| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
/*****************************************************************************/ |
|
4
|
|
|
|
|
|
|
/* */ |
|
5
|
|
|
|
|
|
|
/* Copyright (c) 1995 - 2004 by Steffen Beyer. */ |
|
6
|
|
|
|
|
|
|
/* All rights reserved. */ |
|
7
|
|
|
|
|
|
|
/* */ |
|
8
|
|
|
|
|
|
|
/* This package is free software; you can redistribute it */ |
|
9
|
|
|
|
|
|
|
/* and/or modify it under the same terms as Perl itself. */ |
|
10
|
|
|
|
|
|
|
/* */ |
|
11
|
|
|
|
|
|
|
/*****************************************************************************/ |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
#include "EXTERN.h" |
|
15
|
|
|
|
|
|
|
#include "perl.h" |
|
16
|
|
|
|
|
|
|
#include "XSUB.h" |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#include "patchlevel.h" |
|
20
|
|
|
|
|
|
|
#if ((PATCHLEVEL < 4) || ((PATCHLEVEL == 4) && (SUBVERSION < 5))) |
|
21
|
|
|
|
|
|
|
/* PL_na was introduced in perl5.004_05 */ |
|
22
|
|
|
|
|
|
|
#ifndef PL_na |
|
23
|
|
|
|
|
|
|
#define PL_na na |
|
24
|
|
|
|
|
|
|
#endif |
|
25
|
|
|
|
|
|
|
#endif |
|
26
|
|
|
|
|
|
|
#if (PATCHLEVEL < 4) |
|
27
|
|
|
|
|
|
|
/* GIMME_V was introduced in perl5.004 */ |
|
28
|
|
|
|
|
|
|
#ifndef GIMME_V |
|
29
|
|
|
|
|
|
|
#define GIMME_V GIMME |
|
30
|
|
|
|
|
|
|
#endif |
|
31
|
|
|
|
|
|
|
#endif |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#include "BitVector.h" |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
static char *BitVector_Class = "Bit::Vector"; |
|
38
|
|
|
|
|
|
|
static HV *BitVector_Stash; |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
typedef SV *BitVector_Object; |
|
41
|
|
|
|
|
|
|
typedef SV *BitVector_Handle; |
|
42
|
|
|
|
|
|
|
typedef N_word *BitVector_Address; |
|
43
|
|
|
|
|
|
|
typedef SV *BitVector_Scalar; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
const char *BitVector_OBJECT_ERROR = "item is not a \"Bit::Vector\" object"; |
|
47
|
|
|
|
|
|
|
const char *BitVector_SCALAR_ERROR = "item is not a scalar"; |
|
48
|
|
|
|
|
|
|
const char *BitVector_STRING_ERROR = "item is not a string"; |
|
49
|
|
|
|
|
|
|
const char *BitVector_MIN_ERROR = "minimum index out of range"; |
|
50
|
|
|
|
|
|
|
const char *BitVector_MAX_ERROR = "maximum index out of range"; |
|
51
|
|
|
|
|
|
|
const char *BitVector_START_ERROR = "start index out of range"; |
|
52
|
|
|
|
|
|
|
const char *BitVector_OFFSET_ERROR = "offset out of range"; |
|
53
|
|
|
|
|
|
|
const char *BitVector_CHUNK_ERROR = "chunk size out of range"; |
|
54
|
|
|
|
|
|
|
const char *BitVector_SET_ERROR = "set size mismatch"; |
|
55
|
|
|
|
|
|
|
const char *BitVector_MATRIX_ERROR = "matrix size mismatch"; |
|
56
|
|
|
|
|
|
|
const char *BitVector_SHAPE_ERROR = "not a square matrix"; |
|
57
|
|
|
|
|
|
|
const char *BitVector_MEMORY_ERROR = ERRCODE_NULL; |
|
58
|
|
|
|
|
|
|
const char *BitVector_INDEX_ERROR = ERRCODE_INDX; |
|
59
|
|
|
|
|
|
|
const char *BitVector_ORDER_ERROR = ERRCODE_ORDR; |
|
60
|
|
|
|
|
|
|
const char *BitVector_SIZE_ERROR = ERRCODE_SIZE; |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
#define BIT_VECTOR_OBJECT(ref,hdl,adr) \ |
|
64
|
|
|
|
|
|
|
( ref && \ |
|
65
|
|
|
|
|
|
|
SvROK(ref) && \ |
|
66
|
|
|
|
|
|
|
(hdl = (BitVector_Handle)SvRV(ref)) && \ |
|
67
|
|
|
|
|
|
|
SvOBJECT(hdl) && \ |
|
68
|
|
|
|
|
|
|
SvREADONLY(hdl) && \ |
|
69
|
|
|
|
|
|
|
(SvTYPE(hdl) == SVt_PVMG) && \ |
|
70
|
|
|
|
|
|
|
(SvSTASH(hdl) == BitVector_Stash) && \ |
|
71
|
|
|
|
|
|
|
(adr = (BitVector_Address)SvIV(hdl)) ) |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
#define BIT_VECTOR_SCALAR(ref,typ,var) \ |
|
74
|
|
|
|
|
|
|
( ref && !(SvROK(ref)) && ((var = (typ)SvIV(ref)) | 1) ) |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#define BIT_VECTOR_STRING(ref,var) \ |
|
77
|
|
|
|
|
|
|
( ref && !(SvROK(ref)) && (var = (charptr)SvPV(ref,PL_na)) ) |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
#define BIT_VECTOR_BUFFER(ref,var,len) \ |
|
80
|
|
|
|
|
|
|
( ref && !(SvROK(ref)) && SvPOK(ref) && \ |
|
81
|
|
|
|
|
|
|
(var = (charptr)SvPV(ref,PL_na)) && \ |
|
82
|
|
|
|
|
|
|
((len = (N_int)SvCUR(ref)) | 1) ) |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
#define BIT_VECTOR_ERROR(message) \ |
|
86
|
|
|
|
|
|
|
croak("Bit::Vector::%s(): %s", GvNAME(CvGV(cv)), message) |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
#define BIT_VECTOR_OBJECT_ERROR \ |
|
90
|
|
|
|
|
|
|
BIT_VECTOR_ERROR( BitVector_OBJECT_ERROR ) |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
#define BIT_VECTOR_SCALAR_ERROR \ |
|
93
|
|
|
|
|
|
|
BIT_VECTOR_ERROR( BitVector_SCALAR_ERROR ) |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
#define BIT_VECTOR_STRING_ERROR \ |
|
96
|
|
|
|
|
|
|
BIT_VECTOR_ERROR( BitVector_STRING_ERROR ) |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
#define BIT_VECTOR_MIN_ERROR \ |
|
99
|
|
|
|
|
|
|
BIT_VECTOR_ERROR( BitVector_MIN_ERROR ) |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
#define BIT_VECTOR_MAX_ERROR \ |
|
102
|
|
|
|
|
|
|
BIT_VECTOR_ERROR( BitVector_MAX_ERROR ) |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
#define BIT_VECTOR_START_ERROR \ |
|
105
|
|
|
|
|
|
|
BIT_VECTOR_ERROR( BitVector_START_ERROR ) |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
#define BIT_VECTOR_OFFSET_ERROR \ |
|
108
|
|
|
|
|
|
|
BIT_VECTOR_ERROR( BitVector_OFFSET_ERROR ) |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
#define BIT_VECTOR_CHUNK_ERROR \ |
|
111
|
|
|
|
|
|
|
BIT_VECTOR_ERROR( BitVector_CHUNK_ERROR ) |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
#define BIT_VECTOR_SET_ERROR \ |
|
114
|
|
|
|
|
|
|
BIT_VECTOR_ERROR( BitVector_SET_ERROR ) |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
#define BIT_VECTOR_MATRIX_ERROR \ |
|
117
|
|
|
|
|
|
|
BIT_VECTOR_ERROR( BitVector_MATRIX_ERROR ) |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
#define BIT_VECTOR_SHAPE_ERROR \ |
|
120
|
|
|
|
|
|
|
BIT_VECTOR_ERROR( BitVector_SHAPE_ERROR ) |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
#define BIT_VECTOR_MEMORY_ERROR \ |
|
123
|
|
|
|
|
|
|
BIT_VECTOR_ERROR( BitVector_MEMORY_ERROR ) |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
#define BIT_VECTOR_INDEX_ERROR \ |
|
126
|
|
|
|
|
|
|
BIT_VECTOR_ERROR( BitVector_INDEX_ERROR ) |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
#define BIT_VECTOR_ORDER_ERROR \ |
|
129
|
|
|
|
|
|
|
BIT_VECTOR_ERROR( BitVector_ORDER_ERROR ) |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
#define BIT_VECTOR_SIZE_ERROR \ |
|
132
|
|
|
|
|
|
|
BIT_VECTOR_ERROR( BitVector_SIZE_ERROR ) |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
#define BIT_VECTOR_EXCEPTION(code) \ |
|
136
|
|
|
|
|
|
|
BIT_VECTOR_ERROR( BitVector_Error(code) ) |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
MODULE = Bit::Vector PACKAGE = Bit::Vector PREFIX = BitVector_ |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
PROTOTYPES: DISABLE |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
BOOT: |
|
146
|
|
|
|
|
|
|
{ |
|
147
|
|
|
|
|
|
|
ErrCode rc; |
|
148
|
|
|
|
|
|
|
|
|
149
|
21
|
|
|
|
|
|
if ((rc = BitVector_Boot())) |
|
150
|
|
|
|
|
|
|
{ |
|
151
|
0
|
|
|
|
|
|
BIT_VECTOR_EXCEPTION(rc); |
|
152
|
|
|
|
|
|
|
exit((int)rc); |
|
153
|
|
|
|
|
|
|
} |
|
154
|
21
|
|
|
|
|
|
BitVector_Stash = gv_stashpv(BitVector_Class,1); |
|
155
|
|
|
|
|
|
|
} |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
void |
|
159
|
|
|
|
|
|
|
BitVector_Version(...) |
|
160
|
|
|
|
|
|
|
PPCODE: |
|
161
|
|
|
|
|
|
|
{ |
|
162
|
|
|
|
|
|
|
charptr string; |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
if ((items >= 0) and (items <= 1)) |
|
165
|
|
|
|
|
|
|
{ |
|
166
|
4
|
|
|
|
|
|
string = BitVector_Version(); |
|
167
|
4
|
|
|
|
|
|
if (string != NULL) |
|
168
|
|
|
|
|
|
|
{ |
|
169
|
4
|
|
|
|
|
|
EXTEND(sp,1); |
|
170
|
4
|
|
|
|
|
|
PUSHs(sv_2mortal(newSVpv((char *)string,0))); |
|
171
|
|
|
|
|
|
|
} |
|
172
|
0
|
|
|
|
|
|
else BIT_VECTOR_MEMORY_ERROR; |
|
173
|
|
|
|
|
|
|
} |
|
174
|
2
|
|
|
|
|
|
else croak("Usage: Bit::Vector->Version()"); |
|
175
|
|
|
|
|
|
|
} |
|
176
|
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
N_int |
|
179
|
|
|
|
|
|
|
BitVector_Word_Bits(...) |
|
180
|
|
|
|
|
|
|
CODE: |
|
181
|
|
|
|
|
|
|
{ |
|
182
|
24
|
|
|
|
|
|
if ((items >= 0) and (items <= 1)) |
|
183
|
|
|
|
|
|
|
{ |
|
184
|
22
|
|
|
|
|
|
RETVAL = BitVector_Word_Bits(); |
|
185
|
|
|
|
|
|
|
} |
|
186
|
2
|
|
|
|
|
|
else croak("Usage: Bit::Vector->Word_Bits()"); |
|
187
|
|
|
|
|
|
|
} |
|
188
|
|
|
|
|
|
|
OUTPUT: |
|
189
|
|
|
|
|
|
|
RETVAL |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
N_int |
|
193
|
|
|
|
|
|
|
BitVector_Long_Bits(...) |
|
194
|
|
|
|
|
|
|
CODE: |
|
195
|
|
|
|
|
|
|
{ |
|
196
|
106
|
|
|
|
|
|
if ((items >= 0) and (items <= 1)) |
|
197
|
|
|
|
|
|
|
{ |
|
198
|
104
|
|
|
|
|
|
RETVAL = BitVector_Long_Bits(); |
|
199
|
|
|
|
|
|
|
} |
|
200
|
2
|
|
|
|
|
|
else croak("Usage: Bit::Vector->Long_Bits()"); |
|
201
|
|
|
|
|
|
|
} |
|
202
|
|
|
|
|
|
|
OUTPUT: |
|
203
|
|
|
|
|
|
|
RETVAL |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
void |
|
207
|
|
|
|
|
|
|
BitVector_Create(...) |
|
208
|
|
|
|
|
|
|
ALIAS: |
|
209
|
|
|
|
|
|
|
new = 1 |
|
210
|
|
|
|
|
|
|
PPCODE: |
|
211
|
|
|
|
|
|
|
{ |
|
212
|
|
|
|
|
|
|
BitVector_Scalar arg1; |
|
213
|
|
|
|
|
|
|
BitVector_Scalar arg2; |
|
214
|
|
|
|
|
|
|
BitVector_Address address; |
|
215
|
|
|
|
|
|
|
BitVector_Handle handle; |
|
216
|
|
|
|
|
|
|
BitVector_Object reference; |
|
217
|
|
|
|
|
|
|
listptr list; |
|
218
|
|
|
|
|
|
|
listptr slot; |
|
219
|
|
|
|
|
|
|
N_int bits; |
|
220
|
|
|
|
|
|
|
N_int count; |
|
221
|
|
|
|
|
|
|
|
|
222
|
4217
|
|
|
|
|
|
if ((items >= 2) and (items <= 3)) |
|
223
|
|
|
|
|
|
|
{ |
|
224
|
4209
|
|
|
|
|
|
arg1 = ST(1); |
|
225
|
4209
|
|
|
|
|
|
if ( BIT_VECTOR_SCALAR(arg1,N_int,bits) ) |
|
226
|
|
|
|
|
|
|
{ |
|
227
|
4208
|
|
|
|
|
|
if (items > 2) |
|
228
|
|
|
|
|
|
|
{ |
|
229
|
0
|
|
|
|
|
|
arg2 = ST(2); |
|
230
|
0
|
|
|
|
|
|
if ( BIT_VECTOR_SCALAR(arg2,N_int,count) ) |
|
231
|
|
|
|
|
|
|
{ |
|
232
|
0
|
|
|
|
|
|
if (count > 0) |
|
233
|
|
|
|
|
|
|
{ |
|
234
|
0
|
|
|
|
|
|
if ((list = BitVector_Create_List(bits,true,count)) != NULL) |
|
235
|
|
|
|
|
|
|
{ |
|
236
|
0
|
|
|
|
|
|
EXTEND(sp,(int)count); |
|
237
|
|
|
|
|
|
|
slot = list; |
|
238
|
0
|
|
|
|
|
|
while (count-- > 0) |
|
239
|
|
|
|
|
|
|
{ |
|
240
|
0
|
|
|
|
|
|
address = *slot++; |
|
241
|
0
|
|
|
|
|
|
handle = newSViv((IV)address); |
|
242
|
0
|
|
|
|
|
|
reference = sv_bless(sv_2mortal(newRV(handle)), |
|
243
|
|
|
|
|
|
|
BitVector_Stash); |
|
244
|
0
|
|
|
|
|
|
SvREFCNT_dec(handle); |
|
245
|
0
|
|
|
|
|
|
SvREADONLY_on(handle); |
|
246
|
0
|
|
|
|
|
|
PUSHs(reference); |
|
247
|
|
|
|
|
|
|
} |
|
248
|
0
|
|
|
|
|
|
BitVector_Destroy_List(list,0); |
|
249
|
|
|
|
|
|
|
} |
|
250
|
0
|
|
|
|
|
|
else BIT_VECTOR_MEMORY_ERROR; |
|
251
|
|
|
|
|
|
|
} |
|
252
|
|
|
|
|
|
|
} |
|
253
|
0
|
|
|
|
|
|
else BIT_VECTOR_SCALAR_ERROR; |
|
254
|
|
|
|
|
|
|
} |
|
255
|
|
|
|
|
|
|
else |
|
256
|
|
|
|
|
|
|
{ |
|
257
|
4208
|
|
|
|
|
|
if ((address = BitVector_Create(bits,true)) != NULL) |
|
258
|
|
|
|
|
|
|
{ |
|
259
|
4208
|
|
|
|
|
|
handle = newSViv((IV)address); |
|
260
|
4208
|
|
|
|
|
|
reference = sv_bless(sv_2mortal(newRV(handle)), |
|
261
|
|
|
|
|
|
|
BitVector_Stash); |
|
262
|
4208
|
|
|
|
|
|
SvREFCNT_dec(handle); |
|
263
|
4208
|
|
|
|
|
|
SvREADONLY_on(handle); |
|
264
|
4208
|
|
|
|
|
|
PUSHs(reference); |
|
265
|
|
|
|
|
|
|
} |
|
266
|
0
|
|
|
|
|
|
else BIT_VECTOR_MEMORY_ERROR; |
|
267
|
|
|
|
|
|
|
} |
|
268
|
|
|
|
|
|
|
} |
|
269
|
1
|
|
|
|
|
|
else BIT_VECTOR_SCALAR_ERROR; |
|
270
|
|
|
|
|
|
|
} |
|
271
|
8
|
|
|
|
|
|
else croak("Usage: %s(class,bits[,count])", GvNAME(CvGV(cv))); |
|
272
|
|
|
|
|
|
|
} |
|
273
|
|
|
|
|
|
|
|
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
void |
|
276
|
|
|
|
|
|
|
BitVector_new_Hex(class,bits,string) |
|
277
|
|
|
|
|
|
|
BitVector_Object class |
|
278
|
|
|
|
|
|
|
BitVector_Scalar bits |
|
279
|
|
|
|
|
|
|
BitVector_Scalar string |
|
280
|
|
|
|
|
|
|
PPCODE: |
|
281
|
|
|
|
|
|
|
{ |
|
282
|
|
|
|
|
|
|
BitVector_Address address; |
|
283
|
|
|
|
|
|
|
BitVector_Handle handle; |
|
284
|
|
|
|
|
|
|
BitVector_Object reference; |
|
285
|
|
|
|
|
|
|
N_int size; |
|
286
|
|
|
|
|
|
|
charptr pointer; |
|
287
|
|
|
|
|
|
|
ErrCode code; |
|
288
|
|
|
|
|
|
|
|
|
289
|
57
|
|
|
|
|
|
if ( BIT_VECTOR_SCALAR(bits,N_int,size) ) |
|
290
|
|
|
|
|
|
|
{ |
|
291
|
56
|
|
|
|
|
|
if ( BIT_VECTOR_STRING(string,pointer) ) |
|
292
|
|
|
|
|
|
|
{ |
|
293
|
55
|
|
|
|
|
|
if ((address = BitVector_Create(size,false)) != NULL) |
|
294
|
|
|
|
|
|
|
{ |
|
295
|
55
|
|
|
|
|
|
if ((code = BitVector_from_Hex(address,pointer))) |
|
296
|
|
|
|
|
|
|
{ |
|
297
|
0
|
|
|
|
|
|
BitVector_Destroy(address); |
|
298
|
0
|
|
|
|
|
|
BIT_VECTOR_EXCEPTION(code); |
|
299
|
|
|
|
|
|
|
} |
|
300
|
|
|
|
|
|
|
else |
|
301
|
|
|
|
|
|
|
{ |
|
302
|
55
|
|
|
|
|
|
handle = newSViv((IV)address); |
|
303
|
55
|
|
|
|
|
|
reference = sv_bless(sv_2mortal(newRV(handle)), |
|
304
|
|
|
|
|
|
|
BitVector_Stash); |
|
305
|
55
|
|
|
|
|
|
SvREFCNT_dec(handle); |
|
306
|
55
|
|
|
|
|
|
SvREADONLY_on(handle); |
|
307
|
55
|
|
|
|
|
|
PUSHs(reference); |
|
308
|
|
|
|
|
|
|
} |
|
309
|
|
|
|
|
|
|
} |
|
310
|
0
|
|
|
|
|
|
else BIT_VECTOR_MEMORY_ERROR; |
|
311
|
|
|
|
|
|
|
} |
|
312
|
1
|
|
|
|
|
|
else BIT_VECTOR_STRING_ERROR; |
|
313
|
|
|
|
|
|
|
} |
|
314
|
1
|
|
|
|
|
|
else BIT_VECTOR_SCALAR_ERROR; |
|
315
|
|
|
|
|
|
|
} |
|
316
|
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
void |
|
319
|
|
|
|
|
|
|
BitVector_new_Bin(class,bits,string) |
|
320
|
|
|
|
|
|
|
BitVector_Object class |
|
321
|
|
|
|
|
|
|
BitVector_Scalar bits |
|
322
|
|
|
|
|
|
|
BitVector_Scalar string |
|
323
|
|
|
|
|
|
|
PPCODE: |
|
324
|
|
|
|
|
|
|
{ |
|
325
|
|
|
|
|
|
|
BitVector_Address address; |
|
326
|
|
|
|
|
|
|
BitVector_Handle handle; |
|
327
|
|
|
|
|
|
|
BitVector_Object reference; |
|
328
|
|
|
|
|
|
|
N_int size; |
|
329
|
|
|
|
|
|
|
charptr pointer; |
|
330
|
|
|
|
|
|
|
ErrCode code; |
|
331
|
|
|
|
|
|
|
|
|
332
|
57
|
|
|
|
|
|
if ( BIT_VECTOR_SCALAR(bits,N_int,size) ) |
|
333
|
|
|
|
|
|
|
{ |
|
334
|
56
|
|
|
|
|
|
if ( BIT_VECTOR_STRING(string,pointer) ) |
|
335
|
|
|
|
|
|
|
{ |
|
336
|
55
|
|
|
|
|
|
if ((address = BitVector_Create(size,false)) != NULL) |
|
337
|
|
|
|
|
|
|
{ |
|
338
|
55
|
|
|
|
|
|
if ((code = BitVector_from_Bin(address,pointer))) |
|
339
|
|
|
|
|
|
|
{ |
|
340
|
0
|
|
|
|
|
|
BitVector_Destroy(address); |
|
341
|
0
|
|
|
|
|
|
BIT_VECTOR_EXCEPTION(code); |
|
342
|
|
|
|
|
|
|
} |
|
343
|
|
|
|
|
|
|
else |
|
344
|
|
|
|
|
|
|
{ |
|
345
|
55
|
|
|
|
|
|
handle = newSViv((IV)address); |
|
346
|
55
|
|
|
|
|
|
reference = sv_bless(sv_2mortal(newRV(handle)), |
|
347
|
|
|
|
|
|
|
BitVector_Stash); |
|
348
|
55
|
|
|
|
|
|
SvREFCNT_dec(handle); |
|
349
|
55
|
|
|
|
|
|
SvREADONLY_on(handle); |
|
350
|
55
|
|
|
|
|
|
PUSHs(reference); |
|
351
|
|
|
|
|
|
|
} |
|
352
|
|
|
|
|
|
|
} |
|
353
|
0
|
|
|
|
|
|
else BIT_VECTOR_MEMORY_ERROR; |
|
354
|
|
|
|
|
|
|
} |
|
355
|
1
|
|
|
|
|
|
else BIT_VECTOR_STRING_ERROR; |
|
356
|
|
|
|
|
|
|
} |
|
357
|
1
|
|
|
|
|
|
else BIT_VECTOR_SCALAR_ERROR; |
|
358
|
|
|
|
|
|
|
} |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
|
|
361
|
|
|
|
|
|
|
void |
|
362
|
|
|
|
|
|
|
BitVector_new_Dec(class,bits,string) |
|
363
|
|
|
|
|
|
|
BitVector_Object class |
|
364
|
|
|
|
|
|
|
BitVector_Scalar bits |
|
365
|
|
|
|
|
|
|
BitVector_Scalar string |
|
366
|
|
|
|
|
|
|
PPCODE: |
|
367
|
|
|
|
|
|
|
{ |
|
368
|
|
|
|
|
|
|
BitVector_Address address; |
|
369
|
|
|
|
|
|
|
BitVector_Handle handle; |
|
370
|
|
|
|
|
|
|
BitVector_Object reference; |
|
371
|
|
|
|
|
|
|
N_int size; |
|
372
|
|
|
|
|
|
|
charptr pointer; |
|
373
|
|
|
|
|
|
|
ErrCode code; |
|
374
|
|
|
|
|
|
|
|
|
375
|
57
|
|
|
|
|
|
if ( BIT_VECTOR_SCALAR(bits,N_int,size) ) |
|
376
|
|
|
|
|
|
|
{ |
|
377
|
56
|
|
|
|
|
|
if ( BIT_VECTOR_STRING(string,pointer) ) |
|
378
|
|
|
|
|
|
|
{ |
|
379
|
55
|
|
|
|
|
|
if ((address = BitVector_Create(size,false)) != NULL) |
|
380
|
|
|
|
|
|
|
{ |
|
381
|
55
|
|
|
|
|
|
if ((code = BitVector_from_Dec(address,pointer))) |
|
382
|
|
|
|
|
|
|
{ |
|
383
|
0
|
|
|
|
|
|
BitVector_Destroy(address); |
|
384
|
0
|
|
|
|
|
|
BIT_VECTOR_EXCEPTION(code); |
|
385
|
|
|
|
|
|
|
} |
|
386
|
|
|
|
|
|
|
else |
|
387
|
|
|
|
|
|
|
{ |
|
388
|
55
|
|
|
|
|
|
handle = newSViv((IV)address); |
|
389
|
55
|
|
|
|
|
|
reference = sv_bless(sv_2mortal(newRV(handle)), |
|
390
|
|
|
|
|
|
|
BitVector_Stash); |
|
391
|
55
|
|
|
|
|
|
SvREFCNT_dec(handle); |
|
392
|
55
|
|
|
|
|
|
SvREADONLY_on(handle); |
|
393
|
55
|
|
|
|
|
|
PUSHs(reference); |
|
394
|
|
|
|
|
|
|
} |
|
395
|
|
|
|
|
|
|
} |
|
396
|
0
|
|
|
|
|
|
else BIT_VECTOR_MEMORY_ERROR; |
|
397
|
|
|
|
|
|
|
} |
|
398
|
1
|
|
|
|
|
|
else BIT_VECTOR_STRING_ERROR; |
|
399
|
|
|
|
|
|
|
} |
|
400
|
1
|
|
|
|
|
|
else BIT_VECTOR_SCALAR_ERROR; |
|
401
|
|
|
|
|
|
|
} |
|
402
|
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
|
|
404
|
|
|
|
|
|
|
void |
|
405
|
|
|
|
|
|
|
BitVector_new_Enum(class,bits,string) |
|
406
|
|
|
|
|
|
|
BitVector_Object class |
|
407
|
|
|
|
|
|
|
BitVector_Scalar bits |
|
408
|
|
|
|
|
|
|
BitVector_Scalar string |
|
409
|
|
|
|
|
|
|
PPCODE: |
|
410
|
|
|
|
|
|
|
{ |
|
411
|
|
|
|
|
|
|
BitVector_Address address; |
|
412
|
|
|
|
|
|
|
BitVector_Handle handle; |
|
413
|
|
|
|
|
|
|
BitVector_Object reference; |
|
414
|
|
|
|
|
|
|
N_int size; |
|
415
|
|
|
|
|
|
|
charptr pointer; |
|
416
|
|
|
|
|
|
|
ErrCode code; |
|
417
|
|
|
|
|
|
|
|
|
418
|
57
|
|
|
|
|
|
if ( BIT_VECTOR_SCALAR(bits,N_int,size) ) |
|
419
|
|
|
|
|
|
|
{ |
|
420
|
56
|
|
|
|
|
|
if ( BIT_VECTOR_STRING(string,pointer) ) |
|
421
|
|
|
|
|
|
|
{ |
|
422
|
55
|
|
|
|
|
|
if ((address = BitVector_Create(size,false)) != NULL) |
|
423
|
|
|
|
|
|
|
{ |
|
424
|
55
|
|
|
|
|
|
if ((code = BitVector_from_Enum(address,pointer))) |
|
425
|
|
|
|
|
|
|
{ |
|
426
|
0
|
|
|
|
|
|
BitVector_Destroy(address); |
|
427
|
0
|
|
|
|
|
|
BIT_VECTOR_EXCEPTION(code); |
|
428
|
|
|
|
|
|
|
} |
|
429
|
|
|
|
|
|
|
else |
|
430
|
|
|
|
|
|
|
{ |
|
431
|
55
|
|
|
|
|
|
handle = newSViv((IV)address); |
|
432
|
55
|
|
|
|
|
|
reference = sv_bless(sv_2mortal(newRV(handle)), |
|
433
|
|
|
|
|
|
|
BitVector_Stash); |
|
434
|
55
|
|
|
|
|
|
SvREFCNT_dec(handle); |
|
435
|
55
|
|
|
|
|
|
SvREADONLY_on(handle); |
|
436
|
55
|
|
|
|
|
|
PUSHs(reference); |
|
437
|
|
|
|
|
|
|
} |
|
438
|
|
|
|
|
|
|
} |
|
439
|
0
|
|
|
|
|
|
else BIT_VECTOR_MEMORY_ERROR; |
|
440
|
|
|
|
|
|
|
} |
|
441
|
1
|
|
|
|
|
|
else BIT_VECTOR_STRING_ERROR; |
|
442
|
|
|
|
|
|
|
} |
|
443
|
1
|
|
|
|
|
|
else BIT_VECTOR_SCALAR_ERROR; |
|
444
|
|
|
|
|
|
|
} |
|
445
|
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
void |
|
448
|
|
|
|
|
|
|
BitVector_Shadow(reference) |
|
449
|
|
|
|
|
|
|
BitVector_Object reference |
|
450
|
|
|
|
|
|
|
PPCODE: |
|
451
|
|
|
|
|
|
|
{ |
|
452
|
|
|
|
|
|
|
BitVector_Handle handle; |
|
453
|
|
|
|
|
|
|
BitVector_Address address; |
|
454
|
|
|
|
|
|
|
|
|
455
|
2736
|
|
|
|
|
|
if ( BIT_VECTOR_OBJECT(reference,handle,address) ) |
|
456
|
|
|
|
|
|
|
{ |
|
457
|
2733
|
|
|
|
|
|
if ((address = BitVector_Shadow(address)) != NULL) |
|
458
|
|
|
|
|
|
|
{ |
|
459
|
2733
|
|
|
|
|
|
handle = newSViv((IV)address); |
|
460
|
2733
|
|
|
|
|
|
reference = sv_bless(sv_2mortal(newRV(handle)), |
|
461
|
|
|
|
|
|
|
BitVector_Stash); |
|
462
|
2733
|
|
|
|
|
|
SvREFCNT_dec(handle); |
|
463
|
2733
|
|
|
|
|
|
SvREADONLY_on(handle); |
|
464
|
2733
|
|
|
|
|
|
PUSHs(reference); |
|
465
|
|
|
|
|
|
|
} |
|
466
|
0
|
|
|
|
|
|
else BIT_VECTOR_MEMORY_ERROR; |
|
467
|
|
|
|
|
|
|
} |
|
468
|
3
|
|
|
|
|
|
else BIT_VECTOR_OBJECT_ERROR; |
|
469
|
|
|
|
|
|
|
} |
|
470
|
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
|
|
472
|
|
|