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