97 ST_START, ST_SEP, ST_FIRST_DOT, ST_SECOND_DOT
103 for (i = 0, j = 0; i != ref->
len; ++i, ++j)
109 if (ref->
data[i] ==
'/')
117 if (ref->
data[i] ==
'.')
120 state = ST_FIRST_DOT;
130 if (ref->
data[i] ==
'.')
133 state = ST_SECOND_DOT;
143 if (ref->
data[i] ==
'/')
146 for (k = j - 4; k >= 0; --k)
148 if (ref->
data[k] ==
'/')
155 if (memcmp(&ref->
data[k],
"/../", 4) == 0)
181 ref->
len -= 3 * *parents;
182 memmove(ref->
data, ref->
data + 3 * *parents, ref->
len);
196 return source_names[origin].len + 1;
218 if (ref->
data[0] ==
'~')
231 if (ref->
len > 1 && ref->
data[1] ==
'/')
237 else if (ref->
data[0] ==
'/')
240 *orig = currentSource;
248 if ((ref->
len >= source_names[i].len) &&
252 *offset = source_names[i].len;
306 if (inRef->
data[offset] ==
'/')
330 while (in_len > 0 && inRef->
data[in_len - 1] ==
'\0')
336 path.
len = in_len - offset;
340 ResolveParentDir(©, &parents);
347 app_dir_len = activeAppPath.
len;
350 while (app_dir_len > 0 &&
351 activeAppPath.
data[app_dir_len - 1] !=
'/')
360 if (app_dir_len == 0 && parents > 0)
368 out.
len = source_names[orig].len + 1 + copy.
len;
371 out.
len += app_dir_len + 1;
374 if (out.
data != NULL)
376 memcpy( out.
data, source_names[orig].data, source_names[orig].len );
377 offset = source_names[orig].len;
378 out.
data[offset++] =
'/';
384 memcpy( out.
data + offset, activeAppPath.
data, app_dir_len );
385 offset += app_dir_len;
386 out.
data[offset++] =
'/';
396 else if (parents == 0)
399 out.
len = source_names[orig].len + 1 + copy.
len;
401 if (out.
data != NULL)
403 memcpy( out.
data, source_names[orig].data, source_names[orig].len );
404 offset = source_names[orig].len;
405 out.
data[offset++] =
'/';
417 else if (copy.
len == 0 && root)
420 out.
len = source_names[orig].len + 1;
422 if (out.
data != NULL)
424 memcpy( out.
data, source_names[orig].data, source_names[orig].len );
425 offset = source_names[orig].len;
426 out.
data[offset++] =
'/';
448 out.
len = source_names[origin].len;
449 if (path.
zptr != NULL)
451 if (path.
zptr[0] !=
'/')
461 if (name.
zptr != NULL)
463 if (name.
zptr[0] !=
'/')
470 if (out.
data == NULL)
472 TRACE(TERROR,(
"mem fail"))
477 memcpy( out.
data, source_names[origin].data, source_names[origin].len );
478 offset = source_names[origin].len;
479 if (path.
zptr != NULL)
481 if (path.
zptr[0] !=
'/')
483 out.
data[offset++] =
'/';
492 if (name.
zptr != NULL)
494 if (name.
zptr[0] !=
'/')
496 out.
data[offset++] =
'/';
501 assert(out.
len == offset);
551 else if (gref2.
len == 0)
566 if ((path1.
len == path2.
len) &&
590 if (activeAppPath.
data != NULL)
593 activeAppPath.
len = 0;
594 activeAppPath.
data = NULL;
599 ERROR_PRINT((
"ERROR: MHEG5setWorkingDir - app_dir too short\n"));
605 if ((app_dir.
len >= source_names[i].len) &&
606 (
MHEG5strncmp(app_dir.
data, source_names[i].data, source_names[i].len)) == 0)
614 ERROR_PRINT((
"ERROR: MHEG5setWorkingDir - unrecognised app_dir\n"));
629 while (firstByte < app_dir.
len)
631 if ((app_dir.
data[firstByte - 2] ==
'/') &&
632 (app_dir.
data[firstByte - 1] ==
'/'))
642 lastByte = app_dir.
len - 2;
643 while ((lastByte > 0) && (app_dir.
data[lastByte + 1] !=
'/'))
648 if (lastByte >= firstByte)
651 activeAppPath.
len = lastByte - firstByte + 1;
653 if (activeAppPath.
data == NULL)
655 activeAppPath.
len = 0;
660 memcpy( activeAppPath.
data, app_dir.
data + firstByte, activeAppPath.
len );
Implement MHEG5 engine control functions (i.e. start/stop etc)
void MHEG5setWorkingDir(MHEG5String app_dir)
Set the working directory for the current application. This is used to resolve relative paths...
MHEG5String MHEG5CreateUrl(E_FS_ORIGIN origin, S_STRING path, S_STRING name)
Convert a group ID from a relative reference to an absolute reference. See UK1.05 section 8...
unsigned char * STR_DataAlloc(unsigned int size)
MHEG5Int MHEG5FullOriginLength(E_FS_ORIGIN origin)
Get length for origin (e.g. "DSM://" is 6)
union sMH5GroupRef::@5 ptr
MHEG5String MHEG5stringCopy(MHEG5String source)
<Function description>="">
void MHEG5stringDestruct(MHEG5String *item)
Destruct a MHEG5String.
This file defines the profile for the MHEG engine.
MHEG5Bool MHEG5sameGroups(MH5GroupRef gref1, MH5GroupRef gref2)
Compares two group ID strings to see whether they both reference the same group. Relative group ID st...
void STR_DataFree(unsigned char *data, unsigned int size)
Implement Functions to support Service Gateways. Functions for standarizing several GroupIDs like +DS...
#define MHEG5strncmp(a, b, n)
Implementation of the MHEG5 Application Class Defines a set of Ingredient objects, which are shared within an application scope. Base class: Group Subclasses: None Status: Concrete class.
Mheg5 logging and debug printing.
MHEG5String MHEG5convertGIDGetOrigin(MHEG5String *inRef, E_FS_ORIGIN *pOrigin)
Convert a group ID from a relative reference to an absolute reference. See UK1.05 section 8...
MHEG5Bool MH5_SupportInteractionChannel(void)
Return whether Interaction channel is supported by current profile.
MHEG5String MHEG5convertGID(MHEG5String *inRef)
Convert a group ID from a relative reference to an absolute reference. See UK1.05 section 8...
MHEG5Bool MHEG5ResolveOrigin(MHEG5String *ref, E_FS_ORIGIN *orig, MHEG5Int *offset)
Resolve the orig of a reference.
MHEG5Bool MHEG5sameGroup(MH5GroupPtr gptr, MH5GroupRef gref)
Compares two group ID strings to see whether they both reference the same group. The first string is ...
Engine support utility functions for MHEG5.