version 1.1, 2002/10/23 13:38:50 |
version 1.2, 2002/10/24 02:12:34 |
|
|
%% $OpenXM$ |
%% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-rpc.sm1,v 1.1 2002/10/23 13:38:50 takayama Exp $ |
%% http server by sm1. Used for RPC. Generic example. |
%% http server by sm1. Used for RPC. Generic example. |
|
|
[(parse) (httpd.sm1) pushfile] extension pop |
[(parse) (httpd.sm1) pushfile] extension pop |
|
|
/httpd.port 8090 def |
/httpd.port 8090 def |
/httpd.serial 0 def |
/httpd.serial 0 def |
|
|
/httpd.image.name (kobeuniv2.jpg) def |
%%******* Put initialization codes for ox_asir here. |
|
/httpd.initialization |
|
[ |
|
(XM_debug=0; ctrl("debug_window",0); Xm_noX=1;) |
|
("Asirweb version 0.80. "+ |
|
" Risa/Asir oxasir version "+rtostr(version());) |
|
] cat |
|
def |
|
|
|
|
[(parse) (oxasir.sm1) pushfile] extension |
[(parse) (oxasir.sm1) pushfile] extension |
|
|
[(x^2-1) (x)] fctr pop |
[(x^2-1) (x)] fctr pop |
oxasir.ccc oxmathcap |
oxasir.ccc oxmathcap |
oxasir.ccc oxsetmathcap |
oxasir.ccc oxsetmathcap |
|
oxasir.ccc httpd.initialization oxexecutestring ; |
|
(Initialization returns ...: ) messagen |
|
oxasir.ccc oxpopcmo message ; |
} ifelse |
} ifelse |
|
|
/webrpc { |
/webrpc { |
|
|
[(sm1.socket) (select) [httpd.server.fd 0 get -1]] extension |
[(sm1.socket) (select) [httpd.server.fd 0 get -1]] extension |
%% wait for ever |
%% wait for ever |
[(sm1.socket) (readHTTP) [httpd.server.fd 0 get ]] extension /ff set |
[(sm1.socket) (readHTTP) [httpd.server.fd 0 get ]] extension /ff set |
ff length 0 eq { |
ff tag 0 eq { |
(connection is closed.) message |
(connection is closed.) message exit |
} |
} |
{ |
{ |
(------------ start ----------------------) message |
(------------ start ----------------------) message |
|
|
[(httpd.com=) httpd.com] cat message |
[(httpd.com=) httpd.com] cat message |
(------------ end ----------------------) message |
(------------ end ----------------------) message |
( ) message |
( ) message |
httpd.serial 0 eq { |
|
/httpd.com httpd.initialization def |
|
} { } ifelse |
|
httpd.com metaCommand { |
httpd.com metaCommand { |
httpd.textarea.valid { |
httpd.textarea.valid { |
|
|
|
|
httpd.result message |
httpd.result message |
(----------------------------------) message |
(----------------------------------) message |
( ) message |
( ) message |
|
|
|
(----------- error -------------) message |
err message |
err message |
|
(-------------------------------) message |
err [ ] eq { |
err [ ] eq { |
} { |
} { |
oxasir.ccc cleanErrors |
oxasir.ccc cleanErrors |
|
|
popVariables |
popVariables |
} def |
} def |
|
|
%%******* Put initialization codes for ox_asir here. |
%% **** Overwrites the definition in httpd.sm1 |
/httpd.initialization |
/httpd_startserver { |
[ |
(httpd server accessible outside localhost.) message |
(XM_debug=0; ctrl("debug_window",0); Xm_noX=1;) |
%% get the hostname of this machine. |
("Asirweb version 0.80. "+ |
[(sm1.socket) (open) [httpd.port |
" Risa/Asir oxasir version "+rtostr(version());) |
[(sm1.socket) (gethostname) [ ] ]extension ] ] |
] cat |
extension |
def |
/httpd.server.fdAndPort set |
|
(sm1.socket.open returns ) messagen httpd.server.fdAndPort message |
|
[(sm1.socket) (accept) [httpd.server.fdAndPort 0 get]] extension |
|
/httpd.server.fd set |
|
(connected.) message |
|
(sm1.socket.accept returns <httpd.server.fd> ) messagen |
|
httpd.server.fd message |
|
|
|
} def |
|
|
%% ******* sample of cooked command |
%% ******* sample of cooked command |
/cookedCommand { |
/cookedCommand { |