From 76266e0d139eaffcb3b61c001e1f6fe730765517 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Sat, 16 Mar 2019 11:06:02 +0800 Subject: [PATCH 01/28] add ignore and modified Makefile --- .gitignore | 259 +++++++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 46 +++------- 2 files changed, 269 insertions(+), 36 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..38e7bba --- /dev/null +++ b/.gitignore @@ -0,0 +1,259 @@ +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.txt +*.o + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +project.fragment.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opendb +*.opensdf +*.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb + +# Visual Studio profiler +*.psess +*.vsp +*.vspx +*.sap + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +#*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config +# NuGet v3's project.json files produces more ignoreable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +node_modules/ +orleans.codegen.cs + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions + +# Paket dependency manager +.paket/paket.exe +paket-files/ + +# FAKE - F# Make +.fake/ + +# JetBrains Rider +.idea/ +*.sln.iml + +# CodeRush +.cr/ + +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc diff --git a/Makefile b/Makefile index f04cf96..f0f2ef3 100644 --- a/Makefile +++ b/Makefile @@ -1,40 +1,14 @@ +cc = gcc +prom = MorseCodeTool +deps = $(shell find ./ -name "*.h") +src = $(shell find ./ -name "*.c") +obj = $(src:%.c=%.o) +$(prom): $(obj) + $(cc) -o $(prom) $(obj) -CC = cc - -CFLAGS = -Wall -g - -INCLUDES = - -LFLAGS = - -LIBS = -lm - -#define the C source files -SRCS = main.c morse.c - -#define the C object files -OBJS = $(SRCS:.c=.o) - -#define the executable fiel -MAIN = morsetest - -.PHONY: depend clean - -all: $(MAIN) - @echo the program of \" $(MAIN) \" has been compiled - -$(MAIN): $(OBJS) - $(CC) $(CFLAGS) $(INCLUDES) -o $(MAIN) $(OBJS) $(LFLAGS) $(LIBS) - -# -.c.o: - $(CC) $(CFLAGS) $(INCLUDES) -c $< -o $@ +%.o: %.c $(deps) + $(cc) -c $< -o $@ clean: - $(RM) *.o *~ $(MAIN) - -depend: $(SRCS) - makedepend $(INCLUDES) $^ - -# DO NOT DELETE THIS LINE -- make depend needs it + rm -rf $(obj) $(prom) From 9b63ee19cd9727f60b4a11df1c7ab3755d9ff4cf Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Sat, 16 Mar 2019 13:32:41 +0800 Subject: [PATCH 02/28] adjust the contents --- Makefile | 8 +++++--- morse.h => include/morse.h | 0 main.c => src/main.c | 0 morse.c => src/morse.c | 0 4 files changed, 5 insertions(+), 3 deletions(-) rename morse.h => include/morse.h (100%) rename main.c => src/main.c (100%) rename morse.c => src/morse.c (100%) diff --git a/Makefile b/Makefile index f0f2ef3..9ad32df 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,16 @@ cc = gcc prom = MorseCodeTool -deps = $(shell find ./ -name "*.h") -src = $(shell find ./ -name "*.c") +CFLAGS=-I ./include +deps = $(shell find ./include -name "*.h") +src = $(shell find ./src -name "*.c") obj = $(src:%.c=%.o) $(prom): $(obj) $(cc) -o $(prom) $(obj) %.o: %.c $(deps) - $(cc) -c $< -o $@ + $(cc) $(CFLAGS) -c $< -o $@ + clean: rm -rf $(obj) $(prom) diff --git a/morse.h b/include/morse.h similarity index 100% rename from morse.h rename to include/morse.h diff --git a/main.c b/src/main.c similarity index 100% rename from main.c rename to src/main.c diff --git a/morse.c b/src/morse.c similarity index 100% rename from morse.c rename to src/morse.c From 0605a4b52b97f465ce5580079410a2d101640bd2 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Sat, 16 Mar 2019 14:25:57 +0800 Subject: [PATCH 03/28] add license infos in source files --- Makefile | 2 +- include/morse.h | 53 +++++++++++++++++++++++++++++ src/main.c | 36 -------------------- src/morse.c | 57 +++++++++++++++++++++++++++++-- src/test.c | 89 +++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 198 insertions(+), 39 deletions(-) delete mode 100644 src/main.c create mode 100644 src/test.c diff --git a/Makefile b/Makefile index 9ad32df..9b64bd1 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ cc = gcc -prom = MorseCodeTool +prom = MorseCodeTest CFLAGS=-I ./include deps = $(shell find ./include -name "*.h") src = $(shell find ./src -name "*.c") diff --git a/include/morse.h b/include/morse.h index 997b4f7..5aacd01 100644 --- a/include/morse.h +++ b/include/morse.h @@ -1,3 +1,56 @@ +/* + + morse-encode-and-decode + Copyright (C) 2019 Joker2770 + Copyright (C) {years} robert1207 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + +*/ + #ifndef MORSE_H_ #define MORSE_H_ diff --git a/src/main.c b/src/main.c deleted file mode 100644 index be0b98c..0000000 --- a/src/main.c +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include -#include - -#include "morse.h" - -#define BUF_LEN 300 - - -int main() { - - char *mystr = "abcdefghijklmnopqrstuvwxyz0123456789.:,;?='/!-_\"()$&@"; - char mor[BUF_LEN]; - char str[BUF_LEN]; - char out[BUF_LEN]; - memset(out, 0, BUF_LEN); - memset(mor, 0, BUF_LEN); - memset(str, 0, BUF_LEN); - - printf("base string:\n%s\n", mystr); - - //TO LOWCASE - str2lowcase(mystr, out, BUF_LEN); - - //TO MORSE STRING - String2MorseString(out , mor, BUF_LEN); - printf("\nget morse code string:\n%s\n" , mor); - - - //TO NORMAL STRING - MorseString2String(mor, str, BUF_LEN); - printf("\nget decode string:\n%s\n", str); - - return 0; -} - diff --git a/src/morse.c b/src/morse.c index d94da1d..57945de 100644 --- a/src/morse.c +++ b/src/morse.c @@ -1,3 +1,56 @@ +/* + + morse-encode-and-decode + Copyright (C) 2019 Joker2770 + Copyright (C) {years} robert1207 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + +*/ + #include "morse.h" #include @@ -204,10 +257,10 @@ void MorseString2String(char *morse ,char *string, int buf_len) { else if (morse[a] == SEPARATOR && morse[a-1] != FAKE_SPACE) {//get one charactor if (true == morse2str(temp, &ch) && b < 5) { string[c++] = ch; - } else if (true == morse2num(temp, &ch)) { - string[c++] = ch; } else if (true == morse2mark(temp, &ch)) { string[c++] = ch; + } else if (true == morse2num(temp, &ch)) { + string[c++] = ch; } else { printf("has morse that not be decoded !\n"); } diff --git a/src/test.c b/src/test.c new file mode 100644 index 0000000..ebc6306 --- /dev/null +++ b/src/test.c @@ -0,0 +1,89 @@ +/* + + morse-encode-and-decode + Copyright (C) 2019 Joker2770 + Copyright (C) {years} robert1207 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + {signature of Ty Coon}, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. + +*/ + +#include +#include +#include + +#include "morse.h" + +#define BUF_LEN 300 + + +int main() { + + char *mystr = "abcdefghijklmnopqrstuvwxyz0123456789.:,;?='/!-_\"()$&@"; + char mor[BUF_LEN]; + char str[BUF_LEN]; + char out[BUF_LEN]; + memset(out, 0, BUF_LEN); + memset(mor, 0, BUF_LEN); + memset(str, 0, BUF_LEN); + + printf("base string:\n%s\n", mystr); + + //TO LOWCASE + str2lowcase(mystr, out, BUF_LEN); + + //TO MORSE STRING + String2MorseString(out , mor, BUF_LEN); + printf("\nget morse code string:\n%s\n" , mor); + + + //TO NORMAL STRING + MorseString2String(mor, str, BUF_LEN); + printf("\nget decode string:\n%s\n", str); + + return 0; +} + From b0e0e035e40d3541d460625495792ed2a2bedeb1 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Sat, 16 Mar 2019 14:29:01 +0800 Subject: [PATCH 04/28] modified README info --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3eed175..5169436 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# morse_encode +# morse-encode-and-decode morse encode and decode From 1ec8eb25283340050aaa484dff94595672b395f8 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Sun, 17 Mar 2019 12:29:14 +0800 Subject: [PATCH 05/28] modified Makefile to generate so library --- .gitignore | 1 + Makefile | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 38e7bba..3aaa3b2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ # User-specific files *.txt *.o +*.so # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs diff --git a/Makefile b/Makefile index 9b64bd1..a654849 100644 --- a/Makefile +++ b/Makefile @@ -3,14 +3,13 @@ prom = MorseCodeTest CFLAGS=-I ./include deps = $(shell find ./include -name "*.h") src = $(shell find ./src -name "*.c") -obj = $(src:%.c=%.o) +obj = $(src:%.c=%.so) $(prom): $(obj) $(cc) -o $(prom) $(obj) -%.o: %.c $(deps) - $(cc) $(CFLAGS) -c $< -o $@ - +%.so: %.c $(deps) + $(cc) $(CFLAGS) -Wall -g -fPIC -o $@ -c $< clean: rm -rf $(obj) $(prom) From ee6d3875edb993b0ce80ffbd9c6be2ef6276ee65 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Sun, 17 Mar 2019 12:37:20 +0800 Subject: [PATCH 06/28] modified Makefile to link to so library --- .gitignore | 1 + Makefile | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 3aaa3b2..88543d6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ *.txt *.o *.so +MorseCodeTest # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs diff --git a/Makefile b/Makefile index a654849..0c19c15 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ $(prom): $(obj) $(cc) -o $(prom) $(obj) %.so: %.c $(deps) - $(cc) $(CFLAGS) -Wall -g -fPIC -o $@ -c $< + $(cc) $(CFLAGS) -Wall -g -fPIC -shared -o $@ -c $< clean: rm -rf $(obj) $(prom) From 5285b9e22faaac806131bd91ffe9cc8cb85a4327 Mon Sep 17 00:00:00 2001 From: joker2770 <1214220480@qq.com> Date: Mon, 12 Aug 2019 10:56:41 +0800 Subject: [PATCH 07/28] add snap build --- SnapBuild/snap/snapcraft.yaml | 17 ++++++++ src/test.c | 75 ++++++++++++++++++++++++++++------- 2 files changed, 78 insertions(+), 14 deletions(-) create mode 100644 SnapBuild/snap/snapcraft.yaml diff --git a/SnapBuild/snap/snapcraft.yaml b/SnapBuild/snap/snapcraft.yaml new file mode 100644 index 0000000..4a1fe11 --- /dev/null +++ b/SnapBuild/snap/snapcraft.yaml @@ -0,0 +1,17 @@ +name: morse-encode-and-decode # you probably want to 'snapcraft register ' +version: '0.2' # just for humans, typically '1.2+git' or '1.3.2' +summary: Coding or decoding with morse # 79 char long summary +description: | + A simple command-line tool, create by Joker2770. + +grade: stable # must be 'stable' to release into candidate/stable channels +confinement: strict # use 'strict' once you have the right plugs and slots + +apps: + morse-encode-and-decode: + command: bin/morse-encode-and-decode + +parts: + morse-encode-and-decode: + # See 'snapcraft plugins' + plugin: dump diff --git a/src/test.c b/src/test.c index ebc6306..6a7f7dd 100644 --- a/src/test.c +++ b/src/test.c @@ -60,30 +60,77 @@ Public License instead of this License. #define BUF_LEN 300 -int main() { +int main(int argc, char **argv) { + + if(argc < 2) + { + printf( + "\n--list (-l) List command." + "\n--encode (-e) Encode string. e.g, MorseCodeTest -e \"Hello world!\"" + "\n--decode (-d) Decode Morse code. e.g, MorseCodeTest -d \".- -... -.-. \"" + "\n\n"); + exit(0); + } - char *mystr = "abcdefghijklmnopqrstuvwxyz0123456789.:,;?='/!-_\"()$&@"; char mor[BUF_LEN]; char str[BUF_LEN]; char out[BUF_LEN]; - memset(out, 0, BUF_LEN); - memset(mor, 0, BUF_LEN); - memset(str, 0, BUF_LEN); - printf("base string:\n%s\n", mystr); + if(strcmp(*(argv+1), "-l") == 0 || strcmp(*(argv+1), "--list") == 0) + { - //TO LOWCASE - str2lowcase(mystr, out, BUF_LEN); + char *mystr = "abcdefghijklmnopqrstuvwxyz0123456789.:,;?='/!-_\"()$&@"; + memset(out, 0, BUF_LEN); + memset(mor, 0, BUF_LEN); + memset(str, 0, BUF_LEN); + + printf("base string:\n%s\n", mystr); + + //TO LOWCASE + str2lowcase(mystr, out, BUF_LEN); - //TO MORSE STRING - String2MorseString(out , mor, BUF_LEN); - printf("\nget morse code string:\n%s\n" , mor); + //TO MORSE STRING + String2MorseString(out , mor, BUF_LEN); + printf("\nget morse code string:\n%s\n" , mor); - //TO NORMAL STRING - MorseString2String(mor, str, BUF_LEN); - printf("\nget decode string:\n%s\n", str); + //TO NORMAL STRING + MorseString2String(mor, str, BUF_LEN); + printf("\nget decode string:\n%s\n", str); + } + if(strcmp(*(argv+1), "--encode") == 0 || strcmp(*(argv+1), "-e") == 0) + { + memset(out, 0, BUF_LEN); + memset(mor, 0, BUF_LEN); + memset(str, 0, BUF_LEN); + + printf("base string:\n%s\n", *(argv+2)); + + //TO LOWCASE + str2lowcase(*(argv+2), out, BUF_LEN); + + //TO MORSE STRING + String2MorseString(out , mor, BUF_LEN); + printf("\nget morse code string:\n%s\n" , mor); + + } + + if(strcmp(*(argv+1), "--decode") == 0 || strcmp(*(argv+1), "-d") == 0) + { + memset(out, 0, BUF_LEN); + memset(mor, 0, BUF_LEN); + memset(str, 0, BUF_LEN); + + printf("base string:\n%s\n", *(argv+2)); + + //TO NORMAL STRING + MorseString2String(*(argv+2), str, BUF_LEN); + printf("\nget decode string:\n%s\n", str); + + } + + return 0; } From cad72be80574abd646334efadb624cb3ba7dae15 Mon Sep 17 00:00:00 2001 From: joker2770 <1214220480@qq.com> Date: Mon, 12 Aug 2019 14:41:00 +0800 Subject: [PATCH 08/28] modified yaml summary --- SnapBuild/snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SnapBuild/snap/snapcraft.yaml b/SnapBuild/snap/snapcraft.yaml index 4a1fe11..a776d87 100644 --- a/SnapBuild/snap/snapcraft.yaml +++ b/SnapBuild/snap/snapcraft.yaml @@ -1,6 +1,6 @@ name: morse-encode-and-decode # you probably want to 'snapcraft register ' version: '0.2' # just for humans, typically '1.2+git' or '1.3.2' -summary: Coding or decoding with morse # 79 char long summary +summary: Encoding or decoding with morse # 79 char long summary description: | A simple command-line tool, create by Joker2770. From 92ab60e1cfea9839eeeff2e50e7fec0a86e5569e Mon Sep 17 00:00:00 2001 From: joker2770 <1214220480@qq.com> Date: Sat, 29 Feb 2020 12:10:44 +0800 Subject: [PATCH 09/28] feat: add install function in Makefile. :zap: --- Makefile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0c19c15..1cc5834 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ cc = gcc -prom = MorseCodeTest +prom = morse-encode-and-decode CFLAGS=-I ./include deps = $(shell find ./include -name "*.h") src = $(shell find ./src -name "*.c") @@ -13,3 +13,6 @@ $(prom): $(obj) clean: rm -rf $(obj) $(prom) + +install: + cp $(prom) /usr/local/bin \ No newline at end of file From 7e4885f5a88b217b9b6064a083074995ba446d8f Mon Sep 17 00:00:00 2001 From: joker2770 <1214220480@qq.com> Date: Sat, 29 Feb 2020 12:44:45 +0800 Subject: [PATCH 10/28] script: modify source. :rocket: --- snap/gui/icon.png | Bin 0 -> 11217 bytes {SnapBuild/snap => snap}/snapcraft.yaml | 17 ++++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 snap/gui/icon.png rename {SnapBuild/snap => snap}/snapcraft.yaml (55%) diff --git a/snap/gui/icon.png b/snap/gui/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..d5200150cd83c7bbb1a08793f0b4a1cbc87cd676 GIT binary patch literal 11217 zcmdUVXH-*B(=JGh^oT&{BnU_cl@39gph&UMJBaiqJrwDLUKNxkf}qku3rN#Q2LYu8 z2%#4tbO^oNsPDJdcYoZw?!UXfALnG9oPB1`E;IAYGdosKM}vlvm6C{vh~~bg+GE1+ z`kxCxPPqFGKe$f#A@+K#p+ZzKz`ja&AhlQ4Rwg2ZV}0IY1?$>aJdbx866}aFD7n zJq;v0^dnH7N$nB0O

