示例#1
0
文件: qt3to4.cpp 项目: AtlantisCD9/Qt
QString Porting::renameClass(const QString &className) const
{
    if (className == QLatin1String("QSplitter"))  // We don't want a Q3Splitter, ever!
        return className;

    int index = findRule(m_renamedClasses, className);
    return index == -1 ? className : m_renamedClasses.at(index).second;
}
示例#2
0
inline void PDPolySource::fillList() {
  const GroebnerRule & rule1 = d_give.fact(d_numbers.first);
  const GroebnerRule & rule2 = d_give.fact(d_numbers.second);
#if 0
  if(findRule(id1,d_numbers.first,d_active)) {
    if(findRule(id2,d_numbers.second,d_active)) {
#endif
      MatcherMonomial matcher;
      const Monomial & LHS1 = rule1.LHS(); // id1.poly().mono();
      const Monomial & LHS2 = rule2.LHS(); // id2.poly().mono();
      if(UserOptions::s_UseSubMatch) {
        matcher.subMatch(LHS1,d_numbers.first,LHS2,d_numbers.second,d_list);
      };
      matcher.overlapMatch(LHS1,d_numbers.first,LHS2,d_numbers.second,d_list);
#if 0
    };
  };
#endif
};
int intSysMain()
{
	Rule *rule;
	char str[128];
	int key;
	int i;

	if (is.sitChange)
		key = 0;
	else
		key = 1;
	if (is.sitChange)
	{
		is.sitChange = 0;
		rule = findRule(&is);
		printf("%s\n", printStates(&is, str));
		if (!rule)
		{
			is.emf = 0;
			printf("No rule found\n");
			strcpy(ruleDesc, "Suitable response rule not found!");
			roboThought = "Damn it! I don't know what to do!!!";
			return 1;
		}
		else
		{
			printf("Response - %d %s\n", rule->respid, emfName[rule->respid]);
		}
		is.emf = emf[rule->respid];
		*ruleDesc = 0;
		for (i=0; i<rule->numsit; ++i)
		{
			strcat(ruleDesc, rule->sit[i]);
			if (i < rule->numsit-1)
				strcat(ruleDesc, ", ");
		}
		strcat(ruleDesc, " --> ");
		strcat(ruleDesc, emfName[rule->respid]);
		roboThought = rule->respdesc;
	}
	if (is.emf)
		is.emf(key);

	return 1;
}
  // file announce callback
  void
  DataPriorityController::operator() (rapid::FileAnnounce const * announcement)
  {
    MIRO_LOG(LL_DEBUG, "DPC: Received Fileannonuce");

    const Rule &rule = findRule(announcement->fileLocator);
    if (!rule.m_autoAdd) {
      MIRO_LOG_OSTR(LL_DEBUG, "DPC: Not an auto-add file: '" << rule.m_extension << "'"
                    << " - " << announcement->fileLocator);
      return;
    }

    MIRO_LOG(LL_DEBUG, "DPC: adding file to queue");

    int retval = m_queue.putFile(announcement->fileUuid, rule.m_channel, rule.m_priority);
    if (retval != 0) {
      MIRO_LOG_OSTR(LL_ERROR, "DPC: Error putting file in queue: " << retval);
    }
  }
示例#5
0
void VCompDialog::okButton( WWindow* )
{
    _eName->getText( *_fn );
//    _fn->toLower();
    if( _fn->isMask() ) {
        WMessageDialog::messagef( this, MsgError, MsgOk, _viperError, "'%s' cannot be a wildcard", (const char*)*_fn );
    } else if( !_fn->legal() ) {
        WMessageDialog::messagef( this, MsgError, MsgOk, _viperError, "'%s' is not a legal filename", (const char*)*_fn );
    } else if( !checkName() ) {
        //error issued by checkName()
    } else if( streq( _fn->ext(), ".tgt" ) ) {
        quit( TRUE );
    } else if( !legalExt() ) {
        //error issued by legalExt()
    } else if( !findRule() ) {
        //this will work since extension has been verified
    } else {
        quit( TRUE );
    }
}
示例#6
0
TopGenerator::TopGenerator(const DataMap &data) 
 : lang(data.getLang().lang)
 {
  DynArray<TypeDef::Kind *> kind_list(DoReserve,1024);
  
  for(auto &synt : data.getLang().synts.getRange() )
    for(auto &kind : synt.kinds.getRange() )
      kind_list.append_copy(&kind);
  
  ulen len=kind_list.getLen();
  
  table.extend_default(len);
  
  ulen count=0;
  
  while( count<len )
    {
     bool flag=false;
     
     for(ulen ind=count; ind<len ;ind++)
       {
        auto *kind=kind_list[ind];
       
        if( auto *rule=findRule(kind) )
          {
           defRule(kind,rule);
           
           if( ind>count ) Swap(kind_list[ind],kind_list[count]);
           
           count++;
           flag=true;
          }
       }
     
     if( !flag )
       {
        Printf(Exception,"App::TopGenerator::TopGenerator(...) : bad lang");
       }
    }
 }
