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

1.10    ! takayama    1: %% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-sm1.sm1,v 1.9 2001/08/23 00:49:00 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:
                     44: /websm1 {
                     45:  [/rrr ] pushVariables
                     46:  [
                     47:   %% This procedure to generate port number might fail.
                     48:   [(oxGenPass)] extension . (integer) dc  /rrr set
                     49:   rrr << rrr 20000 idiv 20000 mul >> sub /rrr set
                     50:   /httpd.port 1200 rrr add def
                     51:   httpd.port message
                     52:
1.2       takayama   53: %  [(sleep 3; start iexplore http://localhost:)
                     54: %    httpd.port toString
                     55: %   ( &)] cat system
1.6       takayama   56:    [(ostype)] extension 0 get
                     57:    (windows) eq {
                     58:      %% On windows.
                     59:       [(forkExec)
                     60:        [
                     61:          (c:/windows/command/start)
                     62:          (iexplore)   %% Starting internet explorer (TM).
                     63:          [(http://localhost:) httpd.port toString] cat
                     64:        ]
                     65:        [  ]
                     66:       3] extension
                     67:    }{
                     68:       %% On unix.
                     69:       [(sleep 3 ; netscape http://localhost:) httpd.port toString ( & ) ] cat
                     70:       system
                     71:    } ifelse
1.1       takayama   72:    httpd ;
                     73:   ] pop
                     74:   popVariables
                     75: } def
                     76:
                     77:
                     78: /httpd_action {
                     79:   [/in-httpd /ff /httpd.com /httpd.result /sss
1.3       takayama   80:    /sss.engine /sss.web /err /httpd.sendFile
1.9       takayama   81:    /oxserver.vname
1.1       takayama   82:   ] pushVariables
                     83:   [
                     84:   {
                     85:        [(sm1.socket) (select) [httpd.server.fd 0 get -1]] extension
                     86:        %%     wait for ever
                     87:         [(sm1.socket) (read) [httpd.server.fd 0 get ]] extension /ff set
                     88:         ff length 0 eq {
                     89:            (connection is closed.) message
                     90:         }
                     91:         {
                     92:           (------------  start ----------------------) message
                     93:              ff message
                     94:           (-----------------------------------------) message
1.3       takayama   95:              ff 1 copy askToSendFile /httpd.sendFile set
                     96:              httpd.sendFile tag 0 eq {
                     97:                ff removeGET webstringToAscii /httpd.com set
                     98:              } {
                     99:                /httpd.com (NONE) def
                    100:              } ifelse
                    101:              [(httpd.com=) httpd.com] cat message
                    102:              (httpd.sendFile=) messagen httpd.sendFile message
1.1       takayama  103:           (------------  end ----------------------) message
                    104:           (   ) message
                    105:           httpd.serial 0 eq {
                    106:             /httpd.com  httpd.initialization def
                    107:           } { } ifelse
1.3       takayama  108:           httpd.sendFile tag 0 eq { }
                    109:           {
                    110:             httpd.sendFile httpd.image.type send-image
                    111:             exit  %% exit the loop LOOP-A
                    112:           } ifelse
1.1       takayama  113:           httpd.com metaCommand {
                    114:             httpd.textarea.valid {
1.9       takayama  115:               /oxserver.vname
                    116:                 [Oxserver_history_variable httpd.serial toString] cat
                    117:               def
1.1       takayama  118:               ox.ccc
1.9       takayama  119:                [
                    120:                  httpd.com
                    121:                  (  /) oxserver.vname (  set )
                    122:                  oxserver.vname ( )
                    123:                ] cat
1.1       takayama  124:               oxexecutestring ;
                    125:             }{
                    126:               send-page-warning  exit
                    127:             } ifelse
                    128:             [(oxReq) ox.ccc SM_dupErrors ] extension pop
                    129:
                    130:             [(oxReq) ox.ccc SM_popCMO ] extension pop
                    131:             [(oxReq) ox.ccc SM_popString ] extension pop
                    132:             [(flush)] extension pop
                    133:             %% Select inputs for interruption.
                    134:             %% Wait by the spin lock.
                    135:             {
                    136:               [(oxMultiSelect) [ox.ccc] 1] extension 1 get 0 get
                    137:               /sss.engine set
                    138:               [(sm1.socket) (mselect)
                    139:                 [[httpd.server.fd 0 get] 1]
                    140:               ] extension 0 get /sss.web set
                    141:               /sss [sss.engine sss.web] def
                    142:               sss.engine { exit } { } ifelse
                    143:               sss.web    { exit } { } ifelse
                    144:             } loop
                    145:             sss message
                    146:
                    147:             sss 0 get {
                    148:                 [(oxGet) ox.ccc] extension  /err          set
                    149:                 [(oxGet) ox.ccc] extension  /httpd.result set
                    150:                 %% ox.ccc oxpopstring /httpd.result set
                    151:             } {
                    152:                 ox.ccc oxreset
                    153:                 ox.ccc ("computation is interrupted.";) oxexecutestring ;
                    154:                 ox.ccc oxpopstring
                    155:                 /httpd.result set
                    156:                 exit
                    157:             } ifelse
                    158:             (------------- result -------------) message
                    159:             httpd.result message
                    160:             (----------------------------------) message
                    161:             (  ) message
                    162:
                    163:             err message
                    164:             err [ ] eq  {
                    165:               /httpd.history
                    166:                 httpd.history
                    167:                 [10 (string) dc
                    168:                  37 (string) dc httpd.serial toString
                    169:                  10 (string) dc
                    170:                   httpd.com
                    171:                  ( )  %% add extra ;
                    172:                  ] cat
                    173:                 append
                    174:               def
                    175:             } {
                    176:               ox.ccc cleanErrors
                    177:               [httpd.result 10 (string) dc err toString] cat
                    178:               /httpd.result set
                    179:             } ifelse
                    180:
                    181:             [httpd.serial 0 eq { } {
                    182:                 (<title> Web/sm1 </title> )
                    183:                 (<font color="blue"> Input-) httpd.serial toString
                    184:                  (: </font> )
                    185:                  httpd.com preformatHTML (<br>)
                    186:               } ifelse
                    187:              (<font color="green"> Output-) httpd.serial toString
                    188:              (: </font> )
1.3       takayama  189:              (<a href=") httpd.image.name ("> (in pretty format) </a>) %%test
1.1       takayama  190:               httpd.result preformatHTML
1.4       takayama  191:               httpd.result.history httpd.result append /httpd.result.history set
1.1       takayama  192:             ] cat
1.3       takayama  193:             send-page-3  exit  %% exit the loop LOOP-A
1.1       takayama  194:           } { exit } ifelse  %% metaCommand
                    195:         } ifelse
1.3       takayama  196:   } loop %% LOOP-A
1.1       takayama  197:   ] pop
                    198:   popVariables
                    199: } def
                    200:
                    201:
1.3       takayama  202:
1.1       takayama  203: /httpd.sm1man
1.5       takayama  204:  ("http://www.math.sci.kobe-u.ac.jp/OpenXM/1.1.3/doc/kan96xx/onlinehelp/index.html")
1.1       takayama  205: def
                    206: /httpd.sm1man.index
                    207:   ("http://www.math.sci.kobe-u.ac.jp/OpenXM/1.1.3/doc/asir2000/html-jp/man_262.html#SEC262")
                    208: def
                    209: /httpd.asir.intro
1.5       takayama  210:    ("http://www.math.sci.kobe-u.ac.jp/OpenXM/1.1.3/doc/kan96xx/ttt/index.html")
1.1       takayama  211: def
                    212: /send-menu-1 {
                    213:
                    214:   (FILE:) sendln
                    215:   [$<a href="http://localhost:$ httpd.port toString
                    216:    $/?msg=httpdAsirMeta+quit"> Shutdown the sm1 server. </a>, $
                    217:   ] cat sendln
                    218: %%  [$<a href="http://localhost:$ httpd.port toString
                    219: %%   $/?msg=httpdAsirMeta+interrupt"> interrupt </a>, $
                    220: %%  ] cat sendln
                    221:   [$<a href="http://localhost:$ httpd.port toString
                    222:    $/?msg=httpdAsirMeta+save"> save. </a>, $
                    223:   ] cat sendln
                    224:   ( <spacer type=horizontal size=80> ) sendln
                    225:
                    226:   (HELP:) sendln
                    227:   [(<font color="red">
                    228:     <a href=) httpd.sm1man ( > Sm1manual (Ja) </a> </font>, )] cat sendln
                    229:   [(<font color="blue">
                    230:     <a href=) httpd.asir.intro ( > Intro (Ja) </a> </font>, )] cat sendln
                    231: } def
                    232:
                    233: /send-page-save {
                    234:  [/in-send-page-save /i] pushVariables
                    235:  [
                    236:    (HTTP/0.9 200 OK) sendln
                    237:    (Connection: close) sendln
                    238:    (Content-Type: text/plain) sendln
                    239:    0 sendln
                    240:    [37 (string) dc ( Saved the following to sm1out.txt )] cat sendln
                    241:    [37 (string) dc ( Save the following by your browser as a text file. )]
                    242:    cat sendln
                    243:
                    244:    0 1 httpd.history length 1 sub {
                    245:      /i set
                    246:      httpd.history i get sendln
                    247:    } for
                    248:    (  ) sendln
                    249:    0 sendln
                    250:    [(flush)] extension
                    251:    [(PrintDollar) 1] system_variable
                    252:    httpd.history output
                    253:    [(PrintDollar) 0] system_variable
                    254:  ] pop
                    255:  popVariables
                    256: } def
                    257:
                    258:
                    259: /metaCommand {
                    260:   /arg1 set
                    261:   [/in-metaCommand /msg /result] pushVariables
                    262:   [
                    263:     /msg arg1 def
                    264:     /result 1 def
                    265:     msg (httpdAsirMeta quit) eq {
                    266:        ox.ccc ( quit ) oxsubmit
                    267:        ox.ccc oxshutdown
                    268:        send-page-bye
                    269:        quit
                    270:        /result 0 def
                    271:     } { } ifelse
                    272:     msg (httpdAsirMeta save) eq {
                    273:        send-page-save
                    274:        /result 0 def
                    275:     } { } ifelse
                    276:     msg (httpdAsirMeta interrupt) eq {
                    277:        ox.ccc oxreset
                    278:        (Interrupted! <br>) send-page-3
                    279:        /result 0 def
                    280:     } { } ifelse
                    281:     /arg1 result def
                    282:   ] pop
                    283:   popVariables
                    284:   arg1
                    285: } def

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