root преди 7 години
родител
ревизия
d764e5efae
променени са 100 файла, в които са добавени 70723 реда и са изтрити 0 реда
  1. 1 0
      build.sh
  2. 1 0
      buildfdk-aac.sh
  3. 1 0
      buildffmpeg.sh
  4. 17 0
      buildnasm.sh
  5. 2 0
      buildx264.sh
  6. 137 0
      nasm/AUTHORS
  7. 2 0
      nasm/CHANGES
  8. 2905 0
      nasm/ChangeLog
  9. 102 0
      nasm/INSTALL
  10. 29 0
      nasm/LICENSE
  11. 529 0
      nasm/Makefile
  12. 481 0
      nasm/Makefile.dep
  13. 529 0
      nasm/Makefile.in
  14. 46 0
      nasm/Mkfiles/README
  15. 399 0
      nasm/Mkfiles/msvc.mak
  16. 758 0
      nasm/Mkfiles/openwcom.mak
  17. 23 0
      nasm/README
  18. 116 0
      nasm/SubmittingPatches
  19. 376 0
      nasm/TODO
  20. 202 0
      nasm/aclocal.m4
  21. 2997 0
      nasm/asm/assemble.c
  22. 54 0
      nasm/asm/assemble.h
  23. 126 0
      nasm/asm/directbl.c
  24. 515 0
      nasm/asm/directiv.c
  25. 103 0
      nasm/asm/directiv.dat
  26. 77 0
      nasm/asm/directiv.h
  27. 211 0
      nasm/asm/error.c
  28. 1023 0
      nasm/asm/eval.c
  29. 49 0
      nasm/asm/eval.h
  30. 79 0
      nasm/asm/exprdump.c
  31. 200 0
      nasm/asm/exprlib.c
  32. 955 0
      nasm/asm/float.c
  33. 54 0
      nasm/asm/float.h
  34. 703 0
      nasm/asm/labels.c
  35. 379 0
      nasm/asm/listing.c
  36. 113 0
      nasm/asm/listing.h
  37. 2042 0
      nasm/asm/nasm.c
  38. 1208 0
      nasm/asm/parser.c
  39. 45 0
      nasm/asm/parser.h
  40. 109 0
      nasm/asm/phash.pl
  41. 511 0
      nasm/asm/pptok.c
  42. 96 0
      nasm/asm/pptok.dat
  43. 158 0
      nasm/asm/pptok.h
  44. 99 0
      nasm/asm/pptok.ph
  45. 271 0
      nasm/asm/pptok.pl
  46. 274 0
      nasm/asm/pragma.c
  47. 196 0
      nasm/asm/preproc-nop.c
  48. 5488 0
      nasm/asm/preproc.c
  49. 56 0
      nasm/asm/preproc.h
  50. 479 0
      nasm/asm/quote.c
  51. 44 0
      nasm/asm/quote.h
  52. 70 0
      nasm/asm/rdstrnum.c
  53. 51 0
      nasm/asm/segalloc.c
  54. 345 0
      nasm/asm/stdscan.c
  55. 49 0
      nasm/asm/stdscan.h
  56. 359 0
      nasm/asm/strfunc.c
  57. 135 0
      nasm/asm/tokens.dat
  58. 11 0
      nasm/asm/tokens.h
  59. 6431 0
      nasm/asm/tokhash.c
  60. 284 0
      nasm/asm/tokhash.pl
  61. 8 0
      nasm/autogen.sh
  62. 64 0
      nasm/common/common.c
  63. 6482 0
      nasm/config.log
  64. 1129 0
      nasm/config.status
  65. 544 0
      nasm/config/config.h
  66. 543 0
      nasm/config/config.h.in
  67. 192 0
      nasm/config/msvc.h
  68. 51 0
      nasm/config/unknown.h
  69. 74 0
      nasm/config/watcom.h
  70. 10172 0
      nasm/configure
  71. 318 0
      nasm/configure.ac
  72. 25 0
      nasm/contrib/MSVC6.txt
  73. 16 0
      nasm/contrib/VSrules/nasm.README
  74. 79 0
      nasm/contrib/VSrules/nasm.rules
  75. 1765 0
      nasm/disasm/disasm.c
  76. 49 0
      nasm/disasm/disasm.h
  77. 396 0
      nasm/disasm/ndisasm.c
  78. 132 0
      nasm/disasm/sync.c
  79. 45 0
      nasm/disasm/sync.h
  80. 90 0
      nasm/doc/Makefile
  81. 90 0
      nasm/doc/Makefile.in
  82. 20 0
      nasm/doc/README
  83. 102 0
      nasm/doc/afmmetrics.ph
  84. 2698 0
      nasm/doc/changes.src
  85. 180 0
      nasm/doc/findfont.ph
  86. 1294 0
      nasm/doc/genps.pl
  87. 401 0
      nasm/doc/head.ps
  88. 108 0
      nasm/doc/inslist.pl
  89. 290 0
      nasm/doc/internal.doc
  90. 1 0
      nasm/doc/local.css
  91. 150 0
      nasm/doc/nasmdoc.css
  92. 8475 0
      nasm/doc/nasmdoc.src
  93. 212 0
      nasm/doc/nasmlogo.eps
  94. BIN
      nasm/doc/nasmlogw.png
  95. 116 0
      nasm/doc/opt_var.txt
  96. 53 0
      nasm/doc/psfonts.ph
  97. 118 0
      nasm/doc/pspdf.pl
  98. 25 0
      nasm/doc/pswidth.ph
  99. 1111 0
      nasm/doc/rdsrc.pl
  100. 0 0
      nasm/doc/ttfmetrics.ph

+ 1 - 0
build.sh

@@ -12,6 +12,7 @@ git submodule update
 mkdir debs || true
 
 ./buildfdk-aac.sh
+./buildnasm.sh
 ./buildx264.sh
 
 ./buildffmpeg.sh

+ 1 - 0
buildfdk-aac.sh

@@ -10,4 +10,5 @@ make
 checkinstall --pkgname=fdk-aac --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default
 ldconfig
 mv *.deb ../debs
+rm -f description-pak
 cd -

+ 1 - 0
buildffmpeg.sh

@@ -11,4 +11,5 @@ make
 checkinstall --pkgname=ffmpeg --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default
 
 mv *.deb ../debs
+rm -f description-pak
 cd -

+ 17 - 0
buildnasm.sh

@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e
+set -x
+
+cd nasm
+./configure --prefix=/usr
+make
+rm nasm.spec
+
+checkinstall --pkgname=nasm --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default
+
+rm -f description-pak
+
+# this is only needed for building x264. Not needed on target system.
+
+cd -

+ 2 - 0
buildx264.sh

@@ -10,4 +10,6 @@ make
 checkinstall --pkgname=x264 --pkgversion="$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default
 
 mv *.deb ../debs
+
+rm -f description-pak
 cd -

+ 137 - 0
nasm/AUTHORS

@@ -0,0 +1,137 @@
+This is the AUTHORS file for the NASM project located at:
+http://nasm.sourceforge.net/
+
+Names should be inserted as follows:
+
+N: Name Here
+E: Email Here
+D: Description Here
+D: Additional Description Here.... and so on
+C: Copyright information
+
+Such is life.
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+N: Julian Hall
+E: Jules@acris.co.uk
+D: Original author and co-conspirator
+
+N: Simon Tatham
+E: anakin@pobox.com
+D: Original author and co-conspirator
+
+N: Nelson Rush
+E: palisade@users.sourceforge.net
+D: Some guy.
+
+N: Frank Kotler
+E: fbkotler@users.sf.net
+D: Bug smashing.
+D: Documentation - "KATMAI" and "3DNow!" instructions supported by 0.98
+D: General coordination and moral support.
+
+N: Stephen Silver
+E: nasm@argentum.freeserve.co.uk
+D: Documentation - "3dNow!" instructions and misc.
+D: insns.dat fixes and new instructions.
+
+N: AMD Inc. (names of developers here?)
+E:
+D: 3DNow instructions
+D: New Athlon instructions
+D: Makefile.vc fix
+
+N: John Coffman
+E: johninsd@users.sourceforge.net
+D: added Jcc optimizations; CPU level checks
+D: bug fixes, compilation fixes
+
+N: Yuri Zaporozhets
+E: r_tty@yahoo.co.uk
+D: RDOFF support
+
+N: H. Peter Anvin
+E: hpa@zytor.com
+D: Primary maintainer for the 0.98, late 0.98.x and 2.x releases.
+C: Contributions since 2008-12-15 are Copyright Intel Corporation.
+
+N: John Fine
+E: johnfine@earthlink.net
+D: Preprocessor and OBJ (OMF) output format driver
+D: Organized DOS versions of 0.98 release
+
+N: Kendall Bennet
+E: KendallB@scitechsoft.com
+D: NASM enhancements
+D: macros
+D: Syntax modifications
+
+N: Gary Clark
+E:
+D: AMD 3DNow! instructions
+
+N: Andrew Crabtree
+E:
+D: Debugging support
+
+N: Rafael R. Sevilla
+E: dido@pacific.net.ph
+D: RDF2HEX utility
+
+N: Jaime Tejedor Gómez, aka Metalbrain
+E: metalbrain_coder@gmx.net
+D: jecxz bug fix
+
+N: James Seter
+E: pharos@zsnes.com
+D: --POSTFIX, --PREFIX switches
+D: ?
+
+N: Edward J. Beroset
+E: beroset@mindspring.com
+D: added %substr and %strlen
+
+N: Stanislav Karchebny, aka berkus, madfire, daemonhunter
+E: madfire@users.sourceforge.net
+D: multiple sections support for -fbin format
+D: cvs maintenance
+D: webpage at http://nasm.2y.net maintenance
+
+N: Debbie Wiles, aka debs
+E: debs@dwiles.demon.co.uk
+D: Work on docs, added undocumented instructions (esp SSE2 and 3D-Now!)
+D: Added other documentation and tidied up docs
+D: Added a few instructions to insns.dat and tidied it up.
+
+N: Trevor Woerner
+E: FIXME
+D: Quiet compiler warnings
+
+N: Michael K. Ter Louw
+E: mterlo1 "at" uic "dot" edu
+D: Multisection support for "-f bin"
+
+N: Martin Wawro
+E: FIXME
+D: stabs debug support for "-f elf"
+
+N: Alexei Frounze
+E: alexfru@users.sourceforge.net
+D: "-I" paths searched for "incbined" files
+D: bugswatting
+
+N: Keith Kanios, aka SpooK
+E: keith@kanios.net
+D: c99 Compliance
+D: General x64 Support
+D: win64 (x86-64 COFF) output format
+D: __BITS__ Standard Macro
+D: Website Maintenance @ http://nasm.sourceforge.net/
+
+N: Chuck Crayne
+E: ccrayne@users.sourceforge.net
+D: elf64 (x86_64) output format
+
+N: Cyrill Gorcunov
+E: gorcunov@gmail.com
+D: AMD XOP/FMA4/CVT16 instructions

+ 2 - 0
nasm/CHANGES

@@ -0,0 +1,2 @@
+The revision history has moved to the file doc/changes.src, and
+is now included in the documentation as Appendix C.

Файловите разлики са ограничени, защото са твърде много
+ 2905 - 0
nasm/ChangeLog


+ 102 - 0
nasm/INSTALL

@@ -0,0 +1,102 @@
+1. Installing NASM from source (Unix, MacOS X; Windows - Cygwin;
+   Windows - MinGW; DOS - DJGPP)
+2. Installing NASM from source (Windows - MS Visual C++)
+3. Installing NASM from source (DOS, Windows, OS/2 - OpenWatcom)
+
+
+1. Installing NASM from source (Unix, MacOS X; Windows - Cygwin;
+   Windows - MinGW; DOS - DJGPP)
+================================================================
+
+Installing NASM is pretty straightforward on Unix or Unix-like systems
+with a C compiler, Make, and standard shell tools installed, including
+MinGW for Windows (with MSYS installed) and DJGPP for DOS with the
+appropriate tools.  Perl is not required for compiling unmodified
+sources from a tarball, but is required to build from git or for most
+source modifications.
+
+If you checked out source from git you will need to run autoconf to
+generate configure, otherwise you don't have to.
+
+$ sh autogen.sh
+
+Then run configure to detect your platform settings and generate makefiles.
+
+$ sh configure
+
+You can get information about available configuration options by
+running `sh configure --help`.
+
+If configure fails, please file a bug report with detailed platform
+information at:
+
+    http://www.sf.net/projects/nasm/
+
+If everything went okay, type
+
+$ make
+
+to build NASM, ndisasm and rdoff tools, or
+
+$ make everything
+
+to build the former plus the docs.
+
+You can decrease the size of produces executables by stripping off
+unnecessary information, to achieve this run
+
+$ make strip
+
+If you install to a system-wide location you might need to become
+root:
+
+$ su <enter root password>
+
+then
+
+$ make install
+
+optionally followed by 
+
+$ make install_rdf
+
+Or you can 
+
+$ make install_everything
+
+to install everything =)
+
+
+Thats it, enjoy!
+
+
+2. Installing NASM from source (Windows - MS Visual C++)
+========================================================
+
+The recommended compiler for NASM on Windows is MinGW
+(http://www.mingw.org/), but it is also possible to compile with
+Microsoft Visual C++ (tested with Visual C++ 2005 Express Edition.)
+
+To do so, start the "Visual C++ Command Shell", go to the directory
+where the NASM source code was extracted, and run:
+
+> nmake /f Mkfiles/msvc.mak
+
+We recommend MinGW over Visual C++ 2005 as we have found it to be more
+up to date with regards to C99 compliance, and we are increasingly
+using C99 features in NASM.
+
+
+3. Installing NASM from source (DOS, Windows, OS/2 - OpenWatcom)
+================================================================
+
+NASM has been reported to build correctly with OpenWatcom 1.7 on the
+Windows and OS/2 platforms.  In addition, it *should* work under DOS
+with the DOS4GW DOS extender, although the NASM developers recommend
+using DJGPP with the CWSDPMI DOS extender instead.
+
+A WMAKE make file is provided:
+
+> wmake -f Mkfiles\openwcom.mak <platform>
+
+... where <platform> is "dos", "win32" or "os2".

+ 29 - 0
nasm/LICENSE

@@ -0,0 +1,29 @@
+NASM is now licensed under the 2-clause BSD license, also known as the
+simplified BSD license.
+
+    Copyright 1996-2010 the NASM Authors - All rights reserved.
+
+    Redistribution and use in source and binary forms, with or without
+    modification, are permitted provided that the following
+    conditions are met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+      
+      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+      CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+      INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+      MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+      DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+      CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+      NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+      LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+      HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+      CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+      OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+      EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

+ 529 - 0
nasm/Makefile

@@ -0,0 +1,529 @@
+#
+# Auto-configuring Makefile for the Netwide Assembler.
+#
+# The Netwide Assembler is copyright (C) 1996 Simon Tatham and
+# Julian Hall. All rights reserved. The software is
+# redistributable under the license given in the file "LICENSE"
+# distributed in the NASM archive.
+
+
+
+top_srcdir	= .
+srcdir		= .
+objdir		= .
+
+prefix		= /usr
+exec_prefix	= ${prefix}
+bindir		= ${exec_prefix}/bin
+mandir		= ${datarootdir}/man
+datarootdir	= ${prefix}/share
+
+CC		= gcc
+CFLAGS		= -g -O3 -fwrapv -U__STRICT_ANSI__ -fno-common -Werror=attributes -fvisibility=hidden -W -Wall -pedantic -Wc90-c99-compat -Wno-long-long -Wno-shift-negative-value -Werror=implicit -Werror=missing-braces -Werror=return-type -Werror=trigraphs -Werror=pointer-arith -Werror=missing-prototypes -Werror=missing-declarations -Werror=comment -Werror=vla
+CPPFLAGS	= 
+BUILD_CFLAGS	= $(CPPFLAGS) $(CFLAGS) -DHAVE_CONFIG_H
+INTERNAL_CFLAGS = -I$(srcdir) -I$(objdir) \
+		  -I$(srcdir)/include -I$(objdir)/include \
+		  -I$(srcdir)/x86 -I$(objdir)/x86 \
+		  -I$(srcdir)/asm -I$(objdir)/asm \
+		  -I$(srcdir)/disasm -I$(objdir)/disasm \
+		  -I$(srcdir)/output -I$(objdir)/output
+ALL_CFLAGS	= $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
+LDFLAGS		=  -fvisibility=hidden
+LIBS		= 
+
+AR		= ar
+RANLIB		= ranlib
+STRIP		= strip
+
+PERL		= perl
+PERLFLAGS	= -I$(srcdir)/perllib -I$(srcdir)
+RUNPERL         = $(PERL) $(PERLFLAGS)
+
+INSTALL		= /usr/bin/install -c
+INSTALL_PROGRAM	= ${INSTALL}
+INSTALL_DATA	= ${INSTALL} -m 644
+
+NROFF		= false
+ASCIIDOC	= false
+XMLTO		= false
+
+MAKENSIS	= makensis
+
+MKDIR		= mkdir -p
+RM_F		= rm -f
+RM_RF		= rm -rf
+LN_S		= ln -s
+FIND		= find
+
+# Binary suffixes
+O               = o
+X               = 
+A		= a
+
+# Debug stuff
+ifeq ($(TRACE),1)
+	CFLAGS += -DNASM_TRACE
+endif
+
+.SUFFIXES:
+.SUFFIXES: $(X) .$(O) .$(A) .xml .1 .c .i .s .txt
+
+.PHONY: all doc rdf install clean distclean cleaner spotless install_rdf test
+.PHONY: install_doc everything install_everything strip perlreq dist tags TAGS
+.PHONY: manpages nsis
+
+.c.$(O):
+	$(CC) -c $(ALL_CFLAGS) -o $@ $<
+
+.c.s:
+	$(CC) -S $(ALL_CFLAGS) -o $@ $<
+
+.c.i:
+	$(CC) -E $(ALL_CFLAGS) -o $@ $<
+
+.txt.xml:
+	$(ASCIIDOC) -b docbook -d manpage -o $@ $<
+
+.xml.1:
+	$(XMLTO) man --skip-validation $< 2>/dev/null
+
+#-- Begin File Lists --#
+NASM =	asm/nasm.$(O)
+NDISASM = disasm/ndisasm.$(O)
+
+LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
+	stdlib/strnlen.$(O) stdlib/strrchrnul.$(O) \
+	\
+	nasmlib/ver.$(O) \
+	nasmlib/crc64.$(O) nasmlib/malloc.$(O) nasmlib/errfile.$(O) \
+	nasmlib/md5c.$(O) nasmlib/string.$(O) \
+	nasmlib/file.$(O) nasmlib/mmap.$(O) nasmlib/ilog2.$(O) \
+	nasmlib/realpath.$(O) nasmlib/path.$(O) \
+	nasmlib/filename.$(O) nasmlib/srcfile.$(O) \
+	nasmlib/zerobuf.$(O) nasmlib/readnum.$(O) nasmlib/bsi.$(O) \
+	nasmlib/rbtree.$(O) nasmlib/hashtbl.$(O) \
+	nasmlib/raa.$(O) nasmlib/saa.$(O) \
+	nasmlib/strlist.$(O) \
+	nasmlib/perfhash.$(O) nasmlib/badenum.$(O) \
+	\
+	common/common.$(O) \
+	\
+	x86/insnsa.$(O) x86/insnsb.$(O) x86/insnsd.$(O) x86/insnsn.$(O) \
+	x86/regs.$(O) x86/regvals.$(O) x86/regflags.$(O) x86/regdis.$(O) \
+	x86/disp8.$(O) x86/iflag.$(O) \
+	\
+	asm/error.$(O) \
+	asm/float.$(O) \
+	asm/directiv.$(O) asm/directbl.$(O) \
+	asm/pragma.$(O) \
+	asm/assemble.$(O) asm/labels.$(O) asm/parser.$(O) \
+	asm/preproc.$(O) asm/quote.$(O) asm/pptok.$(O) \
+	asm/listing.$(O) asm/eval.$(O) asm/exprlib.$(O) asm/exprdump.$(O) \
+	asm/stdscan.$(O) \
+	asm/strfunc.$(O) asm/tokhash.$(O) \
+	asm/segalloc.$(O) \
+	asm/preproc-nop.$(O) \
+	asm/rdstrnum.$(O) \
+	\
+	macros/macros.$(O) \
+	\
+	output/outform.$(O) output/outlib.$(O) output/legacy.$(O) \
+	output/strtbl.$(O) \
+	output/nulldbg.$(O) output/nullout.$(O) \
+	output/outbin.$(O) output/outaout.$(O) output/outcoff.$(O) \
+	output/outelf.$(O) \
+	output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
+	output/outdbg.$(O) output/outieee.$(O) output/outmacho.$(O) \
+	output/codeview.$(O) \
+	\
+	disasm/disasm.$(O) disasm/sync.$(O)
+
+SUBDIRS  = stdlib nasmlib output asm disasm x86 common macros
+XSUBDIRS = test doc nsis rdoff
+DEPDIRS  = . include config x86 rdoff $(SUBDIRS)
+#-- End File Lists --#
+
+all: nasm$(X) ndisasm$(X) rdf
+
+NASMLIB = libnasm.$(A)
+
+$(NASMLIB): $(LIBOBJ)
+	$(RM_F) $(NASMLIB)
+	$(AR) cq $(NASMLIB) $(LIBOBJ)
+	$(RANLIB) $(NASMLIB)
+
+nasm$(X): $(NASM) $(NASMLIB)
+	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o nasm$(X) $(NASM) $(NASMLIB) $(LIBS)
+
+ndisasm$(X): $(NDISASM) $(NASMLIB)
+	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o ndisasm$(X) $(NDISASM) $(NASMLIB) $(LIBS)
+
+#-- Begin Generated File Rules --#
+
+# These source files are automagically generated from data files using
+# Perl scripts. They're distributed, though, so it isn't necessary to
+# have Perl just to recompile NASM from the distribution.
+
+# Perl-generated source files
+PERLREQ = x86/insnsb.c x86/insnsa.c x86/insnsd.c x86/insnsi.h x86/insnsn.c \
+	  x86/regs.c x86/regs.h x86/regflags.c x86/regdis.c x86/regdis.h \
+	  x86/regvals.c asm/tokhash.c asm/tokens.h asm/pptok.h asm/pptok.c \
+	  x86/iflag.c x86/iflaggen.h \
+	  macros/macros.c \
+	  asm/pptok.ph asm/directbl.c asm/directiv.h \
+	  version.h version.mac version.mak nsis/version.nsh
+
+INSDEP = x86/insns.dat x86/insns.pl x86/insns-iflags.ph
+
+x86/iflag.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)/x86/insns.pl -fc \
+		$(srcdir)/x86/insns.dat x86/iflag.c
+x86/iflaggen.h: $(INSDEP)
+	$(RUNPERL) $(srcdir)/x86/insns.pl -fh \
+		$(srcdir)/x86/insns.dat x86/iflaggen.h
+x86/insnsb.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)/x86/insns.pl -b \
+		$(srcdir)/x86/insns.dat x86/insnsb.c
+x86/insnsa.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)/x86/insns.pl -a \
+		$(srcdir)/x86/insns.dat x86/insnsa.c
+x86/insnsd.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)/x86/insns.pl -d \
+		$(srcdir)/x86/insns.dat x86/insnsd.c
+x86/insnsi.h: $(INSDEP)
+	$(RUNPERL) $(srcdir)/x86/insns.pl -i \
+		$(srcdir)/x86/insns.dat x86/insnsi.h
+x86/insnsn.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)/x86/insns.pl -n \
+		$(srcdir)/x86/insns.dat x86/insnsn.c
+
+# These files contains all the standard macros that are derived from
+# the version number.
+version.h: version version.pl
+	$(RUNPERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
+version.mac: version version.pl
+	$(RUNPERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
+version.sed: version version.pl
+	$(RUNPERL) $(srcdir)/version.pl sed < $(srcdir)/version > version.sed
+version.mak: version version.pl
+	$(RUNPERL) $(srcdir)/version.pl make < $(srcdir)/version > version.mak
+nsis/version.nsh: version version.pl
+	$(RUNPERL) $(srcdir)/version.pl nsis < $(srcdir)/version > nsis/version.nsh
+
+# This source file is generated from the standard macros file
+# `standard.mac' by another Perl script. Again, it's part of the
+# standard distribution.
+macros/macros.c: macros/macros.pl asm/pptok.ph version.mac \
+	$(srcdir)/macros/*.mac $(srcdir)/output/*.mac
+	$(RUNPERL) $(srcdir)/macros/macros.pl version.mac \
+		$(srcdir)/macros/*.mac $(srcdir)/output/*.mac
+
+# These source files are generated from regs.dat by yet another
+# perl script.
+x86/regs.c: x86/regs.dat x86/regs.pl
+	$(RUNPERL) $(srcdir)/x86/regs.pl c \
+		$(srcdir)/x86/regs.dat > x86/regs.c
+x86/regflags.c: x86/regs.dat x86/regs.pl
+	$(RUNPERL) $(srcdir)/x86/regs.pl fc \
+		$(srcdir)/x86/regs.dat > x86/regflags.c
+x86/regdis.c: x86/regs.dat x86/regs.pl
+	$(RUNPERL) $(srcdir)/x86/regs.pl dc \
+		$(srcdir)/x86/regs.dat > x86/regdis.c
+x86/regdis.h: x86/regs.dat x86/regs.pl
+	$(RUNPERL) $(srcdir)/x86/regs.pl dh \
+		$(srcdir)/x86/regs.dat > x86/regdis.h
+x86/regvals.c: x86/regs.dat x86/regs.pl
+	$(RUNPERL) $(srcdir)/x86/regs.pl vc \
+		$(srcdir)/x86/regs.dat > x86/regvals.c
+x86/regs.h: x86/regs.dat x86/regs.pl
+	$(RUNPERL) $(srcdir)/x86/regs.pl h \
+		$(srcdir)/x86/regs.dat > x86/regs.h
+
+# Assembler token hash
+asm/tokhash.c: x86/insns.dat x86/regs.dat asm/tokens.dat asm/tokhash.pl \
+	perllib/phash.ph
+	$(RUNPERL) $(srcdir)/asm/tokhash.pl c \
+		$(srcdir)/x86/insns.dat $(srcdir)/x86/regs.dat \
+		$(srcdir)/asm/tokens.dat > asm/tokhash.c
+
+# Assembler token metadata
+asm/tokens.h: x86/insns.dat x86/regs.dat asm/tokens.dat asm/tokhash.pl \
+	perllib/phash.ph
+	$(RUNPERL) $(srcdir)/asm/tokhash.pl h \
+		$(srcdir)/x86/insns.dat $(srcdir)/x86/regs.dat \
+		$(srcdir)/asm/tokens.dat > asm/tokens.h
+
+# Preprocessor token hash
+asm/pptok.h: asm/pptok.dat asm/pptok.pl perllib/phash.ph
+	$(RUNPERL) $(srcdir)/asm/pptok.pl h \
+		$(srcdir)/asm/pptok.dat asm/pptok.h
+asm/pptok.c: asm/pptok.dat asm/pptok.pl perllib/phash.ph
+	$(RUNPERL) $(srcdir)/asm/pptok.pl c \
+		$(srcdir)/asm/pptok.dat asm/pptok.c
+asm/pptok.ph: asm/pptok.dat asm/pptok.pl perllib/phash.ph
+	$(RUNPERL) $(srcdir)/asm/pptok.pl ph \
+		$(srcdir)/asm/pptok.dat asm/pptok.ph
+
+# Directives hash
+asm/directiv.h: asm/directiv.dat nasmlib/perfhash.pl perllib/phash.ph
+	$(RUNPERL) $(srcdir)/nasmlib/perfhash.pl h \
+		$(srcdir)/asm/directiv.dat asm/directiv.h
+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
+
+#-- End Generated File Rules --#
+
+perlreq: $(PERLREQ)
+
+# This rule is only used for RDOFF
+.$(O)$(X):
+	$(CC) $(ALL_CFLAGS) -o $@ $< $(LDFLAGS) $(RDFLIB) $(NASMLIB) $(LIBS)
+
+RDFLN    = cd rdoff && ln -s
+RDFLNPFX =
+
+#-- Begin RDOFF Shared Rules --#
+
+RDFLIBOBJ = rdoff/rdoff.$(O) rdoff/rdfload.$(O) rdoff/symtab.$(O) \
+	    rdoff/collectn.$(O) rdoff/rdlib.$(O) rdoff/segtab.$(O) \
+	    rdoff/hash.$(O)
+
+RDFPROGS = rdoff/rdfdump$(X) rdoff/ldrdf$(X) rdoff/rdx$(X) rdoff/rdflib$(X) \
+	   rdoff/rdf2bin$(X)
+RDF2BINLINKS = rdoff/rdf2com$(X) rdoff/rdf2ith$(X) \
+	    rdoff/rdf2ihx$(X) rdoff/rdf2srec$(X)
+
+RDFLIB = rdoff/librdoff.$(A)
+RDFLIBS = $(RDFLIB) $(NASMLIB)
+
+rdoff/rdfdump$(X): rdoff/rdfdump.$(O) $(RDFLIBS)
+rdoff/ldrdf$(X): rdoff/ldrdf.$(O) $(RDFLIBS)
+rdoff/rdx$(X): rdoff/rdx.$(O) $(RDFLIBS)
+rdoff/rdflib$(X): rdoff/rdflib.$(O) $(RDFLIBS)
+rdoff/rdf2bin$(X): rdoff/rdf2bin.$(O) $(RDFLIBS)
+rdoff/rdf2com$(X): rdoff/rdf2bin$(X)
+	$(RM_F) rdoff/rdf2com$(X)
+	$(RDFLN) $(RDFLNPFX)rdf2bin$(X) $(RDFLNPFX)rdf2com$(X)
+rdoff/rdf2ith$(X): rdoff/rdf2bin$(X)
+	$(RM_F) rdoff/rdf2ith$(X)
+	$(RDFLN) $(RDFLNPFX)rdf2bin$(X) $(RDFLNPFX)rdf2ith$(X)
+rdoff/rdf2ihx$(X): rdoff/rdf2bin$(X)
+	$(RM_F) rdoff/rdf2ihx$(X)
+	$(RDFLN) $(RDFLNPFX)rdf2bin$(X) $(RDFLNPFX)rdf2ihx$(X)
+rdoff/rdf2srec$(X): rdoff/rdf2bin$(X)
+	$(RM_F) rdoff/rdf2srec$(X)
+	$(RDFLN) $(RDFLNPFX)rdf2bin$(X) $(RDFLNPFX)rdf2srec$(X)
+
+#-- End RDOFF Shared Rules --#
+
+rdf: $(RDFPROGS) $(RDF2BINLINKS)
+
+$(RDFLIB): $(RDFLIBOBJ)
+	$(RM_F) $(RDFLIB)
+	$(AR) cq $(RDFLIB) $(RDFLIBOBJ)
+	$(RANLIB) $(RDFLIB)
+
+#-- Begin NSIS Rules --#
+
+# NSIS is not built except by explicit request, as it only applies to
+# Windows platforms
+nsis/arch.nsh: nsis/getpearch.pl nasm$(X)
+	$(PERL) $(srcdir)/nsis/getpearch.pl nasm$(X) > nsis/arch.nsh
+
+# Should only be done after "make everything".
+# The use of redirection here keeps makensis from moving the cwd to the
+# source directory.
+nsis: nsis/nasm.nsi nsis/arch.nsh nsis/version.nsh
+	$(MAKENSIS) -Dsrcdir="$(srcdir)" -Dobjdir="$(objdir)" - < nsis/nasm.nsi
+
+#-- End NSIS Rules --#
+
+# Generated manpages, also pregenerated for distribution
+manpages: nasm.1 ndisasm.1
+
+install: nasm$(X) ndisasm$(X)
+	$(MKDIR) $(DESTDIR)$(bindir)
+	$(INSTALL_PROGRAM) nasm$(X) $(DESTDIR)$(bindir)/nasm$(X)
+	$(INSTALL_PROGRAM) ndisasm$(X) $(DESTDIR)$(bindir)/ndisasm$(X)
+	$(MKDIR) $(DESTDIR)$(mandir)/man1
+	$(INSTALL_DATA) $(srcdir)/nasm.1 $(DESTDIR)$(mandir)/man1/nasm.1
+	$(INSTALL_DATA) $(srcdir)/ndisasm.1 $(DESTDIR)$(mandir)/man1/ndisasm.1
+
+clean:
+	for d in . $(SUBDIRS) $(XSUBDIRS); do \
+		$(RM_F) "$$d"/*.$(O) "$$d"/*.s "$$d"/*.i "$$d"/*.$(A) ; \
+	done
+	$(RM_F) nasm$(X) ndisasm$(X)
+	$(RM_F) nasm-*-installer-*.exe
+	$(RM_F) tags TAGS
+	$(RM_F) nsis/arch.nsh
+	$(RM_F) perlbreq.si
+	$(RM_F) $(RDFPROGS) $(RDF2BINLINKS)
+
+distclean: clean
+	$(RM_F) config.log config.status config/config.h
+	for d in . $(SUBDIRS) $(XSUBDIRS); do \
+		$(RM_F) "$$d"/*~ "$$d"/*.bak "$$d"/*.lst "$$d"/*.bin ; \
+	done
+	$(RM_F) test/*.$(O)
+	$(RM_RF) autom4te*.cache
+	$(RM_F) Makefile *.dep
+
+cleaner: clean
+	$(RM_F) $(PERLREQ) *.1 nasm.spec
+	$(MAKE) -C doc clean
+	$(RM_F) *.dep
+
+spotless: distclean cleaner
+	$(RM_F) doc/Makefile
+
+strip:
+	$(STRIP) --strip-unneeded nasm$(X) ndisasm$(X)
+
+TAGS:
+	$(RM_F) TAGS
+	$(FIND) . -name '*.[hcS]' -print | xargs etags -a
+
+tags:
+	$(RM_F) tags
+	$(FIND) . -name '*.[hcS]' -print | xargs ctags -a
+
+cscope:
+	$(RM_F) cscope.out cscope.files
+	$(FIND) . -name '*.[hcS]' -print > cscope.files
+	cscope -b -f cscope.out
+
+rdf_install install_rdf install_rdoff:
+	$(MKDIR) $(DESTDIR)$(bindir)
+	for f in $(RDFPROGS); do \
+		$(INSTALL_PROGRAM) "$$f" '$(DESTDIR)$(bindir)'/ ; \
+	done
+	cd '$(DESTDIR)$(bindir)' && \
+	for f in $(RDF2BINLINKS); do \
+		bn=`basename "$$f"` && $(RM_F) "$$bn" && \
+		$(LN_S) rdf2bin$(X) "$$bn" ; \
+	done
+	$(MKDIR) $(DESTDIR)$(mandir)/man1
+	$(INSTALL_DATA) $(srcdir)/rdoff/*.1 $(DESTDIR)$(mandir)/man1/
+
+doc:
+	$(MAKE) -C doc all
+
+doc_install install_doc:
+	$(MAKE) -C doc install
+
+everything: all manpages doc rdf
+
+install_everything: everything install install_doc install_rdf
+
+dist:
+	$(MAKE) alldeps
+	$(MAKE) spotless perlreq manpages spec
+	autoheader
+	autoconf
+	$(RM_RF) ./autom4te*.cache
+
+tar: dist
+	tar -cvj --exclude CVS -C .. -f ../nasm-`cat version`-`date +%Y%m%d`.tar.bz2 `basename \`pwd\``
+
+spec: nasm.spec
+
+ALLPERLSRC := $(shell find $(srcdir) -type f -name '*.p[lh]')
+
+perlbreq.si: $(ALLPERLSRC)
+	sed -n -r -e 's/^[[:space:]]*use[[:space:]]+([^[:space:];]+).*$$/BuildRequires: perl(\1)/p' $(ALLPERLSRC) | \
+	sed -r -e '/perl\((strict|warnings|Win32.*)\)/d' | \
+	sort | uniq > perlbreq.si || ( rm -f perlbreq.si ; false )
+
+nasm.spec: nasm.spec.in nasm.spec.sed version.sed perlbreq.si
+	sed -f version.sed -f nasm.spec.sed \
+	< nasm.spec.in > nasm.spec || ( rm -f nasm.spec ; false )
+
+splint:
+	splint -weak *.c
+
+test: nasm$(X)
+	cd test && $(RUNPERL) performtest.pl --nasm=../nasm *.asm
+
+golden: nasm$(X)
+	cd test && $(RUNPERL) performtest.pl --golden --nasm=../nasm *.asm
+
+#
+# Rules to run autoreconf if necessary
+#
+configure: configure.ac aclocal.m4
+	autoreconf
+
+config.status: configure
+	@if [ ! -f config.status ]; then \
+		echo "*** ERROR: Need to run configure!" 1>&2 ; \
+		exit 1; \
+	fi
+	sh config.status --recheck
+
+Makefile: config.status Makefile.in doc/Makefile.in
+	sh config.status
+
+doc/Makefile: Makefile
+
+config/config.h: config.status
+
+#
+# Does this version of this file have external dependencies?  This definition
+# will be automatically updated by mkdep.pl as needed.
+#
+EXTERNAL_DEPENDENCIES = 1
+
+#
+# Generate dependency information for this Makefile only.
+# If this Makefile has external dependency information, then
+# the dependency information will remain external, so it doesn't
+# pollute the git logs.
+#
+Makefile.dep: $(PERLREQ) tools/mkdep.pl config.status
+	$(RUNPERL) tools/mkdep.pl -M Makefile.in -- $(DEPDIRS)
+
+dep: Makefile.dep
+
+#
+# This build dependencies in *ALL* makefiles, and forces all
+# dependencies to be inserted inline.  For that reason, it should only
+# be invoked manually or via "make dist".  It should be run before
+# creating release archives.
+#
+alldeps: $(PERLREQ) tools/syncfiles.pl tools/mkdep.pl
+	$(RUNPERL) tools/syncfiles.pl Makefile.in Mkfiles/*.mak
+	$(RUNPERL) tools/mkdep.pl -i -M Makefile.in Mkfiles/*.mak -- \
+		$(DEPDIRS)
+	$(RM_F) *.dep
+	if [ -f config.status ]; then \
+		if [ $(EXTERNAL_DEPENDENCIES) -eq 1 ]; then \
+			sh config.status --recheck; \
+		fi; \
+		sh config.status; \
+	fi
+
+# Strip internal dependency information from all Makefiles; this makes
+# the output good for git checkin
+cleandeps: $(PERLREQ) tools/syncfiles.pl tools/mkdep.pl
+	$(RUNPERL) tools/syncfiles.pl Makefile.in Mkfiles/*.mak
+	$(RUNPERL) tools/mkdep.pl -e -M Makefile.in Mkfiles/*.mak -- \
+		$(DEPDIRS)
+	$(RM_F) *.dep
+	if [ -f config.status ]; then \
+		if [ $(EXTERNAL_DEPENDENCIES) -eq 0 ]; then \
+			sh config.status --recheck; \
+		fi; \
+		sh config.status; \
+	fi
+
+#-- Magic hints to mkdep.pl --#
+# @object-ending: ".$(O)"
+# @path-separator: "/"
+# @external: "Makefile.dep"
+# @include-command: "-include"
+# @selfrule: "1"
+#-- Everything below is generated by mkdep.pl - do not edit --#
+-include Makefile.dep

+ 481 - 0
nasm/Makefile.dep

@@ -0,0 +1,481 @@
+#-- Everything below is generated by mkdep.pl - do not edit --#
+Makefile.dep: asm/assemble.c asm/assemble.h asm/directbl.c asm/directiv.c \
+ asm/directiv.h asm/error.c asm/eval.c asm/eval.h asm/exprdump.c \
+ asm/exprlib.c asm/float.c asm/float.h asm/labels.c asm/listing.c \
+ asm/listing.h asm/nasm.c asm/parser.c asm/parser.h asm/pptok.c asm/pptok.h \
+ asm/pragma.c asm/preproc-nop.c asm/preproc.c asm/preproc.h asm/quote.c \
+ asm/quote.h asm/rdstrnum.c asm/segalloc.c asm/stdscan.c asm/stdscan.h \
+ asm/strfunc.c asm/tokens.h asm/tokhash.c common/common.c config/config.h \
+ config/msvc.h config/unknown.h config/watcom.h disasm/disasm.c \
+ disasm/disasm.h disasm/ndisasm.c disasm/sync.c disasm/sync.h \
+ include/bytesex.h include/compiler.h include/disp8.h include/error.h \
+ include/hashtbl.h include/iflag.h include/ilog2.h include/insns.h \
+ include/labels.h include/md5.h include/nasm.h include/nasmint.h \
+ include/nasmlib.h include/opflags.h include/perfhash.h include/raa.h \
+ include/rbtree.h include/rdoff.h include/saa.h include/strlist.h \
+ include/tables.h include/ver.h macros/macros.c nasmlib/badenum.c \
+ nasmlib/bsi.c nasmlib/crc64.c nasmlib/errfile.c nasmlib/file.c \
+ nasmlib/file.h nasmlib/filename.c nasmlib/hashtbl.c nasmlib/ilog2.c \
+ nasmlib/malloc.c nasmlib/md5c.c nasmlib/mmap.c nasmlib/path.c \
+ nasmlib/perfhash.c nasmlib/raa.c nasmlib/rbtree.c nasmlib/readnum.c \
+ nasmlib/realpath.c nasmlib/saa.c nasmlib/srcfile.c nasmlib/string.c \
+ nasmlib/strlist.c nasmlib/ver.c nasmlib/zerobuf.c output/codeview.c \
+ output/dwarf.h output/elf.h output/legacy.c output/nulldbg.c \
+ output/nullout.c output/outaout.c output/outas86.c output/outbin.c \
+ output/outcoff.c output/outdbg.c output/outelf.c output/outelf.h \
+ output/outform.c output/outform.h output/outieee.c output/outlib.c \
+ output/outlib.h output/outmacho.c output/outobj.c output/outrdf2.c \
+ output/pecoff.h output/stabs.h output/strtbl.c output/strtbl.h \
+ rdoff/collectn.c rdoff/collectn.h rdoff/hash.c rdoff/hash.h rdoff/ldrdf.c \
+ rdoff/ldsegs.h rdoff/rdf2bin.c rdoff/rdfdump.c rdoff/rdflib.c \
+ rdoff/rdfload.c rdoff/rdfload.h rdoff/rdfutils.h rdoff/rdlar.c \
+ rdoff/rdlar.h rdoff/rdlib.c rdoff/rdlib.h rdoff/rdoff.c rdoff/rdx.c \
+ rdoff/segtab.c rdoff/segtab.h rdoff/symtab.c rdoff/symtab.h \
+ stdlib/snprintf.c stdlib/strlcpy.c stdlib/strnlen.c stdlib/strrchrnul.c \
+ stdlib/vsnprintf.c version.h x86/disp8.c x86/iflag.c x86/iflaggen.h \
+ x86/insnsa.c x86/insnsb.c x86/insnsd.c x86/insnsi.h x86/insnsn.c \
+ x86/regdis.c x86/regdis.h x86/regflags.c x86/regs.c x86/regs.h \
+ x86/regvals.c
+asm/assemble.$(O): asm/assemble.c asm/assemble.h asm/directiv.h \
+ asm/listing.h asm/pptok.h asm/preproc.h asm/tokens.h config/config.h \
+ config/msvc.h config/unknown.h config/watcom.h include/bytesex.h \
+ include/compiler.h include/disp8.h include/error.h include/iflag.h \
+ include/ilog2.h include/insns.h include/labels.h include/nasm.h \
+ include/nasmint.h include/nasmlib.h include/opflags.h include/perfhash.h \
+ include/strlist.h include/tables.h x86/iflaggen.h x86/insnsi.h x86/regs.h
+asm/directbl.$(O): asm/directbl.c asm/directiv.h config/config.h \
+ config/msvc.h config/unknown.h config/watcom.h include/bytesex.h \
+ include/compiler.h include/nasmint.h include/nasmlib.h include/perfhash.h
+asm/directiv.$(O): asm/directiv.c asm/assemble.h asm/directiv.h asm/eval.h \
+ asm/float.h asm/listing.h asm/pptok.h asm/preproc.h asm/stdscan.h \
+ config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/error.h include/iflag.h \
+ include/ilog2.h include/labels.h include/nasm.h include/nasmint.h \
+ include/nasmlib.h include/opflags.h include/perfhash.h include/strlist.h \
+ include/tables.h output/outform.h x86/iflaggen.h x86/insnsi.h x86/regs.h
+asm/error.$(O): asm/error.c config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/nasmint.h include/nasmlib.h
+asm/eval.$(O): asm/eval.c asm/assemble.h asm/directiv.h asm/eval.h \
+ asm/float.h asm/pptok.h asm/preproc.h config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/iflag.h include/ilog2.h include/labels.h \
+ include/nasm.h include/nasmint.h include/nasmlib.h include/opflags.h \
+ include/perfhash.h include/strlist.h include/tables.h x86/iflaggen.h \
+ x86/insnsi.h x86/regs.h
+asm/exprdump.$(O): asm/exprdump.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/labels.h include/nasm.h \
+ include/nasmint.h include/nasmlib.h include/opflags.h include/perfhash.h \
+ include/strlist.h include/tables.h x86/insnsi.h x86/regs.h
+asm/exprlib.$(O): asm/exprlib.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/labels.h include/nasm.h \
+ include/nasmint.h include/nasmlib.h include/opflags.h include/perfhash.h \
+ include/strlist.h include/tables.h x86/insnsi.h x86/regs.h
+asm/float.$(O): asm/float.c asm/directiv.h asm/float.h asm/pptok.h \
+ asm/preproc.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/strlist.h include/tables.h \
+ x86/insnsi.h x86/regs.h
+asm/labels.$(O): asm/labels.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/error.h include/hashtbl.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/strlist.h include/tables.h \
+ x86/insnsi.h x86/regs.h
+asm/listing.$(O): asm/listing.c asm/directiv.h asm/listing.h asm/pptok.h \
+ asm/preproc.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/strlist.h include/tables.h \
+ x86/insnsi.h x86/regs.h
+asm/nasm.$(O): asm/nasm.c asm/assemble.h asm/directiv.h asm/eval.h \
+ asm/float.h asm/listing.h asm/parser.h asm/pptok.h asm/preproc.h \
+ asm/stdscan.h asm/tokens.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/iflag.h include/ilog2.h include/insns.h include/labels.h \
+ include/nasm.h include/nasmint.h include/nasmlib.h include/opflags.h \
+ include/perfhash.h include/raa.h include/saa.h include/strlist.h \
+ include/tables.h include/ver.h output/outform.h x86/iflaggen.h x86/insnsi.h \
+ x86/regs.h
+asm/parser.$(O): asm/parser.c asm/assemble.h asm/directiv.h asm/eval.h \
+ asm/float.h asm/parser.h asm/pptok.h asm/preproc.h asm/stdscan.h \
+ asm/tokens.h config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/error.h include/iflag.h \
+ include/ilog2.h include/insns.h include/labels.h include/nasm.h \
+ include/nasmint.h include/nasmlib.h include/opflags.h include/perfhash.h \
+ include/strlist.h include/tables.h x86/iflaggen.h x86/insnsi.h x86/regs.h
+asm/pptok.$(O): asm/pptok.c asm/pptok.h asm/preproc.h config/config.h \
+ config/msvc.h config/unknown.h config/watcom.h include/bytesex.h \
+ include/compiler.h include/hashtbl.h include/nasmint.h include/nasmlib.h
+asm/pragma.$(O): asm/pragma.c asm/assemble.h asm/directiv.h asm/pptok.h \
+ asm/preproc.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/iflag.h include/ilog2.h include/labels.h include/nasm.h \
+ include/nasmint.h include/nasmlib.h include/opflags.h include/perfhash.h \
+ include/strlist.h include/tables.h x86/iflaggen.h x86/insnsi.h x86/regs.h
+asm/preproc-nop.$(O): asm/preproc-nop.c asm/directiv.h asm/listing.h \
+ asm/pptok.h asm/preproc.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/strlist.h include/tables.h \
+ x86/insnsi.h x86/regs.h
+asm/preproc.$(O): asm/preproc.c asm/directiv.h asm/eval.h asm/listing.h \
+ asm/pptok.h asm/preproc.h asm/quote.h asm/stdscan.h asm/tokens.h \
+ config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/error.h include/hashtbl.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/strlist.h include/tables.h \
+ x86/insnsi.h x86/regs.h
+asm/quote.$(O): asm/quote.c asm/quote.h config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/nasmint.h include/nasmlib.h
+asm/rdstrnum.$(O): asm/rdstrnum.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/labels.h include/nasm.h \
+ include/nasmint.h include/nasmlib.h include/opflags.h include/perfhash.h \
+ include/strlist.h include/tables.h x86/insnsi.h x86/regs.h
+asm/segalloc.$(O): asm/segalloc.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ asm/tokens.h config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/iflag.h include/ilog2.h \
+ include/insns.h include/labels.h include/nasm.h include/nasmint.h \
+ include/nasmlib.h include/opflags.h include/perfhash.h include/strlist.h \
+ include/tables.h x86/iflaggen.h x86/insnsi.h x86/regs.h
+asm/stdscan.$(O): asm/stdscan.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ asm/quote.h asm/stdscan.h asm/tokens.h config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/iflag.h include/ilog2.h include/insns.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/strlist.h include/tables.h \
+ x86/iflaggen.h x86/insnsi.h x86/regs.h
+asm/strfunc.$(O): asm/strfunc.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/labels.h include/nasm.h \
+ include/nasmint.h include/nasmlib.h include/opflags.h include/perfhash.h \
+ include/strlist.h include/tables.h x86/insnsi.h x86/regs.h
+asm/tokhash.$(O): asm/tokhash.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ asm/stdscan.h asm/tokens.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/hashtbl.h \
+ include/iflag.h include/ilog2.h include/insns.h include/labels.h \
+ include/nasm.h include/nasmint.h include/nasmlib.h include/opflags.h \
+ include/perfhash.h include/strlist.h include/tables.h x86/iflaggen.h \
+ x86/insnsi.h x86/regs.h
+common/common.$(O): common/common.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ asm/tokens.h config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/iflag.h include/ilog2.h \
+ include/insns.h include/labels.h include/nasm.h include/nasmint.h \
+ include/nasmlib.h include/opflags.h include/perfhash.h include/strlist.h \
+ include/tables.h x86/iflaggen.h x86/insnsi.h x86/regs.h
+disasm/disasm.$(O): disasm/disasm.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ asm/tokens.h config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ disasm/disasm.h disasm/sync.h include/bytesex.h include/compiler.h \
+ include/disp8.h include/iflag.h include/ilog2.h include/insns.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/strlist.h include/tables.h \
+ x86/iflaggen.h x86/insnsi.h x86/regdis.h x86/regs.h
+disasm/ndisasm.$(O): disasm/ndisasm.c asm/directiv.h asm/pptok.h \
+ asm/preproc.h asm/tokens.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h disasm/disasm.h disasm/sync.h include/bytesex.h \
+ include/compiler.h include/error.h include/iflag.h include/ilog2.h \
+ include/insns.h include/labels.h include/nasm.h include/nasmint.h \
+ include/nasmlib.h include/opflags.h include/perfhash.h include/strlist.h \
+ include/tables.h include/ver.h x86/iflaggen.h x86/insnsi.h x86/regs.h
+disasm/sync.$(O): disasm/sync.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h disasm/sync.h include/bytesex.h \
+ include/compiler.h include/nasmint.h include/nasmlib.h
+macros/macros.$(O): macros/macros.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/hashtbl.h include/labels.h \
+ include/nasm.h include/nasmint.h include/nasmlib.h include/opflags.h \
+ include/perfhash.h include/strlist.h include/tables.h output/outform.h \
+ x86/insnsi.h x86/regs.h
+nasmlib/badenum.$(O): nasmlib/badenum.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/nasmint.h include/nasmlib.h
+nasmlib/bsi.$(O): nasmlib/bsi.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/nasmint.h include/nasmlib.h
+nasmlib/crc64.$(O): nasmlib/crc64.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/hashtbl.h include/nasmint.h include/nasmlib.h
+nasmlib/errfile.$(O): nasmlib/errfile.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/compiler.h include/nasmint.h
+nasmlib/file.$(O): nasmlib/file.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/nasmint.h include/nasmlib.h nasmlib/file.h
+nasmlib/filename.$(O): nasmlib/filename.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/nasmint.h include/nasmlib.h
+nasmlib/hashtbl.$(O): nasmlib/hashtbl.c asm/directiv.h asm/pptok.h \
+ asm/preproc.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/hashtbl.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/strlist.h include/tables.h \
+ x86/insnsi.h x86/regs.h
+nasmlib/ilog2.$(O): nasmlib/ilog2.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/compiler.h include/ilog2.h \
+ include/nasmint.h
+nasmlib/malloc.$(O): nasmlib/malloc.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/nasmint.h include/nasmlib.h
+nasmlib/md5c.$(O): nasmlib/md5c.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/compiler.h include/md5.h \
+ include/nasmint.h
+nasmlib/mmap.$(O): nasmlib/mmap.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/nasmint.h include/nasmlib.h nasmlib/file.h
+nasmlib/path.$(O): nasmlib/path.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/nasmint.h include/nasmlib.h
+nasmlib/perfhash.$(O): nasmlib/perfhash.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/hashtbl.h include/nasmint.h include/nasmlib.h include/perfhash.h
+nasmlib/raa.$(O): nasmlib/raa.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/nasmint.h include/nasmlib.h include/raa.h
+nasmlib/rbtree.$(O): nasmlib/rbtree.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/compiler.h include/nasmint.h \
+ include/rbtree.h
+nasmlib/readnum.$(O): nasmlib/readnum.c asm/directiv.h asm/pptok.h \
+ asm/preproc.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/strlist.h include/tables.h \
+ x86/insnsi.h x86/regs.h
+nasmlib/realpath.$(O): nasmlib/realpath.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/nasmint.h include/nasmlib.h
+nasmlib/saa.$(O): nasmlib/saa.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/nasmint.h include/nasmlib.h include/saa.h
+nasmlib/srcfile.$(O): nasmlib/srcfile.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/hashtbl.h include/nasmint.h include/nasmlib.h
+nasmlib/string.$(O): nasmlib/string.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/nasmint.h include/nasmlib.h
+nasmlib/strlist.$(O): nasmlib/strlist.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/nasmint.h include/nasmlib.h include/strlist.h
+nasmlib/ver.$(O): nasmlib/ver.c include/ver.h version.h
+nasmlib/zerobuf.$(O): nasmlib/zerobuf.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/nasmint.h include/nasmlib.h
+output/codeview.$(O): output/codeview.c asm/directiv.h asm/pptok.h \
+ asm/preproc.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/hashtbl.h include/labels.h include/md5.h include/nasm.h \
+ include/nasmint.h include/nasmlib.h include/opflags.h include/perfhash.h \
+ include/saa.h include/strlist.h include/tables.h output/outlib.h \
+ output/pecoff.h version.h x86/insnsi.h x86/regs.h
+output/legacy.$(O): output/legacy.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/error.h include/labels.h \
+ include/nasm.h include/nasmint.h include/nasmlib.h include/opflags.h \
+ include/perfhash.h include/strlist.h include/tables.h output/outlib.h \
+ x86/insnsi.h x86/regs.h
+output/nulldbg.$(O): output/nulldbg.c asm/directiv.h asm/pptok.h \
+ asm/preproc.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/strlist.h include/tables.h \
+ output/outlib.h x86/insnsi.h x86/regs.h
+output/nullout.$(O): output/nullout.c asm/directiv.h asm/pptok.h \
+ asm/preproc.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/strlist.h include/tables.h \
+ output/outlib.h x86/insnsi.h x86/regs.h
+output/outaout.$(O): output/outaout.c asm/directiv.h asm/eval.h asm/pptok.h \
+ asm/preproc.h asm/stdscan.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/raa.h include/saa.h \
+ include/strlist.h include/tables.h output/outform.h output/outlib.h \
+ x86/insnsi.h x86/regs.h
+output/outas86.$(O): output/outas86.c asm/directiv.h asm/pptok.h \
+ asm/preproc.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/raa.h include/saa.h \
+ include/strlist.h include/tables.h output/outform.h output/outlib.h \
+ x86/insnsi.h x86/regs.h
+output/outbin.$(O): output/outbin.c asm/directiv.h asm/eval.h asm/pptok.h \
+ asm/preproc.h asm/stdscan.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/saa.h include/strlist.h \
+ include/tables.h output/outform.h output/outlib.h x86/insnsi.h x86/regs.h
+output/outcoff.$(O): output/outcoff.c asm/directiv.h asm/eval.h asm/pptok.h \
+ asm/preproc.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/ilog2.h include/labels.h include/nasm.h include/nasmint.h \
+ include/nasmlib.h include/opflags.h include/perfhash.h include/raa.h \
+ include/saa.h include/strlist.h include/tables.h output/outform.h \
+ output/outlib.h output/pecoff.h x86/insnsi.h x86/regs.h
+output/outdbg.$(O): output/outdbg.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ asm/tokens.h config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/error.h include/iflag.h \
+ include/ilog2.h include/insns.h include/labels.h include/nasm.h \
+ include/nasmint.h include/nasmlib.h include/opflags.h include/perfhash.h \
+ include/strlist.h include/tables.h output/outform.h output/outlib.h \
+ x86/iflaggen.h x86/insnsi.h x86/regs.h
+output/outelf.$(O): output/outelf.c asm/directiv.h asm/eval.h asm/pptok.h \
+ asm/preproc.h asm/stdscan.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/raa.h include/rbtree.h \
+ include/saa.h include/strlist.h include/tables.h include/ver.h \
+ output/dwarf.h output/elf.h output/outelf.h output/outform.h \
+ output/outlib.h output/stabs.h x86/insnsi.h x86/regs.h
+output/outform.$(O): output/outform.c asm/directiv.h asm/pptok.h \
+ asm/preproc.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/labels.h \
+ include/nasm.h include/nasmint.h include/nasmlib.h include/opflags.h \
+ include/perfhash.h include/strlist.h include/tables.h output/outform.h \
+ x86/insnsi.h x86/regs.h
+output/outieee.$(O): output/outieee.c asm/directiv.h asm/pptok.h \
+ asm/preproc.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/strlist.h include/tables.h \
+ include/ver.h output/outform.h output/outlib.h x86/insnsi.h x86/regs.h
+output/outlib.$(O): output/outlib.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/error.h include/labels.h \
+ include/nasm.h include/nasmint.h include/nasmlib.h include/opflags.h \
+ include/perfhash.h include/strlist.h include/tables.h output/outlib.h \
+ x86/insnsi.h x86/regs.h
+output/outmacho.$(O): output/outmacho.c asm/directiv.h asm/pptok.h \
+ asm/preproc.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/hashtbl.h include/ilog2.h include/labels.h include/nasm.h \
+ include/nasmint.h include/nasmlib.h include/opflags.h include/perfhash.h \
+ include/raa.h include/rbtree.h include/saa.h include/strlist.h \
+ include/tables.h include/ver.h output/dwarf.h output/outform.h \
+ output/outlib.h x86/insnsi.h x86/regs.h
+output/outobj.$(O): output/outobj.c asm/directiv.h asm/eval.h asm/pptok.h \
+ asm/preproc.h asm/stdscan.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/strlist.h include/tables.h \
+ include/ver.h output/outform.h output/outlib.h x86/insnsi.h x86/regs.h
+output/outrdf2.$(O): output/outrdf2.c asm/directiv.h asm/pptok.h \
+ asm/preproc.h config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/rdoff.h include/saa.h \
+ include/strlist.h include/tables.h output/outform.h output/outlib.h \
+ x86/insnsi.h x86/regs.h
+output/strtbl.$(O): output/strtbl.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/error.h include/hashtbl.h \
+ include/labels.h include/nasm.h include/nasmint.h include/nasmlib.h \
+ include/opflags.h include/perfhash.h include/strlist.h include/tables.h \
+ output/strtbl.h x86/insnsi.h x86/regs.h
+rdoff/collectn.$(O): rdoff/collectn.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/nasmint.h include/nasmlib.h include/rdoff.h \
+ rdoff/collectn.h rdoff/rdfutils.h
+rdoff/hash.$(O): rdoff/hash.c config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/compiler.h include/nasmint.h rdoff/hash.h
+rdoff/ldrdf.$(O): rdoff/ldrdf.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/nasmint.h include/nasmlib.h include/rdoff.h \
+ rdoff/collectn.h rdoff/ldsegs.h rdoff/rdfutils.h rdoff/rdlib.h \
+ rdoff/segtab.h rdoff/symtab.h
+rdoff/rdf2bin.$(O): rdoff/rdf2bin.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/nasmint.h include/nasmlib.h include/rdoff.h \
+ rdoff/rdfload.h rdoff/rdfutils.h
+rdoff/rdfdump.$(O): rdoff/rdfdump.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/nasmint.h include/nasmlib.h include/rdoff.h \
+ rdoff/rdfutils.h
+rdoff/rdflib.$(O): rdoff/rdflib.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/nasmint.h include/nasmlib.h include/rdoff.h \
+ rdoff/rdfutils.h
+rdoff/rdfload.$(O): rdoff/rdfload.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/nasmint.h include/nasmlib.h include/rdoff.h \
+ rdoff/collectn.h rdoff/rdfload.h rdoff/rdfutils.h rdoff/symtab.h
+rdoff/rdlar.$(O): rdoff/rdlar.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/compiler.h include/nasmint.h \
+ rdoff/rdlar.h
+rdoff/rdlib.$(O): rdoff/rdlib.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/nasmint.h include/nasmlib.h include/rdoff.h \
+ rdoff/rdfutils.h rdoff/rdlar.h rdoff/rdlib.h
+rdoff/rdoff.$(O): rdoff/rdoff.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/nasmint.h include/nasmlib.h include/rdoff.h \
+ rdoff/rdfutils.h
+rdoff/rdx.$(O): rdoff/rdx.c config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/bytesex.h include/compiler.h include/error.h \
+ include/nasmint.h include/nasmlib.h include/rdoff.h rdoff/rdfload.h \
+ rdoff/rdfutils.h rdoff/symtab.h
+rdoff/segtab.$(O): rdoff/segtab.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/nasmint.h include/nasmlib.h include/rdoff.h \
+ rdoff/rdfutils.h rdoff/segtab.h
+rdoff/symtab.$(O): rdoff/symtab.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/nasmint.h include/nasmlib.h include/rdoff.h \
+ rdoff/hash.h rdoff/rdfutils.h rdoff/symtab.h
+stdlib/snprintf.$(O): stdlib/snprintf.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/nasmint.h include/nasmlib.h
+stdlib/strlcpy.$(O): stdlib/strlcpy.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/compiler.h include/nasmint.h
+stdlib/strnlen.$(O): stdlib/strnlen.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/compiler.h include/nasmint.h
+stdlib/strrchrnul.$(O): stdlib/strrchrnul.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/compiler.h include/nasmint.h
+stdlib/vsnprintf.$(O): stdlib/vsnprintf.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/bytesex.h include/compiler.h \
+ include/error.h include/nasmint.h include/nasmlib.h
+x86/disp8.$(O): x86/disp8.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/disp8.h include/labels.h \
+ include/nasm.h include/nasmint.h include/nasmlib.h include/opflags.h \
+ include/perfhash.h include/strlist.h include/tables.h x86/insnsi.h \
+ x86/regs.h
+x86/iflag.$(O): x86/iflag.c config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/compiler.h include/iflag.h include/ilog2.h \
+ include/nasmint.h x86/iflaggen.h
+x86/insnsa.$(O): x86/insnsa.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ asm/tokens.h config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/iflag.h include/ilog2.h \
+ include/insns.h include/labels.h include/nasm.h include/nasmint.h \
+ include/nasmlib.h include/opflags.h include/perfhash.h include/strlist.h \
+ include/tables.h x86/iflaggen.h x86/insnsi.h x86/regs.h
+x86/insnsb.$(O): x86/insnsb.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ asm/tokens.h config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/iflag.h include/ilog2.h \
+ include/insns.h include/labels.h include/nasm.h include/nasmint.h \
+ include/nasmlib.h include/opflags.h include/perfhash.h include/strlist.h \
+ include/tables.h x86/iflaggen.h x86/insnsi.h x86/regs.h
+x86/insnsd.$(O): x86/insnsd.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ asm/tokens.h config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/iflag.h include/ilog2.h \
+ include/insns.h include/labels.h include/nasm.h include/nasmint.h \
+ include/nasmlib.h include/opflags.h include/perfhash.h include/strlist.h \
+ include/tables.h x86/iflaggen.h x86/insnsi.h x86/regs.h
+x86/insnsn.$(O): x86/insnsn.c config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/compiler.h include/nasmint.h include/tables.h \
+ x86/insnsi.h
+x86/regdis.$(O): x86/regdis.c x86/regdis.h x86/regs.h
+x86/regflags.$(O): x86/regflags.c asm/directiv.h asm/pptok.h asm/preproc.h \
+ config/config.h config/msvc.h config/unknown.h config/watcom.h \
+ include/bytesex.h include/compiler.h include/labels.h include/nasm.h \
+ include/nasmint.h include/nasmlib.h include/opflags.h include/perfhash.h \
+ include/strlist.h include/tables.h x86/insnsi.h x86/regs.h
+x86/regs.$(O): x86/regs.c config/config.h config/msvc.h config/unknown.h \
+ config/watcom.h include/compiler.h include/nasmint.h include/tables.h \
+ x86/insnsi.h
+x86/regvals.$(O): x86/regvals.c config/config.h config/msvc.h \
+ config/unknown.h config/watcom.h include/compiler.h include/nasmint.h \
+ include/tables.h x86/insnsi.h

+ 529 - 0
nasm/Makefile.in

@@ -0,0 +1,529 @@
+#
+# Auto-configuring Makefile for the Netwide Assembler.
+#
+# The Netwide Assembler is copyright (C) 1996 Simon Tatham and
+# Julian Hall. All rights reserved. The software is
+# redistributable under the license given in the file "LICENSE"
+# distributed in the NASM archive.
+
+@SET_MAKE@
+
+top_srcdir	= @top_srcdir@
+srcdir		= @srcdir@
+objdir		= @builddir@
+VPATH		= @srcdir@
+prefix		= @prefix@
+exec_prefix	= @exec_prefix@
+bindir		= @bindir@
+mandir		= @mandir@
+datarootdir	= @datarootdir@
+
+CC		= @CC@
+CFLAGS		= @CFLAGS@
+CPPFLAGS	= @CPPFLAGS@
+BUILD_CFLAGS	= $(CPPFLAGS) $(CFLAGS) @DEFS@
+INTERNAL_CFLAGS = -I$(srcdir) -I$(objdir) \
+		  -I$(srcdir)/include -I$(objdir)/include \
+		  -I$(srcdir)/x86 -I$(objdir)/x86 \
+		  -I$(srcdir)/asm -I$(objdir)/asm \
+		  -I$(srcdir)/disasm -I$(objdir)/disasm \
+		  -I$(srcdir)/output -I$(objdir)/output
+ALL_CFLAGS	= $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
+LDFLAGS		= @LDFLAGS@
+LIBS		= @LIBS@
+
+AR		= @AR@
+RANLIB		= @RANLIB@
+STRIP		= @STRIP@
+
+PERL		= perl
+PERLFLAGS	= -I$(srcdir)/perllib -I$(srcdir)
+RUNPERL         = $(PERL) $(PERLFLAGS)
+
+INSTALL		= @INSTALL@
+INSTALL_PROGRAM	= @INSTALL_PROGRAM@
+INSTALL_DATA	= @INSTALL_DATA@
+
+NROFF		= @NROFF@
+ASCIIDOC	= @ASCIIDOC@
+XMLTO		= @XMLTO@
+
+MAKENSIS	= makensis
+
+MKDIR		= mkdir -p
+RM_F		= rm -f
+RM_RF		= rm -rf
+LN_S		= @LN_S@
+FIND		= find
+
+# Binary suffixes
+O               = @OBJEXT@
+X               = @EXEEXT@
+A		= @LIBEXT@
+
+# Debug stuff
+ifeq ($(TRACE),1)
+	CFLAGS += -DNASM_TRACE
+endif
+
+.SUFFIXES:
+.SUFFIXES: $(X) .$(O) .$(A) .xml .1 .c .i .s .txt
+
+.PHONY: all doc rdf install clean distclean cleaner spotless install_rdf test
+.PHONY: install_doc everything install_everything strip perlreq dist tags TAGS
+.PHONY: manpages nsis
+
+.c.$(O):
+	$(CC) -c $(ALL_CFLAGS) -o $@ $<
+
+.c.s:
+	$(CC) -S $(ALL_CFLAGS) -o $@ $<
+
+.c.i:
+	$(CC) -E $(ALL_CFLAGS) -o $@ $<
+
+.txt.xml:
+	$(ASCIIDOC) -b docbook -d manpage -o $@ $<
+
+.xml.1:
+	$(XMLTO) man --skip-validation $< 2>/dev/null
+
+#-- Begin File Lists --#
+NASM =	asm/nasm.$(O)
+NDISASM = disasm/ndisasm.$(O)
+
+LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
+	stdlib/strnlen.$(O) stdlib/strrchrnul.$(O) \
+	\
+	nasmlib/ver.$(O) \
+	nasmlib/crc64.$(O) nasmlib/malloc.$(O) nasmlib/errfile.$(O) \
+	nasmlib/md5c.$(O) nasmlib/string.$(O) \
+	nasmlib/file.$(O) nasmlib/mmap.$(O) nasmlib/ilog2.$(O) \
+	nasmlib/realpath.$(O) nasmlib/path.$(O) \
+	nasmlib/filename.$(O) nasmlib/srcfile.$(O) \
+	nasmlib/zerobuf.$(O) nasmlib/readnum.$(O) nasmlib/bsi.$(O) \
+	nasmlib/rbtree.$(O) nasmlib/hashtbl.$(O) \
+	nasmlib/raa.$(O) nasmlib/saa.$(O) \
+	nasmlib/strlist.$(O) \
+	nasmlib/perfhash.$(O) nasmlib/badenum.$(O) \
+	\
+	common/common.$(O) \
+	\
+	x86/insnsa.$(O) x86/insnsb.$(O) x86/insnsd.$(O) x86/insnsn.$(O) \
+	x86/regs.$(O) x86/regvals.$(O) x86/regflags.$(O) x86/regdis.$(O) \
+	x86/disp8.$(O) x86/iflag.$(O) \
+	\
+	asm/error.$(O) \
+	asm/float.$(O) \
+	asm/directiv.$(O) asm/directbl.$(O) \
+	asm/pragma.$(O) \
+	asm/assemble.$(O) asm/labels.$(O) asm/parser.$(O) \
+	asm/preproc.$(O) asm/quote.$(O) asm/pptok.$(O) \
+	asm/listing.$(O) asm/eval.$(O) asm/exprlib.$(O) asm/exprdump.$(O) \
+	asm/stdscan.$(O) \
+	asm/strfunc.$(O) asm/tokhash.$(O) \
+	asm/segalloc.$(O) \
+	asm/preproc-nop.$(O) \
+	asm/rdstrnum.$(O) \
+	\
+	macros/macros.$(O) \
+	\
+	output/outform.$(O) output/outlib.$(O) output/legacy.$(O) \
+	output/strtbl.$(O) \
+	output/nulldbg.$(O) output/nullout.$(O) \
+	output/outbin.$(O) output/outaout.$(O) output/outcoff.$(O) \
+	output/outelf.$(O) \
+	output/outobj.$(O) output/outas86.$(O) output/outrdf2.$(O) \
+	output/outdbg.$(O) output/outieee.$(O) output/outmacho.$(O) \
+	output/codeview.$(O) \
+	\
+	disasm/disasm.$(O) disasm/sync.$(O)
+
+SUBDIRS  = stdlib nasmlib output asm disasm x86 common macros
+XSUBDIRS = test doc nsis rdoff
+DEPDIRS  = . include config x86 rdoff $(SUBDIRS)
+#-- End File Lists --#
+
+all: nasm$(X) ndisasm$(X) rdf
+
+NASMLIB = libnasm.$(A)
+
+$(NASMLIB): $(LIBOBJ)
+	$(RM_F) $(NASMLIB)
+	$(AR) cq $(NASMLIB) $(LIBOBJ)
+	$(RANLIB) $(NASMLIB)
+
+nasm$(X): $(NASM) $(NASMLIB)
+	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o nasm$(X) $(NASM) $(NASMLIB) $(LIBS)
+
+ndisasm$(X): $(NDISASM) $(NASMLIB)
+	$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o ndisasm$(X) $(NDISASM) $(NASMLIB) $(LIBS)
+
+#-- Begin Generated File Rules --#
+
+# These source files are automagically generated from data files using
+# Perl scripts. They're distributed, though, so it isn't necessary to
+# have Perl just to recompile NASM from the distribution.
+
+# Perl-generated source files
+PERLREQ = x86/insnsb.c x86/insnsa.c x86/insnsd.c x86/insnsi.h x86/insnsn.c \
+	  x86/regs.c x86/regs.h x86/regflags.c x86/regdis.c x86/regdis.h \
+	  x86/regvals.c asm/tokhash.c asm/tokens.h asm/pptok.h asm/pptok.c \
+	  x86/iflag.c x86/iflaggen.h \
+	  macros/macros.c \
+	  asm/pptok.ph asm/directbl.c asm/directiv.h \
+	  version.h version.mac version.mak nsis/version.nsh
+
+INSDEP = x86/insns.dat x86/insns.pl x86/insns-iflags.ph
+
+x86/iflag.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)/x86/insns.pl -fc \
+		$(srcdir)/x86/insns.dat x86/iflag.c
+x86/iflaggen.h: $(INSDEP)
+	$(RUNPERL) $(srcdir)/x86/insns.pl -fh \
+		$(srcdir)/x86/insns.dat x86/iflaggen.h
+x86/insnsb.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)/x86/insns.pl -b \
+		$(srcdir)/x86/insns.dat x86/insnsb.c
+x86/insnsa.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)/x86/insns.pl -a \
+		$(srcdir)/x86/insns.dat x86/insnsa.c
+x86/insnsd.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)/x86/insns.pl -d \
+		$(srcdir)/x86/insns.dat x86/insnsd.c
+x86/insnsi.h: $(INSDEP)
+	$(RUNPERL) $(srcdir)/x86/insns.pl -i \
+		$(srcdir)/x86/insns.dat x86/insnsi.h
+x86/insnsn.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)/x86/insns.pl -n \
+		$(srcdir)/x86/insns.dat x86/insnsn.c
+
+# These files contains all the standard macros that are derived from
+# the version number.
+version.h: version version.pl
+	$(RUNPERL) $(srcdir)/version.pl h < $(srcdir)/version > version.h
+version.mac: version version.pl
+	$(RUNPERL) $(srcdir)/version.pl mac < $(srcdir)/version > version.mac
+version.sed: version version.pl
+	$(RUNPERL) $(srcdir)/version.pl sed < $(srcdir)/version > version.sed
+version.mak: version version.pl
+	$(RUNPERL) $(srcdir)/version.pl make < $(srcdir)/version > version.mak
+nsis/version.nsh: version version.pl
+	$(RUNPERL) $(srcdir)/version.pl nsis < $(srcdir)/version > nsis/version.nsh
+
+# This source file is generated from the standard macros file
+# `standard.mac' by another Perl script. Again, it's part of the
+# standard distribution.
+macros/macros.c: macros/macros.pl asm/pptok.ph version.mac \
+	$(srcdir)/macros/*.mac $(srcdir)/output/*.mac
+	$(RUNPERL) $(srcdir)/macros/macros.pl version.mac \
+		$(srcdir)/macros/*.mac $(srcdir)/output/*.mac
+
+# These source files are generated from regs.dat by yet another
+# perl script.
+x86/regs.c: x86/regs.dat x86/regs.pl
+	$(RUNPERL) $(srcdir)/x86/regs.pl c \
+		$(srcdir)/x86/regs.dat > x86/regs.c
+x86/regflags.c: x86/regs.dat x86/regs.pl
+	$(RUNPERL) $(srcdir)/x86/regs.pl fc \
+		$(srcdir)/x86/regs.dat > x86/regflags.c
+x86/regdis.c: x86/regs.dat x86/regs.pl
+	$(RUNPERL) $(srcdir)/x86/regs.pl dc \
+		$(srcdir)/x86/regs.dat > x86/regdis.c
+x86/regdis.h: x86/regs.dat x86/regs.pl
+	$(RUNPERL) $(srcdir)/x86/regs.pl dh \
+		$(srcdir)/x86/regs.dat > x86/regdis.h
+x86/regvals.c: x86/regs.dat x86/regs.pl
+	$(RUNPERL) $(srcdir)/x86/regs.pl vc \
+		$(srcdir)/x86/regs.dat > x86/regvals.c
+x86/regs.h: x86/regs.dat x86/regs.pl
+	$(RUNPERL) $(srcdir)/x86/regs.pl h \
+		$(srcdir)/x86/regs.dat > x86/regs.h
+
+# Assembler token hash
+asm/tokhash.c: x86/insns.dat x86/regs.dat asm/tokens.dat asm/tokhash.pl \
+	perllib/phash.ph
+	$(RUNPERL) $(srcdir)/asm/tokhash.pl c \
+		$(srcdir)/x86/insns.dat $(srcdir)/x86/regs.dat \
+		$(srcdir)/asm/tokens.dat > asm/tokhash.c
+
+# Assembler token metadata
+asm/tokens.h: x86/insns.dat x86/regs.dat asm/tokens.dat asm/tokhash.pl \
+	perllib/phash.ph
+	$(RUNPERL) $(srcdir)/asm/tokhash.pl h \
+		$(srcdir)/x86/insns.dat $(srcdir)/x86/regs.dat \
+		$(srcdir)/asm/tokens.dat > asm/tokens.h
+
+# Preprocessor token hash
+asm/pptok.h: asm/pptok.dat asm/pptok.pl perllib/phash.ph
+	$(RUNPERL) $(srcdir)/asm/pptok.pl h \
+		$(srcdir)/asm/pptok.dat asm/pptok.h
+asm/pptok.c: asm/pptok.dat asm/pptok.pl perllib/phash.ph
+	$(RUNPERL) $(srcdir)/asm/pptok.pl c \
+		$(srcdir)/asm/pptok.dat asm/pptok.c
+asm/pptok.ph: asm/pptok.dat asm/pptok.pl perllib/phash.ph
+	$(RUNPERL) $(srcdir)/asm/pptok.pl ph \
+		$(srcdir)/asm/pptok.dat asm/pptok.ph
+
+# Directives hash
+asm/directiv.h: asm/directiv.dat nasmlib/perfhash.pl perllib/phash.ph
+	$(RUNPERL) $(srcdir)/nasmlib/perfhash.pl h \
+		$(srcdir)/asm/directiv.dat asm/directiv.h
+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
+
+#-- End Generated File Rules --#
+
+perlreq: $(PERLREQ)
+
+# This rule is only used for RDOFF
+.$(O)$(X):
+	$(CC) $(ALL_CFLAGS) -o $@ $< $(LDFLAGS) $(RDFLIB) $(NASMLIB) $(LIBS)
+
+RDFLN    = cd rdoff && ln -s
+RDFLNPFX =
+
+#-- Begin RDOFF Shared Rules --#
+
+RDFLIBOBJ = rdoff/rdoff.$(O) rdoff/rdfload.$(O) rdoff/symtab.$(O) \
+	    rdoff/collectn.$(O) rdoff/rdlib.$(O) rdoff/segtab.$(O) \
+	    rdoff/hash.$(O)
+
+RDFPROGS = rdoff/rdfdump$(X) rdoff/ldrdf$(X) rdoff/rdx$(X) rdoff/rdflib$(X) \
+	   rdoff/rdf2bin$(X)
+RDF2BINLINKS = rdoff/rdf2com$(X) rdoff/rdf2ith$(X) \
+	    rdoff/rdf2ihx$(X) rdoff/rdf2srec$(X)
+
+RDFLIB = rdoff/librdoff.$(A)
+RDFLIBS = $(RDFLIB) $(NASMLIB)
+
+rdoff/rdfdump$(X): rdoff/rdfdump.$(O) $(RDFLIBS)
+rdoff/ldrdf$(X): rdoff/ldrdf.$(O) $(RDFLIBS)
+rdoff/rdx$(X): rdoff/rdx.$(O) $(RDFLIBS)
+rdoff/rdflib$(X): rdoff/rdflib.$(O) $(RDFLIBS)
+rdoff/rdf2bin$(X): rdoff/rdf2bin.$(O) $(RDFLIBS)
+rdoff/rdf2com$(X): rdoff/rdf2bin$(X)
+	$(RM_F) rdoff/rdf2com$(X)
+	$(RDFLN) $(RDFLNPFX)rdf2bin$(X) $(RDFLNPFX)rdf2com$(X)
+rdoff/rdf2ith$(X): rdoff/rdf2bin$(X)
+	$(RM_F) rdoff/rdf2ith$(X)
+	$(RDFLN) $(RDFLNPFX)rdf2bin$(X) $(RDFLNPFX)rdf2ith$(X)
+rdoff/rdf2ihx$(X): rdoff/rdf2bin$(X)
+	$(RM_F) rdoff/rdf2ihx$(X)
+	$(RDFLN) $(RDFLNPFX)rdf2bin$(X) $(RDFLNPFX)rdf2ihx$(X)
+rdoff/rdf2srec$(X): rdoff/rdf2bin$(X)
+	$(RM_F) rdoff/rdf2srec$(X)
+	$(RDFLN) $(RDFLNPFX)rdf2bin$(X) $(RDFLNPFX)rdf2srec$(X)
+
+#-- End RDOFF Shared Rules --#
+
+rdf: $(RDFPROGS) $(RDF2BINLINKS)
+
+$(RDFLIB): $(RDFLIBOBJ)
+	$(RM_F) $(RDFLIB)
+	$(AR) cq $(RDFLIB) $(RDFLIBOBJ)
+	$(RANLIB) $(RDFLIB)
+
+#-- Begin NSIS Rules --#
+
+# NSIS is not built except by explicit request, as it only applies to
+# Windows platforms
+nsis/arch.nsh: nsis/getpearch.pl nasm$(X)
+	$(PERL) $(srcdir)/nsis/getpearch.pl nasm$(X) > nsis/arch.nsh
+
+# Should only be done after "make everything".
+# The use of redirection here keeps makensis from moving the cwd to the
+# source directory.
+nsis: nsis/nasm.nsi nsis/arch.nsh nsis/version.nsh
+	$(MAKENSIS) -Dsrcdir="$(srcdir)" -Dobjdir="$(objdir)" - < nsis/nasm.nsi
+
+#-- End NSIS Rules --#
+
+# Generated manpages, also pregenerated for distribution
+manpages: nasm.1 ndisasm.1
+
+install: nasm$(X) ndisasm$(X)
+	$(MKDIR) $(DESTDIR)$(bindir)
+	$(INSTALL_PROGRAM) nasm$(X) $(DESTDIR)$(bindir)/nasm$(X)
+	$(INSTALL_PROGRAM) ndisasm$(X) $(DESTDIR)$(bindir)/ndisasm$(X)
+	$(MKDIR) $(DESTDIR)$(mandir)/man1
+	$(INSTALL_DATA) $(srcdir)/nasm.1 $(DESTDIR)$(mandir)/man1/nasm.1
+	$(INSTALL_DATA) $(srcdir)/ndisasm.1 $(DESTDIR)$(mandir)/man1/ndisasm.1
+
+clean:
+	for d in . $(SUBDIRS) $(XSUBDIRS); do \
+		$(RM_F) "$$d"/*.$(O) "$$d"/*.s "$$d"/*.i "$$d"/*.$(A) ; \
+	done
+	$(RM_F) nasm$(X) ndisasm$(X)
+	$(RM_F) nasm-*-installer-*.exe
+	$(RM_F) tags TAGS
+	$(RM_F) nsis/arch.nsh
+	$(RM_F) perlbreq.si
+	$(RM_F) $(RDFPROGS) $(RDF2BINLINKS)
+
+distclean: clean
+	$(RM_F) config.log config.status config/config.h
+	for d in . $(SUBDIRS) $(XSUBDIRS); do \
+		$(RM_F) "$$d"/*~ "$$d"/*.bak "$$d"/*.lst "$$d"/*.bin ; \
+	done
+	$(RM_F) test/*.$(O)
+	$(RM_RF) autom4te*.cache
+	$(RM_F) Makefile *.dep
+
+cleaner: clean
+	$(RM_F) $(PERLREQ) *.1 nasm.spec
+	$(MAKE) -C doc clean
+	$(RM_F) *.dep
+
+spotless: distclean cleaner
+	$(RM_F) doc/Makefile
+
+strip:
+	$(STRIP) --strip-unneeded nasm$(X) ndisasm$(X)
+
+TAGS:
+	$(RM_F) TAGS
+	$(FIND) . -name '*.[hcS]' -print | xargs etags -a
+
+tags:
+	$(RM_F) tags
+	$(FIND) . -name '*.[hcS]' -print | xargs ctags -a
+
+cscope:
+	$(RM_F) cscope.out cscope.files
+	$(FIND) . -name '*.[hcS]' -print > cscope.files
+	cscope -b -f cscope.out
+
+rdf_install install_rdf install_rdoff:
+	$(MKDIR) $(DESTDIR)$(bindir)
+	for f in $(RDFPROGS); do \
+		$(INSTALL_PROGRAM) "$$f" '$(DESTDIR)$(bindir)'/ ; \
+	done
+	cd '$(DESTDIR)$(bindir)' && \
+	for f in $(RDF2BINLINKS); do \
+		bn=`basename "$$f"` && $(RM_F) "$$bn" && \
+		$(LN_S) rdf2bin$(X) "$$bn" ; \
+	done
+	$(MKDIR) $(DESTDIR)$(mandir)/man1
+	$(INSTALL_DATA) $(srcdir)/rdoff/*.1 $(DESTDIR)$(mandir)/man1/
+
+doc:
+	$(MAKE) -C doc all
+
+doc_install install_doc:
+	$(MAKE) -C doc install
+
+everything: all manpages doc rdf
+
+install_everything: everything install install_doc install_rdf
+
+dist:
+	$(MAKE) alldeps
+	$(MAKE) spotless perlreq manpages spec
+	autoheader
+	autoconf
+	$(RM_RF) ./autom4te*.cache
+
+tar: dist
+	tar -cvj --exclude CVS -C .. -f ../nasm-`cat version`-`date +%Y%m%d`.tar.bz2 `basename \`pwd\``
+
+spec: nasm.spec
+
+ALLPERLSRC := $(shell find $(srcdir) -type f -name '*.p[lh]')
+
+perlbreq.si: $(ALLPERLSRC)
+	sed -n -r -e 's/^[[:space:]]*use[[:space:]]+([^[:space:];]+).*$$/BuildRequires: perl(\1)/p' $(ALLPERLSRC) | \
+	sed -r -e '/perl\((strict|warnings|Win32.*)\)/d' | \
+	sort | uniq > perlbreq.si || ( rm -f perlbreq.si ; false )
+
+nasm.spec: nasm.spec.in nasm.spec.sed version.sed perlbreq.si
+	sed -f version.sed -f nasm.spec.sed \
+	< nasm.spec.in > nasm.spec || ( rm -f nasm.spec ; false )
+
+splint:
+	splint -weak *.c
+
+test: nasm$(X)
+	cd test && $(RUNPERL) performtest.pl --nasm=../nasm *.asm
+
+golden: nasm$(X)
+	cd test && $(RUNPERL) performtest.pl --golden --nasm=../nasm *.asm
+
+#
+# Rules to run autoreconf if necessary
+#
+configure: configure.ac aclocal.m4
+	autoreconf
+
+config.status: configure
+	@if [ ! -f config.status ]; then \
+		echo "*** ERROR: Need to run configure!" 1>&2 ; \
+		exit 1; \
+	fi
+	sh config.status --recheck
+
+Makefile: config.status Makefile.in doc/Makefile.in
+	sh config.status
+
+doc/Makefile: Makefile
+
+config/config.h: config.status
+
+#
+# Does this version of this file have external dependencies?  This definition
+# will be automatically updated by mkdep.pl as needed.
+#
+EXTERNAL_DEPENDENCIES = 1
+
+#
+# Generate dependency information for this Makefile only.
+# If this Makefile has external dependency information, then
+# the dependency information will remain external, so it doesn't
+# pollute the git logs.
+#
+Makefile.dep: $(PERLREQ) tools/mkdep.pl config.status
+	$(RUNPERL) tools/mkdep.pl -M Makefile.in -- $(DEPDIRS)
+
+dep: Makefile.dep
+
+#
+# This build dependencies in *ALL* makefiles, and forces all
+# dependencies to be inserted inline.  For that reason, it should only
+# be invoked manually or via "make dist".  It should be run before
+# creating release archives.
+#
+alldeps: $(PERLREQ) tools/syncfiles.pl tools/mkdep.pl
+	$(RUNPERL) tools/syncfiles.pl Makefile.in Mkfiles/*.mak
+	$(RUNPERL) tools/mkdep.pl -i -M Makefile.in Mkfiles/*.mak -- \
+		$(DEPDIRS)
+	$(RM_F) *.dep
+	if [ -f config.status ]; then \
+		if [ $(EXTERNAL_DEPENDENCIES) -eq 1 ]; then \
+			sh config.status --recheck; \
+		fi; \
+		sh config.status; \
+	fi
+
+# Strip internal dependency information from all Makefiles; this makes
+# the output good for git checkin
+cleandeps: $(PERLREQ) tools/syncfiles.pl tools/mkdep.pl
+	$(RUNPERL) tools/syncfiles.pl Makefile.in Mkfiles/*.mak
+	$(RUNPERL) tools/mkdep.pl -e -M Makefile.in Mkfiles/*.mak -- \
+		$(DEPDIRS)
+	$(RM_F) *.dep
+	if [ -f config.status ]; then \
+		if [ $(EXTERNAL_DEPENDENCIES) -eq 0 ]; then \
+			sh config.status --recheck; \
+		fi; \
+		sh config.status; \
+	fi
+
+#-- Magic hints to mkdep.pl --#
+# @object-ending: ".$(O)"
+# @path-separator: "/"
+# @external: "Makefile.dep"
+# @include-command: "-include"
+# @selfrule: "1"
+#-- Everything below is generated by mkdep.pl - do not edit --#
+-include Makefile.dep

+ 46 - 0
nasm/Mkfiles/README

@@ -0,0 +1,46 @@
+These are pre-created Makefiles for various platforms, use them if
+GNU autoconf/automake packages are not supported on your system.
+
+The Makefiles are:
+
+  Filename      Target		Compiler	Tested with
+  ---------------------------------------------------------------------------
+  msvc.mak	Win32		MS Visual C++	Visual Visual Studio 2013-2017
+
+	For building on a Win32 host using Microsoft Visual C++.
+
+	Usage:	nmake /f Mkfiles\msvc.mak
+
+	If the following tools are installed, the full installer package can
+	be built:
+		1. Perl (5.6 or later), e.g. ActivePerl or StrawberryPerl
+		   http://strawberryperl.com/
+		2. Nullsoft Scriptable Install System (makensis)
+		   http://nsis.sourceforge.net/Download
+		3. Ghostscript (ps2pdf) or Acrobat Distriller (acrodist)
+		   https://downloads.ghostscript.com/
+		4. The Adobe Source Sans Pro and Source Code Pro fonts
+		   https://github.com/adobe-fonts
+		5. The Perl module Font::TTF (can usually be installed
+		   via the "CPAN Client" in your Perl distribution)
+		   http://search.cpan.org/~bhallissy/Font-TTF/
+		6. The Perl module Sort::Versions (can usually be installed
+		   via the "CPAN Client" in your Perl distribution)
+		   http://search.cpan.org/~neilb/Sort-Versions-1.62/lib/Sort/Versions.pm
+
+	The tools need to be in your current path.  To build the
+	installer package, run:
+
+		nmake /f Mkfiles\msvc.mak everything nsis
+
+  Filename      Target		Compiler	Tested with
+  ---------------------------------------------------------------------------
+  openwcom.mak	DOS,Win32,OS/2	OpenWatcom C	OpenWatcom 1.7 (Win32)
+		Linux (386)			OpenWatcom 1.9 (Linux)
+
+	For building on a DOS, OS/2, Win32 or Linux host using OpenWatcom.
+	OpenWatcom can be downloaded from http://www.openwatcom.org/.
+
+	Usage:	wmake /f Mkfiles/openwcom.mak <target>
+
+	<target> is dos, win32, os2, or linux386.

+ 399 - 0
nasm/Mkfiles/msvc.mak

@@ -0,0 +1,399 @@
+# -*- makefile -*-
+#
+# Makefile for building NASM using Microsoft Visual C++ and NMAKE.
+# Tested on Microsoft Visual C++ 2005 Express Edition.
+#
+# Make sure to put the appropriate directories in your PATH, in
+# the case of MSVC++ 2005, they are ...\VC\bin and ...\Common7\IDE.
+#
+# This is typically done by opening the Visual Studio Command Prompt.
+#
+
+top_srcdir	= .
+srcdir		= .
+objdir          = .
+VPATH		= .
+prefix		= "C:\Program Files\NASM"
+exec_prefix	= $(prefix)
+bindir		= $(prefix)/bin
+mandir		= $(prefix)/man
+
+!IF "$(DEBUG)" == "1"
+CFLAGS		= /Od /Zi
+LDFLAGS		= /DEBUG
+!ELSE
+CFLAGS		= /O2 /Zi
+LDFLAGS		= /DEBUG /OPT:REF /OPT:ICF # (latter two undoes /DEBUG harm)
+!ENDIF
+
+CC		= cl
+AR		= lib
+CFLAGS		= $(CFLAGS) /W2
+BUILD_CFLAGS	= $(CFLAGS)
+INTERNAL_CFLAGS = /I$(srcdir) /I. \
+		  /I$(srcdir)/include /I./include \
+		  /I$(srcdir)/x86 /I./x86 \
+		  /I$(srcdir)/asm /I./asm \
+		  /I$(srcdir)/disasm /I./disasm \
+		  /I$(srcdir)/output /I./output
+ALL_CFLAGS	= $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
+LDFLAGS		= /link $(LINKFLAGS) /SUBSYSTEM:CONSOLE /RELEASE
+LIBS		=
+
+PERL		= perl
+PERLFLAGS	= -I$(srcdir)/perllib -I$(srcdir)
+RUNPERL         = $(PERL) $(PERLFLAGS)
+
+MAKENSIS        = makensis
+
+RM_F		= -del /f
+LN_S		= copy
+
+# Binary suffixes
+O               = obj
+A		= lib
+X               = .exe
+.SUFFIXES:
+.SUFFIXES: $(X) .$(A) .$(O) .c .i .s .1 .man
+
+.c.obj:
+	$(CC) /c $(ALL_CFLAGS) /Fo$@ $<
+
+#-- Begin File Lists --#
+# Edit in Makefile.in, not here!
+NASM =	asm\nasm.$(O)
+NDISASM = disasm\ndisasm.$(O)
+
+LIBOBJ = stdlib\snprintf.$(O) stdlib\vsnprintf.$(O) stdlib\strlcpy.$(O) \
+	stdlib\strnlen.$(O) stdlib\strrchrnul.$(O) \
+	\
+	nasmlib\ver.$(O) \
+	nasmlib\crc64.$(O) nasmlib\malloc.$(O) nasmlib\errfile.$(O) \
+	nasmlib\md5c.$(O) nasmlib\string.$(O) \
+	nasmlib\file.$(O) nasmlib\mmap.$(O) nasmlib\ilog2.$(O) \
+	nasmlib\realpath.$(O) nasmlib\path.$(O) \
+	nasmlib\filename.$(O) nasmlib\srcfile.$(O) \
+	nasmlib\zerobuf.$(O) nasmlib\readnum.$(O) nasmlib\bsi.$(O) \
+	nasmlib\rbtree.$(O) nasmlib\hashtbl.$(O) \
+	nasmlib\raa.$(O) nasmlib\saa.$(O) \
+	nasmlib\strlist.$(O) \
+	nasmlib\perfhash.$(O) nasmlib\badenum.$(O) \
+	\
+	common\common.$(O) \
+	\
+	x86\insnsa.$(O) x86\insnsb.$(O) x86\insnsd.$(O) x86\insnsn.$(O) \
+	x86\regs.$(O) x86\regvals.$(O) x86\regflags.$(O) x86\regdis.$(O) \
+	x86\disp8.$(O) x86\iflag.$(O) \
+	\
+	asm\error.$(O) \
+	asm\float.$(O) \
+	asm\directiv.$(O) asm\directbl.$(O) \
+	asm\pragma.$(O) \
+	asm\assemble.$(O) asm\labels.$(O) asm\parser.$(O) \
+	asm\preproc.$(O) asm\quote.$(O) asm\pptok.$(O) \
+	asm\listing.$(O) asm\eval.$(O) asm\exprlib.$(O) asm\exprdump.$(O) \
+	asm\stdscan.$(O) \
+	asm\strfunc.$(O) asm\tokhash.$(O) \
+	asm\segalloc.$(O) \
+	asm\preproc-nop.$(O) \
+	asm\rdstrnum.$(O) \
+	\
+	macros\macros.$(O) \
+	\
+	output\outform.$(O) output\outlib.$(O) output\legacy.$(O) \
+	output\strtbl.$(O) \
+	output\nulldbg.$(O) output\nullout.$(O) \
+	output\outbin.$(O) output\outaout.$(O) output\outcoff.$(O) \
+	output\outelf.$(O) \
+	output\outobj.$(O) output\outas86.$(O) output\outrdf2.$(O) \
+	output\outdbg.$(O) output\outieee.$(O) output\outmacho.$(O) \
+	output\codeview.$(O) \
+	\
+	disasm\disasm.$(O) disasm\sync.$(O)
+
+SUBDIRS  = stdlib nasmlib output asm disasm x86 common macros
+XSUBDIRS = test doc nsis rdoff
+DEPDIRS  = . include config x86 rdoff $(SUBDIRS)
+#-- End File Lists --#
+
+NASMLIB = libnasm.$(A)
+
+all: nasm$(X) ndisasm$(X) rdf
+
+nasm$(X): $(NASM) $(NASMLIB)
+	$(CC) /Fe$@ $(NASM) $(LDFLAGS) $(NASMLIB) $(LIBS)
+
+ndisasm$(X): $(NDISASM) $(NASMLIB)
+	$(CC) /Fe$@ $(NDISASM) $(LDFLAGS) $(NASMLIB) $(LIBS)
+
+$(NASMLIB): $(LIBOBJ)
+	$(AR) $(ARFLAGS) /OUT:$@ $**
+
+#-- Begin Generated File Rules --#
+# Edit in Makefile.in, not here!
+
+# These source files are automagically generated from data files using
+# Perl scripts. They're distributed, though, so it isn't necessary to
+# have Perl just to recompile NASM from the distribution.
+
+# Perl-generated source files
+PERLREQ = x86\insnsb.c x86\insnsa.c x86\insnsd.c x86\insnsi.h x86\insnsn.c \
+	  x86\regs.c x86\regs.h x86\regflags.c x86\regdis.c x86\regdis.h \
+	  x86\regvals.c asm\tokhash.c asm\tokens.h asm\pptok.h asm\pptok.c \
+	  x86\iflag.c x86\iflaggen.h \
+	  macros\macros.c \
+	  asm\pptok.ph asm\directbl.c asm\directiv.h \
+	  version.h version.mac version.mak nsis\version.nsh
+
+INSDEP = x86\insns.dat x86\insns.pl x86\insns-iflags.ph
+
+x86\iflag.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)\x86\insns.pl -fc \
+		$(srcdir)\x86\insns.dat x86\iflag.c
+x86\iflaggen.h: $(INSDEP)
+	$(RUNPERL) $(srcdir)\x86\insns.pl -fh \
+		$(srcdir)\x86\insns.dat x86\iflaggen.h
+x86\insnsb.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)\x86\insns.pl -b \
+		$(srcdir)\x86\insns.dat x86\insnsb.c
+x86\insnsa.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)\x86\insns.pl -a \
+		$(srcdir)\x86\insns.dat x86\insnsa.c
+x86\insnsd.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)\x86\insns.pl -d \
+		$(srcdir)\x86\insns.dat x86\insnsd.c
+x86\insnsi.h: $(INSDEP)
+	$(RUNPERL) $(srcdir)\x86\insns.pl -i \
+		$(srcdir)\x86\insns.dat x86\insnsi.h
+x86\insnsn.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)\x86\insns.pl -n \
+		$(srcdir)\x86\insns.dat x86\insnsn.c
+
+# These files contains all the standard macros that are derived from
+# the version number.
+version.h: version version.pl
+	$(RUNPERL) $(srcdir)\version.pl h < $(srcdir)\version > version.h
+version.mac: version version.pl
+	$(RUNPERL) $(srcdir)\version.pl mac < $(srcdir)\version > version.mac
+version.sed: version version.pl
+	$(RUNPERL) $(srcdir)\version.pl sed < $(srcdir)\version > version.sed
+version.mak: version version.pl
+	$(RUNPERL) $(srcdir)\version.pl make < $(srcdir)\version > version.mak
+nsis\version.nsh: version version.pl
+	$(RUNPERL) $(srcdir)\version.pl nsis < $(srcdir)\version > nsis\version.nsh
+
+# This source file is generated from the standard macros file
+# `standard.mac' by another Perl script. Again, it's part of the
+# standard distribution.
+macros\macros.c: macros\macros.pl asm\pptok.ph version.mac \
+	$(srcdir)\macros\*.mac $(srcdir)\output\*.mac
+	$(RUNPERL) $(srcdir)\macros\macros.pl version.mac \
+		$(srcdir)\macros\*.mac $(srcdir)\output\*.mac
+
+# These source files are generated from regs.dat by yet another
+# perl script.
+x86\regs.c: x86\regs.dat x86\regs.pl
+	$(RUNPERL) $(srcdir)\x86\regs.pl c \
+		$(srcdir)\x86\regs.dat > x86\regs.c
+x86\regflags.c: x86\regs.dat x86\regs.pl
+	$(RUNPERL) $(srcdir)\x86\regs.pl fc \
+		$(srcdir)\x86\regs.dat > x86\regflags.c
+x86\regdis.c: x86\regs.dat x86\regs.pl
+	$(RUNPERL) $(srcdir)\x86\regs.pl dc \
+		$(srcdir)\x86\regs.dat > x86\regdis.c
+x86\regdis.h: x86\regs.dat x86\regs.pl
+	$(RUNPERL) $(srcdir)\x86\regs.pl dh \
+		$(srcdir)\x86\regs.dat > x86\regdis.h
+x86\regvals.c: x86\regs.dat x86\regs.pl
+	$(RUNPERL) $(srcdir)\x86\regs.pl vc \
+		$(srcdir)\x86\regs.dat > x86\regvals.c
+x86\regs.h: x86\regs.dat x86\regs.pl
+	$(RUNPERL) $(srcdir)\x86\regs.pl h \
+		$(srcdir)\x86\regs.dat > x86\regs.h
+
+# Assembler token hash
+asm\tokhash.c: x86\insns.dat x86\regs.dat asm\tokens.dat asm\tokhash.pl \
+	perllib\phash.ph
+	$(RUNPERL) $(srcdir)\asm\tokhash.pl c \
+		$(srcdir)\x86\insns.dat $(srcdir)\x86\regs.dat \
+		$(srcdir)\asm\tokens.dat > asm\tokhash.c
+
+# Assembler token metadata
+asm\tokens.h: x86\insns.dat x86\regs.dat asm\tokens.dat asm\tokhash.pl \
+	perllib\phash.ph
+	$(RUNPERL) $(srcdir)\asm\tokhash.pl h \
+		$(srcdir)\x86\insns.dat $(srcdir)\x86\regs.dat \
+		$(srcdir)\asm\tokens.dat > asm\tokens.h
+
+# Preprocessor token hash
+asm\pptok.h: asm\pptok.dat asm\pptok.pl perllib\phash.ph
+	$(RUNPERL) $(srcdir)\asm\pptok.pl h \
+		$(srcdir)\asm\pptok.dat asm\pptok.h
+asm\pptok.c: asm\pptok.dat asm\pptok.pl perllib\phash.ph
+	$(RUNPERL) $(srcdir)\asm\pptok.pl c \
+		$(srcdir)\asm\pptok.dat asm\pptok.c
+asm\pptok.ph: asm\pptok.dat asm\pptok.pl perllib\phash.ph
+	$(RUNPERL) $(srcdir)\asm\pptok.pl ph \
+		$(srcdir)\asm\pptok.dat asm\pptok.ph
+
+# Directives hash
+asm\directiv.h: asm\directiv.dat nasmlib\perfhash.pl perllib\phash.ph
+	$(RUNPERL) $(srcdir)\nasmlib\perfhash.pl h \
+		$(srcdir)\asm\directiv.dat asm\directiv.h
+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
+
+#-- End Generated File Rules --#
+
+perlreq: $(PERLREQ)
+
+# This rule is only used for RDOFF
+.obj.exe:
+	$(CC) /Fe$@ $< $(LDFLAGS) $(RDFLIB) $(NASMLIB) $(LIBS)
+
+RDFLN = copy
+RDFLNPFX = rdoff^\
+
+#-- Begin RDOFF Shared Rules --#
+# Edit in Makefile.in, not here!
+
+RDFLIBOBJ = rdoff\rdoff.$(O) rdoff\rdfload.$(O) rdoff\symtab.$(O) \
+	    rdoff\collectn.$(O) rdoff\rdlib.$(O) rdoff\segtab.$(O) \
+	    rdoff\hash.$(O)
+
+RDFPROGS = rdoff\rdfdump$(X) rdoff\ldrdf$(X) rdoff\rdx$(X) rdoff\rdflib$(X) \
+	   rdoff\rdf2bin$(X)
+RDF2BINLINKS = rdoff\rdf2com$(X) rdoff\rdf2ith$(X) \
+	    rdoff\rdf2ihx$(X) rdoff\rdf2srec$(X)
+
+RDFLIB = rdoff\librdoff.$(A)
+RDFLIBS = $(RDFLIB) $(NASMLIB)
+
+rdoff\rdfdump$(X): rdoff\rdfdump.$(O) $(RDFLIBS)
+rdoff\ldrdf$(X): rdoff\ldrdf.$(O) $(RDFLIBS)
+rdoff\rdx$(X): rdoff\rdx.$(O) $(RDFLIBS)
+rdoff\rdflib$(X): rdoff\rdflib.$(O) $(RDFLIBS)
+rdoff\rdf2bin$(X): rdoff\rdf2bin.$(O) $(RDFLIBS)
+rdoff\rdf2com$(X): rdoff\rdf2bin$(X)
+	$(RM_F) rdoff\rdf2com$(X)
+	$(RDFLN) $(RDFLNPFX)rdf2bin$(X) $(RDFLNPFX)rdf2com$(X)
+rdoff\rdf2ith$(X): rdoff\rdf2bin$(X)
+	$(RM_F) rdoff\rdf2ith$(X)
+	$(RDFLN) $(RDFLNPFX)rdf2bin$(X) $(RDFLNPFX)rdf2ith$(X)
+rdoff\rdf2ihx$(X): rdoff\rdf2bin$(X)
+	$(RM_F) rdoff\rdf2ihx$(X)
+	$(RDFLN) $(RDFLNPFX)rdf2bin$(X) $(RDFLNPFX)rdf2ihx$(X)
+rdoff\rdf2srec$(X): rdoff\rdf2bin$(X)
+	$(RM_F) rdoff\rdf2srec$(X)
+	$(RDFLN) $(RDFLNPFX)rdf2bin$(X) $(RDFLNPFX)rdf2srec$(X)
+
+#-- End RDOFF Shared Rules --#
+
+rdf: $(RDFPROGS) $(RDF2BINLINKS)
+
+$(RDFLIB): $(RDFLIBOBJ)
+	$(AR) $(ARFLAGS) /OUT:$@ $**
+
+#-- Begin NSIS Rules --#
+# Edit in Makefile.in, not here!
+
+# NSIS is not built except by explicit request, as it only applies to
+# Windows platforms
+nsis\arch.nsh: nsis\getpearch.pl nasm$(X)
+	$(PERL) $(srcdir)\nsis\getpearch.pl nasm$(X) > nsis\arch.nsh
+
+# Should only be done after "make everything".
+# The use of redirection here keeps makensis from moving the cwd to the
+# source directory.
+nsis: nsis\nasm.nsi nsis\arch.nsh nsis\version.nsh
+	$(MAKENSIS) -Dsrcdir="$(srcdir)" -Dobjdir="$(objdir)" - < nsis\nasm.nsi
+
+#-- End NSIS Rules --#
+
+clean:
+	-del /f /s *.$(O)
+	-del /f /s *.pdb
+	-del /f /s *.s
+	-del /f /s *.i
+	-del /f $(NASMLIB) $(RDFLIB)
+	-del /f nasm$(X)
+	-del /f ndisasm$(X)
+	-del /f rdoff\*$(X)
+
+distclean: clean
+	-del /f config.h
+	-del /f config.log
+	-del /f config.status
+	-del /f Makefile
+	-del /f /s *~
+	-del /f /s *.bak
+	-del /f /s *.lst
+	-del /f /s *.bin
+	-del /f /s *.dep
+	-del /f output\*~
+	-del /f output\*.bak
+	-del /f test\*.lst
+	-del /f test\*.bin
+	-del /f test\*.$(O)
+	-del /f test\*.bin
+	-del /f/s autom4te*.cache
+	rem cd rdoff && $(MAKE) distclean
+
+cleaner: clean
+	-del /f $(PERLREQ)
+	-del /f *.man
+	-del /f nasm.spec
+	rem cd doc && $(MAKE) clean
+
+spotless: distclean cleaner
+	-del /f doc\Makefile
+	-del doc\*~
+	-del doc\*.bak
+
+strip:
+
+# Abuse doc/Makefile.in to build nasmdoc.pdf only
+docs:
+	cd doc && $(MAKE) /f Makefile.in srcdir=. top_srcdir=.. \
+		PERL=$(PERL) PDFOPT= nasmdoc.pdf
+
+everything: all docs nsis
+
+#
+# Does this version of this file have external dependencies?  This definition
+# will be automatically updated by mkdep.pl as needed.
+#
+EXTERNAL_DEPENDENCIES = 1
+
+#
+# Generate dependency information for this Makefile only.
+# If this Makefile has external dependency information, then
+# the dependency information will remain external, so it doesn't
+# pollute the git logs.
+#
+msvc.dep: $(PERLREQ) tools\mkdep.pl
+	$(RUNPERL) tools\mkdep.pl -M Mkfiles\msvc.mak -- $(DEPDIRS)
+
+dep: msvc.dep
+
+# Include and/or generate msvc.dep as needed. This is too complex to
+# use the include-command feature, but we can open-code it here.
+MKDEP=0
+!IF $(EXTERNAL_DEPENDENCIES) == 1 && $(MKDEP) == 0
+!IF EXISTS(msvc.dep)
+!INCLUDE msvc.dep
+!ELSEIF [$(MAKE) /c MKDEP=1 /f Mkfiles\msvc.mak msvc.dep] == 0
+!INCLUDE msvc.dep
+!ELSE
+!ERROR Unable to rebuild dependencies file msvc.dep
+!ENDIF
+!ENDIF
+
+#-- Magic hints to mkdep.pl --#
+# @object-ending: ".$(O)"
+# @path-separator: "\"
+# @exclude: "config\config.h"
+# @external: "msvc.dep"
+# @selfrule: "1"
+#-- Everything below is generated by mkdep.pl - do not edit --#

+ 758 - 0
nasm/Mkfiles/openwcom.mak

@@ -0,0 +1,758 @@
+# -*- makefile -*-
+#
+# Makefile for building NASM using OpenWatcom
+# cross-compile on a DOS/Win32/OS2 platform host
+#
+
+top_srcdir  = .
+srcdir      = .
+VPATH       = $(srcdir)\asm;$(srcdir)\x86;asm;x86;$(srcdir)\macros;macros;$(srcdir)\output;$(srcdir)\lib;$(srcdir)\common;$(srcdir)\stdlib;$(srcdir)\nasmlib;$(srcdir)\disasm
+prefix      = C:\Program Files\NASM
+exec_prefix = $(prefix)
+bindir      = $(prefix)\bin
+mandir      = $(prefix)\man
+
+CC      = *wcl386
+DEBUG       =
+CFLAGS      = -zq -6 -ox -wx -ze -fpi $(DEBUG)
+BUILD_CFLAGS    = $(CFLAGS) $(%TARGET_CFLAGS)
+INTERNAL_CFLAGS = -I$(srcdir) -I. -I$(srcdir)\include -I$(srcdir)\x86 -Ix86 -I$(srcdir)\asm -Iasm -I$(srcdir)\disasm -I$(srcdir)\output
+ALL_CFLAGS  = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS)
+LD      = *wlink
+LDEBUG      =
+LDFLAGS     = op quiet $(%TARGET_LFLAGS) $(LDEBUG)
+LIBS        =
+STRIP       = wstrip
+
+PERL		= perl
+PERLFLAGS	= -I$(srcdir)\perllib -I$(srcdir)
+RUNPERL         = $(PERL) $(PERLFLAGS)
+
+MAKENSIS        = makensis
+
+# Binary suffixes
+O               = obj
+X               = .exe
+
+# WMAKE errors out if a suffix is declared more than once, including
+# its own built-in declarations.  Thus, we need to explicitly clear the list
+# first.  Also, WMAKE only allows implicit rules that point "to the left"
+# in this list!
+.SUFFIXES:
+.SUFFIXES: .man .1 .$(O) .i .c
+
+# Needed to find C files anywhere but in the current directory
+.c : $(VPATH)
+
+.c.$(O):
+    @set INCLUDE=
+    $(CC) -c $(ALL_CFLAGS) -fo=$^@ $[@
+
+#-- Begin File Lists --#
+# Edit in Makefile.in, not here!
+NASM =	asm\nasm.$(O)
+NDISASM = disasm\ndisasm.$(O)
+
+LIBOBJ = stdlib\snprintf.$(O) stdlib\vsnprintf.$(O) stdlib\strlcpy.$(O) &
+	stdlib\strnlen.$(O) stdlib\strrchrnul.$(O) &
+	&
+	nasmlib\ver.$(O) &
+	nasmlib\crc64.$(O) nasmlib\malloc.$(O) nasmlib\errfile.$(O) &
+	nasmlib\md5c.$(O) nasmlib\string.$(O) &
+	nasmlib\file.$(O) nasmlib\mmap.$(O) nasmlib\ilog2.$(O) &
+	nasmlib\realpath.$(O) nasmlib\path.$(O) &
+	nasmlib\filename.$(O) nasmlib\srcfile.$(O) &
+	nasmlib\zerobuf.$(O) nasmlib\readnum.$(O) nasmlib\bsi.$(O) &
+	nasmlib\rbtree.$(O) nasmlib\hashtbl.$(O) &
+	nasmlib\raa.$(O) nasmlib\saa.$(O) &
+	nasmlib\strlist.$(O) &
+	nasmlib\perfhash.$(O) nasmlib\badenum.$(O) &
+	&
+	common\common.$(O) &
+	&
+	x86\insnsa.$(O) x86\insnsb.$(O) x86\insnsd.$(O) x86\insnsn.$(O) &
+	x86\regs.$(O) x86\regvals.$(O) x86\regflags.$(O) x86\regdis.$(O) &
+	x86\disp8.$(O) x86\iflag.$(O) &
+	&
+	asm\error.$(O) &
+	asm\float.$(O) &
+	asm\directiv.$(O) asm\directbl.$(O) &
+	asm\pragma.$(O) &
+	asm\assemble.$(O) asm\labels.$(O) asm\parser.$(O) &
+	asm\preproc.$(O) asm\quote.$(O) asm\pptok.$(O) &
+	asm\listing.$(O) asm\eval.$(O) asm\exprlib.$(O) asm\exprdump.$(O) &
+	asm\stdscan.$(O) &
+	asm\strfunc.$(O) asm\tokhash.$(O) &
+	asm\segalloc.$(O) &
+	asm\preproc-nop.$(O) &
+	asm\rdstrnum.$(O) &
+	&
+	macros\macros.$(O) &
+	&
+	output\outform.$(O) output\outlib.$(O) output\legacy.$(O) &
+	output\strtbl.$(O) &
+	output\nulldbg.$(O) output\nullout.$(O) &
+	output\outbin.$(O) output\outaout.$(O) output\outcoff.$(O) &
+	output\outelf.$(O) &
+	output\outobj.$(O) output\outas86.$(O) output\outrdf2.$(O) &
+	output\outdbg.$(O) output\outieee.$(O) output\outmacho.$(O) &
+	output\codeview.$(O) &
+	&
+	disasm\disasm.$(O) disasm\sync.$(O)
+
+SUBDIRS  = stdlib nasmlib output asm disasm x86 common macros
+XSUBDIRS = test doc nsis rdoff
+DEPDIRS  = . include config x86 rdoff $(SUBDIRS)
+#-- End File Lists --#
+
+what:   .SYMBOLIC
+    @echo Please build "dos", "win32", "os2" or "linux386"
+
+dos:    .SYMBOLIC
+    @set TARGET_CFLAGS=-bt=DOS -I"$(%WATCOM)\h"
+    @set TARGET_LFLAGS=sys causeway
+    @%make all
+
+win32:  .SYMBOLIC
+    @set TARGET_CFLAGS=-bt=NT -I"$(%WATCOM)\h" -I"$(%WATCOM)\h\nt"
+    @set TARGET_LFLAGS=sys nt
+    @%make all
+
+os2:    .SYMBOLIC
+    @set TARGET_CFLAGS=-bt=OS2 -I"$(%WATCOM)\h" -I"$(%WATCOM)\h\os2"
+    @set TARGET_LFLAGS=sys os2v2
+    @%make all
+
+linux386:   .SYMBOLIC
+    @set TARGET_CFLAGS=-bt=LINUX -I"$(%WATCOM)\lh"
+    @set TARGET_LFLAGS=sys linux
+    @%make all
+
+all: perlreq nasm$(X) ndisasm$(X) .SYMBOLIC
+#   cd rdoff && $(MAKE) all
+
+NASMLIB = nasm.lib
+
+nasm$(X): $(NASM) $(NASMLIB)
+    $(LD) $(LDFLAGS) name nasm$(X) libr {$(NASMLIB) $(LIBS)} file {$(NASM)}
+
+ndisasm$(X): $(NDISASM) $(LIBOBJ)
+    $(LD) $(LDFLAGS) name ndisasm$(X) libr {$(NASMLIB) $(LIBS)} file {$(NDISASM)}
+
+nasm.lib: $(LIBOBJ)
+    wlib -q -b -n $@ $(LIBOBJ)
+
+#-- Begin Generated File Rules --#
+# Edit in Makefile.in, not here!
+
+# These source files are automagically generated from data files using
+# Perl scripts. They're distributed, though, so it isn't necessary to
+# have Perl just to recompile NASM from the distribution.
+
+# Perl-generated source files
+PERLREQ = x86\insnsb.c x86\insnsa.c x86\insnsd.c x86\insnsi.h x86\insnsn.c &
+	  x86\regs.c x86\regs.h x86\regflags.c x86\regdis.c x86\regdis.h &
+	  x86\regvals.c asm\tokhash.c asm\tokens.h asm\pptok.h asm\pptok.c &
+	  x86\iflag.c x86\iflaggen.h &
+	  macros\macros.c &
+	  asm\pptok.ph asm\directbl.c asm\directiv.h &
+	  version.h version.mac version.mak nsis\version.nsh
+
+INSDEP = x86\insns.dat x86\insns.pl x86\insns-iflags.ph
+
+x86\iflag.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)\x86\insns.pl -fc &
+		$(srcdir)\x86\insns.dat x86\iflag.c
+x86\iflaggen.h: $(INSDEP)
+	$(RUNPERL) $(srcdir)\x86\insns.pl -fh &
+		$(srcdir)\x86\insns.dat x86\iflaggen.h
+x86\insnsb.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)\x86\insns.pl -b &
+		$(srcdir)\x86\insns.dat x86\insnsb.c
+x86\insnsa.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)\x86\insns.pl -a &
+		$(srcdir)\x86\insns.dat x86\insnsa.c
+x86\insnsd.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)\x86\insns.pl -d &
+		$(srcdir)\x86\insns.dat x86\insnsd.c
+x86\insnsi.h: $(INSDEP)
+	$(RUNPERL) $(srcdir)\x86\insns.pl -i &
+		$(srcdir)\x86\insns.dat x86\insnsi.h
+x86\insnsn.c: $(INSDEP)
+	$(RUNPERL) $(srcdir)\x86\insns.pl -n &
+		$(srcdir)\x86\insns.dat x86\insnsn.c
+
+# These files contains all the standard macros that are derived from
+# the version number.
+version.h: version version.pl
+	$(RUNPERL) $(srcdir)\version.pl h < $(srcdir)\version > version.h
+version.mac: version version.pl
+	$(RUNPERL) $(srcdir)\version.pl mac < $(srcdir)\version > version.mac
+version.sed: version version.pl
+	$(RUNPERL) $(srcdir)\version.pl sed < $(srcdir)\version > version.sed
+version.mak: version version.pl
+	$(RUNPERL) $(srcdir)\version.pl make < $(srcdir)\version > version.mak
+nsis\version.nsh: version version.pl
+	$(RUNPERL) $(srcdir)\version.pl nsis < $(srcdir)\version > nsis\version.nsh
+
+# This source file is generated from the standard macros file
+# `standard.mac' by another Perl script. Again, it's part of the
+# standard distribution.
+macros\macros.c: macros\macros.pl asm\pptok.ph version.mac &
+	$(srcdir)\macros\*.mac $(srcdir)\output\*.mac
+	$(RUNPERL) $(srcdir)\macros\macros.pl version.mac &
+		$(srcdir)\macros\*.mac $(srcdir)\output\*.mac
+
+# These source files are generated from regs.dat by yet another
+# perl script.
+x86\regs.c: x86\regs.dat x86\regs.pl
+	$(RUNPERL) $(srcdir)\x86\regs.pl c &
+		$(srcdir)\x86\regs.dat > x86\regs.c
+x86\regflags.c: x86\regs.dat x86\regs.pl
+	$(RUNPERL) $(srcdir)\x86\regs.pl fc &
+		$(srcdir)\x86\regs.dat > x86\regflags.c
+x86\regdis.c: x86\regs.dat x86\regs.pl
+	$(RUNPERL) $(srcdir)\x86\regs.pl dc &
+		$(srcdir)\x86\regs.dat > x86\regdis.c
+x86\regdis.h: x86\regs.dat x86\regs.pl
+	$(RUNPERL) $(srcdir)\x86\regs.pl dh &
+		$(srcdir)\x86\regs.dat > x86\regdis.h
+x86\regvals.c: x86\regs.dat x86\regs.pl
+	$(RUNPERL) $(srcdir)\x86\regs.pl vc &
+		$(srcdir)\x86\regs.dat > x86\regvals.c
+x86\regs.h: x86\regs.dat x86\regs.pl
+	$(RUNPERL) $(srcdir)\x86\regs.pl h &
+		$(srcdir)\x86\regs.dat > x86\regs.h
+
+# Assembler token hash
+asm\tokhash.c: x86\insns.dat x86\regs.dat asm\tokens.dat asm\tokhash.pl &
+	perllib\phash.ph
+	$(RUNPERL) $(srcdir)\asm\tokhash.pl c &
+		$(srcdir)\x86\insns.dat $(srcdir)\x86\regs.dat &
+		$(srcdir)\asm\tokens.dat > asm\tokhash.c
+
+# Assembler token metadata
+asm\tokens.h: x86\insns.dat x86\regs.dat asm\tokens.dat asm\tokhash.pl &
+	perllib\phash.ph
+	$(RUNPERL) $(srcdir)\asm\tokhash.pl h &
+		$(srcdir)\x86\insns.dat $(srcdir)\x86\regs.dat &
+		$(srcdir)\asm\tokens.dat > asm\tokens.h
+
+# Preprocessor token hash
+asm\pptok.h: asm\pptok.dat asm\pptok.pl perllib\phash.ph
+	$(RUNPERL) $(srcdir)\asm\pptok.pl h &
+		$(srcdir)\asm\pptok.dat asm\pptok.h
+asm\pptok.c: asm\pptok.dat asm\pptok.pl perllib\phash.ph
+	$(RUNPERL) $(srcdir)\asm\pptok.pl c &
+		$(srcdir)\asm\pptok.dat asm\pptok.c
+asm\pptok.ph: asm\pptok.dat asm\pptok.pl perllib\phash.ph
+	$(RUNPERL) $(srcdir)\asm\pptok.pl ph &
+		$(srcdir)\asm\pptok.dat asm\pptok.ph
+
+# Directives hash
+asm\directiv.h: asm\directiv.dat nasmlib\perfhash.pl perllib\phash.ph
+	$(RUNPERL) $(srcdir)\nasmlib\perfhash.pl h &
+		$(srcdir)\asm\directiv.dat asm\directiv.h
+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
+
+#-- End Generated File Rules --#
+
+perlreq: $(PERLREQ) .SYMBOLIC
+
+#-- Begin NSIS Rules --#
+# Edit in Makefile.in, not here!
+
+# NSIS is not built except by explicit request, as it only applies to
+# Windows platforms
+nsis\arch.nsh: nsis\getpearch.pl nasm$(X)
+	$(PERL) $(srcdir)\nsis\getpearch.pl nasm$(X) > nsis\arch.nsh
+
+# Should only be done after "make everything".
+# The use of redirection here keeps makensis from moving the cwd to the
+# source directory.
+nsis: nsis\nasm.nsi nsis\arch.nsh nsis\version.nsh
+	$(MAKENSIS) -Dsrcdir="$(srcdir)" -Dobjdir="$(objdir)" - < nsis\nasm.nsi
+
+#-- End NSIS Rules --#
+
+clean: .SYMBOLIC
+    rm -f *.$(O) *.s *.i
+    rm -f asm\*.$(O) asm\*.s asm\*.i
+    rm -f x86\*.$(O) x86\*.s x86\*.i
+    rm -f lib\*.$(O) lib\*.s lib\*.i
+    rm -f macros\*.$(O) macros\*.s macros\*.i
+    rm -f output\*.$(O) output\*.s output\*.i
+    rm -f common\*.$(O) common\*.s common\*.i
+    rm -f stdlib\*.$(O) stdlib\*.s stdlib\*.i
+    rm -f nasmlib\*.$(O) nasmlib\*.s nasmlib\*.i
+    rm -f disasm\*.$(O) disasm\*.s disasm\*.i
+    rm -f config.h config.log config.status
+    rm -f nasm$(X) ndisasm$(X) $(NASMLIB)
+#   cd rdoff && $(MAKE) clean
+
+distclean: clean .SYMBOLIC
+    rm -f config.h config.log config.status
+    rm -f Makefile *~ *.bak *.lst *.bin
+    rm -f output\*~ output\*.bak
+    rm -f test\*.lst test\*.bin test\*.$(O) test\*.bin
+#   -del \s autom4te*.cache
+#   cd rdoff && $(MAKE) distclean
+
+cleaner: clean .SYMBOLIC
+    rm -f $(PERLREQ)
+    rm -f *.man
+    rm -f nasm.spec
+#   cd doc && $(MAKE) clean
+
+spotless: distclean cleaner .SYMBOLIC
+    rm -f doc\Makefile doc\*~ doc\*.bak
+
+strip: .SYMBOLIC
+    $(STRIP) *.exe
+
+rdf:
+#   cd rdoff && $(MAKE)
+
+doc:
+#   cd doc && $(MAKE) all
+
+everything: all doc rdf
+
+#
+# This build dependencies in *ALL* makefiles.  Partially for that reason,
+# it's expected to be invoked manually.
+#
+alldeps: perlreq .SYMBOLIC
+    $(PERL) syncfiles.pl Makefile.in Mkfiles\openwcom.mak
+    $(PERL) mkdep.pl -M Makefile.in Mkfiles\openwcom.mak -- . output lib
+
+#-- Magic hints to mkdep.pl --#
+# @object-ending: ".$(O)"
+# @path-separator: "\"
+# @exclude: "config/config.h"
+# @continuation: "&"
+#-- Everything below is generated by mkdep.pl - do not edit --#
+asm\assemble.$(O): asm\assemble.c asm\assemble.h asm\directiv.h &
+ asm\listing.h asm\pptok.h asm\preproc.h asm\tokens.h config\msvc.h &
+ config\unknown.h config\watcom.h include\bytesex.h include\compiler.h &
+ include\disp8.h include\error.h include\iflag.h include\ilog2.h &
+ include\insns.h include\labels.h include\nasm.h include\nasmint.h &
+ include\nasmlib.h include\opflags.h include\perfhash.h include\strlist.h &
+ include\tables.h x86\iflaggen.h x86\insnsi.h x86\regs.h
+asm\directbl.$(O): asm\directbl.c asm\directiv.h config\msvc.h &
+ config\unknown.h config\watcom.h include\bytesex.h include\compiler.h &
+ include\nasmint.h include\nasmlib.h include\perfhash.h
+asm\directiv.$(O): asm\directiv.c asm\assemble.h asm\directiv.h asm\eval.h &
+ asm\float.h asm\listing.h asm\pptok.h asm\preproc.h asm\stdscan.h &
+ config\msvc.h config\unknown.h config\watcom.h include\bytesex.h &
+ include\compiler.h include\error.h include\iflag.h include\ilog2.h &
+ include\labels.h include\nasm.h include\nasmint.h include\nasmlib.h &
+ include\opflags.h include\perfhash.h include\strlist.h include\tables.h &
+ output\outform.h x86\iflaggen.h x86\insnsi.h x86\regs.h
+asm\error.$(O): asm\error.c config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\nasmint.h &
+ include\nasmlib.h
+asm\eval.$(O): asm\eval.c asm\assemble.h asm\directiv.h asm\eval.h &
+ asm\float.h asm\pptok.h asm\preproc.h config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\iflag.h include\ilog2.h include\labels.h include\nasm.h &
+ include\nasmint.h include\nasmlib.h include\opflags.h include\perfhash.h &
+ include\strlist.h include\tables.h x86\iflaggen.h x86\insnsi.h x86\regs.h
+asm\exprdump.$(O): asm\exprdump.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ config\msvc.h config\unknown.h config\watcom.h include\bytesex.h &
+ include\compiler.h include\labels.h include\nasm.h include\nasmint.h &
+ include\nasmlib.h include\opflags.h include\perfhash.h include\strlist.h &
+ include\tables.h x86\insnsi.h x86\regs.h
+asm\exprlib.$(O): asm\exprlib.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ config\msvc.h config\unknown.h config\watcom.h include\bytesex.h &
+ include\compiler.h include\labels.h include\nasm.h include\nasmint.h &
+ include\nasmlib.h include\opflags.h include\perfhash.h include\strlist.h &
+ include\tables.h x86\insnsi.h x86\regs.h
+asm\float.$(O): asm\float.c asm\directiv.h asm\float.h asm\pptok.h &
+ asm\preproc.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\strlist.h include\tables.h x86\insnsi.h &
+ x86\regs.h
+asm\labels.$(O): asm\labels.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ config\msvc.h config\unknown.h config\watcom.h include\bytesex.h &
+ include\compiler.h include\error.h include\hashtbl.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\strlist.h include\tables.h x86\insnsi.h &
+ x86\regs.h
+asm\listing.$(O): asm\listing.c asm\directiv.h asm\listing.h asm\pptok.h &
+ asm\preproc.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\strlist.h include\tables.h x86\insnsi.h &
+ x86\regs.h
+asm\nasm.$(O): asm\nasm.c asm\assemble.h asm\directiv.h asm\eval.h &
+ asm\float.h asm\listing.h asm\parser.h asm\pptok.h asm\preproc.h &
+ asm\stdscan.h asm\tokens.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\iflag.h &
+ include\ilog2.h include\insns.h include\labels.h include\nasm.h &
+ include\nasmint.h include\nasmlib.h include\opflags.h include\perfhash.h &
+ include\raa.h include\saa.h include\strlist.h include\tables.h &
+ include\ver.h output\outform.h x86\iflaggen.h x86\insnsi.h x86\regs.h
+asm\parser.$(O): asm\parser.c asm\assemble.h asm\directiv.h asm\eval.h &
+ asm\float.h asm\parser.h asm\pptok.h asm\preproc.h asm\stdscan.h &
+ asm\tokens.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\iflag.h &
+ include\ilog2.h include\insns.h include\labels.h include\nasm.h &
+ include\nasmint.h include\nasmlib.h include\opflags.h include\perfhash.h &
+ include\strlist.h include\tables.h x86\iflaggen.h x86\insnsi.h x86\regs.h
+asm\pptok.$(O): asm\pptok.c asm\pptok.h asm\preproc.h config\msvc.h &
+ config\unknown.h config\watcom.h include\bytesex.h include\compiler.h &
+ include\hashtbl.h include\nasmint.h include\nasmlib.h
+asm\pragma.$(O): asm\pragma.c asm\assemble.h asm\directiv.h asm\pptok.h &
+ asm\preproc.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\iflag.h &
+ include\ilog2.h include\labels.h include\nasm.h include\nasmint.h &
+ include\nasmlib.h include\opflags.h include\perfhash.h include\strlist.h &
+ include\tables.h x86\iflaggen.h x86\insnsi.h x86\regs.h
+asm\preproc-nop.$(O): asm\preproc-nop.c asm\directiv.h asm\listing.h &
+ asm\pptok.h asm\preproc.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\strlist.h include\tables.h x86\insnsi.h &
+ x86\regs.h
+asm\preproc.$(O): asm\preproc.c asm\directiv.h asm\eval.h asm\listing.h &
+ asm\pptok.h asm\preproc.h asm\quote.h asm\stdscan.h asm\tokens.h &
+ config\msvc.h config\unknown.h config\watcom.h include\bytesex.h &
+ include\compiler.h include\error.h include\hashtbl.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\strlist.h include\tables.h x86\insnsi.h &
+ x86\regs.h
+asm\quote.$(O): asm\quote.c asm\quote.h config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\nasmint.h &
+ include\nasmlib.h
+asm\rdstrnum.$(O): asm\rdstrnum.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ config\msvc.h config\unknown.h config\watcom.h include\bytesex.h &
+ include\compiler.h include\labels.h include\nasm.h include\nasmint.h &
+ include\nasmlib.h include\opflags.h include\perfhash.h include\strlist.h &
+ include\tables.h x86\insnsi.h x86\regs.h
+asm\segalloc.$(O): asm\segalloc.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ asm\tokens.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\iflag.h include\ilog2.h &
+ include\insns.h include\labels.h include\nasm.h include\nasmint.h &
+ include\nasmlib.h include\opflags.h include\perfhash.h include\strlist.h &
+ include\tables.h x86\iflaggen.h x86\insnsi.h x86\regs.h
+asm\stdscan.$(O): asm\stdscan.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ asm\quote.h asm\stdscan.h asm\tokens.h config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\iflag.h include\ilog2.h include\insns.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\strlist.h include\tables.h x86\iflaggen.h &
+ x86\insnsi.h x86\regs.h
+asm\strfunc.$(O): asm\strfunc.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ config\msvc.h config\unknown.h config\watcom.h include\bytesex.h &
+ include\compiler.h include\labels.h include\nasm.h include\nasmint.h &
+ include\nasmlib.h include\opflags.h include\perfhash.h include\strlist.h &
+ include\tables.h x86\insnsi.h x86\regs.h
+asm\tokhash.$(O): asm\tokhash.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ asm\stdscan.h asm\tokens.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\hashtbl.h include\iflag.h &
+ include\ilog2.h include\insns.h include\labels.h include\nasm.h &
+ include\nasmint.h include\nasmlib.h include\opflags.h include\perfhash.h &
+ include\strlist.h include\tables.h x86\iflaggen.h x86\insnsi.h x86\regs.h
+common\common.$(O): common\common.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ asm\tokens.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\iflag.h include\ilog2.h &
+ include\insns.h include\labels.h include\nasm.h include\nasmint.h &
+ include\nasmlib.h include\opflags.h include\perfhash.h include\strlist.h &
+ include\tables.h x86\iflaggen.h x86\insnsi.h x86\regs.h
+disasm\disasm.$(O): disasm\disasm.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ asm\tokens.h config\msvc.h config\unknown.h config\watcom.h disasm\disasm.h &
+ disasm\sync.h include\bytesex.h include\compiler.h include\disp8.h &
+ include\iflag.h include\ilog2.h include\insns.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\strlist.h include\tables.h x86\iflaggen.h &
+ x86\insnsi.h x86\regdis.h x86\regs.h
+disasm\ndisasm.$(O): disasm\ndisasm.c asm\directiv.h asm\pptok.h &
+ asm\preproc.h asm\tokens.h config\msvc.h config\unknown.h config\watcom.h &
+ disasm\disasm.h disasm\sync.h include\bytesex.h include\compiler.h &
+ include\error.h include\iflag.h include\ilog2.h include\insns.h &
+ include\labels.h include\nasm.h include\nasmint.h include\nasmlib.h &
+ include\opflags.h include\perfhash.h include\strlist.h include\tables.h &
+ include\ver.h x86\iflaggen.h x86\insnsi.h x86\regs.h
+disasm\sync.$(O): disasm\sync.c config\msvc.h config\unknown.h &
+ config\watcom.h disasm\sync.h include\bytesex.h include\compiler.h &
+ include\nasmint.h include\nasmlib.h
+macros\macros.$(O): macros\macros.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ config\msvc.h config\unknown.h config\watcom.h include\bytesex.h &
+ include\compiler.h include\hashtbl.h include\labels.h include\nasm.h &
+ include\nasmint.h include\nasmlib.h include\opflags.h include\perfhash.h &
+ include\strlist.h include\tables.h output\outform.h x86\insnsi.h x86\regs.h
+nasmlib\badenum.$(O): nasmlib\badenum.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\nasmint.h &
+ include\nasmlib.h
+nasmlib\bsi.$(O): nasmlib\bsi.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\nasmint.h &
+ include\nasmlib.h
+nasmlib\crc64.$(O): nasmlib\crc64.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\hashtbl.h &
+ include\nasmint.h include\nasmlib.h
+nasmlib\errfile.$(O): nasmlib\errfile.c config\msvc.h config\unknown.h &
+ config\watcom.h include\compiler.h include\nasmint.h
+nasmlib\file.$(O): nasmlib\file.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\nasmint.h include\nasmlib.h nasmlib\file.h
+nasmlib\filename.$(O): nasmlib\filename.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\nasmint.h include\nasmlib.h
+nasmlib\hashtbl.$(O): nasmlib\hashtbl.c asm\directiv.h asm\pptok.h &
+ asm\preproc.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\hashtbl.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\strlist.h include\tables.h x86\insnsi.h &
+ x86\regs.h
+nasmlib\ilog2.$(O): nasmlib\ilog2.c config\msvc.h config\unknown.h &
+ config\watcom.h include\compiler.h include\ilog2.h include\nasmint.h
+nasmlib\malloc.$(O): nasmlib\malloc.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\nasmint.h include\nasmlib.h
+nasmlib\md5c.$(O): nasmlib\md5c.c config\msvc.h config\unknown.h &
+ config\watcom.h include\compiler.h include\md5.h include\nasmint.h
+nasmlib\mmap.$(O): nasmlib\mmap.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\nasmint.h include\nasmlib.h nasmlib\file.h
+nasmlib\path.$(O): nasmlib\path.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\nasmint.h include\nasmlib.h
+nasmlib\perfhash.$(O): nasmlib\perfhash.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\hashtbl.h &
+ include\nasmint.h include\nasmlib.h include\perfhash.h
+nasmlib\raa.$(O): nasmlib\raa.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\nasmint.h &
+ include\nasmlib.h include\raa.h
+nasmlib\rbtree.$(O): nasmlib\rbtree.c config\msvc.h config\unknown.h &
+ config\watcom.h include\compiler.h include\nasmint.h include\rbtree.h
+nasmlib\readnum.$(O): nasmlib\readnum.c asm\directiv.h asm\pptok.h &
+ asm\preproc.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\strlist.h include\tables.h x86\insnsi.h &
+ x86\regs.h
+nasmlib\realpath.$(O): nasmlib\realpath.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\nasmint.h &
+ include\nasmlib.h
+nasmlib\saa.$(O): nasmlib\saa.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\nasmint.h &
+ include\nasmlib.h include\saa.h
+nasmlib\srcfile.$(O): nasmlib\srcfile.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\hashtbl.h &
+ include\nasmint.h include\nasmlib.h
+nasmlib\string.$(O): nasmlib\string.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\nasmint.h &
+ include\nasmlib.h
+nasmlib\strlist.$(O): nasmlib\strlist.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\nasmint.h &
+ include\nasmlib.h include\strlist.h
+nasmlib\ver.$(O): nasmlib\ver.c include\ver.h version.h
+nasmlib\zerobuf.$(O): nasmlib\zerobuf.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\nasmint.h &
+ include\nasmlib.h
+output\codeview.$(O): output\codeview.c asm\directiv.h asm\pptok.h &
+ asm\preproc.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\hashtbl.h &
+ include\labels.h include\md5.h include\nasm.h include\nasmint.h &
+ include\nasmlib.h include\opflags.h include\perfhash.h include\saa.h &
+ include\strlist.h include\tables.h output\outlib.h output\pecoff.h &
+ version.h x86\insnsi.h x86\regs.h
+output\legacy.$(O): output\legacy.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ config\msvc.h config\unknown.h config\watcom.h include\bytesex.h &
+ include\compiler.h include\error.h include\labels.h include\nasm.h &
+ include\nasmint.h include\nasmlib.h include\opflags.h include\perfhash.h &
+ include\strlist.h include\tables.h output\outlib.h x86\insnsi.h x86\regs.h
+output\nulldbg.$(O): output\nulldbg.c asm\directiv.h asm\pptok.h &
+ asm\preproc.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\strlist.h include\tables.h output\outlib.h &
+ x86\insnsi.h x86\regs.h
+output\nullout.$(O): output\nullout.c asm\directiv.h asm\pptok.h &
+ asm\preproc.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\strlist.h include\tables.h output\outlib.h &
+ x86\insnsi.h x86\regs.h
+output\outaout.$(O): output\outaout.c asm\directiv.h asm\eval.h asm\pptok.h &
+ asm\preproc.h asm\stdscan.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\raa.h include\saa.h include\strlist.h &
+ include\tables.h output\outform.h output\outlib.h x86\insnsi.h x86\regs.h
+output\outas86.$(O): output\outas86.c asm\directiv.h asm\pptok.h &
+ asm\preproc.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\raa.h include\saa.h include\strlist.h &
+ include\tables.h output\outform.h output\outlib.h x86\insnsi.h x86\regs.h
+output\outbin.$(O): output\outbin.c asm\directiv.h asm\eval.h asm\pptok.h &
+ asm\preproc.h asm\stdscan.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\saa.h include\strlist.h include\tables.h &
+ output\outform.h output\outlib.h x86\insnsi.h x86\regs.h
+output\outcoff.$(O): output\outcoff.c asm\directiv.h asm\eval.h asm\pptok.h &
+ asm\preproc.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\ilog2.h &
+ include\labels.h include\nasm.h include\nasmint.h include\nasmlib.h &
+ include\opflags.h include\perfhash.h include\raa.h include\saa.h &
+ include\strlist.h include\tables.h output\outform.h output\outlib.h &
+ output\pecoff.h x86\insnsi.h x86\regs.h
+output\outdbg.$(O): output\outdbg.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ asm\tokens.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\iflag.h &
+ include\ilog2.h include\insns.h include\labels.h include\nasm.h &
+ include\nasmint.h include\nasmlib.h include\opflags.h include\perfhash.h &
+ include\strlist.h include\tables.h output\outform.h output\outlib.h &
+ x86\iflaggen.h x86\insnsi.h x86\regs.h
+output\outelf.$(O): output\outelf.c asm\directiv.h asm\eval.h asm\pptok.h &
+ asm\preproc.h asm\stdscan.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\raa.h include\rbtree.h include\saa.h &
+ include\strlist.h include\tables.h include\ver.h output\dwarf.h &
+ output\elf.h output\outelf.h output\outform.h output\outlib.h &
+ output\stabs.h x86\insnsi.h x86\regs.h
+output\outform.$(O): output\outform.c asm\directiv.h asm\pptok.h &
+ asm\preproc.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\labels.h include\nasm.h &
+ include\nasmint.h include\nasmlib.h include\opflags.h include\perfhash.h &
+ include\strlist.h include\tables.h output\outform.h x86\insnsi.h x86\regs.h
+output\outieee.$(O): output\outieee.c asm\directiv.h asm\pptok.h &
+ asm\preproc.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\strlist.h include\tables.h include\ver.h &
+ output\outform.h output\outlib.h x86\insnsi.h x86\regs.h
+output\outlib.$(O): output\outlib.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ config\msvc.h config\unknown.h config\watcom.h include\bytesex.h &
+ include\compiler.h include\error.h include\labels.h include\nasm.h &
+ include\nasmint.h include\nasmlib.h include\opflags.h include\perfhash.h &
+ include\strlist.h include\tables.h output\outlib.h x86\insnsi.h x86\regs.h
+output\outmacho.$(O): output\outmacho.c asm\directiv.h asm\pptok.h &
+ asm\preproc.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\hashtbl.h &
+ include\ilog2.h include\labels.h include\nasm.h include\nasmint.h &
+ include\nasmlib.h include\opflags.h include\perfhash.h include\raa.h &
+ include\rbtree.h include\saa.h include\strlist.h include\tables.h &
+ include\ver.h output\dwarf.h output\outform.h output\outlib.h x86\insnsi.h &
+ x86\regs.h
+output\outobj.$(O): output\outobj.c asm\directiv.h asm\eval.h asm\pptok.h &
+ asm\preproc.h asm\stdscan.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\strlist.h include\tables.h include\ver.h &
+ output\outform.h output\outlib.h x86\insnsi.h x86\regs.h
+output\outrdf2.$(O): output\outrdf2.c asm\directiv.h asm\pptok.h &
+ asm\preproc.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\rdoff.h include\saa.h include\strlist.h &
+ include\tables.h output\outform.h output\outlib.h x86\insnsi.h x86\regs.h
+output\strtbl.$(O): output\strtbl.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ config\msvc.h config\unknown.h config\watcom.h include\bytesex.h &
+ include\compiler.h include\error.h include\hashtbl.h include\labels.h &
+ include\nasm.h include\nasmint.h include\nasmlib.h include\opflags.h &
+ include\perfhash.h include\strlist.h include\tables.h output\strtbl.h &
+ x86\insnsi.h x86\regs.h
+rdoff\collectn.$(O): rdoff\collectn.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\nasmint.h include\nasmlib.h include\rdoff.h rdoff\collectn.h &
+ rdoff\rdfutils.h
+rdoff\hash.$(O): rdoff\hash.c config\msvc.h config\unknown.h config\watcom.h &
+ include\compiler.h include\nasmint.h rdoff\hash.h
+rdoff\ldrdf.$(O): rdoff\ldrdf.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\nasmint.h include\nasmlib.h include\rdoff.h rdoff\collectn.h &
+ rdoff\ldsegs.h rdoff\rdfutils.h rdoff\rdlib.h rdoff\segtab.h rdoff\symtab.h
+rdoff\rdf2bin.$(O): rdoff\rdf2bin.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\nasmint.h include\nasmlib.h include\rdoff.h rdoff\rdfload.h &
+ rdoff\rdfutils.h
+rdoff\rdfdump.$(O): rdoff\rdfdump.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\nasmint.h include\nasmlib.h include\rdoff.h rdoff\rdfutils.h
+rdoff\rdflib.$(O): rdoff\rdflib.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\nasmint.h include\nasmlib.h include\rdoff.h rdoff\rdfutils.h
+rdoff\rdfload.$(O): rdoff\rdfload.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\nasmint.h include\nasmlib.h include\rdoff.h rdoff\collectn.h &
+ rdoff\rdfload.h rdoff\rdfutils.h rdoff\symtab.h
+rdoff\rdlar.$(O): rdoff\rdlar.c config\msvc.h config\unknown.h &
+ config\watcom.h include\compiler.h include\nasmint.h rdoff\rdlar.h
+rdoff\rdlib.$(O): rdoff\rdlib.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\nasmint.h include\nasmlib.h include\rdoff.h rdoff\rdfutils.h &
+ rdoff\rdlar.h rdoff\rdlib.h
+rdoff\rdoff.$(O): rdoff\rdoff.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\nasmint.h include\nasmlib.h include\rdoff.h rdoff\rdfutils.h
+rdoff\rdx.$(O): rdoff\rdx.c config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\error.h include\nasmint.h &
+ include\nasmlib.h include\rdoff.h rdoff\rdfload.h rdoff\rdfutils.h &
+ rdoff\symtab.h
+rdoff\segtab.$(O): rdoff\segtab.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\nasmint.h include\nasmlib.h include\rdoff.h rdoff\rdfutils.h &
+ rdoff\segtab.h
+rdoff\symtab.$(O): rdoff\symtab.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\nasmint.h include\nasmlib.h include\rdoff.h rdoff\hash.h &
+ rdoff\rdfutils.h rdoff\symtab.h
+stdlib\snprintf.$(O): stdlib\snprintf.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\nasmint.h &
+ include\nasmlib.h
+stdlib\strlcpy.$(O): stdlib\strlcpy.c config\msvc.h config\unknown.h &
+ config\watcom.h include\compiler.h include\nasmint.h
+stdlib\strnlen.$(O): stdlib\strnlen.c config\msvc.h config\unknown.h &
+ config\watcom.h include\compiler.h include\nasmint.h
+stdlib\strrchrnul.$(O): stdlib\strrchrnul.c config\msvc.h config\unknown.h &
+ config\watcom.h include\compiler.h include\nasmint.h
+stdlib\vsnprintf.$(O): stdlib\vsnprintf.c config\msvc.h config\unknown.h &
+ config\watcom.h include\bytesex.h include\compiler.h include\error.h &
+ include\nasmint.h include\nasmlib.h
+x86\disp8.$(O): x86\disp8.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ config\msvc.h config\unknown.h config\watcom.h include\bytesex.h &
+ include\compiler.h include\disp8.h include\labels.h include\nasm.h &
+ include\nasmint.h include\nasmlib.h include\opflags.h include\perfhash.h &
+ include\strlist.h include\tables.h x86\insnsi.h x86\regs.h
+x86\iflag.$(O): x86\iflag.c config\msvc.h config\unknown.h config\watcom.h &
+ include\compiler.h include\iflag.h include\ilog2.h include\nasmint.h &
+ x86\iflaggen.h
+x86\insnsa.$(O): x86\insnsa.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ asm\tokens.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\iflag.h include\ilog2.h &
+ include\insns.h include\labels.h include\nasm.h include\nasmint.h &
+ include\nasmlib.h include\opflags.h include\perfhash.h include\strlist.h &
+ include\tables.h x86\iflaggen.h x86\insnsi.h x86\regs.h
+x86\insnsb.$(O): x86\insnsb.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ asm\tokens.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\iflag.h include\ilog2.h &
+ include\insns.h include\labels.h include\nasm.h include\nasmint.h &
+ include\nasmlib.h include\opflags.h include\perfhash.h include\strlist.h &
+ include\tables.h x86\iflaggen.h x86\insnsi.h x86\regs.h
+x86\insnsd.$(O): x86\insnsd.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ asm\tokens.h config\msvc.h config\unknown.h config\watcom.h &
+ include\bytesex.h include\compiler.h include\iflag.h include\ilog2.h &
+ include\insns.h include\labels.h include\nasm.h include\nasmint.h &
+ include\nasmlib.h include\opflags.h include\perfhash.h include\strlist.h &
+ include\tables.h x86\iflaggen.h x86\insnsi.h x86\regs.h
+x86\insnsn.$(O): x86\insnsn.c config\msvc.h config\unknown.h config\watcom.h &
+ include\compiler.h include\nasmint.h include\tables.h x86\insnsi.h
+x86\regdis.$(O): x86\regdis.c x86\regdis.h x86\regs.h
+x86\regflags.$(O): x86\regflags.c asm\directiv.h asm\pptok.h asm\preproc.h &
+ config\msvc.h config\unknown.h config\watcom.h include\bytesex.h &
+ include\compiler.h include\labels.h include\nasm.h include\nasmint.h &
+ include\nasmlib.h include\opflags.h include\perfhash.h include\strlist.h &
+ include\tables.h x86\insnsi.h x86\regs.h
+x86\regs.$(O): x86\regs.c config\msvc.h config\unknown.h config\watcom.h &
+ include\compiler.h include\nasmint.h include\tables.h x86\insnsi.h
+x86\regvals.$(O): x86\regvals.c config\msvc.h config\unknown.h &
+ config\watcom.h include\compiler.h include\nasmint.h include\tables.h &
+ x86\insnsi.h

+ 23 - 0
nasm/README

@@ -0,0 +1,23 @@
+              NASM, the Netwide Assembler.
+
+Many many developers all over the net respect NASM for what it is
+- a widespread (thus netwide), portable (thus netwide!), very
+flexible and mature assembler tool with support for many output
+formats (thus netwide!!).
+
+Now we have good news for you: NASM is licensed under the "simplified"
+(2-clause) BSD license.  This means its development is open to even
+wider society of programmers wishing to improve their lovely
+assembler.
+
+The NASM project is now situated at SourceForge.net, the most
+popular Open Source development site on the Internet.
+
+Visit our website at http://nasm.sourceforge.net/ and our
+SourceForge project at http://sourceforge.net/projects/nasm/
+
+See the file CHANGES for the description of changes between revisions,
+and the file AUTHORS for a list of contributors.
+
+                                                   With best regards,
+                                                           NASM crew.

+ 116 - 0
nasm/SubmittingPatches

@@ -0,0 +1,116 @@
+How to submit patches into the NASM
+===================================
+
+Actually the rules are pretty simple
+
+Obtaining the source code
+-------------------------
+
+The NASM sources are tracked by Git SCM at http://repo.or.cz/w/nasm.git
+repository. You either could download packed sources or use git tool itself
+
+        git clone git://repo.or.cz/nasm.git
+
+Changin the source code
+-----------------------
+
+When you change the NASM source code keep in mind -- we prefer tabs and
+indentations to be 4 characters width, space filled.
+
+Other "rules" could be learned from NASM sources -- just make your code
+to look similar.
+
+Producing patch
+---------------
+
+There are at least two ways to make it right.
+
+ 1) git format-patch
+
+    You might need to read documentation on Git SCM how to prepare patch
+    for mail submission. Take a look on http://book.git-scm.com/ and/or
+    http://git-scm.com/documentation for details. It should not be hard
+    at all.
+
+ 2) Use "diff -up"
+ 
+    Use "diff -up" or "diff -uprN" to create patches.
+
+Signing your work
+-----------------
+
+To improve tracking of who did what we've introduced a "sign-off" procedure
+on patches that are being emailed around.
+
+The sign-off is a simple line at the end of the explanation for the
+patch, which certifies that you wrote it or otherwise have the right to
+pass it on as a open-source patch.  The rules are pretty simple: if you
+can certify the below:
+
+        Developer's Certificate of Origin 1.1
+
+        By making a contribution to this project, I certify that:
+
+        (a) The contribution was created in whole or in part by me and I
+            have the right to submit it under the open source license
+            indicated in the file; or
+
+        (b) The contribution is based upon previous work that, to the best
+            of my knowledge, is covered under an appropriate open source
+            license and I have the right under that license to submit that
+            work with modifications, whether created in whole or in part
+            by me, under the same open source license (unless I am
+            permitted to submit under a different license), as indicated
+            in the file; or
+
+        (c) The contribution was provided directly to me by some other
+            person who certified (a), (b) or (c) and I have not modified
+            it.
+
+	(d) I understand and agree that this project and the contribution
+	    are public and that a record of the contribution (including all
+	    personal information I submit with it, including my sign-off) is
+	    maintained indefinitely and may be redistributed consistent with
+	    this project or the open source license(s) involved.
+
+then you just add a line saying
+
+        Signed-off-by: Random J Developer <random@developer.example.org>
+
+using your real name (please, no pseudonyms or anonymous contributions if
+it possible)
+
+An example of patch message
+---------------------------
+
+From: Random J Developer <random@developer.example.org>
+Subject: [PATCH] Short patch description
+
+Long patch description (could be skipped if patch
+is trivial enough)
+
+Signed-off-by: Random J Developer <random@developer.example.org>
+---
+Patch body here
+
+Mailing patches
+---------------
+
+The patches should be sent to NASM development mailing list
+
+    nasm-devel@lists.sourceforge.net
+
+Please make sure the email client you're using doesn't screw
+your patch (line wrapping and so on).
+
+Wait for response
+-----------------
+
+Be patient. Most NASM developers are pretty busy people so if
+there is no immediate response on your patch -- don't
+be surprised, sometimes a patch may fly around a week(s) before
+gets reviewed. But definitely the patches will not go to /dev/null.
+
+    ---
+    With best regards,
+    NASM-team

+ 376 - 0
nasm/TODO

@@ -0,0 +1,376 @@
+NASM TODO list
+==============
+
+This, like the AUTHORS file, is intended for easy readability by both human 
+and machine, thus the format.
+
+  F: feature
+  V: version you should expect it by
+  R: responsible person or - if unassigned
+  C: % complete
+  D: description
+  D: maybe on multiple lines
+  
+Anything that doesn't start with /^[FVRCD]:/ should be ignored.
+
+  F:-line triggers new entry.
+  Empty V,R,C assume: V: ?, R: -, C: 0%
+
+=============
+
+F: Extended x64 Support
+D: Full FPU/MMX/SSE* instruction support for x64
+
+F: ELF64 output format
+D: Support for assembling code to the ELF64 output format
+
+F: NDISASM x64 Support
+D: Ability to disassemble respective x64 code
+
+F: General x64 Support
+V: 0.99.00
+R: Keith Kanios
+C: 99%
+D: Support for assembling 64-bit code to various output formats
+
+F: win64 (x86-64 COFF) output format
+V: 0.99.00
+R: Keith Kanios
+C: 99%
+D: Support for assembling code to the win64 output format
+
+F: c99 data-type compliance
+V: 0.99.00
+R: Keith Kanios
+C: 99%
+D: Revamped entire source-code base data-types for compliance
+D: with c99 (inttypes.h)
+
+F: __BITS__ Standard Macro
+V: 0.99.00
+R: Keith Kanios
+C: 100%
+D: __BITS__ standard macro that returns current [BITS XX] mode
+
+F: i18n via gettext
+D: kkanios: be careful about that, stick to UTF-8 if anything
+
+F: Convert shallow code model to deep code model
+D: Tired of messing between lots of unrelated files (especially .c/.h stuff)
+
+F: Automated dependency generation for Makefile
+D: Current looks awful and will break if anything changes.
+
+F: Move output modules out*.c to output/ subdir
+R: madfire
+C: 100%
+
+== THESE ARE FROM old NASM's Wishlist
+== THEY NEED SEVERE REVISING (seems they weren't updated for a couple of years or so)
+
+F: Check misc/ide.cfg into RCS as Watcom IDE enhancement thingy
+V: 0.98
+D: (nop@dlc.fi)
+
+F: Package the Linux Assembler HOWTO
+V: 0.98
+
+F: 3DNow!, SSE and other extensions need documenting
+V: 0.98
+D: hpa: Does it really make sense to have a whole instruction set
+D: reference packaged with the assembler?
+D: kkanios: Yes, for me it was a great help... and still is.
+
+F: prototypes of lrotate don't match in test/*. Fix.
+V: 0.98
+
+F: Build djgpp binaries for 0.98 onwards. Look into PMODE/W as a stub
+V: 0.98
+D: it might be a lot better than CWSDPMI. It's in PMW133.ZIP.
+
+F: %undef operator that goes along with %define
+V: ?
+C: 100%
+
+F: Fix `%error' giving error messages twice.
+V: 0.99
+D: Not especially important, as changes planned for 1.1x below will make
+D: the preprocessor be only called once.
+
+F: Sort out problems with OBJ
+V: 0.99
+D: * TLINK32 doesn't seem to like SEGDEF32 et al. So for that, we
+D:   should avoid xxx32 records wherever we can.
+D: * However, didn't we change _to_ using xxx32 at some stage? Try
+D:   to remember why and when.
+D: * Apparently Delphi's linker has trouble with two or more
+D:   globals being defined inside a PUBDEF32. Don't even know if it
+D:   _can_ cope with a PUBDEF16.
+D: * Might need extra flags. *sigh*
+
+F: Symbol table output may possibly be useful.
+V: 0.99
+D: Ken Martwick (kenm@efn.org) wants the following format:
+D: 	labelname	type	offset(hex)	repetition count
+D: Possibly include xref addresses after repetition count?
+
+F: ELF fixes
+V: 0.99
+D: There are various other bugs in outelf.c that make certain kinds
+D: of relocation not work. See zbrown.asm. Looks like we may have to do
+D: a major rewrite of parts of it. Compare some NASM code output with
+D: equivalent GAS code output. Look at the ELF spec. Generally fix things.
+
+F: ELF fixes
+V: 0.99
+D: NASM is currently using a kludge in ELF that involves defining
+D: a symbol at a zero absolute offset. This isn't needed, as the
+D: documented solution to the problem that this solves is to use
+D: SHN_UNDEF.
+
+F: Debug information, in all formats it can be usefully done in.
+V: 0.99
+D: * including line-number record support.
+D: * "George C. Lindauer" <gclind01@starbase.spd.louisville.edu>
+D:   wants to have some say in how this goes through.
+D: * Andrew Crabtree <andrewc@rosemail.rose.hp.com> wants to help out.
+
+F: Think about a line-continuation character.
+V: 0.99
+
+F: Consider allowing declaration of two labels on the same line,
+V: 0.99
+D: syntax 'label1[:] label2[:] ... instruction'.
+D: Need to investigate feasibility.
+
+F: Quoting of quotes by doubling them, in string and char constants.
+V: 0.99
+
+F: Two-operand syntax for SEGMENT/SECTION macro to avoid warnings
+D: of ignored section parameters on reissue of __SECT__.
+D: Or maybe skip the warning if the given parameters are identical to
+D: what was actually stored. Investigate.				
+V: 0.99
+
+F: Apparently we are not missing a PSRAQ instruction, because it
+D: doesn't exist.  Check that it doesn't exist as an undocumented
+D: instruction, or something stupid like that.
+V: 0.99
+
+F: Any assembled form starting 0x80 can also start 0x82.
+V: 1.00
+D: ndisasm should know this. New special code in instruction encodings, probably.
+
+F: Pointing an EQU at an external symbol now generates an error.
+V: 1.05
+D: There may be a better way of handling this; we should look into it.
+D: Ideally, the label mechanism should be changed to cope with one
+D: label being declared relative to another - that may work, but could be
+D: a pain to implement (or is it? it may be easy enough that you just
+D: need to declare a new offset in the same segment...) This should be done
+D: before v1.0 is released. There is a comment regarding this in labels.c,
+D: towards the end of the file, which discusses ways of fixing this.
+
+F: nested %rep used to cause a panic.
+V: 1.10
+D: Now a more informative error message is produced. This problem whould
+D: be fixed before v1.0.
+D: See comment in switch() statement block for PP_REP in do_directive()
+D: in preproc.c (line 1585, or thereabouts)
+
+F: Contribution
+D: zgraeme.tar contains improved hash table routines
+D: contributed by Graeme Defty <graeme@HK.Super.NET> for use in the
+D: label manager.
+
+F: Contribution
+D: zsyntax.zip contains a syntax-highlighting mode for
+D: NASM, for use with the Aurora text editor (??).
+
+F: Contribution
+D: zvim.zip contains a syntax-highlighting mode for NASM, for use with vim.
+
+F: Contribution
+D: zkendal1.zip and zkendal2.zip contain Kendall
+D: Bennett's (<KendallB@scitechsoft.com>) alternative syntax stuff,
+D: providing an alternative syntax mode for NASM which allows a macro
+D: set to be written that allows the same source files to be
+D: assembled with NASM and TASM.
+R: Kendall Bennett
+C: 100%
+
+F: Add the UD2 instruction.
+C: 100%
+
+F: Add the four instructions documented in 24368901.pdf (Intel's own document).
+C: 100%
+
+F: Some means of avoiding MOV memoffs,EAX which apparently the
+D: Pentium pairing detector thinks modifies EAX. Similar means of
+D: choosing instruction encodings where necessary.
+V: 1.10?
+
+F: The example of ..@ makes it clear that a ..@ label isn't just
+D: local, but doesn't make it clear that it isn't just global either.
+
+F: hpa wants an evaluator operator for ceil(log2(x)).
+
+F: Extra reloc types in ELF
+D: R_386_16 type 20, PC16 is 21, 8 is 22, PC8 is 23.
+D: Add support for the 16s at least.
+
+F: Lazy section creation or selective section output
+D: in COFF/win32 at least and probably other formats: don't bother to emit a section
+D: if it contains no data. Particularly the default auto-created
+D: section. We believe zero-length sections crash at least WLINK (in win32).
+
+F: Make the flags field in `struct itemplate' in insns.h a long instead of an int.
+C: 100%?
+
+F: Implement %ifref to check whether a single-line macro has ever been expanded since (last re) definition. Or maybe not. We'll see.
+
+F: add pointer to \k{insLEAVE} and \k{insENTER} in chapters about	mixed-language programming.
+
+F: Some equivalent to TASM's GLOBAL directive
+D: ie something which defines a symbol as external if it doesn't end up being defined
+D: but defines it as public if it does end up being defined.
+
+F: Documentation doesn't explain about C++ name mangling.
+
+F: see if BITS can be made to do anything sensible in obj (eg set the default new-segment property to Use32).
+
+F: OBJ: coalesce consecutive offset and segment fixups for the same location into full-32bit-pointer fixups.
+D: This is apparently necessary because some twazzock in the PowerBASIC development
+D: team didn't design to support the OMF spec the way the rest of the
+D: world sees it.
+
+F: Allow % to be separated from the rest of a preproc directive, for	alternative directive indentation styles.
+
+F: __DATE__, __TIME__, and text variants of __NASM_MAJOR__ and __NASM_MINOR__.
+
+F: Warn on TIMES combined with multi-line macros.
+V: 1.00
+D: TIMES gets applied to first line only - should bring to users' attention.
+
+F: Re-work the evaluator, again, with a per-object-format fixup
+D: routine, so as to be able to cope with section offsets "really"
+D: being pure numbers; should be able to allow at _least_ the two
+D: common idioms
+D:   TIMES 510-$ DB 0            ; bootsector
+D:   MOV AX,(PROG_END-100H)/16   ; .COM TSR
+D: Would need to call the fixup throughout the evaluator, and the
+D: fixup would have to be allowed to return UNKNOWN on pass one if it
+D: had to. (_Always_ returning UNKNOWN on pass one, though a lovely
+D: clean design, breaks the first of the above examples.)
+V: 1.10
+
+F: Preprocessor identifier concatenation?
+V: 1.10
+
+F: Arbitrary section names in `bin'.
+V: 0.98.09
+D: Is this necessary? Is it even desirable?
+D: hpa: Desirable, yes.  Necessary?  Probably not, but there are definitely cases where it becomes quite useful.
+R: madfire
+C: 100%
+
+F: Ability to read from a pipe.
+V: 1.10
+D: Obviously not useful under dos, so memory problems with storing
+D: entire input file aren't a problem either.
+
+F: File caching under DOS/32 bit...
+V: 1.10?
+D: maybe even implement discardable buffers that get thrown away
+D: when we get a NULL returned from malloc(). Only really useful under
+D: DOS. Think about it.
+
+F: possibly spool out the pre-processed stuff to a file, to avoid having to re-process it.
+V: 1.10?
+D: Possible problems with preprocessor values not known on pass 1? Have a look...
+
+F: Or maybe we can spool out a pre-parsed version...?
+V: 1.10
+D: Need to investigate feasibility. Does the results from the parser
+D: change from pass 1 to pass 2? Would it be feasible to alter it so that
+D: the parser returns an invariant result, and this is then processed
+D: afterwards to resolve label references, etc?
+
+F: Subsection support?
+
+F: A good ALIGN mechanism, similar to GAS's.
+V: 0.98p1
+D: GAS pads out space by means of the following (32-bit) instructions:
+D:         8DB42600000000    lea esi,[esi+0x0]
+D:         8DB600000000      lea esi,[esi+0x0]
+D:         8D742600          lea esi,[esi+0x0]
+D:         8D7600            lea esi,[esi+0x0]
+D:         8D36              lea esi,[esi]
+D:         90                nop
+D: It uses up to two of these instructions to do up to 14-byte pads;
+D: when more than 14 bytes are needed, it issues a (short) jump to
+D: the end of the padded section and then NOPs the rest. Come up with
+D: a similar scheme for 16 bit mode, and also come up with a way to
+D: use it - internal to the assembler, so that programs using ALIGN
+D: don't knock over preprocess-only mode.
+D:   Also re-work the macro form so that when given one argument in a
+D: code section it calls this feature.
+R: Panos Minos
+C: 100%?
+
+F: Possibly a means whereby FP constants can be specified as immediate operands to non-FP instructions.
+D: * Possible syntax: MOV EAX,FLOAT 1.2 to get a single-precision FP
+D:   constant. Then maybe MOV EAX,HI_FLOAT 1.2 and MOV EAX,LO_FLOAT
+D:   1.2 to get the two halves of a double-precision one. Best to
+D:   ignore extended-precision in case it bites.
+D: * Alternatively, maybe MOV EAX,FLOAT(4,0-4,1.2) to get bytes 0-4
+D:   (ie 0-3) of a 4-byte constant. Then HI_FLOAT is FLOAT(8,4-8,x)
+D:   and LO_FLOAT is FLOAT(8,0-4,x). But this version allows two-byte
+D:   chunks, one-byte chunks, even stranger chunks, and pieces of
+D:   ten-byte reals to be bandied around as well.
+
+F: A UNION macro might be quite cool
+D: now that ABSOLUTE is sane enough to be able to handle it.
+
+F: An equivalent to gcc's ## stringify operator, plus string concatenation
+D: somehow implemented without undue ugliness, so as
+D: to be able to do `%include "/my/path/%1"' in a macro, or something
+D: similar...
+
+F: Actually _do_ something with the processor, privileged and
+D: undocumented flags in the instruction table. When this happens,
+D: consider allowing PMULHRW to map to either of the Cyrix or AMD
+D: versions?
+D: hpa: The -p option to ndisasm now uses this to some extent.
+V: 1.10
+
+F: Maybe NEC V20/V30 instructions?					?
+D: hpa: What are they?  Should be trivial to implement.
+
+F: Yet more object formats.
+D: * Possibly direct support for .EXE files?
+V: 1.10
+
+F: Symbol map in binary format. Format-specific options...
+V: 1.10?
+
+F: REDESIGN: Think about EQU dependency, and about start-point specification in OBJ. Possibly re-think directive support.
+V: 1.20?
+
+F: Think about a wrapper program like gcc?
+V: 2.00?
+D: Possibly invent a _patch_ for gcc so that it can take .asm files on the command line?
+D: If a wrapper happens, think about adding an option to cause the
+D: resulting executable file to be executed immediately, thus
+D: allowing NASM source files to have #!... (probably silly)
+
+F: Multi-platform support?
+D: If so: definitely Alpha; possibly Java byte code;
+D: probably ARM/StrongARM; maybe Sparc; maybe Mips; maybe
+D: Vax. Perhaps Z80 and 6502, just for a laugh?
+
+F: Consider a 'verbose' option that prints information about the resulting object file onto stdout.
+
+F: Line numbers in the .lst file don't match the line numbers in the input.
+D: They probably should, rather than the current matching of the post-preprocessor line numbers.
+

+ 202 - 0
nasm/aclocal.m4

@@ -0,0 +1,202 @@
+dnl --------------------------------------------------------------------------
+dnl PA_SYM(prefix, string)
+dnl
+dnl Convert a (semi-) arbitrary string to a CPP symbol
+dnl --------------------------------------------------------------------------
+AC_DEFUN(PA_SYM,
+[[$1]m4_bpatsubsts(m4_toupper([$2]),[[^ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]+],[_],[^._?\(.*\)_.$],[[\1]])])
+
+dnl --------------------------------------------------------------------------
+dnl PA_ADD_CFLAGS(flag [,actual_flag])
+dnl
+dnl Attempt to add the given option to CFLAGS, if it doesn't break
+dnl compilation.  If the option to be tested is different than the
+dnl option that should actually be added, add the option to be
+dnl actually added as a second argument.
+dnl --------------------------------------------------------------------------
+AC_DEFUN(PA_ADD_CFLAGS,
+[AC_MSG_CHECKING([if $CC accepts $1])
+ pa_add_cflags__old_cflags="$CFLAGS"
+ CFLAGS="$CFLAGS $1"
+ AC_TRY_LINK(AC_INCLUDES_DEFAULT,
+ [printf("Hello, World!\n");],
+ [AC_MSG_RESULT([yes])
+  CFLAGS="$pa_add_cflags__old_cflags ifelse([$2],[],[$1],[$2])"
+  AC_DEFINE(PA_SYM([CFLAG_],[$1]), 1,
+   [Define to 1 if compiled with the `$1' compiler flag])],
+ [AC_MSG_RESULT([no])
+  CFLAGS="$pa_add_cflags__old_cflags"])])
+
+dnl --------------------------------------------------------------------------
+dnl PA_ADD_CLDFLAGS(flag [,actual_flag])
+dnl
+dnl Attempt to add the given option to CFLAGS and LDFLAGS,
+dnl if it doesn't break compilation
+dnl --------------------------------------------------------------------------
+AC_DEFUN(PA_ADD_CLDFLAGS,
+[AC_MSG_CHECKING([if $CC accepts $1])
+ pa_add_cldflags__old_cflags="$CFLAGS"
+ CFLAGS="$CFLAGS $1"
+ pa_add_cldflags__old_ldflags="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $1"
+ AC_TRY_LINK(AC_INCLUDES_DEFAULT,
+ [printf("Hello, World!\n");],
+ [AC_MSG_RESULT([yes])
+  CFLAGS="$pa_add_cldflags__old_cflags ifelse([$2],[],[$1],[$2])"
+  LDFLAGS="$pa_add_cldflags__old_ldflags ifelse([$2],[],[$1],[$2])"
+  AC_DEFINE(PA_SYM([CFLAG_],[$1]), 1,
+   [Define to 1 if compiled with the `$1' compiler flag])],
+ [AC_MSG_RESULT([no])
+  CFLAGS="$pa_add_cldflags__old_cflags"
+  LDFLAGS="$pa_add_cldflags__old_ldflags"])])
+
+dnl --------------------------------------------------------------------------
+dnl PA_HAVE_FUNC(func_name)
+dnl
+dnl Look for a function with the specified arguments which could be
+dnl a builtin/intrinsic function.
+dnl --------------------------------------------------------------------------
+AC_DEFUN(PA_HAVE_FUNC,
+[AC_MSG_CHECKING([for $1])
+ AC_LINK_IFELSE([AC_LANG_SOURCE([
+AC_INCLUDES_DEFAULT
+int main(void) {
+    (void)$1$2;
+    return 0;
+}
+ ])],
+ [AC_MSG_RESULT([yes])
+  AC_DEFINE(AS_TR_CPP([HAVE_$1]), 1,
+  [Define to 1 if you have the `$1' intrinsic function.])],
+ [AC_MSG_RESULT([no])])
+])
+
+dnl --------------------------------------------------------------------------
+dnl PA_LIBEXT
+dnl
+dnl Guess the library extension based on the object extension
+dnl --------------------------------------------------------------------------
+AC_DEFUN(PA_LIBEXT,
+[AC_MSG_CHECKING([for suffix of library files])
+if test x"$LIBEXT" = x; then
+  case "$OBJEXT" in
+    obj )
+      LIBEXT=lib
+      ;;
+    *)
+      LIBEXT=a
+      ;;
+  esac
+fi
+AC_MSG_RESULT([$LIBEXT])
+AC_SUBST([LIBEXT])])
+
+dnl --------------------------------------------------------------------------
+dnl PA_FUNC_ATTRIBUTE(attribute_name)
+dnl
+dnl See if this compiler supports the equivalent of a specific gcc
+dnl attribute on a function, using the __attribute__(()) syntax.
+dnl All arguments except the attribute name are optional.
+dnl PA_FUNC_ATTRIBUTE(attribute, attribute_opts, return_type,
+dnl                   prototype_args, call_args)
+dnl --------------------------------------------------------------------------
+AC_DEFUN(PA_FUNC_ATTRIBUTE,
+[AC_MSG_CHECKING([if $CC supports the $1 function attribute])
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+AC_INCLUDES_DEFAULT
+extern ifelse([$3],[],[void *],[$3])  __attribute__(($1$2))
+  bar(ifelse([$4],[],[int],[$4]));
+ifelse([$3],[],[void *],[$3]) foo(void);
+ifelse([$3],[],[void *],[$3]) foo(void)
+{
+	ifelse([$3],[void],[],[return])
+		bar(ifelse([$5],[],[1],[$5]));
+}
+ ])],
+ [AC_MSG_RESULT([yes])
+  AC_DEFINE(PA_SYM([HAVE_FUNC_ATTRIBUTE_],[$1]), 1,
+    [Define to 1 if your compiler supports __attribute__(($1)) on functions])],
+ [AC_MSG_RESULT([no])])
+])
+
+dnl --------------------------------------------------------------------------
+dnl PA_FUNC_ATTRIBUTE_ERROR
+dnl
+dnl See if this compiler supports __attribute__((error("foo")))
+dnl The generic version of this doesn't work as it makes the compiler
+dnl throw an error by design.
+dnl --------------------------------------------------------------------------
+AC_DEFUN(PA_FUNC_ATTRIBUTE_ERROR,
+[AC_MSG_CHECKING([if $CC supports the error function attribute])
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+AC_INCLUDES_DEFAULT
+extern void __attribute__((error("message"))) barf(void);
+void foo(void);
+void foo(void)
+{
+	if (0)
+		barf();
+}
+ ])],
+ [AC_MSG_RESULT([yes])
+  AC_DEFINE([HAVE_FUNC_ATTRIBUTE_ERROR], 1,
+    [Define to 1 if your compiler supports __attribute__((error)) on functions])],
+ [AC_MSG_RESULT([no])])
+])
+
+dnl --------------------------------------------------------------------------
+dnl PA_ARG_ENABLED(option, helptext [,enabled_action [,disabled_action]])
+dnl PA_ARG_DISABLED(option, helptext [,disabled_action [,enabled_action]])
+dnl
+dnl  Simpler-to-use versions of AC_ARG_ENABLED, that include the
+dnl  test for $enableval and the AS_HELP_STRING definition
+dnl --------------------------------------------------------------------------
+AC_DEFUN(PA_ARG_ENABLED,
+[AC_ARG_ENABLE([$1], [AS_HELP_STRING([--enable-$1],[$2])], [], [enableval=no])
+ AS_IF([test x"$enableval" != xno], [$3], [$4])
+])
+
+AC_DEFUN(PA_ARG_DISABLED,
+[AC_ARG_ENABLE([$1],[AS_HELP_STRING([--disable-$1],[$2])], [], [enableval=yes])
+ AS_IF([test x"$enableval" = xno], [$3], [$4])
+])
+
+dnl --------------------------------------------------------------------------
+dnl PA_ADD_HEADERS(headers...)
+dnl
+dnl Call AC_CHECK_HEADERS(), and add to ac_includes_default if found
+dnl --------------------------------------------------------------------------
+AC_DEFUN(_PA_ADD_HEADER,
+[AC_CHECK_HEADERS([$1],[ac_includes_default="$ac_includes_default
+#include <$1>"
+])])
+
+AC_DEFUN(PA_ADD_HEADERS,
+[m4_map_args_w([$1],[_PA_ADD_HEADER(],[)])])
+
+dnl --------------------------------------------------------------------------
+dnl PA_CHECK_BAD_STDC_INLINE
+dnl
+dnl Some versions of gcc seem to apply -Wmissing-prototypes to C99
+dnl inline functions, which means we need to use GNU inline syntax
+dnl --------------------------------------------------------------------------
+AC_DEFUN(PA_CHECK_BAD_STDC_INLINE,
+[AC_MSG_CHECKING([if $CC supports C99 external inlines])
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+AC_INCLUDES_DEFAULT
+
+/* Don't mistake GNU inlines for c99 */
+#ifdef __GNUC_GNU_INLINE__
+# error "Using gnu inline standard"
+#endif
+
+inline int foo(int x)
+{
+	return x+1;
+}
+ ])],
+ [AC_MSG_RESULT([yes])
+  AC_DEFINE(HAVE_STDC_INLINE, 1,
+    [Define to 1 if your compiler supports C99 extern inline])],
+ [AC_MSG_RESULT([no])
+  PA_ADD_CFLAGS([-fgnu89-inline])])])

Файловите разлики са ограничени, защото са твърде много
+ 2997 - 0
nasm/asm/assemble.c


+ 54 - 0
nasm/asm/assemble.h

@@ -0,0 +1,54 @@
+/* ----------------------------------------------------------------------- *
+ *   
+ *   Copyright 1996-2017 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *     
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * assemble.h - header file for stuff private to the assembler
+ */
+
+#ifndef NASM_ASSEMBLE_H
+#define NASM_ASSEMBLE_H
+
+#include "nasm.h"
+#include "iflag.h"
+
+extern iflag_t cpu;
+extern bool in_absolute;        /* Are we in an absolute segment? */
+extern struct location absolute;
+
+int64_t insn_size(int32_t segment, int64_t offset, int bits, insn *instruction);
+int64_t assemble(int32_t segment, int64_t offset, int bits, insn *instruction);
+
+bool process_directives(char *);
+void process_pragma(char *);
+
+#endif

+ 126 - 0
nasm/asm/directbl.c

@@ -0,0 +1,126 @@
+/*
+ * This file is generated from ./asm/directiv.dat
+ * by perfhash.pl; do not edit.
+ */
+
+#include "directiv.h"
+
+const char * const directive_tbl[38] = {
+    "absolute",
+    "bits",
+    "common",
+    "cpu",
+    "debug",
+    "default",
+    "extern",
+    "float",
+    "global",
+    "static",
+    "list",
+    "section",
+    "segment",
+    "warning",
+    "sectalign",
+    "pragma",
+    "export",
+    "group",
+    "import",
+    "library",
+    "map",
+    "module",
+    "org",
+    "osabi",
+    "safeseh",
+    "uppercase",
+    "prefix",
+    "suffix",
+    "gprefix",
+    "gsuffix",
+    "lprefix",
+    "lsuffix",
+    "limit",
+    "subsections_via_symbols",
+    "no_dead_strip",
+    "maxdump",
+    "nodepend",
+    "noseclabels"
+};
+
+#define UNUSED (65536/3)
+
+static const int16_t directive_hashvals[64] = {
+    0,
+    UNUSED,
+    0,
+    UNUSED,
+    26,
+    -4,
+    0,
+    11,
+    0,
+    8,
+    UNUSED,
+    UNUSED,
+    0,
+    -5,
+    28,
+    15,
+    UNUSED,
+    UNUSED,
+    UNUSED,
+    -16,
+    UNUSED,
+    2,
+    19,
+    -3,
+    -22,
+    16,
+    UNUSED,
+    6,
+    11,
+    -20,
+    16,
+    -13,
+    0,
+    UNUSED,
+    UNUSED,
+    UNUSED,
+    0,
+    0,
+    6,
+    0,
+    22,
+    2,
+    -28,
+    32,
+    12,
+    23,
+    3,
+    UNUSED,
+    26,
+    UNUSED,
+    12,
+    29,
+    10,
+    17,
+    28,
+    34,
+    UNUSED,
+    UNUSED,
+    1,
+    9,
+    27,
+    UNUSED,
+    19,
+    14
+};
+
+const struct perfect_hash directive_hash = {
+    UINT64_C(0x076259c3e291c26c),
+    UINT32_C(0x1f),
+    UINT32_C(38),
+    3,
+    (D_unknown),
+    directive_hashvals,
+    directive_tbl
+};

+ 515 - 0
nasm/asm/directiv.c

@@ -0,0 +1,515 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 1996-2018 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * Parse and handle assembler directives
+ */
+
+#include "compiler.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <limits.h>
+
+#include "nasm.h"
+#include "nasmlib.h"
+#include "ilog2.h"
+#include "error.h"
+#include "float.h"
+#include "stdscan.h"
+#include "preproc.h"
+#include "eval.h"
+#include "assemble.h"
+#include "outform.h"
+#include "listing.h"
+#include "labels.h"
+#include "iflag.h"
+
+struct cpunames {
+    const char *name;
+    unsigned int level;
+    /* Eventually a table of features */
+};
+
+static iflag_t get_cpu(const char *value)
+{
+    iflag_t r;
+    const struct cpunames *cpu;
+    static const struct cpunames cpunames[] = {
+        { "8086", IF_8086 },
+        { "186",  IF_186  },
+        { "286",  IF_286  },
+        { "386",  IF_386  },
+        { "486",  IF_486  },
+        { "586",  IF_PENT },
+        { "pentium", IF_PENT },
+        { "pentiummmx", IF_PENT },
+        { "686",  IF_P6 },
+        { "p6",   IF_P6 },
+        { "ppro", IF_P6 },
+        { "pentiumpro", IF_P6 },
+        { "p2", IF_P6 },        /* +MMX */
+        { "pentiumii", IF_P6 },
+        { "p3", IF_KATMAI },
+        { "katmai", IF_KATMAI },
+        { "p4", IF_WILLAMETTE },
+        { "willamette", IF_WILLAMETTE },
+        { "prescott", IF_PRESCOTT },
+        { "x64", IF_X86_64 },
+        { "x86-64", IF_X86_64 },
+        { "ia64", IF_IA64 },
+        { "ia-64", IF_IA64 },
+        { "itanium", IF_IA64 },
+        { "itanic", IF_IA64 },
+        { "merced", IF_IA64 },
+        { "any", IF_PLEVEL },
+        { "default", IF_PLEVEL },
+        { "all", IF_PLEVEL },
+        { NULL, IF_PLEVEL }     /* Error and final default entry */
+    };
+
+    iflag_clear_all(&r);
+
+    for (cpu = cpunames; cpu->name; cpu++) {
+        if (!nasm_stricmp(value, cpu->name))
+            break;
+    }
+
+    if (!cpu->name) {
+        nasm_error(pass0 < 2 ? ERR_NONFATAL : ERR_FATAL,
+                   "unknown 'cpu' type '%s'", value);
+    }
+
+    iflag_set_cpu(&r, cpu->level);
+    return r;
+}
+
+static int get_bits(const char *value)
+{
+    int i = atoi(value);
+
+    switch (i) {
+    case 16:
+        break;                  /* Always safe */
+    case 32:
+        if (!iflag_cpu_level_ok(&cpu, IF_386)) {
+            nasm_error(ERR_NONFATAL,
+                       "cannot specify 32-bit segment on processor below a 386");
+            i = 16;
+        }
+        break;
+    case 64:
+        if (!iflag_cpu_level_ok(&cpu, IF_X86_64)) {
+            nasm_error(ERR_NONFATAL,
+                       "cannot specify 64-bit segment on processor below an x86-64");
+            i = 16;
+        }
+        break;
+    default:
+        nasm_error(pass0 < 2 ? ERR_NONFATAL : ERR_FATAL,
+                   "`%s' is not a valid segment size; must be 16, 32 or 64",
+                   value);
+        i = 16;
+        break;
+    }
+    return i;
+}
+
+static enum directive parse_directive_line(char **directive, char **value)
+{
+    char *p, *q, *buf;
+
+    buf = nasm_skip_spaces(*directive);
+
+    /*
+     * It should be enclosed in [ ].
+     * XXX: we don't check there is nothing else on the remainder of the
+     * line, except a possible comment.
+     */
+    if (*buf != '[')
+        return D_none;
+    q = strchr(buf, ']');
+    if (!q)
+        return D_corrupt;
+
+    /*
+     * Strip off the comments.  XXX: this doesn't account for quoted
+     * strings inside a directive.  We should really strip the
+     * comments in generic code, not here.  While we're at it, it
+     * would be better to pass the backend a series of tokens instead
+     * of a raw string, and actually process quoted strings for it,
+     * like of like argv is handled in C.
+     */
+    p = strchr(buf, ';');
+    if (p) {
+        if (p < q) /* ouch! somewhere inside */
+            return D_corrupt;
+        *p = '\0';
+    }
+
+    /* no brace, no trailing spaces */
+    *q = '\0';
+    nasm_zap_spaces_rev(--q);
+
+    /* directive */
+    p = nasm_skip_spaces(++buf);
+    q = nasm_skip_word(p);
+    if (!q)
+        return D_corrupt; /* sigh... no value there */
+    *q = '\0';
+    *directive = p;
+
+    /* and value finally */
+    p = nasm_skip_spaces(++q);
+    *value = p;
+
+    return directive_find(*directive);
+}
+
+/*
+ * Process a line from the assembler and try to handle it if it
+ * is a directive.  Return true if the line was handled (including
+ * if it was an error), false otherwise.
+ */
+bool process_directives(char *directive)
+{
+    enum directive d;
+    char *value, *p, *q, *special;
+    struct tokenval tokval;
+    bool bad_param = false;
+    int pass2 = passn > 1 ? 2 : 1;
+    enum label_type type;
+
+    d = parse_directive_line(&directive, &value);
+
+    switch (d) {
+    case D_none:
+        return D_none;      /* Not a directive */
+
+    case D_corrupt:
+	nasm_error(ERR_NONFATAL, "invalid directive line");
+	break;
+
+    default:			/* It's a backend-specific directive */
+        switch (ofmt->directive(d, value, pass2)) {
+        case DIRR_UNKNOWN:
+            goto unknown;
+        case DIRR_OK:
+        case DIRR_ERROR:
+            break;
+        case DIRR_BADPARAM:
+            bad_param = true;
+            break;
+        default:
+            panic();
+        }
+        break;
+
+    case D_unknown:
+    unknown:
+        nasm_error(pass0 < 2 ? ERR_NONFATAL : ERR_PANIC,
+                   "unrecognised directive [%s]", directive);
+        break;
+
+    case D_SEGMENT:         /* [SEGMENT n] */
+    case D_SECTION:
+    {
+	int sb = globalbits;
+        int32_t seg = ofmt->section(value, pass2, &sb);
+
+        if (seg == NO_SEG) {
+            nasm_error(pass0 < 2 ? ERR_NONFATAL : ERR_PANIC,
+                       "segment name `%s' not recognized", value);
+        } else {
+            globalbits = sb;
+            switch_segment(seg);
+        }
+        break;
+    }
+
+    case D_SECTALIGN:       /* [SECTALIGN n] */
+    {
+	expr *e;
+
+        if (*value) {
+            stdscan_reset();
+            stdscan_set(value);
+            tokval.t_type = TOKEN_INVALID;
+            e = evaluate(stdscan, NULL, &tokval, NULL, pass2, NULL);
+            if (e) {
+                uint64_t align = e->value;
+
+		if (!is_power2(e->value)) {
+                    nasm_error(ERR_NONFATAL,
+                               "segment alignment `%s' is not power of two",
+                               value);
+		} else if (align > UINT64_C(0x7fffffff)) {
+                    /*
+                     * FIXME: Please make some sane message here
+                     * ofmt should have some 'check' method which
+                     * would report segment alignment bounds.
+                     */
+		    nasm_error(ERR_NONFATAL,
+			       "absurdly large segment alignment `%s' (2^%d)",
+			       value, ilog2_64(align));
+                }
+
+                /* callee should be able to handle all details */
+                if (location.segment != NO_SEG)
+                    ofmt->sectalign(location.segment, align);
+            }
+        }
+        break;
+    }
+
+    case D_BITS:            /* [BITS bits] */
+        globalbits = get_bits(value);
+        break;
+
+    case D_GLOBAL:          /* [GLOBAL|STATIC|EXTERN|COMMON symbol:special] */
+        type = LBL_GLOBAL;
+        goto symdef;
+    case D_STATIC:
+        type = LBL_STATIC;
+        goto symdef;
+    case D_EXTERN:
+        type = LBL_EXTERN;
+        goto symdef;
+    case D_COMMON:
+        type = LBL_COMMON;
+        goto symdef;
+
+    symdef:
+    {
+        bool validid = true;
+        int64_t size = 0;
+        char *sizestr;
+        bool rn_error;
+
+        if (*value == '$')
+            value++;        /* skip initial $ if present */
+
+        q = value;
+        if (!isidstart(*q)) {
+            validid = false;
+        } else {
+            q++;
+            while (*q && *q != ':' && !nasm_isspace(*q)) {
+                if (!isidchar(*q))
+                    validid = false;
+                q++;
+            }
+        }
+        if (!validid) {
+            nasm_error(ERR_NONFATAL,
+                       "identifier expected after %s, got `%s'",
+                       directive, value);
+            break;
+        }
+
+        if (nasm_isspace(*q)) {
+            *q++ = '\0';
+            sizestr = q = nasm_skip_spaces(q);
+            q = strchr(q, ':');
+        } else {
+            sizestr = NULL;
+        }
+
+        if (q && *q == ':') {
+            *q++ = '\0';
+            special = q;
+        } else {
+            special = NULL;
+        }
+
+        if (type == LBL_COMMON) {
+            if (sizestr)
+                size = readnum(sizestr, &rn_error);
+            if (!sizestr || rn_error)
+                nasm_error(ERR_NONFATAL,
+                           "%s size specified in common declaration",
+                           sizestr ? "invalid" : "no");
+        } else if (sizestr) {
+            nasm_error(ERR_NONFATAL, "invalid syntax in %s declaration",
+                       directive);
+        }
+
+        if (!declare_label(value, type, special))
+            break;
+        
+        if (type == LBL_COMMON || type == LBL_EXTERN)
+            define_label(value, 0, size, false);
+
+    	break;
+    }
+
+    case D_ABSOLUTE:        /* [ABSOLUTE address] */
+    {
+	expr *e;
+
+        stdscan_reset();
+        stdscan_set(value);
+        tokval.t_type = TOKEN_INVALID;
+        e = evaluate(stdscan, NULL, &tokval, NULL, pass2, NULL);
+        if (e) {
+            if (!is_reloc(e))
+                nasm_error(pass0 ==
+                           1 ? ERR_NONFATAL : ERR_PANIC,
+                           "cannot use non-relocatable expression as "
+                           "ABSOLUTE address");
+            else {
+                absolute.segment = reloc_seg(e);
+                absolute.offset = reloc_value(e);
+            }
+        } else if (passn == 1)
+            absolute.offset = 0x100;     /* don't go near zero in case of / */
+        else
+            nasm_panic(0, "invalid ABSOLUTE address "
+                       "in pass two");
+        in_absolute = true;
+        location.segment = NO_SEG;
+        location.offset = absolute.offset;
+        break;
+    }
+
+    case D_DEBUG:           /* [DEBUG] */
+    {
+        bool badid, overlong;
+	char debugid[128];
+
+        p = value;
+        q = debugid;
+        badid = overlong = false;
+        if (!isidstart(*p)) {
+            badid = true;
+        } else {
+            while (*p && !nasm_isspace(*p)) {
+                if (q >= debugid + sizeof debugid - 1) {
+                    overlong = true;
+                    break;
+                }
+                if (!isidchar(*p))
+                    badid = true;
+                *q++ = *p++;
+            }
+            *q = 0;
+        }
+        if (badid) {
+            nasm_error(passn == 1 ? ERR_NONFATAL : ERR_PANIC,
+                       "identifier expected after DEBUG");
+            break;
+        }
+        if (overlong) {
+            nasm_error(passn == 1 ? ERR_NONFATAL : ERR_PANIC,
+                       "DEBUG identifier too long");
+            break;
+        }
+        p = nasm_skip_spaces(p);
+        if (pass0 == 2)
+            dfmt->debug_directive(debugid, p);
+        break;
+    }
+
+    case D_WARNING:         /* [WARNING {+|-|*}warn-name] */
+        if (!set_warning_status(value)) {
+            nasm_error(ERR_WARNING|WARN_UNK_WARNING,
+                       "unknown warning option: %s", value);
+        }
+        break;
+
+    case D_CPU:         /* [CPU] */
+        cpu = get_cpu(value);
+        break;
+
+    case D_LIST:        /* [LIST {+|-}] */
+        value = nasm_skip_spaces(value);
+        if (*value == '+') {
+            user_nolist = false;
+        } else {
+            if (*value == '-') {
+                user_nolist = true;
+            } else {
+                bad_param = true;
+            }
+        }
+        break;
+
+    case D_DEFAULT:         /* [DEFAULT] */
+        stdscan_reset();
+        stdscan_set(value);
+        tokval.t_type = TOKEN_INVALID;
+        if (stdscan(NULL, &tokval) != TOKEN_INVALID) {
+            switch (tokval.t_integer) {
+            case S_REL:
+                globalrel = 1;
+                break;
+            case S_ABS:
+                globalrel = 0;
+                break;
+            case P_BND:
+                globalbnd = 1;
+                break;
+            case P_NOBND:
+                globalbnd = 0;
+                break;
+            default:
+                bad_param = true;
+                break;
+            }
+        } else {
+            bad_param = true;
+        }
+        break;
+
+    case D_FLOAT:
+        if (float_option(value)) {
+            nasm_error(pass0 < 2 ? ERR_NONFATAL : ERR_PANIC,
+                       "unknown 'float' directive: %s", value);
+        }
+        break;
+
+    case D_PRAGMA:
+        process_pragma(value);
+        break;
+    }
+
+
+    /* A common error message */
+    if (bad_param) {
+        nasm_error(ERR_NONFATAL, "invalid parameter to [%s] directive",
+                   directive);
+    }
+
+    return d != D_none;
+}

+ 103 - 0
nasm/asm/directiv.dat

@@ -0,0 +1,103 @@
+;; --------------------------------------------------------------------------
+;;
+;;   Copyright 1996-2017 The NASM Authors - All Rights Reserved
+;;   See the file AUTHORS included with the NASM distribution for
+;;   the specific copyright holders.
+;;
+;;   Redistribution and use in source and binary forms, with or without
+;;   modification, are permitted provided that the following
+;;   conditions are met:
+;;
+;;   * Redistributions of source code must retain the above copyright
+;;     notice, this list of conditions and the following disclaimer.
+;;   * Redistributions in binary form must reproduce the above
+;;     copyright notice, this list of conditions and the following
+;;     disclaimer in the documentation and/or other materials provided
+;;     with the distribution.
+;;
+;;     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+;;     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+;;     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+;;     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+;;     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+;;     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+;;     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+;;     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+;;     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+;;     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+;;     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+;;     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+;;     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+;;
+;; --------------------------------------------------------------------------
+;;
+;; List of global NASM directives and pragma operations codes
+;;
+;; ALL directives, including backend-specific, need to be added here.
+;;
+;; %pragma operation keywords (the second word, after facility) MAY
+;; be added here too to assist in parsing, but it is not required.
+;; See the definition of struct pragma in include/nasm.h.
+;;
+;; The same keyword can be used as a directive and as a pragma
+;; operation, or as pragma operations in different namespaces.  The
+;; same D_ constant will be used for both, and this is perfectly
+;; acceptable.
+;;
+
+; --- General configuration
+#name directive
+#prefix D_
+#errval D_unknown
+#header directiv.h
+
+; --- Special enum values
+#special none = 0			; Must be zero
+#special unknown
+#special corrupt
+
+; --- Global directives
+absolute
+bits
+common
+cpu
+debug
+default
+extern
+float
+global
+static
+list
+section
+segment
+warning
+sectalign
+pragma
+
+; --- Format-specific directives
+export				; outcoff, outobj
+group				; outobj
+import				; outobj
+library				; outrdf2
+map				; outbin
+module				; outrdf2
+org				; outbin
+osabi				; outelf
+safeseh				; outcoff
+uppercase			; outieee, outobj
+
+; --- Assembler pragmas
+prefix
+suffix
+gprefix
+gsuffix
+lprefix
+lsuffix
+limit
+
+; --- Pragma operations
+subsections_via_symbols		; macho
+no_dead_strip			; macho
+maxdump				; dbg
+nodepend			; obj
+noseclabels			; dbg

+ 77 - 0
nasm/asm/directiv.h

@@ -0,0 +1,77 @@
+/*
+ * This file is generated from ./asm/directiv.dat
+ * by perfhash.pl; do not edit.
+ */
+
+#ifndef DIRECTIV_H
+#define DIRECTIV_H 1
+
+#include "perfhash.h"
+
+enum directive {
+    D_none,
+    D_unknown,
+    D_corrupt,
+    D_ABSOLUTE,
+    D_BITS,
+    D_COMMON,
+    D_CPU,
+    D_DEBUG,
+    D_DEFAULT,
+    D_EXTERN,
+    D_FLOAT,
+    D_GLOBAL,
+    D_STATIC,
+    D_LIST,
+    D_SECTION,
+    D_SEGMENT,
+    D_WARNING,
+    D_SECTALIGN,
+    D_PRAGMA,
+    D_EXPORT,
+    D_GROUP,
+    D_IMPORT,
+    D_LIBRARY,
+    D_MAP,
+    D_MODULE,
+    D_ORG,
+    D_OSABI,
+    D_SAFESEH,
+    D_UPPERCASE,
+    D_PREFIX,
+    D_SUFFIX,
+    D_GPREFIX,
+    D_GSUFFIX,
+    D_LPREFIX,
+    D_LSUFFIX,
+    D_LIMIT,
+    D_SUBSECTIONS_VIA_SYMBOLS,
+    D_NO_DEAD_STRIP,
+    D_MAXDUMP,
+    D_NODEPEND,
+    D_NOSECLABELS
+};
+
+extern const struct perfect_hash directive_hash;
+extern const char * const directive_tbl[38];
+
+static inline enum directive directive_find(const char *str)
+{
+    return perfhash_find(&directive_hash, str);
+}
+
+static inline const char * directive_name(enum directive x)
+{
+    size_t ix = (size_t)x - (3);
+    if (ix >= 38)
+        return NULL;
+    return directive_tbl[ix];
+}
+
+static inline const char * directive_dname(enum directive x)
+{
+    const char *y = directive_name(x);
+    return y ? y : invalid_enum_str(x);
+}
+
+#endif /* DIRECTIV_H */

+ 211 - 0
nasm/asm/error.c

@@ -0,0 +1,211 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 1996-2018 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * error.c - error message handling routines for the assembler
+ */
+
+#include "compiler.h"
+
+#include <stdlib.h>
+
+#include "nasmlib.h"
+#include "error.h"
+
+/*
+ * Description of the suppressible warnings for the command line and
+ * the [warning] directive.
+ */
+#define on	(WARN_ST_ENABLED)
+#define off	0
+#define err	(WARN_ST_ENABLED|WARN_ST_ERROR)
+
+const struct warning warnings[WARN_ALL+1] = {
+    {NULL, NULL, on},	/* must be on - used for unconditional enable */
+    {"macro-params", "macro calls with wrong parameter count", on},
+    {"macro-selfref", "cyclic macro references", off},
+    {"macro-defaults", "macros with more default than optional parameters", on},
+    {"orphan-labels", "labels alone on lines without trailing `:'", on},
+    {"number-overflow", "numeric constant does not fit", on},
+    {"gnu-elf-extensions", "using 8- or 16-bit relocation in ELF32, a GNU extension", off},
+    {"float-overflow", "floating point overflow", on},
+    {"float-denorm", "floating point denormal", off},
+    {"float-underflow", "floating point underflow", off},
+    {"float-toolong", "too many digits in floating-point number", on},
+    {"user", "%warning directives", on},
+    {"lock", "lock prefix on unlockable instructions", on},
+    {"hle", "invalid hle prefixes", on},
+    {"bnd", "invalid bnd prefixes", on},
+    {"zext-reloc", "relocation zero-extended to match output format", on},
+    {"ptr", "non-NASM keyword used in other assemblers", on},
+    {"bad-pragma", "empty or malformed %pragma", off},
+    {"unknown-pragma", "unknown %pragma facility or directive", off},
+    {"not-my-pragma", "%pragma not applicable to this compilation", off},
+    {"unknown-warning", "unknown warning in -W/-w or warning directive", off},
+    {"negative-rep", "regative %rep count", on},
+    {"phase", "phase error during stabilization", off},
+    {"label-redef", "label redefined to an identical value", off},
+    {"label-redef-late", "label (re)defined during code generation", err},
+
+    /* THESE ENTRIES SHOULD COME LAST */
+    {"other", "any warning not specifially mentioned above", on},
+    {"all", "all possible warnings", off}
+};
+
+uint8_t warning_state[WARN_ALL];/* Current state */
+uint8_t warning_state_init[WARN_ALL]; /* Command-line state, for reset */
+
+vefunc nasm_verror;    /* Global error handling function */
+
+void nasm_error(int severity, const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    nasm_verror(severity, fmt, ap);
+    va_end(ap);
+}
+
+fatal_func nasm_fatal(int flags, const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    nasm_verror(flags | ERR_FATAL, fmt, ap);
+    abort();			/* We should never get here */
+}
+
+fatal_func nasm_panic(int flags, const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    nasm_verror(flags | ERR_PANIC, fmt, ap);
+    abort();			/* We should never get here */
+}
+
+fatal_func nasm_panic_from_macro(const char *file, int line)
+{
+    nasm_panic(ERR_NOFILE, "Internal error at %s:%d\n", file, line);
+}
+
+fatal_func nasm_assert_failed(const char *file, int line, const char *msg)
+{
+    nasm_panic(0, "assertion %s failed at %s:%d", msg, file, line);
+}
+
+/*
+ * This is called when processing a -w or -W option, or a warning directive.
+ * Returns on if if the action was successful.
+ */
+bool set_warning_status(const char *value)
+{
+    enum warn_action { WID_OFF, WID_ON, WID_RESET };
+    enum warn_action action;
+    uint8_t mask;
+    int i;
+    bool ok = false;
+
+    value = nasm_skip_spaces(value);
+    switch (*value) {
+    case '-':
+        action = WID_OFF;
+        value++;
+        break;
+    case '+':
+        action = WID_ON;
+        value++;
+        break;
+    case '*':
+        action = WID_RESET;
+        value++;
+        break;
+    case 'N':
+    case 'n':
+        if (!nasm_strnicmp(value, "no-", 3)) {
+            action = WID_OFF;
+            value += 3;
+            break;
+        } else if (!nasm_stricmp(value, "none")) {
+            action = WID_OFF;
+            value = NULL;
+            break;
+        }
+        /* else fall through */
+    default:
+        action = WID_ON;
+        break;
+    }
+
+    mask = WARN_ST_ENABLED;
+
+    if (value && !nasm_strnicmp(value, "error", 5)) {
+        switch (value[5]) {
+        case '=':
+            mask = WARN_ST_ERROR;
+            value += 6;
+            break;
+        case '\0':
+            mask = WARN_ST_ERROR;
+            value = NULL;
+            break;
+        default:
+            /* Just an accidental prefix? */
+            break;
+        }
+    }
+
+    if (value && !nasm_stricmp(value, "all"))
+        value = NULL;
+
+    /* This is inefficient, but it shouldn't matter... */
+    for (i = 1; i < WARN_ALL; i++) {
+        if (!value || !nasm_stricmp(value, warnings[i].name)) {
+            ok = true;          /* At least one action taken */
+            switch (action) {
+            case WID_OFF:
+                warning_state[i] &= ~mask;
+                break;
+            case WID_ON:
+                warning_state[i] |= mask;
+                break;
+            case WID_RESET:
+                warning_state[i] &= ~mask;
+                warning_state[i] |= warning_state_init[i] & mask;
+                break;
+            }
+        }
+    }
+
+    return ok;
+}

Файловите разлики са ограничени, защото са твърде много
+ 1023 - 0
nasm/asm/eval.c


+ 49 - 0
nasm/asm/eval.h

@@ -0,0 +1,49 @@
+/* ----------------------------------------------------------------------- *
+ *   
+ *   Copyright 1996-2009 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *     
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/* 
+ * eval.h   header file for eval.c
+ */
+
+#ifndef NASM_EVAL_H
+#define NASM_EVAL_H
+
+/*
+ * The evaluator itself.
+ */
+expr *evaluate(scanner sc, void *scprivate, struct tokenval *tv,
+               int *fwref, int critical, struct eval_hints *hints);
+
+void eval_cleanup(void);
+
+#endif

+ 79 - 0
nasm/asm/exprdump.c

@@ -0,0 +1,79 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 1996-2017 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * exprdump.c
+ *
+ * Debugging code to dump the contents of an expression vector to stdout
+ */
+
+#include "nasm.h"
+
+static const char *expr_type(int32_t type)
+{
+    static char seg_str[64];
+
+    switch (type) {
+    case 0:
+        return "null";
+    case EXPR_UNKNOWN:
+        return "unknown";
+    case EXPR_SIMPLE:
+        return "simple";
+    case EXPR_WRT:
+        return "wrt";
+    case EXPR_RDSAE:
+        return "sae";
+    default:
+        break;
+    }
+
+    if (type >= EXPR_REG_START && type <= EXPR_REG_END) {
+        return nasm_reg_names[type - EXPR_REG_START];
+    } else if (type >= EXPR_SEGBASE) {
+        snprintf(seg_str, sizeof seg_str, "%sseg %d",
+                 (type - EXPR_SEGBASE) == location.segment ? "this " : "",
+                 type - EXPR_SEGBASE);
+        return seg_str;
+    } else {
+        return "ERR";
+    }
+}
+
+void dump_expr(const expr *e)
+{
+    printf("[");
+    for (; e->type; e++)
+        printf("<%s(%d),%"PRId64">", expr_type(e->type), e->type, e->value);
+    printf("]\n");
+}

+ 200 - 0
nasm/asm/exprlib.c

@@ -0,0 +1,200 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 1996-2017 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * exprlib.c
+ *
+ * Library routines to manipulate expression data types.
+ */
+
+#include "nasm.h"
+
+/*
+ * Return true if the argument is a simple scalar. (Or a far-
+ * absolute, which counts.)
+ */
+bool is_simple(const expr *vect)
+{
+    while (vect->type && !vect->value)
+        vect++;
+    if (!vect->type)
+        return true;
+    if (vect->type != EXPR_SIMPLE)
+        return false;
+    do {
+        vect++;
+    } while (vect->type && !vect->value);
+    if (vect->type && vect->type < EXPR_SEGBASE + SEG_ABS)
+        return false;
+    return true;
+}
+
+/*
+ * Return true if the argument is a simple scalar, _NOT_ a far-
+ * absolute.
+ */
+bool is_really_simple(const expr *vect)
+{
+    while (vect->type && !vect->value)
+        vect++;
+    if (!vect->type)
+        return true;
+    if (vect->type != EXPR_SIMPLE)
+        return false;
+    do {
+        vect++;
+    } while (vect->type && !vect->value);
+    if (vect->type)
+        return false;
+    return true;
+}
+
+/*
+ * Return true if the argument is relocatable (i.e. a simple
+ * scalar, plus at most one segment-base, possibly a subtraction
+ * of the current segment base, plus possibly a WRT).
+ */
+bool is_reloc(const expr *vect)
+{
+    bool has_rel = false;       /* Has a self-segment-subtract */
+    bool has_seg = false;       /* Has a segment base */
+
+    for (; vect->type; vect++) {
+        if (!vect->value) {
+            /* skip value-0 terms */
+            continue;
+        } else if (vect->type < EXPR_SIMPLE) {
+            /* false if a register is present */
+            return false;
+        } else if (vect->type == EXPR_SIMPLE) {
+            /* skip over a pure number term... */
+            continue;
+        } else if (vect->type == EXPR_WRT) {
+            /* skip over a WRT term... */
+            continue;
+        } else if (vect->type < EXPR_SEGBASE) {
+            /* other special type -> problem */
+            return false;
+        } else if (vect->value == 1) {
+            if (has_seg)
+                return false;   /* only one segbase allowed */
+            has_seg = true;
+        } else if (vect->value == -1) {
+            if (vect->type != location.segment + EXPR_SEGBASE)
+                return false;   /* can only subtract current segment */
+            if (has_rel)
+                return false;   /* already is relative */
+            has_rel = true;
+        }
+    }
+
+    return true;
+}
+
+/*
+ * Return true if the argument contains an `unknown' part.
+ */
+bool is_unknown(const expr *vect)
+{
+    while (vect->type && vect->type < EXPR_UNKNOWN)
+        vect++;
+    return (vect->type == EXPR_UNKNOWN);
+}
+
+/*
+ * Return true if the argument contains nothing but an `unknown'
+ * part.
+ */
+bool is_just_unknown(const expr *vect)
+{
+    while (vect->type && !vect->value)
+        vect++;
+    return (vect->type == EXPR_UNKNOWN);
+}
+
+/*
+ * Return the scalar part of a relocatable vector. (Including
+ * simple scalar vectors - those qualify as relocatable.)
+ */
+int64_t reloc_value(const expr *vect)
+{
+    while (vect->type && !vect->value)
+        vect++;
+    if (!vect->type)
+        return 0;
+    if (vect->type == EXPR_SIMPLE)
+        return vect->value;
+    else
+        return 0;
+}
+
+/*
+ * Return the segment number of a relocatable vector, or NO_SEG for
+ * simple scalars.
+ */
+int32_t reloc_seg(const expr *vect)
+{
+    for (; vect->type; vect++) {
+        if (vect->type >= EXPR_SEGBASE && vect->value == 1)
+            return vect->type - EXPR_SEGBASE;
+    }
+
+    return NO_SEG;
+}
+
+/*
+ * Return the WRT segment number of a relocatable vector, or NO_SEG
+ * if no WRT part is present.
+ */
+int32_t reloc_wrt(const expr *vect)
+{
+    while (vect->type && vect->type < EXPR_WRT)
+        vect++;
+    if (vect->type == EXPR_WRT) {
+        return vect->value;
+    } else
+        return NO_SEG;
+}
+
+/*
+ * Return true if this expression contains a subtraction of the location
+ */
+bool is_self_relative(const expr *vect)
+{
+    for (; vect->type; vect++) {
+        if (vect->type == location.segment + EXPR_SEGBASE && vect->value == -1)
+            return true;
+    }
+
+    return false;
+}

+ 955 - 0
nasm/asm/float.c

@@ -0,0 +1,955 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 1996-2018 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * float.c     floating-point constant support for the Netwide Assembler
+ */
+
+#include "compiler.h"
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "nasm.h"
+#include "float.h"
+#include "error.h"
+
+/*
+ * -----------------
+ *  local variables
+ * -----------------
+ */
+static bool daz = false;        /* denormals as zero */
+static enum float_round rc = FLOAT_RC_NEAR;     /* rounding control */
+
+/*
+ * -----------
+ *  constants
+ * -----------
+ */
+
+/* "A limb is like a digit but bigger */
+typedef uint32_t fp_limb;
+typedef uint64_t fp_2limb;
+
+#define LIMB_BITS       32
+#define LIMB_BYTES      (LIMB_BITS/8)
+#define LIMB_TOP_BIT    ((fp_limb)1 << (LIMB_BITS-1))
+#define LIMB_MASK       ((fp_limb)(~0))
+#define LIMB_ALL_BYTES  ((fp_limb)0x01010101)
+#define LIMB_BYTE(x)    ((x)*LIMB_ALL_BYTES)
+
+/* 112 bits + 64 bits for accuracy + 16 bits for rounding */
+#define MANT_LIMBS 6
+
+/* 52 digits fit in 176 bits because 10^53 > 2^176 > 10^52 */
+#define MANT_DIGITS 52
+
+/* the format and the argument list depend on MANT_LIMBS */
+#define MANT_FMT "%08x_%08x_%08x_%08x_%08x_%08x"
+#define MANT_ARG SOME_ARG(mant, 0)
+
+#define SOME_ARG(a,i) (a)[(i)+0], (a)[(i)+1], (a)[(i)+2], \
+                      (a)[(i)+3], (a)[(i)+4], (a)[(i)+5]
+
+/*
+ * ---------------------------------------------------------------------------
+ *  emit a printf()-like debug message... but only if DEBUG_FLOAT was defined
+ * ---------------------------------------------------------------------------
+ */
+
+#ifdef DEBUG_FLOAT
+#define dprintf(x) printf x
+#else
+#define dprintf(x) do { } while (0)
+#endif
+
+/*
+ * ---------------------------------------------------------------------------
+ *  multiply
+ * ---------------------------------------------------------------------------
+ */
+static int float_multiply(fp_limb *to, fp_limb *from)
+{
+    fp_2limb temp[MANT_LIMBS * 2];
+    int i, j;
+
+    /*
+     * guaranteed that top bit of 'from' is set -- so we only have
+     * to worry about _one_ bit shift to the left
+     */
+    dprintf(("%s=" MANT_FMT "\n", "mul1", SOME_ARG(to, 0)));
+    dprintf(("%s=" MANT_FMT "\n", "mul2", SOME_ARG(from, 0)));
+
+    memset(temp, 0, sizeof temp);
+
+    for (i = 0; i < MANT_LIMBS; i++) {
+        for (j = 0; j < MANT_LIMBS; j++) {
+            fp_2limb n;
+            n = (fp_2limb) to[i] * (fp_2limb) from[j];
+            temp[i + j] += n >> LIMB_BITS;
+            temp[i + j + 1] += (fp_limb)n;
+        }
+    }
+
+    for (i = MANT_LIMBS * 2; --i;) {
+        temp[i - 1] += temp[i] >> LIMB_BITS;
+        temp[i] &= LIMB_MASK;
+    }
+
+    dprintf(("%s=" MANT_FMT "_" MANT_FMT "\n", "temp", SOME_ARG(temp, 0),
+             SOME_ARG(temp, MANT_LIMBS)));
+
+    if (temp[0] & LIMB_TOP_BIT) {
+        for (i = 0; i < MANT_LIMBS; i++) {
+            to[i] = temp[i] & LIMB_MASK;
+        }
+        dprintf(("%s=" MANT_FMT " (%i)\n", "prod", SOME_ARG(to, 0), 0));
+        return 0;
+    } else {
+        for (i = 0; i < MANT_LIMBS; i++) {
+            to[i] = (temp[i] << 1) + !!(temp[i + 1] & LIMB_TOP_BIT);
+        }
+        dprintf(("%s=" MANT_FMT " (%i)\n", "prod", SOME_ARG(to, 0), -1));
+        return -1;
+    }
+}
+
+/*
+ * ---------------------------------------------------------------------------
+ *  read an exponent; returns INT32_MAX on error
+ * ---------------------------------------------------------------------------
+ */
+static int32_t read_exponent(const char *string, int32_t max)
+{
+    int32_t i = 0;
+    bool neg = false;
+
+    if (*string == '+') {
+        string++;
+    } else if (*string == '-') {
+        neg = true;
+        string++;
+    }
+    while (*string) {
+        if (*string >= '0' && *string <= '9') {
+            i = (i * 10) + (*string - '0');
+
+            /*
+             * To ensure that underflows and overflows are
+             * handled properly we must avoid wraparounds of
+             * the signed integer value that is used to hold
+             * the exponent. Therefore we cap the exponent at
+             * +/-5000, which is slightly more/less than
+             * what's required for normal and denormal numbers
+             * in single, double, and extended precision, but
+             * sufficient to avoid signed integer wraparound.
+             */
+            if (i > max)
+                i = max;
+        } else if (*string == '_') {
+            /* do nothing */
+        } else {
+            nasm_error(ERR_NONFATAL,
+                  "invalid character in floating-point constant %s: '%c'",
+                  "exponent", *string);
+            return INT32_MAX;
+        }
+        string++;
+    }
+
+    return neg ? -i : i;
+}
+
+/*
+ * ---------------------------------------------------------------------------
+ *  convert
+ * ---------------------------------------------------------------------------
+ */
+static bool ieee_flconvert(const char *string, fp_limb *mant,
+                           int32_t * exponent)
+{
+    char digits[MANT_DIGITS];
+    char *p, *q, *r;
+    fp_limb mult[MANT_LIMBS], bit;
+    fp_limb *m;
+    int32_t tenpwr, twopwr;
+    int32_t extratwos;
+    bool started, seendot, warned;
+
+    warned = false;
+    p = digits;
+    tenpwr = 0;
+    started = seendot = false;
+
+    while (*string && *string != 'E' && *string != 'e') {
+        if (*string == '.') {
+            if (!seendot) {
+                seendot = true;
+            } else {
+                nasm_error(ERR_NONFATAL,
+                      "too many periods in floating-point constant");
+                return false;
+            }
+        } else if (*string >= '0' && *string <= '9') {
+            if (*string == '0' && !started) {
+                if (seendot) {
+                    tenpwr--;
+                }
+            } else {
+                started = true;
+                if (p < digits + sizeof(digits)) {
+                    *p++ = *string - '0';
+                } else {
+                    if (!warned) {
+                        nasm_error(ERR_WARNING|WARN_FL_TOOLONG|ERR_PASS2,
+                              "floating-point constant significand contains "
+                              "more than %i digits", MANT_DIGITS);
+                        warned = true;
+                    }
+                }
+                if (!seendot) {
+                    tenpwr++;
+                }
+            }
+        } else if (*string == '_') {
+            /* do nothing */
+        } else {
+            nasm_error(ERR_NONFATAL|ERR_PASS2,
+                  "invalid character in floating-point constant %s: '%c'",
+                  "significand", *string);
+            return false;
+        }
+        string++;
+    }
+
+    if (*string) {
+        int32_t e;
+
+        string++;               /* eat the E */
+        e = read_exponent(string, 5000);
+        if (e == INT32_MAX)
+            return false;
+        tenpwr += e;
+    }
+
+    /*
+     * At this point, the memory interval [digits,p) contains a
+     * series of decimal digits zzzzzzz, such that our number X
+     * satisfies X = 0.zzzzzzz * 10^tenpwr.
+     */
+    q = digits;
+    dprintf(("X = 0."));
+    while (q < p) {
+        dprintf(("%c", *q + '0'));
+        q++;
+    }
+    dprintf((" * 10^%i\n", tenpwr));
+
+    /*
+     * Now convert [digits,p) to our internal representation.
+     */
+    bit = LIMB_TOP_BIT;
+    for (m = mant; m < mant + MANT_LIMBS; m++) {
+        *m = 0;
+    }
+    m = mant;
+    q = digits;
+    started = false;
+    twopwr = 0;
+    while (m < mant + MANT_LIMBS) {
+        fp_limb carry = 0;
+        while (p > q && !p[-1]) {
+            p--;
+        }
+        if (p <= q) {
+            break;
+        }
+        for (r = p; r-- > q;) {
+            int32_t i;
+            i = 2 * *r + carry;
+            if (i >= 10) {
+                carry = 1;
+                i -= 10;
+            } else {
+                carry = 0;
+            }
+            *r = i;
+        }
+        if (carry) {
+            *m |= bit;
+            started = true;
+        }
+        if (started) {
+            if (bit == 1) {
+                bit = LIMB_TOP_BIT;
+                m++;
+            } else {
+                bit >>= 1;
+            }
+        } else {
+            twopwr--;
+        }
+    }
+    twopwr += tenpwr;
+
+    /*
+     * At this point, the 'mant' array contains the first frac-
+     * tional places of a base-2^16 real number which when mul-
+     * tiplied by 2^twopwr and 5^tenpwr gives X.
+     */
+    dprintf(("X = " MANT_FMT " * 2^%i * 5^%i\n", MANT_ARG, twopwr,
+             tenpwr));
+
+    /*
+     * Now multiply 'mant' by 5^tenpwr.
+     */
+    if (tenpwr < 0) {           /* mult = 5^-1 = 0.2 */
+        for (m = mult; m < mult + MANT_LIMBS - 1; m++) {
+            *m = LIMB_BYTE(0xcc);
+        }
+        mult[MANT_LIMBS - 1] = LIMB_BYTE(0xcc)+1;
+        extratwos = -2;
+        tenpwr = -tenpwr;
+
+        /*
+         * If tenpwr was 1000...000b, then it becomes 1000...000b. See
+         * the "ANSI C" comment below for more details on that case.
+         *
+         * Because we already truncated tenpwr to +5000...-5000 inside
+         * the exponent parsing code, this shouldn't happen though.
+         */
+    } else if (tenpwr > 0) {    /* mult = 5^+1 = 5.0 */
+        mult[0] = (fp_limb)5 << (LIMB_BITS-3); /* 0xA000... */
+        for (m = mult + 1; m < mult + MANT_LIMBS; m++) {
+            *m = 0;
+        }
+        extratwos = 3;
+    } else {
+        extratwos = 0;
+    }
+    while (tenpwr) {
+        dprintf(("loop=" MANT_FMT " * 2^%i * 5^%i (%i)\n", MANT_ARG,
+                 twopwr, tenpwr, extratwos));
+        if (tenpwr & 1) {
+            dprintf(("mant*mult\n"));
+            twopwr += extratwos + float_multiply(mant, mult);
+        }
+        dprintf(("mult*mult\n"));
+        extratwos = extratwos * 2 + float_multiply(mult, mult);
+        tenpwr >>= 1;
+
+        /*
+         * In ANSI C, the result of right-shifting a signed integer is
+         * considered implementation-specific. To ensure that the loop
+         * terminates even if tenpwr was 1000...000b to begin with, we
+         * manually clear the MSB, in case a 1 was shifted in.
+         *
+         * Because we already truncated tenpwr to +5000...-5000 inside
+         * the exponent parsing code, this shouldn't matter; neverthe-
+         * less it is the right thing to do here.
+         */
+        tenpwr &= (uint32_t) - 1 >> 1;
+    }
+
+    /*
+     * At this point, the 'mant' array contains the first frac-
+     * tional places of a base-2^16 real number in [0.5,1) that
+     * when multiplied by 2^twopwr gives X. Or it contains zero
+     * of course. We are done.
+     */
+    *exponent = twopwr;
+    return true;
+}
+
+/*
+ * ---------------------------------------------------------------------------
+ *  operations of specific bits
+ * ---------------------------------------------------------------------------
+ */
+
+/* Set a bit, using *bigendian* bit numbering (0 = MSB) */
+static void set_bit(fp_limb *mant, int bit)
+{
+    mant[bit/LIMB_BITS] |= LIMB_TOP_BIT >> (bit & (LIMB_BITS-1));
+}
+
+/* Test a single bit */
+static int test_bit(const fp_limb *mant, int bit)
+{
+    return (mant[bit/LIMB_BITS] >> (~bit & (LIMB_BITS-1))) & 1;
+}
+
+/* Report if the mantissa value is all zero */
+static bool is_zero(const fp_limb *mant)
+{
+    int i;
+
+    for (i = 0; i < MANT_LIMBS; i++)
+        if (mant[i])
+            return false;
+
+    return true;
+}
+
+/*
+ * ---------------------------------------------------------------------------
+ *  round a mantissa off after i words
+ * ---------------------------------------------------------------------------
+ */
+
+#define ROUND_COLLECT_BITS                      \
+    do {                                        \
+        m = mant[i] & (2*bit-1);                \
+        for (j = i+1; j < MANT_LIMBS; j++)      \
+            m = m | mant[j];                    \
+    } while (0)
+
+#define ROUND_ABS_DOWN                          \
+    do {                                        \
+        mant[i] &= ~(bit-1);                    \
+        for (j = i+1; j < MANT_LIMBS; j++)      \
+            mant[j] = 0;                        \
+        return false;                           \
+    } while (0)
+
+#define ROUND_ABS_UP                            \
+    do {                                        \
+        mant[i] = (mant[i] & ~(bit-1)) + bit;   \
+        for (j = i+1; j < MANT_LIMBS; j++)      \
+            mant[j] = 0;                        \
+        while (i > 0 && !mant[i])               \
+            ++mant[--i];                        \
+        return !mant[0];                        \
+    } while (0)
+
+static bool ieee_round(bool minus, fp_limb *mant, int bits)
+{
+    fp_limb m = 0;
+    int32_t j;
+    int i = bits / LIMB_BITS;
+    int p = bits % LIMB_BITS;
+    fp_limb bit = LIMB_TOP_BIT >> p;
+
+    if (rc == FLOAT_RC_NEAR) {
+        if (mant[i] & bit) {
+            mant[i] &= ~bit;
+            ROUND_COLLECT_BITS;
+            mant[i] |= bit;
+            if (m) {
+                ROUND_ABS_UP;
+            } else {
+                if (test_bit(mant, bits-1)) {
+                    ROUND_ABS_UP;
+                } else {
+                    ROUND_ABS_DOWN;
+                }
+            }
+        } else {
+            ROUND_ABS_DOWN;
+        }
+    } else if (rc == FLOAT_RC_ZERO ||
+               rc == (minus ? FLOAT_RC_UP : FLOAT_RC_DOWN)) {
+        ROUND_ABS_DOWN;
+    } else {
+        /* rc == (minus ? FLOAT_RC_DOWN : FLOAT_RC_UP) */
+        /* Round toward +/- infinity */
+        ROUND_COLLECT_BITS;
+        if (m) {
+            ROUND_ABS_UP;
+        } else {
+            ROUND_ABS_DOWN;
+        }
+    }
+    return false;
+}
+
+/* Returns a value >= 16 if not a valid hex digit */
+static unsigned int hexval(char c)
+{
+    unsigned int v = (unsigned char) c;
+
+    if (v >= '0' && v <= '9')
+        return v - '0';
+    else
+        return (v|0x20) - 'a' + 10;
+}
+
+/* Handle floating-point numbers with radix 2^bits and binary exponent */
+static bool ieee_flconvert_bin(const char *string, int bits,
+                               fp_limb *mant, int32_t *exponent)
+{
+    static const int log2tbl[16] =
+        { -1, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3 };
+    fp_limb mult[MANT_LIMBS + 1], *mp;
+    int ms;
+    int32_t twopwr;
+    bool seendot, seendigit;
+    unsigned char c;
+    const int radix = 1 << bits;
+    fp_limb v;
+
+    twopwr = 0;
+    seendot = seendigit = false;
+    ms = 0;
+    mp = NULL;
+
+    memset(mult, 0, sizeof mult);
+
+    while ((c = *string++) != '\0') {
+        if (c == '.') {
+            if (!seendot)
+                seendot = true;
+            else {
+                nasm_error(ERR_NONFATAL,
+                      "too many periods in floating-point constant");
+                return false;
+            }
+        } else if ((v = hexval(c)) < (unsigned int)radix) {
+            if (!seendigit && v) {
+                int l = log2tbl[v];
+
+                seendigit = true;
+                mp = mult;
+                ms = (LIMB_BITS-1)-l;
+
+                twopwr += l+1-bits;
+            }
+
+            if (seendigit) {
+                if (ms < 0) {
+                    /* Cast to fp_2limb as ms == -LIMB_BITS is possible. */
+                    *mp |= (fp_2limb)v >> -ms;
+                    mp++;
+                    if (mp > &mult[MANT_LIMBS])
+                        mp = &mult[MANT_LIMBS]; /* Guard slot */
+                    ms += LIMB_BITS;
+                }
+                *mp |= v << ms;
+                ms -= bits;
+
+                if (!seendot)
+                    twopwr += bits;
+            } else {
+                if (seendot)
+                    twopwr -= bits;
+            }
+        } else if (c == 'p' || c == 'P') {
+            int32_t e;
+            e = read_exponent(string, 20000);
+            if (e == INT32_MAX)
+                return false;
+            twopwr += e;
+            break;
+        } else if (c == '_') {
+            /* ignore */
+        } else {
+            nasm_error(ERR_NONFATAL,
+                  "floating-point constant: `%c' is invalid character", c);
+            return false;
+        }
+    }
+
+    if (!seendigit) {
+        memset(mant, 0, MANT_LIMBS*sizeof(fp_limb)); /* Zero */
+        *exponent = 0;
+    } else {
+        memcpy(mant, mult, MANT_LIMBS*sizeof(fp_limb));
+        *exponent = twopwr;
+    }
+
+    return true;
+}
+
+/*
+ * Shift a mantissa to the right by i bits.
+ */
+static void ieee_shr(fp_limb *mant, int i)
+{
+    fp_limb n, m;
+    int j = 0;
+    int sr, sl, offs;
+
+    sr = i % LIMB_BITS; sl = LIMB_BITS-sr;
+    offs = i/LIMB_BITS;
+
+    if (sr == 0) {
+        if (offs)
+            for (j = MANT_LIMBS-1; j >= offs; j--)
+                mant[j] = mant[j-offs];
+    } else if (MANT_LIMBS-1-offs < 0) {
+        j = MANT_LIMBS-1;
+    } else {
+        n = mant[MANT_LIMBS-1-offs] >> sr;
+        for (j = MANT_LIMBS-1; j > offs; j--) {
+            m = mant[j-offs-1];
+            mant[j] = (m << sl) | n;
+            n = m >> sr;
+        }
+        mant[j--] = n;
+    }
+    while (j >= 0)
+        mant[j--] = 0;
+}
+
+/* Produce standard IEEE formats, with implicit or explicit integer
+   bit; this makes the following assumptions:
+
+   - the sign bit is the MSB, followed by the exponent,
+     followed by the integer bit if present.
+   - the sign bit plus exponent fit in 16 bits.
+   - the exponent bias is 2^(n-1)-1 for an n-bit exponent */
+
+struct ieee_format {
+    int bytes;
+    int mantissa;               /* Fractional bits in the mantissa */
+    int explicit;               /* Explicit integer */
+    int exponent;               /* Bits in the exponent */
+};
+
+/*
+ * The 16- and 128-bit formats are expected to be in IEEE 754r.
+ * AMD SSE5 uses the 16-bit format.
+ *
+ * The 32- and 64-bit formats are the original IEEE 754 formats.
+ *
+ * The 80-bit format is x87-specific, but widely used.
+ *
+ * The 8-bit format appears to be the consensus 8-bit floating-point
+ * format.  It is apparently used in graphics applications.
+ */
+static const struct ieee_format ieee_8   = {  1,   3, 0,  4 };
+static const struct ieee_format ieee_16  = {  2,  10, 0,  5 };
+static const struct ieee_format ieee_32  = {  4,  23, 0,  8 };
+static const struct ieee_format ieee_64  = {  8,  52, 0, 11 };
+static const struct ieee_format ieee_80  = { 10,  63, 1, 15 };
+static const struct ieee_format ieee_128 = { 16, 112, 0, 15 };
+
+/* Types of values we can generate */
+enum floats {
+    FL_ZERO,
+    FL_DENORMAL,
+    FL_NORMAL,
+    FL_INFINITY,
+    FL_QNAN,
+    FL_SNAN
+};
+
+static int to_packed_bcd(const char *str, const char *p,
+                         int s, uint8_t *result,
+                         const struct ieee_format *fmt)
+{
+    int n = 0;
+    char c;
+    int tv = -1;
+
+    if (fmt != &ieee_80) {
+        nasm_error(ERR_NONFATAL,
+              "packed BCD requires an 80-bit format");
+        return 0;
+    }
+
+    while (p >= str) {
+        c = *p--;
+        if (c >= '0' && c <= '9') {
+            if (tv < 0) {
+                if (n == 9) {
+                    nasm_error(ERR_WARNING|ERR_PASS2,
+                          "packed BCD truncated to 18 digits");
+                }
+                tv = c-'0';
+            } else {
+                if (n < 9)
+                    *result++ = tv + ((c-'0') << 4);
+                n++;
+                tv = -1;
+            }
+        } else if (c == '_') {
+            /* do nothing */
+        } else {
+            nasm_error(ERR_NONFATAL,
+                  "invalid character `%c' in packed BCD constant", c);
+            return 0;
+        }
+    }
+    if (tv >= 0) {
+        if (n < 9)
+            *result++ = tv;
+        n++;
+    }
+    while (n < 9) {
+        *result++ = 0;
+        n++;
+    }
+    *result = (s < 0) ? 0x80 : 0;
+
+    return 1;                   /* success */
+}
+
+static int to_float(const char *str, int s, uint8_t *result,
+                    const struct ieee_format *fmt)
+{
+    fp_limb mant[MANT_LIMBS];
+    int32_t exponent = 0;
+    const int32_t expmax = 1 << (fmt->exponent - 1);
+    fp_limb one_mask = LIMB_TOP_BIT >>
+        ((fmt->exponent+fmt->explicit) % LIMB_BITS);
+    const int one_pos = (fmt->exponent+fmt->explicit)/LIMB_BITS;
+    int i;
+    int shift;
+    enum floats type;
+    bool ok;
+    const bool minus = s < 0;
+    const int bits = fmt->bytes * 8;
+    const char *strend;
+
+    if (!str[0]) {
+        nasm_panic(0,
+              "internal errror: empty string passed to float_const");
+        return 0;
+    }
+
+    strend = strchr(str, '\0');
+    if (strend[-1] == 'P' || strend[-1] == 'p')
+        return to_packed_bcd(str, strend-2, s, result, fmt);
+
+    if (str[0] == '_') {
+        /* Special tokens */
+
+        switch (str[2]) {
+        case 'n':              /* __nan__ */
+        case 'N':
+        case 'q':              /* __qnan__ */
+        case 'Q':
+            type = FL_QNAN;
+            break;
+        case 's':              /* __snan__ */
+        case 'S':
+            type = FL_SNAN;
+            break;
+        case 'i':              /* __infinity__ */
+        case 'I':
+            type = FL_INFINITY;
+            break;
+        default:
+            nasm_error(ERR_NONFATAL,
+                  "internal error: unknown FP constant token `%s'\n", str);
+            type = FL_QNAN;
+            break;
+        }
+    } else {
+        if (str[0] == '0') {
+            switch (str[1]) {
+            case 'x': case 'X':
+            case 'h': case 'H':
+                ok = ieee_flconvert_bin(str+2, 4, mant, &exponent);
+                break;
+            case 'o': case 'O':
+            case 'q': case 'Q':
+                ok = ieee_flconvert_bin(str+2, 3, mant, &exponent);
+                break;
+            case 'b': case 'B':
+            case 'y': case 'Y':
+                ok = ieee_flconvert_bin(str+2, 1, mant, &exponent);
+                break;
+            case 'd': case 'D':
+            case 't': case 'T':
+                ok = ieee_flconvert(str+2, mant, &exponent);
+                break;
+            case 'p': case 'P':
+                return to_packed_bcd(str+2, strend-1, s, result, fmt);
+            default:
+                /* Leading zero was just a zero? */
+                ok = ieee_flconvert(str, mant, &exponent);
+                break;
+            }
+        } else if (str[0] == '$') {
+            ok = ieee_flconvert_bin(str+1, 4, mant, &exponent);
+        } else {
+            ok = ieee_flconvert(str, mant, &exponent);
+        }
+
+        if (!ok) {
+            type = FL_QNAN;
+        } else if (mant[0] & LIMB_TOP_BIT) {
+            /*
+             * Non-zero.
+             */
+            exponent--;
+            if (exponent >= 2 - expmax && exponent <= expmax) {
+                type = FL_NORMAL;
+            } else if (exponent > 0) {
+                if (pass0 == 1)
+                    nasm_error(ERR_WARNING|WARN_FL_OVERFLOW|ERR_PASS2,
+                          "overflow in floating-point constant");
+                type = FL_INFINITY;
+            } else {
+                /* underflow or denormal; the denormal code handles
+                   actual underflow. */
+                type = FL_DENORMAL;
+            }
+        } else {
+            /* Zero */
+            type = FL_ZERO;
+        }
+    }
+
+    switch (type) {
+    case FL_ZERO:
+    zero:
+        memset(mant, 0, sizeof mant);
+        break;
+
+    case FL_DENORMAL:
+    {
+        shift = -(exponent + expmax - 2 - fmt->exponent)
+            + fmt->explicit;
+        ieee_shr(mant, shift);
+        ieee_round(minus, mant, bits);
+        if (mant[one_pos] & one_mask) {
+            /* One's position is set, we rounded up into normal range */
+            exponent = 1;
+            if (!fmt->explicit)
+                mant[one_pos] &= ~one_mask;     /* remove explicit one */
+            mant[0] |= exponent << (LIMB_BITS-1 - fmt->exponent);
+        } else {
+            if (daz || is_zero(mant)) {
+                /* Flush denormals to zero */
+                nasm_error(ERR_WARNING|WARN_FL_UNDERFLOW|ERR_PASS2,
+                      "underflow in floating-point constant");
+                goto zero;
+            } else {
+                nasm_error(ERR_WARNING|WARN_FL_DENORM|ERR_PASS2,
+                      "denormal floating-point constant");
+            }
+        }
+        break;
+    }
+
+    case FL_NORMAL:
+        exponent += expmax - 1;
+        ieee_shr(mant, fmt->exponent+fmt->explicit);
+        ieee_round(minus, mant, bits);
+        /* did we scale up by one? */
+        if (test_bit(mant, fmt->exponent+fmt->explicit-1)) {
+            ieee_shr(mant, 1);
+            exponent++;
+            if (exponent >= (expmax << 1)-1) {
+                    nasm_error(ERR_WARNING|WARN_FL_OVERFLOW|ERR_PASS2,
+                          "overflow in floating-point constant");
+                type = FL_INFINITY;
+                goto overflow;
+            }
+        }
+
+        if (!fmt->explicit)
+            mant[one_pos] &= ~one_mask; /* remove explicit one */
+        mant[0] |= exponent << (LIMB_BITS-1 - fmt->exponent);
+        break;
+
+    case FL_INFINITY:
+    case FL_QNAN:
+    case FL_SNAN:
+    overflow:
+        memset(mant, 0, sizeof mant);
+        mant[0] = (((fp_limb)1 << fmt->exponent)-1)
+            << (LIMB_BITS-1 - fmt->exponent);
+        if (fmt->explicit)
+            mant[one_pos] |= one_mask;
+        if (type == FL_QNAN)
+            set_bit(mant, fmt->exponent+fmt->explicit+1);
+        else if (type == FL_SNAN)
+            set_bit(mant, fmt->exponent+fmt->explicit+fmt->mantissa);
+        break;
+    }
+
+    mant[0] |= minus ? LIMB_TOP_BIT : 0;
+
+    for (i = fmt->bytes - 1; i >= 0; i--)
+        *result++ = mant[i/LIMB_BYTES] >> (((LIMB_BYTES-1)-(i%LIMB_BYTES))*8);
+
+    return 1;                   /* success */
+}
+
+int float_const(const char *number, int sign, uint8_t *result, int bytes)
+{
+    switch (bytes) {
+    case 1:
+        return to_float(number, sign, result, &ieee_8);
+    case 2:
+        return to_float(number, sign, result, &ieee_16);
+    case 4:
+        return to_float(number, sign, result, &ieee_32);
+    case 8:
+        return to_float(number, sign, result, &ieee_64);
+    case 10:
+        return to_float(number, sign, result, &ieee_80);
+    case 16:
+        return to_float(number, sign, result, &ieee_128);
+    default:
+        nasm_panic(0, "strange value %d passed to float_const", bytes);
+        return 0;
+    }
+}
+
+/* Set floating-point options */
+int float_option(const char *option)
+{
+    if (!nasm_stricmp(option, "daz")) {
+        daz = true;
+        return 0;
+    } else if (!nasm_stricmp(option, "nodaz")) {
+        daz = false;
+        return 0;
+    } else if (!nasm_stricmp(option, "near")) {
+        rc = FLOAT_RC_NEAR;
+        return 0;
+    } else if (!nasm_stricmp(option, "down")) {
+        rc = FLOAT_RC_DOWN;
+        return 0;
+    } else if (!nasm_stricmp(option, "up")) {
+        rc = FLOAT_RC_UP;
+        return 0;
+    } else if (!nasm_stricmp(option, "zero")) {
+        rc = FLOAT_RC_ZERO;
+        return 0;
+    } else if (!nasm_stricmp(option, "default")) {
+        rc = FLOAT_RC_NEAR;
+        daz = false;
+        return 0;
+    } else {
+        return -1;              /* Unknown option */
+    }
+}

+ 54 - 0
nasm/asm/float.h

@@ -0,0 +1,54 @@
+/* ----------------------------------------------------------------------- *
+ *   
+ *   Copyright 1996-2009 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *     
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/* 
+ * float.h   header file for the floating-point constant module of
+ *	     the Netwide Assembler
+ */
+
+#ifndef NASM_FLOAT_H
+#define NASM_FLOAT_H
+
+#include "nasm.h"
+
+enum float_round {
+    FLOAT_RC_NEAR,
+    FLOAT_RC_ZERO,
+    FLOAT_RC_DOWN,
+    FLOAT_RC_UP
+};
+
+int float_const(const char *string, int sign, uint8_t *result, int bytes);
+int float_option(const char *option);
+
+#endif

+ 703 - 0
nasm/asm/labels.c

@@ -0,0 +1,703 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 1996-2018 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * labels.c  label handling for the Netwide Assembler
+ */
+
+#include "compiler.h"
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "nasm.h"
+#include "nasmlib.h"
+#include "error.h"
+#include "hashtbl.h"
+#include "labels.h"
+
+/*
+ * A dot-local label is one that begins with exactly one period. Things
+ * that begin with _two_ periods are NASM-specific things.
+ *
+ * If TASM compatibility is enabled, a local label can also begin with
+ * @@.
+ */
+static bool islocal(const char *l)
+{
+    if (tasm_compatible_mode) {
+        if (l[0] == '@' && l[1] == '@')
+            return true;
+    }
+
+    return (l[0] == '.' && l[1] != '.');
+}
+
+/*
+ * Return true if this falls into NASM's '..' namespace
+ */
+static bool ismagic(const char *l)
+{
+    return l[0] == '.' && l[1] == '.' && l[2] != '@';
+}
+
+/*
+ * Return true if we should update the local label base
+ * as a result of this symbol.  We must exclude local labels
+ * as well as any kind of special labels, including ..@ ones.
+ */
+static bool set_prevlabel(const char *l)
+{
+    if (tasm_compatible_mode) {
+        if (l[0] == '@' && l[1] == '@')
+            return false;
+    }
+
+    return l[0] != '.';
+}
+
+#define LABEL_BLOCK     128     /* no. of labels/block */
+#define LBLK_SIZE       (LABEL_BLOCK * sizeof(union label))
+
+#define END_LIST        -3      /* don't clash with NO_SEG! */
+#define END_BLOCK       -2
+
+#define PERMTS_SIZE     16384   /* size of text blocks */
+#if (PERMTS_SIZE < IDLEN_MAX)
+ #error "IPERMTS_SIZE must be greater than or equal to IDLEN_MAX"
+#endif
+
+/* string values for enum label_type */
+static const char * const types[] =
+{"local", "global", "static", "extern", "common", "special",
+ "output format special"};
+
+union label {                   /* actual label structures */
+    struct {
+        int32_t segment;
+        int32_t subsection;     /* Available for ofmt->herelabel() */
+        int64_t offset;
+        int64_t size;
+        int64_t defined;        /* 0 if undefined, passn+1 for when defn seen */
+        char *label, *mangled, *special;
+        const char *def_file;   /* Where defined */
+        int32_t def_line;
+        enum label_type type, mangled_type;
+    } defn;
+    struct {
+        int32_t movingon;
+        int64_t dummy;
+        union label *next;
+    } admin;
+};
+
+struct permts {                 /* permanent text storage */
+    struct permts *next;        /* for the linked list */
+    unsigned int size, usage;   /* size and used space in ... */
+    char data[PERMTS_SIZE];     /* ... the data block itself */
+};
+#define PERMTS_HEADER offsetof(struct permts, data)
+
+uint64_t global_offset_changed;		/* counter for global offset changes */
+
+static struct hash_table ltab;          /* labels hash table */
+static union label *ldata;              /* all label data blocks */
+static union label *lfree;              /* labels free block */
+static struct permts *perm_head;        /* start of perm. text storage */
+static struct permts *perm_tail;        /* end of perm. text storage */
+
+static void init_block(union label *blk);
+static char *perm_alloc(size_t len);
+static char *perm_copy(const char *string);
+static char *perm_copy3(const char *s1, const char *s2, const char *s3);
+static const char *mangle_label_name(union label *lptr);
+
+static const char *prevlabel;
+
+static bool initialized = false;
+
+/*
+ * Emit a symdef to the output and the debug format backends.
+ */
+static void out_symdef(union label *lptr)
+{
+    int backend_type;
+    int64_t backend_offset;
+
+    /* Backend-defined special segments are passed to symdef immediately */
+    if (pass0 == 2) {
+        /* Emit special fixups for globals and commons */
+        switch (lptr->defn.type) {
+        case LBL_GLOBAL:
+        case LBL_EXTERN:
+        case LBL_COMMON:
+            if (lptr->defn.special)
+                ofmt->symdef(lptr->defn.mangled, 0, 0, 3, lptr->defn.special);
+            break;
+        default:
+            break;
+        }
+        return;
+    }
+
+    if (pass0 != 1 && lptr->defn.type != LBL_BACKEND)
+        return;
+
+    /* Clean up this hack... */
+    switch(lptr->defn.type) {
+    case LBL_GLOBAL:
+    case LBL_EXTERN:
+        backend_type = 1;
+        backend_offset = lptr->defn.offset;
+        break;
+    case LBL_COMMON:
+        backend_type = 2;
+        backend_offset = lptr->defn.size;
+        break;
+    default:
+        backend_type = 0;
+        backend_offset = lptr->defn.offset;
+        break;
+    }
+
+    /* Might be necessary for a backend symbol */
+    mangle_label_name(lptr);
+
+    ofmt->symdef(lptr->defn.mangled, lptr->defn.segment,
+                 backend_offset, backend_type,
+                 lptr->defn.special);
+
+    /*
+     * NASM special symbols are not passed to the debug format; none
+     * of the current backends want to see them.
+     */
+    if (lptr->defn.type == LBL_SPECIAL || lptr->defn.type == LBL_BACKEND)
+        return;
+
+    dfmt->debug_deflabel(lptr->defn.mangled, lptr->defn.segment,
+                         lptr->defn.offset, backend_type,
+                         lptr->defn.special);
+}
+
+/*
+ * Internal routine: finds the `union label' corresponding to the
+ * given label name. Creates a new one, if it isn't found, and if
+ * `create' is true.
+ */
+static union label *find_label(const char *label, bool create, bool *created)
+{
+    union label *lptr, **lpp;
+    char *label_str = NULL;
+    struct hash_insert ip;
+
+    nasm_assert(label != NULL);
+
+    if (islocal(label))
+        label = label_str = nasm_strcat(prevlabel, label);
+
+    lpp = (union label **) hash_find(&ltab, label, &ip);
+    lptr = lpp ? *lpp : NULL;
+
+    if (lptr || !create) {
+        if (created)
+            *created = false;
+        return lptr;
+    }
+
+    /* Create a new label... */
+    if (lfree->admin.movingon == END_BLOCK) {
+        /*
+         * must allocate a new block
+         */
+        lfree->admin.next = nasm_malloc(LBLK_SIZE);
+        lfree = lfree->admin.next;
+        init_block(lfree);
+    }
+
+    if (created)
+        *created = true;
+
+    nasm_zero(*lfree);
+    lfree->defn.label     = perm_copy(label);
+    lfree->defn.subsection = NO_SEG;
+    if (label_str)
+        nasm_free(label_str);
+
+    hash_add(&ip, lfree->defn.label, lfree);
+    return lfree++;
+}
+
+bool lookup_label(const char *label, int32_t *segment, int64_t *offset)
+{
+    union label *lptr;
+
+    if (!initialized)
+        return false;
+
+    lptr = find_label(label, false, NULL);
+    if (lptr && lptr->defn.defined) {
+        *segment = lptr->defn.segment;
+        *offset = lptr->defn.offset;
+        return true;
+    }
+
+    return false;
+}
+
+bool is_extern(const char *label)
+{
+    union label *lptr;
+
+    if (!initialized)
+        return false;
+
+    lptr = find_label(label, false, NULL);
+    return lptr && lptr->defn.type == LBL_EXTERN;
+}
+
+static const char *mangle_strings[] = {"", "", "", ""};
+static bool mangle_string_set[ARRAY_SIZE(mangle_strings)];
+
+/*
+ * Set a prefix or suffix
+ */
+void set_label_mangle(enum mangle_index which, const char *what)
+{
+    if (mangle_string_set[which])
+        return;                 /* Once set, do not change */
+
+    mangle_strings[which] = perm_copy(what);
+    mangle_string_set[which] = true;
+}
+
+/*
+ * Format a label name with appropriate prefixes and suffixes
+ */
+static const char *mangle_label_name(union label *lptr)
+{
+    const char *prefix;
+    const char *suffix;
+
+    if (likely(lptr->defn.mangled &&
+               lptr->defn.mangled_type == lptr->defn.type))
+        return lptr->defn.mangled; /* Already mangled */
+
+    switch (lptr->defn.type) {
+    case LBL_GLOBAL:
+    case LBL_STATIC:
+    case LBL_EXTERN:
+        prefix = mangle_strings[LM_GPREFIX];
+        suffix = mangle_strings[LM_GSUFFIX];
+        break;
+    case LBL_BACKEND:
+    case LBL_SPECIAL:
+        prefix = suffix = "";
+        break;
+    default:
+        prefix = mangle_strings[LM_LPREFIX];
+        suffix = mangle_strings[LM_LSUFFIX];
+        break;
+    }
+
+    lptr->defn.mangled_type = lptr->defn.type;
+
+    if (!(*prefix) && !(*suffix))
+        lptr->defn.mangled = lptr->defn.label;
+    else
+        lptr->defn.mangled = perm_copy3(prefix, lptr->defn.label, suffix);
+
+    return lptr->defn.mangled;
+}
+
+static void
+handle_herelabel(union label *lptr, int32_t *segment, int64_t *offset)
+{
+    int32_t oldseg;
+
+    if (likely(!ofmt->herelabel))
+        return;
+
+    if (unlikely(location.segment == NO_SEG))
+        return;
+
+    oldseg = *segment;
+
+    if (oldseg == location.segment && *offset == location.offset) {
+        /* This label is defined at this location */
+        int32_t newseg;
+        bool copyoffset = false;
+
+        nasm_assert(lptr->defn.mangled);
+        newseg = ofmt->herelabel(lptr->defn.mangled, lptr->defn.type,
+                                 oldseg, &lptr->defn.subsection, &copyoffset);
+        if (likely(newseg == oldseg))
+            return;
+
+        *segment = newseg;
+        if (copyoffset) {
+            /* Maintain the offset from the old to the new segment */
+            switch_segment(newseg);
+            location.offset = *offset;
+        } else {
+            /* Keep a separate offset for the new segment */
+            *offset = switch_segment(newseg);
+        }
+    }
+}
+
+static bool declare_label_lptr(union label *lptr,
+                               enum label_type type, const char *special)
+{
+    if (special && !special[0])
+        special = NULL;
+
+    if (lptr->defn.type == type ||
+        (pass0 == 0 && lptr->defn.type == LBL_LOCAL)) {
+        lptr->defn.type = type;
+        if (special) {
+            if (!lptr->defn.special)
+                lptr->defn.special = perm_copy(special);
+            else if (nasm_stricmp(lptr->defn.special, special))
+                nasm_error(ERR_NONFATAL,
+                           "symbol `%s' has inconsistent attributes `%s' and `%s'",
+                           lptr->defn.label, lptr->defn.special, special);
+        }
+        return true;
+    }
+
+    /* EXTERN can be replaced with GLOBAL or COMMON */
+    if (lptr->defn.type == LBL_EXTERN &&
+        (type == LBL_GLOBAL || type == LBL_COMMON)) {
+        lptr->defn.type = type;
+        /* Override special unconditionally */
+        if (special)
+            lptr->defn.special = perm_copy(special);
+        return true;
+    }
+
+    /* GLOBAL or COMMON ignore subsequent EXTERN */
+    if ((lptr->defn.type == LBL_GLOBAL || lptr->defn.type == LBL_COMMON) &&
+        type == LBL_EXTERN) {
+        if (!lptr->defn.special)
+            lptr->defn.special = perm_copy(special);
+        return false;           /* Don't call define_label() after this! */
+    }
+
+    nasm_error(ERR_NONFATAL, "symbol `%s' declared both as %s and %s",
+               lptr->defn.label, types[lptr->defn.type], types[type]);
+
+    return false;
+}
+
+bool declare_label(const char *label, enum label_type type, const char *special)
+{
+    union label *lptr = find_label(label, true, NULL);
+    return declare_label_lptr(lptr, type, special);
+}
+
+/*
+ * The "normal" argument decides if we should update the local segment
+ * base name or not.
+ */
+void define_label(const char *label, int32_t segment,
+                  int64_t offset, bool normal)
+{
+    union label *lptr;
+    bool created, changed;
+    int64_t size;
+    int64_t lastdef;
+
+    /*
+     * The backend may invoke this before pass 1, so treat that as
+     * a special "pass".
+     */
+    const int64_t lpass = passn + 1;
+
+    /*
+     * Phase errors here can be one of two types: a new label appears,
+     * or the offset changes. Increment global_offset_changed when that
+     * happens, to tell the assembler core to make another pass.
+     */
+    lptr = find_label(label, true, &created);
+
+    lastdef = lptr->defn.defined;
+
+    if (segment) {
+        /* We are actually defining this label */
+        if (lptr->defn.type == LBL_EXTERN) {
+            /* auto-promote EXTERN to GLOBAL */
+            lptr->defn.type = LBL_GLOBAL;
+            lastdef = 0; /* We are "re-creating" this label */
+        }
+    } else {
+        /* It's a pseudo-segment (extern, common) */
+        segment = lptr->defn.segment ? lptr->defn.segment : seg_alloc();
+    }
+
+    if (lastdef || lptr->defn.type == LBL_BACKEND) {
+        /*
+         * We have seen this on at least one previous pass, or
+         * potentially earlier in this same pass (in which case we
+         * will probably error out further down.)
+         */
+        mangle_label_name(lptr);
+        handle_herelabel(lptr, &segment, &offset);
+    }
+
+    if (ismagic(label) && lptr->defn.type == LBL_LOCAL)
+        lptr->defn.type = LBL_SPECIAL;
+
+    if (set_prevlabel(label) && normal)
+        prevlabel = lptr->defn.label;
+
+    if (lptr->defn.type == LBL_COMMON) {
+        size = offset;
+        offset = 0;
+    } else {
+        size = 0;               /* This is a hack... */
+    }
+
+    changed = created || !lastdef ||
+        lptr->defn.segment != segment ||
+        lptr->defn.offset != offset ||
+        lptr->defn.size != size;
+    global_offset_changed += changed;
+
+    if (lastdef == lpass) {
+        int32_t saved_line = 0;
+        const char *saved_fname = NULL;
+        int noteflags;
+
+        /*
+         * Defined elsewhere in the program, seen in this pass.
+         */
+        if (changed) {
+            nasm_error(ERR_NONFATAL,
+                       "label `%s' inconsistently redefined",
+                       lptr->defn.label);
+            noteflags = ERR_NOTE|ERR_HERE;
+        } else {
+            nasm_error(ERR_WARNING|WARN_LABEL_REDEF|ERR_PASS2,
+                       "label `%s' redefined to an identical value",
+                       lptr->defn.label);
+            noteflags = ERR_NOTE|ERR_HERE|WARN_LABEL_REDEF|ERR_PASS2;
+        }
+
+        src_get(&saved_line, &saved_fname);
+        src_set(lptr->defn.def_line, lptr->defn.def_file);
+        nasm_error(noteflags, "label `%s' originally defined",
+                   lptr->defn.label);
+        src_set(saved_line, saved_fname);
+    } else if (changed && pass0 > 1 && lptr->defn.type != LBL_SPECIAL) {
+        /*
+         * WARN_LABEL_LATE defaults to an error, as this should never
+         * actually happen.  Just in case this is a backwards
+         * compatibility problem, still make it a warning so that the
+         * user can suppress or demote it.
+         *
+         * As a special case, LBL_SPECIAL symbols are allowed to be changed
+         * even during the last pass.
+         */
+        nasm_error(ERR_WARNING|WARN_LABEL_LATE,
+                   "label `%s' %s during code generation",
+                   lptr->defn.label, created ? "defined" : "changed");
+    }
+    lptr->defn.segment = segment;
+    lptr->defn.offset  = offset;
+    lptr->defn.size    = size;
+    lptr->defn.defined = lpass;
+
+    if (changed || lastdef != lpass)
+        src_get(&lptr->defn.def_line, &lptr->defn.def_file);
+
+    if (lastdef != lpass)
+        out_symdef(lptr);
+}
+
+/*
+ * Define a special backend label
+ */
+void backend_label(const char *label, int32_t segment, int64_t offset)
+{
+    if (!declare_label(label, LBL_BACKEND, NULL))
+        return;
+
+    define_label(label, segment, offset, false);
+}
+
+int init_labels(void)
+{
+    hash_init(&ltab, HASH_LARGE);
+
+    ldata = lfree = nasm_malloc(LBLK_SIZE);
+    init_block(lfree);
+
+    perm_head = perm_tail =
+        nasm_malloc(sizeof(struct permts));
+
+    perm_head->next = NULL;
+    perm_head->size = PERMTS_SIZE;
+    perm_head->usage = 0;
+
+    prevlabel = "";
+
+    initialized = true;
+
+    return 0;
+}
+
+void cleanup_labels(void)
+{
+    union label *lptr, *lhold;
+
+    initialized = false;
+
+    hash_free(&ltab);
+
+    lptr = lhold = ldata;
+    while (lptr) {
+        lptr = &lptr[LABEL_BLOCK-1];
+        lptr = lptr->admin.next;
+        nasm_free(lhold);
+        lhold = lptr;
+    }
+
+    while (perm_head) {
+        perm_tail = perm_head;
+        perm_head = perm_head->next;
+        nasm_free(perm_tail);
+    }
+}
+
+static void init_block(union label *blk)
+{
+    int j;
+
+    for (j = 0; j < LABEL_BLOCK - 1; j++)
+        blk[j].admin.movingon = END_LIST;
+    blk[LABEL_BLOCK - 1].admin.movingon = END_BLOCK;
+    blk[LABEL_BLOCK - 1].admin.next = NULL;
+}
+
+static char * safe_alloc perm_alloc(size_t len)
+{
+    char *p;
+
+    if (perm_tail->size - perm_tail->usage < len) {
+        size_t alloc_len = (len > PERMTS_SIZE) ? len : PERMTS_SIZE;
+        perm_tail->next = nasm_malloc(PERMTS_HEADER + alloc_len);
+        perm_tail = perm_tail->next;
+        perm_tail->next = NULL;
+        perm_tail->size = alloc_len;
+        perm_tail->usage = 0;
+    }
+    p = perm_tail->data + perm_tail->usage;
+    perm_tail->usage += len;
+    return p;
+}
+
+static char *perm_copy(const char *string)
+{
+    char *p;
+    size_t len;
+
+    if (!string)
+        return NULL;
+
+    len = strlen(string)+1; /* Include final NUL */
+
+    p = perm_alloc(len);
+    memcpy(p, string, len);
+
+    return p;
+}
+
+static char *
+perm_copy3(const char *s1, const char *s2, const char *s3)
+{
+    char *p;
+    size_t l1 = strlen(s1);
+    size_t l2 = strlen(s2);
+    size_t l3 = strlen(s3)+1;   /* Include final NUL */
+
+    p = perm_alloc(l1+l2+l3);
+    memcpy(p, s1, l1);
+    memcpy(p+l1, s2, l2);
+    memcpy(p+l1+l2, s3, l3);
+
+    return p;
+}
+
+const char *local_scope(const char *label)
+{
+   return islocal(label) ? prevlabel : "";
+}
+
+/*
+ * Notes regarding bug involving redefinition of external segments.
+ *
+ * Up to and including v0.97, the following code didn't work. From 0.97
+ * developers release 2 onwards, it will generate an error.
+ *
+ * EXTERN extlabel
+ * newlabel EQU extlabel + 1
+ *
+ * The results of allowing this code through are that two import records
+ * are generated, one for 'extlabel' and one for 'newlabel'.
+ *
+ * The reason for this is an inadequacy in the defined interface between
+ * the label manager and the output formats. The problem lies in how the
+ * output format driver tells that a label is an external label for which
+ * a label import record must be produced. Most (all except bin?) produce
+ * the record if the segment number of the label is not one of the internal
+ * segments that the output driver is producing.
+ *
+ * A simple fix to this would be to make the output formats keep track of
+ * which symbols they've produced import records for, and make them not
+ * produce import records for segments that are already defined.
+ *
+ * The best way, which is slightly harder but reduces duplication of code
+ * and should therefore make the entire system smaller and more stable is
+ * to change the interface between assembler, define_label(), and
+ * the output module. The changes that are needed are:
+ *
+ * The semantics of the 'isextern' flag passed to define_label() need
+ * examining. This information may or may not tell us what we need to
+ * know (ie should we be generating an import record at this point for this
+ * label). If these aren't the semantics, the semantics should be changed
+ * to this.
+ *
+ * The output module interface needs changing, so that the `isextern' flag
+ * is passed to the module, so that it can be easily tested for.
+ */

+ 379 - 0
nasm/asm/listing.c

@@ -0,0 +1,379 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 1996-2018 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * listing.c    listing file generator for the Netwide Assembler
+ */
+
+#include "compiler.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "nasm.h"
+#include "nasmlib.h"
+#include "error.h"
+#include "listing.h"
+
+#define LIST_MAX_LEN 256       /* something sensible */
+#define LIST_INDENT  40
+#define LIST_HEXBIT  18
+
+typedef struct MacroInhibit MacroInhibit;
+
+static struct MacroInhibit {
+    MacroInhibit *next;
+    int level;
+    int inhibiting;
+} *mistack;
+
+static char xdigit[] = "0123456789ABCDEF";
+
+#define HEX(a,b) (*(a)=xdigit[((b)>>4)&15],(a)[1]=xdigit[(b)&15]);
+
+static char listline[LIST_MAX_LEN];
+static bool listlinep;
+
+struct list_error {
+    struct list_error *next;
+    char str[1];
+};
+struct list_error *listerr_head, **listerr_tail;
+
+static char listdata[2 * LIST_INDENT];  /* we need less than that actually */
+static int32_t listoffset;
+
+static int32_t listlineno;
+
+static int32_t listp;
+
+static int suppress;            /* for INCBIN & TIMES special cases */
+
+static int listlevel, listlevel_e;
+
+static FILE *listfp;
+
+static void list_emit(void)
+{
+    int i;
+    struct list_error *le, *tmp;
+
+    if (listlinep || *listdata) {
+        fprintf(listfp, "%6"PRId32" ", listlineno);
+
+        if (listdata[0])
+            fprintf(listfp, "%08"PRIX32" %-*s", listoffset, LIST_HEXBIT + 1,
+                    listdata);
+        else
+            fprintf(listfp, "%*s", LIST_HEXBIT + 10, "");
+
+        if (listlevel_e)
+            fprintf(listfp, "%s<%d>", (listlevel < 10 ? " " : ""),
+                    listlevel_e);
+        else if (listlinep)
+            fprintf(listfp, "    ");
+
+        if (listlinep)
+            fprintf(listfp, " %s", listline);
+
+        putc('\n', listfp);
+        listlinep = false;
+        listdata[0] = '\0';
+    }
+
+    list_for_each_safe(le, tmp, listerr_head) {
+	fprintf(listfp, "%6"PRId32"          ", listlineno);
+	for (i = 0; i < LIST_HEXBIT; i++)
+	    putc('*', listfp);
+
+	if (listlevel_e)
+	    fprintf(listfp, " %s<%d>", (listlevel < 10 ? " " : ""),
+		    listlevel_e);
+	else
+	    fprintf(listfp, "     ");
+
+	fprintf(listfp, "  %s\n", le->str);
+        nasm_free(le);
+    }
+    listerr_head = NULL;
+    listerr_tail = &listerr_head;
+}
+
+static void list_init(const char *fname)
+{
+    if (!fname || fname[0] == '\0') {
+	listfp = NULL;
+	return;
+    }
+
+    listfp = nasm_open_write(fname, NF_TEXT);
+    if (!listfp) {
+	nasm_error(ERR_NONFATAL, "unable to open listing file `%s'",
+		   fname);
+        return;
+    }
+
+    *listline = '\0';
+    listlineno = 0;
+    listerr_head = NULL;
+    listerr_tail = &listerr_head;
+    listp = true;
+    listlevel = 0;
+    suppress = 0;
+    mistack = nasm_malloc(sizeof(MacroInhibit));
+    mistack->next = NULL;
+    mistack->level = 0;
+    mistack->inhibiting = true;
+}
+
+static void list_cleanup(void)
+{
+    if (!listp)
+        return;
+
+    while (mistack) {
+        MacroInhibit *temp = mistack;
+        mistack = temp->next;
+        nasm_free(temp);
+    }
+
+    list_emit();
+    fclose(listfp);
+}
+
+static void list_out(int64_t offset, char *str)
+{
+    if (strlen(listdata) + strlen(str) > LIST_HEXBIT) {
+        strcat(listdata, "-");
+        list_emit();
+    }
+    if (!listdata[0])
+        listoffset = offset;
+    strcat(listdata, str);
+}
+
+static void list_address(int64_t offset, const char *brackets,
+			 int64_t addr, int size)
+{
+    char q[20];
+    char *r = q;
+
+    nasm_assert(size <= 8);
+
+    *r++ = brackets[0];
+    while (size--) {
+	HEX(r, addr);
+	addr >>= 8;
+	r += 2;
+    }
+    *r++ = brackets[1];
+    *r = '\0';
+    list_out(offset, q);
+}
+
+static void list_output(const struct out_data *data)
+{
+    char q[24];
+    uint64_t size = data->size;
+    uint64_t offset = data->offset;
+    const uint8_t *p = data->data;
+
+
+    if (!listp || suppress || user_nolist)
+        return;
+
+    switch (data->type) {
+    case OUT_ZERODATA:
+        if (size > 16) {
+            snprintf(q, sizeof(q), "<zero %08"PRIX64">", size);
+            list_out(offset, q);
+            break;
+        } else {
+            p = zero_buffer;
+        }
+        /* fall through */
+    case OUT_RAWDATA:
+    {
+	if (size == 0 && !listdata[0])
+	    listoffset = data->offset;
+        while (size--) {
+            HEX(q, *p);
+            q[2] = '\0';
+            list_out(offset++, q);
+            p++;
+        }
+	break;
+    }
+    case OUT_ADDRESS:
+        list_address(offset, "[]", data->toffset, size);
+	break;
+    case OUT_SEGMENT:
+        q[0] = '[';
+        memset(q+1, 's', size << 1);
+        q[(size << 1)+1] = ']';
+        q[(size << 1)+2] = '\0';
+        list_out(offset, q);
+        offset += size;
+        break;
+    case OUT_RELADDR:
+	list_address(offset, "()", data->toffset, size);
+	break;
+    case OUT_RESERVE:
+    {
+        snprintf(q, sizeof(q), "<res %08"PRIX64">", size);
+        list_out(offset, q);
+	break;
+    }
+    default:
+        panic();
+    }
+}
+
+static void list_line(int type, char *line)
+{
+    if (!listp)
+        return;
+
+    if (user_nolist)
+      return;
+
+    if (mistack && mistack->inhibiting) {
+        if (type == LIST_MACRO)
+            return;
+        else {                  /* pop the m i stack */
+            MacroInhibit *temp = mistack;
+            mistack = temp->next;
+            nasm_free(temp);
+        }
+    }
+    list_emit();
+    listlineno = src_get_linnum();
+    listlinep = true;
+    strncpy(listline, line, LIST_MAX_LEN - 1);
+    listline[LIST_MAX_LEN - 1] = '\0';
+    listlevel_e = listlevel;
+}
+
+static void list_uplevel(int type)
+{
+    if (!listp)
+        return;
+    if (type == LIST_INCBIN || type == LIST_TIMES) {
+        suppress |= (type == LIST_INCBIN ? 1 : 2);
+        list_out(listoffset, type == LIST_INCBIN ? "<incbin>" : "<rept>");
+        return;
+    }
+
+    listlevel++;
+
+    if (mistack && mistack->inhibiting && type == LIST_INCLUDE) {
+        MacroInhibit *temp = nasm_malloc(sizeof(MacroInhibit));
+        temp->next = mistack;
+        temp->level = listlevel;
+        temp->inhibiting = false;
+        mistack = temp;
+    } else if (type == LIST_MACRO_NOLIST) {
+        MacroInhibit *temp = nasm_malloc(sizeof(MacroInhibit));
+        temp->next = mistack;
+        temp->level = listlevel;
+        temp->inhibiting = true;
+        mistack = temp;
+    }
+}
+
+static void list_downlevel(int type)
+{
+    if (!listp)
+        return;
+
+    if (type == LIST_INCBIN || type == LIST_TIMES) {
+        suppress &= ~(type == LIST_INCBIN ? 1 : 2);
+        return;
+    }
+
+    listlevel--;
+    while (mistack && mistack->level > listlevel) {
+        MacroInhibit *temp = mistack;
+        mistack = temp->next;
+        nasm_free(temp);
+    }
+}
+
+static void list_error(int severity, const char *fmt, ...)
+{
+    struct list_error *le;
+    va_list ap;
+    int len;
+
+    if (!listfp)
+	return;
+
+    va_start(ap, fmt);
+    len = vsnprintf(NULL, 0, fmt, ap);
+    va_end(ap);
+
+    /* sizeof(*le) already accounts for the final NULL */
+    le = nasm_malloc(sizeof(*le) + len);
+
+    va_start(ap, fmt);
+    vsnprintf(le->str, len+1, fmt, ap);
+    va_end(ap);
+
+    le->next = NULL;
+    *listerr_tail = le;
+    listerr_tail = &le->next;
+
+    if ((severity & ERR_MASK) >= ERR_FATAL)
+	list_emit();
+}
+
+static void list_set_offset(uint64_t offset)
+{
+    listoffset = offset;
+}
+
+static const struct lfmt nasm_list = {
+    list_init,
+    list_cleanup,
+    list_output,
+    list_line,
+    list_uplevel,
+    list_downlevel,
+    list_error,
+    list_set_offset
+};
+
+const struct lfmt *lfmt = &nasm_list;

+ 113 - 0
nasm/asm/listing.h

@@ -0,0 +1,113 @@
+/* ----------------------------------------------------------------------- *
+ *   
+ *   Copyright 1996-2016 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *     
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/* 
+ * listing.h   header file for listing.c
+ */
+
+#ifndef NASM_LISTING_H
+#define NASM_LISTING_H
+
+/*
+ * List-file generators should look like this:
+ */
+struct lfmt {
+    /*
+     * Called to initialize the listing file generator. Before this
+     * is called, the other routines will silently do nothing when
+     * called. The `char *' parameter is the file name to write the
+     * listing to.
+     */
+    void (*init)(const char *fname);
+
+    /*
+     * Called to clear stuff up and close the listing file.
+     */
+    void (*cleanup)(void);
+
+    /*
+     * Called to output binary data. Parameters are: the offset;
+     * the data; the data type. Data types are similar to the
+     * output-format interface, only OUT_ADDRESS will _always_ be
+     * displayed as if it's relocatable, so ensure that any non-
+     * relocatable address has been converted to OUT_RAWDATA by
+     * then.
+     */
+    void (*output)(const struct out_data *data);
+
+    /*
+     * Called to send a text line to the listing generator. The
+     * `int' parameter is LIST_READ or LIST_MACRO depending on
+     * whether the line came directly from an input file or is the
+     * result of a multi-line macro expansion.
+     */
+    void (*line)(int type, char *line);
+
+    /*
+     * Called to change one of the various levelled mechanisms in
+     * the listing generator. LIST_INCLUDE and LIST_MACRO can be
+     * used to increase the nesting level of include files and
+     * macro expansions; LIST_TIMES and LIST_INCBIN switch on the
+     * two binary-output-suppression mechanisms for large-scale
+     * pseudo-instructions.
+     *
+     * LIST_MACRO_NOLIST is synonymous with LIST_MACRO except that
+     * it indicates the beginning of the expansion of a `nolist'
+     * macro, so anything under that level won't be expanded unless
+     * it includes another file.
+     */
+    void (*uplevel)(int type);
+
+    /*
+     * Reverse the effects of uplevel.
+     */
+    void (*downlevel)(int type);
+
+    /*
+     * Called on a warning or error, with the error message.
+     */
+    void printf_func(2, 3) (*error)(int severity, const char *fmt, ...);
+
+    /*
+     * Update the current offset.  Used to give the listing generator
+     * an offset to work with when doing things like
+     * uplevel(LIST_TIMES) or uplevel(LIST_INCBIN); see
+     * list_set_offset();
+     */
+    void (*set_offset)(uint64_t offset);
+};
+
+extern const struct lfmt *lfmt;
+extern bool user_nolist;
+
+#endif

Файловите разлики са ограничени, защото са твърде много
+ 2042 - 0
nasm/asm/nasm.c


Файловите разлики са ограничени, защото са твърде много
+ 1208 - 0
nasm/asm/parser.c


+ 45 - 0
nasm/asm/parser.h

@@ -0,0 +1,45 @@
+/* ----------------------------------------------------------------------- *
+ *   
+ *   Copyright 1996-2009 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *     
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/* 
+ * parser.h   header file for the parser module of the Netwide
+ *            Assembler
+ */
+
+#ifndef NASM_PARSER_H
+#define NASM_PARSER_H
+
+insn *parse_line(int pass, char *buffer, insn *result);
+void cleanup_insn(insn *instruction);
+
+#endif

+ 109 - 0
nasm/asm/phash.pl

@@ -0,0 +1,109 @@
+#!/usr/bin/perl
+## --------------------------------------------------------------------------
+##   
+##   Copyright 1996-2009 the NASM Authors - All rights reserved.
+##
+##   Redistribution and use in source and binary forms, with or without
+##   modification, are permitted provided that the following
+##   conditions are met:
+##
+##   * Redistributions of source code must retain the above copyright
+##     notice, this list of conditions and the following disclaimer.
+##   * Redistributions in binary form must reproduce the above
+##     copyright notice, this list of conditions and the following
+##     disclaimer in the documentation and/or other materials provided
+##     with the distribution.
+##     
+##     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+##     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+##     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+##     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+##     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+##     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+##     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+##     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+##     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+##     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+##     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+##     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+##     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+##
+## --------------------------------------------------------------------------
+
+#
+# Perfect Minimal Hash Generator written in Perl, which produces
+# C output.
+#
+
+require 'phash.ph';
+
+#
+# Read input file
+#
+sub read_input() {
+    my $key,$val;
+    my %out;
+    my $x = 0;
+
+    while (defined($l = <STDIN>)) {
+	chomp $l;
+	$l =~ s/\s*(\#.*|)$//;
+
+	next if ($l eq '');
+
+	if ($l =~ /^([^=]+)\=([^=]+)$/) {
+	    $out{$1} = $2;
+	    $x = $2;
+	} else {
+	    $out{$l} = $x;
+	}
+	$x++;
+    }
+
+    return %out;
+}
+
+#
+# Main program
+#
+sub main() {
+    my $n;
+    my %data;
+    my @hashinfo;
+    my $x, $i;
+
+    %data = read_input();
+    @hashinfo = gen_perfect_hash(\%data);
+
+    if (!@hashinfo) {
+	die "$0: no hash found\n";
+    }
+
+    verify_hash_table(\%data, \@hashinfo);
+
+    ($n, $sv, $f1, $f2, $g) = @hashinfo;
+
+    print "static int HASHNAME_fg1[$n] =\n";
+    print "{\n";
+    for ($i = 0; $i < $n; $i++) {
+	print "\t", ${$g}[${$f1}[$i]], "\n";
+    }
+    print "};\n\n";
+
+    print "static int HASHNAME_fg2[$n] =\n";
+    print "{\n";
+    for ($i = 0; $i < $n; $i++) {
+	print "\t", ${$g}[${$f2}[$i]], "\n";
+    }
+    print "};\n\n";
+
+    print "struct p_hash HASHNAME =\n";
+    print "{\n";
+    print "\t$n\n";
+    print "\t$sv\n";
+    print "\tHASHNAME_fg1,\n";
+    print "\tHASHNAME_fg2,\n";
+    print "};\n";
+}
+
+main();

+ 511 - 0
nasm/asm/pptok.c

@@ -0,0 +1,511 @@
+/* Automatically generated from ./asm/pptok.dat by ./asm/pptok.pl */
+/* Do not edit */
+
+#include "compiler.h"
+#include <ctype.h>
+#include "nasmlib.h"
+#include "hashtbl.h"
+#include "preproc.h"
+
+const char * const pp_directives[109] = {
+    "%elif",
+    "%elifn",
+    "%elifctx",
+    "%elifnctx",
+    "%elifdef",
+    "%elifndef",
+    "%elifempty",
+    "%elifnempty",
+    "%elifenv",
+    "%elifnenv",
+    "%elifid",
+    "%elifnid",
+    "%elifidn",
+    "%elifnidn",
+    "%elifidni",
+    "%elifnidni",
+    "%elifmacro",
+    "%elifnmacro",
+    "%elifnum",
+    "%elifnnum",
+    "%elifstr",
+    "%elifnstr",
+    "%eliftoken",
+    "%elifntoken",
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    "%if",
+    "%ifn",
+    "%ifctx",
+    "%ifnctx",
+    "%ifdef",
+    "%ifndef",
+    "%ifempty",
+    "%ifnempty",
+    "%ifenv",
+    "%ifnenv",
+    "%ifid",
+    "%ifnid",
+    "%ifidn",
+    "%ifnidn",
+    "%ifidni",
+    "%ifnidni",
+    "%ifmacro",
+    "%ifnmacro",
+    "%ifnum",
+    "%ifnnum",
+    "%ifstr",
+    "%ifnstr",
+    "%iftoken",
+    "%ifntoken",
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    NULL,
+    "%arg",
+    "%assign",
+    "%clear",
+    "%define",
+    "%defstr",
+    "%deftok",
+    "%depend",
+    "%else",
+    "%endif",
+    "%endm",
+    "%endmacro",
+    "%endrep",
+    "%error",
+    "%exitmacro",
+    "%exitrep",
+    "%fatal",
+    "%iassign",
+    "%idefine",
+    "%idefstr",
+    "%ideftok",
+    "%imacro",
+    "%include",
+    "%irmacro",
+    "%ixdefine",
+    "%line",
+    "%local",
+    "%macro",
+    "%pathsearch",
+    "%pop",
+    "%pragma",
+    "%push",
+    "%rep",
+    "%repl",
+    "%rmacro",
+    "%rotate",
+    "%stacksize",
+    "%strcat",
+    "%strlen",
+    "%substr",
+    "%undef",
+    "%unimacro",
+    "%unmacro",
+    "%use",
+    "%warning",
+    "%xdefine",
+};
+const uint8_t pp_directives_len[109] = {
+    5,
+    6,
+    8,
+    9,
+    8,
+    9,
+    10,
+    11,
+    8,
+    9,
+    7,
+    8,
+    8,
+    9,
+    9,
+    10,
+    10,
+    11,
+    8,
+    9,
+    8,
+    9,
+    10,
+    11,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    3,
+    4,
+    6,
+    7,
+    6,
+    7,
+    8,
+    9,
+    6,
+    7,
+    5,
+    6,
+    6,
+    7,
+    7,
+    8,
+    8,
+    9,
+    6,
+    7,
+    6,
+    7,
+    8,
+    9,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    0,
+    4,
+    7,
+    6,
+    7,
+    7,
+    7,
+    7,
+    5,
+    6,
+    5,
+    9,
+    7,
+    6,
+    10,
+    8,
+    6,
+    8,
+    8,
+    8,
+    8,
+    7,
+    8,
+    8,
+    9,
+    5,
+    6,
+    6,
+    11,
+    4,
+    7,
+    5,
+    4,
+    5,
+    7,
+    7,
+    10,
+    7,
+    7,
+    7,
+    6,
+    9,
+    8,
+    4,
+    8,
+    8,
+};
+enum preproc_token pp_token_hash(const char *token)
+{
+#define UNUSED (65535/3)
+    static const int16_t hash1[128] = {
+        UNUSED,
+        UNUSED,
+        0,
+        0,
+        0,
+        0,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        0,
+        UNUSED,
+        UNUSED,
+        0,
+        0,
+        UNUSED,
+        0,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        0,
+        -45,
+        UNUSED,
+        0,
+        UNUSED,
+        -60,
+        0,
+        UNUSED,
+        UNUSED,
+        -42,
+        UNUSED,
+        UNUSED,
+        -49,
+        UNUSED,
+        UNUSED,
+        0,
+        UNUSED,
+        UNUSED,
+        0,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        48,
+        UNUSED,
+        UNUSED,
+        49,
+        5,
+        UNUSED,
+        -53,
+        65,
+        UNUSED,
+        UNUSED,
+        0,
+        0,
+        UNUSED,
+        38,
+        UNUSED,
+        31,
+        0,
+        UNUSED,
+        6,
+        35,
+        UNUSED,
+        UNUSED,
+        60,
+        33,
+        UNUSED,
+        136,
+        UNUSED,
+        -87,
+        -12,
+        42,
+        17,
+        0,
+        130,
+        -85,
+        UNUSED,
+        UNUSED,
+        82,
+        0,
+        UNUSED,
+        16,
+        98,
+        -66,
+        -100,
+        0,
+        -10,
+        -76,
+        UNUSED,
+        84,
+        UNUSED,
+        1,
+        UNUSED,
+        0,
+        12,
+        UNUSED,
+        -145,
+        41,
+        106,
+        UNUSED,
+        85,
+        UNUSED,
+        43,
+        85,
+        UNUSED,
+        23,
+        0,
+        -14,
+        UNUSED,
+        UNUSED,
+        77,
+        -2,
+        UNUSED,
+        UNUSED,
+        11,
+        91,
+        -7,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        107,
+        44,
+        UNUSED,
+    };
+    static const int16_t hash2[128] = {
+        UNUSED,
+        0,
+        UNUSED,
+        0,
+        UNUSED,
+        UNUSED,
+        0,
+        UNUSED,
+        UNUSED,
+        0,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        0,
+        80,
+        0,
+        64,
+        UNUSED,
+        0,
+        0,
+        0,
+        0,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        64,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        0,
+        121,
+        0,
+        UNUSED,
+        22,
+        100,
+        63,
+        UNUSED,
+        114,
+        UNUSED,
+        178,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        0,
+        UNUSED,
+        -40,
+        UNUSED,
+        88,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        87,
+        UNUSED,
+        42,
+        UNUSED,
+        UNUSED,
+        141,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        103,
+        UNUSED,
+        46,
+        106,
+        149,
+        UNUSED,
+        23,
+        53,
+        0,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        0,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        33,
+        0,
+        0,
+        92,
+        UNUSED,
+        50,
+        72,
+        UNUSED,
+        7,
+        43,
+        66,
+        UNUSED,
+        UNUSED,
+        113,
+        52,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        99,
+        101,
+        71,
+        UNUSED,
+        20,
+        63,
+        32,
+        UNUSED,
+        UNUSED,
+        UNUSED,
+        97,
+        18,
+        84,
+        132,
+        UNUSED,
+        37,
+        UNUSED,
+        9,
+        20,
+        UNUSED,
+        UNUSED,
+        75,
+        98,
+        UNUSED,
+    };
+    uint32_t k1, k2;
+    uint64_t crc;
+    uint16_t ix;
+
+    crc = crc64i(UINT64_C(0xaee7ac5ccabdec91), token);
+    k1 = (uint32_t)crc;
+    k2 = (uint32_t)(crc >> 32);
+
+    ix = hash1[k1 & 0x7f] + hash2[k2 & 0x7f];
+    if (ix >= 109)
+        return PP_INVALID;
+
+    if (!pp_directives[ix] || nasm_stricmp(pp_directives[ix], token))
+        return PP_INVALID;
+
+    return ix;
+}

+ 96 - 0
nasm/asm/pptok.dat

@@ -0,0 +1,96 @@
+## --------------------------------------------------------------------------
+##   
+##   Copyright 1996-2016 The NASM Authors - All Rights Reserved
+##   See the file AUTHORS included with the NASM distribution for
+##   the specific copyright holders.
+##
+##   Redistribution and use in source and binary forms, with or without
+##   modification, are permitted provided that the following
+##   conditions are met:
+##
+##   * Redistributions of source code must retain the above copyright
+##     notice, this list of conditions and the following disclaimer.
+##   * Redistributions in binary form must reproduce the above
+##     copyright notice, this list of conditions and the following
+##     disclaimer in the documentation and/or other materials provided
+##     with the distribution.
+##     
+##     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+##     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+##     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+##     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+##     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+##     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+##     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+##     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+##     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+##     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+##     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+##     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+##     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+##
+## --------------------------------------------------------------------------
+
+#
+# A * at the end indicates a condition; the list of conditions are
+# on lines starting with *; the negatives are auto-generated
+#
+*
+*ctx
+*def
+*empty
+*env
+*id
+*idn
+*idni
+*macro
+*num
+*str
+*token
+%arg
+%assign
+%clear
+%define
+%defstr
+%deftok
+%depend
+%elif*
+%else
+%endif
+%endm
+%endmacro
+%endrep
+%error
+%exitmacro
+%exitrep
+%fatal
+%iassign
+%idefine
+%idefstr
+%ideftok
+%if*
+%imacro
+%irmacro
+%include
+%ixdefine
+%line
+%local
+%macro
+%pathsearch
+%pop
+%pragma
+%push
+%rep
+%repl
+%rmacro
+%rotate
+%stacksize
+%strcat
+%strlen
+%substr
+%undef
+%unimacro
+%unmacro
+%use
+%warning
+%xdefine

+ 158 - 0
nasm/asm/pptok.h

@@ -0,0 +1,158 @@
+/* Automatically generated from ./asm/pptok.dat by ./asm/pptok.pl */
+/* Do not edit */
+
+enum preproc_token {
+    PP_ELIF          =   0,
+    PP_ELIFN         =   1,
+    PP_ELIFCTX       =   2,
+    PP_ELIFNCTX      =   3,
+    PP_ELIFDEF       =   4,
+    PP_ELIFNDEF      =   5,
+    PP_ELIFEMPTY     =   6,
+    PP_ELIFNEMPTY    =   7,
+    PP_ELIFENV       =   8,
+    PP_ELIFNENV      =   9,
+    PP_ELIFID        =  10,
+    PP_ELIFNID       =  11,
+    PP_ELIFIDN       =  12,
+    PP_ELIFNIDN      =  13,
+    PP_ELIFIDNI      =  14,
+    PP_ELIFNIDNI     =  15,
+    PP_ELIFMACRO     =  16,
+    PP_ELIFNMACRO    =  17,
+    PP_ELIFNUM       =  18,
+    PP_ELIFNNUM      =  19,
+    PP_ELIFSTR       =  20,
+    PP_ELIFNSTR      =  21,
+    PP_ELIFTOKEN     =  22,
+    PP_ELIFNTOKEN    =  23,
+    PP_IF            =  32,
+    PP_IFN           =  33,
+    PP_IFCTX         =  34,
+    PP_IFNCTX        =  35,
+    PP_IFDEF         =  36,
+    PP_IFNDEF        =  37,
+    PP_IFEMPTY       =  38,
+    PP_IFNEMPTY      =  39,
+    PP_IFENV         =  40,
+    PP_IFNENV        =  41,
+    PP_IFID          =  42,
+    PP_IFNID         =  43,
+    PP_IFIDN         =  44,
+    PP_IFNIDN        =  45,
+    PP_IFIDNI        =  46,
+    PP_IFNIDNI       =  47,
+    PP_IFMACRO       =  48,
+    PP_IFNMACRO      =  49,
+    PP_IFNUM         =  50,
+    PP_IFNNUM        =  51,
+    PP_IFSTR         =  52,
+    PP_IFNSTR        =  53,
+    PP_IFTOKEN       =  54,
+    PP_IFNTOKEN      =  55,
+    PP_ARG           =  64,
+    PP_ASSIGN        =  65,
+    PP_CLEAR         =  66,
+    PP_DEFINE        =  67,
+    PP_DEFSTR        =  68,
+    PP_DEFTOK        =  69,
+    PP_DEPEND        =  70,
+    PP_ELSE          =  71,
+    PP_ENDIF         =  72,
+    PP_ENDM          =  73,
+    PP_ENDMACRO      =  74,
+    PP_ENDREP        =  75,
+    PP_ERROR         =  76,
+    PP_EXITMACRO     =  77,
+    PP_EXITREP       =  78,
+    PP_FATAL         =  79,
+    PP_IASSIGN       =  80,
+    PP_IDEFINE       =  81,
+    PP_IDEFSTR       =  82,
+    PP_IDEFTOK       =  83,
+    PP_IMACRO        =  84,
+    PP_INCLUDE       =  85,
+    PP_IRMACRO       =  86,
+    PP_IXDEFINE      =  87,
+    PP_LINE          =  88,
+    PP_LOCAL         =  89,
+    PP_MACRO         =  90,
+    PP_PATHSEARCH    =  91,
+    PP_POP           =  92,
+    PP_PRAGMA        =  93,
+    PP_PUSH          =  94,
+    PP_REP           =  95,
+    PP_REPL          =  96,
+    PP_RMACRO        =  97,
+    PP_ROTATE        =  98,
+    PP_STACKSIZE     =  99,
+    PP_STRCAT        = 100,
+    PP_STRLEN        = 101,
+    PP_SUBSTR        = 102,
+    PP_UNDEF         = 103,
+    PP_UNIMACRO      = 104,
+    PP_UNMACRO       = 105,
+    PP_USE           = 106,
+    PP_WARNING       = 107,
+    PP_XDEFINE       = 108,
+    PP_INVALID       =  -1
+};
+
+enum pp_conditional {
+    PPC_IF           =   0,    PPC_IFCTX        =   2,    PPC_IFDEF        =   4,    PPC_IFEMPTY      =   6,    PPC_IFENV        =   8,    PPC_IFID         =  10,    PPC_IFIDN        =  12,    PPC_IFIDNI       =  14,    PPC_IFMACRO      =  16,    PPC_IFNUM        =  18,    PPC_IFSTR        =  20,    PPC_IFTOKEN      =  22
+};
+
+#define PP_COND(x)     ((enum pp_conditional)((x) & 0x1e))
+#define PP_IS_COND(x)  ((unsigned int)(x) < PP_ARG)
+#define PP_NEGATIVE(x) ((x) & 1)
+
+#define CASE_PP_ELIF \
+	case PP_ELIF: \
+	case PP_ELIFN:\
+	case PP_ELIFCTX: \
+	case PP_ELIFNCTX:\
+	case PP_ELIFDEF: \
+	case PP_ELIFNDEF:\
+	case PP_ELIFEMPTY: \
+	case PP_ELIFNEMPTY:\
+	case PP_ELIFENV: \
+	case PP_ELIFNENV:\
+	case PP_ELIFID: \
+	case PP_ELIFNID:\
+	case PP_ELIFIDN: \
+	case PP_ELIFNIDN:\
+	case PP_ELIFIDNI: \
+	case PP_ELIFNIDNI:\
+	case PP_ELIFMACRO: \
+	case PP_ELIFNMACRO:\
+	case PP_ELIFNUM: \
+	case PP_ELIFNNUM:\
+	case PP_ELIFSTR: \
+	case PP_ELIFNSTR:\
+	case PP_ELIFTOKEN: \
+	case PP_ELIFNTOKEN
+#define CASE_PP_IF \
+	case PP_IF: \
+	case PP_IFN:\
+	case PP_IFCTX: \
+	case PP_IFNCTX:\
+	case PP_IFDEF: \
+	case PP_IFNDEF:\
+	case PP_IFEMPTY: \
+	case PP_IFNEMPTY:\
+	case PP_IFENV: \
+	case PP_IFNENV:\
+	case PP_IFID: \
+	case PP_IFNID:\
+	case PP_IFIDN: \
+	case PP_IFNIDN:\
+	case PP_IFIDNI: \
+	case PP_IFNIDNI:\
+	case PP_IFMACRO: \
+	case PP_IFNMACRO:\
+	case PP_IFNUM: \
+	case PP_IFNNUM:\
+	case PP_IFSTR: \
+	case PP_IFNSTR:\
+	case PP_IFTOKEN: \
+	case PP_IFNTOKEN

+ 99 - 0
nasm/asm/pptok.ph

@@ -0,0 +1,99 @@
+# Automatically generated from ./asm/pptok.dat by ./asm/pptok.pl
+# Do not edit
+
+%pptok_hash = (
+    '%elif' => 0,
+    '%elifn' => 1,
+    '%elifctx' => 2,
+    '%elifnctx' => 3,
+    '%elifdef' => 4,
+    '%elifndef' => 5,
+    '%elifempty' => 6,
+    '%elifnempty' => 7,
+    '%elifenv' => 8,
+    '%elifnenv' => 9,
+    '%elifid' => 10,
+    '%elifnid' => 11,
+    '%elifidn' => 12,
+    '%elifnidn' => 13,
+    '%elifidni' => 14,
+    '%elifnidni' => 15,
+    '%elifmacro' => 16,
+    '%elifnmacro' => 17,
+    '%elifnum' => 18,
+    '%elifnnum' => 19,
+    '%elifstr' => 20,
+    '%elifnstr' => 21,
+    '%eliftoken' => 22,
+    '%elifntoken' => 23,
+    '%if' => 32,
+    '%ifn' => 33,
+    '%ifctx' => 34,
+    '%ifnctx' => 35,
+    '%ifdef' => 36,
+    '%ifndef' => 37,
+    '%ifempty' => 38,
+    '%ifnempty' => 39,
+    '%ifenv' => 40,
+    '%ifnenv' => 41,
+    '%ifid' => 42,
+    '%ifnid' => 43,
+    '%ifidn' => 44,
+    '%ifnidn' => 45,
+    '%ifidni' => 46,
+    '%ifnidni' => 47,
+    '%ifmacro' => 48,
+    '%ifnmacro' => 49,
+    '%ifnum' => 50,
+    '%ifnnum' => 51,
+    '%ifstr' => 52,
+    '%ifnstr' => 53,
+    '%iftoken' => 54,
+    '%ifntoken' => 55,
+    '%arg' => 64,
+    '%assign' => 65,
+    '%clear' => 66,
+    '%define' => 67,
+    '%defstr' => 68,
+    '%deftok' => 69,
+    '%depend' => 70,
+    '%else' => 71,
+    '%endif' => 72,
+    '%endm' => 73,
+    '%endmacro' => 74,
+    '%endrep' => 75,
+    '%error' => 76,
+    '%exitmacro' => 77,
+    '%exitrep' => 78,
+    '%fatal' => 79,
+    '%iassign' => 80,
+    '%idefine' => 81,
+    '%idefstr' => 82,
+    '%ideftok' => 83,
+    '%imacro' => 84,
+    '%include' => 85,
+    '%irmacro' => 86,
+    '%ixdefine' => 87,
+    '%line' => 88,
+    '%local' => 89,
+    '%macro' => 90,
+    '%pathsearch' => 91,
+    '%pop' => 92,
+    '%pragma' => 93,
+    '%push' => 94,
+    '%rep' => 95,
+    '%repl' => 96,
+    '%rmacro' => 97,
+    '%rotate' => 98,
+    '%stacksize' => 99,
+    '%strcat' => 100,
+    '%strlen' => 101,
+    '%substr' => 102,
+    '%undef' => 103,
+    '%unimacro' => 104,
+    '%unmacro' => 105,
+    '%use' => 106,
+    '%warning' => 107,
+    '%xdefine' => 108,
+);
+1;

+ 271 - 0
nasm/asm/pptok.pl

@@ -0,0 +1,271 @@
+#!/usr/bin/perl
+## --------------------------------------------------------------------------
+##   
+##   Copyright 1996-2009 The NASM Authors - All Rights Reserved
+##   See the file AUTHORS included with the NASM distribution for
+##   the specific copyright holders.
+##
+##   Redistribution and use in source and binary forms, with or without
+##   modification, are permitted provided that the following
+##   conditions are met:
+##
+##   * Redistributions of source code must retain the above copyright
+##     notice, this list of conditions and the following disclaimer.
+##   * Redistributions in binary form must reproduce the above
+##     copyright notice, this list of conditions and the following
+##     disclaimer in the documentation and/or other materials provided
+##     with the distribution.
+##     
+##     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+##     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+##     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+##     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+##     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+##     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+##     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+##     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+##     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+##     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+##     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+##     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+##     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+##
+## --------------------------------------------------------------------------
+
+#
+# Produce pptok.c, pptok.h and pptok.ph from pptok.dat
+#
+
+require 'phash.ph';
+
+my($what, $in, $out) = @ARGV;
+
+#
+# Read pptok.dat
+#
+open(IN, '<', $in) or die "$0: cannot open: $in\n";
+while (defined($line = <IN>)) {
+    $line =~ s/\r?\n$//;	# Remove trailing \r\n or \n
+    $line =~ s/^\s+//;		# Remove leading whitespace
+    $line =~ s/\s*\#.*$//;	# Remove comments and trailing whitespace
+    next if ($line eq '');
+
+    if ($line =~ /^\%(.*)\*$/) {
+	push(@cctok, $1);
+    } elsif ($line =~ /^\%(.*)$/) {
+	push(@pptok, $1);
+    } elsif ($line =~ /^\*(.*)$/) {
+	push(@cond, $1);
+    }
+}
+close(IN);
+
+@cctok = sort @cctok;
+@cond = sort @cond;
+@pptok = sort @pptok;
+
+# Generate the expanded list including conditionals.  The conditionals
+# are at the beginning, padded to a power of 2, with the inverses
+# interspersed; this allows a simple mask to pick out the condition.
+
+while ((scalar @cond) & (scalar @cond)-1) {
+    push(@cond, undef);
+}
+
+@cptok = ();
+foreach $ct (@cctok) {
+    foreach $cc (@cond) {
+	if (defined($cc)) {
+	    push(@cptok, $ct.$cc);
+	    push(@cptok, $ct.'n'.$cc);
+	} else {
+	    push(@cptok, undef, undef);
+	}
+    }
+}
+$first_uncond = $pptok[0];
+@pptok = (@cptok, @pptok);
+
+open(OUT, '>', $out) or die "$0: cannot open: $out\n";
+
+#
+# Output pptok.h
+#
+if ($what eq 'h') {
+    print OUT "/* Automatically generated from $in by $0 */\n";
+    print OUT "/* Do not edit */\n";
+    print OUT "\n";
+
+    print OUT "enum preproc_token {\n";
+    $n = 0;
+    foreach $pt (@pptok) {
+	if (defined($pt)) {
+	    printf OUT "    %-16s = %3d,\n", "PP_\U$pt\E", $n;
+	}
+	$n++;
+    }
+    printf OUT "    %-16s = %3d\n", 'PP_INVALID', -1;
+    print OUT "};\n";
+    print OUT "\n";
+
+    print  OUT "enum pp_conditional {\n";
+    $n = 0;
+    $c = '';
+    foreach $cc (@cond) {
+	if (defined($cc)) {
+	    printf OUT "$c    %-16s = %3d", "PPC_IF\U$cc\E", $n;
+	    $c = ',';
+	}
+	$n += 2;
+    }
+    print  OUT "\n};\n\n";
+
+    printf OUT "#define PP_COND(x)     ((enum pp_conditional)((x) & 0x%x))\n",
+	(scalar(@cond)-1) << 1;
+    print  OUT "#define PP_IS_COND(x)  ((unsigned int)(x) < PP_\U$first_uncond\E)\n";
+    print  OUT "#define PP_NEGATIVE(x) ((x) & 1)\n";
+    print  OUT "\n";
+
+    foreach $ct (@cctok) {
+	print OUT "#define CASE_PP_\U$ct\E";
+	$pref = " \\\n";
+	foreach $cc (@cond) {
+	    if (defined($cc)) {
+		print OUT "$pref\tcase PP_\U${ct}${cc}\E: \\\n";
+		print OUT "\tcase PP_\U${ct}N${cc}\E";
+		$pref = ":\\\n";
+	    }
+	}
+	print OUT "\n";		# No colon or newline on the last one
+    }
+}
+
+#
+# Output pptok.c
+#
+if ($what eq 'c') {
+    print OUT "/* Automatically generated from $in by $0 */\n";
+    print OUT "/* Do not edit */\n";
+    print OUT "\n";
+
+    my %tokens = ();
+    my @tokendata = ();
+
+    my $n = 0;
+    foreach $pt (@pptok) {
+	if (defined($pt)) {
+	    $tokens{'%'.$pt} = $n;
+	    if ($pt =~ /[\@\[\]\\_]/) {
+		# Fail on characters which look like upper-case letters
+		# to the quick-and-dirty downcasing in the prehash
+		# (see below)
+		die "$in: invalid character in token: $pt";
+	    }
+	}
+	$n++;
+    }
+
+    my @hashinfo = gen_perfect_hash(\%tokens);
+    if (!@hashinfo) {
+	die "$0: no hash found\n";
+    }
+
+    # Paranoia...
+    verify_hash_table(\%tokens, \@hashinfo);
+
+    ($n, $sv, $g) = @hashinfo;
+    $sv2 = $sv+2;
+
+    die if ($n & ($n-1));
+
+    print OUT "#include \"compiler.h\"\n";
+    print OUT "#include <ctype.h>\n";
+    print OUT "#include \"nasmlib.h\"\n";
+    print OUT "#include \"hashtbl.h\"\n";
+    print OUT "#include \"preproc.h\"\n";
+    print OUT "\n";
+
+    # Note that this is global.
+    printf OUT "const char * const pp_directives[%d] = {\n", scalar(@pptok);
+    foreach $d (@pptok) {
+	if (defined($d)) {
+	    print OUT "    \"%$d\",\n";
+	} else {
+	    print OUT "    NULL,\n";
+	}
+    }
+    print OUT  "};\n";
+
+    printf OUT "const uint8_t pp_directives_len[%d] = {\n", scalar(@pptok);
+    foreach $d (@pptok) {
+	printf OUT "    %d,\n", defined($d) ? length($d)+1 : 0;
+    }
+    print OUT  "};\n";
+
+    print OUT "enum preproc_token pp_token_hash(const char *token)\n";
+    print OUT "{\n";
+
+    # Put a large value in unused slots.  This makes it extremely unlikely
+    # that any combination that involves unused slot will pass the range test.
+    # This speeds up rejection of unrecognized tokens, i.e. identifiers.
+    print OUT "#define UNUSED (65535/3)\n";
+
+    print OUT "    static const int16_t hash1[$n] = {\n";
+    for ($i = 0; $i < $n; $i++) {
+	my $h = ${$g}[$i*2+0];
+	print OUT "        ", defined($h) ? $h : 'UNUSED', ",\n";
+    }
+    print OUT "    };\n";
+
+    print OUT "    static const int16_t hash2[$n] = {\n";
+    for ($i = 0; $i < $n; $i++) {
+	my $h = ${$g}[$i*2+1];
+	print OUT "        ", defined($h) ? $h : 'UNUSED', ",\n";
+    }
+    print OUT "    };\n";
+
+    print OUT  "    uint32_t k1, k2;\n";
+    print OUT  "    uint64_t crc;\n";
+    # For correct overflow behavior, "ix" should be unsigned of the same
+    # width as the hash arrays.
+    print OUT  "    uint16_t ix;\n";
+    print OUT  "\n";
+
+    printf OUT "    crc = crc64i(UINT64_C(0x%08x%08x), token);\n",
+	$$sv[0], $$sv[1];
+    print  OUT "    k1 = (uint32_t)crc;\n";
+    print  OUT "    k2 = (uint32_t)(crc >> 32);\n";
+    print  OUT "\n";
+    printf OUT "    ix = hash1[k1 & 0x%x] + hash2[k2 & 0x%x];\n", $n-1, $n-1;
+    printf OUT "    if (ix >= %d)\n", scalar(@pptok);
+    print OUT  "        return PP_INVALID;\n";
+    print OUT  "\n";
+
+    print OUT  "    if (!pp_directives[ix] || nasm_stricmp(pp_directives[ix], token))\n";
+    print OUT  "        return PP_INVALID;\n";
+    print OUT  "\n";
+    print OUT  "    return ix;\n";
+    print OUT  "}\n";
+}
+
+#
+# Output pptok.ph
+#
+if ($what eq 'ph') {
+    print OUT "# Automatically generated from $in by $0\n";
+    print OUT "# Do not edit\n";
+    print OUT "\n";
+    
+    print OUT "%pptok_hash = (\n";
+    $n = 0;
+    foreach $tok (@pptok) {
+	if (defined($tok)) {
+	    printf OUT "    '%%%s' => %d,\n", $tok, $n;
+	}
+	$n++;
+    }
+    print OUT ");\n";
+    print OUT "1;\n";
+}
+
+    

+ 274 - 0
nasm/asm/pragma.c

@@ -0,0 +1,274 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 1996-2018 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * Parse and handle [pragma] directives.  The preprocessor handles
+ * %pragma preproc directives separately, all other namespaces are
+ * simply converted to [pragma].
+ */
+
+#include "compiler.h"
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <limits.h>
+
+#include "nasm.h"
+#include "nasmlib.h"
+#include "assemble.h"
+#include "error.h"
+
+static enum directive_result output_pragma(const struct pragma *pragma);
+static enum directive_result limit_pragma(const struct pragma *pragma);
+
+/*
+ * Handle [pragma] directives.  [pragma] is generally produced by
+ * the %pragma preprocessor directive, which simply passes on any
+ * string that it finds *except* %pragma preproc.  The idea is
+ * that pragmas are of the form:
+ *
+ * %pragma <facility> <opname> [<options>...]
+ *
+ * ... where "facility" can be either a generic facility or a backend
+ * name.
+ *
+ * The following names are currently reserved for global facilities;
+ * so far none of these have any defined pragmas at all:
+ *
+ * preproc	- preprocessor
+ * limit	- limit setting
+ * asm		- assembler
+ * list		- listing generator
+ * file		- generic file handling
+ * input	- input file handling
+ * output	- backend-independent output handling
+ * debug	- backend-independent debug handling
+ * ignore	- dummy pragma (can be used to "comment out")
+ *
+ * This function should generally not error out if it doesn't understand
+ * what a pragma is for, for unknown arguments, etc; the whole point of
+ * a pragma is that future releases might add new ones that should be
+ * ignored rather than be an error.  Erroring out is acceptable for
+ * known pragmas suffering from parsing errors and so on.
+ *
+ * Adding default-suppressed warnings would, however, be a good idea
+ * at some point.
+ */
+static struct pragma_facility global_pragmas[] =
+{
+    { "asm",		NULL },
+    { "limit",          limit_pragma },
+    { "list",		NULL },
+    { "file",		NULL },
+    { "input",		NULL },
+
+    /* None of these should actually happen due to special handling */
+    { "preproc",	NULL }, /* Handled in the preprocessor by necessity */
+    { "output",		NULL },
+    { "debug",	        NULL },
+    { "ignore",		NULL },
+    { NULL, NULL }
+};
+
+/*
+ * Search a pragma list for a known pragma facility and if so, invoke
+ * the handler.  Return true if processing is complete.
+ * The "default name", if set, matches the final NULL entry (used
+ * for backends, so multiple backends can share the same list under
+ * some circumstances.)
+ */
+static bool search_pragma_list(const struct pragma_facility *list,
+                               const char *default_name,
+                               pragma_handler generic_handler,
+			       struct pragma *pragma)
+{
+    const struct pragma_facility *pf;
+    enum directive_result rv;
+
+    if (!list)
+	return false;
+
+    for (pf = list; pf->name; pf++) {
+        if (!nasm_stricmp(pragma->facility_name, pf->name))
+            goto found_it;
+    }
+
+    if (default_name && !nasm_stricmp(pragma->facility_name, default_name))
+        goto found_it;
+
+    return false;
+
+found_it:
+    pragma->facility = pf;
+
+    /* If the handler is NULL all pragmas are unknown... */
+    if (pf->handler)
+        rv = pf->handler(pragma);
+    else
+        rv = DIRR_UNKNOWN;
+
+    /* Is there an additional, applicable generic handler? */
+    if (rv == DIRR_UNKNOWN && generic_handler)
+        rv = generic_handler(pragma);
+
+    switch (rv) {
+    case DIRR_UNKNOWN:
+        switch (pragma->opcode) {
+        case D_none:
+            nasm_error(ERR_WARNING|ERR_PASS2|WARN_BAD_PRAGMA,
+                       "empty %%pragma %s", pragma->facility_name);
+            break;
+        default:
+            nasm_error(ERR_WARNING|ERR_PASS2|WARN_UNKNOWN_PRAGMA,
+                       "unknown %%pragma %s %s",
+                       pragma->facility_name, pragma->opname);
+            break;
+        }
+        break;
+
+    case DIRR_OK:
+    case DIRR_ERROR:
+        break;                  /* Nothing to do */
+
+    case DIRR_BADPARAM:
+        /*
+         * This one is an error.  Don't use it if forward compatibility
+         * would be compromised, as opposed to an inherent error.
+         */
+        nasm_error(ERR_NONFATAL, "bad argument to %%pragma %s %s",
+                   pragma->facility_name, pragma->opname);
+        break;
+
+    default:
+        panic();
+    }
+    return true;
+}
+
+void process_pragma(char *str)
+{
+    struct pragma pragma;
+    char *p;
+
+    nasm_zero(pragma);
+
+    pragma.facility_name = nasm_get_word(str, &p);
+    if (!pragma.facility_name) {
+	nasm_error(ERR_WARNING|ERR_PASS2|WARN_BAD_PRAGMA,
+		   "empty pragma directive");
+        return;                 /* Empty pragma */
+    }
+
+    /*
+     * The facility "ignore" means just that; don't even complain of
+     * the absence of an operation.
+     */
+    if (!nasm_stricmp(pragma.facility_name, "ignore"))
+        return;
+
+    /*
+     * The "output" and "debug" facilities are aliases for the
+     * current output and debug formats, respectively.
+     */
+    if (!nasm_stricmp(pragma.facility_name, "output"))
+        pragma.facility_name = ofmt->shortname;
+    if (!nasm_stricmp(pragma.facility_name, "debug"))
+        pragma.facility_name = dfmt->shortname;
+
+    pragma.opname = nasm_get_word(p, &p);
+    if (!pragma.opname)
+        pragma.opcode = D_none;
+    else
+        pragma.opcode = directive_find(pragma.opname);
+
+    pragma.tail = nasm_trim_spaces(p);
+
+    /* Look for a global pragma namespace */
+    if (search_pragma_list(global_pragmas, NULL, NULL, &pragma))
+	return;
+
+    /* Look to see if it is an output backend pragma */
+    if (search_pragma_list(ofmt->pragmas, ofmt->shortname,
+                           output_pragma, &pragma))
+	return;
+
+    /* Look to see if it is a debug format pragma */
+    if (search_pragma_list(dfmt->pragmas, dfmt->shortname, NULL, &pragma))
+	return;
+
+    /*
+     * Note: it would be nice to warn for an unknown namespace,
+     * but in order to do so we need to walk *ALL* the backends
+     * in order to make sure we aren't dealing with a pragma that
+     * is for another backend.  On the other hand, that could
+     * also be a warning with a separate warning flag.
+     *
+     * Leave this for the future, however, the warning classes are
+     * already defined for future compatibility.
+     */
+}
+
+/*
+ * Generic pragmas that apply to all output backends; these are handled
+ * specially so they can be made selective based on the output format.
+ */
+static enum directive_result output_pragma(const struct pragma *pragma)
+{
+    switch (pragma->opcode) {
+    case D_PREFIX:
+    case D_GPREFIX:
+        set_label_mangle(LM_GPREFIX, pragma->tail);
+        return DIRR_OK;
+    case D_SUFFIX:
+    case D_GSUFFIX:
+        set_label_mangle(LM_GSUFFIX, pragma->tail);
+        return DIRR_OK;
+    case D_LPREFIX:
+        set_label_mangle(LM_LPREFIX, pragma->tail);
+        return DIRR_OK;
+    case D_LSUFFIX:
+        set_label_mangle(LM_LSUFFIX, pragma->tail);
+        return DIRR_OK;
+    default:
+        return DIRR_UNKNOWN;
+    }
+}
+
+/*
+ * %pragma limit to set resource limits
+ */
+static enum directive_result limit_pragma(const struct pragma *pragma)
+{
+    return nasm_set_limit(pragma->opname, pragma->tail);
+}

+ 196 - 0
nasm/asm/preproc-nop.c

@@ -0,0 +1,196 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 1996-2016 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * This is a null preprocessor which just copies lines from input
+ * to output. It's used when someone explicitly requests that NASM
+ * not preprocess their source file.
+ */
+
+#include "compiler.h"
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <limits.h>
+#include <time.h>
+
+#include "nasm.h"
+#include "nasmlib.h"
+#include "error.h"
+#include "preproc.h"
+#include "listing.h"
+
+#define BUF_DELTA 512
+
+static FILE *nop_fp;
+static int32_t nop_lineinc;
+
+static void nop_init(void)
+{
+    /* Nothing to do */
+}
+
+static void nop_reset(const char *file, int pass, StrList **deplist)
+{
+    src_set(0, file);
+    nop_lineinc = 1;
+    nop_fp = nasm_open_read(file, NF_TEXT);
+
+    if (!nop_fp)
+	nasm_fatal(ERR_NOFILE, "unable to open input file `%s'", file);
+    (void)pass;                 /* placate compilers */
+
+    nasm_add_string_to_strlist(deplist, file);
+}
+
+static char *nop_getline(void)
+{
+    char *buffer, *p, *q;
+    int bufsize;
+
+    bufsize = BUF_DELTA;
+    buffer = nasm_malloc(BUF_DELTA);
+    src_set_linnum(src_get_linnum() + nop_lineinc);
+
+    while (1) {                 /* Loop to handle %line */
+        p = buffer;
+        while (1) {             /* Loop to handle long lines */
+            q = fgets(p, bufsize - (p - buffer), nop_fp);
+            if (!q)
+                break;
+            p += strlen(p);
+            if (p > buffer && p[-1] == '\n')
+                break;
+            if (p - buffer > bufsize - 10) {
+                int offset;
+                offset = p - buffer;
+                bufsize += BUF_DELTA;
+                buffer = nasm_realloc(buffer, bufsize);
+                p = buffer + offset;
+            }
+        }
+
+        if (!q && p == buffer) {
+            nasm_free(buffer);
+            return NULL;
+        }
+
+        /*
+         * Play safe: remove CRs, LFs and any spurious ^Zs, if any of
+         * them are present at the end of the line.
+         */
+        buffer[strcspn(buffer, "\r\n\032")] = '\0';
+
+        if (!nasm_strnicmp(buffer, "%line", 5)) {
+            int32_t ln;
+            int li;
+            char *nm = nasm_malloc(strlen(buffer));
+            int conv = sscanf(buffer + 5, "%"PRId32"+%d %s", &ln, &li, nm);
+            if (conv >= 2) {
+                if (!pp_noline)
+                    src_set(ln, conv >= 3 ? nm : NULL);
+                nop_lineinc = li;
+            }
+            nasm_free(nm);
+            if (conv >= 2)
+                continue;
+        }
+        break;
+    }
+
+    lfmt->line(LIST_READ, buffer);
+
+    return buffer;
+}
+
+static void nop_cleanup(int pass)
+{
+    (void)pass;                     /* placate GCC */
+    if (nop_fp) {
+        fclose(nop_fp);
+        nop_fp = NULL;
+    }
+}
+
+static void nop_extra_stdmac(macros_t *macros)
+{
+    (void)macros;
+}
+
+static void nop_pre_define(char *definition)
+{
+    (void)definition;
+}
+
+static void nop_pre_undefine(char *definition)
+{
+    (void)definition;
+}
+
+static void nop_pre_include(char *fname)
+{
+    (void)fname;
+}
+
+static void nop_pre_command(const char *what, char *string)
+{
+    (void)what;
+    (void)string;
+}
+
+static void nop_include_path(char *path)
+{
+    (void)path;
+}
+
+static void nop_error_list_macros(int severity)
+{
+    (void)severity;
+}
+
+const struct preproc_ops preproc_nop = {
+    nop_init,
+    nop_reset,
+    nop_getline,
+    nop_cleanup,
+    nop_extra_stdmac,
+    nop_pre_define,
+    nop_pre_undefine,
+    nop_pre_include,
+    nop_pre_command,
+    nop_include_path,
+    nop_error_list_macros,
+};

Файловите разлики са ограничени, защото са твърде много
+ 5488 - 0
nasm/asm/preproc.c


+ 56 - 0
nasm/asm/preproc.h

@@ -0,0 +1,56 @@
+/* ----------------------------------------------------------------------- *
+ *   
+ *   Copyright 1996-2009 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *     
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/* 
+ * preproc.h  header file for preproc.c
+ */
+
+#ifndef NASM_PREPROC_H
+#define NASM_PREPROC_H
+
+#include "nasmlib.h"
+#include "pptok.h"
+
+extern const char * const pp_directives[];
+extern const uint8_t pp_directives_len[];
+extern bool pp_noline;
+
+/* Pointer to a macro chain */
+typedef const unsigned char macros_t;
+
+enum preproc_token pp_token_hash(const char *token);
+
+/* Opens an include file or input file. This uses the include path. */
+FILE *pp_input_fopen(const char *filename, enum file_flags mode);
+
+#endif

+ 479 - 0
nasm/asm/quote.c

@@ -0,0 +1,479 @@
+/* ----------------------------------------------------------------------- *
+ *   
+ *   Copyright 1996-2016 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *     
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * quote.c
+ */
+
+#include "compiler.h"
+
+#include <stdlib.h>
+
+#include "nasmlib.h"
+#include "quote.h"
+
+char *nasm_quote(const char *str, size_t len)
+{
+    const char *p, *ep;
+    char c, c1, *q, *nstr;
+    unsigned char uc;
+    bool sq_ok, dq_ok;
+    size_t qlen;
+
+    sq_ok = dq_ok = true;
+    ep = str+len;
+    qlen = 0;			/* Length if we need `...` quotes */
+    for (p = str; p < ep; p++) {
+	c = *p;
+	switch (c) {
+	case '\'':
+	    sq_ok = false;
+	    qlen++;
+	    break;
+	case '\"':
+	    dq_ok = false;
+	    qlen++;
+	    break;
+	case '`':
+	case '\\':
+	    qlen += 2;
+	    break;
+	default:
+	    if (c < ' ' || c > '~') {
+		sq_ok = dq_ok = false;
+		switch (c) {
+		case '\a':
+		case '\b':
+		case '\t':
+		case '\n':
+		case '\v':
+		case '\f':
+		case '\r':
+		case 27:
+		    qlen += 2;
+		    break;
+		default:
+		    c1 = (p+1 < ep) ? p[1] : 0;
+		    if (c1 >= '0' && c1 <= '7')
+			uc = 0377; /* Must use the full form */
+		    else
+			uc = c;
+		    if (uc > 077)
+			qlen++;
+		    if (uc > 07)
+			qlen++;
+		    qlen += 2;
+		    break;
+		}
+	    } else {
+		qlen++;
+	    }
+	    break;
+	}
+    }
+
+    if (sq_ok || dq_ok) {
+	/* Use '...' or "..." */
+	nstr = nasm_malloc(len+3);
+	nstr[0] = nstr[len+1] = sq_ok ? '\'' : '\"';
+	nstr[len+2] = '\0';
+	if (len > 0)
+	    memcpy(nstr+1, str, len);
+    } else {
+	/* Need to use `...` quoted syntax */
+	nstr = nasm_malloc(qlen+3);
+	q = nstr;
+	*q++ = '`';
+	for (p = str; p < ep; p++) {
+	    c = *p;
+	    switch (c) {
+	    case '`':
+	    case '\\':
+		*q++ = '\\';
+		*q++ = c;
+		break;
+	    case 7:
+		*q++ = '\\';
+		*q++ = 'a';
+		break;
+	    case 8:
+		*q++ = '\\';
+		*q++ = 'b';
+		break;
+	    case 9:
+		*q++ = '\\';
+		*q++ = 't';
+		break;
+	    case 10:
+		*q++ = '\\';
+		*q++ = 'n';
+		break;
+	    case 11:
+		*q++ = '\\';
+		*q++ = 'v';
+		break;
+	    case 12:
+		*q++ = '\\';
+		*q++ = 'f';
+		break;
+	    case 13:
+		*q++ = '\\';
+		*q++ = 'r';
+		break;
+	    case 27:
+		*q++ = '\\';
+		*q++ = 'e';
+		break;
+	    default:
+		if (c < ' ' || c > '~') {
+		    c1 = (p+1 < ep) ? p[1] : 0;
+		    if (c1 >= '0' && c1 <= '7')
+			uc = 0377; /* Must use the full form */
+		    else
+			uc = c;
+		    *q++ = '\\';
+		    if (uc > 077)
+			*q++ = ((unsigned char)c >> 6) + '0';
+		    if (uc > 07)
+			*q++ = (((unsigned char)c >> 3) & 7) + '0';
+		    *q++ = ((unsigned char)c & 7) + '0';
+		    break;
+		} else {
+		    *q++ = c;
+		}
+		break;
+	    }
+	}
+	*q++ = '`';
+	*q++ = '\0';
+	nasm_assert((size_t)(q-nstr) == qlen+3);
+    }
+    return nstr;
+}
+
+static char *emit_utf8(char *q, int32_t v)
+{
+    if (v < 0) {
+	/* Impossible - do nothing */
+    } else if (v <= 0x7f) {
+	*q++ = v;
+    } else if (v <= 0x000007ff) {
+	*q++ = 0xc0 | (v >> 6);
+	*q++ = 0x80 | (v & 63);
+    } else if (v <= 0x0000ffff) {
+	*q++ = 0xe0 | (v >> 12);
+	*q++ = 0x80 | ((v >> 6) & 63);
+	*q++ = 0x80 | (v & 63);
+    } else if (v <= 0x001fffff) {
+	*q++ = 0xf0 | (v >> 18);
+	*q++ = 0x80 | ((v >> 12) & 63);
+	*q++ = 0x80 | ((v >> 6) & 63);
+	*q++ = 0x80 | (v & 63);
+    } else if (v <= 0x03ffffff) {
+	*q++ = 0xf8 | (v >> 24);
+	*q++ = 0x80 | ((v >> 18) & 63);
+	*q++ = 0x80 | ((v >> 12) & 63);
+	*q++ = 0x80 | ((v >> 6) & 63);
+	*q++ = 0x80 | (v & 63);
+    } else {
+	*q++ = 0xfc | (v >> 30);
+	*q++ = 0x80 | ((v >> 24) & 63);
+	*q++ = 0x80 | ((v >> 18) & 63);
+	*q++ = 0x80 | ((v >> 12) & 63);
+	*q++ = 0x80 | ((v >> 6) & 63);
+	*q++ = 0x80 | (v & 63);
+    }
+    return q;
+}
+
+/*
+ * Do an *in-place* dequoting of the specified string, returning the
+ * resulting length (which may be containing embedded nulls.)
+ *
+ * In-place replacement is possible since the unquoted length is always
+ * shorter than or equal to the quoted length.
+ *
+ * *ep points to the final quote, or to the null if improperly quoted.
+ */
+size_t nasm_unquote(char *str, char **ep)
+{
+    char bq;
+    char *p, *q;
+    char *escp = NULL;
+    char c;
+    enum unq_state {
+	st_start,
+	st_backslash,
+	st_hex,
+	st_oct,
+	st_ucs
+    } state;
+    int ndig = 0;
+    int32_t nval = 0;
+
+    p = q = str;
+    
+    bq = *p++;
+    if (!bq)
+	return 0;
+
+    switch (bq) {
+    case '\'':
+    case '\"':
+	/* '...' or "..." string */
+	while ((c = *p) && c != bq) {
+	    p++;
+	    *q++ = c;
+	}
+	*q = '\0';
+	break;
+
+    case '`':
+	/* `...` string */
+	state = st_start;
+
+	while ((c = *p)) {
+	    p++;
+	    switch (state) {
+	    case st_start:
+		switch (c) {
+		case '\\':
+		    state = st_backslash;
+		    break;
+		case '`':
+		    p--;
+		    goto out;
+		default:
+		    *q++ = c;
+		    break;
+		}
+		break;
+
+	    case st_backslash:
+		state = st_start;
+		escp = p;	/* Beginning of argument sequence */
+		nval = 0;
+		switch (c) {
+		case 'a':
+		    *q++ = 7;
+		    break;
+		case 'b':
+		    *q++ = 8;
+		    break;
+		case 'e':
+		    *q++ = 27;
+		    break;
+		case 'f':
+		    *q++ = 12;
+		    break;
+		case 'n':
+		    *q++ = 10;
+		    break;
+		case 'r':
+		    *q++ = 13;
+		    break;
+		case 't':
+		    *q++ = 9;
+		    break;
+		case 'u':
+		    state = st_ucs;
+		    ndig = 4;
+		    break;
+		case 'U':
+		    state = st_ucs;
+		    ndig = 8;
+		    break;
+		case 'v':
+		    *q++ = 11;
+		    break;
+		case 'x':
+		case 'X':
+		    state = st_hex;
+		    ndig = 2;
+		    break;
+		case '0':
+		case '1':
+		case '2':
+		case '3':
+		case '4':
+		case '5':
+		case '6':
+		case '7':
+		    state = st_oct;
+		    ndig = 2;	/* Up to two more digits */
+		    nval = c - '0';
+		    break;
+		default:
+		    *q++ = c;
+		    break;
+		}
+		break;
+
+	    case st_oct:
+		if (c >= '0' && c <= '7') {
+		    nval = (nval << 3) + (c - '0');
+		    if (!--ndig) {
+			*q++ = nval;
+			state = st_start;
+		    }
+		} else {
+		    p--;	/* Process this character again */
+		    *q++ = nval;
+		    state = st_start;
+		}
+		break;
+
+	    case st_hex:
+		if ((c >= '0' && c <= '9') ||
+		    (c >= 'A' && c <= 'F') ||
+		    (c >= 'a' && c <= 'f')) {
+		    nval = (nval << 4) + numvalue(c);
+		    if (!--ndig) {
+			*q++ = nval;
+			state = st_start;
+		    }
+		} else {
+		    p--;	/* Process this character again */
+		    *q++ = (p > escp) ? nval : escp[-1];
+		    state = st_start;
+		}
+		break;
+
+	    case st_ucs:
+		if ((c >= '0' && c <= '9') ||
+		    (c >= 'A' && c <= 'F') ||
+		    (c >= 'a' && c <= 'f')) {
+		    nval = (nval << 4) + numvalue(c);
+		    if (!--ndig) {
+			q = emit_utf8(q, nval);
+			state = st_start;
+		    }
+		} else {
+		    p--;	/* Process this character again */
+		    if (p > escp)
+			q = emit_utf8(q, nval);
+		    else
+			*q++ = escp[-1];
+		    state = st_start;
+		}
+		break;
+	    }
+	}
+	switch (state) {
+	case st_start:
+	case st_backslash:
+	    break;
+	case st_oct:
+	    *q++ = nval;
+	    break;
+	case st_hex:
+	    *q++ = (p > escp) ? nval : escp[-1];
+	    break;
+	case st_ucs:
+	    if (p > escp)
+		q = emit_utf8(q, nval);
+	    else
+		*q++ = escp[-1];
+	    break;
+	}
+    out:
+	break;
+
+    default:
+	/* Not a quoted string, just return the input... */
+	p = q = strchr(str, '\0');
+	break;
+    }
+
+    if (ep)
+	*ep = p;
+    return q-str;
+}
+
+/*
+ * Find the end of a quoted string; returns the pointer to the terminating
+ * character (either the ending quote or the null character, if unterminated.)
+ */
+char *nasm_skip_string(char *str)
+{
+    char bq;
+    char *p;
+    char c;
+    enum unq_state {
+	st_start,
+	st_backslash
+    } state;
+
+    bq = str[0];
+    if (bq == '\'' || bq == '\"') {
+	/* '...' or "..." string */
+	for (p = str+1; *p && *p != bq; p++)
+	    ;
+	return p;
+    } else if (bq == '`') {
+	/* `...` string */
+	state = st_start;
+	p = str+1;
+	if (!*p)
+		return p;
+
+	while ((c = *p++)) {
+	    switch (state) {
+	    case st_start:
+		switch (c) {
+		case '\\':
+		    state = st_backslash;
+		    break;
+		case '`':
+		    return p-1;	/* Found the end */
+		default:
+		    break;
+		}
+		break;
+
+	    case st_backslash:
+		/*
+		 * Note: for the purpose of finding the end of the string,
+		 * all successor states to st_backslash are functionally
+		 * equivalent to st_start, since either a backslash or
+		 * a backquote will force a return to the st_start state.
+		 */
+		state = st_start;
+		break;
+	    }
+	}
+	return p-1;		/* Unterminated string... */
+    } else {
+	return str;		/* Not a string... */
+    }
+}

+ 44 - 0
nasm/asm/quote.h

@@ -0,0 +1,44 @@
+/* ----------------------------------------------------------------------- *
+ *   
+ *   Copyright 1996-2009 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *     
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+#ifndef NASM_QUOTE_H
+#define NASM_QUOTE_H
+
+#include "compiler.h"
+
+char *nasm_quote(const char *str, size_t len);
+size_t nasm_unquote(char *str, char **endptr);
+char *nasm_skip_string(char *str);
+
+#endif /* NASM_QUOTE_H */
+

+ 70 - 0
nasm/asm/rdstrnum.c

@@ -0,0 +1,70 @@
+/* ----------------------------------------------------------------------- *
+ *   
+ *   Copyright 1996-2016 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *     
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * rdstrnum.c
+ *
+ * This converts a NASM string to an integer, used when a string
+ * is used in an integer constant context.  This is a binary conversion,
+ * not a conversion from a numeric constant in text form.
+ */
+
+#include "compiler.h"
+#include "nasmlib.h"
+#include "nasm.h"
+
+int64_t readstrnum(char *str, int length, bool *warn)
+{
+    int64_t charconst = 0;
+    int i;
+
+    *warn = false;
+
+    str += length;
+    if (globalbits == 64) {
+        for (i = 0; i < length; i++) {
+            if (charconst & UINT64_C(0xFF00000000000000))
+                *warn = true;
+            charconst &= ~UINT64_C(0xFF00000000000000);
+            charconst = (charconst << 8) + (uint8_t)*--str;
+        }
+    } else {
+        for (i = 0; i < length; i++) {
+            if (charconst & UINT32_C(0xFF000000))
+                *warn = true;
+            charconst &= ~UINT32_C(0xFF000000);
+            charconst = (charconst << 8) + (uint8_t)*--str;
+        }
+    }
+    return charconst;
+}

+ 51 - 0
nasm/asm/segalloc.c

@@ -0,0 +1,51 @@
+/* ----------------------------------------------------------------------- *
+ *   
+ *   Copyright 1996-2018 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *     
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * nasmlib.c	library routines for the Netwide Assembler
+ */
+
+#include "compiler.h"
+#include "nasm.h"
+#include "nasmlib.h"
+#include "insns.h"
+
+static int32_t next_seg  = 2;
+
+int32_t seg_alloc(void)
+{
+    int32_t this_seg = next_seg;
+
+    next_seg += 2;
+    return this_seg;
+}

+ 345 - 0
nasm/asm/stdscan.c

@@ -0,0 +1,345 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 1996-2016 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+#include "compiler.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "nasm.h"
+#include "nasmlib.h"
+#include "error.h"
+#include "quote.h"
+#include "stdscan.h"
+#include "insns.h"
+
+/*
+ * Standard scanner routine used by parser.c and some output
+ * formats. It keeps a succession of temporary-storage strings in
+ * stdscan_tempstorage, which can be cleared using stdscan_reset.
+ */
+static char *stdscan_bufptr = NULL;
+static char **stdscan_tempstorage = NULL;
+static int stdscan_tempsize = 0, stdscan_templen = 0;
+#define STDSCAN_TEMP_DELTA 256
+
+void stdscan_set(char *str)
+{
+        stdscan_bufptr = str;
+}
+
+char *stdscan_get(void)
+{
+        return stdscan_bufptr;
+}
+
+static void stdscan_pop(void)
+{
+    nasm_free(stdscan_tempstorage[--stdscan_templen]);
+}
+
+void stdscan_reset(void)
+{
+    while (stdscan_templen > 0)
+        stdscan_pop();
+}
+
+/*
+ * Unimportant cleanup is done to avoid confusing people who are trying
+ * to debug real memory leaks
+ */
+void stdscan_cleanup(void)
+{
+    stdscan_reset();
+    nasm_free(stdscan_tempstorage);
+}
+
+static char *stdscan_copy(char *p, int len)
+{
+    char *text;
+
+    text = nasm_malloc(len + 1);
+    memcpy(text, p, len);
+    text[len] = '\0';
+
+    if (stdscan_templen >= stdscan_tempsize) {
+        stdscan_tempsize += STDSCAN_TEMP_DELTA;
+        stdscan_tempstorage = nasm_realloc(stdscan_tempstorage,
+                                           stdscan_tempsize *
+                                           sizeof(char *));
+    }
+    stdscan_tempstorage[stdscan_templen++] = text;
+
+    return text;
+}
+
+/*
+ * a token is enclosed with braces. proper token type will be assigned
+ * accordingly with the token flag.
+ */
+static int stdscan_handle_brace(struct tokenval *tv)
+{
+    if (!(tv->t_flag & TFLAG_BRC_ANY)) {
+        /* invalid token is put inside braces */
+        nasm_error(ERR_NONFATAL,
+                    "`%s' is not a valid decorator with braces", tv->t_charptr);
+        tv->t_type = TOKEN_INVALID;
+    } else if (tv->t_flag & TFLAG_BRC_OPT) {
+        if (is_reg_class(OPMASKREG, tv->t_integer)) {
+            /* within braces, opmask register is now used as a mask */
+            tv->t_type = TOKEN_OPMASK;
+        }
+    }
+
+    return tv->t_type;
+}
+
+int stdscan(void *private_data, struct tokenval *tv)
+{
+    char ourcopy[MAX_KEYWORD + 1], *r, *s;
+
+    (void)private_data;         /* Don't warn that this parameter is unused */
+
+    stdscan_bufptr = nasm_skip_spaces(stdscan_bufptr);
+    if (!*stdscan_bufptr)
+        return tv->t_type = TOKEN_EOS;
+
+    /* we have a token; either an id, a number or a char */
+    if (isidstart(*stdscan_bufptr) ||
+        (*stdscan_bufptr == '$' && isidstart(stdscan_bufptr[1]))) {
+        /* now we've got an identifier */
+        bool is_sym = false;
+        int token_type;
+
+        if (*stdscan_bufptr == '$') {
+            is_sym = true;
+            stdscan_bufptr++;
+        }
+
+        r = stdscan_bufptr++;
+        /* read the entire buffer to advance the buffer pointer but... */
+        while (isidchar(*stdscan_bufptr))
+            stdscan_bufptr++;
+
+        /* ... copy only up to IDLEN_MAX-1 characters */
+        tv->t_charptr = stdscan_copy(r, stdscan_bufptr - r < IDLEN_MAX ?
+                                     stdscan_bufptr - r : IDLEN_MAX - 1);
+
+        if (is_sym || stdscan_bufptr - r > MAX_KEYWORD)
+            return tv->t_type = TOKEN_ID;       /* bypass all other checks */
+
+        for (s = tv->t_charptr, r = ourcopy; *s; s++)
+            *r++ = nasm_tolower(*s);
+        *r = '\0';
+        /* right, so we have an identifier sitting in temp storage. now,
+         * is it actually a register or instruction name, or what? */
+        token_type = nasm_token_hash(ourcopy, tv);
+
+	if (unlikely(tv->t_flag & TFLAG_WARN)) {
+	    nasm_error(ERR_WARNING|ERR_PASS1|WARN_PTR,
+		       "`%s' is not a NASM keyword", tv->t_charptr);
+	}
+
+        if (likely(!(tv->t_flag & TFLAG_BRC))) {
+            /* most of the tokens fall into this case */
+            return token_type;
+        } else {
+            return tv->t_type = TOKEN_ID;
+        }
+    } else if (*stdscan_bufptr == '$' && !isnumchar(stdscan_bufptr[1])) {
+        /*
+         * It's a $ sign with no following hex number; this must
+         * mean it's a Here token ($), evaluating to the current
+         * assembly location, or a Base token ($$), evaluating to
+         * the base of the current segment.
+         */
+        stdscan_bufptr++;
+        if (*stdscan_bufptr == '$') {
+            stdscan_bufptr++;
+            return tv->t_type = TOKEN_BASE;
+        }
+        return tv->t_type = TOKEN_HERE;
+    } else if (isnumstart(*stdscan_bufptr)) {   /* now we've got a number */
+        bool rn_error;
+        bool is_hex = false;
+        bool is_float = false;
+        bool has_e = false;
+        char c;
+
+        r = stdscan_bufptr;
+
+        if (*stdscan_bufptr == '$') {
+            stdscan_bufptr++;
+            is_hex = true;
+        }
+
+        for (;;) {
+            c = *stdscan_bufptr++;
+
+            if (!is_hex && (c == 'e' || c == 'E')) {
+                has_e = true;
+                if (*stdscan_bufptr == '+' || *stdscan_bufptr == '-') {
+                    /*
+                     * e can only be followed by +/- if it is either a
+                     * prefixed hex number or a floating-point number
+                     */
+                    is_float = true;
+                    stdscan_bufptr++;
+                }
+            } else if (c == 'H' || c == 'h' || c == 'X' || c == 'x') {
+                is_hex = true;
+            } else if (c == 'P' || c == 'p') {
+                is_float = true;
+                if (*stdscan_bufptr == '+' || *stdscan_bufptr == '-')
+                    stdscan_bufptr++;
+            } else if (isnumchar(c))
+                ; /* just advance */
+            else if (c == '.')
+                is_float = true;
+            else
+                break;
+        }
+        stdscan_bufptr--;       /* Point to first character beyond number */
+
+        if (has_e && !is_hex) {
+            /* 1e13 is floating-point, but 1e13h is not */
+            is_float = true;
+        }
+
+        if (is_float) {
+            tv->t_charptr = stdscan_copy(r, stdscan_bufptr - r);
+            return tv->t_type = TOKEN_FLOAT;
+        } else {
+            r = stdscan_copy(r, stdscan_bufptr - r);
+            tv->t_integer = readnum(r, &rn_error);
+            stdscan_pop();
+            if (rn_error) {
+                /* some malformation occurred */
+                return tv->t_type = TOKEN_ERRNUM;
+            }
+            tv->t_charptr = NULL;
+            return tv->t_type = TOKEN_NUM;
+        }
+    } else if (*stdscan_bufptr == '\'' || *stdscan_bufptr == '"' ||
+               *stdscan_bufptr == '`') {
+        /* a quoted string */
+        char start_quote = *stdscan_bufptr;
+        tv->t_charptr = stdscan_bufptr;
+        tv->t_inttwo = nasm_unquote(tv->t_charptr, &stdscan_bufptr);
+        if (*stdscan_bufptr != start_quote)
+            return tv->t_type = TOKEN_ERRSTR;
+        stdscan_bufptr++;       /* Skip final quote */
+        return tv->t_type = TOKEN_STR;
+    } else if (*stdscan_bufptr == '{') {
+        /* now we've got a decorator */
+        int token_len;
+
+        stdscan_bufptr = nasm_skip_spaces(stdscan_bufptr);
+
+        r = ++stdscan_bufptr;
+        /*
+         * read the entire buffer to advance the buffer pointer
+         * {rn-sae}, {rd-sae}, {ru-sae}, {rz-sae} contain '-' in tokens.
+         */
+        while (isbrcchar(*stdscan_bufptr))
+            stdscan_bufptr++;
+
+        token_len = stdscan_bufptr - r;
+
+        /* ... copy only up to DECOLEN_MAX-1 characters */
+        tv->t_charptr = stdscan_copy(r, token_len < DECOLEN_MAX ?
+                                        token_len : DECOLEN_MAX - 1);
+
+        stdscan_bufptr = nasm_skip_spaces(stdscan_bufptr);
+        /* if brace is not closed properly or token is too long  */
+        if ((*stdscan_bufptr != '}') || (token_len > MAX_KEYWORD)) {
+            nasm_error(ERR_NONFATAL,
+                       "invalid decorator token inside braces");
+            return tv->t_type = TOKEN_INVALID;
+        }
+
+        stdscan_bufptr++;       /* skip closing brace */
+
+        for (s = tv->t_charptr, r = ourcopy; *s; s++)
+            *r++ = nasm_tolower(*s);
+        *r = '\0';
+
+        /* right, so we have a decorator sitting in temp storage. */
+        nasm_token_hash(ourcopy, tv);
+
+        /* handle tokens inside braces */
+        return stdscan_handle_brace(tv);
+    } else if (*stdscan_bufptr == ';') {
+        /* a comment has happened - stay */
+        return tv->t_type = TOKEN_EOS;
+    } else if (stdscan_bufptr[0] == '>' && stdscan_bufptr[1] == '>') {
+        stdscan_bufptr += 2;
+        return tv->t_type = TOKEN_SHR;
+    } else if (stdscan_bufptr[0] == '<' && stdscan_bufptr[1] == '<') {
+        stdscan_bufptr += 2;
+        return tv->t_type = TOKEN_SHL;
+    } else if (stdscan_bufptr[0] == '/' && stdscan_bufptr[1] == '/') {
+        stdscan_bufptr += 2;
+        return tv->t_type = TOKEN_SDIV;
+    } else if (stdscan_bufptr[0] == '%' && stdscan_bufptr[1] == '%') {
+        stdscan_bufptr += 2;
+        return tv->t_type = TOKEN_SMOD;
+    } else if (stdscan_bufptr[0] == '=' && stdscan_bufptr[1] == '=') {
+        stdscan_bufptr += 2;
+        return tv->t_type = TOKEN_EQ;
+    } else if (stdscan_bufptr[0] == '<' && stdscan_bufptr[1] == '>') {
+        stdscan_bufptr += 2;
+        return tv->t_type = TOKEN_NE;
+    } else if (stdscan_bufptr[0] == '!' && stdscan_bufptr[1] == '=') {
+        stdscan_bufptr += 2;
+        return tv->t_type = TOKEN_NE;
+    } else if (stdscan_bufptr[0] == '<' && stdscan_bufptr[1] == '=') {
+        stdscan_bufptr += 2;
+        return tv->t_type = TOKEN_LE;
+    } else if (stdscan_bufptr[0] == '>' && stdscan_bufptr[1] == '=') {
+        stdscan_bufptr += 2;
+        return tv->t_type = TOKEN_GE;
+    } else if (stdscan_bufptr[0] == '&' && stdscan_bufptr[1] == '&') {
+        stdscan_bufptr += 2;
+        return tv->t_type = TOKEN_DBL_AND;
+    } else if (stdscan_bufptr[0] == '^' && stdscan_bufptr[1] == '^') {
+        stdscan_bufptr += 2;
+        return tv->t_type = TOKEN_DBL_XOR;
+    } else if (stdscan_bufptr[0] == '|' && stdscan_bufptr[1] == '|') {
+        stdscan_bufptr += 2;
+        return tv->t_type = TOKEN_DBL_OR;
+    } else                      /* just an ordinary char */
+        return tv->t_type = (uint8_t)(*stdscan_bufptr++);
+}

+ 49 - 0
nasm/asm/stdscan.h

@@ -0,0 +1,49 @@
+/* ----------------------------------------------------------------------- *
+ *   
+ *   Copyright 1996-2009 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *     
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/* 
+ * stdscan.h	header file for stdscan.c
+ */
+
+#ifndef NASM_STDSCAN_H
+#define NASM_STDSCAN_H
+
+/* Standard scanner */
+void stdscan_set(char *str);
+char *stdscan_get(void);
+void stdscan_reset(void);
+int stdscan(void *private_data, struct tokenval *tv);
+int nasm_token_hash(const char *token, struct tokenval *tv);
+void stdscan_cleanup(void);
+
+#endif

+ 359 - 0
nasm/asm/strfunc.c

@@ -0,0 +1,359 @@
+/* ----------------------------------------------------------------------- *
+ *   
+ *   Copyright 1996-2009 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *     
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * strfunc.c
+ *
+ * String transformation functions
+ */
+
+#include "nasmlib.h"
+#include "nasm.h"
+
+/*
+ * Convert a string in UTF-8 format to UTF-16LE
+ */
+static size_t utf8_to_16le(uint8_t *str, size_t len, char *op)
+{
+#define EMIT(x) do { if (op) { WRITESHORT(op,x); } outlen++; } while(0)
+
+    size_t outlen = 0;
+    int expect = 0;
+    uint8_t c;
+    uint32_t v = 0, vmin = 0;
+
+    while (len--) {
+        c = *str++;
+
+        if (expect) {
+            if ((c & 0xc0) != 0x80) {
+                expect = 0;
+                return -1;
+            } else {
+                v = (v << 6) | (c & 0x3f);
+                if (!--expect) {
+                    if (v < vmin || v > 0x10ffff ||
+                        (v >= 0xd800 && v <= 0xdfff)) {
+                        return -1;
+                    } else if (v > 0xffff) {
+                        v -= 0x10000;
+                        EMIT(0xd800 | (v >> 10));
+                        EMIT(0xdc00 | (v & 0x3ff));
+                    } else {
+                        EMIT(v);
+                    }
+                }
+                continue;
+            }
+        }
+
+        if (c < 0x80) {
+            EMIT(c);
+        } else if (c < 0xc0 || c >= 0xfe) {
+            /* Invalid UTF-8 */
+            return -1;
+        } else if (c < 0xe0) {
+            v = c & 0x1f;
+            expect = 1;
+            vmin = 0x80;
+        } else if (c < 0xf0) {
+            v = c & 0x0f;
+            expect = 2;
+            vmin = 0x800;
+        } else if (c < 0xf8) {
+            v = c & 0x07;
+            expect = 3;
+            vmin = 0x10000;
+        } else if (c < 0xfc) {
+            v = c & 0x03;
+            expect = 4;
+            vmin = 0x200000;
+        } else {
+            v = c & 0x01;
+            expect = 5;
+            vmin = 0x4000000;
+        }
+    }
+
+    return expect ? (size_t)-1 : outlen << 1;
+
+#undef EMIT
+}
+
+/*
+ * Convert a string in UTF-8 format to UTF-16BE
+ */
+static size_t utf8_to_16be(uint8_t *str, size_t len, char *op)
+{
+#define EMIT(x)                                 \
+    do {                                        \
+        uint16_t _y = (x);                      \
+        if (op) {                               \
+            WRITECHAR(op, _y >> 8);             \
+            WRITECHAR(op, _y);                  \
+        }                                       \
+        outlen++;                               \
+    } while (0)                                 \
+
+    size_t outlen = 0;
+    int expect = 0;
+    uint8_t c;
+    uint32_t v = 0, vmin = 0;
+
+    while (len--) {
+        c = *str++;
+
+        if (expect) {
+            if ((c & 0xc0) != 0x80) {
+                expect = 0;
+                return -1;
+            } else {
+                v = (v << 6) | (c & 0x3f);
+                if (!--expect) {
+                    if (v < vmin || v > 0x10ffff ||
+                        (v >= 0xd800 && v <= 0xdfff)) {
+                        return -1;
+                    } else if (v > 0xffff) {
+                        v -= 0x10000;
+                        EMIT(0xdc00 | (v & 0x3ff));
+                        EMIT(0xd800 | (v >> 10));
+                    } else {
+                        EMIT(v);
+                    }
+                }
+                continue;
+            }
+        }
+
+        if (c < 0x80) {
+            EMIT(c);
+        } else if (c < 0xc0 || c >= 0xfe) {
+            /* Invalid UTF-8 */
+            return -1;
+        } else if (c < 0xe0) {
+            v = c & 0x1f;
+            expect = 1;
+            vmin = 0x80;
+        } else if (c < 0xf0) {
+            v = c & 0x0f;
+            expect = 2;
+            vmin = 0x800;
+        } else if (c < 0xf8) {
+            v = c & 0x07;
+            expect = 3;
+            vmin = 0x10000;
+        } else if (c < 0xfc) {
+            v = c & 0x03;
+            expect = 4;
+            vmin = 0x200000;
+        } else {
+            v = c & 0x01;
+            expect = 5;
+            vmin = 0x4000000;
+        }
+    }
+
+    return expect ? (size_t)-1 : outlen << 1;
+
+#undef EMIT
+}
+
+/*
+ * Convert a string in UTF-8 format to UTF-32LE
+ */
+static size_t utf8_to_32le(uint8_t *str, size_t len, char *op)
+{
+#define EMIT(x) do { if (op) { WRITELONG(op,x); } outlen++; } while(0)
+
+    size_t outlen = 0;
+    int expect = 0;
+    uint8_t c;
+    uint32_t v = 0, vmin = 0;
+
+    while (len--) {
+        c = *str++;
+
+        if (expect) {
+            if ((c & 0xc0) != 0x80) {
+                return -1;
+            } else {
+                v = (v << 6) | (c & 0x3f);
+                if (!--expect) {
+                    if (v < vmin || (v >= 0xd800 && v <= 0xdfff)) {
+                        return -1;
+                    } else {
+                        EMIT(v);
+                    }
+                }
+                continue;
+            }
+        }
+
+        if (c < 0x80) {
+            EMIT(c);
+        } else if (c < 0xc0 || c >= 0xfe) {
+            /* Invalid UTF-8 */
+            return -1;
+        } else if (c < 0xe0) {
+            v = c & 0x1f;
+            expect = 1;
+            vmin = 0x80;
+        } else if (c < 0xf0) {
+            v = c & 0x0f;
+            expect = 2;
+            vmin = 0x800;
+        } else if (c < 0xf8) {
+            v = c & 0x07;
+            expect = 3;
+            vmin = 0x10000;
+        } else if (c < 0xfc) {
+            v = c & 0x03;
+            expect = 4;
+            vmin = 0x200000;
+        } else {
+            v = c & 0x01;
+            expect = 5;
+            vmin = 0x4000000;
+        }
+    }
+
+    return expect ? (size_t)-1 : outlen << 2;
+
+#undef EMIT
+}
+
+/*
+ * Convert a string in UTF-8 format to UTF-32BE
+ */
+static size_t utf8_to_32be(uint8_t *str, size_t len, char *op)
+{
+#define EMIT(x)                                         \
+    do {                                                \
+        uint32_t _y = (x);                              \
+        if (op) {                                       \
+            WRITECHAR(op,_y >> 24);                     \
+            WRITECHAR(op,_y >> 16);                     \
+            WRITECHAR(op,_y >> 8);                      \
+            WRITECHAR(op,_y);                           \
+        }                                               \
+        outlen++;                                       \
+    } while (0)
+
+    size_t outlen = 0;
+    int expect = 0;
+    uint8_t c;
+    uint32_t v = 0, vmin = 0;
+
+    while (len--) {
+        c = *str++;
+
+        if (expect) {
+            if ((c & 0xc0) != 0x80) {
+                return -1;
+            } else {
+                v = (v << 6) | (c & 0x3f);
+                if (!--expect) {
+                    if (v < vmin || (v >= 0xd800 && v <= 0xdfff)) {
+                        return -1;
+                    } else {
+                        EMIT(v);
+                    }
+                }
+                continue;
+            }
+        }
+
+        if (c < 0x80) {
+            EMIT(c);
+        } else if (c < 0xc0 || c >= 0xfe) {
+            /* Invalid UTF-8 */
+            return -1;
+        } else if (c < 0xe0) {
+            v = c & 0x1f;
+            expect = 1;
+            vmin = 0x80;
+        } else if (c < 0xf0) {
+            v = c & 0x0f;
+            expect = 2;
+            vmin = 0x800;
+        } else if (c < 0xf8) {
+            v = c & 0x07;
+            expect = 3;
+            vmin = 0x10000;
+        } else if (c < 0xfc) {
+            v = c & 0x03;
+            expect = 4;
+            vmin = 0x200000;
+        } else {
+            v = c & 0x01;
+            expect = 5;
+            vmin = 0x4000000;
+        }
+    }
+
+    return expect ? (size_t)-1 : outlen << 2;
+
+#undef EMIT
+}
+
+typedef size_t (*transform_func)(uint8_t *, size_t, char *);
+
+/*
+ * Apply a specific string transform and return it in a nasm_malloc'd
+ * buffer, returning the length.  On error, returns (size_t)-1 and no
+ * buffer is allocated.
+ */
+size_t string_transform(char *str, size_t len, char **out, enum strfunc func)
+{
+    /* This should match enum strfunc in nasm.h */
+    static const transform_func str_transforms[] = {
+        utf8_to_16le,
+        utf8_to_16le,
+        utf8_to_16be,
+        utf8_to_32le,
+        utf8_to_32le,
+        utf8_to_32be,
+    };
+    transform_func transform = str_transforms[func];
+    size_t outlen;
+    uint8_t *s = (uint8_t *)str;
+    char *buf;
+
+    outlen = transform(s, len, NULL);
+    if (outlen == (size_t)-1)
+        return -1;
+
+    *out = buf = nasm_malloc(outlen+1);
+    buf[outlen] = '\0'; /* Forcibly null-terminate the buffer */
+    return transform(s, len, buf);
+}

+ 135 - 0
nasm/asm/tokens.dat

@@ -0,0 +1,135 @@
+## --------------------------------------------------------------------------
+##   
+##   Copyright 1996-2016 The NASM Authors - All Rights Reserved
+##   See the file AUTHORS included with the NASM distribution for
+##   the specific copyright holders.
+##
+##   Redistribution and use in source and binary forms, with or without
+##   modification, are permitted provided that the following
+##   conditions are met:
+##
+##   * Redistributions of source code must retain the above copyright
+##     notice, this list of conditions and the following disclaimer.
+##   * Redistributions in binary form must reproduce the above
+##     copyright notice, this list of conditions and the following
+##     disclaimer in the documentation and/or other materials provided
+##     with the distribution.
+##     
+##     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+##     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+##     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+##     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+##     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+##     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+##     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+##     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+##     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+##     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+##     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+##     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+##     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+##
+## --------------------------------------------------------------------------
+
+#
+# Tokens other than instructions and registers
+#
+
+% TOKEN_PREFIX, 0, 0, P_*
+a16
+a32
+a64
+asp
+lock
+o16
+o32
+o64
+osp
+rep
+repe
+repne
+repnz
+repz
+times
+wait
+xacquire
+xrelease
+bnd
+nobnd
+
+% TOKEN_SPECIAL, 0, 0, S_*
+abs
+byte
+dword
+far
+long
+near
+nosplit
+oword
+qword
+rel
+short
+strict
+to
+tword
+word
+yword
+zword
+
+% TOKEN_ID, 0, TFLAG_WARN, 0
+ptr
+
+% TOKEN_FLOAT, 0, 0, 0
+__infinity__
+__nan__
+__qnan__
+__snan__
+
+% TOKEN_FLOATIZE, 0, 0, FLOAT_{__float*__}
+__float8__
+__float16__
+__float32__
+__float64__
+__float80m__
+__float80e__
+__float128l__
+__float128h__
+
+% TOKEN_STRFUNC, 0, 0, STRFUNC_{__*__}
+__utf16__
+__utf16le__
+__utf16be__
+__utf32__
+__utf32le__
+__utf32be__
+
+% TOKEN_IFUNC, 0, 0, IFUNC_{__*__}
+__ilog2e__
+__ilog2w__
+__ilog2f__
+__ilog2c__
+
+% TOKEN_*, 0, 0, 0
+seg
+wrt
+
+% TOKEN_DECORATOR, 0, TFLAG_BRC | TFLAG_BRDCAST , BRC_1TO{1to*}
+1to2
+1to4
+1to8
+1to16
+
+% TOKEN_DECORATOR, 0, TFLAG_BRC, BRC_{*-sae}
+rn-sae
+rd-sae
+ru-sae
+rz-sae
+
+% TOKEN_DECORATOR, 0, TFLAG_BRC, BRC_*
+sae
+z
+
+% TOKEN_PREFIX, 0, TFLAG_BRC, P_*
+evex
+vex3
+vex2

+ 11 - 0
nasm/asm/tokens.h

@@ -0,0 +1,11 @@
+/*
+ * This file is generated from insns.dat, regs.dat and token.dat
+ * by tokhash.pl; do not edit.
+ */
+
+#ifndef NASM_TOKENS_H
+#define NASM_TOKENS_H
+
+#define MAX_KEYWORD 17 /* length of longest keyword */
+
+#endif /* NASM_TOKENS_H */

Файловите разлики са ограничени, защото са твърде много
+ 6431 - 0
nasm/asm/tokhash.c


+ 284 - 0
nasm/asm/tokhash.pl

@@ -0,0 +1,284 @@
+#!/usr/bin/perl
+## --------------------------------------------------------------------------
+##   
+##   Copyright 1996-2014 The NASM Authors - All Rights Reserved
+##   See the file AUTHORS included with the NASM distribution for
+##   the specific copyright holders.
+##
+##   Redistribution and use in source and binary forms, with or without
+##   modification, are permitted provided that the following
+##   conditions are met:
+##
+##   * Redistributions of source code must retain the above copyright
+##     notice, this list of conditions and the following disclaimer.
+##   * Redistributions in binary form must reproduce the above
+##     copyright notice, this list of conditions and the following
+##     disclaimer in the documentation and/or other materials provided
+##     with the distribution.
+##     
+##     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+##     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+##     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+##     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+##     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+##     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+##     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+##     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+##     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+##     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+##     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+##     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+##     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+##
+## --------------------------------------------------------------------------
+
+#
+# Generate a perfect hash for token parsing
+#
+# Usage: tokenhash.pl insns.dat regs.dat tokens.dat
+#
+
+require 'phash.ph';
+
+my($output, $insns_dat, $regs_dat, $tokens_dat) = @ARGV;
+
+%tokens = ();
+@tokendata = ();
+
+#
+# List of condition codes
+#
+@conditions = ('a', 'ae', 'b', 'be', 'c', 'e', 'g', 'ge', 'l', 'le',
+	       'na', 'nae', 'nb', 'nbe', 'nc', 'ne', 'ng', 'nge', 'nl',
+	       'nle', 'no', 'np', 'ns', 'nz', 'o', 'p', 'pe', 'po', 's', 'z');
+
+#
+# Read insns.dat
+#
+open(ID, '<', $insns_dat) or die "$0: cannot open $insns_dat: $!\n";
+while (defined($line = <ID>)) {
+    if ($line =~ /^([A-Z0-9_]+)(|cc)\s/) {
+	$insn = $1.$2;
+	($token = $1) =~ tr/A-Z/a-z/;
+
+	if ($2 eq '') {
+	    # Single instruction token
+	    if (!defined($tokens{$token})) {
+		$tokens{$token} = scalar @tokendata;
+		push(@tokendata, "\"${token}\", TOKEN_INSN, C_none, 0, I_${insn}");
+	    }
+	} else {
+	    # Conditional instruction
+	    foreach $cc (@conditions) {
+		if (!defined($tokens{$token.$cc})) {
+		    $tokens{$token.$cc} = scalar @tokendata;
+		    push(@tokendata, "\"${token}${cc}\", TOKEN_INSN, C_\U$cc\E, 0, I_${insn}");
+		}
+	    }
+	}
+    }
+}
+close(ID);
+
+#
+# Read regs.dat
+#
+open(RD, '<', $regs_dat) or die "$0: cannot open $regs_dat: $!\n";
+while (defined($line = <RD>)) {
+    if ($line =~ /^([a-z0-9_-]+)\s*\S+\s*\S+\s*[0-9]+\s*(\S*)/) {
+	$reg = $1;
+	$reg_flag = $2;
+
+	if ($reg =~ /^(.*[^0-9])([0-9]+)\-([0-9]+)(|[^0-9].*)$/) {
+	    $nregs = $3-$2+1;
+	    $reg = $1.$2.$4;
+	    $reg_nr = $2;
+	    $reg_prefix = $1;
+	    $reg_suffix = $4;
+	} else {
+	    $nregs = 1;
+	    undef $reg_prefix, $reg_suffix;
+	}
+
+	while ($nregs--) {
+	    if (defined($tokens{$reg})) {
+		die "Duplicate definition: $reg\n";
+	    }
+	    $tokens{$reg} = scalar @tokendata;
+	    if ($reg_flag eq '') {
+	        push(@tokendata, "\"${reg}\", TOKEN_REG, 0, 0, R_\U${reg}\E");
+	    } else {
+	        push(@tokendata, "\"${reg}\", TOKEN_REG, 0, ${reg_flag}, R_\U${reg}\E");
+	    }
+
+	    if (defined($reg_prefix)) {
+		$reg_nr++;
+		$reg = sprintf("%s%u%s", $reg_prefix, $reg_nr, $reg_suffix);
+	    } else {
+		# Not a dashed sequence
+		die if ($nregs);
+	    }
+	}
+    }
+}
+close(RD);
+
+#
+# Read tokens.dat
+#
+open(TD, '<', $tokens_dat) or die "$0: cannot open $tokens_dat: $!\n";
+while (defined($line = <TD>)) {
+    if ($line =~ /^\%\s+(.*)$/) {
+	$pattern = $1;
+    } elsif ($line =~ /^([a-z0-9_-]+)/) {
+	$token = $1;
+
+	if (defined($tokens{$token})) {
+	    die "Duplicate definition: $token\n";
+	}
+	$tokens{$token} = scalar @tokendata;
+
+	$data = $pattern;
+	if ($data =~ /^(.*)\{(.*)\}(.*)$/) {
+	    my $head = $1, $tail = $3;
+	    my $px = $2;
+
+	    $px =~ s/\*/(.*)/g;
+	    if ($token =~ /$px/i) {
+		$data = $head."\U$1".$tail;
+	    } else {
+		die "$0: token $token doesn't match $px\n";
+	    }
+	}
+
+	$data =~ s/\*/\U$token/g;
+
+	push(@tokendata, "\"$token\", $data");
+    }
+}
+close(TD);
+
+if ($output eq 'h') {
+    #
+    # tokens.h
+    #
+
+    $max_len = 0;
+    foreach $token (keys(%tokens)) {
+	if (length($token) > $max_len) {
+	    $max_len = length($token);
+	}
+    }
+
+    print "/*\n";
+    print " * This file is generated from insns.dat, regs.dat and token.dat\n";
+    print " * by tokhash.pl; do not edit.\n";
+    print " */\n";
+    print "\n";
+
+    print "#ifndef NASM_TOKENS_H\n";
+    print "#define NASM_TOKENS_H\n";
+    print "\n";
+    print "#define MAX_KEYWORD $max_len /* length of longest keyword */\n";
+    print "\n";
+    print "#endif /* NASM_TOKENS_H */\n";
+} elsif ($output eq 'c') {
+    #
+    # tokhash.c
+    #
+
+    @hashinfo = gen_perfect_hash(\%tokens);
+    if (!@hashinfo) {
+	die "$0: no hash found\n";
+    }
+
+    # Paranoia...
+    verify_hash_table(\%tokens, \@hashinfo);
+
+    ($n, $sv, $g) = @hashinfo;
+    $sv2 = $sv+2;
+
+    die if ($n & ($n-1));
+
+    print "/*\n";
+    print " * This file is generated from insns.dat, regs.dat and token.dat\n";
+    print " * by tokhash.pl; do not edit.\n";
+    print " */\n";
+    print "\n";
+
+    print "#include \"compiler.h\"\n";
+    print "#include <string.h>\n";
+    print "#include \"nasm.h\"\n";
+    print "#include \"hashtbl.h\"\n";
+    print "#include \"insns.h\"\n";
+    print "#include \"stdscan.h\"\n";
+    print "\n";
+
+    # These somewhat odd sizes and ordering thereof are due to the
+    # relative ranges of the types; this makes it fit in 16 bytes on
+    # 64-bit machines and 12 bytes on 32-bit machines.
+    print "struct tokendata {\n";
+    print "    const char *string;\n";
+    print "    int16_t tokentype;\n";
+    print "    int8_t aux;\n";
+    print "    int8_t tokflag;\n";
+    print "    int32_t num;\n";
+    print "};\n";
+    print "\n";
+
+    print "int nasm_token_hash(const char *token, struct tokenval *tv)\n";
+    print "{\n";
+
+    # Put a large value in unused slots.  This makes it extremely unlikely
+    # that any combination that involves unused slot will pass the range test.
+    # This speeds up rejection of unrecognized tokens, i.e. identifiers.
+    print "#define UNUSED (65535/3)\n";
+
+    print "    static const int16_t hash1[$n] = {\n";
+    for ($i = 0; $i < $n; $i++) {
+	my $h = ${$g}[$i*2+0];
+	print "        ", defined($h) ? $h : 'UNUSED', ",\n";
+    }
+    print "    };\n";
+
+    print "    static const int16_t hash2[$n] = {\n";
+    for ($i = 0; $i < $n; $i++) {
+	my $h = ${$g}[$i*2+1];
+	print "        ", defined($h) ? $h : 'UNUSED', ",\n";
+    }
+    print "    };\n";
+
+    printf "    static const struct tokendata tokendata[%d] = {\n", scalar(@tokendata);
+    foreach $d (@tokendata) {
+	print "        { ", $d, " },\n";
+    }
+    print  "    };\n";
+
+    print  "    uint32_t k1, k2;\n";
+    print  "    uint64_t crc;\n";
+    # For correct overflow behavior, "ix" should be unsigned of the same
+    # width as the hash arrays.
+    print  "    uint16_t ix;\n";
+    print  "    const struct tokendata *data;\n";
+    print  "\n";
+    printf "    tv->t_flag = 0;\n";
+    printf "    crc = crc64(UINT64_C(0x%08x%08x), token);\n",
+	$$sv[0], $$sv[1];
+    print  "    k1 = (uint32_t)crc;\n";
+    print  "    k2 = (uint32_t)(crc >> 32);\n";
+    print  "\n";
+    printf "    ix = hash1[k1 & 0x%x] + hash2[k2 & 0x%x];\n", $n-1, $n-1;
+    printf "    if (ix >= %d)\n", scalar(@tokendata);
+    print  "        return tv->t_type = TOKEN_ID;\n";
+    print  "\n";
+    print  "    data = &tokendata[ix];\n";
+
+    print  "    if (strcmp(data->string, token))\n";
+    print  "        return tv->t_type = TOKEN_ID;\n";
+    print  "\n";
+    print  "    tv->t_integer = data->num;\n";
+    print  "    tv->t_inttwo  = data->aux;\n";
+    print  "    tv->t_flag    = data->tokflag;\n";
+    print  "    return tv->t_type = data->tokentype;\n";
+    print  "}\n";
+}

+ 8 - 0
nasm/autogen.sh

@@ -0,0 +1,8 @@
+#!/bin/sh -xe
+#
+# Simple script to run the appropriate autotools from a repository.
+#
+autoreconf
+rm -rf autom4te.cache config.log config.status
+rm -f Makefile rdoff/Makefile doc/Makefile
+rm -f config.h.in config.h config/config.h

+ 64 - 0
nasm/common/common.c

@@ -0,0 +1,64 @@
+/* ----------------------------------------------------------------------- *
+ *   
+ *   Copyright 1996-2016 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *     
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * common.c - code common to nasm and ndisasm
+ */
+
+#include "compiler.h"
+#include "nasm.h"
+#include "nasmlib.h"
+#include "insns.h"
+
+/*
+ * The current bit size of the CPU
+ */
+int globalbits = 0;
+/*
+ * Common list of prefix names; ideally should be auto-generated
+ * from tokens.dat
+ */
+const char *prefix_name(int token)
+{
+    static const char *prefix_names[] = {
+        "a16", "a32", "a64", "asp", "lock", "o16", "o32", "o64", "osp",
+        "rep", "repe", "repne", "repnz", "repz", "times", "wait",
+        "xacquire", "xrelease", "bnd"
+    };
+    unsigned int prefix = token-PREFIX_ENUM_START;
+
+    if (prefix >= ARRAY_SIZE(prefix_names))
+	return NULL;
+
+    return prefix_names[prefix];
+}

Файловите разлики са ограничени, защото са твърде много
+ 6482 - 0
nasm/config.log


Файловите разлики са ограничени, защото са твърде много
+ 1129 - 0
nasm/config.status


+ 544 - 0
nasm/config/config.h

@@ -0,0 +1,544 @@
+/* config/config.h.  Generated from config.h.in by configure.  */
+/* config/config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 to call abort() on panics (internal errors), for debugging. */
+/* #undef ABORT_ON_PANIC */
+
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
+/* Define to 1 if compiled with the `-fdata-sections' compiler flag */
+/* #undef CFLAG_FDATA_SECTIONS */
+
+/* Define to 1 if compiled with the `-ffunction-sections' compiler flag */
+/* #undef CFLAG_FFUNCTION_SECTIONS */
+
+/* Define to 1 if compiled with the `-fgnu89-inline' compiler flag */
+/* #undef CFLAG_FGNU89_INLINE */
+
+/* Define to 1 if compiled with the `-flto' compiler flag */
+/* #undef CFLAG_FLTO */
+
+/* Define to 1 if compiled with the `-fno-common' compiler flag */
+#define CFLAG_FNO_COMMON 1
+
+/* Define to 1 if compiled with the `-fno-omit-frame-pointer' compiler flag */
+/* #undef CFLAG_FNO_OMIT_FRAME_POINTER */
+
+/* Define to 1 if compiled with the `-fsanitize=address' compiler flag */
+/* #undef CFLAG_FSANITIZE_ADDRESS */
+
+/* Define to 1 if compiled with the `-fsanitize=undefined' compiler flag */
+/* #undef CFLAG_FSANITIZE_UNDEFINED */
+
+/* Define to 1 if compiled with the `-fvisibility=hidden' compiler flag */
+#define CFLAG_FVISIBILITY_HIDDEN 1
+
+/* Define to 1 if compiled with the `-fwrapv' compiler flag */
+#define CFLAG_FWRAPV 1
+
+/* Define to 1 if compiled with the `-ggdb3' compiler flag */
+/* #undef CFLAG_GGDB3 */
+
+/* Define to 1 if compiled with the `-pedantic' compiler flag */
+#define CFLAG_PEDANTIC 1
+
+/* Define to 1 if compiled with the `-U__STRICT_ANSI__' compiler flag */
+#define CFLAG_U_STRICT_ANSI 1
+
+/* Define to 1 if compiled with the `-W' compiler flag */
+#define CFLAG_W 1
+
+/* Define to 1 if compiled with the `-Wall' compiler flag */
+#define CFLAG_WALL 1
+
+/* Define to 1 if compiled with the `-Wc90-c99-compat' compiler flag */
+#define CFLAG_WC90_C99_COMPAT 1
+
+/* Define to 1 if compiled with the `-Werror' compiler flag */
+/* #undef CFLAG_WERROR */
+
+/* Define to 1 if compiled with the `-Werror=attributes' compiler flag */
+#define CFLAG_WERROR_ATTRIBUTES 1
+
+/* Define to 1 if compiled with the `-Werror=comment' compiler flag */
+#define CFLAG_WERROR_COMMENT 1
+
+/* Define to 1 if compiled with the `-Werror=implicit' compiler flag */
+#define CFLAG_WERROR_IMPLICIT 1
+
+/* Define to 1 if compiled with the `-Werror=missing-braces' compiler flag */
+#define CFLAG_WERROR_MISSING_BRACES 1
+
+/* Define to 1 if compiled with the `-Werror=missing-declarations' compiler
+   flag */
+#define CFLAG_WERROR_MISSING_DECLARATIONS 1
+
+/* Define to 1 if compiled with the `-Werror=missing-prototypes' compiler flag
+   */
+#define CFLAG_WERROR_MISSING_PROTOTYPES 1
+
+/* Define to 1 if compiled with the `-Werror=pointer-arith' compiler flag */
+#define CFLAG_WERROR_POINTER_ARITH 1
+
+/* Define to 1 if compiled with the `-Werror=return-type' compiler flag */
+#define CFLAG_WERROR_RETURN_TYPE 1
+
+/* Define to 1 if compiled with the `-Werror=strict-prototypes' compiler flag
+   */
+/* #undef CFLAG_WERROR_STRICT_PROTOTYPES */
+
+/* Define to 1 if compiled with the `-Werror=trigraphs' compiler flag */
+#define CFLAG_WERROR_TRIGRAPHS 1
+
+/* Define to 1 if compiled with the `-Werror=unknown-warning-option' compiler
+   flag */
+/* #undef CFLAG_WERROR_UNKNOWN_WARNING_OPTION */
+
+/* Define to 1 if compiled with the `-Werror=vla' compiler flag */
+#define CFLAG_WERROR_VLA 1
+
+/* Define to 1 if compiled with the `-Wlong-long' compiler flag */
+#define CFLAG_WLONG_LONG 1
+
+/* Define to 1 if compiled with the `-Wl,--gc-sections' compiler flag */
+/* #undef CFLAG_WL_GC_SECTIONS */
+
+/* Define to 1 if compiled with the `-Wpedantic-ms-format' compiler flag */
+/* #undef CFLAG_WPEDANTIC_MS_FORMAT */
+
+/* Define to 1 if compiled with the `-Wshift-negative-value' compiler flag */
+#define CFLAG_WSHIFT_NEGATIVE_VALUE 1
+
+/* Define to 1 if compiled with the `-Wstringop-truncation' compiler flag */
+/* #undef CFLAG_WSTRINGOP_TRUNCATION */
+
+/* Define to 1 if you have the `access' function. */
+#define HAVE_ACCESS 1
+
+/* Define to 1 if you have the `canonicalize_file_name' function. */
+#define HAVE_CANONICALIZE_FILE_NAME 1
+
+/* Define to 1 if you have the `cpu_to_le16' intrinsic function. */
+/* #undef HAVE_CPU_TO_LE16 */
+
+/* Define to 1 if you have the `cpu_to_le32' intrinsic function. */
+/* #undef HAVE_CPU_TO_LE32 */
+
+/* Define to 1 if you have the `cpu_to_le64' intrinsic function. */
+/* #undef HAVE_CPU_TO_LE64 */
+
+/* Define to 1 if you have the declaration of `strcasecmp', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRCASECMP 1
+
+/* Define to 1 if you have the declaration of `stricmp', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRICMP 0
+
+/* Define to 1 if you have the declaration of `strlcpy', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRLCPY 0
+
+/* Define to 1 if you have the declaration of `strncasecmp', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRNCASECMP 1
+
+/* Define to 1 if you have the declaration of `strnicmp', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRNICMP 0
+
+/* Define to 1 if you have the declaration of `strnlen', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRNLEN 1
+
+/* Define to 1 if you have the declaration of `strrchrnul', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRRCHRNUL 0
+
+/* Define to 1 if you have the declaration of `strsep', and to 0 if you don't.
+   */
+#define HAVE_DECL_STRSEP 1
+
+/* Define to 1 if you have the <endian.h> header file. */
+#define HAVE_ENDIAN_H 1
+
+/* Define to 1 if you have the `faccessat' function. */
+#define HAVE_FACCESSAT 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the `fileno' function. */
+#define HAVE_FILENO 1
+
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+#define HAVE_FSEEKO 1
+
+/* Define to 1 if you have the `fstat' function. */
+#define HAVE_FSTAT 1
+
+/* Define to 1 if you have the `ftruncate' function. */
+#define HAVE_FTRUNCATE 1
+
+/* Define to 1 if your compiler supports __attribute__((alloc_size)) on
+   functions */
+#define HAVE_FUNC_ATTRIBUTE_ALLOC_SIZE 1
+
+/* Define to 1 if your compiler supports __attribute__((cold)) on functions */
+#define HAVE_FUNC_ATTRIBUTE_COLD 1
+
+/* Define to 1 if your compiler supports __attribute__((const)) on functions
+   */
+#define HAVE_FUNC_ATTRIBUTE_CONST 1
+
+/* Define to 1 if your compiler supports __attribute__((error)) on functions
+   */
+#define HAVE_FUNC_ATTRIBUTE_ERROR 1
+
+/* Define to 1 if your compiler supports __attribute__((format)) on functions
+   */
+#define HAVE_FUNC_ATTRIBUTE_FORMAT 1
+
+/* Define to 1 if your compiler supports __attribute__((malloc)) on functions
+   */
+#define HAVE_FUNC_ATTRIBUTE_MALLOC 1
+
+/* Define to 1 if your compiler supports __attribute__((noreturn)) on
+   functions */
+#define HAVE_FUNC_ATTRIBUTE_NORETURN 1
+
+/* Define to 1 if your compiler supports __attribute__((pure)) on functions */
+#define HAVE_FUNC_ATTRIBUTE_PURE 1
+
+/* Define to 1 if your compiler supports __attribute__((returns_nonnull)) on
+   functions */
+#define HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL 1
+
+/* Define to 1 if your compiler supports __attribute__((sentinel)) on
+   functions */
+#define HAVE_FUNC_ATTRIBUTE_SENTINEL 1
+
+/* Define to 1 if you have the `getgid' function. */
+#define HAVE_GETGID 1
+
+/* Define to 1 if you have the `getpagesize' function. */
+#define HAVE_GETPAGESIZE 1
+
+/* Define to 1 if you have the `getuid' function. */
+#define HAVE_GETUID 1
+
+/* Define to 1 if you have the `htole16' intrinsic function. */
+#define HAVE_HTOLE16 1
+
+/* Define to 1 if you have the `htole32' intrinsic function. */
+#define HAVE_HTOLE32 1
+
+/* Define to 1 if you have the `htole64' intrinsic function. */
+#define HAVE_HTOLE64 1
+
+/* Define to 1 if you have the <intrin.h> header file. */
+/* #undef HAVE_INTRIN_H */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <io.h> header file. */
+/* #undef HAVE_IO_H */
+
+/* Define to 1 if you have the <machine/endian.h> header file. */
+/* #undef HAVE_MACHINE_ENDIAN_H */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have a working `mmap' system call. */
+#define HAVE_MMAP 1
+
+/* Define to 1 if you have the `pathconf' function. */
+#define HAVE_PATHCONF 1
+
+/* Define to 1 if you have the `realpath' function. */
+#define HAVE_REALPATH 1
+
+/* Define to 1 if you have the `snprintf' function. */
+#define HAVE_SNPRINTF 1
+
+/* Define to 1 if you have the `stat' function. */
+#define HAVE_STAT 1
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#define HAVE_STDBOOL_H 1
+
+/* Define to 1 if your compiler supports C99 extern inline */
+#define HAVE_STDC_INLINE 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <stdnoreturn.h> header file. */
+#define HAVE_STDNORETURN_H 1
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#define HAVE_STRCASECMP 1
+
+/* Define to 1 if you have the `stricmp' function. */
+/* #undef HAVE_STRICMP */
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the `strlcpy' function. */
+/* #undef HAVE_STRLCPY */
+
+/* Define to 1 if you have the `strncasecmp' function. */
+#define HAVE_STRNCASECMP 1
+
+/* Define to 1 if you have the `strnicmp' function. */
+/* #undef HAVE_STRNICMP */
+
+/* Define to 1 if you have the `strnlen' function. */
+#define HAVE_STRNLEN 1
+
+/* Define to 1 if you have the `strrchrnul' function. */
+/* #undef HAVE_STRRCHRNUL */
+
+/* Define to 1 if you have the `strsep' function. */
+#define HAVE_STRSEP 1
+
+/* Define to 1 if the system has the type `struct stat'. */
+#define HAVE_STRUCT_STAT 1
+
+/* Define to 1 if the system has the type `struct _stati64'. */
+/* #undef HAVE_STRUCT__STATI64 */
+
+/* Define to 1 if you have the `sysconf' function. */
+#define HAVE_SYSCONF 1
+
+/* Define to 1 if you have the <sys/endian.h> header file. */
+/* #undef HAVE_SYS_ENDIAN_H */
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#define HAVE_SYS_MMAN_H 1
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#define HAVE_SYS_PARAM_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if the system has the type `uintptr_t'. */
+#define HAVE_UINTPTR_T 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+
+/* Define to 1 if you have the `_access' function. */
+/* #undef HAVE__ACCESS */
+
+/* Define to 1 if you have the `_BitScanReverse' intrinsic function. */
+/* #undef HAVE__BITSCANREVERSE */
+
+/* Define to 1 if you have the `_BitScanReverse64' intrinsic function. */
+/* #undef HAVE__BITSCANREVERSE64 */
+
+/* Define to 1 if the system has the type `_Bool'. */
+#define HAVE__BOOL 1
+
+/* Define to 1 if you have the `_byteswap_uint64' intrinsic function. */
+/* #undef HAVE__BYTESWAP_UINT64 */
+
+/* Define to 1 if you have the `_byteswap_ulong' intrinsic function. */
+/* #undef HAVE__BYTESWAP_ULONG */
+
+/* Define to 1 if you have the `_byteswap_ushort' intrinsic function. */
+/* #undef HAVE__BYTESWAP_USHORT */
+
+/* Define to 1 if you have the `_chsize' function. */
+/* #undef HAVE__CHSIZE */
+
+/* Define to 1 if you have the `_chsize_s' function. */
+/* #undef HAVE__CHSIZE_S */
+
+/* Define to 1 if you have the `_filelengthi64' function. */
+/* #undef HAVE__FILELENGTHI64 */
+
+/* Define to 1 if you have the `_fileno' function. */
+/* #undef HAVE__FILENO */
+
+/* Define to 1 if you have the `_fseeki64' function. */
+/* #undef HAVE__FSEEKI64 */
+
+/* Define to 1 if you have the `_fstati64' function. */
+/* #undef HAVE__FSTATI64 */
+
+/* Define to 1 if you have the `_fullpath' function. */
+/* #undef HAVE__FULLPATH */
+
+/* Define to 1 if you have the `_snprintf' function. */
+/* #undef HAVE__SNPRINTF */
+
+/* Define to 1 if you have the `_stati64' function. */
+/* #undef HAVE__STATI64 */
+
+/* Define to 1 if you have the `_vsnprintf' function. */
+/* #undef HAVE__VSNPRINTF */
+
+/* Define to 1 if you have the `__bswap_16' intrinsic function. */
+#define HAVE___BSWAP_16 1
+
+/* Define to 1 if you have the `__bswap_32' intrinsic function. */
+#define HAVE___BSWAP_32 1
+
+/* Define to 1 if you have the `__bswap_64' intrinsic function. */
+#define HAVE___BSWAP_64 1
+
+/* Define to 1 if you have the `__builtin_bswap16' intrinsic function. */
+#define HAVE___BUILTIN_BSWAP16 1
+
+/* Define to 1 if you have the `__builtin_bswap32' intrinsic function. */
+#define HAVE___BUILTIN_BSWAP32 1
+
+/* Define to 1 if you have the `__builtin_bswap64' intrinsic function. */
+#define HAVE___BUILTIN_BSWAP64 1
+
+/* Define to 1 if you have the `__builtin_clz' intrinsic function. */
+#define HAVE___BUILTIN_CLZ 1
+
+/* Define to 1 if you have the `__builtin_clzl' intrinsic function. */
+#define HAVE___BUILTIN_CLZL 1
+
+/* Define to 1 if you have the `__builtin_clzll' intrinsic function. */
+#define HAVE___BUILTIN_CLZLL 1
+
+/* Define to 1 if you have the `__builtin_constant_p' intrinsic function. */
+#define HAVE___BUILTIN_CONSTANT_P 1
+
+/* Define to 1 if you have the `__builtin_expect' intrinsic function. */
+#define HAVE___BUILTIN_EXPECT 1
+
+/* Define to 1 if you have the `__cpu_to_le16' intrinsic function. */
+/* #undef HAVE___CPU_TO_LE16 */
+
+/* Define to 1 if you have the `__cpu_to_le32' intrinsic function. */
+/* #undef HAVE___CPU_TO_LE32 */
+
+/* Define to 1 if you have the `__cpu_to_le64' intrinsic function. */
+/* #undef HAVE___CPU_TO_LE64 */
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME ""
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING ""
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME ""
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION ""
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+
+
+/* Define to 1 if your processor stores words with the most significant byte
+   first (like Motorola and SPARC, unlike Intel and VAX). */
+/* #undef WORDS_BIGENDIAN */
+
+/* Define to 1 if your processor stores words with the least significant byte
+   first (like Intel and VAX, unlike Motorola and SPARC). */
+#define WORDS_LITTLEENDIAN 1
+
+/* Enable large inode numbers on Mac OS X 10.5.  */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+/* #undef _LARGEFILE_SOURCE */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+/* #undef inline */
+#endif
+
+/* Define to the equivalent of the C99 'restrict' keyword, or to
+   nothing if this is not supported.  Do not define if restrict is
+   supported directly.  */
+#define restrict __restrict
+/* Work around a bug in Sun C++: it does not support _Restrict or
+   __restrict__, even though the corresponding Sun C compiler ends up with
+   "#define restrict _Restrict" or "#define restrict __restrict__" in the
+   previous line.  Perhaps some future version of Sun C++ will work with
+   restrict; if so, hopefully it defines __RESTRICT like Sun C does.  */
+#if defined __SUNPRO_CC && !defined __RESTRICT
+# define _Restrict
+# define __restrict__
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+/* #undef size_t */
+
+/* Define to the type of an unsigned integer type wide enough to hold a
+   pointer, if such a type exists, and if the system does not define it. */
+/* #undef uintptr_t */

+ 543 - 0
nasm/config/config.h.in

@@ -0,0 +1,543 @@
+/* config/config.h.in.  Generated from configure.ac by autoheader.  */
+
+/* Define to 1 to call abort() on panics (internal errors), for debugging. */
+#undef ABORT_ON_PANIC
+
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
+/* Define to 1 if compiled with the `-fdata-sections' compiler flag */
+#undef CFLAG_FDATA_SECTIONS
+
+/* Define to 1 if compiled with the `-ffunction-sections' compiler flag */
+#undef CFLAG_FFUNCTION_SECTIONS
+
+/* Define to 1 if compiled with the `-fgnu89-inline' compiler flag */
+#undef CFLAG_FGNU89_INLINE
+
+/* Define to 1 if compiled with the `-flto' compiler flag */
+#undef CFLAG_FLTO
+
+/* Define to 1 if compiled with the `-fno-common' compiler flag */
+#undef CFLAG_FNO_COMMON
+
+/* Define to 1 if compiled with the `-fno-omit-frame-pointer' compiler flag */
+#undef CFLAG_FNO_OMIT_FRAME_POINTER
+
+/* Define to 1 if compiled with the `-fsanitize=address' compiler flag */
+#undef CFLAG_FSANITIZE_ADDRESS
+
+/* Define to 1 if compiled with the `-fsanitize=undefined' compiler flag */
+#undef CFLAG_FSANITIZE_UNDEFINED
+
+/* Define to 1 if compiled with the `-fvisibility=hidden' compiler flag */
+#undef CFLAG_FVISIBILITY_HIDDEN
+
+/* Define to 1 if compiled with the `-fwrapv' compiler flag */
+#undef CFLAG_FWRAPV
+
+/* Define to 1 if compiled with the `-ggdb3' compiler flag */
+#undef CFLAG_GGDB3
+
+/* Define to 1 if compiled with the `-pedantic' compiler flag */
+#undef CFLAG_PEDANTIC
+
+/* Define to 1 if compiled with the `-U__STRICT_ANSI__' compiler flag */
+#undef CFLAG_U_STRICT_ANSI
+
+/* Define to 1 if compiled with the `-W' compiler flag */
+#undef CFLAG_W
+
+/* Define to 1 if compiled with the `-Wall' compiler flag */
+#undef CFLAG_WALL
+
+/* Define to 1 if compiled with the `-Wc90-c99-compat' compiler flag */
+#undef CFLAG_WC90_C99_COMPAT
+
+/* Define to 1 if compiled with the `-Werror' compiler flag */
+#undef CFLAG_WERROR
+
+/* Define to 1 if compiled with the `-Werror=attributes' compiler flag */
+#undef CFLAG_WERROR_ATTRIBUTES
+
+/* Define to 1 if compiled with the `-Werror=comment' compiler flag */
+#undef CFLAG_WERROR_COMMENT
+
+/* Define to 1 if compiled with the `-Werror=implicit' compiler flag */
+#undef CFLAG_WERROR_IMPLICIT
+
+/* Define to 1 if compiled with the `-Werror=missing-braces' compiler flag */
+#undef CFLAG_WERROR_MISSING_BRACES
+
+/* Define to 1 if compiled with the `-Werror=missing-declarations' compiler
+   flag */
+#undef CFLAG_WERROR_MISSING_DECLARATIONS
+
+/* Define to 1 if compiled with the `-Werror=missing-prototypes' compiler flag
+   */
+#undef CFLAG_WERROR_MISSING_PROTOTYPES
+
+/* Define to 1 if compiled with the `-Werror=pointer-arith' compiler flag */
+#undef CFLAG_WERROR_POINTER_ARITH
+
+/* Define to 1 if compiled with the `-Werror=return-type' compiler flag */
+#undef CFLAG_WERROR_RETURN_TYPE
+
+/* Define to 1 if compiled with the `-Werror=strict-prototypes' compiler flag
+   */
+#undef CFLAG_WERROR_STRICT_PROTOTYPES
+
+/* Define to 1 if compiled with the `-Werror=trigraphs' compiler flag */
+#undef CFLAG_WERROR_TRIGRAPHS
+
+/* Define to 1 if compiled with the `-Werror=unknown-warning-option' compiler
+   flag */
+#undef CFLAG_WERROR_UNKNOWN_WARNING_OPTION
+
+/* Define to 1 if compiled with the `-Werror=vla' compiler flag */
+#undef CFLAG_WERROR_VLA
+
+/* Define to 1 if compiled with the `-Wlong-long' compiler flag */
+#undef CFLAG_WLONG_LONG
+
+/* Define to 1 if compiled with the `-Wl,--gc-sections' compiler flag */
+#undef CFLAG_WL_GC_SECTIONS
+
+/* Define to 1 if compiled with the `-Wpedantic-ms-format' compiler flag */
+#undef CFLAG_WPEDANTIC_MS_FORMAT
+
+/* Define to 1 if compiled with the `-Wshift-negative-value' compiler flag */
+#undef CFLAG_WSHIFT_NEGATIVE_VALUE
+
+/* Define to 1 if compiled with the `-Wstringop-truncation' compiler flag */
+#undef CFLAG_WSTRINGOP_TRUNCATION
+
+/* Define to 1 if you have the `access' function. */
+#undef HAVE_ACCESS
+
+/* Define to 1 if you have the `canonicalize_file_name' function. */
+#undef HAVE_CANONICALIZE_FILE_NAME
+
+/* Define to 1 if you have the `cpu_to_le16' intrinsic function. */
+#undef HAVE_CPU_TO_LE16
+
+/* Define to 1 if you have the `cpu_to_le32' intrinsic function. */
+#undef HAVE_CPU_TO_LE32
+
+/* Define to 1 if you have the `cpu_to_le64' intrinsic function. */
+#undef HAVE_CPU_TO_LE64
+
+/* Define to 1 if you have the declaration of `strcasecmp', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRCASECMP
+
+/* Define to 1 if you have the declaration of `stricmp', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRICMP
+
+/* Define to 1 if you have the declaration of `strlcpy', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRLCPY
+
+/* Define to 1 if you have the declaration of `strncasecmp', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRNCASECMP
+
+/* Define to 1 if you have the declaration of `strnicmp', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRNICMP
+
+/* Define to 1 if you have the declaration of `strnlen', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRNLEN
+
+/* Define to 1 if you have the declaration of `strrchrnul', and to 0 if you
+   don't. */
+#undef HAVE_DECL_STRRCHRNUL
+
+/* Define to 1 if you have the declaration of `strsep', and to 0 if you don't.
+   */
+#undef HAVE_DECL_STRSEP
+
+/* Define to 1 if you have the <endian.h> header file. */
+#undef HAVE_ENDIAN_H
+
+/* Define to 1 if you have the `faccessat' function. */
+#undef HAVE_FACCESSAT
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the `fileno' function. */
+#undef HAVE_FILENO
+
+/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
+#undef HAVE_FSEEKO
+
+/* Define to 1 if you have the `fstat' function. */
+#undef HAVE_FSTAT
+
+/* Define to 1 if you have the `ftruncate' function. */
+#undef HAVE_FTRUNCATE
+
+/* Define to 1 if your compiler supports __attribute__((alloc_size)) on
+   functions */
+#undef HAVE_FUNC_ATTRIBUTE_ALLOC_SIZE
+
+/* Define to 1 if your compiler supports __attribute__((cold)) on functions */
+#undef HAVE_FUNC_ATTRIBUTE_COLD
+
+/* Define to 1 if your compiler supports __attribute__((const)) on functions
+   */
+#undef HAVE_FUNC_ATTRIBUTE_CONST
+
+/* Define to 1 if your compiler supports __attribute__((error)) on functions
+   */
+#undef HAVE_FUNC_ATTRIBUTE_ERROR
+
+/* Define to 1 if your compiler supports __attribute__((format)) on functions
+   */
+#undef HAVE_FUNC_ATTRIBUTE_FORMAT
+
+/* Define to 1 if your compiler supports __attribute__((malloc)) on functions
+   */
+#undef HAVE_FUNC_ATTRIBUTE_MALLOC
+
+/* Define to 1 if your compiler supports __attribute__((noreturn)) on
+   functions */
+#undef HAVE_FUNC_ATTRIBUTE_NORETURN
+
+/* Define to 1 if your compiler supports __attribute__((pure)) on functions */
+#undef HAVE_FUNC_ATTRIBUTE_PURE
+
+/* Define to 1 if your compiler supports __attribute__((returns_nonnull)) on
+   functions */
+#undef HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL
+
+/* Define to 1 if your compiler supports __attribute__((sentinel)) on
+   functions */
+#undef HAVE_FUNC_ATTRIBUTE_SENTINEL
+
+/* Define to 1 if you have the `getgid' function. */
+#undef HAVE_GETGID
+
+/* Define to 1 if you have the `getpagesize' function. */
+#undef HAVE_GETPAGESIZE
+
+/* Define to 1 if you have the `getuid' function. */
+#undef HAVE_GETUID
+
+/* Define to 1 if you have the `htole16' intrinsic function. */
+#undef HAVE_HTOLE16
+
+/* Define to 1 if you have the `htole32' intrinsic function. */
+#undef HAVE_HTOLE32
+
+/* Define to 1 if you have the `htole64' intrinsic function. */
+#undef HAVE_HTOLE64
+
+/* Define to 1 if you have the <intrin.h> header file. */
+#undef HAVE_INTRIN_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <io.h> header file. */
+#undef HAVE_IO_H
+
+/* Define to 1 if you have the <machine/endian.h> header file. */
+#undef HAVE_MACHINE_ENDIAN_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have a working `mmap' system call. */
+#undef HAVE_MMAP
+
+/* Define to 1 if you have the `pathconf' function. */
+#undef HAVE_PATHCONF
+
+/* Define to 1 if you have the `realpath' function. */
+#undef HAVE_REALPATH
+
+/* Define to 1 if you have the `snprintf' function. */
+#undef HAVE_SNPRINTF
+
+/* Define to 1 if you have the `stat' function. */
+#undef HAVE_STAT
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#undef HAVE_STDBOOL_H
+
+/* Define to 1 if your compiler supports C99 extern inline */
+#undef HAVE_STDC_INLINE
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <stdnoreturn.h> header file. */
+#undef HAVE_STDNORETURN_H
+
+/* Define to 1 if you have the `strcasecmp' function. */
+#undef HAVE_STRCASECMP
+
+/* Define to 1 if you have the `stricmp' function. */
+#undef HAVE_STRICMP
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strlcpy' function. */
+#undef HAVE_STRLCPY
+
+/* Define to 1 if you have the `strncasecmp' function. */
+#undef HAVE_STRNCASECMP
+
+/* Define to 1 if you have the `strnicmp' function. */
+#undef HAVE_STRNICMP
+
+/* Define to 1 if you have the `strnlen' function. */
+#undef HAVE_STRNLEN
+
+/* Define to 1 if you have the `strrchrnul' function. */
+#undef HAVE_STRRCHRNUL
+
+/* Define to 1 if you have the `strsep' function. */
+#undef HAVE_STRSEP
+
+/* Define to 1 if the system has the type `struct stat'. */
+#undef HAVE_STRUCT_STAT
+
+/* Define to 1 if the system has the type `struct _stati64'. */
+#undef HAVE_STRUCT__STATI64
+
+/* Define to 1 if you have the `sysconf' function. */
+#undef HAVE_SYSCONF
+
+/* Define to 1 if you have the <sys/endian.h> header file. */
+#undef HAVE_SYS_ENDIAN_H
+
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#undef HAVE_SYS_MMAN_H
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if the system has the type `uintptr_t'. */
+#undef HAVE_UINTPTR_T
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#undef HAVE_VSNPRINTF
+
+/* Define to 1 if you have the `_access' function. */
+#undef HAVE__ACCESS
+
+/* Define to 1 if you have the `_BitScanReverse' intrinsic function. */
+#undef HAVE__BITSCANREVERSE
+
+/* Define to 1 if you have the `_BitScanReverse64' intrinsic function. */
+#undef HAVE__BITSCANREVERSE64
+
+/* Define to 1 if the system has the type `_Bool'. */
+#undef HAVE__BOOL
+
+/* Define to 1 if you have the `_byteswap_uint64' intrinsic function. */
+#undef HAVE__BYTESWAP_UINT64
+
+/* Define to 1 if you have the `_byteswap_ulong' intrinsic function. */
+#undef HAVE__BYTESWAP_ULONG
+
+/* Define to 1 if you have the `_byteswap_ushort' intrinsic function. */
+#undef HAVE__BYTESWAP_USHORT
+
+/* Define to 1 if you have the `_chsize' function. */
+#undef HAVE__CHSIZE
+
+/* Define to 1 if you have the `_chsize_s' function. */
+#undef HAVE__CHSIZE_S
+
+/* Define to 1 if you have the `_filelengthi64' function. */
+#undef HAVE__FILELENGTHI64
+
+/* Define to 1 if you have the `_fileno' function. */
+#undef HAVE__FILENO
+
+/* Define to 1 if you have the `_fseeki64' function. */
+#undef HAVE__FSEEKI64
+
+/* Define to 1 if you have the `_fstati64' function. */
+#undef HAVE__FSTATI64
+
+/* Define to 1 if you have the `_fullpath' function. */
+#undef HAVE__FULLPATH
+
+/* Define to 1 if you have the `_snprintf' function. */
+#undef HAVE__SNPRINTF
+
+/* Define to 1 if you have the `_stati64' function. */
+#undef HAVE__STATI64
+
+/* Define to 1 if you have the `_vsnprintf' function. */
+#undef HAVE__VSNPRINTF
+
+/* Define to 1 if you have the `__bswap_16' intrinsic function. */
+#undef HAVE___BSWAP_16
+
+/* Define to 1 if you have the `__bswap_32' intrinsic function. */
+#undef HAVE___BSWAP_32
+
+/* Define to 1 if you have the `__bswap_64' intrinsic function. */
+#undef HAVE___BSWAP_64
+
+/* Define to 1 if you have the `__builtin_bswap16' intrinsic function. */
+#undef HAVE___BUILTIN_BSWAP16
+
+/* Define to 1 if you have the `__builtin_bswap32' intrinsic function. */
+#undef HAVE___BUILTIN_BSWAP32
+
+/* Define to 1 if you have the `__builtin_bswap64' intrinsic function. */
+#undef HAVE___BUILTIN_BSWAP64
+
+/* Define to 1 if you have the `__builtin_clz' intrinsic function. */
+#undef HAVE___BUILTIN_CLZ
+
+/* Define to 1 if you have the `__builtin_clzl' intrinsic function. */
+#undef HAVE___BUILTIN_CLZL
+
+/* Define to 1 if you have the `__builtin_clzll' intrinsic function. */
+#undef HAVE___BUILTIN_CLZLL
+
+/* Define to 1 if you have the `__builtin_constant_p' intrinsic function. */
+#undef HAVE___BUILTIN_CONSTANT_P
+
+/* Define to 1 if you have the `__builtin_expect' intrinsic function. */
+#undef HAVE___BUILTIN_EXPECT
+
+/* Define to 1 if you have the `__cpu_to_le16' intrinsic function. */
+#undef HAVE___CPU_TO_LE16
+
+/* Define to 1 if you have the `__cpu_to_le32' intrinsic function. */
+#undef HAVE___CPU_TO_LE32
+
+/* Define to 1 if you have the `__cpu_to_le64' intrinsic function. */
+#undef HAVE___CPU_TO_LE64
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Enable extensions on AIX 3, Interix.  */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris.  */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop.  */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris.  */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
+/* Define to 1 if your processor stores words with the most significant byte
+   first (like Motorola and SPARC, unlike Intel and VAX). */
+#undef WORDS_BIGENDIAN
+
+/* Define to 1 if your processor stores words with the least significant byte
+   first (like Intel and VAX, unlike Motorola and SPARC). */
+#undef WORDS_LITTLEENDIAN
+
+/* Enable large inode numbers on Mac OS X 10.5.  */
+#ifndef _DARWIN_USE_64_BIT_INODE
+# define _DARWIN_USE_64_BIT_INODE 1
+#endif
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
+#undef _LARGEFILE_SOURCE
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to 1 if on MINIX. */
+#undef _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to the equivalent of the C99 'restrict' keyword, or to
+   nothing if this is not supported.  Do not define if restrict is
+   supported directly.  */
+#undef restrict
+/* Work around a bug in Sun C++: it does not support _Restrict or
+   __restrict__, even though the corresponding Sun C compiler ends up with
+   "#define restrict _Restrict" or "#define restrict __restrict__" in the
+   previous line.  Perhaps some future version of Sun C++ will work with
+   restrict; if so, hopefully it defines __RESTRICT like Sun C does.  */
+#if defined __SUNPRO_CC && !defined __RESTRICT
+# define _Restrict
+# define __restrict__
+#endif
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to the type of an unsigned integer type wide enough to hold a
+   pointer, if such a type exists, and if the system does not define it. */
+#undef uintptr_t

+ 192 - 0
nasm/config/msvc.h

@@ -0,0 +1,192 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 2016 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * config/msvc.h
+ *
+ * Compiler definitions for Microsoft Visual C++;
+ * instead of config.h.in.  See config.h.in for the
+ * variables which can be defined here.
+ *
+ * MSDN seems to have information back to Visual Studio 2003, so aim
+ * for compatibility that far back.
+ *
+ * Relevant _MSC_VER values:
+ * 1310 - Visual Studio 2003
+ * 1400 - Visual Studio 2005
+ * 1500 - Visual Studio 2008
+ * 1600 - Visual Studio 2010
+ * 1700 - Visual Studio 2012
+ * 1800 - Visual Studio 2013
+ * 1900 - Visual Studio 2015
+ * 1910 - Visual Studio 2017
+ */
+
+#ifndef NASM_CONFIG_MSVC_H
+#define NASM_CONFIG_MSVC_H
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#if _MSC_VER >= 1800
+# define HAVE_INTTYPES_H 1
+#endif
+
+/* Define to 1 if you have the <io.h> header file. */
+#define HAVE_IO_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the `access' function. */
+#define HAVE_ACCESS 1
+#if _MSC_VER < 1400
+# define access _access
+#endif
+
+/* Define to 1 if you have the `fileno' function. */
+#define HAVE_FILENO 1
+#if _MSC_VER < 1400
+# define fileno _fileno
+#endif
+
+/* Define to 1 if you have the `snprintf' function. */
+#define HAVE_SNPRINTF 1
+#if _MSC_VER < 1900
+# define snprintf _snprinf
+#endif
+
+/* Define to 1 if you have the `_chsize' function. */
+#define HAVE__CHSIZE 1
+
+/* Define to 1 if you have the `_chsize_s' function. */
+#if _MSC_VER >= 1400
+# define HAVE__CHSIZE_S 1
+#endif
+
+/* Define to 1 if you have the `_filelengthi64' function. */
+#define HAVE__FILELENGTHI64 1
+
+/* Define to 1 if you have the `_fseeki64' function. */
+#define HAVE__FSEEKI64 1
+
+/* Define to 1 if you have the `_fullpath' function. */
+#define HAVE__FULLPATH 1
+
+/* Define to 1 if the system has the type `struct _stati64'. */
+#define HAVE_STRUCT__STATI64
+
+/* Define to 1 if you have the `_stati64' function. */
+#define HAVE__STATI64 1
+
+/* Define to 1 if you have the `_fstati64' function. */
+#define HAVE__FSTATI64 1
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#if _MSC_VER >= 1800
+# define HAVE_STDBOOL_H 1
+#endif
+
+/* Define to 1 if you have the `stricmp' function. */
+#define HAVE_STRICMP 1
+/* Define to 1 if you have the declaration of `stricmp', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRICMP 1
+#if _MSC_VER < 1400
+# define stricmp _stricmp
+#endif
+
+/* Define to 1 if you have the `strnicmp' function. */
+#define HAVE_STRNICMP 1
+/* Define to 1 if you have the declaration of `strnicmp', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRNICMP 1
+#if _MSC_VER < 1400
+# define strnicmp _strnicmp
+#endif
+
+#if _MSC_VER >= 1400
+/* Define to 1 if you have the `strnlen' function. */
+# define HAVE_STRNLEN 1
+/* Define to 1 if you have the declaration of `strnlen', and to 0 if you
+   don't. */
+# define HAVE_DECL_STRNLEN 1
+#endif
+
+/* Define to 1 if the system has the type `uintptr_t'. */
+#if _MSC_VER >= 1900
+# define HAVE_UINTPTR_T 1
+#else
+/* Define to the type of an unsigned integer type wide enough to hold a
+   pointer, if such a type exists, and if the system does not define it. */
+# define uintptr_t size_t
+#endif
+
+/* Define to 1 if you have the `vsnprintf' function. */
+#define HAVE_VSNPRINTF 1
+#if _MSC_VER < 1400
+# define vsnprint _vsnprintf
+#endif
+
+/* Define to 1 if the system has the type `_Bool'. */
+#if _MSC_VER >= 1900
+# define HAVE__BOOL 1
+#endif
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if your processor stores words with the least significant byte
+   first (like Intel and VAX, unlike Motorola and SPARC). */
+#define WORDS_LITTLEENDIAN 1
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#define inline __inline
+
+/* Define to the equivalent of the C99 'restrict' keyword, or to
+   nothing if this is not supported.  Do not define if restrict is
+   supported directly.  */
+#define restrict __restrict
+
+#endif /* NASM_CONFIG_MSVC_H */

+ 51 - 0
nasm/config/unknown.h

@@ -0,0 +1,51 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 2016 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * config/unknown.h
+ *
+ * Compiler definitions for an unknown compiler.  Assume the worst.
+ */
+
+#ifndef NASM_CONFIG_UNKNOWN_H
+#define NASM_CONFIG_UNKNOWN_H
+
+/* Assume these don't exist */
+#ifndef inline
+# define inline
+#endif
+#ifndef restrict
+# define restrict
+#endif
+
+#endif /* NASM_CONFIG_UNKNOWN_H */

+ 74 - 0
nasm/config/watcom.h

@@ -0,0 +1,74 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 2016 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * config/watcom.h
+ *
+ * Compiler definitions for OpenWatcom instead of config.h.in.
+ *  See config.h.in for the variables which can be defined here.
+ *
+ * This was taken from openwcom.mak and needs to be actually validated.
+ */
+
+#ifndef NASM_CONFIG_WATCOM_H
+#define NASM_CONFIG_WATCOM_H
+
+#define HAVE_DECL_STRCASECMP 1
+#define HAVE_DECL_STRICMP 1
+#define HAVE_DECL_STRLCPY 1
+#define HAVE_DECL_STRNCASECMP 1
+#define HAVE_DECL_STRNICMP 1
+#define HAVE_INTTYPES_H 1
+#define HAVE_LIMITS_H 1
+#define HAVE_MEMORY_H 1
+#define HAVE_SNPRINTF 1
+#define HAVE_STDBOOL_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRCASECMP 1
+#define HAVE_STRCSPN 1
+#define HAVE_STRICMP 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_STRLCPY 1
+#define HAVE_STRNCASECMP 1
+#define HAVE_STRNICMP 1
+#define HAVE_STRSPN 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_UNISTD_H 1
+#define HAVE_VSNPRINTF 1
+#define STDC_HEADERS 1
+#define inline __inline
+
+#endif /* NASM_CONFIG_WATCOM_H */

Файловите разлики са ограничени, защото са твърде много
+ 10172 - 0
nasm/configure


+ 318 - 0
nasm/configure.ac

@@ -0,0 +1,318 @@
+dnl Process this file with autoconf 2.69 or later to produce
+dnl a configure script.
+AC_PREREQ(2.69)
+AC_INIT(config/config.h.in)
+AC_CONFIG_HEADERS(config/config.h)
+
+AC_PREFIX_PROGRAM(nasm)
+
+dnl Save initial CFLAGS, to see if -g -O2 came from configure or not
+pa_init_cflags="$CFLAGS"
+
+dnl This prevents us from running Wine and thinking we are not
+dnl cross-compiling when in fact we are; running Wine here is at
+dnl the best very slow and doesn't buy us a single thing at all.
+WINELOADER=/dev/null
+export WINELOADER
+
+dnl Checks for programs and enable necessary CC extensions
+AC_USE_SYSTEM_EXTENSIONS
+AC_SYS_LARGEFILE
+AC_PROG_CC
+AC_PROG_CC_STDC
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+AC_PROG_INSTALL
+
+dnl If the user did not specify a CFLAGS default, change default -O2
+dnl to either -O3 (normal) or -O0 (for debugging)
+PA_ARG_DISABLED([optimization],
+ [compile without optimization (-O0) to help debugging],
+ [pa_optimize=-O0], [pa_optimize=-O3])
+
+dnl Compile and link with dwarf debug
+PA_ARG_ENABLED([gdb],
+ [disable optimization and compile with extra debug information for GDB debugger],
+ [pa_optimize='-O0'
+  PA_ADD_CFLAGS([-ggdb3])
+ ])
+
+AS_IF([test x"$pa_init_cflags" = x],
+      [CFLAGS=`echo "$CFLAGS" | sed -e "s/-O2/$pa_optimize/"`])
+
+AS_IF([test x"$pa_optimize" = "x-O0"],
+      [PA_ADD_CFLAGS([-fno-omit-frame-pointer])])
+
+dnl Abort on panic
+PA_ARG_ENABLED([panic-abort],
+ [call abort() on panic to trap in the debugger],
+ [AC_DEFINE(ABORT_ON_PANIC)])
+AH_TEMPLATE(ABORT_ON_PANIC,
+[Define to 1 to call abort() on panics (internal errors), for debugging.])
+
+dnl Check for library extension
+PA_LIBEXT
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_C_INLINE
+AC_C_RESTRICT
+AC_TYPE_SIZE_T
+AC_C_BIGENDIAN(AC_DEFINE(WORDS_BIGENDIAN),AC_DEFINE(WORDS_LITTLEENDIAN),,)
+AH_TEMPLATE(WORDS_BIGENDIAN,
+[Define to 1 if your processor stores words with the most significant
+byte first (like Motorola and SPARC, unlike Intel and VAX).])
+AH_TEMPLATE(WORDS_LITTLEENDIAN,
+[Define to 1 if your processor stores words with the least significant
+byte first (like Intel and VAX, unlike Motorola and SPARC).])
+
+dnl Force gcc and gcc-compatible compilers treat signed integers
+dnl as 2's complement
+PA_ADD_CFLAGS([-fwrapv])
+
+dnl Some environments abuse __STRICT_ANSI__ to disable some
+dnl function declarations
+PA_ADD_CFLAGS([-U__STRICT_ANSI__])
+
+dnl Don't put things in common if we can avoid it.  We don't want to
+dnl assume all compilers support common, and this will help find those
+dnl problems.  This also works around an OSX linker problem.
+PA_ADD_CFLAGS([-fno-common])
+
+dnl Look for programs...
+AC_CHECK_PROGS(NROFF,    nroff,    false)
+AC_CHECK_PROGS(ASCIIDOC, asciidoc, false)
+AC_CHECK_PROGS(XMLTO,    xmlto,    false)
+
+dnl Check for progs needed for manpage generation
+AS_IF([test $ASCIIDOC = false],
+  [AC_MSG_WARN([No asciidoc package found])]
+)
+AS_IF([test $XMLTO = false],
+  [AC_MSG_WARN([No xmlto package found])]
+)
+
+dnl Check for host compiler tools
+AC_CHECK_TOOL(AR, ar)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip)
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS(inttypes.h)
+AC_CHECK_HEADERS(strings.h)
+AC_HEADER_STDBOOL
+AC_CHECK_HEADERS(stdnoreturn.h)
+AC_CHECK_HEADERS(io.h)
+AC_CHECK_HEADERS(fcntl.h)
+AC_CHECK_HEADERS(unistd.h)
+AC_CHECK_HEADERS(sys/mman.h)
+AC_CHECK_HEADERS(sys/types.h)
+AC_CHECK_HEADERS(sys/stat.h)
+
+dnl Checks for library functions.
+AC_CHECK_FUNCS(strcasecmp stricmp)
+AC_CHECK_FUNCS(strncasecmp strnicmp)
+AC_CHECK_FUNCS(strsep)
+AC_CHECK_FUNCS(strnlen)
+AC_CHECK_FUNCS(strrchrnul)
+
+AC_CHECK_FUNCS(getuid)
+AC_CHECK_FUNCS(getgid)
+
+AC_CHECK_FUNCS(realpath)
+AC_CHECK_FUNCS(canonicalize_file_name)
+AC_CHECK_FUNCS(_fullpath)
+AC_CHECK_FUNCS(pathconf)
+
+AC_FUNC_FSEEKO
+AC_CHECK_FUNCS([_fseeki64])
+AC_CHECK_FUNCS([ftruncate _chsize _chsize_s])
+AC_CHECK_FUNCS([fileno _fileno])
+
+AC_CHECK_FUNCS(_filelengthi64)
+AC_FUNC_MMAP
+AC_CHECK_FUNCS(getpagesize)
+AC_CHECK_FUNCS(sysconf)
+
+AC_CHECK_FUNCS([access _access faccessat])
+
+PA_HAVE_FUNC(__builtin_expect, (1,1))
+
+dnl ilog2() building blocks
+PA_ADD_HEADERS(intrin.h)
+PA_HAVE_FUNC(__builtin_clz, (0U))
+PA_HAVE_FUNC(__builtin_clzl, (0UL))
+PA_HAVE_FUNC(__builtin_clzll, (0ULL))
+PA_HAVE_FUNC(_BitScanReverse, (0))
+PA_HAVE_FUNC(_BitScanReverse64, (0))
+
+dnl Functions for which we have replacements available in stdlib/
+AC_CHECK_FUNCS([vsnprintf _vsnprintf])
+AC_CHECK_FUNCS([snprintf _snprintf])
+AC_CHECK_FUNCS([strlcpy])
+AC_CHECK_FUNCS([strrchrnul])
+
+dnl These types are POSIX-specific, and Windows does it differently...
+AC_CHECK_TYPES([struct _stati64])
+AC_CHECK_TYPES([struct stat])
+AC_CHECK_FUNCS([stat _stati64])
+AC_CHECK_FUNCS([fstat _fstati64])
+
+dnl Check for functions that might not be declared in the headers for
+dnl various idiotic reasons (mostly because of library authors
+dnl abusing the meaning of __STRICT_ANSI__)
+AC_CHECK_DECLS(strcasecmp)
+AC_CHECK_DECLS(stricmp)
+AC_CHECK_DECLS(strncasecmp)
+AC_CHECK_DECLS(strnicmp)
+AC_CHECK_DECLS(strsep)
+AC_CHECK_DECLS(strlcpy)
+AC_CHECK_DECLS(strnlen)
+AC_CHECK_DECLS(strrchrnul)
+
+dnl Check for missing types
+AC_TYPE_UINTPTR_T
+
+dnl Documentation: should we generate an uncompressed PDF?  It is
+dnl about twice as big, but it can be externally compressed (e.g. with xz)
+dnl and becomes significantly smaller than the original.
+PA_ARG_DISABLED([pdf-compression],
+  [generate an uncompressed documentation PDF],
+  [PDFOPT='-nocompress'])
+AC_SUBST([PDFOPT])
+
+dnl
+dnl Look for byte-swapping support...
+dnl
+PA_ADD_HEADERS(endian.h sys/endian.h machine/endian.h)
+PA_HAVE_FUNC(cpu_to_le16, (0))
+PA_HAVE_FUNC(cpu_to_le32, (0))
+PA_HAVE_FUNC(cpu_to_le64, (0))
+PA_HAVE_FUNC(__cpu_to_le16, (0))
+PA_HAVE_FUNC(__cpu_to_le32, (0))
+PA_HAVE_FUNC(__cpu_to_le64, (0))
+PA_HAVE_FUNC(htole16, (0))
+PA_HAVE_FUNC(htole32, (0))
+PA_HAVE_FUNC(htole64, (0))
+PA_HAVE_FUNC(__bswap_16, (0))
+PA_HAVE_FUNC(__bswap_32, (0))
+PA_HAVE_FUNC(__bswap_64, (0))
+PA_HAVE_FUNC(__builtin_bswap16, (0))
+PA_HAVE_FUNC(__builtin_bswap32, (0))
+PA_HAVE_FUNC(__builtin_bswap64, (0))
+PA_HAVE_FUNC(_byteswap_ushort, (0))
+PA_HAVE_FUNC(_byteswap_ulong, (0))
+PA_HAVE_FUNC(_byteswap_uint64, (0))
+
+dnl
+dnl Check for __builtin_constant_p()
+dnl
+PA_HAVE_FUNC(__builtin_constant_p, (0))
+
+dnl
+dnl Check for supported gcc attributes; some compilers (e.g. Sun CC)
+dnl support these, but don't define __GNUC__ as they don't support
+dnl some other features of gcc.
+dnl
+PA_ADD_CFLAGS([-Werror=attributes])
+PA_FUNC_ATTRIBUTE(noreturn)
+PA_FUNC_ATTRIBUTE(returns_nonnull)
+PA_FUNC_ATTRIBUTE(malloc)
+PA_FUNC_ATTRIBUTE(alloc_size, (1))
+PA_FUNC_ATTRIBUTE(sentinel,,, [const char *, ...], ["a","b",NULL])
+PA_FUNC_ATTRIBUTE(format, [(printf,1,2)], int, [const char *, ...], ["%d",1])
+PA_FUNC_ATTRIBUTE(const)
+PA_FUNC_ATTRIBUTE(pure)
+PA_FUNC_ATTRIBUTE(cold)
+PA_FUNC_ATTRIBUTE_ERROR
+
+dnl
+dnl support function sections (if available)
+dnl
+PA_ARG_ENABLED([sections],
+ [compile with function/data section support],
+ [PA_ADD_CLDFLAGS([-ffunction-sections])
+  PA_ADD_CLDFLAGS([-fdata-sections])
+  PA_ADD_CLDFLAGS([-Wl,--gc-sections])],
+ [])
+
+dnl
+dnl support LTO
+dnl
+PA_ARG_ENABLED([lto],
+ [compile with gcc-style link time optimization],
+ [PA_ADD_CLDFLAGS([-flto])
+  dnl Note: we use _PROG rather than _TOOL since we are prepending the full
+  dnl CC name which ought to already contain the host triplet if needed
+  ccbase=`echo "$CC" | awk '{ print $1; }'`
+  AC_CHECK_PROGS(CC_AR, [${ccbase}-ar], [$ac_cv_prog_AR])
+  AR="$CC_AR"
+  AC_CHECK_PROGS(CC_RANLIB, [${ccbase}-ranlib], [$ac_cv_prog_RANLIB])
+  RANLIB="$CC_RANLIB"], [])
+
+dnl
+dnl support sanitizers (if available)
+dnl
+PA_ARG_ENABLED([sanitizer],
+ [compile with sanitizers enabled],
+ [PA_ADD_CFLAGS([-fno-omit-frame-pointer])
+  PA_ADD_CLDFLAGS([-fsanitize=address])
+  PA_ADD_CLDFLAGS([-fsanitize=undefined])])
+
+dnl
+dnl Don't make symbols visible, there is no point and it just
+dnl makes the code slower.
+dnl
+PA_ADD_CLDFLAGS([-fvisibility=hidden])
+
+dnl If we have gcc, add appropriate code cleanliness options
+PA_ADD_CFLAGS([-W])
+PA_ADD_CFLAGS([-Wall])
+PA_ADD_CFLAGS([-pedantic])
+dnl LLVM doesn't error out on invalid -W options unless this option is
+dnl specified first.  Enable this so this script can actually discover
+dnl which -W options are possible for this compiler.
+PA_ADD_CFLAGS([-Werror=unknown-warning-option])
+dnl Suppress format warning on Windows targets due to their <inttypes.h>
+PA_ADD_CFLAGS([-Wpedantic-ms-format],[-Wno-pedantic-ms-format])
+PA_ADD_CFLAGS([-Wc90-c99-compat])
+PA_ADD_CFLAGS([-Wlong-long],[-Wno-long-long])
+dnl This is needed because we intentionally expect strncpy() to fill
+dnl in a zero-padded (not zero-terminated) buffer in several backends
+PA_ADD_CFLAGS([-Wstringop-truncation],[-Wno-stringop-truncation])
+dnl This is needed because we assume 2's-completement signed arithmetic;
+dnl on compilers with gcc-like command line syntax we pass the -fwrapv
+dnl option for exactly that reason.
+PA_ADD_CFLAGS([-Wshift-negative-value],[-Wno-shift-negative-value])
+
+dnl PA_ADD_CFLAGS([-Wwrite-strings])
+PA_ARG_ENABLED([werror],
+ [compile with -Werror to error out on any warning],
+ [PA_ADD_CFLAGS([-Werror])],
+ [PA_ADD_CFLAGS([-Werror=implicit])
+  PA_ADD_CFLAGS([-Werror=missing-braces])
+  PA_ADD_CFLAGS([-Werror=return-type])
+  PA_ADD_CFLAGS([-Werror=trigraphs])
+  PA_ADD_CFLAGS([-Werror=pointer-arith])
+  PA_ADD_CFLAGS([-Werror=strict-prototypes])
+  PA_ADD_CFLAGS([-Werror=missing-prototypes])
+  PA_ADD_CFLAGS([-Werror=missing-declarations])
+  PA_ADD_CFLAGS([-Werror=comment])
+  PA_ADD_CFLAGS([-Werror=vla])]
+)
+
+dnl
+dnl On some versions of gcc, -Werror=missing-prototypes causes problems
+dnl with C99-style external inlines.  Test this *after* adding the -Werror
+dnl options.
+dnl
+PA_CHECK_BAD_STDC_INLINE
+
+dnl
+dnl support ccache
+dnl
+PA_ARG_ENABLED([ccache], [compile with ccache], [CC="ccache $CC"], [])
+
+AC_OUTPUT_COMMANDS([mkdir -p config nasmlib nsis output stdlib x86 asm disasm rdoff macros common])
+AC_OUTPUT(Makefile doc/Makefile)

+ 25 - 0
nasm/contrib/MSVC6.txt

@@ -0,0 +1,25 @@
+Compilation with Nasm on MSVC 6.0, with usage of Custom Build step.
+
+1) Open your project in MSVC.
+
+2) Add .asm at the list of source files.
+
+3) Click on it with the right button, further press Settings...
+
+4) In General tab, flags "Always use custom build step" and "Exclude file
+   from build" should be disabled.
+
+5) In "Custom Build" tab it is necessary to define "Commands" and "Outputs"
+   (By "Outputs" build system checks if it has reached a necessary result.
+    This parameter is mandatory and without it MSVC will not let you close
+    the window by OK button).
+
+   The "Commands" should be set to
+
+        nasmw.exe -fwin -o $(OUTDIR)\$(InputName).obj $(InputName).asm
+
+   And "Outputs" to
+
+        $(OUTDIR)\$(InputName).obj
+
+Have fun!

+ 16 - 0
nasm/contrib/VSrules/nasm.README

@@ -0,0 +1,16 @@
+			Visual Studio 2008 NASM integration
+
+
+In order to use nasm seamlessly in your VS2k8, follow the steps below. 
+
+1. First install nasm by running its installer
+2. copy nasm.rules to c:\Program Files\Microsoft Visual Studio 2008\VC\VCProjectDefaults
+3. Start Visual Studio 2008
+4. go to Tools->Options->VC++ Directories
+5. click on Show Directories for Executables
+6. add C:\Program Files\NASM to the list of paths
+7. Open a solution that you want to use NASM with
+8. Right click on the project name and select Custom Build Rules
+9. Check the box next to the NASM line
+10. Add any .asm files to the project
+11. click on build to test

+ 79 - 0
nasm/contrib/VSrules/nasm.rules

@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="utf-8"?>
+<VisualStudioToolFile
+	Name="Netwide Macro Assembler"
+	Version="8.00"
+	>
+	<Rules>
+		<CustomBuildRule
+			Name="NASM"
+			DisplayName="Netwide Macro Assembler"
+			CommandLine="nasm.exe -f win32 -Xvc [AllOptions] [AdditionalOptions] [Inputs]"
+			Outputs="[$ObjectFileName]"
+			FileExtensions="*.asm"
+			ExecutionDescription="Assembling..."
+			>
+			<Properties>
+				<StringProperty
+					Name="ObjectFileName"
+					DisplayName="Object File Name"
+					PropertyPageName="Object File"
+					Description="Specifies the name of the output object file.     (-o [file])"
+					HelpURL="http://www.nasm.us/doc/"
+					Switch="-o &quot;[value]&quot;"
+					DefaultValue="$(IntDir)\$(InputName).obj"
+				/>
+				<StringProperty
+					Name="PreprocessorDefinitions"
+					DisplayName="Preprocessor Definitions"
+					Description="Defines a text macro with the given name.     (-D[symbol])"
+					HelpURL="http://www.nasm.us/doc/"
+					Switch="-D[value]"
+					Delimited="false"
+					Inheritable="true"
+				/>
+				<StringProperty
+					Name="UndefinePreprocessorDefinitions"
+					DisplayName="Undefine Preprocessor Definitions"
+					Description="Undefines a text macro with the given name.     (-U[symbol])"
+					HelpURL="http://www.nasm.us/doc/"
+					Switch="-U[value]"
+					Delimited="false"
+					Inheritable="true"
+				/>
+				<StringProperty
+					Name="AssembledCodeListingFile"
+					DisplayName="Assembled Code Listing File"
+					PropertyPageName="Listing File"
+					Description="Generates an assembled code listing file.     (-l [file])"
+					HelpURL="http://www.nasm.us/doc/"
+					Switch="-l &quot;[value]&quot;"
+				/>
+				<StringProperty
+					Name="IncludePaths"
+					DisplayName="Include Paths"
+					Description="Sets path for include file.     (-I[path])"
+					HelpURL="http://www.nasm.us/doc/"
+					Switch="-I[value]"
+					Delimited="false"
+					Inheritable="true"
+				/>
+				<BooleanProperty
+					Name="TreatWarningsAsErrors"
+					DisplayName="Treat Warnings As Errors"
+					Description="Returns an error code if warnings are generated.     (-Werror)"
+					HelpURL="http://www.nasm.us/doc/"
+					Switch="-Werror"
+				/>
+				<BooleanProperty
+					Name="GenerateDebugInformation"
+					DisplayName="Generate Debug Information"
+					Description="Generates Debug Information.     (-g)"
+					HelpURL="http://www.nasm.us/doc/"
+					Switch="-g"
+					DefaultValue="true"
+				/>
+				
+			</Properties>
+		</CustomBuildRule>
+	</Rules>
+</VisualStudioToolFile>

Файловите разлики са ограничени, защото са твърде много
+ 1765 - 0
nasm/disasm/disasm.c


+ 49 - 0
nasm/disasm/disasm.h

@@ -0,0 +1,49 @@
+/* ----------------------------------------------------------------------- *
+ *   
+ *   Copyright 1996-2009 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *     
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * disasm.h   header file for disasm.c
+ */
+
+#ifndef NASM_DISASM_H
+#define NASM_DISASM_H
+
+#include "iflag.h"
+
+#define INSN_MAX 32             /* one instruction can't be longer than this */
+
+int32_t disasm(uint8_t *data, int32_t data_size, char *output, int outbufsize, int segsize,
+               int64_t offset, int autosync, iflag_t *prefer);
+int32_t eatbyte(uint8_t *data, char *output, int outbufsize, int segsize);
+
+#endif

+ 396 - 0
nasm/disasm/ndisasm.c

@@ -0,0 +1,396 @@
+/* ----------------------------------------------------------------------- *
+ *   
+ *   Copyright 1996-2009 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *     
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * ndisasm.c   the Netwide Disassembler main module
+ */
+
+#include "compiler.h"
+
+#include <stdio.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+
+#include "insns.h"
+#include "nasm.h"
+#include "nasmlib.h"
+#include "error.h"
+#include "ver.h"
+#include "sync.h"
+#include "disasm.h"
+
+#define BPL 8                   /* bytes per line of hex dump */
+
+static const char *help =
+    "usage: ndisasm [-a] [-i] [-h] [-r] [-u] [-b bits] [-o origin] [-s sync...]\n"
+    "               [-e bytes] [-k start,bytes] [-p vendor] file\n"
+    "   -a or -i activates auto (intelligent) sync\n"
+    "   -u same as -b 32\n"
+    "   -b 16, -b 32 or -b 64 sets the processor mode\n"
+    "   -h displays this text\n"
+    "   -r or -v displays the version number\n"
+    "   -e skips <bytes> bytes of header\n"
+    "   -k avoids disassembling <bytes> bytes from position <start>\n"
+    "   -p selects the preferred vendor instruction set (intel, amd, cyrix, idt)\n";
+
+static void output_ins(uint64_t, uint8_t *, int, char *);
+static void skip(uint32_t dist, FILE * fp);
+
+static void ndisasm_verror(int severity, const char *fmt, va_list va)
+{
+    vfprintf(stderr, fmt, va);
+
+    if (severity & ERR_FATAL)
+	exit(1);
+}
+
+int main(int argc, char **argv)
+{
+    char buffer[INSN_MAX * 2], *p, *ep, *q;
+    char outbuf[256];
+    char *pname = *argv;
+    char *filename = NULL;
+    uint32_t nextsync, synclen, initskip = 0L;
+    int lenread;
+    int32_t lendis;
+    bool autosync = false;
+    int bits = 16, b;
+    bool eof = false;
+    iflag_t prefer;
+    bool rn_error;
+    int64_t offset;
+    FILE *fp;
+
+    tolower_init();
+    nasm_set_verror(ndisasm_verror);
+    iflag_clear_all(&prefer);
+
+    offset = 0;
+    init_sync();
+
+    while (--argc) {
+        char *v, *vv, *p = *++argv;
+        if (*p == '-' && p[1]) {
+            p++;
+            while (*p)
+                switch (nasm_tolower(*p)) {
+                case 'a':      /* auto or intelligent sync */
+                case 'i':
+                    autosync = true;
+                    p++;
+                    break;
+                case 'h':
+                    fputs(help, stderr);
+                    return 0;
+                case 'r':
+                case 'v':
+                    fprintf(stderr,
+                            "NDISASM version %s compiled on %s\n",
+			    nasm_version, nasm_date);
+                    return 0;
+                case 'u':	/* -u for -b 32, -uu for -b 64 */
+		    if (bits < 64)
+			bits <<= 1;
+                    p++;
+                    break;
+                case 'b':      /* bits */
+                    v = p[1] ? p + 1 : --argc ? *++argv : NULL;
+                    if (!v) {
+                        fprintf(stderr, "%s: `-b' requires an argument\n",
+                                pname);
+                        return 1;
+                    }
+		    b = strtoul(v, &ep, 10);
+		    if (*ep || !(bits == 16 || bits == 32 || bits == 64)) {
+                        fprintf(stderr, "%s: argument to `-b' should"
+                                " be 16, 32 or 64\n", pname);
+                    } else {
+			bits = b;
+		    }
+                    p = "";     /* force to next argument */
+                    break;
+                case 'o':      /* origin */
+                    v = p[1] ? p + 1 : --argc ? *++argv : NULL;
+                    if (!v) {
+                        fprintf(stderr, "%s: `-o' requires an argument\n",
+                                pname);
+                        return 1;
+                    }
+                    offset = readnum(v, &rn_error);
+                    if (rn_error) {
+                        fprintf(stderr,
+                                "%s: `-o' requires a numeric argument\n",
+                                pname);
+                        return 1;
+                    }
+                    p = "";     /* force to next argument */
+                    break;
+                case 's':      /* sync point */
+                    v = p[1] ? p + 1 : --argc ? *++argv : NULL;
+                    if (!v) {
+                        fprintf(stderr, "%s: `-s' requires an argument\n",
+                                pname);
+                        return 1;
+                    }
+                    add_sync(readnum(v, &rn_error), 0L);
+                    if (rn_error) {
+                        fprintf(stderr,
+                                "%s: `-s' requires a numeric argument\n",
+                                pname);
+                        return 1;
+                    }
+                    p = "";     /* force to next argument */
+                    break;
+                case 'e':      /* skip a header */
+                    v = p[1] ? p + 1 : --argc ? *++argv : NULL;
+                    if (!v) {
+                        fprintf(stderr, "%s: `-e' requires an argument\n",
+                                pname);
+                        return 1;
+                    }
+                    initskip = readnum(v, &rn_error);
+                    if (rn_error) {
+                        fprintf(stderr,
+                                "%s: `-e' requires a numeric argument\n",
+                                pname);
+                        return 1;
+                    }
+                    p = "";     /* force to next argument */
+                    break;
+                case 'k':      /* skip a region */
+                    v = p[1] ? p + 1 : --argc ? *++argv : NULL;
+                    if (!v) {
+                        fprintf(stderr, "%s: `-k' requires an argument\n",
+                                pname);
+                        return 1;
+                    }
+                    vv = strchr(v, ',');
+                    if (!vv) {
+                        fprintf(stderr,
+                                "%s: `-k' requires two numbers separated"
+                                " by a comma\n", pname);
+                        return 1;
+                    }
+                    *vv++ = '\0';
+                    nextsync = readnum(v, &rn_error);
+                    if (rn_error) {
+                        fprintf(stderr,
+                                "%s: `-k' requires numeric arguments\n",
+                                pname);
+                        return 1;
+                    }
+                    synclen = readnum(vv, &rn_error);
+                    if (rn_error) {
+                        fprintf(stderr,
+                                "%s: `-k' requires numeric arguments\n",
+                                pname);
+                        return 1;
+                    }
+                    add_sync(nextsync, synclen);
+                    p = "";     /* force to next argument */
+                    break;
+                case 'p':      /* preferred vendor */
+                    v = p[1] ? p + 1 : --argc ? *++argv : NULL;
+                    if (!v) {
+                        fprintf(stderr, "%s: `-p' requires an argument\n",
+                                pname);
+                        return 1;
+                    }
+                    if (!strcmp(v, "intel")) {
+                        iflag_clear_all(&prefer); /* default */
+                    } else if (!strcmp(v, "amd")) {
+                        iflag_clear_all(&prefer);
+                        iflag_set(&prefer, IF_AMD);
+                        iflag_set(&prefer, IF_3DNOW);
+                    } else if (!strcmp(v, "cyrix")) {
+                        iflag_clear_all(&prefer);
+                        iflag_set(&prefer, IF_CYRIX);
+                        iflag_set(&prefer, IF_3DNOW);
+                    } else if (!strcmp(v, "idt") ||
+                               !strcmp(v, "centaur") ||
+                               !strcmp(v, "winchip")) {
+                        iflag_clear_all(&prefer);
+                        iflag_set(&prefer, IF_3DNOW);
+                    } else {
+                        fprintf(stderr,
+                                "%s: unknown vendor `%s' specified with `-p'\n",
+                                pname, v);
+                        return 1;
+                    }
+                    p = "";     /* force to next argument */
+                    break;
+                default:       /*bf */
+                    fprintf(stderr, "%s: unrecognised option `-%c'\n",
+                            pname, *p);
+                    return 1;
+                }
+        } else if (!filename) {
+            filename = p;
+        } else {
+            fprintf(stderr, "%s: more than one filename specified\n",
+                    pname);
+            return 1;
+        }
+    }
+
+    if (!filename) {
+        fprintf(stderr, help, pname);
+        return 0;
+    }
+
+    if (strcmp(filename, "-")) {
+        fp = fopen(filename, "rb");
+        if (!fp) {
+            fprintf(stderr, "%s: unable to open `%s': %s\n",
+                    pname, filename, strerror(errno));
+            return 1;
+        }
+    } else
+        fp = stdin;
+
+    if (initskip > 0)
+        skip(initskip, fp);
+
+    /*
+     * This main loop is really horrible, and wants rewriting with
+     * an axe. It'll stay the way it is for a while though, until I
+     * find the energy...
+     */
+
+    p = q = buffer;
+    nextsync = next_sync(offset, &synclen);
+    do {
+        uint32_t to_read = buffer + sizeof(buffer) - p;
+	if ((nextsync || synclen) &&
+	    to_read > nextsync - offset - (p - q))
+            to_read = nextsync - offset - (p - q);
+        if (to_read) {
+            lenread = fread(p, 1, to_read, fp);
+            if (lenread == 0)
+                eof = true;     /* help along systems with bad feof */
+        } else
+            lenread = 0;
+        p += lenread;
+        if ((nextsync || synclen) &&
+	    (uint32_t)offset == nextsync) {
+            if (synclen) {
+                fprintf(stdout, "%08"PRIX64"  skipping 0x%"PRIX32" bytes\n",
+			offset, synclen);
+                offset += synclen;
+                skip(synclen, fp);
+            }
+            p = q = buffer;
+            nextsync = next_sync(offset, &synclen);
+        }
+        while (p > q && (p - q >= INSN_MAX || lenread == 0)) {
+            lendis = disasm((uint8_t *)q, INSN_MAX, outbuf, sizeof(outbuf),
+			    bits, offset, autosync, &prefer);
+            if (!lendis || lendis > (p - q)
+                || ((nextsync || synclen) &&
+		    (uint32_t)lendis > nextsync - offset))
+                lendis = eatbyte((uint8_t *) q, outbuf, sizeof(outbuf), bits);
+            output_ins(offset, (uint8_t *) q, lendis, outbuf);
+            q += lendis;
+            offset += lendis;
+        }
+        if (q >= buffer + INSN_MAX) {
+            uint8_t *r = (uint8_t *) buffer, *s = (uint8_t *) q;
+            int count = p - q;
+            while (count--)
+                *r++ = *s++;
+            p -= (q - buffer);
+            q = buffer;
+        }
+    } while (lenread > 0 || !(eof || feof(fp)));
+
+    if (fp != stdin)
+        fclose(fp);
+
+    return 0;
+}
+
+static void output_ins(uint64_t offset, uint8_t *data,
+                       int datalen, char *insn)
+{
+    int bytes;
+    fprintf(stdout, "%08"PRIX64"  ", offset);
+
+    bytes = 0;
+    while (datalen > 0 && bytes < BPL) {
+        fprintf(stdout, "%02X", *data++);
+        bytes++;
+        datalen--;
+    }
+
+    fprintf(stdout, "%*s%s\n", (BPL + 1 - bytes) * 2, "", insn);
+
+    while (datalen > 0) {
+        fprintf(stdout, "         -");
+        bytes = 0;
+        while (datalen > 0 && bytes < BPL) {
+            fprintf(stdout, "%02X", *data++);
+            bytes++;
+            datalen--;
+        }
+        fprintf(stdout, "\n");
+    }
+}
+
+/*
+ * Skip a certain amount of data in a file, either by seeking if
+ * possible, or if that fails then by reading and discarding.
+ */
+static void skip(uint32_t dist, FILE * fp)
+{
+    char buffer[256];           /* should fit on most stacks :-) */
+
+    /*
+     * Got to be careful with fseek: at least one fseek I've tried
+     * doesn't approve of SEEK_CUR. So I'll use SEEK_SET and
+     * ftell... horrible but apparently necessary.
+     */
+    if (fseek(fp, dist + ftell(fp), SEEK_SET)) {
+        while (dist > 0) {
+            uint32_t len = (dist < sizeof(buffer) ?
+                                 dist : sizeof(buffer));
+            if (fread(buffer, 1, len, fp) < len) {
+                perror("fread");
+                exit(1);
+            }
+            dist -= len;
+        }
+    }
+}

+ 132 - 0
nasm/disasm/sync.c

@@ -0,0 +1,132 @@
+/* ----------------------------------------------------------------------- *
+ *
+ *   Copyright 1996-2009 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/*
+ * sync.c   the Netwide Disassembler synchronisation processing module
+ */
+
+#include "compiler.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+
+#include "nasmlib.h"
+#include "sync.h"
+
+#define SYNC_MAX_SHIFT          31
+#define SYNC_MAX_SIZE           (1U << SYNC_MAX_SHIFT)
+
+/* initial # of sync points (*must* be power of two)*/
+#define SYNC_INITIAL_CHUNK      (1U << 12)
+
+/*
+ * This lot manages the current set of sync points by means of a
+ * heap (priority queue) structure.
+ */
+
+static struct Sync {
+    uint64_t pos;
+    uint32_t length;
+} *synx;
+
+static uint32_t max_synx, nsynx;
+
+static inline void swap_sync(uint32_t dst, uint32_t src)
+{
+    struct Sync t = synx[dst];
+    synx[dst] = synx[src];
+    synx[src] = t;
+}
+
+void init_sync(void)
+{
+    max_synx = SYNC_INITIAL_CHUNK;
+    synx = nasm_malloc((max_synx + 1) * sizeof(*synx));
+    nsynx = 0;
+}
+
+void add_sync(uint64_t pos, uint32_t length)
+{
+    uint32_t i;
+
+    if (nsynx >= max_synx) {
+        if (max_synx >= SYNC_MAX_SIZE) /* too many sync points! */
+            return;
+        max_synx = (max_synx << 1);
+        synx = nasm_realloc(synx, (max_synx + 1) * sizeof(*synx));
+    }
+
+    nsynx++;
+    synx[nsynx].pos = pos;
+    synx[nsynx].length = length;
+
+    for (i = nsynx; i > 1; i /= 2) {
+        if (synx[i / 2].pos > synx[i].pos)
+            swap_sync(i / 2, i);
+    }
+}
+
+uint64_t next_sync(uint64_t position, uint32_t *length)
+{
+    while (nsynx > 0 && synx[1].pos + synx[1].length <= position) {
+        uint32_t i, j;
+
+        swap_sync(nsynx, 1);
+        nsynx--;
+
+        i = 1;
+        while (i * 2 <= nsynx) {
+            j = i * 2;
+            if (synx[j].pos < synx[i].pos &&
+                (j + 1 > nsynx || synx[j + 1].pos > synx[j].pos)) {
+                swap_sync(j, i);
+                i = j;
+            } else if (j + 1 <= nsynx && synx[j + 1].pos < synx[i].pos) {
+                swap_sync(j + 1, i);
+                i = j + 1;
+            } else
+                break;
+        }
+    }
+
+    if (nsynx > 0) {
+        if (length)
+            *length = synx[1].length;
+        return synx[1].pos;
+    } else {
+        if (length)
+            *length = 0L;
+        return 0;
+    }
+}

+ 45 - 0
nasm/disasm/sync.h

@@ -0,0 +1,45 @@
+/* ----------------------------------------------------------------------- *
+ *   
+ *   Copyright 1996-2009 The NASM Authors - All Rights Reserved
+ *   See the file AUTHORS included with the NASM distribution for
+ *   the specific copyright holders.
+ *
+ *   Redistribution and use in source and binary forms, with or without
+ *   modification, are permitted provided that the following
+ *   conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above
+ *     copyright notice, this list of conditions and the following
+ *     disclaimer in the documentation and/or other materials provided
+ *     with the distribution.
+ *     
+ *     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ *     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ *     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ *     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ *     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ *     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ *     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ *     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ *     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ *     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ *     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ *     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ----------------------------------------------------------------------- */
+
+/* 
+ * sync.h   header file for sync.c
+ */
+
+#ifndef NASM_SYNC_H
+#define NASM_SYNC_H
+
+void init_sync(void);
+void add_sync(uint64_t position, uint32_t length);
+uint64_t next_sync(uint64_t position, uint32_t *length);
+
+#endif

+ 90 - 0
nasm/doc/Makefile

@@ -0,0 +1,90 @@
+#
+# UNIX Makefile for NASM documentation
+#
+
+top_srcdir	= ..
+srcdir		= .
+
+prefix		= /usr
+exec_prefix	= ${prefix}
+bindir		= ${exec_prefix}/bin
+mandir		= ${datarootdir}/man
+docdir		= ${datarootdir}/doc/${PACKAGE}
+htmldir		= ${docdir}
+infodir		= ${datarootdir}/info
+datarootdir	= ${prefix}/share
+
+INSTALL		= /usr/bin/install -c
+INSTALL_PROGRAM	= ${INSTALL}
+INSTALL_DATA	= ${INSTALL} -m 644
+
+PERL		= perl -I$(srcdir)
+
+PDFOPT		= 
+
+MKDIR		= mkdir
+RM_F		= rm -f
+RM_RF		= rm -rf
+CP_F		= cp -f
+CP_UF		= cp -ufv
+
+# Auxiliary files referenced by the HTML files
+HTMLAUX		= nasmdoc.css local.css nasmlogw.png
+
+SRCS		= nasmdoc.src inslist.src changes.src version.src
+OUT		= html nasmdoc.txt nasmdoc.pdf
+
+.SUFFIXES:
+.SUFFIXES: .pfa .ph
+
+all: $(OUT)
+
+inslist.src: inslist.pl ../x86/insns.dat
+	$(PERL) $(srcdir)/inslist.pl $(srcdir)/../x86/insns.dat
+
+.PHONY: html
+html: $(HTMLAUX)
+	$(MKDIR) -p html
+	for f in $(HTMLAUX); do $(CP_UF) "$(srcdir)/$$f" html/; done
+	$(MAKE) html/nasmdoc0.html
+
+RDSRC = $(PERL) $(srcdir)/rdsrc.pl -I$(srcdir)/
+
+html/nasmdoc0.html: $(SRCS) rdsrc.pl
+	$(RM_F) html/*.html
+	$(RDSRC) -ohtml html nasmdoc.src
+
+nasmdoc.dip: $(SRCS) rdsrc.pl
+	$(RDSRC) dip nasmdoc.src
+
+nasmdoc.txt: $(SRCS) rdsrc.pl
+	$(RDSRC) txt nasmdoc.src
+
+version.src: $(top_srcdir)/version.pl $(top_srcdir)/version
+	$(PERL) $(top_srcdir)/version.pl docsrc \
+		< $(top_srcdir)/version > version.src
+
+nasmdoc.ps: nasmdoc.dip genps.pl afmmetrics.ph ttfmetrics.ph \
+	pswidth.ph nasmlogo.eps psfonts.ph head.ps
+	$(PERL) $(srcdir)/genps.pl -epsdir "$(srcdir)" \
+		-headps $(srcdir)/head.ps nasmdoc.dip \
+		> nasmdoc.ps
+
+nasmdoc.pdf: nasmdoc.ps pspdf.pl
+	$(PERL) $(srcdir)/pspdf.pl $(PDFOPT) nasmdoc.ps nasmdoc.pdf
+
+clean:
+	-$(RM_F) *.rtf *.hpj *.texi *.gid *.ipf *.dip
+	-$(RM_F) *.aux *.cp *.fn *.ky *.pg *.log *.toc *.tp *.vr
+	-$(RM_F) inslist.src version.src
+	-$(RM_F) nasmdoc*.ps
+
+spotless: clean
+	-$(RM_RF) html info
+	-$(RM_F) *.hlp nasmdoc.txt *.inf *.pdf *.dvi
+
+install: all
+	$(MKDIR) -p $(DESTDIR)$(htmldir)
+	$(INSTALL_DATA) html/* $(DESTDIR)$(htmldir)
+	$(MKDIR) -p $(DESTDIR)$(docdir)
+	$(INSTALL_DATA) nasmdoc.pdf nasmdoc.txt $(DESTDIR)$(docdir)

+ 90 - 0
nasm/doc/Makefile.in

@@ -0,0 +1,90 @@
+#
+# UNIX Makefile for NASM documentation
+#
+
+top_srcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+prefix		= @prefix@
+exec_prefix	= @exec_prefix@
+bindir		= @bindir@
+mandir		= @mandir@
+docdir		= @docdir@
+htmldir		= @htmldir@
+infodir		= @infodir@
+datarootdir	= @datarootdir@
+
+INSTALL		= @INSTALL@
+INSTALL_PROGRAM	= @INSTALL_PROGRAM@
+INSTALL_DATA	= @INSTALL_DATA@
+
+PERL		= perl -I$(srcdir)
+
+PDFOPT		= @PDFOPT@
+
+MKDIR		= mkdir
+RM_F		= rm -f
+RM_RF		= rm -rf
+CP_F		= cp -f
+CP_UF		= cp -ufv
+
+# Auxiliary files referenced by the HTML files
+HTMLAUX		= nasmdoc.css local.css nasmlogw.png
+
+SRCS		= nasmdoc.src inslist.src changes.src version.src
+OUT		= html nasmdoc.txt nasmdoc.pdf
+
+.SUFFIXES:
+.SUFFIXES: .pfa .ph
+
+all: $(OUT)
+
+inslist.src: inslist.pl ../x86/insns.dat
+	$(PERL) $(srcdir)/inslist.pl $(srcdir)/../x86/insns.dat
+
+.PHONY: html
+html: $(HTMLAUX)
+	$(MKDIR) -p html
+	for f in $(HTMLAUX); do $(CP_UF) "$(srcdir)/$$f" html/; done
+	$(MAKE) html/nasmdoc0.html
+
+RDSRC = $(PERL) $(srcdir)/rdsrc.pl -I$(srcdir)/
+
+html/nasmdoc0.html: $(SRCS) rdsrc.pl
+	$(RM_F) html/*.html
+	$(RDSRC) -ohtml html nasmdoc.src
+
+nasmdoc.dip: $(SRCS) rdsrc.pl
+	$(RDSRC) dip nasmdoc.src
+
+nasmdoc.txt: $(SRCS) rdsrc.pl
+	$(RDSRC) txt nasmdoc.src
+
+version.src: $(top_srcdir)/version.pl $(top_srcdir)/version
+	$(PERL) $(top_srcdir)/version.pl docsrc \
+		< $(top_srcdir)/version > version.src
+
+nasmdoc.ps: nasmdoc.dip genps.pl afmmetrics.ph ttfmetrics.ph \
+	pswidth.ph nasmlogo.eps psfonts.ph head.ps
+	$(PERL) $(srcdir)/genps.pl -epsdir "$(srcdir)" \
+		-headps $(srcdir)/head.ps nasmdoc.dip \
+		> nasmdoc.ps
+
+nasmdoc.pdf: nasmdoc.ps pspdf.pl
+	$(PERL) $(srcdir)/pspdf.pl $(PDFOPT) nasmdoc.ps nasmdoc.pdf
+
+clean:
+	-$(RM_F) *.rtf *.hpj *.texi *.gid *.ipf *.dip
+	-$(RM_F) *.aux *.cp *.fn *.ky *.pg *.log *.toc *.tp *.vr
+	-$(RM_F) inslist.src version.src
+	-$(RM_F) nasmdoc*.ps
+
+spotless: clean
+	-$(RM_RF) html info
+	-$(RM_F) *.hlp nasmdoc.txt *.inf *.pdf *.dvi
+
+install: all
+	$(MKDIR) -p $(DESTDIR)$(htmldir)
+	$(INSTALL_DATA) html/* $(DESTDIR)$(htmldir)
+	$(MKDIR) -p $(DESTDIR)$(docdir)
+	$(INSTALL_DATA) nasmdoc.pdf nasmdoc.txt $(DESTDIR)$(docdir)

+ 20 - 0
nasm/doc/README

@@ -0,0 +1,20 @@
+To build the entire documentation, the following tools are needed:
+
+1. A Perl interpreter for your platform
+2. The following Perl modules available from CPAN:
+   Font::TTF
+   Sort::Versions
+3. asciidoc
+   http://asciidoc.org/
+4. xmlto
+   https://fedorahosted.org/xmlto
+5. One of:
+	Adobe Acrobat (acrodist)
+	Ghostscript (ps2pdf) http://download.ghostscript.com/
+	pstopdf	(available on some BSD-derived Unix systems)
+
+	Of these, Ghostscript is the most tested, although Acrobat has
+	been claimed to generate smaller files.
+6. For best results, the Adobe fonts Source Sans Pro and Source Code
+   Pro, available for free at:
+   https://github.com/adobe-fonts

+ 102 - 0
nasm/doc/afmmetrics.ph

@@ -0,0 +1,102 @@
+#!/usr/bin/perl
+## --------------------------------------------------------------------------
+##
+##   Copyright 1996-2017 The NASM Authors - All Rights Reserved
+##   See the file AUTHORS included with the NASM distribution for
+##   the specific copyright holders.
+##
+##   Redistribution and use in source and binary forms, with or without
+##   modification, are permitted provided that the following
+##   conditions are met:
+##
+##   * Redistributions of source code must retain the above copyright
+##     notice, this list of conditions and the following disclaimer.
+##   * Redistributions in binary form must reproduce the above
+##     copyright notice, this list of conditions and the following
+##     disclaimer in the documentation and/or other materials provided
+##     with the distribution.
+##
+##     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+##     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+##     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+##     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+##     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+##     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+##     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+##     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+##     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+##     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+##     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+##     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+##     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+##
+## --------------------------------------------------------------------------
+
+#
+# Parse AFM metric file, returns a reference to fontdata
+#
+sub parse_afm_file($$) {
+    my($filename, $filetype) = @_;
+
+    my $fontdata = {
+	widths => {},
+	kern => {}
+    };
+
+    my $charmetrics = 0;
+    my $kerndata = 0;
+    my $charcode, $width, $name;
+
+    my $fontfile = $filename.'.'.$filetype;
+    return undef unless ( -f $fontfile );
+
+    $fontdata->{file} = $fontfile;
+    $fontdata->{type} = $filetype;
+    $fontdata->{scale} = 1000;	# AFM metrics always have scale 1000
+
+    return undef unless (open(my $fh, '<', $filename.'.afm'));
+
+    while ( my $line = <$fh> ) {
+	if ( $line =~ /^\s*FontName\s+(.*)\s*$/i ) {
+	    $fontdata->{'name'} = $1;
+	} elsif ( $line =~ /^\s*StartCharMetrics\b/i ) {
+	    $charmetrics = 1;
+	} elsif ( $line =~ /^\s*EndCharMetrics\b/i ) {
+	    $charmetrics = 0;
+	} elsif ( $line =~ /^\s*StartKernPairs\b/i ) {
+	    $kerndata = 1;
+	} elsif ( $line =~ /^\s*EndKernPairs\b/i ) {
+	    $kerndata = 0;
+	} elsif ( $charmetrics ) {
+	    my @data = split(/\s*;\s*/, $line);
+	    undef $charcode, $width, $name;
+	    foreach my $d ( @data ) {
+		my @dd = split(/\s+/, $d);
+		if ( $dd[0] eq 'C' ) {
+		    $charcode = $dd[1];
+		} elsif ( $dd[0] eq 'WX' ) {
+		    $width = $dd[1];
+		} elsif ( $dd[0] eq 'W' ) {
+		    $width = $dd[2];
+		} elsif ( $dd[0] eq 'N' ) {
+		    $name = $dd[1];
+		}
+	    }
+	    if ( defined($name) && defined($width) ) {
+		$fontdata->{widths}{$name} = $width;
+	    }
+	} elsif ( $kerndata ) {
+	    my($kpx, $a, $b, $adj) = split(/\s+/, $line);
+	    if ( $kpx eq 'KPX' ) {
+		if (!exists($fontdata->{kern}{$a})) {
+		    $fontdata->{kern}{$a} = {};
+		}
+		$fontdata->{kern}{$a}{$b} = $adj;
+	    }
+	}
+    }
+
+    return $fontdata;
+}
+
+1;

Файловите разлики са ограничени, защото са твърде много
+ 2698 - 0
nasm/doc/changes.src


+ 180 - 0
nasm/doc/findfont.ph

@@ -0,0 +1,180 @@
+#!/usr/bin/perl
+## --------------------------------------------------------------------------
+##
+##   Copyright 1996-2017 The NASM Authors - All Rights Reserved
+##   See the file AUTHORS included with the NASM distribution for
+##   the specific copyright holders.
+##
+##   Redistribution and use in source and binary forms, with or without
+##   modification, are permitted provided that the following
+##   conditions are met:
+##
+##   * Redistributions of source code must retain the above copyright
+##     notice, this list of conditions and the following disclaimer.
+##   * Redistributions in binary form must reproduce the above
+##     copyright notice, this list of conditions and the following
+##     disclaimer in the documentation and/or other materials provided
+##     with the distribution.
+##
+##     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+##     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+##     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+##     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+##     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+##     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+##     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+##     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+##     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+##     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+##     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+##     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+##     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+##
+## --------------------------------------------------------------------------
+
+#
+# Try our best to find a specific PostScipt font in the system.
+# We need to find the font files so we can extract the metrics.
+# Sadly there isn't any reasonable Perl module to do this for us,
+# as far as I can tell.
+#
+
+use strict;
+use File::Spec;
+use File::Find;
+
+require 'afmmetrics.ph';
+require 'ttfmetrics.ph';
+
+my %font_info_hash = ();
+my $fonts_scanned = 0;
+my %prefs = { 'otf' => 1, 'ttf' => 2, 'pfa' => 3, 'pfb' => 4 };
+
+sub add_file_to_font_hash($) {
+    my($filename) = @_;
+
+    return unless ( -f $filename );
+    return unless ( $filename =~ /^(.*)\.([[:alnum:]]+)$/ );
+
+    my $filestem = $1;
+    my $fonttype = $2;
+    my $fontdata;
+
+    if ( $filename =~ /\.(otf|ttf)$/i ) {
+        $fontdata = parse_ttf_file($filename);
+    } elsif ( $filename =~ /\.(pfa|pfb)$/i ) {
+        if ( -f "${filestem}.afm" ) {
+            $fontdata = parse_afm_file($filestem, $fonttype);
+        }
+    }
+
+    return unless (defined($fontdata));
+
+    my $oldinfo = $font_info_hash{$fontdata->{name}};
+
+    if (!defined($oldinfo) ||
+        $prefs{$fontdata->{type}} < $prefs{$oldinfo->{type}}) {
+        $font_info_hash{$fontdata->{name}} = $fontdata;
+    }
+}
+
+my $win32_ok = eval {
+    require Win32::TieRegistry;
+    Win32::TieRegistry->import();
+    1;
+};
+
+# Based on Font::TTF::Win32 by
+# Martin Hosken <http://scripts.sil.org/FontUtils>.
+# LICENSING
+#
+#   Copyright (c) 1998-2014, SIL International (http://www.sil.org)
+#
+#   This module is released under the terms of the Artistic License 2.0.
+#   For details, see the full text of the license in the file LICENSE.
+sub scanfonts_win32() {
+    return unless ($win32_ok);
+
+    my $Reg = $::Registry->Open('', {Access=>'KEY_READ', Delimiter=>'/'});
+    my $fd;
+    foreach my $win ('Windows NT', 'Windows') {
+	$fd = $Reg->{"HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/$win/CurrentVersion/Fonts"};
+        last if (defined($fd));
+    }
+    return unless (defined($fd));
+
+    foreach my $font (keys(%$fd)) {
+        my($fname, $ftype) = ($font =~ m:^/(.+?)(| \([^\(\)]+\))$:);
+        next unless ($ftype =~ / \((TrueType|OpenType)\)$/);
+        my $file = File::Spec->rel2abs($fd->{$font}, $ENV{'windir'}.'\\fonts');
+        add_file_to_font_hash($file);
+    }
+}
+
+sub font_search_file {
+    add_file_to_font_hash($_);
+}
+
+sub findfont($) {
+    my($fontname) = @_;
+    my $win32 = eval {
+	require Font::TTF::Win32;
+	Font::TTF::Win32->import();
+	1;
+    };
+    my($file, $psname, $fontdata);
+
+    if (exists($font_info_hash{$fontname})) {
+	return $font_info_hash{$fontname};
+    }
+
+    # Are we on a system that uses fontconfig?
+    # NOTE: use a single string for the command here, or this
+    # script dies horribly on Windows, even though this isn't really
+    # applicable there...
+    if (open(my $fh, '-|',
+	     "fc-match -f \"%{file}\\n%{postscriptname}\\n\" ".
+	     "\" : postscriptname=$fontname\"")) {
+        chomp($file = <$fh>);
+        chomp($psname = <$fh>);
+        close($fh);
+        if ( -f $file ) {
+            if ($psname eq $fontname) {
+                add_file_to_font_hash($file);
+            }
+            if (!exists($font_info_hash{$fontname})) {
+                $font_info_hash{$fontname} = undef;
+            }
+            return $font_info_hash{$fontname};
+        }
+    }
+
+    if (exists($font_info_hash{$fontname})) {
+        return $font_info_hash{$fontname};
+    } elsif ($fonts_scanned >= 1) {
+        return $font_info_hash{$fontname} = undef;
+    }
+
+    scanfonts_win32();
+    $fonts_scanned = 1;
+
+    if (exists($font_info_hash{$fontname})) {
+        return $font_info_hash{$fontname};
+    } elsif ($fonts_scanned >= 2) {
+        return $font_info_hash{$fontname} = undef;
+    }
+
+    # Search a set of possible locations for a file, from a few different
+    # systems...
+    my @dirs = ('fonts', '/usr/share/fonts', '/usr/lib/fonts', '/Library/Fonts');
+    push @dirs, $ENV{'windir'}.'\\fonts' if (defined $ENV{'windir'});
+    push @dirs, $ENV{'HOME'}.'/.fonts', $ENV{'HOME'}.'/Library/Fonts'
+	if (defined $ENV{'HOME'});
+
+    find({wanted => \&font_search_file, follow=>1, no_chdir=>1}, @dirs);
+    $fonts_scanned = 2;
+
+    return $font_info_hash{$fontname};
+}
+
+1;

Файловите разлики са ограничени, защото са твърде много
+ 1294 - 0
nasm/doc/genps.pl


+ 401 - 0
nasm/doc/head.ps

@@ -0,0 +1,401 @@
+%
+% PostScript header for NASM documentation
+%
+
+% Avoid barfing on old PS implementations
+/pdfmark where
+{pop} {userdict /pdfmark /cleartomark load put} ifelse
+/setpagedevice where
+{pop} {userdict /setpagedevice /pop load put} ifelse
+
+% Useful definition
+/space 32 def
+
+%
+% This asks the PostScript interpreter for the proper size paper
+%
+/setpagesize {
+  1 dict dup /PageSize [pagewidth pageheight] put setpagedevice
+} def
+
+%
+% Code to handle links
+%
+/min { 2 copy gt { exch } if pop } def
+/max { 2 copy lt { exch } if pop } def
+
+/lkbegun 0 def
+/lktype null def
+/lkury 0 def
+/lkurx 0 def
+/lklly 0 def
+/lkllx 0 def
+/lkxmarg 1 def	% Extra space for link in x dir
+/lkymarg 1 def	% Extra space for link in y dir
+/lktarget () def
+
+% target type --
+/linkbegin {
+  userdict begin
+    /lkbegun 1 def
+    /lktype exch def
+    /lktarget exch def
+    colorlinks { 0 0 0.4 setrgbcolor } if
+  end
+} def
+
+% target --
+/linkbegindest {
+  /Dest linkbegin
+} def
+
+% uristring --
+/linkbeginuri {
+  /URI linkbegin
+} def
+
+% pageno --
+/linkbeginpage {
+  /Page linkbegin
+} def
+
+% string spacepadding --
+/linkshow {
+  userdict begin
+    /lspad exch def /lss exch def
+    lkbegun 0 ne {
+      gsave lss true charpath flattenpath pathbbox grestore
+      lkbegun 1 eq {
+        /lkury exch def
+        lss spacecount lspad mul add /lkurx exch def
+        /lklly exch def
+        /lkllx exch def
+        /lkbegun 2 def
+      } {
+        lkury max /lkury exch def
+        lss spacecount lspad mul add lkurx max /lkurx exch def
+        lklly min /lklly exch def
+        lkllx min /lkllx exch def
+      } ifelse
+    } if
+    lspad 0 space lss widthshow
+  end
+} def
+
+% --
+/linkend {
+  userdict begin
+    [ lktype /URI eq {
+        /Action 2 dict dup /Subtype /URI put dup /URI lktarget put
+      } {
+	/Dest lktarget
+      } ifelse
+      /Border [0 0 0]
+      /Rect [ lkllx lkxmarg sub
+              lklly lkymarg sub
+              lkurx lkxmarg add
+              lkury lkymarg add ]
+      /Subtype /Link
+      /ANN pdfmark
+    /lkbegun 0 def
+    colorlinks { 0 setgray } if
+  end
+} def
+
+% targetname --
+/linkdest {
+  [ /Dest 3 -1 roll
+    /View [ /XYZ currentpoint null ]
+    /DEST pdfmark
+} def
+
+% A "fontset" is an array of fonts; a "stream" is an array of strings
+% and numbers or procedures:
+% [ 0 (Foo) ( ) (mani) ( ) 1 (padme) 0 ( ) (hum.) ]
+% A number choses a font from the current fontset.
+% A procedure is invoked as-is when printing the stream.
+%
+% When printing justified, an equal amount of space is added in
+% between each string.
+
+% string -- spacecount
+% Count space characters in a string
+/spacecount {
+  0 exch {
+    space eq { 1 add } if
+  } forall
+} def
+
+% stream fontset -- spacecount width
+% Get the width of a stream in the given fontset, and the
+% number of space characters in the stream
+/streamwidth {
+  gsave
+    6 dict begin
+      /f exch def
+      /w 0 def
+      /s 0 def
+      f 0 get setfont
+      /integertype {
+        f exch get setfont
+      } def
+      /stringtype {
+        dup stringwidth pop w add /w exch def
+        spacecount s add /s exch def
+      } def
+      /arraytype { pop } def
+      % The input stream is on the top of the stack now
+      {
+        dup type exec
+      } forall
+      s w
+    end
+  grestore
+} def
+
+% stream fontset spacer --
+% Show the stream in the given fontset, but add a certain amount
+% of space to each space character
+/showstreamspc {
+  5 dict begin
+    /spc exch def
+    /f exch def
+    f 0 get setfont
+    /integertype {
+      f exch get setfont
+    } def
+    /stringtype {
+      spc linkshow
+    } def
+    /arraytype {
+      exec
+    } def
+    % Now stream is on the top of the stack
+    {
+      dup type exec
+    } forall
+  end
+} def
+
+% stream fontset --
+% Show the stream in the given fontset, with no extra spacing
+/showstream {
+  0 showstreamspc
+} def
+
+% stream fontset totalspace --
+% Show the stream justified to fit into a certain number of pixels
+/showstreamjust {
+  userdict begin
+    /ts exch def /fs exch def /st exch def
+      st fs
+        st fs streamwidth ts exch sub exch
+	dup 0 gt { div } { pop } ifelse
+      showstreamspc
+    end
+} def
+
+/bullmarg lmarg bulladj add def
+/lwidth pagewidth lmarg sub rmarg sub def
+/bwidth lwidth bulladj sub def
+
+%
+% The various paragraph types
+% The number at the end indicates start (1) of para, end (2) of para
+%
+/chapline {
+	currentpoint exch pop 10 sub lmarg exch moveto
+	0 setlinecap 3 setlinewidth
+	lwidth 0 rlineto stroke
+} def
+
+/chap0 { lmarg exch moveto cfont lwidth showstreamjust } def
+/chap1 { lmarg exch moveto cfont lwidth showstreamjust } def
+/chap2 { lmarg exch moveto cfont showstream chapline } def
+/chap3 { lmarg exch moveto cfont showstream chapline } def
+
+/appn0 {chap0} def
+/appn1 {chap1} def
+/appn2 {chap2} def
+/appn3 {chap3} def
+
+% lbl ypos fontset -- ypos
+/headlbl {
+  3 -1 roll [exch (  )] exch % ypos strm fontset
+  2 copy % ypos strm fontset strm fontset
+  streamwidth % ypos strm fontset spccount width
+  lmarg exch sub % ypos strm fontset spccount xpos
+  4 index % ypos strm fontset spccount xpos ypos
+  moveto % ypos strm fontset spccount
+  pop % ypos strm fontset spccount
+  showstream % ypos
+} def
+
+/head0 { lmarg exch moveto hfont lwidth showstreamjust } def
+/head1 { hfont headlbl lmarg exch moveto hfont lwidth showstreamjust } def
+/head2 { lmarg exch moveto hfont showstream } def
+/head3 { hfont headlbl lmarg exch moveto hfont showstream } def
+
+/subh0 { lmarg exch moveto sfont lwidth showstreamjust } def
+/subh1 { sfont headlbl lmarg exch moveto sfont lwidth showstreamjust } def
+/subh2 { lmarg exch moveto sfont showstream } def
+/subh3 { sfont headlbl lmarg exch moveto sfont showstream } def
+
+/norm0 { lmarg exch moveto bfont lwidth showstreamjust } def
+/norm1 { lmarg exch moveto bfont lwidth showstreamjust } def
+/norm2 { lmarg exch moveto bfont showstream } def
+/norm3 { lmarg exch moveto bfont showstream } def
+
+/code0 { lmarg exch moveto bfont showstream } def
+/code1 { lmarg exch moveto bfont showstream } def
+/code2 { lmarg exch moveto bfont showstream } def
+/code3 { lmarg exch moveto bfont showstream } def
+
+/bull0 { bullmarg exch moveto bfont bwidth showstreamjust } def
+/bull1 { dup lmarg exch moveto bullet bfont showstream
+	 bullmarg exch moveto bfont bwidth showstreamjust } def
+/bull2 { bullmarg exch moveto bfont showstream } def
+/bull3 { dup lmarg exch moveto bullet bfont showstream
+	 bullmarg exch moveto bfont showstream } def
+
+/indt0 { bullmarg exch moveto bfont bwidth showstreamjust } def
+/indt1 { bullmarg exch moveto bfont bwidth showstreamjust } def
+/indt2 { bullmarg exch moveto bfont showstream } def
+/indt3 { bullmarg exch moveto bfont showstream } def
+
+/bquo0 { bullmarg exch moveto qfont bwidth showstreamjust } def
+/bquo1 { bullmarg exch moveto qfont bwidth showstreamjust } def
+/bquo2 { bullmarg exch moveto qfont showstream } def
+/bquo3 { bullmarg exch moveto qfont showstream } def
+
+/tocw0 lwidth tocpnz sub def
+/tocw1 tocw0 tocind sub def
+/tocw2 tocw1 tocind sub def
+
+/tocx0 lmarg def
+/tocx1 tocx0 tocind add def
+/tocx2 tocx1 tocind add def
+
+/tocpn {
+  bfont0 setfont
+  3 dict begin
+    /s exch def
+    /x s stringwidth pop pagewidth rmarg sub exch sub def
+    currentpoint /y exch def
+    lmarg sub tocdots div ceiling tocdots mul lmarg add
+    tocdots x {
+      y moveto (.) 0 linkshow
+    } for
+    x y moveto s 0 linkshow
+  end
+  linkend
+} def
+
+/toc00 { tocx0 exch moveto 0 rmoveto bfont showstream } def
+/toc01 { tocx0 exch moveto
+	 linkbegindest bfont0 setfont 0 linkshow bfont showstream } def
+/toc02 { tocx0 exch moveto 3 1 roll
+	 0 rmoveto bfont showstream tocpn } def
+/toc03 { tocx0 exch moveto 4 1 roll
+	 linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def
+
+/toc10 { tocx1 exch moveto 0 rmoveto bfont showstream } def
+/toc11 { tocx1 exch moveto
+	 linkbegindest bfont0 setfont 0 linkshow bfont showstream } def
+/toc12 { tocx1 exch moveto 3 1 roll
+	 0 rmoveto bfont showstream tocpn } def
+/toc13 { tocx1 exch moveto 4 1 roll
+	 linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def
+
+/toc20 { tocx2 exch moveto 0 rmoveto bfont showstream } def
+/toc21 { tocx2 exch moveto
+	 linkbegindest bfont0 setfont 0 linkshow bfont showstream } def
+/toc22 { tocx2 exch moveto 3 1 roll
+	 0 rmoveto bfont showstream tocpn } def
+/toc23 { tocx2 exch moveto 4 1 roll
+	 linkbegindest bfont0 setfont 0 linkshow bfont showstream tocpn } def
+
+% Spacing between index columns
+/indexcolumn pagewidth lmarg sub rmarg sub idxgutter add idxcolumns div def
+% Width of an individual index column
+/indexcolwid indexcolumn idxgutter sub def
+
+/idx03 {
+  2 dict begin
+    indexcolumn mul lmarg add
+    /x exch def /y exch def x y moveto
+    exch bfont showstream
+    dup bfont streamwidth
+    x indexcolwid add exch sub exch pop y moveto
+    bfont showstream
+  end
+} def
+/idx00 {idx03} def
+/idx01 {idx03} def
+/idx02 {idx03} def
+
+/idx13 {
+  2 dict begin
+    indexcolumn mul lmarg add idxindent add
+    /x exch def /y exch def x y moveto
+    exch bfont showstream
+    dup bfont streamwidth
+    x indexcolwid idxindent sub add exch sub exch pop y moveto
+    bfont showstream
+  end
+} def
+/idx10 {idx13} def
+/idx11 {idx13} def
+/idx12 {idx13} def
+
+%
+% Page numbers
+%
+/pagey botmarg pymarg sub def
+/pagel lmarg plmarg sub def
+/pager pagewidth rmarg sub prmarg add def
+
+/pageeven { pagel pagey moveto bfont1 setfont show } def
+/pageodd  { bfont1 setfont dup stringwidth pop pager exch sub
+	    pagey moveto show } def
+
+%
+% Functions invoked during parsing
+%
+/xa { linkdest } def
+/pa { 0 pageheight moveto linkdest } def
+/xl { linkbegindest } def
+/wl { linkbeginuri } def
+/pl { linkbeginpage } def
+/el { linkend } def
+
+%
+% PDF viewer options
+%
+[/PageMode /UseOutlines /DOCVIEW pdfmark	% Display bookmarks
+
+%
+% Functions to include EPS
+%
+/BeginEPSF {
+  /Before_EPSF_State save def
+  /dict_count countdictstack def
+  /op_count count 1 sub def
+  userdict begin
+  /showpage {} def
+  0 setgray 0 setlinecap
+  1 setlinewidth 0 setlinejoin
+  10 setmiterlimit [ ] 0 setdash newpath
+  /languagelevel where
+  {
+    pop languagelevel
+    1 ne {
+      false setstrokeadjust false setoverprint
+    } if
+  } if
+} bind def
+/EndEPSF {
+  count op_count sub {pop} repeat
+  countdictstack dict_count sub {end} repeat
+  Before_EPSF_State restore
+} bind def

+ 108 - 0
nasm/doc/inslist.pl

@@ -0,0 +1,108 @@
+#!/usr/bin/perl
+## --------------------------------------------------------------------------
+##   
+##   Copyright 1996-2017 The NASM Authors - All Rights Reserved
+##   See the file AUTHORS included with the NASM distribution for
+##   the specific copyright holders.
+##
+##   Redistribution and use in source and binary forms, with or without
+##   modification, are permitted provided that the following
+##   conditions are met:
+##
+##   * Redistributions of source code must retain the above copyright
+##     notice, this list of conditions and the following disclaimer.
+##   * Redistributions in binary form must reproduce the above
+##     copyright notice, this list of conditions and the following
+##     disclaimer in the documentation and/or other materials provided
+##     with the distribution.
+##     
+##     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+##     CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+##     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+##     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+##     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+##     CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+##     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+##     NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+##     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+##     HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+##     CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+##     OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+##     EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+##
+## --------------------------------------------------------------------------
+
+#
+# inslist.pl   produce inslist.src
+#
+
+print STDERR "Reading insns.dat...\n";
+
+@args   = ();
+undef $output;
+foreach $arg ( @ARGV ) {
+    if ( $arg =~ /^\-/ ) {
+	if  ( $arg =~ /^\-([adins])$/ ) {
+	    $output = $1;
+	} else {
+	    die "$0: Unknown option: ${arg}\n";
+	}
+    } else {
+	push (@args, $arg);
+    }
+}
+
+$fname = "../insns.dat" unless $fname = $args[0];
+open (F, '<', $fname) || die "unable to open $fname";
+print STDERR "Writing inslist.src...\n";
+open S, '>', 'inslist.src';
+$line = 0;
+$insns = 0;
+while (<F>) {
+  $line++;
+  next if (/^\s*$/);		# blank lines
+  if ( /^\s*;/ )		# comments
+  {
+    if ( /^\s*;\#\s*(.+)/ )	# section subheader
+    {
+      print S "\n\\S{} $1\n\n";
+    }
+    next;
+  }
+  chomp;
+  unless (/^\s*(\S+)\s+(\S+)\s+(\S+|\[.*\])\s+(\S+)\s*$/) {
+      warn "line $line does not contain four fields\n";
+      next;
+  }
+  my @entry = ($1, $2, $3, $4);
+
+  $entry[1] =~ s/ignore//;
+  $entry[1] =~ s/void//;
+
+  my @flags = split(/,/, $entry[3]);
+  my @nflags;
+  undef $isavx512;
+  undef @avx512fl;
+  for my $fl (@flags) {
+      next if ($fl =~ /^(ignore|SB|SM|SM2|SQ|AR2|FUTURE)$/);
+
+      if ($fl =~ /^AVX512(.*)$/) {
+	  $isavx512 = 1;
+	  push(@avx512fl, $1) unless ($1 eq '');
+      } else {
+	  push(@nflags,$fl);
+      }
+  }
+
+  if ($isavx512) {
+      unshift(@nflags, "AVX512".join('/', @avx512fl));
+  }
+
+  printf S "\\c %-16s %-24s %s\n",$entry[0],$entry[1], join(',', @nflags);
+  $insns++;
+}
+print S "\n";
+close S;
+close F;
+printf STDERR "Done: %d instructions\n", $insns;
+

+ 290 - 0
nasm/doc/internal.doc

@@ -0,0 +1,290 @@
+Internals of the Netwide Assembler
+==================================
+
+The Netwide Assembler is intended to be a modular, re-usable x86
+assembler, which can be embedded in other programs, for example as
+the back end to a compiler.
+
+The assembler is composed of modules. The interfaces between them
+look like:
+
+		  +--- preproc.c ----+
+		  |		     |
+		  +---- parser.c ----+
+		  |	   |         |
+		  |     float.c      |
+		  |		     |
+		  +--- assemble.c ---+
+		  |        |         |
+	nasm.c ---+     insnsa.c     +--- nasmlib.c
+		  |		     |
+		  +--- listing.c ----+
+		  |		     |
+		  +---- labels.c ----+
+		  |		     |
+		  +--- outform.c ----+
+		  |		     |
+		  +----- *out.c -----+
+
+In other words, each of `preproc.c', `parser.c', `assemble.c',
+`labels.c', `listing.c', `outform.c' and each of the output format
+modules `*out.c' are independent modules, which do not directly
+inter-communicate except through the main program.
+
+The Netwide *Disassembler* is not intended to be particularly
+portable or reusable or anything, however. So I won't bother
+documenting it here. :-)
+
+nasmlib.c
+---------
+
+This is a library module; it contains simple library routines which
+may be referenced by all other modules. Among these are a set of
+wrappers around the standard `malloc' routines, which will report a
+fatal error if they run out of memory, rather than returning NULL.
+
+preproc.c
+---------
+
+This contains a macro preprocessor, which takes a file name as input
+and returns a sequence of preprocessed source lines. The only symbol
+exported from the module is `nasmpp', which is a data structure of
+type `Preproc', declared in nasm.h. This structure contains pointers
+to all the functions designed to be callable from outside the
+module.
+
+parser.c
+--------
+
+This contains a source-line parser. It parses `canonical' assembly
+source lines, containing some combination of the `label', `opcode',
+`operand' and `comment' fields: it does not process directives or
+macros. It exports two functions: `parse_line' and `cleanup_insn'.
+
+`parse_line' is the main parser function: you pass it a source line
+in ASCII text form, and it returns you an `insn' structure
+containing all the details of the instruction on that line. The
+parameters it requires are:
+
+- The location (segment, offset) where the instruction on this line
+  will eventually be placed. This is necessary in order to evaluate
+  expressions containing the Here token, `$'.
+
+- A function which can be called to retrieve the value of any
+  symbols the source line references.
+
+- Which pass the assembler is on: an undefined symbol only causes an
+  error condition on pass two.
+
+- The source line to be parsed.
+
+- A structure to fill with the results of the parse.
+
+- A function which can be called to report errors.
+
+Some instructions (DB, DW, DD for example) can require an arbitrary
+amount of storage, and so some of the members of the resulting
+`insn' structure will be dynamically allocated. The other function
+exported by `parser.c' is `cleanup_insn', which can be called to
+deallocate any dynamic storage associated with the results of a
+parse.
+
+names.c
+-------
+
+This doesn't count as a module - it defines a few arrays which are
+shared between NASM and NDISASM, so it's a separate file which is
+#included by both parser.c and disasm.c.
+
+float.c
+-------
+
+This is essentially a library module: it exports one function,
+`float_const', which converts an ASCII representation of a
+floating-point number into an x86-compatible binary representation,
+without using any built-in floating-point arithmetic (so it will run
+on any platform, portably). It calls nothing, and is called only by
+`parser.c'. Note that the function `float_const' must be passed an
+error reporting routine.
+
+assemble.c
+----------
+
+This module contains the code generator: it translates `insn'
+structures as returned from the parser module into actual generated
+code which can be placed in an output file. It exports two
+functions, `assemble' and `insn_size'.
+
+`insn_size' is designed to be called on pass one of assembly: it
+takes an `insn' structure as input, and returns the amount of space
+that would be taken up if the instruction described in the structure
+were to be converted to real machine code. `insn_size' also requires
+to be told the location (as a segment/offset pair) where the
+instruction would be assembled, the mode of assembly (16/32 bit
+default), and a function it can call to report errors.
+
+`assemble' is designed to be called on pass two: it takes all the
+parameters that `insn_size' does, but has an extra parameter which
+is an output driver. `assemble' actually converts the input
+instruction into machine code, and outputs the machine code by means
+of calling the `output' function of the driver.
+
+insnsa.c
+--------
+
+This is another library module: it exports one very big array of
+instruction translations. It is generated automatically from the
+insns.dat file by the insns.pl script.
+
+labels.c
+--------
+
+This module contains a label manager. It exports six functions:
+
+`init_labels' should be called before any other function in the
+module. `cleanup_labels' may be called after all other use of the
+module has finished, to deallocate storage.
+
+`define_label' is called to define new labels: you pass it the name
+of the label to be defined, and the (segment,offset) pair giving the
+value of the label. It is also passed an error-reporting function,
+and an output driver structure (so that it can call the output
+driver's label-definition function). `define_label' mentally
+prepends the name of the most recently defined non-local label to
+any label beginning with a period.
+
+`define_label_stub' is designed to be called in pass two, once all
+the labels have already been defined: it does nothing except to
+update the "most-recently-defined-non-local-label" status, so that
+references to local labels in pass two will work correctly.
+
+`declare_as_global' is used to declare that a label should be
+global. It must be called _before_ the label in question is defined.
+
+Finally, `lookup_label' attempts to translate a label name into a
+(segment,offset) pair. It returns non-zero on success.
+
+The label manager module is (theoretically :) restartable: after
+calling `cleanup_labels', you can call `init_labels' again, and
+start a new assembly with a new set of symbols.
+
+listing.c
+---------
+
+This file contains the listing file generator. The interface to the
+module is through the one symbol it exports, `nasmlist', which is a
+structure containing six function pointers. The calling semantics of
+these functions isn't terribly well thought out, as yet, but it
+works (just about) so it's going to get left alone for now...
+
+outform.c
+---------
+
+This small module contains a set of routines to manage a list of
+output formats, and select one given a keyword. It contains three
+small routines: `ofmt_register' which registers an output driver as
+part of the managed list, `ofmt_list' which lists the available
+drivers on stdout, and `ofmt_find' which tries to find the driver
+corresponding to a given name.
+
+The output modules
+------------------
+
+Each of the output modules, `outbin.o', `outelf.o' and so on,
+exports only one symbol, which is an output driver data structure
+containing pointers to all the functions needed to produce output
+files of the appropriate type.
+
+The exception to this is `outcoff.o', which exports _two_ output
+driver structures, since COFF and Win32 object file formats are very
+similar and most of the code is shared between them.
+
+nasm.c
+------
+
+This is the main program: it calls all the functions in the above
+modules, and puts them together to form a working assembler. We
+hope. :-)
+
+Segment Mechanism
+-----------------
+
+In NASM, the term `segment' is used to separate the different
+sections/segments/groups of which an object file is composed.
+Essentially, every address NASM is capable of understanding is
+expressed as an offset from the beginning of some segment.
+
+The defining property of a segment is that if two symbols are
+declared in the same segment, then the distance between them is
+fixed at assembly time. Hence every externally-declared variable
+must be declared in its own segment, since none of the locations of
+these are known, and so no distances may be computed at assembly
+time.
+
+The special segment value NO_SEG (-1) is used to denote an absolute
+value, e.g. a constant whose value does not depend on relocation,
+such as the _size_ of a data object.
+
+Apart from NO_SEG, segment indices all have their least significant
+bit clear, if they refer to actual in-memory segments. For each
+segment of this type, there is an auxiliary segment value, defined
+to be the same number but with the LSB set, which denotes the
+segment-base value of that segment, for object formats which support
+it (Microsoft .OBJ, for example).
+
+Hence, if `textsym' is declared in a code segment with index 2, then
+referencing `SEG textsym' would return zero offset from
+segment-index 3. Or, in object formats which don't understand such
+references, it would return an error instead.
+
+The next twist is SEG_ABS. Some symbols may be declared with a
+segment value of SEG_ABS plus a 16-bit constant: this indicates that
+they are far-absolute symbols, such as the BIOS keyboard buffer
+under MS-DOS, which always resides at 0040h:001Eh. Far-absolutes are
+handled with care in the parser, since they are supposed to evaluate
+simply to their offset part within expressions, but applying SEG to
+one should yield its segment part. A far-absolute should never find
+its way _out_ of the parser, unless it is enclosed in a WRT clause,
+in which case Microsoft 16-bit object formats will want to know
+about it.
+
+Porting Issues
+--------------
+
+We have tried to write NASM in portable ANSI C: we do not assume
+little-endianness or any hardware characteristics (in order that
+NASM should work as a cross-assembler for x86 platforms, even when
+run on other, stranger machines).
+
+Assumptions we _have_ made are:
+
+- We assume that `short' is at least 16 bits, and `long' at least
+  32. This really _shouldn't_ be a problem, since Kernighan and
+  Ritchie tell us we are entitled to do so.
+
+- We rely on having more than 6 characters of significance on
+  externally linked symbols in the NASM sources. This may get fixed
+  at some point. We haven't yet come across a linker brain-dead
+  enough to get it wrong anyway.
+
+- We assume that `fopen' using the mode "wb" can be used to write
+  binary data files. This may be wrong on systems like VMS, with a
+  strange file system. Though why you'd want to run NASM on VMS is
+  beyond me anyway.
+
+That's it. Subject to those caveats, NASM should be completely
+portable. If not, we _really_ want to know about it.
+
+Porting Non-Issues
+------------------
+
+The following is _not_ a portability problem, although it looks like
+one.
+
+- When compiling with some versions of DJGPP, you may get errors
+  such as `warning: ANSI C forbids braced-groups within
+  expressions'. This isn't NASM's fault - the problem seems to be
+  that DJGPP's definitions of the <ctype.h> macros include a
+  GNU-specific C extension. So when compiling using -ansi and
+  -pedantic, DJGPP complains about its own header files. It isn't a
+  problem anyway, since it still generates correct code.

+ 1 - 0
nasm/doc/local.css

@@ -0,0 +1 @@
+/* Add site-local nasmdoc style configuration to this file */

+ 150 - 0
nasm/doc/nasmdoc.css

@@ -0,0 +1,150 @@
+body {
+    font-family: "source sans pro", "clear sans", "liberation sans",
+    "arial", "sans-serif";
+    background: white;
+}
+div.title {
+    text-align: center;
+    font-weight: bold;
+    margin: 0.67em 0;
+}
+h1 {
+    font-size: 2em;
+    margin: 0;
+}
+span.subtitle {
+    font-size: 1.25em;
+    font-style: italic;
+}
+code, pre {
+    font-family: "source code pro", "liberation mono", "monospace";
+}
+pre, blockquote {
+    margin-left: 4em;
+    margin-right: 4em;
+}
+code {
+    display: inline;
+    white-space: nowrap;
+}
+a {
+    text-decoration: none;
+}
+div.toc {
+    padding-left: 0;
+    font-size: 195%;
+}
+div.toc li {
+    list-style-type: none;
+    padding-left: 0;
+}
+div.toc ol {
+    padding-left: 2em;
+    font-size: 80%;
+}
+li.toc1 {
+    padding-top: 0.7em;
+}
+li.toc2 {
+    padding-top: 0.3em;
+}
+ul.index {
+    list-style-type: none;
+}
+@media not screen {
+    ul.navbar {
+	display: none;
+    }
+}
+@media print {
+    a {
+	color: inherit;
+    }
+}
+@media only screen {
+    div.contents {
+	-webkit-column-gap: 4em;
+	-webkit-column-rule: 1px dotted black;
+	-moz-column-gap: 4em;
+	-moz-column-rule: 1px dotted black;
+	column-gap: 4em;
+	column-rule: 1px dotted black;
+    }
+}
+@media only screen and (min-width: 90em) {
+    /* For a very wide screen, go to a columnar layout */
+    div.contents {
+	-webkit-column-count: 2;
+	-moz-column-count: 2;
+	column-count: 2;
+    }
+}
+@media only screen and (min-width: 135em) {
+    div.contents {
+	-webkit-column-count: 3;
+	-moz-column-count: 3;
+	column-count: 3;
+    }
+}
+@media screen {
+    /* Setting an explicit margin to keep the navbar from moving */
+    body {
+	padding: 0;
+	margin: 8px;
+    }
+
+    /* Link styles */
+    a:link {
+	color: #33c;
+    }
+    a:visited {
+	color: #338;
+    }
+    a:hover {
+	background: #ccc;
+    }
+    a:active {
+	color: #f33;
+	background: #ccc;
+    }
+
+    /* Trick to avoid the navbar hiding the the target of an # link */
+    :target {
+	margin-top: -10vh;
+	padding-top: 10vh;
+	background: #ffa;	/* Highlight the jump target */
+	background-clip: content-box;
+    }
+
+    ul.navbar {
+	display: block;
+	position: sticky;
+	top: 8px;
+	width: 100%;
+	margin: 0;
+	padding: 0;
+	overflow: hidden;
+	white-space: nowrap;
+	list-style-type: none;
+	background: #336 url("nasmlogw.png") no-repeat right center;
+	background-size: contain;
+    }
+
+    ul.navbar li {
+	float: left;
+    }
+    ul.navbar li.last {
+	border-right: none;
+    }
+    ul.navbar a {
+	border-right: 1px solid #bbb;
+	display: block;
+	color: white;
+	text-align: center;
+	padding: 1em 1.5em;
+	text-decoration: none;
+    }
+    ul.navbar a:hover {
+	background-color: #448;
+    }
+}

Файловите разлики са ограничени, защото са твърде много
+ 8475 - 0
nasm/doc/nasmdoc.src


+ 212 - 0
nasm/doc/nasmlogo.eps

@@ -0,0 +1,212 @@
+%!PS-Adobe-3.0 EPSF-3.0
+%%Creator: cairo 1.10.2 (http://cairographics.org)
+%%CreationDate: Sun Feb 26 02:08:42 2012
+%%Pages: 1
+%%BoundingBox: 44 42 306 306
+%%DocumentData: Clean7Bit
+%%LanguageLevel: 2
+%%EndComments
+%%BeginProlog
+/cairo_eps_state save def
+/dict_count countdictstack def
+/op_count count 1 sub def
+userdict begin
+/q { gsave } bind def
+/Q { grestore } bind def
+/cm { 6 array astore concat } bind def
+/w { setlinewidth } bind def
+/J { setlinecap } bind def
+/j { setlinejoin } bind def
+/M { setmiterlimit } bind def
+/d { setdash } bind def
+/m { moveto } bind def
+/l { lineto } bind def
+/c { curveto } bind def
+/h { closepath } bind def
+/re { exch dup neg 3 1 roll 5 3 roll moveto 0 rlineto
+      0 exch rlineto 0 rlineto closepath } bind def
+/S { stroke } bind def
+/f { fill } bind def
+/f* { eofill } bind def
+/n { newpath } bind def
+/W { clip } bind def
+/W* { eoclip } bind def
+/BT { } bind def
+/ET { } bind def
+/pdfmark where { pop globaldict /?pdfmark /exec load put }
+    { globaldict begin /?pdfmark /pop load def /pdfmark
+    /cleartomark load def end } ifelse
+/BDC { mark 3 1 roll /BDC pdfmark } bind def
+/EMC { mark /EMC pdfmark } bind def
+/cairo_store_point { /cairo_point_y exch def /cairo_point_x exch def } def
+/Tj { show currentpoint cairo_store_point } bind def
+/TJ {
+  {
+    dup
+    type /stringtype eq
+    { show } { -0.001 mul 0 cairo_font_matrix dtransform rmoveto } ifelse
+  } forall
+  currentpoint cairo_store_point
+} bind def
+/cairo_selectfont { cairo_font_matrix aload pop pop pop 0 0 6 array astore
+    cairo_font exch selectfont cairo_point_x cairo_point_y moveto } bind def
+/Tf { pop /cairo_font exch def /cairo_font_matrix where
+      { pop cairo_selectfont } if } bind def
+/Td { matrix translate cairo_font_matrix matrix concatmatrix dup
+      /cairo_font_matrix exch def dup 4 get exch 5 get cairo_store_point
+      /cairo_font where { pop cairo_selectfont } if } bind def
+/Tm { 2 copy 8 2 roll 6 array astore /cairo_font_matrix exch def
+      cairo_store_point /cairo_font where { pop cairo_selectfont } if } bind def
+/g { setgray } bind def
+/rg { setrgbcolor } bind def
+/d1 { setcachedevice } bind def
+%%EndProlog
+%%Page: 1 1
+%%BeginPageSetup
+%%PageBoundingBox: 44 42 306 306
+%%EndPageSetup
+q 44 42 262 264 rectclip q
+0.501961 g
+279.656 304.422 m 265.238 304.422 253.559 292.734 253.559 278.32 c 
+253.559 273.254 255.023 268.539 257.523 264.535 c 240.906 247.918 l 
+220.031 266.812 192.352 278.32 161.977 278.32 c 96.988 278.32 44.297 
+225.633 44.297 160.64 c 44.297 95.648 96.988 42.965 161.977 42.965 c 
+226.969 42.965 279.656 95.648 279.656 160.64 c 279.656 191.012 268.145 
+218.695 249.254 239.574 c 265.871 256.191 l 269.875 253.691 274.59 
+252.223 279.66 252.223 c 294.07 252.223 305.754 263.906 305.754 278.32 
+c 305.754 292.73 294.07 304.422 279.656 304.422 c h
+279.656 304.422 m f
+1 g
+107.184 140.832 m 107 140.492 106.547 140.324 105.816 140.324 c 97.219 
+140.324 l 96.07 140.324 95.5 140.871 95.5 141.965 c 95.5 145.406 95.508 
+148.82 95.535 152.207 c 95.562 155.594 95.574 159.008 95.574 162.445 c 
+95.574 164.637 95.195 166.187 94.441 167.098 c 93.684 168.008 92.469 
+168.465 90.805 168.465 c 89.555 168.465 88.199 168.164 86.742 167.566 c 
+85.281 166.965 84.086 166.508 83.145 166.195 c 83.145 141.965 l 83.145 
+141.547 83.051 141.172 82.871 140.828 c 82.688 140.492 82.234 140.324 
+81.504 140.324 c 72.984 140.324 l 72.309 140.324 71.852 140.465 71.617 
+140.754 c 71.379 141.039 71.266 141.445 71.266 141.965 c 71.266 177.14 
+l 71.266 177.664 71.379 178.078 71.617 178.39 c 71.852 178.703 72.309 
+178.863 72.984 178.863 c 81.504 178.863 l 82.23 178.863 82.688 178.676 
+82.871 178.312 c 83.055 177.949 83.145 177.558 83.145 177.14 c 83.145 
+175.265 l 83.195 175.265 83.238 175.25 83.262 175.226 c 83.289 175.199 
+83.324 175.187 83.379 175.187 c 85.098 176.492 87.105 177.547 89.398 
+178.351 c 91.688 179.16 93.773 179.566 95.648 179.566 c 98.414 179.566 
+100.59 179.109 102.176 178.199 c 103.77 177.285 104.953 176.086 105.734 
+174.601 c 106.52 173.117 106.996 171.461 107.18 169.637 c 107.363 
+167.812 107.453 165.988 107.453 164.168 c 107.453 141.965 l 107.461 
+141.547 107.367 141.172 107.184 140.832 c h
+107.184 140.832 m f
+137.324 145.015 m 136.281 144.078 135.16 143.269 133.965 142.594 c 
+132.766 141.914 131.543 141.355 130.289 140.914 c 129.039 140.469 
+127.812 140.16 126.613 139.976 c 125.414 139.793 124.32 139.703 123.332 
+139.703 c 121.039 139.703 119.176 140.027 117.742 140.68 c 116.309 
+141.328 115.199 142.18 114.422 143.223 c 113.637 144.262 113.102 
+145.473 112.82 146.855 c 112.531 148.234 112.391 149.68 112.391 151.195 
+c 112.336 153.594 112.66 155.621 113.367 157.293 c 114.07 158.961 
+115.074 160.301 116.375 161.316 c 117.68 162.332 119.27 163.066 121.145 
+163.508 c 123.02 163.949 125.105 164.172 127.398 164.172 c 136.391 
+164.172 l 136.391 165.422 l 136.391 166.254 136.293 166.961 136.117 
+167.531 c 135.93 168.105 135.594 168.574 135.102 168.937 c 134.605 
+169.305 133.914 169.578 133.027 169.762 c 132.141 169.941 130.969 
+170.035 129.512 170.035 c 128.938 170.035 128.219 170.008 127.359 
+169.957 c 126.5 169.902 125.605 169.851 124.664 169.797 c 123.727 
+169.746 122.785 169.668 121.848 169.562 c 120.91 169.461 120.051 
+169.379 119.27 169.328 c 118.176 169.226 117.457 169.226 117.121 
+169.328 c 116.781 169.433 116.508 169.879 116.301 170.66 c 115.441 
+174.723 l 115.336 175.398 115.43 175.957 115.715 176.402 c 116 176.844 
+116.742 177.301 117.941 177.769 c 118.828 178.086 119.855 178.355 
+121.031 178.594 c 122.203 178.828 123.402 179.023 124.625 179.18 c 
+125.852 179.336 127.062 179.453 128.262 179.531 c 129.461 179.609 
+130.504 179.644 131.391 179.644 c 135.035 179.644 137.969 179.308 
+140.184 178.629 c 142.398 177.953 144.09 176.988 145.266 175.738 c 
+146.438 174.488 147.203 172.949 147.57 171.125 c 147.934 169.301 
+148.117 167.219 148.117 164.871 c 148.117 152.523 l 148.117 151.687 
+148.156 151.035 148.238 150.566 c 148.312 150.098 148.457 149.746 
+148.664 149.512 c 148.871 149.277 149.16 149.105 149.523 149.004 c 
+149.887 148.898 150.383 148.82 151.008 148.769 c 151.688 148.715 
+152.129 148.598 152.336 148.418 c 152.547 148.234 152.652 147.91 
+152.652 147.441 c 152.652 142.433 l 152.652 141.394 151.895 140.715 
+150.383 140.402 c 148.926 140.039 147.309 139.855 145.535 139.855 c 
+143.609 139.855 141.914 140.183 140.453 140.832 c 138.996 141.484 
+138.004 142.851 137.484 144.937 c h
+136.152 156.586 m 129.121 156.586 l 127.66 156.586 126.512 156.246 
+125.68 155.57 c 124.844 154.89 124.426 153.637 124.426 151.816 c 
+124.426 150.617 124.676 149.781 125.172 149.316 c 125.664 148.848 
+126.59 148.609 127.945 148.609 c 129.145 148.609 130.539 148.894 
+132.129 149.469 c 133.719 150.039 135.062 150.668 136.156 151.344 c 
+136.156 156.586 l h
+136.152 156.586 m f
+187.52 152.488 m 187.52 150.043 187.035 148 186.074 146.367 c 185.105 
+144.726 183.82 143.414 182.203 142.426 c 180.586 141.437 178.746 
+140.726 176.691 140.281 c 174.633 139.844 172.484 139.621 170.242 
+139.621 c 169.305 139.621 168.289 139.66 167.195 139.734 c 166.102 
+139.812 164.992 139.93 163.875 140.082 c 162.754 140.238 161.684 
+140.418 160.668 140.629 c 159.652 140.832 158.754 141.066 157.969 
+141.328 c 156.668 141.793 155.832 142.269 155.469 142.762 c 155.105 
+143.25 155.051 144.015 155.312 145.047 c 156.172 148.769 l 156.328 
+149.496 156.562 149.941 156.879 150.094 c 157.191 150.254 157.789 
+150.254 158.676 150.094 c 160.5 149.781 162.477 149.535 164.613 149.351 
+c 166.754 149.168 168.5 149.078 169.855 149.078 c 171.832 149.078 
+173.238 149.301 174.074 149.746 c 174.91 150.191 175.324 150.933 
+175.324 151.98 c 175.324 153.129 175.012 153.898 174.391 154.293 c 
+173.762 154.683 172.617 154.984 170.949 155.191 c 168.812 155.508 
+166.816 155.875 164.965 156.289 c 163.117 156.707 161.488 157.336 
+160.082 158.172 c 158.676 159.008 157.57 160.133 156.758 161.543 c 
+155.949 162.953 155.551 164.808 155.551 167.105 c 155.551 169.195 
+155.949 171.023 156.754 172.59 c 157.551 174.156 158.652 175.465 
+160.051 176.508 c 161.449 177.555 163.121 178.336 165.066 178.859 c 
+167.004 179.383 169.125 179.64 171.418 179.64 c 172.305 179.64 173.281 
+179.601 174.352 179.523 c 175.418 179.445 176.5 179.34 177.594 179.211 
+c 178.688 179.078 179.746 178.906 180.762 178.699 c 181.777 178.484 
+182.703 178.226 183.535 177.91 c 184.578 177.543 185.348 177.16 185.84 
+176.765 c 186.336 176.371 186.453 175.676 186.191 174.676 c 185.332 
+170.656 l 185.125 169.926 184.906 169.48 184.668 169.324 c 184.434 
+169.168 183.875 169.14 182.988 169.246 c 182.102 169.351 181.141 
+169.465 180.098 169.598 c 179.055 169.726 178.027 169.832 177.012 
+169.91 c 175.996 169.988 175.039 170.055 174.156 170.105 c 173.27 
+170.156 172.516 170.183 171.891 170.183 c 169.91 170.234 168.668 
+170.012 168.176 169.519 c 167.68 169.027 167.434 168.363 167.434 
+167.531 c 167.434 166.543 167.891 165.91 168.809 165.625 c 169.723 
+165.336 170.887 165.066 172.301 164.805 c 174.34 164.547 176.273 
+164.219 178.105 163.832 c 179.938 163.441 181.547 162.805 182.934 
+161.922 c 184.316 161.035 185.43 159.855 186.266 158.371 c 187.102 
+156.89 187.52 154.93 187.52 152.488 c h
+187.52 152.488 m f
+250.336 140.832 m 250.152 140.492 249.723 140.324 249.047 140.324 c 
+240.449 140.324 l 239.77 140.324 239.312 140.469 239.078 140.754 c 
+238.844 141.039 238.727 141.445 238.727 141.965 c 238.727 162.527 l 
+238.727 164.922 238.363 166.512 237.633 167.293 c 236.902 168.078 
+235.809 168.465 234.352 168.465 c 233.414 168.465 232.266 168.219 
+230.91 167.723 c 229.555 167.23 228.383 166.719 227.391 166.199 c 
+227.391 141.965 l 227.391 141.551 227.301 141.172 227.117 140.832 c 
+226.938 140.492 226.48 140.324 225.75 140.324 c 217.152 140.324 l 
+216.523 140.324 216.098 140.469 215.863 140.754 c 215.629 141.039 
+215.512 141.445 215.512 141.965 c 215.512 162.762 l 215.512 164.949 
+215.16 166.445 214.449 167.254 c 213.738 168.062 212.676 168.469 
+211.262 168.469 c 210.312 168.469 209.172 168.234 207.836 167.765 c 
+206.496 167.293 205.277 166.773 204.176 166.199 c 204.176 141.969 l 
+204.176 141.551 204.07 141.176 203.863 140.832 c 203.656 140.496 
+203.191 140.328 202.465 140.328 c 193.926 140.328 l 193.301 140.328 
+192.875 140.469 192.641 140.758 c 192.406 141.039 192.297 141.449 
+192.297 141.969 c 192.297 177.144 l 192.297 177.664 192.406 178.082 
+192.641 178.394 c 192.875 178.707 193.301 178.867 193.926 178.867 c 
+202.465 178.867 l 203.191 178.867 203.656 178.68 203.863 178.316 c 
+204.07 177.953 204.176 177.562 204.176 177.144 c 204.176 175.348 l 
+204.332 175.269 l 206 176.621 207.824 177.68 209.801 178.433 c 211.781 
+179.187 213.789 179.566 215.824 179.566 c 218.168 179.566 220.223 
+179.14 221.996 178.277 c 223.766 177.418 225.074 176.074 225.906 174.25 
+c 227.73 175.762 229.801 177.027 232.117 178.043 c 234.438 179.058 
+236.77 179.566 239.113 179.566 c 241.879 179.566 244.027 179.109 
+245.562 178.199 c 247.102 177.285 248.25 176.101 249.004 174.644 c 
+249.758 173.183 250.215 171.543 250.371 169.719 c 250.527 167.894 
+250.605 166.07 250.605 164.246 c 250.605 141.965 l 250.609 141.547 
+250.52 141.172 250.336 140.832 c h
+250.336 140.832 m f
+Q Q
+showpage
+%%Trailer
+count op_count sub {pop} repeat
+countdictstack dict_count sub {end} repeat
+cairo_eps_state restore
+%%EOF

BIN
nasm/doc/nasmlogw.png


+ 116 - 0
nasm/doc/opt_var.txt

@@ -0,0 +1,116 @@
+                     NASM Optimizer Usage of
+              Certain Variables to Control Assembly
+
+                  prepared by:  John R Coffman
+                       date:  07-Mar-2005
+
+
+GLOBAL variables:
+        optimizing     optimization meta data (with level and flag info)
+        .level         -1 flags nasm 0.98 compatible operation;
+                            offsets usually are explicit (short/near)
+                            no optimization passes
+                        0 flags non-optimized assembly; forward
+                            references generate long offsets; always
+                            assembles
+                            no optimization passes
+                        2 or more specifies optmization passes.  5 is
+                            the actual recommended minimum setting
+                            optimization passes (2 or more, plus
+                            passes 1 and 2 will be required)
+        .flag           0 allow all optimizations
+                        1 disallow jump match optimization
+
+        pass0           0 flags an optimizer pass (multiple passes)
+                        1 flags pass1 (define labels)
+                        2 flags pass2 (spit out code)
+
+
+LOCAL variables:        local to 'assemble_file' (nasm.c)
+
+        pass_max        2 for non-optimized assembly
+                        4 or more for optimized assembly
+
+        pass            index of the FOR loop (1..pass_max)
+                        with optimized assembly, this variable is
+                            advanced to 'pass_max - 1' in the logic
+                            at the end of the loop to terminate
+                            an optimized assembly before all passes
+                            are used; i.e., when convergence has 
+                            occurred
+                
+
+        pass1           flag for making parts of the assembler do
+                            pass 1 behaviors on optimizer passes
+
+        pass2           flag for making parts of the assembler do
+                            pass 2 behaviors on optimizer passes
+
+        pass_cnt        benign counter for counting the actual
+                            number of passes taken.  Since 'pass'
+                            may be jerked upward early on optimized
+                            assembly, it does not accurately reflect
+                            the number of passes taken.
+                        always ends at 2 for non-optimized assembly
+
+
+
+        How the variables sequence:
+
+
+NON-OPTIMIZED assembly:
+
+                
+        pass0           1  2        all indicate, pass 1 and pass 2
+        pass1           1  2
+        pass2           1  2
+
+        pass            1  2
+   ----------------------------------------
+
+        pass_max        pre-set to 2
+        pass_cnt        ends at 2
+
+
+OPTIMIZED assembly:
+
+        optimizing      set to 2 or greater
+
+        pass0           0  0  0  0  0 ... 0  0  1  2
+        pass1           1  1  1  1  1 ... 1  1  1  2
+        pass2           1  2  2  2  2 ... 2  2  2  2
+
+        pass            1  2  3  4  5 ... 7  8  9  12
+
+        pass_max        pre-set to, say, 12
+        pass_cnt        ends at 10 for this assembly
+
+>From pass_cnt, the reported number of passes will be 1+8+1, meaning 
+8 optimization passes, plus pass 1, plus pass 2.
+
+Subroutines may check 'pass0' to see if an optimizer pass is in
+progress (pass0==0).  Many have arguments to tell what pass is in
+progress.  But these variables are passed in as 'pass1' or 'pass2'.
+
+>From the sequences above, 'pass' bears no relation to the desired
+pass 1 or pass 2 behavior of the assembler.  'pass1' is used to tell
+parts of the assembler, on multiple occasions, that pass 1 is in
+progress, and only once that pass 2 is being performed.  Other parts
+of the assembler need to be told only once that pass 1 is being
+performed, but may be told multiple times that pass 2 is being done.
+
+For instance, the preprocessor reset operation looks at pass1, and it
+thinks many pass 1 resets are being done, but only one pass 2 reset
+is done.  Also, certain errors are non-fatal on pass 1, but fatal on
+pass 2; hence, they are tied to the 'pass1' variable to determine the
+assembler pass number.
+
+Further, segment definitions look at the 'pass2' variable, since they
+do some initialization on pass 1, but are pretty much no-ops on pass
+2.  Hence, they should see pass 1 only once, but may see pass 2
+multiple times.
+
+
+ 
+[end]
+

+ 53 - 0
nasm/doc/psfonts.ph

@@ -0,0 +1,53 @@
+#!/usr/bin/perl
+#
+# Font metrics for the PS code generator
+#
+
+# Font substitution lists, in order of preference
+my @TText = ('SourceSansPro-Bold', 'ClearSans-Bold', 'LiberationSans-Bold',
+	     'Arial-Bold', 'Helvetica-Bold');
+my @TItal = ('SourceSansPro-BoldIt', 'ClearSans-BoldItalic', 'LiberationSans-BoldItalic',
+	     'Arial-BoldItalic', 'Helvetica-BoldItalic');
+my @TCode = ('SourceCodePro-Bold', 'LiberationMono-Bold', 'Courier-Bold');
+my @HText = ('SourceSansPro-Semibold', 'ClearSans-Bold', 'Arial-Bold', 'Helvetica-Bold');
+my @HItal = ('SourceSansPro-SemiboldIt', 'ClearSans-BoldItalic',
+	     'Arial-BoldItalic', 'Helvetica-BoldItalic');
+my @HCode = ('SourceCodePro-Semibold', 'LiberationMono-Bold', 'Courier-Bold');
+my @BText = ('SourceSansPro-Regular', 'ClearSans', 'LiberationSans', 'Arial', 'Helvetica');
+my @BItal = ('SourceSansPro-It', 'ClearSans-Italic', 'LiberationSans-Italic',
+	     'Arial-Italic', 'Helvetica-Italic');
+my @BCode = ('SourceCodePro-Regular', 'LiberationMono', 'Courier');
+my @QText = ('SourceSansPro-It', 'ClearSans-Italic', 'LiberationSans-Italic',
+	     'Arial-Italic', 'Helvetica-Italic');
+my @QBold = ('SourceSansPro-BoldIt', 'ClearSans-BoldItalic', 'LiberationSans-BoldItalic', 'Arial-Bold', 'Helvetica-BoldItalic');
+my @QCode = ('SourceCodePro-Regular', 'LiberationMono', 'Courier');
+
+# The fonts we want to use for various things
+# The order is: <normal> <emphatic> <code>
+
+%TitlFont = (name => 'tfont',
+	     leading => 24,
+	     fonts => [[20, \@TText], [20, \@TItal], [20, \@TCode]]);
+%ChapFont = (name => 'cfont',
+	     leading => 21.6,
+	     fonts => [[18, \@HText], [18, \@HItal], [18, \@HCode]]);
+%HeadFont = (name => 'hfont',
+		leading => 16.8,
+		fonts => [[14, \@HText], [14, \@HItal], [14, \@HCode]]);
+%SubhFont = (name => 'sfont',
+	     leading => 14.4,
+	     fonts => [[12, \@HText], [12, \@HItal], [12, \@HCode]]);
+%BodyFont = (name => 'bfont',
+	     leading => 12,
+	     fonts => [[10, \@BText], [10, \@BItal], [10, \@BCode]]);
+%BquoFont = (name => 'qfont',
+	     leading => 10.8,
+	     fonts => [[9, \@QText], [9, \@QBold], [9, \@QCode]]);
+#
+# List of all fontsets; used to compute the list of fonts needed
+#
+@AllFonts = ( \%TitlFont, \%ChapFont, \%HeadFont, \%SubhFont, \%BodyFont,
+    \%BquoFont);
+
+# OK
+1;

+ 118 - 0
nasm/doc/pspdf.pl

@@ -0,0 +1,118 @@
+#!/usr/bin/perl
+#
+# Wrapper around a variety of programs that can do PS -> PDF conversion
+#
+
+use strict;
+use File::Spec;
+
+my $compress = 1;
+
+my $win32_ok = eval {
+    require Win32::TieRegistry;
+    Win32::TieRegistry->import();
+    1;
+};
+
+while ($ARGV[0] =~ /^-(.*)$/) {
+    my $opt = $1;
+    shift @ARGV;
+
+    if ($opt eq '-nocompress') {
+        $compress = 0;
+    }
+}
+
+# Ghostscript executable name.  "gs" on Unix-based systems.
+my $gs = 'gs';
+
+my ($in, $out) = @ARGV;
+
+if (!defined($out)) {
+    die "Usage: $0 [-nocompress] infile ou{ tfile\n";
+}
+
+# If Win32, help GhostScript out with some defaults
+sub win32_gs_help() {
+    return if (!$win32_ok);
+
+    use Sort::Versions;
+    use sort 'stable';
+
+    my $Reg = $::Registry->Open('', {Access => 'KEY_READ', Delimiter => '/'});
+    my $dir;
+    my @gs;
+
+    foreach my $k1 ('HKEY_CURRENT_USER/Software/',
+                    'HKEY_LOCAL_MACHINE/SOFTWARE/') {
+        foreach my $k2 ('Artifex/', '') {
+            foreach my $k3 ('GPL Ghostscript/', 'AFPL Ghostscript/',
+                            'Ghostscript/') {
+                my $r = $Reg->{$k1.$k2.$k3};
+                if (ref($r) eq 'Win32::TieRegistry') {
+                    foreach my $k (keys(%$r)) {
+                        my $rk = $r->{$k};
+                        if (ref($rk) eq 'Win32::TieRegistry' &&
+                            defined($rk->{'/GS_LIB'})) {
+                            push @gs, $rk;
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    @gs = sort {
+        my($av) = $a->Path =~ m:^.*/([^/]+)/$:;
+        my($bv) = $b->Path =~ m:^.*/([^/]+)/$:;
+        versioncmp($av, $bv);
+    } @gs;
+
+    return unless (scalar(@gs));
+
+    $ENV{'PATH'} .= ';' . $gs[0]->{'/GS_LIB'};
+    $ENV{'GS_FONTPATH'} .= (defined($ENV{'GS_FONTPATH'}) ? ';' : '')
+        . $ENV{'windir'}.'\\fonts';
+
+    my $gsp = undef;
+    foreach my $p (split(/\;/, $gs[0]->{'/GS_LIB'})) {
+	foreach my $exe ('gswin64c.exe', 'gswin32c.exe', 'gs.exe') {
+	    last if (defined($gsp));
+	    my $e = File::Spec->catpath($p, $exe);
+	    $gsp = $e if (-f $e && -x _);
+	}
+    }
+
+    $gs = $gsp if (defined($gsp));
+}
+
+# Remove output file
+unlink($out);
+
+# 1. Acrobat distiller
+my $r = system('acrodist', '-n', '-q', '--nosecurity', '-o', $out, $in);
+exit 0 if ( !$r && -f $out );
+
+# 2. ps2pdf (from Ghostscript)
+#
+# GhostScript uses # rather than = to separate options and values on Windows,
+# it seems.  Call gs directly rather than ps2pdf, because -dSAFER
+# breaks font discovery on some systems, apparently.
+win32_gs_help();
+my $o = $win32_ok ? '#' : '=';
+my $r = system($gs, "-dCompatibilityLevel${o}1.4", "-q",
+	       "-P-", "-dNOPAUSE", "-dBATCH", "-sDEVICE${o}pdfwrite",
+	       "-sstdout${o}%stderr", "-sOutputFile${o}${out}",
+	       "-dOptimize${o}true", "-dEmbedAllFonts${o}true",
+               "-dCompressPages${o}" . ($compress ? 'true' : 'false'),
+               "-dUseFlateCompression${o}true",
+	       "-c", ".setpdfwrite", "-f", $in);
+exit 0 if ( !$r && -f $out );
+
+# 3. pstopdf (BSD/MacOS X utility)
+my $r = system('pstopdf', $in, '-o', $out);
+exit 0 if ( !$r && -f $out );
+
+# Otherwise, fail
+unlink($out);
+exit 1;

+ 25 - 0
nasm/doc/pswidth.ph

@@ -0,0 +1,25 @@
+#!/usr/bin/perl
+#
+# Get the width of a PostScript string in PostScript points (1/72")
+# given a set of font metrics and an encoding vector.
+#
+sub ps_width($$$) {
+    my($str, $met, $encoding) = @_;
+    my($w) = 0;
+    my($i,$c,$p);
+
+    $l = length($str);
+    undef $p;
+    for ( $i = 0 ; $i < $l ; $i++ ) {
+	$c = substr($str,$i,1);
+	$w += $$met{widths}{$encoding->[ord($c)]};
+	# The standard PostScript "show" operator doesn't do kerning.
+	# $w += $$met{kern}{$p.$c};
+	$p = $c;
+    }
+    
+    return $w / $met->{scale};
+}
+
+# OK
+1;

Файловите разлики са ограничени, защото са твърде много
+ 1111 - 0
nasm/doc/rdsrc.pl


+ 0 - 0
nasm/doc/ttfmetrics.ph


Някои файлове не бяха показани, защото твърде много файлове са промени