⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prbar.tsh

📁 表格线打印算法C语言源程序
💻 TSH
字号:
/*
 * 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);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -