MHEG5  18.9.0
MHEG5 Documentation
mh5queue.c
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2004 Ocean Blue Software Ltd
4  * Copyright © 2000 Koninklijke Philips Electronics N.V
5  *
6  * This file is part of a DTVKit Software Component
7  * You are permitted to copy, modify or distribute this file subject to the terms
8  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
9  *
10  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
11  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
12  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
13  *
14  * If you or your organisation is not a member of DTVKit then you have access
15  * to this source code outside of the terms of the licence agreement
16  * and you are expected to delete this and any associated files immediately.
17  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
18  *******************************************************************************/
46 /*---includes for this file--------------------------------------------------*/
47 #include <string.h>
48 #include "stb_os.h"
49 #include "mh5profile.h"
50 #include "mh5classes.h"
51 #include "mh5application.h"
52 #include "mh5eventtokens.h"
53 #include "mh5actiontokens.h"
54 #include "glue_memory.h"
55 #include "mh5object.h"
56 #include "mh5gate.h"
57 
58 #include "glue_debug.h"
59 #include "mh5debug.h"
60 #include "mh5display.h"
61 #include "glue_queue.h"
62 #include "mh5queue.h"
63 
64 /*---constant definitions for this file--------------------------------------*/
65 
66 #define MHEG5_SYNC_UPDATE 0
67 /* */
68 #define MAX_ACTION_LISTS (1 << 9)
69 #define ACTION_LIST_MASK (MAX_ACTION_LISTS - 1)
70 
71 #define DO_ANY_EVENT 0x0
72 #define DEFER_ASYNC_EVENTS 0x1
73 #define SUSPEND_EVENTS 0x2
74 #define STOP_ALL_EVENTS 0x4
75 
76 #define SYNC_Q_SIZE 128
77 #define SHORT_Q_SIZE 8
78 
79 #define MAX_USER_EVENTS 2
80 
81 #ifdef TRACING
82  #ifdef MH5PRINTOUT
83  #define DBGPrintAction(at, t, e, p) if (mheg_trace_debug & TACTIONS) { \
84  TraceAction(at, t, e, p); } else { MHEG5PrintAction(t, e, p); }
85  #else
86  #define DBGPrintAction(at, t, e, p) if (mheg_trace_debug & TACTIONS) { \
87  TraceAction(at, t, e, p); }
88  #endif
89  #define DBGTraceEvent(lk) if (mheg_trace_debug & (TACTIONS | TEVNTS)) TraceEvent( lk );
90  #define DBGTraceToken(lk, t, i) if (mheg_trace_debug & (TACTIONS | TEVNTS)) TraceToken( lk, t, i );
91  #define DECLARE_RC MHEG5ErrorCode rc;
92  #define ASSIGN_RC extra_trace_param = 0; rc =
93  #define DBGCheckRC(t, a, p) if (rc != MHEG5ERR_NOERROR) TraceActionError(t, a, p, rc);
94 #else
95  #ifdef MH5PRINTOUT
96  #define DBGPrintAction(at, t, e, p) MHEG5PrintAction(t, e, p);
97  #define DECLARE_RC
98  #define ASSIGN_RC (void)
99  #define DBGCheckRC(t, a, p)
100  #else
101  #ifdef MHEG5LOG
102  #define DBGPrintAction(at, t, e, p) printAction(t, e, p);
103  #define DECLARE_RC MHEG5ErrorCode rc;
104  #define ASSIGN_RC rc =
105  #define DBGCheckRC(t, a, p) if (rc != MHEG5ERR_NOERROR) printActionError(t, a, p, rc);
106  #else
107  #define DBGPrintAction(at, t, e, p)
108  #define DECLARE_RC
109  #define ASSIGN_RC (void)
110  #define DBGCheckRC(t, a, p)
111  #endif
112  #endif
113  #define DBGTraceEvent(lk)
114  #define DBGTraceToken(lk, t, i)
115 #endif
116 
117 #ifdef TRACING
118 int extra_trace_param;
119 #endif
120 
121 /*---local typedef structs for this file-------------------------------------*/
122 
123 /* Structure for storing linked list of events. Two seperate queues are
124  * maintained, one for asynchronous events and one for synchronous events.
125  */
126 typedef struct sMHEG5EventInfo
127 {
132 #ifdef TRACING
133  MHEG5Bool e_clone;
134 #endif
135 } S_EventInfo;
136 
137 typedef struct s_EventQ
138 {
139  struct s_EventQ *next;
140  unsigned char hdum; /*dbg val*/
141  unsigned char tail;
142  unsigned char tdum; /*dbg val*/
143  unsigned char head;
145 } S_EventQueue;
146 
147 typedef struct s_SyncEventQ
148 {
149  unsigned short size;
150  unsigned short slen;
152 } S_SyncQueue;
153 
154 typedef struct s_ShortSyncQ
155 {
156  unsigned short size;
157  unsigned short slen;
159 } S_ShortSyncQ;
160 
161 typedef enum
162 {
167 } E_RQ_STATUS;
168 
169 typedef MHEG5ErrorCode (*F_Action)(MHEG5Root *target, MHEG5GList *params);
170 
171 typedef struct
172 {
175 } S_Element;
176 
177 static MHEG5ErrorCode ActionNotSupported(MHEG5Root *target, MHEG5GList *params);
178 static MHEG5ErrorCode ActionNoProfileSupport(MHEG5Root *target, MHEG5GList *params);
179 static void MHEG5DeferProcessing(void);
180 static void CriticalMessageArrived(void);
181 static void CriticalMessageProcessed(void);
182 
183 #ifdef MHEG5PROFILE_UK1_06
184 #define MHEG5toggle ActionNoProfileSupport
185 #define MHEG5setLabel ActionNoProfileSupport
186 #define MHEG5select ActionNoProfileSupport
187 #define MHEG5getSelectionStatus ActionNoProfileSupport
188 #define MHEG5getLabel ActionNoProfileSupport
189 #define MHEG5deselect ActionNoProfileSupport
190 #define MHEG5openConnection ActionNoProfileSupport
191 #define MHEG5closeConnection ActionNoProfileSupport
192 #endif
193 
194 /*---local (static) variable declarations for this file----------------------*/
196  {ActionNotSupported, NOTHING },
197  {MHEG5activate, EXISTS },
198  {MHEG5add, RUNNING },
200  {MHEG5append, RUNNING },
201  {MHEG5bringToFront, AVAILABLE },
202  {MHEG5call, EXISTS },
203  {MHEG5callActionSlot, RUNNING },
204  {MHEG5clear, AVAILABLE },
205  {MHEG5clone, AVAILABLE },
206  {MHEG5closeConnection, AVAILABLE },
207  {MHEG5deactivate, AVAILABLE },
208  {MHEG5delItem, AVAILABLE },
209  {MHEG5deselect, AVAILABLE },
210  {MHEG5deselectItem, AVAILABLE },
211  {MHEG5divide, RUNNING },
212  {MHEG5drawArc, AVAILABLE },
213  {MHEG5drawLine, AVAILABLE },
214  {MHEG5drawOval, AVAILABLE },
215  {MHEG5drawPolygon, AVAILABLE },
216  {MHEG5drawPolyline, AVAILABLE },
217  {MHEG5drawRectangle, AVAILABLE },
218  {MHEG5drawSector, AVAILABLE },
219  {MHEG5fork, EXISTS },
220  {MHEG5getAvailabilityStatus, EXISTS },
221  {MHEG5getBoxSize, AVAILABLE },
222  {MHEG5getCellItem, AVAILABLE },
223  {MHEG5getCursorPosition, EXISTS },
224  {MHEG5getEngineSupport, AVAILABLE },
225  {MHEG5getEntryPoint, AVAILABLE },
226  {MHEG5getFillColour, AVAILABLE },
227  {MHEG5getFirstItem, AVAILABLE },
228  {MHEG5getHighlightStatus, AVAILABLE },
229  {MHEG5getInteractionStatus, AVAILABLE },
230  {MHEG5getItemStatus, AVAILABLE },
231  {MHEG5getLabel, EXISTS },
232  {MHEG5getLastAnchorFired, AVAILABLE },
233  {MHEG5getLineColour, AVAILABLE },
234  {MHEG5getLineStyle, AVAILABLE },
235  {MHEG5getLineWidth, AVAILABLE },
236  {MHEG5getListItem, AVAILABLE },
237  {MHEG5getListSize, AVAILABLE },
238  {MHEG5getOverwriteMode, AVAILABLE },
239  {MHEG5getPortion, AVAILABLE },
240  {MHEG5getPosition, AVAILABLE },
241  {MHEG5getRunningStatus, AVAILABLE },
242  {MHEG5getSelectionStatus, AVAILABLE },
243  {MHEG5getSliderValue, AVAILABLE },
244  {MHEG5getTextContent, AVAILABLE },
245  {MHEG5getTextData, AVAILABLE },
246  {MHEG5getTokenPosition, AVAILABLE },
247  {MHEG5getVolume, AVAILABLE },
248  {MHEG5launch, NOTHING },
249  {MHEG5lockScreen, EXISTS },
250  {MHEG5modulo, RUNNING },
251  {MHEG5move, AVAILABLE },
252  {MHEG5moveTo, AVAILABLE },
253  {MHEG5multiply, RUNNING },
254  {MHEG5openConnection, AVAILABLE },
255  {MHEG5preload, EXISTS },
256  {MHEG5putBefore, AVAILABLE },
257  {MHEG5putBehind, AVAILABLE },
258  {MHEG5quit, EXISTS },
259  {MHEG5readPersistent, AVAILABLE },
260  {MHEG5run, EXISTS },
261  {MHEG5scaleBitmap, AVAILABLE },
262  {MHEG5scaleVideo, AVAILABLE },
263  {MHEG5scrollItems, AVAILABLE },
264  {MHEG5select, AVAILABLE },
265  {MHEG5selectItem, AVAILABLE },
266  {MHEG5sendEventAction, EXISTS },
267  {MHEG5sendToBack, AVAILABLE },
268  {MHEG5setBoxSize, AVAILABLE },
269  {MHEG5setCachePriority, AVAILABLE },
270  {MHEG5setCounterEndPosition, AVAILABLE },
271  {MHEG5setCounterPosition, AVAILABLE },
272  {MHEG5setCounterTrigger, AVAILABLE },
273  {MHEG5setCursorPosition, EXISTS },
274  {MHEG5setCursorShape, EXISTS },
275  {MHEG5setData, AVAILABLE },
276  {MHEG5setEntryPoint, AVAILABLE },
277  {MHEG5setFillColour, AVAILABLE },
278  {MHEG5setFirstItem, AVAILABLE },
279  {MHEG5setFontRef, AVAILABLE },
280  {MHEG5setHighlightStatus, AVAILABLE },
281  {MHEG5setInteractionStatus, RUNNING },
282  {MHEG5setLabel, AVAILABLE },
283  {MHEG5setLineColour, AVAILABLE },
284  {MHEG5setLineStyle, AVAILABLE },
285  {MHEG5setLineWidth, AVAILABLE },
286  {MHEG5setOverwriteMode, AVAILABLE },
287  {MHEG5setPaletteRef, AVAILABLE },
288  {MHEG5setPortion, AVAILABLE },
289  {MHEG5setPosition, AVAILABLE },
290  {MHEG5setSliderValue, AVAILABLE },
291  {MHEG5setSpeed, AVAILABLE },
292  {MHEG5setTimer, EXISTS },
293  {MHEG5setTransparency, AVAILABLE },
294  {MHEG5setVariable, RUNNING },
295  {MHEG5setVolume, AVAILABLE },
296  {MHEG5spawn, NOTHING },
297  {MHEG5step, AVAILABLE },
298  {MHEG5stop, AVAILABLE },
299  {MHEG5storePersistent, AVAILABLE },
300  {MHEG5subtract, RUNNING },
301  {MHEG5testVariable, RUNNING },
302  {MHEG5toggle, AVAILABLE },
303  {MHEG5toggleItem, AVAILABLE },
304  {MHEG5transitionTo, NOTHING },
305  {MHEG5unload, AVAILABLE },
306  {MHEG5unlockScreen, EXISTS },
307  {ActionNotSupported, NOTHING },
308  {ActionNotSupported, NOTHING },
309  {ActionNotSupported, NOTHING },
310  {ActionNotSupported, NOTHING },
311  {ActionNotSupported, NOTHING },
312  {ActionNotSupported, NOTHING },
313  {ActionNotSupported, NOTHING },
314  {ActionNotSupported, NOTHING },
315  {ActionNotSupported, NOTHING },
316  {ActionNotSupported, NOTHING },
317  {ActionNotSupported, NOTHING },
318  {ActionNotSupported, NOTHING },
319  {MHEG5setBackgroundColour, AVAILABLE },
320  {MHEG5setCellPosition, AVAILABLE },
321  {MHEG5setInputRegister, EXISTS },
322  {MHEG5setTextColour, AVAILABLE },
323  {MHEG5setFontAttributes, AVAILABLE },
324  {MHEG5setVideoDecodeOffset, AVAILABLE },
325  {MHEG5getVideoDecodeOffset, EXISTS },
326  {MHEG5getFocusPosition, AVAILABLE },
327  {MHEG5setFocusPosition, AVAILABLE },
328  {MHEG5setBitmapDecodeOffset, AVAILABLE },
329  {MHEG5getBitmapDecodeOffset, EXISTS },
330  {MHEG5setSliderParameters, AVAILABLE },
331  {ActionNotSupported, NOTHING },
332  {MHEG5setDesktopColour, AVAILABLE },
333  {MHEG5getCounterPosition, AVAILABLE },
334  {MHEG5getCounterMaxPosition, AVAILABLE },
335  {ActionNotSupported, NOTHING },
336  {MHEG5setInputMask, AVAILABLE }
337 };
338 
339 /* Rule: Tails NEVER have stuff in that action list, but Heads can */
340 static MHEG5ActionList mainActionLists[MAX_ACTION_LISTS];
341 static unsigned int mainActionListHead = 0;
342 static unsigned int mainActionListTail = 0;
343 static MHEG5ActionList *action_list_ptr = NULL;
344 
345 /* Queue for asynchronous events (external events) */
346 static S_EventQueue *frst_a_queue = NULL;
347 static S_EventQueue *last_a_queue = NULL;
348 
349 /* Current investigation has shown that maximum SYNC QUEUE size (and required temp Q size) is 11
350  * for DTG test suite 3.0.2 - test 3.13.3 Sync Events 3 - so can assume it's less than 256! */
351 /* Queue for synchronous events (events generated by actions) */
352 static S_SyncQueue *the_sync_q = NULL;
353 
354 /* Flag to indicate whether events should be queued or discarded */
355 static MHEG5Bool queueEvents = MHEG5TRUE;
356 
357 static int processing_state = DO_ANY_EVENT;
358 static void *state_mutex = NULL;
359 static void *queue_notify_hdl = NULL;
360 
361 /* Maintain a count of how many times event processing has been disabled. If
362  * this count is greater than 0, processing_state flag will be clear of the SUSPEND_EVENTS bit
363  */
364 static int eventProcessingDisableCount = 0;
365 static int critical_msg_count = 0;
366 
367 /* Flag to indicate whether a display update was requested */
368 static MHEG5Bool displayUpdateRequested = MHEG5FALSE;
369 
370 /* Counter for user input events - too many user input events can cause
371  * long delays and user confusion.
372  */
373 static MHEG5Int userInputEventCount = 0;
374 
375 /*******************
376  * GLOBAL DATA *
377  ********************/
378 
379 #if defined(MH5PRINTOUT) || defined(TRACING)
380 int event_indent_num = 0;
381 #endif
382 
383 
384 /***********************
385  * FUNCTION DEFINITIONS *
386  ************************/
387 
388 MHEG5ErrorCode ActionNotSupported(MHEG5Root *target, MHEG5GList *params)
389 {
390  USE_UNWANTED_PARAM(target);
391  USE_UNWANTED_PARAM(params);
393 }
394 
395 MHEG5ErrorCode ActionNoProfileSupport(MHEG5Root *target, MHEG5GList *params)
396 {
397  USE_UNWANTED_PARAM(target);
398  USE_UNWANTED_PARAM(params);
400 }
401 
402 /*******************************************************************************
403  ********************* Debug/Tracing/Logging functions *************************
404  *******************************************************************************/
405 
406 #ifdef MH5PRINTOUT
407 
412 void MHEG5queuePrint(char *out)
413 {
414  S_EventQueue *a_queue = frst_a_queue;
415  U8BIT tail;
416 
417  MHEG_PRINT(out, "Asynchronous event queue:");
418  MHEG5newLine(out);
419  while (a_queue)
420  {
421  tail = a_queue->tail;
422  while (tail != a_queue->head)
423  {
424  MHEG_PRINT(out, "Event from (");
425  MHEG5stringPrint(a_queue->events[tail].e_grp->groupName, out);
426  MHEG_PRINT(out, " ");
427  MHEG5intPrint(a_queue->events[tail].e_id, out);
428  MHEG_PRINT(out, ") ");
429  MHEG5eventPrint((MHEG5EventType)a_queue->events[tail].e_type, out);
430  MHEG5intPrint(a_queue->events[tail].e_data, out);
431  MHEG5newLine(out);
432  tail++;
433  }
434  a_queue = a_queue->next;
435  }
436  MHEG_PRINT(out, "Synchronous event queue:");
437  MHEG5newLine(out);
438  if (the_sync_q)
439  {
440  for (tail = 0; tail != the_sync_q->slen; tail++)
441  {
442  MHEG_PRINT(out, "Event from (");
443  MHEG5stringPrint(the_sync_q->links[tail]->ingredient.root.grp->groupName, out);
444  MHEG_PRINT(out, " ");
445  MHEG5intPrint(the_sync_q->links[tail]->ingredient.root.id, out);
446  MHEG_PRINT(out, ") ");
447  MHEG5eventPrint(the_sync_q->links[tail]->eventType, out);
448  MHEG5intPrint(the_sync_q->links[tail]->eventData.value.i, out);
449  MHEG5newLine(out);
450  }
451  }
452 }
453 
454 extern int mheg_trace_source;
455 
456 void MHEG5PrintEvent(MHEG5EventType e, MHEG5Int id)
457 {
458  int ind;
459  char buff[256];
460  if (mheg_trace_source & 2)
461  {
462  ind = (event_indent_num << 1) % MAX_EVENT_INDENT;
463 
464  buff[ind + 1] = 0;
465  while (ind != 0)
466  {
467  buff[ind] = ' ';
468  ind--;
469  }
470  buff[0] = '\n';
471  strcat(buff, MHEG5eventToString(e));
472  strcat(buff, " ");
473  printf(buff);
474  MHEG5intPrint(id, buff);
475  }
476 }
477 
478 #endif /*MH5PRINTOUT*/
479 
480 #ifdef TRACING
481 static void TraceEvent( MHEG5Link *link )
482 {
483  MHEG5Group *grp_ptr;
484  int ind;
485  char buff[160];
486 
487  ind = (event_indent_num << 1) % MAX_EVENT_INDENT;
488 
489  buff[ind + 1] = 0;
490  while (ind != 0)
491  {
492  buff[ind] = ' ';
493  ind--;
494  }
495  buff[0] = '\n';
496  DBG_PRINTF( buff );
498  grp_ptr = link->ingredient.root.grp;
499  DBG_PRINTF(" link: %c%ld ", (grp_ptr->root.clazz == MHEG5SCENE) ? 'S' : 'A', link->ingredient.root.id );
500  grp_ptr = (MHEG5Group *)MHEG5getCurrentApplication();
501  assert( grp_ptr );
502  if ((grp_ptr == link->sourcegid.ptr.group) ||
503  ((link->sourcegid.len != 0) && MHEG5sameGroup(grp_ptr, link->sourcegid)))
504  {
505  DBG_PRINTF(" src: A%ld", link->source );
506  }
507  else
508  {
509  DBG_PRINTF(" src: S%ld", link->source );
510  }
511  if (link->eventData.type == MHEG5INT)
512  {
513  DBG_PRINTF(" data: %ld", link->eventData.value.i );
514  }
515  else if (link->eventData.type == MHEG5BOOL)
516  {
517  if (link->eventData.value.b)
518  {
519  DBG_PRINTF(" data: TRUE" );
520  }
521  else
522  {
523  DBG_PRINTF(" data: FALSE" );
524  }
525  }
526 }
527 
528 static void TraceAction(MHEG5Root *at, MHEG5Root *t, MHEG5ElemActionType a, MHEG5GList *l)
529 {
530  int ind;
531  char buff[224];
532  char tmp[32];
533 
534  if (t == NULL)
535  {
536  return;
537  }
538 
539  ind = (event_indent_num << 1) % MAX_EVENT_INDENT;
540 
541  buff[ind + 1] = 0;
542  while (ind != 0)
543  {
544  buff[ind] = ' ';
545  ind--;
546  }
547  buff[0] = '\n';
548  DBG_PRINTF(buff);
550  strcpy(buff, "( ");
551  if (at != NULL)
552  {
553  if (t == at)
554  {
555  sprintf(tmp, "%c%ld ", (at->grp->root.clazz == MHEG5SCENE) ? 'S' : 'A', at->id);
556  strcat(buff, tmp);
557  }
558  else
559  {
560  sprintf(tmp, "%c%ld->%c%ld ", (at->grp->root.clazz == MHEG5SCENE) ? 'S' : 'A', at->id,
561  (t->grp->root.clazz == MHEG5SCENE) ? 'S' : 'A', t->id );
562  strcat(buff, tmp);
563  }
564  }
565  while (l)
566  {
567  switch (l->generic.type)
568  {
569  case MHEG5NONE:
570  strcat(buff, "?");
571  break;
572  case MHEG5INT:
573  assert( !l->generic.indirect );
574  sprintf(tmp, "%ld", l->generic.value.i);
575  strcat(buff, tmp);
576  break;
577  case MHEG5BOOL:
578  if (l->generic.value.b)
579  {
580  strcat(buff, "true");
581  }
582  else
583  {
584  strcat(buff, "false");
585  }
586  break;
587  case MHEG5NULL:
588  break;
589  case MHEG5CONTENTREF:
590  strcat(buff, "CR:");
591  /* fallthrough */
592 
593  case MHEG5OCTETSTRING:
594  assert( !l->generic.indirect );
595  MHEG5stringTrace(l->generic.value.s, buff, 0, 100);
596  break;
597  case MHEG5BRACKETOPEN:
598  strcat(buff, "(");
599  break;
600  case MHEG5BRACKETCLOSE:
601  strcat(buff, ")");
602  break;
603  case MHEG5EVENT:
604  strcat(buff, MHEG5eventToString(l->generic.value.e));
605  break;
606  case MHEG5INTPAIR:
607  sprintf(tmp, "%ld,", l->generic.value.p.x);
608  strcat(buff, tmp);
609  sprintf(tmp, "%ld", l->generic.value.p.y);
610  strcat(buff, tmp);
611  break;
612  case MHEG5OBJREFEXT:
613  case MHEG5OBJECTREF:
615  if (at == NULL)
616  {
617  strcat(buff, "UNKNOWN:");
618  if (l->generic.value.o.gref.len)
619  {
620  strcat(buff, "(");
621  MHEG5stringTrace( *((MHEG5String *)&l->generic.value.o.gref), buff, 0, 100 );
622  sprintf(tmp, " %ld)", l->generic.value.o.id);
623  }
624  else
625  {
626  sprintf(tmp, "%ld", l->generic.value.o.id);
627  }
628  strcat(buff, tmp);
629  }
630  else
631  {
632  sprintf(tmp, "%c%ld", (at->grp->root.clazz == MHEG5SCENE) ? 'S' : 'A', at->id);
633  strcat(buff, tmp);
634  if (l->generic.indirect && at->clazz == MHEG5OBJECTREFVARIABLE)
635  {
636  t = MHEG5resolveRealObject( at );
637  if (t == NULL)
638  {
639  strcat(buff, "->BAD");
640  }
641  else
642  {
643  sprintf(tmp, "->%c%ld", (t->grp->root.clazz == MHEG5SCENE) ? 'S' : 'A', t->id );
644  strcat(buff, tmp);
645  }
646  }
647  }
648  break;
649  default:
650  strcat(buff, "// :InternalError ");
651  break;
652  }
653  strcat(buff, " ");
654  if (strlen(buff) > 196)
655  {
656  DBG_PRINTF(buff);
657  buff[0] = 0;
658  }
659  l = l->next;
660  }
661  strcat(buff, ")");
662  DBG_PRINTF(buff);
663 }
664 
665 static void TraceActionError( MHEG5Root *target, MHEG5ElemActionType type,
666  MHEG5GList *firstParam, MHEG5ErrorCode rc )
667 {
668  int id;
669  id = (target) ? target->id : -1;
670  if (mheg_trace_debug & TACTIONS)
671  {
672  DBG_PRINTF("\n");
673  }
674  switch (rc)
675  {
677  TRACE(TERROR, ("%s(%d) not supported", MHEG5actionToString(type), id))
678  break;
680  if (extra_trace_param != 0)
681  {
682  TRACE(TERROR, ("%s(%d) \"%s\" not supported by profile", MHEG5actionToString(type), id, (char *)extra_trace_param))
683  }
684  else
685  {
686  TRACE(TERROR, ("%s(%d) not supported by profile", MHEG5actionToString(type), id))
687  }
688  break;
690  TRACE(TERROR, ("%s(%d) had wrong number of params", MHEG5actionToString(type), id))
691  break;
693  if (id == -1)
694  {
695  TRACE(TERROR, ("%s - target object does not exist", MHEG5actionToString(type)))
696  }
697  else
698  {
699  /*TRACE(TERROR,("%s(%d) target object is not available",MHEG5actionToString(type), id ))*/
700  }
701  break;
703  TRACE(TERROR, ("%s(%d) - wrong type of target object", MHEG5actionToString(type), id))
704  break;
706  TRACE(TERROR, ("%s(%d) - param not available", MHEG5actionToString(type), id))
707  break;
708  case MHEG5ERR_WRONGPARAM:
709  TRACE(TERROR, ("%s(%d) - wrong type of param", MHEG5actionToString(type), id))
710  break;
712  TRACE(TERROR, ("%s(%d) - one param is not active", MHEG5actionToString(type), id))
713  break;
714  case MHEG5ERR_NOSCENE:
715  TRACE(TERROR, ("%s(%d) - missing current scene", MHEG5actionToString(type), id))
716  break;
718  TRACE(TERROR, ("%s(%d) - target not active", MHEG5actionToString(type), id))
719  break;
720  case MHEG5ERR_NOSUCHITEM:
721  TRACE(TERROR, ("%s(%d) - no such tokengroup item %d", MHEG5actionToString(type), id, extra_trace_param >> 16))
722  break;
723  case MHEG5ERR_NOSUCHSLOT:
724  TRACE(TERROR, ("%s(%d) - no slot for token position %d, slot %d", MHEG5actionToString(type), id, extra_trace_param >> 16, extra_trace_param & 0xffff))
725  break;
726  default:
727  break;
728  }
729 }
730 
731 #endif /*TRACING*/
732 
733 #ifdef MHEG5LOG
734 
743 static void printEvent(S_EventInfo *eventItem)
744 {
745  char eventName[30];
746  char generic[16];
747 
748  eventName[0] = '\0';
749  generic[0] = '\0';
750  MHEG5eventPrint((MHEG5EventType)eventItem->e_type, eventName);
751  MHEG5intPrint(eventItem->e_data, generic);
752  DEBUG_PRINT(("INFO: Testing event source ( %d ), type %s, data %s\n", eventItem->e_id, eventName, generic));
753 }
754 
764 static void printAction(MHEG5Root *t, MHEG5ElemActionType type,
765  MHEG5GList *firstParam)
766 {
767  MHEG5GList *paramList;
768  char buf[2000];
769 
770  MHEG5LogPrintf(MHEG5MESSAGE, "ElementaryAction ");
771  MHEG5LogPrintAction(MHEG5MESSAGE, type );
772  MHEG5LogPrintf(MHEG5MESSAGE, " from object ");
773  MHEG5LogPrintObjectRef(MHEG5MESSAGE, t->grp, 0);
774  MHEG5LogPrintf(MHEG5MESSAGE, " - ");
775 
776  paramList = firstParam;
777 
778  do
779  {
780  buf[0] = '\0';
781  MHEG5genericPrint(paramList->generic, buf, 0);
782  MHEG5LogPrintf(MHEG5MESSAGE, "%s ", buf);
783  paramList++;
784  }
785  while (!paramList->generic.isfirst);
786 
787  MHEG5LogPrintf(MHEG5MESSAGE, "\n");
788 }
789 
790 static void printActionError( MHEG5Root *target, MHEG5ElemActionType type,
791  MHEG5GList *firstParam, MHEG5ErrorCode rc )
792 {
793  MHEG5LogPrintf(MHEG5WARNING, "ERROR: ElementaryAction ");
794  MHEG5LogPrintAction(MHEG5WARNING, type );
795  MHEG5LogPrintf(MHEG5WARNING, " from object ");
796  MHEG5LogPrintObjectRef(MHEG5WARNING, target->grp, 0);
797  MHEG5LogPrintf(MHEG5WARNING, " - ");
798  if (target)
799  {
800  MHEG5LogPrintf(MHEG5WARNING, " target ID %d - ", target->id);
801  }
802  else
803  {
804  MHEG5LogPrintf(MHEG5WARNING, " No target specified");
805  }
806  switch (rc)
807  {
809  MHEG5LogPrintf(MHEG5WARNING, "action not supported by this engine");
810  break;
812  MHEG5LogPrintf(MHEG5WARNING, "action not supported by profile %s", MHEG5PROFILEID);
813  break;
815  MHEG5LogPrintf(MHEG5WARNING, "wrong number of params given");
816  break;
818  MHEG5LogPrintf(MHEG5WARNING, "target object is not available");
819  break;
821  MHEG5LogPrintf(MHEG5WARNING, "wrong type of target object");
822  break;
824  MHEG5LogPrintf(MHEG5WARNING, "param not available");
825  break;
826  case MHEG5ERR_WRONGPARAM:
827  MHEG5LogPrintf(MHEG5WARNING, "wrong type of param");
828  break;
830  MHEG5LogPrintf(MHEG5WARNING, " action aborted because one param is not active");
831  break;
832  case MHEG5ERR_NOSCENE:
833  MHEG5LogPrintf(MHEG5WARNING, " action aborted because of missing current scene");
834  break;
836  MHEG5LogPrintf(MHEG5WARNING, " action aborted because target not active");
837  break;
838  case MHEG5ERR_NOSUCHITEM:
839  MHEG5LogPrintf(MHEG5WARNING, " action aborted because no such tokengroup item");
840  break;
841  case MHEG5ERR_NOSUCHSLOT:
842  MHEG5LogPrintf(MHEG5WARNING, " action aborted - no action slot found");
843  break;
844  default:
845  break;
846  }
847  MHEG5LogPrintf(MHEG5WARNING, "\n");
848 }
849 
850 #endif /*MHEG5LOG*/
851 
852 
853 
854 /*******************************************************************************
855  ***************** The REAL functions for Event/Action Queues ******************
856  *******************************************************************************/
857 
859 {
860  int rtn = 1;
861  frst_a_queue = (S_EventQueue *)MHEG5getMem( sizeof(S_EventQueue));
862  if (frst_a_queue != NULL)
863  {
864  the_sync_q = (S_SyncQueue *)MHEG5getMem( sizeof(S_SyncQueue));
865  if (the_sync_q != NULL)
866  {
867  state_mutex = STB_OSCreateMutex();
868  TRACE(TKEYS, ("state_mutex=%d", state_mutex))
869  if (state_mutex != NULL)
870  {
872 
873  queue_notify_hdl = VQ_RegisterNotify( MHEG5DeferProcessing,
874  CriticalMessageArrived, CriticalMessageProcessed );
875 
876  frst_a_queue->next = NULL;
877  frst_a_queue->tail = 0;
878  frst_a_queue->head = 0;
879  last_a_queue = frst_a_queue;
880 
881  the_sync_q->size = SYNC_Q_SIZE;
882  the_sync_q->slen = 0;
883  }
884  else
885  {
886  MHEG5freeMem(frst_a_queue);
887  MHEG5freeMem(the_sync_q);
888  frst_a_queue = 0;
889  the_sync_q = 0;
890  rtn = 0;
891  }
892  }
893  else
894  {
895  MHEG5freeMem(frst_a_queue);
896  frst_a_queue = 0;
897  rtn = 0;
898  }
899  }
900  else
901  {
902  rtn = 0;
903  }
904  return rtn;
905 }
906 
915 {
916  S_EventQueue *e_q, *n_q;
917  unsigned int i;
918 
919  /* Stop receiving any more events () */
920  queueEvents = MHEG5FALSE;
921 
922  /* An Application Launch or Spawn constitutes a context change, as defined
923  * in section 53.3 of ISO/IEC13522-5. This causes pending elementary actions
924  * and events to be destroyed.
925  */
926  DEBUG_PRINT(("INFO: MHEG5queueReset clearing event and action queues\n"));
927  TRACE(TEVNTS, ("*************** QUEUE RESET *****************\n"))
928  e_q = frst_a_queue->next;
929  while (e_q)
930  {
931  n_q = e_q->next;
932  MHEG5freeMem( e_q );
933  e_q = n_q;
934  }
935  frst_a_queue->tail = frst_a_queue->head;
936  frst_a_queue->next = 0;
937  last_a_queue = frst_a_queue;
938 
939  assert( the_sync_q->size == SYNC_Q_SIZE );
940  the_sync_q->slen = 0;
941 
942  i = mainActionListHead;
943  while (i != mainActionListTail)
944  {
945  mainActionLists[i].a_ptr = NULL;
946  mainActionLists[i].total = 0;
947  #if defined(MH5PRINTOUT) || defined(TRACING)
948  mainActionLists[i].indent = 0;
949  #endif
950  i++;
951  i &= ACTION_LIST_MASK;
952  }
953 
954  userInputEventCount = 0;
955 }
956 
958 {
959  S_EventQueue *e_q;
960  U8BIT t;
961  unsigned int i;
962 
963  e_q = frst_a_queue;
964 
965  TRACE(TEVNTS, ("**** Scene=%p, e_q->tail=0x%x, e_q->head=0x%x ****\n", grp, e_q->tail, e_q->head))
966 
967  do
968  {
969  for (t = e_q->tail; t != e_q->head; t++)
970  {
971  if (e_q->events[t].e_grp == (MHEG5Group *)grp)
972  {
973  e_q->events[t].e_grp = NULL;
974  e_q->events[t].e_id = 0;
975  e_q->events[t].e_type = MHEG5NONEEVENT;
976  }
977  }
978  e_q = e_q->next;
979  }
980  while (e_q);
981 
982  assert( the_sync_q->size == SYNC_Q_SIZE );
983  the_sync_q->slen = 0;
984  i = mainActionListHead;
985  while (i != mainActionListTail)
986  {
987  mainActionLists[i].a_ptr = NULL;
988  mainActionLists[i].total = 0;
989  #if defined(MH5PRINTOUT) || defined(TRACING)
990  mainActionLists[i].indent = 0;
991  #endif
992 
993  i++;
994  i &= ACTION_LIST_MASK;
995  }
996 
997  userInputEventCount = 0;
998 }
999 
1001 {
1002  if (frst_a_queue != NULL)
1003  {
1004  MHEG5freeMem(frst_a_queue);
1005  frst_a_queue = NULL;
1006  }
1007  if (the_sync_q != NULL)
1008  {
1009  MHEG5freeMem(the_sync_q);
1010  the_sync_q = NULL;
1011  }
1012  if (state_mutex != NULL)
1013  {
1014  STB_OSDeleteMutex( state_mutex );
1015  state_mutex = NULL;
1016  }
1017 
1018  if (queue_notify_hdl != NULL)
1019  {
1020  VQ_UnRegisterNotify(queue_notify_hdl);
1021  queue_notify_hdl = NULL;
1022  }
1023 
1024  userInputEventCount = 0;
1025 }
1026 
1033 {
1034  unsigned int newTail = (mainActionListTail + 1) & ACTION_LIST_MASK;
1035 
1036  if (newTail == mainActionListHead)
1037  {
1038  /* Serious as when a malloc fails - no memory! */
1039  TRACE(TERROR, ("Eeek! MainActionLists is FULL"))
1040  }
1041  else
1042  {
1043  /* Store the group of the action source */
1044  /* Store the new actions on the queue */
1045  mainActionLists[mainActionListTail] = actions;
1046  #if defined(MH5PRINTOUT) || defined(TRACING)
1047  mainActionLists[mainActionListTail].indent = 1;
1048  #endif
1049  mainActionListTail = newTail;
1050  }
1051 }
1052 
1060 static void doAsyncEvent( S_EventInfo *eventItem )
1061 {
1062  MHEG5Link *link;
1063  int cnt = 0;
1064 
1065  /* Get pointer to the list of active Link objects */
1066  link = activeLinksHead[eventItem->e_type];
1067 
1068  if (eventItem->e_type == MHEG5USERINPUT)
1069  {
1070  #ifdef TRACING
1071  TRACE(TKEYS, (": User Input, Edata=%d", eventItem->e_data))
1072  #endif
1073  userInputEventCount--;
1074  }
1075 
1076 #if defined(MH5PRINTOUT) || defined(TRACING)
1077  event_indent_num = 0;
1078 #endif
1079 
1080  /* Repeat for each active Link object for this event type */
1081  while (link)
1082  {
1083  /* We can only get here coz there are active links for this event,
1084  * and e_grp is only NULL when e_type is a NONEVENT so we assert ... */
1085  assert( eventItem->e_grp != NULL );
1086 
1087  #ifdef _WINDOWS
1088  assert((unsigned int)eventItem->e_grp != 0xfeeefeee);
1089  #endif
1090  /* Check whether source ID matches */
1091  if (link->source == eventItem->e_id)
1092  {
1093  #ifdef TRACING
1094  assert( !eventItem->e_clone );
1095  #endif
1096  /* Check whether event data matches */
1097  if ((link->eventData.type == MHEG5NONE) ||
1098  ((link->eventData.type == MHEG5INT) && (link->eventData.value.i == eventItem->e_data)) ||
1099  ((link->eventData.type == MHEG5BOOL) && (link->eventData.value.b == eventItem->e_data)))
1100  {
1101  /* Check whether source GID matches */
1102  if ((eventItem->e_grp == link->sourcegid.ptr.group) ||
1103  ((link->sourcegid.len != 0) && MHEG5sameGroup(eventItem->e_grp, link->sourcegid)))
1104  {
1105  /* This Link Fires ! */
1106  if (cnt != 0)
1107  {
1108  TRACE(TERROR, ("more than one link (%d) fires: Link %ld", cnt, link->ingredient.root.id))
1109  }
1110  cnt++;
1111  #ifdef MH5PRINTOUT
1112  MHEG5PrintEvent(eventItem->e_type, eventItem->e_id);
1113  #endif
1114 
1115  DBGTraceEvent( link );
1116 
1118  }
1119  }
1120  }
1121  /* Process the next link in the list */
1122  link = link->nextActiveLink;
1123  }
1124 }
1125 
1131 static void processSyncEvents(void)
1132 {
1133  MHEG5Link **pLinks = the_sync_q->links + the_sync_q->slen;
1134  //TRACE(TEVNTS,("events=%d",the_sync_q->slen))
1135  do
1136  {
1137  pLinks--;
1138  mainActionListHead--;
1139  mainActionListHead &= ACTION_LIST_MASK;
1140  if (mainActionListHead == mainActionListTail)
1141  {
1142  /* Head has reached the tail, Get here in test 3.11C scene 2 */
1143 
1144  /* Note: setting ENABLE_RED_KEY_IN_3_11C may allow async events
1145  * to be processed before continuing with sync events
1146  * which would not be strictly correct according to 3.13.3 */
1147  #ifndef ENABLE_RED_KEY_IN_3_11C
1148  /* Try to recover some space in mainActionLists */
1149  do
1150  {
1151  mainActionListHead++;
1152  mainActionListHead &= ACTION_LIST_MASK;
1153  }
1154  while (mainActionListHead != mainActionListTail &&
1155  mainActionLists[mainActionListHead].total == 0);
1156  mainActionListHead--;
1157  mainActionListHead &= ACTION_LIST_MASK;
1158  if (mainActionListHead == mainActionListTail)
1159  #endif
1160  {
1161  TRACE(TERROR, ("Eeek! Head reached tail"))
1162  mainActionListHead++;
1163  mainActionListHead &= ACTION_LIST_MASK;
1164  break;
1165  }
1166  }
1167  /*TRACE(TEVNTVERB,("link effect for %ld",(*pLinks)->ingredient.root.id))*/
1168  mainActionLists[mainActionListHead] = (*pLinks)->linkEffect;
1169  #if defined(MH5PRINTOUT) || defined(TRACING)
1170  mainActionLists[mainActionListHead].indent = event_indent_num + 1;
1171  #endif
1172  the_sync_q->slen--;
1173  }
1174  while (the_sync_q->slen);
1175 }
1176 
1183 {
1184  MHEG5GList *params;
1185  while (actions.total)
1186  {
1187  if (element_act[(int)actions.a_ptr->type].stat != NOTHING &&
1188  actions.a_ptr->target == NULL)
1189  {
1190  params = actions.a_ptr->firstParam;
1191  actions.a_ptr->targetIsIndirect = params->generic.indirect;
1192  actions.a_ptr->firstParam = MHEG5resolveORef( params, &actions.a_ptr->target );
1193  }
1194  actions.a_ptr++;
1195  actions.total--;
1196  }
1197 }
1198 
1205 {
1206  while (actions.total)
1207  {
1208  actions.a_ptr->firstParam = actions.a_ptr->origFirstParam;
1209  actions.a_ptr->target = NULL;
1210  actions.a_ptr++;
1211  actions.total--;
1212  }
1213 }
1214 
1222 static void processActions(void)
1223 {
1224  MHEG5Root *target;
1225  MHEG5Action *action;
1226  E_RQ_STATUS rq_stat;
1227  DECLARE_RC
1228 
1229  /* While there are actions in the queue and event processing is enabled */
1230  while (mainActionListHead != mainActionListTail)
1231  {
1232  while (mainActionLists[mainActionListHead].total != 0)
1233  {
1234  /* take action off list */
1235  action = mainActionLists[mainActionListHead].a_ptr;
1236  mainActionLists[mainActionListHead].a_ptr++;
1237  mainActionLists[mainActionListHead].total--;
1238  #if defined(MH5PRINTOUT) || defined(TRACING)
1239  event_indent_num = mainActionLists[mainActionListHead].indent;
1240  #endif
1241 
1242  #ifdef DEBUG_ACTION_ENUMS
1243  assert( action->magic == ACTION_MAGIC_VAL );
1244  #endif
1245  assert( action->type > MHEG5NONEACTION );
1246  assert( action->type < ACTION_LAST );
1247 
1248  /* Execute the action. This may place new synchronous events onto the synchronous event queue */
1249  rq_stat = element_act[(int)action->type].stat;
1250  if (rq_stat == NOTHING)
1251  {
1252  target = NULL;
1253  }
1254  else
1255  {
1256  target = action->target;
1257  if (action->targetIsIndirect && target != NULL)
1258  {
1259  target = MHEG5resolveRealObject( target );
1260  }
1261  if (target != NULL)
1262  {
1263  switch (rq_stat)
1264  {
1265  case RUNNING:
1266  if (!target->runningStatus)
1267  {
1268  break;
1269  }
1270  case AVAILABLE:
1271  if (!target->availabilityStatus)
1272  {
1273  break;
1274  }
1275  default:
1276  case EXISTS:
1277  rq_stat = NOTHING;
1278  break;
1279  }
1280  }
1281  }
1282  if (rq_stat == NOTHING)
1283  {
1284  DBGPrintAction( action->target, target, action->type, action->firstParam )
1285 
1286  /* Call the function that implements this action */
1287  ASSIGN_RC element_act[(int)action->type].func( target, action->firstParam );
1288 
1289  DBGCheckRC( target, action->type, action->firstParam )
1290  }
1291 
1292  if (displayUpdateRequested)
1293  {
1294  /* This action requests an immediate screen update */
1296  displayUpdateRequested = MHEG5FALSE;
1297  }
1298 
1299  /* Process any synchronous events that have been raised as a result of
1300  * executing this action. And prepend actions to main queue */
1301  if (the_sync_q->slen)
1302  {
1303  processSyncEvents();
1304  }
1305 
1306  if (processing_state > DEFER_ASYNC_EVENTS)
1307  {
1308  /* suspend queue processing */
1309  return;
1310  }
1311  }
1312  assert( mainActionLists[mainActionListHead].total == 0 );
1313  mainActionListHead++;
1314  mainActionListHead &= ACTION_LIST_MASK;
1315  }
1316  /* Update the on screen display to reflect the changes caused by any of the
1317  * actions we just executed.
1318  */
1321  displayUpdateRequested = MHEG5FALSE;
1322 }
1323 
1334 {
1335  S_EventQueue *a_queue;
1336  unsigned int newHead;
1337 
1338  STB_OSMutexLock(state_mutex);
1339  processing_state &= ~DEFER_ASYNC_EVENTS;
1340  STB_OSMutexUnlock(state_mutex);
1341 
1342  if (processing_state == DO_ANY_EVENT)
1343  {
1344  /* Process any pending synchronous events, queued as a result of re-enabling
1345  * event processing. And prepend actions to main queue */
1346  if (the_sync_q->slen)
1347  {
1348  processSyncEvents();
1349  }
1350 
1351  /* Process any pending actions resulting from the synchronous events we just
1352  * processed. All actions in the queue will be processed.
1353  */
1354  processActions();
1355 
1356  /* Process each asynchronous event in the queue, processing all resulting
1357  * actions and synchronous events before proceeding to the next asynchronous
1358  * event.
1359  */
1360  assert( frst_a_queue );
1361  do
1362  {
1363  newHead = 0;
1364  a_queue = frst_a_queue;
1365  /* While there are events in the queue and event processing is enabled */
1366  while (processing_state == DO_ANY_EVENT && a_queue->tail != a_queue->head)
1367  {
1368  doAsyncEvent( a_queue->events + a_queue->tail );
1369 
1370  a_queue->tail++;
1371 
1372  /* Process any actions generated as a result of processing the
1373  * asynchronous event. All actions in the queue will be processed.
1374  */
1375  //TRACE(TEVNTS,(" EQ=%x h=%d t=%d s=%d ",a_queue,a_queue->tail, a_queue->head, processing_state ))
1376  processActions();
1377  }
1378  if (a_queue->next && (a_queue->tail == a_queue->head))
1379  {
1380  //TRACE(TEVNTS,(" EQ=%x N=%x F=%x s=%d ",a_queue, a_queue->next, frst_a_queue, processing_state ))
1381  /* move the Async queue */
1382  frst_a_queue = a_queue->next;
1383  MHEG5freeMem(a_queue);
1384  newHead = 1;
1385  }
1386  }
1387  while (newHead);
1388  }
1389 }
1390 
1401 {
1402  S_ShortSyncQ temp_event_q;
1403  MHEG5ActionList tmp_action_q[SHORT_Q_SIZE];
1404  S_SyncQueue *save_sync_q;
1405  MHEG5Root *target;
1406  MHEG5Action *action;
1407  E_RQ_STATUS rq_stat;
1408  DECLARE_RC
1409 
1410  /* ensure MHEG5sendEvent() does not go beyond the short size */
1411  temp_event_q.size = SHORT_Q_SIZE;
1412  temp_event_q.slen = 0;
1413  tmp_action_q[0] = act_q;
1414  action_list_ptr = tmp_action_q + 1;
1415 
1416  //TRACE(TEVNTS,("events=%d",the_sync_q->slen))
1417  save_sync_q = the_sync_q;
1418  the_sync_q = (S_SyncQueue *)&temp_event_q;
1419 
1420  #if defined(MH5PRINTOUT) || defined(TRACING)
1421  event_indent_num++;
1422  #endif
1423 
1424  do
1425  {
1426  action_list_ptr--;
1427  while (action_list_ptr->total != 0)
1428  {
1429  action = action_list_ptr->a_ptr;
1430  action_list_ptr->a_ptr++;
1431  action_list_ptr->total--;
1432 
1433  assert((action->type != MHEG5LAUNCH) && (action->type != MHEG5QUIT) &&
1434  (action->type != MHEG5SPAWN) && (action->type != MHEG5TRANSITIONTO));
1435 
1436  assert( action->type > MHEG5NONEACTION );
1437  assert( action->type < ACTION_LAST );
1438 
1439  rq_stat = element_act[(int)action->type].stat;
1440  if (rq_stat == NOTHING)
1441  {
1442  target = NULL;
1443  }
1444  else
1445  {
1446  target = action->target;
1447  if (action->targetIsIndirect && target != NULL)
1448  {
1449  target = MHEG5resolveRealObject( target );
1450  }
1451  if (target != NULL)
1452  {
1453  switch (rq_stat)
1454  {
1455  case RUNNING: if (!target->runningStatus)
1456  break;
1457  case AVAILABLE: if (!target->availabilityStatus)
1458  break;
1459  default:
1460  case EXISTS:
1461  rq_stat = NOTHING;
1462  break;
1463  }
1464  }
1465  }
1466  if (rq_stat == NOTHING)
1467  {
1468  DBGPrintAction( action->target, target, action->type, action->firstParam );
1469 
1470  /* Call the function that implements this action */
1471  ASSIGN_RC element_act[(int)action->type].func( target, action->firstParam );
1472 
1473  DBGCheckRC( target, action->type, action->firstParam )
1474  }
1475 
1476  /* Process any synchronous events raised */
1477  if (temp_event_q.slen != 0)
1478  {
1479  MHEG5Link *link = temp_event_q.links[0];
1480  do
1481  {
1482  temp_event_q.slen--;
1483  action_list_ptr++;
1484  *action_list_ptr = link->linkEffect;
1485  link++;
1486  }
1487  while (temp_event_q.slen != 0);
1488  }
1489  }
1490  assert( action_list_ptr->total == 0 );
1491  } while (action_list_ptr != tmp_action_q);
1492  //TRACE(TEVNTS,("events=%d",the_sync_q->slen))
1493  the_sync_q = save_sync_q;
1494  action_list_ptr = NULL;
1495 }
1496 
1503 {
1504  if (action_list_ptr != NULL)
1505  {
1506  action_list_ptr++;
1507  *action_list_ptr = actions;
1508  }
1509  else
1510  {
1511  mainActionListHead--;
1512  mainActionListHead &= ACTION_LIST_MASK;
1513  /* Store the group of the action source */
1514  /* Store the new actions on the queue */
1515  mainActionLists[mainActionListHead] = actions;
1516 
1517  #if defined(MH5PRINTOUT) || defined(TRACING)
1518  mainActionLists[mainActionListHead].indent = event_indent_num + 1;
1519  #endif
1520  }
1521 }
1522 
1529 {
1530  queueEvents = MHEG5TRUE;
1531 }
1532 
1541 {
1542  S_EventInfo *newInfo;
1543  U8BIT new_tail;
1544 
1545  assert( a_type >= MHEG5ANCHORFIRED );
1546 
1547  if (!source)
1548  {
1549  INFO_PRINT(("INFO: MHEG5sendEvent: Ignoring event %d - source is invalid\n", a_type));
1550  return;
1551  }
1552 
1553  if (!queueEvents)
1554  {
1555  /* Event processing is currently disabled - ignore this event */
1556  INFO_PRINT(("INFO: MHEG5sendEvent: Ignoring event %d (from %ld) - queueEvents is FALSE\n", a_type, source->id));
1557  return;
1558  }
1559 
1560  if (a_type == MHEG5USERINPUT)
1561  {
1562  #ifdef TRACING
1563  TRACE(TKEYS, (": User Input, Edata=%d", data))
1564  #endif
1565  if (userInputEventCount == MAX_USER_EVENTS)
1566  {
1567  /* Too many user input events */
1568  INFO_PRINT(("INFO: MHEG5sendEvent: Too many user input events\n"));
1569  return;
1570  }
1571  }
1572  else
1573  {
1574  #ifdef TRACING
1575  /*TRACE(TEVNTVERB,(" t=%d Id=%ld num=%ld",a_type,source->id,number_on_aq))*/
1576  #endif
1577  }
1578 
1579 
1580  /* We cannot assume that just coz there are no links waiting now,
1581  * that there will be no links by the time the async Q is processed
1582  * so we have to store all Async events *
1583  if ( existsLinkCount[a_type] == 0 )
1584  {
1585  INFO_PRINT(("INFO: MHEG5sendEvent: Ignor %s (from %d) - no links existing\n", MHEG5eventToString(a_type), source->id));
1586  return;
1587  }
1588  ****/
1589 
1590  new_tail = last_a_queue->head;
1591  new_tail++;
1592  if (new_tail == last_a_queue->tail)
1593  {
1594  /* overflow of Q - it is reasonable to expect that this will happen - like in DTG X.1 test */
1595  last_a_queue->next = (S_EventQueue *)MHEG5getMem( sizeof(S_EventQueue));
1596  if (last_a_queue->next == NULL)
1597  {
1598  /* malloc fail */
1599  return;
1600  }
1601  last_a_queue = last_a_queue->next;
1602  last_a_queue->next = NULL;
1603  last_a_queue->tail = 0;
1604  last_a_queue->head = 1;
1605  newInfo = last_a_queue->events;
1606  }
1607  else
1608  {
1609  newInfo = last_a_queue->events + last_a_queue->head;
1610  last_a_queue->head = new_tail;
1611  }
1612 
1613  /* Set data for the new event structure */
1614  newInfo->e_grp = source->grp;
1615  newInfo->e_id = source->id;
1616  newInfo->e_type = (U16BIT)a_type;
1617  newInfo->e_data = data;
1618 #ifdef TRACING
1619  if (source->clazz == MHEG5SCENE || source->clazz == MHEG5APPLICATION)
1620  newInfo->e_clone = MHEG5FALSE;
1621  else
1622  newInfo->e_clone = ((MHEG5Ingredient *)source)->cloned;
1623 #endif
1624  if (a_type == MHEG5USERINPUT)
1625  {
1626  userInputEventCount++;
1627  }
1628 }
1629 
1634 {
1635  MHEG5Root *application = (MHEG5Root *)MHEG5getCurrentApplication();
1636 
1637  /* Check that an application is running before sending the event */
1638  if (application)
1639  {
1640  MHEG5sendEvent(application, MHEG5ENGINEEVENT, engine_event );
1641  }
1642 }
1643 
1652 {
1653  MHEG5Link *link;
1654  int count = 0;
1655  MHEG5Int source_id = source->id;
1656  #ifdef REVERSE_MULTIPLE_LINK_ORDER
1657  MHEG5Link *links[8];
1658  #endif
1659 
1660  assert( source );
1661  assert( e_type < MHEG5ANCHORFIRED );
1662 
1663  if (!queueEvents)
1664  {
1665  /* Event processing is currently disabled - ignore this e_type */
1666  INFO_PRINT(("INFO: MHEG5sendSync: Ignoring event %d (from %ld) - queueEvents is FALSE\n", e_type, source->id));
1667  return;
1668  }
1669 
1670  /*TRACE(TEVNTVERB,(" t=%d Id=%ld num=%ld",e_type,source->id,number_on_aq))*/
1671 
1672  /* Get pointer to the list of active Link objects */
1673  link = activeLinksHead[e_type];
1674 
1675  /* Repeat for each active Link object for this event type */
1676  while (link)
1677  {
1678  assert( link->ingredient.root.runningStatus ); /* It MUST be active */
1679 
1680  /* Check whether source ID matches */
1681  if (link->source == source_id)
1682  {
1683  /* Check whether event data matches */
1684  if ((link->eventData.type == MHEG5NONE) ||
1685  ((link->eventData.type == MHEG5INT) && (link->eventData.value.i == e_data)) ||
1686  ((link->eventData.type == MHEG5BOOL) && (link->eventData.value.b == e_data)))
1687  {
1688  /* Check whether source GID matches */
1689  if ((source->grp == link->sourcegid.ptr.group) ||
1690  ((link->sourcegid.len != 0) && MHEG5sameGroup(source->grp, link->sourcegid)))
1691  {
1692  /* This Link Fires ! */
1693  //TRACE(TEVNTS,("firing link %ld",link->ingredient.root.id))
1694 
1695  #ifdef REVERSE_MULTIPLE_LINK_ORDER
1696  /* On NZ stream, found that it has bug in mheg app (courtesy of S&T) that relies on
1697  * particular order for firing links that matches for a particular Sync event
1698  * Really the app only wants the most recent one to be activated, but thats not to spec
1699  * so we will reverse the order here for AUS/NZ build
1700  */
1701  links[count++] = link;
1702 
1703  #else
1704 
1705  if (the_sync_q->slen != the_sync_q->size)
1706  {
1707  /* I don't believe it is possible for 128 (SYNC_Q_SIZE) synchronous events to be added
1708  * without processing any of them, nor would one expect that when doing
1709  * OnStartUp, OnCloseDown type of actions could there be more than 8 (SHORT_Q_SIZE)
1710  * but checked it's ok anyway */
1711  the_sync_q->links[the_sync_q->slen] = link;
1712  the_sync_q->slen++;
1713  if (count != 0)
1714  {
1715  TRACE(TERROR, ("more than one link (%d) fires: Link %ld", count, link->ingredient.root.id))
1716  }
1717  count++;
1718  }
1719 
1720  #endif
1721  }
1722  }
1723  }
1724  /* Process the next active link in the list */
1725  link = link->nextActiveLink;
1726  }
1727 
1728  #ifdef REVERSE_MULTIPLE_LINK_ORDER
1729  while (count--)
1730  {
1731  if (the_sync_q->slen != the_sync_q->size)
1732  {
1733  the_sync_q->links[the_sync_q->slen] = links[count];
1734  the_sync_q->slen++;
1735  }
1736  }
1737  #endif
1738 }
1739 
1752 {
1753  /* Keep a count of the number of requests to disable events. Only enable
1754  * event processing when the counter is zero.
1755  */
1756  if (enable)
1757  {
1758  /* Check that we have previously received a disable request */
1759  assert(eventProcessingDisableCount > 0);
1760 
1761  /* Decrement the counter of disable requests */
1762  eventProcessingDisableCount--;
1763 
1764  if (eventProcessingDisableCount <= 0)
1765  {
1766  /* Enable event processing */
1767  STB_OSMutexLock(state_mutex);
1768  processing_state &= ~SUSPEND_EVENTS;
1769  STB_OSMutexUnlock(state_mutex);
1770  }
1771  }
1772  else
1773  {
1774  assert(eventProcessingDisableCount <= 1);
1775 
1776  /* This is a disable request - increment the disable request counter */
1777  eventProcessingDisableCount++;
1778 
1779  /* We have at least one outstanding disable request - disable event
1780  * processing
1781  */
1782  STB_OSMutexLock(state_mutex);
1783  processing_state |= SUSPEND_EVENTS;
1784  STB_OSMutexUnlock(state_mutex);
1785  }
1786 }
1787 
1796 {
1797  eventProcessingDisableCount = 0;
1798  STB_OSMutexLock(state_mutex);
1799  processing_state &= ~SUSPEND_EVENTS;
1800  STB_OSMutexUnlock(state_mutex);
1801 }
1802 
1809 static void MHEG5DeferProcessing(void)
1810 {
1811  STB_OSMutexLock(state_mutex);
1812  processing_state |= DEFER_ASYNC_EVENTS;
1813  STB_OSMutexUnlock(state_mutex);
1814 }
1815 
1822 void CriticalMessageArrived(void)
1823 {
1824  STB_OSMutexLock(state_mutex);
1825  critical_msg_count++;
1826  processing_state |= STOP_ALL_EVENTS;
1827  STB_OSMutexUnlock(state_mutex);
1828 }
1829 
1835 void CriticalMessageProcessed(void)
1836 {
1837  STB_OSMutexLock(state_mutex);
1838  assert( critical_msg_count > 0 );
1839  if (critical_msg_count > 0)
1840  {
1841  critical_msg_count--;
1842  if (critical_msg_count == 0)
1843  {
1844  processing_state &= ~STOP_ALL_EVENTS;
1845  }
1846  }
1847  STB_OSMutexUnlock(state_mutex);
1848 }
1849 
1856 {
1857  displayUpdateRequested = MHEG5TRUE;
1858 }
1859 
MHEG5Bool availabilityStatus
Definition: mh5root.h:52
void MHEG5sendEvent(MHEG5Root *source, MHEG5EventType a_type, MHEG5Int data)
Store an event in the asynchronous event queue .
Definition: mh5queue.c:1540
U8BIT indirect
Definition: mh5base.h:149
MH5GroupRef gref
Definition: mh5base.h:110
unsigned short slen
Definition: mh5queue.c:150
MHEG5ErrorCode MHEG5setLineWidth(MHEG5Root *target, MHEG5GList *params)
Definition: mh5lineart.c:271
#define DBGCheckRC(t, a, p)
Definition: mh5queue.c:110
MHEG5ErrorCode MHEG5subtract(MHEG5Root *target, MHEG5GList *params)
Subtract Value from Target Variable. Target variable is the first operand of the infix operation...
Definition: mh5variable.c:1145
MHEG5ErrorCode MHEG5sendEventAction(MHEG5Root *target, MHEG5GList *params)
The actions inserts an event defined by the given parameters into the systems event queue...
Definition: mh5scene.c:640
MHEG5ErrorCode MHEG5clone(MHEG5Root *target, MHEG5GList *params)
Implementation of the Clone action Clone (CloneRefVar) If the engine supports the Cloning option the ...
MHEG5ErrorCode MHEG5getLineWidth(MHEG5Root *target, MHEG5GList *params)
Retrieve the current Line Width of the DynamicLineart object Implementation of the GetLineWidth actio...
MHEG5ErrorCode MHEG5getFocusPosition(MHEG5Root *target, MHEG5GList *params)
Definition: mh5hypertext.c:343
MHEG5ErrorCode MHEG5move(MHEG5Root *target, MHEG5GList *params)
Move the token between elements of the group. The movement to apply from any particular element locat...
MHEG5Bool MHEG5sameGroup(MH5GroupPtr gptr, MH5GroupRef gref)
Compares group ptr with group ref to see whether they both reference the same group. The first is pointer to group, the second can be a relative group name and will be converted to absolute prior to the comparison, so two different references that resolve to reference the same group name produces a True return value.
Definition: mh5gate.c:517
U8BIT isfirst
Definition: mh5base.h:150
MHEG5ErrorCode MHEG5getListItem(MHEG5Root *target, MHEG5GList *params)
Implementation of the ListGroup GetListItem elementary action.
Event to String conversion.
MHEG5ErrorCode MHEG5getFirstItem(MHEG5Root *target, MHEG5GList *params)
Implementation of the ListGroup GetFirstItem elementary action.
unsigned short size
Definition: mh5queue.c:156
MHEG5ErrorCode MHEG5openConnection(MHEG5Root *target, MHEG5GList *params)
Impelemtation of the OpenConnection (OpenSucceeded, Protocol, Address, ConnectionTag) action of the a...
E_RQ_STATUS stat
Definition: mh5queue.c:174
struct s_SyncEventQ S_SyncQueue
#define DBG_PRINTF(...)
Definition: glue_debug.h:127
MHEG5ErrorCode MHEG5getLineColour(MHEG5Root *target, MHEG5GList *params)
Retrieve the current LineColour of the DynamicLineart Object Implementation of the GetLineColour acti...
MHEG5ErrorCode MHEG5getListSize(MHEG5Root *target, MHEG5GList *params)
Implementation of the ListGroup GetListSize elementary action.
MHEG5ErrorCode MHEG5callActionSlot(MHEG5Root *target, MHEG5GList *params)
const char * data
Definition: mh5gate.c:56
MHEG5ErrorCode MHEG5setCursorShape(MHEG5Root *target, MHEG5GList *params)
This action sets a new cursor shape. Implementation of the SetCursorShape (NewCursorShape) action of ...
Definition: mh5scene.c:715
MHEG5ErrorCode MHEG5getHighlightStatus(MHEG5Root *target, MHEG5GList *params)
void MHEG5stopEventsAndResetQueue(void)
Discard any pending events and actions and prevent future events from being queued. And reset queues. See also MHEG5queueEvents.
Definition: mh5queue.c:914
MHEG5Int i
Definition: mh5base.h:154
MHEG5ErrorCode MHEG5preload(MHEG5Root *target, MHEG5GList *params)
Implementation of the Preload action Preload Prepares an Ingredient and provides a hint to the MHEG-5...
MHEG5ErrorCode MHEG5getInteractionStatus(MHEG5Root *target, MHEG5GList *params)
MHEG5ErrorCode MHEG5setCounterTrigger(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to update the list of CounterTriggers for a Stream object SetCounterTrig...
Definition: mh5stream.c:500
struct s_EventQ S_EventQueue
MHEG5String s
Definition: mh5base.h:156
#define SYNC_Q_SIZE
Definition: mh5queue.c:76
#define INFO_PRINT(x)
Definition: mh5debug.h:69
MHEG5ErrorCode MHEG5unload(MHEG5Root *target, MHEG5GList *params)
Implementation of the Unload action Unload Destroys an Ingredient and provides a hint to the MHEG-5 e...
void MHEG5queueUnresolveTargets(MHEG5ActionList actions)
Clear targets for the action list.
Definition: mh5queue.c:1204
MHEG5ErrorCode MHEG5getVideoDecodeOffset(MHEG5Root *target, MHEG5GList *params)
Implementation of the GetVideoDecodeOffset (XOffsetVar, YOffsetVar) action of the video class...
Definition: mh5video.c:368
MHEG5ErrorCode MHEG5setFirstItem(MHEG5Root *target, MHEG5GList *params)
Implementation of the ListGroup SetFirstItem elementary action.
MHEG5ErrorCode MHEG5deselectItem(MHEG5Root *target, MHEG5GList *params)
Implementation of the ListGroup DeselectItem elementary action.
MHEG5ObjectReference o
Definition: mh5base.h:159
struct s_EventQ * next
Definition: mh5queue.c:139
U16BIT type
Definition: mh5base.h:151
MHEG5ErrorCode MHEG5setTextColour(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to set the TextColour to the given colour. Implementation of the MHEG5se...
Definition: mh5text.c:585
MHEG5Root * MHEG5findObject(MH5GroupRef gid, MHEG5Int id)
Definition: mh5object.c:65
void MHEG5displayUpdate(void)
Update the display, redrawing any visible objects that are in the dirty rectangle.
Definition: mh5display.c:2035
Debug tracing.
void STB_OSDeleteMutex(void *mutex)
Delete a mutex.
MHEG5 queue.
void MHEG5displayUnlockStreams(void)
Unlock streams, allow stream updates.
Definition: mh5display.c:2963
MHEG5ErrorCode MHEG5getAvailabilityStatus(MHEG5Root *target, MHEG5GList *params)
Implementation of the GetAvailabilityStatus action GetAvailabilityStatus (AvailabilityStatusVar) Set ...
Definition: mh5root.c:284
MHEG5ErrorCode MHEG5getOverwriteMode(MHEG5Root *target, MHEG5GList *params)
Retrieve the overwrite mode of the entryfield Implementation of the GetOverwriteMode action of the en...
MHEG5ErrorCode MHEG5getEngineSupport(MHEG5Root *target, MHEG5GList *params)
Implementation of the GetEngineSupport action of the application class GetEngineSupport (Feature...
#define ACTION_LIST_MASK
Definition: mh5queue.c:69
#define MHEG5getMem
Definition: glue_memory.h:93
MHEG5ErrorCode MHEG5getRunningStatus(MHEG5Root *target, MHEG5GList *params)
Implementation of the GetRunningStatus action GetRunningStatus (RunningStatusVar) Set the Variable re...
Definition: mh5root.c:336
MHEG5Final clazz
Definition: mh5root.h:55
MHEG5Bool b
Definition: mh5base.h:155
MHEG5ErrorCode MHEG5setVideoDecodeOffset(MHEG5Root *target, MHEG5GList *params)
Implementation of the SetVideoDecodeOffset (NewXOffset, NewYOffset) action of the video class...
Definition: mh5video.c:312
MHEG5ErrorCode MHEG5getBoxSize(MHEG5Root *target, MHEG5GList *params)
Returns the size of the bounding box of the target Visible. Implementation of the GetBoxSize (XBoxSiz...
Definition: mh5visible.c:671
MHEG5ErrorCode MHEG5unlockScreen(MHEG5Root *target, MHEG5GList *params)
Impelemtation of the UnlockScreen action of the application class This action may refresh the display...
union sMH5GroupRef::@5 ptr
#define MAX_USER_EVENTS
Definition: mh5queue.c:79
MHEG5ErrorCode MHEG5setCounterEndPosition(MHEG5Root *target, MHEG5GList *params)
Implementation of the SetCounterEndPosition (Target, NewPosition) action of the stream class...
Definition: mh5stream.c:785
#define DBGTraceEvent(lk)
Definition: mh5queue.c:113
MHEG5ErrorCode MHEG5drawArc(MHEG5Root *target, MHEG5GList *params)
Draws an arc between "StartAngle" and "StartAngle" + "ArcAngle". Implementation of the DrawArc action...
unsigned short size
Definition: mh5queue.c:149
#define SUSPEND_EVENTS
Definition: mh5queue.c:73
MHEG5ErrorCode MHEG5getTextData(MHEG5Root *target, MHEG5GList *params)
Set the Variable referenced by TextDataVar to the value of the TextData attribute. Implementation of the GetTextData (Target, TextDataVar) action of the text class.
Definition: mh5text.c:470
MHEG5Short MHEG5ElemActionType
Definition: mh5action.h:184
MHEG5ElemActionType type
Definition: mh5action.h:195
MHEG5ErrorCode MHEG5addItem(MHEG5Root *target, MHEG5GList *params)
Implementation of the ListGroup AddItem elementary action.
MHEG5ErrorCode MHEG5setHighlightStatus(MHEG5Root *target, MHEG5GList *params)
union MHEG5Generic::@6 value
unsigned char hdum
Definition: mh5queue.c:140
void MHEG5sendSync(MHEG5Root *source, MHEG5EventType e_type, MHEG5Int e_data)
Store an event in the synchronous event queue.
Definition: mh5queue.c:1651
MHEG5ErrorCode MHEG5multiply(MHEG5Root *target, MHEG5GList *params)
Multiplies Target Variable by Value. Target variable is the first operand of the infix operation...
Definition: mh5variable.c:1183
MHEG5ErrorCode MHEG5setBackgroundColour(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to set the BackgroundColour to the given colour. Implementation of the M...
Definition: mh5text.c:620
MHEG5ErrorCode MHEG5select(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to select a button. Implementation of the Select action of the button cl...
Definition: mh5button.c:232
MHEG5ErrorCode MHEG5deselect(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to deselect the button. Implementation of the Deselect action of the but...
Definition: mh5button.c:275
#define STOP_ALL_EVENTS
Definition: mh5queue.c:74
MH5GroupPtr grp
Definition: mh5root.h:57
MHEG5ErrorCode MHEG5step(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to modify the SliderValue of the target by the number given...
Definition: mh5slider.c:313
MHEG5EventType
Definition: mh5base.h:114
MHEG5ErrorCode MHEG5run(MHEG5Root *target, MHEG5GList *params)
<Function description>="">
MHEG5ErrorCode MHEG5setEntryPoint(MHEG5Root *target, MHEG5GList *params)
Set the entrypoint for the entryfield Implementation of the SetEntryPoint action of the entryfield cl...
MHEG5ErrorCode MHEG5putBehind(MHEG5Root *target, MHEG5GList *params)
Put a Visible exactly below another Visible in the display stack. Implementation of the PutBehind (Re...
Definition: mh5visible.c:891
void MHEG5requestDisplayUpdate(void)
Request display update at the end of synchronous event processing Note that this function can only be...
Definition: mh5queue.c:1855
MHEG5ErrorCode MHEG5drawRectangle(MHEG5Root *target, MHEG5GList *params)
Draws a rectangle. Implementation of the DrawRectangle action of the dynamiclineart class...
S_EventInfo events[256]
Definition: mh5queue.c:144
MHEG5ErrorCode MHEG5divide(MHEG5Root *target, MHEG5GList *params)
Divides Target Variable by Value. Target variable is the first operand of the infix operation...
Definition: mh5variable.c:1218
MHEG5ErrorCode MHEG5getLastAnchorFired(MHEG5Root *target, MHEG5GList *params)
Definition: mh5hypertext.c:308
MHEG5ErrorCode MHEG5drawPolygon(MHEG5Root *target, MHEG5GList *params)
Draw a closed polygon. Implementation of the DrawPolygon action of the dynamiclineart class...
uint8_t U8BIT
Definition: techtype.h:82
long MHEG5Int
Definition: mh5base.h:73
MHEG5ErrorCode MHEG5setInputRegister(MHEG5Root *target, MHEG5GList *params)
Change the InputEventRegister attribute of the target Scene object. Changing the register will affect...
Definition: mh5scene.c:897
MHEG5GList * firstParam
Definition: mh5action.h:193
MHEG5ErrorCode MHEG5setBitmapDecodeOffset(MHEG5Root *target, MHEG5GList *params)
Implementation of the SetBitmapDecodeOffset (NewXOffset, NewYOffset) action of the bitmap class...
Definition: mh5bitmap.c:376
MHEG5ErrorCode MHEG5getCellItem(MHEG5Root *target, MHEG5GList *params)
Implementation of the ListGroup GetCellItem elementary action.
MHEG5ErrorCode MHEG5delItem(MHEG5Root *target, MHEG5GList *params)
Implementation of the ListGroup DelItem elementary action.
MHEG5ErrorCode MHEG5setData(MHEG5Root *target, MHEG5GList *params)
Implementation of SetData action SetData (NewContent) Set the Content attribute of the target Ingredi...
struct sMHEG5EventInfo S_EventInfo
MHEG5ErrorCode MHEG5call(MHEG5Root *target, MHEG5GList *params)
Definition: mh5program.c:364
const char * MHEG5actionToString(MHEG5ElemActionType action)
MHEG5ErrorCode MHEG5toggle(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to toggle the selection state of the switchbutton. Implementation of the...
Memory functions.
MHEG5Root * MHEG5resolveRealObject(MHEG5Root *objref)
Definition: mh5object.c:254
MHEG5ErrorCode MHEG5setFillColour(MHEG5Root *target, MHEG5GList *params)
Definition: mh5lineart.c:406
void STB_OSMutexUnlock(void *mutex)
Unlock a mutex (a.k.a. &#39;leave&#39;, &#39;signal&#39; or &#39;release&#39;)
#define DBGPrintAction(at, t, e, p)
Definition: mh5queue.c:107
MHEG5ErrorCode MHEG5closeConnection(MHEG5Root *target, MHEG5GList *params)
Impelemtation of the CloseConnection(ConnectionTag) action of the application class |NOT IMPLEMENTED...
#define MHEG5freeMem
Definition: glue_memory.h:94
void MHEG5sendAppEngineEvent(E_ENGINE_EVENT engine_event)
Store an Engine event in the asynchronous event queue.
Definition: mh5queue.c:1633
MHEG5ErrorCode MHEG5storePersistent(MHEG5Root *target, MHEG5GList *params)
Implementation of the StorePersistent (StoreSucceeded, InVariables, OutFileName) action from the appl...
MHEG5ErrorCode MHEG5sendToBack(MHEG5Root *target, MHEG5GList *params)
Put a Visible at the background of the screen. Implementation of the SendToBack action of the visible...
Definition: mh5visible.c:784
MHEG5Action * a_ptr
Definition: mh5action.h:201
This file defines the profile for the MHEG engine.
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.
Definition: mh5variable.c:1107
void * VQ_RegisterNotify(F_QueueNotify normal_rcvd, F_QueueNotify critical_rcvd, F_QueueNotify critical_done)
Definition: glue_queue.c:507
MHEG5ErrorCode MHEG5launch(MHEG5Root *target, MHEG5GList *params)
unsigned char head
Definition: mh5queue.c:143
MHEG5ErrorCode(* F_Action)(MHEG5Root *target, MHEG5GList *params)
Definition: mh5queue.c:169
MHEG5Int x
Definition: mh5base.h:78
MHEG5ErrorCode MHEG5moveTo(MHEG5Root *target, MHEG5GList *params)
Move the token to a specific element of the group. Implementation of the MoveTo (Target, Index) action of the TokenManager class.
Implement Functions to support Service Gateways. Functions for standarizing several GroupIDs like +DS...
MHEG5ErrorCode MHEG5setDesktopColour(MHEG5Root *target, MHEG5GList *params)
Impelemtation of the SetDesktopColour action of the application class This action may refresh the dis...
MHEG5ErrorCode MHEG5readPersistent(MHEG5Root *target, MHEG5GList *params)
Implementation of the ReadPersistent (ReadSucceded, OutVariables, InFileName) action from the applica...
MHEG5Link * links[SYNC_Q_SIZE]
Definition: mh5queue.c:151
short MHEG5Bool
Definition: mh5base.h:71
const char * MHEG5eventToString(MHEG5EventType event)
MHEG5ErrorCode MHEG5getFillColour(MHEG5Root *target, MHEG5GList *params)
Retrieve the current FillColour of the Dynamic Lineart object. Implementation of the GetFillColour ac...
MHEG5ErrorCode
Definition: mh5base.h:222
void * STB_OSCreateMutex(void)
Create a mutex.
MHEG5ErrorCode MHEG5getPortion(MHEG5Root *target, MHEG5GList *params)
This action retrieves the size of the slider portion and stores it in the PortionVar, which is passed to this action as the second parameter. Implementation of the GetPortion (Target, PortionVar) action of the slider class.
Definition: mh5slider.c:464
MHEG5ErrorCode MHEG5setSpeed(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to change the speed in which the stream is displayed. Implementation of the SetSpeed (Target, NewSpeed) action of the stream class. SetSpeed (NewSpeed) Change the presentation speed of a stream. Execute the following sequence of actions:
Definition: mh5stream.c:610
#define DO_ANY_EVENT
Definition: mh5queue.c:71
MHEG5ErrorCode MHEG5setInputMask(MHEG5Root *target, MHEG5GList *params)
Change the InputMask attribute of the target Scene object. Changing the registermask will affect how ...
Definition: mh5scene.c:937
Event handling. Implementation of a combined queue for events and actions. This is the eventsystem wh...
MHEG5ErrorCode MHEG5getCursorPosition(MHEG5Root *target, MHEG5GList *params)
The effect of this action is that the current cursor position is retrieved and stored in the given va...
Definition: mh5scene.c:837
MHEG5ErrorCode MHEG5getVolume(MHEG5Root *target, MHEG5GList *params)
Returns the volume of an Audio. Implementation of the GetVolume (VolumeVar) action of the audio class...
Definition: mh5audio.c:253
void MHEG5PrependActionList(MHEG5ActionList actions)
The supplied list of actions should execute before others on the queue.
Definition: mh5queue.c:1502
MHEG5ErrorCode MHEG5getSelectionStatus(MHEG5Root *target, MHEG5GList *params)
Implementation of the GetSelectionStatus action.
MHEG5ErrorCode MHEG5fork(MHEG5Root *target, MHEG5GList *params)
Definition: mh5program.c:459
#define SHORT_Q_SIZE
Definition: mh5queue.c:77
MHEG5ErrorCode MHEG5testVariable(MHEG5Root *target, MHEG5GList *params)
This action tests variables agains each other or against values Implementation of the TestVariable (T...
Definition: mh5variable.c:923
void MHEG5queueResolveTargets(MHEG5ActionList actions)
Finds targets for the action list.
Definition: mh5queue.c:1182
unsigned char tail
Definition: mh5queue.c:141
MHEG5ErrorCode MHEG5setPortion(MHEG5Root *target, MHEG5GList *params)
This action sets the portion of the slider to a new value, given as the second parameter to this acti...
Definition: mh5slider.c:428
MHEG5ErrorCode MHEG5setVolume(MHEG5Root *target, MHEG5GList *params)
Change the volume of an audio. Implementation of the SetVolume (NewVolume) action of the audio class...
Definition: mh5audio.c:221
#define MHEG5TRUE
Definition: mh5base.h:49
MHEG5Link * links[SHORT_Q_SIZE]
Definition: mh5queue.c:158
void MHEG5ExitQueues(void)
Definition: mh5queue.c:1000
MHEG5ErrorCode MHEG5selectItem(MHEG5Root *target, MHEG5GList *params)
Implementation of the ListGroup SelectItem elementary action.
MHEG5ErrorCode MHEG5getLabel(MHEG5Root *target, MHEG5GList *params)
void MHEG5AppendActionList(MHEG5ActionList actions)
The supplied list of actions should execute after any already on queue.
Definition: mh5queue.c:1032
uint16_t U16BIT
Definition: techtype.h:84
Implement functions to retrieve MHEG5objects by GroupID and ID.
E_RQ_STATUS
Definition: mh5queue.c:161
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.
void MHEG5actionListExecute(MHEG5Group *source, MHEG5ActionList act_q)
Execute the supplied list of actions immediately. The actions will have been executed by the time the...
Definition: mh5queue.c:1400
struct s_ShortSyncQ S_ShortSyncQ
MHEG5ErrorCode MHEG5setSliderValue(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to set the SliderValue to the given value. Implementation of the SetSlid...
Definition: mh5slider.c:353
MHEG5ErrorCode MHEG5getTextContent(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to transfer the data of the content attribute of the text to the variabl...
Definition: mh5text.c:421
Mheg5 logging and debug printing.
void MHEG5enableEventProcessing(MHEG5Bool enable)
Enable or disable engine event processing. This function is used to implement the Call action for res...
Definition: mh5queue.c:1751
MHEG5ErrorCode MHEG5clear(MHEG5Root *target, MHEG5GList *params)
Fills up the bounding box with the OriginalRefFillColour. Implementation of the Clear action of the d...
MHEG5ErrorCode MHEG5setLineColour(MHEG5Root *target, MHEG5GList *params)
Definition: mh5lineart.c:354
MHEG5ErrorCode MHEG5setVariable(MHEG5Root *target, MHEG5GList *params)
Set the Value attribute of the Target object to NewVariableValue. Implementation of the SetVariable (...
Definition: mh5variable.c:761
MHEG5ErrorCode MHEG5transitionTo(MHEG5Root *target, MHEG5GList *params)
This function performs the TransitionTo action which leads to a new scene. Implementation of the Tran...
Definition: mh5scene.c:566
MHEG5ErrorCode MHEG5scaleBitmap(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to scale the contents of the Bitmap to the size (XScale, YScale). Implementation of the ScaleBitmap (XScale, YScale) action of the bitmap class.
Definition: mh5bitmap.c:276
MHEG5ErrorCode MHEG5setOverwriteMode(MHEG5Root *target, MHEG5GList *params)
Set the overwrite mode of the entryfield to the new value of the parameter Implementation of the SetO...
MHEG5Int len
Definition: mh5base.h:99
MHEG5Bool runningStatus
Definition: mh5root.h:51
#define MHEG5PROFILEID
Definition: mh5profile.h:40
void MHEG5processQueue(void)
Process all pending events and actions. After processing all events and actions, Normally there will ...
Definition: mh5queue.c:1333
MHEG5ErrorCode MHEG5drawOval(MHEG5Root *target, MHEG5GList *params)
Draws an ellipse bounded by the rectangle defined by the parameters. Implementation of the DrawOval a...
MHEG5ErrorCode MHEG5drawLine(MHEG5Root *target, MHEG5GList *params)
Draws a line between ("X1", "Y1") and ("X2", "Y2"). Implementation of the DrawLine action of the dyna...
MHEG5ErrorCode MHEG5drawPolyline(MHEG5Root *target, MHEG5GList *params)
Draws series of joint lines. Implementation of the DrawPolyline action of the dynamiclineart class...
MHEG5String groupName
Definition: mh5group.h:53
MHEG5Root root
Definition: mh5group.h:50
MHEG5Int id
Definition: mh5root.h:48
MH5GroupPtr e_grp
Definition: mh5queue.c:128
MHEG5ErrorCode MHEG5quit(MHEG5Root *target, MHEG5GList *params)
Implementation of the Quit action from the application class Close an application and restart the pre...
MHEG5ErrorCode MHEG5getCounterMaxPosition(MHEG5Root *target, MHEG5GList *params)
Implementation of the GetCounterMaxPosition (Target, CounterPositionVar) action of the stream class...
Definition: mh5stream.c:909
MHEG5ErrorCode MHEG5setBoxSize(MHEG5Root *target, MHEG5GList *params)
Change the size of the bounding box of the target Visible. Implementation of the SetBoxSize (XNewBoxS...
Definition: mh5visible.c:553
MHEG5Int e_type
Definition: mh5queue.c:130
action to string conversion
void MHEG5queueResetScene(MHEG5Root *grp)
Reset both event queues and the action queue, discarding any pending events and actions for this scen...
Definition: mh5queue.c:957
MHEG5ErrorCode MHEG5spawn(MHEG5Root *target, MHEG5GList *params)
Implementation of the Spawn action from the application class +Execute the OnSpawnCloseDown Action of...
MHEG5ErrorCode MHEG5setLineStyle(MHEG5Root *target, MHEG5GList *params)
Definition: mh5lineart.c:310
MHEG5ErrorCode MHEG5setTimer(MHEG5Root *target, MHEG5GList *params)
This actions sets a new Timer which results in a TimerFired event when the given time is reached...
Definition: mh5group.c:1070
MHEG5ErrorCode MHEG5getPosition(MHEG5Root *target, MHEG5GList *params)
Returns the location of the target Visible.
Definition: mh5visible.c:487
void STB_OSMutexLock(void *mutex)
Lock a mutex (a.k.a. &#39;enter&#39;, &#39;wait&#39; or &#39;get&#39;).
MH5GroupPtr group
Definition: mh5base.h:103
MHEG5ErrorCode MHEG5setLabel(MHEG5Root *target, MHEG5GList *params)
MHEG5ErrorCode MHEG5setFontRef(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to change the character font used to preset a text. Implementation of th...
Definition: mh5text.c:655
#define DECLARE_RC
Definition: mh5queue.c:108
unsigned char tdum
Definition: mh5queue.c:142
#define ASSIGN_RC
Definition: mh5queue.c:109
MHEG5ErrorCode MHEG5getBitmapDecodeOffset(MHEG5Root *target, MHEG5GList *params)
Implementation of the GetBitmapDecodeOffset (XOffset, YOffset) action of the bitmap class GetBitmapDe...
Definition: mh5bitmap.c:432
MHEG5ErrorCode MHEG5modulo(MHEG5Root *target, MHEG5GList *params)
Returns the remainder modulo Value of Target - as defined by usual integer arithmetic rules...
Definition: mh5variable.c:1262
MHEG5EventType e
Definition: mh5base.h:157
MHEG5ErrorCode MHEG5lockScreen(MHEG5Root *target, MHEG5GList *params)
Implementation of the LockScreen action of the application class Freeze the display screen and preven...
MHEG5ErrorCode MHEG5getSliderValue(MHEG5Root *target, MHEG5GList *params)
This action retrieves the SliderValue from the target and stores it in the variable, passed as the second parameter of this action. Implementation of the GetSliderValue (Target, SliderValueVar) action of the slider class.
Definition: mh5slider.c:393
MHEG5ErrorCode MHEG5setPosition(MHEG5Root *target, MHEG5GList *params)
Change the location of the target Visible. Implementation of the SetPosition (NewXPosition, NewYPosition) action of the visible class.
Definition: mh5visible.c:361
MHEG5Root * target
Definition: mh5action.h:192
MHEG5ErrorCode MHEG5setCachePriority(MHEG5Root *target, MHEG5GList *params)
Implementation of the SetCachePriority action SetCachePriority (NewCachePriority) Set the GroupCacheP...
Definition: mh5group.c:937
MHEG5GList * origFirstParam
Definition: mh5action.h:194
MHEG5ErrorCode MHEG5append(MHEG5Root *target, MHEG5GList *params)
Appends AppendValue to Target Variable. Target variable is the first operand of the infix operation...
Definition: mh5variable.c:1306
MHEG5ErrorCode MHEG5scrollItems(MHEG5Root *target, MHEG5GList *params)
Implementation of the ListGroup ScrollItems elementary action.
void MHEG5eventProcessingReset(void)
Causes the MHEG5enableEventProcessing counter to be reset to 0, and event processing to be enabled...
Definition: mh5queue.c:1795
MHEG5ErrorCode MHEG5bringToFront(MHEG5Root *target, MHEG5GList *params)
Put a Visible at the foreground of the screen, i.e. on top of the Display Stack Implementation of the...
Definition: mh5visible.c:742
MHEG5Int e_id
Definition: mh5queue.c:129
MHEG5ErrorCode MHEG5setInteractionStatus(MHEG5Root *target, MHEG5GList *params)
MHEG5Boolean targetIsIndirect
Definition: mh5action.h:196
MHEG5ErrorCode MHEG5setFocusPosition(MHEG5Root *target, MHEG5GList *params)
Definition: mh5hypertext.c:375
#define USE_UNWANTED_PARAM(param)
Definition: techtype.h:48
#define MAX_ACTION_LISTS
Definition: mh5queue.c:68
MHEG5ErrorCode MHEG5getEntryPoint(MHEG5Root *target, MHEG5GList *params)
Retrieve the current entrypoint of the entryfield Implementation of the GetEntryPoint action of the e...
Include all classes.
#define MAX_EVENT_INDENT
Definition: mh5action.h:37
MHEG5ErrorCode MHEG5drawSector(MHEG5Root *target, MHEG5GList *params)
Draws a sector between "StartAngle" and "StartAngle" + "ArcAngle". Implementation of the DrawSector a...
MHEG5GList * MHEG5resolveORef(MHEG5GList *params, MHEG5Root **object)
Definition: mh5object.c:126
int MHEG5InitQueues(void)
Definition: mh5queue.c:858
void VQ_UnRegisterNotify(void *qn)
Definition: glue_queue.c:530
Implement generic MHEG5-display functions - independent from the OSD These are generic functions used...
MHEG5ErrorCode MHEG5getLineStyle(MHEG5Root *target, MHEG5GList *params)
Retrieve the current Line Style of the DynamicLineArt object Implementation of the GetLineStyle actio...
MHEG5ErrorCode MHEG5getItemStatus(MHEG5Root *target, MHEG5GList *params)
Implementation of the ListGroup GetItemStatus elementary action.
void MHEG5queueEvents(void)
Allow future events to be stored in the event queues. See also MHEG5discardEvents.
Definition: mh5queue.c:1528
MHEG5ErrorCode MHEG5stop(MHEG5Root *target, MHEG5GList *params)
MHEG5ErrorCode MHEG5setPaletteRef(MHEG5Root *target, MHEG5GList *params)
Change the colour look-up table used to render colours of the Visible object. Implementation of the S...
Definition: mh5visible.c:943
MHEG5ErrorCode MHEG5getCounterPosition(MHEG5Root *target, MHEG5GList *params)
Implementation of the GetCounterPosition (Target, CounterPositionVar) action of the stream class...
Definition: mh5stream.c:849
MHEG5ErrorCode MHEG5setCounterPosition(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to set the display counter to a new position. Implementation of the SetC...
Definition: mh5stream.c:713
MHEG5ErrorCode MHEG5setSliderParameters(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to set the MinValue, MaxValue and StepSize to the given values...
Definition: mh5slider.c:502
MHEG5Generic generic
Definition: mh5base.h:171
unsigned short slen
Definition: mh5queue.c:157
MHEG5ErrorCode MHEG5setCellPosition(MHEG5Root *target, MHEG5GList *params)
Implementation of the ListGroup SetCellPosition elementary action.
struct sMHEG5GList * next
Definition: mh5base.h:172
MHEG5ErrorCode MHEG5setFontAttributes(MHEG5Root *target, MHEG5GList *params)
The effect of this action is to set the FontAttributes to the given attributes. Implementation of the...
Definition: mh5text.c:548
MHEG5Int y
Definition: mh5base.h:79
MHEG5ErrorCode MHEG5toggleItem(MHEG5Root *target, MHEG5GList *params)
Implementation of the ListGroup ToggleItem elementary action.
#define MHEG5FALSE
Definition: mh5base.h:48
#define DEFER_ASYNC_EVENTS
Definition: mh5queue.c:72
MHEG5ErrorCode MHEG5scaleVideo(MHEG5Root *target, MHEG5GList *params)
Implementation of the ScaleVideo (XScale, YScale) action of the video class. The effect of this actio...
Definition: mh5video.c:240
const S_Element element_act[]
Definition: mh5queue.c:195
MHEG5ErrorCode MHEG5setCursorPosition(MHEG5Root *target, MHEG5GList *params)
This action sets the cursor position to the values given as parameters. Implementation of the SetCurs...
Definition: mh5scene.c:782
MHEG5ErrorCode MHEG5setTransparency(MHEG5Root *target, MHEG5GList *params)
Change the value of the Transparency attribute. Implementation of the SetTransparency (NewTransparenc...
Definition: mh5bitmap.c:327
F_Action func
Definition: mh5queue.c:173
MHEG5Int e_data
Definition: mh5queue.c:131
MHEG5ErrorCode MHEG5getTokenPosition(MHEG5Root *target, MHEG5GList *params)
Set the Variable referenced by TokenPositionVar to the value of the TokenPosition attribute...
MHEG5IntPair p
Definition: mh5base.h:158
E_ENGINE_EVENT
Definition: mh5queue.h:43
MHEG5ErrorCode MHEG5putBefore(MHEG5Root *target, MHEG5GList *params)
Put a Visible exactly in front of another Visible in the display stack. Implementation of the PutBefo...
Definition: mh5visible.c:829
MHEG5Int total
Definition: mh5action.h:202
MHEG5Application * MHEG5getCurrentApplication(void)
<Function description>="">
#define DEBUG_PRINT(x)
Definition: mh5debug.h:70
#define TRACE(t, x)
Definition: glue_debug.h:118
Header file - Function prototypes for operating system.