[BACK]Return to httpd-sm1.sm1 CVS log [TXT][DIR] Up to [local] / OpenXM / src / kan96xx / Doc

Annotation of OpenXM/src/kan96xx/Doc/httpd-sm1.sm1, Revision 1.19

1.19    ! ohara       1: %% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-sm1.sm1,v 1.18 2005/11/17 08:15:51 takayama Exp $
1.1       takayama    2: %% http server by sm1
1.3       takayama    3: %% Note to run on the Windows (TM).
1.2       takayama    4: %% (A) You need to set IE (internet explorer) as follows:
                      5: %%   (1) Visit the menu
                      6: %%     tool / internet option / connection / LAN configuration
1.3       takayama    7: %%   (2) Add localhost to the list of hosts which are not accessed via
                      8: %%        the proxy server.
1.2       takayama    9: %% (B) You need to have the "start.exe" at  c:\windows\command\start.exe
1.3       takayama   10: %% (C) cygwin1.dll should be by sm1.exe, ox_sm1.exe and ox.exe
1.1       takayama   11:
1.8       takayama   12: [(parse) (httpd.sm1) pushfile] extension pop
1.1       takayama   13:
1.3       takayama   14: /httpd.image.name (kobeuniv2.jpg) def
                     15: /httpd.image.type (jpeg) def
1.1       takayama   16: /httpd.port 1200 def
                     17:
                     18: /httpd.initialization
                     19: %% Put initialization codes here.
                     20:  [
                     21:   ([$parse$ $cohom.sm1$ pushfile] extension
                     22:    [$Web/sm1 version 0.80. $
                     23:     $Kan/sm1 ox_sm1 version $ [$Version$] system_variable] cat)
                     24:  ] cat
                     25: def
                     26:
1.6       takayama   27: [(ostype)] extension 0 get
                     28: (windows) eq {
                     29:   %% Native windows environment or cygwin.
1.3       takayama   30:   [(parse) (ox-win.sm1) pushfile] extension
                     31: }{
1.6       takayama   32:   [(parse) (ox.sm1) pushfile] extension
1.3       takayama   33: } ifelse
                     34:
1.1       takayama   35: (ox_sm1.started) boundp {
                     36: } {
1.3       takayama   37:   %% Initialize ox_sm1
1.6       takayama   38:   [(ostype)] extension 0 get
1.10      takayama   39:   sm1connectr
1.1       takayama   40:   ox.ccc oxmathcap
                     41:   ox.ccc oxsetmathcap
                     42: } ifelse
                     43:
1.17      takayama   44: /ox-win.start.iconic 1 def
                     45: /ox.win.set.start {
                     46:   [(stat) (c:\windows\system32\cmd.exe)] extension 0 get
                     47:   0 eq {
                     48:     /ox.win.start.0 [(c:\windows\system32\cmd.exe) (/c) (start)] def
                     49:     /ox.win.start [ox.win.start.0 aload pop
                     50:                    ox-win.start.iconic { (/min) } { } ifelse ] def
                     51:   }{
                     52:    [(stat) (c:\winnt\system32\cmd.exe)] extension 0 get
                     53:    0 eq {
                     54:       /ox.win.start.0 [(c:\winnt\system32\cmd.exe) (/c) (start) ] def
                     55:       /ox.win.start [ox.win.start.0 aload pop
                     56:                      ox-win.start.iconic { (/min) } { } ifelse ] def
                     57:    }{
                     58:      /ox.win.start.0 [ (start) ] def
                     59:      /ox.win.start [ ox.win.start.0 aload pop
                     60:                      ox-win.start.iconic { (/min) } { } ifelse ] def
                     61:    } ifelse
                     62:   } ifelse
                     63: } def
                     64:
