xref: /csrg-svn/lib/libplot/hp7221/linemod.c (revision 19978)
1*19978Sdist /*
2*19978Sdist  * Copyright (c) 1980 Regents of the University of California.
3*19978Sdist  * All rights reserved.  The Berkeley software License Agreement
4*19978Sdist  * specifies the terms and conditions for redistribution.
5*19978Sdist  */
6*19978Sdist 
715473Sralph #ifndef lint
8*19978Sdist static char sccsid[] = "@(#)linemod.c	5.1 (Berkeley) 05/07/85";
9*19978Sdist #endif not lint
1015473Sralph 
1115473Sralph #include "hp7221.h"
1215473Sralph 
1315473Sralph linemod( line )
1415473Sralph char	*line;
1515473Sralph {
1615473Sralph 	/*
1715473Sralph 	 * Note that the bit patterns could be compacted using the
1815473Sralph 	 *  repeat field conventions.  They aren't for clarity.
1915473Sralph 	 *  Examples of almost identical packed patterns are in the
2015473Sralph 	 *  comments.
2115473Sralph 	 *  If linemod is changed really often, a ~15% savings
2215473Sralph 	 *  could be achieved.
2315473Sralph 	 */
2415473Sralph 	if ( *(line) == 's' ) {
2515473Sralph 		if ( *(++line) == 'o' ) {
2615473Sralph 			/*
2715473Sralph 			 * solid mode 1
2815473Sralph 			 */
2915473Sralph 			printf( "vA" );
3015473Sralph 			return;
3115473Sralph 		}
3215473Sralph 		else if ( *(line) == 'h' ) {
3315473Sralph 			/*
3415473Sralph 			 * shortdashed mode 4
3515473Sralph 			 */
3615473Sralph 			printf( "vD" );
3715473Sralph 			return;
3815473Sralph 		}
3915473Sralph 	}
4015473Sralph 	else if ( *(line) == 'd' ) {
4115473Sralph 		if ( *(++line) == 'o' && *(++line) == 't' ) {
4215473Sralph 			if ( *(++line) == 't' ) {
4315473Sralph 				/*
4415473Sralph 				 * dotted mode 2
4515473Sralph 				 *  printf( "W(P00001)" );
4615473Sralph 				 */
4715473Sralph 				printf( "vB" );
4815473Sralph 				return;
4915473Sralph 			}
5015473Sralph 			else if ( *(line) == 'd' ) {
5115473Sralph 				/*
5215473Sralph 				 * dotdashed mode 3
5315473Sralph 				 *  printf( "W(P0110010)" );
5415473Sralph 				 */
5515473Sralph 				printf( "vC" );
5615473Sralph 				return;
5715473Sralph 			}
5815473Sralph 		}
5915473Sralph 	}
6015473Sralph 	else if ( *(line) == 'l' ) {
6115473Sralph 		/*
6215473Sralph 		 * longdashed mode 5
6315473Sralph 		 *  printf( "W(P11100)" );
6415473Sralph 		 */
6515473Sralph 		printf( "vE" );
6615473Sralph 		return;
6715473Sralph 	}
6815473Sralph 	printf( "vA" );
6915473Sralph 	return;
7015473Sralph }
71