about summary refs log tree commit diff stats
path: root/linux/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'linux/Makefile')
0 files changed, 0 insertions, 0 deletions
id='n46' href='#n46'>46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
/** @file numericx.h
 * Numericx library header file.
 */
#ifndef _NUMERICX_H
#define _NUMERICX_H

#include <stdbool.h>

#define PROG_NAME "numericx"

/* ||DATA STRUCTURE|| */

/**
 * @brief Numeral structure
 *
 * This struct is in use to apply our operations on the number.
 * The number are converted to this struct, the operations are applied,
 * and on the end, the resulting number is converted from this struct.
 */
typedef struct NumeralPtr
{
	char const* symbol; /**< a pointer to the glyph/numeral/symbol of this digit. */
	struct NumeralPtr *next; /**< a pointer to the next digit */
	struct NumeralPtr *previous; /**< a pointer to the previous digit */
} numeral_ptr;


/* ||FUNCTIONS|| */

/**
 * @brief Free numericx result.
 *
 * Free up the result string of numericx_translate(),
 * after we are done with it.
 *
 * @param string - char pointer to be free.
 */
void
numericx_free(char* string);

/**
 * @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 from_units_on_the_end - does the translate 'from' 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 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 - string with all the numerals of the resulting number's numerical system.
 * @param to_units_on_the_end - does the translate 'to' numerical system have units on the end (on the right)?
 * @param to_first_number_void - does the translate 'to' numerical system start counting on the second number?
 * @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.
 * @param result_string - string to where to store the result.
 *
 * @return EINVAL if argument of result_string is not NULL.
 * @return EDOM if number doesn't belong to the 'from' numerical system.
 * @return ERANGE if the resulting number cannot be represented, because of a 'from' void number and a lack of void number in 'to'.
 * @return EXIT_SUCCESS in case of success.
 */
int
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, char** result_string);

#endif