Exemple #1
0
//-----------------------------------------------------------------------------  
// NewSymbolVar - Add new var to current context.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
static Var *NewSymbolVar(Context *co, char *Name)
{  Symbol *s;
   Var *v;
//   static int ID = 0;
   
   CodeOutput(VERBOSE_L, "// NewSymbolVar Name: %s\n", Name);
   
   s = NewSymbol(co);
   s->Name = CreateName(Name);
   s->Type = S_VAR;

   v = malloc(sizeof(Var));
   assert(v != NULL);

   s->details = v;
   
//   p->ID    = ID++;

   v->Type        = 0;     // undetermined type    
   v->ArraySize   = 0;     // not an array, -1 = undetermined size.
   v->CallMethod  = 0;     // 0 = not a param, 'v' = value, 'r' = reference, 'c' = code
   
   v->put         = NULL;   
   v->get         = NULL;   
   v->data        = NULL;   
   v->size        = 1;     // size in bytes, bit values are rounded up.
   v->p1          = 0;
   v->p2          = 0;

   return v;
}
Exemple #2
0
//-----------------------------------------------------------------------------    
// SymbolVarAdd_GetName -
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SymbolVarAdd_GetName(Context *co, char *BaseName, char *GetName)
{  Var *v;

   v = SymbolGetOrNewVar(co, BaseName);
   v->get = CreateName(GetName);
   
}
Exemple #3
0
//----------------------------------------------------------------------------- 
// NewSymbolAlias - add an ALIAS record to symbol table
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
Symbol *NewSymbolAlias(Context *co, char *AliasName, char *AliasTarget)
{  Symbol *s;
   SymbolFunction *f;

   Symbol *Target;

   // make sure alias name does not exists
   s = GetSymbolPointer(co, AliasName, S_ALL, 1);   
   if (s != NULL) {
      printf("warning adding alias '%s' - Symbol already exists\n", AliasName);
      CodeOutput(VERBOSE_ALL, "// waring adding alias '%s' - Symbol already exists\n", AliasName);
//      ErrorCount++;
//      return NULL;
   }

   // find alias target
   Target = GetSymbolPointer(co, AliasTarget, S_ALL, 1);   
   if (Target == NULL) {
      printf("Error adding alias '%s' - Target '%s' does not exist\n", AliasName, AliasTarget);
      CodeOutput(VERBOSE_ALL, "// Error adding alias '%s' - Target '%s' does not exist\n", AliasName, AliasTarget);
      ErrorCount++;
      return NULL;
   }

   // add alias      
   s = NewSymbol(co);
   s->Name = CreateName(AliasName);
   s->Type = S_ALIAS;
   s->details = Target;  // details points to symbol record.
   
   return s;
}
Exemple #4
0
int main
(
    int       argc,
    char     *argv[]
)
{
    long      argument;
    size_t    numberOfKeywords;
    size_t    index;
    char      metadataVariableName[64]; 

    if( argc > 1 )
    {
        argument = atol( argv[ 1 ] );
        numberOfKeywords = sizeof( metadataKeyword ) / sizeof( char * ); 

        printf( "\n" );
        index = 0;
        argument = argument >> 2;
        while( ( index < numberOfKeywords ) && ( argument > 0 ) )
        {
            if( ( argument & 0x1L ) == 0x01L )
            {
                CreateName( metadataVariableName, index, '1' );
                printf( "## %s: \"This is the value of metadata variable: %s\"\n", metadataKeyword[ index ], metadataVariableName );
            }
            argument = argument >> 2;
            index++;
        }
        printf( "# \n");
        printf( "# This is a comment for automatically generated basefile\n" );
        printf( "# \n");
        printf( "TESTVARIABLE=ShiftRegister of basefile\n\n");
    }
Exemple #5
0
/**
 * @brief VSpline constructor.
 * @param p1 first point spline.
 * @param p4 last point spline.
 * @param angle1 angle from first point to first control point.
 * @param angle2 angle from second point to second control point.
 * @param kCurve coefficient of curvature spline.
 * @param kAsm1 coefficient of length first control line.
 * @param kAsm2 coefficient of length second control line.
 */
VSpline::VSpline (VPointF p1, VPointF p4, qreal angle1, qreal angle2, qreal kAsm1, qreal kAsm2, qreal kCurve,
                  quint32 idObject, Draw mode)
    :VAbstractCurve(GOType::Spline, idObject, mode), p1(p1), p2(QPointF()), p3(QPointF()), p4(p4), angle1(angle1),
      angle2(angle2), kAsm1(kAsm1), kAsm2(kAsm2), kCurve(kCurve)
{
    CreateName();

    this->p1 = p1;
    this->p4 = p4;
    this->angle1 = angle1;
    this->angle2 = angle2;
    this->kAsm1 = kAsm1;
    this->kAsm2 = kAsm2;
    this->kCurve = kCurve;

    qreal L = 0, radius = 0, angle = 90;
    QPointF point1 = GetP1().toQPointF();
    QPointF point4 = GetP4().toQPointF();
    radius = QLineF(point1, point4).length()/1.414213;//1.414213=sqrt(2);
    L = kCurve * radius * 4 / 3 * tan( angle * M_PI / 180.0 / 4 );
    QLineF p1p2(GetP1().x(), GetP1().y(), GetP1().x() + L * kAsm1, GetP1().y());
    p1p2.setAngle(angle1);
    QLineF p4p3(GetP4().x(), GetP4().y(), GetP4().x() + L * kAsm2, GetP4().y());
    p4p3.setAngle(angle2);
    this->p2 = p1p2.p2();
    this->p3 = p4p3.p2();
}
Exemple #6
0
//-----------------------------------------------------------------------------
// SymbolVarAdd_PutName - set PutName value of pseudo-var
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SymbolVarAdd_PutName(Context *co, char *BaseName, char *PutName)
{  Var *v;

   CodeOutput(VERBOSE_L, "// SymbolVarAdd_PutName BaseName: %s, PutName: %s\n", BaseName, PutName);

   v = SymbolGetOrNewVar(co, BaseName);                                              
   assert(v != NULL); // Error: PutName pointer v is NULL
   
   v->put = CreateName(PutName);   
}
Exemple #7
0
//-----------------------------------------------------------------------------   
// SymbolVarAdd_DataName - lookup/create record and add name
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
Var *SymbolVarAdd_DataName(Context *co, char *BaseName, char *DataName)
{  Var *v;

   CodeOutput(VERBOSE_L, "\n// SymbolVarAdd_DataName Base: %s, Data: %s\n", BaseName, DataName);

   v = SymbolGetOrNewVar(co, BaseName);                       
   
   v->data =CreateName(DataName);
   
   return v;
} 
bool Component::SetupFromXml( const tinyxml2::XMLElement* pNode )
{
	if(pNode)
	{
		const char* pTextName = pNode->Attribute("Name");		
		if (pTextName && strlen(pTextName) > 0)
		{
			m_szTextName = pTextName;
			m_oName = ObjectId(pTextName);
			return true;
		}
		else
		{
			CreateName();
		}

		return true;
	}

	return false;
}
void CRegionCloner::CloneCommonCards()
{
	STablemapRegion region_to_be_cloned;
	if (!p_tablemap_access->GetTableMapRegion("region_to_be_cloned", &region_to_be_cloned))
	{
		return;
	}
	CalculateLinearRegions(region_to_be_cloned, k_number_of_community_cards);
	for (int i=0; i<k_number_of_community_cards; i++)
	{	
		STablemapRegion new_region;
		ApplyNextLinearRegionPosition(&new_region, i);

		new_region.name = CreateName("c0cardface", i, "");
		new_region.color = region_to_be_cloned.color;
		new_region.radius = region_to_be_cloned.radius;
		new_region.transform = region_to_be_cloned.transform;

		p_tablemap->r$_insert(new_region);

		theApp.m_TableMapDlg->UpdateDisplayOfAllRegions();
	}
}
Exemple #10
0
/**
 * @brief VSpline constructor.
 * @param p1 first point spline.
 * @param p2 first control point.
 * @param p3 second control point.
 * @param p4 second point spline.
 */
VSpline::VSpline (VPointF p1, QPointF p2, QPointF p3, VPointF p4, qreal kCurve, quint32 idObject, Draw mode)
    :VAbstractCurve(GOType::Spline, idObject, mode), p1(p1), p2(p2), p3(p3), p4(p4), angle1(0), angle2(0), kAsm1(1),
      kAsm2(1), kCurve(1)
{
    CreateName();

    this->p1 = p1;
    this->p2 = p2;
    this->p3 = p3;
    this->p4 = p4;
    this->angle1 = QLineF ( GetP1().toQPointF(), p2 ).angle();
    this->angle2 = QLineF ( GetP4().toQPointF(), p3 ).angle();

    qreal L = 0, radius = 0, angle = 90;
    QPointF point1 = GetP1().toQPointF();
    QPointF point4 = GetP4().toQPointF();
    radius = QLineF(point1, point4).length()/1.414213;//1.414213=sqrt(2);
    L = kCurve * radius * 4 / 3 * tan( angle * M_PI / 180.0 / 4 );

    this->kCurve = kCurve;
    this->kAsm1 = QLineF ( GetP1().toQPointF(), p2 ).length()/L;
    this->kAsm2 = QLineF ( GetP4().toQPointF(), p3 ).length()/L;
}
void CRegionCloner::CloneCircularCloneableRegions()
{
	CalculateCircularRegionsForFirstCloneableObject();

	STablemapRegion region_to_be_cloned;
	for (int i = 0; i<k_number_of_circular_cloneable_regions; i++)
	{
		// Clone a single region;
		if (!p_tablemap_access->GetTableMapRegion(
			circular_cloneable_regions[i][0], // name of region
			&region_to_be_cloned))
		{
			continue;
		}
		CalculateDistanceToFirstCloneableRegion(region_to_be_cloned);

		// Start with player 1 and keep player 0 as is
		for (int p=1; p<k_max_number_of_players; p++)
		{	
			STablemapRegion new_region;
			ApplyNextCircularRegionPosition(region_to_be_cloned, &new_region, p);

			new_region.name = CreateName( 
				circular_cloneable_regions[i][1],   // prefix
				p,									// player number
				circular_cloneable_regions[i][2]);  // postfix
			new_region.color = region_to_be_cloned.color;
			new_region.radius = region_to_be_cloned.radius;
			new_region.transform = region_to_be_cloned.transform;

			p_tablemap->r$_insert(new_region);

			theApp.m_TableMapDlg->UpdateDisplayOfAllRegions();
		}
	}
}
Exemple #12
0
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
pANTLR3_INPUT_STREAM JalOpenInclude(char *Line) 
{  int State, i;
   char *BaseName;                       
   char FileName[MAX_FILENAME_SIZE];  
   char FilePath[MAX_FILENAME_SIZE];
   IncludeNameList *Inl;
   
   pANTLR3_INPUT_STREAM    in;

   if (NoInclude) {
      CodeOutput(VERBOSE_M, "// Ignore include line %s\n", Line);
      return NULL;
   }
   
//   printf("// JalInclude line: %s\n", Line);

   //---------------------------------------------
   // extract filename from include statement line
   //---------------------------------------------
   State = 0;
   for (i=0; ((Line[i] != 0)&(State != 3)); i++) {
      switch(State) {
         case 0 : { // search for first whitespace
            if ((Line[i] == ' ') | (Line[i] == '\t')) {
               State = 1;
            }
            break;  
         }          
         case 1 : { // search for non-whitespace, which is start of filename/path
            if ((Line[i] != ' ') & (Line[i] != '\t')) {
               BaseName = &Line[i];
               State = 2;
            }
            break;  
         }          
         case 2 : { // search for first whitespace, which is end of filename/path
            if ((Line[i] == ' ') | (Line[i] == '\t') | (Line[i] == '\r') | (Line[i] == '\n')) {
               Line[i] = 0; // terminate string
               State = 3;
            }
            break;  
         }               
         default : {
            CodeOutput(VERBOSE_ALL, "Error state: %d, i: %d\n", State, i);     
            break;
         }
      }
   }
   CodeOutput(VERBOSE_M, "// include BaseName: _%s_\n", BaseName);   

   // base filename retrieved.
   sprintf(FileName, "%s.jal", BaseName);

   //------------------------------------------
   // check if file is already included
   //------------------------------------------
   Inl = InlRoot;
   while (Inl) {
      if (strcmp(BaseName, Inl->FileName) == 0) {
         // file found
         CodeOutput(VERBOSE_M, "// File '%s' already included, so ignore now\n", BaseName);
         return NULL;
      }              
      Inl = Inl->Next;
   }
   // not found, so add
   Inl = malloc(sizeof(IncludeNameList));
   Inl->Next = InlRoot;
   Inl->FileName = CreateName(BaseName);
   InlRoot = Inl;
   

   //------------------------------------------
   // try to open filename at current location.
   //------------------------------------------
   strcpy(FilePath, FileName);
   CodeOutput(VERBOSE_L, "// Try first %s \n", FilePath); 
   in = antlr3AsciiFileStreamNew(FilePath);

   if (in == NULL) {
      //------------------------------------------
      // file not at current location, so
      // walk include path to find file.                                  
      //------------------------------------------
   GetIncludePath(NULL, 1); // reset include path   
      for (;;) {
         if (GetIncludePath(FilePath, 0)) {
            // got a path.
            strcat(FilePath, FileName);
            CodeOutput(VERBOSE_L, "// Try path %s \n", FilePath); 
            in = antlr3AsciiFileStreamNew(FilePath);
            if (in != NULL) break;  // found the file!

            // else next file
            continue;
         }
         CodeOutput(VERBOSE_L, "// Path done without succes...\n"); 
         break;      
      }
   }

   if (in == NULL) {
      CodeOutput(VERBOSE_ERROR, "Error opening include file %s\n", FileName);
      exit(1);
   }

   // note: PUSHSTREAM macro only works in LEX context (not in this code, nor PARSER context).
   // So leave PUSHSTREAM in the gramar-file.
   return in;
}
Exemple #13
0
///////////////////////////////////////////////////////////////////////////////
// This function will parse the source file and create the token file
CMainApp::Error_Codes CMainApp::TokGen()
{
    Error_Codes ReturnErr = ERR_NOERROR;    
    
    WriteCon(CONERR, "%s\r\n", CalcTab("", 79, '-'));

    // Open the iodll.dll using the first file name
    HANDLE hModule = RSOpenModule(m_strInExe, NULL);
    if ((int)hModule < 100) {
            // error or warning
            WriteCon(CONERR, "%s", CalcTab(m_strInExe, m_strInExe.GetLength()+5, ' '));
            IoDllError((int)hModule);
            return ERR_FILE_NOTSUPP;
    } else {
        // before we do anything else we have to check how many languages we have in the file
        CString strLang;
        char szLang[8];
        BOOL b_multi_lang = FALSE;
        USHORT usInputLang = MAKELANGID(m_usIPriLangId, m_usISubLangId);

        if((b_multi_lang = RSLanguages(hModule, strLang.GetBuffer(128))) && !IsFlag(INPUT_LANG))
        {
            // this is a multiple language file but we don't have an input language specified
            // Fail, but warn the user that he has to set the input language to continue.
            strLang.ReleaseBuffer();
            WriteCon(CONERR, "Multiple language file. Please specify an input language %s.\r\n", strLang);
            goto exit; 
        }

        // Convert the language in to the hex value
        sprintf(szLang,"0x%3.3X", usInputLang);

        // Check if the input language that we got is a valid one
        if(IsFlag(INPUT_LANG) && strLang.Find(szLang)==-1)
        {
            WriteCon(CONERR, "The language %s in not a valid language for this file.\r\n", szLang);
            WriteCon(CONERR, "Valid languages are: %s.\r\n", strLang);
            goto exit;
        }

        // Check if the user is extracting the neutral language
        if(!usInputLang)
            usInputLang = 0xFFFF;

        // Open the output file 
        CStdioFile fileOut;
        if(!fileOut.Open(m_strTgtTok, CFile::modeCreate | CFile::modeReadWrite)) {
            WriteCon(CONERR, "Cannot create file: %s\r\n", CalcTab(m_strTgtTok, m_strTgtTok.GetLength()+5, ' '));
            return ERR_FILE_CREATE;
        }

        CString strBmpDir = "";
        CString strFileName = m_strInExe;
        int pos = m_strInExe.ReverseFind('\\');
        if(pos!=-1)
        {
            strFileName = m_strInExe.Right(m_strInExe.GetLength()-pos-1);
        }
        else 
        if((pos = m_strInExe.ReverseFind(':'))!=-1)
        {
            strFileName = m_strInExe.Right(m_strInExe.GetLength()-pos-1);
        }
        
        pos = m_strTgtTok.ReverseFind('\\');
        if(pos!=-1)
        {
            strBmpDir = m_strTgtTok.Left(pos+1);
        }
        else 
        if((pos = m_strTgtTok.ReverseFind(':'))!=-1)
        {
            strBmpDir = m_strTgtTok.Left(pos+1);
        }

        // inform the user ...
        WriteCon(CONOUT, "Processing\t");
        WriteCon(CONBOTH, "%s", CalcTab(strFileName, strFileName.GetLength()+5, ' '));
        
		LPCSTR lpszType = 0L;
        LPCSTR lpszRes = 0L;
        DWORD  dwLang = 0L;
        DWORD  dwItem = 0L;
        DWORD  dwItemID = 0L;
        LPRESITEM lpResItem = NULL;

        CString strToken;
        CString strResName;
        CString strCaption;
        WORD wFlag;
        BOOL bSkip = FALSE;
        BOOL bSkipEmpty = FALSE;
        BOOL bSkipLang = FALSE;
        WORD wCount = 0;

        WORD wMsgCount = 0;
        int iPos = 1;
        int iBmpIdCount = 0;

        BOOL bVersionStampOnly = TRUE;
    
        while ((lpszType = RSEnumResType(hModule, lpszType))) {
            
            // Check if is one of the type we care about
            if(HIWORD(lpszType)==0)
                switch(LOWORD(lpszType))
                {
                    case 2:
                    case 3:
                        if(theApp.IsFlag(CMainApp::BITMAPS))
                            bSkip = FALSE;
                        else bSkip = TRUE;
                    break;
                    case 4:
                    case 5:
                    case 6:
                    case 9:
                    case 10:
                    case 11:
                        bVersionStampOnly = FALSE;
                    case 16:
                        bSkip = FALSE;
                        break;
                    default:
                        bSkip = TRUE;
                }

            lpszRes = 0L;
            dwLang = 0L;
            dwItem = 0L;

            while ((!bSkip) && (lpszRes = RSEnumResId(hModule, lpszType, lpszRes))) {
                while ((dwLang = RSEnumResLang(hModule, lpszType, lpszRes, dwLang))) {

                    // Check if we have to skip this language
                    if(b_multi_lang && (LOWORD(dwLang)!=usInputLang))
                        bSkipLang = TRUE;
                    else
                        bSkipLang = FALSE;

                    while ((!bSkipLang) && (dwItem = RSEnumResItemId(hModule, lpszType, lpszRes, dwLang, dwItem))) {

                    // Now Get the Data 
                    DWORD dwImageSize = RSGetResItemData( hModule, 
											  lpszType,
											  lpszRes,
											  dwLang,
											  dwItem,
											  m_pBuf,
											  MAX_BUF_SIZE );
											  
				    lpResItem = (LPRESITEM)m_pBuf;

                    if((wCount++ % 50)==0) 
                        WriteCon(CONOUT, ".");
				    
                    // Check if we want or not empty strings
                    switch(lpResItem->dwTypeID)
                    {
                        case 4:
                        case 5:
                        case 16:
                            bSkipEmpty = TRUE;
                        break;
                        default:
                            bSkipEmpty = FALSE;
                        break;
                    }

                    // Version stamp use class name as res id
                    if(lpResItem->lpszResID)
                        strResName = lpResItem->lpszResID;
                    else strResName = "";

                    dwItemID = lpResItem->dwItemID;
                    
                    // Add font info for dialogs
                    if((theApp.IsFlag(CMainApp::FONTS) && (lpResItem->dwTypeID==5) && (dwItemID==0))) {
                        // Add font information
                        sprintf(strToken.GetBuffer(MAX_STR_SIZE),
                            TEXT("[[%u|%u|%u|%u|%u|\"%s\"]]=%s:%hd\n"),
                            lpResItem->dwTypeID,
                            lpResItem->dwResID,
                            dwItemID,
                            ISDLGFONTNAME | ISDLGFONTSIZE,
                            ST_TRANSLATED,
                            strResName.GetBuffer(0),
                            Format(lpResItem->lpszFaceName),
                            lpResItem->wPointSize);

                       fileOut.WriteString(strToken);
                    }

                    strCaption = lpResItem->lpszCaption;

                    // Set the flag
                    wFlag = 0;
                    
                    if(!(bSkipEmpty && strCaption.IsEmpty()))
                    {
                        switch(lpResItem->dwTypeID)
                        {
                            case 2:
                            case 3:
                            {
                                // create the BMP name
                                CString strBmpName;
                                if(lpResItem->dwTypeID==2)
                                    if(lpResItem->dwResID)
                                        strBmpName = CreateName(strFileName, ".bmp", lpResItem->dwResID);
                                    else strBmpName = CreateName(strFileName, ".bmp", lpResItem->lpszResID);
                                else
                                    if(lpResItem->dwResID)
                                        strBmpName = CreateName(strFileName, ".ico", lpResItem->dwResID);
                                    else strBmpName = CreateName(strFileName, ".ico", lpResItem->lpszResID);

                                // Get the image from the file
                                DWORD dwBufSize = RSGetResImage( hModule, 
											  lpszType,
											  lpszRes,
											  dwLang,
											  NULL,
											  0 );

                                BYTE * pBuf = (BYTE*)(new BYTE[dwBufSize]);
                                if(pBuf==NULL)
                                {
                                    WriteCon(CONERR, "Warning: Failed to allocate buffer for image! (%d, %d, %s, Size: %d)\r\n", 
                                        lpResItem->dwTypeID, lpResItem->dwResID, lpResItem->lpszResID, dwBufSize);
                                    break;
                                }

                                dwBufSize = RSGetResImage( hModule, 
			                                  lpszType,
											  lpszRes,
											  dwLang,
											  pBuf,
											  dwBufSize );

                                // write the data in to a file
                                CFile BmpFile;
                                if(!BmpFile.Open(strBmpDir+strBmpName, CFile::modeCreate | CFile::modeWrite))
                                {
                                    WriteCon(CONERR, "Cannot create file: %s\r\n", 
                                        CalcTab(strBmpDir+strBmpName, strBmpName.GetLength()+strBmpDir.GetLength()+5, ' '));
                                    delete pBuf;
                                    break;
                                }

                                switch(lpResItem->dwTypeID)
                                {
                                    case 2:
                                    {
                                        BITMAPFILEHEADER bmpFileHeader;
                                        BITMAPINFO * pbmpInfo = (BITMAPINFO *)pBuf;
                                        DWORD dwNumColor = 0;
                                        if(pbmpInfo->bmiHeader.biBitCount!=24)
                                            dwNumColor = ( 1L << pbmpInfo->bmiHeader.biBitCount);

                                        bmpFileHeader.bfType = 0x4d42;
                                        bmpFileHeader.bfSize = (dwBufSize+sizeof(BITMAPFILEHEADER))/4;
                                        bmpFileHeader.bfReserved1 = 0;
                                        bmpFileHeader.bfReserved2 = 0;
                                        bmpFileHeader.bfOffBits = sizeof(BITMAPFILEHEADER) + pbmpInfo->bmiHeader.biSize + dwNumColor*sizeof(RGBQUAD);

                                        BmpFile.Write(&bmpFileHeader, sizeof(BITMAPFILEHEADER));
                                    }
                                    break;
                                    case 3:
                                    {
                                        ICONHEADER icoHeader;
                                        BITMAPINFOHEADER * pbmpInfoH = (BITMAPINFOHEADER*)pBuf;

                                        icoHeader.idReserved = 0;
                                        icoHeader.idType = 1;
                                        icoHeader.idCount = 1;
                                        icoHeader.bWidth = LOBYTE(pbmpInfoH->biWidth);
                                        icoHeader.bHeight = LOBYTE(pbmpInfoH->biWidth);
                                        icoHeader.bColorCount = 16;
                                        icoHeader.bReserved = 0;
                                        icoHeader.wPlanes = 0;
                                        icoHeader.wBitCount = 0;
                                        icoHeader.dwBytesInRes = dwBufSize;
                                        icoHeader.dwImageOffset = sizeof(ICONHEADER);

                                        BmpFile.Write(&icoHeader, sizeof(ICONHEADER));
                                    }
                                    break;
                                    default:
                                    break;
                                }

                                BmpFile.Write(pBuf, dwBufSize);

                                BmpFile.Close();
                                delete pBuf;

                                strCaption = strBmpName;
                            }    
                            break;
                            case 4:
                                if(lpResItem->dwFlags & MF_POPUP) {
									wFlag = ISPOPUP;

									// check if this popup has a valid ID
									if (LOWORD(dwItemID)==0xffff)
										wFlag |= OLD_POPUP_ID;           

                                    dwItemID = (LOWORD(dwItemID)==0xffff ? HIWORD(dwItemID) : dwItemID);
                                }
                            break;
                            case 5:
                                if(dwItemID==0) {
                                    wFlag = ISCAP;
                                }

                                // check if this is a duplicated id
                                if (LOWORD(dwItemID)==0xffff)
							        wFlag |= ISDUP;

                                dwItemID = (LOWORD(dwItemID)==0xffff ? HIWORD(dwItemID) : dwItemID);
                            break;
                            case 9:
                            {
                                CAccel accel(lpResItem->dwFlags, lpResItem->dwStyle);
                                strCaption = accel.GetText();

                                // check if this is a duplicated ID
                                if(HIWORD(dwItemID))
                                {
                                    wFlag |= ISDUP;
                                }
                            }
                            break;
                            case 11:
                                dwItemID = LOWORD(dwItemID);
                            break;
                            case 16:
                                strResName = lpResItem->lpszClassName;
                            break;
                            default:
                            break;
                        }
                    
                        // Create the token file
                        if(lpResItem->dwTypeID==11 && theApp.IsFlag(CMainApp::SPLIT))
                        {
                            // Search for the \r\n and replace them
                            while((iPos = strCaption.Find("\r\n"))!=-1)
                            {
                                sprintf(strToken.GetBuffer(MAX_STR_SIZE),
                                    TEXT("[[%u|%u|%u|%u|%u|\"%s\"]]=%s\\r\\n\n"),
                                    lpResItem->dwTypeID,
                                    lpResItem->dwResID,
                                    dwItemID,
                                    wFlag | wMsgCount++,
                                    ST_TRANSLATED,
                                    strResName.GetBuffer(0),
                                    Format(strCaption.Left(iPos)));
                
                                strCaption = strCaption.Right(strCaption.GetLength()-2-iPos);
                                fileOut.WriteString(strToken);
                            }
                            wMsgCount = 0;
                        }
                        else
                        {
                            sprintf(strToken.GetBuffer(MAX_STR_SIZE),
                                TEXT("[[%u|%u|%u|%u|%u|\"%s\"]]=%s\n"),
                                lpResItem->dwTypeID,
                                lpResItem->dwResID,
                                dwItemID, /*(LOWORD(dwItemID)==0xffff ? HIWORD(dwItemID) : dwItemID),*/
                                wFlag,
                                ST_TRANSLATED,
                                strResName.GetBuffer(0),
                                Format(strCaption));
            
                            fileOut.WriteString(strToken);
                        }

                        // If this is a dialog box add the coordinates
                        if(lpResItem->dwTypeID==5) 
                        {
                            sprintf(strToken.GetBuffer(MAX_STR_SIZE),
                                TEXT("[[%u|%u|%u|%u|%u|\"%s\"]]=%hu %hu %hu %hu\n"),
                                lpResItem->dwTypeID,
                                lpResItem->dwResID,
                                (LOWORD(dwItemID)==0xffff ? HIWORD(dwItemID) : dwItemID),
                                wFlag | ISCOR,
                                ST_TRANSLATED,
                                strResName.GetBuffer(0),
                                lpResItem->wX,
                                lpResItem->wY,
                                lpResItem->wcX,
                                lpResItem->wcY);
                    
                            fileOut.WriteString(strToken);
                        }

                    }
                    else
                    {
                        // If this is a dialog box add the coordinates
                        if(lpResItem->dwTypeID==5) {
                        
                            sprintf(strToken.GetBuffer(MAX_STR_SIZE),
                                TEXT("[[%u|%u|%u|%u|%u|\"%s\"]]=%hu %hu %hu %hu\n"),
                                lpResItem->dwTypeID,
                                lpResItem->dwResID,
                                (LOWORD(dwItemID)==0xffff ? HIWORD(dwItemID) : dwItemID),
                                wFlag | ISCOR,
                                ST_TRANSLATED,
                                strResName.GetBuffer(0),
                                lpResItem->wX,
                                lpResItem->wY,
                                lpResItem->wcX,
                                lpResItem->wcY);
                    
                            fileOut.WriteString(strToken);
                        }
                    }
                    } // end while
                }
            }
        }

		fileOut.Close();

        // Check the size of the new file and remove it if empty...
        CFileStatus fstat;	
        if(CFile::GetStatus(m_strTgtTok, fstat))
            if(fstat.m_size==0)
                CFile::Remove(m_strTgtTok);

        WriteCon(CONBOTH, " %hu Items\r\n", wCount);
        if(bVersionStampOnly) {
            ReturnErr = ERR_FILE_VERSTAMPONLY;
            WriteCon(CONWRN, "%s : Version Stamping only!\r\n", strFileName);
        }
	}

exit:
    RSCloseModule(hModule);
    
    return ReturnErr;
}
Exemple #14
0
//-----------------------------------------------------------------------------
// SymbolParamSetName -
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
void SymbolParamSetName(SymbolParam *p, char *Name)
{
   p->Name = CreateName(Name);   
}