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: paramu.c /main/3 1995/11/08 11:07:11 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 /* Paramu.c contains functions for programs ELTDEF and PARSER
31 relevant to checking parameter values. */
33 /* Check to see if string is a valid value for parameter par. If so
34 return a pointer to the keyword if it's a keyword parameter and otherwise
35 a pointer to string. If not valid, return FALSE. */
37 const M_WCHAR *m_partype(const int par , const M_WCHAR *string )
39 M_WCHAR *m_partype(par, string)
44 LOGICAL first = TRUE ;
46 const M_WCHAR *p = string ;
49 if (m_parameter[par - 1].type == M_KEYWORD) {
50 for (kw = m_parameter[par - 1].kwlist ; kw ; kw = m_ptype[kw - 1].next)
51 if (! m_wcupstrcmp(&m_keyword[m_ptype[kw - 1].keyword], string))
52 return(&m_keyword[m_ptype[kw - 1].keyword]) ;
55 if (m_parameter[par - 1].type == M_CDATT) return(string) ;
56 if (! *string) return(FALSE) ;
57 if (m_allwhite(string)) return(FALSE) ;
60 switch (m_cttype(*p)) {
62 switch (m_parameter[par - 1].type) {
73 if (! m_whitespace(*p)) return(FALSE) ;
79 if (len > M_NAMELEN) return(FALSE) ;
80 if (m_parameter[par - 1].type == M_NUMBER ||
81 m_parameter[par - 1].type == M_NUMS) return(FALSE) ;
86 if (len > M_NAMELEN) return(FALSE) ;
87 switch (m_parameter[par - 1].type) {
94 if (first) return(FALSE) ;
104 if (first) return(FALSE) ;
107 m_error("Undefined parameter type") ;
113 if (len > M_NAMELEN) return(FALSE) ;
114 switch (m_parameter[par - 1].type) {
121 if (first) return(FALSE) ;
133 m_error("Undefined parameter type") ;
138 m_error("Undefined character type") ;
141 if (m_parameter[par - 1].type == M_ENTATT) {
142 if ((M_ENTITY *) m_lookfortrie(string, m_enttrie))