예제 #1
0
void TestCaseF( void )
{
    char            bufA[80] = "FoO baR gOoBeR bLaH";
    char            bufB[80];
    char            bufLower[80] = "foo bar goober blah";
    char            bufUpper[80] = "FOO BAR GOOBER BLAH";
    char __far      *bufPtr;
    int             status;

    bufPtr = _fstrcpy( bufB, bufA );            /* copy string */
    VERIFY( bufPtr == bufB );

    bufPtr = _fstrlwr( bufB );                  /* lowercase */
    VERIFY( bufPtr == bufB );

    status = _fstrcmp( bufB, bufLower );        /* ensure ok */
    VERIFY( status == 0 );

    bufPtr = _fstrcpy( bufB, bufA );            /* copy string */
    VERIFY( bufPtr == bufB );

    bufPtr = _fstrupr( bufB );                  /* uppercase */
    VERIFY( bufPtr == bufB );

    status = _fstrcmp( bufB, bufUpper );        /* ensure ok */
    VERIFY( status == 0 );
}
예제 #2
0
static void sel_sort(PGENSEL gs)
   {

   SHORT bound, j, t;
   char  temp[21];

   /* B1: initialize BOUND.  We correct for zero origin here. */
   bound = gs->sCountNames - 1;

   do
     {
     /* B2: Loop on j */
     for (t = -1, j = 0; j < bound; j++)
         {
         /* B3: Compare/Exchange R[j], R[j+1] */
         /*   if R[j] > R[j+1] ... */
         if (0 < _fstrcmp(gs->szNames[j], gs->szNames[j+1]) )
            {
            /* swap */
            _fstrcpy(temp, gs->szNames[j]);
            _fstrcpy(gs->szNames[j], gs->szNames[j+1]);
            _fstrcpy(gs->szNames[j+1], temp);
            t = j;
            }
         }
         bound = t;  /* B4: set for restart ... */
      }
                     /*     if we swapped anything */
      while (t >= 0);

   }
