NetBurner 3.1
nbprintfinternal.h
1 /*NB_REVISION*/
2 
3 /*NB_COPYRIGHT*/
4 
5 #ifndef NB_INTERNAL_PRINTF
6 #define NB_INTERNAL_PRINTF
7 
8 #include <stdarg.h>
9 
10 class TCP_SOCKET;
11 struct tlbuffer
12 {
13  TCP_SOCKET *ps;
14  char tbuffer[128];
15  uint8_t cnt;
16 };
17 
18 void putatchar(void *data, char c);
19 
20 struct pfstate
21 {
22  int nsent;
23  uint16_t flags;
24  int width;
25  int dwidth;
26  int len;
27 };
28 
29 typedef int(PutCharsFunction)(void *data, const char *chars, int len);
30 typedef int(ParsePrintfFloatFunc)(char f, PutCharsFunction *pf, void *data, double d, pfstate &pfs);
31 extern ParsePrintfFloatFunc *pPrintfFloatFunc;
32 
33 int TheFloatPrintf(char f, PutCharsFunction *pf, void *data, double d, pfstate &pfs);
34 
35 int NB_internal_iprintf(PutCharsFunction *pf, void *data, const char *format, va_list arg);
36 
37 #define NB_PRINTF_EXTEND (1)
38 #define PRINTF_FLAG_DONE (0x0001)
39 #define PRINTF_FLAG_LEFT (0x0002)
40 #define PRINTF_FLAG_PLUSSIGN (0x0004)
41 #define PRINTF_FLAG_BLANKSIGN (0x0008)
42 #define PRINTF_FLAG_LEADZERO (0x0010)
43 #define PRINTF_FLAG_SPECIAL (0x0020)
44 #define PRINTF_FLAG_LOWERHEX (0x0040)
45 #define PRINTF_FLAG_SAWDOT (0x0080)
46 #define PRINTF_FLAG_SAWWID (0x0100)
47 #define PRINTF_FLAG_FIRST_L (0x0200)
48 #define PRINTF_FLAG_LONG_LONG (0x0400)
49 #define PRINTF_FLAG_FIRST_H (0x0800)
50 #define PRINTF_FLAG_HALF_HALF (0x1000)
51 #define PRINTF_FLAG_WAS_NEG (0x2000)
52 #define PRINTF_FLAG_ZERO_PREC (0x4000)
53 
54 int decimallen(uint32_t dw);
55 bool prespace(int width, uint32_t flags, int len, PutCharsFunction *pf, void *data, int &nsent);
56 bool postspace(int width, uint32_t flags, int len, PutCharsFunction *pf, void *data, int &nsent);
57 bool leadzero(int width, uint32_t flags, int len, PutCharsFunction *pf, void *data, int &nsent);
58 
59 #endif