make WWW_Find work again, now that its ML modules reside within a theory context (cf. bf5b45870110) -- patch by Rafal Kolanski; Isabelle2013
authorwenzelm
Mon, 11 Feb 2013 14:39:04 +0100
changeset 51085 d90218288d51
parent 51084 cbae5c5ffd23
child 51086 f24c68eb8e75
make WWW_Find work again, now that its ML modules reside within a theory context (cf. bf5b45870110) -- patch by Rafal Kolanski;
src/Tools/WWW_Find/Start_WWW_Find.thy
src/Tools/WWW_Find/doc/design.tex
src/Tools/WWW_Find/lib/Tools/wwwfind
src/Tools/WWW_Find/scgi_server.ML
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Tools/WWW_Find/Start_WWW_Find.thy	Mon Feb 11 14:39:04 2013 +0100
@@ -0,0 +1,14 @@
+(* Load this theory to start the WWW_Find server on port defined by environment
+   variable "SCGIPORT". Used by the isabelle wwwfind tool.
+*)
+
+theory Start_WWW_Find imports WWW_Find begin
+
+ML {*
+  YXML_Find_Theorems.init ();
+  val port = OS.Process.getEnv "SCGIPORT" |> the |> Int.fromString |> the;
+  ScgiServer.server' 10 "/" port;
+*}
+
+end
+
--- a/src/Tools/WWW_Find/doc/design.tex	Sun Feb 10 22:07:56 2013 +0100
+++ b/src/Tools/WWW_Find/doc/design.tex	Mon Feb 11 14:39:04 2013 +0100
@@ -267,8 +267,6 @@
 print mode of Isabelle, but the form fields and page structure were manually 
 implemented.
 
-The module is built by using a \texttt{ROOT.ML} file inside a heap that 
-contains the theories to be searched.
 The server is started by calling \texttt{ScgiServer.server}.
 Scripts have been created to automate this process.
 
--- a/src/Tools/WWW_Find/lib/Tools/wwwfind	Sun Feb 10 22:07:56 2013 +0100
+++ b/src/Tools/WWW_Find/lib/Tools/wwwfind	Mon Feb 11 14:39:04 2013 +0100
@@ -124,17 +124,20 @@
 
 WWWPORT=`sed -e 's/[ 	]*//g' -ne 's/server.port=\([0-9][0-9]*\),\?/\1/p' "$WWWCONFIG"`
 SCGIPORT=`sed -e 's/[ 	]*//g' -ne 's/"port"=>\([0-9][0-9]*\),\?/\1/p' "$WWWCONFIG"`
-MLSTARTSERVER="YXML_Find_Theorems.init (); ScgiServer.server' 10 \"/\" $SCGIPORT;"
+
+# inform theory which SCGI port to use via environment variable
+export SCGIPORT
+MLSTARTSERVER="use_thy \"Start_WWW_Find\";"
 
 case "$COMMAND" in
   start)
     "$LIGHTTPD" -f "$WWWCONFIG"
     if [ "$LOGFILE" = true ]; then
       (cd "$WWWFINDDIR"; \
-       nohup "$ISABELLE_PROCESS" -r -u -e "$MLSTARTSERVER" "$INPUT") &
+       nohup "$ISABELLE_PROCESS" -r -e "$MLSTARTSERVER" "$INPUT") &
     else
       (cd "$WWWFINDDIR"; \
-       nohup "$ISABELLE_PROCESS" -r -u -e "$MLSTARTSERVER" \
+       nohup "$ISABELLE_PROCESS" -r -e "$MLSTARTSERVER" \
          "$INPUT" > /dev/null 2> /dev/null) &
     fi
     ;;
--- a/src/Tools/WWW_Find/scgi_server.ML	Sun Feb 10 22:07:56 2013 +0100
+++ b/src/Tools/WWW_Find/scgi_server.ML	Mon Feb 11 14:39:04 2013 +0100
@@ -103,7 +103,7 @@
         loop ()
       end;
   in
-    tracing ("SCGI server started.");
+    tracing ("SCGI server started on port " ^ string_of_int port ^ ".");
     dump_handlers ();
     loop ();
     Socket.close passive_sock