§1conveps1.

conveps.

CONVEPS
Convert Encapsulated PostScript to structured PostScript and PNG (conveps.web).
Log[LDF 2005.04.22.] This program now works. It could be refined, though.
h Version control identifier 1 i ≡static char rcs id [ ] = "$Id: conveps.web,v 1.32 2009/08/20 11:24:17 lfinsto1 Exp $";This code is used in section 81.

1

2

COPYRIGHT AND LICENSE

conveps§2

2. Copyright and License.
Copyright c 2003, 2004, 2005, 2006, 2007, 2008, 2009 The Free Software Foundation
See the section h GNU Free Documentation License 78 i for the copying conditions that apply to thisdocument.
conveps is part of GNU 3DLDF.
The program GNU 3DLDF documented here is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version. See the section h GNU General Public
License 79 i in this document.
GNU 3DLDF is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; withouteven the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with 3DLDF; if not, write to
the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
GNU 3DLDF is a GNU package. It is part of the GNU Project of the Free Software Foundation and ispublished under the GNU General Public License. See the website http://www.gnu.org for more information. GNU 3DLDF is available for downloading from http://www.gnu.org/software/3dldf/LDF.html. It
is also available from http://www.dante.de/software/ctan/, the Dante www-server and fromhttp://wwwuser.gwgd.de/~lfinsto1, the author’s website.
Please send bug reports to:
lfinsto1@gwdg.de
The mailing list help-3DLDF@gnu.org is available for people to ask other users for help. The mailing list
info-3DLDF@gnu.org is for sending announcements to users. To subscribe to these mailing lists, send an
email with “subscribe hemail-addressi” as the subject.
The author can be contacted at:
Laurence D. Finston
c/o Free Software Foundation, Inc.
51 Franklin St, Fifth Floor
Boston, MA 02110-1301
USA
lfinsto1@gwdg.des246794@stud.uni-goettingen.de
Web site: http:://wwwuser.gwdg.de/~lfinsto1

§3
3.

conveps

INSTRUCTIONS FOR USE

Instructions for use.

3

[LDF 2005.05.02.]
Log[LDF 2005.05.02.] Copied the text in this section from ~/EXAMPLES/CROPPING/00README and edited it.
conveps takes one required argument, the filename without extension of the Encapsulated PostScript(EPS) files. This argument can be followed by one or two numbers indicating the first and last EPS files thatshould be processed. The defaults for the first and last files are 0 and 100, respectively. If these arguments
aren’t used, and hfilenamei.0 doesn’t exist, conveps tries to process hfilenamei.1. If a file fails to exist fora larger number, conveps will exit.
Given the files 3DLDFmp.1, 3DLDFmp.2, and 3DLDFmp.3, “conveps 3DLDFmp 1 3” will generate the files
3DLDFmp_1.pnm, 3DLDFmp_2.pnm, and 3DLDFmp_3.pnm.
conveps can be invoked using the options in the following list. Options can take no argument, a required
argument, or an optional argument. Optional arguments must be passed as follows: −−hoptioni=hargument i.
Required arguments can be passed like this, but in this case, a space can be substituted for the equals sign.
Color arguments must be specified as required by the ImageMagick programs. See the ImageMagick
manual (“man pages”) for more information. Color arguments containing parentheses should be quoted, toprevent the shell from treating them as special characters.
−−borderOptional numerical argument. If n is the argument, a border of n pixels is added
to the image. If no argument is used, the default value of 10 is used.

−−bordercolor

Required color argument. Used together with the −−border,−−horizontal−border, or −−vertical−border options. If not used, the border
will be white.

−−coerce

Optional argument. If no argument is used, the image is coerced to 640 × 480
pixels. If the argument “s” (for “small”) is used, it is coerced to 320 × 240 pixels.
If any other argument is used, conveps issues a warning and coerces the image to
640 × 480 pixels.

−−end

Required numerical argument. The number of the last file EPS to be processed.

−−fillRequired color argument. This option is used in combination with the −−opaqueargument. When replacing colors in an image, the −−fill color replaces the−−opaque color.

−−force

No argument. If no −−end argument is used, −−force will cause conveps tocontinue trying to find files to convert until it reaches the default value (currently
100).

−−gray−negate

No argument. Grayscale pixel values are negated. See also the −−negate option.

−−height

Required numerical argument. Currently not used for anything.

−−helpNo argument. Prints information about conveps to standard output and exits.

−−horizontal−border

Optional numerical argument. If n is the argument, a border of n pixels is added
to the left and right sides of the image. If no argument is used, the default valueof 10 is used.

4

INSTRUCTIONS FOR USE

conveps§3−−landscape

The TEX files that include the images will be in DIN A3 landscape format, i.e.,
width 420mm and height 297mm.

−−large

The TEX files that include the images will be in DIN A3 format, i.e., width 420mm
and height 297mm.

−−new−filename

Required string argument. The files created by conveps will have names beginningwith this string. It will be followed by an underline character and a number,possibly preceded by one or more zeroes. The extension will indicate the fileformat.

−−no−zeroes

No argument. Suppresses the use of leading zeroes in the output filenames.

−−opaqueRequired argument. This option is used in combination with the −−fill argument.
When replacing colors in an image, the −−fill color replaces the −−opaque color.

−−negate

No argument. Pixel values are negated. See also the −−gray−negate option.

−−output−format

Required string argument. The argument can be “eps”, “jpeg”, “jpg”, “png”,“pnm”, or “ps”. Case is ignored, so “JPG” or “jPg” is equivalent to “jpg”. PNM
is the default output format.

−−portrait

The TEX files that include the images will be in DIN A3 portrait format, i.e.,
width 297mm and height 420mm.

−−quietNo argument. Suppresses some terminal output.

−−renumber

Required argument. The output files will be numbered starting with the argument.

−−silent

No argument. Suppresses more terminal output than the “−−quiet” option.

−−startRequired argument. The starting number for the input files.

−−threads−limit

Required argument. The greatest number of threads created by conveps that canbe active at one time. The default is 100.

−−transparent

Required color argument. This color will be made transparent in the output files,
provided their format supports transparency.

−−verbose

No argument. Enables more terminal output than normal.

−−version

No argument. Prints out the version number of conveps and exits.

−−vertical−border

Optional numerical argument. If n is the argument, a border of n pixels is added
to the top and bottom of the image. If no argument is used, the default value of
10 is used.

−−widthRequired numerical argument. Currently not used for anything.

−−zeroes

Required argument. Specifies the minimum number of leading zeroes used in thenumbers included in the names of the output files.

§4
4.

GENERATING THE EXECUTABLE CONVEPS

conveps

Generating the executable conveps.

5[LDF 2005.04.26.]
Log[LDF 2005.08.24.] Revised.

To generate the executable conveps, call‘make conveps’ from a shell. Alternatively, you can call ‘ctangle conveps.web’ and ‘gcc −o conveps −g −pthread con

6

INVOKING CONVEPS

5.

Invoking conveps.

6.

Include files. [LDF 2005.04.21.]

h Include files 6 i ≡#include "config.h"#include <ctype.h>#include <getopt.h>#include <iomanip>#include <ios>#include <iostream>#include <math.h>#include <new>#include <pthread.h>#include <sstream>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <time.h>#include <unistd.h>using namespace std;
This code is used in section 81.

conveps[LDF 2005.08.24.]

§5

§7
7.

conveps

Preprocessor macros.

PREPROCESSOR MACROS[LDF 2005.08.18.]
Log[LDF 2005.08.18.] Added this section.
h Preprocessor macros 7 i ≡#define DEBUG_COMPILE 1
This code is used in section 81.

7

8

TYPE DECLARATIONS

8.

Type declarations.

conveps[LDF 2005.04.21.]

h Type declarations 8 i ≡typedef char Byte;
typedef Byte Signed Byte;
typedef unsigned char Unsigned Byte;
This code is used in section 81.

§8

§9

DECLARE THREAD FUNC ARG TYPE

conveps9.

Declare Thread Func Arg Type.

=Log[LDF 2005.08.26.] Added this section.
h Declare Thread Func Arg Type 9 i ≡struct Thread Func Arg Type {int eps file number ;int thread ctr ;char zeroes string [MAX_ZEROES_STRING];};
This code is used in section 81.

10.

Global constants. [LDF 2005.04.21.]
Log[LDF 2005.09.02.] Added const unsigned short DEFAULT_END_VALUE = 100.
[2009.01.14.] Changed DEFAULT_BORDER_VALUE from 10 to 0.
h Global constants 10 i ≡/∗ 25 ∗/
const Unsigned Byte MAX_FILENAME = 32;
const unsigned short MAX_SYSTEM_STRING = 1024;/∗ 21 0 ∗/const unsigned short MAX_TEX_FILE_HEADER = 1024;
const unsigned short MAX_DATESTAMP = 128;/∗ 27 ∗/
const unsigned short MAX_BORDER_STRING = 128;
const unsigned short DEFAULT_BORDER_VALUE = 0;
const unsigned short DEFAULT_END_VALUE = 100;
const unsigned short MAX_COLOR_STRING = 128;
const unsigned short MAX_ZEROES_STRING = 16;
const unsigned short DEFAULT_ZEROES = 2;
const unsigned short MAX_COERCE_STRING = 32;
const unsigned short MAX_OUTPUT_EXTENSION = 8;
const unsigned short DEFAULT_THREADS_LIMIT = 100;
const Unsigned Byte SILENT = 0;
const Unsigned Byte QUIET = 1;
const Unsigned Byte NORMAL = 2;
const Unsigned Byte VERBOSE = 3;
const Unsigned Byte PORTRAIT = 0;
const Unsigned Byte LANDSCAPE = 1;
This code is used in section 81.

910

DECLARE THREAD FUNC ARG TYPE

11.

Global variables. [LDF 2005.08.18.]

conveps§11

Log[LDF 2005.09.02.] Added bool force switch = false .
[LDF 2005.12.16.] Added Unsigned Byte ∗default output .
[LDF 2008.12.29.] Replaced PTHREAD_THREADS_MAX with 8192 (21 3). PTHREAD_THREADS_MAX should be
defined in limits.h, but I can’t find a definition on the machine I’m currently using. On another machine,
it was 16384 = 214 .
h Global variables 11 i ≡Unsigned Byte VERBOSITY;
char filename stem [MAX_FILENAME];
char new filename stem [MAX_FILENAME];
int start value = −1;
int end value = −1;char border string [MAX_BORDER_STRING];
char vertical border string [MAX_BORDER_STRING];
char horizontal border string [MAX_BORDER_STRING];
char default border string [MAX_BORDER_STRING];
char border color string [MAX_COLOR_STRING];
char default border color string [MAX_COLOR_STRING];
Unsigned Byte eps output = 0;
Unsigned Byte jpeg output = 0;
Unsigned Byte pnm output = 0;
Unsigned Byte png output = 0;
Unsigned Byte ps output = 0;
Unsigned Byte ∗default output = 0;bool force switch = false ;char fill string [MAX_COLOR_STRING];
char opaque string [MAX_COLOR_STRING];
char transparent string [MAX_COLOR_STRING];
char negate string [16] = "";signed int zeroes = −1;
unsigned int height value = 0;
unsigned int width value = 0;
unsigned int renumber value = 0;
Unsigned Byte coerce value = 0;
Unsigned Byte portrait or landscape = PORTRAIT;
char coerce string [MAX_COERCE_STRING];
char output extension [MAX_OUTPUT_EXTENSION];
pthread t ∗ thread array [8192];/∗ Formerly PTHREAD_THREADS_MAX. See log entry above. [LDF 2008.12.29.] ∗/Thread Func Arg Type ∗thread func args [8192];
pthread mutex t stdio mutex ;/∗ As above. [LDF 2008.12.29.] ∗/unsigned short threads limit = DEFAULT_THREADS_LIMIT;
char tex file header [MAX_TEX_FILE_HEADER];
This code is used in section 81.

§12conveps

12.

Local variables for main().

LOCAL VARIABLES FOR MAIN()[LDF 2005.08.18.]
Log[LDF 2005.08.18.] Added this section.
h Local variables for main ( ) 12 i ≡bool DEBUG = false ;/∗ true ∗/int status ;char zeroes string [MAX_ZEROES_STRING];
This code is used in section 50.

11

12

COMMAND LINE OPTIONS

13.

Command line options.

conveps[LDF 2005.08.18.]
Log[LDF 2005.08.18.] Added this section.

§13

§14

conveps

DECLARATIONS FOR COMMAND LINE OPTIONS

14.

Declarations for command line options.

[LDF 2005.08.18.]

13

