Commit 01b15475 authored by Pietro Abate's avatar Pietro Abate

[r2003-06-29 14:41:57 by cvscast] Bug fix in webiface \ SESSION_DIR in Makefile

Original author: cvscast
Date: 2003-06-29 14:41:58+00:00
parent 43aa937b
......@@ -17,3 +17,4 @@ EXPAT = false
WEB_PREFIX = /var/www
CGI_DIR = $(WEB_PREFIX)/cgi-bin
CDUCE_HTML_DIR = $(WEB_PREFIX)/html
SESSION_DIR = /tmp/cduce_sessions
......@@ -11,7 +11,8 @@ endif
SYNTAX = camlp4o -I misc/ pa_extend.cmo \
q_symbol.cmo \
-symbol cduce_version=\"$(VERSION)\" \
-symbol build_date=\"$(shell date +%Y-%m-%d)\"
-symbol build_date=\"$(shell date +%Y-%m-%d)\" \
-symbol session_dir=\"$(SESSION_DIR)\"
ifeq ($(NATIVE), true)
SYNTAX += -symbol ocaml_compiler=\"native\"
......@@ -166,5 +167,8 @@ install_web_local:web/files webiface
cp web/img/*.* $(CDUCE_HTML_DIR)/img
local_website: cduce
local_website: cduce webiface
(cd web; ../cduce --quiet site.cd --arg site.xml)
cp web/www/*.html web/cduce.css $(CDUCE_HTML_DIR)/
cp webiface $(CGI_DIR)/cduce
......@@ -25,6 +25,9 @@ let print_sample ppf s =
Location.protect ppf
(fun ppf -> Sample.print ppf s)
let print_protect ppf s =
Location.protect ppf (fun ppf -> Format.fprintf ppf "%s" s)
let print_value ppf v =
Location.protect ppf (fun ppf -> Value.print ppf v)
......@@ -106,8 +109,8 @@ let debug ppf = function
Format.fprintf ppf "[DEBUG:subtype]@.";
let t1 = Types.descr (Typer.typ t1)
and t2 = Types.descr (Typer.typ t2) in
Format.fprintf ppf "%a <= %a : %b@." print_norm t1 print_norm t2
(Types.subtype t1 t2)
let s = Types.subtype t1 t2 in
Format.fprintf ppf "%a %a %a : %b@." print_norm t1 print_protect "<=" print_norm t2 s
| `Sample t ->
Format.fprintf ppf "[DEBUG:sample]@.";
(try
......@@ -191,7 +194,7 @@ let rec phrases ppf phs = match phs with
insert_bindings ppf typs vals;
phrases ppf rest
| { descr = Ast.Debug l } :: rest ->
debug ppf l;
debug ppf l;
phrases ppf rest
| { descr = Ast.Directive `Quit } :: rest ->
if !toplevel then raise End_of_file;
......
(* TODO:
- correct error messages, not failwith "..."
- HTML design, logo
- dump
*)
open Netcgi
......@@ -26,12 +24,22 @@ let fatal_error title s =
(* Configuration *)
let session_dir = <:symbol<session_dir>>
let () =
if not (Sys.file_exists session_dir) then
try Unix.mkdir session_dir 0o755
with Unix.Unix_error(_,_,_)-> fatal_error "Fatal error" "Cannot create session directory"
(*
let session_dirs = ["/usr/local/tmp/"; "/home/beppe/sessions"; "/home/frisch/sessions";
"/users/formel/cduce/sessions"; "/home/zack/cduce/sessions"; "/tmp" ]
let session_dir =
try List.find Sys.file_exists session_dirs
with Not_found -> fatal_error "Internal error"
"Cannot find sessions directory"
*)
let timeout = 60 * 5 (* seconds *)
let max_sess = 10
......@@ -241,7 +249,7 @@ let main (cgi : Netcgi.std_activation) =
State.set s);
close_in chan;
with Sys_error _ ->
failwith "This session has expired ..."
fatal_error "Fatal error" "This session has expired ..."
in
let store_state () =
......
......@@ -73,8 +73,10 @@ let print_loc ppf ((src,i,j),w) =
l1 c1 l2 c2 print_precise w fn
let extr s i j =
Netencoding.Html.encode_from_latin1
(String.sub s i (j - i))
try
Netencoding.Html.encode_from_latin1
(String.sub s i (j - i))
with e -> failwith "Location.extr"
let dump_loc ppf ((src,i,j),w) =
match (src, !viewport) with
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment