CVS log for mandoc/term_ps.c

[BACK] Up to [cvsweb.bsd.lv] / mandoc

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.92 / (download) - annotate - [select for diffs], Sun Sep 6 14:45:22 2020 UTC (3 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_6, HEAD
Changes since 1.91: +6 -3 lines
Diff to previous 1.91 (colored) to selected 1.83 (colored)

After .ti, there are many reasons why the offset may change, so setting
it back later requires a guard against underflow, or subsequent assertions
may fail.
Issue found in an afl run performed by Jan Schreiber <jes at posteo dot de>.

Revision 1.91 / (download) - annotate - [select for diffs], Fri Nov 10 23:42:52 2017 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_5, VERSION_1_14_4
Changes since 1.90: +6 -15 lines
Diff to previous 1.90 (colored) to selected 1.83 (colored)

streamline termp allocation: this will allow the init function
to do things differently in the ps vs pdf case;
from espie@

Revision 1.90 / (download) - annotate - [select for diffs], Thu Nov 2 14:53:02 2017 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.89: +37 -15 lines
Diff to previous 1.89 (colored) to selected 1.83 (colored)

Shrink -Tps output by more than 50%
by using PostScript as a programming language.
* Define and use one PostScript procedure to select each font.
* Define and use procedures combining "use" and "show".
* In one of these, reuse the current row if it did not change.
Most ideas and most coding by espie@, tweaked by me.

Revision 1.89 / (download) - annotate - [select for diffs], Sun Oct 29 19:25:31 2017 UTC (6 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.88: +28 -11 lines
Diff to previous 1.88 (colored) to selected 1.83 (colored)

Print a human-readable media name in the %%DocumentMedia DSC comment
and use the setpagedevice PostScript operator to help printers
automatically select the paper of the best matching PageSize.

Many thanks to Mike Williams <obsd1 at eandem dot co dot uk>
for teaching me about the relevant features of PostScript and DSC
and for suggesting what to put into the first %%DocumentMedia argument.

Revision 1.88 / (download) - annotate - [select for diffs], Thu Oct 26 18:11:31 2017 UTC (6 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.87: +3 -3 lines
Diff to previous 1.87 (colored) to selected 1.83 (colored)

more readable conversion of paper size from millimeters to PostScript
basic units, also slightly more precise

Revision 1.87 / (download) - annotate - [select for diffs], Wed Oct 25 20:48:48 2017 UTC (6 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.86: +1 -3 lines
Diff to previous 1.86 (colored) to selected 1.83 (colored)

The page footer line (psmarg) is created in ps_begin(), and the
last call writing to it is always ps_endline(), which ends with
ps_pclose(), which prints "ET" (end text).

Consequently, do not print another instance of "ET" in ps_closepage()
after the footer line and before the "endstream" for the page.

Fixing a PDF syntax error found while investigating the bug report
from Jan Stary that also resulted in the previous commit.

Revision 1.86 / (download) - annotate - [select for diffs], Wed Oct 25 18:52:06 2017 UTC (6 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.85: +4 -4 lines
Diff to previous 1.85 (colored) to selected 1.83 (colored)

Properly close out the top-level Font object, the end-of-page
Resource objects, and the Catalog object, fixing three PDF syntax
errors that were present in every PDF file generated with mandoc
since the initial checkin of the formatter in July 2010.
Bug reported by Jan Stary <hans at stare dot cz> on misc@.

Revision 1.85 / (download) - annotate - [select for diffs], Wed Jun 7 17:38:26 2017 UTC (6 years, 9 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_3, VERSION_1_14_2
Changes since 1.84: +8 -5 lines
Diff to previous 1.84 (colored) to selected 1.83 (colored)

Prepare the terminal driver for filling multiple columns in parallel,
first step: split column data out of the terminal state struct into
a new column state struct and use an array of such column state
structs.  No functional change.

Revision 1.84 / (download) - annotate - [select for diffs], Mon May 8 15:34:54 2017 UTC (6 years, 10 months ago) by schwarze
Branch: MAIN
Changes since 1.83: +5 -2 lines
Diff to previous 1.83 (colored)

Basic implementation of the roff(7) .ti (temporary indent) request.
Needed by about four dozen ports (thanks to naddy@ for the research).

Revision 1.83 / (download) - annotate - [selected], Fri Feb 17 14:31:52 2017 UTC (7 years, 1 month ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_14_1, VERSION_1_13
Changes since 1.82: +2 -2 lines
Diff to previous 1.82 (colored)

Be consistent in protecting __attribute__ attributes with __;
from Christos Zoulas <christos @ NetBSD>.

Revision 1.82 / (download) - annotate - [select for diffs], Wed Aug 10 11:03:43 2016 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.81: +46 -58 lines
Diff to previous 1.81 (colored) to selected 1.83 (colored)

Fix assertion failures caused by whitespace inside \o'' (overstrike)
sequences that jsg@ found with afl(1):
* Avoid writing \t\b in term.c.
* Handle trailing \b in term_ps.c.

Revision 1.81 / (download) - annotate - [select for diffs], Tue Jul 19 13:36:13 2016 UTC (7 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.80: +3 -5 lines
Diff to previous 1.80 (colored) to selected 1.83 (colored)

Use __attribute__((__format__ throughout.
Triggered by a smaller patch from Christos Zoulas.

While here, unify style, move several config tests to config.h,
and delete the useless MANDOC_CONFIG_H.

Revision 1.80 / (download) - annotate - [select for diffs], Wed Dec 23 20:50:13 2015 UTC (8 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_4
Changes since 1.79: +3 -5 lines
Diff to previous 1.79 (colored) to selected 1.83 (colored)

remove NULL-checks before free(); from mmcc@

Revision 1.79 / (download) - annotate - [select for diffs], Sat Nov 7 14:22:29 2015 UTC (8 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.78: +3 -1 lines
Diff to previous 1.78 (colored) to selected 1.83 (colored)

Without HAVE_ERR, don't try to include <err.h>, it probably isn't there.
In that case, the required prototypes are in "config.h".
Patch from Peter Bray <pdb_ml at yahoo dot com dot au>.

Revision 1.78 / (download) - annotate - [select for diffs], Tue Oct 13 22:59:54 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.77: +7 -9 lines
Diff to previous 1.77 (colored) to selected 1.83 (colored)

Major character table cleanup:
* Use ohash(3) rather than a hand-rolled hash table.
* Make the character table static in the chars.c module:
There is no need to pass a pointer around, we most certainly
never want to use two different character tables concurrently.
* No need to keep the characters in a separate file chars.in;
that merely encourages downstream porters to mess with them.
* Sort the characters to agree with the mandoc_chars(7) manual page.
* Specify Unicode codepoints in hex, not decimal (that's the detail
that originally triggered this patch).
No functional change, minus 100 LOC, and i don't see a performance change.

Revision 1.77 / (download) - annotate - [select for diffs], Mon Oct 12 00:08:16 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.76: +1 -3 lines
Diff to previous 1.76 (colored) to selected 1.83 (colored)

To make the code more readable, delete 283 /* FALLTHROUGH */ comments
that were right between two adjacent case statement.  Keep only
those 24 where the first case actually executes some code before
falling through to the next case.

Revision 1.76 / (download) - annotate - [select for diffs], Sun Oct 11 21:12:55 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.75: +3 -2 lines
Diff to previous 1.75 (colored) to selected 1.83 (colored)

Finally use __progname, err(3) and warn(3).
That's more readable and less error-prone than fumbling around
with argv[0], fprintf(3), strerror(3), perror(3), and exit(3).

It's a bad idea to boycott good interfaces merely because standards
committees ignore them.  Instead, let's provide compatibility modules
for archaic systems (like commercial Solaris) that still don't have
them.  The compat module has an UCB Copyright (c) 1993...

Revision 1.75 / (download) - annotate - [select for diffs], Tue Oct 6 18:32:20 2015 UTC (8 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.74: +6 -6 lines
Diff to previous 1.74 (colored) to selected 1.83 (colored)

modernize style: "return" is not a function

Revision 1.74 / (download) - annotate - [select for diffs], Sat Apr 4 17:47:18 2015 UTC (8 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.73: +8 -8 lines
Diff to previous 1.73 (colored) to selected 1.83 (colored)

Rounding rules for horizontal scaling widths are more complicated.
There is a first rounding to basic units on the input side.
After that, rounding rules differ between requests and macros.
Requests round to the nearest possible character position.
Macros round to the next character position to the left.

Implement that by changing the return value of term_hspan()
to basic units and leaving the second scaling and rounding stage
to the formatters instead of doing it in the terminal handler.

Improves for example argtable2(3).

Revision 1.73 / (download) - annotate - [select for diffs], Fri Mar 27 21:33:20 2015 UTC (9 years ago) by schwarze
Branch: MAIN
Changes since 1.72: +10 -23 lines
Diff to previous 1.72 (colored) to selected 1.83 (colored)

Actually use the new man.conf(5) "output" directive.
Additional functionality, yet minus 45 lines of code.

Revision 1.72 / (download) - annotate - [select for diffs], Wed Jan 21 19:40:54 2015 UTC (9 years, 2 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_3
Changes since 1.71: +34 -4 lines
Diff to previous 1.71 (colored) to selected 1.83 (colored)

Improve overstriking.  When overstriking a wider character with a
narrower one, center the latter horizontally.  After a group of
characters printed in the same position, advance by the width of
the widest one among them.

Revision 1.71 / (download) - annotate - [select for diffs], Fri Dec 19 17:12:04 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
Changes since 1.70: +4 -1 lines
Diff to previous 1.70 (colored) to selected 1.83 (colored)

Enforcing an arbitrary, implementation dependent, undocumented limit
by calling assert() when valid user input exceeds it is a bad idea.
Allocate the terminal font stack dynamically instead of crashing
above 10 entries.  Issue found by jsg@ with afl.

Revision 1.70 / (download) - annotate - [select for diffs], Mon Dec 1 08:05:52 2014 UTC (9 years, 3 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_2
Changes since 1.69: +2 -3 lines
Diff to previous 1.69 (colored) to selected 1.83 (colored)

header cleanup:
* add missing forward declarations
* remove needless header inclusions
* some style unification

Revision 1.69 / (download) - annotate - [select for diffs], Thu Nov 20 13:56:20 2014 UTC (9 years, 4 months ago) by schwarze
Branch: MAIN
Changes since 1.68: +6 -4 lines
Diff to previous 1.68 (colored) to selected 1.83 (colored)

Prevent negative arguments to the .ll request from causing integer
underflow.  Found while preparing an audit of termp.rmargin.

Overflow can also happen, but i see no sane way to deal with it,
so just let it happen.  It doesn't happen for any sane input anyway,
groff behaviour is undefined, and the resulting values are legal,
even though they are useless.

Revision 1.68 / (download) - annotate - [select for diffs], Tue Oct 28 17:36:19 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.67: +8 -7 lines
Diff to previous 1.67 (colored) to selected 1.83 (colored)

Make the character table available to libroff so it can check the
validity of character escape names and warn about unknown ones.
This requires mchars_spec2cp() to report unknown names again.
Fortunately, that doesn't require changing the calling code because
according to groff, invalid character escapes should not produce
output anyway, and now that we warn about them, that's fine.

Revision 1.67 / (download) - annotate - [select for diffs], Mon Oct 27 20:41:58 2014 UTC (9 years, 5 months ago) by schwarze
Branch: MAIN
Changes since 1.66: +62 -16 lines
Diff to previous 1.66 (colored) to selected 1.83 (colored)

Support overstriking by backspace in PostScript and PDF output.
Of course, this is only a minor improvement; it would be much better
to support non-ASCII characters in these output modes, but that
would require major changes that i'm not going to work on right now.

The main reason for doing this is that it allows to get ASCII output
closer to groff.

Revision 1.66 / (download) - annotate - [select for diffs], Thu Aug 28 01:37:12 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.65: +1 -6 lines
Diff to previous 1.65 (colored) to selected 1.83 (colored)

I just noticed that -Tps writes "%%CreationDate:" headers.
That's an unwelcome leak of potentially private information.
Kill it with fire.

Revision 1.65 / (download) - annotate - [select for diffs], Sun Aug 24 23:43:13 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.64: +140 -36 lines
Diff to previous 1.64 (colored) to selected 1.83 (colored)

When support for bold italic font was added to the parsers and to the
generic parts of the formatters some time ago, the PostScript- and
PDF-specific part of the formatters was neglected.

Now pascal@ reports that mandoc -Tps throws an assertion on perl(1),
apparently because that manual actually uses bold italic font.

So here is an overdue implementation of bold italic font support for
PostScript and PDF output.

Revision 1.64 / (download) - annotate - [select for diffs], Wed Aug 13 20:34:29 2014 UTC (9 years, 7 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_12_4, VERSION_1_12
Changes since 1.63: +25 -15 lines
Diff to previous 1.63 (colored) to selected 1.83 (colored)

Begin cleaning up scaling units.
Start with the horizontal terminal specifiers, making sure that they match
up with troff.
Then move on to PS, PDF, and HTML, noting that we stick to the terminal
default width for "u".
Lastly, fix some completely-wrong documentation and note that we diverge
from troff w/r/t "u".

Revision 1.63 / (download) - annotate - [select for diffs], Sun Aug 10 23:54:41 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.62: +1 -3 lines
Diff to previous 1.62 (colored) to selected 1.83 (colored)

Get rid of HAVE_CONFIG_H, it is always defined; idea from libnbcompat.
Include <sys/types.h> where needed, it does not belong in config.h.
Remove <stdio.h> from config.h; if it is missing somewhere, it should
be added, but i cannot find a *.c file where it is missing.

Revision 1.62 / (download) - annotate - [select for diffs], Fri Aug 1 19:25:52 2014 UTC (9 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_13_1
Changes since 1.61: +4 -4 lines
Diff to previous 1.61 (colored) to selected 1.83 (colored)

Clarity with respect to floating point handling:
Write double constants as double rather than integer literals.
Remove useless explicit (double) cast done at one place and nowhere else.
No functional change.

Revision 1.61 / (download) - annotate - [select for diffs], Sun Jul 27 21:53:17 2014 UTC (9 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.60: +6 -8 lines
Diff to previous 1.60 (colored) to selected 1.83 (colored)

code readability; no functional change

Revision 1.60 / (download) - annotate - [select for diffs], Wed Apr 23 21:06:41 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.59: +4 -10 lines
Diff to previous 1.59 (colored) to selected 1.83 (colored)

Audit malloc(3)/calloc(3)/realloc(3) usage.
* Change eight reallocs to reallocarray to be safe from overflows.
* Change one malloc to reallocarray to be safe from overflows.
* Change one calloc to reallocarray, no zeroing needed.
* Change the order of arguments of three callocs (aesthetical).

Revision 1.59 / (download) - annotate - [select for diffs], Sun Apr 20 16:46:05 2014 UTC (9 years, 11 months ago) by schwarze
Branch: MAIN
Changes since 1.58: +65 -99 lines
Diff to previous 1.58 (colored) to selected 1.83 (colored)

KNF: case (FOO):  ->  case FOO:, remove /* LINTED */ and /* ARGSUSED */,
remove trailing whitespace and blanks before tabs, improve some indenting;
no functional change

Revision 1.58 / (download) - annotate - [select for diffs], Sun Mar 30 21:28:01 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.57: +9 -4 lines
Diff to previous 1.57 (colored) to selected 1.83 (colored)

Support relative arguments to .ll (increase or decrease line length).

Revision 1.57 / (download) - annotate - [select for diffs], Sun Mar 30 19:47:48 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.56: +17 -2 lines
Diff to previous 1.56 (colored) to selected 1.83 (colored)

Implement the roff(7) .ll (line length) request.
Found by naddy@ in the textproc/enchant(1) port.
Of course, do not use this in new manuals.

Revision 1.56 / (download) - annotate - [select for diffs], Sun Mar 23 11:25:26 2014 UTC (10 years ago) by schwarze
Branch: MAIN
Changes since 1.55: +2 -1 lines
Diff to previous 1.55 (colored) to selected 1.83 (colored)

The files mandoc.c and mandoc.h contained both specialised low-level
functions used for multiple languages (mdoc, man, roff), for example
mandoc_escape(), mandoc_getarg(), mandoc_eos(), and generic auxiliary
functions.  Split the auxiliaries out into their own file and header.
While here, do some #include cleanup.

Revision 1.55 / (download) - annotate - [select for diffs], Sun Jan 5 19:10:56 2014 UTC (10 years, 2 months ago) by joerg
Branch: MAIN
Changes since 1.54: +5 -2 lines
Diff to previous 1.54 (colored) to selected 1.83 (colored)

Tag functions with format strings as arguments as printf-like.
Fix one case where a non-literal is used as format string.
Fix another case where a variable is formatted using the wrong type.

Revision 1.54 / (download) - annotate - [select for diffs], Sun Oct 16 12:20:34 2011 UTC (12 years, 5 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_3, VERSION_1_12_2, VERSION_1_12_1
Changes since 1.53: +3 -4 lines
Diff to previous 1.53 (colored) to selected 1.83 (colored)

Remove a bunch of useless assignments,
and assert that print_bvspace cannot be called on NULL pointers.
No change in behaviour, none of these were bugs,
but the code becomes easier to understand.
Based on a clang report posted by joerg@; ok kristaps@.

Revision 1.53 / (download) - annotate - [select for diffs], Sun Sep 18 14:14:15 2011 UTC (12 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_12_0
Changes since 1.52: +2 -2 lines
Diff to previous 1.52 (colored) to selected 1.83 (colored)

forgotten Copyright bumps; no code change
found while syncing to OpenBSD

Revision 1.52 / (download) - annotate - [select for diffs], Tue Aug 16 12:23:51 2011 UTC (12 years, 7 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_7, VERSION_1_11_6
Changes since 1.51: +6 -5 lines
Diff to previous 1.51 (colored) to selected 1.83 (colored)

Fixed mingw compatibility where the "z" printf() modifier isn't
recognised.  It's easier to make these u_int than to jump through hoops
for a special formatter.

Revision 1.51 / (download) - annotate - [select for diffs], Tue May 17 14:38:34 2011 UTC (12 years, 10 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_5, VERSION_1_11_4, VERSION_1_11_3
Changes since 1.50: +3 -2 lines
Diff to previous 1.50 (colored) to selected 1.83 (colored)

Add mode for -Tlocale.  This mode, with this commit, behaves exactly
like -Tascii.  While adding this, inline term_alloc() (was a one-liner),
remove some switches around the terminal encoding for the symbol table
(unnecessary), and split out ascii_alloc() into ascii_init(), which is
also called from locale_init().

Revision 1.50 / (download) - annotate - [select for diffs], Sun May 15 00:58:48 2011 UTC (12 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.49: +197 -169 lines
Diff to previous 1.49 (colored) to selected 1.83 (colored)

Move struct termp_ps into term_ps.c; remove the engine union in struct termp,
which only held one entry; finally (as per the first), make "ps" member into a
pointer managed by term_ps.c.  This frees up a nice chunk of memory during
run-time and in the binary.

Revision 1.49 / (download) - annotate - [select for diffs], Sat May 14 17:54:42 2011 UTC (12 years, 10 months ago) by kristaps
Branch: MAIN
Changes since 1.48: +10 -7 lines
Diff to previous 1.48 (colored) to selected 1.83 (colored)

Make character engine (-Tascii, -Tpdf, -Tps) ready for Unicode: make buffer
consist of type "int".  This will take more work (especially in encode and
friends), but this is a strong start.  This commit also consists of some
harmless lint fixes.

Revision 1.48 / (download) - annotate - [select for diffs], Thu Mar 17 08:49:34 2011 UTC (13 years ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_11_2, VERSION_1_11_1, VERSION_1_10_10
Changes since 1.47: +2 -7 lines
Diff to previous 1.47 (colored) to selected 1.83 (colored)

Move mandoc_{realloc,malloc,calloc} out of libmandoc.h and into mandoc.h
so that everybody can use them.  This follows the convention of
libXXXX.h being internal to a library and XXXX.h being the external
interface.  Not only does this allow the removal of lots of redundant
NULL-checking code, it also sets the tone for adding new mandoc-global
routines.

Revision 1.47 / (download) - annotate - [select for diffs], Mon Mar 7 01:58:24 2011 UTC (13 years ago) by schwarze
Branch: MAIN
Changes since 1.46: +1 -3 lines
Diff to previous 1.46 (colored) to selected 1.83 (colored)

Do not leak information about the software used
into PostScript and PDF documents behind the user's back.
Joerg Sonnenberger pointed out that almost all software
creating PostScript and PDF documents does so, even on OpenBSD,
but that doesn't make the leakage much better in my book.
According to all standards i could find, this information is optional.
Issue originally reported by deraadt@; "commit!" kristaps@.

Revision 1.46 / (download) - annotate - [select for diffs], Tue Jan 25 17:32:04 2011 UTC (13 years, 2 months ago) by kristaps
Branch: MAIN
Changes since 1.45: +2 -3 lines
Diff to previous 1.45 (colored) to selected 1.83 (colored)

Remove unnecessary conditional...

Revision 1.45 / (download) - annotate - [select for diffs], Mon Sep 27 23:03:44 2010 UTC (13 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: VERSION_1_10_9, VERSION_1_10_8, VERSION_1_10_7
Changes since 1.44: +2 -2 lines
Diff to previous 1.44 (colored) to selected 1.83 (colored)

Merge from OpenBSD right after 1.10.6; now back to full sync.
* mdoc.c: blank lines outside literal mode are more similar to .sp than .Pp
* backslashes do not terminate macros; partial revert of mdoc.c 1.164;
  the intention of that commit is fully achieved in roff.c
* mdoc_term.c: no need to list the same prototype twice
* mdoc_validate.c: drop .Pp before .sp just like .Pp before .Pp
* fix off-by-one found by jsg@ with parfait, OpenBSD term_ps.c 1.12
ok kristaps@

Revision 1.44 / (download) - annotate - [select for diffs], Sat Sep 4 20:18:53 2010 UTC (13 years, 6 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_6
Changes since 1.43: +4 -3 lines
Diff to previous 1.43 (colored) to selected 1.83 (colored)

Churny commit to quiet lint.  No functional changes.

Revision 1.43 / (download) - annotate - [select for diffs], Thu Aug 26 13:00:59 2010 UTC (13 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored) to selected 1.83 (colored)

"sys/param.h is for kernel interface programs.
sys/types.h is the file you want to include."

From a downstream fix by deraadt@.

Revision 1.42 / (download) - annotate - [select for diffs], Fri Aug 20 01:02:07 2010 UTC (13 years, 7 months ago) by schwarze
Branch: MAIN
Changes since 1.41: +4 -3 lines
Diff to previous 1.41 (colored) to selected 1.83 (colored)

Implement a simple, consistent user interface for error handling.
We now have sufficient practical experience to know what we want,
so this is intended to be final:
- provide -Wlevel (warning, error or fatal) to select what you care about
- provide -Wstop to stop after parsing a file with warnings you care about
- provide consistent exit status codes for those warnings you care about
- fully document what warnings, errors and fatal errors mean
- remove all other cruft from the user interface, less is more:
- remove all -f knobs along with the whole -f option
- remove the old -Werror because calling warnings "fatal" is silly
- always finish parsing each file, unless fatal errors prevent that
This commit also includes a couple of related simplifications behind
the scenes regarding error handling.
Feedback and OK  kristaps@;  Joerg Sonnenberger (NetBSD) and
Sascha Wildner (DragonFly BSD) agree with the general direction.

Revision 1.41 / (download) - annotate - [select for diffs], Fri Aug 6 16:07:35 2010 UTC (13 years, 7 months ago) by kristaps
Branch: MAIN
Changes since 1.40: +8 -4 lines
Diff to previous 1.40 (colored) to selected 1.83 (colored)

IMPORTANT FIX: add missing braces around alloc failure conditional in
fuction-isation of PS_GROWBUF.  Obviously the original commit was never
actually tested, as -Tps and -Tpdf errored out immediately.

Revision 1.40 / (download) - annotate - [select for diffs], Sun Aug 1 15:46:18 2010 UTC (13 years, 7 months ago) by joerg
Branch: MAIN
Changes since 1.39: +19 -16 lines
Diff to previous 1.39 (colored) to selected 1.83 (colored)

Turn the non-trivial PS_GROWBUF macro into a function. Don't use MAX, it
doesn't exist in the default namespace on Solaris.

Revision 1.39 / (download) - annotate - [select for diffs], Sun Jul 25 22:15:07 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_5
Changes since 1.38: +44 -15 lines
Diff to previous 1.38 (colored) to selected 1.83 (colored)

Fully-working -Tpdf: xref table is now generated.  This works for both
single and multiple-manual mode (e.g., mandoc -Tpdf foo.1 bar.1).

Revision 1.38 / (download) - annotate - [select for diffs], Sun Jul 25 19:37:38 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.37: +52 -64 lines
Diff to previous 1.37 (colored) to selected 1.83 (colored)

Make PDF sections contiguous.

Revision 1.37 / (download) - annotate - [select for diffs], Sun Jul 25 11:44:31 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.36: +227 -47 lines
Diff to previous 1.36 (colored) to selected 1.83 (colored)

Initial PDF shim over PS.  This produces working PDF output with -Tpdf.
It's currently missing the xref table, so you'll get a warning in most
PDF viewers).  It also produces lots of redundant output, which will go
away once I get a better handle on the PDF spec.  The code doesn't
really touch any existing functionality; it's a bunch of conditionals
atop the -Tps (term_ps.c) implementation.  I'm checking it in now to
have it exist and be auditable.  It needs clean-up, polish, and general
care (and xref!).

Revision 1.36 / (download) - annotate - [select for diffs], Wed Jul 21 08:24:39 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_5_PREPDF
Changes since 1.35: +8 -8 lines
Diff to previous 1.35 (colored) to selected 1.83 (colored)

The "wx" value is quite small, so use a u_short instead of a size_t.

Revision 1.35 / (download) - annotate - [select for diffs], Tue Jul 20 10:56:03 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.34: +5 -5 lines
Diff to previous 1.34 (colored) to selected 1.83 (colored)

Use floating-point -Tps "moveto" arguments to smooth out column and row
misalignments.

Revision 1.34 / (download) - annotate - [select for diffs], Tue Jul 13 23:53:20 2010 UTC (13 years, 8 months ago) by schwarze
Branch: MAIN
Changes since 1.33: +2 -2 lines
Diff to previous 1.33 (colored) to selected 1.83 (colored)

correct lots of copyright notices;
ok kristaps@

Revision 1.33 / (download) - annotate - [select for diffs], Mon Jul 5 08:46:09 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_4
Changes since 1.32: +2 -6 lines
Diff to previous 1.32 (colored) to selected 1.83 (colored)

Suppress duplicate "Page: 1 1" -Tps printing and instead relay on
PS_NEWPAGE to do the job for us.  Noted by Dillo.

Revision 1.32 / (download) - annotate - [select for diffs], Sun Jul 4 20:17:42 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.31: +25 -7 lines
Diff to previous 1.31 (colored) to selected 1.83 (colored)

gv(1) doesn't remember the last set font when displaying new pages, so
print it out for each new page.  This also prevents superfluous
printings of the font before the %%Page: comment has been displayed.

Revision 1.31 / (download) - annotate - [select for diffs], Sun Jul 4 20:06:59 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.30: +6 -19 lines
Diff to previous 1.30 (colored) to selected 1.83 (colored)

Set line-height to be 1.4em.  Removed check for minimum margins that are no
longer important.

Revision 1.30 / (download) - annotate - [select for diffs], Sun Jul 4 19:57:26 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.29: +14 -10 lines
Diff to previous 1.29 (colored) to selected 1.83 (colored)

Suppress printing blank eof pages in -Tps.  Delay printing of Page:
until actual text is ready to be displayed.

Revision 1.29 / (download) - annotate - [select for diffs], Sun Jul 4 19:42:25 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.28: +32 -16 lines
Diff to previous 1.28 (colored) to selected 1.83 (colored)

Suppress printing of newlines/space at start of new -Tps page.

Also renamed "psstate" -> "flags" (was wrongly implying some sort of
state machine).

Revision 1.28 / (download) - annotate - [select for diffs], Sun Jul 4 19:24:00 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.27: +11 -16 lines
Diff to previous 1.27 (colored) to selected 1.83 (colored)

Backed out margin calculations in favour of much simpler rule of thumb:
margins are 1/9 the length/width.

Revision 1.27 / (download) - annotate - [select for diffs], Sun Jul 4 10:53:04 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.26: +40 -13 lines
Diff to previous 1.26 (colored) to selected 1.83 (colored)

Auto-margins.  Documented in mandoc.1.  Also bumped line-height and made
sure header and footer accomodate for said line-height.

Revision 1.26 / (download) - annotate - [select for diffs], Fri Jul 2 10:53:28 2010 UTC (13 years, 8 months ago) by kristaps
Branch: MAIN
Changes since 1.25: +2 -1 lines
Diff to previous 1.25 (colored) to selected 1.83 (colored)

Lint fixes.

Revision 1.25 / (download) - annotate - [select for diffs], Thu Jul 1 14:23:45 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.24: +41 -15 lines
Diff to previous 1.24 (colored) to selected 1.83 (colored)

First, I'm defaulting to 11-point font, which renders much nicer (the
"Internet" vaguely suggests using 11- or 9-Point for serifed fonts).
This verified on GNU/Linux, Mac OSX, Windows, and OpenBSD.  Noted in
mandoc.1.

Then added a3, a4, a5, letter, legal, and custom page dimensions.  These
seem to be the main players.  Noted in mandoc.1.

Lintified the casting.

Revision 1.24 / (download) - annotate - [select for diffs], Wed Jun 30 20:57:41 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.23: +271 -271 lines
Diff to previous 1.23 (colored) to selected 1.83 (colored)

Now using Times AFM provided by Dillo.  Verified on OpenBSD by me and Mac OSX
by M. Deksters.

Revision 1.23 / (download) - annotate - [select for diffs], Wed Jun 30 15:05:02 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.22: +5 -6 lines
Diff to previous 1.22 (colored) to selected 1.83 (colored)

Correct dimensions for DocumentMedia.  Noted by schwarze@, as gv(1) was
puking on input.

Revision 1.22 / (download) - annotate - [select for diffs], Wed Jun 30 13:16:25 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.21: +289 -289 lines
Diff to previous 1.21 (colored) to selected 1.83 (colored)

Embedding Charter proportional-width glyphs.  Nice-looking output.

Revision 1.21 / (download) - annotate - [select for diffs], Wed Jun 30 13:00:00 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.20: +28 -18 lines
Diff to previous 1.20 (colored) to selected 1.83 (colored)

PostScript can now handle scaled glyph sizes (see "scale" in struct
termp_ps) to arbitrarily scale font.  Tested with 10 (default), 12, 14.

Revision 1.20 / (download) - annotate - [select for diffs], Wed Jun 30 12:30:36 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.19: +4 -10 lines
Diff to previous 1.19 (colored) to selected 1.83 (colored)

Pushed normalisation of scaling units into term_hspan().

Revision 1.19 / (download) - annotate - [select for diffs], Wed Jun 30 12:27:55 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.18: +66 -7 lines
Diff to previous 1.18 (colored) to selected 1.83 (colored)

Move term_hspan() calculation into the output devices, where it belongs.

Revision 1.18 / (download) - annotate - [select for diffs], Wed Jun 30 11:45:21 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.17: +22 -21 lines
Diff to previous 1.17 (colored) to selected 1.83 (colored)

Push paper calculation out of getsubopt() loop.  Make all points be AFM
glyph units to make positioning more precise.

Revision 1.17 / (download) - annotate - [select for diffs], Tue Jun 29 14:53:14 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_3
Changes since 1.16: +24 -2 lines
Diff to previous 1.16 (colored) to selected 1.83 (colored)

Add in -Opaper=xxx support for -Tps postscript.  This doesn't have any
functional changes beyond the getsubopt() parse in term_ps.c.  If you
want to test this (it only does -Opaper=a4 and -Opaper=letter; adding
more is trivial), make sure you specify (e.g.) -sPAPERSIZE=a4 to gs(1).

Revision 1.16 / (download) - annotate - [select for diffs], Tue Jun 29 14:18:05 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.15: +57 -24 lines
Diff to previous 1.15 (colored) to selected 1.83 (colored)

Give -Tps better PostScript hinting.  Note that we're using Adobe-3.0
constructs.  Push the stupid CPP defines for page boundaries and margins
into proper variables.  Give enum termfont a proper TERMFONT__MAX.

Revision 1.15 / (download) - annotate - [select for diffs], Mon Jun 28 23:26:09 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.14: +12 -10 lines
Diff to previous 1.14 (colored) to selected 1.83 (colored)

Clean-up of variable-width glyph support.  Adds no new code; only
restructured to make a bit more readable.  Also removed an unused entry
in the PS engine structure.

Revision 1.14 / (download) - annotate - [select for diffs], Mon Jun 28 22:46:21 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.13: +14 -16 lines
Diff to previous 1.13 (colored) to selected 1.83 (colored)

This enables variable glyph-width output.  The checkin will be followed
by a [functionless] clean-up in term_ps.c, but this makes the
appropriate changes to "enable" initial proportional-width functionality
in term.c and fixes some areas of term_ps.c that were causing errors.

Revision 1.13 / (download) - annotate - [select for diffs], Mon Jun 28 13:45:28 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.12: +342 -15 lines
Diff to previous 1.12 (colored) to selected 1.83 (colored)

Initial encoding of glyph widths.  From /usr/X11R6/lib/X11/fonts/Type1.
These continues proportional-width glyph encoding.

Revision 1.12 / (download) - annotate - [select for diffs], Fri Jun 25 19:50:23 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.11: +2 -1 lines
Diff to previous 1.11 (colored) to selected 1.83 (colored)

Remove "pt" from struct roffsu, as CSS (the only reason it was there) is
unclear about which units accept floats/integers, which leads me to
assume that it handles either and rounds as appropriate.

Revision 1.11 / (download) - annotate - [select for diffs], Fri Jun 25 18:53:14 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.10: +13 -1 lines
Diff to previous 1.10 (colored) to selected 1.83 (colored)

Initial chunks for variable-width fonts.  Pushes all width calculations
in mdoc_term.c and man_term.c down into term.c.  This is still not
implemented in term.c, although stubs for width calculations are in
place.  From now on, offset, rmargin, and other layout variables are
abstract screen widths.  They will resolve to the the familiar values
for -Tascii but -Tps will eventually use points instead of chars.

Revision 1.10 / (download) - annotate - [select for diffs], Sat Jun 19 20:46:28 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
CVS Tags: VERSION_1_10_2
Changes since 1.9: +2 -2 lines
Diff to previous 1.9 (colored) to selected 1.83 (colored)

Churn as I finish email address migration kth.se -> bsd.lv.

Revision 1.9 / (download) - annotate - [select for diffs], Fri Jun 11 16:58:20 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.8: +134 -62 lines
Diff to previous 1.8 (colored) to selected 1.83 (colored)

Implement font-switching for PostScript.  -Tps now supports
TERMFONT_BOLD (Courier-Bold) and TERMFONT_UNDER (Courier-Oblique).  It
doesn't look half bad.  This accomplished through tricksy juggling of
the one-char back-buffer.

Revision 1.8 / (download) - annotate - [select for diffs], Fri Jun 11 15:26:39 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.7: +42 -21 lines
Diff to previous 1.7 (colored) to selected 1.83 (colored)

Delay opening a word state until a character is ready to be output.
This paves the way for closing/reopening scope in the event that a font
changes.

Revision 1.7 / (download) - annotate - [select for diffs], Fri Jun 11 07:23:04 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.6: +31 -2 lines
Diff to previous 1.6 (colored) to selected 1.83 (colored)

Teach -Tps to ignore backspace-encoding by using a one-char buffer and a
simple state machine.  This paves the way for decorated text.

Revision 1.6 / (download) - annotate - [select for diffs], Thu Jun 10 23:56:33 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.5: +5 -4 lines
Diff to previous 1.5 (colored) to selected 1.83 (colored)

Allow open word contexts in -Tps to preserve whitespace, as whitespace
apparently doesn't collapse in PostScript (surprise!).  Makes output
files much more compact.

Revision 1.5 / (download) - annotate - [select for diffs], Wed Jun 9 08:31:18 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.4: +4 -2 lines
Diff to previous 1.4 (colored) to selected 1.83 (colored)

Forgot to increment into the nil terminator.  And call va_end() while
we're at it.

Revision 1.4 / (download) - annotate - [select for diffs], Wed Jun 9 08:07:13 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.3: +139 -55 lines
Diff to previous 1.3 (colored) to selected 1.83 (colored)

Have the standard manpage header and footer print on every page of -Tps
output.  This is more tricky than you may think:  we can't just call the
header function out-of-state (i.e., before a flushln has occured)
because we'd clobber our current state.  Thus, we call at the beginning
and dump the output into an auxiliary buffer.

For the record, I don't think there's any other clean way to do this.
The only other Way That Works is to copy-aside *all* termp state, zero
it, and do the necessary headf/footf.  This is just as complex, as
memory needs to be alloc'd and free'd per margin.

Unfortunately, this prohibits page numbering (the margin is only printed
once), so I'll probably end up re-writing this down the line.

Revision 1.3 / (download) - annotate - [select for diffs], Tue Jun 8 15:06:01 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.2: +2 -1 lines
Diff to previous 1.2 (colored) to selected 1.83 (colored)

Lint noops.  Also fixed getsubopt() to be in unistd.h (noted by joerg@).

Revision 1.2 / (download) - annotate - [select for diffs], Tue Jun 8 15:00:17 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Changes since 1.1: +173 -1 lines
Diff to previous 1.1 (colored) to selected 1.83 (colored)

Broke ascii_*() functions into term_ascii.c

Made low-level engine functions into function pointers.

Revision 1.1 / (download) - annotate - [select for diffs], Tue Jun 8 13:22:37 2010 UTC (13 years, 9 months ago) by kristaps
Branch: MAIN
Diff to selected 1.83 (colored)

No functionality changes: just restructuring.  Deprecated
terminal_free() in favour of ps_free() and ascii_free().  Moved ps_*()
functions into term_ps.c so that they don't clutter up term.c.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb