Add Mach-O documentation.
SRCS = nasmdoc.src
OUT = nasm.info nasmdoc.ps nasmdoc.pdf
+# exports
+export srcdir
+export PERL
+
all: $(OUT)
os2: nasm.inf
nasmdoc.texi: nasmdoc.dip
: Generated by side effect
-nasmdoc.ps: nasmdoc.dip nasmlogo.eps ../version genpsdriver.pl \
+nasmdoc.ps: nasmdoc.dip nasmlogo.eps $(srcdir)/../version genpsdriver.pl \
genps.pl psfonts.ph pswidth.ph head.ps
$(PERL) $(srcdir)/genpsdriver.pl > nasmdoc.ps
nasmdoc.pdf: nasmdoc.ps
- $(PS2PDF) nasmdoc.ps nasmdoc.pdf
+ $(PS2PDF) nasmdoc.ps
nasm.info: info/nasm.info
# Format the documentation as PostScript
#
+use Env;
+use lib $srcdir;
+
require 'psfonts.ph'; # The fonts we want to use
require 'pswidth.ph'; # PostScript string width
#
# Document formatting parameters
-#
+#
$paraskip = 6; # Space between paragraphs
$chapstart = 30; # Space before a chapter heading
$chapskip = 24; # Space after a chapter heading
$i = int($i/$b);
}
return $n.$s;
-}
+}
#
# Convert a string to a rendering array
{
my($s) = @_;
my(@a) = ();
-
+
$s =~ s/ \- / $charcode{'endash'} /g; # Replace " - " with en dash
while ( $s =~ /^(\s+|\S+)(.*)$/ ) {
foreach $e ( @data ) {
if ( $$e[0] < 0 ) {
# Type is metadata. Zero width.
- if ( $$e[0] == -6 ) {
+ if ( $$e[0] == -6 ) {
$pastmarker = 1;
}
if ( $$e[0] == -1 || $$e[0] == -6 ) {
my $esw = ps_width($sp, $fontset->{fonts}->[$$e[0]][1],
\@NASMEncoding) *
($fontset->{fonts}->[$$e[0]][0]/1000);
-
+
if ( ($w+$ew) - $ps_space_squeeze*($sw+$esw) > $wid ) {
# Begin new line
# Search backwards for previous space chunk
my(@ci) = @_;
my($c, $lc);
my(@co, $eco);
-
+
undef $lc;
@co = ();
$eco = -1; # Index of the last entry in @co
foreach $chunk ( @chunks ) {
my $type = substr($chunk,0,2);
my $text = substr($chunk,2);
-
+
if ( $type eq 'sp' ) {
push(@para, [$in_e?1:0, ' ']);
} elsif ( $type eq 'da' ) {
my $refwidth = ps_width($refname, $BodyFont{fonts}->[0][1],
\@NASMEncoding) *
($BodyFont{fonts}->[0][0]/1000);
-
+
@ls = ps_flow_lines($linewidth-$ntoc*$psconf{tocind}-
$psconf{tocpnz}-$refwidth,
\%BodyFont, $ptype, @data);
-
+
# Auxilliary data: for the first line, the cross reference symbol
# and the reference name; for all lines but the first, the
# reference width; and for the last line, the page number
#
sub ps_break_pages($$) {
my($startline, $endline) = @_;
-
+
# Paragraph types which should never be broken
my $nobreakregexp = "^(chap|appn|head|subh|toc.|idx.)\$";
# Paragraph types which are heading (meaning they should not be broken
$columnstart = $curypos;
$curcolumn = 0;
}
-
+
# Adjust position by the appropriate leading
$curypos += $$linfo[3]->{leading};
-
+
# Record the page and y-position
$$linfo[4] = $curpage;
- $$linfo[5] = $curypos;
+ $$linfo[5] = $curypos;
$$linfo[6] = $curcolumn if ( defined($columnstart) );
-
+
if ( $curypos > $upageheight ) {
# We need to break the page before this line.
my $broken = 0; # No place found yet
while ( !$broken && $pslines[$i]->[0]->[4] == $curpage ) {
my $linfo = $pslines[$i]->[0];
my $pinfo = $pslines[$i-1]->[0];
-
+
if ( $$linfo[1] == 2 ) {
# This would be an orphan, don't break.
} elsif ( $$linfo[1] & 1 ) {
ps_start_page();
foreach $line ( @pslines ) {
my $linfo = $line->[0];
-
+
if ( $$linfo[4] != $curpage ) {
ps_end_page($curpage > 2);
ps_start_page();
use File::Spec;
use Fcntl;
+use Env;
-$perl = $ENV{'PERL'} || 'perl';
-$srcdir = $ENV{'srcdir'} || File::Spec->curdir();
+$perl = $ENV{PERL} || 'perl';
+$srcdir = $ENV{srcdir} || File::Spec->curdir();
-$versionfile = File::Spec->catfile(File::Spec->updir($srcdir), 'version');
+$versionfile = File::Spec->catfile($srcdir, File::Spec->updir(), 'version');
$genps = File::Spec->catfile($srcdir, 'genps.pl');
sysopen(VERSION, $versionfile, O_RDONLY)
The Netwide Assembler, NASM, is an 80x86 assembler designed for
portability and modularity. It supports a range of object file
formats, including Linux and \c{NetBSD/FreeBSD} \c{a.out}, \c{ELF},
-\c{COFF}, Microsoft 16-bit \c{OBJ} and \c{Win32}. It will also output
+\c{COFF}, \c{Mach-O}, Microsoft 16-bit \c{OBJ} and \c{Win32}. It will also output
plain binary files. Its syntax is designed to be simple and easy to
understand, similar to Intel's but less complex. It supports \c{Pentium},
\c{P6}, \c{MMX}, \c{3DNow!}, \c{SSE} and \c{SSE2} opcodes, and has
will remove the \c{.asm} \i{extension} (or whatever extension you
like to use - NASM doesn't care) from your source file name and
substitute \c{.obj}. For Unix object file formats (\i\c{aout},
-\i\c{coff}, \i\c{elf} and \i\c{as86}) it will substitute \c{.o}. For
+\i\c{coff}, \i\c{elf}, \i\c{macho} and \i\c{as86}) it will substitute \c{.o}. For
\i\c{rdf}, it will use \c{.rdf}, and for the \i\c{bin} format it
will simply remove the extension, so that \c{myfile.asm} produces
the output file \c{myfile}.
operating in 32-bit mode. The syntax is \c{BITS 16} or \c{BITS 32}.
In most cases, you should not need to use \c{BITS} explicitly. The
-\c{aout}, \c{coff}, \c{elf} and \c{win32} object formats, which are
+\c{aout}, \c{coff}, \c{elf}, \c{macho} and \c{win32} object formats, which are
designed for use in 32-bit operating systems, all cause NASM to
select 32-bit mode by default. The \c{obj} object format allows you
to specify each segment you define as either \c{USE16} or \c{USE32},
directive as \c{win32} does, except that the \c{align} qualifier and
the \c{info} section type are not supported.
+\H{machofmt} \i\c{macho}: \i{Mach Object File Format}
+
+The \c{macho} output type produces \c{Mach-O} object files suitable for
+linking with the \i{Mac OSX} linker.
+
+\c{macho} provides a default output file-name extension of \c{.o}.
\H{elffmt} \i\c{elf}: \I{ELF}\I{linux, elf}\i{Executable and Linkable
Format} Object Files