| 1 | package Google::ProtocolBuffers::Constants; | ||
| 2 | 14 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 14 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 14 | my ($types, $wiretypes, $labels, $complex_types); | |
| 6 | BEGIN | ||
| 7 | 14 | ▶ | { |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | ## from src/google/protobuf/descriptor.h | ||
| 9 | 14 | $types = { | |
| 10 | TYPE_DOUBLE => 1, ## double, exactly eight bytes on the wire. | ||
| 11 | TYPE_FLOAT => 2, ## float, exactly four bytes on the wire. | ||
| 12 | TYPE_INT64 => 3, ## int64, varint on the wire. Negative numbers | ||
| 13 | ## take 10 bytes. Use TYPE_SINT64 if negative | ||
| 14 | ## values are likely. | ||
| 15 | TYPE_UINT64 => 4, ## uint64, varint on the wire. | ||
| 16 | TYPE_INT32 => 5, ## int32, varint on the wire. Negative numbers | ||
| 17 | ## take 10 bytes. Use TYPE_SINT32 if negative | ||
| 18 | ## values are likely. | ||
| 19 | TYPE_FIXED64 => 6, ## uint64, exactly eight bytes on the wire. | ||
| 20 | TYPE_FIXED32 => 7, ## uint32, exactly four bytes on the wire. | ||
| 21 | TYPE_BOOL => 8, ## bool, varint on the wire. | ||
| 22 | TYPE_STRING => 9, ## UTF-8 text. | ||
| 23 | TYPE_GROUP => 10, ## Tag-delimited message. Deprecated. | ||
| 24 | TYPE_MESSAGE => 11, ## Length-delimited message. | ||
| 25 | TYPE_BYTES => 12, ## Arbitrary byte array. | ||
| 26 | TYPE_UINT32 => 13, ## uint32, varint on the wire | ||
| 27 | TYPE_ENUM => 14, ## Enum, varint on the wire | ||
| 28 | TYPE_SFIXED32 => 15, ## int32, exactly four bytes on the wire | ||
| 29 | TYPE_SFIXED64 => 16, ## int64, exactly eight bytes on the wire | ||
| 30 | TYPE_SINT32 => 17, ## int32, ZigZag-encoded varint on the wire | ||
| 31 | TYPE_SINT64 => 18, ## int64, ZigZag-encoded varint on the wire | ||
| 32 | }; | ||
| 33 | |||
| 34 | ## from src/google/protobuf/descriptor.h | ||
| 35 | 14 | $labels = { | |
| 36 | LABEL_OPTIONAL => 1, | ||
| 37 | LABEL_REQUIRED => 2, | ||
| 38 | LABEL_REPEATED => 3, | ||
| 39 | }; | ||
| 40 | |||
| 41 | |||
| 42 | ## from src/google/protobuf/wire_format.h | ||
| 43 | 14 | $wiretypes = { | |
| 44 | WIRETYPE_VARINT => 0, | ||
| 45 | WIRETYPE_FIXED64 => 1, | ||
| 46 | WIRETYPE_LENGTH_DELIMITED => 2, | ||
| 47 | WIRETYPE_START_GROUP => 3, | ||
| 48 | WIRETYPE_END_GROUP => 4, | ||
| 49 | WIRETYPE_FIXED32 => 5, | ||
| 50 | }; | ||
| 51 | |||
| 52 | |||
| 53 | ## Complex types - this is not a part of Google specificaion | ||
| 54 | 14 | $complex_types = { | |
| 55 | MESSAGE => 1, | ||
| 56 | GROUP => 2, | ||
| 57 | ENUM => 3, | ||
| 58 | ONEOF => 4, | ||
| 59 | }; | ||
| 60 | } | ||
| 61 | |||
| 62 | 14 | ▶ | use base 'Exporter'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 63 | 14 | ▶ | use vars qw/@EXPORT_OK %EXPORT_TAGS/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 64 | |||
| 65 | 14 | ▶ | use constant $types; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 66 | 14 | $EXPORT_TAGS{'types'} = [keys %$types]; | |
| 67 | 14 | push @{$EXPORT_TAGS{'all'}}, keys %$types; | |
| 68 | 14 | push @EXPORT_OK, keys %$types; | |
| 69 | |||
| 70 | 14 | ▶ | use constant $wiretypes; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 71 | 14 | $EXPORT_TAGS{'wiretypes'} = [keys %$wiretypes]; | |
| 72 | 14 | push @{$EXPORT_TAGS{'all'}}, keys %$wiretypes; | |
| 73 | 14 | push @EXPORT_OK, keys %$wiretypes; | |
| 74 | |||
| 75 | 14 | ▶ | use constant $labels; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 76 | 14 | $EXPORT_TAGS{'labels'} = [keys %$labels]; | |
| 77 | 14 | push @{$EXPORT_TAGS{'all'}}, keys %$labels; | |
| 78 | 14 | push @EXPORT_OK, keys %$labels; | |
| 79 | |||
| 80 | 14 | ▶ | use constant $complex_types; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 81 | 14 | $EXPORT_TAGS{'complex_types'} = [keys %$complex_types]; | |
| 82 | 14 | push @{$EXPORT_TAGS{'all'}}, keys %$complex_types; | |
| 83 | 14 | push @EXPORT_OK, keys %$complex_types; | |
| 84 | |||
| 85 | 14 | 1; | |
| 86 | |||