17 #if defined __cplusplus
22 #define nameValueLength 1024
33 int n = (
int) strlen( fileName ) + 1, nCwd = 0;
34 char *absPath, cwd[4 * 1024] =
"", *
p, *needle;
36 if( fileName[0] !=
'/' ) {
39 if( getcwd( cwd,
sizeof( cwd ) ) == NULL ) {
43 nCwd = (
int) strlen( cwd );
46 if( ( absPath = (
char *)
smr_malloc2( smr, n, 0,
"absPath" ) ) == NULL )
return( NULL );
47 if( fileName[0] !=
'/' ) {
48 strcpy( absPath, cwd );
49 strcat( absPath,
"/" );
50 strcat( absPath, fileName ); }
52 strcpy( absPath, fileName );
56 if( ( needle = strstr( absPath,
"/./" ) ) == NULL )
break;
58 for( needle += 2; *needle;
p++, needle++ ) *
p = *needle;
63 if( ( needle = strstr( absPath,
"/../" ) ) == NULL )
break;
65 while( (
p > absPath ) && ( *
p !=
'/' ) )
p--;
66 if( *
p !=
'/' )
break;
67 if(
p == absPath )
break;
68 for( needle += 3; *needle;
p++, needle++ ) *
p = *needle;
77 const char *fmt, ... ) {
81 va_start( args, fmt );
93 if( link[0] ==
'/' ) {
94 for( linkedElement = element; linkedElement->
parent != NULL; ) linkedElement = linkedElement->
parent;
99 return( linkedElement );
106 int n = (
int) strlen( link );
107 char const *slash = strchr( link,
'/' ), *bracket = strchr( link,
'[' ), *attributesValue;
111 if( bracket != NULL ) n = (
int) ( bracket - link );
112 if( slash != NULL ) {
113 if( (
int) ( slash - link ) < n ) {
114 n = (
int) ( slash - link );
118 for( child = element->
children; child != NULL; child = child->
next ) {
119 if( strncmp( link, child->
name, n ) == 0 ) {
120 if( bracket != NULL ) {
121 if( bracket[1] !=
'@' ) {
127 if( strcmp( value, attributesValue ) )
continue;
129 if( slash == NULL )
return( child );
141 char const *equal = strchr( nameValue,
'=' ), *
p;
144 if( equal == NULL ) {
148 n = (
int) ( equal - nameValue );
153 strncpy( name, nameValue, n );
157 if( *equal != quote ) quote =
'"';
158 if( *equal != quote ) {
164 p = strchr( equal, quote );
170 n = (
int) (
p - equal );
175 strncpy( value, equal, n );
181 #if defined __cplusplus
int xDataTOM_smrLibraryID
xDataTOM_element * xDataTOM_getLinksElement(statusMessageReporting *smr, xDataTOM_element *element, char const *link)
static xDataTOM_element * xDataTOM_getLinksElement2(statusMessageReporting *smr, xDataTOM_element *element, char const *link, char const *fullLink)
#define smr_setReportError2p(smr, libraryID, code, fmt)
#define smr_setReportError2(smr, libraryID, code, fmt,...)
const XML_Char int const XML_Char * value
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
#define smr_malloc2(smr, size, zero, forItem)
static int xDataTOM_getLinksElement3(statusMessageReporting *smr, char const *nameValue, char *name, char *value, char const *fullLink)
int smr_setReportError(statusMessageReporting *smr, void *userInterface, char const *file, int line, char const *function, int libraryID, int code, char const *fmt,...)
xDataTOM_element * children
int xDataTOM_setMessageError_ReturnInt(int value, statusMessageReporting *smr, void *userData, const char *file, int line, int code, const char *fmt,...)
char * xDataTOMMisc_getAbsPath(statusMessageReporting *smr, const char *fileName)
char const * xDataTOM_getAttributesValueInElement(xDataTOM_element *element, char const *name)
xDataTOM_element * parent