JIWVv-ZZqHh94bFEF(7+rwwY^9cNm;5?cD2Bb8t9N|GfWg zUFGeo;Z}FxRuNWe|FdsdfvAh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7Z z*MXnjM~U8V^KEQbygS(2i=S<0&~-`dZ@hn}RY?=%3ry~nd*Yk8Q(Ga{v0DjTcZ!bC zF8faR``Ylhb%WVh6|LGjk3QksE2wJHWmCc#A*2d72}RAIkhP2!=^ACqI**Bp!q#h3 zHx^Wd8~4+uworTHv8&Hr&6(!-sM|Wa-}a`sGCe^*KQbh_pcf`!Bky=eJr#$;qd1`o zqo1<`Dc_uxDa2@GJCC|urUJSg8r$Q;qUqX7`>L$>!^{1;#m$V9XbPEK=*#Z^&ps&n hziWRd>){1mFV5U%(=EA)a158|zPgTDg^E@9{{rzUzPSJZ literal 0 HcmV?d00001 diff --git a/SnapBuild/snap/snapcraft.yaml b/snap/snapcraft.yaml similarity index 55% rename from SnapBuild/snap/snapcraft.yaml rename to snap/snapcraft.yaml index a776d87..680bd5f 100644 --- a/SnapBuild/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,17 +1,28 @@ name: morse-encode-and-decode # you probably want to 'snapcraft register ' -version: '0.2' # just for humans, typically '1.2+git' or '1.3.2' +version: '0.4' # just for humans, typically '1.2+git' or '1.3.2' summary: Encoding or decoding with morse # 79 char long summary description: | A simple command-line tool, create by Joker2770. - +icon: gui/icon.png grade: stable # must be 'stable' to release into candidate/stable channels confinement: strict # use 'strict' once you have the right plugs and slots apps: morse-encode-and-decode: - command: bin/morse-encode-and-decode + command: morse-encode-and-decode parts: morse-encode-and-decode: # See 'snapcraft plugins' + plugin: make + source: https://github.com/Joker2770/morse-encode-and-decode.git + source-type: git + source-branch: master + source-depth: 1 + # source: ../ + artifacts: [morse-encode-and-decode] + + env: plugin: dump + organize: + ./morse-encode-and-decode: /bin/morse-encode-and-decode \ No newline at end of file From fed87b764ef97d6b01538f90ff1fb842cd965d71 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Sat, 29 Feb 2020 15:34:35 +0800 Subject: [PATCH 11/28] fix: fix menu display. :bug: --- src/test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test.c b/src/test.c index 6a7f7dd..886f892 100644 --- a/src/test.c +++ b/src/test.c @@ -66,8 +66,8 @@ int main(int argc, char **argv) { { printf( "\n--list (-l) List command." - "\n--encode (-e) Encode string. e.g, MorseCodeTest -e \"Hello world!\"" - "\n--decode (-d) Decode Morse code. e.g, MorseCodeTest -d \".- -... -.-. \"" + "\n--encode (-e) Encode string. e.g, morse-encode-and-decode -e \"Hello world!\"" + "\n--decode (-d) Decode Morse code. e.g, morse-encode-and-decode -d \".- -... -.-. \"" "\n\n"); exit(0); } From d52d01fdc3ebdc136741aedc4969c8d385f03f08 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Sat, 29 Feb 2020 15:50:18 +0800 Subject: [PATCH 12/28] fix: fix display. --- src/test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test.c b/src/test.c index 886f892..bbba90f 100644 --- a/src/test.c +++ b/src/test.c @@ -66,8 +66,8 @@ int main(int argc, char **argv) { { printf( "\n--list (-l) List command." - "\n--encode (-e) Encode string. e.g, morse-encode-and-decode -e \"Hello world!\"" - "\n--decode (-d) Decode Morse code. e.g, morse-encode-and-decode -d \".- -... -.-. \"" + "\n--encode (-e) Encode string. e.g.: morse-encode-and-decode -e \"Hello world!\"" + "\n--decode (-d) Decode Morse code. e.g.: morse-encode-and-decode -d \".- -... -.-. \"" "\n\n"); exit(0); } From aebbf2980224c3a26c00cefbee404f8818f8a8af Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Sat, 29 Feb 2020 19:03:55 +0800 Subject: [PATCH 13/28] style: remove icon define. :fire: --- snap/snapcraft.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 680bd5f..903cf74 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -3,7 +3,9 @@ version: '0.4' # just for humans, typically '1.2+git' or '1.3.2' summary: Encoding or decoding with morse # 79 char long summary description: | A simple command-line tool, create by Joker2770. -icon: gui/icon.png + +# icon: gui/icon.png + grade: stable # must be 'stable' to release into candidate/stable channels confinement: strict # use 'strict' once you have the right plugs and slots From 9f77ad763c4a0fe213b574f767729db763b099e3 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Tue, 3 Mar 2020 20:08:42 +0800 Subject: [PATCH 14/28] style: fix table display. :rocket: --- src/test.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/test.c b/src/test.c index bbba90f..87331e8 100644 --- a/src/test.c +++ b/src/test.c @@ -65,7 +65,7 @@ int main(int argc, char **argv) { if(argc < 2) { printf( - "\n--list (-l) List command." + "\n--list (-l) List morse code table." "\n--encode (-e) Encode string. e.g.: morse-encode-and-decode -e \"Hello world!\"" "\n--decode (-d) Decode Morse code. e.g.: morse-encode-and-decode -d \".- -... -.-. \"" "\n\n"); @@ -84,19 +84,21 @@ int main(int argc, char **argv) { memset(mor, 0, BUF_LEN); memset(str, 0, BUF_LEN); - printf("base string:\n%s\n", mystr); - //TO LOWCASE str2lowcase(mystr, out, BUF_LEN); + + char szTmpOne[4] = ""; + unsigned int i = 0; + for(i = 0; i < strlen(mystr); i++) + { + memset(szTmpOne, 0, sizeof(szTmpOne)); + sprintf(szTmpOne, "%c", out[i]); + printf("\t%c\t", out[i]); - //TO MORSE STRING - String2MorseString(out , mor, BUF_LEN); - printf("\nget morse code string:\n%s\n" , mor); - - - //TO NORMAL STRING - MorseString2String(mor, str, BUF_LEN); - printf("\nget decode string:\n%s\n", str); + //TO MORSE STRING + String2MorseString(szTmpOne , mor, BUF_LEN); + printf("%s\n" , mor); + } } if(strcmp(*(argv+1), "--encode") == 0 || strcmp(*(argv+1), "-e") == 0) From 25f0759f55fcbe99ee521177b534c6013d197210 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Wed, 4 Mar 2020 15:40:14 +0800 Subject: [PATCH 15/28] docs: add usage. :memo: --- README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/README.md b/README.md index 5169436..04de94f 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,31 @@ # morse-encode-and-decode morse encode and decode + +## Build +Required: +* make +* gcc + +Step: +~~~ +git clone https://github.com/Joker2770/morse-encode-and-decode.git +cd morse-encode-and-decode +make +./morse-encode-and-decode +sudo make install +morse-encode-and-decode +~~~ + +## Usage +morse-encode-and-decode -l +morse-encode-and-decode {-e|-d} {} + +~~~ + + --list (-l) List morse code table. + + --encode (-e) Encode string. e.g.: morse-encode-and-decode -e "Hello world!" + + --decode (-d) Decode Morse code. e.g.: morse-encode-and-decode -d ".- -... -.-. " + +~~~ \ No newline at end of file From 9b9b57cffdf0313f633f6ae7b8763d54cf408389 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Wed, 4 Mar 2020 15:43:12 +0800 Subject: [PATCH 16/28] fix: modify README.MD display. :memo: --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 04de94f..71a0bd6 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,9 @@ morse-encode-and-decode ~~~ ## Usage -morse-encode-and-decode -l -morse-encode-and-decode {-e|-d} {} + +**morse-encode-and-decode -l** +**morse-encode-and-decode {-e|-d} {}** ~~~ From 93f16f1492c6cd75868a75ce63e19e921e01edbb Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Wed, 4 Mar 2020 16:54:53 +0800 Subject: [PATCH 17/28] docs: line feed. :zap: --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 71a0bd6..39bc0e4 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ morse-encode-and-decode ## Usage -**morse-encode-and-decode -l** -**morse-encode-and-decode {-e|-d} {}** +**morse-encode-and-decode -l**
+**morse-encode-and-decode {-e|-d} {}**
~~~ From bd171a68c85bfb458732c09a19d14655fa8420a9 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Wed, 4 Mar 2020 16:56:33 +0800 Subject: [PATCH 18/28] docs: fix. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 39bc0e4..f32f56b 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ morse-encode-and-decode ## Usage **morse-encode-and-decode -l**
-**morse-encode-and-decode {-e|-d} {}**
+**morse-encode-and-decode {-e|-d} {\}**
~~~ From c86e0070e326279e694f04937bea1da01507b29f Mon Sep 17 00:00:00 2001 From: joker2770 <1214220480@qq.com> Date: Thu, 5 Mar 2020 10:05:30 +0800 Subject: [PATCH 19/28] perf: change syntax. :zap: --- snap/snapcraft.yaml | 2 +- src/test.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 903cf74..3bb1165 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -2,7 +2,7 @@ name: morse-encode-and-decode # you probably want to 'snapcraft register ' version: '0.4' # just for humans, typically '1.2+git' or '1.3.2' summary: Encoding or decoding with morse # 79 char long summary description: | - A simple command-line tool, create by Joker2770. + A simple command-line tool, create by Joker2770< https://github.com/Joker2770/morse-encode-and-decode >. # icon: gui/icon.png diff --git a/src/test.c b/src/test.c index 87331e8..7ed4f3b 100644 --- a/src/test.c +++ b/src/test.c @@ -1,7 +1,7 @@ /* morse-encode-and-decode - Copyright (C) 2019 Joker2770 + Copyright (C) 2019-2020 Joker2770 Copyright (C) {years} robert1207 This program is free software; you can redistribute it and/or modify @@ -62,7 +62,7 @@ Public License instead of this License. int main(int argc, char **argv) { - if(argc < 2) + if(argc < 2 || 0 == strcmp(*(argv+1), "-h") || 0 == strcmp(*(argv+1), "--help")) { printf( "\n--list (-l) List morse code table." @@ -72,11 +72,11 @@ int main(int argc, char **argv) { exit(0); } - char mor[BUF_LEN]; - char str[BUF_LEN]; - char out[BUF_LEN]; + char mor[BUF_LEN] = ""; + char str[BUF_LEN] = ""; + char out[BUF_LEN] = ""; - if(strcmp(*(argv+1), "-l") == 0 || strcmp(*(argv+1), "--list") == 0) + if(0 == strcmp(*(argv+1), "-l") || 0 == strcmp(*(argv+1), "--list")) { char *mystr = "abcdefghijklmnopqrstuvwxyz0123456789.:,;?='/!-_\"()$&@"; @@ -101,7 +101,7 @@ int main(int argc, char **argv) { } } - if(strcmp(*(argv+1), "--encode") == 0 || strcmp(*(argv+1), "-e") == 0) + if(0 == strcmp(*(argv+1), "--encode") || 0 == strcmp(*(argv+1), "-e")) { memset(out, 0, BUF_LEN); memset(mor, 0, BUF_LEN); @@ -118,7 +118,7 @@ int main(int argc, char **argv) { } - if(strcmp(*(argv+1), "--decode") == 0 || strcmp(*(argv+1), "-d") == 0) + if(0 == strcmp(*(argv+1), "--decode") || 0 == strcmp(*(argv+1), "-d")) { memset(out, 0, BUF_LEN); memset(mor, 0, BUF_LEN); From d0a33f69faba9cd34533e7806c110a4d864f9415 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Thu, 14 May 2020 13:21:51 +0800 Subject: [PATCH 20/28] fix: some charactors encode :bug: --- snap/snapcraft.yaml | 2 +- src/test.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 3bb1165..f1901c5 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: morse-encode-and-decode # you probably want to 'snapcraft register ' -version: '0.4' # just for humans, typically '1.2+git' or '1.3.2' +version: '0.5' # just for humans, typically '1.2+git' or '1.3.2' summary: Encoding or decoding with morse # 79 char long summary description: | A simple command-line tool, create by Joker2770< https://github.com/Joker2770/morse-encode-and-decode >. diff --git a/src/test.c b/src/test.c index 7ed4f3b..c95b0df 100644 --- a/src/test.c +++ b/src/test.c @@ -91,6 +91,7 @@ int main(int argc, char **argv) { unsigned int i = 0; for(i = 0; i < strlen(mystr); i++) { + memset(mor, 0, BUF_LEN); memset(szTmpOne, 0, sizeof(szTmpOne)); sprintf(szTmpOne, "%c", out[i]); printf("\t%c\t", out[i]); From e8e95704e48584a16db90e978f6a4521f5c95bc5 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Tue, 6 Oct 2020 16:18:29 +0800 Subject: [PATCH 21/28] style: modify menu and compile script. :arrow_up: --- .gitignore | 2 +- Makefile | 4 ++-- snap/snapcraft.yaml | 10 +++++----- src/{test.c => main.c} | 23 +++++++++++++---------- 4 files changed, 21 insertions(+), 18 deletions(-) rename src/{test.c => main.c} (82%) diff --git a/.gitignore b/.gitignore index 88543d6..6323394 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,7 @@ *.txt *.o *.so -MorseCodeTest +*morse-encode-and-decode # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs diff --git a/Makefile b/Makefile index 1cc5834..837e18d 100644 --- a/Makefile +++ b/Makefile @@ -3,12 +3,12 @@ prom = morse-encode-and-decode CFLAGS=-I ./include deps = $(shell find ./include -name "*.h") src = $(shell find ./src -name "*.c") -obj = $(src:%.c=%.so) +obj = $(src:%.c=%.o) $(prom): $(obj) $(cc) -o $(prom) $(obj) -%.so: %.c $(deps) +%.o: %.c $(deps) $(cc) $(CFLAGS) -Wall -g -fPIC -shared -o $@ -c $< clean: diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index f1901c5..fbb68ac 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: morse-encode-and-decode # you probably want to 'snapcraft register ' -version: '0.5' # just for humans, typically '1.2+git' or '1.3.2' +version: '0.6' # just for humans, typically '1.2+git' or '1.3.2' summary: Encoding or decoding with morse # 79 char long summary description: | A simple command-line tool, create by Joker2770< https://github.com/Joker2770/morse-encode-and-decode >. @@ -24,7 +24,7 @@ parts: # source: ../ artifacts: [morse-encode-and-decode] - env: - plugin: dump - organize: - ./morse-encode-and-decode: /bin/morse-encode-and-decode \ No newline at end of file + # env: + # plugin: dump + # organize: + # ./morse-encode-and-decode: /bin/morse-encode-and-decode \ No newline at end of file diff --git a/src/test.c b/src/main.c similarity index 82% rename from src/test.c rename to src/main.c index c95b0df..9403139 100644 --- a/src/test.c +++ b/src/main.c @@ -62,12 +62,13 @@ Public License instead of this License. int main(int argc, char **argv) { - if(argc < 2 || 0 == strcmp(*(argv+1), "-h") || 0 == strcmp(*(argv+1), "--help")) + if(argc < 2 || 0 == strcmp(*(argv+1), "-h") || 0 == strcmp(*(argv+1), "-H") || 0 == strcmp(*(argv+1), "--help")) { printf( - "\n--list (-l) List morse code table." - "\n--encode (-e) Encode string. e.g.: morse-encode-and-decode -e \"Hello world!\"" - "\n--decode (-d) Decode Morse code. e.g.: morse-encode-and-decode -d \".- -... -.-. \"" + "\n--list (-l) List morse code table." + "\n--version (-v) show current version." + "\n--encode (-e) Encode string. e.g.: morse-encode-and-decode -e \"Hello world!\"" + "\n--decode (-d) Decode Morse code. e.g.: morse-encode-and-decode -d \".- -... -.-. \"" "\n\n"); exit(0); } @@ -76,7 +77,7 @@ int main(int argc, char **argv) { char str[BUF_LEN] = ""; char out[BUF_LEN] = ""; - if(0 == strcmp(*(argv+1), "-l") || 0 == strcmp(*(argv+1), "--list")) + if(0 == strcmp(*(argv+1), "-l") || 0 == strcmp(*(argv+1), "-L") || 0 == strcmp(*(argv+1), "--list")) { char *mystr = "abcdefghijklmnopqrstuvwxyz0123456789.:,;?='/!-_\"()$&@"; @@ -101,8 +102,7 @@ int main(int argc, char **argv) { printf("%s\n" , mor); } } - - if(0 == strcmp(*(argv+1), "--encode") || 0 == strcmp(*(argv+1), "-e")) + else if(0 == strcmp(*(argv+1), "--encode") || 0 == strcmp(*(argv+1), "-e") || 0 == strcmp(*(argv+1), "-E")) { memset(out, 0, BUF_LEN); memset(mor, 0, BUF_LEN); @@ -118,8 +118,7 @@ int main(int argc, char **argv) { printf("\nget morse code string:\n%s\n" , mor); } - - if(0 == strcmp(*(argv+1), "--decode") || 0 == strcmp(*(argv+1), "-d")) + else if(0 == strcmp(*(argv+1), "--decode") || 0 == strcmp(*(argv+1), "-d") || 0 == strcmp(*(argv+1), "-D")) { memset(out, 0, BUF_LEN); memset(mor, 0, BUF_LEN); @@ -131,8 +130,12 @@ int main(int argc, char **argv) { MorseString2String(*(argv+2), str, BUF_LEN); printf("\nget decode string:\n%s\n", str); - } + } + if (0 == strcmp(*(argv+1), "--version") || 0 == strcmp(*(argv+1), "-v") || 0 == strcmp(*(argv+1), "-V")) + { + printf("v0.6\n"); + } return 0; } From 589ae39a47fc4be3630d3560984f2d5faad4f19f Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Thu, 19 Nov 2020 10:08:07 +0800 Subject: [PATCH 22/28] add cmake to compile. --- .gitignore | 1 + Makefile | 8 ++++---- {include => src}/morse.h | 0 3 files changed, 5 insertions(+), 4 deletions(-) rename {include => src}/morse.h (100%) diff --git a/.gitignore b/.gitignore index 6323394..e89b189 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,7 @@ x64/ x86/ bld/ [Bb]in/ +[Bb]uild/ [Oo]bj/ [Ll]og/ diff --git a/Makefile b/Makefile index 837e18d..20b57b3 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,6 @@ cc = gcc prom = morse-encode-and-decode -CFLAGS=-I ./include -deps = $(shell find ./include -name "*.h") +deps = $(shell find ./src -name "*.h") src = $(shell find ./src -name "*.c") obj = $(src:%.c=%.o) @@ -9,10 +8,11 @@ $(prom): $(obj) $(cc) -o $(prom) $(obj) %.o: %.c $(deps) - $(cc) $(CFLAGS) -Wall -g -fPIC -shared -o $@ -c $< + $(cc) -Wall -g -fPIC -shared -o $@ -c $< clean: rm -rf $(obj) $(prom) install: - cp $(prom) /usr/local/bin \ No newline at end of file + cp $(prom) /usr/local/bin + diff --git a/include/morse.h b/src/morse.h similarity index 100% rename from include/morse.h rename to src/morse.h From 33706e7fe56189ede4699ecd87de77a2eb2746a2 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Thu, 19 Nov 2020 10:14:00 +0800 Subject: [PATCH 23/28] initial cmake script. --- .gitignore | 1 - CMakeLists.txt | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 CMakeLists.txt diff --git a/.gitignore b/.gitignore index e89b189..2de53f9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ ## files generated by popular Visual Studio add-ons. # User-specific files -*.txt *.o *.so *morse-encode-and-decode diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..23ab545 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.10) + +project(morse-encode-and-decode) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_C_FLAGS, "-Wall") + +if(CMAKE_CONFIGURATION_TYPES) + set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "My multi config types" FORCE) +elseif(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE RELEASE) +endif() + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) +file(GLOB SRCS "src/*.c" "src/*.h") +add_executable(${PROJECT_NAME} ${SRCS}) + +if(UNIX) + set(CMAKE_INSTALL_PREFIX /usr/local) + install(TARGETS ${PROJECT_NAME} DESTINATION bin) +elseif(WIN32) + set(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/") + install(TARGETS ${PROJECT_NAME} DESTINATION bin) +endif() From e8befb8c56aaa393212f451670861ec6975565d2 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Thu, 19 Nov 2020 10:57:10 +0800 Subject: [PATCH 24/28] perf: expend BUF_LEN to 512. :arrow_up: --- snap/snapcraft.yaml | 5 +++-- src/main.c | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index fbb68ac..cfbb199 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: morse-encode-and-decode # you probably want to 'snapcraft register ' -version: '0.6' # just for humans, typically '1.2+git' or '1.3.2' +version: '0.7' # just for humans, typically '1.2+git' or '1.3.2' summary: Encoding or decoding with morse # 79 char long summary description: | A simple command-line tool, create by Joker2770< https://github.com/Joker2770/morse-encode-and-decode >. @@ -27,4 +27,5 @@ parts: # env: # plugin: dump # organize: - # ./morse-encode-and-decode: /bin/morse-encode-and-decode \ No newline at end of file + # ./morse-encode-and-decode: /bin/morse-encode-and-decode + diff --git a/src/main.c b/src/main.c index 9403139..ec07e53 100644 --- a/src/main.c +++ b/src/main.c @@ -57,7 +57,7 @@ Public License instead of this License. #include "morse.h" -#define BUF_LEN 300 +#define BUF_LEN 512 int main(int argc, char **argv) { @@ -134,7 +134,7 @@ int main(int argc, char **argv) { if (0 == strcmp(*(argv+1), "--version") || 0 == strcmp(*(argv+1), "-v") || 0 == strcmp(*(argv+1), "-V")) { - printf("v0.6\n"); + printf("v0.7\n"); } return 0; From 3a427b7fc2dc7be3470de9cacf6ffce46379f4f8 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Fri, 4 Dec 2020 14:22:25 +0800 Subject: [PATCH 25/28] just rebuild for snapcraft security. --- .gitignore | 3 +++ CMakeLists.txt | 1 + 2 files changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 2de53f9..f72c0c9 100644 --- a/.gitignore +++ b/.gitignore @@ -259,3 +259,6 @@ paket-files/ # Python Tools for Visual Studio (PTVS) __pycache__/ *.pyc + +.vs/ +.vscode/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 23ab545..f58ae2d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(morse-encode-and-decode) set(CMAKE_CXX_STANDARD 11) set(CMAKE_C_FLAGS, "-Wall") +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) if(CMAKE_CONFIGURATION_TYPES) set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "My multi config types" FORCE) From bc629cdfb9bff767970d63efcd752767d57090a9 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Tue, 3 Aug 2021 14:35:50 +0800 Subject: [PATCH 26/28] fix: syntax error. :bookmark: --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index cfbb199..bdb22db 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -2,7 +2,7 @@ name: morse-encode-and-decode # you probably want to 'snapcraft register ' version: '0.7' # just for humans, typically '1.2+git' or '1.3.2' summary: Encoding or decoding with morse # 79 char long summary description: | - A simple command-line tool, create by Joker2770< https://github.com/Joker2770/morse-encode-and-decode >. + A simple command-line tool, created by Joker2770< https://github.com/Joker2770/morse-encode-and-decode >. # icon: gui/icon.png From e694d1ef95605270c40d9585e085c57e98f9b8d0 Mon Sep 17 00:00:00 2001 From: Joker2770 <1214220480@qq.com> Date: Fri, 16 Sep 2022 13:07:47 +0800 Subject: [PATCH 27/28] fix: syntax error. :art: --- src/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.c b/src/main.c index ec07e53..d7ba893 100644 --- a/src/main.c +++ b/src/main.c @@ -66,9 +66,9 @@ int main(int argc, char **argv) { { printf( "\n--list (-l) List morse code table." - "\n--version (-v) show current version." - "\n--encode (-e) Encode string. e.g.: morse-encode-and-decode -e \"Hello world!\"" - "\n--decode (-d) Decode Morse code. e.g.: morse-encode-and-decode -d \".- -... -.-. \"" + "\n--version (-v) Show current version." + "\n--encode (-e) String to encode. e.g.: morse-encode-and-decode -e \"Hello world!\"" + "\n--decode (-d) String to decode. e.g.: morse-encode-and-decode -d \".- -... -.-. \"" "\n\n"); exit(0); } From 19f3092686dd1c49c1f4f702081bc2290c327554 Mon Sep 17 00:00:00 2001 From: The Codacy Badger Date: Sat, 7 Jan 2023 10:11:57 +0000 Subject: [PATCH 28/28] Add Codacy badge --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index f32f56b..5cd892a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # morse-encode-and-decode + +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/4781e30bba254e4da7ec8373234718d9)](https://app.codacy.com/gh/Joker2770/morse-encode-and-decode?utm_source=github.com&utm_medium=referral&utm_content=Joker2770/morse-encode-and-decode&utm_campaign=Badge_Grade_Settings) + morse encode and decode ## Build