Commit Graph

67 Commits

Author SHA1 Message Date
Daniel Santos b34afcd993 cli.c: usage with argv[0]
Instead of printing a usage message with the "numericx" string as a
program name, uses argv[0], better for debugging log readability.

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-05-13 14:15:08 +01:00
Daniel Santos 81f8fd63a8 README.md update
* add library information to README.md
 * fixed some README.md mistakes
 * update doc/

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-21 13:34:36 +00:00
Daniel Santos a6b6c803a0 doc update
Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-19 18:42:30 +00:00
Daniel Santos 23ba97c49b README.md: remove DEBUG flag
* remove `DEBUG` compiler flag text
 * improve some UI of README.md

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-19 18:40:11 +00:00
Daniel Santos dc910012f9 Makefile: include header file in install-lib
* install numericx.h with Makefile rule install-lib

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-19 10:20:24 +00:00
Daniel Santos 6608a8ba67 move between files numeral_ptr struct
* move numeral_ptr struct from numericx.h to numericx.c
 * doc update

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-19 10:01:12 +00:00
Daniel Santos 5c8a3b16c5 doc update
Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-19 08:25:58 +00:00
Daniel Santos 9e89a65676 add to Makefile
* change make into $(MAKE)
 * in compiling libraries, echo message with path
 * create Makefile variables: INSTALL and prefix
 * add rule install-lib

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-19 08:22:20 +00:00
Daniel Santos f5421e7612 replace PROG_NAME with "numericx" literal
* replaced PROG_NAME for string literal "numericx".
 * deleted macro definition of PROG_NAME.

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-19 07:43:14 +00:00
Daniel Santos fcc6c957bf numericx_translate() return true
* numericx_translate() was returning EXIT_SUCCESS in case of success.
   Doohh! Now it is return true, in case of success.

   Ajust doxygen comment accordingly.

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-19 07:35:32 +00:00
Daniel Santos aa172de2cf doc update
Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-18 22:08:25 +00:00
Daniel Santos ff971aaa63 add/update MAkefile
* removed c99 as the c compiler variable
 * add doc rule
 * add build library rules for .a and .so
 * mem2 rule now tests for 000 arg instead of 0
 * clean rule update for libraries
 * add numericx.h dependency to rules

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-18 22:03:33 +00:00
Daniel Santos 6fbbcbd9e1 update gitignore
Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-18 21:59:09 +00:00
Daniel Santos 3020dad2ff README.md change c compiler text
* in README.md change 'c99' compiler to 'cc' compiler

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-18 20:55:41 +00:00
Daniel Santos 32fbc9c08c bugfix: handle number void with any number of cases
* add is_number_void()
 * numericx_translate() was only handling a void number with one digit
   as argument, for example a 0.
   When encontering a void number with more then one digit, the function
   was entering on a infinite cycle.

   Now, with the function is_number_void(), numericx_translate() can
   handle correctly void number with any number of cases. Either with a
   from numerical system that is infinite (0 == 00 == 000 ...)  or if it
   is not (0 is void, 00 is concrete, 000 is concrete, ...)

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-18 20:39:40 +00:00
Daniel Santos a8f50b625c doxygen refactor
* removed doxygen comments from header file
 * change the title of README.md from better understanding in doxygen
   doc
 * removed all files from doc/ and rebuild the doc

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-18 14:59:24 +00:00
Daniel Santos 47d229f3d9 bugfix for numericx_translate() number argument
* numericx_translate() was doing a reverse of the string argument,
   which it cannot. Now the reverse is using a malloced version of the
   string argument.
 * add free() to malloced number from number argument

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 22:01:01 +00:00
Daniel Santos 63a4b2b9bb add to Makefile libnumericx.a
* add libnumericx.a static library building and clearing

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 21:37:08 +00:00
Daniel Santos 8ffc581d8f remove print_numeral()
* remove print_numeral() from numericx.c

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 20:26:42 +00:00
Daniel Santos 0f85f6e016 doc update
Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 19:21:29 +00:00
Daniel Santos 7640bc88a7 gitignore update
* update .gitignore to ignore the *.o and the executable files

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 19:14:12 +00:00
Daniel Santos b7c06abbcf Makefile accomodate separation of concerns
* the source code was, in the last commit, separated, in order to
   create a library. Makes build the CLIs in the Makefile work.
 * make clean cleans the *.o

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 19:09:55 +00:00
Daniel Santos 2bea495fe6 separate into header, implementation and cli
* separate numericx into: numericx.h, numericx.c, cli.c
 * numericx.h is the numericx library header
 * numericx.c is the numericx library implementation
 * cli.c is the numericx command-line program

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 19:09:42 +00:00
Daniel Santos 6752a1a9e2 doc update
Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 17:52:07 +00:00
Daniel Santos fd66c37285 invalid argument list of main() return E2BIG
* If invalid number of arguments supplied to main(), return errno E2BIG
 * add Makefile rule to test memory leak of wrong number of arguments to
   main()

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 14:24:13 +00:00
Daniel Santos 3d304af497 doc update
Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 12:07:06 +00:00
Daniel Santos 4eb78790a9 numericx_translate() not printing message
* numericx_translate() only returns status codes. Instead of returning
   the resulting translated string.
 * add result_string to numericx_translate() arguments, that is the
   variable to where to store the resulting translated string.
 * for the cli program, now the message is delegated to main. Also
   changed the doxygen comments of main().

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 11:56:52 +00:00
Daniel Santos 089a2a899c Makefile more memory rules
* add to Makefile the rules: mem1, mem2 and mem3

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 11:51:42 +00:00
Daniel Santos 30d4aede61 doc update
Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 09:09:14 +00:00
Daniel Santos 327de4f901 update numericx.c comments
Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 09:07:07 +00:00
Daniel Santos 23772dbb14 doc update
Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 07:55:41 +00:00
Daniel Santos a23fe88c3a Makefile fix
* fix sun-to-earth rule, missing -o

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 07:49:49 +00:00
Daniel Santos 2fe995048c make numericx_translate()
* add numericx_free() and numericx_translate()
 * functionality in main() to the minimum, to house the
   numericx_translate() in it

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 07:49:49 +00:00
Daniel Santos 2775a1670c remove DEBUG
* remove debug message printing and the DEBUG variable

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-17 07:49:49 +00:00
Daniel Santos c4bc0ae725 rename doxygen.conf to Doxyfile
Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-16 21:39:09 +00:00
Daniel Santos e4545cb7fd doc update
Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-16 20:04:29 +00:00
Daniel Santos 2952ed7c23 add html symlink for doxygen build
* add html symbolic link pointing to doc/, so that when building the
   doc with doxygen, all documentation goes to doc/

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-16 20:01:12 +00:00
Daniel Santos c6d7a8a26f add Documentation section in README.md
* README.md has a Documentation section with a link to the online
   documentation website

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-16 19:50:28 +00:00
Daniel Santos 9393cea4a4 add submodule doc/
Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-16 16:49:37 +00:00
Daniel Santos b1f890b434 remove html/ for submodule
* remove html/* for the creating on a submodule in this directory, so
   that the documentation can be in a separate branch, for codeberg
   pages

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-16 16:18:42 +00:00
Daniel Santos fdd2142827 update README.md
* text 'console program' to 'command-line interface'

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-16 14:33:18 +00:00
Daniel Santos acc2126757 add doxygen
* transformed comments into doxygen comments and set it's attributes
 * add doxygen.conf file
 * add doxygen html documentation

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-16 14:29:11 +00:00
Daniel Santos b559d657c3 test rule in Makefile
* add tests/earth.sh
 * add to Makefile all the necessary rules for `make test`

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-15 14:34:39 +00:00
Daniel Santos ad3f14edbd better comments and legibility
* add better comments to the code structure
 * on decrement_number_string(), renamed arguments for better legibility

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-14 17:17:00 +00:00
Daniel Santos 471cd39b04 rearrange Makefile
Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-14 15:32:52 +00:00
Daniel Santos 78d5b4d899 update README.md
* correct mispellings and make the text more understandable

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-13 22:44:15 +00:00
Daniel Santos 428eecbdcb better invalid numeral error message
* invalid numeral error message now indicates which numerals are valid

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-13 14:28:09 +00:00
Daniel Santos f44be5f3b4 create README.md
Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-13 14:21:26 +00:00
Daniel Santos 5d7cabc420 add to Makefile sun<->earth rule
* add sun to earth and vice-versa rule, without adding it to the all
   rule
 * also add earth<->sun to 'clean' Makefile rule

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-12 18:14:15 +00:00
Daniel Santos f1cd830c40 add decimal<->binary Makefile rule
* add decimal to binary and vice-versa Makefile rule

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
2022-03-12 17:38:31 +00:00