=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Doc/httpd-asir.sm1,v retrieving revision 1.5 retrieving revision 1.9 diff -u -p -r1.5 -r1.9 --- OpenXM/src/kan96xx/Doc/httpd-asir.sm1 2001/04/21 13:54:29 1.5 +++ OpenXM/src/kan96xx/Doc/httpd-asir.sm1 2001/04/22 04:55:07 1.9 @@ -1,7 +1,8 @@ -%% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-asir.sm1,v 1.4 2001/04/21 11:16:30 takayama Exp $ +%% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-asir.sm1,v 1.8 2001/04/22 04:35:46 takayama Exp $ %% http server by sm1 /httpd.port 1200 def + /httpd.initialization %% Put initialization codes here. [ @@ -9,17 +10,31 @@ " Risa/Asir oxasir version "+rtostr(version());) ] cat def + [(parse) (oxasir.sm1) pushfile] extension (oxasir.started) boundp { } { + %% Initialize oxasir. [(x^2-1) (x)] fctr pop oxasir.ccc oxmathcap oxasir.ccc oxsetmathcap } ifelse /asirweb { - (sleep 3; netscape -geometry 800x500 http://localhost:1200 &) system + [/rrr ] pushVariables + [ + %% This procedure to generate port number might fail. + [(oxGenPass)] extension . (integer) dc /rrr set + rrr << rrr 20000 idiv 20000 mul >> sub /rrr set + /httpd.port 1200 rrr add def + httpd.port message + + [(sleep 3; netscape -geometry 800x500 http://localhost:) + httpd.port toString + ( &)] cat system httpd ; + ] pop + popVariables } def /httpd_startserver { @@ -69,7 +84,7 @@ def /httpd_action { [/in-httpd /ff /httpd.com /httpd.result /sss - /sss.engine /sss.web + /sss.engine /sss.web /err ] pushVariables [ { @@ -91,19 +106,16 @@ def /httpd.com httpd.initialization def } { } ifelse httpd.com metaCommand { - /httpd.history - httpd.history - [10 (string) dc - (/**** ) httpd.serial toString ( ****/) - 10 (string) dc - httpd.com - ] cat - append - def - oxasir.ccc - [(if (1) {) httpd.com (};)] cat - oxexecutestring ; + httpd.textarea.valid { + oxasir.ccc + [(if (1) {) httpd.com (; };)] cat + oxexecutestring ; + }{ + send-page-warning exit + } ifelse + [(oxReq) oxasir.ccc SM_dupErrors ] extension pop + [(oxReq) oxasir.ccc SM_popCMO ] extension pop [(oxReq) oxasir.ccc SM_popString ] extension pop [(flush)] extension pop %% Select inputs for interruption. @@ -121,6 +133,7 @@ def sss message sss 0 get { + [(oxGet) oxasir.ccc] extension /err set [(oxGet) oxasir.ccc] extension /httpd.result set %% oxasir.ccc oxpopstring /httpd.result set } { @@ -134,15 +147,34 @@ def httpd.result message (----------------------------------) message ( ) message + + err message + err [ ] eq { + /httpd.history + httpd.history + [10 (string) dc + (/**** ) httpd.serial toString ( ****/) + 10 (string) dc + httpd.com + (;) %% add extra ; + ] cat + append + def + } { + oxasir.ccc cleanErrors + [httpd.result 10 (string) dc err toString] cat + /httpd.result set + } ifelse + [httpd.serial 0 eq { } { (
) httpd.com () (
) httpd.result () + httpd.result preformatHTML ] cat send-page-3 exit } { exit } ifelse %% metaCommand @@ -199,7 +231,8 @@ def result sendln () sendln send-menu-1 0 sendln @@ -245,18 +278,16 @@ def [ (HTTP/0.9 200 OK) sendln (Connection: close) sendln - (Content-Type: text/html) sendln + (Content-Type: text/plain) sendln 0 sendln - ( ) sendln - (/* Save the following to sm1out.txt */
) sendln 0 1 httpd.history length 1 sub { /i set httpd.history i get sendln } for - () sendln - ( ) sendln + ( end$) sendln 0 sendln [(flush)] extension [(PrintDollar) 1] system_variable @@ -266,12 +297,33 @@ def popVariables } def +/send-page-warning { + (HTTP/0.9 200 OK) sendln + (Connection: close) sendln + (Content-Type: text/html) sendln + 0 sendln + (You cannot execute oxasir without a session key!
) sss ()] cat /arg1 set + ] pop + popVariables + arg1 +} def + /metaCommand { /arg1 set [/in-metaCommand /msg /result] pushVariables @@ -370,6 +501,7 @@ def /msg arg1 def /result 1 def msg (httpdAsirMeta quit) eq { + oxasir.ccc oxshutdown send-page-bye quit /result 0 def