示例#7
0
文件: leg.c 项目: AntiTyping/tinyrb
YY_ACTION(void) yy_1_definition(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_1_definition\n"));
   if (push(beginRule(findRule(yytext)))->rule.expression)
							    fprintf(stderr, "rule '%s' redefined\n", yytext); ;
}
示例#8
0
文件: leg.c 项目: AntiTyping/tinyrb
YY_ACTION(void) yy_2_primary(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_2_primary\n"));
   Node *name= makeName(findRule(yytext));  name->name.variable= pop();  push(name); ;
}
示例#9
0
文件: leg.c 项目: AntiTyping/tinyrb
YY_ACTION(void) yy_3_primary(char *yytext, int yyleng)
{
  yyprintf((stderr, "do yy_3_primary\n"));
   push(makeName(findRule(yytext))); ;
}
示例#10
0
文件: qt3to4.cpp 项目: AtlantisCD9/Qt
QString Porting::renameEnumerator(const QString &enumName) const
{
    int index = findRule(m_renamedEnums, enumName);
    return index == -1 ? QString() : m_renamedEnums.at(index).second;
}
示例#11
0
文件: qt3to4.cpp 项目: AtlantisCD9/Qt
QString Porting::renameHeader(const QString &headerName) const
{
    int index = findRule(m_renamedHeaders, headerName);
    return index == -1 ? headerName : m_renamedHeaders.at(index).second;
}
//====================>>> makefileMaker::saveMakefile <<<=========================
  void makefileMaker::saveMakefile()
  {

    bool isBorland = false;		// set up Borland stuff

    char resName[50];

    resName[0] = 0;

    libsBCC.erase();

    //builds the file named makefile using infos stored in project

    cmdw = ((videApp*)theApp)->GetMsgWindow();

    // Now, change directory, drive

    int ix = strlen(makeName);
    while (ix > 0)
      {
        if (makeName[ix] == '\\' || makeName[ix] == '/')
          {
            break;
          }
        --ix;
      }
    if (ix > 0)
      {
	char dirPath[maxFileNameSize];
	vOS vos;
	strcpy(dirPath, makeName);	// copy the makefile name
	makeName[ix] = 0;		// strip the name
	if (dirPath[1] == ':')		// a drive
	  {
	    int drive = dirPath[0]; // need to change drive, too.
	    if (drive > 'a')
		drive = drive - ' ';
	    vos.vChDrive(drive-'A');
	  }
	vos.vChDir(dirPath);			// change dir
      }

    ofstream mkf(makeName);		// where to write makefile
    //header
    char buff[256];
    char date[20];
    char time[40];

    vGetLocalTime(time);
    vGetLocalDate(date);

    isBorland = (stricmp(cc,"BCC32") == 0);

    if (isBorland)
	cmdw->AddLine("Building Borland Makefile...");
    else
	cmdw->AddLine("Building Makefile -- Running compiler to generate dependencies...");


    mkf << "#=======================================================================\n";
    mkf << "#@V@:Note: File automatically generated by VIDE: ";
    mkf << "(" << time << " " << date << ") (" << cc << ").\n";
    mkf << "#  This file regenerated each time you run VIDE, so save under a\n";
    mkf << "#    new name if you hand edit, or it will be overwritten.\n";
    mkf << "#=======================================================================\n\n";
    mkf << "# Standard defines:\n";

    if (isBorland)
      {
#ifdef V_VersionWindows
	mkf << ".AUTODEPEND\n\n"
	    << "# Borland C++ tools\n"
	    << "IMPLIB\t= $(BCCROOT)\\bin\\Implib\n"
	    << "ILINK32\t= $(BCCROOT)\\bin\\ILink32\n"
	    << "TLIB\t= $(BCCROOT)\\bin\\TLib\n"
	    << "BRC32\t= $(BCCROOT)\\bin\\Brc32\n"
	    << "TASM32\t= $(BCROOT)\\bin\\Tasm32\n"
	    << "CC  \t= $(BCCROOT)\\bin\\" << cc << "\n\n";
	if (*((videApp*)theApp)->getBCCPath())
	    mkf << "BCCROOT\t= " << ((videApp*)theApp)->getBCCPath() << "\n\n";
	else
	    mkf << "BCCROOT\t= C:\\borland\\bcc55\n\n";
#endif
      }
    else		// gnu stuff
      {
	mkf << "CC  \t=\t" << cc << "\n\n";
	mkf << "WRES\t=\twindres\n\n";
      }

    // HomeV
    mkf << "HOMEV\t=\t" << fixBackSlash(homeV,isBorland) << endl;
    
    //Dirs
    if (isBorland)
	mkf << "VPATH\t=\t$(HOMEV)\\include" << endl;
    else
	mkf << "VPATH\t=\t$(HOMEV)/include" << endl;

    mkf << "oDir\t=\t" << fixBackSlash(ObjDir,isBorland) << endl; //Obj Dir
    mkf << "Bin\t=\t" << fixBackSlash(BinDir,isBorland) << endl; //Bin Dir
    mkf << "Src\t=\t" << fixBackSlash(SrcDir, isBorland) << endl; //Src Dir

    mkf << "libDirs\t=";
 
    int nxtld = libDirs.size();

    if (isBorland && nxtld > 0)
	mkf << "\t-L";

    for (int ixx = 0 ; ixx < nxtld ; ++ixx)
      {
	if (isBorland)		// put out ; separated list
	  {
	    mkf << fixBackSlash(libDirs.list[ixx],isBorland);
	    if (ixx + 1 < nxtld)
		mkf << ";";
	  }
	else
	  {
	    mkf << "\t-L" << fixBackSlash(libDirs.list[ixx],isBorland);
	    if (ixx + 1 < nxtld)
		mkf << " \\";
	    mkf << endl;
	  }
      }
    if (isBorland)
	mkf << endl;
    mkf << endl;

    mkf << "incDirs\t="; 

    int nxtid = incDirs.size();

    if (isBorland && nxtid > 0)
	mkf << "\t-I";

    for (int ixa = 0 ; ixa < nxtid ; ++ixa)
      {
	if (isBorland)		// put out ; separated list
	  {
	    mkf << fixBackSlash(incDirs.list[ixa],isBorland);
	    if (ixa + 1 < nxtid)
		mkf << ";";
	  }
	else
	  {
	    mkf << "\t-I" << fixBackSlash(incDirs.list[ixa],isBorland);
	    if (ixa + 1 < nxtid)
		mkf << " \\";
	    mkf << endl;
	  }
      }
    if (isBorland)
	mkf << endl;
    mkf << endl;

    //Libs
    if (isBorland)
      {
	mkf << "LIBS\t=\t" << fixBCCLibs() << endl;
      }
    else
	mkf << "LIBS\t=\t" << Libs << endl;

    //C_FLAGS & paths to includes

    mkf << "C_FLAGS\t=\t" << fixBackSlash(cFlags,isBorland);

    //defines
    int nxtcd = curDefs.size();

    for (int ixb = 0 ; ixb < nxtcd ; ++ixb)
      {
	mkf << "\\\n\t" << curDefs.list[ixb];
      }
    mkf << endl << endl;

    //sources
    int nxtof = objFiles.size();

    mkf << "SRCS\t=";

    for (int ixc = 0 ; ixc < nxtof ; ++ixc)
      {
	if (isBorland)
	    mkf << "\\\n\t$(Src)\\" << fixBackSlash(objFiles.list[ixc], isBorland);
	else
	    mkf << "\\\n\t$(Src)/" << objFiles.list[ixc];
      }
    mkf << endl << endl;

    //objects

    mkf << "EXOBJS\t=";

    for (int ixd = 0 ; ixd < nxtof ; ++ixd)
      {
	char *objn;
	if (isBorland)
	  {
	    objn = fixBackSlash(srcN2ObjN(objFiles.list[ixd],".obj"),isBorland);
	    mkf << "\\" << endl << "\t$(oDir)\\" << objn;

	    if (strstr(objn,".res") != 0)
		strcpy(resName,srcN2ObjN(objFiles.list[ixd],".obj"));
	  }
	else
	  {
	    objn = srcN2ObjN(objFiles.list[ixd],".o");
	    mkf << "\\" << endl << "\t$(oDir)/" << objn;
	  }

      }
    mkf << endl << endl;

    mkf << "ALLOBJS\t=\t$(EXOBJS)" << endl;
    if (isBorland)
      {
	mkf << "BCCJUNK\t=\t*.il* *.csm *.tds\n";
	mkf << "ALLBIN\t=\t$(Bin)\\" << exeName << endl;
	mkf << "ALLTGT\t=\t$(Bin)\\" << exeName << endl << endl;
      }
    else
      {
	mkf << "ALLBIN\t=\t$(Bin)/" << exeName << endl;
	mkf << "ALLTGT\t=\t$(Bin)/" << exeName << endl << endl;
      }


    // Options

    mkf << "# User defines:" << endl;
    int nxtOpts = curOpts.size();

    for (int ixe = 0 ; ixe < nxtOpts ; ++ixe)
      {
	fixTabs(buff,curOpts.list[ixe]);
	mkf << buff << endl;
      }
    mkf << endl;

    mkf << "#@# Targets follow ---------------------------------" 
	<< endl << endl;
    //target file
    //all:
    mkf << "all:\t$(ALLTGT)" << endl << endl;
    //objs:
    mkf << "objs:\t$(ALLOBJS)" << endl << endl;

    //cleanobjs:
    mkf << "cleanobjs:\n\trm -f $(ALLOBJS)" << endl << endl;

    // cleanbin
    if (isBorland)
	mkf << "cleanbin:\n\trm -f $(ALLBIN) $(BCCJUNK)" << endl << endl;
    else
	mkf << "cleanbin:\n\trm -f $(ALLBIN)" << endl << endl;

    // clean
    mkf << "clean:\tcleanobjs cleanbin" << endl << endl;

    // cleanall
    mkf << "cleanall:\tcleanobjs cleanbin" << endl << endl;

    mkf << "#@# User Targets follow ---------------------------------" 
	<< endl << endl;

    for (int ixf = 0 ; userTargets.list[ixf] != 0 ; ++ixf)
      {
	fixTabs(buff,userTargets.list[ixf]);
	mkf << buff << endl;
      }
    mkf << endl;

    mkf << "#@# Dependency rules follow -----------------------------"
	<< endl << endl;
    //dependency rules

    // allow user to override the all: target with a #all comment
    if (!(userTargets.list[0] && strstr(userTargets.list[0],"#all")!=0))
      {
        bool isStaticLib = false;
        char ext[32];

	// check for a static library
	splitFileName(exeName,0,0,ext);	// get the extention
	if (stricmp(ext,".a") == 0
#ifdef V_VersionWindows
            || stricmp(ext,".lib") == 0 ||
	    stricmp(ext,".LIB") == 0
#endif
           )
	    isStaticLib = true;		// found a static lib
        
	if (isBorland)
	  {
#ifdef V_VersionWindows
	    mkf << "$(Bin)\\" << exeName << " : $(EXOBJS)" << endl ;
	    
	    if (isStaticLib)
	      {
		mkf << "  rm -f $<\n";
		mkf << "  $(TLIB) $< @&&|\n";
		for (int ixg = 0 ; objFiles.list[ixg] != 0 ; ixg++)
		  {
		    char* objn = srcN2ObjN(objFiles.list[ixg],".obj");
		    if (ixg != 0)
			mkf << " &\n";
		    mkf << " +$(oDir)\\" << srcN2ObjN(objFiles.list[ixg],".obj");
		  }
		mkf << " \n|\n\n";

	      }
	    else		// standard linker commands
	      {
		mkf << "  $(ILINK32) @&&|\n" << " $(LIBS) $(incDirs) $(libDirs) +\n";
		
		mkf << "$(BCC32STARTUP)";

		for (int ixg = 0 ; objFiles.list[ixg] != 0 ; ixg++)
		  {
		    char* objn = srcN2ObjN(objFiles.list[ixg],".obj");
		    if (strstr(objn,".res") == 0)
			mkf << " +\n$(oDir)\\" << srcN2ObjN(objFiles.list[ixg],".obj");
		  }

		mkf << "\n$<,$*\n";

		for (int ixa = 0 ; libsBCC.list[ixa] != 0 ; ixa++)
		  {
		    if (ixa != 0)
			mkf << " +\n";
		    mkf << libsBCC.list[ixa] ;
		  }

		if (*resName)		// had a .res file
		    mkf << "\n\n$(oDir)\\" << resName << "\n\n|\n";
		else
		    mkf << "\n\n\n\n|\n";
	      }
#endif
	  }
	else		// gnu compatible;
	  {
	    mkf << "$(Bin)/" << exeName << ": $(EXOBJS)" << endl;
	    if (isStaticLib)
	      {
		mkf << "\trm -f $(Bin)/" << exeName << endl;
		mkf << "\tar cr $(Bin)/" << exeName << " $(EXOBJS)\n";
		mkf << "\tranlib $(Bin)" << exeName << endl;
	      }
	    else
	      {
		mkf << "\t$(CC) -o $(Bin)/"
		<< exeName << " $(EXOBJS) $(incDirs) $(libDirs) $(LIBS)" << endl ;
	      }
	  }
      }

    if (isBorland)
      {
	// now count on autodependency for borland
	for (int ixg = 0 ; objFiles.list[ixg] != 0 ; ixg++)
	  {
	    mkf << "$(oDir)\\" << srcN2ObjN(objFiles.list[ixg],".obj");
	    mkf << " : $(Src)\\" << objFiles.list[ixg] << endl;

	    // check for .rc files
	    if (strstr(objFiles.list[ixg],".rc") != 0 
		|| strstr(objFiles.list[ixg],".RC") != 0)
	      {
		mkf 	<< "  $(BRC32) -r $(incDirs) -fo$@ $(Src)\\"
			<< objFiles.list[ixg] << "\n\n";

	      }
	    else		// it is a .rc file
	      {
		mkf 	<< "  $(CC) -c $(C_FLAGS) $(incDirs) -o$@ $(Src)\\"
			<< objFiles.list[ixg] << "\n\n";
	      }
	  }
      }
    else
      {
	rules.erase();	// fix by chorn - 03/08/99

	for (int ixg = 0 ; objFiles.list[ixg] != 0 ; ixg++)
	  {
#ifdef V_VersionWindows
	    if (strstr(objFiles.list[ixg],".rc") != 0 
		|| strstr(objFiles.list[ixg],".RC") != 0)
	      {
		mkf << "\n$(oDir)/" << srcN2ObjN(objFiles.list[ixg],".o");
		mkf << " : $(Src)/" << objFiles.list[ixg] << endl;
		mkf << "\t$(WRES) $(Src)/" << objFiles.list[ixg];
		mkf << " $(oDir)/" << srcN2ObjN(objFiles.list[ixg],".o");
		mkf << "\n";
	      }
	    else
	      {
	        findRule(objFiles.list[ixg]);
	      }
#else
	    findRule(objFiles.list[ixg]);
#endif
	  }

	int lim = rules.size();
	for (int ixh = 0 ; ixh < lim ; ++ixh)
	  {
	    mkf << endl << "$(oDir)/" << rules.list[ixh] << endl;
	    // check for continuation lines
	    while (*(rules.list[ixh]+strlen(rules.list[ixh])-1) == '\\')
	      {
		++ixh;
		if (rules.list[ixh])
		    mkf << rules.list[ixh] << endl;
	      }
	    mkf << "\t$(CC) $(C_FLAGS) $(incDirs) -c -o $@ $<" << endl;
	  }
      }

    mkf.close();

    
    strcpy(buff,makeName); 
    strcat(buff," ("); strcat(buff,time); strcat(buff," ");
    strcat(buff,date);
    strcat(buff,") - Makefile saved.");
    cmdw->AddLine(buff);

  }
示例#13
0
文件: greg.c 项目: 0x3FFFFFFF/macdown
YY_ACTION(void) yy_1_definition(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_1_definition\n"));
   if (push(beginRule(findRule(yytext)))->rule.expression)
							    fprintf(stderr, "rule '%s' redefined\n", yytext); ;
}
示例#14
0
文件: greg.c 项目: 0x3FFFFFFF/macdown
YY_ACTION(void) yy_2_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_2_primary\n"));
   Node *name= makeName(findRule(yytext));  name->name.variable= pop();  push(name); ;
}
示例#15
0
文件: greg.c 项目: 0x3FFFFFFF/macdown
YY_ACTION(void) yy_3_primary(GREG *G, char *yytext, int yyleng, yythunk *thunk, YY_XTYPE YY_XVAR)
{
  yyprintf((stderr, "do yy_3_primary\n"));
   push(makeName(findRule(yytext))); ;
}