~ubuntu-branches/ubuntu/wily/libsereal-encoder-perl/wily

« back to all changes in this revision

Viewing changes to srl_encoder.h

  • Committer: Package Import Robot
  • Author(s): Alexandre Mestiashvili, Alexandre Mestiashvili, gregor herrmann
  • Date: 2015-04-29 11:12:18 UTC
  • mfrom: (17.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20150429111218-v3ghc7ck5gcr38fu
Tags: 3.005.001-1
[ Alexandre Mestiashvili ]
* Imported Upstream version 3.005.001
* d/control: cme fix dpkg
* d/copyright: updated debian/* copyright year

[ gregor herrmann ]
* Mark package as autopkgtest-able.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
    SV *sereal_string_sv;     /* SV that says "Sereal" for FREEZE support */
40
40
} srl_encoder_t;
41
41
 
 
42
typedef struct {
 
43
    SV *sv;
 
44
    U32 hash;
 
45
} sv_with_hash;
 
46
 
42
47
/* constructor from options */
43
 
srl_encoder_t *srl_build_encoder_struct(pTHX_ HV *opt);
 
48
srl_encoder_t *srl_build_encoder_struct(pTHX_ HV *opt, sv_with_hash *options);
 
49
 
44
50
/* clone; "constructor from prototype" */
45
51
srl_encoder_t *srl_build_encoder_struct_alike(pTHX_ srl_encoder_t *proto);
46
52
 
50
56
void srl_destroy_encoder(pTHX_ srl_encoder_t *enc);
51
57
 
52
58
/* Write Sereal packet header to output buffer */
53
 
void srl_write_header(pTHX_ srl_encoder_t *enc, SV *user_header_src);
 
59
void srl_write_header(pTHX_ srl_encoder_t *enc, SV *user_header_src, const U32 compress_flags);
54
60
/* Start dumping a top-level SV */
55
61
SV *srl_dump_data_structure_mortal_sv(pTHX_ srl_encoder_t *enc, SV *src, SV *user_header_src, const U32 flags);
56
62
 
77
83
 * set since we otherwise croak.  Corresponds to the 'warn_unknown' option. */
78
84
#define SRL_F_WARN_UNKNOWN                      0x00020UL
79
85
 
80
 
/* WARNING: This is different from the protocol bit SRL_PROTOCOL_ENCODING_SNAPPY in that it's
81
 
 *          a flag on the encoder struct indicating that we want to use Snappy. */
82
 
#define SRL_F_COMPRESS_SNAPPY                   0x00040UL
83
 
#define SRL_F_COMPRESS_SNAPPY_INCREMENTAL       0x00080UL
84
 
 
85
 
/* WARNING: This is different from the protocol bit SRL_PROTOCOL_ENCODING_ZLIB in that it's
86
 
 *          a flag on the encoder struct indicating that we want to use ZLIB. */
87
 
#define SRL_F_COMPRESS_ZLIB                     0x00100UL
 
86
/* WARNING: SRL_F_COMPRESS_SNAPPY               0x00040UL
 
87
 *          SRL_F_COMPRESS_SNAPPY_INCREMENTAL   0x00080UL
 
88
 *          SRL_F_COMPRESS_ZLIB                 0x00100UL
 
89
 *          are moved to srl_compress.h */
88
90
 
89
91
/* Only meaningful if SRL_F_WARN_UNKNOWN also set. If this one is set, then we don't warn
90
92
 * if the unsupported item has string overloading. */
130
132
#define SRL_ENC_SV_COPY_ALWAYS 0x00000000UL
131
133
#define SRL_ENC_SV_REUSE_MAYBE 0x00000001UL
132
134
 
 
135
/* by default we do not allow people to build with support for SRL_HDR_LONG_DOUBLE */
 
136
#if defined(SRL_ALLOW_LONG_DOUBLE) && defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
 
137
#define SRL_DO_LONG_DOUBLE      1
 
138
#else
 
139
#define SRL_DO_LONG_DOUBLE      0
 
140
#endif
 
141
 
 
142
/* Options Parsing related code */
 
143
#define SRL_INIT_OPTION(idx, str) STMT_START {                          \
 
144
    MY_CXT.options[idx].sv = newSVpvn((str ""), (sizeof(str) - 1));     \
 
145
    PERL_HASH(MY_CXT.options[idx].hash, (str ""), (sizeof(str) - 1));   \
 
146
} STMT_END
 
147
 
 
148
#define SRL_ENC_OPT_STR_ALIASED_DEDUPE_STRINGS "aliased_dedupe_strings"
 
