bglibs
fmt.h
1 #ifndef FMT__NUMBER__H__
2 #define FMT__NUMBER__H__
3 
4 #include <stdarg.h>
5 struct str;
6 
54 #define FMT_ULONG_LEN 40
55 
56 extern const char fmt_lcase_digits[36];
57 extern const char fmt_ucase_digits[36];
58 
59 extern unsigned fmt_pad(char* buffer, unsigned width, char pad);
60 extern unsigned fmt_sign_pad(char* buffer, int sign,
61  unsigned width, char pad);
62 
66 extern unsigned fmt_snumw(char* buffer, long num,
67  unsigned width, char pad,
68  unsigned base, const char* digits);
69 extern unsigned fmt_sdec(char* buffer, long num);
70 extern unsigned fmt_sdecw(char* buffer, long num,
71  unsigned width, char pad);
72 
78 extern unsigned fmt_sllnumw(char* buffer, long long num,
79  unsigned width, char pad,
80  unsigned base, const char* digits);
81 extern unsigned fmt_slldec(char* buffer, long long num);
82 extern unsigned fmt_slldecw(char* buffer, long long num,
83  unsigned width, char pad);
84 
90 extern unsigned fmt_unumw(char* buffer, unsigned long num,
91  unsigned width, char pad,
92  unsigned base, const char* digits);
93 extern unsigned fmt_udec(char* buffer, unsigned long num);
94 extern unsigned fmt_udecw(char* buffer, unsigned long num,
95  unsigned width, char pad);
96 extern unsigned fmt_uhex(char* buffer, unsigned long num);
97 extern unsigned fmt_uhexw(char* buffer, unsigned long num,
98  unsigned width, char pad);
99 extern unsigned fmt_uHex(char* buffer, unsigned long num);
100 extern unsigned fmt_uHexw(char* buffer, unsigned long num,
101  unsigned width, char pad);
102 
108 extern unsigned fmt_ullnumw(char* buffer, unsigned long long num,
109  unsigned width, char pad,
110  unsigned base, const char* digits);
111 extern unsigned fmt_ulldec(char* buffer, unsigned long long num);
112 extern unsigned fmt_ulldecw(char* buffer, unsigned long long num,
113  unsigned width, char pad);
114 extern unsigned fmt_ullhex(char* buffer, unsigned long long num);
115 extern unsigned fmt_ullhexw(char* buffer, unsigned long long num,
116  unsigned width, char pad);
117 extern unsigned fmt_ullHex(char* buffer, unsigned long long num);
118 extern unsigned fmt_ullHexw(char* buffer, unsigned long long num,
119  unsigned width, char pad);
120 
127 extern unsigned fmt_char(char* buffer, int ch, unsigned width, char pad);
128 extern unsigned fmt_mem(char* buffer, const char* s, unsigned length,
129  unsigned width, char pad);
130 extern unsigned fmt_chars(char* buffer, const char* s,
131  unsigned width, char pad);
132 extern unsigned fmt_str(char* buffer, const struct str* s,
133  unsigned width, char pad);
134 
142 typedef unsigned (*fmt_function)(char* buffer,
143  const void* data,
144  unsigned width,
145  char pad);
146 
147 extern unsigned fmt_multi(char* buffer, const char* format, ...);
148 extern unsigned fmt_multiv(char* buffer, const char* format, va_list ap);
149 
154 #endif
unsigned fmt_udecw(char *buffer, unsigned long num, unsigned width, char pad)
Definition: udec.c:4
char * s
Definition: str.h:36
unsigned fmt_ulldecw(char *buffer, unsigned long long num, unsigned width, char pad)
Definition: ulldec.c:4
unsigned fmt_uHex(char *buffer, unsigned long num)
Definition: uhexu.c:11
unsigned(* fmt_function)(char *buffer, const void *data, unsigned width, char pad)
Definition: fmt.h:142
unsigned fmt_uhexw(char *buffer, unsigned long num, unsigned width, char pad)
Definition: uhexl.c:5
unsigned fmt_udec(char *buffer, unsigned long num)
Definition: udec.c:10
unsigned fmt_uhex(char *buffer, unsigned long num)
Definition: uhexl.c:11
unsigned fmt_multi(char *buffer, const char *format,...)
Definition: multi.c:106
unsigned fmt_ullnumw(char *buffer, unsigned long long num, unsigned width, char pad, unsigned base, const char *digits)
Definition: ullnum.c:39
const char fmt_ucase_digits[36]
Definition: ucase.c:4
unsigned fmt_sdec(char *buffer, long num)
Definition: sdec.c:10
unsigned fmt_slldec(char *buffer, long long num)
Definition: slldec.c:10
unsigned fmt_pad(char *buffer, unsigned width, char pad)
Definition: pad.c:5
unsigned fmt_char(char *buffer, int ch, unsigned width, char pad)
Definition: char.c:21
unsigned fmt_sdecw(char *buffer, long num, unsigned width, char pad)
Definition: sdec.c:4
unsigned fmt_snumw(char *buffer, long num, unsigned width, char pad, unsigned base, const char *digits)
Definition: snum.c:35
unsigned fmt_unumw(char *buffer, unsigned long num, unsigned width, char pad, unsigned base, const char *digits)
Definition: unum.c:38
unsigned fmt_multiv(char *buffer, const char *format, va_list ap)
Definition: multi.c:152
unsigned fmt_ullHexw(char *buffer, unsigned long long num, unsigned width, char pad)
Definition: ullhexu.c:5
Definition: str.h:30
unsigned fmt_sllnumw(char *buffer, long long num, unsigned width, char pad, unsigned base, const char *digits)
Definition: sllnum.c:36
const char fmt_lcase_digits[36]
Definition: lcase.c:4
unsigned fmt_slldecw(char *buffer, long long num, unsigned width, char pad)
Definition: slldec.c:4
unsigned fmt_uHexw(char *buffer, unsigned long num, unsigned width, char pad)
Definition: uhexu.c:5
unsigned fmt_ullhex(char *buffer, unsigned long long num)
Definition: ullhexl.c:11
unsigned fmt_ullHex(char *buffer, unsigned long long num)
Definition: ullhexu.c:12
unsigned fmt_ulldec(char *buffer, unsigned long long num)
Definition: ulldec.c:11
unsigned fmt_ullhexw(char *buffer, unsigned long long num, unsigned width, char pad)
Definition: ullhexl.c:4
unsigned fmt_sign_pad(char *buffer, int sign, unsigned width, char pad)
Definition: sign_pad.c:5