Main Page | Modules | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

dfa_lookup.c

Go to the documentation of this file.
00001 
00023 /*
00024  * Copyright (c) 1991-2006 Kawahara Lab., Kyoto University
00025  * Copyright (c) 2000-2005 Shikano Lab., Nara Institute of Science and Technology
00026  * Copyright (c) 2005-2006 Julius project team, Nagoya Institute of Technology, Nagoya Institute of Technology
00027  * All rights reserved
00028  */
00029 
00030 #include <sent/stddefs.h>
00031 #include <sent/dfa.h>
00032 #include <ctype.h>
00033 
00043 WORD_ID
00044 dfa_symbol_lookup(DFA_INFO *dinfo, char *terminalname)
00045 {
00046   WORD_ID id;
00047   int c;
00048   char *p;
00049 
00050   /* check if terminal name is digit */
00051   for(p=terminalname;*p!='\0';p++) {
00052     c = *p;
00053     if (! isdigit(c)) {
00054       j_printerr("Error: wrong format: terminal number is not digit in dict! [%s]\n", terminalname);
00055       return(WORD_INVALID);
00056     }
00057   }
00058 
00059   /* Currently, terminal ID is already assigned by mkdfa in wname,
00060      so this function only returns the ID */
00061   id = atoi(terminalname);
00062   if (id >= dinfo->term_num) return(WORD_INVALID); /* error */
00063   else return(id);
00064 }

Generated on Tue Mar 28 16:01:39 2006 for Julius by  doxygen 1.4.2