PageRenderTime 9ms CodeModel.GetById 1ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/Proj4/p_series.c

http://github.com/route-me/route-me
C | 42 lines | 40 code | 1 blank | 1 comment | 8 complexity | 860ad58f1d23bbb53c73ed71572c4dcf MD5 | raw file
 1/* print row coefficients of Tseries structure */
 2#ifndef lint
 3static const char SCCSID[]="@(#)p_series.c	4.6	95/08/19	GIE	REL";
 4#endif
 5#include "projects.h"
 6#include <stdio.h>
 7#include <string.h>
 8#define NF 20 /* length of final format string */
 9#define CUT 60 /* check length of line */
10	void
11p_series(Tseries *T, FILE *file, char *fmt) {
12	int i, j, n, L;
13	char format[NF+1];
14
15	*format = ' ';
16	strncpy(format + 1, fmt, NF - 3);
17	strcat(format, "%n");
18	fprintf(file, "u: %d\n", T->mu+1);
19	for (i = 0; i <= T->mu; ++i)
20		if (T->cu[i].m) {
21			L = fprintf(file, "%d %d", i, T->cu[i].m);
22			n = 0;
23			for (j = 0; j < T->cu[i].m; ++j) {
24				if ((L += n) > CUT)
25					L = fprintf(file, "\n ");
26				fprintf(file, format, T->cu[i].c[j], &n);
27			}
28			fputc('\n', file);
29		}
30	fprintf(file, "v: %d\n", T->mv+1);
31	for (i = 0; i <= T->mv; ++i)
32		if (T->cv[i].m) {
33			L = fprintf(file, "%d %d", i, T->cv[i].m);
34			n = 0;
35			for (j = 0; j < T->cv[i].m; ++j) {
36				if ((L += n) > 60)
37					L = fprintf(file, "\n ");
38				fprintf(file, format, T->cv[i].c[j], &n);
39			}
40			fputc('\n', file);
41		}
42}