compatibility with camlp5?

32 views
Skip to first unread message

Ben.S...@gmail.com

unread,
Dec 4, 2007, 7:04:10 PM12/4/07
to micmatch
Hey,

Has anyone had any experience compiling/using micmatch with camlp5?
(I'm using ocaml 3.10).
The make procedure seems to assume camlp4 <= 3.09.

I tried replacing all the (*pp *) references to camlp5, and setting
CAMLP4 = camlp5 in the OCamlMakeFile,
but so far to no avail...

I get:
ocamlc -c -pp "$PP " -I /usr/local/lib/ocaml/camlp5 declare_once.ml
File "declare_once.ml", line 208, characters 4-17:
Unbound constructor PaNativeInt

Any help is appreciated,
Ben

Martin Jambon

unread,
Dec 4, 2007, 7:21:21 PM12/4/07
to Ben.S...@gmail.com, micmatch

I'm not sure about the origin of this error message.

Daniel de Rauglaudre told me several months ago that he managed to compile
micmatch with his updated version of the old camlp4 (not yet released
as camlp5).

I haven't tried myself, being too busy with other things, and hesitating
between camlp5 (= the old camlp4) and the new camlp4 (3.10).

At work we're using 3.09 intensively without any problems, but sooner or
later we will have to do something with the camlp4 extensions.

My current plan is to translate micmatch to the new camlp4, but I know it
won't be easy. For now, I'm accumulating to-dos.


Martin

--
http://wink.com/profile/mjambon
http://martin.jambon.free.fr

jfgo...@gmail.com

unread,
Jul 18, 2008, 9:43:32 PM7/18/08
to Ben.S...@gmail.com, micm...@googlegroups.com
After some fumbling with the code I was able to get micmatch-0.700 to
work with camlp5-5.09 on ocaml-3.10.1. I'm not experienced enough with
camlp5 to tell whether my changes are correct, but they compile and
micmatch (such a sweet tool btw) appears to work. I've pasted the diff
down below. The changes in the docs were from a global search/replace
and can be ignored. You can run the diff through patch:
micmatch-0.700$ patch -Np1 < thepatchfile.

John

diff -Naur micmatch-0.700/Changes micmatch-0.700.jfgorski/Changes
--- micmatch-0.700/Changes 2007-06-27 11:34:23.000000000 -0500
+++ micmatch-0.700.jfgorski/Changes 2008-07-18 16:30:06.000000000
-0500
@@ -17,7 +17,7 @@
0.699: [+ui] added CAPTURE and COLLECTOBJ

0.698: [bug] fixed dynamic linking problems on MacOS/NetBSD by
removing
- version_filter. As a consequence, only recent versions
of camlp4
+ version_filter. As a consequence, only recent versions
of camlp5
are now supported (starting from 3.08.4, maybe earlier).
[bug] fixed missing dependency on "common" for "pcre" and
"str"
targets in main Makefile
diff -Naur micmatch-0.700/doc/micmatch-manual.tex
micmatch-0.700.jfgorski/doc/micmatch-manual.tex
--- micmatch-0.700/doc/micmatch-manual.tex 2007-06-27
11:34:23.000000000 -0500
+++ micmatch-0.700.jfgorski/doc/micmatch-manual.tex 2008-07-18
16:30:06.000000000 -0500
@@ -744,7 +744,7 @@

\subsubsection{Micmatch\_str}
The preprocessing library \texttt{pa\_micmatch\_str.cma} must be
loaded by
-the preprocessor (\texttt{camlp4o} or \texttt{camlp4r}).
+the preprocessor (\texttt{camlp5o} or \texttt{camlp5r}).

It is safe to use Micmatch\_str in
multithreaded programs only if the Str library is not being used by
@@ -756,7 +756,7 @@

\subsubsection{Micmatch\_pcre}
The preprocessing library \texttt{pa\_micmatch\_pcre.cma} must be
loaded by
-the preprocessor (\texttt{camlp4o} or \texttt{camlp4r}).
+the preprocessor (\texttt{camlp5o} or \texttt{camlp5r}).
When compiling multithreaded programs, the \texttt{-thread} option
must be passed to the preprocessor (versions earlier than
0.693 do not require the \texttt{-thread} flag and do not accept
diff -Naur micmatch-0.700/doc/micmatch-manual.tex.mlx
micmatch-0.700.jfgorski/doc/micmatch-manual.tex.mlx
--- micmatch-0.700/doc/micmatch-manual.tex.mlx 2007-06-27
11:34:23.000000000 -0500
+++ micmatch-0.700.jfgorski/doc/micmatch-manual.tex.mlx 2008-07-18
16:30:06.000000000 -0500
@@ -744,7 +744,7 @@

\subsubsection{Micmatch\_str}
The preprocessing library \texttt{pa\_micmatch\_str.cma} must be
loaded by
-the preprocessor (\texttt{camlp4o} or \texttt{camlp4r}).
+the preprocessor (\texttt{camlp5o} or \texttt{camlp5r}).

It is safe to use Micmatch\_str in
multithreaded programs only if the Str library is not being used by
@@ -756,7 +756,7 @@

\subsubsection{Micmatch\_pcre}
The preprocessing library \texttt{pa\_micmatch\_pcre.cma} must be
loaded by
-the preprocessor (\texttt{camlp4o} or \texttt{camlp4r}).
+the preprocessor (\texttt{camlp5o} or \texttt{camlp5r}).
When compiling multithreaded programs, the \texttt{-thread} option
must be passed to the preprocessor (versions earlier than
0.693 do not require the \texttt{-thread} flag and do not accept
diff -Naur micmatch-0.700/external-libs/regexp-pp/common/
declare_once.ml micmatch-0.700.jfgorski/external-libs/regexp-pp/common/
declare_once.ml
--- micmatch-0.700/external-libs/regexp-pp/common/declare_once.ml
2007-06-27 11:34:23.000000000 -0500
+++ micmatch-0.700.jfgorski/external-libs/regexp-pp/common/
declare_once.ml 2008-07-18 16:47:42.000000000 -0500
@@ -18,7 +18,7 @@
Please refrain from changing interfaces and internal data
structures of this module without contacting to the author:
When different implementations of this module are loaded into
one
- instance of camlp4 preprocessor, it may crash, because this
+ instance of camlp5 preprocessor, it may crash, because this
module uses a dirty, type-unsafe trick to share the internal
states between several instances of this module. Instead,
please
give the author a chance to merge your improvements into the
original
@@ -60,8 +60,8 @@
#else
*)
open Lexing
-let dummy_loc = { pos_fname = ""; pos_lnum = 1; pos_bol = 0; pos_cnum
= 0 },
- { pos_fname = ""; pos_lnum = 1; pos_bol = 0; pos_cnum = 0 }
+let dummy_loc = Ploc.dummy (*{ pos_fname = ""; pos_lnum = 1; pos_bol
= 0; pos_cnum = 0 },
+ { pos_fname = ""; pos_lnum = 1; pos_bol = 0; pos_cnum = 0 }*)
(*
#endif
*)
@@ -169,8 +169,10 @@
Printf.fprintf f "(%d,%d)" (fst loc) (snd loc)
#else
*)
-let print_loc f (loc, _) =
- Printf.fprintf f "%S (%d,%d)" loc.pos_fname loc.pos_lnum
loc.pos_cnum
+(*let print_loc f (loc, _) =
+ Printf.fprintf f "%S (%d,%d)" loc.pos_fname loc.pos_lnum
loc.pos_cnum*)
+let print_loc f loc =
+ Printf.fprintf f "%S (%d,%d)" "<unknown-filename>" (Ploc.line_nb
loc) (Ploc.first_pos loc)
(*
#endif
*)
@@ -205,7 +207,7 @@
| <:patt< $int:_$ >>
(*#if 3.06 | 3.07pre
#else*)
- | PaNativeInt _ | PaInt64 _ | PaInt32 _
+ (*| PaNativeInt _ | PaInt64 _ | PaInt32 _*) | PaInt _
(*#endif*)
| <:patt< $str:_$ >>
| <:patt< $flo:_$ >> -> []
diff -Naur micmatch-0.700/external-libs/regexp-pp/common/
declare_once.mli micmatch-0.700.jfgorski/external-libs/regexp-pp/
common/declare_once.mli
--- micmatch-0.700/external-libs/regexp-pp/common/declare_once.mli
2007-06-27 11:34:23.000000000 -0500
+++ micmatch-0.700.jfgorski/external-libs/regexp-pp/common/
declare_once.mli 2008-07-18 16:30:06.000000000 -0500
@@ -48,3 +48,4 @@
val pickup_variables : MLast.patt -> string list

val dummy_loc : MLast.loc
+(*val dummy_loc : Lexing.position * Lexing.position*)
diff -Naur micmatch-0.700/Makefile micmatch-0.700.jfgorski/Makefile
--- micmatch-0.700/Makefile 2007-06-27 11:34:23.000000000 -0500
+++ micmatch-0.700.jfgorski/Makefile 2008-07-18 16:30:06.000000000
-0500
@@ -1,7 +1,7 @@
.PHONY: defaults install uninstall all opt micmatch-pcre micmatch-str
\
common install-str install-pcre uninstall-str uninstall-pcre
\
backup clean archive
-
+PREFIX=/opt/ocaml
ifndef PREFIX
BINDIR = $(shell dirname `which ocaml`)
PREFIX = $(shell dirname $(BINDIR))
@@ -12,7 +12,7 @@
export BINDIR


-PP = camlp4o pa_extend.cmo q_MLast.cmo -loc loc
+PP = camlp5o pa_extend.cmo q_MLast.cmo -loc loc
#PP = ocamlrun ./version_filter -pp "camlp4o pa_extend.cmo
q_MLast.cmo -loc loc -impl"
export PP

diff -Naur micmatch-0.700/micmatch_common/constants.ml
micmatch-0.700.jfgorski/micmatch_common/constants.ml
--- micmatch-0.700/micmatch_common/constants.ml 2007-06-27
11:34:23.000000000 -0500
+++ micmatch-0.700.jfgorski/micmatch_common/constants.ml 2008-07-18
16:30:06.000000000 -0500
@@ -1,4 +1,4 @@
-(*pp camlp4o q_MLast.cmo -loc loc *)
+(*pp camlp5o q_MLast.cmo -loc loc *)

let dummy_loc = Declare_once.dummy_loc

diff -Naur micmatch-0.700/micmatch_common/match.ml
micmatch-0.700.jfgorski/micmatch_common/match.ml
--- micmatch-0.700/micmatch_common/match.ml 2007-06-27
11:34:23.000000000 -0500
+++ micmatch-0.700.jfgorski/micmatch_common/match.ml 2008-07-18
16:30:06.000000000 -0500
@@ -493,9 +493,9 @@
| <:patt< $flo:_$ >>
| <:patt< _ >> -> keep patt

- | MLast.PaNativeInt (_, _)
+ (*| MLast.PaNativeInt (_, _)
| MLast.PaInt64 (_, _)
- | MLast.PaInt32 (_, _) -> keep patt
+ | MLast.PaInt32 (_, _) *) |MLast.PaInt _ -> keep patt

| MLast.PaVrn (_, _)
| MLast.PaTyp (_, _) -> keep patt
diff -Naur micmatch-0.700/micmatch_pcre/Makefile
micmatch-0.700.jfgorski/micmatch_pcre/Makefile
--- micmatch-0.700/micmatch_pcre/Makefile 2007-06-27
11:34:23.000000000 -0500
+++ micmatch-0.700.jfgorski/micmatch_pcre/Makefile 2008-07-18
16:30:06.000000000 -0500
@@ -88,8 +88,8 @@
ocamlc -a -o run_micmatch_pcre.cma -I $(PCRE_DIR) \
micmatch.ml run_micmatch_pcre.ml
ocamlmktop -o micmatch_pcre.top \
- -I +camlp4 -I $(PCRE_DIR) \
- camlp4o.cma \
+ -I /opt/ocaml/site-lib/camlp5 -I $(PCRE_DIR) \
+ camlp5o.cma \
pa_micmatch_pcre.cma pcre.cma unix.cma run_micmatch_pcre.cma
./make_micmatch_pcre

@@ -104,16 +104,16 @@

# Toplevel (preinstall test)
test1:
- camlp4o ./pa_micmatch_pcre.cma pr_o.cmo test1.ml > test1.ppo
- ocamlmktop -o micmatch_pcre.test -I +camlp4 -I . -I $(PCRE_DIR) \
- camlp4o.cma \
+ camlp5o ./pa_micmatch_pcre.cma pr_o.cmo test1.ml > test1.ppo
+ ocamlmktop -o micmatch_pcre.test -I /opt/ocaml/site-lib/camlp5 -I .
-I $(PCRE_DIR) \
+ camlp5o.cma \
pa_micmatch_pcre.cma pcre.cma unix.cma run_micmatch_pcre.cma
./micmatch_pcre.test -I $(PCRE_DIR) test1.ml

# Compilation without ocamlfind (preinstall test)
more-tests:
- camlp4o ./pa_micmatch_pcre.cma pr_o.cmo -direct test1.ml > test1.ppo
- ocamlopt -pp 'camlp4o ./pa_micmatch_pcre.cma -direct' \
+ camlp5o ./pa_micmatch_pcre.cma pr_o.cmo -direct test1.ml > test1.ppo
+ ocamlopt -pp 'camlp5o ./pa_micmatch_pcre.cma -direct' \
-I $(PCRE_DIR) pcre.cmxa unix.cmxa run_micmatch_pcre.cmxa \
test1.ml -o test1
./test1
@@ -121,7 +121,7 @@
# Compilation with ocamlfind (postinstall test)
test-install:
ocamlfind ocamlopt \
- -syntax camlp4o \
+ -syntax camlp5o \
-package pcre,micmatch_pcre\
-linkpkg \
test1.ml -o test1
diff -Naur micmatch-0.700/micmatch_pcre/match.ml
micmatch-0.700.jfgorski/micmatch_pcre/match.ml
--- micmatch-0.700/micmatch_pcre/match.ml 2007-06-27
11:34:23.000000000 -0500
+++ micmatch-0.700.jfgorski/micmatch_pcre/match.ml 2008-07-18
16:30:06.000000000 -0500
@@ -493,9 +493,9 @@
| <:patt< $flo:_$ >>
| <:patt< _ >> -> keep patt

- | MLast.PaNativeInt (_, _)
+ (*| MLast.PaNativeInt (_, _)
| MLast.PaInt64 (_, _)
- | MLast.PaInt32 (_, _) -> keep patt
+ | MLast.PaInt32 (_, _) *) |MLast.PaInt _ -> keep patt

| MLast.PaVrn (_, _)
| MLast.PaTyp (_, _) -> keep patt
diff -Naur micmatch-0.700/micmatch_pcre/META micmatch-0.700.jfgorski/
micmatch_pcre/META
--- micmatch-0.700/micmatch_pcre/META 2007-06-27 11:34:23.000000000
-0500
+++ micmatch-0.700.jfgorski/micmatch_pcre/META 2008-07-18
16:30:06.000000000 -0500
@@ -2,7 +2,7 @@
version = "0.700"
description = "Pattern matching extended with regexps in Ocamllex
syntax"

-requires = "camlp4 pcre unix"
+requires = "camlp5 pcre unix"
archive(syntax,toploop) = "pa_micmatch_pcre.cma
run_micmatch_pcre.cma"
archive(syntax,create_toploop) = "pa_micmatch_pcre.cma
run_micmatch_pcre.cma"
archive(syntax,preprocessor) = "pa_micmatch_pcre.cma"
diff -Naur micmatch-0.700/micmatch_pcre/META.mlx
micmatch-0.700.jfgorski/micmatch_pcre/META.mlx
--- micmatch-0.700/micmatch_pcre/META.mlx 2007-06-27
11:34:23.000000000 -0500
+++ micmatch-0.700.jfgorski/micmatch_pcre/META.mlx 2008-07-18
16:30:06.000000000 -0500
@@ -2,7 +2,7 @@
version = "## Sys.command "../VERSION" ##"
description = "Pattern matching extended with regexps in Ocamllex
syntax"

-requires = "camlp4 pcre unix"
+requires = "camlp5 pcre unix"
archive(syntax,toploop) = "pa_micmatch_pcre.cma
run_micmatch_pcre.cma"
archive(syntax,create_toploop) = "pa_micmatch_pcre.cma
run_micmatch_pcre.cma"
archive(syntax,preprocessor) = "pa_micmatch_pcre.cma"
diff -Naur micmatch-0.700/micmatch_pcre/pcre_lib.ml
micmatch-0.700.jfgorski/micmatch_pcre/pcre_lib.ml
--- micmatch-0.700/micmatch_pcre/pcre_lib.ml 2007-06-27
11:34:23.000000000 -0500
+++ micmatch-0.700.jfgorski/micmatch_pcre/pcre_lib.ml 2008-07-18
16:30:06.000000000 -0500
@@ -1,4 +1,4 @@
-(*pp camlp4o q_MLast.cmo -loc loc *)
+(*pp camlp5o q_MLast.cmo -loc loc *)


let _ =
diff -Naur micmatch-0.700/micmatch_pcre/syntax_pcre.ml
micmatch-0.700.jfgorski/micmatch_pcre/syntax_pcre.ml
--- micmatch-0.700/micmatch_pcre/syntax_pcre.ml 2007-06-27
11:34:23.000000000 -0500
+++ micmatch-0.700.jfgorski/micmatch_pcre/syntax_pcre.ml 2008-07-18
16:30:06.000000000 -0500
@@ -85,7 +85,7 @@

let extend_common ?(expr1_level = "expr1") () =
EXTEND
- Pcaml.expr: LEVEL $expr1_level$ [
+ Pcaml.expr: LEVEL "expr1" (*$expr1_level$*) [
[ "RE_PCRE"; re = regexp ->
warnings re;
let (re_args, re_source, named_groups, postbindings) =
@@ -178,4 +178,4 @@

(match !Pcaml.syntax_name with
"OCaml" -> extend_regular ()
- | _ -> extend_revised ())
+ | _ -> (raise (Failure "extend_revised not supported");
extend_revised ()))
diff -Naur micmatch-0.700/micmatch_str/Makefile
micmatch-0.700.jfgorski/micmatch_str/Makefile
--- micmatch-0.700/micmatch_str/Makefile 2007-06-27 11:34:23.000000000
-0500
+++ micmatch-0.700.jfgorski/micmatch_str/Makefile 2008-07-18
16:30:06.000000000 -0500
@@ -69,8 +69,8 @@
ocamlopt -a -thread -o run_micmatch_str_mt.cmxa \
micmatch.ml run_micmatch_str.ml run_micmatch_str_mt.ml
ocamlmktop -o micmatch_str.top \
- -I +camlp4 \
- camlp4o.cma \
+ -I /opt/ocaml/site-lib/camlp5 \
+ camlp5o.cma \
pa_micmatch_str.cma str.cma unix.cma run_micmatch_str.cma
./make_micmatch_str

@@ -80,16 +80,16 @@

# Toplevel (preinstall test)
test1:
- camlp4o ./pa_micmatch_str.cma pr_o.cmo test1.ml > test1.ppo
- ocamlmktop -o micmatch_str.test -I +camlp4 -I . camlp4o.cma \
+ camlp5o ./pa_micmatch_str.cma pr_o.cmo test1.ml > test1.ppo
+ ocamlmktop -o micmatch_str.test -I /opt/ocaml/site-lib/camlp5 -I .
camlp5o.cma \
pa_micmatch_str.cma str.cma unix.cma run_micmatch_str.cma
./micmatch_str.test test1.ml

# Compilation without ocamlfind (preinstall test)
more-tests:
- camlp4o ./pa_micmatch_str.cma pr_o.cmo -thread -direct test1.ml \
+ camlp5o ./pa_micmatch_str.cma pr_o.cmo -thread -direct test1.ml \
> test1_mt.ppo
- ocamlopt -pp 'camlp4o ./pa_micmatch_str.cma -thread -direct' \
+ ocamlopt -pp 'camlp5o ./pa_micmatch_str.cma -thread -direct' \
-thread threads.cmxa str.cmxa unix.cmxa \
run_micmatch_str_mt.cmxa \
test1.ml -o test1_mt
@@ -98,13 +98,13 @@
# Compilation with ocamlfind (postinstall test)
test-install:
ocamlfind ocamlopt \
- -syntax camlp4o \
+ -syntax camlp5o \
-package micmatch_str\
-linkpkg \
test1.ml -o test1
ocamlfind ocamlopt \
-thread \
- -syntax camlp4o \
+ -syntax camlp5o \
-package micmatch_str \
-ppopt -thread \
-ppopt -direct \
diff -Naur micmatch-0.700/micmatch_str/match.ml
micmatch-0.700.jfgorski/micmatch_str/match.ml
--- micmatch-0.700/micmatch_str/match.ml 2007-06-27 11:34:23.000000000
-0500
+++ micmatch-0.700.jfgorski/micmatch_str/match.ml 2008-07-18
16:30:06.000000000 -0500
@@ -493,9 +493,9 @@
| <:patt< $flo:_$ >>
| <:patt< _ >> -> keep patt

- | MLast.PaNativeInt (_, _)
+ (*| MLast.PaNativeInt (_, _)
| MLast.PaInt64 (_, _)
- | MLast.PaInt32 (_, _) -> keep patt
+ | MLast.PaInt32 (_, _) *) |MLast.PaInt _ -> keep patt

| MLast.PaVrn (_, _)
| MLast.PaTyp (_, _) -> keep patt
diff -Naur micmatch-0.700/micmatch_str/META micmatch-0.700.jfgorski/
micmatch_str/META
--- micmatch-0.700/micmatch_str/META 2007-06-27 11:34:23.000000000
-0500
+++ micmatch-0.700.jfgorski/micmatch_str/META 2008-07-18
16:30:06.000000000 -0500
@@ -2,7 +2,7 @@
version = "0.700"
description = "Pattern matching extended with regexps in Ocamllex
syntax"

-requires = "camlp4 str unix"
+requires = "camlp5 str unix"
archive(syntax,toploop) = "pa_micmatch_str.cma run_micmatch_str.cma"
archive(syntax,toploop,mt) = "pa_micmatch_str.cma
run_micmatch_str_mt.cma"
archive(syntax,create_toploop) = "pa_micmatch_str.cma
run_micmatch_str.cma"
diff -Naur micmatch-0.700/micmatch_str/META.mlx
micmatch-0.700.jfgorski/micmatch_str/META.mlx
--- micmatch-0.700/micmatch_str/META.mlx 2007-06-27 11:34:23.000000000
-0500
+++ micmatch-0.700.jfgorski/micmatch_str/META.mlx 2008-07-18
16:30:06.000000000 -0500
@@ -2,7 +2,7 @@
version = "## Sys.command "../VERSION" ##"
description = "Pattern matching extended with regexps in Ocamllex
syntax"

-requires = "camlp4 str unix"
+requires = "camlp5 str unix"
archive(syntax,toploop) = "pa_micmatch_str.cma run_micmatch_str.cma"
archive(syntax,toploop,mt) = "pa_micmatch_str.cma
run_micmatch_str_mt.cma"
archive(syntax,create_toploop) = "pa_micmatch_str.cma
run_micmatch_str.cma"
diff -Naur micmatch-0.700/micmatch_str/str_lib.ml
micmatch-0.700.jfgorski/micmatch_str/str_lib.ml
--- micmatch-0.700/micmatch_str/str_lib.ml 2007-06-27
11:34:23.000000000 -0500
+++ micmatch-0.700.jfgorski/micmatch_str/str_lib.ml 2008-07-18
16:30:06.000000000 -0500
@@ -1,4 +1,4 @@
-(*pp camlp4o q_MLast.cmo -loc loc *)
+(*pp camlp5o q_MLast.cmo -loc loc *)

open Constants

diff -Naur micmatch-0.700/micmatch_str/test2.ml
micmatch-0.700.jfgorski/micmatch_str/test2.ml
--- micmatch-0.700/micmatch_str/test2.ml 2007-06-27 11:34:23.000000000
-0500
+++ micmatch-0.700.jfgorski/micmatch_str/test2.ml 2008-07-18
16:30:06.000000000 -0500
@@ -1,4 +1,4 @@
-(* camlp4o -I . ./pa_micmatch.cma pr_o.cmo -thread test2.ml *)
+(* camlp5o -I . ./pa_micmatch.cma pr_o.cmo -thread test2.ml *)

match Some "x" with
RE "y" -> "hello"
diff -Naur micmatch-0.700/OCamlMakefile micmatch-0.700.jfgorski/
OCamlMakefile
--- micmatch-0.700/OCamlMakefile 2007-06-27 11:34:23.000000000 -0500
+++ micmatch-0.700.jfgorski/OCamlMakefile 2008-07-18
16:30:06.000000000 -0500
@@ -234,7 +234,7 @@
export CAMELEON_REPORT_FLAGS

ifndef CAMELEON_ZOGGY
- CAMELEON_ZOGGY := camlp4o pa_zog.cma pr_o.cmo
+ CAMELEON_ZOGGY := camlp5o pa_zog.cma pr_o.cmo
endif
export CAMELEON_ZOGGY

@@ -266,7 +266,8 @@
export NO_CUSTOM

ifndef CAMLP4
- CAMLP4 := camlp4
+# CAMLP4 := camlp5
+ CAMLP4 := camlp5
endif
export CAMLP4

@@ -491,7 +492,7 @@

ifdef USE_CAMLP4
CAMLP4PATH := \
- $(shell $(CAMLP4) -where 2>/dev/null || echo /usr/local/lib/
camlp4)
+ $(shell $(CAMLP4) -where 2>/dev/null || echo /usr/local/lib/
camlp5)
INCFLAGS := -I $(CAMLP4PATH)
CINCFLAGS := -I$(CAMLP4PATH)
endif
@@ -665,7 +666,7 @@
# USER RULES

# Call "OCamlMakefile QUIET=" to get rid of all of the @'s.
-QUIET=@
+#QUIET=@

# generates byte-code (default)
byte-code: $(PRE_TARGETS)
diff -Naur micmatch-0.700/public-domain/pa_use.ml
micmatch-0.700.jfgorski/public-domain/pa_use.ml
--- micmatch-0.700/public-domain/pa_use.ml 2007-06-27
11:34:23.000000000 -0500
+++ micmatch-0.700.jfgorski/public-domain/pa_use.ml 2008-07-18
16:30:06.000000000 -0500
@@ -1,4 +1,4 @@
-(*pp camlp4o pa_extend.cmo q_MLast.cmo -loc loc *)
+(*pp camlp5o pa_extend.cmo q_MLast.cmo -loc loc *)

(* Created by Martin Jambon, 2004 *)
(* No copyright, no guarantee *)

Martin Jambon

unread,
Jul 20, 2008, 2:13:21 PM7/20/08
to jfgo...@gmail.com, Ben.S...@gmail.com, micm...@googlegroups.com
On Fri, 18 Jul 2008, jfgo...@gmail.com wrote:

> After some fumbling with the code I was able to get micmatch-0.700 to
> work with camlp5-5.09 on ocaml-3.10.1. I'm not experienced enough with
> camlp5 to tell whether my changes are correct, but they compile and
> micmatch (such a sweet tool btw) appears to work. I've pasted the diff
> down below. The changes in the docs were from a global search/replace
> and can be ignored. You can run the diff through patch:
> micmatch-0.700$ patch -Np1 < thepatchfile.

This was helpful, thank you John.

I created an SVN sub-repository for it. You can check it out using

svn checkout svn://svn.forge.ocamlcore.org/svnroot/micmatch/trunk/micmatch-camlp5

or visit http://forge.ocamlcore.org/scm/?group_id=28

I made a few additional changes (notably under micmatch_str).
So we now have a version of micmatch that passes the runtime tests under
OCaml 3.10.2 and Camlp5 5.08. It is a very good sign and I plan to make a
release soon.

One thing I'm not sure about is how to use it with ocamlfind.
Before, one could do:

ocamlfind ocamlc -c -syntax camlp4o -package micmatch_pcre foo.ml

Now using camlp5 installed from godi_console, the following works:

ocamlfind ocamlc -c \
-pp "camlp5o -I '$(ocamlfind query micmatch_pcre)' pa_micmatch_pcre.cma" \
-package micmatch_pcre foo.ml

Let me know if you have a better solution.


Martin

--
http://mjambon.com/
Join http://ocamlhackers.ning.com/

John Gregorski

unread,
Jul 22, 2008, 5:01:04 AM7/22/08
to Martin Jambon, Ben.S...@gmail.com, micm...@googlegroups.com
I gave it a try and ran into the same problem, but I got it to work when I

1. Put the camlp5 META file into the godi installation tree (e.g. pkg-lib/camlp5/META). Seems like the camlp5 installation does not copy this file, even though it's there in the etc/ dir in the sources.

2. Ran

   ocamlfind ocamlc -c -syntax camlp5o -package camlp5,micmatch_pcre comments.ml

   i.e. added camlp5 to -package. This is needed for camlp4 too. I didn't need to do this in my non-godi setup though.

I guess since #1 is out of your hands you're stuck with your alternative compile line.
Reply all
Reply to author
Forward
0 new messages