home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / gnu / g__lib / generic.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-23  |  1.8 KB  |  61 lines

  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. #pragma once
  26. #define generic_h 1
  27.  
  28. /*
  29.  *    See the CPP manual, argument prescan section for explanation
  30.  */
  31.  
  32. #define name2(a,b) gEnErIc2(a,b)
  33. #define gEnErIc2(a,b) a ## b
  34.  
  35. #define name3(a,b,c) gEnErIc3(a,b,c)
  36. #define gEnErIc3(a,b,c) a ## b ## c
  37.  
  38. #define name4(a,b,c,d) gEnErIc4(a,b,c,d)
  39. #define gEnErIc4(a,b,c,d) a ## b ## c ## d
  40.  
  41. #define GENERIC_STRING(a) gEnErIcStRiNg(a)
  42. #define gEnErIcStRiNg(a) #a
  43.  
  44. #define declare(clas,t)        name2(clas,declare)(t)
  45. #define declare2(clas,t1,t2)   name2(clas,declare2)(t1,t2)
  46.  
  47. #define implement(clas,t)      name2(clas,implement)(t)
  48. #define implement2(clas,t1,t2) name2(clas,implement2)(t1,t2)
  49.  
  50. extern genericerror(int,char*);
  51. typedef int (*GPT)(int,char*);
  52.  
  53. #define set_handler(gen,type,x) name4(set_,type,gen,_handler)(x)
  54.  
  55. #define errorhandler(gen,type)  name3(type,gen,handler)
  56.  
  57. #define callerror(gen,type,a,b) (*errorhandler(gen,type))(a,b)
  58.  
  59.  
  60. #endif generic_h
  61.