diff --git a/htdocs/demo/report/index.php b/htdocs/demo/report/index.php index b6793ae95..18ff7d904 100644 --- a/htdocs/demo/report/index.php +++ b/htdocs/demo/report/index.php @@ -39,7 +39,7 @@ * @param string $code Source code * @return string Output lines */ - function get_democlient_outout($code) { + function get_democlient_output($code) { $postdata = http_build_query( array( 'code' => $code @@ -59,6 +59,28 @@ return file('http://cppcheck.sourceforge.net/cgi-bin/democlient.cgi', false, $context); } + /** + * ... + * @param array $output Output lines + * @return array Parsed output + */ + function parse_democlient_output($output) { + $parsed = array(); + foreach ($output as $line) { //for each output line... + $line = trim($line); + if (empty($line)) { //if empty line... + continue; + } + preg_match('/\[test.c:(\d+)\]: (.*)/', $line, $matches); + $lineNumber = $matches[1]; + $result = $matches[2]; + if (!empty($lineNumber) && !empty($result)) { //if complete result... + $parsed[$lineNumber][] = $result; + } + } + return $parsed; + } + function cut_string($string, $length = 1024) { if (strlen($string) > $length) { return substr($string, 0, $length); @@ -82,14 +104,17 @@ echo "
" . htmlspecialchars($line) . "
\n"; } + echo "Use the online demo page to create the report.
\n"; diff --git a/htdocs/site/css/all.css b/htdocs/site/css/all.css index eb0a6b50f..1f9520a9b 100644 --- a/htdocs/site/css/all.css +++ b/htdocs/site/css/all.css @@ -6,6 +6,10 @@ body { background: #eee; } +dt { + font-weight:bold; +} + /* Default link style */ a:link { color:#036; text-decoration:underline; } a:visited { color:#036; text-decoration:underline; }