plt - Software for 2D Plots 2.5

File: <base>/plt/src/makeplthead.c (2,577 bytes)
/* file: makeplthead.c		G. Moody	7 April 1996
				Last revised:	23 March 2001
Generate an EPSF heading, including a bounding box, for `plt' output

Copyright (C) George B. Moody 1996
_______________________________________________________________________________
This 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 2 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, write to the Free Software Foundation, Inc., 59 Temple
Place - Suite 330, Boston, MA 02111-1307, USA.

You may contact the author by e-mail (george@mit.edu) or postal mail
(MIT Room E25-505A, Cambridge, MA 02139 USA).  For updates to this software,
please visit PhysioNet (http://www.physionet.org/).
_______________________________________________________________________________

Usage:
	makeplthead FSCL X0 Y0 X1 Y1
where FSCL is a font scaling factor (ignored); (X0, Y0) is the lower left
corner of the bounding box;  and (X1, Y1) is the upper right corner of the
bounding box.  Note that the units of X0, Y0, X1, and Y1 are *inches*.

The intended use of this program is within the `lwcat' script, in which the
variable WDEF contains the five command-line arguments in the order given
above.  Thus, from `lwcat', this program is invoked as:
	makeplthead $WDEF
*/

#include <stdio.h>
#include <time.h>

/* If fewer than 5 arguments are supplied, the following default values are
   assumed. These are implied by the WDEF generated by lwplt without -size. */
#define DEFX0 0.775
#define	DEFY0 3.350
#define DEFX1 7.975
#define	DEFY1 9.350

main(argc, argv)
int argc;
char **argv;
{
    double x0 = DEFX0, y0 = DEFY0, x1 = DEFX1, y1 = DEFY1, atof();
    int llx, lly, urx, ury;
    time_t now;

    if (argc > 5) {
	x0 = atof(argv[2]);
	y0 = atof(argv[3]);
	x1 = atof(argv[4]);
	y1 = atof(argv[5]);
    }
    llx = (int)(x0 * 72.0);
    lly = (int)(y0 * 72.0);
    urx = (int)(x1 * 72.0);
    ury = (int)(y1 * 72.0);

    printf("%%!PS-Adobe-3.0\n");
    printf("%%%%BoundingBox: %d %d %d %d\n", llx, lly, urx, ury);
    printf("%%%%Title: (plt/lwcat output)\n");
    (void)time(&now);
    printf("%%%%CreationDate: %s", ctime(&now));
}