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

Diff for /OpenXM/src/kan96xx/Doc/httpd-sm1.sm1 between version 1.2 and 1.7

version 1.2, 2001/08/10 08:33:03 version 1.7, 2001/08/21 14:21:29
Line 1 
Line 1 
 %% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-sm1.sm1,v 1.1 2001/08/09 13:05:49 takayama Exp $  %% $OpenXM: OpenXM/src/kan96xx/Doc/httpd-sm1.sm1,v 1.6 2001/08/21 14:12:45 takayama Exp $
 %% http server by sm1  %% http server by sm1
   %% Note to run on the Windows (TM).
 %% (A) You need to set IE (internet explorer) as follows:  %% (A) You need to set IE (internet explorer) as follows:
 %%   (1) Visit the menu  %%   (1) Visit the menu
 %%     tool / internet option / connection / LAN configuration  %%     tool / internet option / connection / LAN configuration
 %%   (2) Add localhost to the list of not using the proxy server.  %%   (2) Add localhost to the list of hosts which are not accessed via
   %%        the proxy server.
 %% (B) You need to have the "start.exe" at  c:\windows\command\start.exe  %% (B) You need to have the "start.exe" at  c:\windows\command\start.exe
 %% (C) cygwin1.dll should be by sm1.exe and ox.exe  %% (C) cygwin1.dll should be by sm1.exe, ox_sm1.exe and ox.exe
   
   
   /httpd.image.name (kobeuniv2.jpg) def
   /httpd.image.type (jpeg) def
 /httpd.port 1200 def  /httpd.port 1200 def
   
 /httpd.initialization  /httpd.initialization
Line 20 
Line 23 
  ] cat   ] cat
 def  def
   
 [(parse) (ox-win.sm1) pushfile] extension  [(ostype)] extension 0 get
   (windows) eq {
     %% Native windows environment or cygwin.
     [(parse) (ox-win.sm1) pushfile] extension
   }{
     [(parse) (ox.sm1) pushfile] extension
   } ifelse
   
 (ox_sm1.started) boundp {  (ox_sm1.started) boundp {
 } {  } {
   %% Initialize oxasir.    %% Initialize ox_sm1
   sm1connectr_win    [(ostype)] extension 0 get
     (windows) eq {
       [(getenv) (OSTYPE)] extension
       (cygwin) eq {
         sm1connectr      %% Cygwin
       }{
         sm1connectr_win  %% Native Windows.
       } ifelse
     }{
        sm1connectr      %% Unix
     } ifelse
   ox.ccc oxmathcap    ox.ccc oxmathcap
   ox.ccc oxsetmathcap    ox.ccc oxsetmathcap
 } ifelse  } ifelse
