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