ceptr
 All Data Structures Files Functions Variables Typedefs Macros Modules Pages
sys_defs.h
Go to the documentation of this file.
1 
9 #ifndef _CEPTR_SYS_DEFS_H
10 #define _CEPTR_SYS_DEFS_H
11 
12 #include "ceptr_types.h"
13 #include "semtable.h"
14 
15 SemTable *G_sem;
16 
17 #define is_sys_symbol(s) (s.context == SYS_CONTEXT)
18 #define is_sys_process(s) (is_process(s) && (s.context == SYS_CONTEXT))
19 #define is_sys_structure(s) (is_structure(s) && (s.context == SYS_CONTEXT))
20 #define is_sys_receptor(s) (is_receptor(s) && (s.context == SYS_CONTEXT))
21 
22 const Structure NULL_SYMBOL;
23 const Process NULL_PROCESS;
24 const Structure NULL_STRUCTURE;
25 
26 Context G_ctx;
27 char * G_label;
28 // helper macros for setting up the base system definitions, these macros are
29 // used in the code generated by base_defs.pl.
30 // Note: symbols that are defined via a Declare line in the source file, cannot be
31 // redefined, and thus are just set using the sYs macro.
32 #define sT(ctx,name,num,...) name = _d_define_structure_v(sem,"" #name "",ctx,num,__VA_ARGS__)
33 #define sTs(ctx,name,def) G_ctx = ctx;G_label=""#name"";name = _d_define_structure(sem,"" #name "",def,ctx);
34 #define sY(ctx,name,str) name = _d_define_symbol(sem,str,"" #name "",ctx)
35 #define sYs(ctx,sym,str) __d_set_symbol_structure(__sem_get_defs(sem,SEM_TYPE_SYMBOL,ctx),sym,str)
36 #define sP(ctx,name,code,intention,...) name = _d_define_process(sem,code,"" #name "",intention,__p_make_signature(__VA_ARGS__),NULL,ctx)
37 #define sPL(ctx,name,code,intention,link_to,link_as,...) name = _d_define_process(sem,code,"" #name "",intention,__p_make_signature(__VA_ARGS__), _t_build(sem,0,PROCESS_LINK,PROCESS_OF_STRUCTURE,link_to,PROCESS_TYPE,link_as,NULL_SYMBOL,NULL_SYMBOL),ctx)
38 
39 #define sT_OR(...) sT_(sem,STRUCTURE_OR,__VA_ARGS__)
40 #define sT_SEQ(...) sT_(sem,STRUCTURE_SEQUENCE,__VA_ARGS__)
41 #define sT_STAR(...) sT_(sem,STRUCTURE_ZERO_OR_MORE,1,__VA_ARGS__)
42 #define sT_PLUS(...) sT_(sem,STRUCTURE_ONE_OR_MORE,1,__VA_ARGS__)
43 #define sT_QMRK(...) sT_(sem,STRUCTURE_ZERO_OR_ONE,1,__VA_ARGS__)
44 #define sT_SYM(sym) _t_news(0,STRUCTURE_SYMBOL,sym)
45 #define sT_PCNT(str) _t_news(0,STRUCTURE_STRUCTURE,str)
46 #define sT_BANG _t_newr(0,STRUCTURE_ANYTHING)
47 
48 #define sProt(ctx,name,def) {_o_add_label("" #name "",def);name = _d_define_protocol(sem,def,ctx);}
49 #define sData(ctx,name,...) T *name=_t_build2(sem,0,__VA_ARGS__);
50 #define sLabel(ctx,s,label_type,label) _sem_add_label(sem,s,label_type,label);
51 
52 T *sT_(SemTable *sem,Symbol sym,int num_params,...);
53 
54 void load_contexts(SemTable *sem);
55 void load_context(char *name, Receptor *parent);
56 
57 #endif
Definition: ceptr_types.h:114
header file for table for coordinating meaning across a vmhost