update numericx.c comments

Signed-off-by: Daniel Santos <dacs.git@brilhante.top>
This commit is contained in:
Daniel Santos 2022-03-17 09:07:07 +00:00
parent 23772dbb14
commit 327de4f901
1 changed files with 27 additions and 9 deletions

View File

@ -369,12 +369,12 @@ free_numeral(numeral_ptr* numeral)
} }
/** /**
* @brief Free numericx result * @brief Free numericx result.
* *
* Function frees up the result of numericx_translate(), * Function frees up the result of numericx_translate(),
* after we are done with it * after we are done with it.
* *
* @param string - char pointer to be free * @param string - char pointer to be free.
*/ */
void void
numericx_free(char* string) numericx_free(char* string)
@ -383,15 +383,15 @@ numericx_free(char* string)
} }
/** /**
* @brief Convert numeral_ptr to string * @brief Convert numeral_ptr to string.
* *
* Allocates space for string and converts numeral_ptr* to char* * Allocates space for string and converts numeral_ptr* to char*.
* *
* @param numeral - numeral_ptr to be converted to string * @param numeral - numeral_ptr to be converted to string.
* @param result_with_units_on_the_end - define if result has units on the end * @param result_with_units_on_the_end - define if result has units on the end.
* *
* @return char pointer to converted string in case of success * @return char pointer to converted string in case of success.
* @return NULL in case of no memory * @return NULL in case of no memory.
*/ */
char* char*
numeral_to_string(numeral_ptr* numeral, bool result_with_units_on_the_end) numeral_to_string(numeral_ptr* numeral, bool result_with_units_on_the_end)
@ -433,6 +433,24 @@ numeral_to_string(numeral_ptr* numeral, bool result_with_units_on_the_end)
} }
/** /**
* @brief Translate string to a different numerical system.
*
* After definition of the 'from' numerical system proprieties and the
* 'to' numerical system proprieties, will be translate 'number' from the
* 'from' to the 'to' numerical system, resulting in a string.
*
* @param from - string with all the numerals of the number's numerical system.
* @param to - string with all the numerals of the resulting number's numerical system.
* @param from_units_on_the_end - does the translate from numerical system have units on the end (on the right)?
* @param to_units_on_the_end - does the translate to numerical system have units on the end (on the right)?
* @param from_first_number_void - does the translate from numerical system start counting on the second number?
* @param to_first_number_void - does the translate to numerical system start counting on the second number?
* @param from_infinite_base - is the translate from numerical system first numeral infinite? For example, if first numeral is 'A', then does 'A' == 'AA' == 'AAA' == 'AAAA' ... ?
* @param to_infinite_base - is the translate to numerical system first numeral infinite? For example, if first numeral is 'A', then does 'A' == 'AA' == 'AAA' == 'AAAA' ... ?
* @param number - number of the from numerical system, to be translated into the to numerical system
*
* @return NULL in case of failure
* @return string of translated number, in case of success
*/ */
char* char*
numericx_translate(char* from, bool from_units_on_the_end, bool from_first_number_void, bool from_infinite_base, char* to, bool to_units_on_the_end, bool to_first_number_void, bool to_infinite_base, char* number) numericx_translate(char* from, bool from_units_on_the_end, bool from_first_number_void, bool from_infinite_base, char* to, bool to_units_on_the_end, bool to_first_number_void, bool to_infinite_base, char* number)