00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef PLINT_PROG_DATA_H
00026 #define PLINT_PROG_DATA_H
00027
00028 #include "share/common.h"
00029 #include "share/defines.h"
00030 #include "share/functions.h"
00031
00032 #include "share/hash.h"
00033 #include "share/cache.h"
00034 #include "share/slot.h"
00035
00036 #include "type.h"
00037
00038 #include <misc/sys.h>
00039
00040 #define PLINT_OUT_LEN (10 + 1 + 2 + 2 * (sizeof(pid_t) + 2 * sizeof(unsigned int)) + 1)
00041
00042
00043 #include "types.h"
00044
00045 #include "block.h"
00046 #define PLINT_RET_MEM (plint->prog.stack.top->block.ret)
00047
00048 #define PLINT_WRAP_GET_EXIT (plint->prog.stack.top->down->block.arg.wrap.exit)
00049 #define PLINT_WRAP_SET_EXIT(__x__) (PLINT_WRAP_GET_EXIT = (__x__))
00050 #define PLINT_WRAP_GET_RET (plint->prog.stack.top->down->block.arg.wrap.ret)
00051 #define PLINT_WRAP_SET_RET(__x__) (PLINT_WRAP_GET_RET = (__x__))
00052 #define PLINT_WRAP_GET_OWN_DATA (plint->prog.stack.top->down->block.arg.wrap.data)
00053 #define PLINT_WRAP_SET_OWN_DATA(__x__) (PLINT_WRAP_GET_OWN_DATA = (__x__))
00054 #define PLINT_WRAP_GET_ABORT_FUNC (plint->prog.stack.top->down->block.arg.wrap.abort)
00055 #define PLINT_WRAP_SET_ABORT_FUNC(__x__) (PLINT_WRAP_GET_ABORT_FUNC = (__x__))
00056 #define PLINT_WRAP_GET_POP_FUNC (plint->prog.stack.top->down->block.arg.wrap.pop)
00057 #define PLINT_WRAP_SET_POP_FUNC(__x__) (PLINT_WRAP_GET_POP_FUNC = (__x__))
00058 #define PLINT_WRAP_GET_CONTROL_FUNC (plint->prog.stack.top->down->block.arg.wrap.control)
00059 #define PLINT_WRAP_SET_CONTROL_FUNC(__x__) (PLINT_WRAP_GET_CONTROL_FUNC = (__x__))
00060
00061
00062
00063 struct _plint_list
00064 {
00065
00066 plint_stack_t home;
00067 plint_list_t next;
00068 hashindex_t name;
00069 plint_mem_t var;
00070
00071 flag_t touch:1;
00072
00073 };
00074
00075 struct _plint_proc
00076 {
00077 hashindex_t name , * args ;
00078 size_t arrity;
00079
00080
00081 #define PROC_SIG_EQU(__x__, __y__) (HASH_INDEX_EQU((__x__).name, (__y__).name) && (__x__).arrity == (__y__).arrity)
00082
00083 };
00084
00085 typedef enum
00086 {
00087
00088 PLINT_FRM_PROC,
00089 PLINT_FRM_METH,
00090 PLINT_FRM_NORM,
00091
00092 } plint_efrm_t;
00093
00094 struct _plint_tree
00095 {
00096 plint_eblk_t blk;
00097 plint_efrm_t frm;
00099 plint_proc_t proc;
00101 plint_tree_t prnt;
00103 flag_t host_id:1;
00104 union {
00105 plint_tree_t d;
00106 plint_tree_t * i;
00107 } host;
00109 plint_tree_t * chlds;
00110 int nchlds;
00112 int flag;
00113
00114
00115
00116
00117
00118
00119
00120 #define PLINT_TREE_NOPRC(__r__) HASH_INDEX_DOBAD((__r__)->proc.name)
00121 #define PLINT_TREE_ISPRC(__r__) (!HASH_INDEX_ISBAD((__r__)->proc.name))
00122 #define PLINT_TREE_ISINS(__r__) ((__r__)->flag & ~(~(unsigned int)0 >> 1))
00123 #define PLINT_TREE_ISPRS(__r__) ((__r__)->flag & ~(~(unsigned int)0 << 1))
00124 #define PLINT_TREE_ISWRP(__r__) ((__r__)->blk == PLINT_BLK_WRAP)
00125
00126
00127
00128 int level;
00130 FILE * file;
00131 char * srcfile;
00133 plint_stack_t top;
00135 slot_key_t user;
00137 };
00138
00139 typedef enum
00140 {
00141
00142 PLINT_INS_INSERT,
00143 PLINT_INS_INCLUD,
00144
00145 } plint_eins_t;
00146
00147 struct _plint_insert
00148 {
00149
00150 plint_eins_t type;
00151 plint_insert_t down;
00152 file_t file;
00153 plint_tree_t point;
00154 char * dir, * base;
00155 int line;
00156 int level;
00157
00158 noref_t count;
00160 };
00161
00162
00163 struct _plint_include
00164 {
00165
00166 plint_insert_t ins;
00167 plint_include_t next;
00168
00169 };
00170
00171
00172 struct _plint_include_stack
00173 {
00174
00175 plint_include_t head;
00176 plint_include_stack_t down;
00177
00178 };
00179
00180
00181 struct _plint_insprnt
00182 {
00183
00184 plint_tree_t insp;
00185 plint_tree_t prnt;
00186 plint_insprnt_t next;
00187
00188 };
00189
00190
00191 struct _plint_stack
00192 {
00193
00194 plint_stack_t up;
00195 plint_stack_t down;
00196 plint_stack_t proc;
00197 plint_list_t head;
00198 size_t count;
00199
00200 #define PLINT_BLOCK__(__s__) ((__s__)->head)
00201 #define PLINT_METH_SELF(__s__) ((__s__)->proc->head->next)
00202 #define PLINT_ARGV (plint->prog.stack.bot->head->next)
00203 #define PLINT_ARGO (plint->prog.stack.bot->head->next->next)
00204
00205 plint_block_t block;
00206 plint_insprnt_t insprnt;
00207
00208 };
00209
00210
00211
00212
00213
00214
00215
00216
00217
00218
00219
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241
00242
00243 __BEGIN_DECLS
00244
00245 inline int plint_tree_user_new(plint_tree_t TREE);
00246 inline int plint_tree_user_del(plint_tree_t TREE, int TYPE);
00247 inline void plint_tree_user_set(plint_tree_t TREE, int TYPE, void * DATA);
00248 inline void * plint_tree_user_get(plint_tree_t TREE, int TYPE);
00249 int plint_tree_user_slot_add(slot_key_t SLOT, plint_tree_t TREE, void * DATA);
00250 int plint_tree_user_slot_rem(slot_key_t SLOT, plint_tree_t TREE);
00251 inline void * plint_tree_user_slot_get(slot_key_t SLOT, plint_tree_t TREE);
00252
00253 void plint_proc_log(FILE * F, plint_tree_t TREE);
00254
00255 inline plint_tree_t plint_tree_non_ins(plint_tree_t TREE);
00256 inline plint_tree_t plint_tree_non_ins_wrp(plint_tree_t TREE);
00257 #define plint_tree_non_wrp_ins plint_tree_non_ins_wrp
00258 inline plint_tree_t plint_tree_host(plint_tree_t TREE);
00259
00260 plint_tree_t plint_proc_lup_sig(plint_tree_t TREE);
00261 int plint_proc_lup_ptr(plint_tree_t TREE);
00262
00263 plint_stack_t plint_stack_block(int);
00264
00265 __END_DECLS
00266
00267
00268 #endif