Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

/ray/src/lib/lex/basicparse.h File Reference

Basic integer / floating point parsing routines. More...

#include <lib/sconfig.h>
#include <lib/serror.h>

Include dependency graph for basicparse.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define _LIB_LEX_BASICPARSE_H_   1

Functions

char * ParseInt (int32 *val, const char *str, SError &error, bool may_continue=0)
 Read in a signed 32bit integer value.

char * ParseInt (int8 *val, const char *str, SError &error, bool may_continue=0)
 Read in a signed 8bit integer value.

char * ParseInt (int16 *val, const char *str, SError &error, bool may_continue=0)
 Read in a signed 16bit integer value.

char * ParseInt (int64 *val, const char *str, SError &error, bool may_continue=0)
 Read in a signed 64bit integer value.

char * ParseInt (uint32 *val, const char *str, SError &error, bool may_continue=0)
 Read in an unsigned 32bit integer value.

char * ParseInt (uint8 *val, const char *str, SError &error, bool may_continue=0)
 Read in an unsigned 8bit integer value.

char * ParseInt (uint16 *val, const char *str, SError &error, bool may_continue=0)
 Read in an unsigned 16bit integer value.

char * ParseInt (uint64 *val, const char *str, SError &error, bool may_continue=0)
 Read in an unsigned 64bit integer value.

char * ParseFloat (dbl *val, const char *str, SError &error, bool may_continue=0)
 Read in a dbl (double) floating point value.

char * ParseFloat (flt *val, const char *str, SError &error, bool may_continue=0)
 Read in an flt (float) floating point value.


Detailed Description

Basic integer / floating point parsing routines.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
Functions to parse integer and floating point values: Normal standard (strtol()/strtod()-like) ones and fancy ones which may be needed in a compiler.

Definition in file basicparse.h.


Define Documentation

#define _LIB_LEX_BASICPARSE_H_   1
 

Definition at line 18 of file basicparse.h.


Function Documentation

char* ParseFloat flt val,
const char *  str,
SError error,
bool  may_continue = 0
 

Read in an flt (float) floating point value.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
For more information, see ParseFloat() for dbl (double) floats.

Definition at line 325 of file basicparse.cc.

References flt.

Referenced by ParseFloatSpec().

char* ParseFloat dbl val,
const char *  str,
SError error,
bool  may_continue = 0
 

Read in a dbl (double) floating point value.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
This function works much like the ParseInt() function but for floating point values. The format is just the standard floating point format (as also recognized via strtod()).

The input is a NUL-terminated string in str.

The parsed float is stored in *val (overloaded allowing the compiler to select the correct version itself).

Errors: Out of range or (in case may_continue is not set) if not the whole input was a valid floating point value.

Returns:
The first non-matching char (where parsing stopped) is returned.

Definition at line 327 of file basicparse.cc.

References dbl.

char* ParseInt uint64 val,
const char *  str,
SError error,
bool  may_continue = 0
 

Read in an unsigned 64bit integer value.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
For more information, see ParseInt() for 32bit (unsigned) integers.

Definition at line 290 of file basicparse.cc.

References uint64.

char* ParseInt uint16 val,
const char *  str,
SError error,
bool  may_continue = 0
 

Read in an unsigned 16bit integer value.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
For more information, see ParseInt() for 32bit (unsigned) integers.

Definition at line 284 of file basicparse.cc.

References uint16.

char* ParseInt uint8 val,
const char *  str,
SError error,
bool  may_continue = 0
 

Read in an unsigned 8bit integer value.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
For more information, see ParseInt() for 32bit (unsigned) integers.

Definition at line 281 of file basicparse.cc.

References uint8.

char* ParseInt uint32 val,
const char *  str,
SError error,
bool  may_continue = 0
 

Read in an unsigned 32bit integer value.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
Works pretty much like the ParseInt() for 32bit signed integers, however "underflow" cannot occur and the negative sign is (of course) not recognized.

For more information, see ParseInt() for signed 32bit integers.

Definition at line 287 of file basicparse.cc.

References uint32.

char* ParseInt int64 val,
const char *  str,
SError error,
bool  may_continue = 0
 

Read in a signed 64bit integer value.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
For more information, see ParseInt() for 32bit integers.

Definition at line 165 of file basicparse.cc.

References int64.

char* ParseInt int16 val,
const char *  str,
SError error,
bool  may_continue = 0
 

Read in a signed 16bit integer value.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
For more information, see ParseInt() for 32bit integers.

Definition at line 159 of file basicparse.cc.

References int16.

char* ParseInt int8 val,
const char *  str,
SError error,
bool  may_continue = 0
 

Read in a signed 8bit integer value.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
For more information, see ParseInt() for 32bit integers.

Definition at line 156 of file basicparse.cc.

References int8.

char* ParseInt int32 val,
const char *  str,
SError error,
bool  may_continue = 0
 

Read in a signed 32bit integer value.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
This function reads in a signed integer value and returns that value in the *val pointer. There are versions for 16, 32 and 64 bit integer values and the compiler can choose the correct one according to the first argument.

The passed string is a standard NUL-terminated string. The parsing is done as follows:

  • First, any number of whitespace is skipped.
  • Then, the sign (either '+' or '-') is read in.
  • Then, the prefix is interpreted to determine the base. As usual, a "0" is octal, a "0x" is hexadecimal. Additionally, "0b" is binary and the rest is considered decimal.
  • As many digits as possible are read in (keeps on reading digits on overfow).
The return value points to the first non-digit symbol in the input. If this is not end-of-string NUL, and may_continue is NOT set, then this is an error (returned in SError).

In case an over/underflow occurs, the largest/smallest value representable by the type is returned and the overflow error is set in the passed SError.

Definition at line 162 of file basicparse.cc.

References int32.


Generated on Sat Feb 19 22:33:58 2005 for Ray by doxygen 1.3.5