Commit | Line | Data |
---|---|---|
15637ed4 RG |
1 | // This may look like C code, but it is really -*- C++ -*- |
2 | /* | |
3 | Copyright (C) 1988 Free Software Foundation | |
4 | written by Doug Lea (dl@rocky.oswego.edu) | |
5 | ||
6 | This file is part of GNU CC. | |
7 | ||
8 | GNU CC is distributed in the hope that it will be useful, | |
9 | but WITHOUT ANY WARRANTY. No author or distributor | |
10 | accepts responsibility to anyone for the consequences of using it | |
11 | or for whether it serves any particular purpose or works at all, | |
12 | unless he says so in writing. Refer to the GNU CC General Public | |
13 | License for full details. | |
14 | ||
15 | Everyone is granted permission to copy, modify and redistribute | |
16 | GNU CC, but only under the conditions described in the | |
17 | GNU CC General Public License. A copy of this license is | |
18 | supposed to have been given to you along with GNU CC so you | |
19 | can know your rights and responsibilities. It should be in a | |
20 | file named COPYING. Among other things, the copyright notice | |
21 | and this notice must be preserved on all copies. | |
22 | */ | |
23 | ||
24 | #ifndef generic_h | |
25 | #ifdef __GNUG__ | |
26 | #pragma once | |
27 | #pragma interface | |
28 | #endif | |
29 | #define generic_h 1 | |
30 | ||
31 | /* | |
32 | * See the CPP manual, argument prescan section for explanation | |
33 | */ | |
34 | ||
35 | #define name2(a,b) gEnErIc2(a,b) | |
36 | #define gEnErIc2(a,b) a ## b | |
37 | ||
38 | #define name3(a,b,c) gEnErIc3(a,b,c) | |
39 | #define gEnErIc3(a,b,c) a ## b ## c | |
40 | ||
41 | #define name4(a,b,c,d) gEnErIc4(a,b,c,d) | |
42 | #define gEnErIc4(a,b,c,d) a ## b ## c ## d | |
43 | ||
44 | #define GENERIC_STRING(a) gEnErIcStRiNg(a) | |
45 | #define gEnErIcStRiNg(a) #a | |
46 | ||
47 | #define declare(clas,t) name2(clas,declare)(t) | |
48 | #define declare2(clas,t1,t2) name2(clas,declare2)(t1,t2) | |
49 | ||
50 | #define implement(clas,t) name2(clas,implement)(t) | |
51 | #define implement2(clas,t1,t2) name2(clas,implement2)(t1,t2) | |
52 | ||
53 | extern genericerror(int,char*); | |
54 | typedef int (*GPT)(int,char*); | |
55 | ||
56 | #define set_handler(gen,type,x) name4(set_,type,gen,_handler)(x) | |
57 | ||
58 | #define errorhandler(gen,type) name3(type,gen,handler) | |
59 | ||
60 | #define callerror(gen,type,a,b) (*errorhandler(gen,type))(a,b) | |
61 | ||
62 | ||
63 | #endif generic_h |