Browse files

Self-spec refactoring

- rename proto-name, -custom, -package to protobuf-name, ...
- rename wire-type to protobuf-wire-type
- rename wire-packed to protobuf-packed
- merge piqi.protobuf-wire.piqi into piqi.protobuf.piqi
  • Loading branch information...
1 parent a17a01f commit ad93ce431abd660b94bede33757e05c61ef9186c @alavrik committed Sep 16, 2012
View
2 examples/def.piqi
@@ -70,7 +70,7 @@
.enum [
.name e
- .option [ .name a .proto-name "e_a" ]
+ .option [ .name a .protobuf-name "e_a" ]
.option [ .name b ]
.option [ .name c ]
]
View
10 examples/erlang/addressbook.proto.piqi
@@ -3,7 +3,7 @@
% piqi of-proto --normalize addressbook.proto
-.proto-package "tutorial"
+.protobuf-package "tutorial"
.record [
.name person
@@ -14,7 +14,7 @@
]
.field [
.name id
- .type proto-int32
+ .type protobuf-int32
.code 2
]
.field [
@@ -52,17 +52,17 @@
.option [
.name mobile
.code 0
- .proto-name "person_mobile"
+ .protobuf-name "person_mobile"
]
.option [
.name home
.code 1
- .proto-name "person_home"
+ .protobuf-name "person_home"
]
.option [
.name work
.code 2
- .proto-name "person_work"
+ .protobuf-name "person_work"
]
]
View
8 examples/int.piq
@@ -33,8 +33,8 @@
:int32-fixed -0x8000_0000
:int32-fixed 0x7fff_ffff
-:proto-int32 -0x8000_0000
-:proto-int32 0x7fff_ffff
+:protobuf-int32 -0x8000_0000
+:protobuf-int32 0x7fff_ffff
:uint64 0
@@ -50,6 +50,6 @@
:int64-fixed -0x8000_0000_0000_0000
:int64-fixed 0x7fff_ffff_ffff_ffff
-:proto-int64 -0x8000_0000_0000_0000
-:proto-int64 0x7fff_ffff_ffff_ffff
+:protobuf-int64 -0x8000_0000_0000_0000
+:protobuf-int64 0x7fff_ffff_ffff_ffff
View
10 examples/ocaml/addressbook.proto.piqi
@@ -3,7 +3,7 @@
% piqi of-proto --normalize addressbook.proto
-.proto-package "tutorial"
+.protobuf-package "tutorial"
.record [
.name person
@@ -14,7 +14,7 @@
]
.field [
.name id
- .type proto-int32
+ .type protobuf-int32
.code 2
]
.field [
@@ -52,17 +52,17 @@
.option [
.name mobile
.code 0
- .proto-name "person_mobile"
+ .protobuf-name "person_mobile"
]
.option [
.name home
.code 1
- .proto-name "person_home"
+ .protobuf-name "person_home"
]
.option [
.name work
.code 2
- .proto-name "person_work"
+ .protobuf-name "person_work"
]
]
View
4 piqi-erlang/include/piqirun.hrl
@@ -20,8 +20,8 @@
% non_neg_integer() holds a value for all varint and zigzag_varint types:
%
-% bool, int, int32, int64, uint, uint32, uint64, proto-int32, proto-int64,
-% enum
+% bool, int, int32, int64, uint, uint32, uint64, protobuf-int32,
+% protobuf-int64, enum
%
% {fixed32, binary()} with a binary of size 4 holds a value for fixed32 -encoded
% types:
View
66 piqi-tools/descriptor.proto.piqi
@@ -1,4 +1,4 @@
-.proto-package "google.protobuf"
+.protobuf-package "google.protobuf"
.record [
.name file-descriptor-set
@@ -112,13 +112,13 @@
.name descriptor-proto-extension-range
.field [
.name start
- .type proto-int32
+ .type protobuf-int32
.optional
.code 1
]
.field [
.name end
- .type proto-int32
+ .type protobuf-int32
.optional
.code 2
]
@@ -134,7 +134,7 @@
]
.field [
.name number
- .type proto-int32
+ .type protobuf-int32
.optional
.code 3
]
@@ -181,92 +181,92 @@
.option [
.name type-double
.code 1
- .proto-name "field_descriptor_proto_type_double"
+ .protobuf-name "field_descriptor_proto_type_double"
]
.option [
.name type-float
.code 2
- .proto-name "field_descriptor_proto_type_float"
+ .protobuf-name "field_descriptor_proto_type_float"
]
.option [
.name type-int64
.code 3
- .proto-name "field_descriptor_proto_type_int64"
+ .protobuf-name "field_descriptor_proto_type_int64"
]
.option [
.name type-uint64
.code 4
- .proto-name "field_descriptor_proto_type_uint64"
+ .protobuf-name "field_descriptor_proto_type_uint64"
]
.option [
.name type-int32
.code 5
- .proto-name "field_descriptor_proto_type_int32"
+ .protobuf-name "field_descriptor_proto_type_int32"
]
.option [
.name type-fixed64
.code 6
- .proto-name "field_descriptor_proto_type_fixed64"
+ .protobuf-name "field_descriptor_proto_type_fixed64"
]
.option [
.name type-fixed32
.code 7
- .proto-name "field_descriptor_proto_type_fixed32"
+ .protobuf-name "field_descriptor_proto_type_fixed32"
]
.option [
.name type-bool
.code 8
- .proto-name "field_descriptor_proto_type_bool"
+ .protobuf-name "field_descriptor_proto_type_bool"
]
.option [
.name type-string
.code 9
- .proto-name "field_descriptor_proto_type_string"
+ .protobuf-name "field_descriptor_proto_type_string"
]
.option [
.name type-group
.code 10
- .proto-name "field_descriptor_proto_type_group"
+ .protobuf-name "field_descriptor_proto_type_group"
]
.option [
.name type-message
.code 11
- .proto-name "field_descriptor_proto_type_message"
+ .protobuf-name "field_descriptor_proto_type_message"
]
.option [
.name type-bytes
.code 12
- .proto-name "field_descriptor_proto_type_bytes"
+ .protobuf-name "field_descriptor_proto_type_bytes"
]
.option [
.name type-uint32
.code 13
- .proto-name "field_descriptor_proto_type_uint32"
+ .protobuf-name "field_descriptor_proto_type_uint32"
]
.option [
.name type-enum
.code 14
- .proto-name "field_descriptor_proto_type_enum"
+ .protobuf-name "field_descriptor_proto_type_enum"
]
.option [
.name type-sfixed32
.code 15
- .proto-name "field_descriptor_proto_type_sfixed32"
+ .protobuf-name "field_descriptor_proto_type_sfixed32"
]
.option [
.name type-sfixed64
.code 16
- .proto-name "field_descriptor_proto_type_sfixed64"
+ .protobuf-name "field_descriptor_proto_type_sfixed64"
]
.option [
.name type-sint32
.code 17
- .proto-name "field_descriptor_proto_type_sint32"
+ .protobuf-name "field_descriptor_proto_type_sint32"
]
.option [
.name type-sint64
.code 18
- .proto-name "field_descriptor_proto_type_sint64"
+ .protobuf-name "field_descriptor_proto_type_sint64"
]
]
@@ -275,17 +275,17 @@
.option [
.name label-optional
.code 1
- .proto-name "field_descriptor_proto_label_optional"
+ .protobuf-name "field_descriptor_proto_label_optional"
]
.option [
.name label-required
.code 2
- .proto-name "field_descriptor_proto_label_required"
+ .protobuf-name "field_descriptor_proto_label_required"
]
.option [
.name label-repeated
.code 3
- .proto-name "field_descriptor_proto_label_repeated"
+ .protobuf-name "field_descriptor_proto_label_repeated"
]
]
@@ -321,7 +321,7 @@
]
.field [
.name number
- .type proto-int32
+ .type protobuf-int32
.optional
.code 2
]
@@ -445,17 +445,17 @@
.option [
.name speed
.code 1
- .proto-name "file_options_speed"
+ .protobuf-name "file_options_speed"
]
.option [
.name code-size
.code 2
- .proto-name "file_options_code_size"
+ .protobuf-name "file_options_code_size"
]
.option [
.name lite-runtime
.code 3
- .proto-name "file_options_lite_runtime"
+ .protobuf-name "file_options_lite_runtime"
]
]
@@ -524,17 +524,17 @@
.option [
.name string
.code 0
- .proto-name "field_options_string"
+ .protobuf-name "field_options_string"
]
.option [
.name cord
.code 1
- .proto-name "field_options_cord"
+ .protobuf-name "field_options_cord"
]
.option [
.name string-piece
.code 2
- .proto-name "field_options_string_piece"
+ .protobuf-name "field_options_string_piece"
]
]
@@ -600,7 +600,7 @@
]
.field [
.name negative-int-value
- .type proto-int64
+ .type protobuf-int64
.optional
.code 5
]
View
12 piqi-tools/piqi_of_proto.ml
@@ -171,12 +171,12 @@ let gen_enum_value path x =
let piqi_name = format_name name in
let proto_name =
match path with
- | [] -> iol [] (* empty -- no need for separate .proto-name *)
+ | [] -> iol [] (* empty -- no need for separate .protobuf-name *)
| _ ->
(* after formatting and probably normalizing name we need to convert
* dashes back to underscores *)
let n = U.dashes_to_underscores (make_piqi_name (name :: path)) in
- ios ".proto-name " ^^ ioq n
+ ios ".protobuf-name " ^^ ioq n
in
iod " " [
ios ".option [";
@@ -326,13 +326,13 @@ let gen_builtin_type = function
| `type_double -> "float64"
| `type_float -> "float32"
- | `type_int64 -> "proto-int64"
+ | `type_int64 -> "protobuf-int64"
| `type_uint64 -> "uint64"
| `type_fixed64 -> "uint64-fixed"
| `type_sfixed64 -> "int64-fixed"
| `type_sint64 -> "int64"
- | `type_int32 -> "proto-int32"
+ | `type_int32 -> "protobuf-int32"
| `type_uint32 -> "uint32"
| `type_fixed32 -> "uint32-fixed"
| `type_sfixed32 -> "int32-fixed"
@@ -401,7 +401,7 @@ let gen_field_internals idtable ?(path=[]) x =
| None -> ""
| Some x ->
if x.D.Field_options#packed = Some true
- then ".wire-packed"
+ then ".protobuf-packed"
else ""
in
iod "\n" [
@@ -538,7 +538,7 @@ let gen_proto idtable (x:ProtoFile.t) =
let package =
match x.package with
| None -> iol []
- | Some x -> ios ".proto-package " ^^ ioq x
+ | Some x -> ios ".protobuf-package " ^^ ioq x
in
let code =
iod "\n" [
View
197 piqi-tools/piqi_to_proto.ml
@@ -41,7 +41,7 @@ let gen_name parent name =
| `piqi _ -> name (* local module *)
| `import x ->
let piqi = some_of x.Import#piqi in
- match piqi.P#proto_package with
+ match piqi.P#protobuf_package with
| None -> name (* no .proto package => use flat .proto namespace *)
| Some package ->
(* build fully-qualified name *)
@@ -82,10 +82,10 @@ let rec typename ?parent (t:T.piqtype) =
| `bool -> "bool"
| `string -> "string"
| `binary -> "bytes"
- | `record t -> gen_name t.R#parent t.R#proto_name
- | `variant t -> gen_name t.V#parent t.V#proto_name
- | `enum t -> gen_name t.E#parent t.E#proto_name
- | `list t -> gen_name t.L#parent t.L#proto_name
+ | `record t -> gen_name t.R#parent t.R#protobuf_name
+ | `variant t -> gen_name t.V#parent t.V#protobuf_name
+ | `enum t -> gen_name t.E#parent t.E#protobuf_name
+ | `list t -> gen_name t.L#parent t.L#protobuf_name
| `alias t ->
(* unwind aliases to their original type *)
gen_alias_typename t ?parent
@@ -99,14 +99,14 @@ let rec typename ?parent (t:T.piqtype) =
* ::piqi::piqi::wire_type. Non-fully qualified name in case of
* repeated namespace parts confuses g++
*
- * Thus, adding "_org" suffix to the top namespace for now.
+ * For this reason, adding "_org" suffix to the top namespace for now.
*)
".piqi_org.piqi.any"
and gen_alias_typename ?parent x =
let open Alias in
- match x.proto_type with
+ match x.protobuf_type with
| Some x -> x
| None ->
let parent = recalc_import_parent ?parent x.parent in
@@ -135,11 +135,11 @@ let gen_piqtype' ?parent = function
let typedef_proto_name = function
- | `record t -> some_of t.R#proto_name
- | `variant t -> some_of t.V#proto_name
- | `enum t -> some_of t.E#proto_name
- | `alias t -> some_of t.A#proto_name
- | `list t -> some_of t.L#proto_name
+ | `record t -> some_of t.R#protobuf_name
+ | `variant t -> some_of t.V#protobuf_name
+ | `enum t -> some_of t.E#protobuf_name
+ | `alias t -> some_of t.A#protobuf_name
+ | `list t -> some_of t.L#protobuf_name
| _ ->
(* this function will be called only for named types (i.e. typedefs) *)
assert false
@@ -154,11 +154,11 @@ let protoname_of name piqtype =
let protoname_of_field f =
- let open F in protoname_of f.proto_name f.piqtype
+ let open F in protoname_of f.protobuf_name f.piqtype
let protoname_of_option o =
- let open O in protoname_of o.proto_name o.piqtype
+ let open O in protoname_of o.protobuf_name o.piqtype
let gen_proto_custom proto_custom =
@@ -202,7 +202,7 @@ let rec gen_default_obj (x:Piqobj.obj) =
| `enum x ->
let o = x.Piqobj.Enum#option in
let o = o.Piqobj.Option#t in
- make_default (some_of o.O#proto_name)
+ make_default (some_of o.O#protobuf_name)
| `alias x ->
gen_default_obj x.Piqobj.Alias#obj (* recurse *)
| `any _ | `record _ | `variant _ | `list _ ->
@@ -243,15 +243,15 @@ let gen_field parent f =
let gen_record ?name ?parent r =
let open R in
let parent = recalc_import_parent ?parent r.parent in
- let name = recalc_name ?name r.proto_name in
+ let name = recalc_name ?name r.protobuf_name in
(* field definition list *)
let fdefs = List.map (gen_field parent) r.field in
let rdef = iol
[
ios "message "; ios name;
ios " {"; indent;
iod "\n" fdefs;
- gen_proto_custom r.proto_custom;
+ gen_proto_custom r.protobuf_custom;
unindent; eol;
ios "}"; eol;
]
@@ -261,19 +261,19 @@ let gen_record ?name ?parent r =
let gen_const c =
let open O in
iod " " [
- ios (some_of c.proto_name); ios "="; gen_code c.code ^^ ios ";";
+ ios (some_of c.protobuf_name); ios "="; gen_code c.code ^^ ios ";";
]
let gen_enum e =
let open E in
- let enum_name = some_of e.proto_name in
+ let enum_name = some_of e.protobuf_name in
let const_defs = List.map gen_const e.option in
let make_enum_def name =
iol [
ios "enum "; ios name; ios " {"; indent;
iod "\n" const_defs;
- gen_proto_custom e.proto_custom;
+ gen_proto_custom e.protobuf_custom;
unindent; eol;
ios "}";
]
@@ -304,15 +304,15 @@ let gen_option parent o =
let gen_variant ?name ?parent v =
let open Variant in
let parent = recalc_import_parent ?parent v.parent in
- let name = recalc_name ?name v.proto_name in
+ let name = recalc_name ?name v.protobuf_name in
(* field definition list *)
let vdefs = List.map (gen_option parent) v.option in
let vdef = iol
[
ios "message "; ios name;
ios " {"; indent;
iod "\n" vdefs;
- gen_proto_custom v.proto_custom;
+ gen_proto_custom v.protobuf_custom;
unindent; eol;
ios "}"; eol;
]
@@ -322,7 +322,7 @@ let gen_variant ?name ?parent v =
let gen_list ?name ?parent l =
let open L in
let parent = recalc_import_parent ?parent l.parent in
- let name = recalc_name ?name l.proto_name in
+ let name = recalc_name ?name l.protobuf_name in
let packed =
if l.wire_packed
then " [packed = true]"
@@ -333,7 +333,7 @@ let gen_list ?name ?parent l =
ios "message "; ios name;
ios " {"; indent;
ios "repeated "; gen_piqtype (some_of l.piqtype) ?parent; ios " elem = 1"; ios packed; ios ";";
- gen_proto_custom l.proto_custom;
+ gen_proto_custom l.protobuf_custom;
unindent; eol;
ios "}"; eol;
]
@@ -361,7 +361,7 @@ and gen_alias ?name ?parent ?(is_func_param=false) a =
let open A in
let is_func_param = is_func_param || a.is_func_param in
let parent = recalc_import_parent ?parent a.parent in
- let name = recalc_name ?name a.proto_name in
+ let name = recalc_name ?name a.protobuf_name in
match some_of a.piqtype with
| `record _ | `variant _ | `alias _ | `list _ as def ->
(* generate the original definition with the new name *)
@@ -431,7 +431,7 @@ let gen_imports l =
let gen_piqi (piqi:T.piqi) =
let open P in
let package =
- match piqi.P.proto_package with
+ match piqi.P.protobuf_package with
| None -> iol [] (* no package name *)
| Some n -> iol [ios "package "; ios n; ios ";"; eol; eol]
in
@@ -450,7 +450,7 @@ let gen_piqi (piqi:T.piqi) =
else iol []
in
let proto_custom =
- List.map (fun x -> iol [ios x; eol; eol]) piqi.P#proto_custom
+ List.map (fun x -> iol [ios x; eol; eol]) piqi.P#protobuf_custom
in
iol [
package;
@@ -484,42 +484,127 @@ let protoname' n =
| Some n -> protoname n
+let proto_custom_warning l =
+ List.iter (fun x ->
+ C.warning x ".proto-custom is deprecated; use .protobuf-custom instead"
+ ) l
+
+
+let proto_name_warning x =
+ C.warning x ".proto-name is deprecated; use .protobuf-name instead"
+
+
let protoname_field x =
- let open Field in
- if x.proto_name = None then x.proto_name <- protoname' x.name
+ let open Field in (
+ if x.proto_name <> None
+ then (
+ proto_name_warning x.proto_name;
+ if x.protobuf_name = None
+ then x.protobuf_name <- x.proto_name;
+ );
+ if x.protobuf_name = None then x.protobuf_name <- protoname' x.name;
+ )
let protoname_record x =
- let open Record in
- (if x.proto_name = None then x.proto_name <- protoname (some_of x.name);
- List.iter protoname_field x.field)
+ let open Record in (
+ if x.proto_name <> None
+ then (
+ proto_name_warning x.proto_name;
+ if x.protobuf_name = None
+ then x.protobuf_name <- x.proto_name;
+ );
+ if x.proto_custom <> []
+ then (
+ proto_custom_warning x.proto_custom;
+ x.protobuf_custom <- x.protobuf_custom @ x.proto_custom;
+ );
+
+ if x.protobuf_name = None then x.protobuf_name <- protoname (some_of x.name);
+ List.iter protoname_field x.field;
+ )
let protoname_option x =
- let open Option in
- if x.proto_name = None then x.proto_name <- protoname' x.name
+ let open Option in (
+ if x.proto_name <> None
+ then (
+ proto_name_warning x.proto_name;
+ if x.protobuf_name = None
+ then x.protobuf_name <- x.proto_name;
+ );
+
+ if x.protobuf_name = None then x.protobuf_name <- protoname' x.name;
+ )
let protoname_variant x =
- let open Variant in
- (if x.proto_name = None then x.proto_name <- protoname (some_of x.name);
- List.iter protoname_option x.option)
+ let open Variant in (
+ if x.proto_name <> None
+ then (
+ proto_name_warning x.proto_name;
+ if x.protobuf_name = None
+ then x.protobuf_name <- x.proto_name;
+ );
+ if x.proto_custom <> []
+ then (
+ proto_custom_warning x.proto_custom;
+ x.protobuf_custom <- x.protobuf_custom @ x.proto_custom;
+ );
+
+ if x.protobuf_name = None then x.protobuf_name <- protoname (some_of x.name);
+ List.iter protoname_option x.option;
+ )
let protoname_enum x =
- let open Enum in
- (if x.proto_name = None then x.proto_name <- protoname (some_of x.name);
- List.iter protoname_option x.option)
+ let open Enum in (
+ if x.proto_name <> None
+ then (
+ proto_name_warning x.proto_name;
+ if x.protobuf_name = None
+ then x.protobuf_name <- x.proto_name;
+ );
+ if x.proto_custom <> []
+ then (
+ proto_custom_warning x.proto_custom;
+ x.protobuf_custom <- x.protobuf_custom @ x.proto_custom;
+ );
+
+ if x.protobuf_name = None then x.protobuf_name <- protoname (some_of x.name);
+ List.iter protoname_option x.option;
+ )
let protoname_alias x =
- let open Alias in
- if x.proto_name = None then x.proto_name <- protoname (some_of x.name)
+ let open Alias in (
+ if x.proto_name <> None
+ then (
+ proto_name_warning x.proto_name;
+ if x.protobuf_name = None
+ then x.protobuf_name <- x.proto_name;
+ );
+
+ if x.protobuf_name = None then x.protobuf_name <- protoname (some_of x.name);
+ )
let protoname_list x =
- let open L in
- if x.proto_name = None then x.proto_name <- protoname (some_of x.name)
+ let open L in (
+ if x.proto_name <> None
+ then (
+ proto_name_warning x.proto_name;
+ if x.protobuf_name = None
+ then x.protobuf_name <- x.proto_name;
+ );
+ if x.proto_custom <> []
+ then (
+ proto_custom_warning x.proto_custom;
+ x.protobuf_custom <- x.protobuf_custom @ x.proto_custom;
+ );
+
+ if x.protobuf_name = None then x.protobuf_name <- protoname (some_of x.name);
+ )
let protoname_typedef = function
@@ -549,12 +634,30 @@ let proto_modname n =
*)
+(* generate warning when deprecated fiels are used and provde some backwards
+ * compatibiliy *)
+let check_transform_piqi piqi =
+ (* handle deprecated .proto-package *)
+ let proto_package = piqi.P#proto_package in
+ if proto_package <> None
+ then (
+ C.warning proto_package ".proto-package is deprecated; use .protobuf-package instead";
+ if piqi.P#protobuf_package = None
+ then piqi.P#protobuf_package <- proto_package;
+ );
+ (* handle deprecated top-level .proto-custom *)
+ let proto_custom = piqi.P#proto_custom in
+ if proto_custom <> []
+ then (
+ proto_custom_warning proto_custom;
+ piqi.P#protobuf_custom <- piqi.P#protobuf_custom @ proto_custom;
+ )
+
+
let rec protoname_piqi (piqi:T.piqi) =
let open P in
begin
- (*
- if piqi.proto_package = None then piqi.proto_package <- proto_modname piqi.modname;
- *)
+ check_transform_piqi piqi;
protoname_defs piqi.P#resolved_typedef;
protoname_defs piqi.P#imported_typedef;
protoname_imports piqi.P#resolved_import;
View
1 piqi/Makefile
@@ -3,7 +3,6 @@
PIQI_FILES = \
piqi.piq.piqi \
piqi.protobuf.piqi \
- piqi.protobuf-wire.piqi \
piqi.json.piqi \
piqi.getopt.piqi \
\
View
82 piqi/piqi.piqi
@@ -5,11 +5,8 @@
% Copyright 2009, 2010, 2011, 2012 Anton Lavrik
-.proto-package "piqi_org.piqi"
-
-
% aliases for built-in types; these definitions are automatically included in
-% all Piqi modules
+% each Piqi module except modules named "piqi"
.alias [ .name bool .piqi-type.bool ]
.alias [ .name string .piqi-type.string ]
@@ -23,48 +20,48 @@
.name int
.piqi-type.int
- .wire-type.zigzag-varint
- .proto-type "sint32"
+ .protobuf-type "sint32"
+ .protobuf-wire-type.zigzag-varint
]
.alias [
.name uint
.piqi-type.int
- .wire-type.varint
- .proto-type "uint32"
+ .protobuf-type "uint32"
+ .protobuf-wire-type.varint
]
.alias [
.name int32
.piqi-type.int
- .wire-type.zigzag-varint
- .proto-type "sint32"
+ .protobuf-type "sint32"
+ .protobuf-wire-type.zigzag-varint
]
.alias [
.name uint32
.piqi-type.int
- .wire-type.varint
- .proto-type "uint32"
+ .protobuf-type "uint32"
+ .protobuf-wire-type.varint
]
.alias [
.name int64
.piqi-type.int
- .wire-type.zigzag-varint
- .proto-type "sint64"
+ .protobuf-type "sint64"
+ .protobuf-wire-type.zigzag-varint
]
.alias [
.name uint64
.piqi-type.int
- .wire-type.varint
- .proto-type "uint64"
+ .protobuf-type "uint64"
+ .protobuf-wire-type.varint
]
@@ -75,35 +72,35 @@
.type int32
.piqi-type.int
- .wire-type.signed-fixed32
- .proto-type "sfixed32"
+ .protobuf-type "sfixed32"
+ .protobuf-wire-type.signed-fixed32
]
.alias [
.name uint32-fixed
.type uint32
.piqi-type.int
- .wire-type.fixed32
- .proto-type "fixed32"
+ .protobuf-type "fixed32"
+ .protobuf-wire-type.fixed32
]
.alias [
.name int64-fixed
.type int64
.piqi-type.int
- .wire-type.signed-fixed64
- .proto-type "sfixed64"
+ .protobuf-type "sfixed64"
+ .protobuf-wire-type.signed-fixed64
]
.alias [
.name uint64-fixed
.type uint64
.piqi-type.int
- .wire-type.fixed64
- .proto-type "fixed64"
+ .protobuf-type "fixed64"
+ .protobuf-wire-type.fixed64
]
@@ -112,30 +109,30 @@
% negative integers which representation is very inefficient requiring many
% bytes for small absolue values.
.alias [
- .name proto-int32
+ .name protobuf-int32
.type int32
.piqi-type.int
- .wire-type.signed-varint
- .proto-type "int32"
+ .protobuf-type "int32"
+ .protobuf-wire-type.signed-varint
]
.alias [
- .name proto-int64
+ .name protobuf-int64
.type int64
.piqi-type.int
- .wire-type.signed-varint
- .proto-type "int64"
+ .protobuf-type "int64"
+ .protobuf-wire-type.signed-varint
]
.alias [
.name float64
.piqi-type.float
- .wire-type.fixed64
- .proto-type "double"
+ .protobuf-type "double"
+ .protobuf-wire-type.fixed64
]
.alias [
@@ -148,8 +145,8 @@
.name float32
.piqi-type.float
- .wire-type.fixed32
- .proto-type "float"
+ .protobuf-type "float"
+ .protobuf-wire-type.fixed32
]
@@ -185,7 +182,7 @@
.type list
]
- .proto-name "piqi_typedef"
+ .protobuf-name "piqi_typedef"
]
@@ -194,12 +191,12 @@
.name piqi-type
- .option [ .name int .proto-name "piqi_type_int" ]
- .option [ .name float .proto-name "piqi_type_float" ]
- .option [ .name bool .proto-name "piqi_type_bool" ]
- .option [ .name string .proto-name "piqi_type_string" ]
- .option [ .name binary .proto-name "piqi_type_binary" ]
- .option [ .name any .proto-name "piqi_type_any" ]
+ .option [ .name int .protobuf-name "piqi_type_int" ]
+ .option [ .name float .protobuf-name "piqi_type_float" ]
+ .option [ .name bool .protobuf-name "piqi_type_bool" ]
+ .option [ .name string .protobuf-name "piqi_type_string" ]
+ .option [ .name binary .protobuf-name "piqi_type_binary" ]
+ .option [ .name any .protobuf-name "piqi_type_any" ]
]
@@ -308,7 +305,7 @@
.repeated % > 1
]
- .proto-name "piqi_enum"
+ .protobuf-name "piqi_enum"
]
@@ -423,7 +420,6 @@
%
.include [ .module piqi.piq ]
-.include [ .module piqi.protobuf-wire ]
.include [ .module piqi.protobuf ]
.include [ .module piqi.json ]
.include [ .module piqi.getopt ]
View
65 piqi/piqi.protobuf-wire.piqi
@@ -1,65 +0,0 @@
-% Piqi self-spec extensions adding support for binary Google Protocol Buffers
-% format
-%
-% The document describing Protocol Buffers binary "wire" format:
-%
-% https://developers.google.com/protocol-buffers/docs/encoding
-%
-%
-% Copyright 2009, 2010, 2011, 2012 Anton Lavrik
-
-
-.include [ .module piqi ]
-
-
-.enum [
- .name wire-type
- .option [ varint ]
- .option [ zigzag-varint ]
- .option [ fixed32 ]
- .option [ fixed64 ]
- .option [ signed-varint ]
- .option [ signed-fixed32 ]
- .option [ signed-fixed64 ]
- .option [ block ]
-]
-
-
-.extend [
- .typedef alias
-
- .with.field [
- .type wire-type
- .optional
- ]
-]
-
-
-.extend [
- (.typedef field option)
-
- .with.field [
- % for fields and variant options: unique integer field id
- % from (1 -- (2^29-1)) range used for identifying individual fields and
- % options encoded in wire format
- %
- % for enum options: non-unique integer constant from a full int32 range
-
- .name code
- .type int32
- .optional
- ]
-]
-
-
-.extend [
- (.typedef field list)
-
- % indication that Protobuf "packed" format is used for repeated fields or
- % list elements
- .with.field [
- .name wire-packed
- .optional
- ]
-]
-
View
121 piqi/piqi.protobuf.piqi
@@ -1,36 +1,67 @@
% Google Protocol Buffers extension for Piqi self-spec
%
-% This file defines some extensions to the base Piqi self-specification adding
-% properties related to Protocol Buffer's .proto files. Namely, these properties
-% are used by "piqi to-proto" command that generates .proto files from .piqi
-% files.
-%
+% This file defines two kinds of extensions to the base Piqi self-specification:
+%
+% - properties related to Protocol Buffer's .proto files that are used by
+% "piqi to-proto" command
+%
+% - properties related to binary binary Google Protocol Buffers format also
+% known as wire format
+%
+%
+% The document describing Protocol Buffers binary "wire" format:
+%
+% https://developers.google.com/protocol-buffers/docs/encoding
+%
+%
% Copyright 2009, 2010, 2011, 2012 Anton Lavrik
+.protobuf-package "piqi_org.piqi"
+
+
.include [ .module piqi ]
.extend [
(.typedef record field variant option enum alias list)
.with.field [
+ .name protobuf-name
+ .type string
+ .optional
+ ]
+
+ .with.field [
+ % same as protobuf-name in Piqi-0.5.*
+
.name proto-name
.type string
.optional
+ .deprecated
]
]
.extend [
- (.typedef record variant list enum)
+ (.typedef piqi record variant list enum)
- % arbitrary string that will be included in .proto message and enum
- % definitions as a result of .piqi -> .proto conversion
.with.field [
+ % arbitrary string that will be included in .proto message and enum
+ % definitions as a result of .piqi -> .proto conversion
+
+ .name protobuf-custom
+ .type string
+ .repeated
+ ]
+
+ .with.field [
+ % same as protobuf-custom in Piqi-0.5.*
+
.name proto-custom
.type string
.repeated
+ .deprecated
]
]
@@ -39,17 +70,18 @@
.typedef piqi
.with.field [
- .name proto-package
+ .name protobuf-package
.type string
.optional
]
- % arbitrary string that will be included in .proto as a result of .piqi ->
- % .proto conversion
.with.field [
- .name proto-custom
+ % same as protobuf-package in Piqi-0.5.*
+
+ .name proto-package
.type string
- .repeated
+ .optional
+ .deprecated
]
]
@@ -58,9 +90,70 @@
.typedef alias
.with.field [
- .name proto-type
+ .name protobuf-type
.type string
.optional
]
]
+
+.enum [
+ .name protobuf-wire-type
+
+ .option [ varint ]
+ .option [ zigzag-varint ]
+ .option [ fixed32 ]
+ .option [ fixed64 ]
+ .option [ signed-varint ]
+ .option [ signed-fixed32 ]
+ .option [ signed-fixed64 ]
+ .option [ block ]
+]
+
+
+.extend [
+ .typedef alias
+
+ .with.field [
+ .type protobuf-wire-type
+ .optional
+ ]
+]
+
+
+.extend [
+ (.typedef field option)
+
+ .with.field [
+ % for fields and variant options: unique integer field id
+ % from (1 -- (2^29-1)) range used for identifying individual fields and
+ % options encoded in wire format
+ %
+ % for enum options: non-unique integer constant from a full int32 range
+
+ .name code
+ .type int32
+ .optional
+ ]
+]
+
+
+.extend [
+ (.typedef field list)
+
+ % indication that Protobuf "packed" format is used for repeated fields or
+ % list elements
+ .with.field [
+ .name protobuf-packed
+ .optional
+ ]
+
+ .with.field [
+ % same as protobuf-packed in Piqi-0.5.*
+
+ .name wire-packed
+ .optional
+ .deprecated
+ ]
+]
+
View
2 piqic/piqic_erlang_defaults.ml
@@ -134,7 +134,7 @@ let gen_alias a =
ios "default_"; ios (some_of a.erlang_name); ios "() -> ";
Piqic_erlang_in.gen_convert_of piqtype a.erlang_type (
gen_default_piqtype
- piqtype ?erlang_type:a.erlang_type ?wire_type:a.wire_type;
+ piqtype ?erlang_type:a.erlang_type ?wire_type:a.protobuf_wire_type;
);
ios ".";
]
View
12 piqic/piqic_erlang_in.ml
@@ -114,13 +114,13 @@ let gen_field_parser i f =
ios "piqirun:parse_" ^^ ios mode ^^ ios "_field(";
gen_code f.code; ios ", ";
ios "fun ";
- gen_parse_piqtype piqtype ~wire_packed:f.wire_packed;
+ gen_parse_piqtype piqtype ~wire_packed:f.protobuf_packed;
ios "/1, ";
(* when parsing packed repeated fields, we should also accept
* fields in unpacked representation; therefore, specifying an
* unpacked field parser as another parameter *)
- if f.wire_packed
+ if f.protobuf_packed
then iol [
ios "fun ";
gen_parse_piqtype piqtype;
@@ -275,7 +275,7 @@ let gen_alias a ~wire_packed =
iol [
gen_parse_piqtype piqtype
?erlang_type:a.erlang_type
- ?wire_type:a.wire_type
+ ?wire_type:a.protobuf_wire_type
~wire_packed;
ios "(X)";
]
@@ -299,18 +299,18 @@ let gen_alias a =
let gen_list l =
let open L in
- let packed = ios (if l.wire_packed then "packed_" else "") in
+ let packed = ios (if l.protobuf_packed then "packed_" else "") in
iol [
ios "parse_" ^^ ios (some_of l.erlang_name); ios "(X) ->"; indent;
ios "piqirun:parse_"; packed; ios "list(";
ios "fun ";
- gen_parse_piqtype (some_of l.piqtype) ~wire_packed:l.wire_packed;
+ gen_parse_piqtype (some_of l.piqtype) ~wire_packed:l.protobuf_packed;
ios "/1, ";
(* when parsing packed repeated fields, we should also accept
* fields in unpacked representation; therefore, specifying an
* unpacked field parser as another parameter *)
- if l.wire_packed
+ if l.protobuf_packed
then iol [
ios "fun ";
gen_parse_piqtype (some_of l.piqtype);
View
16 piqic/piqic_erlang_out.ml
@@ -82,7 +82,7 @@ let gen_mode f =
| `required -> "required"
| `optional -> "optional"
| `repeated ->
- if f.wire_packed
+ if f.protobuf_packed
then "packed_repeated"
else "repeated"
@@ -102,8 +102,8 @@ let gen_field rname f =
ios "piqirun:gen_" ^^ ios mode ^^ ios "_field(";
gen_code f.code; ios ", ";
ios "fun ";
- gen_gen_piqtype piqtype ~wire_packed:f.wire_packed;
- if f.wire_packed (* arity *)
+ gen_gen_piqtype piqtype ~wire_packed:f.protobuf_packed;
+ if f.protobuf_packed (* arity *)
then ios "/1, "
else ios "/2, ";
ffname;
@@ -285,7 +285,7 @@ let gen_alias a =
iol [
ios "gen_"; ios (some_of a.erlang_name);
ios "(Code, X) ->"; indent;
- gen_gen_piqtype piqtype ?erlang_type:a.erlang_type ?wire_type:a.wire_type;
+ gen_gen_piqtype piqtype ?erlang_type:a.erlang_type ?wire_type:a.protobuf_wire_type;
ios "(Code, "; gen_convert_to piqtype a.erlang_type (ios "X"); ios ").";
unindent; eol;
]
@@ -299,7 +299,7 @@ let gen_packed_alias a =
ios "(X) ->"; indent;
gen_gen_piqtype piqtype
?erlang_type:a.erlang_type
- ?wire_type:a.wire_type
+ ?wire_type:a.protobuf_wire_type
~wire_packed:true;
ios "("; gen_convert_to piqtype a.erlang_type (ios "X"); ios ").";
unindent; eol;
@@ -320,14 +320,14 @@ let gen_alias a =
let gen_list l =
let open L in
- let packed = ios (if l.wire_packed then "packed_" else "") in
+ let packed = ios (if l.protobuf_packed then "packed_" else "") in
iol [
ios "gen_" ^^ ios (some_of l.erlang_name);
ios "(Code, X) ->"; indent;
ios "piqirun:gen_"; packed; ios "list(Code, ";
ios "fun ";
- gen_gen_piqtype (some_of l.piqtype) ~wire_packed:l.wire_packed;
- if l.wire_packed (* arity *)
+ gen_gen_piqtype (some_of l.piqtype) ~wire_packed:l.protobuf_packed;
+ if l.protobuf_packed (* arity *)
then ios "/1, X)."
else ios "/2, X).";
unindent; eol;
View
2 piqic/piqic_ocaml_defaults.ml
@@ -152,7 +152,7 @@ let gen_alias a =
ios "default_" ^^ ios (some_of a.ocaml_name); ios "() =";
Piqic_ocaml_in.gen_convert_of piqtype a.ocaml_type (
gen_default_piqtype
- piqtype ?ocaml_type:a.ocaml_type ?wire_type:a.wire_type;
+ piqtype ?ocaml_type:a.ocaml_type ?wire_type:a.protobuf_wire_type;
);
]
View
10 piqic/piqic_ocaml_in.ml
@@ -98,11 +98,11 @@ let gen_field_parser f =
(* "parse_(required|optional|repeated)_field" function invocation *)
ios "Piqirun.parse_" ^^ ios mode ^^ ios "_field";
gen_code f.code;
- gen_parse_piqtype piqtype ~wire_packed:f.wire_packed;
+ gen_parse_piqtype piqtype ~wire_packed:f.protobuf_packed;
(* when parsing packed repeated fields, we should also accept
* fields in unpacked representation; therefore, specifying an
* unpacked field parser as another parameter *)
- if f.wire_packed then gen_parse_piqtype piqtype else iol [];
+ if f.protobuf_packed then gen_parse_piqtype piqtype else iol [];
ios " x";
gen_default f.default;
]
@@ -235,7 +235,7 @@ let gen_alias a ~wire_packed =
gen_parse_piqtype
piqtype
?ocaml_type:a.ocaml_type
- ?wire_type:a.wire_type
+ ?wire_type:a.protobuf_wire_type
~wire_packed;
ios " x";
]
@@ -263,12 +263,12 @@ let gen_list l =
gen_cc "let count = next_count() in refer count (";
(* Piqirun.parse_(packed_)?(list|array|array32|array64) *)
ios "Piqirun.parse_"; repr;
- ios " ("; gen_parse_piqtype (some_of l.piqtype) ~wire_packed:l.wire_packed; ios ")";
+ ios " ("; gen_parse_piqtype (some_of l.piqtype) ~wire_packed:l.protobuf_packed; ios ")";
(* when parsing packed repeated fields, we should also accept
* fields in unpacked representation; therefore, specifying an
* unpacked field parser as another parameter *)
- if l.wire_packed
+ if l.protobuf_packed
then iol [
ios " ("; gen_parse_piqtype (some_of l.piqtype); ios ")";
]
View
18 piqic/piqic_ocaml_out.ml
@@ -85,7 +85,7 @@ let gen_wire_elem_width piqtype wire_packed =
| `alias x ->
(* NOTE: overriding upper-level wire type even if this one is undefined
*)
- aux (some_of x.A#piqtype) ?wire_type:x.A#wire_type
+ aux (some_of x.A#piqtype) ?wire_type:x.A#protobuf_wire_type
| t ->
Piqi_wire.get_wire_type_width t wire_type
in
@@ -106,13 +106,13 @@ let gen_mode f =
| `optional -> "optional"
| `repeated ->
let mode =
- if f.wire_packed
+ if f.protobuf_packed
then "packed_repeated"
else "repeated"
in
if f.ocaml_array
then
- let width = gen_wire_elem_width f.piqtype f.wire_packed in
+ let width = gen_wire_elem_width f.piqtype f.protobuf_packed in
mode ^ "_array" ^ width
else mode
@@ -132,7 +132,7 @@ let gen_field rname f =
[
ios "Piqirun.gen_" ^^ ios mode ^^ ios "_field";
gen_code f.code;
- gen_gen_piqtype piqtype ~wire_packed:f.wire_packed;
+ gen_gen_piqtype piqtype ~wire_packed:f.protobuf_packed;
ffname
]
| None ->
@@ -280,7 +280,7 @@ let gen_alias a =
iol [
ios "gen__"; ios (some_of a.ocaml_name);
ios " code x = ";
- gen_gen_piqtype piqtype ?ocaml_type:a.ocaml_type ?wire_type:a.wire_type;
+ gen_gen_piqtype piqtype ?ocaml_type:a.ocaml_type ?wire_type:a.protobuf_wire_type;
ios " code"; gen_convert_to piqtype a.ocaml_type (ios " x");
]
@@ -293,7 +293,7 @@ let gen_packed_alias a =
ios " x = ";
gen_gen_piqtype piqtype
?ocaml_type:a.ocaml_type
- ?wire_type:a.wire_type
+ ?wire_type:a.protobuf_wire_type
~wire_packed:true;
gen_convert_to piqtype a.ocaml_type (ios " x");
]
@@ -314,10 +314,10 @@ let gen_alias a =
(* generate: (packed_)?(list|array|array32|array64) *)
let gen_list_repr l =
let open L in
- let packed = ios (if l.wire_packed then "packed_" else "") in
+ let packed = ios (if l.protobuf_packed then "packed_" else "") in
let repr =
if l.ocaml_array
- then ios "array" ^^ ios (gen_wire_elem_width l.piqtype l.wire_packed)
+ then ios "array" ^^ ios (gen_wire_elem_width l.piqtype l.protobuf_packed)
else ios "list"
in
packed ^^ repr
@@ -331,7 +331,7 @@ let gen_list l =
gen_cc "reference ";
(* Piqirun.gen_(packed_)?(list|array|array32|array64) *)
ios "(Piqirun.gen_"; repr; ios " (";
- gen_gen_piqtype (some_of l.piqtype) ~wire_packed:l.wire_packed;
+ gen_gen_piqtype (some_of l.piqtype) ~wire_packed:l.protobuf_packed;
ios ")) code x";
]
View
366 piqicc/boot/piqi_piqi.ml
241 additions, 125 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
4 piqilib/piqi.ml
@@ -410,8 +410,8 @@ let check_resolved_alias a =
(* TODO: check for alias loops *)
let open A in
begin
- (* check for wire-types compatibility with piq types *)
- (match a.wire_type with
+ (* check for wire-types compatibility with piqi types *)
+ (match a.protobuf_wire_type with
| None -> ()
| Some x ->
check_wire_type a x
View
44 piqilib/piqi_wire.ml
@@ -50,7 +50,7 @@ let default_wire_type (t:T.piqtype) =
| _ -> `block
-let wire_type_name (wt:T.wire_type) =
+let wire_type_name (wt:T.protobuf_wire_type) =
match wt with
| `varint -> "varint"
| `zigzag_varint -> "zigzag_varint"
@@ -62,7 +62,7 @@ let wire_type_name (wt:T.wire_type) =
| `block -> "block"
-let get_wire_type (t:T.piqtype) (wt:T.wire_type option) =
+let get_wire_type (t:T.piqtype) (wt:T.protobuf_wire_type option) =
match wt with
| None -> default_wire_type t
| Some wt -> wt
@@ -231,21 +231,41 @@ let check_packed_type obj t =
error obj "packed representation can be used only for numeric, bool and enum types"
-let check_packed_field x =
- let open F in
- if x.wire_packed
- then (
- if x.mode <> `repeated
- then error x "packed representation can be used only for repeated fields";
+let wire_packed_warning x =
+ warning x ".wire-packed is deprecated; use .protobuf-packed instead"
+
- check_packed_type x x.piqtype
+let check_packed_field x =
+ let open F in (
+ if x.wire_packed
+ then (
+ wire_packed_warning x;
+ if not x.protobuf_packed
+ then x.protobuf_packed <- true;
+ );
+
+ if x.protobuf_packed
+ then (
+ if x.mode <> `repeated
+ then error x "packed representation can be used only for repeated fields";
+
+ check_packed_type x x.piqtype
+ )
)
let check_packed_list x =
- let open L in
- if x.wire_packed
- then check_packed_type x x.piqtype
+ let open L in (
+ if x.wire_packed
+ then (
+ wire_packed_warning x;
+ if not x.protobuf_packed
+ then x.protobuf_packed <- true;
+ );
+
+ if x.protobuf_packed
+ then check_packed_type x x.piqtype;
+ )
let process_def = function
View
8 piqilib/piqobj_of_wire.ml
@@ -199,7 +199,7 @@ and do_parse_field t l =
let res = (match x with Some x -> [x] | None -> []) in
res, rem
| `repeated ->
- if not t.wire_packed
+ if not t.protobuf_packed
then parse_repeated_field code field_type l
else parse_packed_repeated_field code field_type l
in
@@ -295,7 +295,7 @@ and parse_enum_option t code32 =
and parse_list t x =
let obj_type = some_of t.T.Piqi_list#piqtype in
let contents =
- if not t.T.Piqi_list.wire_packed
+ if not t.T.Piqi_list.protobuf_packed
then Piqirun.parse_list (parse_obj obj_type) x
else Piqirun.parse_packed_list
(parse_packed_obj obj_type) (parse_obj obj_type) x
@@ -310,7 +310,7 @@ and parse_alias0 t x =
(* XXX: roll-up multiple enclosed aliases into one? *)
and parse_alias t ?wire_type x =
let open T.Alias in
- let wire_type = Piqobj_to_wire.resolve_wire_type ?wire_type t.wire_type in
+ let wire_type = Piqobj_to_wire.resolve_wire_type ?wire_type t.protobuf_wire_type in
let obj =
match some_of t.piqtype with
| `int -> parse_int x ?wire_type
@@ -323,7 +323,7 @@ and parse_alias t ?wire_type x =
and parse_packed_alias t ?wire_type x =
let open T.Alias in
- let wire_type = Piqobj_to_wire.resolve_wire_type ?wire_type t.wire_type in
+ let wire_type = Piqobj_to_wire.resolve_wire_type ?wire_type t.protobuf_wire_type in
let obj =
match some_of t.piqtype with
| `int -> parse_packed_int x ?wire_type
View
8 piqilib/piqobj_to_wire.ml
@@ -227,7 +227,7 @@ and gen_fields fields =
else List.map gen_field fields
-and is_packed_field x = x.F#t.T.Field#wire_packed
+and is_packed_field x = x.F#t.T.Field#protobuf_packed
(* generate fields but first group packed repeated fields together because they
@@ -328,14 +328,14 @@ and gen_packed_enum_option x =
and gen_list code x =
let open L in
- if not x.t.T.Piqi_list.wire_packed
+ if not x.t.T.Piqi_list.protobuf_packed
then Piqirun.gen_list gen_obj code x.obj
else Piqirun.gen_packed_list gen_packed_obj code x.obj
and gen_alias ?wire_type code x =
let open A in
- let wire_type = resolve_wire_type ?wire_type x.t.T.Alias#wire_type in
+ let wire_type = resolve_wire_type ?wire_type x.t.T.Alias#protobuf_wire_type in
match x.obj with
| `int x | `uint x -> gen_int code x ?wire_type
| `float x -> gen_float code x ?wire_type
@@ -345,7 +345,7 @@ and gen_alias ?wire_type code x =
and gen_packed_alias ?wire_type x =
let open A in
- let wire_type = resolve_wire_type ?wire_type x.t.T.Alias#wire_type in
+ let wire_type = resolve_wire_type ?wire_type x.t.T.Alias#protobuf_wire_type in
match x.obj with
| `int x | `uint x -> gen_packed_int x ?wire_type
| `float x -> gen_packed_float x ?wire_type
View
4 tests/boot_proto2piqi/proto2piqi.cc
@@ -175,7 +175,7 @@ void dump_field(const FieldDescriptor *f, string &accu)
case FieldDescriptor::TYPE_FLOAT:
type = "float32"; break;
case FieldDescriptor::TYPE_INT64:
- type = "proto-int64"; break;
+ type = "protobuf-int64"; break;
case FieldDescriptor::TYPE_UINT64:
type = "uint64"; break;
case FieldDescriptor::TYPE_FIXED64:
@@ -185,7 +185,7 @@ void dump_field(const FieldDescriptor *f, string &accu)
case FieldDescriptor::TYPE_SINT64:
type = "int64"; break;
case FieldDescriptor::TYPE_INT32:
- type = "proto-int32"; break;
+ type = "protobuf-int32"; break;
case FieldDescriptor::TYPE_UINT32:
type = "uint32"; break;
case FieldDescriptor::TYPE_FIXED32:
View
2 tests/erlang_packed/Makefile
@@ -1,6 +1,6 @@
all:
- cat ../piqi_packed/packed.piqi | sed -e 's/\.wire-packed//' > unpacked.piqi
+ cat ../piqi_packed/packed.piqi | sed -e 's/\.protobuf-packed//' > unpacked.piqi
cat ../piqi_packed/test-all.piq | sed -e 's/:packed/:unpacked/' > test-all-unpacked.piq
$(MAKE) -f Makefile.erlang
View
8 tests/ocaml_array/packed.piqi
@@ -80,13 +80,13 @@
]
.field [
.name i32
- .type proto-int32
+ .type protobuf-int32
.repeated
.ocaml-array
]
.field [
.name i64
- .type proto-int64
+ .type protobuf-int64
.repeated
.ocaml-array
]
@@ -216,12 +216,12 @@
]
.list [
.name i32-list
- .type proto-int32
+ .type protobuf-int32
.ocaml-array
]
.list [
.name i64-list
- .type proto-int64
+ .type protobuf-int64
.ocaml-array
]
View
2 tests/ocaml_packed/Makefile
@@ -1,6 +1,6 @@
all:
- cat ../piqi_packed/packed.piqi | sed -e 's/\.wire-packed//' > unpacked.piqi
+ cat ../piqi_packed/packed.piqi | sed -e 's/\.protobuf-packed//' > unpacked.piqi
cat ../piqi_packed/test-all.piq | sed -e 's/:packed/:unpacked/' > test-all-unpacked.piq
$(MAKE) -f Makefile.ocaml
View
82 tests/ocaml_packed/packed-array.piqi
@@ -3,7 +3,7 @@
.field [
.type i
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
]
@@ -34,7 +34,7 @@
.field [
.type e
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
]
@@ -44,7 +44,7 @@
.field [
.type b
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
]
@@ -55,99 +55,99 @@
.name bool
.type bool
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.field [
.name u32
.type uint32
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.field [
.name u64
.type uint64
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.field [
.name s32
.type int32
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.field [
.name s64
.type int64
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.field [
.name i32
- .type proto-int32
+ .type protobuf-int32
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.field [
.name i64
- .type proto-int64
+ .type protobuf-int64
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.field [
.name uf32
.type uint32-fixed
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.field [
.name uf64
.type uint64-fixed
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.field [
.name if32
.type int32-fixed
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.field [
.name if64
.type int64-fixed
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.field [
.name f
.type float
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.field [
.name f32
.type float32
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.field [
.name f64
.type float64
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
@@ -156,21 +156,21 @@
.name e
.type e
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.field [
.name b
.type b
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.field [
.name i
.type i
.repeated
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
@@ -193,110 +193,110 @@
.list [
.name bool-list
.type bool
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.list [
.name int-list
.type int
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.list [
.name e-list
.type e
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.list [
.name i-list
.type i
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.list [
.name b-list
.type b
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.list [
.name u32-list
.type uint32
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.list [
.name u64-list
.type uint64
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.list [
.name s32-list
.type int32
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.list [
.name s64-list
.type int64
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.list [
.name i32-list
- .type proto-int32
- .wire-packed
+ .type protobuf-int32
+ .protobuf-packed
.ocaml-array
]
.list [
.name i64-list
- .type proto-int64
- .wire-packed
+ .type protobuf-int64
+ .protobuf-packed
.ocaml-array
]
.list [
.name uf32-list
.type uint32-fixed
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.list [
.name uf64-list
.type uint64-fixed
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.list [
.name if32-list
.type int32-fixed
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.list [
.name if64-list
.type int64-fixed
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.list [
.name f32-list
.type float32
- .wire-packed
+ .protobuf-packed
.ocaml-array
]
.list [
.name f64-list
.type float64
- .wire-packed
+ .protobuf-packed
.ocaml-array
]