[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.17

1.17    ! takayama    1: %% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-sm1.sm1,v 1.16 2002/10/24 02:30:16 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.
                     92:       [(sleep 3 ; netscape http://localhost:) httpd.port toString ( & ) ] cat
                     93:       system
                     94:    } ifelse
1.1       takayama   95:    httpd ;
                     96:   ] pop
                     97:   popVariables
                     98: } def
                     99:
                    100:
                    101: /httpd_action {
                    102:   [/in-httpd /ff /httpd.com /httpd.result /sss
1.3       takayama  103:    /sss.engine /sss.web /err /httpd.sendFile
1.9       takayama  104:    /oxserver.vname
1.1       takayama  105:   ] pushVariables
                    106:   [
                    107:   {
                    108:        [(sm1.socket) (select) [httpd.server.fd 0 get -1]] extension
                    109:        %%     wait for ever
1.14      takayama  110:         [(sm1.socket) (readHTTP) [httpd.server.fd 0 get ]] extension /ff set
1.15      takayama  111:         ff tag 0 eq {
                    112:            (connection is closed.) message exit
1.1       takayama  113:         }
                    114:         {
                    115:           (------------  start ----------------------) message
                    116:              ff message
                    117:           (-----------------------------------------) message
1.3       takayama  118:              ff 1 copy askToSendFile /httpd.sendFile set
                    119:              httpd.sendFile tag 0 eq {
                    120:                ff removeGET webstringToAscii /httpd.com set
                    121:              } {
                    122:                /httpd.com (NONE) def
                    123:              } ifelse
                    124:              [(httpd.com=) httpd.com] cat message
                    125:              (httpd.sendFile=) messagen httpd.sendFile message
1.1       takayama  126:           (------------  end ----------------------) message
                    127:           (   ) message
                    128:           httpd.serial 0 eq {
                    129:             /httpd.com  httpd.initialization def
1.16      takayama  130:             /httpd.textarea.valid 1 def
1.1       takayama  131:           } { } ifelse
1.3       takayama  132:           httpd.sendFile tag 0 eq { }
                    133:           {
                    134:             httpd.sendFile httpd.image.type send-image
                    135:             exit  %% exit the loop LOOP-A
                    136:           } ifelse
1.1       takayama  137:           httpd.com metaCommand {
                    138:             httpd.textarea.valid {
1.9       takayama  139:               /oxserver.vname
                    140:                 [Oxserver_history_variable httpd.serial toString] cat
                    141:               def
1.1       takayama  142:               ox.ccc
1.9       takayama  143:                [
                    144:                  httpd.com
                    145:                  (  /) oxserver.vname (  set )
                    146:                  oxserver.vname ( )
                    147:                ] cat
1.1       takayama  148:               oxexecutestring ;
                    149:             }{
                    150:               send-page-warning  exit
                    151:             } ifelse
                    152:             [(oxReq) ox.ccc SM_dupErrors ] extension pop
                    153:
                    154:             [(oxReq) ox.ccc SM_popCMO ] extension pop
                    155:             [(oxReq) ox.ccc SM_popString ] extension pop
                    156:             [(flush)] extension pop
                    157:             %% Select inputs for interruption.
                    158:             %% Wait by the spin lock.
                    159:             {
                    160:               [(oxMultiSelect) [ox.ccc] 1] extension 1 get 0 get
                    161:               /sss.engine set
                    162:               [(sm1.socket) (mselect)
                    163:                 [[httpd.server.fd 0 get] 1]
                    164:               ] extension 0 get /sss.web set
                    165:               /sss [sss.engine sss.web] def
                    166:               sss.engine { exit } { } ifelse
                    167:               sss.web    { exit } { } ifelse
                    168:             } loop
                    169:             sss message
                    170:
                    171:             sss 0 get {
                    172:                 [(oxGet) ox.ccc] extension  /err          set
                    173:                 [(oxGet) ox.ccc] extension  /httpd.result set
                    174:                 %% ox.ccc oxpopstring /httpd.result set
                    175:             } {
                    176:                 ox.ccc oxreset
                    177:                 ox.ccc ("computation is interrupted.";) oxexecutestring ;
                    178:                 ox.ccc oxpopstring
                    179:                 /httpd.result set
                    180:                 exit
                    181:             } ifelse
                    182:             (------------- result -------------) message
                    183:             httpd.result message
                    184:             (----------------------------------) message
                    185:             (  ) message
                    186:
                    187:             err message
                    188:             err [ ] eq  {
                    189:               /httpd.history
                    190:                 httpd.history
                    191:                 [10 (string) dc
                    192:                  37 (string) dc httpd.serial toString
                    193:                  10 (string) dc
                    194:                   httpd.com
                    195:                  ( )  %% add extra ;
                    196:                  ] cat
                    197:                 append
                    198:               def
                    199:             } {
                    200:               ox.ccc cleanErrors
                    201:               [httpd.result 10 (string) dc err toString] cat
                    202:               /httpd.result set
                    203:             } ifelse
                    204:
                    205:             [httpd.serial 0 eq { } {
                    206:                 (<title> Web/sm1 </title> )
                    207:                 (<font color="blue"> Input-) httpd.serial toString
                    208:                  (: </font> )
                    209:                  httpd.com preformatHTML (<br>)
                    210:               } ifelse
                    211:              (<font color="green"> Output-) httpd.serial toString
                    212:              (: </font> )
1.3       takayama  213:              (<a href=") httpd.image.name ("> (in pretty format) </a>) %%test
1.1       takayama  214:               httpd.result preformatHTML
1.4       takayama  215:               httpd.result.history httpd.result append /httpd.result.history set
1.1       takayama  216:             ] cat
1.3       takayama  217:             send-page-3  exit  %% exit the loop LOOP-A
1.1       takayama  218:           } { exit } ifelse  %% metaCommand
                    219:         } ifelse
1.3       takayama  220:   } loop %% LOOP-A
1.1       takayama  221:   ] pop
                    222:   popVariables
                    223: } def
                    224:
                    225:
