Пример #1
0
void
main(int argc,char *argv[])
{
    extern void ga(char *);
    extern void fl(char *);

    if (argc!=2)
    {
        printf("usage: flga  runfile\n");
        exit(1);
    }
    char gaName[80],flName[80];
    char Msg[80];
    strcpy(Msg,"edit ");
    strcat(Msg,argv[1]);
    char condition;
    int true=1;
    do
    {
        clrscr();
        ifstream runFile;
        runFile.open(argv[1],ios::in);
        if (!runFile)
        {
	 cerr<<"cann't open file "<<argv[1]<<"  for input"<<endl;
	 exit(1);
        }
        runFile>>gaName>>flName;
        cout<<gaName<<"	run file for generating rules"<<endl;
        cout<<flName<<"	run file for classification using fuzzy rule system"<<endl;
        runFile.close();
        cout<<"C: continue"<<endl;
        cout<<"M: modify"<<endl;
        cout<<"Q: quit"<<endl;
        cout<<"your choice? ";
        cin>>condition;
        switch(condition)
        {
	 case 'c':
	 case 'C':
	     true=0;
	     break;
	 case  'm':
	 case  'M':
	     system(Msg);
	     break;
	 case 'q':
	 case 'Q':
	     exit(1);
	 default:
	     break;
        }
    }while (true==1);

    true=1;
    do
    {
        clrscr();
        cout<<"G: generating rules"<<endl;
        cout<<"C: classification"<<endl;
        cout<<"Q: quit"<<endl;
        cout<<"your choice?  ";
        cin>>condition;
        switch(condition)
        {
	 case  'g':
	 case  'G':
	     ga(gaName);
	     break;
	 case  'c':
	 case  'C':
	     fl(flName);
	     break;
            case  'q':
	 case  'Q': 
	     true=0;
	     break;
	 default:
	     true=0;
        }
    } while (true==1);
}
void HeadersDetectorDlg::ProcessFile( ProjectFile* file, wxArrayString& includes )
{
    // We do not care about proper encoding right now.
    // Libraries should never use any native characters in names
    // of their includes and in case of any multibyte encoding
    // multibyte charcters shouldn't hurt us
    // Encoding detector tends to work really slow in some cases

    wxString Ext = file->file.GetExt();
    Ext.MakeLower();

    static const wxChar* Exts[] =
    {
        _T("h"), _T("hxx"), _T("hpp"),
        _T("c"), _T("cpp"), _T("cxx"),
        0
    };

    bool validExt = false;
    for ( const wxChar** ptr = Exts; *ptr; ptr++ )
    {
        if ( Ext == *ptr )
        {
            validExt = true;
            break;
        }
    }
    if ( !validExt )
        return;


    wxFile fl( file->file.GetFullPath() );
    if ( !fl.IsOpened() ) return;
    wxFileOffset contentLength = fl.Length();
    if ( contentLength <= 0 )
        return;

    char* content = new char[contentLength+1];
    char* line = new char[contentLength+1];
    if ( fl.Read(content,contentLength) != contentLength )
    {
        delete[] line;
        delete[] content;
        return;
    }
    content[contentLength] = 0;

    bool blockComment = false;
    for ( size_t pos = 0; pos < static_cast<size_t>(contentLength); )
    {
        // Fetching next line
        char last = 0;
        bool lineEnd = false;
        int lineLength = 0;
        bool lineComment = false;
        bool inStr = false;
        bool inChar = false;
        bool lastCharAdded = false;
        do
        {
            char ch = content[pos++];
            bool thisCharAdded = false;
            switch ( ch )
            {
                case '\n':
                    if ( content[pos] == '\r' )
                        pos++;
                    // Continue to \r
                case '\r':
                    if ( last != '\\' )
                    {
                        lineEnd = true;
                        break;
                    }
                    else if ( lastCharAdded )
                    {
                        // Removing last char since it was '\'
                        // which is removed in the
                        // preprocessor level
                        lineLength--;
                    }
                    break;

                case '*':
                    if ( blockComment )
                    {
                        if ( content[pos] == '/' )
                        {
                            pos++;
                            blockComment = false;
                            break;
                        }
                    }
                    else if ( !lineComment )
                    {
                        thisCharAdded = true;
                        line[lineLength++] = ch;
                    }
                    break;

                case '"':
                    if ( !blockComment && !lineComment )
                    {
                        if ( !inChar )
                        {
                            if ( !inStr )
                                inStr = true;
                            else if ( last != '\\' )
                                inStr = false;
                        }
                        thisCharAdded = true;
                        line[lineLength++] = ch;
                    }
                    break;

                case '\'':
                    if ( !blockComment && !lineComment )
                    {
                        if ( !inStr )
                        {
                            if ( !inChar )
                                inChar = true;
                            else if ( last != '\\' )
                                inChar = false;
                        }
                        thisCharAdded = true;
                        line[lineLength++] = ch;
                    }
                    break;

                case '/':
                    if ( !blockComment && !lineComment && !inStr && !inChar )
                    {
                        if ( content[pos] == '/' )
                        {
                            pos++;
                            lineComment = true;
                            break;
                        }

                        if ( content[pos] == '*' )
                        {
                            pos++;
                            blockComment = true;
                            break;
                        }
                    }

                    // Contnue to default case
                default:
                    if ( !blockComment && !lineComment )
                    {
                        thisCharAdded = true;
                        line[lineLength++] = ch;
                    }
            }
            last = ch;
            lastCharAdded = thisCharAdded;
        }
        while ( !lineEnd && pos < static_cast<size_t>(contentLength) );
        line[lineLength] = 0;

        // Searching for include

        int i=0;
        while ( line[i]==' ' || line[i]=='\t' ) i++;
        if ( line[i++] == '#' )
        {
            while ( line[i]==' ' || line[i]=='\t' ) i++;
            if ( !strncmp( line+i, "include", 7 ) )
            {
                i += 7;
                while ( line[i]==' ' || line[i]=='\t' ) i++;

                wxString include;

                char readTill =
                    ( line[i] == '<' ) ? '>' :
                    ( line[i] == '"' ) ? '"' :
                      0;

                if ( readTill )
                {
                    i++;
                    while ( line[i] && line[i]!=readTill )
                        include += (wxChar)line[i++];
                    if ( line[i] == readTill )
                        includes.Add( include );
                }
            }
        }
    }

    delete[] line;
    delete[] content;
}
Пример #3
0
int main() {

  try {
    edmplugin::PluginManager::configure(edmplugin::standard::config());

    std::string config =
      "import FWCore.ParameterSet.Config as cms\n"
      "process = cms.Process('edmFileUtil')\n"
      "process.InitRootHandlers = cms.Service('InitRootHandlers')\n"
      "process.SiteLocalConfigService = cms.Service('SiteLocalConfigService')\n";

    //create the services
    edm::ServiceToken tempToken = edm::ServiceRegistry::createServicesFromConfig(config);

    //make the services available
    edm::ServiceRegistry::Operate operate(tempToken);

    {
      edm::FileLocator fl("", false);

      const char * lfn[] = {
      "/store/group/bha/bho",
      "/bha/bho",
      "bha",
      "file:bha",
      "file:/bha/bho",
      "/castor/cern.ch/cms/bha/bho",
      "rfio:/castor/cern.ch/cms/bha/bho",
      "rfio:/bha/bho"
      };
      int nfile=8;
    
      std::cout << "lfn2pfn" << std::endl;
      for (int i=0; i<nfile; ++i)
        std::cout << lfn[i] << " -> " << fl.pfn(lfn[i]) << std::endl;
    
      std::cout << "pfn2lfn" << std::endl;
      for (int i=0; i<nfile; ++i)
        std::cout << lfn[i] << " -> " << fl.lfn(lfn[i]) << std::endl;
   }

    {
      edm::FileLocator fl("trivialcatalog_file:FWCore/Catalog/test/override_catalog.xml?protocol=override", false);
    
      const char * lfn[] = {
      "/store/unmerged/relval/CMSSW_3_8_0_pre3/RelValZTT/GEN-SIM-DIGI-RAW-HLTDEBUG/START38_V2-v1/0666/80EC0BCD-D279-DF11-B1DB-0030487C90EE.root",
      "/store/group/bha/bho",
      "/bha/bho",
      "bha",
      "file:bha",
      "file:/bha/bho",
      "/castor/cern.ch/cms/bha/bho",
      "rfio:/castor/cern.ch/cms/bha/bho",
      "rfio:/bha/bho"
      };
      int nfile=9;
    
      std::cout << "lfn2pfn" << std::endl;
      for (int i=0; i<nfile; ++i)
        std::cout << lfn[i] << " -> " << fl.pfn(lfn[i]) << std::endl;
    
      std::cout << "pfn2lfn" << std::endl;
      for (int i=0; i<nfile; ++i)
        std::cout << lfn[i] << " -> " << fl.lfn(lfn[i]) << std::endl;
   }


  } 
  catch (cms::Exception const & e) {
    std::cout << e.what()  << std::endl;
  }
  catch (...) {
    std::cout << "got a problem..." << std::endl;
    return 1;
  }



  return 0;

}
Пример #4
0
void CActorCondition::UpdateTutorialThresholds()
{
	string256						cb_name;
	static float _cPowerThr			= pSettings->r_float("tutorial_conditions_thresholds","power");
	static float _cPowerMaxThr		= pSettings->r_float("tutorial_conditions_thresholds","max_power");
	static float _cBleeding			= pSettings->r_float("tutorial_conditions_thresholds","bleeding");
	static float _cSatiety			= pSettings->r_float("tutorial_conditions_thresholds","satiety");
	static float _cRadiation		= pSettings->r_float("tutorial_conditions_thresholds","radiation");
	static float _cWpnCondition		= pSettings->r_float("tutorial_conditions_thresholds","weapon_jammed");
	static float _cPsyHealthThr		= pSettings->r_float("tutorial_conditions_thresholds","psy_health");



	bool b = true;
	if(b && !m_condition_flags.test(eCriticalPowerReached) && GetPower()<_cPowerThr){
		m_condition_flags.set			(eCriticalPowerReached, TRUE);
		b=false;
		xr_strcpy(cb_name,"_G.on_actor_critical_power");
	}

	if(b && !m_condition_flags.test(eCriticalMaxPowerReached) && GetMaxPower()<_cPowerMaxThr){
		m_condition_flags.set			(eCriticalMaxPowerReached, TRUE);
		b=false;
		xr_strcpy(cb_name,"_G.on_actor_critical_max_power");
	}

	if(b && !m_condition_flags.test(eCriticalBleedingSpeed) && BleedingSpeed()>_cBleeding){
		m_condition_flags.set			(eCriticalBleedingSpeed, TRUE);
		b=false;
		xr_strcpy(cb_name,"_G.on_actor_bleeding");
	}

	if(b && !m_condition_flags.test(eCriticalSatietyReached) && GetSatiety()<_cSatiety){
		m_condition_flags.set			(eCriticalSatietyReached, TRUE);
		b=false;
		xr_strcpy(cb_name,"_G.on_actor_satiety");
	}

	if(b && !m_condition_flags.test(eCriticalRadiationReached) && GetRadiation()>_cRadiation){
		m_condition_flags.set			(eCriticalRadiationReached, TRUE);
		b=false;
		xr_strcpy(cb_name,"_G.on_actor_radiation");
	}

	if(b && !m_condition_flags.test(ePhyHealthMinReached) && GetPsyHealth()<_cPsyHealthThr){
		m_condition_flags.set			(ePhyHealthMinReached, TRUE);
		b=false;
		xr_strcpy(cb_name,"_G.on_actor_psy");
	}

	if(b && m_condition_flags.test(eCantWalkWeight) && !m_condition_flags.test(eCantWalkWeightReached)){
		m_condition_flags.set			(eCantWalkWeightReached, TRUE);
		b=false;
		xr_strcpy(cb_name,"_G.on_actor_cant_walk_weight");
	}

	if(b && !m_condition_flags.test(eWeaponJammedReached)&&m_object->inventory().GetActiveSlot()!=NO_ACTIVE_SLOT){
		PIItem item							= m_object->inventory().ItemFromSlot(m_object->inventory().GetActiveSlot());
		CWeapon* pWeapon					= smart_cast<CWeapon*>(item); 
		if(pWeapon&&pWeapon->GetCondition()<_cWpnCondition){
			m_condition_flags.set			(eWeaponJammedReached, TRUE);b=false;
			xr_strcpy(cb_name,"_G.on_actor_weapon_jammed");
		}
	}
	
	if(!b){
		luabind::functor<LPCSTR>			fl;
		R_ASSERT							(ai().script_engine().functor<LPCSTR>(cb_name,fl));
		fl									();
	}
}
Пример #5
0
int _tmain(int argc, _TCHAR* argv[])
{
  if (!MD5Hash::Test())
    return 2;
  if (!SHA256Hash::Test())
    return 1;
  if (argc >= 3) {
    if (!_wcsicmp(argv[1], L"-p")) {
      const wchar_t *path = argv[2];
      const wchar_t *logpath = 0;
      if (argc > 4 && !_wcsicmp(argv[3], L"-o")) {
        logpath = argv[4];
        CreateOutputLog(logpath);
      }
      if (path && *path) {
        MappingFileClass map;
        int inner_argc = 0;
        if (map.Parse(path)) {
          wchar_t cmd[MAX_PATH];
          do {
            wprintf_s(L"Command > ");
            if (ReadCmdFromCin(cmd, _countof(cmd))) {
              PrintCommand(logpath, cmd);
              LPWSTR *inner_argv = CommandLineToArgvW(cmd, &inner_argc);
              if (inner_argc && inner_argv) {
                if (inner_argc > 3) {
                  if (!_wcsicmp(inner_argv[0], L"--consumerinstance")) { // --consumerinstance namespace type instancename
                    ConsumerParserClass cp(map);
                    if (cp.ParseConsumerInstance(path, inner_argv[1], inner_argv[2], inner_argv[3])) {
                      cp.Print(logpath, path, inner_argv[1], inner_argv[2], inner_argv[3]);
                    }
                  }
                  else if (!_wcsicmp(inner_argv[0], L"--instance")) { //--instance namespace classname instancename
                    InstanceDeclarationParser instParser(path, inner_argv[1], map);
                    instParser.Parse(inner_argv[2], inner_argv[3], logpath);
                  }
                }
                else if (inner_argc > 2) {
                  if (!_wcsicmp(inner_argv[0], L"--consumerinstance")) { // --consumerinstance namespace type
                    ConsumerParserClass cp(map);
                    if (cp.ParseAllConsumersByType(path, inner_argv[1], inner_argv[2])) {
                      cp.Print(logpath, inner_argv[1], inner_argv[2]);
                    }
                  }
                  else if (!_wcsicmp(inner_argv[0], L"--filterinstance")) { // --filterinstance namespace filtername
                    EventFilterParserClass fl(map);
                    if (fl.ParseFilterInstance(path, inner_argv[1], inner_argv[2])) {
                      fl.Print(logpath, inner_argv[1], inner_argv[2]);
                    }
                  }
                  else if (!_wcsicmp(inner_argv[0], L"--classdef")) { //--classdef namespace classname
                    ClassDefinitionParser::Print(path, inner_argv[1], inner_argv[2], map, logpath);
                  }
                  else if (!_wcsicmp(inner_argv[0], L"--instance")) { //--instance namespace classname
                    InstanceDeclarationParser instParser(path, inner_argv[1], map);
                    instParser.Parse(inner_argv[2], logpath);
                  }
                }
                else if (inner_argc > 1) {
                  if (!_wcsicmp(inner_argv[0], L"--classdef")) { //--classdef namespace
                    ClassDefinitionParser::Print(path, inner_argv[1], map, logpath);
                  }
                  else if (!_wcsicmp(inner_argv[0], L"--specified_classdef")) { //--specified_classdef classname
                    ClassDefinitionParser::PrintAllClasses(path, inner_argv[1], map, logpath);
                  }
                  else if (!_wcsicmp(inner_argv[0], L"--consumerinstance")) { //--consumerinstance namespace
                    ConsumerParserClass cp(map);
                    if (cp.ParseAllConsumers(path, inner_argv[1])) {
                      cp.Print(logpath, inner_argv[1]);
                    }
                  }
                  else if (!_wcsicmp(inner_argv[0], L"--filterinstance")) { //--filterinstance namespace
                    EventFilterParserClass fl(map);
                    if (fl.ParseAllFilterInstances(path, inner_argv[1])) {
                      fl.Print(logpath, inner_argv[1]);
                    }
                  }
                  else if (!_wcsicmp(inner_argv[0], L"--bindinginstance")) { //--bindinginstance namespace
                    FilterToConsumerBindingParserClass bd(map);
                    if (bd.ParseAllBindings(path, inner_argv[1])) {
                      bd.Print(inner_argv[1], logpath);
                    }
                  }
                  else if (!_wcsicmp(inner_argv[0], L"--instance")) { //--instance classname
                    InstanceDeclarationParser instParser(path, L"", map);
                    instParser.ParseInAllNS(inner_argv[1], logpath);
                  }
                }
                else if (inner_argc) {
                  if (!_wcsicmp(inner_argv[0], L"--namespaceinstance"))
                    ParseNamespace(path, map, logpath);
                  else if (!_wcsicmp(inner_argv[0], L"--classdef")) { //--classdef
                    ClassDefinitionParser::Print(path, map, logpath);
                  }
                  else if (!_wcsicmp(inner_argv[0], L"--index")) {
                    ParseAllIndexFile(path, map, logpath);
                  }
                  else if (!_wcsicmp(inner_argv[0], L"--help")) {
                    PrintHelp();
                  }
                  else if (!_wcsicmp(inner_argv[0], L"--quit"))
                    break;
                }
                else
                  break;
              }
            }
          } while (true);
        }
      }
    }
  }
  else
    wprintf(L"Usage : WMIParser.exe -p $path_to_objects_data$ [-o $output_file_path$]\r\n");
  return 0;
}
Пример #6
0
void pair::print_pair() const {printf("(%d,%d) ",f,s); fl();}
Пример #7
0
void dpair::print() const {printf("(%f,%f) ",f,s); fl();}
Пример #8
0
bool
GBuildMakefileGenerator::writeMakefile(QTextStream &text)
{
    QStringList tmp;
    QString filename(Option::output.fileName());
    QString pathtoremove(qmake_getpwd());
    QString relpath(pathtoremove);
    QString strtarget(project->first("TARGET"));
    bool isnativebin = nativebins.contains(strtarget);
    relpath.replace(Option::output_dir, "");

    /* correct output for non-prl, non-recursive case */
    QString outname(qmake_getpwd());
    outname += QDir::separator();
    outname += strtarget;
    outname += projectSuffix();
    Option::output.close();
    Option::output.setFileName(outname);
    MakefileGenerator::openOutput(Option::output, QString());

    if (strtarget != fileInfo(project->projectFile()).baseName().section('.', -2, -2)) {
        QString gpjname(strtarget);
        QString outputName(qmake_getpwd());
        outputName += QDir::separator();
        outputName += fileInfo(project->projectFile()).baseName();
        outputName += projectSuffix();
        QFile f(outputName);
        f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
        QTextStream t(&f);
        t << "#!gbuild\n";
        t << "[Project]\n";
        t << gpjname << projectSuffix() << "\n";
        if ((project->first("TEMPLATE") == "lib")
                && project->isActiveConfig("shared"))
            t << gpjname << "_shared" << projectSuffix() << "\n";
        t.flush();
        gpjname += projectSuffix();
        Option::output.close();
        Option::output.setFileName(gpjname);
        MakefileGenerator::openOutput(Option::output, QString());
    }

    if ((project->first("TEMPLATE") == "app")
            && (!isnativebin)) {
        QTextStream t(&Option::output);
        QString intname(strtarget);
        intname += ".int";
        /* this is for bulding an INTEGRITY application.
         * generate the .int integrate file and the .gpj INTEGRITY Application
         * project file, then go on with regular files */
        t << "#!gbuild" << "\n";
        t << "[INTEGRITY Application]" << "\n";
        t << "\t:binDirRelative=.\n";
        t << "\t-o " << strtarget << "\n";
        t << intname << "\n";
        t << strtarget << "_app" << projectSuffix() << "\n";
        t.flush();

        /* generate integrate file */
        QFile f(intname);
        f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
        QTextStream ti(&f);
        ti << "# This is a file automatically generated by qmake" << "\n";
        ti << "# Modifications will be lost next time you run qmake" << "\n";
        ti << "Kernel" << "\n";
        ti << "\tFilename\tDynamicDownload" << "\n";
        ti << "EndKernel" << "\n" << "\n";
        ti << "AddressSpace" << "\n";
        ti << "\tName\t" << strtarget << "\n";
        ti << "\tFilename\t" << strtarget << "_app" << "\n";
        ti << "\tMemoryPoolSize\t0x100000" << "\n";
        ti << "\tLanguage\tC++" << "\n";
        /* FIXME : heap size is huge to be big enough for every example
         * it should probably be tailored for each example, btu there is no
         * good way to guess that */
        ti << "\tHeapSize\t0x00D00000" << "\n";
        ti << "\tTask\tInitial" << "\n";
        ti << "\t\tStackSize\t0x30000" << "\n";
        ti << "\t\tStartIt\tTrue" << "\n";
        ti << "\tEndTask" << "\n";
        ti << "EndAddressSpace" << "\n";
        ti.flush();

        /* change current project file to <projectname>_app.gpj and continue
         * generation */
        outname.insert(outname.lastIndexOf("."), "_app");
        Option::output.close();
        Option::output.setFileName(outname);
        MakefileGenerator::openOutput(Option::output, QString());
    } else if ((project->first("TEMPLATE") == "lib")
            && project->isActiveConfig("dll")) {
        QString gpjname(strtarget);
        gpjname += "_shared";
        gpjname += projectSuffix();
        QFile f(gpjname);
        f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
        QTextStream t(&f);
        t << "#!gbuild\n"
            "[Program]\n"
            "\t-A libINTEGRITY.so\n"
            "\t-A libc.so\n"
            "\t-A libscxx.so\n"
            "\t-A libQtCore.so\n"
            "\t-e __ghsbegin_text\n"
            "\t-startfile=-\n"
            "\t:syslibraries=-\n"
            "\t-Onolink\n";
        t << "\t-o lib" << strtarget << ".so\n";
        t << "\t-l" << strtarget << "\n";
        t << "\t-extractall=-l" << strtarget << "\n";
        t << "\t:outputDir=work/" << filename.section(QDir::separator(), 0, -1).remove(".gpj") << "\n";
        t << strtarget << "_shared.ld\n";
        t << "$(__OS_DIR)/intlib/sharedobjbssinit.c\n";
        t.flush();

        QFile fl(strtarget + "_shared.ld");
        fl.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate);
        QTextStream tl(&fl);
        tl << "CONSTANTS {\n"
             "    __INTEGRITY_MinPageAlign          = 16K\n"
             "    __INTEGRITY_MaxPageAlign          = 16K\n"
             "    __INTEGRITY_LibCBaseAddress       = \n";
        tl << dllbase << "\n";
        tl << "}\n"
             "-sec\n"
             "{\n"
             "        .picbase __INTEGRITY_LibCBaseAddress :\n"
             "        .text :\n"
             "        .syscall :\n"
             "        .intercall :\n"
             "        .interfunc :\n"
             "        .secinfo :\n"
             "        .rodata align(16) :\n"
             "        .fixaddr :\n"
             "        .fixtype :\n"
             "        .rombeg :\n"
             "        .textchecksum :\n"
             "        // The above sections may be large. Leave a bigger gap for large pages.\n"
             "        .pidbase align(__INTEGRITY_MaxPageAlign) :\n"
             "        .sdabase :\n"
             "        .data :\n"
             "        .toc :\n"
             "        .opd :\n"
             "        .datachecksum :\n"
             "        .sbss : \n"
             "        .bss align(__INTEGRITY_MinPageAlign) :\n"
             "        .argsection(__INTEGRITY_MaxPageAlign) :\n"
             "        .heap : \n"
             "}\n";
        tl.flush();
        dllbase += DLLOFFSET;
    }

    warn_msg(WarnParser, Option::output.fileName().toAscii());
    QTextStream t(&Option::output);
    QString primaryTarget;
    if (!project->values("QMAKE_CXX").isEmpty())
        primaryTarget = project->values("QMAKE_CXX").at(0);

    pathtoremove += QDir::separator();
    filename.remove(qmake_getpwd());

    //HEADER
    t << "#!gbuild" << "\n";

    /* find the architecture out of the compiler name */
    if (filename.endsWith("projects.gpj")) {
        primaryTarget.remove(0, 5);
        t << "macro QT_BUILD_DIR=%expand_path(.)\n";
        t << "macro __OS_DIR=" << project->values("INTEGRITY_DIR").first() << "\n";
        t << "primaryTarget=" << primaryTarget << "_integrity.tgt" << "\n";
        t << "customization=util/integrity/qt.bod\n";
    }
    /* project type */
    if (project->first("TEMPLATE") == "app") {
        t << "[Program]" << "\n";
        if (isnativebin) {
            t << "\t:binDir=bin\n";
            t << "\t-o " << strtarget << "\n";
        } else {
            t << "\t:binDirRelative=.\n";
            t << "\t-o " << strtarget << "_app\n";
        }
    } else if (project->first("TEMPLATE") == "lib") {
        t << "[Library]" << "\n";
        t << "\t:binDir=lib" << "\n";
        t << "\t-o lib" << strtarget << ".a" << "\n";
    } else if (project->first("TEMPLATE") == "subdirs")
        t << "[Project]" << "\n";
    else
        t << project->first("TEMPLATE") << "\n";

    /* compilations options */
    t << "\t:sourceDir=." << "\n";

    t << "\t:outputDir=work" << relpath << "\n";
    t << "\t-I${%expand_path(.)}/work" << relpath << "\n";
    t << "\t--cxx_include_directory ${%expand_path(.)}/work" << relpath << "\n";
    if (filename.endsWith("projects.gpj")) {
        t << "\t:sourceDir=work\n";
        t << "\t-Iwork\n";
        t << "\t-Llib\n";
        t << "\t";
        QStringList &l = project->values("QMAKE_CXXFLAGS");
        for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
            if ((*it).startsWith("-"))
                t << "\n" << "\t" << (*it);
            else
                t << " " << (*it);
        }
        t << "\n";
    }
    t << "\n";

    if (project->first("TEMPLATE") != "project")
        t << varGlue("DEFINES", "\t-D", "\n\t-D", "\n");

    t << "\t-I.\n\t-I" << specdir() << "\n";
    t << varGlue("INCLUDEPATH", "\t-I", "\n\t-I", "\n");
    t << "\t--cxx_include_directory .\n\t--cxx_include_directory " << specdir() << "\n";
    t << varGlue("INCLUDEPATH", "\t--cxx_include_directory ", "\n\t--cxx_include_directory ", "\n");

    if (project->first("TEMPLATE") == "app") {
        /* include linker flags if it's an application */
        QString src[] = { "QMAKE_LFLAGS", "QMAKE_FRAMEWORKPATH_FLAGS", "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", "LIBS", QString() };
        for (int i = 0; !src[i].isNull(); i++) {
            /* skip target libraries for native tools */
            if (isnativebin && (i == 0))
                continue;
            t << "\t";
            QStringList &l = project->values(src[i]);
            for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
                if ((*it).startsWith("-"))
                    t << "\n" << "\t" << (*it);
                else
                    t << " " << (*it);
            }
            t << "\n";
        }
    }

    /* first subdirectories/subprojects */
    {
        QStringList &l = project->values("SUBDIRS");
        for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
            QString gpjname((*it));
            /* avoid native tools */
            if (nativebins.contains(gpjname.section("_", -1)))
                continue;
            if (!project->first((*it) + ".subdir").isEmpty())
                gpjname = project->first((*it) + ".subdir");
            /* some SUBDIRS are not actually subdirs, instead .pro files */
            if (gpjname.endsWith(".pro"))
                gpjname.chop(4);
            else
                gpjname += QDir::separator() + gpjname.section(QDir::separator(), -1);
            gpjname += projectSuffix();
            /* make relative */
            if (!project->values("QT_SOURCE_TREE").isEmpty()) {
                gpjname.replace(project->values("QT_SOURCE_TREE").first() + QDir::separator(), "");
            }
            t << gpjname << "\n";
        }
    }

    {
        QStringList &l = project->values("RESOURCES");
        for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
            QString tmpstr((*it).replace(pathtoremove, ""));
            t << tmpstr << "\t[Qt Resource]\n";
            tmpstr = tmpstr.section(".", -2, -1).section(QDir::separator(), -1);
            tmpstr.remove(".qrc");
            t << "\t-name " << tmpstr << "\n";
            tmpstr.insert(tmpstr.lastIndexOf(QDir::separator()) + 1, "qrc_");
            tmpstr.append(".cpp");
            t << "\t-o work/" << relpath << QDir::separator() << tmpstr << "\n";
        }
    }
    {
        QStringList &l = project->values("FORMS");
        for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
            QString tmpstr((*it).replace(pathtoremove, ""));
            t << tmpstr << "\t[Qt Dialog]\n";
            tmpstr = tmpstr.section(".", 0, 0).section(QDir::separator(), -1);
            tmpstr.insert(tmpstr.lastIndexOf(QDir::separator()) + 1, "ui_");
            tmpstr.remove(".ui");
            tmpstr.append(".h");
            t << "\t-o work/" << relpath << QDir::separator() << tmpstr << "\n";
        }
    }

    /* source files for this project */
    QString src[] = { "HEADERS", "SOURCES", QString() };
    for (int i = 0; !src[i].isNull(); i++) {
        QStringList &l = project->values(src[i]);
        for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
            if ((*it).isEmpty())
                continue;
            /* native tools aren't preprocessed */
            if (!isnativebin)
                t << writeOne((*it), pathtoremove);
            else
                t << (*it).remove(pathtoremove) << "\n";
        }
    }
    t << "\n";

    {
        QStringList &l = project->values("GENERATED_SOURCES");
        for (QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
            t << "work/" << relpath << QDir::separator() << (*it).section(QDir::separator(), -1) << "\n";
        }
    }

    return true;
}
Пример #9
0
Файл: vsh.cpp Проект: garinh/cs
static void cmd_cp (char *args)
{
  bool onepass;
  get_option (args, onepass);

  char *src, *dst;
  if (!get2args ("cp", args, src, dst))
    return;

  csRef<iStringArray> fl (VFS->FindFiles (src));
  size_t i;
  for (i = 0; i < fl->GetSize () ; i++)
  {
    char destname [VFS_MAX_PATH_LEN + 1];
    src = (char *)fl->Get (i);

    if (fl->GetSize () > 1)
    {
      size_t dirlen = strlen (src);
      if (dirlen)
        dirlen--;
      while (dirlen && src [dirlen - 1] != VFS_PATH_SEPARATOR)
        dirlen--;
      strcpy (destname, dst);
      if (destname [0])
        if (destname [strlen (destname) - 1] != VFS_PATH_SEPARATOR)
          strcat (destname, "/");
      strcat (destname, src + dirlen);
      csPrintf ("%s -> %s\n", src, destname);
      dst = destname;
    }

    if (onepass)
    {
      csRef<iDataBuffer> data (VFS->ReadFile (src));
      if (!data)
      {
        csPrintfErr ("cp: cannot read file \"%s\"\n", src);
        return;
      }

      if (!VFS->WriteFile (dst, **data, data->GetSize ()))
        csPrintfErr ("cp: error writing to file \"%s\"\n", dst);
    }
    else
    {
      csRef<iFile> dF (VFS->Open (dst, VFS_FILE_WRITE));
      if (!dF)
      {
        csPrintfErr ("cp: cannot open destination file \"%s\"\n", dst);
        return;
      }
      csRef<iFile> sF (VFS->Open (src, VFS_FILE_READ));
      if (!sF)
      {
        csPrintfErr ("cp: cannot open source file \"%s\"\n", src);
        return;
      }
      while (!sF->AtEOF ())
      {
        char buff [123];
        size_t len = sF->Read (buff, sizeof (buff));
        if (dF->Write (buff, len) != len)
        {
          csPrintfErr ("cp: error writing to file \"%s\"\n", dst);
          break;
        }
      }
    }
  }
}
Пример #10
0
void pr(oop p) {
  FlagSetting fl(PrintVMMessages, true);
  p->print_real();
}
Пример #11
0
void pm(Map* p) {
  FlagSetting fl(PrintVMMessages, true);
  p->print_map();
}
Пример #12
0
/**
 * Call this method when getting a Property from HTMLCollection
 */