1.1       takayama   65: /websm1 {
                     66:  [/rrr ] pushVariables
                     67:  [
                     68:   %% This procedure to generate port number might fail.
                     69:   [(oxGenPass)] extension . (integer) dc  /rrr set
                     70:   rrr << rrr 20000 idiv 20000 mul >> sub /rrr set
                     71:   /httpd.port 1200 rrr add def
                     72:   httpd.port message
                     73:
1.2       takayama   74: %  [(sleep 3; start iexplore http://localhost:)
                     75: %    httpd.port toString
                     76: %   ( &)] cat system
1.6       takayama   77:    [(ostype)] extension 0 get
                     78:    (windows) eq {
                     79:      %% On windows.
1.17      takayama   80:       ox.win.set.start
1.6       takayama   81:       [(forkExec)
                     82:        [
1.11      takayama   83:          %%(c:/windows/command/start)
1.12      takayama   84:          ox.win.start.0 aload pop
1.6       takayama   85:          (iexplore)   %% Starting internet explorer (TM).
                     86:          [(http://localhost:) httpd.port toString] cat
                     87:        ]
                     88:        [  ]
                     89:       3] extension
                     90:    }{
                     91:       %% On unix.
1.18      takayama   92:       httpd.port httpd.startBrowserUnix
1.6       takayama   93:    } ifelse
1.1       takayama   94:    httpd ;
                     95:   ] pop
                     96:   popVariables
                     97: } def
                     98:
                     99:
                    100: /httpd_action {
                    101:   [/in-httpd /ff /httpd.com /httpd.result /sss
1.3       takayama  102:    /sss.engine /sss.web /err /httpd.sendFile
1.9       takayama  103:    /oxserver.vname
1.1       takayama  104:   ] pushVariables
                    105:   [
                    106:   {
                    107:        [(sm1.socket) (select) [httpd.server.fd 0 get -1]] extension
                    108:        %%     wait for ever
1.14      takayama  109:         [(sm1.socket) (readHTTP) [httpd.server.fd 0 get ]] extension /ff set
1.15      takayama  110:         ff tag 0 eq {
                    111:            (connection is closed.) message exit
1.1       takayama  112:         }
                    113:         {
                    114:           (------------  start ----------------------) message
                    115:              ff message
                    116:           (-----------------------------------------) message
1.3       takayama  117:              ff 1 copy askToSendFile /httpd.sendFile set
                    118:              httpd.sendFile tag 0 eq {
                    119:                ff removeGET webstringToAscii /httpd.com set
                    120:              } {
                    121:                /httpd.com (NONE) def
                    122:              } ifelse
                    123:              [(httpd.com=) httpd.com] cat message
                    124:              (httpd.sendFile=) messagen httpd.sendFile message
1.1       takayama  125:           (------------  end ----------------------) message
                    126:           (   ) message
                    127:           httpd.serial 0 eq {
                    128:             /httpd.com  httpd.initialization def
1.16      takayama  129:             /httpd.textarea.valid 1 def
1.1       takayama  130:           } { } ifelse
1.3       takayama  131:           httpd.sendFile tag 0 eq { }
                    132:           {
                    133:             httpd.sendFile httpd.image.type send-image
                    134:             exit  %% exit the loop LOOP-A
                    135:           } ifelse
1.1       takayama  136:           httpd.com metaCommand {
                    137:             httpd.textarea.valid {
1.9       takayama  138:               /oxserver.vname
                    139:                 [Oxserver_history_variable httpd.serial toString] cat
                    140:               def
1.1       takayama  141:               ox.ccc
1.9       takayama  142:                [
                    143:                  httpd.com
                    144:                  (  /) oxserver.vname (  set )
                    145:                  oxserver.vname ( )
                    146:                ] cat
1.1       takayama  147:               oxexecutestring ;
                    148:             }{
                    149:               send-page-warning  exit
                    150:             } ifelse
                    151:             [(oxReq) ox.ccc SM_dupErrors ] extension pop
                    152:
                    153:             [(oxReq) ox.ccc SM_popCMO ] extension pop
                    154:             [(oxReq) ox.ccc SM_popString ] extension pop
                    155:             [(flush)] extension pop
                    156:             %% Select inputs for interruption.
                    157:             %% Wait by the spin lock.
                    158:             {
                    159:               [(oxMultiSelect) [ox.ccc] 1] extension 1 get 0 get
                    160:               /sss.engine set
                    161:               [(sm1.socket) (mselect)
                    162:                 [[httpd.server.fd 0 get] 1]
                    163:               ] extension 0 get /sss.web set
                    164:               /sss [sss.engine sss.web] def
                    165:               sss.engine { exit } { } ifelse
                    166:               sss.web    { exit } { } ifelse
                    167:             } loop
                    168:             sss message
                    169:
                    170:             sss 0 get {
                    171:                 [(oxGet) ox.ccc] extension  /err          set
                    172:                 [(oxGet) ox.ccc] extension  /httpd.result set
                    173:                 %% ox.ccc oxpopstring /httpd.result set
                    174:             } {
                    175:                 ox.ccc oxreset
                    176:                 ox.ccc ("computation is interrupted.";) oxexecutestring ;
                    177:                 ox.ccc oxpopstring
                    178:                 /httpd.result set
                    179:                 exit
                    180:             } ifelse
                    181:             (------------- result -------------) message
                    182:             httpd.result message
                    183:             (----------------------------------) message
                    184:             (  ) message
                    185:
                    186:             err message
                    187:             err [ ] eq  {
                    188:               /httpd.history
                    189:                 httpd.history
                    190:                 [10 (string) dc
                    191:                  37 (string) dc httpd.serial toString
                    192:                  10 (string) dc
                    193:                   httpd.com
                    194:                  ( )  %% add extra ;
                    195:                  ] cat
                    196:                 append
                    197:               def
                    198:             } {
                    199:               ox.ccc cleanErrors
                    200:               [httpd.result 10 (string) dc err toString] cat
                    201:               /httpd.result set
                    202:             } ifelse
                    203:
                    204:             [httpd.serial 0 eq { } {
                    205:                 (<title> Web/sm1 </title> )
                    206:                 (<font color="blue"> Input-) httpd.serial toString
                    207:                  (: </font> )
                    208:                  httpd.com preformatHTML (<br>)
                    209:               } ifelse
                    210:              (<font color="green"> Output-) httpd.serial toString
                    211:              (: </font> )
1.3       takayama  212:              (<a href=") httpd.image.name ("> (in pretty format) </a>) %%test
1.1       takayama  213:               httpd.result preformatHTML
1.4       takayama  214:               httpd.result.history httpd.result append /httpd.result.history set
1.1       takayama  215:             ] cat
1.3       takayama  216:             send-page-3  exit  %% exit the loop LOOP-A
1.1       takayama  217:           } { exit } ifelse  %% metaCommand
                    218:         } ifelse
1.3       takayama  219:   } loop %% LOOP-A
1.1       takayama  220:   ] pop
                    221:   popVariables
                    222: } def
                    223:
                    224:
1.3       takayama  225:
1.1       takayama  226: /httpd.sm1man
1.17      takayama  227:  ("http://www.math.sci.kobe-u.ac.jp/OpenXM/Current/doc/kan96xx/onlinehelp/index.html")
1.1       takayama  228: def
                    229: /httpd.sm1man.index
1.19    ! ohara     230:   ("http://www.math.sci.kobe-u.ac.jp/OpenXM/Current/doc/asir2000/html-ja/man_262.html#SEC262")
1.1       takayama  231: def
                    232: /httpd.asir.intro
1.17      takayama  233:    ("http://www.math.sci.kobe-u.ac.jp/OpenXM/Current/doc/kan96xx/ttt/index.html")
1.1       takayama  234: def
                    235: /send-menu-1 {
                    236:
                    237:   (FILE:) sendln
                    238:   [$<a href="http://localhost:$ httpd.port toString
                    239:    $/?msg=httpdAsirMeta+quit"> Shutdown the sm1 server. </a>, $
                    240:   ] cat sendln
                    241: %%  [$<a href="http://localhost:$ httpd.port toString
                    242: %%   $/?msg=httpdAsirMeta+interrupt"> interrupt </a>, $
                    243: %%  ] cat sendln
                    244:   [$<a href="http://localhost:$ httpd.port toString
                    245:    $/?msg=httpdAsirMeta+save"> save. </a>, $
                    246:   ] cat sendln
                    247:   ( <spacer type=horizontal size=80> ) sendln
                    248:
                    249:   (HELP:) sendln
                    250:   [(<font color="red">
                    251:     <a href=) httpd.sm1man ( > Sm1manual (Ja) </a> </font>, )] cat sendln
                    252:   [(<font color="blue">
                    253:     <a href=) httpd.asir.intro ( > Intro (Ja) </a> </font>, )] cat sendln
                    254: } def
                    255:
                    256: /send-page-save {
                    257:  [/in-send-page-save /i] pushVariables
                    258:  [
                    259:    (HTTP/0.9 200 OK) sendln
                    260:    (Connection: close) sendln
                    261:    (Content-Type: text/plain) sendln
                    262:    0 sendln
                    263:    [37 (string) dc ( Saved the following to sm1out.txt )] cat sendln
                    264:    [37 (string) dc ( Save the following by your browser as a text file. )]
                    265:    cat sendln
                    266:
                    267:    0 1 httpd.history length 1 sub {
                    268:      /i set
                    269:      httpd.history i get sendln
                    270:    } for
                    271:    (  ) sendln
                    272:    0 sendln
                    273:    [(flush)] extension
                    274:    [(PrintDollar) 1] system_variable
                    275:    httpd.history output
                    276:    [(PrintDollar) 0] system_variable
                    277:  ] pop
                    278:  popVariables
                    279: } def
                    280:
                    281:
                    282: /metaCommand {
                    283:   /arg1 set
                    284:   [/in-metaCommand /msg /result] pushVariables
                    285:   [
                    286:     /msg arg1 def
                    287:     /result 1 def
                    288:     msg (httpdAsirMeta quit) eq {
                    289:        ox.ccc ( quit ) oxsubmit
                    290:        ox.ccc oxshutdown
                    291:        send-page-bye
                    292:        quit
                    293:        /result 0 def
                    294:     } { } ifelse
                    295:     msg (httpdAsirMeta save) eq {
                    296:        send-page-save
                    297:        /result 0 def
                    298:     } { } ifelse
                    299:     msg (httpdAsirMeta interrupt) eq {
                    300:        ox.ccc oxreset
                    301:        (Interrupted! <br>) send-page-3
                    302:        /result 0 def
                    303:     } { } ifelse
                    304:     /arg1 result def
                    305:   ] pop
                    306:   popVariables
                    307:   arg1
                    308: } def

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>