xref: /original-bsd/lib/libplot/hp7221/linemod.c (revision 6219b5e8)
1 #ifndef lint
2 static char sccsid[] = "@(#)linemod.c	4.1 (Berkeley) 11/10/83";
3 #endif
4 
5 #include "hp7221.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( "vA" );
24 			return;
25 		}
26 		else if ( *(line) == 'h' ) {
27 			/*
28 			 * shortdashed mode 4
29 			 */
30 			printf( "vD" );
31 			return;
32 		}
33 	}
34 	else if ( *(line) == 'd' ) {
35 		if ( *(++line) == 'o' && *(++line) == 't' ) {
36 			if ( *(++line) == 't' ) {
37 				/*
38 				 * dotted mode 2
39 				 *  printf( "W(P00001)" );
40 				 */
41 				printf( "vB" );
42 				return;
43 			}
44 			else if ( *(line) == 'd' ) {
45 				/*
46 				 * dotdashed mode 3
47 				 *  printf( "W(P0110010)" );
48 				 */
49 				printf( "vC" );
50 				return;
51 			}
52 		}
53 	}
54 	else if ( *(line) == 'l' ) {
55 		/*
56 		 * longdashed mode 5
57 		 *  printf( "W(P11100)" );
58 		 */
59 		printf( "vE" );
60 		return;
61 	}
62 	printf( "vA" );
63 	return;
64 }
65