version 1.5, 2001/04/21 13:54:29 |
version 1.7, 2001/04/22 01:02:27 |
|
|
%% $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.6 2001/04/22 00:34:01 takayama Exp $ |
%% http server by sm1 |
%% http server by sm1 |
|
|
/httpd.port 1200 def |
/httpd.port 1200 def |
|
|
[(parse) (oxasir.sm1) pushfile] extension |
[(parse) (oxasir.sm1) pushfile] extension |
(oxasir.started) boundp { |
(oxasir.started) boundp { |
} { |
} { |
|
%% Initialize oxasir. |
[(x^2-1) (x)] fctr pop |
[(x^2-1) (x)] fctr pop |
oxasir.ccc oxmathcap |
oxasir.ccc oxmathcap |
oxasir.ccc oxsetmathcap |
oxasir.ccc oxsetmathcap |
} ifelse |
} ifelse |
|
|
/asirweb { |
/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 ; |
httpd ; |
|
] pop |
|
popVariables |
} def |
} def |
|
|
/httpd_startserver { |
/httpd_startserver { |
|
|
|
|
/httpd_action { |
/httpd_action { |
[/in-httpd /ff /httpd.com /httpd.result /sss |
[/in-httpd /ff /httpd.com /httpd.result /sss |
/sss.engine /sss.web |
/sss.engine /sss.web /err |
] pushVariables |
] pushVariables |
[ |
[ |
{ |
{ |
|
|
/httpd.com httpd.initialization def |
/httpd.com httpd.initialization def |
} { } ifelse |
} { } ifelse |
httpd.com metaCommand { |
httpd.com metaCommand { |
/httpd.history |
|
httpd.history |
|
[10 (string) dc |
|
(/**** ) httpd.serial toString ( ****/) |
|
10 (string) dc |
|
httpd.com |
|
] cat |
|
append |
|
def |
|
oxasir.ccc |
oxasir.ccc |
[(if (1) {) httpd.com (};)] cat |
[(if (1) {) httpd.com (};)] cat |
oxexecutestring ; |
oxexecutestring ; |
|
[(oxReq) oxasir.ccc SM_dupErrors ] extension pop |
|
|
|
[(oxReq) oxasir.ccc SM_popCMO ] extension pop |
[(oxReq) oxasir.ccc SM_popString ] extension pop |
[(oxReq) oxasir.ccc SM_popString ] extension pop |
[(flush)] extension pop |
[(flush)] extension pop |
%% Select inputs for interruption. |
%% Select inputs for interruption. |
|
|
sss message |
sss message |
|
|
sss 0 get { |
sss 0 get { |
|
[(oxGet) oxasir.ccc] extension /err set |
[(oxGet) oxasir.ccc] extension /httpd.result set |
[(oxGet) oxasir.ccc] extension /httpd.result set |
%% oxasir.ccc oxpopstring /httpd.result set |
%% oxasir.ccc oxpopstring /httpd.result set |
} { |
} { |
|
|
httpd.result message |
httpd.result message |
(----------------------------------) message |
(----------------------------------) message |
( ) message |
( ) message |
|
|
|
err message |
|
err [ ] eq { |
|
/httpd.history |
|
httpd.history |
|
[10 (string) dc |
|
(/**** ) httpd.serial toString ( ****/) |
|
10 (string) dc |
|
httpd.com |
|
] cat |
|
append |
|
def |
|
} { |
|
oxasir.ccc cleanErrors |
|
[httpd.result 10 (string) dc err toString] cat |
|
/httpd.result set |
|
} ifelse |
|
|
[httpd.serial 0 eq { } { |
[httpd.serial 0 eq { } { |
(<title> asirweb </title> ) |
(<title> asirweb </title> ) |
(<font color="blue"> Input-) httpd.serial toString |
(<font color="blue"> Input-) httpd.serial toString |
|
|
(Content-Type: text/html) sendln |
(Content-Type: text/html) sendln |
0 sendln |
0 sendln |
(<html> <body>) sendln |
(<html> <body>) sendln |
(/* Save the following to sm1out.txt */<br>) sendln |
(/* Saved the following to sm1out.txt */<br>) sendln |
|
(/* Save the following by your browser as a text file. */<br>) sendln |
|
|
(<pre>) sendln |
(<pre>) sendln |
0 1 httpd.history length 1 sub { |
0 1 httpd.history length 1 sub { |
|
|
} def |
} def |
|
|
|
|
|
/cleanErrors { |
|
/arg1 set |
|
[/in-cleanErrors /clientt /spp] pushVariables |
|
[ |
|
/clientt arg1 def |
|
clientt oxgetsp (integer) dc /spp set |
|
clientt spp oxpops |
|
] pop |
|
popVariables |
|
} def |
|
|
|
|
/fromHex { |
/fromHex { |
/arg1 set |
/arg1 set |
[/in-fromHex /s1 /s2 /c /c2] pushVariables |
[/in-fromHex /s1 /s2 /c /c2] pushVariables |
|
|
arg1 |
arg1 |
} def |
} def |
|
|
|
%% remove GET /?msg= |
/removeGET { |
/removeGET { |
/arg1 set |
/arg1 set |
[/in-removeGET /s /s2 /i /j] pushVariables |
[/in-removeGET /s /s2 /i /j /i0] pushVariables |
[ |
[ |
/s arg1 def |
/s arg1 def |
s 1 copy /s2 set |
s 1 copy /s2 set |
s (array) dc /s set |
s (array) dc /s set |
|
|
|
0 1 s length 1 sub { |
|
/i0 set |
|
s i0 get 61 eq { %% 61 is = |
|
i0 1 add /i0 set |
|
exit |
|
} { } ifelse |
|
} for |
|
|
/j 0 def |
/j 0 def |
10 1 s length 1 sub { |
i0 1 s length 1 sub { |
/i set |
/i set |
s2 j << s i get (string) dc >> put |
s2 j << s i get (string) dc >> put |
j 1 add /j set |
j 1 add /j set |