Skip to content
Browse files

(piqi) Get rid of m4 as a build dependency

  • Loading branch information...
1 parent 055ab9f commit 4862a62c4a4da2623569af2aa89d8dd07d433870 @alavrik committed Feb 18, 2012
Showing with 126 additions and 8 deletions.
  1. +2 −2 INSTALL
  2. +0 −1 piqilib/.gitignore
  3. +2 −5 piqilib/Makefile.piqi_common
  4. +122 −0 piqilib/piqobj.ml
View
4 INSTALL
@@ -60,13 +60,13 @@ PREREQUISITES
GCC works. Other compilers should work if they are able to build OCaml.
-* GNU make, m4, sed and probably some other tools.
+* GNU make, sed and probably some other tools.
On Debian Squeeze, the above dependencies can be installed using the following
command:
- apt-get install ocaml camlp4-extra ocaml-findlib gcc m4 make sed
+ apt-get install ocaml camlp4-extra ocaml-findlib gcc make sed
INSTALLATION INSTRUCTIONS
View
1 piqilib/.gitignore
@@ -1,6 +1,5 @@
piqi_piqi.*
-piqobj.ml
piqi_version.ml
piqi_json_parser.ml
View
7 piqilib/Makefile.piqi_common
@@ -29,6 +29,7 @@ PIQI_SOURCES_TAIL = \
piq_parser.ml \
piq_gen.ml \
\
+ piqobj.ml \
piqobj_common.ml \
piqobj_to_wire.ml \
piqobj_of_wire.ml \
@@ -47,11 +48,10 @@ SOURCES = \
piqi_version.ml \
$(PIQI_SOURCES_HEAD) \
piqi_piqi.ml \
- piqobj.ml \
$(PIQI_SOURCES_TAIL)
-PRE_TARGETS = piqi_version.ml piqi_piqi.ml piqobj.ml
+PRE_TARGETS = piqi_version.ml piqi_piqi.ml
PACKS = ulex easy-format piqirun
@@ -66,9 +66,6 @@ PACKS = ulex easy-format piqirun
# USE_CAMLP4 = yes
-piqobj.ml: $(PIQI_ROOT)/piqilib/piqobj.ml.m4
- m4 $< >$@
-
piqi_version.ml: $(PIQI_ROOT)/VERSION
echo "let version = \"`head -1 $<`\"" >$@
View
122 piqilib/piqobj.ml
@@ -0,0 +1,122 @@
+(*
+ Copyright 2009, 2010, 2011 Anton Lavrik
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*)
+
+(* XXX: replace this handwritten file by "piqobj.piqi" after boostrap stage. *)
+
+
+module rec Types:
+ sig
+ type record = Record.t
+ type variant = Variant.t
+ type enum = Variant.t
+ type alias = Alias.t
+ type list = List.t
+
+ type field = Field.t
+ type option = Option.t
+ type any = Any.t
+
+ type piqdef =
+ [ `record of record
+ | `variant of variant
+ | `enum of enum
+ | `alias of alias
+ | `list of list ]
+
+ type obj =
+ [ piqdef
+ (* built-in types *)
+ | `int of int64 (* XXX: use big_int for internal representation? *)
+ | `uint of int64
+ | `float of float
+ | `bool of bool
+ | `string of string
+ | `binary of string
+ | `text of string
+
+ | `word of string
+ | `any of any ]
+ end = Types
+
+and Record:
+ sig
+ type t =
+ {
+ mutable piqtype : Piqi_piqi.record;
+ mutable field : Types.field list;
+ }
+ end = Record
+
+and Field:
+ sig
+ type t =
+ {
+ mutable piqtype : Piqi_piqi.field;
+ mutable obj: Types.obj option;
+ }
+ end = Field
+
+and Variant:
+ sig
+ type t =
+ {
+ mutable piqtype : Piqi_piqi.variant;
+ mutable option : Types.option;
+ }
+ end = Variant
+
+and Option:
+ sig
+ type t =
+ {
+ mutable piqtype : Piqi_piqi.option;
+ mutable obj: Types.obj option; (* None for named options, i.e. constants *)
+ }
+ end = Option
+
+and List:
+ sig
+ type t =
+ {
+ mutable piqtype : Piqi_piqi.piqlist;
+ mutable obj: Types.obj list;
+ }
+ end = List
+
+and Alias:
+ sig
+ type t =
+ {
+ mutable piqtype : Piqi_piqi.alias;
+ mutable obj: Types.obj;
+ }
+ end = Alias
+
+and Any:
+ sig
+ type t =
+ {
+ mutable any : Piqi_piqi.any;
+ (* it is not possible to convert "any" to object at any given time, some
+ typing hints may be required to do that which causes the delay, hence
+ defining it as "optional" *)
+ mutable obj: Types.obj option;
+ }
+ end = Any
+
+
+include Types
+

0 comments on commit 4862a62

Please sign in to comment.
Something went wrong with that request. Please try again.