ocaml-camlp5/0001-added-etc-topfind.caml...

76 lines
1.9 KiB
Diff

From 46067702024061c693fc034bfedf1fce4313c4ce Mon Sep 17 00:00:00 2001
From: Chet Murthy <chetsky@gmail.com>
Date: Tue, 24 Mar 2020 20:06:53 -0700
Subject: [PATCH 01/10] added etc/topfind.camlp5"
---
Makefile | 2 ++
etc/topfind.camlp5 | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 37 insertions(+)
create mode 100644 etc/topfind.camlp5
diff --git a/Makefile b/Makefile
index f6811269..12c69b70 100644
--- a/Makefile
+++ b/Makefile
@@ -57,6 +57,7 @@ install:
for i in $(DIRS) compile; do \
(cd $$i; $(MAKE) install DESTDIR=$(DESTDIR); cd ..); \
done
+ cp etc/topfind.camlp5 "$(DESTDIR)$(LIBDIR)/$(OCAMLN)/."
uninstall:
@if test -z "$(LIBDIR)"; then \
@@ -66,6 +67,7 @@ uninstall:
$(RM) -rf "$(DESTDIR)$(LIBDIR)/$(CAMLP5N)"
cd "$(DESTDIR)$(BINDIR)"; $(RM) -f *$(CAMLP5N)* odyl ocpp; cd ..
cd "$(DESTDIR)$(MANDIR)/man1"; $(RM) -f *$(CAMLP5N)* odyl ocpp
+ $(RM) -f "$(DESTDIR)$(LIBDIR)/$(OCAMLN)/"topfind.camlp5
clean::
$(MAKE) clean_hot clean_cold
diff --git a/etc/topfind.camlp5 b/etc/topfind.camlp5
new file mode 100644
index 00000000..5a260beb
--- /dev/null
+++ b/etc/topfind.camlp5
@@ -0,0 +1,35 @@
+#use "topfind";;
+
+(* Add "#camlp5o" directive: *)
+
+let _ =
+Hashtbl.add
+ Toploop.directive_table
+ "camlp5o"
+ (Toploop.Directive_none
+ Topfind.(fun () ->
+ (*protect*) (fun () ->
+ syntax "camlp5o" ;
+ load_deeply ["camlp5"]) ()
+ )) ;
+
+
+(* Add "#camlp4r" directive: *)
+
+Hashtbl.add
+ Toploop.directive_table
+ "camlp5r"
+ (Toploop.Directive_none
+ Topfind.(fun () ->
+ (*protect*) (fun () ->
+ syntax "camlp5r";
+ load_deeply ["camlp5"]) ()
+ )) ;
+
+
+print_endline
+ ("Additional Camlp5 directives:\n" ^
+ " #camlp5o;; to load camlp5 (standard syntax)\n" ^
+ " #camlp5r;; to load camlp5 (revised syntax)\n" ^
+ "")
+;;
--
2.24.1