/*
 * $Id: hp2648.trm,v 1.6 1995/12/20 21:47:52 drd Exp $
 *
 */

/* GNUPLOT -  hp2648.trm */
/*
 * Copyright (C) 1990 - 1993   
 *
 * 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:
 *  HP2648 and HP2647
 *
 * AUTHORS
 *  Russell Lang
 * 
 * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
 * 
 */

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

#ifndef GOT_DRIVER_H
#include "driver.h"
#endif

#ifdef TERM_REGISTER
register_term(hp2648)
#endif

#ifdef TERM_PROTO
TERM_PUBLIC void HP2648init __P((void));
TERM_PUBLIC void HP2648graphics __P((void));
TERM_PUBLIC void HP2648text __P((void));
TERM_PUBLIC void HP2648linetype __P((int linetype));
TERM_PUBLIC void HP2648move __P((unsigned int x, unsigned int y));
TERM_PUBLIC void HP2648vector __P((unsigned int x, unsigned int y));
TERM_PUBLIC void HP2648put_text __P((unsigned int x, unsigned int y, char *str));
TERM_PUBLIC int HP2648_text_angle __P((int ang));
TERM_PUBLIC void HP2648reset __P((void));

#define HP2648XMAX 720             
#define HP2648YMAX 360

#define HP2648VCHAR		12  	
#define HP2648HCHAR		7		
#define HP2648VTIC		8
#define HP2648HTIC		8
#endif /* TERM_PROTO */

#ifndef TERM_PROTO_ONLY
#ifdef TERM_BODY
#define HP2648XLAST (HP2648XMAX - 1)
#define HP2648YLAST (HP2648YMAX - 1)


TERM_PUBLIC void HP2648init()
{
	fprintf(outfile,"\033*m1m1n136,1cZ");
/*                   1     2 3     4
	1. mode
	2. textsize=1
	3. textangle=1
        4. define line type 2 to be *   *   *   * etc.
*/
}


TERM_PUBLIC void HP2648graphics()
{
	fprintf(outfile,"\033*dacZ");
/*                   1     23
	1. mode
	2. clear grahics screen
	3. graphics video on
*/
}


TERM_PUBLIC void HP2648text()
{
}


TERM_PUBLIC void HP2648linetype(linetype)
int linetype;
{
	static int hpline[] = {1,7,1,4,5,6,8,9,10,7,2};
	fprintf(outfile,"\033*m%dbZ",hpline[(linetype+2)%11]);
}


TERM_PUBLIC void HP2648move(x,y)
unsigned int x,y;
{
	fprintf(outfile,"\033*paf%d,%dZ",x,y);
    /*               1     23     4
	1	plot mode
	2	"pen up"
	3	goto absolute x,y
	4	end command
	*/
}


TERM_PUBLIC void HP2648vector(x,y)
unsigned int x,y;
{
	fprintf(outfile,"\033*pbf%d,%dZ",x,y);
    /*                     1 
	1	"pen down"
	*/
}


TERM_PUBLIC void HP2648put_text(x,y,str)
unsigned int x, y;
char *str;
{
	HP2648move(x,y-HP2648VCHAR/2 + 1);
	fprintf(outfile,"\033*l%s\n",str);
}


TERM_PUBLIC int HP2648_text_angle(ang)
int ang;
{
	fprintf(outfile,"\033*m%dnZ\n",ang+1);
	return TRUE;
}
	
TERM_PUBLIC void HP2648reset()
{
}

#endif /* TERM_BODY */

#ifdef TERM_TABLE

TERM_TABLE_START(hp2648_driver)
    "hp2648", "HP2648 and HP2647",
	   HP2648XMAX, HP2648YMAX, HP2648VCHAR, HP2648HCHAR, 
	   HP2648VTIC, HP2648HTIC, options_null, HP2648init, HP2648reset, 
	   HP2648text, null_scale, HP2648graphics, HP2648move, HP2648vector, 
	   HP2648linetype, HP2648put_text, HP2648_text_angle, 
	   null_justify_text, line_and_point, do_arrow, set_font_null
TERM_TABLE_END(hp2648_driver)

#undef LAST_TERM
#define LAST_TERM hp2648_driver

#endif /* TERM_TABLE */
#endif /* TERM_PROTO_ONLY */

/*
 * NAME: hp2648
 *
 * OPTIONS: none
 *
 * SUPPORTS: HP2648 & HP2647
 *
 * Further Info: Same as for hp2623A, I have no idea, whether this is
 *		 plotter or a graphics terminal (or a streamer device).
 *
 */