Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Related Pages

fmt: Formatting Functions


Signed integer conversions

unsigned fmt_snumw (char *buffer, long num, unsigned width, char pad, unsigned base, const char *digits)
unsigned fmt_sdec (char *buffer, long num)
unsigned fmt_sdecw (char *buffer, long num, unsigned width, char pad)

Signed long long integer conversions

unsigned fmt_sllnumw (char *buffer, long long num, unsigned width, char pad, unsigned base, const char *digits)
unsigned fmt_slldec (char *buffer, long long num)
unsigned fmt_slldecw (char *buffer, long long num, unsigned width, char pad)

Unsigned integer conversions

unsigned fmt_unumw (char *buffer, unsigned long num, unsigned width, char pad, unsigned base, const char *digits)
unsigned fmt_udec (char *buffer, unsigned long num)
unsigned fmt_udecw (char *buffer, unsigned long num, unsigned width, char pad)
unsigned fmt_uhex (char *buffer, unsigned long num)
unsigned fmt_uhexw (char *buffer, unsigned long num, unsigned width, char pad)
unsigned fmt_uHex (char *buffer, unsigned long num)
unsigned fmt_uHexw (char *buffer, unsigned long num, unsigned width, char pad)

Unsigned long long integer conversions

unsigned fmt_ullnumw (char *buffer, unsigned long long num, unsigned width, char pad, unsigned base, const char *digits)
unsigned fmt_ulldec (char *buffer, unsigned long long num)
unsigned fmt_ulldecw (char *buffer, unsigned long long num, unsigned width, char pad)
unsigned fmt_ullhex (char *buffer, unsigned long long num)
unsigned fmt_ullhexw (char *buffer, unsigned long long num, unsigned width, char pad)
unsigned fmt_ullHex (char *buffer, unsigned long long num)
unsigned fmt_ullHexw (char *buffer, unsigned long long num, unsigned width, char pad)

Defines

#define FMT_ULONG_LEN   40

Functions

unsigned fmt_pad (char *buffer, unsigned width, char pad)
unsigned fmt_sign_pad (char *buffer, int sign, unsigned width, char pad)

Variables

const char fmt_lcase_digits [36] = "0123456789abcdefghijklmnopqrstuvwxyz"
const char fmt_lcase_digits [36]
const char fmt_ucase_digits [36]

Detailed Description

Function Naming
  1. Prefix
  2. Data type
  3. Conversion type
  4. Width / Padding

For example, fmt_sdecw formats a signed integer using decimal with width padding.

Calling Convention
Parameters to the fmt functions are passed in the following order. The presence of all parameters, except for buffer, is dependant on which function is being used.

  1. buffer : The character string into which to put the data result. If this is NULL, no data is written, and only the length is calculated. This is useful for determining how long a formatted string might be.
  2. number or data : The input data item to convert.
  3. width : The minimum output width.
  4. pad : The character with which to pad the output.
  5. base : The numerical base to use.
  6. digits : The array of digits to use.

Return Value
All fmt functions return the number of bytes written to the buffer space.

Define Documentation

#define FMT_ULONG_LEN   40
 

The maximum space used by a formatted number.

This value is long enough for 2^128 plus a trailing NUL byte.


Function Documentation

unsigned fmt_pad char *  buffer,
unsigned  width,
char  pad
 

Format a pad character.

unsigned fmt_sdec char *  buffer,
long  num
 

Format a signed integer as decimal.

unsigned fmt_sdecw char *  buffer,
long  num,
unsigned  width,
char  pad
 

Format a signed integer as decimal with padding.

unsigned fmt_sign_pad char *  buffer,
int  sign,
unsigned  width,
char  pad
 

Format padding for a signed number.

unsigned fmt_slldec char *  buffer,
long long  num
 

Format a signed long long integer as decimal.

unsigned fmt_slldecw char *  buffer,
long long  num,
unsigned  width,
char  pad
 

Format a signed long long integer as decimal with padding.

unsigned fmt_sllnumw char *  buffer,
long long  num,
unsigned  width,
char  pad,
unsigned  base,
const char *  digits
 

Format a signed long long integer of arbitrary base with optional padding.

unsigned fmt_snumw char *  buffer,
long  num,
unsigned  width,
char  pad,
unsigned  base,
const char *  digits
 

Format a signed integer of arbitrary base with optional padding.

unsigned fmt_udec char *  buffer,
unsigned long  num
 

Format an unsigned integer as decimal.

unsigned fmt_udecw char *  buffer,
unsigned long  num,
unsigned  width,
char  pad
 

Format an unsigned integer as decimal with padding.

unsigned fmt_uHex char *  buffer,
unsigned long  num
 

Format an unsigned integer as (upper-case) hexadecimal.

unsigned fmt_uhex char *  buffer,
unsigned long  num
 

Format an unsigned integer as (lower-case) hexadecimal.

unsigned fmt_uHexw char *  buffer,
unsigned long  num,
unsigned  width,
char  pad
 

Format an unsigned integer as (upper-case) hexadecimal with padding.

unsigned fmt_uhexw char *  buffer,
unsigned long  num,
unsigned  width,
char  pad
 

Format an unsigned integer as (lower-case) hexadecimal with padding.

unsigned fmt_ulldec char *  buffer,
unsigned long long  num
 

Format an unsigned long long integer as decimal.

unsigned fmt_ulldecw char *  buffer,
unsigned long long  num,
unsigned  width,
char  pad
 

Format an unsigned long long integer as decimal with padding.

unsigned fmt_ullHex char *  buffer,
unsigned long long  num
 

Format an unsigned long long integer as (upper-case) hexadecimal.

unsigned fmt_ullhex char *  buffer,
unsigned long long  num
 

Format an unsigned long long integer as hexadecimal.

unsigned fmt_ullHexw char *  buffer,
unsigned long long  num,
unsigned  width,
char  pad
 

Format an unsigned long long integer as (upper-case) hexadecimal with padding.

unsigned fmt_ullhexw char *  buffer,
unsigned long long  num,
unsigned  width,
char  pad
 

Format an unsigned long long integer as hexadecimal with padding.

unsigned fmt_ullnumw char *  buffer,
unsigned long long  num,
unsigned  width,
char  pad,
unsigned  base,
const char *  digits
 

Format an unsigned long long integer of arbitrary base with optional padding.

unsigned fmt_unumw char *  buffer,
unsigned long  num,
unsigned  width,
char  pad,
unsigned  base,
const char *  digits
 

Format an unsigned integer of arbitrary base with optional padding.


Variable Documentation

const char fmt_lcase_digits[36]
 

Array of digits for lower-case conversions.

const char fmt_lcase_digits[36] = "0123456789abcdefghijklmnopqrstuvwxyz"
 

Array of digits for lower-case conversions.

const char fmt_ucase_digits[36]
 

Array of digits for upper-case conversions.


Generated on Tue Mar 23 21:58:09 2004 for bglibs by doxygen 1.3.5