=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Doc/httpd-rpc.sm1,v retrieving revision 1.6 retrieving revision 1.11 diff -u -p -r1.6 -r1.11 --- OpenXM/src/kan96xx/Doc/httpd-rpc.sm1 2002/10/28 08:57:28 1.6 +++ OpenXM/src/kan96xx/Doc/httpd-rpc.sm1 2002/11/04 05:40:40 1.11 @@ -1,23 +1,45 @@ -%% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-rpc.sm1,v 1.5 2002/10/24 07:45:03 takayama Exp $ +%% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-rpc.sm1,v 1.10 2002/11/03 12:43:03 takayama Exp $ %% http server by sm1. Used for RPC. Generic example. [(parse) (httpd.sm1) pushfile] extension pop +%% keyword for rpc /httpd.textarea.name (rpc) def /httpd.textarea.name.aaa [(GET /?) httpd.textarea.name] cat (array) dc def -/httpd.port 8090 def + +[(getenv) (OXWEB_PORT)] extension tag 0 eq { + (Default httpd port : ) messagen + /httpd.port 8090 def +} { + /httpd.port [(getenv) (OXWEB_PORT)] extension .. (integer) dc def +} ifelse +(httpd.port = ) messagen httpd.port message + /httpd.serial 0 def +/httpd.oxasir.timer 1 def %% 1 to use timer, but it accepts only one command + %% 0 not to use timer. It accepts programs. + +/httpd.title + (
) sendln result sendln + () sendln 0 sendln [(flush)] extension ] pop @@ -287,7 +331,7 @@ oxNoX } def %% ******* sample of cooked command -/cookedCommand { +/cookedCommand.simplest { /arg1 set [/in-cookedCommand /httpd.com] pushVariables [ @@ -298,8 +342,34 @@ oxNoX popVariables arg1 } def +/cookedCommand { + /arg1 set + [/in-cookedCommand /httpd.com /fff] pushVariables + [ + /httpd.com arg1 def + httpd.oxasir.timer not { + [(if (1) {) httpd.com (; };)] cat + /fff set + }{ +%% It does not work. +%% [$timer(30,eval_str("$ +%% (if (1) {) httpd.com (; };) +%% $"),"Computation is aborted with the resource limit ( 30 seconds)");$ +%% ] cat + [$timer(30,$ httpd.com + $,"Computation is aborted with the resource limit ( 30 seconds) or there was a syntax error.");$ + ] cat + /fff set + } ifelse + (cooked command is ) messagen fff message + /arg1 fff def + ] pop + popVariables + arg1 +} def /httpd.refusedCommands - [(shell) (eval_str) (ox_) (sm1_) (m_) + [(shell) (eval_str) (ox_) (sm1_) + (m_start) (m_N_) (m_Inverse) (m_TexForm) %(m_) (connect) (load) (bload) (bsave) (end) (quit) (output) (bload27) (open) (plot) (ctrl) (debug) (error) (port) (bind) (accept)