60 static MHEG5Bool MHEG5variableIs(
MHEG5Root *variable);
61 static MHEG5Int MHEG5storeBool(MHEG5Bool b,
char *buf, MHEG5Int bufLen);
62 static MHEG5Int MHEG5storeString(
MHEG5String s,
char *buf, MHEG5Int bufLen);
63 static MHEG5Int MHEG5storeInt(MHEG5Int i,
char *buf, MHEG5Int bufLen);
64 static MHEG5Int MHEG5readBool(MHEG5Bool *b,
char *buf);
65 static MHEG5Int MHEG5readInt(MHEG5Int *i,
char *buf);
189 MHEG5ingredientPrint(&v->ingredient, out);
191 MHEG_PRINT(out,
":OrigValue ");
192 MHEG5boolPrint(v->originalValue, out);
212 MHEG5ingredientPrint(&v->ingredient, out);
214 MHEG_PRINT(out,
":OrigValue ");
215 MHEG5intPrint(v->originalValue, out);
236 MHEG5ingredientPrint(&v->ingredient, out);
238 MHEG_PRINT(out,
":OrigValue ");
239 MHEG5stringPrint(v->originalValue, out);
260 MHEG5ingredientPrint(&v->ingredient, out);
262 MHEG_PRINT(out,
":OrigValue :ObjectRef");
263 if (v->originalValueGid.len)
265 MHEG_PRINT(out,
" ");
266 MHEG5stringPrint(*((
MHEG5String *)&v->originalValueGid), out);
268 MHEG_PRINT(out,
" ");
269 MHEG5intPrint(v->originalValueId, out);
294 MHEG5ingredientPrint(&v->ingredient, out);
296 MHEG_PRINT(out,
":OrigValue ");
297 if (v->originalContentData.data)
299 MHEG_PRINT(out,
":ContentRef ");
300 MHEG5stringPrint(v->originalContentData, out);
303 if (v->contentData.data)
306 MHEG_PRINT(out,
"// Value:\t");
307 MHEG_PRINT(out,
":ContentRef ");
308 MHEG5stringPrint(v->contentData, out);
321 if (((
MHEG5Root *)variable)->clazz == MHEG5BOOLEANVARIABLE)
323 if (((
MHEG5Root *)variable)->clazz == MHEG5INTEGERVARIABLE)
325 if (((
MHEG5Root *)variable)->clazz == MHEG5OCTETSTRINGVARIABLE)
327 if (((
MHEG5Root *)variable)->clazz == MHEG5OBJECTREFVARIABLE)
329 if (((
MHEG5Root *)variable)->clazz == MHEG5CONTENTREFVARIABLE)
344 static MHEG5Bool MHEG5variableIs(
MHEG5Root *variable)
346 if ((variable->clazz == MHEG5BOOLEANVARIABLE) ||
347 (variable->clazz == MHEG5INTEGERVARIABLE) ||
348 (variable->clazz == MHEG5OCTETSTRINGVARIABLE) ||
349 (variable->clazz == MHEG5OBJECTREFVARIABLE) ||
350 (variable->clazz == MHEG5CONTENTREFVARIABLE))
380 variable->value = variable->originalValue;
421 variable->value = variable->originalValue;
512 ref.len = ref.ptr.group->groupName.len;
513 ref.ptr.name = ref.ptr.group->groupName.data;
516 objRef->valueGrp.len = ref.len;
517 objRef->valueGrp.data = STR_DataAlloc( ref.len );
518 if (objRef->valueGrp.data != NULL)
520 memcpy( objRef->valueGrp.data, ref.ptr.name, ref.len );
524 TRACE(TERROR, (
"failed to get memory"))
526 objRef->valueId = id;
534 objRef->valueGrp.len = ref.len;
535 objRef->valueGrp.data = STR_DataAlloc( ref.len );
536 if (objRef->valueGrp.data != NULL)
538 memcpy( objRef->valueGrp.data, ref.data, ref.len );
542 TRACE(TERROR, (
"failed to get memory"))
543 objRef->valueGrp.len = 0;
548 objRef->valueGrp.len = 0;
549 objRef->valueGrp.data = NULL;
551 objRef->valueId = id;
564 MHEG5objRefStoreValue( variable, variable->originalValueGid, variable->originalValueId );
582 if (variable->originalValueGid.len)
584 if (variable->valueGrp.len)
610 variable->contentData =
MHEG5stringCopy(variable->originalContentData);
668 if (!variable->root.runningStatus)
670 if (!variable->root.availabilityStatus)
672 switch (variable->root.clazz)
674 case MHEG5BOOLEANVARIABLE:
677 case MHEG5INTEGERVARIABLE:
680 case MHEG5OCTETSTRINGVARIABLE:
683 case MHEG5OBJECTREFVARIABLE:
686 case MHEG5CONTENTREFVARIABLE:
695 variable->root.runningStatus = MHEG5TRUE;
724 if (((
MHEG5Root *) variable)->clazz == MHEG5OCTETSTRINGVARIABLE)
728 if (((
MHEG5Root *) variable)->clazz == MHEG5CONTENTREFVARIABLE)
765 MHEG5Bool cref = MHEG5FALSE;
766 MHEG5Bool valid = MHEG5FALSE;
772 return MHEG5ERR_WRONGNUMBEROFPARAMS;
774 switch (target->clazz)
776 case MHEG5CONTENTREFVARIABLE:
777 MHEG5resolveGenericCRef(params, &cdata, &cref, &valid);
780 TRACE(TERROR, (
"Application error: ISO/IEC 13522-5 sec 26.4 - Provision of use!"))
787 if (mheg_trace_debug & TACTIONS)
798 case MHEG5BOOLEANVARIABLE:
799 (void) MHEG5resolveGenericGeneric(params, &g);
800 if (g.type == MHEG5BOOL)
806 case MHEG5INTEGERVARIABLE:
807 (void) MHEG5resolveGenericGeneric(params, &g);
808 if (g.type == MHEG5INT)
812 if (g.type == MHEG5OCTETSTRING)
817 if (mheg_trace_debug & TACTIONS)
824 case MHEG5OCTETSTRINGVARIABLE:
825 (void) MHEG5resolveGenericGeneric(params, &g);
831 case MHEG5OCTETSTRING:
841 if (mheg_trace_debug & TACTIONS)
844 strcpy(buff,
" <- ");
852 case MHEG5OBJECTREFVARIABLE:
855 thirdParam = MHEG5resolveGenericGeneric(params, &g);
856 if (g.type == MHEG5OBJECTREF)
858 MHEG5objRefStoreValue( objRef, g.value.o.gref, g.value.o.id );
864 fourthParam = MHEG5resolveGenericGeneric(thirdParam, &g);
866 if (g.type == MHEG5OCTETSTRING)
868 MHEG5objRefStoreString( objRef, g.value.s, 0 );
871 MHEG5resolveGenericGeneric(fourthParam, &g);
872 if (g.type == MHEG5INT)
874 objRef->valueId = g.value.i;
882 ERROR_PRINT((
"ERROR: MHEG5setVariable: Invalid object class for setting variable value\n"));
883 return MHEG5ERR_WRONGTARGET;
885 return MHEG5ERR_NOERROR;
926 static const char opstr[6][3] = {
"==",
"!=",
"< ",
"<=",
"> ",
">="};
931 MHEG5Bool cref = MHEG5FALSE;
932 MHEG5Bool eq = MHEG5FALSE;
935 MHEG5Bool invalidString;
939 if (!MHEG5variableIs(target))
941 return MHEG5ERR_WRONGTARGET;
947 return MHEG5ERR_WRONGNUMBEROFPARAMS;
949 thirdParam = MHEG5resolveGenericInteger(params, &op);
952 return MHEG5ERR_WRONGNUMBEROFPARAMS;
955 if ((op < 1) || (op > (target->clazz == MHEG5INTEGERVARIABLE ? 6 : 2)))
957 ERROR_PRINT((
"MHEG5testVariable invalid Operator %ld\n", op));
958 return MHEG5ERR_WRONGPARAM;
962 eventData = MHEG5FALSE;
966 switch (target->clazz)
968 case MHEG5CONTENTREFVARIABLE:
970 MHEG5resolveGenericCRef(thirdParam, &cdata, &cref, &invalidString);
971 if (op == 1 && cref &&
974 eventData = MHEG5TRUE;
978 eventData = MHEG5TRUE;
981 case MHEG5INTEGERVARIABLE:
983 MHEG5resolveGenericInteger(thirdParam, &csize);
989 eventData = MHEG5TRUE;
995 eventData = MHEG5TRUE;
1001 eventData = MHEG5TRUE;
1007 eventData = MHEG5TRUE;
1013 eventData = MHEG5TRUE;
1019 eventData = MHEG5TRUE;
1024 if (mheg_trace_debug & TACTIONS)
1030 case MHEG5BOOLEANVARIABLE:
1032 MHEG5resolveGenericBoolean(thirdParam, &cref);
1036 eventData = MHEG5TRUE;
1039 case MHEG5OCTETSTRINGVARIABLE:
1045 return MHEG5ERR_WRONGPARAM;
1051 eventData = MHEG5TRUE;
1054 case MHEG5OBJECTREFVARIABLE:
1064 vRef.len = objref->valueGrp.len;
1065 vRef.ptr.name = objref->valueGrp.data;
1072 if ((eq && (op == 1)) || (!eq && (op == 2)))
1074 eventData = MHEG5TRUE;
1079 ERROR_PRINT((
"MHEG5testVariable internal error - target->clazz = %d\n", target->clazz));
1084 return MHEG5ERR_NOERROR;
1114 return MHEG5ERR_WRONGNUMBEROFPARAMS;
1115 if (target->clazz != MHEG5INTEGERVARIABLE)
1116 return MHEG5ERR_WRONGTARGET;
1117 MHEG5resolveGenericInteger(params, &value);
1119 if (mheg_trace_debug & TACTIONS)
1125 return MHEG5ERR_NOERROR;
1152 return MHEG5ERR_WRONGNUMBEROFPARAMS;
1153 if (target->clazz != MHEG5INTEGERVARIABLE)
1154 return MHEG5ERR_WRONGTARGET;
1155 MHEG5resolveGenericInteger(params, &value);
1157 if (mheg_trace_debug & TACTIONS)
1163 return MHEG5ERR_NOERROR;
1191 return MHEG5ERR_WRONGNUMBEROFPARAMS;
1192 if (target->clazz != MHEG5INTEGERVARIABLE)
1193 return MHEG5ERR_WRONGTARGET;
1194 MHEG5resolveGenericInteger(params, &value);
1197 return MHEG5ERR_NOERROR;
1225 return MHEG5ERR_WRONGNUMBEROFPARAMS;
1226 if (target->clazz != MHEG5INTEGERVARIABLE)
1227 return MHEG5ERR_WRONGTARGET;
1228 MHEG5resolveGenericInteger(params, &value);
1235 MHEG5LogPrintf(MHEG5WARNING,
"Division by zero\n");
1238 return MHEG5ERR_NOERROR;
1269 return MHEG5ERR_WRONGNUMBEROFPARAMS;
1270 if (target->clazz != MHEG5INTEGERVARIABLE)
1271 return MHEG5ERR_WRONGTARGET;
1272 MHEG5resolveGenericInteger(params, &value);
1279 MHEG5LogPrintf(MHEG5WARNING,
"Modulo division by zero\n");
1282 return MHEG5ERR_NOERROR;
1310 MHEG5Bool invalidString;
1316 return MHEG5ERR_WRONGNUMBEROFPARAMS;
1318 if (target->clazz != MHEG5OCTETSTRINGVARIABLE)
1320 return MHEG5ERR_WRONGTARGET;
1327 return MHEG5ERR_WRONGPARAM;
1332 return MHEG5ERR_NOERROR;
1337 if (mheg_trace_debug & TACTIONS)
1339 DBG_PRINTF(
" lens: %ld += %ld", os->value.len, value.len);
1348 if (mheg_trace_debug & TACTIONS)
1351 strcpy(buff,
" rst: ");
1352 MHEG5stringTrace( os->value, buff, 0, 120 );
1358 return MHEG5ERR_NOERROR;
1365 static MHEG5Int MHEG5storeBool(MHEG5Bool b,
char *buf, MHEG5Int bufLen)
1376 static MHEG5Int MHEG5storeString(
MHEG5String s,
char *buf, MHEG5Int bufLen)
1378 if (bufLen < (MHEG5Int)
sizeof(s.len))
1380 memcpy(buf, &s.len,
sizeof(s.len));
1381 if (s.len + (MHEG5Int)
sizeof(s.len) > bufLen)
1384 memcpy(&buf[
sizeof(s.len)], s.data, s.len);
1385 return s.len +
sizeof(s.len);
1388 static MHEG5Int MHEG5storeInt(MHEG5Int i,
char *buf, MHEG5Int bufLen)
1390 if (bufLen < (MHEG5Int)
sizeof(i))
1392 memcpy(buf, &i,
sizeof(i));
1396 static MHEG5Int MHEG5readBool(MHEG5Bool *b,
char *buf)
1405 static MHEG5Int MHEG5readString(
MHEG5String *s,
char *buf, MHEG5Int max_size)
1407 memcpy(&s->len, buf,
sizeof(s->len));
1410 if (s->len > max_size)
1417 return sizeof(s->len);
1420 s->data = STR_DataAlloc( s->len );
1421 memcpy(s->data, &buf[
sizeof(s->len)], s->len);
1422 return s->len +
sizeof(s->len);
1425 static MHEG5Int MHEG5readInt(MHEG5Int *i,
char *buf)
1427 memcpy(i, buf,
sizeof(*i));
1439 MHEG5Int len = 0, rc;
1449 case MHEG5CONTENTREFVARIABLE:
1457 case MHEG5INTEGERVARIABLE:
1465 case MHEG5BOOLEANVARIABLE:
1473 case MHEG5OCTETSTRINGVARIABLE:
1481 case MHEG5OBJECTREFVARIABLE:
1511 MHEG5Int pos = 0, rc, id;
1524 case MHEG5CONTENTREFVARIABLE:
1530 case MHEG5INTEGERVARIABLE:
1535 case MHEG5BOOLEANVARIABLE:
1540 case MHEG5OCTETSTRINGVARIABLE:
1546 case MHEG5OBJECTREFVARIABLE:
1550 rc = MHEG5readInt( &
id, &buf[pos] );
1552 rc = MHEG5readString(&objRef->valueGrp, &buf[pos], max_size);
1553 objRef->valueId = id;
void MHEG5ingredientInit(MHEG5Ingredient *ingredient)
Initialise a ingredient object with default values.
MHEG5Int MHEG5variableStore(MHEG5Ingredient *v, void *buf, MHEG5Int bufLen)
This functions stores the value of a variable in the persistant storage. Implementation of the StoreP...
void MHEG5booleanVariablePrepare(MHEG5BooleanVariable *variable)
Sets all internal attributes for the specified object to their default values.
MHEG5Bool MHEG5stringEqual(MHEG5String *s1, MHEG5String *s2)
Compare two Strings (case sensitive!)
void MHEG5objectRefVariableInit(MHEG5ObjectRefVariable *variable)
Initialise an objectRefVariable object with default values.
void MHEG5octetStringVariablePrepare(MHEG5OctetStringVariable *variable)
Sets all internal attributes for the specified object to their default values.
void MHEG5objectRefVariableFree(MHEG5ObjectRefVariable *variable)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
void MHEG5booleanVariableFree(MHEG5BooleanVariable *variable)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
void MHEG5ingredientDestruct(MHEG5Ingredient *ingredient)
Implementation of the Destruction behaviour Execute the following sequence of actions: ...
void MHEG5contentVariableFree(MHEG5ContentVariable *variable)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
MHEG5Int MHEG5strToInt(MHEG5String string)
Convert a MHEG5String to a MHEG5Integer.
void MHEG5contentVariableInit(MHEG5ContentVariable *variable)
Initialise a contentVariable object with default values.
void MHEG5octetStringVariableFree(MHEG5OctetStringVariable *variable)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
MHEG5String MHEG5stringCopy(MHEG5String source)
<Function description>="">
Implement the MHEG5 Variable Class 21 Variable Class Defines a variable within the context of a Group...
void MHEG5stringDestruct(MHEG5String *item)
Destruct a MHEG5String.
void MHEG5objectRefVariablePrepare(MHEG5ObjectRefVariable *variable)
Sets all internal attributes for the specified object to their default values.
void MHEG5integerVariablePrepare(MHEG5IntegerVariable *variable)
Sets all internal attributes for the specified object to their default values.
void MHEG5variableDeactivate(MHEG5Ingredient *variable)
Apply the deactivation behaviour of the variable class. As this class has no own deactivation behavio...
MHEG5Int MHEG5variableRead(MHEG5Ingredient *v, char *buf, MHEG5Int max_size)
This functions reads the value of a variable from the persistant storage. Implementation of the ReadP...
MHEG5ErrorCode MHEG5append(MHEG5Root *target, MHEG5GList *params)
Appends AppendValue to Target Variable. Target variable is the first operand of the infix operation...
MHEG5ErrorCode MHEG5divide(MHEG5Root *target, MHEG5GList *params)
Divides Target Variable by Value. Target variable is the first operand of the infix operation...
MHEG5ErrorCode MHEG5add(MHEG5Root *target, MHEG5GList *params)
Add Target Variable to Value. Target variable is the first operand of the infix operation. Result is stored in Target Variable. Implementation of the Add (Value) action of the IntegerVariable class.
MHEG5Bool MHEG5sameGroups(MH5GroupRef gref1, MH5GroupRef gref2)
Compares two group ID strings to see whether they both reference the same group. Relative group ID st...
MHEG5ErrorCode MHEG5subtract(MHEG5Root *target, MHEG5GList *params)
Subtract Value from Target Variable. Target variable is the first operand of the infix operation...
MHEG5ErrorCode MHEG5testVariable(MHEG5Root *target, MHEG5GList *params)
This action tests variables agains each other or against values Implementation of the TestVariable (T...
This file defines the profile for the MHEG engine.
MHEG5GList * MHEG5resolveGenericOctetString(MHEG5GList *params, MHEG5String *value, MHEG5Bool *invalidString)
Resolve a parameter reference to a generic octet string. The reference can be either direct or indire...
Implement Functions to support Service Gateways. Functions for standarizing several GroupIDs like +DS...
void MHEG5booleanVariableInit(MHEG5BooleanVariable *variable)
Initialise a booleanVariable object with default values.
void MHEG5variableActivate(MHEG5Ingredient *variable)
Apply the activation behaviour of the Variable class. Apply the activation behaviour of the variable ...
void MHEG5contentVariablePrepare(MHEG5ContentVariable *variable)
Sets all internal attributes for the specified object to their default values.
Event handling. Implementation of a combined queue for events and actions. This is the eventsystem wh...
MHEG5String MHEG5stringCat(MHEG5String string1, MHEG5String string2)
Concatenate two MHEG5Strings.
MHEG5String MHEG5intToStr(MHEG5Int i)
Convert MHEG5Int to MHEG5String.
MHEG5ErrorCode MHEG5setVariable(MHEG5Root *target, MHEG5GList *params)
Set the Value attribute of the Target object to NewVariableValue. Implementation of the SetVariable (...
void MHEG5integerVariableFree(MHEG5IntegerVariable *variable)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
void MHEG5ingredientDeactivate(MHEG5Ingredient *ingredient)
Implementation of Deactivate behaviour Inherrited from Root class.
MHEG5ErrorCode MHEG5modulo(MHEG5Root *target, MHEG5GList *params)
Returns the remainder modulo Value of Target - as defined by usual integer arithmetic rules...
Implement functions to retrieve MHEG5objects by GroupID and ID.
void MHEG5ingredientPrepare(MHEG5Ingredient *ingredient)
Implementation of the Preparation behaviour Inherrited from Root class.
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.
Implementation of the MHEG5 Scene Class Scene Class Defines a set of Ingredient objects to be activat...
Mheg5 logging and debug printing.
MHEG5ErrorCode MHEG5multiply(MHEG5Root *target, MHEG5GList *params)
Multiplies Target Variable by Value. Target variable is the first operand of the infix operation...
void MHEG5variableDestruct(MHEG5Ingredient *variable)
Destruct a variable object.
MHEG5Scene * MHEG5getCurrentScene(void)
<Function description>="">
void MHEG5integerVariableInit(MHEG5IntegerVariable *variable)
Initialise a integerVariable object with default values.
void MHEG5ingredientFree(MHEG5Ingredient *ingredient)
Free off all memory associated with the specified object, including any exchanged attributes and inte...
void MHEG5octetStringVariableInit(MHEG5OctetStringVariable *variable)
Initialise an octetStringVariable object with default values.
void MHEG5sendSync(MHEG5Root *source, MHEG5EventType event, MHEG5Int data)
Store an event in the synchronous event queue.
void MHEG5variablePrepare(MHEG5Ingredient *variable)
Apply the preparation behaviour of the variable class Apply the preparation behaviour of the variable...
MHEG5GList * MHEG5resolveGenericORefProper(MHEG5GList *params, MH5GroupRef *pgroupRef, MHEG5Int *id)
Resolve a generic object reference, returning the object reference. The reference can be direct or in...
MHEG5Application * MHEG5getCurrentApplication(void)
<Function description>="">