[BACK]Return to fg.trm CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gnuplot / term

File: [local] / OpenXM_contrib / gnuplot / term / Attic / fg.trm (download)

Revision 1.1, Sun Jan 9 17:01:13 2000 UTC (24 years, 4 months ago) by maekawa
Branch: MAIN

Initial revision

/*
 * $Id: $
 */

/* GNUPLOT - fg.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 Zortech C
 *      egalib, vgalib, vgamono, svga, mcga, cga, hercules, att
 *
 * AUTHORS
 *		  Gnuplot for DOS 386/flash graphics
 *				  Clifton T. Liu
 *
 * There is a mailing list for gnuplot users. Note, however, that the
 * newsgroup 
 *	comp.graphics.apps.gnuplot 
 * is identical to the mailing list (they
 * both carry the same set of messages). We prefer that you read the
 * messages through that newsgroup, to subscribing to the mailing list.
 * (If you can read that newsgroup, and are already on the mailing list,
 * please send a message to majordomo@dartmouth.edu, asking to be
 * removed from the mailing list.)
 *
 * The address for mailing to list members is
 *	   info-gnuplot@dartmouth.edu
 * and for mailing administrative requests is 
 *	   majordomo@dartmouth.edu
 * The mailing list for bug reports is 
 *	   bug-gnuplot@dartmouth.edu
 * The list of those interested in beta-test versions is
 *	   info-gnuplot-beta@dartmouth.edu
 */
/* The modifications to allow Gnuplot to compile with Zortech C/C++   */
/* 3.1 /Flash Graphics	were made by Clifton T. Liu		  */
/* (cliu@merlin.appmath.columbia.edu)		 20 Feb 1993	  */

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

#include "driver.h"

#ifdef TERM_REGISTER
register_term(hercules)
register_term(egamono)
register_term(egalib)
register_term(vgalib)
register_term(vgamono)
register_term(svgalib)
register_term(ssvgalib)
#endif

#ifdef TERM_PROTO
TERM_PUBLIC void PC_text __PROTO((void));
TERM_PUBLIC void PC_reset __PROTO((void));
TERM_PUBLIC int VGA_text_angle __PROTO((int ang));
TERM_PUBLIC int VGA_justify_text __PROTO((enum JUSTIFY mode));
TERM_PUBLIC void VGA_init __PROTO((void));
TERM_PUBLIC void HERC_graphics __PROTO((void));
TERM_PUBLIC void EGAMONO_graphics __PROTO((void));
TERM_PUBLIC void EGA_graphics __PROTO((void));
TERM_PUBLIC void VGA_graphics __PROTO((void));
TERM_PUBLIC void VGAMONO_graphics __PROTO((void));
TERM_PUBLIC void SVGA_graphics __PROTO((void));
TERM_PUBLIC void SSVGA_graphics __PROTO((void));
TERM_PUBLIC void VGA_linetype __PROTO((int linetype));
#define HERC_XMAX 720
#define HERC_YMAX 348

#define HERC_XLAST (HERC_XMAX - 1)
#define HERC_YLAST (HERC_YMAX - 1)

#define HERC_VCHAR 10
#define HERC_HCHAR 8
#define HERC_VTIC 5
#define HERC_HTIC 5



#define EGA_XMAX 640
#define EGA_YMAX 350

#define EGA_XLAST (EGA_XMAX - 1)
#define EGA_YLAST (EGA_YMAX - 1)

#define EGA_VCHAR 18
#define EGA_HCHAR 8
#define EGA_VTIC 5
#define EGA_HTIC 5


#define VGA_XMAX 640
#define VGA_YMAX 480

#define VGA_XLAST (VGA_XMAX - 1)
#define VGA_YLAST (VGA_YMAX - 1)

#define VGA_VCHAR 24
#define VGA_HCHAR 8
#define VGA_VTIC 5
#define VGA_HTIC 5


#define SVGA_XMAX 800
#define SVGA_YMAX 600

#define SVGA_XLAST (SVGA_XMAX - 1)
#define SVGA_YLAST (SVGA_YMAX - 1)

#define SVGA_VCHAR 24
#define SVGA_HCHAR 8
#define SVGA_VTIC 5
#define SVGA_HTIC 5

#define SSVGA_XMAX 1024
#define SSVGA_YMAX 768

#define SSVGA_XLAST (SSVGA_XMAX - 1)
#define SSVGA_YLAST (SSVGA_YMAX - 1)

#define SSVGA_VCHAR 24
#define SSVGA_HCHAR 8
#define SSVGA_VTIC 5
#define SSVGA_HTIC 5

#endif /* TERM_PROTO */

#ifndef TERM_PROTO_ONLY
#ifdef TERM_BODY

