]>
git.saurik.com Git - apple/security.git/blob - SecuritySNACCRuntime/compiler/back-ends/c-gen/kwd2.c
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
20 * compiler/back-ends/c-gen/kwd.c - routines for determining whether a given str is a C keyword
22 * NOTE: this was hacked up really quickly. It uses a slow linear
23 * search. A much better approach is to use a hash tbl.
26 * Copyright (C) 1991, 1992 Michael Sample
27 * and the University of British Columbia
29 * This program is free software; you can redistribute it and/or modify
30 * it under the terms of the GNU General Public License as published by
31 * the Free Software Foundation; either version 2 of the License, or
32 * (at your option) any later version.
34 * $Header: /cvs/Darwin/src/live/Security/SecuritySNACCRuntime/compiler/back-ends/c-gen/kwd2.c,v 1.1.1.1 2001/05/18 23:14:09 mb Exp $
36 * Revision 1.1.1.1 2001/05/18 23:14:09 mb
37 * Move from private repository to open source repository
39 * Revision 1.2 2001/05/05 00:59:28 rmurphy
40 * Adding darwin license headers
42 * Revision 1.1.1.1 1999/03/16 18:06:43 aram
43 * Originals from SMIME Free Library.
45 * Revision 1.4 1995/07/25 18:45:38 rj
46 * file name has been shortened for redundant part: c-gen/c-kwd -> c-gen/kwd.
48 * Revision 1.3 1994/10/08 03:48:06 rj
49 * since i was still irritated by cpp standing for c++ and not the C preprocessor, i renamed them to cxx (which is one known suffix for C++ source files). since the standard #define is __cplusplus, cplusplus would have been the more obvious choice, but it is a little too long.
51 * Revision 1.2 1994/09/01 00:20:28 rj
52 * snacc_config.h removed; more portable .h file inclusion.
54 * Revision 1.1 1994/08/28 09:48:13 rj
55 * first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
61 #if STDC_HEADERS || HAVE_STRING_H
70 * last elmt must be NULL.
71 * key words grabbed from K&R 2nd Ed
73 static char * cKWdG
[] =
75 "auto" , "break" , "case" , "char" , "const" , "continue" ,
76 "default" , "do" , "double" , "else" , "enum" , "extern" ,
77 "float" , "for" , "goto" , "if" , "int" , "long" , "register" ,
78 "return" , "short" , "signed" , "sizeof" , "static" , "struct" ,
79 "switch" , "typedef" , "union" , "unsigned" , "void" , "volatile" ,
85 * returns non-zero if the given str is a C key word
88 IsCKeyWord
PARAMS (( str
),
93 for ( i
= 0 ; ( cKWdG
[ i
] != NULL
) && ( strcmp ( cKWdG
[ i
], str
) != 0 ); i
++)
96 return cKWdG
[ i
] != NULL
;