diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-05-06 07:34:34 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2014-05-06 07:34:34 +0000 |
commit | 526582da8c8fabccfebea407a9da54822daa4f88 (patch) | |
tree | 6a43246601863a43f773d3ac3f3228223f52958a | |
parent | dab66ac6e4a0df1662c67937c13535fcbd1148b3 (diff) |
pdfTeX, e-(u)pTeX: Slightly reorganize to avoid duplicat code
git-svn-id: svn://tug.org/texlive/trunk@33876 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/web2c/ChangeLog | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/eptexdir/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/eptexdir/eptexextra.c | 55 | ||||
-rw-r--r-- | Build/source/texk/web2c/euptexdir/ChangeLog | 4 | ||||
-rw-r--r-- | Build/source/texk/web2c/euptexdir/euptexextra.c | 55 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/ChangeLog | 6 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/texmfmp.c | 55 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/ChangeLog | 8 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/ptexlib.h | 1 | ||||
-rw-r--r-- | Build/source/texk/web2c/pdftexdir/utils.c | 55 | ||||
-rw-r--r-- | Build/source/texk/web2c/ptexdir/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/ptexdir/kanji.h | 1 | ||||
-rw-r--r-- | Build/source/texk/web2c/texmfmp.h | 1 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/uptexdir/kanji.h | 1 |
15 files changed, 81 insertions, 182 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog index f9315f17785..b8aa2a77231 100644 --- a/Build/source/texk/web2c/ChangeLog +++ b/Build/source/texk/web2c/ChangeLog @@ -1,3 +1,9 @@ +2014-05-06 Peter Breitenlohner <peb@mppmu.mpg.de> + + Update to e-pTeX and e-upTeX from Akira Kakuto. + * texmfmp.h (getfiledump): Move declaration from + pdftexdir/ptexlib.h to here. + 2014-05-05 Peter Breitenlohner <peb@mppmu.mpg.de> * dvicopy.ch, dvicopy.web: Fixed a non-Web2C bug and several diff --git a/Build/source/texk/web2c/eptexdir/ChangeLog b/Build/source/texk/web2c/eptexdir/ChangeLog index 8326d308181..436bc76ce11 100644 --- a/Build/source/texk/web2c/eptexdir/ChangeLog +++ b/Build/source/texk/web2c/eptexdir/ChangeLog @@ -1,7 +1,8 @@ 2014-05-05 Akira Kakuto <kakuto@fuk.kindai.ac.jp> +2014-05-06 Peter Breitenlohner <peb@mppmu.mpg.de> - * pdfutils.ch, eptexextra.c, and eptex.defines: Add a primitive - \pdffiledump for eptex. + * pdfutils.ch, eptex.defines: Add a primitive \pdffiledump for + eptex. 2014-05-02 Peter Breitenlohner <peb@mppmu.mpg.de> diff --git a/Build/source/texk/web2c/eptexdir/eptexextra.c b/Build/source/texk/web2c/eptexdir/eptexextra.c index 22a72b9fad9..c60bb42922a 100644 --- a/Build/source/texk/web2c/eptexdir/eptexextra.c +++ b/Build/source/texk/web2c/eptexdir/eptexextra.c @@ -10,58 +10,3 @@ /* Hand-coded routines for TeX or Metafont in C. */ #include <lib/texmfmp.c> - -void getfiledump(int s, int offset, int length) -{ - FILE *f; - int read, i; - poolpointer data_ptr; - poolpointer data_end; - char *file_name; - - if (length == 0) { - /* empty result string */ - return; - } - - if (poolptr + 2 * length + 1 >= poolsize) { - /* no place for result */ - poolptr = poolsize; - /* error by str_toks that calls str_room(1) */ - return; - } - - file_name = kpse_find_tex(makecfilename(s)); - if (file_name == NULL) { - return; /* empty string */ - } - - /* read file data */ - f = fopen(file_name, FOPEN_RBIN_MODE); - if (f == NULL) { - xfree(file_name); - return; - } - recorder_record_input(file_name); - if (fseek(f, offset, SEEK_SET) != 0) { - xfree(file_name); - return; - } - /* there is enough space in the string pool, the read - data are put in the upper half of the result, thus - the conversion to hex can be done without overwriting - unconverted bytes. */ - data_ptr = poolptr + length; - read = fread(&strpool[data_ptr], sizeof(char), length, f); - fclose(f); - - /* convert to hex */ - data_end = data_ptr + read; - for (; data_ptr < data_end; data_ptr++) { - i = snprintf((char *) &strpool[poolptr], 3, - "%.2X", (unsigned int) strpool[data_ptr]); - check_nprintf(i, 3); - poolptr += i; - } - xfree(file_name); -} diff --git a/Build/source/texk/web2c/euptexdir/ChangeLog b/Build/source/texk/web2c/euptexdir/ChangeLog index 0c1d747a896..eadc5cfd32d 100644 --- a/Build/source/texk/web2c/euptexdir/ChangeLog +++ b/Build/source/texk/web2c/euptexdir/ChangeLog @@ -1,7 +1,7 @@ 2014-05-05 Akira Kakuto <kakuto@fuk.kindai.ac.jp> +2014-05-06 Peter Breitenlohner <peb@mppmu.mpg.de> - * euptex.defines, and euptexextra.c: Add a primitive \pdffiledump - for euptex. + * euptex.defines: Add a primitive \pdffiledump for euptex. 2014-05-02 Peter Breitenlohner <peb@mppmu.mpg.de> diff --git a/Build/source/texk/web2c/euptexdir/euptexextra.c b/Build/source/texk/web2c/euptexdir/euptexextra.c index 64781efff0b..1497c967625 100644 --- a/Build/source/texk/web2c/euptexdir/euptexextra.c +++ b/Build/source/texk/web2c/euptexdir/euptexextra.c @@ -10,58 +10,3 @@ /* Hand-coded routines for TeX or Metafont in C. */ #include <lib/texmfmp.c> - -void getfiledump(int s, int offset, int length) -{ - FILE *f; - int read, i; - poolpointer data_ptr; - poolpointer data_end; - char *file_name; - - if (length == 0) { - /* empty result string */ - return; - } - - if (poolptr + 2 * length + 1 >= poolsize) { - /* no place for result */ - poolptr = poolsize; - /* error by str_toks that calls str_room(1) */ - return; - } - - file_name = kpse_find_tex(makecfilename(s)); - if (file_name == NULL) { - return; /* empty string */ - } - - /* read file data */ - f = fopen(file_name, FOPEN_RBIN_MODE); - if (f == NULL) { - xfree(file_name); - return; - } - recorder_record_input(file_name); - if (fseek(f, offset, SEEK_SET) != 0) { - xfree(file_name); - return; - } - /* there is enough space in the string pool, the read - data are put in the upper half of the result, thus - the conversion to hex can be done without overwriting - unconverted bytes. */ - data_ptr = poolptr + length; - read = fread(&strpool[data_ptr], sizeof(char), length, f); - fclose(f); - - /* convert to hex */ - data_end = data_ptr + read; - for (; data_ptr < data_end; data_ptr++) { - i = snprintf((char *) &strpool[poolptr], 3, - "%.2X", (unsigned int) strpool[data_ptr]); - check_nprintf(i, 3); - poolptr += i; - } - xfree(file_name); -} diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog index 26ff9fcb5d7..6b208404b3e 100644 --- a/Build/source/texk/web2c/lib/ChangeLog +++ b/Build/source/texk/web2c/lib/ChangeLog @@ -1,3 +1,9 @@ +2014-05-06 Peter Breitenlohner <peb@mppmu.mpg.de> + + Update to e-pTeX and e-upTeX from Akira Kakuto. + * texmfmp.c (getfiledump): Move definition of this function + also used by e-(u)pTeX from ../pdftexdir/utils.c to here. + 2014-01-20 Akira Kakuto <kakuto@fuk.kinidai.ac.jp> * printversion.c: 2013 ---> 2014. diff --git a/Build/source/texk/web2c/lib/texmfmp.c b/Build/source/texk/web2c/lib/texmfmp.c index e45e8446d01..d6cdb401136 100644 --- a/Build/source/texk/web2c/lib/texmfmp.c +++ b/Build/source/texk/web2c/lib/texmfmp.c @@ -2990,6 +2990,61 @@ void getfilesize(integer s) xfree(file_name); } + +void getfiledump(integer s, int offset, int length) +{ + FILE *f; + int read, i; + poolpointer data_ptr; + poolpointer data_end; + char *file_name; + + if (length == 0) { + /* empty result string */ + return; + } + + if (poolptr + 2 * length + 1 >= poolsize) { + /* no place for result */ + poolptr = poolsize; + /* error by str_toks that calls str_room(1) */ + return; + } + + file_name = kpse_find_tex(makecfilename(s)); + if (file_name == NULL) { + return; /* empty string */ + } + + /* read file data */ + f = fopen(file_name, FOPEN_RBIN_MODE); + if (f == NULL) { + xfree(file_name); + return; + } + recorder_record_input(file_name); + if (fseek(f, offset, SEEK_SET) != 0) { + xfree(file_name); + return; + } + /* there is enough space in the string pool, the read + data are put in the upper half of the result, thus + the conversion to hex can be done without overwriting + unconverted bytes. */ + data_ptr = poolptr + length; + read = fread(&strpool[data_ptr], sizeof(char), length, f); + fclose(f); + + /* convert to hex */ + data_end = data_ptr + read; + for (; data_ptr < data_end; data_ptr++) { + i = snprintf((char *) &strpool[poolptr], 3, + "%.2X", (unsigned int) strpool[data_ptr]); + check_nprintf(i, 3); + poolptr += i; + } + xfree(file_name); +} #endif /* e-pTeX or e-upTeX */ #endif /* TeX */ diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog index 3b287c45fd7..e00f8e182a8 100644 --- a/Build/source/texk/web2c/pdftexdir/ChangeLog +++ b/Build/source/texk/web2c/pdftexdir/ChangeLog @@ -1,3 +1,11 @@ +2014-05-06 Peter Breitenlohner <peb@mppmu.mpg.de> + + Update to e-pTeX and e-upTeX from Akira Kakuto. + * ptexlib.h (getfiledump): Move declaration also used by + e-(u)pTeX from here to ../texmfmp.h. + * utils.c (getfiledump): Move definition also used by + e-(u)pTeX from here to ../lib/texmfmp.c. + 2014-03-18 Akira Kakuto <kakuto@fuk.kindai.ac.jp> * pdftex.web and writefont.c: Import from r704. diff --git a/Build/source/texk/web2c/pdftexdir/ptexlib.h b/Build/source/texk/web2c/pdftexdir/ptexlib.h index b79c98147ef..c4581b5fa20 100644 --- a/Build/source/texk/web2c/pdftexdir/ptexlib.h +++ b/Build/source/texk/web2c/pdftexdir/ptexlib.h @@ -220,7 +220,6 @@ extern void escapestring(poolpointer in); extern void escapehex(poolpointer in); extern void unescapehex(poolpointer in); extern void getmd5sum(strnumber s, boolean file); -extern void getfiledump(strnumber s, int offset, int length); extern void matchstrings(strnumber s, strnumber t, int subcount, boolean icase); extern void getmatch(int i); extern void makepdftexbanner(void); diff --git a/Build/source/texk/web2c/pdftexdir/utils.c b/Build/source/texk/web2c/pdftexdir/utils.c index 70d504d3502..02352fefece 100644 --- a/Build/source/texk/web2c/pdftexdir/utils.c +++ b/Build/source/texk/web2c/pdftexdir/utils.c @@ -878,61 +878,6 @@ void getmd5sum(strnumber s, boolean file) poolptr += len; } -void getfiledump(strnumber s, int offset, int length) -{ - FILE *f; - int read, i; - poolpointer data_ptr; - poolpointer data_end; - char *file_name; - - if (length == 0) { - /* empty result string */ - return; - } - - if (poolptr + 2 * length + 1 >= poolsize) { - /* no place for result */ - poolptr = poolsize; - /* error by str_toks that calls str_room(1) */ - return; - } - - file_name = kpse_find_tex(makecfilename(s)); - if (file_name == NULL) { - return; /* empty string */ - } - - /* read file data */ - f = fopen(file_name, FOPEN_RBIN_MODE); - if (f == NULL) { - xfree(file_name); - return; - } - recorder_record_input(file_name); - if (fseek(f, offset, SEEK_SET) != 0) { - xfree(file_name); - return; - } - /* there is enough space in the string pool, the read - data are put in the upper half of the result, thus - the conversion to hex can be done without overwriting - unconverted bytes. */ - data_ptr = poolptr + length; - read = fread(&strpool[data_ptr], sizeof(char), length, f); - fclose(f); - - /* convert to hex */ - data_end = data_ptr + read; - for (; data_ptr < data_end; data_ptr++) { - i = snprintf((char *) &strpool[poolptr], 3, - "%.2X", (unsigned int) strpool[data_ptr]); - check_nprintf(i, 3); - poolptr += i; - } - xfree(file_name); -} - #define DEFAULT_SUB_MATCH_COUNT 10 static int sub_match_count = DEFAULT_SUB_MATCH_COUNT; static regmatch_t *pmatch = NULL; diff --git a/Build/source/texk/web2c/ptexdir/ChangeLog b/Build/source/texk/web2c/ptexdir/ChangeLog index bd9aad93264..1b13f882cf9 100644 --- a/Build/source/texk/web2c/ptexdir/ChangeLog +++ b/Build/source/texk/web2c/ptexdir/ChangeLog @@ -1,8 +1,3 @@ -2014-05-05 Akira Kakuto <kakuto@fuk.kindai.ac.jp> - - * kanji.h: declare getfiledump() to add a primitive \pdffiledump - for eptex. - 2014-05-02 Peter Breitenlohner <peb@mppmu.mpg.de> * ptrip/ptrip.diffs: Updated for TL14. diff --git a/Build/source/texk/web2c/ptexdir/kanji.h b/Build/source/texk/web2c/ptexdir/kanji.h index d0492e55148..75482fe4cca 100644 --- a/Build/source/texk/web2c/ptexdir/kanji.h +++ b/Build/source/texk/web2c/ptexdir/kanji.h @@ -9,7 +9,6 @@ #include <ptexenc/unicode.h> #define getintone(w) ((w).cint1) #define setintone(w,a) ((w).cint1=(a)) -void getfiledump(int s, int offset, int length); #endif #ifndef KANJI diff --git a/Build/source/texk/web2c/texmfmp.h b/Build/source/texk/web2c/texmfmp.h index 422fc5d4421..5f210ebbc6c 100644 --- a/Build/source/texk/web2c/texmfmp.h +++ b/Build/source/texk/web2c/texmfmp.h @@ -121,6 +121,7 @@ extern char *makecfilename(integer s); extern void getcreationdate(void); extern void getfilemoddate(integer s); extern void getfilesize(integer s); +extern void getfiledump(integer s, int offset, int length); #endif /* pdftex etc. except for tex use these for pipe support */ diff --git a/Build/source/texk/web2c/uptexdir/ChangeLog b/Build/source/texk/web2c/uptexdir/ChangeLog index 2b75f2d46ea..bae45919502 100644 --- a/Build/source/texk/web2c/uptexdir/ChangeLog +++ b/Build/source/texk/web2c/uptexdir/ChangeLog @@ -1,8 +1,3 @@ -2014-05-05 Akira Kakuto <kakuto@fuk.kindai.ac.jp> - - * kanji.h: declare getfiledump() to add a primitive \pdffiledump - for euptex. - 2014-05-02 Peter Breitenlohner <peb@mppmu.mpg.de> * uptrip/uptrip.diffs: Updated for TL14. diff --git a/Build/source/texk/web2c/uptexdir/kanji.h b/Build/source/texk/web2c/uptexdir/kanji.h index d6ae13af94f..a00f41d9eff 100644 --- a/Build/source/texk/web2c/uptexdir/kanji.h +++ b/Build/source/texk/web2c/uptexdir/kanji.h @@ -9,7 +9,6 @@ #ifdef eupTeX #define getintone(w) ((w).cint1) #define setintone(w,a) ((w).cint1=(a)) -void getfiledump(int s, int offset, int length); #endif #ifndef KANJI |