void pause __PROTO((void));

#include <fg.h>

static int pattern[] ={ 0xffff, 0x0f0f, 0xffff, 0xaaaa, 0x3333, 0x3f3f, 0x0f0f };

static int graphics_on = FALSE;
int startx, starty;
/*
int pc_angle;
#define PC_VCHAR FNT5X9_VCHAR
#define PC_HCHAR FNT5X9_HCHAR
*/
void pause()
{				/* press any key to continue... */
    (void) getch();
}


TERM_PUBLIC void PC_text()
{
    if (graphics_on) {
	graphics_on = FALSE;
	pause();
    }
    fg_term();
}

TERM_PUBLIC void PC_reset()
{
}



/* all of the FlashGraphics C routines for the different graphics devices
 * go here */



static int vga256color[] ={ 7, 8, 2, 3, 4, 5, 9, 14, 12, 15, 13, 10, 11, 1, 6 };
static int *vgacolor = vga256color;
static fg_color_t vga_color;
static int text_angle;
static fg_line_t line_to_draw;

TERM_PUBLIC int VGA_text_angle(ang)
int ang;
{
    text_angle = ang;
    return TRUE;
}

TERM_PUBLIC int VGA_justify_text(mode)
enum JUSTIFY mode;
{
    return FALSE;
}

TERM_PUBLIC void VGA_init()
{
    if (fg_init() == FG_NULL) {
	fputs("Graphics card not detected.\n", stderr);
	exit(EXIT_FAILURE);
    }
}

TERM_PUBLIC void HERC_graphics()
{
    fg_init_herc();
    graphics_on = TRUE;
}

TERM_PUBLIC void EGAMONO_graphics()
{
    fg_init_egamono();
    graphics_on = TRUE;
}

TERM_PUBLIC void EGA_graphics()
{
    fg_init_egaecd();
    graphics_on = TRUE;
}

TERM_PUBLIC void VGA_graphics()
{
    fg_init_vga12();
    graphics_on = TRUE;
}

TERM_PUBLIC void VGAMONO_graphics()
{
    fg_init_vga11();
    graphics_on = TRUE;
}

TERM_PUBLIC void SVGA_graphics()
{
    fg_init_vesa6a();
    graphics_on = TRUE;
}

TERM_PUBLIC void SSVGA_graphics()
{
    fg_init_vesa5();
    graphics_on = TRUE;
}

TERM_PUBLIC void VGA_linetype(linetype)
{
    if (linetype >= 13)
	linetype %= 13;
    vga_color = fg.color[vgacolor[linetype + 2]];
}

TERM_PUBLIC void VGA_put_text(x, y, str)
unsigned int x, y;
char *str;
{
    fg_puts(vga_color, FG_MODE_SET, ~0, text_angle, x, y, str, fg.displaybox);
}

TERM_PUBLIC void VGA_move(x, y)
{
    line_to_draw[FG_X1] = x;
    line_to_draw[FG_Y1] = y;
}


TERM_PUBLIC void VGA_vector(x, y)
{
    line_to_draw[FG_X2] = x;
    line_to_draw[FG_Y2] = y;
    fg_drawline(vga_color, FG_MODE_SET, ~0, FG_LINE_SOLID, line_to_draw);
    line_to_draw[FG_X1] = x;
    line_to_draw[FG_Y1] = y;
}

TERM_PUBLIC void VGA_text()
{
    if (graphics_on) {
	graphics_on = FALSE;
	fg_flush();
	pause();
    }
    fg_term();
}

TERM_PUBLIC void VGA_reset()
{
    fg_term();
}

#endif /* TERM_BODY */

#ifdef TERM_TABLE

TERM_TABLE_START(hercules_driver)
    "hercules", "IBM PC/Clone with Hercules graphics board",
    HERC_XMAX, HERC_YMAX, HERC_VCHAR, HERC_HCHAR,
    HERC_VTIC, HERC_HTIC, options_null, VGA_init, VGA_reset,
    VGA_text, null_scale, HERC_graphics, VGA_move, VGA_vector,
    VGA_linetype, VGA_put_text, VGA_text_angle,
    VGA_justify_text, do_point, do_arrow, set_font_null
TERM_TABLE_END(hercules_driver)

#undef LAST_TERM
#define LAST_TERM hercules_driver

TERM_TABLE_START(egamono_driver)
    "egamono", "IBM PC/Clone with monochrome EGA graphics board",
    EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
    EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
    VGA_text, null_scale, EGAMONO_graphics, VGA_move, VGA_vector,
    VGA_linetype, VGA_put_text, VGA_text_angle,
    VGA_justify_text, do_point, do_arrow, set_font_null
TERM_TABLE_END(egamono_driver)

