=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/Doc/httpd-sm1.sm1,v retrieving revision 1.2 retrieving revision 1.3 diff -u -p -r1.2 -r1.3 --- OpenXM/src/kan96xx/Doc/httpd-sm1.sm1 2001/08/10 08:33:03 1.2 +++ OpenXM/src/kan96xx/Doc/httpd-sm1.sm1 2001/08/12 03:13:35 1.3 @@ -1,14 +1,17 @@ -%% $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.2 2001/08/10 08:33:03 takayama Exp $ %% http server by sm1 +%% Note to run on the Windows (TM). %% (A) You need to set IE (internet explorer) as follows: %% (1) Visit the menu %% 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 -%% (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.initialization @@ -20,11 +23,27 @@ ] cat def -[(parse) (ox-win.sm1) pushfile] extension +[(getenv) (OSTYPE)] extension +tag 0 eq { + [(parse) (ox-win.sm1) pushfile] extension +}{ + [(getenv) (OSTYPE)] extension + (cygwin) eq { + [(parse) (ox-win.sm1) pushfile] extension + }{ + [(parse) (ox.sm1) pushfile] extension + } ifelse +} ifelse + (ox_sm1.started) boundp { } { - %% Initialize oxasir. - sm1connectr_win + %% Initialize ox_sm1 + [(getenv) (OSTYPE)] extension + tag 0 eq { + sm1connectr_win %% Assume that it is native Windows. + }{ + sm1connectr %% cygwin or unix. + } ifelse ox.ccc oxmathcap ox.ccc oxsetmathcap } ifelse @@ -83,7 +102,7 @@ def 10 (string) dc /mmm set } ifelse [(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 } ifelse @@ -91,6 +110,29 @@ def popVariables } 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.serial 0 def /httpd.history [ ] def @@ -105,7 +147,7 @@ def /httpd_action { [/in-httpd /ff /httpd.com /httpd.result /sss - /sss.engine /sss.web /err + /sss.engine /sss.web /err /httpd.sendFile ] pushVariables [ { @@ -119,13 +161,24 @@ def (------------ start ----------------------) message ff message (-----------------------------------------) message - ff removeGET webstringToAscii /httpd.com set - httpd.com message + ff 1 copy askToSendFile /httpd.sendFile set + 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 ( ) message httpd.serial 0 eq { /httpd.com httpd.initialization def } { } ifelse + httpd.sendFile tag 0 eq { } + { + httpd.sendFile httpd.image.type send-image + exit %% exit the loop LOOP-A + } ifelse httpd.com metaCommand { httpd.textarea.valid { ox.ccc @@ -195,12 +248,13 @@ def } ifelse ( Output-) httpd.serial toString (: ) + ( (in pretty format) ) %%test httpd.result preformatHTML ] cat - send-page-3 exit + send-page-3 exit %% exit the loop LOOP-A } { exit } ifelse %% metaCommand } ifelse - } loop + } loop %% LOOP-A ] pop popVariables } def @@ -250,6 +304,10 @@ def 0 sendln %% (
) sendln result sendln + + %%( ) sendln %%test. It does not work always?! + %%( Pretty format ) sendln %%test. It works. + () sendln () sendln [(