/* prototypes for this file are in pc.trm-proto */ /* GNUPLOT - pc.trm */ /* * Copyright (C) 1990 * * 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. * * This terminal driver supports: * Under Microsoft C * cga, egabios, egalib, vgabios, hercules, corona325, att * Under Turboc C * egalib, vgalib, vgamono, mcga, cga, hercules, att * * AUTHORS * Colin Kelley, Thomas Williams, William Wilson, Russell Lang * * send your comments or suggestions to (pixar!info-gnuplot@sun.com). * */ #if defined(__TURBOC__) && !defined(__BORLANDC__) #include "c:\borlandc\include\graphics.h" #include int g_driver, g_mode, g_error; char *path=NULL; char *pathp, path_s[128]; /* instead of string.h */ int get_path(void) { path= getenv("BGI"); if (path==NULL) { (void) strcpy_ss(path_s, _argv[0]); pathp=strrchr(path_s, '\\'); *pathp=0x00; path=path_s; } } #endif /* __TURBOC__ */ static char near buf[80]; /* kludge since EGA.LIB is compiled SMALL */ 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 pause() /* press any key to continue... */ { /* disabled--M.Borland while (kbhit()) (void) getch(); while (!kbhit()) ; */ } int PC_text(void) { if (graphics__on) { graphics__on = FALSE; pause(); } #if defined(__TURBOC__) && !defined(__BORLANDC__) closegraph(); #else Vmode(3); #endif } int PC_reset(void) { #if defined(__TURBOC__) && !defined(__BORLANDC__) closegraph(); #endif } #if !defined(__TURBOC__) || defined(__BORLANDC__) int PC_putc(int x, int y, char c, int angle, FUNC_PTR line_func) { int i, j, k; int pixelon; i = (int)(c) - 32; for (j=0; j> k & 1); if (pixelon) { switch(angle) { case 0 : (*line_func)(x+k+1, y-j, x+k+1, y-j); break; case 1 : (*line_func)(x-j, y-k-1, x-j, y-k-1); break; } } } } } int PC_text_angle(int ang) { pc_angle=ang; return TRUE; } #define CGA_XMAX 640 #define CGA_YMAX 200 #define CGA_XLAST (CGA_XMAX - 1) #define CGA_YLAST (CGA_YMAX - 1) #define CGA_VCHAR PC_VCHAR #define CGA_HCHAR PC_HCHAR #define CGA_VTIC 4 #define CGA_HTIC 6 int line_cga; int CGA_init(void) { PC_color(1); /* monochrome */ } int CGA_graphics(void) { graphics__on = TRUE; Vmode(6); } #define CGA_text PC_text int CGA_linetype(int linetype) { if (linetype >= 5) linetype %= 5; line_cga=linetype; PC_mask(pattern[linetype+2]); } CGA_move(int x, int y) { startx = x; starty = y; } CGA_vector(int x, int y) { PC_line(startx, CGA_YLAST-starty, x, CGA_YLAST-y); startx = x; starty = y; } int CGA_put_text(int x, int y, char *str) { int i; int line; line= line_cga; /* disable the dotted lines temporarily */ PC_mask(pattern[0]); switch(pc_angle) { case 0 : y -= CGA_VCHAR/2; break; case 1 : x += CGA_VCHAR/2; break; } for (i=0;str[i];i++) { PC_putc(x, CGA_YLAST-y, str[i], pc_angle, PC_line); switch(pc_angle) { case 0 : x+=CGA_HCHAR ; break; case 1 : y+=CGA_HCHAR ; break; } } PC_mask(pattern[line]); /* enable dotted lines */ } #define CGA_text_angle PC_text_angle #define CGA_reset PC_reset #define EGA_XMAX 640 #define EGA_YMAX 350 #define EGA_XLAST (EGA_XMAX - 1) #define EGA_YLAST (EGA_YMAX - 1) #define EGA_VCHAR PC_VCHAR #define EGA_HCHAR PC_HCHAR #define EGA_VTIC 4 #define EGA_HTIC 5 static int ega64color[] = {1, 1, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5}; static int ega256color[] = {7, 8, 2, 3, 4, 5, 9, 14, 12, 15, 13, 10, 11, 1, 6}; static int *egacolor; int EGA_init(void) { PC_mask(0xffff); egacolor = ega256color; /* should be smarter */ } int EGA_graphics(void) { graphics__on = TRUE; Vmode(16); } #define EGA_text PC_text int EGA_linetype(int linetype) { if (linetype >= 13) linetype %= 13; PC_color(egacolor[linetype+2]); } EGA_move(int x, int y) { startx = x; starty = y; } EGA_vector(int x, int y) { PC_line(startx, EGA_YLAST-starty, x, EGA_YLAST-y); startx = x; starty = y; } int EGA_put_text(int x, int y, char *str) { int i; switch(pc_angle) { case 0 : y -= EGA_VCHAR/2; break; case 1 : x += EGA_VCHAR/2; break; } for (i=0;str[i];i++) { PC_putc(x, EGA_YLAST-y, str[i], pc_angle, PC_line); switch(pc_angle) { case 0 : x+=EGA_HCHAR ; break; case 1 : y+=EGA_HCHAR ; break; } } } #define EGA_text_angle PC_text_angle #define EGA_reset PC_reset /* The following VGA routines are hacked from the above EGA routines They worked on two VGA cards. Russell Lang, eln272v@monu1.cc.monash.oz */ #define VGA_XMAX 640 #define VGA_YMAX 480 #define VGA_XLAST (VGA_XMAX - 1) #define VGA_YLAST (VGA_YMAX - 1) #define VGA_VCHAR PC_VCHAR #define VGA_HCHAR PC_HCHAR #define VGA_VTIC 5 #define VGA_HTIC 5 static int vga256color[] = {7, 8, 2, 3, 4, 5, 9, 14, 12, 15, 13, 10, 11, 1, 6}; static int *vgacolor; int VGA_init(void) { PC_mask(0xffff); vgacolor = vga256color; /* should be smarter */ } int VGA_graphics(void) { graphics__on = TRUE; Vmode(18); } #define VGA_text PC_text int VGA_linetype(int linetype) { if (linetype >= 13) linetype %= 13; PC_color(vgacolor[linetype+2]); } VGA_move(int x, int y) { startx = x; starty = y; } VGA_vector(int x, int y) { PC_line(startx, VGA_YLAST-starty, x, VGA_YLAST-y); startx = x; starty = y; } int VGA_put_text(int x, int y, char *str) { int i; switch(pc_angle) { case 0 : y -= VGA_VCHAR/2; break; case 1 : x += VGA_VCHAR/2; break; } for (i=0;str[i];i++) { PC_putc(x, VGA_YLAST-y, str[i], pc_angle, PC_line); switch(pc_angle) { case 0 : x+=VGA_HCHAR ; break; case 1 : y+=VGA_HCHAR ; break; } } } #define VGA_text_angle PC_text_angle #define VGA_reset PC_reset #ifdef EGALIB #define EGALIB_XMAX 640 #define EGALIB_YMAX 350 #define EGALIB_XLAST (EGA_XMAX - 1) #define EGALIB_YLAST (EGA_YMAX - 1) #define EGALIB_VCHAR 14 #define EGALIB_HCHAR 8 #define EGALIB_VTIC 4 #define EGALIB_HTIC 5 #include "mcega.h" int EGALIB_init(void) { GPPARMS(); if (GDTYPE != 5) { term = 0; int_error("color EGA board not found", NO_CARET); } egacolor = (GDMEMORY < 256) ? ega64color : ega256color; } int EGALIB_graphics(void) { graphics__on = TRUE; GPINIT(); } int EGALIB_text(void) { if (graphics__on) { graphics__on = FALSE; pause(); } GPTERM(); } int EGALIB_linetype(int linetype) { if (linetype >= 13) linetype %= 13; GPCOLOR(egacolor[linetype+2]); } EGALIB_move(int x, int y) { GPMOVE(x, GDMAXROW-y); } EGALIB_vector(int x, int y) { GPLINE(x, GDMAXROW-y); } int EGALIB_put_text(int x, int y, char *str) { strcpy_ss((char far *)buf, str); GotoXY((int)(x/EGALIB_HCHAR), (int)((EGALIB_YMAX-y-(EGALIB_VCHAR/2))/EGALIB_VCHAR)); gprintf(buf); } #define EGALIB_reset PC_reset #endif /* EGALIB */ #ifdef HERCULES #define HERC_XMAX 720 #define HERC_YMAX 348 #define HERC_XLAST (HERC_XMAX - 1) #define HERC_YLAST (HERC_YMAX - 1) #define HERC_VCHAR PC_VCHAR #define HERC_HCHAR PC_HCHAR #define HERC_VTIC 4 #define HERC_HTIC 5 int line_herc; int HERC_init(void) { H_init(); } int HERC_graphics(void) { HVmode(1); graphics__on = TRUE; } int HERC_text(void) { if (graphics__on) { graphics__on = FALSE; pause(); } HVmode(0); } int HERC_linetype(int linetype) { if (linetype >= 5) linetype %= 5; H_mask(pattern[linetype+2]); line_herc = linetype; } HERC_move(int x, int y) { if (x < 0) startx = 0; else if (x > HERC_XLAST) startx = HERC_XLAST; else startx = x; if (y < 0) starty = 0; else if (y > HERC_YLAST) starty = HERC_YLAST; else starty = y; } HERC_vector(int x, int y) { if (x < 0) x = 0; else if (x > HERC_XLAST) x = HERC_XLAST; if (y < 0) y = 0; else if (y > HERC_YLAST) y = HERC_YLAST; H_line(startx, HERC_YLAST-starty, x, HERC_YLAST-y); startx = x; starty = y; } int HERC_put_text(int x, int y, char *str) { int i; int line; line= line_herc; /* disable the dotted lines temporarily */ H_mask(pattern[0]); switch(pc_angle) { case 0 : y -= HERC_VCHAR/2; break; case 1 : x += HERC_VCHAR/2; break; } for (i=0;str[i];i++) { PC_putc(x, HERC_YLAST-y, str[i], pc_angle, H_line); switch(pc_angle) { case 0 : x+=HERC_HCHAR ; break; case 1 : y+=HERC_HCHAR ; break; } } H_mask(pattern[line]); /* enable dotted lines */ } #define HERC_text_angle PC_text_angle #define HERC_reset PC_reset #endif /* HERCULES */ /* thanks to sask!macphed (Geoff Coleman and Ian Macphedran) for the ATT 6300 driver */ #ifdef ATT6300 #define ATT_XMAX 640 #define ATT_YMAX 400 #define ATT_XLAST (ATT_XMAX - 1) #define ATT_YLAST (ATT_YMAX - 1) #define ATT_VCHAR PC_VCHAR #define ATT_HCHAR PC_HCHAR #define ATT_VTIC 4 #define ATT_HTIC 5 #define ATT_init CGA_init int ATT_graphics(void) { graphics__on = TRUE; Vmode(0x40); /* 40H is the magic number for the AT&T driver */ } #define ATT_text CGA_text #define ATT_linetype CGA_linetype #define ATT_move CGA_move ATT_vector(int x, int y) { PC_line(startx, ATT_YLAST-starty, x, ATT_YLAST-y); startx = x; starty = y; } int ATT_put_text(int x, int y, char *str) { int i; int line; line= line_cga; /* disable the dotted lines temporarily */ PC_mask(pattern[0]); switch(pc_angle) { case 0 : y -= ATT_VCHAR/2; break; case 1 : x += ATT_VCHAR/2; break; } for (i=0;str[i];i++) { PC_putc(x, ATT_YLAST-y, str[i], pc_angle, PC_line); switch(pc_angle) { case 0 : x+=ATT_HCHAR ; break; case 1 : y+=ATT_HCHAR ; break; } } PC_mask(pattern[line]); /* enable dotted lines */ } #define ATT_text_angle PC_text_angle #define ATT_reset CGA_reset #endif /* ATT6300 */ #ifdef CORONA #define COR_XMAX 640 #define COR_YMAX 325 #define COR_XLAST (COR_XMAX - 1) #define COR_YLAST (COR_YMAX - 1) #define COR_VCHAR PC_VCHAR #define COR_HCHAR PC_HCHAR #define COR_VTIC 4 #define COR_HTIC 5 int line_cor; static int corscreen; /* screen number, 0 - 7 */ int COR_init(void) { register char *p; if (!(p = getenv("CORSCREEN"))) int_error("must run CORPLOT for Corona graphics", NO_CARET); corscreen = *p - '0'; } int COR_graphics(void) { graphics__on = TRUE; Vmode(3); /* clear text screen */ grinit(corscreen); grandtx(); } int COR_text(void) { if (graphics__on) { graphics__on = FALSE; pause(); } grreset(); txonly(); Vmode(3); } int COR_linetype(int linetype) { if (linetype >= 5) linetype %= 5; line_cor = linetype; Cor_mask(pattern[linetype+2]); } COR_move(int x, int y) { if (x < 0) startx = 0; else if (x > COR_XLAST) startx = COR_XLAST; else startx = x; if (y < 0) starty = 0; else if (y > COR_YLAST) starty = COR_YLAST; else starty = y; } COR_vector(int x, int y) { if (x < 0) x = 0; else if (x > COR_XLAST) x = COR_XLAST; if (y < 0) y = 0; else if (y > COR_YLAST) y = COR_YLAST; Cor_line(startx, COR_YLAST-starty, x, COR_YLAST-y); startx = x; starty = y; } int COR_put_text(int x, int y, char *str) { int i; int line; line= line_cor; /* disable the dotted lines temporarily */ Cor_mask(pattern[0]); switch(pc_angle) { case 0 : y -= COR_VCHAR/2; break; case 1 : x += COR_VCHAR/2; break; } for (i=0;str[i];i++) { PC_putc(x, COR_YLAST-y, str[i], pc_angle, Cor_line); switch(pc_angle) { case 0 : x+=COR_HCHAR ; break; case 1 : y+=COR_HCHAR ; break; } } COR_mask(pattern[line]); /* enable dotted lines */ } #define COR_text_angle PC_text_angle #define COR_reset PC_reset #endif /* CORONA */ #else /* ifndef __TURBOC__ */ /* all of the Turbo C routines for the different graphics devices go here */ int PC_text_angle(int ang) { pc_angle = ang; switch (ang) { case 0 : settextstyle(DEFAULT_FONT, HORIZ_DIR, 1); break; case 1 : settextstyle(DEFAULT_FONT, VERT_DIR, 1); break; } return TRUE; } int PC_justify_text(enum JUSTIFY mode) { switch(mode) { case LEFT : settextjustify(LEFT_TEXT, CENTER_TEXT); break; case CENTRE : settextjustify(CENTER_TEXT, CENTER_TEXT); break; case RIGHT: settextjustify(RIGHT_TEXT, CENTER_TEXT); break; } return TRUE; } #define VGA_XMAX 640 #define VGA_YMAX 480 #define VGA_XLAST (VGA_XMAX - 1) #define VGA_YLAST (VGA_YMAX - 1) #define VGA_VCHAR 10 #define VGA_HCHAR 8 #define VGA_VTIC 4 #define VGA_HTIC 5 static int vga256color[] = {7, 8, 2, 3, 4, 5, 9, 14, 12, 15, 13, 10, 11, 1, 6}; static int *vgacolor; #define VGA_reset EGALIB_reset #define VGA_text EGALIB_text #define VGA_move EGALIB_move #define VGA_vector EGALIB_vector #define VGA_text_angle PC_text_angle #define VGA_justify_text PC_justify_text int VGA_init(void) { g_driver=VGA; g_mode=2; get_path(); initgraph(&g_driver, &g_mode, path); if(g_driver!=9){ term=0; switch (g_driver){ case -2: fprintf(stderr, "Graphics card not detected.\n"); break; case -3: fprintf(stderr, "BGI driver file cannot be found.\n"); fprintf(stderr, "path to BGI directory is %s\n", path); break; case -4: fprintf(stderr, "Invalid BGI driver file.\n"); break; case -5: fprintf(stderr, "Insufficient memory to load ", "graphics driver."); break; } /* int_error("color VGA board not found", NO_CARET);*/ } if(g_driver==VGA) vgacolor=vga256color; } int VGA_graphics(void) { g_driver=VGA; g_mode=2; graphics__on = TRUE; initgraph(&g_driver, &g_mode, path); VGA_justify_text(LEFT); } int VGA_linetype(int linetype) { if (linetype >= 13) linetype %= 13; setcolor(vgacolor[linetype+2]); } int VGA_put_text(int x, int y, char *str) { strcpy_ss((char far *)buf, str); outtextxy(x, VGA_YLAST-y, buf); } int VGAMONO_linetype(int linetype) { if (linetype >= 5) linetype %= 5; setlinestyle(4, pattern[linetype+2], 1); } #define MCGA_XMAX 640 #define MCGA_YMAX 480 #define MCGA_XLAST (MCGA_XMAX - 1) #define MCGA_YLAST (MCGA_YMAX - 1) #define MCGA_VCHAR 10 #define MCGA_HCHAR 8 #define MCGA_VTIC 4 #define MCGA_HTIC 5 static int *MCGAcolor; #define MCGA_reset EGALIB_reset #define MCGA_text EGALIB_text #define MCGA_move EGALIB_move #define MCGA_vector EGALIB_vector #define MCGA_text_angle PC_text_angle #define MCGA_justify_text PC_justify_text int MCGA_init(void) { g_driver=MCGA; g_mode=5; initgraph(&g_driver, &g_mode, path); if(g_driver!=2){ term=0; switch (g_driver){ case -2: fprintf(stderr, "Graphics card not detected.\n"); break; case -3: fprintf(stderr, "BGI driver file cannot be found.\n"); break; case -4: fprintf(stderr, "Invalid BGI driver file.\n"); break; case -5: fprintf(stderr, "Insufficient memory to load ", "graphics driver."); break; } } } int MCGA_graphics(void) { g_driver=MCGA; g_mode=5; graphics__on = TRUE; initgraph(&g_driver, &g_mode, path); MCGA_justify_text(LEFT); } int MCGA_put_text(int x, int y, char *str) { strcpy_ss((char far *)buf, str); outtextxy(x, MCGA_YLAST-y, buf); } int MCGA_linetype(int linetype) { if (linetype >= 5) linetype %= 5; setlinestyle(4, pattern[linetype+2], 1); } #define EGALIB_XMAX 640 #define EGALIB_YMAX 350 #define EGALIB_XLAST (EGALIB_XMAX - 1) #define EGALIB_YLAST (EGALIB_YMAX - 1) #define EGALIB_VCHAR 10 #define EGALIB_HCHAR 8 #define EGALIB_VTIC 4 #define EGALIB_HTIC 5 static int ega64color[] = {1, 1, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5, 4, 3, 5}; static int ega256color[] = {7, 8, 2, 3, 4, 5, 9, 14, 12, 15, 13, 10, 11, 1, 6}; static int *egacolor; #define EGALIB_text_angle PC_text_angle #define EGALIB_justify_text PC_justify_text int EGALIB_init(void) { g_driver=EGA; g_mode=1; initgraph(&g_driver, &g_mode, path); if(g_driver<3 || g_driver>4){ term=0; switch (g_driver){ case -2: fprintf(stderr, "Graphics card not detected.\n"); break; case -3: fprintf(stderr, "BGI driver file cannot be found.\n"); break; case -4: fprintf(stderr, "Invalid BGI driver file.\n"); break; case -5: fprintf(stderr, "Insufficient memory to load ", "graphics driver."); break; } /* int_error("color EGA board not found", NO_CARET);*/ } if(g_driver==EGA) egacolor=ega256color; if(g_driver==EGA64) egacolor=ega64color; } int EGALIB_graphics(void) { graphics__on = TRUE; initgraph(&g_driver, &g_mode, path); EGALIB_justify_text(LEFT); } int EGALIB_text(void) { if (graphics__on) { graphics__on = FALSE; pause(); } closegraph(); } int EGALIB_linetype(int linetype) { if (linetype >= 13) linetype %= 13; setcolor(egacolor[linetype+2]); } EGALIB_move(int x, int y) { moveto(x, getmaxy()-y); } EGALIB_vector(int x, int y) { lineto(x, getmaxy()-y); } int EGALIB_put_text(int x, int y, char *str) { strcpy_ss((char far *)buf, str); outtextxy(x, EGALIB_YLAST-y, buf); } int EGALIB_reset(void) { closegraph(); } #define CGA_XMAX 640 #define CGA_YMAX 200 #define CGA_XLAST (CGA_XMAX - 1) #define CGA_YLAST (CGA_YMAX - 1) #define CGA_VCHAR 10 #define CGA_HCHAR 8 #define CGA_VTIC 4 #define CGA_HTIC 6 #define CGA_text_angle PC_text_angle #define CGA_justify_text PC_justify_text #define CGA_reset PC_reset int CGA_init(void) { g_driver=CGA; g_mode=4; initgraph(&g_driver, &g_mode, path); switch (g_driver){ case -2: fprintf(stderr, "Graphics card not detected.\n"); break; case -3: fprintf(stderr, "BGI driver file cannot be found.\n"); break; case -4: fprintf(stderr, "Invalid BGI driver file.\n"); break; case -5: fprintf(stderr, "Insufficient memory to load ", "graphics driver."); break; } /* PC_color(1); monochrome */ } int CGA_graphics(void) { graphics__on = TRUE; g_driver=CGA; g_mode=4; initgraph(&g_driver, &g_mode, path); CGA_justify_text(LEFT); /* Vmode(6);*/ } #define CGA_text PC_text int CGA_linetype(int linetype) { if (linetype >= 5) linetype %= 5; setlinestyle(4, pattern[linetype+2], 1); } CGA_move(int x, int y) { moveto(x, getmaxy()-y); } CGA_vector(int x, int y) { lineto(x, getmaxy()-y); } int CGA_put_text(int x, int y, char *str) { strcpy_ss((char far *)buf, str); outtextxy(x, CGA_YLAST-y, buf); } #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 4 #define HERC_HTIC 5 #define HERC_text_angle PC_text_angle #define HERC_justify_text PC_justify_text #define HERC_reset PC_reset int HERC_init(void) { g_driver=HERCMONO; g_mode=0; initgraph(&g_driver, &g_mode, path); switch (g_driver){ case -2: fprintf(stderr, "Graphics card not detected.\n"); break; case -3: fprintf(stderr, "BGI driver file cannot be found.\n"); break; case -4: fprintf(stderr, "Invalid BGI driver file.\n"); break; case -5: fprintf(stderr, "Insufficient memory to load ", "graphics driver."); break; } } int HERC_graphics(void) { g_driver=HERCMONO; g_mode=0; initgraph(&g_driver, &g_mode, path); HERC_justify_text(LEFT); graphics__on = TRUE; } int HERC_text(void) { if (graphics__on) { graphics__on = FALSE; pause(); } closegraph(); } int HERC_linetype(int linetype) { if (linetype >= 5) linetype %= 5; setlinestyle(4, pattern[linetype+2], 1); } HERC_move(int x, int y) { if (x < 0) x = 0; else if (x > HERC_XLAST) x = HERC_XLAST; if (y < 0) y = 0; else if (y > HERC_YLAST) y = HERC_YLAST; moveto(x, getmaxy()-y); } HERC_vector(int x, int y) { if (x < 0) x = 0; else if (x > HERC_XLAST) x = HERC_XLAST; if (y < 0) y = 0; else if (y > HERC_YLAST) y = HERC_YLAST; lineto(x, getmaxy()-y); } int HERC_put_text(int x, int y, char *str) { strcpy_ss((char far *)buf, str); outtextxy(x, HERC_YLAST-y, buf); } #ifdef ATT6300 /* this driver added by rjl@monu1.cc.monash.edu.au */ #define ATT_XMAX 640 #define ATT_YMAX 400 #define ATT_XLAST (ATT_XMAX - 1) #define ATT_YLAST (ATT_YMAX - 1) #define ATT_VCHAR PC_VCHAR #define ATT_HCHAR PC_HCHAR #define ATT_VTIC 4 #define ATT_HTIC 5 #define ATT_text_angle PC_text_angle #define ATT_justify_text PC_justify_text #define ATT_reset PC_reset int ATT_init(void) { g_driver=ATT400; g_mode=5; initgraph(&g_driver, &g_mode, path); switch (g_driver){ case -2: fprintf(stderr, "Graphics card not detected.\n"); break; case -3: fprintf(stderr, "BGI driver file cannot be found.\n"); break; case -4: fprintf(stderr, "Invalid BGI driver file.\n"); break; case -5: fprintf(stderr, "Insufficient memory to load ", "graphics driver."); break; } } int ATT_graphics(void) { g_driver=ATT400; g_mode=5; initgraph(&g_driver, &g_mode, path); ATT_justify_text(LEFT); graphics__on = TRUE; } int ATT_text(void) { if (graphics__on) { graphics__on = FALSE; pause(); } closegraph(); } int ATT_linetype(int linetype) { if (linetype >= 5) linetype %= 5; setlinestyle(4, pattern[linetype+2], 1); } ATT_move(int x, int y) { if (x < 0) x = 0; else if (x > ATT_XLAST) x = ATT_XLAST; if (y < 0) y = 0; else if (y > ATT_YLAST) y = ATT_YLAST; moveto(x, getmaxy()-y); } ATT_vector(int x, int y) { if (x < 0) x = 0; else if (x > ATT_XLAST) x = ATT_XLAST; if (y < 0) y = 0; else if (y > ATT_YLAST) y = ATT_YLAST; lineto(x, getmaxy()-y); } int ATT_put_text(int x, int y, char *str) { strcpy_ss((char far *)buf, str); outtextxy(x, ATT_YLAST-y, buf); } #endif /* ifdef ATT6300 */ #endif /* ifndef __TURBOC__ */