OSDN Git Service

move camlp4 pos
authormzp <mzpppp@gmail.com>
Mon, 23 Mar 2009 01:40:32 +0000 (10:40 +0900)
committermzp <mzpppp@gmail.com>
Mon, 23 Mar 2009 01:40:32 +0000 (10:40 +0900)
OMakefile
camlp4/OMakefile [moved from xml/camlp4/OMakefile with 93% similarity]
camlp4/pa_monad.ml [moved from xml/camlp4/pa_monad.ml with 100% similarity]
camlp4/pa_oo.ml [moved from xml/camlp4/pa_oo.ml with 100% similarity]
driver/test/runner [deleted symlink]
scm/src/OMakefile
scm/src/cpool.ml
xml/OMakefile
xml/src/OMakefile

index 23b60e6..d456068 100644 (file)
--- a/OMakefile
+++ b/OMakefile
@@ -18,6 +18,16 @@ Shell. +=
     ocaml-clean(argv) =
       rm -f *.cm[iox] *.o *.omc *.opt *.run *~ $(argv) *.cmxa *.a *.spot *.annot
 
+# ------------------------------
+# camlp4 rules
+# ------------------------------
+public.UseCamlp4(files) =
+       protected.CAMLP4CMO = $(addprefix $(ROOT)/camlp4/,$(addsuffix .cmo,$(files)))
+       OCAMLPPFLAGS+=-pp 'camlp4o $(CAMLP4CMO)'
+       OCAMLDEPFLAGS+=$(OCAMLPPFLAGS)
+       export
+
+       .SCANNER: scan-ocaml-%.ml: %.ml $(CAMLP4CMO)
 
 .PHONY: all install config clean distclean example
 
@@ -76,7 +86,7 @@ base/config.ml:
                @echo 'let path_sep="$(PATHSEP)"' >> $@
                @echo 'let exe="$(EXE)"' >> $@
 
-.SUBDIRS: scm xml driver base lib
+.SUBDIRS: scm xml driver base lib camlp4
 
 # ------------------------------
 # all
similarity index 93%
rename from xml/camlp4/OMakefile
rename to camlp4/OMakefile
index 676044c..28b289c 100644 (file)
@@ -4,7 +4,7 @@
 .PHONY: clean
 
 clean:
-       rm -f *.cm[iox] *~ *.o *.omc
+       ocaml-clean
 
 ########################################################################
 # OCaml configuration.
@@ -19,7 +19,7 @@ USE_OCAMLFIND = false
 OCAMLINCLUDES += -I +camlp4
 
 #
-# Compile native or byte code? 
+# Compile native or byte code?
 #
 # The default values are defined as follows:
 #
@@ -41,5 +41,4 @@ OCAMLDEPFLAGS += $(OCAMLPPFLAGS)
 # Build an OCaml program
 #
 OCamlProgram(pa_oo,pa_oo)
-
 OCamlProgram(pa_monad,pa_monad)
similarity index 100%
rename from xml/camlp4/pa_monad.ml
rename to camlp4/pa_monad.ml
similarity index 100%
rename from xml/camlp4/pa_oo.ml
rename to camlp4/pa_oo.ml
diff --git a/driver/test/runner b/driver/test/runner
deleted file mode 120000 (symlink)
index 1616924..0000000
+++ /dev/null
@@ -1 +0,0 @@
-runner.opt
\ No newline at end of file
index 4aea15c..4df12e7 100644 (file)
@@ -31,9 +31,7 @@ BYTE_ENABLED = true
 # Various options
 #
 #OCAMLFLAGS    +=
-OCAMLPPFLAGS   += -pp 'camlp4o'
-OCAMLDEPFLAGS  += $(OCAMLPPFLAGS)
-
+UseCamlp4(pa_oo)
 
 ################################################
 # Build an OCaml program
index 0f53a9f..55f03c6 100644 (file)
@@ -170,30 +170,31 @@ let to_abc tbl =
 let index_u30 x xs=
   Bytes.u30 @@ index x xs
 
-let accessor f =
+let make_accessor f =
   let nget value map =
     index value @@ PSet.to_list @@ f map in
   let get value map =
     index_u30 value @@ PSet.to_list @@ f map in
-    nget,get
+    (nget,get)
 
-let int_nget,int_get =
-  accessor (fun {int=map}->map)
+let (int_nget,int_get) =
+  make_accessor (fun {int=map}->map)
 
 let uint_nget,uint_get =
-  accessor (fun {uint=map}->map)
+  make_accessor (fun {uint=map}->map)
 
 let string_nget,string_get =
-  accessor (fun {string=map}->map)
+  make_accessor (fun {string=map}->map)
 
 let double_nget,double_get =
-  accessor (fun {double=map}->map)
+  make_accessor (fun {double=map}->map)
 
 let namespace_nget,namespace_get =
-  accessor (fun {namespace=map}->map)
+  make_accessor (fun {namespace=map}->map)
 
 let multiname_nget,multiname_get =
-  accessor (fun {multiname=map}->map)
+  make_accessor (fun {multiname=map}->map)
 
 let make_qname ?(ns="") x =
   QName ((Namespace ns),x)
+
index 1c4158a..e769d35 100644 (file)
@@ -1,5 +1,5 @@
 .PHONY: check clean
-.SUBDIRS: test camlp4 src
+.SUBDIRS: test src
 
 .DEFAULT: src/habc-xml$(EXE)
 
index b873b11..14b6674 100644 (file)
@@ -1,5 +1,8 @@
 .PHONY: clean
 
+UseCamlp4(pa_oo)
+
+
 ########################################################################
 # OCaml configuration.
 #
@@ -37,19 +40,6 @@ BYTE_ENABLED = true
 # OCAML_BYTE_LINK_FLAGS +=
 # OCAML_NATIVE_LINK_FLAGS +=
 
-
-################################################
-#
-# Camlp4 flags
-#
-
-CAMLP4FILES[] =
-       ../camlp4/pa_oo.cmo
-
-OCAMLPPFLAGS  += -pp 'camlp4o ../camlp4/pa_oo.cmo'
-OCAMLDEPFLAGS += $(OCAMLPPFLAGS)
-.SCANNER: scan-ocaml-%.ml: %.ml $(CAMLP4FILES)
-
 ################################################
 # Build an OCaml program
 #