home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / files / gnu / g__inc / generic.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-23  |  1.8 KB  |  59 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 the GNU C++ Library.  This library is free
  7. software; you can redistribute it and/or modify it under the terms of
  8. the GNU Library General Public License as published by the Free
  9. Software Foundation; either version 2 of the License, or (at your
  10. option) any later version.  This library is distributed in the hope
  11. that it will be useful, but WITHOUT ANY WARRANTY; without even the
  12. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  13. PURPOSE.  See the GNU Library General Public License for more details.
  14. You should have received a copy of the GNU Library General Public
  15. License along with this library; if not, write to the Free Software
  16. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  17. */
  18.  
  19. #ifndef generic_h
  20. #ifdef __GNUG__
  21. #pragma once
  22. #pragma interface
  23. #endif
  24. #define generic_h 1
  25.  
  26. /*
  27.  *    See the CPP manual, argument prescan section for explanation
  28.  */
  29.  
  30. #define name2(a,b) gEnErIc2(a,b)
  31. #define gEnErIc2(a,b) a ## b
  32.  
  33. #define name3(a,b,c) gEnErIc3(a,b,c)
  34. #define gEnErIc3(a,b,c) a ## b ## c
  35.  
  36. #define name4(a,b,c,d) gEnErIc4(a,b,c,d)
  37. #define gEnErIc4(a,b,c,d) a ## b ## c ## d
  38.  
  39. #define GENERIC_STRING(a) gEnErIcStRiNg(a)
  40. #define gEnErIcStRiNg(a) #a
  41.  
  42. #define declare(clas,t)        name2(clas,declare)(t)
  43. #define declare2(clas,t1,t2)   name2(clas,declare2)(t1,t2)
  44.  
  45. #define implement(clas,t)      name2(clas,implement)(t)
  46. #define implement2(clas,t1,t2) name2(clas,implement2)(t1,t2)
  47.  
  48. extern genericerror(int,char*);
  49. typedef int (*GPT)(int,char*);
  50.  
  51. #define set_handler(gen,type,x) name4(set_,type,gen,_handler)(x)
  52.  
  53. #define errorhandler(gen,type)  name3(type,gen,handler)
  54.  
  55. #define callerror(gen,type,a,b) (*errorhandler(gen,type))(a,b)
  56.  
  57.  
  58. #endif generic_h
  59.