50
56
void srl_destroy_encoder(pTHX_ srl_encoder_t *enc);
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);
77
83
* set since we otherwise croak. Corresponds to the 'warn_unknown' option. */
78
84
#define SRL_F_WARN_UNKNOWN 0x00020UL
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
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 */
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
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
139
#define SRL_DO_LONG_DOUBLE 0
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)); \
148
#define SRL_ENC_OPT_STR_ALIASED_DEDUPE_STRINGS "aliased_dedupe_strings"
149
#define SRL_ENC_OPT_IDX_ALIASED_DEDUPE_STRINGS 0
151
#define SRL_ENC_OPT_STR_CANONICAL "canonical"
152
#define SRL_ENC_OPT_IDX_CANONICAL 1
154
#define SRL_ENC_OPT_STR_CANONICAL_REFS "canonical_refs"
155
#define SRL_ENC_OPT_IDX_CANONICAL_REFS 2
157
#define SRL_ENC_OPT_STR_COMPRESS "compress"
158
#define SRL_ENC_OPT_IDX_COMPRESS 3
160
#define SRL_ENC_OPT_STR_COMPRESS_LEVEL "compress_level"
161
#define SRL_ENC_OPT_IDX_COMPRESS_LEVEL 4
163
#define SRL_ENC_OPT_STR_COMPRESS_THRESHOLD "compress_threshold"
164
#define SRL_ENC_OPT_IDX_COMPRESS_THRESHOLD 5
166
#define SRL_ENC_OPT_STR_CROAK_ON_BLESS "croak_on_bless"
167
#define SRL_ENC_OPT_IDX_CROAK_ON_BLESS 6
169
#define SRL_ENC_OPT_STR_DEDUPE_STRINGS "dedupe_strings"
170
#define SRL_ENC_OPT_IDX_DEDUPE_STRINGS 7
172
#define SRL_ENC_OPT_STR_FREEZE_CALLBACKS "freeze_callbacks"
173
#define SRL_ENC_OPT_IDX_FREEZE_CALLBACKS 8
175
#define SRL_ENC_OPT_STR_MAX_RECURSION_DEPTH "max_recursion_depth"
176
#define SRL_ENC_OPT_IDX_MAX_RECURSION_DEPTH 9
178
#define SRL_ENC_OPT_STR_NO_BLESS_OBJECTS "no_bless_objects"
179
#define SRL_ENC_OPT_IDX_NO_BLESS_OBJECTS 10
181
#define SRL_ENC_OPT_STR_NO_SHARED_HASHKEYS "no_shared_hashkeys"
182
#define SRL_ENC_OPT_IDX_NO_SHARED_HASHKEYS 11
184
#define SRL_ENC_OPT_STR_PROTOCOL_VERSION "protocol_version"
185
#define SRL_ENC_OPT_IDX_PROTOCOL_VERSION 12
187
#define SRL_ENC_OPT_STR_SNAPPY "snappy"
188
#define SRL_ENC_OPT_IDX_SNAPPY 13
190
#define SRL_ENC_OPT_STR_SNAPPY_INCR "snappy_incr"
191
#define SRL_ENC_OPT_IDX_SNAPPY_INCR 14
193
#define SRL_ENC_OPT_STR_SNAPPY_THRESHOLD "snappy_threshold"
194
#define SRL_ENC_OPT_IDX_SNAPPY_THRESHOLD 15
196
#define SRL_ENC_OPT_STR_SORT_KEYS "sort_keys"
197
#define SRL_ENC_OPT_IDX_SORT_KEYS 16
199
#define SRL_ENC_OPT_STR_STRINGIFY_UNKNOWN "stringify_unknown"
200
#define SRL_ENC_OPT_IDX_STRINGIFY_UNKNOWN 17
202
#define SRL_ENC_OPT_STR_UNDEF_UNKNOWN "undef_unknown"
203
#define SRL_ENC_OPT_IDX_UNDEF_UNKNOWN 18
205
#define SRL_ENC_OPT_STR_USE_PROTOCOL_V1 "use_protocol_v1"
206
#define SRL_ENC_OPT_IDX_USE_PROTOCOL_V1 19
208
#define SRL_ENC_OPT_STR_WARN_UNKNOWN "warn_unknown"
209
#define SRL_ENC_OPT_IDX_WARN_UNKNOWN 20
211
#define SRL_ENC_OPT_COUNT 21