===================================================================
RCS file: /home/cvs/OpenXM/src/kan96xx/Doc/httpd-asir.sm1,v
retrieving revision 1.14
retrieving revision 1.32
diff -u -p -r1.14 -r1.32
--- OpenXM/src/kan96xx/Doc/httpd-asir.sm1 2001/08/23 02:08:41 1.14
+++ OpenXM/src/kan96xx/Doc/httpd-asir.sm1 2014/08/29 11:58:05 1.32
@@ -1,15 +1,15 @@
-%% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-asir.sm1,v 1.13 2001/08/23 00:49:00 takayama Exp $
+%% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-asir.sm1,v 1.31 2014/08/28 11:27:34 takayama Exp $
%% http server by sm1
[(parse) (httpd.sm1) pushfile] extension pop
/httpd.port 1200 def
/httpd.image.name (kobeuniv2.jpg) def
-/httpd.image.type (jpeg) def
/httpd.initialization
%% Put initialization codes here.
[
+ (XM_debug=0; ctrl("debug_window",0);)
("Asirweb version 0.80. "+
" Risa/Asir oxasir version "+rtostr(version());)
] cat
@@ -24,9 +24,30 @@ def
oxasir.ccc oxsetmathcap
} ifelse
+/ox-win.start.iconic 1 def
+/ox.win.set.start {
+ [(stat) (c:\windows\system32\cmd.exe)] extension 0 get
+ 0 eq {
+ /ox.win.start.0 [(c:\windows\system32\cmd.exe) (/c) (start)] def
+ /ox.win.start [ox.win.start.0 aload pop
+ ox-win.start.iconic { (/min) } { } ifelse ] def
+ }{
+ [(stat) (c:\winnt\system32\cmd.exe)] extension 0 get
+ 0 eq {
+ /ox.win.start.0 [(c:\winnt\system32\cmd.exe) (/c) (start) ] def
+ /ox.win.start [ox.win.start.0 aload pop
+ ox-win.start.iconic { (/min) } { } ifelse ] def
+ }{
+ /ox.win.start.0 [ (start) ] def
+ /ox.win.start [ ox.win.start.0 aload pop
+ ox-win.start.iconic { (/min) } { } ifelse ] def
+ } ifelse
+ } ifelse
+} def
+
/webasir { asirweb } def
/asirweb {
- [/rrr ] pushVariables
+ [/rrr /cmd] pushVariables
[
%% This procedure to generate port number might fail.
[(oxGenPass)] extension . (integer) dc /rrr set
@@ -34,9 +55,27 @@ def
/httpd.port 1200 rrr add def
httpd.port message
- [(sleep 3; netscape -geometry 800x500 http://localhost:)
- httpd.port toString
- ( &)] cat system
+ %%[(sleep 3; firefox -geometry 800x500 http://localhost:)
+ %% httpd.port toString
+ %% ( &)] cat system
+ [(ostype)] extension 0 get
+ (windows) eq {
+ %% On windows.
+ ox.win.set.start
+ [(forkExec)
+ [
+ %%(c:\windows\command\start)
+ ox.win.start.0 aload pop
+ (iexplore) %% Starting internet explorer (TM).
+ [(http://localhost:) httpd.port toString] cat
+ ]
+ [ ]
+ 3] extension
+ }{
+ %% On unix.
+ httpd.port httpd.startBrowserUnix
+ } ifelse
+
httpd ;
] pop
popVariables
@@ -52,9 +91,9 @@ def
{
[(sm1.socket) (select) [httpd.server.fd 0 get -1]] extension
%% wait for ever
- [(sm1.socket) (read) [httpd.server.fd 0 get ]] extension /ff set
- ff length 0 eq {
- (connection is closed.) message
+ [(sm1.socket) (readHTTP) [httpd.server.fd 0 get ]] extension /ff set
+ ff tag 0 eq {
+ (connection is closed.) message exit
}
{
(------------ start ----------------------) message
@@ -72,6 +111,7 @@ def
( ) message
httpd.serial 0 eq {
/httpd.com httpd.initialization def
+ /httpd.textarea.valid 1 def
} { } ifelse
httpd.sendFile tag 0 eq { }
{
@@ -172,10 +212,10 @@ def
/httpd.asirman
- ("http://www.math.sci.kobe-u.ac.jp/OpenXM/1.1.3/doc/asir2000/html-jp/man_toc.html")
+ ("http://www.math.sci.kobe-u.ac.jp/OpenXM/Current/doc/asir2000/html-ja/man_toc.html")
def
-/httpd.asirman.index
- ("http://www.math.sci.kobe-u.ac.jp/OpenXM/1.1.3/doc/asir2000/html-jp/man_262.html#SEC262")
+/httpd.asirman.contrib
+ ("http://www.math.sci.kobe-u.ac.jp/OpenXM/Current/doc/asir-contrib/ja/cman-html/cman-ja_toc.html")
def
/httpd.asir.intro
("http://www.math.sci.kobe-u.ac.jp/~taka/asir-book-html/main")
@@ -198,7 +238,7 @@ def
[(
AsirManual (Ja) , )] cat sendln
[(
- Index (Ja) , )] cat sendln
+ AsirContrib (Ja) , )] cat sendln
[(
Intro (Ja) , )] cat sendln
} def
@@ -241,13 +281,19 @@ def
msg2 0 get (httpdAsirMeta) eq
msg2 1 get (Pretty) eq and
{
+ httpd.image.type tag 0 eq {
+ send-page-warning-image
+ /skip-image goto
+ } { } ifelse
+
+
msg2 2 get . (integer) dc /nn set
%% Reformat the "nn"-th result by tex and send it.
%% BUG: index is out of bound. httpd.result.history nn get message
oxasir.ccc
- [$print_gif_form(Oxserver_history_variable_$
+ [$print_$ httpd.image.type $_form(Oxserver_history_variable_$
nn toString
$);$
] cat
@@ -256,13 +302,14 @@ def
dup 0 get /err set
1 get /fn set
err [ ] eq {
- fn 0 get (gif) send-image
+ fn 0 get httpd.image.type send-image
} {
[err preformatHTML] cat
send-page-3
} ifelse
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+ /skip-image
/result 0 def
} { } ifelse
}{ } ifelse
@@ -285,4 +332,26 @@ def
] pop
popVariables
arg1
+} def
+
+/webasir2 {
+ [/rrr /cmd /mypid /lockname] 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
+
+ [(getpid)] extension (dollar) dc /mypid set
+ [(/tmp/webasir-) mypid (.txt)] cat /lockname set
+ [(outputObjectToFile) lockname
+ [httpd.port nl httpd.textarea.name nl ] cat
+ ] extension
+ lockname message
+ [(cat ) lockname] cat (system) nl message
+ httpd ;
+ [(rm -f ) lockname] cat system
+ ] pop
+ popVariables
} def