BOOL APIENTRY DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:            
        
        // The DLL is being loaded for the first time by a given process.
        // Perform per-process initialization here.  If the initialization
        // is successful, return TRUE; if unsuccessful, return FALSE.
        g_hInst = (HINSTANCE)hModule;

        //load the icon
        g_hIcon = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_DISPLAYICON), IMAGE_ICON, DRA::SCALEX(32), DRA::SCALEY(32) ,LR_DEFAULTCOLOR);
                
        //initilize the application class, and set the global window handle
        UnregisterClass(TEXT(PLUGIN_NAME), g_hInst);
        InitializeClasses();
        g_hWnd = 0;
        
        break;
        
    case DLL_PROCESS_DETACH:
        // The DLL is being unloaded by a given process.  Do any
        // per-process clean up here, such as undoing what was done in
        // DLL_PROCESS_ATTACH.    The return value is ignored.

        DestroyIcon(g_hIcon);
        
        UnregisterClass(TEXT(PLUGIN_NAME), g_hInst);
        g_hInst = NULL;
        break;           
    }
    
    return TRUE;
}
Example #2
0
/*********************************************************
  NAME         : SetupDefclasses
  DESCRIPTION  : Initializes Class Hash Table,
                   Function Parsers, and Data Structures
  INPUTS       : None
  RETURNS      : Nothing useful
  SIDE EFFECTS :
  NOTES        : None
 *********************************************************/
