[07/12] lucy-clownfish git commit: Move CFC test files into "common" directory

2016-03-10 Thread nwellnhof
Move CFC test files into "common" directory


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/82ad2895
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/82ad2895
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/82ad2895

Branch: refs/heads/master
Commit: 82ad28953d9d1e2e66fded8ef8ffab85be18f124
Parents: df605b5
Author: Nick Wellnhofer 
Authored: Sat Mar 5 19:46:12 2016 +0100
Committer: Nick Wellnhofer 
Committed: Sat Mar 5 19:52:04 2016 +0100

--
 compiler/c/t/cfbase/Animal.cfh  |  21 
 compiler/c/t/cfbase/Animal.cfp  |   4 -
 compiler/c/t/cfbase/Animal/Dog.cfh  |  28 -
 compiler/c/t/cfbase/Animal/Util.cfh |  23 
 compiler/c/t/cfclash/bar/Bar.cfh|  25 
 compiler/c/t/cfclash/bar/Bar.cfp|   4 -
 compiler/c/t/cfclash/bar/Baz.cfh|  25 
 compiler/c/t/cfclash/class/Animal/DogClash.cfh  |  28 -
 compiler/c/t/cfclash/class/AnimalExtension.cfp  |   5 -
 compiler/c/t/cfclash/file/Animal/Dog.cfh|  28 -
 compiler/c/t/cfclash/foo/Foo.cfh|  25 
 compiler/c/t/cfclash/foo/Foo.cfp|   4 -
 compiler/c/t/cfext/Animal/Rottweiler.cfh|  31 -
 compiler/c/t/cfext/AnimalExtension.cfp  |   8 --
 compiler/c/t/test_cfc.c |   2 +-
 compiler/common/test/cfbase/Animal.cfh  |  21 
 compiler/common/test/cfbase/Animal.cfp  |   4 +
 compiler/common/test/cfbase/Animal/Dog.cfh  |  28 +
 compiler/common/test/cfbase/Animal/Util.cfh |  23 
 compiler/common/test/cfclash/bar/Bar.cfh|  25 
 compiler/common/test/cfclash/bar/Bar.cfp|   4 +
 compiler/common/test/cfclash/bar/Baz.cfh|  25 
 .../test/cfclash/class/Animal/DogClash.cfh  |  28 +
 .../test/cfclash/class/AnimalExtension.cfp  |   5 +
 .../common/test/cfclash/file/Animal/Dog.cfh |  28 +
 compiler/common/test/cfclash/foo/Foo.cfh|  25 
 compiler/common/test/cfclash/foo/Foo.cfp|   4 +
 .../common/test/cfext/Animal/Rottweiler.cfh |  31 +
 compiler/common/test/cfext/AnimalExtension.cfp  |   8 ++
 compiler/perl/buildlib/Clownfish/CFC/Build.pm   |  21 ++--
 .../buildlib/Clownfish/CFC/Test/TestUtils.pm|  44 +++
 compiler/perl/lib/Clownfish/CFC.xs  |   5 +-
 compiler/perl/t/403-parcel.t|   3 +-
 compiler/perl/t/500-hierarchy.t |   7 +-
 compiler/perl/t/501-include_dir.t   |   7 +-
 compiler/perl/t/cfbase/Animal.cfh   |  21 
 compiler/perl/t/cfbase/Animal.cfp   |   4 -
 compiler/perl/t/cfbase/Animal/Dog.cfh   |  28 -
 compiler/perl/t/cfbase/Animal/Util.cfh  |  23 
 compiler/perl/t/cfext/Animal/Rottweiler.cfh |  31 -
 compiler/perl/t/cfext/AnimalExtension.cfp   |   8 --
 compiler/perl/t/core/403-parcel.t   |   6 +-
 compiler/perl/t/core/500-hierarchy.t|   6 +-
 compiler/src/CFCTest.c  |  20 ++-
 compiler/src/CFCTest.h  |   9 +-
 compiler/src/CFCTestHierarchy.c | 121 +++
 compiler/src/CFCTestParcel.c|   3 +-
 47 files changed, 433 insertions(+), 454 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/c/t/cfbase/Animal.cfh
--
diff --git a/compiler/c/t/cfbase/Animal.cfh b/compiler/c/t/cfbase/Animal.cfh
deleted file mode 100644
index 46130b7..000
--- a/compiler/c/t/cfbase/Animal.cfh
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-parcel Animal;
-
-class Clownfish::Obj { }
-
-abstract class Animal { }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/82ad2895/compiler/c/t/cfbase/Animal.cfp
--
diff --git a/

[03/12] lucy-clownfish git commit: Support catching CFC exceptions from C

2016-03-10 Thread nwellnhof
Support catching CFC exceptions from C

Needed to fix CLOWNFISH-14.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/5d0a3efe
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/5d0a3efe
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/5d0a3efe

Branch: refs/heads/master
Commit: 5d0a3efefc68ae1ea81564a0184d70273db75623
Parents: 65387c4
Author: Nick Wellnhofer 
Authored: Fri Mar 4 17:58:28 2016 +0100
Committer: Nick Wellnhofer 
Committed: Sat Mar 5 17:51:27 2016 +0100

--
 compiler/src/CFCUtil.c | 71 +
 compiler/src/CFCUtil.h | 23 +++
 2 files changed, 88 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/5d0a3efe/compiler/src/CFCUtil.c
--
diff --git a/compiler/src/CFCUtil.c b/compiler/src/CFCUtil.c
index da546af..a2a0993 100644
--- a/compiler/src/CFCUtil.c
+++ b/compiler/src/CFCUtil.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 // For mkdir.
 #ifdef CHY_HAS_DIRECT_H
@@ -36,6 +37,9 @@
 
 #include "CFCUtil.h"
 
