home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / c / djgpp / include / generic.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-01-20  |  2.1 KB  |  67 lines

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