Hello community, here is the log from the commit of package ohcount for openSUSE:Factory checked in at 2013-04-02 12:32:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ohcount (Old) and /work/SRC/openSUSE:Factory/.ohcount.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "ohcount", Maintainer is "" Changes: -------- --- /work/SRC/openSUSE:Factory/ohcount/ohcount.changes 2012-12-07 14:43:39.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.ohcount.new/ohcount.changes 2013-04-02 12:32:49.000000000 +0200 @@ -1,0 +2,8 @@ +Wed Mar 20 12:54:25 UTC 2013 - jengelh@inai.de + +- Update to new git snapshot (3.0.0.g) +* Added support for Genie and Vala .vapi files +* Detect file import on pp disambiguation +* Add support for Coq .v files (based on the OCaml parser) + +------------------------------------------------------------------- Old: ---- ohcount-3.0.0.g297.tar.xz New: ---- ohcount-3.0.0.g312.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ohcount.spec ++++++ --- /var/tmp/diff_new_pack.gIyV8W/_old 2013-04-02 12:32:52.000000000 +0200 +++ /var/tmp/diff_new_pack.gIyV8W/_new 2013-04-02 12:32:52.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package ohcount # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -18,9 +18,9 @@ Name: ohcount %define lname libohcount -Version: 3.0.0.g297 +Version: 3.0.0.g312 Release: 0 -# git-describe: 2.0.1-297-g6cb04fe +# git-describe: 2.0.1-312-g4fb66a8 Url: http://ohloh.net/p/ohcount Summary: The Ohloh source code line counter License: GPL-2.0 @@ -39,7 +39,8 @@ BuildRequires: gperf BuildRequires: pcre-devel BuildRequires: pkg-config -BuildRequires: ragel >= 6.3, ruby-devel +BuildRequires: ragel >= 6.3 +BuildRequires: ruby-devel BuildRequires: swig BuildRequires: xz BuildRequires: pkgconfig(ruby-1.9) @@ -88,7 +89,6 @@ rm -f "$r"/*.{c,i}; %post -n %lname -p /sbin/ldconfig - %postun -n %lname -p /sbin/ldconfig %files @@ -96,7 +96,7 @@ %doc COPYING %_bindir/ohcount -%files -n libohcount +%files -n %lname %defattr(-,root,root) %_libdir/libohcount.so ++++++ ohcount-3.0.0.g297.tar.xz -> ohcount-3.0.0.g312.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/src/detector.c new/ohcount/src/detector.c --- old/ohcount/src/detector.c 2012-11-16 00:07:57.000000000 +0100 +++ new/ohcount/src/detector.c 2013-03-20 13:53:38.000000000 +0100 @@ -771,6 +771,8 @@ // strnlen is not available on OS X, so we roll our own size_t mystrnlen(const char *begin, size_t maxlen) { + if (begin == NULL) + return 0; const char *end = memchr(begin, '\0', maxlen); return end ? (end - begin) : maxlen; } @@ -778,6 +780,9 @@ const char *disambiguate_pp(SourceFile *sourcefile) { char *p = ohcount_sourcefile_get_contents(sourcefile); + if (!p) + return NULL; + /* prepare regular expressions */ const char *error; int erroffset; @@ -792,7 +797,7 @@ /* check for standard puppet constructs */ pcre *construct; - construct = pcre_compile("^\\s*(define\\s+[\\w:-]+\\s*\\(|class\\s+[\\w:-]+(\\s+inherits\\s+[\\w:-]+)?\\s*{|node\\s+\\'?[\\w:\\.-]+\\'?\\s*{)", + construct = pcre_compile("^\\s*(define\\s+[\\w:-]+\\s*\\(|class\\s+[\\w:-]+(\\s+inherits\\s+[\\w:-]+)?\\s*{|node\\s+\\'?[\\w:\\.-]+\\'?\\s*{|import\\s+\")", PCRE_MULTILINE, &error, &erroffset, NULL); if (pcre_exec(construct, NULL, p, mystrnlen(p, 10000), 0, 0, NULL, 0) > -1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/src/hash/extensions.gperf new/ohcount/src/hash/extensions.gperf --- old/ohcount/src/hash/extensions.gperf 2012-11-16 00:07:57.000000000 +0100 +++ new/ohcount/src/hash/extensions.gperf 2013-03-20 13:53:38.000000000 +0100 @@ -85,6 +85,7 @@ glsl, LANG_GLSL go, LANG_GOLANG groovy, LANG_GROOVY +gs, LANG_GENIE gz, BINARY h, DISAMBIGUATE("h") h++, LANG_CPP @@ -203,6 +204,8 @@ tiff, BINARY tpl, LANG_HTML vala, LANG_VALA +vapi, LANG_VALA +v, LANG_COQ vb, LANG_VISUALBASIC vba, LANG_VISUALBASIC vbs, LANG_VISUALBASIC diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/src/hash/languages.gperf new/ohcount/src/hash/languages.gperf --- old/ohcount/src/hash/languages.gperf 2012-11-16 00:07:57.000000000 +0100 +++ new/ohcount/src/hash/languages.gperf 2013-03-20 13:53:38.000000000 +0100 @@ -24,6 +24,7 @@ clojure, LANG_CLOJURE, "Clojure", 0 cmake, LANG_CMAKE, "Cmake script", 2 coffescript, LANG_COFFEESCRIPT, "CoffeeScript", 0 +coq, LANG_COQ, "Coq", 0 cpp, LANG_CPP, "C++", 0 cs_aspx, LANG_CS_ASPX, "", 0 csharp, LANG_CSHARP, "C#", 0 @@ -44,6 +45,7 @@ fortranfixed, LANG_FORTRANFIXED, "Fortan (Fixed-format)", 0 fortranfree, LANG_FORTRANFREE, "Fortan (Free-format)", 0 fsharp, LANG_FSHARP, "F#", 0 +genie, LANG_GENIE, "Genie", 0 glsl, LANG_GLSL, "OpenGL Shading Language", 0 golang, LANG_GOLANG, "Golang", 0 groovy, LANG_GROOVY, "Groovy", 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/src/hash/parsers.gperf new/ohcount/src/hash/parsers.gperf --- old/ohcount/src/hash/parsers.gperf 2012-11-16 00:07:57.000000000 +0100 +++ new/ohcount/src/hash/parsers.gperf 2013-03-20 13:53:38.000000000 +0100 @@ -18,6 +18,7 @@ #include "../parsers/clearsilverhtml.h" #include "../parsers/coffeescript.h" #include "../parsers/cmake.h" +#include "../parsers/coq.h" #include "../parsers/cs_aspx.h" #include "../parsers/css.h" #include "../parsers/d.h" @@ -116,6 +117,7 @@ clearsilver_template, parse_cshtml clojure, parse_clojure coffeescript, parse_coffeescript +coq, parse_coq cpp, parse_cpp cs_aspx, parse_cs_aspx csharp, parse_csharp @@ -135,6 +137,7 @@ fortranfixed, parse_fortranfixed fortranfree, parse_fortranfree fsharp, parse_fsharp +genie, parse_genie glsl, parse_glsl golang, parse_golang groovy, parse_groovy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/src/languages.h new/ohcount/src/languages.h --- old/ohcount/src/languages.h 2012-11-16 00:07:57.000000000 +0100 +++ new/ohcount/src/languages.h 2013-03-20 13:53:38.000000000 +0100 @@ -26,6 +26,7 @@ #define LANG_CLOJURE "clojure" #define LANG_CMAKE "cmake" #define LANG_COFFEESCRIPT "coffeescript" +#define LANG_COQ "coq" #define LANG_CPP "cpp" #define LANG_CS_ASPX "cs_aspx" #define LANG_CSHARP "csharp" @@ -45,6 +46,7 @@ #define LANG_FORTRANFIXED "fortranfixed" #define LANG_FORTRANFREE "fortranfree" #define LANG_FSHARP "fsharp" +#define LANG_GENIE "genie" #define LANG_GLSL "glsl" #define LANG_GOLANG "golang" #define LANG_GROOVY "groovy" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/src/parsers/c.rl new/ohcount/src/parsers/c.rl --- old/ohcount/src/parsers/c.rl 2012-11-16 00:07:57.000000000 +0100 +++ new/ohcount/src/parsers/c.rl 2013-03-20 13:53:38.000000000 +0100 @@ -211,6 +211,17 @@ C_LANG = ORIG_C_LANG; } +const char *GENIE_LANG = LANG_GENIE; +void parse_genie(char *buffer, int length, int count, + void (*callback) (const char *lang, const char *entity, + int s, int e, void *udata), + void *userdata + ) { + C_LANG = GENIE_LANG; + parse_c(buffer, length, count, callback, userdata); + C_LANG = ORIG_C_LANG; +} + const char *CUDA_LANG = LANG_CUDA; void parse_cuda(char *buffer, int length, int count, void (*callback) (const char *lang, const char *entity, int s, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/src/parsers/coq.rl new/ohcount/src/parsers/coq.rl --- old/ohcount/src/parsers/coq.rl 1970-01-01 01:00:00.000000000 +0100 +++ new/ohcount/src/parsers/coq.rl 2013-03-20 13:53:38.000000000 +0100 @@ -0,0 +1,135 @@ +/************************* Required for every parser *************************/ +#ifndef OHCOUNT_COQ_PARSER_H +#define OHCOUNT_COQ_PARSER_H + +#include "../parser_macros.h" + +// the name of the language +const char *COQ_LANG = LANG_COQ; + +// the languages entities +const char *coq_entities[] = { + "space", "comment", "string", "any" +}; + +// constants associated with the entities +enum { + COQ_SPACE = 0, COQ_COMMENT, COQ_STRING, COQ_ANY +}; + +/*****************************************************************************/ + +%%{ + machine coq; + write data; + include common "common.rl"; + + # Line counting machine + + action coq_ccallback { + switch(entity) { + case COQ_SPACE: + ls + break; + case COQ_ANY: + code + break; + case INTERNAL_NL: + std_internal_newline(COQ_LANG) + break; + case NEWLINE: + std_newline(COQ_LANG) + } + } + + action coq_comment_nc_res { nest_count = 0; } + action coq_comment_nc_inc { nest_count++; } + action coq_comment_nc_dec { nest_count--; } + + coq_nested_block_comment = + '(*' >coq_comment_nc_res @comment ( + newline %{ entity = INTERNAL_NL; } %coq_ccallback + | + ws + | + '(*' @coq_comment_nc_inc @comment + | + '*)' @coq_comment_nc_dec @comment + | + (nonnewline - ws) @comment + )* :>> ('*)' when { nest_count == 0 }) @comment; + + coq_comment = coq_nested_block_comment; + + coq_string = + '"' @code ( + newline %{ entity = INTERNAL_NL; } %coq_ccallback + | + ws + | + [^"] @code + )* '"'; + + coq_line := |* + spaces ${ entity = COQ_SPACE; } => coq_ccallback; + coq_comment; + coq_string; + newline ${ entity = NEWLINE; } => coq_ccallback; + ^space ${ entity = COQ_ANY; } => coq_ccallback; + *|; + + # Entity machine + + action coq_ecallback { + callback(COQ_LANG, coq_entities[entity], cint(ts), cint(te), userdata); + } + + coq_comment_entity = '(*' >coq_comment_nc_res ( + '(*' @coq_comment_nc_inc + | + '*)' @coq_comment_nc_dec + | + any + )* :>> ('*)' when { nest_count == 0 }); + + coq_entity := |* + space+ ${ entity = COQ_SPACE; } => coq_ecallback; + coq_comment_entity ${ entity = COQ_COMMENT; } => coq_ecallback; + # TODO: + ^space; + *|; +}%% + +/************************* Required for every parser *************************/ + +/* Parses a string buffer with Coq code. + * + * @param *buffer The string to parse. + * @param length The length of the string to parse. + * @param count Integer flag specifying whether or not to count lines. If yes, + * uses the Ragel machine optimized for counting. Otherwise uses the Ragel + * machine optimized for returning entity positions. + * @param *callback Callback function. If count is set, callback is called for + * every line of code, comment, or blank with 'lcode', 'lcomment', and + * 'lblank' respectively. Otherwise callback is called for each entity found. + */ +void parse_coq(char *buffer, int length, int count, + void (*callback) (const char *lang, const char *entity, int s, + int e, void *udata), + void *userdata + ) { + init + + int nest_count = 0; + + %% write init; + cs = (count) ? coq_en_coq_line : coq_en_coq_entity; + %% write exec; + + // if no newline at EOF; callback contents of last line + if (count) { process_last_line(COQ_LANG) } +} + +#endif + +/*****************************************************************************/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/test/detect_files/client-osx.gs new/ohcount/test/detect_files/client-osx.gs --- old/ohcount/test/detect_files/client-osx.gs 1970-01-01 01:00:00.000000000 +0100 +++ new/ohcount/test/detect_files/client-osx.gs 2013-03-20 13:53:38.000000000 +0100 @@ -0,0 +1,38 @@ +/* + * WebSoy - Client for OSX + * Copyright (C) 2011,2012 Copyleft Games Group + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published + * by the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program; if not, see http://www.gnu.org/licenses + * + */ + +#if XP_MACOSX + +[indent=4] +uses + GLib + GL + +class Client : Object + scene : soy.scenes.Scene + window : soy.widgets.Window + + construct (window : NP.Window) + self.scene = new soy.scenes.Scene() + self.window = new soy.widgets.Window(null) + + // TODO + +#endif + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/test/detect_files/coq.v new/ohcount/test/detect_files/coq.v --- old/ohcount/test/detect_files/coq.v 1970-01-01 01:00:00.000000000 +0100 +++ new/ohcount/test/detect_files/coq.v 2013-03-20 13:53:38.000000000 +0100 @@ -0,0 +1,10 @@ +Require Import String. +(* comment *) +Check "multiline +string"%string. + +(* multiline + comment *) + +(* recursion in (* a + comment *) to complicate things *) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/test/detect_files/puppet_import.pp new/ohcount/test/detect_files/puppet_import.pp --- old/ohcount/test/detect_files/puppet_import.pp 1970-01-01 01:00:00.000000000 +0100 +++ new/ohcount/test/detect_files/puppet_import.pp 2013-03-20 13:53:38.000000000 +0100 @@ -0,0 +1,2 @@ +import "classes/*.pp" +import "definitions/*.pp" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/test/detect_files/puppet_import_annotated.pp new/ohcount/test/detect_files/puppet_import_annotated.pp --- old/ohcount/test/detect_files/puppet_import_annotated.pp 1970-01-01 01:00:00.000000000 +0100 +++ new/ohcount/test/detect_files/puppet_import_annotated.pp 2013-03-20 13:53:38.000000000 +0100 @@ -0,0 +1,2 @@ +puppet lcode import "classes/*.pp" +puppet lcode import "definitions/*.pp" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/test/detect_files/puppet_test.pp new/ohcount/test/detect_files/puppet_test.pp --- old/ohcount/test/detect_files/puppet_test.pp 1970-01-01 01:00:00.000000000 +0100 +++ new/ohcount/test/detect_files/puppet_test.pp 2013-03-20 13:53:38.000000000 +0100 @@ -0,0 +1,3 @@ +class main::sub { + include substuff +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/test/detect_files/puppet_test_annotated.pp new/ohcount/test/detect_files/puppet_test_annotated.pp --- old/ohcount/test/detect_files/puppet_test_annotated.pp 1970-01-01 01:00:00.000000000 +0100 +++ new/ohcount/test/detect_files/puppet_test_annotated.pp 2013-03-20 13:53:38.000000000 +0100 @@ -0,0 +1,3 @@ +puppet lcode class main::sub { +puppet lcode include substuff +puppet lcode } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/test/expected_dir/coq.v new/ohcount/test/expected_dir/coq.v --- old/ohcount/test/expected_dir/coq.v 1970-01-01 01:00:00.000000000 +0100 +++ new/ohcount/test/expected_dir/coq.v 2013-03-20 13:53:38.000000000 +0100 @@ -0,0 +1,10 @@ +coq code Require Import String. +coq comment (* comment *) +coq code Check "multiline +coq code string"%string. +coq blank +coq comment (* multiline +coq comment comment *) +coq blank +coq comment (* recursion in (* a +coq comment comment *) to complicate things *) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/test/src_dir/coq.v new/ohcount/test/src_dir/coq.v --- old/ohcount/test/src_dir/coq.v 1970-01-01 01:00:00.000000000 +0100 +++ new/ohcount/test/src_dir/coq.v 2013-03-20 13:53:38.000000000 +0100 @@ -0,0 +1,10 @@ +Require Import String. +(* comment *) +Check "multiline +string"%string. + +(* multiline + comment *) + +(* recursion in (* a + comment *) to complicate things *) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/test/unit/detector_test.h new/ohcount/test/unit/detector_test.h --- old/ohcount/test/unit/detector_test.h 2012-11-16 00:07:57.000000000 +0100 +++ new/ohcount/test/unit/detector_test.h 2013-03-20 13:53:38.000000000 +0100 @@ -150,6 +150,7 @@ ASSERT_DETECT(LANG_NSIS, "foo.nsh"); ASSERT_DETECT(LANG_COFFEESCRIPT, "foo.coffee"); ASSERT_DETECT(LANG_QML, "foo.qml"); + ASSERT_DETECT(LANG_COQ, "coq.v"); ASSERT_NODETECT("empty.inc"); } @@ -198,6 +199,19 @@ ASSERT_DETECT(LANG_C, "emacs_mode.c"); } +void test_detector_puppet(){ + ASSERT_DETECT(LANG_PUPPET, "puppet_import.pp"); + ASSERT_DETECT(LANG_PUPPET, "puppet_test.pp"); +} + +void test_detector_genie(){ + ASSERT_DETECT(LANG_GENIE, "client-osx.gs"); +} + +void test_non_existent_file(){ + ASSERT_NODETECT("xxx_non_exists_xxxi.pp"); +} + void all_detector_tests() { test_detector_smalltalk(); test_detector_disambiguate_asx(); @@ -216,4 +230,7 @@ test_detector_xml_with_custom_extension(); test_detector_brainfuck(); test_detector_emacs_mode(); + test_detector_puppet(); + test_detector_genie(); + test_non_existent_file(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/test/unit/parser_test.h new/ohcount/test/unit/parser_test.h --- old/ohcount/test/unit/parser_test.h 2012-11-16 00:07:57.000000000 +0100 +++ new/ohcount/test/unit/parser_test.h 2013-03-20 13:53:38.000000000 +0100 @@ -91,6 +91,7 @@ #include "parsers/test_clearsilvertemplate.h" #include "parsers/test_clearsilver.h" #include "parsers/test_clojure.h" +#include "parsers/test_coq.h" #include "parsers/test_cs_aspx.h" #include "parsers/test_csharp.h" #include "parsers/test_css.h" @@ -274,6 +275,7 @@ all_clearsilver_template_tests(); all_clearsilver_tests(); all_clojure_tests(); + all_coq_tests(); all_cs_aspx_tests(); all_csharp_tests(); all_css_tests(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/ohcount/test/unit/parsers/test_coq.h new/ohcount/test/unit/parsers/test_coq.h --- old/ohcount/test/unit/parsers/test_coq.h 1970-01-01 01:00:00.000000000 +0100 +++ new/ohcount/test/unit/parsers/test_coq.h 2013-03-20 13:53:38.000000000 +0100 @@ -0,0 +1,19 @@ + +void test_coq_comments() { + test_parser_verify_parse( + test_parser_sourcefile("coq", " (* comment *)"), + "coq", "", "(* comment *)", 0 + ); +} + +void test_coq_comment_entities() { + test_parser_verify_entity( + test_parser_sourcefile("coq", " (*comment*)"), + "comment", "(*comment*)" + ); +} + +void all_coq_tests() { + test_coq_comments(); + test_coq_comment_entities(); +} -- To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-commit+help@opensuse.org