Пример #1
0
	void
begin_plot (

enum plot_size		size		/* IN - size of plot to begin */
)
{
	current_plot_size = size;
	switch (size) {
	case BIG_PLOT:
		page_break ();
		announce_new_page ();
		(void) printf ("BeginPlot\n");
		break;

	case SMALL_PLOT:
		if (small_plots_on_page EQ 0) {
			announce_new_page ();
		}
		(void) printf ("BeginSmallPlot\n");
		break;

	default:
		fatal ("begin_plot: Bug 1.");
		break;
	}
}
Пример #2
0
	void
plot_full_sets (

bitmap_t *		fset_mask,	/* IN - subset of full-sets to plot */
struct cinfo *		cip,		/* IN - compatibility info */
enum plot_size		plot_size	/* IN - size of plot to produce */
)
{
int			i;
int			n;
struct full_set *	fsp;
int *			vp1;
int *			vp2;
char			title [256];
char			buf1 [32];

	n = cip -> num_edges;

	if ((cip -> pts NE NULL) AND (cip -> full_trees NE NULL)) {
		/* Draw the FSTs with postscript. */
		for (i = 0; i < n; i++) {
			if (NOT BITON (fset_mask, i)) continue;
			fsp = cip -> full_trees [i];
			begin_plot (plot_size);
			(void) printf ("\tPlot_Terminals\n");
			fst_comment (fsp);
			draw_fst (fsp, cip);
			dist_to_string (buf1,
					cip -> cost [i],
					&(cip -> scale));
			(void) sprintf (title, "FST %lu,  Length = %s",
					(int32u) i, buf1);
			end_plot (title);
		}
		page_break ();
	}
	else {
		/* Just print the hyperedges */
		for (i = 0; i < n; i++) {
			if (NOT BITON (fset_mask, i)) continue;
			printf ("Edge %d: ", i);
			vp1 = cip -> edge [i];
			vp2 = cip -> edge [i + 1];
			while (vp1 < vp2) {
				printf ("%d ", *vp1++);
			}
			dist_to_string (buf1,
					cip -> cost [i],
					&(cip -> scale));
			printf ("%s\n", buf1);
		}
	}
}
Пример #3
0
int do_noargs(int cmd_id)
{
	if (cmd_id < 10)
		line_break();
	switch (cmd_id) {
	case 1:
		no_fill = 1;
		break;
	case 2:
		no_fill = 0;
		break;
	case 3:
		pending_nl = 1;
		break;
	case 4:
		break;
	case 5:
		page_break();
		break;
	case 6:
		left_indent = old_para_indent;
		pending_nl = 1;
		break;
	case 7:
		pending_nl = 1;
		left_indent += standard_tab;
		old_para_indent += standard_tab;
		break;
	case 8:
		pending_nl = 1;
		left_indent -= standard_tab;
		old_para_indent -= standard_tab;
		break;

	case 10:
		right_adjust = 1;
		break;
	case 11:
		right_adjust = 0;
		break;
	case 12:
		input_tab = atoi(word);
		if (input_tab <= 0)
			input_tab = 8;
		break;
	}
	return 0;
}
Пример #4
0
	void
