home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 22 gnu
/
22-gnu.zip
/
gp36emx.zip
/
emxvga.trm
< prev
next >
Wrap
Text File
|
1996-01-08
|
5KB
|
185 lines
/* GNUPLOT - emxvga.trm */
/*
* Copyright (C) 1994
*
* 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 modified code. Modifications are to be distributed
* as patches to released version.
*
* This software is provided "as is" without express or implied warranty.
*
* This file is included by ../term.c. Be sure to add term_tbl[EMXVGA].
*
* This terminal driver supports:
* SVGA 640x480x256 on PC's running DOS or OS/2, windowed or full-screen,
* emx run-time lib required for OS/2.
*
* AUTHOR
* David J. Liu (liudj0@minerva.cis.yale.edu)
*/
/*
* Compile with GCC (emx) with VESA and SVGAKIT maintained by
* Johannes Martin <z946785@corn.cso.niu.edu>
* with addition of g_string() by David J. Liu (liudj0@minerva.cis.yale.edu)
* ftp.uni-stuttgart.de:/pub/systems/os2/emx-0.8h/contrib/gstring.zip
* alternatively, define BORLAND to use Borland fonts (untested)
* supports Trident, Cirrus, ET4000, WD, S3 and all other VESA cards.
*/
#ifndef GOT_TERM_DRIVER
#include "driver.h"
#endif
#ifdef TERM_REGISTER
register_term(emxvga)
#endif
#ifdef TERM_PROTO
#define EMXVGA_VCHAR 8
#define EMXVGA_HCHAR 8
#define EMXVGA_VTIC 4
#define EMXVGA_HTIC 4
#define EMXVGA_XMAX 0 /* These two entries are just place holders. */
#define EMXVGA_YMAX 0 /* The actual values will be filled in init. */
TERM_PUBLIC void EMXVGA_init __P((void));
TERM_PUBLIC void EMXVGA_reset __P((void));
TERM_PUBLIC void EMXVGA_text __P((void));
TERM_PUBLIC void EMXVGA_graphics __P((void));
TERM_PUBLIC void EMXVGA_linetype __P((int linetype));
TERM_PUBLIC void EMXVGA_move __P((unsigned int x, unsigned int y));
TERM_PUBLIC void EMXVGA_vector __P((unsigned int x, unsigned int y));
TERM_PUBLIC int EMXVGA_text_angle __P((int ang));
TERM_PUBLIC void EMXVGA_put_text __P((unsigned int x, unsigned int y, char *str));
TERM_PUBLIC void EMXVGA_suspend __P((void));
TERM_PUBLIC void EMXVGA_resume __P((void));
#endif
#ifdef TERM_BODY
#ifdef DOWN
#undef DOWN
#endif
#ifdef RIGHT
#undef RIGHT
#endif
#include <vesa.h>
#include <graph.h>
#undef DOWN /* to avoid a conflict */
#undef RIGHT /* between graph.h and other terminals */
static int EMXVGA_vmode=G640x480x256 ; /* default mode */
static int vgacolor[]={7,8,2,3,4,5,9,14,12,15,13,10,11,1,6} ;
static int startx,starty,lasty,graphics_on=FALSE ;
static int EMXVGA_angle,EMXVGA_color ;
static char EMXVGA_chr,*EMXVGA_buf ;
TERM_PUBLIC void EMXVGA_init ()
{
if (!g_mode(EMXVGA_vmode))
{ fprintf (stderr,"Unable to initiate graphics.\n") ; return ; }
term->xmax=g_xsize ; term->ymax=g_ysize ; lasty=g_ysize-1 ;
#ifdef BORLAND
gf_loadfont ("default.chr") ;
#endif
}
TERM_PUBLIC void EMXVGA_reset ()
{
g_mode (GTEXT) ; graphics_on=FALSE ;
}
TERM_PUBLIC void EMXVGA_text ()
{
if (graphics_on)
{ VesaGetCharacter (&EMXVGA_chr) ; g_mode (GTEXT) ; graphics_on=FALSE ; }
}
TERM_PUBLIC void EMXVGA_graphics ()
{
if (!graphics_on) { g_mode (EMXVGA_vmode) ; graphics_on=TRUE ; }
}
TERM_PUBLIC void EMXVGA_linetype (linetype)
int linetype;
{
EMXVGA_color=vgacolor[(linetype%13)+2] ;
}
TERM_PUBLIC void EMXVGA_move (x,y)
unsigned int x,y ;
{
startx=x ; starty=y ;
}
TERM_PUBLIC void EMXVGA_vector (x,y)
unsigned int x,y ;
{
g_line (startx,lasty-starty,x,lasty-y,EMXVGA_color) ;
startx=x ; starty=y ;
}
TERM_PUBLIC int EMXVGA_text_angle (ang)
int ang ;
{
#ifdef BORLAND
EMXVGA_angle=ang ;
#else
EMXVGA_angle=ang*90 ;
#endif
return (TRUE) ;
}
TERM_PUBLIC void EMXVGA_put_text (x,y,str)
unsigned int x,y ;
char *str ;
{
#ifdef BORLAND
gf_setdirection (EMXVGA_angle) ;
gf_drawstring (x,lasty-y,str,EMXVGA_color) ;
#else
g_string (x,lasty-y-3,EMXVGA_color,EMXVGA_angle,str) ;
#endif
}
TERM_PUBLIC void EMXVGA_suspend ()
{
EMXVGA_buf=(char *)malloc(g_memsize) ;
g_save (EMXVGA_buf) ;
g_mode (GTEXT) ;
}
TERM_PUBLIC void EMXVGA_resume ()
{
g_mode (EMXVGA_vmode) ;
g_restore (EMXVGA_buf) ;
free (EMXVGA_buf) ;
}
#endif
#ifdef TERM_TABLE
TERM_TABLE_START(emxvga_driver)
"emxvga", "PC with SuperVGA running DOS or OS/2",
EMXVGA_XMAX, EMXVGA_YMAX, EMXVGA_VCHAR, EMXVGA_HCHAR,
EMXVGA_VTIC, EMXVGA_HTIC, options_null, EMXVGA_init, EMXVGA_reset,
EMXVGA_text, null_scale, EMXVGA_graphics, EMXVGA_move, EMXVGA_vector,
EMXVGA_linetype, EMXVGA_put_text, EMXVGA_text_angle,
null_justify_text, do_point, do_arrow, set_font_null,
0, /* pointsize */
TERM_CAN_MULTIPLOT, EMXVGA_suspend, EMXVGA_resume
TERM_TABLE_END(emxvga_driver)
#undef LAST_TERM
#define LAST_TERM emxvga_driver
#endif