18 T *s = _t_news(expect,SEMTREX_GROUP,SHELL_COMMAND);
20 T *cm =
_sl(s,SHELL_COMMAND);
21 T *vl = _t_newr(cm,SEMTREX_VALUE_LITERAL);
22 T *vls = _t_newr(vl,SEMTREX_VALUE_SET);
23 _t_new_str(vls,VERB,command);
26 __r_make_addr(p,TO_ADDRESS,ox);
28 _t_news(p,ASPECT_IDENT,DEFAULT_ASPECT);
29 _t_news(p,CARRIER,NULL_SYMBOL);
35 if (bindings_handler) {
36 char proc_name[255] =
"handle ";
37 strcpy(&proc_name[7],command);
38 int pt1[] = {2,1,TREE_PATH_TERMINATOR};
39 _t_new(p,PARAM_REF,pt1,
sizeof(
int)*3);
41 _t_news(bindings_handler,ACTUAL_PROCESS,proc);
58 Xaddr shellx = _v_new_receptor(v,v->
r,shell,r);
63 Stream *output_stream = *osp = _st_new_unix_stream(output,0);
64 Stream *input_stream = *isp = _st_new_unix_stream(input,1);
66 Receptor *i_r = *irp = _r_makeStreamEdgeReceptor(v->
sem);
67 _r_addReader(i_r,input_stream,r->
addr,DEFAULT_ASPECT,parse_line,LINE,
false);
68 Xaddr ix = _v_new_receptor(v,v->
r,STREAM_EDGE,i_r);
71 Receptor *o_r = *orp = _r_makeStreamEdgeReceptor(v->
sem);
72 _r_addWriter(o_r,output_stream,DEFAULT_ASPECT);
73 Xaddr ox = _v_new_receptor(v,v->
r,STREAM_EDGE,o_r);
78 __sem_get_by_label(v->
sem,
"PARSE_COMMAND_FROM_LINE",&clp,DEV_COMPOSITORY_CONTEXT);
80 T *res = _t_newr(bindings,RESOLUTION);
81 T *w = _t_newr(res,WHICH_RECEPTOR);
82 _t_news(w,ROLE,LINE_SENDER);
83 __r_make_addr(w,ACTUAL_RECEPTOR,i_r->
addr);
84 res = _t_newr(bindings,RESOLUTION);
85 w = _t_newr(res,WHICH_RECEPTOR);
86 _t_news(w,ROLE,COMMAND_RECEIVER);
87 __r_make_addr(w,ACTUAL_RECEPTOR,r->
addr);
88 res = _t_newr(bindings,RESOLUTION);
89 w = _t_newr(res,WHICH_SYMBOL);
90 _t_news(w,USAGE,COMMAND_TYPE);
91 _t_news(w,ACTUAL_SYMBOL,SHELL_COMMAND);
98 __sem_get_by_label(v->
sem,
"time",&time,CLOCK_CONTEXT);
100 _t_news(code,PNAME,time);
101 _t_news(code,WHICH_INTERACTION,tell_time);
102 bindings = _t_newr(code,PROTOCOL_BINDINGS);
103 res = _t_newr(bindings,RESOLUTION);
104 w = _t_newr(res,WHICH_RECEPTOR);
105 _t_news(w,ROLE,TIME_HEARER);
106 __r_make_addr(w,ACTUAL_RECEPTOR,r->
addr);
107 res = _t_newr(bindings,RESOLUTION);
108 w = _t_newr(res,WHICH_RECEPTOR);
109 _t_news(w,ROLE,TIME_TELLER);
111 __r_make_addr(w,ACTUAL_RECEPTOR,clock_addr);
112 res = _t_newr(bindings,RESOLUTION);
113 w = _t_newr(res,WHICH_PROCESS);
114 _t_news(w,GOAL,RESPONSE_HANDLER);
116 addCommand(r,o_r->
addr,
"time",
"get time",code,w);
120 code = _t_newi(0,MAGIC,MagicReceptors);
121 addCommand(r,o_r->
addr,
"receptors",
"get receptor list",code,NULL);
124 code = _t_newi(0,MAGIC,MagicQuit);
125 addCommand(r,o_r->
addr,
"quit",
"shut down the vmhost",code,NULL);
128 code = _t_newi(0,MAGIC,MagicDebug);
129 addCommand(r,o_r->
addr,
"debug",
"toggle debug mode",code,NULL);
T * _t_new_root(Symbol symbol)
command line shell receptor header files
Semantic tree regular expression header file.
SemanticID _d_define_receptor(SemTable *sem, char *label, T *definitions, Context c)
protocol helpers header file
T * _t_newp(T *parent, Symbol symbol, Process surface)
ReceptorAddress addr
the address by which to get messages to this receptor instance
void _r_add_expectation(Receptor *r, Aspect aspect, Symbol carrier, T *pattern, T *action, T *with, T *until, T *using, T *cid)
Adds an expectation to a receptor's aspect.
void _v_activate(VMHost *v, Xaddr x)
Receptor * _r_new(SemTable *sem, SemanticID r)
Creates a new receptor.
SemTable * sem
Semantic Table for definitions on this host.
SemTable * sem
pointer back to the genotype table for this receptor's vmhost instance
void _o_express_role(Receptor *r, Protocol protocol, Symbol role, Aspect aspect, T *bindings)
Receptor * r
Receptor data for this vm host.
#define _sl(t, s)
macro to add a single symbol literal to semtrex tree
Process _r_define_process(Receptor *r, T *code, char *name, char *intention, T *signature, T *link)