CGM Objects Library
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
CgmDecode.h
1 
2 #if !defined(CGMIDECODE_H_INCLUDED)
3 #define CGMIDECODE_H_INCLUDED
4 
7 
8 #pragma once
9 
10 #ifdef WIN32
11 #define WCSICMP(s1,s2) wcsicmp(s1,s2)
12 #else
13 #ifndef ANDROID_NDK
14 #define WCSICMP(s1,s2) wcscasecmp(s1,s2)
15 #else
16 extern "C" int mywcsicmp(wchar_t *s1, wchar_t *s2);
17 #define WCSICMP(s1,s2) mywcsicmp(s1,s2)
18 #endif
19 #endif
20 
21 namespace Larson
22 {
23  // character encoding type
24  #define CHR_ASCII 1
25  #define CHR_UTF8 2
26  #define CHR_UTF16 3
27  #define CHR_UTF32 4
28 
29  #define NAME_PRECISION 16
30 
32  #define ix_UNKNOWN -1
33  #define ix_SDR 1
34  #define ix_CI 2
35  #define ix_CD 3
36  #define ix_N 4
37  #define ix_E 5
38  #define ix_I 6
39  /* reserved 7 */
40  #define ix_IF8 8
41  #define ix_IF16 9
42  #define ix_IF32 10
43  #define ix_IX 11
44  #define ix_R 12
45  #define ix_S 13
46  #define ix_SF 14
47  #define ix_VC 15
48  #define ix_VDC 16
49  #define ix_CCO 17
50  #define ix_UI8 18
51  #define ix_UI32 19 /*?*/
52  #define ix_BS 20
53  #define ix_CL 21
54  #define ix_UI16 22
55 
56  #define outSHORT 0
57  #define outINT 1
58  #define outFLOAT 2
59  #define outDOUBLE 3
60  #define outCHAR 4
61  #define outUTF16 5
62  #define outLONG 6
63  //#define lTYPE ((sizeof(long)==4)?outINT:outLONG)
64 
66  #define GABSOLUTE 0
67  #define GSCALED 1
68  #define GFRACTIONAL 2
69  #define GMM 3
70 
71 #ifndef CGMI_DS_STRUCT
72 #define CGMI_DS_STRUCT
73  typedef struct CGMI_DS
75  {
76  unsigned char *data;
77  long count;
78  long cont;
79  long encoding;
80  long nobj;
81  } CGMI_DS;
82 #endif
83 
85  typedef struct CGMI_FMTBL
86  {
87  long vdcType;
90  long intPrecision;
93  long realType;
96  long realPrecision[2];
102  long ixPrecision;
105  long cdPrecision;
108  long ciPrecision;
111  long namePrecision;
115  long sfEncoding;
116  long sEncoding;
117  long cdModel;
125  long cdParts;
126  } CGMI_FMTBL;
127 
128  typedef struct VDC_PRECISIONS
129  {
131  long realType;
133  int realMantissa;
134  } VDC_PRECISIONS;
135 
146  void cgmi_d_ce(unsigned char* cgmp, long *total, long *klass,
147  long *element, long *count, CGMI_DS *cgmi_ds);
148 
150  void cgmi_d_ce_ctx(char elemstr[128], long *klass, long *element);
151 
160  #define cgmi_d_ci(ip,op,cnt,it) cgmi_d_ui(ip, op, cnt, it.ciPrecision)
161  #define cgmi_d_cd(ip,op,cnt,it) cgmi_d_cdi(ip, op, cnt, it.cdPrecision, it.cdParts)
162  #define cgmi_d_ix(ip,op,cnt,it) cgmi_d_si(ip, op, cnt, it.ixPrecision)
163  #define cgmi_d_i(ip,op,cnt,it) cgmi_d_si(ip, op, cnt, it.intPrecision)
164  #define cgmi_d_d(ip,op,cnt,k0) cgmi_d_s(ip, op, cnt, k0)
165  #define cgmi_d_p(ip,op,cnt,it,vdcPrecisions) (cgmi_d_vdc(ip, op, cnt*2, it,vdcPrecisions) / 2)
166 
167 
169 
181  long cgmi_d_co(CGMI_DS **cgmi_ds, unsigned long *op, long cnt, CGMI_FMTBL it, long colorSelectionMode);
182 
192  long cgmi_d_ew(CGMI_DS **cgmi_ds, double *op, long cnt, CGMI_FMTBL it, long ewSpecMode, VDC_PRECISIONS vdcPrecisions);
193 
204  long cgmi_d_fp(CGMI_DS **cgmi_ds, double *op, long cnt, const long *fp);
205 
216  long cgmi_d_fx(CGMI_DS **cgmi_ds, double *op, long cnt, long *fx);
217 
227  long cgmi_d_lw(CGMI_DS **cgmi_ds, double *op, long cnt, CGMI_FMTBL it, long lwSpecmode, VDC_PRECISIONS vdcPrecisions);
228 
238  long cgmi_d_ms(CGMI_DS **cgmi_ds, double *op, long cnt, CGMI_FMTBL it, long msSpecmode, VDC_PRECISIONS vdcPrecisions);
239 
249  long cgmi_d_r(CGMI_DS **cgmi_ds, double *op, long cnt, CGMI_FMTBL it);
250 
264  long cgmi_d_s(CGMI_DS **cgmi_ds, wchar_t *op, long cnt, long *chrtyp);
265 
278  long cgmi_d_sdre(CGMI_DS *cgmi_ds, long n, void **outbfp, long buftyp, CGMI_FMTBL it,
279  long* p_data_type_index, VDC_PRECISIONS vdcPrecisions);
280 
290  long cgmi_d_si(CGMI_DS **cgmi_ds, long *op, long cnt, long si_precision);
291 
301  long cgmi_d_e(CGMI_DS **cgmi_ds, long *op, long cnt, long element);
302 
307  long cgmi_d_bs(CGMI_DS ** cgmi_ds, unsigned char *op);
308 
318  long cgmi_d_ui(CGMI_DS **cgmi_ds, unsigned long *op, long cnt, long ui_precision);
319 
330  long cgmi_d_vdc(CGMI_DS **cgmi_ds, double *op, long cnt, CGMI_FMTBL it, VDC_PRECISIONS vdcPrecisions);
331  /* end of group that returns the number of items decoded */
332 
334  long cgmi_d_cdi(CGMI_DS **cgmi_ds, unsigned long *op, long cnt, long ui_precision, long ui_parts);
335 
340  long cgmi_sulen(CGMI_DS *cgmi_ds);
341 
343  long cgmi_nchars(long length, long encoding);
344 
345  void cgmi_eswab2(long n, short *buf);
346  void cgmi_eswab4(long n, unsigned long *buf);
347  double get_power_of_ten(long exponent, long negative);
348  long getPrecFromInt(unsigned long maxint);
349  long getPrecFromSignedInt(long maxint);
350 };
351 
352 #endif // !defined(CGMIDECODE_H_INCLUDED)
long cgmi_d_s(CGMI_DS **cgmi_ds, wchar_t *op, long cnt, long *chrtyp)
Definition: CgmDecode.cpp:1630
long cgmi_d_fx(CGMI_DS **cgmi_ds, double *op, long cnt, long *fx)
Definition: CgmDecode.cpp:1419
long encoding
Definition: CgmDecode.h:79
long cgmi_d_cdi(CGMI_DS **cgmi_ds, unsigned long *op, long cnt, long ui_precision, long ui_parts)
CGM Utility Decode Color for internal use only.
Definition: CgmDecode.cpp:388
long cgmi_d_bs(CGMI_DS **cgmi_ds, unsigned char *op)
Definition: CgmDecode.cpp:3157
long cont
Definition: CgmDecode.h:78
long cgmi_nchars(long length, long encoding)
determine number of characters in string for this encoding
Definition: CgmDecode.cpp:3381
unsigned char * data
Definition: CgmDecode.h:76
long nobj
Definition: CgmDecode.h:80
long cgmi_sulen(CGMI_DS *cgmi_ds)
Definition: CgmDecode.cpp:3228
struct Larson::CGMI_DS CGMI_DS
decoder data stream structure
decoder data stream structure
Definition: CgmDecode.h:74
long realType
Definition: CgmDecode.h:131
long cgmi_d_r(CGMI_DS **cgmi_ds, double *op, long cnt, CGMI_FMTBL it)
Definition: CgmDecode.cpp:933
long cgmi_d_ew(CGMI_DS **cgmi_ds, double *op, long cnt, CGMI_FMTBL it, long ewSpecMode, VDC_PRECISIONS vdcPrecisions)
Definition: CgmDecode.cpp:2327
long cgmi_d_si(CGMI_DS **cgmi_ds, long *op, long cnt, long si_precision)
Definition: CgmDecode.cpp:440
long cgmi_d_e(CGMI_DS **cgmi_ds, long *op, long cnt, long element)
Definition: CgmDecode.cpp:697
long cgmi_d_vdc(CGMI_DS **cgmi_ds, double *op, long cnt, CGMI_FMTBL it, VDC_PRECISIONS vdcPrecisions)
Definition: CgmDecode.cpp:949
long cgmi_d_sdre(CGMI_DS *cgmi_ds, long n, void **outbfp, long buftyp, CGMI_FMTBL it, long *p_data_type_index, VDC_PRECISIONS vdcPrecisions)
Definition: CgmDecode.cpp:2481
long cgmi_d_co(CGMI_DS **cgmi_ds, unsigned long *op, long cnt, CGMI_FMTBL it, long colorSelectionMode)
this group of functions returns the number of items decoded (note: 1 pt => 2 vdc) ...
Definition: CgmDecode.cpp:2268
long cgmi_d_ui(CGMI_DS **cgmi_ds, unsigned long *op, long cnt, long ui_precision)
Definition: CgmDecode.cpp:165
Definition: CgmDecode.h:128
long cgmi_d_ms(CGMI_DS **cgmi_ds, double *op, long cnt, CGMI_FMTBL it, long msSpecmode, VDC_PRECISIONS vdcPrecisions)
Definition: CgmDecode.cpp:2306
long count
Definition: CgmDecode.h:77
long cgmi_d_lw(CGMI_DS **cgmi_ds, double *op, long cnt, CGMI_FMTBL it, long lwSpecmode, VDC_PRECISIONS vdcPrecisions)
Definition: CgmDecode.cpp:2285
int realExponent
Definition: CgmDecode.h:132
long intPrecision
Definition: CgmDecode.h:130
long cgmi_d_fp(CGMI_DS **cgmi_ds, double *op, long cnt, const long *fp)
Definition: CgmDecode.cpp:1124
void cgmi_d_ce(unsigned char *cgmp, long *total, long *klass, long *element, long *count, CGMI_DS *cgmi_ds)
Definition: CgmDecode.cpp:56
void cgmi_d_ce_ctx(char elemstr[128], long *klass, long *element)
CGM clear text decode class and element.
Definition: CgmDecode.cpp:3442