Old.xs

filter: Statementstmt 0.0% 0 / 41 Branchbran 0.0% 0 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 57 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« Embperl.xs ↑ Summary Syntax.xs »
1  
2  
3  
4 MODULE = Embperl PACKAGE = Embperl PREFIX = embperl_
5  
6 PROTOTYPES: ENABLE
7  
8  
9  
10 # /* ---- Helper ----- */
11  
12  
13 #if defined (__GNUC__) && defined (__i386__)
14  
15 void
16 embperl_dbgbreak()
17 CODE:
18 __asm__ ("int $0x03\n") ;
19  
20 #endif
21  
22  
23  
24 double
25 Clock()
26 CODE:
27 #ifdef CLOCKS_PER_SEC
28 0 ▶ RETVAL = clock () * 1000 / CLOCKS_PER_SEC / 1000.0 ;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = clock () * 1000 / CLOCKS_PER_SEC / 1000.0 ; 0 0 0
29 #else
30 RETVAL = clock () ;
31 #endif
32 OUTPUT:
33 RETVAL
34  
35  
36  
37 void
38 embperl_logerror(code, sText, pApacheReqSV=NULL)
39 int code
40 char * sText
41 SV * pApacheReqSV
42 PREINIT:
43 0 tReq * r = CurrReq ;
44 0 ▶ int bRestore = 0 ;
Branch: 1 branch
BranchTrueFalseTotal
int bRestore = 0 ; 0 0 0
45 #ifdef APACHE
46 SV * pSaveApacheReqSV = NULL ;
47 request_rec * pSaveApacheReq = NULL ;
48 #endif
49 CODE:
50 #ifdef APACHE
51 if (pApacheReqSV && r -> pApacheReq == NULL)
52 {
53 bRestore = 1 ;
54 pSaveApacheReqSV = r -> pApacheReqSV ;
55 pSaveApacheReq = r -> pApacheReq ;
56 if (SvROK (pApacheReqSV))
57 r -> pApacheReq = (request_rec *)SvIV((SV*)SvRV(pApacheReqSV));
58 else
59 r -> pApacheReq = NULL ;
60 r -> pApacheReqSV = pApacheReqSV ;
61 }
62 #endif
63 0 ▶ if (r)
Branch: 1 branch
BranchTrueFalseTotal
if (r) 0 0 0
64 {
65 0 strncpy (r->errdat1, sText, sizeof (r->errdat1) - 1) ;
66 0 LogError (r,code) ;
67 }
68 else
69 0 LogErrorParam(NULL, code, sText, NULL) ;
70 #ifdef APACHE
71 if (bRestore)
72 {
73 r -> pApacheReqSV = pSaveApacheReqSV ;
74 r -> pApacheReq = pSaveApacheReq ;
75 }
76 #endif
77  
78  
79  
80 void
81 embperl_log(sText)
82 char * sText
83 INIT:
84 0 tReq * r = CurrReq ;
85 CODE:
86 0 ▶ if (r)
Branch: 1 branch
BranchTrueFalseTotal
if (r) 0 0 0
87 0 lwrite (r->pApp,sText, strlen (sText)) ;
88 else
89 0 PerlIO_puts(PerlIO_stderr(), sText) ;
90  
91  
92 void
93 embperl_output(sText)
94 SV * sText
95 INIT:
96 STRLEN l ;
97 0 tReq * r = CurrReq ;
98 CODE:
99 {
100 0 char * p = SvPV (sText, l) ;
101 0 r -> Component.bSubNotEmpty = 1 ;
102 0 ▶ r -> Component.xCurrNode = Node_insertAfter_CDATA (r->pApp, p, l, (SvUTF8(sText)?nflgEscUTF8:0) + ((r -> Component.nCurrEscMode & 3)== 3?1 + (r -> Component.nCurrEscMode & 4):r -> Component.nCurrEscMode), DomTree_self (r -> Component.xCurrDomTree), r -> Component.xCurrNode, r -> Component.nCurrRepeatLevel) ;
Branch: 1 branch
BranchTrueFalseTotal
r -> Component.xCurrNode = Node_insertAfter_CDATA (r->pApp, p, l, (SvUTF8(sText)?nflgEscUTF8:0) + ((r -> Component.nCurrEscMode & 3)== 3?1 + (r -> Component.nCurrEscMode & 4):r -> Component.nCurrEscMode), DomTree_self (r -> Component.xCurrDomTree), r -> Component.xCurrNode, r -> Component.nCurrRepeatLevel) ; 0 0 0
103 0 r -> Component.bEscModeSet = 0 ;
104 }
105  
106  
107 int
108 embperl_getlineno()
109 INIT:
110 0 tReq * r = CurrReq ;
111 CODE:
112 0 RETVAL = GetLineNo (r) ;
113 OUTPUT:
114 RETVAL
115  
116  
117 void
118 embperl_flushlog()
119 CODE:
120 0 FlushLog (CurrApp) ;
121  
122  
123 char *
124 embperl_Sourcefile()
125 INIT:
126 0 tReq * r = CurrReq ;
127 CODE:
128 0 ▶ RETVAL = r?r -> Component.sSourcefile:"" ;
Branch: 1 branch
BranchTrueFalseTotal
RETVAL = r?r -> Component.sSourcefile:"" ; 0 0 0
129 OUTPUT:
130 RETVAL
131  
132  
133  
134  
135 void
136 embperl_exit(...)
137 CODE:
138 /* from mod_perl's perl_util.c */
139 /* does not work with Perl >= 5.18
140 struct ufuncs umg;
141  
142 umg.uf_val = errgv_empty_set;
143 umg.uf_set = errgv_empty_set;
144 umg.uf_index = (IV)0;
145  
146 sv_magic(ERRSV, Nullsv, 'U', (char*) &umg, sizeof(umg));
147 */
148  
149 0 ENTER;
150 0 SAVESPTR(diehook);
151 0 diehook = Nullsv;
152 0 ▶ if (items > 0)
Branch: 1 branch
BranchTrueFalseTotal
if (items > 0) 0 0 0
153 0 croak(">embperl_exit< request %d", SvIV(ST(0)));
154 else
155 0 croak(">embperl_exit< component");
156 LEAVE; /* we don't get this far, but croak() will rewind */
157  
158 /* sv_unmagic(ERRSV, 'U'); */
159  
160  
161  
162 void
163 embperl_ClearSymtab(sPackage,bDebug)
164 char * sPackage
165 int bDebug
166 CODE:
167 0 ClearSymtab (CurrReq, sPackage, bDebug) ;
168  
169  
170 ################################################################################
171  
172 MODULE = Embperl PACKAGE = Embperl::Req PREFIX = embperl_
173  
174  
175 void
176 embperl_logerror(r,code, sText,pApacheReqSV=NULL)
177 tReq * r
178 int code
179 char * sText
180 SV * pApacheReqSV
181 PREINIT:
182 0 int bRestore = 0 ;
183 #ifdef APACHE
184 SV * pSaveApacheReqSV = NULL ;
185 request_rec * pSaveApacheReq = NULL ;
186 #endif
187 CODE:
188 #ifdef APACHE
189 if (pApacheReqSV && r -> pApacheReq == NULL)
190 {
191 bRestore = 1 ;
192 pSaveApacheReqSV = r -> pApacheReqSV ;
193 pSaveApacheReq = r -> pApacheReq ;
194 if (SvROK (pApacheReqSV))
195 r -> pApacheReq = (request_rec *)SvIV((SV*)SvRV(pApacheReqSV));
196 else
197 r -> pApacheReq = NULL ;
198 r -> pApacheReqSV = pApacheReqSV ;
199 }
200 #endif
201 0 ▶ if (r)
Branch: 1 branch
BranchTrueFalseTotal
if (r) 0 0 0
202 {
203 0 strncpy (r->errdat1, sText, sizeof (r->errdat1) - 1) ;
204 0 LogError (r,code) ;
205 }
206 else
207 0 LogErrorParam(NULL, code, sText, NULL) ;
208 #ifdef APACHE
209 if (bRestore)
210 {
211 r -> pApacheReqSV = pSaveApacheReqSV ;
212 r -> pApacheReq = pSaveApacheReq ;
213 }
214 #endif
215  
216  
217 void
218 embperl_output(r,sText)
219 tReq * r
220 char * sText
221 CODE:
222 0 r -> Component.bSubNotEmpty = 1 ;
223 0 OutputToHtml (r,sText) ;
224  
225  
226 void
227 embperl_log(r,sText)
228 tReq * r
229 char * sText
230 CODE:
231 0 lwrite (r->pApp, sText, strlen (sText)) ;
232  
233 void
234 embperl_flushlog(r)
235 tReq * r
236 CODE:
237 0 FlushLog (r->pApp) ;
238  
239  
240  
241 int
242 embperl_getlineno(r)
243 tReq * r
244 CODE:
245 0 RETVAL = GetLineNo (r) ;
246 OUTPUT:
247 RETVAL
248  
249  
250 void
251 log_svs(r,sText)
252 tReq * r
253 char * sText
254 CODE:
255 0 lprintf (r->pApp,"[%d]MEM: %s: SVs: %d\n", r->pThread->nPid, sText, sv_count) ;
256  
257 SV *
258 embperl_Escape(r, str, mode)
259 tReq * r
260 char * str = NO_INIT
261 int mode
262 PREINIT:
263 STRLEN len ;
264 CODE:
265 0 str = SvPV(ST(1),len) ;
266 0 RETVAL = Escape(r, str, len, mode, NULL, 0) ;
267 OUTPUT:
268 RETVAL
269  
270
271  
272  
273  
274 INCLUDE: Cmd.xs
275  
276 INCLUDE: DOM.xs
277  
278 INCLUDE: Syntax.xs
279  
280  
281  
282 # Reset Module, so we get the correct boot function
283  
284 MODULE = Embperl PACKAGE = Embperl PREFIX = embperl_
285  
286  
287  
288  
289  
« Embperl.xs ↑ Summary Syntax.xs »