From e3d038fc9bc221df72fc0b41b2b4c7c8ecc800a7 Mon Sep 17 00:00:00 2001 From: Eric Berberich Date: Fri, 23 Mar 2007 14:18:23 +0000 Subject: [PATCH] added creation script --- .gitattributes | 1 + .../developer_scripts/create_bench_webpage | 130 ++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100755 Benchmark_instances/developer_scripts/create_bench_webpage diff --git a/.gitattributes b/.gitattributes index d2ed202f1e5..742b3a13eeb 100644 --- a/.gitattributes +++ b/.gitattributes @@ -338,6 +338,7 @@ Benchmark/doc_tex/Benchmark/fig/classification.gif -text svneol=unset#image/gif Benchmark/doc_tex/Benchmark/fig/classification.pdf -text svneol=unset#application/pdf Benchmark/examples/Benchmark/polynomial.cpp -text Benchmark/src/Benchmark/benchmark_lexer.l -text +Benchmark_instances/developer_scripts/create_bench_webpage -text Boolean_set_operations_2/demo/Boolean_set_operations_2/boolean_operations.vcproj eol=crlf Boolean_set_operations_2/demo/Boolean_set_operations_2/data/vlsi_1.dxf -text svneol=unset#application/octet-stream Boolean_set_operations_2/demo/Boolean_set_operations_2/data/vlsi_2.dxf -text svneol=unset#application/octet-stream diff --git a/Benchmark_instances/developer_scripts/create_bench_webpage b/Benchmark_instances/developer_scripts/create_bench_webpage new file mode 100755 index 00000000000..5335563e191 --- /dev/null +++ b/Benchmark_instances/developer_scripts/create_bench_webpage @@ -0,0 +1,130 @@ +#!/usr/bin/perl -w + +sub print_html_header { + my $title = $_[0]; + return <<"END_HEADER"; + + + + + CGAL Benchmark - $title + + + +END_HEADER +} + +sub check_unique_filenames { + my $cmdline ='find . -name "*.bff" -type f'; + open FILES, "$cmdline|"; + my %filenames = (); + while() { + chomp; + my $filename = $_; + if( $_ =~ /\/([^\/]+)$/ ) { + $filename = $1; + } + if( defined $filenames{$1} ) { + printf STDERR "! Warning: duplicate filename \"$1\"\n"; + } + $filenames{$1} = 1; + } + close FILES; +} + +%targz = (); + + + +sub parse_description { + my $description=$_[0]; + print "\tparsing description $description\n"; + my $outdir = ""; + my $basename = ""; + if( $description =~ /^[^\/]+\/[^\/]+\/[^\/]+\/([^\/]+\/)([^\/]+)$/ ) { + $outdir = $1; + $basename = $2; + } else { + printf STDERR "! Error: badly placed description filename $description\n"; + return; + } + printf OUT "

$outdir$basename

\n"; + open DESC, $description; + + my $in_paragraph = 0; + my $first_paragraph = 1; + while( ) { + # check for empty lines and produce

tags + if( $_ =~ /^\s*$/ ) { + if( $in_paragraph && !$first_paragraph ) { + printf OUT "

\n\n"; + } + $in_paragraph = 0; + } else { + if( ! $in_paragraph ) { + printf OUT "

"; + } + $first_paragraph = 0; + $in_paragraph = 1; + if( $_ =~ /\\instance(\[\w+\])?\{([^}]+)\}/ ) { + my $pre=$`; + my $post=$'; + #my $modifier=$1; + my $location=$2; + my $filenames=""; + my $pattern="-name \"*.bff\""; + if( $location =~ /\/([^\/]*\*[^\/]*)$/ ) { + $pattern = " -maxdepth 1 -name \"$1\""; + $location = $`; + } + my $cmdline ="find $location $pattern -type f"; + open FILENAMES, "$cmdline|"; + while( ) { + chomp; + $filenames .= $_." "; + } + close FILENAMES; + my $id = $targz{$basename}++; + my $freshname = "${basename}_${id}.tar.gz"; + $cmdline = "tar czf $html/data/$freshname $filenames"; + system "$cmdline"; + printf OUT "$pre$freshname$post"; + } else { + printf OUT; + } + } + } + close DESC; +} + +&check_unique_filenames; + +$html='Benchmark_instaces/out_html'; + +system "rm -rf $html"; +system "mkdir -p $html/data"; +opendir PKG, "."; +open OUT, ">$html/index.html"; +printf OUT &print_html_header( "CGAL Benchmarks - Overview" ); +printf OUT "

CGAL Benchmarks - Overview

\n\n"; +while( $pkg=readdir PKG ) { + if( -d $pkg && $pkg ne '.' && $pkg ne '..' && $pkg ne '.svn') { + print "searching in package: $pkg\n"; + if( -d "$pkg/benchmark/description" ) { + #print " contains benchmark\n"; + open FILES, "find $pkg/benchmark/description -type f -name \"*.desc\"|"; + while() { + chomp; + &parse_description( $_ ); + } + close FILES; + } + } +} +printf OUT <<"END_FOOTER"; + + +END_FOOTER +close OUT; +closedir PKG; +print "\n";