| 1 |
root |
1.1 |
BEGIN { |
| 2 |
|
|
# Get function prototypes |
| 3 |
|
|
require 'regen_lib.pl'; |
| 4 |
|
|
} |
| 5 |
|
|
#use Fatal qw(open close rename chmod unlink); |
| 6 |
|
|
open DESC, 'regcomp.sym'; |
| 7 |
|
|
$ind = 0; |
| 8 |
|
|
|
| 9 |
|
|
while (<DESC>) { |
| 10 |
|
|
next if /^\s*($|\#)/; |
| 11 |
|
|
$ind++; |
| 12 |
|
|
chomp; |
| 13 |
|
|
($name[$ind], $desc, $rest[$ind]) = split /\t+/, $_, 3; |
| 14 |
|
|
($type[$ind], $code[$ind], $args[$ind], $longj[$ind]) |
| 15 |
|
|
= split /[,\s]\s*/, $desc, 4; |
| 16 |
|
|
} |
| 17 |
|
|
close DESC; |
| 18 |
|
|
$tot = $ind; |
| 19 |
|
|
|
| 20 |
|
|
$tmp_h = 'tmp_reg.h'; |
| 21 |
|
|
|
| 22 |
|
|
unlink $tmp_h if -f $tmp_h; |
| 23 |
|
|
|
| 24 |
|
|
open OUT, ">$tmp_h"; |
| 25 |
|
|
binmode OUT; |
| 26 |
|
|
|
| 27 |
|
|
print OUT <<EOP; |
| 28 |
|
|
/* !!!!!!! DO NOT EDIT THIS FILE !!!!!!! |
| 29 |
|
|
This file is built by regcomp.pl from regcomp.sym. |
| 30 |
|
|
Any changes made here will be lost! |
| 31 |
|
|
*/ |
| 32 |
|
|
|
| 33 |
|
|
EOP |
| 34 |
|
|
|
| 35 |
|
|
$ind = 0; |
| 36 |
|
|
while (++$ind <= $tot) { |
| 37 |
|
|
$oind = $ind - 1; |
| 38 |
|
|
$hind = sprintf "%#4x", $oind; |
| 39 |
|
|
print OUT <<EOP; |
| 40 |
|
|
#define $name[$ind] $oind /* $hind $rest[$ind] */ |
| 41 |
|
|
EOP |
| 42 |
|
|
} |
| 43 |
|
|
|
| 44 |
|
|
print OUT <<EOP; |
| 45 |
|
|
|
| 46 |
|
|
#ifndef DOINIT |
| 47 |
|
|
EXTCONST U8 PL_regkind[]; |
| 48 |
|
|
#else |
| 49 |
|
|
EXTCONST U8 PL_regkind[] = { |
| 50 |
|
|
EOP |
| 51 |
|
|
|
| 52 |
|
|
$ind = 0; |
| 53 |
|
|
while (++$ind <= $tot) { |
| 54 |
|
|
print OUT <<EOP; |
| 55 |
|
|
$type[$ind], /* $name[$ind] */ |
| 56 |
|
|
EOP |
| 57 |
|
|
} |
| 58 |
|
|
|
| 59 |
|
|
print OUT <<EOP; |
| 60 |
|
|
}; |
| 61 |
|
|
#endif |
| 62 |
|
|
|
| 63 |
|
|
|
| 64 |
|
|
#ifdef REG_COMP_C |
| 65 |
|
|
static const U8 regarglen[] = { |
| 66 |
|
|
EOP |
| 67 |
|
|
|
| 68 |
|
|
$ind = 0; |
| 69 |
|
|
while (++$ind <= $tot) { |
| 70 |
|
|
$size = 0; |
| 71 |
|
|
$size = "EXTRA_SIZE(struct regnode_$args[$ind])" if $args[$ind]; |
| 72 |
|
|
|
| 73 |
|
|
print OUT <<EOP; |
| 74 |
|
|
$size, /* $name[$ind] */ |
| 75 |
|
|
EOP |
| 76 |
|
|
} |
| 77 |
|
|
|
| 78 |
|
|
print OUT <<EOP; |
| 79 |
|
|
}; |
| 80 |
|
|
|
| 81 |
|
|
static const char reg_off_by_arg[] = { |
| 82 |
|
|
EOP |
| 83 |
|
|
|
| 84 |
|
|
$ind = 0; |
| 85 |
|
|
while (++$ind <= $tot) { |
| 86 |
|
|
$size = $longj[$ind] || 0; |
| 87 |
|
|
|
| 88 |
|
|
print OUT <<EOP; |
| 89 |
|
|
$size, /* $name[$ind] */ |
| 90 |
|
|
EOP |
| 91 |
|
|
} |
| 92 |
|
|
|
| 93 |
|
|
print OUT <<EOP; |
| 94 |
|
|
}; |
| 95 |
|
|
|
| 96 |
|
|
#ifdef DEBUGGING |
| 97 |
|
|
static const char * const reg_name[] = { |
| 98 |
|
|
EOP |
| 99 |
|
|
|
| 100 |
|
|
$ind = 0; |
| 101 |
|
|
while (++$ind <= $tot) { |
| 102 |
|
|
$hind = sprintf "%#4x", $ind-1; |
| 103 |
|
|
$size = $longj[$ind] || 0; |
| 104 |
|
|
|
| 105 |
|
|
print OUT <<EOP; |
| 106 |
|
|
"$name[$ind]", /* $hind */ |
| 107 |
|
|
EOP |
| 108 |
|
|
} |
| 109 |
|
|
|
| 110 |
|
|
print OUT <<EOP; |
| 111 |
|
|
}; |
| 112 |
|
|
|
| 113 |
|
|
static const int reg_num = $tot; |
| 114 |
|
|
|
| 115 |
|
|
#endif /* DEBUGGING */ |
| 116 |
|
|
#endif /* REG_COMP_C */ |
| 117 |
|
|
|
| 118 |
|
|
EOP |
| 119 |
|
|
|
| 120 |
|
|
close OUT or die "close $tmp_h: $!"; |
| 121 |
|
|
|
| 122 |
|
|
safer_rename $tmp_h, 'regnodes.h'; |