File: gendef0

package info (click to toggle)
libio-aio-perl 4.81-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 988 kB
  • sloc: ansic: 5,008; perl: 603; makefile: 11; sh: 2
file content (36 lines) | stat: -rwxr-xr-x 683 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/perl

open STDIN, "<AIO.xs"
   or die "AIO.xs: $!";

open STDOUT, ">def0.h"
   or die "def0.h: $!";

print <<EOF;
/* GENERATED FILE */
/* use ./gendef0 to regenerate this file */
EOF

while (<>) {
   if (/\/\*GENDEF0_SYSCALL\((.*),(.*)\)\*\//) {
      my ($syscall, $linux) = ($1, $2);
      print <<EOF;
#if HAVE_SYSCALL
# if __linux__ && !defined(SYS_$syscall)
#  define SYS_$syscall $linux
# endif
#else
# undef SYS_$syscall
#endif
#ifndef SYS_$syscall
# define SYS_$syscall -1
#endif
EOF
   }

   if (/^\s*const_iv\s*\((\S+)\)\s*$/ || /^\s*const_niv\s*\([^,]+,\s*(\S+)\)\s*$/) {
      print "#ifndef $1\n",
            "#define $1 0\n",
            "#endif\n";
   }
}