# include # include # include # include #include "defs.h" /* this module contains one function, dev_setup, which is called by the main gplot modules at startup time. It is the only existing piece of code which must be modified to add a new device driver */ /* here is the common argument list for all of these routines */ #define arg_list opt, dev_info, c1, c2, c3, c5, delim, mfdesc, pdesc, mfctrl, \ gprim, attr, escfun, extfun, ctrl, pargc, argv int dev_setup(arg_list) struct one_opt *opt; /* the command line options, in only */ struct info_struct *dev_info; /* device info to fill out, out only */ struct mf_d_struct *c1; /* the class 1 elements, in only */ struct pic_d_struct *c2; /* the class 2 elements, in only */ struct control_struct *c3; /* the class 3 elements, in only */ struct attrib_struct *c5; /* the class 5 elements, in only */ int (*delim[])(); /* delimiter functions */ int (*mfdesc[])(); /* metafile descriptor functions */ int (*pdesc[])(); /* page descriptor functions */ int (*mfctrl[])(); /* controller functions */ int (*ctrl[])(); /* controller functions */ int (*gprim[])(); /* graphical primitives */ int (*attr[])(); /* the attribute functions */ int (*escfun[])(); /* the escape functions */ int (*extfun[])(); /* the external functions */ int *pargc; /* pointer to argc */ char **argv; /* the main argv */ { #define dev_length 20 /* maximum device name length */ static char dev_name[dev_length + 1], buffer[dev_length + 1]; int i; /* first check if we are using a controller */ if (opt[(int) tty].set || opt[(int) screen].set) { #ifdef inctty tty_ctrl(ctrl, opt); #else (void) fprintf(stderr, "tty controller not loaded\n"); #endif } if (opt[(int) diaquest].set) { #ifdef incdq dq_ctrl(ctrl, opt); #else (void) fprintf(stderr, "diaquest controller not loaded\n"); #endif } if (opt[(int) lvr].set) { #ifdef inclvr lvr_ctrl(ctrl, opt); #else (void) fprintf(stderr, "Laser Video (lvr) controller not loaded\n"); #endif } /* now see if we asked for a device */ if (opt[(int) device].set) strncpy(dev_name, opt[(int) device].val.str, dev_length); else if (opt[(int) screen].set) if (!strlen(opt[(int) screen].val.str)) /* default to tektronix */ strncpy(dev_name, "tek4010", dev_length); else strncpy(dev_name, opt[(int) screen].val.str, dev_length); else { /* no device set, listing only */ dev_info->pxl_in = 1.0; dev_info->ypxl_in = 1.0; dev_info->x_size = 3276.0; dev_info->y_size = 3276.0; dev_info->x_offset = 0.0; dev_info->y_offset = 0.0; *dev_info->out_name = '\0'; /* no output file */ dev_info->capability = 0; dev_info->rec_size = 80; return(1); } /* so we actually have a device requested, now need to figure out who to call*/ dev_name[dev_length] = '\0'; /* for safety */ /* let's convert to lower case */ for (i=0; i