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