home *** CD-ROM | disk | FTP | other *** search
- /* -*-Emacs Mode: C++ -*- */
-
- /* class.h - Macros for Portable C++/THINK C4.0 Object programs
-
- Copyright (C) 1989, Integrity Software
- Author: Isaac J. Salzman (salzman@rand.org)
-
- This software may be freely used/modified/distributed
- as desired so long as this copyright notice remains
- in tact.
- */
-
- /*
- *------------------------------------------------------------------
- * $Header: /tmp_mnt/amnt/lh/salzman/src/class/RCS/class.h,v 1.2 89/10/03 00:33:15 salzman Exp Locker: salzman $
- *------------------------------------------------------------------
- * $Log: class.h,v $
- * Revision 1.2 89/10/03 00:33:15 salzman
- * all C++ destructors are virtual for compatability with TCO
- * (see README)
- *
- * Revision 1.1 89/09/17 15:01:38 salzman
- * Initial revision
- *
- */
-
- /*
- Some pre-processor macros for writing *portable* C++ and THINK C
- Object programs.
- */
-
- #ifndef _H_class
- #define _H_class
-
- #ifdef THINK_C
- # include <oops.h> /* a must for THINK C */
-
- /* things needed for declaring classes */
- # define class struct
- # define virtual
- # define ROOT : indirect
- # define PROTECTED
- # define PRIVATE
- # define PUBLIC
- # define PREDEC_CLASS(Class)
- # define INHERIT_PUBLIC
-
- /* things needed for initialization */
- # define DECL_INIT(Class) Class *Init##Class
- # define DEF_INIT(Class) Class *Class::Init##Class
- # define MakeObject(Class) ((Class *)new (Class))->Init##Class
- # define INIT_SUPER(Class,args) Class::Init##Class args
- # define SUPER_INIT_ARGS(args)
- # define RETURN_THIS return this
-
- /* things needed for destroying objects */
- # define DECL_DEST(Class) void Destroy
- # define DEF_DEST(Class) void Class::Destroy
- # define DestroyObject(Object) { Object->Destroy();delete(Object); }
- # define DESTROY_SUPER inherited::Destroy()
-
- #else /* C++ */
- /* things needed for declaring classes */
- /* class and virtual are keywords */
- # define ROOT
- # define PROTECTED protected:
- # define PRIVATE private:
- # define PUBLIC public:
- # define PREDEC_CLASS(Class) class Class
- # define INHERIT_PUBLIC public
-
- /* things needed for initialization */
- # define DECL_INIT(Class) Class
- # define DEF_INIT(Class) Class::Class
- # define MakeObject(Class) new Class
- # define INIT_SUPER(Class,args)
- # define SUPER_INIT_ARGS(args) : args
- # define RETURN_THIS
-
- /* things needed for destroying objects */
- # define DECL_DEST(Class) virtual ~Class
- # define DEF_DEST(Class) Class::~Class
- # define DestroyObject(Object) delete Object
- # define DESTROY_SUPER
-
- #endif
-
- #endif /* _H_class */
-