示例#1
0
static void do_resource_pdf(int immediate,int code)
{
switch(code){
case use_box_resource_code:
scan_pdfrefxform(static_pdf);
break;
case use_image_resource_code:
scan_pdfrefximage(static_pdf);
break;
case save_box_resource_code:
scan_pdfxform(static_pdf);
if(immediate){
pdf_cur_form= last_saved_box_index;
ship_out(static_pdf,obj_xform_box(static_pdf,last_saved_box_index),SHIPPING_FORM);
}
break;
case save_image_resource_code:
fix_pdf_minorversion(static_pdf);
scan_pdfximage(static_pdf);
if(immediate){
pdf_write_image(static_pdf,last_saved_image_index);
}
break;
}
}
示例#2
0
文件: page.c 项目: syntheticpp/cpptex
void tex::fire_up(ptr c)
	{
	int	n;
	bool	wait;
	ptr	prev_p;
	scal	save_vfuzz;
	int	save_vbadness;
	ptr	save_split_top_skip;
	ptr	p, q, r;

	if (type(best_page_break) == PENALTY_NODE) {
		set_output_penalty(penalty(best_page_break));
		penalty(best_page_break) = INF_PENALTY;
	} else {
		set_output_penalty(INF_PENALTY);
	}
	if (bot_mark != null) {
		if (top_mark != null)
			delete_token_ref(top_mark);
		top_mark = bot_mark;
		add_token_ref(top_mark);
		delete_token_ref(first_mark);
		first_mark = null;
	}
	if (c == best_page_break) {
		best_page_break = null;
	}
	if (box(255) != null) {
		print_err(null_str);
		print_esc("box");
		print("255 is not void");
		help_box_255();
		box_error(255);
	}
	insert_penalties = 0;
	save_split_top_skip = split_top_skip;
	if (holding_inserts <= 0) {
		r = link(page_ins_head);
		while (r != page_ins_head) {
			if (best_ins_ptr(r) != null) {
				n = subtype(r);
				ensure_vbox(n);
				if (box(n) == null)
					box(n) = new_null_box();
				p = node_list(box(n));
				while (link(p) != null) {
					p = link(p);
				}
				last_ins_ptr(r) = p;
			}
			r = link(r);
		}
	}
	q = hold_head;
	link(q) = null;
	prev_p = page_head;
	p = link(prev_p);
	while (p != best_page_break) {
		if (type(p) == INS_NODE) {
			if (holding_inserts <= 0) {
				wait = insert_box(p);
				link(prev_p) = link(p);
				link(p) = null;
				if (wait) {
					q = link(q) = p;
					incr(insert_penalties);
				} else {
					delete_glue_ref(split_top_ptr(p));
					free_node(p, INS_NODE_SIZE);
				}
				p = prev_p;
			}
		} else if (type(p) == MARK_NODE) {
			if (first_mark == null) {
				first_mark = mark_ptr(p);
				add_token_ref(first_mark);
			}
			if (bot_mark != null)
				delete_token_ref(bot_mark);
			bot_mark = mark_ptr(p);
			add_token_ref(bot_mark);
		}
		prev_p = p;
		p = link(prev_p);
	}
	split_top_skip = save_split_top_skip;
	if (p != null) {
		if (link(contrib_head) == null) {
			if (nest_ptr == nest) {
				tail = page_tail;
			} else {
				contrib_tail = page_tail;
			}
		}
		link(page_tail) = link(contrib_head);
		link(contrib_head) = p;
		link(prev_p) = null;
	}
	save_vbadness = vbadness;
	save_vfuzz = vfuzz;
	vbadness = INF_BAD;
	vfuzz = MAX_DIMEN;
	box(255) = vpackage(link(page_head),
		best_size, EXACTLY, page_max_depth);
	vbadness = save_vbadness;
	vfuzz = save_vfuzz;
	if (last_glue != null)
		delete_glue_ref(last_glue);
	start_new_page();
	if (q != hold_head) {
		link(page_head) = link(hold_head);
		page_tail = q;
	}
	r = link(page_ins_head);
	while (r != page_ins_head) {
		q = link(r);
		free_node(r, PAGE_INS_NODE_SIZE);
		r = q;
	}
	link(page_ins_head) = page_ins_head;
	if (top_mark != null && first_mark == null) {
		first_mark = top_mark;
		add_token_ref(top_mark);
	}
	if (output_routine != null) {
		if (dead_cycles >= max_dead_cycles) {
			print_err("Output loop---");
			print_int(dead_cycles);
			print(" consecutive dead cycles");
			help_dead_cycles();
			error();
		} else {
			output_active = TRUE;
			incr(dead_cycles);
			push_nest();
			mode = -VMODE;
			prev_depth = IGNORE_DEPTH;
			mode_line = -line;
			begin_token_list(output_routine, OUTPUT_TEXT);
			new_save_level(OUTPUT_GROUP);
			normal_paragraph();
			scan_left_brace();
			return;
		}
	}
	if (link(page_head) != null) {
		if (link(contrib_head) == null) {
			if (nest_ptr == nest) {
				tail = page_tail;
			} else {
				contrib_tail = page_tail;
			}
		} else {
			link(page_tail) = link(contrib_head);
		}
		link(contrib_head) = link(page_head);
		link(page_head) = null;
		page_tail = page_head;
	}
	ship_out(box(255));
	box(255) = null;
}
示例#3
0
void tex::box_end(int box_context)
	{
	ptr	p;

#define LEADERS "Leaders not followed by proper glue"

	if (box_context < BOX_FLAG) {
		if (cur_box != null) {
			shift_amount(cur_box) = box_context;
			if (abs(mode) == VMODE) {
				append_to_vlist(cur_box);
				if (tex::adjust_tail != null) {
					if (tex::adjust_head != tex::adjust_tail) {
						link(tail) = link(tex::adjust_head);
						tail = tex::adjust_tail;
					}
					tex::adjust_tail = null;
				}
				if (mode > 0) 
					build_page();
			} else {
				if (abs(mode) == HMODE) {
					space_factor = 1000;
				} else {
					p = new_noad();
					math_type(nucleus(p)) = SUB_BOX;
					info(nucleus(p)) = cur_box;
					cur_box = p;
				}
				tail_append(cur_box);
			}
		}
	} else if (box_context < SHIP_OUT_FLAG) {
		if (box_context < BOX_FLAG + 256) {
			reg_define(box_reg[box_context - BOX_FLAG],
				BOX_REG, cur_box);
		} else {
			reg_gdefine(box_reg[box_context - BOX_FLAG - 256],
				BOX_REG, cur_box);
		}
	} else if (cur_box != null) {
		if (box_context > SHIP_OUT_FLAG) {
			get_nbrx_token();
			if (cur_cmd == HSKIP && abs(mode) != VMODE
			|| cur_cmd == VSKIP && abs(mode) == VMODE
			|| cur_cmd == MSKIP && abs(mode) == MMODE) {
				append_glue();
				leader_ptr(tail) = cur_box;
				subtype(tail) = box_context -
					(LEADER_FLAG - A_LEADERS);
			} else {
				print_err(LEADERS);
				help_leaders();
				back_error();
				flush_node_list(cur_box);
			}
		} else {
			ship_out(cur_box);
		}
	}
}