plot_full_sets_grouped (

bitmap_t *		fset_mask,	/* IN - subset of full-sets to plot */
struct cinfo *		cip,		/* IN - compatibility info */
enum plot_size		plot_size	/* IN - size of plot to produce */
)
{
int			i;
int			j;
int			n;
int			nleft;
int			kmasks;
int			nmasks;
int			nplot;
bitmap_t *		left;
bitmap_t *		tmask;
int *			plist;
struct full_set *	fsp;
struct pset *		pts;
char *			cp1;
char *			cp2;
char			fsnums [110];
char			fsnum [8];
char			title [120];

	n = cip -> num_edges;
	nmasks = cip -> num_edge_masks;
	kmasks = cip -> num_vert_masks;

	left = NEWA (nmasks, bitmap_t);
	tmask = NEWA (kmasks, bitmap_t);
	plist = NEWA (n, int);

	/* Make a local copy of all full sets left to plot. */
	for (i = 0; i < nmasks; i++) {
		left [i] = fset_mask [i];
	}
	nleft = n;

	while (nleft > 0) {
		begin_plot (plot_size);

		for (i = 0; i < kmasks; i++) {
			tmask [i] = 0;
		}

		nplot = 0;
		cp1 = &fsnums [sizeof (fsnums)];
		*--cp1 = '\0';

		for (i = n - 1; i >= 0; i--) {
			if (NOT BITON (left, i)) continue;

			/* Skip full set "i" if not disjoint	*/
			/* with all others in this plot...	*/
			fsp = cip -> full_trees [i];
			pts = fsp -> terminals;
			for (j = 0; j < pts -> n; j++) {
				if (BITON (tmask, pts -> a [j].pnum)) break;
			}
			if (j < pts -> n) continue;

			(void) sprintf (fsnum, "%lu", (int32u) i);
			for (cp2 = fsnum; *cp2 NE '\0'; cp2++) {
			}

			/* Stop if label does not fit! */
			if ((cp2 - fsnum) + 2 > (cp1 - fsnums)) break;

			while (cp2 > fsnum) {
				*--cp1 = *--cp2;
			}
			*--cp1 = ' ';
			*--cp1 = ',';

			plist [nplot++] = i;
			CLRBIT (left, i);
			--nleft;

			fsp = cip -> full_trees [i];
			fst_comment (fsp);
			draw_fst (fsp, cip);

			pts = fsp -> terminals;
			for (j = 0; j < pts -> n; j++) {
				SETBIT (tmask, pts -> a [j].pnum);
			}
		}

		(void) printf ("\tPlot_Terminals\n");
		(void) sprintf (title,
				"FST%s %s.",
				(nplot > 1) ? "s" : "",
				cp1 + 2);
		end_plot (title);
	}

	page_break ();

	free ((char *) plist);
	free ((char *) tmask);
	free ((char *) left);
}
Пример #5
0
int do_argvcmd(int cmd_id)
{
	int ch;

	line_break();
	while ((ch = fgetc(ifd)) != EOF && (ch == ' ' || ch == '\t'));
	ungetc(ch, ifd);

	switch (cmd_id + 10 * (ch == '\n')) {
	case 1:		/* Title and headers */
		page_break();
		left_indent = old_para_indent = standard_tab;
		build_headers();
		break;

	case 2:		/* Section */
		left_indent = 0;
		next_line_indent = old_para_indent = standard_tab;
		no_nl = 0;
		keep_nl = 1;
		pending_nl = 1;

		do_fontwords(1, 1, 0);
		return 0;
	case 3:		/* Subsection */
		left_indent = standard_tab / 2;
		next_line_indent = old_para_indent = standard_tab;
		no_nl = 0;
		keep_nl = 1;
		pending_nl = 1;

		do_fontwords(1, 1, 0);
		break;

	case 15:
	case 5:		/* New para, indent except line 1 */
		do_skipeol();
		next_line_indent = old_para_indent + standard_tab;
		left_indent = old_para_indent;
		pending_nl = 1;
		keep_nl = 1;
		optional_keep = 1;
		break;

	case 4:		/* New para, indent except argument 1 */
		next_line_indent = old_para_indent + standard_tab;
		left_indent = old_para_indent;
		pending_nl = 1;
		keep_nl = 1;
		optional_keep = 1;
		do_fontwords(1, 1, 1);
		do_skipeol();
		break;

	case 14:
		pending_nl = 1;
		left_indent = old_para_indent + standard_tab;
		break;
	}

	return 0;
}
Пример #6
0
/****************************************************************************
 * ifd is the manual page, ofd is the 'output' file or pipe, format it!
 */
void do_file(void)
{
	int nl;
	ungetc('\r', ifd);

	while ((nl = fetch_word()) >= 0) {
#ifdef SPLATTER
		fprintf(ofd, ">WS='%s',", whitespace);
		fprintf(ofd, "catmode=%d,", catmode);
		fprintf(ofd, "nl=%d,", nl);
		fprintf(ofd, "no_nl=%d,", no_nl);
		fprintf(ofd, "no_fill=%d,", no_fill);
		fprintf(ofd, "keep_nl=%d,", keep_nl);
		fprintf(ofd, "opt_keep=%d,", optional_keep);
		fprintf(ofd, "WD='%s',", word);
		fprintf(ofd, "\n");
#endif

		if (catmode) {
			if (strcmp(word, "'\\\"") == 0
			    || strcmp(word, "'''") == 0) {
				/* This is a marker sometimes used for opening subprocesses like
				 * tbl and equ; this program ignores it.
				 */
				do_skipeol();
			} else if (*whitespace == '\r')
				fprintf(ofd, "%s%s", whitespace + 1, word);
			else
				fprintf(ofd, "%s%s", whitespace, word);
		} else {
			if (keep_nl && nl && !no_nl) {
				if (optional_keep) {
					optional_keep = 0;
					if (line_ptr == 0
					    || next_line_indent < 0
					    || left_indent + (line_ptr -
							      line) + 1 >
					    next_line_indent)
						line_break();
					else if (line_ptr != 0
						 && next_line_indent > 0) {
						while (left_indent +
						       (line_ptr - line) +
						       1 <=
						       next_line_indent)
							*line_ptr++ =
							    cur_font + ' ';
					}
				} else
					line_break();
				if (keep_nl > 0)
					keep_nl--;
			}

			if (nl == 1 && (word[0] == '.' ||
					(word[0] == '\''
					 && strcmp(word, "'\\\"") == 0)
					|| (word[0] == '\''
					    && strcmp(word, "'''") == 0)
			    )) {
				no_nl = 1;
				if (do_command() < 0)
					break;
			} else {
				if (nl == 1 && no_fill)
					line_break();
				if (*whitespace)
					print_word(whitespace);
				print_word(word);
				no_nl = 0;
			}
		}
	}

	page_break();
}