Move the sources to trunk
[opencv] / apps / cvenv / include / eicval.h
1 #ifndef EICVALH_
2 #define EICVALH_
3
4 #include <sys/types.h>
5 #include <unistd.h>
6
7 #if !defined(_eic_ptr)
8 #define _eic_ptr
9 typedef struct {void *p, *sp, *ep;} ptr_t;
10 #endif
11
12
13 #ifndef NO_LONG_LONG
14 typedef long long eic_llong;
15 #else
16 typedef long eic_llong;
17 #endif
18
19
20 union VaL {
21   char cval;              /* char value */
22   unsigned char ucval;
23   short sval;             /* short integer val */
24   unsigned short usval;
25   int ival;               /* integer value */
26   unsigned  uival;
27   long lval;              /* long integer */
28   unsigned long ulval;
29
30   /* long longs are not yet supported by ANSI C*/
31
32   eic_llong llval;        /* long long value */
33
34   float fval;            /* float value */
35   double dval;           /* double float value */
36
37   ptr_t p;              /* safe pointer */
38   void *up;             /* unsafe pointer */
39
40   div_t divval;
41   ldiv_t ldivval;
42         
43   int (*func)();             /* function pointer */
44   union VaL (*vfunc)();
45
46   struct symentry_t * sym;/* pointer into symbol table */
47
48   pid_t pid;              /* process ID value */
49   size_t szval;           /* generic size value */
50   ssize_t sszval;         /* POSIX.1 byte count value */
51
52   mode_t mval;            /* mode_t value */
53 #ifdef _NETBSD
54   long offval;            /* file offset position */
55 #else
56   off_t offval;           /* file offset position */
57 #endif
58 };
59
60 typedef union VaL val_t;
61
62
63 typedef struct Label_t {
64     char *name;            /* label name */
65     int loc;               /* label location */
66     struct Label_t *nxt;   /* link to next label in list */
67 } Label_t;
68
69 typedef struct {
70     unsigned opcode;
71     val_t  val;
72     int ext;
73     unsigned short line;
74 }InsT_t;
75
76
77 typedef struct {
78     unsigned int nextinst;  /* next instruction */
79     unsigned int binst;     /* physical size */
80     InsT_t * inst;          /* instructions */
81     char * Filename;        /* file with source code */
82     Label_t * labels;
83     Label_t * gotos;
84     void * parent;         /* used for callbacks */
85     void * prev;           /* used for chaining during reentry and callbacks*/
86 }code_t;
87
88 /* methods for code */
89 #define opcode(C,i)   ((C)->inst[i].opcode)
90 #define setopcode(C,i,y) (opcode(C,i) = y)
91 #define ivalcode(C,i) ((C)->inst[i].val.ival)
92 #define pvalcode(C,i) ((C)->inst[i].val.p.p)
93 #define nextinst(C)   ((C)->nextinst)
94 #define instline(C,i) ((C)->inst[i].line)
95 #define codeName(C)   (C)->Filename
96
97
98 #ifndef EICH_
99 typedef struct AR_t {
100     val_t v;
101     type_expr * type;
102 }AR_t;
103
104 #else
105 typedef struct AR_t {
106     val_t v;
107     void * type;
108 }AR_t;
109 #endif
110
111 #endif
112
113
114