2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
6 * These libraries and programs are free software; you can
7 * redistribute them and/or modify them under the terms of the GNU
8 * Lesser General Public License as published by the Free Software
9 * Foundation; either version 2 of the License, or (at your option)
12 * These libraries and programs are distributed in the hope that
13 * they will be useful, but WITHOUT ANY WARRANTY; without even the
14 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15 * PURPOSE. See the GNU Lesser General Public License for more
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with these librararies and programs; if not, write
20 * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21 * Floor, Boston, MA 02110-1301 USA
23 /* $XConsortium: scan.c /main/3 1995/11/08 10:45:35 rswiston $ */
25 Copyright 1986 Tandem Computers Incorporated.
26 This product and information is proprietary of Tandem Computers Incorporated.
27 Copyright (c) 1986, 1987, 1988, 1989 Hewlett-Packard Co.
30 /* Scan.c contains scanner procedures for program ELTDEF */
48 /* Reads a name token */
58 cname = (LOGICAL) (curcon == INPARAM || curcon == INVALUE);
59 *(p = name) = (M_WCHAR) first;
60 if (! cname) *p = m_ctupper(*p);
66 cttype = m_cttype(*p);
69 if (cttype == M_NONNAME) break;
73 if ((cttype != M_NMSTART) && (cttype != M_DIGIT) && (*p != wus))
76 if (p >= name + M_NAMELEN)
78 *(name + M_NAMELEN) = M_EOS;
79 m_error("Element name too long");
81 if (! cname) *p = m_ctupper(*p);
87 /* Reads the next token and returns it to the main procedure */
92 static char unexp[] = "c";
99 while ((n = gettoken(&c, COMCON)) == STARTCOMMENT)
100 while ((n = gettoken(&c, INCOM)) != ENDCOMMENT)
103 m_error("EOF occurred within comment");
108 n = gettoken(&c, curcon);
111 if (n != LIT && n != LITA) return(n);
118 mbyte = MakeMByteString(literal);
119 printf("literal '%s'\n", mbyte);
120 m_free(mbyte, "multi-byte string");
125 if (c == EOF) return(ENDFILE);
126 if (m_newcon(curcon - 1, TEXT - 1))
128 textchar = (M_WCHAR) c;
131 if (m_whitespace((M_WCHAR) c)) continue;
132 if (m_newcon(curcon - 1, NAME - 1))
134 if (curcon == INPARAM || curcon == INVALUE)
136 /* Check for C identifier */
137 if (m_letter((M_WCHAR) c) || c == wus)
145 /* Check for SGML name */
146 if ((m_cttype(c) == M_NMSTART) ||
147 (m_cttype(c) != M_NONNAME && curcon == VALUE))
156 m_mberr1("Unexpected character: '%s'", unexp);
161 #include "scanutil.c"