Term-Gnuplot

 view release on metacpan or  search on metacpan

gnuterm/term/pc.trm  view on Meta::CPAN

/*
 * $Id: pc.trm,v 1.16 2002/07/26 16:42:29 mikulik Exp $
 *
 */

/* GNUPLOT - pc.trm */

/*[
 * Copyright 1990 - 1993, 1998
 *
 * Permission to use, copy, and distribute this software and its
 * documentation for any purpose with or without fee is hereby granted,
 * provided that the above copyright notice appear in all copies and
 * that both that copyright notice and this permission notice appear
 * in supporting documentation.
 *
 * Permission to modify the software is granted, but not the right to
 * distribute the complete modified source code.  Modifications are to
 * be distributed as patches to the released version.  Permission to
 * distribute binaries produced by compiling modified sources is granted,
 * provided you
 *   1. distribute the corresponding source modifications from the
 *    released version in the form of a patch file along with the binaries,
 *   2. add special version identification to distinguish your version
 *    in addition to the base release version number,
 *   3. provide your name and address as the primary contact for the
 *    support of your modified version, and
 *   4. retain our contact information in regard to use of the base
 *    software.
 * Permission to distribute the released version of the source code along
 * with corresponding source modifications in the form of a patch file is
 * granted with same provisions 2 through 4 for binary distributions.
 *
 * This software is provided "as is" without express or implied warranty
 * to the extent permitted by applicable law.
]*/

/*
 * This file is included by ../term.c.
 *
 * This terminal driver supports:
 *  Under Microsoft C
 *      cga, egabios, egalib, vgabios, hercules, corona325, att
 *  Under Turboc C
 *      cga, ega/vga, vgamono, svga, mcga, hercules, att
 *  Under Watcom C
 *      cga, ega/vga, vgamono, svga, mcga, hercules, ???
 *
 * AUTHORS
 *  Colin Kelley, Thomas Williams, William Wilson, Russell Lang
 *  modified by David J. Liu (liu@csb.yale.edu) for version 3.6
 *
 * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
 *
 * Because only one compiler is used to generate gnuplot.exe
 * and the type of the single graphics board is auto-detected,
 * we can combine all these parts into one terminal type: PC
 * and let the computer take care of the rest.  -- DJL
 *
 * Since I don't have MicroSoft C, I assume it would define MSC.
 * Please correct it if you are using MS C.  Thank you.  -- DJL
 *
 */

/*
 * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
 */

#include "driver.h"

#ifdef TERM_REGISTER
register_term(dospc)
#endif

#ifdef TERM_PROTO
TERM_PUBLIC void PC_text __PROTO((void));
TERM_PUBLIC void PC_reset __PROTO((void));
TERM_PUBLIC void PC_init __PROTO((void));
TERM_PUBLIC void PC_graphics __PROTO((void));
TERM_PUBLIC void PC_linetype __PROTO((int linetype));
TERM_PUBLIC void PC_move __PROTO((int x, int y));
TERM_PUBLIC void PC_vector __PROTO((int x, int y));
TERM_PUBLIC void PC_put_text __PROTO((int x, int y, const char *str));
TERM_PUBLIC int PC_text_angle __PROTO((int ang));
TERM_PUBLIC int PC_justify_text __PROTO((enum JUSTIFY ang));

#define PC_HCHAR FNT5X9_HCHAR
#define PC_VCHAR FNT5X9_VCHAR
#define PC_HTIC 5
#define PC_VTIC 4
#define PC_XMAX 100		/* These two entries are just place holders. */
#define PC_YMAX 100		/* The actual values will be found in init.  */
#endif /* TERM_PROTO */

#ifndef TERM_PROTO_ONLY
#ifdef TERM_BODY

#ifdef __TURBOC__
static int huge detect_svga __PROTO((void));
#endif /* __TURBOC__ */

#include <string.h>
#include <stdlib.h>