Log[LDF 2005.08.18.] Added this section.
h Declarations for command line options 14 i ≡int option ctr ;int digit optind = 0;
const unsigned short BORDER_INDEX = 0;
const unsigned short BORDER_COLOR_INDEX = 1;
const unsigned short COERCE_INDEX = 2;
const unsigned short END_INDEX = 3;
const unsigned short FILL_INDEX = 4;
const unsigned short FORCE_INDEX = 5;
const unsigned short GRAY_NEGATE_INDEX = 6;
const unsigned short HEIGHT_INDEX = 7;
const unsigned short HELP_INDEX = 8;
const unsigned short HORIZONTAL_BORDER_INDEX = 9;
const unsigned short LANDSCAPE_INDEX = 10;
const unsigned short NEGATE_INDEX = 11;
const unsigned short NEW_FILENAME_INDEX = 12;
const unsigned short NO_ZEROES_INDEX = 13;
const unsigned short OPAQUE_INDEX = 14;
const unsigned short OUTPUT_FORMAT_INDEX = 15;
const unsigned short PORTRAIT_INDEX = 16;
const unsigned short QUIET_INDEX = 17;
const unsigned short RENUMBER_INDEX = 18;
const unsigned short SILENT_INDEX = 19;
const unsigned short START_INDEX = 20;
const unsigned short THREADS_LIMIT_INDEX = 21;
const unsigned short TRANSPARENT_INDEX = 22;
const unsigned short VERBOSE_INDEX = 23;
const unsigned short VERSION_INDEX = 24;
const unsigned short VERTICAL_BORDER_INDEX = 25;
const unsigned short WIDTH_INDEX = 26;
const unsigned short ZEROES_INDEX = 27;
static struct option long options [ ] = {{"border", 2, 0, 0}, {"bordercolor", 1, 0, 0}, {"coerce", 2, 0, 0},{"end", 1, 0, 0}, {"fill", 1, 0, 0}, {"force", 0, 0, 0}, {"gray−negate", 0, 0, 0}, {"height", 1, 0, 0},{"help", 0, 0, 0}, {"horizontal−border", 2, 0, 0}, {"landscape", 0, 0, 0}, {"negate", 0, 0, 0},{"new−filename", 1, 0, 0}, {"no−zeroes", 0, 0, 0}, {"opaque", 1, 0, 0}, {"output−format", 1, 0, 0},{"portrait", 0, 0, 0}, {"quiet", 0, 0, 0}, {"renumber", 1, 0, 0}, {"silent", 0, 0, 0}, {"start", 1, 0, 0},{"threads−limit", 1, 0, 0}, {"transparent", 1, 0, 0}, {"verbose", 0, 0, 0}, {"version", 0, 0, 0},{"vertical−border", 2, 0, 0}, {"width", 1, 0, 0}, {"zeroes", 1, 0, 0}, {0, 0, 0, 0}};int option index = 0;
int this option optind = optind ? optind : 1;
This code is used in section 50.

14

PROCESS COMMAND LINE OPTIONS

15.

Process command line options.

conveps§15[LDF 2005.08.18.]
Log[LDF 2005.08.18.] Added this section.
h Process command line options 15 i ≡DEBUG = false ;/∗ true ∗/; while (1) { option ctr = getopt long only (argc , argv , "cefghlnopqrstvwz", long options , &option index );if (option ctr ≡ −1) {if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "No more option arguments." ≪ endl ;pthread mutex unlock (&stdio mutex );}break;}
if (option ctr ≡ 0) {if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "option " ≪ long options [option index ].name ;if (optarg ) cerr ≪ " with arg " ≪ optarg ≪ endl ;else cerr ≪ " with no arguments" ≪ endl ;cerr ≪ "‘option_index’ == " ≪ option index ≪ endl ;pthread mutex unlock (&stdio mutex );}See also sections 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, and 47.
This code is used in section 51.

16.

Border.

