aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2006-02-04 00:23:30 +0000
committerEric Christopher <echristo@apple.com>2006-02-04 00:23:30 +0000
commit1e0de6e913af8c1e9d65121c880960752fd4f190 (patch)
treee177ca8e19614b076647b76bfae5c5cd9010a555 /doc
parenta5f0000db010e84d4508a8aa480e4360b6609718 (diff)
downloadnasm-daily-1e0de6e913af8c1e9d65121c880960752fd4f190.tar.gz
nasm-daily-1e0de6e913af8c1e9d65121c880960752fd4f190.tar.xz
nasm-daily-1e0de6e913af8c1e9d65121c880960752fd4f190.zip
Fix documentation building for non-srcdir builds. Still bugs in .ps implementation.
Add Mach-O documentation.
Diffstat (limited to 'doc')
-rw-r--r--doc/Makefile.in8
-rwxr-xr-xdoc/genps.pl35
-rw-r--r--doc/genpsdriver.pl7
-rw-r--r--doc/nasmdoc.src12
4 files changed, 38 insertions, 24 deletions
diff --git a/doc/Makefile.in b/doc/Makefile.in
index a3279e45..ee7ca5e1 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -24,6 +24,10 @@ PS2PDF = ps2pdf -dOptimize=true # Part of GhostScript
SRCS = nasmdoc.src
OUT = nasm.info nasmdoc.ps nasmdoc.pdf
+# exports
+export srcdir
+export PERL
+
all: $(OUT)
os2: nasm.inf
@@ -37,12 +41,12 @@ nasmdoc.dip: nasmdoc.src rdsrc.pl
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
diff --git a/doc/genps.pl b/doc/genps.pl
index 02828c96..c80a1b2c 100755
--- a/doc/genps.pl
+++ b/doc/genps.pl
@@ -3,6 +3,9 @@
# 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
@@ -78,7 +81,7 @@ while ( $arg = shift(@ARGV) ) {
#
# Document formatting parameters
-#
+#
$paraskip = 6; # Space between paragraphs
$chapstart = 30; # Space before a chapter heading
$chapskip = 24; # Space after a chapter heading
@@ -204,7 +207,7 @@ sub int2base($$) {
$i = int($i/$b);
}
return $n.$s;
-}
+}
#
# Convert a string to a rendering array
@@ -213,7 +216,7 @@ sub string2array($)
{
my($s) = @_;
my(@a) = ();
-
+
$s =~ s/ \- / $charcode{'endash'} /g; # Replace " - " with en dash
while ( $s =~ /^(\s+|\S+)(.*)$/ ) {
@@ -280,7 +283,7 @@ sub ps_flow_lines($$$@) {
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 ) {
@@ -299,7 +302,7 @@ sub ps_flow_lines($$$@) {
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
@@ -398,7 +401,7 @@ sub ps_merge_chunks(@) {
my(@ci) = @_;
my($c, $lc);
my(@co, $eco);
-
+
undef $lc;
@co = ();
$eco = -1; # Index of the last entry in @co
@@ -444,7 +447,7 @@ sub mkparaarray($@) {
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' ) {
@@ -668,11 +671,11 @@ sub ps_break_lines($$) {
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
@@ -723,7 +726,7 @@ $nlines = scalar(@pslines);
#
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
@@ -756,22 +759,22 @@ sub ps_break_pages($$) {
$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 ) {
@@ -1128,7 +1131,7 @@ $curpage = 2;
ps_start_page();
foreach $line ( @pslines ) {
my $linfo = $line->[0];
-
+
if ( $$linfo[4] != $curpage ) {
ps_end_page($curpage > 2);
ps_start_page();
diff --git a/doc/genpsdriver.pl b/doc/genpsdriver.pl
index 0136e3e1..dd9b7a7f 100644
--- a/doc/genpsdriver.pl
+++ b/doc/genpsdriver.pl
@@ -11,11 +11,12 @@
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)
diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src
index d6a14a3b..6adbceac 100644
--- a/doc/nasmdoc.src
+++ b/doc/nasmdoc.src
@@ -224,7 +224,7 @@ Object File Format
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
@@ -453,7 +453,7 @@ For Microsoft object file formats (\i\c{obj} and \i\c{win32}), it
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}.
@@ -3378,7 +3378,7 @@ operating in 16-bit mode, or code designed to run on a processor
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},
@@ -4232,6 +4232,12 @@ The \c{coff} format supports the same extensions to the \c{SECTION}
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