GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> XLX / dev > parser / sun-gcc
#include <XLX_p.h>
#include <EXPAT/expat.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
Functions | |
| static int | strtobin (int optns, const char *string, unsigned int len, void *value) |
| Convert a string to binary. | |
| int | XLX_isEnabled (const char **attribute, int *enabled) |
| Reads the attribute list and sets enabled accordingly. | |
| int | XLX_getAttribute (const char **attribute, const char *name, int *value) |
| Find a named attribute in an attribute list. | |
| int | XLX_strtoi (const char *string, unsigned int len, int *value) |
| Convert a string to a signed 32-bit integer. | |
| int | XLX_strtou (const char *string, unsigned int len, unsigned int *value) |
| Convert a string to an unsigned 32-bit integer. | |
| int | XLX_strtoll (const char *string, unsigned int len, long long *value) |
| Convert a string to a signed 64-bit integer. | |
| int | XLX_strtoull (const char *string, unsigned int len, unsigned long long *value) |
| Convert a string to an unsigned 64-bit integer. | |
| int | XLX_getLineNum (XLX_state *state) |
| Get the current line number. | |
| void | XLX_valError (XLX_state *state, const char *func, const char *string, unsigned int 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. | |
| int | XLX_ischar (const char *string, unsigned int len) |
| Test a string for valid characters. | |
| int strtobin | ( | int | optns, | |
| const char * | string, | |||
| unsigned int | 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.
| 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 |
| 0 | If the string represents a valid integer | |
| -1 | If the string contains invalid characters |
Referenced by XLX_strtoi(), XLX_strtoll(), XLX_strtou(), and XLX_strtoull().
| 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.
| state | Current parse state | |
| func | Name of function reporting the error | |
| name | Attribute name |
References _XLX_state::parser, _XLX_state::verbose, and XLX_dispFileName().
| 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.
| state | Current parse state | |
| func | Name of function reporting the error | |
| name | Attribute name |
References _XLX_state::parser, _XLX_state::verbose, and XLX_dispFileName().
| 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.
| state | Current parse state | |
| func | Name of function reporting the error |
References _XLX_state::fName.
Referenced by XLX_attrError(), XLX_attrValError(), XLX_end(), XLX_parse(), XLX_start(), and XLX_valError().
| int 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.
| attribute | Attribute list from the start tag of the element | |
| name | Attribute to find and return | |
| value | Location to put value of attribute |
| 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 |
References XLX_strtoi().
| int XLX_getLineNum | ( | XLX_state * | state | ) |
Get the current line number.
This routine obtains the current line number in the file being parsed.
| state | Current parse state |
References _XLX_state::parser.
| int XLX_ischar | ( | const char * | string, | |
| unsigned int | len | |||
| ) |
Test a string for valid characters.
Checks that the string has valid graphic characters after any leading whitespace and before the start of the next tag.
| string | Address of string to test | |
| len | Max length of the string (including whitespace) |
| 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 |
Referenced by XLX_character_tag().
| int XLX_isEnabled | ( | const char ** | attribute, | |
| int * | enabled | |||
| ) |
Reads the attribute list and sets enabled accordingly.
| attribute | Attribute list from the start tag of the element | |
| enabled | Location to write 0 (FALSE) or 1 (TRUE) |
| 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 |
| int XLX_strtoi | ( | const char * | string, | |
| unsigned int | len, | |||
| int * | value | |||
| ) |
Convert a string to a signed 32-bit integer.
| string | String to convert | |
| len | Maximum length of the string (including whitespace) | |
| value | Address of the converted value |
| 0 | If the string represents a valid integer | |
| -1 | If the string contains invalid characters |
References strtobin().
Referenced by XLX_getAttribute().
| int XLX_strtoll | ( | const char * | string, | |
| unsigned int | len, | |||
| long long * | value | |||
| ) |
Convert a string to a signed 64-bit integer.
| string | String to convert | |
| len | Maximum length of the string (including whitespace) | |
| value | Address of the converted value |
| 0 | If the string represents a valid integer | |
| -1 | If the string contains invalid characters |
References strtobin().
| int XLX_strtou | ( | const char * | string, | |
| unsigned int | len, | |||
| unsigned int * | value | |||
| ) |
Convert a string to an unsigned 32-bit integer.
| string | String to convert | |
| len | Maximum length of the string (including whitespace) | |
| value | Address of the converted value |
| 0 | If the string represents a valid integer | |
| -1 | If the string contains invalid characters |
References strtobin().
| int XLX_strtoull | ( | const char * | string, | |
| unsigned int | len, | |||
| unsigned long long * | value | |||
| ) |
Convert a string to an unsigned 64-bit integer.
| string | String to convert | |
| len | Maximum length of the string (including whitespace) | |
| value | Address of the converted value |
| 0 | If the string represents a valid integer | |
| -1 | If the string contains invalid characters |
References strtobin().
| void XLX_valError | ( | XLX_state * | state, | |
| const char * | func, | |||
| const char * | string, | |||
| unsigned int | 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.
| state | Current parse state | |
| func | Name of function reporting the error | |
| string | String to report | |
| len | Max length of the string (including whitespace) |
References _XLX_state::parser, _XLX_state::verbose, and XLX_dispFileName().
1.5.8