Commit | Line | Data |
e3b8966e |
1 | |
2 | # creates a C API file from proto.h |
3 | # takes one argument, the path to lib/CORE directory. |
6de196ee |
4 | # creates 2 files: "perlCAPI.cpp" and "perlCAPI.h". |
e3b8966e |
5 | |
565e2fca |
6 | my $hdrfile = "$ARGV[0]/perlCAPI.h"; |
7 | my $infile = '../proto.h'; |
8 | my @embedsyms = ('../global.sym', '../pp.sym'); |
e3b8966e |
9 | my $separateObj = 0; |
10 | |
11 | my %skip_list; |
12 | my %embed; |
13 | |
565e2fca |
14 | sub readsyms(\%@) { |
15 | my ($syms, @files) = @_; |
e3b8966e |
16 | my ($line, @words); |
17 | %$syms = (); |
565e2fca |
18 | foreach my $file (@files) { |
19 | local (*FILE, $_); |
20 | open(FILE, "< $file") |
21 | or die "$0: Can't open $file: $!\n"; |
22 | while (<FILE>) { |
23 | s/[ \t]*#.*$//; # delete comments |
24 | if (/^\s*(\S+)\s*$/) { |
25 | my $sym = $1; |
26 | $$syms{$sym} = "Perl_$sym"; |
27 | } |
e3b8966e |
28 | } |
565e2fca |
29 | close(FILE); |
e3b8966e |
30 | } |
e3b8966e |
31 | } |
32 | |
565e2fca |
33 | readsyms %embed, @embedsyms; |
e3b8966e |
34 | |
35 | sub skip_these { |
36 | my $list = shift; |
37 | foreach my $symbol (@$list) { |
38 | $skip_list{$symbol} = 1; |
39 | } |
40 | } |
41 | |
42 | skip_these [qw( |
b86a2fa7 |
43 | yylex |
e3b8966e |
44 | cando |
45 | cast_ulong |
46 | my_chsize |
47 | condpair_magic |
48 | deb |
49 | deb_growlevel |
50 | debprofdump |
51 | debop |
52 | debstack |
53 | debstackptrs |
58a50f62 |
54 | dump_fds |
55 | dump_mstats |
e3b8966e |
56 | fprintf |
57 | find_threadsv |
58 | magic_mutexfree |
58a50f62 |
59 | my_memcmp |
60 | my_memset |
e3b8966e |
61 | my_pclose |
62 | my_popen |
63 | my_swap |
64 | my_htonl |
65 | my_ntohl |
66 | new_struct_thread |
67 | same_dirent |
68 | unlnk |
69 | unlock_condpair |
70 | safexmalloc |
71 | safexcalloc |
72 | safexrealloc |
73 | safexfree |
74 | Perl_GetVars |
066ef5b5 |
75 | malloced_size |
e3b8966e |
76 | )]; |
77 | |
78 | |
79 | |
80 | if (!open(INFILE, "<$infile")) { |
81 | print "open of $infile failed: $!\n"; |
82 | return 1; |
83 | } |
84 | |
6de196ee |
85 | if (!open(OUTFILE, ">perlCAPI.cpp")) { |
86 | print "open of perlCAPI.cpp failed: $!\n"; |
e3b8966e |
87 | return 1; |
88 | } |
89 | |
b207eff1 |
90 | print OUTFILE <<ENDCODE; |
91 | #include "EXTERN.h" |
92 | #include "perl.h" |
93 | #include "XSUB.h" |
94 | |
95 | #define DESTRUCTORFUNC (void (*)(void*)) |
96 | |
97 | ENDCODE |
98 | |
99 | print OUTFILE "#ifdef SetCPerlObj_defined\n" unless ($separateObj == 0); |
100 | |
101 | print OUTFILE <<ENDCODE; |
102 | extern "C" void SetCPerlObj(CPerlObj* pP) |
103 | { |
104 | pPerl = pP; |
105 | } |
106 | |
107 | ENDCODE |
108 | |
e3b8966e |
109 | print OUTFILE "#endif\n" unless ($separateObj == 0); |
110 | |
111 | while () { |
112 | last unless defined ($_ = <INFILE>); |
113 | if (/^VIRTUAL\s/) { |
114 | while (!/;$/) { |
115 | chomp; |
116 | $_ .= <INFILE>; |
117 | } |
118 | $_ =~ s/^VIRTUAL\s*//; |
119 | $_ =~ s/\s*__attribute__.*$/;/; |
120 | if ( /(.*)\s([A-z_]*[0-9A-z_]+\s)_\(\((.*)\)\);/ || |
121 | /(.*)\*([A-z_]*[0-9A-z_]+\s)_\(\((.*)\)\);/ ) { |
122 | $type = $1; |
123 | $name = $2; |
124 | $args = $3; |
125 | |
126 | $name =~ s/\s*$//; |
127 | $type =~ s/\s*$//; |
128 | next if (defined $skip_list{$name}); |
129 | |
130 | if($args eq "ARGSproto") { |
131 | $args = "void"; |
132 | } |
133 | |
134 | $return = ($type eq "void" or $type eq "Free_t") ? "\t" : "\treturn"; |
135 | |
136 | if(defined $embed{$name}) { |
137 | $funcName = $embed{$name}; |
138 | } else { |
139 | $funcName = $name; |
140 | } |
141 | |
142 | @args = split(',', $args); |
143 | if ($args[$#args] =~ /\s*\.\.\.\s*/) { |
144 | if(($name eq "croak") or ($name eq "deb") or ($name eq "die") |
dfe13c55 |
145 | or ($name eq "form") or ($name eq "warn") |
146 | or ($name eq "warner")) { |
e3b8966e |
147 | print OUTFILE "\n#ifdef $name" . "_defined" unless ($separateObj == 0); |
dfe13c55 |
148 | for (@args) { $_ = $1 if /(\w+)\W*$/; } |
149 | $arg = $args[$#args-1]; |
150 | my $start = ''; |
151 | $start = join(', ',@args[0 .. ($#args - 2)]) if @args > 2; |
152 | $start .= ', ' if $start; |
b207eff1 |
153 | print OUTFILE <<ENDCODE; |
154 | |
155 | #undef $name |
156 | extern "C" $type $funcName ($args) |
157 | { |
158 | char *pstr; |
159 | char *pmsg; |
160 | va_list args; |
161 | va_start(args, $arg); |
162 | pmsg = pPerl->Perl_mess($arg, &args); |
163 | New(0, pstr, strlen(pmsg)+1, char); |
164 | strcpy(pstr, pmsg); |
dfe13c55 |
165 | $return pPerl->Perl_$name($start pstr); |
b207eff1 |
166 | va_end(args); |
167 | } |
168 | ENDCODE |
e3b8966e |
169 | print OUTFILE "#endif\n" unless ($separateObj == 0); |
170 | } |
171 | elsif($name eq "newSVpvf") { |
172 | print OUTFILE "\n#ifdef $name" . "_defined" unless ($separateObj == 0); |
e3b8966e |
173 | $args[0] =~ /(\w+)\W*$/; |
174 | $arg = $1; |
b207eff1 |
175 | print OUTFILE <<ENDCODE; |
176 | |
177 | #undef $name |
178 | extern "C" $type $funcName ($args) |
179 | { |
180 | SV *sv; |
181 | va_list args; |
182 | va_start(args, $arg); |
183 | sv = pPerl->Perl_newSV(0); |
184 | pPerl->Perl_sv_vcatpvfn(sv, $arg, strlen($arg), &args, NULL, 0, NULL); |
185 | va_end(args); |
186 | return sv; |
187 | } |
188 | ENDCODE |
e3b8966e |
189 | print OUTFILE "#endif\n" unless ($separateObj == 0); |
190 | } |
191 | elsif($name eq "sv_catpvf") { |
192 | print OUTFILE "\n#ifdef $name" . "_defined" unless ($separateObj == 0); |
e3b8966e |
193 | $args[0] =~ /(\w+)\W*$/; |
194 | $arg0 = $1; |
195 | $args[1] =~ /(\w+)\W*$/; |
196 | $arg1 = $1; |
b207eff1 |
197 | print OUTFILE <<ENDCODE; |
198 | |
199 | #undef $name |
200 | extern "C" $type $funcName ($args) |
201 | { |
202 | va_list args; |
203 | va_start(args, $arg1); |
204 | pPerl->Perl_sv_vcatpvfn($arg0, $arg1, strlen($arg1), &args, NULL, 0, NULL); |
205 | va_end(args); |
206 | } |
207 | ENDCODE |
e3b8966e |
208 | print OUTFILE "#endif\n" unless ($separateObj == 0); |
209 | } |
6a27c188 |
210 | elsif($name eq "sv_catpvf_mg") { |
211 | print OUTFILE "\n#ifdef $name" . "_defined" unless ($separateObj == 0); |
212 | $args[0] =~ /(\w+)\W*$/; |
213 | $arg0 = $1; |
214 | $args[1] =~ /(\w+)\W*$/; |
215 | $arg1 = $1; |
216 | print OUTFILE <<ENDCODE; |
217 | |
218 | #undef $name |
219 | #ifndef mg_set |
220 | #define mg_set pPerl->Perl_mg_set |
221 | #endif |
222 | extern "C" $type $funcName ($args) |
223 | { |
224 | va_list args; |
225 | va_start(args, $arg1); |
226 | pPerl->Perl_sv_vcatpvfn($arg0, $arg1, strlen($arg1), &args, NULL, 0, NULL); |
227 | va_end(args); |
228 | SvSETMAGIC(sv); |
229 | } |
230 | ENDCODE |
231 | print OUTFILE "#endif\n" unless ($separateObj == 0); |
232 | } |
e3b8966e |
233 | elsif($name eq "sv_setpvf") { |
234 | print OUTFILE "\n#ifdef $name" . "_defined" unless ($separateObj == 0); |
e3b8966e |
235 | $args[0] =~ /(\w+)\W*$/; |
236 | $arg0 = $1; |
237 | $args[1] =~ /(\w+)\W*$/; |
238 | $arg1 = $1; |
b207eff1 |
239 | print OUTFILE <<ENDCODE; |
240 | |
241 | #undef $name |
242 | extern "C" $type $funcName ($args) |
243 | { |
244 | va_list args; |
245 | va_start(args, $arg1); |
246 | pPerl->Perl_sv_vsetpvfn($arg0, $arg1, strlen($arg1), &args, NULL, 0, NULL); |
247 | va_end(args); |
248 | } |
249 | ENDCODE |
e3b8966e |
250 | print OUTFILE "#endif\n" unless ($separateObj == 0); |
251 | } |
6a27c188 |
252 | elsif($name eq "sv_setpvf_mg") { |
253 | print OUTFILE "\n#ifdef $name" . "_defined" unless ($separateObj == 0); |
254 | $args[0] =~ /(\w+)\W*$/; |
255 | $arg0 = $1; |
256 | $args[1] =~ /(\w+)\W*$/; |
257 | $arg1 = $1; |
258 | print OUTFILE <<ENDCODE; |
259 | |
260 | #undef $name |
261 | #ifndef mg_set |
262 | #define mg_set pPerl->Perl_mg_set |
263 | #endif |
264 | extern "C" $type $funcName ($args) |
265 | { |
266 | va_list args; |
267 | va_start(args, $arg1); |
268 | pPerl->Perl_sv_vsetpvfn($arg0, $arg1, strlen($arg1), &args, NULL, 0, NULL); |
269 | va_end(args); |
270 | SvSETMAGIC(sv); |
271 | } |
272 | ENDCODE |
273 | print OUTFILE "#endif\n" unless ($separateObj == 0); |
274 | } |
e3b8966e |
275 | elsif($name eq "fprintf") { |
276 | print OUTFILE "\n#ifdef $name" . "_defined" unless ($separateObj == 0); |
e3b8966e |
277 | $args[0] =~ /(\w+)\W*$/; |
278 | $arg0 = $1; |
279 | $args[1] =~ /(\w+)\W*$/; |
280 | $arg1 = $1; |
b207eff1 |
281 | print OUTFILE <<ENDCODE; |
282 | |
283 | #undef $name |
284 | extern "C" $type $name ($args) |
285 | { |
286 | int nRet; |
287 | va_list args; |
288 | va_start(args, $arg1); |
289 | nRet = PerlIO_vprintf($arg0, $arg1, args); |
290 | va_end(args); |
291 | return nRet; |
292 | } |
293 | ENDCODE |
e3b8966e |
294 | print OUTFILE "#endif\n" unless ($separateObj == 0); |
295 | } else { |
296 | print "Warning: can't handle varargs function '$name'\n"; |
297 | } |
298 | next; |
299 | } |
300 | |
301 | # newXS special case |
302 | if ($name eq "newXS") { |
303 | next; |
304 | } |
305 | |
306 | print OUTFILE "\n#ifdef $name" . "defined" unless ($separateObj == 0); |
307 | |
308 | # handle specical case for save_destructor |
309 | if ($name eq "save_destructor") { |
310 | next; |
311 | } |
312 | # handle specical case for sighandler |
313 | if ($name eq "sighandler") { |
314 | next; |
315 | } |
316 | # handle special case for sv_grow |
317 | if ($name eq "sv_grow" and $args eq "SV* sv, unsigned long newlen") { |
318 | next; |
319 | } |
320 | # handle special case for newSV |
321 | if ($name eq "newSV" and $args eq "I32 x, STRLEN len") { |
322 | next; |
323 | } |
324 | # handle special case for perl_parse |
325 | if ($name eq "perl_parse") { |
b207eff1 |
326 | print OUTFILE <<ENDCODE; |
327 | |
328 | #undef $name |
329 | extern "C" $type $name ($args) |
330 | { |
331 | return pPerl->perl_parse(xsinit, argc, argv, env); |
332 | } |
333 | ENDCODE |
e3b8966e |
334 | print OUTFILE "#endif\n" unless ($separateObj == 0); |
335 | next; |
336 | } |
35ff7856 |
337 | # handle special case for perl_atexit |
338 | if ($name eq "perl_atexit") { |
339 | print OUTFILE <<ENDCODE; |
340 | |
341 | #undef $name |
342 | extern "C" $type $name ($args) |
343 | { |
58a50f62 |
344 | pPerl->perl_atexit(fn, ptr); |
35ff7856 |
345 | } |
346 | ENDCODE |
347 | print OUTFILE "#endif\n" unless ($separateObj == 0); |
348 | next; |
349 | } |
350 | |
e3b8966e |
351 | |
9e6b2b00 |
352 | if($name eq "byterun" and $args eq "struct bytestream bs") { |
353 | next; |
354 | } |
355 | |
e3b8966e |
356 | # foo(void); |
357 | if ($args eq "void") { |
b207eff1 |
358 | print OUTFILE <<ENDCODE; |
359 | |
360 | #undef $name |
361 | extern "C" $type $funcName () |
362 | { |
363 | $return pPerl->$funcName(); |
364 | } |
365 | |
366 | ENDCODE |
e3b8966e |
367 | print OUTFILE "#endif\n" unless ($separateObj == 0); |
368 | next; |
369 | } |
370 | |
371 | # foo(char *s, const int bar); |
b207eff1 |
372 | print OUTFILE <<ENDCODE; |
373 | |
374 | #undef $name |
375 | extern "C" $type $funcName ($args) |
376 | { |
b207eff1 |
377 | ENDCODE |
35ff7856 |
378 | print OUTFILE "$return pPerl->$funcName"; |
e3b8966e |
379 | $doneone = 0; |
380 | foreach $arg (@args) { |
381 | if ($arg =~ /(\w+)\W*$/) { |
382 | if ($doneone) { |
383 | print OUTFILE ", $1"; |
384 | } |
385 | else { |
386 | print OUTFILE "($1"; |
387 | $doneone++; |
388 | } |
389 | } |
390 | } |
391 | print OUTFILE ");\n}\n"; |
392 | print OUTFILE "#endif\n" unless ($separateObj == 0); |
393 | } |
394 | else { |
395 | print "failed to match $_"; |
396 | } |
397 | } |
398 | } |
399 | |
400 | close INFILE; |
401 | |
402 | %skip_list = (); |
403 | |
404 | skip_these [qw( |
405 | strchop |
406 | filemode |
407 | lastfd |
408 | oldname |
409 | curinterp |
410 | Argv |
411 | Cmd |
412 | sortcop |
413 | sortstash |
414 | firstgv |
415 | secondgv |
416 | sortstack |
417 | signalstack |
418 | mystrk |
e3b8966e |
419 | oldlastpm |
420 | gensym |
421 | preambled |
422 | preambleav |
423 | Ilaststatval |
424 | Ilaststype |
425 | mess_sv |
426 | ors |
427 | opsave |
428 | eval_mutex |
942e002e |
429 | strtab_mutex |
e3b8966e |
430 | orslen |
431 | ofmt |
e3b8966e |
432 | modcount |
433 | generation |
434 | DBcv |
435 | archpat_auto |
436 | sortcxix |
437 | lastgotoprobe |
438 | regdummy |
77d41b28 |
439 | regcomp_parse |
e3b8966e |
440 | regxend |
441 | regcode |
442 | regnaughty |
443 | regsawback |
444 | regprecomp |
445 | regnpar |
446 | regsize |
447 | regflags |
448 | regseen |
449 | seen_zerolen |
77d41b28 |
450 | regcomp_rx |
e3b8966e |
451 | extralen |
452 | colorset |
453 | colors |
454 | reginput |
455 | regbol |
456 | regeol |
457 | regstartp |
458 | regendp |
459 | reglastparen |
460 | regtill |
461 | regprev |
462 | reg_start_tmp |
463 | reg_start_tmpl |
464 | regdata |
465 | bostr |
466 | reg_flags |
467 | reg_eval_set |
468 | regnarrate |
469 | regprogram |
470 | regindent |
471 | regcc |
472 | in_clean_objs |
473 | in_clean_all |
474 | linestart |
475 | pending_ident |
476 | statusvalue_vms |
477 | sublex_info |
478 | thrsv |
479 | threadnum |
4c2891ed |
480 | PL_piMem |
481 | PL_piENV |
482 | PL_piStdIO |
483 | PL_piLIO |
484 | PL_piDir |
485 | PL_piSock |
486 | PL_piProc |
e3b8966e |
487 | cshname |
488 | threadsv_names |
489 | thread |
490 | nthreads |
491 | thr_key |
492 | threads_mutex |
493 | malloc_mutex |
494 | svref_mutex |
495 | sv_mutex |
5ff3f7a4 |
496 | cred_mutex |
e3b8966e |
497 | nthreads_cond |
498 | eval_cond |
499 | cryptseen |
500 | cshlen |
3967c732 |
501 | watchaddr |
502 | watchok |
e3b8966e |
503 | )]; |
504 | |
505 | sub readvars(\%$$) { |
506 | my ($syms, $file, $pre) = @_; |
507 | %$syms = (); |
508 | local (*FILE, $_); |
509 | open(FILE, "< $file") |
510 | or die "$0: Can't open $file: $!\n"; |
511 | while (<FILE>) { |
512 | s/[ \t]*#.*//; # Delete comments. |
513 | if (/PERLVARI?C?\($pre(\w+),\s*([^,)]+)/) { |
514 | $$syms{$1} = $2; |
515 | } |
516 | } |
517 | close(FILE); |
518 | } |
519 | |
520 | my %intrp; |
521 | my %thread; |
522 | my %globvar; |
523 | |
524 | readvars %intrp, '..\intrpvar.h','I'; |
525 | readvars %thread, '..\thrdvar.h','T'; |
526 | readvars %globvar, '..\perlvars.h','G'; |
527 | |
528 | open(HDRFILE, ">$hdrfile") or die "$0: Can't open $hdrfile: $!\n"; |
b207eff1 |
529 | print HDRFILE <<ENDCODE; |
530 | void SetCPerlObj(void* pP); |
531 | CV* Perl_newXS(char* name, void (*subaddr)(CV* cv), char* filename); |
532 | |
533 | ENDCODE |
e3b8966e |
534 | |
535 | sub DoVariable($$) { |
536 | my $name = shift; |
537 | my $type = shift; |
538 | |
539 | return if (defined $skip_list{$name}); |
540 | return if ($type eq 'struct perl_thread *'); |
541 | |
542 | print OUTFILE "\n#ifdef $name" . "_defined" unless ($separateObj == 0); |
b207eff1 |
543 | print OUTFILE <<ENDCODE; |
4c2891ed |
544 | #undef PL_$name |
545 | extern "C" $type * _PL_$name () |
b207eff1 |
546 | { |
4c2891ed |
547 | return (($type *)&pPerl->PL_$name); |
b207eff1 |
548 | } |
549 | |
550 | ENDCODE |
551 | |
e3b8966e |
552 | print OUTFILE "#endif\n" unless ($separateObj == 0); |
553 | |
b207eff1 |
554 | print HDRFILE <<ENDCODE; |
555 | |
4c2891ed |
556 | #undef PL_$name |
557 | $type * _PL_$name (); |
558 | #define PL_$name (*_PL_$name()) |
b207eff1 |
559 | |
560 | ENDCODE |
561 | |
e3b8966e |
562 | } |
563 | |
564 | foreach $key (keys %intrp) { |
565 | DoVariable ($key, $intrp{$key}); |
566 | } |
567 | |
568 | foreach $key (keys %thread) { |
569 | DoVariable ($key, $thread{$key}); |
570 | } |
571 | |
572 | foreach $key (keys %globvar) { |
573 | DoVariable ($key, $globvar{$key}); |
574 | } |
575 | |
576 | print OUTFILE <<EOCODE; |
577 | |
578 | |
579 | extern "C" { |
9e6b2b00 |
580 | |
581 | |
582 | char ** _Perl_op_desc(void) |
583 | { |
584 | return pPerl->Perl_get_op_descs(); |
585 | } |
586 | |
587 | char ** _Perl_op_name(void) |
588 | { |
589 | return pPerl->Perl_get_op_names(); |
590 | } |
591 | |
592 | char * _Perl_no_modify(void) |
593 | { |
594 | return pPerl->Perl_get_no_modify(); |
595 | } |
596 | |
597 | U32 * _Perl_opargs(void) |
598 | { |
599 | return pPerl->Perl_get_opargs(); |
600 | } |
601 | |
b207eff1 |
602 | void xs_handler(CV* cv, CPerlObj* p) |
e3b8966e |
603 | { |
604 | void(*func)(CV*); |
605 | SV* sv; |
606 | MAGIC* m = pPerl->Perl_mg_find((SV*)cv, '~'); |
607 | if(m != NULL) |
608 | { |
609 | sv = m->mg_obj; |
610 | if(SvIOK(sv)) |
611 | { |
612 | func = (void(*)(CV*))SvIVX(sv); |
613 | } |
614 | else |
615 | { |
616 | func = (void(*)(CV*))pPerl->Perl_sv_2iv(sv); |
617 | } |
e3b8966e |
618 | func(cv); |
619 | } |
620 | } |
621 | |
622 | CV* Perl_newXS(char* name, void (*subaddr)(CV* cv), char* filename) |
623 | { |
624 | CV* cv = pPerl->Perl_newXS(name, xs_handler, filename); |
625 | pPerl->Perl_sv_magic((SV*)cv, pPerl->Perl_sv_2mortal(pPerl->Perl_newSViv((IV)subaddr)), '~', "CAPI", 4); |
626 | return cv; |
627 | } |
628 | |
b207eff1 |
629 | |
630 | void Perl_deb(const char pat, ...) |
631 | { |
632 | } |
633 | |
4c2891ed |
634 | #undef PL_piMem |
635 | #undef PL_piENV |
636 | #undef PL_piStdIO |
637 | #undef PL_piLIO |
638 | #undef PL_piDir |
639 | #undef PL_piSock |
640 | #undef PL_piProc |
e3b8966e |
641 | |
642 | int * _win32_errno(void) |
643 | { |
644 | return &pPerl->ErrorNo(); |
645 | } |
646 | |
647 | FILE* _win32_stdin(void) |
648 | { |
4c2891ed |
649 | return (FILE*)pPerl->PL_piStdIO->Stdin(); |
e3b8966e |
650 | } |
651 | |
652 | FILE* _win32_stdout(void) |
653 | { |
4c2891ed |
654 | return (FILE*)pPerl->PL_piStdIO->Stdout(); |
e3b8966e |
655 | } |
656 | |
657 | FILE* _win32_stderr(void) |
658 | { |
4c2891ed |
659 | return (FILE*)pPerl->PL_piStdIO->Stderr(); |
e3b8966e |
660 | } |
661 | |
662 | int _win32_ferror(FILE *fp) |
663 | { |
4c2891ed |
664 | return pPerl->PL_piStdIO->Error((PerlIO*)fp, ErrorNo()); |
e3b8966e |
665 | } |
666 | |
667 | int _win32_feof(FILE *fp) |
668 | { |
4c2891ed |
669 | return pPerl->PL_piStdIO->Eof((PerlIO*)fp, ErrorNo()); |
e3b8966e |
670 | } |
671 | |
672 | char* _win32_strerror(int e) |
673 | { |
674 | return strerror(e); |
675 | } |
676 | |
677 | void _win32_perror(const char *str) |
678 | { |
679 | perror(str); |
680 | } |
681 | |
682 | int _win32_vfprintf(FILE *pf, const char *format, va_list arg) |
683 | { |
4c2891ed |
684 | return pPerl->PL_piStdIO->Vprintf((PerlIO*)pf, ErrorNo(), format, arg); |
e3b8966e |
685 | } |
686 | |
687 | int _win32_vprintf(const char *format, va_list arg) |
688 | { |
4c2891ed |
689 | return pPerl->PL_piStdIO->Vprintf(pPerl->PL_piStdIO->Stdout(), ErrorNo(), format, arg); |
e3b8966e |
690 | } |
691 | |
692 | int _win32_fprintf(FILE *pf, const char *format, ...) |
693 | { |
694 | int ret; |
695 | va_list args; |
696 | va_start(args, format); |
697 | ret = _win32_vfprintf(pf, format, args); |
698 | va_end(args); |
699 | return ret; |
700 | } |
701 | |
702 | int _win32_printf(const char *format, ...) |
703 | { |
704 | int ret; |
705 | va_list args; |
706 | va_start(args, format); |
707 | ret = _win32_vprintf(format, args); |
708 | va_end(args); |
709 | return ret; |
710 | } |
711 | |
712 | size_t _win32_fread(void *buf, size_t size, size_t count, FILE *pf) |
713 | { |
4c2891ed |
714 | return pPerl->PL_piStdIO->Read((PerlIO*)pf, buf, (size*count), ErrorNo()); |
e3b8966e |
715 | } |
716 | |
717 | size_t _win32_fwrite(const void *buf, size_t size, size_t count, FILE *pf) |
718 | { |
4c2891ed |
719 | return pPerl->PL_piStdIO->Write((PerlIO*)pf, buf, (size*count), ErrorNo()); |
e3b8966e |
720 | } |
721 | |
722 | FILE* _win32_fopen(const char *path, const char *mode) |
723 | { |
4c2891ed |
724 | return (FILE*)pPerl->PL_piStdIO->Open(path, mode, ErrorNo()); |
e3b8966e |
725 | } |
726 | |
727 | FILE* _win32_fdopen(int fh, const char *mode) |
728 | { |
4c2891ed |
729 | return (FILE*)pPerl->PL_piStdIO->Fdopen(fh, mode, ErrorNo()); |
e3b8966e |
730 | } |
731 | |
732 | FILE* _win32_freopen(const char *path, const char *mode, FILE *pf) |
733 | { |
4c2891ed |
734 | return (FILE*)pPerl->PL_piStdIO->Reopen(path, mode, (PerlIO*)pf, ErrorNo()); |
e3b8966e |
735 | } |
736 | |
737 | int _win32_fclose(FILE *pf) |
738 | { |
4c2891ed |
739 | return pPerl->PL_piStdIO->Close((PerlIO*)pf, ErrorNo()); |
e3b8966e |
740 | } |
741 | |
742 | int _win32_fputs(const char *s,FILE *pf) |
743 | { |
4c2891ed |
744 | return pPerl->PL_piStdIO->Puts((PerlIO*)pf, s, ErrorNo()); |
e3b8966e |
745 | } |
746 | |
747 | int _win32_fputc(int c,FILE *pf) |
748 | { |
4c2891ed |
749 | return pPerl->PL_piStdIO->Putc((PerlIO*)pf, c, ErrorNo()); |
e3b8966e |
750 | } |
751 | |
752 | int _win32_ungetc(int c,FILE *pf) |
753 | { |
4c2891ed |
754 | return pPerl->PL_piStdIO->Ungetc((PerlIO*)pf, c, ErrorNo()); |
e3b8966e |
755 | } |
756 | |
757 | int _win32_getc(FILE *pf) |
758 | { |
4c2891ed |
759 | return pPerl->PL_piStdIO->Getc((PerlIO*)pf, ErrorNo()); |
e3b8966e |
760 | } |
761 | |
762 | int _win32_fileno(FILE *pf) |
763 | { |
4c2891ed |
764 | return pPerl->PL_piStdIO->Fileno((PerlIO*)pf, ErrorNo()); |
e3b8966e |
765 | } |
766 | |
767 | void _win32_clearerr(FILE *pf) |
768 | { |
4c2891ed |
769 | pPerl->PL_piStdIO->Clearerr((PerlIO*)pf, ErrorNo()); |
e3b8966e |
770 | } |
771 | |
772 | int _win32_fflush(FILE *pf) |
773 | { |
4c2891ed |
774 | return pPerl->PL_piStdIO->Flush((PerlIO*)pf, ErrorNo()); |
e3b8966e |
775 | } |
776 | |
777 | long _win32_ftell(FILE *pf) |
778 | { |
4c2891ed |
779 | return pPerl->PL_piStdIO->Tell((PerlIO*)pf, ErrorNo()); |
e3b8966e |
780 | } |
781 | |
782 | int _win32_fseek(FILE *pf,long offset,int origin) |
783 | { |
4c2891ed |
784 | return pPerl->PL_piStdIO->Seek((PerlIO*)pf, offset, origin, ErrorNo()); |
e3b8966e |
785 | } |
786 | |
787 | int _win32_fgetpos(FILE *pf,fpos_t *p) |
788 | { |
4c2891ed |
789 | return pPerl->PL_piStdIO->Getpos((PerlIO*)pf, p, ErrorNo()); |
e3b8966e |
790 | } |
791 | |
792 | int _win32_fsetpos(FILE *pf,const fpos_t *p) |
793 | { |
4c2891ed |
794 | return pPerl->PL_piStdIO->Setpos((PerlIO*)pf, p, ErrorNo()); |
e3b8966e |
795 | } |
796 | |
797 | void _win32_rewind(FILE *pf) |
798 | { |
4c2891ed |
799 | pPerl->PL_piStdIO->Rewind((PerlIO*)pf, ErrorNo()); |
e3b8966e |
800 | } |
801 | |
802 | FILE* _win32_tmpfile(void) |
803 | { |
4c2891ed |
804 | return (FILE*)pPerl->PL_piStdIO->Tmpfile(ErrorNo()); |
e3b8966e |
805 | } |
806 | |
807 | void _win32_setbuf(FILE *pf, char *buf) |
808 | { |
4c2891ed |
809 | pPerl->PL_piStdIO->SetBuf((PerlIO*)pf, buf, ErrorNo()); |
e3b8966e |
810 | } |
811 | |
812 | int _win32_setvbuf(FILE *pf, char *buf, int type, size_t size) |
813 | { |
4c2891ed |
814 | return pPerl->PL_piStdIO->SetVBuf((PerlIO*)pf, buf, type, size, ErrorNo()); |
e3b8966e |
815 | } |
816 | |
9e6b2b00 |
817 | char* _win32_fgets(char *s, int n, FILE *pf) |
818 | { |
4c2891ed |
819 | return pPerl->PL_piStdIO->Gets((PerlIO*)pf, s, n, ErrorNo()); |
9e6b2b00 |
820 | } |
821 | |
822 | char* _win32_gets(char *s) |
823 | { |
4c2891ed |
824 | return _win32_fgets(s, 80, (FILE*)pPerl->PL_piStdIO->Stdin()); |
9e6b2b00 |
825 | } |
826 | |
e3b8966e |
827 | int _win32_fgetc(FILE *pf) |
828 | { |
4c2891ed |
829 | return pPerl->PL_piStdIO->Getc((PerlIO*)pf, ErrorNo()); |
e3b8966e |
830 | } |
831 | |
832 | int _win32_putc(int c, FILE *pf) |
833 | { |
4c2891ed |
834 | return pPerl->PL_piStdIO->Putc((PerlIO*)pf, c, ErrorNo()); |
e3b8966e |
835 | } |
836 | |
837 | int _win32_puts(const char *s) |
838 | { |
4c2891ed |
839 | return pPerl->PL_piStdIO->Puts(pPerl->PL_piStdIO->Stdout(), s, ErrorNo()); |
e3b8966e |
840 | } |
841 | |
842 | int _win32_getchar(void) |
843 | { |
4c2891ed |
844 | return pPerl->PL_piStdIO->Getc(pPerl->PL_piStdIO->Stdin(), ErrorNo()); |
e3b8966e |
845 | } |
846 | |
847 | int _win32_putchar(int c) |
848 | { |
4c2891ed |
849 | return pPerl->PL_piStdIO->Putc(pPerl->PL_piStdIO->Stdout(), c, ErrorNo()); |
e3b8966e |
850 | } |
851 | |
852 | void* _win32_malloc(size_t size) |
853 | { |
4c2891ed |
854 | return pPerl->PL_piMem->Malloc(size); |
e3b8966e |
855 | } |
856 | |
857 | void* _win32_calloc(size_t numitems, size_t size) |
858 | { |
4c2891ed |
859 | return pPerl->PL_piMem->Malloc(numitems*size); |
e3b8966e |
860 | } |
861 | |
862 | void* _win32_realloc(void *block, size_t size) |
863 | { |
4c2891ed |
864 | return pPerl->PL_piMem->Realloc(block, size); |
e3b8966e |
865 | } |
866 | |
867 | void _win32_free(void *block) |
868 | { |
4c2891ed |
869 | pPerl->PL_piMem->Free(block); |
e3b8966e |
870 | } |
871 | |
872 | void _win32_abort(void) |
873 | { |
4c2891ed |
874 | pPerl->PL_piProc->Abort(); |
e3b8966e |
875 | } |
876 | |
877 | int _win32_pipe(int *phandles, unsigned int psize, int textmode) |
878 | { |
4c2891ed |
879 | return pPerl->PL_piProc->Pipe(phandles); |
e3b8966e |
880 | } |
881 | |
882 | FILE* _win32_popen(const char *command, const char *mode) |
883 | { |
4c2891ed |
884 | return (FILE*)pPerl->PL_piProc->Popen(command, mode); |
e3b8966e |
885 | } |
886 | |
887 | int _win32_pclose(FILE *pf) |
888 | { |
4c2891ed |
889 | return pPerl->PL_piProc->Pclose((PerlIO*)pf); |
e3b8966e |
890 | } |
891 | |
892 | unsigned _win32_sleep(unsigned int t) |
893 | { |
4c2891ed |
894 | return pPerl->PL_piProc->Sleep(t); |
e3b8966e |
895 | } |
896 | |
897 | int _win32_spawnvp(int mode, const char *cmdname, const char *const *argv) |
898 | { |
4c2891ed |
899 | return pPerl->PL_piProc->Spawnvp(mode, cmdname, argv); |
e3b8966e |
900 | } |
901 | |
902 | int _win32_mkdir(const char *dir, int mode) |
903 | { |
4c2891ed |
904 | return pPerl->PL_piDir->Makedir(dir, mode, ErrorNo()); |
e3b8966e |
905 | } |
906 | |
907 | int _win32_rmdir(const char *dir) |
908 | { |
4c2891ed |
909 | return pPerl->PL_piDir->Rmdir(dir, ErrorNo()); |
e3b8966e |
910 | } |
911 | |
912 | int _win32_chdir(const char *dir) |
913 | { |
4c2891ed |
914 | return pPerl->PL_piDir->Chdir(dir, ErrorNo()); |
e3b8966e |
915 | } |
916 | |
917 | #undef stat |
918 | int _win32_fstat(int fd,struct stat *sbufptr) |
919 | { |
4c2891ed |
920 | return pPerl->PL_piLIO->FileStat(fd, sbufptr, ErrorNo()); |
e3b8966e |
921 | } |
922 | |
923 | int _win32_stat(const char *name,struct stat *sbufptr) |
924 | { |
4c2891ed |
925 | return pPerl->PL_piLIO->NameStat(name, sbufptr, ErrorNo()); |
e3b8966e |
926 | } |
927 | |
8d9b2e3c |
928 | int _win32_rename(const char *oname, const char *newname) |
e24c7c18 |
929 | { |
4c2891ed |
930 | return pPerl->PL_piLIO->Rename(oname, newname, ErrorNo()); |
e24c7c18 |
931 | } |
932 | |
e3b8966e |
933 | int _win32_setmode(int fd, int mode) |
934 | { |
4c2891ed |
935 | return pPerl->PL_piLIO->Setmode(fd, mode, ErrorNo()); |
e3b8966e |
936 | } |
937 | |
938 | long _win32_lseek(int fd, long offset, int origin) |
939 | { |
4c2891ed |
940 | return pPerl->PL_piLIO->Lseek(fd, offset, origin, ErrorNo()); |
e3b8966e |
941 | } |
942 | |
943 | long _win32_tell(int fd) |
944 | { |
4c2891ed |
945 | return pPerl->PL_piStdIO->Tell((PerlIO*)fd, ErrorNo()); |
e3b8966e |
946 | } |
947 | |
948 | int _win32_dup(int fd) |
949 | { |
4c2891ed |
950 | return pPerl->PL_piLIO->Dup(fd, ErrorNo()); |
e3b8966e |
951 | } |
952 | |
953 | int _win32_dup2(int h1, int h2) |
954 | { |
4c2891ed |
955 | return pPerl->PL_piLIO->Dup2(h1, h2, ErrorNo()); |
e3b8966e |
956 | } |
957 | |
958 | int _win32_open(const char *path, int oflag,...) |
959 | { |
4c2891ed |
960 | return pPerl->PL_piLIO->Open(path, oflag, ErrorNo()); |
e3b8966e |
961 | } |
962 | |
963 | int _win32_close(int fd) |
964 | { |
4c2891ed |
965 | return pPerl->PL_piLIO->Close(fd, ErrorNo()); |
e3b8966e |
966 | } |
967 | |
968 | int _win32_read(int fd, void *buf, unsigned int cnt) |
969 | { |
4c2891ed |
970 | return pPerl->PL_piLIO->Read(fd, buf, cnt, ErrorNo()); |
e3b8966e |
971 | } |
972 | |
973 | int _win32_write(int fd, const void *buf, unsigned int cnt) |
974 | { |
4c2891ed |
975 | return pPerl->PL_piLIO->Write(fd, buf, cnt, ErrorNo()); |
e3b8966e |
976 | } |
977 | |
978 | int _win32_times(struct tms *timebuf) |
979 | { |
4c2891ed |
980 | return pPerl->PL_piProc->Times(timebuf); |
e3b8966e |
981 | } |
982 | |
983 | int _win32_ioctl(int i, unsigned int u, char *data) |
984 | { |
4c2891ed |
985 | return pPerl->PL_piLIO->IOCtl(i, u, data, ErrorNo()); |
e3b8966e |
986 | } |
987 | |
988 | int _win32_utime(const char *f, struct utimbuf *t) |
989 | { |
4c2891ed |
990 | return pPerl->PL_piLIO->Utime((char*)f, t, ErrorNo()); |
e3b8966e |
991 | } |
992 | |
993 | char* _win32_getenv(const char *name) |
994 | { |
4c2891ed |
995 | return pPerl->PL_piENV->Getenv(name, ErrorNo()); |
e3b8966e |
996 | } |
997 | |
998 | int _win32_open_osfhandle(long handle, int flags) |
999 | { |
4c2891ed |
1000 | return pPerl->PL_piStdIO->OpenOSfhandle(handle, flags); |
e3b8966e |
1001 | } |
1002 | |
1003 | long _win32_get_osfhandle(int fd) |
1004 | { |
4c2891ed |
1005 | return pPerl->PL_piStdIO->GetOSfhandle(fd); |
e3b8966e |
1006 | } |
891fc7f2 |
1007 | |
1008 | u_long _win32_htonl (u_long hostlong) |
1009 | { |
4c2891ed |
1010 | return pPerl->PL_piSock->Htonl(hostlong); |
891fc7f2 |
1011 | } |
1012 | |
1013 | u_short _win32_htons (u_short hostshort) |
1014 | { |
4c2891ed |
1015 | return pPerl->PL_piSock->Htons(hostshort); |
891fc7f2 |
1016 | } |
1017 | |
1018 | u_long _win32_ntohl (u_long netlong) |
1019 | { |
4c2891ed |
1020 | return pPerl->PL_piSock->Ntohl(netlong); |
891fc7f2 |
1021 | } |
1022 | |
1023 | u_short _win32_ntohs (u_short netshort) |
1024 | { |
4c2891ed |
1025 | return pPerl->PL_piSock->Ntohs(netshort); |
891fc7f2 |
1026 | } |
1027 | |
1028 | unsigned long _win32_inet_addr (const char * cp) |
1029 | { |
4c2891ed |
1030 | return pPerl->PL_piSock->InetAddr(cp, ErrorNo()); |
891fc7f2 |
1031 | } |
1032 | |
1033 | char * _win32_inet_ntoa (struct in_addr in) |
1034 | { |
4c2891ed |
1035 | return pPerl->PL_piSock->InetNtoa(in, ErrorNo()); |
891fc7f2 |
1036 | } |
1037 | |
1038 | SOCKET _win32_socket (int af, int type, int protocol) |
1039 | { |
4c2891ed |
1040 | return pPerl->PL_piSock->Socket(af, type, protocol, ErrorNo()); |
891fc7f2 |
1041 | } |
1042 | |
1043 | int _win32_bind (SOCKET s, const struct sockaddr *addr, int namelen) |
1044 | { |
4c2891ed |
1045 | return pPerl->PL_piSock->Bind(s, addr, namelen, ErrorNo()); |
891fc7f2 |
1046 | } |
1047 | |
1048 | int _win32_listen (SOCKET s, int backlog) |
1049 | { |
4c2891ed |
1050 | return pPerl->PL_piSock->Listen(s, backlog, ErrorNo()); |
891fc7f2 |
1051 | } |
1052 | |
1053 | SOCKET _win32_accept (SOCKET s, struct sockaddr *addr, int *addrlen) |
1054 | { |
4c2891ed |
1055 | return pPerl->PL_piSock->Accept(s, addr, addrlen, ErrorNo()); |
891fc7f2 |
1056 | } |
1057 | |
1058 | int _win32_connect (SOCKET s, const struct sockaddr *name, int namelen) |
1059 | { |
4c2891ed |
1060 | return pPerl->PL_piSock->Connect(s, name, namelen, ErrorNo()); |
891fc7f2 |
1061 | } |
1062 | |
1063 | int _win32_send (SOCKET s, const char * buf, int len, int flags) |
1064 | { |
4c2891ed |
1065 | return pPerl->PL_piSock->Send(s, buf, len, flags, ErrorNo()); |
891fc7f2 |
1066 | } |
1067 | |
1068 | int _win32_sendto (SOCKET s, const char * buf, int len, int flags, |
1069 | const struct sockaddr *to, int tolen) |
1070 | { |
4c2891ed |
1071 | return pPerl->PL_piSock->Sendto(s, buf, len, flags, to, tolen, ErrorNo()); |
891fc7f2 |
1072 | } |
1073 | |
1074 | int _win32_recv (SOCKET s, char * buf, int len, int flags) |
1075 | { |
4c2891ed |
1076 | return pPerl->PL_piSock->Recv(s, buf, len, flags, ErrorNo()); |
891fc7f2 |
1077 | } |
1078 | |
1079 | int _win32_recvfrom (SOCKET s, char * buf, int len, int flags, |
1080 | struct sockaddr *from, int * fromlen) |
1081 | { |
4c2891ed |
1082 | return pPerl->PL_piSock->Recvfrom(s, buf, len, flags, from, fromlen, ErrorNo()); |
891fc7f2 |
1083 | } |
1084 | |
1085 | int _win32_shutdown (SOCKET s, int how) |
1086 | { |
4c2891ed |
1087 | return pPerl->PL_piSock->Shutdown(s, how, ErrorNo()); |
891fc7f2 |
1088 | } |
1089 | |
1090 | int _win32_closesocket (SOCKET s) |
1091 | { |
4c2891ed |
1092 | return pPerl->PL_piSock->Closesocket(s, ErrorNo()); |
891fc7f2 |
1093 | } |
1094 | |
1095 | int _win32_ioctlsocket (SOCKET s, long cmd, u_long *argp) |
1096 | { |
4c2891ed |
1097 | return pPerl->PL_piSock->Ioctlsocket(s, cmd, argp, ErrorNo()); |
891fc7f2 |
1098 | } |
1099 | |
1100 | int _win32_setsockopt (SOCKET s, int level, int optname, |
1101 | const char * optval, int optlen) |
1102 | { |
4c2891ed |
1103 | return pPerl->PL_piSock->Setsockopt(s, level, optname, optval, optlen, ErrorNo()); |
891fc7f2 |
1104 | } |
1105 | |
1106 | int _win32_getsockopt (SOCKET s, int level, int optname, char * optval, int *optlen) |
1107 | { |
4c2891ed |
1108 | return pPerl->PL_piSock->Getsockopt(s, level, optname, optval, optlen, ErrorNo()); |
891fc7f2 |
1109 | } |
1110 | |
1111 | int _win32_getpeername (SOCKET s, struct sockaddr *name, int * namelen) |
1112 | { |
4c2891ed |
1113 | return pPerl->PL_piSock->Getpeername(s, name, namelen, ErrorNo()); |
891fc7f2 |
1114 | } |
1115 | |
1116 | int _win32_getsockname (SOCKET s, struct sockaddr *name, int * namelen) |
1117 | { |
4c2891ed |
1118 | return pPerl->PL_piSock->Getsockname(s, name, namelen, ErrorNo()); |
891fc7f2 |
1119 | } |
1120 | |
1121 | int _win32_gethostname (char * name, int namelen) |
1122 | { |
4c2891ed |
1123 | return pPerl->PL_piSock->Gethostname(name, namelen, ErrorNo()); |
891fc7f2 |
1124 | } |
1125 | |
1126 | struct hostent * _win32_gethostbyname(const char * name) |
1127 | { |
4c2891ed |
1128 | return pPerl->PL_piSock->Gethostbyname(name, ErrorNo()); |
891fc7f2 |
1129 | } |
1130 | |
1131 | struct hostent * _win32_gethostbyaddr(const char * addr, int len, int type) |
1132 | { |
4c2891ed |
1133 | return pPerl->PL_piSock->Gethostbyaddr(addr, len, type, ErrorNo()); |
891fc7f2 |
1134 | } |
1135 | |
1136 | struct protoent * _win32_getprotobyname(const char * name) |
1137 | { |
4c2891ed |
1138 | return pPerl->PL_piSock->Getprotobyname(name, ErrorNo()); |
891fc7f2 |
1139 | } |
1140 | |
1141 | struct protoent * _win32_getprotobynumber(int proto) |
1142 | { |
4c2891ed |
1143 | return pPerl->PL_piSock->Getprotobynumber(proto, ErrorNo()); |
891fc7f2 |
1144 | } |
1145 | |
1146 | struct servent * _win32_getservbyname(const char * name, const char * proto) |
1147 | { |
4c2891ed |
1148 | return pPerl->PL_piSock->Getservbyname(name, proto, ErrorNo()); |
891fc7f2 |
1149 | } |
1150 | |
1151 | struct servent * _win32_getservbyport(int port, const char * proto) |
1152 | { |
4c2891ed |
1153 | return pPerl->PL_piSock->Getservbyport(port, proto, ErrorNo()); |
891fc7f2 |
1154 | } |
1155 | |
1156 | int _win32_select (int nfds, Perl_fd_set *rfds, Perl_fd_set *wfds, Perl_fd_set *xfds, |
1157 | const struct timeval *timeout) |
1158 | { |
4c2891ed |
1159 | return pPerl->PL_piSock->Select(nfds, (char*)rfds, (char*)wfds, (char*)xfds, timeout, ErrorNo()); |
891fc7f2 |
1160 | } |
1161 | |
1162 | void _win32_endnetent(void) |
1163 | { |
4c2891ed |
1164 | pPerl->PL_piSock->Endnetent(ErrorNo()); |
891fc7f2 |
1165 | } |
1166 | |
1167 | void _win32_endhostent(void) |
1168 | { |
4c2891ed |
1169 | pPerl->PL_piSock->Endhostent(ErrorNo()); |
891fc7f2 |
1170 | } |
1171 | |
1172 | void _win32_endprotoent(void) |
1173 | { |
4c2891ed |
1174 | pPerl->PL_piSock->Endprotoent(ErrorNo()); |
891fc7f2 |
1175 | } |
1176 | |
1177 | void _win32_endservent(void) |
1178 | { |
4c2891ed |
1179 | pPerl->PL_piSock->Endservent(ErrorNo()); |
891fc7f2 |
1180 | } |
1181 | |
1182 | struct netent * _win32_getnetent(void) |
1183 | { |
4c2891ed |
1184 | return pPerl->PL_piSock->Getnetent(ErrorNo()); |
891fc7f2 |
1185 | } |
1186 | |
1187 | struct netent * _win32_getnetbyname(char *name) |
1188 | { |
4c2891ed |
1189 | return pPerl->PL_piSock->Getnetbyname(name, ErrorNo()); |
891fc7f2 |
1190 | } |
1191 | |
1192 | struct netent * _win32_getnetbyaddr(long net, int type) |
1193 | { |
4c2891ed |
1194 | return pPerl->PL_piSock->Getnetbyaddr(net, type, ErrorNo()); |
891fc7f2 |
1195 | } |
1196 | |
1197 | struct protoent *_win32_getprotoent(void) |
1198 | { |
4c2891ed |
1199 | return pPerl->PL_piSock->Getprotoent(ErrorNo()); |
891fc7f2 |
1200 | } |
1201 | |
1202 | struct servent *_win32_getservent(void) |
1203 | { |
4c2891ed |
1204 | return pPerl->PL_piSock->Getservent(ErrorNo()); |
891fc7f2 |
1205 | } |
1206 | |
1207 | void _win32_sethostent(int stayopen) |
1208 | { |
4c2891ed |
1209 | pPerl->PL_piSock->Sethostent(stayopen, ErrorNo()); |
891fc7f2 |
1210 | } |
1211 | |
1212 | void _win32_setnetent(int stayopen) |
1213 | { |
4c2891ed |
1214 | pPerl->PL_piSock->Setnetent(stayopen, ErrorNo()); |
891fc7f2 |
1215 | } |
1216 | |
1217 | void _win32_setprotoent(int stayopen) |
1218 | { |
4c2891ed |
1219 | pPerl->PL_piSock->Setprotoent(stayopen, ErrorNo()); |
891fc7f2 |
1220 | } |
1221 | |
1222 | void _win32_setservent(int stayopen) |
1223 | { |
4c2891ed |
1224 | pPerl->PL_piSock->Setservent(stayopen, ErrorNo()); |
891fc7f2 |
1225 | } |
e3b8966e |
1226 | } /* extern "C" */ |
1227 | EOCODE |
1228 | |
1229 | |
1230 | print HDRFILE <<EOCODE; |
9e6b2b00 |
1231 | #undef Perl_op_desc |
1232 | char ** _Perl_op_desc (); |
1233 | #define Perl_op_desc (_Perl_op_desc()) |
1234 | |
1235 | #undef Perl_op_name |
1236 | char ** _Perl_op_name (); |
1237 | #define Perl_op_name (_Perl_op_name()) |
1238 | |
1239 | #undef Perl_no_modify |
58a50f62 |
1240 | char * _Perl_no_modify (); |
9e6b2b00 |
1241 | #define Perl_no_modify (_Perl_no_modify()) |
1242 | |
1243 | #undef Perl_opargs |
58a50f62 |
1244 | U32 * _Perl_opargs (); |
9e6b2b00 |
1245 | #define Perl_opargs (_Perl_opargs()) |
1246 | |
1247 | |
e3b8966e |
1248 | #undef win32_errno |
1249 | #undef win32_stdin |
1250 | #undef win32_stdout |
1251 | #undef win32_stderr |
1252 | #undef win32_ferror |
1253 | #undef win32_feof |
1254 | #undef win32_fprintf |
1255 | #undef win32_printf |
1256 | #undef win32_vfprintf |
1257 | #undef win32_vprintf |
1258 | #undef win32_fread |
1259 | #undef win32_fwrite |
1260 | #undef win32_fopen |
1261 | #undef win32_fdopen |
1262 | #undef win32_freopen |
1263 | #undef win32_fclose |
1264 | #undef win32_fputs |
1265 | #undef win32_fputc |
1266 | #undef win32_ungetc |
1267 | #undef win32_getc |
1268 | #undef win32_fileno |
1269 | #undef win32_clearerr |
1270 | #undef win32_fflush |
1271 | #undef win32_ftell |
1272 | #undef win32_fseek |
1273 | #undef win32_fgetpos |
1274 | #undef win32_fsetpos |
1275 | #undef win32_rewind |
1276 | #undef win32_tmpfile |
1277 | #undef win32_abort |
1278 | #undef win32_fstat |
1279 | #undef win32_stat |
1280 | #undef win32_pipe |
1281 | #undef win32_popen |
1282 | #undef win32_pclose |
e24c7c18 |
1283 | #undef win32_rename |
e3b8966e |
1284 | #undef win32_setmode |
1285 | #undef win32_lseek |
1286 | #undef win32_tell |
1287 | #undef win32_dup |
1288 | #undef win32_dup2 |
1289 | #undef win32_open |
1290 | #undef win32_close |
1291 | #undef win32_eof |
1292 | #undef win32_read |
1293 | #undef win32_write |
1294 | #undef win32_mkdir |
1295 | #undef win32_rmdir |
1296 | #undef win32_chdir |
1297 | #undef win32_setbuf |
1298 | #undef win32_setvbuf |
1299 | #undef win32_fgetc |
9e6b2b00 |
1300 | #undef win32_fgets |
1301 | #undef win32_gets |
e3b8966e |
1302 | #undef win32_putc |
1303 | #undef win32_puts |
1304 | #undef win32_getchar |
1305 | #undef win32_putchar |
1306 | #undef win32_malloc |
1307 | #undef win32_calloc |
1308 | #undef win32_realloc |
1309 | #undef win32_free |
1310 | #undef win32_sleep |
1311 | #undef win32_times |
1312 | #undef win32_stat |
1313 | #undef win32_ioctl |
1314 | #undef win32_utime |
1315 | #undef win32_getenv |
1316 | |
891fc7f2 |
1317 | #undef win32_htonl |
1318 | #undef win32_htons |
1319 | #undef win32_ntohl |
1320 | #undef win32_ntohs |
1321 | #undef win32_inet_addr |
1322 | #undef win32_inet_ntoa |
1323 | |
1324 | #undef win32_socket |
1325 | #undef win32_bind |
1326 | #undef win32_listen |
1327 | #undef win32_accept |
1328 | #undef win32_connect |
1329 | #undef win32_send |
1330 | #undef win32_sendto |
1331 | #undef win32_recv |
1332 | #undef win32_recvfrom |
1333 | #undef win32_shutdown |
1334 | #undef win32_closesocket |
1335 | #undef win32_ioctlsocket |
1336 | #undef win32_setsockopt |
1337 | #undef win32_getsockopt |
1338 | #undef win32_getpeername |
1339 | #undef win32_getsockname |
1340 | #undef win32_gethostname |
1341 | #undef win32_gethostbyname |
1342 | #undef win32_gethostbyaddr |
1343 | #undef win32_getprotobyname |
1344 | #undef win32_getprotobynumber |
1345 | #undef win32_getservbyname |
1346 | #undef win32_getservbyport |
1347 | #undef win32_select |
1348 | #undef win32_endhostent |
1349 | #undef win32_endnetent |
1350 | #undef win32_endprotoent |
1351 | #undef win32_endservent |
1352 | #undef win32_getnetent |
1353 | #undef win32_getnetbyname |
1354 | #undef win32_getnetbyaddr |
1355 | #undef win32_getprotoent |
1356 | #undef win32_getservent |
1357 | #undef win32_sethostent |
1358 | #undef win32_setnetent |
1359 | #undef win32_setprotoent |
1360 | #undef win32_setservent |
1361 | |
e3b8966e |
1362 | #define win32_errno _win32_errno |
1363 | #define win32_stdin _win32_stdin |
1364 | #define win32_stdout _win32_stdout |
1365 | #define win32_stderr _win32_stderr |
1366 | #define win32_ferror _win32_ferror |
1367 | #define win32_feof _win32_feof |
1368 | #define win32_strerror _win32_strerror |
1369 | #define win32_perror _win32_perror |
1370 | #define win32_fprintf _win32_fprintf |
1371 | #define win32_printf _win32_printf |
1372 | #define win32_vfprintf _win32_vfprintf |
1373 | #define win32_vprintf _win32_vprintf |
1374 | #define win32_fread _win32_fread |
1375 | #define win32_fwrite _win32_fwrite |
1376 | #define win32_fopen _win32_fopen |
1377 | #define win32_fdopen _win32_fdopen |
1378 | #define win32_freopen _win32_freopen |
1379 | #define win32_fclose _win32_fclose |
1380 | #define win32_fputs _win32_fputs |
1381 | #define win32_fputc _win32_fputc |
1382 | #define win32_ungetc _win32_ungetc |
1383 | #define win32_getc _win32_getc |
1384 | #define win32_fileno _win32_fileno |
1385 | #define win32_clearerr _win32_clearerr |
1386 | #define win32_fflush _win32_fflush |
1387 | #define win32_ftell _win32_ftell |
1388 | #define win32_fseek _win32_fseek |
1389 | #define win32_fgetpos _win32_fgetpos |
1390 | #define win32_fsetpos _win32_fsetpos |
1391 | #define win32_rewind _win32_rewind |
1392 | #define win32_tmpfile _win32_tmpfile |
1393 | #define win32_abort _win32_abort |
1394 | #define win32_fstat _win32_fstat |
1395 | #define win32_stat _win32_stat |
1396 | #define win32_pipe _win32_pipe |
1397 | #define win32_popen _win32_popen |
1398 | #define win32_pclose _win32_pclose |
e24c7c18 |
1399 | #define win32_rename _win32_rename |
e3b8966e |
1400 | #define win32_setmode _win32_setmode |
1401 | #define win32_lseek _win32_lseek |
1402 | #define win32_tell _win32_tell |
1403 | #define win32_dup _win32_dup |
1404 | #define win32_dup2 _win32_dup2 |
1405 | #define win32_open _win32_open |
1406 | #define win32_close _win32_close |
1407 | #define win32_eof _win32_eof |
1408 | #define win32_read _win32_read |
1409 | #define win32_write _win32_write |
1410 | #define win32_mkdir _win32_mkdir |
1411 | #define win32_rmdir _win32_rmdir |
1412 | #define win32_chdir _win32_chdir |
1413 | #define win32_setbuf _win32_setbuf |
1414 | #define win32_setvbuf _win32_setvbuf |
1415 | #define win32_fgetc _win32_fgetc |
9e6b2b00 |
1416 | #define win32_fgets _win32_fgets |
1417 | #define win32_gets _win32_gets |
e3b8966e |
1418 | #define win32_putc _win32_putc |
1419 | #define win32_puts _win32_puts |
1420 | #define win32_getchar _win32_getchar |
1421 | #define win32_putchar _win32_putchar |
1422 | #define win32_malloc _win32_malloc |
1423 | #define win32_calloc _win32_calloc |
1424 | #define win32_realloc _win32_realloc |
1425 | #define win32_free _win32_free |
1426 | #define win32_sleep _win32_sleep |
1427 | #define win32_spawnvp _win32_spawnvp |
1428 | #define win32_times _win32_times |
1429 | #define win32_stat _win32_stat |
1430 | #define win32_ioctl _win32_ioctl |
1431 | #define win32_utime _win32_utime |
1432 | #define win32_getenv _win32_getenv |
1433 | #define win32_open_osfhandle _win32_open_osfhandle |
1434 | #define win32_get_osfhandle _win32_get_osfhandle |
1435 | |
891fc7f2 |
1436 | #define win32_htonl _win32_htonl |
1437 | #define win32_htons _win32_htons |
1438 | #define win32_ntohl _win32_ntohl |
1439 | #define win32_ntohs _win32_ntohs |
1440 | #define win32_inet_addr _win32_inet_addr |
1441 | #define win32_inet_ntoa _win32_inet_ntoa |
1442 | |
1443 | #define win32_socket _win32_socket |
1444 | #define win32_bind _win32_bind |
1445 | #define win32_listen _win32_listen |
1446 | #define win32_accept _win32_accept |
1447 | #define win32_connect _win32_connect |
1448 | #define win32_send _win32_send |
1449 | #define win32_sendto _win32_sendto |
1450 | #define win32_recv _win32_recv |
1451 | #define win32_recvfrom _win32_recvfrom |
1452 | #define win32_shutdown _win32_shutdown |
1453 | #define win32_closesocket _win32_closesocket |
1454 | #define win32_ioctlsocket _win32_ioctlsocket |
1455 | #define win32_setsockopt _win32_setsockopt |
1456 | #define win32_getsockopt _win32_getsockopt |
1457 | #define win32_getpeername _win32_getpeername |
1458 | #define win32_getsockname _win32_getsockname |
1459 | #define win32_gethostname _win32_gethostname |
1460 | #define win32_gethostbyname _win32_gethostbyname |
1461 | #define win32_gethostbyaddr _win32_gethostbyaddr |
1462 | #define win32_getprotobyname _win32_getprotobyname |
1463 | #define win32_getprotobynumber _win32_getprotobynumber |
1464 | #define win32_getservbyname _win32_getservbyname |
1465 | #define win32_getservbyport _win32_getservbyport |
1466 | #define win32_select _win32_select |
1467 | #define win32_endhostent _win32_endhostent |
1468 | #define win32_endnetent _win32_endnetent |
1469 | #define win32_endprotoent _win32_endprotoent |
1470 | #define win32_endservent _win32_endservent |
1471 | #define win32_getnetent _win32_getnetent |
1472 | #define win32_getnetbyname _win32_getnetbyname |
1473 | #define win32_getnetbyaddr _win32_getnetbyaddr |
1474 | #define win32_getprotoent _win32_getprotoent |
1475 | #define win32_getservent _win32_getservent |
1476 | #define win32_sethostent _win32_sethostent |
1477 | #define win32_setnetent _win32_setnetent |
1478 | #define win32_setprotoent _win32_setprotoent |
1479 | #define win32_setservent _win32_setservent |
1480 | |
e3b8966e |
1481 | int * _win32_errno(void); |
1482 | FILE* _win32_stdin(void); |
1483 | FILE* _win32_stdout(void); |
1484 | FILE* _win32_stderr(void); |
1485 | int _win32_ferror(FILE *fp); |
1486 | int _win32_feof(FILE *fp); |
1487 | char* _win32_strerror(int e); |
1488 | void _win32_perror(const char *str); |
1489 | int _win32_fprintf(FILE *pf, const char *format, ...); |
1490 | int _win32_printf(const char *format, ...); |
1491 | int _win32_vfprintf(FILE *pf, const char *format, va_list arg); |
1492 | int _win32_vprintf(const char *format, va_list arg); |
1493 | size_t _win32_fread(void *buf, size_t size, size_t count, FILE *pf); |
1494 | size_t _win32_fwrite(const void *buf, size_t size, size_t count, FILE *pf); |
1495 | FILE* _win32_fopen(const char *path, const char *mode); |
1496 | FILE* _win32_fdopen(int fh, const char *mode); |
1497 | FILE* _win32_freopen(const char *path, const char *mode, FILE *pf); |
1498 | int _win32_fclose(FILE *pf); |
1499 | int _win32_fputs(const char *s,FILE *pf); |
1500 | int _win32_fputc(int c,FILE *pf); |
1501 | int _win32_ungetc(int c,FILE *pf); |
1502 | int _win32_getc(FILE *pf); |
1503 | int _win32_fileno(FILE *pf); |
1504 | void _win32_clearerr(FILE *pf); |
1505 | int _win32_fflush(FILE *pf); |
1506 | long _win32_ftell(FILE *pf); |
1507 | int _win32_fseek(FILE *pf,long offset,int origin); |
1508 | int _win32_fgetpos(FILE *pf,fpos_t *p); |
1509 | int _win32_fsetpos(FILE *pf,const fpos_t *p); |
1510 | void _win32_rewind(FILE *pf); |
1511 | FILE* _win32_tmpfile(void); |
1512 | void _win32_abort(void); |
1513 | int _win32_fstat(int fd,struct stat *sbufptr); |
1514 | int _win32_stat(const char *name,struct stat *sbufptr); |
1515 | int _win32_pipe( int *phandles, unsigned int psize, int textmode ); |
1516 | FILE* _win32_popen( const char *command, const char *mode ); |
1517 | int _win32_pclose( FILE *pf); |
e24c7c18 |
1518 | int _win32_rename( const char *oldname, const char *newname); |
e3b8966e |
1519 | int _win32_setmode( int fd, int mode); |
1520 | long _win32_lseek( int fd, long offset, int origin); |
1521 | long _win32_tell( int fd); |
1522 | int _win32_dup( int fd); |
1523 | int _win32_dup2(int h1, int h2); |
1524 | int _win32_open(const char *path, int oflag,...); |
1525 | int _win32_close(int fd); |
1526 | int _win32_eof(int fd); |
1527 | int _win32_read(int fd, void *buf, unsigned int cnt); |
1528 | int _win32_write(int fd, const void *buf, unsigned int cnt); |
1529 | int _win32_mkdir(const char *dir, int mode); |
1530 | int _win32_rmdir(const char *dir); |
1531 | int _win32_chdir(const char *dir); |
1532 | void _win32_setbuf(FILE *pf, char *buf); |
1533 | int _win32_setvbuf(FILE *pf, char *buf, int type, size_t size); |
1534 | char* _win32_fgets(char *s, int n, FILE *pf); |
1535 | char* _win32_gets(char *s); |
1536 | int _win32_fgetc(FILE *pf); |
1537 | int _win32_putc(int c, FILE *pf); |
1538 | int _win32_puts(const char *s); |
1539 | int _win32_getchar(void); |
1540 | int _win32_putchar(int c); |
1541 | void* _win32_malloc(size_t size); |
1542 | void* _win32_calloc(size_t numitems, size_t size); |
1543 | void* _win32_realloc(void *block, size_t size); |
1544 | void _win32_free(void *block); |
1545 | unsigned _win32_sleep(unsigned int); |
1546 | int _win32_spawnvp(int mode, const char *cmdname, const char *const *argv); |
1547 | int _win32_times(struct tms *timebuf); |
1548 | int _win32_stat(const char *path, struct stat *buf); |
1549 | int _win32_ioctl(int i, unsigned int u, char *data); |
1550 | int _win32_utime(const char *f, struct utimbuf *t); |
1551 | char* _win32_getenv(const char *name); |
1552 | int _win32_open_osfhandle(long handle, int flags); |
1553 | long _win32_get_osfhandle(int fd); |
1554 | |
891fc7f2 |
1555 | u_long _win32_htonl (u_long hostlong); |
1556 | u_short _win32_htons (u_short hostshort); |
1557 | u_long _win32_ntohl (u_long netlong); |
1558 | u_short _win32_ntohs (u_short netshort); |
1559 | unsigned long _win32_inet_addr (const char * cp); |
1560 | char * _win32_inet_ntoa (struct in_addr in); |
1561 | |
1562 | SOCKET _win32_socket (int af, int type, int protocol); |
1563 | int _win32_bind (SOCKET s, const struct sockaddr *addr, int namelen); |
1564 | int _win32_listen (SOCKET s, int backlog); |
1565 | SOCKET _win32_accept (SOCKET s, struct sockaddr *addr, int *addrlen); |
1566 | int _win32_connect (SOCKET s, const struct sockaddr *name, int namelen); |
1567 | int _win32_send (SOCKET s, const char * buf, int len, int flags); |
1568 | int _win32_sendto (SOCKET s, const char * buf, int len, int flags, |
1569 | const struct sockaddr *to, int tolen); |
1570 | int _win32_recv (SOCKET s, char * buf, int len, int flags); |
1571 | int _win32_recvfrom (SOCKET s, char * buf, int len, int flags, |
1572 | struct sockaddr *from, int * fromlen); |
1573 | int _win32_shutdown (SOCKET s, int how); |
1574 | int _win32_closesocket (SOCKET s); |
1575 | int _win32_ioctlsocket (SOCKET s, long cmd, u_long *argp); |
1576 | int _win32_setsockopt (SOCKET s, int level, int optname, |
1577 | const char * optval, int optlen); |
1578 | int _win32_getsockopt (SOCKET s, int level, int optname, char * optval, int *optlen); |
1579 | int _win32_getpeername (SOCKET s, struct sockaddr *name, int * namelen); |
1580 | int _win32_getsockname (SOCKET s, struct sockaddr *name, int * namelen); |
1581 | int _win32_gethostname (char * name, int namelen); |
1582 | struct hostent * _win32_gethostbyname(const char * name); |
1583 | struct hostent * _win32_gethostbyaddr(const char * addr, int len, int type); |
1584 | struct protoent * _win32_getprotobyname(const char * name); |
1585 | struct protoent * _win32_getprotobynumber(int proto); |
1586 | struct servent * _win32_getservbyname(const char * name, const char * proto); |
1587 | struct servent * _win32_getservbyport(int port, const char * proto); |
1588 | int _win32_select (int nfds, Perl_fd_set *rfds, Perl_fd_set *wfds, Perl_fd_set *xfds, |
1589 | const struct timeval *timeout); |
1590 | void _win32_endnetent(void); |
1591 | void _win32_endhostent(void); |
1592 | void _win32_endprotoent(void); |
1593 | void _win32_endservent(void); |
1594 | struct netent * _win32_getnetent(void); |
1595 | struct netent * _win32_getnetbyname(char *name); |
1596 | struct netent * _win32_getnetbyaddr(long net, int type); |
1597 | struct protoent *_win32_getprotoent(void); |
1598 | struct servent *_win32_getservent(void); |
1599 | void _win32_sethostent(int stayopen); |
1600 | void _win32_setnetent(int stayopen); |
1601 | void _win32_setprotoent(int stayopen); |
1602 | void _win32_setservent(int stayopen); |
1603 | |
e3b8966e |
1604 | #pragma warning(once : 4113) |
1605 | EOCODE |
1606 | |
1607 | |
1608 | close HDRFILE; |
1609 | close OUTFILE; |