xref: /csrg-svn/lib/libplot/gigi/linemod.c (revision 15492)
1 #ifndef lint
2 static char sccsid[] = "@(#)linemod.c	4.1 (Berkeley) 11/10/83";
3 #endif
4 
5 #include "gigi.h"
6 
7 linemod( line )
8 char	*line;
9 {
10 	/*
11 	 * Note that the bit patterns could be compacted using the
12 	 *  repeat field conventions.  They aren't for clarity.
13 	 *  Examples of almost identical packed patterns are in the
14 	 *  comments.
15 	 *  If linemod is changed really often, a ~15% savings
16 	 *  could be achieved.
17 	 */
18 	if ( *(line) == 's' ) {
19 		if ( *(++line) == 'o' ) {
20 			/*
21 			 * solid mode 1
22 			 */
23 			printf( "W(P1)" );
24 			return;
25 		}
26 		else if ( *(line) == 'h' ) {
27 			/*
28 			 * shortdashed mode 4
29 			 *  printf( "W(P000111)" );
30 			 */
31 			printf( "W(P00011100)" );
32 			return;
33 		}
34 	}
35 	else if ( *(line) == 'd' ) {
36 		if ( *(++line) == 'o' && *(++line) == 't' ) {
37 			if ( *(++line) == 't' ) {
38 				/*
39 				 * dotted mode 2
40 				 *  printf( "W(P00001)" );
41 				 */
42 				printf( "W(P10000000)" );
43 				return;
44 			}
45 			else if ( *(line) == 'd' ) {
46 				/*
47 				 * dotdashed mode 3
48 				 *  printf( "W(P0110010)" );
49 				 */
50 				printf( "W(P10001100)" );
51 				return;
52 			}
53 		}
54 	}
55 	else if ( *(line) == 'l' ) {
56 		/*
57 		 * longdashed mode 5
58 		 *  printf( "W(P11100)" );
59 		 */
60 		printf( "W(P11111100)" );
61 		return;
62 	}
63 	printf( "W(P1)" );			/* default to solid */
64 	return;
65 }
66