1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: nlist.c,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
35 extern int cppgetopt(int, char *const *, const char *);
43 ER: Tabelle extra gross gemacht, da es anscheinend ein Problem mit der
44 der Verkettung gibt, irgendwann irgendwo wird mal ein nlist->next
45 ueberschrieben, was in eineme SIGSEGV resultiert.
46 Den GDB mit watchpoint hab ich aber nach 2 Tagen abgebrochen..
47 so loeppt's jedenfalls erstmal..
51 static Nlist
*nlist
[NLSIZE
];
62 { "ifdef", KIFDEF
, ISKW
},
63 { "ifndef", KIFNDEF
, ISKW
},
64 { "elif", KELIF
, ISKW
},
65 { "else", KELSE
, ISKW
},
66 { "endif", KENDIF
, ISKW
},
67 { "include", KINCLUDE
, ISKW
},
68 { "include_next", KINCLUDENEXT
, ISKW
},
69 { "import", KIMPORT
, ISKW
},
70 { "define", KDEFINE
, ISKW
},
71 { "undef", KUNDEF
, ISKW
},
72 { "line", KLINE
, ISKW
},
73 { "error", KERROR
, ISKW
},
74 { "pragma", KPRAGMA
, ISKW
},
75 { "ident", KIDENT
, ISKW
},
76 { "eval", KEVAL
, ISKW
},
77 { "defined", KDEFINED
, ISDEFINED
+ ISUNCHANGE
},
78 { "machine", KMACHINE
, ISDEFINED
+ ISUNCHANGE
},
79 { "__LINE__", KLINENO
, ISMAC
+ ISUNCHANGE
},
80 { "__FILE__", KFILE
, ISMAC
+ ISUNCHANGE
},
81 { "__DATE__", KDATE
, ISMAC
+ ISUNCHANGE
},
82 { "__TIME__", KTIME
, ISMAC
+ ISUNCHANGE
},
83 { "__STDC__", KSTDC
, ISUNCHANGE
},
87 unsigned long namebit
[077 + 1];
95 static Token deftoken
[1] = {{NAME
, 0, 0, 7, (uchar
*) "defined"}};
96 static Tokenrow deftr
= {deftoken
, deftoken
, deftoken
+ 1, 1};
98 for (kp
= kwtab
; kp
->kw
; kp
++)
100 t
.t
= (uchar
*) kp
->kw
;
101 t
.len
= strlen(kp
->kw
);
103 np
->flag
= (char) kp
->flag
;
104 np
->val
= (char) kp
->val
;
105 if (np
->val
== KDEFINED
)
116 lookup(Token
* tp
, int install
)
123 for (cp
= tp
->t
, cpe
= cp
+ tp
->len
; cp
< cpe
;)
129 if (*tp
->t
== *np
->name
&& tp
->len
== (unsigned int)np
->len
130 && strncmp((char *)tp
->t
, (char *)np
->name
, tp
->len
) == 0)
142 np
->name
= newstring(tp
->t
, tp
->len
, 0);
145 quickset(tp
->t
[0], tp
->len
> 1 ? tp
->t
[1] : 0);