diff options
author | Hironobu Yamashita <h.y.acetaminophen@gmail.com> | 2018-02-23 14:38:56 +0000 |
---|---|---|
committer | Hironobu Yamashita <h.y.acetaminophen@gmail.com> | 2018-02-23 14:38:56 +0000 |
commit | bb1c58eb06781bc65d02648c6d9c47e1c9e0acdf (patch) | |
tree | 361d57ba5bb92c889ac26b8a999414322d261ac3 | |
parent | 43a4e3304666da0835bc8e28676111ed8e1308d3 (diff) |
makejvf: improved usertable parsing
git-svn-id: svn://tug.org/texlive/trunk@46717 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/makejvf/ChangeLog | 6 | ||||
-rw-r--r-- | Build/source/texk/makejvf/usrtable.c | 16 | ||||
-rw-r--r-- | Build/source/texk/makejvf/version.h | 2 |
3 files changed, 19 insertions, 5 deletions
diff --git a/Build/source/texk/makejvf/ChangeLog b/Build/source/texk/makejvf/ChangeLog index 533337ae591..0f1fda86b56 100644 --- a/Build/source/texk/makejvf/ChangeLog +++ b/Build/source/texk/makejvf/ChangeLog @@ -1,3 +1,9 @@ +2018-02-23 Hironobu Yamashita <h.y.acetaminophen@gmail.com> + + * usrtable.c: Initialize CHARSET flag at other commands or an + empty line. Make an error message more clear. + * version.h: Bump version. + 2018-02-17 Hironobu Yamashita <h.y.acetaminophen@gmail.com> * write.c: Add U+301E. diff --git a/Build/source/texk/makejvf/usrtable.c b/Build/source/texk/makejvf/usrtable.c index 54311eaa9b6..13c9e2d6917 100644 --- a/Build/source/texk/makejvf/usrtable.c +++ b/Build/source/texk/makejvf/usrtable.c @@ -30,9 +30,13 @@ void get_usertable(char *name) } for (l = 0; fgets(buf, BUF_SIZE, fp) != NULL; l++) { if ((endptr=strchr(buf, '%')) != NULL) strcpy(endptr,"\n"); /* ignore after '%' */ - if (!strncmp(buf, "\n", 1)) continue; /* ignore empty line */ + if (!strncmp(buf, "\n", 1)) { /* empty line */ + charset_mode = 0; + continue; + } tok = strtok(buf, "\t"); if (!strcmp(tok, "REPLACE")) { + charset_mode = 0; if (usertable_replace_max >= MAX_TABLE) goto buferr; usertable_replace[usertable_replace_max].codepoint = strtol(strtok(NULL, "\t\n"), &endptr, 16); if (*endptr != '\0') goto taberr; @@ -43,6 +47,7 @@ void get_usertable(char *name) continue; } if (!strcmp(tok, "MOVE")) { + charset_mode = 0; if (usertable_move_max >= MAX_TABLE) goto buferr; usertable_move[usertable_move_max].codepoint = strtol(strtok(NULL, "\t\n"), &endptr, 16); if (*endptr != '\0') goto taberr; @@ -62,13 +67,13 @@ void get_usertable(char *name) if (sscanf(tok, "%7s",str0) != 1) goto taberr; if (sscanf(endptr+2,"%7s",str1) != 1) goto taberr; ch0 = strtol(str0, &endptr, 16); - if (*endptr != '\0' || ch0<=char_max) goto taberr; + if (*endptr != '\0' || ch0<=char_max) goto codeerr; ch1 = strtol(str1, &endptr, 16); - if (*endptr != '\0' || ch1<=ch0) goto taberr; + if (*endptr != '\0' || ch1<=ch0) goto codeerr; } else { if (sscanf(tok,"%7s",str0) != 1) goto taberr; ch0 = strtol(str0, &endptr, 16); - if (*endptr != '\0' || ch0<=char_max) goto taberr; + if (*endptr != '\0' || ch0<=char_max) goto codeerr; ch1 = ch0; } if (char_max==ch0-1) { @@ -94,6 +99,9 @@ taberr: buferr: fprintf(stderr, "User-defined table in %s is too large!\n", name); exit(1); +codeerr: + fprintf(stderr, "Character codes must be given in ascending order (line %d)!\n", l+1); + exit(1); } diff --git a/Build/source/texk/makejvf/version.h b/Build/source/texk/makejvf/version.h index 1f66fb935e7..fc5cc7d9835 100644 --- a/Build/source/texk/makejvf/version.h +++ b/Build/source/texk/makejvf/version.h @@ -1,2 +1,2 @@ -#define VERSION "20180217" +#define VERSION "20180223" #define BUG_ADDRESS "issue@texjp.org" |