14 void setupHTTP(
VMHost *v) {
17 _sem_get_by_label(v->
sem,
"HTTP",&HTTP);
22 Xaddr edge = _v_new_receptor(v,v->
r,STREAM_EDGE,r);
24 T *code =
_t_parse(r->
sem,0,
"(CONVERSE (SCOPE (ITERATE (PARAMS) (STREAM_ALIVE (PARAM_REF:/2/1)) (INITIATE_PROTOCOL (PNAME:HTTP) (WHICH_INTERACTION:backnforth) (PROTOCOL_BINDINGS (RESOLUTION (WHICH_RECEPTOR (ROLE:HTTP_CLIENT) %)) (RESOLUTION (WHICH_RECEPTOR (ROLE:HTTP_SERVER) %)) (RESOLUTION (WHICH_PROCESS (GOAL:RESPONSE_HANDLER) (ACTUAL_PROCESS:echo2stream))) (RESOLUTION (WHICH_USAGE (USAGE:RESPONSE_HANDLER_PARAMETERS) (ACTUAL_VALUE (PARAM_REF:/2/1)))) (RESOLUTION (WHICH_VALUE (ACTUAL_SYMBOL:HTTP_REQUEST) (ACTUAL_VALUE (STREAM_READ (PARAM_REF:/2/1) (RESULT_SYMBOL:HTTP_REQUEST)))))) ) ) (STREAM_CLOSE (PARAM_REF:/2/1))) (BOOLEAN:1))",__r_make_addr(0,ACTUAL_RECEPTOR,r->
addr),__r_make_addr(0,ACTUAL_RECEPTOR,r->
addr));
26 T *err_handler =
_t_parse(r->
sem,0,
"(CONTINUE (POP_PATH (PARAM_REF:/4/1/1) (RESULT_SYMBOL:CONTINUE_LOCATION) (POP_COUNT:5)) (CONTINUE_VALUE (BOOLEAN:0)))");
28 SocketListener *l = _r_addListener(r,8888,code,0,err_handler,DELIM_CRLF);
32 T *res = _t_newr(bindings,RESOLUTION);
33 T *w = _t_newr(res,WHICH_RECEPTOR);
34 _t_news(w,ROLE,HTTP_SERVER);
35 __r_make_addr(w,ACTUAL_RECEPTOR,r->
addr);
36 res = _t_newr(bindings,RESOLUTION);
37 w = _t_newr(res,WHICH_PROCESS);
38 _t_news(w,GOAL,HTTP_REQUEST_HANDLER);
39 _t_news(w,ACTUAL_PROCESS,fill_i_am);
45 int main(
int argc,
const char **argv) {
51 debug_enable(D_SIGNALS+D_BOOT+D_STEP+D_STREAM);
56 Stream *output_stream, *input_stream;
59 makeShell(G_vm,stdin,stdout,&i_r,&o_r,&input_stream,&output_stream);
60 output_stream->flags &= ~StreamCloseOnFree;
61 input_stream->flags &= ~StreamCloseOnFree;
62 input_stream->flags |= StreamLoadByLine;
66 _v_start_vmhost(G_vm);
68 while (G_vm->
r->
state == Alive) {
72 _v_join_thread(&G_vm->clock_thread);
73 _v_join_thread(&G_vm->vm_thread);
T * _t_new_root(Symbol symbol)
int state
state information about the receptor that the vmhost manages
command line shell receptor header files
void _v_instantiate_builtins(VMHost *v)
protocol helpers header file
ReceptorAddress addr
the address by which to get messages to this receptor instance
VMHost * _v_new()
Creates a new virtual machine host.
void _v_activate(VMHost *v, Xaddr x)
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.
T * _t_parse(SemTable *sem, T *parent, char *s,...)
header file for the accumulator