[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/gnuplot/gnuplot-old/axis_branch_base/term/unixpc.trm [Back]  [Original]

/*
 * $Id: unixpc.trm,v 1.8 1999/06/22 11:54:24 lhecking Exp $
 *
 */

/* GNUPLOT - unixpc.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:
 *  Unix PC's (ATT 3b1)
 *
 * AUTHORS
 *    John Campbell
 * 
 * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
 * 
 */

/*
>From: John Campbell (...!arizona!naucse!jdc)

I originally ported gnuplot to the ATT 3b1 (ATT7300) on 12/4/88, and then
added the minimal code needed to bring it up to 2.0 level on 1/28/90.  The 
3b1, as I view it, is a 720x300 bitmapped, monochrome display (often people 
don't use the top 12 scan lines and thus the effective size is 720x288).  I 
tried to maximize the size of the graph area, by using these top 12 lines 
(normally reserved) and set up a signal handler to restore them upon exit, 
abort, etc.

Line styles were "fudged" (they do not know the aspect ratio).  The same
line style may look different depending upon the slope of the curve.  Due to
this only 4 line styles were implemented.  While more line types are possible,
the current styles were chosen as distinguishable.

The 3b1 has 4 "special" rows at the bottom that I could not use in graphics
mode.  It has been suggested that we use these lines for command prompting.
Others have requested that we have a graphics window and a command window.
My experience with gnuplot only includes relatively dumb graphics devices--
hence gnuplot "looks and feels" normal to me the way I implemented it.
I welcome either of these changes from someone else, however.
*/

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

#include "driver.h"

#ifdef TERM_REGISTER
register_term(unixpc)
#endif

#ifdef TERM_PROTO
TERM_PUBLIC void uPC_init __PROTO((void));
TERM_PUBLIC void uPC_graphics __PROTO((void));
TERM_PUBLIC void uPC_text __PROTO((void));
TERM_PUBLIC void uPC_linetype __PROTO((int linetype));
TERM_PUBLIC void uPC_move __PROTO((unsigned int x, unsigned int y));
TERM_PUBLIC void uPC_vector __PROTO((unsigned int x, unsigned int y));
TERM_PUBLIC void uPC_put_text __PROTO((unsigned int x, unsigned int y, const char str[]));
TERM_PUBLIC int uPC_text_angle __PROTO((int ang));
TERM_PUBLIC void uPC_reset __PROTO((void));
#define uPC_XMAX 720
#define uPC_YMAX 300
#define uPC_VCHAR FNT5X9_VCHAR
#define uPC_HCHAR FNT5X9_HCHAR
#define uPC_VTIC  uPC_VCHAR/2	/* Was 8  */
#define uPC_HTIC  uPC_HCHAR	/* Was 12 */
#endif /* TERM_PROTO */

#ifndef TERM_PROTO_ONLY
#ifdef TERM_BODY
void uPC_fixwind __PROTO((int signo));
void uPC_putc __PROTO((unsigned int x, unsigned int y, int c, int angle));
void uPC_plot_word __PROTO((unsigned short *a, unsigned short b));
#include 		/* Started with tam.h--too much trouble. */
#include 
#include 

#define uPC_HIGH_BIT    (0x8000)

typedef unsigned short Scr_type;
typedef unsigned char Scr_kluge;


#define uPC_XSIZE       45	/* Short ints. */
#define uPC_YSIZE uPC_YMAX

Scr_type uPC_display[uPC_YSIZE][uPC_XSIZE];
int uPC_width = 2 * uPC_XSIZE;
int uPC_sx = 0, uPC_sy = 0;
int uPC_cur_linetype = 0;
int uPC_angle = 0;
unsigned short uPC_raster_count = 0;
static Scr_type lookup[] =
{
    0x0001, 0x0002, 0x0004, 0x0008,
    0x0010, 0x0020, 0x0040, 0x0080,
    0x0100, 0x0200, 0x0400, 0x0800,
    0x1000, 0x2000, 0x4000, 0x8000,
};

#define uPC_XLAST (uPC_XMAX - 1)
#define uPC_YLAST (uPC_YMAX - 1)


static struct urdata uPC_ur = { (unsigned short *) uPC_display,
				2 * uPC_XSIZE, 0, 0, 0, 0, 0, 0,
				uPC_XMAX, uPC_YMAX, SRCSRC, DSTOR, 0
};

#define IfErrOut(e1,e2,s1,s2) if (e1 e2) {\
fprintf(stderr, "%s:: %s %s\n", sys_errlist[errno], s1, s2);\
uPC_fixwind(0);\
exit(-1);}

TERM_PUBLIC void
uPC_init()
{
    /* This routine will ioctl to change 0 size */
    int i;
    struct uwdata uw;
    int uPC_fixwind();
    short gw;

    /* Check that we are on the bitmapped window. */
    if (iswind() != 0) {
	fputs("Sorry--must run from the bitmapped terminal\n", stderr);
	exit(-1);
    }
    for (i = 1; i 

Web Proxy Viewer  |  New URL  |  Original Page