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

Annotation of OpenXM_contrib/gnuplot/term/emxvga.trm, Revision 1.1.1.1

1.1       maekawa     1: /*
                      2:  * $Id: emxvga.trm,v 1.16 1998/04/14 00:17:40 drd Exp $
                      3:  */
                      4:
                      5: /* GNUPLOT - emxvga.trm */
                      6:
                      7: /*[
                      8:  * Copyright 1994, 1998
                      9:  *
                     10:  * Permission to use, copy, and distribute this software and its
                     11:  * documentation for any purpose with or without fee is hereby granted,
                     12:  * provided that the above copyright notice appear in all copies and
                     13:  * that both that copyright notice and this permission notice appear
                     14:  * in supporting documentation.
                     15:  *
                     16:  * Permission to modify the software is granted, but not the right to
                     17:  * distribute the complete modified source code.  Modifications are to
                     18:  * be distributed as patches to the released version.  Permission to
                     19:  * distribute binaries produced by compiling modified sources is granted,
                     20:  * provided you
                     21:  *   1. distribute the corresponding source modifications from the
                     22:  *    released version in the form of a patch file along with the binaries,
                     23:  *   2. add special version identification to distinguish your version
                     24:  *    in addition to the base release version number,
                     25:  *   3. provide your name and address as the primary contact for the
                     26:  *    support of your modified version, and
                     27:  *   4. retain our contact information in regard to use of the base
                     28:  *    software.
                     29:  * Permission to distribute the released version of the source code along
                     30:  * with corresponding source modifications in the form of a patch file is
                     31:  * granted with same provisions 2 through 4 for binary distributions.
                     32:  *
                     33:  * This software is provided "as is" without express or implied warranty
                     34:  * to the extent permitted by applicable law.
                     35: ]*/
                     36:
                     37: /*
                     38:  * This file is included by ../term.c.
                     39:  *
                     40:  * This terminal driver supports:
                     41:  *  SVGA 1024x768x256 for PC's running DOS or OS/2
                     42:  *
                     43:  * AUTHOR
                     44:  *   David J. Liu (liudj0@minerva.cis.yale.edu)
                     45:  */
                     46: /*
                     47:  * Compile with GCC (emx) with VESA and SVGAKIT maintained by
                     48:  * Johannes Martin (JMARTIN@GOOFY.ZDV.UNI-MAINZ.DE)
                     49:  * with additions by David J. Liu (liudj0@minerva.cis.yale.edu)
                     50:  * supports VESA, Trident, Cirrus, ET4000, WD and S3.
                     51:  */
                     52: /*
                     53:  * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
                     54:  */
                     55:
                     56: #include "driver.h"
                     57:
                     58: #ifdef TERM_REGISTER
                     59: #ifdef EMXVESA
                     60: register_term(vesa)
                     61: #endif /* EMXVESA */
                     62: register_term(emxvga)
                     63: #endif
                     64:
                     65: #ifdef TERM_PROTO
                     66: TERM_PUBLIC void EMXVGA_init __PROTO((void));
                     67: TERM_PUBLIC void EMXVGA_reset __PROTO((void));
                     68: TERM_PUBLIC void EMXVGA_text __PROTO((void));
                     69: TERM_PUBLIC void EMXVGA_graphics __PROTO((void));
                     70: TERM_PUBLIC void EMXVGA_linetype __PROTO((int));
                     71: TERM_PUBLIC void EMXVGA_move __PROTO((unsigned int, unsigned int));
                     72: TERM_PUBLIC void EMXVGA_vector __PROTO((unsigned int, unsigned int));
                     73: TERM_PUBLIC int EMXVGA_text_angle __PROTO((int));
                     74: TERM_PUBLIC void EMXVGA_put_text __PROTO((unsigned int, unsigned int, char *));
                     75: #define EMXVGA_VCHAR 8
                     76: #define EMXVGA_HCHAR 8
                     77: #define EMXVGA_VTIC 4
                     78: #define EMXVGA_HTIC 4
                     79: #define EMXVGA_XMAX 0          /* These two entries are just place holders. */
                     80: #define EMXVGA_YMAX 0          /* The actual values will be filled in init. */
                     81: #ifdef EMXVESA
                     82: TERM_PUBLIC void EMXVESA_options __PROTO((void));
                     83: TERM_PUBLIC void EMXVESA_init __PROTO((void));
                     84: TERM_PUBLIC void EMXVESA_graphics __PROTO((void));
                     85: TERM_PUBLIC void EMXVESA_text __PROTO((void));
                     86: TERM_PUBLIC void EMXVESA_reset __PROTO((void));
                     87: #endif
                     88: #endif /* TERM_PROTO */
                     89: #ifndef TERM_PROTO_ONLY
                     90: #ifdef TERM_BODY
                     91: /* avoid name clash with graph.h - lets hope that no following
                     92:  * driver needs these symbols !
                     93:  */
                     94: #ifdef RIGHT
                     95: #undef RIGHT
                     96: #endif
                     97: #ifdef DOWN
                     98: #undef DOWN
                     99: #endif
                    100: #include <vesa.h>
                    101: #include <jmgraph.h>
                    102: #include <conio.h>             /* for getch()            -SB */
                    103: #include <stdlib.h>
                    104: #include <dos.h>
                    105: /*
                    106:  * Some versions of graph.h (e.g. jmgraph.h) define RIGHT to be 0
                    107:  * colliding with enum JUSTIFY. We don't need this define anyway,
                    108:  * just undef it.                      -SB
                    109:  */
                    110: #ifdef RIGHT
                    111: #undef RIGHT
                    112: #endif
                    113: #ifdef DOWN
                    114: #undef DOWN
                    115: #endif
                    116: static int EMXVGA_vmode = G640x480x256;                /* default mode */
                    117: static int vgacolor[] ={ 7, 8, 2, 3, 4, 5, 9, 14, 12, 15, 13, 10, 11, 1, 6 };
                    118: static int graphics_on = FALSE;
                    119: int startx, starty, lasty;
                    120: int EMXVGA_angle, EMXVGA_color;
                    121: char *EMXVGA_buf;
                    122: void emx_getch()
                    123: {
                    124:     union REGS reg;
                    125:     char c;
                    126:     if (_osmode == OS2_MODE)
                    127:        VesaGetCharacter(&c);
                    128:     else {
                    129:        reg.x.ax = 0x0000;
                    130:        _int86(0x16, &reg, &reg);
                    131:        if (reg.h.al == 0) {
                    132:            reg.x.ax = 0x0000;
                    133:            _int86(0x16, &reg, &reg);
                    134:        }
                    135:     }
                    136: }
                    137:
                    138: /* gstring.c (emx+gcc) -- Copyright (c) 1994 by David J. Liu */
                    139: unsigned char font[128][8] =
                    140: {                              /* 8x8 font */
                    141:     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
                    142:     {0x7E, 0x81, 0xA5, 0x81, 0xBD, 0x99, 0x81, 0x7E},
                    143:     {0x7E, 0xFF, 0xDB, 0xFF, 0xC3, 0xE7, 0xFF, 0x7E},
                    144:     {0x6C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00},
                    145:     {0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x10, 0x00},
                    146:     {0x38, 0x7C, 0x38, 0xFE, 0xFE, 0x92, 0x10, 0x7C},
                    147:     {0x00, 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x7C},
                    148:     {0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00},
                    149:     {0xFF, 0xFF, 0xE7, 0xC3, 0xC3, 0xE7, 0xFF, 0xFF},
                    150:     {0x00, 0x3C, 0x66, 0x42, 0x42, 0x66, 0x3C, 0x00},
                    151:     {0xFF, 0xC3, 0x99, 0xBD, 0xBD, 0x99, 0xC3, 0xFF},
                    152:     {0x0F, 0x07, 0x0F, 0x7D, 0xCC, 0xCC, 0xCC, 0x78},
                    153:     {0x3C, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18},
                    154:     {0x3F, 0x33, 0x3F, 0x30, 0x30, 0x70, 0xF0, 0xE0},
                    155:     {0x7F, 0x63, 0x7F, 0x63, 0x63, 0x67, 0xE6, 0xC0},
                    156:     {0x99, 0x5A, 0x3C, 0xE7, 0xE7, 0x3C, 0x5A, 0x99},
                    157:     {0x80, 0xE0, 0xF8, 0xFE, 0xF8, 0xE0, 0x80, 0x00},
                    158:     {0x02, 0x0E, 0x3E, 0xFE, 0x3E, 0x0E, 0x02, 0x00},
                    159:     {0x18, 0x3C, 0x7E, 0x18, 0x18, 0x7E, 0x3C, 0x18},
                    160:     {0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x66, 0x00},
                    161:     {0x7F, 0xDB, 0xDB, 0x7B, 0x1B, 0x1B, 0x1B, 0x00},
                    162:     {0x3E, 0x63, 0x38, 0x6C, 0x6C, 0x38, 0x86, 0xFC},
                    163:     {0x00, 0x00, 0x00, 0x00, 0x7E, 0x7E, 0x7E, 0x00},
                    164:     {0x18, 0x3C, 0x7E, 0x18, 0x7E, 0x3C, 0x18, 0xFF},
                    165:     {0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00},
                    166:     {0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00},
                    167:     {0x00, 0x18, 0x0C, 0xFE, 0x0C, 0x18, 0x00, 0x00},
                    168:     {0x00, 0x30, 0x60, 0xFE, 0x60, 0x30, 0x00, 0x00},
                    169:     {0x00, 0x00, 0xC0, 0xC0, 0xC0, 0xFE, 0x00, 0x00},
                    170:     {0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00},
                    171:     {0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x00, 0x00},
                    172:     {0x00, 0xFF, 0xFF, 0x7E, 0x3C, 0x18, 0x00, 0x00},
                    173:     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
                    174:     {0x18, 0x3C, 0x3C, 0x18, 0x18, 0x00, 0x18, 0x00},
                    175:     {0x6C, 0x6C, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00},
                    176:     {0x6C, 0x6C, 0xFE, 0x6C, 0xFE, 0x6C, 0x6C, 0x00},
                    177:     {0x18, 0x7E, 0xC0, 0x7C, 0x06, 0xFC, 0x18, 0x00},
                    178:     {0x00, 0xC6, 0xCC, 0x18, 0x30, 0x66, 0xC6, 0x00},
                    179:     {0x38, 0x6C, 0x38, 0x76, 0xDC, 0xCC, 0x76, 0x00},
                    180:     {0x30, 0x30, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00},
                    181:     {0x18, 0x30, 0x60, 0x60, 0x60, 0x30, 0x18, 0x00},
                    182:     {0x60, 0x30, 0x18, 0x18, 0x18, 0x30, 0x60, 0x00},
                    183:     {0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00},
                    184:     {0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00},
                    185:     {0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x30},
                    186:     {0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00},
                    187:     {0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x00},
                    188:     {0x06, 0x0C, 0x18, 0x30, 0x60, 0xC0, 0x80, 0x00},
                    189:     {0x7C, 0xCE, 0xDE, 0xF6, 0xE6, 0xC6, 0x7C, 0x00},
                    190:     {0x30, 0x70, 0x30, 0x30, 0x30, 0x30, 0xFC, 0x00},
                    191:     {0x78, 0xCC, 0x0C, 0x38, 0x60, 0xCC, 0xFC, 0x00},
                    192:     {0x78, 0xCC, 0x0C, 0x38, 0x0C, 0xCC, 0x78, 0x00},
                    193:     {0x1C, 0x3C, 0x6C, 0xCC, 0xFE, 0x0C, 0x1E, 0x00},
                    194:     {0xFC, 0xC0, 0xF8, 0x0C, 0x0C, 0xCC, 0x78, 0x00},
                    195:     {0x38, 0x60, 0xC0, 0xF8, 0xCC, 0xCC, 0x78, 0x00},
                    196:     {0xFC, 0xCC, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x00},
                    197:     {0x78, 0xCC, 0xCC, 0x78, 0xCC, 0xCC, 0x78, 0x00},
                    198:     {0x78, 0xCC, 0xCC, 0x7C, 0x0C, 0x18, 0x70, 0x00},
                    199:     {0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x00},
                    200:     {0x00, 0x18, 0x18, 0x00, 0x00, 0x18, 0x18, 0x30},
                    201:     {0x18, 0x30, 0x60, 0xC0, 0x60, 0x30, 0x18, 0x00},
                    202:     {0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00},
                    203:     {0x60, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x60, 0x00},
                    204:     {0x3C, 0x66, 0x0C, 0x18, 0x18, 0x00, 0x18, 0x00},
                    205:     {0x7C, 0xC6, 0xDE, 0xDE, 0xDC, 0xC0, 0x7C, 0x00},
                    206:     {0x30, 0x78, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0x00},
                    207:     {0xFC, 0x66, 0x66, 0x7C, 0x66, 0x66, 0xFC, 0x00},
                    208:     {0x3C, 0x66, 0xC0, 0xC0, 0xC0, 0x66, 0x3C, 0x00},
                    209:     {0xF8, 0x6C, 0x66, 0x66, 0x66, 0x6C, 0xF8, 0x00},
                    210:     {0xFE, 0x62, 0x68, 0x78, 0x68, 0x62, 0xFE, 0x00},
                    211:     {0xFE, 0x62, 0x68, 0x78, 0x68, 0x60, 0xF0, 0x00},
                    212:     {0x3C, 0x66, 0xC0, 0xC0, 0xCE, 0x66, 0x3A, 0x00},
                    213:     {0xCC, 0xCC, 0xCC, 0xFC, 0xCC, 0xCC, 0xCC, 0x00},
                    214:     {0x78, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00},
                    215:     {0x1E, 0x0C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78, 0x00},
                    216:     {0xE6, 0x66, 0x6C, 0x78, 0x6C, 0x66, 0xE6, 0x00},
                    217:     {0xF0, 0x60, 0x60, 0x60, 0x62, 0x66, 0xFE, 0x00},
                    218:     {0xC6, 0xEE, 0xFE, 0xFE, 0xD6, 0xC6, 0xC6, 0x00},
                    219:     {0xC6, 0xE6, 0xF6, 0xDE, 0xCE, 0xC6, 0xC6, 0x00},
                    220:     {0x38, 0x6C, 0xC6, 0xC6, 0xC6, 0x6C, 0x38, 0x00},
                    221:     {0xFC, 0x66, 0x66, 0x7C, 0x60, 0x60, 0xF0, 0x00},
                    222:     {0x7C, 0xC6, 0xC6, 0xC6, 0xD6, 0x7C, 0x0E, 0x00},
                    223:     {0xFC, 0x66, 0x66, 0x7C, 0x6C, 0x66, 0xE6, 0x00},
                    224:     {0x7C, 0xC6, 0xE0, 0x78, 0x0E, 0xC6, 0x7C, 0x00},
                    225:     {0xFC, 0xB4, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00},
                    226:     {0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xFC, 0x00},
                    227:     {0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00},
                    228:     {0xC6, 0xC6, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00},
                    229:     {0xC6, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0xC6, 0x00},
                    230:     {0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x30, 0x78, 0x00},
                    231:     {0xFE, 0xC6, 0x8C, 0x18, 0x32, 0x66, 0xFE, 0x00},
                    232:     {0x78, 0x60, 0x60, 0x60, 0x60, 0x60, 0x78, 0x00},
                    233:     {0xC0, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x02, 0x00},
                    234:     {0x78, 0x18, 0x18, 0x18, 0x18, 0x18, 0x78, 0x00},
                    235:     {0x10, 0x38, 0x6C, 0xC6, 0x00, 0x00, 0x00, 0x00},
                    236:     {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF},
                    237:     {0x30, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00},
                    238:     {0x00, 0x00, 0x78, 0x0C, 0x7C, 0xCC, 0x76, 0x00},
                    239:     {0xE0, 0x60, 0x60, 0x7C, 0x66, 0x66, 0xDC, 0x00},
                    240:     {0x00, 0x00, 0x78, 0xCC, 0xC0, 0xCC, 0x78, 0x00},
                    241:     {0x1C, 0x0C, 0x0C, 0x7C, 0xCC, 0xCC, 0x76, 0x00},
                    242:     {0x00, 0x00, 0x78, 0xCC, 0xFC, 0xC0, 0x78, 0x00},
                    243:     {0x38, 0x6C, 0x64, 0xF0, 0x60, 0x60, 0xF0, 0x00},
                    244:     {0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8},
                    245:     {0xE0, 0x60, 0x6C, 0x76, 0x66, 0x66, 0xE6, 0x00},
                    246:     {0x30, 0x00, 0x70, 0x30, 0x30, 0x30, 0x78, 0x00},
                    247:     {0x0C, 0x00, 0x1C, 0x0C, 0x0C, 0xCC, 0xCC, 0x78},
                    248:     {0xE0, 0x60, 0x66, 0x6C, 0x78, 0x6C, 0xE6, 0x00},
                    249:     {0x70, 0x30, 0x30, 0x30, 0x30, 0x30, 0x78, 0x00},
                    250:     {0x00, 0x00, 0xCC, 0xFE, 0xFE, 0xD6, 0xD6, 0x00},
                    251:     {0x00, 0x00, 0xB8, 0xCC, 0xCC, 0xCC, 0xCC, 0x00},
                    252:     {0x00, 0x00, 0x78, 0xCC, 0xCC, 0xCC, 0x78, 0x00},
                    253:     {0x00, 0x00, 0xDC, 0x66, 0x66, 0x7C, 0x60, 0xF0},
                    254:     {0x00, 0x00, 0x76, 0xCC, 0xCC, 0x7C, 0x0C, 0x1E},
                    255:     {0x00, 0x00, 0xDC, 0x76, 0x62, 0x60, 0xF0, 0x00},
                    256:     {0x00, 0x00, 0x7C, 0xC0, 0x70, 0x1C, 0xF8, 0x00},
                    257:     {0x10, 0x30, 0xFC, 0x30, 0x30, 0x34, 0x18, 0x00},
                    258:     {0x00, 0x00, 0xCC, 0xCC, 0xCC, 0xCC, 0x76, 0x00},
                    259:     {0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x78, 0x30, 0x00},
                    260:     {0x00, 0x00, 0xC6, 0xC6, 0xD6, 0xFE, 0x6C, 0x00},
                    261:     {0x00, 0x00, 0xC6, 0x6C, 0x38, 0x6C, 0xC6, 0x00},
                    262:     {0x00, 0x00, 0xCC, 0xCC, 0xCC, 0x7C, 0x0C, 0xF8},
                    263:     {0x00, 0x00, 0xFC, 0x98, 0x30, 0x64, 0xFC, 0x00},
                    264:     {0x1C, 0x30, 0x30, 0xE0, 0x30, 0x30, 0x1C, 0x00},
                    265:     {0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00},
                    266:     {0xE0, 0x30, 0x30, 0x1C, 0x30, 0x30, 0xE0, 0x00},
                    267:     {0x76, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
                    268:     {0x00, 0x10, 0x38, 0x6C, 0xC6, 0xC6, 0xFE, 0x00}
                    269: };
                    270:
                    271: void g_set(int x, int y, int color);   /* part of SVGA */
                    272:
                    273: void g_string(x0, y0, color, angle, s)
                    274: /* upper left corner of text, color and angle */
                    275: int x0, y0, color, angle;
                    276: char *s;
                    277: {
                    278:     int i, j, k;
                    279:     float sa, ca, x, y;
                    280:     k = 0;
                    281:     x = 0.5 + x0;
                    282:     y = 0.5 + y0;
                    283:     sa = sin(-Pi * angle / 180);
                    284:     ca = cos(Pi * angle / 180);
                    285:     while (s[k]) {
                    286:        for (i = 0; i < 8; i++)
                    287:            for (j = 0; j < 8; j++)
                    288:                g_set(x + ca * j - sa * i, y + ca * i + sa * j, (font[(int) s[k]][i] & (1 << (7 - j))) ? color : 0);
                    289:        k++;
                    290:        x += ca * 8;
                    291:        y += sa * 8;
                    292:     }
                    293: }
                    294:
                    295: /* end of gstring.c */
                    296:
                    297: TERM_PUBLIC void EMXVGA_init()
                    298: {
                    299:     if (!g_mode(EMXVGA_vmode)) {
                    300:        fputs("Unable to initiate graphics.\n", stderr);
                    301:        return;
                    302:     }
                    303:     term->xmax = g_xsize;
                    304:     term->ymax = g_ysize;
                    305:     lasty = g_ysize - 1;
                    306: }
                    307: TERM_PUBLIC void EMXVGA_reset()
                    308: {
                    309:     g_mode(GTEXT);
                    310:     graphics_on = FALSE;
                    311: }
                    312: TERM_PUBLIC void EMXVGA_text()
                    313: {
                    314:     if (graphics_on) {
                    315:        emx_getch();
                    316:        g_mode(GTEXT);
                    317:        graphics_on = FALSE;
                    318:     }
                    319: }
                    320: TERM_PUBLIC void EMXVGA_graphics()
                    321: {
                    322:     if (!graphics_on) {
                    323:        g_mode(EMXVGA_vmode);
                    324:        graphics_on = TRUE;
                    325:     }
                    326: }
                    327: TERM_PUBLIC void EMXVGA_linetype(linetype)
                    328: int linetype;
                    329: {
                    330:     EMXVGA_color = vgacolor[(linetype % 13) + 2];
                    331: }
                    332: TERM_PUBLIC void EMXVGA_move(x, y)
                    333: unsigned int x, y;
                    334: {
                    335:     startx = x;
                    336:     starty = y;
                    337: }
                    338: TERM_PUBLIC void EMXVGA_vector(x, y)
                    339: unsigned int x, y;
                    340: {
                    341:     g_line(startx, lasty - starty, x, lasty - y, EMXVGA_color);
                    342:     startx = x;
                    343:     starty = y;
                    344: }
                    345: TERM_PUBLIC int EMXVGA_text_angle(ang)
                    346: int ang;
                    347: {
                    348:     EMXVGA_angle = ang * 90;
                    349:     return (TRUE);
                    350: }
                    351: TERM_PUBLIC void EMXVGA_put_text(x, y, str)
                    352: unsigned int x, y;
                    353: char *str;
                    354: {
                    355:     g_string(x, lasty - y - 3, EMXVGA_color, EMXVGA_angle, str);
                    356: }
                    357: TERM_PUBLIC void EMXVGA_suspend()
                    358: {
                    359:     if (EMXVGA_buf)
                    360:        free(EMXVGA_buf);       /* do this just for safety */
                    361:     EMXVGA_buf = (char *) malloc(g_memsize);
                    362:     g_save(EMXVGA_buf);
                    363:     emx_getch();
                    364:     g_mode(GTEXT);
                    365: }
                    366: TERM_PUBLIC void EMXVGA_resume()
                    367: {
                    368:     g_mode(EMXVGA_vmode);
                    369:     g_restore(EMXVGA_buf);
                    370:     free(EMXVGA_buf);
                    371: }
                    372:
                    373: #ifdef EMXVESA
                    374: int emx_vesamode = G640x480x256;
                    375: int emx_xlast, emx_ylast;
                    376: TERM_PUBLIC void EMXVESA_options()
                    377: {
                    378:     if (!END_OF_COMMAND) {
                    379:        if (almost_equals(c_token, "d$efault")) {
                    380:            emx_vesamode = G640x480x256;
                    381:            c_token++;
                    382:        }
                    383:     }
                    384:     if (!END_OF_COMMAND) {
                    385:        /* We have a vesa mode specified */
                    386:        struct value a;
                    387:        emx_vesamode = (int) real(const_express(&a));
                    388:     }
                    389:     sprintf(term_options, "%d", emx_vesamode);
                    390: }
                    391: TERM_PUBLIC void EMXVESA_init()
                    392: {
                    393:     if (!g_mode(emx_vesamode))
                    394:        int_error("Couldn't select graphics mode", NO_CARET);
                    395:     emx_xlast = g_xsize - 1;
                    396:     term->xmax = emx_xlast + 1;
                    397:     emx_ylast = g_ysize - 1;
                    398:     term->ymax = emx_ylast + 1;
                    399:     g_mode(GTEXT);
                    400: }
                    401: TERM_PUBLIC void EMXVESA_graphics()
                    402: {
                    403:     g_mode(emx_vesamode);
                    404: }
                    405: TERM_PUBLIC void EMXVESA_text()
                    406: {
                    407:     int ch;
                    408:     ch = getch();
                    409:     g_mode(GTEXT);
                    410:     if (ch == 3)
                    411:        int_error("Interrupt", NO_CARET);
                    412: }
                    413: TERM_PUBLIC void EMXVESA_reset()
                    414: {
                    415: }
                    416:
                    417: #endif /* VESA */
                    418: #endif /* TERM_BODY */
                    419:
                    420: #ifdef TERM_TABLE
                    421: #ifdef EMXVESA
                    422: TERM_TABLE_START(vesa_driver)
                    423:     "vesa", "IBM PC/Clone with VESA SVGA graphics board [vesa mode]",
                    424:     EMXVGA_XMAX, EMXVGA_YMAX, EMXVGA_VCHAR, EMXVGA_HCHAR,
                    425:     EMXVGA_VTIC, EMXVGA_HTIC, EMXVESA_options, EMXVESA_init, EMXVESA_reset,
                    426:     EMXVESA_text, null_scale, EMXVESA_graphics, EMXVGA_move, EMXVGA_vector,
                    427:     EMXVGA_linetype, EMXVGA_put_text, EMXVGA_text_angle,
                    428:     null_justify_text, do_point, do_arrow, set_font_null
                    429: TERM_TABLE_END(vesa_driver)
                    430:
                    431: #undef LAST_TERM
                    432: #define LAST_TERM vesa_driver
                    433:
                    434: #endif /* VESA */
                    435:
                    436: TERM_TABLE_START(emxvga_driver)
                    437:     "emxvga", "PC with VGA running DOS or OS/2",
                    438:     EMXVGA_XMAX, EMXVGA_YMAX, EMXVGA_VCHAR, EMXVGA_HCHAR,
                    439:     EMXVGA_VTIC, EMXVGA_HTIC, options_null, EMXVGA_init, EMXVGA_reset,
                    440:     EMXVGA_text, null_scale, EMXVGA_graphics, EMXVGA_move,
                    441:     EMXVGA_vector, EMXVGA_linetype, EMXVGA_put_text, EMXVGA_text_angle,
                    442:     null_justify_text, do_point, do_arrow, set_font_null,
                    443:     0,                         /* pointsize */
                    444:     TERM_CAN_MULTIPLOT, EMXVGA_suspend, EMXVGA_resume
                    445: TERM_TABLE_END(emxvga_driver)
                    446:
                    447: #undef LAST_TERM
                    448: #define LAST_TERM emxvga_driver
                    449:
                    450: #endif /* TERM_TABLE */
                    451: #endif /* TERM_PROTO_ONLY */
                    452: #ifdef TERM_HELP
                    453: START_HELP(emxvga)
                    454: "1 emxvga",
                    455: "?commands set terminal emxvga",
                    456: "?set terminal emxvga",
                    457: "?set term emxvga",
                    458: "?terminal emxvga",
                    459: "?term emxvga",
                    460: "?emxvga",
                    461: "?commands set terminal emxvesa",
                    462: "?set terminal emxvesa",
                    463: "?set term emxvesa",
                    464: "?terminal emxvesa",
                    465: "?term emxvesa",
                    466: "?emxvesa",
                    467: "?commands set terminal vgal",
                    468: "?set terminal vgal",
                    469: "?set term vgal",
                    470: "?terminal vgal",
                    471: "?term vgal",
                    472: "?vgal",
                    473: " The `emxvga`, `emxvesa` and `vgal` terminal drivers support PCs with SVGA,",
                    474: " vesa SVGA and VGA graphics boards, respectively.  They are intended to be",
                    475: " compiled with \"emx-gcc\" under either DOS or OS/2.  They also need VESA and",
                    476: " SVGAKIT maintained by Johannes Martin (JMARTIN@GOOFY.ZDV.UNI-MAINZ.DE) with",
                    477: " additions by David J. Liu (liu@phri.nyu.edu).",
                    478: "",
                    479: " Syntax:",
                    480: "       set terminal emxvga",
                    481: "       set terminal emxvesa {vesa-mode}",
                    482: "       set terminal vgal",
                    483: "",
                    484: " The only option is the vesa mode for `emxvesa`, which defaults to G640x480x256."
                    485: END_HELP(emxvga)
                    486: #endif /* TERM_HELP */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>