Line 41  def
Line 61  def
 %  [(sleep 3; start iexplore http://localhost:)  %  [(sleep 3; start iexplore http://localhost:)
 %    httpd.port toString  %    httpd.port toString
 %   ( &)] cat system  %   ( &)] cat system
    [(forkExec)     [(ostype)] extension 0 get
     [     (windows) eq {
       (c:/windows/command/start)       %% On windows.
       (iexplore)   %% Starting internet explorer (TM).        [(forkExec)
       [(http://localhost:) httpd.port toString] cat         [
     ]           (c:/windows/command/start)
     [  ]           (iexplore)   %% Starting internet explorer (TM).
    3] extension           [(http://localhost:) httpd.port toString] cat
          ]
          [  ]
         3] extension
      }{
         %% On unix.
         [(sleep 3 ; netscape http://localhost:) httpd.port toString ( & ) ] cat
         system
      } ifelse
    httpd ;     httpd ;
   ] pop    ] pop
   popVariables    popVariables
Line 83  def
Line 111  def
     10 (string) dc /mmm set      10 (string) dc /mmm set
   } ifelse    } ifelse
   [(sm1.socket) (select) [httpd.server.fd 0 get 0]] extension {    [(sm1.socket) (select) [httpd.server.fd 0 get 0]] extension {
     (Warning: your peer closed the connection. Do not send the data.) message      (Warning (sendln): your peer closed the connection. Do not send the data.) message
   } {    } {
     [(sm1.socket) (write) [httpd.server.fd 0 get mmm]] extension message      [(sm1.socket) (write) [httpd.server.fd 0 get mmm]] extension message
   } ifelse    } ifelse
Line 91  def
Line 119  def
  popVariables   popVariables
 } def  } def
   
   /sendBinaryFile {
    /arg1 set
    [/in-sendln /fname /fd /c /cdata] pushVariables
    [ arg1 /fname set
      [(sendBinaryFile: sending data) ] cat message
      [(fp2openForRead) fname] extension /fd set  fd message
      fd 0 lt {
         [(Error: sendBinaryFile: file ) fname ( is not found.)] cat message
         /aaaa goto
      } {  } ifelse
      [(fp2pushfile) fname] extension /cdata set
      [(sm1.socket) (select) [httpd.server.fd 0 get 0]] extension {
          (Warning (sendBinaryFile): your peer closed the connection. Do not send the data.)
          message
          exit
      } {
          [(sm1.socket) (writeByte) [httpd.server.fd 0 get cdata]] extension pop
      } ifelse
      /aaaa
    ] pop
    popVariables
   } def
   
 /httpd {  /httpd {
   /httpd.serial 0 def    /httpd.serial 0 def
   /httpd.history [ ] def    /httpd.history [ ] def
     /httpd.result.history [ 0 ] def
   {    {
     httpd_startserver ;      httpd_startserver ;
     httpd_action ;      httpd_action ;
Line 105  def
Line 157  def
   
 /httpd_action {  /httpd_action {
   [/in-httpd /ff /httpd.com /httpd.result /sss    [/in-httpd /ff /httpd.com /httpd.result /sss
    /sss.engine /sss.web /err     /sss.engine /sss.web /err /httpd.sendFile
   ] pushVariables    ] pushVariables
   [    [
   {    {
Line 119  def
Line 171  def
           (------------  start ----------------------) message            (------------  start ----------------------) message
              ff message               ff message
           (-----------------------------------------) message            (-----------------------------------------) message
              ff removeGET webstringToAscii /httpd.com set               ff 1 copy askToSendFile /httpd.sendFile set
              httpd.com message               httpd.sendFile tag 0 eq {
                  ff removeGET webstringToAscii /httpd.com set
                } {
                  /httpd.com (NONE) def
                } ifelse
                [(httpd.com=) httpd.com] cat message
                (httpd.sendFile=) messagen httpd.sendFile message
           (------------  end ----------------------) message            (------------  end ----------------------) message
           (   ) message            (   ) message
           httpd.serial 0 eq {            httpd.serial 0 eq {
             /httpd.com  httpd.initialization def              /httpd.com  httpd.initialization def
           } { } ifelse            } { } ifelse
             httpd.sendFile tag 0 eq { }
             {
               httpd.sendFile httpd.image.type send-image
               exit  %% exit the loop LOOP-A
             } ifelse
           httpd.com metaCommand {            httpd.com metaCommand {
             httpd.textarea.valid {              httpd.textarea.valid {
               ox.ccc                ox.ccc
Line 195  def
Line 258  def
               } ifelse                } ifelse
              (<font color="green"> Output-) httpd.serial toString               (<font color="green"> Output-) httpd.serial toString
              (: </font> )               (: </font> )
                (<a href=") httpd.image.name ("> (in pretty format) </a>) %%test
               httpd.result preformatHTML                httpd.result preformatHTML
                 httpd.result.history httpd.result append /httpd.result.history set
             ] cat              ] cat
             send-page-3  exit              send-page-3  exit  %% exit the loop LOOP-A
           } { exit } ifelse  %% metaCommand            } { exit } ifelse  %% metaCommand
         } ifelse          } ifelse
   } loop    } loop %% LOOP-A
   ] pop    ] pop
   popVariables    popVariables
 } def  } def
