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