예제 #3
0
BOOL __far __pascal __export TVLibGetInfo( FPTVLIBFILEINFO fpTVLibFileInfo )
{
  /* Assign data to structure. */
  _fstrcpy( fpTVLibFileInfo->szFilter, szFilter );
  _fstrcpy( fpTVLibFileInfo->szIconResouce, MAIN_ICON );
  _fstrcpy( fpTVLibFileInfo->szIconCaption, szIconText );
  fpTVLibFileInfo->bAskForFile = TRUE;

  /* Return success. */
  return TRUE;
}
예제 #4
0
static bool CallTrapInit( const char *parms, char *errmsg, trap_version *trap_ver )
{
    trap_init_struct    __far *callstruct;

    callstruct = (void __far *)PMData->parmarea;
    callstruct->remote = trap_ver->remote;
    _fstrcpy( (char __far *)&callstruct[1], parms );
    callstruct->errmsg_off = sizeof( *callstruct ) + strlen( parms ) + 1;
    GoToRealMode( RMTrapInit );
    *trap_ver = callstruct->version;
    _fstrcpy( errmsg, (char __far *)callstruct + callstruct->errmsg_off );
    return( *errmsg == '\0' );
}
예제 #5
0
/****************************************************
**
**  Save last position and size of main help window.
**
****************************************************/
void __far __pascal WriteLastMainWndPos( WINDOWPLACEMENT __far * WndPlacePtr )
{ 
  char szNumber[ 8 ];
  char szString[ MAX_WNDPOS_STRING ];
  char szINIFilePath[ _MAX_PATH ];
  
  /* Get path to the INI file. */
  GetINIPath( szINIFilePath );
  

  /* If maximized. */
  if( WndPlacePtr->showCmd == SW_SHOWMAXIMIZED )
  {
    /* Save window state. */
    itoa( TRUE, szNumber, 10 );
    _fstrcpy( szString, szNumber );
  }
  
  /* If not maximized. */
  else
  {
    /* Save window state. */
    itoa( FALSE, szNumber, 10 );
    _fstrcpy( szString, szNumber );
    _fstrcat( szString, INI_WNDPOS_TOKEN );

    /* Process x position. */
    itoa( WndPlacePtr->rcNormalPosition.left, szNumber, 10 );
    _fstrcat( szString, szNumber );
    _fstrcat( szString, INI_WNDPOS_TOKEN );
    
    /* Process y position. */
    itoa( WndPlacePtr->rcNormalPosition.top, szNumber, 10 );
    _fstrcat( szString, szNumber );
    _fstrcat( szString, INI_WNDPOS_TOKEN );
    
    /* Process width position. */
    itoa( WndPlacePtr->rcNormalPosition.right, szNumber, 10 );
    _fstrcat( szString, szNumber );
    _fstrcat( szString, INI_WNDPOS_TOKEN );
    
    /* Process height position. */
    itoa( WndPlacePtr->rcNormalPosition.bottom, szNumber, 10 );
    _fstrcat( szString, szNumber );
  }

  /* Write entry "LastPos" */
  WritePrivateProfileString( INI_GENERAL_SECTION, INI_WNDPOS_ENTRY, 
                             szString, szINIFilePath );
}
예제 #6
0
void TestMoveF( void )
{
    char            bufA[80] = "FoO baR gOoBeR bLaH";
    char            bufB[80];
    char __far      *bufPtr;
    char __far      *newBuf;
    int             status;

    bufPtr = _fstrcpy( bufB, "FoO baR" );       /* copy string */
    VERIFY( bufPtr == bufB );

    bufPtr = _fstrcat( bufB, " gOoBeR bLaH" );  /* append the rest */
    VERIFY( bufPtr == bufB );

    status = _fstrcmp( bufA, bufB );            /* check result */
    VERIFY( status == 0 );

    bufPtr = _fstrset( bufB, 0x00 );            /* zero out buffer */
    VERIFY( bufPtr == bufB );

    bufPtr = _fstrncpy( bufB, "ABCDEFGHIJ", 2 );/* copy two bytes */
    VERIFY( bufPtr == bufB );

    bufPtr = _fstrncat( bufB, "CDEFGHIJ", 3 );  /* copy three more */
    VERIFY( bufPtr == bufB );

    status = _fstrcmp( bufB, "ABCDE" );         /* ensure only five bytes */
    VERIFY( status == 0 );

    bufPtr = _fstrnset( bufB, 0x00, 10 );       /* blank string */
    VERIFY( bufPtr == bufB );

    status = _fstrcmp( bufB, "" );              /* verify empty */
    VERIFY( status == 0 );

    bufPtr = _fstrcpy( bufB, "abcdefghij" );    /* copy string */
    VERIFY( bufPtr == bufB );

    bufPtr = _fstrrev( bufB );                  /* reverse it */
    VERIFY( bufPtr == bufB );

    status = _fstrcmp( bufB, "jihgfedcba" );    /* ensure reversed ok */
    VERIFY( status == 0 );

    newBuf = _fstrdup( bufA );                  /* duplicate string */
    status = _fstrcmp( bufA, newBuf );
    VERIFY( status == 0 );
}
예제 #7
0
VOID SaveColorMap(PSZ szFileName)
   {

   FILE *file;
   char tempname[128];
   SHORT i;
   RGB _far *prgb;
   BYTE r, g, b;

   _fstrcpy(tempname, szFileName);

   file = fopen(tempname,"w");
   if (file == NULL)
       return;

   prgb = &cp.pbmiMemory->argbColor[0];

   fprintf(file,"  0   0   0\n");

   for (i = 1; i < 256; i++)
       {
       r = prgb[i].bRed;
       g = prgb[i].bGreen;
       b = prgb[i].bBlue;
       fprintf(file, "%3d %3d %3d\n",  /* R G B */
                     r, g, b);
       }

   fclose(file);

   }