Line 250  def
Line 315  def
    0 sendln     0 sendln
 %%   (<FORM NAME="myFORM" METHOD="POST">) sendln  %%   (<FORM NAME="myFORM" METHOD="POST">) sendln
    result sendln     result sendln
   
      %%(<img src="hoge.jpeg"> <img>) sendln %%test.  It does not work always?!
      %%(<a href="hoge.jpeg"> Pretty format </a>) sendln %%test. It works.
   
    (<FORM NAME="myFORM">) sendln     (<FORM NAME="myFORM">) sendln
    (<INPUT TYPE=submit VALUE="submit">) sendln     (<INPUT TYPE=submit VALUE="submit">) sendln
    [(<textarea name=) httpd.textarea.name     [(<textarea name=) httpd.textarea.name
Line 262  def
Line 331  def
   popVariables    popVariables
 } def  } def
   
   /send-image {
     /arg2 set
     /arg1 set
     [/in-send-jpeg /fname /imagetype /ff /fsize] pushVariables
     [
        /fname arg1 def % set the jpeg file name.
        /imagetype arg2 def %  jpeg or gif
       [(stat) fname] extension 0 get tag 0 eq {
          (Warning (send-image): the file ) messagen fname messagen ( is not found.) message
          /notFound goto
       }{  }ifelse
       [(stat) fname] extension 1 get 0 get toString /fsize set
       (HTTP/1.1 200 OK) dup message sendln
       (Server: httpd_sm1) dup message sendln
       %% (ETag: "2197-bf6c-3b2d6541") sendln ???
       (Accept-Ranges: bytes) dup message sendln
       [(Content-Length: ) fsize] cat dup message sendln
       (Connection: close) dup message sendln
       [(Content-Type: image/) imagetype] cat dup message sendln
       [(flush)] extension
       0 sendln
       fname sendBinaryFile
       0 sendln
       [(flush)] extension
       /notFound
     ] pop
     popVariables
   } def
   
 /httpd.sm1man  /httpd.sm1man
  ("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/1.1.3/doc/kan96xx/onlinehelp/index.html")
 def  def
 /httpd.sm1man.index  /httpd.sm1man.index
   ("http://www.math.sci.kobe-u.ac.jp/OpenXM/1.1.3/doc/asir2000/html-jp/man_262.html#SEC262")    ("http://www.math.sci.kobe-u.ac.jp/OpenXM/1.1.3/doc/asir2000/html-jp/man_262.html#SEC262")
 def  def
 /httpd.asir.intro  /httpd.asir.intro
    ("http://www.math.sci.kobe-u.ac.jp/~taka/asir-book-html/main")     ("http://www.math.sci.kobe-u.ac.jp/OpenXM/1.1.3/doc/kan96xx/ttt/index.html")
 def  def
 /send-menu-1 {  /send-menu-1 {
   
Line 288  def
Line 386  def
   (HELP:) sendln    (HELP:) sendln
   [(<font color="red">    [(<font color="red">
     <a href=) httpd.sm1man ( > Sm1manual (Ja) </a> </font>, )] cat sendln      <a href=) httpd.sm1man ( > Sm1manual (Ja) </a> </font>, )] cat sendln
   [(<font color="purple">  
     <a href=) httpd.sm1man.index ( > Index (Ja) </a> </font>, )] cat sendln  
   [(<font color="blue">    [(<font color="blue">
     <a href=) httpd.asir.intro ( > Intro (Ja) </a> </font>, )] cat sendln      <a href=) httpd.asir.intro ( > Intro (Ja) </a> </font>, )] cat sendln
 } def  } def
Line 407  def
Line 503  def
        (array) dc         (array) dc
     def      def
  } ifelse   } ifelse
   
   
   %% Decompose into tokens separated by a space.
   %% (GET /hoge.jpeg ???) ---> [(GET) (/hoge.jpeg) (???)]
   /toTokensBySpace {
     /arg1 set
     [/in-toTokesBySpace /ss /ss2 /i] pushVariables
     [
       /ss arg1 def
       ss 1 copy /ss set
       ss (array) dc /ss2 set
       0 1 ss2 length 1 sub {
         /i set
         ss2 i get 32 eq { %% equal to space
           ss i (,) put
         } {  } ifelse
       } for
       ss message
       [ ss to_records pop] /arg1 set
     ] pop
     popVariables
     arg1
   } def
   
   /askToSendFile {
     /arg1 set
     [/in-askToSendFile /ss /fname] pushVariables
     [
       /ss arg1 def
       /fname null def
       ss toTokensBySpace /ss set
       ss 0 get (GET) eq {
         ss 1 get length 1 gt {
           ss 1 get (array) dc 1 get 63 eq { %% See if /?
             /fname null def
           }{
             /fname ss 1 get def % set the file name.
             fname (array) dc rest /fname set % remove /
             fname { (string) dc } map cat /fname set
           } ifelse
         }{ /fname null def } ifelse
       }{
         /fname null def
       } ifelse
       (::::) messagen  ss message fname message
       /arg1 fname def
     ] pop
     popVariables
     arg1
   } def
   
 %% remove GET /?msg=  %% remove GET /?msg=
 /removeGET {  /removeGET {

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.7

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