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