Ejemplo n.º 1
0
/*** Deallocate ressources properly ***/
void cleanup(UBYTE *msg, int errcode)
{
	CBClose();
	close_port();
	CloseMainWnd(1);
	CleanupLocale();
	free_macros();
	free_diskio_alloc();		/* ASL */
	if(args.sa_Free)  FreeVec(args.sa_ArgLst);
	if(DiskfontBase)  CloseLibrary(DiskfontBase);
	if(LocaleBase)    CloseLibrary((struct Library *)LocaleBase);
	if(AslBase)       CloseLibrary(AslBase);
   if(IFFParseBase)  CloseLibrary(IFFParseBase);
	if(UtilityBase)   CloseLibrary((struct Library *)UtilityBase);
	if(KeymapBase)    CloseLibrary(KeymapBase);
	if(GadToolsBase)  CloseLibrary(GadToolsBase);
	if(GfxBase)       CloseLibrary((struct Library *)GfxBase);
	if(IntuitionBase) CloseLibrary((struct Library *)IntuitionBase);
	if(msg)           puts(msg);

#if	DEBUG
	/* Here can be compared good programs with the others :-) */
	amem = AvailMem( MEMF_PUBLIC );
	if(amem < bmem)  printf("Possible memory lost of %d bytes\n", bmem-amem);
#endif
	exit(errcode);
}
Ejemplo n.º 2
0
void Cleanup(STRPTR msg)
{
    if (msg)
    {
	if (IntuitionBase && !((struct Process *)FindTask(NULL))->pr_CLI)
	{
	    ShowMessage("IControl", msg, MSG(MSG_OK));     
	}
	else
	{
	    printf("IControl: %s\n", msg);
	}
    }
    
    KillGUI();

    FreeArguments();
    CloseLibs();
    CleanupLocale();
    
    exit(prog_exitcode);
}