示例#1
0
void TestCompareF( void )
{
    char            bufA[80] = "FoO baR gOoBeR bLaH";
    char            bufLower[80] = "foo bar goober blah";
    char            bufUpper[80] = "FOO BAR GOOBER BLAH";
    int             status;

    status = _fstrcmp( bufA, bufA );            /* ensure same */
    VERIFY( status == 0 );

    status = _fstrcmp( bufA, bufLower );        /* ensure not same */
    VERIFY( status != 0 );

    status = _fstricmp( bufA, bufUpper );       /* ensure same */
    VERIFY( status == 0 );

    status = _fstricmp( bufA, "foo" );          /* ensure not same */
    VERIFY( status != 0 );

    status = _fstrncmp( bufA, bufA, 100 );      /* ensure same */
    VERIFY( status == 0 );

    status = _fstrncmp( bufA, bufLower, 1 );    /* ensure not same */
    VERIFY( status != 0 );

    status = _fstrnicmp( bufA, bufUpper, 100 ); /* ensure same */
    VERIFY( status == 0 );

    status = _fstrnicmp( bufA, "fOo B!!!", 5 ); /* ensure same */
    VERIFY( status == 0 );

    status = _fstrnicmp( bufA, "fOo B!!!", 6 ); /* ensure not same */
    VERIFY( status != 0 );
}
示例#2
0
/*************************************
*
*  Given a file's full path
*  and a simple file name, see if
*  the filenames match.
*
**************************************/
BOOL __far __pascal DoFileNamesMatch( char __far * szLibFilePath, char __far * szFilePath )
{
  char __far * szSeparator;
  char __far * szLibFileName;
  int nReturn;
  
  
  /* Is the supplied szFilePath is a full path. */
  szSeparator = _fstrrchr( szFilePath, DIR_CHAR_SEPARATOR );
  
  /* If we found a DIR_CHAR_SEPARATOR, then compare as full paths. */
  if( szSeparator != NULL )
  {
    /* Compare the full file paths. */
    nReturn = _fstricmp( szLibFilePath, szFilePath ); 

    if( nReturn == 0 ) return TRUE;
    else return FALSE;
  }
  

  /* 
  ** The supplied szFilePath is not a full path, compare it
  ** to the libraries filename.
  */
  else
  {
    /* Point to the filename in the library's full path. */
    szLibFileName = _fstrrchr( szLibFilePath, DIR_CHAR_SEPARATOR );
    
    /* Could not find the last occurence of the DIR_CHAR_SEPARATOR. */ 
    if( szLibFileName == NULL )  return FALSE;
  
    /* Point to the next char - the lib's filename. */
    szLibFileName++;
    
    /* Compare the file names. */
    nReturn = _fstricmp( szLibFileName, szFilePath ); 
  }

  /* We did not find the library we are looking for. */
  if( nReturn != 0 )  return FALSE;
  
  /* Found match. */
  return( TRUE );
}
示例#3
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);
}
示例#4
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);
}
示例#5
0
int _fFNameCmp( const char FAR *a, const char FAR *b )
/***********************************************************/
{
#if defined( __OS2__ ) || defined( __NT__ ) || defined( __DOS__ )
    return( _fstricmp( a, b ) );
#else
    return( _fstrcmp( a, b ) );
#endif
}
示例#6
0
文件: scanner.c 项目: mingpen/OpenNT
//---------------------------------------------------------------------------
// FindSymbol
//
// This function looks for a symbol in the symbol tree, and returns a pointer
// to the node if found.
//
// RETURNS:     Pointer if found, NULL if not found
//---------------------------------------------------------------------------
SYMNODE * NEAR FindSymbol (SYMNODE *pTree, LPSTR szSym)
{
    register    INT     i;

    if (pTree)
        {
        i = _fstricmp (pTree->szSym, szSym);
        if (!i)
            return (pTree);
        if (i < 0)
            return (FindSymbol (pTree->left, szSym));
        return (FindSymbol (pTree->right, szSym));
        }
    return (NULL);
}
示例#7
0
文件: WIN.CPP 项目: xfxf123444/japan
//************************************************************************//                        
//sort accord ascii, from small to larger
//
//
//************************************************************************//                        
void cwindow::additem(char* szstr)
{       
	_itemnode	*pnew = NULL,*psort = NULL;
    
    m_nitemcount ++;
	pnew = (_itemnode*)malloc(sizeof(_itemnode));		
	pnew->szitemtext = (char *)malloc(_fstrlen(szstr) + 1);
	_fstrcpy(pnew->szitemtext, szstr);
	pnew->pnext = NULL;   
	pnew->ppre = NULL;
	if(m_pitemhead == NULL)//the first create item-link
	{
		m_pitemhead = pnew;
		m_pitemend = pnew;      
		m_pitemactive = pnew;
	}
	else
	{                         
		psort = m_pitemhead;
		while(psort != NULL) 
		{
			if(_fstricmp(szstr, psort->szitemtext) <= 0) break; 
			psort = psort->pnext;
		}
		if(psort != NULL)
		{
			pnew->ppre = psort->ppre;
			if(psort->ppre)
				psort->ppre->pnext = pnew;	
			pnew->pnext = psort;
			psort->ppre = pnew;
			
			if(psort == m_pitemhead) m_pitemactive = m_pitemhead = pnew;
		}
		else
		{
			m_pitemend->pnext = pnew;
			pnew->ppre = m_pitemend;
			m_pitemend = pnew;
		}
	}          
	if(m_nwritedrow <= m_nmaxrows)  writeitem(m_nwritedrow ++, szstr);
}
示例#8
0
文件: scanner.c 项目: mingpen/OpenNT
//---------------------------------------------------------------------------
// AddSymbol
//
// This function adds the given symbol to the symbol tree.
//
// RETURNS:     TRUE if successful, or FALSE if an error occurs.
//---------------------------------------------------------------------------
BOOL NEAR AddSymbol (SYMNODE *pTree, LPSTR szSym)
{
    register    INT     i;

    // Simple binary tree insert code.  If already in tree, set its fDef flag
    // to TRUE.
    //-----------------------------------------------------------------------
    i = _fstricmp (pTree->szSym, szSym);
    if (!i)
        return (pTree->fDef = TRUE);
    if (i < 0)
        {
        if (pTree->left)
            return (AddSymbol (pTree->left, szSym));
        return ((pTree->left = NewSymNode (szSym)) ? TRUE : FALSE);
        }
    if (pTree->right)
        return (AddSymbol (pTree->right, szSym));
    return ((pTree->right = NewSymNode (szSym)) ? TRUE : FALSE);
}
示例#9
0
VOID ViewItems_OnCommand( HWND hwnd,
                          INT  id,
                          HWND hwndCtrl,
                          UINT codeNotify )
{
  INT i, j, n;
  CHAR szBuf[128];
  HWND hwndList;
  LRESULT lResult;

  switch(id)
  {
    case IDC_ITEM_LIST:

      if ( codeNotify == LBN_SELCHANGE )
      {
        ViewItems_ItemChanged( hwnd );
      }
      break;

    case IDC_ITEM_RESOURCES:

      if ( codeNotify == LBN_SELCHANGE )
      {
        lResult = ListBox_GetCurSel( hwndCtrl );

        if ( lResult != LB_ERR )
        {
          ListBox_GetText( hwndCtrl, lResult, szBuf );

          for( j = 0; j < po->nBitmaps; ++j )
          {
            if ( !_fstricmp( szBuf, po->pBitmapData[j].bitmap_name ) )
            {
              break;
            }
          }

          if ( j < po->nBitmaps )
          {
            PreviewBitmap( hwnd,
                           IDC_ITEM_BITMAP_PREVIEW,
                           IDC_ITEM_BITMAP_SIZE,
                           &po->pBitmapData[j],
                           po->pPalette );
          }
          else
          {
            PreviewBitmap( hwnd,
                           IDC_ITEM_BITMAP_PREVIEW,
                           IDC_ITEM_BITMAP_SIZE,
                           NULL,
                           NULL );
          }
        }
      }
      break;

    case IDC_ITEM_PIXEL_SIZE:

      if ( codeNotify == EN_CHANGE )
      {
        lResult = ListBox_GetCurSel( GetDlgItem( hwnd, IDC_ITEM_LIST ) );

        if ( lResult >= 0 && lResult < po->nItems )
        {
          i = (INT)lResult;

          SendMessage( hwndCtrl,
                       WM_GETTEXT,
                       (WPARAM)sizeof(szBuf),
                       (LPARAM)((LPSTR)szBuf) );

          po->pItemData[i].pixel_size = (float)atof( szBuf );

          bChange = TRUE;
        }
      }
      break;

    case IDC_ITEM_NEW:

      i = po->nItems;

      if (i == MAX_ITEMS)
      {
        MsgBox( hwnd,
                MB_ICONEXCLAMATION,
                "The limit of %d items has been reached.",
                MAX_ITEMS );

        break;
      }

      _fmemset( szNewItemName, 0, sizeof(szNewItemName) );
      _fmemset( nNewIndex, 0, sizeof(nNewIndex) );
      nNewItemType = -1;
      dNewPixelSize = 15.62;

      for(j = 0; j < MAX_ELEMENTS; ++j)
      {
        nNewIndex[j] = -1;
      }

      if (EditItemDialog(hwnd) == IDCANCEL)
      {
        break;
      }

      hwndList = GetDlgItem(hwnd, IDC_ITEM_LIST);

      ListBox_AddString(hwndList, szNewItemName);

      _fmemset(&po->pItemData[i], 0, sizeof(ITEM_DATA));
      _fstrcpy(po->pItemData[i].item_name, szNewItemName);
      po->pItemData[i].pixel_size = (float)dNewPixelSize;
      po->pItemData[i].item_type = nNewItemType;

      n = GetNumItemElements(nNewItemType);

      for(j = 0; j < n; ++j)
      {
        po->pItemData[i].index[j] = nNewIndex[j];
      }

      ++po->nItems;

      ListBox_SetCurSel(hwndList, i);
      ViewItems_ItemChanged(hwnd);

      bChange = TRUE;

      break;

    case IDC_ITEM_DELETE:

      hwndList = GetDlgItem( hwnd, IDC_ITEM_LIST );

      lResult = ListBox_GetCurSel( hwndList );

      if ( lResult >= 0 && lResult < po->nItems )
      {
        i = (INT)lResult;
        Object_DeleteItem( po, i );
        ListBox_DeleteString( hwndList, i );

        if ( i == 0 )
          ListBox_SetCurSel( hwndList, 0 );
        else
          ListBox_SetCurSel( hwndList, i - 1 );

        ViewItems_ItemChanged( hwnd );

        bChange = TRUE;
      }

      break;

    case IDC_ITEM_EDIT:

      hwndList = GetDlgItem( hwnd, IDC_ITEM_LIST );

      lResult = ListBox_GetCurSel( hwndList );

      if ( lResult >= 0 && lResult < po->nItems )
      {
        i = (INT)lResult;

        _fstrcpy( szNewItemName, po->pItemData[i].item_name );
        dNewPixelSize = (double)po->pItemData[i].pixel_size;
        nNewItemType = po->pItemData[i].item_type;

        n = GetNumItemElements( nNewItemType );

        for( j = 0; j < n; ++j )
        {
          nNewIndex[j] = po->pItemData[i].index[j];
        }

        if ( EditItemDialog( hwnd ) == IDCANCEL )
        {
          break;
        }

        if ( !szNewItemName[0] )
        {
          MsgBox( hwnd,
                  MB_ICONEXCLAMATION,
                  "The item must be given a name." );

          break;
        }

        _fmemset( &po->pItemData[i], 0, sizeof(ITEM_DATA) );
        _fstrcpy( po->pItemData[i].item_name, szNewItemName );
        po->pItemData[i].pixel_size = (float)dNewPixelSize;
        po->pItemData[i].item_type = nNewItemType;

        n = GetNumItemElements( nNewItemType );

        for( j = 0; j < n; ++j )
        {
          po->pItemData[i].index[j] = nNewIndex[j];
        }

        j = ListBox_GetTopIndex(hwndList);

        ListBox_ResetContent(hwndList);

        for( i = 0; i < po->nItems; ++i )
        {
          ListBox_AddString( hwndList, po->pItemData[i].item_name );
        }

        ListBox_SetTopIndex( hwndList, j );
        ListBox_SetCurSel( hwndList, (INT)lResult );

        ViewItems_ItemChanged( hwnd );

        bChange = TRUE;
      }

      break;
      
    case IDOK: case IDCANCEL:

      if ( hPalCommon )
      {
        DeleteObject( hPalCommon );
        hPalCommon = NULL;
      }

      EndDialog( hwnd, IDOK );
      break;
  }
  
} // ViewItems_OnCommand
示例#10
0
long __far __pascal __export SDKWndProc( HWND hWnd, WORD Msg, WORD wParam, LONG lParam )
{
  CREATESTRUCT __far * lpCreateStruct;   /* Data passed in LPARAM. */
  HWND __far * hTwinViewWnd;             /* Handle to the TWINVIEW.EXE main window. */

  HWNDDATA        hWndData ;             /* Handle to window extrabyte data. */
  FPWNDDATA       fpWndData ;            /* Pointer to window extrabyte data. */
  
  char lpszClassName[ MAX_CLASS_NAME ];  /* Name of a window's class. */
  
  HWND hHelpWnd;                         /* Handle to a help window. */

  
  /* 
  ** Handle WinHelp special messages - WM_WINDOC & WM_WINHELP. 
  */

  if( Msg == GetWINHELPMsg() || Msg == GetWINDOCMsg() )
  {
    /* Get window list. */
    hWndData = (HWNDDATA) GetWindowWord (hWnd, TVL_WNDEXTRABYTES ) ;
    fpWndData = (FPWNDDATA) GlobalLock( hWndData );

    /* Get/create the application's help window. */
    hHelpWnd = GetHelpWindow( hWnd, (HWND) wParam, &(fpWndData)->hWndInfoList );
          
    /* Send message to correct help window. */  
    if( hHelpWnd != 0 )
    {
      /* Route the message to the correct help window. */
      SendMessage( hHelpWnd, Msg, wParam, lParam );
    }

    return 0 ;
  }


  /* 
  ** Other Windows messages. 
  */
  switch (Msg)
  {
    case WM_CREATE:
    {
      /* Allocate memory for window private data. */
      hWndData = GlobalAlloc ( LMEM_MOVEABLE | LMEM_ZEROINIT, sizeof (WNDDATA) ) ;
                              
      /* Error retrieving memory. */
      if ( hWndData == NULL ) 
      {
        /* Allocation error. */ 
        MsgBox( GetLibInst(), hWnd, IDS_ERRORTITLE, IDS_MEMORYALLOC, MB_ICONHAND | MB_OK );
        return -1;
      }

      /* Initialize the window data. */
      fpWndData = (FPWNDDATA) GlobalLock( hWndData );
      fpWndData->hTwinViewWnd = 0;
      fpWndData->hWndInfoList = 0;
      GlobalUnlock( hWndData );

      /* Save handle to allocated window data. */
      SetWindowWord ( hWnd, TVL_WNDEXTRABYTES, (WORD) hWndData ) ;
        
      /*
      ** If we are running under TWINVIEW.EXE when the last help 
      ** window is tell TWINVIEW.EXE to close also.  To do this we
      ** will need to save the window handle for TWINVIEW.EXE's 
      ** main window.
      */

      /* Get class of window. */
      GetClassName( hWnd, (LPSTR) lpszClassName, MAX_CLASS_NAME );

      /* 
      ** If we were launched by TWINVIEW.EXE, via a MS-Windows
      ** WinHelp() call, save TWINVIEW's window handle? 
      */
      if( _fstricmp( lpszClassName, MS_WINHELP_CLASS ) == 0 )
      {
        /* Get TWINVIEW's window handle.*/
        lpCreateStruct = ( CREATESTRUCT __far * ) lParam;
        hTwinViewWnd = ( HWND __far * ) lpCreateStruct->lpCreateParams;
      
        /* Save TWINVIEW's window handle.*/
        fpWndData = (FPWNDDATA) GlobalLock( hWndData );
        fpWndData->hTwinViewWnd = *hTwinViewWnd;
        GlobalUnlock( hWndData );
      }
            
      /* Success. */
      return 0;
    }
    
    
    /* 
    ** A help window closed - see if we should close this main redirector 
    ** window. 
    */
    case HELPWM_CLOSE:
    {
      /* Get window list. */
      hWndData = (HWNDDATA) GetWindowWord (hWnd, TVL_WNDEXTRABYTES ) ;
      fpWndData = (FPWNDDATA) GlobalLock( hWndData );
      
      /* Remove the window from the list. */
      RemoveHelpWndInfo( &(fpWndData)->hWndInfoList, (HWND) wParam );
          
      /* Still have help windows under this window. */
      if( GetHelpWndCount( fpWndData->hWndInfoList ) != 0 ) 
      {
        GlobalUnlock( hWndData );
        return 0;
      }
      
      /* 
      ** Last help window - close this parent window. 
      */
      
      /* 
      ** If we were launched by TWINVIEW.EXE, via a MS-Windows
      ** WinHelp() call, close down TWINVIEW.EXE.
      */
      GetClassName( hWnd, (LPSTR) lpszClassName, MAX_CLASS_NAME );
          
      if( _fstricmp( lpszClassName, MS_WINHELP_CLASS ) == 0 )
      {
        /* Tell twinview to close down. */
        PostMessage( fpWndData->hTwinViewWnd, WM_SYSCOMMAND, SC_CLOSE, 0L );
      }
                
      GlobalUnlock( hWndData );
              
      /* Destroy the window. */
      DestroyWindow( hWnd ) ;
              
      return 0;
    }

    
    case WM_DESTROY:
    {
      hWndData = (HWNDDATA) GetWindowWord (hWnd, TVL_WNDEXTRABYTES ) ;
      GlobalFree ( hWndData ) ;
      return 0 ; 
    }
  }

  // Pass unprocessed message to DefWindowProc
  return DefWindowProc (hWnd, Msg, wParam, lParam) ;
}
示例#11
0
/*************************************
*
*  Search for a file in the following places:
*  - Current dir.
*  - /WINDOWS 
*  - /WINDOWS/SYSTEM
*  - All directories listed in the system's $PATH$ variable.
*
*  Call EnumFilesProc() if a matching file is found.
*
**************************************/
BOOL __export __far __pascal EnumFiles( char __far * szWildName, FILESENUMPROC EnumFilesProc, LPARAM lParam, BOOL Yield )
{
  char szWinDir[_MAX_PATH];
  char szWinSysDir[_MAX_PATH];
  char szCurrentDir[_MAX_PATH];

  char szDir[_MAX_PATH];
  char szFilePath[_MAX_PATH];
  char szPathCopyBuffer[_MAX_PATH];

  char __far * szPathCopy;
  char __far * szPath;
  char __far * szNextPath;

  struct _find_t FileInfo;

  int nPhase, nResult;

  BOOL bCallBack;
  
  MSG Msg;              // Storage for messages pulled from windows message
                        // queue.   
                        
  short int LastCharPos;
  
  
  /* Each phase equates to a different search path. */
    
  for( nPhase = 1; nPhase < 5; nPhase ++ )
  {
    /* If we should let other applications execute. */
    if( Yield )
    {
      while ( PeekMessage( &Msg, NULL, NULL, NULL, PM_REMOVE ) )
      {
        TranslateMessage( &Msg );
        DispatchMessage( &Msg );
      }
    }
    
    switch( nPhase )
    {
      /* PHASE 1: use current directory.  */
      case 1: 
        getcwd( szDir, _MAX_PATH );
        _fstrcpy( szCurrentDir, szDir );
        break;

      /* PHASE 2: use windows directory */
      case 2: 
        GetWindowsDirectory( szDir, _MAX_PATH);
        _fstrcpy( szWinDir, szDir );
        break;

      /* PHASE 3: use windows\system directory */
      case 3: 
        GetSystemDirectory( szDir, _MAX_PATH);
        _fstrcpy( szWinSysDir, szDir );
        break;
    } 


    /* For Phases #1 - #3. */
    if( nPhase < 4 )
    {
      if( FindFile( szDir, szWildName, &FileInfo ) )
      {
        /* Start with file's path. */
        _fstrcpy( szFilePath, szDir );
        
        /* Is there already a dir. separator? */
        LastCharPos = ( _fstrlen( szFilePath ) / sizeof(char) ) - 1;
        if( szFilePath[LastCharPos] != DIR_CHAR_SEPARATOR )
        {
          _fstrcat( szFilePath, DIR_STRING_SEPARATOR );
        }
  
        /* Use filename. */
        _fstrcat( szFilePath, FileInfo.name );
        
        /* Call EnumFilesProc() callback function. */
        bCallBack = ( *EnumFilesProc )( szFilePath, lParam ); 
        
        /* Does callback tell us to quit. */
        if( !bCallBack ) return TRUE;
        
        /* Any more file? */
        while( FindFile( NULL, NULL, &FileInfo ) )
        {
          /* Start with file's path. */
          _fstrcpy( szFilePath, szDir );
          
          /* Is there already a dir. separator? */
          LastCharPos = ( _fstrlen( szFilePath ) / sizeof(char) ) - 1;
          if( szFilePath[LastCharPos] != DIR_CHAR_SEPARATOR )
          {
            _fstrcat( szFilePath, DIR_STRING_SEPARATOR );
          }
    
          /* Use filename. */
          _fstrcat( szFilePath, FileInfo.name );
        
          /* Call EnumFilesProc() callback function. */
          bCallBack = ( *EnumFilesProc )( szFilePath, lParam ); 
          
          /* Does callback tell us to quit. */
          if( !bCallBack ) return TRUE;
        } 
      }
    }


    /* For Phase #4 - Use PATH. */
    else
    {
      /* Is there a WIN_PATH set? */
      szPath = getenv("WIN_PATH");
      
      /* If no WIN_PATH set, use standard PATH variable. */
      if( szPath == NULL ) szPath = getenv( "PATH" );
    
      /* If we have some path to search. */
      if( szPath != 0)
      {
        /* Make a copy of the path so that we can change with the copy. */
        lstrcpy( (LPSTR) szPathCopyBuffer, (LPSTR) szPath );
        szPathCopy = szPathCopyBuffer;
        
        /* Walk the path... */
        for( szNextPath = szPathCopy; szNextPath && *szNextPath; szNextPath = szPathCopy) 
        {
          /* If we should let other applications execute. */
          if( Yield )
          {
            while ( PeekMessage( &Msg, NULL, NULL, NULL, PM_REMOVE ) )
            {
              TranslateMessage( &Msg );
              DispatchMessage( &Msg );
            }
          }
          
          /* Get the next element in the path and terminate it */
          szPathCopy = strchr( szNextPath, AUTOEXEC_PATH_DELIMITER );
          if( szPathCopy )
          {
            *szPathCopy = 0;  /* End the current part. */
            szPathCopy++;     /* Point to the next one. */
          }
    
          /* If it's a directory that we've already visited - skip search. */
          nResult = _fstricmp( szNextPath, szWinDir );   /* \Windows dir. */
          if( nResult == 0 ) continue;
          nResult = _fstricmp( szNextPath, szWinSysDir );   /* \Windows\System dir. */
          if( nResult == 0 ) continue;
          nResult = _fstricmp( szNextPath, szCurrentDir );   /* Original dir. */
          if( nResult == 0 ) continue;

          if( FindFile( szNextPath, szWildName, &FileInfo ) )
          {
            /* Start with file's path. */
            _fstrcpy( szFilePath, szNextPath );
            
            /* Is there already a dir. separator? */
            LastCharPos = ( _fstrlen( szFilePath ) / sizeof(char) ) - 1;
            if( szFilePath[LastCharPos] != DIR_CHAR_SEPARATOR )
            {
              _fstrcat( szFilePath, DIR_STRING_SEPARATOR );
            }
      
            /* Use filename. */
            _fstrcat( szFilePath, FileInfo.name );
        
            /* Call EnumFilesProc() callback function. */
            bCallBack = ( *EnumFilesProc )( szFilePath, lParam ); 
            
            /* Does callback tell us to quit. */
            if( !bCallBack ) return TRUE;
        
            while( FindFile( NULL, NULL, &FileInfo ) )
            {
              /* Start with file's path. */
              _fstrcpy( szFilePath, szNextPath );
              
              /* Is there already a dir. separator? */
              LastCharPos = ( _fstrlen( szFilePath ) / sizeof(char) ) - 1;
              if( szFilePath[LastCharPos] != DIR_CHAR_SEPARATOR )
              {
                _fstrcat( szFilePath, DIR_STRING_SEPARATOR );
              }
        
              /* Use filename. */
              _fstrcat( szFilePath, FileInfo.name );
        
              /* Call EnumFilesProc() callback function. */
              bCallBack = ( *EnumFilesProc )( szFilePath, lParam ); 
              
              /* Does callback tell us to quit. */
              if( !bCallBack ) return TRUE;
            } 
          }
        }
      }
    }
  } /* for loop. */
  
  
  /* Return success. */
  return( TRUE );
}
示例#12
0
//------------------------------------------------------------------------
// PreDemo()
//------------------------------------------------------------------------
void PreDemo()
{
#if !SKIP_TITLE_AND_CREDITS
#if TECH_SUPPORT_VERSION

	fontnumber=4;
	SETFONTCOLOR(0,15*3);
	CenterWindow (26,7);
	US_Print(EnterBetaCode);
	VW_UpdateScreen();
	CA_LoadAllSounds();
	PM_CheckMainMem();
	SD_PlaySound(INFORMDEATH2SND);		// Nooooo!
	IN_UserInput(TickBase*20);
	ClearMemory();

#elif BETA_TEST

	boolean param=false;

	for (i=1; i<g_argc; i++)
		switch (US_CheckParm(g_argv[i],MainStrs))
		{
			case 13:
				param=true;
			break;
		}

	if (!param)
	{
		char buffer[15] = {0};

		fontnumber=4;
		CenterWindow (26,7);
		US_Print(EnterBetaCode);
		VW_UpdateScreen();
		SETFONTCOLOR(0,15*3);
		US_LineInput(24*8,92,buffer,buffer,true,14,100);
		if (_fstricmp(buffer,bc_buffer))
			Quit("Bad beta code!");
	}
#endif



#if GAME_VERSION == SHAREWARE_VERSION
#if IN_DEVELOPMENT || GEORGE_CHEAT
	if (!MS_CheckParm("nochex"))
#endif
	{
#if  (!SKIP_CHECKSUMS)
//	CheckValidity("MAPTEMP.",MAPTEMP_CHECKSUM,"LEVELS");
	CheckValidity("MAPTEMP.",MAPTEMP_CHECKSUM);
#endif
	}
#else
#if  (!SKIP_CHECKSUMS)
	if (ChecksumFile("FILE_ID.DIZ",0) != DIZFILE_CHECKSUM)
		gamestate.flags |= GS_BAD_DIZ_FILE;
#endif
#endif

	VL_SetPaletteIntensity(0,255,vgapal,0);

	if (!(gamestate.flags & GS_NOWAIT))
	{
#if (0)				// GAME_VERSION != SHAREWARE_VERSION
//---------------------
// Anti-piracy screen
//---------------------
	// Cache pic
	//
		CA_CacheScreen(PIRACYPIC);

	// Cache and set palette.  AND  Fade it in!
	//
		CA_CacheGrChunk(PIRACYPALETTE);
		VL_SetPalette (0,256,grsegs[PIRACYPALETTE]);
		VL_SetPaletteIntensity(0,255,grsegs[PIRACYPALETTE],0);
		VW_UpdateScreen();

		VL_FadeOut (0, 255, 0, 0, 25, 20);
		VL_FadeIn(0,255,grsegs[PIRACYPALETTE],30);

	// Wait a little
	//
		IN_UserInput(TickBase*20);

	// Free palette
	//
		UNCACHEGRCHUNK(PIRACYPALETTE);

		VL_FadeOut (0, 255, 0, 0, 25, 20);
		VW_FadeOut();

	// Cleanup screen for upcoming SetPalette call
	//
		{
		Uint16 old_bufferofs=bufferofs;

		bufferofs=displayofs;
		VL_Bar(0,0,320,200,0);
		bufferofs=old_bufferofs;
		}
#endif

//---------------------
// Apogee presents
//---------------------
        // ISG --> this fixes intro timing
        IN_UserInput(TickBase*1);
        
	// Cache pic
	//
		CA_CacheScreen(APOGEEPIC);

	// Load and start music
	//
		CA_CacheAudioChunk(STARTMUSIC+APOGFNFM_MUS);

        ::SD_StartMusic(APOGFNFM_MUS);

	// Cache and set palette.  AND  Fade it in!
	//
		CA_CacheGrChunk(APOGEEPALETTE);
		VL_SetPalette (0,256,static_cast<const Uint8*>(grsegs[APOGEEPALETTE]));
		VL_SetPaletteIntensity(0,255,static_cast<const Uint8*>(grsegs[APOGEEPALETTE]),0);
		VW_UpdateScreen();
    
		VL_FadeOut (0, 255, 25, 29, 53, 20);
		VL_FadeIn(0,255,static_cast<const Uint8*>(grsegs[APOGEEPALETTE]),30);

	// Wait for end of fanfare
	//
		if (MusicMode==smm_AdLib)
		{
			IN_StartAck();
			while ((!sqPlayedOnce) && (!IN_CheckAck()));
      }
		else
			IN_UserInput(TickBase*6);

		SD_MusicOff();

	// Free palette and music.  AND  Restore palette
	//
		UNCACHEGRCHUNK(APOGEEPALETTE);

        delete [] audiosegs[STARTMUSIC + APOGFNFM_MUS];
        audiosegs[STARTMUSIC + APOGFNFM_MUS] = NULL;

      // Do A Blue Flash!

      VL_FadeOut (0, 255, 25, 29, 53, 20);
      VL_FadeOut (0, 255, 0, 	0,  0,  30);

//---------------------
// JAM logo intro
//---------------------
	// Load and start music
	//
		CA_CacheAudioChunk(STARTMUSIC+TITLE_LOOP_MUSIC);
        ::SD_StartMusic(TITLE_LOOP_MUSIC);

	// Show JAM logo
	//
		if (!DoMovie(mv_intro,0))
			MAIN_ERROR(PREDEMO_NOJAM);

		if (PowerBall)
      {
      	Sint16 i;

			for (i=0;i<60 && (!DebugOk);i++)
   	   {
      		VL_WaitVBL(1);

            // BBi
            ::in_handle_events();

				if (Keyboard[sc_left_shift] && Keyboard[sc_right_shift])
		      {
					CA_LoadAllSounds();

					SD_MusicOff();

                   ::sd_play_player_sound(SHOOTDOORSND, bstone::AC_ITEM);

		         SD_WaitSoundDone();

				   ClearMemory();
		      	DebugOk = 1;

					CA_CacheAudioChunk(STARTMUSIC+TITLE_LOOP_MUSIC);
                    ::SD_StartMusic(TITLE_LOOP_MUSIC);
      		}
         }
      }

//---------------------
// PC-13
//---------------------
		VL_Bar(0,0,320,200,0x14);
		CacheDrawPic(0,64,PC13PIC);
		VW_UpdateScreen();
		VW_FadeIn();
		IN_UserInput(TickBase*2);

      // Do A Red Flash!

      VL_FadeOut (0, 255, 39, 0, 0, 20);
		VW_FadeOut();
	}
#endif // SKIP_TITLE_AND_CREDITS
}