linemod.c revision b7d62af5b42f0da2eb668e8d33d24d2f4fdd98a8
2N/A/*
2N/A * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A */
2N/A
2N/A/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
2N/A/* All Rights Reserved */
2N/A
2N/A/*
2N/A * Copyright (c) 1980 Regents of the University of California.
2N/A * All rights reserved. The Berkeley software License Agreement
2N/A * specifies the terms and conditions for redistribution.
2N/A */
2N/A
2N/A#pragma ident "%Z%%M% %I% %E% SMI"
2N/A
2N/A#include "hp7221.h"
2N/A
2N/Avoid
2N/Alinemod(char *line)
2N/A{
2N/A /*
2N/A * Note that the bit patterns could be compacted using the
2N/A * repeat field conventions. They aren't for clarity.
2N/A * Examples of almost identical packed patterns are in the
2N/A * comments.
2N/A * If linemod is changed really often, a ~15% savings
2N/A * could be achieved.
2N/A */
2N/A if ( *(line) == 's' ) {
2N/A if ( *(++line) == 'o' ) {
2N/A /*
2N/A * solid mode 1
2N/A */
2N/A printf( "vA" );
2N/A return;
2N/A }
2N/A else if ( *(line) == 'h' ) {
2N/A /*
2N/A * shortdashed mode 4
2N/A */
2N/A printf( "vD" );
2N/A return;
2N/A }
2N/A }
2N/A else if ( *(line) == 'd' ) {
2N/A if ( *(++line) == 'o' && *(++line) == 't' ) {
2N/A if ( *(++line) == 't' ) {
2N/A /*
2N/A * dotted mode 2
2N/A * printf( "W(P00001)" );
2N/A */
2N/A printf( "vB" );
2N/A return;
2N/A }
2N/A else if ( *(line) == 'd' ) {
2N/A /*
2N/A * dotdashed mode 3
2N/A * printf( "W(P0110010)" );
2N/A */
2N/A printf( "vC" );
2N/A return;
2N/A }
2N/A }
2N/A }
2N/A else if ( *(line) == 'l' ) {
2N/A /*
2N/A * longdashed mode 5
2N/A * printf( "W(P11100)" );
2N/A */
2N/A printf( "vE" );
2N/A return;
2N/A }
2N/A printf( "vA" );
2N/A return;
2N/A}
2N/A