MHEG5  18.9.0
MHEG5 Documentation
mh5base.h
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  *******************************************************************************/
26 #ifndef _MH5BASE_H
27 #define _MH5BASE_H
28 
29 /*---includes for this file--------------------------------------------------*/
30 
31 #include <stdio.h>
32 
33 #include "techtype.h"
34 #include "dtvstring.h"
35 #include "glue_debug.h"
36 
37 /*---Constant and macro definitions for public use---------------------------*/
38 
39 /* Rules for version number:
40  Realeases to customers : n.n
41  Minor releases to testers/internal : n.nbn
42  Modified minor releases : n.nbn+
43 
44  Example version sequence: 1.2, 1.3b0+, 1.3b1, 1.3b1+, 1.3b2, 1.3b2+, 1.3, ...
45  */
46 
47 /* Boolean values */
48 #define MHEG5FALSE (0)
49 #define MHEG5TRUE (-1)
50 
51 #ifndef MHG_STRNCMP
52 #define MHEG5strncmp(a, b, n) strncmp((char *)a, (char *)b, n)
53 #endif /* #ifdef MHG_STRNCMP */
54 
55 #ifndef MHG_STRCMP
56 #define MHEG5strcmp(a, b) strcmp((char *)a, (char *)b)
57 #endif /* #ifdef MHG_STRCMP */
58 
59 #define INVALID_GRP_REF 0
60 
61 #define MHEG5colourInit MHEG5genericSet
62 #define MHEG5colourDestruct MHEG5genericDestruct
63 
64 /*---Enumerations for public use---------------------------------------------*/
65 
66 /*---Global type defs for public use-----------------------------------------*/
67 
68 /*
69  Simple Types
70  */
71 typedef short MHEG5Bool;
72 typedef short MHEG5Short;
73 typedef long MHEG5Int;
74 typedef unsigned char MHEG5Byte;
75 
76 typedef struct SMHEG5IntPair
77 {
80 } MHEG5IntPair;
81 
82 typedef struct sMHEG5String
83 {
86 } MHEG5String;
87 
88 /* forward declaration of group structure */
89 typedef struct sMHEG5Group sMHEG5Group;
90 
91 /* unique id for each new group created */
93 
94 /* forward declaration of pointer to group structure */
95 typedef struct sMHEG5Group *MH5GroupPtr;
96 
97 typedef struct sMH5GroupRef
98 {
99  MHEG5Int len; /* if (len == 0) 'pgrp' points to group, else len is string length of 'name' */
100  union
101  {
103  MH5GroupPtr group;
104  } ptr;
105 } MH5GroupRef;
106 
107 typedef struct sMHEG5ObjectReference
108 {
112 
113 
114 typedef enum
115 {
117  /* Synchronous events */
123  /* Asynchronous events */
130  /* dummy last event */
133 
134 
135 /*
136  special MEGA-Type for holding a lot of MHEG5 types
137  */
138 typedef enum
139 {
143 } E_ParamTypes;
144 
146 
147 typedef struct
148 {
152  union
153  {
160  } value;
161 } MHEG5Generic;
162 
163 
164 
165 
166 /*
167  List of Generic Items
168  */
170 {
171  MHEG5Generic generic;
172  struct sMHEG5GList *next;
173 };
174 
175 typedef struct sMHEG5GList MHEG5GList;
176 
178 
179 typedef struct sParamList
180 {
183 } ParamList;
184 
185 
186 
187 /*
188  MHEG5 Finals
189  */
190 typedef enum
191 {
200 } MHEG5Final;
201 
202 
203 typedef enum
204 {
207 
208 typedef enum
209 {
212 
213 typedef enum
214 {
217 
218 
219 /*
220  Error Codes
221  */
222 typedef enum
223 {
237  MHEG5ERR_IGNORE_ACTION /* Used by Launch, Spawn and TransitionTo */
239 
240 typedef struct sMHEG5FontBody
241 {
243  union
244  {
246  struct
247  {
250  } referenced;
251  } ref;
252 } MHEG5FontBody;
253 
254 /*---Global variable declarations for public use-----------------------------*/
255 
256 /*---Global Function prototypes for public use-------------------------------*/
257 
263 #ifdef MHG_TRACK_MEM
264 MHEG5String MHEG5stringCopyFunc(MHEG5String source, int line );
265 #define MHEG5stringCopy(s) MHEG5stringCopyFunc(s, __LINE__)
266 #else
268 #endif
269 MHEG5String MHEG5stringCopyChr(const char *source);
271 void MHEG5stringDestruct(MHEG5String *item);
275 
276 #ifdef MHEG5LOG
277 
278 char* MHEG5stringGet(MHEG5String source);
279 
280 #endif
281 
282 void MHEG5genericSet(MHEG5Generic *item, MHEG5Int initialValue);
285 void MHEG5genericCopy(MHEG5Generic *dest, MHEG5Generic *src);
286 
287 void MHEG5gListDestruct(MHEG5GList *item);
289 
290 #ifdef MHG_STRNCMP
291 
292 int MHEG5strncmp(char *a, char *b, int n);
293 
294 #endif /* #ifdef MHG_STRNCMP */
295 
296 #ifdef MHG_STRCMP
297 
298 int MHEG5strcmp(char *a, char *b);
299 
300 #endif /* #ifdef MHG_STRCMP */
301 
306 unsigned long MHEG5random(void);
307 
308 
319 char* MHEG5safeStrcat(char *dest, size_t destLength,
320  const char *source);
321 
322 
323 #ifdef _WIN32_WCE
324 TCHAR* StrToUnicode(char *string);
325 char* StrFromUnicode(TCHAR *string);
326 #endif
327 
328 /*
329  Debug
330  */
331 #ifdef MH5PRINTOUT
332 void MHEG5classPrint(MHEG5Final class, char *out);
333 void MHEG5indent(char *out);
334 int MHEG5setIndent(int i);
335 void MHEG5incIndent(void);
336 void MHEG5decIndent(void);
337 void MHEG5newLine(char *out);
338 
339 #define MHEG_PRINT(out, str) STB_DebugLogPrintf(str)
340 #define MHEG5intPrint(i, out) STB_DebugLogPrintf("%ld", i)
341 #define MHEG5hexPrint(i, out) STB_DebugLogPrintf("%#x", i)
342 #endif /* #ifdef MH5PRINTOUT */
343 
344 #if defined(MHEG5LOG) || defined(MH5PRINTOUT)
345 void MHEG5eventPrint(MHEG5EventType e, char *out);
346 void MHEG5stringPrint(MHEG5String s, char *out);
347 void MHEG5objectrefPrint(MHEG5ObjectReference o, char *out);
348 void MHEG5boolPrint(MHEG5Bool b, char *out);
349 void MHEG5genericPrint(MHEG5Generic g, char *out, U8BIT dotype);
350 void MHEG5colourPrint(MHEG5Colour c, char *out);
351 void MHEG5gListPrint(MHEG5GList *l, char *out, U8BIT noTypeCnt);
352 void MHEG5cListPrint(MHEG5GList *l, char *out);
353 void MHEG5sdListPrint(MHEG5GList *l, char *out);
354 void MHEG5clrListPrint(MHEG5GList *l, char *out);
355 #endif /* #ifdef MHEG5LOG */
356 
357 #ifdef TRACING
358 extern int extra_trace_param;
359 #endif
360 
361 #endif /*_MH5BASE_H*/
U8BIT indirect
Definition: mh5base.h:149
MH5GroupRef gref
Definition: mh5base.h:110
unsigned long MHEG5random(void)
Calculate and return a psuedo random number.
Definition: mh5base.c:1071
MHEG5GList * MHEG5gListCopy(MHEG5GList *list)
Copy a list of MHEG5Generic objects.
Definition: mh5base.c:950
short MHEG5Short
Definition: mh5base.h:72
U8BIT isfirst
Definition: mh5base.h:150
Define MHEG5 String type.
MHEG5Bool MHEG5stringEqual(MHEG5String *s1, MHEG5String *s2)
Compare two Strings (case sensitive!)
Definition: mh5base.c:710
struct sMHEG5String MHEG5String
MHEG5Int i
Definition: mh5base.h:154
MHEG5String s
Definition: mh5base.h:156
MHEG5ObjectReference o
Definition: mh5base.h:159
U16BIT type
Definition: mh5base.h:151
void MHEG5genericSet(MHEG5Generic *item, MHEG5Int initialValue)
Set a MHEG5Generic to the MHEG5Int value.
Definition: mh5base.c:978
Debug tracing.
struct sMHEG5Group * MH5GroupPtr
Definition: mh5base.h:95
MHEG5Int MH5GroupId
Definition: mh5base.h:92
MHEG5Bool b
Definition: mh5base.h:155
struct SMHEG5IntPair MHEG5IntPair
void MHEG5genericCopy(MHEG5Generic *dest, MHEG5Generic *src)
Copy a MHEG5Generic.
Definition: mh5base.c:861
MHEG5Int MHEG5strToInt(MHEG5String string)
Convert a MHEG5String to a MHEG5Integer.
Definition: mh5base.c:739
MHEG5Final
Definition: mh5base.h:190
MHEG5Bool MHEG5genericEqual(MHEG5Generic *g1, MHEG5Generic *g2)
Compare two generic Variables.
Definition: mh5base.c:889
MHEG5String MHEG5stringCopy(MHEG5String source)
<Function description>="">
Definition: mh5base.c:574
MHEG5EventType
Definition: mh5base.h:114
char * MHEG5safeStrcat(char *dest, size_t destLength, const char *source)
Perform a standard strcat restricted to the length of the destination. The dest string will always be...
Definition: mh5base.c:1103
void MHEG5stringDestruct(MHEG5String *item)
Destruct a MHEG5String.
Definition: mh5base.c:686
MHEG5SliderStyle
Definition: mh5base.h:208
uint8_t U8BIT
Definition: techtype.h:82
long MHEG5Int
Definition: mh5base.h:73
MHEG5Orientation
Definition: mh5base.h:203
void MHEG5gListDestruct(MHEG5GList *item)
Destruct a list of MHEG5Generic objects.
Definition: mh5base.c:933
MHEG5Int id
Definition: mh5base.h:248
MHEG5Generic MHEG5Colour
Definition: mh5base.h:177
MHEG5Bool referenced
Definition: mh5base.h:242
MHEG5Int x
Definition: mh5base.h:78
short MHEG5Bool
Definition: mh5base.h:71
MHEG5ErrorCode
Definition: mh5base.h:222
unsigned char MHEG5Byte
Definition: mh5base.h:74
struct sMHEG5ObjectReference MHEG5ObjectReference
struct sMH5GroupRef MH5GroupRef
struct sParamList ParamList
MH5GroupRef grp
Definition: mh5base.h:249
MHEG5String MHEG5stringCat(MHEG5String string1, MHEG5String string2)
Concatenate two MHEG5Strings.
Definition: mh5base.c:648
MHEG5Byte * data
Definition: mh5base.h:85
MHEG5String MHEG5intToStr(MHEG5Int i)
Convert MHEG5Int to MHEG5String.
Definition: mh5base.c:787
struct sMHEG5GList MHEG5GList
Definition: mh5base.h:175
void MHEG5genericDestruct(MHEG5Generic *item)
Destruct a MHEG5Generic.
Definition: mh5base.c:834
MHEG5PushbuttonStyle
Definition: mh5base.h:213
#define MHEG5strncmp(a, b, n)
Definition: mh5base.h:52
uint16_t U16BIT
Definition: techtype.h:84
System Wide Global Technical Data Type Definitions.
MHEG5Int len
Definition: mh5base.h:99
MHEG5Bool MHEG5Boolean
Definition: mh5base.h:145
MHEG5String MHEG5stringCopyChr(const char *source)
Copy the C-String source to a MHEG5String.
Definition: mh5base.c:612
MHEG5Byte * name
Definition: mh5base.h:102
MHEG5Int total
Definition: mh5base.h:181
struct sMHEG5FontBody MHEG5FontBody
MH5GroupPtr group
Definition: mh5base.h:103
MHEG5EventType e
Definition: mh5base.h:157
MHEG5Int len
Definition: mh5base.h:84
MHEG5GList * params
Definition: mh5base.h:182
MHEG5String included
Definition: mh5base.h:245
E_ParamTypes
Definition: mh5base.h:138
#define MHEG5strcmp(a, b)
Definition: mh5base.h:56
struct sMHEG5GList * next
Definition: mh5base.h:172
MHEG5Int y
Definition: mh5base.h:79
MHEG5IntPair p
Definition: mh5base.h:158