149
#define SRL_ENC_OPT_IDX_ALIASED_DEDUPE_STRINGS 0
 
150
 
 
151
#define SRL_ENC_OPT_STR_CANONICAL "canonical"
 
152
#define SRL_ENC_OPT_IDX_CANONICAL 1
 
153
 
 
154
#define SRL_ENC_OPT_STR_CANONICAL_REFS "canonical_refs"
 
155
#define SRL_ENC_OPT_IDX_CANONICAL_REFS 2
 
156
 
 
157
#define SRL_ENC_OPT_STR_COMPRESS "compress"
 
158
#define SRL_ENC_OPT_IDX_COMPRESS 3
 
159
 
 
160
#define SRL_ENC_OPT_STR_COMPRESS_LEVEL "compress_level"
 
161
#define SRL_ENC_OPT_IDX_COMPRESS_LEVEL 4
 
162
 
 
163
#define SRL_ENC_OPT_STR_COMPRESS_THRESHOLD "compress_threshold"
 
164
#define SRL_ENC_OPT_IDX_COMPRESS_THRESHOLD 5
 
165
 
 
166
#define SRL_ENC_OPT_STR_CROAK_ON_BLESS "croak_on_bless"
 
167
#define SRL_ENC_OPT_IDX_CROAK_ON_BLESS 6
 
168
 
 
169
#define SRL_ENC_OPT_STR_DEDUPE_STRINGS "dedupe_strings"
 
170
#define SRL_ENC_OPT_IDX_DEDUPE_STRINGS 7
 
171
 
 
172
#define SRL_ENC_OPT_STR_FREEZE_CALLBACKS "freeze_callbacks"
 
173
#define SRL_ENC_OPT_IDX_FREEZE_CALLBACKS 8
 
174
 
 
175
#define SRL_ENC_OPT_STR_MAX_RECURSION_DEPTH "max_recursion_depth"
 
176
#define SRL_ENC_OPT_IDX_MAX_RECURSION_DEPTH 9
 
177
 
 
178
#define SRL_ENC_OPT_STR_NO_BLESS_OBJECTS "no_bless_objects"
 
179
#define SRL_ENC_OPT_IDX_NO_BLESS_OBJECTS 10
 
180
 
 
181
#define SRL_ENC_OPT_STR_NO_SHARED_HASHKEYS "no_shared_hashkeys"
 
182
#define SRL_ENC_OPT_IDX_NO_SHARED_HASHKEYS 11
 
183
 
 
184
#define SRL_ENC_OPT_STR_PROTOCOL_VERSION "protocol_version"
 
185
#define SRL_ENC_OPT_IDX_PROTOCOL_VERSION 12
 
186
 
 
187
#define SRL_ENC_OPT_STR_SNAPPY "snappy"
 
188
#define SRL_ENC_OPT_IDX_SNAPPY 13
 
189
 
 
190
#define SRL_ENC_OPT_STR_SNAPPY_INCR "snappy_incr"
 
191
#define SRL_ENC_OPT_IDX_SNAPPY_INCR 14
 
192
 
 
193
#define SRL_ENC_OPT_STR_SNAPPY_THRESHOLD "snappy_threshold"
 
194
#define SRL_ENC_OPT_IDX_SNAPPY_THRESHOLD 15
 
195
 
 
196
#define SRL_ENC_OPT_STR_SORT_KEYS "sort_keys"
 
197
#define SRL_ENC_OPT_IDX_SORT_KEYS 16
 
198
 
 
199
#define SRL_ENC_OPT_STR_STRINGIFY_UNKNOWN "stringify_unknown"
 
200
#define SRL_ENC_OPT_IDX_STRINGIFY_UNKNOWN 17
 
201
 
 
202
#define SRL_ENC_OPT_STR_UNDEF_UNKNOWN "undef_unknown"
 
203
#define SRL_ENC_OPT_IDX_UNDEF_UNKNOWN 18
 
204
 
 
205
#define SRL_ENC_OPT_STR_USE_PROTOCOL_V1 "use_protocol_v1"
 
206
#define SRL_ENC_OPT_IDX_USE_PROTOCOL_V1 19
 
207
 
 
208
#define SRL_ENC_OPT_STR_WARN_UNKNOWN "warn_unknown"
 
209
#define SRL_ENC_OPT_IDX_WARN_UNKNOWN 20
 
210
 
 
211
#define SRL_ENC_OPT_COUNT 21
 
212
 
133
213
#endif