summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/synctexdir/synctex.c
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/synctexdir/synctex.c')
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex.c753
1 files changed, 512 insertions, 241 deletions
diff --git a/Build/source/texk/web2c/synctexdir/synctex.c b/Build/source/texk/web2c/synctexdir/synctex.c
index c01e4480245..f07f13a1c25 100644
--- a/Build/source/texk/web2c/synctexdir/synctex.c
+++ b/Build/source/texk/web2c/synctexdir/synctex.c
@@ -1,9 +1,10 @@
/*
- Copyright (c) 2008, 2009, 2010, 2011 jerome DOT laurens AT u-bourgogne DOT fr
+ Copyright (c) 2008-2017 jerome DOT laurens AT u-bourgogne DOT fr
This file is part of the SyncTeX package.
- Latest Revision: Fri Apr 15 19:10:57 UTC 2011
+ Version 1
+ Latest Revision: Sat Apr 22 10:07:05 UTC 2017
License:
--------
@@ -109,7 +110,7 @@
is producing the expected file named <my file.synctex>, (the '<' and '>' are not part of the name)
whereas running the command line
pdftex --synctex=-1 "my file.tex"
- was producing the unexpected file named <"my file".synctex> where the two '"' chracters were part of the name.
+ was producing the unexpected file named <"my file".synctex> where the two '"' characters were part of the name.
Of course, that was breaking the typesetting mechanism when pdftex was involved.
To solve this problem, we prefer to rely on the output_file_name instead of the jobname.
In the case when no output_file_name is available, we use jobname and test if the file name
@@ -118,7 +119,7 @@
There is some conditional coding.
Version 1
- Latest Revision: Wed Jul 1 08:15:44 UTC 2009
+ Latest Revision: Sat Apr 22 09:10:30 UTC 2017
*/
@@ -338,6 +339,10 @@ static int fsyscp_remove(char *name);
# include "synctex.h"
+# if !defined(SYNCTEX_SUPPORT_PDF_FORM)
+# define SYNCTEX_SUPPORT_PDF_FORM 0
+# endif
+
# define SYNCTEX_YES (1)
# define SYNCTEX_NO (0)
# define SYNCTEX_NO_ERROR (0)
@@ -394,7 +399,11 @@ static struct {
integer curh, curv; /* current point */
integer magnification; /* The magnification as given by \mag */
integer unit; /* The unit, defaults to 1, use 8192 to produce shorter but less accurate info */
- integer total_length; /* The total length of the bytes written since the last check point */
+ integer total_length; /* The total length of the bytes written since the last check point */
+ integer options; /* unsigned options */
+ integer lastv; /* compression trick if
+ |synctex_options&4|>0. */
+ integer form_depth; /* pdf forms are an example of nested sheets */
struct _flags {
unsigned int option_read:1; /* Command line option read (in case of problem or at the end) */
unsigned int off:1; /* Definitely turn off synctex, corresponds to cli option -synctex=0 */
@@ -406,7 +415,7 @@ static struct {
unsigned int reserved:SYNCTEX_BITS_PER_BYTE*sizeof(int)-7; /* Align */
} flags;
} synctex_ctxt = {
- NULL, NULL, NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, {0,0,0,0,0,0,0,0}};
+ NULL, NULL, NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, {0,0,0,0,0,0,0,0}}; /* last_v_recorded is initialized to -1. */
# define SYNCTEX_FILE synctex_ctxt.file
# define SYNCTEX_IS_OFF (synctex_ctxt.flags.off)
@@ -415,6 +424,13 @@ static struct {
# define SYNCTEX_WARNING_DISABLE (synctex_ctxt.flags.warn)
# define SYNCTEX_fprintf (*synctex_ctxt.fprintf)
+# define SYNCTEX_IS_READY (synctex_ctxt.flags.ready)
+
+# define SYNCTEX_NO_GZ_AUX_NAME\
+ (SYNCTEX_NO_GZ||((synctex_ctxt.options)&2)!=0)
+# define SYNCTEX_WITH_FORMS (((synctex_ctxt.options)&4)!=0)
+# define SYNCTEX_H_COMPRESS (((synctex_ctxt.options)&8)!=0)
+
/* Initialize the options, synchronize the variables.
* This is sent by *tex.web before any TeX macro is used.
* */
@@ -429,13 +445,17 @@ void synctexinitcommand(void)
SYNCTEX_VALUE = 0;
} else if (synctex_options == 0) {
/* -synctex=0 was given: SyncTeX must be definitely disabled,
- * any subsequent \synctex=1 will have no effect at all */
+ * any subsequent \synctex=N will have no effect at all */
SYNCTEX_IS_OFF = SYNCTEX_YES;
SYNCTEX_VALUE = 0;
} else {
/* the command line options are not ignored */
if (synctex_options < 0) {
SYNCTEX_NO_GZ = SYNCTEX_YES;
+ synctex_ctxt.options = -synctex_options;
+ } else {
+ SYNCTEX_NO_GZ = SYNCTEX_NO;
+ synctex_ctxt.options = synctex_options;
}
/* Initialize the content of the \synctex primitive */
SYNCTEX_VALUE = synctex_options;
@@ -544,6 +564,9 @@ static int fsyscp_rename(char *s1, char *s2)
#define rename fsyscp_rename
#endif
+static inline int synctex_record_content(void);
+static inline int synctex_record_settings(void);
+
/* synctex_dot_open ensures that the foo.synctex file is open.
* In case of problem, it definitely disables synchronization.
* Now all the output synchronization info is gathered in only one file.
@@ -551,6 +574,7 @@ static int fsyscp_rename(char *s1, char *s2)
* plus 1 for the control but the overall benefits are not so clear.
* For example foo-i.synctex would contain input synchronization
* information for page i alone.
+ * Options given through \synctex=Number are managed here too.
*/
static void *synctex_dot_open(void)
{
@@ -566,6 +590,18 @@ static void *synctex_dot_open(void)
if (SYNCTEX_FILE) {
return SYNCTEX_FILE; /* synchronization is already enabled */
}
+ if (synctex_options < 0) {
+ SYNCTEX_NO_GZ = SYNCTEX_YES;
+ synctex_ctxt.options = -synctex_options;
+ } else if (synctex_options == 0) {
+ /* \synctex=0 was given: SyncTeX must be definitely disabled,
+ * any subsequent \synctex=N will have no effect at all */
+ SYNCTEX_IS_OFF = SYNCTEX_YES;
+ SYNCTEX_VALUE = 0;
+ } else {
+ SYNCTEX_NO_GZ = SYNCTEX_NO;
+ synctex_ctxt.options = synctex_options;
+ }
# if SYNCTEX_DEBUG
printf("\nwarning: Synchronize DEBUG: synctex_dot_open 1\n");
# endif
@@ -579,12 +615,11 @@ static void *synctex_dot_open(void)
if (len>0) {
/* jobname was set by the \jobname command on the *TeX side */
char *the_busy_name = xmalloc((size_t)
- ( len
- + strlen(synctex_suffix)
- + strlen(synctex_suffix_gz)
- + strlen(synctex_suffix_busy)
- + 1
- + (output_directory?strlen(output_directory) + strlen(DIR_SEP_STRING):0)));
+ ( len
+ + strlen(synctex_suffix)
+ + strlen(synctex_suffix_busy)
+ + 1
+ + (output_directory?strlen(output_directory) + strlen(DIR_SEP_STRING):0)));
if (!the_busy_name) {
SYNCTEX_FREE(tmp);
tmp = NULL;
@@ -620,8 +655,9 @@ static void *synctex_dot_open(void)
tmp = NULL;
strcat(the_busy_name, synctex_suffix);
/* Initialize SYNCTEX_NO_GZ with the content of \synctex to let the user choose the format. */
- SYNCTEX_NO_GZ = SYNCTEX_VALUE < 0 ? SYNCTEX_YES : SYNCTEX_NO;
- if (!SYNCTEX_NO_GZ) {
+#define SYNCTEX_GZ_LEN(WHAT)\
+(SYNCTEX_NO_GZ_AUX_NAME?0:strlen(WHAT))
+ if (!SYNCTEX_NO_GZ_AUX_NAME) {
strcat(the_busy_name, synctex_suffix_gz);
}
strcat(the_busy_name, synctex_suffix_busy);
@@ -656,7 +692,10 @@ static void *synctex_dot_open(void)
# endif
SYNCTEX_FREE(the_busy_name);
the_busy_name = NULL;
- return SYNCTEX_FILE;
+ if ((SYNCTEX_NO_ERROR == synctex_record_settings())
+ && (SYNCTEX_NO_ERROR == synctex_record_content())) {
+ return SYNCTEX_FILE;
+ }
} else {
printf("\nSyncTeX warning: no synchronization, problem with %s\n",
the_busy_name);
@@ -798,9 +837,11 @@ void synctexterminate(boolean log_opened)
# endif
if (log_opened && (tmp = SYNCTEX_GET_LOG_NAME())) {
/* In version 1, the jobname was used but it caused problems regarding spaces in file names. */
- the_real_syncname = xmalloc((unsigned)
- (strlen(tmp) + strlen(synctex_suffix) +
- strlen(synctex_suffix_gz) + 1));
+ the_real_syncname =
+ xmalloc((unsigned)(strlen(tmp)
+ + strlen(synctex_suffix)
+ + SYNCTEX_GZ_LEN(synctex_suffix_gz)
+ + 1));
if (!the_real_syncname) {
SYNCTEX_FREE(tmp);
synctexabort(0);
@@ -822,7 +863,9 @@ void synctexterminate(boolean log_opened)
if (!SYNCTEX_NO_GZ) {
/* Remove any uncompressed synctex file, from a previous build. */
remove(the_real_syncname);
- strcat(the_real_syncname, synctex_suffix_gz);
+ if (!SYNCTEX_NO_GZ_AUX_NAME) {
+ strcat(the_real_syncname, synctex_suffix_gz);
+ }
}
/* allways remove the synctex output file before renaming it, windows requires it. */
if (0 != remove(the_real_syncname) && errno == EACCES) {
@@ -852,12 +895,12 @@ void synctexterminate(boolean log_opened)
#ifdef W32UPTEXSYNCTEX
{
char *stmp = chgto_oem(tmp);
- printf((synctex_ctxt.flags.quoted ? "\nSyncTeX written on \"%s\"" : "\nSyncTeX written on %s."),
+ printf((synctex_ctxt.flags.quoted ? "SyncTeX written on \"%s\"" : "\nSyncTeX written on %s.\n"),
stmp);
free(stmp);
}
#else
- printf((synctex_ctxt.flags.quoted ? "\nSyncTeX written on \"%s\"" : "\nSyncTeX written on %s."),
+ printf((synctex_ctxt.flags.quoted ? "SyncTeX written on \"%s\"\n" : "SyncTeX written on %s.\n"),
tmp);
#endif
tmp = NULL;
@@ -878,7 +921,7 @@ void synctexterminate(boolean log_opened)
remove(synctex_ctxt.busy_name);
}
}
- if (SYNCTEX_NO_GZ) {
+ if (SYNCTEX_NO_GZ || SYNCTEX_NO_GZ_AUX_NAME) {
/* Remove any compressed synctex file, from a previous build. */
strcat(the_real_syncname, synctex_suffix_gz);
remove(the_real_syncname);
@@ -889,8 +932,10 @@ void synctexterminate(boolean log_opened)
We just try to remove existing synctex output files
including the busy one. */
the_real_syncname = xmalloc((size_t)
- (len + strlen(synctex_suffix)
- + strlen(synctex_suffix_gz) + 1));
+ (len
+ + strlen(synctex_suffix)
+ + SYNCTEX_GZ_LEN(synctex_suffix_gz)
+ + 1));
if (!the_real_syncname) {
SYNCTEX_FREE(tmp);
synctexabort(0);
@@ -935,8 +980,6 @@ void synctexterminate(boolean log_opened)
synctexabort(0);
}
-static inline int synctex_record_content(void);
-static inline int synctex_record_settings(void);
static inline int synctex_record_sheet(integer sheet);
/* Recording the "{..." line. In *tex.web, use synctex_sheet(pdf_output) at
@@ -967,11 +1010,6 @@ void synctexsheet(integer mag)
if (mag > 0) {
synctex_ctxt.magnification = mag;
}
- if (SYNCTEX_NO_ERROR != synctex_record_settings()
- || SYNCTEX_NO_ERROR != synctex_record_content()) {
- synctexabort(0);
- return;
- }
}
synctex_record_sheet(SYNCTEX_GET_TOTAL_PAGES()+1);
}
@@ -981,6 +1019,7 @@ void synctexsheet(integer mag)
return;
}
+static inline int synctex_record_anchor(void);
static inline int synctex_record_teehs(integer sheet);
/* Recording the "}..." line. In *tex.web, use synctex_teehs at
@@ -1002,7 +1041,216 @@ void synctexteehs(void)
return;
}
-static inline void synctex_record_vlist(halfword p);
+/* The SYNCTEX_IGNORE macro is used to detect unproperly initialized nodes. See
+ * details in the implementation of the functions below. */
+# define SYNCTEX_IGNORE(NODE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE || !SYNCTEX_FILE || (synctex_ctxt.form_depth>0 && !SYNCTEX_WITH_FORMS)
+#define SYNCTEX_RECORD_LEN_OR_RETURN_ERR do {\
+if (len > 0) {\
+synctex_ctxt.total_length += len;\
+++synctex_ctxt.count;\
+} else {\
+return -1;\
+} } while(false)
+#define SYNCTEX_RECORD_LEN_AND_RETURN_NOERR do {\
+if (len > 0) {\
+synctex_ctxt.total_length += len;\
+++synctex_ctxt.count;\
+return SYNCTEX_NOERR;\
+} } while(false)
+
+/* Recording a "}..." or a ">" line */
+static inline int synctex_record_teehs(integer sheet)
+{
+# if SYNCTEX_DEBUG > 999
+ printf("\nSynchronize DEBUG: synctex_record_teehs\n");
+# endif
+ if (SYNCTEX_NOERR == synctex_record_anchor()) {
+ int len = SYNCTEX_fprintf(SYNCTEX_FILE, "}%i\n", sheet);
+ SYNCTEX_RECORD_LEN_AND_RETURN_NOERR;
+ }
+ synctexabort(0);
+ return -1;
+}
+
+# define SYNCTEX_CTXT_CURH \
+(synctex_ctxt.curh)
+# define SYNCTEX_CTXT_CURV \
+(synctex_ctxt.curv)
+# define SYNCTEX_SHOULD_COMPRESS_V \
+SYNCTEX_H_COMPRESS && (synctex_ctxt.lastv == SYNCTEX_CTXT_CURV)
+
+#if SYNCTEX_SUPPORT_PDF_FORM
+
+static inline int synctex_record_pdfxform(halfword form);
+
+/* glue code, this message is sent whenever a pdf form will ship out
+ See pdftex.web: procedure out_form(p: pointer); */
+void synctexpdfxform(halfword p)
+{
+ SYNCTEX_RETURN_IF_DISABLED;
+# if SYNCTEX_DEBUG
+ printf("\nSynchronize DEBUG: synctexpdfxform\n");
+# endif
+ if (SYNCTEX_IS_OFF) {
+ if (SYNCTEX_VALUE && !SYNCTEX_WARNING_DISABLE) {
+ SYNCTEX_WARNING_DISABLE = SYNCTEX_YES;
+ printf
+ ("\nSyncTeX warning: Synchronization was disabled from\nthe command line with -synctex=0\nChanging the value of \\synctex has no effect.");
+ }
+ return;
+ }
+ if (SYNCTEX_FILE
+ || (SYNCTEX_VALUE && (SYNCTEX_NO_ERROR != synctex_dot_open()))) {
+ synctex_record_pdfxform(p);
+ }
+# if SYNCTEX_DEBUG
+ printf("\nSynchronize DEBUG: synctexpdfxform END\n");
+# endif
+ return;
+}
+
+static inline int synctex_record_mrofxfdp(void);
+
+/* glue code, this message is sent whenever a pdf form did ship out */
+void synctexmrofxfdp(void)
+{
+ SYNCTEX_RETURN_IF_DISABLED;
+# if SYNCTEX_DEBUG
+ printf("\nSynchronize DEBUG: synctexmrofxfdp\n");
+# endif
+ synctex_record_mrofxfdp();
+# if SYNCTEX_DEBUG
+ printf("\nSynchronize DEBUG: synctexmrofxfdp END\n");
+# endif
+ return;
+}
+
+static inline int synctex_record_node_pdfrefxform(int formout);
+
+/* glue code, this message is sent whenever a pdf form ref will ship out
+ See pdftex.web: procedure out_form(p: pointer); */
+void synctexpdfrefxform(int objnum)
+{
+ SYNCTEX_RETURN_IF_DISABLED;
+# if SYNCTEX_DEBUG
+ printf("\nSynchronize DEBUG: synctexpdfrefxform\n");
+# endif
+ if (SYNCTEX_WITH_FORMS) {
+ synctex_record_node_pdfrefxform(objnum);
+ }
+# if SYNCTEX_DEBUG
+ printf("\nSynchronize DEBUG: synctexpdfrefxform END\n");
+# endif
+ return;
+}
+
+/* Recording a "<..." line */
+static inline int synctex_record_pdfxform(halfword form)
+{
+ SYNCTEX_RETURN_IF_DISABLED;
+# if SYNCTEX_DEBUG
+ printf("\nSynchronize DEBUG: synctex_record_pdfxform\n");
+# endif
+ if (SYNCTEX_IGNORE(nothing)) {
+ return SYNCTEX_NO_ERROR;
+ } else {
+ ++synctex_ctxt.form_depth;
+ if (SYNCTEX_WITH_FORMS) {
+ int len = SYNCTEX_fprintf(SYNCTEX_FILE, "<%i\n",
+ SYNCTEX_PDF_CUR_FORM);
+ SYNCTEX_RECORD_LEN_AND_RETURN_NOERR;
+ } else {
+ return SYNCTEX_NO_ERROR;
+ }
+ }
+ synctexabort(0);
+ return -1;
+}
+
+/* Recording a ">" line */
+static inline int synctex_record_mrofxfdp(void)
+{
+# if SYNCTEX_DEBUG > 999
+ printf("\nSynchronize DEBUG: synctex_record_mrofxfpd\n");
+# endif
+ if (SYNCTEX_NOERR == synctex_record_anchor()) {
+ --synctex_ctxt.form_depth;
+ if (SYNCTEX_WITH_FORMS) {
+ int len = SYNCTEX_fprintf(SYNCTEX_FILE, ">\n",
+ SYNCTEX_PDF_CUR_FORM);
+ SYNCTEX_RECORD_LEN_AND_RETURN_NOERR;
+ } else {
+ return SYNCTEX_NO_ERROR;
+ }
+ }
+ synctexabort(0);
+ return -1;
+}
+
+/* Recording a "f..." line */
+static inline int synctex_record_node_pdfrefxform(int objnum)//UNUSED form JL
+{
+ SYNCTEX_RETURN_IF_DISABLED;
+# if SYNCTEX_DEBUG
+ printf("\nSynchronize DEBUG: synctex_record_node_pdfrefxform\n");
+# endif
+ synctex_ctxt.curh = SYNCTEX_CURH;
+ synctex_ctxt.curv = SYNCTEX_CURV;
+ if (SYNCTEX_IGNORE(nothing)) {
+ return SYNCTEX_NO_ERROR;
+ } else if (synctex_ctxt.form_depth>0 && !SYNCTEX_WITH_FORMS) {
+ return SYNCTEX_NO_ERROR;
+ } else {
+ int len = 0;
+ if (SYNCTEX_SHOULD_COMPRESS_V) {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "f%i:%i,=\n",
+ objnum,
+ SYNCTEX_CURH UNIT);
+ } else {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "f%i:%i,%i\n",
+ objnum,
+ SYNCTEX_CURH UNIT,
+ SYNCTEX_CURV UNIT);
+ synctex_ctxt.lastv = SYNCTEX_CURV;
+ }
+ SYNCTEX_RECORD_LEN_AND_RETURN_NOERR;
+ }
+ synctexabort(0);
+ return -1;
+}
+#else
+/* DO NOTHING functions.
+ Any engine will have these functions, even when not using pdf xforms.
+ One shoud be able to replace these void implementaions with an alternation in the header file.
+ */
+void synctexpdfxform(halfword p)
+{
+ SYNCTEX_RETURN_IF_DISABLED;
+# if SYNCTEX_DEBUG
+ printf("\nSynchronize DEBUG: DO NOTHING synctexpdfxform\n");
+# endif
+ return;
+}
+void synctexmrofxfdp(void)
+{
+ SYNCTEX_RETURN_IF_DISABLED;
+# if SYNCTEX_DEBUG
+ printf("\nSynchronize DEBUG: DO NOTHING synctexmrofxfdp END\n");
+# endif
+ return;
+}
+void synctexpdfrefxform(int objnum)
+{
+ SYNCTEX_RETURN_IF_DISABLED;
+# if SYNCTEX_DEBUG
+ printf("\nSynchronize DEBUG: DO NOTHING synctexpdfrefxform\n");
+# endif
+ return;
+}
+#endif
+/*#if SYNCTEX_SUPPORT_PDF_FORM*/
+
+static inline void synctex_record_node_vlist(halfword p);
/* When an hlist ships out, it can contain many different kern/glue nodes with
* exactly the same sync tag and line. To reduce the size of the .synctex
@@ -1012,16 +1260,12 @@ static inline void synctex_record_vlist(halfword p);
* consecutive nodes, as far as possible. This tricky part uses a "recorder",
* which is the address of the routine that knows how to write the
* synchronization info to the .synctex file. It also uses criteria to detect
- * a change in the context, this is the macro SYNCTEX_???_CONTEXT_DID_CHANGE. The
- * SYNCTEX_IGNORE macro is used to detect unproperly initialized nodes. See
- * details in the implementation of the functions below. */
-# define SYNCTEX_IGNORE(NODE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE || !SYNCTEX_FILE
-
+ * a change in the context, this is the macro SYNCTEX_???_CONTEXT_DID_CHANGE.*/
/* This message is sent when a vlist will be shipped out, more precisely at
* the beginning of the vlist_out procedure in *TeX.web. It will be balanced
* by a synctex_tsilv, sent at the end of the vlist_out procedure. p is the
- * address of the vlist We assume that p is really a vlist node! */
+ * address of the vlist. We assume that p is really a vlist node! */
void synctexvlist(halfword this_box)
{
SYNCTEX_RETURN_IF_DISABLED;
@@ -1037,10 +1281,10 @@ void synctexvlist(halfword this_box)
synctex_ctxt.line = SYNCTEX_LINE_MODEL(this_box,box);
synctex_ctxt.curh = SYNCTEX_CURH;
synctex_ctxt.curv = SYNCTEX_CURV;
- synctex_record_vlist(this_box);
+ synctex_record_node_vlist(this_box);
}
-static inline void synctex_record_tsilv(halfword p);
+static inline void synctex_record_node_tsilv(halfword p);
/* Recording a "f" line ending a vbox: this message is sent whenever a vlist
* has been shipped out. It is used to close the vlist nesting level. It is
@@ -1062,10 +1306,10 @@ void synctextsilv(halfword this_box)
synctex_ctxt.curh = SYNCTEX_CURH;
synctex_ctxt.curv = SYNCTEX_CURV;
synctex_ctxt.recorder = NULL;
- synctex_record_tsilv(this_box);
+ synctex_record_node_tsilv(this_box);
}
-static inline void synctex_record_void_vlist(halfword p);
+static inline void synctex_record_node_void_vlist(halfword p);
/* This message is sent when a void vlist will be shipped out.
* There is no need to balance a void vlist. */
@@ -1084,7 +1328,7 @@ void synctexvoidvlist(halfword p, halfword this_box __attribute__ ((unused)))
synctex_ctxt.curh = SYNCTEX_CURH;
synctex_ctxt.curv = SYNCTEX_CURV;
synctex_ctxt.recorder = NULL; /* reset */
- synctex_record_void_vlist(p);
+ synctex_record_node_void_vlist(p);
}
static inline void synctex_record_hlist(halfword p);
@@ -1111,7 +1355,7 @@ void synctexhlist(halfword this_box)
synctex_record_hlist(this_box);
}
-static inline void synctex_record_tsilh(halfword p);
+static inline void synctex_record_node_tsilh(halfword p);
/* Recording a ")" line ending an hbox this message is sent whenever an hlist
* has been shipped out it is used to close the hlist nesting level. It is
@@ -1133,10 +1377,10 @@ void synctextsilh(halfword this_box)
synctex_ctxt.curh = SYNCTEX_CURH;
synctex_ctxt.curv = SYNCTEX_CURV;
synctex_ctxt.recorder = NULL; /* reset */
- synctex_record_tsilh(this_box);
+ synctex_record_node_tsilh(this_box);
}
-static inline void synctex_record_void_hlist(halfword p);
+static inline void synctex_record_node_void_hlist(halfword p);
/* This message is sent when a void hlist will be shipped out.
* There is no need to balance a void hlist. */
@@ -1160,11 +1404,12 @@ void synctexvoidhlist(halfword p, halfword this_box __attribute__ ((unused)))
synctex_ctxt.curh = SYNCTEX_CURH;
synctex_ctxt.curv = SYNCTEX_CURV;
synctex_ctxt.recorder = NULL; /* reset */
- synctex_record_void_hlist(p);
+ synctex_record_node_void_hlist(p);
}
/* With LuaTeX we have to consider other node sizes than medium ones */
# define SYNCTEX_IGNORE_NODE(NODE,TYPE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE \
+|| (synctex_ctxt.form_depth>0 && !SYNCTEX_WITH_FORMS) \
|| (0 >= SYNCTEX_TAG_MODEL(NODE,TYPE)) \
|| (0 >= SYNCTEX_LINE_MODEL(NODE,TYPE))
/* This macro will detect a change in the synchronization context. As long as
@@ -1175,7 +1420,7 @@ void synctexvoidhlist(halfword p, halfword this_box __attribute__ ((unused)))
|| (SYNCTEX_TAG_MODEL(NODE,TYPE) != synctex_ctxt.tag)\
|| (SYNCTEX_LINE_MODEL(NODE,TYPE) != synctex_ctxt.line))
-void synctex_math_recorder(halfword p);
+void synctex_record_node_math(halfword p);
/* glue code, this message is sent whenever an inline math node will ship out
See: @ @<Output the non-|char_node| |p| for... */
@@ -1198,12 +1443,12 @@ void synctexmath(halfword p, halfword this_box __attribute__ ((unused)))
synctex_ctxt.curh = SYNCTEX_CURH;
synctex_ctxt.curv = SYNCTEX_CURV;
synctex_ctxt.recorder = NULL;/* no need to record once more */
- synctex_math_recorder(p);/* always record synchronously */
+ synctex_record_node_math(p);/* always record synchronously */
}
-static inline void synctex_record_glue(halfword p);
-static inline void synctex_record_kern(halfword p);
-static inline void synctex_record_rule(halfword p);
+static inline void synctex_record_node_glue(halfword p);
+static inline void synctex_record_node_rule(halfword p);
+static inline void synctex_record_node_kern(halfword p);
/* this message is sent whenever an horizontal glue node or rule node ships out
See: move_past:... */
@@ -1216,7 +1461,7 @@ void synctexhorizontalruleorglue(halfword p, halfword this_box
{
SYNCTEX_RETURN_IF_DISABLED;
# if SYNCTEX_DEBUG
- printf("\nSynchronize DEBUG: synctexglue\n");
+ printf("\nSynchronize DEBUG: synctexhorizontalruleorglue\n");
# endif
switch (SYNCTEX_TYPE(p)) {
case rule_node:
@@ -1245,25 +1490,23 @@ void synctexhorizontalruleorglue(halfword p, halfword this_box
case rule_node:
synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p,rule);
synctex_ctxt.line = SYNCTEX_LINE_MODEL(p,rule);
- synctex_record_rule(p); /* always record synchronously: maybe some text is outside the box */
+ synctex_record_node_rule(p); /* always record synchronously: maybe some text is outside the box */
break;
case glue_node:
synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p,glue);
synctex_ctxt.line = SYNCTEX_LINE_MODEL(p,glue);
- synctex_record_glue(p); /* always record synchronously: maybe some text is outside the box */
+ synctex_record_node_glue(p); /* always record synchronously: maybe some text is outside the box */
break;
case kern_node:
synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p,kern);
synctex_ctxt.line = SYNCTEX_LINE_MODEL(p,kern);
- synctex_record_kern(p); /* always record synchronously: maybe some text is outside the box */
+ synctex_record_node_kern(p); /* always record synchronously: maybe some text is outside the box */
break;
default:
printf("\nSynchronize ERROR: unknown node type %i\n", SYNCTEX_TYPE(p));
}
}
-void synctex_kern_recorder(halfword p);
-
/* this message is sent whenever a kern node ships out
See: @ @<Output the non-|char_node| |p| for... */
void synctexkern(halfword p, halfword this_box)
@@ -1286,7 +1529,7 @@ void synctexkern(halfword p, halfword this_box)
synctex_ctxt.node = p;
synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p,kern);
synctex_ctxt.line = SYNCTEX_LINE_MODEL(p,kern);
- synctex_ctxt.recorder = &synctex_kern_recorder;
+ synctex_ctxt.recorder = &synctex_record_node_kern;
} else {
synctex_ctxt.node = p;
synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p,kern);
@@ -1294,14 +1537,14 @@ void synctexkern(halfword p, halfword this_box)
synctex_ctxt.recorder = NULL;
/* always record when the context has just changed
* and when not the first node */
- synctex_kern_recorder(p);
+ synctex_record_node_kern(p);
}
} else {
/* just update the geometry and type (for future improvements) */
synctex_ctxt.node = p;
synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p,kern);
synctex_ctxt.line = SYNCTEX_LINE_MODEL(p,kern);
- synctex_ctxt.recorder = &synctex_kern_recorder;
+ synctex_ctxt.recorder = &synctex_record_node_kern;
}
}
@@ -1311,7 +1554,7 @@ void synctexkern(halfword p, halfword this_box)
# define SYNCTEX_IGNORE(NODE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE || !SYNCTEX_FILE \
|| (synctex_ctxt.count>2000)
-void synctex_char_recorder(halfword p);
+void synctex_record_node_char(halfword p);
/* this message is sent whenever a char node ships out */
void synctexchar(halfword p, halfword this_box __attribute__ ((unused)))
@@ -1332,10 +1575,10 @@ void synctexchar(halfword p, halfword this_box __attribute__ ((unused)))
synctex_ctxt.line = 0;
synctex_ctxt.recorder = NULL;
/* always record when the context has just changed */
- synctex_char_recorder(p);
+ synctex_record_node_char(p);
}
-void synctex_node_recorder(halfword p);
+void synctex_record_node_unknown(halfword p);
# undef SYNCTEX_IGNORE
# define SYNCTEX_IGNORE(NODE) (SYNCTEX_IS_OFF || !SYNCTEX_VALUE || !SYNCTEX_FILE)
@@ -1352,7 +1595,7 @@ void synctexnode(halfword p, halfword this_box __attribute__ ((unused)))
return;
}
/* always record, not very usefull yet */
- synctex_node_recorder(p);
+ synctex_record_node_unknown(p);
}
/* this message should be sent to record information
@@ -1366,9 +1609,18 @@ void synctexcurrent(void)
if (SYNCTEX_IGNORE(nothing)) {
return;
} else {
- int len = SYNCTEX_fprintf(SYNCTEX_FILE, "x%i,%i:%i,%i\n",
+ int len = 0;
+ if (SYNCTEX_SHOULD_COMPRESS_V) {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "x%i,%i:%i,=\n",
+ synctex_ctxt.tag,synctex_ctxt.line,
+ SYNCTEX_CURH UNIT);
+ } else {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "x%i,%i:%i,%i\n",
synctex_ctxt.tag,synctex_ctxt.line,
- SYNCTEX_CURH UNIT,SYNCTEX_CURV UNIT);
+ SYNCTEX_CURH UNIT,
+ SYNCTEX_CURV UNIT);
+ synctex_ctxt.lastv = SYNCTEX_CURV;
+ }
if (len > 0) {
synctex_ctxt.total_length += len;
return;
@@ -1409,7 +1661,9 @@ static inline int synctex_record_preamble(void)
printf("\nSynchronize DEBUG: synctex_record_preamble\n");
# endif
len =
- SYNCTEX_fprintf(SYNCTEX_FILE, "SyncTeX Version:%i\n", SYNCTEX_VERSION);
+ SYNCTEX_fprintf(SYNCTEX_FILE, "SyncTeX Version:%i\n",
+ synctex_ctxt.options>SYNCTEX_VERSION?
+ synctex_ctxt.options:SYNCTEX_VERSION);
if (len > 0) {
synctex_ctxt.total_length = len;
return SYNCTEX_NOERR;
@@ -1475,116 +1729,121 @@ static inline int synctex_record_sheet(integer sheet)
# endif
if (SYNCTEX_NOERR == synctex_record_anchor()) {
int len = SYNCTEX_fprintf(SYNCTEX_FILE, "{%i\n", sheet);
- if (len > 0) {
- synctex_ctxt.total_length += len;
- ++synctex_ctxt.count;
- return SYNCTEX_NOERR;
- }
- }
- synctexabort(0);
- return -1;
-}
-
-/* Recording a "}..." line */
-static inline int synctex_record_teehs(integer sheet)
-{
-# if SYNCTEX_DEBUG > 999
- printf("\nSynchronize DEBUG: synctex_record_teehs\n");
-# endif
- if (SYNCTEX_NOERR == synctex_record_anchor()) {
- int len = SYNCTEX_fprintf(SYNCTEX_FILE, "}%i\n", sheet);
- if (len > 0) {
- synctex_ctxt.total_length += len;
- ++synctex_ctxt.count;
- return SYNCTEX_NOERR;
- }
+ SYNCTEX_RECORD_LEN_AND_RETURN_NOERR;
}
synctexabort(0);
return -1;
}
/* Recording a "v..." line */
-static inline void synctex_record_void_vlist(halfword p)
+static inline void synctex_record_node_void_vlist(halfword p)
{
int len = 0;
# if SYNCTEX_DEBUG > 999
- printf("\nSynchronize DEBUG: synctex_record_void_vlist\n");
-# endif
- len = SYNCTEX_fprintf(SYNCTEX_FILE, "v%i,%i:%i,%i:%i,%i,%i\n",
- SYNCTEX_TAG_MODEL(p,box),
- SYNCTEX_LINE_MODEL(p,box),
- synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
- SYNCTEX_WIDTH(p) UNIT,
- SYNCTEX_HEIGHT(p) UNIT,
- SYNCTEX_DEPTH(p) UNIT);
- if (len > 0) {
- synctex_ctxt.total_length += len;
- ++synctex_ctxt.count;
- return;
- }
+ printf("\nSynchronize DEBUG: synctex_record_node_void_vlist\n");
+# endif
+ if (SYNCTEX_SHOULD_COMPRESS_V) {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "v%i,%i:%i,=:%i,%i,%i\n",
+ SYNCTEX_TAG_MODEL(p,box),
+ SYNCTEX_LINE_MODEL(p,box),
+ SYNCTEX_CTXT_CURH UNIT,
+ SYNCTEX_WIDTH(p) UNIT,
+ SYNCTEX_HEIGHT(p) UNIT,
+ SYNCTEX_DEPTH(p) UNIT);
+ } else {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "v%i,%i:%i,%i:%i,%i,%i\n",
+ SYNCTEX_TAG_MODEL(p,box),
+ SYNCTEX_LINE_MODEL(p,box),
+ SYNCTEX_CTXT_CURH UNIT,
+ SYNCTEX_CTXT_CURV UNIT,
+ SYNCTEX_WIDTH(p) UNIT,
+ SYNCTEX_HEIGHT(p) UNIT,
+ SYNCTEX_DEPTH(p) UNIT);
+ synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
+ }
+# define SYNCTEX_RECORD_LEN_AND_RETURN do {\
+ if (len > 0) {\
+ synctex_ctxt.total_length += len;\
+ ++synctex_ctxt.count;\
+ return;\
+ } } while(false)
+ SYNCTEX_RECORD_LEN_AND_RETURN;
synctexabort(0);
return;
}
/* Recording a "[..." line */
-static inline void synctex_record_vlist(halfword p)
+static inline void synctex_record_node_vlist(halfword p)
{
int len = 0;
SYNCTEX_NOT_VOID = SYNCTEX_YES;
# if SYNCTEX_DEBUG > 999
- printf("\nSynchronize DEBUG: synctex_record_vlist\n");
-# endif
- len = SYNCTEX_fprintf(SYNCTEX_FILE, "[%i,%i:%i,%i:%i,%i,%i\n",
- SYNCTEX_TAG_MODEL(p,box),
- SYNCTEX_LINE_MODEL(p,box),
- synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
- SYNCTEX_WIDTH(p) UNIT,
- SYNCTEX_HEIGHT(p) UNIT,
- SYNCTEX_DEPTH(p) UNIT);
- if (len > 0) {
- synctex_ctxt.total_length += len;
- ++synctex_ctxt.count;
- return;
+ printf("\nSynchronize DEBUG: synctex_record_node_vlist\n");
+# endif
+ if (SYNCTEX_SHOULD_COMPRESS_V) {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "[%i,%i:%i,=:%i,%i,%i\n",
+ SYNCTEX_TAG_MODEL(p,box),
+ SYNCTEX_LINE_MODEL(p,box),
+ SYNCTEX_CTXT_CURH UNIT,
+ SYNCTEX_WIDTH(p) UNIT,
+ SYNCTEX_HEIGHT(p) UNIT,
+ SYNCTEX_DEPTH(p) UNIT);
+ } else {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "[%i,%i:%i,%i:%i,%i,%i\n",
+ SYNCTEX_TAG_MODEL(p,box),
+ SYNCTEX_LINE_MODEL(p,box),
+ SYNCTEX_CTXT_CURH UNIT,
+ SYNCTEX_CTXT_CURV UNIT,
+ SYNCTEX_WIDTH(p) UNIT,
+ SYNCTEX_HEIGHT(p) UNIT,
+ SYNCTEX_DEPTH(p) UNIT);
+ synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
}
+ SYNCTEX_RECORD_LEN_AND_RETURN;
synctexabort(0);
return;
}
/* Recording a "]..." line */
-static inline void synctex_record_tsilv(halfword p __attribute__ ((unused)))
+static inline void synctex_record_node_tsilv(halfword p __attribute__ ((unused)))
{
int len = 0;
# if SYNCTEX_DEBUG > 999
- printf("\nSynchronize DEBUG: synctex_record_tsilv\n");
+ printf("\nSynchronize DEBUG: synctex_record_node_tsilv\n");
# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "]\n");
- if (len > 0) {
- synctex_ctxt.total_length += len;
- return;
- }
+ SYNCTEX_RECORD_LEN_AND_RETURN;
synctexabort(0);
return;
}
/* Recording a "h..." line */
-static inline void synctex_record_void_hlist(halfword p)
+static inline void synctex_record_node_void_hlist(halfword p)
{
int len = 0;
# if SYNCTEX_DEBUG > 999
- printf("\nSynchronize DEBUG: synctex_record_void_hlist\n");
-# endif
- len = SYNCTEX_fprintf(SYNCTEX_FILE, "h%i,%i:%i,%i:%i,%i,%i\n",
- SYNCTEX_TAG_MODEL(p,box),
- SYNCTEX_LINE_MODEL(p,box),
- synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
- SYNCTEX_WIDTH(p) UNIT,
- SYNCTEX_HEIGHT(p) UNIT,
- SYNCTEX_DEPTH(p) UNIT);
- if (len > 0) {
- synctex_ctxt.total_length += len;
- ++synctex_ctxt.count;
- return;
+ printf("\nSynchronize DEBUG: synctex_record_node_void_hlist\n");
+# endif
+ if (SYNCTEX_SHOULD_COMPRESS_V) {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "h%i,%i:%i,=:%i,%i,%i\n",
+ SYNCTEX_TAG_MODEL(p,box),
+ SYNCTEX_LINE_MODEL(p,box),
+ SYNCTEX_CTXT_CURH UNIT,
+ SYNCTEX_WIDTH(p) UNIT,
+ SYNCTEX_HEIGHT(p) UNIT,
+ SYNCTEX_DEPTH(p) UNIT);
+ } else {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "h%i,%i:%i,%i:%i,%i,%i\n",
+ SYNCTEX_TAG_MODEL(p,box),
+ SYNCTEX_LINE_MODEL(p,box),
+ SYNCTEX_CTXT_CURH UNIT,
+ SYNCTEX_CTXT_CURV UNIT,
+ SYNCTEX_WIDTH(p) UNIT,
+ SYNCTEX_HEIGHT(p) UNIT,
+ SYNCTEX_DEPTH(p) UNIT);
+ synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
}
+ SYNCTEX_RECORD_LEN_AND_RETURN;
synctexabort(0);
return;
}
@@ -1597,35 +1856,39 @@ static inline void synctex_record_hlist(halfword p)
# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_record_hlist\n");
# endif
- len = SYNCTEX_fprintf(SYNCTEX_FILE, "(%i,%i:%i,%i:%i,%i,%i\n",
- SYNCTEX_TAG_MODEL(p,box),
- SYNCTEX_LINE_MODEL(p,box),
- synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
- SYNCTEX_WIDTH(p) UNIT,
- SYNCTEX_HEIGHT(p) UNIT,
- SYNCTEX_DEPTH(p) UNIT);
- if (len > 0) {
- synctex_ctxt.total_length += len;
- ++synctex_ctxt.count;
- return;
+ if (SYNCTEX_SHOULD_COMPRESS_V) {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "(%i,%i:%i,=:%i,%i,%i\n",
+ SYNCTEX_TAG_MODEL(p,box),
+ SYNCTEX_LINE_MODEL(p,box),
+ SYNCTEX_CTXT_CURH UNIT,
+ SYNCTEX_WIDTH(p) UNIT,
+ SYNCTEX_HEIGHT(p) UNIT,
+ SYNCTEX_DEPTH(p) UNIT);
+ } else {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "(%i,%i:%i,%i:%i,%i,%i\n",
+ SYNCTEX_TAG_MODEL(p,box),
+ SYNCTEX_LINE_MODEL(p,box),
+ SYNCTEX_CTXT_CURH UNIT,
+ SYNCTEX_CTXT_CURV UNIT,
+ SYNCTEX_WIDTH(p) UNIT,
+ SYNCTEX_HEIGHT(p) UNIT,
+ SYNCTEX_DEPTH(p) UNIT);
+ synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
}
+ SYNCTEX_RECORD_LEN_AND_RETURN;
synctexabort(0);
return;
}
/* Recording a ")..." line */
-static inline void synctex_record_tsilh(halfword p __attribute__ ((unused)))
+static inline void synctex_record_node_tsilh(halfword p __attribute__ ((unused)))
{
int len = 0;
# if SYNCTEX_DEBUG > 999
- printf("\nSynchronize DEBUG: synctex_record_tsilh\n");
+ printf("\nSynchronize DEBUG: synctex_record_node_tsilh\n");
# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, ")\n");
- if (len > 0) {
- synctex_ctxt.total_length += len;
- ++synctex_ctxt.count;
- return;
- }
+ SYNCTEX_RECORD_LEN_AND_RETURN;
synctexabort(0);
return;
}
@@ -1671,141 +1934,149 @@ static inline int synctex_record_postamble(void)
}
/* Recording a "g..." line */
-static inline void synctex_record_glue(halfword p)
+static inline void synctex_record_node_glue(halfword p)
{
int len = 0;
# if SYNCTEX_DEBUG > 999
- printf("\nSynchronize DEBUG: synctex_glue_recorder\n");
+ printf("\nSynchronize DEBUG: synctex_record_node_glue\n");
# endif
- len = SYNCTEX_fprintf(SYNCTEX_FILE, "g%i,%i:%i,%i\n",
- SYNCTEX_TAG_MODEL(p,glue),
- SYNCTEX_LINE_MODEL(p,glue),
- synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT);
- if (len > 0) {
- synctex_ctxt.total_length += len;
- ++synctex_ctxt.count;
- return;
+ if (SYNCTEX_SHOULD_COMPRESS_V) {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "g%i,%i:%i,=\n",
+ SYNCTEX_TAG_MODEL(p,glue),
+ SYNCTEX_LINE_MODEL(p,glue),
+ SYNCTEX_CTXT_CURH UNIT);
+ } else {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "g%i,%i:%i,%i\n",
+ SYNCTEX_TAG_MODEL(p,glue),
+ SYNCTEX_LINE_MODEL(p,glue),
+ SYNCTEX_CTXT_CURH UNIT,
+ SYNCTEX_CTXT_CURV UNIT);
+ synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
}
+ SYNCTEX_RECORD_LEN_AND_RETURN;
synctexabort(0);
return;
}
/* Recording a "k..." line */
-static inline void synctex_record_kern(halfword p)
+static inline void synctex_record_node_kern(halfword p)
{
int len = 0;
# if SYNCTEX_DEBUG > 999
- printf("\nSynchronize DEBUG: synctex_kern_recorder\n");
-# endif
- len = SYNCTEX_fprintf(SYNCTEX_FILE, "k%i,%i:%i,%i:%i\n",
- SYNCTEX_TAG_MODEL(p,glue),
- SYNCTEX_LINE_MODEL(p,glue),
- synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
- SYNCTEX_WIDTH(p) UNIT);
- if (len > 0) {
- synctex_ctxt.total_length += len;
- ++synctex_ctxt.count;
- return;
+ printf("\nSynchronize DEBUG: synctex_record_node_kern\n");
+# endif
+ if (SYNCTEX_SHOULD_COMPRESS_V) {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "k%i,%i:%i,=:%i\n",
+ SYNCTEX_TAG_MODEL(p,glue),
+ SYNCTEX_LINE_MODEL(p,glue),
+ SYNCTEX_CTXT_CURH UNIT,
+ SYNCTEX_WIDTH(p) UNIT);
+ } else {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "k%i,%i:%i,%i:%i\n",
+ SYNCTEX_TAG_MODEL(p,glue),
+ SYNCTEX_LINE_MODEL(p,glue),
+ SYNCTEX_CTXT_CURH UNIT,
+ SYNCTEX_CTXT_CURV UNIT,
+ SYNCTEX_WIDTH(p) UNIT);
+ synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
}
+ SYNCTEX_RECORD_LEN_AND_RETURN;
synctexabort(0);
return;
}
/* Recording a "r..." line */
-static inline void synctex_record_rule(halfword p)
+static inline void synctex_record_node_rule(halfword p)
{
int len = 0;
# if SYNCTEX_DEBUG > 999
- printf("\nSynchronize DEBUG: synctex_record_tsilh\n");
-# endif
- len = SYNCTEX_fprintf(SYNCTEX_FILE, "r%i,%i:%i,%i:%i,%i,%i\n",
- SYNCTEX_TAG_MODEL(p,rule),
- SYNCTEX_LINE_MODEL(p,rule),
- synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
- SYNCTEX_RULE_WD UNIT, SYNCTEX_RULE_HT UNIT, SYNCTEX_RULE_DP UNIT);
- if (len > 0) {
- synctex_ctxt.total_length += len;
- ++synctex_ctxt.count;
- return;
+ printf("\nSynchronize DEBUG: synctex_record_node_tsilh\n");
+# endif
+ if (SYNCTEX_SHOULD_COMPRESS_V) {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "r%i,%i:%i,=:%i,%i,%i\n",
+ SYNCTEX_TAG_MODEL(p,rule),
+ SYNCTEX_LINE_MODEL(p,rule),
+ SYNCTEX_CTXT_CURH UNIT,
+ SYNCTEX_RULE_WD UNIT, SYNCTEX_RULE_HT UNIT, SYNCTEX_RULE_DP UNIT);
+ } else {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "r%i,%i:%i,%i:%i,%i,%i\n",
+ SYNCTEX_TAG_MODEL(p,rule),
+ SYNCTEX_LINE_MODEL(p,rule),
+ SYNCTEX_CTXT_CURH UNIT,
+ SYNCTEX_CTXT_CURV UNIT,
+ SYNCTEX_RULE_WD UNIT, SYNCTEX_RULE_HT UNIT, SYNCTEX_RULE_DP UNIT);
+ synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
}
+ SYNCTEX_RECORD_LEN_AND_RETURN;
synctexabort(0);
return;
}
/* Recording a "$..." line */
-void synctex_math_recorder(halfword p)
-{
- int len = 0;
-# if SYNCTEX_DEBUG > 999
- printf("\nSynchronize DEBUG: synctex_math_recorder\n");
-# endif
- len = SYNCTEX_fprintf(SYNCTEX_FILE, "$%i,%i:%i,%i\n",
- SYNCTEX_TAG_MODEL(p, math),
- SYNCTEX_LINE_MODEL(p, math),
- synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT);
- if (len > 0) {
- synctex_ctxt.total_length += len;
- ++synctex_ctxt.count;
- return;
- }
- synctexabort(0);
- return;
-}
-
-/* Recording a "k..." line */
-void synctex_kern_recorder(halfword p)
+void synctex_record_node_math(halfword p)
{
int len = 0;
# if SYNCTEX_DEBUG > 999
- printf("\nSynchronize DEBUG: synctex_kern_recorder\n");
+ printf("\nSynchronize DEBUG: synctex_record_node_math\n");
# endif
- len = SYNCTEX_fprintf(SYNCTEX_FILE, "k%i,%i:%i,%i:%i\n",
- SYNCTEX_TAG_MODEL(p, kern),
- SYNCTEX_LINE_MODEL(p, kern),
- synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
- SYNCTEX_WIDTH(p) UNIT);
- if (len > 0) {
- synctex_ctxt.total_length += len;
- ++synctex_ctxt.count;
- return;
+ if (SYNCTEX_SHOULD_COMPRESS_V) {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "$%i,%i:%i,=\n",
+ SYNCTEX_TAG_MODEL(p, math),
+ SYNCTEX_LINE_MODEL(p, math),
+ SYNCTEX_CTXT_CURH UNIT);
+ } else {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "$%i,%i:%i,%i\n",
+ SYNCTEX_TAG_MODEL(p, math),
+ SYNCTEX_LINE_MODEL(p, math),
+ SYNCTEX_CTXT_CURH UNIT,
+ SYNCTEX_CTXT_CURV UNIT);
+ synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
}
+ SYNCTEX_RECORD_LEN_AND_RETURN;
synctexabort(0);
return;
}
/* Recording a "c..." line */
-void synctex_char_recorder(halfword p __attribute__ ((unused)))
+void synctex_record_node_char(halfword p __attribute__ ((unused)))
{
int len = 0;
# if SYNCTEX_DEBUG > 999
- printf("\nSynchronize DEBUG: synctex_char_recorder\n");
+ printf("\nSynchronize DEBUG: synctex_record_node_char\n");
# endif
- len = SYNCTEX_fprintf(SYNCTEX_FILE, "c%i,%i\n",
- synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT);
- if (len > 0) {
- synctex_ctxt.total_length += len;
- ++synctex_ctxt.count;
- return;
+ if (SYNCTEX_SHOULD_COMPRESS_V) {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "c%i,=\n",
+ SYNCTEX_CTXT_CURH UNIT);
+ } else {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "c%i,%i\n",
+ SYNCTEX_CTXT_CURH UNIT,
+ SYNCTEX_CTXT_CURV UNIT);
+ synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
}
+ SYNCTEX_RECORD_LEN_AND_RETURN;
synctexabort(0);
return;
}
/* Recording a "?..." line, type, subtype and position */
-void synctex_node_recorder(halfword p)
+void synctex_record_node_unknown(halfword p)
{
int len = 0;
# if SYNCTEX_DEBUG > 999
- printf("\nSynchronize DEBUG: synctex_node_recorder(0x%x)\n", p);
+ printf("\nSynchronize DEBUG: synctex_record_node_unknown(0x%x)\n", p);
# endif
- len = SYNCTEX_fprintf(SYNCTEX_FILE, "?%i,%i:%i,%i\n",
- synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
- SYNCTEX_TYPE(p), SYNCTEX_SUBTYPE(p));
- if (len > 0) {
- synctex_ctxt.total_length += len;
- ++synctex_ctxt.count;
- return;
+ if (SYNCTEX_SHOULD_COMPRESS_V) {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "?%i,=:%i,%i\n",
+ SYNCTEX_CTXT_CURH UNIT,
+ SYNCTEX_TYPE(p), SYNCTEX_SUBTYPE(p));
+ } else {
+ len = SYNCTEX_fprintf(SYNCTEX_FILE, "?%i,%i:%i,%i\n",
+ SYNCTEX_CTXT_CURH UNIT,
+ SYNCTEX_CTXT_CURV UNIT,
+ SYNCTEX_TYPE(p), SYNCTEX_SUBTYPE(p));
+ synctex_ctxt.lastv = SYNCTEX_CTXT_CURV;
}
+ SYNCTEX_RECORD_LEN_AND_RETURN;
synctexabort(0);
return;
}