FreeBASIC  0.91.0
io_printusg.c File Reference
#include "fb.h"
#include <math.h>
Include dependency graph for io_printusg.c:

Go to the source code of this file.

Data Structures

struct  FB_PRINTUSGCTX
 

Macros

#define BUFFERLEN   2048
 
#define MIN_EXPDIGS   3
 
#define MAX_EXPDIGS   5
 
#define MAX_DIGS
 
#define CHAR_ZERO   '0'
 
#define CHAR_DOT   '.'
 
#define CHAR_COMMA   ','
 
#define CHAR_TOOBIG   '%'
 
#define CHAR_PLUS   '+'
 
#define CHAR_MINUS   '-'
 
#define CHAR_STAR   '*'
 
#define CHAR_DOLLAR   '$'
 
#define CHAR_SPACE   ' '
 
#define CHAR_WTF   '!'
 
#define CHAR_EXP_SINGLE   'E'
 
#define SNG_AUTODIGS   7
 
#define DBL_AUTODIGS   15
 
#define DBL_MAXDIGS   16
 
#define CHARS_NAN   ('#' << 24 | 'N' << 16 | 'A' << 8 | 'N')
 
#define CHARS_INF   ('#' << 24 | 'I' << 16 | 'N' << 8 | 'F')
 
#define CHARS_IND   ('#' << 24 | 'I' << 16 | 'N' << 8 | 'D')
 
#define CHARS_TRUNC   ('$' << 24 | '0' << 16 | '0' << 8 | '0') /* QB glitch: truncation "rounds up" the text chars */
 
#define ADD_CHAR(c)
 
#define VAL_ISNEG   0x1
 
#define VAL_ISINF   0x2
 
#define VAL_ISIND   0x4
 
#define VAL_ISNAN   0x8
 
#define VAL_ISFLOAT   0x10
 
#define VAL_ISSNG   0x20
 

Functions

static long long hDoubleToLongBits (double d)
 
static int hIsNeg (double d)
 
static int hIsZero (double d)
 
static int hIsFinite (double d)
 
static int hIsInf (double d)
 
static int hIsInd (double d)
 
static int hIsNan (double d)
 
static int fb_PrintUsingFmtStr (int fnum)
 
FBCALL int fb_PrintUsingInit (FBSTRING *fmtstr)
 
FBCALL int fb_PrintUsingEnd (int fnum)
 
static unsigned long long hPow10_ULL (int n)
 
static int hLog10_ULL (unsigned long long a)
 
static int hNumDigits (unsigned long long a)
 
static unsigned long long hDivPow10_ULL (unsigned long long a, int n)
 
FBCALL int fb_PrintUsingStr (int fnum, FBSTRING *s, int mask)
 
FBCALL int fb_PrintUsingWstr (int fnum, FB_WCHAR *s, int mask)
 
static int hPrintNumber (int fnum, unsigned long long val, int val_exp, int flags, int mask)
 
static unsigned long long hScaleDoubleToULL (double value, int *pval_exp)
 
FBCALL int fb_PrintUsingDouble (int fnum, double value, int mask)
 
FBCALL int fb_PrintUsingSingle (int fnum, float value_f, int mask)
 
FBCALL int fb_PrintUsingULongint (int fnum, unsigned long long value_ull, int mask)
 
FBCALL int fb_PrintUsingLongint (int fnum, long long val_ll, int mask)
 

Macro Definition Documentation

#define ADD_CHAR (   c)
Value:
do { \
DBG_ASSERT( p >= buffer ); \
if( p >= buffer ) \
*(p--) = (char)(c); \
else if( p == buffer ) \
*p = CHAR_WTF; \
} while (0)

Definition at line 49 of file io_printusg.c.

#define BUFFERLEN   2048

Definition at line 12 of file io_printusg.c.

#define CHAR_COMMA   ','

Definition at line 27 of file io_printusg.c.

#define CHAR_DOLLAR   '$'

Definition at line 32 of file io_printusg.c.

#define CHAR_DOT   '.'

Definition at line 26 of file io_printusg.c.

#define CHAR_EXP_SINGLE   'E'

Definition at line 35 of file io_printusg.c.

#define CHAR_MINUS   '-'

Definition at line 30 of file io_printusg.c.

#define CHAR_PLUS   '+'

Definition at line 29 of file io_printusg.c.

#define CHAR_SPACE   ' '

Definition at line 33 of file io_printusg.c.

#define CHAR_STAR   '*'

Definition at line 31 of file io_printusg.c.

#define CHAR_TOOBIG   '%'

Definition at line 28 of file io_printusg.c.

#define CHAR_WTF   '!'

Definition at line 34 of file io_printusg.c.

#define CHAR_ZERO   '0'

Definition at line 25 of file io_printusg.c.

#define CHARS_IND   ('#' << 24 | 'I' << 16 | 'N' << 8 | 'D')

Definition at line 46 of file io_printusg.c.

