summaryrefslogtreecommitdiff
path: root/Build/source/texk
diff options
context:
space:
mode:
authorJonathan Kew <jfkthame@googlemail.com>2008-06-21 00:42:36 +0000
committerJonathan Kew <jfkthame@googlemail.com>2008-06-21 00:42:36 +0000
commita833f19836b8e188ce94d82473439714b50f6853 (patch)
tree7c93c7dfa09f14c61cf13933ac80164198fd0241 /Build/source/texk
parentc6e0b21f3b6f248c5d57cb61fb0fa545ec329189 (diff)
synctex update (parser, comments)
git-svn-id: svn://tug.org/texlive/trunk@8892 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
-rw-r--r--Build/source/texk/web2c/synctexdir/INSTALL12
-rw-r--r--Build/source/texk/web2c/synctexdir/README.txt13
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-common.h13
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-e-mem.ch013
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-e-mem.ch113
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-e-rec.ch013
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-e-rec.ch113
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-etex.h13
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-mem.ch013
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-mem.ch113
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-mem.ch213
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-pdf-rec.ch266
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-pdftex.h13
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-rec.ch013
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-rec.ch113
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-rec.ch215
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-tex.h13
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-xe-mem.ch213
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-xe-rec.ch213
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-xe-rec.ch313
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex-xetex.h13
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex.c15
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex.defines13
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex.h19
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex.mk13
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex_main.c13
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex_parser.c355
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex_parser.h93
28 files changed, 691 insertions, 157 deletions
diff --git a/Build/source/texk/web2c/synctexdir/INSTALL b/Build/source/texk/web2c/synctexdir/INSTALL
index f7456ac1b02..b894c46e732 100644
--- a/Build/source/texk/web2c/synctexdir/INSTALL
+++ b/Build/source/texk/web2c/synctexdir/INSTALL
@@ -30,6 +30,18 @@
# use or other dealings in this Software without prior written
# authorization from the copyright holder.
#
+# Acknowledgments:
+# ----------------
+# The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+# and significant help from XeTeX developer Jonathan Kew
+#
+# Nota Bene:
+# ----------
+# If you include or use a significant part of the synctex package into a software,
+# I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+#
+# Version 1
+# Thu Jun 19 09:39:21 UTC 2008
How to INSTALL synctex support in web2c.
diff --git a/Build/source/texk/web2c/synctexdir/README.txt b/Build/source/texk/web2c/synctexdir/README.txt
index a599b6e57fa..bfd724341e5 100644
--- a/Build/source/texk/web2c/synctexdir/README.txt
+++ b/Build/source/texk/web2c/synctexdir/README.txt
@@ -30,6 +30,19 @@
# use or other dealings in this Software without prior written
# authorization from the copyright holder.
#
+# Acknowledgments:
+# ----------------
+# The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+# and significant help from XeTeX developer Jonathan Kew
+#
+# Nota Bene:
+# ----------
+# If you include or use a significant part of the synctex package into a software,
+# I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+#
+# Version 1
+# Thu Jun 19 09:39:21 UTC 2008
+
This file gives the .synctex file specifications.
diff --git a/Build/source/texk/web2c/synctexdir/synctex-common.h b/Build/source/texk/web2c/synctexdir/synctex-common.h
index f5ae8ac6ded..293c258210b 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-common.h
+++ b/Build/source/texk/web2c/synctexdir/synctex-common.h
@@ -23,6 +23,19 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
*/
# ifndef __SYNCTEX_COMMON_HEADER__
diff --git a/Build/source/texk/web2c/synctexdir/synctex-e-mem.ch0 b/Build/source/texk/web2c/synctexdir/synctex-e-mem.ch0
index 880fa929a70..6fa195a019a 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-e-mem.ch0
+++ b/Build/source/texk/web2c/synctexdir/synctex-e-mem.ch0
@@ -30,6 +30,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
Notice:
-------
This file contains TeX changes for core synctex support.
diff --git a/Build/source/texk/web2c/synctexdir/synctex-e-mem.ch1 b/Build/source/texk/web2c/synctexdir/synctex-e-mem.ch1
index 67e11212f63..7e6ee124998 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-e-mem.ch1
+++ b/Build/source/texk/web2c/synctexdir/synctex-e-mem.ch1
@@ -30,6 +30,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
Notice:
-------
This file contains TeX changes for core synctex support.
diff --git a/Build/source/texk/web2c/synctexdir/synctex-e-rec.ch0 b/Build/source/texk/web2c/synctexdir/synctex-e-rec.ch0
index db584a92b84..8a240879650 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-e-rec.ch0
+++ b/Build/source/texk/web2c/synctexdir/synctex-e-rec.ch0
@@ -30,6 +30,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
Notice:
-------
Description forthcoming
diff --git a/Build/source/texk/web2c/synctexdir/synctex-e-rec.ch1 b/Build/source/texk/web2c/synctexdir/synctex-e-rec.ch1
index c1c4e813010..a52fdefb76c 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-e-rec.ch1
+++ b/Build/source/texk/web2c/synctexdir/synctex-e-rec.ch1
@@ -30,6 +30,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
Notice:
-------
This file contains TeX changes for core synctex support.
diff --git a/Build/source/texk/web2c/synctexdir/synctex-etex.h b/Build/source/texk/web2c/synctexdir/synctex-etex.h
index 7e51d9c18e9..3bdce72bd74 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-etex.h
+++ b/Build/source/texk/web2c/synctexdir/synctex-etex.h
@@ -31,6 +31,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
*/
# warning SyncTeX for eTeX
diff --git a/Build/source/texk/web2c/synctexdir/synctex-mem.ch0 b/Build/source/texk/web2c/synctexdir/synctex-mem.ch0
index 3cb0cd1950b..0f433728777 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-mem.ch0
+++ b/Build/source/texk/web2c/synctexdir/synctex-mem.ch0
@@ -30,6 +30,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
Notice:
-------
diff --git a/Build/source/texk/web2c/synctexdir/synctex-mem.ch1 b/Build/source/texk/web2c/synctexdir/synctex-mem.ch1
index c46ecd4f90d..23aabcc16a0 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-mem.ch1
+++ b/Build/source/texk/web2c/synctexdir/synctex-mem.ch1
@@ -30,6 +30,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
Notice:
-------
This file contains TeX changes for synctex support.
diff --git a/Build/source/texk/web2c/synctexdir/synctex-mem.ch2 b/Build/source/texk/web2c/synctexdir/synctex-mem.ch2
index 41e74ca3dc0..c6a6fa9e3ff 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-mem.ch2
+++ b/Build/source/texk/web2c/synctexdir/synctex-mem.ch2
@@ -30,6 +30,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
Notice:
-------
This file contains TeX changes for synctex support.
diff --git a/Build/source/texk/web2c/synctexdir/synctex-pdf-rec.ch2 b/Build/source/texk/web2c/synctexdir/synctex-pdf-rec.ch2
index 501c115bb18..ca11466a538 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-pdf-rec.ch2
+++ b/Build/source/texk/web2c/synctexdir/synctex-pdf-rec.ch2
@@ -1,25 +1,47 @@
-%
-% Copyright (c) 1996-2007 Han The Thanh, <thanh@pdftex.org>
-%
-% This file is part of pdfTeX.
-%
-% pdfTeX is free software; you can redistribute it and/or modify
-% it under the terms of the GNU General Public License as published by
-% the Free Software Foundation; either version 2 of the License, or
-% (at your option) any later version.
-%
-% pdfTeX is distributed in the hope that it will be useful,
-% but WITHOUT ANY WARRANTY; without even the implied warranty of
-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-% GNU General Public License for more details.
-%
-% You should have received a copy of the GNU General Public License along with
-% pdfTeX; if not, write to the Free Software Foundation, Inc., 51 Franklin
-% Street, Fifth Floor, Boston, MA 02110-1301 USA.
-%
-% These are synctex specific additions to pdftex.
-% This change file is meant to override previous changes made by synctex.ch
-%
+Copyright (c) 2008 jerome DOT laurens AT u-bourgogne DOT fr
+
+This file is part of the SyncTeX package.
+
+License:
+--------
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE
+
+Except as contained in this notice, the name of the copyright holder
+shall not be used in advertising or otherwise to promote the sale,
+use or other dealings in this Software without prior written
+authorization from the copyright holder.
+
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
@x
margin_kern_node,
diff --git a/Build/source/texk/web2c/synctexdir/synctex-pdftex.h b/Build/source/texk/web2c/synctexdir/synctex-pdftex.h
index be4004eef0f..4ff5864493c 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-pdftex.h
+++ b/Build/source/texk/web2c/synctexdir/synctex-pdftex.h
@@ -31,6 +31,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
*/
# include "pdftexd.h"
diff --git a/Build/source/texk/web2c/synctexdir/synctex-rec.ch0 b/Build/source/texk/web2c/synctexdir/synctex-rec.ch0
index e219d7af3f5..02cb0fba4db 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-rec.ch0
+++ b/Build/source/texk/web2c/synctexdir/synctex-rec.ch0
@@ -30,6 +30,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
Notice:
-------
diff --git a/Build/source/texk/web2c/synctexdir/synctex-rec.ch1 b/Build/source/texk/web2c/synctexdir/synctex-rec.ch1
index 0fd74544777..57bc298302f 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-rec.ch1
+++ b/Build/source/texk/web2c/synctexdir/synctex-rec.ch1
@@ -30,6 +30,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
Notice:
-------
This file contains TeX changes for synctex support.
diff --git a/Build/source/texk/web2c/synctexdir/synctex-rec.ch2 b/Build/source/texk/web2c/synctexdir/synctex-rec.ch2
index d4ddb9f894d..72af34b54a6 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-rec.ch2
+++ b/Build/source/texk/web2c/synctexdir/synctex-rec.ch2
@@ -30,11 +30,24 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
Notice:
-------
This file contains TeX changes for synctex support.
It implements the memory management for TeX like engines.
-It must apply after synctex-mem.ch? and synctex-act.ch?
+It must apply after synctex-mem.ch? and synctex-rec.ch?
@x tex.web l.12378
kern_node,math_node:cur_h:=cur_h+width(p);
diff --git a/Build/source/texk/web2c/synctexdir/synctex-tex.h b/Build/source/texk/web2c/synctexdir/synctex-tex.h
index d8573268b59..64392b3035a 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-tex.h
+++ b/Build/source/texk/web2c/synctexdir/synctex-tex.h
@@ -31,6 +31,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
*/
# warning SyncTeX for TeX
diff --git a/Build/source/texk/web2c/synctexdir/synctex-xe-mem.ch2 b/Build/source/texk/web2c/synctexdir/synctex-xe-mem.ch2
index 1213ba0999d..4b8b5f5c18f 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-xe-mem.ch2
+++ b/Build/source/texk/web2c/synctexdir/synctex-xe-mem.ch2
@@ -30,6 +30,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
Notice:
-------
This file contains TeX changes for SyncTeX support.
diff --git a/Build/source/texk/web2c/synctexdir/synctex-xe-rec.ch2 b/Build/source/texk/web2c/synctexdir/synctex-xe-rec.ch2
index 6b196182613..1f68c1ea0a6 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-xe-rec.ch2
+++ b/Build/source/texk/web2c/synctexdir/synctex-xe-rec.ch2
@@ -30,6 +30,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
Notice:
-------
This file contains TeX changes for SyncTeX support.
diff --git a/Build/source/texk/web2c/synctexdir/synctex-xe-rec.ch3 b/Build/source/texk/web2c/synctexdir/synctex-xe-rec.ch3
index 880c0e4115f..9bd9f0ab090 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-xe-rec.ch3
+++ b/Build/source/texk/web2c/synctexdir/synctex-xe-rec.ch3
@@ -30,6 +30,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
Notice:
-------
This file contains TeX changes for SyncTeX support.
diff --git a/Build/source/texk/web2c/synctexdir/synctex-xetex.h b/Build/source/texk/web2c/synctexdir/synctex-xetex.h
index f0c32fad6f4..1dc8a99dd2b 100644
--- a/Build/source/texk/web2c/synctexdir/synctex-xetex.h
+++ b/Build/source/texk/web2c/synctexdir/synctex-xetex.h
@@ -30,6 +30,19 @@ Except as contained in this notice, the name of the copyright holder
shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
*/
# include "xetexd.h"
diff --git a/Build/source/texk/web2c/synctexdir/synctex.c b/Build/source/texk/web2c/synctexdir/synctex.c
index 33c96b20f26..e3272d5673c 100644
--- a/Build/source/texk/web2c/synctexdir/synctex.c
+++ b/Build/source/texk/web2c/synctexdir/synctex.c
@@ -70,6 +70,19 @@ For .synctex file format, the actual version is SYNCTEX_VERSION below
Please, do not remove these explanations.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
*/
# define SYNCTEX_VERSION 1
@@ -466,7 +479,7 @@ void synctexstartinput(void)
/* 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 certainly not necessary due to \jobname */
+ * This is necessary because \jobname can be different */
synctex_ctxt.root_name = gettexstring(curinput.namefield);
/* we could initialize the unit field to 1 to avoid floating point exception
* when accidentaly dividing by the unit.
diff --git a/Build/source/texk/web2c/synctexdir/synctex.defines b/Build/source/texk/web2c/synctexdir/synctex.defines
index 6c6db7b24f2..13addde0368 100644
--- a/Build/source/texk/web2c/synctexdir/synctex.defines
+++ b/Build/source/texk/web2c/synctexdir/synctex.defines
@@ -31,6 +31,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
Notice:
-------
This file is an interface to the synctex system for web2c.
diff --git a/Build/source/texk/web2c/synctexdir/synctex.h b/Build/source/texk/web2c/synctexdir/synctex.h
index 1acfb96f86f..de736f68aff 100644
--- a/Build/source/texk/web2c/synctexdir/synctex.h
+++ b/Build/source/texk/web2c/synctexdir/synctex.h
@@ -23,6 +23,19 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
*/
# ifndef __SYNCTEX_HEADER__
@@ -49,9 +62,9 @@ extern void synctexteehs(void);
* address of the vlist We assume that p is really a vlist node! */
extern void synctexvlist(halfword this_box);
-/* Recording a "f" line ending a vbox: this message is sent whenever a vlist
+/* Recording a "}" 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
- * sent at the end of the vlist_out procedure in *TeX.web to balance a former
+ * sent at the end of each vlist_out procedure in *TeX.web to balance a former
* synctex_vlist sent at the beginning of that procedure. */
extern void synctextsilv(halfword this_box);
@@ -65,7 +78,7 @@ extern void synctexvoidvlist(halfword p, halfword this_box);
* address of the hlist. */
extern void synctexhlist(halfword this_box);
-/* Sent this message at the end of the hlist_out procedure in *TeX.web
+/* Send this message at the end of the various hlist_out procedure in *TeX.web
* to balance a former synctex_hlist. */
extern void synctextsilh(halfword this_box);
diff --git a/Build/source/texk/web2c/synctexdir/synctex.mk b/Build/source/texk/web2c/synctexdir/synctex.mk
index 7e2bc039935..53c22a97062 100644
--- a/Build/source/texk/web2c/synctexdir/synctex.mk
+++ b/Build/source/texk/web2c/synctexdir/synctex.mk
@@ -30,6 +30,19 @@
# use or other dealings in this Software without prior written
# authorization from the copyright holder.
#
+# Acknowledgments:
+# ----------------
+# The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+# and significant help from XeTeX developer Jonathan Kew
+#
+# Nota Bene:
+# ----------
+# If you include or use a significant part of the synctex package into a software,
+# I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+#
+# Version 1
+# Thu Jun 19 09:39:21 UTC 2008
+#
# Notice:
# -------
# Makefile fragment for synctex.
diff --git a/Build/source/texk/web2c/synctexdir/synctex_main.c b/Build/source/texk/web2c/synctexdir/synctex_main.c
index 900bbf676fe..eb4d2758be9 100644
--- a/Build/source/texk/web2c/synctexdir/synctex_main.c
+++ b/Build/source/texk/web2c/synctexdir/synctex_main.c
@@ -31,6 +31,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
Important notice:
-----------------
This file is named "synctex_main.c".
diff --git a/Build/source/texk/web2c/synctexdir/synctex_parser.c b/Build/source/texk/web2c/synctexdir/synctex_parser.c
index 22b3938929c..1e99f2cf1ec 100644
--- a/Build/source/texk/web2c/synctexdir/synctex_parser.c
+++ b/Build/source/texk/web2c/synctexdir/synctex_parser.c
@@ -31,6 +31,19 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
*/
/* We assume that high level application like pdf viewers will want
@@ -211,8 +224,8 @@ struct __synctex_class_t {
/* Next box getter and setter
*/
# define SYNCTEX_NEXT_BOX(NODE) SYNCTEX_GET(NODE,next_box)
-# define SYNCTEX_SET_NEXT_BOX(NODE,NEW_FRIEND) if(NODE && NEW_FRIEND){\
- SYNCTEX_GETTER(NODE,next_box)[0]=NEW_FRIEND;\
+# define SYNCTEX_SET_NEXT_BOX(NODE,NEXT_BOX) if(NODE && NEXT_BOX){\
+ SYNCTEX_GETTER(NODE,next_box)[0]=NEXT_BOX;\
}
void _synctex_free_node(synctex_node_t node);
@@ -3084,6 +3097,15 @@ synctex_node_t synctex_sheet_content(synctex_scanner_t scanner,int page) {
return NULL;
}
+# ifdef SYNCTEX_NOTHING
+# pragma mark -
+# pragma mark Query
+# endif
+
+int synctex_display_query(synctex_scanner_t scanner,const char * name,int line,int column);
+int synctex_edit_query(synctex_scanner_t scanner,int page,float h,float v);
+synctex_node_t synctex_next_result(synctex_scanner_t scanner);
+
int synctex_display_query(synctex_scanner_t scanner,const char * name,int line,int column) {
# ifdef __DARWIN_UNIX03
# pragma unused(column)
@@ -3119,111 +3141,132 @@ int synctex_display_query(synctex_scanner_t scanner,const char * name,int line,i
return SYNCTEX_END-SYNCTEX_START;
}
-int _synctex_node_is_box(synctex_node_t node) {
- switch(synctex_node_type(node)) {
- case synctex_node_type_hbox:
- case synctex_node_type_hbox_non_void:
- case synctex_node_type_void_hbox:
- case synctex_node_type_vbox:
- case synctex_node_type_void_vbox:
- return -1;
- default:
- return 0;
- }
-}
-
-int _synctex_point_in_box(int h, int v, synctex_node_t node);
-int _synctex_point_in_box(int h, int v, synctex_node_t node) {
-#if 0
- if(_synctex_node_is_box(node)) {
- v -= synctex_node_box_visible_v(node);
- if((v<=-synctex_node_box_visible_height(node)
- && v>=synctex_node_box_visible_depth(node))
- || (v>=-synctex_node_box_visible_height(node)
- && v<= synctex_node_box_visible_depth(node))) {
- h -= synctex_node_box_visible_h(node);
- if((h<=0 && h>=synctex_node_box_visible_width(node))
- || (h>=0 && h<=synctex_node_box_visible_width(node))) {
- return -1;
- }
- }
- }
-#endif
- return 0;
-}
-
-inline static synctex_node_t _synctex_inner_containing_node(synctex_node_t node,int H,int V);
-inline static synctex_node_t _synctex_inner_containing_node(synctex_node_t node,int H,int V) {
- if(_synctex_point_in_box(H,V,node) || (node->class->type == synctex_node_type_vbox)) {
- synctex_node_t child = SYNCTEX_CHILD(node);
- if(NULL != child) {
- synctex_node_t result = NULL;
- do {
- if((result = _synctex_inner_containing_node(child,H,V))
- && (result->class->type != synctex_node_type_vbox)) {
- return result;
- }
- } while((child = SYNCTEX_SIBLING(child)));
- }
- if(node->class->type != synctex_node_type_vbox) {
- return node;
- }
- }
- return NULL;
-}
inline static synctex_node_t _synctex_best_child_node(synctex_node_t node,int H,int V, int * distanceRef);
inline static synctex_node_t _synctex_best_child_node(synctex_node_t node,int H,int V, int * distanceRef) {
if(NULL != distanceRef) {
synctex_node_t child = NULL;
- if((child = SYNCTEX_CHILD(node))) {
- synctex_node_t result = NULL;
- do {
- synctex_node_t candidate = NULL;
- if((candidate = _synctex_best_child_node(child,H,V,distanceRef))) {
- result = candidate;
+ switch((node->class)->type) {
+ case synctex_node_type_hbox_non_void:
+ if((child = SYNCTEX_CHILD(node))) {
+ synctex_node_t result = NULL;
+ do {
+ synctex_node_t candidate = NULL;
+ if((candidate = _synctex_best_child_node(child,H,V,distanceRef))) {
+ if(0 == *distanceRef) {
+ /* We can't do better */
+ return candidate;
+ }
+ result = candidate;
+ }
+ } while((child = SYNCTEX_SIBLING(child)));
+ return result;
+ } else {
+ /* this is an error if this box does not contain children. */
+ fprintf(stderr,
+ "SyncTeX internal inconsistency: we should not get there (synctex_best_child_node:%i), please report bug to the SyncTeX maintainer\n",
+ (node->class)->type);
+ return NULL;
}
- } while((child = SYNCTEX_SIBLING(child)));
- return result;
- } else {
- int distance,i;
- switch((node->class)->type) {
- default:
- i = SYNCTEX_HORIZ(node);
- if(H<i) {
- distance = i-H;
- } else {
- distance = H-i;
- }
- i = SYNCTEX_VERT(node);
- if(V<i) {
- distance += i-V;
- } else {
- distance += V-i;
+ case synctex_node_type_hbox:
+ case synctex_node_type_vbox:
+ /* This is a box that contains children but no kern, math or glue nodes. */
+ if((child = SYNCTEX_CHILD(node))) {
+ synctex_node_t result = NULL;
+ do {
+ synctex_node_t candidate = NULL;
+ if((candidate = _synctex_best_child_node(child,H,V,distanceRef))) {
+ if(0 == *distanceRef) {
+ /* We can't do better */
+ return candidate;
+ }
+ result = candidate;
+ }
+ } while((child = SYNCTEX_SIBLING(child)));
+ return result;
+ } else {
+ /* If the hit point is inside the box, we must return a node inside the box */
+ int min = SYNCTEX_HORIZ_V(node);
+ int max = min+SYNCTEX_WIDTH_V(node);
+ if(min<=H && H<=max) {
+ min = SYNCTEX_VERT_V(node);
+ max = min + SYNCTEX_DEPTH_V(node);
+ min -= SYNCTEX_HEIGHT_V(node);
+ if(min<=V && V<=max) {
+ /* The hit point and the result are in the same box, we can't do better */
+ *distanceRef = 0;/* no one else will ever try to do better */
+ return node;
+ }
}
- if(distance<*distanceRef) {
- *distanceRef = distance;
- return node;
+ return NULL;
+ }
+ case synctex_node_type_void_hbox:
+ case synctex_node_type_void_vbox:
+ /* Both boxes does not contain any material, they only contribute to SyncTeX by their line number. */
+ return NULL;
+ default:
+ {
+ int i = SYNCTEX_HORIZ(node);
+ int distance = i>H?i-H:H-i;
+ i = SYNCTEX_VERT(node);
+ distance += i>V?i-V:V-i;
+ if(distance<*distanceRef) {
+ *distanceRef = distance;
+ return node;
+ }
+ return NULL;
+ }
+ }
+ }
+ return NULL;
+}
+
+/* The best container is the deeper box that contains the given point.
+ * We traverse the node tree in a deep first manner and stop as soon as a resutl is found. */
+inline static synctex_node_t _synctex_best_container(synctex_node_t node,int H,int V);
+inline static synctex_node_t _synctex_best_container(synctex_node_t node,int H,int V) {
+ int min, max;
+ synctex_node_t child = NULL;
+ synctex_node_t result = NULL;
+ switch(node->class->type) {
+ case synctex_node_type_hbox:
+ case synctex_node_type_vbox:
+ case synctex_node_type_hbox_non_void:
+ max = SYNCTEX_WIDTH_V(node);
+ if(max<0) {
+ min = max;
+ max = SYNCTEX_HORIZ_V(node);
+ min += max;
+ } else {
+ min = SYNCTEX_HORIZ_V(node);
+ max += min;
+ }
+ if(min<=H && H<=max) {
+ child = node;
+ while((child = SYNCTEX_CHILD(child))) {
+ if((result = _synctex_best_container(child,H,V))) {
+ return result;
}
- break;
- case synctex_node_type_hbox:
- case synctex_node_type_void_hbox:
- case synctex_node_type_hbox_non_void:
- case synctex_node_type_vbox:
- case synctex_node_type_void_vbox:
- break;
- }
- }
+ }
+ min = SYNCTEX_VERT_V(node);
+ max = min + SYNCTEX_DEPTH_V(node);
+ min -= SYNCTEX_HEIGHT_V(node);
+ if(min<=V && V<=max) {
+ /* The hit point and the result are in the same box, we can't do better */
+ return node;
+ }
+ }
}
return NULL;
}
+
int synctex_edit_query(synctex_scanner_t scanner,int page,float h,float v) {
synctex_node_t sheet = NULL;
synctex_node_t node = NULL;
synctex_node_t best_node = NULL;
+ synctex_node_t best_container = NULL;
int H,V;
int minH,maxH,minV,maxV;
- int distance;
- int best_distance,best_height;
+ int best_distance,distance;
if(NULL == scanner || 0 == scanner->unit) {
return 0;
}
@@ -3246,6 +3289,8 @@ int synctex_edit_query(synctex_scanner_t scanner,int page,float h,float v) {
/* We initialize the values with the next box of the sheet. */
node = SYNCTEX_NEXT_BOX(sheet);
if(NULL == node) {
+ /* This is a very weird situation where there are no kern, math or glue nodes.
+ * Ignore this, for the moment. */
return 0;
}
/* The distance between a point and a box is special.
@@ -3257,14 +3302,19 @@ int synctex_edit_query(synctex_scanner_t scanner,int page,float h,float v) {
* we also give names to the vertices of the box.
*
* 1 | 2 | 3
- * ---A---B---
+ * ---A---B--->
* 4 | 5 | 6
- * ---C---D---
+ * ---C---D--->
* 7 | 8 | 9
- *
+ * v v
* In each region, there is a different formula.
* In the end we have a continuous distance which may not be a mathematical distance but who cares. */
+ /* In order to gain speed, we have made a linked list of all the box nodes that contain either kern, glue or math node.
+ * These kind of boxes are expected to represent the vast majority of boxes.
+ * It was created while parsing the sheet content, and the boxes are ordered from deeper to lower. */
/* min? and max? are the coordinates of the box. */
+next_box:
+ /* getting the box bounds, taking into account negative widths. */
maxH = SYNCTEX_WIDTH_V(node);
if(maxH<0) {
minH = maxH;
@@ -3277,7 +3327,6 @@ int synctex_edit_query(synctex_scanner_t scanner,int page,float h,float v) {
minV = SYNCTEX_VERT_V(node);
maxV = minV + SYNCTEX_DEPTH_V(node);
minV -= SYNCTEX_HEIGHT_V(node);
- best_height = maxV - minV;
/* In what region is the point P=(H,V) ? */
if(V<minV) {
if(H<minH) {
@@ -3314,8 +3363,48 @@ int synctex_edit_query(synctex_scanner_t scanner,int page,float h,float v) {
}
}
best_node = node;
- /* Then browse the list of boxes until we find one with a 0 best_distance, or finish the list. */
- while(best_distance>0 && (node = SYNCTEX_NEXT_BOX(node))) {
+ /* Is best_node a box containing the hit point? */
+ if(best_distance==0) {
+ if((best_container = _synctex_best_container(best_node,H,V)) && (best_container != best_node)) {
+ /* We have found a box that contains the hit point, as a descendant of best_node.
+ * best_container is a box that contains no kern, math and glue nodes,
+ * otherwise, it would be located in the linked list of such boxes, before its ancestor best_node
+ * and it would have been laready caught.
+ * In mathematical formulas, there are such boxes because there is not enough material to add glue or kern. */
+ if((SYNCTEX_START = malloc(sizeof(synctex_node_t)))) {
+ * (synctex_node_t *)SYNCTEX_START = best_container;
+ SYNCTEX_END = SYNCTEX_START + sizeof(synctex_node_t);
+ SYNCTEX_CUR = NULL;
+ return (SYNCTEX_END-SYNCTEX_START)/sizeof(synctex_node_t);
+ } else {
+ return SYNCTEX_STATUS_ERROR;
+ }
+ }
+ /* Then we try to find what is the best child node inside the box best_node,
+ * which means the node closest to the hit point.*/
+ distance = INT_MAX;
+ if(node = _synctex_best_child_node(best_node,H,V,&distance)) {
+ if((SYNCTEX_START = malloc(sizeof(synctex_node_t)))) {
+ * (synctex_node_t *)SYNCTEX_START = node;
+ SYNCTEX_END = SYNCTEX_START + sizeof(synctex_node_t);
+ SYNCTEX_CUR = NULL;
+ return (SYNCTEX_END-SYNCTEX_START)/sizeof(synctex_node_t);
+ } else {
+ return SYNCTEX_STATUS_ERROR;
+ }
+ }
+ /* We could not find a best node closest to the hit point.
+ * This is unreachable code because all the boxes here are non void boxes. */
+ if((node = SYNCTEX_NEXT_BOX(best_node))) {
+ goto next_box;
+ } else {
+ return 0;
+ }
+ }
+ node = best_node;
+ /* Now we have best_distance>0
+ * We continue through the non void box list until we find the box closest to the hit point */
+ while(node = SYNCTEX_NEXT_BOX(node)) {
maxH = SYNCTEX_WIDTH_V(node);
if(maxH<0) {
minH = maxH;
@@ -3362,18 +3451,72 @@ int synctex_edit_query(synctex_scanner_t scanner,int page,float h,float v) {
distance = V - maxV + H - maxH;
}
}
- if(distance<best_distance) {
- best_distance = distance;
+ if(distance>0) {
+ /* This box does not contain the hit point */
+ if(distance<best_distance) {
+ /* but it is closer */
+ best_distance = distance;
+ best_node = node;
+ }
+ } else {
+ /* This box contains the hit point */
best_node = node;
+ /* Is ther a better container, that was not a non void box?*/
+ if((best_container = _synctex_best_container(node,H,V)) && (best_container != best_node)) {
+ /* the answer is yes */
+ if((SYNCTEX_START = malloc(sizeof(synctex_node_t)))) {
+ * (synctex_node_t *)SYNCTEX_START = best_container;
+ SYNCTEX_END = SYNCTEX_START + sizeof(synctex_node_t);
+ SYNCTEX_CUR = NULL;
+ return (SYNCTEX_END-SYNCTEX_START)/sizeof(synctex_node_t);
+ } else {
+ return SYNCTEX_STATUS_ERROR;
+ }
+ }
+ /* the best_node is also the best_container, just find the closest child node. */
+ distance = INT_MAX;
+ if(best_node = _synctex_best_child_node(best_node,H,V,&distance)) {
+ if((SYNCTEX_START = malloc(sizeof(synctex_node_t)))) {
+ * (synctex_node_t *)SYNCTEX_START = best_node;
+ SYNCTEX_END = SYNCTEX_START + sizeof(synctex_node_t);
+ SYNCTEX_CUR = NULL;
+ return (SYNCTEX_END-SYNCTEX_START)/sizeof(synctex_node_t);
+ } else {
+ return SYNCTEX_STATUS_ERROR;
+ }
+ }
+ /* We should have stopped here because _synctex_best_child_node always returns something for non void boxes. */
+ }
+ }
+ /* Bad luck, no non void box does contain the hit point, we have to work harder.
+ * We start from the top (the sheet's child) and try to find a box that contains the hit point.
+ * It is a bit long but it should occur only seldomly. */
+ if((node = SYNCTEX_CHILD(sheet)) && (best_container = _synctex_best_container(node,H,V)) && (best_container != best_node)) {
+ /* in fact, we always have best_container != best_node, because the former contains the hit point, but not the latter.
+ * At that point, we are sure that the distance between the hit point and the best_node is positive. */
+ if((SYNCTEX_START = malloc(sizeof(synctex_node_t)))) {
+ * (synctex_node_t *)SYNCTEX_START = best_container;
+ SYNCTEX_END = SYNCTEX_START + sizeof(synctex_node_t);
+ SYNCTEX_CUR = NULL;
+ return (SYNCTEX_END-SYNCTEX_START)/sizeof(synctex_node_t);
+ } else {
+ return SYNCTEX_STATUS_ERROR;
}
}
- best_distance = INT_MAX;
- if((best_node = _synctex_best_child_node(best_node,H,V,&best_distance))
- && (SYNCTEX_START = malloc(sizeof(synctex_node_t)))) {
- * (synctex_node_t *)SYNCTEX_START = best_node;
- SYNCTEX_END = SYNCTEX_START + sizeof(synctex_node_t);
- SYNCTEX_CUR = NULL;
- return (SYNCTEX_END-SYNCTEX_START)/sizeof(synctex_node_t);
+ /* Last chance, return the best_node or its best child. */
+ if(best_node) {
+ distance = INT_MAX;
+ if((node = _synctex_best_child_node(best_node,H,V,&distance))) {
+ best_node = node;
+ }
+ if((SYNCTEX_START = malloc(sizeof(synctex_node_t)))) {
+ * (synctex_node_t *)SYNCTEX_START = best_node;
+ SYNCTEX_END = SYNCTEX_START + sizeof(synctex_node_t);
+ SYNCTEX_CUR = NULL;
+ return (SYNCTEX_END-SYNCTEX_START)/sizeof(synctex_node_t);
+ } else {
+ return SYNCTEX_STATUS_ERROR;
+ }
}
return 0;
}
diff --git a/Build/source/texk/web2c/synctexdir/synctex_parser.h b/Build/source/texk/web2c/synctexdir/synctex_parser.h
index 18a3c8a01a1..f698ffb5a7e 100644
--- a/Build/source/texk/web2c/synctexdir/synctex_parser.h
+++ b/Build/source/texk/web2c/synctexdir/synctex_parser.h
@@ -31,16 +31,34 @@ shall not be used in advertising or otherwise to promote the sale,
use or other dealings in this Software without prior written
authorization from the copyright holder.
+Acknowledgments:
+----------------
+The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
+and significant help from XeTeX developer Jonathan Kew
+
+Nota Bene:
+----------
+If you include or use a significant part of the synctex package into a software,
+I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
+
+Version 1
+Thu Jun 19 09:39:21 UTC 2008
+
*/
#ifndef __SYNCTEX_PARSER__
# define __SYNCTEX_PARSER__
-/* synctex_node_t is the type for all synctex nodes */
+/* synctex_node_t is the type for all synctex nodes.
+ * The synctex file is parsed into a tree of nodes, either sheet, boxes, math nodes... */
typedef struct _synctex_node * synctex_node_t;
/* The main synctex object is a scanner
- * Its implementation is considered private
+ * Its implementation is considered private.
+ * The basic workflow is
+ * - create a scanner with a file
+ * - perform actions on that scanner
+ * - free the scanner
*/
typedef struct __synctex_scanner_t _synctex_scanner_t;
typedef _synctex_scanner_t * synctex_scanner_t;
@@ -50,28 +68,33 @@ extern "C" {
#endif
/* This is the designated method to create a new synctex scanner object.
- * name can be the tex file that originated the synctex file.
- * The ".tex" file extension is removed and replaced by the proper extension.
+ * output is the pdf/dvi/xdv file associated to the synctex file.
+ * If relevant, it can be the tex file that originated the synctex file
+ * but it might cause problems if the \jobname has a custom value.
+ * The last file extension is removed and replaced by the proper extension.
* Then the private method synctex_scanner_new_with_contents_of_file is called.
* NULL is returned in case of an error or non existent file.
*/
synctex_scanner_t synctex_scanner_new_with_output_file(const char * output);
/* This is the designated method to delete a synctex scanner object.
+ * Frees all the memory.
*/
void synctex_scanner_free(synctex_scanner_t scanner);
-/* Display all the information contains in the scanner object.
- * If the records are too numerous, they are not displayed.
+/* Display all the information contained in the scanner object.
+ * If the records are too numerous, only the first ones are displayed.
+ * This is mainly for informatinal purpose to help developers.
*/
void synctex_scanner_display(synctex_scanner_t scanner);
-/* The x and y offset of the origin. The magnification
+/* The x and y offset of the origin in TeX coordinates. The magnification
These are used by pdf viewers that want to display the real box size.
- For example, getting the horizontal coordinate of a node would require
+ For example, getting the horizontal coordinates of a node would require
synctex_node_box_h(node)*synctex_scanner_magnification(scanner)+synctex_scanner_x_offset(scanner)
- Getting its width would simply require
+ Getting its TeX width would simply require
synctex_node_box_width(node)*synctex_scanner_magnification(scanner)
+ but direct methods are available for that below.
*/
int synctex_scanner_x_offset(synctex_scanner_t scanner);
int synctex_scanner_y_offset(synctex_scanner_t scanner);
@@ -80,14 +103,21 @@ float synctex_scanner_magnification(synctex_scanner_t scanner);
/* Managing the input file names.
* Given a tag, synctex_scanner_get_name will return the corresponding file name.
* Conversely, given a file name, synctex_scanner_get_tag will retur, the corresponding tag.
+ * The file name must be the very same as understood by TeX.
+ * For example, if you \input myDir/foo.tex, the file name is myDir/foo.tex.
+ * No automatic path expansion is performed.
* Finally, synctex_scanner_input is the first input node of the scanner.
* To browse all the input node, use a loop like
*
- * if(input_node = synctex_scanner_input(scanner)){
+ * if((input_node = synctex_scanner_input(scanner))){
* do {
* blah
- * } while(input_node=synctex_node_sibling(input_node));
+ * } while((input_node=synctex_node_sibling(input_node)));
* }
+ *
+ * The output is the name that was used to create the scanner.
+ * The synctex is the real name of the synctex file,
+ * it was obtained from output by setting the proper file extension.
*/
const char * synctex_scanner_get_name(synctex_scanner_t scanner,int tag);
int synctex_scanner_get_tag(synctex_scanner_t scanner,const char * name);
@@ -99,7 +129,7 @@ const char * synctex_scanner_get_synctex(synctex_scanner_t scanner);
* parent, child and sibling are standard names for tree nodes.
* The parent is one level higher, the child is one level deeper,
* and the sibling is at the same level.
- * The sheet of a node is the first ancestor pf type sheet.
+ * The sheet of a node is the first ancestor, it is of type sheet.
* A node and its sibling have the same parent.
* A node is the parent of its child.
* A node is either the child of its parent,
@@ -109,12 +139,13 @@ const char * synctex_scanner_get_synctex(synctex_scanner_t scanner);
* This allows to navigate through all the nodes of a given sheet node:
*
* synctex_node_t node = sheet;
- * while(node = synctex_node_next(node)) {
+ * while((node = synctex_node_next(node))) {
* // do something with node
* }
*
- * With synctex_sheet_content, you can retrieve the sheet node at index page.
- * whereas synctex_node_sheet allows to retrieve the sheet containing a given node.
+ * With synctex_sheet_content, you can retrieve the sheet node given the page.
+ * The page is 1 based, according to TeX standards.
+ * Conversely synctex_node_sheet allows to retrieve the sheet containing a given node.
*/
synctex_node_t synctex_node_parent(synctex_node_t node);
synctex_node_t synctex_node_sheet(synctex_node_t node);
@@ -144,13 +175,15 @@ typedef enum {
synctex_node_type_t synctex_node_type(synctex_node_t node);
const char * synctex_node_isa(synctex_node_t node);
-/* This is primarily used for debugging purpose */
+/* This is primarily used for debugging purpose.
+ * The second one logs information for the node and recursively displays information for its next node */
void synctex_node_log(synctex_node_t node);
void synctex_node_display(synctex_node_t node);
/* Given a node, access to its tag, line and column.
* The line and column numbers are 1 based.
- * The latter is not yet fully supported.
+ * The latter is not yet fully supported in TeX, the default implementation returns 0 which means the whole line.
+ * When the tag is known, the scanner of the node will give the corresponding file name.
* When the tag is known, the scanner of the node will give the name.
*/
int synctex_node_tag(synctex_node_t node);
@@ -163,13 +196,16 @@ int synctex_node_column(synctex_node_t node);
int synctex_node_page(synctex_node_t node);
/* For quite all nodes, horizontal, vertical coordinates, and width.
+ * These are expressed in page coordinates, with origin at the top left corner.
*/
float synctex_node_h(synctex_node_t node);
float synctex_node_v(synctex_node_t node);
float synctex_node_width(synctex_node_t node);
/* For all nodes, dimensions of the enclosing box.
- * A box is enclosing itself.*/
+ * These are expressed in page coordinates, with origin at the top left corner.
+ * A box is enclosing itself.
+ */
float synctex_node_box_h(synctex_node_t node);
float synctex_node_box_v(synctex_node_t node);
float synctex_node_box_width(synctex_node_t node);
@@ -177,7 +213,9 @@ float synctex_node_box_height(synctex_node_t node);
float synctex_node_box_depth(synctex_node_t node);
/* For quite all nodes, horizontal, vertical coordinates, and width.
- * The visible dimensions are bigger than real ones to compensate 0 width boxes.
+ * The visible dimensions are bigger than real ones to compensate 0 width boxes
+ * that do contain nodes.
+ * These are expressed in page coordinates, with origin at the top left corner.
* A box is enclosing itself.
*/
float synctex_node_visible_h(synctex_node_t node);
@@ -185,7 +223,8 @@ float synctex_node_visible_v(synctex_node_t node);
float synctex_node_visible_width(synctex_node_t node);
/* For all nodes, visible dimensions of the enclosing box.
* A box is enclosing itself.
- * The visible dimensions are bigger than real ones to compensate 0 width boxes.
+ * The visible dimensions are bigger than real ones to compensate 0 width boxes
+ * that do contain nodes.
*/
float synctex_node_box_visible_h(synctex_node_t node);
float synctex_node_box_visible_v(synctex_node_t node);
@@ -199,16 +238,16 @@ float synctex_node_box_visible_depth(synctex_node_t node);
*
* if(synctex_display_query(scanner,name,line,column)>0) {
* synctex_node_t node;
- * while(node = synctex_next_result(scanner)) {
+ * while((node = synctex_next_result(scanner))) {
* // do something with node
* ...
* }
* }
*
- * Given the page and the position, synctex_edit_query returns the number of nodes
+ * Given the page and the position in the page, synctex_edit_query returns the number of nodes
* satisfying the contrain. Use code like
*
- * if(synctex_display_query(scanner,page,h,v)>0) {
+ * if(synctex_edit_query(scanner,page,h,v)>0) {
* synctex_node_t node;
* while(node = synctex_next_result(scanner)) {
* // do something with node
@@ -217,9 +256,13 @@ float synctex_node_box_visible_depth(synctex_node_t node);
* }
*
* page is 1 based
- * h and v are counted relative to the top left corner of the page.
+ * h and v are coordinates relative to the top left corner of the page.
+ * If you make a new query, the result of the previous one is discarded.
* If one of this function returns a non positive integer,
* it means that an error occurred.
+ *
+ * Both methods are conservative, in the sense that matching is weak.
+ * If the exact column number is not found, there will be an answer with the whole line.
*/
int synctex_display_query(synctex_scanner_t scanner,const char * name,int line,int column);
int synctex_edit_query(synctex_scanner_t scanner,int page,float h,float v);
@@ -228,6 +271,8 @@ synctex_node_t synctex_next_result(synctex_scanner_t scanner);
/* The main synctex updater object.
* This object is used to append information to the synctex file.
* Its implementation is considered private.
+ * It is used by the synctex command line tool to take into account modifications
+ * that could occur while postprocessing files by dvipdf like filters.
*/
typedef struct __synctex_updater_t _synctex_updater_t;
typedef _synctex_updater_t * synctex_updater_t;