diff options
-rw-r--r-- | numericx.c | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/numericx.c b/numericx.c index 695ef4e..56e3438 100644 --- a/numericx.c +++ b/numericx.c @@ -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(), - * 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 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 result_with_units_on_the_end - define if result has units on the end + * @param numeral - numeral_ptr to be converted to string. + * @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 NULL in case of no memory + * @return char pointer to converted string in case of success. + * @return NULL in case of no memory. */ char* 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* 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) |