version 1.4, 2004/09/27 08:32:05 |
version 1.7, 2004/10/13 12:11:31 |
|
|
% $OpenXM: OpenXM/src/kan96xx/Doc/cgi.sm1,v 1.3 2004/09/27 01:20:46 takayama Exp $ |
% $OpenXM: OpenXM/src/kan96xx/Doc/cgi.sm1,v 1.6 2004/09/28 12:20:39 takayama Exp $ |
% OpenXM/src/polymake/cgi/cgi-polymake.sh |
% OpenXM/src/polymake/cgi/cgi-polymake.sh |
% is a shell script to call sm1/polymake as a CGI script. |
% is a shell script to call sm1/polymake as a CGI script. |
% Override as /doPolymake {doPolymake.OoHG} def if you need. |
% Override as /doPolymake {doPolymake.OoHG} def if you need. |
|
|
|
/cgi.verbose 0 def |
|
|
[(plugin-cgi) |
[(plugin-cgi) |
[(Key words: ) |
[(Key words: ) |
( cgiUrlEncodingToKeyValuePair) |
( cgiUrlEncodingToKeyValuePair) |
|
|
[ |
[ |
/sss arg1 def |
/sss arg1 def |
% Step 1. analyze the query string in URL encoding. |
% Step 1. analyze the query string in URL encoding. |
[(cgiUrlEncodingToKeyValuePair) [(?) sss] cat] extension /kv set |
[(cgiUrlEncodingToKeyValuePair) sss] extension /kv set |
kv (oxMessageBody) getNode /comm set |
kv (oxMessageBody) getNode /comm set |
% [nl nl] cat message sss message kv message % for debug. |
% [nl nl] cat message sss message kv message % for debug. |
% Step 2. Extract action part and file part for polymake. |
% Step 2. Extract action part and file part for polymake. |
|
|
[ |
[ |
/saction arg1 def /sfile arg2 def |
/saction arg1 def /sfile arg2 def |
% step1. Generate query in URL encoding. |
% step1. Generate query in URL encoding. |
[[(URL) cgiQueryPolymake.cginame] |
[[(URL) [(http://) cgiQueryPolymake.hostname cgiQueryPolymake.cginame] cat] |
|
% full URL necessary for virtual host of apache. |
[(oxMessageBody) |
[(oxMessageBody) |
[saction ( ) |
[saction ( ) |
sfile nl ] cat |
sfile nl ] cat |
|
|
[80 cgiQueryPolymake.hostname]] extension 0 get /goo set |
[80 cgiQueryPolymake.hostname]] extension 0 get /goo set |
[(sm1.socket) (write) [goo sss2]] extension |
[(sm1.socket) (write) [goo sss2]] extension |
goo readHTTP0 /pp set |
goo readHTTP0 /pp set |
pp message |
cgi.verbose { pp message } { } ifelse |
[(sm1.socket) (close) [goo]] extension |
[(sm1.socket) (close) [goo]] extension |
[(cgiHttpToKeyValuePair) pp] extension /pp2 set |
[(cgiHttpToKeyValuePair) pp] extension /pp2 set |
|
|
|
|
|
|
% Overrides doPolymake |
% Overrides doPolymake |
%/doPolymake { doPolymake.OoHG } def |
%/doPolymake { doPolymake.OoHG } def |
|
%/polymake.start { polymake.start.OoHG } def |
|
|
[(doPolymake.OoHG) |
[(doPolymake.OoHG) |
[(It first looks for local polymake. If there is, it calls the local polymake.) |
[(It first looks for local polymake. If there is, it calls the local polymake.) |
|
|
(Trying web service.) message |
(Trying web service.) message |
pAction pNative cgiQueryPolymake /doPolymake.OoHG.result set |
pAction pNative cgiQueryPolymake /doPolymake.OoHG.result set |
|
|
|
[(regexec) (Not Found) [doPolymake.OoHG.result 0 get ]] |
|
extension length 0 eq not { |
|
doPolymake.OoHG.result message |
|
(The polymake cgi seems to be out of service.) error |
|
} { } ifelse |
|
|
doPolymake.OoHG.result 0 get /pNative set |
doPolymake.OoHG.result 0 get /pNative set |
|
|
|
|
pError doPolymake.OoHG.result rest append /pError set |
pError doPolymake.OoHG.result rest append /pError set |
} { |
} { |
% local polymake |
% local polymake |
|
|
] pop |
] pop |
popVariables |
popVariables |
arg1 |
arg1 |
|
} def |
|
|
|
/polymake.start.OoHG { |
|
(ox.k0.loaded) boundp { } |
|
{ [(parse) (ox.sm1) pushfile] extension |
|
/@@@polymake.k0.ccc [ ] def |
|
} ifelse |
|
@@@polymake.k0.ccc [ ] eq { |
|
k0connectr /@@@polymake.k0.ccc oxk0.ccc def /oxk0.ccc [ ] def |
|
@@@polymake.k0.ccc oxsetmathcap @@@polymake.k0.ccc oxmathcap |
|
} { } ifelse |
|
@@@polymake.k0.ccc 0 get (closed) eq { |
|
k0connectr /@@@polymake.k0.ccc oxk0.ccc def /oxk0.ccc [ ] def |
|
@@@polymake.k0.ccc oxsetmathcap @@@polymake.k0.ccc oxmathcap |
|
} { } ifelse |
|
[(which) (polymake2tfb)] oxshell tag 0 eq { |
|
(polymake2tfb is not installed in this system.) error |
|
} { } ifelse |
} def |
} def |
|
|
|
|