Example #1
0
void initPassOne()
{
	aboutToFreeRuntime();

	//dump_pool_histo(pyr_pool_runtime);
	pyr_pool_runtime->FreeAllInternal();
	//dump_pool_histo(pyr_pool_runtime);
	//gPermanentObjPool.Init(pyr_pool_runtime, PERMOBJCHUNK);
	sClassExtFiles = 0;

	void *ptr = pyr_pool_runtime->Alloc(sizeof(SymbolTable));
	gMainVMGlobals->symbolTable  = new (ptr) SymbolTable(pyr_pool_runtime, 8192);

	//gFileSymbolTable = newSymbolTable(512);

	pyrmath_init_globs();

	initSymbols(); // initialize symbol globals
	//init_graph_compile();
	initSpecialSelectors();
	initSpecialClasses();
	initClasses();
	initParserPool();
	initParseNodes();
	initPrimitives();
	//tellPlugInsAboutToCompile();
	initLexer();
	compileErrors = 0;
	numClassDeps = 0;
	compiledOK = false;
	compiledDirectories.clear();
	sc_InitCompileDirectory();
}
Example #2
0
int main()
{
	int n = 0; char c;
	f = fopen("9.txt", "r");
	if (f == NULL)
		err("Eroare la fisier!");
	while ((c = fgetc(f)) != EOF)
		text[n++] = c;
	fclose(f);
	pointer_urmator = text;
	do
		getNextToken();
	while (lastToken->code != END);
	showAtoms();
	initSymbols(&symbols);
	AddExtFunctions();
	currentToken = tokens;
	unit();
	afisareSymbols(&symbols);
	return 0;
}
Example #3
0
TrackPickerDlg::TrackPickerDlg( wxWindow* parent ):TrackPickerDlgGen( parent )
{

  m_GridTrack->EnableEditing(false);
  m_GridTrack->EnableDragGridSize(false);
  m_GridTrack->ClearGrid();
  m_GridTrack->DeleteRows( 0, m_GridTrack->GetNumberRows() );
  m_GridTrack->SetCellTextColour(*wxWHITE);

  int itemidps = 7;
  int textps =  m_GridTrack->GetDefaultCellFont().GetPointSize();
  m_Renderer = new SymbolRenderer( NULL, this, wxGetApp().getFrame()->getSymMap(), itemidps, textps, wxGetApp().getFrame()->getScale() );


  m_GridSwitch->EnableEditing(false);
  m_GridSwitch->EnableDragGridSize(false);
  m_GridSwitch->ClearGrid();
  m_GridSwitch->DeleteRows( 0, m_GridSwitch->GetNumberRows() );
  m_GridSwitch->SetCellTextColour(*wxWHITE);

  m_GridSignal->EnableEditing(false);
  m_GridSignal->EnableDragGridSize(false);
  m_GridSignal->ClearGrid();
  m_GridSignal->DeleteRows( 0, m_GridSignal->GetNumberRows() );
  m_GridSignal->SetCellTextColour(*wxWHITE);

  m_GridBlock->EnableEditing(false);
  m_GridBlock->EnableDragGridSize(false);
  m_GridBlock->ClearGrid();
  m_GridBlock->DeleteRows( 0, m_GridBlock->GetNumberRows() );
  m_GridBlock->SetCellTextColour(*wxWHITE);

  m_GridSensor->EnableEditing(false);
  m_GridSensor->EnableDragGridSize(false);
  m_GridSensor->ClearGrid();
  m_GridSensor->DeleteRows( 0, m_GridSensor->GetNumberRows() );
  m_GridSensor->SetCellTextColour(*wxWHITE);

  m_GridAccessory->EnableEditing(false);
  m_GridAccessory->EnableDragGridSize(false);
  m_GridAccessory->ClearGrid();
  m_GridAccessory->DeleteRows( 0, m_GridAccessory->GetNumberRows() );
  m_GridAccessory->SetCellTextColour(*wxWHITE);

  m_GridRoad->EnableEditing(false);
  m_GridRoad->EnableDragGridSize(false);
  m_GridRoad->ClearGrid();
  m_GridRoad->DeleteRows( 0, m_GridRoad->GetNumberRows() );
  m_GridRoad->SetCellTextColour(*wxWHITE);

  initSymbols();

  m_TrackBook->SetPageText( 0, wxGetApp().getMsg( "track" ) );
  m_TrackBook->SetPageText( 1, wxGetApp().getMsg( "turnout" ) );
  m_TrackBook->SetPageText( 2, wxGetApp().getMsg( "signal" ) );
  m_TrackBook->SetPageText( 3, wxGetApp().getMsg( "block" ) );
  m_TrackBook->SetPageText( 4, wxGetApp().getMsg( "sensor" ) );
  m_TrackBook->SetPageText( 5, wxGetApp().getMsg( "accessory" ) );
  m_TrackBook->SetPageText( 6, wxGetApp().getMsg( "road" ) );
  SetTitle( wxGetApp().getMsg("additem") );

  m_TrackBook->SetSelection(0);
  GetSizer()->Fit(this);
  GetSizer()->SetSizeHints(this);
}
Example #4
0
void MScore::init()
      {
      Sym::init();

#ifdef SCRIPT_INTERFACE
      qRegisterMetaType<Element::ElementType>("ElementType");
      qRegisterMetaType<MScore::ValueType>("ValueType");
      qRegisterMetaType<MScore::Direction>("Direction");
      qRegisterMetaType<MScore::DirectionH>("DirectionH");
      qRegisterMetaType<Element::Placement>("Placement");
      qRegisterMetaType<Accidental::AccidentalRole>("AccidentalRole");
      qRegisterMetaType<Accidental::AccidentalType>("AccidentalType");
      qRegisterMetaType<Spanner::Anchor>("Anchor");
      qRegisterMetaType<Note::NoteHeadGroup>("NoteHeadGroup");
      qRegisterMetaType<Note::NoteHeadType>("NoteHeadType");
      qRegisterMetaType<Segment::SegmentType>("SegmentType");
      qRegisterMetaType<FiguredBassItem::Modifier>("Modifier");
      qRegisterMetaType<FiguredBassItem::Parenthesis>("Parenthesis");
      qRegisterMetaType<VoltaType>("VoltaType");
      qRegisterMetaType<Ottava::OttavaType>("OttavaType");
      qRegisterMetaType<Trill::TrillType>("TrillType");
      qRegisterMetaType<Element::DynamicRange>("DynamicRange");
      qRegisterMetaType<JumpType>("JumpType");
      qRegisterMetaType<MarkerType>("MarkerType");
      qRegisterMetaType<BeamMode>("BeamMode");
#endif

      DPMM = DPI / INCH;       // dots/mm

#ifdef __MINGW32__
      QDir dir(QCoreApplication::applicationDirPath() + QString("/../" INSTALL_NAME));
      _globalShare = dir.absolutePath() + "/";
#elif defined(Q_WS_IOS)
      {
      extern QString resourcePath();
      _globalShare = resourcePath();
      }
#elif defined(Q_WS_MAC)
      QDir dir(QCoreApplication::applicationDirPath() + QString("/../Resources"));
      _globalShare = dir.absolutePath() + "/";
#else
      _globalShare = QString( INSTPREFIX "/share/" INSTALL_NAME);
#endif

      selectColor[0].setRgb(0, 0, 255);     //blue
      selectColor[1].setRgb(0, 150, 0);     //green
      selectColor[2].setRgb(230, 180, 50);  //yellow
      selectColor[3].setRgb(200, 0, 200);   //purple
      defaultColor        = Qt::black;
      dropColor           = Qt::red;
      nudgeStep           = .1;       // in spatium units (default 0.1)
      defaultPlayDuration = 300;      // ms
      warnPitchRange      = true;
      replaceFractions    = true;
      playRepeats         = true;
      panPlayback         = true;
      partStyle           = "";

      lastError           = "";

      layoutBreakColor    = Qt::green;
      soundFont           = _globalShare + "sound/fluid.sf3";
      bgColor.setRgb(0x76, 0x76, 0x6e);

      _defaultStyle         = new MStyle();
      ::initStyle(_defaultStyle);
      _baseStyle            = new MStyle(*_defaultStyle);

      //
      //  load internal fonts
      //
      //
      // do not load application specific fonts
      // for MAC, they are in Resources/fonts
      //
#if !defined(Q_WS_MAC) && !defined(Q_WS_UIKIT)
      static const char* fonts[] = {
            "mscore-20.otf",
            "MuseJazz.ttf",
            "FreeSans.ttf",
            "FreeSerifMscore.ttf",
            "FreeSerifBold.ttf",
            "gonville-20.otf",
            "mscoreTab.ttf",
            "mscore-BC.ttf"
            };

      for (unsigned i = 0; i < sizeof(fonts)/sizeof(*fonts); ++i) {
            QString s = QString(":/fonts/%1").arg(fonts[i]);
            if (-1 == QFontDatabase::addApplicationFont(s)) {
                  qDebug("Mscore: fatal error: cannot load internal font <%s>\n", fonts[i]);
                  if (!MScore::debugMode)
                        exit(-1);
                  }
            }
#endif
      StaffTypeTablature::readConfigFile(0);          // get TAB font config, before initStaffTypes()
      initSymbols(0);   // init emmentaler symbols
      initStaffTypes();
      initDrumset();
      FiguredBass::readConfigFile(0);
      }
