synctex_parser.c.svn-base

来自「SumatraPDF是一款小型开源的pdf阅读工具。虽然玲珑小巧(只有800多K」· SVN-BASE 代码 · 共 1,720 行 · 第 1/5 页

SVN-BASE
1,720
字号
	(_synctex_info_getter_t)&_synctex_implementation_3  /*  info */};/*  sheet node creator */synctex_node_t _synctex_new_sheet(synctex_scanner_t scanner) {	synctex_node_t node = _synctex_malloc(sizeof(synctex_sheet_t));	if(node) {		node->class = scanner?scanner->class+synctex_node_type_sheet:(synctex_class_t)&synctex_class_sheet;	}	return node;}/*  A box node contains navigation and synctex information *  There are different kind of boxes. *  Only horizontal boxes are treated differently because of their visible size. */#   define SYNCTEX_TAG_IDX 0#   define SYNCTEX_LINE_IDX (SYNCTEX_TAG_IDX+1)#   define SYNCTEX_COLUMN_IDX (SYNCTEX_LINE_IDX+1)#   define SYNCTEX_HORIZ_IDX (SYNCTEX_COLUMN_IDX+1)#   define SYNCTEX_VERT_IDX (SYNCTEX_HORIZ_IDX+1)#   define SYNCTEX_WIDTH_IDX (SYNCTEX_VERT_IDX+1)#   define SYNCTEX_HEIGHT_IDX (SYNCTEX_WIDTH_IDX+1)#   define SYNCTEX_DEPTH_IDX (SYNCTEX_HEIGHT_IDX+1)/*  the corresponding info accessors */#   define SYNCTEX_TAG(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_TAG_IDX].INT#   define SYNCTEX_LINE(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_LINE_IDX].INT#   define SYNCTEX_COLUMN(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_COLUMN_IDX].INT#   define SYNCTEX_HORIZ(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_HORIZ_IDX].INT#   define SYNCTEX_VERT(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_VERT_IDX].INT#   define SYNCTEX_WIDTH(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_WIDTH_IDX].INT#   define SYNCTEX_HEIGHT(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_HEIGHT_IDX].INT#   define SYNCTEX_DEPTH(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_DEPTH_IDX].INT#   define SYNCTEX_ABS_WIDTH(NODE) ((SYNCTEX_WIDTH(NODE)>0?SYNCTEX_WIDTH(NODE):-SYNCTEX_WIDTH(NODE)))#   define SYNCTEX_ABS_HEIGHT(NODE) ((SYNCTEX_HEIGHT(NODE)>0?SYNCTEX_HEIGHT(NODE):-SYNCTEX_HEIGHT(NODE)))#   define SYNCTEX_ABS_DEPTH(NODE) ((SYNCTEX_DEPTH(NODE)>0?SYNCTEX_DEPTH(NODE):-SYNCTEX_DEPTH(NODE)))typedef struct {	synctex_class_t class;	synctex_info_t implementation[5+SYNCTEX_DEPTH_IDX+1]; /*  parent,child,sibling,friend,next box,						        *  SYNCTEX_TAG,SYNCTEX_LINE,SYNCTEX_COLUMN,								*  SYNCTEX_HORIZ,SYNCTEX_VERT,SYNCTEX_WIDTH,SYNCTEX_HEIGHT,SYNCTEX_DEPTH */} synctex_vert_box_node_t;synctex_node_t _synctex_new_vbox(synctex_scanner_t scanner);void _synctex_log_box(synctex_node_t sheet);void _synctex_display_vbox(synctex_node_t node);/*  These are static class objects, each scanner will make a copy of them and setup the scanner field. */static const _synctex_class_t synctex_class_vbox = {	NULL,                       /*  No scanner yet */	synctex_node_type_vbox,     /*  Node type */	&_synctex_new_vbox,         /*  creator */	&_synctex_free_node,        /*  destructor */	&_synctex_log_box,          /*  log */	&_synctex_display_vbox,     /*  display */	&_synctex_implementation_0, /*  parent */	&_synctex_implementation_1, /*  child */	&_synctex_implementation_2, /*  sibling */	&_synctex_implementation_3, /*  friend */	&_synctex_implementation_4, /*  next box */	(_synctex_info_getter_t)&_synctex_implementation_5};/*  vertical box node creator */synctex_node_t _synctex_new_vbox(synctex_scanner_t scanner) {	synctex_node_t node = _synctex_malloc(sizeof(synctex_vert_box_node_t));	if(node) {		node->class = scanner?scanner->class+synctex_node_type_vbox:(synctex_class_t)&synctex_class_vbox;	}	return node;}#   define SYNCTEX_HORIZ_V_IDX (SYNCTEX_DEPTH_IDX+1)#   define SYNCTEX_VERT_V_IDX (SYNCTEX_HORIZ_V_IDX+1)#   define SYNCTEX_WIDTH_V_IDX (SYNCTEX_VERT_V_IDX+1)#   define SYNCTEX_HEIGHT_V_IDX (SYNCTEX_WIDTH_V_IDX+1)#   define SYNCTEX_DEPTH_V_IDX (SYNCTEX_HEIGHT_V_IDX+1)/*  the corresponding info accessors */#   define SYNCTEX_HORIZ_V(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_HORIZ_V_IDX].INT#   define SYNCTEX_VERT_V(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_VERT_V_IDX].INT#   define SYNCTEX_WIDTH_V(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_WIDTH_V_IDX].INT#   define SYNCTEX_HEIGHT_V(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_HEIGHT_V_IDX].INT#   define SYNCTEX_DEPTH_V(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_DEPTH_V_IDX].INT#   define SYNCTEX_ABS_WIDTH_V(NODE) ((SYNCTEX_WIDTH_V(NODE)>0?SYNCTEX_WIDTH_V(NODE):-SYNCTEX_WIDTH_V(NODE)))#   define SYNCTEX_ABS_HEIGHT_V(NODE) ((SYNCTEX_HEIGHT_V(NODE)>0?SYNCTEX_HEIGHT_V(NODE):-SYNCTEX_HEIGHT_V(NODE)))#   define SYNCTEX_ABS_DEPTH_V(NODE) ((SYNCTEX_DEPTH_V(NODE)>0?SYNCTEX_DEPTH_V(NODE):-SYNCTEX_DEPTH_V(NODE)))/*  Horizontal boxes must contain visible size, because 0 width does not mean emptiness */typedef struct {	synctex_class_t class;	synctex_info_t implementation[5+SYNCTEX_DEPTH_V_IDX+1]; /*parent,child,sibling,friend,next box,						*  SYNCTEX_TAG,SYNCTEX_LINE,SYNCTEX_COLUMN,						*  SYNCTEX_HORIZ,SYNCTEX_VERT,SYNCTEX_WIDTH,SYNCTEX_HEIGHT,SYNCTEX_DEPTH,						*  SYNCTEX_HORIZ_V,SYNCTEX_VERT_V,SYNCTEX_WIDTH_V,SYNCTEX_HEIGHT_V,SYNCTEX_DEPTH_V*/} synctex_horiz_box_node_t;synctex_node_t _synctex_new_hbox(synctex_scanner_t scanner);void _synctex_display_hbox(synctex_node_t node);void _synctex_log_horiz_box(synctex_node_t sheet);static const _synctex_class_t synctex_class_hbox = {	NULL,                       /*  No scanner yet */	synctex_node_type_hbox,     /*  Node type */	&_synctex_new_hbox,         /*  creator */	&_synctex_free_node,        /*  destructor */	&_synctex_log_horiz_box,    /*  log */	&_synctex_display_hbox,     /*  display */	&_synctex_implementation_0, /*  parent */	&_synctex_implementation_1, /*  child */	&_synctex_implementation_2, /*  sibling */	&_synctex_implementation_3, /*  friend */	&_synctex_implementation_4, /*  next box */	(_synctex_info_getter_t)&_synctex_implementation_5};/*  horizontal box node creator */synctex_node_t _synctex_new_hbox(synctex_scanner_t scanner) {	synctex_node_t node = _synctex_malloc(sizeof(synctex_horiz_box_node_t));	if(node) {		node->class = scanner?scanner->class+synctex_node_type_hbox:(synctex_class_t)&synctex_class_hbox;	}	return node;}/*  This void box node implementation is either horizontal or vertical *  It does not contain a child field. */typedef struct {	synctex_class_t class;	synctex_info_t implementation[3+SYNCTEX_DEPTH_IDX+1]; /*  parent,sibling,friend,	                  *  SYNCTEX_TAG,SYNCTEX_LINE,SYNCTEX_COLUMN,					  *  SYNCTEX_HORIZ,SYNCTEX_VERT,SYNCTEX_WIDTH,SYNCTEX_HEIGHT,SYNCTEX_DEPTH*/} synctex_void_box_node_t;synctex_node_t _synctex_new_void_vbox(synctex_scanner_t scanner);void _synctex_log_void_box(synctex_node_t sheet);void _synctex_display_void_vbox(synctex_node_t node);static const _synctex_class_t synctex_class_void_vbox = {	NULL,                       /*  No scanner yet */	synctex_node_type_void_vbox,/*  Node type */	&_synctex_new_void_vbox,    /*  creator */	&_synctex_free_node,        /*  destructor */	&_synctex_log_void_box,     /*  log */	&_synctex_display_void_vbox,/*  display */	&_synctex_implementation_0, /*  parent */	NULL,                       /*  No child */	&_synctex_implementation_1, /*  sibling */	&_synctex_implementation_2, /*  friend */	NULL,						/*  No next box */	(_synctex_info_getter_t)&_synctex_implementation_3};/*  vertical void box node creator */synctex_node_t _synctex_new_void_vbox(synctex_scanner_t scanner) {	synctex_node_t node = _synctex_malloc(sizeof(synctex_void_box_node_t));	if(node) {		node->class = scanner?scanner->class+synctex_node_type_void_vbox:(synctex_class_t)&synctex_class_void_vbox;	}	return node;}synctex_node_t _synctex_new_void_hbox(synctex_scanner_t scanner);void _synctex_display_void_hbox(synctex_node_t node);static const _synctex_class_t synctex_class_void_hbox = {	NULL,                       /*  No scanner yet */	synctex_node_type_void_hbox,/*  Node type */	&_synctex_new_void_hbox,    /*  creator */	&_synctex_free_node,        /*  destructor */	&_synctex_log_void_box,     /*  log */	&_synctex_display_void_hbox,/*  display */	&_synctex_implementation_0, /*  parent */	NULL,                       /*  No child */	&_synctex_implementation_1, /*  sibling */	&_synctex_implementation_2, /*  friend */	NULL,						/*  No next box */	(_synctex_info_getter_t)&_synctex_implementation_3};/*  horizontal void box node creator */synctex_node_t _synctex_new_void_hbox(synctex_scanner_t scanner) {	synctex_node_t node = _synctex_malloc(sizeof(synctex_void_box_node_t));	if(node) {		node->class = scanner?scanner->class+synctex_node_type_void_hbox:(synctex_class_t)&synctex_class_void_hbox;	}	return node;}/*  The medium nodes correspond to kern and math nodes.  */typedef struct {	synctex_class_t class;	synctex_info_t implementation[3+SYNCTEX_WIDTH_IDX+1]; /*  parent,sibling,friend,	                  *  SYNCTEX_TAG,SYNCTEX_LINE,SYNCTEX_COLUMN,					  *  SYNCTEX_HORIZ,SYNCTEX_VERT,SYNCTEX_WIDTH */} synctex_medium_node_t;#define SYNCTEX_IS_BOX(NODE)\	((NODE->class->type == synctex_node_type_vbox)\	|| (NODE->class->type == synctex_node_type_void_vbox)\	|| (NODE->class->type == synctex_node_type_hbox)\	|| (NODE->class->type == synctex_node_type_void_hbox))	#define SYNCTEX_HAS_CHILDREN(NODE) (NODE && SYNCTEX_CHILD(NODE))	void _synctex_log_medium_node(synctex_node_t node);/*  math node creator */synctex_node_t _synctex_new_math(synctex_scanner_t scanner);void _synctex_display_math(synctex_node_t node);static const _synctex_class_t synctex_class_math = {	NULL,                       /*  No scanner yet */	synctex_node_type_math,     /*  Node type */	&_synctex_new_math,         /*  creator */	&_synctex_free_leaf,        /*  destructor */	&_synctex_log_medium_node,  /*  log */	&_synctex_display_math,     /*  display */	&_synctex_implementation_0, /*  parent */	NULL,                       /*  No child */	&_synctex_implementation_1, /*  sibling */	&_synctex_implementation_2, /*  friend */	NULL,                       /*  No next box */	(_synctex_info_getter_t)&_synctex_implementation_3};synctex_node_t _synctex_new_math(synctex_scanner_t scanner) {	synctex_node_t node = _synctex_malloc(sizeof(synctex_medium_node_t));	if(node) {		node->class = scanner?scanner->class+synctex_node_type_math:(synctex_class_t)&synctex_class_math;	}	return node;}/*  kern node creator */synctex_node_t _synctex_new_kern(synctex_scanner_t scanner);void _synctex_display_kern(synctex_node_t node);static const _synctex_class_t synctex_class_kern = {	NULL,                       /*  No scanner yet */	synctex_node_type_kern,     /*  Node type */	&_synctex_new_kern,         /*  creator */	&_synctex_free_leaf,        /*  destructor */	&_synctex_log_medium_node,  /*  log */	&_synctex_display_kern,     /*  display */	&_synctex_implementation_0, /*  parent */	NULL,                       /*  No child */	&_synctex_implementation_1, /*  sibling */	&_synctex_implementation_2, /*  friend */	NULL,                       /*  No next box */	(_synctex_info_getter_t)&_synctex_implementation_3};synctex_node_t _synctex_new_kern(synctex_scanner_t scanner) {	synctex_node_t node = _synctex_malloc(sizeof(synctex_medium_node_t));	if(node) {		node->class = scanner?scanner->class+synctex_node_type_kern:(synctex_class_t)&synctex_class_kern;	}	return node;}/*  The small nodes correspond to glue and boundary nodes.  */typedef struct {	synctex_class_t class;	synctex_info_t implementation[3+SYNCTEX_VERT_IDX+1]; /*  parent,sibling,friend,	                  *  SYNCTEX_TAG,SYNCTEX_LINE,SYNCTEX_COLUMN,					  *  SYNCTEX_HORIZ,SYNCTEX_VERT */} synctex_small_node_t;void _synctex_log_small_node(synctex_node_t node);/*  glue node creator */synctex_node_t _synctex_new_glue(synctex_scanner_t scanner);void _synctex_display_glue(synctex_node_t node);static const _synctex_class_t synctex_class_glue = {	NULL,                       /*  No scanner yet */	synctex_node_type_glue,     /*  Node type */	&_synctex_new_glue,         /*  creator */	&_synctex_free_leaf,        /*  destructor */	&_synctex_log_medium_node,  /*  log */	&_synctex_display_glue,     /*  display */	&_synctex_implementation_0, /*  parent */	NULL,                       /*  No child */	&_synctex_implementation_1, /*  sibling */	&_synctex_implementation_2, /*  friend */	NULL,                       /*  No next box */	(_synctex_info_getter_t)&_synctex_implementation_3};synctex_node_t _synctex_new_glue(synctex_scanner_t scanner) {	synctex_node_t node = _synctex_malloc(sizeof(synctex_medium_node_t));	if(node) {		node->class = scanner?scanner->class+synctex_node_type_glue:(synctex_class_t)&synctex_class_glue;	}	return node;}/*  boundary node creator */synctex_node_t _synctex_new_boundary(synctex_scanner_t scanner);void _synctex_display_boundary(synctex_node_t node);static const _synctex_class_t synctex_class_boundary = {	NULL,                       /*  No scanner yet */	synctex_node_type_boundary,     /*  Node type */	&_synctex_new_boundary, /*  creator */	&_synctex_free_leaf,        /*  destructor */	&_synctex_log_small_node,   /*  log */	&_synctex_display_boundary,     /*  display */	&_synctex_implementation_0, /*  parent */	NULL,                       /*  No child */	&_synctex_implementation_1, /*  sibling */	&_synctex_implementation_2, /*  friend */	NULL,                       /*  No next box */	(_synctex_info_getter_t)&_synctex_implementation_3};synctex_node_t _synctex_new_boundary(synctex_scanner_t scanner) {	synctex_node_t node = _synctex_malloc(sizeof(synctex_small_node_t));	if(node) {		node->class = scanner?scanner->class+synctex_node_type_boundary:(synctex_class_t)&synctex_class_boundary;	}	return node;}#   define SYNCTEX_NAME_IDX (SYNCTEX_TAG_IDX+1)#   define SYNCTEX_NAME(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_NAME_IDX].PTR/*  Input nodes only know about their sibling, which is another input node. *  The synctex information is the SYNCTEX_TAG and SYNCTEX_NAME*/typedef struct {	synctex_class_t class;	synctex_info_t implementation[1+SYNCTEX_NAME_IDX+1]; /*  sibling,	                          *  SYNCTEX_TAG,SYNCTEX_NAME */} synctex_input_t;synctex_node_t _synctex_new_input(synctex_scanner_t scanner);void _synctex_free_input(synctex_node_t node);void _synctex_display_input(synctex_node_t node);void _synctex_log_input(synctex_node_t sheet);static const _synctex_class_t synctex_class_input = {	NULL,                       /*  No scanner yet */

⌨️ 快捷键说明

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