示例#1
0
void EditorToolThreaded::slotAbort()
{
    d->currentRenderingMode = EditorToolThreaded::NoneRendering;

    if (analyser())
    {
        analyser()->cancelFilter();
    }

    if (filter())
    {
        filter()->cancelFilter();
    }

    EditorToolIface::editorToolIface()->setToolStopProgress();

    toolSettings()->enableButton(EditorToolSettings::Ok,      true);
    toolSettings()->enableButton(EditorToolSettings::Load,    true);
    toolSettings()->enableButton(EditorToolSettings::SaveAs,  true);
    toolSettings()->enableButton(EditorToolSettings::Try,     true);
    toolSettings()->enableButton(EditorToolSettings::Default, true);
    toolView()->setEnabled(true);

    kapp->restoreOverrideCursor();

    renderingFinished();
}
    void processAnalysis()
    {
        std::string absoluteFilename = STRINGIFY(EBU_TEST_ESSENCES);
        absoluteFilename += "/";
        absoluteFilename += _file.getFilename();
        Loudness::io::SoundFile audioFile;

        if(!audioFile.open_read(absoluteFilename.c_str()))
        {
            Loudness::io::AnalyseFile analyser(_loudness, audioFile);
            analyser(checkProgress);
            audioFile.close();
        }
        std::cout << absoluteFilename << std::endl;
        _loudness.printPloudValues();
    }