1.3       takayama  226:
1.1       takayama  227: /httpd.sm1man
1.17    ! takayama  228:  ("http://www.math.sci.kobe-u.ac.jp/OpenXM/Current/doc/kan96xx/onlinehelp/index.html")
1.1       takayama  229: def
                    230: /httpd.sm1man.index
1.17    ! takayama  231:   ("http://www.math.sci.kobe-u.ac.jp/OpenXM/Current/doc/asir2000/html-jp/man_262.html#SEC262")
1.1       takayama  232: def
                    233: /httpd.asir.intro
1.17    ! takayama  234:    ("http://www.math.sci.kobe-u.ac.jp/OpenXM/Current/doc/kan96xx/ttt/index.html")
1.1       takayama  235: def
                    236: /send-menu-1 {
                    237:
                    238:   (FILE:) sendln
                    239:   [$<a href="http://localhost:$ httpd.port toString
                    240:    $/?msg=httpdAsirMeta+quit"> Shutdown the sm1 server. </a>, $
                    241:   ] cat sendln
                    242: %%  [$<a href="http://localhost:$ httpd.port toString
                    243: %%   $/?msg=httpdAsirMeta+interrupt"> interrupt </a>, $
                    244: %%  ] cat sendln
                    245:   [$<a href="http://localhost:$ httpd.port toString
                    246:    $/?msg=httpdAsirMeta+save"> save. </a>, $
                    247:   ] cat sendln
                    248:   ( <spacer type=horizontal size=80> ) sendln
                    249:
                    250:   (HELP:) sendln
                    251:   [(<font color="red">
                    252:     <a href=) httpd.sm1man ( > Sm1manual (Ja) </a> </font>, )] cat sendln
                    253:   [(<font color="blue">
                    254:     <a href=) httpd.asir.intro ( > Intro (Ja) </a> </font>, )] cat sendln
                    255: } def
                    256:
                    257: /send-page-save {
                    258:  [/in-send-page-save /i] pushVariables
                    259:  [
                    260:    (HTTP/0.9 200 OK) sendln
                    261:    (Connection: close) sendln
                    262:    (Content-Type: text/plain) sendln
                    263:    0 sendln
                    264:    [37 (string) dc ( Saved the following to sm1out.txt )] cat sendln
                    265:    [37 (string) dc ( Save the following by your browser as a text file. )]
                    266:    cat sendln
                    267:
                    268:    0 1 httpd.history length 1 sub {
                    269:      /i set
                    270:      httpd.history i get sendln
                    271:    } for
                    272:    (  ) sendln
                    273:    0 sendln
                    274:    [(flush)] extension
                    275:    [(PrintDollar) 1] system_variable
                    276:    httpd.history output
                    277:    [(PrintDollar) 0] system_variable
                    278:  ] pop
                    279:  popVariables
                    280: } def
                    281:
                    282:
                    283: /metaCommand {
                    284:   /arg1 set
                    285:   [/in-metaCommand /msg /result] pushVariables
                    286:   [
                    287:     /msg arg1 def
                    288:     /result 1 def
                    289:     msg (httpdAsirMeta quit) eq {
                    290:        ox.ccc ( quit ) oxsubmit
                    291:        ox.ccc oxshutdown
                    292:        send-page-bye
                    293:        quit
                    294:        /result 0 def
                    295:     } { } ifelse
                    296:     msg (httpdAsirMeta save) eq {
                    297:        send-page-save
                    298:        /result 0 def
                    299:     } { } ifelse
                    300:     msg (httpdAsirMeta interrupt) eq {
                    301:        ox.ccc oxreset
                    302:        (Interrupted! <br>) send-page-3
                    303:        /result 0 def
                    304:     } { } ifelse
                    305:     /arg1 result def
                    306:   ] pop
                    307:   popVariables
                    308:   arg1
                    309: } def

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