diff -Nru ocaml-deriving-ocsigen-0.6.2/CHANGES ocaml-deriving-ocsigen-0.7/CHANGES --- ocaml-deriving-ocsigen-0.6.2/CHANGES 2014-04-10 10:21:23.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/CHANGES 2014-09-30 09:10:36.000000000 +0000 @@ -1,3 +1,9 @@ +== 0.7 + + * Compatibility with ocaml-4.02 (Peter Zotoz, Hugo Heuzard) + * Fix toplevel usage (Vincent Bernardoff) + * Class: add equality for sets (Jeremy Yallop) + == 0.6 * Added a 'Default' class (Hugo Heuzard) diff -Nru ocaml-deriving-ocsigen-0.6.2/configure ocaml-deriving-ocsigen-0.7/configure --- ocaml-deriving-ocsigen-0.6.2/configure 2014-04-10 10:21:23.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/configure 2014-09-30 09:10:36.000000000 +0000 @@ -1,5 +1,9 @@ #!/bin/sh +# OASIS_START +# DO NOT EDIT (digest: 6f7b8221311e800a7093dc3b793f67ca) +set -e + FST=true for i in "$@"; do if $FST; then @@ -19,4 +23,5 @@ esac done -make configure CONFIGUREFLAGS="$@" +make configure CONFIGUREFLAGS="$*" +# OASIS_STOP diff -Nru ocaml-deriving-ocsigen-0.6.2/debian/changelog ocaml-deriving-ocsigen-0.7/debian/changelog --- ocaml-deriving-ocsigen-0.6.2/debian/changelog 2014-06-14 13:13:53.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/debian/changelog 2015-11-05 15:22:23.000000000 +0000 @@ -1,3 +1,23 @@ +ocaml-deriving-ocsigen (0.7-2build1) xenial; urgency=medium + + * No-change rebuild against ocaml 4.02. + + -- Łukasz 'sil2100' Zemczak Thu, 05 Nov 2015 09:22:23 -0600 + +ocaml-deriving-ocsigen (0.7-2) unstable; urgency=medium + + * Fix FTBFS due to oasis 0.4.5 installing new files + + -- Stéphane Glondu Fri, 04 Sep 2015 20:24:08 +0200 + +ocaml-deriving-ocsigen (0.7-1) unstable; urgency=medium + + * New upstream release + * Drop versioned Build-Depends to camlp4-extra + * Bump Standards-Version to 3.9.6 + + -- Stéphane Glondu Fri, 04 Sep 2015 11:20:16 +0200 + ocaml-deriving-ocsigen (0.6.2-1) unstable; urgency=medium * New upstream release diff -Nru ocaml-deriving-ocsigen-0.6.2/debian/control ocaml-deriving-ocsigen-0.7/debian/control --- ocaml-deriving-ocsigen-0.6.2/debian/control 2014-06-14 13:11:53.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/debian/control 2015-09-04 18:23:21.000000000 +0000 @@ -11,9 +11,9 @@ debhelper (>= 9), libtype-conv-camlp4-dev (>= 108), liboptcomp-camlp4-dev, - oasis (>= 0.4), - camlp4-extra (>= 4.01) -Standards-Version: 3.9.5 + oasis (>= 0.4.5), + camlp4-extra +Standards-Version: 3.9.6 Homepage: https://github.com/ocsigen/deriving Vcs-Git: git://anonscm.debian.org/pkg-ocaml-maint/packages/ocaml-deriving-ocsigen.git Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-ocaml-maint/packages/ocaml-deriving-ocsigen.git diff -Nru ocaml-deriving-ocsigen-0.6.2/debian/libderiving-ocsigen-ocaml-dev.install.in ocaml-deriving-ocsigen-0.7/debian/libderiving-ocsigen-ocaml-dev.install.in --- ocaml-deriving-ocsigen-0.6.2/debian/libderiving-ocsigen-ocaml-dev.install.in 2014-06-14 13:11:53.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/debian/libderiving-ocsigen-ocaml-dev.install.in 2015-09-04 13:11:47.000000000 +0000 @@ -1,3 +1,6 @@ +@OCamlStdlibDir@/deriving/*.annot +@OCamlStdlibDir@/deriving/*.cmt +@OCamlStdlibDir@/deriving/*.cmti @OCamlStdlibDir@/deriving/*.cmi @OCamlStdlibDir@/deriving/*.mli @OCamlStdlibDir@/deriving/*.ml @@ -5,3 +8,4 @@ OPT: @OCamlStdlibDir@/deriving/*.cmxa OPT: @OCamlStdlibDir@/deriving/*.a OPT: @OCamlStdlibDir@/deriving/*.cmx +usr/share/doc/libderiving-ocsigen-ocaml-dev/api diff -Nru ocaml-deriving-ocsigen-0.6.2/debian/rules ocaml-deriving-ocsigen-0.7/debian/rules --- ocaml-deriving-ocsigen-0.6.2/debian/rules 2014-06-14 13:11:53.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/debian/rules 2015-09-04 06:53:10.000000000 +0000 @@ -16,23 +16,23 @@ .PHONY: override_dh_auto_configure override_dh_auto_configure: - ocaml setup.ml -configure --prefix /usr --destdir '$(DESTDIR)' --docdir /usr/share/doc/libderiving-ocsigen-ocaml-dev + $(MAKE) configure CONFIGUREFLAGS="--prefix /usr --destdir '$(DESTDIR)' --docdir /usr/share/doc/libderiving-ocsigen-ocaml-dev" .PHONY: override_dh_auto_build override_dh_auto_build: - ocaml setup.ml -build - ocaml setup.ml -doc + $(MAKE) build + $(MAKE) doc .PHONY: override_dh_auto_test override_dh_auto_test: - ocaml setup.ml -test + $(MAKE) test .PHONY: override_dh_auto_install override_dh_auto_install: mkdir -p '$(OCAMLFIND_DESTDIR)' - ocaml setup.ml -install + $(MAKE) install .PHONY: override_dh_auto_clean override_dh_auto_clean: - ocaml setup.ml -distclean + $(MAKE) distclean rm -f setup*.exe diff -Nru ocaml-deriving-ocsigen-0.6.2/doc/apiref-intro ocaml-deriving-ocsigen-0.7/doc/apiref-intro --- ocaml-deriving-ocsigen-0.6.2/doc/apiref-intro 1970-01-01 00:00:00.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/doc/apiref-intro 2014-09-30 09:10:36.000000000 +0000 @@ -0,0 +1,40 @@ +{1 Deriving - API Reference} + +{2 Runtime library} + +Runtime for deriving classes shipped with deriving. + +{!modules: +Deriving_Show +Deriving_Eq +Deriving_Bounded +Deriving_Enum +Deriving_monad +Deriving_Dump +Deriving_Typeable +Deriving_Pickle +Deriving_Functor +Deriving_Default +} + +{!modules: +Deriving_num +} + +{2 Syntax} +The {e deriving.syntax.common} package contains modules needed to +write deriving classes. + +{!modules: +Id +Utils +Type +Defs +Clusters +Base +Extend +} + +{2 Index} + +{!indexlist} diff -Nru ocaml-deriving-ocsigen-0.6.2/doc/manual-wiki/classes.wiki ocaml-deriving-ocsigen-0.7/doc/manual-wiki/classes.wiki --- ocaml-deriving-ocsigen-0.6.2/doc/manual-wiki/classes.wiki 1970-01-01 00:00:00.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/doc/manual-wiki/classes.wiki 2014-09-30 09:10:36.000000000 +0000 @@ -0,0 +1,230 @@ += Standard classes = +== Show == + +< a -> unit + val format_list : Format.formatter -> a list -> unit + val show : a -> string + val show_list : a list -> string +end +>> + +If you're writing your own instance then you'll find the Defaults useful. The only method you have to write yourself is format: + +< a -> unit + end) : Show with type a = S.a + +>> +== Eq == + +< a -> bool +end +>> + +== Typeable == + +< t -> int + val eq : t -> t -> bool + ... +end +>> + +The exception CastFailure is thrown when throwing_cast fails: + +<> +< TypeRep.t + val has_type : dynamic -> bool + val cast : dynamic -> a option + val throwing_cast : dynamic -> a + val make_dynamic : a -> dynamic + val mk : a -> dynamic +end +>> + +If you're writing your own instance (which is not recommended in this +case!) you can just supply the type_rep method and use the Defaults +functor: + +< TypeRep.t + end)) + : Typeable with type a = T.a +>> + +== Dump == + +< a -> unit + val to_string : a -> string + val to_channel : out_channel -> a -> unit + val from_stream : char Stream.t -> a + val from_string : string -> a + val from_channel : in_channel -> a + end +>> + +If the input doesn't match the type then deserialisation will fail +with the exception: + +<> + +If you're writing your own instance then you use the Defaults functor, +which requires implementations of the methods to_buffer and +from_stream. + +< a -> unit + val from_stream : char Stream.t -> a + end) : Dump with type a = P.a +>> +== Pickle == +< id Write.m + val unpickle : id -> a Read.m + val to_buffer : Buffer.t -> a -> unit + val to_string : a -> string + val to_channel : out_channel -> a -> unit + val from_stream : char Stream.t -> a + val from_string : string -> a + val from_channel : in_channel -> a +end +>> + +If deserialisation (unmarshalling) fails then one of the following +exceptions is thrown: + + +<> + +As usual, you can use the Defaults method when writing your own +instance: + +< id Write.m + val unpickle : id -> a Read.m + end) : Pickle with type a = S.a +>> + +You can also create a Pickle instance from a Dump instance, although +you may limit the opportunities for sharing if you do: + +<> + +== Enum == + +< a + val pred : a -> a + val to_enum : int -> a + val from_enum : a -> int + val enum_from : a -> a list + val enum_from_then : a -> a -> a list + val enum_from_to : a -> a -> a list + val enum_from_then_to : a -> a -> a -> a list + end + +>> + +There are two easy ways to write your own instance of Enum: you can +supply an explicit mapping from values of your type to integers: + +<> + +or you can supply the mapping as a pair of functions, together with suitable bounds for your type: +< int val to_enum : int -> a end) + (B : Bounded.Bounded with type a = E.a) + : Enum with type a = B.a +>> + +== Bounded == +<> + +== Functor == + +There is no signature for Functor, since the type of the derived +function depends on the number of type parameters. For example, a type +with one parameter will result in a singature + +< 'b) -> 'a f -> 'b f +end +>> + +whereas a type with three parameters will generate an instance with +signature + +< 'd) -> ('b -> 'e) -> ('c -> 'f) -> ('a,'b,'c) f -> ('d,'e,'f) f +end +>> diff -Nru ocaml-deriving-ocsigen-0.6.2/doc/manual-wiki/intro.wiki ocaml-deriving-ocsigen-0.7/doc/manual-wiki/intro.wiki --- ocaml-deriving-ocsigen-0.6.2/doc/manual-wiki/intro.wiki 1970-01-01 00:00:00.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/doc/manual-wiki/intro.wiki 2014-09-30 09:10:36.000000000 +0000 @@ -0,0 +1,367 @@ += deriving examples = +== Pretty printing == + +The deriving preprocessor and library provide common functionality +which has an obvious definition at most types. For example, it's +usually easy, although tedious, to write a to_string function for a +new type you've defined; deriving will save you the trouble by writing +the function for you automatically. To call a deriving function at a +particular type you use a special notation: + + +< argument +>> + +(Note that the terms "Class" and "method" are taken from Haskell's + type classes, and has nothing to do with OCaml's object-oriented + class system.) + + +For example, to call the show method of the Show class to convert an +integer to a string you would write: + +< 3 +=> +"3" +>> + +You can also specify more complex types: + +< factors +=> +"[(10,[2; 5]); (11, []); 12, [2; 3; 4; 6]]" +>> + +To use a deriving function at a type you've defined, you need to add +the phrase deriving (Class) to the end of your type definition. For +example, + +< points +=> +"Branch + (Leaf {x =193.11; y =132.13}, {x =211.91; y =201.11}, + Branch + (Leaf {x =113.12; y =1.}, {x =12.7; y =44.1}, Leaf {x =0.; y + =13.41}))" + +>> + +If you want to show values of an abstract type defined in a module +outside the module you should add the deriving annotation to the +signature as well: + + +< t -> t + val top : t -> int + val pop : t -> t +end = +struct + type t = Stack of int list + deriving (Show) + let empty = Stack [] + let push item (Stack list) = Stack (item::list) + let top (Stack (top::_)) = top + let pop (Stack (_::rest)) = Stack rest +end + +Show.show + (IntStack.push 3 (IntStack.push 4 (IntStack.push 5 IntStack.empty))) +=> +"Stack [3; 4; 5]" +>> + +You can derive Show for most types, including recursive (and mutually +recursive) types, normal and polymorphic variants, records, tuples and +types containing other types for which Show has been derived. You +can't derive Show for functions because there's usually no meaningful +way to display them. If you have a way to display values of a type for +which Show cannot be derived then you can always write your own +definition and make it available to deriving; see the section +"Extending definitions". + + +== Dynamic typing == + +The `Typeable' class provides operations for converting between a +universal type `dynamic' and any other type. Converting from dynamic +to another type succeeds only if the type specified in the conversion +matches the type used to create the dynamic value. The upcast +operation is called mk (or make_dynamic if you prefer to be +verbose). The downcasts are cast, which returns an option value, and +throwing_cast, which throws an exception if the downcast fails. + + +< 3; + Typeable.mk 3.0; + Typeable.mk (Leaf "three")] +=> +[; ; ] + +Typeable.cast (List.hd items) +=> +Some 3 + +Typeable.throwing_cast (List.hd items) +=> +3 + +Typeable.cast (List.hd items) +=> +None + +Typeable.throwing_cast (List.hd items) +=> +Exception: Typeable.CastFailure "cast failed". +>> + +Casts also work between equivalent polymorphic variant types (even if +the types used for the upcast and downcast are defined differently): + +< + (Typeable.mk l) +=> +Some (`Cons (3, `Cons (2, `Cons (1, `Nil)))) + +>> + +Casts don't work between record or normal variant types which are +defined separately, even if the definitions are identical. + +< (Typeable.mk {x : -1.0; y : 0.0}) +=> +None +>> + +However, abstraction using module signatures does not change whether +types are interconvertible, so you can use Typeable to access the +representation of an abstract type if you know it. + + +< (Typeable.mk T.v) +=> +12 +>> + +== Equality == + +There are two polymorphic equality operators in OCaml: + +{{{=}}} tests for structural equality. +{{{==}}} tests for physical equality. +Sometimes neither of these is appropriate. Instead, we want to test +for structural equality at immutable types and physical equality +(identity) at mutable types (as in SML). This sort of equality tests +whether two values can be used interchangeably in a program. + + +< (ref 1) (ref 1) +=> +false + +let x = ref 1 in Eq.eq x x +=> +true + +Eq.eq [1;2;3] [1;2;3] +=> +true + +type mpoint = { mutable x : float; mutable y : float} + deriving (Eq) + +Eq.eq {x = 1.0; y = 2.0} {x = 1.0; y = 2.0} +=> +false + +let p = {x = 1.0; y = 2.0} in Eq.eq p p +=> +true + +type ipoint = { x : float; y : float} + deriving (Eq) + +Eq.eq {x = 1.0; y = 2.0} {x = 1.0; y = 2.0} +=> +true +>> + +== Serialisation == +The `Pickle' class provides operations for structure-sharing +serialisation (marshalling). If any value to be serialised contains +two equal subvalues then only one copy of the subvalue will be +serialised. Cycles that are created by mutable record fields, +including references, are preserved. + +All "instances" of Pickle must also be "instances" of Eq and +Typeable. (As in Haskell, we use "instance" to mean a set of functions +that implement the methods of a class at a particular type.) + +< points +=> +"\007\003\t\128\128\128\128\128\128\128\248?\t\128\128\128\128\128\128\128\128@\001\000\005\000\001\008\000\001\n\001\003\004\t\003\000\001\012\001\003\006\011\005\005\002\002\000\002\000\002\002\000\000\002\001\001\002\002\002" + +Pickle.from_string (Pickle.to_string points) +=> +Branch + (Leaf {x =193.11; y =132.13}, {x =211.91; y =201.11}, + Branch + (Leaf {x =113.12; y =1.}, {x =12.7; y =44.1}, Leaf {x =0.; y =13.41})) +>> + +You can supply a custom definition of equality (see the section +"Extending definitions") to increase sharing: see the file +tests/exp.ml in the distribution for an example. + +There is another class, `Dump', that provides simpler value-oriented +serialisation, but doesn't deal with references or cycles. + + +== Map == + +Given a type ('a1,...,'an) t, the `Functor' class will derive a map operation: +<'b1) -> ... ('an->'bn} -> ('a1,...,'an) t -> ('b1,...,'bn) t +>> + +For example, + +< +(Branch (Leaf 4, 5, Leaf 6)) +>> + +The notation is not currently available for Functor. + +== Enumerations == + +Enumerations provide several operations for dealing with variant types +where all constructors have no argument. + + +< 0 10 +=> +[0; 1; 2; 3; 4; 5; 6; 7; 8; 9; 10] + +type fruit = Apple | Orange | Banana | Kiwi + deriving (Enum) + +Enum.enum_from_to Apple Kiwi +=> +[Apple; Orange; Banana; Kiwi] + +Enum.succ Orange +=> +Banana +>> + +== Minimum and maximum values == +Instances of bounded have maximum and minimum values: + +<, Bounded.max_bound) +=> +((-1073741824, Apple), (1073741823, Kiwi)) +>> + +== Extending definitions == +Instead of deriving a definition automatically you can provide your +own by writing a module with the same signature as the standard +definitions with a name formed from the class name, an underscore, and +the name of the type constructor for which you want to provide the +definition. + +< true + | _ -> false +end) + +Eq.eq [Apple; Orange; Banana] [Orange; Orange; Banana] +=> +true + +>> diff -Nru ocaml-deriving-ocsigen-0.6.2/.gitignore ocaml-deriving-ocsigen-0.7/.gitignore --- ocaml-deriving-ocsigen-0.6.2/.gitignore 2014-04-10 10:21:23.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/.gitignore 2014-09-30 09:10:36.000000000 +0000 @@ -10,7 +10,7 @@ syntax/common/id.ml *.bak *.ba0 -setup-dev.exe +setup.exe *.mllib *.mlpack lib/META diff -Nru ocaml-deriving-ocsigen-0.6.2/.jenkins.sh ocaml-deriving-ocsigen-0.7/.jenkins.sh --- ocaml-deriving-ocsigen-0.6.2/.jenkins.sh 1970-01-01 00:00:00.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/.jenkins.sh 2014-09-30 09:10:36.000000000 +0000 @@ -0,0 +1,15 @@ + +opam pin add --no-action deriving . +opam install type_conv +opam install --deps-only deriving +opam install --verbose deriving + +do_build_doc () { + make wikidoc + cp -Rf doc/manual-wiki/*.wiki ${MANUAL_SRC_DIR} + cp -Rf _build/deriving-api.wikidocdir/*.wiki ${API_DIR} +} + +do_remove () { + opam remove --verbose deriving +} diff -Nru ocaml-deriving-ocsigen-0.6.2/lib/deriving_Dump.ml ocaml-deriving-ocsigen-0.7/lib/deriving_Dump.ml --- ocaml-deriving-ocsigen-0.6.2/lib/deriving_Dump.ml 2014-04-10 10:21:23.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/lib/deriving_Dump.ml 2014-09-30 09:10:36.000000000 +0000 @@ -138,9 +138,9 @@ end and from_stream stream = let len = Dump_int.from_stream stream in - let s = String.create len in + let s = Bytes.create len in for i = 0 to len - 1 do - String.set s i (Stream.next stream) (* could use String.unsafe_set here *) + Bytes.unsafe_set s i (Stream.next stream) done; s end @@ -243,11 +243,11 @@ let to_buffer buffer obj = Buffer.add_string buffer (Marshal.to_string obj [Marshal.Closures]) let from_stream stream = let readn n = - let s = String.create n in - for i = 0 to n - 1 do - String.set s i (Stream.next stream) - done; - s + let s = Bytes.create n in + for i = 0 to n - 1 do + Bytes.set s i (Stream.next stream) + done; + s in let header = readn Marshal.header_size in let datasize = Marshal.data_size header 0 in diff -Nru ocaml-deriving-ocsigen-0.6.2/lib/deriving_Eq.ml ocaml-deriving-ocsigen-0.7/lib/deriving_Eq.ml --- ocaml-deriving-ocsigen-0.6.2/lib/deriving_Eq.ml 2014-04-10 10:21:23.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/lib/deriving_Eq.ml 2014-09-30 09:10:36.000000000 +0000 @@ -54,6 +54,13 @@ let eq = M.equal (E.eq) end +module Eq_set_s_t (S : Set.S) + : Eq with type a = S.t = +struct + type a = S.t + let eq = S.equal +end + module Eq_list (E : Eq) : Eq with type a = E.a list = struct diff -Nru ocaml-deriving-ocsigen-0.6.2/lib/deriving_Eq.mli ocaml-deriving-ocsigen-0.7/lib/deriving_Eq.mli --- ocaml-deriving-ocsigen-0.6.2/lib/deriving_Eq.mli 2014-04-10 10:21:23.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/lib/deriving_Eq.mli 2014-09-30 09:10:36.000000000 +0000 @@ -26,3 +26,4 @@ module Eq_list (E : Eq) : Eq with type a = E.a list module Eq_option (E : Eq): Eq with type a = E.a option module Eq_map_s_t (E : Eq) (M : Map.S) : Eq with type a = E.a M.t +module Eq_set_s_t (S : Set.S) : Eq with type a = S.t diff -Nru ocaml-deriving-ocsigen-0.6.2/lib/deriving_interned.ml ocaml-deriving-ocsigen-0.7/lib/deriving_interned.ml --- ocaml-deriving-ocsigen-0.6.2/lib/deriving_interned.ml 2014-04-10 10:21:23.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/lib/deriving_interned.ml 2014-09-30 09:10:36.000000000 +0000 @@ -4,25 +4,25 @@ *) (* Interned strings *) -module StringMap = Map.Make(String) +module BytesMap = Map.Make(Bytes) (* global state *) -let map = ref StringMap.empty +let map = ref BytesMap.empty let counter = ref 0 type t = int * string deriving (Show) -let intern s = - try StringMap.find s !map +let intern s = + try BytesMap.find s !map with Not_found -> - let fresh = (!counter, String.copy s) in begin - map := StringMap.add s fresh !map; - incr counter; - fresh - end - -let to_string (_,s) = String.copy s + let fresh = (!counter, Bytes.of_string s) in begin + map := BytesMap.add s fresh !map; + incr counter; + fresh + end + +let to_string (_,s) = Bytes.to_string s let name = snd let compare (l,_) (r,_) = compare l r let eq (l,_) (r,_) = l = r diff -Nru ocaml-deriving-ocsigen-0.6.2/lib/META.ab ocaml-deriving-ocsigen-0.7/lib/META.ab --- ocaml-deriving-ocsigen-0.6.2/lib/META.ab 2014-04-10 10:21:23.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/lib/META.ab 2014-09-30 09:10:36.000000000 +0000 @@ -2,7 +2,6 @@ description = "Deriving" requires = "$(pkg_name).runtime, $(pkg_name).syntax" -requires(syntax, preprocessor) = "$(pkg_name).syntax" archive(syntax, preprocessor) = "-ignore dummy" error(pkg_type_conv, pkg_deriving) = "Could not be loaded together with 'type_conv'. Please use $(pkg_name).tc instead." @@ -14,12 +13,14 @@ archive(byte, pkg_num) += "deriving_num.cma" archive(native, pkg_num) += "deriving_num.cmxa" + requires = "bytes" + ) package "syntax" ( requires(syntax, preprocessor) = "$(pkg_name).syntax.std, $(pkg_name).syntax.classes" - requires(syntax, toploop) = "$(pkg_name).syntax.std, $(pkg_name).syntax.classes" + requires(toploop) = "$(pkg_name).syntax.std, $(pkg_name).syntax.classes" archive(syntax, preprocessor) = "-ignore dummy" error(pkg_type_conv, pkg_deriving.syntax, -pkg_deriving) = "Could not be loaded together with 'type_conv'. Please use $(pkg_name).syntax_tc instead." @@ -27,7 +28,7 @@ package "common" ( requires(syntax, preprocessor) = "unix, camlp4" - requires(syntax, toploop) = "unix, camlp4" + requires(toploop) = "unix, camlp4" archive(syntax, preprocessor) = "pa_deriving_common.cma" archive(syntax, toploop) = "pa_deriving_common.cma" @@ -40,7 +41,7 @@ version = "$(pkg_version)" requires(syntax, preprocessor) = "$(pkg_name).syntax.common" - requires(syntax, toploop) = "$(pkg_name).syntax.common" + requires(toploop) = "$(pkg_name).syntax.common" error(pkg_type_conv, -pkg_deriving.syntax, -pkg_deriving) = "Could not be loaded together with 'type_conv'. Please use $(pkg_name).syntax.tc instead." @@ -57,7 +58,7 @@ version = "$(pkg_version)" requires(syntax, preprocessor) = "$(pkg_name).syntax.common, type_conv" - requires(syntax, toploop) = "$(pkg_name).syntax.common, type_conv" + requires(toploop) = "$(pkg_name).syntax.common, type_conv" exists_if = "pa_deriving_tc.cma" @@ -72,7 +73,7 @@ version = "$(pkg_version)" requires(syntax, preprocessor) = "$(pkg_name).syntax.common" - requires(syntax, toploop) = "$(pkg_name).syntax.common" + requires(toploop) = "$(pkg_name).syntax.common" exists_if = "pa_deriving_classes.cma" @@ -85,12 +86,11 @@ package "tc" ( requires = "$(pkg_name).runtime, $(pkg_name).syntax_tc" - requires(syntax, preprocessor) = "$(pkg_name).syntax_tc" archive(syntax, preprocessor) = "-ignore dummy" ) package "syntax_tc" ( requires(syntax, preprocessor) = "$(pkg_name).syntax.tc, $(pkg_name).syntax.classes" - requires(syntax, toploop) = "$(pkg_name).syntax.tc, $(pkg_name).syntax.classes" + requires(toploop) = "$(pkg_name).syntax.tc, $(pkg_name).syntax.classes" archive(syntax, preprocessor) = "-ignore dummy" ) diff -Nru ocaml-deriving-ocsigen-0.6.2/Makefile ocaml-deriving-ocsigen-0.7/Makefile --- ocaml-deriving-ocsigen-0.6.2/Makefile 2014-04-10 10:21:23.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/Makefile 2014-09-30 09:10:36.000000000 +0000 @@ -1,65 +1,49 @@ -# Makefile -# -------- -# Copyright : (c) 2012, Jeremie Dimino -# Licence : BSD3 -# -# Generic Makefile for oasis project - -# Set to setup.exe for the release -SETUP := setup-dev.exe - -ifeq ($(shell ocamlc -v | grep -q "version 3.12"; echo $$?),0) -# FIX for ocaml version 3.12, link with toplevellib.cma -TOPLEVEL := toplevellib.cma -else -TOPLEVEL := -package compiler-libs.toplevel -endif - -# Default rule -default: build - -# Setup for the development version -setup-dev.exe: _oasis setup.ml - grep -v '^#' setup.ml > setup_dev.ml - ocamlfind ocamlc -o $@ -linkpkg -package ocamlbuild,oasis.dynrun $(TOPLEVEL) setup_dev.ml || true - rm -f setup_dev.* +# OASIS_START +# DO NOT EDIT (digest: 9a60866e2fa295c5e33a3fe33b8f3a32) -# Setup for the release -setup.exe: setup.ml - ocamlopt.opt -o $@ $< || ocamlopt -o $@ $< || ocamlc -o $@ $< - rm -f setup.cmx setup.cmi setup.o setup.obj setup.cmo +SETUP = ./setup.exe -build: $(SETUP) setup.data - ./$(SETUP) -build $(BUILDFLAGS) +build: setup.data $(SETUP) + $(SETUP) -build $(BUILDFLAGS) -doc: $(SETUP) setup.data build - ./$(SETUP) -doc $(DOCFLAGS) +doc: setup.data $(SETUP) build + $(SETUP) -doc $(DOCFLAGS) -test: $(SETUP) setup.data build - ./$(SETUP) -test $(TESTFLAGS) +test: setup.data $(SETUP) build + $(SETUP) -test $(TESTFLAGS) all: $(SETUP) - ./$(SETUP) -all $(ALLFLAGS) + $(SETUP) -all $(ALLFLAGS) -install: $(SETUP) setup.data - ./$(SETUP) -install $(INSTALLFLAGS) +install: setup.data $(SETUP) + $(SETUP) -install $(INSTALLFLAGS) -uninstall: $(SETUP) setup.data - ./$(SETUP) -uninstall $(UNINSTALLFLAGS) +uninstall: setup.data $(SETUP) + $(SETUP) -uninstall $(UNINSTALLFLAGS) -reinstall: $(SETUP) setup.data - ./$(SETUP) -reinstall $(REINSTALLFLAGS) +reinstall: setup.data $(SETUP) + $(SETUP) -reinstall $(REINSTALLFLAGS) clean: $(SETUP) - ./$(SETUP) -clean $(CLEANFLAGS) + $(SETUP) -clean $(CLEANFLAGS) distclean: $(SETUP) - ./$(SETUP) -distclean $(DISTCLEANFLAGS) + $(SETUP) -distclean $(DISTCLEANFLAGS) + $(RM) $(SETUP) + +setup.data: $(SETUP) + $(SETUP) -configure $(CONFIGUREFLAGS) configure: $(SETUP) - ./$(SETUP) -configure $(CONFIGUREFLAGS) + $(SETUP) -configure $(CONFIGUREFLAGS) -setup.data: $(SETUP) - ./$(SETUP) -configure $(CONFIGUREFLAGS) +setup.exe: setup.ml + ocamlfind ocamlopt -o $@ -linkpkg -package oasis.dynrun $< || ocamlfind ocamlc -o $@ -linkpkg -package oasis.dynrun $< || true + $(RM) setup.cmi setup.cmo setup.cmx setup.o + +.PHONY: build doc test all install uninstall reinstall clean distclean configure + +# OASIS_STOP -.PHONY: default build doc test all install uninstall reinstall clean distclean configure +wikidoc: $(SETUP) setup.data build + $(SETUP) -build deriving-api.wikidocdir/index.wiki diff -Nru ocaml-deriving-ocsigen-0.6.2/myocamlbuild.ml ocaml-deriving-ocsigen-0.7/myocamlbuild.ml --- ocaml-deriving-ocsigen-0.6.2/myocamlbuild.ml 2014-04-10 10:21:23.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/myocamlbuild.ml 2014-09-30 09:10:36.000000000 +0000 @@ -27,4 +27,45 @@ flag ["ocaml"; "doc"; tag] & S[A"-ppopt"; A file]; dep ["ocaml"; "ocamldep"; tag] [file]) ["common"; "std"; "tc"; "classes"]; + + (* Use an introduction page with categories *) + tag_file "deriving-api.docdir/index.html" ["apiref"]; + dep ["apiref"] ["doc/apiref-intro"]; + flag ["apiref"] & S[A "-intro"; P "doc/apiref-intro"; A"-colorize-code"]; + | _ -> ()) + + + +(* Compile the wiki version of the Ocamldoc. + + Thanks to Till Varoquaux on usenet: + http://www.digipedia.pl/usenet/thread/14273/231/ + +*) + +let ocamldoc_wiki tags deps docout docdir = + let tags = tags -- "extension:html" in + Ocamlbuild_pack.Ocaml_tools.ocamldoc_l_dir tags deps docout docdir + +let () = + try + let wikidoc_dir = + let base = Ocamlbuild_pack.My_unix.run_and_read "ocamlfind query wikidoc" in + String.sub base 0 (String.length base - 1) + in + + Ocamlbuild_pack.Rule.rule + "ocamldoc: document ocaml project odocl & *odoc -> wikidocdir" + ~insert:`top + ~prod:"%.wikidocdir/index.wiki" + ~stamp:"%.wikidocdir/wiki.stamp" + ~dep:"%.odocl" + (Ocamlbuild_pack.Ocaml_tools.document_ocaml_project + ~ocamldoc:ocamldoc_wiki + "%.odocl" "%.wikidocdir/index.wiki" "%.wikidocdir"); + + tag_file "deriving-api.wikidocdir/index.wiki" ["apiref";"wikidoc"]; + flag ["wikidoc"] & S[A"-i";A wikidoc_dir;A"-g";A"odoc_wiki.cma"] + + with Failure e -> () (* Silently fail if the package wikidoc isn't available *) diff -Nru ocaml-deriving-ocsigen-0.6.2/_oasis ocaml-deriving-ocsigen-0.7/_oasis --- ocaml-deriving-ocsigen-0.6.2/_oasis 2014-04-10 10:21:23.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/_oasis 2014-09-30 09:10:36.000000000 +0000 @@ -1,13 +1,15 @@ OASISFormat: 0.4 Name: deriving OCamlVersion: >= 3.12.1 -Version: 0.6.1 +Version: 0.7 Synopsis: Extension to OCaml for deriving functions from type declarations Authors: Jeremy Yallop License: MIT BuildTools: ocamlbuild FilesAB: syntax/common/id.ml.ab, lib/META.ab +Plugins: DevFiles (0.4) +AlphaFeatures: compiled_setup_ml Flag tc Description: type-conv support @@ -45,7 +47,7 @@ FindlibName : common Pack : true Modules : Id, Utils, Type, Defs, Clusters, Base, Extend - BuildDepends : camlp4,camlp4.extend,camlp4.quotations.o,optcomp + BuildDepends : camlp4,camlp4.extend,camlp4.quotations.o,optcomp,bytes Library "pa_deriving_std" Path : syntax/std @@ -63,6 +65,19 @@ Build$: flag(tc) Install$: flag(tc) +Document "deriving-api" + Title: API reference for Deriving + Type: ocamlbuild (0.3) + Install: true + InstallDir: $htmldir/api + BuildTools: ocamldoc + XOCamlbuildPath: ./ + XOCamlbuildLibraries: + deriving, + deriving.num, + deriving.syntax, + deriving.syntax.common + Executable test Path : tests/std CompiledObject : best File /tmp/qUsmdLgBsb/ocaml-deriving-ocsigen-0.6.2/opam is a directory while file /tmp/NIwDWT0Nro/ocaml-deriving-ocsigen-0.7/opam is a regular file diff -Nru ocaml-deriving-ocsigen-0.6.2/setup.ml ocaml-deriving-ocsigen-0.7/setup.ml --- ocaml-deriving-ocsigen-0.6.2/setup.ml 2014-04-10 10:21:23.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/setup.ml 2014-09-30 09:10:36.000000000 +0000 @@ -1,6 +1,6 @@ (* OASIS_START *) -(* DO NOT EDIT (digest: 9852805d5c19ca1cb6abefde2dcea323) *) +(* DO NOT EDIT (digest: 172e37fc4b327922311f6cf9389bc560) *) (******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) @@ -23,14 +23,7 @@ (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) -let () = - try - Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH") - with Not_found -> () -;; -#use "topfind";; -#require "oasis.dynrun";; -open OASISDynRun;; +open OASISDynRun (* OASIS_STOP *) diff -Nru ocaml-deriving-ocsigen-0.6.2/syntax/common/extend.ml ocaml-deriving-ocsigen-0.7/syntax/common/extend.ml --- ocaml-deriving-ocsigen-0.6.2/syntax/common/extend.ml 2014-04-10 10:21:23.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/syntax/common/extend.ml 2014-09-30 09:10:36.000000000 +0000 @@ -32,12 +32,46 @@ include Syntax + let rec drop n l = + if n <= 0 then + l + else + match l with + | [] -> [] + | _ :: l -> drop (n - 1) l + + let test_val_longident_dot_lt = + Gram.Entry.of_parser "test_val_longident_dot_lt" (fun strm -> + let rec test_longident_dot pos tokens = + match tokens with + | (ANTIQUOT ((""|"id"|"anti"|"list"), _), _) :: tokens -> + test_longident_dot (pos+1) tokens + | (UIDENT _, _) :: (KEYWORD ".", _) :: (LIDENT _, _) :: tokens -> + test_longident_dot (pos+3) tokens + | _ :: _ -> + test_delim pos tokens + | [] -> fetch_more test_longident_dot pos + and test_delim pos tokens = + if pos = 0 then + raise Stream.Failure + else + match tokens with + | (KEYWORD ("<"), _) :: _ -> () + | _ :: _ -> raise Stream.Failure + | [] -> fetch_more test_delim pos + and fetch_more k pos = + match drop pos (Stream.npeek (pos + 10) strm) with + | [] -> raise Stream.Failure + | tokens -> k pos tokens + in fetch_more test_longident_dot 0 + ) + open Ast EXTEND Gram expr: LEVEL "simple" [ - [ TRY [e1 = val_longident ; "<" ; t = ctyp; ">" -> + [ TRY[ test_val_longident_dot_lt; e1 = val_longident ; "<" ; t = ctyp; ">" -> match e1 with | <:ident< $uid:classname$ . $lid:methodname$ >> -> let m = instantiate _loc t classname in @@ -50,7 +84,7 @@ module_expr: LEVEL "simple" [ - [ TRY [e1 = val_longident ; "<" ; t = ctyp; ">" -> + [ TRY[ test_val_longident_dot_lt; e1 = val_longident ; "<" ; t = ctyp; ">" -> match e1 with | <:ident< $uid:classname$ >> -> instantiate _loc t classname diff -Nru ocaml-deriving-ocsigen-0.6.2/syntax/common/utils.ml ocaml-deriving-ocsigen-0.7/syntax/common/utils.ml --- ocaml-deriving-ocsigen-0.6.2/syntax/common/utils.ml 2014-04-10 10:21:23.000000000 +0000 +++ ocaml-deriving-ocsigen-0.7/syntax/common/utils.ml 2014-09-30 09:10:36.000000000 +0000 @@ -146,6 +146,11 @@ | TyAnP _ -> "TyAnP" | TyAnM _ -> "TyAnM" #endif +#if ocaml_version >= (4, 02) + | TyAtt (_,name,_,c) -> "TyAtt("^ name ^", "^ ctyp c ^")" + | TyExt (_,name,args,c) -> "TyExt("^ ident name ^", ["^ (String.concat ", " (List.map ctyp args)) ^ "], " ^ ctyp c ^")" + | TyOpn _ -> "TyOpn" +#endif end module Map = struct @@ -207,9 +212,9 @@ let random_id length = let idchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'" in let nidchars = String.length idchars in - let s = String.create length in + let s = Bytes.create length in for i = 0 to length - 1 do - s.[i] <- idchars.[Random.int nidchars] + Bytes.set s i idchars.[Random.int nidchars] done; s