[LDF 2005.08.24.]
Log[LDF 2005.08.24.] Added this section.
h Process command line options 15 i +≡if (option index ≡ BORDER_INDEX) {if (optarg ) strcpy (border string , optarg );else sprintf (border string , "%d", DEFAULT_BORDER_VALUE);#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Setting border_string to %s.\n", border string );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ if (option index ≡ BORDER_INDEX) ∗/§17conveps17.

Bordercolor.

BORDERCOLOR[LDF 2005.08.24.]
Log[LDF 2005.08.24.] Added this section.
h Process command line options 15 i +≡else if (option index ≡ BORDER_COLOR_INDEX) { sprintf (border color string , "%s", optarg );#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Setting border_color_string to %s.\n", border color string );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ if (option index ≡ BORDER_COLOR_INDEX) ∗/

15

16

COERCE18.

coerce.

conveps[LDF 2005.08.18.]
Log[LDF 2005.08.18.] Added this section.
h Process command line options 15 i +≡else if (option index ≡ COERCE_INDEX) {#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Coercing.");if (optarg ) fprintf (stderr , "’optarg’ == %s\n", optarg );else fprintf (stderr , "’optarg’ == 0\n");pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/if (optarg ∧ ¬strcasecmp (optarg , "s")) {#if DEBUG_COMPILE
pthread mutex lock (&stdio mutex );fprintf (stderr , "Coercing to 320x240 pixels\n");pthread mutex unlock (&stdio mutex );#endif/∗ DEBUG_COMPILE ∗/coerce value = 1; } else if (optarg ∧ ¬strcasecmp (optarg , "l")) {#if DEBUG_COMPILE
pthread mutex lock (&stdio mutex );fprintf (stderr , "Coercing to 640x480 pixels\n");pthread mutex unlock (&stdio mutex );#endif/∗ DEBUG_COMPILE ∗/coerce value = 2; } else
if (optarg ) {pthread mutex lock (&stdio mutex );fprintf (stderr , "WARNING! Invalid argument for the ’−−coerce’option:
ill coerce to 640x480 pixels.\n", optarg );pthread mutex unlock (&stdio mutex );coerce value = 2;}
else {#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "‘optarg’ == 0. " ≪ "Coercing to 640x480 pixels" ≪ endl ;pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗//∗ if (option index ≡ COERCE_INDEX) ∗/coerce value = 2; } }%s\nW\§18

§19

conveps

19.

end. [LDF 2005.08.19.]

COERCE

Log[LDF 2005.08.19.] Added this section.
[LDF 2005.09.02.] Now setting force switch = true .
h Process command line options 15 i +≡else if (option index ≡ END_INDEX) { sscanf (optarg , "%d", &end value );force switch = true ;#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Setting end_value to %d.\n", end value );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ if (option index ≡ END_INDEX) ∗/20.

fill. [LDF 2005.08.22.]
Log[LDF 2005.08.22.] Added this section.
h Process command line options 15 i +≡else if (option index ≡ FILL_INDEX) { sprintf (fill string , "−fill \"%s\"", optarg );#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Setting ‘fill_string’ to %s.\n", fill string );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ if (option index ≡ FILL_INDEX) ∗/21.

force. [LDF 2005.09.02.]
Log[LDF 2005.09.02.] Added this section.
h Process command line options 15 i +≡else if (option index ≡ FORCE_INDEX) { force switch = true ;#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "Setting ‘force_switch’ to " ≪ force switch ≪ "." ≪ endl ;pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ if (option index ≡ FORCE_INDEX) ∗/

17

18

GRAY-NEGATE

22.

gray-negate.

conveps[LDF 2005.09.01.]
Log[LDF 2005.09.01.] Added this section.
h Process command line options 15 i +≡else if (option index ≡ GRAY_NEGATE_INDEX) { strcpy (negate string , "+negate");#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Setting ‘negate_string’ to %s.\n", negate string );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ if (option index ≡ GRAY_NEGATE_INDEX) ∗/23.

height. [LDF 2005.08.18.]
Log[LDF 2005.08.18.] Added this section.
h Process command line options 15 i +≡else if (option index ≡ HEIGHT_INDEX) { sscanf (optarg , "%d", &height value );#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Setting height to %d pixels.\n", height value );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ if (option index ≡ HEIGHT_INDEX) ∗/24. help.
h Process command line options 15 i +≡else
if (option index ≡ HELP_INDEX) {pthread mutex lock (&stdio mutex );fprintf (stderr , "conveps.\nCopyright (C) 2009 The Free Software Foundation\n");pthread mutex unlock (&stdio mutex );exit (0);}/∗ if (option index ≡ HELP_INDEX) ∗/

§22

§25

conveps

25.

Horizontal Border.

HORIZONTAL BORDER[LDF 2005.08.19.]
Log[LDF 2005.08.19.] Added this section.
h Process command line options 15 i +≡else if (option index ≡ HORIZONTAL_BORDER_INDEX) {if (optarg ) strcpy (horizontal border string , optarg );else sprintf (horizontal border string , "%d", DEFAULT_BORDER_VALUE);#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Setting horizontal border_string to %s.\n", horizontal border string );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ if (option index ≡ HORIZONTAL_BORDER_INDEX) ∗/26.

landscape.

[LDF 2005.09.01.]
Log[LDF 2005.09.01.] Added this section.
h Process command line options 15 i +≡else
if (option index ≡ LANDSCAPE_INDEX) {portrait or landscape = LANDSCAPE;}/∗ if (option index ≡ LANDSCAPE_INDEX) ∗/27.

negate. [LDF 2005.09.01.]
Log[LDF 2005.09.01.] Added this section.
h Process command line options 15 i +≡else if (option index ≡ NEGATE_INDEX) { strcpy (negate string , "−negate");#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Setting ‘negate_string’ to %s.\n", negate string );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ if (option index ≡ NEGATE_INDEX) ∗/

19

20

LANDSCAPE

28.

new-filename. [LDF 2005.08.26.]

conveps

Log[LDF 2005.08.26.] Added this section.
h Process command line options 15 i +≡else if (option index ≡ NEW_FILENAME_INDEX) { sscanf (optarg , "%s", &new filename stem );#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Setting new filename stem to ‘%s’.\n", new filename stem );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ if (option index ≡ NEW_FILENAME_INDEX) ∗/29.

no-zeroes. [LDF 2005.08.22.]
Log[LDF 2005.08.22.] Added this section.
h Process command line options 15 i +≡else if (option index ≡ NO_ZEROES_INDEX) { zeroes = 0;
#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Setting ‘zeroes’ to %d.\n", zeroes );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ if (option index ≡ NO_ZEROES_INDEX) ∗/30.

opaque. [LDF 2005.08.22.]
Log[LDF 2005.08.22.] Added this section.
h Process command line options 15 i +≡else if (option index ≡ OPAQUE_INDEX) { sprintf (opaque string , "−opaque \"%s\"", optarg );#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Setting ‘opaque_string’ to %s.\n", opaque string );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ if (option index ≡ OPAQUE_INDEX) ∗/

§28

§31

conveps31.

output. [LDF 2005.08.19.]

LANDSCAPE

21

Log[LDF 2005.08.19.] Added this section.
[LDF 2005.12.17.] BUG FIX: Now setting ∗default output %= 2 in the case that optarg is "pnm".
h Process command line options 15 i +≡else
if (option index ≡ OUTPUT_FORMAT_INDEX) {if (¬strcasecmp (optarg , "eps")) {eps output = 1;
∗default output %= 2;}
else if (¬strcasecmp (optarg , "jpeg") ∨ ¬strcasecmp (optarg , "jpg")) {jpeg output = 1;
∗default output %= 2;}
else if (¬strcasecmp (optarg , "png")) {png output = 1;
∗default output %= 2;}
else if (¬strcasecmp (optarg , "pnm")) {pnm output = 1;
∗default output %= 2;}
else if (¬strcasecmp (optarg , "ps")) {ps output = 1;
∗default output %= 2;}
else {
pthread mutex lock (&stdio mutex );fprintf (stderr , "WARNING! Invalid ‘−output−format’ argument:%s\nIgnoring.\n", optarg );pthread mutex unlock (&stdio mutex );}}/∗ if (option index ≡ OUTPUT_FORMAT_INDEX) ∗/32.

portrait.

[LDF 2005.09.01.]
Log[LDF 2005.09.01.] Added this section.
h Process command line options 15 i +≡else
if (option index ≡ PORTRAIT_INDEX) {portrait or landscape = PORTRAIT;}/∗ if (option index ≡ PORTRAIT_INDEX) ∗/

22

QUIET

33.

quiet.

convepsh Process command line options 15 i +≡else if (option index ≡ QUIET_INDEX) {#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Will run quietly.\n");pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/VERBOSITY = QUIET; }34.

renumber. [LDF 2005.08.26.]
Log[LDF 2005.08.26.] Added this section.
[LDF 2005.10.30.] BUG FIX: Now decrementing renumber value .n
h Process command line options 15 i +≡else if (option index ≡ RENUMBER_INDEX) { sscanf (optarg , "%d", &renumber value );−− renumber value ;#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Renumbering starting with %d.\n", renumber value );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ if (option index ≡ RENUMBER_INDEX) ∗/35.

silent.

h Process command line options 15 i +≡else if (option index ≡ SILENT_INDEX) {#if DEBUG_COMPILE
if (DEBUG) {if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Will run silently.\n");pthread mutex unlock (&stdio mutex );}}#endif/∗ DEBUG_COMPILE ∗/VERBOSITY = SILENT; }

§33

§36

conveps

36.

start. [LDF 2005.08.19.]

SILENT

Log[LDF 2005.08.19.] Added this section.
h Process command line options 15 i +≡else if (option index ≡ START_INDEX) { sscanf (optarg , "%d", &start value );#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Setting start_value to %d.\n", start value );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ else if (option index ≡ START_INDEX) ∗/37.

Threads Limit. [LDF 2005.08.27.]
Log[LDF 2005.08.27.] Added this section.
h Process command line options 15 i +≡else if (option index ≡ THREADS_LIMIT_INDEX) { sscanf (optarg , "%d", &threads limit );#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Setting threads_limit to %d.\n", threads limit );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ else if (option index ≡ THREADS_LIMIT_INDEX) ∗/38.

transparent. [LDF 2005.08.22.]
Log[LDF 2005.08.22.] Added this section.
h Process command line options 15 i +≡else if (option index ≡ TRANSPARENT_INDEX) { sprintf (transparent string , "−transparent \"%s\"",optarg );#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Setting ‘transparent_string’ to %s.\n", transparent string );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ else if (option index ≡ TRANSPARENT_INDEX) ∗/

23

24

VERBOSE39.

verbose.

convepsh Process command line options 15 i +≡else if (option index ≡ VERBOSE_INDEX) {#if DEBUG_COMPILE
if (DEBUG) {if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Will run verbosely.\n");pthread mutex unlock (&stdio mutex );}}#endif/∗ DEBUG_COMPILE ∗/VERBOSITY = VERBOSE; }40. version.
h Process command line options 15 i +≡else
if (option index ≡ VERSION_INDEX) {pthread mutex lock (&stdio mutex );fprintf (stderr , "conveps 1.2.0\n");pthread mutex unlock (&stdio mutex );exit (0);}41.

Vertical Border. [LDF 2005.08.18.]
Log[LDF 2005.08.19.] Added this section.
h Process command line options 15 i +≡else if (option index ≡ VERTICAL_BORDER_INDEX) {if (optarg ) strcpy (vertical border string , optarg );else sprintf (vertical border string , "%d", DEFAULT_BORDER_VALUE);#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Setting vertical border_string to %s.\n", vertical border string );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ if (option index ≡ VERTICAL_BORDER_INDEX) ∗/

§39

§42

conveps42.

width. [LDF 2005.08.18.]

VERBOSELog[LDF 2005.08.18.] Added this section.
h Process command line options 15 i +≡else if (option index ≡ WIDTH_INDEX) { sscanf (optarg , "%d", &width value );#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Setting width to %d pixels.\n", width value );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ if (option index ≡ WIDTH_INDEX) ∗/43.

zeroes. [LDF 2005.08.22.]
Log[LDF 2005.08.22.] Added this section.
h Process command line options 15 i +≡else if (option index ≡ ZEROES_INDEX) { sscanf (optarg , "%d", &zeroes );#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Setting ‘zeroes’ to %d.\n", zeroes );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ if (option index ≡ ZEROES_INDEX) ∗/44. Invalid option index value.
h Process command line options 15 i +≡else {
pthread mutex lock (&stdio mutex );fprintf (stderr , "ERROR! In ‘main()’:\n‘option_index’ has invalid value: %d\\
nWill try to continue.\n", option index );pthread mutex unlock (&stdio mutex );}}/∗ if (option ctr ≡ 0) ∗/

25

26

AMBIGUOUS OPTION

45.

Ambiguous option.

h Process command line options 15 i +≡else
if (option ctr ≡ ’?’) {pthread mutex lock (&stdio mutex );cerr ≪ "ERROR! In ‘main()’: ‘getopt_long()’ returned " ≪"ambiguous match. Breaking." ≪ endl ;pthread mutex unlock (&stdio mutex );}46.

Invalid option.

h Process command line options 15 i +≡else {
pthread mutex lock (&stdio mutex );fprintf (stderr , "getopt_long() returned invalid option.\n");pthread mutex unlock (&stdio mutex );}47.

End of while loop.

h Process command line options 15 i +≡}/∗ while ∗/if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "In ‘main()’: End of command line processing.\n");pthread mutex unlock (&stdio mutex );}conveps§45

§48

conveps

48.

Process filenames.

PROCESS FILENAMES[LDF 2005.08.18.]
Log[LDF 2005.08.18.] Added this section.
h Process filenames 48 i ≡Unsigned Byte arg ctr = optind ;#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "arg_ctr == %d\nargc == %d\n", arg ctr , argc );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/if (argc − arg ctr < 1) {pthread mutex lock (&stdio mutex );fprintf (stderr , "ERROR! In ‘main()’: Not enough arguments.\nExiting ‘conve\
ps’ with return value 1.\n");pthread mutex unlock (&stdio mutex );return 1;}/∗ if ∗/
if (argc − arg ctr ≥ 1) strcpy (filename stem , argv [arg ctr ]);#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "filename_stem == %s\n", filename stem );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/++ arg ctr ;#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Before start value arg: arg_ctr == %d\n", arg ctr );fprintf (stderr , "Before start value arg: start_value == %d\n", start value );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/if (argc − arg ctr ≥ 1 ∧ start value 6= −1) {pthread mutex lock (&stdio mutex );fprintf (stderr , "WARNING: ‘start_value’ already set using an optional argum\
ent.\n‘start_value’ == %d. Not resetting to %s\n", start value , argv [arg ctr ]);pthread mutex unlock (&stdio mutex );}else if (argc − arg ctr ≥ 1 ∧ start value ≡ −1) sscanf (argv [arg ctr ], "%d", &start value );else if (start value ≡ −1) start value = 0;
#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "After start value arg: arg_ctr == %d\n", arg ctr );fprintf (stderr , "After start value arg: start_value == %d\n", start value );pthread mutex unlock (&stdio mutex );

27

28

PROCESS FILENAMES

conveps}#endif/∗ DEBUG_COMPILE ∗/++ arg ctr ;#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Before end value arg: arg_ctr == %d\n", arg ctr );fprintf (stderr , "Before end value arg: end_value == %d\n", end value );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/if (argc − arg ctr ≥ 1 ∧ end value 6= −1) {pthread mutex lock (&stdio mutex );fprintf (stderr , "WARNING: ‘end_value’ already set using an optional argumen\t.\n‘end_value’ == %d. Not resetting to %s\n", end value , argv [arg ctr ]);pthread mutex unlock (&stdio mutex );}See also section 49.
This code is used in section 54.

49.
Log[LDF 2005.09.02.] Now setting force switch = true .
********** *************
h Process filenames 48 i +≡else
if (argc − arg ctr ≥ 1 ∧ end value ≡ −1) {sscanf (argv [arg ctr ], "%d", &end value );force switch = true ;}else if (end value ≡ −1) end value = DEFAULT_END_VALUE;#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "After end value arg: arg_ctr == %d\n", arg ctr );fprintf (stderr , "After end value arg: end_value == %d\n", end value );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/++ arg ctr ;

§48

§50

conveps

50.

Main.

MAIN

29

[LDF 2005.04.21.]

h Main 50 i ≡int main (int argc , char ∗∗argv ){ VERBOSITY = NORMAL;
h Local variables for main ( ) 12 i
h Declarations for command line options 14 ipthread mutex init (&stdio mutex , 0);
strcpy (border string , "");
strcpy (horizontal border string , "");
strcpy (vertical border string , "");
sprintf (default border string , "%d", DEFAULT_BORDER_VALUE);
strcpy (border color string , "");
strcpy (default border color string , "white");strcpy (fill string , "");
strcpy (opaque string , "");
strcpy (transparent string , "");
strcpy (new filename stem , "");
See also sections 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, and 62.
This code is used in section 81.

51.
Log[LDF 2005.12.16.] Added this section. Now setting Unsigned Byte ∗default output according to thevalue of the environment variable "CONVEPS_DEFAULT_OUTPUT_FORMAT", if present and valid. Otherwise, it’s
set to point to Unsigned Byte png output .
[LDF 2005.12.17.] BUG FIX: Fixed the way I use the return value of getenv ( ).
h Main 50 i +≡char ∗default output env var ;default output env var = getenv ("CONVEPS_DEFAULT_OUTPUT_FORMAT");if (¬default output env var ∨ ¬strlen (default output env var )) default output = &png output ;else if (¬(strncasecmp (default output env var , "eps", 10))) default output = &eps output ;else if (¬(strncasecmp (default output env var , "jpeg", 10))) default output = &jpeg output ;else if (¬(strncasecmp (default output env var , "jpg", 10))) default output = &jpeg output ;else if (¬(strncasecmp (default output env var , "pnm", 10))) default output = &pnm output ;else if (¬(strncasecmp (default output env var , "png", 10))) default output = &png output ;else if (¬(strncasecmp (default output env var , "ps", 10))) default output = &ps output ;else {
pthread mutex lock (&stdio mutex );cerr ≪ "WARNING! In ‘main()’: The environment variable " ≪"‘CONVEPS_DEFAULT_OUTPUT_FORMAT’" ≪ endl ≪ "has invalid value: " ≪default output env var ≪ endl ≪ "Will use PNG format instead." ≪ endl ;cerr ≪ "Type <RETURN> to continue: ";getchar ( );pthread mutex unlock (&stdio mutex );default output = &png output ;}∗default output = 2;
default output env var = 0;
h Process command line options 15 i

30

MAIN

conveps§52

52.
h Main 50 i +≡if (VERBOSITY ≥ NORMAL) {cerr ≪ "conveps Version 1.2.0" ≪ endl ≪ "conveps is part of GNU 3DLDF Version 1.2.0" ≪endl ≪ "Copyright (C) 2009 The Free Software Foundation" ≪endl ≪ "Author: Laurence D. Finston" ≪ endl ≪"conveps and GNU 3DLDF come with ABSOLUTELY NO WARRANTY;" ≪ endl ≪"for details see the file COPYING," ≪ endl ≪ "which you should have received" ≪endl ≪ "in the distribution of GNU 3DLDF 1.2.0." ≪ endl ≪"This is Free Software, and you are welcome" ≪ endl ≪"to redistribute it under certain conditions;" ≪ endl ≪"for details, again, see the file COPYING." ≪ endl ≪ endl ≪"Please send bug reports to Laurence.Finston@gmx.de" ≪ endl ≪"Web site: http://www.gnu.org/software/3dldf/LDF.html" ≪ endl ≪ endl ;}/∗ if (VERBOSITY ≥ NORMAL) ∗/53.

Set tex file header.

[LDF 2005.09.01.]
Log[LDF 2005.09.01.] Added this section.
h Main 50 i +≡{/∗ Beginning of group. ∗/stringstream tex stringstream ;tex stringstream ≪ "\\batchmode\\input epsf" ≪ endl ≪ "\\def\\epsfsize#1#2{#1}" ≪ endl ≪"\\nopagenumbers" ≪ endl ≪ "\\parindent=0pt" ≪ endl ;#if 0/∗ 1 ∗/
if (portrait or landscape ≡ LANDSCAPE) tex stringstream ≪ "\\hsize=420mm" ≪ endl ≪"\\vsize=297mm" ≪ endl ≪ "\\special{papersize=420mm, 297mm}" ≪ endl ;else/∗ (portrait or landscape ≡ PORTRAIT) ∗/tex stringstream ≪ "\\hsize=297mm" ≪ endl ≪ "\\vsize=420mm" ≪ endl ;#endiftex stringstream ≪ "\\advance\\voffset by −1in" ≪ endl ≪ "\\advance\\hoffset by −1in" ≪endl ;
strcpy (tex file header , tex stringstream .str ( ).c str ( ));}/∗ End of group. ∗/§54conveps

SET TEX FILE HEADER

31

54.
h Main 50 i +≡if (¬(strlen (border string ) ≡ 0 ∧ strlen (horizontal border string ) ≡ 0 ∧ strlen (vertical border string ) ≡ 0)){
if (strlen (horizontal border string ) ≡ 0) strcpy (horizontal border string , border string );if (strlen (vertical border string ) ≡ 0) strcpy (vertical border string , border string );if (strlen (border color string ) ≡ 0) strcpy (border color string , default border color string );sprintf (border string , "−border %sx%s −bordercolor %s", horizontal border string ,vertical border string , border color string );}if (¬(eps output ∨ jpeg output ∨ png output ∨ pnm output ∨ ps output )) {pthread mutex lock (&stdio mutex );fprintf (stderr , "ERROR! Command line arguments suppress all output.\nExitin\g ‘conveps’ with return value 1.\n");pthread mutex unlock (&stdio mutex );return 1;}
h Process filenames 48 i
#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "‘filename_stem’: %s\n", filename stem );fprintf (stderr , "‘start_value’: %d\n", start value );fprintf (stderr , "‘end_value’: %d\n", end value );if (strlen (horizontal border string ))fprintf (stderr , "‘horizontal_border_string’: %s\n", horizontal border string );else fprintf (stderr , "‘horizontal_border_string’ is empty.\n");if (strlen (vertical border string ))fprintf (stderr , "‘vertical_border_string’: %s\n", vertical border string );else fprintf (stderr , "‘vertical_border_string’ is empty.\n");if (strlen (border string )) fprintf (stderr , "‘border_string’: %s\n", border string );else fprintf (stderr , "‘border_string’ is empty.\n");if (eps output ) fprintf (stderr , "Producing EPS output.\n");else fprintf (stderr , "Not producing EPS output.\n");if (jpeg output ) fprintf (stderr , "Producing JPEG output.\n");else fprintf (stderr , "Not producing JPEG output.\n");if (png output ) fprintf (stderr , "Producing PNG output.\n");else fprintf (stderr , "Not producing PNG output.\n");if (pnm output ) fprintf (stderr , "Producing PNM output.\n");else fprintf (stderr , "Not producing PNM output.\n");if (ps output ) fprintf (stderr , "Producing PS output.\n");else fprintf (stderr , "Not producing PS output.\n");pthread mutex unlock (&stdio mutex );}/∗ if (DEBUG) ∗/#endif/∗ DEBUG_COMPILE ∗/32

SET TEX FILE HEADER

55.

Write code for including EPS files to tex file . [LDF 2005.04.22.]

conveps§55

Log[LDF 2005.04.22.] BUG FIX: Now checking to see if temp file exists. If it doesn’t, break is called.
[LDF 2005.04.22.] Now running TEX and dvips on individual files. There were problems using the −i and−S options to dvips.
h Main 50 i +≡int i;
float width ;float height ;§56conveps56.

Set zeroes . [LDF 2005.08.22.] o

SET TEX FILE HEADER

Log[LDF 2005.08.22.] Added this section.
To Do
Find out how to use natural logarithms to find out how many places I need for zeroes.
h Main 50 i +≡if (zeroes ≡ 0) zeroes string [0] = ’\0’;else if ((end value + renumber value ) > 10000) {pthread mutex lock (&stdio mutex );fprintf (stderr , "ERROR! (‘end_value’ + ‘renumber_value’) == %d > 10,000.\nC\
an’t handle this case yet.\nExiting ‘conveps’ with return value 1.\n",end value + renumber value );pthread mutex unlock (&stdio mutex );return 1;}/∗ if (end value > 10000) ∗/else if ((end value + renumber value ) ≥ 1000 ∧ zeroes ≤ 4) {zeroes = 4;}
else if ((end value + renumber value ) ≥ 100 ∧ zeroes ≤ 3) {zeroes = 3;}
else if ((end value + renumber value ) ≥ 10 ∧ zeroes ≤ 2) {zeroes = 2;}
else if (zeroes < 0) {zeroes = DEFAULT_ZEROES;}#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "zeroes == " ≪ zeroes ≪ endl ;pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/{int i;for (i = 0; i < zeroes ; ++ i) zeroes string [i] = ’0’;
zeroes string [i] = ’\0’;}#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "zeroes_string == " ≪ zeroes string ≪ endl ;pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/

33

34

SET TEX FILE HEADER

conveps

§57

57.
Log
[LDF 2005.08.22.] Now continuing if i ≡ 0 and filename stem .0 doesn’t exist. [LDF 2005.08.22.]
h Main 50 i +≡#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "start_value == %d, end_value == %d, renumber_value == %d\n", start value ,end value , renumber value );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/int thread ctr = 0;char temp eps file name [MAX_FILENAME];
FILE ∗temp eps file ;58.
Log[LDF 2005.08.27.] Added code for limiting the number of threads that can be active at one time. Thisis controlled by the global variable unsigned short threads limit , whose default value is const unsigned
short DEFAULT_THREADS_LIMIT = 100. It can be reset by the command-line option −−threads−limit.
h Main 50 i +≡{/∗ Beginning of group. ∗/int i = start value ; for (int k = 0; ; ++ k) {if (i > end value ) break;for (i = start value + (k ∗ threads limit ); i < start value + (k ∗ threads limit ) + threads limit ; ++ i) {59.
h Main 50 i +≡if (i > end value ) break;sprintf (temp eps file name , "%s.%d", filename stem , i);if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "‘temp_eps_file_name’ == " ≪ "‘" ≪ temp eps file name ≪ "’." ≪ endl ;pthread mutex unlock (&stdio mutex );}temp eps file = fopen (temp eps file name , "r");§60

SET TEX FILE HEADER

conveps

60.
Log[LDF 2005.09.02.] Now continuing if force switch ≡ true .
h Main 50 i +≡if (temp eps file ≡ 0 ∧ (force switch ∨ i ≡ 0)) {#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ filename stem ≪ "." ≪ i ≪ "doesn’t exist.
pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/continue; }Continuing." ≪ endl ;

35

36

SET TEX FILE HEADER

conveps

§61

61.
Log
[LDF 2005.08.27.] BUG FIX: Now setting i = end value + 1 before breaking.
h Main 50 i +≡else
if (temp eps file ≡ 0) {pthread mutex lock (&stdio mutex );cerr ≪ filename stem ≪ "." ≪ i ≪ " doesn’t exist. " ≪"Won’t create any more threads." ≪ endl ;pthread mutex unlock (&stdio mutex );i = end value + 1;
break;}
else fclose (temp eps file );#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "About to create thread." ≪ endl ;pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/thread array [thread ctr ] = ( pthread t ∗ ) malloc (sizeof (pthread t ));thread func args [thread ctr ] = new Thread Func Arg Type;thread func args [thread ctr ]~ eps file number = i;thread func args [thread ctr ]~ thread ctr = thread ctr ;strcpy (thread func args [thread ctr ]~ zeroes string , zeroes string );#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "zeroes_string == " ≪ zeroes string ≪ endl ;cerr ≪ "thread_func_args[" ≪ thread ctr ≪ "]−>zeroes_string == " ≪thread func args [thread ctr ]~ zeroes string ≪ endl ;pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/do {status = pthread create (thread array [thread ctr ], 0, thread func, thread func args [thread ctr ]);if (status 6= 0) {pthread mutex lock (&stdio mutex );cerr ≪ "ERROR! In ‘main()’:\n" ≪ "‘pthread_create()’ failed, returning " ≪ status ≪"." ≪ endl ≪ "Going to sleep and will retry." ≪ endl ;pthread mutex unlock (&stdio mutex );sleep (1);}} while (status 6= 0);#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "After creating thread." ≪ endl ;pthread mutex unlock (&stdio mutex );§61

SET TEX FILE HEADER

conveps}#endif/∗ DEBUG_COMPILE ∗/++ thread ctr ; }/∗ First inner for. Create threads. ∗/for (int j = 0 + (k ∗ threads limit ); j < thread ctr ; ++ j) {pthread join (∗(thread array [j]), 0);
if (VERBOSITY ≥ VERBOSE) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Joined with thread %d.\n", j);pthread mutex unlock (&stdio mutex );}}/∗ Second inner for. Join threads. ∗/}/∗ Outer for ∗/}/∗ End of group. ∗/62. End of main ( ). Exit successfully with return value 0. [LDF 2005.04.22.]
h Main 50 i +≡if (VERBOSITY ≥ NORMAL) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Exiting ‘conveps’ successfully with return value 0.\n");pthread mutex unlock (&stdio mutex );}return 0; }/∗ End of main ( ) definition. ∗/63.
h Declare thread function 63 i ≡void ∗thread func (void ∗v);
This code is used in section 81.

64.
h Define thread function 64 i ≡void ∗thread func (void ∗v){ bool DEBUG = false ;char system string [MAX_SYSTEM_STRING];
char out filename stem [MAX_FILENAME];/∗ true ∗/if (strlen (new filename stem )) strcpy (out filename stem , new filename stem );
else strcpy (out filename stem , filename stem );int status ;Thread Func Arg Type ∗arg ptr = (Thread Func Arg Type ∗) v;
int i = arg ptr~ eps file number ;int thread ctr = arg ptr~ thread ctr ;See also sections 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 76, and 77.
This code is used in section 81.

37

38

SET TEX FILE HEADER

conveps

65.
Log
Added the variables int width pixels , int height pixels , float width cm , float height cm .
h Define thread function 64 i +≡FILE ∗tex file ;FILE ∗dvi file ;FILE ∗eps file ;FILE ∗ps file ;char temp file name [MAX_FILENAME];
char tex file name [MAX_FILENAME];
char dvi file name [MAX_FILENAME];
char ps file name [MAX_FILENAME];
char pnm file name [MAX_FILENAME];
char eps file name [MAX_FILENAME];
char log file name [MAX_FILENAME];
int width pixels = 0;
int height pixels = 0;
float width cm = 0;
float height cm = 0;66.
h Define thread function 64 i +≡#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Thread %d: Entering ‘thread_func()’.\n", thread ctr );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/

§65

§67

conveps67.

Set arg ptr~ zeroes string .

SET TEX FILE HEADER

39

Log[LDF 2005.08.22.] Added this section.
h Define thread function 64 i +≡int temp ctr = zeroes ;if ((i + renumber value ) < 10) temp ctr −= 1;
else if ((i + renumber value ) < 100) temp ctr −= 2;else if ((i + renumber value ) < 1000) temp ctr −= 3;
else temp ctr = 0;
#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "temp_ctr == " ≪ temp ctr ≪ endl ≪ "Before: arg_ptr−>zeroes_string == " ≪arg ptr~ zeroes string ≪ endl ;pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/arg ptr~ zeroes string [temp ctr ] = ’\0’;#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "After: arg_ptr−>zeroes_string == " ≪ arg ptr~ zeroes string ≪ endl ;pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": ‘arg_ptr−>zeroes_string’ == " ≪ arg ptr~ zeroes string ≪"." ≪ endl ;pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/40

SET TEX FILE HEADER

conveps

§68

68.
Log
[2009.01.14.] Changed the TEX code written to the output file. The argument −crop 0x0 to mogrify nolonger works. It wasn’t documented, so this program was apparently depending on unintended behavior of
the mogrify program. It did provide a simple way of cropping empty parts of an image surrounding thedesired parts.
h Define thread function 64 i +≡sprintf (eps file name , "%s.%d", filename stem , i);sprintf (tex file name , "%s_%s%d.tex", out filename stem , arg ptr~ zeroes string , (i + renumber value ));sprintf (dvi file name , "%s_%s%d.dvi", out filename stem , arg ptr~ zeroes string , (i + renumber value ));sprintf (log file name , "%s_%s%d.log", out filename stem , arg ptr~ zeroes string , (i + renumber value ));sprintf (ps file name , "%s_%s%d.ps", out filename stem , arg ptr~ zeroes string , (i + renumber value ));sprintf (pnm file name , "%s_%s%d.pnm", out filename stem , arg ptr~ zeroes string , (i + renumber value ));tex file = fopen (tex file name , "w");#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Thread %d: ‘eps_file_name’ == %s\n", thread ctr , eps file name );fprintf (stderr , "Thread %d: ‘tex_file_name’ == %s\n", thread ctr , tex file name );fprintf (stderr , "Thread %d: ‘dvi_file_name’ == %s\n", thread ctr , dvi file name );fprintf (stderr , "Thread %d: ‘log_file_name’ == %s\n", thread ctr , log file name );fprintf (stderr , "Thread %d: ‘ps_file_name’ == %s\n", thread ctr , ps file name );fprintf (stderr , "Thread %d: ‘pnm_file_name’ == %s\n", thread ctr , pnm file name );pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/§69

SET TEX FILE HEADER

conveps

41

69.
Log
[LDF 2009.11.02.] !! TODO: Change so that identify isn’t used for finding the size of the image. I’m
getting an error when TEX/ fonts are used. Put the image into a box instead and measure the box.
The problem can be avoided by setting prologues to 3 in the METAPOST file (possibly by means of
verbatim_metapost in the 3DLDF input file).x
h Define thread function 64 i +≡strcpy (system string , "identify ");strcat (system string , eps file name );FILE ∗fp = popen (system string , "r");/∗ This is the output of ‘identify 3DLDFmp.1’ when the image contains a square one square cm inarea: 3DLDFmp.1 PS 29x29 29x29+0+0 PseudoClass 256c 16-bit 906b LDF 2009.01.14. ∗/fscanf (fp , "%*s %*s %dx%d", &width pixels , &height pixels );pclose (fp );fp = 0;width cm = width pixels /29.0;
height cm = height pixels /29.0;
strcpy (system string , "");
fprintf (tex file ,"%s\n\\setbox0=\\vbox{\\hbox{\\epsffile{%s}\\hskip5pt}\\vskip5pt}\n\\vsize=\\ht0\\n\\hsize=\\wd0\n\\special{papersize=%.3fcm, %.3fcm}\n\n\\box0\n\\bye\n",tex file header , eps file name , width cm , height cm );fclose (tex file );sprintf (system string , "tex %s > /dev/null", tex file name );if (VERBOSITY ≥ VERBOSE) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Thread %d: Executing ‘%s’.\n", thread ctr , system string );pthread mutex unlock (&stdio mutex );}do {status = system (system string );if (status 6= 0) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": ERROR! In ‘thread_func’:\n" ≪"‘system()’ failed, returning " ≪ status ≪ "." ≪ endl ≪"Going to sleep and will retry." ≪ endl ;pthread mutex unlock (&stdio mutex );sleep (1);}} while (status 6= 0);
if (VERBOSITY ≥ VERBOSE) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": ‘" ≪ system string ≪ "’ returned " ≪ status ≪ "." ≪endl ;
pthread mutex unlock (&stdio mutex );}42

SET TEX FILE HEADER

conveps

§70

70.
Log
[LDF 2005.04.25.] Now calling remove ( ) rather than using “rm” in a call to system ( ).
[LDF 2005.08.31.] Now using “rm −f” in a call to system ( ) rather than calling remove ( ). Removed theloop that tried to remove the PostScript file, and went to sleep upon failure.
h Define thread function 64 i +≡sprintf (system string , "rm −f %s", ps file name );if (VERBOSITY ≥ VERBOSE) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": Executing ‘" ≪ system string ≪ "’." ≪ endl ;pthread mutex unlock (&stdio mutex );}status = system (system string );if (status 6= 0 ∧ VERBOSITY ≥ NORMAL) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": WARNING! In ‘thread_func’:\n" ≪"Failed to delete ‘" ≪ ps file name ≪ "’." ≪ " Continuing." ≪ endl ;pthread mutex unlock (&stdio mutex );}/∗ if (status 6= 0 ∧ VERBOSITY ≥ NORMAL) ∗/sprintf (system string , "dvips −q −o %s %s", ps file name , dvi file name );if (VERBOSITY ≥ VERBOSE) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Thread %d: Executing ‘%s’.\n", thread ctr , system string );pthread mutex unlock (&stdio mutex );}do {status = system (system string );if (status 6= 0) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": ERROR! In ‘thread_func’:\n" ≪"‘system()’ failed, returning " ≪ status ≪ "." ≪ endl ≪"Going to sleep and will retry." ≪ endl ;pthread mutex unlock (&stdio mutex );sleep (1);}} while (status 6= 0);#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": ‘" ≪ system string ≪ "’ returned " ≪ status ≪ "." ≪endl ;
pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/§71

SET TEX FILE HEADER

conveps

43

71.
Log
[LDF 2005.09.02.] Added this section.
[LDF 2005.09.02.] BUG FIX: Added +antialias option.
[2009.01.14.] Now using width pixels and height pixels in the argument to the −crop option. For somereason, I’m losing a pixel in each dimension. ?? Find out why.
h Define thread function 64 i +≡sprintf (system string , "mogrify +antialias −crop %dx%d %s", width pixels , height pixels , ps file name );if (VERBOSITY ≥ NORMAL) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": Executing ‘" ≪ system string ≪ "’." ≪ endl ;pthread mutex unlock (&stdio mutex );}status = system (system string );72.
Log[LDF 2005.09.01.] Added this section. BUG FIX: Now rotating the image in a separate call to mogrify.
Doing it in combination with other options had been working, but then I started getting incorrect results.
[LDF 2005.09.02.] BUG FIX: Added +antialias option.
[2009.01.14.] Commented-out this code.
h Define thread function 64 i +≡#if 0/∗ 1 ∗/
if (portrait or landscape ≡ LANDSCAPE) {sprintf (system string , "mogrify +antialias −rotate −90 %s", ps file name );if (VERBOSITY ≥ NORMAL) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": Executing ‘" ≪ system string ≪ "’." ≪ endl ;pthread mutex unlock (&stdio mutex );}status = system (system string );}/∗ if (portrait or landscape ≡ LANDSCAPE) ∗/#endifif (coerce value ≡ 0) strcpy (coerce string , "");
else if (coerce value ≡ 1) strcpy (coerce string , "−geometry 320x240!");else if (coerce value ≡ 2) strcpy (coerce string , "−geometry 640x480!");else {
pthread mutex lock (&stdio mutex );fprintf (stderr , "Thread %d: ERROR! In ‘main()’: Invalid value for ‘coerce\_value’: %d\nSetting ‘coerce_string’ to \"\" and continuing.\n", thread ctr ,coerce value );pthread mutex unlock (&stdio mutex );strcpy (coerce string , "");}

44

SET TEX FILE HEADER

conveps

§73

73.
Log
[LDF 2005.10.30.] BUG FIX: No longer including border color string in system string . It’s already included
in border string .
h Define thread function 64 i +≡if (strlen (coerce string ) ∨ strlen (opaque string ) ∨ strlen (border string ) ∨ strlen (negate string )) {sprintf (system string , "mogrify +antialias %s %s %s %s %s %s", border string , fill string ,opaque string , coerce string , negate string , ps file name );if (VERBOSITY ≥ NORMAL) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": Executing ‘" ≪ system string ≪ "’." ≪ endl ;pthread mutex unlock (&stdio mutex );}do {status = system (system string );if (status 6= 0) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": ERROR! In ‘thread_func’:\n" ≪"‘system()’ failed, returning " ≪ status ≪ "." ≪ endl ≪"Going to sleep and will retry." ≪ endl ;pthread mutex unlock (&stdio mutex );sleep (1);}} while (status 6= 0);#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": ‘" ≪ system string ≪ "’ returned " ≪ status ≪ "." ≪endl ;
pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/}/∗ if (strlen (coerce string ) ∨ strlen (opaque string ) ∨ strlen (border string )) ∗/§74

SET TEX FILE HEADER

conveps

45

74.
Log
[LDF 2005.04.25.] Now calling remove ( ) rather than using “rm” in calls to system ( ).
[LDF 2005.05.08.] Commented-out the code that converts the EPS files to PNG.
[LDF 2005.08.31.] Now using “rm −f” in calls to system ( ) instead of calling remove ( ). Removed the loops
that tried to remove the files and put the thread to sleep upon failure.
To Do
TO DO: Change the way the return value of system is checked elsewhere. I’ve fixed it here.
h Define thread function 64 i +≡if (eps output ) {strcpy (output extension , "eps");h Convert PS file 75 i}
if (jpeg output ) {strcpy (output extension , "jpg");h Convert PS file 75 i}
if (pnm output ) {strcpy (output extension , "pnm");h Convert PS file 75 i}
if (png output ) {strcpy (output extension , "png");h Convert PS file 75 i}
if (VERBOSITY ≥ VERBOSE) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Thread %d: Removing %s\n", thread ctr , tex file name );pthread mutex unlock (&stdio mutex );}sprintf (system string , "rm −f %s", tex file name );status = system (system string );if ((¬WIFEXITED(status ) ∨ WEXITSTATUS(status ) ∨ status ) ∧ VERBOSITY ≥ NORMAL) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": WARNING! In ‘thread_func()’:" ≪ endl ≪"Failed to delete ‘" ≪ tex file name ≪ "’. Continuing." ≪ endl ;pthread mutex unlock (&stdio mutex );}/∗ if (¬WIFEXITED(status ) ∨ WEXITSTATUS(status ) ∨ status ) ∗/if (VERBOSITY ≥ VERBOSE) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Thread %d: Removing %s\n", thread ctr , dvi file name );pthread mutex unlock (&stdio mutex );}sprintf (system string , "rm −f %s", dvi file name );status = system (system string );if (status 6= 0 ∧ VERBOSITY ≥ NORMAL) {pthread mutex lock (&stdio mutex );46

SET TEX FILE HEADER

cerr ≪ "Thread " ≪ thread ctr ≪ ": WARNING!
"Failed to delete ‘" ≪ dvi file name ≪ "’.
pthread mutex unlock (&stdio mutex );}/∗ if (status 6= 0 ∧ VERBOSITY ≥ NORMAL) ∗/conveps§74

In ‘thread_func’:" ≪ endl ≪Continuing." ≪ endl ;75.
h Convert PS file 75 i ≡sprintf (system string , "convert +antialias %s %s %s %s_%s%d.%s", transparent string , coerce string ,ps file name , out filename stem , arg ptr~ zeroes string , (i + renumber value ), output extension );if (VERBOSITY ≥ NORMAL) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Thread %d: Executing ‘%s’.\n", thread ctr , system string );pthread mutex unlock (&stdio mutex );}do {status = system (system string );if (status 6= 0) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": ERROR! In ‘thread_func’:\n" ≪"‘system()’ failed, returning " ≪ status ≪ "." ≪ endl ≪"Going to sleep and will retry." ≪ endl ;pthread mutex unlock (&stdio mutex );sleep (1);}} while (status 6= 0);#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": ‘" ≪ system string ≪ "’ returned " ≪ status ≪ "." ≪endl ;
pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/This code is used in section 74.

§76

conveps

SET TEX FILE HEADER

76.

PS file. Don’t delete if ps output 6= 0. [LDF 2005.08.19.]

47

Log[LDF 2005.08.31.] Removed the loops that tried to remove files and put the thread to sleep upon failure.
h Define thread function 64 i +≡if (¬ps output ) {if (VERBOSITY ≥ VERBOSE) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Thread %d: Removing %s\n", thread ctr , ps file name );pthread mutex unlock (&stdio mutex );}status = remove (ps file name );if (status 6= 0 ∧ VERBOSITY ≥ NORMAL) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": WARNING: Failed to remove " ≪ ps file name ≪". Continuing." ≪ endl ;pthread mutex unlock (&stdio mutex );}/∗ if (status 6= 0) ∗/}/∗ if (¬ps output ) ∗/#if DEBUG_COMPILEelse
if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": Not removing " ≪ ps file name ≪ "." ≪ endl ;pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/48

SET TEX FILE HEADER

conveps77.
h Define thread function 64 i +≡if (VERBOSITY ≥ VERBOSE) {pthread mutex lock (&stdio mutex );fprintf (stderr , "Thread %d: Removing %s\n", thread ctr , log file name );pthread mutex unlock (&stdio mutex );}status = remove (log file name );if (status 6= 0 ∧ VERBOSITY ≥ NORMAL) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": WARNING: Failed to remove " ≪ log file name ≪". Continuing." ≪ endl ;pthread mutex unlock (&stdio mutex );}#if DEBUG_COMPILE
if (DEBUG) {pthread mutex lock (&stdio mutex );cerr ≪ "Thread " ≪ thread ctr ≪ ": Exiting ‘thread_func()’ successfully\
with return value 0." ≪ endl ;pthread mutex unlock (&stdio mutex );}#endif/∗ DEBUG_COMPILE ∗/delete arg ptr ;arg ptr = 0;
return 0; }/∗ End of thread func ( ) definition. ∗/

§77

§78

conveps

GNU FREE DOCUMENTATION LICENSE

49

78. GNU Free Documentation License. The GNU Free Documentation License, which follows,
applies to this document.
GNU Free Documentation License Version 1.3, 3 November 2008
Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc. ¡http://fsf.org/¿ Everyone ispermitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
0. PREAMBLE
The purpose of this License is to make a manual, textbook, or other functional and useful document ”free”
in the sense of freedom: to assure everyone the effective freedom to copy and redistribute it, with or without
modifying it, either commercially or noncommercially. Secondarily, this License preserves for the author andpublisher a way to get credit for their work, while not being considered responsible for modifications madeby others.
This License is a kind of ”copyleft”, which means that derivative works of the document must themselvesbe free in the same sense. It complements the GNU General Public License, which is a copyleft licensedesigned for free software.
We have designed this License in order to use it for manuals for free software, because free software needs
free documentation: a free program should come with manuals providing the same freedoms that the software
does. But this License is not limited to software manuals; it can be used for any textual work, regardlessof subject matter or whether it is published as a printed book. We recommend this License principally forworks whose purpose is instruction or reference.
1. APPLICABILITY AND DEFINITIONSThis License applies to any manual or other work, in any medium, that contains a notice placed by the
copyright holder saying it can be distributed under the terms of this License. Such a notice grants a worldwide, royalty-free license, unlimited in duration, to use that work under the conditions stated herein. The”Document”, below, refers to any such manual or work. Any member of the public is a licensee, and isaddressed as ”you”. You accept the license if you copy, modify or distribute the work in a way requiring
permission under copyright law.
A ”Modified Version” of the Document means any work containing the Document or a portion of it, either
copied verbatim, or with modifications and/or translated into another language.
A ”Secondary Section” is a named appendix or a front-matter section of the Document that deals
exclusively with the relationship of the publishers or authors of the Document to the Document’s overall
subject (or to related matters) and contains nothing that could fall directly within that overall subject.
(Thus, if the Document is in part a textbook of mathematics, a Secondary Section may not explain any
mathematics.) The relationship could be a matter of historical connection with the subject or with related
matters, or of legal, commercial, philosophical, ethical or political position regarding them.
The ”Invariant Sections” are certain Secondary Sections whose titles are designated, as being those ofInvariant Sections, in the notice that says that the Document is released under this License. If a section does
not fit the above definition of Secondary then it is not allowed to be designated as Invariant. The Document
may contain zero Invariant Sections. If the Document does not identify any Invariant Sections then there
are none.
The ”Cover Texts” are certain short passages of text that are listed, as Front-Cover Texts or Back-CoverTexts, in the notice that says that the Document is released under this License. A Front-Cover Text may beat most 5 words, and a Back-Cover Text may be at most 25 words.
A ”Transparent” copy of the Document means a machine-readable copy, represented in a format whose
specification is available to the general public, that is suitable for revising the document straightforwardly
with generic text editors or (for images composed of pixels) generic paint programs or (for drawings) somewidely available drawing editor, and that is suitable for input to text formatters or for automatic translation
to a variety of formats suitable for input to text formatters. A copy made in an otherwise Transparent
file format whose markup, or absence of markup, has been arranged to thwart or discourage subsequent
modification by readers is not Transparent. An image format is not Transparent if used for any substantial
amount of text. A copy that is not ”Transparent” is called ”Opaque”.
Examples of suitable formats for Transparent copies include plain ASCII without markup, Texinfo input
format, LaTeX input format, SGML or XML using a publicly available DTD, and standard-conforming

50

GNU FREE DOCUMENTATION LICENSE

conveps§78

simple HTML, PostScript or PDF designed for human modification. Examples of transparent image formats
include PNG, XCF and JPG. Opaque formats include proprietary formats that can be read and edited
only by proprietary word processors, SGML or XML for which the DTD and/or processing tools are notgenerally available, and the machine-generated HTML, PostScript or PDF produced by some word processors
for output purposes only.
The ”Title Page” means, for a printed book, the title page itself, plus such following pages as are needed
to hold, legibly, the material this License requires to appear in the title page. For works in formats which
do not have any title page as such, ”Title Page” means the text near the most prominent appearance of thework’s title, preceding the beginning of the body of the text.
The ”publisher” means any person or entity that distributes copies of the Document to the public.
A section ”Entitled XYZ” means a named subunit of the Document whose title either is precisely XYZ orcontains XYZ in parentheses following text that translates XYZ in another language. (Here XYZ stands fora specific section name mentioned below, such as ”Acknowledgements”, ”Dedications”, ”Endorsements”, or”History”.) To ”Preserve the Title” of such a section when you modify the Document means that it remains
a section ”Entitled XYZ” according to this definition.
The Document may include Warranty Disclaimers next to the notice which states that this License applies
to the Document. These Warranty Disclaimers are considered to be included by reference in this License,
but only as regards disclaiming warranties: any other implication that these Warranty Disclaimers may haveis void and has no effect on the meaning of this License.
2. VERBATIM COPYING
You may copy and distribute the Document in any medium, either commercially or noncommercially,
provided that this License, the copyright notices, and the license notice saying this License applies to theDocument are reproduced in all copies, and that you add no other conditions whatsoever to those of thisLicense. You may not use technical measures to obstruct or control the reading or further copying of thecopies you make or distribute. However, you may accept compensation in exchange for copies. If you
distribute a large enough number of copies you must also follow the conditions in section 3.
You may also lend copies, under the same conditions stated above, and you may publicly display copies.
3. COPYING IN QUANTITY
If you publish printed copies (or copies in media that commonly have printed covers) of the Document,
numbering more than 100, and the Document’s license notice requires Cover Texts, you must enclose thecopies in covers that carry, clearly and legibly, all these Cover Texts: Front-Cover Texts on the front cover,and Back-Cover Texts on the back cover. Both covers must also clearly and legibly identify you as the
publisher of these copies. The front cover must present the full title with all words of the title equallyprominent and visible. You may add other material on the covers in addition. Copying with changes limited
to the covers, as long as they preserve the title of the Document and satisfy these conditions, can be treatedas verbatim copying in other respects.
If the required texts for either cover are too voluminous to fit legibly, you should put the first ones listed(as many as fit reasonably) on the actual cover, and continue the rest onto adjacent pages.
If you publish or distribute Opaque copies of the Document numbering more than 100, you must either
include a machine-readable Transparent copy along with each Opaque copy, or state in or with each Opaque
copy a computer-network location from which the general network-using public has access to download using
public-standard network protocols a complete Transparent copy of the Document, free of added material. If
you use the latter option, you must take reasonably prudent steps, when you begin distribution of Opaquecopies in quantity, to ensure that this Transparent copy will remain thus accessible at the stated location
until at least one year after the last time you distribute an Opaque copy (directly or through your agents orretailers) of that edition to the public.
It is requested, but not required, that you contact the authors of the Document well before redistributing
any large number of copies, to give them a chance to provide you with an updated version of the Document.
4. MODIFICATIONS
You may copy and distribute a Modified Version of the Document under the conditions of sections 2 and3 above, provided that you release the Modified Version under precisely this License, with the Modified§78

conveps

GNU FREE DOCUMENTATION LICENSE

51

Version filling the role of the Document, thus licensing distribution and modification of the Modified Version
to whoever possesses a copy of it. In addition, you must do these things in the Modified Version:
A. Use in the Title Page (and on the covers, if any) a title distinct from that of the Document, and fromthose of previous versions (which should, if there were any, be listed in the History section of the Document).
You may use the same title as a previous version if the original publisher of that version gives permission.
B. List on the Title Page, as authors, one or more persons or entities responsible for authorship of themodifications in the Modified Version, together with at least five of the principal authors of the Document(all of its principal authors, if it has fewer than five), unless they release you from this requirement. C. Stateon the Title page the name of the publisher of the Modified Version, as the publisher. D. Preserve all the
copyright notices of the Document. E. Add an appropriate copyright notice for your modifications adjacentto the other copyright notices. F. Include, immediately after the copyright notices, a license notice giving
the public permission to use the Modified Version under the terms of this License, in the form shown in the
Addendum below. G. Preserve in that license notice the full lists of Invariant Sections and required CoverTexts given in the Document’s license notice. H. Include an unaltered copy of this License. I. Preserve thesection Entitled ”History”, Preserve its Title, and add to it an item stating at least the title, year, newauthors, and publisher of the Modified Version as given on the Title Page. If there is no section Entitled”History” in the Document, create one stating the title, year, authors, and publisher of the Document asgiven on its Title Page, then add an item describing the Modified Version as stated in the previous sentence.
J. Preserve the network location, if any, given in the Document for public access to a Transparent copyof the Document, and likewise the network locations given in the Document for previous versions it was
based on. These may be placed in the ”History” section. You may omit a network location for a workthat was published at least four years before the Document itself, or if the original publisher of the version
it refers to gives permission. K. For any section Entitled ”Acknowledgements” or ”Dedications”, Preserve
the Title of the section, and preserve in the section all the substance and tone of each of the contributor
acknowledgements and/or dedications given therein. L. Preserve all the Invariant Sections of the Document,
unaltered in their text and in their titles. Section numbers or the equivalent are not considered part of thesection titles. M. Delete any section Entitled ”Endorsements”. Such a section may not be included in the
Modified Version. N. Do not retitle any existing section to be Entitled ”Endorsements” or to conflict in title
with any Invariant Section. O. Preserve any Warranty Disclaimers.
If the Modified Version includes new front-matter sections or appendices that qualify as Secondary Sections
and contain no material copied from the Document, you may at your option designate some or all of these
sections as invariant. To do this, add their titles to the list of Invariant Sections in the Modified Version’s
license notice. These titles must be distinct from any other section titles.
You may add a section Entitled ”Endorsements”, provided it contains nothing but endorsements of your
Modified Version by various parties–for example, statements of peer review or that the text has been approvedby an organization as the authoritative definition of a standard.
You may add a passage of up to five words as a Front-Cover Text, and a passage of up to 25 words asa Back-Cover Text, to the end of the list of Cover Texts in the Modified Version. Only one passage ofFront-Cover Text and one of Back-Cover Text may be added by (or through arrangements made by) any
one entity. If the Document already includes a cover text for the same cover, previously added by you or byarrangement made by the same entity you are acting on behalf of, you may not add another; but you may
replace the old one, on explicit permission from the previous publisher that added the old one.
The author(s) and publisher(s) of the Document do not by this License give permission to use their names
for publicity for or to assert or imply endorsement of any Modified Version.
5. COMBINING DOCUMENTS
You may combine the Document with other documents released under this License, under the terms
defined in section 4 above for modified versions, provided that you include in the combination all of theInvariant Sections of all of the original documents, unmodified, and list them all as Invariant Sections ofyour combined work in its license notice, and that you preserve all their Warranty Disclaimers.
The combined work need only contain one copy of this License, and multiple identical Invariant Sections
may be replaced with a single copy. If there are multiple Invariant Sections with the same name but different
contents, make the title of each such section unique by adding at the end of it, in parentheses, the name of

52

GNU FREE DOCUMENTATION LICENSE

conveps§78

the original author or publisher of that section if known, or else a unique number. Make the same adjustment
to the section titles in the list of Invariant Sections in the license notice of the combined work.
In the combination, you must combine any sections Entitled ”History” in the various original documents,
forming one section Entitled ”History”; likewise combine any sections Entitled ”Acknowledgements”, andany sections Entitled ”Dedications”. You must delete all sections Entitled ”Endorsements”.
6. COLLECTIONS OF DOCUMENTS
You may make a collection consisting of the Document and other documents released under this License,
and replace the individual copies of this License in the various documents with a single copy that is includedin the collection, provided that you follow the rules of this License for verbatim copying of each of the
documents in all other respects.
You may extract a single document from such a collection, and distribute it individually under this License,
provided you insert a copy of this License into the extracted document, and follow this License in all otherrespects regarding verbatim copying of that document.
7. AGGREGATION WITH INDEPENDENT WORKS
A compilation of the Document or its derivatives with other separate and independent documents or works,
in or on a volume of a storage or distribution medium, is called an ”aggregate” if the copyright resulting fromthe compilation is not used to limit the legal rights of the compilation’s users beyond what the individual
works permit. When the Document is included in an aggregate, this License does not apply to the otherworks in the aggregate which are not themselves derivative works of the Document.
If the Cover Text requirement of section 3 is applicable to these copies of the Document, then if theDocument is less than one half of the entire aggregate, the Document’s Cover Texts may be placed on covers
that bracket the Document within the aggregate, or the electronic equivalent of covers if the Document isin electronic form. Otherwise they must appear on printed covers that bracket the whole aggregate.
8. TRANSLATION
Translation is considered a kind of modification, so you may distribute translations of the Document
under the terms of section 4. Replacing Invariant Sections with translations requires special permission fromtheir copyright holders, but you may include translations of some or all Invariant Sections in addition to theoriginal versions of these Invariant Sections. You may include a translation of this License, and all the license
notices in the Document, and any Warranty Disclaimers, provided that you also include the original English
version of this License and the original versions of those notices and disclaimers. In case of a disagreement
between the translation and the original version of this License or a notice or disclaimer, the original version
will prevail.
If a section in the Document is Entitled ”Acknowledgements”, ”Dedications”, or ”History”, the requirement (section 4) to Preserve its Title (section 1) will typically require changing the actual title.
9. TERMINATION
You may not copy, modify, sublicense, or distribute the Document except as expressly provided under thisLicense. Any attempt otherwise to copy, modify, sublicense, or distribute it is void, and will automaticallyterminate your rights under this License.
However, if you cease all violation of this License, then your license from a particular copyright holder
is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates yourlicense, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonablemeans prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder
notifies you of the violation by some reasonable means, this is the first time you have received notice of
violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30
days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received
copies or rights from you under this License. If your rights have been terminated and not permanently
reinstated, receipt of a copy of some or all of the same material does not give you any rights to use it.
10. FUTURE REVISIONS OF THIS LICENSE

§78

conveps

GNU FREE DOCUMENTATION LICENSE

53

The Free Software Foundation may publish new, revised versions of the GNU Free Documentation Licensefrom time to time. Such new versions will be similar in spirit to the present version, but may differ in detailto address new problems or concerns. See http://www.gnu.org/copyleft/.
Each version of the License is given a distinguishing version number. If the Document specifies that a
particular numbered version of this License ”or any later version” applies to it, you have the option offollowing the terms and conditions either of that specified version or of any later version that has been
published (not as a draft) by the Free Software Foundation. If the Document does not specify a version
number of this License, you may choose any version ever published (not as a draft) by the Free Software
Foundation. If the Document specifies that a proxy can decide which future versions of this License can beused, that proxy’s public statement of acceptance of a version permanently authorizes you to choose thatversion for the Document.
11. RELICENSING”Massive Multiauthor Collaboration Site” (or ”MMC Site”) means any World Wide Web server thatpublishes copyrightable works and also provides prominent facilities for anybody to edit those works. A
public wiki that anybody can edit is an example of such a server. A ”Massive Multiauthor Collaboration”(or ”MMC”) contained in the site means any set of copyrightable works thus published on the MMC site.
”CC-BY-SA” means the Creative Commons Attribution-Share Alike 3.0 license published by Creative
Commons Corporation, a not-for-profit corporation with a principal place of business in San Francisco,California, as well as future copyleft versions of that license published by that same organization.
”Incorporate” means to publish or republish a Document, in whole or in part, as part of another Document.
An MMC is ”eligible for relicensing” if it is licensed under this License, and if all works that were firstpublished under this License somewhere other than this MMC, and subsequently incorporated in whole orin part into the MMC, (1) had no cover texts or invariant sections, and (2) were thus incorporated prior to
November 1, 2008.
The operator of an MMC Site may republish an MMC contained in the site under CC-BY-SA on the samesite at any time before August 1, 2009, provided the MMC is eligible for relicensing.
ADDENDUM: How to use this License for your documents
To use this License in a document you have written, include a copy of the License in the document andput the following copyright and license notices just after the title page:
Copyright (c) YEAR YOUR NAME. Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by theFree Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
copy of the license is included in the section entitled ”GNU Free Documentation License”.
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts, replace the ”with...Texts.” linewith this:with the Invariant Sections being LIST THEIR TITLES, with the Front-Cover Texts being LIST, andwith the Back-Cover Texts being LIST.
If you have Invariant Sections without Cover Texts, or some other combination of the three, merge those
two alternatives to suit the situation.
If your document contains nontrivial examples of program code, we recommend releasing these examples
in parallel under your choice of free software license, such as the GNU General Public License, to permit
their use in free software.
h GNU Free Documentation License 78 i ≡/∗ This section contains no C ++ code. ∗/This code is cited in section 2.
This code is used in section 81.

54

GNU GENERAL PUBLIC LICENSE

conveps§79

79. GNU General Public License. The GNU General Public License, which follows, applies to theprogram 3DLDF described in this document.
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright c 2007 Free Software Foundation, Inc. hhttp://fsf.org/i
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is
not allowed.
Preamble
The GNU General Public License is a free, copyleft license for software and other kinds of works.
The licenses for most software and other practical works are designed to take away your freedom to shareand change the works. By contrast, the GNU General Public License is intended to guarantee your freedom
to share and change all versions of a program–to make sure it remains free software for all its users. We, theFree Software Foundation, use the GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses aredesigned to make sure that you have the freedom to distribute copies of free software (and charge for them
if you wish), that you receive source code or can get it if you want it, that you can change the software oruse pieces of it in new free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender
the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you
modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to
the recipients the same freedoms that you received. You must make sure that they, too, receive or can get
the source code. And you must show them these terms so they know their rights.
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software,and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
For the developers’ and authors’ protection, the GPL clearly explains that there is no warranty for thisfree software. For both users’ and authors’ sake, the GPL requires that modified versions be marked aschanged, so that their problems will not be attributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run modified versions of the software insidethem, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting
users’ freedom to change the software. The systematic pattern of such abuse occurs in the area of products
for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed thisversion of the GPL to prohibit the practice for those products. If such problems arise substantially in otherdomains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed
to protect the freedom of users.
Finally, every program is threatened constantly by software patents. States should not allow patents torestrict development and use of software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could make it effectively proprietary. To
prevent this, the GPL assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS
0. Definitions.
“This License” refers to version 3 of the GNU General Public License.

§79

conveps

GNU GENERAL PUBLIC LICENSE

55“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor
masks.
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed
as “you”. “Licensees” and “recipients” may be individuals or organizations.
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright
permission, other than the making of an exact copy. The resulting work is called a “modified version” of theearlier work or a work “based on” the earlier work.
A “covered work” means either the unmodified Program or a work based on the Program.
To “propagate” a work means to do anything with it that, without permission, would make you directlyor secondarily liable for infringement under applicable copyright law, except executing it on a computer ormodifying a private copy. Propagation includes copying, distribution (with or without modification), making
available to the public, and in some countries other activities as well.
To “convey” a work means any kind of propagation that enables other parties to make or receive copies.
Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the userthat there is no warranty for the work (except to the extent that warranties are provided), that licensees
may convey the work under this License, and how to view a copy of this License. If the interface presents alist of user commands or options, such as a menu, a prominent item in the list meets this criterion.
1. Source Code.
The “source code” for a work means the preferred form of the work for making modifications to it. “Objectcode” means any non-source form of a work.
A “Standard Interface” means an interface that either is an official standard defined by a recognized
standards body, or, in the case of interfaces specified for a particular programming language, one that is
widely used among developers working in that language.
The “System Libraries” of an executable work include anything, other than the work as a whole, that(a) is included in the normal form of packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that Major Component, or to implement aStandard Interface for which an implementation is available to the public in source code form. A “Major
Component”, in this context, means a major essential component (kernel, window system, and so on) of
the specific operating system (if any) on which the executable work runs, or a compiler used to produce thework, or an object code interpreter used to run it.
The “Corresponding Source” for a work in object code form means all the source code needed to generate,install, and (for an executable work) run the object code and to modify the work, including scripts tocontrol those activities. However, it does not include the work’s System Libraries, or general-purpose tools
or generally available free programs which are used unmodified in performing those activities but which are
not part of the work. For example, Corresponding Source includes interface definition files associated withsource files for the work, and the source code for shared libraries and dynamically linked subprograms thatthe work is specifically designed to require, such as by intimate data communication or control flow between
those subprograms and other parts of the work.
The Corresponding Source need not include anything that users can regenerate automatically from otherparts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions.

56

GNU GENERAL PUBLIC LICENSE

conveps§79

All rights granted under this License are granted for the term of copyright on the Program, and are
irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission
to run the unmodified Program. The output from running a covered work is covered by this License only if
the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use
or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey, without conditions so long as
your license otherwise remains in force. You may convey covered works to others for the sole purpose of
having them make modifications exclusively for you, or provide you with facilities for running those works,
provided that you comply with the terms of this License in conveying all material for which you do not control
copyright. Those thus making or running the covered works for you must do so exclusively on your behalf,
under your direction and control, on terms that prohibit them from making any copies of your copyrighted
material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
3. Protecting Users’ Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure under any applicable law
fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similarlaws prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention of technologicalmeasures to the extent such circumvention is effected by exercising rights under this License with respect
to the covered work, and you disclaim any intention to limit operation or modification of the work as ameans of enforcing, against the work’s users, your or third parties’ legal rights to forbid circumvention oftechnological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program’s source code as you receive it, in any medium, provided
that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact
all notices stating that this License and any non-permissive terms added in accord with section 7 apply tothe code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this Licensealong with the Program.
You may charge any price or no price for each copy that you convey, and you may offer support or warranty
protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce it from the Program, inthe form of source code under the terms of section 4, provided that you also meet all of these conditions:a) The work must carry prominent notices stating that you modified it, and giving a relevantdate.
b) The work must carry prominent notices stating that it is released under this License andany conditions added under section 7. This requirement modifies the requirement in section 4
to “keep intact all notices”.
c) You must license the entire work, as a whole, under this License to anyone who comes
into possession of a copy. This License will therefore apply, along with any applicable section
7 additional terms, to the whole of the work, and all its parts, regardless of how they arepackaged. This License gives no permission to license the work in any other way, but it does
not invalidate such permission if you have separately received it.

§79conveps

GNU GENERAL PUBLIC LICENSE

57d) If the work has interactive user interfaces, each must display Appropriate Legal Notices;
however, if the Program has interactive interfaces that do not display Appropriate Legal Notices,
your work need not make them do so.
A compilation of a covered work with other separate and independent works, which are not by their natureextensions of the covered work, and which are not combined with it such as to form a larger program, inor on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its
resulting copyright are not used to limit the access or legal rights of the compilation’s users beyond what theindividual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply
to the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of sections 4 and 5, provided thatyou also convey the machine-readable Corresponding Source under the terms of this License, in one of theseways:a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product model, to give anyone who
possesses the object code either (1) a copy of the Corresponding Source for all the software in
the product that is covered by this License, on a durable physical medium customarily used forsoftware interchange, for a price no more than your reasonable cost of physically performing
this conveying of source, or (2) access to copy the Corresponding Source from a network serverat no charge.
c) Convey individual copies of the object code with a copy of the written offer to provide theCorresponding Source. This alternative is allowed only occasionally and noncommercially, andonly if you received the object code with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis or for a charge),
and offer equivalent access to the Corresponding Source in the same way through the same placeat no further charge. You need not require recipients to copy the Corresponding Source alongwith the object code. If the place to copy the object code is a network server, the Corresponding
Source may be on a different server (operated by you or a third party) that supports equivalentcopying facilities, provided you maintain clear directions next to the object code saying where tofind the Corresponding Source. Regardless of what server hosts the Corresponding Source, youremain obligated to ensure that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform other peers
where the object code and Corresponding Source of the work are being offered to the generalpublic at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded from the Corresponding Source asa System Library, need not be included in conveying the object code work.
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which isnormally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolvedin favor of coverage. For a particular product received by a particular user, “normally used” refers to atypical or common use of that class of product, regardless of the status of the particular user or of the way
in which the particular user actually uses, or expects or is expected to use, the product. A product is a

58

GNU GENERAL PUBLIC LICENSE

conveps§79

consumer product regardless of whether the product has substantial commercial, industrial or non-consumer
uses, unless such uses represent the only significant mode of use of the product.
“Installation Information” for a User Product means any methods, procedures, authorization keys, or otherinformation required to install and execute modified versions of a covered work in that User Product froma modified version of its Corresponding Source. The information must suffice to ensure that the continued
functioning of the modified object code is in no case prevented or interfered with solely because modification
has been made.
If you convey an object code work under this section in, or with, or specifically for use in, a User
Product, and the conveying occurs as part of a transaction in which the right of possession and use of
the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how thetransaction is characterized), the Corresponding Source conveyed under this section must be accompaniedby the Installation Information. But this requirement does not apply if neither you nor any third party
retains the ability to install modified object code on the User Product (for example, the work has been
installed in ROM).
The requirement to provide Installation Information does not include a requirement to continue to provide
support service, warranty, or updates for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a network may be denied when themodification itself materially and adversely affects the operation of the network or violates the rules andprotocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided, in accord with this section must
be in a format that is publicly documented (and with an implementation available to the public in sourcecode form), and must require no special password or key for unpacking, reading or copying.
7. Additional Terms.
“Additional permissions” are terms that supplement the terms of this License by making exceptions fromone or more of its conditions. Additional permissions that are applicable to the entire Program shall betreated as though they were included in this License, to the extent that they are valid under applicablelaw. If additional permissions apply only to part of the Program, that part may be used separately underthose permissions, but the entire Program remains governed by this License without regard to the additional
permissions.
When you convey a copy of a covered work, you may at your option remove any additional permissions
from that copy, or from any part of it. (Additional permissions may be written to require their own removal
in certain cases when you modify the work.) You may place additional permissions on material, added by
you to a covered work, for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you add to a covered work, you may (ifauthorized by the copyright holders of that material) supplement the terms of this License with terms:a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of
this License; orb) Requiring preservation of specified reasonable legal notices or author attributions in thatmaterial or in the Appropriate Legal Notices displayed by works containing it; orc) Prohibiting misrepresentation of the origin of that material, or requiring that modified
versions of such material be marked in reasonable ways as different from the original version;ord) Limiting the use for publicity purposes of names of licensors or authors of the material; ore) Declining to grant rights under trademark law for use of some trade names, trademarks, orservice marks; or§79

conveps

GNU GENERAL PUBLIC LICENSE

59f) Requiring indemnification of licensors and authors of that material by anyone who conveys thematerial (or modified versions of it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered “further restrictions” within the meaning ofsection 10. If the Program as you received it, or any part of it, contains a notice stating that it is governedby this License along with a term that is a further restriction, you may remove that term. If a license
document contains a further restriction but permits relicensing or conveying under this License, you may
add to a covered work material governed by the terms of that license document, provided that the further
restriction does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must place, in the relevant source
files, a statement of the additional terms that apply to those files, or a notice indicating where to find theapplicable terms.
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license,or stated as exceptions; the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly provided under this License. Any
attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under thisLicense (including any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from a particular copyright holder
is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates yourlicense, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonablemeans prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder
notifies you of the violation by some reasonable means, this is the first time you have received notice of
violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30
days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received
copies or rights from you under this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary
propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive
a copy likewise does not require acceptance. However, nothing other than this License grants you permission
to propagate or modify any covered work. These actions infringe copyright if you do not accept this License.
Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to doso.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives a license from the original
licensors, to run, modify and propagate that work, subject to this License. You are not responsible for
enforcing compliance by third parties with this License.
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets ofone, or subdividing an organization, or merging organizations. If propagation of a covered work results froman entity transaction, each party to that transaction who receives a copy of the work also receives whatever
licenses to the work the party’s predecessor in interest had or could give under the previous paragraph,plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if thepredecessor has it or can get it with reasonable efforts.

60

GNU GENERAL PUBLIC LICENSE

conveps§79

You may not impose any further restrictions on the exercise of the rights granted or affirmed under thisLicense. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted
under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit)alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing theProgram or any portion of it.
11. Patents.
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on
which the Program is based. The work thus licensed is called the contributor’s “contributor version”.
A contributor’s “essential patent claims” are all patent claims owned or controlled by the contributor,
whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by thisLicense, of making, using, or selling its contributor version, but do not include claims that would be infringed
only as a consequence of further modification of the contributor version. For purposes of this definition,“control” includes the right to grant patent sublicenses in a manner consistent with the requirements of thisLicense.
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor’s
essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate
the contents of its contributor version.
In the following three paragraphs, a “patent license” is any express agreement or commitment, however
denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not tosue for patent infringement). To “grant” such a patent license to a party means to make such an agreement
or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of thework is not available for anyone to copy, free of charge and under the terms of this License, through a publicly
available network server or other readily accessible means, then you must either (1) cause the Corresponding
Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for thisparticular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend thepatent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but
for the patent license, your conveying the covered work in a country, or your recipient’s use of the covered
work in a country, would infringe one or more identifiable patents in that country that you have reason tobelieve are valid.
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate byprocuring conveyance of, a covered work, and grant a patent license to some of the parties receiving thecovered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, thenthe patent license you grant is automatically extended to all recipients of the covered work and works basedon it.
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits theexercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted
under this License. You may not convey a covered work if you are a party to an arrangement with a third
party that is in the business of distributing software, under which you make payment to the third party
based on the extent of your activity of conveying the work, and under which the third party grants, to any ofthe parties who would receive the covered work from you, a discriminatory patent license (a) in connection
with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for
and in connection with specific products or compilations that contain the covered work, unless you enteredinto that arrangement, or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses
to infringement that may otherwise be available to you under applicable patent law.
12. No Surrender of Others’ Freedom.

§79

conveps

GNU GENERAL PUBLIC LICENSE

61

If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict theconditions of this License, they do not excuse you from the conditions of this License. If you cannot convey
a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent
obligations, then as a consequence you may not convey it at all. For example, if you agree to terms thatobligate you to collect a royalty for further conveying from those to whom you convey the Program, theonly way you could satisfy both those terms and this License would be to refrain entirely from conveying
the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have permission to link or combine any covered
work with a work licensed under version 3 of the GNU Affero General Public License into a single combined
work, and to convey the resulting work. The terms of this License will continue to apply to the part whichis the covered work, but the special requirements of the GNU Affero General Public License, section 13,
concerning interaction through a network will apply to the combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the GNU General Public Licensefrom time to time. Such new versions will be similar in spirit to the present version, but may differ in detailto address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies that a certain numberedversion of the GNU General Public License “or any later version” applies to it, you have the option offollowing the terms and conditions either of that numbered version or of any later version published by theFree Software Foundation. If the Program does not specify a version number of the GNU General Public
License, you may choose any version ever published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of the GNU General Public License
can be used, that proxy’s public statement of acceptance of a version permanently authorizes you to choosethat version for the Program.
Later license versions may give you additional or different permissions. However, no additional obligations
are imposed on any author or copyright holder as a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS
AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARYSERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILLANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE
PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANYGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA ORDATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES ORA FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCHHOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.

62

GNU GENERAL PUBLIC LICENSE

conveps§79

If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effectaccording to their terms, reviewing courts shall apply local law that most closely approximates an absolute
waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability
accompanies a copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best
way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source
file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line
and a pointer to where the full notice is found.
hone line to give the program’s name and a brief idea of what it does.i Copyright (C) hyeari
hname of authoriThis program is free software: you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program.
If not, see hhttp://www.gnu.org/licenses/i.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like this when it starts in aninteractive mode:
hprogrami Copyright (C) hyeari hname of authori This program comes with ABSOLUTELYNO WARRANTY; for details type ‘show w’. This is free software, and you are welcome toredistribute it under certain conditions; type ‘show c’ for details.
The hypothetical commands ‘show w’ and ‘show c’ should show the appropriate parts of the General
Public License. Of course, your program’s commands might be different; for a GUI interface, you would use
an “about box”.
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright
disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the
GNU GPL, see hhttp://www.gnu.org/licenses/i.
The GNU General Public License does not permit incorporating your program into proprietary programs.
If your program is a subroutine library, you may consider it more useful to permit linking proprietary
applications with the library. If this is what you want to do, use the GNU Lesser General Public License
instead of this License. But first, please read hhttp://www.gnu.org/philosophy/why-not-lgpl.htmli.
h GNU General Public License 79 i ≡/∗ This section contains no C ++ code. ∗/This code is cited in section 2.
This code is used in section 81.

§81

conveps80.

Putting conveps together.

81.

This is what’s compiled.

PUTTING CONVEPS TOGETHER

63h Version control identifier 1 i
h Include files 6 i
h Preprocessor macros 7 i
h Type declarations 8 i
h Global constants 10 i
h Declare Thread Func Arg Type 9 i
h Global variables 11 i
h Declare thread function 63 i
h Main 50 i
h GNU Free Documentation License 78 i
h GNU General Public License 79 i
h Define thread function 64 i
: 74.
: 71.
arg ctr : 48, 49.
arg ptr : 64, 67, 68, 75, 77.
argc : 15, 48, 49, 50.
argv : 15, 48, 49, 50.
BORDER_COLOR_INDEX: 14, 17.
border color string : 11, 17, 50, 54, 73.
BORDER_INDEX: 14, 16.
border string : 11, 16, 50, 54, 73.
: 31, 34, 51, 55, 61, 71, 72, 73.
Byte: 8.
c str : 53.
cerr : 15, 18, 21, 45, 51, 52, 56, 59, 60, 61, 67, 69,
70, 71, 72, 73, 74, 75, 76, 77.
COERCE_INDEX: 14, 18.
coerce string : 11, 72, 73, 75.
coerce value : 11, 18, 72.
DEBUG: 12, 15, 16, 17, 18, 19, 20, 21, 22, 23, 25,
27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39, 41,
42, 43, 47, 48, 49, 54, 56, 57, 59, 60, 61, 64,
66, 67, 68, 70, 73, 75, 76, 77.
DEBUG_COMPILE: 7, 16, 17, 18, 19, 20, 21, 22, 23,
25, 27, 28, 29, 30, 33, 34, 35, 36, 37, 38, 39,
41, 42, 43, 48, 49, 54, 56, 57, 60, 61, 66, 67,
68, 70, 73, 75, 76, 77.
default border color string : 11, 50, 54.
default border string : 11, 50.
DEFAULT_BORDER_VALUE: 10, 16, 25, 41, 50.
DEFAULT_END_VALUE: 10, 49.
default output : 11, 31, 51.
default output env var : 51.
DEFAULT_THREADS_LIMIT: 10, 11, 58.
DEFAULT_ZEROES: 10, 56.
digit optind : 14.
dvi file : 65.

dvi file name : 65, 68, 70, 74.
END_INDEX: 14, 19.
end value : 11, 19, 48, 49, 54, 56, 57, 58, 59, 61.
endl : 15, 18, 21, 45, 51, 52, 53, 56, 59, 60, 61, 67,
69, 70, 71, 72, 73, 74, 75, 76, 77.
eps file : 65.
eps file name : 65, 68, 69.
eps file number : 9, 61, 64.
eps output : 11, 31, 51, 54, 74.
exit : 24, 40.
false : 11, 12, 15, 64.
fclose : 61, 69.
filename stem : 11, 48, 54, 57, 59, 60, 61, 64, 68.
FILL_INDEX: 14, 20.
fill string : 11, 20, 50, 73.
fopen : 59, 68.
FORCE_INDEX: 14, 21.
force switch : 11, 19, 21, 49, 60.
fp : 69.
fprintf : 16, 17, 18, 19, 20, 22, 23, 24, 25, 27, 28,
29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 46, 47, 48, 49, 54, 56, 57, 61, 62,
66, 68, 69, 70, 72, 74, 75, 76, 77.
fscanf : 69.
getchar : 51.
getenv : 51.
getopt long only : 15.
GRAY_NEGATE_INDEX: 14, 22.
height : 55.
height cm : 65, 69.
HEIGHT_INDEX: 14, 23.
height pixels : 65, 69, 71.
height value : 11, 23.
HELP_INDEX: 14, 24.
HORIZONTAL_BORDER_INDEX: 14, 25.
horizontal border string : 11, 25, 50, 54.

64

PUTTING CONVEPS TOGETHER

i: 55, 56, 58, 64.
j: 61.
jpeg output : 11, 31, 51, 54, 74.
k: 58.
LANDSCAPE: 10, 26, 53, 72.
LANDSCAPE_INDEX: 14, 26.
log file name : 65, 68, 77.
long options : 14, 15.
main : 50, 62.
malloc : 61.
MAX_BORDER_STRING: 10, 11.
MAX_COERCE_STRING: 10, 11.
MAX_COLOR_STRING: 10, 11.
MAX_DATESTAMP: 10.
MAX_FILENAME: 10, 11, 57, 64, 65.
MAX_OUTPUT_EXTENSION: 10, 11.
MAX_SYSTEM_STRING: 10, 64.
MAX_TEX_FILE_HEADER: 10, 11.
MAX_ZEROES_STRING: 9, 10, 12.
name : 15.
NEGATE_INDEX: 14, 27.
negate string : 11, 22, 27, 73.
NEW_FILENAME_INDEX: 14, 28.
new filename stem : 11, 28, 50, 64.
NO_ZEROES_INDEX: 14, 29.
NORMAL: 10, 50, 52, 62, 70, 71, 72, 73, 74,
75, 76, 77.
OPAQUE_INDEX: 14, 30.
opaque string : 11, 30, 50, 73.
optarg : 15, 16, 17, 18, 19, 20, 23, 25, 28, 30, 31,
34, 36, 37, 38, 41, 42, 43.
optind : 14, 48.
option : 14.
option ctr : 14, 15, 44, 45.
option index : 14, 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39, 40, 41, 42, 43, 44.
out filename stem : 64, 68, 75.
output extension : 11, 74, 75.
OUTPUT_FORMAT_INDEX: 14, 31.
pclose : 69.
png output : 11, 31, 51, 54, 74.
pnm file name : 65, 68.
pnm output : 11, 31, 51, 54, 74.
popen : 69.
PORTRAIT: 10, 11, 32, 53.
PORTRAIT_INDEX: 14, 32.
portrait or landscape : 11, 26, 32, 53, 72.
ps file : 65.
ps file name : 65, 68, 70, 71, 72, 73, 75, 76.
ps output : 11, 31, 51, 54, 76.
pthread create : 61.

conveps§81

pthread join : 61.
pthread mutex init : 50.
pthread mutex lock : 15, 16, 17, 18, 19, 20, 21, 22,
23, 24, 25, 27, 28, 29, 30, 31, 33, 34, 35, 36,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
49, 51, 54, 56, 57, 59, 60, 61, 62, 66, 67, 68,
69, 70, 71, 72, 73, 74, 75, 76, 77.
pthread mutex t : 11.
pthread mutex unlock : 15, 16, 17, 18, 19, 20, 21,
22, 23, 24, 25, 27, 28, 29, 30, 31, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 51, 54, 56, 57, 59, 60, 61, 62, 66, 67,
68, 69, 70, 71, 72, 73, 74, 75, 76, 77.
pthread t : 11, 61.
PTHREAD_THREADS_MAX: 11.
QUIET: 10, 33.
QUIET_INDEX: 14, 33.
rcs id : 1.
remove : 70, 74, 76, 77.
RENUMBER_INDEX: 14, 34.
renumber value : 11, 34, 56, 57, 67, 68, 75.
Signed Byte: 8.
SILENT: 10, 35.
SILENT_INDEX: 14, 35.
sleep : 61, 69, 70, 73, 75.
sprintf : 16, 17, 20, 25, 30, 38, 41, 50, 54, 59, 68,
69, 70, 71, 72, 73, 74, 75.
sscanf : 19, 23, 28, 34, 36, 37, 42, 43, 48, 49.
START_INDEX: 14, 36.
start value : 11, 36, 48, 54, 57, 58.
status : 12, 61, 64, 69, 70, 71, 72, 73, 74, 75, 76, 77.
std: 6.
stderr : 16, 17, 18, 19, 20, 22, 23, 24, 25, 27, 28,
29, 30, 31, 33, 34, 35, 36, 37, 38, 39, 40, 41,
42, 43, 44, 46, 47, 48, 49, 54, 56, 57, 61, 62,
66, 68, 69, 70, 72, 74, 75, 76, 77.
stdio mutex : 11, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 27, 28, 29, 30, 31, 33, 34, 35, 36, 37,
38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
50, 51, 54, 56, 57, 59, 60, 61, 62, 66, 67, 68,
69, 70, 71, 72, 73, 74, 75, 76, 77.
str : 53.
strcasecmp : 18, 31.
strcat : 69.
strcpy : 16, 22, 25, 27, 41, 48, 50, 53, 54, 61,
64, 69, 72, 74.
stringstream : 53.
strlen : 51, 54, 64, 73.
strncasecmp : 51.
system : 69, 70, 71, 72, 73, 74, 75.
system string : 64, 69, 70, 71, 72, 73, 74, 75.
temp ctr : 67.

§81conveps

temp eps file : 57, 59, 60, 61.
temp eps file name : 57, 59.
temp file : 55.
temp file name : 65.
tex file : 55, 65, 68, 69.
tex file header : 11, 53, 69.
tex file name : 65, 68, 69, 74.
tex stringstream : 53.
this option optind : 14.
thread array : 11, 61.
thread ctr : 9, 57, 61, 64, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77.
thread func : 61, 63, 64, 77.
Thread Func Arg Type: 9, 11, 61, 64.
thread func args : 11, 61.
threads limit : 11, 37, 58, 61.
THREADS_LIMIT_INDEX: 14, 37.
TO DO: 56, 74.
TRANSPARENT_INDEX: 14, 38.
transparent string : 11, 38, 50, 75.
true : 12, 15, 19, 21, 49, 60, 64.
Unsigned Byte: 8, 10, 11, 48, 51.
v: 63, 64.
VERBOSE: 10, 39, 61, 69, 70, 74, 76, 77.
VERBOSE_INDEX: 14, 39.
VERBOSITY: 11, 33, 35, 39, 50, 52, 61, 62, 69, 70,
71, 72, 73, 74, 75, 76, 77.
VERSION_INDEX: 14, 40.
VERTICAL_BORDER_INDEX: 14, 41.
vertical border string : 11, 41, 50, 54.
WEXITSTATUS: 74.
width : 55.
width cm : 65, 69.
WIDTH_INDEX: 14, 42.
width pixels : 65, 69, 71.
width value : 11, 42.
WIFEXITED: 74.
zeroes : 11, 29, 43, 56, 67.
ZEROES_INDEX: 14, 43.
zeroes string : 9, 12, 56, 61, 67, 68, 75.

PUTTING CONVEPS TOGETHER

65

66

NAMES OF THE SECTIONS

convepsh Convert PS file 75 i Used in section 74.
h Declarations for command line options 14 i Used in section 50.
h Declare thread function 63 i Used in section 81.
h Declare Thread Func Arg Type 9 i Used in section 81.
h Define thread function 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 76, 77 i Used in section 81.
h GNU Free Documentation License 78 i Cited in section 2. Used in section 81.
h GNU General Public License 79 i Cited in section 2. Used in section 81.
h Global constants 10 i Used in section 81.
h Global variables 11 i Used in section 81.
h Include files 6 i Used in section 81.
h Local variables for main ( ) 12 i Used in section 50.
h Main 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62 i Used in section 81.
h Preprocessor macros 7 i Used in section 81.
h Process command line options 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
39, 40, 41, 42, 43, 44, 45, 46, 47 i Used in section 51.
h Process filenames 48, 49 i Used in section 54.
h Type declarations 8 i Used in section 81.
h Version control identifier 1 i Used in section 81.

conveps
Version 1.2.0
by Laurence D. Finston
December 2005

Section Page
conveps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1
Copyright and License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2
Instructions for use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3Generating the executable conveps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
5Invoking conveps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
6Preprocessor macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
7Type declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
89Declare Thread Func Arg Type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Local variables for main() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
11
Command line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
12
Declarations for command line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
13
Process command line options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
14
Border . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
14
Bordercolor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
15
coerce . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
16
gray-negate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
18
Horizontal Border . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
19
landscape . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
19
portrait . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
21
quiet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
22
silent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
22
verbose . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
24
Ambiguous option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
26
Invalid option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
26
Process filenames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
27
Main . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
29
Set tex file header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
30
GNU Free Documentation License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
49
GNU General Public License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
54
Putting conveps together . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
63