[BACK]Return to x11.trm CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gnuplot / term

Annotation of OpenXM_contrib/gnuplot/term/x11.trm, Revision 1.1.1.1

1.1       maekawa     1: /*
                      2:  * $Id: x11.trm,v 1.35 1998/06/18 14:59:27 ddenholm Exp $
                      3:  *
                      4:  */
                      5:
                      6: /*[
                      7:  * Copyright 1986 - 1993, 1998   Thomas Williams, Colin Kelley
                      8:  *
                      9:  * Permission to use, copy, and distribute this software and its
                     10:  * documentation for any purpose with or without fee is hereby granted,
                     11:  * provided that the above copyright notice appear in all copies and
                     12:  * that both that copyright notice and this permission notice appear
                     13:  * in supporting documentation.
                     14:  *
                     15:  * Permission to modify the software is granted, but not the right to
                     16:  * distribute the complete modified source code.  Modifications are to
                     17:  * be distributed as patches to the released version.  Permission to
                     18:  * distribute binaries produced by compiling modified sources is granted,
                     19:  * provided you
                     20:  *   1. distribute the corresponding source modifications from the
                     21:  *    released version in the form of a patch file along with the binaries,
                     22:  *   2. add special version identification to distinguish your version
                     23:  *    in addition to the base release version number,
                     24:  *   3. provide your name and address as the primary contact for the
                     25:  *    support of your modified version, and
                     26:  *   4. retain our contact information in regard to use of the base
                     27:  *    software.
                     28:  * Permission to distribute the released version of the source code along
                     29:  * with corresponding source modifications in the form of a patch file is
                     30:  * granted with same provisions 2 through 4 for binary distributions.
                     31:  *
                     32:  * This software is provided "as is" without express or implied warranty
                     33:  * to the extent permitted by applicable law.
                     34: ]*/
                     35:
                     36: /*
                     37:  *    x11.trm  --- inboard terminal driver for X11
                     38:  */
                     39:
                     40: #include "driver.h"
                     41:
                     42: #ifdef TERM_REGISTER
                     43: register_term(x11)
                     44: #endif
                     45:
                     46: #ifdef TERM_PROTO
                     47: int X11_args __PROTO((int argc, char *argv[]));
                     48: TERM_PUBLIC void X11_options __PROTO((void));
                     49: TERM_PUBLIC void X11_init __PROTO((void));
                     50: TERM_PUBLIC void X11_graphics __PROTO((void));
                     51: TERM_PUBLIC void X11_text __PROTO((void));
                     52: TERM_PUBLIC void X11_reset __PROTO((void));
                     53: TERM_PUBLIC void X11_move __PROTO((unsigned int x, unsigned int y));
                     54: TERM_PUBLIC void X11_vector __PROTO((unsigned int x, unsigned int y));
                     55: TERM_PUBLIC void X11_linewidth __PROTO((double lw));
                     56: TERM_PUBLIC void X11_pointsize __PROTO((double ps));
                     57: TERM_PUBLIC void X11_linetype __PROTO((int lt));
                     58: TERM_PUBLIC void X11_put_text __PROTO((unsigned int x, unsigned int y, char str[]));
                     59: TERM_PUBLIC int X11_justify_text __PROTO((enum JUSTIFY mode));
                     60: TERM_PUBLIC void X11_point __PROTO((unsigned int x, unsigned int y, int number));
                     61: TERM_PUBLIC void X11_fillbox __PROTO((int style, unsigned int x, unsigned y, unsigned int width, unsigned int height));
                     62: #define X11_XMAX 4096
                     63: #define X11_YMAX 4096
                     64:
                     65: /* approximations for typical font/screen sizes */
                     66: #define X11_VCHAR (X11_YMAX/25)
                     67: #define X11_HCHAR (X11_XMAX/100)
                     68: #define X11_VTIC (X11_YMAX/100)
                     69: #define X11_HTIC (X11_XMAX/150)
                     70: #endif
                     71:
                     72:
                     73: #ifndef TERM_PROTO_ONLY
                     74:
                     75: #ifdef TERM_BODY
                     76: int X11_Display = 0;           /* non-zero if '-display' found on command line */
                     77:
                     78:
                     79: /* sunos 4 uses on_exit() in place of atexit(). If both are missing,
                     80:  * we can probably survive since gnuplot_x11 should detect EOF on
                     81:  * the pipe. Unfortunately, the handlers take different parameters.
                     82:  */
                     83:
                     84: #ifdef NO_ATEXIT
                     85: # define HANDLER_PROTO  __PROTO((int x, void *y))
                     86: # define HANDLER_DECL (x,y) int x; void *y;
                     87: # define HANDLER_PARAMS (0,NULL)
                     88: # ifdef HAVE_ON_EXIT
                     89: #  define atexit(x) on_exit(x, NULL)
                     90: # else
                     91: #  define atexit(x)            /* nowt */
                     92: # endif
                     93: #else /* !NO_ATEXIT */
                     94: # define HANDLER_PROTO __PROTO((void))
                     95: # define HANDLER_DECL   ()
                     96: # define HANDLER_PARAMS ()
                     97: #endif
                     98:
                     99: static void X11_atexit HANDLER_PROTO;
                    100:
                    101: static char X11_opts[][20] =
                    102: {
                    103:     "-mono", "-gray", "-clear", "-tvtwm", "-pointsize",
                    104:     "-iconic", "-rv", "-reverse", "+rv", "-synchronous",
                    105:     "-display", "-geometry", "-bg", "-background", "-bd", "-bordercolor", "-bw",
                    106:     "-borderwidth", "-fg", "-foreground", "-fn", "-font", "-name",
                    107:     "-selectionTimeout", "-title", "-xnllanguage", "-xrm",
                    108:     "-raise", "-noraise", "-persist"
                    109: };
                    110:
                    111: #define X11_nopts (sizeof(X11_opts) / sizeof(X11_opts[0]))
                    112:
                    113: static int X11_optarg[X11_nopts] =
                    114: {
                    115:     0, 0, 0, 0, 1,
                    116:     0, 0, 0, 0, 0,
                    117:     1, 1, 1, 1, 1, 1, 1,
                    118:     1, 1, 1, 1, 1, 1,
                    119:     1, 1, 1, 1,
                    120:     0, 0, 0
                    121: };
                    122:
                    123: static FILE *X11_ipc;
                    124: #ifdef OS2
                    125: static char X11_command[1024] = "gnuplot_x11.exe";
                    126: #else
                    127: static char X11_command[1024] = "gnuplot_x11";
                    128: #endif
                    129:
                    130: /*   X11_args - scan gnuplot command line for standard X Toolkit options
                    131:  * called from plot.c so must not be TERM_PUBLIC (which may be static)
                    132:  */
                    133:
                    134: int X11_args(argc, argv)
                    135: int argc;
                    136: char *argv[];
                    137: {
                    138:     int nx11 = 0, n;
                    139:
                    140:     while (++argv, --argc > 0) {
                    141:        for (n = 0; n < X11_nopts; n++) {
                    142:            if (!strcmp(*argv, X11_opts[n])) {
                    143:                strcat(X11_command, " ");
                    144:                strcat(X11_command, *argv);
                    145:                if (strcmp(*argv, "-display") == 0)
                    146:                    X11_Display++;
                    147:                if (X11_optarg[n]) {
                    148:                    if (--argc <= 0)
                    149:                        return (nx11);
                    150:                    strcat(X11_command, " \"");
                    151:                    strcat(X11_command, *++argv);
                    152:                    strcat(X11_command, "\"");
                    153:                    nx11++;
                    154:                }
                    155:                nx11++;
                    156:                break;
                    157:            }
                    158:        }
                    159:        if (n == X11_nopts)
                    160:            break;
                    161:     }
                    162:     return (nx11);
                    163: }
                    164:
                    165:
                    166: static unsigned int X11_plot_number;
                    167:
                    168: TERM_PUBLIC void X11_options()
                    169: {
                    170:     if (almost_equals(c_token, "res$et")) {
                    171:        X11_atexit HANDLER_PARAMS;      /* tell gnuplot_x11 to shut down */
                    172:        ++c_token;
                    173:     }
                    174:     if (!END_OF_COMMAND) {
                    175:        struct value a;
                    176:        X11_plot_number = (int) real(const_express(&a));
                    177:        /* let gnuplot_x11 check range */
                    178:     }
                    179:     sprintf(term_options, "%d", X11_plot_number);
                    180: }
                    181:
                    182: /*-----------------------------------------------------------------------------
                    183:  *   Three different versions of the remainder of the X11 terminal driver
                    184:  *   are provided to support three different types of IPC with the
                    185:  *   gnuplot_x11 outboard terminal driver:
                    186:  *
                    187:  *   DEFAULT_X11:      popen() pipe for most un*x platforms
                    188:  *
                    189:  *   CRIPPLED_SELECT : file IPC for un*x platforms with incomplete or faulty
                    190:  *                     implementation of BSD select()
                    191:  *
                    192:  *   VMS :             mailbox/spawn IPC
                    193:  *---------------------------------------------------------------------------*/
                    194:
                    195: #define DEFAULT_X11
                    196: #if defined(VMS) || defined(CRIPPLED_SELECT)
                    197: #undef DEFAULT_X11
                    198: #endif
                    199: #if defined(VMS) && defined(CRIPPLED_SELECT)
                    200: Error.Incompatible options.
                    201: #endif
                    202:
                    203: /* we do not want to have to duplicate all the code, so we
                    204:  * do most of it with macros.
                    205:  * PRINT0(format), PRINT1(format, p1), PRINT2(format, p1, p2) etc
                    206:  * also  FLUSH0(format), etc, which do an additional flush
                    207:  */
                    208:
                    209:
                    210: #ifdef DEFAULT_X11
                    211: /*-----------------------------------------------------------------------------
                    212:  *   DEFAULT_X11 popen() pipe IPC
                    213:  *---------------------------------------------------------------------------*/
                    214:
                    215:        static void X11_atexit HANDLER_DECL { if (X11_ipc) {
                    216:        fputs("R\n", X11_ipc);
                    217:        fclose(X11_ipc);
                    218:        /* dont wait(), since they might be -persist */
                    219:        X11_ipc = NULL;
                    220:     }
                    221: } TERM_PUBLIC void X11_init()
                    222: {
                    223:     if (!X11_ipc) {
                    224:        /* first time through or after a reset */
                    225: #if defined(OSK) || defined(OS2)
                    226:        /* OS-9 popen() does not block on close for child to end, so
                    227:         * we can safely use it here
                    228:         */
                    229:        X11_ipc = popen(X11_command, "w");
                    230: #else
                    231:        int fdes[2];
                    232:        pipe(fdes);
                    233:        if (fork() == 0) {
                    234:            /* child */
                    235:            close(fdes[1]);
                    236:            dup2(fdes[0], 0);   /* stdin from pipe */
                    237:            execl("/bin/sh", "sh", "-c", X11_command, NULL);
                    238:            /* if we get here, something went wrong */
                    239:            perror("exec failed");
                    240:            exit(1);
                    241:        }
                    242:        /* parent */
                    243:        close(fdes[0]);         /* read end of pipe */
                    244:        X11_ipc = fdopen(fdes[1], "w");
                    245: #endif
                    246:     } {
                    247:        static int been_here = 0;
                    248:        if (!been_here) {
                    249:            atexit(X11_atexit);
                    250:            been_here = 1;
                    251:        }
                    252:     }
                    253:
                    254: }
                    255:
                    256: TERM_PUBLIC void X11_reset()
                    257: {
                    258:     /* leave the pipe alone, until exit or  set term x11 reset */
                    259: }
                    260:
                    261: #define PRINT0(fmt)          fprintf(X11_ipc, fmt)
                    262: #define PRINT1(fmt,p1)       fprintf(X11_ipc, fmt,p1)
                    263: #define PRINT2(fmt,p1,p2)    fprintf(X11_ipc, fmt,p1,p2)
                    264: #define PRINT3(fmt,p1,p2,p3) fprintf(X11_ipc, fmt,p1,p2,p3)
                    265: #define PRINT4(fmt,p1,p2,p3,p4) fprintf(X11_ipc, fmt,p1,p2,p3,p4)
                    266: #define PRINT5(fmt,p1,p2,p3,p4,p5) fprintf(X11_ipc, fmt,p1,p2,p3,p4,p5)
                    267:
                    268: #define FFLUSH()             fflush(X11_ipc)
                    269:
                    270: #define BEFORE_GRAPHICS                /* nowt */
                    271: #define AFTER_TEXT             /* nowt */
                    272: #endif /* DEFAULT_X11 */
                    273:
                    274:
                    275: #ifdef CRIPPLED_SELECT
                    276:
                    277: /* PLEASE CAN SOMEONE CHECK THAT THIS STILL WORKS !!! */
                    278:
                    279: /*-----------------------------------------------------------------------------
                    280:  *   CRIPPLED_SELECT file IPC
                    281:  *---------------------------------------------------------------------------*/
                    282:
                    283: static char X11_tmp[32], X11_tmp0[32], X11_shutdown[32];
                    284: static int X11_pid;
                    285:
                    286: TERM_PUBLIC void X11_init()
                    287: {
                    288:     if (!(X11_pid = fork())) {
                    289:        execl("/bin/sh", "sh", "-c", X11_command, NULL);
                    290:        _exit(1);
                    291:     }
                    292:     sprintf(X11_tmp, "/tmp/Gnuplot_%d", X11_pid);
                    293:     sprintf(X11_tmp0, "%s-", X11_tmp);
                    294:     sprintf(X11_shutdown, "echo R >%s", X11_tmp);
                    295: }
                    296:
                    297: TERM_PUBLIC void X11_reset()
                    298: {
                    299:     system(X11_shutdown);
                    300: }
                    301:
                    302: #define BEFORE_GRAPHICS \
                    303:  if (!(X11_ipc = fopen(X11_tmp0, "w"))) { \
                    304:    perror(X11_tmp0); system(X11_shutdown); exit(1); \
                    305:  }
                    306:
                    307: #define AFTER_TEXT \
                    308:  { fclose(X11_ipc); rename(X11_tmp0, X11_tmp); }
                    309:
                    310: #define PRINT0(fmt)          fprintf(X11_ipc, fmt)
                    311: #define PRINT1(fmt,p1)       fprintf(X11_ipc, fmt,p1)
                    312: #define PRINT2(fmt,p1,p2)    fprintf(X11_ipc, fmt,p1,p2)
                    313: #define PRINT3(fmt,p1,p2,p3) fprintf(X11_ipc, fmt,p1,p2,p3)
                    314: #define PRINT4(fmt,p1,p2,p3,p4) fprintf(X11_ipc, fmt,p1,p2,p3,p4)
                    315: #define PRINT5(fmt,p1,p2,p3,p4,p5) fprintf(X11_ipc, fmt,p1,p2,p3,p4,p5)
                    316: #define FFLUSH()             fflush(X11_ipc)
                    317:
                    318: static void X11_atexit HANDLER_DECL { /* WHAT SHOULD I DO ? */
                    319: }
                    320:
                    321: #endif                         /* CRIPPLED_SELECT */
                    322: #ifdef VMS
                    323: /*-----------------------------------------------------------------------------
                    324:  *   VMS mailbox/spawn IPC - Yehavi Bourvine - YEHAVI@VMS.HUJI.AC.IL
                    325:  *---------------------------------------------------------------------------*/
                    326: #include <iodef.h>
                    327: #include <descrip.h>
                    328: #include <dvidef.h>
                    329: #ifdef __DECC
                    330: #include <lib$routines.h>
                    331: #include <starlet.h>
                    332: #endif
                    333: #ifdef __GNUC__
                    334: #include <errno.h>
                    335: #else
                    336: int vaxc$errno;
                    337: #endif
                    338:
                    339: #define SS$_NORMAL 1           /* or include <ssdef.h> for all SS$_ def's */
                    340:
                    341: #define MBXMXMSG 128           /* DEFMBXMXMSG is set by SYSGEN */
                    342:
                    343: static short X11_channel;
                    344:
                    345: struct iosb {
                    346:     unsigned short stat;
                    347:     unsigned short count;
                    348:     unsigned long info;
                    349: };
                    350:
                    351:
                    352: TERM_PUBLIC void X11_init()
                    353: {
                    354:
                    355:     struct iosb iosb;
                    356:
                    357:     static char devnam_string[64];
                    358:     static $DESCRIPTOR(devnam, devnam_string);
                    359:
                    360:     struct {
                    361:        short int buf_len;
                    362:        short int item;
                    363:        char *buf_addr;
                    364:        unsigned short int *ret_len;
                    365:        int end;
                    366:     } item_list = {
                    367:        devnam.dsc$w_length, DVI$_DEVNAM,
                    368:            devnam.dsc$a_pointer,
                    369:            &devnam.dsc$w_length, 0
                    370:     };
                    371:
                    372:
                    373:     if (!X11_channel) {
                    374:        int one = 1;
                    375:
                    376:        /* Create a descriptor for the command line that starts
                    377:           GNUPLOT_X11. $DESCRIP doesn't work in this context... */
                    378:
                    379:        struct dsc$descriptor_s pgmdsc =
                    380:        {0, DSC$K_DTYPE_T,
                    381:         DSC$K_CLASS_S, 0};
                    382:        pgmdsc.dsc$w_length = strlen(X11_command);
                    383:        pgmdsc.dsc$a_pointer = X11_command;
                    384:
                    385:
                    386:        /* Create a mailbox which will be used as a pipe for commands to the
                    387:           subprocess.  What we'll write to it will be read by the subprocess as
                    388:           its STDIN.  Use an unnamed mailbox and refer to it by its device
                    389:           number */
                    390:
                    391:        vaxc$errno = sys$crembx(0, &X11_channel, MBXMXMSG, MBXMXMSG, 0, 0, 0, 0);
                    392:        if ((vaxc$errno & SS$_NORMAL) != SS$_NORMAL) {
                    393:            printf("SYS$CreMbx failed with status=%d\r\n", vaxc$errno);
                    394:            os_error("sys$crembx failed", NO_CARET);
                    395:        }
                    396:        vaxc$errno = sys$getdviw(0, X11_channel, 0, &item_list, &iosb, 0, 0, 0);
                    397:        if ((vaxc$errno & SS$_NORMAL) == SS$_NORMAL)
                    398:            vaxc$errno = iosb.stat;
                    399:        if ((vaxc$errno & SS$_NORMAL) != SS$_NORMAL) {
                    400:            printf("SYS$Getdviw failed with status=%d\r\n", vaxc$errno);
                    401:            sys$dassgn(X11_channel);
                    402:            X11_channel = 0;
                    403:            os_error("sys$getdviw failed", NO_CARET);
                    404:        }
                    405:        /* Create a subprocess whose input is this mailbox. */
                    406:        vaxc$errno = lib$spawn(&pgmdsc, &devnam, 0, &one, 0, 0, 0, 0, 0, 0, 0, 0, 0);
                    407:        if ((vaxc$errno & SS$_NORMAL) != SS$_NORMAL) {
                    408:            printf("LIB$SPAWN failed with status=%d\r\n", vaxc$errno);
                    409:            sys$dassgn(X11_channel);
                    410:            X11_channel = 0;
                    411:            os_error("lib$spawn failed", NO_CARET);
                    412:        }
                    413:     } {
                    414:        static int been_here = 0;
                    415:        if (!been_here) {
                    416:            atexit(X11_atexit);
                    417:            been_here = 1;
                    418:        }
                    419:     }
                    420: }
                    421:
                    422:
                    423: /*   We use $QIO in order to avoid buffering problems, although it might
                    424:  *   work  as well with simple Fprintf calls.
                    425:  */
                    426:
                    427: #define GO(x) \
                    428: { \
                    429:    char buffer[512]; int status; struct iosb iosb;\
                    430:    sprintf x; \
                    431:    if (strlen(buffer) >= MBXMXMSG )  { \
                    432:      printf("buffer contents (%d char) catenated to mailbox size (%d bytes)\n", \
                    433:      strlen(buffer), MBXMXMSG); \
                    434:      buffer[MBXMXMSG-1] = '\0';\
                    435:      printf("%s\n", buffer); \
                    436:    } \
                    437:    status = sys$qiow(0, X11_channel, IO$_WRITEVBLK, &iosb, 0, 0, buffer, strlen(buffer), 0, 0, 0, 0); \
                    438:    if ((status & SS$_NORMAL) == SS$_NORMAL) status = iosb.stat; \
                    439:    if((status & SS$_NORMAL) != SS$_NORMAL) exit(status); \
                    440:  }
                    441:
                    442: #define PRINT0(fmt)          GO( (buffer, fmt) )
                    443: #define PRINT1(fmt,p1)       GO( (buffer, fmt,p1) )
                    444: #define PRINT2(fmt,p1,p2)    GO( (buffer, fmt,p1,p2) )
                    445: #define PRINT3(fmt,p1,p2,p3) GO( (buffer, fmt,p1,p2,p3) )
                    446: #define PRINT4(fmt,p1,p2,p3,p4) GO( (buffer, fmt,p1,p2,p3,p4) )
                    447: #define PRINT5(fmt,p1,p2,p3,p4,p5) GO( (buffer, fmt,p1,p2,p3,p4,p5) )
                    448:
                    449: #define FFLUSH()               /* nowt */
                    450: #define BEFORE_GRAPHICS                /* nowt */
                    451: #define AFTER_TEXT             /* nowt */
                    452:
                    453:     static void X11_atexit HANDLER_DECL { if (X11_channel) {
                    454:        PRINT0("R\n");
                    455:        sleep(2);               /* Wait for subprocess to finish */
                    456:        sys$dassgn(X11_channel);
                    457:        X11_channel = 0;
                    458:     }
                    459: } TERM_PUBLIC void X11_reset()
                    460: {
                    461:     /* do nothing until exit */
                    462: }
                    463:
                    464: #endif /* VMS */
                    465:
                    466:
                    467:
                    468:
                    469:
                    470: /* common stuff, using macros defined above */
                    471:
                    472:
                    473:
                    474: TERM_PUBLIC void X11_graphics()
                    475: {
                    476:     BEFORE_GRAPHICS;           /* kludge for crippled select */
                    477:
                    478:     PRINT1("G%d\n", X11_plot_number);  /* for VMS sake, keep as separate prints */
                    479:
                    480: #ifdef ULTRIX_KLUDGE
                    481:     fflush(X11_ipc);
                    482: #endif
                    483:
                    484: }
                    485:
                    486: TERM_PUBLIC void X11_text()
                    487: {
                    488:     PRINT0("E\n");
                    489:     FFLUSH();
                    490: #ifdef ULTRIX_KLUDGE
                    491:     PRINT0("E\n");
                    492:     FFLUSH();
                    493: #endif
                    494:
                    495:     AFTER_TEXT;                        /* kludge for crippled select */
                    496: }
                    497:
                    498:
                    499: TERM_PUBLIC void X11_move(x, y)
                    500: unsigned int x, y;
                    501: {
                    502:     PRINT2("M%04d%04d\n", x, y);
                    503: }
                    504:
                    505: TERM_PUBLIC void X11_vector(x, y)
                    506: unsigned int x, y;
                    507: {
                    508:     PRINT2("V%04d%04d\n", x, y);
                    509: }
                    510:
                    511: TERM_PUBLIC void X11_pointsize(ps)
                    512: double ps;
                    513: {
                    514:     PRINT2("P7%04d%04d\n",     /* size of point symbols */
                    515:           (int) (term->h_tic * ps * 0.5), (int) (term->v_tic * ps * 0.5));
                    516: }
                    517:
                    518: TERM_PUBLIC void X11_linewidth(lw)
                    519: double lw;
                    520: {
                    521:     PRINT1("W%04d\n", (int) lw);
                    522: }
                    523:
                    524: TERM_PUBLIC void X11_linetype(lt)
                    525: int lt;
                    526: {
                    527:     PRINT1("L%04d\n", lt);
                    528: }
                    529:
                    530: TERM_PUBLIC void X11_put_text(x, y, str)
                    531: unsigned int x, y;
                    532: char str[];
                    533: {
                    534:     /* badly outrange labels can overflow into text field */
                    535:     if (x < 10000 && y < 10000) {
                    536:        PRINT3("T%04d%04d%s\n", x, y, str);
                    537:     }
                    538: }
                    539:
                    540: TERM_PUBLIC int X11_justify_text(mode)
                    541: enum JUSTIFY mode;
                    542: {
                    543:     PRINT1("J%04d\n", mode);
                    544:     return (TRUE);
                    545: }
                    546:
                    547: TERM_PUBLIC void X11_point(x, y, number)
                    548: unsigned int x, y;
                    549: int number;
                    550: {
                    551:     if (number >= 0)
                    552:        number %= POINT_TYPES;
                    553:     number += 1;
                    554:     PRINT3("P%01d%04d%04d\n", number, x, y);
                    555: }
                    556:
                    557: TERM_PUBLIC void X11_fillbox(style, x, y, w, h)
                    558: int style;
                    559: unsigned int x, y, w, h;
                    560: {
                    561:     PRINT5("F%04d%04u%04u%04u%04u\n", style, x, y, w, h);
                    562: }
                    563:
                    564: #endif /* TERM_BODY */
                    565:
                    566: #ifdef TERM_TABLE
                    567:
                    568: TERM_TABLE_START(x11_driver)
                    569:     "x11", "X11 Window System",
                    570:     X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR,
                    571:     X11_VTIC, X11_HTIC, X11_options, X11_init, X11_reset,
                    572:     X11_text, null_scale, X11_graphics, X11_move, X11_vector,
                    573:     X11_linetype, X11_put_text, null_text_angle,
                    574:     X11_justify_text, X11_point, do_arrow, set_font_null,
                    575:     X11_pointsize, TERM_CAN_MULTIPLOT,
                    576:     X11_text /* suspend can use same routine */ , 0 /* resume */ ,
                    577:     X11_fillbox, X11_linewidth
                    578: TERM_TABLE_END(x11_driver)
                    579:
                    580: #undef LAST_TERM
                    581: #define LAST_TERM x11_driver
                    582:
                    583: TERM_TABLE_START(X11_driver)
                    584:     "X11", "X11 Window System (identical to x11)",
                    585:     X11_XMAX, X11_YMAX, X11_VCHAR, X11_HCHAR,
                    586:     X11_VTIC, X11_HTIC, X11_options, X11_init, X11_reset,
                    587:     X11_text, null_scale, X11_graphics, X11_move, X11_vector,
                    588:     X11_linetype, X11_put_text, null_text_angle,
                    589:     X11_justify_text, X11_point, do_arrow, set_font_null,
                    590:     X11_pointsize, TERM_CAN_MULTIPLOT,
                    591:     X11_text /* suspend can use same routine */ , 0 /* resume */ ,
                    592:     X11_fillbox, X11_linewidth
                    593: TERM_TABLE_END(X11_driver)
                    594:
                    595: #undef LAST_TERM
                    596: #define LAST_TERM x11_driver
                    597:
                    598: #endif /* TERM_TABLE */
                    599: #endif /* TERM_PROTO_ONLY */
                    600:
                    601:
                    602: #ifdef TERM_HELP
                    603: START_HELP(x11)
                    604: "1 x11",
                    605: "?commands set terminal x11",
                    606: "?set terminal x11",
                    607: "?set term x11",
                    608: "?terminal x11",
                    609: "?term x11",
                    610: "?x11",
                    611: "?X11",
                    612: " `gnuplot` provides the `x11` terminal type for use with X servers.  This",
                    613: " terminal type is set automatically at startup if the `DISPLAY` environment",
                    614: " variable is set, if the `TERM` environment variable is set to `xterm`, or",
                    615: " if the `-display` command line option is used.",
                    616: "",
                    617: " Syntax:",
                    618: "       set terminal x11 {reset} {<n>}",
                    619: "",
                    620: " Multiple plot windows are supported: `set terminal x11 <n>` directs the",
                    621: " output to plot window number n.  If n>0, the terminal number will be",
                    622: " appended to the window title and the icon will be labeled `gplt <n>`.",
                    623: " The active window may distinguished by a change in cursor (from default",
                    624: " to crosshair.)",
                    625: "",
                    626: " Plot windows remain open even when the `gnuplot` driver is changed to a",
                    627: " different device.  A plot window can be closed by pressing the letter q",
                    628: " while that window has input focus, or by choosing `close` from a window",
                    629: " manager menu.  All plot windows can be closed by specifying `reset`, which",
                    630: " actually terminates the subprocess which maintains the windows (unless",
                    631: " `-persist` was specified).",
                    632: "",
                    633: " Plot windows will automatically be closed at the end of the session",
                    634: " unless the `-persist` option was given.",
                    635: "",
                    636: " The size or aspect ratio of a plot may be changed by resizing the `gnuplot`",
                    637: " window.",
                    638: "",
                    639: " Linewidths and pointsizes may be changed from within `gnuplot` with",
                    640: " `set linestyle`.",
                    641: "",
                    642: " For terminal type `x11`, `gnuplot` accepts (when initialized) the standard",
                    643: " X Toolkit options and resources such as geometry, font, and name from the",
                    644: " command line arguments or a configuration file.  See the X(1) man page",
                    645: " (or its equivalent) for a description of such options.",
                    646: "",
                    647: " A number of other `gnuplot` options are available for the `x11` terminal.",
                    648: " These may be specified either as command-line options when `gnuplot` is",
                    649: " invoked or as resources in the configuration file \"/.Xdefaults\".  They are",
                    650: " set upon initialization and cannot be altered during a `gnuplot` session.",
                    651: "2 command-line_options",
                    652: "?commands set terminal x11 command-line-options",
                    653: "?set terminal x11 command-line-options",
                    654: "?set term x11 command-line-options",
                    655: "?x11 command-line-options",
                    656: "?command-line-options",
                    657: " In addition to the X Toolkit options, the following options may be specified",
                    658: " on the command line when starting `gnuplot` or as resources in your",
                    659: " \".Xdefaults\" file:",
                    660: "@start table - first is interactive cleartext form",
                    661: "  `-clear`   requests that the window be cleared momentarily before a",
                    662: "             new plot is displayed.",
                    663: "  `-gray`    requests grayscale rendering on grayscale or color displays.",
                    664: "             (Grayscale displays receive monochrome rendering by default.)",
                    665: "  `-mono`    forces monochrome rendering on color displays.",
                    666: "  `-persist` plot windows survive after main gnuplot program exits",
                    667: "  `-raise`   raise plot window after each plot",
                    668: "  `-noraise` do not raise plot window after each plot",
                    669: "  `-tvtwm`   requests that geometry specifications for position of the",
                    670: "             window be made relative to the currently displayed portion",
                    671: "             of the virtual root.",
                    672: "#\\begin{tabular}{|cl|} \\hline",
                    673: "#`-mono`  & forces monochrome rendering on color displays.\\\\",
                    674: "#`-gray`  & requests grayscale rendering on grayscale or color displays.\\\\",
                    675: "#         & (Grayscale displays receive monochrome rendering by default.) \\\\",
                    676: "#`-clear` & requests that the window be cleared momentarily before a\\\\",
                    677: "#         & new plot is displayed. \\\\",
                    678: "#`-tvtwm` & requests that geometry specifications for position of the\\\\",
                    679: "#         & window be made relative to the currently displayed portion\\\\",
                    680: "#         & of the virtual root. \\\\",
                    681: "#`-raise` & raise plot window after each plot. \\\\",
                    682: "#`-noraise` & do not raise plot window after each plot. \\\\",
                    683: "#`-persist`&plot windows survive after main gnuplot program exits. \\\\",
                    684: "%c l .",
                    685: "%`-mono`@forces monochrome rendering on color displays.",
                    686: "%`-gray`@requests grayscale rendering on grayscale or color displays.",
                    687: "%       @(Grayscale displays receive monochrome rendering by default.)",
                    688: "%`-clear`@requests that the window be cleared momentarily before a",
                    689: "%        @new plot is displayed.",
                    690: "%`-tvtwm`@requests that geometry specifications for position of the",
                    691: "%        @window be made relative to the currently displayed portion",
                    692: "%        @of the virtual root.",
                    693: "%`-raise`@raise plot window after each plot",
                    694: "%`-noraise`@do not raise plot window after each plot",
                    695: "%`-persist`@plot windows survive after main gnuplot program exits",
                    696: "@end table",
                    697: " The options are shown above in their command-line syntax.  When entered as",
                    698: " resources in \".Xdefaults\", they require a different syntax.",
                    699: "",
                    700: " Example:",
                    701: "       gnuplot*gray: on",
                    702: "",
                    703: " `gnuplot` also provides a command line option (`-pointsize <v>`) and a",
                    704: " resource, `gnuplot*pointsize: <v>`, to control the size of points plotted",
                    705: " with the `points` plotting style.  The value `v` is a real number (greater",
                    706: " than 0 and less than or equal to ten) used as a scaling factor for point",
                    707: " sizes.  For example, `-pointsize 2` uses points twice the default size, and",
                    708: " `-pointsize 0.5` uses points half the normal size.",
                    709: "2 monochome_options",
                    710: "?commands set terminal x11 monochrome_options",
                    711: "?set terminal x11 monochrome_options",
                    712: "?set term x11 monochrome_options",
                    713: "?x11 monochrome_options",
                    714: "?monochrome_options",
                    715: " For monochrome displays, `gnuplot` does not honor foreground or background",
                    716: " colors.  The default is black-on-white.  `-rv` or `gnuplot*reverseVideo: on`",
                    717: " requests white-on-black.",
                    718: "",
                    719: "2 color_resources",
                    720: "?commands set terminal x11 color_resources",
                    721: "?set terminal x11 color_resources",
                    722: "?set term x11 color_resources",
                    723: "?x11 color_resources",
                    724: "?color_resources",
                    725: " For color displays, `gnuplot` honors the following resources (shown here",
                    726: " with their default values) or the greyscale resources.  The values may be",
                    727: " color names as listed in the X11 rgb.txt file on your system, hexadecimal",
                    728: " RGB color specifications (see X11 documentation), or a color name followed",
                    729: " by a comma and an `intensity` value from 0 to 1.  For example, `blue, 0.5`",
                    730: " means a half intensity blue.",
                    731: "@start table - first is interactive cleartext form",
                    732: "  gnuplot*background:  white",
                    733: "  gnuplot*textColor:   black",
                    734: "  gnuplot*borderColor: black",
                    735: "  gnuplot*axisColor:   black",
                    736: "  gnuplot*line1Color:  red",
                    737: "  gnuplot*line2Color:  green",
                    738: "  gnuplot*line3Color:  blue",
                    739: "  gnuplot*line4Color:  magenta",
                    740: "  gnuplot*line5Color:  cyan",
                    741: "  gnuplot*line6Color:  sienna",
                    742: "  gnuplot*line7Color:  orange",
                    743: "  gnuplot*line8Color:  coral",
                    744: "#\\begin{tabular}{|cl|} \\hline",
                    745: "#&gnuplot*background: white\\\\",
                    746: "#&gnuplot*textColor: black\\\\",
                    747: "#&gnuplot*borderColor: black\\\\",
                    748: "#&gnuplot*axisColor: black\\\\",
                    749: "#&gnuplot*line1Color: red\\\\",
                    750: "#&gnuplot*line2Color: green\\\\",
                    751: "#&gnuplot*line3Color: blue\\\\",
                    752: "#&gnuplot*line4Color: magenta\\\\",
                    753: "#&gnuplot*line5Color: cyan\\\\",
                    754: "#&gnuplot*line6Color: sienna\\\\",
                    755: "#&gnuplot*line7Color: orange\\\\",
                    756: "#&gnuplot*line8Color: coral\\\\",
                    757: "%c l .",
                    758: "%@gnuplot*background: white",
                    759: "%@gnuplot*textColor: black",
                    760: "%@gnuplot*borderColor: black",
                    761: "%@gnuplot*axisColor: black",
                    762: "%@gnuplot*line1Color: red",
                    763: "%@gnuplot*line2Color: green",
                    764: "%@gnuplot*line3Color: blue",
                    765: "%@gnuplot*line4Color: magenta",
                    766: "%@gnuplot*line5Color: cyan",
                    767: "%@gnuplot*line6Color: sienna",
                    768: "%@gnuplot*line7Color: orange",
                    769: "%@gnuplot*line8Color: coral",
                    770: "@end table",
                    771: "",
                    772: " The command-line syntax for these is, for example,",
                    773: "",
                    774: " Example:",
                    775: "       gnuplot -background coral",
                    776: "",
                    777: "2 grayscale_resources",
                    778: "?commands set terminal x11 grayscale_resources",
                    779: "?set terminal x11 grayscale_resources",
                    780: "?set term x11 grayscale_resources",
                    781: "?x11 grayscale_resources",
                    782: "?grayscale_resources",
                    783: " When `-gray` is selected, `gnuplot` honors the following resources for",
                    784: " grayscale or color displays (shown here with their default values).  Note",
                    785: " that the default background is black.",
                    786: "@start table - first is interactive cleartext form",
                    787: "  gnuplot*background: black",
                    788: "  gnuplot*textGray:   white",
                    789: "  gnuplot*borderGray: gray50",
                    790: "  gnuplot*axisGray:   gray50",
                    791: "  gnuplot*line1Gray:  gray100",
                    792: "  gnuplot*line2Gray:  gray60",
                    793: "  gnuplot*line3Gray:  gray80",
                    794: "  gnuplot*line4Gray:  gray40",
                    795: "  gnuplot*line5Gray:  gray90",
                    796: "  gnuplot*line6Gray:  gray50",
                    797: "  gnuplot*line7Gray:  gray70",
                    798: "  gnuplot*line8Gray:  gray30",
                    799: "#\\begin{tabular}{|cl|} \\hline",
                    800: "#&gnuplot*background: black\\\\",
                    801: "#&gnuplot*textGray: white\\\\",
                    802: "#&gnuplot*borderGray: gray50\\\\",
                    803: "#&gnuplot*axisGray: gray50\\\\",
                    804: "#&gnuplot*line1Gray: gray100\\\\",
                    805: "#&gnuplot*line2Gray: gray60\\\\",
                    806: "#&gnuplot*line3Gray: gray80\\\\",
                    807: "#&gnuplot*line4Gray: gray40\\\\",
                    808: "#&gnuplot*line5Gray: gray90\\\\",
                    809: "#&gnuplot*line6Gray: gray50\\\\",
                    810: "#&gnuplot*line7Gray: gray70\\\\",
                    811: "#&gnuplot*line8Gray: gray30\\\\",
                    812: "%c l .",
                    813: "%@gnuplot*background: black",
                    814: "%@gnuplot*textGray: white",
                    815: "%@gnuplot*borderGray: gray50",
                    816: "%@gnuplot*axisGray: gray50",
                    817: "%@gnuplot*line1Gray: gray100",
                    818: "%@gnuplot*line2Gray: gray60",
                    819: "%@gnuplot*line3Gray: gray80",
                    820: "%@gnuplot*line4Gray: gray40",
                    821: "%@gnuplot*line5Gray: gray90",
                    822: "%@gnuplot*line6Gray: gray50",
                    823: "%@gnuplot*line7Gray: gray70",
                    824: "%@gnuplot*line8Gray: gray30",
                    825: "@end table",
                    826: "",
                    827: "2 line_resources",
                    828: "?commands set terminal x11 line_resources",
                    829: "?set terminal x11 line_resources",
                    830: "?set term x11 line_resources",
                    831: "?x11 line_resources",
                    832: "?line_resources",
                    833: " `gnuplot` honors the following resources for setting the width (in pixels) of",
                    834: " plot lines (shown here with their default values.)  0 or 1 means a minimal",
                    835: " width line of 1 pixel width.  A value of 2 or 3 may improve the appearance of",
                    836: " some plots.",
                    837: "@start table - first is interactive cleartext form",
                    838: "  gnuplot*borderWidth: 2",
                    839: "  gnuplot*axisWidth:   0",
                    840: "  gnuplot*line1Width:  0",
                    841: "  gnuplot*line2Width:  0",
                    842: "  gnuplot*line3Width:  0",
                    843: "  gnuplot*line4Width:  0",
                    844: "  gnuplot*line5Width:  0",
                    845: "  gnuplot*line6Width:  0",
                    846: "  gnuplot*line7Width:  0",
                    847: "  gnuplot*line8Width:  0",
                    848: "#\\begin{tabular}{|cl|} \\hline",
                    849: "#&gnuplot*borderWidth: 2\\\\",
                    850: "#&gnuplot*axisWidth: 0\\\\",
                    851: "#&gnuplot*line1Width: 0\\\\",
                    852: "#&gnuplot*line2Width: 0\\\\",
                    853: "#&gnuplot*line3Width: 0\\\\",
                    854: "#&gnuplot*line4Width: 0\\\\",
                    855: "#&gnuplot*line5Width: 0\\\\",
                    856: "#&gnuplot*line6Width: 0\\\\",
                    857: "#&gnuplot*line7Width: 0\\\\",
                    858: "#&gnuplot*line8Width: 0\\\\",
                    859: "%c l .",
                    860: "%@gnuplot*borderWidth: 2",
                    861: "%@gnuplot*axisWidth: 0",
                    862: "%@gnuplot*line1Width: 0",
                    863: "%@gnuplot*line2Width: 0",
                    864: "%@gnuplot*line3Width: 0",
                    865: "%@gnuplot*line4Width: 0",
                    866: "%@gnuplot*line5Width: 0",
                    867: "%@gnuplot*line6Width: 0",
                    868: "%@gnuplot*line7Width: 0",
                    869: "%@gnuplot*line8Width: 0",
                    870: "@end table",
                    871: "",
                    872: " `gnuplot` honors the following resources for setting the dash style used for",
                    873: " plotting lines.  0 means a solid line.  A two-digit number `jk` (`j` and `k`",
                    874: " are >= 1  and <= 9) means a dashed line with a repeated pattern of `j` pixels",
                    875: " on followed by `k` pixels off.  For example, '16' is a \"dotted\" line with one",
                    876: " pixel on followed by six pixels off.  More elaborate on/off patterns can be",
                    877: " specified with a four-digit value.  For example, '4441' is four on, four off,",
                    878: " four on, one off.  The default values shown below are for monochrome displays",
                    879: " or monochrome rendering on color or grayscale displays.  For color displays,",
                    880: " the default for each is 0 (solid line) except for `axisDashes` which defaults",
                    881: " to a '16' dotted line.",
                    882: "@start table - first is interactive cleartext form",
                    883: "  gnuplot*borderDashes:   0",
                    884: "  gnuplot*axisDashes:    16",
                    885: "  gnuplot*line1Dashes:    0",
                    886: "  gnuplot*line2Dashes:   42",
                    887: "  gnuplot*line3Dashes:   13",
                    888: "  gnuplot*line4Dashes:   44",
                    889: "  gnuplot*line5Dashes:   15",
                    890: "  gnuplot*line6Dashes: 4441",
                    891: "  gnuplot*line7Dashes:   42",
                    892: "  gnuplot*line8Dashes:   13",
                    893: "#\\begin{tabular}{|cl|} \\hline",
                    894: "#&gnuplot*borderDashes: 0\\\\",
                    895: "#&gnuplot*axisDashes: 16\\\\",
                    896: "#&gnuplot*line1Dashes: 0\\\\",
                    897: "#&gnuplot*line2Dashes: 42\\\\",
                    898: "#&gnuplot*line3Dashes: 13\\\\",
                    899: "#&gnuplot*line4Dashes: 44\\\\",
                    900: "#&gnuplot*line5Dashes: 15\\\\",
                    901: "#&gnuplot*line6Dashes: 4441\\\\",
                    902: "#&gnuplot*line7Dashes: 42\\\\",
                    903: "#&gnuplot*line8Dashes: 13\\\\",
                    904: "%c l .",
                    905: "%@gnuplot*borderDashes: 0",
                    906: "%@gnuplot*axisDashes: 16",
                    907: "%@gnuplot*line1Dashes: 0",
                    908: "%@gnuplot*line2Dashes: 42",
                    909: "%@gnuplot*line3Dashes: 13",
                    910: "%@gnuplot*line4Dashes: 44",
                    911: "%@gnuplot*line5Dashes: 15",
                    912: "%@gnuplot*line6Dashes: 4441",
                    913: "%@gnuplot*line7Dashes: 42",
                    914: "%@gnuplot*line8Dashes: 13",
                    915: "@end table"
                    916: END_HELP(x11)
                    917: #endif /* TERM_HELP */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>