File: gsshcm.c

package info (click to toggle)
pact 980714-3
  • links: PTS
  • area: main
  • in suites: slink
  • size: 13,096 kB
  • ctags: 26,034
  • sloc: ansic: 109,076; lisp: 9,645; csh: 7,147; fortran: 1,050; makefile: 136; lex: 95; sh: 32
file content (120 lines) | stat: -rw-r--r-- 2,779 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/*
 * GSSHCM.C - display the device colormap
 *
 * Source Version: 2.0
 * Software Release #92-0043
 *
 */

#include "cpyright.h"

#include "pgs.h"

#define SHOW_MAP 1
#define SHOW_PAL 2
#define MAKE_PAL 3
#define DUMP_MAP 4

/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/

main(c, v)
   int c;
   char **v;
   {char device[MAXLINE];
    int i, nc, mode, wbck;

    wbck = TRUE;
    nc   = 16;
    mode = MAKE_PAL;
    strcpy(device, "WINDOW");

#ifndef MAC

    for (i = 1; v[i] != NULL; i++)
        {if (v[i][0] == '-')
            {switch (v[i][1])
	        {case 'b' :
		      wbck = FALSE;
		      break;

                 case 'c' :
		      strcpy(device, "CGM");
		      break;

                 case 'd' :
		      mode = DUMP_MAP;
		      break;

                 case 'h' :
		      help();
		      return(1);

                 case 'm' :
		      mode = MAKE_PAL;
		      nc = SC_stoi(v[++i]);
		      break;

                 case 'p' :
		      mode = SHOW_PAL;
		      break;

                 case 's' :
		      strcpy(device, "PS");
		      break;

                 case 't' :
		      mode = SHOW_MAP;
		      break;

                 case 'w' :
		      wbck = TRUE;
		      break;};}
         else
            break;};

#endif

    switch (mode)
       {case SHOW_MAP :
	     PG_show_colormap(device, wbck);
	     break;

        case DUMP_MAP :
	     PG_dump_colormap(device, "device.colors");
	     break;

        case SHOW_PAL :
	     PG_show_palettes(NULL, device, wbck);
	     break;

        case MAKE_PAL :
	     PG_make_palette(NULL, NULL, nc, wbck);
	     break;};

    exit(0);}

/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/

/* HELP - print the help info */

help()
   {printf("\nUsage: gsshcm [-c | -s] [-m <# colors> | -p | -t] [ -b | -w]\n");
    printf("   Show various aspects of the color handling in PGS.\n");
    printf("   Options:\n");
    printf("      b - use black background\n");
    printf("      c - put the color map or palettes out to a CGM file\n");
    printf("      h - print this help message\n");
    printf("      s - put the color map or palettes out to a PostScript file\n");
    printf("      w - use white background (default)\n");
    printf("\n");
    printf("      m - make a new palette\n");
    printf("      p - show the built in palettes\n");
    printf("      t - show the root PGS color table\n");
    printf("\n");

    return(0);}

/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/