* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lex.h,v 1.28 2002/02/20 03:35:33 marka Exp $ */
+/* $Id: lex.h,v 1.29 2002/02/21 00:44:16 bwelling Exp $ */
#ifndef ISC_LEX_H
#define ISC_LEX_H 1
* Current line number or 0 if no current source.
*/
+isc_result_t
+isc_lex_setsourcename(isc_lex_t *lex, const char *name);
+/*
+ * Assigns a new name to the input source.
+ *
+ * Requires:
+ *
+ * 'lex' is a valid lexer.
+ *
+ * Returns:
+ * ISC_R_SUCCESS
+ * ISC_R_NOMEMORY
+ * ISC_R_NOTFOUND - there are no sources.
+ */
+
isc_boolean_t
isc_lex_isfile(isc_lex_t *lex);
/*
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: lex.c,v 1.72 2001/12/13 06:13:44 marka Exp $ */
+/* $Id: lex.c,v 1.73 2002/02/21 00:44:14 bwelling Exp $ */
#include <config.h>
source = HEAD(lex->sources);
if (source == NULL)
- return(NULL);
+ return (NULL);
return (source->name);
}
source = HEAD(lex->sources);
if (source == NULL)
- return(0);
+ return (0);
return (source->line);
}
+
+isc_result_t
+isc_lex_setsourcename(isc_lex_t *lex, const char *name) {
+ inputsource *source;
+ char *newname;
+
+ REQUIRE(VALID_LEX(lex));
+ source = HEAD(lex->sources);
+
+ if (source == NULL)
+ return(ISC_R_NOTFOUND);
+ newname = isc_mem_strdup(lex->mctx, name);
+ if (newname == NULL)
+ return (ISC_R_NOMEMORY);
+ isc_mem_free(lex->mctx, source->name);
+ source->name = newname;
+ return (ISC_R_SUCCESS);
+}
+
isc_boolean_t
isc_lex_isfile(isc_lex_t *lex) {
inputsource *source;