18 #define realpath( a, b ) GetFullPathName( a, PATH_MAX, b, NULL )
19 #define strtoll _strtoi64
20 typedef SSIZE_T ssize_t;
27 #if defined __cplusplus
96 ssize_t count,
n =
sizeof(
buffer ) - 1;
102 f =
open( fileName, O_RDONLY );
107 while( ( count = read( f, buffer, n ) ) > 0 ) {
176 "status = %d\nXML_Error code = %d\nXML_ErrorString = %s\nerror line, column = %d, %d",
xDataXML_errXMLParser,
205 for( ; element != NULL; element = next ) {
206 next = element->
next;
263 size_t needSize = text->
length + len + 1, l;
267 if( needSize < 8 ) needSize = 8;
271 if( l < 100 ) l = 100;
279 strncpy( p, s, len );
315 int i,
n, status = 1;
318 char const **pAttris;
323 if( element == NULL )
return( 1 );
330 element->
next = NULL;
331 if( ( element->
name = (
char *)
smr_malloc2( doc->
smr, strlen( name ) + 1, 0,
"name" ) ) == NULL ) {
335 strcpy( element->
name, name );
341 for( i = 0, lens = 0, pAttris = attris; *pAttris; i++, pAttris++ ) lens += strlen( *pAttris ) + 1;
353 for( i = 0, pAttris = attris; ( i <
n ) && status; i++, a++, pAttris++ ) {
354 lens = strlen( *pAttris ) + 1;
356 strcpy( p, *pAttris );
359 lens = strlen( *pAttris ) + 1;
361 strcpy( p, *pAttris );
363 if( !strcmp(
"index", a->name ) ) {
364 element->
index = (
int) strtoll( a->value, &e, 10 );
434 return( item->
mode );
462 return( item->
mode );
471 for( i = 0; i < attributes->
number; i++ ) {
472 if( !strcmp( attributes->
attributes[i].
name, name ) )
return( 1 );
490 for( i = 0; i < attributes->
number; i++ ) {
507 return( attributes->
number );
514 if( index >= attributes->
number )
return( NULL );
547 "element %s is not xData", element->
fullName );
583 if( xDT->
start < 0 ) {
610 "missing required attribute '%s'", name );
616 "could not convert attribute %s's value = %s to an integer", name, value );
633 "missing required attribute '%s'", name );
636 *d = strtod( value, &e );
639 "could not convert attribute %s's values = %s to a double", name, value );
672 if( !strcmp( child->
name, tagName ) ) {
692 1,
"element %s does not have sub-element named %s", element->
fullName, name ); }
693 else if( list->
n > 1 ) {
695 "element %s contains more than one sub-element named %s", element->
fullName, name ); }
720 name = element->
name;
721 size = (
int) strlen( name ) + 1;
737 s = (
char *)
smr_malloc2( smr, n + 1, 0,
"traceback string" );
741 size = (
int) strlen( name ) + 1;
755 if( xDT->
ID == NULL ) {
758 else if( xDT->
ID != ID ) {
760 "Element %s is not xData object of ID %s but %s", xDT->
element->
fullName, ID, xDT->
ID );
762 return( xDT->
ID == ID );
787 if( fileName != NULL ) {
789 if( realpath( fileName, realPath ) != NULL ) {
810 if( doc == NULL )
return( NULL );
849 else if( smrUserInterface->
doc->
fileName != NULL ) {
862 int status = 1,
n =
sizeof(
tmp );
864 for( s = c; *s != 0; s++ )
if( !isspace( *s ) )
break;
869 if( *endings == 0 )
while( isspace( **e ) ) (*e)++;
873 if( *endings == 0 ) {
877 if( strchr( endings, **e ) == NULL ) {
895 int status = 1,
n =
sizeof(
tmp );
897 for( s = c; *s != 0; s++ )
if( !isspace( *s ) )
break;
898 *value = strtod( s, e );
903 if( *endings == 0 )
while( isspace( **e ) ) (*e)++;
907 if( *endings == 0 ) {
911 if( strchr( endings, **e ) == NULL ) {
942 if( strlen( In ) > size ) {
943 strncpy( Out, In, size - 5 );
945 strcat( Out,
" ..." );
963 for( i = 0; 1; i++ ) {
972 if( xDataValue == NULL ) {
996 printf(
"Unsupported xData type '%s' in element '%s'\n", xDataValue, XE->
name );
999 "Unsupported xData type = \"%s\"", xDataValue );
1015 return( xDI->
data );
1018 #if defined __cplusplus