コード例 #1
0
ファイル: main.c プロジェクト: FelipeBudinich/cc65
static void ConvertO65 (const char* File)
/* Convert an o65 object file into an assembler file */
{
    /* Remember the current converter argument count */
    unsigned ArgCount = CO65.ArgCount;

    /* If we won't assemble, this is the final step. In this case, set the
    ** output name.
    */
    if (!DoAssemble && OutputName) {
        CmdSetOutput (&CO65, OutputName);
    }

    /* Add the file as argument for the object file converter */
    CmdAddArg (&CO65, File);

    /* Add a NULL pointer to terminate the argument list */
    CmdAddArg (&CO65, 0);

    /* Run the converter */
    ExecProgram (&CO65);

    /* Remove the excess arguments */
    CmdDelArgs (&CO65, ArgCount);

    /* If this is not the final step, assemble the generated file, then
    ** remove it
    */
    if (DoAssemble) {
        /* Assemble the intermediate file and remove it */
        AssembleIntermediate (File);
    }
}
コード例 #2
0
ファイル: wfinit.c プロジェクト: mingpen/OpenNT
VOID NEAR PASCAL BoilThatDustSpec(register CHAR *pStart, BOOL bLoadIt)
{
  register CHAR *pEnd;
  WORD          ret;
  BOOL          bFinished;

  ENTER("BoilThatDustSpec");

  if (*pStart == TEXT('\0'))
      return;

  bFinished = FALSE;
  while (!bFinished)
    {
      pEnd = pStart;
      while ((*pEnd) && (*pEnd != ' ') && (*pEnd != ','))
#ifdef DBCS
          pEnd = AnsiNext(pEnd);
#else
          ++pEnd;
#endif

      if (*pEnd == TEXT('\0'))
          bFinished = TRUE;
      else
          *pEnd = TEXT('\0');

      ret = ExecProgram(pStart, szNULL, NULL, bLoadIt);
      if (ret)
          MyMessageBox(NULL, IDS_EXECERRTITLE, ret, MB_OK | MB_ICONEXCLAMATION | MB_SYSTEMMODAL);

      pStart = pEnd+1;
    }
  LEAVE("BoilThatDustSpec");
}
コード例 #3
0
ファイル: main.c プロジェクト: FelipeBudinich/cc65
static void CompileRes (const char* File)
/* Compile the given geos resource file */
{
    /* Remember the current assembler argument count */
    unsigned ArgCount = GRC.ArgCount;

    /* Resource files need an geos-apple or geos-cbm target but this
    ** is checked within grc65.
    */
    CmdSetTarget (&GRC, Target);

    /* Add the file as argument for the resource compiler */
    CmdAddArg (&GRC, File);

    /* Add a NULL pointer to terminate the argument list */
    CmdAddArg (&GRC, 0);

    /* Run the compiler */
    ExecProgram (&GRC);

    /* Remove the excess arguments */
    CmdDelArgs (&GRC, ArgCount);

    /* If this is not the final step, assemble the generated file, then
    ** remove it
    */
    if (DoAssemble) {
        /* Assemble the intermediate file and remove it */
        AssembleIntermediate (File);
    }
}
コード例 #4
0
ファイル: main.c プロジェクト: FelipeBudinich/cc65
static void Compile (const char* File)
/* Compile the given file */
{
    /* Remember the current compiler argument count */
    unsigned ArgCount = CC65.ArgCount;

    /* Set the target system */
    CmdSetTarget (&CC65, Target);

    /* Check if this is the final step */
    if (DoAssemble) {
        /* We will assemble this file later. If a dependency file is to be
        ** generated, set the dependency target to be the final object file,
        ** not the intermediate assembler file. But beware: There may be an
        ** output name specified for the assembler.
        */
        if (DepName || FullDepName) {
            /* Was an output name for the assembler specified? */
            if (!DoLink && OutputName) {
                /* Use this name as the dependency target */
                CmdAddArg2 (&CC65, "--dep-target", OutputName);
            } else {
                /* Use the object file name as the dependency target */
                char* ObjName = MakeFilename (File, ".o");
                CmdAddArg2 (&CC65, "--dep-target", ObjName);
                xfree (ObjName);
            }
        }
    } else {
        /* If we won't assemble, this is the final step. In this case, set
        ** the output name if it was given.
        */
        if (OutputName) {
            CmdSetOutput (&CC65, OutputName);
        }
    }

    /* Add the file as argument for the compiler */
    CmdAddArg (&CC65, File);

    /* Add a NULL pointer to terminate the argument list */
    CmdAddArg (&CC65, 0);

    /* Run the compiler */
    ExecProgram (&CC65);

    /* Remove the excess arguments */
    CmdDelArgs (&CC65, ArgCount);

    /* If this is not the final step, assemble the generated file, then
    ** remove it
    */
    if (DoAssemble) {
        /* Assemble the intermediate file and remove it */
        AssembleIntermediate (File);
    }
}
コード例 #5
0
ファイル: main.c プロジェクト: FelipeBudinich/cc65
static void Link (void)
/* Link the resulting executable */
{
    unsigned I;

    /* Since linking is always the final step, if we have an output file name
    ** given, set it here. If we don't have an explicit output name given,
    ** try to build one from the name of the first input file.
    */
    if (OutputName) {

        CmdSetOutput (&LD65, OutputName);

    } else if (FirstInput && FindExt (FirstInput)) {  /* Only if ext present! */

        const char* Extension = Module? MODULE_EXT : "";
        char* Output = MakeFilename (FirstInput, Extension);
        CmdSetOutput (&LD65, Output);
        xfree (Output);

    }

    /* If we have a linker config file given, add it to the command line.
    ** Otherwise pass the target to the linker if we have one.
    */
    if (LinkerConfig) {
        if (Module) {
            Error ("Cannot use -C and --module together");
        }
        CmdAddArg2 (&LD65, "-C", LinkerConfig);
    } else if (Module) {
        CmdSetTarget (&LD65, TGT_MODULE);
    } else {
        CmdSetTarget (&LD65, Target);
    }

    /* Determine which target libraries are needed */
    SetTargetFiles ();

    /* Add all object files as parameters */
    for (I = 0; I < LD65.FileCount; ++I) {
        CmdAddArg (&LD65, LD65.Files [I]);
    }

    /* Add the system runtime library */
    if (TargetLib) {
        CmdAddArg (&LD65, TargetLib);
    }

    /* Terminate the argument list with a NULL pointer */
    CmdAddArg (&LD65, 0);

    /* Call the linker */
    ExecProgram (&LD65);
}
コード例 #6
0
ファイル: main.c プロジェクト: FelipeBudinich/cc65
static void AssembleFile (const char* File, unsigned ArgCount)
/* Common routine to assemble a file. Will be called by Assemble() and
** AssembleIntermediate(). Adds options common for both routines and
** assembles the file. Will remove excess arguments after assembly.
*/
{
    /* Set the target system */
    CmdSetTarget (&CA65, Target);

    /* Check if this is the last processing step */
    if (DoLink) {
        /* We're linking later. Add the output file of the assembly
        ** the the file list of the linker. The name of the output
        ** file is that of the input file with ".s" replaced by ".o".
        */
        char* ObjName = MakeFilename (File, ".o");
        CmdAddFile (&LD65, ObjName);
        xfree (ObjName);
    } else {
        /* This is the final step. If an output name is given, set it */
        if (OutputName) {
            CmdSetOutput (&CA65, OutputName);
        }
    }

    /* Add the file as argument for the assembler */
    CmdAddArg (&CA65, File);

    /* Add a NULL pointer to terminate the argument list */
    CmdAddArg (&CA65, 0);

    /* Run the assembler */
    ExecProgram (&CA65);

    /* Remove the excess arguments */
    CmdDelArgs (&CA65, ArgCount);
}
コード例 #7
0
ファイル: main.cpp プロジェクト: oldbay/dnc_kassa
int main( int argc, char ** argv )
{
    
    QApplication a( argc, argv );
    
    puts("`````````````````````````````````````````````````");
    printf("RESHKA MAIN PROCESS ID - %d\n", getpid());
    printf("VERSION: %s\n", PROGRAMM_VERSION);
    puts("`````````````````````````````````````````````````");
    
    startHW();
    
    get_setup_params();
    
    hw->DSP_Up(UpStr);
    hw->DSP_Down(DownStr);   
    
    init_keyboard_device(&a);     
    
    bool flag = auth_request(false);
    if ( flag )    {	
	cfw = new mainmenuForm;
	cfw->setWindowState(Qt::WindowNoState);
	cfw->setWindowState(Qt::WindowFullScreen);
	//printf("Authorization::GetInstance()->GetUserName() = %s \n", Authorization::GetInstance()->GetUserName());
	cfw->textLabel2->setText(DBCodec->toUnicode((Authorization::GetInstance()->GetUserName())));
	applyRights();
	
	while ( true )	{
	    puts("------Main Menu------");	    
	    cfw->setWindowState(Qt::WindowNoState);
      	    cfw->setWindowState(Qt::WindowFullScreen);
	    cfw->exec();
	    //printf("Selected point  = %d \n", cfw->focus_num);
	    cfw->releaseKeyboard();
	    if  ( cfw->exec_flag )   {
		switch(cfw->focus_num)		{
		case 0 :
		    printf("--------lincash-------\n");
		    delete (hw);
		    ExecProgram(REG_PATH, REG_NAME, uid);//, REG_NAME);	///-------------------------23/10 16.41---------------
		    cfw->grabKeyboard();
		    //---(+)---Zuskin---27/02/2012---
		    sp.ReloadSections();
		    //-------------------------------
		    startHW();
		    hw->DSP_Up(UpStr);
		    hw->DSP_Down(DownStr); 
		    break;
		case 1 :
		    printf("-------service-----\n");
		    //delete (hw);
		    //QApplication::setOverrideCursor( QCursor(Qt::WaitCursor) );
		    //ExecProgram(SERVICE_PATH, SERVICE_NAME, uid);//, SERVICE_NAME);
		    StartService();
		    cfw->exec_flag = false;
   		    cfw->grabKeyboard();
		    //QApplication::restoreOverrideCursor(); 
		    //startHW();
		    hw->DSP_Up(UpStr);
		    hw->DSP_Down(DownStr);      
		    break;
		case 2 :
		    printf("-------accessrights-------\n");
		    delete (hw);
		    //printf("RIGHTS_PATH = %s \n", RIGHTS_PATH);
		    ExecProgram(RIGHTS_PATH);//, RIGHTS_NAME);
		    Authorization::GetInstance()->GetRights(Authorization::GetInstance()->GetUid());
		    applyRights();
   		    cfw->grabKeyboard();
		    startHW();
		    hw->DSP_Up(UpStr);
		    hw->DSP_Down(DownStr); 
		    break;
		case 3 :
		    printf("--------ware------\n");
		    delete (hw);
		    ExecProgram(WARE_PATH);//, SETUP_NAME);
		    cfw->grabKeyboard();	
		    startHW();
		    hw->DSP_Up(UpStr);
		    hw->DSP_Down(DownStr);
		    break;			    
		case 4 :
		    printf("-------programsetup-----\n");
		    StartSetup();
		    cfw->grabKeyboard();	
		    get_setup_params();
		    cfw->exec_flag = false;
		    hw->DSP_Up(UpStr);
		    hw->DSP_Down(DownStr);
		    break;
		case 5 :
		    printf("--------devicesetup-------\n");		    
		    if ( kbcode_scaner != NULL ) {   delete (kbcode_scaner);    kbcode_scaner = NULL;    }
		    if ( kbcode_reader != NULL ) {   delete (kbcode_reader);    kbcode_reader = NULL;    }
		    
		    delete (hw);
		    ExecProgram(DCONF_PATH);//, DCONF_NAME);
    		    cfw->grabKeyboard();
		    startHW();
		    init_keyboard_device(&a); 
		    hw->DSP_Up(UpStr);
		    hw->DSP_Down(DownStr); 
		    break;
		case 6 :
		    printf("--------setuploadunload------\n");
		    delete (hw);
		    ExecProgram(EXCH_PATH);//, EXCH_NAME);
    		    cfw->grabKeyboard();
		    startHW();
		    hw->DSP_Up(UpStr);
		    hw->DSP_Down(DownStr);	      
		    break;
		case 7 :
		    printf("-------changeuser------\n");
		    bool auth = auth_request(true);
		    while ( !auth ) auth = auth_request(true);
    		    cfw->grabKeyboard();
		    cfw->exec_flag = false;
		    cfw->textLabel2->setText(DBCodec->toUnicode((Authorization::GetInstance()->GetUserName())));
		    applyRights();
		    break;	    
		}
		cfw->exec_flag = false;
		
	    }
	    else break;   
	}
	delete(cfw);
    }       
    if ( kbcode_scaner != NULL ) delete (kbcode_scaner);
    if ( kbcode_reader != NULL ) delete (kbcode_reader);
    if ( hw != NULL )  delete (hw);
    puts("END OF RESHKA");
    
    return 0;
}
コード例 #8
0
ファイル: wowexec.c プロジェクト: chunhualiu/OpenNT
BOOL NEAR PASCAL ExecApplication(PWOWINFO pWowInfo)
{

    WORD    ret;
    LPSTR   szEnv;
    LPSTR   szEnd;
    BYTE    bDrive;
    WORD    wSegEnvSave;
    HANDLE  hTask;
    LPSTR   lpTask;
    HANDLE  hPDB;
    LPSTR   lpPDB;
    HANDLE  hNewEnv;

    int     nLength;
    int     nNewEnvLength;
    LPSTR   lpstrEnv;
    LPSTR   lpstr;
    LPSTR   lpOriginalEnv;
    BOOL    bBlanks;
    LPSTR   szEnvTmp;


    if (!pWowInfo) {
        return FALSE;
        }

    //
    // Seup the environment from WOWINFO record from getvdmcommand
    //


    // Figure out who we are (so we can edit our PDB/PSP)

    hTask = GetCurrentTask();
    lpTask = GlobalLock( hTask );
    if ( lpTask == NULL ) {
        ret = IDS_NOMEMORYMSG;
        goto punt;
    }

    hPDB = *((LPWORD)(lpTask + TDB_PDB_OFFSET));
    lpPDB = GlobalLock( hPDB );

    // Save our environment block
    wSegEnvSave = *((LPWORD)(lpPDB + PDB_ENV_OFFSET));


    // Now determine the length of the original env

    lpOriginalEnv = (LPSTR)MAKELONG(0,wSegEnvSave);

    do {
        nLength = lstrlen(lpOriginalEnv);
        lpOriginalEnv += nLength + 1;
    } while ( nLength != 0 );

    lpOriginalEnv += 2;         // Skip over magic word, see comment below

    nNewEnvLength = 4 + lstrlen(lpOriginalEnv); // See magic comments below!

    // WOW Apps cannot deal with an invalid TEMP=c:\bugusdir directory
    // Usually on Win 3.1 the TEMP= is checked in ldboot.asm check_temp
    // routine.   However on NT since we get a new environment with each
    // WOW app it means that we have to check it here.   If it is not
    // valid then it is edited in the environment.
    //      - mattfe june 11 93

    szEnv = pWowInfo->lpEnv;
    szEnd = szEnv + pWowInfo->EnvSize;
    szEnd--;

    while ( szEnv < szEnd ) {

       nLength = lstrlen(szEnv) + 1;

       if (  (*szEnv == 'T') &&
         (*(szEnv+1) == 'E') &&
         (*(szEnv+2) == 'M') &&
         (*(szEnv+3) == 'P') &&
         (*(szEnv+4) == '=') )  {

            // Try to set the current directory to the TEMP= dir
            // If it fails then nuke the TEMP= part of the environment
            // in the same way check_TEMP does in ldboot.asm
            // We also scan for blanks, just like check_TEMP

            bBlanks = FALSE;
            szEnvTmp = szEnv+5;
            while (*szEnvTmp != 0) {
                if (*szEnvTmp == ' ') {
                    bBlanks = TRUE;
                    break;
                }
                szEnvTmp++;
            }

            if (bBlanks || (SetCurrentDirectory(szEnv+5) )) {
                while (*szEnv != 0) {
                    *szEnv = 'x';
                    szEnv++;
                }
            }
       break;
       }
       szEnv += nLength;
    }

    // WOW Apps only have a Single Current Directory
    // Find =d:=D:\path where d is the active drive letter
    // Note that the drive info doesn have to be at the start
    // of the environment.

    bDrive = pWowInfo->CurDrive + 'A';
    szEnv = pWowInfo->lpEnv;
    szEnd = szEnv + pWowInfo->EnvSize;
    szEnd--;

    while ( szEnv < szEnd ) {

       nLength = lstrlen(szEnv) + 1;
       if ( *szEnv == '=' ) {
            if ( (bDrive == (*(szEnv+1) & 0xdf)) &&
                 (*(szEnv+2) == ':') && (*(szEnv+3) == '=') ) {
                SetCurrentDirectory(szEnv+4);
            }
       } else {
            nNewEnvLength += nLength;
       }
       szEnv += nLength;
    }

    // Now allocate and make a personal copy of the Env

    hNewEnv = GlobalAlloc( GMEM_MOVEABLE, (DWORD)nNewEnvLength );
    if ( hNewEnv == NULL ) {
        ret = IDS_NOMEMORYMSG;
        goto punt;
    }
    lpstrEnv = GlobalLock( hNewEnv );
    if ( lpstrEnv == NULL ) {
        GlobalFree( hNewEnv );
        ret = IDS_NOMEMORYMSG;
        goto punt;
    }

    // Copy only the non-current directory env variables

    szEnv = pWowInfo->lpEnv;
    lpstr = lpstrEnv;

    while ( szEnv < szEnd ) {
        nLength = lstrlen(szEnv) + 1;

        // Copy everything except the drive letters

        if ( *szEnv != '=' ) {
            lstrcpy( lpstr, szEnv );
            lpstr += nLength;
        }
        szEnv += nLength;
    }
    *lpstr++ = '\0';          // Extra '\0' on the end

    // Magic environment goop!
    //
    // Windows only supports the passing of environment information
    // using the LoadModule API.  The WinExec API just causes
    // the application to inherit the current DOS PDB's environment.
    //
    // Also, the environment block has a little gotcha at the end.  Just
    // after the double-nuls there is a magic WORD value 0x0001 (DOS 3.0
    // and later).  After the value is a nul terminated string indicating
    // the applications executable file name (including PATH).
    //
    // We copy the value from WOWEXEC's original environment because
    // that is what WinExec appears to do.
    //
    // -BobDay

    *lpstr++ = '\1';
    *lpstr++ = '\0';        // Magic 0x0001 from DOS

    lstrcpy( lpstr, lpOriginalEnv );    // More Magic (see comment above)

    // Temporarily update our environment block

    *((LPWORD)(lpPDB + PDB_ENV_OFFSET)) = (WORD)hNewEnv | 1;

    pWowInfo->lpEnv = lpstrEnv;


    //
    // Set our current drive & directory as requested.
    //

    SetCurrentDirectory(pWowInfo->lpCurDir);

    ret = ExecProgram(pWowInfo);

    // Restore our environment block

    *((LPWORD)(lpPDB + PDB_ENV_OFFSET)) = wSegEnvSave;

    GlobalUnlock( hPDB );
    GlobalUnlock( hTask );
    GlobalUnlock( hNewEnv );
    GlobalFree( hNewEnv );


punt:

    // Change back to the Windows Directory
    // So that if we are execing from a NET Drive its
    // Not kept Active

    SetCurrentDirectory(szWindowsDirectory);

    // Check for errors.
    if (ret) {
        MyMessageBox(IDS_EXECERRTITLE, ret, pWowInfo->lpAppName);
    }

    //  Always call this when we are done try to start an app.
    //  It will do nothing if we were successful in starting an
    //  app, otherwise if we were unsucessful it will signal that
    //  the app has completed.
    WowFailedExec();

    return(ret);
}