diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-08-04 08:37:18 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-08-04 08:37:18 +0000 |
commit | 1e33cce520ec961287eb72234c7f09648ff2ac56 (patch) | |
tree | bb977b25d489bb703c4b424edef44592ca445c0b /Build | |
parent | 9356d0c8571afcad861f873e2b334b285259f57b (diff) |
SyncTeX: Avoid a memory leak, from Sebastian Ramacher <sramacher@debian.org>
Added a simple test case
git-svn-id: svn://tug.org/texlive/trunk@34833 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
23 files changed, 203 insertions, 227 deletions
diff --git a/Build/source/texk/web2c/Makefile.in b/Build/source/texk/web2c/Makefile.in index 67704b3663b..e095dfab4de 100644 --- a/Build/source/texk/web2c/Makefile.in +++ b/Build/source/texk/web2c/Makefile.in @@ -112,7 +112,7 @@ TESTS = tangle.test $(am__EXEEXT_41) ctiedir/ctie.test \ $(am__append_46) $(am__append_50) $(am__append_52) \ $(am__append_58) $(am__append_69) $(am__append_70) \ $(am__append_78) $(am__append_80) $(am__append_83) \ - libmd5/md5.test + $(am__append_113) libmd5/md5.test DIST_COMMON = $(srcdir)/am/bootstrap.am $(srcdir)/am/web.am \ $(srcdir)/am/cweb.am $(srcdir)/am/texmf.am \ $(srcdir)/mplibdir/am/mplib.am \ @@ -338,6 +338,7 @@ DIST_COMMON = $(srcdir)/am/bootstrap.am $(srcdir)/am/web.am \ @XETEX_SYNCTEX_TRUE@ synctexdir/synctex-common.h \ @XETEX_SYNCTEX_TRUE@ synctexdir/synctex-xetex.h +@SYNCTEX_TRUE@am__append_113 = $(synctex_tests) subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/web2c-disable.m4 \ @@ -2245,7 +2246,7 @@ EXTRA_DIST = PROJECTS cftests cpascal.h help.h w2c/config.h \ synctexdir/synctex-p-mem.ch1 synctexdir/synctex-p-rec.ch0 \ synctexdir/synctex-p-rec.ch1 synctexdir/synctex-ep-mem.ch0 \ synctexdir/synctex-ep-mem.ch1 synctexdir/synctex-pdf-rec.ch2 \ - synctexdir/synctex-xe-rec.ch3 libmd5/md5.test + synctexdir/synctex-xe-rec.ch3 $(synctex_tests) libmd5/md5.test DISTCLEANFILES = $(EXTRA_LIBRARIES) CXXLD.sh tangle.c tangle.h \ tangle.p tangle-web2c tangleboot.c tangleboot.h tangleboot.p \ tangleboot-web2c ctangle.c cweb.c cweb.h common-ctangle \ @@ -3486,6 +3487,10 @@ pkgconfigdir = ${libdir}/pkgconfig @XETEX_SYNCTEX_TRUE@xetex_post_ch_synctex = \ @XETEX_SYNCTEX_TRUE@ synctexdir/synctex-xe-rec.ch3 + +# SyncTeX Tests +# +synctex_tests = synctexdir/synctex.test libmd5_a_CPPFLAGS = -I$(srcdir)/libmd5 libmd5_a_SOURCES = libmd5/md5.c libmd5/md5.h md5main_CPPFLAGS = -I$(srcdir)/libmd5 diff --git a/Build/source/texk/web2c/omegafonts/ChangeLog b/Build/source/texk/web2c/omegafonts/ChangeLog index ccf39392ded..05851a2a078 100644 --- a/Build/source/texk/web2c/omegafonts/ChangeLog +++ b/Build/source/texk/web2c/omegafonts/ChangeLog @@ -1,3 +1,11 @@ +2014-08-04 Peter Breitenlohner <peb@mppmu.mpg.de> + + * char_routines.c: Compute checksum. + * header_routines.[ch]: Drop more unused code. + * shorten.test, tests/realnum.out, tests/repeat.opl, + tests/repeated.opl, tests/sample.{out,ovp}, tests/shorten.opl: + Always use computed checksum. + 2014-08-03 Peter Breitenlohner <peb@mppmu.mpg.de> * dimen_routines.c (set_indices): Fixed a dimen rounding bug. diff --git a/Build/source/texk/web2c/omegafonts/char_routines.c b/Build/source/texk/web2c/omegafonts/char_routines.c index 52e32de0f87..0fb0cbd5033 100644 --- a/Build/source/texk/web2c/omegafonts/char_routines.c +++ b/Build/source/texk/web2c/omegafonts/char_routines.c @@ -872,6 +872,33 @@ unsigned num_char_info, words_per_entry; #define RM_NEXT YY_NEXT(remainder) #define TG_NEXT YY_NEXT(tag) +static void +compute_check_sum(void) +{ + unsigned c; + unsigned plane, index; + char_entry *entry; + unsigned c0 = bc, c1 = ec, c2 = bc, c3 = ec; + fix wd; + + for (c = bc; c <= ec; c++) { + plane = c / PLANE; + index = c % PLANE; + entry = planes[plane][index]; + if ((entry == NULL) || (WD_ENTRY == 0)) + continue; + wd = lval(entry->indices[C_WD]); + if (design_units != UNITY) + wd = zround(((double)wd) / ((double)design_units) * 1048576.0); + wd += (c + 4) * 0x400000; /* this should be positive */ + c0 = (c0 + c0 + wd) % 255; + c1 = (c1 + c1 + wd) % 253; + c2 = (c2 + c2 + wd) % 251; + c3 = (c3 + c3 + wd) % 247; + } + check_sum = (c0 << 24) | (c1 << 16) | (c2 << 8) | c3; +} + void compute_ofm_character_info(void) { @@ -963,14 +990,9 @@ compute_ofm_character_info(void) } default: { internal_error_0("compute_ofm_character_info"); } } -} -void -calculate_check_sum(void) -{ -/* - not_yet_done("checksum calculation"); -*/ + if (check_sum_specified==FALSE) + compute_check_sum(); } void diff --git a/Build/source/texk/web2c/omegafonts/header_routines.c b/Build/source/texk/web2c/omegafonts/header_routines.c index 3e19955d7bb..160c021b7dc 100644 --- a/Build/source/texk/web2c/omegafonts/header_routines.c +++ b/Build/source/texk/web2c/omegafonts/header_routines.c @@ -240,12 +240,6 @@ set_design_size(fix ds) } void -store_design_size(void) -{ - store_header_int(LOC_DESIGN_SIZE, design_size); -} - -void retrieve_design_size(void) { retrieve_header_int(LOC_DESIGN_SIZE, (unsigned *) &design_size); @@ -306,18 +300,6 @@ set_coding_scheme(string sval) } void -store_coding_scheme(void) -{ - register unsigned i=0, j=LOC_CODING_SCHEME, len=strlen(coding_scheme); - - header[j] = len; - for (j++; i<len; i++,j++) header[j] = coding_scheme[i]; - for (; j<(LOC_CODING_SCHEME+LEN_CODING_SCHEME); j++) - header[j] = '\0';; -} - - -void retrieve_coding_scheme(void) { register unsigned i=0, j=LOC_CODING_SCHEME, len=header[LOC_CODING_SCHEME]; @@ -362,19 +344,6 @@ set_family(string sval) } void -store_family(void) -{ - register unsigned i=0, j=LOC_FAMILY, len=strlen(family); - - if (len>LEN_FAMILY) internal_error_1("store_family (len=%d)", len); - header[j] = len; - for (j++; i<len; i++,j++) header[j] = family[i]; - for (; j<=(LOC_FAMILY+LEN_FAMILY); j++) - header[j] = '\0';; -} - - -void retrieve_family(void) { register unsigned i=0, j=LOC_FAMILY, len=header[LOC_FAMILY]; @@ -414,12 +383,6 @@ set_face(unsigned f) } void -store_face(void) -{ - store_header_byte(LOC_FACE, face); -} - -void retrieve_face(void) { unsigned char face_byte; @@ -489,12 +452,6 @@ set_seven_bit_safe_flag(unsigned f) } void -store_seven_bit_safe_flag(void) -{ - store_header_byte(LOC_SEVEN_FLAG, seven_bit ? 0x80 : 0); -} - -void retrieve_seven_bit_safe_flag(void) { unsigned char seven_bit_byte; @@ -546,8 +503,6 @@ output_ofm_header(void) av_list L = header_list; - if (check_sum_specified==FALSE) - calculate_check_sum(); out_ofm_4(check_sum); out_ofm_4(design_size); k1 = strlen(coding_scheme); diff --git a/Build/source/texk/web2c/omegafonts/header_routines.h b/Build/source/texk/web2c/omegafonts/header_routines.h index b418af27dce..857d16fc745 100644 --- a/Build/source/texk/web2c/omegafonts/header_routines.h +++ b/Build/source/texk/web2c/omegafonts/header_routines.h @@ -65,11 +65,9 @@ extern void set_header_word(unsigned, unsigned); extern void init_check_sum(void); extern void set_check_sum(unsigned); extern void retrieve_check_sum(void); -extern void calculate_check_sum(void); extern void init_design_size(void); extern void set_design_size(fix); -extern void store_design_size(void); extern void retrieve_design_size(void); extern void init_design_units(void); @@ -77,20 +75,16 @@ extern void set_design_units(fix); extern void init_coding_scheme(void); extern void set_coding_scheme(string ); -extern void store_coding_scheme(void); extern void retrieve_coding_scheme(void); extern void init_family(void); extern void set_family(string ); -extern void store_family(void); extern void retrieve_family(void); extern void set_face(unsigned); -extern void store_face(void); extern void retrieve_face(void); extern void set_seven_bit_safe_flag(unsigned); -extern void store_seven_bit_safe_flag(void); extern void retrieve_seven_bit_safe_flag(void); extern void calculate_seven_bit_safe_flag(void); diff --git a/Build/source/texk/web2c/omegafonts/shorten.test b/Build/source/texk/web2c/omegafonts/shorten.test index 10ede611451..9252de35cca 100755 --- a/Build/source/texk/web2c/omegafonts/shorten.test +++ b/Build/source/texk/web2c/omegafonts/shorten.test @@ -10,10 +10,8 @@ test -d $tests || mkdir -p $tests TEXMFCNF=$srcdir/../../kpathsea export TEXMFCNF -sed -e'/CHECKSUM/d' $srcdir/$tests/shorten.opl >$tests/shortend.in - -echo && echo "pltotf $tests/shortend.in $tests/shortend.tfm" && \ - ../pltotf $tests/shortend.in $tests/shortend.tfm || exit +echo && echo "pltotf $tests/shorten.opl $tests/shortend.tfm" && \ + ../pltotf $srcdir/$tests/shorten.opl $tests/shortend.tfm || exit echo && echo "omfonts -ofm2opl $tests/shorten.tfm $tests/shortend.pl" && \ ./omfonts -ofm2opl $tests/shortend.tfm $tests/shortend.pl || exit diff --git a/Build/source/texk/web2c/omegafonts/tests/realnum.out b/Build/source/texk/web2c/omegafonts/tests/realnum.out index 2ce85862405..cacd83209bf 100644 --- a/Build/source/texk/web2c/omegafonts/tests/realnum.out +++ b/Build/source/texk/web2c/omegafonts/tests/realnum.out @@ -4,7 +4,7 @@ (DESIGNSIZE R 10.0) (COMMENT DESIGNSIZE IS IN POINTS) (COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE) -(CHECKSUM H 0) +(CHECKSUM H 3996EA86) (SEVENBITSAFEFLAG TRUE) (COMMENT (CHARWD_ENTRY D 0 R 0.0) diff --git a/Build/source/texk/web2c/omegafonts/tests/repeat.opl b/Build/source/texk/web2c/omegafonts/tests/repeat.opl index 09099826e4b..1a790fb622b 100644 --- a/Build/source/texk/web2c/omegafonts/tests/repeat.opl +++ b/Build/source/texk/web2c/omegafonts/tests/repeat.opl @@ -1,4 +1,4 @@ -(OFMLEVEL D 1) +(OFMLEVEL H 1) (FONTDIR TL) (FAMILY UNSPECIFIED) (FACE F MRR) @@ -6,8 +6,6 @@ (DESIGNSIZE R 10.0) (COMMENT DESIGNSIZE IS IN POINTS) (COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE) -(CHECKSUM H 0) -(SEVENBITSAFEFLAG FALSE) (FONTDIMEN (SLANT R 0.0) (SPACE R 0.0) @@ -17,21 +15,6 @@ (QUAD R 1.0) (EXTRASPACE R 0.0) ) -(COMMENT - (CHARWD_ENTRY D 0 R 0.0) - (CHARWD_ENTRY D 1 R 1.0) - ) -(COMMENT - (CHARHT_ENTRY D 0 R 0.0) - (CHARHT_ENTRY D 1 R 0.9) - ) -(COMMENT - (CHARDP_ENTRY D 0 R 0.0) - (CHARDP_ENTRY D 1 R 0.1) - ) -(COMMENT - (CHARIC_ENTRY D 0 R 0.0) - ) (CHARREPEAT H 1 H 0 (COMMENT Repeat count zero) (CHARWD R 1.0) diff --git a/Build/source/texk/web2c/omegafonts/tests/repeated.opl b/Build/source/texk/web2c/omegafonts/tests/repeated.opl index 08c9f8aaa5d..5fdcaab97fa 100644 --- a/Build/source/texk/web2c/omegafonts/tests/repeated.opl +++ b/Build/source/texk/web2c/omegafonts/tests/repeated.opl @@ -6,7 +6,7 @@ (DESIGNSIZE R 10.0) (COMMENT DESIGNSIZE IS IN POINTS) (COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE) -(CHECKSUM H 0) +(CHECKSUM H 461B802F) (SEVENBITSAFEFLAG FALSE) (FONTDIMEN (SLANT R 0.0) diff --git a/Build/source/texk/web2c/omegafonts/tests/sample.out b/Build/source/texk/web2c/omegafonts/tests/sample.out index 4e756fcec07..095881a95a3 100644 --- a/Build/source/texk/web2c/omegafonts/tests/sample.out +++ b/Build/source/texk/web2c/omegafonts/tests/sample.out @@ -7,17 +7,17 @@ (DESIGNSIZE R 10.0) (COMMENT DESIGNSIZE IS IN POINTS) (COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE) -(CHECKSUM H 0) +(CHECKSUM H 16497D66) (SEVENBITSAFEFLAG FALSE) (MAPFONT D 0 (FONTNAME sample0-h) - (FONTCHECKSUM H 0) + (FONTCHECKSUM H 11AB1731) (FONTAT R 1.0) (FONTDSIZE R 10.0) ) (MAPFONT D 1 (FONTNAME sample1-h) - (FONTCHECKSUM H 0) + (FONTCHECKSUM H 11AB1731) (FONTAT R 1.0) (FONTDSIZE R 10.0) ) diff --git a/Build/source/texk/web2c/omegafonts/tests/sample.ovp b/Build/source/texk/web2c/omegafonts/tests/sample.ovp index e1bdf269a03..2805f82e876 100644 --- a/Build/source/texk/web2c/omegafonts/tests/sample.ovp +++ b/Build/source/texk/web2c/omegafonts/tests/sample.ovp @@ -1,5 +1,5 @@ (VTITLE JVF for SAMPLE) -(OFMLEVEL D 0) +(OFMLEVEL H 0) (FONTDIR TL) (FAMILY UNSPECIFIED) (FACE F MRR) @@ -7,33 +7,18 @@ (DESIGNSIZE R 10.0) (COMMENT DESIGNSIZE IS IN POINTS) (COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE) -(CHECKSUM H 0) -(SEVENBITSAFEFLAG FALSE) (MAPFONT D 0 (FONTNAME sample0-h) - (FONTCHECKSUM H 0) + (FONTCHECKSUM H 11AB1731) (FONTAT R 1.0) (FONTDSIZE R 10.0) ) (MAPFONT D 2 (FONTNAME sample1-h) - (FONTCHECKSUM H 0) + (FONTCHECKSUM H 11AB1731) (FONTAT R 1.0) (FONTDSIZE R 10.0) ) -(COMMENT - (CHARWD_ENTRY D 0 R 0.0) - (CHARWD_ENTRY D 1 R 1.0) - ) -(COMMENT - (CHARHT_ENTRY D 0 R 0.0) - ) -(COMMENT - (CHARDP_ENTRY D 0 R 0.0) - ) -(COMMENT - (CHARIC_ENTRY D 0 R 0.0) - ) (CHARACTER H 2121 (CHARWD R 1.0) (MAP diff --git a/Build/source/texk/web2c/omegafonts/tests/shorten.opl b/Build/source/texk/web2c/omegafonts/tests/shorten.opl index d9f951d67ae..ab6c3341699 100644 --- a/Build/source/texk/web2c/omegafonts/tests/shorten.opl +++ b/Build/source/texk/web2c/omegafonts/tests/shorten.opl @@ -1,5 +1,4 @@ (COMMENT More that 15 non-zero depths and heights) -(CHECKSUM H 77A61937) (CHARACTER H A (CHARWD R 1.1) (CHARHT R 0.1) diff --git a/Build/source/texk/web2c/omegaware/ChangeLog b/Build/source/texk/web2c/omegaware/ChangeLog index df1717b0643..96187e7208d 100644 --- a/Build/source/texk/web2c/omegaware/ChangeLog +++ b/Build/source/texk/web2c/omegaware/ChangeLog @@ -1,3 +1,8 @@ +2014-08-04 Peter Breitenlohner <peb@mppmu.mpg.de> + + * level1.opl, repeat.opl, repeated.opl, sample.ovp: Always use + computed checksum. + 2014-08-03 Peter Breitenlohner <peb@mppmu.mpg.de> * shorten.test, tests/shorten.opl, (new): Shell script and data diff --git a/Build/source/texk/web2c/omegaware/tests/level1.opl b/Build/source/texk/web2c/omegaware/tests/level1.opl index 1bcf6a73470..ad9d54a5684 100644 --- a/Build/source/texk/web2c/omegaware/tests/level1.opl +++ b/Build/source/texk/web2c/omegaware/tests/level1.opl @@ -6,7 +6,7 @@ (DESIGNSIZE R 10.0) (COMMENT DESIGNSIZE IS IN POINTS) (COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE) -(CHECKSUM H 0) +(CHECKSUM H 76407678) (SEVENBITSAFEFLAG FALSE) (FONTDIMEN (SLANT R 0.0) diff --git a/Build/source/texk/web2c/omegaware/tests/repeat.opl b/Build/source/texk/web2c/omegaware/tests/repeat.opl index e629f952d63..1a790fb622b 100644 --- a/Build/source/texk/web2c/omegaware/tests/repeat.opl +++ b/Build/source/texk/web2c/omegaware/tests/repeat.opl @@ -6,8 +6,6 @@ (DESIGNSIZE R 10.0) (COMMENT DESIGNSIZE IS IN POINTS) (COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE) -(CHECKSUM H 0) -(SEVENBITSAFEFLAG FALSE) (FONTDIMEN (SLANT R 0.0) (SPACE R 0.0) diff --git a/Build/source/texk/web2c/omegaware/tests/repeated.opl b/Build/source/texk/web2c/omegaware/tests/repeated.opl index f443e08546b..19ffa802b6f 100644 --- a/Build/source/texk/web2c/omegaware/tests/repeated.opl +++ b/Build/source/texk/web2c/omegaware/tests/repeated.opl @@ -6,7 +6,7 @@ (DESIGNSIZE R 10.0) (COMMENT DESIGNSIZE IS IN POINTS) (COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE) -(CHECKSUM H 0) +(CHECKSUM H 461B802F) (SEVENBITSAFEFLAG FALSE) (FONTDIMEN (SLANT R 0.0) diff --git a/Build/source/texk/web2c/omegaware/tests/sample.ovp b/Build/source/texk/web2c/omegaware/tests/sample.ovp index 0293ac4ca88..2805f82e876 100644 --- a/Build/source/texk/web2c/omegaware/tests/sample.ovp +++ b/Build/source/texk/web2c/omegaware/tests/sample.ovp @@ -7,8 +7,6 @@ (DESIGNSIZE R 10.0) (COMMENT DESIGNSIZE IS IN POINTS) (COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE) -(CHECKSUM H 16497D66) -(SEVENBITSAFEFLAG FALSE) (MAPFONT D 0 (FONTNAME sample0-h) (FONTCHECKSUM H 11AB1731) diff --git a/Build/source/texk/web2c/synctexdir/ChangeLog b/Build/source/texk/web2c/synctexdir/ChangeLog index 3094db84802..6afbeac7c2b 100644 --- a/Build/source/texk/web2c/synctexdir/ChangeLog +++ b/Build/source/texk/web2c/synctexdir/ChangeLog @@ -1,3 +1,18 @@ +2014-08-04 Peter Breitenlohner <peb@mppmu.mpg.de> + + * synctex_parser.c: Declare functions with file scope as static. + * synctex.test (new): Shell script for a simple test. + * am/synctex.am: Added the new test. + +2014-08-04 Sebastian Ramacher <sramacher@debian.org> + + * synctex_parser.c (_synctex_open): Avoid memory leak, + +2014-07-22 Peter Breitenlohner <peb@mppmu.mpg.de> + + * am/synctex.am: Build libsynctex as possibly shared library. + From Sebastian Ramacher <sramacher@debian.org>. + 2014-07-22 Khaled Hosny <khaledhosny@eglug.org> * am/synctex.am: Don't apply synctex-e-mem.ch0 to XeTeX, and replace diff --git a/Build/source/texk/web2c/synctexdir/am/synctex.am b/Build/source/texk/web2c/synctexdir/am/synctex.am index 9df0b2ae30e..c4481ae1cad 100644 --- a/Build/source/texk/web2c/synctexdir/am/synctex.am +++ b/Build/source/texk/web2c/synctexdir/am/synctex.am @@ -341,3 +341,13 @@ endif XETEX_SYNCTEX EXTRA_DIST += \ synctexdir/synctex-xe-rec.ch3 +# SyncTeX Tests +# +synctex_tests = synctexdir/synctex.test + +EXTRA_DIST += $(synctex_tests) + +if SYNCTEX +TESTS += $(synctex_tests) +endif SYNCTEX + diff --git a/Build/source/texk/web2c/synctexdir/synctex.test b/Build/source/texk/web2c/synctexdir/synctex.test new file mode 100755 index 00000000000..473bf116331 --- /dev/null +++ b/Build/source/texk/web2c/synctexdir/synctex.test @@ -0,0 +1,7 @@ +#! /bin/sh + +# Copyright (C) 2014 Peter Breitenlohner <tex-live@tug.org> +# You may freely use, modify and/or distribute this file. + +./synctex help || exit 1 + diff --git a/Build/source/texk/web2c/synctexdir/synctex_main.c b/Build/source/texk/web2c/synctexdir/synctex_main.c index f0fa3b96dab..cf07d4cdfca 100644 --- a/Build/source/texk/web2c/synctexdir/synctex_main.c +++ b/Build/source/texk/web2c/synctexdir/synctex_main.c @@ -1,9 +1,9 @@ /* -Copyright (c) 2008-2012 jerome DOT laurens AT u-bourgogne DOT fr +Copyright (c) 2008-2014 jerome DOT laurens AT u-bourgogne DOT fr This file is part of the SyncTeX package. -Latest Revision: Tue Jun 14 08:23:30 UTC 2011 +Latest Revision: Tue Jan 14 09:55:00 UTC 2014 Version: 1.17 @@ -155,7 +155,7 @@ static void synctex_usage(const char * error,va_list ap) { } fprintf((error?stderr:stdout), "usage: synctex <subcommand> [options] [args]\n" - "Synchronize TeXnology command-line client, version 1.15\n\n" + "Synchronize TeXnology command-line client, version 1.17\n\n" "The Synchronization TeXnology by Jérôme Laurens is a new feature of recent TeX engines.\n" "It allows to synchronize between input and output, which means to\n" "navigate from the source document to the typeset material and vice versa.\n\n" diff --git a/Build/source/texk/web2c/synctexdir/synctex_parser.c b/Build/source/texk/web2c/synctexdir/synctex_parser.c index f4d9633106d..3175495ffdb 100644 --- a/Build/source/texk/web2c/synctexdir/synctex_parser.c +++ b/Build/source/texk/web2c/synctexdir/synctex_parser.c @@ -240,14 +240,11 @@ struct __synctex_class_t { SYNCTEX_GETTER(NODE,next_hbox)[0]=NEXT_HBOX;\ } -void _synctex_free_node(synctex_node_t node); -void _synctex_free_leaf(synctex_node_t node); - /* A node is meant to own its child and sibling. * It is not owned by its parent, unless it is its first child. * This destructor is for all nodes with children. */ -void _synctex_free_node(synctex_node_t node) { +static void _synctex_free_node(synctex_node_t node) { if (node) { (*((node->class)->sibling))(node); SYNCTEX_FREE(SYNCTEX_SIBLING(node)); @@ -262,7 +259,7 @@ void _synctex_free_node(synctex_node_t node) { * This destructor is for nodes with no child. * The first sheet is onwned by the scanner. */ -void _synctex_free_leaf(synctex_node_t node) { +static void _synctex_free_leaf(synctex_node_t node) { if (node) { SYNCTEX_FREE(SYNCTEX_SIBLING(node)); free(node); @@ -345,8 +342,7 @@ struct __synctex_scanner_t { * It is only used for pointer values */ # define SYNCTEX_MAKE_GET(SYNCTEX_GETTER,OFFSET)\ -synctex_node_t * SYNCTEX_GETTER (synctex_node_t node);\ -synctex_node_t * SYNCTEX_GETTER (synctex_node_t node) {\ +static synctex_node_t * SYNCTEX_GETTER (synctex_node_t node) {\ return node?(synctex_node_t *)((&((node)->implementation))+OFFSET):NULL;\ } SYNCTEX_MAKE_GET(_synctex_implementation_0,0) @@ -363,29 +359,10 @@ typedef struct { * SYNCTEX_PAGE_IDX */ } synctex_node_sheet_t; -synctex_node_t _synctex_new_sheet(synctex_scanner_t scanner); -void _synctex_display_sheet(synctex_node_t node); -void _synctex_log_sheet(synctex_node_t node); - -static _synctex_class_t synctex_class_sheet = { - NULL, /* No scanner yet */ - synctex_node_type_sheet, /* Node type */ - &_synctex_new_sheet, /* creator */ - &_synctex_free_node, /* destructor */ - &_synctex_log_sheet, /* log */ - &_synctex_display_sheet, /* display */ - NULL, /* No parent */ - &_synctex_implementation_0, /* child */ - &_synctex_implementation_1, /* sibling */ - NULL, /* No friend */ - &_synctex_implementation_2, /* Next hbox */ - (_synctex_info_getter_t)&_synctex_implementation_3 /* info */ -}; - /* sheet node creator */ #define DEFINE_synctex_new_NODE(NAME)\ -synctex_node_t _synctex_new_##NAME(synctex_scanner_t scanner) {\ +static synctex_node_t _synctex_new_##NAME(synctex_scanner_t scanner) {\ if (scanner) {\ synctex_node_t node = _synctex_malloc(sizeof(synctex_node_##NAME##_t));\ if (node) {\ @@ -399,6 +376,24 @@ synctex_node_t _synctex_new_##NAME(synctex_scanner_t scanner) {\ } DEFINE_synctex_new_NODE(sheet) +static void _synctex_display_sheet(synctex_node_t node); +static void _synctex_log_sheet(synctex_node_t node); + +static _synctex_class_t synctex_class_sheet = { + NULL, /* No scanner yet */ + synctex_node_type_sheet, /* Node type */ + &_synctex_new_sheet, /* creator */ + &_synctex_free_node, /* destructor */ + &_synctex_log_sheet, /* log */ + &_synctex_display_sheet, /* display */ + NULL, /* No parent */ + &_synctex_implementation_0, /* child */ + &_synctex_implementation_1, /* sibling */ + NULL, /* No friend */ + &_synctex_implementation_2, /* Next hbox */ + (_synctex_info_getter_t)&_synctex_implementation_3 /* info */ +}; + /* A box node contains navigation and synctex information * There are different kind of boxes. * Only horizontal boxes are treated differently because of their visible size. @@ -432,9 +427,11 @@ typedef struct { * SYNCTEX_HORIZ,SYNCTEX_VERT,SYNCTEX_WIDTH,SYNCTEX_HEIGHT,SYNCTEX_DEPTH */ } synctex_node_vbox_t; -synctex_node_t _synctex_new_vbox(synctex_scanner_t scanner); -void _synctex_log_vbox(synctex_node_t node); -void _synctex_display_vbox(synctex_node_t node); +/* vertical box node creator */ +DEFINE_synctex_new_NODE(vbox) + +static void _synctex_log_vbox(synctex_node_t node); +static void _synctex_display_vbox(synctex_node_t node); /* These are static class objects, each scanner will make a copy of them and setup the scanner field. */ @@ -453,9 +450,6 @@ static _synctex_class_t synctex_class_vbox = { (_synctex_info_getter_t)&_synctex_implementation_5 }; -/* vertical box node creator */ -DEFINE_synctex_new_NODE(vbox) - /* Horizontal boxes must contain visible size, because 0 width does not mean emptiness. * They also contain an average of the line numbers of the containing nodes. */ # define SYNCTEX_MEAN_LINE_IDX (SYNCTEX_DEPTH_IDX+1) @@ -487,9 +481,11 @@ typedef struct { * SYNCTEX_HORIZ_V,SYNCTEX_VERT_V,SYNCTEX_WIDTH_V,SYNCTEX_HEIGHT_V,SYNCTEX_DEPTH_V*/ } synctex_node_hbox_t; -synctex_node_t _synctex_new_hbox(synctex_scanner_t scanner); -void _synctex_display_hbox(synctex_node_t node); -void _synctex_log_hbox(synctex_node_t node); +/* horizontal box node creator */ +DEFINE_synctex_new_NODE(hbox) + +static void _synctex_display_hbox(synctex_node_t node); +static void _synctex_log_hbox(synctex_node_t node); static _synctex_class_t synctex_class_hbox = { @@ -507,9 +503,6 @@ static _synctex_class_t synctex_class_hbox = { (_synctex_info_getter_t)&_synctex_implementation_5 }; -/* horizontal box node creator */ -DEFINE_synctex_new_NODE(hbox) - /* This void box node implementation is either horizontal or vertical * It does not contain a child field. */ @@ -521,9 +514,11 @@ typedef struct { * SYNCTEX_HORIZ,SYNCTEX_VERT,SYNCTEX_WIDTH,SYNCTEX_HEIGHT,SYNCTEX_DEPTH*/ } synctex_node_void_vbox_t; -synctex_node_t _synctex_new_void_vbox(synctex_scanner_t scanner); -void _synctex_log_void_box(synctex_node_t node); -void _synctex_display_void_vbox(synctex_node_t node); +/* vertical void box node creator */ +DEFINE_synctex_new_NODE(void_vbox) + +static void _synctex_log_void_box(synctex_node_t node); +static void _synctex_display_void_vbox(synctex_node_t node); static _synctex_class_t synctex_class_void_vbox = { NULL, /* No scanner yet */ @@ -540,13 +535,12 @@ static _synctex_class_t synctex_class_void_vbox = { (_synctex_info_getter_t)&_synctex_implementation_3 }; -/* vertical void box node creator */ -DEFINE_synctex_new_NODE(void_vbox) - typedef synctex_node_void_vbox_t synctex_node_void_hbox_t; -synctex_node_t _synctex_new_void_hbox(synctex_scanner_t scanner); -void _synctex_display_void_hbox(synctex_node_t node); +/* horizontal void box node creator */ +DEFINE_synctex_new_NODE(void_hbox) + +static void _synctex_display_void_hbox(synctex_node_t node); static _synctex_class_t synctex_class_void_hbox = { NULL, /* No scanner yet */ @@ -563,9 +557,6 @@ static _synctex_class_t synctex_class_void_hbox = { (_synctex_info_getter_t)&_synctex_implementation_3 }; -/* horizontal void box node creator */ -DEFINE_synctex_new_NODE(void_hbox) - /* The medium nodes correspond to kern, glue, penalty and math nodes. * In LuaTeX, the size of the nodes may have changed. */ typedef struct { @@ -584,13 +575,14 @@ typedef struct { #define SYNCTEX_HAS_CHILDREN(NODE) (NODE && SYNCTEX_CHILD(NODE)) -void _synctex_log_medium_node(synctex_node_t node); +static void _synctex_log_medium_node(synctex_node_t node); typedef synctex_node_medium_t synctex_node_math_t; /* math node creator */ -synctex_node_t _synctex_new_math(synctex_scanner_t scanner); -void _synctex_display_math(synctex_node_t node); +DEFINE_synctex_new_NODE(math) + +static void _synctex_display_math(synctex_node_t node); static _synctex_class_t synctex_class_math = { NULL, /* No scanner yet */ @@ -607,13 +599,12 @@ static _synctex_class_t synctex_class_math = { (_synctex_info_getter_t)&_synctex_implementation_3 }; -DEFINE_synctex_new_NODE(math) - typedef synctex_node_medium_t synctex_node_kern_t; /* kern node creator */ -synctex_node_t _synctex_new_kern(synctex_scanner_t scanner); -void _synctex_display_kern(synctex_node_t node); +DEFINE_synctex_new_NODE(kern) + +static void _synctex_display_kern(synctex_node_t node); static _synctex_class_t synctex_class_kern = { NULL, /* No scanner yet */ @@ -630,8 +621,6 @@ static _synctex_class_t synctex_class_kern = { (_synctex_info_getter_t)&_synctex_implementation_3 }; -DEFINE_synctex_new_NODE(kern) - /* The small nodes correspond to glue and boundary nodes. */ typedef struct { SYNCTEX_DECLARE_CHARINDEX @@ -641,12 +630,12 @@ typedef struct { * SYNCTEX_HORIZ,SYNCTEX_VERT */ } synctex_node_small_t; -void _synctex_log_small_node(synctex_node_t node); +static void _synctex_log_small_node(synctex_node_t node); /* glue node creator */ typedef synctex_node_small_t synctex_node_glue_t; -synctex_node_t _synctex_new_glue(synctex_scanner_t scanner); -void _synctex_display_glue(synctex_node_t node); +DEFINE_synctex_new_NODE(glue) +static void _synctex_display_glue(synctex_node_t node); static _synctex_class_t synctex_class_glue = { NULL, /* No scanner yet */ @@ -662,12 +651,12 @@ static _synctex_class_t synctex_class_glue = { NULL, /* No next hbox */ (_synctex_info_getter_t)&_synctex_implementation_3 }; -DEFINE_synctex_new_NODE(glue) /* boundary node creator */ typedef synctex_node_small_t synctex_node_boundary_t; -synctex_node_t _synctex_new_boundary(synctex_scanner_t scanner); -void _synctex_display_boundary(synctex_node_t node); +DEFINE_synctex_new_NODE(boundary) + +static void _synctex_display_boundary(synctex_node_t node); static _synctex_class_t synctex_class_boundary = { NULL, /* No scanner yet */ @@ -684,8 +673,6 @@ static _synctex_class_t synctex_class_boundary = { (_synctex_info_getter_t)&_synctex_implementation_3 }; -DEFINE_synctex_new_NODE(boundary) - # define SYNCTEX_NAME_IDX (SYNCTEX_TAG_IDX+1) # define SYNCTEX_NAME(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_NAME_IDX].PTR @@ -698,29 +685,8 @@ typedef struct { * SYNCTEX_TAG,SYNCTEX_NAME */ } synctex_input_t; -synctex_node_t _synctex_new_input(synctex_scanner_t scanner); -void _synctex_free_input(synctex_node_t node); -void _synctex_display_input(synctex_node_t node); -void _synctex_log_input(synctex_node_t node); - -static _synctex_class_t synctex_class_input = { - NULL, /* No scanner yet */ - synctex_node_type_input, /* Node type */ - &_synctex_new_input, /* creator */ - &_synctex_free_input, /* destructor */ - &_synctex_log_input, /* log */ - &_synctex_display_input, /* display */ - NULL, /* No parent */ - NULL, /* No child */ - &_synctex_implementation_0, /* sibling */ - NULL, /* No friend */ - NULL, /* No next hbox */ - (_synctex_info_getter_t)&_synctex_implementation_1 -}; - # define SYNCTEX_INPUT_MARK "Input:" - -synctex_node_t _synctex_new_input(synctex_scanner_t scanner) { +static synctex_node_t _synctex_new_input(synctex_scanner_t scanner) { if (scanner) { synctex_node_t node = _synctex_malloc(sizeof(synctex_input_t)); if (node) { @@ -731,13 +697,33 @@ synctex_node_t _synctex_new_input(synctex_scanner_t scanner) { } return NULL; } -void _synctex_free_input(synctex_node_t node){ + +static void _synctex_free_input(synctex_node_t node){ if (node) { SYNCTEX_FREE(SYNCTEX_SIBLING(node)); free(SYNCTEX_NAME(node)); free(node); } } + +static void _synctex_display_input(synctex_node_t node); +static void _synctex_log_input(synctex_node_t node); + +static _synctex_class_t synctex_class_input = { + NULL, /* No scanner yet */ + synctex_node_type_input, /* Node type */ + &_synctex_new_input, /* creator */ + &_synctex_free_input, /* destructor */ + &_synctex_log_input, /* log */ + &_synctex_display_input, /* display */ + NULL, /* No parent */ + NULL, /* No child */ + &_synctex_implementation_0, /* sibling */ + NULL, /* No friend */ + NULL, /* No next hbox */ + (_synctex_info_getter_t)&_synctex_implementation_1 +}; + # ifdef SYNCTEX_NOTHING # pragma mark - # pragma mark Navigation @@ -810,14 +796,14 @@ void synctex_node_log(synctex_node_t node) { SYNCTEX_LOG(node); } -void _synctex_log_input(synctex_node_t node) { +static void _synctex_log_input(synctex_node_t node) { if (node) { printf("%s:%i,%s",synctex_node_isa(node),SYNCTEX_TAG(node),SYNCTEX_NAME(node)); printf(" SYNCTEX_SIBLING:%p",(void *)SYNCTEX_SIBLING(node)); } } -void _synctex_log_sheet(synctex_node_t node) { +static void _synctex_log_sheet(synctex_node_t node) { if (node) { printf("%s:%i",synctex_node_isa(node),SYNCTEX_PAGE(node)); SYNCTEX_PRINT_CHARINDEX; @@ -830,7 +816,7 @@ void _synctex_log_sheet(synctex_node_t node) { } } -void _synctex_log_small_node(synctex_node_t node) { +static void _synctex_log_small_node(synctex_node_t node) { if (node) { printf("%s:%i,%i:%i,%i", synctex_node_isa(node), @@ -847,7 +833,7 @@ void _synctex_log_small_node(synctex_node_t node) { } } -void _synctex_log_medium_node(synctex_node_t node) { +static void _synctex_log_medium_node(synctex_node_t node) { if (node) { printf("%s:%i,%i:%i,%i:%i", synctex_node_isa(node), @@ -865,7 +851,7 @@ void _synctex_log_medium_node(synctex_node_t node) { } } -void _synctex_log_void_box(synctex_node_t node) { +static void _synctex_log_void_box(synctex_node_t node) { if (node) { printf("%s",synctex_node_isa(node)); printf(":%i",SYNCTEX_TAG(node)); @@ -885,7 +871,7 @@ void _synctex_log_void_box(synctex_node_t node) { } } -void _synctex_log_vbox(synctex_node_t node) { +static void _synctex_log_vbox(synctex_node_t node) { if (node) { printf("%s",synctex_node_isa(node)); printf(":%i",SYNCTEX_TAG(node)); @@ -906,7 +892,7 @@ void _synctex_log_vbox(synctex_node_t node) { } } -void _synctex_log_hbox(synctex_node_t node) { +static void _synctex_log_hbox(synctex_node_t node) { if (node) { printf("%s",synctex_node_isa(node)); printf(":%i",SYNCTEX_TAG(node)); @@ -938,7 +924,7 @@ void synctex_node_display(synctex_node_t node) { SYNCTEX_DISPLAY(node); } -void _synctex_display_input(synctex_node_t node) { +static void _synctex_display_input(synctex_node_t node) { if (node) { printf("....Input:%i:%s", SYNCTEX_TAG(node), @@ -948,7 +934,7 @@ void _synctex_display_input(synctex_node_t node) { } } -void _synctex_display_sheet(synctex_node_t node) { +static void _synctex_display_sheet(synctex_node_t node) { if (node) { printf("....{%i",SYNCTEX_PAGE(node)); SYNCTEX_PRINT_CHARINDEX; @@ -958,7 +944,7 @@ void _synctex_display_sheet(synctex_node_t node) { } } -void _synctex_display_vbox(synctex_node_t node) { +static void _synctex_display_vbox(synctex_node_t node) { if (node) { printf("....[%i,%i:%i,%i:%i,%i,%i", SYNCTEX_TAG(node), @@ -975,7 +961,7 @@ void _synctex_display_vbox(synctex_node_t node) { } } -void _synctex_display_hbox(synctex_node_t node) { +static void _synctex_display_hbox(synctex_node_t node) { if (node) { printf("....(%i,%i~%i*%i:%i,%i:%i,%i,%i", SYNCTEX_TAG(node), @@ -994,7 +980,7 @@ void _synctex_display_hbox(synctex_node_t node) { } } -void _synctex_display_void_vbox(synctex_node_t node) { +static void _synctex_display_void_vbox(synctex_node_t node) { if (node) { printf("....v%i,%i;%i,%i:%i,%i,%i", SYNCTEX_TAG(node), @@ -1009,7 +995,7 @@ void _synctex_display_void_vbox(synctex_node_t node) { } } -void _synctex_display_void_hbox(synctex_node_t node) { +static void _synctex_display_void_hbox(synctex_node_t node) { if (node) { printf("....h%i,%i:%i,%i:%i,%i,%i", SYNCTEX_TAG(node), @@ -1024,7 +1010,7 @@ void _synctex_display_void_hbox(synctex_node_t node) { } } -void _synctex_display_glue(synctex_node_t node) { +static void _synctex_display_glue(synctex_node_t node) { if (node) { printf("....glue:%i,%i:%i,%i", SYNCTEX_TAG(node), @@ -1036,7 +1022,7 @@ void _synctex_display_glue(synctex_node_t node) { } } -void _synctex_display_math(synctex_node_t node) { +static void _synctex_display_math(synctex_node_t node) { if (node) { printf("....math:%i,%i:%i,%i", SYNCTEX_TAG(node), @@ -1048,7 +1034,7 @@ void _synctex_display_math(synctex_node_t node) { } } -void _synctex_display_kern(synctex_node_t node) { +static void _synctex_display_kern(synctex_node_t node) { if (node) { printf("....kern:%i,%i:%i,%i:%i", SYNCTEX_TAG(node), @@ -1061,7 +1047,7 @@ void _synctex_display_kern(synctex_node_t node) { } } -void _synctex_display_boundary(synctex_node_t node) { +static void _synctex_display_boundary(synctex_node_t node) { if (node) { printf("....boundary:%i,%i:%i,%i", SYNCTEX_TAG(node), @@ -2728,15 +2714,13 @@ synctex_scanner_t synctex_scanner_new_with_output_file(const char * output, cons return parse? synctex_scanner_parse(scanner):scanner; } -int __synctex_open(const char * output, char ** synctex_name_ref, gzFile * file_ref, synctex_bool_t add_quotes, synctex_io_mode_t * io_mode_ref); - /* This functions opens the file at the "output" given location. * It manages the problem of quoted filenames that appear with pdftex and filenames containing the space character. * In TeXLive 2008, the synctex file created with pdftex did contain unexpected quotes. * This function will remove them if possible. * All the reference arguments will take a value on return. They must be non NULL. * 0 on success, non 0 on error. */ -int __synctex_open(const char * output, char ** synctex_name_ref, gzFile * file_ref, synctex_bool_t add_quotes, synctex_io_mode_t * io_mode_ref) { +static int __synctex_open(const char * output, char ** synctex_name_ref, gzFile * file_ref, synctex_bool_t add_quotes, synctex_io_mode_t * io_mode_ref) { if (synctex_name_ref && file_ref && io_mode_ref) { /* 1 local variables that uses dynamic memory */ char * synctex_name = NULL; @@ -2878,6 +2862,7 @@ int _synctex_open(const char * output, const char * build_directory, char ** syn build_output[0] = '\0'; } else { if (build_output != strcpy(build_output,output)) { + free(build_output); return -4; } build_output[lpc-output]='\0'; @@ -2886,15 +2871,20 @@ int _synctex_open(const char * output, const char * build_directory, char ** syn /* Append a path separator if necessary. */ if (!SYNCTEX_IS_PATH_SEPARATOR(build_output[strlen(build_directory)-1])) { if (build_output != strcat(build_output,"/")) { + free(build_output); return -2; } } /* Append the last path component of the output. */ if (build_output != strcat(build_output,lpc)) { + free(build_output); return -3; } - return __synctex_open(build_output,synctex_name_ref,file_ref,add_quotes,io_mode_ref); + result = __synctex_open(build_output,synctex_name_ref,file_ref,add_quotes,io_mode_ref); + free(build_output); + return result; } + free(build_output); } return -1; } diff --git a/Build/source/texk/web2c/synctexdir/synctex_parser_readme.txt b/Build/source/texk/web2c/synctexdir/synctex_parser_readme.txt index 251451f1b99..4265cf423e9 100644 --- a/Build/source/texk/web2c/synctexdir/synctex_parser_readme.txt +++ b/Build/source/texk/web2c/synctexdir/synctex_parser_readme.txt @@ -158,6 +158,10 @@ TeX and friends are not concerned by these changes. - minor changes, no version changes - syntax man pages are fixed as suggested by M. Shimata see mail to tex-live@tug.org titled "syntax.5 has many warnings from groff" and "syntax.1 use invalid macro for mdoc" +1.17: Tue Jan 14 09:55:00 UTC 2014 +- fixed a segfault, from Sebastian Ramacher +1.17: Mon Aug 04 +- fixed a memory leak Acknowledgments: ---------------- The author received useful remarks from the pdfTeX developers, especially Hahn The Thanh, @@ -168,5 +172,5 @@ 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. -Copyright (c) 2008-2011 jerome DOT laurens AT u-bourgogne DOT fr +Copyright (c) 2008-2014 jerome DOT laurens AT u-bourgogne DOT fr |