示例#3
0
int IdentificateurFacteur::eval(TableDesSymboles *tablesDesSymboles) {
    LOG(INFO) << "IdentificateurFacteur::eval";
    if (analyser(tablesDesSymboles)) {
        return *tablesDesSymboles->getValeur(id->getNom());
    } else {
        exit(1);
    }
}
示例#4
0
int main()
{
	/*OracleBuilder oracle_builder;
	oracle_builder.parse_productions("data.txt");
	std::cout << oracle_builder.production_list_to_string() << std::endl;
	oracle_builder.build_first_sets();
	std::cout << oracle_builder.first_sets_to_string() << std::endl;


	Production goal_production = oracle_builder.get_production_list()[0];
	LrItem goal_item = LrItem(goal_production);
	std::set<LrItem> initial_set = { goal_item };
	std::set<LrItem> initial_state = oracle_builder.closure(initial_set);

	for each (LrItem lritem in initial_state)
	{
	std::cout << lritem << ", ";
	}*/

	Synt analyser("program.txt", "data.txt");
	//std::cout << analyser.builder;
	//ofstream file("out.txt");
	//file << analyser.builder << endl;
	//file.close();
	analyser.Run();
	
	analyser.lexer.showLexemes();

	/*OracleBuilder oracle_builder2;
	oracle_builder2.build_oracle("data.txt");
	fsm_lexer lexer;
	lexer.Run("program.txt");
	lexer.showLexemes();*/
	
	//std::cout << oracle_builder2 << std::endl;

	/*OracleBuilder oracle_builder;
	oracle_builder.build_oracle("data.txt");
	std::cout << oracle_builder;*/
	return 0;
}
示例#5
0
void run_program( const char * filename ) {
    SemanticAnalyser analyser( std::make_unique<Parser>(filename) );
    bool errors = false;
    while( analyser.has_next() )
        try {
            analyser.next();
        } catch ( parse_error& ex ) {
            std::cerr << "Syntactic error: " << ex.what()
                      << ' ' << ex.where.line << ':' << ex.where.column << '\n';
            errors = true;
        } catch ( semantic_error & ex ) {
            std::cerr << "Semantic error: " << ex.what() << '\n';
            errors = true;
        }

    if( errors ) {
        std::cerr << "Aborting due to programming errors.\n";
        return;
    }

    std::cout << *SymbolTable::lastNullaryInserted()->compute() << std::endl;
}
示例#6
0
文件: renderer.c 项目: kunaldeo/JESS
void *renderer (void)
{
 
  gint16 data_tmp[2][512];

  nice (10);

 again:;
  printf("Renderer loop (re)started \n");
  
  while (!quit_renderer)
    {   
#ifdef DEBUG  
 	printf("Debut renderer\n");   
#endif 
      if(conteur.freeze == 0)
	{

	  SDL_mutexP(mutex_one); 
	  memcpy (data_tmp, data, sizeof( data ));
	  SDL_mutexV(mutex_one);

#ifdef DEBUG
	  printf("ips()\n");
#endif
	  ips (); 


#ifdef DEBUG
	  printf("manage_dynamic_and_states_open\n");
#endif
	  manage_dynamic_and_states_open();

#ifdef DEBUG
	  printf("render_deformation\n");
#endif
	  render_deformation(conteur.blur_mode);
	
#ifdef DEBUG
	  printf("render_blur\n");
#endif
	  render_blur(0); 
	
#ifdef DEBUG
	  printf("draw_mode\n");
#endif
	  draw_mode(conteur.draw_mode);

#ifdef DEBUG
	  printf("copy_and_fade\n");
#endif
	  copy_and_fade(DEDT_FACTOR*lys.dEdt_moyen);

	  if (conteur.analyser == 1) 
	    {
#ifdef DEBUG
	      printf("analyser\n");
#endif
	      analyser(pixel);
	    }
#ifdef DEBUG
	  printf("manage_states_close\n");
#endif
	  manage_states_close();
	}

#ifdef DEBUG
      printf("SDL_UpdateRect\n");
#endif
     SDL_UpdateRect (screen,0,0,resx,resy);
     
#ifdef DEBUG
     printf("keyboard\n");
#endif
     keyboard ();

    }

  printf("Renderer Ok je quitte\n");
  quit_renderer = 0;
  
  if(resolution_change == 1)
    {
      jess_cleanup();
      jess_init();
      resolution_change = 0;
      goto again;
    }
 
  return NULL;
}
int main(int argc, char** argv)
{
    bool validToProcess = false;
    bool showTime = false;
    bool enableOptimization = true;
    std::vector<int> standards;
    std::vector<std::string> filenames;

    time_t start, end;

    for(int i = 1; i < argc; i++)
    {

        if(strcmp(argv[i], "--progress") == 0)
        {
            showProgress = true;
        }
        if(strcmp(argv[i], "--verbose") == 0)
        {
            showProgress = true;
            showResults = true;
        }
        if(strcmp(argv[i], "--time") == 0)
        {
            showTime = true;
        }
        if(strcmp(argv[i], "--disable-optimization") == 0)
        {
            enableOptimization = false;
        }
        if(strncmp(argv[i], "--standard=", 11) == 0)
        {
            if(strcmp(argv[i], "--standard=cst") == 0)
            {
                standards.push_back(0);
            }
            else
            {
                if(strcmp(argv[i], "--standard=ebu") == 0)
                {
                    standards.push_back(1);
                }
                else
                {
                    if(strcmp(argv[i], "--standard=atsc") == 0)
                    {
                        standards.push_back(2);
                    }
                    else
                    {
                        std::cout << "Error: unknown standard specified in command line" << std::endl;
                        return -100;
                    }
                }
            }
        }
        if(standards.empty())
        {
            standards.push_back(1); // default standard : EBU R128
        }
        std::string ext(argv[i]);
        ext.erase(0, ext.length() - 5);
        std::string ext4 = ext;
        ext4.erase(0, 1);
        if(strcmp(ext.c_str(), ".aiff") == 0 || strcmp(ext4.c_str(), ".aif") == 0 || strcmp(ext4.c_str(), ".wav") == 0)
        {
            filenames.push_back(argv[i]);
            validToProcess = true;
        }
    }
    if(validToProcess)
    {
        for(size_t i = 0; i < filenames.size(); i++)
        {
            std::cout << filenames.at(i) << std::endl;

            std::string filename(filenames.at(i));
            if(filename.at(filename.length() - 4) == '.')
                filename.erase(filename.length() - 4, 4);
            else if(filename.at(filename.length() - 5) == '.')
                filename.erase(filename.length() - 5, 5);

            filename.append("_PLoud.xml");
            Loudness::tools::WriteXml writerXml(filename, filenames.at(i));

            for(size_t j = 0; j < standards.size(); j++)
            {
                Loudness::io::SoundFile audioFile;
                Loudness::analyser::LoudnessLevels levels =
                    standards.at(j) == 0 ? Loudness::analyser::LoudnessLevels::Loudness_CST_R017()
                                         : standards.at(j) == 1 ? Loudness::analyser::LoudnessLevels::Loudness_EBU_R128()
                                                                : Loudness::analyser::LoudnessLevels::Loudness_ATSC_A85();

                Loudness::analyser::LoudnessAnalyser loudness(levels);
                if(!audioFile.open_read(filenames.at(i).c_str()))
                {
                    time(&start);
                    Loudness::io::AnalyseFile analyser(loudness, audioFile);
                    analyser.enableOptimization(enableOptimization);
                    analyser(progress);
                    time(&end);
                    if(showResults)
                        loudness.printPloudValues();
                    audioFile.close();
                    writerXml.writeResults("unknown", loudness);
                    double dif = difftime(end, start);
                    if(showTime)
                        std::cout << "processing time: " << dif << " seconds." << std::endl;
                }
            }
        }
    }
    else
    {
        std::cout << "Loudness Analyser" << std::endl;
        std::cout << "Author: Marc-Antoine ARNAUD" << std::endl << std::endl;
        std::cout << "Common usage :" << std::endl;
        std::cout << "\tloudness-analyser [options] filename.ext" << std::endl << std::endl;
        std::cout << "Options :" << std::endl;
        std::cout << "\t--standard=ebu/cst/atsc : select one standard to validate the Loudness" << std::endl;
        std::cout << "\t\t\tebu:  EBU R 128 (default)" << std::endl;
        std::cout << "\t\t\tcst:  CST RT 017" << std::endl;
        std::cout << "\t\t\tatsc: ATSC A/85" << std::endl;
        return -1;
    }
    return 0;
}
示例#8
0
void Calculatrice::afficherPile(const QString & txt){
    analyser(txt);
    this->pileActive()->afficher();
}
示例#9
0
void Calculatrice::envoyer(){
    QString txt = ui->entreeTxt->text();
    analyser(txt);
}
bool IfcGeom::convert_openings_fast(const Ifc2x3::IfcProduct::ptr entity, const Ifc2x3::IfcRelVoidsElement::list& openings, 
							   const IfcRepresentationShapeItems& entity_shapes, const gp_Trsf& entity_trsf, IfcRepresentationShapeItems& cut_shapes) {
	
	// Create a compound of all opening shapes in order to speed up the boolean operations
	TopoDS_Compound opening_compound;
	BRep_Builder builder;
	builder.MakeCompound(opening_compound);

	for ( Ifc2x3::IfcRelVoidsElement::it it = openings->begin(); it != openings->end(); ++ it ) {
		Ifc2x3::IfcRelVoidsElement::ptr v = *it;
		Ifc2x3::IfcFeatureElementSubtraction::ptr fes = v->RelatedOpeningElement();
		if ( fes->is(Ifc2x3::Type::IfcOpeningElement) ) {

			// Convert the IfcRepresentation of the IfcOpeningElement
			gp_Trsf opening_trsf;
			IfcGeom::convert(fes->ObjectPlacement(),opening_trsf);

			// Move the opening into the coordinate system of the IfcProduct
			opening_trsf.PreMultiply(entity_trsf.Inverted());

			Ifc2x3::IfcProductRepresentation::ptr prodrep = fes->Representation();
			Ifc2x3::IfcRepresentation::list reps = prodrep->Representations();

			IfcGeom::IfcRepresentationShapeItems opening_shapes;
						
			for ( Ifc2x3::IfcRepresentation::it it2 = reps->begin(); it2 != reps->end(); ++ it2 ) {
				IfcGeom::convert_shapes(*it2,opening_shapes);
			}

			for ( unsigned int i = 0; i < opening_shapes.size(); ++ i ) {
				gp_GTrsf gtrsf = opening_shapes[i].Placement();
				gtrsf.PreMultiply(opening_trsf);
				const TopoDS_Shape& opening_shape = gtrsf.Form() == gp_Other
					? BRepBuilderAPI_GTransform(opening_shapes[i].Shape(),gtrsf,true).Shape()
					: (opening_shapes[i].Shape()).Moved(gtrsf.Trsf());
				builder.Add(opening_compound,opening_shape);
			}

		}
	}

	// Iterate over the shapes of the IfcProduct
	for ( IfcGeom::IfcRepresentationShapeItems::const_iterator it3 = entity_shapes.begin(); it3 != entity_shapes.end(); ++ it3 ) {
		TopoDS_Shape entity_shape_solid;
		const TopoDS_Shape& entity_shape_unlocated = IfcGeom::ensure_fit_for_subtraction(it3->Shape(),entity_shape_solid);
		const gp_GTrsf& entity_shape_gtrsf = it3->Placement();
		TopoDS_Shape entity_shape;
		if ( entity_shape_gtrsf.Form() == gp_Other ) {
			Logger::Message(Logger::LOG_WARNING,"Applying non uniform transformation to:",entity->entity);
			entity_shape = BRepBuilderAPI_GTransform(entity_shape_unlocated,entity_shape_gtrsf,true).Shape();
		} else {
			entity_shape = entity_shape_unlocated.Moved(entity_shape_gtrsf.Trsf());
		}

		BRepAlgoAPI_Cut brep_cut(entity_shape,opening_compound);
		bool is_valid = false;
		if ( brep_cut.IsDone() ) {
			TopoDS_Shape brep_cut_result = brep_cut;
				
			BRepCheck_Analyzer analyser(brep_cut_result);
			is_valid = analyser.IsValid() != 0;
			if ( is_valid ) {
				cut_shapes.push_back(IfcGeom::IfcRepresentationShapeItem(brep_cut_result, &it3->Style()));
			}
		}
		if ( !is_valid ) {
			// Apparently processing the boolean operation failed or resulted in an invalid result
			// in which case the original shape without the subtractions is returned instead
			// we try convert the openings in the original way, one by one.
			Logger::Message(Logger::LOG_WARNING,"Subtracting combined openings compound failed:",entity->entity);
			return false;
		}
		
	}
	return true;
}
bool IfcGeom::convert_openings(const Ifc2x3::IfcProduct::ptr entity, const Ifc2x3::IfcRelVoidsElement::list& openings, 
							   const IfcRepresentationShapeItems& entity_shapes, const gp_Trsf& entity_trsf, IfcRepresentationShapeItems& cut_shapes) {
	// Iterate over IfcOpeningElements
	IfcGeom::IfcRepresentationShapeItems opening_shapes;
	unsigned int last_size = 0;
	for ( Ifc2x3::IfcRelVoidsElement::it it = openings->begin(); it != openings->end(); ++ it ) {
		Ifc2x3::IfcRelVoidsElement::ptr v = *it;
		Ifc2x3::IfcFeatureElementSubtraction::ptr fes = v->RelatedOpeningElement();
		if ( fes->is(Ifc2x3::Type::IfcOpeningElement) ) {

			// Convert the IfcRepresentation of the IfcOpeningElement
			gp_Trsf opening_trsf;
			IfcGeom::convert(fes->ObjectPlacement(),opening_trsf);

			// Move the opening into the coordinate system of the IfcProduct
			opening_trsf.PreMultiply(entity_trsf.Inverted());

			Ifc2x3::IfcProductRepresentation::ptr prodrep = fes->Representation();
			Ifc2x3::IfcRepresentation::list reps = prodrep->Representations();
						
			for ( Ifc2x3::IfcRepresentation::it it2 = reps->begin(); it2 != reps->end(); ++ it2 ) {
				IfcGeom::convert_shapes(*it2,opening_shapes);
			}

			const unsigned int current_size = (const unsigned int) opening_shapes.size();
			for ( unsigned int i = last_size; i < current_size; ++ i ) {
				opening_shapes[i].prepend(opening_trsf);
			}
			last_size = current_size;
		}
	}

	// Iterate over the shapes of the IfcProduct
	for ( IfcGeom::IfcRepresentationShapeItems::const_iterator it3 = entity_shapes.begin(); it3 != entity_shapes.end(); ++ it3 ) {
		TopoDS_Shape entity_shape_solid;
		const TopoDS_Shape& entity_shape_unlocated = IfcGeom::ensure_fit_for_subtraction(it3->Shape(),entity_shape_solid);
		const gp_GTrsf& entity_shape_gtrsf = it3->Placement();
		TopoDS_Shape entity_shape;
		if ( entity_shape_gtrsf.Form() == gp_Other ) {
			Logger::Message(Logger::LOG_WARNING,"Applying non uniform transformation to:",entity->entity);
			entity_shape = BRepBuilderAPI_GTransform(entity_shape_unlocated,entity_shape_gtrsf,true).Shape();
		} else {
			entity_shape = entity_shape_unlocated.Moved(entity_shape_gtrsf.Trsf());
		}

		// Iterate over the shapes of the IfcOpeningElements
		for ( IfcGeom::IfcRepresentationShapeItems::const_iterator it4 = opening_shapes.begin(); it4 != opening_shapes.end(); ++ it4 ) {
			TopoDS_Shape opening_shape_solid;
			const TopoDS_Shape& opening_shape_unlocated = IfcGeom::ensure_fit_for_subtraction(it4->Shape(),opening_shape_solid);
			const gp_GTrsf& opening_shape_gtrsf = it4->Placement();
			if ( opening_shape_gtrsf.Form() == gp_Other ) {
				Logger::Message(Logger::LOG_WARNING,"Applying non uniform transformation to opening of:",entity->entity);
			}
			const TopoDS_Shape& opening_shape = opening_shape_gtrsf.Form() == gp_Other
				? BRepBuilderAPI_GTransform(opening_shape_unlocated,opening_shape_gtrsf,true).Shape()
				: opening_shape_unlocated.Moved(opening_shape_gtrsf.Trsf());
					
			double opening_volume, original_shape_volume;
			if ( Logger::Verbosity() >= Logger::LOG_WARNING ) {
				opening_volume = shape_volume(opening_shape);
				if ( opening_volume <= ALMOST_ZERO )
					Logger::Message(Logger::LOG_WARNING,"Empty opening for:",entity->entity);
				original_shape_volume = shape_volume(entity_shape);
			}
			
			BRepAlgoAPI_Cut brep_cut(entity_shape,opening_shape);

			if ( brep_cut.IsDone() ) {
				TopoDS_Shape brep_cut_result = brep_cut;
				
				BRepCheck_Analyzer analyser(brep_cut_result);
				bool is_valid = analyser.IsValid() != 0;
				if ( is_valid ) {
					entity_shape = brep_cut;
					if ( Logger::Verbosity() >= Logger::LOG_WARNING ) {
						const double volume_after_subtraction = shape_volume(entity_shape);
					
						if ( ALMOST_THE_SAME(original_shape_volume,volume_after_subtraction) )
							Logger::Message(Logger::LOG_WARNING,"Subtraction yields unchanged volume:",entity->entity);
					}
				} else {
					Logger::Message(Logger::LOG_ERROR,"Invalid result from subtraction:",entity->entity);
				}
			} else {
				Logger::Message(Logger::LOG_ERROR,"Failed to process subtraction:",entity->entity);
			}

		}
		cut_shapes.push_back(IfcGeom::IfcRepresentationShapeItem(entity_shape, &it3->Style()));
	}

	return true;
}