/* GNUPLOT - linux.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: * VGA 640x480x16 for PC's running the Linux Operating System * * AUTHOR * Tommy Frandsen (frandsen@diku.dk) - original * div - (D.R.Denholm@southampton.ac.uk) * - modified to spawn a process to run the privilege'd part * of the code (ie the vga graphics). Send commands along * a pipe using the Xlib protocol (more or less...) * * send your comments or suggestions to (pixar!info-gnuplot@sun.com). * */ #include /* div - for popen */ #define LINUX_XMAX 640 #define LINUX_YMAX 480 #define LINUX_XLAST (LINUX_XMAX - 1) #define LINUX_YLAST (LINUX_YMAX - 1) #define LINUX_VCHAR FNT5X9_VCHAR #define LINUX_HCHAR FNT5X9_HCHAR #define LINUX_VTIC 5 #define LINUX_HTIC 5 static int graphics_on = FALSE; static int vgacolor[] = {7,8,2,3,4,5,9,14,12,15,13,10,11,1,6}; static FILE *linux_pipe=NULL; /* div */ LINUX_text() { int c; if (graphics_on) { graphics_on = FALSE; fflush(linux_pipe); getchar(); /* could do better than this..? */ } fputs("E\n", linux_pipe); fflush(linux_pipe); } LINUX_reset() { fputs("R\n", linux_pipe); fflush(linux_pipe); pclose(linux_pipe); } int LINUX_text_angle(ang) int ang; { fprintf(linux_pipe, "A%4d\n", ang); return TRUE; } LINUX_init() { linux_pipe = popen("gnuplot_linux", "w"); } LINUX_graphics() { graphics_on = TRUE; fprintf(linux_pipe, "G\nP7%04d%04d\n", term_tbl[term].h_tic/2, term_tbl[term].v_tic/2); } LINUX_linetype(linetype) { if (linetype >= 13) linetype %= 13; fprintf(linux_pipe, "L%04d\n", linetype); } LINUX_move(x,y) { fprintf(linux_pipe, "M%04d%04d\n", x, y); } LINUX_vector(x,y) { fprintf(linux_pipe, "V%04d%04d\n", x, y); } LINUX_put_text(x,y,str) unsigned int x, y; char *str; { fprintf(linux_pipe, "T%04d%04d%s\n", x, y,str); }