hydroforth/include/hydroforth/number.h
2022-12-23 15:02:29 +01:00

24 lines
1 KiB
C

#ifndef __HYDROFORTH__NUMBER_H__
#define __HYDROFORTH__NUMBER_H__
extern bool hydroforth__number__is_digit(char c);
extern void hydroforth__number__convert_hex_digit(HYDROFORTH__RESULT *const result, char c, unsigned char *const val);
extern void hydroforth__number__parse_number_hex(HYDROFORTH__RESULT *const result, const char *const start, unsigned char len, int *const val);
extern void hydroforth__number__parse_number(HYDROFORTH__RESULT *const result, const char *const start, unsigned char len, int *const val);
extern unsigned char hydroforth__number__count_digits(int n);
typedef struct __HYDROFORTH__NUMBER
{
bool (*is_digit)(char c);
void (*convert_hex_digit)(HYDROFORTH__RESULT *const result, char c, unsigned char *const val);
void (*parse_number_hex)(HYDROFORTH__RESULT *const result, const char *const start, unsigned char len, int *const val);
void (*parse_number)(HYDROFORTH__RESULT *const result, const char *const start, unsigned char len, int *const val);
unsigned char (*count_digits)(int n);
} __HYDROFORTH__NUMBER;
#endif