home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / 3DTOSHI2.ZIP / mpgui / source / mpgui.cpp < prev   
Encoding:
C/C++ Source or Header  |  1996-03-23  |  1.9 KB  |  107 lines

  1.  
  2. // mpgui.cpp
  3. //
  4. // Copyright (c) 1995 by Toshiaki Tsuji, all rights reserved.
  5.  
  6. #include "stdgfx.h"
  7. #include "mpgui.h"
  8.  
  9. void ProcessArgs ( int argc, char **argv )
  10.   {
  11.     INT i;
  12.     INT Pos=0;
  13.     NumArgs = argc-1;
  14.          for (i=1;i<argc;i++)
  15.       {
  16.         INT j=0;
  17.         while (argv[i][j]!=NULL)
  18.           {
  19.             CmdLine[Pos] = argv[i][j];
  20.             Pos++;
  21.             j++;
  22.           } // End while
  23.         CmdLine[Pos] = ' ';
  24.         Pos++;
  25.       } // End for
  26.   } // End of ProcessArgs
  27.  
  28. void InitApp ()
  29.   {
  30.     InitWinHashTable ();
  31.     #if defined (__FOROS2__)
  32.       hAB = WinInitialize ( 0 );
  33.       hMQ = WinCreateMsgQueue ( hAB, 0 );
  34.     #elif defined (__FORUNIX__)
  35.     #endif
  36.   } // End of InitApp
  37.  
  38. VOID PrepareArg ( STRING args )
  39.   {
  40.     INT i,Pos;
  41.  
  42.     i = 0;
  43.     Pos = 0;
  44.     NumArgs = 0;
  45.     while (args[i]!=NULL)
  46.       {
  47.         while ((args[i]==' '))
  48.           i++;
  49.         if (args[i]==NULL)
  50.           break;
  51.           
  52.         while ((args[i]!=' ')&&(args[i]!=NULL))
  53.           {
  54.             CmdLine[Pos++] = args[i++];  
  55.           } // End while
  56.         NumArgs++;  
  57.         CmdLine[Pos++] = ' ';  
  58.       } // End while
  59.     if (Pos>0)  
  60.       CmdLine[Pos-1] = NULL;
  61.     else
  62.       CmdLine[Pos] = NULL;  
  63.   } // End of PrepareArg
  64.  
  65. LONG GetNumArgs ()
  66.   {
  67.     return NumArgs;    
  68.   } // End of GetNumArgs 
  69.  
  70. VOID GetArg ( LONG Index, STRING Str )
  71.   {
  72.     if (Str==NULL)
  73.       return;
  74.       
  75.     if ((Index>=NumArgs)||(Index<0))
  76.       {
  77.         Str[0] = NULL;  
  78.       } // End if
  79.  
  80.     INT i,Count;
  81.  
  82.     i = 0;
  83.     Count = 0;
  84.     while (Count!=Index)
  85.       {
  86.         if (CmdLine[i]==' ')
  87.           Count++;
  88.         i++;  
  89.       } // End if
  90.  
  91.     INT j;
  92.     j = 0;
  93.     while ((CmdLine[i]!=' ')&&(CmdLine[i]!=NULL))
  94.       Str[j++] = CmdLine[i++];
  95.     Str[j] = NULL;  
  96.   } // End of GetArg
  97.  
  98.   
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.