[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6215] parsetexi printindex argument checking
From: |
Gavin D. Smith |
Subject: |
[6215] parsetexi printindex argument checking |
Date: |
Thu, 09 Apr 2015 17:40:36 +0000 |
Revision: 6215
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6215
Author: gavin
Date: 2015-04-09 17:40:36 +0000 (Thu, 09 Apr 2015)
Log Message:
-----------
parsetexi printindex argument checking
Modified Paths:
--------------
trunk/parsetexi/end_line.c
trunk/parsetexi/parser.c
Modified: trunk/parsetexi/end_line.c
===================================================================
--- trunk/parsetexi/end_line.c 2015-04-09 17:09:17 UTC (rev 6214)
+++ trunk/parsetexi/end_line.c 2015-04-09 17:40:36 UTC (rev 6215)
@@ -430,10 +430,35 @@
free (from); free (to);
break;
}
- case CM_printindex:
+ case CM_printindex: // 5641
{
- /* TODO */
- ADD_ARG (line);
+ char *arg;
+ char *p = line;
+ arg = read_command_name (&p);
+ if (!arg || *p)
+ line_errorf ("bad argument to @printindex: %s", line);
+ else
+ {
+ INDEX *idx = index_by_name (arg);
+ if (!idx)
+ line_errorf ("unknown index `%s' in @printindex", arg);
+ else
+ {
+ // 5650
+ if (idx->merged_in)
+ line_warnf
+ ("printing an index `%s' merged in another one, `%s'",
+ arg, idx->merged_in->name);
+ if (!current_node && !current_section)
+ // TODO && nothing on regions stack?
+ {
+ line_warnf ("printindex before document beginning: "
+ "@printindex %s", arg);
+ }
+ ADD_ARG (arg);
+ }
+ }
+ free (arg);
break;
}
case CM_everyheadingmarks:
Modified: trunk/parsetexi/parser.c
===================================================================
--- trunk/parsetexi/parser.c 2015-04-09 17:09:17 UTC (rev 6214)
+++ trunk/parsetexi/parser.c 2015-04-09 17:40:36 UTC (rev 6215)
@@ -49,8 +49,10 @@
return !strncmp (s1, s2, strlen (s2));
}
-/* Return value to be freed by caller. *PTR is advanced past the read name.
- Return 0 if name is invalid. */
+/* Look for a sequence of alphanumeric characters or hyphens, where the
+ first isn't a hyphen. This is the format of (non-single-character) Texinfo
+ commands, but is also used elsewhere. Return value to be freed by caller.
+ *PTR is advanced past the read name. Return 0 if name is invalid. */
// 4161
char *
read_command_name (char **ptr)
@@ -58,8 +60,6 @@
char *p = *ptr, *q;
char *ret = 0;
- /* Look for a sequence of alphanumeric characters or hyphens, where the
- first isn't a hyphen. */
q = p;
if (!isalnum (*q))
return 0; /* Invalid. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6215] parsetexi printindex argument checking,
Gavin D. Smith <=