#define CHARS_INF   ('#' << 24 | 'I' << 16 | 'N' << 8 | 'F')

Definition at line 45 of file io_printusg.c.

#define CHARS_NAN   ('#' << 24 | 'N' << 16 | 'A' << 8 | 'N')

Definition at line 44 of file io_printusg.c.

#define CHARS_TRUNC   ('$' << 24 | '0' << 16 | '0' << 8 | '0') /* QB glitch: truncation "rounds up" the text chars */

Definition at line 47 of file io_printusg.c.

#define DBL_AUTODIGS   15

Definition at line 41 of file io_printusg.c.

#define DBL_MAXDIGS   16

Definition at line 42 of file io_printusg.c.

#define MAX_DIGS
Value:
- 2 /* '%' char(s) */ \
- 1 /* +/- sign */ \
- 1 /* dollar sign */ \
- 1 /* decimal point */ \
- MAX_EXPDIGS /* exp digits */ \
- (MIN_EXPDIGS - 1) /* stray carets */ \
)

Definition at line 15 of file io_printusg.c.

#define MAX_EXPDIGS   5

Definition at line 14 of file io_printusg.c.

#define MIN_EXPDIGS   3

Definition at line 13 of file io_printusg.c.

#define SNG_AUTODIGS   7

Definition at line 40 of file io_printusg.c.

#define VAL_ISFLOAT   0x10

Definition at line 111 of file io_printusg.c.

#define VAL_ISIND   0x4

Definition at line 108 of file io_printusg.c.

#define VAL_ISINF   0x2

Definition at line 107 of file io_printusg.c.

#define VAL_ISNAN   0x8

Definition at line 109 of file io_printusg.c.

#define VAL_ISNEG   0x1

Definition at line 106 of file io_printusg.c.

#define VAL_ISSNG   0x20

Definition at line 112 of file io_printusg.c.

Function Documentation

FBCALL int fb_PrintUsingDouble ( int  fnum,
double  value,
int  mask 
)

Definition at line 1387 of file io_printusg.c.

Here is the call graph for this function:

FBCALL int fb_PrintUsingEnd ( int  fnum)

Definition at line 134 of file io_printusg.c.

Here is the call graph for this function:

static int fb_PrintUsingFmtStr ( int  fnum)
static

Definition at line 216 of file io_printusg.c.

Here is the call graph for this function:

Here is the caller graph for this function:

FBCALL int fb_PrintUsingInit ( FBSTRING fmtstr)

Definition at line 117 of file io_printusg.c.

Here is the call graph for this function:

Here is the caller graph for this function:

FBCALL int fb_PrintUsingLongint ( int  fnum,
long long  val_ll,
int  mask 
)

Definition at line 1464 of file io_printusg.c.

Here is the call graph for this function:

FBCALL int fb_PrintUsingSingle ( int  fnum,
float  value_f,
int  mask 
)

Definition at line 1423 of file io_printusg.c.

Here is the call graph for this function:

FBCALL int fb_PrintUsingStr ( int  fnum,
FBSTRING s,
int  mask 
)

Definition at line 305 of file io_printusg.c.

Here is the call graph for this function:

FBCALL int fb_PrintUsingULongint ( int  fnum,
unsigned long long  value_ull,
int  mask 
)

Definition at line 1459 of file io_printusg.c.

Here is the call graph for this function:

FBCALL int fb_PrintUsingWstr ( int  fnum,
FB_WCHAR s,
int  mask 
)

Definition at line 431 of file io_printusg.c.

Here is the call graph for this function:

static unsigned long long hDivPow10_ULL ( unsigned long long  a,
int  n 
)
static

Definition at line 199 of file io_printusg.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static long long hDoubleToLongBits ( double  d)
static

Definition at line 65 of file io_printusg.c.

Here is the caller graph for this function:

static int hIsFinite ( double  d)
static

Definition at line 82 of file io_printusg.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int hIsInd ( double  d)
static

Definition at line 92 of file io_printusg.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int hIsInf ( double  d)
static

Definition at line 87 of file io_printusg.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int hIsNan ( double  d)
static

Definition at line 97 of file io_printusg.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int hIsNeg ( double  d)
static

Definition at line 72 of file io_printusg.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int hIsZero ( double  d)
static

Definition at line 77 of file io_printusg.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int hLog10_ULL ( unsigned long long  a)
static

Definition at line 169 of file io_printusg.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static int hNumDigits ( unsigned long long  a)
static

Definition at line 194 of file io_printusg.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static unsigned long long hPow10_ULL ( int  n)
static

Definition at line 153 of file io_printusg.c.

Here is the caller graph for this function:

static int hPrintNumber ( int  fnum,
unsigned long long  val,
int  val_exp,
int  flags,
int  mask 
)
static

Definition at line 541 of file io_printusg.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static unsigned long long hScaleDoubleToULL ( double  value,
int *  pval_exp 
)
static

Definition at line 1274 of file io_printusg.c.

Here is the call graph for this function:

Here is the caller graph for this function: