xref: /original-bsd/lib/libplot/hp7221/linemod.c (revision c3e32dec)
1 /*-
2  * Copyright (c) 1980, 1993
3  *	The Regents of the University of California.  All rights reserved.
4  *
5  * %sccs.include.proprietary.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)linemod.c	8.1 (Berkeley) 06/04/93";
10 #endif /* not lint */
11 
12 #include "hp7221.h"
13 
14 linemod( line )
15 char	*line;
16 {
17 	/*
18 	 * Note that the bit patterns could be compacted using the
19 	 *  repeat field conventions.  They aren't for clarity.
20 	 *  Examples of almost identical packed patterns are in the
21 	 *  comments.
22 	 *  If linemod is changed really often, a ~15% savings
23 	 *  could be achieved.
24 	 */
25 	if ( *(line) == 's' ) {
26 		if ( *(++line) == 'o' ) {
27 			/*
28 			 * solid mode 1
29 			 */
30 			printf( "vA" );
31 			return;
32 		}
33 		else if ( *(line) == 'h' ) {
34 			/*
35 			 * shortdashed mode 4
36 			 */
37 			printf( "vD" );
38 			return;
39 		}
40 	}
41 	else if ( *(line) == 'd' ) {
42 		if ( *(++line) == 'o' && *(++line) == 't' ) {
43 			if ( *(++line) == 't' ) {
44 				/*
45 				 * dotted mode 2
46 				 *  printf( "W(P00001)" );
47 				 */
48 				printf( "vB" );
49 				return;
50 			}
51 			else if ( *(line) == 'd' ) {
52 				/*
53 				 * dotdashed mode 3
54 				 *  printf( "W(P0110010)" );
55 				 */
56 				printf( "vC" );
57 				return;
58 			}
59 		}
60 	}
61 	else if ( *(line) == 'l' ) {
62 		/*
63 		 * longdashed mode 5
64 		 *  printf( "W(P11100)" );
65 		 */
66 		printf( "vE" );
67 		return;
68 	}
69 	printf( "vA" );
70 	return;
71 }
72