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

📄 driver.c

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 C
字号:
#ifndef lintstatic	char	*sccsid = "@(#)driver.c	4.1	(ULTRIX)	7/17/90";#endif lint/************************************************************************ *									* *			Copyright (c) 1985 by				* *		Digital Equipment Corporation, Maynard, MA		* *			All rights reserved.				* *									* *   This software is furnished under a license and may be used and	* *   copied  only  in accordance with the terms of such license and	* *   with the  inclusion  of  the  above  copyright  notice.   This	* *   software  or  any  other copies thereof may not be provided or	* *   otherwise made available to any other person.  No title to and	* *   ownership of the software is hereby transferred.			* *									* *   This software is  derived  from  software  received  from  the	* *   University    of   California,   Berkeley,   and   from   Bell	* *   Laboratories.  Use, duplication, or disclosure is  subject  to	* *   restrictions  under  license  agreements  with  University  of	* *   California and with AT&T.						* *									* *   The information in this software is subject to change  without	* *   notice  and should not be construed as a commitment by Digital	* *   Equipment Corporation.						* *									* *   Digital assumes no responsibility for the use  or  reliability	* *   of its software on equipment which is not supplied by Digital.	* *									* ************************************************************************//* *			Modification History				 *									 *	David L Ballenger, 25-Apr-1985					 * 001	Change name of local function gets() to getstr() to prevent	 *	conflicts with gets() function from <stdio.h>.			 * 									 *	Pradeep Chetal, 10-April-1989					 * 002  Added '-r' option from 4.3BSD for resolution, and added '-c' option *	to specify initial color for certain devices (plotters). *	The -c option is used only for LVP16's at present. *	Also added 'xmax' and 'ymax' parameters which are defined in the *	device LVP16 libraries. These take advantage of the '-l' & '-w' options *	passed to plot(1) which were never used otherwise. */#include <stdio.h>#ifdef LVP16extern int xmax;extern int ymax;#endif LVP16float deltx;float delty;int PlotRes;int colour = 1;main(argc,argv)       int argc;     char **argv; {	int std=1;	FILE *fin;	while(argc-- > 1) {		if(*argv[1] == '-')			switch(argv[1][1]) {				case 'l':#ifdef LVP16					xmax = atoi(&argv[1][2]);#endif LVP16					deltx = atoi(&argv[1][2]) - 1;					break;				case 'w':#ifdef LVP16					ymax = atoi(&argv[1][2]);#endif LVP16					delty = atoi(&argv[1][2]) - 1;					break;				case 'r':					PlotRes = atoi(&argv[1][2]);					break;				case 'c':					colour = atoi(&argv[1][2]);					break;				}		else {			std = 0;			if ((fin = fopen(argv[1], "r")) == NULL) {				fprintf(stderr, "can't open %s\n", argv[1]);				exit(1);				}			fplt(fin);			}		argv++;		}	if (std)		fplt( stdin );	exit(0);	}fplt(fin)  FILE *fin; {	int c;	char s[256];	int xi,yi,x0,y0,x1,y1,r,dx,n,i;	int pat[256];	openpl();#ifdef LVP16	if (colour != 1) color(colour);#endif LVP16	while((c=getc(fin)) != EOF){		switch(c){		case 'm':			xi = getsi(fin);			yi = getsi(fin);			move(xi,yi);			break;		case 'l':			x0 = getsi(fin);			y0 = getsi(fin);			x1 = getsi(fin);			y1 = getsi(fin);			line(x0,y0,x1,y1);			break;		case 't':			getstr(s,fin);			label(s);			break;		case 'e':			erase();			break;		case 'p':			xi = getsi(fin);			yi = getsi(fin);			point(xi,yi);			break;		case 'n':			xi = getsi(fin);			yi = getsi(fin);			cont(xi,yi);			break;		case 's':			x0 = getsi(fin);			y0 = getsi(fin);			x1 = getsi(fin);			y1 = getsi(fin);			space(x0,y0,x1,y1);			break;		case 'a':			xi = getsi(fin);			yi = getsi(fin);			x0 = getsi(fin);			y0 = getsi(fin);			x1 = getsi(fin);			y1 = getsi(fin);			arc(xi,yi,x0,y0,x1,y1);			break;		case 'c':			xi = getsi(fin);			yi = getsi(fin);			r = getsi(fin);			circle(xi,yi,r);			break;		case 'f':			getstr(s,fin);			linemod(s);			break;		case 'd':			xi = getsi(fin);			yi = getsi(fin);			dx = getsi(fin);			n = getsi(fin);			for(i=0; i<n; i++)pat[i] = getsi(fin);			dot(xi,yi,dx,n,pat);			break;			}		}	closepl();	}getsi(fin)  FILE *fin; {	/* get an integer stored in 2 ascii bytes. */	short a, b;	if((b = getc(fin)) == EOF)		return(EOF);	if((a = getc(fin)) == EOF)		return(EOF);	a = a<<8;	return(a|b);}getstr(s,fin)  char *s;  FILE *fin; {	for( ; *s = getc(fin); s++)		if(*s == '\n')			break;	*s = '\0';	return;}

⌨️ 快捷键说明

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