gnuterm/term/pc.trm  view on Meta::CPAN

    pc_graphics = TRUE;
}

TERM_PUBLIC void
PC_init()
{
    char *pathp;
#ifdef __WATCOMC__
    struct _fontinfo fi;
#endif

    if (!pc_graphics) {
	fputs("Unable to initialize graphics.\n", stderr);
	term = 0;
	return;
    }
    /* Double the tic/font sizes. */
    pc_text_size = (pc_lasty > 590) ? 2 : 1;
    term->h_char = PC_HCHAR;
    term->v_char = PC_VCHAR;
    term->h_tic = PC_HTIC * pc_text_size;
    term->v_tic = PC_VTIC * pc_text_size;
    term->xmax = pc_lastx + 1;
    term->ymax = pc_lasty + 1;
#ifdef __TURBOC__
    setgraphmode(pc_mode);
    settextstyle(DEFAULT_FONT, HORIZ_DIR, pc_text_size);
    settextjustify(pc_hjustify, pc_vjustify);
    term->h_char = textheight("X");	/* overriding the default */
    term->v_char = textwidth("X");	/* overriding the default */
#endif /* __TURBOC__ */
#ifdef __WATCOMC__
    _setvideomode(pc_mode);
    _settextang(HORIZ_DIR);
    _settextalign(pc_hjustify, pc_vjustify);
    _setcharsize(pc_text_size * PC_HCHAR, pc_text_size * PC_VCHAR);
    _getfontinfo(&fi);
    term->h_char = fi.avgwidth;
    term->v_char = fi.pixheight * 1.5;
#endif /* WATCOMC */
#ifdef MSC
#endif /* MSC */
}

TERM_PUBLIC void
PC_graphics()
{
    graphics_on = TRUE;
#ifdef __TURBOC__
    setgraphmode(pc_mode);
#endif /* __TURBOC__ */
#ifdef __WATCOMC__
    _setvideomode(pc_mode);
#endif /* WATCOMC */
#ifdef MSC
    if (pc_corscreen == -1)
	Vmode(18);		/* VGA */
    else {
	grinit(corscreen);
	grandtx();
    }				/* corolla */
#endif /* MSC */
}

TERM_PUBLIC void
PC_linetype(linetype)
{
    if (pc_colors > 14) {	/* 16 or more colors */
	if (linetype >= 13)
	    linetype %= 13;
#ifdef __TURBOC__
	setcolor(vga_color[linetype + 2]);
#endif /* __TURBOC__ */
#ifdef __WATCOMC__
	_setcolor(vga_color[linetype + 2]);
#endif /* WATCOMC */
#ifdef MSC
#endif /* MSC */
    } else {			/* MONO */
	if (linetype >= 5)
	    linetype %= 5;
#ifdef __TURBOC__
	setlinestyle(4, pattern[linetype + 2], 1);
#endif /* __TURBOC__ */
#ifdef __WATCOMC__
	_setlinestyle(pattern[linetype + 2]);
#endif /* WATCOMC */
#ifdef MSC
	if (pc_corscreen != -1)
	    Cor_mask(pattern[linetype + 2]);
#endif /* MSC */
    }
}

TERM_PUBLIC void
PC_move(x, y)
int x, y;
{
#ifdef __TURBOC__
    moveto(x, pc_lasty - y);
#endif /* __TURBOC__ */
#ifdef __WATCOMC__
    _moveto(x, pc_lasty - y);
#endif /* WATCOMC */
#ifdef MSC
#endif /* MSC */
    startx = x;
    starty = y;
}

TERM_PUBLIC void
PC_vector(x, y)
int x, y;
{
#ifdef __TURBOC__
    lineto(x, pc_lasty - y);
#endif /* __TURBOC__ */
#ifdef __WATCOMC__
    _lineto(x, pc_lasty - y);
#endif /* WATCOMC */
#ifdef MSC



( run in 3.203 seconds using v1.01-cache-2.11-cpan-df04353d9ac )