This is an automated email from the git hooks/post-receive script.

glondu pushed a commit to branch master
in repository cppo.

commit 6f86be106ca36cb397c38c28baf3a924af1ffcf1
Author: Stephane Glondu <st...@glondu.net>
Date:   Tue Jan 26 15:48:00 2016 +0100

    Imported Upstream version 1.2.0
---
 Makefile                             |  4 ++--
 README.md                            | 10 +++++++++-
 cppo_main.ml                         |  6 +++---
 cppo_parser.mly                      | 14 +++++++++++---
 ocamlbuild_plugin/ocamlbuild_cppo.ml | 24 ++++++++++++++----------
 test.cppo                            |  8 ++++----
 6 files changed, 43 insertions(+), 23 deletions(-)

diff --git a/Makefile b/Makefile
index 467d5c6..f311d89 100644
--- a/Makefile
+++ b/Makefile
@@ -24,7 +24,7 @@ export BINDIR
 
 
 
-BEST := opt
+BEST != if ocamlopt 2>/dev/null; then echo .native; else echo .byte; fi
 NATDYNLINK ?= $(shell if [ -f `ocamlc -where`/dynlink.cmxa ]; then \
                         echo YES; \
                       else \
@@ -33,7 +33,7 @@ NATDYNLINK ?= $(shell if [ -f `ocamlc -where`/dynlink.cmxa ]; 
then \
 
 OCAMLBUILD_IMPL := ocamlbuild_cppo.cma
 
-ifeq "${BEST}" "opt"
+ifeq "${BEST}" ".native"
 OCAMLBUILD_IMPL += ocamlbuild_cppo.cmxa ocamlbuild_cppo.a
 ifeq "${NATDYNLINK}" "YES"
 OCAMLBUILD_IMPL += ocamlbuild_cppo.cmxs
diff --git a/README.md b/README.md
index 862864b..1290779 100644
--- a/README.md
+++ b/README.md
@@ -420,7 +420,8 @@ to produce`.ml` files. The following tags are available:
   * If `foo` is a file, it adds `foo` as a dependency and apply `-I
     parent(foo)`.
 * `cppo_V(NAME:VERSION)` ≡ `-V NAME:VERSION`
-* `cppo_V_OCAML` ≡ `-V OCAML:VERSION`, where `VERSION` is the version of OCaml 
that ocamlbuild uses.
+* `cppo_V_OCAML` ≡ `-V OCAML:VERSION`, where `VERSION`
+   is the version of OCaml that ocamlbuild uses.
 
 Detailed command-line usage and options
 ---------------------------------------
@@ -488,3 +489,10 @@ Options:
   -help  Display this list of options
   --help  Display this list of options
 ```
+
+
+Contributing
+------------
+
+See our contribution guidelines at
+https://github.com/mjambon/documents/blob/master/how-to-contribute.md
diff --git a/cppo_main.ml b/cppo_main.ml
index 26a56f6..22792b3 100644
--- a/cppo_main.ml
+++ b/cppo_main.ml
@@ -20,7 +20,7 @@ let semver_re = Str.regexp "\
 \\.\\([0-9]+\\)\
 \\(-\\([^+]*\\)\\)?\
 \\(\\+\\(.*\\)\\)?\
-$"
+\r?$"
 
 let parse_semver s =
   if not (Str.string_match semver_re s 0) then
@@ -43,7 +43,7 @@ let opt_define var o =
 
 let parse_version_spec s =
   let error () =
-    failwith (sprintf "Invalid version specification: %s" s)
+    failwith (sprintf "Invalid version specification: %S" s)
   in
   let prefix, version_full =
     try
@@ -82,7 +82,7 @@ let main () =
     "-D", Arg.String (fun s -> header := ("#define " ^ s ^ "\n") :: !header),
     "DEF
           Equivalent of interpreting '#define DEF' before processing the
-          input";
+          input, e.g. `cppo -D 'VERSION \"1.2.3\"'` (no equal sign)";
 
     "-U", Arg.String (fun s -> header := ("#undef " ^ s ^ "\n") :: !header),
     "IDENT
diff --git a/cppo_parser.mly b/cppo_parser.mly
index efb41a5..1131499 100644
--- a/cppo_parser.mly
+++ b/cppo_parser.mly
@@ -190,9 +190,17 @@ args1:
 ;
 
 def_args1:
-  IDENT COMMA def_args1
-                   { (snd $1) :: $3 }
-| IDENT            { [ snd $1 ] }
+| arg_blank IDENT COMMA def_args1
+                               { (snd $2) :: $4 }
+| arg_blank IDENT              { [ snd $2 ] }
+;
+
+arg_blank:
+| TEXT arg_blank         { let loc, is_space, s = $1 in
+                           if not is_space then
+                             error loc "Invalid argument list"
+                         }
+|                        { () }
 ;
 
 test:
diff --git a/ocamlbuild_plugin/ocamlbuild_cppo.ml 
b/ocamlbuild_plugin/ocamlbuild_cppo.ml
index 91f7b2f..153d071 100644
--- a/ocamlbuild_plugin/ocamlbuild_cppo.ml
+++ b/ocamlbuild_plugin/ocamlbuild_cppo.ml
@@ -3,17 +3,21 @@ open Ocamlbuild_plugin
 
 let dispatcher = function
   | After_rules -> begin
-      let dep = "%(name).cppo.ml" in
-      let prod1 = "%(name: <*> and not <*.cppo>).ml" in
-      let prod2 = "%(name: <**/*> and not <**/*.cppo>).ml" in
-      let f prod env _build =
-        let dep = env dep in
-        let prod = env prod in
-        let tags = tags_of_pathname prod ++ "cppo" in
-        Cmd (S[A "cppo"; T tags; S [A "-o"; P prod]; P dep ])
+      let cppo_rules ext =
+        let dep   = "%(name).cppo"-.-ext
+        and prod1 = "%(name: <*> and not <*.cppo>)"-.-ext
+        and prod2 = "%(name: <**/*> and not <**/*.cppo>)"-.-ext in
+        let cppo_rule prod env _build =
+          let dep = env dep in
+          let prod = env prod in
+          let tags = tags_of_pathname prod ++ "cppo" in
+          Cmd (S[A "cppo"; T tags; S [A "-o"; P prod]; P dep ])
+        in
+        rule ("cppo: *.cppo."-.-ext^" -> *."-.-ext)  ~dep ~prod:prod1 
(cppo_rule prod1);
+        rule ("cppo: **/*.cppo."-.-ext^" -> **/*."-.-ext)  ~dep ~prod:prod2 
(cppo_rule prod2);
       in
-      rule "cppo1" ~dep ~prod:prod1 (f prod1) ;
-      rule "cppo2" ~dep ~prod:prod2 (f prod2) ;
+      List.iter cppo_rules ["ml"; "mli"];
+
       pflag ["cppo"] "cppo_D" (fun s -> S [A "-D"; A s]) ;
       pflag ["cppo"] "cppo_U" (fun s -> S [A "-U"; A s]) ;
       pflag ["cppo"] "cppo_I" (fun s ->
diff --git a/test.cppo b/test.cppo
index 39a08ba..6379377 100644
--- a/test.cppo
+++ b/test.cppo
@@ -42,7 +42,7 @@ failure
    456 *)
 test_multiline
 
-#define test_args(x,y) x y
+#define test_args(x, y) x y
 test_args("a","b")
 
 #define test_argc(x) x y
@@ -73,7 +73,7 @@ obj
 '  (* lone single quote *)
 
 #define one 1
-one� is not 1 �
+one is not 1
 
 #undef x
 #define x #
@@ -133,11 +133,11 @@ end
 DEBUG("test1 %i %i" x y)
 DEBUG("test2 %i" x)
 
-#include "testdata/incl.cppo"
+#include "test/incl.cppo"
 # 123456
 
 #789 "test"
-#include "testdata/incl.cppo"
+#include "test/incl.cppo"
 
 #define debug(s) Printf.eprintf "%S %i: %s\n%!" __FILE__ __LINE__ s
 

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-ocaml-maint/packages/cppo.git

_______________________________________________
Pkg-ocaml-maint-commits mailing list
Pkg-ocaml-maint-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ocaml-maint-commits

Reply via email to