diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2015-08-13 10:59:03 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2015-08-13 10:59:03 +0000 |
commit | 2d4a7ddf09618de3129cecb386faa05eab3a551f (patch) | |
tree | 0af27e2b5a5ff6d8bbd8373ca805700d5cab043c /Build/source/texk/dvipdfm-x | |
parent | e99c0ea4de186714209c6be95394fe48a720567f (diff) |
texk/dvipdfm-x: More static functions
git-svn-id: svn://tug.org/texlive/trunk@38112 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/dvipdfm-x')
-rw-r--r-- | Build/source/texk/dvipdfm-x/ChangeLog | 9 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/agl.c | 4 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/agl.h | 1 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/cmap_write.c | 14 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/dpxutil.c | 103 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/dpxutil.h | 8 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/pst_obj.c | 93 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/pst_obj.h | 5 |
8 files changed, 117 insertions, 120 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index 88d9d6159ab..c7dd5298861 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,12 @@ +2015-08-13 Peter Breitenlohner <peb@mppmu.mpg.de> + + * agl.[ch]: Declare agl_load_listfile() as static. + + * dpxutil.[ch]: Extern sputx(), getxpair(), putxpair(), + ostrtouc(), and esctouc() moved from here ... + * cmap_write.c: ... to here or ... + * pst_obj.c: ... to here as static. + 2015-08-12 Peter Breitenlohner <peb@mppmu.mpg.de> * mpost.[ch]: Extern check_for_mp() moved from here ... diff --git a/Build/source/texk/dvipdfm-x/agl.c b/Build/source/texk/dvipdfm-x/agl.c index fe9c6adfff4..3f1cc52731c 100644 --- a/Build/source/texk/dvipdfm-x/agl.c +++ b/Build/source/texk/dvipdfm-x/agl.c @@ -50,6 +50,8 @@ #include "agl.h" +static int agl_load_listfile (const char *filename, int format); + static int verbose = 0; void @@ -389,7 +391,7 @@ agl_close_map (void) #define WBUF_SIZE 1024 -int +static int agl_load_listfile (const char *filename, int is_predef) { int count = 0; diff --git a/Build/source/texk/dvipdfm-x/agl.h b/Build/source/texk/dvipdfm-x/agl.h index 12639cee997..49c7a9b8160 100644 --- a/Build/source/texk/dvipdfm-x/agl.h +++ b/Build/source/texk/dvipdfm-x/agl.h @@ -53,7 +53,6 @@ extern long agl_name_convert_unicode (const char *glyphname); extern const char *agl_suffix_to_otltag (const char *suffix); extern agl_name *agl_lookup_list (const char *glyphname); -extern int agl_load_listfile (const char *filename, int format); #if 0 extern int agl_select_listfile (const char *mapfile); diff --git a/Build/source/texk/dvipdfm-x/cmap_write.c b/Build/source/texk/dvipdfm-x/cmap_write.c index 4c1895a0aa4..c56b95fa1a1 100644 --- a/Build/source/texk/dvipdfm-x/cmap_write.c +++ b/Build/source/texk/dvipdfm-x/cmap_write.c @@ -105,6 +105,20 @@ block_count (mapDef *mtab, int c) } static int +sputx (unsigned char c, char **s, char *end) +{ + char hi = (c >> 4), lo = c & 0x0f; + + if (*s + 2 > end) + ERROR("Buffer overflow."); + **s = (hi < 10) ? hi + '0' : hi + '7'; + *(*s+1) = (lo < 10) ? lo + '0' : lo + '7'; + *s += 2; + + return 2; +} + +static int write_map (mapDef *mtab, int count, unsigned char *codestr, int depth, struct sbuf *wbuf, pdf_obj *stream) diff --git a/Build/source/texk/dvipdfm-x/dpxutil.c b/Build/source/texk/dvipdfm-x/dpxutil.c index acf318026ab..05640096af0 100644 --- a/Build/source/texk/dvipdfm-x/dpxutil.c +++ b/Build/source/texk/dvipdfm-x/dpxutil.c @@ -49,109 +49,6 @@ xtoi (char c) return -1; } -int -sputx (unsigned char c, char **s, char *end) -{ - char hi = (c >> 4), lo = c & 0x0f; - - if (*s + 2 > end) - ERROR("Buffer overflow."); - **s = (hi < 10) ? hi + '0' : hi + '7'; - *(*s+1) = (lo < 10) ? lo + '0' : lo + '7'; - *s += 2; - - return 2; -} - -int -getxpair (unsigned char **s) -{ - int hi, lo; - hi = xtoi(**s); - if (hi < 0) - return hi; - (*s)++; - lo = xtoi(**s); - if (lo < 0) - return lo; - (*s)++; - return ((hi << 4)| lo); -} - -int -putxpair (unsigned char c, char **s) -{ - char hi = (c >> 4), lo = c & 0x0f; - - **s = (hi < 10) ? hi + '0' : hi + '7'; - *(*s+1) = (lo < 10) ? lo + '0' : lo + '7'; - *s += 2; - - return 2; -} - -/* Overflowed value is set to invalid char. */ -unsigned char -ostrtouc (unsigned char **inbuf, unsigned char *inbufend, unsigned char *valid) -{ - unsigned char *cur = *inbuf; - unsigned int val = 0; - - while (cur < inbufend && cur < *inbuf + 3 && - (*cur >= '0' && *cur <= '7')) { - val = (val << 3) | (*cur - '0'); - cur++; - } - if (val > 255 || cur == *inbuf) - *valid = 0; - else - *valid = 1; - - *inbuf = cur; - return (unsigned char) val; -} - -unsigned char -esctouc (unsigned char **inbuf, unsigned char *inbufend, unsigned char *valid) -{ - unsigned char unescaped, escaped; - - escaped = **inbuf; - *valid = 1; - switch (escaped) { - /* Backslash, unbalanced paranthes */ - case '\\': case ')': case '(': - unescaped = escaped; - (*inbuf)++; - break; - /* Other escaped char */ - case 'n': unescaped = '\n'; (*inbuf)++; break; - case 'r': unescaped = '\r'; (*inbuf)++; break; - case 't': unescaped = '\t'; (*inbuf)++; break; - case 'b': unescaped = '\b'; (*inbuf)++; break; - case 'f': unescaped = '\f'; (*inbuf)++; break; - /* - * An end-of-line marker preceeded by backslash is not part of a - * literal string - */ - case '\r': - unescaped = 0; - *valid = 0; - *inbuf += (*inbuf < inbufend - 1 && *(*inbuf+1) == '\n') ? 2 : 1; - break; - case '\n': - unescaped = 0; - *valid = 0; - (*inbuf)++; - break; - /* Possibly octal notion */ - default: - unescaped = ostrtouc(inbuf, inbufend, valid); - } - - return unescaped; -} - void skip_white_spaces (unsigned char **s, unsigned char *endptr) { diff --git a/Build/source/texk/dvipdfm-x/dpxutil.h b/Build/source/texk/dvipdfm-x/dpxutil.h index f9defab88de..930bb820ec6 100644 --- a/Build/source/texk/dvipdfm-x/dpxutil.h +++ b/Build/source/texk/dvipdfm-x/dpxutil.h @@ -45,14 +45,6 @@ extern void skip_white_spaces (unsigned char **s, unsigned char *endptr); extern int xtoi (char c); -extern int getxpair (unsigned char **str); -extern int putxpair (unsigned char c, char **str); -extern int sputx (unsigned char c, char **buf, char *endptr); - -extern unsigned char ostrtouc (unsigned char **inbuf, - unsigned char *inbufend, unsigned char *valid); -extern unsigned char esctouc (unsigned char **inbuf, - unsigned char *inbufend, unsigned char *valid); #define HASH_TABLE_SIZE 503 diff --git a/Build/source/texk/dvipdfm-x/pst_obj.c b/Build/source/texk/dvipdfm-x/pst_obj.c index e082e8b3b16..f5769256590 100644 --- a/Build/source/texk/dvipdfm-x/pst_obj.c +++ b/Build/source/texk/dvipdfm-x/pst_obj.c @@ -597,7 +597,7 @@ pst_name_release (pst_name *obj) } #if 0 -int +static int pst_name_is_valid (const char *name) { static const char *valid_chars = @@ -608,7 +608,19 @@ pst_name_is_valid (const char *name) return 0; } -char * +static int +putxpair (unsigned char c, char **s) +{ + char hi = (c >> 4), lo = c & 0x0f; + + **s = (hi < 10) ? hi + '0' : hi + '7'; + *(*s+1) = (lo < 10) ? lo + '0' : lo + '7'; + *s += 2; + + return 2; +} + +static char * pst_name_encode (const char *name) { char *encoded_name, *p; @@ -638,6 +650,21 @@ pst_name_encode (const char *name) } #endif +static int +getxpair (unsigned char **s) +{ + int hi, lo; + hi = xtoi(**s); + if (hi < 0) + return hi; + (*s)++; + lo = xtoi(**s); + if (lo < 0) + return lo; + (*s)++; + return ((hi << 4)| lo); +} + pst_obj * pst_parse_name (unsigned char **inbuf, unsigned char *inbufend) /* / is required */ { @@ -760,6 +787,68 @@ pst_parse_string (unsigned char **inbuf, unsigned char *inbufend) return NULL; } +/* Overflowed value is set to invalid char. */ +static unsigned char +ostrtouc (unsigned char **inbuf, unsigned char *inbufend, unsigned char *valid) +{ + unsigned char *cur = *inbuf; + unsigned int val = 0; + + while (cur < inbufend && cur < *inbuf + 3 && + (*cur >= '0' && *cur <= '7')) { + val = (val << 3) | (*cur - '0'); + cur++; + } + if (val > 255 || cur == *inbuf) + *valid = 0; + else + *valid = 1; + + *inbuf = cur; + return (unsigned char) val; +} + +static unsigned char +esctouc (unsigned char **inbuf, unsigned char *inbufend, unsigned char *valid) +{ + unsigned char unescaped, escaped; + + escaped = **inbuf; + *valid = 1; + switch (escaped) { + /* Backslash, unbalanced paranthes */ + case '\\': case ')': case '(': + unescaped = escaped; + (*inbuf)++; + break; + /* Other escaped char */ + case 'n': unescaped = '\n'; (*inbuf)++; break; + case 'r': unescaped = '\r'; (*inbuf)++; break; + case 't': unescaped = '\t'; (*inbuf)++; break; + case 'b': unescaped = '\b'; (*inbuf)++; break; + case 'f': unescaped = '\f'; (*inbuf)++; break; + /* + * An end-of-line marker preceeded by backslash is not part of a + * literal string + */ + case '\r': + unescaped = 0; + *valid = 0; + *inbuf += (*inbuf < inbufend - 1 && *(*inbuf+1) == '\n') ? 2 : 1; + break; + case '\n': + unescaped = 0; + *valid = 0; + (*inbuf)++; + break; + /* Possibly octal notion */ + default: + unescaped = ostrtouc(inbuf, inbufend, valid); + } + + return unescaped; +} + static pst_string * pst_string_parse_literal (unsigned char **inbuf, unsigned char *inbufend) { diff --git a/Build/source/texk/dvipdfm-x/pst_obj.h b/Build/source/texk/dvipdfm-x/pst_obj.h index ccb41b60cf3..475b1cd6d5a 100644 --- a/Build/source/texk/dvipdfm-x/pst_obj.h +++ b/Build/source/texk/dvipdfm-x/pst_obj.h @@ -31,9 +31,4 @@ extern pst_obj *pst_parse_name (unsigned char **inbuf, unsigned char *inbufend extern pst_obj *pst_parse_number (unsigned char **inbuf, unsigned char *inbufend); extern pst_obj *pst_parse_string (unsigned char **inbuf, unsigned char *inbufend); -#if 0 -extern int pst_name_is_valid (const char *name); -extern char *pst_name_encode (const char *name); -#endif - #endif /* _PST_OBJ_H_ */ |