+static char*thrown_error;
+static jmp_buf *current_env;
+
 void
 CFCUtil_null_check(const void *arg, const char *name, const char *file,
int line) {
@@ -594,6 +598,21 @@ CFCUtil_closedir(void *dirhandle, const char *dir) {
 
 /***/
 
+jmp_buf*
+CFCUtil_try_start(jmp_buf *env) {
+jmp_buf *prev_env = current_env;
+current_env = env;
+return prev_env;
+}
+
+char*
+CFCUtil_try_end(jmp_buf *prev_env) {
+current_env = prev_env;
+char *error = thrown_error;
+thrown_error = NULL;
+return error;
+}
+
 #ifdef CFCPERL
 
 #include "EXTERN.h"
@@ -605,8 +624,27 @@ void
 CFCUtil_die(const char* format, ...) {
 va_list args;
 va_start(args, format);
-vcroak(format, &args);
-va_end(args);
+
+if (current_env) {
+thrown_error = CFCUtil_vsprintf(format, args);
+va_end(args);
+longjmp(*current_env, 1);
+}
+else {
+vcroak(format, &args);
+va_end(args);
+}
+}
+
+void
+CFCUtil_rethrow(char *error) {
+if (current_env) {
+thrown_error = error;
+longjmp(*current_env, 1);
+}
+else {
+croak("%s", error);
+}
 }
 
 void
@@ -623,10 +661,31 @@ void
 CFCUtil_die(const char* format, ...) {
 va_list args;
 va_start(args, format);
-vfprintf(stderr, format, args);
-va_end(args);
-fprintf(stderr, "\n");
-exit(1);
+
+if (current_env) {
+thrown_error = CFCUtil_vsprintf(format, args);
+va_end(args);
+longjmp(*current_env, 1);
+}
+else {
+vfprintf(stderr, format, args);
+va_end(args);
+fprintf(stderr, "\n");
+abort();
+}
+}
+
+void
+CFCUtil_rethrow(char *error) {
+if (current_env) {
+thrown_error = error;
+longjmp(*current_env, 1);
+}
+else {
+fprintf(stderr, "%s\n", error);
+FREEMEM(error);
+abort();
+}
 }
 
 void

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/5d0a3efe/compiler/src/CFCUtil.h
--
diff --git a/compiler/src/CFCUtil.h b/compiler/src/CFCUtil.h
index 3e06b03..73286ef 100644
--- a/compiler/src/CFCUtil.h
+++ b/compiler/src/CFCUtil.h
@@ -29,6 +29,18 @@ extern "C" {
 
 #include 
 #include 
+#include 
+
+#define CFCUTIL_TRY   \
+do {  \
+jmp_buf env;  \
+jmp_buf *prev_env = CFCUtil_try_start(&env);  \
+if (!setjmp(env))
+
+#define CFCUTIL_CATCH(error)  \
+error = CFCUtil_try_end(prev_env);\
+} while (0)
+
 
 /** Create an inner Perl object with a refcount of 1.  For use in actual
  * Perl-space, it is necessary to wrap this inner object in an RV.
@@ -223,11 +235,22 @@ CFCUtil_free_string_array(char **strings);
 void
 CFCUtil_die(const char *format, ...);
 
+/* Rethrow an error.
+ */
+void
+CFCUtil_rethrow(char *error);
+
 /* Print an error message to stderr.
  */
 void
 CFCUtil_warn(const char *format, ...);
 
+jmp_buf*
+CFCUtil_try_start(jmp_buf *env);
+
+char*
+CFCUtil_try_end(jmp_buf *prev_env);
+
 #ifdef __cplusplus
 }
 #endif



[08/12] lucy-clownfish git commit: Add check for va_copy

2016-03-10 Thread nwellnhof
Add check for va_copy


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/25e6ff33
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/25e6ff33
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/25e6ff33

Branch: refs/heads/master
Commit: 25e6ff33d3df646d1bf5adc887b8bd5cd6f59023
Parents: 82ad289
Author: Nick Wellnhofer 
Authored: Sat Mar 5 19:54:54 2016 +0100
Committer: Nick Wellnhofer 
Committed: Sat Mar 5 19:54:54 2016 +0100

--
 compiler/src/CFCUtil.c | 15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/25e6ff33/compiler/src/CFCUtil.c
--
diff --git a/compiler/src/CFCUtil.c b/compiler/src/CFCUtil.c
index a2a0993..7470c04 100644
--- a/compiler/src/CFCUtil.c
+++ b/compiler/src/CFCUtil.c
@@ -30,6 +30,17 @@
   #include 
 #endif
 
+#if !defined(CHY_HAS_C99_SNPRINTF) && !defined(CHY_HAS__SCPRINTF)
+  #error "snprintf or replacement not available."
+#endif
+
+/* va_copy is not part of C89. Assume that simple assignment works if it
+ * isn't defined.
+ */
+#ifndef va_copy
+  #define va_copy(dst, src) ((dst) = (src))
+#endif
+
 #ifndef true
 #define true 1
 #define false 0
@@ -74,10 +85,6 @@ CFCUtil_sprintf(const char *fmt, ...) {
 return string;
 }
 
-#if !defined(CHY_HAS_C99_SNPRINTF) && !defined(CHY_HAS__SCPRINTF)
-  #error "snprintf or replacement not available."
-#endif
-
 char*
 CFCUtil_vsprintf(const char *fmt, va_list args) {
 va_list args_copy;



[11/12] lucy-clownfish git commit: Don't allow inheriting from final class

2016-03-10 Thread nwellnhof
Don't allow inheriting from final class


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/64142fb2
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/64142fb2
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/64142fb2

Branch: refs/heads/master
Commit: 64142fb25442fd7c0fb0b1281f441a1125873f31
Parents: 00efad1
Author: Nick Wellnhofer 
Authored: Sat Mar 5 20:26:27 2016 +0100
Committer: Nick Wellnhofer 
Committed: Thu Mar 10 14:22:10 2016 +0100

--
 compiler/src/CFCClass.c |  3 +++
 compiler/src/CFCTestClass.c | 21 -
 2 files changed, 23 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/64142fb2/compiler/src/CFCClass.c
--
diff --git a/compiler/src/CFCClass.c b/compiler/src/CFCClass.c
index 5e1f795..56edce5 100644
--- a/compiler/src/CFCClass.c
+++ b/compiler/src/CFCClass.c
@@ -474,6 +474,9 @@ CFCClass_add_child(CFCClass *self, CFCClass *child) {
 if (self->tree_grown) {
 CFCUtil_die("Can't call add_child after grow_tree");
 }
+if (self->is_final) {
+CFCUtil_die("Can't inherit from final class %s", self->name);
+}
 if (self->is_inert) {
 CFCUtil_die("Can't inherit from inert class %s", self->name);
 }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/64142fb2/compiler/src/CFCTestClass.c
--
diff --git a/compiler/src/CFCTestClass.c b/compiler/src/CFCTestClass.c
index 8acb300..9fa182c 100644
--- a/compiler/src/CFCTestClass.c
+++ b/compiler/src/CFCTestClass.c
@@ -44,7 +44,7 @@ S_has_symbol(CFCSymbol **symbols, const char *name);
 
 const CFCTestBatch CFCTEST_BATCH_CLASS = {
 "Clownfish::CFC::Model::Class",
-96,
+97,
 S_run_tests
 };
 
@@ -211,6 +211,25 @@ S_run_tests(CFCTest *test) {
 
 CFCClass_add_child(foo, foo_jr);
 CFCClass_add_child(foo_jr, final_foo);
+
+{
+CFCClass *bar
+= CFCClass_create(neato, NULL, "Foo::FooJr::FinalFoo::Bar", NULL,
+  NULL, NULL, "Foo::FooJr::FinalFoo", false, false,
+  false);
+char *error;
+
+CFCUTIL_TRY {
+CFCClass_add_child(final_foo, bar);
+}
+CFCUTIL_CATCH(error);
+OK(test, error && strstr(error, "final class"),
+   "Can't add_child to final class");
+
+FREEMEM(error);
+CFCBase_decref((CFCBase*)bar);
+}
+
 CFCClass_grow_tree(foo);
 
 {



[09/12] lucy-clownfish git commit: Merge branch 'catch-cfc-exceptions'

2016-03-10 Thread nwellnhof
Merge branch 'catch-cfc-exceptions'


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/b21ec10f
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/b21ec10f
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/b21ec10f

Branch: refs/heads/master
Commit: b21ec10f15a9e453e869983294340c31100270d1
Parents: faefec2 25e6ff3
Author: Nick Wellnhofer 
Authored: Thu Mar 10 14:21:18 2016 +0100
Committer: Nick Wellnhofer 
Committed: Thu Mar 10 14:21:18 2016 +0100

--
 compiler/c/t/cfbase/Animal.cfh  |  21 ---
 compiler/c/t/cfbase/Animal.cfp  |   4 -
 compiler/c/t/cfbase/Animal/Dog.cfh  |  28 ---
 compiler/c/t/cfbase/Animal/Util.cfh |  23 ---
 compiler/c/t/cfext/Animal/Rottweiler.cfh|  31 
 compiler/c/t/cfext/AnimalExtension.cfp  |   8 -
 compiler/c/t/test_cfc.c |   2 +-
 compiler/common/test/cfbase/Animal.cfh  |  21 +++
 compiler/common/test/cfbase/Animal.cfp  |   4 +
 compiler/common/test/cfbase/Animal/Dog.cfh  |  28 +++
 compiler/common/test/cfbase/Animal/Util.cfh |  23 +++
 compiler/common/test/cfclash/bar/Bar.cfh|  25 +++
 compiler/common/test/cfclash/bar/Bar.cfp|   4 +
 compiler/common/test/cfclash/bar/Baz.cfh|  25 +++
 .../test/cfclash/class/Animal/DogClash.cfh  |  28 +++
 .../test/cfclash/class/AnimalExtension.cfp  |   5 +
 .../common/test/cfclash/file/Animal/Dog.cfh |  28 +++
 compiler/common/test/cfclash/foo/Foo.cfh|  25 +++
 compiler/common/test/cfclash/foo/Foo.cfp|   4 +
 .../common/test/cfext/Animal/Rottweiler.cfh |  31 
 compiler/common/test/cfext/AnimalExtension.cfp  |   8 +
 compiler/perl/buildlib/Clownfish/CFC/Build.pm   |  21 ++-
 .../buildlib/Clownfish/CFC/Test/TestUtils.pm|  44 +
 compiler/perl/lib/Clownfish/CFC.xs  |   5 +-
 compiler/perl/t/401-class.t |  45 +++--
 compiler/perl/t/403-parcel.t|   3 +-
 compiler/perl/t/500-hierarchy.t |   7 +-
 compiler/perl/t/501-include_dir.t   |   7 +-
 compiler/perl/t/502-clash.t | 108 ---
 compiler/perl/t/cfbase/Animal.cfh   |  21 ---
 compiler/perl/t/cfbase/Animal.cfp   |   4 -
 compiler/perl/t/cfbase/Animal/Dog.cfh   |  28 ---
 compiler/perl/t/cfbase/Animal/Util.cfh  |  23 ---
 compiler/perl/t/cfclash/bar/Bar.cfh |  25 ---
 compiler/perl/t/cfclash/bar/Bar.cfp |   4 -
 compiler/perl/t/cfclash/bar/Baz.cfh |  25 ---
 .../perl/t/cfclash/class/Animal/DogClash.cfh|  28 ---
 .../perl/t/cfclash/class/AnimalExtension.cfp|   5 -
 compiler/perl/t/cfclash/file/Animal/Dog.cfh |  28 ---
 compiler/perl/t/cfclash/foo/Foo.cfh |  25 ---
 compiler/perl/t/cfclash/foo/Foo.cfp |   4 -
 compiler/perl/t/cfext/Animal/Rottweiler.cfh |  31 
 compiler/perl/t/cfext/AnimalExtension.cfp   |   8 -
 compiler/perl/t/core/403-parcel.t   |   6 +-
 compiler/perl/t/core/500-hierarchy.t|   6 +-
 compiler/src/CFCCBlock.c|   5 +-
 compiler/src/CFCClass.c |  14 +-
 compiler/src/CFCTest.c  |  57 +-
 compiler/src/CFCTest.h  |  12 +-
 compiler/src/CFCTestCBlock.c|  19 +-
 compiler/src/CFCTestClass.c | 105 ++-
 compiler/src/CFCTestFunction.c  |  30 +++-
 compiler/src/CFCTestHierarchy.c | 180 +++
 compiler/src/CFCTestMethod.c|  67 ++-
 compiler/src/CFCTestParcel.c|  90 --
 compiler/src/CFCTestSymbol.c|  29 ++-
 compiler/src/CFCTestType.c  |  59 +-
 compiler/src/CFCTestVariable.c  |  32 +++-
 compiler/src/CFCUtil.c  | 124 +
 compiler/src/CFCUtil.h  |  27 +++
 compiler/src/CFCVariable.c  |   5 +-
 61 files changed, 1109 insertions(+), 633 deletions(-)
--




[02/12] lucy-clownfish git commit: Fix a couple of leaking exceptions

2016-03-10 Thread nwellnhof
Fix a couple of leaking exceptions


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/ce0dfbb5
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/ce0dfbb5
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/ce0dfbb5

Branch: refs/heads/master
Commit: ce0dfbb5a77b55ca59f97eb9cdd6a5de7f59ad86
Parents: 5d0a3ef
Author: Nick Wellnhofer 
Authored: Sat Mar 5 17:50:13 2016 +0100
Committer: Nick Wellnhofer 
Committed: Sat Mar 5 17:51:27 2016 +0100

--
 compiler/perl/t/401-class.t | 45 ++--
 compiler/src/CFCCBlock.c|  5 -
 compiler/src/CFCClass.c | 14 +++--
 compiler/src/CFCVariable.c  |  5 -
 4 files changed, 40 insertions(+), 29 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ce0dfbb5/compiler/perl/t/401-class.t
--
diff --git a/compiler/perl/t/401-class.t b/compiler/perl/t/401-class.t
index f456471..5e0fcba 100644
--- a/compiler/perl/t/401-class.t
+++ b/compiler/perl/t/401-class.t
@@ -51,32 +51,27 @@ my $should_be_foo = 
Clownfish::CFC::Model::Class->fetch_singleton(
 );
 is( $$foo, $$should_be_foo, "fetch_singleton" );
 
-SKIP: {
-skip( 'Exceptions leak', 3 )
-if $ENV{LUCY_VALGRIND};
+eval { Clownfish::CFC::Model::Class->create(%foo_create_args) };
+like( $@, qr/two classes with name/i,
+  "Can't call create for the same class more than once" );
 
-eval { Clownfish::CFC::Model::Class->create(%foo_create_args) };
-like( $@, qr/two classes with name/i,
-  "Can't call create for the same class more than once" );
-
-eval {
-Clownfish::CFC::Model::Class->create(
-parcel => 'Neato',
-class_name => 'Other::Foo',
-);
-};
-like( $@, qr/class name conflict/i,
-  "Can't create classes wth the same final component" );
-eval {
-Clownfish::CFC::Model::Class->create(
-parcel => 'Neato',
-class_name => 'Bar',
-nickname   => 'Foo',
-);
-};
-like( $@, qr/class nickname conflict/i,
-  "Can't create classes wth the same nickname" );
-}
+eval {
+Clownfish::CFC::Model::Class->create(
+parcel => 'Neato',
+class_name => 'Other::Foo',
+);
+};
+like( $@, qr/class name conflict/i,
+  "Can't create classes wth the same final component" );
+eval {
+Clownfish::CFC::Model::Class->create(
+parcel => 'Neato',
+class_name => 'Bar',
+nickname   => 'Foo',
+);
+};
+like( $@, qr/class nickname conflict/i,
+  "Can't create classes wth the same nickname" );
 
 my $foo_jr = Clownfish::CFC::Model::Class->create(
 parcel=> 'Neato',

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ce0dfbb5/compiler/src/CFCCBlock.c
--
diff --git a/compiler/src/CFCCBlock.c b/compiler/src/CFCCBlock.c
index 0231877..01d0b42 100644
--- a/compiler/src/CFCCBlock.c
+++ b/compiler/src/CFCCBlock.c
@@ -38,7 +38,10 @@ CFCCBlock_new(const char *contents) {
 
 CFCCBlock*
 CFCCBlock_init(CFCCBlock *self, const char *contents) {
-CFCUTIL_NULL_CHECK(contents);
+if (!contents) {
+CFCBase_decref((CFCBase*)self);
+CFCUtil_die("contents cannot be NULL");
+}
 self->contents = CFCUtil_strdup(contents);
 return self;
 }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ce0dfbb5/compiler/src/CFCClass.c
--
diff --git a/compiler/src/CFCClass.c b/compiler/src/CFCClass.c
index 7ed3167..5e1f795 100644
--- a/compiler/src/CFCClass.c
+++ b/compiler/src/CFCClass.c
@@ -310,8 +310,18 @@ CFCClass_do_create(CFCClass *self, struct CFCParcel 
*parcel,
 || !parcel_source_dir
 || strcmp(class_source_dir, parcel_source_dir) == 0
 ) {
-// Store in registry.
-S_register(self);
+char *error;
+
+CFCUTIL_TRY {
+// Store in registry.
+S_register(self);
+}
+CFCUTIL_CATCH(error);
+
+if (error) {
+CFCBase_decref((CFCBase*)self);
+CFCUtil_rethrow(error);
+}
 
 CFCParcel_add_struct_sym(parcel, self->struct_sym);
 }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/ce0dfbb5/compiler/src/CFCVariable.c
--
diff --git a/compiler/src/CFCVariable.c b/compiler/src/CFCVariable.c
index c2802fc..6636ba6 100644
--- a/compiler/src/CFCVariable.c
+++ b/compiler/src/CFCVariable.c
@@ -59,7 +59,10 @@ CFCVariable*
 CFCVariable_init(CFCVariable *self, const char *exposure, const char

[12/12] lucy-clownfish git commit: Remove Perl test t/501-include_dir.t

2016-03-10 Thread nwellnhof
Remove Perl test t/501-include_dir.t

This test is part of C test suite now.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/20eef8fc
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/20eef8fc
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/20eef8fc

Branch: refs/heads/master
Commit: 20eef8fc34f5e9042131cebb01137e7c42955410
Parents: 64142fb
Author: Nick Wellnhofer 
Authored: Thu Mar 10 14:26:25 2016 +0100
Committer: Nick Wellnhofer 
Committed: Thu Mar 10 14:26:25 2016 +0100

--
 compiler/perl/t/501-include_dir.t | 103 -
 1 file changed, 103 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/20eef8fc/compiler/perl/t/501-include_dir.t
--
diff --git a/compiler/perl/t/501-include_dir.t 
b/compiler/perl/t/501-include_dir.t
deleted file mode 100644
index 0e4d24e..000
--- a/compiler/perl/t/501-include_dir.t
+++ /dev/null
@@ -1,103 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-use strict;
-use warnings;
-
-use Test::More tests => 24;
-
-use Clownfish::CFC::Model::Hierarchy;
-use Clownfish::CFC::Test::TestUtils qw( test_files_dir );
-use File::Spec::Functions qw( catdir catfile splitpath );
-use File::Path qw( rmtree );
-
-my $base_dir = catdir( test_files_dir(), 'cfbase' );
-my $ext_dir  = catdir( test_files_dir(), 'cfext' );
-my $dest_dir = 'autogen';
-
-# One source, one include
-
-{
-my $hierarchy = Clownfish::CFC::Model::Hierarchy->new(dest => $dest_dir);
-
-$hierarchy->add_source_dir($ext_dir);
-is_deeply( $hierarchy->get_source_dirs, [ $ext_dir ], "get_source_dirs" );
-
-$hierarchy->add_include_dir($base_dir);
-is_deeply( $hierarchy->get_include_dirs, [ $base_dir ],
-   "get_include_dirs" );
-
-$hierarchy->build;
-
-my $classes = $hierarchy->ordered_classes;
-is( scalar @$classes, 5, "all classes" );
-my $num_included = 0;
-for my $class (@$classes) {
-die "not a Class"
-unless isa_ok( $class, "Clownfish::CFC::Model::Class" );
-
-my $expect;
-
-if ($class->get_name eq "Animal::Rottweiler") {
-$expect = 0;
-my $parent_name = $class->get_parent->get_name;
-is( $parent_name, "Animal::Dog", "parent of included class" );
-}
-else {
-$expect = 1;
-}
-
-my $included = $class->included ? 1 : 0;
-++$num_included if $included;
-
-is( $included, $expect, "included" );
-}
-is( $num_included, 4, "included class count" );
-
-Clownfish::CFC::Model::Class->_clear_registry();
-Clownfish::CFC::Model::Parcel->reap_singletons();
-}
-
-# Two sources
-
-{
-my $hierarchy = Clownfish::CFC::Model::Hierarchy->new(dest => $dest_dir);
-
-$hierarchy->add_source_dir($base_dir);
-$hierarchy->add_source_dir($ext_dir);
-is_deeply( $hierarchy->get_source_dirs, [ $base_dir, $ext_dir ],
-   "get_source_dirs" );
-is_deeply( $hierarchy->get_include_dirs, [], "get_include_dirs" );
-
-$hierarchy->build;
-
-my $classes = $hierarchy->ordered_classes;
-is( scalar @$classes, 5, "all classes" );
-for my $class (@$classes) {
-die "not a Class" unless isa_ok( $class, 
"Clownfish::CFC::Model::Class" );
-
-if ($class->get_name eq "Animal::Rottweiler") {
-my $parent_name = $class->get_parent->get_name;
-is( $parent_name, "Animal::Dog", "parent of class from second 
source" );
-}
-}
-
-Clownfish::CFC::Model::Class->_clear_registry();
-Clownfish::CFC::Model::Parcel->reap_singletons();
-}
-
-# Clean up.
-rmtree($dest_dir);
-



[06/12] lucy-clownfish git commit: Remove Perl test t/502-clash.t

2016-03-10 Thread nwellnhof
Remove Perl test t/502-clash.t

This test is part of C test suite now.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/df605b50
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/df605b50
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/df605b50

Branch: refs/heads/master
Commit: df605b501d441251871450f9f46ab11b601781f4
Parents: e3ecf10
Author: Nick Wellnhofer 
Authored: Sat Mar 5 18:17:00 2016 +0100
Committer: Nick Wellnhofer 
Committed: Sat Mar 5 18:18:36 2016 +0100

--
 compiler/perl/t/502-clash.t | 108 ---
 compiler/perl/t/cfclash/bar/Bar.cfh |  25 -
 compiler/perl/t/cfclash/bar/Bar.cfp |   4 -
 compiler/perl/t/cfclash/bar/Baz.cfh |  25 -
 .../perl/t/cfclash/class/Animal/DogClash.cfh|  28 -
 .../perl/t/cfclash/class/AnimalExtension.cfp|   5 -
 compiler/perl/t/cfclash/file/Animal/Dog.cfh |  28 -
 compiler/perl/t/cfclash/foo/Foo.cfh |  25 -
 compiler/perl/t/cfclash/foo/Foo.cfp |   4 -
 9 files changed, 252 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/df605b50/compiler/perl/t/502-clash.t
--
diff --git a/compiler/perl/t/502-clash.t b/compiler/perl/t/502-clash.t
deleted file mode 100644
index 4cf870b..000
--- a/compiler/perl/t/502-clash.t
+++ /dev/null
@@ -1,108 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-use strict;
-use warnings;
-
-use Test::More tests => 4;
-
-use Clownfish::CFC::Model::Hierarchy;
-use File::Spec::Functions qw( catdir catfile splitpath );
-use File::Path qw( rmtree );
-
-my $base_dir= catdir(qw( t cfbase ));
-my $ext_dir = catdir(qw( t cfext ));
-my $dest_dir= catdir(qw( t cfdest ));
-my $class_clash_dir = catdir(qw( t cfclash class ));
-my $file_clash_dir  = catdir(qw( t cfclash file ));
-
-SKIP: {
-skip( 'Exceptions leak', 1 )
-if $ENV{LUCY_VALGRIND};
-
-my $hierarchy = Clownfish::CFC::Model::Hierarchy->new(dest => $dest_dir);
-
-$hierarchy->add_source_dir($base_dir);
-$hierarchy->add_source_dir($file_clash_dir);
-
-eval { $hierarchy->build; };
-
-my $filename = catfile(qw( Animal Dog.cfh ));
-like( $@, qr|\Q$filename\E .* \Q$base_dir\E .* \Q$file_clash_dir\E|,
-  "source/source filename clash" );
-
-Clownfish::CFC::Model::Class->_clear_registry();
-Clownfish::CFC::Model::Parcel->reap_singletons();
-}
-
-SKIP: {
-skip( 'Exceptions leak', 1 )
-if $ENV{LUCY_VALGRIND};
-
-my $hierarchy = Clownfish::CFC::Model::Hierarchy->new(dest => $dest_dir);
-
-$hierarchy->add_source_dir($class_clash_dir);
-$hierarchy->add_include_dir($base_dir);
-
-eval { $hierarchy->build; };
-
-like( $@, qr/Two classes with name/, "source/include class name clash" );
-
-Clownfish::CFC::Model::Class->_clear_registry();
-Clownfish::CFC::Model::Parcel->reap_singletons();
-}
-
-{
-my $hierarchy = Clownfish::CFC::Model::Hierarchy->new(dest => $dest_dir);
-
-$hierarchy->add_source_dir($base_dir);
-$hierarchy->add_include_dir($file_clash_dir);
-
-$hierarchy->build;
-
-my $classes = $hierarchy->ordered_classes;
-is( scalar @$classes, 4, "source/include filename clash" );
-
-Clownfish::CFC::Model::Class->_clear_registry();
-Clownfish::CFC::Model::Parcel->reap_singletons();
-}
-
-# Parcel/class include mismatch
-
-my $foo_dir = catdir(qw( t cfclash foo ));
-my $bar_dir = catdir(qw( t cfclash bar ));
-
-SKIP: {
-skip( 'Exceptions leak', 1 )
-if $ENV{LUCY_VALGRIND};
-
-my $hierarchy = Clownfish::CFC::Model::Hierarchy->new(dest => $dest_dir);
-
-$hierarchy->add_source_dir($bar_dir);
-$hierarchy->add_include_dir($foo_dir);
-$hierarchy->add_include_dir($base_dir);
-
-eval { $hierarchy->build; };
-
-like( $@, qr/Class .* from source dir .* parcel .* from include dir/,
-  "source class with included parcel" );
-
-   

[01/12] lucy-clownfish git commit: Implement CFCUtil_vsprintf

2016-03-10 Thread nwellnhof
Repository: lucy-clownfish
Updated Branches:
  refs/heads/master faefec2b5 -> 20eef8fc3


Implement CFCUtil_vsprintf

Drop support for Microsoft compilers without _vscprintf. This function
is supported at least since Visual Studio .NET 2003 (MSVC 7.1). I think
it was only MSVC 6 that didn't support it.

Also use va_copy when iterating va_lists twice.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/65387c4f
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/65387c4f
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/65387c4f

Branch: refs/heads/master
Commit: 65387c4fe5f0088fe89c90a9d0a1e8829fabb0f3
Parents: 05d3caa
Author: Nick Wellnhofer 
Authored: Fri Mar 4 17:54:20 2016 +0100
Committer: Nick Wellnhofer 
Committed: Fri Mar 4 17:56:55 2016 +0100

--
 compiler/src/CFCUtil.c | 46 ++---
 compiler/src/CFCUtil.h |  4 
 2 files changed, 22 insertions(+), 28 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/65387c4f/compiler/src/CFCUtil.c
--
diff --git a/compiler/src/CFCUtil.c b/compiler/src/CFCUtil.c
index 6fe62fa..da546af 100644
--- a/compiler/src/CFCUtil.c
+++ b/compiler/src/CFCUtil.c
@@ -59,51 +59,41 @@ CFCUtil_strndup(const char *string, size_t len) {
 return copy;
 }
 
-#if defined(CHY_HAS_C99_SNPRINTF) || defined(CHY_HAS__SCPRINTF)
-
 char*
 CFCUtil_sprintf(const char *fmt, ...) {
 va_list args;
 
 va_start(args, fmt);
+char *string = CFCUtil_vsprintf(fmt, args);
+va_end(args);
+
+return string;
+}
+
+#if !defined(CHY_HAS_C99_SNPRINTF) && !defined(CHY_HAS__SCPRINTF)
+  #error "snprintf or replacement not available."
+#endif
+
+char*
+CFCUtil_vsprintf(const char *fmt, va_list args) {
+va_list args_copy;
+
+va_copy(args_copy, args);
 #if defined(CHY_HAS_C99_SNPRINTF)
-int size = vsnprintf(NULL, 0, fmt, args);
+int size = vsnprintf(NULL, 0, fmt, args_copy);
 if (size < 0) { CFCUtil_die("snprintf failed"); }
 #else
-int size = _vscprintf(fmt, args);
+int size = _vscprintf(fmt, args_copy);
 if (size < 0) { CFCUtil_die("_scprintf failed"); }
 #endif
-va_end(args);
+va_end(args_copy);
 
 char *string = (char*)MALLOCATE((size_t)size + 1);
-va_start(args, fmt);
 vsprintf(string, fmt, args);
-va_end(args);
 
 return string;
 }
 
-#elif defined(CHY_HAS__SNPRINTF)
-
-char*
-CFCUtil_sprintf(const char *fmt, ...) {
-for (size_t size = 32; size * 2 > size; size *= 2) {
-char *string = (char*)MALLOCATE(size);
-va_list args;
-va_start(args, fmt);
-int result = _vsnprintf(string, size, fmt, args);
-va_end(args);
-if (result >= 0 && (size_t)result < size) { return string; }
-FREEMEM(string);
-}
-CFCUtil_die("_snprintf failed");
-return NULL;
-}
-
-#else
-  #error "snprintf or replacement not available."
-#endif
-
 char*
 CFCUtil_cat(char *string, ...) {
 va_list args;

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/65387c4f/compiler/src/CFCUtil.h
--
diff --git a/compiler/src/CFCUtil.h b/compiler/src/CFCUtil.h
index 15f45a9..3e06b03 100644
--- a/compiler/src/CFCUtil.h
+++ b/compiler/src/CFCUtil.h
@@ -27,6 +27,7 @@
 extern "C" {
 #endif
 
+#include 
 #include 
 
 /** Create an inner Perl object with a refcount of 1.  For use in actual
@@ -58,6 +59,9 @@ CFCUtil_strndup(const char *string, size_t len);
 char*
 CFCUtil_sprintf(const char *fmt, ...);
 
+char*
+CFCUtil_vsprintf(const char *fmt, va_list args);
+
 /** Concatenate a NULL-terminated list of strings onto the first, reallocating
  * with each argument.
  */



[04/12] lucy-clownfish git commit: Finish support for skipping CFC tests

2016-03-10 Thread nwellnhof
Finish support for skipping CFC tests


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/6fdf098c
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/6fdf098c
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/6fdf098c

Branch: refs/heads/master
Commit: 6fdf098cef2a360218df6fc666e52d9af5b87152
Parents: ce0dfbb
Author: Nick Wellnhofer 
Authored: Sat Mar 5 18:09:27 2016 +0100
Committer: Nick Wellnhofer 
Committed: Sat Mar 5 18:14:35 2016 +0100

--
 compiler/src/CFCTest.c | 37 -
 compiler/src/CFCTest.h |  3 ++-
 2 files changed, 38 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/6fdf098c/compiler/src/CFCTest.c
--
diff --git a/compiler/src/CFCTest.c b/compiler/src/CFCTest.c
index c62f3b5..0f61745 100644
--- a/compiler/src/CFCTest.c
+++ b/compiler/src/CFCTest.c
@@ -37,6 +37,7 @@ typedef struct CFCTestFormatter {
  va_list args);
 void (*test_comment)(const char *fmt, ...);
 void (*batch_comment)(const char *fmt, ...);
+void (*skip)(int test_num, int num_skipped, const char *fmt, va_list args);
 void (*summary)(const CFCTest *test);
 } CFCTestFormatter;
 
@@ -71,6 +72,10 @@ static void
 S_format_cfish_batch_comment(const char *fmt, ...);
 
 static void
+S_format_cfish_skip(int test_num, int num_skipped, const char *fmt,
+va_list args);
+
+static void
 S_format_cfish_summary(const CFCTest *test);
 
 static void
@@ -87,6 +92,10 @@ static void
 S_format_tap_batch_comment(const char *fmt, ...);
 
 static void
+S_format_tap_skip(int test_num, int num_skipped, const char *fmt,
+  va_list args);
+
+static void
 S_format_tap_summary(const CFCTest *test);
 
 static const CFCMeta CFCTEST_META = {
@@ -100,6 +109,7 @@ static const CFCTestFormatter S_formatter_cfish = {
 S_format_cfish_vtest_result,
 S_format_cfish_test_comment,
 S_format_cfish_batch_comment,
+S_format_cfish_skip,
 S_format_cfish_summary
 };
 
@@ -108,6 +118,7 @@ static const CFCTestFormatter S_formatter_tap = {
 S_format_tap_vtest_result,
 S_format_tap_test_comment,
 S_format_tap_batch_comment,
+S_format_tap_skip,
 S_format_tap_summary
 };
 
@@ -261,7 +272,12 @@ CFCTest_test_int_equals(CFCTest *self, uint64_t result, 
uint64_t expected,
 }
 
 void
-CFCTest_skip(CFCTest *self, int num) {
+CFCTest_skip(CFCTest *self, int num, const char *fmt, ...) {
+va_list args;
+va_start(args, fmt);
+self->formatter->skip(self->num_tests + 1, num, fmt, args);
+va_end(args);
+
 self->num_tests  += num;
 self->num_tests_in_batch += num;
 }
@@ -327,6 +343,15 @@ S_format_cfish_batch_comment(const char *fmt, ...) {
 }
 
 static void
+S_format_cfish_skip(int test_num, int num_skipped, const char *fmt,
+va_list args) {
+CHY_UNUSED_VAR(test_num);
+CHY_UNUSED_VAR(num_skipped);
+CHY_UNUSED_VAR(fmt);
+CHY_UNUSED_VAR(args);
+}
+
+static void
 S_format_cfish_summary(const CFCTest *test) {
 if (test->num_batches == 0) {
 printf("No tests planned or run.\n");
@@ -379,6 +404,16 @@ S_format_tap_batch_comment(const char *fmt, ...) {
 }
 
 static void
+S_format_tap_skip(int test_num, int num_skipped, const char *fmt,
+  va_list args) {
+for (int i = 0; i < num_skipped; ++i) {
+printf("ok %d # SKIP ", test_num + i);
+vprintf(fmt, args);
+printf("\n");
+}
+}
+
+static void
 S_format_tap_summary(const CFCTest *test) {
 (void)test; // unused
 }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/6fdf098c/compiler/src/CFCTest.h
--
diff --git a/compiler/src/CFCTest.h b/compiler/src/CFCTest.h
index 93d11eb..41cf73d 100644
--- a/compiler/src/CFCTest.h
+++ b/compiler/src/CFCTest.h
@@ -29,6 +29,7 @@
   #define OK  CFCTest_test_true
   #define STR_EQ  CFCTest_test_string_equals
   #define INT_EQ  CFCTest_test_int_equals
+  #define SKIPCFCTest_skip
 #endif
 
 typedef struct CFCTest CFCTest;
@@ -112,7 +113,7 @@ CFCTest_test_int_equals(CFCTest *self, uint64_t result, 
uint64_t expected,
  * @param num Number of tests to skip.
  */
 void
-CFCTest_skip(CFCTest *self, int num);
+CFCTest_skip(CFCTest *self, int num, const char *fmt, ...);
 
 /* Finish testing.
  *



[10/12] lucy-clownfish git commit: Fix CFCClass_create documentation

2016-03-10 Thread nwellnhof
Fix CFCClass_create documentation


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/00efad15
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/00efad15
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/00efad15

Branch: refs/heads/master
Commit: 00efad151f54e33f09bdf6d5a3245d621507dee5
Parents: b21ec10
Author: Nick Wellnhofer 
Authored: Sat Mar 5 20:21:38 2016 +0100
Committer: Nick Wellnhofer 
Committed: Thu Mar 10 14:22:04 2016 +0100

--
 compiler/src/CFCClass.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/00efad15/compiler/src/CFCClass.h
--
diff --git a/compiler/src/CFCClass.h b/compiler/src/CFCClass.h
index e148500..c4cf52b 100644
--- a/compiler/src/CFCClass.h
+++ b/compiler/src/CFCClass.h
@@ -63,11 +63,10 @@ CFCClass_validate_class_name_component(const char *name);
  * to this class.
  * @param file_spec - Clownfish::CFC::Model::FileSpec of the file in which
  * this class was declared
- * @param docucomment A Clownfish::CFC::Model::DocuComment describing this
- * Class.
+ * @param parent_class_name The name of the parent class.
+ * @param is_final Should be true if the class is final.
  * @param is_inert Should be true if the class is inert, i.e. cannot be
  * instantiated.
- * @param is_final Should be true if the class is final.
  * @param is_abstract Should be true if the class is abstract.
  */
 CFCClass*



[05/12] lucy-clownfish git commit: Test CFC exceptions in C test suite

2016-03-10 Thread nwellnhof
Test CFC exceptions in C test suite

Catching exceptions sometimes requires a separate function because
stack variables might be clobbered by longjmp. See

http://stackoverflow.com/q/2024933

Also add some other parcel tests from the Perl test suite.

Fixes CLOWNFISH-14.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/e3ecf10d
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/e3ecf10d
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/e3ecf10d

Branch: refs/heads/master
Commit: e3ecf10da6a3314c31e60133041ed3578357387b
Parents: 6fdf098
Author: Nick Wellnhofer 
Authored: Fri Mar 4 18:00:49 2016 +0100
Committer: Nick Wellnhofer 
Committed: Sat Mar 5 18:15:14 2016 +0100

--
 compiler/c/t/cfclash/bar/Bar.cfh   |  25 +
 compiler/c/t/cfclash/bar/Bar.cfp   |   4 +
 compiler/c/t/cfclash/bar/Baz.cfh   |  25 +
 compiler/c/t/cfclash/class/Animal/DogClash.cfh |  28 ++
 compiler/c/t/cfclash/class/AnimalExtension.cfp |   5 +
 compiler/c/t/cfclash/file/Animal/Dog.cfh   |  28 ++
 compiler/c/t/cfclash/foo/Foo.cfh   |  25 +
 compiler/c/t/cfclash/foo/Foo.cfp   |   4 +
 compiler/src/CFCTestCBlock.c   |  19 +++-
 compiler/src/CFCTestClass.c| 105 +++-
 compiler/src/CFCTestFunction.c |  30 --
 compiler/src/CFCTestHierarchy.c|  99 +-
 compiler/src/CFCTestMethod.c   |  67 -
 compiler/src/CFCTestParcel.c   |  87 +---
 compiler/src/CFCTestSymbol.c   |  29 +-
 compiler/src/CFCTestType.c |  59 ++-
 compiler/src/CFCTestVariable.c |  32 +-
 17 files changed, 645 insertions(+), 26 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/e3ecf10d/compiler/c/t/cfclash/bar/Bar.cfh
--
diff --git a/compiler/c/t/cfclash/bar/Bar.cfh b/compiler/c/t/cfclash/bar/Bar.cfh
new file mode 100644
index 000..89e798e
--- /dev/null
+++ b/compiler/c/t/cfclash/bar/Bar.cfh
@@ -0,0 +1,25 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+parcel Bar;
+
+public class Bar inherits Clownfish::Obj {
+int var;
+
+public void
+Method(Bar *self);
+}
+

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/e3ecf10d/compiler/c/t/cfclash/bar/Bar.cfp
--
diff --git a/compiler/c/t/cfclash/bar/Bar.cfp b/compiler/c/t/cfclash/bar/Bar.cfp
new file mode 100644
index 000..e5868f6
--- /dev/null
+++ b/compiler/c/t/cfclash/bar/Bar.cfp
@@ -0,0 +1,4 @@
+{
+"name": "Bar",
+"version": "v1.0.0"
+}

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/e3ecf10d/compiler/c/t/cfclash/bar/Baz.cfh
--
diff --git a/compiler/c/t/cfclash/bar/Baz.cfh b/compiler/c/t/cfclash/bar/Baz.cfh
new file mode 100644
index 000..00e4033
--- /dev/null
+++ b/compiler/c/t/cfclash/bar/Baz.cfh
@@ -0,0 +1,25 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+parcel Foo;
+
+public class Baz i