bump patchlevel to 52; other little tweaks for threads, win32 builds
[p5sagit/p5-mst-13.2.git] / win32 / GenCAPI.pl
CommitLineData
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 6my $hdrfile = "$ARGV[0]\\perlCAPI.h";
e3b8966e 7my $infile = '..\\proto.h';
8my $embedfile = '..\\embed.h';
9my $separateObj = 0;
10
11my %skip_list;
12my %embed;
13
14sub 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
33readembed %embed, $embedfile;
34
35sub skip_these {
36 my $list = shift;
37 foreach my $symbol (@$list) {
38 $skip_list{$symbol} = 1;
39 }
40}
41
42skip_these [qw(
43cando
44cast_ulong
45my_chsize
46condpair_magic
47deb
48deb_growlevel
49debprofdump
50debop
51debstack
52debstackptrs
58a50f62 53dump_fds
54dump_mstats
e3b8966e 55fprintf
56find_threadsv
57magic_mutexfree
58a50f62 58my_memcmp
59my_memset
e3b8966e 60my_pclose
61my_popen
62my_swap
63my_htonl
64my_ntohl
65new_struct_thread
66same_dirent
67unlnk
68unlock_condpair
69safexmalloc
70safexcalloc
71safexrealloc
72safexfree
73Perl_GetVars
066ef5b5 74malloced_size
e3b8966e 75)];
76
77
78
79if (!open(INFILE, "<$infile")) {
80 print "open of $infile failed: $!\n";
81 return 1;
82}
83
6de196ee 84if (!open(OUTFILE, ">perlCAPI.cpp")) {
85 print "open of perlCAPI.cpp failed: $!\n";
e3b8966e 86 return 1;
87}
88
b207eff1 89print OUTFILE <<ENDCODE;
90#include "EXTERN.h"
91#include "perl.h"
92#include "XSUB.h"
93
94#define DESTRUCTORFUNC (void (*)(void*))
95
96ENDCODE
97
98print OUTFILE "#ifdef SetCPerlObj_defined\n" unless ($separateObj == 0);
99
100print OUTFILE <<ENDCODE;
101extern "C" void SetCPerlObj(CPerlObj* pP)
102{
103 pPerl = pP;
104}
105
106ENDCODE
107
e3b8966e 108print OUTFILE "#endif\n" unless ($separateObj == 0);
109
110while () {
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
155extern "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}
167ENDCODE
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
177extern "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}
187ENDCODE
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
199extern "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}
206ENDCODE
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
221extern "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}
229ENDCODE
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
241extern "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}
248ENDCODE
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
263extern "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}
271ENDCODE
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
283extern "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}
292ENDCODE
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
328extern "C" $type $name ($args)
329{
330 return pPerl->perl_parse(xsinit, argc, argv, env);
331}
332ENDCODE
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
341extern "C" $type $name ($args)
342{
58a50f62 343 pPerl->perl_atexit(fn, ptr);
35ff7856 344}
345ENDCODE
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
360extern "C" $type $funcName ()
361{
362$return pPerl->$funcName();
363}
364
365ENDCODE
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
374extern "C" $type $funcName ($args)
375{
b207eff1 376ENDCODE
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
399close INFILE;
400
401%skip_list = ();
402
403skip_these [qw(
404strchop
405filemode
406lastfd
407oldname
408curinterp
409Argv
410Cmd
411sortcop
412sortstash
413firstgv
414secondgv
415sortstack
416signalstack
417mystrk
418dumplvl
419oldlastpm
420gensym
421preambled
422preambleav
423Ilaststatval
424Ilaststype
425mess_sv
426ors
427opsave
428eval_mutex
942e002e 429strtab_mutex
e3b8966e 430orslen
431ofmt
e3b8966e 432modcount
433generation
434DBcv
435archpat_auto
436sortcxix
437lastgotoprobe
438regdummy
77d41b28 439regcomp_parse
e3b8966e 440regxend
441regcode
442regnaughty
443regsawback
444regprecomp
445regnpar
446regsize
447regflags
448regseen
449seen_zerolen
77d41b28 450regcomp_rx
e3b8966e 451extralen
452colorset
453colors
454reginput
455regbol
456regeol
457regstartp
458regendp
459reglastparen
460regtill
461regprev
462reg_start_tmp
463reg_start_tmpl
464regdata
465bostr
466reg_flags
467reg_eval_set
468regnarrate
469regprogram
470regindent
471regcc
472in_clean_objs
473in_clean_all
474linestart
475pending_ident
476statusvalue_vms
477sublex_info
478thrsv
479threadnum
4c2891ed 480PL_piMem
481PL_piENV
482PL_piStdIO
483PL_piLIO
484PL_piDir
485PL_piSock
486PL_piProc
e3b8966e 487cshname
488threadsv_names
489thread
490nthreads
491thr_key
492threads_mutex
493malloc_mutex
494svref_mutex
495sv_mutex
496nthreads_cond
497eval_cond
498cryptseen
499cshlen
500)];
501
502sub 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
517my %intrp;
518my %thread;
519my %globvar;
520
521readvars %intrp, '..\intrpvar.h','I';
522readvars %thread, '..\thrdvar.h','T';
523readvars %globvar, '..\perlvars.h','G';
524
525open(HDRFILE, ">$hdrfile") or die "$0: Can't open $hdrfile: $!\n";
b207eff1 526print HDRFILE <<ENDCODE;
527void SetCPerlObj(void* pP);
528CV* Perl_newXS(char* name, void (*subaddr)(CV* cv), char* filename);
529
530ENDCODE
e3b8966e 531
532sub 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
542extern "C" $type * _PL_$name ()
b207eff1 543{
4c2891ed 544 return (($type *)&pPerl->PL_$name);
b207eff1 545}
546
547ENDCODE
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
557ENDCODE
558
e3b8966e 559}
560
561foreach $key (keys %intrp) {
562 DoVariable ($key, $intrp{$key});
563}
564
565foreach $key (keys %thread) {
566 DoVariable ($key, $thread{$key});
567}
568
569foreach $key (keys %globvar) {
570 DoVariable ($key, $globvar{$key});
571}
572
573print OUTFILE <<EOCODE;
574
575
576extern "C" {
9e6b2b00 577
578
579char ** _Perl_op_desc(void)
580{
581 return pPerl->Perl_get_op_descs();
582}
583
584char ** _Perl_op_name(void)
585{
586 return pPerl->Perl_get_op_names();
587}
588
589char * _Perl_no_modify(void)
590{
591 return pPerl->Perl_get_no_modify();
592}
593
594U32 * _Perl_opargs(void)
595{
596 return pPerl->Perl_get_opargs();
597}
598
b207eff1 599void 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
619CV* 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
627void 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
639int * _win32_errno(void)
640{
641 return &pPerl->ErrorNo();
642}
643
644FILE* _win32_stdin(void)
645{
4c2891ed 646 return (FILE*)pPerl->PL_piStdIO->Stdin();
e3b8966e 647}
648
649FILE* _win32_stdout(void)
650{
4c2891ed 651 return (FILE*)pPerl->PL_piStdIO->Stdout();
e3b8966e 652}
653
654FILE* _win32_stderr(void)
655{
4c2891ed 656 return (FILE*)pPerl->PL_piStdIO->Stderr();
e3b8966e 657}
658
659int _win32_ferror(FILE *fp)
660{
4c2891ed 661 return pPerl->PL_piStdIO->Error((PerlIO*)fp, ErrorNo());
e3b8966e 662}
663
664int _win32_feof(FILE *fp)
665{
4c2891ed 666 return pPerl->PL_piStdIO->Eof((PerlIO*)fp, ErrorNo());
e3b8966e 667}
668
669char* _win32_strerror(int e)
670{
671 return strerror(e);
672}
673
674void _win32_perror(const char *str)
675{
676 perror(str);
677}
678
679int _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
684int _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
689int _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
699int _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
709size_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
714size_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
719FILE* _win32_fopen(const char *path, const char *mode)
720{
4c2891ed 721 return (FILE*)pPerl->PL_piStdIO->Open(path, mode, ErrorNo());
e3b8966e 722}
723
724FILE* _win32_fdopen(int fh, const char *mode)
725{
4c2891ed 726 return (FILE*)pPerl->PL_piStdIO->Fdopen(fh, mode, ErrorNo());
e3b8966e 727}
728
729FILE* _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
734int _win32_fclose(FILE *pf)
735{
4c2891ed 736 return pPerl->PL_piStdIO->Close((PerlIO*)pf, ErrorNo());
e3b8966e 737}
738
739int _win32_fputs(const char *s,FILE *pf)
740{
4c2891ed 741 return pPerl->PL_piStdIO->Puts((PerlIO*)pf, s, ErrorNo());
e3b8966e 742}
743
744int _win32_fputc(int c,FILE *pf)
745{
4c2891ed 746 return pPerl->PL_piStdIO->Putc((PerlIO*)pf, c, ErrorNo());
e3b8966e 747}
748
749int _win32_ungetc(int c,FILE *pf)
750{
4c2891ed 751 return pPerl->PL_piStdIO->Ungetc((PerlIO*)pf, c, ErrorNo());
e3b8966e 752}
753
754int _win32_getc(FILE *pf)
755{
4c2891ed 756 return pPerl->PL_piStdIO->Getc((PerlIO*)pf, ErrorNo());
e3b8966e 757}
758
759int _win32_fileno(FILE *pf)
760{
4c2891ed 761 return pPerl->PL_piStdIO->Fileno((PerlIO*)pf, ErrorNo());
e3b8966e 762}
763
764void _win32_clearerr(FILE *pf)
765{
4c2891ed 766 pPerl->PL_piStdIO->Clearerr((PerlIO*)pf, ErrorNo());
e3b8966e 767}
768
769int _win32_fflush(FILE *pf)
770{
4c2891ed 771 return pPerl->PL_piStdIO->Flush((PerlIO*)pf, ErrorNo());
e3b8966e 772}
773
774long _win32_ftell(FILE *pf)
775{
4c2891ed 776 return pPerl->PL_piStdIO->Tell((PerlIO*)pf, ErrorNo());
e3b8966e 777}
778
779int _win32_fseek(FILE *pf,long offset,int origin)
780{
4c2891ed 781 return pPerl->PL_piStdIO->Seek((PerlIO*)pf, offset, origin, ErrorNo());
e3b8966e 782}
783
784int _win32_fgetpos(FILE *pf,fpos_t *p)
785{
4c2891ed 786 return pPerl->PL_piStdIO->Getpos((PerlIO*)pf, p, ErrorNo());
e3b8966e 787}
788
789int _win32_fsetpos(FILE *pf,const fpos_t *p)
790{
4c2891ed 791 return pPerl->PL_piStdIO->Setpos((PerlIO*)pf, p, ErrorNo());
e3b8966e 792}
793
794void _win32_rewind(FILE *pf)
795{
4c2891ed 796 pPerl->PL_piStdIO->Rewind((PerlIO*)pf, ErrorNo());
e3b8966e 797}
798
799FILE* _win32_tmpfile(void)
800{
4c2891ed 801 return (FILE*)pPerl->PL_piStdIO->Tmpfile(ErrorNo());
e3b8966e 802}
803
804void _win32_setbuf(FILE *pf, char *buf)
805{
4c2891ed 806 pPerl->PL_piStdIO->SetBuf((PerlIO*)pf, buf, ErrorNo());
e3b8966e 807}
808
809int _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 814char* _win32_fgets(char *s, int n, FILE *pf)
815{
4c2891ed 816 return pPerl->PL_piStdIO->Gets((PerlIO*)pf, s, n, ErrorNo());
9e6b2b00 817}
818
819char* _win32_gets(char *s)
820{
4c2891ed 821 return _win32_fgets(s, 80, (FILE*)pPerl->PL_piStdIO->Stdin());
9e6b2b00 822}
823
e3b8966e 824int _win32_fgetc(FILE *pf)
825{
4c2891ed 826 return pPerl->PL_piStdIO->Getc((PerlIO*)pf, ErrorNo());
e3b8966e 827}
828
829int _win32_putc(int c, FILE *pf)
830{
4c2891ed 831 return pPerl->PL_piStdIO->Putc((PerlIO*)pf, c, ErrorNo());
e3b8966e 832}
833
834int _win32_puts(const char *s)
835{
4c2891ed 836 return pPerl->PL_piStdIO->Puts(pPerl->PL_piStdIO->Stdout(), s, ErrorNo());
e3b8966e 837}
838
839int _win32_getchar(void)
840{
4c2891ed 841 return pPerl->PL_piStdIO->Getc(pPerl->PL_piStdIO->Stdin(), ErrorNo());
e3b8966e 842}
843
844int _win32_putchar(int c)
845{
4c2891ed 846 return pPerl->PL_piStdIO->Putc(pPerl->PL_piStdIO->Stdout(), c, ErrorNo());
e3b8966e 847}
848
849void* _win32_malloc(size_t size)
850{
4c2891ed 851 return pPerl->PL_piMem->Malloc(size);
e3b8966e 852}
853
854void* _win32_calloc(size_t numitems, size_t size)
855{
4c2891ed 856 return pPerl->PL_piMem->Malloc(numitems*size);
e3b8966e 857}
858
859void* _win32_realloc(void *block, size_t size)
860{
4c2891ed 861 return pPerl->PL_piMem->Realloc(block, size);
e3b8966e 862}
863
864void _win32_free(void *block)
865{
4c2891ed 866 pPerl->PL_piMem->Free(block);
e3b8966e 867}
868
869void _win32_abort(void)
870{
4c2891ed 871 pPerl->PL_piProc->Abort();
e3b8966e 872}
873
874int _win32_pipe(int *phandles, unsigned int psize, int textmode)
875{
4c2891ed 876 return pPerl->PL_piProc->Pipe(phandles);
e3b8966e 877}
878
879FILE* _win32_popen(const char *command, const char *mode)
880{
4c2891ed 881 return (FILE*)pPerl->PL_piProc->Popen(command, mode);
e3b8966e 882}
883
884int _win32_pclose(FILE *pf)
885{
4c2891ed 886 return pPerl->PL_piProc->Pclose((PerlIO*)pf);
e3b8966e 887}
888
889unsigned _win32_sleep(unsigned int t)
890{
4c2891ed 891 return pPerl->PL_piProc->Sleep(t);
e3b8966e 892}
893
894int _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
899int _win32_mkdir(const char *dir, int mode)
900{
4c2891ed 901 return pPerl->PL_piDir->Makedir(dir, mode, ErrorNo());
e3b8966e 902}
903
904int _win32_rmdir(const char *dir)
905{
4c2891ed 906 return pPerl->PL_piDir->Rmdir(dir, ErrorNo());
e3b8966e 907}
908
909int _win32_chdir(const char *dir)
910{
4c2891ed 911 return pPerl->PL_piDir->Chdir(dir, ErrorNo());
e3b8966e 912}
913
914#undef stat
915int _win32_fstat(int fd,struct stat *sbufptr)
916{
4c2891ed 917 return pPerl->PL_piLIO->FileStat(fd, sbufptr, ErrorNo());
e3b8966e 918}
919
920int _win32_stat(const char *name,struct stat *sbufptr)
921{
4c2891ed 922 return pPerl->PL_piLIO->NameStat(name, sbufptr, ErrorNo());
e3b8966e 923}
924
8d9b2e3c 925int _win32_rename(const char *oname, const char *newname)
e24c7c18 926{
4c2891ed 927 return pPerl->PL_piLIO->Rename(oname, newname, ErrorNo());
e24c7c18 928}
929
e3b8966e 930int _win32_setmode(int fd, int mode)
931{
4c2891ed 932 return pPerl->PL_piLIO->Setmode(fd, mode, ErrorNo());
e3b8966e 933}
934
935long _win32_lseek(int fd, long offset, int origin)
936{
4c2891ed 937 return pPerl->PL_piLIO->Lseek(fd, offset, origin, ErrorNo());
e3b8966e 938}
939
940long _win32_tell(int fd)
941{
4c2891ed 942 return pPerl->PL_piStdIO->Tell((PerlIO*)fd, ErrorNo());
e3b8966e 943}
944
945int _win32_dup(int fd)
946{
4c2891ed 947 return pPerl->PL_piLIO->Dup(fd, ErrorNo());
e3b8966e 948}
949
950int _win32_dup2(int h1, int h2)
951{
4c2891ed 952 return pPerl->PL_piLIO->Dup2(h1, h2, ErrorNo());
e3b8966e 953}
954
955int _win32_open(const char *path, int oflag,...)
956{
4c2891ed 957 return pPerl->PL_piLIO->Open(path, oflag, ErrorNo());
e3b8966e 958}
959
960int _win32_close(int fd)
961{
4c2891ed 962 return pPerl->PL_piLIO->Close(fd, ErrorNo());
e3b8966e 963}
964
965int _win32_read(int fd, void *buf, unsigned int cnt)
966{
4c2891ed 967 return pPerl->PL_piLIO->Read(fd, buf, cnt, ErrorNo());
e3b8966e 968}
969
970int _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
975int _win32_times(struct tms *timebuf)
976{
4c2891ed 977 return pPerl->PL_piProc->Times(timebuf);
e3b8966e 978}
979
980int _win32_ioctl(int i, unsigned int u, char *data)
981{
4c2891ed 982 return pPerl->PL_piLIO->IOCtl(i, u, data, ErrorNo());
e3b8966e 983}
984
985int _win32_utime(const char *f, struct utimbuf *t)
986{
4c2891ed 987 return pPerl->PL_piLIO->Utime((char*)f, t, ErrorNo());
e3b8966e 988}
989
990char* _win32_getenv(const char *name)
991{
4c2891ed 992 return pPerl->PL_piENV->Getenv(name, ErrorNo());
e3b8966e 993}
994
995int _win32_open_osfhandle(long handle, int flags)
996{
4c2891ed 997 return pPerl->PL_piStdIO->OpenOSfhandle(handle, flags);
e3b8966e 998}
999
1000long _win32_get_osfhandle(int fd)
1001{
4c2891ed 1002 return pPerl->PL_piStdIO->GetOSfhandle(fd);
e3b8966e 1003}
891fc7f2 1004
1005u_long _win32_htonl (u_long hostlong)
1006{
4c2891ed 1007 return pPerl->PL_piSock->Htonl(hostlong);
891fc7f2 1008}
1009
1010u_short _win32_htons (u_short hostshort)
1011{
4c2891ed 1012 return pPerl->PL_piSock->Htons(hostshort);
891fc7f2 1013}
1014
1015u_long _win32_ntohl (u_long netlong)
1016{
4c2891ed 1017 return pPerl->PL_piSock->Ntohl(netlong);
891fc7f2 1018}
1019
1020u_short _win32_ntohs (u_short netshort)
1021{
4c2891ed 1022 return pPerl->PL_piSock->Ntohs(netshort);
891fc7f2 1023}
1024
1025unsigned long _win32_inet_addr (const char * cp)
1026{
4c2891ed 1027 return pPerl->PL_piSock->InetAddr(cp, ErrorNo());
891fc7f2 1028}
1029
1030char * _win32_inet_ntoa (struct in_addr in)
1031{
4c2891ed 1032 return pPerl->PL_piSock->InetNtoa(in, ErrorNo());
891fc7f2 1033}
1034
1035SOCKET _win32_socket (int af, int type, int protocol)
1036{
4c2891ed 1037 return pPerl->PL_piSock->Socket(af, type, protocol, ErrorNo());
891fc7f2 1038}
1039
1040int _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
1045int _win32_listen (SOCKET s, int backlog)
1046{
4c2891ed 1047 return pPerl->PL_piSock->Listen(s, backlog, ErrorNo());
891fc7f2 1048}
1049
1050SOCKET _win32_accept (SOCKET s, struct sockaddr *addr, int *addrlen)
1051{
4c2891ed 1052 return pPerl->PL_piSock->Accept(s, addr, addrlen, ErrorNo());
891fc7f2 1053}
1054
1055int _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
1060int _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
1065int _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
1071int _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
1076int _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
1082int _win32_shutdown (SOCKET s, int how)
1083{
4c2891ed 1084 return pPerl->PL_piSock->Shutdown(s, how, ErrorNo());
891fc7f2 1085}
1086
1087int _win32_closesocket (SOCKET s)
1088{
4c2891ed 1089 return pPerl->PL_piSock->Closesocket(s, ErrorNo());
891fc7f2 1090}
1091
1092int _win32_ioctlsocket (SOCKET s, long cmd, u_long *argp)
1093{
4c2891ed 1094 return pPerl->PL_piSock->Ioctlsocket(s, cmd, argp, ErrorNo());
891fc7f2 1095}
1096
1097int _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
1103int _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
1108int _win32_getpeername (SOCKET s, struct sockaddr *name, int * namelen)
1109{
4c2891ed 1110 return pPerl->PL_piSock->Getpeername(s, name, namelen, ErrorNo());
891fc7f2 1111}
1112
1113int _win32_getsockname (SOCKET s, struct sockaddr *name, int * namelen)
1114{
4c2891ed 1115 return pPerl->PL_piSock->Getsockname(s, name, namelen, ErrorNo());
891fc7f2 1116}
1117
1118int _win32_gethostname (char * name, int namelen)
1119{
4c2891ed 1120 return pPerl->PL_piSock->Gethostname(name, namelen, ErrorNo());
891fc7f2 1121}
1122
1123struct hostent * _win32_gethostbyname(const char * name)
1124{
4c2891ed 1125 return pPerl->PL_piSock->Gethostbyname(name, ErrorNo());
891fc7f2 1126}
1127
1128struct 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
1133struct protoent * _win32_getprotobyname(const char * name)
1134{
4c2891ed 1135 return pPerl->PL_piSock->Getprotobyname(name, ErrorNo());
891fc7f2 1136}
1137
1138struct protoent * _win32_getprotobynumber(int proto)
1139{
4c2891ed 1140 return pPerl->PL_piSock->Getprotobynumber(proto, ErrorNo());
891fc7f2 1141}
1142
1143struct servent * _win32_getservbyname(const char * name, const char * proto)
1144{
4c2891ed 1145 return pPerl->PL_piSock->Getservbyname(name, proto, ErrorNo());
891fc7f2 1146}
1147
1148struct servent * _win32_getservbyport(int port, const char * proto)
1149{
4c2891ed 1150 return pPerl->PL_piSock->Getservbyport(port, proto, ErrorNo());
891fc7f2 1151}
1152
1153int _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
1159void _win32_endnetent(void)
1160{
4c2891ed 1161 pPerl->PL_piSock->Endnetent(ErrorNo());
891fc7f2 1162}
1163
1164void _win32_endhostent(void)
1165{
4c2891ed 1166 pPerl->PL_piSock->Endhostent(ErrorNo());
891fc7f2 1167}
1168
1169void _win32_endprotoent(void)
1170{
4c2891ed 1171 pPerl->PL_piSock->Endprotoent(ErrorNo());
891fc7f2 1172}
1173
1174void _win32_endservent(void)
1175{
4c2891ed 1176 pPerl->PL_piSock->Endservent(ErrorNo());
891fc7f2 1177}
1178
1179struct netent * _win32_getnetent(void)
1180{
4c2891ed 1181 return pPerl->PL_piSock->Getnetent(ErrorNo());
891fc7f2 1182}
1183
1184struct netent * _win32_getnetbyname(char *name)
1185{
4c2891ed 1186 return pPerl->PL_piSock->Getnetbyname(name, ErrorNo());
891fc7f2 1187}
1188
1189struct netent * _win32_getnetbyaddr(long net, int type)
1190{
4c2891ed 1191 return pPerl->PL_piSock->Getnetbyaddr(net, type, ErrorNo());
891fc7f2 1192}
1193
1194struct protoent *_win32_getprotoent(void)
1195{
4c2891ed 1196 return pPerl->PL_piSock->Getprotoent(ErrorNo());
891fc7f2 1197}
1198
1199struct servent *_win32_getservent(void)
1200{
4c2891ed 1201 return pPerl->PL_piSock->Getservent(ErrorNo());
891fc7f2 1202}
1203
1204void _win32_sethostent(int stayopen)
1205{
4c2891ed 1206 pPerl->PL_piSock->Sethostent(stayopen, ErrorNo());
891fc7f2 1207}
1208
1209void _win32_setnetent(int stayopen)
1210{
4c2891ed 1211 pPerl->PL_piSock->Setnetent(stayopen, ErrorNo());
891fc7f2 1212}
1213
1214void _win32_setprotoent(int stayopen)
1215{
4c2891ed 1216 pPerl->PL_piSock->Setprotoent(stayopen, ErrorNo());
891fc7f2 1217}
1218
1219void _win32_setservent(int stayopen)
1220{
4c2891ed 1221 pPerl->PL_piSock->Setservent(stayopen, ErrorNo());
891fc7f2 1222}
e3b8966e 1223} /* extern "C" */
1224EOCODE
1225
1226
1227print HDRFILE <<EOCODE;
9e6b2b00 1228#undef Perl_op_desc
1229char ** _Perl_op_desc ();
1230#define Perl_op_desc (_Perl_op_desc())
1231
1232#undef Perl_op_name
1233char ** _Perl_op_name ();
1234#define Perl_op_name (_Perl_op_name())
1235
1236#undef Perl_no_modify
58a50f62 1237char * _Perl_no_modify ();
9e6b2b00 1238#define Perl_no_modify (_Perl_no_modify())
1239
1240#undef Perl_opargs
58a50f62 1241U32 * _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 1478int * _win32_errno(void);
1479FILE* _win32_stdin(void);
1480FILE* _win32_stdout(void);
1481FILE* _win32_stderr(void);
1482int _win32_ferror(FILE *fp);
1483int _win32_feof(FILE *fp);
1484char* _win32_strerror(int e);
1485void _win32_perror(const char *str);
1486int _win32_fprintf(FILE *pf, const char *format, ...);
1487int _win32_printf(const char *format, ...);
1488int _win32_vfprintf(FILE *pf, const char *format, va_list arg);
1489int _win32_vprintf(const char *format, va_list arg);
1490size_t _win32_fread(void *buf, size_t size, size_t count, FILE *pf);
1491size_t _win32_fwrite(const void *buf, size_t size, size_t count, FILE *pf);
1492FILE* _win32_fopen(const char *path, const char *mode);
1493FILE* _win32_fdopen(int fh, const char *mode);
1494FILE* _win32_freopen(const char *path, const char *mode, FILE *pf);
1495int _win32_fclose(FILE *pf);
1496int _win32_fputs(const char *s,FILE *pf);
1497int _win32_fputc(int c,FILE *pf);
1498int _win32_ungetc(int c,FILE *pf);
1499int _win32_getc(FILE *pf);
1500int _win32_fileno(FILE *pf);
1501void _win32_clearerr(FILE *pf);
1502int _win32_fflush(FILE *pf);
1503long _win32_ftell(FILE *pf);
1504int _win32_fseek(FILE *pf,long offset,int origin);
1505int _win32_fgetpos(FILE *pf,fpos_t *p);
1506int _win32_fsetpos(FILE *pf,const fpos_t *p);
1507void _win32_rewind(FILE *pf);
1508FILE* _win32_tmpfile(void);
1509void _win32_abort(void);
1510int _win32_fstat(int fd,struct stat *sbufptr);
1511int _win32_stat(const char *name,struct stat *sbufptr);
1512int _win32_pipe( int *phandles, unsigned int psize, int textmode );
1513FILE* _win32_popen( const char *command, const char *mode );
1514int _win32_pclose( FILE *pf);
e24c7c18 1515int _win32_rename( const char *oldname, const char *newname);
e3b8966e 1516int _win32_setmode( int fd, int mode);
1517long _win32_lseek( int fd, long offset, int origin);
1518long _win32_tell( int fd);
1519int _win32_dup( int fd);
1520int _win32_dup2(int h1, int h2);
1521int _win32_open(const char *path, int oflag,...);
1522int _win32_close(int fd);
1523int _win32_eof(int fd);
1524int _win32_read(int fd, void *buf, unsigned int cnt);
1525int _win32_write(int fd, const void *buf, unsigned int cnt);
1526int _win32_mkdir(const char *dir, int mode);
1527int _win32_rmdir(const char *dir);
1528int _win32_chdir(const char *dir);
1529void _win32_setbuf(FILE *pf, char *buf);
1530int _win32_setvbuf(FILE *pf, char *buf, int type, size_t size);
1531char* _win32_fgets(char *s, int n, FILE *pf);
1532char* _win32_gets(char *s);
1533int _win32_fgetc(FILE *pf);
1534int _win32_putc(int c, FILE *pf);
1535int _win32_puts(const char *s);
1536int _win32_getchar(void);
1537int _win32_putchar(int c);
1538void* _win32_malloc(size_t size);
1539void* _win32_calloc(size_t numitems, size_t size);
1540void* _win32_realloc(void *block, size_t size);
1541void _win32_free(void *block);
1542unsigned _win32_sleep(unsigned int);
1543int _win32_spawnvp(int mode, const char *cmdname, const char *const *argv);
1544int _win32_times(struct tms *timebuf);
1545int _win32_stat(const char *path, struct stat *buf);
1546int _win32_ioctl(int i, unsigned int u, char *data);
1547int _win32_utime(const char *f, struct utimbuf *t);
1548char* _win32_getenv(const char *name);
1549int _win32_open_osfhandle(long handle, int flags);
1550long _win32_get_osfhandle(int fd);
1551
891fc7f2 1552u_long _win32_htonl (u_long hostlong);
1553u_short _win32_htons (u_short hostshort);
1554u_long _win32_ntohl (u_long netlong);
1555u_short _win32_ntohs (u_short netshort);
1556unsigned long _win32_inet_addr (const char * cp);
1557char * _win32_inet_ntoa (struct in_addr in);
1558
1559SOCKET _win32_socket (int af, int type, int protocol);
1560int _win32_bind (SOCKET s, const struct sockaddr *addr, int namelen);
1561int _win32_listen (SOCKET s, int backlog);
1562SOCKET _win32_accept (SOCKET s, struct sockaddr *addr, int *addrlen);
1563int _win32_connect (SOCKET s, const struct sockaddr *name, int namelen);
1564int _win32_send (SOCKET s, const char * buf, int len, int flags);
1565int _win32_sendto (SOCKET s, const char * buf, int len, int flags,
1566 const struct sockaddr *to, int tolen);
1567int _win32_recv (SOCKET s, char * buf, int len, int flags);
1568int _win32_recvfrom (SOCKET s, char * buf, int len, int flags,
1569 struct sockaddr *from, int * fromlen);
1570int _win32_shutdown (SOCKET s, int how);
1571int _win32_closesocket (SOCKET s);
1572int _win32_ioctlsocket (SOCKET s, long cmd, u_long *argp);
1573int _win32_setsockopt (SOCKET s, int level, int optname,
1574 const char * optval, int optlen);
1575int _win32_getsockopt (SOCKET s, int level, int optname, char * optval, int *optlen);
1576int _win32_getpeername (SOCKET s, struct sockaddr *name, int * namelen);
1577int _win32_getsockname (SOCKET s, struct sockaddr *name, int * namelen);
1578int _win32_gethostname (char * name, int namelen);
1579struct hostent * _win32_gethostbyname(const char * name);
1580struct hostent * _win32_gethostbyaddr(const char * addr, int len, int type);
1581struct protoent * _win32_getprotobyname(const char * name);
1582struct protoent * _win32_getprotobynumber(int proto);
1583struct servent * _win32_getservbyname(const char * name, const char * proto);
1584struct servent * _win32_getservbyport(int port, const char * proto);
1585int _win32_select (int nfds, Perl_fd_set *rfds, Perl_fd_set *wfds, Perl_fd_set *xfds,
1586 const struct timeval *timeout);
1587void _win32_endnetent(void);
1588void _win32_endhostent(void);
1589void _win32_endprotoent(void);
1590void _win32_endservent(void);
1591struct netent * _win32_getnetent(void);
1592struct netent * _win32_getnetbyname(char *name);
1593struct netent * _win32_getnetbyaddr(long net, int type);
1594struct protoent *_win32_getprotoent(void);
1595struct servent *_win32_getservent(void);
1596void _win32_sethostent(int stayopen);
1597void _win32_setnetent(int stayopen);
1598void _win32_setprotoent(int stayopen);
1599void _win32_setservent(int stayopen);
1600
e3b8966e 1601#pragma warning(once : 4113)
1602EOCODE
1603
1604
1605close HDRFILE;
1606close OUTFILE;