예제 #8
0
WINEXPORT int CALLBACK EnumFamTypefaces( const LOGFONT FAR *lf, const TEXTMETRIC FAR *tm, DWORD FontType, LPARAM lparam )
#endif
{
#ifdef __WINDOWS_386__
    char                   faceName[LF_FACESIZE];
    const LOGFONT __far    *lf = MK_FP32( (void *)_lf );
    tm = tm;
#elif defined( __WINDOWS__ )
    const LOGFONT FAR      *lf = (const LOGFONT FAR *)elf;
//    const TEXTMETRIC FAR *tm = (const TEXTMETRIC FAR *)ntm;
    ntm = ntm;
#else
    tm = tm;
#endif

    lparam = lparam;
    FontType = FontType;

#ifdef __WINDOWS_386__
    /* On Win386, we need to pass a near 32-bit pointer with LB_ADDSTRING,
     * but we get a far pointer from Windows. Hence the shenanigans with
     * a temp buffer in the flat address space.
     */
    _fstrcpy( faceName, lf->lfFaceName );
    SendMessage( hwndTypeface, LB_ADDSTRING, 0, (LPARAM)faceName );
#else
    SendMessage( hwndTypeface, LB_ADDSTRING, 0, (LPARAM)(lf->lfFaceName) );
#endif

    return( TRUE );
}
예제 #9
0
int CALLBACK EnumFamTypefaces( LPLOGFONT lf, LPTEXTMETRIC tm,
                               int FontType, LONG lparam )
{
#ifdef __WINDOWS_386__
    char            faceName[LF_FACESIZE];
    LOGFONT __FAR__ *lgf = MAKEPTR( lf );
#endif

    lparam = lparam;
    tm = tm;
    FontType = FontType;

#ifdef __WINDOWS_386__
    /* On Win386, we need to pass a near 32-bit pointer with LB_ADDSTRING,
     * but we get a far pointer from Windows. Hence the shenanigans with
     * a temp buffer in the flat address space.
     */
    _fstrcpy( faceName, lgf->lfFaceName );
    SendMessage( hwndTypeface, LB_ADDSTRING, 0, (LONG)faceName );
#else
    SendMessage( hwndTypeface, LB_ADDSTRING, 0, (LONG)(lf->lfFaceName) );
#endif

    return( TRUE );
}
예제 #10
0
파일: pwin16.c 프로젝트: rickerliang/OpenNT
BOOL FAR PASCAL MDeleteFile(LPSTR lpPathName)
{
    static char szPath[_MAX_PATH];

    _fstrcpy(szPath, lpPathName);
    return(!remove(szPath));
}
예제 #11
0
파일: files.c 프로젝트: ErisBlastar/osfree
BOOL __far __pascal GetFilesExtension( char __far * szFilePath, char __far * szExtBuffer )
{
  char __far * szFileExt;
  
  
  /*
  ** Get the szFilePath's extension. 
  */

  /* Get the extension separator in path. */
  szFileExt = _fstrrchr( szFilePath, EXTENSION_CHAR_SEPARATOR ); 

  /* If didn't find the separator in path. */
  if( szFileExt == NULL ) return FALSE;

  /* Move to the character after the extension character. */
  szFileExt++;
  
  /* ** If we are at the end of the name string - no extension. */ 
  if( *szFileExt == NULL_CHAR ) return FALSE;

  /* Copy the extension into the buffer. */
  _fstrcpy( szExtBuffer, szFileExt );

  return TRUE;
}
예제 #12
0
파일: mktyplib.c 프로젝트: mingpen/OpenNT
void DebAssertShow(LPSTR lpszFileName, UINT uLine, LPSTR szComment)
{
    CHAR szFileName[255];
    _fstrcpy(szFileName, lpszFileName);		// copy near

    AssertFail(szFileName, (WORD)uLine);
}
예제 #13
0
파일: pwin16.c 프로젝트: rickerliang/OpenNT
WORD2DWORD FAR PASCAL MExtDeviceMode(HWND hWnd,LPSTR lpDriverName,
        LPDEVMODE lpDevModeOutput, LPSTR lpDeviceName, LPSTR lpPort,
        LPDEVMODE lpDevModeInput, LPSTR lpProfile, WORD2DWORD flMode)
{
    HANDLE     hmod;
    INT (APIENTRY *fpTarget)(HWND, HANDLE, LPDEVMODE, LPSTR, LPSTR, LPDEVMODE, LPSTR, WORD2DWORD);
    INT        iRC;
    CHAR       szAddDrv[13];

    _fstrcpy(szAddDrv, lpDriverName);
    _fstrcat(szAddDrv, ".DRV");
    hmod = LoadLibrary(szAddDrv);

    if (hmod < 32) {
        GlobalLastError = hmod;
        return(-1);
    }
    else {
        fpTarget = GetProcAddress(hmod, "ExtDeviceMode");
        if (fpTarget == NULL) {
            GlobalLastError = ERROR_GETADDR_FAILED;
            FreeLibrary(hmod);
            return(-1);
        }
        else {
            iRC = (*fpTarget)(hWnd, hmod, lpDevModeOutput, lpDeviceName,
                lpPort, lpDevModeInput, lpProfile, flMode);
            FreeLibrary(hmod);
            return(iRC);
        }
    }
}
예제 #14
0
파일: pwin16.c 프로젝트: rickerliang/OpenNT
DWORD FAR PASCAL MDeviceCapabilities(LPSTR lpDriverName, LPSTR lpDeviceName,
        LPSTR lpPort, WORD2DWORD nIndex, LPSTR lpOutput, LPDEVMODE lpDevMode)
{
    HANDLE      hmod;
    INT (APIENTRY *fpTarget)(LPSTR, LPSTR, WORD, LPSTR, LPDEVMODE);
    INT         iRC;
    CHAR        szAddDrv[13];

    _fstrcpy(szAddDrv, lpDriverName);
    _fstrcat(szAddDrv, ".DRV");
    hmod = LoadLibrary(szAddDrv);

    if (hmod < 32) {
        GlobalLastError = hmod;
        return(-1L);
    }
    else {
        fpTarget = GetProcAddress(hmod, "DeviceCapabilitiesEx");

        if (fpTarget == NULL) {
            GlobalLastError = ERROR_GETADDR_FAILED;
            FreeLibrary(hmod);
            return(-1L);
        }
        else {
            iRC = (*fpTarget)(lpDeviceName, lpPort, nIndex,
                    lpOutput, lpDevMode);
            FreeLibrary(hmod);
            return(iRC);
        }
    }
}
예제 #15
0
파일: pwin16.c 프로젝트: rickerliang/OpenNT
BOOL FAR PASCAL MDeviceMode(HWND hWnd, LPSTR lpDriverName, LPSTR lpDeviceName,
LPSTR lpOutput)
{
    HANDLE  hmod;
    INT (APIENTRY *fpTarget)(HWND, HANDLE, LPSTR, LPSTR);
    CHAR    szAddDrv[13];

    _fstrcpy(szAddDrv, lpDriverName);
    _fstrcat(szAddDrv, ".DRV");
    hmod = LoadLibrary(szAddDrv);

    if (hmod < 32) {
        GlobalLastError = hmod;
        return(FALSE);
    }

    fpTarget = GetProcAddress(hmod, "DeviceMode");

    if (fpTarget == NULL) {
        GlobalLastError =  ERROR_GETADDR_FAILED;
        FreeLibrary(hmod);
        return(FALSE);
    }
    else {
        (*fpTarget)(hWnd, hmod, lpDeviceName, lpOutput);
        FreeLibrary(hmod);
        return(TRUE);
    }
}
예제 #16
0
int SampWrite( void FAR_PTR *buff, unsigned len )
{
    unsigned    written;
    int         handle;
    int         rc;

    _fstrcpy( SampName, SharedMemory->SampName );
    if( SharedMemory->SampleHandle == 0 ) {
        handle = SysCreate( SampName );
        SharedMemory->SampleHandle = 1;
    } else {
        handle = SysOpen( SampName );
        if( handle >= 0 ) SysSeek( handle, SharedMemory->SampOffset );
    }
    if( handle == -1 ) {
        SharedMemory->FarWriteProblem = 1;
        return( -1 );
    }

    written = SysWrite( handle, buff, len );
    if( written == len ) {
        SharedMemory->SampOffset += len;
        rc = 0;
    } else {
        SysSeek( handle, SharedMemory->SampOffset );
        SysWrite( handle, "", 0 );
        SharedMemory->FarWriteProblem = 1;
        rc = -1;
    }
    SysClose( handle );
    return( rc );

} /* SampWrite */
예제 #17
0
파일: files.c 프로젝트: ErisBlastar/osfree
/*************************************
*
*  Search for a file in the given directory.
*
**************************************/
BOOL __far __pascal FindFile( char __far * szDir, char __far * szWildName, struct _find_t __far * FileInfo )
{
  char szFilesPath[_MAX_PATH];
  short int LastCharPos;

  /* First time through. */
  if( szDir != NULL )
  {
    /* Build full path for search directory and wild name of file. */
    _fstrcpy( szFilesPath, szDir );

    /* Is there already a dir. separator? */
    LastCharPos = ( _fstrlen( szFilesPath ) / sizeof(char) ) - 1;
    if( szFilesPath[LastCharPos] != DIR_CHAR_SEPARATOR )
    {
      _fstrcat( szFilesPath, DIR_STRING_SEPARATOR );
    }

    _fstrcat( szFilesPath, szWildName );
      
    if( !_dos_findfirst( szFilesPath, _A_NORMAL, FileInfo ) ) return TRUE;
  }

  /* No first time through. */
  else
  {
    if( !_dos_findnext( FileInfo ) ) return TRUE;
  }
  
  /* Failure. */
  return FALSE;
}
예제 #18
0
static bool MsgReadErrArray( void )
#endif
{
    int         i;
    char        buffer[128];
    unsigned    msg_shift;

    msg_shift = _WResLanguage() * MSG_LANG_SPACING;
    for( i = ERR_FIRST_MESSAGE; i <= ERR_LAST_MESSAGE; i++ ) {
#if !defined(__WINDOWS__)
        if( WResLoadString( &hInstance, i + msg_shift, (lpstr)buffer, sizeof( buffer ) ) <= 0 ) {
#else
        if( LoadString( inst, i + msg_shift, (LPSTR)buffer, sizeof( buffer ) ) <= 0 ) {
#endif
            if( i == ERR_FIRST_MESSAGE )
                return( false );
            buffer[0] = '\0';
        }
        MsgArray[i - ERR_FIRST_MESSAGE] = my_alloc( strlen( buffer ) + 1 );
        if( MsgArray[i - ERR_FIRST_MESSAGE] == NULL )
            return( false );
        _fstrcpy( MsgArray[i - ERR_FIRST_MESSAGE], buffer );
    }
    return( true );
}

#if !defined(__WINDOWS__)
bool MsgInit( void )
{
    char        buffer[_MAX_PATH];
#if defined(_PLS)
    char        *fname;
    char        fullpath[_MAX_PATH];
#endif
    bool        rc;

    hInstance.status = 0;
    if( _cmdname( buffer ) != NULL ) {
        rc = OpenResFile( &hInstance, buffer );
#if defined(_PLS)
        if( !rc ) {
            _splitpath2( buffer, fullpath, NULL, NULL, &fname, NULL );
            _makepath( buffer, NULL, NULL, fname, ".exp" );
            _searchenv( buffer, "PATH", fullpath );
            if( fullpath[0] != '\0' ) {
                rc = OpenResFile( &hInstance, fullpath );
            }
        }
#endif
        if( rc ) {
            MsgReadErrArray();
            CloseResFile( &hInstance );
            return( true );
        }
    }
    CloseResFile( &hInstance );
    posix_write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
    return( false );
}
예제 #19
0
WORD    GetEncKey (char far *pcSeqNumArr, WORD usKeyFld, WORD far *pusCmpCod)
{
    char    szWrkKey[SERSEGLEN+1];
    SCB     SCB;
    DWORD   ulSeqNum; 

    /********************************************************************/
    /********************************************************************/
    *pusCmpCod = 0;

    /********************************************************************/
    /********************************************************************/
    _fstrncpy (szWrkKey, pcSeqNumArr, SERSEGLEN);
    szWrkKey[SERSEGLEN] = '\0';
    ulSeqNum = _fstrtoul (&szWrkKey[0], NULL, 10);      /* Convert Seq# */

    /********************************************************************/
    /********************************************************************/
    _fstrcpy(SCB.id, "..?Z");           /* Signature Literal            */
    SCB.return_code = -1;               /* Init to invalid return code  */
    SCB.function_code = 1;              /* Code 0, 1, or 2              */
    _fstrcpy(SCB.product_name, "VFEdit");
    SCB.pin_number = 1637034832;        /*  Verify Personal ID Number   */

    /********************************************************************/
    /********************************************************************/
    SCB.product_serial = ulSeqNum;

    /********************************************************************/
    /********************************************************************/
    if (*pusCmpCod = KECHK (&SCB)) {
        if (TBxGlo.usDebFlg & KEY___DEB) 
            MsgDspUsr ("Accelerator I/O Error: %04x\n", *pusCmpCod);
        return (0);
    }
    if (SCB.return_code) {
        if (TBxGlo.usDebFlg & KEY___DEB) 
            MsgDspUsr ("Accelerator Access Error: %04x-%04x-%04x\n",
                SCB.return_code, SCB.return_status, SCB.return_function);
        *pusCmpCod = 0x8000;            // Force completion code non-zero
        return (0);
    }
    return (((WORD *) SCB.user_data)[usKeyFld]);

}
예제 #20
0
static bool CallTrapInit( const char *parms, char *errmsg, trap_version *trap_ver )
{
    _Packed struct {
        unsigned_16     remote;
        unsigned_16     retcode;
        trap_version    version;
        addr32_off      errmsg_off;
    }                   __far *callstruct;

    callstruct = (void __far *)PMData->parmarea;
    callstruct->remote = trap_ver->remote;
    _fstrcpy( (char __far *)&callstruct[1], parms );
    callstruct->errmsg_off = sizeof( *callstruct ) + strlen( parms ) + 1;
    GoToRealMode( RMTrapInit );
    *trap_ver = callstruct->version;
    _fstrcpy( errmsg, (char __far *)callstruct + callstruct->errmsg_off );
    return( *errmsg == NULLCHAR );
}
예제 #21
0
파일: exec.c 프로젝트: TijmenW/FreeDOS
int exec(const char *cmd, char *cmdLine, const unsigned segOfEnv)
{
#ifdef FEATURE_XMS_SWAP
#	define buf dosCMDTAIL
#	define memcpy _fmemcpy
#else
  unsigned char buf[128];
#endif
  struct fcb fcb1,
    fcb2;
  struct ExecBlock execBlock;
  int retval;


  assert(cmd);
  assert(cmdLine);
  assert(strlen(cmdLine) <= 125);

  invalidateNLSbuf();

  /* generate Pascal string from the command line */
  memcpy(&buf[1], cmdLine, buf[0] = strlen(cmdLine));
  memcpy(&buf[1] + buf[0], "\xd", 2);

  /* fill FCBs */
  if ((cmdLine = parsfnm(cmdLine, &fcb1, 1)) != 0)
    parsfnm(cmdLine, &fcb2, 1);

  saveSession();

#ifdef FEATURE_XMS_SWAP
	if(XMSisactive() && swapOnExec == TRUE) {
		/* Copy the prepared values into the buffers in CSWAP.ASM module */
		_fmemcpy(dosFCB1, &fcb1, sizeof(fcb1));
		_fmemcpy(dosFCB2, &fcb2, sizeof(fcb1));
		assert(strlen(cmd) < 128);
		_fstrcpy(dosCMDNAME, cmd);
		dosParamDosExec.envSeg = segOfEnv; 

		retval = XMSexec();
		} else
#endif
	{
	  /* fill execute structure */
	  execBlock.segOfEnv = segOfEnv;
	  execBlock.cmdLine = (char far *)buf;
	  execBlock.fcb1 = (struct fcb far *)&fcb1;
	  execBlock.fcb2 = (struct fcb far *)&fcb2;

	  retval = lowLevelExec((char far*)cmd, (struct ExecBlock far*)&execBlock);
	}

  restoreSession();
				
  return decode_exec_result(retval);
}
예제 #22
0
파일: hout.c 프로젝트: mingpen/OpenNT
VOID NEAR XOutF
(
    LPSTR lpszData
)
{
    CHAR szBuffer[256];

    _fstrcpy(szBuffer, lpszData);	// copy data near

    XOut(szBuffer);			// output it
}
예제 #23
0
/*-----------------------------------------------
   Helper function to keep the title bar and the
   switch entry up to date.
 -----------------------------------------------*/
VOID SetSwitchEntry(HWND hwnd, PSZ szTitleBar, PSZ szFract)
{
    PID pid;
    static SWCNTRL swcntrl;
    static HSWITCH hswitch = NULL;
    HWND hwndFrame;

    hwndFrame = WinQueryWindow (hwnd, QW_PARENT, FALSE);

    if (hswitch == (HSWITCH) NULL) {  /* if first time */

        /* get our process ID for the Switch structure */
        WinQueryWindowProcess(hwndFrame, &pid, NULL);

        /* add/change switch list entry */
        swcntrl.hwnd             = hwndFrame;
        swcntrl.hwndIcon         = (HWND) NULL;
        swcntrl.hprog            = (HPROGRAM) NULL;
        swcntrl.idProcess        = pid;
        swcntrl.idSession        = 0;
        swcntrl.uchVisibility    = SWL_VISIBLE;
        swcntrl.fbJump           = SWL_JUMPABLE;
        _fstrcpy( swcntrl.szSwtitle, szTitleBar);
        strcat( swcntrl.szSwtitle, " - ");
        _fstrcat( swcntrl.szSwtitle, szFract);
        swcntrl.fReserved        = '\0';

        hswitch = WinAddSwitchEntry( &swcntrl );
    }
    else {   /* do an update */
        _fstrcpy( swcntrl.szSwtitle, szTitleBar);
        strcat( swcntrl.szSwtitle, " - ");
        _fstrcat( swcntrl.szSwtitle, szFract);

        WinChangeSwitchEntry( hswitch, &swcntrl);
    }

    /* now put it in the titlebar also */
    WinSetWindowText(hwndFrame, swcntrl.szSwtitle);

}
예제 #24
0
/* -------------------------------------------------------------------
	krb_mk_req - 
	------------------------------------------------------------------- */
int KL_CALLTYPE KL_EXPORT krb_mk_req (KTEXT pKtext, LPSTR lpszServName, 
											LPSTR lpszServInst, LPSTR lpszServRealm, long lChecksum) 
	{
	assert (pKtext != NULL) ;
	
	if (_fstrlen(lpFt->szTicket) == 0)
		return (1) ;
		
	_fstrcpy (pKtext->dat, lpFt->szTicket) ;
	pKtext->length = _fstrlen (lpFt->szTicket) ;
	return (0) ;
	}
예제 #25
0
파일: scanner.c 프로젝트: mingpen/OpenNT
//---------------------------------------------------------------------------
// NewSymNode
//
// This function creates a symbol tree node out of the given symbol.
//
// RETURNS:     Pointer to new node if successful, or NULL if not
//---------------------------------------------------------------------------
SYMNODE * NEAR NewSymNode (LPSTR szSym)
{
    SYMNODE *pTree;

    pTree = (SYMNODE *)LptrAlloc (sizeof(SYMNODE) + lstrlen(szSym));
    if (!pTree)
        return (NULL);
    _fstrcpy (pTree->szSym, szSym);
    pTree->left = pTree->right = NULL;
    pTree->fDef = TRUE;
    return (pTree);
}
예제 #26
0
파일: tsr.c 프로젝트: hirataya/tsr
/* tsr_stay
 * 
 * 解説: プログラムを常駐します
 * 宣言: BOOL tsr_stay(BYTE retcode, WORD idofs, const char *idstr, WORD size);
 * 引数: BYTE retcode --- プログラム終了コード
 *       WORD idofs --- 常駐id文字列の開始オフセット
 *       const char *idstr --- 常駐id文字列
 *       WORD size --- 常駐サイズ(パラグラフ単位)
 * 戻値: BOOL --- TRUE: (成功)  FALSE: 失敗
 * 備考: 常駐に成功するとプログラムに制御が戻ってこないので常にFALSEを返します
 *       idofs+strlen(idstr)<0xFFの条件をプログラマーの責任で満足させる必要
 *       があります
 *       内部で非公開ライブラリー関数_restorezeroを呼び出しています
 *       idofsの推奨値は0x0080または0x0081です
 */
BOOL tsr_stay(BYTE retcode, WORD idofs, const char *idstr, WORD size)
{
	_restorezero();
	
	if(tsr_is_stayed(idofs, idstr))
		return FALSE;
	
	_fstrcpy(MK_FP(_psp, idofs), idstr);
	
	dos_keep(retcode, size);
	
	return FALSE;
}
예제 #27
0
LPSTR   _fdtorna (double dSrcVal, short sDecCnt, LPSTR szTxtBuf)
{
    LPSTR   lpcCvtTxt;
    LPSTR   lpcWrkBuf = szTxtBuf;
    int     iDecPos, iSgnFlg;

    /********************************************************************/
    /********************************************************************/
    if (0.0 == dSrcVal) return (_fstrcpy (szTxtBuf, "0"));

    /********************************************************************/
    /* Convert dSrcVal to string, sDecCnt digits after decimal pt       */
    /********************************************************************/
    lpcCvtTxt = _ffcvt (dSrcVal, sDecCnt, &iDecPos, &iSgnFlg);
    if (iSgnFlg) *lpcWrkBuf++ = '-';

    /********************************************************************/
    /* Adjust iDecPos since fcvt returns < -sDecCnt for small values    */
    /********************************************************************/
    if (iDecPos < -sDecCnt) iDecPos = -sDecCnt;

    /********************************************************************/
    /********************************************************************/
    if (iDecPos <= 0) {
        *lpcWrkBuf++ = '.';
        while (iDecPos++ < 0) *lpcWrkBuf++ = '0';
    } else {
        while (iDecPos-- > 0) *lpcWrkBuf++ = *lpcCvtTxt++;
        *lpcWrkBuf++ = '.';
    }
    _fstrcpy (lpcWrkBuf, lpcCvtTxt);

    /********************************************************************/
    /********************************************************************/
    return (szTxtBuf);
  
}
예제 #28
0
static int get_formula_names(PGENSEL gs)  /* get the fractal formula names */
{
   int numformulas, i;
   FILE *File;
   char msg[81], tempstring[201];

   gs->szSelected[0] = 0;             /* start by declaring failure */
   for (i = 0; i < MAX_SEL; i++) {
      gs->szNames[i][0] = 0;
      }

   _fstrcpy(tempstring, npTempParms.szFormFileName);
   if((File = fopen(tempstring, "rt")) == NULL) {
      sprintf(msg,"I Can't find %s", tempstring);
      stopmsg(1,msg);
      return(-1);
   }

   numformulas = 0;
   while(fscanf(File, " %F20[^ \n\t({]", gs->szNames[numformulas]) != EOF) {
      int c;

      while(c = getc(File)) {
         if(c == EOF || c == '{' || c == '\n')
            break;
      }
      if(c == EOF)
         break;
      else if(c != '\n'){
         numformulas++;
         if (numformulas >= MAX_SEL-1) break;
skipcomments:
         if(fscanf(File, "%200[^}]", tempstring) == EOF) break;
         if (getc(File) != '}') goto skipcomments;
         if (_fstricmp(gs->szNames[numformulas-1],"") == 0 ||
             _fstricmp(gs->szNames[numformulas-1],"comment") == 0)
                 numformulas--;
      }
   }
   fclose(File);

   gs->sCountNames = numformulas;
   /* now sort the names */
   sel_sort(gs);
   return(0);
}
예제 #29
0
static int get_lsys_name(PGENSEL gs)         /* get the Lsystem formula name */
{
   int numformulas, i;
   FILE *File;
   char buf[201], tempstring[201];

   for (i = 0; i < MAX_SEL; i++) {
      gs->szNames[i][0] = 0;
      }

   _fstrcpy(tempstring, npTempParms.szLSysFileName);
   if ((File = fopen(tempstring, "rt")) == NULL) {
      sprintf(buf,"I Can't find %s", tempstring);
      stopmsg(1,buf);
      gs->szSelected[0] = 0;
      return(-1);
      }

   numformulas = 0;
   while (1) {
      int c;
      gs->szNames[numformulas][0] = 0;
      if (fscanf(File, " %F20[^ \n\t({]", gs->szNames[numformulas]) == EOF)
         break;
      while(c = getc(File)) {
         if(c == EOF || c == '{' || c == '\n')
            break;
         }
      if(c == EOF)
         break;
      else if(c != '\n') {
skipcomments:
         if(fscanf(File, "%200[^}]", buf) == EOF) break;
         if (getc(File) != '}') goto skipcomments;
         if (_fstricmp(gs->szNames[numformulas],"") != 0 &&
             _fstricmp(gs->szNames[numformulas],"comment") != 0)
                 if (++numformulas >= MAX_SEL) break;
         }
      }
   fclose(File);

   gs->sCountNames = numformulas;
   /* now sort the names */
   sel_sort(gs);
   return(0);
}
예제 #30
0
/*--------------------------------------------------------------------------
 * Function: _SetMemoryString
 * Expects:  HWND        hDlg
 *           LPDLGVALS   lpDlgVals;
 * Returns:  nothing
 * Purpose:  To Set the static string for the 'Memory display' of the assert
 *           dialog box.
 * History:  11/7/94     Initial Revision (mdh)
 *--------------------------------------------------------------------------
 */
static VOID NEAR PASCAL	_SetMemoryString( HWND hDlg, LPDLGVALS lpdlgVals )
{
	char		szTmp[32];
	SZMSGBUF	szBuf;

	if (lpdlgVals->ulCount > 0)
		{
		_NumToHexStr((long)lpdlgVals->lpvData, szTmp, 8);

		_fstrcpy(szBuf, _szMemoryMessage);
		_fmemmove(&(szBuf[kAddressOffset]), szTmp, _fstrlen(szTmp));

		switch (lpdlgVals->ulFormat)
			{
			case 'b':
			case 'B':
				_FormatBytes(((sBYTE FAR*)lpdlgVals->lpvData), lpdlgVals->ulCount, (sBYTE FAR*)szBuf);
				break;
	
			case 'w':
			case 'W':
				_FormatWords(((sBYTE FAR*)lpdlgVals->lpvData), lpdlgVals->ulCount, (sBYTE FAR*)szBuf);
				break;
	
			case 'l':
			case 'L':
				_FormatLongs(((sBYTE FAR*)lpdlgVals->lpvData), lpdlgVals->ulCount, (sBYTE FAR*)szBuf);
				break;
	
			case 's':
			case 'S':
				_FormatCStr(((sBYTE FAR*)lpdlgVals->lpvData),  szBuf);
				break;
	
			case 'p':
			case 'P':
				_FormatPStr(((sBYTE FAR*)lpdlgVals->lpvData), szBuf);
				break;
			}
		}
	else
		*szBuf = 0;		//	Null terminate the string.
	
	SetWindowText( GetDlgItem( hDlg, DLGID_MEMORYTEXT ), szBuf );
}