static void SetupDefclasses(
    void *theEnv)
{
    InstallPrimitive(theEnv,&DefclassData(theEnv)->DefclassEntityRecord,DEFCLASS_PTR);

    DefclassData(theEnv)->DefclassModuleIndex =
        RegisterModuleItem(theEnv,(char*)"defclass",
#if (! RUN_TIME)
                           AllocateModule,ReturnModule,
#else
                           NULL,NULL,
#endif
#if BLOAD_AND_BSAVE || BLOAD || BLOAD_ONLY
                           BloadDefclassModuleReference,
#else
                           NULL,
#endif
#if CONSTRUCT_COMPILER && (! RUN_TIME)
                           DefclassCModuleReference,
#else
                           NULL,
#endif
                           EnvFindDefclass);

    DefclassData(theEnv)->DefclassConstruct =  AddConstruct(theEnv,(char*)"defclass",(char*)"defclasses",
#if (! BLOAD_ONLY) && (! RUN_TIME)
            ParseDefclass,
#else
            NULL,
#endif
            EnvFindDefclass,
            GetConstructNamePointer,GetConstructPPForm,
            GetConstructModuleItem,EnvGetNextDefclass,
            SetNextConstruct,EnvIsDefclassDeletable,
            EnvUndefclass,
#if (! RUN_TIME)
            RemoveDefclass
#else
            NULL
#endif
                                                           );

    AddClearReadyFunction(theEnv,(char*)"defclass",InstancesPurge,0);

#if ! RUN_TIME
    EnvAddClearFunction(theEnv,(char*)"defclass",CreateSystemClasses,0);
    InitializeClasses(theEnv);

#if ! BLOAD_ONLY
#if DEFMODULE_CONSTRUCT
    AddPortConstructItem(theEnv,(char*)"defclass",SYMBOL);
    AddAfterModuleDefinedFunction(theEnv,(char*)"defclass",UpdateDefclassesScope,0);
#endif
    EnvDefineFunction2(theEnv,(char*)"undefclass",'v',PTIEF UndefclassCommand,(char*)"UndefclassCommand",(char*)"11w");

    AddSaveFunction(theEnv,(char*)"defclass",SaveDefclasses,10);
#endif

#if DEBUGGING_FUNCTIONS
    EnvDefineFunction2(theEnv,(char*)"list-defclasses",'v',PTIEF ListDefclassesCommand,(char*)"ListDefclassesCommand",(char*)"01");
    EnvDefineFunction2(theEnv,(char*)"ppdefclass",'v',PTIEF PPDefclassCommand,(char*)"PPDefclassCommand",(char*)"11w");
    EnvDefineFunction2(theEnv,(char*)"describe-class",'v',PTIEF DescribeClassCommand,(char*)"DescribeClassCommand",(char*)"11w");
    EnvDefineFunction2(theEnv,(char*)"browse-classes",'v',PTIEF BrowseClassesCommand,(char*)"BrowseClassesCommand",(char*)"01w");
#endif

    EnvDefineFunction2(theEnv,(char*)"get-defclass-list",'m',PTIEF GetDefclassListFunction,
                       (char*)"GetDefclassListFunction",(char*)"01");
    EnvDefineFunction2(theEnv,(char*)"superclassp",'b',PTIEF SuperclassPCommand,(char*)"SuperclassPCommand",(char*)"22w");
    EnvDefineFunction2(theEnv,(char*)"subclassp",'b',PTIEF SubclassPCommand,(char*)"SubclassPCommand",(char*)"22w");
    EnvDefineFunction2(theEnv,(char*)"class-existp",'b',PTIEF ClassExistPCommand,(char*)"ClassExistPCommand",(char*)"11w");
    EnvDefineFunction2(theEnv,(char*)"message-handler-existp",'b',
                       PTIEF MessageHandlerExistPCommand,(char*)"MessageHandlerExistPCommand",(char*)"23w");
    EnvDefineFunction2(theEnv,(char*)"class-abstractp",'b',PTIEF ClassAbstractPCommand,(char*)"ClassAbstractPCommand",(char*)"11w");
#if DEFRULE_CONSTRUCT
    EnvDefineFunction2(theEnv,(char*)"class-reactivep",'b',PTIEF ClassReactivePCommand,(char*)"ClassReactivePCommand",(char*)"11w");
#endif
    EnvDefineFunction2(theEnv,(char*)"class-slots",'m',PTIEF ClassSlotsCommand,(char*)"ClassSlotsCommand",(char*)"12w");
    EnvDefineFunction2(theEnv,(char*)"class-superclasses",'m',
                       PTIEF ClassSuperclassesCommand,(char*)"ClassSuperclassesCommand",(char*)"12w");
    EnvDefineFunction2(theEnv,(char*)"class-subclasses",'m',
                       PTIEF ClassSubclassesCommand,(char*)"ClassSubclassesCommand",(char*)"12w");
    EnvDefineFunction2(theEnv,(char*)"get-defmessage-handler-list",'m',
                       PTIEF GetDefmessageHandlersListCmd,(char*)"GetDefmessageHandlersListCmd",(char*)"02w");
    EnvDefineFunction2(theEnv,(char*)"slot-existp",'b',PTIEF SlotExistPCommand,(char*)"SlotExistPCommand",(char*)"23w");
    EnvDefineFunction2(theEnv,(char*)"slot-facets",'m',PTIEF SlotFacetsCommand,(char*)"SlotFacetsCommand",(char*)"22w");
    EnvDefineFunction2(theEnv,(char*)"slot-sources",'m',PTIEF SlotSourcesCommand,(char*)"SlotSourcesCommand",(char*)"22w");
    EnvDefineFunction2(theEnv,(char*)"slot-types",'m',PTIEF SlotTypesCommand,(char*)"SlotTypesCommand",(char*)"22w");
    EnvDefineFunction2(theEnv,(char*)"slot-allowed-values",'m',PTIEF SlotAllowedValuesCommand,(char*)"SlotAllowedValuesCommand",(char*)"22w");
    EnvDefineFunction2(theEnv,(char*)"slot-allowed-classes",'m',PTIEF SlotAllowedClassesCommand,(char*)"SlotAllowedClassesCommand",(char*)"22w");
    EnvDefineFunction2(theEnv,(char*)"slot-range",'m',PTIEF SlotRangeCommand,(char*)"SlotRangeCommand",(char*)"22w");
    EnvDefineFunction2(theEnv,(char*)"slot-cardinality",'m',PTIEF SlotCardinalityCommand,(char*)"SlotCardinalityCommand",(char*)"22w");
    EnvDefineFunction2(theEnv,(char*)"slot-writablep",'b',PTIEF SlotWritablePCommand,(char*)"SlotWritablePCommand",(char*)"22w");
    EnvDefineFunction2(theEnv,(char*)"slot-initablep",'b',PTIEF SlotInitablePCommand,(char*)"SlotInitablePCommand",(char*)"22w");
    EnvDefineFunction2(theEnv,(char*)"slot-publicp",'b',PTIEF SlotPublicPCommand,(char*)"SlotPublicPCommand",(char*)"22w");
    EnvDefineFunction2(theEnv,(char*)"slot-direct-accessp",'b',PTIEF SlotDirectAccessPCommand,
                       (char*)"SlotDirectAccessPCommand",(char*)"22w");
    EnvDefineFunction2(theEnv,(char*)"slot-default-value",'u',PTIEF SlotDefaultValueCommand,
                       (char*)"SlotDefaultValueCommand",(char*)"22w");
    EnvDefineFunction2(theEnv,(char*)"defclass-module",'w',PTIEF GetDefclassModuleCommand,
                       (char*)"GetDefclassModuleCommand",(char*)"11w");
    EnvDefineFunction2(theEnv,(char*)"get-class-defaults-mode", 'w', PTIEF GetClassDefaultsModeCommand,  (char*)"GetClassDefaultsModeCommand", (char*)"00");
    EnvDefineFunction2(theEnv,(char*)"set-class-defaults-mode", 'w', PTIEF SetClassDefaultsModeCommand,  (char*)"SetClassDefaultsModeCommand", (char*)"11w");
#endif

#if DEBUGGING_FUNCTIONS
    AddWatchItem(theEnv,(char*)"instances",0,&DefclassData(theEnv)->WatchInstances,75,DefclassWatchAccess,DefclassWatchPrint);
    AddWatchItem(theEnv,(char*)"slots",1,&DefclassData(theEnv)->WatchSlots,74,DefclassWatchAccess,DefclassWatchPrint);
#endif
}