line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
/* These definitions affect -pedantic warnings... |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
#define PERL_GCC_BRACE_GROUPS_FORBIDDEN 1 |
4
|
|
|
|
|
|
|
#define __STRICT_ANSI__ 1 |
5
|
|
|
|
|
|
|
#define PERL_GCC_PEDANTIC 1 |
6
|
|
|
|
|
|
|
*/ |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#include "EXTERN.h" |
9
|
|
|
|
|
|
|
#include "perl.h" |
10
|
|
|
|
|
|
|
#define NO_XSLOCKS |
11
|
|
|
|
|
|
|
#include "XSUB.h" |
12
|
|
|
|
|
|
|
#define NEED_newRV_noinc |
13
|
|
|
|
|
|
|
#define NEED_sv_2pv_nolen |
14
|
|
|
|
|
|
|
#define NEED_sv_2pvbyte |
15
|
|
|
|
|
|
|
#define NEED_gv_fetchpvn_flags |
16
|
|
|
|
|
|
|
#include "ppport.h" |
17
|
|
|
|
|
|
|
#include "yaml.h" |
18
|
|
|
|
|
|
|
#include "ppport_sort.h" |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
#ifndef PERL_STATIC_INLINE |
21
|
|
|
|
|
|
|
#define PERL_STATIC_INLINE static |
22
|
|
|
|
|
|
|
#endif |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
#if PERL_VERSION < 5 |
25
|
|
|
|
|
|
|
#define sv_peek(pTHX_ sv_file) "" |
26
|
|
|
|
|
|
|
#endif |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
/* 5.8.9 */ |
29
|
|
|
|
|
|
|
#ifndef GV_NOADD_NOINIT |
30
|
|
|
|
|
|
|
# ifdef GV_NOINIT |
31
|
|
|
|
|
|
|
# define GV_NOADD_NOINIT GV_NOINIT |
32
|
|
|
|
|
|
|
# else |
33
|
|
|
|
|
|
|
# define GV_NOADD_NOINIT 0 |
34
|
|
|
|
|
|
|
# endif |
35
|
|
|
|
|
|
|
#endif |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
#ifndef HvNAMEUTF8 |
38
|
|
|
|
|
|
|
# define HvNAMEUTF8(hv) 0 |
39
|
|
|
|
|
|
|
#endif |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
#define TAG_PERL_PREFIX "tag:yaml.org,2002:perl/" |
42
|
|
|
|
|
|
|
#define TAG_PERL_REF TAG_PERL_PREFIX "ref" |
43
|
|
|
|
|
|
|
#define TAG_PERL_STR TAG_PERL_PREFIX "str" |
44
|
|
|
|
|
|
|
#define TAG_PERL_GLOB TAG_PERL_PREFIX "glob" |
45
|
|
|
|
|
|
|
#define ERRMSG "yaml error: " |
46
|
|
|
|
|
|
|
#define WARNMSG "YAML::Safe warning: " |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
#define F_UNICODE 0x00000001 |
49
|
|
|
|
|
|
|
#define F_DISABLEBLESSED 0x00000002 |
50
|
|
|
|
|
|
|
#define F_QUOTENUM 0x00000004 |
51
|
|
|
|
|
|
|
#define F_NONSTRICT 0x00000008 |
52
|
|
|
|
|
|
|
#define F_LOADCODE 0x00000010 |
53
|
|
|
|
|
|
|
#define F_DUMPCODE 0x00000020 |
54
|
|
|
|
|
|
|
/* both: */ |
55
|
|
|
|
|
|
|
#define F_ENABLECODE 0x00000030 |
56
|
|
|
|
|
|
|
#define F_NOINDENTMAP 0x00000040 |
57
|
|
|
|
|
|
|
#define F_CANONICAL 0x00000080 |
58
|
|
|
|
|
|
|
#define F_OPENENDED 0x00000100 |
59
|
|
|
|
|
|
|
#define F_SAFEMODE 0x00000200 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
typedef enum { |
62
|
|
|
|
|
|
|
YAML_BOOLEAN_NONE = 0, |
63
|
|
|
|
|
|
|
YAML_BOOLEAN_JSONPP, |
64
|
|
|
|
|
|
|
YAML_BOOLEAN_BOOLEAN, |
65
|
|
|
|
|
|
|
} yaml_boolean_t; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
typedef struct { |
68
|
|
|
|
|
|
|
yaml_parser_t parser; /* inlined */ |
69
|
|
|
|
|
|
|
yaml_event_t event; |
70
|
|
|
|
|
|
|
yaml_emitter_t emitter; |
71
|
|
|
|
|
|
|
U32 flags; |
72
|
|
|
|
|
|
|
char *filename; |
73
|
|
|
|
|
|
|
PerlIO *perlio; |
74
|
|
|
|
|
|
|
HV *anchors; |
75
|
|
|
|
|
|
|
HV *shadows; |
76
|
|
|
|
|
|
|
HV *safeclasses; |
77
|
|
|
|
|
|
|
long anchor; |
78
|
|
|
|
|
|
|
int document; |
79
|
|
|
|
|
|
|
int indent; |
80
|
|
|
|
|
|
|
int wrapwidth; |
81
|
|
|
|
|
|
|
yaml_encoding_t encoding; |
82
|
|
|
|
|
|
|
yaml_break_t linebreak; |
83
|
|
|
|
|
|
|
yaml_boolean_t boolean; |
84
|
|
|
|
|
|
|
} YAML; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
#if 0 |
87
|
|
|
|
|
|
|
typedef struct { |
88
|
|
|
|
|
|
|
YAML yaml; /* common options */ |
89
|
|
|
|
|
|
|
yaml_parser_t parser; |
90
|
|
|
|
|
|
|
yaml_event_t event; |
91
|
|
|
|
|
|
|
int document; |
92
|
|
|
|
|
|
|
HV *anchors; |
93
|
|
|
|
|
|
|
} perl_yaml_loader_t; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
typedef struct { |
96
|
|
|
|
|
|
|
YAML yaml; /* common options */ |
97
|
|
|
|
|
|
|
yaml_emitter_t emitter; |
98
|
|
|
|
|
|
|
long anchor; |
99
|
|
|
|
|
|
|
HV *anchors; |
100
|
|
|
|
|
|
|
HV *shadows; |
101
|
|
|
|
|
|
|
} perl_yaml_dumper_t; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
PERL_STATIC_INLINE YAML* |
104
|
|
|
|
|
|
|
yaml_new () |
105
|
|
|
|
|
|
|
{ |
106
|
|
|
|
|
|
|
return (YAML*)calloc(1, sizeof(YAML)); |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
#endif |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
PERL_STATIC_INLINE YAML* |
111
|
177
|
|
|
|
|
|
yaml_init (YAML *self) |
112
|
|
|
|
|
|
|
{ |
113
|
177
|
|
|
|
|
|
Zero (self, 1, YAML); |
114
|
177
|
|
|
|
|
|
self->flags = F_UNICODE|F_QUOTENUM; |
115
|
177
|
|
|
|
|
|
self->indent = 2; |
116
|
177
|
|
|
|
|
|
self->wrapwidth = 80; |
117
|
177
|
|
|
|
|
|
return self; |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
void |
121
|
|
|
|
|
|
|
yaml_destroy (YAML *self); |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
int |
124
|
|
|
|
|
|
|
Dump(YAML*, int); |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
int |
127
|
|
|
|
|
|
|
DumpFile(YAML*, SV*, int); |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
int |
130
|
|
|
|
|
|
|
Load(YAML*, SV*); |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
int |
133
|
|
|
|
|
|
|
LoadFile(YAML*, SV*); |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
void |
136
|
|
|
|
|
|
|
set_parser_options(YAML *self, yaml_parser_t *parser); |
137
|
|
|
|
|
|
|
void |
138
|
|
|
|
|
|
|
set_emitter_options(YAML *self, yaml_emitter_t *emitter); |