Exemple #1
0
static void
db_chunk(const struct chunk *cnk) {
	/*	print the tokens in the chunk, with a one-char margin
	*/
	size_t i;
	const struct position *first = &cnk->ch_first;
	const struct position *last = &cnk->ch_last;
	size_t start = cnk->ch_text->tx_start;

	if (first->ps_tk_cnt > 0) {
		fprintf(Debug_File, "...");
		fprint_token(Debug_File,
			Token_Array[start + first->ps_tk_cnt - 1]);
		fprintf(Debug_File, "  ");
	}
	else {	/* create same offset as above */
		fprintf(Debug_File, "       ");
	}

	for (i = first->ps_tk_cnt; i <= last->ps_tk_cnt; i++) {
		fprintf(Debug_File, " ");
		fprint_token(Debug_File, Token_Array[start + i]);
	}

	if (start + last->ps_tk_cnt + 1 < cnk->ch_text->tx_limit) {
		fprintf(Debug_File, "  ");
		fprint_token(Debug_File,
			Token_Array[start + last->ps_tk_cnt + 1]);
		fprintf(Debug_File, "...");
	}

	fprintf(Debug_File, "\n");
}
Exemple #2
0
static void
db_print_text(const struct text *txt) {
	/* prints a text (in compressed form) */
	int i;

	fprintf(Debug_File, "\n\n**** DB_PRINT_TEXT ****\n");

	fprintf(Debug_File, "File \"%s\", %u %ss, ",
		txt->tx_fname, txt->tx_limit - txt->tx_start, token_name
	);
	fprintf(Debug_File, "txt->tx_start = %u, txt->tx_limit = %u\n",
		txt->tx_start, txt->tx_limit
	);

	int BoL = 1;
	for (i = txt->tx_start; i < txt->tx_limit; i++) {
		if (BoL) {
			fprintf(Debug_File, "[%d]:", i);
			BoL = 0;
		}
		fprintf(Debug_File, " ");
		fprint_token(Debug_File, Token_Array[i]);
		if ((i - txt->tx_start + 1) % 10 == 0) {
			fprintf(Debug_File, "\n");
			BoL = 1;
		}
	}
	fprintf(Debug_File, "\n");
}
Exemple #3
0
static void
db_print_text(const struct text *txt) {
	/* prints a text (in compressed form) */
	size_t i;

	fprintf(Debug_File, "\n\n**** DB_PRINT_TEXT ****\n");

	fprintf(Debug_File, "File \"%s\", %s %ss, ",
		txt->tx_fname,
		size_t2string(txt->tx_limit - txt->tx_start),
		Token_Name
	);
	fprintf(Debug_File, "txt->tx_start = %s, txt->tx_limit = %s\n",
		size_t2string(txt->tx_start),
		size_t2string(txt->tx_limit)
	);

	int BoL = 1;
	for (i = txt->tx_start; i < txt->tx_limit; i++) {
		if (BoL) {
			fprintf(Debug_File, "[%s]:", size_t2string(i));
			BoL = 0;
		}
		fprintf(Debug_File, " ");
		fprint_token(Debug_File, Token_Array[i]);
		if ((i - txt->tx_start + 1) % 10 == 0) {
			fprintf(Debug_File, "\n");
			BoL = 1;
		}
	}
	fprintf(Debug_File, "\n");
}
Exemple #4
0
static void
db_print_lex(const char *fn) {
	fprintf(Debug_File,
		"%s: lex_tk_cnt = %u, lex_nl_cnt = %u, lex_token = ",
		fn, lex_tk_cnt, lex_nl_cnt);
	fprint_token(Debug_File, lex_token);
	fprintf(Debug_File, "\n");
}