comparison src/gpf3/ccd/ccddata_load.c @ 2:c41a534f33c6

src/gpf3: preened GPF goo from TCS3.2
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 25 Sep 2016 23:52:50 +0000
parents
children
comparison
equal deleted inserted replaced
1:864b8cc0cf63 2:c41a534f33c6
1 /*
2 +-----------------------------------------------------------------------------
3 | Project :
4 | Modul : ccddata_load.c
5 +-----------------------------------------------------------------------------
6 | Copyright 2002 Texas Instruments Berlin, AG
7 | All rights reserved.
8 |
9 | This file is confidential and a trade secret of Texas
10 | Instruments Berlin, AG
11 | The receipt of or possession of this file does not convey
12 | any rights to reproduce or disclose its contents or to
13 | manufacture, use, or sell anything it may describe, in
14 | whole, or in part, without the specific written consent of
15 | Texas Instruments Berlin, AG.
16 +-----------------------------------------------------------------------------
17 | Purpose : Manage the explicit dynamic loading of ccddata.
18 +-----------------------------------------------------------------------------
19 */
20
21 /*==== INCLUDES ==============================================================*/
22 #include <windows.h>
23 #include <string.h>
24 #include <stdio.h>
25 #include "typedefs.h"
26 #include "vsi.h"
27 #include "ccdtable.h"
28 #include "ccdapi.h"
29 #include "pdi.h"
30 #include "pcon.h"
31 #include "ccdedit.h"
32 #include "ccddata.h"
33 #include "ccddata_tap_priv.h"
34 /*==== CONSTS ================================================================*/
35 #define MAXPROC 16
36 /*==== TYPES =================================================================*/
37 /* pcon.c */
38 typedef ULONG (*T_pcon_init_prim_coding)(T_HANDLE caller, UBYTE format);
39 typedef ULONG (*T_pcon_decodePrim)(ULONG opc,
40 void ** decoded_prim,
41 void * coded_prim,
42 ULONG * length,
43 ULONG woff);
44 typedef ULONG (*T_pcon_codePrim)(ULONG opc,
45 void * decoded_prim,
46 void ** coded_prim,
47 ULONG * length,
48 ULONG woff,
49 char* receiver);
50 typedef ULONG (*T_pcon_init_ccddata)(void);
51 typedef ULONG (*T_pcon_make_filter)(char* string, void** prim);
52 typedef ULONG (*T_pcon_filter_decode_prim)(ULONG opc,
53 void** decoded_prim,
54 void* coded_prim,
55 ULONG* length,
56 ULONG woff,
57 void** shadow_prim);
58 /* ccddata_pdi.c */
59 typedef int (*T_ccddata_get_pdi_dinfo)(const T_PDI_DECODEINFO* (*dinfo) );
60 /* ccddata_mconst.c */
61 typedef int (*T_ccddata_get_num_of_entities)(void);
62 typedef int (*T_ccddata_get_max_message_id)(void);
63 typedef int (*T_ccddata_get_max_bitstream_len)(void);
64 typedef int (*T_ccddata_get_max_mstruct_len)(void);
65 typedef int (*T_ccddata_get_max_mstruct_len)(void);
66 typedef int (*T_ccddata_mccd_symbols)(void);
67 /* ccddata_pconst.c */
68 typedef int (*T_ccddata_get_max_sap_num)(void);
69 typedef int (*T_ccddata_get_max_primitive_id)(void);
70 typedef int (*T_ccddata_get_max_pstruct_len)(void);
71 /* ccddata_ccdmtab.c */
72 typedef const T_CCD_VarTabEntry* (*T_ccddata_get_mvar) (USHORT idx);
73 typedef const T_CCD_SpareTabEntry* (*T_ccddata_get_spare) (USHORT idx);
74 typedef const T_CCD_CalcTabEntry* (*T_ccddata_get_calc) (USHORT idx);
75 typedef const T_CCD_CompTabEntry* (*T_ccddata_get_mcomp) (USHORT idx);
76 typedef const T_CCD_ElemTabEntry* (*T_ccddata_get_melem) (USHORT idx);
77 typedef const T_CCD_CalcIndex* (*T_ccddata_get_calcidx) (USHORT idx);
78 typedef USHORT (*T_ccddata_get_mmtx) (USHORT entity, USHORT msgid, USHORT idx);
79 /* ccddata_ccdptab.c */
80 typedef const T_CCD_VarTabEntry* (*T_ccddata_get_pvar) (USHORT idx);
81 typedef const T_CCD_CompTabEntry* (*T_ccddata_get_pcomp) (USHORT idx);
82 typedef const T_CCD_ElemTabEntry* (*T_ccddata_get_pelem) (USHORT idx);
83 typedef USHORT (*T_ccddata_get_pmtx) (USHORT sap, USHORT primid, USHORT idx);
84 /* ccddata_cdemval.c */
85 typedef const T_CCD_ValTabEntry* (*T_ccddata_get_mval) (USHORT idx);
86 /* ccddata_cdemstr.c */
87 typedef const T_CCD_StrTabEntry* (*T_ccddata_get_mstr) (USHORT idx);
88 /* ccddata_cdepval.c */
89 typedef const T_CCD_ValTabEntry* (*T_ccddata_get_pval) (USHORT idx);
90 typedef const T_CCD_StrTabEntry* (*T_ccddata_get_pstr) (USHORT idx);
91 /* ccddata_ccdent.c */
92 typedef short (*T_ccddata_get_ccdent) (char* entname);
93 typedef const char * (*T_ccddata_get_entname) (short ccdent);
94 /* ccddata_alias.c */
95 typedef char* (*T_ccddata_get_alias) (USHORT idx, int from_msg);
96 /* ccddata_version.c */
97 typedef char* (*T_ccddata_get_version) ();
98 typedef int (*T_ccddata_get_table_version) ();
99 /* ccd_config.c */
100 typedef UBYTE* (*T_ccddata_get_mi_length) (void);
101 typedef UBYTE* (*T_ccddata_get_decmsgbuffer) (void);
102 /* ccddata_tap_priv.c */
103 typedef int (*T_ccddata_tap_get_pd) (UCHAR comp);
104 typedef int (*T_ccddata_tap_check_pd) (UCHAR comp, UCHAR pd);
105 /* ccddata_eg.c */
106 typedef int (*T_ccddata_eg_nodes) (void);
107 typedef char** (*T_ccddata_eg_nodenames) (void);
108 typedef char* (*T_ccddata_eg_adjacent) (int idx);
109 typedef int (*T_ccddata_eg_saps) (void);
110 typedef char** (*T_ccddata_eg_sapnames) (void);
111 typedef T_COMENDPOINTS* (*T_ccddata_eg_comendpoints) (int idx);
112 /* ccdedit.c */
113 typedef void (*T_cde_init) (void);
114 typedef USHORT (*T_cde_get_comp) (T_CCDE_HANDLE* chandle,
115 T_CCDE_ELEM_DESCR* edescr);
116 typedef USHORT (*T_cde_prim_first) (T_CCDE_HANDLE* phandle,
117 ULONG primcode,
118 char* name);
119 typedef USHORT (*T_cde_prim_next) (T_CCDE_HANDLE* phandle,
120 UBYTE descent,
121 T_CCDE_ELEM_DESCR* pdescr);
122 typedef USHORT (*T_cde_msg_first) (T_CCDE_HANDLE* mhandle,
123 UBYTE type,
124 UBYTE direction,
125 UBYTE entity,
126 char* name);
127 typedef USHORT (*T_cde_msg_next) (T_CCDE_HANDLE* mhandle,
128 UBYTE descent,
129 T_CCDE_ELEM_DESCR* iedesrc);
130 typedef USHORT (*T_cde_comp_first) (T_CCDE_HANDLE* chandle,
131 T_ELM_SRC source,
132 char* compname);
133 typedef USHORT (*T_cde_comp_next) (T_CCDE_HANDLE* chandle,
134 UBYTE descent,
135 T_CCDE_ELEM_DESCR* descr);
136 typedef char* (*T_cde_get_symval) (int elem_value,
137 T_CCDE_ELEM_DESCR* descr);
138 typedef USHORT (*T_cde_read_elem) (T_CCDE_HANDLE* handle,
139 void* cstruct,
140 T_CCDE_ELEM_DESCR* descr,
141 UBYTE* value);
142 typedef void (*T_cde_write_prepare) (T_CCDE_HANDLE* handle,
143 void* cstruct,
144 T_CCDE_ELEM_DESCR* descr);
145 typedef USHORT (*T_cde_write_elem) (T_CCDE_HANDLE* handle,
146 void* cstruct,
147 T_CCDE_ELEM_DESCR* descr,
148 UBYTE* value);
149 typedef USHORT (*T_cde_get_type) (char* name, T_ELM_SRC* source);
150 typedef USHORT (*T_cde_get_primcode) (char* name, ULONG* primcode);
151 typedef USHORT (*T_cde_get_msgcode) (char* name,
152 UBYTE* type,
153 UBYTE* direction,
154 UBYTE* entity);
155 typedef int (*T_cde_get_is_downlink) (ULONG comp_index);
156 typedef ULONG (*T_cde_get_comp_index) (char* comp_name, T_ELM_SRC table);
157 typedef char* (*T_cde_get_element_name) (ULONG comp_index,
158 USHORT elem_off,
159 T_ELM_SRC table);
160 typedef ULONG (*T_cde_get_array_kind) (char* var_name, T_ELM_SRC table);
161 /* pdi.c */
162 typedef T_PDI_CONTEXT* (*T_pdi_createDefContext) ();
163 typedef T_PDI_CONTEXT* (*T_pdi_createContext) (const T_PDI_DECODEINFO* dinfop,
164 unsigned int dicount);
165 typedef void (*T_pdi_destroyContext) (T_PDI_CONTEXT* context);
166 typedef void (*T_pdi_startPrim) (T_PDI_CONTEXT* context, ULONG opc);
167 typedef void (*T_pdi_getDecodeInfo) (T_PDI_CONTEXT* context,
168 const char* ename,
169 char* evalue,
170 int evlen,
171 T_PDI* decinfo);
172 typedef short (*T_pdi_getEntityByPD) (const T_PDI_CONTEXT* context,
173 unsigned char pd);
174 typedef const char* (*T_pdi_pd2name) (unsigned char pd);
175 /* ccd.c */
176 typedef int (*T_ccd_set_patch_infos) (T_patch_info* pinfo);
177 typedef BYTE (*T_ccd_init) (void);
178 typedef int (*T_ccd_exit) (void);
179 typedef UBYTE* (*T_ccd_begin) (void);
180 typedef void (*T_ccd_end) (void);
181 typedef BYTE (*T_ccd_decodeMsg) (UBYTE entity,
182 UBYTE direction,
183 T_MSGBUF *mBuf,
184 UBYTE *mStruct,
185 UBYTE pt);
186 typedef S8 (*T_ccd_decodeMsgPtr) (U8 entity,
187 U8 direction,
188 U16 l_buf,
189 U16 o_buf,
190 U8 *buf,
191 U8 **mStructPtr,
192 U8 pt);
193 typedef BYTE (*T_ccd_codeMsg) (UBYTE entity,
194 UBYTE direction,
195 T_MSGBUF *mBuf,
196 UBYTE *mStruct,
197 UBYTE pt);
198 typedef BYTE (*T_ccd_codeMsgPtr) (U8 entity,
199 U8 direction,
200 U16 *l_buf,
201 U16 o_buf,
202 U8 *buf,
203 U8 *mStruct,
204 U8 pt);
205 typedef ULONG (*T_ccd_init_ccddata) (void);
206 /* cdc_std.c */
207 typedef BYTE (*T_ccd_decodeByte) (UBYTE *bitstream,
208 USHORT startbit,
209 USHORT bitlen,
210 UBYTE *value);
211 typedef BYTE (*T_ccd_codeByte) (UBYTE *bitstream,
212 USHORT startbit,
213 USHORT bitlen,
214 UBYTE val);
215 typedef BYTE (*T_ccd_codeLong) (UBYTE *bitstream,
216 USHORT startbit,
217 USHORT bitlen,
218 ULONG value);
219 typedef BYTE (*T_ccd_decodeLong) (UBYTE *bitstream,
220 USHORT startbit,
221 USHORT bitlen,
222 ULONG *value);
223 typedef void (*T_ccd_bitcopy) (UBYTE *dest,
224 UBYTE *source,
225 USHORT bitlen,
226 USHORT offset);
227 /* ccd_err.c */
228 typedef UBYTE (*T_ccd_getFirstError) (UBYTE entity, USHORT *parlist);
229 typedef UBYTE (*T_ccd_getNextError) (UBYTE entity, USHORT *parlist);
230 typedef ULONG (*T_ccd_getFirstFault) (T_CCD_ERR_ENTRY **ccd_err_entry);
231 typedef ULONG (*T_ccd_getNextFault) (T_CCD_ERR_ENTRY **ccd_err_entry);
232 typedef void (*T_ccd_free_faultlist) (void);
233 typedef int (*T_ccd_get_numFaults) (void);
234 /* ccd_elem.c */
235 typedef int (*T_ccd_encodeElem) (ULONG ccdid,
236 USHORT *l_buf,
237 USHORT o_buf,
238 UCHAR *buf,
239 UCHAR *eStruct);
240
241 typedef int (*T_ccd_decodeElem) (ULONG ccdid,
242 USHORT l_buf,
243 USHORT o_buf,
244 UCHAR *buf,
245 UCHAR *eStruct);
246 /*==== LOCALS ================================================================*/
247 static int me = -1;
248 static HANDLE initlock;
249 static void (*ccddata_i_notify)(void)=NULL;
250 static void (*ccddata_x_notify)(void)=NULL;
251
252 static int ccddata_attach (int i);
253
254 #pragma data_seg(".shared")
255 static char lastdll[MAX_PATH] = { 0 };
256 static DWORD ptrindex[MAXPROC] = {0, 0, 0, 0, 0, 0, 0, 0,
257 0, 0, 0, 0, 0, 0, 0, 0 };
258 static HINSTANCE cdll[MAXPROC] = {0, 0, 0, 0, 0, 0, 0, 0,
259 0, 0, 0, 0, 0, 0, 0, 0 };
260 static HANDLE mut[MAXPROC] = {0, 0, 0, 0, 0, 0, 0, 0,
261 0, 0, 0, 0, 0, 0, 0, 0 };
262 static T_pcon_init_prim_coding ptr_pcon_init_prim_coding[MAXPROC]
263 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
264 static T_pcon_decodePrim ptr_pcon_decodePrim[MAXPROC]
265 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
266 static T_pcon_codePrim ptr_pcon_codePrim[MAXPROC]
267 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
268 static T_pcon_init_ccddata ptr_pcon_init_ccddata[MAXPROC]
269 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
270 static T_pcon_make_filter ptr_pcon_make_filter[MAXPROC]
271 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
272 static T_pcon_filter_decode_prim ptr_pcon_filter_decode_prim[MAXPROC]
273 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
274 static T_ccddata_get_pdi_dinfo ptr_ccddata_get_pdi_dinfo[MAXPROC]
275 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
276 static T_ccddata_get_num_of_entities ptr_ccddata_get_num_of_entities[MAXPROC]
277 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
278 static T_ccddata_get_max_message_id ptr_ccddata_get_max_message_id[MAXPROC]
279 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
280 static T_ccddata_get_max_bitstream_len
281 ptr_ccddata_get_max_bitstream_len[MAXPROC]
282 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
283 static T_ccddata_get_max_mstruct_len ptr_ccddata_get_max_mstruct_len[MAXPROC]
284 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
285 static T_ccddata_mccd_symbols ptr_ccddata_mccd_symbols[MAXPROC]
286 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
287 static T_ccddata_get_max_sap_num ptr_ccddata_get_max_sap_num[MAXPROC]
288 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
289 static T_ccddata_get_max_primitive_id ptr_ccddata_get_max_primitive_id[MAXPROC]
290 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
291 static T_ccddata_get_max_pstruct_len ptr_ccddata_get_max_pstruct_len[MAXPROC]
292 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
293 static T_ccddata_get_mvar ptr_ccddata_get_mvar[MAXPROC]
294 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
295 static T_ccddata_get_spare ptr_ccddata_get_spare[MAXPROC]
296 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
297 static T_ccddata_get_calc ptr_ccddata_get_calc[MAXPROC]
298 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
299 static T_ccddata_get_mcomp ptr_ccddata_get_mcomp[MAXPROC]
300 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
301 static T_ccddata_get_melem ptr_ccddata_get_melem[MAXPROC]
302 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
303 static T_ccddata_get_calcidx ptr_ccddata_get_calcidx[MAXPROC]
304 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
305 static T_ccddata_get_mmtx ptr_ccddata_get_mmtx[MAXPROC]
306 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
307 static T_ccddata_get_pvar ptr_ccddata_get_pvar[MAXPROC]
308 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
309 static T_ccddata_get_pcomp ptr_ccddata_get_pcomp[MAXPROC]
310 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
311 static T_ccddata_get_pelem ptr_ccddata_get_pelem[MAXPROC]
312 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
313 static T_ccddata_get_pmtx ptr_ccddata_get_pmtx[MAXPROC]
314 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
315 static T_ccddata_get_mval ptr_ccddata_get_mval[MAXPROC]
316 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
317 static T_ccddata_get_mstr ptr_ccddata_get_mstr[MAXPROC]
318 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
319 static T_ccddata_get_pval ptr_ccddata_get_pval[MAXPROC]
320 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
321 static T_ccddata_get_pstr ptr_ccddata_get_pstr[MAXPROC]
322 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
323 static T_ccddata_get_ccdent ptr_ccddata_get_ccdent[MAXPROC]
324 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
325 static T_ccddata_get_entname ptr_ccddata_get_entname[MAXPROC]
326 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
327 static T_ccddata_get_alias ptr_ccddata_get_alias[MAXPROC]
328 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
329 static T_ccddata_get_version ptr_ccddata_get_version[MAXPROC]
330 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
331 static T_ccddata_get_table_version ptr_ccddata_get_table_version[MAXPROC]
332 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
333 static T_ccddata_get_mi_length ptr_ccddata_get_mi_length[MAXPROC]
334 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
335 static UBYTE* mi_length[MAXPROC]
336 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
337 static T_ccddata_get_decmsgbuffer ptr_ccddata_get_decmsgbuffer[MAXPROC]
338 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
339 static UBYTE* decmsgbuffer[MAXPROC]
340 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
341 static T_ccddata_tap_check_pd ptr_ccddata_tap_check_pd[MAXPROC]
342 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
343 static T_ccddata_tap_get_pd ptr_ccddata_tap_get_pd[MAXPROC]
344 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
345 static T_ccddata_eg_nodes ptr_ccddata_eg_nodes[MAXPROC]
346 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
347 static T_ccddata_eg_nodenames ptr_ccddata_eg_nodenames[MAXPROC]
348 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
349 static T_ccddata_eg_adjacent ptr_ccddata_eg_adjacent[MAXPROC]
350 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
351 static T_ccddata_eg_saps ptr_ccddata_eg_saps[MAXPROC]
352 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
353 static T_ccddata_eg_sapnames ptr_ccddata_eg_sapnames[MAXPROC]
354 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
355 static T_ccddata_eg_comendpoints ptr_ccddata_eg_comendpoints[MAXPROC]
356 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
357 static T_cde_init ptr_cde_init[MAXPROC]
358 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
359 static T_cde_get_comp ptr_cde_get_comp[MAXPROC]
360 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
361 static T_cde_prim_first ptr_cde_prim_first[MAXPROC]
362 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
363 static T_cde_prim_next ptr_cde_prim_next[MAXPROC]
364 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
365 static T_cde_msg_first ptr_cde_msg_first[MAXPROC]
366 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
367 static T_cde_msg_next ptr_cde_msg_next[MAXPROC]
368 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
369 static T_cde_comp_first ptr_cde_comp_first[MAXPROC]
370 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
371 static T_cde_comp_next ptr_cde_comp_next[MAXPROC]
372 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
373 static T_cde_get_symval ptr_cde_get_symval[MAXPROC]
374 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
375 static T_cde_read_elem ptr_cde_read_elem[MAXPROC]
376 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
377 static T_cde_write_prepare ptr_cde_write_prepare[MAXPROC]
378 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
379 static T_cde_write_elem ptr_cde_write_elem[MAXPROC]
380 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
381 static T_cde_get_type ptr_cde_get_type[MAXPROC]
382 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
383 static T_cde_get_primcode ptr_cde_get_primcode[MAXPROC]
384 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
385 static T_cde_get_msgcode ptr_cde_get_msgcode[MAXPROC]
386 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
387 static T_cde_get_is_downlink ptr_cde_get_is_downlink[MAXPROC]
388 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
389 static T_cde_get_comp_index ptr_cde_get_comp_index[MAXPROC]
390 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
391 static T_cde_get_element_name ptr_cde_get_element_name[MAXPROC]
392 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
393 static T_cde_get_array_kind ptr_cde_get_array_kind[MAXPROC]
394 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
395 static T_pdi_createDefContext ptr_pdi_createDefContext[MAXPROC]
396 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
397 static T_pdi_createContext ptr_pdi_createContext[MAXPROC]
398 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
399 static T_pdi_destroyContext ptr_pdi_destroyContext[MAXPROC]
400 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
401 static T_pdi_startPrim ptr_pdi_startPrim[MAXPROC]
402 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
403 static T_pdi_getDecodeInfo ptr_pdi_getDecodeInfo[MAXPROC]
404 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
405 static T_pdi_getEntityByPD ptr_pdi_getEntityByPD[MAXPROC]
406 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
407 static T_pdi_pd2name ptr_pdi_pd2name[MAXPROC]
408 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
409 static T_ccd_set_patch_infos ptr_ccd_set_patch_infos[MAXPROC]
410 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
411 static T_ccd_init ptr_ccd_init[MAXPROC]
412 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
413 static T_ccd_exit ptr_ccd_exit[MAXPROC]
414 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
415 static T_ccd_begin ptr_ccd_begin[MAXPROC]
416 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
417 static T_ccd_end ptr_ccd_end[MAXPROC]
418 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
419 static T_ccd_decodeMsg ptr_ccd_decodeMsg[MAXPROC]
420 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
421 static T_ccd_decodeMsgPtr ptr_ccd_decodeMsgPtr[MAXPROC]
422 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
423 static T_ccd_codeMsg ptr_ccd_codeMsg[MAXPROC]
424 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
425 static T_ccd_codeMsgPtr ptr_ccd_codeMsgPtr[MAXPROC]
426 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
427 static T_ccd_init_ccddata ptr_ccd_init_ccddata[MAXPROC]
428 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
429 static T_ccd_decodeByte ptr_ccd_decodeByte[MAXPROC]
430 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
431 static T_ccd_codeByte ptr_ccd_codeByte[MAXPROC]
432 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
433 static T_ccd_codeLong ptr_ccd_codeLong[MAXPROC]
434 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
435 static T_ccd_decodeLong ptr_ccd_decodeLong[MAXPROC]
436 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
437 static T_ccd_bitcopy ptr_ccd_bitcopy[MAXPROC]
438 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
439 static T_ccd_getFirstError ptr_ccd_getFirstError[MAXPROC]
440 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
441 static T_ccd_getNextError ptr_ccd_getNextError[MAXPROC]
442 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
443 static T_ccd_getFirstFault ptr_ccd_getFirstFault[MAXPROC]
444 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
445 static T_ccd_getNextFault ptr_ccd_getNextFault[MAXPROC]
446 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
447 static T_ccd_free_faultlist ptr_ccd_free_faultlist[MAXPROC]
448 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
449 static T_ccd_get_numFaults ptr_ccd_get_numFaults[MAXPROC]
450 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
451 static T_ccd_encodeElem ptr_ccd_encodeElem[MAXPROC]
452 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
453 static T_ccd_decodeElem ptr_ccd_decodeElem[MAXPROC]
454 = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
455 #pragma data_seg()
456
457
458 /*==== HANDLER FOR FUNCTIONS UNSUPPORTED BY LOADED DLL =======================*/
459 int cddl_ccddata_get_pdi_dinfo (const T_PDI_DECODEINFO* (*dinfo) )
460 {
461 dinfo=NULL;
462 return 0;
463 }
464
465 int cddl_ccddata_eg_nodes (void)
466 {
467 return 0;
468 }
469
470 char** cddl_ccddata_eg_nodenames (void)
471 {
472 return NULL;
473 }
474
475 char* cddl_ccddata_eg_adjacent (int idx)
476 {
477 return NULL;
478 }
479
480 int cddl_ccddata_eg_saps (void)
481 {
482 return 0;
483 }
484
485 char** cddl_ccddata_eg_sapnames (void)
486 {
487 return NULL;
488 }
489
490 T_COMENDPOINTS* cddl_ccddata_eg_comendpoints (int idx)
491 {
492 return NULL;
493 }
494
495 char* cddl_ccddata_get_version (void)
496 {
497 return "OLD";
498 }
499
500 int cddl_ccddata_get_table_version (void)
501 {
502 return 0;
503 }
504
505 const char * cddl_ccddata_get_entname (short ccdent)
506 {
507 return NULL;
508 }
509 /*==== PRIVATE FUNCTIONS =====================================================*/
510 /*
511 +------------------------------------------------------------------------------
512 | Function : ccddata_init_lock
513 +------------------------------------------------------------------------------
514 | Description : Synchronize calls of ccddata_init
515 |
516 | Parameters : -
517 |
518 | Return : 0 on success, otherwise error code
519 +------------------------------------------------------------------------------
520 */
521 static HANDLE ccddata_init_lock (void)
522 {
523 char* mname = "ccddata_init_lock";
524 HANDLE tmp;
525 if ((tmp = CreateMutex (NULL, FALSE, mname)) == 0)
526 {
527 return 0;
528 }
529 if ((initlock = OpenMutex (MUTEX_ALL_ACCESS, FALSE, mname)) == 0)
530 {
531 return 0;
532 }
533 CloseHandle (tmp);
534 WaitForSingleObject (initlock, INFINITE);
535 return initlock;
536 }
537
538 /*
539 +------------------------------------------------------------------------------
540 | Function : ccddata_register
541 +------------------------------------------------------------------------------
542 | Description : Register process in ccddata load dll
543 |
544 | Parameters : -
545 |
546 | Return : Index to ptrindex on success, otherwise -1
547 +------------------------------------------------------------------------------
548 */
549 static int ccddata_register (void)
550 {
551 if (me >= 0)
552 {
553 return me;
554 }
555 for (me=0; me<MAXPROC; me++)
556 {
557 if (!ptrindex[me])
558 {
559 char mname[32];
560 HANDLE tmp;
561 ptrindex[me] = GetCurrentProcessId ();
562 sprintf (mname, "ccddata_%d", ptrindex[me]);
563 tmp = CreateMutex (NULL, FALSE, mname);
564 mut[me] = OpenMutex (MUTEX_ALL_ACCESS, FALSE, mname);
565 CloseHandle (tmp);
566 return me;
567 }
568 }
569 me = -1;
570 return me;
571 }
572
573 /*
574 +------------------------------------------------------------------------------
575 | Function : ccddata_detach
576 +------------------------------------------------------------------------------
577 | Description : Unload ccddata dll and clean pointer to the functions
578 |
579 | Parameters : i - index to pointer list
580 | exit_all - if set, call ccd_exit and call FreeLibrary
581 |
582 | Return : -
583 +------------------------------------------------------------------------------
584 */
585 static void ccddata_detach (int i, int exit_all)
586 {
587 char mname[32];
588 HANDLE mutex;
589
590 if (!cdll[i])
591 return;
592
593 if (ccddata_x_notify != NULL && exit_all)
594 {
595 // make sure all functions are available again
596 if (ptr_ccd_init[i] != NULL || ccddata_attach(i)==CCDDATA_DLL_OK)
597 {
598 (*ccddata_x_notify)();
599 }
600 }
601
602 if (ptr_ccd_init[i] != NULL)
603 {
604 // clean all function pointers except ccd_exit
605 if (!exit_all)
606 {
607 sprintf (mname, "ccddata_%d", ptrindex[i]);
608 mutex = OpenMutex (MUTEX_ALL_ACCESS, FALSE, mname);
609 WaitForSingleObject (mutex, INFINITE);
610 }
611
612 ptr_pcon_init_prim_coding[i] = NULL;
613 ptr_pcon_decodePrim[i] = NULL;
614 ptr_pcon_codePrim[i] = NULL;
615 ptr_pcon_init_ccddata[i] = NULL;
616 ptr_pcon_make_filter[i] = NULL;
617 ptr_pcon_filter_decode_prim[i] = NULL;
618 ptr_ccddata_get_pdi_dinfo[i] = NULL;
619 ptr_ccddata_get_num_of_entities[i] = NULL;
620 ptr_ccddata_get_max_message_id[i] = NULL;
621 ptr_ccddata_get_max_bitstream_len[i] = NULL;
622 ptr_ccddata_get_max_mstruct_len[i] = NULL;
623 ptr_ccddata_mccd_symbols[i] = NULL;
624 ptr_ccddata_get_max_sap_num[i] = NULL;
625 ptr_ccddata_get_max_primitive_id[i] = NULL;
626 ptr_ccddata_get_max_pstruct_len[i] = NULL;
627 ptr_ccddata_get_mvar[i] = NULL;
628 ptr_ccddata_get_spare[i] = NULL;
629 ptr_ccddata_get_calc[i] = NULL;
630 ptr_ccddata_get_mcomp[i] = NULL;
631 ptr_ccddata_get_melem[i] = NULL;
632 ptr_ccddata_get_calcidx[i] = NULL;
633 ptr_ccddata_get_mmtx[i] = NULL;
634 ptr_ccddata_get_pvar[i] = NULL;
635 ptr_ccddata_get_pcomp[i] = NULL;
636 ptr_ccddata_get_pelem[i] = NULL;
637 ptr_ccddata_get_pmtx[i] = NULL;
638 ptr_ccddata_get_mval[i] = NULL;
639 ptr_ccddata_get_mstr[i] = NULL;
640 ptr_ccddata_get_pval[i] = NULL;
641 ptr_ccddata_get_pstr[i] = NULL;
642 ptr_ccddata_get_ccdent[i] = NULL;
643 ptr_ccddata_get_entname[i] = NULL;
644 ptr_ccddata_get_alias[i] = NULL;
645 ptr_ccddata_get_version[i] = NULL;
646 ptr_ccddata_get_table_version[i] = NULL;
647 ptr_ccddata_get_mi_length[i] = NULL;
648 mi_length[i] = NULL;
649 ptr_ccddata_get_decmsgbuffer[i] = NULL;
650 decmsgbuffer[i] = NULL;
651 ptr_ccddata_tap_check_pd[i] = NULL;
652 ptr_ccddata_tap_get_pd[i] = NULL;
653 ptr_ccddata_eg_nodes[i] = NULL;
654 ptr_ccddata_eg_nodenames[i] = NULL;
655 ptr_ccddata_eg_adjacent[i] = NULL;
656 ptr_ccddata_eg_saps[i] = NULL;
657 ptr_ccddata_eg_sapnames[i] = NULL;
658 ptr_ccddata_eg_comendpoints[i] = NULL;
659
660 ptr_cde_init[i] = NULL;
661 ptr_cde_get_comp[i] = NULL;
662 ptr_cde_prim_first[i] = NULL;
663 ptr_cde_prim_next[i] = NULL;
664 ptr_cde_msg_first[i] = NULL;
665 ptr_cde_msg_next[i] = NULL;
666 ptr_cde_comp_first[i] = NULL;
667 ptr_cde_comp_next[i] = NULL;
668 ptr_cde_get_symval[i] = NULL;
669 ptr_cde_read_elem[i] = NULL;
670 ptr_cde_write_prepare[i] = NULL;
671 ptr_cde_write_elem[i] = NULL;
672 ptr_cde_get_type[i] = NULL;
673 ptr_cde_get_primcode[i] = NULL;
674 ptr_cde_get_msgcode[i] = NULL;
675 ptr_cde_get_is_downlink[i] = NULL;
676 ptr_cde_get_comp_index[i] = NULL;
677 ptr_cde_get_element_name[i] = NULL;
678 ptr_cde_get_array_kind[i] = NULL;
679
680 ptr_pdi_createDefContext[i] = NULL;
681 ptr_pdi_createContext[i] = NULL;
682 ptr_pdi_destroyContext[i] = NULL;
683 ptr_pdi_startPrim[i] = NULL;
684 ptr_pdi_getDecodeInfo[i] = NULL;
685 ptr_pdi_getEntityByPD[i] = NULL;
686 ptr_pdi_pd2name[i] = NULL;
687
688 ptr_ccd_set_patch_infos[i] = NULL;
689 ptr_ccd_begin[i] = NULL;
690 ptr_ccd_end[i] = NULL;
691 ptr_ccd_decodeMsg[i] = NULL;
692 ptr_ccd_decodeMsgPtr[i] = NULL;
693 ptr_ccd_codeMsg[i] = NULL;
694 ptr_ccd_codeMsgPtr[i] = NULL;
695 ptr_ccd_init_ccddata[i] = NULL;
696 ptr_ccd_decodeByte[i] = NULL;
697 ptr_ccd_codeByte[i] = NULL;
698 ptr_ccd_codeLong[i] = NULL;
699 ptr_ccd_decodeLong[i] = NULL;
700 ptr_ccd_bitcopy[i] = NULL;
701 ptr_ccd_getFirstError[i] = NULL;
702 ptr_ccd_getNextError[i] = NULL;
703 ptr_ccd_getFirstFault[i] = NULL;
704 ptr_ccd_getNextFault[i] = NULL;
705 ptr_ccd_free_faultlist[i] = NULL;
706 ptr_ccd_get_numFaults[i] = NULL;
707 ptr_ccd_encodeElem[i] = NULL;
708 ptr_ccd_decodeElem[i] = NULL;
709 ptr_ccd_init[i] = NULL;
710
711 if (!exit_all)
712 {
713 ReleaseMutex (mutex);
714 CloseHandle (mutex);
715 }
716 }
717
718 if (exit_all)
719 {
720 if (ptr_ccd_exit[i])
721 {
722 (void)(*ptr_ccd_exit[i])();
723 ptr_ccd_exit[i] = NULL;
724 }
725 (void) FreeLibrary (cdll[i]);
726 cdll[i] = 0;
727 }
728 }
729
730 /*
731 +------------------------------------------------------------------------------
732 | Function : ccddata_clean
733 +------------------------------------------------------------------------------
734 | Description : Free own instance of ccddata dll and clean the pointers
735 | of the other processes.
736 |
737 | Parameters : -
738 |
739 | Return : CCDDATA_DLL_REGISTER, if the process is not registered
740 | or has not yet called ccddata_exit; CCDDATA_DLL_OK otherwise
741 +------------------------------------------------------------------------------
742 */
743 static int ccddata_clean (void)
744 {
745 int i;
746
747 if (me < 0)
748 {
749 return CCDDATA_DLL_REGISTER;
750 }
751
752 for (i=0; i<MAXPROC; i++)
753 {
754 if (me != i)
755 {
756 ccddata_detach (i, 0);
757 }
758 }
759
760 return CCDDATA_DLL_OK;
761 }
762
763 /*
764 +------------------------------------------------------------------------------
765 | Function : ccddata_attach
766 +------------------------------------------------------------------------------
767 | Description : Unload ccddata dll and clean pointer to the functions
768 |
769 | Parameters : i - index to pointer list
770 |
771 | Return : CCDDATA_DLL_OK or error code
772 +------------------------------------------------------------------------------
773 */
774 static int ccddata_attach (int i)
775 {
776 int already_loaded=(cdll[i]!=0);
777 if (!already_loaded)
778 {
779 cdll[i] = LoadLibrary (lastdll);
780 if (cdll[i] == NULL)
781 {
782 return CCDDATA_DLL_LOADLIB;
783 }
784 }
785
786 ptr_pcon_init_prim_coding[i] = (T_pcon_init_prim_coding)
787 GetProcAddress (cdll[i], "cddl_pcon_init_prim_coding");
788 ptr_pcon_decodePrim[i] = (T_pcon_decodePrim)
789 GetProcAddress (cdll[i], "cddl_pcon_decodePrim");
790 ptr_pcon_codePrim[i] = (T_pcon_codePrim)
791 GetProcAddress (cdll[i], "cddl_pcon_codePrim");
792 ptr_pcon_init_ccddata[i] = (T_pcon_init_ccddata)
793 GetProcAddress (cdll[i], "cddl_pcon_init_ccddata");
794 ptr_pcon_make_filter[i] = (T_pcon_make_filter)
795 GetProcAddress (cdll[i], "cddl_pcon_make_filter");
796 ptr_pcon_filter_decode_prim[i] = (T_pcon_filter_decode_prim)
797 GetProcAddress (cdll[i], "cddl_pcon_filter_decode_prim");
798
799 if (
800 ptr_pcon_init_prim_coding[i] == NULL ||
801 ptr_pcon_decodePrim[i] == NULL ||
802 ptr_pcon_codePrim[i] == NULL ||
803 ptr_pcon_init_ccddata[i] == NULL ||
804 ptr_pcon_make_filter[i] == NULL ||
805 ptr_pcon_filter_decode_prim[i] == NULL)
806 {
807 ptr_pcon_init_prim_coding[i] = cddl_pcon_init_prim_coding;
808 ptr_pcon_decodePrim[i] = cddl_pcon_decodePrim;
809 ptr_pcon_codePrim[i] = cddl_pcon_codePrim;
810 ptr_pcon_init_ccddata[i] = cddl_pcon_init_ccddata;
811 ptr_pcon_make_filter[i] = cddl_pcon_make_filter;
812 ptr_pcon_filter_decode_prim[i] = cddl_pcon_filter_decode_prim;
813 }
814
815 ptr_ccd_init[i] = (T_ccd_init)
816 GetProcAddress (cdll[i], "cddl_ccd_init");
817 ptr_ccd_exit[i] = (T_ccd_exit)
818 GetProcAddress (cdll[i], "cddl_ccd_exit");
819 ptr_ccd_begin[i] = (T_ccd_begin)
820 GetProcAddress (cdll[i], "cddl_ccd_begin");
821 ptr_ccd_end[i] = (T_ccd_end)
822 GetProcAddress (cdll[i], "cddl_ccd_end");
823 ptr_ccd_decodeMsg[i] = (T_ccd_decodeMsg)
824 GetProcAddress (cdll[i], "cddl_ccd_decodeMsg");
825 ptr_ccd_decodeMsgPtr[i] = (T_ccd_decodeMsgPtr)
826 GetProcAddress (cdll[i], "cddl_ccd_decodeMsgPtr");
827 ptr_ccd_codeMsg[i] = (T_ccd_codeMsg)
828 GetProcAddress (cdll[i], "cddl_ccd_codeMsg");
829 ptr_ccd_codeMsgPtr[i] = (T_ccd_codeMsgPtr)
830 GetProcAddress (cdll[i], "cddl_ccd_codeMsgPtr");
831 ptr_ccd_init_ccddata[i] = (T_ccd_init_ccddata)
832 GetProcAddress (cdll[i], "cddl_ccd_init_ccddata");
833 ptr_ccd_decodeByte[i] = (T_ccd_decodeByte)
834 GetProcAddress (cdll[i], "cddl_ccd_decodeByte");
835 ptr_ccd_codeByte[i] = (T_ccd_codeByte)
836 GetProcAddress (cdll[i], "cddl_ccd_codeByte");
837 ptr_ccd_codeLong[i] = (T_ccd_codeLong)
838 GetProcAddress (cdll[i], "cddl_ccd_codeLong");
839 ptr_ccd_decodeLong[i] = (T_ccd_decodeLong)
840 GetProcAddress (cdll[i], "cddl_ccd_decodeLong");
841 ptr_ccd_bitcopy[i] = (T_ccd_bitcopy)
842 GetProcAddress (cdll[i], "cddl_ccd_bitcopy");
843 ptr_ccd_getFirstError[i] = (T_ccd_getFirstError)
844 GetProcAddress (cdll[i], "cddl_ccd_getFirstError");
845 ptr_ccd_getNextError[i] = (T_ccd_getNextError)
846 GetProcAddress (cdll[i], "cddl_ccd_getNextError");
847 ptr_ccd_getFirstFault[i] = (T_ccd_getFirstFault)
848 GetProcAddress (cdll[i], "cddl_ccd_getFirstFault");
849 ptr_ccd_getNextFault[i] = (T_ccd_getNextFault)
850 GetProcAddress (cdll[i], "cddl_ccd_getNextFault");
851 ptr_ccd_free_faultlist[i] = (T_ccd_free_faultlist)
852 GetProcAddress (cdll[i], "cddl_ccd_free_faultlist");
853 ptr_ccd_get_numFaults[i] = (T_ccd_get_numFaults)
854 GetProcAddress (cdll[i], "cddl_ccd_get_numFaults");
855 ptr_ccd_encodeElem[i] = (T_ccd_encodeElem)
856 GetProcAddress (cdll[i], "cddl_ccd_encodeElem");
857 ptr_ccd_decodeElem[i] = (T_ccd_decodeElem)
858 GetProcAddress (cdll[i], "cddl_ccd_decodeElem");
859 if (
860 ptr_ccd_init[i] == NULL ||
861 ptr_ccd_exit[i] == NULL ||
862 ptr_ccd_begin[i] == NULL ||
863 ptr_ccd_end[i] == NULL ||
864 ptr_ccd_decodeMsg[i] == NULL ||
865 ptr_ccd_decodeMsgPtr[i] == NULL ||
866 ptr_ccd_codeMsg[i] == NULL ||
867 ptr_ccd_codeMsgPtr[i] == NULL ||
868 ptr_ccd_init_ccddata[i] == NULL ||
869 ptr_ccd_decodeByte[i] == NULL ||
870 ptr_ccd_codeByte[i] == NULL ||
871 ptr_ccd_codeLong[i] == NULL ||
872 ptr_ccd_decodeLong[i] == NULL ||
873 ptr_ccd_bitcopy[i] == NULL ||
874 ptr_ccd_getFirstError[i] == NULL ||
875 ptr_ccd_getNextError[i] == NULL ||
876 ptr_ccd_getFirstFault[i] == NULL ||
877 ptr_ccd_getNextFault[i] == NULL ||
878 ptr_ccd_free_faultlist[i] == NULL ||
879 ptr_ccd_get_numFaults[i] == NULL ||
880 ptr_ccd_encodeElem[i] == NULL ||
881 ptr_ccd_decodeElem[i] == NULL)
882 {
883 ptr_ccd_init[i] = cddl_ccd_init;
884 ptr_ccd_exit[i] = cddl_ccd_exit;
885 ptr_ccd_begin[i] = cddl_ccd_begin;
886 ptr_ccd_end[i] = cddl_ccd_end;
887 ptr_ccd_decodeMsg[i] = cddl_ccd_decodeMsg;
888 ptr_ccd_decodeMsgPtr[i] = cddl_ccd_decodeMsgPtr;
889 ptr_ccd_codeMsg[i] = cddl_ccd_codeMsg;
890 ptr_ccd_codeMsgPtr[i] = cddl_ccd_codeMsgPtr;
891 ptr_ccd_init_ccddata[i] = cddl_ccd_init_ccddata;
892 ptr_ccd_decodeByte[i] = cddl_ccd_decodeByte;
893 ptr_ccd_codeByte[i] = cddl_ccd_codeByte;
894 ptr_ccd_codeLong[i] = cddl_ccd_codeLong;
895 ptr_ccd_decodeLong[i] = cddl_ccd_decodeLong;
896 ptr_ccd_bitcopy[i] = cddl_ccd_bitcopy;
897 ptr_ccd_getFirstError[i] = cddl_ccd_getFirstError;
898 ptr_ccd_getNextError[i] = cddl_ccd_getNextError;
899 ptr_ccd_getFirstFault[i] = cddl_ccd_getFirstFault;
900 ptr_ccd_getNextFault[i] = cddl_ccd_getNextFault;
901 ptr_ccd_free_faultlist[i] = cddl_ccd_free_faultlist;
902 ptr_ccd_get_numFaults[i] = cddl_ccd_get_numFaults;
903 ptr_ccd_encodeElem[i] = cddl_ccd_encodeElem;
904 ptr_ccd_decodeElem[i] = cddl_ccd_decodeElem;
905 }
906 ptr_ccd_set_patch_infos[i] = (T_ccd_set_patch_infos)
907 GetProcAddress (cdll[i], "cddl_ccd_set_patch_infos");
908 if (ptr_ccd_set_patch_infos[i] == NULL)
909 {
910 ptr_ccd_set_patch_infos[i] = cddl_ccd_set_patch_infos;
911 }
912
913 ptr_ccddata_eg_nodes[i] = (T_ccddata_eg_nodes)
914 GetProcAddress (cdll[i], "ccddata_eg_nodes");
915 ptr_ccddata_eg_nodenames[i] = (T_ccddata_eg_nodenames)
916 GetProcAddress (cdll[i], "ccddata_eg_nodenames");
917 ptr_ccddata_eg_adjacent[i] = (T_ccddata_eg_adjacent)
918 GetProcAddress (cdll[i], "ccddata_eg_adjacent");
919 if (
920 ptr_ccddata_eg_nodes[i] == NULL ||
921 ptr_ccddata_eg_nodenames[i] == NULL ||
922 ptr_ccddata_eg_adjacent[i] == NULL)
923 {
924 ptr_ccddata_eg_nodes[i] = cddl_ccddata_eg_nodes;
925 ptr_ccddata_eg_nodenames[i] = cddl_ccddata_eg_nodenames;
926 ptr_ccddata_eg_adjacent[i] = cddl_ccddata_eg_adjacent;
927 }
928
929 ptr_ccddata_eg_saps[i] = (T_ccddata_eg_saps)
930 GetProcAddress (cdll[i], "ccddata_eg_saps");
931 ptr_ccddata_eg_sapnames[i] = (T_ccddata_eg_sapnames)
932 GetProcAddress (cdll[i], "ccddata_eg_sapnames");
933 ptr_ccddata_eg_comendpoints[i] = (T_ccddata_eg_comendpoints)
934 GetProcAddress (cdll[i], "ccddata_eg_comendpoints");
935 if (
936 ptr_ccddata_eg_saps[i] == NULL ||
937 ptr_ccddata_eg_sapnames[i] == NULL ||
938 ptr_ccddata_eg_comendpoints[i] == NULL)
939 {
940 ptr_ccddata_eg_saps[i] = cddl_ccddata_eg_saps;
941 ptr_ccddata_eg_sapnames[i] = cddl_ccddata_eg_sapnames;
942 ptr_ccddata_eg_comendpoints[i] = cddl_ccddata_eg_comendpoints;
943 }
944
945 ptr_cde_init[i] = (T_cde_init)
946 GetProcAddress (cdll[i], "cddl_cde_init");
947 ptr_cde_get_comp[i] = (T_cde_get_comp)
948 GetProcAddress (cdll[i], "cddl_cde_get_comp");
949 ptr_cde_prim_first[i] = (T_cde_prim_first)
950 GetProcAddress (cdll[i], "cddl_cde_prim_first");
951 ptr_cde_prim_next[i] = (T_cde_prim_next)
952 GetProcAddress (cdll[i], "cddl_cde_prim_next");
953 ptr_cde_msg_first[i] = (T_cde_msg_first)
954 GetProcAddress (cdll[i], "cddl_cde_msg_first");
955 ptr_cde_msg_next[i] = (T_cde_msg_next)
956 GetProcAddress (cdll[i], "cddl_cde_msg_next");
957 ptr_cde_comp_first[i] = (T_cde_comp_first)
958 GetProcAddress (cdll[i], "cddl_cde_comp_first");
959 ptr_cde_comp_next[i] = (T_cde_comp_next)
960 GetProcAddress (cdll[i], "cddl_cde_comp_next");
961 ptr_cde_get_symval[i] = (T_cde_get_symval)
962 GetProcAddress (cdll[i], "cddl_cde_get_symval");
963 ptr_cde_read_elem[i] = (T_cde_read_elem)
964 GetProcAddress (cdll[i], "cddl_cde_read_elem");
965 ptr_cde_write_prepare[i] = (T_cde_write_prepare)
966 GetProcAddress (cdll[i], "cddl_cde_write_prepare");
967 ptr_cde_write_elem[i] = (T_cde_write_elem)
968 GetProcAddress (cdll[i], "cddl_cde_write_elem");
969 ptr_cde_get_type[i] = (T_cde_get_type)
970 GetProcAddress (cdll[i], "cddl_cde_get_type");
971 ptr_cde_get_primcode[i] = (T_cde_get_primcode)
972 GetProcAddress (cdll[i], "cddl_cde_get_primcode");
973 ptr_cde_get_msgcode[i] = (T_cde_get_msgcode)
974 GetProcAddress (cdll[i], "cddl_cde_get_msgcode");
975 ptr_cde_get_is_downlink[i] = (T_cde_get_is_downlink)
976 GetProcAddress (cdll[i], "cddl_cde_get_is_downlink");
977 ptr_cde_get_comp_index[i] = (T_cde_get_comp_index)
978 GetProcAddress (cdll[i], "cddl_cde_get_comp_index");
979 ptr_cde_get_element_name[i] = (T_cde_get_element_name)
980 GetProcAddress (cdll[i], "cddl_cde_get_element_name");
981 ptr_cde_get_array_kind[i] = (T_cde_get_array_kind)
982 GetProcAddress (cdll[i], "cddl_cde_get_array_kind");
983 if (
984 ptr_cde_init[i] == NULL ||
985 ptr_cde_get_comp[i] == NULL ||
986 ptr_cde_prim_first[i] == NULL ||
987 ptr_cde_prim_next[i] == NULL ||
988 ptr_cde_msg_first[i] == NULL ||
989 ptr_cde_msg_next[i] == NULL ||
990 ptr_cde_comp_first[i] == NULL ||
991 ptr_cde_comp_next[i] == NULL ||
992 ptr_cde_get_symval[i] == NULL ||
993 ptr_cde_read_elem[i] == NULL ||
994 ptr_cde_write_prepare[i] == NULL ||
995 ptr_cde_write_elem[i] == NULL ||
996 ptr_cde_get_type[i] == NULL ||
997 ptr_cde_get_primcode[i] == NULL ||
998 ptr_cde_get_msgcode[i] == NULL ||
999 ptr_cde_get_is_downlink[i] == NULL ||
1000 ptr_cde_get_comp_index[i] == NULL ||
1001 ptr_cde_get_element_name[i] == NULL ||
1002 ptr_cde_get_array_kind[i] == NULL)
1003 {
1004 ptr_cde_init[i] = cddl_cde_init;
1005 ptr_cde_get_comp[i] = cddl_cde_get_comp;
1006 ptr_cde_prim_first[i] = cddl_cde_prim_first;
1007 ptr_cde_prim_next[i] = cddl_cde_prim_next;
1008 ptr_cde_msg_first[i] = cddl_cde_msg_first;
1009 ptr_cde_msg_next[i] = cddl_cde_msg_next;
1010 ptr_cde_comp_first[i] = cddl_cde_comp_first;
1011 ptr_cde_comp_next[i] = cddl_cde_comp_next;
1012 ptr_cde_get_symval[i] = cddl_cde_get_symval;
1013 ptr_cde_read_elem[i] = cddl_cde_read_elem;
1014 ptr_cde_write_prepare[i] = cddl_cde_write_prepare;
1015 ptr_cde_write_elem[i] = cddl_cde_write_elem;
1016 ptr_cde_get_type[i] = cddl_cde_get_type;
1017 ptr_cde_get_primcode[i] = cddl_cde_get_primcode;
1018 ptr_cde_get_msgcode[i] = cddl_cde_get_msgcode;
1019 ptr_cde_get_is_downlink[i] = cddl_cde_get_is_downlink;
1020 ptr_cde_get_comp_index[i] = cddl_cde_get_comp_index;
1021 ptr_cde_get_element_name[i] = cddl_cde_get_element_name;
1022 ptr_cde_get_array_kind[i] = cddl_cde_get_array_kind;
1023 }
1024
1025 ptr_pdi_createDefContext[i] = (T_pdi_createDefContext)
1026 GetProcAddress (cdll[i], "cddl_pdi_createDefContext");
1027 ptr_pdi_createContext[i] = (T_pdi_createContext)
1028 GetProcAddress (cdll[i], "cddl_pdi_createContext");
1029 ptr_pdi_destroyContext[i] = (T_pdi_destroyContext)
1030 GetProcAddress (cdll[i], "cddl_pdi_destroyContext");
1031 ptr_pdi_startPrim[i] = (T_pdi_startPrim)
1032 GetProcAddress (cdll[i], "cddl_pdi_startPrim");
1033 ptr_pdi_getDecodeInfo[i] = (T_pdi_getDecodeInfo)
1034 GetProcAddress (cdll[i], "cddl_pdi_getDecodeInfo");
1035 ptr_pdi_getEntityByPD[i] = (T_pdi_getEntityByPD)
1036 GetProcAddress (cdll[i], "cddl_pdi_getEntityByPD");
1037 ptr_pdi_pd2name[i] = (T_pdi_pd2name)
1038 GetProcAddress (cdll[i], "cddl_pdi_pd2name");
1039 if (
1040 ptr_pdi_createDefContext[i] == NULL ||
1041 ptr_pdi_createContext[i] == NULL ||
1042 ptr_pdi_destroyContext[i] == NULL ||
1043 ptr_pdi_startPrim[i] == NULL ||
1044 ptr_pdi_getDecodeInfo[i] == NULL ||
1045 ptr_pdi_getEntityByPD[i] == NULL ||
1046 ptr_pdi_pd2name[i] == NULL)
1047 {
1048 ptr_pdi_createDefContext[i]=cddl_pdi_createDefContext;
1049 ptr_pdi_createContext[i] =cddl_pdi_createContext;
1050 ptr_pdi_destroyContext[i] = cddl_pdi_destroyContext;
1051 ptr_pdi_startPrim[i] = cddl_pdi_startPrim;
1052 ptr_pdi_getDecodeInfo[i] = cddl_pdi_getDecodeInfo;
1053 ptr_pdi_getEntityByPD[i] = cddl_pdi_getEntityByPD;
1054 ptr_pdi_pd2name[i] = cddl_pdi_pd2name;
1055 }
1056
1057 ptr_ccddata_get_pdi_dinfo[i] = (T_ccddata_get_pdi_dinfo)
1058 GetProcAddress (cdll[i], "ccddata_get_pdi_dinfo");
1059 if (ptr_ccddata_get_pdi_dinfo[i] == NULL)
1060 {
1061 ptr_ccddata_get_pdi_dinfo[i] = cddl_ccddata_get_pdi_dinfo;
1062 }
1063 ptr_ccddata_get_num_of_entities[i] = (T_ccddata_get_num_of_entities)
1064 GetProcAddress (cdll[i], "ccddata_get_num_of_entities");
1065 ptr_ccddata_get_max_message_id[i] = (T_ccddata_get_max_message_id)
1066 GetProcAddress (cdll[i], "ccddata_get_max_message_id");
1067 ptr_ccddata_get_max_bitstream_len[i] = (T_ccddata_get_max_bitstream_len)
1068 GetProcAddress (cdll[i], "ccddata_get_max_bitstream_len");
1069 ptr_ccddata_get_max_mstruct_len[i] = (T_ccddata_get_max_mstruct_len)
1070 GetProcAddress (cdll[i], "ccddata_get_max_mstruct_len");
1071 ptr_ccddata_mccd_symbols[i] = (T_ccddata_mccd_symbols)
1072 GetProcAddress (cdll[i], "ccddata_mccd_symbols");
1073 ptr_ccddata_get_max_sap_num[i] = (T_ccddata_get_max_sap_num)
1074 GetProcAddress (cdll[i], "ccddata_get_max_sap_num");
1075 ptr_ccddata_get_max_primitive_id[i] = (T_ccddata_get_max_primitive_id)
1076 GetProcAddress (cdll[i], "ccddata_get_max_primitive_id");
1077 ptr_ccddata_get_max_pstruct_len[i] = (T_ccddata_get_max_pstruct_len)
1078 GetProcAddress (cdll[i], "ccddata_get_max_pstruct_len");
1079 ptr_ccddata_get_mvar[i] = (T_ccddata_get_mvar)
1080 GetProcAddress (cdll[i], "ccddata_get_mvar");
1081 ptr_ccddata_get_spare[i] = (T_ccddata_get_spare)
1082 GetProcAddress (cdll[i], "ccddata_get_spare");
1083 ptr_ccddata_get_calc[i] = (T_ccddata_get_calc)
1084 GetProcAddress (cdll[i], "ccddata_get_calc");
1085 ptr_ccddata_get_mcomp[i] = (T_ccddata_get_mcomp)
1086 GetProcAddress (cdll[i], "ccddata_get_mcomp");
1087 ptr_ccddata_get_melem[i] = (T_ccddata_get_melem)
1088 GetProcAddress (cdll[i], "ccddata_get_melem");
1089 ptr_ccddata_get_calcidx[i] = (T_ccddata_get_calcidx)
1090 GetProcAddress (cdll[i], "ccddata_get_calcidx");
1091 ptr_ccddata_get_mmtx[i] = (T_ccddata_get_mmtx)
1092 GetProcAddress (cdll[i], "ccddata_get_mmtx");
1093 ptr_ccddata_get_pvar[i] = (T_ccddata_get_pvar)
1094 GetProcAddress (cdll[i], "ccddata_get_pvar");
1095 ptr_ccddata_get_pcomp[i] = (T_ccddata_get_pcomp)
1096 GetProcAddress (cdll[i], "ccddata_get_pcomp");
1097 ptr_ccddata_get_pelem[i] = (T_ccddata_get_pelem)
1098 GetProcAddress (cdll[i], "ccddata_get_pelem");
1099 ptr_ccddata_get_pmtx[i] = (T_ccddata_get_pmtx)
1100 GetProcAddress (cdll[i], "ccddata_get_pmtx");
1101 ptr_ccddata_get_mval[i] = (T_ccddata_get_mval)
1102 GetProcAddress (cdll[i], "ccddata_get_mval");
1103 ptr_ccddata_get_mstr[i] = (T_ccddata_get_mstr)
1104 GetProcAddress (cdll[i], "ccddata_get_mstr");
1105 ptr_ccddata_get_pval[i] = (T_ccddata_get_pval)
1106 GetProcAddress (cdll[i], "ccddata_get_pval");
1107 ptr_ccddata_get_pstr[i] = (T_ccddata_get_pstr)
1108 GetProcAddress (cdll[i], "ccddata_get_pstr");
1109 ptr_ccddata_get_ccdent[i] = (T_ccddata_get_ccdent)
1110 GetProcAddress (cdll[i], "ccddata_get_ccdent");
1111 ptr_ccddata_get_entname[i] = (T_ccddata_get_entname)
1112 GetProcAddress (cdll[i], "ccddata_get_entname");
1113 if (ptr_ccddata_get_entname[i] == NULL)
1114 {
1115 ptr_ccddata_get_entname[i] = cddl_ccddata_get_entname;
1116 }
1117 ptr_ccddata_get_alias[i] = (T_ccddata_get_alias)
1118 GetProcAddress (cdll[i], "ccddata_get_alias");
1119 ptr_ccddata_get_version[i] = (T_ccddata_get_version)
1120 GetProcAddress (cdll[i], "ccddata_get_version");
1121 if (ptr_ccddata_get_version[i] == NULL)
1122 {
1123 ptr_ccddata_get_version[i] = cddl_ccddata_get_version;
1124 }
1125 ptr_ccddata_get_table_version[i] = (T_ccddata_get_table_version)
1126 GetProcAddress (cdll[i], "ccddata_get_table_version");
1127 if (ptr_ccddata_get_table_version[i] == NULL)
1128 {
1129 ptr_ccddata_get_table_version[i] = cddl_ccddata_get_table_version;
1130 }
1131 ptr_ccddata_get_mi_length[i] = (T_ccddata_get_mi_length)
1132 GetProcAddress (cdll[i], "ccddata_get_mi_length");
1133 if (ptr_ccddata_get_mi_length[i] == NULL)
1134 {
1135 mi_length[i] = (UBYTE*) GetProcAddress (cdll[i], "mi_length");
1136 }
1137 ptr_ccddata_get_decmsgbuffer[i] = (T_ccddata_get_decmsgbuffer)
1138 GetProcAddress (cdll[i], "ccddata_get_decmsgbuffer");
1139 if (ptr_ccddata_get_decmsgbuffer[i] == NULL)
1140 {
1141 decmsgbuffer[i] = (UBYTE*) GetProcAddress (cdll[i], "decMsgBuffer");
1142 }
1143 ptr_ccddata_tap_check_pd[i] = (T_ccddata_tap_check_pd)
1144 GetProcAddress (cdll[i], "ccddata_tap_check_pd");
1145 ptr_ccddata_tap_get_pd[i] = (T_ccddata_tap_get_pd)
1146 GetProcAddress (cdll[i], "ccddata_tap_get_pd");
1147 if (
1148 ptr_ccddata_get_pdi_dinfo[i] == NULL ||
1149 ptr_ccddata_get_num_of_entities[i] == NULL ||
1150 ptr_ccddata_get_max_message_id[i] == NULL ||
1151 ptr_ccddata_get_max_bitstream_len[i] == NULL ||
1152 ptr_ccddata_get_max_mstruct_len[i] == NULL ||
1153 ptr_ccddata_mccd_symbols[i] == NULL ||
1154 ptr_ccddata_get_max_sap_num[i] == NULL ||
1155 ptr_ccddata_get_max_primitive_id[i] == NULL ||
1156 ptr_ccddata_get_max_pstruct_len[i] == NULL ||
1157 ptr_ccddata_get_mvar[i] == NULL ||
1158 ptr_ccddata_get_spare[i] == NULL ||
1159 ptr_ccddata_get_calc[i] == NULL ||
1160 ptr_ccddata_get_mcomp[i] == NULL ||
1161 ptr_ccddata_get_melem[i] == NULL ||
1162 ptr_ccddata_get_calcidx[i] == NULL ||
1163 ptr_ccddata_get_mmtx[i] == NULL ||
1164 ptr_ccddata_get_pvar[i] == NULL ||
1165 ptr_ccddata_get_pcomp[i] == NULL ||
1166 ptr_ccddata_get_pelem[i] == NULL ||
1167 ptr_ccddata_get_pmtx[i] == NULL ||
1168 ptr_ccddata_get_mval[i] == NULL ||
1169 ptr_ccddata_get_mstr[i] == NULL ||
1170 ptr_ccddata_get_pval[i] == NULL ||
1171 ptr_ccddata_get_pstr[i] == NULL ||
1172 ptr_ccddata_get_ccdent[i] == NULL ||
1173 ptr_ccddata_get_entname[i] == NULL ||
1174 ptr_ccddata_get_alias[i] == NULL ||
1175 ptr_ccddata_get_version[i] == NULL ||
1176 ptr_ccddata_get_table_version[i] == NULL ||
1177 ((ptr_ccddata_get_mi_length[i] == NULL) && (mi_length[i] == NULL)) ||
1178 ((ptr_ccddata_get_decmsgbuffer[i] == NULL) &&
1179 (decmsgbuffer[i] == NULL)) ||
1180 ptr_ccddata_tap_check_pd[i] == NULL ||
1181 ptr_ccddata_tap_get_pd[i] == NULL)
1182 {
1183 (void) ccddata_exit ();
1184 return CCDDATA_DLL_LOADFUN;
1185 }
1186
1187 (void) (*ptr_ccd_init_ccddata[i]) ();
1188 (void) (*ptr_ccd_init[i]) ();
1189 (void) (*ptr_cde_init[i]) ();
1190 (void) (*ptr_pcon_init_ccddata[i]) ();
1191 (void) (*ptr_pcon_init_prim_coding[i]) (0, PCON_LITTLE);
1192
1193 if (!already_loaded && ccddata_i_notify != NULL)
1194 {
1195 (*ccddata_i_notify)();
1196 }
1197
1198 return CCDDATA_DLL_OK;
1199 }
1200
1201 /*
1202 +------------------------------------------------------------------------------
1203 | Function : ccddata_ehandler
1204 +------------------------------------------------------------------------------
1205 | Description : Handle NULL pointer; if we had loaded a ccddata dll
1206 | but any other process had loaded another one in the
1207 | meantime, the old one is unloaded and the new one is
1208 < attached to.
1209 |
1210 | Parameters : -
1211 |
1212 | Return : An error code or the return value of ccddata_attach
1213 +------------------------------------------------------------------------------
1214 */
1215 static int ccddata_ehandler (void)
1216 {
1217 if (me < 0)
1218 {
1219 return CCDDATA_DLL_REGISTER;
1220 }
1221
1222 // functions not loaded -> reattach
1223 ccddata_detach (me, 1);
1224 return ccddata_attach (me);
1225 }
1226 /*==== PUBLIC FUNCTIONS ======================================================*/
1227
1228 /* pcon_init_prim_coding ==================================================== */
1229 ULONG pcon_init_prim_coding (T_HANDLE caller, UBYTE format)
1230 {
1231 ULONG ret = PCON_DLLFUNC_ERROR;
1232 if (me < 0)
1233 {
1234 return ret;
1235 }
1236 WaitForSingleObject (mut[me], INFINITE);
1237 if ((ptr_pcon_init_prim_coding[me] != NULL) ||
1238 (ccddata_ehandler() == CCDDATA_DLL_OK))
1239 {
1240 __try
1241 {
1242 ret = (*ptr_pcon_init_prim_coding[me]) (caller, format);
1243 }
1244 __except(EXCEPTION_EXECUTE_HANDLER)
1245 {
1246 // acces violation -> possibly wrong ccddata-DLL
1247 }
1248 }
1249 ReleaseMutex (mut[me]);
1250 return ret;
1251 }
1252
1253 /* pcon_decodePrim ========================================================== */
1254 ULONG pcon_decodePrim (ULONG opc,
1255 void ** decoded_prim,
1256 void * coded_prim,
1257 ULONG * length,
1258 ULONG woff)
1259 {
1260 ULONG ret = PCON_DLLFUNC_ERROR;
1261 if (me < 0)
1262 {
1263 return ret;
1264 }
1265 WaitForSingleObject (mut[me], INFINITE);
1266 if ((ptr_pcon_decodePrim[me] != NULL) ||
1267 (ccddata_ehandler() == CCDDATA_DLL_OK))
1268 {
1269 __try
1270 {
1271 ret = (*ptr_pcon_decodePrim[me])(opc, decoded_prim, coded_prim, length,
1272 woff);
1273 }
1274 __except(EXCEPTION_EXECUTE_HANDLER)
1275 {
1276 // acces violation -> possibly wrong ccddata-DLL
1277 }
1278 }
1279 ReleaseMutex (mut[me]);
1280 return ret;
1281 }
1282
1283 /* pcon_codePrim ============================================================*/
1284 ULONG pcon_codePrim (ULONG opc,
1285 void * decoded_prim,
1286 void ** coded_prim,
1287 ULONG * length,
1288 ULONG woff,
1289 char* receiver)
1290 {
1291 ULONG ret = PCON_DLLFUNC_ERROR;
1292 if (me < 0)
1293 {
1294 return ret;
1295 }
1296 WaitForSingleObject (mut[me], INFINITE);
1297 if ((ptr_pcon_codePrim[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
1298 {
1299 __try
1300 {
1301 ret = (*ptr_pcon_codePrim[me])(opc, decoded_prim, coded_prim, length,
1302 woff, receiver);
1303 }
1304 __except(EXCEPTION_EXECUTE_HANDLER)
1305 {
1306 // acces violation -> possibly wrong ccddata-DLL
1307 }
1308 }
1309 ReleaseMutex (mut[me]);
1310 return ret;
1311 }
1312
1313 /* pcon_init_ccddata ========================================================*/
1314 ULONG pcon_init_ccddata (void)
1315 {
1316 ULONG ret = PCON_DLLFUNC_ERROR;
1317 if (me < 0)
1318 {
1319 return ret;
1320 }
1321 WaitForSingleObject (mut[me], INFINITE);
1322 if ((ptr_pcon_init_ccddata[me] != NULL) ||
1323 (ccddata_ehandler() == CCDDATA_DLL_OK))
1324 {
1325 __try
1326 {
1327 ret = (*ptr_pcon_init_ccddata[me])();
1328 }
1329 __except(EXCEPTION_EXECUTE_HANDLER)
1330 {
1331 // acces violation -> possibly wrong ccddata-DLL
1332 }
1333 }
1334 ReleaseMutex (mut[me]);
1335 return ret;
1336 }
1337
1338 /* pcon_make_filter =========================================================*/
1339 ULONG pcon_make_filter (char* string, void** prim)
1340 {
1341 ULONG ret = PCON_DLLFUNC_ERROR;
1342 if (me < 0)
1343 {
1344 return ret;
1345 }
1346 WaitForSingleObject (mut[me], INFINITE);
1347 if ((ptr_pcon_make_filter[me] != NULL) ||
1348 (ccddata_ehandler() == CCDDATA_DLL_OK))
1349 {
1350 __try
1351 {
1352 ret = (*ptr_pcon_make_filter[me])(string, prim);
1353 }
1354 __except(EXCEPTION_EXECUTE_HANDLER)
1355 {
1356 // acces violation -> possibly wrong ccddata-DLL
1357 }
1358 }
1359 ReleaseMutex (mut[me]);
1360 return ret;
1361 }
1362
1363 /* pcon_filter_decode_prim ===================================================*/
1364 ULONG pcon_filter_decode_prim (ULONG opc,
1365 void** decoded_prim,
1366 void* coded_prim,
1367 ULONG* length,
1368 ULONG woff,
1369 void** shadow_prim)
1370 {
1371 ULONG ret = PCON_DLLFUNC_ERROR;
1372 if (me < 0)
1373 {
1374 return ret;
1375 }
1376 WaitForSingleObject (mut[me], INFINITE);
1377 if ((ptr_pcon_filter_decode_prim[me] != NULL) ||
1378 (ccddata_ehandler() == CCDDATA_DLL_OK))
1379 {
1380 __try
1381 {
1382 ret = (*ptr_pcon_filter_decode_prim[me])(opc, decoded_prim, coded_prim,
1383 length, woff, shadow_prim);
1384 }
1385 __except(EXCEPTION_EXECUTE_HANDLER)
1386 {
1387 // acces violation -> possibly wrong ccddata-DLL
1388 }
1389 }
1390 ReleaseMutex (mut[me]);
1391 return ret;
1392 }
1393
1394 /* pcon_codePrim ============================================================*/
1395 /* ccddata_get_num_of_entities ==============================================*/
1396 int ccddata_get_num_of_entities (void)
1397 {
1398 int ret = 0;
1399 if (me < 0)
1400 {
1401 return ret;
1402 }
1403 WaitForSingleObject (mut[me], INFINITE);
1404 if ((ptr_ccddata_get_num_of_entities[me] != NULL) ||
1405 (ccddata_ehandler() == CCDDATA_DLL_OK))
1406 {
1407 __try
1408 {
1409 ret = (*ptr_ccddata_get_num_of_entities[me])();
1410 }
1411 __except(EXCEPTION_EXECUTE_HANDLER)
1412 {
1413 // acces violation -> possibly wrong ccddata-DLL
1414 }
1415 }
1416 ReleaseMutex (mut[me]);
1417 return ret;
1418 }
1419
1420 /* ccddata_get_pdi_dinfo ==============================================*/
1421 int ccddata_get_pdi_dinfo (const T_PDI_DECODEINFO* (*dinfo) )
1422 {
1423 int ret = 0;
1424 if (me < 0)
1425 {
1426 return ret;
1427 }
1428 WaitForSingleObject (mut[me], INFINITE);
1429 if ((ptr_ccddata_get_pdi_dinfo[me] != NULL) ||
1430 (ccddata_ehandler() == CCDDATA_DLL_OK))
1431 {
1432 __try
1433 {
1434 ret = (*ptr_ccddata_get_pdi_dinfo[me])(dinfo);
1435 }
1436 __except(EXCEPTION_EXECUTE_HANDLER)
1437 {
1438 // acces violation -> possibly wrong ccddata-DLL
1439 }
1440 }
1441 ReleaseMutex (mut[me]);
1442 return ret;
1443 }
1444
1445 /* ccddata_get_max_message_id ===============================================*/
1446 int ccddata_get_max_message_id (void)
1447 {
1448 int ret = 0;
1449 if (me < 0)
1450 {
1451 return ret;
1452 }
1453 WaitForSingleObject (mut[me], INFINITE);
1454 if ((ptr_ccddata_get_max_message_id[me] != NULL) ||
1455 (ccddata_ehandler() == CCDDATA_DLL_OK))
1456 {
1457 __try
1458 {
1459 ret = (*ptr_ccddata_get_max_message_id[me])();
1460 }
1461 __except(EXCEPTION_EXECUTE_HANDLER)
1462 {
1463 // acces violation -> possibly wrong ccddata-DLL
1464 }
1465 }
1466 ReleaseMutex (mut[me]);
1467 return ret;
1468 }
1469
1470 /* ccddata_get_max_bitstream_len ============================================*/
1471 int ccddata_get_max_bitstream_len (void)
1472 {
1473 int ret = CCDDATA_MCONST_ERROR;
1474 if (me < 0)
1475 {
1476 return ret;
1477 }
1478 WaitForSingleObject (mut[me], INFINITE);
1479 if ((ptr_ccddata_get_max_bitstream_len[me] != NULL) ||
1480 (ccddata_ehandler() == CCDDATA_DLL_OK))
1481 {
1482 __try
1483 {
1484 ret = (*ptr_ccddata_get_max_bitstream_len[me])();
1485 }
1486 __except(EXCEPTION_EXECUTE_HANDLER)
1487 {
1488 // acces violation -> possibly wrong ccddata-DLL
1489 }
1490 }
1491 ReleaseMutex (mut[me]);
1492 return ret;
1493 }
1494
1495 /* ccddata_get_max_mstruct_len ==============================================*/
1496 int ccddata_get_max_mstruct_len (void)
1497 {
1498 int ret = CCDDATA_MCONST_ERROR;
1499 if (me < 0)
1500 {
1501 return ret;
1502 }
1503 WaitForSingleObject (mut[me], INFINITE);
1504 if ((ptr_ccddata_get_max_mstruct_len[me] != NULL) ||
1505 (ccddata_ehandler() == CCDDATA_DLL_OK))
1506 {
1507 __try
1508 {
1509 ret = (*ptr_ccddata_get_max_mstruct_len[me])();
1510 }
1511 __except(EXCEPTION_EXECUTE_HANDLER)
1512 {
1513 // acces violation -> possibly wrong ccddata-DLL
1514 }
1515 }
1516 ReleaseMutex (mut[me]);
1517 return ret;
1518 }
1519
1520 /* ccddata_mccd_symbols =====================================================*/
1521 int ccddata_mccd_symbols (void)
1522 {
1523 int ret = CCDDATA_MCONST_ERROR;
1524 if (me < 0)
1525 {
1526 return ret;
1527 }
1528 WaitForSingleObject (mut[me], INFINITE);
1529 if ((ptr_ccddata_mccd_symbols[me] != NULL) ||
1530 (ccddata_ehandler() == CCDDATA_DLL_OK))
1531 {
1532 __try
1533 {
1534 ret = (*ptr_ccddata_mccd_symbols[me])();
1535 }
1536 __except(EXCEPTION_EXECUTE_HANDLER)
1537 {
1538 // acces violation -> possibly wrong ccddata-DLL
1539 }
1540 }
1541 ReleaseMutex (mut[me]);
1542 return ret;
1543 }
1544
1545 /* ccddata_get_max_sap_num ==================================================*/
1546 int ccddata_get_max_sap_num (void)
1547 {
1548 int ret = 0;
1549 if (me < 0)
1550 {
1551 return ret;
1552 }
1553 WaitForSingleObject (mut[me], INFINITE);
1554 if ((ptr_ccddata_get_max_sap_num[me] != NULL) ||
1555 (ccddata_ehandler() == CCDDATA_DLL_OK))
1556 {
1557 __try
1558 {
1559 ret = (*ptr_ccddata_get_max_sap_num[me])();
1560 }
1561 __except(EXCEPTION_EXECUTE_HANDLER)
1562 {
1563 // acces violation -> possibly wrong ccddata-DLL
1564 }
1565 }
1566 ReleaseMutex (mut[me]);
1567 return ret;
1568 }
1569
1570 /* ccddata_get_max_primitive_id =============================================*/
1571 int ccddata_get_max_primitive_id (void)
1572 {
1573 int ret = 0;
1574 if (me < 0)
1575 {
1576 return ret;
1577 }
1578 WaitForSingleObject (mut[me], INFINITE);
1579 if ((ptr_ccddata_get_max_primitive_id[me] != NULL) ||
1580 (ccddata_ehandler() == CCDDATA_DLL_OK))
1581 {
1582 __try
1583 {
1584 ret = (*ptr_ccddata_get_max_primitive_id[me])();
1585 }
1586 __except(EXCEPTION_EXECUTE_HANDLER)
1587 {
1588 // acces violation -> possibly wrong ccddata-DLL
1589 }
1590 }
1591 ReleaseMutex (mut[me]);
1592 return ret;
1593 }
1594
1595 /* ccddata_get_max_pstruct_len ==============================================*/
1596 int ccddata_get_max_pstruct_len (void)
1597 {
1598 int ret = CCDDATA_PCONST_ERROR;
1599 if (me < 0)
1600 {
1601 return ret;
1602 }
1603 WaitForSingleObject (mut[me], INFINITE);
1604 if ((ptr_ccddata_get_max_pstruct_len[me] != NULL) ||
1605 (ccddata_ehandler() == CCDDATA_DLL_OK))
1606 {
1607 __try
1608 {
1609 ret = (*ptr_ccddata_get_max_pstruct_len[me])();
1610 }
1611 __except(EXCEPTION_EXECUTE_HANDLER)
1612 {
1613 // acces violation -> possibly wrong ccddata-DLL
1614 }
1615 }
1616 ReleaseMutex (mut[me]);
1617 return ret;
1618 }
1619
1620 /* ccddata_get_calcidx ======================================================*/
1621 const T_CCD_CalcIndex* ccddata_get_calcidx (USHORT idx)
1622 {
1623 const T_CCD_CalcIndex* ret = NULL;
1624 if (me < 0)
1625 {
1626 return ret;
1627 }
1628 WaitForSingleObject (mut[me], INFINITE);
1629 if ((ptr_ccddata_get_calcidx[me] != NULL) ||
1630 (ccddata_ehandler() == CCDDATA_DLL_OK))
1631 {
1632 __try
1633 {
1634 ret = (*ptr_ccddata_get_calcidx[me])(idx);
1635 }
1636 __except(EXCEPTION_EXECUTE_HANDLER)
1637 {
1638 // acces violation -> possibly wrong ccddata-DLL
1639 }
1640 }
1641 ReleaseMutex (mut[me]);
1642 return ret;
1643 }
1644
1645 /* ccddata_get_mvar =========================================================*/
1646 const T_CCD_VarTabEntry* ccddata_get_mvar (USHORT idx)
1647 {
1648 const T_CCD_VarTabEntry* ret = NULL;
1649 if (me < 0)
1650 {
1651 return ret;
1652 }
1653 WaitForSingleObject (mut[me], INFINITE);
1654 if ((ptr_ccddata_get_mvar[me] != NULL) ||
1655 (ccddata_ehandler() == CCDDATA_DLL_OK))
1656 {
1657 __try
1658 {
1659 ret = (*ptr_ccddata_get_mvar[me])(idx);
1660 }
1661 __except(EXCEPTION_EXECUTE_HANDLER)
1662 {
1663 // acces violation -> possibly wrong ccddata-DLL
1664 }
1665 }
1666 ReleaseMutex (mut[me]);
1667 return ret;
1668 }
1669
1670 /* ccddata_get_spare ========================================================*/
1671 const T_CCD_SpareTabEntry* ccddata_get_spare (USHORT idx)
1672 {
1673 const T_CCD_SpareTabEntry* ret = NULL;
1674 if (me < 0)
1675 {
1676 return ret;
1677 }
1678 WaitForSingleObject (mut[me], INFINITE);
1679 if ((ptr_ccddata_get_spare[me] != NULL) ||
1680 (ccddata_ehandler() == CCDDATA_DLL_OK))
1681 {
1682 __try
1683 {
1684 ret = (*ptr_ccddata_get_spare[me])(idx);
1685 }
1686 __except(EXCEPTION_EXECUTE_HANDLER)
1687 {
1688 // acces violation -> possibly wrong ccddata-DLL
1689 }
1690 }
1691 ReleaseMutex (mut[me]);
1692 return ret;
1693 }
1694
1695 /* ccddata_get_calc =========================================================*/
1696 const T_CCD_CalcTabEntry* ccddata_get_calc (USHORT idx)
1697 {
1698 const T_CCD_CalcTabEntry* ret = NULL;
1699 if (me < 0)
1700 {
1701 return ret;
1702 }
1703 WaitForSingleObject (mut[me], INFINITE);
1704 if ((ptr_ccddata_get_calc[me] != NULL) ||
1705 (ccddata_ehandler() == CCDDATA_DLL_OK))
1706 {
1707 __try
1708 {
1709 ret = (*ptr_ccddata_get_calc[me])(idx);
1710 }
1711 __except(EXCEPTION_EXECUTE_HANDLER)
1712 {
1713 // acces violation -> possibly wrong ccddata-DLL
1714 }
1715 }
1716 ReleaseMutex (mut[me]);
1717 return ret;
1718 }
1719
1720 /* ccddata_get_mcomp ========================================================*/
1721 const T_CCD_CompTabEntry* ccddata_get_mcomp (USHORT idx)
1722 {
1723 const T_CCD_CompTabEntry* ret = NULL;
1724 if (me < 0)
1725 {
1726 return ret;
1727 }
1728 WaitForSingleObject (mut[me], INFINITE);
1729 if ((ptr_ccddata_get_mcomp[me] != NULL) ||
1730 (ccddata_ehandler() == CCDDATA_DLL_OK))
1731 {
1732 __try
1733 {
1734 ret = (*ptr_ccddata_get_mcomp[me])(idx);
1735 }
1736 __except(EXCEPTION_EXECUTE_HANDLER)
1737 {
1738 // acces violation -> possibly wrong ccddata-DLL
1739 }
1740 }
1741 ReleaseMutex (mut[me]);
1742 return ret;
1743 }
1744
1745 /* ccddata_get_melem ========================================================*/
1746 const T_CCD_ElemTabEntry* ccddata_get_melem (USHORT idx)
1747 {
1748 const T_CCD_ElemTabEntry* ret = NULL;
1749 if (me < 0)
1750 {
1751 return ret;
1752 }
1753 WaitForSingleObject (mut[me], INFINITE);
1754 if ((ptr_ccddata_get_melem[me] != NULL) ||
1755 (ccddata_ehandler() == CCDDATA_DLL_OK))
1756 {
1757 __try
1758 {
1759 ret = (*ptr_ccddata_get_melem[me])(idx);
1760 }
1761 __except(EXCEPTION_EXECUTE_HANDLER)
1762 {
1763 // acces violation -> possibly wrong ccddata-DLL
1764 }
1765 }
1766 ReleaseMutex (mut[me]);
1767 return ret;
1768 }
1769
1770 /* ccddata_get_mmtx =========================================================*/
1771 USHORT ccddata_get_mmtx (USHORT entity, USHORT msgid, USHORT index)
1772 {
1773 USHORT ret = NO_REF;
1774 if (me < 0)
1775 {
1776 return ret;
1777 }
1778 WaitForSingleObject (mut[me], INFINITE);
1779 if ((ptr_ccddata_get_mmtx[me] != NULL) ||
1780 (ccddata_ehandler() == CCDDATA_DLL_OK))
1781 {
1782 __try
1783 {
1784 ret = (*ptr_ccddata_get_mmtx[me])(entity, msgid, index);
1785 }
1786 __except(EXCEPTION_EXECUTE_HANDLER)
1787 {
1788 // acces violation -> possibly wrong ccddata-DLL
1789 }
1790 }
1791 ReleaseMutex (mut[me]);
1792 return ret;
1793 }
1794
1795 /* ccddata_get_pvar =========================================================*/
1796 const T_CCD_VarTabEntry* ccddata_get_pvar (USHORT idx)
1797 {
1798 const T_CCD_VarTabEntry* ret = NULL;
1799 if (me < 0)
1800 {
1801 return ret;
1802 }
1803 WaitForSingleObject (mut[me], INFINITE);
1804 if ((ptr_ccddata_get_pvar[me] != NULL) ||
1805 (ccddata_ehandler() == CCDDATA_DLL_OK))
1806 {
1807 __try
1808 {
1809 ret = (*ptr_ccddata_get_pvar[me])(idx);
1810 }
1811 __except(EXCEPTION_EXECUTE_HANDLER)
1812 {
1813 // acces violation -> possibly wrong ccddata-DLL
1814 }
1815 }
1816 ReleaseMutex (mut[me]);
1817 return ret;
1818 }
1819
1820 /* ccddata_get_pcomp ========================================================*/
1821 const T_CCD_CompTabEntry* ccddata_get_pcomp (USHORT idx)
1822 {
1823 const T_CCD_CompTabEntry* ret = NULL;
1824 if (me < 0)
1825 {
1826 return ret;
1827 }
1828 WaitForSingleObject (mut[me], INFINITE);
1829 if ((ptr_ccddata_get_pcomp[me] != NULL) ||
1830 (ccddata_ehandler() == CCDDATA_DLL_OK))
1831 {
1832 __try
1833 {
1834 ret = (*ptr_ccddata_get_pcomp[me])(idx);
1835 }
1836 __except(EXCEPTION_EXECUTE_HANDLER)
1837 {
1838 // acces violation -> possibly wrong ccddata-DLL
1839 }
1840 }
1841 ReleaseMutex (mut[me]);
1842 return ret;
1843 }
1844
1845 /* ccddata_get_pelem ========================================================*/
1846 const T_CCD_ElemTabEntry* ccddata_get_pelem (USHORT idx)
1847 {
1848 const T_CCD_ElemTabEntry* ret = NULL;
1849 if (me < 0)
1850 {
1851 return ret;
1852 }
1853 WaitForSingleObject (mut[me], INFINITE);
1854 if ((ptr_ccddata_get_pelem[me] != NULL) ||
1855 (ccddata_ehandler() == CCDDATA_DLL_OK))
1856 {
1857 __try
1858 {
1859 ret = (*ptr_ccddata_get_pelem[me])(idx);
1860 }
1861 __except(EXCEPTION_EXECUTE_HANDLER)
1862 {
1863 // acces violation -> possibly wrong ccddata-DLL
1864 }
1865 }
1866 ReleaseMutex (mut[me]);
1867 return ret;
1868 }
1869
1870 /* ccddata_get_pmtx =========================================================*/
1871 USHORT ccddata_get_pmtx (USHORT sap, USHORT primid, USHORT index)
1872 {
1873 USHORT ret = NO_REF;
1874 if (me < 0)
1875 {
1876 return ret;
1877 }
1878 WaitForSingleObject (mut[me], INFINITE);
1879 if ((ptr_ccddata_get_pmtx[me] != NULL) ||
1880 (ccddata_ehandler() == CCDDATA_DLL_OK))
1881 {
1882 __try
1883 {
1884 ret = (*ptr_ccddata_get_pmtx[me])(sap, primid, index);
1885 }
1886 __except(EXCEPTION_EXECUTE_HANDLER)
1887 {
1888 // acces violation -> possibly wrong ccddata-DLL
1889 }
1890 }
1891 ReleaseMutex (mut[me]);
1892 return ret;
1893 }
1894
1895 /* ccddata_get_mval =========================================================*/
1896 const T_CCD_ValTabEntry* ccddata_get_mval (USHORT idx)
1897 {
1898 const T_CCD_ValTabEntry* ret = NULL;
1899 if (me < 0)
1900 {
1901 return ret;
1902 }
1903 WaitForSingleObject (mut[me], INFINITE);
1904 if ((ptr_ccddata_get_mval[me] != NULL) ||
1905 (ccddata_ehandler() == CCDDATA_DLL_OK))
1906 {
1907 __try
1908 {
1909 ret = (*ptr_ccddata_get_mval[me])(idx);
1910 }
1911 __except(EXCEPTION_EXECUTE_HANDLER)
1912 {
1913 // acces violation -> possibly wrong ccddata-DLL
1914 }
1915 }
1916 ReleaseMutex (mut[me]);
1917 return ret;
1918 }
1919
1920 /* ccddata_get_mstr =========================================================*/
1921 const T_CCD_StrTabEntry* ccddata_get_mstr (USHORT idx)
1922 {
1923 const T_CCD_StrTabEntry* ret = NULL;
1924 if (me < 0)
1925 {
1926 return ret;
1927 }
1928 WaitForSingleObject (mut[me], INFINITE);
1929 if ((ptr_ccddata_get_mstr[me] != NULL) ||
1930 (ccddata_ehandler() == CCDDATA_DLL_OK))
1931 {
1932 __try
1933 {
1934 ret = (*ptr_ccddata_get_mstr[me])(idx);
1935 }
1936 __except(EXCEPTION_EXECUTE_HANDLER)
1937 {
1938 // acces violation -> possibly wrong ccddata-DLL
1939 }
1940 }
1941 ReleaseMutex (mut[me]);
1942 return ret;
1943 }
1944
1945 /* ccddata_get_pval =========================================================*/
1946 const T_CCD_ValTabEntry* ccddata_get_pval (USHORT idx)
1947 {
1948 const T_CCD_ValTabEntry* ret = NULL;
1949 if (me < 0)
1950 {
1951 return ret;
1952 }
1953 WaitForSingleObject (mut[me], INFINITE);
1954 if ((ptr_ccddata_get_pval[me] != NULL) ||
1955 (ccddata_ehandler() == CCDDATA_DLL_OK))
1956 {
1957 __try
1958 {
1959 ret = (*ptr_ccddata_get_pval[me])(idx);
1960 }
1961 __except(EXCEPTION_EXECUTE_HANDLER)
1962 {
1963 // acces violation -> possibly wrong ccddata-DLL
1964 }
1965 }
1966 ReleaseMutex (mut[me]);
1967 return ret;
1968 }
1969
1970 /* ccddata_get_pstr =========================================================*/
1971 const T_CCD_StrTabEntry* ccddata_get_pstr (USHORT idx)
1972 {
1973 const T_CCD_StrTabEntry* ret = NULL;
1974 if (me < 0)
1975 {
1976 return ret;
1977 }
1978 WaitForSingleObject (mut[me], INFINITE);
1979 if ((ptr_ccddata_get_pstr[me] != NULL) ||
1980 (ccddata_ehandler() == CCDDATA_DLL_OK))
1981 {
1982 __try
1983 {
1984 ret = (*ptr_ccddata_get_pstr[me])(idx);
1985 }
1986 __except(EXCEPTION_EXECUTE_HANDLER)
1987 {
1988 // acces violation -> possibly wrong ccddata-DLL
1989 }
1990 }
1991 ReleaseMutex (mut[me]);
1992 return ret;
1993 }
1994
1995 /* ccddata_get_ccdent =======================================================*/
1996 short ccddata_get_ccdent (char* entname)
1997 {
1998 short ret = CCDDATA_CCDENT_INVALID;
1999 if (me < 0)
2000 {
2001 return ret;
2002 }
2003 WaitForSingleObject (mut[me], INFINITE);
2004 if ((ptr_ccddata_get_ccdent[me] != NULL) ||
2005 (ccddata_ehandler() == CCDDATA_DLL_OK))
2006 {
2007 __try
2008 {
2009 ret = (*ptr_ccddata_get_ccdent[me])(entname);
2010 }
2011 __except(EXCEPTION_EXECUTE_HANDLER)
2012 {
2013 // acces violation -> possibly wrong ccddata-DLL
2014 }
2015 }
2016 ReleaseMutex (mut[me]);
2017 return ret;
2018 }
2019
2020 /* ccddata_get_entname =======================================================*/
2021 const char * ccddata_get_entname (short ccdent)
2022 {
2023 const char * ret = NULL;
2024 if (me < 0)
2025 {
2026 return ret;
2027 }
2028 WaitForSingleObject (mut[me], INFINITE);
2029 if ((ptr_ccddata_get_entname[me] != NULL) ||
2030 (ccddata_ehandler() == CCDDATA_DLL_OK))
2031 {
2032 __try
2033 {
2034 ret = (*ptr_ccddata_get_entname[me])(ccdent);
2035 }
2036 __except(EXCEPTION_EXECUTE_HANDLER)
2037 {
2038 // acces violation -> possibly wrong ccddata-DLL
2039 }
2040 }
2041 ReleaseMutex (mut[me]);
2042 return ret;
2043 }
2044
2045 /* ccddata_get_alias ========================================================*/
2046 char* ccddata_get_alias (USHORT idx, int from_msg)
2047 {
2048 char* ret = "";
2049 if (me < 0)
2050 {
2051 return ret;
2052 }
2053 WaitForSingleObject (mut[me], INFINITE);
2054 if ((ptr_ccddata_get_alias[me] != NULL) ||
2055 (ccddata_ehandler() == CCDDATA_DLL_OK))
2056 {
2057 __try
2058 {
2059 ret = (*ptr_ccddata_get_alias[me])(idx, from_msg);
2060 }
2061 __except(EXCEPTION_EXECUTE_HANDLER)
2062 {
2063 // acces violation -> possibly wrong ccddata-DLL
2064 }
2065 }
2066 ReleaseMutex (mut[me]);
2067 return ret;
2068 }
2069
2070 /* ccddata_get_version ======================================================*/
2071 char* ccddata_get_version (void)
2072 {
2073 char* ret = "";
2074 if (me < 0)
2075 {
2076 return ret;
2077 }
2078 WaitForSingleObject (mut[me], INFINITE);
2079 if ((ptr_ccddata_get_version[me] != NULL) ||
2080 (ccddata_ehandler() == CCDDATA_DLL_OK))
2081 {
2082 __try
2083 {
2084 ret = (*ptr_ccddata_get_version[me])();
2085 }
2086 __except(EXCEPTION_EXECUTE_HANDLER)
2087 {
2088 // acces violation -> possibly wrong ccddata-DLL
2089 }
2090 }
2091 ReleaseMutex (mut[me]);
2092 return ret;
2093 }
2094
2095 /* ccddata_get_table_version ================================================*/
2096 int ccddata_get_table_version (void)
2097 {
2098 int ret = 0;
2099 if (me < 0)
2100 {
2101 return ret;
2102 }
2103 WaitForSingleObject (mut[me], INFINITE);
2104 if ((ptr_ccddata_get_table_version[me] != NULL) ||
2105 (ccddata_ehandler() == CCDDATA_DLL_OK))
2106 {
2107 __try
2108 {
2109 ret = (*ptr_ccddata_get_table_version[me])();
2110 }
2111 __except(EXCEPTION_EXECUTE_HANDLER)
2112 {
2113 // acces violation -> possibly wrong ccddata-DLL
2114 }
2115 }
2116 ReleaseMutex (mut[me]);
2117 return ret;
2118 }
2119
2120 /* ccddata_get_decmsgbuffer =================================================*/
2121 UBYTE* ccddata_get_decmsgbuffer (void)
2122 {
2123 UBYTE* ret = NULL;
2124 if (me < 0)
2125 {
2126 return ret;
2127 }
2128 WaitForSingleObject (mut[me], INFINITE);
2129 if (ptr_ccddata_get_decmsgbuffer[me] == NULL)
2130 {
2131 if (decmsgbuffer[me] != NULL)
2132 {
2133 ret = decmsgbuffer[me];
2134 }
2135 else if (ccddata_ehandler() == CCDDATA_DLL_OK)
2136 {
2137 ret = ccddata_get_decmsgbuffer ();
2138 }
2139 else
2140 {
2141 ;
2142 }
2143 }
2144 else
2145 {
2146 __try
2147 {
2148 ret = (*ptr_ccddata_get_decmsgbuffer[me])();
2149 }
2150 __except(EXCEPTION_EXECUTE_HANDLER)
2151 {
2152 // acces violation -> possibly wrong ccddata-DLL
2153 }
2154 }
2155 ReleaseMutex (mut[me]);
2156 return ret;
2157 }
2158
2159 /* ccddata_get_mi_length ====================================================*/
2160 UBYTE* ccddata_get_mi_length (void)
2161 {
2162 UBYTE* ret = NULL;
2163 if (me < 0)
2164 {
2165 return ret;
2166 }
2167 WaitForSingleObject (mut[me], INFINITE);
2168 if (ptr_ccddata_get_mi_length[me] == NULL)
2169 {
2170 if (mi_length[me] != NULL)
2171 {
2172 ret = mi_length[me];
2173 }
2174 else if (ccddata_ehandler() == CCDDATA_DLL_OK)
2175 {
2176 ret = ccddata_get_mi_length ();
2177 }
2178 else
2179 {
2180 ;
2181 }
2182 }
2183 else
2184 {
2185 __try
2186 {
2187 ret = (*ptr_ccddata_get_mi_length[me])();
2188 }
2189 __except(EXCEPTION_EXECUTE_HANDLER)
2190 {
2191 // acces violation -> possibly wrong ccddata-DLL
2192 }
2193 }
2194 ReleaseMutex (mut[me]);
2195 return ret;
2196 }
2197
2198 /* ccddata_tap_get_pd =======================================================*/
2199 int ccddata_tap_get_pd (UCHAR comp)
2200 {
2201 int ret = TAP_PD_INVALID;
2202 if (me < 0)
2203 {
2204 return ret;
2205 }
2206 WaitForSingleObject (mut[me], INFINITE);
2207 if ((ptr_ccddata_tap_get_pd[me] != NULL) ||
2208 (ccddata_ehandler() == CCDDATA_DLL_OK))
2209 {
2210 __try
2211 {
2212 ret = (*ptr_ccddata_tap_get_pd[me])(comp);
2213 }
2214 __except(EXCEPTION_EXECUTE_HANDLER)
2215 {
2216 // acces violation -> possibly wrong ccddata-DLL
2217 }
2218 }
2219 ReleaseMutex (mut[me]);
2220 return ret;
2221 }
2222
2223 /* ccddata_tap_check_pd =====================================================*/
2224 int ccddata_tap_check_pd (UCHAR comp, UCHAR pd)
2225 {
2226 int ret = TAP_PD_INVALID;
2227 if (me < 0)
2228 {
2229 return ret;
2230 }
2231 WaitForSingleObject (mut[me], INFINITE);
2232 if ((ptr_ccddata_tap_check_pd[me] != NULL) ||
2233 (ccddata_ehandler() == CCDDATA_DLL_OK))
2234 {
2235 __try
2236 {
2237 ret = (*ptr_ccddata_tap_check_pd[me])(comp, pd);
2238 }
2239 __except(EXCEPTION_EXECUTE_HANDLER)
2240 {
2241 // acces violation -> possibly wrong ccddata-DLL
2242 }
2243 }
2244 ReleaseMutex (mut[me]);
2245 return ret;
2246 }
2247
2248 /* ccddata_eg_nodes =========================================================*/
2249 int ccddata_eg_nodes (void)
2250 {
2251 int ret = 0;
2252 if (me < 0)
2253 {
2254 return ret;
2255 }
2256 WaitForSingleObject (mut[me], INFINITE);
2257 if ((ptr_ccddata_eg_nodes[me] != NULL) ||
2258 (ccddata_ehandler() == CCDDATA_DLL_OK))
2259 {
2260 __try
2261 {
2262 ret = (*ptr_ccddata_eg_nodes[me])();
2263 }
2264 __except(EXCEPTION_EXECUTE_HANDLER)
2265 {
2266 // acces violation -> possibly wrong ccddata-DLL
2267 }
2268 }
2269 ReleaseMutex (mut[me]);
2270 return ret;
2271 }
2272
2273 /* ccddata_eg_nodenames =====================================================*/
2274 char** ccddata_eg_nodenames (void)
2275 {
2276 char** ret = NULL;
2277 if (me < 0)
2278 {
2279 return ret;
2280 }
2281 WaitForSingleObject (mut[me], INFINITE);
2282 if ((ptr_ccddata_eg_nodenames[me] != NULL) ||
2283 (ccddata_ehandler() == CCDDATA_DLL_OK))
2284 {
2285 __try
2286 {
2287 ret = (*ptr_ccddata_eg_nodenames[me])();
2288 }
2289 __except(EXCEPTION_EXECUTE_HANDLER)
2290 {
2291 // acces violation -> possibly wrong ccddata-DLL
2292 }
2293 }
2294 ReleaseMutex (mut[me]);
2295 return ret;
2296 }
2297
2298 /* ccddata_eg_adjacent ======================================================*/
2299 char* ccddata_eg_adjacent (int idx)
2300 {
2301 char* ret = NULL;
2302 if (me < 0)
2303 {
2304 return ret;
2305 }
2306 WaitForSingleObject (mut[me], INFINITE);
2307 if ((ptr_ccddata_eg_adjacent[me] != NULL) ||
2308 (ccddata_ehandler() == CCDDATA_DLL_OK))
2309 {
2310 __try
2311 {
2312 ret = (*ptr_ccddata_eg_adjacent[me])(idx);
2313 }
2314 __except(EXCEPTION_EXECUTE_HANDLER)
2315 {
2316 // acces violation -> possibly wrong ccddata-DLL
2317 }
2318 }
2319 ReleaseMutex (mut[me]);
2320 return ret;
2321 }
2322
2323 /* ccddata_eg_saps ==========================================================*/
2324 int ccddata_eg_saps (void)
2325 {
2326 int ret = 0;
2327 if (me < 0)
2328 {
2329 return ret;
2330 }
2331 WaitForSingleObject (mut[me], INFINITE);
2332 if ((ptr_ccddata_eg_saps[me] != NULL) ||
2333 (ccddata_ehandler() == CCDDATA_DLL_OK))
2334 {
2335 __try
2336 {
2337 ret = (*ptr_ccddata_eg_saps[me])();
2338 }
2339 __except(EXCEPTION_EXECUTE_HANDLER)
2340 {
2341 // acces violation -> possibly wrong ccddata-DLL
2342 }
2343 }
2344 ReleaseMutex (mut[me]);
2345 return ret;
2346 }
2347
2348 /* ccddata_eg_sapnames ======================================================*/
2349 char** ccddata_eg_sapnames (void)
2350 {
2351 char** ret = NULL;
2352 if (me < 0)
2353 {
2354 return ret;
2355 }
2356 WaitForSingleObject (mut[me], INFINITE);
2357 if ((ptr_ccddata_eg_sapnames[me] != NULL) ||
2358 (ccddata_ehandler() == CCDDATA_DLL_OK))
2359 {
2360 __try
2361 {
2362 ret = (*ptr_ccddata_eg_sapnames[me])();
2363 }
2364 __except(EXCEPTION_EXECUTE_HANDLER)
2365 {
2366 // acces violation -> possibly wrong ccddata-DLL
2367 }
2368 }
2369 ReleaseMutex (mut[me]);
2370 return ret;
2371 }
2372
2373 /* ccddata_eg_comendpoints ==================================================*/
2374 T_COMENDPOINTS* ccddata_eg_comendpoints (int idx)
2375 {
2376 T_COMENDPOINTS* ret = NULL;
2377 if (me < 0)
2378 {
2379 return ret;
2380 }
2381 WaitForSingleObject (mut[me], INFINITE);
2382 if ((ptr_ccddata_eg_comendpoints[me] != NULL) ||
2383 (ccddata_ehandler() == CCDDATA_DLL_OK))
2384 {
2385 __try
2386 {
2387 ret = (*ptr_ccddata_eg_comendpoints[me])(idx);
2388 }
2389 __except(EXCEPTION_EXECUTE_HANDLER)
2390 {
2391 // acces violation -> possibly wrong ccddata-DLL
2392 }
2393 }
2394 ReleaseMutex (mut[me]);
2395 return ret;
2396 }
2397
2398 /* cde_init =================================================================*/
2399 void cde_init (void)
2400 {
2401 if (me < 0)
2402 {
2403 return;
2404 }
2405 WaitForSingleObject (mut[me], INFINITE);
2406 if ((ptr_cde_init[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
2407 {
2408 __try
2409 {
2410 (*ptr_cde_init[me])();
2411 }
2412 __except(EXCEPTION_EXECUTE_HANDLER)
2413 {
2414 // acces violation -> possibly wrong ccddata-DLL
2415 }
2416 }
2417 ReleaseMutex (mut[me]);
2418 }
2419
2420 /* cde_get_comp =============================================================*/
2421 USHORT cde_get_comp (T_CCDE_HANDLE* chandle,
2422 T_CCDE_ELEM_DESCR* edescr)
2423 {
2424 USHORT ret = CCDEDIT_DLL_ERROR;
2425 if (me < 0)
2426 {
2427 return ret;
2428 }
2429 WaitForSingleObject (mut[me], INFINITE);
2430 if ((ptr_cde_get_comp[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
2431 {
2432 __try
2433 {
2434 ret = (*ptr_cde_get_comp[me])(chandle, edescr);
2435 }
2436 __except(EXCEPTION_EXECUTE_HANDLER)
2437 {
2438 // acces violation -> possibly wrong ccddata-DLL
2439 }
2440 }
2441 ReleaseMutex (mut[me]);
2442 return ret;
2443 }
2444
2445 /* cde_prim_first ===========================================================*/
2446 USHORT cde_prim_first (T_CCDE_HANDLE * phandle,
2447 ULONG primcode,
2448 char * name)
2449 {
2450 USHORT ret = CCDEDIT_DLL_ERROR;
2451 if (me < 0)
2452 {
2453 return ret;
2454 }
2455 WaitForSingleObject (mut[me], INFINITE);
2456 if ((ptr_cde_prim_first[me] != NULL) ||
2457 (ccddata_ehandler() == CCDDATA_DLL_OK))
2458 {
2459 __try
2460 {
2461 ret = (*ptr_cde_prim_first[me])(phandle, primcode, name);
2462 }
2463 __except(EXCEPTION_EXECUTE_HANDLER)
2464 {
2465 // acces violation -> possibly wrong ccddata-DLL
2466 }
2467 }
2468 ReleaseMutex (mut[me]);
2469 return ret;
2470 }
2471
2472 /* cde_prim_next ============================================================*/
2473 USHORT cde_prim_next (T_CCDE_HANDLE *phandle,
2474 UBYTE descent,
2475 T_CCDE_ELEM_DESCR *pdescr)
2476 {
2477 USHORT ret = CCDEDIT_DLL_ERROR;
2478 if (me < 0)
2479 {
2480 return ret;
2481 }
2482 WaitForSingleObject (mut[me], INFINITE);
2483 if ((ptr_cde_prim_next[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
2484 {
2485 __try
2486 {
2487 ret = (*ptr_cde_prim_next[me])(phandle, descent, pdescr);
2488 }
2489 __except(EXCEPTION_EXECUTE_HANDLER)
2490 {
2491 // acces violation -> possibly wrong ccddata-DLL
2492 }
2493 }
2494 ReleaseMutex (mut[me]);
2495 return ret;
2496 }
2497
2498 /* cde_msg_first ============================================================*/
2499 USHORT cde_msg_first (T_CCDE_HANDLE * mhandle,
2500 UBYTE type,
2501 UBYTE direction,
2502 UBYTE entity,
2503 char * name)
2504
2505 {
2506 USHORT ret = CCDEDIT_DLL_ERROR;
2507 if (me < 0)
2508 {
2509 return ret;
2510 }
2511 WaitForSingleObject (mut[me], INFINITE);
2512 if ((ptr_cde_msg_first[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
2513 {
2514 __try
2515 {
2516 ret = (*ptr_cde_msg_first[me])(mhandle, type, direction, entity, name);
2517 }
2518 __except(EXCEPTION_EXECUTE_HANDLER)
2519 {
2520 // acces violation -> possibly wrong ccddata-DLL
2521 }
2522 }
2523 ReleaseMutex (mut[me]);
2524 return ret;
2525 }
2526
2527 /* cde_msg_next =============================================================*/
2528 USHORT cde_msg_next (T_CCDE_HANDLE *mhandle,
2529 UBYTE descent,
2530 T_CCDE_ELEM_DESCR *iedescr)
2531 {
2532 USHORT ret = CCDEDIT_DLL_ERROR;
2533 if (me < 0)
2534 {
2535 return ret;
2536 }
2537 WaitForSingleObject (mut[me], INFINITE);
2538 if ((ptr_cde_msg_next[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
2539 {
2540 __try
2541 {
2542 ret = (*ptr_cde_msg_next[me])(mhandle, descent, iedescr);
2543 }
2544 __except(EXCEPTION_EXECUTE_HANDLER)
2545 {
2546 // acces violation -> possibly wrong ccddata-DLL
2547 }
2548 }
2549 ReleaseMutex (mut[me]);
2550 return ret;
2551 }
2552
2553 /* cde_comp_first ===========================================================*/
2554 USHORT cde_comp_first (T_CCDE_HANDLE * chandle,
2555 T_ELM_SRC source,
2556 char * compname)
2557
2558 {
2559 USHORT ret = CCDEDIT_DLL_ERROR;
2560 if (me < 0)
2561 {
2562 return ret;
2563 }
2564 WaitForSingleObject (mut[me], INFINITE);
2565 if ((ptr_cde_comp_first[me] != NULL) ||
2566 (ccddata_ehandler() == CCDDATA_DLL_OK))
2567 {
2568 __try
2569 {
2570 ret = (*ptr_cde_comp_first[me])(chandle, source, compname);
2571 }
2572 __except(EXCEPTION_EXECUTE_HANDLER)
2573 {
2574 // acces violation -> possibly wrong ccddata-DLL
2575 }
2576 }
2577 ReleaseMutex (mut[me]);
2578 return ret;
2579 }
2580
2581 /* cde_comp_next ============================================================*/
2582 USHORT cde_comp_next (T_CCDE_HANDLE *chandle,
2583 UBYTE descent,
2584 T_CCDE_ELEM_DESCR *descr)
2585 {
2586 USHORT ret = CCDEDIT_DLL_ERROR;
2587 if (me < 0)
2588 {
2589 return ret;
2590 }
2591 WaitForSingleObject (mut[me], INFINITE);
2592 if ((ptr_cde_comp_next[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
2593 {
2594 __try
2595 {
2596 ret = (*ptr_cde_comp_next[me])(chandle, descent, descr);
2597 }
2598 __except(EXCEPTION_EXECUTE_HANDLER)
2599 {
2600 // acces violation -> possibly wrong ccddata-DLL
2601 }
2602 }
2603 ReleaseMutex (mut[me]);
2604 return ret;
2605 }
2606
2607 /* cde_get_symval ===========================================================*/
2608 char* cde_get_symval (int elem_value, T_CCDE_ELEM_DESCR* edescr)
2609 {
2610 char* ret = NULL;
2611 if (me < 0)
2612 {
2613 return ret;
2614 }
2615 WaitForSingleObject (mut[me], INFINITE);
2616 if ((ptr_cde_get_symval[me] != NULL) ||
2617 (ccddata_ehandler() == CCDDATA_DLL_OK))
2618 {
2619 __try
2620 {
2621 ret = (*ptr_cde_get_symval[me])(elem_value, edescr);
2622 }
2623 __except(EXCEPTION_EXECUTE_HANDLER)
2624 {
2625 // acces violation -> possibly wrong ccddata-DLL
2626 }
2627 }
2628 ReleaseMutex (mut[me]);
2629 return ret;
2630 }
2631
2632 /* cde_read_elem ============================================================*/
2633 USHORT cde_read_elem (T_CCDE_HANDLE * handle,
2634 void * cstruct,
2635 T_CCDE_ELEM_DESCR * edescr,
2636 UBYTE * value)
2637 {
2638 USHORT ret = CCDEDIT_DLL_ERROR;
2639 if (me < 0)
2640 {
2641 return ret;
2642 }
2643 WaitForSingleObject (mut[me], INFINITE);
2644 if ((ptr_cde_read_elem[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
2645 {
2646 __try
2647 {
2648 ret = (*ptr_cde_read_elem[me])(handle, cstruct, edescr, value);
2649 }
2650 __except(EXCEPTION_EXECUTE_HANDLER)
2651 {
2652 // acces violation -> possibly wrong ccddata-DLL
2653 }
2654 }
2655 ReleaseMutex (mut[me]);
2656 return ret;
2657 }
2658
2659 /* cde_write_prepare ========================================================*/
2660 void cde_write_prepare (T_CCDE_HANDLE * handle,
2661 void * cstruct,
2662 T_CCDE_ELEM_DESCR * edescr)
2663 {
2664 if (me < 0)
2665 {
2666 return;
2667 }
2668 WaitForSingleObject (mut[me], INFINITE);
2669 if ((ptr_cde_write_prepare[me] != NULL) ||
2670 (ccddata_ehandler() == CCDDATA_DLL_OK))
2671 {
2672 (*ptr_cde_write_prepare[me])(handle, cstruct, edescr);
2673 }
2674 ReleaseMutex (mut[me]);
2675 }
2676
2677 /* cde_write_elem ===========================================================*/
2678 USHORT cde_write_elem (T_CCDE_HANDLE * handle,
2679 void * cstruct,
2680 T_CCDE_ELEM_DESCR * edescr,
2681 UBYTE * value)
2682 {
2683 USHORT ret = CCDEDIT_DLL_ERROR;
2684 if (me < 0)
2685 {
2686 return ret;
2687 }
2688 WaitForSingleObject (mut[me], INFINITE);
2689 if ((ptr_cde_write_elem[me] != NULL) ||
2690 (ccddata_ehandler() == CCDDATA_DLL_OK))
2691 {
2692 __try
2693 {
2694 ret = (*ptr_cde_write_elem[me])(handle, cstruct, edescr, value);
2695 }
2696 __except(EXCEPTION_EXECUTE_HANDLER)
2697 {
2698 // acces violation -> possibly wrong ccddata-DLL
2699 }
2700 }
2701 ReleaseMutex (mut[me]);
2702 return ret;
2703 }
2704
2705 /* cde_get_type ===========================================================*/
2706 USHORT cde_get_type (char *name,
2707 T_ELM_SRC *type)
2708 {
2709 USHORT ret = CCDEDIT_DLL_ERROR;
2710 if (me < 0)
2711 {
2712 return ret;
2713 }
2714 WaitForSingleObject (mut[me], INFINITE);
2715 if ((ptr_cde_get_type[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
2716 {
2717 __try
2718 {
2719 ret = (*ptr_cde_get_type[me])(name, type);
2720 }
2721 __except(EXCEPTION_EXECUTE_HANDLER)
2722 {
2723 // acces violation -> possibly wrong ccddata-DLL
2724 }
2725 }
2726 ReleaseMutex (mut[me]);
2727 return ret;
2728 }
2729
2730 /* cde_get_primcode =========================================================*/
2731 USHORT cde_get_primcode (char *name,
2732 ULONG *primcode)
2733 {
2734 USHORT ret = CCDEDIT_DLL_ERROR;
2735 if (me < 0)
2736 {
2737 return ret;
2738 }
2739 WaitForSingleObject (mut[me], INFINITE);
2740 if ((ptr_cde_get_primcode[me] != NULL) ||
2741 (ccddata_ehandler() == CCDDATA_DLL_OK))
2742 {
2743 __try
2744 {
2745 ret = (*ptr_cde_get_primcode[me])(name, primcode);
2746 }
2747 __except(EXCEPTION_EXECUTE_HANDLER)
2748 {
2749 // acces violation -> possibly wrong ccddata-DLL
2750 }
2751 }
2752 ReleaseMutex (mut[me]);
2753 return ret;
2754 }
2755
2756 /* cde_get_msgcode ==========================================================*/
2757 USHORT cde_get_msgcode (char *name,
2758 UBYTE *type,
2759 UBYTE *direction,
2760 UBYTE *entity)
2761 {
2762 USHORT ret = CCDEDIT_DLL_ERROR;
2763 if (me < 0)
2764 {
2765 return ret;
2766 }
2767 WaitForSingleObject (mut[me], INFINITE);
2768 if ((ptr_cde_get_msgcode[me] != NULL) ||
2769 (ccddata_ehandler() == CCDDATA_DLL_OK))
2770 {
2771 __try
2772 {
2773 ret = (*ptr_cde_get_msgcode[me])(name, type, direction, entity);
2774 }
2775 __except(EXCEPTION_EXECUTE_HANDLER)
2776 {
2777 // acces violation -> possibly wrong ccddata-DLL
2778 }
2779 }
2780 ReleaseMutex (mut[me]);
2781 return ret;
2782 }
2783
2784 /* cde_get_is_downlink ======================================================*/
2785 int cde_get_is_downlink (ULONG comp_index)
2786 {
2787 int ret = CCDEDIT_DLL_ERROR;
2788 if (me < 0)
2789 {
2790 return ret;
2791 }
2792 WaitForSingleObject (mut[me], INFINITE);
2793 if ((ptr_cde_get_is_downlink[me] != NULL) ||
2794 (ccddata_ehandler() == CCDDATA_DLL_OK))
2795 {
2796 __try
2797 {
2798 ret = (*ptr_cde_get_is_downlink[me])(comp_index);
2799 }
2800 __except(EXCEPTION_EXECUTE_HANDLER)
2801 {
2802 // acces violation -> possibly wrong ccddata-DLL
2803 }
2804 }
2805 ReleaseMutex (mut[me]);
2806 return ret;
2807 }
2808
2809 /* cde_get_comp_index =======================================================*/
2810 ULONG cde_get_comp_index (char* comp_name, T_ELM_SRC table)
2811 {
2812 ULONG ret = CCDEDIT_DLL_ERROR;
2813 if (me < 0)
2814 {
2815 return ret;
2816 }
2817 WaitForSingleObject (mut[me], INFINITE);
2818 if ((ptr_cde_get_comp_index[me] != NULL) ||
2819 (ccddata_ehandler() == CCDDATA_DLL_OK))
2820 {
2821 __try
2822 {
2823 ret = (*ptr_cde_get_comp_index[me])(comp_name, table);
2824 }
2825 __except(EXCEPTION_EXECUTE_HANDLER)
2826 {
2827 // acces violation -> possibly wrong ccddata-DLL
2828 }
2829 }
2830 ReleaseMutex (mut[me]);
2831 return ret;
2832 }
2833
2834 /* cde_get_element_name =====================================================*/
2835 char* cde_get_element_name (ULONG comp_index, USHORT elem_off, T_ELM_SRC table)
2836 {
2837 char* ret = NULL;
2838 if (me < 0)
2839 {
2840 return ret;
2841 }
2842 WaitForSingleObject (mut[me], INFINITE);
2843 if ((ptr_cde_get_element_name[me] != NULL) ||
2844 (ccddata_ehandler() == CCDDATA_DLL_OK))
2845 {
2846 __try
2847 {
2848 ret = (*ptr_cde_get_element_name[me])(comp_index, elem_off, table);
2849 }
2850 __except(EXCEPTION_EXECUTE_HANDLER)
2851 {
2852 // acces violation -> possibly wrong ccddata-DLL
2853 }
2854 }
2855 ReleaseMutex (mut[me]);
2856 return ret;
2857 }
2858
2859 /* cde_get_array_kind =======================================================*/
2860 ULONG cde_get_array_kind (char* var_name, T_ELM_SRC table)
2861 {
2862 ULONG ret = (ULONG)CCDEDIT_ERROR;
2863 if (me < 0)
2864 {
2865 return ret;
2866 }
2867 WaitForSingleObject (mut[me], INFINITE);
2868 if ((ptr_cde_get_array_kind[me] != NULL) ||
2869 (ccddata_ehandler() == CCDDATA_DLL_OK))
2870 {
2871 __try
2872 {
2873 ret = (*ptr_cde_get_array_kind[me])(var_name, table);
2874 }
2875 __except(EXCEPTION_EXECUTE_HANDLER)
2876 {
2877 // acces violation -> possibly wrong ccddata-DLL
2878 }
2879 }
2880 ReleaseMutex (mut[me]);
2881 return ret;
2882 }
2883
2884 /* ccd_set_patch_infos ======================================================*/
2885 int ccd_set_patch_infos (T_patch_info* pinfo)
2886 {
2887 int ret = CCD_DLL_ERROR;
2888 if (me < 0)
2889 {
2890 return ret;
2891 }
2892 WaitForSingleObject (mut[me], INFINITE);
2893 if ((ptr_ccd_set_patch_infos[me] != NULL) ||
2894 (ccddata_ehandler() == CCDDATA_DLL_OK))
2895 {
2896 __try
2897 {
2898 ret = (*ptr_ccd_set_patch_infos[me])(pinfo);
2899 }
2900 __except(EXCEPTION_EXECUTE_HANDLER)
2901 {
2902 // acces violation -> possibly wrong ccddata-DLL
2903 }
2904 }
2905 ReleaseMutex (mut[me]);
2906 return ret;
2907 }
2908
2909 /* ccd_init =================================================================*/
2910 BYTE ccd_init (void)
2911 {
2912 BYTE ret = CCD_DLL_ERROR;
2913 if (me < 0)
2914 {
2915 return ret;
2916 }
2917 WaitForSingleObject (mut[me], INFINITE);
2918 if ((ptr_ccd_init[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
2919 {
2920 __try
2921 {
2922 ret = (*ptr_ccd_init[me])();
2923 }
2924 __except(EXCEPTION_EXECUTE_HANDLER)
2925 {
2926 // acces violation -> possibly wrong ccddata-DLL
2927 }
2928 }
2929 ReleaseMutex (mut[me]);
2930 return ret;
2931 }
2932
2933 /* ccd_exit =================================================================*/
2934 int ccd_exit (void)
2935 {
2936 int ret = CCD_DLL_ERROR;
2937 if (me < 0)
2938 {
2939 return ret;
2940 }
2941 WaitForSingleObject (mut[me], INFINITE);
2942 if ((ptr_ccd_exit[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
2943 {
2944 __try
2945 {
2946 ret = (*ptr_ccd_exit[me])();
2947 }
2948 __except(EXCEPTION_EXECUTE_HANDLER)
2949 {
2950 // acces violation -> possibly wrong ccddata-DLL
2951 }
2952 }
2953 ReleaseMutex (mut[me]);
2954 return ret;
2955 }
2956
2957 /* ccd_begin ================================================================*/
2958 UBYTE* ccd_begin (void)
2959 {
2960 UBYTE* ret = NULL;
2961 if (me < 0)
2962 {
2963 return ret;
2964 }
2965 WaitForSingleObject (mut[me], INFINITE);
2966 if ((ptr_ccd_begin[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
2967 {
2968 __try
2969 {
2970 ret = (*ptr_ccd_begin[me])();
2971 }
2972 __except(EXCEPTION_EXECUTE_HANDLER)
2973 {
2974 // acces violation -> possibly wrong ccddata-DLL
2975 }
2976 }
2977 ReleaseMutex (mut[me]);
2978 return ret;
2979 }
2980
2981 /* ccd_end ==================================================================*/
2982 void ccd_end (void)
2983 {
2984 if (me < 0)
2985 {
2986 return;
2987 }
2988 WaitForSingleObject (mut[me], INFINITE);
2989 if ((ptr_ccd_end[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
2990 {
2991 (*ptr_ccd_end[me])();
2992 }
2993 ReleaseMutex (mut[me]);
2994 }
2995
2996 /* ccd_decodeMsg ============================================================*/
2997 BYTE ccd_decodeMsg (UBYTE entity,
2998 UBYTE direction,
2999 T_MSGBUF *mBuf,
3000 UBYTE *mStruct,
3001 UBYTE mId)
3002 {
3003 BYTE ret = CCD_DLL_ERROR;
3004 if (me < 0)
3005 {
3006 return ret;
3007 }
3008 WaitForSingleObject (mut[me], INFINITE);
3009 if ((ptr_ccd_decodeMsg[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
3010 {
3011 __try
3012 {
3013 ret = (*ptr_ccd_decodeMsg[me])(entity, direction, mBuf, mStruct, mId);
3014 }
3015 __except(EXCEPTION_EXECUTE_HANDLER)
3016 {
3017 // acces violation -> possibly wrong ccddata-DLL
3018 }
3019 }
3020 ReleaseMutex (mut[me]);
3021 return ret;
3022 }
3023
3024 /* ccd_decodeMsgPtr =========================================================*/
3025 S8 ccd_decodeMsgPtr (U8 entity,
3026 U8 direction,
3027 U16 l_buf,
3028 U16 o_buf,
3029 U8* buf,
3030 U8** mStructPtr,
3031 U8 mId)
3032 {
3033 S8 ret = CCD_DLL_ERROR;
3034 if (me < 0)
3035 {
3036 return ret;
3037 }
3038 WaitForSingleObject (mut[me], INFINITE);
3039 if ((ptr_ccd_decodeMsgPtr[me] != NULL) ||
3040 (ccddata_ehandler() == CCDDATA_DLL_OK))
3041 {
3042 __try
3043 {
3044 ret = (*ptr_ccd_decodeMsgPtr[me])(entity, direction, l_buf, o_buf, buf,
3045 mStructPtr, mId);
3046 }
3047 __except(EXCEPTION_EXECUTE_HANDLER)
3048 {
3049 // acces violation -> possibly wrong ccddata-DLL
3050 }
3051 }
3052 ReleaseMutex (mut[me]);
3053 return ret;
3054 }
3055
3056 /* ccd_codeMsg ========================)=====================================*/
3057 BYTE ccd_codeMsg (UBYTE entity,
3058 UBYTE direction,
3059 T_MSGBUF *mBuf,
3060 UBYTE *mStruct,
3061 UBYTE mId)
3062 {
3063 BYTE ret = CCD_DLL_ERROR;
3064 if (me < 0)
3065 {
3066 return ret;
3067 }
3068 WaitForSingleObject (mut[me], INFINITE);
3069 if ((ptr_ccd_codeMsg[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
3070 {
3071 __try
3072 {
3073 ret = (*ptr_ccd_codeMsg[me])(entity, direction, mBuf, mStruct, mId);
3074 }
3075 __except(EXCEPTION_EXECUTE_HANDLER)
3076 {
3077 // acces violation -> possibly wrong ccddata-DLL
3078 }
3079 }
3080 ReleaseMutex (mut[me]);
3081 return ret;
3082 }
3083
3084 /* ccd_codeMsgPtr =========================)=================================*/
3085 S8 ccd_codeMsgPtr(U8 entity,
3086 U8 direction,
3087 U16* l_buf,
3088 U16 o_buf,
3089 U8* buf,
3090 U8* mStruct,
3091 U8 mId)
3092 {
3093 S8 ret = CCD_DLL_ERROR;
3094 if (me < 0)
3095 {
3096 return ret;
3097 }
3098 WaitForSingleObject (mut[me], INFINITE);
3099 if ((ptr_ccd_codeMsgPtr[me] != NULL) ||
3100 (ccddata_ehandler() == CCDDATA_DLL_OK))
3101 {
3102 __try
3103 {
3104 ret = (*ptr_ccd_codeMsgPtr[me])(entity, direction, l_buf, o_buf, buf,
3105 mStruct, mId);
3106 }
3107 __except(EXCEPTION_EXECUTE_HANDLER)
3108 {
3109 // acces violation -> possibly wrong ccddata-DLL
3110 }
3111 }
3112 ReleaseMutex (mut[me]);
3113 return ret;
3114 }
3115
3116 /* ccd_init_ccddata =========================================================*/
3117 ULONG ccd_init_ccddata (void)
3118 {
3119 ULONG ret = CCD_DLL_ERROR;
3120 if (me < 0)
3121 {
3122 return ret;
3123 }
3124 WaitForSingleObject (mut[me], INFINITE);
3125 if ((ptr_ccd_init_ccddata[me] != NULL) ||
3126 (ccddata_ehandler() == CCDDATA_DLL_OK))
3127 {
3128 __try
3129 {
3130 ret = (*ptr_ccd_init_ccddata[me])();
3131 }
3132 __except(EXCEPTION_EXECUTE_HANDLER)
3133 {
3134 // acces violation -> possibly wrong ccddata-DLL
3135 }
3136 }
3137 ReleaseMutex (mut[me]);
3138 return ret;
3139 }
3140
3141 /* ccd_decodeByte ===========================================================*/
3142 BYTE ccd_decodeByte (UBYTE* bitstream, USHORT startbit,
3143 USHORT bitlen, UBYTE* value)
3144 {
3145 BYTE ret = CCD_DLL_ERROR;
3146 if (me < 0)
3147 {
3148 return ret;
3149 }
3150 WaitForSingleObject (mut[me], INFINITE);
3151 if ((ptr_ccd_decodeByte[me] != NULL) ||
3152 (ccddata_ehandler() == CCDDATA_DLL_OK))
3153 {
3154 __try
3155 {
3156 ret = (*ptr_ccd_decodeByte[me])(bitstream, startbit, bitlen, value);
3157 }
3158 __except(EXCEPTION_EXECUTE_HANDLER)
3159 {
3160 // acces violation -> possibly wrong ccddata-DLL
3161 }
3162 }
3163 ReleaseMutex (mut[me]);
3164 return ret;
3165 }
3166
3167 /* ccd_codeByte =============================)===============================*/
3168 BYTE ccd_codeByte (UBYTE* bitstream, USHORT startbit,
3169 USHORT bitlen, UBYTE value)
3170 {
3171 BYTE ret = CCD_DLL_ERROR;
3172 if (me < 0)
3173 {
3174 return ret;
3175 }
3176 WaitForSingleObject (mut[me], INFINITE);
3177 if ((ptr_ccd_codeByte[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
3178 {
3179 __try
3180 {
3181 ret = (*ptr_ccd_codeByte[me])(bitstream, startbit, bitlen, value);
3182 }
3183 __except(EXCEPTION_EXECUTE_HANDLER)
3184 {
3185 // acces violation -> possibly wrong ccddata-DLL
3186 }
3187 }
3188 ReleaseMutex (mut[me]);
3189 return ret;
3190 }
3191
3192 /* ccd_codeLong ===)=========================================================*/
3193 BYTE ccd_codeLong (UBYTE* bitstream, USHORT startbit,
3194 USHORT bitlen, ULONG value)
3195 {
3196 BYTE ret = CCD_DLL_ERROR;
3197 if (me < 0)
3198 {
3199 return ret;
3200 }
3201 WaitForSingleObject (mut[me], INFINITE);
3202 if ((ptr_ccd_codeLong[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
3203 {
3204 __try
3205 {
3206 ret = (*ptr_ccd_codeLong[me])(bitstream, startbit, bitlen, value);
3207 }
3208 __except(EXCEPTION_EXECUTE_HANDLER)
3209 {
3210 // acces violation -> possibly wrong ccddata-DLL
3211 }
3212 }
3213 ReleaseMutex (mut[me]);
3214 return ret;
3215 }
3216
3217 /* ccd_decodeLong ===========================================================*/
3218 BYTE ccd_decodeLong (UBYTE* bitstream, USHORT startbit,
3219 USHORT bitlen, ULONG *value)
3220 {
3221 BYTE ret = CCD_DLL_ERROR;
3222 if (me < 0)
3223 {
3224 return ret;
3225 }
3226 WaitForSingleObject (mut[me], INFINITE);
3227 if ((ptr_ccd_decodeLong[me] != NULL) ||
3228 (ccddata_ehandler() == CCDDATA_DLL_OK))
3229 {
3230 __try
3231 {
3232 ret = (*ptr_ccd_decodeLong[me])(bitstream, startbit, bitlen, value);
3233 }
3234 __except(EXCEPTION_EXECUTE_HANDLER)
3235 {
3236 // acces violation -> possibly wrong ccddata-DLL
3237 }
3238 }
3239 ReleaseMutex (mut[me]);
3240 return ret;
3241 }
3242
3243 /* ccd_bitcopy ============================)=================================*/
3244 void ccd_bitcopy (UBYTE *dest,
3245 UBYTE *source,
3246 USHORT bitlen,
3247 USHORT offset)
3248 {
3249 if (me < 0)
3250 {
3251 return;
3252 }
3253 WaitForSingleObject (mut[me], INFINITE);
3254 if ((ptr_ccd_bitcopy[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
3255 {
3256 __try
3257 {
3258 (*ptr_ccd_bitcopy[me])(dest, source, bitlen, offset);
3259 }
3260 __except(EXCEPTION_EXECUTE_HANDLER)
3261 {
3262 // acces violation -> possibly wrong ccddata-DLL
3263 }
3264 }
3265 ReleaseMutex (mut[me]);
3266 }
3267
3268 /* ccd_getFirstError ========================================================*/
3269 UBYTE ccd_getFirstError (UBYTE entity, USHORT *parlist)
3270 {
3271 UBYTE ret = CCD_DLL_ERROR;
3272 if (me < 0)
3273 {
3274 return ret;
3275 }
3276 WaitForSingleObject (mut[me], INFINITE);
3277 if ((ptr_ccd_getFirstError[me] != NULL) ||
3278 (ccddata_ehandler() == CCDDATA_DLL_OK))
3279 {
3280 __try
3281 {
3282 ret = (*ptr_ccd_getFirstError[me])(entity, parlist);
3283 }
3284 __except(EXCEPTION_EXECUTE_HANDLER)
3285 {
3286 // acces violation -> possibly wrong ccddata-DLL
3287 }
3288 }
3289 ReleaseMutex (mut[me]);
3290 return ret;
3291 }
3292
3293 /* ccd_getNextError =========================================================*/
3294 UBYTE ccd_getNextError (UBYTE entity, USHORT *parlist)
3295 {
3296 UBYTE ret = CCD_DLL_ERROR;
3297 if (me < 0)
3298 {
3299 return ret;
3300 }
3301 WaitForSingleObject (mut[me], INFINITE);
3302 if ((ptr_ccd_getNextError[me] != NULL) ||
3303 (ccddata_ehandler() == CCDDATA_DLL_OK))
3304 {
3305 __try
3306 {
3307 ret = (*ptr_ccd_getNextError[me])(entity, parlist);
3308 }
3309 __except(EXCEPTION_EXECUTE_HANDLER)
3310 {
3311 // acces violation -> possibly wrong ccddata-DLL
3312 }
3313 }
3314 ReleaseMutex (mut[me]);
3315 return ret;
3316 }
3317
3318 /* ccd_getFirstFault ========================================================*/
3319 ULONG ccd_getFirstFault (T_CCD_ERR_ENTRY **ccd_err_entry)
3320 {
3321 ULONG ret = CCD_DLL_ERROR;
3322 if (me < 0)
3323 {
3324 return ret;
3325 }
3326 WaitForSingleObject (mut[me], INFINITE);
3327 if ((ptr_ccd_getFirstFault[me] != NULL) ||
3328 (ccddata_ehandler() == CCDDATA_DLL_OK))
3329 {
3330 __try
3331 {
3332 ret = (*ptr_ccd_getFirstFault[me])(ccd_err_entry);
3333 }
3334 __except(EXCEPTION_EXECUTE_HANDLER)
3335 {
3336 // acces violation -> possibly wrong ccddata-DLL
3337 }
3338 }
3339 ReleaseMutex (mut[me]);
3340 return ret;
3341 }
3342
3343 /* ccd_getNextFault =========================================================*/
3344 ULONG ccd_getNextFault (T_CCD_ERR_ENTRY **ccd_err_entry)
3345 {
3346 ULONG ret = CCD_DLL_ERROR;
3347 if (me < 0)
3348 {
3349 return ret;
3350 }
3351 WaitForSingleObject (mut[me], INFINITE);
3352 if ((ptr_ccd_getNextFault[me] != NULL) ||
3353 (ccddata_ehandler() == CCDDATA_DLL_OK))
3354 {
3355 __try
3356 {
3357 ret = (*ptr_ccd_getNextFault[me])(ccd_err_entry);
3358 }
3359 __except(EXCEPTION_EXECUTE_HANDLER)
3360 {
3361 // acces violation -> possibly wrong ccddata-DLL
3362 }
3363 }
3364 ReleaseMutex (mut[me]);
3365 return ret;
3366 }
3367
3368 /* ccd_free_faultlist =======================================================*/
3369 void ccd_free_faultlist (void)
3370 {
3371 if (me < 0)
3372 {
3373 return;
3374 }
3375 WaitForSingleObject (mut[me], INFINITE);
3376 if ((ptr_ccd_free_faultlist[me] != NULL) ||
3377 (ccddata_ehandler() == CCDDATA_DLL_OK))
3378 {
3379 __try
3380 {
3381 (*ptr_ccd_free_faultlist[me])();
3382 }
3383 __except(EXCEPTION_EXECUTE_HANDLER)
3384 {
3385 // acces violation -> possibly wrong ccddata-DLL
3386 }
3387 }
3388 ReleaseMutex (mut[me]);
3389 }
3390
3391 /* ccd_get_numFaults ========================================================*/
3392 int ccd_get_numFaults ()
3393 {
3394 int ret = CCD_DLL_ERROR;
3395 if (me < 0)
3396 {
3397 return ret;
3398 }
3399 WaitForSingleObject (mut[me], INFINITE);
3400 if ((ptr_ccd_get_numFaults[me] != NULL) ||
3401 (ccddata_ehandler() == CCDDATA_DLL_OK))
3402 {
3403 __try
3404 {
3405 ret = (*ptr_ccd_get_numFaults[me])();
3406 }
3407 __except(EXCEPTION_EXECUTE_HANDLER)
3408 {
3409 // acces violation -> possibly wrong ccddata-DLL
3410 }
3411 }
3412 ReleaseMutex (mut[me]);
3413 return ret;
3414 }
3415
3416 /* ccd_encodeElem ===========================================================*/
3417 int ccd_encodeElem (ULONG ccdid,
3418 USHORT* l_buf,
3419 USHORT o_buf,
3420 UCHAR* buf,
3421 UCHAR* eStruct)
3422 {
3423 int ret = CCD_DLL_ERROR;
3424 if (me < 0)
3425 {
3426 return ret;
3427 }
3428 WaitForSingleObject (mut[me], INFINITE);
3429 if ((ptr_ccd_encodeElem[me] != NULL) ||
3430 (ccddata_ehandler() == CCDDATA_DLL_OK))
3431 {
3432 __try
3433 {
3434 ret = (*ptr_ccd_encodeElem[me])(ccdid, l_buf, o_buf, buf, eStruct);
3435 }
3436 __except(EXCEPTION_EXECUTE_HANDLER)
3437 {
3438 // acces violation -> possibly wrong ccddata-DLL
3439 }
3440 }
3441 ReleaseMutex (mut[me]);
3442 return ret;
3443 }
3444
3445 /* ccd_decodeElem ===========================================================*/
3446 int ccd_decodeElem (ULONG ccdid,
3447 USHORT l_buf,
3448 USHORT o_buf,
3449 UCHAR* buf,
3450 UCHAR* eStruct)
3451 {
3452 int ret = CCD_DLL_ERROR;
3453 if (me < 0)
3454 {
3455 return ret;
3456 }
3457 WaitForSingleObject (mut[me], INFINITE);
3458 if ((ptr_ccd_decodeElem[me] != NULL) ||
3459 (ccddata_ehandler() == CCDDATA_DLL_OK))
3460 {
3461 __try
3462 {
3463 ret = (*ptr_ccd_decodeElem[me])(ccdid, l_buf, o_buf, buf, eStruct);
3464 }
3465 __except(EXCEPTION_EXECUTE_HANDLER)
3466 {
3467 // acces violation -> possibly wrong ccddata-DLL
3468 }
3469 }
3470 ReleaseMutex (mut[me]);
3471 return ret;
3472 }
3473
3474 /* pdi_createDefContext =====================================================*/
3475 T_PDI_CONTEXT* pdi_createDefContext()
3476 {
3477 T_PDI_CONTEXT* ret = NULL;
3478 if (me < 0)
3479 {
3480 return ret;
3481 }
3482 WaitForSingleObject (mut[me], INFINITE);
3483 if ((ptr_pdi_createDefContext[me] != NULL) ||
3484 (ccddata_ehandler() == CCDDATA_DLL_OK))
3485 {
3486 __try
3487 {
3488 ret = (*ptr_pdi_createDefContext[me])();
3489 }
3490 __except(EXCEPTION_EXECUTE_HANDLER)
3491 {
3492 // acces violation -> possibly wrong ccddata-DLL
3493 }
3494 }
3495 ReleaseMutex (mut[me]);
3496 return ret;
3497 }
3498
3499 /* pdi_createContext ========================================================*/
3500 T_PDI_CONTEXT* pdi_createContext(const T_PDI_DECODEINFO* dinfo,
3501 unsigned int dicount)
3502 {
3503 T_PDI_CONTEXT* ret = NULL;
3504 if (me < 0)
3505 {
3506 return ret;
3507 }
3508 WaitForSingleObject (mut[me], INFINITE);
3509 if ((ptr_pdi_createContext[me] != NULL) ||
3510 (ccddata_ehandler() == CCDDATA_DLL_OK))
3511 {
3512 __try
3513 {
3514 ret = (*ptr_pdi_createContext[me])(dinfo, dicount);
3515 }
3516 __except(EXCEPTION_EXECUTE_HANDLER)
3517 {
3518 // acces violation -> possibly wrong ccddata-DLL
3519 }
3520 }
3521 ReleaseMutex (mut[me]);
3522 return ret;
3523 }
3524
3525 /* pdi_destroyContext =======================================================*/
3526 void pdi_destroyContext(T_PDI_CONTEXT *context)
3527 {
3528 if (me < 0)
3529 {
3530 return;
3531 }
3532 WaitForSingleObject (mut[me], INFINITE);
3533 if ((ptr_pdi_destroyContext[me] != NULL) ||
3534 (ccddata_ehandler() == CCDDATA_DLL_OK))
3535 {
3536 __try
3537 {
3538 (*ptr_pdi_destroyContext[me])(context);
3539 }
3540 __except(EXCEPTION_EXECUTE_HANDLER)
3541 {
3542 // acces violation -> possibly wrong ccddata-DLL
3543 }
3544 }
3545 ReleaseMutex (mut[me]);
3546 }
3547
3548 /* pdi_startPrim ============================================================*/
3549 void pdi_startPrim(T_PDI_CONTEXT *context, ULONG opc)
3550 {
3551 if (me < 0)
3552 {
3553 return;
3554 }
3555 WaitForSingleObject (mut[me], INFINITE);
3556 if ((ptr_pdi_startPrim[me] != NULL) ||
3557 (ccddata_ehandler() == CCDDATA_DLL_OK))
3558 {
3559 __try
3560 {
3561 (*ptr_pdi_startPrim[me])(context, opc);
3562 }
3563 __except(EXCEPTION_EXECUTE_HANDLER)
3564 {
3565 // acces violation -> possibly wrong ccddata-DLL
3566 }
3567 }
3568 ReleaseMutex (mut[me]);
3569 }
3570
3571 /* pdi_getDecodeInfo ========================================================*/
3572 void pdi_getDecodeInfo(T_PDI_CONTEXT *context, const char *ename,
3573 char *evalue, int evlen, T_PDI *decinfo)
3574 {
3575 if (me < 0)
3576 {
3577 return;
3578 }
3579 WaitForSingleObject (mut[me], INFINITE);
3580 if ((ptr_pdi_getDecodeInfo[me] != NULL) ||
3581 (ccddata_ehandler() == CCDDATA_DLL_OK))
3582 {
3583 __try
3584 {
3585 (*ptr_pdi_getDecodeInfo[me])(context, ename, evalue, evlen, decinfo);
3586 }
3587 __except(EXCEPTION_EXECUTE_HANDLER)
3588 {
3589 // acces violation -> possibly wrong ccddata-DLL
3590 }
3591 }
3592 ReleaseMutex (mut[me]);
3593 }
3594
3595 /* pdi_getEntityByPD ========================================================*/
3596 short pdi_getEntityByPD(T_PDI_CONTEXT *context, unsigned char pd)
3597 {
3598 short ret = PDI_DLL_ERROR;
3599 if (me < 0)
3600 {
3601 return ret;
3602 }
3603 WaitForSingleObject (mut[me], INFINITE);
3604 if ((ptr_pdi_getEntityByPD[me] != NULL) ||
3605 (ccddata_ehandler() == CCDDATA_DLL_OK))
3606 {
3607 __try
3608 {
3609 ret = (*ptr_pdi_getEntityByPD[me])(context, pd);
3610 }
3611 __except(EXCEPTION_EXECUTE_HANDLER)
3612 {
3613 // acces violation -> possibly wrong ccddata-DLL
3614 }
3615 }
3616 ReleaseMutex (mut[me]);
3617 return ret;
3618 }
3619
3620 /* pdi_pd2name ==============================================================*/
3621 const char* pdi_pd2name(unsigned char pd)
3622 {
3623 const char* ret = NULL;
3624 if (me < 0)
3625 {
3626 return ret;
3627 }
3628 WaitForSingleObject (mut[me], INFINITE);
3629 if ((ptr_pdi_pd2name[me] != NULL) || (ccddata_ehandler() == CCDDATA_DLL_OK))
3630 {
3631 __try
3632 {
3633 ret = (*ptr_pdi_pd2name[me])(pd);
3634 }
3635 __except(EXCEPTION_EXECUTE_HANDLER)
3636 {
3637 // acces violation -> possibly wrong ccddata-DLL
3638 }
3639 }
3640 ReleaseMutex (mut[me]);
3641 return ret;
3642 }
3643
3644 /*
3645 +------------------------------------------------------------------------------
3646 | Function : ccddata_dllname
3647 +------------------------------------------------------------------------------
3648 | Description : Deliver name of currently loaded dll
3649 |
3650 | Parameters : -
3651 |
3652 | Return : lastdll
3653 +------------------------------------------------------------------------------
3654 */
3655 char* ccddata_dllname (void)
3656 {
3657 return lastdll;
3658 }
3659
3660 /*
3661 +------------------------------------------------------------------------------
3662 | Function : ccddata_exit
3663 +------------------------------------------------------------------------------
3664 | Description : Unload ccddata dll and clean pointer to the functions
3665 |
3666 | Parameters : -
3667 |
3668 | Return : 0 on success, otherwise error code
3669 +------------------------------------------------------------------------------
3670 */
3671
3672 int ccddata_exit (void)
3673 {
3674 if (me < 0)
3675 {
3676 return CCDDATA_DLL_REGISTER;
3677 }
3678
3679 ccddata_detach (me, 1);
3680
3681 CloseHandle (mut[me]);
3682 CloseHandle (initlock);
3683 ptrindex[me] = 0;
3684 me = -1;
3685
3686 return CCDDATA_DLL_OK;
3687 }
3688
3689 /*
3690 +------------------------------------------------------------------------------
3691 | Function : ccddata_init
3692 +------------------------------------------------------------------------------
3693 | Description : Load ccddata dll and initialize pointer to the functions
3694 |
3695 | Parameters : dllname - name of the ccddata dll or NULL
3696 | reload - if set, the ccddata dll will be switched
3697 |
3698 | Return : 0 on success, otherwise error code
3699 +------------------------------------------------------------------------------
3700 */
3701
3702 int ccddata_init (const char* dllname,
3703 int reload,
3704 void (*ccddata_init_notify)(void),
3705 void (*ccddata_exit_notify)(void))
3706 {
3707 int ret = CCDDATA_DLL_OK;
3708
3709 if (cdll[me] && !reload)
3710 {
3711 return CCDDATA_DLL_ALREADY;
3712 }
3713
3714 if ((initlock = ccddata_init_lock ()) == 0)
3715 {
3716 return CCDDATA_DLL_REGISTER;
3717 }
3718
3719 if (ccddata_register () < 0)
3720 {
3721 ret = CCDDATA_DLL_REGISTER;
3722 }
3723 else
3724 {
3725 ccddata_i_notify = ccddata_init_notify;
3726 ccddata_x_notify = ccddata_exit_notify;
3727
3728 if (dllname)
3729 {
3730 /* build full path of DLL */
3731 char name[MAX_PATH+1];
3732 LPTSTR filepart;
3733 DWORD len=SearchPath(
3734 NULL, // pointer to search path
3735 dllname, // pointer to filename
3736 NULL, // pointer to extension
3737 MAX_PATH, // size, in characters, of buffer
3738 name, // pointer to buffer for found filename
3739 &filepart // pointer to pointer to file component
3740 );
3741 if (!len)
3742 {
3743 strcpy(name, dllname);
3744 }
3745
3746 if (!lastdll[0])
3747 {
3748 // no DLL has been loaded yet
3749 reload=1;
3750 }
3751 else if (strcmp (lastdll, name)==0)
3752 {
3753 // the correct DLL is already in use
3754 reload=0;
3755 }
3756
3757 if (reload)
3758 {
3759 // we want to load a new DLL but save the current one ... just in case
3760 char old_dll[MAX_PATH]="";
3761 strcpy (old_dll, lastdll);
3762 strcpy (lastdll, name);
3763 (void) ccddata_detach (me, 1);
3764 ret = ccddata_attach (me);
3765 if (ret == CCDDATA_DLL_OK)
3766 {
3767 // now inform the other applications
3768 (void)ccddata_clean ();
3769 }
3770 else
3771 {
3772 // upps, didn't work
3773 strcpy (lastdll, old_dll);
3774 (void) ccddata_attach (me);
3775 }
3776 }
3777 else
3778 {
3779 // we just attach to the already loaded DLL
3780 ret = ccddata_attach (me);
3781 }
3782
3783 }
3784 }
3785
3786 ReleaseMutex (initlock);
3787
3788 return ret;
3789 }
3790 /*==== END OF FILE ===========================================================*/