Initial commit
[text-levenshtein-edlib.git] / fallback / const-c.inc
1 #define PERL_constant_NOTFOUND 1
2 #define PERL_constant_NOTDEF 2
3 #define PERL_constant_ISIV 3
4 #define PERL_constant_ISNO 4
5 #define PERL_constant_ISNV 5
6 #define PERL_constant_ISPV 6
7 #define PERL_constant_ISPVN 7
8 #define PERL_constant_ISSV 8
9 #define PERL_constant_ISUNDEF 9
10 #define PERL_constant_ISUV 10
11 #define PERL_constant_ISYES 11
12
13 #ifndef NVTYPE
14 typedef double NV; /* 5.6 and later define NVTYPE, and typedef NV to it. */
15 #endif
16 #ifndef aTHX_
17 #define aTHX_ /* 5.6 or later define this for threading support. */
18 #endif
19 #ifndef pTHX_
20 #define pTHX_ /* 5.6 or later define this for threading support. */
21 #endif
22
23 static int
24 constant (pTHX_ const char *name, STRLEN len, IV *iv_return) {
25 /* Initially switch on the length of the name. */
26 /* When generated this function returned values for the list of names given
27 in this section of perl code. Rather than manually editing these functions
28 to add or remove constants, which would result in this comment and section
29 of code becoming inaccurate, we recommend that you edit this section of
30 code, and use it to regenerate a new set of constant functions which you
31 then use to replace the originals.
32
33 Regenerate these constant functions by feeding this entire source file to
34 perl -x
35
36 #!/usr/bin/perl -w
37 use ExtUtils::Constant qw (constant_types C_constant XS_constant);
38
39 my $types = {map {($_, 1)} qw(IV)};
40 my @names = (qw(EDLIB_EDOP_DELETE EDLIB_EDOP_INSERT EDLIB_EDOP_MATCH
41 EDLIB_EDOP_MISMATCH EDLIB_STATUS_ERROR EDLIB_STATUS_OK),
42 {name=>"EDLIB_CIGAR_EXTENDED", type=>"IV", macro=>"1"},
43 {name=>"EDLIB_CIGAR_STANDARD", type=>"IV", macro=>"1"},
44 {name=>"EDLIB_MODE_HW", type=>"IV", macro=>"1"},
45 {name=>"EDLIB_MODE_NW", type=>"IV", macro=>"1"},
46 {name=>"EDLIB_MODE_SHW", type=>"IV", macro=>"1"},
47 {name=>"EDLIB_TASK_DISTANCE", type=>"IV", macro=>"1"},
48 {name=>"EDLIB_TASK_LOC", type=>"IV", macro=>"1"},
49 {name=>"EDLIB_TASK_PATH", type=>"IV", macro=>"1"});
50
51 print constant_types(), "\n"; # macro defs
52 foreach (C_constant ("Text::Levenshtein::Edlib", 'constant', 'IV', $types, undef, 3, @names) ) {
53 print $_, "\n"; # C constant subs
54 }
55 print "\n#### XS Section:\n";
56 print XS_constant ("Text::Levenshtein::Edlib", $types);
57 __END__
58 */
59
60 switch (len) {
61 case 13:
62 /* Names all of length 13. */
63 /* EDLIB_MODE_HW EDLIB_MODE_NW */
64 /* Offset 11 gives the best switch position. */
65 switch (name[11]) {
66 case 'H':
67 if (memEQ(name, "EDLIB_MODE_HW", 13)) {
68 /* ^ */
69 *iv_return = EDLIB_MODE_HW;
70 return PERL_constant_ISIV;
71 }
72 break;
73 case 'N':
74 if (memEQ(name, "EDLIB_MODE_NW", 13)) {
75 /* ^ */
76 *iv_return = EDLIB_MODE_NW;
77 return PERL_constant_ISIV;
78 }
79 break;
80 }
81 break;
82 case 14:
83 /* Names all of length 14. */
84 /* EDLIB_MODE_SHW EDLIB_TASK_LOC */
85 /* Offset 9 gives the best switch position. */
86 switch (name[9]) {
87 case 'E':
88 if (memEQ(name, "EDLIB_MODE_SHW", 14)) {
89 /* ^ */
90 *iv_return = EDLIB_MODE_SHW;
91 return PERL_constant_ISIV;
92 }
93 break;
94 case 'K':
95 if (memEQ(name, "EDLIB_TASK_LOC", 14)) {
96 /* ^ */
97 *iv_return = EDLIB_TASK_LOC;
98 return PERL_constant_ISIV;
99 }
100 break;
101 }
102 break;
103 case 15:
104 /* Names all of length 15. */
105 /* EDLIB_STATUS_OK EDLIB_TASK_PATH */
106 /* Offset 6 gives the best switch position. */
107 switch (name[6]) {
108 case 'S':
109 if (memEQ(name, "EDLIB_STATUS_OK", 15)) {
110 /* ^ */
111 #ifdef EDLIB_STATUS_OK
112 *iv_return = EDLIB_STATUS_OK;
113 return PERL_constant_ISIV;
114 #else
115 return PERL_constant_NOTDEF;
116 #endif
117 }
118 break;
119 case 'T':
120 if (memEQ(name, "EDLIB_TASK_PATH", 15)) {
121 /* ^ */
122 *iv_return = EDLIB_TASK_PATH;
123 return PERL_constant_ISIV;
124 }
125 break;
126 }
127 break;
128 case 16:
129 if (memEQ(name, "EDLIB_EDOP_MATCH", 16)) {
130 #ifdef EDLIB_EDOP_MATCH
131 *iv_return = EDLIB_EDOP_MATCH;
132 return PERL_constant_ISIV;
133 #else
134 return PERL_constant_NOTDEF;
135 #endif
136 }
137 break;
138 case 17:
139 /* Names all of length 17. */
140 /* EDLIB_EDOP_DELETE EDLIB_EDOP_INSERT */
141 /* Offset 15 gives the best switch position. */
142 switch (name[15]) {
143 case 'R':
144 if (memEQ(name, "EDLIB_EDOP_INSERT", 17)) {
145 /* ^ */
146 #ifdef EDLIB_EDOP_INSERT
147 *iv_return = EDLIB_EDOP_INSERT;
148 return PERL_constant_ISIV;
149 #else
150 return PERL_constant_NOTDEF;
151 #endif
152 }
153 break;
154 case 'T':
155 if (memEQ(name, "EDLIB_EDOP_DELETE", 17)) {
156 /* ^ */
157 #ifdef EDLIB_EDOP_DELETE
158 *iv_return = EDLIB_EDOP_DELETE;
159 return PERL_constant_ISIV;
160 #else
161 return PERL_constant_NOTDEF;
162 #endif
163 }
164 break;
165 }
166 break;
167 case 18:
168 if (memEQ(name, "EDLIB_STATUS_ERROR", 18)) {
169 #ifdef EDLIB_STATUS_ERROR
170 *iv_return = EDLIB_STATUS_ERROR;
171 return PERL_constant_ISIV;
172 #else
173 return PERL_constant_NOTDEF;
174 #endif
175 }
176 break;
177 case 19:
178 /* Names all of length 19. */
179 /* EDLIB_EDOP_MISMATCH EDLIB_TASK_DISTANCE */
180 /* Offset 18 gives the best switch position. */
181 switch (name[18]) {
182 case 'E':
183 if (memEQ(name, "EDLIB_TASK_DISTANC", 18)) {
184 /* E */
185 *iv_return = EDLIB_TASK_DISTANCE;
186 return PERL_constant_ISIV;
187 }
188 break;
189 case 'H':
190 if (memEQ(name, "EDLIB_EDOP_MISMATC", 18)) {
191 /* H */
192 #ifdef EDLIB_EDOP_MISMATCH
193 *iv_return = EDLIB_EDOP_MISMATCH;
194 return PERL_constant_ISIV;
195 #else
196 return PERL_constant_NOTDEF;
197 #endif
198 }
199 break;
200 }
201 break;
202 case 20:
203 /* Names all of length 20. */
204 /* EDLIB_CIGAR_EXTENDED EDLIB_CIGAR_STANDARD */
205 /* Offset 17 gives the best switch position. */
206 switch (name[17]) {
207 case 'A':
208 if (memEQ(name, "EDLIB_CIGAR_STANDARD", 20)) {
209 /* ^ */
210 *iv_return = EDLIB_CIGAR_STANDARD;
211 return PERL_constant_ISIV;
212 }
213 break;
214 case 'D':
215 if (memEQ(name, "EDLIB_CIGAR_EXTENDED", 20)) {
216 /* ^ */
217 *iv_return = EDLIB_CIGAR_EXTENDED;
218 return PERL_constant_ISIV;
219 }
220 break;
221 }
222 break;
223 }
224 return PERL_constant_NOTFOUND;
225 }
226
This page took 0.026764 seconds and 4 git commands to generate.