1 /*
2 Copyright (c) 2008-2011 jerome DOT laurens AT u-bourgogne DOT fr
3 
4 This file is part of the SyncTeX package.
5 
6 Latest Revision: Wed Aug 22 07:20:29 UTC 2011
7 
8 License:
9 --------
10 Permission is hereby granted, free of charge, to any person
11 obtaining a copy of this software and associated documentation
12 files (the "Software"), to deal in the Software without
13 restriction, including without limitation the rights to use,
14 copy, modify, merge, publish, distribute, sublicense, and/or sell
15 copies of the Software, and to permit persons to whom the
16 Software is furnished to do so, subject to the following
17 conditions:
18 
19 The above copyright notice and this permission notice shall be
20 included in all copies or substantial portions of the Software.
21 
22 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
24 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
27 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29 OTHER DEALINGS IN THE SOFTWARE
30 
31 Except as contained in this notice, the name of the copyright holder
32 shall not be used in advertising or otherwise to promote the sale,
33 use or other dealings in this Software without prior written
34 authorization from the copyright holder.
35 Acknowledgments:
36 ----------------
37 The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh,
38 and significant help from XeTeX developer Jonathan Kew
39 
40 Nota Bene:
41 ----------
42 If you include or use a significant part of the synctex package into a software,
43 I would appreciate to be listed as contributor and see "SyncTeX" highlighted.
44 
45 Version 1
46 Thu Jun 19 09:39:21 UTC 2008
47 
48 */
49 
50 #  include "xetexd.h"
51 /* this will define XeTeX, which we can use in later conditionals */
52 
53 #  include <xetexdir/xetexextra.h>
54 
55 /* We observe nopdfoutput in order to determine whether output mode is
56  * pdf or xdv. */
57 #  define SYNCTEX_OFFSET_IS_PDF (nopdfoutput==0)
58 #  define SYNCTEX_OUTPUT (nopdfoutput!=0?"xdv":"pdf")
59 
60 #define SYNCTEX_CURH ((nopdfoutput==0)?(curh+4736287):curh)
61 #define SYNCTEX_CURV ((nopdfoutput==0)?(curv+4736287):curv)
62 
63 /*  WARNING:
64     The definition below must be in sync with their eponym declarations in synctex-xetex.ch1
65 */
66 #  define synchronization_field_size 1
67 
68 /* in XeTeX, "halfword" fields are at least 32 bits, so we'll use those for
69  * tag and line so that the sync field size is only one memory_word. */
70 #  define SYNCTEX_TAG_MODEL(NODE,TYPE)\
71                 mem[NODE+TYPE##_node_size-synchronization_field_size].hh.lhfield
72 #  define SYNCTEX_LINE_MODEL(NODE,TYPE)\
73                 mem[NODE+TYPE##_node_size-synchronization_field_size].hh.rh
74