version 1.12, 2002/11/10 07:00:03 |
version 1.17, 2013/03/07 02:10:32 |
|
|
%% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-rpc.sm1,v 1.11 2002/11/04 05:40:40 takayama Exp $ |
%% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-rpc.sm1,v 1.16 2012/12/23 02:33:16 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.textmode 1 def %% It does not work on some browsers. |
|
|
/httpd_action { |
/httpd_action { |
httpd_action_allow_file_transfer |
httpd_action_allow_file_transfer |
|
|
def |
def |
|
|
/httpd.asirman |
/httpd.asirman |
("http://www.math.sci.kobe-u.ac.jp/OpenXM/1.2.1/doc/asir2000/html-eg/man_toc.html") |
("http://www.math.sci.kobe-u.ac.jp/OpenXM/1.2.1/doc/asir2000/html-en/man_toc.html") |
def |
def |
/httpd.asirman.ja |
/httpd.asirman.ja |
("http://www.math.sci.kobe-u.ac.jp/OpenXM/1.2.1/doc/asir2000/html-jp/man_toc.html") |
("http://www.math.sci.kobe-u.ac.jp/OpenXM/1.2.1/doc/asir2000/html-ja/man_toc.html") |
def |
def |
|
|
[(parse) (oxasir.sm1) pushfile] extension |
[(parse) (oxasir.sm1) pushfile] extension |
|
|
3] extension |
3] extension |
}{ |
}{ |
%% On unix. |
%% On unix. |
[(sleep 3 ; netscape http://) |
[(ostype)] extension 1 get (mac) eq { |
|
/webrpc.browser (open) def |
|
} { /webrpc.browser (firefox) def } ifelse |
|
[(sleep 3 ; ) webrpc.browser ( http://) |
[(sm1.socket) (gethostname) []] extension |
[(sm1.socket) (gethostname) []] extension |
(:) httpd.port toString ( & ) ] cat |
(:) httpd.port toString ( & ) ] cat |
system |
system |
|
|
|
|
/send-page-result { |
/send-page-result { |
/arg1 set |
/arg1 set |
[/in-send-page-result /result] pushVariables |
[/in-send-page-result /result /hlen /msg1 /msg2] pushVariables |
[ |
[ |
/result arg1 def |
/result arg1 def |
|
/msg1 (<html> <body> <pre>) def |
|
/msg2 (</pre> </body> </html>) def |
|
httpd.textmode { 0 /hlen set } |
|
{ msg1 length msg2 length add 3 add /hlen set } ifelse |
(HTTP/0.9 200 OK) sendln |
(HTTP/0.9 200 OK) sendln |
(Connection: close) sendln |
(Connection: close) sendln |
[(Content-length: ) result length toString ] cat sendln |
[(Content-length: ) result length hlen add toString ] cat sendln |
(Content-Type: text/html) sendln |
httpd.textmode |
%(Content-Type: text/plain) sendln % It does not work on some browsers. |
{ (Content-Type: text/plain) sendln } % It does not work on some browsers. |
|
{ (Content-Type: text/html) sendln } ifelse |
0 sendln |
0 sendln |
|
|
(<html> <body> <pre>) sendln |
httpd.textmode { } { msg1 sendln } ifelse |
result sendln |
result sendln |
(</pre> </body> </html>) sendln |
httpd.textmode { } { msg2 sendln } ifelse |
0 sendln |
0 sendln |
[(flush)] extension |
[(flush)] extension |
] pop |
] pop |
|
|
(end) (quit) (output) (bload27) (open) |
(end) (quit) (output) (bload27) (open) |
(plot) (ctrl) (debug) (error) (port) (bind) (accept) |
(plot) (ctrl) (debug) (error) (port) (bind) (accept) |
(draw) (peek) (poke) |
(draw) (peek) (poke) |
|
(write_string_to_a_file) (_filter) |
] |
] |
def |
def |