This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

optimization/4133: heavy optimization and -march=pentium leads to ICE



>Number:         4133
>Category:       optimization
>Synopsis:       heavy optimization and -march=pentium leads to ICE
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    unassigned
>State:          open
>Class:          ice-on-legal-code
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 26 21:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Maciej
>Release:        3.0
>Organization:
>Environment:
System: Linux apathy 2.4.9 #6 Fri Aug 24 00:57:59 CDT 2001 i586 unknown
Architecture: i586
	Pentium 200MMX, Linux 2.4.9, glibc-2.2.3

host: i586-pc-linux-gnu
build: i586-pc-linux-gnu
target: i586-pc-linux-gnu
configured with: ./configure --prefix=/usr/opt/packages/gcc-3.0 : (reconfigured) ./configure --prefix=/usr/opt/packages/gcc-3.0
>Description:
	Setting -O3 produces an ICE. Full text:
>How-To-Repeat:
	Command line:  gcc -DHAVE_CONFIG_H -I. -I. -I/usr/opt   -O3 -I/usr/opt/include -I./term -I./term -c term.c
	Full preprocessed text included at bottom.
>Fix:
	Turn optimization down.

# 2 "term.c"
static char *RCSid = "$Id: term.c,v 1.19.2.3 1999/10/01 10:37:23 lhecking Exp $";
# 77 "term.c"
# 1 "plot.h" 1
# 43 "plot.h"
# 1 "config.h" 1
# 44 "plot.h" 2


# 1 "ansichek.h" 1
# 47 "plot.h" 2

# 1 "stdfn.h" 1
# 48 "stdfn.h"
# 1 "/usr/include/ctype.h" 1 3
# 26 "/usr/include/ctype.h" 3
# 1 "/usr/include/features.h" 1 3
# 283 "/usr/include/features.h" 3
# 1 "/usr/include/sys/cdefs.h" 1 3
# 284 "/usr/include/features.h" 2 3
# 311 "/usr/include/features.h" 3
# 1 "/usr/include/gnu/stubs.h" 1 3
# 312 "/usr/include/features.h" 2 3
# 27 "/usr/include/ctype.h" 2 3
# 1 "/usr/include/bits/types.h" 1 3
# 26 "/usr/include/bits/types.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/bits/types.h" 2 3


# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 199 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 3
typedef unsigned int size_t;
# 30 "/usr/include/bits/types.h" 2 3


typedef unsigned char __u_char;
typedef unsigned short __u_short;
typedef unsigned int __u_int;
typedef unsigned long __u_long;

__extension__ typedef unsigned long long int __u_quad_t;
__extension__ typedef long long int __quad_t;
# 49 "/usr/include/bits/types.h" 3
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;

__extension__ typedef signed long long int __int64_t;
__extension__ typedef unsigned long long int __uint64_t;

typedef __quad_t *__qaddr_t;

typedef __u_quad_t __dev_t;
typedef __u_int __uid_t;
typedef __u_int __gid_t;
typedef __u_long __ino_t;
typedef __u_int __mode_t;
typedef __u_int __nlink_t;
typedef long int __off_t;
typedef __quad_t __loff_t;
typedef int __pid_t;
typedef int __ssize_t;
typedef __u_long __rlim_t;
typedef __u_quad_t __rlim64_t;
typedef __u_int __id_t;

typedef struct
  {
    int __val[2];
  } __fsid_t;


typedef int __daddr_t;
typedef char *__caddr_t;
typedef long int __time_t;
typedef unsigned int __useconds_t;
typedef long int __suseconds_t;
typedef long int __swblk_t;

typedef long int __clock_t;


typedef int __clockid_t;


typedef int __timer_t;






typedef int __key_t;


typedef unsigned short int __ipc_pid_t;



typedef long int __blksize_t;




typedef long int __blkcnt_t;
typedef __quad_t __blkcnt64_t;


typedef __u_long __fsblkcnt_t;
typedef __u_quad_t __fsblkcnt64_t;


typedef __u_long __fsfilcnt_t;
typedef __u_quad_t __fsfilcnt64_t;


typedef __u_quad_t __ino64_t;


typedef __loff_t __off64_t;


typedef long int __t_scalar_t;
typedef unsigned long int __t_uscalar_t;


typedef int __intptr_t;


typedef unsigned int __socklen_t;




# 1 "/usr/include/bits/pthreadtypes.h" 1 3
# 23 "/usr/include/bits/pthreadtypes.h" 3
# 1 "/usr/include/bits/sched.h" 1 3
# 68 "/usr/include/bits/sched.h" 3
struct __sched_param
  {
    int __sched_priority;
  };
# 24 "/usr/include/bits/pthreadtypes.h" 2 3


struct _pthread_fastlock
{
  long int __status;
  int __spinlock;

};



typedef struct _pthread_descr_struct *_pthread_descr;





typedef struct __pthread_attr_s
{
  int __detachstate;
  int __schedpolicy;
  struct __sched_param __schedparam;
  int __inheritsched;
  int __scope;
  size_t __guardsize;
  int __stackaddr_set;
  void *__stackaddr;
  size_t __stacksize;
} pthread_attr_t;



typedef struct
{
  struct _pthread_fastlock __c_lock;
  _pthread_descr __c_waiting;
} pthread_cond_t;



typedef struct
{
  int __dummy;
} pthread_condattr_t;


typedef unsigned int pthread_key_t;





typedef struct
{
  int __m_reserved;
  int __m_count;
  _pthread_descr __m_owner;
  int __m_kind;
  struct _pthread_fastlock __m_lock;
} pthread_mutex_t;



typedef struct
{
  int __mutexkind;
} pthread_mutexattr_t;



typedef int pthread_once_t;
# 140 "/usr/include/bits/pthreadtypes.h" 3
typedef unsigned long int pthread_t;
# 144 "/usr/include/bits/types.h" 2 3
# 28 "/usr/include/ctype.h" 2 3
# 40 "/usr/include/ctype.h" 3
# 1 "/usr/include/endian.h" 1 3
# 22 "/usr/include/endian.h" 3
# 1 "/usr/include/features.h" 1 3
# 23 "/usr/include/endian.h" 2 3
# 37 "/usr/include/endian.h" 3
# 1 "/usr/include/bits/endian.h" 1 3
# 38 "/usr/include/endian.h" 2 3
# 41 "/usr/include/ctype.h" 2 3






enum
{
  _ISupper = ((0) < 8 ? ((1 << (0)) << 8) : ((1 << (0)) >> 8)),
  _ISlower = ((1) < 8 ? ((1 << (1)) << 8) : ((1 << (1)) >> 8)),
  _ISalpha = ((2) < 8 ? ((1 << (2)) << 8) : ((1 << (2)) >> 8)),
  _ISdigit = ((3) < 8 ? ((1 << (3)) << 8) : ((1 << (3)) >> 8)),
  _ISxdigit = ((4) < 8 ? ((1 << (4)) << 8) : ((1 << (4)) >> 8)),
  _ISspace = ((5) < 8 ? ((1 << (5)) << 8) : ((1 << (5)) >> 8)),
  _ISprint = ((6) < 8 ? ((1 << (6)) << 8) : ((1 << (6)) >> 8)),
  _ISgraph = ((7) < 8 ? ((1 << (7)) << 8) : ((1 << (7)) >> 8)),
  _ISblank = ((8) < 8 ? ((1 << (8)) << 8) : ((1 << (8)) >> 8)),
  _IScntrl = ((9) < 8 ? ((1 << (9)) << 8) : ((1 << (9)) >> 8)),
  _ISpunct = ((10) < 8 ? ((1 << (10)) << 8) : ((1 << (10)) >> 8)),
  _ISalnum = ((11) < 8 ? ((1 << (11)) << 8) : ((1 << (11)) >> 8))
};
# 75 "/usr/include/ctype.h" 3
extern __const unsigned short int *__ctype_b;
extern __const __int32_t *__ctype_tolower;
extern __const __int32_t *__ctype_toupper;
# 91 "/usr/include/ctype.h" 3
extern int isalnum (int) ;
extern int isalpha (int) ;
extern int iscntrl (int) ;
extern int isdigit (int) ;
extern int islower (int) ;
extern int isgraph (int) ;
extern int isprint (int) ;
extern int ispunct (int) ;
extern int isspace (int) ;
extern int isupper (int) ;
extern int isxdigit (int) ;







extern int tolower (int __c) ;


extern int toupper (int __c) ;






extern int isascii (int __c) ;



extern int toascii (int __c) ;



extern int _toupper (int) ;
extern int _tolower (int) ;
# 168 "/usr/include/ctype.h" 3
extern __inline int
tolower (int __c)
{
  return __c >= -128 && __c < 256 ? __ctype_tolower[__c] : __c;
}

extern __inline int
toupper (int __c)
{
  return __c >= -128 && __c < 256 ? __ctype_toupper[__c] : __c;
}
# 49 "stdfn.h" 2
# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 1 3
# 36 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
# 1 "/usr/include/features.h" 1 3
# 37 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 2 3





# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 43 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 2 3

# 1 "/usr/include/bits/types.h" 1 3
# 45 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 2 3
# 53 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
typedef struct _IO_FILE FILE;
# 63 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
typedef struct _IO_FILE __FILE;
# 73 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
# 1 "/usr/include/libio.h" 1 3
# 30 "/usr/include/libio.h" 3
# 1 "/usr/include/_G_config.h" 1 3
# 9 "/usr/include/_G_config.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 10 "/usr/include/_G_config.h" 2 3




# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 287 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 3
typedef long int wchar_t;
# 312 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 3
typedef unsigned int wint_t;
# 15 "/usr/include/_G_config.h" 2 3
# 24 "/usr/include/_G_config.h" 3
# 1 "/usr/include/wchar.h" 1 3
# 48 "/usr/include/wchar.h" 3
# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 49 "/usr/include/wchar.h" 2 3

# 1 "/usr/include/bits/wchar.h" 1 3
# 51 "/usr/include/wchar.h" 2 3
# 67 "/usr/include/wchar.h" 3
typedef struct
{
  int __count;
  union
  {
    wint_t __wch;
    char __wchb[4];
  } __value;
} __mbstate_t;
# 25 "/usr/include/_G_config.h" 2 3

typedef struct
{
  __off_t __pos;
  __mbstate_t __state;
} _G_fpos_t;
typedef struct
{
  __off64_t __pos;
  __mbstate_t __state;
} _G_fpos64_t;
# 44 "/usr/include/_G_config.h" 3
# 1 "/usr/include/gconv.h" 1 3
# 26 "/usr/include/gconv.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/gconv.h" 2 3

# 1 "/usr/include/wchar.h" 1 3
# 48 "/usr/include/wchar.h" 3
# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 49 "/usr/include/wchar.h" 2 3

# 1 "/usr/include/bits/wchar.h" 1 3
# 51 "/usr/include/wchar.h" 2 3
# 29 "/usr/include/gconv.h" 2 3

# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 31 "/usr/include/gconv.h" 2 3





enum
{
  __GCONV_OK = 0,
  __GCONV_NOCONV,
  __GCONV_NODB,
  __GCONV_NOMEM,

  __GCONV_EMPTY_INPUT,
  __GCONV_FULL_OUTPUT,
  __GCONV_ILLEGAL_INPUT,
  __GCONV_INCOMPLETE_INPUT,

  __GCONV_ILLEGAL_DESCRIPTOR,
  __GCONV_INTERNAL_ERROR
};



enum
{
  __GCONV_IS_LAST = 0x0001,
  __GCONV_IGNORE_ERRORS = 0x0002
};



struct __gconv_step;
struct __gconv_step_data;
struct __gconv_loaded_object;
struct __gconv_trans_data;



typedef int (*__gconv_fct) (struct __gconv_step *, struct __gconv_step_data *,
                            __const unsigned char **, __const unsigned char *,
                            unsigned char **, size_t *, int, int);


typedef int (*__gconv_init_fct) (struct __gconv_step *);
typedef void (*__gconv_end_fct) (struct __gconv_step *);



typedef int (*__gconv_trans_fct) (struct __gconv_step *,
                                  struct __gconv_step_data *, void *,
                                  __const unsigned char *,
                                  __const unsigned char **,
                                  __const unsigned char *, unsigned char **,
                                  size_t *);


typedef int (*__gconv_trans_context_fct) (void *, __const unsigned char *,
                                          __const unsigned char *,
                                          unsigned char *, unsigned char *);


typedef int (*__gconv_trans_query_fct) (__const char *, __const char ***,
                                        size_t *);


typedef int (*__gconv_trans_init_fct) (void **, const char *);
typedef void (*__gconv_trans_end_fct) (void *);

struct __gconv_trans_data
{

  __gconv_trans_fct __trans_fct;
  __gconv_trans_context_fct __trans_context_fct;
  __gconv_trans_end_fct __trans_end_fct;
  void *__data;
  struct __gconv_trans_data *__next;
};



struct __gconv_step
{
  struct __gconv_loaded_object *__shlib_handle;
  __const char *__modname;

  int __counter;

  char *__from_name;
  char *__to_name;

  __gconv_fct __fct;
  __gconv_init_fct __init_fct;
  __gconv_end_fct __end_fct;



  int __min_needed_from;
  int __max_needed_from;
  int __min_needed_to;
  int __max_needed_to;


  int __stateful;

  void *__data;
};



struct __gconv_step_data
{
  unsigned char *__outbuf;
  unsigned char *__outbufend;



  int __flags;



  int __invocation_counter;



  int __internal_use;

  __mbstate_t *__statep;
  __mbstate_t __state;



  struct __gconv_trans_data *__trans;
};



typedef struct __gconv_info
{
  size_t __nsteps;
  struct __gconv_step *__steps;
  __extension__ struct __gconv_step_data __data [];
} *__gconv_t;
# 45 "/usr/include/_G_config.h" 2 3
typedef union
{
  struct __gconv_info __cd;
  struct
  {
    struct __gconv_info __cd;
    struct __gconv_step_data __data;
  } __combined;
} _G_iconv_t;

typedef int _G_int16_t __attribute__ ((__mode__ (__HI__)));
typedef int _G_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int _G_uint16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int _G_uint32_t __attribute__ ((__mode__ (__SI__)));
# 31 "/usr/include/libio.h" 2 3
# 51 "/usr/include/libio.h" 3
# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdarg.h" 1 3
# 43 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdarg.h" 3
typedef __builtin_va_list __gnuc_va_list;
# 52 "/usr/include/libio.h" 2 3
# 158 "/usr/include/libio.h" 3
struct _IO_jump_t; struct _IO_FILE;
# 168 "/usr/include/libio.h" 3
typedef void _IO_lock_t;





struct _IO_marker {
  struct _IO_marker *_next;
  struct _IO_FILE *_sbuf;



  int _pos;
# 191 "/usr/include/libio.h" 3
};


enum __codecvt_result
{
  __codecvt_ok,
  __codecvt_partial,
  __codecvt_error,
  __codecvt_noconv
};
# 259 "/usr/include/libio.h" 3
struct _IO_FILE {
  int _flags;




  char* _IO_read_ptr;
  char* _IO_read_end;
  char* _IO_read_base;
  char* _IO_write_base;
  char* _IO_write_ptr;
  char* _IO_write_end;
  char* _IO_buf_base;
  char* _IO_buf_end;

  char *_IO_save_base;
  char *_IO_backup_base;
  char *_IO_save_end;

  struct _IO_marker *_markers;

  struct _IO_FILE *_chain;

  int _fileno;
  int _blksize;
  __off_t _old_offset;



  unsigned short _cur_column;
  signed char _vtable_offset;
  char _shortbuf[1];



  _IO_lock_t *_lock;
# 303 "/usr/include/libio.h" 3
  __off64_t _offset;





  void *__pad1;
  void *__pad2;

  int _mode;

  char _unused2[15 * sizeof (int) - 2 * sizeof (void *)];

};


typedef struct _IO_FILE _IO_FILE;


struct _IO_FILE_plus;

extern struct _IO_FILE_plus _IO_2_1_stdin_;
extern struct _IO_FILE_plus _IO_2_1_stdout_;
extern struct _IO_FILE_plus _IO_2_1_stderr_;
# 342 "/usr/include/libio.h" 3
typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);







typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
                                 size_t __n);







typedef int __io_seek_fn (void *__cookie, __off64_t *__pos, int __w);


typedef int __io_close_fn (void *__cookie);
# 394 "/usr/include/libio.h" 3
extern int __underflow (_IO_FILE *) ;
extern int __uflow (_IO_FILE *) ;
extern int __overflow (_IO_FILE *, int) ;
extern wint_t __wunderflow (_IO_FILE *) ;
extern wint_t __wuflow (_IO_FILE *) ;
extern wint_t __woverflow (_IO_FILE *, wint_t) ;
# 424 "/usr/include/libio.h" 3
extern int _IO_getc (_IO_FILE *__fp) ;
extern int _IO_putc (int __c, _IO_FILE *__fp) ;
extern int _IO_feof (_IO_FILE *__fp) ;
extern int _IO_ferror (_IO_FILE *__fp) ;

extern int _IO_peekc_locked (_IO_FILE *__fp) ;





extern void _IO_flockfile (_IO_FILE *) ;
extern void _IO_funlockfile (_IO_FILE *) ;
extern int _IO_ftrylockfile (_IO_FILE *) ;
# 454 "/usr/include/libio.h" 3
extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
                        __gnuc_va_list, int *__restrict) ;
extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
                         __gnuc_va_list) ;
extern __ssize_t _IO_padn (_IO_FILE *, int, __ssize_t) ;
extern size_t _IO_sgetn (_IO_FILE *, void *, size_t) ;

extern __off64_t _IO_seekoff (_IO_FILE *, __off64_t, int, int) ;
extern __off64_t _IO_seekpos (_IO_FILE *, __off64_t, int) ;

extern void _IO_free_backup_area (_IO_FILE *) ;
# 74 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 2 3
# 88 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
typedef _G_fpos_t fpos_t;
# 137 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
# 1 "/usr/include/bits/stdio_lim.h" 1 3
# 138 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 2 3



extern FILE *stdin;
extern FILE *stdout;
extern FILE *stderr;






extern int remove (__const char *__filename) ;

extern int rename (__const char *__old, __const char *__new) ;




extern FILE *tmpfile (void) ;
# 169 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
extern char *tmpnam (char *__s) ;




extern char *tmpnam_r (char *__s) ;
# 186 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
extern char *tempnam (__const char *__dir, __const char *__pfx)
             __attribute__ ((__malloc__));




extern int fclose (FILE *__stream) ;

extern int fflush (FILE *__stream) ;



extern int fflush_unlocked (FILE *__stream) ;
# 209 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
extern FILE *fopen (__const char *__restrict __filename,
                    __const char *__restrict __modes) ;

extern FILE *freopen (__const char *__restrict __filename,
                      __const char *__restrict __modes,
                      FILE *__restrict __stream) ;
# 239 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
extern FILE *fdopen (int __fd, __const char *__modes) ;
# 262 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) ;



extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
                    int __modes, size_t __n) ;




extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
                       size_t __size) ;


extern void setlinebuf (FILE *__stream) ;




extern int fprintf (FILE *__restrict __stream,
                    __const char *__restrict __format, ...) ;

extern int printf (__const char *__restrict __format, ...) ;

extern int sprintf (char *__restrict __s,
                    __const char *__restrict __format, ...) ;


extern int vfprintf (FILE *__restrict __s, __const char *__restrict __format,
                     __gnuc_va_list __arg) ;

extern int vprintf (__const char *__restrict __format, __gnuc_va_list __arg)
            ;

extern int vsprintf (char *__restrict __s, __const char *__restrict __format,
                     __gnuc_va_list __arg) ;



extern int snprintf (char *__restrict __s, size_t __maxlen,
                     __const char *__restrict __format, ...)
             __attribute__ ((__format__ (__printf__, 3, 4)));

extern int vsnprintf (char *__restrict __s, size_t __maxlen,
                      __const char *__restrict __format, __gnuc_va_list __arg)
             __attribute__ ((__format__ (__printf__, 3, 0)));
# 333 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
extern int fscanf (FILE *__restrict __stream,
                   __const char *__restrict __format, ...) ;

extern int scanf (__const char *__restrict __format, ...) ;

extern int sscanf (__const char *__restrict __s,
                   __const char *__restrict __format, ...) ;
# 359 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
extern int fgetc (FILE *__stream) ;
extern int getc (FILE *__stream) ;


extern int getchar (void) ;







extern int getc_unlocked (FILE *__stream) ;
extern int getchar_unlocked (void) ;




extern int fgetc_unlocked (FILE *__stream) ;




extern int fputc (int __c, FILE *__stream) ;
extern int putc (int __c, FILE *__stream) ;


extern int putchar (int __c) ;







extern int fputc_unlocked (int __c, FILE *__stream) ;




extern int putc_unlocked (int __c, FILE *__stream) ;
extern int putchar_unlocked (int __c) ;





extern int getw (FILE *__stream) ;


extern int putw (int __w, FILE *__stream) ;




extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
            ;
# 425 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
extern char *gets (char *__s) ;
# 449 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
extern int fputs (__const char *__restrict __s, FILE *__restrict __stream)
            ;
# 459 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
extern int puts (__const char *__s) ;



extern int ungetc (int __c, FILE *__stream) ;



extern size_t fread (void *__restrict __ptr, size_t __size,
                     size_t __n, FILE *__restrict __stream) ;

extern size_t fwrite (__const void *__restrict __ptr, size_t __size,
                      size_t __n, FILE *__restrict __s) ;



extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
                              size_t __n, FILE *__restrict __stream) ;
extern size_t fwrite_unlocked (__const void *__restrict __ptr, size_t __size,
                               size_t __n, FILE *__restrict __stream) ;




extern int fseek (FILE *__stream, long int __off, int __whence) ;

extern long int ftell (FILE *__stream) ;

extern void rewind (FILE *__stream) ;
# 503 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
extern int fgetpos (FILE *__restrict __stream, fpos_t *__restrict __pos)
            ;

extern int fsetpos (FILE *__stream, __const fpos_t *__pos) ;
# 539 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
extern void clearerr (FILE *__stream) ;

extern int feof (FILE *__stream) ;

extern int ferror (FILE *__stream) ;



extern void clearerr_unlocked (FILE *__stream) ;
extern int feof_unlocked (FILE *__stream) ;
extern int ferror_unlocked (FILE *__stream) ;




extern void perror (__const char *__s) ;




extern int sys_nerr;
extern __const char *__const sys_errlist[];
# 570 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
extern int fileno (FILE *__stream) ;




extern int fileno_unlocked (FILE *__stream) ;






extern FILE *popen (__const char *__command, __const char *__modes) ;


extern int pclose (FILE *__stream) ;





extern char *ctermid (char *__s) ;
# 617 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
extern void flockfile (FILE *__stream) ;



extern int ftrylockfile (FILE *__stream) ;


extern void funlockfile (FILE *__stream) ;
# 638 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 3
# 1 "/usr/include/bits/stdio.h" 1 3
# 39 "/usr/include/bits/stdio.h" 3
extern __inline int
vprintf (__const char *__restrict __fmt, __gnuc_va_list __arg)
{
  return vfprintf (stdout, __fmt, __arg);
}


extern __inline int
getchar (void)
{
  return _IO_getc (stdin);
}




extern __inline int
getc_unlocked (FILE *__fp)
{
  return ((__fp)->_IO_read_ptr >= (__fp)->_IO_read_end ? __uflow (__fp) : *(unsigned char *) (__fp)->_IO_read_ptr++);
}


extern __inline int
getchar_unlocked (void)
{
  return ((stdin)->_IO_read_ptr >= (stdin)->_IO_read_end ? __uflow (stdin) : *(unsigned char *) (stdin)->_IO_read_ptr++);
}




extern __inline int
putchar (int __c)
{
  return _IO_putc (__c, stdout);
}




extern __inline int
fputc_unlocked (int __c, FILE *__stream)
{
  return (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
}





extern __inline int
putc_unlocked (int __c, FILE *__stream)
{
  return (((__stream)->_IO_write_ptr >= (__stream)->_IO_write_end) ? __overflow (__stream, (unsigned char) (__c)) : (unsigned char) (*(__stream)->_IO_write_ptr++ = (__c)));
}


extern __inline int
putchar_unlocked (int __c)
{
  return (((stdout)->_IO_write_ptr >= (stdout)->_IO_write_end) ? __overflow (stdout, (unsigned char) (__c)) : (unsigned char) (*(stdout)->_IO_write_ptr++ = (__c)));
}
# 117 "/usr/include/bits/stdio.h" 3
extern __inline int
feof_unlocked (FILE *__stream)
{
  return (((__stream)->_flags & 0x10) != 0);
}


extern __inline int
ferror_unlocked (FILE *__stream)
{
  return (((__stream)->_flags & 0x20) != 0);
}
# 639 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stdio.h" 2 3
# 50 "stdfn.h" 2

# 1 "syscfg.h" 1
# 46 "syscfg.h"
# 1 "config.h" 1
# 47 "syscfg.h" 2


# 1 "ansichek.h" 1
# 50 "syscfg.h" 2
# 52 "stdfn.h" 2


# 1 "/usr/include/string.h" 1 3
# 26 "/usr/include/string.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/string.h" 2 3






# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 34 "/usr/include/string.h" 2 3



extern void *memcpy (void *__restrict __dest,
                     __const void *__restrict __src, size_t __n) ;


extern void *memmove (void *__dest, __const void *__src, size_t __n)
            ;





extern void *memccpy (void *__restrict __dest, __const void *__restrict __src,
                      int __c, size_t __n)
            ;




extern void *memset (void *__s, int __c, size_t __n) ;


extern int memcmp (__const void *__s1, __const void *__s2, size_t __n)
             __attribute__ ((__pure__));


extern void *memchr (__const void *__s, int __c, size_t __n)
              __attribute__ ((__pure__));
# 77 "/usr/include/string.h" 3
extern char *strcpy (char *__restrict __dest, __const char *__restrict __src)
            ;

extern char *strncpy (char *__restrict __dest,
                      __const char *__restrict __src, size_t __n) ;


extern char *strcat (char *__restrict __dest, __const char *__restrict __src)
            ;

extern char *strncat (char *__restrict __dest, __const char *__restrict __src,
                      size_t __n) ;


extern int strcmp (__const char *__s1, __const char *__s2)
             __attribute__ ((__pure__));

extern int strncmp (__const char *__s1, __const char *__s2, size_t __n)
             __attribute__ ((__pure__));


extern int strcoll (__const char *__s1, __const char *__s2)
             __attribute__ ((__pure__));

extern size_t strxfrm (char *__restrict __dest,
                       __const char *__restrict __src, size_t __n) ;
# 120 "/usr/include/string.h" 3
extern char *strdup (__const char *__s) __attribute__ ((__malloc__));
# 155 "/usr/include/string.h" 3
extern char *strchr (__const char *__s, int __c) __attribute__ ((__pure__));

extern char *strrchr (__const char *__s, int __c) __attribute__ ((__pure__));
# 167 "/usr/include/string.h" 3
extern size_t strcspn (__const char *__s, __const char *__reject)
             __attribute__ ((__pure__));


extern size_t strspn (__const char *__s, __const char *__accept)
             __attribute__ ((__pure__));

extern char *strpbrk (__const char *__s, __const char *__accept)
             __attribute__ ((__pure__));

extern char *strstr (__const char *__haystack, __const char *__needle)
             __attribute__ ((__pure__));
# 187 "/usr/include/string.h" 3
extern char *strtok (char *__restrict __s, __const char *__restrict __delim)
            ;



extern char *__strtok_r (char *__restrict __s,
                         __const char *__restrict __delim,
                         char **__restrict __save_ptr) ;

extern char *strtok_r (char *__restrict __s, __const char *__restrict __delim,
                       char **__restrict __save_ptr) ;
# 218 "/usr/include/string.h" 3
extern size_t strlen (__const char *__s) __attribute__ ((__pure__));
# 229 "/usr/include/string.h" 3
extern char *strerror (int __errnum) ;



extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) ;




extern void __bzero (void *__s, size_t __n) ;



extern void bcopy (__const void *__src, void *__dest, size_t __n) ;


extern void bzero (void *__s, size_t __n) ;


extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
             __attribute__ ((__pure__));


extern char *index (__const char *__s, int __c) __attribute__ ((__pure__));


extern char *rindex (__const char *__s, int __c) __attribute__ ((__pure__));



extern int ffs (int __i) __attribute__ ((__const__));
# 272 "/usr/include/string.h" 3
extern int strcasecmp (__const char *__s1, __const char *__s2)
             __attribute__ ((__pure__));


extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
             __attribute__ ((__pure__));
# 294 "/usr/include/string.h" 3
extern char *strsep (char **__restrict __stringp,
                     __const char *__restrict __delim) ;
# 356 "/usr/include/string.h" 3
# 1 "/usr/include/bits/string.h" 1 3
# 357 "/usr/include/string.h" 2 3


# 1 "/usr/include/bits/string2.h" 1 3
# 52 "/usr/include/bits/string2.h" 3
# 1 "/usr/include/endian.h" 1 3
# 53 "/usr/include/bits/string2.h" 2 3
# 1 "/usr/include/bits/types.h" 1 3
# 54 "/usr/include/bits/string2.h" 2 3
# 371 "/usr/include/bits/string2.h" 3
extern void *__rawmemchr (const void *__s, int __c);
# 395 "/usr/include/bits/string2.h" 3
extern __inline char *__strcpy_small (char *, __uint16_t, __uint16_t,
                                      __uint32_t, __uint32_t, size_t);
extern __inline char *
__strcpy_small (char *__dest,
                __uint16_t __src0_2, __uint16_t __src4_2,
                __uint32_t __src0_4, __uint32_t __src4_4,
                size_t __srclen)
{
  union {
    __uint32_t __ui;
    __uint16_t __usi;
    unsigned char __uc;
  } *__u = (void *) __dest;
  switch ((unsigned int) __srclen)
    {
    case 1:
      __u->__uc = '\0';
      break;
    case 2:
      __u->__usi = __src0_2;
      break;
    case 3:
      __u->__usi = __src0_2;
      __u = __extension__ ((void *) __u + 2);
      __u->__uc = '\0';
      break;
    case 4:
      __u->__ui = __src0_4;
      break;
    case 5:
      __u->__ui = __src0_4;
      __u = __extension__ ((void *) __u + 4);
      __u->__uc = '\0';
      break;
    case 6:
      __u->__ui = __src0_4;
      __u = __extension__ ((void *) __u + 4);
      __u->__usi = __src4_2;
      break;
    case 7:
      __u->__ui = __src0_4;
      __u = __extension__ ((void *) __u + 4);
      __u->__usi = __src4_2;
      __u = __extension__ ((void *) __u + 2);
      __u->__uc = '\0';
      break;
    case 8:
      __u->__ui = __src0_4;
      __u = __extension__ ((void *) __u + 4);
      __u->__ui = __src4_4;
      break;
    }
  return __dest;
}
# 873 "/usr/include/bits/string2.h" 3
extern __inline size_t __strcspn_c1 (__const char *__s, char __reject);
extern __inline size_t
__strcspn_c1 (__const char *__s, char __reject)
{
  register size_t __result = 0;
  while (__s[__result] != '\0' && __s[__result] != __reject)
    ++__result;
  return __result;
}

extern __inline size_t __strcspn_c2 (__const char *__s, char __reject1,
                                     char __reject2);
extern __inline size_t
__strcspn_c2 (__const char *__s, char __reject1, char __reject2)
{
  register size_t __result = 0;
  while (__s[__result] != '\0' && __s[__result] != __reject1
         && __s[__result] != __reject2)
    ++__result;
  return __result;
}

extern __inline size_t __strcspn_c3 (__const char *__s, char __reject1,
                                     char __reject2, char __reject3);
extern __inline size_t
__strcspn_c3 (__const char *__s, char __reject1, char __reject2,
              char __reject3)
{
  register size_t __result = 0;
  while (__s[__result] != '\0' && __s[__result] != __reject1
         && __s[__result] != __reject2 && __s[__result] != __reject3)
    ++__result;
  return __result;
}
# 928 "/usr/include/bits/string2.h" 3
extern __inline size_t __strspn_c1 (__const char *__s, char __accept);
extern __inline size_t
__strspn_c1 (__const char *__s, char __accept)
{
  register size_t __result = 0;

  while (__s[__result] == __accept)
    ++__result;
  return __result;
}

extern __inline size_t __strspn_c2 (__const char *__s, char __accept1,
                                    char __accept2);
extern __inline size_t
__strspn_c2 (__const char *__s, char __accept1, char __accept2)
{
  register size_t __result = 0;

  while (__s[__result] == __accept1 || __s[__result] == __accept2)
    ++__result;
  return __result;
}

extern __inline size_t __strspn_c3 (__const char *__s, char __accept1,
                                    char __accept2, char __accept3);
extern __inline size_t
__strspn_c3 (__const char *__s, char __accept1, char __accept2, char __accept3)
{
  register size_t __result = 0;

  while (__s[__result] == __accept1 || __s[__result] == __accept2
         || __s[__result] == __accept3)
    ++__result;
  return __result;
}
# 983 "/usr/include/bits/string2.h" 3
extern __inline char *__strpbrk_c2 (__const char *__s, int __accept1,
                                     int __accept2);
extern __inline char *
__strpbrk_c2 (__const char *__s, int __accept1, int __accept2)
{

  while (*__s != '\0' && *__s != __accept1 && *__s != __accept2)
    ++__s;
  return *__s == '\0' ? ((void *)0) : (char *) (size_t) __s;
}

extern __inline char *__strpbrk_c3 (__const char *__s, int __accept1,
                                     int __accept2, int __accept3);
extern __inline char *
__strpbrk_c3 (__const char *__s, int __accept1, int __accept2,
              int __accept3)
{

  while (*__s != '\0' && *__s != __accept1 && *__s != __accept2
         && *__s != __accept3)
    ++__s;
  return *__s == '\0' ? ((void *)0) : (char *) (size_t) __s;
}
# 1045 "/usr/include/bits/string2.h" 3
extern __inline char *__strtok_r_1c (char *__s, char __sep, char **__nextp);
extern __inline char *
__strtok_r_1c (char *__s, char __sep, char **__nextp)
{
  char *__result;
  if (__s == ((void *)0))
    __s = *__nextp;
  while (*__s == __sep)
    ++__s;
  if (*__s == '\0')
    __result = ((void *)0);
  else
    {
      __result = __s;
      while (*__s != '\0' && *__s != __sep)
        ++__s;
      if (*__s == '\0')
        *__nextp = __s;
      else
        {
          *__s = '\0';
          *__nextp = __s + 1;
        }
    }
  return __result;
}
# 1095 "/usr/include/bits/string2.h" 3
extern __inline char *__strsep_1c (char **__s, char __reject);
extern __inline char *
__strsep_1c (char **__s, char __reject)
{
  register char *__retval = *__s;
  if (__retval == ((void *)0))
    return *__s = ((void *)0);
  if (*__retval == __reject)
    *(*__s)++ = '\0';
  else
    if ((*__s = (__extension__ (__builtin_constant_p (__reject) && (__reject) == '\0' ? (char *) __rawmemchr (__retval, __reject) : strchr (__retval, __reject)))) != ((void *)0))
      *(*__s)++ = '\0';
    else
      *__s = ((void *)0);
  return __retval;
}

extern __inline char *__strsep_2c (char **__s, char __reject1, char __reject2);
extern __inline char *
__strsep_2c (char **__s, char __reject1, char __reject2)
{
  register char *__retval = *__s;
  if (__retval == ((void *)0))
    return *__s = ((void *)0);
  if (*__retval == __reject1 || *__retval == __reject2)
    *(*__s)++ = '\0';
  else
    {
      register char *__cp = __retval;
      while (*__cp != '\0' && *__cp != __reject1 && *__cp != __reject2)
        ++__cp;
      if (*__cp != '\0')
        {
          *__s = __cp;
          *(*__s)++ = '\0';
        }
      else
        *__s = ((void *)0);
    }
  return __retval;
}

extern __inline char *__strsep_3c (char **__s, char __reject1, char __reject2,
                                   char __reject3);
extern __inline char *
__strsep_3c (char **__s, char __reject1, char __reject2, char __reject3)
{
  register char *__retval = *__s;
  if (__retval == ((void *)0))
    return *__s = ((void *)0);
  if (*__retval == __reject1 || *__retval == __reject2
      || *__retval == __reject3)
    *(*__s)++ = '\0';
  else
    {
      register char *__cp = __retval;
      while (*__cp != '\0' && *__cp != __reject1 && *__cp != __reject2
             && *__cp != __reject3)
        ++__cp;
      if (*__cp != '\0')
        {
          *__s = __cp;
          *(*__s)++ = '\0';
        }
      else
        *__s = ((void *)0);
    }
  return __retval;
}

extern __inline char *__strsep_g (char **__s, __const char *__reject);
extern __inline char *
__strsep_g (char **__s, __const char *__reject)
{
  register char *__retval = *__s;
  if (__retval == ((void *)0))
    return ((void *)0);
  if ((*__s = __extension__ ({ char __a0, __a1, __a2; (__builtin_constant_p (__reject) && ((size_t)(const void *)((__reject) + 1) - (size_t)(const void *)(__reject) == 1) ? ((__a0 = ((__const char *) (__reject))[0], __a0 == '\0') ? ((void) (__retval), ((void *)0)) : ((__a1 = ((__const char *) (__reject))[1], __a1 == '\0') ? (__extension__ (__builtin_constant_p (__a0) && (__a0) == '\0' ? (char *) __rawmemchr (__retval, __a0) : strchr (__retval, __a0))) : ((__a2 = ((__const char *) (__reject))[2], __a2 == '\0') ? __strpbrk_c2 (__retval, __a0, __a1) : (((__const char *) (__reject))[3] == '\0' ? __strpbrk_c3 (__retval, __a0, __a1, __a2) : strpbrk (__retval, __reject))))) : strpbrk (__retval, __reject)); })) != ((void *)0))
    *(*__s)++ = '\0';
  return __retval;
}
# 1188 "/usr/include/bits/string2.h" 3
# 1 "/usr/include/stdlib.h" 1 3
# 25 "/usr/include/stdlib.h" 3
# 1 "/usr/include/features.h" 1 3
# 26 "/usr/include/stdlib.h" 2 3







# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 34 "/usr/include/stdlib.h" 2 3
# 528 "/usr/include/stdlib.h" 3
extern void *malloc (size_t __size) __attribute__ ((__malloc__));

extern void *calloc (size_t __nmemb, size_t __size)
             __attribute__ ((__malloc__));
# 1189 "/usr/include/bits/string2.h" 2 3




extern char *__strdup (__const char *__string) __attribute__ ((__malloc__));
# 1212 "/usr/include/bits/string2.h" 3
extern char *__strndup (__const char *__string, size_t __n)
             __attribute__ ((__malloc__));
# 360 "/usr/include/string.h" 2 3
# 55 "stdfn.h" 2
# 98 "stdfn.h"
# 1 "/usr/include/stdlib.h" 1 3
# 25 "/usr/include/stdlib.h" 3
# 1 "/usr/include/features.h" 1 3
# 26 "/usr/include/stdlib.h" 2 3







# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 34 "/usr/include/stdlib.h" 2 3
# 94 "/usr/include/stdlib.h" 3
typedef struct
  {
    int quot;
    int rem;
  } div_t;



typedef struct
  {
    long int quot;
    long int rem;
  } ldiv_t;
# 133 "/usr/include/stdlib.h" 3
extern size_t __ctype_get_mb_cur_max (void) ;



extern double atof (__const char *__nptr) __attribute__ ((__pure__));

extern int atoi (__const char *__nptr) __attribute__ ((__pure__));

extern long int atol (__const char *__nptr) __attribute__ ((__pure__));



__extension__ extern long long int atoll (__const char *__nptr)
             __attribute__ ((__pure__));



extern double strtod (__const char *__restrict __nptr,
                      char **__restrict __endptr) ;
# 163 "/usr/include/stdlib.h" 3
extern long int strtol (__const char *__restrict __nptr,
                        char **__restrict __endptr, int __base) ;

extern unsigned long int strtoul (__const char *__restrict __nptr,
                                  char **__restrict __endptr, int __base)
            ;



__extension__
extern long long int strtoq (__const char *__restrict __nptr,
                             char **__restrict __endptr, int __base) ;

__extension__
extern unsigned long long int strtouq (__const char *__restrict __nptr,
                                       char **__restrict __endptr, int __base)
            ;






__extension__
extern long long int strtoll (__const char *__restrict __nptr,
                              char **__restrict __endptr, int __base) ;

__extension__
extern unsigned long long int strtoull (__const char *__restrict __nptr,
                                        char **__restrict __endptr, int __base)
            ;
# 250 "/usr/include/stdlib.h" 3
extern double __strtod_internal (__const char *__restrict __nptr,
                                 char **__restrict __endptr, int __group)
            ;
extern float __strtof_internal (__const char *__restrict __nptr,
                                char **__restrict __endptr, int __group)
            ;
extern long double __strtold_internal (__const char *__restrict __nptr,
                                       char **__restrict __endptr,
                                       int __group) ;

extern long int __strtol_internal (__const char *__restrict __nptr,
                                   char **__restrict __endptr,
                                   int __base, int __group) ;



extern unsigned long int __strtoul_internal (__const char *__restrict __nptr,
                                             char **__restrict __endptr,
                                             int __base, int __group) ;




__extension__
extern long long int __strtoll_internal (__const char *__restrict __nptr,
                                         char **__restrict __endptr,
                                         int __base, int __group) ;



__extension__
extern unsigned long long int __strtoull_internal (__const char *
                                                   __restrict __nptr,
                                                   char **__restrict __endptr,
                                                   int __base, int __group)
            ;
# 294 "/usr/include/stdlib.h" 3
extern __inline double
strtod (__const char *__restrict __nptr, char **__restrict __endptr)
{
  return __strtod_internal (__nptr, __endptr, 0);
}
extern __inline long int
strtol (__const char *__restrict __nptr, char **__restrict __endptr,
        int __base)
{
  return __strtol_internal (__nptr, __endptr, __base, 0);
}
extern __inline unsigned long int
strtoul (__const char *__restrict __nptr, char **__restrict __endptr,
         int __base)
{
  return __strtoul_internal (__nptr, __endptr, __base, 0);
}
# 326 "/usr/include/stdlib.h" 3
__extension__ extern __inline long long int
strtoq (__const char *__restrict __nptr, char **__restrict __endptr,
        int __base)
{
  return __strtoll_internal (__nptr, __endptr, __base, 0);
}
__extension__ extern __inline unsigned long long int
strtouq (__const char *__restrict __nptr, char **__restrict __endptr,
         int __base)
{
  return __strtoull_internal (__nptr, __endptr, __base, 0);
}



__extension__ extern __inline long long int
strtoll (__const char *__restrict __nptr, char **__restrict __endptr,
         int __base)
{
  return __strtoll_internal (__nptr, __endptr, __base, 0);
}
__extension__ extern __inline unsigned long long int
strtoull (__const char * __restrict __nptr, char **__restrict __endptr,
          int __base)
{
  return __strtoull_internal (__nptr, __endptr, __base, 0);
}


extern __inline double
atof (__const char *__nptr)
{
  return strtod (__nptr, (char **) ((void *)0));
}
extern __inline int
atoi (__const char *__nptr)
{
  return (int) strtol (__nptr, (char **) ((void *)0), 10);
}
extern __inline long int
atol (__const char *__nptr)
{
  return strtol (__nptr, (char **) ((void *)0), 10);
}


__extension__ extern __inline long long int
atoll (__const char *__nptr)
{
  return strtoll (__nptr, (char **) ((void *)0), 10);
}
# 385 "/usr/include/stdlib.h" 3
extern char *l64a (long int __n) ;


extern long int a64l (__const char *__s) __attribute__ ((__pure__));


# 1 "/usr/include/sys/types.h" 1 3
# 26 "/usr/include/sys/types.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/sys/types.h" 2 3



# 1 "/usr/include/bits/types.h" 1 3
# 31 "/usr/include/sys/types.h" 2 3


typedef __u_char u_char;
typedef __u_short u_short;
typedef __u_int u_int;
typedef __u_long u_long;
typedef __quad_t quad_t;
typedef __u_quad_t u_quad_t;
typedef __fsid_t fsid_t;


typedef __loff_t loff_t;



typedef __ino_t ino_t;
# 58 "/usr/include/sys/types.h" 3
typedef __dev_t dev_t;




typedef __gid_t gid_t;




typedef __mode_t mode_t;




typedef __nlink_t nlink_t;




typedef __uid_t uid_t;





typedef __off_t off_t;
# 96 "/usr/include/sys/types.h" 3
typedef __pid_t pid_t;




typedef __id_t id_t;




typedef __ssize_t ssize_t;




typedef __daddr_t daddr_t;
typedef __caddr_t caddr_t;



typedef __key_t key_t;
# 126 "/usr/include/sys/types.h" 3
# 1 "/usr/include/time.h" 1 3
# 67 "/usr/include/time.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 68 "/usr/include/time.h" 2 3


typedef __time_t time_t;
# 79 "/usr/include/time.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 80 "/usr/include/time.h" 2 3


typedef __clockid_t clockid_t;
# 91 "/usr/include/time.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 92 "/usr/include/time.h" 2 3


typedef __timer_t timer_t;
# 127 "/usr/include/sys/types.h" 2 3
# 140 "/usr/include/sys/types.h" 3
# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 141 "/usr/include/sys/types.h" 2 3



typedef unsigned long int ulong;
typedef unsigned short int ushort;
typedef unsigned int uint;
# 184 "/usr/include/sys/types.h" 3
typedef int int8_t __attribute__ ((__mode__ (__QI__)));
typedef int int16_t __attribute__ ((__mode__ (__HI__)));
typedef int int32_t __attribute__ ((__mode__ (__SI__)));
typedef int int64_t __attribute__ ((__mode__ (__DI__)));


typedef unsigned int u_int8_t __attribute__ ((__mode__ (__QI__)));
typedef unsigned int u_int16_t __attribute__ ((__mode__ (__HI__)));
typedef unsigned int u_int32_t __attribute__ ((__mode__ (__SI__)));
typedef unsigned int u_int64_t __attribute__ ((__mode__ (__DI__)));

typedef int register_t __attribute__ ((__mode__ (__word__)));
# 206 "/usr/include/sys/types.h" 3
# 1 "/usr/include/endian.h" 1 3
# 207 "/usr/include/sys/types.h" 2 3


# 1 "/usr/include/sys/select.h" 1 3
# 25 "/usr/include/sys/select.h" 3
# 1 "/usr/include/features.h" 1 3
# 26 "/usr/include/sys/select.h" 2 3


# 1 "/usr/include/bits/types.h" 1 3
# 29 "/usr/include/sys/select.h" 2 3


# 1 "/usr/include/bits/select.h" 1 3
# 32 "/usr/include/sys/select.h" 2 3


# 1 "/usr/include/bits/sigset.h" 1 3
# 23 "/usr/include/bits/sigset.h" 3
typedef int __sig_atomic_t;




typedef struct
  {
    unsigned long int __val[(1024 / (8 * sizeof (unsigned long int)))];
  } __sigset_t;
# 35 "/usr/include/sys/select.h" 2 3



typedef __sigset_t sigset_t;




# 1 "/usr/include/time.h" 1 3
# 106 "/usr/include/time.h" 3
struct timespec
  {
    long int tv_sec;
    long int tv_nsec;
  };
# 44 "/usr/include/sys/select.h" 2 3

# 1 "/usr/include/bits/time.h" 1 3
# 63 "/usr/include/bits/time.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 64 "/usr/include/bits/time.h" 2 3



struct timeval
  {
    __time_t tv_sec;
    __suseconds_t tv_usec;
  };
# 46 "/usr/include/sys/select.h" 2 3



typedef long int __fd_mask;







typedef struct
  {






    __fd_mask __fds_bits[1024 / (8 * sizeof (__fd_mask))];


  } fd_set;






typedef __fd_mask fd_mask;
# 96 "/usr/include/sys/select.h" 3
extern int select (int __nfds, fd_set *__restrict __readfds,
                   fd_set *__restrict __writefds,
                   fd_set *__restrict __exceptfds,
                   struct timeval *__restrict __timeout) ;
# 210 "/usr/include/sys/types.h" 2 3


# 1 "/usr/include/sys/sysmacros.h" 1 3
# 213 "/usr/include/sys/types.h" 2 3
# 224 "/usr/include/sys/types.h" 3
typedef __blkcnt_t blkcnt_t;



typedef __fsblkcnt_t fsblkcnt_t;



typedef __fsfilcnt_t fsfilcnt_t;
# 392 "/usr/include/stdlib.h" 2 3






extern long int random (void) ;


extern void srandom (unsigned int __seed) ;





extern char *initstate (unsigned int __seed, char *__statebuf,
                        size_t __statelen) ;



extern char *setstate (char *__statebuf) ;







struct random_data
  {
    int32_t *fptr;
    int32_t *rptr;
    int32_t *state;
    int rand_type;
    int rand_deg;
    int rand_sep;
    int32_t *end_ptr;
  };

extern int random_r (struct random_data *__restrict __buf,
                     int32_t *__restrict __result) ;

extern int srandom_r (unsigned int __seed, struct random_data *__buf) ;

extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
                        size_t __statelen,
                        struct random_data *__restrict __buf) ;

extern int setstate_r (char *__restrict __statebuf,
                       struct random_data *__restrict __buf) ;





extern int rand (void) ;

extern void srand (unsigned int __seed) ;



extern int rand_r (unsigned int *__seed) ;







extern double drand48 (void) ;
extern double erand48 (unsigned short int __xsubi[3]) ;


extern long int lrand48 (void) ;
extern long int nrand48 (unsigned short int __xsubi[3]) ;


extern long int mrand48 (void) ;
extern long int jrand48 (unsigned short int __xsubi[3]) ;


extern void srand48 (long int __seedval) ;
extern unsigned short int *seed48 (unsigned short int __seed16v[3]) ;
extern void lcong48 (unsigned short int __param[7]) ;





struct drand48_data
  {
    unsigned short int __x[3];
    unsigned short int __old_x[3];
    unsigned short int __c;
    unsigned short int __init;
    unsigned long long int __a;
  };


extern int drand48_r (struct drand48_data *__restrict __buffer,
                      double *__restrict __result) ;
extern int erand48_r (unsigned short int __xsubi[3],
                      struct drand48_data *__restrict __buffer,
                      double *__restrict __result) ;


extern int lrand48_r (struct drand48_data *__restrict __buffer,
                      long int *__restrict __result) ;
extern int nrand48_r (unsigned short int __xsubi[3],
                      struct drand48_data *__restrict __buffer,
                      long int *__restrict __result) ;


extern int mrand48_r (struct drand48_data *__restrict __buffer,
                      long int *__restrict __result) ;
extern int jrand48_r (unsigned short int __xsubi[3],
                      struct drand48_data *__restrict __buffer,
                      long int *__restrict __result) ;


extern int srand48_r (long int __seedval, struct drand48_data *__buffer)
            ;

extern int seed48_r (unsigned short int __seed16v[3],
                     struct drand48_data *__buffer) ;

extern int lcong48_r (unsigned short int __param[7],
                      struct drand48_data *__buffer) ;
# 537 "/usr/include/stdlib.h" 3
extern void *realloc (void *__ptr, size_t __size) __attribute__ ((__malloc__));

extern void free (void *__ptr) ;



extern void cfree (void *__ptr) ;



# 1 "/usr/include/alloca.h" 1 3
# 22 "/usr/include/alloca.h" 3
# 1 "/usr/include/features.h" 1 3
# 23 "/usr/include/alloca.h" 2 3


# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 26 "/usr/include/alloca.h" 2 3







extern void *alloca (size_t __size) ;
# 548 "/usr/include/stdlib.h" 2 3




extern void *valloc (size_t __size) __attribute__ ((__malloc__));
# 562 "/usr/include/stdlib.h" 3
extern void abort (void) __attribute__ ((__noreturn__));



extern int atexit (void (*__func) (void)) ;




extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
            ;





extern void exit (int __status) __attribute__ ((__noreturn__));
# 588 "/usr/include/stdlib.h" 3
extern char *getenv (__const char *__name) ;



extern char *__secure_getenv (__const char *__name) ;





extern int putenv (char *__string) ;





extern int setenv (__const char *__name, __const char *__value, int __replace)
            ;


extern int unsetenv (__const char *__name) ;






extern int clearenv (void) ;
# 624 "/usr/include/stdlib.h" 3
extern char *mktemp (char *__template) ;







extern int mkstemp (char *__template) ;
# 651 "/usr/include/stdlib.h" 3
extern char *mkdtemp (char *__template) ;




extern int system (__const char *__command) ;
# 673 "/usr/include/stdlib.h" 3
extern char *realpath (__const char *__restrict __name,
                       char *__restrict __resolved) ;






typedef int (*__compar_fn_t) (__const void *, __const void *);
# 690 "/usr/include/stdlib.h" 3
extern void *bsearch (__const void *__key, __const void *__base,
                      size_t __nmemb, size_t __size, __compar_fn_t __compar);



extern void qsort (void *__base, size_t __nmemb, size_t __size,
                   __compar_fn_t __compar);



extern int abs (int __x) __attribute__ ((__const__));
extern long int labs (long int __x) __attribute__ ((__const__));
# 711 "/usr/include/stdlib.h" 3
extern div_t div (int __numer, int __denom)
             __attribute__ ((__const__));
extern ldiv_t ldiv (long int __numer, long int __denom)
             __attribute__ ((__const__));
# 729 "/usr/include/stdlib.h" 3
extern char *ecvt (double __value, int __ndigit, int *__restrict __decpt,
                   int *__restrict __sign) ;




extern char *fcvt (double __value, int __ndigit, int *__restrict __decpt,
                   int *__restrict __sign) ;




extern char *gcvt (double __value, int __ndigit, char *__buf) ;




extern char *qecvt (long double __value, int __ndigit,
                    int *__restrict __decpt, int *__restrict __sign) ;
extern char *qfcvt (long double __value, int __ndigit,
                    int *__restrict __decpt, int *__restrict __sign) ;
extern char *qgcvt (long double __value, int __ndigit, char *__buf) ;




extern int ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
                   int *__restrict __sign, char *__restrict __buf,
                   size_t __len) ;
extern int fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
                   int *__restrict __sign, char *__restrict __buf,
                   size_t __len) ;

extern int qecvt_r (long double __value, int __ndigit,
                    int *__restrict __decpt, int *__restrict __sign,
                    char *__restrict __buf, size_t __len) ;
extern int qfcvt_r (long double __value, int __ndigit,
                    int *__restrict __decpt, int *__restrict __sign,
                    char *__restrict __buf, size_t __len) ;






extern int mblen (__const char *__s, size_t __n) ;


extern int mbtowc (wchar_t *__restrict __pwc,
                   __const char *__restrict __s, size_t __n) ;


extern int wctomb (char *__s, wchar_t __wchar) ;



extern size_t mbstowcs (wchar_t *__restrict __pwcs,
                        __const char *__restrict __s, size_t __n) ;

extern size_t wcstombs (char *__restrict __s,
                        __const wchar_t *__restrict __pwcs, size_t __n)
            ;







extern int rpmatch (__const char *__response) ;
# 859 "/usr/include/stdlib.h" 3
extern int getloadavg (double __loadavg[], int __nelem) ;
# 99 "stdfn.h" 2
# 125 "stdfn.h"
# 1 "/usr/include/unistd.h" 1 3
# 26 "/usr/include/unistd.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/unistd.h" 2 3
# 175 "/usr/include/unistd.h" 3
# 1 "/usr/include/bits/posix_opt.h" 1 3
# 176 "/usr/include/unistd.h" 2 3
# 190 "/usr/include/unistd.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 191 "/usr/include/unistd.h" 2 3
# 199 "/usr/include/unistd.h" 3
# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 200 "/usr/include/unistd.h" 2 3
# 240 "/usr/include/unistd.h" 3
typedef __intptr_t intptr_t;






typedef __socklen_t socklen_t;
# 260 "/usr/include/unistd.h" 3
extern int access (__const char *__name, int __type) ;
# 290 "/usr/include/unistd.h" 3
extern __off_t lseek (int __fd, __off_t __offset, int __whence) ;
# 306 "/usr/include/unistd.h" 3
extern int close (int __fd) ;



extern ssize_t read (int __fd, void *__buf, size_t __nbytes) ;


extern ssize_t write (int __fd, __const void *__buf, size_t __n) ;
# 353 "/usr/include/unistd.h" 3
extern int pipe (int __pipedes[2]) ;
# 362 "/usr/include/unistd.h" 3
extern unsigned int alarm (unsigned int __seconds) ;
# 371 "/usr/include/unistd.h" 3
extern unsigned int sleep (unsigned int __seconds) ;






extern __useconds_t ualarm (__useconds_t __value, __useconds_t __interval)
            ;



extern int usleep (__useconds_t __useconds) ;





extern int pause (void) ;



extern int chown (__const char *__file, __uid_t __owner, __gid_t __group)
            ;



extern int fchown (int __fd, __uid_t __owner, __gid_t __group) ;




extern int lchown (__const char *__file, __uid_t __owner, __gid_t __group)
            ;




extern int chdir (__const char *__path) ;



extern int fchdir (int __fd) ;
# 423 "/usr/include/unistd.h" 3
extern char *getcwd (char *__buf, size_t __size) ;
# 436 "/usr/include/unistd.h" 3
extern char *getwd (char *__buf) ;




extern int dup (int __fd) ;


extern int dup2 (int __fd, int __fd2) ;


extern char **__environ;







extern int execve (__const char *__path, char *__const __argv[],
                   char *__const __envp[]) ;
# 467 "/usr/include/unistd.h" 3
extern int execv (__const char *__path, char *__const __argv[]) ;



extern int execle (__const char *__path, __const char *__arg, ...) ;



extern int execl (__const char *__path, __const char *__arg, ...) ;



extern int execvp (__const char *__file, char *__const __argv[]) ;




extern int execlp (__const char *__file, __const char *__arg, ...) ;




extern int nice (int __inc) ;




extern void _exit (int __status) __attribute__ ((__noreturn__));





# 1 "/usr/include/bits/confname.h" 1 3
# 25 "/usr/include/bits/confname.h" 3
enum
  {
    _PC_LINK_MAX,

    _PC_MAX_CANON,

    _PC_MAX_INPUT,

    _PC_NAME_MAX,

    _PC_PATH_MAX,

    _PC_PIPE_BUF,

    _PC_CHOWN_RESTRICTED,

    _PC_NO_TRUNC,

    _PC_VDISABLE,

    _PC_SYNC_IO,

    _PC_ASYNC_IO,

    _PC_PRIO_IO,

    _PC_SOCK_MAXBUF,

    _PC_FILESIZEBITS,

    _PC_REC_INCR_XFER_SIZE,

    _PC_REC_MAX_XFER_SIZE,

    _PC_REC_MIN_XFER_SIZE,

    _PC_REC_XFER_ALIGN,

    _PC_ALLOC_SIZE_MIN,

    _PC_SYMLINK_MAX

  };


enum
  {
    _SC_ARG_MAX,

    _SC_CHILD_MAX,

    _SC_CLK_TCK,

    _SC_NGROUPS_MAX,

    _SC_OPEN_MAX,

    _SC_STREAM_MAX,

    _SC_TZNAME_MAX,

    _SC_JOB_CONTROL,

    _SC_SAVED_IDS,

    _SC_REALTIME_SIGNALS,

    _SC_PRIORITY_SCHEDULING,

    _SC_TIMERS,

    _SC_ASYNCHRONOUS_IO,

    _SC_PRIORITIZED_IO,

    _SC_SYNCHRONIZED_IO,

    _SC_FSYNC,

    _SC_MAPPED_FILES,

    _SC_MEMLOCK,

    _SC_MEMLOCK_RANGE,

    _SC_MEMORY_PROTECTION,

    _SC_MESSAGE_PASSING,

    _SC_SEMAPHORES,

    _SC_SHARED_MEMORY_OBJECTS,

    _SC_AIO_LISTIO_MAX,

    _SC_AIO_MAX,

    _SC_AIO_PRIO_DELTA_MAX,

    _SC_DELAYTIMER_MAX,

    _SC_MQ_OPEN_MAX,

    _SC_MQ_PRIO_MAX,

    _SC_VERSION,

    _SC_PAGESIZE,


    _SC_RTSIG_MAX,

    _SC_SEM_NSEMS_MAX,

    _SC_SEM_VALUE_MAX,

    _SC_SIGQUEUE_MAX,

    _SC_TIMER_MAX,




    _SC_BC_BASE_MAX,

    _SC_BC_DIM_MAX,

    _SC_BC_SCALE_MAX,

    _SC_BC_STRING_MAX,

    _SC_COLL_WEIGHTS_MAX,

    _SC_EQUIV_CLASS_MAX,

    _SC_EXPR_NEST_MAX,

    _SC_LINE_MAX,

    _SC_RE_DUP_MAX,

    _SC_CHARCLASS_NAME_MAX,


    _SC_2_VERSION,

    _SC_2_C_BIND,

    _SC_2_C_DEV,

    _SC_2_FORT_DEV,

    _SC_2_FORT_RUN,

    _SC_2_SW_DEV,

    _SC_2_LOCALEDEF,


    _SC_PII,

    _SC_PII_XTI,

    _SC_PII_SOCKET,

    _SC_PII_INTERNET,

    _SC_PII_OSI,

    _SC_POLL,

    _SC_SELECT,

    _SC_UIO_MAXIOV,

    _SC_IOV_MAX = _SC_UIO_MAXIOV,

    _SC_PII_INTERNET_STREAM,

    _SC_PII_INTERNET_DGRAM,

    _SC_PII_OSI_COTS,

    _SC_PII_OSI_CLTS,

    _SC_PII_OSI_M,

    _SC_T_IOV_MAX,



    _SC_THREADS,

    _SC_THREAD_SAFE_FUNCTIONS,

    _SC_GETGR_R_SIZE_MAX,

    _SC_GETPW_R_SIZE_MAX,

    _SC_LOGIN_NAME_MAX,

    _SC_TTY_NAME_MAX,

    _SC_THREAD_DESTRUCTOR_ITERATIONS,

    _SC_THREAD_KEYS_MAX,

    _SC_THREAD_STACK_MIN,

    _SC_THREAD_THREADS_MAX,

    _SC_THREAD_ATTR_STACKADDR,

    _SC_THREAD_ATTR_STACKSIZE,

    _SC_THREAD_PRIORITY_SCHEDULING,

    _SC_THREAD_PRIO_INHERIT,

    _SC_THREAD_PRIO_PROTECT,

    _SC_THREAD_PROCESS_SHARED,


    _SC_NPROCESSORS_CONF,

    _SC_NPROCESSORS_ONLN,

    _SC_PHYS_PAGES,

    _SC_AVPHYS_PAGES,

    _SC_ATEXIT_MAX,

    _SC_PASS_MAX,


    _SC_XOPEN_VERSION,

    _SC_XOPEN_XCU_VERSION,

    _SC_XOPEN_UNIX,

    _SC_XOPEN_CRYPT,

    _SC_XOPEN_ENH_I18N,

    _SC_XOPEN_SHM,


    _SC_2_CHAR_TERM,

    _SC_2_C_VERSION,

    _SC_2_UPE,


    _SC_XOPEN_XPG2,

    _SC_XOPEN_XPG3,

    _SC_XOPEN_XPG4,


    _SC_CHAR_BIT,

    _SC_CHAR_MAX,

    _SC_CHAR_MIN,

    _SC_INT_MAX,

    _SC_INT_MIN,

    _SC_LONG_BIT,

    _SC_WORD_BIT,

    _SC_MB_LEN_MAX,

    _SC_NZERO,

    _SC_SSIZE_MAX,

    _SC_SCHAR_MAX,

    _SC_SCHAR_MIN,

    _SC_SHRT_MAX,

    _SC_SHRT_MIN,

    _SC_UCHAR_MAX,

    _SC_UINT_MAX,

    _SC_ULONG_MAX,

    _SC_USHRT_MAX,


    _SC_NL_ARGMAX,

    _SC_NL_LANGMAX,

    _SC_NL_MSGMAX,

    _SC_NL_NMAX,

    _SC_NL_SETMAX,

    _SC_NL_TEXTMAX,


    _SC_XBS5_ILP32_OFF32,

    _SC_XBS5_ILP32_OFFBIG,

    _SC_XBS5_LP64_OFF64,

    _SC_XBS5_LPBIG_OFFBIG,


    _SC_XOPEN_LEGACY,

    _SC_XOPEN_REALTIME,

    _SC_XOPEN_REALTIME_THREADS,


    _SC_ADVISORY_INFO,

    _SC_BARRIERS,

    _SC_BASE,

    _SC_C_LANG_SUPPORT,

    _SC_C_LANG_SUPPORT_R,

    _SC_CLOCK_SELECTION,

    _SC_CPUTIME,

    _SC_THREAD_CPUTIME,

    _SC_DEVICE_IO,

    _SC_DEVICE_SPECIFIC,

    _SC_DEVICE_SPECIFIC_R,

    _SC_FD_MGMT,

    _SC_FIFO,

    _SC_PIPE,

    _SC_FILE_ATTRIBUTES,

    _SC_FILE_LOCKING,

    _SC_FILE_SYSTEM,

    _SC_MONOTONIC_CLOCK,

    _SC_MULTI_PROCESS,

    _SC_SINGLE_PROCESS,

    _SC_NETWORKING,

    _SC_READER_WRITER_LOCKS,

    _SC_SPIN_LOCKS,

    _SC_REGEXP,

    _SC_REGEX_VERSION,

    _SC_SHELL,

    _SC_SIGNALS,

    _SC_SPAWN,

    _SC_SPORADIC_SERVER,

    _SC_THREAD_SPORADIC_SERVER,

    _SC_SYSTEM_DATABASE,

    _SC_SYSTEM_DATABASE_R,

    _SC_TIMEOUTS,

    _SC_TYPED_MEMORY_OBJECTS,

    _SC_USER_GROUPS,

    _SC_USER_GROUPS_R,

    _SC_2_PBS,

    _SC_2_PBS_ACCOUNTING,

    _SC_2_PBS_LOCATE,

    _SC_2_PBS_MESSAGE,

    _SC_2_PBS_TRACK,

    _SC_SYMLOOP_MAX,

    _SC_STREAMS,

    _SC_2_PBS_CHECKPOINT,


    _SC_V6_ILP32_OFF32,

    _SC_V6_ILP32_OFFBIG,

    _SC_V6_LP64_OFF64,

    _SC_V6_LPBIG_OFFBIG,


    _SC_HOST_NAME_MAX,

    _SC_TRACE,

    _SC_TRACE_EVENT_FILTER,

    _SC_TRACE_INHERIT,

    _SC_TRACE_LOG

  };





enum
  {
    _CS_PATH,
# 563 "/usr/include/bits/confname.h" 3
    _CS_V6_WIDTH_RESTRICTED_ENVS

  };
# 501 "/usr/include/unistd.h" 2 3


extern long int pathconf (__const char *__path, int __name) ;


extern long int fpathconf (int __fd, int __name) ;


extern long int sysconf (int __name) __attribute__ ((__const__));



extern size_t confstr (int __name, char *__buf, size_t __len) ;




extern __pid_t getpid (void) ;


extern __pid_t getppid (void) ;




extern __pid_t getpgrp (void) ;
# 536 "/usr/include/unistd.h" 3
extern __pid_t __getpgid (__pid_t __pid) ;
# 545 "/usr/include/unistd.h" 3
extern int setpgid (__pid_t __pid, __pid_t __pgid) ;
# 562 "/usr/include/unistd.h" 3
extern int setpgrp (void) ;
# 580 "/usr/include/unistd.h" 3
extern __pid_t setsid (void) ;







extern __uid_t getuid (void) ;


extern __uid_t geteuid (void) ;


extern __gid_t getgid (void) ;


extern __gid_t getegid (void) ;




extern int getgroups (int __size, __gid_t __list[]) ;
# 613 "/usr/include/unistd.h" 3
extern int setuid (__uid_t __uid) ;




extern int setreuid (__uid_t __ruid, __uid_t __euid) ;




extern int seteuid (__uid_t __uid) ;






extern int setgid (__gid_t __gid) ;




extern int setregid (__gid_t __rgid, __gid_t __egid) ;




extern int setegid (__gid_t __gid) ;






extern __pid_t fork (void) ;






extern __pid_t vfork (void) ;





extern char *ttyname (int __fd) ;



extern int ttyname_r (int __fd, char *__buf, size_t __buflen) ;



extern int isatty (int __fd) ;





extern int ttyslot (void) ;




extern int link (__const char *__from, __const char *__to) ;



extern int symlink (__const char *__from, __const char *__to) ;




extern int readlink (__const char *__restrict __path, char *__restrict __buf,
                     size_t __len) ;



extern int unlink (__const char *__name) ;


extern int rmdir (__const char *__path) ;



extern __pid_t tcgetpgrp (int __fd) ;


extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) ;



extern char *getlogin (void) ;
# 717 "/usr/include/unistd.h" 3
extern int setlogin (__const char *__name) ;
# 726 "/usr/include/unistd.h" 3
# 1 "/usr/include/getopt.h" 1 3
# 47 "/usr/include/getopt.h" 3
extern char *optarg;
# 61 "/usr/include/getopt.h" 3
extern int optind;




extern int opterr;



extern int optopt;
# 145 "/usr/include/getopt.h" 3
extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
# 727 "/usr/include/unistd.h" 2 3







extern int gethostname (char *__name, size_t __len) ;






extern int sethostname (__const char *__name, size_t __len) ;



extern int sethostid (long int __id) ;





extern int getdomainname (char *__name, size_t __len) ;
extern int setdomainname (__const char *__name, size_t __len) ;





extern int vhangup (void) ;


extern int revoke (__const char *__file) ;







extern int profil (unsigned short int *__sample_buffer, size_t __size,
                   size_t __offset, unsigned int __scale) ;





extern int acct (__const char *__name) ;



extern char *getusershell (void) ;
extern void endusershell (void) ;
extern void setusershell (void) ;





extern int daemon (int __nochdir, int __noclose) ;






extern int chroot (__const char *__path) ;



extern char *getpass (__const char *__prompt) ;





extern int fsync (int __fd) ;






extern long int gethostid (void) ;


extern void sync (void) ;




extern int getpagesize (void) __attribute__ ((__const__));




extern int truncate (__const char *__file, __off_t __length) ;
# 841 "/usr/include/unistd.h" 3
extern int ftruncate (int __fd, __off_t __length) ;
# 857 "/usr/include/unistd.h" 3
extern int getdtablesize (void) ;
# 866 "/usr/include/unistd.h" 3
extern int brk (void *__addr) ;





extern void *sbrk (intptr_t __delta) ;
# 887 "/usr/include/unistd.h" 3
extern long int syscall (long int __sysno, ...) ;
# 907 "/usr/include/unistd.h" 3
extern int lockf (int __fd, int __cmd, __off_t __len) ;
# 938 "/usr/include/unistd.h" 3
extern int fdatasync (int __fildes) ;
# 983 "/usr/include/unistd.h" 3
extern int pthread_atfork (void (*__prepare) (void),
                           void (*__parent) (void),
                           void (*__child) (void)) ;
# 126 "stdfn.h" 2







# 1 "/usr/include/errno.h" 1 3
# 29 "/usr/include/errno.h" 3
# 1 "/usr/include/features.h" 1 3
# 30 "/usr/include/errno.h" 2 3






# 1 "/usr/include/bits/errno.h" 1 3
# 25 "/usr/include/bits/errno.h" 3
# 1 "/usr/include/linux/errno.h" 1 3



# 1 "/usr/include/asm/errno.h" 1 3
# 5 "/usr/include/linux/errno.h" 2 3
# 26 "/usr/include/bits/errno.h" 2 3
# 36 "/usr/include/bits/errno.h" 3
extern int errno;


extern int *__errno_location (void) __attribute__ ((__const__));
# 37 "/usr/include/errno.h" 2 3
# 134 "stdfn.h" 2






# 1 "/usr/include/sys/types.h" 1 3
# 141 "stdfn.h" 2



# 1 "/usr/include/sys/stat.h" 1 3
# 26 "/usr/include/sys/stat.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/sys/stat.h" 2 3

# 1 "/usr/include/bits/types.h" 1 3
# 29 "/usr/include/sys/stat.h" 2 3
# 98 "/usr/include/sys/stat.h" 3
# 1 "/usr/include/bits/stat.h" 1 3
# 36 "/usr/include/bits/stat.h" 3
struct stat
  {
    __dev_t st_dev;
    unsigned short int __pad1;

    __ino_t st_ino;



    __mode_t st_mode;
    __nlink_t st_nlink;
    __uid_t st_uid;
    __gid_t st_gid;
    __dev_t st_rdev;
    unsigned short int __pad2;

    __off_t st_size;



    __blksize_t st_blksize;


    __blkcnt_t st_blocks;



    __time_t st_atime;
    unsigned long int __unused1;
    __time_t st_mtime;
    unsigned long int __unused2;
    __time_t st_ctime;
    unsigned long int __unused3;

    unsigned long int __unused4;
    unsigned long int __unused5;



  };
# 99 "/usr/include/sys/stat.h" 2 3
# 200 "/usr/include/sys/stat.h" 3
extern int stat (__const char *__restrict __file,
                 struct stat *__restrict __buf) ;



extern int fstat (int __fd, struct stat *__buf) ;
# 228 "/usr/include/sys/stat.h" 3
extern int lstat (__const char *__restrict __file,
                  struct stat *__restrict __buf) ;
# 249 "/usr/include/sys/stat.h" 3
extern int chmod (__const char *__file, __mode_t __mode) ;



extern int fchmod (int __fd, __mode_t __mode) ;





extern __mode_t umask (__mode_t __mask) ;
# 268 "/usr/include/sys/stat.h" 3
extern int mkdir (__const char *__path, __mode_t __mode) ;





extern int mknod (__const char *__path, __mode_t __mode, __dev_t __dev)
            ;




extern int mkfifo (__const char *__path, __mode_t __mode) ;
# 306 "/usr/include/sys/stat.h" 3
extern int __fxstat (int __ver, int __fildes, struct stat *__stat_buf) ;
extern int __xstat (int __ver, __const char *__filename,
                    struct stat *__stat_buf) ;
extern int __lxstat (int __ver, __const char *__filename,
                     struct stat *__stat_buf) ;
# 337 "/usr/include/sys/stat.h" 3
extern int __xmknod (int __ver, __const char *__path, __mode_t __mode,
                     __dev_t *__dev) ;




extern __inline__ int stat (__const char *__path,
                            struct stat *__statbuf)
{
  return __xstat (3, __path, __statbuf);
}


extern __inline__ int lstat (__const char *__path,
                             struct stat *__statbuf)
{
  return __lxstat (3, __path, __statbuf);
}


extern __inline__ int fstat (int __fd, struct stat *__statbuf)
{
  return __fxstat (3, __fd, __statbuf);
}


extern __inline__ int mknod (__const char *__path, __mode_t __mode,
                             __dev_t __dev)
{
  return __xmknod (1, __path, __mode, &__dev);
}
# 145 "stdfn.h" 2
# 217 "stdfn.h"
# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/limits.h" 1 3
# 11 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/limits.h" 3
# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/syslimits.h" 1 3






# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/limits.h" 1 3
# 130 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/limits.h" 3
# 1 "/usr/include/limits.h" 1 3
# 26 "/usr/include/limits.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/limits.h" 2 3
# 144 "/usr/include/limits.h" 3
# 1 "/usr/include/bits/posix1_lim.h" 1 3
# 126 "/usr/include/bits/posix1_lim.h" 3
# 1 "/usr/include/bits/local_lim.h" 1 3
# 36 "/usr/include/bits/local_lim.h" 3
# 1 "/usr/include/linux/limits.h" 1 3
# 37 "/usr/include/bits/local_lim.h" 2 3
# 127 "/usr/include/bits/posix1_lim.h" 2 3
# 145 "/usr/include/limits.h" 2 3



# 1 "/usr/include/bits/posix2_lim.h" 1 3
# 149 "/usr/include/limits.h" 2 3
# 131 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/limits.h" 2 3
# 8 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/syslimits.h" 2 3
# 12 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/limits.h" 2 3
# 218 "stdfn.h" 2
# 229 "stdfn.h"
# 1 "/usr/include/time.h" 1 3
# 28 "/usr/include/time.h" 3
# 1 "/usr/include/features.h" 1 3
# 29 "/usr/include/time.h" 2 3
# 38 "/usr/include/time.h" 3
# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 39 "/usr/include/time.h" 2 3



# 1 "/usr/include/bits/time.h" 1 3
# 39 "/usr/include/bits/time.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 40 "/usr/include/bits/time.h" 2 3
extern long int __sysconf (int);
# 43 "/usr/include/time.h" 2 3
# 56 "/usr/include/time.h" 3
# 1 "/usr/include/bits/types.h" 1 3
# 57 "/usr/include/time.h" 2 3


typedef __clock_t clock_t;
# 118 "/usr/include/time.h" 3
struct tm
{
  int tm_sec;
  int tm_min;
  int tm_hour;
  int tm_mday;
  int tm_mon;
  int tm_year;
  int tm_wday;
  int tm_yday;
  int tm_isdst;


  long int tm_gmtoff;
  __const char *tm_zone;




};




struct itimerspec
  {
    struct timespec it_interval;
    struct timespec it_value;
  };


struct sigevent;
# 163 "/usr/include/time.h" 3
extern clock_t clock (void) ;


extern time_t time (time_t *__timer) ;


extern double difftime (time_t __time1, time_t __time0)
             __attribute__ ((__const__));


extern time_t mktime (struct tm *__tp) ;





extern size_t strftime (char *__restrict __s, size_t __maxsize,
                        __const char *__restrict __format,
                        __const struct tm *__restrict __tp) ;
# 194 "/usr/include/time.h" 3
extern struct tm *gmtime (__const time_t *__timer) ;



extern struct tm *localtime (__const time_t *__timer) ;




extern struct tm *gmtime_r (__const time_t *__restrict __timer,
                            struct tm *__restrict __tp) ;



extern struct tm *localtime_r (__const time_t *__restrict __timer,
                               struct tm *__restrict __tp) ;




extern char *asctime (__const struct tm *__tp) ;


extern char *ctime (__const time_t *__timer) ;






extern char *asctime_r (__const struct tm *__restrict __tp,
                        char *__restrict __buf) ;


extern char *ctime_r (__const time_t *__restrict __timer,
                      char *__restrict __buf) ;




extern char *__tzname[2];
extern int __daylight;
extern long int __timezone;




extern char *tzname[2];



extern void tzset (void) ;



extern int daylight;
extern long int timezone;





extern int stime (__const time_t *__when) ;
# 271 "/usr/include/time.h" 3
extern time_t timegm (struct tm *__tp) ;


extern time_t timelocal (struct tm *__tp) ;


extern int dysize (int __year) __attribute__ ((__const__));





extern int nanosleep (__const struct timespec *__requested_time,
                      struct timespec *__remaining) ;



extern int clock_getres (clockid_t __clock_id, struct timespec *__res) ;


extern int clock_gettime (clockid_t __clock_id, struct timespec *__tp) ;


extern int clock_settime (clockid_t __clock_id, __const struct timespec *__tp)
            ;
# 309 "/usr/include/time.h" 3
extern int timer_create (clockid_t __clock_id,
                         struct sigevent *__restrict __evp,
                         timer_t *__restrict __timerid) ;


extern int timer_delete (timer_t __timerid) ;


extern int timer_settime (timer_t __timerid, int __flags,
                          __const struct itimerspec *__restrict __value,
                          struct itimerspec *__restrict __ovalue) ;


extern int timer_gettime (timer_t __timerid, struct itimerspec *__value)
            ;


extern int timer_getoverrun (timer_t __timerid) ;
# 230 "stdfn.h" 2
# 238 "stdfn.h"
# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/float.h" 1 3
# 239 "stdfn.h" 2



# 1 "/usr/include/locale.h" 1 3
# 26 "/usr/include/locale.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/locale.h" 2 3


# 1 "/usr/opt/packages/gcc-3.0/lib/gcc-lib/i586-pc-linux-gnu/3.0/include/stddef.h" 1 3
# 30 "/usr/include/locale.h" 2 3
# 1 "/usr/include/bits/locale.h" 1 3
# 27 "/usr/include/bits/locale.h" 3
enum
{
  __LC_CTYPE = 0,
  __LC_NUMERIC = 1,
  __LC_TIME = 2,
  __LC_COLLATE = 3,
  __LC_MONETARY = 4,
  __LC_MESSAGES = 5,
  __LC_ALL = 6,
  __LC_PAPER = 7,
  __LC_NAME = 8,
  __LC_ADDRESS = 9,
  __LC_TELEPHONE = 10,
  __LC_MEASUREMENT = 11,
  __LC_IDENTIFICATION = 12
};
# 31 "/usr/include/locale.h" 2 3
# 52 "/usr/include/locale.h" 3
struct lconv
{


  char *decimal_point;
  char *thousands_sep;





  char *grouping;





  char *int_curr_symbol;
  char *currency_symbol;
  char *mon_decimal_point;
  char *mon_thousands_sep;
  char *mon_grouping;
  char *positive_sign;
  char *negative_sign;
  char int_frac_digits;
  char frac_digits;

  char p_cs_precedes;

  char p_sep_by_space;

  char n_cs_precedes;

  char n_sep_by_space;






  char p_sign_posn;
  char n_sign_posn;
# 112 "/usr/include/locale.h" 3
  char __int_p_cs_precedes;
  char __int_p_sep_by_space;
  char __int_n_cs_precedes;
  char __int_n_sep_by_space;
  char __int_p_sign_posn;
  char __int_n_sign_posn;

};



extern char *setlocale (int __category, __const char *__locale) ;


extern struct lconv *localeconv (void) ;
# 243 "stdfn.h" 2



# 1 "/usr/include/math.h" 1 3
# 27 "/usr/include/math.h" 3
# 1 "/usr/include/features.h" 1 3
# 28 "/usr/include/math.h" 2 3





# 1 "/usr/include/bits/huge_val.h" 1 3
# 25 "/usr/include/bits/huge_val.h" 3
# 1 "/usr/include/features.h" 1 3
# 26 "/usr/include/bits/huge_val.h" 2 3
# 34 "/usr/include/math.h" 2 3






# 1 "/usr/include/bits/mathdef.h" 1 3
# 41 "/usr/include/math.h" 2 3
# 63 "/usr/include/math.h" 3
# 1 "/usr/include/bits/mathcalls.h" 1 3
# 54 "/usr/include/bits/mathcalls.h" 3
extern double acos (double __x) ; extern double __acos (double __x) ;

extern double asin (double __x) ; extern double __asin (double __x) ;

extern double atan (double __x) ; extern double __atan (double __x) ;

extern double atan2 (double __y, double __x) ; extern double __atan2 (double __y, double __x) ;


extern double cos (double __x) ; extern double __cos (double __x) ;

extern double sin (double __x) ; extern double __sin (double __x) ;

extern double tan (double __x) ; extern double __tan (double __x) ;
# 78 "/usr/include/bits/mathcalls.h" 3
extern double cosh (double __x) ; extern double __cosh (double __x) ;

extern double sinh (double __x) ; extern double __sinh (double __x) ;

extern double tanh (double __x) ; extern double __tanh (double __x) ;



extern double acosh (double __x) ; extern double __acosh (double __x) ;

extern double asinh (double __x) ; extern double __asinh (double __x) ;

extern double atanh (double __x) ; extern double __atanh (double __x) ;





extern double exp (double __x) ; extern double __exp (double __x) ;
# 106 "/usr/include/bits/mathcalls.h" 3
extern double frexp (double __x, int *__exponent) ; extern double __frexp (double __x, int *__exponent) ;


extern double ldexp (double __x, int __exponent) ; extern double __ldexp (double __x, int __exponent) ;


extern double log (double __x) ; extern double __log (double __x) ;


extern double log10 (double __x) ; extern double __log10 (double __x) ;


extern double modf (double __x, double *__iptr) ; extern double __modf (double __x, double *__iptr) ;



extern double expm1 (double __x) ; extern double __expm1 (double __x) ;


extern double log1p (double __x) ; extern double __log1p (double __x) ;


extern double logb (double __x) ; extern double __logb (double __x) ;
# 143 "/usr/include/bits/mathcalls.h" 3
extern double pow (double __x, double __y) ; extern double __pow (double __x, double __y) ;


extern double sqrt (double __x) ; extern double __sqrt (double __x) ;



extern double hypot (double __x, double __y) ; extern double __hypot (double __x, double __y) ;




extern double cbrt (double __x) ; extern double __cbrt (double __x) ;






extern double ceil (double __x) ; extern double __ceil (double __x) ;


extern double fabs (double __x) __attribute__ ((__const__)); extern double __fabs (double __x) __attribute__ ((__const__));


extern double floor (double __x) ; extern double __floor (double __x) ;


extern double fmod (double __x, double __y) ; extern double __fmod (double __x, double __y) ;




extern int __isinf (double __value) __attribute__ ((__const__));


extern int __finite (double __value) __attribute__ ((__const__));




extern int isinf (double __value) __attribute__ ((__const__));


extern int finite (double __value) __attribute__ ((__const__));


extern double drem (double __x, double __y) ; extern double __drem (double __x, double __y) ;



extern double significand (double __x) ; extern double __significand (double __x) ;




extern double copysign (double __x, double __y) __attribute__ ((__const__)); extern double __copysign (double __x, double __y) __attribute__ ((__const__));
# 209 "/usr/include/bits/mathcalls.h" 3
extern int __isnan (double __value) __attribute__ ((__const__));



extern int isnan (double __value) __attribute__ ((__const__));


extern double j0 (double) ; extern double __j0 (double) ;
extern double j1 (double) ; extern double __j1 (double) ;
extern double jn (int, double) ; extern double __jn (int, double) ;
extern double y0 (double) ; extern double __y0 (double) ;
extern double y1 (double) ; extern double __y1 (double) ;
extern double yn (int, double) ; extern double __yn (int, double) ;





extern double erf (double) ; extern double __erf (double) ;
extern double erfc (double) ; extern double __erfc (double) ;
extern double lgamma (double) ; extern double __lgamma (double) ;
# 238 "/usr/include/bits/mathcalls.h" 3
extern double gamma (double) ; extern double __gamma (double) ;






extern double lgamma_r (double, int *__signgamp) ; extern double __lgamma_r (double, int *__signgamp) ;






extern double rint (double __x) ; extern double __rint (double __x) ;


extern double nextafter (double __x, double __y) __attribute__ ((__const__)); extern double __nextafter (double __x, double __y) __attribute__ ((__const__));





extern double remainder (double __x, double __y) ; extern double __remainder (double __x, double __y) ;



extern double scalb (double __x, double __n) ; extern double __scalb (double __x, double __n) ;




extern double scalbn (double __x, int __n) ; extern double __scalbn (double __x, int __n) ;



extern int ilogb (double __x) ; extern int __ilogb (double __x) ;
# 64 "/usr/include/math.h" 2 3
# 82 "/usr/include/math.h" 3
# 1 "/usr/include/bits/mathcalls.h" 1 3
# 54 "/usr/include/bits/mathcalls.h" 3
extern float acosf (float __x) ; extern float __acosf (float __x) ;

extern float asinf (float __x) ; extern float __asinf (float __x) ;

extern float atanf (float __x) ; extern float __atanf (float __x) ;

extern float atan2f (float __y, float __x) ; extern float __atan2f (float __y, float __x) ;


extern float cosf (float __x) ; extern float __cosf (float __x) ;

extern float sinf (float __x) ; extern float __sinf (float __x) ;

extern float tanf (float __x) ; extern float __tanf (float __x) ;
# 78 "/usr/include/bits/mathcalls.h" 3
extern float coshf (float __x) ; extern float __coshf (float __x) ;

extern float sinhf (float __x) ; extern float __sinhf (float __x) ;

extern float tanhf (float __x) ; extern float __tanhf (float __x) ;



extern float acoshf (float __x) ; extern float __acoshf (float __x) ;

extern float asinhf (float __x) ; extern float __asinhf (float __x) ;

extern float atanhf (float __x) ; extern float __atanhf (float __x) ;





extern float expf (float __x) ; extern float __expf (float __x) ;
# 106 "/usr/include/bits/mathcalls.h" 3
extern float frexpf (float __x, int *__exponent) ; extern float __frexpf (float __x, int *__exponent) ;


extern float ldexpf (float __x, int __exponent) ; extern float __ldexpf (float __x, int __exponent) ;


extern float logf (float __x) ; extern float __logf (float __x) ;


extern float log10f (float __x) ; extern float __log10f (float __x) ;


extern float modff (float __x, float *__iptr) ; extern float __modff (float __x, float *__iptr) ;



extern float expm1f (float __x) ; extern float __expm1f (float __x) ;


extern float log1pf (float __x) ; extern float __log1pf (float __x) ;


extern float logbf (float __x) ; extern float __logbf (float __x) ;
# 143 "/usr/include/bits/mathcalls.h" 3
extern float powf (float __x, float __y) ; extern float __powf (float __x, float __y) ;


extern float sqrtf (float __x) ; extern float __sqrtf (float __x) ;



extern float hypotf (float __x, float __y) ; extern float __hypotf (float __x, float __y) ;




extern float cbrtf (float __x) ; extern float __cbrtf (float __x) ;






extern float ceilf (float __x) ; extern float __ceilf (float __x) ;


extern float fabsf (float __x) __attribute__ ((__const__)); extern float __fabsf (float __x) __attribute__ ((__const__));


extern float floorf (float __x) ; extern float __floorf (float __x) ;


extern float fmodf (float __x, float __y) ; extern float __fmodf (float __x, float __y) ;




extern int __isinff (float __value) __attribute__ ((__const__));


extern int __finitef (float __value) __attribute__ ((__const__));




extern int isinff (float __value) __attribute__ ((__const__));


extern int finitef (float __value) __attribute__ ((__const__));


extern float dremf (float __x, float __y) ; extern float __dremf (float __x, float __y) ;



extern float significandf (float __x) ; extern float __significandf (float __x) ;




extern float copysignf (float __x, float __y) __attribute__ ((__const__)); extern float __copysignf (float __x, float __y) __attribute__ ((__const__));
# 209 "/usr/include/bits/mathcalls.h" 3
extern int __isnanf (float __value) __attribute__ ((__const__));



extern int isnanf (float __value) __attribute__ ((__const__));


extern float j0f (float) ; extern float __j0f (float) ;
extern float j1f (float) ; extern float __j1f (float) ;
extern float jnf (int, float) ; extern float __jnf (int, float) ;
extern float y0f (float) ; extern float __y0f (float) ;
extern float y1f (float) ; extern float __y1f (float) ;
extern float ynf (int, float) ; extern float __ynf (int, float) ;





extern float erff (float) ; extern float __erff (float) ;
extern float erfcf (float) ; extern float __erfcf (float) ;
extern float lgammaf (float) ; extern float __lgammaf (float) ;
# 238 "/usr/include/bits/mathcalls.h" 3
extern float gammaf (float) ; extern float __gammaf (float) ;






extern float lgammaf_r (float, int *__signgamp) ; extern float __lgammaf_r (float, int *__signgamp) ;






extern float rintf (float __x) ; extern float __rintf (float __x) ;


extern float nextafterf (float __x, float __y) __attribute__ ((__const__)); extern float __nextafterf (float __x, float __y) __attribute__ ((__const__));





extern float remainderf (float __x, float __y) ; extern float __remainderf (float __x, float __y) ;



extern float scalbf (float __x, float __n) ; extern float __scalbf (float __x, float __n) ;




extern float scalbnf (float __x, int __n) ; extern float __scalbnf (float __x, int __n) ;



extern int ilogbf (float __x) ; extern int __ilogbf (float __x) ;
# 83 "/usr/include/math.h" 2 3
# 99 "/usr/include/math.h" 3
# 1 "/usr/include/bits/mathcalls.h" 1 3
# 54 "/usr/include/bits/mathcalls.h" 3
extern long double acosl (long double __x) ; extern long double __acosl (long double __x) ;

extern long double asinl (long double __x) ; extern long double __asinl (long double __x) ;

extern long double atanl (long double __x) ; extern long double __atanl (long double __x) ;

extern long double atan2l (long double __y, long double __x) ; extern long double __atan2l (long double __y, long double __x) ;


extern long double cosl (long double __x) ; extern long double __cosl (long double __x) ;

extern long double sinl (long double __x) ; extern long double __sinl (long double __x) ;

extern long double tanl (long double __x) ; extern long double __tanl (long double __x) ;
# 78 "/usr/include/bits/mathcalls.h" 3
extern long double coshl (long double __x) ; extern long double __coshl (long double __x) ;

extern long double sinhl (long double __x) ; extern long double __sinhl (long double __x) ;

extern long double tanhl (long double __x) ; extern long double __tanhl (long double __x) ;



extern long double acoshl (long double __x) ; extern long double __acoshl (long double __x) ;

extern long double asinhl (long double __x) ; extern long double __asinhl (long double __x) ;

extern long double atanhl (long double __x) ; extern long double __atanhl (long double __x) ;





extern long double expl (long double __x) ; extern long double __expl (long double __x) ;
# 106 "/usr/include/bits/mathcalls.h" 3
extern long double frexpl (long double __x, int *__exponent) ; extern long double __frexpl (long double __x, int *__exponent) ;


extern long double ldexpl (long double __x, int __exponent) ; extern long double __ldexpl (long double __x, int __exponent) ;


extern long double logl (long double __x) ; extern long double __logl (long double __x) ;


extern long double log10l (long double __x) ; extern long double __log10l (long double __x) ;


extern long double modfl (long double __x, long double *__iptr) ; extern long double __modfl (long double __x, long double *__iptr) ;



extern long double expm1l (long double __x) ; extern long double __expm1l (long double __x) ;


extern long double log1pl (long double __x) ; extern long double __log1pl (long double __x) ;


extern long double logbl (long double __x) ; extern long double __logbl (long double __x) ;
# 143 "/usr/include/bits/mathcalls.h" 3
extern long double powl (long double __x, long double __y) ; extern long double __powl (long double __x, long double __y) ;


extern long double sqrtl (long double __x) ; extern long double __sqrtl (long double __x) ;



extern long double hypotl (long double __x, long double __y) ; extern long double __hypotl (long double __x, long double __y) ;




extern long double cbrtl (long double __x) ; extern long double __cbrtl (long double __x) ;






extern long double ceill (long double __x) ; extern long double __ceill (long double __x) ;


extern long double fabsl (long double __x) __attribute__ ((__const__)); extern long double __fabsl (long double __x) __attribute__ ((__const__));


extern long double floorl (long double __x) ; extern long double __floorl (long double __x) ;


extern long double fmodl (long double __x, long double __y) ; extern long double __fmodl (long double __x, long double __y) ;




extern int __isinfl (long double __value) __attribute__ ((__const__));


extern int __finitel (long double __value) __attribute__ ((__const__));




extern int isinfl (long double __value) __attribute__ ((__const__));


extern int finitel (long double __value) __attribute__ ((__const__));


extern long double dreml (long double __x, long double __y) ; extern long double __dreml (long double __x, long double __y) ;



extern long double significandl (long double __x) ; extern long double __significandl (long double __x) ;




extern long double copysignl (long double __x, long double __y) __attribute__ ((__const__)); extern long double __copysignl (long double __x, long double __y) __attribute__ ((__const__));
# 209 "/usr/include/bits/mathcalls.h" 3
extern int __isnanl (long double __value) __attribute__ ((__const__));



extern int isnanl (long double __value) __attribute__ ((__const__));


extern long double j0l (long double) ; extern long double __j0l (long double) ;
extern long double j1l (long double) ; extern long double __j1l (long double) ;
extern long double jnl (int, long double) ; extern long double __jnl (int, long double) ;
extern long double y0l (long double) ; extern long double __y0l (long double) ;
extern long double y1l (long double) ; extern long double __y1l (long double) ;
extern long double ynl (int, long double) ; extern long double __ynl (int, long double) ;





extern long double erfl (long double) ; extern long double __erfl (long double) ;
extern long double erfcl (long double) ; extern long double __erfcl (long double) ;
extern long double lgammal (long double) ; extern long double __lgammal (long double) ;
# 238 "/usr/include/bits/mathcalls.h" 3
extern long double gammal (long double) ; extern long double __gammal (long double) ;






extern long double lgammal_r (long double, int *__signgamp) ; extern long double __lgammal_r (long double, int *__signgamp) ;






extern long double rintl (long double __x) ; extern long double __rintl (long double __x) ;


extern long double nextafterl (long double __x, long double __y) __attribute__ ((__const__)); extern long double __nextafterl (long double __x, long double __y) __attribute__ ((__const__));





extern long double remainderl (long double __x, long double __y) ; extern long double __remainderl (long double __x, long double __y) ;



extern long double scalbl (long double __x, long double __n) ; extern long double __scalbl (long double __x, long double __n) ;




extern long double scalbnl (long double __x, int __n) ; extern long double __scalbnl (long double __x, int __n) ;



extern int ilogbl (long double __x) ; extern int __ilogbl (long double __x) ;
# 100 "/usr/include/math.h" 2 3
# 113 "/usr/include/math.h" 3
extern int signgam;
# 240 "/usr/include/math.h" 3
typedef enum
{
  _IEEE_ = -1,
  _SVID_,
  _XOPEN_,
  _POSIX_,
  _ISOC_
} _LIB_VERSION_TYPE;




extern _LIB_VERSION_TYPE _LIB_VERSION;
# 265 "/usr/include/math.h" 3
struct exception

  {
    int type;
    char *name;
    double arg1;
    double arg2;
    double retval;
  };




extern int matherr (struct exception *__exc);
# 350 "/usr/include/math.h" 3
# 1 "/usr/include/bits/mathinline.h" 1 3
# 291 "/usr/include/bits/mathinline.h" 3
extern __inline double __sgn (double) ; extern __inline double __sgn (double __x) { return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0); } extern __inline float __sgnf (float) ; extern __inline float __sgnf (float __x) { return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0); } extern __inline long double __sgnl (long double) ; extern __inline long double __sgnl (long double __x) { return __x == 0.0 ? 0.0 : (__x > 0.0 ? 1.0 : -1.0); }
# 425 "/usr/include/bits/mathinline.h" 3
extern __inline double atan2 (double __y, double __x) { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value; } extern __inline float atan2f (float __y, float __x) { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value; } extern __inline long double atan2l (long double __y, long double __x) { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value; }
extern __inline long double __atan2l (long double __y, long double __x) { register long double __value; __asm __volatile__ ("fpatan" : "=t" (__value) : "0" (__x), "u" (__y) : "st(1)"); return __value; }


extern __inline double fmod (double __x, double __y) { register long double __value; __asm __volatile__ ("1:	fprem\n\t" "fnstsw	%%ax\n\t" "sahf\n\t" "jp	1b" : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc"); return __value; } extern __inline float fmodf (float __x, float __y) { register long double __value; __asm __volatile__ ("1:	fprem\n\t" "fnstsw	%%ax\n\t" "sahf\n\t" "jp	1b" : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc"); return __value; } extern __inline long double fmodl (long double __x, long double __y) { register long double __value; __asm __volatile__ ("1:	fprem\n\t" "fnstsw	%%ax\n\t" "sahf\n\t" "jp	1b" : "=t" (__value) : "0" (__x), "u" (__y) : "ax", "cc"); return __value; }
# 440 "/usr/include/bits/mathinline.h" 3
extern __inline double sqrt (double __x) { register double __result; __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); return __result; } extern __inline float sqrtf (float __x) { register float __result; __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); return __result; } extern __inline long double sqrtl (long double __x) { register long double __result; __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); return __result; }
extern __inline long double __sqrtl (long double __x) { register long double __result; __asm __volatile__ ("fsqrt" : "=t" (__result) : "0" (__x)); return __result; }


extern __inline double fabs (double __x) { return __builtin_fabs (__x); }
extern __inline float fabsf (float __x) { return __builtin_fabsf (__x); }
extern __inline long double fabsl (long double __x) { return __builtin_fabsl (__x); }
extern __inline long double __fabsl (long double __x) { return __builtin_fabsl (__x); }
# 466 "/usr/include/bits/mathinline.h" 3
extern __inline double atan (double __x) { register double __result; __asm __volatile__ ("fld1; fpatan" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline float atanf (float __x) { register float __result; __asm __volatile__ ("fld1; fpatan" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; } extern __inline long double atanl (long double __x) { register long double __result; __asm __volatile__ ("fld1; fpatan" : "=t" (__result) : "0" (__x) : "st(1)"); return __result; }

extern __inline long double __sgn1l (long double) ; extern __inline long double __sgn1l (long double __x) { __extension__ union { long double __xld; unsigned int __xi[3]; } __n = { __xld: __x }; __n.__xi[2] = (__n.__xi[2] & 0x8000) | 0x3fff; __n.__xi[1] = 0x80000000; __n.__xi[0] = 0; return __n.__xld; }
# 492 "/usr/include/bits/mathinline.h" 3
extern __inline double floor (double __x) { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0400; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; } extern __inline float floorf (float __x) { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0400; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; } extern __inline long double floorl (long double __x) { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstc!
w %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0400; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; }
# 503 "/usr/include/bits/mathinline.h" 3
extern __inline double ceil (double __x) { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0800; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; } extern __inline float ceilf (float __x) { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0800; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; } extern __inline long double ceill (long double __x) { register long double __value; __volatile unsigned short int __cw; __volatile unsigned short int __cwtmp; __asm __volatile ("fnstcw %!
0" : "=m" (__cw)); __cwtmp = (__cw & 0xf3ff) | 0x0800; __asm __volatile ("fldcw %0" : : "m" (__cwtmp)); __asm __volatile ("frndint" : "=t" (__value) : "0" (__x)); __asm __volatile ("fldcw %0" : : "m" (__cw)); return __value; }
# 521 "/usr/include/bits/mathinline.h" 3
extern __inline double
ldexp (double __x, int __y)
{
  register long double __value; __asm __volatile__ ("fscale" : "=t" (__value) : "0" (__x), "u" ((long double) __y)); return __value;
}
# 539 "/usr/include/bits/mathinline.h" 3
extern __inline double log1p (double __x) { register long double __value; if (__fabsl (__x) >= 1.0 - 0.5 * 1.41421356237309504880L) __value = logl (1.0 + __x); else __asm __volatile__ ("fldln2\n\t" "fxch\n\t" "fyl2xp1" : "=t" (__value) : "0" (__x) : "st(1)"); return __value; } extern __inline float log1pf (float __x) { register long double __value; if (__fabsl (__x) >= 1.0 - 0.5 * 1.41421356237309504880L) __value = logl (1.0 + __x); else __asm __volatile__ ("fldln2\n\t" "fxch\n\t" "fyl2xp1" : "=t" (__value) : "0" (__x) : "st(1)"); return __value; } extern __inline long double log1pl (long double __x) { register long double __value; if (__fabsl (__x) >= 1.0 - 0.5 * 1.41421356237309504880L) __value = logl (1.0 + __x); else __asm __volatile__ ("fldln2\n\t" "fxch\n\t" "fyl2xp1" : "=t" (__value) : "0" (__x) : "st(1)"); return __value; }
# 553 "/usr/include/bits/mathinline.h" 3
extern __inline double asinh (double __x) { register long double __y = __fabsl (__x); return (log1pl (__y * __y / (__sqrtl (__y * __y + 1.0) + 1.0) + __y) * __sgn1l (__x)); } extern __inline float asinhf (float __x) { register long double __y = __fabsl (__x); return (log1pl (__y * __y / (__sqrtl (__y * __y + 1.0) + 1.0) + __y) * __sgn1l (__x)); } extern __inline long double asinhl (long double __x) { register long double __y = __fabsl (__x); return (log1pl (__y * __y / (__sqrtl (__y * __y + 1.0) + 1.0) + __y) * __sgn1l (__x)); }




extern __inline double acosh (double __x) { return logl (__x + __sqrtl (__x - 1.0) * __sqrtl (__x + 1.0)); } extern __inline float acoshf (float __x) { return logl (__x + __sqrtl (__x - 1.0) * __sqrtl (__x + 1.0)); } extern __inline long double acoshl (long double __x) { return logl (__x + __sqrtl (__x - 1.0) * __sqrtl (__x + 1.0)); }


extern __inline double atanh (double __x) { register long double __y = __fabsl (__x); return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x); } extern __inline float atanhf (float __x) { register long double __y = __fabsl (__x); return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x); } extern __inline long double atanhl (long double __x) { register long double __y = __fabsl (__x); return -0.5 * log1pl (-(__y + __y) / (1.0 + __y)) * __sgn1l (__x); }




extern __inline double hypot (double __x, double __y) { return __sqrtl (__x * __x + __y * __y); } extern __inline float hypotf (float __x, float __y) { return __sqrtl (__x * __x + __y * __y); } extern __inline long double hypotl (long double __x, long double __y) { return __sqrtl (__x * __x + __y * __y); }

extern __inline double logb (double __x) { register long double __value; register long double __junk; __asm __volatile__ ("fxtract\n\t" : "=t" (__junk), "=u" (__value) : "0" (__x)); return __value; } extern __inline float logbf (float __x) { register long double __value; register long double __junk; __asm __volatile__ ("fxtract\n\t" : "=t" (__junk), "=u" (__value) : "0" (__x)); return __value; } extern __inline long double logbl (long double __x) { register long double __value; register long double __junk; __asm __volatile__ ("fxtract\n\t" : "=t" (__junk), "=u" (__value) : "0" (__x)); return __value; }
# 652 "/usr/include/bits/mathinline.h" 3
extern __inline double drem (double __x, double __y) { register double __value; register int __clobbered; __asm __volatile__ ("1:	fprem1\n\t" "fstsw	%%ax\n\t" "sahf\n\t" "jp	1b" : "=t" (__value), "=&a" (__clobbered) : "0" (__x), "u" (__y) : "cc"); return __value; } extern __inline float dremf (float __x, float __y) { register double __value; register int __clobbered; __asm __volatile__ ("1:	fprem1\n\t" "fstsw	%%ax\n\t" "sahf\n\t" "jp	1b" : "=t" (__value), "=&a" (__clobbered) : "0" (__x), "u" (__y) : "cc"); return __value; } extern __inline long double dreml (long double __x, long double __y) { register double __value; register int __clobbered; __asm __volatile__ ("1:	fprem1\n\t" "fstsw	%%ax\n\t" "sahf\n\t" "jp	1b" : "=t" (__value), "=&a" (__clobbered) : "0" (__x), "u" (__y) : "cc"); return __value; }
# 665 "/usr/include/bits/mathinline.h" 3
extern __inline int
__finite (double __x)
{
  return (__extension__
          (((((union { double __d; int __i[2]; }) {__d: __x}).__i[1]
             | 0x800fffffu) + 1) >> 31));
}
# 351 "/usr/include/math.h" 2 3
# 247 "stdfn.h" 2
# 289 "stdfn.h"
# 1 "/usr/include/assert.h" 1 3
# 36 "/usr/include/assert.h" 3
# 1 "/usr/include/features.h" 1 3
# 37 "/usr/include/assert.h" 2 3
# 68 "/usr/include/assert.h" 3
extern void __assert_fail (__const char *__assertion, __const char *__file,
                           unsigned int __line, __const char *__function)
             __attribute__ ((__noreturn__));


extern void __assert_perror_fail (int __errnum, __const char *__file,
                                  unsigned int __line,
                                  __const char *__function)
             __attribute__ ((__noreturn__));




extern void __assert (const char *__assertion, const char *__file, int __line)
             __attribute__ ((__noreturn__));
# 290 "stdfn.h" 2
# 49 "plot.h" 2
# 81 "plot.h"
typedef int TBOOLEAN;
# 222 "plot.h"
typedef double coordval;
# 343 "plot.h"
typedef void (*sigfunc)(int);





typedef int (*sortfunc) (const void *, const void *);




enum operators {

        PUSH, PUSHC, PUSHD1, PUSHD2, PUSHD, CALL, CALLN, LNOT, BNOT, UMINUS,
        LOR, LAND, BOR, XOR, BAND, EQ, NE, GT, LT, GE, LE, PLUS, MINUS, MULT,
        DIV, MOD, POWER, FACTORIAL, BOOLE,
        DOLLARS,

   JUMP, JUMPZ, JUMPNZ, JTERN, SF_START
};





enum DATA_TYPES {
        INTGR, CMPLX
};



enum PLOT_TYPE {
        FUNC, DATA, FUNC3D, DATA3D
};







enum PLOT_STYLE {
        LINES = 0*8 + 1,
        POINTSTYLE = 1*8 + 2,
        IMPULSES = 2*8 + 1,
        LINESPOINTS= 3*8 + 3,
        DOTS = 4*8 + 0,
        XERRORBARS = 5*8 + 6,
        YERRORBARS = 6*8 + 6,
        XYERRORBARS= 7*8 + 6,
        BOXXYERROR = 8*8 + 1,
        BOXES = 9*8 + 1,
        BOXERROR =10*8 + 1,
        STEPS =11*8 + 1,
        FSTEPS =12*8 + 1,
        HISTEPS =13*8 + 1,
        VECTOR =14*8 + 1,
        CANDLESTICKS=15*8 + 4,
        FINANCEBARS=16*8 + 1
};

enum PLOT_SMOOTH {
        NONE, UNIQUE, CSPLINES, ACSPLINES, BEZIER, SBEZIER

};




enum JUSTIFY {
        LEFT, CENTRE, RIGHT
};







struct cmplx {
        double real, imag;
};



struct value {
        enum DATA_TYPES type;
        union {
                int int_val;
                struct cmplx cmplx_val;
        } v;
};


struct lexical_unit {
        TBOOLEAN is_token;
        struct value l_val;
        int start_index;
        int length;
};


struct udft_entry {
        struct udft_entry *next_udf;
        char udf_name[50 +1];
        struct at_type *at;
        char *definition;
        struct value dummy_values[5];
};


struct udvt_entry {
        struct udvt_entry *next_udv;
        char udv_name[50 +1];
        TBOOLEAN udv_undef;
        struct value udv_value;
};


union argument {
        int j_arg;
        struct value v_arg;
        struct udvt_entry *udv_arg;
        struct udft_entry *udf_arg;
};


struct at_entry {
        enum operators index;
        union argument arg;
};


struct at_type {
        int a_count;
        struct at_entry actions[150];

};






typedef int (*FUNC_PTR) (union argument *arg);


struct ft_entry {
        char *f_name;
        FUNC_PTR func;
};




enum coord_type {
    INRANGE,
    OUTRANGE,
    UNDEFINED
};


struct coordinate {
        enum coord_type type;
        coordval x, y, z;
        coordval ylow, yhigh;
        coordval xlow, xhigh;



};

struct lp_style_type {
        int pointflag;
        int l_type,
                p_type;
        double l_width,
                p_size;

};






struct curve_points {
        struct curve_points *next_cp;
        int token;
        enum PLOT_TYPE plot_type;
        enum PLOT_STYLE plot_style;
        enum PLOT_SMOOTH plot_smooth;
        char *title;
        struct lp_style_type lp_properties;
        int p_max;
        int p_count;
        int x_axis;
        int y_axis;
        struct coordinate *points;
};

struct gnuplot_contours {
        struct gnuplot_contours *next;
        struct coordinate *coords;
        char isNewLevel;
        char label[32];
        int num_pts;
};

struct iso_curve {
        struct iso_curve *next;
        int p_max;
        int p_count;
        struct coordinate *points;
};

struct surface_points {
        struct surface_points *next_sp;
        int token;
        enum PLOT_TYPE plot_type;
        enum PLOT_STYLE plot_style;
        char *title;
        struct lp_style_type lp_properties;
        int has_grid_topology;
        int num_iso_read;

        struct gnuplot_contours *contours;
        struct iso_curve *iso_crvs;
};
# 591 "plot.h"
struct TERMENTRY {
        char *name;



        char *description;

        unsigned int xmax,ymax,v_char,h_char,v_tic,h_tic;

        void (*options) (void);
        void (*init) (void);
        void (*reset) (void);
        void (*text) (void);
        int (*scale) (double, double);
        void (*graphics) (void);
        void (*move) (unsigned int, unsigned int);
        void (*vector) (unsigned int, unsigned int);
        void (*linetype) (int);
        void (*put_text) (unsigned int, unsigned int,char*);

        int (*text_angle) (int);
        int (*justify_text) (enum JUSTIFY);
        void (*point) (unsigned int, unsigned int,int);
        void (*arrow) (unsigned int, unsigned int, unsigned int, unsigned int, int);
        int (*set_font) (char *font);
        void (*pointsize) (double);
        int flags;
        void (*suspend) (void);
        void (*resume) (void);
        void (*fillbox) (int, unsigned int, unsigned int, unsigned int, unsigned int);
   void (*linewidth) (double linewidth);
};
# 633 "plot.h"
enum position_type { first_axes, second_axes, graph, screen };

struct position {
        enum position_type scalex,scaley,scalez;
        double x,y,z;
};

struct text_label {
        struct text_label *next;
        int tag;
        struct position place;
        enum JUSTIFY pos;
        int rotate;
        char text[1024 +1];
        char font[1024 +1];
};

struct arrow_def {
        struct arrow_def *next;
        int tag;
        struct position start;
        struct position end;
        TBOOLEAN head;
        struct lp_style_type lp_properties;
};

struct linestyle_def {
        struct linestyle_def *next;
        int tag;
        struct lp_style_type lp_properties;
};


struct ticdef {
    int type;





    union {
           struct {
                  double start, incr;
                  double end;
           } series;
           struct ticmark *user;
    } def;
};






struct ticmark {
    double position;
    char *label;
    struct ticmark *next;
};
# 718 "plot.h"
extern TBOOLEAN screen_ok;
extern struct TERMENTRY *term;
extern TBOOLEAN undefined;
extern char *input_line;
extern int input_line_len;
extern char *replot_line;
extern struct lexical_unit *token;
extern int token_table_size;
extern int num_tokens, c_token;
extern int inline_num;
extern char c_dummy_var[5][50 +1];
extern struct ft_entry ft[];
extern struct udft_entry *first_udf;
extern struct udvt_entry *first_udv;
extern TBOOLEAN interactive;
extern char *infile_name;
extern struct udft_entry *dummy_func;
extern char dummy_var[5][50 +1];
# 782 "plot.h"
# 1 "protos.h" 1
# 38 "protos.h"
# 1 "ansichek.h" 1
# 39 "protos.h" 2






void extend_input_line (void);
void extend_token_table (void);
void init_memory (void);
int com_line (void);
int do_line (void);
void done (int status);
void define (void);
void bail_to_command_line (void);


typedef double tri_diag[3];

struct gnuplot_contours *contour (int num_isolines, struct iso_curve *iso_lines, int ZLevels, int approx_pts, int int_kind, int order1, int levels_kind, double *levels_list);
int solve_tri_diag (tri_diag m[], double r[], double x[], int n);


int df_open (int max_using);
int df_readline (double v[], int max);
void df_close (void);
int df_2dbinary (struct curve_points *this_plot);
int df_3dmatrix (struct surface_points *this_plot);



struct udvt_entry * add_udv (int t_num);
struct udft_entry * add_udf (int t_num);
int standard (int t_num);
void execute_at (struct at_type *at_ptr);




char *get_next_word (char **s, char *subst);
void init_fit (void);
void setvar (char *varname, struct value data);
int getivar (char *varname);
void update (char *pfile, char *npfile);
void do_fit (void);
size_t wri_to_fil_last_fit_cmd (FILE *fp);




void graph_error (char *text);
void fixup_range (int axis, char *axis_name);
void timetic_format (int axis, double amin, double amax);
void do_plot (struct curve_points *plots, int pcount);
double time_tic_just (int level, double ticplace);
double make_ltic (int tlevel, double incr);
int label_width (char *str, int *lines);
double set_tic (double l10, int guide);
void setup_tics (int axis, struct ticdef *def, char *format, int max);

typedef void (*tic_callback) (int axis, double place, char *text, struct lp_style_type grid);
void gen_tics (int axis, struct ticdef *def, int grid, int minitic, double minifreq, tic_callback callback);
void write_multiline (unsigned int x, unsigned int y, char *text_will_be_mangled, enum JUSTIFY hor, int vert, int angle, char *font);



void map3d_xy (double x, double y, double z, unsigned int *xt, unsigned int *yt);
int map3d_z (double x, double y, double z);
void do_3dplot (struct surface_points *plots, int pcount);




int help (char *keyword, char *path, TBOOLEAN *subtopics);
void FreeHelp (void);
void StartOutput (void);
void OutLine (char *line);
void EndOutput (void);




void clip_move (unsigned int x, unsigned int y);
void clip_vector (unsigned int x, unsigned int y);

void set_hidden3doptions (void);
void show_hidden3doptions (void);

void save_hidden3doptions (FILE *fp);

void init_hidden_line_removal (void);
void reset_hidden_line_removal (void);
void term_hidden_line_removal (void);
void plot3d_hidden (struct surface_points *plots, int pcount);
void draw_line_hidden (unsigned int, unsigned int, unsigned int, unsigned int);
# 145 "protos.h"
void reset_stack (void);
void check_stack (void);
struct value *pop (struct value *x);
void push (struct value *x);




void gen_interp (struct curve_points *plot);
void sort_points (struct curve_points *plot);
void cp_implode (struct curve_points *cp);




struct curve_points * cp_alloc (int num);
void cp_extend (struct curve_points *cp, int num);
void cp_free (struct curve_points *cp);
struct iso_curve * iso_alloc (int num);
void iso_extend (struct iso_curve *ip, int num);
void iso_free (struct iso_curve *ip);
struct surface_points * sp_alloc (int num_samp_1, int num_iso_1, int num_samp_2, int num_iso_2);
void sp_replace (struct surface_points *sp, int num_samp_1, int num_iso_1, int num_samp_2, int num_iso_2);
void sp_free (struct surface_points *sp);
void save_functions (FILE *fp);
void save_variables (FILE *fp);
void save_all (FILE *fp);
void save_set (FILE *fp);
void save_set_all (FILE *fp);
void load_file (FILE *fp, char *name, TBOOLEAN subst_args);
FILE *lf_top (void);
void load_file_error (void);
int instring (char *str, int c);
void show_functions (void);
void show_at (void);
void disp_at (struct at_type *curr_at, int level);
int find_maxl_keys (struct curve_points *plots, int count, int *kcnt);
int find_maxl_keys3d (struct surface_points *plots, int count, int *kcnt);
TBOOLEAN valid_format (const char *format);





void evaluate_at (struct at_type *at_ptr, struct value *val_ptr);
struct value * const_express (struct value *valptr);
struct at_type * temp_at (void);
struct at_type * perm_at (void);




void interrupt_setup (void);




void plotrequest (void);




void plot3drequest (void);
# 216 "protos.h"
extern char *readline();
extern void add_history();
# 227 "protos.h"
int scanner (char expression[]);




char *safe_strncpy (char *, char *, size_t);







void term_set_output (char *);
void term_init (void);
void term_start_plot (void);
void term_end_plot (void);
void term_start_multiplot (void);
void term_end_multiplot (void);

void term_reset (void);
void term_apply_lp_properties (struct lp_style_type *lp);
void term_check_multiplot_okay (TBOOLEAN);

__inline__ int term_count (void);
void list_terms (void);
struct TERMENTRY *set_term (int);
struct TERMENTRY *change_term (char *name, int length);
void init_terminal (void);
void test_term (void);
void UP_redirect (int called);
# 267 "protos.h"
int null_text_angle (int ang);
int null_justify_text (enum JUSTIFY just);
int null_scale (double x, double y);
int do_scale (double x, double y);
void options_null (void);
void UNKNOWN_null (void);
void MOVE_null (unsigned int, unsigned int);
void LINETYPE_null (int);
void PUTTEXT_null (unsigned int, unsigned int, char *);




char * gstrptime (char *, char *, struct tm *);
int gstrftime (char *, int, char *, double);
double gtimegm (struct tm *);
int ggmtime (struct tm *, double);




int chr_in_str (int t_num, int c);
int equals (int t_num, char *str);
int almost_equals (int t_num, char *str);
int isstring (int t_num);
int isanumber (int t_num);
int isletter (int t_num);
int is_definition (int t_num);
void copy_str (char str[], int t_num, int max);
int token_len (int t_num);
void quote_str (char str[], int t_num, int max);
void capture (char str[], int start, int end, int max);
void m_capture (char **str, int start, int end);
void m_quote_capture (char **str, int start, int end);
void convert (struct value *val_ptr, int t_num);
void disp_value (FILE *fp, struct value *val);
double real (struct value *val);
double imag (struct value *val);
double magnitude (struct value *val);
double angle (struct value *val);
struct value * Gcomplex (struct value *a, double realpart, double imagpart);
struct value * Ginteger (struct value *a, int i);
void os_error (char str[], int t_num);
void int_error (char str[], int t_num);
void int_warn (char str[], int t_num);
void lower_case (char *s);
void squash_spaces (char *s);




void draw_clip_line (unsigned int, unsigned int, unsigned int, unsigned int);




int clip_line (int *, int *, int *, int *);
void edge3d_intersect (struct coordinate *points, int i, double *ex, double *ey, double *ez);
TBOOLEAN two_edge3d_intersect (struct coordinate *points, int i, double *lx, double *ly, double *lz);
void mat_unit (double mat[4][4]);
void mat_trans (double tx, double ty, double tz, double mat[4][4]);
void mat_scale (double sx, double sy, double sz, double mat[4][4]);
void mat_rot_x (double teta, double mat[4][4]);
void mat_rot_y (double teta, double mat[4][4]);
void mat_rot_z (double teta, double mat[4][4]);
void mat_mult (double mat_res[4][4], double mat1[4][4], double mat2[4][4]);
int clip_point (unsigned int x, unsigned int y);
void clip_put_text (unsigned int x, unsigned int y, char *str);
void clip_put_text_just (unsigned int x, unsigned int y, char *str, enum JUSTIFY just);

# 1 "alloc.h" 1
# 39 "alloc.h"
char *gp_alloc (unsigned long size, char *message);
void *gp_realloc (void *p, unsigned long size, char *message);
# 338 "protos.h" 2
# 783 "plot.h" 2
# 78 "term.c" 2
# 1 "bitmap.h" 1
# 37 "bitmap.h"
typedef unsigned int char_row;
typedef char_row * char_box;
# 47 "bitmap.h"
extern char_row fnt5x9[96][9];






extern char_row fnt9x17[96][17];






extern char_row fnt13x25[96][25];


typedef unsigned char pixels;
typedef pixels *bitmap[];

extern bitmap *b_p;
extern unsigned int b_currx, b_curry;
extern unsigned int b_xsize, b_ysize;
extern unsigned int b_planes;
extern unsigned int b_psize;
extern unsigned int b_rastermode;
extern unsigned int b_linemask;
extern unsigned int b_value;
extern unsigned int b_hchar;
extern unsigned int b_hbits;
extern unsigned int b_vchar;
extern unsigned int b_vbits;
extern unsigned int b_angle;
extern char_box b_font[96];
extern unsigned int b_pattern[];
extern int b_maskcount;
extern unsigned int b_lastx, b_lasty;







struct rgb
{
    unsigned char r, g, b;
};

extern struct rgb web_color_rgbs[];




void b_makebitmap (unsigned int x, unsigned int y, unsigned int planes);
void b_freebitmap (void);
void b_setpixel (unsigned int x, unsigned int y, unsigned int value);

void b_line (unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2);
void b_setmaskpixel (unsigned int x, unsigned int y, unsigned int value);

void b_charsize (unsigned int size);
void b_setvalue (unsigned int value);

void b_setlinetype (int linetype);
void b_move (unsigned int x, unsigned int y);
void b_vector (unsigned int x, unsigned int y);
void b_put_text (unsigned int x, unsigned int y, char *str);
int b_text_angle (int ang);
# 79 "term.c" 2
# 1 "setshow.h" 1
# 41 "setshow.h"
# 1 "/usr/include/sys/utsname.h" 1 3
# 26 "/usr/include/sys/utsname.h" 3
# 1 "/usr/include/features.h" 1 3
# 27 "/usr/include/sys/utsname.h" 2 3



# 1 "/usr/include/bits/utsname.h" 1 3
# 31 "/usr/include/sys/utsname.h" 2 3






struct utsname
  {

    char sysname[65];


    char nodename[65];


    char release[65];

    char version[65];


    char machine[65];






    char __domainname[65];


  };







extern int uname (struct utsname *__name) ;
# 42 "setshow.h" 2
# 53 "setshow.h"
typedef struct {
        char text[1024 +1];
        double xoffset, yoffset;
        char font[1024 +1];
} label_struct;


extern TBOOLEAN multiplot;

extern TBOOLEAN autoscale_r;
extern TBOOLEAN autoscale_t;
extern TBOOLEAN autoscale_u;
extern TBOOLEAN autoscale_v;
extern TBOOLEAN autoscale_x;
extern TBOOLEAN autoscale_y;
extern TBOOLEAN autoscale_z;
extern TBOOLEAN autoscale_x2;
extern TBOOLEAN autoscale_y2;
extern TBOOLEAN autoscale_lt;
extern TBOOLEAN autoscale_lu;
extern TBOOLEAN autoscale_lv;
extern TBOOLEAN autoscale_lx;
extern TBOOLEAN autoscale_ly;
extern TBOOLEAN autoscale_lz;
extern double boxwidth;
extern TBOOLEAN clip_points;
extern TBOOLEAN clip_lines1;
extern TBOOLEAN clip_lines2;
extern struct lp_style_type border_lp;
extern int draw_border;
# 91 "setshow.h"
extern TBOOLEAN draw_surface;
extern char dummy_var[5][50 +1];
extern char default_font[];
extern char xformat[];
extern char yformat[];
extern char zformat[];
extern char x2format[];
extern char y2format[];

extern int format_is_numeric[];

extern char key_title[];
extern enum PLOT_STYLE data_style, func_style;
extern double bar_size;
extern struct lp_style_type work_grid, grid_lp, mgrid_lp;
extern double polar_grid_angle;
extern int key;
extern struct position key_user_pos;
extern int key_vpos, key_hpos, key_just;
extern double key_swidth, key_vert_factor;
extern double key_width_fix;
extern TBOOLEAN key_reverse;
extern struct lp_style_type key_box;
extern TBOOLEAN is_log_x, is_log_y, is_log_z;
extern double base_log_x, base_log_y, base_log_z;

extern double log_base_log_x, log_base_log_y, log_base_log_z;

extern TBOOLEAN is_log_x2, is_log_y2;
extern double base_log_x2, base_log_y2;

extern double log_base_log_x2, log_base_log_y2;

extern char *outstr;
extern TBOOLEAN parametric;
extern double pointsize;
extern TBOOLEAN polar;
extern TBOOLEAN hidden3d;
extern int angles_format;
extern double ang2rad;
extern int mapping3d;
extern int samples;
extern int samples_1;
extern int samples_2;
extern int iso_samples_1;
extern int iso_samples_2;
extern float xsize;
extern float xoffset;
extern float yoffset;
extern float ysize;
extern float zsize;
extern float aspect_ratio;
extern float surface_rot_z;
extern float surface_rot_x;
extern float surface_scale;
extern float surface_zscale;
extern char term_options[];

extern label_struct title, timelabel;
extern label_struct xlabel, ylabel, zlabel;
extern label_struct x2label, y2label;

extern int timelabel_rotate;
extern int timelabel_bottom;
extern char timefmt[];
extern int datatype[];
extern int range_flags[];
extern double rmin, rmax;
extern double tmin, tmax, umin, umax, vmin, vmax;
extern double xmin, xmax, ymin, ymax, zmin, zmax;
extern double x2min, x2max, y2min, y2max;
extern double loff, roff, toff, boff;
extern int draw_contour;
extern TBOOLEAN label_contours;
extern char contour_format[];
extern int contour_pts;
extern int contour_kind;
extern int contour_order;
extern int contour_levels;
extern double zero;
extern int levels_kind;
extern double levels_list[30];

extern int dgrid3d_row_fineness;
extern int dgrid3d_col_fineness;
extern int dgrid3d_norm_value;
extern TBOOLEAN dgrid3d;






extern int encoding;
extern char *encoding_names[];


extern struct lp_style_type xzeroaxis;
extern struct lp_style_type yzeroaxis;
extern struct lp_style_type x2zeroaxis;
extern struct lp_style_type y2zeroaxis;

extern int xtics;
extern int ytics;
extern int ztics;
extern int mxtics;
extern int mytics;
extern int mztics;
extern int x2tics;
extern int y2tics;
extern int mx2tics;
extern int my2tics;
extern double mxtfreq;
extern double mytfreq;
extern double mztfreq;
extern double mx2tfreq;
extern double my2tfreq;
extern TBOOLEAN rotate_xtics;
extern TBOOLEAN rotate_ytics;
extern TBOOLEAN rotate_ztics;
extern TBOOLEAN rotate_x2tics;
extern TBOOLEAN rotate_y2tics;

extern float ticslevel;
extern double ticscale;
extern double miniticscale;

extern struct ticdef xticdef;
extern struct ticdef yticdef;
extern struct ticdef zticdef;
extern struct ticdef x2ticdef;
extern struct ticdef y2ticdef;

extern TBOOLEAN tic_in;

extern struct text_label *first_label;
extern struct arrow_def *first_arrow;
extern struct linestyle_def *first_linestyle;

extern int lmargin, bmargin,rmargin,tmargin;

extern char cur_locale[50 +1];

extern char full_month_names[12][32];
extern char abbrev_month_names[12][8];

extern char full_day_names[7][32];
extern char abbrev_day_names[7][8];


void set_command (void);
void reset_command (void);
void show_command (void);

enum PLOT_STYLE get_style (void);
TBOOLEAN load_range (int axis, double *a, double *b, int autosc);
void show_version (FILE *fp);
void show_version_long (void);
char * conv_text (char *s, char *t);
void lp_use_properties (struct lp_style_type *lp, int tag, int pointflag );


extern char *missing_val;
# 80 "term.c" 2
# 1 "term/driver.h" 1
# 47 "term/driver.h"
void do_point (unsigned int x, unsigned int y, int number);
void line_and_point (unsigned int x, unsigned int y, int number);
void do_arrow (unsigned int sx, unsigned int sy, unsigned int ex, unsigned int ey, int head);
int null_text_angle (int ang);
int null_justify_text (enum JUSTIFY just);
int null_scale (double x, double y);
int do_scale (double x, double y);
void options_null (void);
void UNKNOWN_null (void);
int set_font_null (char *s);
void null_set_pointsize (double size);

extern FILE *gpoutfile;
extern struct TERMENTRY *term;
extern float xsize, ysize;
# 81 "term.c" 2
# 94 "term.c"
static TBOOLEAN term_initialised;


static TBOOLEAN term_graphics = 0;


static TBOOLEAN term_suspended = 0;


static TBOOLEAN opened_binary = 0;


static TBOOLEAN term_force_init = 0;

extern FILE *gpoutfile;
extern char *outstr;
extern float xsize, ysize;


static double term_pointsize;

static void term_suspend (void);
static void term_close_output (void);
static void null_linewidth (double);

void do_point (unsigned int x, unsigned int y, int number);
void do_pointsize (double size);
void line_and_point (unsigned int x, unsigned int y, int number);
void do_arrow (unsigned int sx, unsigned int sy, unsigned int ex, unsigned int ey, int head);
# 148 "term.c"
static int unixplot = 0;
# 166 "term.c"
static TBOOLEAN pipe_open = 0;


static void term_close_output()
{
                                            ;

    opened_binary = 0;

    if (!outstr)
        return;


    if (pipe_open) {
        (void) pclose(gpoutfile);
        pipe_open = 0;
    } else






        (void) fclose(gpoutfile);

    gpoutfile = stdout;
    free(outstr);
    outstr = ((void *)0);
}
# 205 "term.c"
void term_set_output(dest)
char *dest;
{
    FILE *f;

                                          ;
    ((void) ((dest == ((void *)0) || dest != outstr) ? 0 : (__assert_fail ("dest == ((void *)0) || dest != outstr", "term.c", 211, __PRETTY_FUNCTION__), 0)));

    if (multiplot) {
        fputs("In multiplotmode you can't change the output\n", stderr);
        return;
    }
    if (term && term_initialised) {
        (*term->reset) ();
        term_initialised = 0;
    }
    if (dest == ((void *)0)) {
        UP_redirect(4);
        term_close_output();
    } else {


        if (*dest == '|') {
            if ((f = popen(dest + 1, ("w"))) == (FILE *) ((void *)0))
                    os_error("cannot create pipe; output not changed", c_token);
                else
                    pipe_open = 1;
        } else
# 249 "term.c"
        {
            if (term && (term->flags & 4)) {
                f = fopen(dest, "wb");
            } else
                f = fopen(dest, "w");

            if (f == (FILE *) ((void *)0))
                os_error("cannot open file; output not changed", c_token);
        }
        term_close_output();
        gpoutfile = f;
        outstr = dest;
        opened_binary = (term && (term->flags & 4));
        UP_redirect(1);
    }
}

void term_init()
{
                                      ;

    if (!term)
        int_error("No terminal defined", (-1));







    if (outstr &&
        (((term->flags & 4) && !opened_binary) ||
         ((!(term->flags & 4) && opened_binary)))) {





        char *temp = gp_alloc(strlen(outstr) + 1, "temp file string");
        if (temp) {
                                                                            ;

            (__extension__ (__builtin_constant_p (outstr) ? (((size_t)(const void *)((outstr) + 1) - (size_t)(const void *)(outstr) == 1) && strlen (outstr) + 1 <= 8 ? __strcpy_small (temp, __extension__ (((__const unsigned char *) (__const char *) (outstr))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) (outstr))[0]), __extension__ (((__const unsigned char *) (__const char *) (outstr))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) (outstr))[4]), __extension__ (((((__const unsigned char *) (__const char *) (outstr))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) (outstr))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) (outstr))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) (outstr))[0]), __extension__ (((((__const unsigned char *) (__const char *) (outstr))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) (outstr))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) (outstr))[4 + 1]) << 8 | ((__const !
unsigned char *) (__const char *) (outstr))[4]), strlen (outstr) + 1) : (char *) memcpy (temp, outstr, strlen (outstr) + 1)) : strcpy (temp, outstr)));
            term_set_output(temp);
        } else
            fputs("Cannot reopen output file in binary", stderr);

    }
# 307 "term.c"
    if (!term_initialised || term_force_init) {
                                                     ;
        (*term->init) ();
        term_initialised = 1;
    }
}


void term_start_plot()
{
                                            ;

    if (!term_initialised)
        term_init();

    if (!term_graphics) {
                                                         ;
        (*term->graphics) ();
        term_graphics = 1;
    } else if (multiplot && term_suspended) {
        if (term->resume) {
                                                           ;
            (*term->resume) ();
        }
        term_suspended = 0;
    }
}

void term_end_plot()
{
                                          ;

    if (!term_initialised)
        return;

    if (!multiplot) {
                                                     ;
        (*term->text) ();
        term_graphics = 0;
    }






        (void) fflush(gpoutfile);
}

void term_start_multiplot()
{
                                                 ;
    if (multiplot)
        term_end_multiplot();

    multiplot = 1;
    term_start_plot();
}

void term_end_multiplot()
{
                                               ;
    if (!multiplot)
        return;

    if (term_suspended) {
        if (term->resume)
            (*term->resume) ();
        term_suspended = 0;
    }
    multiplot = 0;

    term_end_plot();
}



static void term_suspend()
{
                                         ;
    if (term_initialised && !term_suspended && term->suspend) {
                                                        ;
        (*term->suspend) ();
        term_suspended = 1;
    }
}

void term_reset()
{
                                       ;

    if (!term_initialised)
        return;

    if (term_suspended) {
        if (term->resume) {
                                                           ;
            (*term->resume) ();
        }
        term_suspended = 0;
    }
    if (term_graphics) {
        (*term->text) ();
        term_graphics = 0;
    }
    if (term_initialised) {
        (*term->reset) ();
        term_initialised = 0;
    }
}

void term_apply_lp_properties(lp)
struct lp_style_type *lp;
{
# 429 "term.c"
    if (lp->pointflag) {





        (*term->pointsize) (lp->p_size);
    }




    (*term->linewidth) (lp->l_width);
    (*term->linetype) (lp->l_type);
}



void term_check_multiplot_okay(f_interactive)
TBOOLEAN f_interactive;
{
                                                                 ;

    if (!term_initialised)
        return;
# 462 "term.c"
    if (!f_interactive || (term->flags & 1) ||
        ((gpoutfile != stdout) && !(term->flags & 2))
        ) {

        term_suspend();
        return;
    }


    term_end_multiplot();






    if (term->flags & 2)
        int_error("This terminal does not support multiplot", (-1));
    else
        int_error("Must set output to a file or put all multiplot commands on one input line", (-1));
}

void do_point(x, y, number)
unsigned int x, y;
int number;
{
    register int htic, vtic;
    register struct TERMENTRY *t = term;

    if (number < 0) {
        (*t->move) (x, y);
        (*t->vector) (x, y);
        return;
    }
    number %= 6;

    htic = (term_pointsize * t->h_tic / 2);
    vtic = (term_pointsize * t->v_tic / 2);

    switch (number) {
    case 0:
        (*t->move) (x - htic, y);
        (*t->vector) (x, y - vtic);
        (*t->vector) (x + htic, y);
        (*t->vector) (x, y + vtic);
        (*t->vector) (x - htic, y);
        (*t->move) (x, y);
        (*t->vector) (x, y);
        break;
    case 1:
        (*t->move) (x - htic, y);
        (*t->vector) (x - htic, y);
        (*t->vector) (x + htic, y);
        (*t->move) (x, y - vtic);
        (*t->vector) (x, y - vtic);
        (*t->vector) (x, y + vtic);
        break;
    case 2:
        (*t->move) (x - htic, y - vtic);
        (*t->vector) (x - htic, y - vtic);
        (*t->vector) (x + htic, y - vtic);
        (*t->vector) (x + htic, y + vtic);
        (*t->vector) (x - htic, y + vtic);
        (*t->vector) (x - htic, y - vtic);
        (*t->move) (x, y);
        (*t->vector) (x, y);
        break;
    case 3:
        (*t->move) (x - htic, y - vtic);
        (*t->vector) (x - htic, y - vtic);
        (*t->vector) (x + htic, y + vtic);
        (*t->move) (x - htic, y + vtic);
        (*t->vector) (x - htic, y + vtic);
        (*t->vector) (x + htic, y - vtic);
        break;
    case 4:
        (*t->move) (x, y + (4 * vtic / 3));
        (*t->vector) (x - (4 * htic / 3), y - (2 * vtic / 3));
        (*t->vector) (x + (4 * htic / 3), y - (2 * vtic / 3));
        (*t->vector) (x, y + (4 * vtic / 3));
        (*t->move) (x, y);
        (*t->vector) (x, y);
        break;
    case 5:
        (*t->move) (x - htic, y);
        (*t->vector) (x - htic, y);
        (*t->vector) (x + htic, y);
        (*t->move) (x, y - vtic);
        (*t->vector) (x, y - vtic);
        (*t->vector) (x, y + vtic);
        (*t->move) (x - htic, y - vtic);
        (*t->vector) (x - htic, y - vtic);
        (*t->vector) (x + htic, y + vtic);
        (*t->move) (x - htic, y + vtic);
        (*t->vector) (x - htic, y + vtic);
        (*t->vector) (x + htic, y - vtic);
        break;
    }
}

void do_pointsize(size)
double size;
{
    term_pointsize = (size >= 0 ? size : 1);
}





void line_and_point(x, y, number)
unsigned int x, y;
int number;
{



    (*term->linetype) (0);
    do_point(x, y, number);
}
# 604 "term.c"
void do_arrow(sx, sy, ex, ey, head)
unsigned int sx, sy;
unsigned int ex, ey;
TBOOLEAN head;
{
    register struct TERMENTRY *t = term;
    float len_tic = ((double) (t->h_tic + t->v_tic)) / 2.0;


    double dx = (double) sx - (double) ex;
    double dy = (double) sy - (double) ey;
    double len_arrow = sqrt(dx * dx + dy * dy);


    (*t->move) (sx, sy);
    (*t->vector) (ex, ey);





    if (head && fabs(len_arrow) >= 2.2204460492503131e-16) {

        double coeff_shortest = len_tic * (0.3) / len_arrow;
        double coeff_longest = len_tic * (2.0) / len_arrow;
        double head_coeff = ( (coeff_shortest) > (( ((0.3)) < (coeff_longest) ? ((0.3)) : (coeff_longest) )) ? (coeff_shortest) : (( ((0.3)) < (coeff_longest) ? ((0.3)) : (coeff_longest) )) );



        int x, y;

        x = (int) (ex + ((0.96593) * dx - (0.25882) * dy) * head_coeff);
        y = (int) (ey + ((0.25882) * dx + (0.96593) * dy) * head_coeff);
        (*t->move) (x, y);
        (*t->vector) (ex, ey);

        x = (int) (ex + ((0.96593) * dx + (0.25882) * dy) * head_coeff);
        y = (int) (ey + (-(0.25882) * dx + (0.96593) * dy) * head_coeff);
        (*t->vector) (x, y);
    }
}
# 698 "term.c"
# 1 "term.h" 1
# 220 "term.h"
# 1 "term/aed.trm" 1
# 55 "term/aed.trm"
# 1 "term/driver.h" 1
# 56 "term/aed.trm" 2







static void AED_init (void);
static void AED_graphics (void);
static void AED_text (void);
static void AED_linetype (int linetype);
static void AED_move (unsigned int x, unsigned int y);
static void AED_vector (unsigned int x, unsigned int y);
static void AED_put_text (unsigned int x, unsigned int y, char str[]);
static void AED_reset (void);
# 92 "term/aed.trm"
static void AED_init()
{
    fputs("\033SEN3DDDN.SEC.7.SCT.0.1.80.80.90.SBC.0.AAV2.MOV.0.9.CHR.0.FFD", gpoutfile);
# 104 "term/aed.trm"
}


static void AED_graphics()
{
    fputs("\033FFD\033", gpoutfile);
}


static void AED_text()
{
    fputs("\033MOV.0.9.SEC.7.XXX", gpoutfile);
}



static void AED_linetype(linetype)
int linetype;
{
    static int color[2 + 9] = { 7, 1, 6, 2, 3, 5, 1, 6, 2, 3, 5 };
    static int type[2 + 9] = { 85, 85, 255, 255, 255, 255, 255, 85, 85, 85, 85 };

    if (linetype >= 10)
        linetype %= 10;

    fprintf(gpoutfile, "\033SLS%d.255.\033SEC%d.",


            type[linetype + 2],
            color[linetype + 2]);
}



static void AED_move(x, y)
unsigned int x, y;
{
    fprintf(gpoutfile, "\033MOV%d.%d.", x, y);
}


static void AED_vector(x, y)
unsigned int x, y;
{
    fprintf(gpoutfile, "\033DVA%d.%d.", x, y);
}


static void AED_put_text(x, y, str)
unsigned int x, y;
char str[];
{
    AED_move(x, y - 13 / 2 + 2);
    fprintf(gpoutfile, "\033XXX%s\033", str);
}





static void AED_reset()
{
    fputs("\033SCT0.1.0.0.0.SBC.0.FFD", gpoutfile);
}
# 221 "term.h" 2
# 231 "term.h"
# 1 "term/gpic.trm" 1
# 56 "term/gpic.trm"
# 1 "term/driver.h" 1
# 57 "term/gpic.trm" 2






static void GPIC_options (void);
static void GPIC_init (void);
static void GPIC_graphics (void);
static void GPIC_text (void);
static void GPIC_linetype (int linetype);
static void GPIC_move (unsigned int x, unsigned int y);
static void GPIC_vector (unsigned int ux, unsigned int uy);
static void GPIC_arrow (unsigned int sx, unsigned int sy, unsigned int ex, unsigned int ey, TBOOLEAN head);


static void GPIC_put_text (unsigned int x, unsigned int y, char str[]);

static int GPIC_justify_text (enum JUSTIFY mode);
static int GPIC_text_angle (int ang);
static void GPIC_reset (void);
# 98 "term/gpic.trm"
void GPIC_close_line (void);
static float GPIC_x, GPIC_y;
static unsigned int GPIC_ltype;
enum JUSTIFY GPIC_justify = LEFT;



static char *GPIC_lines[] =
{
    "thickness 1.0",
    "",
    "",
    "dotted",
    "dashed 0.05",
    "dashed 0.075",
};





static int GPIC_linecount = 0;


static void GPIC_options()
{
    float x, y;
    struct value a;

    GPIC_x = 0;
    GPIC_y = 0;

    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        x = real(const_express(&a));
        if (!(c_token >= num_tokens || equals(c_token,";"))) {
            y = real(const_express(&a));
            GPIC_x = x;
            GPIC_y = y;
        }
    }
    sprintf(term_options, "Origin is at (%f,%f)", GPIC_x, GPIC_y);

}

static void GPIC_init()
{
    GPIC_linetype(-1);
    fputs(".\\\"GNUPLOT: GROFF picture using the gpic preprocessor\n", gpoutfile);
}



static void GPIC_graphics()
{
    register struct TERMENTRY *t = term;

    fprintf(gpoutfile, ".PS %f %f\n", ((float)t->xmax)/((float)(300)),
            ((float)t->ymax)/((float)(300)));
    fprintf(gpoutfile, "x=%f; y=%f\n", GPIC_x, GPIC_y);
}


static void GPIC_text()
{
    GPIC_close_line();
    fputs(".PE\n", gpoutfile);
}

static void GPIC_linetype(linetype)
int linetype;
{
    if (linetype >= (sizeof(GPIC_lines)/sizeof(char *)) - 2)
        linetype %= ((sizeof(GPIC_lines)/sizeof(char *)) - 2);
    GPIC_ltype = linetype;
}

void GPIC_close_line()
{
    if (GPIC_linecount > 0) {
        fputs("; reset linewid\n", gpoutfile);
        GPIC_linecount = 0;
    }
}

static void GPIC_move(x, y)
unsigned int x, y;
{
    GPIC_close_line();
    fprintf(gpoutfile, "move to (x+%f,y+%f)\n", ((float)x)/((float)(300)), ((float)y)/((float)(300)));
    GPIC_linecount = 1;
}


static void GPIC_vector(ux, uy)
unsigned int ux, uy;
{
    if (GPIC_linecount == 1) {
        fprintf(gpoutfile, "line %s to (x+%f,y+%f)",
                GPIC_lines[GPIC_ltype + 2],
                ((float)ux)/((float)(300)), ((float)uy)/((float)(300)));
    } else {
        fprintf(gpoutfile, " \\\n   then to (x+%f,y+%f)",


                ((float)ux)/((float)(300)), ((float)uy)/((float)(300)));
    }
    GPIC_linecount++;
}


static void GPIC_arrow(sx, sy, ex, ey, head)
unsigned int sx, sy, ex, ey;
TBOOLEAN head;
{
    GPIC_close_line();
    if (head) {
        fprintf(gpoutfile, "arrowhead=7; arrow from x+%f,y+%f to x+%f,y+%f\n",
                ((float)sx)/((float)(300)), ((float)sy)/((float)(300)), ((float)ex)/((float)(300)), ((float)ey)/((float)(300)));
    } else {
        fprintf(gpoutfile, "line from x+%f,y+%f to x+%f,y+%f\n",
                ((float)sx)/((float)(300)), ((float)sy)/((float)(300)), ((float)ex)/((float)(300)), ((float)ey)/((float)(300)));
    }
}


static void GPIC_put_text(x, y, str)
unsigned int x, y;
char str[];
{
    GPIC_close_line();
    fprintf(gpoutfile, "\"%s\" ", str);
    switch (GPIC_justify) {
    case LEFT:{
            fputs("ljust ", gpoutfile);
            break;
        }
    case CENTRE:{
            fputs(" ", gpoutfile);
            break;
        }
    case RIGHT:{
            fputs("rjust ", gpoutfile);
            break;
        }
    }
    fprintf(gpoutfile, "at x+%f,y+%f\n", ((float)x)/((float)(300)), ((float)y)/((float)(300)));
}



static int GPIC_justify_text(mode)
enum JUSTIFY mode;
{
    GPIC_justify = mode;
    return (1);
}

static int GPIC_text_angle(ang)
int ang;
{
    GPIC_close_line();
    return (0);
}

static void GPIC_reset()
{
    fflush(gpoutfile);
}
# 232 "term.h" 2


# 1 "term/regis.trm" 1
# 51 "term/regis.trm"
# 1 "term/driver.h" 1
# 52 "term/regis.trm" 2







static void REGISinit (void);
static void REGISgraphics (void);
static void REGISinit (void);
static void REGISgraphics (void);
static void REGIStext (void);
static void REGISlinetype (int linetype);
static void REGISmove (unsigned int x, unsigned int y);
static void REGISvector (unsigned int x, unsigned int y);
static void REGISput_text (unsigned int x, unsigned int y, char *str);
static int REGIStext_angle (int ang);
static void REGISreset (void);
static void REGISoptions (void);
# 94 "term/regis.trm"
static int REGIS16color = 0;

static int REGISang = 0;

static void REGISinit()
{
    fputs("\033[r\033[24;1H", gpoutfile);




}



static void REGISgraphics()
{
    fputs("\033[2J\033P1pS(C0)S(E)T(A0)\n", gpoutfile);







    (void) REGIStext_angle(0);
}


static void REGIStext()
{
    fputs("\033\\\033[24;1H", gpoutfile);




}


static void REGISlinetype(linetype)
int linetype;
{


    static int in_16_map[15 + 2] = { 7, 7, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
    static int lt_16_map[15 + 2] = { 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
    static int in_map[9 + 2] = { 2, 2, 3, 2, 1, 3, 2, 1, 3, 2, 1 };
    static int lt_map[9 + 2] = { 1, 4, 1, 1, 1, 4, 4, 4, 6, 6, 6 };

    if (!REGIS16color) {
        if (linetype >= 9)
            linetype %= 9;
        fprintf(gpoutfile, "W(I%d)\n", in_map[linetype + 2]);
        fprintf(gpoutfile, "W(P%d)\n", lt_map[linetype + 2]);
    } else {
        if (linetype >= 15)
            linetype %= 15;
        fprintf(gpoutfile, "W(I%d)\n", in_16_map[linetype + 2]);
        fprintf(gpoutfile, "W(P%d)\n", lt_16_map[linetype + 2]);
    }
}
# 168 "term/regis.trm"
static void REGISmove(x, y)
unsigned int x, y;
{
    fprintf(gpoutfile, "P[%d,%d]\n", x, (440 - 1) - y);
}


static void REGISvector(x, y)
unsigned int x, y;
{
    fprintf(gpoutfile, "v[]v[%d,%d]\n", x, (440 - 1) - y);

}



static void REGISput_text(x, y, str)
unsigned int x, y;
char *str;
{
    if (REGISang == 1)
        REGISmove(x - 20 / 2 - 1, y);
    else
        REGISmove(x, y + 20 / 2 - 1);
    (void) _IO_putc ('T', gpoutfile);
    (void) _IO_putc ('\'', gpoutfile);
    while (*str) {
        (void) _IO_putc (*str, gpoutfile);
        if (*str == '\'')
            (void) _IO_putc ('\'', gpoutfile);
        str++;
    }
    (void) _IO_putc ('\'', gpoutfile);
    (void) _IO_putc ('\n', gpoutfile);
}


static int REGIStext_angle(ang)
int ang;
{
    REGISang = ang;
    if (ang == 1)
        fputs("T(D90,S1)\n", gpoutfile);
    else
        fputs("T(D0,S1)\n", gpoutfile);
    return 1;
}


static void REGISreset()
{
    fputs("\033[2J\033[24;1H", gpoutfile);
}

static void REGISoptions()
{
    int i = 0;
    struct value a;

    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        i = (int) real(const_express(&a));
    }
    REGIS16color = (i == 16);
    sprintf(term_options, "%s", REGIS16color ? "16" : "4");
}
# 235 "term.h" 2


# 1 "term/t410x.trm" 1
# 67 "term/t410x.trm"
# 1 "term/driver.h" 1
# 68 "term/t410x.trm" 2






static void T410X_init (void);
static void T410X_reset (void);
static void T410X_graphics (void);
static void T410X_text (void);
static void T410X_move (unsigned int x, unsigned int y);
static void T410X_vector (unsigned int x, unsigned int y);
static void T410X_point (unsigned int x, unsigned int y, int number);
static void T410X_linetype (int linetype);
static void T410X_put_text (unsigned int x, unsigned int y, char str[]);
static int T410X_text_angle (int ang);
# 95 "term/t410x.trm"
void T410X_encode_x_y (unsigned int x, unsigned int y);
void T410X_encode_int (int number);


static int T410X_angle = 0;

static void T410X_init()
{
    fputs("\033%%!0\033MN0\033MCB7C;\033MQ1\033MT1", gpoutfile);
    fputs("\033MG1\033RK!\033SK!\033LZ\033%%!1", gpoutfile);
# 117 "term/t410x.trm"
    (void) fflush(gpoutfile);
}


static void T410X_reset()
{
    fputs("\033%%!0\033LZ\033%%!1", gpoutfile);





    (void) fflush(gpoutfile);
}


static void T410X_graphics()
{
    fputs("\033%%!0\033\014\033LV0", gpoutfile);





    (void) fflush(gpoutfile);
}

static void T410X_text()
{
    fputs("\033LV1\033%%!1", gpoutfile);




    (void) fflush(gpoutfile);
}


static void T410X_move(x, y)
unsigned int x, y;
{
    fputs("\033LF", gpoutfile);

    (void) T410X_encode_x_y(x, y);
    (void) fflush(gpoutfile);
}


static void T410X_vector(x, y)
unsigned int x, y;
{
    fputs("\033LG", gpoutfile);
    (void) T410X_encode_x_y(x, y);
    (void) fflush(gpoutfile);
}


static void T410X_point(x, y, number)
unsigned int x, y;
int number;
{
    fputs("\033MM", gpoutfile);
    (void) T410X_encode_int(( (number) > (0) ? (number) : (0) ) % 11);
    fputs("\033LH", gpoutfile);
    (void) T410X_encode_x_y(x, y);
    (void) fflush(gpoutfile);
}


static void T410X_linetype(linetype)
int linetype;
{
    switch (linetype) {
    case -1:
        fputs("\033ML5", gpoutfile);
        break;
    case -2:
        fputs("\033ML?", gpoutfile);
        break;
    default:
        fputs("\033ML", gpoutfile);
        (void) T410X_encode_int(linetype % 14 + 2);
        break;
    }
    fputs("\033MV", gpoutfile);
    (void) T410X_encode_int(( (linetype) > (0) ? (linetype) : (0) ) % 8);
    (void) fflush(gpoutfile);
}


static void T410X_put_text(x, y, str)
unsigned int x, y;
char str[];
{

    if (T410X_angle == 0) {
        (void) T410X_move(x, y - 71 / 2 + 6);
        fputs("\033MR00", gpoutfile);
    } else {
        (void) T410X_move(x + 51 / 2 - 6, y);
        fputs("\033MRE:0", gpoutfile);
    }
    (void) fputs("\033LT", gpoutfile);
    (void) T410X_encode_int(strlen(str));
    (void) fputs(str, gpoutfile);
    (void) fflush(gpoutfile);
}

static int T410X_text_angle(ang)
int ang;
{

    T410X_angle = ang;
    return (1);
}





void T410X_encode_x_y(x, y)
unsigned int x, y;
{
    static char chix = 0, chiy = 0, cloy = 0, ceb = 0;

    register unsigned int hix, lox, hiy, loy, eb, lx, ly;

    lx = (x <= 4095) ? x : 4095;
    ly = (y <= 3131) ? y : 3131;

    hix = lx / 128 + 32;
    lox = (lx / 4) % 32 + 64;
    hiy = ly / 128 + 32;
    loy = (ly / 4) % 32 + 96;
    eb = (ly % 4) * 4 + lx % 4 + 96;

    if (chiy != hiy)
        (void) _IO_putc (hiy, gpoutfile);
    if (ceb != eb)
        (void) _IO_putc (eb, gpoutfile);
    if ((cloy != loy) || (ceb != eb) || (chix != hix))
        (void) _IO_putc (loy, gpoutfile);
    if (chix != hix)
        (void) _IO_putc (hix, gpoutfile);
    (void) _IO_putc (lox, gpoutfile);

    chix = hix;
    chiy = hiy;
    cloy = loy;
    ceb = eb;
}


void T410X_encode_int(number)
int number;
{
    register unsigned int mag, hi1, hi2, lo;

    mag = ((number) >= 0 ? (number) : -(number));

    hi1 = mag / 1024 + 64;
    hi2 = (mag / 16) % 64 + 64;
    lo = mag % 16 + 32;

    if (number >= 0)
        lo += 16;

    if (hi1 != 64)
        (void) _IO_putc (hi1, gpoutfile);
    if ((hi2 != 64) || (hi1 != 64))
        (void) _IO_putc (hi2, gpoutfile);
    (void) _IO_putc (lo, gpoutfile);

}
# 238 "term.h" 2


# 1 "term/tek.trm" 1
# 62 "term/tek.trm"
# 1 "term/driver.h" 1
# 63 "term/tek.trm" 2
# 82 "term/tek.trm"
static void TEK40init (void);
static void TEK40graphics (void);
static void TEK40text (void);
static void TEK40linetype (int linetype);
static void TEK40move (unsigned int x, unsigned int y);
static void TEK40vector (unsigned int x, unsigned int y);
static void TEK40put_text (unsigned int x, unsigned int y, char str[]);
static void TEK40reset (void);
static void BG_text (void);
static void BG_put_text (unsigned int x, unsigned int y, char str[]);
static void KTEK40graphics (void);
static void KTEK40Ctext (void);
static void KTEK40Clinetype (int linetype);
static void KTEK40Mlinetype (int linetype);
static void KTEK40reset (void);
static void SEL_init (void);
static void SEL_graphics (void);
static void SEL_text (void);
static void SEL_reset (void);
static void VTTEK40init (void);
static void VTTEK40reset (void);
static void VTTEK40linetype (int linetype);
static void VTTEK40put_text (unsigned int x, unsigned int y, char str[]);
static void CTEK_linetype (int linetype);
static void CTEK_move (unsigned int x, unsigned int y);
static void CTEK_vector (unsigned int x, unsigned int y);
# 136 "term/tek.trm"
static void TEK40init()
{
}


static void TEK40graphics()
{



    fputs("\033\014", gpoutfile);



    (void) fflush(gpoutfile);
    sleep(1);


}

static void TEK40text()
{



    TEK40move(0, 12);
    fputs("\037", gpoutfile);






}


static void TEK40linetype(linetype)
int linetype;
{
}

static void TEK40move(x, y)
unsigned int x, y;
{
    (void) _IO_putc ('\035', gpoutfile);
    TEK40vector(x, y);
}


static void TEK40vector(x, y)
unsigned int x, y;
{
    (void) _IO_putc ((0x20 | (y & (31<<5)) >> 5), gpoutfile);
    (void) _IO_putc ((0x60 | (y & 31)), gpoutfile);
    (void) _IO_putc ((0x20 | (x & (31<<5)) >> 5), gpoutfile);
    (void) _IO_putc ((0x40 | (x & 31)), gpoutfile);
}


static void TEK40put_text(x, y, str)
unsigned int x, y;
char str[];
{
    TEK40move(x, y - 11);
    fprintf(gpoutfile, "\037%s\n", str);
}


static void TEK40reset()
{
}
# 241 "term/tek.trm"
static void BG_text()
{



    TEK40move(0, 1024 - 2 * 16);
    fputs("\037", gpoutfile);



}


static void BG_put_text(x, y, str)
unsigned int x, y;
char str[];
{
    TEK40move(x, y - 11);
    fprintf(gpoutfile, "\037%s\n", str);
}
# 275 "term/tek.trm"
static void KTEK40graphics()
{




    fputs("\033\014", gpoutfile);




}

static void KTEK40Ctext()
{
    TEK40text();
    KTEK40Clinetype(0);



}





static char *kermit_color[15] =
{"\033[0;37m", "\033[1;30m",
 "\033[0;32m", "\033[0;36m", "\033[0;31m", "\033[0;35m",
 "\033[1;34m", "\033[1;33m", "\033[1;31m", "\033[1;37m",
 "\033[1;35m", "\033[1;32m", "\033[1;36m", "\033[0;34m",
 "\033[0;33m"};

static void KTEK40Clinetype(linetype)
int linetype;
{
    if (linetype >= 13)
        linetype %= 13;
    fprintf(gpoutfile, "%s", kermit_color[linetype + 2]);
}





static char *kerm_linetype = "`a`abcde";

static void KTEK40Mlinetype(linetype)
int linetype;
{
    if (linetype >= 6)
        linetype %= 6;
    fprintf(gpoutfile, "\033%c", kerm_linetype[linetype + 2]);
}

static void KTEK40reset()
{
    fputs("\030\n", gpoutfile);



}
# 346 "term/tek.trm"
static void SEL_init()
{
    fputs("\033\062", gpoutfile);



}


static void SEL_graphics()
{
    fputs("\033[H\033[J\033\061\033\014", gpoutfile);
# 366 "term/tek.trm"
}


static void SEL_text()
{



    TEK40move(0, 12);
    fputs("\033\062", gpoutfile);






}

static void SEL_reset()
{
    fputs("\033\061\033\012\033\062\033[H\033[J", gpoutfile);






}





static void VTTEK40init()
{
    fputs("\033[?38h", gpoutfile);
    fflush(gpoutfile);
    sleep(1);




}

static void VTTEK40reset()
{
    fputs("\033[?38l", gpoutfile);
    fflush(gpoutfile);
    sleep(1);




}





static char *vt_linetype = "`a`abcdhijkl";
static int last_vt_linetype = 0;
static void VTTEK40linetype(linetype)
int linetype;
{
    if (linetype >= 10)
        linetype %= 10;
    fprintf(gpoutfile, "\033%c", vt_linetype[linetype + 2]);
    last_vt_linetype = linetype;
}

static void VTTEK40put_text(x, y, str)
unsigned int x, y;
char str[];
{
    int linetype;
    linetype = last_vt_linetype;
    VTTEK40linetype(0);
    TEK40put_text(x, y, str);
    VTTEK40linetype(linetype);
}
# 471 "term/tek.trm"
static void CT_solid_vector (int x, int y);
static void CT_draw_vpoint (int x, int y, int last);
static void CT_pattern_vector (int x1, int y1);


static unsigned long CT_lines[] =
{0xffffffff,
 0x000fffff,
 0x00ff00ff,
 0x00f00fff,
 0x00f07fff,
 0x07070707,
 0x07ff07ff,
 0x070707ff};


static unsigned long *CT_pattern = &CT_lines[0];


static int CT_last_linetype = 0, CT_last_x, CT_last_y;

static void CTEK_linetype(linetype)
int linetype;
{
    if (linetype < 0)
        linetype = 0;
    linetype %= (sizeof(CT_lines) / sizeof(unsigned long));
    CT_pattern = &CT_lines[linetype];
    CT_last_linetype = linetype;
}

static void CTEK_move(x, y)
unsigned int x;
unsigned int y;
{
    TEK40move(x, y);
    CT_last_x = x;
    CT_last_y = y;
}

static void CT_solid_vector(x, y)
int x;
int y;
{
    TEK40vector(x, y);
    CT_last_x = x;
    CT_last_y = y;
}






static int CT_penon = 0;

static void CT_draw_vpoint(x, y, last)
int x;
int y;
int last;
{
    static int xx0, yy0, xx1, yy1;

    if ((*CT_pattern) & 1) {
        if (CT_penon) {
            xx1 = x;
            yy1 = y;
        } else {
            xx0 = xx1 = x;
            yy0 = yy1 = y;
            CT_penon = 1;
        }
        *CT_pattern = ((*CT_pattern) >> 1) | 0x80000000;
        if (last) {
            TEK40move(xx0, yy0);
            TEK40vector(xx1, yy1);
            CT_penon = 0;
        }
    } else {
        if (CT_penon) {

            TEK40move(xx0, yy0);
            TEK40vector(xx1, yy1);
            CT_penon = 0;
        }
        *CT_pattern = (*CT_pattern) >> 1;
    }
}





static void CT_pattern_vector(x1, y1)
int x1;
int y1;
{
    int op;
    int x0 = CT_last_x;
    int y0 = CT_last_y;
    int dx = x1 - x0;
    int dy = y1 - y0;
    int ax = ((dx) >= 0 ? (dx) : -(dx)) << 1;
    int ay = ((dy) >= 0 ? (dy) : -(dy)) << 1;
    int sx = (((dx) >= 0)? 1:-1);
    int sy = (((dy) >= 0)? 1:-1);

    if (ax >= ay) {
        for (op = ay - (ax >> 1); x0 != x1; x0 += sx, op += ay) {
            CT_draw_vpoint(x0, y0, 0);
            if (op > 0 || (op == 0 && sx == 1)) {
                op -= ax;
                y0 += sy;
            }
        }
    } else {
        for (op = ax - (ay >> 1); y0 != y1; y0 += sy, op += ax) {
            CT_draw_vpoint(x0, y0, 0);
            if (op > 0 || (op == 0 && sy == 1)) {
                op -= ay;
                x0 += sx;
            }
        }
    }
    CT_draw_vpoint(x0, y0, 1);
    CT_last_x = x1;
    CT_last_y = y1;
}

static void CTEK_vector(x, y)
unsigned int x;
unsigned int y;
{
    if (CT_last_linetype <= 0)
        CT_solid_vector(x, y);
    else
        CT_pattern_vector(x, y);
}
# 241 "term.h" 2


# 1 "term/xlib.trm" 1
# 47 "term/xlib.trm"
# 1 "term/driver.h" 1
# 48 "term/xlib.trm" 2






static void Xlib_init (void);
static void Xlib_graphics (void);
static void Xlib_text (void);
static void Xlib_reset (void);
static void Xlib_move (unsigned int x, unsigned int y);
static void Xlib_vector (unsigned int x, unsigned int y);
static void Xlib_linetype (int lt);
static void Xlib_put_text (unsigned int x, unsigned int y, char str[]);
static int Xlib_justify_text (enum JUSTIFY mode);
# 79 "term/xlib.trm"
static void Xlib_init()
{

}

static void Xlib_graphics()
{
    fputs("G\n", gpoutfile);
}

static void Xlib_text()
{
    fputs("E\n", gpoutfile);
    fflush(gpoutfile);




}

static void Xlib_reset()
{
    fputs("R\n", gpoutfile);
    fflush(gpoutfile);
}

static void Xlib_move(x, y)
unsigned int x, y;
{
    fprintf(gpoutfile, "M%04d%04d\n", x, y);
}

static void Xlib_vector(x, y)
unsigned int x, y;
{
    fprintf(gpoutfile, "V%04d%04d\n", x, y);
}

static void Xlib_linetype(lt)
int lt;
{
    fprintf(gpoutfile, "L%04d\n", lt);
}

static void Xlib_put_text(x, y, str)
unsigned int x, y;
char str[];
{
    fprintf(gpoutfile, "T%04d%04d%s\n", x, y, str);
}

static int Xlib_justify_text(mode)
enum JUSTIFY mode;
{
    fprintf(gpoutfile, "J%04d\n", mode);
    return (1);
}
# 244 "term.h" 2
# 253 "term.h"
# 1 "term/x11.trm" 1
# 40 "term/x11.trm"
# 1 "term/driver.h" 1
# 41 "term/x11.trm" 2






int X11_args (int argc, char *argv[]);
static void X11_options (void);
static void X11_init (void);
static void X11_graphics (void);
static void X11_text (void);
static void X11_reset (void);
static void X11_move (unsigned int x, unsigned int y);
static void X11_vector (unsigned int x, unsigned int y);
static void X11_linewidth (double lw);
static void X11_pointsize (double ps);
static void X11_linetype (int lt);
static void X11_put_text (unsigned int x, unsigned int y, char str[]);
static int X11_justify_text (enum JUSTIFY mode);
static void X11_point (unsigned int x, unsigned int y, int number);
static void X11_fillbox (int style, unsigned int x, unsigned y, unsigned int width, unsigned int height);
# 78 "term/x11.trm"
int X11_Display = 0;
# 101 "term/x11.trm"
static void X11_atexit (void);





typedef enum { hasNoArg, hasArg } OptionArg;

static struct x11opt {
    const char *option;
    OptionArg arg;
} X11_opts[] =
{
   { "-mono", hasNoArg }, { "-gray", hasNoArg }, { "-clear", hasNoArg },
   { "-tvtwm", hasNoArg }, { "-pointsize", hasArg },
   { "-iconic", hasNoArg }, { "-rv", hasNoArg },
   { "-reverse", hasNoArg }, { "+rv", hasNoArg },
   { "-synchronous", hasNoArg },
   { "-display", hasArg }, { "-geometry", hasArg }, { "-bg", hasArg },
   { "-background", hasArg }, { "-bd", hasArg },
   { "-bordercolor", hasArg }, { "-bw", hasArg },
   { "-borderwidth", hasArg }, { "-fg", hasArg },
   { "-foreground", hasArg }, { "-fn", hasArg }, { "-font", hasArg },
   { "-name", hasArg },
   { "-selectionTimeout", hasArg }, { "-title", hasArg },
   { "-xnllanguage", hasArg }, { "-xrm", hasArg },
   { "-raise", hasNoArg }, { "-noraise", hasNoArg },
   { "-persist", hasNoArg }
};



static FILE *X11_ipc;

static char **xargv = (char **)((void *)0);
static char *optvec[2*(sizeof(X11_opts) / sizeof(X11_opts[0]))+1];



static char X11_command[] = "gnuplot_x11";






int
X11_args(argc, argv)
int argc;
char *argv[];
{
    int nx11 = 0, i = 0, n;

    xargv = (char **) gp_alloc (argc*sizeof(char *), "<xargv>");

    if (!xargv) {
        fputs ("not enough memory to copy argv - quitting\n", stderr);
        exit (1);
    }



    memcpy (xargv, argv, argc*sizeof(char *));
    optvec[i++] = X11_command;

    while (++argv, ++xargv, --argc > 0) {
        for (n = 0; n < (sizeof(X11_opts) / sizeof(X11_opts[0])); n++) {
            if (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (*argv) && __builtin_constant_p (X11_opts[n].option) && (__s1_len = strlen (*argv), __s2_len = strlen (X11_opts[n].option), (!((size_t)(const void *)((*argv) + 1) - (size_t)(const void *)(*argv) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((X11_opts[n].option) + 1) - (size_t)(const void *)(X11_opts[n].option) == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (*argv), (__const char *) (X11_opts[n].option), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (*argv) && ((size_t)(const void *)((*argv) + 1) - (size_t)(const void *)(*argv) == 1) && (__s1_len = strlen (*argv), __s1_len < 4) ? (__builtin_constant_p (X11_opts[n].option) && ((size_t)(const void *)((X11_opts[n].option) + 1) - (size_t)(const void *)(X11_opts[n].option) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (*argv))[0] - ((__const unsigned char *) (__co!
nst char *)(X11_opts[n].option))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (*argv))[1] - ((__const unsigned char *) (__const char *) (X11_opts[n].option))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (*argv))[2] - ((__const unsigned char *) (__const char *) (X11_opts[n].option))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (*argv))[3] - ((__const unsigned char *) (__const char *) (X11_opts[n].option))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) (X11_opts[n].option); register int __result = (((__const unsigned char *) (__const char *) (*argv))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (*argv))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) !
(__const char *) (*argv))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (*argv))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (X11_opts[n].option) && ((size_t)(const void *)((X11_opts[n].option) + 1) - (size_t)(const void *)(X11_opts[n].option) == 1) && (__s2_len = strlen (X11_opts[n].option), __s2_len < 4) ? (__builtin_constant_p (*argv) && ((size_t)(const void *)((*argv) + 1) - (size_t)(const void *)(*argv) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (*argv))[0] - ((__const unsigned char *) (__const char *)(X11_opts[n].option))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (*argv))[1] - ((__const unsigned char *) (__const char *) (X11_opts[n].option))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (*argv))[2] - ((__const unsigned char *) (__const cha!
r *) (X11_opts[n].option))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (*argv))[3] - ((__const unsigned char *) (__const char *) (X11_opts[n].option))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (*argv); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) (X11_opts[n].option))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) (X11_opts[n].option))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) (X11_opts[n].option))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) (X11_opts[n].option))[3]); } } __result; }))) : strcmp (*argv, X11_opts[n].option)))); }) == 0) {
                optvec[i++] = *xargv;
                if (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (*argv) && __builtin_constant_p ("-display") && (__s1_len = strlen (*argv), __s2_len = strlen ("-display"), (!((size_t)(const void *)((*argv) + 1) - (size_t)(const void *)(*argv) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("-display") + 1) - (size_t)(const void *)("-display") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (*argv), (__const char *) ("-display"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (*argv) && ((size_t)(const void *)((*argv) + 1) - (size_t)(const void *)(*argv) == 1) && (__s1_len = strlen (*argv), __s1_len < 4) ? (__builtin_constant_p ("-display") && ((size_t)(const void *)(("-display") + 1) - (size_t)(const void *)("-display") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (*argv))[0] - ((__const unsigned char *) (__const char *)("-display"))[0]); if (__s1_len > 0 && __result =!
= 0) { __result = (((__const unsigned char *) (__const char *) (*argv))[1] - ((__const unsigned char *) (__const char *) ("-display"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (*argv))[2] - ((__const unsigned char *) (__const char *) ("-display"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (*argv))[3] - ((__const unsigned char *) (__const char *) ("-display"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("-display"); register int __result = (((__const unsigned char *) (__const char *) (*argv))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (*argv))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (*argv))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const un!
signed char *) (__const char *) (*argv))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("-display") && ((size_t)(const void *)(("-display") + 1) - (size_t)(const void *)("-display") == 1) && (__s2_len = strlen ("-display"), __s2_len < 4) ? (__builtin_constant_p (*argv) && ((size_t)(const void *)((*argv) + 1) - (size_t)(const void *)(*argv) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (*argv))[0] - ((__const unsigned char *) (__const char *)("-display"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (*argv))[1] - ((__const unsigned char *) (__const char *) ("-display"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (*argv))[2] - ((__const unsigned char *) (__const char *) ("-display"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (*argv))[3] - ((__const unsigned !
char *) (__const char *) ("-display"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (*argv); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("-display"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("-display"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("-display"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("-display"))[3]); } } __result; }))) : strcmp (*argv, "-display")))); }) == 0)
                    X11_Display++;
                if (X11_opts[n].arg == hasArg) {
                    if (--argc <= 0)
                        return nx11;
                    optvec[i++] = *++xargv, ++argv;
                    nx11++;
                }
                nx11++;
                break;
            }
        }
        if (n == (sizeof(X11_opts) / sizeof(X11_opts[0])))
            break;
    }

    return (nx11);
}


static unsigned int X11_plot_number;

static void
X11_options()
{
    if (almost_equals(c_token, "res$et")) {
        X11_atexit ();
        ++c_token;
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        struct value a;
        X11_plot_number = (int) real(const_express(&a));

    }
    sprintf(term_options, "%d", X11_plot_number);
}
# 240 "term/x11.trm"
static void
X11_atexit ()
{
    if (X11_ipc) {
        fputs("R\n", X11_ipc);
        fclose(X11_ipc);

        X11_ipc = ((void *)0);
    }
}

static void
X11_init()
{
    static int been_here = 0;

    if (!X11_ipc) {







        int fdes[2];

        if (pipe(fdes)) perror("pipe() failed:");

        if (fork() == 0) {

            close(fdes[1]);
            dup2(fdes[0], 0);
            execvp(X11_command, optvec);

            perror("exec failed");
            exit(1);
        }

        close(fdes[0]);
        X11_ipc = fdopen(fdes[1], "w");

    }

    if (!been_here) {
        atexit(X11_atexit);
        been_here++;
    }
}

static void
X11_reset()
{

}
# 529 "term/x11.trm"
static void
X11_graphics()
{
                   ;


    fprintf(X11_ipc, "G%d\n",X11_plot_number);





}

static void
X11_text()
{
    fprintf(X11_ipc, "E\n");
    fflush(X11_ipc);





              ;
}


static void
X11_move(x, y)
unsigned int x, y;
{
    fprintf(X11_ipc, "M%04d%04d\n",x,y);
}

static void
X11_vector(x, y)
unsigned int x, y;
{
    fprintf(X11_ipc, "V%04d%04d\n",x,y);
}

static void
X11_pointsize(ps)
double ps;
{
    fprintf(X11_ipc, "P7%04d%04d\n",(int) (term->h_tic * ps * 0.5),(int) (term->v_tic * ps * 0.5));

}

static void
X11_linewidth(lw)
double lw;
{
    fprintf(X11_ipc, "W%04d\n",(int) lw);
}

static void
X11_linetype(lt)
int lt;
{
    fprintf(X11_ipc, "L%04d\n",lt);
}

static void
X11_put_text(x, y, str)
unsigned int x, y;
char str[];
{

    if (x < 10000 && y < 10000) {
        fprintf(X11_ipc, "T%04d%04d%s\n",x,y,str);
    }
}

static int
X11_justify_text(mode)
enum JUSTIFY mode;
{
    fprintf(X11_ipc, "J%04d\n",mode);
    return (1);
}

static void
X11_point(x, y, number)
unsigned int x, y;
int number;
{
    if (number >= 0)
        number %= 6;
    number += 1;
    fprintf(X11_ipc, "P%01d%04d%04d\n",number,x,y);
}

static void
X11_fillbox(style, x, y, w, h)
int style;
unsigned int x, y, w, h;
{
    fprintf(X11_ipc, "F%04d%04u%04u%04u%04u\n",style,x,y,w,h);
}
# 254 "term.h" 2



# 1 "term/ai.trm" 1
# 64 "term/ai.trm"
# 1 "term/driver.h" 1
# 65 "term/ai.trm" 2






static void AI_init (void);
static void AI_graphics (void);
static void AI_text (void);
static void AI_linetype (int linetype);
static void AI_move (unsigned int x, unsigned int y);
static void AI_vector (unsigned int x, unsigned int y);
static void AI_put_text (unsigned int x, unsigned int y, char *str);
static int AI_text_angle (int ang);
static void AI_reset (void);
static void AI_options (void);
static int AI_justify_text (enum JUSTIFY mode);
static void AI_suspend ();
static void AI_resume ();
static int AI_set_font (char *font);
# 112 "term/ai.trm"
extern char version[];
extern char patchlevel[];

char ai_font[50 + 1] = "Times-Roman";
int ai_fontsize = 14;
char ai_oldfont[50 + 1] = "Times-Roman";
int ai_oldfontsize = 14;
TBOOLEAN ai_color = 0;
TBOOLEAN ai_stroke = 0;
int ai_page = 0;
int ai_path_count = 0;
int ai_ang = 0;
int ai_subgroup_level = 0;
int ai_multiplot_group = 0;
enum JUSTIFY ai_justify = LEFT;


static void AI_options()
{
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "d$efault")) {
            ai_color = 0;
            (__extension__ (__builtin_constant_p ("Times-Roman") ? (((size_t)(const void *)(("Times-Roman") + 1) - (size_t)(const void *)("Times-Roman") == 1) && strlen ("Times-Roman") + 1 <= 8 ? __strcpy_small (ai_font, __extension__ (((__const unsigned char *) (__const char *) ("Times-Roman"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("Times-Roman"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("Times-Roman"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("Times-Roman"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("Times-Roman"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("Times-Roman"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("Times-Roman"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("Times-Roman"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("Times-Roman"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("Times-Ro!
man"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("Times-Roman"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("Times-Roman"))[4]), strlen ("Times-Roman") + 1) : (char *) memcpy (ai_font, "Times-Roman", strlen ("Times-Roman") + 1)) : strcpy (ai_font, "Times-Roman")));
            ai_fontsize = 14;
            (__extension__ (__builtin_constant_p ("Times-Roman") ? (((size_t)(const void *)(("Times-Roman") + 1) - (size_t)(const void *)("Times-Roman") == 1) && strlen ("Times-Roman") + 1 <= 8 ? __strcpy_small (ai_oldfont, __extension__ (((__const unsigned char *) (__const char *) ("Times-Roman"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("Times-Roman"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("Times-Roman"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("Times-Roman"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("Times-Roman"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("Times-Roman"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("Times-Roman"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("Times-Roman"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("Times-Roman"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("Times!
-Roman"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("Times-Roman"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("Times-Roman"))[4]), strlen ("Times-Roman") + 1) : (char *) memcpy (ai_oldfont, "Times-Roman", strlen ("Times-Roman") + 1)) : strcpy (ai_oldfont, "Times-Roman")));
            ai_oldfontsize = 14;
            c_token++;
        }
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "m$onochrome")) {
            ai_color = 0;
            c_token++;
        } else if (almost_equals(c_token, "c$olor")
                   || almost_equals(c_token, "c$olour")) {
            ai_color = 1;
            c_token++;
        }
    }
    if (!(c_token >= num_tokens || equals(c_token,";")) && isstring(c_token)) {
        quote_str(ai_font, c_token, 50);
        (__extension__ (__builtin_constant_p (ai_font) ? (((size_t)(const void *)((ai_font) + 1) - (size_t)(const void *)(ai_font) == 1) && strlen (ai_font) + 1 <= 8 ? __strcpy_small (ai_oldfont, __extension__ (((__const unsigned char *) (__const char *) (ai_font))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) (ai_font))[0]), __extension__ (((__const unsigned char *) (__const char *) (ai_font))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) (ai_font))[4]), __extension__ (((((__const unsigned char *) (__const char *) (ai_font))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) (ai_font))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) (ai_font))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) (ai_font))[0]), __extension__ (((((__const unsigned char *) (__const char *) (ai_font))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) (ai_font))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) (ai_font))[4 + 1]) !
<< 8 | ((__const unsigned char *) (__const char *) (ai_font))[4]), strlen (ai_font) + 1) : (char *) memcpy (ai_oldfont, ai_font, strlen (ai_font) + 1)) : strcpy (ai_oldfont, ai_font)));
        c_token++;
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {

        struct value a;
        ai_fontsize = (int) real(const_express(&a));
        ai_oldfontsize = ai_fontsize;
        c_token++;
        term->v_char = (unsigned int) (ai_fontsize * (10.0));
        term->h_char = (unsigned int) (ai_fontsize * (10.0) * 6 / 10);
    }
    sprintf(term_options, "%s \"%s\" %d",
            ai_color ? "color" : "monochrome", ai_font, ai_fontsize);
}


static void AI_init()
{
    ai_page = 0;

    fprintf(gpoutfile, "%%!PS-Adobe-2.0 EPSF-1.2\n%%%%Creator: Adobe Illustrator(TM) 3.2\n%%%%TrueCreator: gnuplot %s patchlevel %s ai terminal\n%%%%BoundingBox: %d %d %d %d\n%%%%Template:\n%%%%EndComments\n%%%%EndProlog\n",






            version, patchlevel,
            50, 50,
            (int) ((5000) / (10.0) + 0.5 + 50),
            (int) ((3500) / (10.0) + 0.5 + 50));
}


static void AI_graphics()
{
    ai_page++;

    fputs("0 G\n1 j\n1 J\nu\n", gpoutfile);




    ai_path_count = 0;
    ai_stroke = 0;
}


static void AI_text()
{
    if (ai_stroke) {
        fputs("S\n", gpoutfile);
        ai_stroke = 0;
    }
    while (ai_subgroup_level) {
        fputs("U\n", gpoutfile);
        ai_subgroup_level--;
    }
    fputs("U\n", gpoutfile);
    ai_path_count = 0;
    ai_multiplot_group = 0;
}


static void AI_reset()
{
    fputs("%%%%Trailer\n", gpoutfile);

}


static void AI_linetype(linetype)
int linetype;
{
    if (ai_stroke) {
        fputs("S\n", gpoutfile);
        ai_stroke = 0;
    }
    if (ai_subgroup_level) {
        fputs("U\n", gpoutfile);
        ai_subgroup_level--;
    }
    if (linetype == -2 && multiplot) {




        switch (ai_multiplot_group) {
        case 0:
            fputs("u\n", gpoutfile);
            ai_subgroup_level++;
            ai_multiplot_group = 1;
            break;
        case 1:
            ai_multiplot_group = 2;
            break;
        case 2:
            ai_multiplot_group = 1;
            fputs("U\nu\n", gpoutfile);
            break;
        }
    }
    if (linetype == -2 && !multiplot) {
        if (ai_multiplot_group) {
            fputs("U\n", gpoutfile);
            ai_subgroup_level--;
            ai_multiplot_group = 0;
        }
    }
    fputs("u\n", gpoutfile);
    ai_subgroup_level++;

    switch (linetype) {
    case -2:
        fprintf(gpoutfile, "%.2f w\n", (0.5*(10.0)) / (10.0) * 2.0);
        if (ai_color) {
            fputs("0 0 0 1 K\n", gpoutfile);
        } else {
            fputs("[] 0 d\n", gpoutfile);
        }
        break;

    case -1:
        fprintf(gpoutfile, "%.2f w\n", (0.5*(10.0)) / (10.0) / 2.0);
        if (ai_color) {
            fputs("0 0 0 1 K\n", gpoutfile);
        } else {
            fputs("[1 2] 0 d\n", gpoutfile);
        }
        break;

    case 0:
        fprintf(gpoutfile, "%.2f w\n", (0.5*(10.0)) / (10.0));
        if (ai_color) {
            fputs("1 0 1 0 K\n", gpoutfile);
        } else {
            fputs("[] 0 d\n", gpoutfile);
        }
        break;

    case 1:
        fprintf(gpoutfile, "%.2f w\n", (0.5*(10.0)) / (10.0));
        if (ai_color) {
            fputs("1 1 0 0 K\n", gpoutfile);
        } else {
            fputs("[4 2] 0 d\n", gpoutfile);
        }
        break;

    case 2:
        fprintf(gpoutfile, "%.2f w\n", (0.5*(10.0)) / (10.0));
        if (ai_color) {
            fputs("0 1 1 0 K\n", gpoutfile);
        } else {
            fputs("[2 3] 0 d\n", gpoutfile);
        }
        break;

    case 3:
        fprintf(gpoutfile, "%.2f w\n", (0.5*(10.0)) / (10.0));
        if (ai_color) {
            fputs("0 1 0 0 K\n", gpoutfile);
        } else {
            fputs("[1 1.5] 0 d\n", gpoutfile);
        }
        break;

    case 4:
        fprintf(gpoutfile, "%f w\n", (0.5*(10.0)) / (10.0));
        if (ai_color) {
            fputs("1 0 0 0 K\n", gpoutfile);
        } else {
            fputs("[5 2 1 2] 0 d\n", gpoutfile);
        }
        break;

    case 5:
        fprintf(gpoutfile, "%.2f w\n", (0.5*(10.0)) / (10.0));
        if (ai_color) {
            fputs("0 0 1 0 K\n", gpoutfile);
        } else {
            fputs("[4 3 1 3] 0 d\n", gpoutfile);
        }
        break;

    case 6:
        fprintf(gpoutfile, "%.2f w\n", (0.5*(10.0)) / (10.0));
        if (ai_color) {
            fputs("0 0 0 1 K\n", gpoutfile);
        } else {
            fputs("[2 2 2 4] 0 d\n", gpoutfile);
        }
        break;

    case 7:
        fprintf(gpoutfile, "%.2f w\n", (0.5*(10.0)) / (10.0));
        if (ai_color) {
            fputs("0 0.7 1 0 K\n", gpoutfile);
        } else {
            fputs("[2 2 2 2 2 4] 0 d\n", gpoutfile);
        }
        break;

    case 8:
        fprintf(gpoutfile, "%.2f w\n", (0.5*(10.0)) / (10.0));
        if (ai_color) {
            fputs("0.5 0.5 0.5 0 K\n", gpoutfile);
        } else {
            fputs("[2 2 2 2 2 2 2 4] 0 d\n", gpoutfile);
        }
        break;
    }

    ai_path_count = 0;
}


static void AI_move(x, y)
unsigned int x, y;
{
    if (ai_stroke)
        fputs("S\n", gpoutfile);
    fprintf(gpoutfile, "%.2f %.2f m\n", x / (10.0), y / (10.0));
    ai_path_count += 1;
    ai_stroke = 1;
}


static void AI_vector(x, y)
unsigned int x, y;
{
    fprintf(gpoutfile, "%.2f %.2f l\n", x / (10.0), y / (10.0));
    ai_path_count += 1;
    ai_stroke = 1;
    if (ai_path_count >= 400) {
        fprintf(gpoutfile, "S\n%.2f %.2f m\n", x / (10.0), y / (10.0));
        ai_path_count = 0;
    }
}


static void AI_put_text(x, y, str)
unsigned int x, y;
char *str;
{
    char ch;
    if (ai_stroke) {
        fputs("S\n", gpoutfile);
        ai_stroke = 0;
    }
    switch (ai_justify) {
    case LEFT:
        fprintf(gpoutfile, "/_%s %d 0 0 0 z\n", ai_font, ai_fontsize);
        break;
    case CENTRE:
        fprintf(gpoutfile, "/_%s %d 0 0 1 z\n", ai_font, ai_fontsize);
        break;
    case RIGHT:
        fprintf(gpoutfile, "/_%s %d 0 0 2 z\n", ai_font, ai_fontsize);
        break;
    }
    if (ai_ang == 0) {
        fprintf(gpoutfile, "[ 1 0 0 1 %.2f %.2f] e\n",
                x / (10.0), y / (10.0) - ai_fontsize / 3.0);
    } else {
        fprintf(gpoutfile, "[ 0 1 -1 0 %.2f %.2f] e\n",
                x / (10.0) - ai_fontsize / 3.0, y / (10.0));
    }

    _IO_putc ('(', gpoutfile);
    ch = *str++;
    while (ch != '\0') {
        if ((ch == '(') || (ch == ')') || (ch == '\\'))
            _IO_putc ('\\', gpoutfile);
        _IO_putc (ch, gpoutfile);
        ch = *str++;
    }
    fputs(") t\nT\n", gpoutfile);
    ai_path_count = 0;
}

static int AI_text_angle(ang)
int ang;
{
    ai_ang = ang;
    return 1;
}

static int AI_justify_text(mode)
enum JUSTIFY mode;
{
    ai_justify = mode;
    return 1;
}

static int AI_set_font(font)
char *font;
{
    char name[32];
    int size, sep;

    if (font && *font) {
        sep = __extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p (",") && ((size_t)(const void *)((",") + 1) - (size_t)(const void *)(",") == 1) ? ((__r0 = ((__const char *) (","))[0], __r0 == '\0') ? strlen (font) : ((__r1 = ((__const char *) (","))[1], __r1 == '\0') ? __strcspn_c1 (font, __r0) : ((__r2 = ((__const char *) (","))[2], __r2 == '\0') ? __strcspn_c2 (font, __r0, __r1) : (((__const char *) (","))[3] == '\0' ? __strcspn_c3 (font, __r0, __r1, __r2) : strcspn (font, ","))))) : strcspn (font, ",")); });
        (__extension__ (__builtin_constant_p (font) && __builtin_constant_p (sep) ? (strlen (font) + 1 >= ((size_t) (sep)) ? (char *) memcpy (name, font, sep) : strncpy (name, font, sep)) : strncpy (name, font, sep)));
        name[sep] = '\0';
        size = ai_fontsize;
        sscanf(&(font[sep + 1]), "%d", &size);
        if (*name)
            (__extension__ (__builtin_constant_p (name) ? (((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) && strlen (name) + 1 <= 8 ? __strcpy_small (ai_font, __extension__ (((__const unsigned char *) (__const char *) (name))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) (name))[0]), __extension__ (((__const unsigned char *) (__const char *) (name))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) (name))[4]), __extension__ (((((__const unsigned char *) (__const char *) (name))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) (name))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) (name))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) (name))[0]), __extension__ (((((__const unsigned char *) (__const char *) (name))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) (name))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) (name))[4 + 1]) << 8 | ((__const unsigned char *) (__const c!
har *) (name))[4]), strlen (name) + 1) : (char *) memcpy (ai_font, name, strlen (name) + 1)) : strcpy (ai_font, name)));
        if (size)
            ai_fontsize = size;
    } else {
        ai_fontsize = ai_oldfontsize;
        (__extension__ (__builtin_constant_p (ai_oldfont) ? (((size_t)(const void *)((ai_oldfont) + 1) - (size_t)(const void *)(ai_oldfont) == 1) && strlen (ai_oldfont) + 1 <= 8 ? __strcpy_small (ai_font, __extension__ (((__const unsigned char *) (__const char *) (ai_oldfont))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) (ai_oldfont))[0]), __extension__ (((__const unsigned char *) (__const char *) (ai_oldfont))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) (ai_oldfont))[4]), __extension__ (((((__const unsigned char *) (__const char *) (ai_oldfont))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) (ai_oldfont))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) (ai_oldfont))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) (ai_oldfont))[0]), __extension__ (((((__const unsigned char *) (__const char *) (ai_oldfont))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) (ai_oldfont))[4 + 2]) << 8 | ((__const unsigned char !
*) (__const char *) (ai_oldfont))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) (ai_oldfont))[4]), strlen (ai_oldfont) + 1) : (char *) memcpy (ai_font, ai_oldfont, strlen (ai_oldfont) + 1)) : strcpy (ai_font, ai_oldfont)));
    }
    return 1;
}


static void AI_suspend()
{
}

static void AI_resume()
{
}
# 258 "term.h" 2


# 1 "term/cgm.trm" 1
# 54 "term/cgm.trm"
# 1 "term/driver.h" 1
# 55 "term/cgm.trm" 2






static void CGM_options (void);
static void CGM_init (void);
static void CGM_reset (void);
static void CGM_text (void);
static void CGM_graphics (void);
static void CGM_move (unsigned int x, unsigned int y);
static void CGM_dashed_vector (unsigned int ux, unsigned int uy);
static void CGM_solid_vector (unsigned int ux, unsigned int uy);
static void CGM_linetype (int linetype);
static void CGM_linecolor (int color);
static void CGM_dashtype (int dashtype);
static void CGM_linewidth (double width);
static void CGM_put_text (unsigned int x, unsigned int y, char *str);

static int CGM_text_angle (int ang);
static int CGM_justify_text (enum JUSTIFY mode);
static void CGM_point (unsigned int x, unsigned int y, int number);

static int CGM_find_font (char *font, int numchar);
static int CGM_set_font (char *font);
static void CGM_set_pointsize (double size);
# 115 "term/cgm.trm"
# 1 "/usr/include/ctype.h" 1 3
# 116 "term/cgm.trm" 2
# 127 "term/cgm.trm"
# 1 "/usr/include/assert.h" 1 3
# 36 "/usr/include/assert.h" 3
# 1 "/usr/include/features.h" 1 3
# 37 "/usr/include/assert.h" 2 3
# 68 "/usr/include/assert.h" 3
extern void __assert_fail (__const char *__assertion, __const char *__file,
                           unsigned int __line, __const char *__function)
             __attribute__ ((__noreturn__));


extern void __assert_perror_fail (int __errnum, __const char *__file,
                                  unsigned int __line,
                                  __const char *__function)
             __attribute__ ((__noreturn__));




extern void __assert (const char *__assertion, const char *__file, int __line)
             __attribute__ ((__noreturn__));
# 128 "term/cgm.trm" 2




static unsigned int cgm_posx;
static unsigned int cgm_posy;
static unsigned int cgm_linetype = 1;
static unsigned int cgm_dashtype = 0;
static unsigned int cgm_color = 0;
static int cgm_polyline[104];
static int cgm_coords = 0;
enum JUSTIFY cgm_justify = LEFT;
static int cgm_vert_text = 0;
static int cgm_vert_text_requested = 0;
static int cgm_step_sizes[8];

static int cgm_step_index = 0;
static int cgm_step = 0;

static int cgm_tic, cgm_tic707, cgm_tic866, cgm_tic500, cgm_tic1241, cgm_tic1077, cgm_tic621;

static char cgm_font_data[] =
{"\005Arial\014Arial Italic\012Arial Bold\021Arial Bold Italic\013Times Roman\022Times Roman Italic\020Times Roman Bold\027Times Roman Bold Italic\011Helvetica\005Roman"};
# 164 "term/cgm.trm"
static char cgm_font[32] = "Arial Bold";
static unsigned int cgm_fontsize = 10;
static unsigned cgm_linewidth;
static unsigned cgm_linewidth_pt = 1;
static TBOOLEAN cgm_monochrome = 0;
static int cgm_plotwidth = 432;
static TBOOLEAN cgm_portrait = 0;
static TBOOLEAN cgm_rotate = 1;
static TBOOLEAN cgm_dashed = 1;
static TBOOLEAN cgm_winword6_mode = 0;


static void CGM_flush_polyline (void);
static void CGM_flush_polygon (void);
static void CGM_write_char_record (int class, int cgm_id, int length, char *data);

static void CGM_write_code (int class, int cgm_id, int length);
static void CGM_write_int (int value);
static void CGM_write_int_record (int class, int cgm_id, int length, int *data);

static void CGM_write_mixed_record (int class, int cgm_id, int numint, int *int_data, int numchar, char *char_data);


static void CGM_write_byte_record (int class, int cgm_id, int length, char *data);




static void CGM_init()
{
    cgm_posx = cgm_posy = 0;
    cgm_linetype = 0;
    cgm_vert_text = 0;
}

static void CGM_graphics()
{
    register struct TERMENTRY *t = term;
    static int version_data[] = { 1 };
    static char description_data[] = "Computer Graphics Metafile version of Gnuplot";
    static int vdc_type_data[] = { 0 };
    static int integer_precision_data[] = { 16 };
    static int real_precision_data[] = { 1, 16, 16 };
    static int index_precision_data[] = { 16 };
    static int color_precision_data[] = { 16 };
    static int color_index_precision_data[] = { 16 };
    static int maximum_color_index_data_data[] = { 7 };
    static int scaling_mode_data[] = { 0, 0, 0 };
    static int color_value_extent_data[] = { 0, 0, 0, 255, 255, 255 };
    static int color_table_data[] =






    {

        0, 255, 255, 255,
        0, 0, 0, 255, 0, 0, 0, 255, 0, 0, 0, 255, 255, 255, 0, 255, 0, 255, 0, 255, 255

    };

    static int color_selection_mode_data[] = { 0 };
    static int linewidth_specification_mode_data[] = { 0 };
    static int marker_size_specification_mode_data[] = { 0 };
    static int vdc_extent_data[] = { 0, 0, 0, 0 };
    static int vdc_integer_precision_data[] = { 16 };
    static int transparency_data[] = { 1 };
    static int clip_indicator_data[] = { 0 };

    static int line_type_data[] = { 1 };
    static int interior_style_data[] = { 1 };

    static int elements_list_data[] =
    {
        0,
        0, 1,
        0, 2,
        0, 3,
        0, 4,
        0, 5,
        1, 1,
        1, 2,
        1, 3,
        1, 4,
        1, 5,
        1, 6,
        1, 7,
        1, 8,
        1, 9,
        2, 1,
        2, 2,
        2, 3,
        2, 4,
        2, 6,
        3, 1,
        3, 4,
        3, 6,
        4, 1,
        4, 3,
        4, 4,
        4, 7,
        4, 11,
        4, 12,
        4, 15,
        4, 16,
        4, 17,
        4, 18,
        4, 19,
        5, 2,
        5, 3,
        5, 4,
        5, 6,
        5, 7,
        5, 8,
        5, 10,
        5, 14,
        5, 15,
        5, 16,
        5, 18,
        5, 22,
        5, 23,
        5, 24,
        6, 1,
        7, 2
    };


    if (!outstr)
        CGM_write_char_record(0, 1, 1, outstr);
    else
        CGM_write_char_record(0, 1, strlen(outstr) + 1, outstr);
    CGM_write_int_record(1, 1, 2, version_data);
    CGM_write_char_record(1, 2, sizeof(description_data), description_data);
    CGM_write_int_record(1, 3, 2, vdc_type_data);
    CGM_write_int_record(1, 4, 2, integer_precision_data);
    CGM_write_int_record(1, 5, 6, real_precision_data);
    CGM_write_int_record(1, 6, 2, index_precision_data);
    CGM_write_int_record(1, 7, 2, color_precision_data);
    CGM_write_int_record(1, 8, 2, color_index_precision_data);
    CGM_write_int_record(1, 9, 2, maximum_color_index_data_data);
    CGM_write_int_record(1, 10, sizeof(color_value_extent_data) / (sizeof(int)/sizeof(short)),
                         color_value_extent_data);
    elements_list_data[0] = (sizeof(elements_list_data) / (sizeof(int)/sizeof(short)) - 2) / 4;
    CGM_write_int_record(1, 11, sizeof(elements_list_data) / (sizeof(int)/sizeof(short)),
                         elements_list_data);
    if (cgm_winword6_mode == 0)
        CGM_write_byte_record(1, 13, strlen(cgm_font_data), cgm_font_data);


    CGM_write_char_record(0, 3, 8, "PICTURE1");
    CGM_write_int_record(2, 1, 6, scaling_mode_data);
    CGM_write_int_record(2, 2, 2, color_selection_mode_data);
    CGM_write_int_record(2, 3, 2, linewidth_specification_mode_data);
    CGM_write_int_record(2, 4, 2, marker_size_specification_mode_data);
    vdc_extent_data[2] = t->xmax + (32767/180);
    vdc_extent_data[3] = t->ymax + (32767/180);
    CGM_write_int_record(2, 6, 8, vdc_extent_data);
    CGM_write_int_record(3, 1, 2, vdc_integer_precision_data);
    CGM_write_int_record(3, 4, sizeof(transparency_data) / (sizeof(int)/sizeof(short)),
                         transparency_data);
    CGM_write_int_record(3, 6, sizeof(clip_indicator_data) / (sizeof(int)/sizeof(short)),
                         clip_indicator_data);


    CGM_write_int_record(0, 4, 0, ((void *)0));




    if (!cgm_winword6_mode)
        CGM_write_int_record(5, 34, sizeof(color_table_data) / (sizeof(int)/sizeof(short)),
                             color_table_data);
    CGM_write_int_record(5, 2, sizeof(line_type_data) / (sizeof(int)/sizeof(short)),
                         line_type_data);
    cgm_linewidth = cgm_linewidth_pt * ((term->xmax + (32767/180))/cgm_plotwidth);
    CGM_write_int_record(5, 3, sizeof(cgm_linewidth) / (sizeof(int)/sizeof(short)),
                         (int *) &cgm_linewidth);
    CGM_linecolor(0);

    CGM_write_int_record(5, 15, 2, (int *) &t->v_char);
    CGM_write_int_record(5, 22, 2, interior_style_data);
    {
        char buf[45];
        sprintf(buf, "%.31s,%d", cgm_font, cgm_fontsize);
        CGM_set_font(buf);
    }
    CGM_set_pointsize(pointsize);
}

static int CGM_find_font(font, numchar)
char *font;
int numchar;
{
    int font_index = 1;
    char *s;
    for (s = cgm_font_data; s < cgm_font_data + strlen(cgm_font_data); s += (int) *s + 1) {

        if (numchar == (int) *s && strncasecmp(font, s + 1, numchar - 1) == 0)
            return font_index;
        font_index++;
    }
    return 0;
}

static int CGM_set_font(font)
char *font;
{
    register struct TERMENTRY *t = term;
    int size, font_index;
    char *comma;
    int sep;

    comma = (__extension__ (__builtin_constant_p (',') && (',') == '\0' ? (char *) __rawmemchr (font, ',') : strchr (font, ',')));
    if (comma == ((void *)0))
        return 0;
    sep = comma - font;

    font_index = CGM_find_font(font, sep);
    if (font_index == 0)
        font_index = 1;
    CGM_write_int_record(5, 10, 2, &font_index);


    size = cgm_fontsize;
    sscanf(comma + 1, "%d", &size);
    if (sep > 31)
        sep = 31;
    (__extension__ (__builtin_constant_p (font) && __builtin_constant_p (sep) ? (strlen (font) + 1 >= ((size_t) (sep)) ? (char *) memcpy (cgm_font, font, sep) : strncpy (cgm_font, font, sep)) : strncpy (cgm_font, font, sep)));
    cgm_font[sep] = ('\0');
    t->v_char = size * ((term->xmax + (32767/180))/cgm_plotwidth);
    t->h_char = (t->v_char * 5) / 9;
    CGM_write_int_record(5, 15, 2, (int *) &t->v_char);
    return 1;
}

static void CGM_text()
{
    CGM_flush_polyline();
    CGM_write_int_record(0, 5, 0, ((void *)0));
    CGM_write_int_record(0, 2, 0, ((void *)0));
}

static void CGM_linetype(linetype)
int linetype;
{
    ((void) ((linetype >= -2) ? 0 : (__assert_fail ("linetype >= -2", "term/cgm.trm", 411, __PRETTY_FUNCTION__), 0)));
    if (linetype == cgm_linetype)
        return;
    cgm_linetype = linetype;

    CGM_linecolor(linetype);
    if (cgm_dashed) {
        CGM_dashtype(linetype);
    } else {

        CGM_dashtype(linetype == -1 ? 2 : 0);
    }


}

static void CGM_linecolor(linecolor)
int linecolor;
{
    ((void) ((linecolor >= -2) ? 0 : (__assert_fail ("linecolor >= -2", "term/cgm.trm", 430, __PRETTY_FUNCTION__), 0)));
    linecolor = (linecolor < 1) ? 1 : linecolor % 7 + 1;
    if (cgm_monochrome || linecolor == cgm_color)
        return;
    cgm_color = linecolor;

    CGM_flush_polyline();
    CGM_write_int_record(5, 4, 2, (int *) &cgm_color);
    CGM_write_int_record(5, 23, 2, (int *) &cgm_color);
}

static void CGM_linewidth(width)
double width;
{
    int new_linewidth;

    ((void) ((width >= 0) ? 0 : (__assert_fail ("width >= 0", "term/cgm.trm", 446, __PRETTY_FUNCTION__), 0)));
    new_linewidth = width * cgm_linewidth_pt * ((term->xmax + (32767/180))/cgm_plotwidth);
    if (new_linewidth == cgm_linewidth)
        return;
    cgm_linewidth = new_linewidth;
    CGM_write_int_record(5, 3, sizeof(cgm_linewidth) / (sizeof(int)/sizeof(short)),
                         (int *) &cgm_linewidth);
    CGM_dashtype(cgm_dashtype);
}

static void CGM_dashtype(dashtype)
int dashtype;
{
    int i, j;




    static int dot_length[9 * 8] =
    {
        5, 8, 5, 8, 5, 8, 5, 8,
        5, 3, 5, 3, 5, 3, 5, 3,
        4, 1, 4, 1, 4, 1, 4, 1,
        4, 8, 4, 1, 4, 8, 4, 1,
        4, 9, 4, 1, 4, 1, 0, 0,
        4, 10, 4, 1, 4, 1, 4, 1,
        4, 10, 4, 10, 4, 1, 0, 0,
        4, 10, 4, 10, 4, 1, 4, 1};


    ((void) ((dashtype >= -2) ? 0 : (__assert_fail ("dashtype >= -2", "term/cgm.trm", 476, __PRETTY_FUNCTION__), 0)));
    if (dashtype == cgm_dashtype)
        return;
    cgm_dashtype = dashtype;

    CGM_flush_polyline();

    if (dashtype >= 9)
        dashtype = dashtype % 9;
    if (dashtype < 1) {
        term->vector = CGM_solid_vector;
        return;
    }
    term->vector = CGM_dashed_vector;


    j = (dashtype - 1) * 8;
    for (i = 0; i < 8; i++, j++) {
        if (dot_length[j])
            cgm_step_sizes[i] = (dot_length[j] * cgm_linewidth) * 2 / 3;
        else
            cgm_step_sizes[i] = 0;
    }

    cgm_step = cgm_step_sizes[1];
    cgm_step_index = 1;
}

static void CGM_move(x, y)
unsigned int x, y;
{
    ((void) ((x < term->xmax && y < term->ymax) ? 0 : (__assert_fail ("x < term->xmax && y < term->ymax", "term/cgm.trm", 507, __PRETTY_FUNCTION__), 0)));
    if (x == cgm_posx && y == cgm_posy)
        return;
    CGM_flush_polyline();
    cgm_posx = x;
    cgm_posy = y;
}

static void CGM_flush_polyline()
{
    if (cgm_coords == 0)
        return;
    CGM_write_int_record(4, 1, cgm_coords * 2, cgm_polyline);
    cgm_coords = 0;
}

static void CGM_write_char_record(class, cgm_id, numbytes, data)
int class, cgm_id, numbytes;
char *data;
{
    int i, pad, length;
    static unsigned char flag = 0xff;
    static unsigned char paddata = 0;
    char short_len;

    pad = 0;
    length = numbytes + 1;
    if (numbytes >= 255)
        length += 2;
    if (length & 1)
        pad = 1;
    CGM_write_code(class, cgm_id, length);
    if (numbytes < 255)
    {
        short_len = (char)numbytes;
        fwrite(&short_len, 1, 1, gpoutfile);
    } else {
        fwrite(&flag, 1, 1, gpoutfile);
        CGM_write_int(numbytes);
    }

    if (data)
        fwrite(data, 1, numbytes, gpoutfile);
    else
        for (i=0; i<numbytes+pad; i++)
            fputc('\0', gpoutfile);

    if(pad)
      fwrite(&paddata, 1, 1, gpoutfile);
}

static void CGM_write_byte_record(class, cgm_id, numbytes, data)
int class, cgm_id, numbytes;
char *data;
{
    int pad;
    static unsigned char paddata = 0;

    pad = numbytes & 1;
    CGM_write_code(class, cgm_id, numbytes);
    fwrite(data, 1, numbytes, gpoutfile);
    if(pad)
      fwrite(&paddata, 1, 1, gpoutfile);
}

static void CGM_write_int_record(class, cgm_id, numbytes, data)
int class, cgm_id, numbytes, *data;
{
    int i;
    ((void) (((numbytes & 1) == 0) ? 0 : (__assert_fail ("(numbytes & 1) == 0", "term/cgm.trm", 576, __PRETTY_FUNCTION__), 0)));
    CGM_write_code(class, cgm_id, numbytes);
    numbytes >>= 1;
    for (i = 0; i < numbytes; i++)
        CGM_write_int(data[i]);
}

static void CGM_write_mixed_record(class, cgm_id, numint, int_data,
                                   numchar, char_data)
int class, cgm_id, numint, *int_data, numchar;
char *char_data;
{
    int i, pad, length;
    static unsigned char paddata = 0;
    static unsigned char flag = 0xff;
    char short_len;

    pad = 0;
    length = numchar + 1;
    if (numchar >= 255)
        length += 2;
    if (length & 1)
        pad = 1;

    CGM_write_code(class, cgm_id, numint * 2 + length);

    for (i = 0; i < numint; i++)
        CGM_write_int(int_data[i]);

    if (numchar < 255) {
        short_len = (char)numchar;
        fwrite(&short_len, 1, 1, gpoutfile);
    } else {
        fwrite(&flag, 1, 1, gpoutfile);
        CGM_write_int(numchar);
    }
    fwrite(char_data, 1, numchar, gpoutfile);
    if(pad)
      fwrite(&paddata, 1, 1, gpoutfile);
}
# 627 "term/cgm.trm"
static void CGM_write_code(class, cgm_id, length)
int class, cgm_id, length;
{
    unsigned code;

    ((void) (((0 <= class) &&(class <16)) ? 0 : (__assert_fail ("(0 <= class) &&(class <16)", "term/cgm.trm", 632, __PRETTY_FUNCTION__), 0)));
    ((void) (((0 <= cgm_id) && (cgm_id < 128)) ? 0 : (__assert_fail ("(0 <= cgm_id) && (cgm_id < 128)", "term/cgm.trm", 633, __PRETTY_FUNCTION__), 0)));
    ((void) ((0 <= length) ? 0 : (__assert_fail ("0 <= length", "term/cgm.trm", 634, __PRETTY_FUNCTION__), 0)));
    if (length < 31) {
        code = ((class &0x0f) <<12) |
            ((cgm_id & 0x7f) << 5) |
            ((length & 0x1f));
        CGM_write_int(code);
    } else {
        code = ((class &0x0f) <<12) |
            ((cgm_id & 0x7f) << 5) |
            0x1f;
        CGM_write_int(code);
        CGM_write_int(length);
    }
}

static void CGM_write_int(value)
int value;
{
    union {
        short s;
        char c[2];
    } u;


    ((void) ((-32768 <= value && value <= 32767) ? 0 : (__assert_fail ("-32768 <= value && value <= 32767", "term/cgm.trm", 658, __PRETTY_FUNCTION__), 0)));


    u.c[0] = (value >> 8) & 255;
    u.c[1] = value & 255;

    fwrite(&u.s, 1, 2, gpoutfile);
}






static void CGM_dashed_vector(ux, uy)
unsigned int ux, uy;
{
    int xa, ya;
    int dx, dy, adx, ady;
    int dist;


    long remain;


    ((void) ((ux < term->xmax && uy < term->ymax) ? 0 : (__assert_fail ("ux < term->xmax && uy < term->ymax", "term/cgm.trm", 683, __PRETTY_FUNCTION__), 0)));

    dx = (ux - cgm_posx);
    dy = (uy - cgm_posy);
    adx = abs(dx);
    ady = abs(dy * 10);





    if (10 * adx < ady)
        dist = (ady / 2 + 25 * adx / ady * adx / 6 * 5) / 5;
    else {
        if (adx == 0)
            return;
        dist = (adx * 10 + (ady / 24) * (ady / adx)) / 10;
    }
    remain = dist;
    xa = cgm_posx;
    ya = cgm_posy;
    while (remain > cgm_step) {
        remain -= cgm_step;
        if (cgm_step_index & 1)
            CGM_solid_vector((int) (ux - (remain * dx) / dist),
                             (int) (uy - (remain * dy) / dist));
        else {
            xa = (int) (ux - (remain * dx) / dist);
            ya = (int) (uy - (remain * dy) / dist);
            CGM_move(xa, ya);
        }
        if (++cgm_step_index >= 8)
            cgm_step_index = 0;
        cgm_step = cgm_step_sizes[cgm_step_index];
    }
    if (cgm_step_index & 1)
        CGM_solid_vector(ux, uy);
    else
        CGM_move(ux, uy);
    cgm_step -= (int) remain;
}

static void CGM_solid_vector(ux, uy)
unsigned int ux, uy;
{
    ((void) ((ux < term->xmax && uy < term->ymax) ? 0 : (__assert_fail ("ux < term->xmax && uy < term->ymax", "term/cgm.trm", 728, __PRETTY_FUNCTION__), 0)));
    if (ux == cgm_posx && uy == cgm_posy)
        return;
    if (cgm_coords > 104 - 2) {
        CGM_flush_polyline();
        cgm_polyline[cgm_coords++] = cgm_posx;
        cgm_polyline[cgm_coords++] = cgm_posy + (32767/180);
    } else if (cgm_coords == 0) {
        cgm_polyline[cgm_coords++] = cgm_posx;
        cgm_polyline[cgm_coords++] = cgm_posy + (32767/180);
    }
    cgm_polyline[cgm_coords++] = ux;
    cgm_polyline[cgm_coords++] = uy + (32767/180);
    cgm_posx = ux;
    cgm_posy = uy;
}

static void CGM_put_text(x, y, str)
unsigned int x, y;
char str[];
{
    static int where[3] = { 0, 0, 1 };
    int data[4];
    char *s = str;

    while (*s)
        if (!(__ctype_b[(int) (((int) *s++))] & (unsigned short int) _ISspace))
            goto showit;
    return;

  showit:
    if (cgm_vert_text != cgm_vert_text_requested) {
        cgm_vert_text = cgm_vert_text_requested;
        if (cgm_vert_text) {
            data[0] = -term->v_char;
            data[1] = data[2] = 0;
            data[3] = term->v_char;
        } else {
            data[1] = data[2] = term->v_char;
            data[0] = data[3] = 0;
        }
        CGM_write_int_record(5, 16, 8, data);
    }
    CGM_flush_polyline();
    where[0] = x;
    where[1] = y + (32767/180);
    CGM_write_mixed_record(4, 4, 3, where, strlen(str), str);

    cgm_posx = cgm_posy = -2000;
}

static int CGM_text_angle(ang)
int ang;
{
    if (cgm_rotate) {
        cgm_vert_text_requested = ang;
        return 1;
    }
    return ang ? 0 : 1;
}

static int CGM_justify_text(mode)
enum JUSTIFY mode;
{
    static int data[6] = { 1, 3, 0, 0, 0, 0 };

    switch (mode) {
    case LEFT:
        data[0] = 1;
        break;
    case CENTRE:
        data[0] = 2;
        break;
    case RIGHT:
        data[0] = 3;
        break;
    default:
        ((void) ((0) ? 0 : (__assert_fail ("0", "term/cgm.trm", 805, __PRETTY_FUNCTION__), 0)));
    }
    CGM_write_int_record(5, 18, 12, data);
    return (1);
}

static void CGM_reset()
{
    cgm_posx = cgm_posy = 0;
}

static void CGM_point(x, y, number)
unsigned int x, y;
int number;
{
    int old_dashtype;

    if (number < 0) {
        CGM_move(x, y);
        CGM_solid_vector(x + 1, y);
        return;
    }
    number %= 8;

    CGM_flush_polyline();
    old_dashtype = cgm_dashtype;
    CGM_dashtype(0);

    switch (number) {
    case 0:
        CGM_move(x - cgm_tic, y);
        CGM_solid_vector(x, y - cgm_tic);
        CGM_solid_vector(x + cgm_tic, y);
        CGM_solid_vector(x, y + cgm_tic);
        CGM_flush_polygon();
        break;
    case 1:
        CGM_move(x - cgm_tic, y);
        CGM_solid_vector(x + cgm_tic, y);
        CGM_move(x, y - cgm_tic);
        CGM_solid_vector(x, y + cgm_tic);
        break;
    case 2:
        CGM_move(x - cgm_tic707, y - cgm_tic707);
        CGM_solid_vector(x + cgm_tic707, y - cgm_tic707);
        CGM_solid_vector(x + cgm_tic707, y + cgm_tic707);
        CGM_solid_vector(x - cgm_tic707, y + cgm_tic707);
        CGM_flush_polygon();
        break;
    case 3:
        CGM_move(x - cgm_tic707, y - cgm_tic707);
        CGM_solid_vector(x + cgm_tic707, y + cgm_tic707);
        CGM_move(x - cgm_tic707, y + cgm_tic707);
        CGM_solid_vector(x + cgm_tic707, y - cgm_tic707);
        break;
    case 4:
        CGM_move(x, y + cgm_tic1241);
        CGM_solid_vector(x - cgm_tic1077, y - cgm_tic621);
        CGM_solid_vector(x + cgm_tic1077, y - cgm_tic621);
        CGM_flush_polygon();
        break;
    case 5:
        CGM_move(x, y - cgm_tic);
        CGM_solid_vector(x, y + cgm_tic);
        CGM_move(x + cgm_tic866, y - cgm_tic500);
        CGM_solid_vector(x - cgm_tic866, y + cgm_tic500);
        CGM_move(x + cgm_tic866, y + cgm_tic500);
        CGM_solid_vector(x - cgm_tic866, y - cgm_tic500);
        break;
    case 6:
        CGM_move(x, y - cgm_tic1241);
        CGM_solid_vector(x - cgm_tic1077, y + cgm_tic621);
        CGM_solid_vector(x + cgm_tic1077, y + cgm_tic621);
        CGM_flush_polygon();
        break;
    case 7:



        CGM_move(x, y - cgm_tic);
        CGM_solid_vector(x + cgm_tic500, y - cgm_tic866);
        CGM_solid_vector(x + cgm_tic866, y - cgm_tic500);
        CGM_solid_vector(x + cgm_tic, y);
        CGM_solid_vector(x + cgm_tic866, y + cgm_tic500);
        CGM_solid_vector(x + cgm_tic500, y + cgm_tic866);
        CGM_solid_vector(x, y + cgm_tic);
        CGM_solid_vector(x - cgm_tic500, y + cgm_tic866);
        CGM_solid_vector(x - cgm_tic866, y + cgm_tic500);
        CGM_solid_vector(x - cgm_tic, y);
        CGM_solid_vector(x - cgm_tic866, y - cgm_tic500);
        CGM_solid_vector(x - cgm_tic500, y - cgm_tic866);
        CGM_flush_polygon();
        break;
    }
    CGM_dashtype(old_dashtype);
}


static void CGM_set_pointsize(size)
double size;
{
# 924 "term/cgm.trm"
    cgm_tic = (size * term->h_tic / 2);
    cgm_tic707 = cgm_tic * 12 / 17;
    cgm_tic866 = cgm_tic * 13 / 15;
    cgm_tic500 = cgm_tic / 2;
    cgm_tic1241 = cgm_tic * 36 / 29;
    cgm_tic1077 = cgm_tic * 14 / 13;
    cgm_tic621 = cgm_tic * 18 / 29;
}

static void CGM_flush_polygon()
{
    if (cgm_coords == 0)
        return;
    CGM_write_int_record(4, 7, cgm_coords * 2, cgm_polyline);
    cgm_coords = 0;
}

static void CGM_options()
{
    (__extension__ (__builtin_constant_p ("Arial Bold") ? (((size_t)(const void *)(("Arial Bold") + 1) - (size_t)(const void *)("Arial Bold") == 1) && strlen ("Arial Bold") + 1 <= 8 ? __strcpy_small (cgm_font, __extension__ (((__const unsigned char *) (__const char *) ("Arial Bold"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("Arial Bold"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("Arial Bold"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("Arial Bold"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("Arial Bold"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("Arial Bold"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("Arial Bold"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("Arial Bold"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("Arial Bold"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("Arial Bold"))[4 + 2]) << 8 |!
 ((__const unsigned char *) (__const char *) ("Arial Bold"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("Arial Bold"))[4]), strlen ("Arial Bold") + 1) : (char *) memcpy (cgm_font, "Arial Bold", strlen ("Arial Bold") + 1)) : strcpy (cgm_font, "Arial Bold")));
    cgm_fontsize = 10;
    term->v_char = (unsigned int) (cgm_fontsize * ((term->xmax + (32767/180))/cgm_plotwidth));
    term->h_char = (unsigned int) (cgm_fontsize * ((term->xmax + (32767/180))/cgm_plotwidth) * 5 / 9);
    cgm_linewidth_pt = 1;
    cgm_monochrome = 0;
    cgm_plotwidth = 6 * 72;
    cgm_portrait = 0;
    cgm_rotate = 1;
    cgm_dashed = 1;
    cgm_winword6_mode = 0;
    while (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "p$ortrait")) {
            cgm_portrait = 1;
            c_token++;
            continue;
        }
        if (almost_equals(c_token, "la$ndscape")) {
            cgm_portrait = 0;
            c_token++;
            continue;
        }
        if (almost_equals(c_token, "de$fault")) {
            (__extension__ (__builtin_constant_p ("Arial Bold") ? (((size_t)(const void *)(("Arial Bold") + 1) - (size_t)(const void *)("Arial Bold") == 1) && strlen ("Arial Bold") + 1 <= 8 ? __strcpy_small (cgm_font, __extension__ (((__const unsigned char *) (__const char *) ("Arial Bold"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("Arial Bold"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("Arial Bold"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("Arial Bold"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("Arial Bold"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("Arial Bold"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("Arial Bold"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("Arial Bold"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("Arial Bold"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("Arial Bold"))[4 + 2]!
) << 8 | ((__const unsigned char *) (__const char *) ("Arial Bold"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("Arial Bold"))[4]), strlen ("Arial Bold") + 1) : (char *) memcpy (cgm_font, "Arial Bold", strlen ("Arial Bold") + 1)) : strcpy (cgm_font, "Arial Bold")));
            cgm_fontsize = 10;
            term->v_char = (unsigned int) (cgm_fontsize * ((term->xmax + (32767/180))/cgm_plotwidth));
            term->h_char = (unsigned int) (cgm_fontsize * ((term->xmax + (32767/180))/cgm_plotwidth) * 5 / 9);
            cgm_linewidth_pt = 1;
            cgm_monochrome = 0;
            cgm_plotwidth = 6 * 72;
            cgm_portrait = 0;
            cgm_rotate = 1;
            cgm_dashed = 1;
            cgm_winword6_mode = 0;
            c_token++;
            continue;
        }
        if (almost_equals(c_token, "w$inword6")) {
            cgm_winword6_mode = 1;
            c_token++;
            continue;
        }
        if (almost_equals(c_token, "m$onochrome")) {
            cgm_monochrome = 1;
            c_token++;
            continue;
        }
        if (almost_equals(c_token, "c$olor")
            || almost_equals(c_token, "c$olour")) {
            cgm_monochrome = 0;
            c_token++;
            continue;
        }
        if (almost_equals(c_token, "r$otate")) {
            cgm_rotate = 1;
            c_token++;
            continue;
        }
        if (almost_equals(c_token, "nor$otate")) {
            cgm_rotate = 0;
            c_token++;
            continue;
        }
        if (almost_equals(c_token, "da$shed")) {
            cgm_dashed = 1;
            c_token++;
            continue;
        }
        if (almost_equals(c_token, "s$olid")) {
            cgm_dashed = 0;
            c_token++;
            continue;
        }
        if (almost_equals(c_token, "li$newidth")) {
            c_token++;
            if (!(c_token >= num_tokens || equals(c_token,";"))) {
                struct value a;
                cgm_linewidth_pt = (unsigned int) real(const_express(&a));
                if (cgm_linewidth_pt > 10000) {
                    fputs("gnuplot(cgm.trm): linewidth out of range\n", stderr);
                    cgm_linewidth_pt = 1;
                }
            }
            continue;
        }
        if (almost_equals(c_token, "wid$th")) {
            c_token++;
            if (!(c_token >= num_tokens || equals(c_token,";"))) {
                struct value a;
                cgm_plotwidth = (int) real(const_express(&a));
                if (cgm_plotwidth < 0 || cgm_plotwidth > 10000) {
                    fputs("gnuplot(cgm.trm): width out of range\n", stderr);
                    cgm_plotwidth = 6 * 72;
                }
            }
            continue;
        }
        break;
    }

    if (!(c_token >= num_tokens || equals(c_token,";")) && isstring(c_token)) {
        quote_str(cgm_font, c_token, 50);
        if (CGM_find_font(cgm_font, strlen(cgm_font)) == 0) {

            int n;
            n = strlen(cgm_font);
            if (n + 1 <= sizeof(cgm_font_data) && n <= 255) {
                cgm_font_data[0] = n;
                (__extension__ (__builtin_constant_p (cgm_font) && __builtin_constant_p (n) ? (strlen (cgm_font) + 1 >= ((size_t) (n)) ? (char *) memcpy (cgm_font_data + 1, cgm_font, n) : strncpy (cgm_font_data + 1, cgm_font, n)) : strncpy (cgm_font_data + 1, cgm_font, n)));
                cgm_font_data[n + 1] = 0;
            }
        }
        c_token++;
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {

        struct value a;
        cgm_fontsize = (int) real(const_express(&a));
        term->v_char = (unsigned int) (cgm_fontsize * ((term->xmax + (32767/180))/cgm_plotwidth));
        term->h_char = (unsigned int) (cgm_fontsize * ((term->xmax + (32767/180))/cgm_plotwidth) * 5 / 9);
    }
    if (cgm_portrait) {
        term->xmax = 32767/18*13 - (32767/180);
        term->ymax = 32767 - (32767/180);
    } else {
        term->xmax = 32767 - (32767/180);
        term->ymax = 32767/18*13 - (32767/180);
    }

    sprintf(default_font, "%s,%d", cgm_font, cgm_fontsize);

    sprintf(term_options, "%s %s %s %s %s width %d linewidth %d \"%s\" %d",
            cgm_portrait ? "portrait" : "landscape",
            cgm_monochrome ? "monochrome" : "color",
            cgm_rotate ? "rotate" : "norotate",
            cgm_dashed ? "dashed" : "solid",
            cgm_winword6_mode ? "winword6" : "",
            cgm_plotwidth,
            cgm_linewidth_pt,
            cgm_font, cgm_fontsize);
}
# 261 "term.h" 2


# 1 "term/corel.trm" 1
# 28 "term/corel.trm"
# 1 "term/driver.h" 1
# 29 "term/corel.trm" 2






static void COREL_options (void);
static void COREL_init (void);
static void COREL_graphics (void);
static void COREL_text (void);
static void COREL_reset (void);
static void COREL_linetype (int linetype);
static void COREL_move (unsigned int x, unsigned int y);
static void COREL_vector (unsigned int x, unsigned int y);
static void COREL_put_text (unsigned int x, unsigned int y, char *str);

static int COREL_text_angle (int ang);
static int COREL_justify_text (enum JUSTIFY mode);
# 59 "term/corel.trm"
char corel_font[50 + 1] = "SwitzerlandLight";
int corel_fontsize = 22;
TBOOLEAN corel_color = 0;
TBOOLEAN corel_stroke = 0;
int corel_path_count = 0;
int corel_ang = 0;
enum JUSTIFY corel_justify = LEFT;
# 74 "term/corel.trm"
unsigned int corel_xmax = 5960;
unsigned int corel_ymax = 7200;
float corel_lw = (1.2*(10.0));

static void COREL_options()
{
    struct value a;

    if (!(c_token >= num_tokens || equals(c_token,";")) && almost_equals(c_token, "def$ault")) {
        corel_color = 0;
        (__extension__ (__builtin_constant_p ("SwitzerlandLight") ? (((size_t)(const void *)(("SwitzerlandLight") + 1) - (size_t)(const void *)("SwitzerlandLight") == 1) && strlen ("SwitzerlandLight") + 1 <= 8 ? __strcpy_small (corel_font, __extension__ (((__const unsigned char *) (__const char *) ("SwitzerlandLight"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("SwitzerlandLight"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("SwitzerlandLight"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("SwitzerlandLight"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("SwitzerlandLight"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("SwitzerlandLight"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("SwitzerlandLight"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("SwitzerlandLight"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("SwitzerlandLight"))[4 + !
3] << 8 | ((__const unsigned char *) (__const char *) ("SwitzerlandLight"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("SwitzerlandLight"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("SwitzerlandLight"))[4]), strlen ("SwitzerlandLight") + 1) : (char *) memcpy (corel_font, "SwitzerlandLight", strlen ("SwitzerlandLight") + 1)) : strcpy (corel_font, "SwitzerlandLight")));
        corel_fontsize = 22;
        corel_lw = (1.2*(10.0));
        corel_xmax = 5960;
        corel_ymax = 7200;
        c_token++;
    }
    if (!(c_token >= num_tokens || equals(c_token,";")) && almost_equals(c_token, "mono$chrome")) {
        corel_color = 0;
        c_token++;
    } else if (!(c_token >= num_tokens || equals(c_token,";")) && (almost_equals(c_token, "color$")
                                   || almost_equals(c_token, "colour$"))) {
        corel_color = 1;
        c_token++;
    }
    if (!(c_token >= num_tokens || equals(c_token,";")) && isstring(c_token)) {
        quote_str(corel_font, c_token, 50);
        c_token++;
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {

        corel_fontsize = (int) real(const_express(&a));
        c_token++;
        term->v_char = (unsigned int) (corel_fontsize * (10.0));
        term->h_char = (unsigned int) (corel_fontsize * (10.0) * 6 / 10);
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        corel_xmax = (unsigned int) (real(const_express(&a)) * 720);
        c_token++;
        if (!(c_token >= num_tokens || equals(c_token,";"))) {
            corel_ymax = (unsigned int) (real(const_express(&a)) * 720);
            c_token++;
        }
        term->xmax = corel_xmax;
        term->ymax = corel_ymax;
        term->v_tic = corel_ymax / 80;
        term->h_tic = corel_ymax / 80;
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        corel_lw = real(const_express(&a)) * (10.0);
        c_token++;
    }
    sprintf(term_options, "%s \"%s\" %d,%0.1f,%0.1f,%0.1f",
            corel_color ? "color" : "monochrome", corel_font,
            corel_fontsize, corel_xmax / 720.0, corel_ymax / 720.0,
            corel_lw / (10.0));
}

static void COREL_init()
{
    fprintf(gpoutfile, "%%!PS-Adobe-2.0 EPSF-1.2\n%%%%BoundingBox: %d %d %d %d\n%%%%TemplateBox: %d %d %d %d\n%%%%EndComments\n%%%%EndProlog\n%%%%BeginSetup\n%%%%EndSetup\n",






            0, 0,
            (int) ((corel_xmax) / (10.0) + 0.5 + 0),
            (int) ((corel_ymax) / (10.0) + 0.5 + 0),
            0, 0,
            (int) ((corel_xmax) / (10.0) + 0.5 + 0),
            (int) ((corel_ymax) / (10.0) + 0.5 + 0));
}


static void COREL_graphics()
{
    corel_path_count = 0;
    corel_stroke = 0;
}


static void COREL_text()
{
    if (corel_stroke) {
        fputs("S\n", gpoutfile);
        corel_stroke = 0;
    }
    corel_path_count = 0;
}


static void COREL_reset()
{
    fputs("%%%%Trailer\n", gpoutfile);
}


static void COREL_linetype(linetype)
int linetype;
{
    if (corel_stroke) {
        fputs("S\n", gpoutfile);
        corel_stroke = 0;
    }
    switch (linetype) {
    case -2:
        fprintf(gpoutfile, "%.2f w\n", corel_lw / (10.0));
        if (corel_color) {
            fputs("0 0 0 1 K\n", gpoutfile);
        } else {
            fputs("[] 0 d\n0 j\n0 G\n", gpoutfile);


        }
        break;

    case -1:
        fprintf(gpoutfile, "%.2f w\n", corel_lw / (10.0));
        if (corel_color) {
            fputs("0 0 0 1 K\n", gpoutfile);
        } else {
            fputs("[1 2] 0 d\n0 j\n0 G\n", gpoutfile);


        }
        break;

    case 0:
        fprintf(gpoutfile, "%.2f w\n", corel_lw / (10.0));
        if (corel_color) {
            fputs("1 0 1 0 K\n", gpoutfile);
        } else {
            fputs("[] 0 d\n2 j\n0 G\n", gpoutfile);


        }
        break;

    case 1:
        fprintf(gpoutfile, "%.2f w\n", corel_lw / (10.0));
        if (corel_color) {
            fputs("1 1 0 0 K\n", gpoutfile);
        } else {
            fputs("[4 2] 0 d\n2 j\n0 G\n", gpoutfile);


        }
        break;

    case 2:
        fprintf(gpoutfile, "%.2f w\n", corel_lw / (10.0));
        if (corel_color) {
            fputs("0 1 1 0 K\n", gpoutfile);
        } else {
            fputs("[2 3] 0 d\n2 j\n0 G\n", gpoutfile);


        }
        break;

    case 3:
        fprintf(gpoutfile, "%.2f w\n", corel_lw / (10.0));
        if (corel_color) {
            fputs("0 1 0 0 K\n", gpoutfile);
        } else {
            fputs("[1 1.5] 0 d\n2 j\n0 G\n", gpoutfile);


        }
        break;

    case 4:
        fprintf(gpoutfile, "%f w\n", corel_lw / (10.0));
        if (corel_color) {
            fputs("1 0 0 0 K\n", gpoutfile);
        } else {
            fputs("[5 2 1 2] 0 d\n2 j\n0 G\n", gpoutfile);


        }
        break;

    case 5:
        fprintf(gpoutfile, "%.2f w\n", corel_lw / (10.0));
        if (corel_color) {
            fputs("0 0 1 0 K\n", gpoutfile);
        } else {
            fputs("[4 3 1 3] 0 d\n2 j\n0 G\n", gpoutfile);


        }
        break;

    case 6:
        fprintf(gpoutfile, "%.2f w\n", corel_lw / (10.0));
        if (corel_color) {
            fputs("0 0 0 1 K\n", gpoutfile);
        } else {
            fputs("[2 2 2 4] 0 d\n2 j\n0 G\n", gpoutfile);


        }
        break;

    case 7:
        fprintf(gpoutfile, "%.2f w\n", corel_lw / (10.0));
        if (corel_color) {
            fputs("0 0.7 1 0 K\n", gpoutfile);
        } else {
            fputs("[2 2 2 2 2 4] 0 d\n2 j\n0 G\n", gpoutfile);


        }
        break;

    case 8:
        fprintf(gpoutfile, "%.2f w\n", corel_lw / (10.0));
        if (corel_color) {
            fputs("0.5 0.5 0.5 0 K\n", gpoutfile);
        } else {
            fputs("[2 2 2 2 2 2 2 4] 0 d\n2 j\n0 G\n", gpoutfile);


        }
        break;
    }
    corel_path_count = 0;
}


static void COREL_move(x, y)
unsigned int x, y;
{
    if (corel_stroke)
        fputs("S\n", gpoutfile);
    fprintf(gpoutfile, "%0.2f %0.2f m\n", x / (10.0), y / (10.0));
    corel_path_count += 1;
    corel_stroke = 1;
}


static void COREL_vector(x, y)
unsigned int x, y;
{
    fprintf(gpoutfile, "%.2f %.2f l\n", x / (10.0), y / (10.0));
    corel_path_count += 1;
    corel_stroke = 1;
    if (corel_path_count >= 400) {
        fprintf(gpoutfile, "S\n%.2f %.2f m\n", x / (10.0), y / (10.0));
        corel_path_count = 0;
    }
}


static void COREL_put_text(x, y, str)
unsigned int x, y;
char *str;
{
    char ch;
    if (corel_stroke) {
        fputs("S\n", gpoutfile);
        corel_stroke = 0;
    }
    switch (corel_justify) {
    case LEFT:
        fprintf(gpoutfile, "/_%s %d %d 0 0 z\n",
                corel_font, corel_fontsize, corel_fontsize);
        break;
    case CENTRE:
        fprintf(gpoutfile, "/_%s %d %d 0 1 z\n",
                corel_font, corel_fontsize, corel_fontsize);
        break;
    case RIGHT:
        fprintf(gpoutfile, "/_%s %d %d 0 2 z\n",
                corel_font, corel_fontsize, corel_fontsize);
        break;
    }
    if (corel_ang == 0) {
        fprintf(gpoutfile, "[1 0 0 1 %.2f %.2f]e\n0 g\n",
                x / (10.0), y / (10.0) - corel_fontsize / 3.0);
    } else {
        fprintf(gpoutfile, "[0 1 -1 0 %.2f %.2f]e\n0 g\n",
                x / (10.0) - corel_fontsize / 3.0, y / (10.0));
    }

    _IO_putc ('(', gpoutfile);
    ch = *str++;
    while (ch != ('\0')) {
        if ((ch == '(') || (ch == ')') || (ch == '\\'))
            _IO_putc ('\\', gpoutfile);
        _IO_putc (ch, gpoutfile);
        ch = *str++;
    }
    fputs(")t\nT\n", gpoutfile);
    corel_path_count = 0;
}

static int COREL_text_angle(ang)
int ang;
{
    corel_ang = ang;
    return 1;
}

static int COREL_justify_text(mode)
enum JUSTIFY mode;
{
    corel_justify = mode;
    return 1;
}
# 264 "term.h" 2







# 1 "term/dumb.trm" 1
# 51 "term/dumb.trm"
# 1 "term/driver.h" 1
# 52 "term/dumb.trm" 2






static void DUMB_options (void);
static void DUMB_init (void);
static void DUMB_graphics (void);
static void DUMB_text (void);
static void DUMB_reset (void);
static void DUMB_linetype (int linetype);
static void DUMB_move (unsigned int x, unsigned int y);
static void DUMB_point (unsigned int x, unsigned int y, int point);

static void DUMB_vector (unsigned int x, unsigned int y);
static void DUMB_put_text (unsigned int x, unsigned int y, char *str);

static void DUMB_arrow (unsigned int sx, unsigned int sy, unsigned int ex, unsigned int ey, int head);
# 85 "term/dumb.trm"
static char *dumb_matrix = ((void *)0);

static char *dumb_priority = ((void *)0);

static char dumb_pen;

static int dumb_x;

static int dumb_y;
static int dumb_xmax = 79;
static int dumb_ymax = 24;
static int dumb_feed = 1;



static void dumb_set_pixel (int x, int y, int v, int p);


static void dumb_set_pixel(x, y, v, p)
int x, y, v, p;
{
    if ((unsigned) x <= dumb_xmax &&
        (unsigned) y <= dumb_ymax &&
        p > dumb_priority[dumb_xmax * y + x]) {
        dumb_matrix[dumb_xmax * y + x] = v;
        dumb_priority[dumb_xmax * y + x] = p;
    }
}


static void DUMB_options()
{
    int x, y;
    struct value a;

    if (almost_equals(c_token, "f$eed"))
        ++c_token, dumb_feed = 1;
    else if (almost_equals(c_token, "nof$eed"))
        ++c_token, dumb_feed = 0;

    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        x = (int) real(const_express(&a));
        if (!(c_token >= num_tokens || equals(c_token,";"))) {
            y = (int) real(const_express(&a));
            dumb_xmax = term->xmax = x;
            dumb_ymax = term->ymax = y;
        }
    }
    sprintf(term_options, "%sfeed %d %d",
            dumb_feed ? "" : "no", dumb_xmax, dumb_ymax);
}


static void DUMB_init()
{
    if (dumb_matrix)
        free(dumb_matrix);

    dumb_matrix = gp_alloc((unsigned long) dumb_xmax * dumb_ymax * 2, "dumb terminal");

    dumb_priority = dumb_matrix + dumb_xmax * dumb_ymax;
}


static void DUMB_graphics()
{
    int i;
    char *pm = dumb_matrix, *pp = dumb_priority;

    for (i = dumb_xmax * dumb_ymax; i > 0; i--) {
        *pm++ = ' ';
        *pp++ = 0;
    }
}


static void DUMB_text()
{
    int x, y, l;

    _IO_putc ('\f', gpoutfile);
    for (y = dumb_ymax - 1; y >= 0; y--) {
        for (l = dumb_xmax; l > 0 && dumb_matrix[dumb_xmax*(y)+(l - 1)] == ' '; l--);
        for (x = 0; x < l; x++)
            _IO_putc (dumb_matrix[dumb_xmax*(y)+(x)], gpoutfile);
        if (dumb_feed || y > 0)
            _IO_putc ('\n', gpoutfile);
    }
    fflush(gpoutfile);
}


static void DUMB_reset()
{
    free(dumb_matrix);
    dumb_matrix = ((void *)0);
}


static void DUMB_linetype(linetype)
int linetype;
{
    static char pen_type[7] = { '*', '#', '$', '%', '@', '&', '=' };

    if (linetype == -2)
        dumb_pen = '\2';
    else if (linetype == -1)
        dumb_pen = '\1';
    else {
        linetype = linetype % 7;
        dumb_pen = pen_type[linetype];
    }
}


static void DUMB_move(x, y)
unsigned int x, y;
{
    dumb_x = x;
    dumb_y = y;
}


static void DUMB_point(x, y, point)
unsigned int x, y;
int point;
{
    dumb_set_pixel(x, y, point == -1 ? '.' : point % 26 + 'A', 4);
}


static void DUMB_vector(_x, _y)
unsigned int _x, _y;
{
    int x = _x;

    int y = _y;
    char pen, pen1;
    int priority;
    int delta;

    if (((y - dumb_y) >= 0 ? (y - dumb_y) : -(y - dumb_y)) > ((x - dumb_x) >= 0 ? (x - dumb_x) : -(x - dumb_x))) {
        switch (dumb_pen) {
        case '\1':
            pen = ':';
            pen1 = '+';
            priority = 1;
            break;

        case '\2':
            pen = '|';
            pen1 = '+';
            priority = 2;
            break;

        default:
            pen = dumb_pen;
            pen1 = dumb_pen;
            priority = 3;
            break;
        }
        dumb_set_pixel(dumb_x, dumb_y, pen1, priority);
        for (delta = 1; delta < ((y - dumb_y) >= 0 ? (y - dumb_y) : -(y - dumb_y)); delta++) {
            dumb_set_pixel(dumb_x + (int) ((double) (x - dumb_x) *
                                            delta / ((y - dumb_y) >= 0 ? (y - dumb_y) : -(y - dumb_y)) + 0.5),
                           dumb_y + delta * ((y - dumb_y) >= 0 ? 1 : -1), pen, priority);
        }
        dumb_set_pixel(x, y, pen1, priority);
    } else if (((x - dumb_x) >= 0 ? (x - dumb_x) : -(x - dumb_x)) > ((y - dumb_y) >= 0 ? (y - dumb_y) : -(y - dumb_y))) {
        switch (dumb_pen) {
        case '\1':
            pen = '.';
            pen1 = '+';
            priority = 1;
            break;

        case '\2':
            pen = '-';
            pen1 = '+';
            priority = 2;
            break;

        default:
            pen = dumb_pen;
            pen1 = dumb_pen;
            priority = 3;
            break;
        }
        dumb_set_pixel(dumb_x, dumb_y, pen1, priority);
        for (delta = 1; delta < ((x - dumb_x) >= 0 ? (x - dumb_x) : -(x - dumb_x)); delta++)
            dumb_set_pixel(dumb_x + delta * ((x - dumb_x) >= 0 ? 1 : -1),
                           dumb_y +
                           (int) ((double) (y - dumb_y) * delta / ((x - dumb_x) >= 0 ? (x - dumb_x) : -(x - dumb_x))
                                  + 0.5),
                           pen, priority);
        dumb_set_pixel(x, y, pen1, priority);
    } else {
        switch (dumb_pen) {
        case '\1':
            pen = '+';
            priority = 1;
            break;

        case '\2':
            pen = '+';
            priority = 2;
            break;

        default:
            pen = dumb_pen;
            priority = 3;
            break;
        }
        for (delta = 0; delta <= ((x - dumb_x) >= 0 ? (x - dumb_x) : -(x - dumb_x)); delta++)
            dumb_set_pixel(dumb_x + delta * ((x - dumb_x) >= 0 ? 1 : -1),
                           dumb_y + delta * ((y - dumb_y) >= 0 ? 1 : -1),
                           pen, priority);
    }
    dumb_x = x;
    dumb_y = y;
}


static void DUMB_put_text(x, y, str)
unsigned int x, y;
char *str;
{
    int length;

    length = strlen(str);
    if (x + length > dumb_xmax)
        x = ( (0) > (dumb_xmax - length) ? (0) : (dumb_xmax - length) );

    for (; x < dumb_xmax && *str; x++, str++)
        dumb_set_pixel(x, y, *str, 5);
}


static void DUMB_arrow(sx, sy, ex, ey, head)
unsigned int sx, sy, ex, ey;
int head;
{
    char saved_pen;
    char saved_x;
    char saved_y;

    saved_pen = dumb_pen;
    saved_x = dumb_x;
    saved_y = dumb_y;

    dumb_pen = '>';
    dumb_x = sx;
    dumb_y = sy;
    DUMB_vector(ex, ey);

    dumb_pen = saved_pen;
    dumb_x = saved_x;
    dumb_y = saved_y;
}
# 272 "term.h" 2


# 1 "term/dxf.trm" 1
# 55 "term/dxf.trm"
# 1 "term/driver.h" 1
# 56 "term/dxf.trm" 2






static void DXF_init (void);
static void DXF_graphics (void);
static void DXF_text (void);
static void DXF_linetype (int linetype);
static void DXF_move (unsigned int x, unsigned int y);
static void DXF_vector (unsigned int ux, unsigned int uy);
static void DXF_put_text (unsigned int x, unsigned int y, char str[]);

static int DXF_text_angle (int ang);
static int DXF_justify_text (enum JUSTIFY mode);
static void DXF_reset (void);
# 103 "term/dxf.trm"
static unsigned int DXF_posx;
static unsigned int DXF_posy;

static unsigned int dxf_linetype;
enum JUSTIFY dxf_justify = LEFT;
static float dxf_angle = 0.0;


static char *text_style = "STANDARD";






static char *layer_name[] ={ "0", "1", "2", "3", "4", "5", "6" };




static char *layer_colour[] = { "7", "1", "2", "3", "4", "5", "6" };

static char *layer_lines[] = { "CONTINUOUS", "DASHED", "HIDDEN", "CENTER",
                              "PHANTOM", "DOT", "DASHDOT" };

static TBOOLEAN vector_was_last = 0;

static void DXF_init()
{
    DXF_posx = DXF_posy = 0;
    dxf_linetype = 0;
    dxf_angle = 0.0;
    vector_was_last = 0;
}

static void DXF_graphics()
{
    register struct TERMENTRY *t = term;
    int i;
    static char dxfi1[] = "999\n%% GNUPLOT: dxf file for AutoCad\n  0\nSECTION\n  2\nHEADER\n  9\n$EXTMIN\n 10\n0.000\n 20\n0.000\n  9\n$EXTMAX\n 10\n%-6.3f\n 20\n%-6.3f\n  9\n$LIMMIN\n 10\n0.000\n 20\n0.000\n  9\n$LIMMAX\n 10\n%-6.3f\n 20\n%-6.3f\n  9\n$TEXTSTYLE\n  7\n%s\n  9\n$TEXTSIZE\n 40\n%-6.3f\n  9\n$PLINEWID\n 40\n%-6.4f\n  9\n$LTSCALE\n  40\n%-6.3f\n  9\n$COORDS\n 70\n  1\n  9\n$CELTYPE\n 6\nBYLAYER\n  9\n$CLAYER\n  8\n0\n  9\n$CECOLOR\n 62\n   %s\n  9\n$MENU\n  1\nacad\n  0\nENDSEC\n  0\nSECTION\n  2\nTABLES\n";
# 165 "term/dxf.trm"
    static char dxfi2[] = "0\nTABLE\n  2\nLTYPE\n 70\n    %d\n0\nLTYPE\n  2\nCONTINUOUS\n 70\n    64\n  3\nSolid line\n 72\n    65\n 73\n      0\n 40\n0.0\n  0\nLTYPE\n  2\nDASHED\n 70\n    64\n  3\n__ __ __ __ __ __ __ __ __ __ __ __ __ __ __\n 72\n    65\n 73\n     2\n 40\n0.75\n 49\n0.5\n 49\n-0.25\n  0\nLTYPE\n  2\nHIDDEN\n 70\n    64\n  3\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\n 72\n    65\n 73\n     2\n 40\n0.375\n 49\n0.25\n 49\n-0.125\n  0\nLTYPE\n  2\nCENTER\n 70\n    64\n  3\n____ _ ____ _ ____ _ ____ _ ____ _ ____ _ ____\n 72\n    65\n 73\n     4\n 40\n2.0\n 49\n1.25\n 49\n-0.25\n 49\n0.25\n 49\n-0.25\n  0\nLTYPE\n  2\nPHANTOM\n 70\n    64\n  3\n_____ _ _ _____ _ _ _____ _ _ _____ _ _ ____\n 72\n    65\n 73\n     6\n 40\n2.5\n 49\n1.25\n 49\n-0.25\n 49\n0.25\n 49\n-0.25\n 49\n0.25\n 49\n-0.25\n  0\nLTYPE\n  2\nDOT\n 70\n    64\n  3\n...............................................\n 72\n    65\n 73\n     2\n 40\n0.25\n 49\n0.0\n 49\n-0.25\n  0\nLTYPE\n  2\n!
DASHDOT\n 70\n    64\n  3\n__ . __ . __ . __ . __ . __ . __ . __ . __ . __\n 72\n    65\n 73\n     4\n 40\n1.0\n 49\n0.5\n 49\n-0.25\n 49\n0.0\n 49\n-0.25\n  0\nENDTAB\n";
# 192 "term/dxf.trm"
    fprintf(gpoutfile, dxfi1,
            t->xmax / 60.0, t->ymax / 60.0,
            t->xmax / 60.0, t->ymax / 60.0,
            text_style,
            (0.7 * (0.026 * (80.0 * 60.0))) / 60.0,
            0.0351,
            (double) 1,
            layer_colour[0]);

    fprintf(gpoutfile, dxfi2, 7);

    fprintf(gpoutfile, "  0\nTABLE\n  2\nLAYER\n 70\n   %-d\n", 7);
    for (i = 1; i <= 7; i++)
        fprintf(gpoutfile, "  0\nLAYER\n  2\n%s\n 70\n   64\n62\n   %s\n  6\n%s\n", layer_name[i - 1], layer_colour[i - 1], layer_lines[i - 1]);



    fputs("  0\nENDTAB\n0\nENDSEC\n  0\nSECTION\n  2\nBLOCKS\n  0\nENDSEC\n  0\nSECTION\n  2\nENTITIES\n",



          gpoutfile);
}

static void DXF_text()
{
    if (vector_was_last)
        fputs("  0\nSEQEND\n", gpoutfile);
    fputs("  0\nENDSEC\n  0\nEOF\n", gpoutfile);
}

static void DXF_linetype(linetype)
int linetype;
{
    linetype = ((linetype) >= 0 ? (linetype) : -(linetype));
    linetype = linetype % 7;
    dxf_linetype = linetype;
}

static void DXF_move(x, y)
unsigned int x, y;
{
    DXF_posx = x;
    DXF_posy = y;
    if (vector_was_last)
        fputs("  0\nSEQEND\n", gpoutfile);
    vector_was_last = 0;
    fprintf(gpoutfile, "  0\nPOLYLINE\n  8\n%s\n 66\n   1\n  6\n%s\n  0\nVERTEX\n  8\n%s\n  6\n%s\n 10\n%-6.3f\n 20\n%-6.3f\n 30\n0.000\n",





            layer_name[dxf_linetype],
            layer_lines[dxf_linetype],
            layer_name[dxf_linetype],
            layer_lines[dxf_linetype],
            DXF_posx / 60.0, DXF_posy / 60.0);

}

static void DXF_vector(ux, uy)
unsigned int ux, uy;
{
    DXF_posx = ux;
    DXF_posy = uy;
    vector_was_last = 1;

    fprintf(gpoutfile, "  0\nVERTEX\n  8\n%s\n  6\n%s\n  10\n%-6.3f\n  20\n%-6.3f\n  30\n0.000\n",



            layer_name[dxf_linetype],
            layer_lines[dxf_linetype],
            DXF_posx / 60.0, DXF_posy / 60.0);
}

static void DXF_put_text(x, y, str)
unsigned int x, y;
char str[];
{
    int stl;
    float xleftpos, yleftpos, xrightpos, yrightpos;


    xleftpos = yleftpos = xrightpos = yrightpos = 1.0;

    if (str[0] == ('\0'))
        return;

    stl = 0;
    while (str[stl] != ('\0'))
        ++stl;

    if (vector_was_last)
        fputs("  0\nSEQEND\n", gpoutfile);
    vector_was_last = 0;
    fprintf(gpoutfile, "  0\nTEXT\n  8\n%s\n", layer_name[0]);
    if (dxf_angle != 90.0) {
        switch (dxf_justify) {
        case LEFT:
            xleftpos = (float) x;
            yleftpos = (float) (y - (0.026 * (80.0 * 60.0)) / 4.0);
            xrightpos = (float) (x + stl * (0.7 * (0.014 * (120.0 * 60.0))));
            yrightpos = yleftpos;
            break;
        case RIGHT:
            xleftpos = (float) (x - stl * (0.7 * (0.014 * (120.0 * 60.0))));
            yleftpos = (float) (y - (0.026 * (80.0 * 60.0)) / 4.0);
            xrightpos = (float) x;
            yrightpos = yleftpos;
            break;
        case CENTRE:
            xleftpos = (float) (x - stl * (0.7 * (0.014 * (120.0 * 60.0))) / 2.0);
            yleftpos = (float) (y - (0.026 * (80.0 * 60.0)) / 4.0);
            xrightpos = (float) x;
            yrightpos = yleftpos;
            break;
        }
    } else {
        switch (dxf_justify) {
        case LEFT:
            xleftpos = (float) (x + (0.026 * (80.0 * 60.0)) / 4.0);
            yleftpos = (float) y;
            xrightpos = xleftpos;
            yrightpos = (float) (y + stl * (0.7 * (0.014 * (120.0 * 60.0))));
            break;
        case RIGHT:
            xleftpos = (float) (x + (0.026 * (80.0 * 60.0)) / 4.0);
            yleftpos = (float) (y - stl * (0.014 * (120.0 * 60.0)));
            xrightpos = xleftpos;
            yrightpos = (float) y;
            break;
        case CENTRE:
            xleftpos = (float) (x + (0.026 * (80.0 * 60.0)) / 4.0);
            yleftpos = (float) (y - stl * (0.7 * (0.014 * (120.0 * 60.0))) / 2.0);
            xrightpos = xleftpos;
            yrightpos = (float) y;
            break;
        }
    }

    fprintf(gpoutfile, " 10\n%-6.3f\n 20\n%-6.3f\n 30\n0.000\n 40\n%-6.3f\n  1\n%s\n 50\n%-6.3f\n  7\n%s\n",



            xleftpos / 60.0, yleftpos / 60.0,
            (0.7 * (0.026 * (80.0 * 60.0))) / 60.0, str, dxf_angle,
            text_style);

    if (dxf_justify != LEFT) {
        fprintf(gpoutfile, " 72\n%d\n 11\n%-6.3f\n 21\n%-6.3f\n 31\n0.000\n",

                dxf_justify,
                xrightpos / 60.0, yrightpos / 60.0);
    }
}

static int DXF_text_angle(ang)
int ang;
{
    dxf_angle = 0.0;
    if (ang == 1)
        dxf_angle = 90.0;
    return (1);
}

static int DXF_justify_text(mode)
enum JUSTIFY mode;
{
    dxf_justify = mode;
    return (1);
}

static void DXF_reset()
{
    DXF_posx = DXF_posy = 0;
}
# 275 "term.h" 2







# 1 "term/fig.trm" 1
# 63 "term/fig.trm"
# 1 "term/driver.h" 1
# 64 "term/fig.trm" 2






static void FIG_options (void);
static void FIG_init (void);
static void FIG_graphics (void);
static void FIG_text (void);
static void FIG_linetype (int linetype);
static void FIG_move (unsigned int x, unsigned int y);
static void FIG_vector (unsigned int ux, unsigned int uy);
static void FIG_arrow (unsigned int sx, unsigned int sy, unsigned int ex, unsigned int ey, TBOOLEAN head);
static void FIG_put_text (unsigned int x, unsigned int y, char *str);
static int FIG_justify_text (enum JUSTIFY mode);
static int FIG_text_angle (int ang);
static void FIG_pointsize (double arg_pointsize);
static void FIG_linewidth (double linewidth);
static void FIG_reset (void);
static void FIG_lpoint (unsigned int x, unsigned int y, int number);







# 1 "term/object.h" 1
# 49 "term/object.h"
typedef struct f_point {
    int x, y;
}
                F_point;

typedef struct f_pos {
    int x, y;
}
                F_pos;




typedef struct f_arrow {
    int type;
    int style;
    float thickness;
    float wid;
    float ht;
}
                F_arrow;

typedef struct f_ellipse {
    int tagged;
    int distrib;
    int type;




    int style;
    int thickness;
    int pen_color;
    int fill_color;
    int fill_style;
    int depth;
    float style_val;
    int pen_style;
    float angle;
    int direction;

    struct f_pos center;
    struct f_pos radiuses;
    struct f_pos start;
    struct f_pos end;
    struct f_ellipse *next;
}
                F_ellipse;



typedef struct f_arc {
    int tagged;
    int distrib;
    int type;




    int style;
    int thickness;
    int pen_color;
    int fill_color;
    int fill_style;
    int depth;
    int pen_style;
    struct f_arrow *for_arrow;
    struct f_arrow *back_arrow;

    int cap_style;
    float style_val;
    int direction;
    struct {
        float x, y;
    } center;
    struct f_pos point[3];
    struct f_arc *next;
}
                F_arc;







typedef struct f_pic {



    char file[4095];
    int subtype;





    int flipped;
    unsigned char *bitmap;
    int numcols;
    float hw_ratio;
    int size_x, size_y;
    struct f_pos bit_size;
    int color;
    int pix_rotation, pix_width, pix_height, pix_flipped;
}
                F_pic;

extern char EMPTY_PIC[];



typedef struct f_line {
    int tagged;
    int distrib;
    int type;





    int style;
    int thickness;
    int pen_color;
    int fill_color;
    int fill_style;
    int depth;
    int pen_style;
    struct f_arrow *for_arrow;
    struct f_arrow *back_arrow;

    int cap_style;



    struct f_point *points;
    int join_style;



    float style_val;
    int radius;
    struct f_pic *pic;
    struct f_line *next;
}
                F_line;

typedef struct f_text {
    int tagged;
    int distrib;
    int type;



    int font;

    int size;
    int color;
    int depth;
    float angle;

    int flags;





    int ascent;
    int length;
    int descent;
    int base_x;
    int base_y;
    int pen_style;
    char *cstring;
    struct f_text *next;
}
                F_text;
# 250 "term/object.h"
typedef struct f_control {
    float lx, ly, rx, ry;
    struct f_control *next;
}
                F_control;
# 263 "term/object.h"
typedef struct f_spline {
    int tagged;
    int distrib;
    int type;




    int style;
    int thickness;
    int pen_color;
    int fill_color;
    int fill_style;
    int depth;
    int pen_style;
    struct f_arrow *for_arrow;
    struct f_arrow *back_arrow;

    int cap_style;





    struct f_point *points;
    float style_val;
    struct f_control *controls;
    struct f_spline *next;
}
                F_spline;

typedef struct f_compound {
    int tagged;
    int distrib;
    struct f_pos nwcorner;
    struct f_pos secorner;
    struct f_line *lines;
    struct f_ellipse *ellipses;
    struct f_spline *splines;
    struct f_text *texts;
    struct f_arc *arcs;
    struct f_compound *compounds;
    struct f_compound *next;
}
                F_compound;

typedef struct f_linkinfo {
    struct f_line *line;
    struct f_point *endpt;
    struct f_point *prevpt;
    int two_pts;
    struct f_linkinfo *next;
}
                F_linkinfo;
# 381 "term/object.h"
extern F_compound objects;



extern F_line *cur_l, *new_l, *old_l;
extern F_arc *cur_a, *new_a, *old_a;
extern F_ellipse *cur_e, *new_e, *old_e;
extern F_text *cur_t, *new_t, *old_t;
extern F_spline *cur_s, *new_s, *old_s;
extern F_compound *cur_c, *new_c, *old_c;
extern F_point *first_point, *cur_point;
extern F_linkinfo *cur_links;




extern int cur_linewidth;
extern int cur_linestyle;
extern int cur_joinstyle;
extern int cur_capstyle;
extern float cur_dashlength;
extern float cur_dotgap;
extern float cur_styleval;
extern int cur_fillcolor, cur_pencolor;
extern int cur_fillstyle, cur_penstyle;
extern int cur_boxradius;
extern int cur_arrowmode;
extern int cur_arrowtype;
extern int cur_arctype;


extern int cur_fontsize;
extern int cur_latex_font;
extern int cur_ps_font;
extern int cur_textjust;
extern int cur_textflags;


extern float cur_elltextangle;
# 93 "term/fig.trm" 2
# 122 "term/fig.trm"
enum FIG_poly_stat {
    FIG_poly_new, FIG_poly_part
};

static int FIG_posx;
static int FIG_posy;
static long FIG_poly_vec_cnt;
static int FIG_depth = 10;
static int FIG_linedepth = 10;
static int FIG_thickness = 1;
static int FIG_default_thickness = 1;
static double FIG_current_pointsize = 1.;
static double FIG_current_linewidth = 1.;



static int FIG_poly_vec_max = 999;

static enum FIG_poly_stat FIG_polyvec_stat;
# 156 "term/fig.trm"
static F_point *FIG_points = ((void *)0);

static F_line FIG_line;
# 168 "term/fig.trm"
static int FIG_type;
static float FIG_spacing;
static int FIG_justify;
static float FIG_angle;
static int FIG_use_color = 0;
static int FIG_is_big = 0;
static int FIG_color = (-1);
static int FIG_xoff = ((1200)/4);
static int FIG_yoff = ((1200)/4);
static int FIG_font_s = (10);
static int FIG_portrait = 0;
static int FIG_inches = 0;

static void FIG_poly_clean (enum FIG_poly_stat fig_stat);





static void FIG_poly_clean(fig_stat)
enum FIG_poly_stat fig_stat;
{
    int i, j;
    if (fig_stat == FIG_poly_part) {
        fprintf(gpoutfile, "%d %d %d %d %d %d %d %d %d %9.3f %d %d %d %d %d %ld\n\t",
                2, FIG_line.type, FIG_line.style, FIG_line.thickness,
                FIG_line.pen_color, FIG_line.fill_color, FIG_line.depth,
                FIG_line.pen_style, FIG_line.fill_style, FIG_line.style_val,
                FIG_line.join_style, FIG_line.cap_style, FIG_line.radius,
                0, 0, FIG_poly_vec_cnt);

        j = 0;
        for (i = 0; i < FIG_poly_vec_cnt; i++) {
            fprintf(gpoutfile, " %d %d", FIG_points[i].x, FIG_points[i].y);
            if (j++ > 4 && i != FIG_poly_vec_cnt - 1) {
                fputs("\n\t", gpoutfile);
                j = 0;
            }
        }
        if (j != 0) {
            _IO_putc ('\n', gpoutfile);
        }



        free(FIG_points);
        FIG_points = ((void *)0);
    }
    FIG_polyvec_stat = FIG_poly_new;
}

static void FIG_options()
{
    static char *options_list =
    "expecting monochrome, color, small, big, portrait, landscape,\n \t inches, metric, size <number> <number>,  fontsize <number>,\n \t thickness <numer>, depth <number> or pointsmax <number>";



    int parse_error = 0;
    long temp_max;
    struct value a;
    unsigned int tmax_t;
    double xsize_t, ysize_t;

    FIG_use_color = 0;
    FIG_is_big = 0;
    FIG_portrait = 0;
    FIG_font_s = 0;
    FIG_default_thickness = 1;
    xsize_t = ysize_t = 0.;



    FIG_inches = 1;

    while (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "mo$nochrome")) {
            FIG_use_color = 0;
            c_token++;
        } else if (almost_equals(c_token, "c$olor")
                   || almost_equals(c_token, "c$olour")) {
            FIG_use_color = 1;
            c_token++;
        } else if (almost_equals(c_token, "sm$all")) {
            FIG_is_big = 0;
            c_token++;
        } else if (almost_equals(c_token, "b$ig")) {
            FIG_is_big = 1;
            c_token++;
        } else if (almost_equals(c_token, "in$ches")) {
            FIG_inches = 1;
            c_token++;
        } else if (almost_equals(c_token, "me$tric")) {
            FIG_inches = 0;
            c_token++;
        } else if (almost_equals(c_token, "por$trait")) {


            FIG_portrait = 1;
            c_token++;
        } else if (almost_equals(c_token, "l$andscape")) {
            FIG_portrait = 0;
            c_token++;
        } else if (almost_equals(c_token, "si$ze")) {
            c_token++;
            if ((c_token >= num_tokens || equals(c_token,";"))) {
                int_error("size: 2 numbers expected", c_token);
            } else {
                xsize_t = real(const_express(&a));
                if ((c_token >= num_tokens || equals(c_token,";"))) {
                    int_error("size: 2 numbers expected", c_token);
                    xsize_t = 0.;
                } else {
                    ysize_t = real(const_express(&a));
                }
                if (xsize_t < 2. || ysize_t < 2. || xsize_t > 99. || ysize_t > 99.) {
                    if (xsize_t != 0. || ysize_t != 0.)
                        int_error("size: out of range", c_token);
                    xsize_t = ysize_t = 0.;
                }
            }
        } else if (almost_equals(c_token, "f$ontsize")) {
            c_token++;
            if ((c_token >= num_tokens || equals(c_token,";"))) {
                int_error("fontsize: number expected", c_token);
            } else {
                FIG_font_s = (int) real(const_express(&a));
                if (FIG_font_s < 5 || FIG_font_s > 36) {
                    int_error("fontsize out of range", c_token - 1);
                    FIG_font_s = 0;
                }
            }
        } else if (almost_equals(c_token, "t$hickness")) {
            c_token++;
            if ((c_token >= num_tokens || equals(c_token,";"))) {
                int_error("thickness: number expected", c_token);
            } else {
                FIG_default_thickness = (int) real(const_express(&a));
                if (FIG_default_thickness < 1 || FIG_default_thickness > 10) {
                    int_error("thickness out of range", c_token - 1);
                    FIG_default_thickness = 1;
                }
            }
        } else if (almost_equals(c_token, "d$epth")) {
            c_token++;
            if ((c_token >= num_tokens || equals(c_token,";"))) {
                int_error("depth: number expected", c_token);
            } else {
                FIG_depth = (int) real(const_express(&a));
                if (FIG_depth < 0 || FIG_depth > 99) {
                    int_error("depth out of range", c_token - 1);
                    FIG_depth = 10;
                }
                FIG_linedepth = FIG_depth;
            }
        } else if (almost_equals(c_token, "poi$ntsmax")) {

            c_token++;
            if ((c_token >= num_tokens || equals(c_token,";"))) {
                int_error("max. points per polyline: number expected", c_token);
            } else {
                temp_max = (long) real(const_express(&a));

                if ((temp_max > 1) && (temp_max < (99999L + 2))) {

                    FIG_poly_vec_max = temp_max - 1;
                } else {
                    char t[128];

                    sprintf(t, "pointsmax: number out of range (2,%ld)",
                            (99999L + 1));
                    int_error(t, c_token);
                }
            }
        } else {
            parse_error = 1;
            int_error(options_list, c_token);
        }
    }

    sprintf(term_options, "%s %s %s %d %s %s %s %d %s %d %s %d",
            FIG_use_color ? "color" : "monochrome",
            FIG_is_big ? "big" : "small",
            "pointsmax",
            FIG_poly_vec_max + 1,
            FIG_portrait ? "portrait" : "landscape",
            FIG_inches ? "inches" : "metric",
            "fontsize", (FIG_font_s > 0 ? FIG_font_s :
                         (FIG_is_big ? (16) : (10))),
            "thickness", FIG_default_thickness, "depth", FIG_depth);
    if (xsize_t > 0. && ysize_t > 0.) {
        if (xsize_t - (int) xsize_t == 0. && ysize_t - (int) ysize_t == 0.)
            sprintf(term_options + strlen(term_options),
                    " size %d %d", (int) xsize_t, (int) ysize_t);
        else
            sprintf(term_options + strlen(term_options),
                    " size %f %f", xsize_t, ysize_t);
    }
    if (!FIG_is_big) {
        if (FIG_font_s == 0)
            FIG_font_s = (10);
        term->xmax = (5 * (1200));
        term->ymax = (3 * (1200));
        term->v_tic = (5*(1200)/80);
        term->h_tic = (5*(1200)/80);
        FIG_xoff = ((1200)/4);
        FIG_yoff = ((1200)/4);
    } else {
        if (FIG_font_s == 0)
            FIG_font_s = (16);
        term->xmax = (8 * (1200));
        term->ymax = (5 * (1200));
        term->v_tic = (7*(1200)/80);
        term->h_tic = (7*(1200)/80);
        FIG_xoff = ((1200)/2);
        FIG_yoff = ((1200)/2);
    }
    if (FIG_portrait) {
        tmax_t = term->xmax;
        term->xmax = term->ymax;
        term->ymax = tmax_t;
    }
    if (xsize_t > 0. && ysize_t > 0.) {
        if (FIG_inches) {
            term->xmax = (unsigned int) (xsize_t * (1200));
            term->ymax = (unsigned int) (ysize_t * (1200));
        } else {
            term->xmax = (unsigned int) (xsize_t / 2.54 * (1200));
            term->ymax = (unsigned int) (ysize_t / 2.54 * (1200));
        }
    }
    term->v_char = ((FIG_font_s)*(1200)/72*3/4);
    term->h_char = (((FIG_font_s)*(1200)/72*3/4)*6/10);
    FIG_thickness = FIG_default_thickness;
    if (parse_error) {
        int_error(options_list, c_token);
    }
}

static void FIG_init()
{
    FIG_posx = FIG_posy = 0;
    FIG_polyvec_stat = FIG_poly_new;
    FIG_linetype(-1);
    FIG_justify_text(LEFT);
    FIG_text_angle(0);

    FIG_line.tagged = (-1);
    FIG_line.distrib = (-1);
    FIG_line.type = 1;
    FIG_line.style = 0;
    FIG_line.thickness = FIG_thickness;
    FIG_line.fill_style = -1;
    FIG_line.depth = FIG_linedepth;
    FIG_line.pen_style = 0;
    FIG_line.for_arrow = ((void *)0);
    FIG_line.back_arrow = ((void *)0);
    FIG_line.cap_style = 0;
    FIG_line.join_style = 0;
    FIG_line.style_val = 0.0;
    FIG_line.radius = 0;
    FIG_line.pic = ((void *)0);
    FIG_line.next = ((void *)0);

    fprintf(gpoutfile, "%s\n%s\n%s\n%s\n%d %d\n",


            "#FIG 3.1",
            (FIG_portrait?"Portrait":"Landscape"), "Center",
            (FIG_inches?"Inches":"Metric"), (1200), 2);
}


static void FIG_graphics()
{
    FIG_posx = FIG_posy = 0;
    FIG_polyvec_stat = FIG_poly_new;

}


static void FIG_text()
{

    FIG_poly_clean(FIG_polyvec_stat);
    FIG_posx = FIG_posy = 0;
    fflush(gpoutfile);
}
# 473 "term/fig.trm"
static void FIG_linetype(linetype)
int linetype;
{
    int last_FIG_type = FIG_type;
    int last_FIG_spacing = FIG_spacing;
    int last_FIG_color = FIG_color;
    int last_FIG_depth = FIG_linedepth;
    int last_FIG_thickness = FIG_thickness;

    FIG_linedepth = FIG_depth;
    FIG_thickness = FIG_current_linewidth * FIG_default_thickness;
    if (FIG_thickness < 1)
        FIG_thickness = 1;
    FIG_color = (-1);

    if (linetype < -2)
        linetype = -2;

    switch (linetype) {
    case 0:
    case -2:{
            FIG_type = 0;
            FIG_spacing = 0.0;
            if (FIG_use_color)
                FIG_color = 0;
            break;
        }
    case -1:{
            FIG_type = 2;
            FIG_spacing = 4.0;
            if (FIG_use_color)
                FIG_color = 0;
            break;
        }
    default:{

            FIG_linedepth = FIG_depth + linetype / 1000;
            linetype %= 1000;



            if ((FIG_thickness = linetype / 100) == 0)
                FIG_thickness = FIG_current_linewidth * FIG_default_thickness;
            if (FIG_thickness < 1)
                FIG_thickness = 1;
            linetype %= 100;
            if (FIG_use_color) {
                FIG_type = (linetype >= 7);
                FIG_color = linetype % 7;
                FIG_spacing = (linetype / 7) * 3;
            } else {
                FIG_type = linetype % 2 + 1;
                FIG_spacing = (linetype + 1) / 2 * 3;
            }
            break;
        }
    }
    if (FIG_type != last_FIG_type || FIG_spacing != last_FIG_spacing ||
        FIG_color != last_FIG_color || FIG_linedepth != last_FIG_depth ||
        FIG_thickness != last_FIG_thickness)
        FIG_poly_clean(FIG_polyvec_stat);
}

static void FIG_move(x, y)
unsigned int x, y;
{
    int last_FIG_posx = FIG_posx;
    int last_FIG_posy = FIG_posy;
    FIG_posx = x;
    FIG_posy = y;
    if (FIG_posx != last_FIG_posx || FIG_posy != last_FIG_posy)
        FIG_poly_clean(FIG_polyvec_stat);
}


static void FIG_vector(ux, uy)
unsigned int ux, uy;
{
    int x = ux, y = uy;

    if (FIG_polyvec_stat != FIG_poly_part) {
        FIG_line.pen_color = FIG_color;
        FIG_line.fill_color = FIG_color;
        FIG_line.style = FIG_type;
        FIG_line.style_val = FIG_spacing;
        FIG_line.depth = FIG_linedepth;
        FIG_line.thickness = FIG_thickness;
        FIG_poly_vec_cnt = 0;

        FIG_points = (F_point *) gp_realloc(FIG_points, sizeof(F_point), "FIG_points");
        FIG_points[FIG_poly_vec_cnt].x = FIG_xoff + FIG_posx;
        FIG_points[FIG_poly_vec_cnt].y = term->ymax
            + FIG_yoff - FIG_posy;

        FIG_poly_vec_cnt = 1;
        FIG_polyvec_stat = FIG_poly_part;
    }

    FIG_points = (F_point *) gp_realloc(FIG_points, (FIG_poly_vec_cnt + 1) *
                                        sizeof(F_point), "FIG_points");
    FIG_points[FIG_poly_vec_cnt].x = FIG_xoff + x;
    FIG_points[FIG_poly_vec_cnt].y = term->ymax + FIG_yoff - y;

    FIG_poly_vec_cnt++;
    if (FIG_poly_vec_cnt > FIG_poly_vec_max)
        FIG_poly_clean(FIG_polyvec_stat);

    FIG_posx = x;
    FIG_posy = y;
}


static void FIG_arrow(sx, sy, ex, ey, head)
unsigned int sx, sy;
unsigned int ex, ey;
TBOOLEAN head;
{
    FIG_poly_clean(FIG_polyvec_stat);
    fprintf(gpoutfile, "%d %d %d %d %d %d %d %d %d %9.3f %d %d %d %d %d %d\n",
            2, FIG_line.type, FIG_line.style, FIG_line.thickness,
            FIG_line.pen_color, FIG_line.fill_color, FIG_line.depth,
            FIG_line.pen_style, FIG_line.fill_style, FIG_line.style_val,
            FIG_line.join_style, FIG_line.cap_style, FIG_line.radius,
            head ? 1 : 0, 0, 2);


    if (head)
        fprintf(gpoutfile, "%d %d %.3f %.3f %.3f\n",
                0, 0, 1.0,
                (double) (term->h_tic / 2 + 1),
                (double) term->h_tic);
    fprintf(gpoutfile, "%d %d %d %d\n",
            FIG_xoff + sx, FIG_yoff + term->ymax - sy,
            FIG_yoff + ex, FIG_yoff + term->ymax - ey);

    FIG_posx = ex;
    FIG_posy = ey;
}


static void FIG_put_text(x, y, str)
unsigned int x, y;
char *str;
{
    if (strlen(str) == 0)
        return;
    FIG_poly_clean(FIG_polyvec_stat);
    y -= term->v_char / 2;

    fprintf(gpoutfile, "%d %d %d %d %d %d %6.3f %6.3f %d %6.3f %6.3f %d %d %s\\001\n",
            4, FIG_justify, FIG_color, 0, (-1),
            (0), (float) FIG_font_s,
            FIG_angle, 2, (float) term->v_char,
            (float) term->h_char * strlen(str),
            FIG_xoff + x, term->ymax + FIG_yoff - y, str);
}

static int FIG_justify_text(mode)
enum JUSTIFY mode;
{
    switch (mode) {
    case LEFT:
        FIG_justify = 0;
        break;
    case CENTRE:
        FIG_justify = 1;
        break;
    case RIGHT:
        FIG_justify = 2;
        break;

    default:
        FIG_justify = 0;
        return (0);
        break;
    }
    return (1);
}

static int FIG_text_angle(ang)
int ang;
{
    if (ang)
        FIG_angle = 3.141592653589793 / 2.0;
    else
        FIG_angle = 0.0;
    return (1);
}

static void FIG_lpoint(x, y, number)
unsigned int x, y;
int number;
{
    FIG_type = 0;
    if (number % 100 >= 49 && number % 100 < 99) {
        int r, d, h, xpc, ypc;
        int line_color, fill_color, fill_style;
        int cnum, tnum, color, depth;

        FIG_poly_clean(FIG_polyvec_stat);
        depth = FIG_linedepth - 1;
        if (number > 1000)
            depth = FIG_depth + number / 1000 - 1;
        number %= 1000;
        if (depth < 0)
            depth = 0;
        if (number < 100)
            color = FIG_color;
        else if (FIG_use_color)
            color = number / 100 - 1;
        else if (number / 100 >= 7)
            color = 7;
        else
            color = (-1);
        number %= 100;
        cnum = (number + 1) % 10;
        tnum = (number - 49) / 10;
        if (cnum < 5)
            line_color = (FIG_use_color ? 0 : (-1));
        else
            line_color = FIG_color;
        fill_color = color;
        if (cnum == 0 || cnum == 5)
            fill_style = -1;
        else
            fill_style = (cnum % 5) * 5;

        xpc = FIG_xoff + x;
        ypc = term->ymax + FIG_yoff - y;

        if (tnum == 0) {
            r = FIG_current_pointsize * term->v_char / 4 + 1;
            fprintf(gpoutfile,
                    "1 3 %d %d %d %d %d %d %d %6.3f 1 0.000 %d %d %d %d %d %d %d %d\n",
                    FIG_type, FIG_thickness, line_color,
                    fill_color, depth, 0, fill_style, FIG_spacing,
                    xpc, ypc, r, r, xpc, ypc, xpc, ypc - r);
        } else {
            fprintf(gpoutfile, "2 3 %d %d %d %d %d %d %d %6.3f 0 0 0 0 0 ",
                    FIG_type, FIG_thickness, line_color,
                    fill_color, depth, 0, fill_style, FIG_spacing);

            if (tnum == 1) {
                d = FIG_current_pointsize * term->v_char / 4 + 1;
                fprintf(gpoutfile, "5\n\t%d %d %d %d %d %d %d %d %d %d\n",
                        xpc - d, ypc - d, xpc - d, ypc + d, xpc + d, ypc + d, xpc + d, ypc - d,
                        xpc - d, ypc - d);
            } else if (tnum == 2) {
                d = FIG_current_pointsize * term->v_char / 3 + 1;
                fprintf(gpoutfile, "5\n\t%d %d %d %d %d %d %d %d %d %d\n",
                        xpc - d, ypc, xpc, ypc + d, xpc + d, ypc, xpc, ypc - d, xpc - d, ypc);
            } else if (tnum == 3) {
                d = FIG_current_pointsize * term->v_char / 3 + 1;
                h = d * 4 / 7;
                fprintf(gpoutfile, "4\n\t%d %d %d %d %d %d %d %d\n",
                        xpc - d, ypc + h, xpc, ypc - 2 * h, xpc + d, ypc + h, xpc - d, ypc + h);
            } else if (tnum == 4) {
                d = FIG_current_pointsize * term->v_char / 3 + 1;
                h = d * 4 / 7;
                fprintf(gpoutfile, "4\n\t%d %d %d %d %d %d %d %d\n",
                        xpc - d, ypc - h, xpc, ypc + 2 * h, xpc + d, ypc - h, xpc - d, ypc - h);
            }
        }
    } else
        do_point(x, y, number);
}

static void FIG_pointsize(arg_pointsize)
double arg_pointsize;
{
    FIG_current_pointsize = arg_pointsize;

    do_pointsize(arg_pointsize * FIG_font_s / (double) (10));
}

static void FIG_linewidth(linewidth)
double linewidth;
{
    FIG_current_linewidth = linewidth;
}

static void FIG_reset()
{
    FIG_poly_clean(FIG_polyvec_stat);
    FIG_posx = FIG_posy = 0;
    fflush(gpoutfile);
}
# 283 "term.h" 2
# 294 "term.h"
# 1 "term/hp26.trm" 1
# 55 "term/hp26.trm"
# 1 "term/driver.h" 1
# 56 "term/hp26.trm" 2






static void HP26_vector (unsigned int x, unsigned int y);
static void HP26_move (unsigned int x, unsigned int y);
static void HP26_init (void);
static void HP26_graphics (void);
static void HP26_text (void);
static void HP26_reset (void);
static int HP26_text_angle (int ang);
static void HP26_put_text (unsigned int x, unsigned int y, char *str);
static void HP26_linetype (int linetype);
static void HP26_line_and_point (unsigned int x, unsigned int y, int number);
# 90 "term/hp26.trm"
void HP26_do_point (unsigned int x, unsigned int y, int number);
int compact_slope (int xp[], int yp[], int isa_move[], int *sz, double delta);
int compact_int (int xp[], int yp[], int isa_move[], int *size);
struct _HP26_Buffer_Node *BN_create (int index, int size, int linetype);
void BN_delete (struct _HP26_Buffer_Node * the_node);
int HP26_flush (struct _HP26_Buffer_Node * the_buff);
void HP26_handle_overflow (void);

# 1 "term/compact.c" 1
# 44 "term/compact.c"
int compact_slope(xp, yp, isa_move, sz, delta)
int xp[], yp[], isa_move[];
int *sz;
double delta;
{
    int dx, dy, old_size, new_index, i, start;
    float slope, old_slope;

    old_size = *sz;
    new_index = 0;
    start = 0;
    if (xp[1] != xp[0])
        old_slope = (float) (yp[1] - yp[0]) / (float) (xp[1] - xp[0]);
    else
        old_slope = (float) (yp[1] - yp[0]) / (float) (0.00001 + xp[1] - xp[0]);
    for (i = 2; i < old_size; i++) {
        dx = xp[i] - xp[i - 1];
        dy = yp[i] - yp[i - 1];
        if (dx != 0)
            slope = (float) dy / (float) dx;
        else
            slope = (float) dy / ((float) dx + 0.00001);
        if ((((slope - old_slope) >= 0 ? (slope - old_slope) : -(slope - old_slope)) > delta) || (isa_move[i])) {
            xp[new_index] = xp[start];
            yp[new_index] = yp[start];
            isa_move[new_index] = isa_move[start];
            new_index++;
            if (start != i - 1) {
                xp[new_index] = xp[i - 1];
                yp[new_index] = yp[i - 1];
                isa_move[new_index] = isa_move[i - 1];
                new_index++;
            }
            start = i;

            old_slope = slope;
        }
    }

    xp[new_index] = xp[old_size - 1];
    yp[new_index] = yp[old_size - 1];
    isa_move[new_index] = isa_move[old_size - 1];
    new_index++;
    *sz = new_index;
    return (old_size - *sz);
}






int compact_int(xp, yp, isa_move, size)
int xp[], yp[], isa_move[], *size;
{
    int dx, dy, old_dx, old_dy, start, index, i, old_size;

    start = index = 0;
    old_dx = xp[1] - xp[0];
    old_dy = yp[1] - yp[0];
    for (i = 2; i < *size; i++) {
        dx = xp[i] - xp[i - 1];
        dy = yp[i] - yp[i - 1];
        if ((((dx - old_dx) >= 0 ? (dx - old_dx) : -(dx - old_dx)) + ((dy - old_dy) >= 0 ? (dy - old_dy) : -(dy - old_dy)) != 0) || (isa_move[i])) {

            xp[index] = xp[start];
            yp[index] = yp[start];
            isa_move[index] = isa_move[start];
            index++;
            if (start != i - 1) {
                xp[index] = xp[i - 1];
                yp[index] = yp[i - 1];
                isa_move[index] = isa_move[i - 1];
                index++;
            }
            start = i;
            old_dx = dx;
            old_dy = dy;
        }
    }

    xp[index] = xp[*size - 1];
    yp[index] = yp[*size - 1];
    isa_move[index] = isa_move[*size - 1];
    index++;
    old_size = *size;
    *size = index;
    return (old_size - *size);
}
# 99 "term/hp26.trm" 2

typedef struct _HP26_Buffer_Node {
    int index;
    int size;
    int next;
    int linetype;
    int *x;
    int *y;
    TBOOLEAN *isa_move;
} HP26_Buffer_Node;


HP26_Buffer_Node *BN_create(index, size, linetype)
int index, size, linetype;
{
    HP26_Buffer_Node *the_node;
    the_node = (HP26_Buffer_Node *) malloc(sizeof(HP26_Buffer_Node));
    the_node->index = index;
    the_node->linetype = linetype;
    the_node->size = size;
    the_node->next = 0;
    the_node->x = (int *) calloc(the_node->size, sizeof(int));
    the_node->y = (int *) calloc(the_node->size, sizeof(int));
    the_node->isa_move = (TBOOLEAN *) calloc(the_node->size, sizeof(TBOOLEAN));
    if (the_node->x == ((void *)0)
        || the_node->y == ((void *)0)
        || the_node->isa_move == ((void *)0))
        return (((void *)0));
    else
        return (the_node);
}


void BN_delete(the_node)
HP26_Buffer_Node *the_node;
{
    free(the_node->x);
    free(the_node->y);
    free(the_node->isa_move);
    free(the_node);
}



HP26_Buffer_Node *HP26_gnu_map[12];
HP26_Buffer_Node *HP26_buff;
int HP26_pen_x;
int HP26_pen_y;
int HP26_angle;
int HP26_cursor_x;
int HP26_cursor_y;
TBOOLEAN HP26_in_text;
int HP26_linetype_current;
int HP26_reduction_int;
int HP26_reduction_slope;
int HP26_overflows;
int HP26_nop_move;
int HP26_nop_vect;
int HP26_nop_line;
# 176 "term/hp26.trm"
char HP26_bin_short_table[32] =
{
    '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<', '=', '>',
    '?', ' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-',
    '.', '/'
};
# 191 "term/hp26.trm"
char HP26_bin_table[32] =
{
    ' ', '!', '"', '#', '$', '%', '&', '\'', '(', ')', '*', '+', ',', '-',
    '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', '<',
    '=', '>', '?'
};
# 215 "term/hp26.trm"
int HP26_flush(the_buff)
HP26_Buffer_Node *the_buff;
{
    int i, delta_x, delta_y, half_dx, half_dy;
    int *buff_x, *buff_y;
    TBOOLEAN *isa_move;
    TBOOLEAN bin_short;

    if (the_buff->next == 0)
        return (0);

    buff_x = the_buff->x;
    buff_y = the_buff->y;
    isa_move = the_buff->isa_move;
    if (HP26_in_text) {
        fputs("\033*dT", gpoutfile);
        HP26_in_text = 0;
    }
    if (HP26_linetype_current != the_buff->linetype
        && (the_buff->next > 1 || !isa_move[0])) {
        fprintf(gpoutfile, "\033*m%dB", the_buff->linetype);
        HP26_linetype_current = the_buff->linetype;
    }

    if (the_buff->next > 30 && the_buff->linetype != 11) {

        HP26_reduction_slope += compact_slope(buff_x, buff_y, isa_move, &(the_buff->next), 0.1);
    }

    fputs("\033*p", gpoutfile);

    delta_x = buff_x[0] - HP26_pen_x;
    delta_y = buff_y[0] - HP26_pen_y;
    if (((delta_x>-17)&&(delta_y>-17)&&(delta_x<16)&&(delta_y<16))) {
        fputc('j', gpoutfile);
        bin_short = 1;
    } else {
        fputc('i', gpoutfile);
        bin_short = 0;
    }

    for (i = 0; i < the_buff->next; i++) {
        if (i > 0) {
            delta_x = buff_x[i] - buff_x[i - 1];
            delta_y = buff_y[i] - buff_y[i - 1];
        }
        if ((delta_x == 0) && (delta_y == 0)) {
            if (i > 0 && !isa_move[i - 1] && !isa_move[i]) {

                HP26_nop_vect++;
                continue;
            } else if (isa_move[i]) {

                HP26_nop_move++;
                continue;
            }
        } else if (i > 0
                   && i + 1 < the_buff->next
                   && isa_move[i]
                   && isa_move[i + 1]) {

            HP26_nop_move++;
            continue;
        } else if (!((delta_x>-17)&&(delta_y>-17)&&(delta_x<16)&&(delta_y<16))
                   && i > 0
                   && i + 2 < the_buff->next
                   && isa_move[i]
                   && !isa_move[i + 1]
                   && isa_move[i + 2]
                   && ((buff_x[i + 1] - buff_x[i - 1]>-17)&&(buff_y[i + 1] - buff_y[i - 1]>-17)&&(buff_x[i + 1] - buff_x[i - 1]<16)&&(buff_y[i + 1] - buff_y[i - 1]<16))) {
            buff_x[i] ^= buff_x[i + 1]; buff_x[i + 1] ^= buff_x[i]; buff_x[i] ^= buff_x[i + 1];;
            buff_y[i] ^= buff_y[i + 1]; buff_y[i + 1] ^= buff_y[i]; buff_y[i] ^= buff_y[i + 1];;

            delta_x = buff_x[i] - buff_x[i - 1];
            delta_y = buff_y[i] - buff_y[i - 1];
        }
        if (((delta_x>-17)&&(delta_y>-17)&&(delta_x<16)&&(delta_y<16))) {
            if (!bin_short) {
                fputc('j', gpoutfile);
                bin_short = 1;
            }
            if (isa_move[i])
                fputc('a', gpoutfile);
            fputc((HP26_bin_short_table[delta_x+16]), gpoutfile);
            fputc((HP26_bin_short_table[delta_y+16]), gpoutfile);
        } else {
            half_dx = (delta_x + (delta_x > 0 ? 1 : -1)) / 2;
            half_dy = (delta_y + (delta_y > 0 ? 1 : -1)) / 2;
            if (bin_short && ((half_dx>-17)&&(half_dy>-17)&&(half_dx<16)&&(half_dy<16))) {
                if (isa_move[i])
                    fputc('a', gpoutfile);
                fputc((HP26_bin_short_table[half_dx+16]), gpoutfile);
                fputc((HP26_bin_short_table[half_dy+16]), gpoutfile);
                if (isa_move[i])
                    fputc('a', gpoutfile);
                fputc((HP26_bin_short_table[delta_x - half_dx+16]), gpoutfile);
                fputc((HP26_bin_short_table[delta_y - half_dy+16]), gpoutfile);
            } else {
                if (bin_short) {
                    bin_short = 0;
                    fputc('i', gpoutfile);
                }
                if (isa_move[i])
                    fputc('a', gpoutfile);
                fputc((HP26_bin_table[buff_x[i]>>5]), gpoutfile);
                fputc((HP26_bin_table[buff_x[i] & 31]), gpoutfile);
                fputc((HP26_bin_table[buff_y[i]>>5]), gpoutfile);
                fputc((HP26_bin_table[buff_y[i] & 31]), gpoutfile);
            }
        }
    }


    fputc('Z', gpoutfile);

    HP26_pen_x = buff_x[the_buff->next - 1];
    HP26_pen_y = buff_y[the_buff->next - 1];
    the_buff->next = 0;
    return (1);
}

void HP26_handle_overflow()
{
    HP26_Buffer_Node *bigger, *old;
    int x, y;
    x = (HP26_buff->x)[HP26_buff->next - 1];
    y = (HP26_buff->y)[HP26_buff->next - 1];
    HP26_flush(HP26_buff);
    bigger = BN_create(HP26_buff->index, HP26_buff->size * 2,
                       HP26_buff->linetype);
    if (bigger != ((void *)0)) {
        old = HP26_buff;
        HP26_gnu_map[bigger->index] = bigger;

        if (bigger->index == 0) {
            HP26_gnu_map[1] = bigger;
            HP26_gnu_map[3] = bigger;
        }
        HP26_buff = bigger;
        BN_delete(old);
    }
    (HP26_buff->x)[0] = x;
    (HP26_buff->y)[0] = y;
    (HP26_buff->isa_move)[0] = 1;
    HP26_buff->next = 1;
    HP26_overflows++;
}


static void HP26_vector(x, y)
unsigned int x, y;
{
    if (HP26_buff->next > 2
        && x == (HP26_buff->x)[HP26_buff->next - 1]
        && y == (HP26_buff->y)[HP26_buff->next - 1]
        && !(HP26_buff->isa_move)[HP26_buff->next - 1]) {
        HP26_nop_vect++;
        return;
    }
    if (HP26_buff->next == HP26_buff->size)
        HP26_handle_overflow();

    (HP26_buff->x)[HP26_buff->next] = x;
    (HP26_buff->y)[HP26_buff->next] = y;
    (HP26_buff->isa_move)[HP26_buff->next] = 0;
    HP26_buff->next++;
}


static void HP26_move(x, y)
unsigned int x, y;
{
    if (HP26_buff->next > 0) {
        if (((HP26_buff->x)[HP26_buff->next - 1] == x)
            && ((HP26_buff->y)[HP26_buff->next - 1] == y)) {

            HP26_nop_move++;
            return;
        } else if ((HP26_buff->isa_move)[HP26_buff->next - 1]) {

            (HP26_buff->x)[HP26_buff->next - 1] = x;
            (HP26_buff->y)[HP26_buff->next - 1] = y;
            HP26_nop_move++;
            return;
        }
    }
    if (HP26_buff->next == HP26_buff->size)
        HP26_handle_overflow();
    (HP26_buff->x)[HP26_buff->next] = x;
    (HP26_buff->y)[HP26_buff->next] = y;
    (HP26_buff->isa_move)[HP26_buff->next] = 1;
    HP26_buff->next++;
    return;
}

static void HP26_init()
{
    HP26_gnu_map[-2 + 2] = BN_create(0, 2048, 7);
    HP26_gnu_map[-1 + 2] = HP26_gnu_map[-2 + 2];
    HP26_gnu_map[0 + 2] = BN_create(2, 3072, 1);
    HP26_gnu_map[1 + 2] = HP26_gnu_map[-2 + 2];
    HP26_gnu_map[2 + 2] = BN_create(4, 1024, 5);
    HP26_gnu_map[3 + 2] = BN_create(5, 256, 6);
    HP26_gnu_map[4 + 2] = BN_create(6, 256, 8);
    HP26_gnu_map[5 + 2] = BN_create(7, 128, 9);
    HP26_gnu_map[6 + 2] = BN_create(8, 128, 10);
    HP26_gnu_map[7 + 2] = BN_create(9, 64, 6);
    HP26_gnu_map[8 + 2] = BN_create(10, 64, 4);
    HP26_gnu_map[9 + 2] = BN_create(11, 512, 11);
    HP26_buff = HP26_gnu_map[10];
    HP26_linetype_current = 0;
    HP26_angle = 1;
    fputs("\033*mp1m2a2Q", gpoutfile);





    fflush(gpoutfile);
}


static void HP26_graphics()
{
    fputs("\033*daflsC", gpoutfile);







    HP26_pen_x = HP26_pen_y = -200;
    HP26_cursor_x = HP26_cursor_y = 800;
    HP26_in_text = 1;

    HP26_reduction_int = 0;
    HP26_reduction_slope = 0;
    HP26_nop_move = 0;
    HP26_nop_vect = 0;
    HP26_nop_line = 0;
    HP26_overflows = 0;
}


static void HP26_text()
{
    int i, j, curr;


    for (i = 0; i < 12; i++)
        if ((HP26_gnu_map[i])->linetype == HP26_linetype_current)
            HP26_flush(HP26_gnu_map[i]);

    for (i = 0; i < 12; i++) {
        HP26_flush(HP26_gnu_map[i]);
        curr = HP26_gnu_map[i]->linetype;
        for (j = 0; j < 12; j++)
            if ((HP26_gnu_map[j])->linetype == curr)
                HP26_flush(HP26_gnu_map[j]);
    }
    fputs("\033*deT", gpoutfile);



    fflush(gpoutfile);
# 506 "term/hp26.trm"
}

static void HP26_reset()
{
    int i;
    for (i = 2; i < 12; i++)
        BN_delete(HP26_gnu_map[i]);
}

static int HP26_text_angle(ang)
int ang;
{
    HP26_angle = ang + 1;
    fprintf(gpoutfile, "\033*m%dN", HP26_angle);
    return (1);
}


static void HP26_put_text(x, y, str)
unsigned int x, y;
char *str;
{
    char abs_str[10], rel_str[10];

    if (!strlen(str))
        return;
    else {
        fputs("\033*d", gpoutfile);
        if (!HP26_in_text) {
            fputc('s', gpoutfile);
            HP26_in_text = 1;
        }
        sprintf(rel_str, "%d,%dP", x - HP26_cursor_x, y - HP26_cursor_y);
        sprintf(abs_str, "%d,%dO", x, y);
        if (strlen(rel_str) < strlen(abs_str))
            fputs(rel_str, gpoutfile);
        else
            fputs(abs_str, gpoutfile);
        fputs(str, gpoutfile);
        HP26_pen_x = HP26_cursor_x = x;
        HP26_pen_y = HP26_cursor_y = y;
    }
# 557 "term/hp26.trm"
    return;
}



static void HP26_linetype(linetype)
int linetype;
{
    if (linetype > 8)
        linetype %= 9;
    linetype += 2;
    if (HP26_gnu_map[linetype] == HP26_buff) {
        HP26_nop_line++;
        return;
    }
    HP26_buff = HP26_gnu_map[linetype];
}




static void HP26_line_and_point(x, y, number)
unsigned int x, y;
int number;
{
    int line_save, not_solid;


    line_save = 0;
    not_solid = (HP26_buff->linetype != 1);
    if (not_solid) {
        line_save = HP26_buff->linetype;
        HP26_linetype(0);
    }
    HP26_do_point(x, y, number);
    if (not_solid)
        HP26_linetype(line_save);
}





void HP26_do_point(x, y, number)
unsigned int x, y;
int number;
{
    int htic, vtic;
    HP26_Buffer_Node *tmp;

    vtic = 5 / 2;
    htic = 5 / 2;
    if (number < 0) {

        tmp = HP26_buff;
        HP26_buff = HP26_gnu_map[11];
        HP26_vector(x, y);
        HP26_buff = tmp;
    }
    switch (number % 9) {
    case 0:

        HP26_move(x - htic, y - vtic);
        HP26_vector(x, y + vtic);
        HP26_vector(x + htic, y - vtic);
        HP26_vector(x - htic, y - vtic);
        break;
    case 1:

        HP26_move(x - htic, y + vtic);
        HP26_vector(x, y - vtic);
        HP26_vector(x + htic, y + vtic);
        HP26_vector(x - htic, y + vtic);
        break;
    case 2:

        HP26_move(x - htic, y);
        HP26_vector(x + htic, y + vtic);
        HP26_vector(x + htic, y - vtic);
        HP26_vector(x - htic, y);
        break;
    case 3:

        HP26_move(x + htic, y);
        HP26_vector(x - htic, y + vtic);
        HP26_vector(x - htic, y - vtic);
        HP26_vector(x + htic, y);
        break;
    case 4:

        HP26_move(x - htic, y - vtic);
        HP26_vector(x - htic, y + vtic);
        HP26_vector(x + htic, y + vtic);
        HP26_vector(x + htic, y - vtic);
        HP26_vector(x - htic, y - vtic);
        break;
    case 5:

        HP26_move(x, y + vtic);
        HP26_vector(x, y - vtic);
        HP26_move(x - htic, y);
        HP26_vector(x + htic, y);
        break;
    case 6:

        HP26_move(x + htic, y + vtic);
        HP26_vector(x - htic, y - vtic);
        HP26_move(x - htic, y + vtic);
        HP26_vector(x + htic, y - vtic);
        break;
    default:

        HP26_move(x, y - vtic);
        HP26_vector(x - htic, y);
        HP26_vector(x, y + vtic);
        HP26_vector(x + htic, y);
        HP26_vector(x, y - vtic);
        break;
    }
}
# 295 "term.h" 2


# 1 "term/hp2648.trm" 1
# 55 "term/hp2648.trm"
# 1 "term/driver.h" 1
# 56 "term/hp2648.trm" 2






static void HP2648init (void);
static void HP2648graphics (void);
static void HP2648text (void);
static void HP2648linetype (int linetype);
static void HP2648move (unsigned int x, unsigned int y);
static void HP2648vector (unsigned int x, unsigned int y);
static void HP2648put_text (unsigned int x, unsigned int y, char *str);
static int HP2648_text_angle (int ang);
static void HP2648reset (void);
# 87 "term/hp2648.trm"
static void HP2648init()
{
    fprintf(gpoutfile, "\033*m1m1n136,1cZ");






}


static void HP2648graphics()
{
    fprintf(gpoutfile, "\033*dacZ");





}


static void HP2648text()
{
}


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


static void HP2648move(x, y)
unsigned int x, y;
{
    fprintf(gpoutfile, "\033*paf%d,%dZ", x, y);






}


static void HP2648vector(x, y)
unsigned int x, y;
{
    fprintf(gpoutfile, "\033*pbf%d,%dZ", x, y);



}


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


static int HP2648_text_angle(ang)
int ang;
{
    fprintf(gpoutfile, "\033*m%dnZ\n", ang + 1);
    return 1;
}

static void HP2648reset()
{
}
# 298 "term.h" 2


# 1 "term/hp500c.trm" 1
# 69 "term/hp500c.trm"
# 1 "term/driver.h" 1
# 70 "term/hp500c.trm" 2






static void HP500Coptions (void);
static void HP500Cinit (void);
static void HP500Creset (void);
static void HP500Clinetype (int linetype);
static void HP500Cgraphics (void);
static void HP500Ctext (void);
# 125 "term/hp500c.trm"
static int HPcompress (unsigned char *op, unsigned char *oe, unsigned char *cp);

static unsigned char HPcomplement (int c);
static int HPcompress_to_TIFF (unsigned char *op, unsigned char *oe, unsigned char *cp);

static int HPnocompress (unsigned char *op, unsigned char *oe, unsigned char *cp);


static int hpdj_dpp = 4;
static int HP_COMP_MODE = 0;




static unsigned int b_300ppi_pattern[] =
{
    0xffff, 0x1111,
    0xffff, 0x3333, 0x0f0f, 0x3f3f, 0x0fff, 0x00ff, 0x33ff
};



static void HP500Coptions()
{
    char opt[6];


    while (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (token[c_token].length > 4)
            int_error("expecting dots per inch size 75, 100, 150 or 300 and/or compression method", c_token);


        capture(opt, c_token, c_token, 6);
        if (!__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (opt) && __builtin_constant_p ("75") && (__s1_len = strlen (opt), __s2_len = strlen ("75"), (!((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("75") + 1) - (size_t)(const void *)("75") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (opt), (__const char *) ("75"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) && (__s1_len = strlen (opt), __s1_len < 4) ? (__builtin_constant_p ("75") && ((size_t)(const void *)(("75") + 1) - (size_t)(const void *)("75") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("75"))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - ((__co!
nst unsigned char *) (__const char *) ("75"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("75"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("75"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("75"); register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("75") && ((size_t)(!
const void *)(("75") + 1) - (size_t)(const void *)("75") == 1) && (__s2_len = strlen ("75"), __s2_len < 4) ? (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("75"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - ((__const unsigned char *) (__const char *) ("75"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("75"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("75"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (opt); register int __resu!
lt = __s1[0] - ((__const unsigned char *) (__const char *) ("75"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("75"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("75"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("75"))[3]); } } __result; }))) : strcmp (opt, "75")))); })) {
            hpdj_dpp = 4;
            HP_COMP_MODE = 0;

        } else if (!__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (opt) && __builtin_constant_p ("100") && (__s1_len = strlen (opt), __s2_len = strlen ("100"), (!((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("100") + 1) - (size_t)(const void *)("100") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (opt), (__const char *) ("100"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) && (__s1_len = strlen (opt), __s1_len < 4) ? (__builtin_constant_p ("100") && ((size_t)(const void *)(("100") + 1) - (size_t)(const void *)("100") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("100"))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (o!
pt))[1] - ((__const unsigned char *) (__const char *) ("100"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("100"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("100"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("100"); register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p !
("100") && ((size_t)(const void *)(("100") + 1) - (size_t)(const void *)("100") == 1) && (__s2_len = strlen ("100"), __s2_len < 4) ? (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("100"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - ((__const unsigned char *) (__const char *) ("100"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("100"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("100"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *!
) (opt); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("100"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("100"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("100"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("100"))[3]); } } __result; }))) : strcmp (opt, "100")))); })) {
            hpdj_dpp = 3;
            HP_COMP_MODE = 0;
        } else if (!__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (opt) && __builtin_constant_p ("150") && (__s1_len = strlen (opt), __s2_len = strlen ("150"), (!((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("150") + 1) - (size_t)(const void *)("150") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (opt), (__const char *) ("150"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) && (__s1_len = strlen (opt), __s1_len < 4) ? (__builtin_constant_p ("150") && ((size_t)(const void *)(("150") + 1) - (size_t)(const void *)("150") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("150"))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (o!
pt))[1] - ((__const unsigned char *) (__const char *) ("150"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("150"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("150"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("150"); register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p !
("150") && ((size_t)(const void *)(("150") + 1) - (size_t)(const void *)("150") == 1) && (__s2_len = strlen ("150"), __s2_len < 4) ? (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("150"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - ((__const unsigned char *) (__const char *) ("150"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("150"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("150"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *!
) (opt); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("150"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("150"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("150"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("150"))[3]); } } __result; }))) : strcmp (opt, "150")))); })) {
            hpdj_dpp = 2;
            HP_COMP_MODE = 0;
        } else if (!__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (opt) && __builtin_constant_p ("300") && (__s1_len = strlen (opt), __s2_len = strlen ("300"), (!((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("300") + 1) - (size_t)(const void *)("300") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (opt), (__const char *) ("300"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) && (__s1_len = strlen (opt), __s1_len < 4) ? (__builtin_constant_p ("300") && ((size_t)(const void *)(("300") + 1) - (size_t)(const void *)("300") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("300"))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (o!
pt))[1] - ((__const unsigned char *) (__const char *) ("300"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("300"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("300"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("300"); register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p !
("300") && ((size_t)(const void *)(("300") + 1) - (size_t)(const void *)("300") == 1) && (__s2_len = strlen ("300"), __s2_len < 4) ? (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("300"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - ((__const unsigned char *) (__const char *) ("300"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("300"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("300"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *!
) (opt); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("300"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("300"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("300"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("300"))[3]); } } __result; }))) : strcmp (opt, "300")))); })) {
            hpdj_dpp = 1;
            HP_COMP_MODE = 0;
        } else if (!__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (opt) && __builtin_constant_p ("rle") && (__s1_len = strlen (opt), __s2_len = strlen ("rle"), (!((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("rle") + 1) - (size_t)(const void *)("rle") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (opt), (__const char *) ("rle"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) && (__s1_len = strlen (opt), __s1_len < 4) ? (__builtin_constant_p ("rle") && ((size_t)(const void *)(("rle") + 1) - (size_t)(const void *)("rle") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("rle"))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (o!
pt))[1] - ((__const unsigned char *) (__const char *) ("rle"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("rle"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("rle"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("rle"); register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p !
("rle") && ((size_t)(const void *)(("rle") + 1) - (size_t)(const void *)("rle") == 1) && (__s2_len = strlen ("rle"), __s2_len < 4) ? (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("rle"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - ((__const unsigned char *) (__const char *) ("rle"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("rle"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("rle"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *!
) (opt); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("rle"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("rle"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("rle"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("rle"))[3]); } } __result; }))) : strcmp (opt, "rle")))); })) {
            HP_COMP_MODE = 1;
        } else if (!__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (opt) && __builtin_constant_p ("tiff") && (__s1_len = strlen (opt), __s2_len = strlen ("tiff"), (!((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("tiff") + 1) - (size_t)(const void *)("tiff") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (opt), (__const char *) ("tiff"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) && (__s1_len = strlen (opt), __s1_len < 4) ? (__builtin_constant_p ("tiff") && ((size_t)(const void *)(("tiff") + 1) - (size_t)(const void *)("tiff") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("tiff"))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const c!
har *) (opt))[1] - ((__const unsigned char *) (__const char *) ("tiff"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("tiff"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("tiff"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("tiff"); register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - __s2[3]); } } __result; }))) : (__builti!
n_constant_p ("tiff") && ((size_t)(const void *)(("tiff") + 1) - (size_t)(const void *)("tiff") == 1) && (__s2_len = strlen ("tiff"), __s2_len < 4) ? (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("tiff"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - ((__const unsigned char *) (__const char *) ("tiff"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("tiff"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("tiff"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned ch!
ar *) (__const char *) (opt); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("tiff"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("tiff"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("tiff"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("tiff"))[3]); } } __result; }))) : strcmp (opt, "tiff")))); })) {
            HP_COMP_MODE = 2;
        }
        c_token++;
    }

    term->xmax = (8*(unsigned int)(xsize*1920/(hpdj_dpp)/8.0+0.9));
    term->ymax = (8*(unsigned int)(ysize*1920/(hpdj_dpp)/8.0+0.9));
    switch (hpdj_dpp) {
    case 1:
        (__extension__ (__builtin_constant_p ("300") ? (((size_t)(const void *)(("300") + 1) - (size_t)(const void *)("300") == 1) && strlen ("300") + 1 <= 8 ? __strcpy_small (term_options, __extension__ (((__const unsigned char *) (__const char *) ("300"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("300"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("300"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("300"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("300"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("300"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("300"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("300"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("300"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("300"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("300"))[4 + 1]) << 8 | ((__const unsigned ch!
ar *) (__const char *) ("300"))[4]), strlen ("300") + 1) : (char *) memcpy (term_options, "300", strlen ("300") + 1)) : strcpy (term_options, "300")));
        term->v_tic = 15;
        term->h_tic = 15;
        break;
    case 2:
        (__extension__ (__builtin_constant_p ("150") ? (((size_t)(const void *)(("150") + 1) - (size_t)(const void *)("150") == 1) && strlen ("150") + 1 <= 8 ? __strcpy_small (term_options, __extension__ (((__const unsigned char *) (__const char *) ("150"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("150"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("150"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("150"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("150"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("150"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("150"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("150"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("150"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("150"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("150"))[4 + 1]) << 8 | ((__const unsigned ch!
ar *) (__const char *) ("150"))[4]), strlen ("150") + 1) : (char *) memcpy (term_options, "150", strlen ("150") + 1)) : strcpy (term_options, "150")));
        term->v_tic = 8;
        term->h_tic = 8;
        break;
    case 3:
        (__extension__ (__builtin_constant_p ("100") ? (((size_t)(const void *)(("100") + 1) - (size_t)(const void *)("100") == 1) && strlen ("100") + 1 <= 8 ? __strcpy_small (term_options, __extension__ (((__const unsigned char *) (__const char *) ("100"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("100"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("100"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("100"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("100"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("100"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("100"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("100"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("100"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("100"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("100"))[4 + 1]) << 8 | ((__const unsigned ch!
ar *) (__const char *) ("100"))[4]), strlen ("100") + 1) : (char *) memcpy (term_options, "100", strlen ("100") + 1)) : strcpy (term_options, "100")));
        term->v_tic = 6;
        term->h_tic = 6;
        break;
    case 4:
        (__extension__ (__builtin_constant_p ("75") ? (((size_t)(const void *)(("75") + 1) - (size_t)(const void *)("75") == 1) && strlen ("75") + 1 <= 8 ? __strcpy_small (term_options, __extension__ (((__const unsigned char *) (__const char *) ("75"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("75"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("75"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("75"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("75"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("75"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("75"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("75"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("75"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("75"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("75"))[4 + 1]) << 8 | ((__const unsigned char *) (__const !
char *) ("75"))[4]), strlen ("75") + 1) : (char *) memcpy (term_options, "75", strlen ("75") + 1)) : strcpy (term_options, "75")));
        term->v_tic = 5;
        term->h_tic = 5;
        break;
    }
    switch (HP_COMP_MODE) {
    case 0:
        strcat(term_options, " no comp");
        break;
    case 1:
        strcat(term_options, " RLE");
        break;
    case 2:
        strcat(term_options, " TIFF");
        break;
    case 3:
        strcat(term_options, " Delta Row");
        break;
    }
}

static void HP500Cinit()
{


    switch (hpdj_dpp) {
    case 1:
        b_charsize(2);
        term->v_char = 31;
        term->h_char = 19;
        break;
    case 2:
        b_charsize(2);
        term->v_char = 31;
        term->h_char = 19;
        break;
    case 3:
        b_charsize(1);
        term->v_char = 21;
        term->h_char = 13;
        break;
    case 4:
        b_charsize(0);
        term->v_char = 11;
        term->h_char = 7;
        break;
    }
}

static void HP500Creset()
{



}





static void HP500Clinetype(linetype)
int linetype;
{
    if (linetype < 0)
        linetype = 7;
    else if (linetype >= 8) {
        linetype %= 8;
    }
    switch (linetype) {
    case 0:
        linetype = 6;
        break;
    case 1:
        linetype = 5;
        break;
    case 2:
        linetype = 3;
        break;
    case 3:
        linetype = 2;
        break;
    case 4:
        linetype = 1;
        break;
    case 5:
        linetype = 4;
        break;
    case 6:
        linetype = 7;
    }
    b_setvalue(linetype);

}
# 303 "term/hp500c.trm"
static void HP500Cgraphics()
{



    b_makebitmap((8*(unsigned int)(ysize*1920/(hpdj_dpp)/8.0+0.9)), (8*(unsigned int)(xsize*1920/(hpdj_dpp)/8.0+0.9)), 3);
    b_rastermode = 1;
}







static int HPcompress(op, oe, cp)
unsigned char *op, *oe, *cp;
{
    unsigned char *ce = cp;
    while (op < oe) {
        unsigned char prevchar;
        unsigned char count;

        prevchar = *op;
        count = 1;

        while (++op < oe && *op == prevchar && count < 255) {

            count++;
        }
        *ce++ = --count;
        *ce++ = prevchar;
    }
    *ce = 0;
    return ce - cp;
}

static unsigned char HPcomplement(c)
int c;
{
    return (unsigned char) (256 - c);
}


static int HPcompress_to_TIFF(op, oe, cp)
unsigned char *op;
unsigned char *oe;
unsigned char *cp;
{
    unsigned char *countposition;
    unsigned char *ce = cp;
    while (op < oe) {
        unsigned char prevchar;
        unsigned char count;

        prevchar = *op;
        count = 1;

        while (++op < oe && *op == prevchar && count < 128) {
            count++;
        }
        *ce = HPcomplement(count - 1);

        countposition = ce++;
        *ce++ = prevchar;

        if (count < 2) {
            while (op < oe && (prevchar != *op || *op != *(op + 1))) {

                *ce++ = *op;
                count++;
                prevchar = *op++;
                if (op > oe)
                    puts("FATAL op> oe!!\n");
            }
            if (op < oe && prevchar == *op) {
                op--;
                count--;
                ce--;
            }
            *countposition = count - 1;
        }
    }
    return ce - cp;

}

static int HPnocompress(op, oe, cp)
unsigned char *op;
unsigned char *oe;
unsigned char *cp;
{
    unsigned char *ce = cp;
    while (op < oe)
        *ce++ = *op++;
    return ce - cp;
}




static void HP500Ctext()
{
    register int x, j, row, count = 0;
    unsigned char *obuf, *oe, *cbuf, *ce;

    if ((obuf = (unsigned char *) malloc(100 * b_psize)) == 0)
        puts("FATAL!-- couldn't get enough memory for obuf");
    if ((cbuf = (unsigned char *) malloc(400 * b_psize)) == 0)
        puts("FATAL!-- couldn't get enough memory for cbuf");

    oe = obuf;

    fprintf(gpoutfile, "\033*t%dR\033*r1A\033*b%1dM\033*r%dS\033*r-3U",





            (300/(hpdj_dpp)),
            HP_COMP_MODE,
            b_ysize);


    for (x = b_xsize - 1; x >= 0; x--) {
        row = (b_ysize / 8) - 1;
        for (j = row; j >= 0; j--) {
            *oe++ = (char) (*((*b_p)[j] + x));
        }
        switch (HP_COMP_MODE) {
        case 2:
            count = HPcompress_to_TIFF(obuf, oe, cbuf);
            break;
        case 1:
            count = HPcompress(obuf, oe, cbuf);
            break;
        case 0:
            count = HPnocompress(obuf, oe, cbuf);
            break;
        }
        fprintf(gpoutfile, "\033*b%dV", count);
        ce = cbuf;
        while (count--)
            fputc(*ce++, gpoutfile);
        oe = obuf;

        for (j = row; j >= 0; j--) {
            *oe++ = (char) (*((*b_p)[j + b_psize] + x));
        }
        switch (HP_COMP_MODE) {
        case 2:
            count = HPcompress_to_TIFF(obuf, oe, cbuf);
            break;
        case 1:
            count = HPcompress(obuf, oe, cbuf);
            break;
        case 0:
            count = HPnocompress(obuf, oe, cbuf);
            break;

        }

        fprintf(gpoutfile, "\033*b%dV", count);
        ce = cbuf;
        while (count--)
            fputc(*ce++, gpoutfile);
        oe = obuf;

        for (j = row; j >= 0; j--) {
            *oe++ = (char) (*((*b_p)[j + (2 * b_psize)] + x));
        }
        switch (HP_COMP_MODE) {
        case 2:
            count = HPcompress_to_TIFF(obuf, oe, cbuf);
            break;
        case 1:
            count = HPcompress(obuf, oe, cbuf);
            break;
        case 0:
            count = HPnocompress(obuf, oe, cbuf);
            break;
        }
        fprintf(gpoutfile, "\033*b%dW", count);
        ce = cbuf;
        while (count--)
            fputc(*ce++, gpoutfile);
        oe = obuf;

    }
    fputs("\033*rbC", gpoutfile);
    free(cbuf);
    free(obuf);
    b_freebitmap();



    _IO_putc ('\f', gpoutfile);

}
# 301 "term.h" 2


# 1 "term/hpgl.trm" 1
# 64 "term/hpgl.trm"
# 1 "term/driver.h" 1
# 65 "term/hpgl.trm" 2







static void HPGL_options (void);
static void HPGL2_options (void);
static void PCL_options (void);
static void HPGL_init (void);

static void PCL_init (void);
static void HPGL_graphics (void);
static void HPGL2_graphics (void);
static void PCL_graphics (void);
static void HPGL_text (void);

static void PCL_text (void);
static void HPGL_linetype (int linetype);
static void HPGL2_linetype (int linetype);
static void HPGL_put_text (unsigned int x, unsigned int y, char *str);
static void HPGL2_put_text (unsigned int x, unsigned int y, char *str);
static void HPGL_move (unsigned int x, unsigned int y);
static void HPGL_vector (unsigned int x, unsigned int y);
static void HPGL2_move (unsigned int x, unsigned int y);
static void HPGL2_vector (unsigned int x, unsigned int y);
static void HPGL2_encode (int d);
static int HPGL_text_angle (int ang);
static int HPGL2_text_angle (int ang);
static void HPGL_reset (void);

static void PCL_reset (void);
static int HPGL2_justify_text (enum JUSTIFY just);
# 185 "term/hpgl.trm"
struct HPGL2_font_str {
    char *compare, *name;
    int symbol_set, spacing;
    double pitch, height;
    int posture, stroke_weight, typeface;
};

struct PCL_mode_str {
    char *compare, *name, *command;
    int xmax, ymax;
};







static struct HPGL2_font_str HPGL2_font_table[] =
{
    {"u$nivers", "univers", 277, 1, 0.0, 14, 0, 0, 4148},
    {"s$tick", "stick", 277, 0, (3 * 72 / (14 * 2)), 0.0, 0, 0, 48},
    {"c$g_times", "cg_times", 277, 1, 0.0, 14, 0, 0, 4101}
};


static struct HPGL2_font_str *HPGL2_font = &HPGL2_font_table[0];






static struct PCL_mode_str PCL_mode_table[] =
{
    {"l$andscape", "landscape", "\033&l1O", 10000, (7500 -60)},
    {"p$ortrait", "portrait", "\033&l0O", (7500 -60), 10000}
};


static struct PCL_mode_str *PCL_mode = &PCL_mode_table[0];





static char *HPGL2_lt[] = { "", "4,2", "5,2", "6,2", "7,2", "8,2" },
            *HPGL2_pw[] = { ".15", ".12", ".08" };






static char hpgl_cp_850[128][4] =
{

           "\0164\017",
           "\016O\017",
           "\016E\017",
           "\016@\017",
           "\016L\017",
           "\016H\017",
           "\016T\017",
           "\0165\017",

           "\016A\017",
           "\016M\017",
           "\016I\017",
           "\016]\017",
           "\016Q\017",
           "\016Y\017",
           "\016X\017",
           "\016P\017",

           "\016\134\017",
           "\016W\017",
           "\016S\017",
           "\016B\017",
           "\016N\017",
           "\016J\017",
           "\016C\017",
           "\016K\017",

           "\016o\017",
           "\016Z\017",
           "\016[\017",
           "\016V\017",
           "\016;\017",
           "\016R\017",
           "",
           "\016>\017",

           "\016D\017",
           "\016U\017",
           "\016F\017",
           "\016G\017",
           "\0167\017",
           "\0166\017",
           "\016y\017",
           "\016z\017",

           "\0169\017",

           "",
           "",

           "\016x\017",
           "\016w\017",
           "\0168\017",
           "\016{\017",
           "\016}\017",

           "",
           "",
           "",
           "",
           "",

           "\016`\017",
           "\016\042\017",
           "\016!\017",

           "",
           "",
           "",
           "",
           "",

           "\016?\017",
           "\016<\017",

           "",

           "",
           "",
           "",
           "",
           "",
           "",

           "\016b\017",
           "\016a\017",

           "",
           "",
           "",
           "",
           "",
           "",
           "",

           "\016:\017",

           "\016d\017",
           "\016c\017",
           "\016$\017",
           "\016%\017",
           "\016#\017",

           "",

           "\016e\017",
           "\016&\017",

           "\016'\017",

           "",
           "",
           "",
           "",
           "",

           "\016f\017",
           "",

           "\016g\017",
           "\016^\017",
           "\016_\017",
           "\016h\017",
           "\016j\017",
           "\016i\017",
           "",
           "\016q\017",

           "\016p\017",
           "\016m\017",
           "\016.\017",
           "\016-\017",
           "",
           "",
           "\0160\017",
           "\016(\017",

           "\016v\017",
           "\016~\017",
           "",
           "",
           "",
           "\016=\017",
           "",
           "",

           "\016z\017",
           "\016+\017",
           "",
           "",
           "",
           "",
           "",
           ""
};




static char hpgl_iso_8859_1[128][4] =
{

           "",
           "",
           "",
           "",
           "",
           "",
           "",
           "",

           "",
           "",
           "",
           "",
           "",
           "",
           "",
           "",

           "",
           "\016\017",
           "\016\017",
           "",
           "",
           "",
           "",
           "",

           "",
           "",
           "",
           "",
           "",
           "",
           "",
           "",

           "",
           "\0168\017",
           "\0165\017",
           "\016;\017",
           "\016:\017",
           "\016<\017",
           "\017|\017",
           "\016=\017",

           "\016+\017",
           "",
           "\016y\017",
           "\016{\017",
           "",
           "",
           "",
           "\0160\017",

           "\016z\017",
           "\016~\017",
           "",
           "",
           "",
           "",
           "",
           "",

           "",
           "",
           "\016z\017",
           "\016}\017",
           "\016w\017",
           "\016x\017",
           "",
           "\0169\017",

           "\016!\017",
           "\016`\017",
           "\016\042\017",
           "\016a\017",
           "\016X\017",
           "\016P\017",
           "\016S\017",
           "\0164\017",

           "\016#\017",
           "\016\134\017",
           "\016$\017",
           "\016%\017",
           "\016f\017",
           "\016e\017",
           "\016\046\017",
           "\016'\017",

           "\016c\017",
           "\0166\017",
           "\016h\017",
           "\016g\017",
           "\016_\017",
           "\016i\017",
           "\016Z\017",
           "",

           "\016R\017",
           "\016-\017",
           "\016m\017",
           "\016.\017",
           "\016[\017",
           "",
           "\016p\017",
           "\016^\017",

           "\016H\017",
           "\016D\017",
           "\016@\017",
           "\016b\017",
           "\016L\017",
           "\016T\017",
           "\016W\017",
           "\0165\017",

           "\016I\017",
           "\016E\017",
           "\016A\017",
           "\016M\017",
           "\016Y\017",
           "\016U\017",
           "\016Q\017",
           "\016]\017",

           "\016d\017",
           "\0167\017",
           "\016J\017",
           "\016F\017",
           "\016B\017",
           "\016j\017",
           "\016N\017",
           "",

           "\016V\017",
           "\016K\017",
           "\016G\017",
           "\016C\017",
           "\016O\017",
           "",
           "\016q\017",
           "\016o\017"
};






static int HPGL_ang = 0, HPGL_x = -10, HPGL_y = -10, HPGL_penstate = -10, HPGL_pentype
= -10, HPGL2_in_pe, HPGL2_lost;





static int HPGL_numpen, HPGL_eject;

static void HPGL_options()
{
    HPGL_numpen = 6;
    HPGL_eject = 0;

    while (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "eje$ct"))
            HPGL_eject = 1;
        else if (isanumber(c_token)) {
            HPGL_numpen = (int) real(&token[c_token].l_val);
            if (HPGL_numpen <= 0) {
                HPGL_numpen = 6;
                int_error("Number of pens must be positive", c_token);
            }
        } else
            int_error("expecting \"eject\" or number of pens", c_token);

        c_token++;
    }


    sprintf(term_options, "%d pens %s", HPGL_numpen,
            HPGL_eject ? "eject" : "noeject");
}

static void HPGL2_options()
{
    struct TERMENTRY *t = term;
    int i;
    double point_size;
    char tmp_options[50];
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        for (i = 0; i < (sizeof(HPGL2_font_table) / sizeof (struct HPGL2_font_str)) &&
             !almost_equals(c_token, HPGL2_font_table[i].compare); i++);
        if (i < (sizeof(HPGL2_font_table) / sizeof (struct HPGL2_font_str))) {
            HPGL2_font = &HPGL2_font_table[i];
        } else
            int_error("expecting font: stick, cg_times, or univers", c_token);
        c_token++;
        if (!(c_token >= num_tokens || equals(c_token,";"))) {
            if ((point_size = real(&token[c_token].l_val)) > 0.0) {
                t->v_char = (int) 1016 *point_size / 72;
                t->h_char = t->v_char * 2 / 3;
                if (HPGL2_font->spacing)
                    HPGL2_font->height = point_size;
                else
                    HPGL2_font->pitch = 72 * 3 / (point_size * 2);
            } else
                int_error("expecting font point size: real number", c_token);
            c_token++;
        }
    }
    sprintf(tmp_options, " %s", HPGL2_font->name);
    strcat(term_options, tmp_options);
    if (HPGL2_font->spacing) {
        sprintf(tmp_options, " %f",
                HPGL2_font->height);
        strcat(term_options, tmp_options);
    } else {
        sprintf(tmp_options, " %f",
                HPGL2_font->pitch);
        strcat(term_options, tmp_options);
    }
}

static void PCL_options()
{
    int i;
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        for (i = 0; i < (sizeof(PCL_mode_table) / sizeof (struct PCL_mode_str)) &&
             !almost_equals(c_token, PCL_mode_table[i].compare); i++);
        if (i < (sizeof(PCL_mode_table) / sizeof (struct PCL_mode_str)))
            PCL_mode = &PCL_mode_table[i];
        else
            int_error("expecting mode: portrait or landscape", c_token);
        c_token++;
    }
    sprintf(term_options, " %s", PCL_mode->name);
    HPGL2_options();
}

static void HPGL_init()
{
}





static void PCL_init()
{
    struct TERMENTRY *t = term;




    fprintf(gpoutfile, "\033E\033&l1X%s\n", PCL_mode->command);
    t->xmax = PCL_mode->xmax;
    t->ymax = PCL_mode->ymax;
}

static void HPGL_graphics()
{
    fputs("\033.Y\n\033.I81;;17:\033.N;19:\033.M500:\n", gpoutfile);



    fprintf(gpoutfile,
            "IN;%s\nSC0,%d,0,%d;\nSR%f,%f;\n",
            ((encoding == 3) || (encoding == 1)) ?
            "CA7;" : "",
            10000, 7500,
            ((double) ((10000/100*12/10)) * 200 / 3 / 10000),
            ((double) ((7500/100*32/10)) * 100 / 2 / 7500));





    HPGL_ang = 0;
}

static void HPGL2_graphics()
{





    fprintf(gpoutfile, "INSP1SD1,%d,2,%d,",
            HPGL2_font->symbol_set, HPGL2_font->spacing);
    if (HPGL2_font->spacing)
        fprintf(gpoutfile, "4,%f,", HPGL2_font->height);
    else
        fprintf(gpoutfile, "3,%f,", HPGL2_font->pitch);
    fprintf(gpoutfile, "5,%d,6,%d,7,%d\n", HPGL2_font->posture,
            HPGL2_font->stroke_weight, HPGL2_font->typeface);



    HPGL_ang = 0;
    HPGL2_in_pe = 0;
    HPGL2_lost = 1;
    HPGL_penstate = 1;
}

static void PCL_graphics()
{



    fputs("\033%0B", gpoutfile);
    HPGL2_graphics();
}

static void HPGL_text()
{
    if (HPGL_eject == 0) {
        fputs("PUSP0;\033.Z\n\0", gpoutfile);





    } else {
        fputs("PUSP0;PG;\033.Z\n\0", gpoutfile);






    }
    HPGL_penstate = 1;
}
# 756 "term/hpgl.trm"
static void PCL_text()
{
    if (HPGL2_in_pe) {
        fputs(";\n", gpoutfile);
        HPGL2_in_pe = 0;
    }



    fputs("\033%1A\033&l0H\n\0", gpoutfile);
}

static void HPGL_linetype(linetype)
int linetype;
{

    linetype = (linetype + 2) % HPGL_numpen + 1;

    if (HPGL_pentype != linetype) {
        fprintf(gpoutfile, "PU;\nSP%d;\n", linetype);
        HPGL_pentype = linetype;
        HPGL_penstate = 1;
    }
}

static void HPGL2_linetype(linetype)
int linetype;
{



    if (HPGL2_in_pe) {
        fputs(";\n", gpoutfile);
        HPGL2_in_pe = 0;
    }



    if (linetype >= 0)
        linetype = linetype % ((sizeof(HPGL2_lt) / sizeof(char *)) * (sizeof(HPGL2_pw) / sizeof(char *)));
    if (linetype != HPGL_pentype) {
        if (linetype >= 0) {
            fprintf(gpoutfile, "PW%sLT%s",
                    HPGL2_pw[linetype / (sizeof(HPGL2_lt) / sizeof(char *))],
                    HPGL2_lt[linetype % (sizeof(HPGL2_lt) / sizeof(char *))]);
        } else if (linetype == -2)



            fprintf(gpoutfile, "PW.2LT");
        else if (linetype == -1)



            fprintf(gpoutfile, "PW.1LT1,.25");
        HPGL_pentype = linetype;
    }
}

static void HPGL_put_text(x, y, str)
unsigned int x, y;
char *str;
{
    if (HPGL_ang == 1)
        HPGL_move(x + (7500/100*32/10) / 4, y);
    else
        HPGL_move(x, y - (7500/100*32/10) / 4);
    if (encoding == 3) {
        unsigned char *s;
        fputs("LB", gpoutfile);
        for (s = (unsigned char *) str; *s; ++s)
            if (*s >= 128 && hpgl_cp_850[*s - 128][0])
                fputs(hpgl_cp_850[*s - 128], gpoutfile);
            else
                _IO_putc (*s, gpoutfile);
        fputs("\003\n", gpoutfile);
    } else if (encoding == 1) {
        unsigned char *s;
        fputs("LB", gpoutfile);
        for (s = (unsigned char *) str; *s; ++s)
            if (*s >= 128 && hpgl_iso_8859_1[*s - 128][0])
                fputs(hpgl_iso_8859_1[*s - 128], gpoutfile);
            else
                _IO_putc (*s, gpoutfile);
        fputs("\003\n", gpoutfile);
    } else
        fprintf(gpoutfile, "LB%s\003\n", str);
}

static void HPGL2_put_text(x, y, str)
unsigned int x, y;
char *str;
{
    struct TERMENTRY *t = term;



    if (HPGL_ang == 1)
        HPGL2_move(x + t->v_char / 4, y);
    else
        HPGL2_move(x, y - t->v_char / 4);



    if (HPGL2_in_pe) {
        fputs(";\n", gpoutfile);
        HPGL2_in_pe = 0;
    }



    fprintf(gpoutfile, "LB%s\003\n", str);
    HPGL2_lost = 1;
}





static void HPGL_move(x, y)
unsigned int x, y;
{
    if (HPGL_x != x || HPGL_y != y) {
        fprintf(gpoutfile, "PU;PA%d,%d;\n", x, y);
        HPGL_penstate = 1;
        HPGL_x = x;
        HPGL_y = y;
    }
}

static void HPGL_vector(x, y)
unsigned int x, y;
{
    if (HPGL_penstate != 0) {
        fprintf(gpoutfile, "PD;PA%d,%d;\n", x, y);
        HPGL_penstate = 0;
    } else
        fprintf(gpoutfile, "PA%d,%d;\n", x, y);
    HPGL_x = x;
    HPGL_y = y;
}

static void HPGL2_move(x, y)
unsigned int x, y;
{
    register int dx, dy;
    if (HPGL2_in_pe) {
        dx = x - HPGL_x;
        dy = y - HPGL_y;
        fputs("<", gpoutfile);
    } else {

        fputs("PE<", gpoutfile);



        if (HPGL2_lost) {
            dx = x;
            dy = y;
            HPGL2_lost = 0;
            fputs("=", gpoutfile);
        } else {
            dx = x - HPGL_x;
            dy = y - HPGL_y;
        }
        HPGL2_in_pe = 1;
    }




    HPGL2_encode(dx);
    HPGL2_encode(dy);
    fputs("\n", gpoutfile);
    HPGL_x = x;
    HPGL_y = y;
}

static void HPGL2_vector(x, y)
unsigned int x, y;
{
    register int dx, dy;
    if (HPGL2_in_pe) {
        dx = x - HPGL_x;
        dy = y - HPGL_y;
    } else {

        fputs("PE", gpoutfile);



        if (HPGL2_lost) {
            dx = x;
            dy = y;
            HPGL2_lost = 0;
            fputs("=", gpoutfile);
        } else {
            dx = x - HPGL_x;
            dy = y - HPGL_y;
        }
        HPGL2_in_pe = 1;
    }
# 969 "term/hpgl.trm"
    HPGL2_encode(dx);
    HPGL2_encode(dy);
    fputs("\n", gpoutfile);
    HPGL_x = x;
    HPGL_y = y;
}





static void HPGL2_encode(d)
register int d;
{
    register int c;
    if ((d <<= 1) < 0)
        d = 1 - d;
    do {
        c = d & 63;
        d >>= 6;
        if (d > 0)
            fputc((char) (c + 63), gpoutfile);
        else
            fputc((char) (c + 191), gpoutfile);
    } while (d > 0);
}

static int HPGL_text_angle(ang)
int ang;
{
    HPGL_ang = ang;
    if (ang == 1)



        fputs("DI0,1;\n", gpoutfile);
    else



        fputs("DI1,0;\n", gpoutfile);
    return 1;
}

static int HPGL2_text_angle(ang)
int ang;
{



    if (HPGL2_in_pe) {
        fputs(";", gpoutfile);
        HPGL2_in_pe = 0;
    }
    if (ang == 1)



        fputs("DI0,1", gpoutfile);
    else



        fputs("DI1,0", gpoutfile);
    HPGL_ang = ang;
    return 1;
}

static void HPGL_reset()
{



}
# 1057 "term/hpgl.trm"
static void PCL_reset()
{




    fputs("\033%0A\033E\n", gpoutfile);
}

static int HPGL2_justify_text(just)
enum JUSTIFY just;
{



    if (HPGL2_in_pe) {
        fputs(";\n", gpoutfile);
        HPGL2_in_pe = 0;
    }
    switch (just) {
    case LEFT:
        fputs("LO1", gpoutfile);
        break;
    case CENTRE:
        fputs("LO4", gpoutfile);
        break;
    case RIGHT:
        fputs("LO7", gpoutfile);
        break;
    default:
        return 0;
    }
    return 1;
}
# 304 "term.h" 2


# 1 "term/hpljii.trm" 1
# 68 "term/hpljii.trm"
# 1 "term/driver.h" 1
# 69 "term/hpljii.trm" 2







static void HPLJIIoptions (void);
static void HPLJIIinit (void);
static void HPLJIIgraphics (void);
static void HPLJIItext (void);
static void HPLJIIlinetype (int linetype);
static void HPLJIIput_text (unsigned int x, unsigned int y, char *str);
static void HPLJIIreset (void);



static void HPDJgraphics (void);
static void HPDJtext (void);
# 123 "term/hpljii.trm"
void HPLJIIputc (unsigned int x, unsigned int y, char c, int ang);
static int hplj_dpp = 4;
# 135 "term/hpljii.trm"
static void HPLJIIoptions()
{
    char opt[4];
    int parse_error = 0;

    if ((c_token >= num_tokens || equals(c_token,";"))) {
        term_options[0] = ('\0');
    } else {
        if (token[c_token].length > 3) {
            parse_error = 1;
        } else {

            capture(opt, c_token, c_token, 4);
            if (!__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (opt) && __builtin_constant_p ("75") && (__s1_len = strlen (opt), __s2_len = strlen ("75"), (!((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("75") + 1) - (size_t)(const void *)("75") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (opt), (__const char *) ("75"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) && (__s1_len = strlen (opt), __s1_len < 4) ? (__builtin_constant_p ("75") && ((size_t)(const void *)(("75") + 1) - (size_t)(const void *)("75") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("75"))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - ((!
__const unsigned char *) (__const char *) ("75"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("75"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("75"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("75"); register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("75") && ((size!
_t)(const void *)(("75") + 1) - (size_t)(const void *)("75") == 1) && (__s2_len = strlen ("75"), __s2_len < 4) ? (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("75"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - ((__const unsigned char *) (__const char *) ("75"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("75"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("75"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (opt); register int __!
result = __s1[0] - ((__const unsigned char *) (__const char *) ("75"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("75"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("75"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("75"))[3]); } } __result; }))) : strcmp (opt, "75")))); })) {
                hplj_dpp = 4;
            } else if (!__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (opt) && __builtin_constant_p ("100") && (__s1_len = strlen (opt), __s2_len = strlen ("100"), (!((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("100") + 1) - (size_t)(const void *)("100") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (opt), (__const char *) ("100"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) && (__s1_len = strlen (opt), __s1_len < 4) ? (__builtin_constant_p ("100") && ((size_t)(const void *)(("100") + 1) - (size_t)(const void *)("100") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("100"))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *!
) (opt))[1] - ((__const unsigned char *) (__const char *) ("100"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("100"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("100"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("100"); register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - __s2[3]); } } __result; }))) : (__builtin_constan!
t_p ("100") && ((size_t)(const void *)(("100") + 1) - (size_t)(const void *)("100") == 1) && (__s2_len = strlen ("100"), __s2_len < 4) ? (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("100"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - ((__const unsigned char *) (__const char *) ("100"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("100"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("100"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const ch!
ar *) (opt); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("100"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("100"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("100"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("100"))[3]); } } __result; }))) : strcmp (opt, "100")))); })) {
                hplj_dpp = 3;
            } else if (!__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (opt) && __builtin_constant_p ("150") && (__s1_len = strlen (opt), __s2_len = strlen ("150"), (!((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("150") + 1) - (size_t)(const void *)("150") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (opt), (__const char *) ("150"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) && (__s1_len = strlen (opt), __s1_len < 4) ? (__builtin_constant_p ("150") && ((size_t)(const void *)(("150") + 1) - (size_t)(const void *)("150") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("150"))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *!
) (opt))[1] - ((__const unsigned char *) (__const char *) ("150"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("150"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("150"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("150"); register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - __s2[3]); } } __result; }))) : (__builtin_constan!
t_p ("150") && ((size_t)(const void *)(("150") + 1) - (size_t)(const void *)("150") == 1) && (__s2_len = strlen ("150"), __s2_len < 4) ? (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("150"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - ((__const unsigned char *) (__const char *) ("150"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("150"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("150"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const ch!
ar *) (opt); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("150"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("150"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("150"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("150"))[3]); } } __result; }))) : strcmp (opt, "150")))); })) {
                hplj_dpp = 2;
            } else if (!__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (opt) && __builtin_constant_p ("300") && (__s1_len = strlen (opt), __s2_len = strlen ("300"), (!((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("300") + 1) - (size_t)(const void *)("300") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (opt), (__const char *) ("300"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) && (__s1_len = strlen (opt), __s1_len < 4) ? (__builtin_constant_p ("300") && ((size_t)(const void *)(("300") + 1) - (size_t)(const void *)("300") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("300"))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *!
) (opt))[1] - ((__const unsigned char *) (__const char *) ("300"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("300"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("300"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("300"); register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - __s2[3]); } } __result; }))) : (__builtin_constan!
t_p ("300") && ((size_t)(const void *)(("300") + 1) - (size_t)(const void *)("300") == 1) && (__s2_len = strlen ("300"), __s2_len < 4) ? (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("300"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - ((__const unsigned char *) (__const char *) ("300"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("300"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("300"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const ch!
ar *) (opt); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("300"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("300"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("300"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("300"))[3]); } } __result; }))) : strcmp (opt, "300")))); })) {
                hplj_dpp = 1;
            } else {

                parse_error = 1;
            }
            c_token++;
        }
    }

    term->xmax = (8*(unsigned int)(xsize*1920/(hplj_dpp)/8.0+0.9));
    term->ymax = (8*(unsigned int)(ysize*1920/(hplj_dpp)/8.0+0.9));
    switch (hplj_dpp) {
    case 1:
        (__extension__ (__builtin_constant_p ("300") ? (((size_t)(const void *)(("300") + 1) - (size_t)(const void *)("300") == 1) && strlen ("300") + 1 <= 8 ? __strcpy_small (term_options, __extension__ (((__const unsigned char *) (__const char *) ("300"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("300"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("300"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("300"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("300"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("300"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("300"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("300"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("300"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("300"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("300"))[4 + 1]) << 8 | ((__const unsigned ch!
ar *) (__const char *) ("300"))[4]), strlen ("300") + 1) : (char *) memcpy (term_options, "300", strlen ("300") + 1)) : strcpy (term_options, "300")));
        term->v_tic = 15;
        term->h_tic = 15;
        break;
    case 2:
        (__extension__ (__builtin_constant_p ("150") ? (((size_t)(const void *)(("150") + 1) - (size_t)(const void *)("150") == 1) && strlen ("150") + 1 <= 8 ? __strcpy_small (term_options, __extension__ (((__const unsigned char *) (__const char *) ("150"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("150"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("150"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("150"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("150"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("150"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("150"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("150"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("150"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("150"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("150"))[4 + 1]) << 8 | ((__const unsigned ch!
ar *) (__const char *) ("150"))[4]), strlen ("150") + 1) : (char *) memcpy (term_options, "150", strlen ("150") + 1)) : strcpy (term_options, "150")));
        term->v_tic = 8;
        term->h_tic = 8;
        break;
    case 3:
        (__extension__ (__builtin_constant_p ("100") ? (((size_t)(const void *)(("100") + 1) - (size_t)(const void *)("100") == 1) && strlen ("100") + 1 <= 8 ? __strcpy_small (term_options, __extension__ (((__const unsigned char *) (__const char *) ("100"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("100"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("100"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("100"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("100"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("100"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("100"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("100"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("100"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("100"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("100"))[4 + 1]) << 8 | ((__const unsigned ch!
ar *) (__const char *) ("100"))[4]), strlen ("100") + 1) : (char *) memcpy (term_options, "100", strlen ("100") + 1)) : strcpy (term_options, "100")));
        term->v_tic = 6;
        term->h_tic = 6;
        break;
    case 4:
        (__extension__ (__builtin_constant_p ("75") ? (((size_t)(const void *)(("75") + 1) - (size_t)(const void *)("75") == 1) && strlen ("75") + 1 <= 8 ? __strcpy_small (term_options, __extension__ (((__const unsigned char *) (__const char *) ("75"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("75"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("75"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("75"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("75"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("75"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("75"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("75"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("75"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("75"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("75"))[4 + 1]) << 8 | ((__const unsigned char *) (__const !
char *) ("75"))[4]), strlen ("75") + 1) : (char *) memcpy (term_options, "75", strlen ("75") + 1)) : strcpy (term_options, "75")));
        term->v_tic = 5;
        term->h_tic = 5;
        break;
    }

    if (parse_error)
        int_error("expecting dots per inch size 75, 100, 150 or 300",
                  c_token);
}


static void HPLJIIinit()
{
    term->v_char = ((300/(hplj_dpp))/6);
    term->h_char = ((300/(hplj_dpp))/10);
}


static void HPLJIIgraphics()
{
    fputs("\033(0N\033(s0p10.0h12.0v0s0b3T\033&l6D",gpoutfile);
    fputs("\033&f0S",gpoutfile);


    b_makebitmap((8*(unsigned int)(ysize*1920/(hplj_dpp)/8.0+0.9)), (8*(unsigned int)(xsize*1920/(hplj_dpp)/8.0+0.9)), 1);
    b_rastermode = 1;
}



static void HPLJIItext()
{
    register int x, j, row;

    fprintf(gpoutfile, "\033*t%dR", (300/(hplj_dpp)));
    fputs("\033&f1S",gpoutfile);
    fputs("\033*r1A", gpoutfile);


    for (x = b_xsize - 1; x >= 0; x--) {
        row = (b_ysize / 8) - 1;
        fprintf(gpoutfile, "\033*b0m%dW", b_ysize / 8);
        for (j = row; j >= 0; j--) {
            (void) fputc((char) (*((*b_p)[j] + x)), gpoutfile);
        }
    }
    fputs("\033*rB", gpoutfile);

    b_freebitmap();



    _IO_putc ('\f', gpoutfile);

}



static void HPLJIIlinetype(linetype)
int linetype;
{

    if (hplj_dpp == 1) {
        if (linetype >= 7)
            linetype %= 7;

        b_linemask = b_300ppi_pattern[linetype + 2];
        b_maskcount = 0;
    } else {
        b_setlinetype(linetype);
    }
}

static void HPLJIIput_text(x, y, str)
unsigned int x, y;
char *str;
{
    switch (b_angle) {
    case 0:
        y -= ((300/(hplj_dpp))/6) / 5;
        fputs("\033&f1S",gpoutfile);
        fputs("\033&f0S",gpoutfile);

        fprintf(gpoutfile, "\033*p%+dx%+dY", x * (hplj_dpp)
                ,((8*(unsigned int)(ysize*1920/(hplj_dpp)/8.0+0.9)) - y - 1) * (hplj_dpp));
        fputs(str, gpoutfile);


        break;
    case 1:
        y += (((300/(hplj_dpp))/10) - 2 * ((300/(hplj_dpp))/6)) / 2;
        y += (((300/(hplj_dpp))/6) + ((300/(hplj_dpp))/10)) * strlen(str) / 2;
        for (; *str; ++str, y -= ((300/(hplj_dpp))/6))
            HPLJIIputc(x, y, *str, b_angle);
        break;
    }
}


void HPLJIIputc(unsigned int x, unsigned int y, char c, int ang)






{
    fputs("\033&f1S",gpoutfile);
    fputs("\033&f0S",gpoutfile);

    fprintf(gpoutfile, "\033*p%+dx%+dY", x * (hplj_dpp)
            ,((8*(unsigned int)(ysize*1920/(hplj_dpp)/8.0+0.9)) - y - 1) * (hplj_dpp));
    fputc(c, gpoutfile);
}


static void HPLJIIreset()
{



}



static void HPDJgraphics()
{
    switch (hplj_dpp) {
    case 1:
        b_charsize(2);
        term->v_char = 31;
        term->h_char = 19;
        break;
    case 2:
        b_charsize(2);
        term->v_char = 31;
        term->h_char = 19;
        break;
    case 3:
        b_charsize(1);
        term->v_char = 21;
        term->h_char = 13;
        break;
    case 4:
        b_charsize(0);
        term->v_char = 11;
        term->h_char = 7;
        break;
    }


    b_makebitmap((8*(unsigned int)(ysize*1920/(hplj_dpp)/8.0+0.9)), (8*(unsigned int)(xsize*1920/(hplj_dpp)/8.0+0.9)), 1);
    b_rastermode = 1;
}




static void HPDJtext()
{
    register int x, j, row;

    fprintf(gpoutfile, "\033*b0M\033*t%dR\033*r1A",



            (300/(hplj_dpp)));


    for (x = b_xsize - 1; x >= 0; x--) {
        row = (b_ysize / 8) - 1;
        fprintf(gpoutfile, "\033*b%dW", b_ysize / 8);
        for (j = row; j >= 0; j--) {
            (void) fputc((char) (*((*b_p)[j] + x)), gpoutfile);
        }
    }
    fputs("\033*rbC", gpoutfile);

    b_freebitmap();


    _IO_putc ('\f', gpoutfile);

}
# 307 "term.h" 2


# 1 "term/hppj.trm" 1
# 64 "term/hppj.trm"
# 1 "term/driver.h" 1
# 65 "term/hppj.trm" 2






static void HPPJoptions (void);
static void HPPJinit (void);
static void HPPJreset (void);
static void HPPJgraphics (void);
static void HPPJtext (void);
static void HPPJlinetype (int linetype);
# 100 "term/hppj.trm"
static int hppj_font = 1;

static void HPPJoptions()
{
    char opt[10];


    term_options[0] = ('\0');
    hppj_font = 1;

    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (token[c_token].length > 8) {
            int_error("expecting font size FNT5X9, FNT9X17, or FNT13X25", c_token);
        }
        capture(opt, c_token, c_token, 9);
        if (!__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (opt) && __builtin_constant_p ("FNT5X9") && (__s1_len = strlen (opt), __s2_len = strlen ("FNT5X9"), (!((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FNT5X9") + 1) - (size_t)(const void *)("FNT5X9") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (opt), (__const char *) ("FNT5X9"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) && (__s1_len = strlen (opt), __s1_len < 4) ? (__builtin_constant_p ("FNT5X9") && ((size_t)(const void *)(("FNT5X9") + 1) - (size_t)(const void *)("FNT5X9") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("FNT5X9"))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *)!
 (__const char *) (opt))[1] - ((__const unsigned char *) (__const char *) ("FNT5X9"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("FNT5X9"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("FNT5X9"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("FNT5X9"); register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - __s2[3]); } } __resul!
t; }))) : (__builtin_constant_p ("FNT5X9") && ((size_t)(const void *)(("FNT5X9") + 1) - (size_t)(const void *)("FNT5X9") == 1) && (__s2_len = strlen ("FNT5X9"), __s2_len < 4) ? (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("FNT5X9"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - ((__const unsigned char *) (__const char *) ("FNT5X9"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("FNT5X9"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("FNT5X9"))[3]); } } __result; })) : (__extension__ ({ __const unsigne!
d char *__s1 = (__const unsigned char *) (__const char *) (opt); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("FNT5X9"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("FNT5X9"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("FNT5X9"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("FNT5X9"))[3]); } } __result; }))) : strcmp (opt, "FNT5X9")))); })) {
            hppj_font = 0;
            (__extension__ (__builtin_constant_p ("FNT5X9") ? (((size_t)(const void *)(("FNT5X9") + 1) - (size_t)(const void *)("FNT5X9") == 1) && strlen ("FNT5X9") + 1 <= 8 ? __strcpy_small (term_options, __extension__ (((__const unsigned char *) (__const char *) ("FNT5X9"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("FNT5X9"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("FNT5X9"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("FNT5X9"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("FNT5X9"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("FNT5X9"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("FNT5X9"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("FNT5X9"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("FNT5X9"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("FNT5X9"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *)!
 ("FNT5X9"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("FNT5X9"))[4]), strlen ("FNT5X9") + 1) : (char *) memcpy (term_options, "FNT5X9", strlen ("FNT5X9") + 1)) : strcpy (term_options, "FNT5X9")));
        } else if (!__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (opt) && __builtin_constant_p ("FNT9X17") && (__s1_len = strlen (opt), __s2_len = strlen ("FNT9X17"), (!((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FNT9X17") + 1) - (size_t)(const void *)("FNT9X17") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (opt), (__const char *) ("FNT9X17"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) && (__s1_len = strlen (opt), __s1_len < 4) ? (__builtin_constant_p ("FNT9X17") && ((size_t)(const void *)(("FNT9X17") + 1) - (size_t)(const void *)("FNT9X17") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("FNT9X17"))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const !
unsigned char *) (__const char *) (opt))[1] - ((__const unsigned char *) (__const char *) ("FNT9X17"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("FNT9X17"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("FNT9X17"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("FNT9X17"); register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - _!
_s2[3]); } } __result; }))) : (__builtin_constant_p ("FNT9X17") && ((size_t)(const void *)(("FNT9X17") + 1) - (size_t)(const void *)("FNT9X17") == 1) && (__s2_len = strlen ("FNT9X17"), __s2_len < 4) ? (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("FNT9X17"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - ((__const unsigned char *) (__const char *) ("FNT9X17"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("FNT9X17"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("FNT9X17"))[3]); } } __result; })) : (__ex!
tension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (opt); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("FNT9X17"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("FNT9X17"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("FNT9X17"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("FNT9X17"))[3]); } } __result; }))) : strcmp (opt, "FNT9X17")))); })) {
            hppj_font = 1;
            (__extension__ (__builtin_constant_p ("FNT9X17") ? (((size_t)(const void *)(("FNT9X17") + 1) - (size_t)(const void *)("FNT9X17") == 1) && strlen ("FNT9X17") + 1 <= 8 ? __strcpy_small (term_options, __extension__ (((__const unsigned char *) (__const char *) ("FNT9X17"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("FNT9X17"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("FNT9X17"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("FNT9X17"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("FNT9X17"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("FNT9X17"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("FNT9X17"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("FNT9X17"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("FNT9X17"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("FNT9X17"))[4 + 2]) << 8 | ((__const unsigned char *) (_!
_const char *) ("FNT9X17"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("FNT9X17"))[4]), strlen ("FNT9X17") + 1) : (char *) memcpy (term_options, "FNT9X17", strlen ("FNT9X17") + 1)) : strcpy (term_options, "FNT9X17")));
        } else if (!__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (opt) && __builtin_constant_p ("FNT13X25") && (__s1_len = strlen (opt), __s2_len = strlen ("FNT13X25"), (!((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("FNT13X25") + 1) - (size_t)(const void *)("FNT13X25") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (opt), (__const char *) ("FNT13X25"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) && (__s1_len = strlen (opt), __s1_len < 4) ? (__builtin_constant_p ("FNT13X25") && ((size_t)(const void *)(("FNT13X25") + 1) - (size_t)(const void *)("FNT13X25") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("FNT13X25"))[0]); if (__s1_len > 0 && __result == 0) { __result = ((!
(__const unsigned char *) (__const char *) (opt))[1] - ((__const unsigned char *) (__const char *) ("FNT13X25"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("FNT13X25"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("FNT13X25"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("FNT13X25"); register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) !
(opt))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("FNT13X25") && ((size_t)(const void *)(("FNT13X25") + 1) - (size_t)(const void *)("FNT13X25") == 1) && (__s2_len = strlen ("FNT13X25"), __s2_len < 4) ? (__builtin_constant_p (opt) && ((size_t)(const void *)((opt) + 1) - (size_t)(const void *)(opt) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (opt))[0] - ((__const unsigned char *) (__const char *)("FNT13X25"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[1] - ((__const unsigned char *) (__const char *) ("FNT13X25"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (opt))[2] - ((__const unsigned char *) (__const char *) ("FNT13X25"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (opt))[3] - ((__const unsigned char *) (__const char *) ("FNT13X25"))[3]); } } !
__result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (opt); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("FNT13X25"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("FNT13X25"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("FNT13X25"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("FNT13X25"))[3]); } } __result; }))) : strcmp (opt, "FNT13X25")))); })) {
            hppj_font = 2;
            (__extension__ (__builtin_constant_p ("FNT13X25") ? (((size_t)(const void *)(("FNT13X25") + 1) - (size_t)(const void *)("FNT13X25") == 1) && strlen ("FNT13X25") + 1 <= 8 ? __strcpy_small (term_options, __extension__ (((__const unsigned char *) (__const char *) ("FNT13X25"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("FNT13X25"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("FNT13X25"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("FNT13X25"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("FNT13X25"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("FNT13X25"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("FNT13X25"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("FNT13X25"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("FNT13X25"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("FNT13X25"))[4 + 2]) << 8 | ((__const unsig!
ned char *) (__const char *) ("FNT13X25"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("FNT13X25"))[4]), strlen ("FNT13X25") + 1) : (char *) memcpy (term_options, "FNT13X25", strlen ("FNT13X25") + 1)) : strcpy (term_options, "FNT13X25")));
        } else {
            int_error("expecting font size FNT5X9, FNT9X17, or FNT13X25", c_token);
        }
        c_token++;
    }
}


static void HPPJinit()
{


    switch (hppj_font) {
    case 0:
        term->v_char = 11;
        term->h_char = 7;
        term->v_tic = 11 / 2;
        term->h_tic = 7 / 2;
        break;
    case 1:
        term->v_char = 21;
        term->h_char = 13;
        term->v_tic = 21 / 2;
        term->h_tic = 13 / 2;
        break;
    case 2:
        term->v_char = 31;
        term->h_char = 19;
        term->v_tic = 31 / 2;
        term->h_tic = 19 / 2;
        break;
    }
}


static void HPPJreset()
{



}


static void HPPJgraphics()
{

    b_charsize(hppj_font);

    b_makebitmap((8*(unsigned int)(9.5 * 180 / 8.0 + 0.9)), (8 * 180), 3);
}


static void HPPJtext()
{
    int x, plane, y;
    int minRow, maxRow;
    int numBytes;
    int numReps;

    fprintf(gpoutfile, "\033E\033*t%dR\033*r%dS\033*b0X\033*b0Y\033*r%dU\033*v%dA\033*v%dB\033*v%dC\033*v%dI\033*v%dA\033*v%dB\033*v%dC\033*v%dI\033*v%dA\033*v%dB\033*v%dC\033*v%dI\033*v%dA\033*v%dB\033*v%dC\033*v%dI\033*v%dA\033*v%dB\033*v%dC\033*v%dI\033*v%dA\033*v%dB\033*v%dC\033*v%dI\033*v%dA\033*v%dB\033*v%dC\033*v%dI\033*v%dA\033*v%dB\033*v%dC\033*v%dI\033*b1M\033*r1A",
# 195 "term/hppj.trm"
            180, (8 * 180),
            3,
            90, 88, 85, 0,
            53, 8, 14, 1,
            3, 26, 22, 2,
            4, 4, 29, 3,
            53, 5, 25, 4,
            2, 22, 64, 5,
            89, 83, 13, 6,
            4, 4, 6, 7);


    for (x = (8*(unsigned int)(9.5 * 180 / 8.0 + 0.9)) - 1; x >= 0; --x) {
        for (plane = 0; plane < 3; plane++) {
            minRow = b_psize * plane;
            maxRow = b_psize * plane + b_psize - 1;


            numBytes = 0;
            for (y = maxRow; y >= minRow; --y) {
                if (y == minRow || *((*b_p)[y] + x) != *((*b_p)[y - 1] + x)) {
                    numBytes += 2;
                }
            }
            fprintf(gpoutfile, "\033*b%d", numBytes);
            (void) fputc((char) (plane < 3 - 1 ? 'V' : 'W'), gpoutfile);


            numReps = 0;
            for (y = maxRow; y >= minRow; --y) {
                if (y == minRow || *((*b_p)[y] + x) != *((*b_p)[y - 1] + x)) {
                    (void) fputc((char) (numReps), gpoutfile);
                    (void) fputc((char) (*((*b_p)[y] + x)), gpoutfile);
                    numReps = 0;
                } else {
                    numReps++;
                }
            }
        }
    }
    fputs("\033*r1B\033E", gpoutfile);

    b_freebitmap();
}


static void HPPJlinetype(linetype)
int linetype;
{
    if (linetype >= 0) {
        b_setlinetype(0);
        b_setvalue((linetype % ((1 << 3) - 1)) + 1);
    } else {
        b_setlinetype(linetype + 2);
        b_setvalue((1 << 3) - 1);
    }
}
# 310 "term.h" 2


# 1 "term/imagen.trm" 1
# 63 "term/imagen.trm"
# 1 "term/driver.h" 1
# 64 "term/imagen.trm" 2






static void IMAGEN_init (void);
static void IMAGEN_graphics (void);
static void IMAGEN_options (void);
static void IMAGEN_text (void);
static void IMAGEN_linetype (int lt);
static void IMAGEN_move (unsigned int x, unsigned int y);
static void IMAGEN_vector (unsigned int ux, unsigned int uy);
static int IMAGEN_text_angle (int ang);
static int IMAGEN_justify_text (enum JUSTIFY mode);
static void IMAGEN_put_text (unsigned int x, unsigned int y, char str[]);
static void IMAGEN_reset (void);
# 93 "term/imagen.trm"
static void IM_page (void);
static void IMAGEN_draw_path (void);
static void IMAGEN_setpos (int ux, int uy);
static unsigned char *IMAGEN_cvts (unsigned char *str, int *width, int *height);
static void IMAGEN_putwd (unsigned int w);
static void IMAGEN_createfamily (char *c, int sz);
static void IMAGEN_setfont (int sz);
void IMP_set_draw_pattern (int pattern, int sz);
void IMAGEN_mapsinit (void);
void IMAGEN_createmap (int name, unsigned short *map);







# 1 "term/impcodes.h" 1
# 111 "term/imagen.trm" 2






static int IMAGEN_Xmax = ((300) * 11);
static int IMAGEN_Ymax = ((300) * 78 / 10);





unsigned short IMP_gmap[128];
unsigned char IMP_chmap[256];

static int IMAGEN_page_h = ((300) * 83 / 10);
static int IMAGEN_page_w = ((300) * 116 / 10);
static int IM_win_horiz = 1;
static int IM_win_verti = 1;
static int IM_plot_nr = 0;

static int IMAGEN_fontsize = 12;
static int IMAGEN_familytable[36];
static int IMAGEN_orgX;
static int IMAGEN_orgY;
static int IMAGEN_orgx;
static int IMAGEN_orgy;
static int IMAGEN_posx;
static int IMAGEN_posy;

static int IMAGEN_xmax = ((300) * 11);
static int IMAGEN_ymax = ((300) * 78 / 10);
static int IMAGEN_winx = ((300) * 11);
static int IMAGEN_winy = ((300) * 78 / 10);
static int IMAGEN_hchar;
static int IMAGEN_wchar;
static int IMAGEN_blofs;
static int IMAGEN_angle = -1;
static int IMAGEN_portrait;
static enum JUSTIFY IMAGEN_justify = LEFT;


unsigned int IM_xvector[100];
unsigned int IM_yvector[100];
unsigned int IM_veclen;
unsigned int IM_vecpos = 0;






char IMPdrpattern[10][10] =
{
         {0},
         {1, 8, 0},
         {0},
         {16, 4, 0},
         {3, 8, 0},
         {8, 8, 0},
         {16, 6, 3, 6, 0},
         {16, 6, 8, 6, 0},
         {16, 4, 1, 4, 8, 4, 1, 4, 0},
         {16, 4, 1, 8, 1, 4, 0}
};

static void IMAGEN_init()
{
    register struct TERMENTRY *t = term;



    IMAGEN_posx = IMAGEN_posy = 0;

    IMAGEN_orgX = (IMAGEN_page_w - IMAGEN_Xmax) / 2;
    IMAGEN_orgY = (IMAGEN_page_h - IMAGEN_Ymax) / 2;

    IMAGEN_xmax = IMAGEN_winx = (int) (IMAGEN_Xmax / IM_win_horiz);
    IMAGEN_ymax = IMAGEN_winy = (int) (IMAGEN_Ymax / IM_win_verti);

    t->xmax = (unsigned int) (IMAGEN_xmax);
    t->ymax = (unsigned int) (IMAGEN_ymax);

    fputs("@document(language impress, paper a4)", gpoutfile);

    if (IMAGEN_portrait) {
        _IO_putc (137, gpoutfile);
        IMAGEN_putwd(3520);
    }
    _IO_putc (205, gpoutfile);
    _IO_putc (((IMAGEN_portrait ? 3 : 0) << 5) | (3 << 3) | (IMAGEN_portrait ? 0 : 5), gpoutfile);


    IMAGEN_mapsinit();
    IMAGEN_createmap(1, IMP_gmap);

    IMAGEN_setfont(IMAGEN_fontsize);

    IMAGEN_text_angle(0);

    _IO_putc (135, gpoutfile);
    IMAGEN_putwd(0);
    _IO_putc (137, gpoutfile);
    IMAGEN_putwd(0);

    IMAGEN_linetype(-1);
# 228 "term/imagen.trm"
    IM_veclen = 100;
    IM_vecpos = 0;
}

static void IM_page()
{
    if (IM_vecpos) {

        IMAGEN_draw_path();
    }
    _IO_putc (219, gpoutfile);
}

static void IMAGEN_graphics()
{
    int tmpx, tmpy;


    if (IM_vecpos) {

        IMAGEN_draw_path();
    }
    if (IM_plot_nr >= (IM_win_horiz * IM_win_verti)) {
        IM_page();
        IM_plot_nr = 0;
    }
    IM_plot_nr++;
    tmpx = IMAGEN_orgX + ((IM_plot_nr - 1) % IM_win_horiz) * IMAGEN_winx;
    tmpy = IMAGEN_orgY + ((IM_win_verti - 1) - (int) ((IM_plot_nr - 1) / IM_win_horiz)) * IMAGEN_winy;
    IMAGEN_orgx = tmpx + (int) ((IMAGEN_winx - IMAGEN_xmax) / 2);
    IMAGEN_orgy = tmpy + (int) ((IMAGEN_winy - IMAGEN_ymax) / 2);
}

static void IMAGEN_options()
{
    struct value a;

    while (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "p$ortrait")) {
            IMAGEN_portrait = 1;
            IMAGEN_page_h = ((300) * 116 / 10);
            IMAGEN_page_w = ((300) * 83 / 10);
            IMAGEN_Xmax = ((300) * 78 / 10);
            IMAGEN_Ymax = ((300) * 11);
            c_token++;
        } else if (almost_equals(c_token, "l$andscape")) {
            IMAGEN_portrait = 0;
            c_token++;
        } else if (equals(c_token, "[")) {
            c_token++;

            if (equals(c_token, "]")) {
                IM_page();
                c_token++;
                continue;
            }
            if ((c_token >= num_tokens || equals(c_token,";"))) {
                int_error("no. windows: [horizontal,vertical] expected", c_token);
            } else if (!equals(c_token, ",")) {
                IM_win_horiz = (int) real(const_express(&a));
            }
            if (!equals(c_token, ","))
                int_error("',' expected", c_token);
            c_token++;
            if (!equals(c_token, "]")) {
                IM_win_verti = (int) real(const_express(&a));
            }
            if (!equals(c_token, "]"))
                int_error("expecting ']'", c_token);
            c_token++;
        } else {

            IMAGEN_fontsize = (int) real(const_express(&a));
            if (IMAGEN_fontsize < 8)
                IMAGEN_fontsize = 8;
            if (IMAGEN_fontsize > 15)
                IMAGEN_fontsize = 15;
        }
    }
    sprintf(term_options, "%d %s [%1d,%1d]", IMAGEN_fontsize, (IMAGEN_portrait) ? "portrait" :
            "landscape", IM_win_horiz, IM_win_verti);
}


static void IMAGEN_text()
{
}





static void IMAGEN_linetype(lt)
int lt;
{
    static int lastlinetype = -10;
    int pen ;

    if (IM_vecpos) {

        IMAGEN_draw_path();
    }





    if (lt == -2) {
        pen = 4;
    } else {
        pen = (int) (lt / 8) * 2;
        if (pen <= 0)
            pen = 1;
    }
    lt = (lt % 8) + 2;

    if (lastlinetype == lt)
        return;

    lastlinetype = lt;

    _IO_putc (232, gpoutfile);
    _IO_putc (pen, gpoutfile);
    IMP_set_draw_pattern(lt, pen);
}


static void IMAGEN_move(x, y)
unsigned int x, y;
{
    if (IM_vecpos) {

        IMAGEN_draw_path();
    }
    IM_xvector[0] = x + IMAGEN_orgx;
    IM_yvector[0] = y + IMAGEN_orgy;

    IM_vecpos = 1;




}

static void IMAGEN_vector(ux, uy)
unsigned int ux, uy;
{



    IM_xvector[IM_vecpos] = ux + IMAGEN_orgx;
    IM_yvector[IM_vecpos] = uy + IMAGEN_orgy;

    IM_vecpos++;
    if (IM_vecpos >= IM_veclen) {
        IMAGEN_draw_path();
        IM_xvector[0] = ux + IMAGEN_orgx;
        IM_yvector[0] = uy + IMAGEN_orgy;
        IM_vecpos = 1;
    }
}

static void IMAGEN_draw_path()
{

    register int i;

    _IO_putc (230, gpoutfile);
    IMAGEN_putwd(IM_vecpos);
    for (i = 0; i < IM_vecpos; i++) {




        IMAGEN_putwd(IM_xvector[i]);
        IMAGEN_putwd(IM_yvector[i]);
    }
    IM_vecpos = 0;


    _IO_putc (234, gpoutfile);
    _IO_putc (15, gpoutfile);




}

static void IMAGEN_setpos(ux, uy)
int ux, uy;
{


    _IO_putc (135, gpoutfile);
    IMAGEN_putwd(ux + IMAGEN_orgx);
    _IO_putc (137, gpoutfile);
    IMAGEN_putwd(uy + IMAGEN_orgy);
    _IO_putc (209, gpoutfile);
    if (IMAGEN_angle == 1)
        IMAGEN_putwd(uy + IMAGEN_orgx);
    else
        IMAGEN_putwd(ux + IMAGEN_orgx);
}

static int IMAGEN_text_angle(ang)
int ang;
{

    if (IM_vecpos) {

        IMAGEN_draw_path();
    }
    if (IMAGEN_angle != ang) {
        IMAGEN_angle = ang;
        _IO_putc (206, gpoutfile);
        _IO_putc (ang == 0 ? 0 : 7, gpoutfile);
    }
    return (1);
}

static int IMAGEN_justify_text(mode)
enum JUSTIFY mode;
{
    if (IM_vecpos) {

        IMAGEN_draw_path();
    }
    IMAGEN_justify = mode;
    return (1);
}

static unsigned char *IMAGEN_cvts(str, width, height)
unsigned char *str;
int *width;
int *height;
{
    unsigned char *cp1;
    unsigned char *cp2;
    static unsigned char *buf = ((void *)0);
    int h;
    int maxw;
    int w;





    if (buf != ((void *)0))
        (void) free(buf);
    buf = (unsigned char *) gp_alloc(strlen((char *) str), "converted label string");



    cp1 = str;
    cp2 = buf;
    h = 1;
    maxw = 0;
    w = 0;
    while (strlen((char *) cp1) > 0) {
        switch (*cp1) {
        case ' ':
            *cp2++ = 128;
            w++;
            break;

        case '\\':
            if (*++cp1 == '\\') {

                h++;
                if (w > maxw)
                    maxw = w;
                w = 0;
                *cp2++ = '\n';

                break;
            }


        default:

            *cp2++ = IMP_chmap[*cp1];
            w++;
            break;
        }
        cp1++;
    }

    *cp2++ = '\n';
    *cp2 = '\0';
    if (w > maxw)
        maxw = w;

    if (height != ((void *)0))
        *height = IMAGEN_angle ?
            IMAGEN_wchar * maxw :
            IMAGEN_hchar * h;
    if (width != ((void *)0))
        *width = IMAGEN_angle ?
            IMAGEN_hchar * h :
            IMAGEN_wchar * maxw;
    return (buf);
}

static void IMAGEN_put_text(x, y, str)
unsigned int x, y;
char str[];
{
    unsigned char *cvstr, *p;
    int height;
    int width;
    int sx, sy;

    if (IM_vecpos) {

        IMAGEN_draw_path();
    }
    cvstr = IMAGEN_cvts((unsigned char *) str, &width, &height);

    if (IMAGEN_angle) {

        x -= width / 2 - IMAGEN_hchar;

    } else
        y += height / 2 - IMAGEN_hchar;

    while ((p = (unsigned char *) (__extension__ (__builtin_constant_p ('\n') && ('\n') == '\0' ? (char *) __rawmemchr ((char *) cvstr, '\n') : strchr ((char *) cvstr, '\n'))))) {
        *p = '\0';
        sx = x;
        sy = y;
        if (IMAGEN_angle)
            sx = x - IMAGEN_blofs;
        else
            sy = y + IMAGEN_blofs;

        width = strlen((char *) cvstr) * IMAGEN_wchar;

        switch (IMAGEN_justify) {
        case LEFT:
            break;
        case CENTRE:
            if (IMAGEN_angle) {
                sy = y - width / 2;
            } else {
                sx = x - width / 2;
            }
            break;

        case RIGHT:
            if (IMAGEN_angle) {
                sy = y - width;
            } else {
                sx = x - width;
            }
            break;

        }

        IMAGEN_setpos(sx, sy);
        fputs((char *) cvstr, gpoutfile);
        cvstr = ++p;
        if (IMAGEN_angle) {
            x += IMAGEN_hchar;
        } else {
            y -= IMAGEN_hchar;
        }

    }
}

static void IMAGEN_reset()
{
    if (IM_vecpos) {

        IMAGEN_draw_path();
    }
    _IO_putc (255, gpoutfile);
}

static void IMAGEN_putwd(w)
unsigned int w;
{

    _IO_putc (w >> 8, gpoutfile);
    _IO_putc (w, gpoutfile);
}

static void IMAGEN_createfamily(c, sz)
char *c;
int sz;
{

    _IO_putc (221, gpoutfile);
    _IO_putc (sz, gpoutfile);
    _IO_putc (1, gpoutfile);
    _IO_putc (1, gpoutfile);

    fputs(c, gpoutfile);
    _IO_putc (0, gpoutfile);
}

static void IMAGEN_setfont(sz)
int sz;
{
    char font[20];

    if (!IMAGEN_familytable[sz]) {
        sprintf(font, "%s%02d", "cour", sz);
        IMAGEN_createfamily(font, sz);
        IMAGEN_familytable[sz] = sz;
    }
    IMAGEN_hchar = sz * 5;
    IMAGEN_wchar = IMAGEN_hchar / 2;
    IMAGEN_blofs = IMAGEN_hchar / 3;
    term->v_char = IMAGEN_hchar;
    term->h_char = IMAGEN_wchar;
    _IO_putc (207, gpoutfile);
    _IO_putc (sz, gpoutfile);
    _IO_putc (210, gpoutfile);
    IMAGEN_putwd(IMAGEN_wchar);
    _IO_putc (208, gpoutfile);
    IMAGEN_putwd(IMAGEN_hchar);
}

void IMP_set_draw_pattern(pattern, sz)
int pattern, sz;
{
    int i ;
    _IO_putc (237, gpoutfile);
    _IO_putc (0, gpoutfile);
    _IO_putc (237, gpoutfile);




    _IO_putc (strlen(IMPdrpattern[pattern]), gpoutfile);
    for (i = 0; i < strlen(IMPdrpattern[pattern]); i++) {
        IMAGEN_putwd(IMPdrpattern[pattern][i] * sz);
    }
}


void IMAGEN_mapsinit()
{

    register int i ;

    for (i = 32; i < 127; i++) {
        IMP_gmap[i] = i;
    }
    IMP_gmap[1] = 225;
    IMP_gmap[2] = 233;
    IMP_gmap[3] = 61736;
    IMP_gmap[4] = 241;
    IMP_gmap[5] = 249;
    IMP_gmap[6] = 61864;
    IMP_gmap[7] = 162;
    IMP_gmap[8] = 163;
    IMP_gmap[9] = 164;
    IMP_gmap[10] = 165;
    IMP_gmap[11] = 167;
    IMP_gmap[12] = 171;
    IMP_gmap[13] = 182;
    IMP_gmap[14] = 61346;
    IMP_gmap[15] = 191;
    IMP_gmap[16] = 187;
    IMP_gmap[17] = 188;
    IMP_gmap[18] = 189;
    IMP_gmap[19] = 190;
    IMP_gmap[20] = 210;
    IMP_gmap[21] = 211;
    IMP_gmap[22] = 251;
    IMP_gmap[23] = 61232;
    IMP_gmap[24] = 212;
    IMP_gmap[25] = 137;
    IMP_gmap[26] = 176;
    IMP_gmap[27] = 161;
    IMP_gmap[28] = 139;
    IMP_gmap[29] = 133;
    IMP_gmap[30] = 140;
    IMP_gmap[31] = 61249;
    IMP_gmap[32] = 8738;
    IMP_gmap[34] = 186;
    IMP_gmap[36] = 164;
    IMP_gmap[39] = 185;
    IMP_gmap[127] = 61286;



    for (i = 32; i <= 127; i++) {
        IMP_chmap[i] = i;
    }
    for (i = 128; i <= 255; i++) {
        IMP_chmap[i] = 128;
    }

    IMP_chmap[161] = 27;
    IMP_chmap[162] = 7;
    IMP_chmap[163] = 8;
    IMP_chmap[164] = 120;
    IMP_chmap[165] = 10;
    IMP_chmap[166] = 124;
    IMP_chmap[167] = 11;
    IMP_chmap[168] = 25;
    IMP_chmap[169] = 21;
    IMP_chmap[170] = 45;
    IMP_chmap[171] = 12;
    IMP_chmap[172] = 83;
    IMP_chmap[173] = 45;
    IMP_chmap[174] = 20;
    IMP_chmap[175] = 126;
    IMP_chmap[176] = 26;
    IMP_chmap[177] = 12;
    IMP_chmap[178] = 1;
    IMP_chmap[179] = 2;
    IMP_chmap[180] = 29;
    IMP_chmap[181] = 52;
    IMP_chmap[182] = 13;
    IMP_chmap[183] = 5;
    IMP_chmap[184] = 28;
    IMP_chmap[185] = 3;
    IMP_chmap[186] = 45;
    IMP_chmap[187] = 16;
    IMP_chmap[188] = 17;
    IMP_chmap[189] = 18;
    IMP_chmap[190] = 19;
    IMP_chmap[191] = 15;
    IMP_chmap[192] = 65;
    IMP_chmap[193] = 65;
    IMP_chmap[194] = 65;
    IMP_chmap[195] = 65;
    IMP_chmap[196] = 65;
    IMP_chmap[197] = 3;
    IMP_chmap[198] = 1;
    IMP_chmap[199] = 67;
    IMP_chmap[200] = 69;
    IMP_chmap[201] = 69;
    IMP_chmap[202] = 69;
    IMP_chmap[203] = 69;
    IMP_chmap[204] = 73;
    IMP_chmap[205] = 73;
    IMP_chmap[206] = 73;
    IMP_chmap[207] = 73;
    IMP_chmap[208] = 68;
    IMP_chmap[209] = 78;
    IMP_chmap[210] = 79;
    IMP_chmap[211] = 79;
    IMP_chmap[212] = 79;
    IMP_chmap[213] = 79;
    IMP_chmap[214] = 79;
    IMP_chmap[215] = 13;
    IMP_chmap[216] = 2;
    IMP_chmap[217] = 85;
    IMP_chmap[218] = 85;
    IMP_chmap[219] = 85;
    IMP_chmap[220] = 85;
    IMP_chmap[221] = 89;
    IMP_chmap[222] = 32;
    IMP_chmap[223] = 22;
    IMP_chmap[224] = 97;
    IMP_chmap[225] = 97;
    IMP_chmap[226] = 97;
    IMP_chmap[227] = 97;
    IMP_chmap[228] = 97;
    IMP_chmap[229] = 6;
    IMP_chmap[230] = 4;
    IMP_chmap[231] = 99;
    IMP_chmap[232] = 101;
    IMP_chmap[233] = 101;
    IMP_chmap[234] = 101;
    IMP_chmap[235] = 101;
    IMP_chmap[236] = 105;
    IMP_chmap[237] = 105;
    IMP_chmap[238] = 105;
    IMP_chmap[239] = 105;
    IMP_chmap[240] = 100;
    IMP_chmap[241] = 110;
    IMP_chmap[242] = 111;
    IMP_chmap[243] = 111;
    IMP_chmap[244] = 111;
    IMP_chmap[245] = 111;
    IMP_chmap[246] = 111;
    IMP_chmap[247] = 10;
    IMP_chmap[248] = 5;
    IMP_chmap[249] = 117;
    IMP_chmap[250] = 117;
    IMP_chmap[251] = 117;
    IMP_chmap[252] = 117;
    IMP_chmap[253] = 121;
    IMP_chmap[254] = 32;
    IMP_chmap[255] = 121;
}

void IMAGEN_createmap(name, map)
unsigned short *map;
int name;
{
    register int i, j;
    unsigned char s[4], *p;

    p = s;
    *p++ = 222;
    *p++ = name;
    j = 0;
    for (i = 0; i < 127; i++) {
        if (map[i])
            j++;
    }
    *p = j;
    for (i = 0; i < 3; i++)
        _IO_putc (s[i], gpoutfile);

    s[3] = 1;
    for (j = 0; j < 127; j++) {
        if (map[j]) {
            p = s;
            *p++ = j;
            *p++ = map[j] >> 8;
            *p = map[j] & 255;
            for (i = 0; i < 4; i++)
                _IO_putc (s[i], gpoutfile);
        }
    }
}
# 313 "term.h" 2





# 1 "term/mif.trm" 1
# 90 "term/mif.trm"
# 1 "term/driver.h" 1
# 91 "term/mif.trm" 2
# 99 "term/mif.trm"
static void MIF_init (void);
static void MIF_graphics (void);
static void MIF_text (void);
static void MIF_linetype (int linetype);
static void MIF_move (unsigned int x, unsigned int y);
static void MIF_vector (unsigned int x, unsigned int y);
static void MIF_put_text (unsigned int x, unsigned int y, char *str);
static int MIF_text_angle (int ang);
static void MIF_reset (void);
static void MIF_options (void);
static int MIF_justify_text (enum JUSTIFY mode);
static void MIF_point (unsigned int x, unsigned int y, int number);
# 126 "term/mif.trm"
static int insert_mif_line (double fx, double fy);
static int proc_group_id (int group_id);
static void free_mif_line (void);
static void put_mif_line (void);
static void MIF_set_font (char *);
static void mif_put_point (unsigned int x, unsigned int y, int np);






extern char term_options[];


extern char version[];
extern char patchlevel[];

static struct mif_line {
    float fpos_x;
    float fpos_y;
    struct mif_line *next;
    struct mif_line *prev;
} mif_line =
{
    ((0) / 1000.0),
        (((10000 - 1)) / 1000.0),
        &mif_line,
        &mif_line
};
# 168 "term/mif.trm"
static char mif_justify[64];
static char mif_pen[64], mif_pen_width[64], mif_separation[64];



static int mif_text_ang = 0;


static int mif_pentype = 0;


static int mif_pattern_table[16] =
{
    0,
    1,
    2, 3, 4, 8, 12, 13,
    5,
    9, 10, 11, 12, 13, 14, 15
};



static struct mif_group_id {
    int group_existance;





    int group_id;


} mif_group_id[20];


static int mif_initialized = 0;
static int mif_in_frame = 0;
static int mif_frameno = -1;
static int mif_colour = 1;
static int mif_polyline = 1;

struct mpt {
    int chr;
    float x_offset, y_offset;
    char *font;
};

char zgnuplot[] = "ZGnuplot";
char zgnuplotp[] = "ZGnuplotP";
char zgnuplotd[] = "ZGnuplotD";
char *mif_font = ((void *)0);

struct mpt mpt[6 + 1] =
{
    {'.', 0.000, 0.005, zgnuplotd, },

    {'G', 0.002, 0.084, zgnuplotp, },
    {';', 0.002, 0.084, zgnuplotp, },
    {'n', 0.002, 0.084, zgnuplotp, },
    {'5', 0.002, 0.084, zgnuplotp, },
    {'s', 0.002, 0.062, zgnuplotp, },
    {'K', 0.005, 0.075, zgnuplotp, },
};


struct mpt *mif_point = &(mpt[1]);
# 243 "term/mif.trm"
static int insert_mif_line (double fx, double fy);
static int proc_group_id (int group_id);




static void MIF_options()
{
    if (!(c_token >= num_tokens || equals(c_token,";"))) {

        if (!(c_token >= num_tokens || equals(c_token,";")) && almost_equals(c_token, "m$onochrome")) {
            mif_colour = 0;
            c_token++;
        }
        if (!(c_token >= num_tokens || equals(c_token,";")) && (almost_equals(c_token, "c$olor")
                                || almost_equals(c_token, "c$olour"))) {
            mif_colour = 1;
            c_token++;
        }

        if (!(c_token >= num_tokens || equals(c_token,";")) && almost_equals(c_token, "v$ectors")) {
            mif_polyline = 0;
            c_token++;
        }
        if (!(c_token >= num_tokens || equals(c_token,";")) && almost_equals(c_token, "p$olyline")) {
            mif_polyline = 1;
            c_token++;
        }

        if (!(c_token >= num_tokens || equals(c_token,";")) &&
            (almost_equals(c_token, "h$elp") ||
             almost_equals(c_token, "?$"))) {
            fprintf(stderr, "Usage: set terminal mif [options]\n\toptions:\n\t\tcolour /        Draw primitives with line types >= 0 in colour (sep. 2-7)\n\t\tmonochrome      Draw primitives in black (sep. 0)\n\n\t\tpolyline /      Draw lines as continous curves\n\t\tvectors         Draw lines as collections of vectors\n\n\t\thelp / ?        Print short usage description on stderr\n");
# 284 "term/mif.trm"
            c_token++;
        }
    }
    sprintf(term_options, "%s %s", (mif_colour == 1) ? "colour" : "monochrome",
            (mif_polyline == 1) ? "polyline" : "vectors");
}


static void free_mif_line()
{
    struct mif_line *tline;

    while (mif_line.prev != &mif_line) {

        tline = mif_line.prev;
        mif_line.prev = mif_line.prev->prev;
        mif_line.prev->next = &mif_line;


        free(tline);
    }


    mif_line.prev = &mif_line;
    mif_line.next = &mif_line;
}


static void put_mif_line()
{
    int np, i;
    struct mif_line *tline;


    if (mif_initialized != 0 && mif_in_frame != 0) {


        for (tline = mif_line.next, np = 1; tline != &mif_line; tline = tline->next, np++);


        if (np >= 2) {


            fprintf(gpoutfile, "\t<PolyLine <GroupID %d> %s %s %s\n",
                    ( 1 + (mif_pentype) ), mif_pen, mif_pen_width, mif_separation);


            fprintf(gpoutfile, "\t\t<NumPoints %d> ", np);
            for (i = 0, tline = &mif_line; i < np; i++, tline = tline->next) {
                if (i % 4 == 0)
                    fputs("\n\t\t", gpoutfile);
                fprintf(gpoutfile, "<Point  %.3f %.3f> ",
                        tline->fpos_x, tline->fpos_y);
            }


            fputs("\n\t>\n", gpoutfile);


            proc_group_id(( 1 + (mif_pentype) ));


            mif_pen[0] = '\0';
            mif_pen_width[0] = '\0';
            mif_separation[0] = '\0';


            mif_line.fpos_x = mif_line.prev->fpos_x;
            mif_line.fpos_y = mif_line.prev->fpos_y;


            free_mif_line();
        }
    }
}



static void mif_put_point(x, y, np)
unsigned int x, y;
int np;
{

    if (mif_initialized != 0 && mif_in_frame != 0) {


        if (mif_polyline == 1)
            put_mif_line();


        MIF_move(x, y);


        MIF_justify_text(CENTRE);


        fprintf(gpoutfile, "\t<TextLine <GroupID %d>\n",
                ( 1 + (mif_pentype) ));

        MIF_set_font(mif_point[np].font);

        fprintf(gpoutfile, "\t\t<TLOrigin  %.3f %.3f> %s <String `%c'>\n",
                mif_line.fpos_x + mif_point[np].x_offset,
                mif_line.fpos_y + mif_point[np].y_offset,
                mif_justify,
                mif_point[np].chr);
        fputs("\t>\n", gpoutfile);


        proc_group_id(( 1 + (mif_pentype) ));


        mif_justify[0] = '\0';

    }
}





static void MIF_point(x, y, number)
unsigned int x, y;
int number;
{
    if (number < 0) {
        number = -1;
    } else {
        number %= 6;
    }
    mif_put_point(x, y, number);
}



static void MIF_init()
{
    int i;


    if (mif_initialized == 0 && mif_in_frame == 0) {

        mif_initialized = 1;
        mif_in_frame = 0;


        free_mif_line();
        mif_line.fpos_x = ((0) / 1000.0);
        mif_line.fpos_y = (((10000 - 1)) / 1000.0);


        mif_pen[0] = '\0';
        mif_pen_width[0] = '\0';
        mif_separation[0] = '\0';

        MIF_justify_text(LEFT);


        for (i = 0; i < 20; i++) {
            mif_group_id[i].group_id = 0;
            mif_group_id[i].group_existance = 0;
        }




        fprintf(gpoutfile, "<MIFFile 3.00> # Generated by gnuplot version %s patchlevel %s; identifies this as a MIF file\n#\n# show borders\n<Document\n<DBordersOn Yes>\n>\n# Set a default pen pattern, pen width, unit and font for subsequent objects\n<Pen 0>\n<Fill 15>\n<PenWidth 0.5 pt>\n<Separation 0>\n<Units Ucm>\n<FontCatalog\n\t<Font <FTag `%s'><FFamily `Times'><FSize %d><FPlain Yes>>\n\t<Font <FTag `%s'><FFamily `ZapfDingbats'><FSize 7.0 pt><FPlain Yes>>\n\t<Font <FTag `%s'><FFamily `Symbol'><FSize 5.0 pt><FPlain Yes>>\n>\n#\n",
# 467 "term/mif.trm"
                version, patchlevel,
                zgnuplot, 9,
                zgnuplotp,
                zgnuplotd);
    }
}


static void MIF_reset()
{

    if (mif_initialized != 0 && mif_in_frame == 0) {

        fputs("#\n# End of MIFFile\n", gpoutfile);




        mif_initialized = 0;


        mif_frameno = -1;

    }
}


static void MIF_graphics()
{
    int i;


    if (mif_initialized != 0 && mif_in_frame == 0) {

        mif_in_frame = 1;


        mif_frameno++;


        free_mif_line();
        mif_line.fpos_x = ((0) / 1000.0);
        mif_line.fpos_y = (((10000 - 1)) / 1000.0);


        mif_pen[0] = '\0';
        mif_pen_width[0] = '\0';
        mif_separation[0] = '\0';

        MIF_justify_text(LEFT);


        for (i = 0; i < 20; i++) {
            mif_group_id[i].group_id = 0;
            mif_group_id[i].group_existance = 0;
        }


        fprintf(gpoutfile, "#\n# Frame number %d with plot of graphics\n<Frame\n\t<Pen 15>\n\t<Fill 15>\n\t<PenWidth  0.5 pt>\n\t<Separation 0>\n\t<BRect 2.000 %.3f %.3f %.3f>\n\t<NSOffset  0.000>\n\t<BLOffset  0.000>\n",
# 536 "term/mif.trm"
            mif_frameno,
            ((float) mif_frameno) * ((10000 + 100) / 1000.0),
            ((15000) / 1000.0), ((10000) / 1000.0));
    }
}


static void MIF_text()
{
    int i;


    if (mif_initialized != 0 && mif_in_frame != 0) {


        if (mif_polyline == 1)
            put_mif_line();


        fputs("\t#\n\t# Group the the objects in groups to make the chart easier to manipulate\n\t# after it's imported into FrameMaker.\n", gpoutfile);




        for (i = 0; i < 20; i++) {
            if (mif_group_id[i].group_id != 0 &&
                mif_group_id[i].group_existance == 1) {
                fprintf(gpoutfile, "\t<Group\n\t\t<ID %d>\n\t>\n", mif_group_id[i].group_id);



            }
        }


        fprintf(gpoutfile, ">\n# End of Frame number %d\n#\n",



                mif_frameno);


        mif_in_frame = 0;
    }
}




static void MIF_linetype(linetype)

int linetype;
{

    if (mif_initialized != 0 && mif_in_frame != 0) {


        if (mif_polyline == 1)
            put_mif_line();


        if (linetype < 0) {
            if (linetype == -1) {
                mif_pentype = 8 + 16;
                if (mif_colour == 1)
                    sprintf(mif_separation, " <Separation 0> ");
            } else {
                mif_pentype = 0 + 16;
                if (mif_colour == 1)
                    sprintf(mif_separation, " <Separation 0> ");
            }
            sprintf(mif_pen_width, " <PenWidth 1.0 pt> ");
        } else {
            mif_pentype = (linetype) % 16;
            sprintf(mif_pen_width, " <PenWidth 0.1 pt> ");
            if (mif_colour == 1)
                sprintf(mif_separation, " <Separation %d> ", 2 + (mif_pentype % 6));
        }


        sprintf(mif_pen, " <Pen %d> ", mif_pattern_table[mif_pentype % 16]);

    }
}


static int MIF_text_angle(ang)
int ang;
{
    if (ang != 0)
        mif_text_ang = 1;
    else
        mif_text_ang = 0;

    return (1);
}


static int MIF_justify_text(mode)


enum JUSTIFY mode;
{
    int rval = 1;


    if (mif_initialized != 0 && mif_in_frame != 0) {
        switch (mode) {
        case LEFT:
            sprintf(mif_justify, " <TLAlignment Left> ");
            break;
        case CENTRE:
            sprintf(mif_justify, " <TLAlignment Center> ");
            break;
        case RIGHT:
            sprintf(mif_justify, " <TLAlignment Right> ");
            break;
        default:
            rval = 0;
            break;
        }

    }

    else {
        rval = 0;
    }

    return (rval);
}




static void MIF_vector(x, y)
unsigned int x, y;
{

    if (mif_initialized != 0 && mif_in_frame != 0) {


        insert_mif_line(((x) / 1000.0), (((10000 - 1) - (int) y) / 1000.0));


        if (mif_polyline == 0)
            put_mif_line();

    }
}


static void MIF_move(x, y)
unsigned int x, y;
{

    if (mif_initialized != 0 && mif_in_frame != 0) {


        if (mif_polyline == 1)
            put_mif_line();

        mif_line.fpos_x = ((x) / 1000.0);
        mif_line.fpos_y = (((10000 - 1) - (int) y) / 1000.0);
    }
}



static void MIF_set_font(font)
char *font;
{
    if (font != mif_font) {
        fprintf(gpoutfile, "\t\t<Font\n\t\t\t<FTag `%s'>\n\t\t>\n", font);
        mif_font = font;
    }
}




static void MIF_put_text(x, y, str)
unsigned int x, y;
char str[];
{

    if (mif_initialized != 0 && mif_in_frame != 0) {


        if (mif_polyline == 1)
            put_mif_line();


        MIF_move(x, y - (10000/31) / 5);

        if (strlen(str) > 0) {


            fprintf(gpoutfile, "\t<TextLine <GroupID %d> %s %s %s\n",
                    ( 1 + (mif_pentype) ), mif_pen,
                    mif_pen_width, mif_separation);

            MIF_set_font(zgnuplot);

            fprintf(gpoutfile, "\t\t<TLOrigin  %.3f %.3f> %s %s <String `%s'>\n\t>\n",


                    mif_line.fpos_x, mif_line.fpos_y, mif_justify,
                    (mif_text_ang == 1) ? "<Angle 90>" : "",
                    str);


            proc_group_id(( 1 + (mif_pentype) ));


            mif_pen[0] = '\0';
            mif_pen_width[0] = '\0';
            mif_separation[0] = '\0';

            mif_justify[0] = '\0';
        }
    }
}



static int insert_mif_line(fx, fy)
double fx, fy;
{
    int rval = 1;

    if ((mif_line.prev->next = (struct mif_line *) gp_alloc(sizeof(struct mif_line),
        "MIF driver")) != (struct mif_line *) ((void *)0)) {

        mif_line.prev->next->next = &mif_line;
        mif_line.prev->next->prev = mif_line.prev;
        mif_line.prev = mif_line.prev->next;


        mif_line.prev->fpos_x = fx;
        mif_line.prev->fpos_y = fy;

        rval = 1;
    } else {

        mif_line.prev->next = &mif_line;

        rval = 0;
    }

    return (rval);
}







static int proc_group_id(group_id)
int group_id;
{
    int i, rval = 0;


    if (mif_initialized != 0 && mif_in_frame != 0) {


        for (i = 0; i < 20 &&
             mif_group_id[i].group_id != 0 &&
             mif_group_id[i].group_id != group_id;
             i++) {

        }

        if (i < 20) {
            if (mif_group_id[i].group_id == 0) {

                mif_group_id[i].group_id = group_id;
                mif_group_id[i].group_existance = 0;
            } else {

                if (mif_group_id[i].group_id == group_id) {
                    mif_group_id[i].group_existance = 1;

                    rval = 1;
                }
            }
        } else {
            rval = -2;
        }

    }

    else {
        rval = -1;
    }


    return (rval);
}
# 319 "term.h" 2


# 1 "term/pbm.trm" 1
# 63 "term/pbm.trm"
# 1 "term/driver.h" 1
# 64 "term/pbm.trm" 2






static void PBMoptions (void);
static void PBMinit (void);
static void PBMreset (void);
static void PBMsetfont (void);
static void PBMgraphics (void);
static void PBMmonotext (void);
static void PBMgraytext (void);
static void PBMcolortext (void);
static void PBMtext (void);
static void PBMlinetype (int linetype);
static void PBMpoint (unsigned int x, unsigned int y, int point);
# 93 "term/pbm.trm"
static int pbm_font = 1;
static int pbm_mode = 0;


static int pgm_gray[] = { 7, 1, 6, 5, 4, 3, 2, 1, 7 };

static int ppm_color[] ={ 15, 8, 3, 5, 6, 2, 4, 1, 11, 13, 14 };

static void PBMoptions()
{
    pbm_font = 1;
    pbm_mode = 0;

    term_options[0] = ('\0');

    while (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "s$mall"))
            pbm_font = 1;
        else if (almost_equals(c_token, "me$dium"))
            pbm_font = 2;
        else if (almost_equals(c_token, "l$arge"))
            pbm_font = 3;
        else if (almost_equals(c_token, "mo$nochrome"))
            pbm_mode = 0;
        else if (almost_equals(c_token, "g$ray"))
            pbm_mode = 1;
        else if (almost_equals(c_token, "c$olor")
                 || almost_equals(c_token, "c$olour"))
            pbm_mode = 2;
        else {

            pbm_font = 1;
            pbm_mode = 0;
            int_error("expecting: {small, medium, large} and {monochrome, gray, color}", c_token);
        }
        c_token++;
    }



    switch (pbm_font) {
    case 1:
        strcat(term_options, "small");
        break;
    case 2:
        strcat(term_options, "medium");
        break;
    case 3:
        strcat(term_options, "large");
        break;
    }

    switch (pbm_mode) {
    case 0:
        strcat(term_options, " monochrome");
        break;
    case 1:
        strcat(term_options, " gray");
        break;
    case 2:
        strcat(term_options, " color");
        break;
    }
}


static void PBMinit()
{
    PBMsetfont();
}


static void PBMreset()
{



}


static void PBMsetfont()
{
    switch (pbm_font) {
    case 1:
        b_charsize(0);
        term->v_char = 11;
        term->h_char = 7;
        term->v_tic = 5;
        term->h_tic = 5;
        break;
    case 2:
        b_charsize(1);
        term->v_char = 21;
        term->h_char = 13;
        term->v_tic = 9;
        term->h_tic = 9;
        break;
    case 3:
        b_charsize(2);
        term->v_char = 31;
        term->h_char = 19;
        term->v_tic = 13;
        term->h_tic = 13;
        break;
    }
}


static void PBMgraphics()
{
    int numplanes = 1;

    switch (pbm_mode) {
    case 1:
        numplanes = 3;
        break;
    case 2:
        numplanes = 4;
        break;
    }







    b_makebitmap((unsigned int) ((480) * ysize),
                 (unsigned int) ((640) * xsize), numplanes);
    b_rastermode = 1;

    if (pbm_mode != 0)
        b_setlinetype(0);
}


static void PBMmonotext()
{
    register int x, j, row;

    fputs("P4\n", gpoutfile);
    fprintf(gpoutfile, "%u %u\n", b_ysize, b_xsize);


    for (x = b_xsize - 1; x >= 0; x--) {
        row = (b_ysize / 8) - 1;
        for (j = row; j >= 0; j--) {
            (void) fputc((char) (*((*b_p)[j] + x)), gpoutfile);
        }
    }

    b_freebitmap();
}

static void PBMgraytext()
{
    register int x, j, row;
    register int i, value;
    int mask, plane1, plane2, plane3;

    fprintf(gpoutfile, "P5\n%u %u\n%u\n",



            b_ysize, b_xsize,
            255);


    for (x = b_xsize - 1; x >= 0; x--) {
        row = (b_ysize / 8) - 1;
        for (j = row; j >= 0; j--) {
            mask = 0x80;
            plane1 = (*((*b_p)[j] + x));
            plane2 = (*((*b_p)[j + b_psize] + x));
            plane3 = (*((*b_p)[j + b_psize + b_psize] + x));
            for (i = 0; i < 8; i++) {


                value = 255;
                if (plane1 & mask)
                    value -= 36;
                if (plane2 & mask)
                    value -= 73;
                if (plane3 & mask)
                    value -= 146;
                (void) fputc((char) (value), gpoutfile);
                mask >>= 1;
            }
        }
    }

    b_freebitmap();
}

static void PBMcolortext()
{
    register int x, j, row;
    register int i;
    int mask, plane1, plane2, plane3, plane4;
    int red, green, blue;

    fprintf(gpoutfile, "P6\n%u %u\n%u\n",


            b_ysize, b_xsize,
            255);


    for (x = b_xsize - 1; x >= 0; x--) {
        row = (b_ysize / 8) - 1;
        for (j = row; j >= 0; j--) {
            mask = 0x80;
            plane1 = (*((*b_p)[j] + x));
            plane2 = (*((*b_p)[j + b_psize] + x));
            plane3 = (*((*b_p)[j + b_psize + b_psize] + x));
            plane4 = (*((*b_p)[j + b_psize + b_psize + b_psize] + x));
            for (i = 0; i < 8; i++) {
                red = (plane3 & mask) ? 1 : 3;
                green = (plane2 & mask) ? 1 : 3;
                blue = (plane1 & mask) ? 1 : 3;
                if (plane4 & mask) {
                    red--;
                    green--;
                    blue--;
                }


                (void) fputc((char) (red * 85), gpoutfile);
                (void) fputc((char) (green * 85), gpoutfile);
                (void) fputc((char) (blue * 85), gpoutfile);
                mask >>= 1;
            }
        }
    }

    b_freebitmap();
}

static void PBMtext()
{
    switch (pbm_mode) {
    case 0:
        PBMmonotext();
        break;
    case 1:
        PBMgraytext();
        break;
    case 2:
        PBMcolortext();
        break;
    }
}


static void PBMlinetype(linetype)
int linetype;
{
    switch (pbm_mode) {
    case 0:
        b_setlinetype(linetype);
        break;
    case 1:
        if (linetype >= 7)
            linetype %= 7;
        b_setvalue(pgm_gray[linetype + 2]);
        break;
    case 2:
        if (linetype >= 9)
            linetype %= 9;
        b_setvalue(ppm_color[linetype + 2]);
        break;
    }
}

static void PBMpoint(x, y, point)
unsigned int x, y;
int point;
{
    if (pbm_mode == 0)
        line_and_point(x, y, point);
    else
        do_point(x, y, point);
}
# 322 "term.h" 2







# 1 "term/post.trm" 1
# 60 "term/post.trm"
# 1 "term/driver.h" 1
# 61 "term/post.trm" 2






static void PS_options (void);
static void PS_common_init (int encap, int portrait, int uses_fonts, unsigned int xoff, unsigned int yoff, unsigned int bb_xmin, unsigned int bb_ymin, unsigned int bb_xmax, unsigned int bb_ymax, char **dict);
static void PS_init (void);
static void PS_graphics (void);
static void PS_text (void);
static void PS_reset (void);
static void PS_linetype (int linetype);
static void PS_move (unsigned int x, unsigned int y);
static void PS_vector (unsigned int x, unsigned int y);
static void PS_put_text (unsigned int x, unsigned int y, char *str);
static void ENHPS_put_text (unsigned int x, unsigned int y, char *str);
static int PS_text_angle (int ang);
static int PS_justify_text (enum JUSTIFY mode);
static void PS_point (unsigned int x, unsigned int y, int number);
static int PS_set_font (char * font);
static int ENHPS_set_font (char * font);
static void PS_fillbox (int style, unsigned int x1, unsigned int y1, unsigned int width, unsigned int height);
static void PS_linewidth (double linewidth);
static void PS_pointsize (double ptsize);
# 110 "term/post.trm"
extern char version[];
extern char patchlevel[];




static char *PS_RememberFont (char *fname, int reencode);
static void ENHPS_put_text (unsigned int x, unsigned int y, char *str);
static char *ENHPS_recurse (char *p, TBOOLEAN brace, char *fontname, double fontsize, double base, TBOOLEAN widthflag, TBOOLEAN showflag);
static char ps_font[50 +1] = "Helvetica" ;
static int ps_fontsize = 14;




static char ps_enh_font[50 +1];
static int ps_enh_fontsize;

static TBOOLEAN ps_portrait = 0;
static TBOOLEAN ps_color = 0;
static TBOOLEAN ps_solid = 0;
static TBOOLEAN ps_eps = 0;

static int ps_page=0;
static int ps_path_count=0;
static int ps_ang=0;
static enum JUSTIFY ps_justify=LEFT;


static TBOOLEAN ps_duplex_state = 0;
static TBOOLEAN ps_duplex_option = 0;

static char * PS_header[] = {
"/M {moveto} bind def\n",
"/L {lineto} bind def\n",
"/R {rmoveto} bind def\n",
"/V {rlineto} bind def\n",
"/vpt2 vpt 2 mul def\n",
"/hpt2 hpt 2 mul def\n",

"/Lshow { currentpoint stroke M\n",
"  0 vshift R show } def\n",

"/Rshow { currentpoint stroke M\n",
"  dup stringwidth pop neg vshift R show } def\n",

"/Cshow { currentpoint stroke M\n",
"  dup stringwidth pop -2 div vshift R show } def\n",

"/UP { dup vpt_ mul /vpt exch def hpt_ mul /hpt exch def\n",
"  /hpt2 hpt 2 mul def /vpt2 vpt 2 mul def } def\n",

"/DL { Color {setrgbcolor Solid {pop []} if 0 setdash }\n",
" {pop pop pop Solid {pop []} if 0 setdash} ifelse } def\n",

"/BL { stroke userlinewidth 2 mul setlinewidth } def\n",

"/AL { stroke userlinewidth 2 div setlinewidth } def\n",

"/UL { dup gnulinewidth mul /userlinewidth exch def\n",
"      10 mul /udl exch def } def\n",

"/PL { stroke userlinewidth setlinewidth } def\n",

"/LTb { BL [] 0 0 0 DL } def\n",
"/LTa { AL [1 udl mul 2 udl mul] 0 setdash 0 0 0 setrgbcolor } def\n",
"/LT0 { PL [] 1 0 0 DL } def\n",
"/LT1 { PL [4 dl 2 dl] 0 1 0 DL } def\n",
"/LT2 { PL [2 dl 3 dl] 0 0 1 DL } def\n",
"/LT3 { PL [1 dl 1.5 dl] 1 0 1 DL } def\n",
"/LT4 { PL [5 dl 2 dl 1 dl 2 dl] 0 1 1 DL } def\n",
"/LT5 { PL [4 dl 3 dl 1 dl 3 dl] 1 1 0 DL } def\n",
"/LT6 { PL [2 dl 2 dl 2 dl 4 dl] 0 0 0 DL } def\n",
"/LT7 { PL [2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 1 0.3 0 DL } def\n",
"/LT8 { PL [2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 2 dl 4 dl] 0.5 0.5 0.5 DL } def\n",

"/Pnt { stroke [] 0 setdash\n",
"   gsave 1 setlinecap M 0 0 V stroke grestore } def\n",


"/Dia { stroke [] 0 setdash 2 copy vpt add M\n",
"  hpt neg vpt neg V hpt vpt neg V\n",
"  hpt vpt V hpt neg vpt V closepath stroke\n",
"  Pnt } def\n",


"/Pls { stroke [] 0 setdash vpt sub M 0 vpt2 V\n",
"  currentpoint stroke M\n",
"  hpt neg vpt neg R hpt2 0 V stroke\n",
"  } def\n",


"/Box { stroke [] 0 setdash 2 copy exch hpt sub exch vpt add M\n",
"  0 vpt2 neg V hpt2 0 V 0 vpt2 V\n",
"  hpt2 neg 0 V closepath stroke\n",
"  Pnt } def\n",


"/Crs { stroke [] 0 setdash exch hpt sub exch vpt add M\n",
"  hpt2 vpt2 neg V currentpoint stroke M\n",
"  hpt2 neg 0 R hpt2 vpt2 V stroke } def\n",


"/TriU { stroke [] 0 setdash 2 copy vpt 1.12 mul add M\n",
"  hpt neg vpt -1.62 mul V\n",
"  hpt 2 mul 0 V\n",
"  hpt neg vpt 1.62 mul V closepath stroke\n",
"  Pnt  } def\n",


"/Star { 2 copy Pls Crs } def\n",



"/BoxF { stroke [] 0 setdash exch hpt sub exch vpt add M\n",
"  0 vpt2 neg V  hpt2 0 V  0 vpt2 V\n",
"  hpt2 neg 0 V  closepath fill } def\n",



"/TriUF { stroke [] 0 setdash vpt 1.12 mul add M\n",
"  hpt neg vpt -1.62 mul V\n",
"  hpt 2 mul 0 V\n",
"  hpt neg vpt 1.62 mul V closepath fill } def\n",



"/TriD { stroke [] 0 setdash 2 copy vpt 1.12 mul sub M\n",
"  hpt neg vpt 1.62 mul V\n",
"  hpt 2 mul 0 V\n",
"  hpt neg vpt -1.62 mul V closepath stroke\n",
"  Pnt  } def\n",


"/TriDF { stroke [] 0 setdash vpt 1.12 mul sub M\n",
"  hpt neg vpt 1.62 mul V\n",
"  hpt 2 mul 0 V\n",
"  hpt neg vpt -1.62 mul V closepath fill} def\n",


"/DiaF { stroke [] 0 setdash vpt add M\n",
"  hpt neg vpt neg V hpt vpt neg V\n",
"  hpt vpt V hpt neg vpt V closepath fill } def\n",


"/Pent { stroke [] 0 setdash 2 copy gsave\n",
"  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat\n",
"  closepath stroke grestore Pnt } def\n",


"/PentF { stroke [] 0 setdash gsave\n",
"  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat\n",
"  closepath fill grestore } def\n",


"/Circle { stroke [] 0 setdash 2 copy\n",
"  hpt 0 360 arc stroke Pnt } def\n",


"/CircleF { stroke [] 0 setdash hpt 0 360 arc fill } def\n",

"/C0 { BL [] 0 setdash 2 copy moveto vpt 90 450  arc } bind def\n",
"/C1 { BL [] 0 setdash 2 copy        moveto\n",
"       2 copy  vpt 0 90 arc closepath fill\n",
"               vpt 0 360 arc closepath } bind def\n",
"/C2 { BL [] 0 setdash 2 copy moveto\n",
"       2 copy  vpt 90 180 arc closepath fill\n",
"               vpt 0 360 arc closepath } bind def\n",
"/C3 { BL [] 0 setdash 2 copy moveto\n",
"       2 copy  vpt 0 180 arc closepath fill\n",
"               vpt 0 360 arc closepath } bind def\n",
"/C4 { BL [] 0 setdash 2 copy moveto\n",
"       2 copy  vpt 180 270 arc closepath fill\n",
"               vpt 0 360 arc closepath } bind def\n",
"/C5 { BL [] 0 setdash 2 copy moveto\n",
"       2 copy  vpt 0 90 arc\n",
"       2 copy moveto\n",
"       2 copy  vpt 180 270 arc closepath fill\n",
"               vpt 0 360 arc } bind def\n",
"/C6 { BL [] 0 setdash 2 copy moveto\n",
"      2 copy  vpt 90 270 arc closepath fill\n",
"              vpt 0 360 arc closepath } bind def\n",
"/C7 { BL [] 0 setdash 2 copy moveto\n",
"      2 copy  vpt 0 270 arc closepath fill\n",
"              vpt 0 360 arc closepath } bind def\n",
"/C8 { BL [] 0 setdash 2 copy moveto\n",
"      2 copy vpt 270 360 arc closepath fill\n",
"              vpt 0 360 arc closepath } bind def\n",
"/C9 { BL [] 0 setdash 2 copy moveto\n",
"      2 copy  vpt 270 450 arc closepath fill\n",
"              vpt 0 360 arc closepath } bind def\n",
"/C10 { BL [] 0 setdash 2 copy 2 copy moveto vpt 270 360 arc closepath fill\n",
"       2 copy moveto\n",
"       2 copy vpt 90 180 arc closepath fill\n",
"               vpt 0 360 arc closepath } bind def\n",
"/C11 { BL [] 0 setdash 2 copy moveto\n",
"       2 copy  vpt 0 180 arc closepath fill\n",
"       2 copy moveto\n",
"       2 copy  vpt 270 360 arc closepath fill\n",
"               vpt 0 360 arc closepath } bind def\n",
"/C12 { BL [] 0 setdash 2 copy moveto\n",
"       2 copy  vpt 180 360 arc closepath fill\n",
"               vpt 0 360 arc closepath } bind def\n",
"/C13 { BL [] 0 setdash  2 copy moveto\n",
"       2 copy  vpt 0 90 arc closepath fill\n",
"       2 copy moveto\n",
"       2 copy  vpt 180 360 arc closepath fill\n",
"               vpt 0 360 arc closepath } bind def\n",
"/C14 { BL [] 0 setdash 2 copy moveto\n",
"       2 copy  vpt 90 360 arc closepath fill\n",
"               vpt 0 360 arc } bind def\n",
"/C15 { BL [] 0 setdash 2 copy vpt 0 360 arc closepath fill\n",
"               vpt 0 360 arc closepath } bind def\n",



"/Rec   { newpath 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto\n",
"       neg 0 rlineto closepath } bind def\n",
"/Square { dup Rec } bind def\n",
"/Bsquare { vpt sub exch vpt sub exch vpt2 Square } bind def\n",



"/S0 { BL [] 0 setdash 2 copy moveto 0 vpt rlineto BL Bsquare } bind def\n",
"/S1 { BL [] 0 setdash 2 copy vpt Square fill Bsquare } bind def\n",
"/S2 { BL [] 0 setdash 2 copy exch vpt sub exch vpt Square fill Bsquare } bind def\n",
"/S3 { BL [] 0 setdash 2 copy exch vpt sub exch vpt2 vpt Rec fill Bsquare } bind def\n",
"/S4 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt Square fill Bsquare } bind def\n",
"/S5 { BL [] 0 setdash 2 copy 2 copy vpt Square fill\n",
"       exch vpt sub exch vpt sub vpt Square fill Bsquare } bind def\n",
"/S6 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill Bsquare } bind def\n",
"/S7 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt vpt2 Rec fill\n",
"       2 copy vpt Square fill\n",
"       Bsquare } bind def\n",
"/S8 { BL [] 0 setdash 2 copy vpt sub vpt Square fill Bsquare } bind def\n",
"/S9 { BL [] 0 setdash 2 copy vpt sub vpt vpt2 Rec fill Bsquare } bind def\n",
"/S10 { BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt Square fill\n",
"       Bsquare } bind def\n",
"/S11 { BL [] 0 setdash 2 copy vpt sub vpt Square fill 2 copy exch vpt sub exch vpt2 vpt Rec fill\n",
"       Bsquare } bind def\n",
"/S12 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill Bsquare } bind def\n",
"/S13 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill\n",
"       2 copy vpt Square fill Bsquare } bind def\n",
"/S14 { BL [] 0 setdash 2 copy exch vpt sub exch vpt sub vpt2 vpt Rec fill\n",
"       2 copy exch vpt sub exch vpt Square fill Bsquare } bind def\n",
"/S15 { BL [] 0 setdash 2 copy Bsquare fill Bsquare } bind def\n",



"/D0 { gsave translate 45 rotate 0 0 S0 stroke grestore } bind def\n",
"/D1 { gsave translate 45 rotate 0 0 S1 stroke grestore } bind def\n",
"/D2 { gsave translate 45 rotate 0 0 S2 stroke grestore } bind def\n",
"/D3 { gsave translate 45 rotate 0 0 S3 stroke grestore } bind def\n",
"/D4 { gsave translate 45 rotate 0 0 S4 stroke grestore } bind def\n",
"/D5 { gsave translate 45 rotate 0 0 S5 stroke grestore } bind def\n",
"/D6 { gsave translate 45 rotate 0 0 S6 stroke grestore } bind def\n",
"/D7 { gsave translate 45 rotate 0 0 S7 stroke grestore } bind def\n",
"/D8 { gsave translate 45 rotate 0 0 S8 stroke grestore } bind def\n",
"/D9 { gsave translate 45 rotate 0 0 S9 stroke grestore } bind def\n",
"/D10 { gsave translate 45 rotate 0 0 S10 stroke grestore } bind def\n",
"/D11 { gsave translate 45 rotate 0 0 S11 stroke grestore } bind def\n",
"/D12 { gsave translate 45 rotate 0 0 S12 stroke grestore } bind def\n",
"/D13 { gsave translate 45 rotate 0 0 S13 stroke grestore } bind def\n",
"/D14 { gsave translate 45 rotate 0 0 S14 stroke grestore } bind def\n",
"/D15 { gsave translate 45 rotate 0 0 S15 stroke grestore } bind def\n",




"/DiaE { stroke [] 0 setdash vpt add M\n",
"  hpt neg vpt neg V hpt vpt neg V\n",
"  hpt vpt V hpt neg vpt V closepath stroke } def\n",


"/BoxE { stroke [] 0 setdash exch hpt sub exch vpt add M\n",
"  0 vpt2 neg V hpt2 0 V 0 vpt2 V\n",
"  hpt2 neg 0 V closepath stroke } def\n",


"/TriUE { stroke [] 0 setdash vpt 1.12 mul add M\n",
"  hpt neg vpt -1.62 mul V\n",
"  hpt 2 mul 0 V\n",
"  hpt neg vpt 1.62 mul V closepath stroke } def\n",


"/TriDE { stroke [] 0 setdash vpt 1.12 mul sub M\n",
"  hpt neg vpt 1.62 mul V\n",
"  hpt 2 mul 0 V\n",
"  hpt neg vpt -1.62 mul V closepath stroke } def\n",


"/PentE { stroke [] 0 setdash gsave\n",
"  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat\n",
"  closepath stroke grestore } def\n",


"/CircE { stroke [] 0 setdash \n",
"  hpt 0 360 arc stroke } def\n",



"/Opaque { gsave closepath 1 setgray fill grestore 0 setgray closepath } def\n",


"/DiaW { stroke [] 0 setdash vpt add M\n",
"  hpt neg vpt neg V hpt vpt neg V\n",
"  hpt vpt V hpt neg vpt V Opaque stroke } def\n",


"/BoxW { stroke [] 0 setdash exch hpt sub exch vpt add M\n",
"  0 vpt2 neg V hpt2 0 V 0 vpt2 V\n",
"  hpt2 neg 0 V Opaque stroke } def\n",


"/TriUW { stroke [] 0 setdash vpt 1.12 mul add M\n",
"  hpt neg vpt -1.62 mul V\n",
"  hpt 2 mul 0 V\n",
"  hpt neg vpt 1.62 mul V Opaque stroke } def\n",


"/TriDW { stroke [] 0 setdash vpt 1.12 mul sub M\n",
"  hpt neg vpt 1.62 mul V\n",
"  hpt 2 mul 0 V\n",
"  hpt neg vpt -1.62 mul V Opaque stroke } def\n",


"/PentW { stroke [] 0 setdash gsave\n",
"  translate 0 hpt M 4 {72 rotate 0 hpt L} repeat\n",
"  Opaque stroke grestore } def\n",


"/CircW { stroke [] 0 setdash \n",
"  hpt 0 360 arc Opaque stroke } def\n",


"/BoxFill { gsave Rec 1 setgray fill grestore } def\n",

((void *)0)
};

static char * ENHPS_header[] = {



"/MFshow {{dup dup 0 get findfont exch 1 get scalefont setfont\n",
"     [ currentpoint ] exch dup 2 get 0 exch rmoveto dup dup 5 get exch 4 get\n",
"     {show} {stringwidth pop 0 rmoveto}ifelse dup 3 get\n",
"     {2 get neg 0 exch rmoveto pop} {pop aload pop moveto}ifelse} forall} bind def\n",
"/MFwidth {0 exch {dup 3 get{dup dup 0 get findfont exch 1 get scalefont setfont\n",
"      5 get stringwidth pop add}\n",
"    {pop} ifelse} forall} bind def\n",


"/MLshow { currentpoint stroke M\n",
"  0 exch R MFshow } bind def\n",


"/MRshow { currentpoint stroke M\n",
"  exch dup MFwidth neg 3 -1 roll R MFshow } def\n",


"/MCshow { currentpoint stroke M\n",
"  exch dup MFwidth -2 div 3 -1 roll R MFshow } def\n",
((void *)0)
};




static struct PS_FontName {
        char *name;
        struct PS_FontName *next;
} *PS_DocFonts = ((void *)0);






static char *PS_RememberFont(fname, can_reencode)
char *fname;
int can_reencode;
{
        struct PS_FontName *fnp;
        char *recode = ((void *)0);

   for (fnp=PS_DocFonts; fnp ; fnp = fnp->next)
                if (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (fnp->name) && __builtin_constant_p (fname) && (__s1_len = strlen (fnp->name), __s2_len = strlen (fname), (!((size_t)(const void *)((fnp->name) + 1) - (size_t)(const void *)(fnp->name) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((fname) + 1) - (size_t)(const void *)(fname) == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (fnp->name), (__const char *) (fname), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (fnp->name) && ((size_t)(const void *)((fnp->name) + 1) - (size_t)(const void *)(fnp->name) == 1) && (__s1_len = strlen (fnp->name), __s1_len < 4) ? (__builtin_constant_p (fname) && ((size_t)(const void *)((fname) + 1) - (size_t)(const void *)(fname) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (fnp->name))[0] - ((__const unsigned char *) (__const char *)(fname))[0]); if (__s1_len > 0 && __result == 0) !
{ __result = (((__const unsigned char *) (__const char *) (fnp->name))[1] - ((__const unsigned char *) (__const char *) (fname))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (fnp->name))[2] - ((__const unsigned char *) (__const char *) (fname))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (fnp->name))[3] - ((__const unsigned char *) (__const char *) (fname))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) (fname); register int __result = (((__const unsigned char *) (__const char *) (fnp->name))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (fnp->name))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (fnp->name))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const uns!
igned char *) (__const char *) (fnp->name))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (fname) && ((size_t)(const void *)((fname) + 1) - (size_t)(const void *)(fname) == 1) && (__s2_len = strlen (fname), __s2_len < 4) ? (__builtin_constant_p (fnp->name) && ((size_t)(const void *)((fnp->name) + 1) - (size_t)(const void *)(fnp->name) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (fnp->name))[0] - ((__const unsigned char *) (__const char *)(fname))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (fnp->name))[1] - ((__const unsigned char *) (__const char *) (fname))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (fnp->name))[2] - ((__const unsigned char *) (__const char *) (fname))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (fnp->name))[3] - ((__const unsigned char!
 *) (__const char *) (fname))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (fnp->name); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) (fname))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) (fname))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) (fname))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) (fname))[3]); } } __result; }))) : strcmp (fnp->name, fname)))); })==0)
                        return ((void *)0);



   fnp = (struct PS_FontName *)gp_alloc(sizeof(struct PS_FontName), "PostScript Font record");
   fnp->name = gp_alloc(1+strlen(fname), "PostScript Font name");
   (__extension__ (__builtin_constant_p (fname) ? (((size_t)(const void *)((fname) + 1) - (size_t)(const void *)(fname) == 1) && strlen (fname) + 1 <= 8 ? __strcpy_small (fnp->name, __extension__ (((__const unsigned char *) (__const char *) (fname))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) (fname))[0]), __extension__ (((__const unsigned char *) (__const char *) (fname))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) (fname))[4]), __extension__ (((((__const unsigned char *) (__const char *) (fname))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) (fname))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) (fname))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) (fname))[0]), __extension__ (((((__const unsigned char *) (__const char *) (fname))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) (fname))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) (fname))[4 + 1]) << 8 | ((__const unsigned char *) (_!
_const char *) (fname))[4]), strlen (fname) + 1) : (char *) memcpy (fnp->name, fname, strlen (fname) + 1)) : strcpy (fnp->name, fname)));
   fnp->next = PS_DocFonts;
   PS_DocFonts = fnp;

        switch(encoding)
        {
                case 1:
                        recode = "reencodeISO def\n";
                        break;
                case 2:
                        recode = "reencodeCP437 def\n";
                        break;
                case 3 :
                        recode = "reencodeCP850 def\n";
                        break;
        }

        if (can_reencode && recode)
        { fprintf(gpoutfile,"/%s %s",fname, recode);
                return ((void *)0);
        }
        else
                return recode;
}

static int PS_pen_x, PS_pen_y;
static int PS_taken;
static int PS_linetype_last;
static TBOOLEAN PS_relative_ok;

static void PS_options()
{
        if (!(c_token >= num_tokens || equals(c_token,";"))) {
                if (almost_equals(c_token,"p$ortrait")) {
                        ps_portrait=1;
                        ps_eps=0;
                        c_token++;
                }
                else if (almost_equals(c_token,"l$andscape")) {
                        ps_portrait=0;
                        ps_eps=0;
                        c_token++;
                }
                else if (almost_equals(c_token,"ep$sf")) {
                        ps_portrait=1;
                        ps_eps = 1;
                        c_token++;
                }
                else if (almost_equals(c_token,"d$efault")) {
                        ps_portrait=0;
                        ps_eps=0;
                        ps_color=0;
                        ps_solid=0;
                        ps_duplex_option=0;
                        (__extension__ (__builtin_constant_p ("Helvetica") ? (((size_t)(const void *)(("Helvetica") + 1) - (size_t)(const void *)("Helvetica") == 1) && strlen ("Helvetica") + 1 <= 8 ? __strcpy_small (ps_font, __extension__ (((__const unsigned char *) (__const char *) ("Helvetica"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("Helvetica"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("Helvetica"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("Helvetica"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[4 + 2]) <!
< 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[4]), strlen ("Helvetica") + 1) : (char *) memcpy (ps_font, "Helvetica", strlen ("Helvetica") + 1)) : strcpy (ps_font, "Helvetica")));
                        ps_fontsize = 14;
                        term->v_char = (unsigned int)(ps_fontsize*(10));
                        term->h_char = (unsigned int)(ps_fontsize*(10)*6/10);
                        term->put_text = PS_put_text;
                        c_token++;
                }
        }

        if (almost_equals(c_token, "enh$anced")) {
                term->put_text = ENHPS_put_text;
                term->set_font = ENHPS_set_font;
                ++c_token;
        } else if (almost_equals(c_token, "noenh$anced")) {
                term->put_text = PS_put_text;
                term->set_font = PS_set_font;
                ++c_token;
        }

        if (!(c_token >= num_tokens || equals(c_token,";"))) {
                if (almost_equals(c_token,"m$onochrome")) {
                        ps_color=0;
                        c_token++;
                }
                else if (almost_equals(c_token,"c$olor")
                         || almost_equals(c_token,"c$olour")) {
                        ps_color=1;
                        c_token++;
                }
        }

        if (!(c_token >= num_tokens || equals(c_token,";"))) {
                if (almost_equals(c_token,"so$lid")) {
                        ps_solid=1;
                        c_token++;
                }
                else if (almost_equals(c_token,"da$shed")) {
                        ps_solid=0;
                        c_token++;
                }
        }

        if (!(c_token >= num_tokens || equals(c_token,";"))) {
                if (almost_equals(c_token,"si$mplex")) {
                        ps_duplex_state = 0;
                        ps_duplex_option = 1;
                        c_token++;
                }
                else if (almost_equals(c_token,"du$plex")) {
                        ps_duplex_state = 1;
                        ps_duplex_option = 1;
                        c_token++;
                }
                else if (almost_equals(c_token,"defaultp$lex")) {
                        ps_duplex_option = 0;
                        c_token++;
                }
        }

        if (!(c_token >= num_tokens || equals(c_token,";")) && isstring(c_token)) {
                quote_str(ps_font,c_token, 50);
                c_token++;
        }

        if (!(c_token >= num_tokens || equals(c_token,";"))) {

                struct value a;
                ps_fontsize = (int)real(const_express(&a));
                term->v_char = (unsigned int)(ps_fontsize*(10));
                term->h_char = (unsigned int)(ps_fontsize*(10)*6/10);
        }

        sprintf(default_font,"%s,%d",ps_font,ps_fontsize);


        sprintf(term_options,"%s %senhanced %s %s %s \"%s\" %d",
                ps_eps ? "eps" : (ps_portrait ? "portrait" : "landscape"),
      term->put_text == ENHPS_put_text ? "" : "no",
                ps_color ? "color" : "monochrome",
                ps_solid ? "solid" : "dashed",
                ps_duplex_option ? (ps_duplex_state ? "duplex" : "simplex")
                                    : "defaultplex",
                ps_font,ps_fontsize);
}




static int ps_common_encap;
static int ps_common_portrait;
static int ps_common_uses_fonts;
static unsigned int ps_common_xoff, ps_common_yoff;


static void PS_common_init(encap, portrait, uses_fonts, xoff, yoff, bb_xmin, bb_ymin, bb_xmax, bb_ymax, dict)
int encap;
int portrait;
int uses_fonts;
unsigned int xoff, yoff;
unsigned int bb_xmin, bb_ymin, bb_xmax, bb_ymax;
char **dict;
{
static char psi1[] = "%%%%Creator: gnuplot %s patchlevel %s\n%%%%CreationDate: %s%%%%DocumentFonts: %s\n";


static char psi2[] = "%%%%EndComments\n/gnudict 256 dict def\ngnudict begin\n/Color %s def\n/Solid %s def\n/gnulinewidth %.3f def\n/userlinewidth gnulinewidth def\n/vshift %d def\n/dl {%d mul} def\n/hpt_ %.1f def\n/vpt_ %.1f def\n/hpt hpt_ def\n/vpt vpt_ def\n";
# 675 "term/post.trm"
static char * PS_iso_8859_1_encoding[] = {
"/reencodeISO {\n",
"dup dup findfont dup length dict begin\n",
"{ 1 index /FID ne { def }{ pop pop } ifelse } forall\n",
"currentdict /CharStrings known {\n",
"\tCharStrings /Idieresis known {\n",
"\t\t/Encoding ISOLatin1Encoding def } if\n} if\n",
"currentdict end definefont\n",
"} def\n",
"/ISOLatin1Encoding [\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright\n",
"/parenleft/parenright/asterisk/plus/comma/minus/period/slash\n",
"/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon\n",
"/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N\n",
"/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright\n",
"/asciicircum/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m\n",
"/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/asciitilde\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/.notdef/dotlessi/grave/acute/circumflex/tilde/macron/breve\n",
"/dotaccent/dieresis/.notdef/ring/cedilla/.notdef/hungarumlaut\n",
"/ogonek/caron/space/exclamdown/cent/sterling/currency/yen/brokenbar\n",
"/section/dieresis/copyright/ordfeminine/guillemotleft/logicalnot\n",
"/hyphen/registered/macron/degree/plusminus/twosuperior/threesuperior\n",
"/acute/mu/paragraph/periodcentered/cedilla/onesuperior/ordmasculine\n",
"/guillemotright/onequarter/onehalf/threequarters/questiondown\n",
"/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE/Ccedilla\n",
"/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex\n",
"/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis\n",
"/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute\n",
"/Thorn/germandbls/agrave/aacute/acircumflex/atilde/adieresis\n",
"/aring/ae/ccedilla/egrave/eacute/ecircumflex/edieresis/igrave\n",
"/iacute/icircumflex/idieresis/eth/ntilde/ograve/oacute/ocircumflex\n",
"/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex/udieresis\n",
"/yacute/thorn/ydieresis\n",
"] def\n",
((void *)0) };
# 728 "term/post.trm"
static char * PS_cp_437_encoding[] = {
"/reencodeCP437 {\n",
"dup dup findfont dup length dict begin\n",
"{ 1 index /FID ne { def }{ pop pop } ifelse } forall\n",
"currentdict /CharStrings known {\n",
"\tCharStrings /Idieresis known {\n",
"\t\t/Encoding CP437Encoding def } if\n} if\n",
"currentdict end definefont\n",
"} def\n",
"/CP437Encoding [\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright\n",
"/parenleft/parenright/asterisk/plus/comma/minus/period/slash\n",
"/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon\n",
"/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N\n",
"/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright\n",
"/asciicircum/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m\n",
"/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/asciitilde/.notdef\n",
"/Ccedilla/udieresis/eacute/acircumflex/adieresis/agrave/aring/ccedilla\n",
"/ecircumflex/edieresis/egrave/idieresis/icircumflex/igrave/Adieresis/Aring\n",
"/Eacute/ae/AE/ocircumflex/odieresis/ograve/ucircumflex/ugrave\n",
"/ydieresis/Odieresis/Udieresis/cent/sterling/yen/.notdef/florin\n",
"/aacute/iacute/oacute/uacute/ntilde/Ntilde/ordfeminine/ordmasculine\n",
"/questiondown/.notdef/logicalnot/onehalf/onequarter/exclamdown/guillemotleft/guillemotright\n",
"/space/space/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/.notdef/germandbls/.notdef/.notdef/.notdef/.notdef/mu/.notdef\n",
"/.notdef/.notdef/.notdef/.notdef/infinity/.notdef/.notdef/.notdef\n",
"/.notdef/plusminus/greaterequal/lessequal/.notdef/.notdef/divide/.notdef\n",
"/degree/bullet/periodcentered/.notdef/nsuperior/twosuperior/.notdef\n",
"] def\n",
((void *)0) };
# 776 "term/post.trm"
static char * PS_cp_850_encoding[] = {
"/reencodeCP850 {\n",
"dup dup findfont dup length dict begin\n",
"{ 1 index /FID ne { def }{ pop pop } ifelse } forall\n",
"currentdict /CharStrings known {\n",
"\tCharStrings /Idieresis known {\n",
"\t\t/Encoding CP850Encoding def } if\n} if\n",
"currentdict end definefont\n",
"} def\n",
"/CP850Encoding [\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef\n",
"/space/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright\n",
"/parenleft/parenright/asterisk/plus/comma/minus/period/slash\n",
"/zero/one/two/three/four/five/six/seven/eight/nine/colon/semicolon\n",
"/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N\n",
"/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright\n",
"/asciicircum/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m\n",
"/n/o/p/q/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/asciitilde/.notdef\n",
"/Ccedilla/udieresis/eacute/acircumflex/adieresis/agrave/aring/ccedilla\n",
"/ecircumflex/edieresis/egrave/idieresis/icircumflex/igrave/Adieresis/Aring\n",
"/Eacute/ae/AE/ocircumflex/odieresis/ograve/ucircumflex/ugrave\n",
"/ydieresis/Odieresis/Udieresis/oslash/sterling/Oslash/multiply/florin\n",
"/aacute/iacute/oacute/uacute/ntilde/Ntilde/ordfeminine/ordmasculine\n",
"/questiondown/registered/logicalnot/onehalf/onequarter/exclamdown/guillemotleft/guillemotright\n",
"/space/space/.notdef/.notdef/.notdef/Aacute/Acircumflex/Agrave\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/cent/yen/.notdef\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/atilde/Atilde\n",
"/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/currency\n",
"/eth/Eth/Ecircumflex/Edieresis/Egrave/dotlessi/Iacute/Icircumflex\n",
"/Idieresis/.notdef/.notdef/.notdef/.notdef/brokenbar/Igrave/.notdef\n",
"/Oacute/germandbls/Ocircumflex/Ograve/otilde/Otilde/mu/thorn\n",
"/Thorn/Uacute/Ucircumflex/Ugrave/yacute/Yacute/macron/acute\n",
"/hyphen/plusminus/equal/threequarters/paragraph/section/divide/.notdef\n",
"/degree/.notdef/periodcentered/onesuperior/threesuperior/twosuperior/.notdef\n",
"] def\n",
((void *)0) };

        struct TERMENTRY *t = term;
        int i;
        time_t now;

        ps_common_encap = encap;
        ps_common_portrait = portrait;
        ps_common_uses_fonts = uses_fonts;
        ps_common_xoff = xoff;
        ps_common_yoff = yoff;

        ps_page = 0;

        if (!encap)
                fprintf(gpoutfile,"%%!PS-Adobe-2.0\n");
        else
                fprintf(gpoutfile,"%%!PS-Adobe-2.0 EPSF-2.0\n");

        if (outstr) fprintf(gpoutfile, "%%%%Title: %s\n", outstr );
        time(&now);
        fprintf(gpoutfile, psi1, version, patchlevel, asctime(localtime(&now)), uses_fonts ? "(atend)" : "");

        fprintf(gpoutfile,"%%%%BoundingBox: %d %d %d %d\n", xoff + bb_xmin, yoff + bb_ymin, xoff + bb_xmax, yoff + bb_ymax);

        fprintf(gpoutfile,"%%%%Orientation: %s\n", ps_portrait ? "Portrait" : "Landscape");

        if (!encap)
                fprintf(gpoutfile,"%%%%Pages: (atend)\n");
        fprintf(gpoutfile, psi2,
                ps_color ? "true" : "false",
                ps_solid ? "true" : "false",
                (0.5*(10)),
                (int)(t->v_char)/(-3),
                (10),
                (5040/80)/2.0,
                (5040/80)/2.0);

        if (uses_fonts && (encoding == 1)) {
                for (i=0; PS_iso_8859_1_encoding[i] != ((void *)0); i++) {
                        fprintf(gpoutfile,"%s",PS_iso_8859_1_encoding[i]);
                }
        }
        if (uses_fonts && (encoding == 2)) {
                for (i=0; PS_cp_437_encoding[i] != ((void *)0); i++) {
                        fprintf(gpoutfile,"%s",PS_cp_437_encoding[i]);
                }
        }
        if (uses_fonts && (encoding == 3)) {
                for (i=0; PS_cp_850_encoding[i] != ((void *)0); i++) {
                        fprintf(gpoutfile,"%s",PS_cp_850_encoding[i]);
                }
        }





        for ( i=0; PS_header[i] != ((void *)0); i++)
                fprintf(gpoutfile,"%s",PS_header[i]);
        if (ps_duplex_option)
                fprintf(gpoutfile, "statusdict begin %s setduplexmode end\n",
                                ps_duplex_state ? "true" : "false");
        PS_RememberFont(ps_font, 1);

        if (dict)
                while (*dict)
                        fputs(*(dict++), gpoutfile);

        fprintf(gpoutfile,"end\n%%%%EndProlog\n");
}


static void PS_init()
{
        unsigned int xmin_t, ymin_t, xmax_t, ymax_t;

        if (ps_eps)
        {
                term->xmax = 7200;
                term->ymax = 5040;
                xmin_t = 7200 * xoffset / (2*(10));
                xmax_t = 7200 * (xsize + xoffset) / (2*(10));
                ymin_t = 5040 * yoffset / (2*(10));
                ymax_t = 5040 * (yoffset + ysize) / (2*(10));
        }
        else if (ps_portrait)
        {
                term->xmax = 5040;
                term->ymax = 7200;
                xmin_t = 5040 * xoffset / (10);
                xmax_t = 5040 * (xsize + xoffset) / (10);
                ymin_t = 7200 * yoffset / (10);
                ymax_t = 7200 * (ysize + yoffset) / (10);
        }
        else
        {
                term->xmax = 7200;
                term->ymax = 5040;
                ymin_t = 7200 * xoffset / (10);
                ymax_t = 7200 * (xsize+xoffset) / (10);
                xmin_t = 5040 * (1-ysize-yoffset) / (10);
                xmax_t = 5040 * (1-yoffset) / (10);
        }




        (__extension__ (__builtin_constant_p (ps_font) ? (((size_t)(const void *)((ps_font) + 1) - (size_t)(const void *)(ps_font) == 1) && strlen (ps_font) + 1 <= 8 ? __strcpy_small (ps_enh_font, __extension__ (((__const unsigned char *) (__const char *) (ps_font))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) (ps_font))[0]), __extension__ (((__const unsigned char *) (__const char *) (ps_font))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) (ps_font))[4]), __extension__ (((((__const unsigned char *) (__const char *) (ps_font))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) (ps_font))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) (ps_font))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) (ps_font))[0]), __extension__ (((((__const unsigned char *) (__const char *) (ps_font))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) (ps_font))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) (ps_font))[4 + 1])!
 << 8 | ((__const unsigned char *) (__const char *) (ps_font))[4]), strlen (ps_font) + 1) : (char *) memcpy (ps_enh_font, ps_font, strlen (ps_font) + 1)) : strcpy (ps_enh_font, ps_font)));
        ps_enh_fontsize = ps_fontsize;

        PS_common_init(ps_eps, ps_portrait, 1, 50, 50,
           xmin_t, ymin_t, xmax_t, ymax_t,
           (term->put_text == ENHPS_put_text) ? ENHPS_header : ((void *)0));
}


static void PS_graphics()
{
static char psg1[] = "0 setgray\nnewpath\n";
struct TERMENTRY *t = term;
        ps_page++;
        if (!ps_common_encap)
                fprintf(gpoutfile,"%%%%Page: %d %d\n",ps_page,ps_page);
        fprintf(gpoutfile,"gnudict begin\ngsave\n");
        fprintf(gpoutfile,"%d %d translate\n",ps_common_xoff, ps_common_yoff);
        fprintf(gpoutfile,"%.3f %.3f scale\n", (ps_eps ? 0.5 : 1.0)/(10),
                                             (ps_eps ? 0.5 : 1.0)/(10));
        if (!ps_common_portrait) {
            fprintf(gpoutfile,"90 rotate\n0 %d translate\n", (int)(-5040));
        }
        fprintf(gpoutfile, psg1);
        if (ps_common_uses_fonts)
                fprintf(gpoutfile, "(%s) findfont %d scalefont setfont\n", ps_font, (t->v_char) );
        ps_path_count = 0;
        PS_relative_ok = 0;
        PS_pen_x = PS_pen_y = -4000;
        PS_taken = 0;
        PS_linetype_last = -1;
}


static void PS_text()
{
        ps_path_count = 0;
        fprintf(gpoutfile,"stroke\ngrestore\nend\nshowpage\n");




}


static void PS_reset()
{
        fprintf(gpoutfile,"%%%%Trailer\n");






        if (ps_common_uses_fonts) {
                fprintf(gpoutfile,"%%%%DocumentFonts: ");
                while (PS_DocFonts) {
                    struct PS_FontName *fnp;
                        fnp = PS_DocFonts->next;
                        fprintf(gpoutfile, "%s%s", PS_DocFonts->name, fnp ? " " : "\n");
                        free(PS_DocFonts->name);
                        free(PS_DocFonts);
                        PS_DocFonts=fnp;
                }
        }
        if (!ps_common_encap)
                fprintf(gpoutfile,"%%%%Pages: %d\n",ps_page);
}


static void PS_linetype(linetype)
int linetype;
{
        linetype = (linetype % 9) + 2;
        if (linetype < 0) linetype = 0;
        PS_relative_ok = 0;
# 1006 "term/post.trm"
        PS_linetype_last = linetype;
        fprintf(gpoutfile,"LT%c\n", "ba012345678"[linetype]);
        ps_path_count = 0;
}


static void PS_linewidth (linewidth)
double linewidth;
{
        fprintf(gpoutfile,"%.3f UL\n",linewidth);
# 1038 "term/post.trm"
}


static void PS_pointsize (ptsize)
double ptsize;
{
        fprintf(gpoutfile,"%.3f UP\n",ptsize);
# 1067 "term/post.trm"
}


static void PS_move(x,y)
unsigned int x,y;
{
        int dx, dy;

        char abso[5+2*(3*sizeof(int))], rel[5+2*(3*sizeof(int))];
        dx = x - PS_pen_x;
        dy = y - PS_pen_y;

        if (dx==0 && dy==0 && PS_relative_ok)
                return;
        sprintf(abso, "%d %d M\n", x, y);
        sprintf(rel, "%d %d R\n", dx, dy);
        if (strlen(rel) < strlen(abso) && PS_relative_ok){
                fputs(rel, gpoutfile);
                PS_taken++;
        }else
                fputs(abso, gpoutfile);
        PS_relative_ok = 1;
        ps_path_count += 1;

        PS_pen_x = x;
        PS_pen_y = y;
}

static void PS_vector(x,y)
unsigned int x,y;
{
        int dx, dy;
        char abso[5+2*(3*sizeof(int))], rel[5+2*(3*sizeof(int))];
        dx = x - PS_pen_x;
        dy = y - PS_pen_y;
        if (dx==0 && dy==0) return;
        sprintf(abso, "%d %d L\n", x, y);
        sprintf(rel, "%d %d V\n", dx, dy);
        if (strlen(rel) < strlen(abso) && PS_relative_ok){
                fputs(rel, gpoutfile);
                PS_taken++;
        }else
                fputs(abso, gpoutfile);
        PS_relative_ok = 1;
        ps_path_count += 1;
        PS_pen_x = x;
        PS_pen_y = y;
        if (ps_path_count >= 400) {
                fprintf(gpoutfile,"currentpoint stroke M\n");
                ps_path_count = 0;
        }
}


static void PS_put_text(x,y,str)
unsigned int x, y;
char *str;
{
char ch;
        if (!strlen(str)) return;
        PS_move(x,y);
        if (ps_ang != 0)
                fprintf(gpoutfile,"currentpoint gsave translate %d rotate 0 0 M\n"
                        ,ps_ang*90);
        _IO_putc ('(', gpoutfile);
        ch = *str++;
        while(ch!='\0') {
                if ( (ch=='(') || (ch==')') || (ch=='\\') )
                        _IO_putc ('\\', gpoutfile);
                _IO_putc (ch, gpoutfile);
                ch = *str++;
        }
        switch(ps_justify) {
                case LEFT : fprintf(gpoutfile,") Lshow\n");
                        break;
                case CENTRE : fprintf(gpoutfile,") Cshow\n");
                        break;
                case RIGHT : fprintf(gpoutfile,") Rshow\n");
                        break;
        }
        if (ps_ang != 0)
                fprintf(gpoutfile,"grestore\n");
        ps_path_count = 0;
        PS_relative_ok = 0;
}


static int PS_text_angle(ang)
int ang;
{
        ps_ang=ang;
        return 1;
}


static int PS_justify_text(mode)
enum JUSTIFY mode;
{
        ps_justify=mode;
        return 1;
}


static int PS_set_font(font)
char *font;
{
char name[32];
int size,sep;

        sep=__extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p (",") && ((size_t)(const void *)((",") + 1) - (size_t)(const void *)(",") == 1) ? ((__r0 = ((__const char *) (","))[0], __r0 == '\0') ? strlen (font) : ((__r1 = ((__const char *) (","))[1], __r1 == '\0') ? __strcspn_c1 (font, __r0) : ((__r2 = ((__const char *) (","))[2], __r2 == '\0') ? __strcspn_c2 (font, __r0, __r1) : (((__const char *) (","))[3] == '\0' ? __strcspn_c3 (font, __r0, __r1, __r2) : strcspn (font, ","))))) : strcspn (font, ",")); });
        (__extension__ (__builtin_constant_p (font) && __builtin_constant_p (sep) ? (strlen (font) + 1 >= ((size_t) (sep)) ? (char *) memcpy (name, font, sep) : strncpy (name, font, sep)) : strncpy (name, font, sep))); name[sep]=('\0');
        size=ps_fontsize; sscanf (&(font[sep+1]),"%d",&size);
        fprintf(gpoutfile,"/%s findfont %d scalefont setfont\n",name,size*(10));
        PS_RememberFont(name,1 );
        return 1;
}





static void PS_point(x,y,number)
unsigned int x,y;
int number;
{
static char * pointFNS[] = {"Pnt", "Pls", "Crs", "Star",
                           "Box", "BoxF", "Circle", "CircleF",
                           "TriU", "TriUF", "TriD", "TriDF",
                           "Dia", "DiaF", "Pent", "PentF",
                           "C0", "C1", "C2", "C3",
                           "C4", "C5", "C6", "C7",
                           "C8", "C9", "C10", "C11",
                           "C12", "C13", "C14", "C15",
                           "S0", "S1", "S2", "S3",
                           "S4", "S5", "S6", "S7",
                           "S8", "S9", "S10", "S11",
                           "S12", "S13", "S14", "S15",
                           "D0", "D1", "D2", "D3",
                           "D4", "D5", "D6", "D7",
                           "D8", "D9", "D10", "D11",
                           "D12", "D13", "D14", "D15",
                           "BoxE", "CircE", "TriUE", "TriDE",
                           "DiaE", "PentE", "BoxW", "CircW",
                           "TriUW", "TriDW", "DiaW", "PentW"
};
        if (number < 0)
                number = -1;
        else
                number %= sizeof(pointFNS)/sizeof(pointFNS[0]) -1;
        fprintf(gpoutfile,"%d %d %s\n", x, y, pointFNS[number+1]);

        PS_relative_ok = 0;
        ps_path_count = 0;
        PS_linetype_last = -1;
}

static void PS_fillbox(style, x1,y1,x2,y2)
int style;
unsigned int x1,y1,x2,y2;
{
        if (ps_path_count) { fprintf(gpoutfile, "stroke "); ps_path_count = 0; }

        fprintf(gpoutfile, "%d %d %d %d BoxFill\n", x1,y1, x2,y2);

        PS_relative_ok = 0;
        PS_linetype_last = -1;
}
# 1246 "term/post.trm"
static TBOOLEAN ENHps_opened_string;



static float ENHps_max_height, ENHps_min_height;
# 1264 "term/post.trm"
static char *ENHPS_recurse(p, brace, fontname, fontsize, base, widthflag, showflag)
char *p, *fontname;
TBOOLEAN brace, widthflag, showflag;
double fontsize, base;
{
# 1291 "term/post.trm"
        { if (ENHps_opened_string) { fputs(")]\n", gpoutfile); ENHps_opened_string = 0; } }

        if (base + fontsize > ENHps_max_height)
        { ENHps_max_height = base + fontsize;
                                                                               ;
        }

        if (base < ENHps_min_height)
        { ENHps_min_height = base;
                                                                               ;
        }

        while (*p)
        { float shift;

                switch (*p)
                {
                        case '}' :

                                if (brace)
                                        return (p);

                                fprintf(stderr, "enhpost printer driver - spurious }\n");
                                break;


                        case '_' :
                        case '^' :


                                shift = (*p == '^') ? 0.5 : -0.3;

                                { if (ENHps_opened_string) { fputs(")]\n", gpoutfile); ENHps_opened_string = 0; } }

                                p = ENHPS_recurse(p+1, 0, fontname, fontsize*0.8, base+shift*fontsize, widthflag, showflag);

                                break;


                        case '{' :
                        {
                                char *savepos=((void *)0), save=0;
                                char *localfontname=fontname, ch;
                                int recode=1;
                                float f=fontsize;





                                if (*++p == '/')
                                {
                                        while (*++p == ' ');
                                        if (*p=='-')
                                        {
                                                recode=0;
                                                while (*++p == ' ');
                                        }
                                        localfontname = p;
                                        while ((ch = *p) > ' ' && ch != '=' && ch != '*')
                                                ++p;
                                        save = *(savepos=p);
                                        if (ch == '=')
                                        {
                                                *p++ = '\0';


                                                f = (float)strtod(p, &p);


                                                if (f)
                                                        f *= (10);
                                                else
                                                        f = fontsize;



                                        }
                                        else if (ch == '*')
                                        {
                                                *p++ = '\0';


                                                f = (float)strtod(p, &p);


                                                if (f)
                                                        f *= fontsize;
                                                else
                                                        f = fontsize;



                                        }
                                        else
                                        {
                                                *p++ = '\0';
                                                f = fontsize;
                                        }

                                        while (*p == ' ')
                                                ++p;
                                        if (*localfontname)
                                        {

                                                char *recodestring = PS_RememberFont(localfontname, recode && !ENHps_opened_string);
                                                if (recode && recodestring)
                                                {
                                                        { if (ENHps_opened_string) { fputs(")]\n", gpoutfile); ENHps_opened_string = 0; } }
                                                        fprintf(gpoutfile, "/%s %s", localfontname, recodestring);
                                                }
                                        }
                                        else
                                                localfontname = fontname;
                                }




                                p = ENHPS_recurse(p, 1, localfontname, f, base, widthflag, showflag);

                                                                      ;

                                { if (ENHps_opened_string) { fputs(")]\n", gpoutfile); ENHps_opened_string = 0; } }

                                if (savepos)

                                        *savepos = save;

                                break;
                        }

                        case '@' :


                                { if (ENHps_opened_string) { fputs(")]\n", gpoutfile); ENHps_opened_string = 0; } }

                                p = ENHPS_recurse(++p, 0, fontname, fontsize, base, 0, showflag);

                                break;


                        case '&' :


                                { if (ENHps_opened_string) { fputs(")]\n", gpoutfile); ENHps_opened_string = 0; } }

                                p = ENHPS_recurse(++p, 0, fontname, fontsize, base, widthflag, 0);

                                break;


                        case '(' :
                        case ')' :


                                { if (!ENHps_opened_string) { fprintf(gpoutfile, "[(%s) %.1f %.1f %s %s (", fontname, fontsize, base, widthflag ? "true" : "false", showflag ? "true" : "false"); ENHps_opened_string = 1; } }
                                fputc('\\', gpoutfile);
                                fputc(*p, gpoutfile);
                                break;


                        case '\\' :



                                if (p[1]=='\\' || p[1]=='(' || p[1]==')')
                                {
                                        { if (!ENHps_opened_string) { fprintf(gpoutfile, "[(%s) %.1f %.1f %s %s (", fontname, fontsize, base, widthflag ? "true" : "false", showflag ? "true" : "false"); ENHps_opened_string = 1; } }
                                        fputc('\\', gpoutfile);
                                }
                                else if (p[1] >= '0' && p[1] <= '7')
                                {

                                        { if (!ENHps_opened_string) { fprintf(gpoutfile, "[(%s) %.1f %.1f %s %s (", fontname, fontsize, base, widthflag ? "true" : "false", showflag ? "true" : "false"); ENHps_opened_string = 1; } }
                                        fputc('\\', gpoutfile);
                                        fputc(p[1], gpoutfile);
                                        ++p;
                                        if (p[1] >= '0' && p[1] <= '7')
                                        {
                                                fputc(p[1], gpoutfile);
                                                ++p;
                                                if (p[1] >= '0' && p[1] <= '7')
                                                {
                                                        fputc(p[1], gpoutfile);
                                                        ++p;
                                                }
                                        }
                                        break;
                                }

                                ++p;



                        default:

                                { if (!ENHps_opened_string) { fprintf(gpoutfile, "[(%s) %.1f %.1f %s %s (", fontname, fontsize, base, widthflag ? "true" : "false", showflag ? "true" : "false"); ENHps_opened_string = 1; } }

                                fputc(*p, gpoutfile);



                }





                if (!brace)
                {
                        { if (ENHps_opened_string) { fputs(")]\n", gpoutfile); ENHps_opened_string = 0; } }
                        return(p);
                }

                if (*p)
                        ++p;
        }
        { if (ENHps_opened_string) { fputs(")]\n", gpoutfile); ENHps_opened_string = 0; } }
        return p;
}







static int ENHPS_set_font(font)
char *font;
{
                                                       ;

        if (*font)
        {
                int sep=__extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p (",") && ((size_t)(const void *)((",") + 1) - (size_t)(const void *)(",") == 1) ? ((__r0 = ((__const char *) (","))[0], __r0 == '\0') ? strlen (font) : ((__r1 = ((__const char *) (","))[1], __r1 == '\0') ? __strcspn_c1 (font, __r0) : ((__r2 = ((__const char *) (","))[2], __r2 == '\0') ? __strcspn_c2 (font, __r0, __r1) : (((__const char *) (","))[3] == '\0' ? __strcspn_c3 (font, __r0, __r1, __r2) : strcspn (font, ","))))) : strcspn (font, ",")); });
                (__extension__ (__builtin_constant_p (font) && __builtin_constant_p (sep) ? (strlen (font) + 1 >= ((size_t) (sep)) ? (char *) memcpy (ps_enh_font, font, sep) : strncpy (ps_enh_font, font, sep)) : strncpy (ps_enh_font, font, sep))); ps_enh_font[sep]=('\0');
                ps_enh_fontsize=ps_fontsize; sscanf (font+sep+1,"%d",&ps_enh_fontsize);
                PS_RememberFont(ps_enh_font, 1);
        }
        else
        {

                (__extension__ (__builtin_constant_p (ps_font) ? (((size_t)(const void *)((ps_font) + 1) - (size_t)(const void *)(ps_font) == 1) && strlen (ps_font) + 1 <= 8 ? __strcpy_small (ps_enh_font, __extension__ (((__const unsigned char *) (__const char *) (ps_font))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) (ps_font))[0]), __extension__ (((__const unsigned char *) (__const char *) (ps_font))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) (ps_font))[4]), __extension__ (((((__const unsigned char *) (__const char *) (ps_font))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) (ps_font))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) (ps_font))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) (ps_font))[0]), __extension__ (((((__const unsigned char *) (__const char *) (ps_font))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) (ps_font))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) (ps_font))!
[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) (ps_font))[4]), strlen (ps_font) + 1) : (char *) memcpy (ps_enh_font, ps_font, strlen (ps_font) + 1)) : strcpy (ps_enh_font, ps_font)));
                ps_enh_fontsize = ps_fontsize;
        }

        return 1;
}

static void ENHPS_put_text(x, y, str)
unsigned int x, y;
char *str;
{


        if (!strlen(str))
                return;

        if (ps_path_count)
        {
                fputs(" stroke\n",gpoutfile);
                ps_path_count=0;
                PS_relative_ok=0;
        }
# 1572 "term/post.trm"
        PS_move(x,y);

        if (ps_ang != 0)
                fprintf(gpoutfile,"currentpoint gsave translate %d rotate 0 0 moveto\n",
                        ps_ang*90);

        fputs("[ ",gpoutfile);



        ENHps_opened_string = 0;
        ENHps_max_height = -1000;
        ENHps_min_height = 1000;
# 1598 "term/post.trm"
        while (*(str = ENHPS_recurse(str, 1, ps_enh_font,
                                     (double)(ps_enh_fontsize*(10)),
                                     0.0, 1, 1)))
        {
                { if (ENHps_opened_string) { fputs(")]\n", gpoutfile); ENHps_opened_string = 0; } }


                if (*str == '}')
                        fprintf(stderr, "enhpost printer driver - ignoring spurious }\n");
                else
                        fprintf(stderr, "internal error in enhpost driver - *str=0x%x\n", *str);

                if (!*++str)
                        break;


        }

        ENHps_max_height += ENHps_min_height;

        fprintf(gpoutfile, "] %.1f ", -ENHps_max_height/3);

        switch(ps_justify)
        {
                case LEFT : fprintf(gpoutfile, "MLshow\n");
                        break;
                case CENTRE : fprintf(gpoutfile, "MCshow\n");
                        break;
                case RIGHT : fprintf(gpoutfile, "MRshow\n");
                        break;
        }

        if (ps_ang != 0)
                fputs("grestore\n", gpoutfile);
        ps_path_count = 0;
        PS_relative_ok=0;
}
# 330 "term.h" 2


# 1 "term/qms.trm" 1
# 55 "term/qms.trm"
# 1 "term/driver.h" 1
# 56 "term/qms.trm" 2






static void QMS_init (void);
static void QMS_graphics (void);
static void QMS_text (void);
static void QMS_linetype (int linetype);
static void QMS_move (unsigned int x, unsigned int y);
static void QMS_vector (unsigned int x2, unsigned int y2);
static void QMS_put_text (unsigned int x, unsigned int y, char str[]);
static void QMS_reset (void);
# 85 "term/qms.trm"
static int qms_line = 0;

static void QMS_init()
{

    fputs("^PY^-\n^IOL\n^ISYNTAX00000^F^IB11000^IJ00000^IT00000\n", gpoutfile);
# 99 "term/qms.trm"
}


static void QMS_graphics()
{
    fputs("^IGV\n", gpoutfile);

}



static void QMS_text()
{


    fputs("^IGE\n^-^,", gpoutfile);




}


static void QMS_linetype(linetype)
int linetype;
{
    static int width[2 + 9] = { 7, 3, 3, 3, 3, 5, 5, 5, 7, 7, 7 };
    static int type[2 + 9] = { 0, 1, 0, 2, 3, 0, 2, 3, 0, 2, 3 };
# 136 "term/qms.trm"
    qms_line = linetype;
    if (linetype >= 9)
        linetype %= 9;

    fprintf(gpoutfile, "^PW%02d\n", width[linetype + 2]);


    switch (type[linetype + 2]) {
    case 1:
        fputs("^PV102025^G\n^V1\n", gpoutfile);



        break;
    case 2:
        fputs("^PV202050^G\n^V2\n", gpoutfile);
        break;
    case 3:
        fputs("^PV302100^G\n^V3\n", gpoutfile);
        break;
    default:
    case 0:
        fputs("^V0\n", gpoutfile);
        break;
    }
}


static void QMS_move(x, y)
unsigned int x, y;
{
    fprintf(gpoutfile, "^U%05d:%05d\n", 1000 + x, (6000 - 1) + 1000 - y);

}


static void QMS_vector(x2, y2)
unsigned int x2, y2;
{
    fprintf(gpoutfile, "^D%05d:%05d\n", 1000 + x2, (6000 - 1) + 1000 - y2);

}


static void QMS_put_text(x, y, str)
unsigned int x, y;
char str[];
{
    char ch;
    QMS_move(x, y + 120 / 3);
    fputs("^IGE\n", gpoutfile);
    ch = *str++;
    while (ch != ('\0')) {
        if (ch == '^')
            _IO_putc ('^', gpoutfile);
        _IO_putc (ch, gpoutfile);
        ch = *str++;
    }
    fputs("\n^IGV\n", gpoutfile);
    QMS_linetype(qms_line);
}


static void QMS_reset()
{
    fputs("^PN^-\n", gpoutfile);

}
# 333 "term.h" 2


# 1 "term/table.trm" 1
# 336 "term.h" 2


# 1 "term/tgif.trm" 1
# 69 "term/tgif.trm"
# 1 "term/driver.h" 1
# 70 "term/tgif.trm" 2






static void TGIF_options (void);
static void TGIF_init (void);
static void TGIF_reset (void);
static void TGIF_text (void);
static void TGIF_graphics (void);
static void TGIF_move (unsigned int ux, unsigned int uy);
static void TGIF_vector (unsigned int ux, unsigned int uy);
static void TGIF_linetype (int linetype);
static void TGIF_put_text (unsigned int ux, unsigned int uy, char *str);
static int TGIF_text_angle (int ang);
static int TGIF_justify_text (enum JUSTIFY mode);
static void TGIF_point (unsigned int ux, unsigned int uy, int number);
static void TGIF_arrow (unsigned int sx, unsigned int sy, unsigned int ex, unsigned int ey, TBOOLEAN head);
static int TGIF_set_font (char *font);
static void TGIF_set_pointsize (double size);
# 128 "term/tgif.trm"
static unsigned int uLastTgifX, uLastTgifY;

static unsigned int uActNr;
static unsigned int uActPage;
static unsigned int uActResolution;
static unsigned int uActZoom;
static unsigned int uActAngle;
static unsigned int uActThick;
static unsigned int uActPointSize;
static unsigned int uActStyle;
static unsigned int uActJust;
static unsigned int uXshift;
static unsigned int uYshift;
static unsigned int uTgifPlotCount;
static unsigned int uTgifPlotRow, uTgifPlotCol;
static unsigned int uTgif_win_horiz, uTgif_win_verti;



static char sActColor[255];
static unsigned int uDefaultFontSize;
static unsigned int uActFontSize;
static char sDefaultFont[255];
static char sActFont[255];


static TBOOLEAN TgifSolid = 0;
static TBOOLEAN TgifPortrait = 1;

static unsigned int uTgifPlotsPerPage = 1;
static unsigned int uTextAngle[] =
{0, 3};






static unsigned int uLineThick[] = { 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };
static unsigned int uLineStyle[] = { 0, 5, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0 };
static char *psColors[] =
{
 "black", "black",
 "red", "green", "blue", "magenta", "cyan", "yellow",
 "DarkSeaGreen", "HotPink", "black", "coral"};
# 182 "term/tgif.trm"
static int iTgifPolyCount;
static unsigned int uBuffX[100], uBuffY[100];

enum eState {
    NEWPOLY = 100, INPOLY
};
static enum eState eTgifState = NEWPOLY;

static void TGIF_flush_poly (void);





static void TGIF_flush_poly()
{
    int i;


    if (eTgifState == INPOLY) {
        fprintf(gpoutfile, "poly('%s',%d,[\n\t", sActColor, iTgifPolyCount);

        for (i = 0; i < iTgifPolyCount - 1; i++) {
            fprintf(gpoutfile, "%u,%u,", uBuffX[i], uBuffY[i]);
            if ((i + 1) % 8 == 0)
                fputs("\n\t", gpoutfile);
        }

        fprintf(gpoutfile, "%u,%u],0,%u,1,%u,0,0,%u,0,8,3,0,[\n]).\n",
                uBuffX[iTgifPolyCount - 1], uBuffY[iTgifPolyCount - 1],
                uActThick, uActNr, uActStyle);

        uActNr++;

        eTgifState = NEWPOLY;
        iTgifPolyCount = 0;
        if (gpoutfile != (FILE *) ((void *)0))
            fflush(gpoutfile);
    }
}


static void TGIF_options()
{

    struct value a, b;
    double dscaleH, dscaleV;


    (__extension__ (__builtin_constant_p ("Helvetica") ? (((size_t)(const void *)(("Helvetica") + 1) - (size_t)(const void *)("Helvetica") == 1) && strlen ("Helvetica") + 1 <= 8 ? __strcpy_small (sActFont, __extension__ (((__const unsigned char *) (__const char *) ("Helvetica"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("Helvetica"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("Helvetica"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("Helvetica"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[4 + 2]) << 8 | ((__const uns!
igned char *) (__const char *) ("Helvetica"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[4]), strlen ("Helvetica") + 1) : (char *) memcpy (sActFont, "Helvetica", strlen ("Helvetica") + 1)) : strcpy (sActFont, "Helvetica")));
    (__extension__ (__builtin_constant_p ("Helvetica") ? (((size_t)(const void *)(("Helvetica") + 1) - (size_t)(const void *)("Helvetica") == 1) && strlen ("Helvetica") + 1 <= 8 ? __strcpy_small (sDefaultFont, __extension__ (((__const unsigned char *) (__const char *) ("Helvetica"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("Helvetica"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("Helvetica"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("Helvetica"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[4 + 2]) << 8 | ((__const!
 unsigned char *) (__const char *) ("Helvetica"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("Helvetica"))[4]), strlen ("Helvetica") + 1) : (char *) memcpy (sDefaultFont, "Helvetica", strlen ("Helvetica") + 1)) : strcpy (sDefaultFont, "Helvetica")));
    uActFontSize = 18;
    uDefaultFontSize = 18;
    term->v_char = (unsigned int) (uActFontSize);
    term->h_char = (unsigned int) (uActFontSize * 6 / 10);

    TgifPortrait = 1;
    uTgifPlotsPerPage = 1;
    uTgifPlotRow = 1;
    uTgifPlotCol = 1;
    uTgif_win_horiz = 1;
    uTgif_win_verti = 1;
    uActResolution = 100;




    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "p$ortrait")) {
            TgifPortrait = 1;
            c_token++;
        } else if (almost_equals(c_token, "l$andscape")) {
            TgifPortrait = 0;
            uActResolution = 140;
            c_token++;
        }
    }


    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (equals(c_token, "[")) {
            c_token++;
            if ((c_token >= num_tokens || equals(c_token,";"))) {
                int_error("no. windows: [horizontal,vertical] expected", c_token);
            } else if (!equals(c_token, ",")) {
                uTgif_win_horiz = (int) real(const_express(&a));
            }
            if (!equals(c_token, ","))
                int_error("',' expected", c_token);
            c_token++;
            if (!equals(c_token, "]")) {
                uTgif_win_verti = (int) real(const_express(&a));
            }
            if (!equals(c_token, "]"))
                int_error("expecting ']'", c_token);
            c_token++;

            uTgifPlotsPerPage = uTgif_win_verti * uTgif_win_horiz;


        }
    }


    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "s$olid")) {
            TgifSolid = 1;
            c_token++;
        } else if (almost_equals(c_token, "d$ashed")) {
            TgifSolid = 0;
            c_token++;
        }
    }


    if (!(c_token >= num_tokens || equals(c_token,";")) && isstring(c_token)) {
        quote_str(sActFont, c_token, 1024);
        (__extension__ (__builtin_constant_p (sActFont) ? (((size_t)(const void *)((sActFont) + 1) - (size_t)(const void *)(sActFont) == 1) && strlen (sActFont) + 1 <= 8 ? __strcpy_small (sDefaultFont, __extension__ (((__const unsigned char *) (__const char *) (sActFont))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) (sActFont))[0]), __extension__ (((__const unsigned char *) (__const char *) (sActFont))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) (sActFont))[4]), __extension__ (((((__const unsigned char *) (__const char *) (sActFont))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) (sActFont))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) (sActFont))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) (sActFont))[0]), __extension__ (((((__const unsigned char *) (__const char *) (sActFont))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) (sActFont))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) (sA!
ctFont))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) (sActFont))[4]), strlen (sActFont) + 1) : (char *) memcpy (sDefaultFont, sActFont, strlen (sActFont) + 1)) : strcpy (sDefaultFont, sActFont)));
        c_token++;
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {

        uActFontSize = (unsigned int) real(const_express(&b));
        uDefaultFontSize = uActFontSize;
        term->v_char = (unsigned int) (uActFontSize);
        term->h_char = (unsigned int) (uActFontSize * 6 / 10);
    }


    if (TgifPortrait) {
        dscaleH = (double) 100.0 *(950) / (xsize * (950 + (uTgif_win_horiz - 1) * 1030));
        dscaleV = (double) 100.0 *(1400) / (ysize * (634 + (uTgif_win_verti - 1) * 714));
        uActResolution = (int) ( (dscaleH) < (dscaleV) ? (dscaleH) : (dscaleV) );
        switch (uTgif_win_verti) {
        case 1:
            uActZoom = 0;
            break;

        case 2:
            uActZoom = 1;
            break;
        default:
            uActZoom = 2;
            break;

        }
    } else {
        dscaleH = (double) 100.0 *(1400) / (xsize * (950 + (uTgif_win_horiz - 1) * 1030));
        dscaleV = (double) 100.0 *(950) / (ysize * (634 + (uTgif_win_verti - 1) * 714));
        uActResolution = (unsigned int) ( (dscaleH) < (dscaleV) ? (dscaleH) : (dscaleV) );

        switch (uTgif_win_verti) {
        case 1:
            uActZoom = 0;
            break;

        case 2:
            uActZoom = 1;
            break;
        default:
            uActZoom = 2;
            break;

        }
    }



    sprintf(term_options, "%s [%u,%u] %s \"%s\" %u",
            TgifPortrait ? "portrait" : "landscape",
            uTgif_win_horiz, uTgif_win_verti,
            TgifSolid ? "solid" : "dashed",
            sActFont, uActFontSize);
}


static void TGIF_init()
{

    if (multiplot) {

        uActResolution = (unsigned int) 100;

        if (uTgifPlotsPerPage > 1) {
            fputs("warning: using standard multiplot\n", stderr);
            uTgifPlotsPerPage = 1;
        }
        uActZoom = 1;
    }
    fprintf(gpoutfile, "%%TGIF 2.15-p7\nstate(%d,30,%u,0,0,%u,16,1,9,1,1,0,0,0,0,1,0,'%s',0,%u,0,0,1,10,0,0,1,1,0,16,0,0,1,1,1).\n%%\n%% @(#)$Header: /var/tmp/CVSROOT/gnuplot/term/tgif.trm,v 1.10 1998/12/16 19:48:20 lhecking Exp $\n%% %%W%%\n%%\npage(1,\"\").\n",




            TgifPortrait ? 0 : 1, uActResolution, uActZoom, sActFont, uActFontSize);
    eTgifState = NEWPOLY;
    iTgifPolyCount = 0;
    uTgifPlotCount = 0;
    uActPage = 1;

}


static void TGIF_graphics()
{

    TGIF_flush_poly();

    if (multiplot) {

        term->xmax = (TgifPortrait) ? 950 : 1400;
        term->ymax = (TgifPortrait) ? 1400 : 950;
        uLastTgifX = (TgifPortrait) ? 50 : 50;
        uLastTgifY = (TgifPortrait) ? 1400 + 50 : 950 + 50;

        uYshift = uLastTgifY;
        uXshift = uLastTgifX;

    } else {
        if (uTgifPlotCount < uTgifPlotsPerPage)
            uTgifPlotCount++;
        else {
            fprintf(stderr, "error: number of plots > plots per page\n");
            return;
        }

        uXshift = (unsigned int) 50 *100 / uActResolution + (xsize * (uTgifPlotCol - 1) * 1030);
        uYshift = (unsigned int) 50 *100 / uActResolution + (ysize * (634 +
                                                                             (uTgifPlotRow - 1) * 714));

        if (uTgifPlotCount % uTgif_win_horiz == 0) {
            uTgifPlotCol = 1;
            uTgifPlotRow++;
        } else {
            uTgifPlotCol++;
        }

        uLastTgifX = uXshift;
        uLastTgifY = uYshift;

    }






    iTgifPolyCount = 0;
    uActNr = 0;
    uActAngle = 0;
    uActThick = 1;
    uActStyle = 0;
    uActJust = LEFT;
    (__extension__ (__builtin_constant_p (psColors[0]) ? (((size_t)(const void *)((psColors[0]) + 1) - (size_t)(const void *)(psColors[0]) == 1) && strlen (psColors[0]) + 1 <= 8 ? __strcpy_small (sActColor, __extension__ (((__const unsigned char *) (__const char *) (psColors[0]))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) (psColors[0]))[0]), __extension__ (((__const unsigned char *) (__const char *) (psColors[0]))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) (psColors[0]))[4]), __extension__ (((((__const unsigned char *) (__const char *) (psColors[0]))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) (psColors[0]))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) (psColors[0]))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) (psColors[0]))[0]), __extension__ (((((__const unsigned char *) (__const char *) (psColors[0]))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) (psColors[0]))[4 + 2]) << 8 | ((__const un!
signed char *) (__const char *) (psColors[0]))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) (psColors[0]))[4]), strlen (psColors[0]) + 1) : (char *) memcpy (sActColor, psColors[0], strlen (psColors[0]) + 1)) : strcpy (sActColor, psColors[0])));


}


static void TGIF_text()
{
    TGIF_flush_poly();


}



static void TGIF_reset()
{
    TGIF_flush_poly();
    iTgifPolyCount = 0;
    uTgifPlotCount = 0;
    uTgifPlotRow = 1;
    uTgifPlotCol = 1;


    if (gpoutfile != (FILE *) ((void *)0))
        fflush(gpoutfile);

}


static void TGIF_linetype(linetype)
int linetype;
{
    unsigned int ult;


    TGIF_flush_poly();


    if (linetype >= 0)
        ult = 2 + linetype % 10;
    else
        ult = linetype + 2;

    (__extension__ (__builtin_constant_p (psColors[ult]) ? (((size_t)(const void *)((psColors[ult]) + 1) - (size_t)(const void *)(psColors[ult]) == 1) && strlen (psColors[ult]) + 1 <= 8 ? __strcpy_small (sActColor, __extension__ (((__const unsigned char *) (__const char *) (psColors[ult]))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) (psColors[ult]))[0]), __extension__ (((__const unsigned char *) (__const char *) (psColors[ult]))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) (psColors[ult]))[4]), __extension__ (((((__const unsigned char *) (__const char *) (psColors[ult]))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) (psColors[ult]))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) (psColors[ult]))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) (psColors[ult]))[0]), __extension__ (((((__const unsigned char *) (__const char *) (psColors[ult]))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) (psColors[ult]))!
[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) (psColors[ult]))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) (psColors[ult]))[4]), strlen (psColors[ult]) + 1) : (char *) memcpy (sActColor, psColors[ult], strlen (psColors[ult]) + 1)) : strcpy (sActColor, psColors[ult])));
    uActThick = uLineThick[ult];
    if (!TgifSolid)
        uActStyle = uLineStyle[ult];
    else {
        if (ult == 1)
            uActStyle = uLineStyle[ult];
        else
            uActStyle = uLineStyle[2];

    }

}


static void TGIF_move(ux, uy)
unsigned int ux, uy;
{

    uLastTgifX = ux + uXshift;
    uLastTgifY = uYshift - uy;

    if (eTgifState == INPOLY)
        TGIF_flush_poly();



}


static void TGIF_vector(ux, uy)
unsigned int ux, uy;
{

    ux = ux + uXshift;
    uy = uYshift - uy;



    if (eTgifState == NEWPOLY) {
        uBuffX[0] = uLastTgifX;
        uBuffY[0] = uLastTgifY;
        iTgifPolyCount = 1;
        eTgifState = INPOLY;
    }
    uBuffX[iTgifPolyCount] = ux;
    uBuffY[iTgifPolyCount] = uy;
    uLastTgifX = ux;
    uLastTgifY = uy;
    iTgifPolyCount++;
    eTgifState = INPOLY;

    if (iTgifPolyCount == 100) {
        TGIF_flush_poly();

    }
}


static void TGIF_arrow(sx, sy, ex, ey, head)
unsigned int sx, sy, ex, ey;
TBOOLEAN head;
{

    TGIF_flush_poly();

    sx = sx + uXshift;
    ex = ex + uXshift;
    sy = uYshift - sy;
    ey = uYshift - ey;


    if (head) {
        fprintf(gpoutfile, "poly('%s',%d,[\n\t%u,%u,%u,%u],1,%u,1,%u,0,0,%u,0,8,3,0,[\n]).\n",
                sActColor, 2, sx, sy, ex, ey, uActThick, uActNr, uActStyle);
    } else {
        fprintf(gpoutfile, "poly('%s',%d,[\n\t%u,%u,%u,%u],1,%u,1,%u,0,0,%u,0,8,3,0,[\n]).\n",
                sActColor, 2, sx, sy, ex, ey, uActThick, uActNr, uActStyle);
    }

    uActNr++;



    uLastTgifX = ex;
    uLastTgifY = ey;

}


static void TGIF_put_text(ux, uy, str)
unsigned int ux, uy;
char *str;
{

    unsigned int x, y;
    struct TERMENTRY *t = term;

    TGIF_flush_poly();

    x = ux + uXshift;
    y = uYshift - uy - t->v_char / 2;



    if (strlen(str) == 0)
        return;


    fprintf(gpoutfile,
            "text('%s',%u,%u,'%s',0,%u,1,%u,%u,1,55,119,%u,0,15,4,0,0,0,0,[\n\t\"%s\"]).\n",
            sActColor, x, y, sActFont, uActFontSize, uActJust, uActAngle, uActNr, str);

    uActNr += 2;


    uActFontSize = uDefaultFontSize;
    (__extension__ (__builtin_constant_p (sDefaultFont) ? (((size_t)(const void *)((sDefaultFont) + 1) - (size_t)(const void *)(sDefaultFont) == 1) && strlen (sDefaultFont) + 1 <= 8 ? __strcpy_small (sActFont, __extension__ (((__const unsigned char *) (__const char *) (sDefaultFont))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) (sDefaultFont))[0]), __extension__ (((__const unsigned char *) (__const char *) (sDefaultFont))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) (sDefaultFont))[4]), __extension__ (((((__const unsigned char *) (__const char *) (sDefaultFont))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) (sDefaultFont))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) (sDefaultFont))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) (sDefaultFont))[0]), __extension__ (((((__const unsigned char *) (__const char *) (sDefaultFont))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) (sDefaultFont))[4 + 2]) << 8 |!
 ((__const unsigned char *) (__const char *) (sDefaultFont))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) (sDefaultFont))[4]), strlen (sDefaultFont) + 1) : (char *) memcpy (sActFont, sDefaultFont, strlen (sDefaultFont) + 1)) : strcpy (sActFont, sDefaultFont)));

}


static int TGIF_text_angle(ang)
int ang;
{
    uActAngle = uTextAngle[ang];
    return (1);
}



static int TGIF_justify_text(mode)
enum JUSTIFY mode;
{
    uActJust = mode;
    return (1);
}



static void TGIF_point(ux, uy, number)
unsigned int ux, uy;
int number;
{
    double p;

    double x, y;



    x = (double) (ux + uXshift);
    y = (double) (uYshift - uy);

    p = pointsize * 8.0;
    if (p == (double) 0.0)
        p = 0.1;

    TGIF_flush_poly();

    if (number != -1)
        number = number % 63;
    switch (number) {
    case -1:

        fprintf(gpoutfile, "poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,1,1,%u,0,0,0,0,8,3,0,[\n]).\n",
                sActColor, x, y, x + 1, y + 1, uActNr++);
        break;
    case 0:


        fprintf(gpoutfile, "group([\npoly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]).\npoly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]).\n",



                sActColor, x - p, y - p, x + p, y + p, uActNr+1,
                sActColor, x - p, y + p, x + p, y - p, uActNr+2);
        uActNr += 4;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 1:


        fprintf(gpoutfile, "group([\npoly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]),\npoly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n])\n",



                sActColor, x, y - p - 1, x, y + p + 1, uActNr+1,
                sActColor, x - p - 1, y, x + p + 1, y, uActNr+2);
        uActNr += 4;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 2:


        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]),\n",
                sActColor, x, y - p - 1, x, y + p + 1, uActNr++);
        fprintf(gpoutfile, "poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n])\n",
                sActColor, x - p - 1, y, x + p + 1, y, uActNr++);
        fprintf(gpoutfile, "poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile, "poly('%s',2,[\n\t%.1f,%.1f,%.1f,%.1f],0,2,1,%u,0,0,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y + p, x + p, y - p, uActNr++);
        uActNr += 4;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 3:

        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr);
        uActNr++;
        break;

    case 4:

        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr);
        uActNr++;
        break;

    case 5:

        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr);
        uActNr++;
        break;

    case 6:

        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr);
        uActNr++;
        break;

    case 7:

        fprintf(gpoutfile,
                "polygon('%s',4,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y - p, x + p, y + 0.75 * p, x - p, y + 0.75 * p, x, y - p, uActNr);
        uActNr++;
        break;

    case 8:

        fprintf(gpoutfile,
                "polygon('%s',4,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y - p, x + p, y + 0.75 * p, x - p, y + 0.75 * p, x, y - p, uActNr);
        uActNr++;
        break;

    case 9:

        fprintf(gpoutfile,
                "polygon('%s',4,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x - p, y - 0.75 * p, x + p, y - 0.75 * p, x, y + p, uActNr);
        uActNr++;
        break;

    case 10:

        fprintf(gpoutfile,
                "polygon('%s',4,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x - p, y - 0.75 * p, x + p, y - 0.75 * p, x, y + p, uActNr);
        uActNr++;
        break;

    case 11:

        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        uActNr++;
        break;

    case 12:

        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        uActNr++;
        break;

    case 13:

        fprintf(gpoutfile,
                "polygon('%s',6,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y - p, x + p, y - p / 4, x + 0.625 * p, y + p, x - 0.625 * p, y + p,
                x - p, y - p / 4, x, y - p, uActNr);
        uActNr++;
        break;

    case 14:

        fprintf(gpoutfile,
                "polygon('%s',6,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y - p, x + p, y - p / 4, x + 0.625 * p, y + p, x - 0.625 * p, y + p,
                x - p, y - p / 4, x, y - p, uActNr);
        uActNr++;
        break;

    case 15:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile,
                "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,4480,2560,%u,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, x + p * 0.342, y - p * 0.94, x - p * 0.342, y - p *
                0.94, 2 * p, 2 * p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 16:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile,
                "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,0,5760,%u,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, x + p, y, x, y - p, 2 * p, 2 * p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 17:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile,
                "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,5760,5760,%u,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, x, y - p, x - p, y, 2 * p, 2 * p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 18:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile,
                "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,0,11520,%u,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, x + p, y, x - p, y, 2 * p, 2 * p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 19:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile,
                "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,11520,5760,%u,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, x - p, y, x, y + p, 2 * p, 2 * p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 20:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile,
                "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,0,5760,%u,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, x + p, y, x, y - p, 2 * p, 2 * p, uActNr++);
        fprintf(gpoutfile,
                "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,11520,5760,%u,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, x - p, y, x, y + p, 2 * p, 2 * p, uActNr++);
        uActNr += 3;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 21:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile,
                "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,5760,11520,%u,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, x, y - p, x, y + p, 2 * p, 2 * p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 22:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile,
                "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,0,17280,%u,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, x + p, y, x, y + p, 2 * p, 2 * p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 23:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile,
                "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,17280,5760,%u,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, x, y + p, x + p, y, 2 * p, 2 * p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 24:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile,
                "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,17280,11520,%u,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, x, y + p, x, y - p, 2 * p, 2 * p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 25:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile,
                "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,5760,5760,%u,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, x, y - p, x - p, y, 2 * p, 2 * p, uActNr++);
        fprintf(gpoutfile,
                "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,17280,5760,%u,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, x, y + p, x + p, y, 2 * p, 2 * p, uActNr++);
        uActNr += 3;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 26:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile,
                "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,17280,17280,%u,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, x, y + p, x - p, y, 2 * p, 2 * p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 27:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile,
                "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,11520,11520,%u,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, x - p, y, x + p, y, 2 * p, 2 * p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 28:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile,
                "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,11520,17280,%u,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, x - p, y, x, y - p, 2 * p, 2 * p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 29:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile,
                "arc('%s',1,1,1,0,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,0,%.1f,%.1f,5760,17280,%u,0,0,8,3,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, x, y - p, x + p, y, 2 * p, 2 * p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 30:

        fprintf(gpoutfile, "oval('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr);
        uActNr++;
        break;

    case 31:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p / 4, y - p, x + p / 4, y, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 32:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x, y - p, x + p, y, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 33:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 34:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 35:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y, x, y + p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 36:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x, y - p, x + p, y, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y, x, y + p, uActNr++);
        uActNr += 3;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 37:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x, y + p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 38:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y, x, y + p, uActNr++);
        uActNr += 3;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 39:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x, y, x + p, y + p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 40:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x, y - p, x + p, y + p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 41:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x, y, x + p, y + p, uActNr++);
        uActNr += 3;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 42:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x, y, x + p, y + p, uActNr++);
        uActNr += 3;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 43:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y, x + p, y + p, uActNr++);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 44:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x, y - p, x + p, y, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y, x + p, y + p, uActNr++);
        uActNr += 3;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 45:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,2,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x, y, uActNr++);
        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y, x + p, y + p, uActNr++);
        uActNr += 3;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 46:

        fprintf(gpoutfile, "box('%s',%.1f,%.1f,%.1f,%.1f,1,1,1,%u,0,0,0,[\n]).\n",
                sActColor, x - p, y - p, x + p, y + p, uActNr);
        uActNr++;
        break;

    case 47:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x - 0.625 * p, y - 0.375 * p, x - 0.375 * p, y - 0.625 * p, x + p / 8,
                y - p / 8, x - p / 8, y + p / 8, x - 0.625 * p, y - 0.375 * p, uActNr);
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        uActNr += 2;
        break;

    case 48:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x - p / 2, y - p / 2, x, y - p, x + p / 2, y - p / 2, x, y, x - p / 2,
                y - p / 2, uActNr);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 49:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x - p, y, x - p / 2, y - p / 2, x, y, x - p / 2, y + p / 2, x - p, y, uActNr);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 50:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x - p, y, x, y - p, x + p / 2, y - p / 2, x - p / 2, y + p / 2, x - p,
                y, uActNr);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 51:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x - p / 2, y + p / 2, x, y, x + p / 2, y + p / 2, x, y + p, x - p / 2,
                y + p / 2, uActNr);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 52:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x - p / 2, y - p / 2, x, y - p, x + p / 2, y - p / 2, x, y, x - p / 2,
                y - p / 2, uActNr);
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x - p / 2, y + p / 2, x, y, x + p / 2, y + p / 2, x, y + p, x - p / 2,
                y + p / 2, uActNr);
        uActNr += 3;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 53:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x - p, y, x - p / 2, y - p / 2, x + p / 2, y + p / 2, x, y + p, x - p,
                y, uActNr);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 54:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        fprintf(gpoutfile,
                "polygon('%s',7,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x - p, y, x, y - p, x + p / 2, y - p / 2, x, y, x + p / 2, y + p / 2,
                x, y + p, x - p, y, uActNr);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 55:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y, x + p / 2, y - p / 2, x + p, y, x + p / 2, y + p / 2, x, y, uActNr);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 56:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x - p / 2, y - p / 2, x, y - p, x + p, y, x + p / 2, y + p / 2, x - p /
                2, y - p / 2, uActNr);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 57:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x - p, y, x - p / 2, y - p / 2, x, y, x - p / 2, y + p / 2, x - p, y, uActNr);
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y, x + p / 2, y - p / 2, x + p, y, x + p / 2, y + p / 2, x, y, uActNr);
        uActNr += 3;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 58:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        fprintf(gpoutfile,
                "polygon('%s',7,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x - p, y, x, y - p, x + p, y, x + p / 2, y + p / 2, x, y, x - p / 2, y
                + p / 2, x - p, y, uActNr);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 59:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x - p / 2, y + p / 2, x + p / 2, y - p / 2, x + p, y, x, y + p, x - p /
                2, y + p / 2, uActNr);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 60:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        fprintf(gpoutfile,
                "polygon('%s',7,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x - p / 2, y - p / 2, x, y - p, x + p, y, x, y + p, x - p / 2, y + p /
                2, x, y, x - p / 2, y - p / 2, uActNr);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 61:

        fprintf(gpoutfile, "group([\n");
        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],0,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        fprintf(gpoutfile,
                "polygon('%s',7,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x - p, y, x - p / 2, y - p / 2, x, y, x + p / 2, y - p / 2, x + p, y,
                x, y + p, x - p, y, uActNr);
        uActNr += 2;
        fprintf(gpoutfile, "],\n%u,0,[\n]).\n", uActNr++);
        break;

    case 62:

        fprintf(gpoutfile,
                "polygon('%s',5,[\n%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f,%.1f],1,1,1,0,%u,0,0,0,0,0,[\n]).\n",
                sActColor, x, y + p, x + p, y, x, y - p, x - p, y, x, y + p, uActNr);
        uActNr++;
        break;


    }
}



static void TGIF_set_pointsize(size)
double size;
{
    uActPointSize = size;
}



static int TGIF_set_font(font)
char *font;
{
    char name[32];
    int size, sep;

    sep = __extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p (",") && ((size_t)(const void *)((",") + 1) - (size_t)(const void *)(",") == 1) ? ((__r0 = ((__const char *) (","))[0], __r0 == '\0') ? strlen (font) : ((__r1 = ((__const char *) (","))[1], __r1 == '\0') ? __strcspn_c1 (font, __r0) : ((__r2 = ((__const char *) (","))[2], __r2 == '\0') ? __strcspn_c2 (font, __r0, __r1) : (((__const char *) (","))[3] == '\0' ? __strcspn_c3 (font, __r0, __r1, __r2) : strcspn (font, ","))))) : strcspn (font, ",")); });
    (__extension__ (__builtin_constant_p (font) && __builtin_constant_p (sep) ? (strlen (font) + 1 >= ((size_t) (sep)) ? (char *) memcpy (name, font, sep) : strncpy (name, font, sep)) : strncpy (name, font, sep)));
    name[sep] = ('\0');
    size = uActFontSize;
    sscanf(&(font[sep + 1]), "%d", &size);
    uActFontSize = size;
    return 1;
}
# 339 "term.h" 2


# 1 "term/tkcanvas.trm" 1
# 75 "term/tkcanvas.trm"
# 1 "term/driver.h" 1
# 76 "term/tkcanvas.trm" 2






static void TK_options (void);
static void TK_init (void);
static void TK_graphics (void);
static void TK_text (void);
static void TK_linetype (int linetype);
static void TK_move (unsigned int x, unsigned int y);
static void TK_vector (unsigned int x, unsigned int y);
static void TK_put_text (unsigned int x, unsigned int y, char *str);
static void TK_reset (void);
static int TK_justify_text (enum JUSTIFY);
static int TK_set_font (char *font);
static void TK_linewidth (double linewidth);
# 111 "term/tkcanvas.trm"
extern double min_array[], max_array[], base_array[], log_base_array[];
extern TBOOLEAN log_array[];

extern int xleft, xright, ybot, ytop;
extern TBOOLEAN is_3d_plot;


static int tk_lastx;
static int tk_lasty;
static int tk_color = 0;
static char tk_anchor[7] = "w";
static double tk_linewidth = 1.0;
static int tk_perl = 0;
static int tk_interactive = 0;
static char *tk_colors[] = {
    "black", "gray", "red", "blue", "green", "brown", "magenta", "cyan"
};

static void
TK_options()
{
    tk_perl = 0;
    tk_interactive = 0;

    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "p$erltk")) {
            tk_perl = 1;
            c_token++;
        }
        if (almost_equals(c_token, "i$nteractive")) {
            tk_interactive = 1;
            c_token++;
        }
    }

    sprintf(term_options, "%s %s",
            tk_perl ? "perltk" : "",
            tk_interactive ? "interactive" : "");
}

static void
TK_init()
{
}

static void
TK_graphics()
{
# 167 "term/tkcanvas.trm"
    if (tk_perl) {
        fputs("sub gnuplot {\nmy($can) = @_;\n$can->delete('all');\nmy $cmx = ($can->configure(-width))[4];\nmy $cmy = ($can->configure(-height))[4];\nmy $cmx = $can->width - 2 * $can->cget(-border);\nif ($cmx <= 1) {\n$cmx = ($can->cget(-width));\n}\nmy $cmy = $can->height - 2 * $can->cget(-border);\nif ($cmy <= 1) {\n$cmy = ($can->cget(-height));\n}\n",
# 178 "term/tkcanvas.trm"
              gpoutfile);
    } else {
        fputs("proc gnuplot can {\n$can delete all\nset cmx [expr [winfo width $can]-2*[$can cget -border]]\nif {$cmx <= 1} {set cmx [$can cget -width]}\nset cmy [expr [winfo height $can]-2*[$can cget -border]]\nif {$cmy <= 1} {set cmy [$can cget -height]}\n",






              gpoutfile);
    }
    tk_lastx = tk_lasty = tk_color = 0;
}

static void
TK_reset()
{
}

static void
TK_linetype(linetype)
int linetype;
{
    tk_color = (linetype + 2) & 7;
}

static void
TK_linewidth(linewidth)
double linewidth;
{
    tk_linewidth = linewidth;
}

static void
TK_move(x, y)
unsigned int x, y;
{
    tk_lastx = x;
    tk_lasty = 1000 - y;
}
# 230 "term/tkcanvas.trm"
static void
TK_vector(x, y)
unsigned int x, y;
{







    if (tk_interactive && !is_3d_plot) {
        if (tk_perl)
            fprintf(gpoutfile, "$can->bind(");
        else
            fprintf(gpoutfile, "$can bind [\n");
    }



    y = 1000 - y;



    if (tk_perl) {
        fprintf(gpoutfile,"$can->createLine($cmx * %d / 1000, $cmy * %d / 1000, $cmx * %d / 1000, $cmy * %d / 1000, -fill => q{%s}, -width => %f, -capstyle => q{round})",





                tk_lastx, tk_lasty, x, y, tk_colors[tk_color], tk_linewidth);
    } else {
        fprintf(gpoutfile,"$can create line [expr $cmx * %d /1000] [expr $cmy * %d /1000] [expr $cmx * %d /1000] [expr $cmy * %d /1000] -fill %s -width %f -capstyle round\n",





                tk_lastx, tk_lasty, x, y, tk_colors[tk_color], tk_linewidth);
    }







    if (tk_interactive && !is_3d_plot) {
        if (tk_perl) {

            fprintf(gpoutfile,", '<Button>' => [\\&gnuplot_xy, %f, %f, %f, %f, %f, %f, %f, %f,",


                    (log_array[2]) ?pow(base_array[2],min_array[2]+(double)(tk_lastx-xleft)/(double)(xright-xleft)*(max_array[2]-min_array[2])) :min_array[2]+(double)(tk_lastx-xleft)/(double)(xright-xleft)*(max_array[2]-min_array[2]),
                    (log_array[1]) ?pow(base_array[1],min_array[1]+(double)((1000 -tk_lasty)-ybot)/(double)(ytop-ybot)*(max_array[1]-min_array[1])) :min_array[1]+(double)((1000 -tk_lasty)-ybot)/(double)(ytop-ybot)*(max_array[1]-min_array[1]),
                    (log_array[6]) ?pow(base_array[6],min_array[6]+(double)(tk_lastx-xleft)/(double)(xright-xleft)*(max_array[6]-min_array[6])) :min_array[6]+(double)(tk_lastx-xleft)/(double)(xright-xleft)*(max_array[6]-min_array[6]),
                    (log_array[5]) ?pow(base_array[5],min_array[5]+(double)((1000 -tk_lasty)-ybot)/(double)(ytop-ybot)*(max_array[5]-min_array[5])) :min_array[5]+(double)((1000 -tk_lasty)-ybot)/(double)(ytop-ybot)*(max_array[5]-min_array[5]),
                    (log_array[2]) ?pow(base_array[2],min_array[2]+(double)(x-xleft)/(double)(xright-xleft)*(max_array[2]-min_array[2])) :min_array[2]+(double)(x-xleft)/(double)(xright-xleft)*(max_array[2]-min_array[2]),
                    (log_array[1]) ?pow(base_array[1],min_array[1]+(double)((1000 -y)-ybot)/(double)(ytop-ybot)*(max_array[1]-min_array[1])) :min_array[1]+(double)((1000 -y)-ybot)/(double)(ytop-ybot)*(max_array[1]-min_array[1]),
                    (log_array[6]) ?pow(base_array[6],min_array[6]+(double)(x-xleft)/(double)(xright-xleft)*(max_array[6]-min_array[6])) :min_array[6]+(double)(x-xleft)/(double)(xright-xleft)*(max_array[6]-min_array[6]),
                    (log_array[5]) ?pow(base_array[5],min_array[5]+(double)((1000 -y)-ybot)/(double)(ytop-ybot)*(max_array[5]-min_array[5])) :min_array[5]+(double)((1000 -y)-ybot)/(double)(ytop-ybot)*(max_array[5]-min_array[5]));
            if (log_array[2]) {
                fprintf(gpoutfile, " %f,",
                        (log_array[2]) ?pow(base_array[2],min_array[2]+(double)(0.5 * (x + tk_lastx)-xleft)/(double)(xright-xleft)*(max_array[2]-min_array[2])) :min_array[2]+(double)(0.5 * (x + tk_lastx)-xleft)/(double)(xright-xleft)*(max_array[2]-min_array[2]));
            } else {
                fprintf(gpoutfile, " \"\",");
            }
            if (log_array[1]) {
                fprintf(gpoutfile, " %f,",
                        (log_array[1]) ?pow(base_array[1],min_array[1]+(double)((1000 -0.5 * (y + tk_lasty))-ybot)/(double)(ytop-ybot)*(max_array[1]-min_array[1])) :min_array[1]+(double)((1000 -0.5 * (y + tk_lasty))-ybot)/(double)(ytop-ybot)*(max_array[1]-min_array[1]));
            } else {
                fprintf(gpoutfile, " \"\",");
            }
            if (log_array[6]) {
                fprintf(gpoutfile, " %f,",
                        (log_array[6]) ?pow(base_array[6],min_array[6]+(double)(0.5 * (x + tk_lastx)-xleft)/(double)(xright-xleft)*(max_array[6]-min_array[6])) :min_array[6]+(double)(0.5 * (x + tk_lastx)-xleft)/(double)(xright-xleft)*(max_array[6]-min_array[6]));
            } else {
                fprintf(gpoutfile, " \"\",");
            }
            if (log_array[5]) {
                fprintf(gpoutfile, " %f",
                        (log_array[5]) ?pow(base_array[5],min_array[5]+(double)((1000 -0.5 * (y + tk_lasty))-ybot)/(double)(ytop-ybot)*(max_array[5]-min_array[5])) :min_array[5]+(double)((1000 -0.5 * (y + tk_lasty))-ybot)/(double)(ytop-ybot)*(max_array[5]-min_array[5]));
            } else {
                fprintf(gpoutfile, " \"\"");
            }
            fprintf(gpoutfile, "]);\n");
        } else {
            fprintf(gpoutfile,"] <Button> \"gnuplot_xy %%W %f %f %f %f %f %f %f %f",


                    (log_array[2]) ?pow(base_array[2],min_array[2]+(double)(tk_lastx-xleft)/(double)(xright-xleft)*(max_array[2]-min_array[2])) :min_array[2]+(double)(tk_lastx-xleft)/(double)(xright-xleft)*(max_array[2]-min_array[2]),
                    (log_array[1]) ?pow(base_array[1],min_array[1]+(double)((1000 -tk_lasty)-ybot)/(double)(ytop-ybot)*(max_array[1]-min_array[1])) :min_array[1]+(double)((1000 -tk_lasty)-ybot)/(double)(ytop-ybot)*(max_array[1]-min_array[1]),
                    (log_array[6]) ?pow(base_array[6],min_array[6]+(double)(tk_lastx-xleft)/(double)(xright-xleft)*(max_array[6]-min_array[6])) :min_array[6]+(double)(tk_lastx-xleft)/(double)(xright-xleft)*(max_array[6]-min_array[6]),
                    (log_array[5]) ?pow(base_array[5],min_array[5]+(double)((1000 -tk_lasty)-ybot)/(double)(ytop-ybot)*(max_array[5]-min_array[5])) :min_array[5]+(double)((1000 -tk_lasty)-ybot)/(double)(ytop-ybot)*(max_array[5]-min_array[5]),
                    (log_array[2]) ?pow(base_array[2],min_array[2]+(double)(x-xleft)/(double)(xright-xleft)*(max_array[2]-min_array[2])) :min_array[2]+(double)(x-xleft)/(double)(xright-xleft)*(max_array[2]-min_array[2]),
                    (log_array[1]) ?pow(base_array[1],min_array[1]+(double)((1000 -y)-ybot)/(double)(ytop-ybot)*(max_array[1]-min_array[1])) :min_array[1]+(double)((1000 -y)-ybot)/(double)(ytop-ybot)*(max_array[1]-min_array[1]),
                    (log_array[6]) ?pow(base_array[6],min_array[6]+(double)(x-xleft)/(double)(xright-xleft)*(max_array[6]-min_array[6])) :min_array[6]+(double)(x-xleft)/(double)(xright-xleft)*(max_array[6]-min_array[6]),
                    (log_array[5]) ?pow(base_array[5],min_array[5]+(double)((1000 -y)-ybot)/(double)(ytop-ybot)*(max_array[5]-min_array[5])) :min_array[5]+(double)((1000 -y)-ybot)/(double)(ytop-ybot)*(max_array[5]-min_array[5]));
            if (log_array[2]) {
                fprintf(gpoutfile, " %f",
                        (log_array[2]) ?pow(base_array[2],min_array[2]+(double)(0.5 * (x + tk_lastx)-xleft)/(double)(xright-xleft)*(max_array[2]-min_array[2])) :min_array[2]+(double)(0.5 * (x + tk_lastx)-xleft)/(double)(xright-xleft)*(max_array[2]-min_array[2]));
            } else {
                fprintf(gpoutfile, " {}");
            }
            if (log_array[1]) {
                fprintf(gpoutfile, " %f",
                        (log_array[1]) ?pow(base_array[1],min_array[1]+(double)((1000 -0.5 * (y + tk_lasty))-ybot)/(double)(ytop-ybot)*(max_array[1]-min_array[1])) :min_array[1]+(double)((1000 -0.5 * (y + tk_lasty))-ybot)/(double)(ytop-ybot)*(max_array[1]-min_array[1]));
            } else {
                fprintf(gpoutfile, " {}");
            }
            if (log_array[6]) {
                fprintf(gpoutfile, " %f",
                        (log_array[6]) ?pow(base_array[6],min_array[6]+(double)(0.5 * (x + tk_lastx)-xleft)/(double)(xright-xleft)*(max_array[6]-min_array[6])) :min_array[6]+(double)(0.5 * (x + tk_lastx)-xleft)/(double)(xright-xleft)*(max_array[6]-min_array[6]));
            } else {
                fprintf(gpoutfile, " {}");
            }
            if (log_array[5]) {
                fprintf(gpoutfile, " %f",
                        (log_array[5]) ?pow(base_array[5],min_array[5]+(double)((1000 -0.5 * (y + tk_lasty))-ybot)/(double)(ytop-ybot)*(max_array[5]-min_array[5])) :min_array[5]+(double)((1000 -0.5 * (y + tk_lasty))-ybot)/(double)(ytop-ybot)*(max_array[5]-min_array[5]));
            } else {
                fprintf(gpoutfile, " {}");
            }
            fprintf(gpoutfile, "\"\n");
        }
    } else {
        if (tk_perl) {
            fprintf(gpoutfile, ";\n");
        }
    }



    tk_lastx = x;
    tk_lasty = y;
}





static void
TK_put_text(x, y, str)
unsigned int x, y;
char *str;
{
    y = 1000 - y;
    if (tk_perl) {
        fprintf(gpoutfile,"$can->createText($cmx * %d / 1000, $cmy * %d / 1000, -text => q{%s}, -fill => q{%s}, -anchor => '%s', (defined $font ? (-font => $font) : ()));\n",





                x, y, str, tk_colors[tk_color], tk_anchor);
    } else {
        fprintf(gpoutfile,"eval $can create text [expr $cmx * %d /1000] [expr $cmy * %d /1000] -text \\{%s\\} -fill %s -anchor %s [expr [info exists font]?\"-font \\$font\":{}]\n",





                x, y, str, tk_colors[tk_color], tk_anchor);
    }
}

static int
TK_justify_text(anchor)
enum JUSTIFY anchor;
{
    int return_value;

    switch (anchor) {
    case RIGHT:
        (__extension__ (__builtin_constant_p ("e") ? (((size_t)(const void *)(("e") + 1) - (size_t)(const void *)("e") == 1) && strlen ("e") + 1 <= 8 ? __strcpy_small (tk_anchor, __extension__ (((__const unsigned char *) (__const char *) ("e"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("e"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("e"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("e"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("e"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("e"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("e"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("e"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("e"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("e"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("e"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("e"))[4])!
, strlen ("e") + 1) : (char *) memcpy (tk_anchor, "e", strlen ("e") + 1)) : strcpy (tk_anchor, "e")));
        return_value = 1;
        break;
    case CENTRE:
        (__extension__ (__builtin_constant_p ("center") ? (((size_t)(const void *)(("center") + 1) - (size_t)(const void *)("center") == 1) && strlen ("center") + 1 <= 8 ? __strcpy_small (tk_anchor, __extension__ (((__const unsigned char *) (__const char *) ("center"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("center"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("center"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("center"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("center"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("center"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("center"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("center"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("center"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("center"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("cent!
er"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("center"))[4]), strlen ("center") + 1) : (char *) memcpy (tk_anchor, "center", strlen ("center") + 1)) : strcpy (tk_anchor, "center")));
        return_value = 1;
        break;
    case LEFT:
        (__extension__ (__builtin_constant_p ("w") ? (((size_t)(const void *)(("w") + 1) - (size_t)(const void *)("w") == 1) && strlen ("w") + 1 <= 8 ? __strcpy_small (tk_anchor, __extension__ (((__const unsigned char *) (__const char *) ("w"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("w"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("w"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("w"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("w"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("w"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("w"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("w"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("w"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("w"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("w"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("w"))[4])!
, strlen ("w") + 1) : (char *) memcpy (tk_anchor, "w", strlen ("w") + 1)) : strcpy (tk_anchor, "w")));
        return_value = 1;
        break;
    default:
        (__extension__ (__builtin_constant_p ("w") ? (((size_t)(const void *)(("w") + 1) - (size_t)(const void *)("w") == 1) && strlen ("w") + 1 <= 8 ? __strcpy_small (tk_anchor, __extension__ (((__const unsigned char *) (__const char *) ("w"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("w"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("w"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("w"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("w"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("w"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("w"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("w"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("w"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("w"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("w"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("w"))[4])!
, strlen ("w") + 1) : (char *) memcpy (tk_anchor, "w", strlen ("w") + 1)) : strcpy (tk_anchor, "w")));
        return_value = 0;
    }
    return return_value;
}

static int
TK_set_font(font)
char *font;
{
    if (!font || *font == ('\0')) {
        if (tk_perl)
            fputs("undef $font;\n", gpoutfile);
        else
            fputs("catch {unset $font}\n", gpoutfile);
    } else {
        char *name;
        int size = 0;
        size_t sep = __extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p (",") && ((size_t)(const void *)((",") + 1) - (size_t)(const void *)(",") == 1) ? ((__r0 = ((__const char *) (","))[0], __r0 == '\0') ? strlen (font) : ((__r1 = ((__const char *) (","))[1], __r1 == '\0') ? __strcspn_c1 (font, __r0) : ((__r2 = ((__const char *) (","))[2], __r2 == '\0') ? __strcspn_c2 (font, __r0, __r1) : (((__const char *) (","))[3] == '\0' ? __strcspn_c3 (font, __r0, __r1, __r2) : strcspn (font, ","))))) : strcspn (font, ",")); });

        name = malloc(sep + 1);
        if (!name)
            return 0;
        (__extension__ (__builtin_constant_p (font) && __builtin_constant_p (sep) ? (strlen (font) + 1 >= ((size_t) (sep)) ? (char *) memcpy (name, font, sep) : strncpy (name, font, sep)) : strncpy (name, font, sep)));
        name[sep] = ('\0');
        if (sep < strlen(font))
            sscanf(&(font[sep + 1]), "%d", &size);
        if (tk_perl) {
            fprintf(gpoutfile,"if ($can->can('fontCreate')) {\n$font = $can->fontCreate(-family => q{%s}",


                    name);
            if (size)
                fprintf(gpoutfile, ", -size => %d", size);
            fputs(");\n}\n", gpoutfile);
        } else {
            fprintf(gpoutfile, "set font [font create -family %s", name);
            if (size)
                fprintf(gpoutfile, " -size %d", size);
            fputs("]\n", gpoutfile);
        }
        free(name);
    }
    return 1;
}

static void
TK_text()
{
# 479 "term/tkcanvas.trm"
    if (tk_perl) {
        fputs("};\n", gpoutfile);
        if (!is_3d_plot) {
            fputs("sub gnuplot_plotarea {\n", gpoutfile);
            fprintf(gpoutfile,
                    "return (%d, %d, %d, %d);\n",
                    xleft, xright, 1000 - ytop, 1000 - ybot);
            fputs("};\n", gpoutfile);
            fputs("sub gnuplot_axisranges {\n", gpoutfile);
            fprintf(gpoutfile,
                    "return (%f, %f, %f, %f, %f, %f, %f, %f);\n",
                    min_array[2], max_array[2],
                    min_array[1], max_array[1],
                    min_array[6], max_array[6],
                    min_array[5], max_array[5]);
            fputs("};\n", gpoutfile);
            if (tk_interactive) {
                fputs("sub gnuplot_xy {\n",
                      gpoutfile);
                fputs("my ($win, $x1s, $y1s, $x2s, $y2s, $x1e, $y1e, $x2e, $y2e, $x1m, $y1m, $x2m, $y2m) = @_;\n",
                      gpoutfile);
                fputs("if (defined &user_gnuplot_coordinates) {\n",
                      gpoutfile);
                fputs("my $id = $win->find('withtag', 'current');\n",
                      gpoutfile);
                fputs("user_gnuplot_coordinates $win, $id, $x1s, $y1s, $x2s, $y2s, $x1e, $y1e, $x2e, $y2e, $x1m, $y1m, $x2m, $y2m\n",
                      gpoutfile);
                fputs("} else {\n",
                      gpoutfile);
                fputs("if (length($x1m)>0) {print \" $x1m\";} else {print \" \", 0.5*($x1s+$x1e);}\n",
                      gpoutfile);
                fputs("if (length($y1m)>0) {print \" $y1m\";} else {print \" \", 0.5*($y1s+$y1e);}\n",
                      gpoutfile);
                fputs("if (length($x2m)>0) {print \" $x2m\";} else {print \" \", 0.5*($x2s+$x2e);}\n",
                      gpoutfile);
                fputs("if (length($y2m)>0) {print \" $y2m\";} else {print \" \", 0.5*($y2s+$y2e);}\n",
                      gpoutfile);
                fputs("print \"\\n\"\n",
                      gpoutfile);
                fputs("}\n",
                      gpoutfile);
                fputs("};\n", gpoutfile);
            }
        }
    } else {
        fputs("}\n", gpoutfile);
        if (!is_3d_plot) {
            fputs("proc gnuplot_plotarea {} {\n", gpoutfile);
            fprintf(gpoutfile,
                    "return {%d %d %d %d}\n",
                    xleft, xright, 1000 - ytop, 1000 - ybot);
            fputs("}\n", gpoutfile);
            fputs("proc gnuplot_axisranges {} {\n", gpoutfile);
            fprintf(gpoutfile,
                    "return {%f %f %f %f %f %f %f %f}\n",
                    min_array[2], max_array[2],
                    min_array[1], max_array[1],
                    min_array[6], max_array[6],
                    min_array[5], max_array[5]);
            fputs("}\n", gpoutfile);
            if (tk_interactive) {
                fputs("proc gnuplot_xy {win x1s y1s x2s y2s x1e y1e x2e y2e x1m y1m x2m y2m} {\n",
                      gpoutfile);
                fputs("if {([llength [info commands user_gnuplot_coordinates]])} {\n",
                      gpoutfile);
                fputs("set id [$win find withtag current]\n",
                      gpoutfile);
                fputs("user_gnuplot_coordinates $win $id $x1s $y1s $x2s $y2s $x1e $y1e $x2e $y2e $x1m $y1m $x2m $y2m\n",
                      gpoutfile);
                fputs("} else {\n", gpoutfile);
                fputs("if {[string length $x1m]>0} {puts -nonewline \" $x1m\"} else {puts -nonewline \" [expr 0.5*($x1s+$x1e)]\"}\n",
                      gpoutfile);
                fputs("if {[string length $y1m]>0} {puts -nonewline \" $y1m\"} else {puts -nonewline \" [expr 0.5*($y1s+$y1e)]\"}\n",
                      gpoutfile);
                fputs("if {[string length $x2m]>0} {puts -nonewline \" $x2m\"} else {puts -nonewline \" [expr 0.5*($x2s+$x2e)]\"}\n",
                      gpoutfile);
                fputs("if {[string length $y2m]>0} {puts \" $y2m\"} else {puts \" [expr 0.5*($y2s+$y2e)]\"}\n",
                      gpoutfile);
                fputs("}\n", gpoutfile);
                fputs("}\n", gpoutfile);
            }
        }
    }
    fflush(gpoutfile);
}
# 342 "term.h" 2
# 364 "term.h"
# 1 "term/epson.trm" 1
# 58 "term/epson.trm"
# 1 "term/driver.h" 1
# 59 "term/epson.trm" 2
# 87 "term/epson.trm"
static void EPSONinit (void);
static void EPSONreset (void);
# 104 "term/epson.trm"
static void EPSONgraphics (void);
static void EPSONtext (void);





static void EPS180graphics (void);
static void EPS180text (void);
# 126 "term/epson.trm"
static void EPS60graphics (void);

static void TANDY60text (void);


static void OKIDATAtext (void);


static void EPS60text (void);




static void NECoptions (void);
static void NECinit (void);
static void NECgraphics (void);
static void NECtext (void);
static void NEClinetype (int linetype);
static void NECreset (void);
# 158 "term/epson.trm"
static void STARCinit (void);
static void STARCgraphics (void);
static void STARCtext (void);
static void STARClinetype (int linetype);
static void STARCreset (void);
# 189 "term/epson.trm"
void epson_dump (void);




static void EPSONinit()
{
}

static void EPSONgraphics()
{
    b_charsize(0);
    b_makebitmap((unsigned int) (512 * xsize),
                 (unsigned int) (384 * ysize), 1);
}


static void EPSONtext()
{
    epson_dump();
    b_freebitmap();
}


static void EPSONreset()
{



}



void epson_dump()
{
    register unsigned int x;
    int j;
    for (j = (b_ysize / 8) - 1; j >= 0; j--) {

        fputs("\033J\030", gpoutfile);
        fputs("\r\033*\005", gpoutfile);
        (void) fputc((char) (b_xsize % 256), gpoutfile);
        (void) fputc((char) (b_xsize / 256), gpoutfile);
        for (x = 0; x < b_xsize; x++) {
            (void) fputc((char) (*((*b_p)[j] + x)), gpoutfile);
        }
    }



}
# 254 "term/epson.trm"
void nec_dump (void);
void nec_draft_dump (void);






static unsigned int neccolor[] = { 1, 8, 4, 2, 10, 12, 6, 14 };
static unsigned int necpcolor[] = { 0, 2, 1, 4 };

static int NECmode;

static void NECoptions()
{
    if ((c_token >= num_tokens || equals(c_token,";"))) {
        (__extension__ (__builtin_constant_p ("monochrome") ? (((size_t)(const void *)(("monochrome") + 1) - (size_t)(const void *)("monochrome") == 1) && strlen ("monochrome") + 1 <= 8 ? __strcpy_small (term_options, __extension__ (((__const unsigned char *) (__const char *) ("monochrome"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("monochrome"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("monochrome"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("monochrome"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[4 + 2]!
) << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[4]), strlen ("monochrome") + 1) : (char *) memcpy (term_options, "monochrome", strlen ("monochrome") + 1)) : strcpy (term_options, "monochrome")));
        NECmode = 'm';
    } else if (almost_equals(c_token, "m$onochrome")) {
        c_token++;
        (__extension__ (__builtin_constant_p ("monochrome") ? (((size_t)(const void *)(("monochrome") + 1) - (size_t)(const void *)("monochrome") == 1) && strlen ("monochrome") + 1 <= 8 ? __strcpy_small (term_options, __extension__ (((__const unsigned char *) (__const char *) ("monochrome"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("monochrome"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("monochrome"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("monochrome"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[4 + 2]!
) << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[4]), strlen ("monochrome") + 1) : (char *) memcpy (term_options, "monochrome", strlen ("monochrome") + 1)) : strcpy (term_options, "monochrome")));
        NECmode = 'm';
    } else if (almost_equals(c_token, "c$olor")
               || almost_equals(c_token, "c$olour")) {
        c_token++;
        (__extension__ (__builtin_constant_p ("color") ? (((size_t)(const void *)(("color") + 1) - (size_t)(const void *)("color") == 1) && strlen ("color") + 1 <= 8 ? __strcpy_small (term_options, __extension__ (((__const unsigned char *) (__const char *) ("color"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("color"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("color"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("color"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("color"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("color"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("color"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("color"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("color"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("color"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("color"))[4 + 1]!
) << 8 | ((__const unsigned char *) (__const char *) ("color"))[4]), strlen ("color") + 1) : (char *) memcpy (term_options, "color", strlen ("color") + 1)) : strcpy (term_options, "color")));
        NECmode = 'c';
    } else if (almost_equals(c_token, "d$raft")) {
        c_token++;
        (__extension__ (__builtin_constant_p ("draft") ? (((size_t)(const void *)(("draft") + 1) - (size_t)(const void *)("draft") == 1) && strlen ("draft") + 1 <= 8 ? __strcpy_small (term_options, __extension__ (((__const unsigned char *) (__const char *) ("draft"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("draft"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("draft"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("draft"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("draft"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("draft"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("draft"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("draft"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("draft"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("draft"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("draft"))[4 + 1]!
) << 8 | ((__const unsigned char *) (__const char *) ("draft"))[4]), strlen ("draft") + 1) : (char *) memcpy (term_options, "draft", strlen ("draft") + 1)) : strcpy (term_options, "draft")));
        NECmode = 'd';
    } else {

        (__extension__ (__builtin_constant_p ("monochrome") ? (((size_t)(const void *)(("monochrome") + 1) - (size_t)(const void *)("monochrome") == 1) && strlen ("monochrome") + 1 <= 8 ? __strcpy_small (term_options, __extension__ (((__const unsigned char *) (__const char *) ("monochrome"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("monochrome"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("monochrome"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("monochrome"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[4 + 2]!
) << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("monochrome"))[4]), strlen ("monochrome") + 1) : (char *) memcpy (term_options, "monochrome", strlen ("monochrome") + 1)) : strcpy (term_options, "monochrome")));
        NECmode = 'm';
        int_error("modes: color, monochrome, draft", c_token);
    }
}

static void NECinit()
{
}

static void NECgraphics()
{
    b_charsize(0);
    b_makebitmap((unsigned int) (400 * xsize),
                 (unsigned int) (320 * ysize), (NECmode == 'c' ? 4 : 1));
}

static void NECtext()
{
    if (NECmode == 'd') {
        nec_draft_dump();
    } else {
        nec_dump();
    }
    b_freebitmap();
}

static void NEClinetype(linetype)
int linetype;
{
    if (NECmode == 'c') {
        if (linetype >= 6)
            linetype %= 6;
        b_setvalue(neccolor[linetype + 2]);
    } else {
        b_setlinetype(linetype);
    }
}



static void NECreset()
{



}



void nec_dump()
{
    unsigned int x;
    unsigned int plane, offset;
    int j;
    unsigned int column8;
    unsigned long column24;
    char column3, column2, column1;
    fputs("\033P\033l\005", gpoutfile);
    for (j = (b_ysize / 8) - 1; j >= 0; j--) {
        fputs("\033J\030", gpoutfile);
        for (plane = 0; plane < b_planes; plane++) {
            offset = plane * b_psize;
            if (b_planes > 1) {

                fputs("\033r", gpoutfile);
                (void) fputc((char) necpcolor[plane], gpoutfile);
            }

            fputs("\r\033*\047", gpoutfile);
            (void) fputc((char) ((b_xsize * 3) % 256), gpoutfile);
            (void) fputc((char) ((b_xsize * 3) / 256), gpoutfile);
            for (x = 0; x < b_xsize; x++) {
                column8 = (unsigned int) (*((*b_p)[j + offset] + x));
                column24 = 0;
                if (column8 & 0x01)
                    column24 |= (long) 0x000007;
                if (column8 & 0x02)
                    column24 |= (long) 0x000038;
                if (column8 & 0x04)
                    column24 |= (long) 0x0001c0;
                if (column8 & 0x08)
                    column24 |= (long) 0x000e00;
                if (column8 & 0x10)
                    column24 |= (long) 0x007000;
                if (column8 & 0x20)
                    column24 |= (long) 0x038000;
                if (column8 & 0x40)
                    column24 |= (long) 0x1c0000;
                if (column8 & 0x80)
                    column24 |= (long) 0xe00000;
                column1 = (char) (column24 & (long) 0xff);
                column2 = (char) ((column24 >> 8) & (long) 0xff);
                column3 = (char) ((column24 >> 16) & (long) 0xff);
                (void) fputc(column3, gpoutfile);
                (void) fputc(column2, gpoutfile);
                (void) fputc(column1, gpoutfile);
                (void) fputc(column3, gpoutfile);
                (void) fputc(column2, gpoutfile);
                (void) fputc(column1, gpoutfile);
                (void) fputc(column3, gpoutfile);
                (void) fputc(column2, gpoutfile);
                (void) fputc(column1, gpoutfile);
            }
        }
    }
    fputs("\r\033l", gpoutfile);
    (void) fputc('\0', gpoutfile);
    if (b_planes > 1) {
        fprintf(gpoutfile, "\033r");
        (void) fputc('\0', gpoutfile);
    }






}


void nec_draft_dump()
{
    unsigned int x;
    unsigned int plane, offset;
    int j;
    fputs("\033P\033l\005\r", gpoutfile);
    for (j = (b_ysize / 8) - 1; j >= 0; j--) {
        fputs("\033J\030", gpoutfile);
        for (plane = 0; plane < b_planes; plane++) {
            offset = plane * b_psize;
            if (b_planes > 1) {

                fputs("\033r", gpoutfile);
                (void) fputc((char) necpcolor[plane], gpoutfile);
            }

            fputs("\r\033*", gpoutfile);
            (void) fputc('\0', gpoutfile);
            (void) fputc((char) (b_xsize % 256), gpoutfile);
            (void) fputc((char) (b_xsize / 256), gpoutfile);
            for (x = 0; x < b_xsize; x++) {
                (void) fputc((char) (*((*b_p)[j + offset] + x)), gpoutfile);
            }
        }
    }
    fputs("\r\033l", gpoutfile);
    (void) fputc('\0', gpoutfile);
    if (b_planes > 1) {
        fputs("\033r", gpoutfile);
        (void) fputc('\0', gpoutfile);
    }



}
# 453 "term/epson.trm"
void STARC_dump (void);






static unsigned int STARCcolor[] = { 1, 8, 4, 2, 10, 12, 6, 14 };
static unsigned int STARCpcolor[] = { 0, 2, 1, 4 };

static void STARCinit()
{
}

static void STARCgraphics()
{
    b_charsize(0);
    b_makebitmap((unsigned int) (512 * xsize),
                 (unsigned int) (384 * ysize), 4);
}


static void STARCtext()
{
    STARC_dump();
    b_freebitmap();
}

static void STARClinetype(linetype)
int linetype;
{
    if (linetype >= 6)
        linetype %= 6;
    b_setvalue(STARCcolor[linetype + 2]);
}



static void STARCreset()
{



}



void STARC_dump()
{
    unsigned int x;
    unsigned int plane, offset;
    int j;
    for (j = (b_ysize / 8) - 1; j >= 0; j--) {
        fputs("\033J\030", gpoutfile);
        for (plane = 0; plane < b_planes; plane++) {
            offset = plane * b_psize;
            if (b_planes > 1) {

                fputs("\033r", gpoutfile);
                (void) fputc((char) STARCpcolor[plane], gpoutfile);
            }

            fputs("\r\033*\005", gpoutfile);
            (void) fputc((char) (b_xsize % 256), gpoutfile);
            (void) fputc((char) (b_xsize / 256), gpoutfile);
            for (x = 0; x < b_xsize; x++) {
                (void) fputc((char) (*((*b_p)[j + offset] + x)), gpoutfile);
            }
        }
    }
    if (b_planes > 1) {
        fputs("\033r", gpoutfile);
        (void) fputc('\0', gpoutfile);
    }



}






void eps180_dump (void);




static void EPS180graphics()
{
    b_charsize(2);
    b_makebitmap((unsigned int) (1260 * xsize),
                 (unsigned int) (1080 * ysize), 1);
}


static void EPS180text()
{
    eps180_dump();
    b_freebitmap();
}




void eps180_dump()
{
    register unsigned int x;
    int j;


    fputs("\033@\033+\060\033l\005", gpoutfile);
    for (j = (b_ysize / 8) - 1; j >= 0;) {

        fputs("\r\n\033*'", gpoutfile);
        (void) fputc((char) (b_xsize % 256), gpoutfile);
        (void) fputc((char) (b_xsize / 256), gpoutfile);
        for (x = 0; x < b_xsize; x++) {
            (void) fputc((char) (*((*b_p)[j] + x)), gpoutfile);
            (void) fputc((char) (*((*b_p)[j - 1] + x)), gpoutfile);
            (void) fputc((char) (*((*b_p)[j - 2] + x)), gpoutfile);
        }
        j -= 3;
    }
    fputs("\r\n\033@\r\n", gpoutfile);



}





void eps60_dump (void);




static void EPS60graphics()
{
    b_charsize(0);
    b_makebitmap((unsigned int) (480 * xsize),
                 (unsigned int) (360 * ysize), 1);
}


static void EPS60text()
{
    eps60_dump();
    b_freebitmap();
}




void eps60_dump()
{
    register unsigned int x;
    int j;
    fprintf(gpoutfile, "\033%c\030", '3');
    for (j = (b_ysize / 8) - 1; j >= 0; j--) {

        fputs("\r\n\033K", gpoutfile);
        (void) fputc((char) (b_xsize % 256), gpoutfile);
        (void) fputc((char) (b_xsize / 256), gpoutfile);
        for (x = 0; x < b_xsize; x++) {
            (void) fputc((char) (*((*b_p)[j] + x)), gpoutfile);
        }
    }
    fprintf(gpoutfile, "\033%c\044\r\n", '3');



}
# 639 "term/epson.trm"
static void TANDY60text()
{






    fprintf(gpoutfile, "\033!\033%c%c\n\n\n", '3', 216);
    eps60_dump();
    b_freebitmap();


    fputs("\f\033!", gpoutfile);
}






void okidata_dump (void);

static void OKIDATAtext()
{
    okidata_dump();
    b_freebitmap();
}

int bitrev_tbl[] =
{
    0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
    0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
    0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
    0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
    0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
    0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
    0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
    0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
    0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
    0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
    0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
    0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
    0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
    0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
    0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
    0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
    0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
    0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
    0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
    0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
    0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
    0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
    0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
    0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
    0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
    0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
    0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
    0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
    0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
    0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
    0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
    0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
};


void okidata_dump()
{
    register unsigned int x;
    int j;
    char cur_char;
    int prev_char;

    prev_char = 0;
    fprintf(gpoutfile, "\033%c%c\020\033*eP:\003", '%', '9');
    for (j = (b_ysize / 8) - 1; j >= 0; j--) {
        fputs("\003\016", gpoutfile);


        for (x = 0; x < b_xsize; x++) {
            if ((cur_char = (char)
                 (bitrev_tbl[(int) (*((*b_p)[j] + x))])) == '\003') {
                fputs("\003\003", gpoutfile);
            } else {
                (void) fputc((char) cur_char, gpoutfile);
            }
        }
    }
    fprintf(gpoutfile, "\003\002\033%c%c\030\r\n", '%', '9');



}
# 365 "term.h" 2







# 1 "term/latex.trm" 1
# 77 "term/latex.trm"
# 1 "term/driver.h" 1
# 78 "term/latex.trm" 2
# 87 "term/latex.trm"
static void LATEX_options (void);
static void LATEX_init (void);
static void LATEX_graphics (void);
static void LATEX_text (void);
static void LATEX_put_text (unsigned int x, unsigned int y, char str[]);
static void LATEX_linetype (int linetype);
static void LATEX_move (unsigned int x, unsigned int y);
static void LATEX_point (unsigned int x, unsigned int y, int number);
static void LATEX_vector (unsigned int ux, unsigned int uy);
static void LATEX_arrow (unsigned int sx, unsigned int sy, unsigned int ex, unsigned int ey, TBOOLEAN head);
static int LATEX_justify_text (enum JUSTIFY mode);
static int LATEX_text_angle (int ang);
static void LATEX_reset (void);


static void EMTEX_init (void);
static void EMTEX_reset (void);
static void EMTEX_text (void);



static void EEPIC_move (unsigned int x, unsigned int y);
static void EEPIC_vector (unsigned int ux, unsigned int uy);
# 132 "term/latex.trm"
static int LATEX_posx;
static int LATEX_posy;
static int LATEX_fontsize = 10;
static char LATEX_font[50 +1] = "cmr";
static enum JUSTIFY latex_justify = LEFT;
static int latex_angle = 0;
# 146 "term/latex.trm"
static char * LATEX_points[] =
{
    "\\raisebox{-.8pt}{\\makebox(0,0){$\\Diamond$}}",
    "\\makebox(0,0){$+$}",
    "\\raisebox{-.8pt}{\\makebox(0,0){$\\Box$}}",
    "\\makebox(0,0){$\\times$}",
    "\\makebox(0,0){$\\triangle$}",
    "\\makebox(0,0){$\\star$}",
    "\\circle{12}", "\\circle{18}", "\\circle{24}",
    "\\circle*{12}", "\\circle*{18}", "\\circle*{24}"
};


static float LATEX_size = 0;
static float LATEX_dotspace = 0;


static struct {
    float size;
    float dotspace;
} LATEX_lines[] =

{
    {0.4, 0.0},
    {0.4, 5.0},
    {0.8, 0.0},
    {1.0, 5.0},
    {1.2, 0.0},
    {1.0, 10.0},
};


static void LATEX_dot_line (int x1, int x2, int y1, int y2);
static void LATEX_solid_line (int x1, int x2, int y1, int y2);
static void LATEX_rule (int code, double x, double y, double width, double height);
static void LATEX_flushdot (void);

static TBOOLEAN LATEX_moved = 1;
static float LATEX_dotsize;
static TBOOLEAN LATEX_needsdot = 0;


TBOOLEAN emtex = 0;
static void
EMTEX_solid_line (int x1, int x2, int y1, int y2);





static struct vslope {
    int dx, dy;
} LATEX_slopes[] =

{
    {1, 1},
    {1, 2},
    {1, 3},
    {1, 4},
    {2, 1},
    {2, 3},
    {3, 1},
    {3, 2},
    {3, 4},
    {4, 1},
    {4, 3},
    {0, 0}
};


void best_latex_arrow (int, int, int, int, int, TBOOLEAN);

static void LATEX_options()
{
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "c$ourier")) {
            (__extension__ (__builtin_constant_p ("cmtt") ? (((size_t)(const void *)(("cmtt") + 1) - (size_t)(const void *)("cmtt") == 1) && strlen ("cmtt") + 1 <= 8 ? __strcpy_small (LATEX_font, __extension__ (((__const unsigned char *) (__const char *) ("cmtt"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("cmtt"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("cmtt"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("cmtt"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("cmtt"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("cmtt"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("cmtt"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("cmtt"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("cmtt"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("cmtt"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("cmtt"))[4 + 1]) << 8 | ((__!
const unsigned char *) (__const char *) ("cmtt"))[4]), strlen ("cmtt") + 1) : (char *) memcpy (LATEX_font, "cmtt", strlen ("cmtt") + 1)) : strcpy (LATEX_font, "cmtt")));
            c_token++;
        } else if (almost_equals(c_token, "r$oman")) {
            (__extension__ (__builtin_constant_p ("cmr") ? (((size_t)(const void *)(("cmr") + 1) - (size_t)(const void *)("cmr") == 1) && strlen ("cmr") + 1 <= 8 ? __strcpy_small (LATEX_font, __extension__ (((__const unsigned char *) (__const char *) ("cmr"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("cmr"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("cmr"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("cmr"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("cmr"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("cmr"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("cmr"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("cmr"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("cmr"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("cmr"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("cmr"))[4 + 1]) << 8 | ((__const unsigned !
char *) (__const char *) ("cmr"))[4]), strlen ("cmr") + 1) : (char *) memcpy (LATEX_font, "cmr", strlen ("cmr") + 1)) : strcpy (LATEX_font, "cmr")));
            c_token++;
        } else if (almost_equals(c_token, "d$efault")) {
            (__extension__ (__builtin_constant_p ("doc") ? (((size_t)(const void *)(("doc") + 1) - (size_t)(const void *)("doc") == 1) && strlen ("doc") + 1 <= 8 ? __strcpy_small (LATEX_font, __extension__ (((__const unsigned char *) (__const char *) ("doc"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("doc"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("doc"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("doc"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("doc"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("doc"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("doc"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("doc"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("doc"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("doc"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("doc"))[4 + 1]) << 8 | ((__const unsigned !
char *) (__const char *) ("doc"))[4]), strlen ("doc") + 1) : (char *) memcpy (LATEX_font, "doc", strlen ("doc") + 1)) : strcpy (LATEX_font, "doc")));
            c_token++;
        }
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        struct value a;
        LATEX_fontsize = (int) real(const_express(&a));
    }



    term->v_char = (unsigned int) (LATEX_fontsize * (300) / 72);
    term->h_char = (unsigned int) (LATEX_fontsize * (300) / 144);

    if (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (LATEX_font) && __builtin_constant_p ("doc") && (__s1_len = strlen (LATEX_font), __s2_len = strlen ("doc"), (!((size_t)(const void *)((LATEX_font) + 1) - (size_t)(const void *)(LATEX_font) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("doc") + 1) - (size_t)(const void *)("doc") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (LATEX_font), (__const char *) ("doc"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (LATEX_font) && ((size_t)(const void *)((LATEX_font) + 1) - (size_t)(const void *)(LATEX_font) == 1) && (__s1_len = strlen (LATEX_font), __s1_len < 4) ? (__builtin_constant_p ("doc") && ((size_t)(const void *)(("doc") + 1) - (size_t)(const void *)("doc") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (LATEX_font))[0] - ((__const unsigned char *) (__const char *)("doc"))[0]); if (__s1_len > 0 && __result == 0) { !
__result = (((__const unsigned char *) (__const char *) (LATEX_font))[1] - ((__const unsigned char *) (__const char *) ("doc"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (LATEX_font))[2] - ((__const unsigned char *) (__const char *) ("doc"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (LATEX_font))[3] - ((__const unsigned char *) (__const char *) ("doc"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("doc"); register int __result = (((__const unsigned char *) (__const char *) (LATEX_font))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (LATEX_font))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (LATEX_font))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const!
 unsigned char *) (__const char *) (LATEX_font))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("doc") && ((size_t)(const void *)(("doc") + 1) - (size_t)(const void *)("doc") == 1) && (__s2_len = strlen ("doc"), __s2_len < 4) ? (__builtin_constant_p (LATEX_font) && ((size_t)(const void *)((LATEX_font) + 1) - (size_t)(const void *)(LATEX_font) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (LATEX_font))[0] - ((__const unsigned char *) (__const char *)("doc"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (LATEX_font))[1] - ((__const unsigned char *) (__const char *) ("doc"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (LATEX_font))[2] - ((__const unsigned char *) (__const char *) ("doc"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (LATEX_font))[3] - ((__const u!
nsigned char *) (__const char *) ("doc"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (LATEX_font); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("doc"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("doc"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("doc"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("doc"))[3]); } } __result; }))) : strcmp (LATEX_font, "doc")))); })==0)
        (__extension__ (__builtin_constant_p ("(document specific font)") && __builtin_constant_p (1024) ? (strlen ("(document specific font)") + 1 >= ((size_t) (1024)) ? (char *) memcpy (term_options, "(document specific font)", 1024) : strncpy (term_options, "(document specific font)", 1024)) : strncpy (term_options, "(document specific font)", 1024)));
    else
        sprintf(term_options, "%s %d",
                LATEX_font[2] == 't' ? "courier" : "roman", LATEX_fontsize);
}


static void LATEX_init()
{

    emtex = 0;

    LATEX_posx = LATEX_posy = 0;

    fprintf(gpoutfile, "%% GNUPLOT: LaTeX picture\n\\setlength{\\unitlength}{%fpt}\n\\ifx\\plotpoint\\undefined\\newsavebox{\\plotpoint}\\fi\n",



            ((72.27)/(300)));

    LATEX_linetype(-1);
    LATEX_size = 0;
}

static void LATEX_graphics()
{
    register struct TERMENTRY *t = term;


    int xscale = xsize * t->xmax;
    int yscale = ysize * t->ymax;

    fprintf(gpoutfile, "\\begin{picture}(%d,%d)(0,0)\n", xscale, yscale);
    if (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (LATEX_font) && __builtin_constant_p ("doc") && (__s1_len = strlen (LATEX_font), __s2_len = strlen ("doc"), (!((size_t)(const void *)((LATEX_font) + 1) - (size_t)(const void *)(LATEX_font) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("doc") + 1) - (size_t)(const void *)("doc") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (LATEX_font), (__const char *) ("doc"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (LATEX_font) && ((size_t)(const void *)((LATEX_font) + 1) - (size_t)(const void *)(LATEX_font) == 1) && (__s1_len = strlen (LATEX_font), __s1_len < 4) ? (__builtin_constant_p ("doc") && ((size_t)(const void *)(("doc") + 1) - (size_t)(const void *)("doc") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (LATEX_font))[0] - ((__const unsigned char *) (__const char *)("doc"))[0]); if (__s1_len > 0 && __result == 0) { !
__result = (((__const unsigned char *) (__const char *) (LATEX_font))[1] - ((__const unsigned char *) (__const char *) ("doc"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (LATEX_font))[2] - ((__const unsigned char *) (__const char *) ("doc"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (LATEX_font))[3] - ((__const unsigned char *) (__const char *) ("doc"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("doc"); register int __result = (((__const unsigned char *) (__const char *) (LATEX_font))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (LATEX_font))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (LATEX_font))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const!
 unsigned char *) (__const char *) (LATEX_font))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("doc") && ((size_t)(const void *)(("doc") + 1) - (size_t)(const void *)("doc") == 1) && (__s2_len = strlen ("doc"), __s2_len < 4) ? (__builtin_constant_p (LATEX_font) && ((size_t)(const void *)((LATEX_font) + 1) - (size_t)(const void *)(LATEX_font) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (LATEX_font))[0] - ((__const unsigned char *) (__const char *)("doc"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (LATEX_font))[1] - ((__const unsigned char *) (__const char *) ("doc"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (LATEX_font))[2] - ((__const unsigned char *) (__const char *) ("doc"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (LATEX_font))[3] - ((__const u!
nsigned char *) (__const char *) ("doc"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (LATEX_font); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("doc"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("doc"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("doc"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("doc"))[3]); } } __result; }))) : strcmp (LATEX_font, "doc")))); }) != 0) {
        fprintf(gpoutfile, "\\font\\gnuplot=%s10 at %dpt\n\\gnuplot\n",


                LATEX_font, LATEX_fontsize);
    }
}


static void LATEX_text()
{
    LATEX_rule(2, 0.,0.,0.,0.);
    LATEX_flushdot();
    fputs("\\end{picture}\n", gpoutfile);
    LATEX_posx = LATEX_posy = 0;
    LATEX_moved = 1;
}

static void LATEX_linetype(linetype)
int linetype;
{
    float size;

    if (linetype >= 6)
        linetype %= 6;


    if (!emtex)

        LATEX_rule(2, 0.,0.,0.,0.);
    LATEX_flushdot();




    size = (linetype >= 0 ? LATEX_lines[linetype].size
            : LATEX_lines[0].size);


    if (size != LATEX_size) {
        fprintf(gpoutfile,
                "\\sbox{\\plotpoint}{\\rule[%.3fpt]{%.3fpt}{%.3fpt}}%%\n",
                -size / 2, size, size);

        if (emtex)
            fprintf(gpoutfile, "\\special{em:linewidth %.1fpt}%%\n", size);

    }
    LATEX_size = size;
    LATEX_dotsize = size / ((72.27)/(300));
    LATEX_dotspace = (linetype >= 0) ? LATEX_lines[linetype].dotspace : 0;
    LATEX_moved = 1;
}

static void LATEX_move(x, y)
unsigned int x, y;
{
    LATEX_flushdot();

    LATEX_posx = x;
    LATEX_posy = y;
    LATEX_moved = 1;
}


static void LATEX_point(x, y, number)
unsigned int x, y;
int number;
{
    LATEX_move(x, y);



    fprintf(gpoutfile, "\\put(%d,%d){%s}\n", x, y,
            (number < 0 ? "\\rule{1pt}{1pt}"
             : LATEX_points[number % 12]));
}


static void LATEX_vector(ux, uy)
unsigned int ux, uy;
{
    if (LATEX_dotspace == 0.0) {


        if (emtex)
            EMTEX_solid_line(LATEX_posx, (int) ux, LATEX_posy, (int) uy);
        else

            LATEX_solid_line(LATEX_posx, (int) ux, LATEX_posy, (int) uy);
    } else

        LATEX_dot_line(LATEX_posx, (int) ux, LATEX_posy, (int) uy);

    LATEX_posx = ux;
    LATEX_posy = uy;
}

static void LATEX_solid_line(x1, x2, y1, y2)
int x1, x2, y1, y2;
{
    float slope;
    int inc;
    float dx, dy, x, y;
    float offset, length;
    int code;




    if (x1 == x2 && y1 == y2) {
        if (LATEX_moved) {
            LATEX_rule(2, 0.,0.,0.,0.);

            fprintf(gpoutfile, "\\put(%u,%u){%s}\n", x1, y1, "\\usebox{\\plotpoint}");
        }
    } else {
        code = (LATEX_moved ? 0 : 1);
        LATEX_moved = 0;
        if (x1 == x2)
            LATEX_rule(code, (double) x1, (double) y1,
                       LATEX_dotsize, (double) y2 - y1);
        else if (y1 == y2)
            LATEX_rule(code, (double) x1, (double) y1, (double) x2 - x1,
                       LATEX_dotsize);
        else {
            dx = (float) x2 - x1;
            dy = (float) y2 - y1;
            slope = dy / dx;
            if (((slope) >= 0 ? (slope) : -(slope)) <= 1.0) {

                x = ( (((dx) >= 0 ? (dx) : -(dx))) < ((0.25 + 1.0 / ((slope) >= 0 ? (slope) : -(slope))) * LATEX_dotsize) ? (((dx) >= 0 ? (dx) : -(dx))) : ((0.25 + 1.0 / ((slope) >= 0 ? (slope) : -(slope))) * LATEX_dotsize) );
                offset = ((dy) >= 0 ? 1 : -1) * ( (LATEX_dotsize) < (((dy) >= 0 ? (dy) : -(dy))) ? (LATEX_dotsize) : (((dy) >= 0 ? (dy) : -(dy))) );
                dy = dy - offset;
                length = x * ((72.27)/(300));
                inc = (x == ((dx) >= 0 ? (dx) : -(dx)) ? 1 : ( (1) > (((dy) >= 0 ? (dy) : -(dy)) / 0.5 + 0.5) ? (1) : (((dy) >= 0 ? (dy) : -(dy)) / 0.5 + 0.5) ));
                if (inc == 1) {
                    fprintf(gpoutfile, "\\put(%u,%.2f){\\rule{%.3fpt}{%.3fpt}}\n",
                            (x2 >= x1 ? x1 : x2), ((float) y1 + y2 - LATEX_dotsize) / 2,
                            length, LATEX_dotsize * ((72.27)/(300)));
                } else {
                    dy = dy / inc;
                    dx = (dx - ((dx) >= 0 ? 1 : -1) * x) / (inc - 1);
                    fprintf(gpoutfile,
                            "\\multiput(%.2f,%.2f)(%.3f,%.3f){%u}{\\rule{%.3fpt}{%.3fpt}}\n",
                            (dx >= 0.0 ? (float) x1 : x1 - x),
                            (float) y1 - (((dy) >= 0 ? (dy) : -(dy)) - offset) / 2,
                            dx, dy, inc, length, ((dy) >= 0 ? (dy) : -(dy)) * ((72.27)/(300)));
                }

                x = x / 2;
                dx = ((dx) >= 0 ? 1 : -1) * x;
                dx = (float) x2 - x1 - dx;
                dy = (float) y2 - y1;
                fprintf(gpoutfile, "\\multiput(%.2f,%.2f)(%.3f,%.3f){2}{\\rule{%.3fpt}{%.3fpt}}\n",
                        (dx >= 0.0 ? (float) x1 : x1 - x), (float) y1 - LATEX_dotsize / 2,
                        dx, dy, x * ((72.27)/(300)), LATEX_dotsize * ((72.27)/(300)));
                LATEX_moved = 1;
            } else {

                y = ( (((dy) >= 0 ? (dy) : -(dy))) < ((0.25 + ((slope) >= 0 ? (slope) : -(slope))) * LATEX_dotsize) ? (((dy) >= 0 ? (dy) : -(dy))) : ((0.25 + ((slope) >= 0 ? (slope) : -(slope))) * LATEX_dotsize) );
                offset = ((dx) >= 0 ? 1 : -1) * ( (LATEX_dotsize) < (((dx) >= 0 ? (dx) : -(dx))) ? (LATEX_dotsize) : (((dx) >= 0 ? (dx) : -(dx))) );
                dx = dx - offset;
                length = y * ((72.27)/(300));
                inc = (y == ((dy) >= 0 ? (dy) : -(dy)) ? 1 : ( (1) > (((dx) >= 0 ? (dx) : -(dx)) / 0.5 + 0.5) ? (1) : (((dx) >= 0 ? (dx) : -(dx)) / 0.5 + 0.5) ));
                if (inc == 1) {
                    fprintf(gpoutfile, "\\put(%.2f,%u){\\rule{%.3fpt}{%.3fpt}}\n",
                            ((float) x1 + x2 - LATEX_dotsize) / 2, (y2 >= y1 ? y1 : y2),
                            LATEX_dotsize * ((72.27)/(300)), length);
                } else {
                    dx = dx / inc;
                    dy = (dy - ((dy) >= 0 ? 1 : -1) * y) / (inc - 1);
                    fprintf(gpoutfile,
                            "\\multiput(%.2f,%.2f)(%.3f,%.3f){%u}{\\rule{%.3fpt}{%.3fpt}}\n",
                            (float) x1 - (((dx) >= 0 ? (dx) : -(dx)) - offset) / 2,
                            (dy >= 0 ? (float) y1 : y1 - y),
                            dx, dy, inc, ((dx) >= 0 ? (dx) : -(dx)) * ((72.27)/(300)), length);
                }

                y = y / 2;
                dx = (float) x2 - x1;
                dy = ((dy) >= 0 ? 1 : -1) * y;
                dy = (float) y2 - y1 - dy;
                fprintf(gpoutfile, "\\multiput(%.2f,%.2f)(%.3f,%.3f){2}{\\rule{%.3fpt}{%.3fpt}}\n",
                        (float) x1 - LATEX_dotsize / 2, (dy >= 0.0 ? (float) y1 : y1 - y),
                        dx, dy, LATEX_dotsize * ((72.27)/(300)), y * ((72.27)/(300)));
                LATEX_moved = 1;
            }
        }
    }
}







static void LATEX_rule(code, x, y, width, height)
int code;
double x, y;
double width;
double height;
{
    static float lastx, lasty;
    static float lastw, lasth;
    static TBOOLEAN isvalid = 0;
    TBOOLEAN combine = (code == 1);
    TBOOLEAN flush = (code == 2);

    if (!flush)
        if (width == 0 || height == 0)
            return;

    if (isvalid && combine) {

        if ((int) lastx == (int) x && lastw == width) {
            if (lasth * height >= 0) {
                lasth += height;
                return;
            }
        } else if ((int) lasty == (int) y && lasth == height) {
            if (lastw * width >= 0) {
                lastw += width;
                return;
            }
        }

    }
    if (isvalid) {

        if (lastw < 0) {
            lastx += lastw;
            lastw = -lastw;
        }
        if (lasth < 0) {
            lasty += lasth;
            lasth = -lasth;
        }

        if (lastw < LATEX_dotsize || lasth < LATEX_dotsize)
            fprintf(gpoutfile, "\\put(%.1f,%.1f){%s}\n",
                    lastx, lasty, "\\usebox{\\plotpoint}");
        else
            fprintf(gpoutfile, "\\put(%.1f,%.1f){\\rule[%.3fpt]{%.3fpt}{%.3fpt}}\n",
                    lastx, lasty, -LATEX_dotsize * ((72.27)/(300)) / 2,
                    lastw * ((72.27)/(300)), lasth * ((72.27)/(300)));
    }
    if (flush) {
        isvalid = 0;
    } else {
        lastx = x;
        lasty = y;
        lastw = width;
        lasth = height;
        isvalid = 1;
    }
}

static void LATEX_dot_line(x1, x2, y1, y2)
int x1, x2, y1, y2;
{
    static float LATEX_left;



    if (LATEX_moved)
        LATEX_left = 1.0;


    if (x1 == x2 && y1 == y2) {
        if (LATEX_moved)

            fprintf(gpoutfile, "\\put(%u,%u){%s}\n", x1, y1, "\\usebox{\\plotpoint}");
    } else {
        float dotspace = LATEX_dotspace / ((72.27)/(300));
        float x, y;
        float xinc, yinc;
        float slope;
        float lastx = -1;
        float lasty = -1;
        int numdots = 0;


        if (x2 == x1) {
            xinc = 0.0;
            yinc = (y2 - y1 > 0) ? dotspace : -dotspace;
        } else {
            slope = ((float) y2 - y1) / ((float) x2 - x1);
            xinc = dotspace / sqrt(1 + slope * slope) * ((x2 - x1) >= 0 ? 1 : -1);
            yinc = slope * xinc;
        }



        for (x = x1 + xinc * (1 - LATEX_left), y = y1 + yinc * (1 - LATEX_left);
             (x2 - x) * xinc >= 0 && (y2 - y) * yinc >= 0;
             lastx = x, x += xinc,
             lasty = y, y += yinc)
            numdots++;
        if (numdots == 1)
            fprintf(gpoutfile, "\\put(%.2f,%.2f){%s}\n",
                    lastx, lasty, "\\usebox{\\plotpoint}");
        else if (numdots > 0)
            fprintf(gpoutfile, "\\multiput(%u,%u)(%.3f,%.3f){%u}{%s}\n",
                    x1, y1, xinc, yinc, numdots, "\\usebox{\\plotpoint}");


        if (xinc != 0.0)
            if (lastx >= 0)
                LATEX_left = ((x2 - lastx) >= 0 ? (x2 - lastx) : -(x2 - lastx)) / ((xinc) >= 0 ? (xinc) : -(xinc));
            else
                LATEX_left += ((x2 - x1) >= 0 ? (x2 - x1) : -(x2 - x1)) / ((xinc) >= 0 ? (xinc) : -(xinc));
        else if (lasty >= 0)
            LATEX_left = ((y2 - lasty) >= 0 ? (y2 - lasty) : -(y2 - lasty)) / ((yinc) >= 0 ? (yinc) : -(yinc));
        else
            LATEX_left += ((y2 - y1) >= 0 ? (y2 - y1) : -(y2 - y1)) / ((yinc) >= 0 ? (yinc) : -(yinc));
    }

    LATEX_needsdot = (LATEX_left > 0);

    LATEX_moved = 0;
}

static void LATEX_flushdot()
{
    if (LATEX_needsdot)
        fprintf(gpoutfile, "\\put(%d,%d){%s}\n",
                LATEX_posx, LATEX_posy, "\\usebox{\\plotpoint}");
    LATEX_needsdot = 0;
}

static void LATEX_arrow(sx, sy, ex, ey, head)
unsigned int sx, sy, ex, ey;
TBOOLEAN head;
{
    best_latex_arrow(sx, sy, ex, ey, 1, head);

    LATEX_posx = ex;
    LATEX_posy = ey;
}

void best_latex_arrow(sx, sy, ex, ey, who, head)
int sx, sy, ex, ey;
int who;
TBOOLEAN head;
{
    int dx = ex - sx;
    int dy = ey - sy;
    float m;
    float arrowslope;
    float minerror = 0;
    struct vslope *slope;
    struct vslope *bestslope;





    if (dx == 0) {

        fprintf(gpoutfile, "\\put(%d,%d){\\%s(0,%d){%d}}\n",
                sx, sy, head ? "vector" : "line",
                ((ey - sy) >= 0 ? 1 : -1), ((ey - sy) >= 0 ? (ey - sy) : -(ey - sy)));
    } else if (dy == 0) {

        fprintf(gpoutfile, "\\put(%d,%d){\\%s(%d,0){%d}}\n",
                sx, sy, head ? "vector" : "line",
                ((ex - sx) >= 0 ? 1 : -1), ((ex - sx) >= 0 ? (ex - sx) : -(ex - sx)));
    } else {



        bestslope = ((void *)0);
        minerror = 0;
        m = (((float) dy / dx) >= 0 ? ((float) dy / dx) : -((float) dy / dx));
        for (slope = LATEX_slopes; slope->dx != 0.0; slope++) {

            arrowslope = (float) slope->dy / slope->dx;
            if (bestslope == ((void *)0) || ((m - arrowslope) >= 0 ? (m - arrowslope) : -(m - arrowslope)) < minerror) {
                minerror = ((m - arrowslope) >= 0 ? (m - arrowslope) : -(m - arrowslope));
                bestslope = slope;
            }
        }



        if (minerror == 0.0)
            fprintf(gpoutfile, "\\put(%d,%d){\\%s(%d,%d){%d}}\n",
                    sx, sy, head ? "vector" : "line",
                    bestslope->dx * ((ex - sx) >= 0 ? 1 : -1), bestslope->dy * ((ey - sy) >= 0 ? 1 : -1),
                    ((ex - sx) >= 0 ? (ex - sx) : -(ex - sx)));
        else {


            if (emtex) {
                LATEX_linetype(0);
                EMTEX_solid_line(sx, ex, sy, ey);
            } else

            if (who == 1) {
                LATEX_linetype(0);
                LATEX_solid_line(sx, ex, sy, ey);
            }

            else {
                EEPIC_move(sx, sy);
                EEPIC_vector(ex, ey);
            }


            if (head)
                fprintf(gpoutfile, "\\put(%d,%d){\\vector(%d,%d){0}}\n",
                        ex, ey,
                        bestslope->dx * ((ex - sx) >= 0 ? 1 : -1), bestslope->dy * ((ey - sy) >= 0 ? 1 : -1));
        }
    }
}

static void LATEX_put_text(x, y, str)
unsigned int x, y;
char str[];
{
    static char *justify[] =
    {"[l]", "", "[r]"};
    int flag, i;


    if (str[0] == ('\0'))
        return;

    for (flag = 0, i = 0; str[i] && !flag;)
        flag = (str[i++] == '\\') && (str[i++] == '\\');

    fprintf(gpoutfile, "\\put(%d,%d)", x, y);
    if ((str[0] == '{') || (str[0] == '[')) {
        fprintf(gpoutfile, "{\\makebox(0,0)%s}\n", str);
    } else if (flag)
        fprintf(gpoutfile, "{\\makebox(0,0)%s{\\shortstack{%s}}}\n",
                justify[latex_justify], str);
    else
        fprintf(gpoutfile, "{\\makebox(0,0)%s{%s}}\n",
                justify[latex_justify], str);
}

static int LATEX_justify_text(mode)
enum JUSTIFY mode;
{
    latex_justify = mode;
    return (1);
}

static int LATEX_text_angle(ang)
int ang;
{



    latex_angle = ang;
    return (1);
}

static void LATEX_reset()
{
    LATEX_posx = LATEX_posy = 0;
    LATEX_moved = 1;
}




static void EMTEX_init()
{
    emtex = 1;
    LATEX_posx = LATEX_posy = 0;
    fprintf(gpoutfile, "%% GNUPLOT: LaTeX picture with emtex specials\n\\setlength{\\unitlength}{%fpt}\n\\ifx\\plotpoint\\undefined\\newsavebox{\\plotpoint}\\fi\n",



            ((72.27)/(300)));
    LATEX_linetype(-1);
}


static void EMTEX_reset()
{
    emtex = 0;
    LATEX_posx = LATEX_posy = 0;
}


static void EMTEX_text()
{
    fputs("\\end{picture}\n", gpoutfile);
}


static void EMTEX_solid_line(x1, x2, y1, y2)
int x1, x2, y1, y2;
{

    if (LATEX_moved)
        fprintf(gpoutfile, "\\put(%d,%d){\\special{em:moveto}}\n", x1, y1);
    if ((x1 != x2) || (y1 != y2))
        fprintf(gpoutfile, "\\put(%d,%d){\\special{em:lineto}}\n", x2, y2);
    LATEX_posx = x2;
    LATEX_posy = y2;
    LATEX_moved = 0;
}
# 373 "term.h" 2


# 1 "term/pslatex.trm" 1
# 52 "term/pslatex.trm"
# 1 "term/driver.h" 1
# 53 "term/pslatex.trm" 2







static void PSLATEX_options (void);
static void PSLATEX_init (void);
static void PSLATEX_graphics (void);
static void PSLATEX_put_text (unsigned int x, unsigned int y, char str[]);
static int PSLATEX_justify_text (enum JUSTIFY mode);
static int PSLATEX_text_angle (int ang);
static void PSLATEX_reset (void);
static void PSLATEX_text (void);
static void PSLATEX_move (unsigned int x, unsigned int y);
static void PSLATEX_vector (unsigned int x, unsigned int y);
static void PSLATEX_linetype (int lt);
static void PSLATEX_point (unsigned int x, unsigned int y, int number);
static void PSLATEX_pointsize (double size);
static void PSLATEX_linewidth (double width);
# 89 "term/pslatex.trm"
static int PSLATEX_angle;
static int PSLATEX_justify;
static int PSLATEX_rotate = 1;
static char *PSLATEX_psfile = ((void *)0);
static TBOOLEAN PSLATEX_useAuxFile = 0;
static FILE *PSLATEX_auxFile = ((void *)0);
static TBOOLEAN PSLATEX_output = 1;

struct text_command {
    int x, y, angle, justify;
    char *label;
    struct text_command *next;
};

static struct text_command *PSLATEX_labels;

static void PSLATEX_options()
{
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "d$efault")) {
            ps_color = 0;
            ps_solid = 0;
            PSLATEX_rotate = 1;
            PSLATEX_useAuxFile = 0;
            c_token++;
        }
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "c$olor")
            || almost_equals(c_token, "c$olour")) {
            ps_color = 1;
            c_token++;
        }
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "m$onochrome")) {
            ps_color = 0;
            c_token++;
        }
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "so$lid")) {
            ps_solid = 1;
            c_token++;
        } else if (almost_equals(c_token, "da$shed")) {
            ps_solid = 0;
            c_token++;
        }
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "r$otate")) {
            PSLATEX_rotate = 1;
            c_token++;
        }
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "n$orotate")) {
            PSLATEX_rotate = 0;
            c_token++;
        }
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "a$uxfile")) {
            PSLATEX_useAuxFile = 1;
            c_token++;
        }
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {

        struct value a;
        int ps_fontsize = (int) real(const_express(&a));
        term->v_char = (unsigned int) (ps_fontsize * (10));
        term->h_char = (unsigned int) (ps_fontsize * (10) / 2);
    }


    sprintf(term_options, "%s %s %s%s",
            ps_color ? "color" : "monochrome",
            ps_solid ? "solid" : "dashed",
            PSLATEX_rotate ? "rotate" : "norotate",
            PSLATEX_useAuxFile ? " auxfile" : "");
}

static void PSLATEX_init()
{
    char *dotIndex;

    if (__extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (term->name) && __builtin_constant_p ("pstex") && (__s1_len = strlen (term->name), __s2_len = strlen ("pstex"), (!((size_t)(const void *)((term->name) + 1) - (size_t)(const void *)(term->name) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("pstex") + 1) - (size_t)(const void *)("pstex") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (term->name), (__const char *) ("pstex"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (term->name) && ((size_t)(const void *)((term->name) + 1) - (size_t)(const void *)(term->name) == 1) && (__s1_len = strlen (term->name), __s1_len < 4) ? (__builtin_constant_p ("pstex") && ((size_t)(const void *)(("pstex") + 1) - (size_t)(const void *)("pstex") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (term->name))[0] - ((__const unsigned char *) (__const char *)("pstex"))[0]); if (__s1_len > 0 &&!
 __result == 0) { __result = (((__const unsigned char *) (__const char *) (term->name))[1] - ((__const unsigned char *) (__const char *) ("pstex"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (term->name))[2] - ((__const unsigned char *) (__const char *) ("pstex"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (term->name))[3] - ((__const unsigned char *) (__const char *) ("pstex"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("pstex"); register int __result = (((__const unsigned char *) (__const char *) (term->name))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (term->name))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (term->name))[2] - __s2[2]); if (__s1_len > 2 && __result =!
= 0) __result = (((__const unsigned char *) (__const char *) (term->name))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("pstex") && ((size_t)(const void *)(("pstex") + 1) - (size_t)(const void *)("pstex") == 1) && (__s2_len = strlen ("pstex"), __s2_len < 4) ? (__builtin_constant_p (term->name) && ((size_t)(const void *)((term->name) + 1) - (size_t)(const void *)(term->name) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (term->name))[0] - ((__const unsigned char *) (__const char *)("pstex"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (term->name))[1] - ((__const unsigned char *) (__const char *) ("pstex"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (term->name))[2] - ((__const unsigned char *) (__const char *) ("pstex"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__cons!
t char *) (term->name))[3] - ((__const unsigned char *) (__const char *) ("pstex"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (term->name); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("pstex"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("pstex"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("pstex"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("pstex"))[3]); } } __result; }))) : strcmp (term->name, "pstex")))); }) == 0)
        PSLATEX_output = 0;


    PSLATEX_auxFile = ((void *)0);
# 189 "term/pslatex.trm"
    if ((dotIndex = strrchr(outstr, '.')) == ((void *)0))
        dotIndex = (__extension__ (__builtin_constant_p (('\0')) && (('\0')) == '\0' ? (char *) __rawmemchr (outstr, ('\0')) : strchr (outstr, ('\0'))));


    if (outstr && PSLATEX_useAuxFile == 1) {


        PSLATEX_psfile = gp_realloc (PSLATEX_psfile,(dotIndex - outstr) + 4,"pslatex aux filename");
        if (PSLATEX_psfile) {

            (__extension__ (__builtin_constant_p (outstr) && __builtin_constant_p ((dotIndex - outstr) + 1) ? (strlen (outstr) + 1 >= ((size_t) ((dotIndex - outstr) + 1)) ? (char *) memcpy (PSLATEX_psfile, outstr, (dotIndex - outstr) + 1) : strncpy (PSLATEX_psfile, outstr, (dotIndex - outstr) + 1)) : strncpy (PSLATEX_psfile, outstr, (dotIndex - outstr) + 1)));

            (__extension__ (__builtin_constant_p (".ps") ? (((size_t)(const void *)((".ps") + 1) - (size_t)(const void *)(".ps") == 1) && strlen (".ps") + 1 <= 8 ? __strcpy_small (PSLATEX_psfile + (dotIndex - outstr), __extension__ (((__const unsigned char *) (__const char *) (".ps"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) (".ps"))[0]), __extension__ (((__const unsigned char *) (__const char *) (".ps"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) (".ps"))[4]), __extension__ (((((__const unsigned char *) (__const char *) (".ps"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) (".ps"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) (".ps"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) (".ps"))[0]), __extension__ (((((__const unsigned char *) (__const char *) (".ps"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) (".ps"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) (".ps"))[4 + 1]) !
<< 8 | ((__const unsigned char *) (__const char *) (".ps"))[4]), strlen (".ps") + 1) : (char *) memcpy (PSLATEX_psfile + (dotIndex - outstr), ".ps", strlen (".ps") + 1)) : strcpy (PSLATEX_psfile + (dotIndex - outstr), ".ps")));
            PSLATEX_auxFile = fopen(PSLATEX_psfile, "w");
            if (PSLATEX_auxFile == (FILE *) ((void *)0)) {
                fprintf(stderr, "Cannot open aux file %s for output\n",
                        PSLATEX_psfile);

            }
        } else {
            fprintf(stderr, "Cannot make PostScript file name from %s\nTurning off auxfile option\n", outstr);


            PSLATEX_auxFile = ((void *)0);
                       PSLATEX_useAuxFile = 0;
        }
    }
    if (PSLATEX_output) {
        fputs("% GNUPLOT: LaTeX picture with Postscript\n\\begingroup%\n  \\makeatletter%\n  \\newcommand{\\GNUPLOTspecial}{%\n    \\@sanitize\\catcode`\\%=14\\relax\\special}%\n  \\setlength{\\unitlength}{0.1bp}%\n", gpoutfile);






    } else {



        fputs("% GNUPLOT: plain TeX with Postscript\n\\begingroup\n  \\catcode`\\@=11\\relax\n  \\def\\GNUPLOTspecial{%\n    \\def\\do##1{\\catcode`##1=12\\relax}\\dospecials\n    \\catcode`\\{=1\\catcode`\\}=2\\catcode\\%=14\\relax\\special}%\n%\n\\expandafter\\ifx\\csname GNUPLOTpicture\\endcsname\\relax\n  \\csname newdimen\\endcsname\\GNUPLOTunit\n  \\gdef\\GNUPLOTpicture(#1,#2){\\vbox to#2\\GNUPLOTunit\\bgroup\n    \\def\\put(##1,##2)##3{\\unskip\\raise##2\\GNUPLOTunit\n      \\hbox to0pt{\\kern##1\\GNUPLOTunit ##3\\hss}\\ignorespaces}%\n    \\def\\ljust##1{\\vbox to0pt{\\vss\\hbox to0pt{##1\\hss}\\vss}}%\n    \\def\\cjust##1{\\vbox to0pt{\\vss\\hbox to0pt{\\hss ##1\\hss}\\vss}}%\n    \\def\\rjust##1{\\vbox to0pt{\\vss\\hbox to0pt{\\hss ##1}\\vss}}%\n    \\def\\stack##1{\\let\\\\=\\cr\\tabskip=0pt\\halign{\\hfil ####\\hfil\\cr ##1\\crcr}}%\n    \\def\\lstack##1{\\hbox to0pt{\\vbox to0pt{\\vss\\stack{##1}}\\hss}}%\n    \\def\\cstack##1{\\hbox to0pt{\\hss\\vbox to0pt{\\vs!
s\\stack{##1}}\\hss}}%\n    \\def\\rstack##1{\\hbox to0pt{\\vbox to0pt{\\stack{##1}\\vss}\\hss}}%\n    \\vss\\hbox to#1\\GNUPLOTunit\\bgroup\\ignorespaces}%\n  \\gdef\\endGNUPLOTpicture{\\hss\\egroup\\egroup}%\n\\fi\n\\GNUPLOTunit=0.1bp\n", gpoutfile);
# 252 "term/pslatex.trm"
    }

    {
        unsigned int xmin_t = xoffset * (5*720) / (10);
        unsigned int xmax_t = (xoffset + xsize) * (5*720) / (10);
        unsigned int ymin_t = yoffset * (3*720) / (10);
        unsigned int ymax_t = (yoffset + ysize) * (3*720) / (10);

        if (PSLATEX_auxFile) {
            FILE *tmp = gpoutfile;
            gpoutfile = PSLATEX_auxFile;
            PS_common_init(1, 1, 0, 0, 0, xmin_t, ymin_t, xmax_t, ymax_t, ((void *)0));
            gpoutfile = tmp;
        } else {
            fputs("{\\GNUPLOTspecial{!\n", gpoutfile);
            PS_common_init(1, 1, 0, 0, 0, xmin_t, ymin_t, xmax_t, ymax_t, ((void *)0));
            fputs("}}%\n", gpoutfile);
        }
    }

    PSLATEX_angle = 0;
    PSLATEX_justify = 0;
    PSLATEX_labels = 0;
}

static void PSLATEX_graphics()
{
    struct TERMENTRY *t = term;

    if (PSLATEX_output)
        fprintf(gpoutfile, "\\begin{picture}(%d,%d)(0,0)%%\n",
                (int) (xsize * t->xmax), (int) (ysize * t->ymax));
    else
        fprintf(gpoutfile, "\\GNUPLOTpicture(%d,%d)\n",
                (int) (xsize * t->xmax), (int) (ysize * t->ymax));

    if (PSLATEX_auxFile) {
        FILE *tmp;


        int urx = (int) (xsize * (7200) / (10) + 0.5);
        int ury = (int) (ysize * (5040) / (10) + 0.5);


        char *psfile_basename = strrchr(PSLATEX_psfile, '/');

        if (psfile_basename)
            psfile_basename++;
        else {
            if (('\0') != ('\0')) {
                psfile_basename = strrchr(PSLATEX_psfile, ('\0'));
                if (psfile_basename)
                    psfile_basename++;
                else
                    psfile_basename = PSLATEX_psfile;
            } else
                psfile_basename = PSLATEX_psfile;
        }


        fprintf(gpoutfile,
                "\\special{psfile=%s llx=0 lly=0 urx=%d ury=%d rwi=%d}\n",
                psfile_basename, urx, ury, 10 * urx);
        tmp = gpoutfile;
        gpoutfile = PSLATEX_auxFile;
        PS_graphics();
        gpoutfile = tmp;
    } else {
        fputs("{\\GNUPLOTspecial{\"\n", gpoutfile);
        PS_graphics();
    }

    PSLATEX_labels = (struct text_command *) ((void *)0);
}

static void PSLATEX_put_text(x, y, str)
unsigned int x, y;
char str[];
{
    struct text_command *tc;


    if (str[0] == ('\0'))
        return;

    tc = (struct text_command *) gp_alloc(sizeof(struct text_command), term->name);
    tc->x = x;
    tc->y = y;
    tc->label = (char *) gp_alloc(strlen(str) + 1, term->name);
    (__extension__ (__builtin_constant_p (str) ? (((size_t)(const void *)((str) + 1) - (size_t)(const void *)(str) == 1) && strlen (str) + 1 <= 8 ? __strcpy_small (tc->label, __extension__ (((__const unsigned char *) (__const char *) (str))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) (str))[0]), __extension__ (((__const unsigned char *) (__const char *) (str))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) (str))[4]), __extension__ (((((__const unsigned char *) (__const char *) (str))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) (str))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) (str))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) (str))[0]), __extension__ (((((__const unsigned char *) (__const char *) (str))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) (str))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) (str))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) (str))[4]), st!
rlen (str) + 1) : (char *) memcpy (tc->label, str, strlen (str) + 1)) : strcpy (tc->label, str)));
    tc->justify = PSLATEX_justify;
    tc->angle = PSLATEX_angle;

    tc->next = PSLATEX_labels;
    PSLATEX_labels = tc;
}

static int PSLATEX_justify_text(mode)
enum JUSTIFY mode;
{
    PSLATEX_justify = mode;
    return 1;
}

static int PSLATEX_text_angle(ang)
int ang;
{


    PSLATEX_angle = ang;
    return 1;
}


static void PSLATEX_reset()
{
    if (PSLATEX_auxFile) {
        fclose(PSLATEX_auxFile);
        PSLATEX_auxFile = ((void *)0);
    }
    if (PSLATEX_psfile) {
        free(PSLATEX_psfile);
        PSLATEX_psfile = ((void *)0);
    }
}

static void PSLATEX_text()
{
    struct text_command *tc;

    if (PSLATEX_auxFile) {
        FILE *tmp = gpoutfile;
        gpoutfile = PSLATEX_auxFile;
        PS_text();
        gpoutfile = tmp;
    } else {
        PS_text();
        fputs("}}%\n", gpoutfile);
    }

    for (tc = PSLATEX_labels; tc != (struct text_command *) ((void *)0); tc = tc->next) {
        fprintf(gpoutfile, "\\put(%d,%d){", tc->x, tc->y);
        if (PSLATEX_output &&
            ((tc->label[0] == '{') || (tc->label[0] == '['))) {
            fprintf(gpoutfile, "\\makebox(0,0)%s", tc->label);
        } else
            switch (tc->angle) {
            case 0:
                switch (tc->justify) {
                case LEFT:
                    fprintf(gpoutfile, (PSLATEX_output
                                        ? "\\makebox(0,0)[l]{%s}"
                                        : "\\ljust{%s}"), tc->label);
                    break;
                case CENTRE:
                    fprintf(gpoutfile, (PSLATEX_output
                                        ? "\\makebox(0,0){%s}"
                                        : "\\cjust{%s}"), tc->label);
                    break;
                case RIGHT:
                    fprintf(gpoutfile, (PSLATEX_output
                                        ? "\\makebox(0,0)[r]{%s}"
                                        : "\\rjust{%s}"), tc->label);
                    break;
                }
                break;
            case 1:
                if (PSLATEX_rotate) {
                    fputs("%\n\\special{ps: gsave currentpoint currentpoint translate\n270 rotate neg exch neg exch translate}%\n", gpoutfile);


                }
                switch (tc->justify) {
                case LEFT:
                    fprintf(gpoutfile, (PSLATEX_output
                                        ? "\\makebox(0,0)[lb]{\\shortstack{%s}}"
                                        : "\\lstack{%s}"),
                            tc->label);
                    break;
                case CENTRE:
                    fprintf(gpoutfile, (PSLATEX_output
                                        ? "\\makebox(0,0)[b]{\\shortstack{%s}}"
                                        : "\\cstack{%s}"),
                            tc->label);
                    break;
                case RIGHT:
                    fprintf(gpoutfile, (PSLATEX_output
                                        ? "\\makebox(0,0)[lt]{\\shortstack{%s}}"
                                        : "\\rstack{%s}"),
                            tc->label);
                    break;
                }
                if (PSLATEX_rotate) {
                    fputs("%\n\\special{ps: currentpoint grestore moveto}%\n", gpoutfile);
                }
            }
        fputs("}%\n", gpoutfile);
    }

    while (PSLATEX_labels) {
        tc = PSLATEX_labels->next;
        free(PSLATEX_labels->label);
        free(PSLATEX_labels);
        PSLATEX_labels = tc;
    }

    if (PSLATEX_output) {
        fputs("\\end{picture}%\n\\endgroup\n\\endinput\n", gpoutfile);



    } else {
        fputs("\\endGNUPLOTpicture\n\\endgroup\n\\endinput\n", gpoutfile);



    }
}

static void PSLATEX_move(x, y)
unsigned int x, y;
{
    if (PSLATEX_auxFile) {
        FILE *tmp = gpoutfile;
        gpoutfile = PSLATEX_auxFile;
        PS_move(x, y);
        gpoutfile = tmp;
    } else {
        PS_move(x, y);
    }
}


static void PSLATEX_vector(x, y)
unsigned int x, y;
{

    if (PSLATEX_auxFile) {
        FILE *tmp = gpoutfile;
        gpoutfile = PSLATEX_auxFile;
        PS_vector(x, y);
        gpoutfile = tmp;
    } else {
        PS_vector(x, y);
    }
}


static void PSLATEX_linetype(lt)
int lt;
{
    if (PSLATEX_auxFile) {
        FILE *tmp = gpoutfile;
        gpoutfile = PSLATEX_auxFile;
        PS_linetype(lt);
        gpoutfile = tmp;
    } else {
        PS_linetype(lt);
    }
}

static void PSLATEX_point(x, y, number)
unsigned int x, y;
int number;
{
    if (PSLATEX_auxFile) {
        FILE *tmp = gpoutfile;
        gpoutfile = PSLATEX_auxFile;
        PS_point(x, y, number);
        gpoutfile = tmp;
    } else
        PS_point(x, y, number);
}


static void PSLATEX_pointsize(ps)
double ps;
{
    if (PSLATEX_auxFile) {
        FILE *tmp = gpoutfile;
        gpoutfile = PSLATEX_auxFile;
        PS_pointsize(ps);
        gpoutfile = tmp;
    } else
        PS_pointsize(ps);
}


static void PSLATEX_linewidth(ps)
double ps;
{
    if (PSLATEX_auxFile) {
        FILE *tmp = gpoutfile;
        gpoutfile = PSLATEX_auxFile;
        PS_linewidth(ps);
        gpoutfile = tmp;
    } else
        PS_linewidth(ps);
}
# 376 "term.h" 2


# 1 "term/eepic.trm" 1
# 67 "term/eepic.trm"
# 1 "term/driver.h" 1
# 68 "term/eepic.trm" 2






static void EEPIC_init (void);
static void EEPIC_graphics (void);
static void EEPIC_text (void);
static void EEPIC_linetype (int linetype);
static void EEPIC_move (unsigned int x, unsigned int y);
static void EEPIC_point (unsigned int x, unsigned int y, int number);

static void EEPIC_vector (unsigned int ux, unsigned int uy);
static void EEPIC_arrow (unsigned int sx, unsigned int sy, unsigned int ex, unsigned int ey, TBOOLEAN head);


static void EEPIC_put_text (unsigned int x, unsigned int y, char str[]);

static int EEPIC_justify_text (enum JUSTIFY mode);
static int EEPIC_text_angle (int ang);
static void EEPIC_reset (void);
# 112 "term/eepic.trm"
static unsigned int EEPIC_posx;
static unsigned int EEPIC_posy;
enum JUSTIFY eepic_justify = LEFT;
static int eepic_angle = 0;






static char * EEPIC_points[] =
{
    "\\raisebox{-1.2pt}{\\makebox(0,0){$\\Diamond$}}",
    "\\makebox(0,0){$+$}",
    "\\raisebox{-1.2pt}{\\makebox(0,0){$\\Box$}}",
    "\\makebox(0,0){$\\times$}",
    "\\makebox(0,0){$\\triangle$}",
    "\\makebox(0,0){$\\star$}",
    "\\circle{12}", "\\circle{18}", "\\circle{24}",
    "\\circle*{12}", "\\circle*{18}", "\\circle*{24}"
};



static char * EEPIC_lines[] =
{
    "\\thicklines \\path",
    "\\thinlines \\drawline[-50]",
    "\\thinlines \\path",
    "\\thicklines \\path",
    "\\Thicklines \\path",
};







static int EEPIC_type;
static TBOOLEAN EEPIC_inline = 0;
void EEPIC_endline (void);
static int EEPIC_linecount = 0;





void best_latex_arrow (int sx, int sy, int ex, int ey, int who, TBOOLEAN head);


static void EEPIC_init()
{
    EEPIC_posx = EEPIC_posy = 0;
    EEPIC_linetype(-1);
    fprintf(gpoutfile, "%% GNUPLOT: LaTeX picture using EEPIC macros\n\\setlength{\\unitlength}{%fpt}\n", ((72.27)/(300)));

}


static void EEPIC_graphics()
{
    register struct TERMENTRY *t = term;

    fprintf(gpoutfile, "\\begin{picture}(%d,%d)(0,0)\n\\footnotesize\n", t->xmax, t->ymax);


}


static void EEPIC_text()
{
    EEPIC_endline();
    fputs("\\end{picture}\n", gpoutfile);
}


static void EEPIC_linetype(linetype)
int linetype;
{
    EEPIC_endline();

    if (linetype >= 5 - 2)
        linetype %= (5 - 2);

    EEPIC_type = linetype;
}



static void EEPIC_move(x, y)
unsigned int x, y;
{
    EEPIC_endline();

    EEPIC_posx = x;
    EEPIC_posy = y;
}


static void EEPIC_point(x, y, number)
unsigned int x, y;
int number;
{
    EEPIC_move(x, y);



    fprintf(gpoutfile, "\\put(%d,%d){%s}\n", x, y,
            (number < 0 ? "\\rule{.1pt}{.1pt}"
             : EEPIC_points[number % 12]));
}


static void EEPIC_vector(ux, uy)
unsigned int ux, uy;
{
    if (!EEPIC_inline) {
        EEPIC_inline = 1;


        fprintf(gpoutfile, "%s(%u,%u)",
                EEPIC_lines[EEPIC_type + 2],
                EEPIC_posx, EEPIC_posy);
        EEPIC_linecount = 1;
    } else {




        if (EEPIC_linecount++ >= 50) {
            fprintf(gpoutfile, "\n%s(%u,%u)",
                    EEPIC_lines[EEPIC_type + 2],
                    EEPIC_posx, EEPIC_posy);
            EEPIC_linecount = 1;
        }
    }
    fprintf(gpoutfile, "(%u,%u)", ux, uy);
    EEPIC_posx = ux;
    EEPIC_posy = uy;
}

void EEPIC_endline()
{
    if (EEPIC_inline) {
        _IO_putc ('\n', gpoutfile);
        EEPIC_inline = 0;
    }
}


static void EEPIC_arrow(sx, sy, ex, ey, head)
unsigned int sx, sy, ex, ey;
TBOOLEAN head;
{
    best_latex_arrow(sx, sy, ex, ey, 2, head);

    EEPIC_posx = ex;
    EEPIC_posy = ey;
}


static void EEPIC_put_text(x, y, str)
unsigned int x, y;
char str[];
{
    EEPIC_endline();

    fprintf(gpoutfile, "\\put(%d,%d)", x, y);
    if ((str[0] == '{') || (str[0] == '[')) {
        fprintf(gpoutfile, "{\\makebox(0,0)%s}\n", str);
    } else
        switch (eepic_angle) {
        case 0:{
                switch (eepic_justify) {
                case LEFT:{
                        fprintf(gpoutfile,
                                "{\\makebox(0,0)[l]{%s}}\n", str);
                        break;
                    }
                case CENTRE:{
                        fprintf(gpoutfile,
                                "{\\makebox(0,0){%s}}\n", str);
                        break;
                    }
                case RIGHT:{
                        fprintf(gpoutfile,
                                "{\\makebox(0,0)[r]{%s}}\n", str);
                        break;
                    }
                }
                break;
            }
        case 1:{
                switch (eepic_justify) {
                case LEFT:{
                        fprintf(gpoutfile,
                                "{\\makebox(0,0)[lb]{\\shortstack{%s}}}\n", str);
                        break;
                    }
                case CENTRE:{
                        fprintf(gpoutfile,
                                "{\\makebox(0,0)[l]{\\shortstack{%s}}}\n", str);
                        break;
                    }
                case RIGHT:{
                        fprintf(gpoutfile,
                                "{\\makebox(0,0)[lt]{\\shortstack{%s}}}\n", str);
                        break;
                    }
                }
                break;
            }
        }
}



static int EEPIC_justify_text(mode)
enum JUSTIFY mode;
{
    eepic_justify = mode;
    return (1);
}

static int EEPIC_text_angle(ang)
int ang;
{



    eepic_angle = ang;
    return (1);
}

static void EEPIC_reset()
{
    EEPIC_endline();
    EEPIC_posx = EEPIC_posy = 0;
}
# 379 "term.h" 2


# 1 "term/tpic.trm" 1
# 82 "term/tpic.trm"
# 1 "term/driver.h" 1
# 83 "term/tpic.trm" 2






static void TPIC_options (void);
static void TPIC_init (void);
static void TPIC_reset (void);
static void TPIC_text (void);
static void TPIC_graphics (void);
static void TPIC_move (unsigned int x, unsigned int y);
static void TPIC_vector (unsigned int ux, unsigned int uy);
static void TPIC_linetype (int linetype);
static void TPIC_put_text (unsigned int x, unsigned int y, char *str);
static int TPIC_text_angle (int ang);
static int TPIC_justify_text (enum JUSTIFY mode);
static void TPIC_point (unsigned int x, unsigned int y, int number);
static void TPIC_arrow (unsigned int sx, unsigned int sy, unsigned int ex, unsigned int ey, TBOOLEAN head);
# 118 "term/tpic.trm"
static int tpic_pointsize = 40;
static int tpic_linewidth = 6;
static double tpic_interval = 0.1;



void best_latex_arrow (int sx, int sy, int ex, int ey, int who, TBOOLEAN head);


static void tpic_startline (void);
static void tpic_endline (void);
static void tpic_pushpath (unsigned int x, unsigned int y);
static void tpic_scanpath (void);
void tpic_diamond (int size);
void tpic_plus (int size);
void tpic_box (int size);
void tpic_times (int size);
void tpic_triangle (int size);
void tpic_star (int size);
void tpic_hexagon (int size);
void tpic_circle (int size);
void tpic_doublecircle (int size);
void tpic_vercircle (int size);
void tpic_horcircle (int size);
void tpic_pluscircle (int size);
void tpic_timescircle (int size);
void tpic_starcircle (int size);
void tpic_dotcircle (int size);
void tpic_diamondcircle (int size);
void tpic_boxcircle (int size);
void tpic_trianglecircle (int size);
void tpic_hexagoncircle (int size);
void tpic_plustimescircle (int size);
void tpic_abspath (unsigned int x, unsigned int y);
void tpic_path (int x, int y);
void tpic_flush (void);
void tpic_arc (int radius);
void tpic_shade (double grayscale);
void tpic_pen (int thickness);
void tpic_dottedflush (double interval);
void tpic_dashedflush (double interval);

typedef enum {
    tpic_none, tpic_white, tpic_gray, tpic_black
} tpic_shadestyle;
typedef enum {
    tpic_nosize, tpic_small, tpic_medium, tpic_large
} tpic_size;
typedef void (*tpic_function) (int size);

typedef struct {
    tpic_shadestyle shadestyle;
    tpic_size size;
    tpic_function function;
} tpic_point_info;


static tpic_point_info tpic_point[] =
{
    {tpic_white, tpic_medium, tpic_diamond},
    {tpic_none, tpic_medium, tpic_plus},
    {tpic_white, tpic_medium, tpic_box},
    {tpic_none, tpic_medium, tpic_times},
    {tpic_white, tpic_medium, tpic_triangle},
    {tpic_none, tpic_medium, tpic_star},
    {tpic_white, tpic_small, tpic_circle},
    {tpic_white, tpic_medium, tpic_circle},
    {tpic_white, tpic_large, tpic_circle},
    {tpic_black, tpic_small, tpic_circle},
    {tpic_black, tpic_medium, tpic_circle},
    {tpic_black, tpic_large, tpic_circle},
    {tpic_black, tpic_medium, tpic_diamond},
    {tpic_black, tpic_medium, tpic_box},
    {tpic_black, tpic_medium, tpic_triangle},
    {tpic_white, tpic_medium, tpic_hexagon},
    {tpic_black, tpic_medium, tpic_hexagon},
    {tpic_white, tpic_medium, tpic_doublecircle},
    {tpic_white, tpic_medium, tpic_vercircle},
    {tpic_white, tpic_medium, tpic_horcircle},
    {tpic_white, tpic_medium, tpic_pluscircle},
    {tpic_white, tpic_medium, tpic_timescircle},
    {tpic_white, tpic_medium, tpic_starcircle},
    {tpic_black, tpic_medium, tpic_doublecircle},
    {tpic_white, tpic_medium, tpic_dotcircle},
    {tpic_white, tpic_medium, tpic_diamondcircle},
    {tpic_white, tpic_medium, tpic_boxcircle},
    {tpic_white, tpic_medium, tpic_trianglecircle},
    {tpic_white, tpic_medium, tpic_hexagoncircle},
    {tpic_white, tpic_medium, tpic_plustimescircle}
};

typedef enum {
    tpic_solid, tpic_dotted, tpic_dashed,
    tpic_dashed_sdot, tpic_dashed_ddot
} tpic_linestyle;
typedef struct {
    tpic_size thickness, interval;
    tpic_linestyle linestyle;
} tpic_line_info;


static tpic_line_info tpic_line[] =
{
    {tpic_medium, tpic_nosize, tpic_solid},
    {tpic_small, tpic_small, tpic_dashed},
    {tpic_small, tpic_nosize, tpic_solid},
    {tpic_medium, tpic_nosize, tpic_solid},
    {tpic_large, tpic_nosize, tpic_solid},
    {tpic_small, tpic_small, tpic_dotted},
    {tpic_medium, tpic_small, tpic_dotted},
    {tpic_large, tpic_small, tpic_dotted},
    {tpic_small, tpic_small, tpic_dashed},
    {tpic_medium, tpic_small, tpic_dashed},
    {tpic_large, tpic_small, tpic_dashed},
    {tpic_small, tpic_small, tpic_dashed_sdot},
    {tpic_medium, tpic_small, tpic_dashed_sdot},
    {tpic_large, tpic_small, tpic_dashed_sdot},
    {tpic_small, tpic_small, tpic_dashed_ddot},
    {tpic_medium, tpic_small, tpic_dashed_ddot},
    {tpic_large, tpic_small, tpic_dashed_ddot},
    {tpic_small, tpic_medium, tpic_dotted},
    {tpic_medium, tpic_medium, tpic_dotted},
    {tpic_large, tpic_medium, tpic_dotted},
    {tpic_small, tpic_medium, tpic_dashed},
    {tpic_medium, tpic_medium, tpic_dashed},
    {tpic_large, tpic_medium, tpic_dashed},
    {tpic_small, tpic_medium, tpic_dashed_sdot},
    {tpic_medium, tpic_medium, tpic_dashed_sdot},
    {tpic_large, tpic_medium, tpic_dashed_sdot},
    {tpic_small, tpic_medium, tpic_dashed_ddot},
    {tpic_medium, tpic_medium, tpic_dashed_ddot},
    {tpic_large, tpic_medium, tpic_dashed_ddot},
    {tpic_small, tpic_large, tpic_dotted},
    {tpic_medium, tpic_large, tpic_dotted},
    {tpic_large, tpic_large, tpic_dotted},
    {tpic_small, tpic_large, tpic_dashed},
    {tpic_medium, tpic_large, tpic_dashed},
    {tpic_large, tpic_large, tpic_dashed},
    {tpic_small, tpic_large, tpic_dashed_sdot},
    {tpic_medium, tpic_large, tpic_dashed_sdot},
    {tpic_large, tpic_large, tpic_dashed_sdot},
    {tpic_small, tpic_large, tpic_dashed_ddot},
    {tpic_medium, tpic_large, tpic_dashed_ddot},
    {tpic_large, tpic_large, tpic_dashed_ddot}
};

static void TPIC_options()
{
    struct value a;
    int ptsize, linewidth;
    double interval;

    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        ptsize = (int) real(const_express(&a));
        if (ptsize > 0)
            tpic_pointsize = ptsize;
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        linewidth = (int) real(const_express(&a));
        if (linewidth > 0)
            tpic_linewidth = linewidth;
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        interval = (double) real(const_express(&a));
        if (interval > 0)
            tpic_interval = interval;
    }
    sprintf(term_options, "%d %d %f", tpic_pointsize, tpic_linewidth,
            tpic_interval);
}

static unsigned int tpic_posx;
static unsigned int tpic_posy;
static int tpic_point_types;
static int tpic_numlines;

static void TPIC_init()
{
    static char tpic1[] = "%% GNUPLOT: LaTeX picture using tpic \\specials\n%%          with %d point types and %d line types\n%% Options: pointsize = %d, linewidth = %d, interval = %f\n%% To change above options, say:\n%% set terminal tpic pointsize_value linewidth_value interval_value\n%% (pointsize and linewidth - integers in milli-inches.\n%%  interval - a float in inches.  If zero is specified, \n%%  the default value is chosen.)\n\\setlength{\\unitlength}{%fin}%%\n";
# 306 "term/tpic.trm"
    tpic_point_types = sizeof(tpic_point) / sizeof(tpic_point[0]);
    tpic_numlines = sizeof(tpic_line) / sizeof(tpic_line[0]);

    tpic_posx = tpic_posy = 0;
    TPIC_linetype(-1);
    fprintf(gpoutfile, tpic1,
            tpic_point_types, tpic_numlines - 2,
            tpic_pointsize, tpic_linewidth, tpic_interval,
            0.001);
}

static void TPIC_reset()
{
    tpic_endline();
    tpic_posx = tpic_posy = 0;
}

static void TPIC_text()
{
    tpic_endline();
    fputs("\\end{picture}\n", gpoutfile);
}

static void TPIC_graphics()
{
    register struct TERMENTRY *t = term;
    int left, right, top, bottom;
    static char begin[] = "%s\\begin{picture}(%d,%d)(%d,%d)%% %s\n";

    fprintf(gpoutfile, begin, "", t->xmax, t->ymax, 0, 0, "");


    left = (unsigned int) ( 5.3 / (72.27 * 0.001)) * 12;
    right = (unsigned int) ( 5.3 / (72.27 * 0.001)) * 2 + (unsigned int) ( 5.0 / (72.27 * 0.001));
    bottom = (unsigned int) (11.0 / (72.27 * 0.001)) * 7 / 2 + 1;
    top = (unsigned int) (11.0 / (72.27 * 0.001)) * 5 / 2 - 1;
    fprintf(gpoutfile, begin, "%% ", t->xmax - left, t->ymax, left, 0,
            "trim left margin");
    fprintf(gpoutfile, begin, "%% ", t->xmax - right, t->ymax, 0, 0,
            "trim right margin");
    fprintf(gpoutfile, begin, "%% ", t->xmax - left - right, t->ymax, left, 0,
            "trim left & right margins");
    fprintf(gpoutfile, begin, "%% ", t->xmax, t->ymax - top, 0, 0,
            "trim top margin");
    fprintf(gpoutfile, begin, "%% ", t->xmax, t->ymax - bottom, 0, bottom,
            "trim bottom margin");
    fprintf(gpoutfile, begin, "%% ", t->xmax, t->ymax - top - bottom, 0, bottom,
            "trim top & bottom margins");

    fputs("\\footnotesize%\n", gpoutfile);
}

static void TPIC_move(x, y)
unsigned int x;
unsigned int y;
{
    tpic_endline();
    tpic_posx = x;
    tpic_posy = y;
}


static TBOOLEAN tpic_inline = 0;
static int tpic_linecount = 0;

static void TPIC_vector(ux, uy)
unsigned int ux;
unsigned int uy;
{
    if (!tpic_inline) {
        tpic_startline();
    } else if (tpic_linecount >= 100) {


        tpic_endline();
        tpic_startline();
    }
    tpic_pushpath(ux, uy);
    tpic_posx = ux;
    tpic_posy = uy;
}

static int tpic_linetype;

static void tpic_startline()
{
    int thickness = 1;

    tpic_inline = 1;
    switch (tpic_line[tpic_linetype + 2].thickness) {
    case tpic_small:
        thickness = tpic_linewidth;
        break;
    case tpic_medium:
        thickness = (int) (tpic_linewidth * 3);
        break;
    case tpic_large:
        thickness = (int) (tpic_linewidth * 5);
        break;
    default:
        break;
    }
    tpic_pen(thickness);
    tpic_linecount = 0;
    tpic_pushpath(tpic_posx, tpic_posy);
    return;
}

static void tpic_endline()
{
    double interval = 1;

    if (tpic_inline) {
        tpic_scanpath();
        switch (tpic_line[tpic_linetype + 2].interval) {
        case tpic_small:
            interval = tpic_interval;
            break;
        case tpic_medium:
            interval = tpic_interval * 2;
            break;
        case tpic_large:
            interval = tpic_interval * 3;
            break;
        case tpic_nosize:
            break;
        }
        switch (tpic_line[tpic_linetype + 2].linestyle) {
        case tpic_solid:
            tpic_flush();
            break;
        case tpic_dotted:
            tpic_dottedflush(interval);
            break;
        case tpic_dashed:
            tpic_dashedflush(interval);
            break;
        case tpic_dashed_sdot:
            tpic_dashedflush(interval);
            tpic_scanpath();
            tpic_dottedflush(interval / 2);
            break;
        case tpic_dashed_ddot:
            tpic_dashedflush(interval);
            tpic_scanpath();
            tpic_dottedflush(interval / 3);
            break;
        }
        tpic_inline = 0;
    }
    return;
}


static unsigned int pathpoint[100][2];

static void tpic_pushpath(x, y)
unsigned int x;
unsigned int y;
{
    if (tpic_linecount < 100) {
        pathpoint[tpic_linecount][0] = x;
        pathpoint[tpic_linecount][1] = y;
        tpic_linecount++;
    }
    return;
}

static void tpic_scanpath()
{
    int i;

    for (i = 0; i < tpic_linecount; i++)
        tpic_abspath(pathpoint[i][0], pathpoint[i][1]);
    return;
}

static void TPIC_linetype(linetype)
int linetype;
{
    tpic_endline();
    if (linetype >= tpic_numlines - 2)
        linetype %= (tpic_numlines - 2);
    tpic_linetype = linetype;
}

static int tpic_angle = 0;
static enum JUSTIFY tpic_justify = LEFT;

static void TPIC_put_text(x, y, str)
unsigned int x;
unsigned int y;
char *str;
{
    char *justify = ((void *)0);

    tpic_endline();
    fprintf(gpoutfile, "\\put(%d,%d)", x, y);

    if ((str[0] == '{') || (str[0] == '[')) {
        fprintf(gpoutfile, "{\\makebox(0,0)%s}\n", str);
    } else
        switch (tpic_angle) {
        case 0:
            switch (tpic_justify) {
            case LEFT:
                justify = "[l]";
                break;
            case CENTRE:
                justify = "";
                break;
            case RIGHT:
                justify = "[r]";
                break;
            }
            fprintf(gpoutfile, "{\\makebox(0,0)%s{%s}}\n", justify, str);
            break;
        case 1:


            switch (tpic_justify) {
            case LEFT:
                justify = "[lb]";
                break;
            case CENTRE:
                justify = "[l]";
                break;
            case RIGHT:
                justify = "[lt]";
                break;
            }
            fprintf(gpoutfile, "{\\makebox(0,0)%s{\\shortstack{%s}}}\n",
                    justify, str);
            break;
        }
}

static int TPIC_text_angle(ang)
int ang;
{
    tpic_angle = ang;
    return (1);
}

static int TPIC_justify_text(mode)
enum JUSTIFY mode;
{
    tpic_justify = mode;
    return (1);
}

static void TPIC_point(x, y, number)
unsigned int x;
unsigned int y;
int number;
{
    int size = 0;

    TPIC_move(x, y);




    fprintf(gpoutfile, "\\put(%d,%d){", x, y);

    if (number < 0) {
        fprintf(gpoutfile, "\\rule{.1pt}{.1pt}");
    } else {
        number %= tpic_point_types;
        switch (tpic_point[number].shadestyle) {
        case tpic_white:
            tpic_pen(tpic_linewidth);
            tpic_shade(0.0);
            break;
        case tpic_gray:
            tpic_pen(tpic_linewidth);
            tpic_shade(0.5);
            break;
        case tpic_black:
            tpic_pen(tpic_linewidth);
            tpic_shade(1.0);
            break;
        case tpic_none:
            tpic_pen(tpic_linewidth * 3);
            break;
        }
        switch (tpic_point[number].size) {
        case tpic_small:
            size = tpic_pointsize;
            break;
        case tpic_medium:
            size = (int) (tpic_pointsize * 1.4142);
            break;
        case tpic_large:
            size = (int) (tpic_pointsize * 2.0);
            break;
        default:
            break;
        }
        (tpic_point[number].function) (size);
    }

    fputs("}%%\n", gpoutfile);
}

static void TPIC_arrow(sx, sy, ex, ey, head)
unsigned int sx;
unsigned int sy;
unsigned int ex;
unsigned int ey;
TBOOLEAN head;
{
    best_latex_arrow(sx, sy, ex, ey, 1, head);
    tpic_posx = ex;
    tpic_posy = ey;
}



void tpic_diamond(size)
int size;
{
    size = (int) (size * 1.4142);

    tpic_path(0, size);
    tpic_path(-size, 0);
    tpic_path(0, -size);
    tpic_path(size, 0);
    tpic_path(0, size);
    tpic_flush();
    return;
}

void tpic_plus(size)
int size;
{
    tpic_path(0, size);
    tpic_path(0, -size);
    tpic_flush();
    tpic_path(size, 0);
    tpic_path(-size, 0);
    tpic_flush();
    return;
}

void tpic_box(size)
int size;
{
    tpic_path(size, size);
    tpic_path(-size, size);
    tpic_path(-size, -size);
    tpic_path(size, -size);
    tpic_path(size, size);
    tpic_flush();
    return;
}

void tpic_times(size)
int size;
{
    size = (int) (size / 1.4142);

    tpic_path(size, size);
    tpic_path(-size, -size);
    tpic_flush();
    tpic_path(size, -size);
    tpic_path(-size, size);
    tpic_flush();
    return;
}

void tpic_triangle(size)
int size;
{
    int x;

    size = (int) (size / 1.6119);
    x = (int) (size * 1.7321);

    tpic_path(0, -size * 2);
    tpic_path(-x, size);
    tpic_path(x, size);
    tpic_path(0, -size * 2);
    tpic_flush();
    return;
}

void tpic_star(size)
int size;
{
    int x;

    size = (int) (size / 2);
    x = (int) (size * 1.7321);

    tpic_path(0, size * 2);
    tpic_path(0, -size * 2);
    tpic_flush();
    tpic_path(x, size);
    tpic_path(-x, -size);
    tpic_flush();
    tpic_path(x, -size);
    tpic_path(-x, size);
    tpic_flush();
    return;
}

void tpic_hexagon(size)
int size;
{
    int x;

    size = (int) (size / 2);
    x = (int) (size * 1.7321);

    tpic_path(0, size * 2);
    tpic_path(-x, size);
    tpic_path(-x, -size);
    tpic_path(0, -size * 2);
    tpic_path(x, -size);
    tpic_path(x, size);
    tpic_path(0, size * 2);
    tpic_flush();
    return;
}

void tpic_circle(size)
int size;
{
    tpic_arc(size);
    return;
}

void tpic_doublecircle(size)
int size;
{
    tpic_arc(size);
    tpic_shade(0.0);
    tpic_arc(size / 2);
    return;
}

void tpic_vercircle(size)
int size;
{
    tpic_arc(size);
    tpic_path(0, size);
    tpic_path(0, -size);
    tpic_flush();
    return;
}

void tpic_horcircle(size)
int size;
{
    tpic_arc(size);
    tpic_path(size, 0);
    tpic_path(-size, 0);
    tpic_flush();
    return;
}

void tpic_pluscircle(size)
int size;
{
    tpic_arc(size);
    tpic_plus(size);
    return;
}

void tpic_timescircle(size)
int size;
{
    tpic_arc(size);
    tpic_times(size);
    return;
}

void tpic_starcircle(size)
int size;
{
    tpic_arc(size);
    tpic_star(size);
    return;
}

void tpic_dotcircle(size)
int size;
{
    tpic_arc(size);
    tpic_shade(1.0);
    tpic_arc(size / 2);
    return;
}

void tpic_diamondcircle(size)
int size;
{
    tpic_arc(size);
    tpic_shade(1.0);
    tpic_diamond((int) (size / 1.5));
    return;
}

void tpic_boxcircle(size)
int size;
{
    tpic_arc(size);
    tpic_shade(1.0);
    tpic_box((int) (size / 1.5));
    return;
}

void tpic_trianglecircle(size)
int size;
{
    tpic_arc(size);
    tpic_shade(1.0);
    tpic_triangle((int) (size / 1.5));
    return;
}

void tpic_hexagoncircle(size)
int size;
{
    tpic_arc(size);
    tpic_shade(1.0);
    tpic_hexagon((int) (size / 1.2));
    return;
}

void tpic_plustimescircle(size)
int size;
{
    tpic_arc(size);
    tpic_plus(size);
    tpic_times(size);
    return;
}



void tpic_abspath(x, y)
unsigned int x;
unsigned int y;
{
    fprintf(gpoutfile, "\\put(%u,%u){", x, y);
    tpic_path(0, 0);
    fputs("}%\n", gpoutfile);
    return;
}



void tpic_path(x, y)
int x;
int y;
{
    fprintf(gpoutfile, "\\special{pa %d %d}", x, y);
    return;
}

void tpic_flush()
{
    fputs("\\special{fp}%\n", gpoutfile);
    return;
}

void tpic_arc(radius)
int radius;
{
    fprintf(gpoutfile, "\\special{ar 0 0 %d %d 0 7}", radius, radius);
    return;
}

void tpic_shade(grayscale)
double grayscale;
{
    fprintf(gpoutfile, "\\special{sh %f}", grayscale);
    return;
}

void tpic_pen(thickness)
int thickness;
{
    fprintf(gpoutfile, "\\special{pn %d}", thickness);
    return;
}

void tpic_dottedflush(interval)
double interval;
{
    fprintf(gpoutfile, "\\special{dt %f}%%\n", interval);
    return;
}

void tpic_dashedflush(interval)
double interval;
{
    fprintf(gpoutfile, "\\special{da %f}%%\n", interval);
    return;
}
# 382 "term.h" 2


# 1 "term/pstricks.trm" 1
# 80 "term/pstricks.trm"
# 1 "term/driver.h" 1
# 81 "term/pstricks.trm" 2






static void PSTRICKS_options (void);
static void PSTRICKS_init (void);
static void PSTRICKS_graphics (void);
static void PSTRICKS_text (void);
static void PSTRICKS_linetype (int linetype);
static void PSTRICKS_move (unsigned int x, unsigned int y);
static void PSTRICKS_point (unsigned int x, unsigned int y, int number);
static void PSTRICKS_vector (unsigned int ux, unsigned int uy);
static void PSTRICKS_arrow (unsigned int sx, unsigned int sy, unsigned int ex, unsigned int ey, TBOOLEAN head);
static void PSTRICKS_put_text (unsigned int x, unsigned int y, char str[]);
static int PSTRICKS_justify_text (enum JUSTIFY mode);
static int PSTRICKS_text_angle (int ang);
static void PSTRICKS_reset (void);
# 112 "term/pstricks.trm"
static void PSTRICKS_endline (void);
static char *PSTRICKS_hack_text (char s[]);

static float PSTRICKS_xscale = 1.0;
static float PSTRICKS_yscale = 1.0;
static float PSTRICKS_posx;
static float PSTRICKS_posy;
enum JUSTIFY PSTRICKS_justify = LEFT;
static int PSTRICKS_angle = 0;





static char *PSTRICKS_points[] =
{
    "\\PST@Diamond",
    "\\PST@Plus",
    "\\PST@Square",
    "\\PST@Cross",
    "\\PST@Circle",
    "\\PST@Triangle",
    "\\PST@Pentagon",
    "\\PST@Filldiamond",
    "\\PST@Fillsquare",
    "\\PST@Filltriangle",
    "\\PST@Fillcircle",
    "\\PST@Fillpentagon"
};



static char *PSTRICKS_lines[] =
{
    "\\PST@Border",
    "\\PST@Axes",
    "\\PST@Solid",
    "\\PST@Dashed",
    "\\PST@Dotted",
    "\\PST@LongDash"
};


static int PSTRICKS_type;


static TBOOLEAN PSTRICKS_inline = 0;


static void PSTRICKS_endline (void);


static int PSTRICKS_linecount = 0;
# 173 "term/pstricks.trm"
static int PST_hack_text = 1;
static int PST_unit_plot = 0;

static void PSTRICKS_options()
{
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "no$hacktext")) {
            PST_hack_text = 0;
            c_token++;
        } else if (almost_equals(c_token, "u$nit")) {
            PST_unit_plot = 1;
            c_token++;
        }
    }
}

static void PSTRICKS_init()
{
    PSTRICKS_posx = PSTRICKS_posy = 0;
    PSTRICKS_linetype(-1);
    fputs("% GNUPLOT: LaTeX picture using PSTRICKS macros\n", gpoutfile);
}


static void PSTRICKS_graphics()
{
    fputs("% Define new PST objects, if not already defined\n\\ifx\\PSTloaded\\undefined\n\\def\\PSTloaded{t}\n\\psset{arrowsize=.01 3.2 1.4 .3}\n\\psset{dotsize=.01}\n\\catcode`@=11\n\n", gpoutfile);
# 208 "term/pstricks.trm"
    fputs("\\newpsobject{PST@Border}{psline}{linewidth=.0015,linestyle=solid}\n\\newpsobject{PST@Axes}{psline}{linewidth=.0015,linestyle=dotted,dotsep=.004}\n\\newpsobject{PST@Solid}{psline}{linewidth=.0015,linestyle=solid}\n\\newpsobject{PST@Dashed}{psline}{linewidth=.0015,linestyle=dashed,dash=.01 .01}\n\\newpsobject{PST@Dotted}{psline}{linewidth=.0025,linestyle=dotted,dotsep=.008}\n\\newpsobject{PST@LongDash}{psline}{linewidth=.0015,linestyle=dashed,dash=.02 .01}\n", gpoutfile);
# 226 "term/pstricks.trm"
    fputs("\\newpsobject{PST@Diamond}{psdots}{linewidth=.001,linestyle=solid,dotstyle=square,dotangle=45}\n\\newpsobject{PST@Filldiamond}{psdots}{linewidth=.001,linestyle=solid,dotstyle=square*,dotangle=45}\n\\newpsobject{PST@Cross}{psdots}{linewidth=.001,linestyle=solid,dotstyle=+,dotangle=45}\n", gpoutfile);





    fputs("\\newpsobject{PST@Plus}{psdots}{linewidth=.001,linestyle=solid,dotstyle=+}\n\\newpsobject{PST@Square}{psdots}{linewidth=.001,linestyle=solid,dotstyle=square}\n\\newpsobject{PST@Circle}{psdots}{linewidth=.001,linestyle=solid,dotstyle=o}\n\\newpsobject{PST@Triangle}{psdots}{linewidth=.001,linestyle=solid,dotstyle=triangle}\n\\newpsobject{PST@Pentagon}{psdots}{linewidth=.001,linestyle=solid,dotstyle=pentagon}\n\\newpsobject{PST@Fillsquare}{psdots}{linewidth=.001,linestyle=solid,dotstyle=square*}\n\\newpsobject{PST@Fillcircle}{psdots}{linewidth=.001,linestyle=solid,dotstyle=*}\n\\newpsobject{PST@Filltriangle}{psdots}{linewidth=.001,linestyle=solid,dotstyle=triangle*}\n\\newpsobject{PST@Fillpentagon}{psdots}{linewidth=.001,linestyle=solid,dotstyle=pentagon*}\n", gpoutfile);
# 244 "term/pstricks.trm"
    fputs("\\newpsobject{PST@Arrow}{psline}{linewidth=.001,linestyle=solid}\n\\catcode`@=12\n\n\\fi\n", gpoutfile);





    if (!PST_unit_plot) {
        fprintf(gpoutfile, "\\psset{unit=%fin,xunit=%fin,yunit=%fin}\n",
                5.0 * PSTRICKS_xscale,
                5.0 * PSTRICKS_xscale,
                3.0 * PSTRICKS_yscale);
    }
    fputs("\\pspicture(0,0)(1,1)\n\\ifx\\nofigs\\undefined\n\\catcode`@=11\n\n", gpoutfile);



}


static void PSTRICKS_text()
{
    PSTRICKS_endline();
    fputs("\\catcode`@=12\n\\fi\n\\endpspicture\n", gpoutfile);



}


static void PSTRICKS_linetype(linetype)
int linetype;
{
    PSTRICKS_endline();

    if (linetype >= 6 - 2)
        linetype %= (6 - 2);

    PSTRICKS_type = linetype;
}



static void PSTRICKS_move(x, y)
unsigned int x;
unsigned int y;
{
    PSTRICKS_endline();

    PSTRICKS_posx = x / 10000.0;
    PSTRICKS_posy = y / 10000.0;
}


static void PSTRICKS_point(x, y, number)
unsigned x;
unsigned y;
int number;
{
    PSTRICKS_move(x, y);




    if (number < 0) {
        fprintf(gpoutfile, "\\qdisk(%.4f,%.4f){%.4f}\n",
                x / 10000.0,
                y / 10000.0,
                0.00025);
    } else {
        fprintf(gpoutfile, "%s(%.4f,%.4f)\n",
                PSTRICKS_points[number % 12],
                x / 10000.0,
                y / 10000.0);
    }
}


static void PSTRICKS_vector(ux, uy)
unsigned ux;
unsigned uy;
{
    if (!PSTRICKS_inline) {
        PSTRICKS_inline = 1;


        fprintf(gpoutfile, "%s(%.4f,%.4f)\n", PSTRICKS_lines[PSTRICKS_type + 2],
                PSTRICKS_posx, PSTRICKS_posy);
        PSTRICKS_linecount = 1;
    } else {





        if (PSTRICKS_linecount++ >= 100) {

            fprintf(gpoutfile, "%s(%.4f,%.4f)\n", PSTRICKS_lines[PSTRICKS_type + 2],
                    PSTRICKS_posx, PSTRICKS_posy);
            PSTRICKS_linecount = 1;
        }
    }
    PSTRICKS_posx = ux / 10000.0;
    PSTRICKS_posy = uy / 10000.0;
    fprintf(gpoutfile, "(%.4f,%.4f)\n", PSTRICKS_posx, PSTRICKS_posy);
}

static void PSTRICKS_endline()
{
    if (PSTRICKS_inline) {
        _IO_putc ('\n', gpoutfile);
        PSTRICKS_inline = 0;
    }
}


static void PSTRICKS_arrow(sx, sy, ex, ey, head)
unsigned int sx;
unsigned int sy;
unsigned int ex;
unsigned int ey;
TBOOLEAN head;
{
    fprintf(gpoutfile, "\\PST@Arrow%s(%.4f,%.4f)(%.4f,%.4f)\n",
            head ? "{->}" : "",
            sx / 10000.0,
            sy / 10000.0,
            ex / 10000.0,
            ey / 10000.0);

    PSTRICKS_posx = ex / 10000.0;
    PSTRICKS_posy = ey / 10000.0;
}
# 393 "term/pstricks.trm"
static char *PSTRICKS_hack_text(s)
char s[];
{
    double value;
    char *ends;
    static char hack[8192];





    value = strtod(s, &ends);

    if (s == ends) {




        (__extension__ (__builtin_constant_p (s) ? (((size_t)(const void *)((s) + 1) - (size_t)(const void *)(s) == 1) && strlen (s) + 1 <= 8 ? __strcpy_small (hack, __extension__ (((__const unsigned char *) (__const char *) (s))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) (s))[0]), __extension__ (((__const unsigned char *) (__const char *) (s))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) (s))[4]), __extension__ (((((__const unsigned char *) (__const char *) (s))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) (s))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) (s))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) (s))[0]), __extension__ (((((__const unsigned char *) (__const char *) (s))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) (s))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) (s))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) (s))[4]), strlen (s) + 1) : (char *) memcpy (!
hack, s, strlen (s) + 1)) : strcpy (hack, s)));
    } else {
        char *ptr;






        safe_strncpy(hack, s, ends - s + 1);


        ptr = (__extension__ (__builtin_constant_p ('e') && ('e') == '\0' ? (char *) __rawmemchr (hack, 'e') : strchr (hack, 'e')));
        if (ptr == ((void *)0)) {
            ptr = (__extension__ (__builtin_constant_p ('E') && ('E') == '\0' ? (char *) __rawmemchr (hack, 'E') : strchr (hack, 'E')));
        }
        if (ptr != ((void *)0)) {




            double man_val;
            int expo_val;

            *ptr = ('\0');

            man_val = atof(hack);
            expo_val = atoi(ptr + 1);

            if (man_val == 0) {
                sprintf(hack, "0");
            } else if (man_val == 1) {
                sprintf(hack, "$10^{%d}$", expo_val);
            } else if (man_val == (int) man_val) {
                if (expo_val == 1) {
                    sprintf(hack, "$%d$", (int) man_val);
                } else {
                    sprintf(hack, "$%d \\times 10^{%d}$", (int) man_val, expo_val);
                }
            } else {
                if (expo_val == 1) {
                    sprintf(hack, "$%f$", man_val);
                } else {
                    sprintf(hack, "$%f \\times 10^{%d}$", man_val, expo_val);
                }
            }
        }




        strcat(hack, ends);
    }

    return hack;
}

static void PSTRICKS_put_text(x, y, str)
unsigned int x;
unsigned int y;
char str[];
{
    PSTRICKS_endline();



    if (strlen(str) > 0) {
        fputs("\\rput", gpoutfile);



        switch (PSTRICKS_justify) {
        case LEFT:
            fputs("[l]", gpoutfile);
            break;
        case CENTRE:
            break;
        case RIGHT:
            fputs("[r]", gpoutfile);
            break;
        }



        switch (PSTRICKS_angle) {
        case 0:
            break;
        case 1:
            fputs("{L}", gpoutfile);
            break;
        }



        fprintf(gpoutfile, "(%.4f,%.4f)",
                x / 10000.0,
                y / 10000.0);
        if (PST_hack_text) {
            char *hack;



            hack = PSTRICKS_hack_text(str);
            fprintf(gpoutfile, "{%s}\n", hack);
        } else {
            fprintf(gpoutfile, "{%s}\n", str);
        }
    }
}



static int PSTRICKS_justify_text(mode)
enum JUSTIFY mode;
{
    PSTRICKS_justify = mode;
    return (1);
}

static int PSTRICKS_text_angle(ang)
int ang;
{
    PSTRICKS_angle = ang;
    return (1);
}

static void PSTRICKS_reset()
{
    PSTRICKS_endline();
    PSTRICKS_posx = PSTRICKS_posy = 0;
}
# 385 "term.h" 2


# 1 "term/texdraw.trm" 1
# 58 "term/texdraw.trm"
# 1 "term/driver.h" 1
# 59 "term/texdraw.trm" 2






static void TEXDRAW_init (void);
static void TEXDRAW_graphics (void);
static void TEXDRAW_text (void);
static void TEXDRAW_linetype (int linetype);
static void TEXDRAW_move (unsigned int x, unsigned int y);
static void TEXDRAW_point (unsigned int x, unsigned int y, int number);

static void TEXDRAW_vector (unsigned int ux, unsigned int uy);
static void TEXDRAW_arrow (unsigned int sx, unsigned int sy, unsigned int ex, unsigned int ey, TBOOLEAN head);


static void TEXDRAW_put_text (unsigned int x, unsigned int y, char str[]);

static int TEXDRAW_justify_text (enum JUSTIFY mode);
static int TEXDRAW_text_angle (int ang);
static void TEXDRAW_reset (void);
# 102 "term/texdraw.trm"
static void TEXDRAW_endline (void);
static unsigned int TEXDRAW_posx;
static unsigned int TEXDRAW_posy;
enum JUSTIFY TEXDRAW_justify = LEFT;
enum JUSTIFY TEXDRAW_last_justify = LEFT;
static int TEXDRAW_angle = 0;
static float TEXDRAW_scalefactor = 0.2409;
static double TEXDRAW_xscale = 1.0, TEXDRAW_yscale = 1.0;






static char * TEXDRAW_points[] =
{
    "\\rmove(0 4)\\htext{$\\Diamond$}",
    "\\htext{$+$}",
    "\\rmove(0 4)\\htext{$\\Box$}",
    "\\htext{$\\times$}",
    "\\htext{$\\triangle$}",
    "\\htext{$\\star$}",
    "\\lcir r:9",
    "\\lcir r:12",
    "\\lcir r:16",
    "\\fcir f:0.9 r:9",
    "\\fcir f:0.9 r:12",
    "\\fcir f:0.9 r:16"
};



static int TEXDRAW_lines[] =
{
    4,
    3,
    3,
    4,
    6,
};


static int TEXDRAW_last_type = 0;

static int TEXDRAW_type;

static TBOOLEAN TEXDRAW_inline = 0;

static void TEXDRAW_endline (void);

static int TEXDRAW_linecount = 0;



static void TEXDRAW_init()
{
    TEXDRAW_posx = TEXDRAW_posy = 0;
    TEXDRAW_linetype(-1);
    fputs("%% GNUPLOT: LaTeX using TEXDRAW macros\n", gpoutfile);
}

static void TEXDRAW_graphics()
{
    static char tdg1[] = "\\begin{texdraw}\n\\normalsize\n\\ifx\\pathDEFINED\\relax\\else\\let\\pathDEFINED\\relax\n \\def\\QtGfr{\\ifx (\\TGre \\let\\YhetT\\cpath\\else\\let\\YhetT\\relax\\fi\\YhetT}\n \\def\\path (#1 #2){\\move (#1 #2)\\futurelet\\TGre\\QtGfr}\n \\def\\cpath (#1 #2){\\lvec (#1 #2)\\futurelet\\TGre\\QtGfr}\n\\fi\n\\drawdim pt\n\\setunitscale %2.2f\n\\linewd %d\n\\textref h:L v:C\n";
# 177 "term/texdraw.trm"
    fprintf(gpoutfile, tdg1,
            TEXDRAW_scalefactor,
            TEXDRAW_lines[2]);
    TEXDRAW_last_type = 0;
    TEXDRAW_type = 0;
}

static void TEXDRAW_text()
{
    TEXDRAW_endline();
    fputs("\\end{texdraw}\n", gpoutfile);
}

static void TEXDRAW_linetype(linetype)
int linetype;
{
    TEXDRAW_endline();

    if (linetype >= 5 - 2)
        linetype %= (5 - 2);

    TEXDRAW_type = linetype;
}

static void TEXDRAW_move(x, y)
unsigned int x, y;
{
    TEXDRAW_endline();

    TEXDRAW_posx = x;
    TEXDRAW_posy = y;
}

static void TEXDRAW_point(x, y, number)
unsigned int x, y;
int number;
{
    TEXDRAW_move(x, y);



    fprintf(gpoutfile, "\\move (%d %d)\n",
            (int) ((double) x * TEXDRAW_xscale),
            (int) ((double) y * TEXDRAW_yscale));
    if (TEXDRAW_last_justify != CENTRE) {
        fprintf(gpoutfile, "\\textref h:C v:C ");
        TEXDRAW_last_justify = CENTRE;
    }
    fprintf(gpoutfile, "%s\n",
            (number < 0 ?
             "\\htext{$\\cdot$}" :
             TEXDRAW_points[number % 12]));
}

static void TEXDRAW_vector(ux, uy)
unsigned int ux, uy;
{
    if (!TEXDRAW_inline) {
        TEXDRAW_inline = 1;


        if (TEXDRAW_type != TEXDRAW_last_type) {
            if (TEXDRAW_lines[TEXDRAW_type + 2] != TEXDRAW_lines[TEXDRAW_last_type + 2])
                fprintf(gpoutfile, "\\linewd %d\n", TEXDRAW_lines[TEXDRAW_type + 2]);
            TEXDRAW_last_type = TEXDRAW_type;
        }
        fprintf(gpoutfile, "\\path (%d %d)",
                (int) ((double) TEXDRAW_posx * TEXDRAW_xscale),
                (int) ((double) TEXDRAW_posy * TEXDRAW_yscale));
        TEXDRAW_linecount = 1;
    } else {




        if (TEXDRAW_linecount++ >= 5) {
            fputs("\n\\cpath ", gpoutfile);
            TEXDRAW_linecount = 1;
        }
    }
    fprintf(gpoutfile, "(%d %d)",
            (int) ((double) ux * TEXDRAW_xscale),
            (int) ((double) uy * TEXDRAW_yscale));
    TEXDRAW_posx = ux;
    TEXDRAW_posy = uy;
}

static void TEXDRAW_endline()
{
    if (TEXDRAW_inline) {
        _IO_putc ('\n', gpoutfile);
        TEXDRAW_inline = 0;
    }
}

static void TEXDRAW_arrow(sx, sy, ex, ey, head)
unsigned int sx, sy, ex, ey;
TBOOLEAN head;
{
    char text;

    if (head)
        text = 'a';
    else
        text = 'l';
    fprintf(gpoutfile, "\\move (%d %d)\\%cvec (%d %d)",
            (int) ((double) sx * TEXDRAW_xscale),
            (int) ((double) sy * TEXDRAW_yscale),
            text,
            (int) ((double) ex * TEXDRAW_xscale),
            (int) ((double) ey * TEXDRAW_yscale));
    TEXDRAW_posx = ex;
    TEXDRAW_posy = ey;
}

static void TEXDRAW_put_text(x, y, str)
unsigned int x, y;
char str[];
{
    char text;

    TEXDRAW_endline();

    fprintf(gpoutfile, "\\move (%d %d)",
            (int) ((double) x * TEXDRAW_xscale),
            (int) ((double) y * TEXDRAW_yscale));

    if (!TEXDRAW_angle)
        text = 'h';
    else
        text = 'v';

    if (TEXDRAW_last_justify != TEXDRAW_justify) {
        TEXDRAW_last_justify = TEXDRAW_justify;
        if (TEXDRAW_justify == LEFT)
            fputs("\\textref h:L v:C ", gpoutfile);
        else if (TEXDRAW_justify == CENTRE)
            fputs("\\textref h:C v:C ", gpoutfile);
        else if (TEXDRAW_justify == RIGHT)
            fputs("\\textref h:R v:C ", gpoutfile);
    }
    fprintf(gpoutfile, "\\%ctext{%s}\n", text, str);
}


static int TEXDRAW_justify_text(mode)
enum JUSTIFY mode;
{
    TEXDRAW_justify = mode;
    return (1);
}

static int TEXDRAW_text_angle(ang)
int ang;
{
    TEXDRAW_angle = ang;
    return (1);
}

static void TEXDRAW_reset()
{
    TEXDRAW_endline();
    TEXDRAW_posx = TEXDRAW_posy = 0;
}
# 388 "term.h" 2


# 1 "term/metafont.trm" 1
# 70 "term/metafont.trm"
# 1 "term/driver.h" 1
# 71 "term/metafont.trm" 2
# 94 "term/metafont.trm"
static void MF_init (void);
static void MF_graphics (void);
static void MF_text (void);
static int MF_justify_text (enum JUSTIFY mode);
static int MF_text_angle (int ang);
static void MF_linetype (int linetype);
static void MF_move (unsigned int x, unsigned int y);
static void MF_vector (unsigned int x, unsigned int y);
static void MF_arrow (unsigned int sx, unsigned int sy, unsigned int ex, unsigned int ey, TBOOLEAN head);


static void MF_put_text (unsigned int x, unsigned int y, char *str);
static void MF_reset (void);
# 119 "term/metafont.trm"
static double MF_xsize = 5.0;
static double MF_ysize = 3.0;
static int MF_char_code;
static int MF_ang;
static int MF_line_type;
static enum JUSTIFY MF_justify;
static double MF_dist_left;
static int MF_is_solid;
static int MF_picked_up_pen;






static int MF_dash_index;
static unsigned int MF_last_x, MF_last_y;

static struct {
    int solid;
    float thickness;
    int dashlen[4];
} MF_lines[10] =
{
    {
        1, 1.5, { 0, 0, 0, 0 }
    },
    {
        0, 1.0, { (300) / 60, (300) / 50, (300) / 60, (300) / 50 }
    },
    {
        1, 1.5, { 0, 0, 0, 0 }
    },
    {
        0, 1.5, { (300) / 20, (300) / 30, (300) / 20, (300) / 30 }
    },
    {
        0, 1.5, { (300) / 30, (300) / 20, (300) / 30, (300) / 20 }
    },
    {
        0, 1.5, { (300) / 15, (300) / 30, (300) / 60, (300) / 30 }
    },
    {
        0, 1.5, { (300) / 30, (300) / 50, (300) / 30, (300) / 50 }
    },
    {
        0, 1.5, { (300) / 20, (300) / 50, (300) / 60, (300) / 30 }
    },
    {
        0, 1.5, { (300) / 30, (300) / 50, (300) / 30, (300) / 30 }
    },
    {
        0, 1.5, { (300) / 60, (300) / 50, (300) / 60, (300) / 30 }
    }

};



static void MF_init()
{
    MF_char_code = 0;
    MF_ang = 0;

    fputs("if unknown cmbase: input cmbase fi\n\ntracingstats:=1;\npicture r[];\n\ndef openit = openwindow currentwindow\n  from (0,0) to (400,800) at (-50,500) enddef;\n\nmode_setup;\n", gpoutfile);







    fputs("\n%Include next eight lines if you have problems with the mode on your system..\n%proofing:=0;\n%fontmaking:=1;\n%tracingtitles:=0;\n%pixels_per_inch:=300;\n%blacker:=0;\n%fillin:=.2;\n%o_correction:=.6;\n%fix_units;\n", gpoutfile);
# 203 "term/metafont.trm"
    fputs("\ndef put_text(expr ts,xstart,ystart,rot,justification) =\n  begingroup\n    text_width:=0;text_height:=0;\n    for ind:=0 step 1 until length(ts)-1:\n      dec_num:=ASCII substring (ind,ind+1) of ts;\n      if unknown r[dec_num]: dec_num:=32; fi\n      if dec_num=32: \n        text_width:=text_width+wd[65];\n        text_height:=GPMAX(text_height,ht[65]+dp[65]);\n      elseif dec_num>=0: \n        text_width:=text_width+wd[dec_num];\n        text_height:=GPMAX(text_height,ht[dec_num]+dp[dec_num]);\n      fi\n    endfor\n    if rot=90:\n      if justification=1: ynext:=ystart;\n      elseif justification=2: ynext:=round(ystart-text_width/2);\n      else: ynext:=round(ystart-text_width);\n      fi\n      xnext:=xstart+text_height/2;\n    else:\n      if justification=1: xnext:=xstart;\n      elseif justification=2: xnext:=round(xstart-text_width/2);\n      else: xnext:=round(xstart-text_width);\n      fi\n      ynext:=ystart-text_height/2;\n    fi\n    for ind:=0 s!
tep 1 until length(ts)-1:\n      dec_num:=ASCII substring (ind,ind+1) of ts;\n      if unknown r[dec_num]: dec_num:=32; fi\n      if dec_num=32: \n        xnext:=xnext+wd[65]*cosd rot;\n        ynext:=ynext+wd[65]*sind rot;\n      elseif dec_num>=0: \n        currentpicture:=currentpicture+r[dec_num] shifted(xnext,ynext)\n          rotatedaround ((xnext,ynext),rot); \n        xnext:=xnext+wd[dec_num]*cosd rot;\n        ynext:=ynext+wd[dec_num]*sind rot;\n      fi\n    endfor\n  endgroup \nenddef;\n", gpoutfile);
# 247 "term/metafont.trm"
    fputs("\ndef endchar =\n  r[charcode]:=currentpicture;\n  wd[charcode]:=w;ht[charcode]:=h;dp[charcode]:=d;\n  message \"Picture of charcode no.\" & decimal charcode;\n  endgroup;\nenddef;\nlet endchar_ = endchar;\nlet generate = relax;\nlet roman = relax;\n", gpoutfile);
# 258 "term/metafont.trm"
    fputs("input cmr10.mf\nif ligs>1: font_coding_scheme:=\"TeX text\";\n  spanish_shriek=oct\"074\"; spanish_query=oct\"076\";\nelse: font_coding_scheme:=\n  if ligs=0: \"TeX typewriter text\"\n  else: \"TeX text without f-ligatures\" fi;\n  spanish_shriek=oct\"016\"; spanish_query=oct\"017\"; fi\nfont_setup;\ninput romanu.mf %Roman uppercase.\ninput romanl.mf %Roman lowerrcase.\ninput greeku.mf %Greek uppercase.\ninput romand.mf %Numerals.\ninput romanp.mf %Ampersand, question marks, currency sign.\ninput romspl.mf %Lowercase specials (dotless \\i, ligature \\ae, etc.)\ninput romspu.mf %Uppercase specials (\\AE, \\OE, \\O)\ninput punct.mf %Punctuation symbols.\n\nminus=ASCII\"-\"; cmchar \"Minus sign\";\nbeginarithchar(minus); \n  pickup rule.nib;\n  lft x1=hround 1.5u-eps;\n  x2=w-x1; y1=y2=math_axis;\n  draw z1--z2;	 % bar\n  labels(1,2); \nendchar;\n", gpoutfile);
# 284 "term/metafont.trm"
    fputs("\ncmchar \"Period\";\n  numeric dot_diam#; dot_diam#:=if monospace: 5/4 fi\\ dot_size#;\n  define_whole_blacker_pixels(dot_diam);\n  beginchar(\".\",5u#,dot_diam#,0);\n  adjust_fit(0,0); pickup fine.nib;\n  pos1(dot_diam,0); pos2(dot_diam,90);\n  lft x1l=hround(.5w-.5dot_diam); bot y2l=0; z1=z2; dot(1,2);	% dot\n  penlabels(1,2);\nendchar;\n", gpoutfile);
# 295 "term/metafont.trm"
    fputs("\ndef endchar =\n  % Next line should probably be removed if CM base is used\n  l:=0; r:=w;\n  %Include the next two lines if you want to\n  %rotate the picture 90 deg.(Portrait to Landscape)\n  %currentpicture:=currentpicture rotated 90 shifted (h,0);\n  %tmp:=charht; charht:=charwd; charwd:=tmp;\n  scantokens extra_endchar;\n  if proofing>0: makebox(proofrule); fi\n  chardx:=w;\n  shipit;\n  if displaying>0: makebox(screenrule); showit; fi\n  endgroup \nenddef;\nlet endchar_ = endchar;\nlet generate = input;\nlet roman = roman;\n", gpoutfile);
# 318 "term/metafont.trm"
    fputs("\n\nfont_identifier:=\"GNUPLOT\";\nfont_size 72pt#;\nth#=0.4pt#; define_whole_pixels(th);\n\npath arrowhead;\narrowhead = (-7pt,-2pt){dir30}..(-6pt,0pt)..{dir150}(-7pt,2pt) &\n  (-7pt,2pt)--(0pt,0pt)--(-7pt,-2pt) & cycle;\n", gpoutfile);







}


static void MF_graphics()
{
    register struct TERMENTRY *t = term;

    fprintf(gpoutfile, "\n\nbeginchar(%d,%gin#,%gin#,0);\n",
            MF_char_code, MF_xsize, MF_ysize);
    MF_char_code++;
    fprintf(gpoutfile, "a:=w/%d;b:=h/%d;\n", t->xmax, t->ymax);
    MF_picked_up_pen = 0;
}


static void MF_text()
{
    fputs("endchar;\n", gpoutfile);
}


static int MF_justify_text(mode)
enum JUSTIFY mode;
{
    MF_justify = mode;
    return 1;
}


static int MF_text_angle(ang)
int ang;
{
    if (ang > 0)
        MF_ang = 90;
    else
        MF_ang = 0;
    return 1;
}


static void MF_linetype(linetype)
int linetype;
{
    if (linetype >= 8)
        linetype %= 8;
    linetype += 2;

    if ((MF_lines[linetype].thickness != MF_lines[MF_line_type].thickness) ||
        (!MF_picked_up_pen)) {
        fprintf(gpoutfile, "pickup pencircle scaled %gth;\n",
                MF_lines[linetype].thickness);
        MF_picked_up_pen = 1;
    }
    MF_line_type = linetype;
    MF_dash_index = 0;
    MF_dist_left = MF_lines[MF_line_type].dashlen[MF_dash_index];
    MF_is_solid = MF_lines[MF_line_type].solid;
}


static void MF_move(x, y)
unsigned int x, y;
{
    MF_last_x = x;
    MF_last_y = y;
    MF_dash_index = 0;
    MF_dist_left = MF_lines[MF_line_type].dashlen[MF_dash_index];
}


static void MF_vector(x, y)
unsigned int x, y;
{
    if (MF_is_solid) {
        if (x == MF_last_x && y == MF_last_y)
            fprintf(gpoutfile, "drawdot (%da,%db);\n", x, y);
        else
            fprintf(gpoutfile, "draw (%da,%db)--(%da,%db);\n",
                    MF_last_x, MF_last_y, x, y);
    } else {
        double dist_to_go, delta_x, delta_y, inc_x, inc_y;
        double last_x_d, last_y_d, next_x_d, next_y_d;
        unsigned int next_x, next_y;

        if (x == MF_last_x && y == MF_last_y) {
            if (!(MF_dash_index & 1))
                fprintf(gpoutfile, "drawdot (%da,%db);\n", x, y);
        } else {
            last_x_d = MF_last_x;
            last_y_d = MF_last_y;
            delta_x = x - last_x_d;
            delta_y = y - last_y_d;
            dist_to_go = sqrt(delta_x * delta_x + delta_y * delta_y);
            inc_x = delta_x / dist_to_go;
            inc_y = delta_y / dist_to_go;
            while (MF_dist_left < dist_to_go) {
                next_x_d = last_x_d + inc_x * MF_dist_left;
                next_y_d = last_y_d + inc_y * MF_dist_left;
                next_x = floor(next_x_d + 0.5);
                next_y = floor(next_y_d + 0.5);

                if (!(MF_dash_index & 1))
                    fprintf(gpoutfile, "draw (%da,%db)--(%da,%db);\n",
                            MF_last_x, MF_last_y, next_x, next_y);
                MF_last_x = next_x;
                MF_last_y = next_y;
                last_x_d = next_x_d;
                last_y_d = next_y_d;
                dist_to_go -= MF_dist_left;
                MF_dash_index = (MF_dash_index + 1) & 3;
                MF_dist_left = MF_lines[MF_line_type].dashlen[MF_dash_index];
            }
            delta_x = x - last_x_d;
            delta_y = y - last_y_d;
            MF_dist_left -= sqrt(delta_x * delta_x + delta_y * delta_y);
            if (!(MF_dash_index & 1)) {
                if (x == MF_last_x && y == MF_last_y)
                    fprintf(gpoutfile, "drawdot (%da,%db);\n", x, y);
                else
                    fprintf(gpoutfile, "draw (%da,%db)--(%da,%db);\n",
                            MF_last_x, MF_last_y, x, y);
            }
        }
    }
    MF_last_x = x;
    MF_last_y = y;
}


static void MF_arrow(sx, sy, ex, ey, head)
unsigned int sx, sy, ex, ey;
TBOOLEAN head;
{
    int delta_x, delta_y;

    MF_move(sx, sy);
    MF_vector(ex, ey);
    if (head) {
        delta_x = ex - sx;
        delta_y = ey - sy;
        fprintf(gpoutfile, "fill arrowhead rotated angle(%d,%d) shifted (%da,%db);\n",
                delta_x, delta_y, ex, ey);
    }
}


static void MF_put_text(x, y, str)
unsigned int x, y;
char *str;
{
    int i, j = 0;

    for (i = 0; i < strlen(str); i++)
        if (str[i] == '"')
            str[i] = '\'';
    switch (MF_justify) {
    case LEFT:
        j = 1;
        break;
    case CENTRE:
        j = 2;
        break;
    case RIGHT:
        j = 3;
        break;
    }
    fprintf(gpoutfile, "put_text(\"%s\",%da,%db,%d,%d);\n",
            str, x, y, MF_ang, j);
}


static void MF_reset()
{
    fputs("end.\n", gpoutfile);
}
# 391 "term.h" 2


# 1 "term/metapost.trm" 1
# 57 "term/metapost.trm"
# 1 "term/driver.h" 1
# 58 "term/metapost.trm" 2






static void MP_options (void);
static void MP_init (void);
static void MP_graphics (void);
static void MP_text (void);
static void MP_linetype (int linetype);
static void MP_move (unsigned int x, unsigned int y);
static void MP_point (unsigned int x, unsigned int y, int number);
static void MP_pointsize (double size);
static void MP_linewidth (double width);
static void MP_vector (unsigned int ux, unsigned int uy);
static void MP_arrow (unsigned int sx, unsigned int sy, unsigned int ex, unsigned int ey, TBOOLEAN head);


static void MP_put_text (unsigned int x, unsigned int y, char str[]);
static int MP_justify_text (enum JUSTIFY mode);
static int MP_text_angle (int ang);
static void MP_reset (void);
static int MP_set_font (char *font);
static void MP_boxfill (int style, unsigned int x1, unsigned int y1, unsigned int width, unsigned int height);
# 106 "term/metapost.trm"
static double MP_xsize = 5.0;
static double MP_ysize = 3.0;




static int MP_posx;
static int MP_posy;
static char MP_fontname[50 + 1];
static double MP_fontsize;
static double MP_textmag;
enum JUSTIFY MP_justify = LEFT;
static int MP_ang = 0;
static int MP_char_code = 0;


static int MP_linecount = 1;
# 131 "term/metapost.trm"
static TBOOLEAN MP_inline = 0;

static TBOOLEAN MP_color = 0;
static TBOOLEAN MP_solid = 0;


static TBOOLEAN MP_notex = 0;


static TBOOLEAN MP_fontchanged = 0;


static int MP_oldline = -2;


static double MP_oldptsize = 1.0;
static double MP_oldpen = 1.0;


static void MP_endline (void);




static void
MP_options()
{
    MP_color = 0;
    MP_solid = 0;
    MP_notex = 0;
    MP_fontsize = 10.0;
    MP_textmag = 1.0;
    (__extension__ (__builtin_constant_p ("cmr10") ? (((size_t)(const void *)(("cmr10") + 1) - (size_t)(const void *)("cmr10") == 1) && strlen ("cmr10") + 1 <= 8 ? __strcpy_small (MP_fontname, __extension__ (((__const unsigned char *) (__const char *) ("cmr10"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("cmr10"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("cmr10"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("cmr10"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("cmr10"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("cmr10"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("cmr10"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("cmr10"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("cmr10"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("cmr10"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("cmr10"))[4 + 1]) << !
8 | ((__const unsigned char *) (__const char *) ("cmr10"))[4]), strlen ("cmr10") + 1) : (char *) memcpy (MP_fontname, "cmr10", strlen ("cmr10") + 1)) : strcpy (MP_fontname, "cmr10")));
    (__extension__ (__builtin_constant_p ("") ? (((size_t)(const void *)(("") + 1) - (size_t)(const void *)("") == 1) && strlen ("") + 1 <= 8 ? __strcpy_small (default_font, __extension__ (((__const unsigned char *) (__const char *) (""))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) (""))[0]), __extension__ (((__const unsigned char *) (__const char *) (""))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) (""))[4]), __extension__ (((((__const unsigned char *) (__const char *) (""))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) (""))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) (""))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) (""))[0]), __extension__ (((((__const unsigned char *) (__const char *) (""))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) (""))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) (""))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) (""))[4]), strlen ("") + 1!
) : (char *) memcpy (default_font, "", strlen ("") + 1)) : strcpy (default_font, "")));
    while (!(c_token >= num_tokens || equals(c_token,";"))) {
        if (almost_equals(c_token, "m$onochrome")) {
            MP_color = 0;
            c_token++;
            continue;
        }
        if (almost_equals(c_token, "c$olor") || almost_equals(c_token, "c$olour")) {
            MP_color = 1;
            c_token++;
            continue;
        }
        if (almost_equals(c_token, "s$olid")) {
            MP_solid = 1;
            c_token++;
            continue;
        }
        if (almost_equals(c_token, "da$shed")) {
            MP_solid = 0;
            c_token++;
            continue;
        }
        if (almost_equals(c_token, "n$otex")) {
            MP_notex = 1;
            (__extension__ (__builtin_constant_p ("pcrr8r") ? (((size_t)(const void *)(("pcrr8r") + 1) - (size_t)(const void *)("pcrr8r") == 1) && strlen ("pcrr8r") + 1 <= 8 ? __strcpy_small (MP_fontname, __extension__ (((__const unsigned char *) (__const char *) ("pcrr8r"))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) ("pcrr8r"))[0]), __extension__ (((__const unsigned char *) (__const char *) ("pcrr8r"))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) ("pcrr8r"))[4]), __extension__ (((((__const unsigned char *) (__const char *) ("pcrr8r"))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) ("pcrr8r"))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) ("pcrr8r"))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("pcrr8r"))[0]), __extension__ (((((__const unsigned char *) (__const char *) ("pcrr8r"))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) ("pcrr8r"))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) !
("pcrr8r"))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) ("pcrr8r"))[4]), strlen ("pcrr8r") + 1) : (char *) memcpy (MP_fontname, "pcrr8r", strlen ("pcrr8r") + 1)) : strcpy (MP_fontname, "pcrr8r")));
            c_token++;
            continue;
        }
        if (almost_equals(c_token, "t$ex")) {
            MP_notex = 0;
            c_token++;
            continue;
        }
        if (almost_equals(c_token, "de$fault")) {
            c_token++;
            continue;
        }
        if (almost_equals(c_token, "m$agnification")) {
            c_token++;
            if (!(c_token >= num_tokens || equals(c_token,";"))) {
                struct value a;
                MP_textmag = (double) real(const_express(&a));
            }
            c_token++;
            continue;
        }
        break;
    }
    if (!(c_token >= num_tokens || equals(c_token,";")) && isstring(c_token)) {
        quote_str(MP_fontname, c_token, 50);
        c_token++;
    }
    if (!(c_token >= num_tokens || equals(c_token,";"))) {
        struct value a;
        MP_fontsize = (double) real(const_express(&a));
        c_token++;
    }

    if (MP_fontsize < 5.0)
        MP_fontsize = 5.0;
    if (MP_fontsize > 99.99)
        MP_fontsize = 99.99;

    term->v_char = (unsigned int) ((300) * MP_fontsize * MP_textmag * 11 / 720);
    if (MP_notex) {
        term->h_char = (unsigned int) ((300) * MP_fontsize * MP_textmag * 6.0 / 720 + 0.5);
    } else {
        term->h_char = (unsigned int) ((300) * MP_fontsize * MP_textmag * 5.3 / 720 + 0.5);
    }
    sprintf(term_options, "%s%s%s%s%6.3f \"%s\" %5.2f",
            MP_color ? "color " : "", MP_solid ? "solid " : "",
            MP_notex ? "notex " : "", "mag ",
            MP_textmag, MP_fontname, MP_fontsize);
}

static void
MP_init()
{
    time_t now;
    time(&now);
    MP_posx = MP_posy = 0;
    fprintf(gpoutfile, "%%GNUPLOT Metapost output: %s\n", asctime(localtime(&now)));
    fputs("\ndefaultmpt:=mpt:=4;\nth:=.6;\n\ndef scalepen expr n = pickup pencircle scaled (n*th) enddef;\ndef ptsize expr n = mpt:=n*defaultmpt enddef;\n",





          gpoutfile);

    fprintf(gpoutfile, "\ntextmag:=%6.3f;\n", MP_textmag);

    fputs("vardef makepic(expr str) =\n  if picture str : str scaled textmag\n  % otherwise a string\n  else: str infont defaultfont scaled (defaultscale*textmag)\n  fi\nenddef;\n\ndef	infontsize(expr str, size) =\n  infont str scaled (size /	fontsize str)\nenddef;\n",
# 267 "term/metapost.trm"
          gpoutfile);

    if (MP_notex) {
        fprintf(gpoutfile, "\ndefaultfont:= \"%s\";\ndefaultscale := %6.3f/fontsize defaultfont;\n",


                MP_fontname, MP_fontsize);
    } else {
        fputs("\n%font changes\nverbatimtex\n  \\def\\setfont#1#2{%.\n    \\font\\gpfont=#1 at #2pt\n    \\gpfont}\n",





              gpoutfile);

        fprintf(gpoutfile, "\\setfont{%s}{%5.2f}\netex\n",
                MP_fontname, MP_fontsize);
    }
    fputs("\ncolor currentcolor; currentcolor=black;\nboolean colorlines,dashedlines;\n",


          gpoutfile);
    if (MP_color) {
        fputs("colorlines:=true;\n", gpoutfile);
    } else {
        fputs("colorlines:=false;\n", gpoutfile);
    }
    if (MP_solid) {
        fputs("dashedlines:=false;\n", gpoutfile);
    } else {
        fputs("dashedlines:=true;\n", gpoutfile);
    }
    fputs("\ndef _wc = withpen currentpen withcolor currentcolor enddef;\ndef _ac = addto currentpicture enddef;\ndef _sms = scaled mpt shifted enddef;\n% drawing point-types\ndef gpdraw (expr n, x, y) =\n  if n<0: _ac contour fullcircle _sms (x,y)\n  elseif (n=1) or (n=3):\n    _ac doublepath ptpath[n] _sms (x,y) _wc;\n    _ac doublepath ptpath[n] rotated 90 _sms (x,y) _wc\n  elseif n<6: _ac doublepath ptpath[n] _sms (x,y) _wc\n  else: _ac contour ptpath[n] _sms (x,y) _wc\n  fi\nenddef;\n\n% the point shapes\npath ptpath[];\n%diamond\nptpath0 = ptpath6 = (-1/2,0)--(0,-1/2)--(1/2,0)--(0,1/2)--cycle;\n% plus sign\nptpath1 = (-1/2,0)--(1/2,0);\n% square\nptpath2 = ptpath7 = (-1/2,-1/2)--(1/2,-1/2)--(1/2,1/2)--(-1/2,1/2)--cycle;\n% cross\nptpath3 := (-1/2,-1/2)--(1/2,1/2);\n% circle:\nptpath4 = ptpath8:= fullcircle;\n% triangle\nptpath5 = ptpath9 := (0,1/2)--(-1/2,-1/2)--(1/2,-1/2)--cycle;\n\ndef linetype expr n =\n  currentcolor:= if colorlines : col[n] else: black fi;\n  if n!
 = -1 :\n      drawoptions(withcolor currentcolor withpen (currentpen scaled .5));\n  elseif n < 1 :\n    drawoptions(_wc);\n  else :\n    drawoptions( if dashedlines: dashed lt[n] fi _wc);\n  fi\nenddef;\n\n% dash patterns\npicture lt[];\nlt1=dashpattern(on 2 off 2); % dashes\nlt2=dashpattern(on 2 off 2 on 0.2 off 2); %dash-dot\nlt3=lt1 scaled 1.414;\nlt4=lt2 scaled 1.414;\nlt5=lt1 scaled 2;\nlt6:=lt2 scaled 2;\nlt7=dashpattern(on 0.2 off 2); %dots\n\ncolor col[],cyan, magenta, yellow;\ncyan=blue+green; magenta=red+blue;yellow=green+red;\ncol[-2]:=col[-1]:=col0:=black;\ncol1:=red;\ncol2:=(.2,.2,1); %blue\ncol3:=(1,.66,0); %orange\ncol4:=.85*green;\ncol5:=.9*magenta;\ncol6:=0.85*cyan;\ncol7:=.85*yellow;\n\n%placing text\npicture GPtext;\ndef put_text(expr pic, x, y, r, j) =\n  GPtext:=makepic(pic);\n  GPtext:=GPtext shifted\n    if j = 1: (-(ulcorner GPtext + llcorner GPtext)/2)\n    elseif j = 2: (-center GPtext)\n    else: (-(urcorner GPtext + lrcorner GPtext)/2)\n    fi\n!
    rotated if r > 0: 90 else: 0 fi;\n  draw GPtext shifted (x,y)\nenddef;\n",
# 374 "term/metapost.trm"
          gpoutfile);
}

static void
MP_graphics()
{

    MP_oldline = -2;
    MP_oldpen = 1.0;
    MP_oldptsize = pointsize;
    fprintf(gpoutfile, "\nbeginfig(%d);\nw:=%gin;h:=%gin;\n",
            MP_char_code, MP_xsize, MP_ysize);
    fprintf(gpoutfile, "a:=w/%d;b:=h/%d;\n", term->xmax, term->ymax);
    fprintf(gpoutfile, "scalepen 1; ptsize %g;linetype -2;\n", pointsize);
    MP_char_code++;
}

static void
MP_text()
{
    if (MP_inline)
        MP_endline();
    fputs("endfig;\n", gpoutfile);
}

static void
MP_linetype(lt)
int lt;
{
    int linetype = lt;
    if (linetype >= 8)
        linetype %= 8;
    if (MP_inline)
        MP_endline();
    if (MP_oldline != linetype) {
        fprintf(gpoutfile, "linetype %d;\n", linetype);
        MP_oldline = linetype;
    }
}

static void
MP_move(x, y)
unsigned int x;
unsigned int y;
{
    if ((x != MP_posx) || (y != MP_posy)) {
        if (MP_inline)
            MP_endline();
        MP_posx = x;
        MP_posy = y;
    }
}

static void
MP_point(x, y, pt)
unsigned int x;
unsigned int y;
int pt;
{
    int pointtype = pt;
    if (MP_inline)
        MP_endline();




    if (pointtype >= 10)
        pointtype %= 10;
    fprintf(gpoutfile, "gpdraw(%d,%da,%db);\n", pointtype, x, y);
}

static void
MP_pointsize(ps)
double ps;
{
    if (MP_oldptsize != ps) {
        if (MP_inline)
            MP_endline();
        fprintf(gpoutfile, "ptsize %g;\n", ps);
        MP_oldptsize = ps;
    }
}


static void
MP_linewidth(lw)
double lw;
{
    if (MP_oldpen != lw) {
        if (MP_inline)
            MP_endline();
        fprintf(gpoutfile, "scalepen %g;\n", lw);
        MP_oldpen = lw;
    }
}


static void
MP_vector(ux, uy)
unsigned int ux;
unsigned int uy;
{
    if ((ux == MP_posx) && (uy == MP_posy))
        return;

    if (MP_inline) {
        if (MP_linecount++ >= 5) {
            fputs("\n", gpoutfile);
            MP_linecount = 1;
        }
    } else {
        MP_inline = 1;
        fprintf(gpoutfile, "draw (%da,%db)", MP_posx, MP_posy);
        MP_linecount = 2;
    }
    MP_posx = ux;
    MP_posy = uy;
    fprintf(gpoutfile, "--(%da,%db)", MP_posx, MP_posy);
}

static void
MP_endline()
{
    MP_inline = 0;
    fprintf(gpoutfile, ";\n");
}

static void
MP_arrow(sx, sy, ex, ey, head)
unsigned int sx;
unsigned int sy;
unsigned int ex;
unsigned int ey;
TBOOLEAN head;
{
    MP_move(sx, sy);
    if (head) {
        fprintf(gpoutfile, "drawarrow (%da,%db)--(%da,%db);\n",
                sx, sy, ex, ey);
    } else if ((sx != ex) || (sy != ey)) {
        fprintf(gpoutfile, "draw (%da,%db)--(%da,%db);\n",
                sx, sy, ex, ey);
    }
    MP_posx = ex;
    MP_posy = ey;

}

static void
MP_put_text(x, y, str)
unsigned int x, y;
char str[];
{
    int i, j = 0;
    char *text;


    if (!str || !*str)
        return;


    text = gp_alloc(strlen(str)+1, "temp string");
    (__extension__ (__builtin_constant_p (str) ? (((size_t)(const void *)((str) + 1) - (size_t)(const void *)(str) == 1) && strlen (str) + 1 <= 8 ? __strcpy_small (text, __extension__ (((__const unsigned char *) (__const char *) (str))[0 + 1] << 8 | ((__const unsigned char *) (__const char *) (str))[0]), __extension__ (((__const unsigned char *) (__const char *) (str))[4 + 1] << 8 | ((__const unsigned char *) (__const char *) (str))[4]), __extension__ (((((__const unsigned char *) (__const char *) (str))[0 + 3] << 8 | ((__const unsigned char *) (__const char *) (str))[0 + 2]) << 8 | ((__const unsigned char *) (__const char *) (str))[0 + 1]) << 8 | ((__const unsigned char *) (__const char *) (str))[0]), __extension__ (((((__const unsigned char *) (__const char *) (str))[4 + 3] << 8 | ((__const unsigned char *) (__const char *) (str))[4 + 2]) << 8 | ((__const unsigned char *) (__const char *) (str))[4 + 1]) << 8 | ((__const unsigned char *) (__const char *) (str))[4]), strlen !
(str) + 1) : (char *) memcpy (text, str, strlen (str) + 1)) : strcpy (text, str)));

    if (MP_inline)
        MP_endline();


    switch (MP_justify) {
    case LEFT:
        j = 1;
        break;
    case CENTRE:
        j = 2;
        break;
    case RIGHT:
        j = 3;
        break;
    }
    if (MP_notex) {
        for (i = 0; i < strlen(text); i++)
            if (text[i] == '"')
                text[i] = '\'';
        if (MP_fontchanged) {
            fprintf(gpoutfile, "put_text(\"%s\" infontsize(\"%s\",%5.2f), %da, %db, %d, %d);\n",

                    text, MP_fontname, MP_fontsize, x, y, MP_ang, j);
        } else {
            fprintf(gpoutfile, "put_text(\"%s\", %da, %db, %d, %d);\n",
                    text, x, y, MP_ang, j);
        }
    } else if (MP_fontchanged) {
        fprintf(gpoutfile, "put_text( btex \\setfont{%s}{%5.2f} %s etex, %da, %db, %d, %d);\n",

                MP_fontname, MP_fontsize, text, x, y, MP_ang, j);
    } else {
        fprintf(gpoutfile, "put_text( btex %s etex, %da, %db, %d, %d);\n",
                text, x, y, MP_ang, j);
    }

    free(text);
}

static int
MP_justify_text(mode)
enum JUSTIFY mode;
{
    MP_justify = mode;
    return (1);
}

static int
MP_text_angle(ang)
int ang;
{

    MP_ang = ang;
    return (1);
}

static int
MP_set_font(font)
char *font;
{
    if (*font) {
        size_t sep = __extension__ ({ char __r0, __r1, __r2; (__builtin_constant_p (",") && ((size_t)(const void *)((",") + 1) - (size_t)(const void *)(",") == 1) ? ((__r0 = ((__const char *) (","))[0], __r0 == '\0') ? strlen (font) : ((__r1 = ((__const char *) (","))[1], __r1 == '\0') ? __strcspn_c1 (font, __r0) : ((__r2 = ((__const char *) (","))[2], __r2 == '\0') ? __strcspn_c2 (font, __r0, __r1) : (((__const char *) (","))[3] == '\0' ? __strcspn_c3 (font, __r0, __r1, __r2) : strcspn (font, ","))))) : strcspn (font, ",")); });
        (__extension__ (__builtin_constant_p (font) && __builtin_constant_p (sep) ? (strlen (font) + 1 >= ((size_t) (sep)) ? (char *) memcpy (MP_fontname, font, sep) : strncpy (MP_fontname, font, sep)) : strncpy (MP_fontname, font, sep)));
        MP_fontname[sep] = ('\0');
        sscanf(&(font[sep + 1]), "%lf", &MP_fontsize);
        if (MP_fontsize < 5)
            MP_fontsize = 5.0;
        if (MP_fontsize >= 100)
            MP_fontsize = 99.99;

        MP_fontchanged = 1;
    } else {
        MP_fontchanged = 0;
    }
    return 1;
}


static void
MP_reset()
{
    fputs("end.\n", gpoutfile);
}

static void
MP_boxfill(sty, x1, y1, wd, ht)
int sty;
unsigned int x1, y1, wd, ht;
{

    if (MP_inline)
        MP_endline();
    if (sty <= 0)
        fprintf(gpoutfile, "fill (%da,%db)--(%da,%db)--(%da,%db)--(%da,%db)--cycle withcolor background;\n",

                x1, y1, x1 + wd, y1, x1 + wd, y1 + ht, x1, y1 + ht);
}
# 394 "term.h" 2
# 699 "term.c" 2
# 714 "term.c"
int null_text_angle(ang)
int ang;
{
    return (ang == 0);
}




int null_justify_text(just)
enum JUSTIFY just;
{
    return (just == LEFT);
}






int null_scale(x, y)
double x;
double y;
{
    return 0;
}

int do_scale(x, y)
double x;
double y;
{
    return 1;
}

void options_null()
{
    term_options[0] = '\0';
}

void UNKNOWN_null()
{
}

void MOVE_null(x, y)
unsigned int x, y;
{
}

void LINETYPE_null(t)
int t;
{
}

void PUTTEXT_null(x, y, s)
unsigned int x, y;
char *s;
{
}


int set_font_null(s)
char *s;
{
    return 0;
}

static void null_linewidth(s)
double s;
{
}



typedef void (*void_fp) (void);
# 803 "term.c"
struct TERMENTRY term_tbl[] =
{
    {"unknown", "Unknown terminal type - not a plotting device",
     100, 100, 1, 1,
     1, 1, options_null, UNKNOWN_null, UNKNOWN_null,
     UNKNOWN_null, null_scale, UNKNOWN_null, MOVE_null, MOVE_null,
     LINETYPE_null, PUTTEXT_null}
    ,
    {"table", "Dump ASCII table of X Y [Z] values to output",
     100, 100, 1, 1,
     1, 1, options_null, UNKNOWN_null, UNKNOWN_null,
     UNKNOWN_null, null_scale, UNKNOWN_null, MOVE_null, MOVE_null,
     LINETYPE_null, PUTTEXT_null}
# 1 "term.h" 1
# 220 "term.h"
# 1 "term/aed.trm" 1
# 55 "term/aed.trm"
# 1 "term/driver.h" 1
# 56 "term/aed.trm" 2
# 172 "term/aed.trm"
,{
    "aed512", "AED 512 Terminal",
    512, 575, 13, 8,
    8, 7, options_null, AED_init, AED_reset,
    AED_text, null_scale, AED_graphics, AED_move, AED_vector,
    AED_linetype, AED_put_text, null_text_angle,
    null_justify_text, do_point, do_arrow, set_font_null
}




,{
    "aed767", "AED 767 Terminal",
    768, 575, 13, 8,
    8, 7, options_null, AED_init, AED_reset,
    AED_text, null_scale, AED_graphics, AED_move, AED_vector,
    AED_linetype, AED_put_text, null_text_angle,
    null_justify_text, do_point, do_arrow, set_font_null
}
# 221 "term.h" 2
# 231 "term.h"
# 1 "term/gpic.trm" 1
# 56 "term/gpic.trm"
# 1 "term/driver.h" 1
# 57 "term/gpic.trm" 2
# 271 "term/gpic.trm"
,{
    "gpic", "GPIC -- Produce graphs in groff using the gpic preprocessor",
    (5*(300)), (3*(300)), ((300)*11/72), ((300)*53/10/72),
    (5*(300)/72), (5*(300)/72), GPIC_options, GPIC_init, GPIC_reset,
    GPIC_text, null_scale, GPIC_graphics, GPIC_move, GPIC_vector,
    GPIC_linetype, GPIC_put_text, GPIC_text_angle,
    GPIC_justify_text, line_and_point, GPIC_arrow, set_font_null
}
# 232 "term.h" 2


# 1 "term/regis.trm" 1
# 51 "term/regis.trm"
# 1 "term/driver.h" 1
# 52 "term/regis.trm" 2
# 238 "term/regis.trm"
,{
    "regis", "REGIS graphics language",
    800, 440, 20, 9,
    8, 6, REGISoptions, REGISinit, REGISreset,
    REGIStext, null_scale, REGISgraphics, REGISmove, REGISvector,
    REGISlinetype, REGISput_text, REGIStext_angle,
    null_justify_text, line_and_point, do_arrow, set_font_null
}
# 235 "term.h" 2


# 1 "term/t410x.trm" 1
# 67 "term/t410x.trm"
# 1 "term/driver.h" 1
# 68 "term/t410x.trm" 2
# 296 "term/t410x.trm"
,{
    "tek410x", "Tektronix 4106, 4107, 4109 and 420X terminals",
    4095, 3131, 71, 51,
    36, 36, options_null, T410X_init, T410X_reset,
    T410X_text, null_scale, T410X_graphics, T410X_move, T410X_vector,
    T410X_linetype, T410X_put_text, T410X_text_angle,
    null_justify_text, T410X_point, do_arrow, set_font_null
}
# 238 "term.h" 2


# 1 "term/tek.trm" 1
# 62 "term/tek.trm"
# 1 "term/driver.h" 1
# 63 "term/tek.trm" 2
# 615 "term/tek.trm"
,{
# 624 "term/tek.trm"
    "tek40xx", "Tektronix 4010 and others; most TEK emulators",
    1024, 780, 25, 14,
    11, 11, options_null, TEK40init, TEK40reset,
    TEK40text, null_scale, TEK40graphics, CTEK_move, CTEK_vector,
    CTEK_linetype, TEK40put_text, null_text_angle,
    null_justify_text, line_and_point, do_arrow, set_font_null

}





,{
    "vttek", "VT-like tek40xx terminal emulator",
    1024, 780, 25, 14,
    11, 11, options_null, VTTEK40init, VTTEK40reset,
    TEK40text, null_scale, TEK40graphics, TEK40move, TEK40vector,
    VTTEK40linetype, VTTEK40put_text, null_text_angle,
    null_justify_text, line_and_point, do_arrow, set_font_null
}







,{
   "kc_tek40xx", "MS-DOS Kermit Tek4010 terminal emulator - color",
    1024, 780, 25, 13,
    11, 11, options_null, TEK40init, KTEK40reset,
    KTEK40Ctext, null_scale, KTEK40graphics, TEK40move, TEK40vector,
    KTEK40Clinetype, TEK40put_text, null_text_angle,
    null_justify_text, do_point, do_arrow, set_font_null
}




,{
    "km_tek40xx", "MS-DOS Kermit Tek4010 terminal emulator - monochrome",
    1024, 780, 25, 13,
    11, 11, options_null, TEK40init, KTEK40reset,
    TEK40text, null_scale, KTEK40graphics, TEK40move, TEK40vector,
    KTEK40Mlinetype, TEK40put_text, null_text_angle,
    null_justify_text, line_and_point, do_arrow, set_font_null
}







,{
    "selanar", "Selanar",
    1024, 780, 25, 14,
    11, 11, options_null, SEL_init, SEL_reset,
    SEL_text, null_scale, SEL_graphics, TEK40move, TEK40vector,
    TEK40linetype, TEK40put_text, null_text_angle,
    null_justify_text, line_and_point, do_arrow, set_font_null
}







,{
    "bitgraph", "BBN Bitgraph Terminal",
    768, 768, 16, 9,
    8, 8, options_null, TEK40init, TEK40reset,
    BG_text, null_scale, TEK40graphics, TEK40move, TEK40vector,
    TEK40linetype, BG_put_text, null_text_angle,
    null_justify_text, line_and_point, do_arrow, set_font_null
}
# 241 "term.h" 2


# 1 "term/xlib.trm" 1
# 47 "term/xlib.trm"
# 1 "term/driver.h" 1
# 48 "term/xlib.trm" 2
# 140 "term/xlib.trm"
,{
    "xlib", "X11 Window System (gnulib_x11 dump)",
    4096, 4096, (4096/25), (4096/100),
    (4096/100), (4096/150), options_null, Xlib_init, Xlib_reset,
    Xlib_text, null_scale, Xlib_graphics, Xlib_move, Xlib_vector,
    Xlib_linetype, Xlib_put_text, null_text_angle,
    Xlib_justify_text, line_and_point, do_arrow, set_font_null
}
# 244 "term.h" 2
# 253 "term.h"
# 1 "term/x11.trm" 1
# 40 "term/x11.trm"
# 1 "term/driver.h" 1
# 41 "term/x11.trm" 2
# 635 "term/x11.trm"
,{
    "x11", "X11 Window System",
    4096, 4096, (4096/25), (4096/100),
    (4096/100), (4096/150), X11_options, X11_init, X11_reset,
    X11_text, null_scale, X11_graphics, X11_move, X11_vector,
    X11_linetype, X11_put_text, null_text_angle,
    X11_justify_text, X11_point, do_arrow, set_font_null,
    X11_pointsize, 1,
    X11_text , 0 ,
    X11_fillbox, X11_linewidth
}




,{
    "X11", "X11 Window System (identical to x11)",
    4096, 4096, (4096/25), (4096/100),
    (4096/100), (4096/150), X11_options, X11_init, X11_reset,
    X11_text, null_scale, X11_graphics, X11_move, X11_vector,
    X11_linetype, X11_put_text, null_text_angle,
    X11_justify_text, X11_point, do_arrow, set_font_null,
    X11_pointsize, 1,
    X11_text , 0 ,
    X11_fillbox, X11_linewidth
}
# 254 "term.h" 2



# 1 "term/ai.trm" 1
# 64 "term/ai.trm"
# 1 "term/driver.h" 1
# 65 "term/ai.trm" 2
# 487 "term/ai.trm"
,{
    "aifm", "Adobe Illustrator 3.0 Format",
    5000, 3500, (14*(10.0)), (14*(10.0)*6/10),
    (3500/80), (3500/80), AI_options, AI_init, AI_reset,
    AI_text, null_scale, AI_graphics, AI_move, AI_vector,
    AI_linetype, AI_put_text, AI_text_angle,
    AI_justify_text, do_point, do_arrow, AI_set_font,
    ((void *)0), 0, AI_suspend, AI_resume
}
# 258 "term.h" 2


# 1 "term/cgm.trm" 1
# 54 "term/cgm.trm"
# 1 "term/driver.h" 1
# 55 "term/cgm.trm" 2
# 1099 "term/cgm.trm"
,{
    "cgm", "Computer Graphics Metafile",
    32767 - (32767/180), 32767/18*13 - (32767/180), (32767/18*13/360*12), (32767/18*13/360*12*5/9),
    (32767/80), (32767/80), CGM_options, CGM_init, CGM_reset,
    CGM_text, null_scale, CGM_graphics, CGM_move, CGM_solid_vector,
    CGM_linetype, CGM_put_text, CGM_text_angle,
    CGM_justify_text, CGM_point, do_arrow, CGM_set_font,
    CGM_set_pointsize,
    4,
    ((void *)0),
    ((void *)0),
    ((void *)0),
    CGM_linewidth
}
# 261 "term.h" 2


# 1 "term/corel.trm" 1
# 28 "term/corel.trm"
# 1 "term/driver.h" 1
# 29 "term/corel.trm" 2
# 391 "term/corel.trm"
,{
    "corel", "EPS format for CorelDRAW",
    5960, 7200, (22*(10.0)), (22*(10.0)*6/10),
    (7200/80), (7200/80), COREL_options, COREL_init, COREL_reset,
    COREL_text, null_scale, COREL_graphics, COREL_move, COREL_vector,
    COREL_linetype, COREL_put_text, COREL_text_angle,
    COREL_justify_text, do_point, do_arrow, set_font_null
}
# 264 "term.h" 2







# 1 "term/dumb.trm" 1
# 51 "term/dumb.trm"
# 1 "term/driver.h" 1
# 52 "term/dumb.trm" 2
# 348 "term/dumb.trm"
,{
    "dumb", "printer or glass dumb terminal",
    79, 24, 1, 1,
    1, 1, DUMB_options, DUMB_init, DUMB_reset,
    DUMB_text, null_scale, DUMB_graphics, DUMB_move, DUMB_vector,
    DUMB_linetype, DUMB_put_text, null_text_angle,
    null_justify_text, DUMB_point, DUMB_arrow, set_font_null,
    0,
    1
}
# 272 "term.h" 2


# 1 "term/dxf.trm" 1
# 55 "term/dxf.trm"
# 1 "term/driver.h" 1
# 56 "term/dxf.trm" 2
# 374 "term/dxf.trm"
,{
  "dxf", "dxf-file for AutoCad (default size 120x80)",
    (120.0 * 60.0), (80.0 * 60.0), (0.026 * (80.0 * 60.0)), (0.014 * (120.0 * 60.0)),
    (0.01 * (80.0 * 60.0)), (0.01 * (120.0 * 60.0)), options_null, DXF_init, DXF_reset,
    DXF_text, null_scale, DXF_graphics, DXF_move, DXF_vector,
    DXF_linetype, DXF_put_text, DXF_text_angle,
    DXF_justify_text, do_point, do_arrow, set_font_null
}
# 275 "term.h" 2







# 1 "term/fig.trm" 1
# 63 "term/fig.trm"
# 1 "term/driver.h" 1
# 64 "term/fig.trm" 2
# 765 "term/fig.trm"
,{
    "fig", "FIG 3.1 graphics language: X graphics editor",
    (5 * (1200)), (3 * (1200)), (((10))*(1200)/72*3/4), ((((10))*(1200)/72*3/4)*6/10),
    (5*(1200)/80), (5*(1200)/80), FIG_options, FIG_init, FIG_reset,
    FIG_text, null_scale, FIG_graphics, FIG_move, FIG_vector,
    FIG_linetype, FIG_put_text, FIG_text_angle, FIG_justify_text,
    FIG_lpoint, FIG_arrow, set_font_null, FIG_pointsize,
    0 , 0 , 0 , 0 ,
    FIG_linewidth
}
# 283 "term.h" 2
# 294 "term.h"
# 1 "term/hp26.trm" 1
# 55 "term/hp26.trm"
# 1 "term/driver.h" 1
# 56 "term/hp26.trm" 2
# 682 "term/hp26.trm"
,{
    "hp2623A", "HP2623A and maybe others",
    512, 390, 10, 7,
    5, 5, options_null, HP26_init, HP26_reset,
    HP26_text, null_scale, HP26_graphics, HP26_move, HP26_vector,
    HP26_linetype, HP26_put_text, HP26_text_angle,
    null_justify_text, HP26_line_and_point, do_arrow, set_font_null
}
# 295 "term.h" 2


# 1 "term/hp2648.trm" 1
# 55 "term/hp2648.trm"
# 1 "term/driver.h" 1
# 56 "term/hp2648.trm" 2
# 169 "term/hp2648.trm"
,{
    "hp2648", "HP2648 and HP2647",
    720, 360, 12, 7,
    8, 8, 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
}
# 298 "term.h" 2


# 1 "term/hp500c.trm" 1
# 69 "term/hp500c.trm"
# 1 "term/driver.h" 1
# 70 "term/hp500c.trm" 2
# 507 "term/hp500c.trm"
,{
    "hp500c", "HP DeskJet 500c, [75 100 150 300] [rle tiff]",
    (1920/4), (1920/4), (1920/4/10),
    (1920/4/6), 5, 5, HP500Coptions,
    HP500Cinit, HP500Creset, HP500Ctext, null_scale,
    HP500Cgraphics, b_move, b_vector, HP500Clinetype,
    b_put_text, b_text_angle, null_justify_text, do_point,
    do_arrow, set_font_null, 0, 4
}
# 301 "term.h" 2


# 1 "term/hpgl.trm" 1
# 64 "term/hpgl.trm"
# 1 "term/driver.h" 1
# 65 "term/hpgl.trm" 2
# 1095 "term/hpgl.trm"
,{
    "hpgl", "HP7475 and relatives [number of pens] [eject]",
    10000, 7500, (7500/100*32/10), (10000/100*12/10),
    (7500/70), (7500/70), HPGL_options, HPGL_init, HPGL_reset,
    HPGL_text, null_scale, HPGL_graphics, HPGL_move, HPGL_vector,
    HPGL_linetype, HPGL_put_text, HPGL_text_angle,
    null_justify_text, do_point, do_arrow, set_font_null
}




    ,{
    "pcl5", "HP LaserJet III [mode] [font] [point]",
    10000, (7500 -60), ((int) 1016 * 14 / 72), (((int) 1016 * 14 / 72) * 2 / 3),
    ((7500 -60)/70), ((7500 -60)/70), PCL_options, PCL_init, PCL_reset,
    PCL_text, null_scale, PCL_graphics, HPGL2_move, HPGL2_vector,
    HPGL2_linetype, HPGL2_put_text, HPGL2_text_angle,
    HPGL2_justify_text, do_point, do_arrow, set_font_null
}
# 304 "term.h" 2


# 1 "term/hpljii.trm" 1
# 68 "term/hpljii.trm"
# 1 "term/driver.h" 1
# 69 "term/hpljii.trm" 2
# 373 "term/hpljii.trm"
,{
    "hpljii", "HP Laserjet series II, [75 100 150 300]",
    (1920/4), (1920/4), (1920/4/10),
    (1920/4/6), 5, 5, HPLJIIoptions,
    HPLJIIinit, HPLJIIreset, HPLJIItext, null_scale,
    HPLJIIgraphics, b_move, b_vector, HPLJIIlinetype,
    HPLJIIput_text, b_text_angle, null_justify_text, line_and_point,
    do_arrow, set_font_null, 0, 4
}




,{
    "hpdj", "HP DeskJet 500, [75 100 150 300]",
    (1920/4), (1920/4), (1920/4/10),
    (1920/4/6), 5, 5, HPLJIIoptions,
    HPLJIIinit, HPLJIIreset, HPDJtext, null_scale,
    HPDJgraphics, b_move, b_vector, HPLJIIlinetype,
    b_put_text, b_text_angle, null_justify_text, line_and_point,
    do_arrow, set_font_null, 0, 4
}
# 307 "term.h" 2


# 1 "term/hppj.trm" 1
# 64 "term/hppj.trm"
# 1 "term/driver.h" 1
# 65 "term/hppj.trm" 2
# 257 "term/hppj.trm"
,{
    "hppj", "HP PaintJet and HP3630 [FNT5X9 FNT9X17 FNT13X25]",
    (8*(unsigned int)(9.5 * 180 / 8.0 + 0.9)), (8 * 180),
    21, 13, (21 / 2), (13 / 2),
    HPPJoptions, HPPJinit, HPPJreset, HPPJtext, null_scale, HPPJgraphics,
    b_move, b_vector, HPPJlinetype, b_put_text, b_text_angle,
    null_justify_text, do_point, do_arrow, set_font_null, 0, 4
}
# 310 "term.h" 2


# 1 "term/imagen.trm" 1
# 63 "term/imagen.trm"
# 1 "term/driver.h" 1
# 64 "term/imagen.trm" 2
# 856 "term/imagen.trm"
,{
    "imagen", "Imagen laser printer",
    ((300) * 11), ((300) * 78 / 10), (12*5), ((12*5)/2),
    (20), (20), IMAGEN_options, IMAGEN_init, IMAGEN_reset,
    IMAGEN_text, null_scale, IMAGEN_graphics, IMAGEN_move,
    IMAGEN_vector, IMAGEN_linetype, IMAGEN_put_text, IMAGEN_text_angle,
    IMAGEN_justify_text, line_and_point, do_arrow, set_font_null
}
# 313 "term.h" 2





# 1 "term/mif.trm" 1
# 90 "term/mif.trm"
# 1 "term/driver.h" 1
# 91 "term/mif.trm" 2
# 843 "term/mif.trm"
,{
    "mif", "Frame maker MIF 3.00 format",
    15000, 10000, (10000/31), (15000/95),
    (10000/150), (15000/225), MIF_options, MIF_init, MIF_reset,
    MIF_text, null_scale, MIF_graphics, MIF_move, MIF_vector,
    MIF_linetype, MIF_put_text, MIF_text_angle,
    MIF_justify_text, MIF_point, do_arrow, set_font_null
}
# 319 "term.h" 2


# 1 "term/pbm.trm" 1
# 63 "term/pbm.trm"
# 1 "term/driver.h" 1
# 64 "term/pbm.trm" 2
# 386 "term/pbm.trm"
,{
    "pbm", "Portable bitmap [small medium large] [monochrome gray color]",
    (640), (480), (11),
    (11), 5, 5, PBMoptions,
    PBMinit, PBMreset, PBMtext, null_scale,
    PBMgraphics, b_move, b_vector, PBMlinetype,
    b_put_text, b_text_angle, null_justify_text, PBMpoint,
    do_arrow, set_font_null,
    0,
    1 | 4
}
# 322 "term.h" 2







# 1 "term/post.trm" 1
# 60 "term/post.trm"
# 1 "term/driver.h" 1
# 61 "term/post.trm" 2
# 1644 "term/post.trm"
,{

      "postscript",
      "PostScript graphics language [mode \042fontname\042 font_size]",
           7200, 5040, (14*(10)), (14*(10)*6/10),
           (5040/80), (5040/80), PS_options, PS_init, PS_reset,
           PS_text, null_scale, PS_graphics, PS_move, PS_vector,
           PS_linetype, PS_put_text, PS_text_angle,
           PS_justify_text, PS_point, do_arrow, PS_set_font, PS_pointsize,
           0 , 0 , 0 , PS_fillbox, PS_linewidth

}
# 330 "term.h" 2


# 1 "term/qms.trm" 1
# 55 "term/qms.trm"
# 1 "term/driver.h" 1
# 56 "term/qms.trm" 2
# 208 "term/qms.trm"
,{
    "qms", "QMS/QUIC Laser printer (also Talaris 1200 and others)",
    9000, 6000, 120, 70,
    70, 70, options_null, QMS_init, QMS_reset,
    QMS_text, null_scale, QMS_graphics, QMS_move, QMS_vector,
    QMS_linetype, QMS_put_text, null_text_angle,
    null_justify_text, line_and_point, do_arrow, set_font_null
}
# 333 "term.h" 2


# 1 "term/table.trm" 1
# 336 "term.h" 2


# 1 "term/tgif.trm" 1
# 69 "term/tgif.trm"
# 1 "term/driver.h" 1
# 70 "term/tgif.trm" 2
# 1418 "term/tgif.trm"
,{
"tgif",
"TGIF X11 [mode] [x,y] [dashed] [\042font\042 [fontsize]]",
950, 634, 18, (18*6/10),
(634/80), (634/80), TGIF_options, TGIF_init, TGIF_reset,
TGIF_text, null_scale, TGIF_graphics, TGIF_move, TGIF_vector,
TGIF_linetype, TGIF_put_text, TGIF_text_angle,
TGIF_justify_text, TGIF_point, TGIF_arrow, TGIF_set_font,
TGIF_set_pointsize, 1

}
# 339 "term.h" 2


# 1 "term/tkcanvas.trm" 1
# 75 "term/tkcanvas.trm"
# 1 "term/driver.h" 1
# 76 "term/tkcanvas.trm" 2
# 569 "term/tkcanvas.trm"
,{
    "tkcanvas", "Tk/Tcl canvas widget [perltk] [interactive]",
    1000, 1000, (25), (16),
    (18), (18), TK_options, TK_init, TK_reset,
    TK_text, null_scale, TK_graphics, TK_move, TK_vector,
    TK_linetype, TK_put_text, null_text_angle,
    TK_justify_text, do_point, do_arrow, TK_set_font,
    ((void *)0), 0, ((void *)0), ((void *)0), ((void *)0), TK_linewidth
}
# 342 "term.h" 2
# 364 "term.h"
# 1 "term/epson.trm" 1
# 58 "term/epson.trm"
# 1 "term/driver.h" 1
# 59 "term/epson.trm" 2
# 740 "term/epson.trm"
,{
    "epson_180dpi", "Epson LQ-style 180-dot per inch (24 pin) printers",
    1260, 1080, 31, 19,
    18, 18, options_null, EPSONinit, EPSONreset,
    EPS180text, null_scale, EPS180graphics, b_move, b_vector,
    b_setlinetype, b_put_text, b_text_angle,
    null_justify_text, do_point, do_arrow, set_font_null, 0, 4
}






,{
    "epson_60dpi", "Epson-style 60-dot per inch printers",
    480, 360, 11, 7,
    6, 6, options_null, EPSONinit, EPSONreset,
    EPS60text, null_scale, EPS60graphics, b_move, b_vector,
    b_setlinetype, b_put_text, b_text_angle,
    null_justify_text, do_point, do_arrow, set_font_null, 0, 4
}






,{
    "epson_lx800", "Epson LX-800, Star NL-10, NX-1000, PROPRINTER ...",
    512, 384, 11, 7,
    6, 6, options_null, EPSONinit, EPSONreset,
    EPSONtext, null_scale, EPSONgraphics, b_move, b_vector,
    b_setlinetype, b_put_text, b_text_angle,
    null_justify_text, line_and_point, do_arrow, set_font_null, 0, 4
}






    ,{
    "nec_cp6", "NEC printer CP6, Epson LQ-800 [monocrome color draft]",
    400, 320, 11, 7,
    6, 6, NECoptions, NECinit, NECreset,
    NECtext, null_scale, NECgraphics, b_move, b_vector,
    NEClinetype, b_put_text, b_text_angle,
    null_justify_text, line_and_point, do_arrow, set_font_null, 0, 4
}






,{
    "okidata", "OKIDATA 320/321 Standard",
    480, 360, 11, 7,
    6, 6, options_null, EPSONinit, EPSONreset,
    OKIDATAtext, null_scale, EPS60graphics, b_move, b_vector,
    b_setlinetype, b_put_text, b_text_angle,
    null_justify_text, do_point, do_arrow, set_font_null, 0, 4
}






,{
    "starc", "Star Color Printer",
    512, 384, 11, 7,
    6, 6, options_null, STARCinit, STARCreset,
    STARCtext, null_scale, STARCgraphics, b_move, b_vector,
    STARClinetype, b_put_text, b_text_angle,
    null_justify_text, line_and_point, do_arrow, set_font_null, 0, 4
}






,{
    "tandy_60dpi", "Tandy DMP-130 series 60-dot per inch graphics",
    480, 360, 11, 7,
    6, 6, options_null, EPSONinit, EPSONreset,
    TANDY60text, null_scale, EPS60graphics, b_move, b_vector,
    b_setlinetype, b_put_text, b_text_angle,
    null_justify_text, do_point, do_arrow, set_font_null, 0, 4
}
# 365 "term.h" 2







# 1 "term/latex.trm" 1
# 77 "term/latex.trm"
# 1 "term/driver.h" 1
# 78 "term/latex.trm" 2
# 794 "term/latex.trm"
,{
    "latex", "LaTeX picture environment",
    (5*(300)), (3*(300)), ((300)*11/72), ((300)*53/10/72),
    (5*(300)/72), (5*(300)/72), LATEX_options, LATEX_init, LATEX_reset,
    LATEX_text, null_scale, LATEX_graphics, LATEX_move, LATEX_vector,
    LATEX_linetype, LATEX_put_text, LATEX_text_angle,
    LATEX_justify_text, LATEX_point, LATEX_arrow, set_font_null
}






,{
    "emtex", "LaTeX picture environment with emTeX specials",
    (5*(300)), (3*(300)), ((300)*11/72), ((300)*53/10/72),
    (5*(300)/72), (5*(300)/72), LATEX_options, EMTEX_init, EMTEX_reset,
    EMTEX_text, null_scale, LATEX_graphics, LATEX_move, LATEX_vector,
    LATEX_linetype, LATEX_put_text, LATEX_text_angle,
    LATEX_justify_text, LATEX_point, LATEX_arrow, set_font_null
}
# 373 "term.h" 2


# 1 "term/pslatex.trm" 1
# 52 "term/pslatex.trm"
# 1 "term/driver.h" 1
# 53 "term/pslatex.trm" 2
# 558 "term/pslatex.trm"
# 1 "term/post.trm" 1
# 60 "term/post.trm"
# 1 "term/driver.h" 1
# 61 "term/post.trm" 2
# 559 "term/pslatex.trm" 2



,{
    "pslatex", "LaTeX picture environment with PostScript \\specials",
    (5*720), (3*720), (100), (50),
    (5040/80), (5040/80), PSLATEX_options, PSLATEX_init, PSLATEX_reset,
    PSLATEX_text, null_scale, PSLATEX_graphics, PSLATEX_move,
    PSLATEX_vector, PSLATEX_linetype, PSLATEX_put_text, PSLATEX_text_angle,
    PSLATEX_justify_text, PSLATEX_point, do_arrow, set_font_null,
    PSLATEX_pointsize, 0 , 0
    , 0 , 0 ,
    PSLATEX_linewidth
}



,{
    "pstex", "plain TeX with PostScript \\specials",
    (5*720), (3*720), (100), (50),
    (5040/80), (5040/80), PSLATEX_options, PSLATEX_init, PSLATEX_reset,
    PSLATEX_text, null_scale, PSLATEX_graphics, PSLATEX_move,
    PSLATEX_vector, PSLATEX_linetype, PSLATEX_put_text, PSLATEX_text_angle,
    PSLATEX_justify_text, PSLATEX_point, do_arrow, set_font_null,
    PSLATEX_pointsize, 0 , 0
    , 0 , 0 ,
    PSLATEX_linewidth
}
# 376 "term.h" 2


# 1 "term/eepic.trm" 1
# 67 "term/eepic.trm"
# 1 "term/driver.h" 1
# 68 "term/eepic.trm" 2
# 357 "term/eepic.trm"
,{
    "eepic", "EEPIC -- extended LaTeX picture environment",
    (5*(300)), (3*(300)), ((300)*11/72), ((300)*53/10/72),
    (5*(300)/72), (5*(300)/72), options_null, EEPIC_init, EEPIC_reset,
    EEPIC_text, null_scale, EEPIC_graphics, EEPIC_move, EEPIC_vector,
    EEPIC_linetype, EEPIC_put_text, EEPIC_text_angle,
    EEPIC_justify_text, EEPIC_point, EEPIC_arrow, set_font_null
}
# 379 "term.h" 2


# 1 "term/tpic.trm" 1
# 82 "term/tpic.trm"
# 1 "term/driver.h" 1
# 83 "term/tpic.trm" 2
# 913 "term/tpic.trm"
,{
    "tpic", "TPIC -- LaTeX picture environment with tpic \\specials",
    (unsigned int) (5 / 0.001), (unsigned int) (3 / 0.001), (unsigned int) (11.0 / (72.27 * 0.001)), (unsigned int) ( 5.3 / (72.27 * 0.001)),
    (unsigned int) ( 5.0 / (72.27 * 0.001)), (unsigned int) ( 5.0 / (72.27 * 0.001)), TPIC_options, TPIC_init, TPIC_reset,
    TPIC_text, null_scale, TPIC_graphics, TPIC_move, TPIC_vector,
    TPIC_linetype, TPIC_put_text, TPIC_text_angle,
    TPIC_justify_text, TPIC_point, TPIC_arrow, set_font_null
}
# 382 "term.h" 2


# 1 "term/pstricks.trm" 1
# 80 "term/pstricks.trm"
# 1 "term/driver.h" 1
# 81 "term/pstricks.trm" 2
# 547 "term/pstricks.trm"
,{
    "pstricks", "LaTeX picture environment with PSTricks macros",
    10000.0, 10000.0, 420, 160,
    200, 150, PSTRICKS_options, PSTRICKS_init, PSTRICKS_reset,
    PSTRICKS_text, null_scale, PSTRICKS_graphics, PSTRICKS_move, PSTRICKS_vector,
    PSTRICKS_linetype, PSTRICKS_put_text, PSTRICKS_text_angle,
    PSTRICKS_justify_text, PSTRICKS_point, PSTRICKS_arrow, set_font_null
}
# 385 "term.h" 2


# 1 "term/texdraw.trm" 1
# 58 "term/texdraw.trm"
# 1 "term/driver.h" 1
# 59 "term/texdraw.trm" 2
# 346 "term/texdraw.trm"
,{
    "texdraw",
    "LaTeX texdraw environment",
    (5*(300)), (3*(300)), ((300)*11/72), ((300)*53/10/72),
    (5*(300)/72), (5*(300)/72), options_null, TEXDRAW_init, TEXDRAW_reset,
    TEXDRAW_text, null_scale, TEXDRAW_graphics, TEXDRAW_move, TEXDRAW_vector,
    TEXDRAW_linetype, TEXDRAW_put_text, TEXDRAW_text_angle,
    TEXDRAW_justify_text, TEXDRAW_point, TEXDRAW_arrow, set_font_null
}
# 388 "term.h" 2


# 1 "term/metafont.trm" 1
# 70 "term/metafont.trm"
# 1 "term/driver.h" 1
# 71 "term/metafont.trm" 2
# 507 "term/metafont.trm"
,{
    "mf", "Metafont plotting standard",
    (5.0*(300)), (3.0*(300)), ((300)*11/72), ((300)*53/10/72),
    (5*(300)/72), (5*(300)/72), options_null, MF_init, MF_reset,
    MF_text, null_scale, MF_graphics, MF_move, MF_vector,
    MF_linetype, MF_put_text, MF_text_angle,
    MF_justify_text, line_and_point, MF_arrow, set_font_null
}
# 391 "term.h" 2


# 1 "term/metapost.trm" 1
# 57 "term/metapost.trm"
# 1 "term/driver.h" 1
# 58 "term/metapost.trm" 2
# 640 "term/metapost.trm"
,{
    "mp", "MetaPost plotting standard",
    (5.0*(300)), (3.0*(300)), ((300)*11/72), ((300)*53/10/72),
    (5*(300)/72), (5*(300)/72), MP_options, MP_init, MP_reset,
    MP_text, null_scale, MP_graphics, MP_move, MP_vector,
    MP_linetype, MP_put_text, MP_text_angle,
    MP_justify_text, MP_point, MP_arrow, MP_set_font, MP_pointsize,
    0, 0, 0, MP_boxfill, MP_linewidth
    }
# 394 "term.h" 2
# 817 "term.c" 2

};




__inline__ int
term_count()
{
    return (sizeof(term_tbl)/sizeof(struct TERMENTRY));
}

void list_terms()
{
    register int i;
    char line_buffer[8192];

    StartOutput();
    sprintf(line_buffer,"\nAvailable terminal types:\n");
    OutLine(line_buffer);

    for (i = 0; i < (sizeof(term_tbl)/sizeof(struct TERMENTRY)); i++) {
        sprintf(line_buffer,"  %15s  %s\n",
                term_tbl[i].name, term_tbl[i].description);
        OutLine(line_buffer);
    }

    EndOutput();
}





struct TERMENTRY *
 set_term(c_token_arg)
int c_token_arg;
{
    register struct TERMENTRY *t = ((void *)0);
    char *input_name;

    if (!token[c_token_arg].is_token)
        int_error("terminal name expected", c_token_arg);
    input_name = input_line + token[c_token_arg].start_index;
    t = change_term(input_name, token[c_token_arg].length);
    if (!t)
        int_error("unknown or ambiguous terminal type; type just 'set terminal' for a list",
                  c_token_arg);



    return (t);
}






struct TERMENTRY *
 change_term(name, length)
char *name;
int length;
{
    int i;
    struct TERMENTRY *t = ((void *)0);

    for (i = 0; i < (sizeof(term_tbl)/sizeof(struct TERMENTRY)); i++) {
        if (!(__extension__ (__builtin_constant_p (length) && ((__builtin_constant_p (name) && strlen (name) < ((size_t) (length))) || (__builtin_constant_p (term_tbl[i].name) && strlen (term_tbl[i].name) < ((size_t) (length)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (name) && __builtin_constant_p (term_tbl[i].name) && (__s1_len = strlen (name), __s2_len = strlen (term_tbl[i].name), (!((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) || __s1_len >= 4) && (!((size_t)(const void *)((term_tbl[i].name) + 1) - (size_t)(const void *)(term_tbl[i].name) == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (name), (__const char *) (term_tbl[i].name), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) && (__s1_len = strlen (name), __s1_len < 4) ? (__builtin_constant_p (term_tbl[i].name) && ((size_t)(const void *)((term_tbl[i].name)!
 + 1) - (size_t)(const void *)(term_tbl[i].name) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (name))[0] - ((__const unsigned char *) (__const char *)(term_tbl[i].name))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[1] - ((__const unsigned char *) (__const char *) (term_tbl[i].name))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[2] - ((__const unsigned char *) (__const char *) (term_tbl[i].name))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (name))[3] - ((__const unsigned char *) (__const char *) (term_tbl[i].name))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) (term_tbl[i].name); register int __result = (((__const unsigned char *) (__const char *) (name))[0] - __s2[0]); if (__s1_len > 0 &!
& __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (name))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (term_tbl[i].name) && ((size_t)(const void *)((term_tbl[i].name) + 1) - (size_t)(const void *)(term_tbl[i].name) == 1) && (__s2_len = strlen (term_tbl[i].name), __s2_len < 4) ? (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (name))[0] - ((__const unsigned char *) (__const char *)(term_tbl[i].name))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[1] - ((__const unsigned char *) (__const char *) (term_tbl[i].nam!
e))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (name))[2] - ((__const unsigned char *) (__const char *) (term_tbl[i].name))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (name))[3] - ((__const unsigned char *) (__const char *) (term_tbl[i].name))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (name); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) (term_tbl[i].name))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) (term_tbl[i].name))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) (term_tbl[i].name))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) (term_tbl[i].name))[3]); } } __result; }))) : strcmp (!
name, term_tbl[i].name)))); }) : strncmp (name, term_tbl[i].name, length)))) {
            if (t)
                return (((void *)0));
            t = term_tbl + i;
        }
    }

    if (!t)
        return (((void *)0));



    term = t;
    term_initialised = 0;
    name = term->name;

    if (term->scale != null_scale)
        fputs("Warning : scale interface is not null_scale - may not work with multiplot\n", stderr);


    if (term->text_angle == 0)
        term->text_angle = null_text_angle;
    if (term->justify_text == 0)
        term->justify_text = null_justify_text;
    if (term->point == 0)
        term->point = do_point;
    if (term->arrow == 0)
        term->arrow = do_arrow;
    if (term->set_font == 0)
        term->set_font = set_font_null;
    if (term->pointsize == 0)
        term->pointsize = do_pointsize;
    if (term->linewidth == 0)
        term->linewidth = null_linewidth;


    if (!(__extension__ (__builtin_constant_p (8) && ((__builtin_constant_p ("unixplot") && strlen ("unixplot") < ((size_t) (8))) || (__builtin_constant_p (name) && strlen (name) < ((size_t) (8)))) ? __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p ("unixplot") && __builtin_constant_p (name) && (__s1_len = strlen ("unixplot"), __s2_len = strlen (name), (!((size_t)(const void *)(("unixplot") + 1) - (size_t)(const void *)("unixplot") == 1) || __s1_len >= 4) && (!((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) || __s2_len >= 4)) ? memcmp ((__const char *) ("unixplot"), (__const char *) (name), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p ("unixplot") && ((size_t)(const void *)(("unixplot") + 1) - (size_t)(const void *)("unixplot") == 1) && (__s1_len = strlen ("unixplot"), __s1_len < 4) ? (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) ? (__extension__ (!
{ register int __result = (((__const unsigned char *) (__const char *) ("unixplot"))[0] - ((__const unsigned char *) (__const char *)(name))[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) ("unixplot"))[1] - ((__const unsigned char *) (__const char *) (name))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) ("unixplot"))[2] - ((__const unsigned char *) (__const char *) (name))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) ("unixplot"))[3] - ((__const unsigned char *) (__const char *) (name))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) (name); register int __result = (((__const unsigned char *) (__const char *) ("unixplot"))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) ("unixplot"))[1] - __s2[1]);!
 if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) ("unixplot"))[2] - __s2[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) ("unixplot"))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p (name) && ((size_t)(const void *)((name) + 1) - (size_t)(const void *)(name) == 1) && (__s2_len = strlen (name), __s2_len < 4) ? (__builtin_constant_p ("unixplot") && ((size_t)(const void *)(("unixplot") + 1) - (size_t)(const void *)("unixplot") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) ("unixplot"))[0] - ((__const unsigned char *) (__const char *)(name))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) ("unixplot"))[1] - ((__const unsigned char *) (__const char *) (name))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) ("unixplot"))[2] - ((__co!
nst unsigned char *) (__const char *) (name))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) ("unixplot"))[3] - ((__const unsigned char *) (__const char *) (name))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) ("unixplot"); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) (name))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) (name))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) (name))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) (name))[3]); } } __result; }))) : strcmp ("unixplot", name)))); }) : strncmp ("unixplot", name, 8)))) {
        UP_redirect(2);
    } else if (unixplot) {
        UP_redirect(3);
    }
    if (interactive)
        fprintf(stderr, "Terminal type set to '%s'\n", name);

    return (t);
}
# 943 "term.c"
void init_terminal()
{
    char *term_name = ((void *)0);

    char *env_term = ((void *)0);


    char *display = ((void *)0);

    char *gnuterm = ((void *)0);


    gnuterm = getenv("GNUTERM");
    if (gnuterm != (char *) ((void *)0)) {
        term_name = gnuterm;
    } else {
# 999 "term.c"
        env_term = getenv("TERM");
        if (term_name == (char *) ((void *)0)
            && env_term != (char *) ((void *)0) && __extension__ ({ size_t __s1_len, __s2_len; (__builtin_constant_p (env_term) && __builtin_constant_p ("xterm") && (__s1_len = strlen (env_term), __s2_len = strlen ("xterm"), (!((size_t)(const void *)((env_term) + 1) - (size_t)(const void *)(env_term) == 1) || __s1_len >= 4) && (!((size_t)(const void *)(("xterm") + 1) - (size_t)(const void *)("xterm") == 1) || __s2_len >= 4)) ? memcmp ((__const char *) (env_term), (__const char *) ("xterm"), (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) : (__builtin_constant_p (env_term) && ((size_t)(const void *)((env_term) + 1) - (size_t)(const void *)(env_term) == 1) && (__s1_len = strlen (env_term), __s1_len < 4) ? (__builtin_constant_p ("xterm") && ((size_t)(const void *)(("xterm") + 1) - (size_t)(const void *)("xterm") == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (env_term))[0] - ((__const unsigned char *) (__const char *)("xterm"))[0!
]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (env_term))[1] - ((__const unsigned char *) (__const char *) ("xterm"))[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (env_term))[2] - ((__const unsigned char *) (__const char *) ("xterm"))[2]); if (__s1_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const char *) (env_term))[3] - ((__const unsigned char *) (__const char *) ("xterm"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s2 = (__const unsigned char *) (__const char *) ("xterm"); register int __result = (((__const unsigned char *) (__const char *) (env_term))[0] - __s2[0]); if (__s1_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (env_term))[1] - __s2[1]); if (__s1_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (env_term))[2] - __s2[2]); if (__s1_len > 2 &&!
 __result == 0) __result = (((__const unsigned char *) (__const char *) (env_term))[3] - __s2[3]); } } __result; }))) : (__builtin_constant_p ("xterm") && ((size_t)(const void *)(("xterm") + 1) - (size_t)(const void *)("xterm") == 1) && (__s2_len = strlen ("xterm"), __s2_len < 4) ? (__builtin_constant_p (env_term) && ((size_t)(const void *)((env_term) + 1) - (size_t)(const void *)(env_term) == 1) ? (__extension__ ({ register int __result = (((__const unsigned char *) (__const char *) (env_term))[0] - ((__const unsigned char *) (__const char *)("xterm"))[0]); if (__s2_len > 0 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (env_term))[1] - ((__const unsigned char *) (__const char *) ("xterm"))[1]); if (__s2_len > 1 && __result == 0) { __result = (((__const unsigned char *) (__const char *) (env_term))[2] - ((__const unsigned char *) (__const char *) ("xterm"))[2]); if (__s2_len > 2 && __result == 0) __result = (((__const unsigned char *) (__const c!
har *) (env_term))[3] - ((__const unsigned char *) (__const char *) ("xterm"))[3]); } } __result; })) : (__extension__ ({ __const unsigned char *__s1 = (__const unsigned char *) (__const char *) (env_term); register int __result = __s1[0] - ((__const unsigned char *) (__const char *) ("xterm"))[0]; if (__s2_len > 0 && __result == 0) { __result = (__s1[1] - ((__const unsigned char *) (__const char *) ("xterm"))[1]); if (__s2_len > 1 && __result == 0) { __result = (__s1[2] - ((__const unsigned char *) (__const char *) ("xterm"))[2]); if (__s2_len > 2 && __result == 0) __result = (__s1[3] - ((__const unsigned char *) (__const char *) ("xterm"))[3]); } } __result; }))) : strcmp (env_term, "xterm")))); }) == 0)
            term_name = "x11";
        display = getenv("DISPLAY");
        if (term_name == (char *) ((void *)0) && display != (char *) ((void *)0))
            term_name = "x11";
        if (X11_Display)
            term_name = "x11";
# 1056 "term.c"
    }


    if (term_name != ((void *)0) && *term_name != '\0') {
        if (change_term(term_name, (int) strlen(term_name)))
            return;
        fprintf(stderr, "Unknown or ambiguous terminal name '%s'\n", term_name);
    }
    change_term("unknown", 7);
}
# 1113 "term.c"
void UP_redirect(caller)
int caller;
{
    caller = caller;

}
# 1170 "term.c"
void test_term()
{
    register struct TERMENTRY *t = term;
    char *str;
    int x, y, xl, yl, i;
    unsigned int xmax_t, ymax_t;
    char label[50];
    int key_entry_height;
    int p_width;

    term_start_plot();
    screen_ok = 0;
    xmax_t = (unsigned int) (t->xmax * xsize);
    ymax_t = (unsigned int) (t->ymax * ysize);

    p_width = pointsize * (t->h_tic);
    key_entry_height = pointsize * (t->v_tic) * 1.25;
    if (key_entry_height < (t->v_char))
        key_entry_height = (t->v_char);


    (*t->linewidth) (1.0);
    (*t->linetype) (-2);
    (*t->move) (0, 0);
    (*t->vector) (xmax_t - 1, 0);
    (*t->vector) (xmax_t - 1, ymax_t - 1);
    (*t->vector) (0, ymax_t - 1);
    (*t->vector) (0, 0);
    (void) (*t->justify_text) (LEFT);
    (*t->put_text) (t->h_char * 5, ymax_t - t->v_char * 3, "Terminal Test");

    (*t->linetype) (-1);
    (*t->move) (xmax_t / 2, 0);
    (*t->vector) (xmax_t / 2, ymax_t - 1);
    (*t->move) (0, ymax_t / 2);
    (*t->vector) (xmax_t - 1, ymax_t / 2);

    (*t->linetype) (-2);
    (*t->move) (xmax_t / 2 - t->h_char * 10, ymax_t / 2 + t->v_char / 2);
    (*t->vector) (xmax_t / 2 + t->h_char * 10, ymax_t / 2 + t->v_char / 2);
    (*t->vector) (xmax_t / 2 + t->h_char * 10, ymax_t / 2 - t->v_char / 2);
    (*t->vector) (xmax_t / 2 - t->h_char * 10, ymax_t / 2 - t->v_char / 2);
    (*t->vector) (xmax_t / 2 - t->h_char * 10, ymax_t / 2 + t->v_char / 2);
    (*t->put_text) (xmax_t / 2 - t->h_char * 10, ymax_t / 2,
                    "12345678901234567890");

    (void) (*t->justify_text) (LEFT);
    (*t->put_text) (xmax_t / 2, ymax_t / 2 + t->v_char * 6, "left justified");
    str = "centre+d text";
    if ((*t->justify_text) (CENTRE))
        (*t->put_text) (xmax_t / 2,
                        ymax_t / 2 + t->v_char * 5, str);
    else
        (*t->put_text) (xmax_t / 2 - strlen(str) * t->h_char / 2,
                        ymax_t / 2 + t->v_char * 5, str);
    str = "right justified";
    if ((*t->justify_text) (RIGHT))
        (*t->put_text) (xmax_t / 2,
                        ymax_t / 2 + t->v_char * 4, str);
    else
        (*t->put_text) (xmax_t / 2 - strlen(str) * t->h_char,
                        ymax_t / 2 + t->v_char * 4, str);

    str = "rotated ce+ntred text";
    if ((*t->text_angle) (1)) {
        if ((*t->justify_text) (CENTRE))
            (*t->put_text) (t->v_char,
                            ymax_t / 2, str);
        else
            (*t->put_text) (t->v_char,
                            ymax_t / 2 - strlen(str) * t->h_char / 2, str);
    } else {
        (void) (*t->justify_text) (LEFT);
        (*t->put_text) (t->h_char * 2, ymax_t / 2 - t->v_char * 2, "Can't rotate text");
    }
    (void) (*t->justify_text) (LEFT);
    (void) (*t->text_angle) (0);

    (*t->move) ((unsigned int) (xmax_t / 2 + t->h_tic * (1 + ticscale)), (unsigned) 0);
    (*t->vector) ((unsigned int) (xmax_t / 2 + t->h_tic * (1 + ticscale)), (unsigned int)
                  (ticscale * t->v_tic));
    (*t->move) ((unsigned int) (xmax_t / 2), (unsigned int) (t->v_tic * (1 + ticscale)));
    (*t->vector) ((unsigned int) (xmax_t / 2 + ticscale * t->h_tic), (unsigned int) (t->v_tic * (1
                                                                                                 + ticscale)));
    (*t->put_text) ((unsigned int) (xmax_t / 2 - 10 * t->h_char), (unsigned int) (t->v_tic * 2 +
                                                                                  t->v_char / 2),
                    "test tics");


    x = xmax_t - t->h_char * 6 - p_width;
    y = ymax_t - key_entry_height;
    (*t->pointsize) (pointsize);
    for (i = -2; y > key_entry_height; i++) {
        (*t->linetype) (i);


        (void) sprintf(label, "%d", i + 1);
        if ((*t->justify_text) (RIGHT))
            (*t->put_text) (x, y, label);
        else
            (*t->put_text) (x - strlen(label) * t->h_char, y, label);
        (*t->move) (x + t->h_char, y);
        (*t->vector) (x + t->h_char * 4, y);
        if (i >= -1)
            (*t->point) (x + t->h_char * 5 + p_width / 2, y, i);
        y -= key_entry_height;
    }

    (*t->linewidth) (1.0);
    (*t->linetype) (0);
    x = xmax_t / 4;
    y = ymax_t / 4;
    xl = t->h_tic * 5;
    yl = t->v_tic * 5;
    (*t->arrow) (x, y, x + xl, y, 1);
    (*t->arrow) (x, y, x + xl / 2, y + yl, 1);
    (*t->arrow) (x, y, x, y + yl, 1);
    (*t->arrow) (x, y, x - xl / 2, y + yl, 0);
    (*t->arrow) (x, y, x - xl, y, 1);
    (*t->arrow) (x, y, x - xl, y - yl, 1);
    (*t->arrow) (x, y, x, y - yl, 1);
    (*t->arrow) (x, y, x + xl, y - yl, 1);

    term_end_plot();
}
>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]