texlive[46717] Build/source/texk/makejvf: makejvf: improved usertable

commits+hironobu at tug.org commits+hironobu at tug.org
Fri Feb 23 15:38:56 CET 2018


Revision: 46717
          http://tug.org/svn/texlive?view=revision&revision=46717
Author:   hironobu
Date:     2018-02-23 15:38:56 +0100 (Fri, 23 Feb 2018)
Log Message:
-----------
makejvf: improved usertable parsing

Modified Paths:
--------------
    trunk/Build/source/texk/makejvf/ChangeLog
    trunk/Build/source/texk/makejvf/usrtable.c
    trunk/Build/source/texk/makejvf/version.h

Modified: trunk/Build/source/texk/makejvf/ChangeLog
===================================================================
--- trunk/Build/source/texk/makejvf/ChangeLog	2018-02-23 08:35:57 UTC (rev 46716)
+++ trunk/Build/source/texk/makejvf/ChangeLog	2018-02-23 14:38:56 UTC (rev 46717)
@@ -1,3 +1,9 @@
+2018-02-23  Hironobu Yamashita  <h.y.acetaminophen at 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 at gmail.com>
 
 	* write.c: Add U+301E.

Modified: trunk/Build/source/texk/makejvf/usrtable.c
===================================================================
--- trunk/Build/source/texk/makejvf/usrtable.c	2018-02-23 08:35:57 UTC (rev 46716)
+++ trunk/Build/source/texk/makejvf/usrtable.c	2018-02-23 14:38:56 UTC (rev 46717)
@@ -30,9 +30,13 @@
 	}
 	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 @@
 			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 @@
 					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 @@
 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);
 }
 
 

Modified: trunk/Build/source/texk/makejvf/version.h
===================================================================
--- trunk/Build/source/texk/makejvf/version.h	2018-02-23 08:35:57 UTC (rev 46716)
+++ trunk/Build/source/texk/makejvf/version.h	2018-02-23 14:38:56 UTC (rev 46717)
@@ -1,2 +1,2 @@
-#define VERSION "20180217"
+#define VERSION "20180223"
 #define BUG_ADDRESS "issue at texjp.org"



More information about the tex-live-commits mailing list