diff --git a/.gitattributes b/.gitattributes index 59c522bf2c7..b132669c67f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -252,9 +252,11 @@ Arrangement_2/examples/Arrangement_2/ex_infinite_edge_insertion.C -text Arrangement_2/examples/Arrangement_2/ex_infinite_insert.C -text Arrangement_2/examples/Arrangement_2/ex_infinite_non_intersecting.C -text Benchmark/examples/Benchmark/bbox.C -text +Benchmark/examples/Benchmark/check_syntax.C -text Benchmark/examples/Benchmark/data/test1.bff -text Benchmark/examples/Benchmark/data/test2.bff -text Benchmark/examples/Benchmark/leftturn.C -text +Benchmark/examples/Benchmark/makefile -text Benchmark/examples/Benchmark/simple.C -text Benchmark/include/CGAL/Bench_option_parser.h -text Benchmark/include/CGAL/Benchmark_visitor.h -text diff --git a/Benchmark/examples/Benchmark/check_syntax.C b/Benchmark/examples/Benchmark/check_syntax.C new file mode 100644 index 00000000000..84d55b9c4ee --- /dev/null +++ b/Benchmark/examples/Benchmark/check_syntax.C @@ -0,0 +1,86 @@ +/************************************************************************** +// Copyright (c) 2004 Max-Planck-Institut Saarbruecken (Germany) +// All rights reserved. +// +// This file is part of BenchmarkParser; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation; version 2.1 of the License. +// See the file LICENSE.LGPL distributed with BenchmarkParser. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $Source: /KM/projects/ecg/CVS/BMTools/parser/src/check_syntax.C,v $ +// $Revision: 1.6 $ $Date: 2005/02/25 16:32:17 $ +// $Name: $ +// +// Author(s) : Lutz Kettner +**************************************************************************/ + +#include + +#include "CGAL/benchmark_basic.h" + +namespace cb = CGAL::benchmark; + +struct Checker : public cb::Benchmark_visitor { + Checker() {} + virtual void token_not_handled( std::string s) {} + virtual void accept_benchmark_name( std::string s) { + Benchmark_visitor::accept_benchmark_name(s); + std::cerr << "name '" << s << "', "; + } + + virtual void accept_classification( std::string problem, + std::string geom, + std::string clas, + std::string family, + std::string instance, + std::string release) { + + if ((problem != "Arrangement") && (problem != "CSG") + && (problem != " ")) + error_handler( "classification error"); + + if ((geom != "Lines") && (geom != "Circles") && (geom != "Conics") + && (geom != "Cubics") && (geom != "Quartics") + && (geom != "ArbitraryDegreeCurves") && ( geom != "Quadrics") + && (geom != "Tori") && (geom != "Planes") && (geom != " ")) + error_handler( "classification error" ); + + if ((clas != "FullCurves") && (clas != "Ellipses") + && (clas != "BoundedArcs") && (clas != "UnboundedArcs") + && (clas != "FullSurfaces") && (clas != "BoundedPatches") + && (clas != "UnboundedPatches") && (clas != " ")) + error_handler( "classification error" ); + } +}; + + + +int main( int argc, char* argv[] ) { + int exit_status = 0; + if ( argc < 2) { + Checker check; + std::cerr << "File read from , "; + if ( cb::benchmark_parse_stream( std::cin, "", & check)) { + std::cerr << "is o.k." << std::endl; + } else { + std::cerr << "is malformed." << std::endl; + exit_status = 1; + } + } else { + for ( int i = 1; i < argc; ++i) { + Checker check; + std::cerr << "File '" << argv[i] << "', "; + if ( cb::benchmark_parse_file( argv[i], & check)) { + std::cerr << "is o.k." << std::endl; + } else { + std::cerr << "is malformed." << std::endl; + exit_status = 1; + } + } + } + return exit_status; +} + diff --git a/Benchmark/examples/Benchmark/makefile b/Benchmark/examples/Benchmark/makefile new file mode 100644 index 00000000000..d9d4c0641b0 --- /dev/null +++ b/Benchmark/examples/Benchmark/makefile @@ -0,0 +1,51 @@ +# Created by the script cgal_create_makefile +# This is the makefile for compiling a CGAL application. + +#---------------------------------------------------------------------# +# include platform specific settings +#---------------------------------------------------------------------# +# Choose the right include file from the /make directory. + +# CGAL_MAKEFILE = ENTER_YOUR_INCLUDE_MAKEFILE_HERE +include $(CGAL_MAKEFILE) + +#---------------------------------------------------------------------# +# compiler flags +#---------------------------------------------------------------------# + +CXXFLAGS = \ + -I../../include \ + $(CGAL_CXXFLAGS) \ + $(LONG_NAME_PROBLEM_CXXFLAGS) + +#---------------------------------------------------------------------# +# linker flags +#---------------------------------------------------------------------# + +LIBPATH = $(CGAL_LIBPATH) -L../../src/Benchmark + +LDFLAGS = $(LONG_NAME_PROBLEM_LDFLAGS) $(CGAL_LDFLAGS) -lCGALBenchmark + +#---------------------------------------------------------------------# +# target entries +#---------------------------------------------------------------------# + +all: check_syntax$(EXE_EXT) simple$(EXE_EXT) leftturn$(EXE_EXT) + +check_syntax$(EXE_EXT): check_syntax$(OBJ_EXT) + $(CGAL_CXX) $(LIBPATH) $(EXE_OPT)check_syntax $? $(LDFLAGS) + +simple$(EXE_EXT): simple$(OBJ_EXT) + $(CGAL_CXX) $(LIBPATH) $(EXE_OPT)simple $? $(LDFLAGS) + +leftturn$(EXE_EXT): leftturn$(OBJ_EXT) + $(CGAL_CXX) $(LIBPATH) $(EXE_OPT)leftturn $? $(LDFLAGS) + +clean: check_syntax.clean simple.clean leftturn.clean + +#---------------------------------------------------------------------# +# suffix rules +#---------------------------------------------------------------------# + +.C$(OBJ_EXT): + $(CGAL_CXX) $(CXXFLAGS) $(OBJ_OPT) $<