[nasm:emacs] misc/emacstbl.pl: add NASM version to output, add to Makefile
nasm-bot for H. Peter Anvin
hpa at zytor.com
Thu Nov 17 15:36:04 PST 2022
Commit-ID: 2d5cf171305a329747d6c0efbb5855444711285a
Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=2d5cf171305a329747d6c0efbb5855444711285a
Author: H. Peter Anvin <hpa at zytor.com>
AuthorDate: Thu, 17 Nov 2022 12:52:52 -0800
Committer: H. Peter Anvin <hpa at zytor.com>
CommitDate: Thu, 17 Nov 2022 12:52:52 -0800
misc/emacstbl.pl: add NASM version to output, add to Makefile
Include the version number in the output (misc/nasmtok.el) and add a
rule for generating it to the Makefiles.
Signed-off-by: H. Peter Anvin <hpa at zytor.com>
---
Makefile.in | 6 ++++++
Mkfiles/msvc.mak | 6 ++++++
Mkfiles/openwcom.mak | 6 ++++++
misc/emacstbl.pl | 30 ++++++++++++++++++++++++++++--
4 files changed, 46 insertions(+), 2 deletions(-)
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);
More information about the Nasm-commits
mailing list