aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--Makefile6
-rw-r--r--scripts/coqc.ml7
-rw-r--r--toplevel/coqtop.ml38
3 files changed, 26 insertions, 25 deletions
diff --git a/Makefile b/Makefile
index 350ebc62f..ac5621dbd 100644
--- a/Makefile
+++ b/Makefile
@@ -44,7 +44,7 @@ OCAMLOPT_P4O=$(OCAMLOPT) -pp $(CAMLP4O) $(OPTFLAGS)
CAMLP4EXTENDFLAGS=-I . pa_extend.cmo q_MLast.cmo
CAMLP4DEPS=sed -n -e 's|^(\*.*camlp4deps: "\(.*\)".*\*)$$|\1|p'
-COQINCLUDES=-I states -R theories=Coq -R contrib=Coq
+COQINCLUDES=-I states -R theories -as Coq -R contrib -as Coq
# -I contrib/omega -I contrib/ring -I contrib/xml \
# -I theories/Init -I theories/Logic -I theories/Arith \
# -I theories/Bool -I theories/Zarith -I theories/Lists \
@@ -224,7 +224,7 @@ INITVO=theories/Init/Datatypes.vo theories/Init/Peano.vo \
theories/Init/Logic_TypeSyntax.vo
theories/Init/%.vo: theories/Init/%.v states/barestate.coq $(COQC)
- $(COQC) -$(BEST) -bindir bin -q -R theories=Coq -is states/barestate.coq $<
+ $(COQC) -$(BEST) -bindir bin -q -R theories -as Coq -is states/barestate.coq $<
init: $(INITVO)
@@ -235,7 +235,7 @@ tactics/%.vo: tactics/%.v states/barestate.coq $(COQC)
$(COQC) -$(BEST) -bindir bin -q -I tactics -is states/barestate.coq $<
states/initial.coq: states/barestate.coq states/MakeInitial.v $(INITVO) $(TACTICSVO) $(BESTCOQTOP)
- $(BESTCOQTOP) -q -batch -silent -is states/barestate.coq -I tactics -R theories=Coq -load-vernac-source states/MakeInitial.v -outputstate states/initial.coq
+ $(BESTCOQTOP) -q -batch -silent -is states/barestate.coq -I tactics -R theories -as Coq -load-vernac-source states/MakeInitial.v -outputstate states/initial.coq
clean::
rm -f states/*~ states/*.coq
diff --git a/scripts/coqc.ml b/scripts/coqc.ml
index adc521232..ee77b8edb 100644
--- a/scripts/coqc.ml
+++ b/scripts/coqc.ml
@@ -123,9 +123,10 @@ let parse_args () =
| "-opt" :: rem ->
binary := "coqtop.opt"; parse (cfiles,args) rem
| ("-?"|"-h"|"-H"|"-help"|"--help") :: _ -> usage ()
- | ("-image"|"-libdir"|"-I"|"-R"|"-include"|"-outputstate"|"-inputstate"
- |"-is"|"-load-vernac-source"|"-load-vernac-object"|"-load-ml-source"
- |"-require"|"-load-ml-object"|"-user"|"-init-file" as o) :: rem ->
+ | ("-image"|"-libdir"|"-I"|"-R"|"-as"|"-include"|"-outputstate"
+ |"-inputstate"|"-is"|"-load-vernac-source"|"-load-vernac-object"
+ |"-load-ml-source"|"-require"|"-load-ml-object"|"-user"
+ |"-init-file" as o) :: rem ->
begin
match rem with
| s :: rem' -> parse (cfiles,s::o::args) rem'
diff --git a/toplevel/coqtop.ml b/toplevel/coqtop.ml
index cff15a003..402e732c1 100644
--- a/toplevel/coqtop.ml
+++ b/toplevel/coqtop.ml
@@ -29,6 +29,21 @@ let outputstate = ref ""
let set_outputstate s = outputstate:=s
let outputstate () = if !outputstate <> "" then extern_state !outputstate
+let coqpath d =
+ let alias = Filename.basename d in
+ let alias =
+ if alias = "." then
+ Filename.basename (Unix.getcwd ())
+ else if alias = ".." then
+ Filename.basename (Filename.dirname (Unix.getcwd ()))
+ else alias in
+ if not (Names.is_ident alias) then
+ error ("Cannot find a name to which "^d^" may map in Coq library");
+ alias
+let set_include d p = push_include (d,Names.dirpath_of_string p)
+let set_rec_include d p = push_rec_include (d,Names.dirpath_of_string p)
+
+
let load_vernacular_list = ref ([] : string list)
let add_load_vernacular s =
load_vernacular_list := (make_suffix s ".v") :: !load_vernacular_list
@@ -77,33 +92,18 @@ let usage () =
flush stderr ;
exit 1
-let parse_include d =
- try
- let pos = String.index d '=' in
- (String.sub d 0 pos,
- Names.dirpath_of_string (String.sub d (pos+1) (String.length d - pos -1)))
- with Not_found ->
- let alias = Filename.basename d in
- let alias =
- if alias = "." then
- Filename.basename (Unix.getcwd ())
- else if alias = ".." then
- Filename.basename (Filename.dirname (Unix.getcwd ()))
- else alias in
- if not (Names.is_ident alias) then
- error ("Cannot find a name to which "^d^" may map in Coq library");
- (d, [alias])
-
let warning s = wARNING [< 'sTR s >]
let parse_args () =
let rec parse = function
| [] -> ()
- | ("-I"|"-include") :: d :: rem -> push_include (parse_include d);parse rem
+ | ("-I"|"-include") :: d :: "-as" :: p :: rem -> set_include d p; parse rem
+ | ("-I"|"-include") :: d :: rem -> set_include d (coqpath d); parse rem
| ("-I"|"-include") :: [] -> usage ()
- | "-R" :: d :: rem -> push_rec_include (parse_include d); parse rem
+ | "-R" :: d :: "-as" :: p :: rem -> set_rec_include d p; parse rem
+ | "-R" :: d :: rem -> set_rec_include d (coqpath d); parse rem
| "-R" :: [] -> usage ()
| "-q" :: rem -> no_load_rc (); parse rem