lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [1/3] lucy-clownfish git commit: Capture "abstract" class modifier.
Date Tue, 07 Apr 2015 22:33:59 GMT
Repository: lucy-clownfish
Updated Branches:
  refs/heads/master 4adae97b2 -> bad0e075a


Capture "abstract" class modifier.


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

Branch: refs/heads/master
Commit: 71cde55b2555186f46534d751d8723a500252c53
Parents: 4adae97
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Mon Mar 23 18:21:25 2015 -0700
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Mon Apr 6 18:40:56 2015 -0700

----------------------------------------------------------------------
 compiler/perl/lib/Clownfish/CFC.pm |  3 ++-
 compiler/perl/lib/Clownfish/CFC.xs |  5 +++--
 compiler/src/CFCClass.c            | 15 ++++++++++++---
 compiler/src/CFCClass.h            |  8 ++++++--
 compiler/src/CFCParseHeader.y      |  5 +++--
 compiler/src/CFCTestClass.c        |  6 +++---
 compiler/src/CFCTestDocuComment.c  |  2 +-
 compiler/src/CFCTestType.c         |  6 +++---
 8 files changed, 33 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/71cde55b/compiler/perl/lib/Clownfish/CFC.pm
----------------------------------------------------------------------
diff --git a/compiler/perl/lib/Clownfish/CFC.pm b/compiler/perl/lib/Clownfish/CFC.pm
index 26f67d4..2346e9a 100644
--- a/compiler/perl/lib/Clownfish/CFC.pm
+++ b/compiler/perl/lib/Clownfish/CFC.pm
@@ -123,6 +123,7 @@ BEGIN { XSLoader::load( 'Clownfish::CFC', '0.4.0' ) }
         inert             => undef,
         final             => undef,
         parcel            => undef,
+        abstract          => undef,
         exposure          => 'parcel',
     );
 
@@ -156,7 +157,7 @@ BEGIN { XSLoader::load( 'Clownfish::CFC', '0.4.0' ) }
         return _create(
             @args{
                 qw( parcel exposure class_name nickname micro_sym docucomment
-                    file_spec parent_class_name final inert)
+                    file_spec parent_class_name final inert abstract )
                 }
         );
     }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/71cde55b/compiler/perl/lib/Clownfish/CFC.xs
----------------------------------------------------------------------
diff --git a/compiler/perl/lib/Clownfish/CFC.xs b/compiler/perl/lib/Clownfish/CFC.xs
index a27e193..c80bb8c 100644
--- a/compiler/perl/lib/Clownfish/CFC.xs
+++ b/compiler/perl/lib/Clownfish/CFC.xs
@@ -155,7 +155,7 @@ PPCODE:
 MODULE = Clownfish::CFC   PACKAGE = Clownfish::CFC::Model::Class
 
 SV*
-_create(parcel, exposure_sv, class_name_sv, class_nickname_sv, micro_sym_sv, docucomment,
file_spec, parent_class_name_sv, is_final, is_inert)
+_create(parcel, exposure_sv, class_name_sv, class_nickname_sv, micro_sym_sv, docucomment,
file_spec, parent_class_name_sv, is_final, is_inert, is_abstract)
     CFCParcel *parcel;
     SV *exposure_sv;
     SV *class_name_sv;
@@ -166,6 +166,7 @@ _create(parcel, exposure_sv, class_name_sv, class_nickname_sv, micro_sym_sv,
doc
     SV *parent_class_name_sv;
     bool is_final;
     bool is_inert;
+    bool is_abstract;
 CODE:
     const char *exposure =
         SvOK(exposure_sv) ? SvPV_nolen(exposure_sv) : NULL;
@@ -180,7 +181,7 @@ CODE:
     CFCClass *self
         = CFCClass_create(parcel, exposure, class_name, class_nickname,
                           micro_sym, docucomment, file_spec, parent_class_name,
-                          is_final, is_inert);
+                          is_final, is_inert, is_abstract);
     RETVAL = S_cfcbase_to_perlref(self);
     CFCBase_decref((CFCBase*)self);
 OUTPUT: RETVAL

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/71cde55b/compiler/src/CFCClass.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCClass.c b/compiler/src/CFCClass.c
index 2184f57..b57c5c2 100644
--- a/compiler/src/CFCClass.c
+++ b/compiler/src/CFCClass.c
@@ -70,6 +70,7 @@ struct CFCClass {
     char *parent_class_name;
     int is_final;
     int is_inert;
+    int is_abstract;
     char *struct_sym;
     char *full_struct_sym;
     char *ivars_struct;
@@ -106,11 +107,12 @@ CFCClass_create(struct CFCParcel *parcel, const char *exposure,
                 const char *class_name, const char *nickname,
                 const char *micro_sym, CFCDocuComment *docucomment,
                 CFCFileSpec *file_spec, const char *parent_class_name,
-                int is_final, int is_inert) {
+                int is_final, int is_inert, int is_abstract) {
     CFCClass *self = (CFCClass*)CFCBase_allocate(&CFCCLASS_META);
     return CFCClass_do_create(self, parcel, exposure, class_name, nickname,
                               micro_sym, docucomment, file_spec,
-                              parent_class_name, is_final, is_inert);
+                              parent_class_name, is_final, is_inert,
+                              is_abstract);
 }
 
 CFCClass*