Example #5
0
void MScore::init()
      {
      DPMM = DPI / INCH;       // dots/mm

#ifdef __MINGW32__
      QDir dir(QCoreApplication::applicationDirPath() + QString("/../" INSTALL_NAME));
      _globalShare = dir.absolutePath() + "/";
#else
#ifdef Q_WS_MAC
#ifdef Q_WS_IOS
      {
      extern QString resourcePath();
      _globalShare = resourcePath();
      }
#else
      QDir dir(QCoreApplication::applicationDirPath() + QString("/../Resources"));
      _globalShare = dir.absolutePath() + "/";
#endif
#else
      _globalShare = QString( INSTPREFIX "/share/" INSTALL_NAME);
#endif
#endif
      selectColor[0].setRgb(0, 0, 255);     //blue
      selectColor[1].setRgb(0, 150, 0);     //green
      selectColor[2].setRgb(230, 180, 50);  //yellow
      selectColor[3].setRgb(200, 0, 200);   //purple
      defaultColor        = Qt::black;
      dropColor           = Qt::red;
      nudgeStep           = .1;       // in spatium units (default 0.1)
      defaultPlayDuration = 300;      // ms
      warnPitchRange      = true;
      replaceFractions    = true;
      partStyle           = "";
      layoutBreakColor    = Qt::green;
      soundFont           = _globalShare + "sound/TimGM6mb.sf2";
      bgColor.setRgb(0x76, 0x76, 0x6e);

      _defaultStyle         = new MStyle();
      ::initStyle(_defaultStyle);
      _baseStyle            = new MStyle(*_defaultStyle);

      //
      //  load internal fonts
      //
      //
      // do not load application specific fonts
      // for MAC, they are in Resources/fonts
      //
#if !defined(Q_WS_MAC) && !defined(Q_WS_UIKIT)
      static const char* fonts[] = {
            "mscore-20.otf",
            "mscore1-20.ttf",
            "MuseJazz.ttf",
            "FreeSans.ttf",
            "FreeSerifMscore.ttf",
            "FreeSerifBold.ttf",
            "gonville-20.otf",
            "mscore_tab_baroque.ttf",
            "mscore_tab_modern.ttf",
            "mscore_tab_renaiss.ttf",
            "mscore_tab_renaiss2.ttf",
//            "FiguredBassMHGPL.otf",
            "mscore-BC.ttf"
            };

      for (unsigned i = 0; i < sizeof(fonts)/sizeof(*fonts); ++i) {
            QString s = QString(":/fonts/%1").arg(fonts[i]);
            if (-1 == QFontDatabase::addApplicationFont(s)) {
                  qDebug("Mscore: fatal error: cannot load internal font <%s>\n", fonts[i]);
                  if (!MScore::debugMode)
                        exit(-1);
                  }
            }
#endif
      initSymbols(0);   // init emmentaler symbols
      initStaffTypes();
      initDrumset();
      FiguredBass::readConfigFile(0);
      }
