/*
    ApplicationCategory.m
    =====================

    John Holdsworth
    Coldwave Programs Ltd.

    This software is in the public domain.

    A slightly dodgy Category of Application that intercepts the call
    to the "new" method on application start up to export the application
    object using distributed objects.

*/
/*
 * $Log: ApplicationCategory.m,v $
 * Revision 1.7  1997/04/15  21:31:23  johnh
 * Fix of sub-class of application complication.
 *
 * Revision 1.6  1997/04/15  20:47:12  johnh
 * Added comment.
 *
 * Revision 1.5  1997/04/15  20:41:06  johnh
 * Moved Objective-C code into Category Poser.
 *
 * Revision 1.4  1997/03/18  22:08:04  johnh
 * New Simple version.
 *
 * Revision 1.3  1997/01/23  01:00:38  johnh
 * Error reporting added and tidy up.
 *
 * Revision 1.2  1997/01/20  22:52:59  johnh
 * Second Version.
 *
 * Revision 1.1  1997/01/19  22:44:57  johnh
 * Initial Version.
 */

#ifdef DEBUG

#import "ApplicationCategory.h"

#import "CategoryPoser.h" // finds overloaded method implementations 
#import "CategoryLoader.h" // Pbject that loads in bundle projects

@implementation  Application(ApplicationCategory)  

+ new
/* Overloads Application class new method which is guaranteed to be called when an application is started to distribute CategoryLoader object. The reloadBundle: method is then messaged by the Bundle project Makefile.postamble to load class category bundles. */
{
    /* call original implementation of [Application new] for app instance */
    Application *appInstance = [Application performOverloadedMethod:_cmd];
    /* _cmd along with "self" is an implicit argument to method functions */

    /* allocate a CategoryLoader instance (which distributes itself) */
    [[CategoryLoader alloc] init];
  
    /* carry on as normal */
    return appInstance;
}

@end

#endif
