home *** CD-ROM | disk | FTP | other *** search
- /*
- * prbar - print a thick or thin line or space
- * TOSH/QUME version (P321)
- * written 1987 David J. Rodman
- * Paradise Technology, Inc.
- */
-
- #include <stdio.h>
- extern int res, depth; /* settings for width and heigth of barcode */
- static char *str; /* the string to encode */
- extern char *text[]; /* text for the right-hand part of label */
- extern lineno; /* current line of label */
-
-
- /*
- * initialize the printer as required to print string s
- */
- prinit(s)
- char *s;
- {
- char *asclen(); /* convert string length to ascii chars */
- int n;
-
- str = s;
- n = 16 * res * (strlen(s) + 2); /* total # of graphic bytes */
- printf("%c%c%c", 0x1b, 0x1e, 7); /* 8 lpi */
- printf("%c>", 0x1b); /* no bidirectional print */
- printf("%c;%s", 0x1b, asclen(n)); /* enter graphics mode */
- }
-
- /*
- * print bottom line defined as text[0]
- */
- prfini()
- {
- int i;
-
- printf("\n%s\n", text[0]);
- }
-
- static char *asclen(n)
- {
- static char buf[5];
- char *p;
-
- sprintf(buf, "%4d", n);
- for(p = &buf[0]; *p == ' '; p++)
- *p = '0';
- return &buf[0];
- }
-
- /*
- * print an individual line or space, thick or thin
- * args are boolean
- */
- prbar(thick, line)
- {
- int w, c;
-
- w = res * (thick ? 3 : 1);
- c = line ? 0xff : 0;
- while(w--)
- printf("%c%c%c%c", c, c, c, c);
- }
-
- /*
- * move down one line, printing the appropriate text
- */
- prdown()
- {
- printf(" %s", text[lineno++]);
- printf("%c%c", 0x0d, 0x0a);
- }
-
-