GLAST/LAT > DAQ and FSW > FSW > Doxygen Index > XLX / V9-0-0

Constituent: parser     Tag: linux-gcc


Interface   Data Structures   File List   Data Fields   Globals  

util.c File Reference

General character/conversion utilities. More...

#include "XLX_p.h"
#include "EXPAT/expat.h"
#include "stdlib.h"
#include "stdio.h"
#include "string.h"
#include "ctype.h"

Include dependency graph for util.c:


Functions

static unsigned strtobin (int optns, const char *string, unsigned len, void *value)
 Convert a string to binary.
unsigned XLX_isEnabled (const char **attribute, int *enabled)
 Reads the attribute list and sets enabled accordingly.
unsigned XLX_getAttribute (const char **attribute, const char *name, int *value)
 Find a named attribute in an attribute list.
unsigned XLX_strtoi (const char *string, unsigned len, int *value)
 Convert a string to a signed 32-bit integer.
unsigned XLX_strtou (const char *string, unsigned len, unsigned *value)
 Convert a string to an unsigned 32-bit integer.
unsigned XLX_strtoll (const char *string, unsigned len, long long *value)
 Convert a string to a signed 64-bit integer.
unsigned XLX_strtoull (const char *string, unsigned len, unsigned long long *value)
 Convert a string to an unsigned 64-bit integer.
void XLX_valError (XLX_state *state, const char *func, const char *string, unsigned len)
 Report value string to be in error.
void XLX_attrError (XLX_state *state, const char *func, const char *name)
 Report missing attribute error.
void XLX_attrValError (XLX_state *state, const char *func, const char *name)
 Report invalid attribute value error.
void XLX_dispFileName (XLX_state *state, const char *func)
 Display the name of the current file being parsed.
unsigned XLX_ischar (const char *string, unsigned len)
 Test a string to see if it is a valid register wide character element.

Detailed Description

General character/conversion utilities.

Author:
James Swain & Owen Saxton
Id
util.c,v 1.12 2006/07/28 23:57:08 saxton Exp

Function Documentation

unsigned strtobin int  optns,
const char *  string,
unsigned  len,
void *  value
[static]
 

Convert a string to binary.

This routine converts a decimal or hexadecimal string to an integer. By default the string must be unsigned and the integer is 32-bit. Options allow the string to be signed, and the integer to be 64-bit.

Parameters:
optns Bit mask of conversion options: 1 = signed, 2 = 64-bit
string String to convert
len Maximum length of the string (including whitespace)
value Address of the converted value
Return values:
0 If the string represents a valid integer
-1 If the string contains invalid characters

void XLX_attrError XLX_state state,
const char *  func,
const char *  name
 

Report missing attribute error.

This routine displays the name of the missing attribute, along with the line number in and the name of the file being parsed.

Parameters:
state Current parse state
func Name of function reporting the error
name Attribute name

void XLX_attrValError XLX_state state,
const char *  func,
const char *  name
 

Report invalid attribute value error.

This routine displays the name of the attribute, along with the line number in and the name of the file being parsed.

Parameters:
state Current parse state
func Name of function reporting the error
name Attribute name

void XLX_dispFileName XLX_state state,
const char *  func
 

Display the name of the current file being parsed.

This routine is used when reporting errors during the parsing.

Parameters:
state Current parse state
func Name of function reporting the error

unsigned XLX_getAttribute const char **  attribute,
const char *  name,
int *  value
 

Find a named attribute in an attribute list.

This routine looks for the attribute in the attribute list and returns its associated value (signed decimal or hexadecimal string) converted to an integer.

Parameters:
attribute Attribute list from the start tag of the element
name Attribute to find and return
value Location to put value of attribute
Return values:
0 If the name is found and its value is valid
-1 If the value is not a valid number
-2 If the name is missing from the attribute list

unsigned XLX_ischar const char *  string,
unsigned  len
 

Test a string to see if it is a valid register wide character element.

Checks that the string has valid characters after any leading whitespace and before the start of the next tag.

Parameters:
string Layer address string to convert
len Max length of the string (including whitespace)
Return values:
1 If the string has valid characters before the start of the next tag
0 If the string does not have valid characters before the start of the next tag

unsigned XLX_isEnabled const char **  attribute,
int *  enabled
 

Reads the attribute list and sets enabled accordingly.

Parameters:
attribute Attribute list from the start tag of the element
enabled Location to write 0 (FALSE) or 1 (TRUE)
Return values:
0 If the attribute list was read correctly
-1 If there was a bad value for the 'enabled' attribute
-2 If there was no 'enabled' attribute

unsigned XLX_strtoi const char *  string,
unsigned  len,
int *  value
 

Convert a string to a signed 32-bit integer.

Parameters:
string String to convert
len Maximum length of the string (including whitespace)
value Address of the converted value
Return values:
0 If the string represents a valid integer
-1 If the string contains invalid characters

unsigned XLX_strtoll const char *  string,
unsigned  len,
long long *  value
 

Convert a string to a signed 64-bit integer.

Parameters:
string String to convert
len Maximum length of the string (including whitespace)
value Address of the converted value
Return values:
0 If the string represents a valid integer
-1 If the string contains invalid characters

unsigned XLX_strtou const char *  string,
unsigned  len,
unsigned *  value
 

Convert a string to an unsigned 32-bit integer.

Parameters:
string String to convert
len Maximum length of the string (including whitespace)
value Address of the converted value
Return values:
0 If the string represents a valid integer
-1 If the string contains invalid characters

unsigned XLX_strtoull const char *  string,
unsigned  len,
unsigned long long *  value
 

Convert a string to an unsigned 64-bit integer.

Parameters:
string String to convert
len Maximum length of the string (including whitespace)
value Address of the converted value
Return values:
0 If the string represents a valid integer
-1 If the string contains invalid characters

void XLX_valError XLX_state state,
const char *  func,
const char *  string,
unsigned  len
 

Report value string to be in error.

This routine displays the contents of the string, along with the line number in and the name of the file being parsed.

Parameters:
state Current parse state
func Name of function reporting the error
string String to report
len Max length of the string (including whitespace)


Generated on Mon Jul 31 20:39:59 2006 by  doxygen 1.4.4