#undef LAST_TERM
#define LAST_TERM egamono_driver

TERM_TABLE_START(egalib_driver)
    "egalib", "IBM PC/Clone with color EGA graphics board",
    EGA_XMAX, EGA_YMAX, EGA_VCHAR, EGA_HCHAR,
    EGA_VTIC, EGA_HTIC, options_null, VGA_init, VGA_reset,
    VGA_text, null_scale, EGA_graphics, VGA_move, VGA_vector,
    VGA_linetype, VGA_put_text, VGA_text_angle,
    VGA_justify_text, do_point, do_arrow, set_font_null
TERM_TABLE_END(egalib_driver)

#undef LAST_TERM
#define LAST_TERM egalib_driver

TERM_TABLE_START(vgalib_driver)
    "vgalib", "IBM PC/Clone with VGA graphics board",
    VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
    VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
    VGA_text, null_scale, VGA_graphics, VGA_move, VGA_vector,
    VGA_linetype, VGA_put_text, VGA_text_angle,
    VGA_justify_text, do_point, do_arrow, set_font_null
TERM_TABLE_END(vgalib_driver)

#undef LAST_TERM
#define LAST_TERM vgalib_driver

TERM_TABLE_START(vgamono_driver)
    "vgamono", "IBM PC/Clone with monochrome VGA graphics board",
    VGA_XMAX, VGA_YMAX, VGA_VCHAR, VGA_HCHAR,
    VGA_VTIC, VGA_HTIC, options_null, VGA_init, VGA_reset,
    VGA_text, null_scale, VGAMONO_graphics, VGA_move, VGA_vector,
    VGA_linetype, VGA_put_text, VGA_text_angle,
    VGA_justify_text, do_point, do_arrow, set_font_null
TERM_TABLE_END(vgamono_driver)

#undef LAST_TERM
#define LAST_TERM vgamono_driver

TERM_TABLE_START(svgalib_driver)
    "svgalib", "IBM PC/Clone with VESA Super VGA graphics board",
    SVGA_XMAX, SVGA_YMAX, SVGA_VCHAR, SVGA_HCHAR,
    SVGA_VTIC, SVGA_HTIC, options_null, VGA_init, VGA_reset,
    VGA_text, null_scale, SVGA_graphics, VGA_move, VGA_vector,
    VGA_linetype, VGA_put_text, VGA_text_angle,
    VGA_justify_text, do_point, do_arrow, set_font_null
TERM_TABLE_END(svgalib_driver)

#undef LAST_TERM
#define LAST_TERM svgalib_driver

TERM_TABLE_START(ssvgalib_driver)
    "ssvgalib", "IBM PC/Clone with VESA 256 color 1024 by 768 super VGA",
    SSVGA_XMAX, SSVGA_YMAX, SSVGA_VCHAR, SSVGA_HCHAR,
    SSVGA_VTIC, SSVGA_HTIC, options_null, VGA_init, VGA_reset,
    VGA_text, null_scale, SSVGA_graphics, VGA_move, VGA_vector,
    VGA_linetype, VGA_put_text, VGA_text_angle,
    VGA_justify_text, do_point, do_arrow, set_font_null
TERM_TABLE_END(ssvgalib_driver)

#undef LAST_TERM
#define LAST_TERM ssvgalib_driver

#endif /* TERM_TABLE */
#endif /* TERM_PROTO_ONLY */


#ifdef TERM_HELP
START_HELP(hercules)
"1 hercules",
"?commands set terminal hercules",
"?set terminal hercules",
"?set term hercules",
"?terminal hercules",
"?term hercules",
"?hercules",
"?commands set terminal egalib",
"?set terminal egalib",
"?set term egalib",
"?terminal egalib",
"?term egalib",
"?egalib",
"?commands set terminal egamono",
"?set terminal egamono",
"?set term egamono",
"?terminal egamono",
"?term egamono",
"?egamono",
"?commands set terminal vgalib",
"?set terminal vgalib",
"?set term vgalib",
"?terminal vgalib",
"?term vgalib",
"?vgalib",
"?commands set terminal vgamono",
"?set terminal vgamono",
"?set term vgamono",
"?terminal vgamono",
"?term vgamono",
"?vgamono",
"?commands set terminal svgalib",
"?set terminal svgalib",
"?set term svgalib",
"?terminal svgalib",
"?term svgalib",
"?svgalib",
"?commands set terminal ssvgalib",
"?set terminal ssvgalib",
"?set term ssvgalib",
"?terminal ssvgalib",
"?term ssvgalib",
"?ssvgalib",
" These drivers supports PC monitors with autodetected graphics boards.  They",
" can be used only when compiled with Zortech C/C++.  None have options."
END_HELP(hercules)
#endif /* TERM_HELP */