Exemplo n.º 1
0
PERROR RunFilter( FRAME *frame, UBYTE *argstr )
{
    char argbuf[ARGBUF_SIZE];
    struct Process *p;
    PERROR res = PERR_OK;

    D(bug("RunFilter( %08X, %s )\n",frame,(argstr) ? argstr : (STRPTR)"NULL" ));

    LOCKGLOB();

    if( !IsAreaSelected(frame) ) {
        SelectWholeImage( frame );
    }

    D(bug("\tSelBox is (%d,%d)-(%d,%d)\n",frame->selbox.MinX, frame->selbox.MinY,
           frame->selbox.MaxX, frame->selbox.MaxY ));

    /*
     *  Reserve frame and lock windows
     */

    if(ObtainFrame( frame, BUSY_READONLY )) {

        if(argstr)
            sprintf(argbuf,"%lu %s",frame,argstr);
        else
            sprintf(argbuf,"%lu",frame);

#ifdef DEBUG_MODE
        p = CreateNewProcTags( NP_Entry, Filter, NP_Cli, FALSE,
            NP_Output, frame->debug_handle = OpenDebugFile( DFT_Effect ),
            NP_CloseOutput,TRUE, NP_Name, frame->nd.ln_Name,
            NP_StackSize, globals->userprefs->extstacksize,
            NP_Priority, globals->userprefs->extpriority, NP_Arguments, argbuf, TAG_END );
#else
        p = CreateNewProcTags( NP_Entry, Filter, NP_Cli, FALSE,
            NP_Output, Open("NIL:",MODE_NEWFILE),
            NP_CloseOutput, TRUE, NP_Name, frame->nd.ln_Name,
            NP_StackSize, globals->userprefs->extstacksize,
            NP_Priority, globals->userprefs->extpriority, NP_Arguments, argbuf, TAG_END );
#endif

        if(!p) {
            ReleaseFrame( frame );
            D(bug("\tCouldn't create a new process.\n"));
            res = PERR_GENERAL;
        } else {
            SetFrameStatus( frame, 1 );
            LOCK(frame);
            frame->currproc = p;
            UNLOCK(frame);
        }
    }

    UNLOCKGLOB();

    return res;
}
Exemplo n.º 2
0
Arquivo: codeopt.c Projeto: coyxc/cc65
void RunOpt (CodeSeg* S)
/* Run the optimizer */
{
    const char* StatFileName;

    /* If we shouldn't run the optimizer, bail out */
    if (!S->Optimize) {
        return;
    }

    /* Check if we are requested to write optimizer statistics */
    StatFileName = getenv ("CC65_OPTSTATS");
    if (StatFileName) {
        ReadOptStats (StatFileName);
    }

    /* Print the name of the function we are working on */
    if (S->Func) {
        Print (stdout, 1, "Running optimizer for function `%s'\n", S->Func->Name);
    } else {
        Print (stdout, 1, "Running optimizer for global code segment\n");
    }

    /* If requested, open an output file */
    OpenDebugFile (S);
    WriteDebugOutput (S, 0);

    /* Generate register info for all instructions */
    CS_GenRegInfo (S);

    /* Run groups of optimizations */
    RunOptGroup1 (S);
    RunOptGroup2 (S);
    RunOptGroup3 (S);
    RunOptGroup4 (S);
    RunOptGroup5 (S);
    RunOptGroup6 (S);
    RunOptGroup7 (S);

    /* Free register info */
    CS_FreeRegInfo (S);

    /* Close output file if necessary */
    if (DebugOptOutput) {
        CloseOutputFile ();
    }

    /* Write statistics */
    if (StatFileName) {
        WriteOptStats (StatFileName);
    }
}
Exemplo n.º 3
0
CParentWnd::CParentWnd()
{
	// OutputDebugStringOutput only at first
	// Get any settings from the registry
	SetDefaults();
	ReadFromRegistry();
	// After this call we may output to the debug file
	OpenDebugFile();
	DebugPrintVersion(DBGVersionBanner);
	// Force the system riched20 so we don't load office's version.
	(void) LoadFromSystemDir(_T("riched20.dll")); // STRING_OK
	// Second part is to load rundll32.exe
	// Don't plan on unloading this, so don't care about the return value
	(void) LoadFromSystemDir(_T("rundll32.exe")); // STRING_OK

	// Load DLLS and get functions from them
	ImportProcs();

	// Initialize objects for theming
	InitializeGDI();

	m_cRef = 1;

	m_hwinEventHook = SetWinEventHook(
		EVENT_OBJECT_REORDER,
		EVENT_OBJECT_REORDER,
		NULL,
		&MyWinEventProc,
		GetCurrentProcessId(),
		NULL,
		NULL);

	ForceOutlookMAPI(0 != RegKeys[regkeyFORCEOUTLOOKMAPI].ulCurDWORD);
	ForceSystemMAPI(0 != RegKeys[regkeyFORCESYSTEMMAPI].ulCurDWORD);

	LoadAddIns();

	// Notice we never create a window here!
	TRACE_CONSTRUCTOR(CLASS);
} // CParentWnd::CParentWnd
Exemplo n.º 4
0
Arquivo: acc.c Projeto: Edward850/acc
static void ProcessArgs(void)
{
	int i = 1;
	int count = 0;
	char *text;
	char option;
	
	while(i < ArgCount)
	{
		text = ArgVector[i];
		
		if(*text == '-')
		{
			// Option
			text++;
			if(*text == 0)
			{
				DisplayUsage();
			}
			option = toupper(*text++);
			switch(option)
			{
				case 'I':
					if((i + 1) < ArgCount)
					{
						TK_AddIncludePath(ArgVector[++i]);
					}
					break;
					
				case 'D':
					acs_DebugMode = YES;
					acs_VerboseMode = YES;
					if(*text != 0)
					{
						OpenDebugFile(text);
					}
					break;
					
				case 'H':
					pc_NoShrink = TRUE;
					pc_HexenCase = TRUE;
					pc_EnforceHexen = toupper(*text) != 'H';
					pc_WarnNotHexen = toupper(*text) == 'H';
					break;
					
				default:
					DisplayUsage();
					break;
			}
		}
		else
		{
			// Input/output file
			count++;
			switch(count)
			{
				case 1:
					strcpy(acs_SourceFileName, text);
					MS_SuggestFileExt(acs_SourceFileName, ".acs");
					break;
					
				case 2:
					strcpy(ObjectFileName, text);
					MS_SuggestFileExt(ObjectFileName, ".o");
					break;
					
				default:
					DisplayUsage();
					break;
			}
		}
		
		// Next arg
		i++;
	}
	
	if(count == 0)
	{
		DisplayUsage();
	}

	TK_AddIncludePath(".");
#ifdef unix
	TK_AddIncludePath("/usr/local/share/acc/");
#endif
	TK_AddProgramIncludePath(ArgVector[0]);
	
	if(count == 1)
	{
		strcpy(ObjectFileName, acs_SourceFileName);
		MS_StripFileExt(ObjectFileName);
		MS_SuggestFileExt(ObjectFileName, ".o");
	}
}