|
31 | 31 | 'floatize' => 'function', |
32 | 32 | 'strfunc' => 'function', |
33 | 33 | 'ifunc' => 'function', |
| 34 | + 'insn' => 'instruction', |
| 35 | + 'reg' => 'register', |
34 | 36 | 'seg' => 'special', |
35 | 37 | 'wrt' => 'special' ); |
36 | 38 |
|
|
124 | 126 | close($dd); |
125 | 127 | } |
126 | 128 |
|
| 129 | +my $version; |
| 130 | +sub read_version($) { |
| 131 | + my($vfile) = @_; |
| 132 | + open(my $v, '<', $vfile) |
| 133 | + or die "$0:$vfile: $!\n"; |
| 134 | + |
| 135 | + $version = <$v>; |
| 136 | + chomp $version; |
| 137 | + |
| 138 | + close($v); |
| 139 | +} |
| 140 | + |
127 | 141 | sub make_lines($$@) { |
128 | 142 | my $maxline = shift @_; |
129 | 143 | my $indent = shift @_; |
@@ -171,12 +185,23 @@ ($) |
171 | 185 | open(my $out, '>', $outfile) |
172 | 186 | or die "$0:$outfile: $!\n"; |
173 | 187 |
|
| 188 | + my($vol,$dir,$file) = File::Spec->splitpath($outfile); |
| 189 | + |
| 190 | + print $out ";;; ${file} --- lists of NASM assembler tokens\n"; |
| 191 | + print $out ";;;\n"; |
| 192 | + print $out ";;; This file contains list of tokens from the NASM x86\n"; |
| 193 | + print $out ";;; assembler, automatically extracted from NASM ${version}.\n"; |
| 194 | + print $out ";;;\n"; |
| 195 | + print $out ";;; This file is intended to be (require)d from a `nasm-mode\'\n"; |
| 196 | + print $out ";;; major mode definition.\n"; |
| 197 | + |
174 | 198 | foreach my $type (sort keys(%tokens)) { |
175 | | - print $out "(defconst nasm-${type}\n"; |
| 199 | + print $out "\n(defconst nasm-${type}\n"; |
176 | 200 | print $out " \'("; |
177 | 201 |
|
178 | 202 | print $out make_lines(78, 4, quote_for_emacs(sort @{$tokens{$type}})); |
179 | | - print $out "))\n"; |
| 203 | + print $out ")\n"; |
| 204 | + print $out " \"NASM ${version} ${type} tokens for `nasm-mode\'.\")\n"; |
180 | 205 | } |
181 | 206 |
|
182 | 207 | close($out); |
|
185 | 210 | read_tokhash_c(File::Spec->catfile($objdir, 'asm', 'tokhash.c')); |
186 | 211 | read_pptok_c(File::Spec->catfile($objdir, 'asm', 'pptok.c')); |
187 | 212 | read_directiv_dat(File::Spec->catfile($srcdir, 'asm', 'directiv.dat')); |
| 213 | +read_version(File::Spec->catfile($srcdir, 'version')); |
188 | 214 |
|
189 | 215 | write_output($outfile); |
0 commit comments