Debian Codegraph @

xo/lres.h

raw
1 /* lres.h -*- C++ -*-
2 $Id: lres.h,v 1.5 1998/10/21 21:13:57 elf Exp $
3
4 written by Marc Singer
5 15 May 1997
6
7 This file is part of the project XO. See the file README for
8 more information.
9
10 Copyright (C) 1997 Marc Singer
11
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License as
14 published by the Free Software Foundation; either version 2 of the
15 License, or (at your option) any later version.
16
17 This program is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 General Public License for more details.
21
22 You should have received a copy of the GNU General Public License
23 in a file called COPYING along with this program; if not, write to
24 the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA
25 02139, USA.
26
27 -----------
28 DESCRIPTION
29 -----------
30
31 */
32
33 #if !defined (__LRES_H__)
34 # define __LRES_H__
35
36 #if defined (IS_PARSER)
37
38 typedef struct _NODE {
39 int type;
40 struct _NODE* pNode;
41 union {
42 long l;
43 float r;
44 char* sz;
45 struct _NODE* pNode;
46 } v;
47 } NODE;
48
49 #endif
50
51 class LResNode {
52 private:
53 int m_type;
54 LResNode* m_pNode;
55 union {
56 long l;
57 float r;
58 char* sz;
59 LResNode* pNode;
60 } m_v;
61
62 static void* g_pvBase; // Base allocation for resource nodes
63 static void* g_pvAlloc; // Source for allocation of new nodes
64 static int* g_piResource; // Offset from base to root node
65
66 void _fixup (void);
67
68 public:
69
70 static void*
71 alloc (int cb, void *pv); // Allocate resource memory
72 void emit (int index);
73 LResNode*
74 enum_args (void);
75 LResNode*
76 find_resources (void);
77 static void
78 fixup (LResNode* pNode);
79 static void
80 generate (LResNode* pNode);
81 char*
82 keyword (void);
83 bool
84 is_invocation (const char* szKeyword, int id);
85 static LResNode*
86 locate (const char* szInvocation, int id);
87 LResNode* next (void) {
88 return m_pNode; }
89
90 bool integer (int* pi);
91 bool real (float* pr);
92 bool string (char** sz);
93
94 };
95
96 extern void* g_pvNodeAlloc; /* Base allocation for all NODEs */
97
98 void* alloc_resource (int cb, void* pv);
99 int safe_atol (char* sz, signed long* pl);
100 int safe_atof (char* sz, float* pr);
101
102 bool as_bool (const XrmValue& value, bool fDefault);
103
104 extern FILE* yyin;
105
106 extern "C" int yylex (void);
107 int yyparse (void);
108
109 #endif /* __LRES_H__ */