Example #6
0
void printYields( vector<TChain*> chmc , vector<char*> labels , TChain* chdata , TCut sel , TCut weight , bool latex ){

  initSymbols( latex );

  TCanvas *ctemp = new TCanvas();

  printLine(latex);
  printHeader();
  printLine(latex);

  TH1F* hyield = new TH1F("hyield","yield",4,0,4);
  TH1F* hmctot = new TH1F("hmctot","hmctot",4,0,4);
  hyield->Sumw2();
  hmctot->Sumw2();

  //----------------------
  // print SM MC samples
  //----------------------

  for(unsigned int imc = 0 ; imc < chmc.size() ; imc++){

    bool correlatedError = false;

    if( TString(labels[imc]).Contains("T2") ) continue;

    // data-driven DY estimate
    if( strcmp(labels[imc],"DYdata")   == 0 ){
      //hyield = doDYestimate( chmc[imc] , sel );
      doDYestimate( chmc[imc] , sel , hyield );
    }

    // fake estimate
    else if( strcmp(labels[imc],"single fakes")   == 0 || strcmp(labels[imc],"double fakes") == 0){

      //correlatedError = true;

      TString weightstring(weight.GetTitle());
      weightstring.ReplaceAll("ndavtxweight","1");
      TCut newweight = TCut(weightstring);

      chmc[imc]->Draw("leptype>>hyield",sel*newweight);

      // SF --> SF - 2 X DF
      if( strcmp(labels[imc],"single fakes")   == 0 ){
	
	TH1F *hyielddf = new TH1F("hyielddf","hyielddf",4,0,4);

	chmc[imc+1]->Draw("leptype>>hyielddf",sel*newweight);
	hyield->Add(hyielddf,-2);
      }      

      hyield->SetBinError(1,0.5*hyield->GetBinContent(1));
      hyield->SetBinError(2,0.5*hyield->GetBinContent(2));
      
    }

    //vanilla MC
    else{
      chmc[imc]->Draw("leptype>>hyield",sel*weight);

      //do efficiency correction
      //hyield->SetBinContent  ( 2 , hyield->GetBinContent(2) * 0.90);
      //hyield->SetBinContent  ( 3 , hyield->GetBinContent(3) * 0.95);
      //hyield->SetBinError    ( 2 , hyield->GetBinError(2)   * 0.90);
      //hyield->SetBinError    ( 3 , hyield->GetBinError(3)   * 0.95);

    }

    if( imc == 0 ) hmctot = (TH1F*) hyield->Clone();
    else           hmctot->Add(hyield);
    
    print( hyield , labels[imc] , correlatedError );

    //hyield->Reset();
  }

  printLine(latex);

  //-------------------------------
  // print sum of SM MC samples
  //-------------------------------

  print( hmctot , "total SM MC" );

  printLine(latex);
 
  chdata->Draw("leptype>>hyield",sel);

  print( hyield , "data" );
    
  printLine(latex);

  //----------------------
  // print T2tt MC samples
  //----------------------

  for(unsigned int imc = 0 ; imc < chmc.size() ; imc++){

    if( !TString(labels[imc]).Contains("T2") ) continue;

    chmc[imc]->Draw("leptype>>hyield",sel*weight);

    if( TString(labels[imc]).Contains("X5")  ) hyield->Scale(5);
    if( TString(labels[imc]).Contains("X6")  ) hyield->Scale(6);
    if( TString(labels[imc]).Contains("X10") ) hyield->Scale(10);

    //do efficiency correction
    //hyield->SetBinContent  ( 2 , hyield->GetBinContent(2) * 0.90);
    //hyield->SetBinContent  ( 3 , hyield->GetBinContent(3) * 0.95);
    //hyield->SetBinError    ( 2 , hyield->GetBinError(2)   * 0.90);
    //hyield->SetBinError    ( 3 , hyield->GetBinError(3)   * 0.95);
    
    print( hyield , labels[imc] );

  }

  printLine(latex);


  
  delete ctemp;
}
Example #7
0
void MScore::init()
      {
      spatium = SPATIUM20;

#ifdef __MINGW32__
      QDir dir(QCoreApplication::applicationDirPath() + QString("/../" INSTALL_NAME));
      _globalShare = dir.absolutePath() + "/";
#else
#ifdef Q_WS_MAC
      QDir dir(QCoreApplication::applicationDirPath() + QString("/../Resources"));
      _globalShare = dir.absolutePath() + "/";
#else
      _globalShare = QString( INSTPREFIX "/share/" INSTALL_NAME);
#endif
#endif
      selectColor[0].setRgb(0, 0, 255);     //blue
      selectColor[1].setRgb(0, 150, 0);     //green
      selectColor[2].setRgb(230, 180, 50);  //yellow
      selectColor[3].setRgb(200, 0, 200);   //purple
      defaultColor        = Qt::black;
      dropColor           = Qt::red;
      nudgeStep           = .1;       // in spatium units (default 0.1)
      defaultPlayDuration = 300;      // ms
      warnPitchRange      = true;
      paperSize           = QPrinter::A4;     // default paper size
      paperWidth          = (210 / INCH);
      paperHeight         = (297 / INCH);
      landscape           = false;
      twosided            = true;
      replaceFractions    = true;
      partStyle           = "";
      layoutBreakColor    = Qt::green;
      soundFont           = _globalShare + "sound/TimGM6mb.sf2";
      bgColor.setRgb(0x76, 0x76, 0x6e);

      _defaultStyle         = new Style();
      setDefaultStyle(_defaultStyle);     // initialize default style
      _baseStyle            = new Style(*_defaultStyle);
      //
      //  load internal fonts
      //
      //
      // do not load application specific fonts
      // for MAC, they are in Resources/fonts
      //
#if !defined(Q_WS_MAC) && !defined(Q_WS_UIKIT)
      static const char* fonts[] = {
            "mscore-20.otf",
            "mscore1-20.ttf",
            "MuseJazz.ttf",
            "FreeSans.ttf",
            "FreeSerifMscore.ttf",
            "FreeSerifBold.ttf",
            "gonville-20.otf",
            "mscore_tab_baroque.ttf",
            "mscore_tab_modern.ttf",
            "mscore_tab_renaiss.ttf",
            "mscore_tab_renaiss2.ttf"
            };
      for (unsigned i = 0; i < sizeof(fonts)/sizeof(*fonts); ++i) {
            QString s = QString(":/fonts/%1").arg(fonts[i]);
            if (-1 == QFontDatabase::addApplicationFont(s)) {
                  fprintf(stderr, "Mscore: fatal error: cannot load internal font <%s>\n", fonts[i]);
                  if (!debugMode)
                        exit(-1);
                  }
            }
#endif
      initSymbols(0);   // init emmentaler symbols
      initStaffTypes();
      initDrumset();
      }