mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-01-18 16:25:05 +08:00
Make the new PS/PDF backend somewhat configurable
This commit is contained in:
parent
692f6631a2
commit
1aef73430e
@ -43,7 +43,7 @@ nasmdoc.texi: nasmdoc.dip
|
|||||||
new: nasmdocx.ps nasmdocx.pdf
|
new: nasmdocx.ps nasmdocx.pdf
|
||||||
|
|
||||||
nasmdocx.ps: nasmdoc.dip nasmlogo.eps genps.pl psfonts.ph pswidth.ph head.ps
|
nasmdocx.ps: nasmdoc.dip nasmlogo.eps genps.pl psfonts.ph pswidth.ph head.ps
|
||||||
$(PERL) $(srcdir)/genps.pl > nasmdocx.ps
|
$(PERL) $(srcdir)/genps.pl nasmdoc.dip > nasmdocx.ps
|
||||||
|
|
||||||
nasmdocx.pdf: nasmdocx.ps
|
nasmdocx.pdf: nasmdocx.ps
|
||||||
$(PS2PDF) nasmdocx.ps nasmdocx.pdf
|
$(PS2PDF) nasmdocx.ps nasmdocx.pdf
|
||||||
|
58
doc/genps.pl
58
doc/genps.pl
@ -6,6 +6,8 @@
|
|||||||
require 'psfonts.ph'; # The fonts we want to use
|
require 'psfonts.ph'; # The fonts we want to use
|
||||||
require 'pswidth.ph'; # PostScript string width
|
require 'pswidth.ph'; # PostScript string width
|
||||||
|
|
||||||
|
use Fcntl;
|
||||||
|
|
||||||
#
|
#
|
||||||
# PostScript configurables; these values are also available to the
|
# PostScript configurables; these values are also available to the
|
||||||
# PostScript code itself
|
# PostScript code itself
|
||||||
@ -30,11 +32,47 @@ require 'pswidth.ph'; # PostScript string width
|
|||||||
idxcolumns => 2, # Number of index columns
|
idxcolumns => 2, # Number of index columns
|
||||||
);
|
);
|
||||||
|
|
||||||
# US-Letter paper
|
%psbool = (
|
||||||
# $psconf{pagewidth} = 612; $psconf{pageheight} = 792;
|
colorlinks => 0, # Set links in blue rather than black
|
||||||
# A4 paper
|
);
|
||||||
# $psconf{pagewidth} = 595; $psconf{pageheight} = 842;
|
|
||||||
|
|
||||||
|
# Known paper sizes
|
||||||
|
%papersizes = (
|
||||||
|
'a4' => [595, 842], # ISO standard paper size
|
||||||
|
'letter' => [612, 792], # US common paper size
|
||||||
|
'pa4' => [595, 792], # Compromise ("portable a4")
|
||||||
|
'b4' => [709,1002], # ISO intermediate paper size
|
||||||
|
'legal' => [612,1008], # US intermediate paper size
|
||||||
|
'a3' => [842,1190], # ISO double paper size
|
||||||
|
'11x17' => [792,1224], # US double paper size
|
||||||
|
);
|
||||||
|
|
||||||
|
#
|
||||||
|
# Parse the command line
|
||||||
|
#
|
||||||
|
undef $input;
|
||||||
|
while ( $arg = shift(@ARGV) ) {
|
||||||
|
if ( $arg =~ /^\-(|no\-)/ ) {
|
||||||
|
$parm = $';
|
||||||
|
$true = ($1 eq '') ? 1 : 0;
|
||||||
|
if ( $true && defined($papersizes{$parm}) ) {
|
||||||
|
$psconf{pagewidth} = $papersizes{$parm}->[0];
|
||||||
|
$psconf{pageheight} = $papersizes{$parm}->[1];
|
||||||
|
} elsif ( defined($psbool{$parm}) ) {
|
||||||
|
$psbool{$parm} = $true;
|
||||||
|
} elsif ( $true && defined($psconf{$parm}) ) {
|
||||||
|
$psconf{$parm} = shift(@ARGV);
|
||||||
|
} else {
|
||||||
|
die "$0: Unknown option: $arg\n";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$input = $arg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Document formatting parameters
|
||||||
|
#
|
||||||
$paraskip = 6; # Space between paragraphs
|
$paraskip = 6; # Space between paragraphs
|
||||||
$chapstart = 30; # Space before a chapter heading
|
$chapstart = 30; # Space before a chapter heading
|
||||||
$chapskip = 24; # Space after a chapter heading
|
$chapskip = 24; # Space after a chapter heading
|
||||||
@ -51,7 +89,12 @@ $tocskip = 6; # Space between TOC entries
|
|||||||
# First, format the stuff coming from the front end into
|
# First, format the stuff coming from the front end into
|
||||||
# a cleaner representation
|
# a cleaner representation
|
||||||
#
|
#
|
||||||
open(PARAS, '< nasmdoc.dip');
|
if ( defined($input) ) {
|
||||||
|
sysopen(PARAS, $input, O_RDONLY) or
|
||||||
|
die "$0: cannot open $input: $!\n";
|
||||||
|
} else {
|
||||||
|
open(PARAS, "<&STDIN") or die "$0: $!\n";
|
||||||
|
}
|
||||||
while ( defined($line = <PARAS>) ) {
|
while ( defined($line = <PARAS>) ) {
|
||||||
chomp $line;
|
chomp $line;
|
||||||
$data = <PARAS>;
|
$data = <PARAS>;
|
||||||
@ -736,9 +779,12 @@ print "%%EndComments\n";
|
|||||||
print "%%BeginProlog\n";
|
print "%%BeginProlog\n";
|
||||||
|
|
||||||
# Emit the configurables as PostScript tokens
|
# Emit the configurables as PostScript tokens
|
||||||
for $c ( keys(%psconf) ) {
|
foreach $c ( keys(%psconf) ) {
|
||||||
print "/$c ", $psconf{$c}, " def\n";
|
print "/$c ", $psconf{$c}, " def\n";
|
||||||
}
|
}
|
||||||
|
foreach $c ( keys(%psbool) ) {
|
||||||
|
print "/$c ", ($psbool{$c}?'true':'false'), " def\n";
|
||||||
|
}
|
||||||
|
|
||||||
# Emit fontset definitions
|
# Emit fontset definitions
|
||||||
foreach $fset ( @AllFonts ) {
|
foreach $fset ( @AllFonts ) {
|
||||||
|
15
doc/head.ps
15
doc/head.ps
@ -41,6 +41,7 @@
|
|||||||
/lkbegun 1 def
|
/lkbegun 1 def
|
||||||
/lktype exch def
|
/lktype exch def
|
||||||
/lktarget exch def
|
/lktarget exch def
|
||||||
|
colorlinks { 0 0 0.4 setrgbcolor } if
|
||||||
end
|
end
|
||||||
} def
|
} def
|
||||||
|
|
||||||
@ -85,17 +86,10 @@
|
|||||||
% --
|
% --
|
||||||
/linkend {
|
/linkend {
|
||||||
userdict begin
|
userdict begin
|
||||||
[ lktype /Dest eq {
|
[ lktype /URI eq {
|
||||||
/Dest lktarget
|
/Action 2 dict dup /Subtype /URI put dup /URI lktarget put
|
||||||
} {
|
} {
|
||||||
lktype /URI eq {
|
/Dest lktarget
|
||||||
/Action
|
|
||||||
% << .. >> would be languagelevel 2 :(
|
|
||||||
2 dict dup /Subtype /URI put dup /URI lktarget put
|
|
||||||
} {
|
|
||||||
/Dest lktarget
|
|
||||||
% /Page lktarget /View [ /XYZ 0 pageheight null ]
|
|
||||||
} ifelse
|
|
||||||
} ifelse
|
} ifelse
|
||||||
/Border [0 0 0]
|
/Border [0 0 0]
|
||||||
/Rect [ lkllx lkxmarg sub
|
/Rect [ lkllx lkxmarg sub
|
||||||
@ -105,6 +99,7 @@
|
|||||||
/Subtype /Link
|
/Subtype /Link
|
||||||
/ANN pdfmark
|
/ANN pdfmark
|
||||||
/lkbegun 0 def
|
/lkbegun 0 def
|
||||||
|
colorlinks { 0 setgray } if
|
||||||
end
|
end
|
||||||
} def
|
} def
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user