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

📄 drawbox.c

📁 speech signal process tools
💻 C
字号:
/*----------------------------------------------------------------------+|									||   This material contains proprietary software of Entropic Speech,	||   Inc.  Any reproduction, distribution, or publication without the	||   prior written permission of Entropic Speech, Inc. is strictly	||   prohibited.  Any public distribution of copies of this work		||   authorized in writing by Entropic Speech, Inc. must bear the	||   notice								||									||         "Copyright (c) 1986, 1987, 1989 Entropic Speech, Inc.		||                         All rights reserved."				||									|+-----------------------------------------------------------------------+|									||  draw_box -- draw labeled box in a form suitable for plotas		||									||  Shankar Narayan, EPI							||  Adapted by Joseph T. Buck. 						||									|+----------------------------------------------------------------------*/#ifndef lint    static char *sccs_id = "@(#)drawbox.c	3.4	10/9/89	ESI";#endif#include <stdio.h>#include <esps/unix.h>#include <esps/esps.h>#define Printf (void) printfdraw_box (xmin, xmax, xstep, xdp, ymin, ymax, ystep, ydp, nogrid)    double  xmin, xmax, xstep;    int     xdp;    double  ymin, ymax, ystep;    int     ydp;    int	    nogrid;  /* no horiz grid if nogrid == 1 */{    char    xfmt[10], yfmt[10];    char    label[50];    double  tmp;    int     ix, iy;    Sprintf(xfmt, "%%.%df", xdp);	/* variable width (centered) */    Sprintf(yfmt, "%%5.%df", ydp);	/* fixed min width (right justified) */    Printf ("\nc 1\n");    Printf ("m 500 500\n");    Printf ("d 500 5500\nd 3000 5500\nd 3000 500\nd  500 500\n");    Printf ("c 2\n"); /* Draw vertical grid */    for (tmp = xmin; tmp <= xmax; tmp = tmp + xstep) {	ix = 500 + 5000 * (tmp - xmin) / (xmax - xmin);	Printf ("m 500 %4d\n", ix);	Printf ("d 3000 %4d\n", ix);	Sprintf (label, xfmt, tmp);	Printf ("m 3200 %4d\nt 5 1\n", ix - 40*strlen(label));			/* 1/2 width of size 5 character is 40 */	Printf ("%s\n", label);    } /* Draw ticks */    for (tmp = xmin + xstep / 2; tmp <= xmax; tmp = tmp + xstep) {	ix = 500 + 5000 * (tmp - xmin) / (xmax - xmin);	Printf ("m 475 %4d\n", ix);	Printf ("d 525 %4d\n", ix);	Printf ("m 2975 %4d\n", ix);	Printf ("d 3025 %4d\n", ix);    } /* Draw horizontal grid */    for (tmp = ymin; tmp <= ymax; tmp = tmp + ystep) {	iy = 3000 - 2500 * (tmp - ymin) / (ymax - ymin);	if (nogrid)		Printf ("m %4d 500\n", iy);	else {		Printf ("m %4d 5500\n", iy);		Printf ("d %4d 500\n", iy);	}	Sprintf (label, yfmt, tmp);	Printf ("m %4d %4d\nt 5 1\n", iy + 50, 400 - 80*strlen(label));			/* 1/2 height of size 5 digit is 50 */	Printf ("%s\n", label);    }}

⌨️ 快捷键说明

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