summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
authorTaco Hoekwater <taco@elvenkind.com>2010-05-13 07:52:28 +0000
committerTaco Hoekwater <taco@elvenkind.com>2010-05-13 07:52:28 +0000
commitf0a58db7edea32e3bd100add19aab00c225ecb94 (patch)
tree192c1ff0f5045e53f2c6f1e96510992befc9e027 /Build
parentefabee1b742bcf1a583b63f9212e285dbb308e21 (diff)
integrate new synctex from Jerome Laurens
git-svn-id: svn://tug.org/texlive/trunk@18227 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/luatexdir/ChangeLog6
-rw-r--r--Build/source/texk/web2c/luatexdir/luatex_svnversion.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/utils/synctex-luatex.h39
-rw-r--r--Build/source/texk/web2c/luatexdir/utils/synctex.c664
4 files changed, 369 insertions, 342 deletions
diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog
index 364ebd61b3e..b600637ede6 100644
--- a/Build/source/texk/web2c/luatexdir/ChangeLog
+++ b/Build/source/texk/web2c/luatexdir/ChangeLog
@@ -1,3 +1,9 @@
+2010-05-13 Taco Hoekwater <taco@luatex.org>
+
+ * utils/synctex.c, utils/synctex-luatex.h: update from Jérome
+ Laurens, bringing luatex in-line with the core synctex distribution
+ * luatex_svnversion.h: updated to reflect the version of 0.60.x branch
+
2010-05-06 Taco Hoekwater <taco@luatex.org>
* luatex.c (calledit): use ifdef __MINGW32__ instead of WIN32.
diff --git a/Build/source/texk/web2c/luatexdir/luatex_svnversion.h b/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
index fd73e149f92..c4a942c57b2 100644
--- a/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
+++ b/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
@@ -1 +1 @@
-#define luatex_svn_revision 3678
+#define luatex_svn_revision 3685
diff --git a/Build/source/texk/web2c/luatexdir/utils/synctex-luatex.h b/Build/source/texk/web2c/luatexdir/utils/synctex-luatex.h
index 1ebcaa5738b..9a8dba6825b 100644
--- a/Build/source/texk/web2c/luatexdir/utils/synctex-luatex.h
+++ b/Build/source/texk/web2c/luatexdir/utils/synctex-luatex.h
@@ -34,7 +34,7 @@ authorization from the copyright holder.
*/
-/* $Id: synctex-luatex.h 3536 2010-03-22 13:07:39Z taco $ */
+/* $Id: synctex-luatex.h 3685 2010-05-13 07:37:47Z taco $ */
#undef synchronization_field_size
#define synchronization_field_size 1
@@ -42,7 +42,10 @@ authorization from the copyright holder.
#undef width_offset
#undef height_offset
#undef depth_offset
+
#undef box_node_size
+#undef rule_node_size
+
#undef rule_node
#undef glue_node
#undef kern_node
@@ -55,6 +58,16 @@ authorization from the copyright holder.
#undef SYNCTEX_TAG_MODEL
#undef SYNCTEX_LINE_MODEL
#undef SYNCTEX_VALUE
+#undef SYNCTEX_CURV
+#undef SYNCTEX_CURH
+#undef SYNCTEX_GET_JOB_NAME
+#undef SYNCTEX_GET_LOG_NAME
+#undef SYNCTEX_RULE_WD
+#undef SYNCTEX_RULE_HT
+#undef SYNCTEX_RULE_DP
+#undef SYNCTEX_CURRENT_TAG
+#undef SYNCTEX_GET_CURRENT_NAME
+#undef SYNCTEX_GET_TOTAL_PAGES
#define SYNCTEX_TAG_MODEL(NODE,SIZE)\
vinfo(NODE+SIZE-synchronization_field_size)
@@ -68,22 +81,19 @@ authorization from the copyright holder.
#define SYNCTEX_HEIGHT(NODE) height(NODE)
#define SYNCTEX_VALUE int_par(synctex_code)
+#define SYNCTEX_CURV (dimen_par(page_height_code)-static_pdf->posstruct->pos.v)
+#define SYNCTEX_CURH static_pdf->posstruct->pos.h
-#define CURV (dimen_par(page_height_code)-static_pdf->posstruct->pos.v)
-#define CURH static_pdf->posstruct->pos.h
+#define SYNCTEX_GET_JOB_NAME() makecstring(job_name)
+#define SYNCTEX_GET_LOG_NAME() (char *)xstrdup((const char*)texmf_log_name)
-#define GETJOBNAME() makecstring(job_name)
-#define GETLOGNAME() (char *)xstrdup((const char*)texmf_log_name)
-#define gettexstring(a) makecstring(a)
+#define SYNCTEX_RULE_WD width(p)
+#define SYNCTEX_RULE_HT height(p)
+#define SYNCTEX_RULE_DP depth(p)
-#define rulewd width(p)
-#define ruleht height(p)
-#define ruledp depth(p)
-
-#define curinput cur_input
-#define totalpages total_pages
-#define synctextagfield synctex_tag_field
-#define namefield name_field
+#define SYNCTEX_CURRENT_TAG (cur_input.synctex_tag_field)
+#define SYNCTEX_GET_CURRENT_NAME() (makecstring(cur_input.name_field))
+#define SYNCTEX_GET_TOTAL_PAGES() (total_pages)
#include "ptexlib.h"
@@ -97,3 +107,4 @@ authorization from the copyright holder.
#define SYNCTEX_OUTPUT ((pdf_output_value>0)?"pdf":"dvi")
#define __SyncTeX__ 1
+
diff --git a/Build/source/texk/web2c/luatexdir/utils/synctex.c b/Build/source/texk/web2c/luatexdir/utils/synctex.c
index c64c8518365..ab76fe9a440 100644
--- a/Build/source/texk/web2c/luatexdir/utils/synctex.c
+++ b/Build/source/texk/web2c/luatexdir/utils/synctex.c
@@ -1,9 +1,9 @@
/*
-Copyright (c) 2008, 2009 jerome DOT laurens AT u-bourgogne DOT fr
+Copyright (c) 2008, 2009, 2010 jerome DOT laurens AT u-bourgogne DOT fr
This file is part of the SyncTeX package.
-Latest Revision: Wed Jul 1 11:18:09 UTC 2009
+Latest Revision: Wed May 12 12:08:40 UTC 2010
License:
--------
@@ -67,7 +67,7 @@ Versioning:
-----------
As synctex is embedded into different TeX implementation, there is an independent
versionning system.
-For TeX implementations, the actual version is: 2
+For TeX implementations, the actual version is: 3
For .synctex file format, the actual version is SYNCTEX_VERSION below
Please, do not remove these explanations.
@@ -84,6 +84,12 @@ I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
History:
--------
+Version 3
+- very minor design change to take luatex into account
+- typo fixed
+- some size_t replaced by int
+- very minor code design change to remove wrong xetex specific warnings
+
Version 2
Fri Sep 19 14:55:31 UTC 2008
- support for file names containing spaces.
@@ -110,23 +116,23 @@ Latest Revision: Wed Jul 1 08:15:44 UTC 2009
*/
-#define SYNCTEX_VERSION 1
+# define SYNCTEX_VERSION 1
-#define SYNCTEX_DEBUG 0
+# define SYNCTEX_DEBUG 0
/* Debugging: define the next macro to "return;" in order to disable the synctex code
* only suplemental function calls will be used. The compiler may optimize them. */
-#define SYNCTEX_RETURN_IF_DISABLED ;
+# define SYNCTEX_RETURN_IF_DISABLED ;
-#define SYNCTEX_NOERR 0
+# define SYNCTEX_NOERR 0
-#define EXTERN extern
+# define EXTERN extern
-#ifdef xfree
-# define SYNCTEX_FREE xfree
-#else
-# define SYNCTEX_FREE(x) free(x)
-#endif
+# ifdef xfree
+# define SYNCTEX_FREE xfree
+# else
+# define SYNCTEX_FREE(x) free(x)
+# endif
/* the macros defined below do the same job than their almost eponym
* counterparts of *tex.web, the memory access is sometimes more direct
@@ -136,26 +142,26 @@ Latest Revision: Wed Jul 1 08:15:44 UTC 2009
* and *tex.web for details, the synctex_ prefix prevents name conflicts, it
* is some kind of namespace
*/
-
+# warning These structures MUST be kept in synchronization with the main program
/* synctexoption is a global integer variable defined in *tex.web
* it is set to 1 by texmfmp.c if the command line has the '-synctex=1'
* option. */
-#define synctex_options synctexoption
-#define SYNCTEX_NO_OPTION INT_MAX
+# define synctex_options synctexoption
+# define SYNCTEX_NO_OPTION INT_MAX
/* if synctex_options is set to SYNCTEX_NO_OPTION, no command line option was provided. */
/* glue code: really define the main memory,
* this is exactly the same "mem" as in *tex.web. */
-#define mem zmem
+# define mem zmem
/* glue code: synctexoffset is a global integer variable defined in *tex.web
* it is set to the offset where the primitive \synctex reads and writes its
* value. */
-#define SYNCTEX_VALUE zeqtb[synctexoffset].cint
+# define SYNCTEX_VALUE zeqtb[synctexoffset].cint
/* if there were a mean to share the value of synctex_code between *tex.web
* and this file, it would be great. */
-#define SYNCTEX_UNIT_FACTOR 1
-#define UNIT / synctex_ctxt.unit
+# define SYNCTEX_UNIT_FACTOR 1
+# define UNIT / synctex_ctxt.unit
/* UNIT is the scale. TeX coordinates are very accurate and client won't need
* that, at leat in a first step. 1.0 <-> 2^16 = 65536.
* The TeX unit is sp (scaled point) or pt/65536 which means that the scale
@@ -180,9 +186,9 @@ Latest Revision: Wed Jul 1 08:15:44 UTC 2009
/* WARNING:
The 9 definitions below must be in sync with their eponym declarations in
- the proper synctex-*.ch* file.
+ the proper synctex-*.ch* file or equivalent.
*/
-#define synchronization_field_size 2
+# define synchronization_field_size 2
/* The default value is 2, it is suitable for original TeX and alike,
* but it is too big for XeTeX.
* The tag and the line are just the two last words of the node. This is a
@@ -191,35 +197,43 @@ Latest Revision: Wed Jul 1 08:15:44 UTC 2009
* XeTeX redefines synchronization_field_size,
* SYNCTEX_TAG_MODEL and SYNCTEX_LINE_MODEL
* All the default values are targeted to TeX or e-TeX. */
-#define SYNCTEX_TAG_MODEL(NODE,SIZE)\
+# define SYNCTEX_TAG_MODEL(NODE,SIZE)\
mem[NODE+SIZE-synchronization_field_size].cint
-#define SYNCTEX_LINE_MODEL(NODE,SIZE)\
+# define SYNCTEX_LINE_MODEL(NODE,SIZE)\
mem[NODE+SIZE-synchronization_field_size+1].cint
/* SYNCTEX_TAG_MODEL and SYNCTEX_LINE_MODEL are used to define
* SYNCTEX_TAG and SYNCTEX_LINE in a model independant way
* Both are tag and line accessors */
-#define box_node_size (7+synchronization_field_size)
+# define box_node_size (7+synchronization_field_size)
/* see: @d box_node_size=...
* There should be an automatic process here because these definitions
* are redundant. However, this process would certainly be overcomplicated
* (building then parsing the *tex.web file would be a pain) */
-#define width_offset 1
+# define width_offset 1
/* see: @d width_offset=... */
-#define depth_offset 2
+# define depth_offset 2
/* see: @d depth_offset=... */
-#define height_offset 3
+# define height_offset 3
/* see: @d height_offset=... */
+/* glue code: these only work with nodes of size medium_node_size */
+# define small_node_size 2
+/* see: @d small_node_size=2 {number of words to allocate for most node types} */
+# define medium_node_size (small_node_size+synchronization_field_size)
+/* see: @d rule_node_size=4 */
+# define rule_node_size (4+synchronization_field_size)
+
/* Now define the local version of width(##), height(##) and depth(##) macros
These only depend on the 3 macros above. */
-#define SYNCTEX_TYPE(NODE) mem[NODE].hh.b0
-#define rule_node 2
-#define glue_node 10
-#define kern_node 11
-#define SYNCTEX_SUBTYPE(NODE) mem[NODE].hh.b1
-#define SYNCTEX_WIDTH(NODE) mem[NODE+width_offset].cint
-#define SYNCTEX_DEPTH(NODE) mem[NODE+depth_offset].cint
-#define SYNCTEX_HEIGHT(NODE) mem[NODE+height_offset].cint
+# define SYNCTEX_TYPE(NODE) mem[NODE].hh.b0
+# define rule_node 2
+# define glue_node 10
+# define kern_node 11
+
+# define SYNCTEX_SUBTYPE(NODE) mem[NODE].hh.b1
+# define SYNCTEX_WIDTH(NODE) mem[NODE+width_offset].cint
+# define SYNCTEX_DEPTH(NODE) mem[NODE+depth_offset].cint
+# define SYNCTEX_HEIGHT(NODE) mem[NODE+height_offset].cint
/* 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
@@ -232,35 +246,48 @@ Latest Revision: Wed Jul 1 08:15:44 UTC 2009
* 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
+# define SYNCTEX_IGNORE(NODE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE || !SYNCTEX_FILE
/* Some parts of the code may differ depending on the ouput mode,
* dvi or xdv vs pdf, in particular the management of magnification.
* The default is dvi mode.
* Also, if pdftex is used, the origin of the coordinates is at 0, not at 1in
* Default values are suitable for TeX */
-#define SYNCTEX_OUTPUT "dvi"
-#define SYNCTEX_OFFSET_IS_PDF 0
+# define SYNCTEX_OUTPUT "dvi"
+# define SYNCTEX_OFFSET_IS_PDF 0
+
+# define SYNCTEX_YES (-1)
+# define SYNCTEX_NO (0)
+# define SYNCTEX_NO_ERROR (0)
-#define SYNCTEX_TRUE 1
-#define SYNCTEX_YES (-1)
-#define SYNCTEX_NO (0)
-#define SYNCTEX_NO_ERROR (0)
+/* This macro layer was added to take luatex into account as suggested by T. Hoekwater. */
+# define SYNCTEX_GET_JOB_NAME() (gettexstring(jobname))
+# define SYNCTEX_GET_LOG_NAME() (gettexstring(texmflogname))
+# define SYNCTEX_CURRENT_TAG (curinput.synctextagfield)
+# define SYNCTEX_GET_CURRENT_NAME() (gettexstring(curinput.namefield))
+# define SYNCTEX_GET_TOTAL_PAGES() (totalpages)
+# define SYNCTEX_CURH curh
+# define SYNCTEX_CURV curv
+# define SYNCTEX_RULE_WD rulewd
+# define SYNCTEX_RULE_HT ruleht
+# define SYNCTEX_RULE_DP ruledp
-#include "synctex-luatex.h"
+/* In the header file below, TEX-OR-MF-OR-MP is replaced by the real name (tex, etex...)
+ * Some macros will be redefined and additional headers will be imported */
+# include "synctex-luatex.h"
-#include "synctex.h"
+# include "synctex.h"
-#if defined(__SyncTeX__)
+# if defined(__SyncTeX__)
-# include <stdio.h>
-# include <stdarg.h>
-# include "zlib.h"
+# include <stdio.h>
+# include <stdarg.h>
+# include "zlib.h"
typedef void (*synctex_recorder_t) (halfword); /* recorders know how to record a node */
typedef int (*synctex_fprintf_t) (void *, const char *, ...); /* print formatted to either FILE * or gzFile */
-# define SYNCTEX_BITS_PER_BYTE 8
+# define SYNCTEX_BITS_PER_BYTE 8
/* Here are all the local variables gathered in one "synchronization context" */
static struct {
@@ -272,33 +299,32 @@ static struct {
/* next concern the last sync record encountered */
halfword node; /* the last synchronized node, must be set
* before the recorder */
- synctex_recorder_t recorder; /* the recorder of the node above, the
- * routine that knows how to record the
- * node to the .synctex file */
+ synctex_recorder_t recorder;/* the recorder of the node above, the
+ * routine that knows how to record the
+ * node to the .synctex file */
integer tag, line; /* current tag and line */
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 */
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 */
- unsigned int no_gz:1; /* Whether zlib is used or not */
- unsigned int not_void:1; /* Whether it really contains synchronization material */
- unsigned int warn:1; /* One shot warning flag */
- unsigned int quoted:1; /* Whether the input file name was quoted by tex or not, for example "\"my input file.tex\"", unused by XeTeX */
- unsigned int reserved:SYNCTEX_BITS_PER_BYTE * sizeof(int) - 6; /* Align */
+ 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 */
+ unsigned int no_gz:1; /* Whether zlib is used or not */
+ unsigned int not_void:1; /* Whether it really contains synchronization material */
+ unsigned int warn:1; /* One shot warning flag */
+ unsigned int quoted:1; /* Whether the input file name was quoted by tex or not, for example "\"my input file.tex\"", unused by XeTeX */
+ unsigned int reserved:SYNCTEX_BITS_PER_BYTE*sizeof(int)-6; /* 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}};
+NULL, NULL, NULL, NULL, 0, 0, NULL, 0, 0, 0, 0, 0, 0, 0, {0,0,0,0,0,0,0}};
-# define SYNCTEX_FILE synctex_ctxt.file
-# define SYNCTEX_IS_OFF (synctex_ctxt.flags.off)
-# define SYNCTEX_NO_GZ (synctex_ctxt.flags.no_gz)
-# define SYNCTEX_NOT_VOID (synctex_ctxt.flags.not_void)
-# define SYNCTEX_WARNING_DISABLE (synctex_ctxt.flags.warn)
-# define SYNCTEX_fprintf (*synctex_ctxt.fprintf)
+# define SYNCTEX_FILE synctex_ctxt.file
+# define SYNCTEX_IS_OFF (synctex_ctxt.flags.off)
+# define SYNCTEX_NO_GZ (synctex_ctxt.flags.no_gz)
+# define SYNCTEX_NOT_VOID (synctex_ctxt.flags.not_void)
+# define SYNCTEX_WARNING_DISABLE (synctex_ctxt.flags.warn)
+# define SYNCTEX_fprintf (*synctex_ctxt.fprintf)
/* Initialize the options, synchronize the variables.
* This is sent by *tex.web before any TeX macro is used.
@@ -315,17 +341,17 @@ void synctexinitcommand(void)
} else if (synctex_options == 0) {
/* -synctex=0 was given: SyncTeX must be definitely disabled,
* any subsequent \synctex=1 will have no effect at all */
- SYNCTEX_IS_OFF = SYNCTEX_TRUE;
+ SYNCTEX_IS_OFF = SYNCTEX_YES;
SYNCTEX_VALUE = 0;
} else {
/* the command line options are not ignored */
if (synctex_options < 0) {
- SYNCTEX_NO_GZ = SYNCTEX_TRUE;
+ SYNCTEX_NO_GZ = SYNCTEX_YES;
}
/* Initialize the content of the \synctex primitive */
SYNCTEX_VALUE = synctex_options;
}
- synctex_ctxt.flags.option_read = SYNCTEX_TRUE;
+ synctex_ctxt.flags.option_read = SYNCTEX_YES;
return;
}
@@ -335,9 +361,9 @@ void synctexinitcommand(void)
void synctexabort(boolean log_opened __attribute__ ((unused)))
{
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctex_abort\n");
-# endif
+# endif
if (SYNCTEX_FILE) {
if (SYNCTEX_NO_GZ) {
xfclose((FILE *) SYNCTEX_FILE, synctex_ctxt.busy_name);
@@ -353,7 +379,7 @@ void synctexabort(boolean log_opened __attribute__ ((unused)))
SYNCTEX_FREE(synctex_ctxt.root_name);
synctex_ctxt.root_name = NULL;
}
- SYNCTEX_IS_OFF = SYNCTEX_TRUE; /* disable synctex */
+ SYNCTEX_IS_OFF = SYNCTEX_YES; /* disable synctex */
}
static inline int synctex_record_preamble(void);
@@ -368,48 +394,47 @@ static const char *synctex_suffix_busy = "(busy)";
* Now all the output synchronization info is gathered in only one file.
* It is possible to split this info into as many different output files as sheets
* 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.
+ * For example foo-i.synctex would contain input synchronization
+ * information for page i alone.
*/
static void *synctex_dot_open(void)
{
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nwarning: Synchronize DEBUG: synctex_dot_open\n");
printf("\nwarning: SYNCTEX_VALUE=%0X\n", SYNCTEX_VALUE);
printf("\nwarning: synctex_options=%0X\n", synctex_options);
-# endif
+# endif
if (SYNCTEX_IS_OFF || !SYNCTEX_VALUE) {
return NULL; /* synchronization is disabled: do nothing */
}
if (SYNCTEX_FILE) {
- return SYNCTEX_FILE; /* synchronization is alerady enabled */
+ return SYNCTEX_FILE; /* synchronization is already enabled */
}
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nwarning: Synchronize DEBUG: synctex_dot_open 1\n");
-# endif
+# endif
/* this is the first time we are asked to open the file
this part of code is executed only once:
either SYNCTEX_FILE is nonnegative or synchronization is
definitely disabled. */
{
- size_t len;
- char *tmp = GETJOBNAME();
+ char *tmp = SYNCTEX_GET_JOB_NAME();
+ size_t len = strlen(tmp);
/* jobname was set by the \jobname command on the *TeX side */
- char *the_busy_name = xmalloc((unsigned)
- (strlen(tmp) + strlen(synctex_suffix) +
- strlen(synctex_suffix_gz) +
- strlen(synctex_suffix_busy) + 1));
+ char *the_busy_name = xmalloc((size_t)
+ (len + strlen(synctex_suffix)
+ + strlen(synctex_suffix_gz)
+ + strlen(synctex_suffix_busy) + 1));
if (!the_busy_name) {
SYNCTEX_FREE(tmp);
synctexabort(0);
return NULL;
}
-# if defined(XeTeX)
+# if defined(XeTeX)
synctex_ctxt.flags.quoted = 0;
strcpy(the_busy_name, tmp);
-# else
- len = strlen(tmp);
+# else
if (len > 0 && tmp[0] == '"' && tmp[len - 1] == '"') {
/* We are certainly on a pdftex like engine and the input file name did contain spaces inside.
Quotes where added around that file name. We prefer to remove the quotes to have a human readable name.
@@ -425,16 +450,12 @@ static void *synctex_dot_open(void)
synctex_ctxt.flags.quoted = 0;
strcpy(the_busy_name, tmp);
}
-# endif
+# endif
SYNCTEX_FREE(tmp);
tmp = NULL;
strcat(the_busy_name, synctex_suffix);
/* Initialize SYNCTEX_NO_GZ with the content of \synctex to let the user choose the format. */
- if (SYNCTEX_VALUE < 0) {
- SYNCTEX_NO_GZ = SYNCTEX_TRUE;
- } else {
- SYNCTEX_NO_GZ = SYNCTEX_NO;
- }
+ SYNCTEX_NO_GZ = SYNCTEX_VALUE < 0 ? SYNCTEX_YES : SYNCTEX_NO;
if (!SYNCTEX_NO_GZ) {
strcat(the_busy_name, synctex_suffix_gz);
}
@@ -446,9 +467,9 @@ static void *synctex_dot_open(void)
SYNCTEX_FILE = gzopen(the_busy_name, FOPEN_WBIN_MODE);
synctex_ctxt.fprintf = (synctex_fprintf_t) (&gzprintf);
}
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nwarning: Synchronize DEBUG: synctex_dot_open 2\n");
-# endif
+# endif
if (SYNCTEX_FILE) {
if (SYNCTEX_NO_ERROR != synctex_record_preamble()) {
synctexabort(0);
@@ -467,23 +488,23 @@ static void *synctex_dot_open(void)
synctex_ctxt.root_name = NULL;
}
synctex_ctxt.count = 0;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
fprintf(stdout,
"\nwarning: Synchronize DEBUG: synctex_dot_open SYNCTEX AVAILABLE\n");
-# endif
+# endif
} else {
/* no .synctex file available, so disable synchronization */
- SYNCTEX_IS_OFF = SYNCTEX_TRUE;
+ SYNCTEX_IS_OFF = SYNCTEX_YES;
SYNCTEX_VALUE = 0;
printf("\nSyncTeX warning: no synchronization, problem with %s\n",
the_busy_name);
/* and free the_busy_name */
SYNCTEX_FREE(the_busy_name);
the_busy_name = NULL;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
fprintf(stdout,
"\nwarning: Synchronize DEBUG: synctex_dot_open SYNCTEX DISABLED\n");
-# endif
+# endif
}
}
return SYNCTEX_FILE;
@@ -512,12 +533,12 @@ void synctexstartinput(void)
static unsigned int synctex_tag_counter = 0;
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nwarning: Synchronize DEBUG: synctexstartinput %i",
synctex_tag_counter);
printf("\nwarning: SYNCTEX_VALUE=%i", SYNCTEX_VALUE);
printf("\nwarning: synctex_options=%0X", synctex_options);
-# endif
+# endif
if (SYNCTEX_IS_OFF) {
return;
@@ -532,34 +553,34 @@ void synctexstartinput(void)
* this makes a lot of files... even in 32 bits
* Maybe we will limit this to 16bits and
* use the 16 other bits to store the column number */
- curinput.synctextagfield = 0;
+ SYNCTEX_CURRENT_TAG = 0;
return;
}
- curinput.synctextagfield = (int) synctex_tag_counter; /* -> *TeX.web */
+ SYNCTEX_CURRENT_TAG = (int) synctex_tag_counter; /* -> *TeX.web */
if (synctex_tag_counter == 1) {
/* this is the first file TeX ever opens, in general \jobname.tex we
* do not know yet if synchronization will ever be enabled so we have
* to store the file name, because we will need it later.
* This is necessary because \jobname can be different */
- synctex_ctxt.root_name = gettexstring(curinput.namefield);
+ synctex_ctxt.root_name = SYNCTEX_GET_CURRENT_NAME();
/* we could initialize the unit field to 1 to avoid floating point exception
* when accidentaly dividing by the unit.
* This occurs when some SYNCTEX_IGNORE macro is not used.
* But this must not happen unexpectedly, so we leave the unit to 0 */
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nwarning: Synchronize DEBUG: synctexstartinput first END\n");
-# endif
+# endif
return;
}
if (SYNCTEX_FILE
|| (SYNCTEX_VALUE && (SYNCTEX_NO_ERROR != synctex_dot_open()))) {
- char *tmp = gettexstring(curinput.namefield);
- synctex_record_input(curinput.synctextagfield, tmp);
+ char *tmp = SYNCTEX_GET_CURRENT_NAME();
+ synctex_record_input(SYNCTEX_CURRENT_TAG,tmp);
SYNCTEX_FREE(tmp);
}
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nwarning: Synchronize DEBUG: synctexstartinput END\n");
-# endif
+# endif
return;
}
@@ -589,10 +610,10 @@ void synctexterminate(boolean log_opened)
char *tmp = NULL;
char *the_real_syncname = NULL;
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctexterminate\n");
-# endif
- if (log_opened && (tmp = GETLOGNAME())) {
+# 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) +
@@ -662,23 +683,22 @@ void synctexterminate(boolean log_opened)
strcat(the_real_syncname, synctex_suffix_gz);
remove(the_real_syncname);
}
- } else if ((tmp = GETJOBNAME())) {
- size_t len;
+ } else if ((tmp = SYNCTEX_GET_JOB_NAME())) {
+ size_t len = strlen(tmp);
/* There was a problem with the output.
We just try to remove existing synctex output files
including the busy one. */
- the_real_syncname = xmalloc((unsigned)
- (strlen(tmp) + strlen(synctex_suffix) +
- strlen(synctex_suffix_gz) + 1));
+ the_real_syncname = xmalloc((size_t)
+ (len + strlen(synctex_suffix)
+ + strlen(synctex_suffix_gz) + 1));
if (!the_real_syncname) {
SYNCTEX_FREE(tmp);
synctexabort(0);
return;
}
-# if defined(XeTeX)
+# if defined(XeTeX)
strcpy(the_real_syncname, tmp);
-# else
- len = strlen(tmp);
+# else
if (len > 0 && tmp[0] == '"' && tmp[len - 1] == '"') {
/* See above a similar situation. */
strcpy(the_real_syncname, tmp + 1); /* only copy what follows the leading " character */
@@ -689,7 +709,7 @@ void synctexterminate(boolean log_opened)
} else {
strcpy(the_real_syncname, tmp);
}
-# endif
+# endif
SYNCTEX_FREE(tmp);
tmp = NULL;
strcat(the_real_syncname, synctex_suffix);
@@ -725,12 +745,12 @@ static inline int synctex_record_sheet(integer sheet);
void synctexsheet(integer mag)
{
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctexsheet %i\n", mag);
-# endif
+# endif
if (SYNCTEX_IS_OFF) {
if (SYNCTEX_VALUE && !SYNCTEX_WARNING_DISABLE) {
- SYNCTEX_WARNING_DISABLE = SYNCTEX_TRUE;
+ 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.");
}
@@ -741,9 +761,8 @@ void synctexsheet(integer mag)
/* First possibility: the .synctex file is already open because SyncTeX was activated on the CLI
* or it was activated with the \synctex macro and the first page is already shipped out.
* Second possibility: tries to open the .synctex, useful if synchronization was enabled
- * from the source file and not from the CLI.
- * totalpages is defined in tex.web */
- if (totalpages == 0) {
+ * from the source file and not from the CLI. */
+ if (SYNCTEX_GET_TOTAL_PAGES() == 0) {
/* Now it is time to properly set up the scale factor. */
if (mag > 0) {
synctex_ctxt.magnification = mag;
@@ -754,11 +773,11 @@ void synctexsheet(integer mag)
return;
}
}
- synctex_record_sheet(totalpages + 1);
+ synctex_record_sheet(SYNCTEX_GET_TOTAL_PAGES()+1);
}
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctexsheet END\n");
-# endif
+# endif
return;
}
@@ -770,16 +789,16 @@ static inline int synctex_record_teehs(integer sheet);
void synctexteehs(void)
{
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctexteehs\n");
-# endif
+# endif
if (SYNCTEX_IS_OFF || !SYNCTEX_FILE) {
return;
}
- synctex_record_teehs(totalpages); /* not totalpages+1 */
-# if SYNCTEX_DEBUG
+ synctex_record_teehs(SYNCTEX_GET_TOTAL_PAGES());/* not SYNCTEX_GET_TOTAL_PAGES()+1*/
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctexteehs END\n");
-# endif
+# endif
return;
}
@@ -792,18 +811,18 @@ static inline void synctex_record_vlist(halfword p);
void synctexvlist(halfword this_box)
{
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctexhlist\n");
-# endif
+# endif
if (SYNCTEX_IGNORE(this_box)) {
return;
}
- synctex_ctxt.node = this_box; /* 0 to reset */
- synctex_ctxt.recorder = NULL; /* reset */
- synctex_ctxt.tag = SYNCTEX_TAG_MODEL(this_box, box_node_size);
- synctex_ctxt.line = SYNCTEX_LINE_MODEL(this_box, box_node_size);
- synctex_ctxt.curh = CURH;
- synctex_ctxt.curv = CURV;
+ synctex_ctxt.node = this_box; /* 0 to reset */
+ synctex_ctxt.recorder = NULL; /* reset */
+ synctex_ctxt.tag = SYNCTEX_TAG_MODEL(this_box,box_node_size);
+ synctex_ctxt.line = SYNCTEX_LINE_MODEL(this_box,box_node_size);
+ synctex_ctxt.curh = SYNCTEX_CURH;
+ synctex_ctxt.curv = SYNCTEX_CURV;
synctex_record_vlist(this_box);
}
@@ -816,18 +835,18 @@ static inline void synctex_record_tsilv(halfword p);
void synctextsilv(halfword this_box)
{
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctextsilv\n");
-# endif
+# endif
if (SYNCTEX_IGNORE(this_box)) {
return;
}
/* Ignoring any pending info to be recorded */
- synctex_ctxt.node = this_box; /* 0 to reset */
- synctex_ctxt.tag = SYNCTEX_TAG_MODEL(this_box, box_node_size);
- synctex_ctxt.line = SYNCTEX_LINE_MODEL(this_box, box_node_size);
- synctex_ctxt.curh = CURH;
- synctex_ctxt.curv = CURV;
+ synctex_ctxt.node = this_box; /* 0 to reset */
+ synctex_ctxt.tag = SYNCTEX_TAG_MODEL(this_box,box_node_size);
+ synctex_ctxt.line = SYNCTEX_LINE_MODEL(this_box,box_node_size);
+ synctex_ctxt.curh = SYNCTEX_CURH;
+ synctex_ctxt.curv = SYNCTEX_CURV;
synctex_ctxt.recorder = NULL;
synctex_record_tsilv(this_box);
}
@@ -839,18 +858,18 @@ static inline void synctex_record_void_vlist(halfword p);
void synctexvoidvlist(halfword p, halfword this_box __attribute__ ((unused)))
{
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctexvoidvlist\n");
-# endif
+# endif
if (SYNCTEX_IGNORE(p)) {
return;
}
- synctex_ctxt.node = p; /* reset */
+ synctex_ctxt.node = p; /* reset */
synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p, box_node_size);
synctex_ctxt.line = SYNCTEX_LINE_MODEL(p, box_node_size);
- synctex_ctxt.curh = CURH;
- synctex_ctxt.curv = CURV;
- synctex_ctxt.recorder = NULL; /* reset */
+ synctex_ctxt.curh = SYNCTEX_CURH;
+ synctex_ctxt.curv = SYNCTEX_CURV;
+ synctex_ctxt.recorder = NULL; /* reset */
synctex_record_void_vlist(p);
}
@@ -863,18 +882,18 @@ static inline void synctex_record_hlist(halfword p);
void synctexhlist(halfword this_box)
{
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctexhlist\n");
-# endif
+# endif
if (SYNCTEX_IGNORE(this_box)) {
return;
}
- synctex_ctxt.node = this_box; /* 0 to reset */
- synctex_ctxt.tag = SYNCTEX_TAG_MODEL(this_box, box_node_size);
- synctex_ctxt.line = SYNCTEX_LINE_MODEL(this_box, box_node_size);
- synctex_ctxt.curh = CURH;
- synctex_ctxt.curv = CURV;
- synctex_ctxt.recorder = NULL; /* reset */
+ synctex_ctxt.node = this_box; /* 0 to reset */
+ synctex_ctxt.tag = SYNCTEX_TAG_MODEL(this_box,box_node_size);
+ synctex_ctxt.line = SYNCTEX_LINE_MODEL(this_box,box_node_size);
+ synctex_ctxt.curh = SYNCTEX_CURH;
+ synctex_ctxt.curv = SYNCTEX_CURV;
+ synctex_ctxt.recorder = NULL; /* reset */
synctex_record_hlist(this_box);
}
@@ -887,19 +906,19 @@ static inline void synctex_record_tsilh(halfword p);
void synctextsilh(halfword this_box)
{
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctextsilh\n");
-# endif
+# endif
if (SYNCTEX_IGNORE(this_box)) {
return;
}
/* Ignoring any pending info to be recorded */
- synctex_ctxt.node = this_box; /* 0 to force next node to be recorded! */
- synctex_ctxt.tag = SYNCTEX_TAG_MODEL(this_box, box_node_size);
- synctex_ctxt.line = SYNCTEX_LINE_MODEL(this_box, box_node_size);
- synctex_ctxt.curh = CURH;
- synctex_ctxt.curv = CURV;
- synctex_ctxt.recorder = NULL; /* reset */
+ synctex_ctxt.node = this_box; /* 0 to force next node to be recorded! */
+ synctex_ctxt.tag = SYNCTEX_TAG_MODEL(this_box,box_node_size);
+ synctex_ctxt.line = SYNCTEX_LINE_MODEL(this_box,box_node_size);
+ synctex_ctxt.curh = SYNCTEX_CURH;
+ synctex_ctxt.curv = SYNCTEX_CURV;
+ synctex_ctxt.recorder = NULL; /* reset */
synctex_record_tsilh(this_box);
}
@@ -910,9 +929,9 @@ static inline void synctex_record_void_hlist(halfword p);
void synctexvoidhlist(halfword p, halfword this_box __attribute__ ((unused)))
{
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctexvoidhlist\n");
-# endif
+# endif
if (SYNCTEX_IGNORE(p)) {
return;
}
@@ -921,25 +940,18 @@ void synctexvoidhlist(halfword p, halfword this_box __attribute__ ((unused)))
/* but was not yet recorded */
(*synctex_ctxt.recorder) (synctex_ctxt.node);
}
- synctex_ctxt.node = p; /* 0 to reset */
+ synctex_ctxt.node = p; /* 0 to reset */
synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p, box_node_size);
synctex_ctxt.line = SYNCTEX_LINE_MODEL(p, box_node_size);
- synctex_ctxt.curh = CURH;
- synctex_ctxt.curv = CURV;
- synctex_ctxt.recorder = NULL; /* reset */
+ synctex_ctxt.curh = SYNCTEX_CURH;
+ synctex_ctxt.curv = SYNCTEX_CURV;
+ synctex_ctxt.recorder = NULL; /* reset */
synctex_record_void_hlist(p);
}
-/* glue code: these only work with nodes of size medium_node_size */
-# define small_node_size 3
-/* see: @d small_node_size=2 {number of words to allocate for most node types} */
-# define medium_node_size (small_node_size+synchronization_field_size)
-/* see: @d rule_node_size=4 */
-/* # define rule_node_size (4+synchronization_field_size) */
-
/* IN THE SEQUEL, ALL NODE ARE medium_node_size'd, UNTIL THE CONTRARY IS MENTIONNED */
-# undef SYNCTEX_IGNORE
-# define SYNCTEX_IGNORE(NODE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE \
+# undef SYNCTEX_IGNORE
+# define SYNCTEX_IGNORE(NODE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE \
|| (0 >= SYNCTEX_TAG_MODEL(NODE,medium_node_size)) \
|| (0 >= SYNCTEX_LINE_MODEL(NODE,medium_node_size))
@@ -947,7 +959,7 @@ void synctexvoidhlist(halfword p, halfword this_box __attribute__ ((unused)))
* the synchronization context remains the same, there is no need to write
* synchronization info: it would not help more. The synchronization context
* has changed when either the line number or the file tag has changed. */
-# define SYNCTEX_CONTEXT_DID_CHANGE(NODE) ((0 == synctex_ctxt.node)\
+# define SYNCTEX_CONTEXT_DID_CHANGE(NODE) ((0 == synctex_ctxt.node)\
|| (SYNCTEX_TAG_MODEL(NODE,medium_node_size) != synctex_ctxt.tag)\
|| (SYNCTEX_LINE_MODEL(NODE,medium_node_size) != synctex_ctxt.line))
@@ -958,9 +970,9 @@ void synctex_math_recorder(halfword p);
void synctexmath(halfword p, halfword this_box __attribute__ ((unused)))
{
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctexmath\n");
-# endif
+# endif
if (SYNCTEX_IGNORE(p)) {
return;
}
@@ -969,12 +981,12 @@ void synctexmath(halfword p, halfword this_box __attribute__ ((unused)))
(*synctex_ctxt.recorder) (synctex_ctxt.node);
}
synctex_ctxt.node = p;
- synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p, medium_node_size);
- synctex_ctxt.line = SYNCTEX_LINE_MODEL(p, medium_node_size);
- synctex_ctxt.curh = CURH;
- synctex_ctxt.curv = CURV;
- synctex_ctxt.recorder = NULL; /* no need to record once more */
- synctex_math_recorder(p); /* always record synchronously */
+ synctex_ctxt.tag = SYNCTEX_TAG_MODEL(p,medium_node_size);
+ synctex_ctxt.line = SYNCTEX_LINE_MODEL(p,medium_node_size);
+ 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 */
}
static inline void synctex_record_glue(halfword p);
@@ -983,16 +995,16 @@ static inline void synctex_record_rule(halfword p);
/* this message is sent whenever an horizontal glue node or rule node ships out
See: move_past:... */
-# define SYNCTEX_IGNORE_RULE(NODE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE \
+# define SYNCTEX_IGNORE_RULE(NODE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE \
|| (0 >= SYNCTEX_TAG_MODEL(NODE,rule_node_size)) \
|| (0 >= SYNCTEX_LINE_MODEL(NODE,rule_node_size))
void synctexhorizontalruleorglue(halfword p, halfword this_box
__attribute__ ((unused)))
{
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctexglue\n");
-# endif
+# endif
if (SYNCTEX_TYPE(p) == rule_node) { /* not medium_node_size so we can't use SYNCTEX_IGNORE */
if (SYNCTEX_IGNORE_RULE(p)) {
return;
@@ -1003,8 +1015,8 @@ void synctexhorizontalruleorglue(halfword p, halfword this_box
}
}
synctex_ctxt.node = p;
- synctex_ctxt.curh = CURH;
- synctex_ctxt.curv = CURV;
+ synctex_ctxt.curh = SYNCTEX_CURH;
+ synctex_ctxt.curv = SYNCTEX_CURV;
synctex_ctxt.recorder = NULL;
switch (SYNCTEX_TYPE(p)) {
case rule_node:
@@ -1034,9 +1046,9 @@ void synctex_kern_recorder(halfword p);
void synctexkern(halfword p, halfword this_box)
{
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctexkern\n");
-# endif
+# endif
if (SYNCTEX_IGNORE(p)) {
return;
}
@@ -1072,8 +1084,8 @@ void synctexkern(halfword p, halfword this_box)
/* This last part is used as a tool to infer TeX behaviour,
* but not for direct synchronization. */
-# undef SYNCTEX_IGNORE
-# define SYNCTEX_IGNORE(NODE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE || !SYNCTEX_FILE \
+# undef SYNCTEX_IGNORE
+# define SYNCTEX_IGNORE(NODE) SYNCTEX_IS_OFF || !SYNCTEX_VALUE || !SYNCTEX_FILE \
|| (synctex_ctxt.count>2000)
void synctex_char_recorder(halfword p);
@@ -1082,9 +1094,9 @@ void synctex_char_recorder(halfword p);
void synctexchar(halfword p, halfword this_box __attribute__ ((unused)))
{
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctexchar\n");
-# endif
+# endif
if (SYNCTEX_IGNORE(p)) {
return;
}
@@ -1102,17 +1114,17 @@ void synctexchar(halfword p, halfword this_box __attribute__ ((unused)))
void synctex_node_recorder(halfword p);
-# undef SYNCTEX_IGNORE
-# define SYNCTEX_IGNORE(NODE) (SYNCTEX_IS_OFF || !SYNCTEX_VALUE || !SYNCTEX_FILE)
+# undef SYNCTEX_IGNORE
+# define SYNCTEX_IGNORE(NODE) (SYNCTEX_IS_OFF || !SYNCTEX_VALUE || !SYNCTEX_FILE)
/* this message should be sent to record information
for a node of an unknown type */
void synctexnode(halfword p, halfword this_box __attribute__ ((unused)))
{
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctexnode\n");
-# endif
+# endif
if (SYNCTEX_IGNORE(p)) {
return;
}
@@ -1125,15 +1137,15 @@ void synctexnode(halfword p, halfword this_box __attribute__ ((unused)))
void synctexcurrent(void)
{
SYNCTEX_RETURN_IF_DISABLED;
-# if SYNCTEX_DEBUG
+# if SYNCTEX_DEBUG
printf("\nSynchronize DEBUG: synctexcurrent\n");
-# endif
+# endif
if (SYNCTEX_IGNORE(nothing)) {
return;
} else {
- integer len = SYNCTEX_fprintf(SYNCTEX_FILE, "x%i,%i:%i,%i\n",
- synctex_ctxt.tag, synctex_ctxt.line,
- CURH UNIT, CURV UNIT);
+ int len = SYNCTEX_fprintf(SYNCTEX_FILE, "x%i,%i:%i,%i\n",
+ synctex_ctxt.tag,synctex_ctxt.line,
+ SYNCTEX_CURH UNIT,SYNCTEX_CURV UNIT);
if (len > 0) {
synctex_ctxt.total_length += len;
return;
@@ -1146,22 +1158,17 @@ void synctexcurrent(void)
/* Recording the settings */
static inline int synctex_record_settings(void)
{
-# if SYNCTEX_DEBUG > 999
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_record_settings\n");
-# endif
+# endif
if (NULL == SYNCTEX_FILE) {
return SYNCTEX_NOERR;
}
if (SYNCTEX_FILE) {
- integer len = SYNCTEX_fprintf(SYNCTEX_FILE,
- "Output:%s\nMagnification:%i\nUnit:%i\nX Offset:%i\nY Offset:%i\n",
- SYNCTEX_OUTPUT,
- synctex_ctxt.magnification,
- synctex_ctxt.unit,
- ((SYNCTEX_OFFSET_IS_PDF !=
- 0) ? 0 : 4736287 UNIT),
- ((SYNCTEX_OFFSET_IS_PDF !=
- 0) ? 0 : 4736287 UNIT));
+ int len = SYNCTEX_fprintf(SYNCTEX_FILE, "Output:%s\nMagnification:%i\nUnit:%i\nX Offset:%i\nY Offset:%i\n",
+ SYNCTEX_OUTPUT,synctex_ctxt.magnification,synctex_ctxt.unit,
+ ((SYNCTEX_OFFSET_IS_PDF != 0) ? 0 : 4736287 UNIT),
+ ((SYNCTEX_OFFSET_IS_PDF != 0) ? 0 : 4736287 UNIT));
if (len > 0) {
synctex_ctxt.total_length += len;
return SYNCTEX_NOERR;
@@ -1174,10 +1181,10 @@ static inline int synctex_record_settings(void)
/* Recording a "SyncTeX..." line */
static inline int synctex_record_preamble(void)
{
- integer len = 0;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_record_preamble\n");
-# endif
+# endif
len =
SYNCTEX_fprintf(SYNCTEX_FILE, "SyncTeX Version:%i\n", SYNCTEX_VERSION);
if (len > 0) {
@@ -1191,10 +1198,10 @@ static inline int synctex_record_preamble(void)
/* Recording a "Input:..." line */
static inline int synctex_record_input(integer tag, char *name)
{
- integer len = 0;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_record_input\n");
-# endif
+# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "Input:%i:%s\n", tag, name);
if (len > 0) {
synctex_ctxt.total_length += len;
@@ -1207,10 +1214,10 @@ static inline int synctex_record_input(integer tag, char *name)
/* Recording a "!..." line */
static inline int synctex_record_anchor(void)
{
- integer len = 0;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_record_anchor\n");
-# endif
+# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "!%i\n", synctex_ctxt.total_length);
if (len > 0) {
synctex_ctxt.total_length = len;
@@ -1224,10 +1231,10 @@ static inline int synctex_record_anchor(void)
/* Recording a "Content" line */
static inline int synctex_record_content(void)
{
- integer len = 0;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_record_content\n");
-# endif
+# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "Content:\n");
if (len > 0) {
synctex_ctxt.total_length += len;
@@ -1240,11 +1247,11 @@ static inline int synctex_record_content(void)
/* Recording a "{..." line */
static inline int synctex_record_sheet(integer sheet)
{
-# if SYNCTEX_DEBUG > 999
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_record_sheet\n");
-# endif
+# endif
if (SYNCTEX_NOERR == synctex_record_anchor()) {
- integer len = SYNCTEX_fprintf(SYNCTEX_FILE, "{%i\n", sheet);
+ int len = SYNCTEX_fprintf(SYNCTEX_FILE, "{%i\n", sheet);
if (len > 0) {
synctex_ctxt.total_length += len;
++synctex_ctxt.count;
@@ -1258,11 +1265,11 @@ static inline int synctex_record_sheet(integer sheet)
/* Recording a "}..." line */
static inline int synctex_record_teehs(integer sheet)
{
-# if SYNCTEX_DEBUG > 999
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_record_teehs\n");
-# endif
+# endif
if (SYNCTEX_NOERR == synctex_record_anchor()) {
- integer len = SYNCTEX_fprintf(SYNCTEX_FILE, "}%i\n", sheet);
+ int len = SYNCTEX_fprintf(SYNCTEX_FILE, "}%i\n", sheet);
if (len > 0) {
synctex_ctxt.total_length += len;
++synctex_ctxt.count;
@@ -1276,16 +1283,17 @@ static inline int synctex_record_teehs(integer sheet)
/* Recording a "v..." line */
static inline void synctex_record_void_vlist(halfword p)
{
- integer len = 0;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_record_void_vlist\n");
-# endif
+# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "v%i,%i:%i,%i:%i,%i,%i\n",
- SYNCTEX_TAG_MODEL(p, box_node_size),
- SYNCTEX_LINE_MODEL(p, box_node_size),
- synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
- SYNCTEX_WIDTH(p) UNIT,
- SYNCTEX_HEIGHT(p) UNIT, SYNCTEX_DEPTH(p) UNIT);
+ SYNCTEX_TAG_MODEL(p, box_node_size),
+ SYNCTEX_LINE_MODEL(p, box_node_size),
+ 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;
@@ -1298,17 +1306,18 @@ static inline void synctex_record_void_vlist(halfword p)
/* Recording a "[..." line */
static inline void synctex_record_vlist(halfword p)
{
- integer len = 0;
- SYNCTEX_NOT_VOID = SYNCTEX_TRUE;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+ SYNCTEX_NOT_VOID = SYNCTEX_YES;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_record_vlist\n");
-# endif
+# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "[%i,%i:%i,%i:%i,%i,%i\n",
- SYNCTEX_TAG_MODEL(p, box_node_size),
- SYNCTEX_LINE_MODEL(p, box_node_size),
- synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
- SYNCTEX_WIDTH(p) UNIT,
- SYNCTEX_HEIGHT(p) UNIT, SYNCTEX_DEPTH(p) UNIT);
+ SYNCTEX_TAG_MODEL(p, box_node_size),
+ SYNCTEX_LINE_MODEL(p, box_node_size),
+ 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;
@@ -1321,10 +1330,10 @@ static inline void synctex_record_vlist(halfword p)
/* Recording a "]..." line */
static inline void synctex_record_tsilv(halfword p __attribute__ ((unused)))
{
- integer len = 0;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_record_tsilv\n");
-# endif
+# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "]\n");
if (len > 0) {
synctex_ctxt.total_length += len;
@@ -1337,16 +1346,17 @@ static inline void synctex_record_tsilv(halfword p __attribute__ ((unused)))
/* Recording a "h..." line */
static inline void synctex_record_void_hlist(halfword p)
{
- integer len = 0;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_record_void_hlist\n");
-# endif
+# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "h%i,%i:%i,%i:%i,%i,%i\n",
- SYNCTEX_TAG_MODEL(p, box_node_size),
- SYNCTEX_LINE_MODEL(p, box_node_size),
- synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
- SYNCTEX_WIDTH(p) UNIT,
- SYNCTEX_HEIGHT(p) UNIT, SYNCTEX_DEPTH(p) UNIT);
+ SYNCTEX_TAG_MODEL(p, box_node_size),
+ SYNCTEX_LINE_MODEL(p, box_node_size),
+ 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;
@@ -1359,17 +1369,18 @@ static inline void synctex_record_void_hlist(halfword p)
/* Recording a "(..." line */
static inline void synctex_record_hlist(halfword p)
{
- integer len = 0;
- SYNCTEX_NOT_VOID = SYNCTEX_TRUE;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+ SYNCTEX_NOT_VOID = SYNCTEX_YES;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_record_hlist\n");
-# endif
+# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "(%i,%i:%i,%i:%i,%i,%i\n",
- SYNCTEX_TAG_MODEL(p, box_node_size),
- SYNCTEX_LINE_MODEL(p, box_node_size),
- synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
- SYNCTEX_WIDTH(p) UNIT,
- SYNCTEX_HEIGHT(p) UNIT, SYNCTEX_DEPTH(p) UNIT);
+ SYNCTEX_TAG_MODEL(p, box_node_size),
+ SYNCTEX_LINE_MODEL(p, box_node_size),
+ 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;
@@ -1382,10 +1393,10 @@ static inline void synctex_record_hlist(halfword p)
/* Recording a ")..." line */
static inline void synctex_record_tsilh(halfword p __attribute__ ((unused)))
{
- integer len = 0;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_record_tsilh\n");
-# endif
+# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, ")\n");
if (len > 0) {
synctex_ctxt.total_length += len;
@@ -1399,10 +1410,10 @@ static inline void synctex_record_tsilh(halfword p __attribute__ ((unused)))
/* Recording a "Count..." line */
static inline int synctex_record_count(void)
{
- integer len = 0;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_record_count\n");
-# endif
+# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "Count:%i\n", synctex_ctxt.count);
if (len > 0) {
synctex_ctxt.total_length += len;
@@ -1415,11 +1426,11 @@ static inline int synctex_record_count(void)
/* Recording a "Postamble" section */
static inline int synctex_record_postamble(void)
{
-# if SYNCTEX_DEBUG > 999
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_record_postamble\n");
-# endif
+# endif
if (SYNCTEX_NOERR == synctex_record_anchor()) {
- integer len = SYNCTEX_fprintf(SYNCTEX_FILE, "Postamble:\n");
+ int len = SYNCTEX_fprintf(SYNCTEX_FILE, "Postamble:\n");
if (len > 0) {
synctex_ctxt.total_length += len;
if (synctex_record_count() || synctex_record_anchor()) {
@@ -1439,10 +1450,10 @@ static inline int synctex_record_postamble(void)
/* Recording a "g..." line */
static inline void synctex_record_glue(halfword p)
{
- integer len = 0;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_glue_recorder\n");
-# endif
+# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "g%i,%i:%i,%i\n",
SYNCTEX_TAG_MODEL(p, medium_node_size),
SYNCTEX_LINE_MODEL(p, medium_node_size),
@@ -1459,10 +1470,10 @@ static inline void synctex_record_glue(halfword p)
/* Recording a "k..." line */
static inline void synctex_record_kern(halfword p)
{
- integer len = 0;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_kern_recorder\n");
-# endif
+# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "k%i,%i:%i,%i:%i\n",
SYNCTEX_TAG_MODEL(p, medium_node_size),
SYNCTEX_LINE_MODEL(p, medium_node_size),
@@ -1480,15 +1491,15 @@ static inline void synctex_record_kern(halfword p)
/* Recording a "r..." line */
static inline void synctex_record_rule(halfword p)
{
- integer len = 0;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_record_tsilh\n");
-# endif
+# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "r%i,%i:%i,%i:%i,%i,%i\n",
- SYNCTEX_TAG_MODEL(p, rule_node_size),
- SYNCTEX_LINE_MODEL(p, rule_node_size),
- synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
- rulewd UNIT, ruleht UNIT, ruledp UNIT);
+ SYNCTEX_TAG_MODEL(p,rule_node_size),
+ SYNCTEX_LINE_MODEL(p,rule_node_size),
+ 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;
@@ -1498,14 +1509,13 @@ static inline void synctex_record_rule(halfword p)
return;
}
-
/* Recording a "$..." line */
void synctex_math_recorder(halfword p)
{
- integer len = 0;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_math_recorder\n");
-# endif
+# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "$%i,%i:%i,%i\n",
SYNCTEX_TAG_MODEL(p, medium_node_size),
SYNCTEX_LINE_MODEL(p, medium_node_size),
@@ -1522,10 +1532,10 @@ void synctex_math_recorder(halfword p)
/* Recording a "k..." line */
void synctex_kern_recorder(halfword p)
{
- integer len = 0;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_kern_recorder\n");
-# endif
+# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "k%i,%i:%i,%i:%i\n",
SYNCTEX_TAG_MODEL(p, medium_node_size),
SYNCTEX_LINE_MODEL(p, medium_node_size),
@@ -1543,10 +1553,10 @@ void synctex_kern_recorder(halfword p)
/* Recording a "c..." line */
void synctex_char_recorder(halfword p __attribute__ ((unused)))
{
- integer len = 0;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_char_recorder\n");
-# endif
+# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "c%i,%i\n",
synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT);
if (len > 0) {
@@ -1561,13 +1571,13 @@ void synctex_char_recorder(halfword p __attribute__ ((unused)))
/* Recording a "?..." line, type, subtype and position */
void synctex_node_recorder(halfword p)
{
- integer len = 0;
-# if SYNCTEX_DEBUG > 999
+ int len = 0;
+# if SYNCTEX_DEBUG > 999
printf("\nSynchronize DEBUG: synctex_node_recorder(0x%x)\n", p);
-# endif
+# endif
len = SYNCTEX_fprintf(SYNCTEX_FILE, "?%i,%i:%i,%i\n",
- synctex_ctxt.curh UNIT, synctex_ctxt.curv UNIT,
- type(p), subtype(p));
+ 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;
@@ -1577,6 +1587,6 @@ void synctex_node_recorder(halfword p)
return;
}
-#else
-# warning "SyncTeX is disabled"
-#endif
+# else
+# warning "SyncTeX is disabled"
+# endif