BSD 4_3 release
[unix-history] / usr / src / usr.lib / libplot / gigi / linemod.c
CommitLineData
dca25f5a
DF
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
ad1adeeb 7#ifndef lint
95f51977 8static char sccsid[] = "@(#)linemod.c 5.1 (Berkeley) 5/7/85";
dca25f5a 9#endif not lint
ad1adeeb
RC
10
11#include "gigi.h"
12
13linemod( line )
14char *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( "W(P1)" );
30 return;
31 }
32 else if ( *(line) == 'h' ) {
33 /*
34 * shortdashed mode 4
35 * printf( "W(P000111)" );
36 */
37 printf( "W(P00011100)" );
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( "W(P10000000)" );
49 return;
50 }
51 else if ( *(line) == 'd' ) {
52 /*
53 * dotdashed mode 3
54 * printf( "W(P0110010)" );
55 */
56 printf( "W(P10001100)" );
57 return;
58 }
59 }
60 }
61 else if ( *(line) == 'l' ) {
62 /*
63 * longdashed mode 5
64 * printf( "W(P11100)" );
65 */
66 printf( "W(P11111100)" );
67 return;
68 }
69 printf( "W(P1)" ); /* default to solid */
70 return;
71}