static JSBool jhtml_collection_getProperty(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
{
	WebcJSScript *jsscr = (WebcJSScript *) jhutil_GetContextPrivate(cx);
	WebcJSDocumentContext *jsmgr = (jsscr)? jsscr->GetJSMgr() : 0;
	if (!jsmgr)
	{
		return JS_FALSE;
	}

	HTMLDocument *pDoc = jsmgr->GetDocument();
	jhtml_collection *pColl = (jhtml_collection *)jhutil_GetPrivate(cx, obj);

	if (!pColl)
		return JS_TRUE;

	switch (JSVAL_TO_INT(id))
	{
		//if we are looking for the element length
		case HTMLCOLLECTION_LENGTH:
		{
			if (pColl->finderType)
			{
				HTMLElementType ele_type = HTML_ELEMENT_NONE;
				//switch on the type of collection this is
				switch(pColl->finderType)
				{
					//these cases can use the HTMLCountByType Finder, and therefore
					//just set the ele_type and break
					case DOCUMENT_IMAGES:
						ele_type = HTML_IMAGE_ELEMENT;
						break;
					case DOCUMENT_ANCHORS:
						ele_type = HTML_ANCHOR_ELEMENT;
						break;
					case TABLE_ROWS:
						ele_type = HTML_TABLE_ROW_ELEMENT;
						break;
					case TABLEROW_CELLS:
						ele_type = HTML_TABLE_CELL_ELEMENT;
						break;
					case MAP_AREAS:
						ele_type = HTML_AREA_ELEMENT;
						break;
					case SELECT_OPTIONS:
						ele_type = HTML_OPTION_ELEMENT;
						break;
					case WIN_FRAMES:
						ele_type = HTML_FRAME_ELEMENT;
						break;
					case ELEMENT_NODES:
					{
						HTMLCountAllFinder finder;
						pColl->pTop->FindElement(&finder, 1, INCLUDE_SELF_NODES_DEFAULT);
						int count = finder.Length();
						*vp = INT_TO_JSVAL(count);
						return JS_TRUE;
					}
					case DOCUMENT_FORMS:
					{
						WebcJSScript *jsscr = (WebcJSScript *) jhutil_GetContextPrivate(cx);
						WebcJSDocumentContext *jsmgr = (jsscr)? jsscr->GetJSMgr() : 0;
						//forms do not live in the document tree, therefore we must use
						//the form vector
						if (jsmgr)
						{
							HTMLElementTypeFinder f(HTML_FORM_ELEMENT);
							HTMLElementCounter fl(&f);
							jsmgr->GetDocument()->FindElement(&fl);
							int len = fl.Count();
							*vp = INT_TO_JSVAL(len);
							return JS_TRUE;
						}
						return JS_FALSE;
					}
					case DOCUMENT_IDS:
					{
						HTMLCountAllFinder finder;
						pColl->pTop->FindElement(&finder,1, INCLUDE_SELF_ELEMENT_DEFAULT);
						int count = finder.Length();
						*vp = INT_TO_JSVAL(count);
						return JS_TRUE;
					}
					case DOCUMENT_ALL:
					{
						HTMLCountAllFinder finder;
						pColl->pTop->FindElement(&finder,1, INCLUDE_SELF_ELEMENT_DEFAULT);
						int count = finder.Length();
						*vp = INT_TO_JSVAL(count);
						return JS_TRUE;
					}
					case ALL_BY_NAME:
					{
						if (!pColl->nameOfAll)
						{
							*vp = INT_TO_JSVAL(0);
							return JS_TRUE;
						}
						//this finder counts the total number of elements with the
						//name given by nameOfAll
						HTMLCountByNameFinder finder(pColl->nameOfAll);
						pColl->pTop->FindElement(&finder, 1, INCLUDE_SELF_ELEMENT_DEFAULT);
						int count = finder.Length();
						*vp = INT_TO_JSVAL(count);
						return JS_TRUE;
					}
					case ALL_TAGS_BY_TAGNAME:
					{
						if (!pColl->nameOfAll)
						{
							*vp = INT_TO_JSVAL(0);
							return JS_TRUE;
						}
						// use this finder to count the total number of elements with the
						// type given by nameOfAll (misnomer)
						HTMLTagType hType = HTML_ParseTagType(pColl->nameOfAll, webc_strlen(pColl->nameOfAll));
						HTMLElementType eType = TagToHTMLElementType[hType];
						HTMLCountByTypeFinder finder(eType);
						pColl->pTop->FindElement(&finder, 1, WEBC_FALSE); // don't include myself in the search results
						int count = finder.Length();
						*vp = INT_TO_JSVAL(count);
						return JS_TRUE;
					}
					case FORM_INPUTS:
					{
						//for this type of collection, the top will always be of type form
						HTMLForm *form = (HTMLForm *)pColl->pTop;
						int len = vector_get_size(form->GetFieldVector());
						*vp = INT_TO_JSVAL(len);
						return JS_TRUE;
					}
					case DOCUMENT_STYLESHEETS:
					{
						//GMP this needs to be revisited if CSS is changed to have more than 1 style sheet
						*vp = INT_TO_JSVAL(1);
						return JS_TRUE;
					}
					case SSHEET_RULES:
					{
#if (WEBC_SUPPORT_STYLE_SHEETS)
						CSSDocumentContext *pCSSCx= pDoc->GetCSSContext();
	/*					int i = 0;
						if (pCSSCx)
						{
							vector_iterator pvi[1];
							CSSPropertyDescriptor * pCSSPD = pCSSCx->EnumFirstProperty(pvi);
							while (pCSSPD)
							{
								i++;
								pCSSPD = pCSSCx->EnumNextProperty(pvi);
							}
						}
						*vp = INT_TO_JSVAL(i);*/
#endif //(WEBC_SUPPORT_STYLE_SHEETS)
						return JS_TRUE;
					}

					case RADIO_BUTTONS:
					{
						int numRadioElems = 0;
						HTMLRadioButton *pRadio = (HTMLRadioButton*)pColl->pTop;
						while (pRadio)
						{
							numRadioElems++;
							pRadio = (pRadio->mpGroupNext != pColl->pTop)
								? pRadio->mpGroupNext : 0;
						}
						*vp = INT_TO_JSVAL(numRadioElems);
						return JS_TRUE;
					}

				}//end inner switch
				if (ele_type != HTML_ELEMENT_NONE)
				{
					HTMLCountByTypeFinder finder(ele_type);
					pColl->pTop->FindElement(&finder, 1, INCLUDE_SELF_ELEMENT_DEFAULT);
					*vp = INT_TO_JSVAL(finder.Length());
				}
			}//end if
			return JS_TRUE;
		}//end case length
		default:
		{
			//MSIE allows collections to be index like 'document.all.nameofelement' where
			//nameofelement is an element name in the document tree.  It also allows
			//'document.all[4]' To account for that we call item on the element passed in.
			//which will call namedItem if the jsval passed is not an int.
			jhtml_collection_item(cx, obj, 1, &id, vp);
			break;
		}
	}//end switch
	return JS_TRUE;
}
Пример #13
0
void Config::WriteStyles(wxString file)
{
  wxConfigBase* config;
  if (file == wxEmptyString)
    config = wxConfig::Get();
  else {
    wxStringInputStream str(wxEmptyString);
    config = new wxFileConfig(str);
  }

  config->Write(wxT("Style/Background/color"),
                m_styleBackground.color.GetAsString(wxC2S_CSS_SYNTAX));
  config->Write(wxT("Style/Highlight/color"),
                m_styleHighlight.color.GetAsString(wxC2S_CSS_SYNTAX));
  config->Write(wxT("Style/TextBackground/color"),
                m_styleTextBackground.color.GetAsString(wxC2S_CSS_SYNTAX));
  config->Write(wxT("Style/CellBracket/color"),
                m_styleCellBracket.color.GetAsString(wxC2S_CSS_SYNTAX));
  config->Write(wxT("Style/ActiveCellBracket/color"),
                m_styleActiveCellBracket.color.GetAsString(wxC2S_CSS_SYNTAX));
  config->Write(wxT("Style/Cursor/color"),
                m_styleCursor.color.GetAsString(wxC2S_CSS_SYNTAX));
  config->Write(wxT("Style/Selection/color"),
                m_styleSelection.color.GetAsString(wxC2S_CSS_SYNTAX));
  config->Write(wxT("Style/Outdated/color"),
                m_styleOutdated.color.GetAsString(wxC2S_CSS_SYNTAX));

  config->Write(wxT("Style/fontname"), m_styleDefault.font);
  config->Write(wxT("fontEncoding"), (int)m_fontEncoding);

  config->Write(wxT("Style/Math/fontname"), m_mathFontName);

#define WRITE_STYLE(style, where)                   \
  config->Write(wxT(where "color"), style.color.GetAsString(wxC2S_CSS_SYNTAX));   \
  config->Write(wxT(where "bold"), style.bold);     \
  config->Write(wxT(where "italic"), style.italic); \
  config->Write(wxT(where "underlined"), style.underlined);

  // Normal text
  WRITE_STYLE(m_styleDefault, "Style/NormalText/")

  // Main prompt
  WRITE_STYLE(m_styleMainPrompt, "Style/MainPrompt/")

  // Other prompt
  WRITE_STYLE(m_styleOtherPrompt, "Style/OtherPrompt/")

  // Label
  WRITE_STYLE(m_styleLabel, "Style/Label/")

  // Special
  WRITE_STYLE(m_styleSpecial, "Style/Special/")

  // Input
  WRITE_STYLE(m_styleInput, "Style/Input/")

  // Number
  WRITE_STYLE(m_styleNumber, "Style/Number/")

  // Greek
  WRITE_STYLE(m_styleGreek, "Style/Greek/")

  // String
  WRITE_STYLE(m_styleString, "Style/String/")

  // Variable
  WRITE_STYLE(m_styleVariable, "Style/Variable/")

  // Text
  config->Write(wxT("Style/Text/fontname"), m_styleText.font);
  config->Write(wxT("Style/Text/fontsize"), m_styleText.fontSize);
  WRITE_STYLE(m_styleText, "Style/Text/")

  // Section
  config->Write(wxT("Style/Subsection/fontname"), m_styleSubsection.font);
  config->Write(wxT("Style/Subsection/fontsize"), m_styleSubsection.fontSize);
  WRITE_STYLE(m_styleSubsection, "Style/Subsection/")

  // Section
  config->Write(wxT("Style/Section/fontname"), m_styleSection.font);
  config->Write(wxT("Style/Section/fontsize"), m_styleSection.fontSize);
  WRITE_STYLE(m_styleSection, "Style/Section/")

  // Title
  config->Write(wxT("Style/Title/fontname"), m_styleTitle.font);
  config->Write(wxT("Style/Title/fontsize"), m_styleTitle.fontSize);
  WRITE_STYLE(m_styleTitle, "Style/Title/")

  // Function names
  WRITE_STYLE(m_styleFunction, "Style/Function/")

  config->Flush();

  if (file != wxEmptyString)
  {
    wxFile fl(file, wxFile::write);
    wxFileOutputStream str(fl);
    ((wxFileConfig *)config)->Save(str);
    delete config;
  }
}
Пример #14
0
	/*! Import a Position Weight Matrices file
	 Imports file and parses the file position weight matrix file
	 \param[in] const char* file
	 */
	void PWM::import(const char* file){
		std::string fl(file);
		import(fl);
	}
Пример #15
0
void pk(Klass* p) {
  Command c("pk");
  FlagSetting fl(PrintVMMessages, true);
  p->print_klass();
}
Пример #16
0
int GFastaIndex::buildIndex() {
    //this parses the whole fasta file, so it could be slow
    if (fa_name==NULL)
       GError("Error: GFastaIndex::buildIndex() called with no fasta file!\n");
    FILE* fa=fopen(fa_name,"rb");
    if (fa==NULL) {
       GMessage("Warning: cannot open fasta index file: %s!\n",fa_name);
       return 0;
       }
    records.Clear();
    GLineReader fl(fa);
    char* s=NULL;
    uint seqlen=0;
    int line_len=0,line_blen=0;
    bool newSeq=false; //set to true after defline
    off_t newSeqOffset=0;
    int prevOffset=0;
    char* seqname=NULL;
    int last_len=0;
    bool mustbeLastLine=false; //true if the line length decreases
    while ((s=fl.nextLine())!=NULL) {
     if (s[0]=='>') {
        if (seqname!=NULL) {
         if (seqlen==0)
            GError("Warning: empty FASTA record skipped (%s)!\n",seqname);
         else { //seqlen!=0
           addRecord(seqname, seqlen,newSeqOffset, line_len, line_blen);
           }
         }
        char *p=s;
        while (*p > 32) p++;
        *p=0;
        GFREE(seqname);
        seqname=Gstrdup(&s[1]);
        newSeq=true;
        newSeqOffset=fl.getfpos();
        last_len=0;
        line_len=0;
        line_blen=0;
        seqlen=0;
        mustbeLastLine=false;
        } //defline parsing
     else { //sequence line
       int llen=fl.length();
       int lblen=fl.getFpos()-prevOffset;
        if (newSeq) { //first sequence line after defline
          line_len=llen;
          line_blen=lblen;
          }
        else {//next seq lines after first
          if (mustbeLastLine || llen>last_len)
             GError(ERR_FALINELEN);
          if (llen<last_len) mustbeLastLine=true;
          }
        seqlen+=llen;
        last_len=llen;
        newSeq=false;
        } //sequence line
     prevOffset=fl.getfpos();
     }//for each line of the fasta file
    if (seqlen>0)
       addRecord(seqname, seqlen, newSeqOffset, line_len, line_blen);
    GFREE(seqname);
    fclose(fa);
    return records.Count();
    }
Пример #17
0
QSqlIndex QSqlCursor::index( const QString& fieldName ) const
{
    QStringList fl( fieldName );
    return index( fl );
}
Пример #18
0
bool
NetworkObject::loadTextNetwork(QString flnm)
{
  m_fileName = flnm;
  
  m_nodeAtt.clear();
  m_edgeAtt.clear();

  QFile fl(m_fileName);
  if (!fl.open(QIODevice::ReadOnly | QIODevice::Text))
    return false;

  QTextStream in(&fl);
  QString line;
  QStringList words;
  int nvert = 0;
  int nedge = 0;
  int nva = 0;
  int nea = 0;

  line = in.readLine();
  words = line.split(" ", QString::SkipEmptyParts);
  nvert = words[0].toInt();
  if (words.count() > 1)
    nva = words[1].toInt();

  line = in.readLine();
  words = line.split(" ", QString::SkipEmptyParts);
  nedge = words[0].toInt();
  if (words.count() > 1)
    nea = words[1].toInt();

  for(int i=0; i<nva; i++)
    {
      line = in.readLine();
      words = line.split("#", QString::SkipEmptyParts);
      m_nodeAtt << words[0];
    }
    
  for(int i=0; i<nea; i++)
    {
      line = in.readLine();
      words = line.split("#", QString::SkipEmptyParts);
      m_edgeAtt << words[0];
    }

  m_vertexRadiusAttribute = -1;
  m_edgeRadiusAttribute = -1;

  for(int i=0; i<m_nodeAtt.count(); i++)
    {
      if (m_nodeAtt[i].contains("radius", Qt::CaseInsensitive) ||
	  m_nodeAtt[i].contains("diameter", Qt::CaseInsensitive))
	{
	  m_vertexRadiusAttribute = i;
	  break;
	}
    }
  for(int i=0; i<m_edgeAtt.count(); i++)
    {
      if (m_edgeAtt[i].contains("radius", Qt::CaseInsensitive) ||
	  m_edgeAtt[i].contains("diameter", Qt::CaseInsensitive))
	{
	  m_edgeRadiusAttribute = i;
	  break;
	}
    }

  //------------------------------------
  // read node information
  {
    m_vertexAttribute.clear();
    m_vertexCenters.clear();

    QVector<float> *vat; // not expecting more than 20 attributes
    int nvat = m_nodeAtt.count();
    vat = new QVector<float> [nvat];

    for(int i=0; i<nvert; i++)
      {
	line = in.readLine();
	line = line.simplified();
	words = line.split(" ", QString::SkipEmptyParts);
	float x, y, z;
	x = words[0].toFloat();
	y = words[1].toFloat();
	z = words[2].toFloat();
	m_vertexCenters << Vec(x,y,z);
	for (int j=0; j<qMin((int)(words.count()-3),nvat); j++)
	  vat[j] << words[3+j].toFloat();
      }
    
    int nv = m_vertexCenters.count();
    for(int c=0; c<m_nodeAtt.count(); c++)
      {
	if (vat[c].count() < nv)
	  vat[c] << 0.0;
      }
    
    for(int vi=0; vi<m_nodeAtt.count(); vi++)
      m_vertexAttribute << qMakePair(m_nodeAtt[vi], vat[vi]);      

    if (m_vertexRadiusAttribute == -1)
      {
	m_vertexRadiusAttribute = m_nodeAtt.count();
	QVector<float> rad;
	rad.resize(m_vertexCenters.count());
	rad.fill(2);
	m_nodeAtt << "vertex_radius";
	m_vertexAttribute << qMakePair(QString("vertex_radius"), rad);
      }
    
    for(int i=0; i<nvat; i++)
      vat[i].clear();
    delete [] vat;
  }
  //------------------------------------
  
  //------------------------------------
  // read edge information
  {
    m_edgeAttribute.clear();
    m_edgeNeighbours.clear();

    QVector<float> *vat; // not expecting more than 20 attributes
    int nvat = m_edgeAtt.count();
    vat = new QVector<float> [nvat];

    for(int i=0; i<nedge; i++)
      {
	line = in.readLine();
	line = line.simplified();
	words = line.split(" ", QString::SkipEmptyParts);
	int a, b;
	a = words[0].toInt();
	b = words[1].toInt();
	m_edgeNeighbours << qMakePair(a,b);
	for (int j=0; j<qMin((int)(words.count()-2),nvat); j++)
	  vat[j] << words[2+j].toFloat();
      }
    
    int nv = m_edgeNeighbours.count();
    for(int c=0; c<m_edgeAtt.count(); c++)
      {
	if (vat[c].count() < nv)
	  vat[c] << 0.0;
      }

    for(int e=0; e<m_edgeAtt.count(); e++)
      {
	if (m_edgeAtt[e].contains("diameter", Qt::CaseInsensitive))
	  {
	    for(int vi=0; vi<vat[e].count(); vi++)
	      vat[e][vi] /= 2;
	  }
      }

    for(int vi=0; vi<m_edgeAtt.count(); vi++)
      m_edgeAttribute << qMakePair(m_edgeAtt[vi], vat[vi]);      
    
    if (m_edgeRadiusAttribute == -1)
      {
	m_edgeRadiusAttribute = m_edgeAtt.count();
	QVector<float> rad;
	rad.resize(m_edgeNeighbours.count());
	rad.fill(2);
	m_edgeAtt << "edge_radius";
	m_edgeAttribute << qMakePair(QString("edge_radius"), rad);
      }
    
    for(int i=0; i<nvat; i++)
      vat[i].clear();
    delete [] vat;
  }
  //------------------------------------
    
  //---------------------
  Vec bmin = m_vertexCenters[0];
  Vec bmax = m_vertexCenters[0];
  for(int i=0; i<m_vertexCenters.count(); i++)
    {
      bmin = StaticFunctions::minVec(bmin, m_vertexCenters[i]);
      bmax = StaticFunctions::maxVec(bmax, m_vertexCenters[i]);
    }
  m_centroid = (bmin + bmax)/2;
  
  m_enclosingBox[0] = Vec(bmin.x, bmin.y, bmin.z);
  m_enclosingBox[1] = Vec(bmax.x, bmin.y, bmin.z);
  m_enclosingBox[2] = Vec(bmax.x, bmax.y, bmin.z);
  m_enclosingBox[3] = Vec(bmin.x, bmax.y, bmin.z);
  m_enclosingBox[4] = Vec(bmin.x, bmin.y, bmax.z);
  m_enclosingBox[5] = Vec(bmax.x, bmin.y, bmax.z);
  m_enclosingBox[6] = Vec(bmax.x, bmax.y, bmax.z);
  m_enclosingBox[7] = Vec(bmin.x, bmax.y, bmax.z);


//  m_nZ = (bmax.x - bmin.x) + 1;
//  m_nY = (bmax.y - bmin.y) + 1;
//  m_nX = (bmax.z - bmin.z) + 1;
  m_nZ = bmax.x;
  m_nY = bmax.y;
  m_nX = bmax.z;

  if (!Global::batchMode())
    {
      QString str;
      str = QString("Grid Size : %1 %2 %3\n").arg(m_nX).arg(m_nY).arg(m_nZ);
      str += QString("Vertices : %1\n").arg(m_vertexCenters.count());
      str += QString("Edges : %1\n").arg(m_edgeNeighbours.count());
      str += QString("\n");
      str += QString("Vertex Attributes : %1\n").arg(m_vertexAttribute.count());
      for(int i=0; i<m_vertexAttribute.count(); i++)
	str += QString(" %1\n").arg(m_vertexAttribute[i].first);
      str += QString("\n");
      str += QString("Edge Attributes : %1\n").arg(m_edgeAttribute.count());
      for(int i=0; i<m_edgeAttribute.count(); i++)
	str += QString(" %1\n").arg(m_edgeAttribute[i].first);
      
      QMessageBox::information(0, "Network loaded", str);
    }

  m_Vatt = 0;
  m_Eatt = 0;
  m_Vminmax.clear();
  m_Eminmax.clear();
  m_userVminmax.clear();
  m_userEminmax.clear();

  for(int i=0; i<m_vertexAttribute.count(); i++)
    {
      float vmin = m_vertexAttribute[i].second[0];
      float vmax = m_vertexAttribute[i].second[0];
      for(int j=1; j<m_vertexAttribute[i].second.count(); j++)
	{
	  vmin = qMin((float)m_vertexAttribute[i].second[j], vmin);
	  vmax = qMax((float)m_vertexAttribute[i].second[j], vmax);
	}
      m_Vminmax.append(qMakePair(vmin, vmax));
      m_userVminmax.append(qMakePair((vmin+vmax)/2, vmax));
    }

  for(int i=0; i<m_edgeAttribute.count(); i++)
    {
      float emin = m_edgeAttribute[i].second[0];
      float emax = m_edgeAttribute[i].second[0];
      for(int j=1; j<m_edgeAttribute[i].second.count(); j++)
	{
	  emin = qMin((float)m_edgeAttribute[i].second[j], emin);
	  emax = qMax((float)m_edgeAttribute[i].second[j], emax);
	}
      m_Eminmax.append(qMakePair(emin, emax));
      m_userEminmax.append(qMakePair((emin+emax)/2, emax));
    }

  return true;
}
Пример #19
0
void switch_elmts(int a, int b, List& L) {
	if (L.size()<=a || L.size()<=b) { printf("Error in switch elmts\n"); fl(); }
	int tmp = L[a];
	L[a] = L[b];
	L[b] = tmp;
}
Пример #20
0
    void Sample::execute(int popSize,
                    Buffer<float4>& population,
                    int sampSize,
                    Buffer<float4>& samples,
                    Buffer<unsigned int>& sampleIndices,
                    unsigned int insOffset,
                    unsigned int insStride)
    {

        
        /*std::vector<float4> fvec(sampSize);
        std::fill(fvec.begin(), fvec.end(), float4(0.0,0.0,0.0,0.0));

        std::vector<int4> uivec(sampSize);
        std::fill(uivec.begin(), uivec.end(), int4(0,0,0,0));
        Buffer<float4> debugf(cli,fvec);
        Buffer<int4> debugi(cli,uivec);*/
        int iarg = 0;
        k_sample.setArg(iarg++, popSize);
        k_sample.setArg(iarg++, population.getDevicePtr());
        k_sample.setArg(iarg++, sampSize);
        k_sample.setArg(iarg++, samples.getDevicePtr());
        k_sample.setArg(iarg++, sampleIndices.getDevicePtr());
        k_sample.setArg(iarg++, insOffset);
        k_sample.setArg(iarg++, insStride);
        //k_sample.setArg(iarg++, debugf.getDevicePtr());
        //k_sample.setArg(iarg++, debugi.getDevicePtr());
        

        try
        {
			//printf("k_sample (non-cloud): num= %d\n", num); 
            float gputime = k_sample.execute(sampSize);
        }
        catch (cl::Error er)
        {
            printf("ERROR(data structures): %s(%s)\n", er.what(), CL::oclErrorString(er.err()));
        }

        
#if 0
        //printSampleDiagnostics();

        printf("**************** Sample Diagnostics ****************\n");
        std::vector<float4> fl(5);
        std::vector<int4> in(5);
        
        debugf.copyToHost(fl);
        debugi.copyToHost(in);

        for(int i = 0; i < 5; i++)
        {
            printf("pos[%d] = (%f,%f,%f,%f)\n", i, fl[i].x, fl[i].y, fl[i].z, fl[i].w);
            printf("index[%d] = (%d,%d,%d,%d)\n", i, in[i].x, in[i].y, in[i].z, in[i].w);
        }

#endif

#if 0
        //print out elements from the sorted arrays
#define DENS 0
#define POS 1
#define VEL 2

			printf("gordon\n");
            int nbc = num+5;
            std::vector<float4> hpos_u(nbc);
            std::vector<float4> hpos_s(nbc);
            std::vector<unsigned int> hindices(nbc);

            //svars.copyToHost(dens, DENS*sphp.max_num);
            //svars.copyToHost(poss, POS*sphp.max_num);

			pos_u.copyToHost(hpos_u);
			pos_s.copyToHost(hpos_s);
			indices.copyToHost(hindices);

			printf("**** INSIDE PERMUTE ****\n");

			printf("**** UNSORTED POSITIONS *****\n");
            for (int i=0; i < num; i++)
            {
                //printf("clf_debug: %f, %f, %f, %f\n", clf[i].x, clf[i].y, clf[i].z, clf[i].w);
                printf("pos unsorted: %f, %f, %f, %f\n", hpos_u[i].x, hpos_u[i].y, hpos_u[i].z, hpos_u[i].w);
            }

			printf("**** SORTED POSITIONS *****\n");
            for (int i=0; i < num; i++)
            {
                printf("pos sorted: %f, %f, %f, %f\n", hpos_s[i].x, hpos_s[i].y, hpos_s[i].z, hpos_s[i].w);
            }

			printf("**** SORTED INDICES *****\n");
            for (int i=0; i < num; i++)
            {
                printf("indices: %d\n", hindices[i]);
            }
#endif



        //return nc;
    }
Пример #21
0
void potdata::readpot(const char *parmin_file,const char *potin_file,const double vol) {
  FILE *in;
  double x0,x1,dx,dr;
  int nx;

  double r0x,r1x,drx;
  int nrx;

  char metalx[80];
  int ipotx,modex; double pnx;
  double vol0;

  double *vatab,*vbtab,*vctab,*vdtab,*vetab,*p1tab,*altab,*vpairtab = 0;
  double *r0rwstab,*evol0tab;
  double (*C)[4];
  double *y,*dy;
  double x,dxdv;
  double unused;

  double zval,rws,ivol,r0rws,rcrws,rmrws;//,mass

  int i,j;
  int L;

  char line[1024];

  input_vol = vol;

  /* Read potential data */
  in = fopen(parmin_file,"r");
  do {
    fgets(line,sizeof(line),in);
  } while(line[strspn(line," \t")] == '#');

  /* Test to see whether this is a one-line or two-line version of parmin */
  if(sscanf(line,"%lf %lf %lf %lf %d",&ddl[1],&ddl[2],&ddl[3],&ddl[4],&L) == 5) {
    /* One-line version, call getparmindata to figure out volume table spacing. */
    int nvol;
    getparmindata(potin_file,&nvol,&vol0,&x0,&x1);
    dx = (x1-x0)/(nvol-1);
    if(0) {
      printf("getparmindata() ==> nvol = %d, vol0 = %.6f, x0= %.6f, x1 = %.6f, dx = %.6f\n",
	     nvol,vol0,x0,x1,dx);
    }
  } else {
    /* Two-line version, reparse this line, and read second line */
    sscanf(line,"%lf %lf %lf %lf",&x0,&x1,&dx,&vol0);
    fgets(line,sizeof(line),in);
    sscanf(line,"%lf %lf %lf %lf %d",&ddl[1],&ddl[2],&ddl[3],&ddl[4],&L);

  }
  double rws_scale = pow(3.0*vol0/(16.0*atan(1.0)),1.0/3.0);
  fclose(in);

  lang = L+1;
  lmax = 2*L+1;
  double s = ddl[1],p = ddl[2],d = ddl[3],f = ddl[4];
  double ss = s*s, pp = p*p, dd = d*d, ff = f*f;
  anorm3 =  s*ss + 2.0*( p*pp +  d*dd +  f*ff);
  anorm4 = ss*ss + 2.0*(pp*pp + dd*dd + ff*ff);
  /*
    for(i = 1; i<=lmax; i++) {
      for(j = 1; j<=lmax; j++)
        del0.m[i][j] = 0.0;
      del0[i][i] = 1.0;
    }
    Matrix::sz = lmax;
  */
  nx = (int) ((x1-x0)/dx + 1.1); /* Really: 1+round((x1-x0)/dx) */
  vatab = new double[nx];
  vbtab = new double[nx];
  vctab = new double[nx];
  vdtab = new double[nx];
  vetab = new double[nx];

  p1tab = new double[nx];
  altab = new double[nx];

  r0rwstab = new double[nx];
  evol0tab = new double[nx];

  in = fopen(potin_file,"r");

  int *tag = new int[nx];
  for(i = 0; i<nx; i++) tag[i] = 0;

  int ii;
  for(ii = 0; ii<nx; ii++) {

    do {
      fgets(line,sizeof(line),in);
    } while(line[strspn(line," \t")] == '#');

    metalx[0] = 0;

    /* Read element type, mode, and pn parameter */ {
      int nf = sscanf(line,"%s %d %d %lf",metalx,&ipotx,&modex,&pnx);
      if(nf < 3) {
	printf("Error in %s() @ %s:%d: Inconsistency in potential input file (%s) "
	       "at record %d:\n"
	       "  Expected at least three fields. Number of fields = %d\n",
	       __func__,__FILE__,__LINE__,potin_file,ii,
	       nf);
	exit(1);
      }
      if(modex <= 4) {
	pnx = 1.0;
      } else if(modex <= 6) {
	if(nf != 4) {
	  printf("Error in %s() @ %s:%d: Inconsistency in potential input file (%s) "
		 "at record %d:\n"
		 "  mode = %d, number of fields = %d\n",
		 __func__,__FILE__,__LINE__,potin_file,ii,
		 modex,nf);
	  exit(1);
	}
      } else {
	  printf("Error in %s() @ %s:%d: Inconsistency in potential input file (%s): "
		 "at record %d\n"
		 "  Invalid mode. mode = %d\n",
		 __func__,__FILE__,__LINE__,potin_file,ii,
		 modex);
      }
    }

    if(ii == 0) {
      sscanf(line,"%s %d %d %lf",metal,&ipot,&mode,&pn);
      if(modex <= 4) pn = pnx;
    } else {
      /* Check that {metal,ipot,mode}x == {metal,ipot,mode} */
      if(strcmp(metal,metalx) != 0 ||
	 ipotx != ipot ||
	 modex != mode ||
	 pnx != pn) {
	printf("Error in %s() @ %s:%d: Inconsistency in potential input file (%s) "
	       "at record %d:\n"
	       "metalx != metal (%s != %s) or\n"
	       "ipotx  != ipot  (%d != %d) or\n"
	       "modex  != mode  (%d != %d) or\n"
	       "pnx    != pn    (%.3f != %.3f).\n",
	       __func__,__FILE__,__LINE__,potin_file,ii,
	       metalx,metal,
	       ipotx,ipot,
	       modex,mode,
	       pnx,pn);
	exit(1);
      }
    }
    //printf("LINE: %s\n",line);
    //printf("metal = \'%s\'  ipot = %d  mode = %d\n",metalx,ipotx,modex);
    fgets(line,sizeof(line),in);
    sscanf(line,"%lf %lf %lf %lf",&zval,&ivol,&rws,&mass);
    /*{
      double xi = x0 + i/((double) (nx-1)) * (x1-x0);
      double volguess = vol0 * xi*xi*xi;
      if(fabs(volguess/ivol - 1.0) > 1e-3)
	printf("Wrong volume guess,  i=%d  volgues=%15.5e  ivol=%15.5e\n",
	       i,volguess,ivol);
     }*/

    double ifrac = (pow(ivol/vol0,1.0/3.0) - x0)/((x1-x0)/(nx-1));
    i = (int) (ifrac + 0.1);
    if(fabs(i - ifrac) > 0.01) {
      printf("Volume point not in table... ii=%d i=%d ifrac=%15.5e  vol=%15.5e\n",
	     ii,i,ifrac,ivol);
      printf("vol0 = %15.5e  zval = %15.5e  mass = %15.5e\n",vol0,zval,mass);
      exit(1);
    } else if(tag[i] == 1) {
      printf("Duplicate volume point in table.... ii=%d i=%d ifrac=%15.5e  vol=%15.5e\n",
	     ii,i,ifrac,ivol);
      exit(1);
    } else tag[i] = 1;

    fgets(line,sizeof(line),in);
    sscanf(line,"%lf %lf %lf %lf",&r0rwstab[i],&altab[i],&rcrws,&rmrws);
    fgets(line,sizeof(line),in);
    sscanf(line,"%lf %lf %lf",&p1tab[i],&unused,&evol0tab[i]);

    fgets(line,sizeof(line),in);
    sscanf(line,"%lf %lf %lf %lf %lf",
	   &vatab[i],&vbtab[i],&vctab[i],&vdtab[i],&vetab[i]);
    if(ipot == 1) {
      vatab[i] *= vdtab[i];
      vctab[i] *= vctab[i];
      vetab[i] *= vetab[i];
    }

    fgets(line,sizeof(line),in);

    fgets(line,sizeof(line),in);
    sscanf(line,"%lf %lf %lf",&r0x,&r1x,&drx);
    nrx = (int) ((r1x-r0x)/drx + 1.1); /* Really: 1+round((r1-r0)/dr) */

    if(ii == 0) {
      r0 = r0x; r1 = r1x; dr = drx; nr = nrx;
      vpairtab = new double[nx*nr];
    } else {
      /* Check that {r0,r1,dr,nr}x == {r0,r1,dr,nr} */
    }

    for(j = 0; j<nr; j++) {
      double rj,ktan,dvdvol;
      fgets(line,sizeof(line),in);
      sscanf(line,"%lf %lf %lf %lf",
	     &rj,&vpairtab[i*nr+j],&ktan,&dvdvol);

      { /* Add screening and fl() part to pair energy table */

	double al = altab[i];
	double p1 = p1tab[i];

	int bscreen = (al > 0.0);

	double xi = x0 + i/((double) (nx-1)) * (x1-x0);
	double rws = rws_scale * xi;

	double r0rws = r0rwstab[i];
	double r00 = r0rws*rws,rp = 1.8*rws;
	if(bscreen == 0) r0rws = 10.0;
	double alp = al,alm = al;
	if(mode == 2 || mode == 4 || mode == 6) alm = 125.0;
	al = alp;

	double r = r0 + j*(r1-r0)/(nr-1);

	double rrws = r/rws;
	//double rsqr = r*r;
	// double fl(double r,int mode,double rp,double p1,double al,double r0)
	double flr = fl(r,mode,rp,p1,al,r00,pn);
	double fl2 = flr*flr;
	double v2a = vatab[i]*fl2*fl2;
	double v2b = vbtab[i]*fl2;
	double fscr = 1.0;

	if(bscreen == 1 && rrws >= r0rws) {
	  double arg = rrws/r0rwstab[i];
	  double arg1 = arg - 1.0;
	  double arg12 = arg1*arg1;
	  double f,dp;
	  if(mode <= 2) {
	    f = fgauss(arg,al);
	    dp=2.*al*arg*arg1;
	  }
	  else {
	    f = hgauss(arg,al);
	    double arg13 = arg1*arg12;
	    dp=2.0*al*al*arg*arg13/(1.+al*arg12);
	  }
	  fscr = f*f;
	}

	double vpair_tmp = vpairtab[i*nr+j];
	vpairtab[i*nr+j] = vpairtab[i*nr+j]*fscr + v2a - v2b;

	if(0) if(fabs(vol-ivol) < 0.01) {
	  static FILE *xfile = NULL;
	  if(j == 0) {
	    xfile = fopen("mgpt5-pot.dat","w");
	    fprintf(xfile,"%%%%  vol = %15.5e  ivol = %15.5e i = %d  ii = %d\n",
		    vol,ivol,i,ii);
	  }
	  fprintf(xfile,"%15.5e %15.5e %15.5e %15.5e %15.5e %20.10e\n",
		  r,vpair_tmp,fscr,v2a,v2b,flr);
	  if(j == nr-1) fclose(xfile);
	}


      }

    }
  }
  fclose(in);

  for(i = 0; i<nx; i++)
    if(tag[i] == 0) {
      printf("Volume point missing in table. i = %d\n",i);
      exit(1);
    }

  /* Make table */
  x = pow(vol/vol0,1.0/3.0);
  dxdv = 1.0/(3.0*vol0*x*x);

  C = new double[(nr > nx) ? nr : nx][4];
  makespline(nx,1,vatab,C);
  evalspline(nx-1,x0,x1,C,x,&va,&dva,&unused);
  dva *= dxdv;

  makespline(nx,1,vbtab,C);
  evalspline(nx-1,x0,x1,C,x,&vb,&dvb,&unused);
  dvb *= dxdv;

  makespline(nx,1,vctab,C);
  evalspline(nx-1,x0,x1,C,x,&vc,&dvc,&unused);
  dvc *= dxdv;

  makespline(nx,1,vdtab,C);
  evalspline(nx-1,x0,x1,C,x,&vd,&dvd,&unused);
  dvd *= dxdv;

  makespline(nx,1,vetab,C);
  evalspline(nx-1,x0,x1,C,x,&ve,&dve,&unused);
  dve *= dxdv;

  makespline(nx,1,p1tab,C);
  evalspline(nx-1,x0,x1,C,x,&p1,&dp1,&unused);
  dp1 *= dxdv;

  makespline(nx,1,altab,C);
  evalspline(nx-1,x0,x1,C,x,&al,&dal,&unused);
  dal *= dxdv;
  if(mode == 2 || mode == 4 || mode == 6) {
    al = 125.0;
    dal = 0.0;
  }


  {
    double dr0rws;
    makespline(nx,1,r0rwstab,C);
    evalspline(nx-1,x0,x1,C,x,&r0rws,&dr0rws,&unused);
    dr0rws *= dxdv;
    rws = rws_scale*x;
    r00 = r0rws * rws;
    dr00 = dr0rws*rws + r0rws*rws_scale*dxdv;
    rp = 1.8 * rws;
    drp = 1.8 * rws_scale*dxdv;
  }

  makespline(nx,1,evol0tab,C);
  evalspline(nx-1,x0,x1,C,x,&evol0,&devol0,&unused);
  devol0 *= dxdv;

  if(1) {
    printf("%% READPOT PARAMETERS:\n");

    printf("%% ddl = %15.5e  %15.5e  %15.5e  %15.5e\n",ddl[1],ddl[2],ddl[3],ddl[4]);
    printf("%% anorm3 = %15.5e  anorm4 = %15.5e\n",anorm3,anorm4);

    printf("%% x  = %15.5e    pn  = %15.5e\n",x,pn);
    printf("%% va = %15.5e    dva = %15.5e\n",va,dva);
    printf("%% vb = %15.5e    dvb = %15.5e\n",vb,dvb);
    printf("%% vc = %15.5e    dvc = %15.5e\n",vc,dvc);
    printf("%% vd = %15.5e    dvd = %15.5e\n",vd,dvd);
    printf("%% ve = %15.5e    dve = %15.5e\n",ve,dve);
    printf("%% p1 = %15.5e    dp1 = %15.5e\n",p1,dp1);
    printf("%% al = %15.5e    dal = %15.5e\n",al,dal);
    printf("%% rp = %15.5e    drp = %15.5e\n",rp,drp);
    printf("%% r00= %15.5e    dr00= %15.5e\n",r00,dr00);
    printf("\n");
  }

  y = new double[nr];
  dy = new double[nr];

  for(j = 0; j<nr; j++) {
    double d2y;
    makespline(nx,nr,&vpairtab[j],C);
    evalspline(nx-1,x0,x1,C,x,&y[j],&dy[j],&d2y);
    dy[j] *= dxdv;
  }
  vpair_spline = new double[nr-1][4];
  dvpair_spline = new double[nr-1][4];
  makespline(nr,1,y,vpair_spline);
  makespline(nr,1,dy,dvpair_spline);


  rcrit = rcrws * rws;
  rmax = rmrws * rws;

  delete[] dy;
  delete[] y;
  delete[] C;
  delete[] evol0tab;
  delete[] r0rwstab;
  delete[] altab;
  delete[] p1tab;
  delete[] vetab;
  delete[] vdtab;
  delete[] vctab;
  delete[] vbtab;
  delete[] vatab;
}
Пример #22
0
 std::string CppExporter::toString(const Norm* op) const {
     if (not op) return "fl::null";
     return "new " + fl(op->className());
 }