Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
76266e0
add ignore and modified Makefile
Joker2770 Mar 16, 2019
9b63ee1
adjust the contents
Joker2770 Mar 16, 2019
0605a4b
add license infos in source files
Joker2770 Mar 16, 2019
b0e0e03
modified README info
Joker2770 Mar 16, 2019
1ec8eb2
modified Makefile to generate so library
Joker2770 Mar 17, 2019
ee6d387
modified Makefile to link to so library
Joker2770 Mar 17, 2019
5285b9e
add snap build
Joker2770 Aug 12, 2019
cad72be
modified yaml summary
Joker2770 Aug 12, 2019
92ab60e
feat: add install function in Makefile. :zap:
Joker2770 Feb 29, 2020
7e4885f
script: modify source. :rocket:
Joker2770 Feb 29, 2020
fed87b7
fix: fix menu display. :bug:
Joker2770 Feb 29, 2020
d52d01f
fix: fix display.
Joker2770 Feb 29, 2020
aebbf29
style: remove icon define. :fire:
Joker2770 Feb 29, 2020
9f77ad7
style: fix table display. :rocket:
Joker2770 Mar 3, 2020
25f0759
docs: add usage. :memo:
Joker2770 Mar 4, 2020
9b9b57c
fix: modify README.MD display. :memo:
Joker2770 Mar 4, 2020
93f16f1
docs: line feed. :zap:
Joker2770 Mar 4, 2020
bd171a6
docs: fix.
Joker2770 Mar 4, 2020
c86e007
perf: change syntax. :zap:
Joker2770 Mar 5, 2020
d0a33f6
fix: some charactors encode :bug:
Joker2770 May 14, 2020
e8e9570
style: modify menu and compile script. :arrow_up:
Joker2770 Oct 6, 2020
589ae39
add cmake to compile.
Joker2770 Nov 19, 2020
33706e7
initial cmake script.
Joker2770 Nov 19, 2020
e8befb8
perf: expend BUF_LEN to 512. :arrow_up:
Joker2770 Nov 19, 2020
3a427b7
just rebuild for snapcraft security.
Joker2770 Dec 4, 2020
bc629cd
fix: syntax error. :bookmark:
Joker2770 Aug 3, 2021
e694d1e
fix: syntax error. :art:
Joker2770 Sep 16, 2022
19f3092
Add Codacy badge
codacy-badger Jan 7, 2023
fef6d7f
Merge pull request #1 from codacy-badger/codacy-badge
Joker2770 Jan 8, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
264 changes: 264 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.

# User-specific files
*.o
*.so
*morse-encode-and-decode

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Bb]uild/
[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

.vs/
.vscode/
25 changes: 25 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
cmake_minimum_required(VERSION 3.10)

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)
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()
46 changes: 12 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,40 +1,18 @@
cc = gcc
prom = morse-encode-and-decode
deps = $(shell find ./src -name "*.h")
src = $(shell find ./src -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) -Wall -g -fPIC -shared -o $@ -c $<

clean:
$(RM) *.o *~ $(MAIN)
rm -rf $(obj) $(prom)

depend: $(SRCS)
makedepend $(INCLUDES) $^
install:
cp $(prom) /usr/local/bin

# DO NOT DELETE THIS LINE -- make depend needs it
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,35 @@
# morse_encode
# 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
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** <br>
**morse-encode-and-decode {-e|-d} {\<string\>}** <br>

~~~

--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 ".- -... -.-. "

~~~
Loading