diff options
author | Stephane Glondu <steph@glondu.net> | 2019-08-05 03:18:27 +0200 |
---|---|---|
committer | Stephane Glondu <steph@glondu.net> | 2019-08-05 03:18:27 +0200 |
commit | b32d41160be8fa9438c673e5f8ed705a548879a0 (patch) | |
tree | 546a49fdce13105ed73789f113bc55bf9ddf4f87 | |
parent | 5dcee417563d6e51a04f1c723628ca6aaaedffa5 (diff) | |
parent | 3557760702519d73ea25e698f8abfc4712b42236 (diff) |
Update upstream source from tag 'upstream/1.6.6'
Update to upstream version '1.6.6'
with Debian dir 3cd3cbe08c6a3d11f34af80f4bbe87264b0b8620
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .travis.yml | 16 | ||||
-rw-r--r-- | CODEOWNERS | 8 | ||||
-rw-r--r-- | Changes | 97 | ||||
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | VERSION | 2 | ||||
-rw-r--r-- | appveyor.yml | 4 | ||||
-rw-r--r-- | cppo.opam | 41 | ||||
-rw-r--r-- | cppo_ocamlbuild.opam | 35 | ||||
-rw-r--r-- | dune-project | 2 | ||||
-rw-r--r-- | examples/dune | 32 | ||||
-rw-r--r-- | examples/jbuild | 22 | ||||
-rw-r--r-- | ocamlbuild_plugin/dune | 6 | ||||
-rw-r--r-- | ocamlbuild_plugin/jbuild | 8 | ||||
-rw-r--r-- | pkg/pkg.ml | 2 | ||||
-rw-r--r-- | src/cppo_eval.ml | 3 | ||||
-rw-r--r-- | src/cppo_parser.mly | 2 | ||||
-rw-r--r-- | src/dune | 16 | ||||
-rw-r--r-- | src/jbuild | 16 | ||||
-rw-r--r-- | test/dune | 130 | ||||
-rw-r--r-- | test/jbuild | 95 |
21 files changed, 321 insertions, 227 deletions
@@ -2,3 +2,4 @@ _build .merlin *.install +.*.swp diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..1f17d11 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,16 @@ +language: c +sudo: required +install: wget https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/.travis-opam.sh +script: bash -ex .travis-opam.sh +env: + global: + - PACKAGE=cppo + matrix: + - OCAML_VERSION=4.03 + - OCAML_VERSION=4.04 + - OCAML_VERSION=4.05 + - OCAML_VERSION=4.06 + - OCAML_VERSION=4.07 +os: + - linux + - osx diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 0000000..2a7c825 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,8 @@ +# We're looking for one or more volunteers to take the lead of cppo, +# with the help of ocaml-community. +# +# Call for volunteers: https://github.com/ocaml-community/meta/issues/27 +# About ocaml-community: https://github.com/ocaml-community/meta +# +# Interim maintainers who won't be very responsive :-( +* @mjambon @pmetzger @@ -1,69 +1,80 @@ -2018-02-26: release 1.6.4 - [compat] Tests should now work with older versions of jbuilder. +## v1.6.6 (2019-05-27) +- [pkg] port build system to dune from jbuilder. +- [pkg] upgrade opam metadata to 2.0 format. +- [pkg] remove topkg and use dune-release. +- [compat] Use `String.capitalize_ascii` to remove warning. -2018-02-21: release 1.6.3 - [compat] Fix tests. +## v1.6.5 (2018-09-12) +- [bug] Fix 'asr' operator (#61) -2018-01-25: release 1.6.1 - [compat] Emit line directives always containing the file name, +## v1.6.4 (2018-02-26) +- [compat] Tests should now work with older versions of jbuilder. + +## v1.6.3 (2018-02-21) +- [compat] Fix tests. + +## v1.6.1 (2018-01-25) +- [compat] Emit line directives always containing the file name, as mandated starting with ocaml 4.07. -2017-08-07: release 1.6.0 - [pkg] BREAKING: cppo and cppo_ocamlbuild are now two distinct opam +## v1.6.0 (2017-08-07) +- [pkg] BREAKING: cppo and cppo_ocamlbuild are now two distinct opam packages. -2017-04-24: release 1.5.0 - [+ui] Added the `CAPITALIZE()` function. +## v1.5.0 (2017-04-24) +- [+ui] Added the `CAPITALIZE()` function. -2016-08-19: release 1.4.0 - [compat] Cppo is now safe-string ready. +## v1.4.0 (2016-08-19) +- [compat] Cppo is now safe-string ready. -2016-04-20: release 1.3.2 - [pkg] Cppo can now be built on MSVC. +## v1.3.2 (2016-04-20) +- [pkg] Cppo can now be built on MSVC. -2015-09-20: release 1.3.1 - [bug] Possible to have #endif between two matching parenthesis. +## v1.3.1 (2015-09-20) +- [bug] Possible to have #endif between two matching parenthesis. -2015-09-13: release 1.3.0 - [+ui] Removed the need for escaping commas and parenthesis in macros. - [+ui] Blanks is now allowed in argument list in macro definitions. - [+ui] #directive with wrong arguments is now giving a proper error. - [bug] Fixed expansion of __FILE__ and __LINE__. +## v1.3.0 (2015-09-13) +- [+ui] Removed the need for escaping commas and parenthesis in macros. +- [+ui] Blanks is now allowed in argument list in macro definitions. +- [+ui] #directive with wrong arguments is now giving a proper error. +- [bug] Fixed expansion of __FILE__ and __LINE__. -2014-11-10: release 1.1.2 - [+ui] Ocamlbuild_cppo: added the ocamlbuild flag `cppo_V(NAME:VERSION)`, +## v1.1.2 (2014-11-10) +- [+ui] Ocamlbuild_cppo: added the ocamlbuild flag `cppo_V(NAME:VERSION)`, equivalent to `-V NAME:VERSION` (for _tags file). -2014-11-10: release 1.1.1 - [+ui] Ocamlbuild_cppo: added the ocamlbuild flag `cppo_V_OCAML`, +## v1.1.1 (2014-11-10) +- [+ui] Ocamlbuild_cppo: added the ocamlbuild flag `cppo_V_OCAML`, equivalent to `-V OCAML:VERSION` (for _tags file). -2014-11-04: release 1.1.0 - [+ui] Added the `-V NAME:VERSION` option. - [+ui] Support for tuples in comparisons: tuples can be constructed +## v1.1.0 (2014-11-04) +- [+ui] Added the `-V NAME:VERSION` option. +- [+ui] Support for tuples in comparisons: tuples can be constructed and compared, e.g. `#if (2 + 2, 5) < (4, 5)`. -2014-10-20: release 1.0.1 - [+ui] `#elif` and `#else` can now be used in the same #if-#else statement. - [bug] Fixed the Ocamlbuild flag `cppo_n`. +## v1.0.1 (2014-10-20) +- [+ui] `#elif` and `#else` can now be used in the same #if-#else statement. +- [bug] Fixed the Ocamlbuild flag `cppo_n`. -2014-09-06: release 1.0.0 - [bug] OCaml comments are now better parsed. For example, (* '"' *) works. +## v1.0.0 (2014-09-06) +- [bug] OCaml comments are now better parsed. For example, (* '"' *) works. -2014-06-10: release 0.9.4 - [+ui] Added the ocamlbuild_cppo plugin for Ocamlbuild. To use it: +## v0.9.4 (2014-06-10) +- [+ui] Added the ocamlbuild_cppo plugin for Ocamlbuild. To use it: `-plugin(cppo_ocamlbuild)`. -2012-02-03: release 0.9.3 - [pkg] New way of building the tar.gz archive. +## v0.9.3 (2012-02-03) +- [pkg] New way of building the tar.gz archive. -2011-08-12: release 0.9.2 - [+ui] Added two predefined macros STRINGIFY and CONCAT for making +## v0.9.2 (2011-08-12) +- [+ui] Added two predefined macros STRINGIFY and CONCAT for making string literals and for building identifiers respectively. -2011-07-20: release 0.9.1 - [+ui] Added support for processing sections of files using external programs +## v0.9.1 (2011-07-20) +- [+ui] Added support for processing sections of files using external programs (#ext/#endext, -x option) - [doc] Moved and extended documentation into the README file. +- [doc] Moved and extended documentation into the README file. + +## v0.9.0 (2009-11-17) -2009-11-17: initial version 0.9.0 +- initial public release @@ -1,18 +1,18 @@ all: - @jbuilder build @install @DEFAULT + @dune build test: - @jbuilder runtest + @dune runtest install: - @jbuilder install + @dune install uninstall: - @jbuilder uninstall + @dune uninstall check: test .PHONY: clean all check test install uninstall clean: - jbuilder clean + dune clean @@ -1 +1 @@ -1.6.4 +1.6.6 diff --git a/appveyor.yml b/appveyor.yml index dc4e382..456a4cc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,5 +10,5 @@ install: build_script: - cd "%APPVEYOR_BUILD_FOLDER%" - - jbuilder subst - - jbuilder build -p cppo + - dune subst + - dune build -p cppo @@ -1,21 +1,30 @@ -opam-version: "1.2" +opam-version: "2.0" maintainer: "martin@mjambon.com" -authors: ["Martin Jambon"] -homepage: "http://mjambon.com/cppo.html" -dev-repo: "https://github.com/mjambon/cppo.git" -bug-reports: "https://github.com/mjambon/cppo/issues" +authors: "Martin Jambon" license: "BSD-3-Clause" - -build: [ - ["jbuilder" "subst"] {pinned} - ["jbuilder" "build" "-p" name "-j" jobs] -] -build-test: [ - ["jbuilder" "runtest" "-p" name] -] - +homepage: "http://mjambon.com/cppo.html" +doc: "https://ocaml-community.github.io/cppo/" +bug-reports: "https://github.com/ocaml-community/cppo/issues" depends: [ - "jbuilder" {build & >= "1.0+beta17"} - "base-bytes" + "ocaml" {>= "4.03"} + "dune" {build & >= "1.0"} "base-unix" ] +build: [ + ["dune" "subst"] {pinned} + ["dune" "build" "-p" name "-j" jobs] + ["dune" "runtest" "-p" name "-j" jobs] {with-test} +] +dev-repo: "git+https://github.com/ocaml-community/cppo.git" +synopsis: "Code preprocessor like cpp for OCaml" +description: """ +Cppo is an equivalent of the C preprocessor for OCaml programs. +It allows the definition of simple macros and file inclusion. + +Cppo is: + +* more OCaml-friendly than cpp +* easy to learn without consulting a manual +* reasonably fast +* simple to install and to maintain +""" diff --git a/cppo_ocamlbuild.opam b/cppo_ocamlbuild.opam index 14608ea..a81a6a8 100644 --- a/cppo_ocamlbuild.opam +++ b/cppo_ocamlbuild.opam @@ -1,20 +1,25 @@ -opam-version: "1.2" +opam-version: "2.0" maintainer: "martin@mjambon.com" -authors: ["Martin Jambon"] -homepage: "http://mjambon.com/cppo.html" -dev-repo: "https://github.com/mjambon/cppo.git" -bug-reports: "https://github.com/mjambon/cppo/issues" +authors: "Martin Jambon" license: "BSD-3-Clause" - -build: [ - ["jbuilder" "subst"] {pinned} - ["jbuilder" "build" "-p" name "-j" jobs] -] -build-test: [ - ["jbuilder" "runtest" "-p" name] -] - +homepage: "http://mjambon.com/cppo.html" +doc: "https://ocaml-community.github.io/cppo/" +bug-reports: "https://github.com/ocaml-community/cppo/issues" depends: [ - "jbuilder" {build & >= "1.0+beta17"} + "ocaml" + "dune" {build & >= "1.0"} "ocamlbuild" ] +build: [ + ["dune" "subst"] {pinned} + ["dune" "build" "-p" name "-j" jobs] + ["dune" "runtest" "-p" name "-j" jobs] {with-test} +] +dev-repo: "git+https://github.com/ocaml-community/cppo.git" +synopsis: "Plugin to use cppo with ocamlbuild" +description: """ +This ocamlbuild plugin lets you use cppo in ocamlbuild projects. + +To use it, you can call ocamlbuild with the argument `-plugin-tag +package(cppo_ocamlbuild)` (only since ocaml 4.01 and cppo >= 0.9.4). +""" diff --git a/dune-project b/dune-project new file mode 100644 index 0000000..902539e --- /dev/null +++ b/dune-project @@ -0,0 +1,2 @@ +(lang dune 1.0) +(name cppo) diff --git a/examples/dune b/examples/dune new file mode 100644 index 0000000..f4d9de7 --- /dev/null +++ b/examples/dune @@ -0,0 +1,32 @@ +(ocamllex lexer) + +(rule + (deps + (:< debug.ml)) + (targets debug.out) + (action + (with-stdout-to + %{targets} + (run %{bin:cppo} %{<})))) + +(rule + (deps + (:< french.ml)) + (targets french.out) + (action + (with-stdout-to + %{targets} + (run %{bin:cppo} %{<})))) + +(rule + (deps + (:< lexer.ml)) + (targets lexer.out) + (action + (with-stdout-to + %{targets} + (run %{bin:cppo} %{<})))) + +(alias + (name DEFAULT) + (deps debug.out french.out lexer.out)) diff --git a/examples/jbuild b/examples/jbuild deleted file mode 100644 index 73eac42..0000000 --- a/examples/jbuild +++ /dev/null @@ -1,22 +0,0 @@ -(jbuild_version 1) - -(ocamllex (lexer)) - -(rule - ((deps (debug.ml)) - (targets (debug.out)) - (action (with-stdout-to ${@} (run ${bin:cppo} ${<}))))) - -(rule - ((deps (french.ml)) - (targets (french.out)) - (action (with-stdout-to ${@} (run ${bin:cppo} ${<}))))) - -(rule - ((deps (lexer.ml)) - (targets (lexer.out)) - (action (with-stdout-to ${@} (run ${bin:cppo} ${<}))))) - -(alias - ((name DEFAULT) - (deps (debug.out french.out lexer.out))))
\ No newline at end of file diff --git a/ocamlbuild_plugin/dune b/ocamlbuild_plugin/dune new file mode 100644 index 0000000..b512a12 --- /dev/null +++ b/ocamlbuild_plugin/dune @@ -0,0 +1,6 @@ +(library + (name cppo_ocamlbuild) + (public_name cppo_ocamlbuild) + (wrapped false) + (synopsis "Cppo ocamlbuild plugin") + (libraries ocamlbuild)) diff --git a/ocamlbuild_plugin/jbuild b/ocamlbuild_plugin/jbuild deleted file mode 100644 index 413a809..0000000 --- a/ocamlbuild_plugin/jbuild +++ /dev/null @@ -1,8 +0,0 @@ -(jbuild_version 1) - -(library - ((name cppo_ocamlbuild) - (public_name cppo_ocamlbuild) - (wrapped false) - (synopsis "Cppo ocamlbuild plugin") - (libraries (ocamlbuild))))
\ No newline at end of file diff --git a/pkg/pkg.ml b/pkg/pkg.ml deleted file mode 100644 index 1a04c2b..0000000 --- a/pkg/pkg.ml +++ /dev/null @@ -1,2 +0,0 @@ -#use "topfind" -#require "topkg-jbuilder.auto" diff --git a/src/cppo_eval.ml b/src/cppo_eval.ml index 7542b42..fb3f9de 100644 --- a/src/cppo_eval.ml +++ b/src/cppo_eval.ml @@ -82,10 +82,11 @@ let trim_and_compact_string s = let buf = Buffer.create (String.length s) in trim_and_compact buf s; Buffer.contents buf + let trim_compact_and_capitalize_string s = let buf = Buffer.create (String.length s) in trim_and_compact buf s; - String.capitalize (Buffer.contents buf) + String.capitalize_ascii (Buffer.contents buf) let is_ident s = let len = String.length s in diff --git a/src/cppo_parser.mly b/src/cppo_parser.mly index 526f66d..21d2cdd 100644 --- a/src/cppo_parser.mly +++ b/src/cppo_parser.mly @@ -252,7 +252,7 @@ aexpr: | aexpr MOD aexpr { `Mod ($2, $1, $3) } | aexpr LSL aexpr { `Lsl ($1, $3) } | aexpr LSR aexpr { `Lsr ($1, $3) } - | aexpr ASR aexpr { `Lsr ($1, $3) } + | aexpr ASR aexpr { `Asr ($1, $3) } | aexpr LAND aexpr { `Land ($1, $3) } | aexpr LOR aexpr { `Lor ($1, $3) } | aexpr LXOR aexpr { `Lxor ($1, $3) } diff --git a/src/dune b/src/dune new file mode 100644 index 0000000..38f1809 --- /dev/null +++ b/src/dune @@ -0,0 +1,16 @@ +(ocamllex cppo_lexer) + +(ocamlyacc cppo_parser) + +(rule + (targets cppo_version.ml) + (action + (with-stdout-to + %{targets} + (echo "let cppo_version = \"%{version:cppo}\"")))) + +(executable + (name cppo_main) + (package cppo) + (public_name cppo) + (libraries unix str)) diff --git a/src/jbuild b/src/jbuild deleted file mode 100644 index b9f335b..0000000 --- a/src/jbuild +++ /dev/null @@ -1,16 +0,0 @@ -(jbuild_version 1) - -(ocamllex (cppo_lexer)) -(ocamlyacc (cppo_parser)) - -(rule - ((targets (cppo_version.ml)) - (action - (with-stdout-to ${@} - (echo "let cppo_version = \"${version:cppo}\""))))) - -(executable - ((name cppo_main) - (package cppo) - (public_name cppo) - (libraries (unix str))))
\ No newline at end of file diff --git a/test/dune b/test/dune new file mode 100644 index 0000000..a7fab7b --- /dev/null +++ b/test/dune @@ -0,0 +1,130 @@ +(rule + (targets ext.out) + (deps + (:< ext.cppo) + source.sh) + (action + (with-stdout-to + %{targets} + (run %{bin:cppo} -x "rot13:tr '[a-z]' '[n-za-m]'" -x + "source:sh source.sh '%F' %B %E" %{<})))) + +(rule + (targets comments.out) + (deps + (:< comments.cppo)) + (action + (with-stdout-to + %{targets} + (run %{bin:cppo} %{<})))) + +(rule + (targets cond.out) + (deps + (:< cond.cppo)) + (action + (with-stdout-to + %{targets} + (run %{bin:cppo} %{<})))) + +(rule + (targets tuple.out) + (deps + (:< tuple.cppo)) + (action + (with-stdout-to + %{targets} + (run %{bin:cppo} %{<})))) + +(rule + (targets loc.out) + (deps + (:< loc.cppo)) + (action + (with-stdout-to + %{targets} + (run %{bin:cppo} %{<})))) + +(rule + (targets paren_arg.out) + (deps + (:< paren_arg.cppo)) + (action + (with-stdout-to + %{targets} + (run %{bin:cppo} %{<})))) + +(rule + (targets unmatched.out) + (deps + (:< unmatched.cppo)) + (action + (with-stdout-to + %{targets} + (run %{bin:cppo} %{<})))) + +(rule + (targets version.out) + (deps + (:< version.cppo)) + (action + (with-stdout-to + %{targets} + (run %{bin:cppo} -V X:123.05.2-alpha.1+foo-2.1 %{<})))) + +(alias + (name runtest) + (package cppo) + (action + (diff ext.ref ext.out))) + +(alias + (name runtest) + (package cppo) + (action + (diff comments.ref comments.out))) + +(alias + (name runtest) + (package cppo) + (action + (diff cond.ref cond.out))) + +(alias + (name runtest) + (package cppo) + (action + (diff tuple.ref tuple.out))) + +(alias + (name runtest) + (package cppo) + (action + (diff loc.ref loc.out))) + +(alias + (name runtest) + (package cppo) + (action + (diff paren_arg.ref paren_arg.out))) + +(alias + (name runtest) + (package cppo) + (deps version.out)) + +(alias + (name runtest) + (package cppo) + (action + (diff unmatched.ref unmatched.out))) + +(alias + (name runtest) + (package cppo) + (deps + (:< test.cppo) + incl.cppo + incl2.cppo) + (action + (ignore-stdout (run %{bin:cppo} %{<})))) diff --git a/test/jbuild b/test/jbuild deleted file mode 100644 index 4efbb88..0000000 --- a/test/jbuild +++ /dev/null @@ -1,95 +0,0 @@ -(jbuild_version 1) - -(rule - ((targets (ext.out)) - (deps (ext.cppo source.sh)) - (action - (with-stdout-to ${@} (run ${bin:cppo} -x "rot13:tr '[a-z]' '[n-za-m]'" -x "source:sh source.sh '%F' %B %E" ${<}))))) - -(rule - ((targets (comments.out)) - (deps (comments.cppo)) - (action - (with-stdout-to ${@} (run ${bin:cppo} ${<}))))) - -(rule - ((targets (cond.out)) - (deps (cond.cppo)) - (action - (with-stdout-to ${@} (run ${bin:cppo} ${<}))))) - -(rule - ((targets (tuple.out)) - (deps (tuple.cppo)) - (action - (with-stdout-to ${@} (run ${bin:cppo} ${<}))))) - -(rule - ((targets (loc.out)) - (deps (loc.cppo)) - (action - (with-stdout-to ${@} (run ${bin:cppo} ${<}))))) - -(rule - ((targets (paren_arg.out)) - (deps (paren_arg.cppo)) - (action - (with-stdout-to ${@} (run ${bin:cppo} ${<}))))) - -(rule - ((targets (unmatched.out)) - (deps (unmatched.cppo)) - (action - (with-stdout-to ${@} (run ${bin:cppo} ${<}))))) - -(rule - ((targets (version.out)) - (deps (version.cppo)) - (action - (with-stdout-to ${@} (run ${bin:cppo} -V X:123.05.2-alpha.1+foo-2.1 ${<}))))) - -(alias - ((name runtest) - (package cppo) - (action (diff ext.ref ext.out)))) - -(alias - ((name runtest) - (package cppo) - (action (diff comments.ref comments.out)))) - -(alias - ((name runtest) - (package cppo) - (action (diff cond.ref cond.out)))) - -(alias - ((name runtest) - (package cppo) - (action (diff tuple.ref tuple.out)))) - -(alias - ((name runtest) - (package cppo) - (action (diff loc.ref loc.out)))) - -(alias - ((name runtest) - (package cppo) - (action (diff paren_arg.ref paren_arg.out)))) - -(alias - ((name runtest) - (package cppo) - (deps (version.out)))) - -(alias - ((name runtest) - (package cppo) - (action (diff unmatched.ref unmatched.out)))) - -(alias - ((name runtest) - (package cppo) - (deps (test.cppo incl.cppo incl2.cppo)) - (action (ignore-stdout (run ${bin:cppo} ${<}))))) |