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

Go to the source code of this file.

Data Structures

struct  _FormatMaskInfo
 

Macros

#define FB_MAXFIXLEN   19 /* floor( log10( pow( 2.0, 63 ) ) ) + 1 */
 

Typedefs

typedef enum _eMaskType eMaskType
 
typedef struct _FormatMaskInfo FormatMaskInfo
 

Enumerations

enum  _eMaskType { eMT_Unknown = 0, eMT_Number, eMT_DateTime }
 

Functions

static void fb_hGetNumberParts (double number, char *pachFixPart, ssize_t *pcchLenFix, char *pachFracPart, ssize_t *pcchLenFrac, char *pchSign, char chDecimalPoint, int precision)
 Splits a number into its fixed and fractional part. More...
 
static FBSTRINGfb_hBuildDouble (double num, char decimal_point, char thousands_separator)
 
static double hRound (double value, const FormatMaskInfo *pInfo)
 
static int fb_hProcessMask (FBSTRING *dst, const char *mask, ssize_t mask_length, double value, FormatMaskInfo *pInfo, char chThousandsSep, char chDecimalPoint, char chDateSep, char chTimeSep)
 Processes a FORMAT mask. More...
 
FBCALL FBSTRINGfb_hStrFormat (double value, const char *mask, size_t mask_length)
 
FBCALL FBSTRINGfb_StrFormat (double value, FBSTRING *mask)
 

Macro Definition Documentation

#define FB_MAXFIXLEN   19 /* floor( log10( pow( 2.0, 63 ) ) ) + 1 */

Definition at line 33 of file str_format.c.

Typedef Documentation

typedef enum _eMaskType eMaskType

Enumeration Type Documentation

enum _eMaskType
Enumerator
eMT_Unknown 
eMT_Number 
eMT_DateTime 

Definition at line 6 of file str_format.c.

Function Documentation

static FBSTRING* fb_hBuildDouble ( double  num,
char  decimal_point,
char  thousands_separator 
)
static

Definition at line 123 of file str_format.c.

Here is the call graph for this function:

Here is the caller graph for this function:

static void fb_hGetNumberParts ( double  number,
char *  pachFixPart,
ssize_t *  pcchLenFix,
char *  pachFracPart,
ssize_t *  pcchLenFrac,
char *  pchSign,
char  chDecimalPoint,
int  precision 
)
static

Splits a number into its fixed and fractional part.

precision info 11 VBDOS' default floating point precision for FORMAT$() when no mask was specified 16 Precision when the user specified a mask

Definition at line 44 of file str_format.c.

Here is the caller graph for this function:

static int fb_hProcessMask ( FBSTRING dst,
const char *  mask,
ssize_t  mask_length,
double  value,
FormatMaskInfo pInfo,
char  chThousandsSep,
char  chDecimalPoint,
char  chDateSep,
char  chTimeSep 
)
static

Processes a FORMAT mask.

This function is used for two passes:

  • Determine the required size of the resulting string.
  • Build the resulting string.

This function is a mess, but hey, it works ...

When I've too much time, I'll simplify this function so that almost all queries of do_output will be removed.

Definition at line 227 of file str_format.c.

Here is the call graph for this function:

Here is the caller graph for this function:

FBCALL FBSTRING* fb_hStrFormat ( double  value,
const char *  mask,
size_t  mask_length 
)

Definition at line 1119 of file str_format.c.

Here is the call graph for this function:

Here is the caller graph for this function:

FBCALL FBSTRING* fb_StrFormat ( double  value,
FBSTRING mask 
)

Definition at line 1188 of file str_format.c.

Here is the call graph for this function:

static double hRound ( double  value,
const FormatMaskInfo pInfo 
)
static

Definition at line 167 of file str_format.c.

Here is the caller graph for this function: