diff --git a/Makefile.in b/Makefile.in index a5c4f7b1..860d4d26 100644 --- a/Makefile.in +++ b/Makefile.in @@ -195,6 +195,7 @@ PERLREQ = config/unconfig.h \ macros/macros.c \ asm/pptok.ph asm/directbl.c asm/directiv.h \ asm/warnings.c include/warnings.h doc/warnings.src \ + misc/nasmtok.el \ version.h version.mac version.mak nsis/version.nsh INSDEP = x86/insns.dat x86/insns.pl x86/insns-iflags.ph x86/iflags.ph @@ -336,6 +337,11 @@ asm/directbl.c: asm/directiv.dat nasmlib/perfhash.pl perllib/phash.ph $(RUNPERL) $(srcdir)/nasmlib/perfhash.pl c \ $(srcdir)/asm/directiv.dat asm/directbl.c +# Emacs token files +misc/nasmtok.el: misc/emacstbl.pl asm/tokhash.c asm/pptok.c \ + asm/directiv.dat version + $(RUNPERL) $< $@ "$(srcdir)" "$(objdir)" + #-- End Generated File Rules --# perlreq: $(PERLREQ) diff --git a/Mkfiles/msvc.mak b/Mkfiles/msvc.mak index 25c50df3..cf71fffc 100644 --- a/Mkfiles/msvc.mak +++ b/Mkfiles/msvc.mak @@ -154,6 +154,7 @@ PERLREQ = config\unconfig.h \ macros\macros.c \ asm\pptok.ph asm\directbl.c asm\directiv.h \ asm\warnings.c include\warnings.h doc\warnings.src \ + misc\nasmtok.el \ version.h version.mac version.mak nsis\version.nsh INSDEP = x86\insns.dat x86\insns.pl x86\insns-iflags.ph x86\iflags.ph @@ -295,6 +296,11 @@ asm\directbl.c: asm\directiv.dat nasmlib\perfhash.pl perllib\phash.ph $(RUNPERL) $(srcdir)\nasmlib\perfhash.pl c \ $(srcdir)\asm\directiv.dat asm\directbl.c +# Emacs token files +misc\nasmtok.el: misc\emacstbl.pl asm\tokhash.c asm\pptok.c \ + asm\directiv.dat version + $(RUNPERL) $< $@ "$(srcdir)" "$(objdir)" + #-- End Generated File Rules --# perlreq: $(PERLREQ) diff --git a/Mkfiles/openwcom.mak b/Mkfiles/openwcom.mak index 589650d7..5394d85d 100644 --- a/Mkfiles/openwcom.mak +++ b/Mkfiles/openwcom.mak @@ -167,6 +167,7 @@ PERLREQ = config\unconfig.h & macros\macros.c & asm\pptok.ph asm\directbl.c asm\directiv.h & asm\warnings.c include\warnings.h doc\warnings.src & + misc\nasmtok.el & version.h version.mac version.mak nsis\version.nsh INSDEP = x86\insns.dat x86\insns.pl x86\insns-iflags.ph x86\iflags.ph @@ -308,6 +309,11 @@ asm\directbl.c: asm\directiv.dat nasmlib\perfhash.pl perllib\phash.ph $(RUNPERL) $(srcdir)\nasmlib\perfhash.pl c & $(srcdir)\asm\directiv.dat asm\directbl.c +# Emacs token files +misc\nasmtok.el: misc\emacstbl.pl asm\tokhash.c asm\pptok.c & + asm\directiv.dat version + $(RUNPERL) $< $@ "$(srcdir)" "$(objdir)" + #-- End Generated File Rules --# perlreq: $(PERLREQ) .SYMBOLIC diff --git a/misc/emacstbl.pl b/misc/emacstbl.pl index 4c7673c9..341810d8 100755 --- a/misc/emacstbl.pl +++ b/misc/emacstbl.pl @@ -31,6 +31,8 @@ my %override = ( 'id' => 'special', 'floatize' => 'function', 'strfunc' => 'function', 'ifunc' => 'function', + 'insn' => 'instruction', + 'reg' => 'register', 'seg' => 'special', 'wrt' => 'special' ); @@ -124,6 +126,18 @@ sub read_directiv_dat($) { close($dd); } +my $version; +sub read_version($) { + my($vfile) = @_; + open(my $v, '<', $vfile) + or die "$0:$vfile: $!\n"; + + $version = <$v>; + chomp $version; + + close($v); +} + sub make_lines($$@) { my $maxline = shift @_; my $indent = shift @_; @@ -171,12 +185,23 @@ sub write_output($) { open(my $out, '>', $outfile) or die "$0:$outfile: $!\n"; + my($vol,$dir,$file) = File::Spec->splitpath($outfile); + + print $out ";;; ${file} --- lists of NASM assembler tokens\n"; + print $out ";;;\n"; + print $out ";;; This file contains list of tokens from the NASM x86\n"; + print $out ";;; assembler, automatically extracted from NASM ${version}.\n"; + print $out ";;;\n"; + print $out ";;; This file is intended to be (require)d from a `nasm-mode\'\n"; + print $out ";;; major mode definition.\n"; + foreach my $type (sort keys(%tokens)) { - print $out "(defconst nasm-${type}\n"; + print $out "\n(defconst nasm-${type}\n"; print $out " \'("; print $out make_lines(78, 4, quote_for_emacs(sort @{$tokens{$type}})); - print $out "))\n"; + print $out ")\n"; + print $out " \"NASM ${version} ${type} tokens for `nasm-mode\'.\")\n"; } close($out); @@ -185,5 +210,6 @@ sub write_output($) { read_tokhash_c(File::Spec->catfile($objdir, 'asm', 'tokhash.c')); read_pptok_c(File::Spec->catfile($objdir, 'asm', 'pptok.c')); read_directiv_dat(File::Spec->catfile($srcdir, 'asm', 'directiv.dat')); +read_version(File::Spec->catfile($srcdir, 'version')); write_output($outfile);