@@ -118,7 +120,8 @@ CFCClass_do_create(CFCClass *self, struct CFCParcel *parcel,
                    const char *exposure, const char *class_name,
                    const char *nickname, const char *micro_sym,
                    CFCDocuComment *docucomment, CFCFileSpec *file_spec,
-                   const char *parent_class_name, int is_final, int is_inert) {
+                   const char *parent_class_name, int is_final, int is_inert,
+                   int is_abstract) {
     CFCUTIL_NULL_CHECK(class_name);
     exposure  = exposure  ? exposure  : "parcel";
     micro_sym = micro_sym ? micro_sym : "class";
@@ -191,6 +194,7 @@ CFCClass_do_create(CFCClass *self, struct CFCParcel *parcel,
 
     self->is_final    = !!is_final;
     self->is_inert    = !!is_inert;
+    self->is_abstract = !!is_abstract;
 
     if (!CFCClass_included(self) && CFCParcel_included(parcel)) {
         CFCUtil_die("Class %s from source dir found in parcel %s from"
@@ -768,6 +772,11 @@ CFCClass_inert(CFCClass *self) {
     return self->is_inert;
 }
 
+int
+CFCClass_abstract(CFCClass *self) {
+    return self->is_abstract;
+}
+
 const char*
 CFCClass_get_struct_sym(CFCClass *self) {
     return self->struct_sym;

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/71cde55b/compiler/src/CFCClass.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCClass.h b/compiler/src/CFCClass.h
index b960134..942ed93 100644
--- a/compiler/src/CFCClass.h
+++ b/compiler/src/CFCClass.h
@@ -55,13 +55,14 @@ struct CFCFileSpec;
  * @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*
 CFCClass_create(struct CFCParcel *parcel, const char *exposure,
                 const char *class_name, const char *nickname,
                 const char *micro_sym, struct CFCDocuComment *docucomment,
                 struct CFCFileSpec *file_spec, const char *parent_class_name,
-                int is_final, int is_inert);
+                int is_final, int is_inert, int is_abstract);
 
 CFCClass*
 CFCClass_do_create(CFCClass *self, struct CFCParcel *parcel,
@@ -69,7 +70,7 @@ CFCClass_do_create(CFCClass *self, struct CFCParcel *parcel,
                    const char *nickname, const char *micro_sym,
                    struct CFCDocuComment *docucomment,
                    struct CFCFileSpec *file_spec, const char *parent_class_name,
-                   int is_final, int is_inert);
+                   int is_final, int is_inert, int is_abstract);
 
 void
 CFCClass_destroy(CFCClass *self);
@@ -229,6 +230,9 @@ CFCClass_final(CFCClass *self);
 int
 CFCClass_inert(CFCClass *self);
 
+int
+CFCClass_abstract(CFCClass *self);
+
 const char*
 CFCClass_get_struct_sym(CFCClass *self);
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/71cde55b/compiler/src/CFCParseHeader.y
----------------------------------------------------------------------
diff --git a/compiler/src/CFCParseHeader.y b/compiler/src/CFCParseHeader.y
index 5e609df..56b2629 100644
--- a/compiler/src/CFCParseHeader.y
+++ b/compiler/src/CFCParseHeader.y
@@ -40,20 +40,21 @@ S_start_class(CFCParser *state, CFCDocuComment *docucomment, char *exposure,
     CFCFileSpec *file_spec = CFCParser_get_file_spec(state);
     int is_final = false;
     int is_inert = false;
+    int is_abstract = false;
     if (modifiers) {
-        /* TODO: Decide how to handle abstract classes. */
         if (strstr(modifiers, "inline")) {
             CFCUtil_die("Illegal class modifiers: '%s'", modifiers);
         }
         is_final = !!strstr(modifiers, "final");
         is_inert = !!strstr(modifiers, "inert");
+        is_abstract = !!strstr(modifiers, "abstract");
     }
     CFCParser_set_class_name(state, class_name);
     CFCParser_set_class_nickname(state, class_nickname);
     CFCClass *klass = CFCClass_create(CFCParser_get_parcel(state), exposure,
                                       class_name, class_nickname, NULL,
                                       docucomment, file_spec, inheritance,
-                                      is_final, is_inert);
+                                      is_final, is_inert, is_abstract);
     CFCBase_decref((CFCBase*)docucomment);
     return klass;
 }

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/71cde55b/compiler/src/CFCTestClass.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTestClass.c b/compiler/src/CFCTestClass.c
index 762180a..2342d03 100644
--- a/compiler/src/CFCTestClass.c
+++ b/compiler/src/CFCTestClass.c
@@ -87,7 +87,7 @@ S_run_tests(CFCTest *test) {
 
     CFCClass *foo
         = CFCClass_create(neato, NULL, "Foo", NULL, NULL, NULL, NULL, NULL,
-                          0, 0);
+                          0, 0, 0);
     CFCClass_add_function(foo, tread_water);
     CFCClass_add_member_var(foo, thing);
     CFCClass_add_inert_var(foo, widget);
@@ -99,7 +99,7 @@ S_run_tests(CFCTest *test) {
 
     CFCClass *foo_jr
         = CFCClass_create(neato, NULL, "Foo::FooJr", NULL, NULL, NULL, NULL,
-                          "Foo", 0, 0);
+                          "Foo", 0, 0, 0);
     STR_EQ(test, CFCClass_get_struct_sym(foo_jr), "FooJr",
            "get_struct_sym");
     STR_EQ(test, CFCClass_full_struct_sym(foo_jr), "neato_FooJr",
@@ -107,7 +107,7 @@ S_run_tests(CFCTest *test) {
 
     CFCClass *final_foo
         = CFCClass_create(neato, NULL, "Foo::FooJr::FinalFoo", NULL, NULL, NULL,
-                          file_spec, "Foo::FooJr", 1, 0);
+                          file_spec, "Foo::FooJr", 1, 0, 0);
     OK(test, CFCClass_final(final_foo), "final");
     STR_EQ(test, CFCClass_include_h(final_foo), "Foo/FooJr.h",
            "include_h uses path_part");

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/71cde55b/compiler/src/CFCTestDocuComment.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTestDocuComment.c b/compiler/src/CFCTestDocuComment.c
index 3e78e38..4d7296d 100644
--- a/compiler/src/CFCTestDocuComment.c
+++ b/compiler/src/CFCTestDocuComment.c
@@ -142,7 +142,7 @@ S_test_generator(CFCTest *test) {
     );
     CFCClass *klass
         = CFCClass_create(parcel, "public", "Neato::Object", NULL, NULL,
-                          docu, NULL, NULL, 0, 0);
+                          docu, NULL, NULL, 0, 0, 0);
 
     char *man_page = CFCCMan_create_man_page(klass);
     const char *expected_man =

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/71cde55b/compiler/src/CFCTestType.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTestType.c b/compiler/src/CFCTestType.c
index fcbd444..fd39f58 100644
--- a/compiler/src/CFCTestType.c
+++ b/compiler/src/CFCTestType.c
@@ -331,7 +331,7 @@ S_run_object_tests(CFCTest *test) {
     CFCParcel *neato_parcel = CFCParcel_new("Neato", NULL, NULL, NULL);
     CFCClass *foo_class
         = CFCClass_create(neato_parcel, NULL, "Foo", NULL, NULL, NULL, NULL,
-                          NULL, false, false);
+                          NULL, false, false, false);
     CFCType *foo = CFCType_new_object(0, neato_parcel, "Foo", 1);
     CFCType_resolve(foo);
 
@@ -345,7 +345,7 @@ S_run_object_tests(CFCTest *test) {
     {
         CFCClass *bar_class
             = CFCClass_create(neato_parcel, NULL, "Bar", NULL, NULL, NULL,
-                              NULL, NULL, false, false);
+                              NULL, NULL, false, false, false);
         CFCType *bar = CFCType_new_object(0, neato_parcel, "Bar", 1);
         CFCType_resolve(bar);
         OK(test, !CFCType_equals(foo, bar),
@@ -359,7 +359,7 @@ S_run_object_tests(CFCTest *test) {
             = CFCParcel_new("Foreign", NULL, NULL, NULL);
         CFCClass *foreign_foo_class
             = CFCClass_create(foreign_parcel, NULL, "Foreign::Foo", NULL, NULL,
-                              NULL, NULL, NULL, false, false);
+                              NULL, NULL, NULL, false, false, false);
         CFCType *foreign_foo = CFCType_new_object(0, foreign_parcel, "Foo", 1);
         CFCType_resolve(foreign_foo);
         OK(test, !CFCType_equals(foo, foreign_foo),


Mime
View raw message