You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2015/05/07 21:13:50 UTC
[3/3] lucy-clownfish git commit: Rename 'micro_sym' and 'macro_sym'
to 'name'
Rename 'micro_sym' and 'macro_sym' to 'name'
Now that Clownfish methods always use "macro" symbols, there's no need
to have different versions of the symbol name. Use a single name in
CFCSymbol. Eliminate macro_sym for methods.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/50575077
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/50575077
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/50575077
Branch: refs/heads/master
Commit: 50575077120bfea036da6212d7e5421e78dcae21
Parents: ed4ce8b
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat Jul 26 18:23:25 2014 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu May 7 21:08:59 2015 +0200
----------------------------------------------------------------------
compiler/perl/lib/Clownfish/CFC.pm | 18 +++---
compiler/perl/lib/Clownfish/CFC.xs | 62 ++++++++++-----------
compiler/perl/t/051-symbol.t | 14 ++---
compiler/perl/t/200-function.t | 6 +-
compiler/perl/t/201-method.t | 18 +++---
compiler/perl/t/202-overridden_method.t | 2 +-
compiler/perl/t/203-final_method.t | 2 +-
compiler/perl/t/300-variable.t | 22 ++++----
compiler/perl/t/401-class.t | 26 ++++-----
compiler/perl/t/403-parcel.t | 6 +-
compiler/perl/t/600-parser.t | 2 +-
compiler/src/CFCBindMethod.c | 12 ++--
compiler/src/CFCCHtml.c | 18 +++---
compiler/src/CFCCMan.c | 14 ++---
compiler/src/CFCCallable.c | 4 +-
compiler/src/CFCCallable.h | 5 +-
compiler/src/CFCClass.c | 27 ++++-----
compiler/src/CFCClass.h | 6 +-
compiler/src/CFCFunction.c | 22 ++++----
compiler/src/CFCFunction.h | 9 ++-
compiler/src/CFCGoClass.c | 6 +-
compiler/src/CFCGoMethod.c | 4 +-
compiler/src/CFCGoTypeMap.c | 6 +-
compiler/src/CFCMethod.c | 82 ++++++++++++++--------------
compiler/src/CFCMethod.h | 8 +--
compiler/src/CFCParamList.c | 4 +-
compiler/src/CFCPerlClass.c | 18 +++---
compiler/src/CFCPerlConstructor.c | 4 +-
compiler/src/CFCPerlMethod.c | 22 ++++----
compiler/src/CFCPerlPod.c | 4 +-
compiler/src/CFCPerlSub.c | 12 ++--
compiler/src/CFCSymbol.c | 22 ++++----
compiler/src/CFCSymbol.h | 12 ++--
compiler/src/CFCTestClass.c | 16 +++---
compiler/src/CFCTestMethod.c | 10 ++--
compiler/src/CFCTestParser.c | 2 +-
compiler/src/CFCTestSymbol.c | 2 +-
compiler/src/CFCVariable.c | 16 +++---
compiler/src/CFCVariable.h | 14 ++---
39 files changed, 272 insertions(+), 287 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/perl/lib/Clownfish/CFC.pm
----------------------------------------------------------------------
diff --git a/compiler/perl/lib/Clownfish/CFC.pm b/compiler/perl/lib/Clownfish/CFC.pm
index 2346e9a..358e8b1 100644
--- a/compiler/perl/lib/Clownfish/CFC.pm
+++ b/compiler/perl/lib/Clownfish/CFC.pm
@@ -156,7 +156,7 @@ BEGIN { XSLoader::load( 'Clownfish::CFC', '0.4.0' ) }
= Clownfish::CFC::Model::Parcel->acquire( $args{parcel} );
return _create(
@args{
- qw( parcel exposure class_name nickname micro_sym docucomment
+ qw( parcel exposure class_name nickname name docucomment
file_spec parent_class_name final inert abstract )
}
);
@@ -218,7 +218,7 @@ BEGIN { XSLoader::load( 'Clownfish::CFC', '0.4.0' ) }
class_name => undef,
class_nickname => undef,
param_list => undef,
- micro_sym => undef,
+ name => undef,
docucomment => undef,
parcel => undef,
inline => undef,
@@ -234,7 +234,7 @@ BEGIN { XSLoader::load( 'Clownfish::CFC', '0.4.0' ) }
= Clownfish::CFC::Model::Parcel->acquire( $args{parcel} );
return _new(
@args{
- qw( parcel exposure class_name class_nickname micro_sym
+ qw( parcel exposure class_name class_nickname name
return_type param_list docucomment inline )
}
);
@@ -303,7 +303,7 @@ BEGIN { XSLoader::load( 'Clownfish::CFC', '0.4.0' ) }
class_name => undef,
class_nickname => undef,
param_list => undef,
- macro_sym => undef,
+ name => undef,
docucomment => undef,
parcel => undef,
abstract => undef,
@@ -321,7 +321,7 @@ BEGIN { XSLoader::load( 'Clownfish::CFC', '0.4.0' ) }
$args{final} ||= 0;
return _new(
@args{
- qw( parcel exposure class_name class_nickname macro_sym
+ qw( parcel exposure class_name class_nickname name
return_type param_list docucomment final abstract )
}
);
@@ -458,7 +458,7 @@ BEGIN { XSLoader::load( 'Clownfish::CFC', '0.4.0' ) }
exposure => undef,
class_name => undef,
class_nickname => undef,
- micro_sym => undef,
+ name => undef,
);
sub new {
@@ -468,7 +468,7 @@ BEGIN { XSLoader::load( 'Clownfish::CFC', '0.4.0' ) }
$args{parcel}
= Clownfish::CFC::Model::Parcel->acquire( $args{parcel} );
return _new(
- @args{qw( parcel exposure class_name class_nickname micro_sym )} );
+ @args{qw( parcel exposure class_name class_nickname name )} );
}
}
@@ -637,7 +637,7 @@ BEGIN { XSLoader::load( 'Clownfish::CFC', '0.4.0' ) }
our %new_PARAMS = (
type => undef,
- micro_sym => undef,
+ name => undef,
parcel => undef,
exposure => 'local',
class_name => undef,
@@ -654,7 +654,7 @@ BEGIN { XSLoader::load( 'Clownfish::CFC', '0.4.0' ) }
= Clownfish::CFC::Model::Parcel->acquire( $args{parcel} );
return _new(
@args{
- qw( parcel exposure class_name class_nickname micro_sym type
+ qw( parcel exposure class_name class_nickname name type
inert )
}
);
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/perl/lib/Clownfish/CFC.xs
----------------------------------------------------------------------
diff --git a/compiler/perl/lib/Clownfish/CFC.xs b/compiler/perl/lib/Clownfish/CFC.xs
index c80bb8c..5d40ae1 100644
--- a/compiler/perl/lib/Clownfish/CFC.xs
+++ b/compiler/perl/lib/Clownfish/CFC.xs
@@ -155,12 +155,12 @@ 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, is_abstract)
+_create(parcel, exposure_sv, class_name_sv, class_nickname_sv, name_sv, docucomment, file_spec, parent_class_name_sv, is_final, is_inert, is_abstract)
CFCParcel *parcel;
SV *exposure_sv;
SV *class_name_sv;
SV *class_nickname_sv;
- SV *micro_sym_sv;
+ SV *name_sv;
CFCDocuComment *docucomment;
CFCFileSpec *file_spec;
SV *parent_class_name_sv;
@@ -174,13 +174,13 @@ CODE:
SvOK(class_name_sv) ? SvPV_nolen(class_name_sv) : NULL;
const char *class_nickname =
SvOK(class_nickname_sv) ? SvPV_nolen(class_nickname_sv) : NULL;
- const char *micro_sym =
- SvOK(micro_sym_sv) ? SvPV_nolen(micro_sym_sv) : NULL;
+ const char *name =
+ SvOK(name_sv) ? SvPV_nolen(name_sv) : NULL;
const char *parent_class_name =
SvOK(parent_class_name_sv) ? SvPV_nolen(parent_class_name_sv) : NULL;
CFCClass *self
= CFCClass_create(parcel, exposure, class_name, class_nickname,
- micro_sym, docucomment, file_spec, parent_class_name,
+ name, docucomment, file_spec, parent_class_name,
is_final, is_inert, is_abstract);
RETVAL = S_cfcbase_to_perlref(self);
CFCBase_decref((CFCBase*)self);
@@ -637,12 +637,12 @@ PPCODE:
MODULE = Clownfish::CFC PACKAGE = Clownfish::CFC::Model::Function
SV*
-_new(parcel, exposure_sv, class_name_sv, class_nickname_sv, micro_sym_sv, return_type, param_list, docucomment, is_inline)
+_new(parcel, exposure_sv, class_name_sv, class_nickname_sv, name_sv, return_type, param_list, docucomment, is_inline)
CFCParcel *parcel;
SV *exposure_sv;
SV *class_name_sv;
SV *class_nickname_sv;
- SV *micro_sym_sv;
+ SV *name_sv;
CFCType *return_type;
CFCParamList *param_list;
CFCDocuComment *docucomment;
@@ -654,11 +654,11 @@ CODE:
SvOK(class_name_sv) ? SvPV_nolen(class_name_sv) : NULL;
const char *class_nickname =
SvOK(class_nickname_sv) ? SvPV_nolen(class_nickname_sv) : NULL;
- const char *micro_sym =
- SvOK(micro_sym_sv) ? SvPV_nolen(micro_sym_sv) : NULL;
+ const char *name =
+ SvOK(name_sv) ? SvPV_nolen(name_sv) : NULL;
CFCFunction *self
= CFCFunction_new(parcel, exposure, class_name, class_nickname,
- micro_sym, return_type, param_list, docucomment,
+ name, return_type, param_list, docucomment,
is_inline);
RETVAL = S_cfcbase_to_perlref(self);
CFCBase_decref((CFCBase*)self);
@@ -814,12 +814,12 @@ PPCODE:
MODULE = Clownfish::CFC PACKAGE = Clownfish::CFC::Model::Method
SV*
-_new(parcel, exposure_sv, class_name_sv, class_nickname_sv, macro_sym, return_type, param_list, docucomment, is_final, is_abstract)
+_new(parcel, exposure_sv, class_name_sv, class_nickname_sv, name, return_type, param_list, docucomment, is_final, is_abstract)
CFCParcel *parcel;
SV *exposure_sv;
SV *class_name_sv;
SV *class_nickname_sv;
- const char *macro_sym;
+ const char *name;
CFCType *return_type;
CFCParamList *param_list;
CFCDocuComment *docucomment;
@@ -834,7 +834,7 @@ CODE:
SvOK(class_nickname_sv) ? SvPV_nolen(class_nickname_sv) : NULL;
CFCMethod *self
= CFCMethod_new(parcel, exposure, class_name, class_nickname,
- macro_sym, return_type, param_list, docucomment,
+ name, return_type, param_list, docucomment,
is_final, is_abstract);
RETVAL = S_cfcbase_to_perlref(self);
CFCBase_decref((CFCBase*)self);
@@ -914,7 +914,6 @@ void
_set_or_get(self, ...)
CFCMethod *self;
ALIAS:
- get_macro_sym = 2
full_override_sym = 10
abstract = 12
novel = 14
@@ -926,11 +925,6 @@ ALIAS:
PPCODE:
{
START_SET_OR_GET_SWITCH
- case 2: {
- const char *macro_sym = CFCMethod_get_macro_sym(self);
- retval = newSVpvn(macro_sym, strlen(macro_sym));
- }
- break;
case 10: {
const char *value = CFCMethod_full_override_sym(self);
retval = newSVpvn(value, strlen(value));
@@ -1284,12 +1278,12 @@ PPCODE:
MODULE = Clownfish::CFC PACKAGE = Clownfish::CFC::Model::Symbol
SV*
-_new(parcel, exposure, class_name_sv, class_nickname_sv, micro_sym_sv)
+_new(parcel, exposure, class_name_sv, class_nickname_sv, name_sv)
CFCParcel *parcel;
const char *exposure;
SV *class_name_sv;
SV *class_nickname_sv;
- SV *micro_sym_sv;
+ SV *name_sv;
CODE:
const char *class_name = SvOK(class_name_sv)
? SvPV_nolen(class_name_sv)
@@ -1297,12 +1291,12 @@ CODE:
const char *class_nickname = SvOK(class_nickname_sv)
? SvPV_nolen(class_nickname_sv)
: NULL;
- const char *micro_sym = SvOK(micro_sym_sv)
- ? SvPV_nolen(micro_sym_sv)
- : NULL;
+ const char *name = SvOK(name_sv)
+ ? SvPV_nolen(name_sv)
+ : NULL;
CFCSymbol *self
= CFCSymbol_new(parcel, exposure, class_name, class_nickname,
- micro_sym);
+ name);
RETVAL = S_cfcbase_to_perlref(self);
CFCBase_decref((CFCBase*)self);
OUTPUT: RETVAL
@@ -1323,7 +1317,7 @@ ALIAS:
get_class_name = 4
get_class_nickname = 6
get_exposure = 8
- micro_sym = 10
+ get_name = 10
get_prefix = 12
get_Prefix = 14
get_PREFIX = 16
@@ -1362,8 +1356,8 @@ PPCODE:
}
break;
case 10: {
- const char *micro_sym = CFCSymbol_micro_sym(self);
- retval = newSVpvn(micro_sym, strlen(micro_sym));
+ const char *name = CFCSymbol_get_name(self);
+ retval = newSVpvn(name, strlen(name));
}
break;
case 12: {
@@ -1782,12 +1776,12 @@ OUTPUT: RETVAL
MODULE = Clownfish::CFC PACKAGE = Clownfish::CFC::Model::Variable
SV*
-_new(parcel, exposure, class_name_sv, class_nickname_sv, micro_sym_sv, type_sv, inert_sv)
+_new(parcel, exposure, class_name_sv, class_nickname_sv, name_sv, type_sv, inert_sv)
CFCParcel *parcel;
const char *exposure;
SV *class_name_sv;
SV *class_nickname_sv;
- SV *micro_sym_sv;
+ SV *name_sv;
SV *type_sv;
SV *inert_sv;
CODE:
@@ -1797,9 +1791,9 @@ CODE:
const char *class_nickname = SvOK(class_nickname_sv)
? SvPV_nolen(class_nickname_sv)
: NULL;
- const char *micro_sym = SvOK(micro_sym_sv)
- ? SvPV_nolen(micro_sym_sv)
- : NULL;
+ const char *name = SvOK(name_sv)
+ ? SvPV_nolen(name_sv)
+ : NULL;
int inert = SvOK(inert_sv)
? !!SvTRUE(inert_sv) : 0;
CFCType *type = NULL;
@@ -1812,7 +1806,7 @@ CODE:
}
CFCVariable *self
= CFCVariable_new(parcel, exposure, class_name, class_nickname,
- micro_sym, type, inert);
+ name, type, inert);
RETVAL = S_cfcbase_to_perlref(self);
CFCBase_decref((CFCBase*)self);
OUTPUT: RETVAL
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/perl/t/051-symbol.t
----------------------------------------------------------------------
diff --git a/compiler/perl/t/051-symbol.t b/compiler/perl/t/051-symbol.t
index 0cd14df..2a6e1be 100644
--- a/compiler/perl/t/051-symbol.t
+++ b/compiler/perl/t/051-symbol.t
@@ -61,18 +61,18 @@ my $luser = new_symbol( parcel => 'Luser' );
ok( !$lucifer->equals($luser), "different parcel spoils equals" );
for ( qw( 1foo * 0 ), "\x{263a}" ) {
- eval { my $thing = new_symbol( micro_sym => $_ ); };
- like( $@, qr/micro_sym/, "reject bad micro_sym" );
+ eval { my $thing = new_symbol( name => $_ ); };
+ like( $@, qr/name/, "reject bad name" );
}
-my $ooga = new_symbol( micro_sym => 'ooga' );
-my $booga = new_symbol( micro_sym => 'booga' );
-ok( !$ooga->equals($booga), "Different micro_sym spoils equals()" );
+my $ooga = new_symbol( name => 'ooga' );
+my $booga = new_symbol( name => 'booga' );
+ok( !$ooga->equals($booga), "Different name spoils equals()" );
my $eep = new_symbol(
parcel => 'Eep',
class_name => "Op::Ork",
- micro_sym => 'ah_ah',
+ name => 'ah_ah',
);
is( $eep->short_sym, "Ork_ah_ah", "short_sym" );
is( $eep->full_sym, "eep_Ork_ah_ah", "full_sym" );
@@ -80,7 +80,7 @@ is( $eep->full_sym, "eep_Ork_ah_ah", "full_sym" );
sub new_symbol {
return Clownfish::CFC::Model::Symbol->new(
parcel => $parcel,
- micro_sym => 'sym',
+ name => 'sym',
exposure => 'parcel',
@_
);
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/perl/t/200-function.t
----------------------------------------------------------------------
diff --git a/compiler/perl/t/200-function.t b/compiler/perl/t/200-function.t
index d52ddc8..859907b 100644
--- a/compiler/perl/t/200-function.t
+++ b/compiler/perl/t/200-function.t
@@ -32,7 +32,7 @@ my %args = (
class_name => 'Neato::Foo',
class_nickname => 'Foo',
param_list => $parser->parse('(int32_t some_num)'),
- micro_sym => 'return_an_obj',
+ name => 'return_an_obj',
);
my $func = Clownfish::CFC::Model::Function->new(%args);
@@ -44,8 +44,8 @@ eval {
};
like( $@, qr/extra_arg/, "Extra arg kills constructor" );
-eval { Clownfish::CFC::Model::Function->new( %args, micro_sym => 'Uh_Oh' ); };
-like( $@, qr/Uh_Oh/, "invalid micro_sym kills constructor" );
+eval { Clownfish::CFC::Model::Function->new( %args, name => 'Uh_Oh' ); };
+like( $@, qr/Uh_Oh/, "invalid name kills constructor" );
$parser->set_class_name("Neato::Obj");
$parser->set_class_nickname("Obj");
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/perl/t/201-method.t
----------------------------------------------------------------------
diff --git a/compiler/perl/t/201-method.t b/compiler/perl/t/201-method.t
index 260f58f..268a7e5 100644
--- a/compiler/perl/t/201-method.t
+++ b/compiler/perl/t/201-method.t
@@ -31,7 +31,7 @@ my %args = (
class_name => 'Neato::Foo',
class_nickname => 'Foo',
param_list => $parser->parse('(Foo *self, int32_t count = 0)'),
- macro_sym => 'Return_An_Obj',
+ name => 'Return_An_Obj',
);
my $method = Clownfish::CFC::Model::Method->new(%args);
@@ -46,23 +46,23 @@ eval {
like( $@, qr/extra_arg/, "Extra arg kills constructor" );
eval {
- Clownfish::CFC::Model::Method->new( %args, macro_sym => 'return_an_obj' );
+ Clownfish::CFC::Model::Method->new( %args, name => 'return_an_obj' );
};
-like( $@, qr/macro_sym/, "Invalid macro_sym kills constructor" );
+like( $@, qr/name/, "Invalid name kills constructor" );
my $dupe = Clownfish::CFC::Model::Method->new(%args);
ok( $method->compatible($dupe), "compatible()" );
-my $macro_sym_differs
- = Clownfish::CFC::Model::Method->new( %args, macro_sym => 'Eat' );
-ok( !$method->compatible($macro_sym_differs),
- "different macro_sym spoils compatible()"
+my $name_differs
+ = Clownfish::CFC::Model::Method->new( %args, name => 'Eat' );
+ok( !$method->compatible($name_differs),
+ "different name spoils compatible()"
);
-ok( !$macro_sym_differs->compatible($method), "... reversed" );
+ok( !$name_differs->compatible($method), "... reversed" );
my $extra_param = Clownfish::CFC::Model::Method->new( %args,
param_list => $parser->parse('(Foo *self, int32_t count = 0, int b)'), );
-ok( !$method->compatible($macro_sym_differs),
+ok( !$method->compatible($name_differs),
"extra param spoils compatible()"
);
ok( !$extra_param->compatible($method), "... reversed" );
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/perl/t/202-overridden_method.t
----------------------------------------------------------------------
diff --git a/compiler/perl/t/202-overridden_method.t b/compiler/perl/t/202-overridden_method.t
index dea925f..ebda8b6 100644
--- a/compiler/perl/t/202-overridden_method.t
+++ b/compiler/perl/t/202-overridden_method.t
@@ -30,7 +30,7 @@ my %args = (
class_name => 'Neato::Foo',
class_nickname => 'Foo',
param_list => $parser->parse('(Foo *self)'),
- macro_sym => 'Return_An_Obj',
+ name => 'Return_An_Obj',
parcel => 'Neato',
);
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/perl/t/203-final_method.t
----------------------------------------------------------------------
diff --git a/compiler/perl/t/203-final_method.t b/compiler/perl/t/203-final_method.t
index 6dbccfb..f2c2ca8 100644
--- a/compiler/perl/t/203-final_method.t
+++ b/compiler/perl/t/203-final_method.t
@@ -29,7 +29,7 @@ my %args = (
class_name => 'Neato::Foo',
class_nickname => 'Foo',
param_list => $parser->parse('(Foo* self)'),
- macro_sym => 'Return_An_Obj',
+ name => 'Return_An_Obj',
parcel => 'Neato',
);
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/perl/t/300-variable.t
----------------------------------------------------------------------
diff --git a/compiler/perl/t/300-variable.t b/compiler/perl/t/300-variable.t
index 0c7ccaf..e31a239 100644
--- a/compiler/perl/t/300-variable.t
+++ b/compiler/perl/t/300-variable.t
@@ -29,7 +29,7 @@ sub new_type { $parser->parse(shift) }
eval {
my $death = Clownfish::CFC::Model::Variable->new(
parcel => $parcel,
- micro_sym => 'foo',
+ name => 'foo',
type => new_type('int'),
extra_arg => undef,
);
@@ -38,8 +38,8 @@ like( $@, qr/extra_arg/, "Extra arg kills constructor" );
eval {
my $death = Clownfish::CFC::Model::Variable->new(
- parcel => $parcel,
- micro_sym => 'foo',
+ parcel => $parcel,
+ name => 'foo',
);
};
like( $@, qr/type/, "type is required" );
@@ -49,12 +49,12 @@ eval {
type => new_type('int32_t'),
);
};
-like( $@, qr/micro_sym/, "micro_sym is required" );
+like( $@, qr/name/, "name is required" );
my $var = Clownfish::CFC::Model::Variable->new(
- parcel => $parcel,
- micro_sym => 'foo',
- type => new_type('float*')
+ parcel => $parcel,
+ name => 'foo',
+ type => new_type('float*')
);
$var->resolve_type;
is( $var->local_c, 'float* foo', "local_c" );
@@ -62,9 +62,9 @@ is( $var->local_declaration, 'float* foo;', "declaration" );
ok( $var->local, "default to local access" );
$var = Clownfish::CFC::Model::Variable->new(
- parcel => $parcel,
- micro_sym => 'foo',
- type => new_type('float[1]')
+ parcel => $parcel,
+ name => 'foo',
+ type => new_type('float[1]')
);
$var->resolve_type;
is( $var->local_c, 'float foo[1]',
@@ -73,7 +73,7 @@ is( $var->local_c, 'float foo[1]',
my $foo_class = $parser->parse("class Foo {}");
$var = Clownfish::CFC::Model::Variable->new(
parcel => 'Neato',
- micro_sym => 'foo',
+ name => 'foo',
type => new_type("Foo*"),
class_name => 'Crustacean::Lobster::LobsterClaw',
class_nickname => 'LobClaw',
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/perl/t/401-class.t
----------------------------------------------------------------------
diff --git a/compiler/perl/t/401-class.t b/compiler/perl/t/401-class.t
index 79e5e46..a392370 100644
--- a/compiler/perl/t/401-class.t
+++ b/compiler/perl/t/401-class.t
@@ -27,19 +27,19 @@ my $thing = Clownfish::CFC::Model::Variable->new(
parcel => 'Neato',
class_name => 'Foo',
type => $parser->parse('Thing*'),
- micro_sym => 'thing',
+ name => 'thing',
);
my $widget = Clownfish::CFC::Model::Variable->new(
parcel => 'Neato',
class_name => 'Widget',
type => $parser->parse('Widget*'),
- micro_sym => 'widget',
+ name => 'widget',
);
my $tread_water = Clownfish::CFC::Model::Function->new(
parcel => 'Neato',
class_name => 'Foo',
return_type => $parser->parse('void'),
- micro_sym => 'tread_water',
+ name => 'tread_water',
param_list => $parser->parse('()'),
);
my %foo_create_args = (
@@ -178,7 +178,7 @@ my $class_content
= 'public class Foo::Foodie nickname Foodie inherits Foo { int num; }';
my $class = $parser->parse($class_content);
isa_ok( $class, "Clownfish::CFC::Model::Class", "class_declaration FooJr" );
-ok( ( scalar grep { $_->micro_sym eq 'num' } @{ $class->fresh_member_vars } ),
+ok( ( scalar grep { $_->get_name eq 'num' } @{ $class->fresh_member_vars } ),
"parsed member var" );
$class_content = q|
@@ -213,25 +213,25 @@ $class_content = q|
$class = $parser->parse($class_content);
isa_ok( $class, "Clownfish::CFC::Model::Class", "class_declaration Dog" );
-ok( ( scalar grep { $_->micro_sym eq 'num_dogs' } @{ $class->inert_vars } ),
+ok( ( scalar grep { $_->get_name eq 'num_dogs' } @{ $class->inert_vars } ),
"parsed inert var" );
-ok( ( scalar grep { $_->micro_sym eq 'top_dog' } @{ $class->inert_vars } ),
+ok( ( scalar grep { $_->get_name eq 'top_dog' } @{ $class->inert_vars } ),
"parsed public inert var" );
-ok( ( scalar grep { $_->micro_sym eq 'mom' } @{ $class->fresh_member_vars } ),
+ok( ( scalar grep { $_->get_name eq 'mom' } @{ $class->fresh_member_vars } ),
"parsed member var" );
-ok( ( scalar grep { $_->micro_sym eq 'squishy' } @{ $class->fresh_member_vars } ),
+ok( ( scalar grep { $_->get_name eq 'squishy' } @{ $class->fresh_member_vars } ),
"parsed member var" );
-ok( ( scalar grep { $_->micro_sym eq 'init' } @{ $class->functions } ),
+ok( ( scalar grep { $_->get_name eq 'init' } @{ $class->functions } ),
"parsed function" );
-ok( ( scalar grep { $_->micro_sym eq 'destroy' } @{ $class->fresh_methods } ),
+ok( ( scalar grep { $_->get_name eq 'Destroy' } @{ $class->fresh_methods } ),
"parsed parcel method" );
-ok( ( scalar grep { $_->micro_sym eq 'bury' } @{ $class->fresh_methods } ),
+ok( ( scalar grep { $_->get_name eq 'Bury' } @{ $class->fresh_methods } ),
"parsed public method" );
-ok( ( scalar grep { $_->micro_sym eq 'scratch' } @{ $class->fresh_methods } ),
+ok( ( scalar grep { $_->get_name eq 'Scratch' } @{ $class->fresh_methods } ),
"parsed public abstract nullable method" );
for my $method ( @{ $class->fresh_methods } ) {
- if ( $method->micro_sym eq 'scratch' ) {
+ if ( $method->get_name eq 'Scratch' ) {
ok( $method->get_return_type->nullable,
"public abstract incremented nullable flagged as nullable" );
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/perl/t/403-parcel.t
----------------------------------------------------------------------
diff --git a/compiler/perl/t/403-parcel.t b/compiler/perl/t/403-parcel.t
index 25ac79b..1fd29a3 100644
--- a/compiler/perl/t/403-parcel.t
+++ b/compiler/perl/t/403-parcel.t
@@ -102,9 +102,9 @@ $parcel->register;
is( $parcel->get_version->get_vstring, 'v0', "get_version" );
my $thing = Clownfish::CFC::Model::Symbol->new(
- micro_sym => 'sym',
- parcel => 'Crustacean',
- exposure => 'parcel'
+ name => 'sym',
+ parcel => 'Crustacean',
+ exposure => 'parcel'
);
is( $thing->get_prefix, 'crust_', 'get_prefix with parcel' );
is( $thing->get_Prefix, 'Crust_', 'get_Prefix with parcel' );
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/perl/t/600-parser.t
----------------------------------------------------------------------
diff --git a/compiler/perl/t/600-parser.t b/compiler/perl/t/600-parser.t
index 8b81999..f8063ae 100644
--- a/compiler/perl/t/600-parser.t
+++ b/compiler/perl/t/600-parser.t
@@ -43,7 +43,7 @@ is( ${ $parser->get_parcel },
for (qw( foo _foo foo_yoo FOO Foo fOO f00 foo_foo_foo )) {
my $var = $parser->parse("int32_t $_;");
- is( $var->micro_sym, $_, "identifier/declarator: $_" );
+ is( $var->get_name, $_, "identifier/declarator: $_" );
}
for (qw( void float uint32_t int64_t uint8_t bool )) {
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCBindMethod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCBindMethod.c b/compiler/src/CFCBindMethod.c
index 47ab90b..1ea5ec5 100644
--- a/compiler/src/CFCBindMethod.c
+++ b/compiler/src/CFCBindMethod.c
@@ -136,7 +136,7 @@ CFCBindMeth_typedef_dec(struct CFCMethod *method, CFCClass *klass) {
char*
CFCBindMeth_novel_spec_def(CFCMethod *method) {
- const char *macro_sym = CFCMethod_get_macro_sym(method);
+ const char *meth_name = CFCMethod_get_name(method);
const char *imp_func = CFCMethod_imp_func(method);
const char *full_override_sym = "NULL";
@@ -154,7 +154,7 @@ CFCBindMeth_novel_spec_def(CFCMethod *method) {
" (cfish_method_t)%s /* callback_func */\n"
" }";
char *def
- = CFCUtil_sprintf(pattern, full_offset_sym, macro_sym, imp_func,
+ = CFCUtil_sprintf(pattern, full_offset_sym, meth_name, imp_func,
full_override_sym);
FREEMEM(full_offset_sym);
@@ -211,17 +211,17 @@ CFCBindMeth_abstract_method_def(CFCMethod *method) {
CFCType *type = CFCMethod_self_type(method);
const char *full_func_sym = CFCMethod_imp_func(method);
const char *class_var = CFCType_get_class_var(type);
- const char *macro_sym = CFCMethod_get_macro_sym(method);
+ const char *meth_name = CFCMethod_get_name(method);
CFCParamList *param_list = CFCMethod_get_param_list(method);
const char *params = CFCParamList_to_c(param_list);
CFCVariable **vars = CFCParamList_get_variables(param_list);
- const char *invocant = CFCVariable_micro_sym(vars[0]);
+ const char *invocant = CFCVariable_get_name(vars[0]);
// All variables other than the invocant are unused, and the return is
// unreachable.
char *unused = CFCUtil_strdup("");
for (int i = 1; vars[i] != NULL; i++) {
- const char *var_name = CFCVariable_micro_sym(vars[i]);
+ const char *var_name = CFCVariable_get_name(vars[i]);
size_t size = strlen(unused) + strlen(var_name) + 80;
unused = (char*)REALLOCATE(unused, size);
strcat(unused, "\n CFISH_UNUSED_VAR(");
@@ -243,7 +243,7 @@ CFCBindMeth_abstract_method_def(CFCMethod *method) {
"}\n";
char *abstract_def
= CFCUtil_sprintf(pattern, ret_type_str, full_func_sym, params,
- unused, invocant, class_var, macro_sym,
+ unused, invocant, class_var, meth_name,
unreachable);
FREEMEM(unused);
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCCHtml.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCCHtml.c b/compiler/src/CFCCHtml.c
index dd4af99..c1b7eb9 100644
--- a/compiler/src/CFCCHtml.c
+++ b/compiler/src/CFCCHtml.c
@@ -499,9 +499,9 @@ S_html_create_functions(CFCClass *klass) {
result = CFCUtil_cat(result, "<h2>Functions</h2>\n<dl>\n", NULL);
}
- const char *micro_sym = CFCFunction_micro_sym(func);
- result = CFCUtil_cat(result, "<dt id=\"func_", micro_sym, "\">",
- micro_sym, "</dt>\n", NULL);
+ const char *name = CFCFunction_get_name(func);
+ result = CFCUtil_cat(result, "<dt id=\"func_", name, "\">",
+ name, "</dt>\n", NULL);
CFCParcel *parcel = CFCSymbol_get_parcel((CFCSymbol*)func);
const char *prefix = CFCParcel_get_prefix(parcel);
@@ -584,9 +584,9 @@ S_html_create_fresh_methods(CFCClass *klass, CFCClass *ancestor) {
result = CFCUtil_cat(result, "<dl>\n", NULL);
}
- const char *macro_sym = CFCMethod_get_macro_sym(method);
- result = CFCUtil_cat(result, "<dt id=\"func_", macro_sym, "\">",
- macro_sym, NULL);
+ const char *name = CFCMethod_get_name(method);
+ result = CFCUtil_cat(result, "<dt id=\"func_", name, "\">",
+ name, NULL);
if (CFCMethod_abstract(method)) {
result = CFCUtil_cat(result,
" <span class=\"comment\">(abstract)</span>", NULL);
@@ -635,11 +635,11 @@ S_html_create_func(CFCClass *klass, CFCFunction *func, const char *prefix,
// Get documentation, which may be inherited.
CFCDocuComment *docucomment = CFCFunction_get_docucomment(func);
if (!docucomment) {
- const char *micro_sym = CFCFunction_micro_sym(func);
+ const char *name = CFCFunction_get_name(func);
CFCClass *parent = klass;
while (NULL != (parent = CFCClass_get_parent(parent))) {
CFCFunction *parent_func
- = (CFCFunction*)CFCClass_method(parent, micro_sym);
+ = (CFCFunction*)CFCClass_method(parent, name);
if (!parent_func) { break; }
docucomment = CFCFunction_get_docucomment(parent_func);
if (docucomment) { break; }
@@ -704,7 +704,7 @@ S_html_create_param_list(CFCClass *klass, CFCFunction *func) {
for (int i = 0; variables[i]; ++i) {
CFCVariable *variable = variables[i];
CFCType *type = CFCVariable_get_type(variable);
- const char *name = CFCVariable_micro_sym(variable);
+ const char *name = CFCVariable_get_name(variable);
char *type_html;
if (is_method && i == 0) {
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCCMan.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCCMan.c b/compiler/src/CFCCMan.c
index f6ef3f0..857a4d4 100644
--- a/compiler/src/CFCCMan.c
+++ b/compiler/src/CFCCMan.c
@@ -179,8 +179,8 @@ S_man_create_functions(CFCClass *klass) {
result = CFCUtil_cat(result, ".SH FUNCTIONS\n", NULL);
}
- const char *micro_sym = CFCFunction_micro_sym(func);
- result = CFCUtil_cat(result, ".TP\n.B ", micro_sym, "\n", NULL);
+ const char *name = CFCFunction_get_name(func);
+ result = CFCUtil_cat(result, ".TP\n.B ", name, "\n", NULL);
const char *full_func_sym = CFCFunction_full_func_sym(func);
char *function_man = S_man_create_func(klass, func, full_func_sym);
@@ -250,8 +250,8 @@ S_man_create_fresh_methods(CFCClass *klass, CFCClass *ancestor) {
continue;
}
- const char *macro_sym = CFCMethod_get_macro_sym(method);
- result = CFCUtil_cat(result, ".TP\n.BR ", macro_sym, NULL);
+ const char *name = CFCMethod_get_name(method);
+ result = CFCUtil_cat(result, ".TP\n.BR ", name, NULL);
if (CFCMethod_abstract(method)) {
result = CFCUtil_cat(result, " \" (abstract)\"", NULL);
}
@@ -295,11 +295,11 @@ S_man_create_func(CFCClass *klass, CFCFunction *func, const char *full_sym) {
// Get documentation, which may be inherited.
CFCDocuComment *docucomment = CFCFunction_get_docucomment(func);
if (!docucomment) {
- const char *micro_sym = CFCFunction_micro_sym(func);
+ const char *name = CFCFunction_get_name(func);
CFCClass *parent = klass;
while (NULL != (parent = CFCClass_get_parent(parent))) {
CFCFunction *parent_func
- = (CFCFunction*)CFCClass_method(parent, micro_sym);
+ = (CFCFunction*)CFCClass_method(parent, name);
if (!parent_func) { break; }
docucomment = CFCFunction_get_docucomment(parent_func);
if (docucomment) { break; }
@@ -357,7 +357,7 @@ S_man_create_param_list(CFCClass *klass, CFCFunction *func) {
for (int i = 0; variables[i]; ++i) {
CFCVariable *variable = variables[i];
CFCType *type = CFCVariable_get_type(variable);
- const char *name = CFCVariable_micro_sym(variable);
+ const char *name = CFCVariable_get_name(variable);
char *type_c;
if (is_method && i == 0) {
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCCallable.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCCallable.c b/compiler/src/CFCCallable.c
index f787324..05aa572 100644
--- a/compiler/src/CFCCallable.c
+++ b/compiler/src/CFCCallable.c
@@ -41,7 +41,7 @@ static const CFCMeta CFCCALLABLE_META = {
CFCCallable*
CFCCallable_init(CFCCallable *self, CFCParcel *parcel, const char *exposure,
const char *class_name, const char *class_nickname,
- const char *micro_sym, CFCType *return_type,
+ const char *name, CFCType *return_type,
CFCParamList *param_list, CFCDocuComment *docucomment) {
exposure = exposure ? exposure : "parcel";
@@ -49,7 +49,7 @@ CFCCallable_init(CFCCallable *self, CFCParcel *parcel, const char *exposure,
CFCUTIL_NULL_CHECK(return_type);
CFCUTIL_NULL_CHECK(param_list);
CFCSymbol_init((CFCSymbol*)self, parcel, exposure, class_name,
- class_nickname, micro_sym);
+ class_nickname, name);
self->return_type = (CFCType*)CFCBase_incref((CFCBase*)return_type);
self->param_list = (CFCParamList*)CFCBase_incref((CFCBase*)param_list);
self->docucomment = (CFCDocuComment*)CFCBase_incref((CFCBase*)docucomment);
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCCallable.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCCallable.h b/compiler/src/CFCCallable.h
index 6e9a349..3c85c57 100644
--- a/compiler/src/CFCCallable.h
+++ b/compiler/src/CFCCallable.h
@@ -49,8 +49,7 @@ struct CFCCallable {
* @param class_name The full name of the class in whose namespace the
* function resides.
* @param class_nickname The C nickname for the class.
- * @param micro_sym The lower case name of the callable, without any
- * namespacing prefixes.
+ * @param name The name of the callable, without any namespacing prefixes.
* @param return_type A Clownfish::CFC::Model::Type representing the
* callable's return type.
* @param param_list A Clownfish::CFC::Model::ParamList representing the
@@ -61,7 +60,7 @@ struct CFCCallable {
CFCCallable*
CFCCallable_init(CFCCallable *self, struct CFCParcel *parcel,
const char *exposure, const char *class_name,
- const char *class_nickname, const char *micro_sym,
+ const char *class_nickname, const char *name,
struct CFCType *return_type, struct CFCParamList *param_list,
struct CFCDocuComment *docucomment);
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCClass.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCClass.c b/compiler/src/CFCClass.c
index b57c5c2..053a4c3 100644
--- a/compiler/src/CFCClass.c
+++ b/compiler/src/CFCClass.c
@@ -105,28 +105,27 @@ static const CFCMeta CFCCLASS_META = {
CFCClass*
CFCClass_create(struct CFCParcel *parcel, const char *exposure,
const char *class_name, const char *nickname,
- const char *micro_sym, CFCDocuComment *docucomment,
+ const char *name, CFCDocuComment *docucomment,
CFCFileSpec *file_spec, const char *parent_class_name,
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,
- is_abstract);
+ name, docucomment, file_spec, parent_class_name,
+ is_final, is_inert, is_abstract);
}
CFCClass*
CFCClass_do_create(CFCClass *self, struct CFCParcel *parcel,
const char *exposure, const char *class_name,
- const char *nickname, const char *micro_sym,
+ const char *nickname, const char *name,
CFCDocuComment *docucomment, CFCFileSpec *file_spec,
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";
+ exposure = exposure ? exposure : "parcel";
+ name = name ? name : "class";
CFCSymbol_init((CFCSymbol*)self, parcel, exposure, class_name, nickname,
- micro_sym);
+ name);
if (!is_inert
&& !parent_class_name
&& strcmp(class_name, "Clownfish::Obj") != 0
@@ -459,15 +458,9 @@ S_find_func(CFCFunction **funcs, const char *sym) {
return NULL;
}
- char lcsym[MAX_FUNC_LEN + 1];
- size_t sym_len = strlen(sym);
- if (sym_len > MAX_FUNC_LEN) { CFCUtil_die("sym too long: '%s'", sym); }
- for (size_t i = 0; i <= sym_len; i++) {
- lcsym[i] = tolower(sym[i]);
- }
for (size_t i = 0; funcs[i] != NULL; i++) {
CFCFunction *func = funcs[i];
- if (strcmp(lcsym, CFCFunction_micro_sym(func)) == 0) {
+ if (strcmp(sym, CFCFunction_get_name(func)) == 0) {
return func;
}
}
@@ -542,8 +535,8 @@ S_bequeath_methods(CFCClass *self) {
// Gather methods which child inherits or overrides.
for (size_t i = 0; i < self->num_methods; i++) {
CFCMethod *method = self->methods[i];
- const char *macro_sym = CFCMethod_get_macro_sym(method);
- CFCMethod *child_method = CFCClass_fresh_method(child, macro_sym);
+ const char *meth_name = CFCMethod_get_name(method);
+ CFCMethod *child_method = CFCClass_fresh_method(child, meth_name);
if (child_method) {
CFCMethod_override(child_method, method);
methods[num_methods++] = child_method;
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCClass.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCClass.h b/compiler/src/CFCClass.h
index 942ed93..bdba617 100644
--- a/compiler/src/CFCClass.h
+++ b/compiler/src/CFCClass.h
@@ -45,7 +45,7 @@ struct CFCFileSpec;
* @param exposure See Clownfish::CFC::Model::Symbol.
* @param class_name See Clownfish::CFC::Model::Symbol.
* @param nickname See Clownfish::CFC::Model::Symbol.
- * @param micro_sym Defaults to "class".
+ * @param name Defaults to "class".
* @param docucomment An optional Clownfish::CFC::Model::DocuComment attached
* to this class.
* @param file_spec - Clownfish::CFC::Model::FileSpec of the file in which
@@ -60,14 +60,14 @@ struct CFCFileSpec;
CFCClass*
CFCClass_create(struct CFCParcel *parcel, const char *exposure,
const char *class_name, const char *nickname,
- const char *micro_sym, struct CFCDocuComment *docucomment,
+ const char *name, struct CFCDocuComment *docucomment,
struct CFCFileSpec *file_spec, const char *parent_class_name,
int is_final, int is_inert, int is_abstract);
CFCClass*
CFCClass_do_create(CFCClass *self, struct CFCParcel *parcel,
const char *exposure, const char *class_name,
- const char *nickname, const char *micro_sym,
+ const char *nickname, const char *name,
struct CFCDocuComment *docucomment,
struct CFCFileSpec *file_spec, const char *parent_class_name,
int is_final, int is_inert, int is_abstract);
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCFunction.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCFunction.c b/compiler/src/CFCFunction.c
index c5d3658..7f21f9b 100644
--- a/compiler/src/CFCFunction.c
+++ b/compiler/src/CFCFunction.c
@@ -46,21 +46,21 @@ static const CFCMeta CFCFUNCTION_META = {
CFCFunction*
CFCFunction_new(CFCParcel *parcel, const char *exposure,
const char *class_name, const char *class_nickname,
- const char *micro_sym, CFCType *return_type,
+ const char *name, CFCType *return_type,
CFCParamList *param_list, CFCDocuComment *docucomment,
int is_inline) {
CFCFunction *self = (CFCFunction*)CFCBase_allocate(&CFCFUNCTION_META);
return CFCFunction_init(self, parcel, exposure, class_name, class_nickname,
- micro_sym, return_type, param_list, docucomment,
+ name, return_type, param_list, docucomment,
is_inline);
}
static int
-S_validate_micro_sym(const char *micro_sym) {
- size_t len = strlen(micro_sym);
+S_validate_function_name(const char *name) {
+ size_t len = strlen(name);
if (!len) { return false; }
for (size_t i = 0; i < len; i++) {
- char c = micro_sym[i];
+ char c = name[i];
if (!islower(c) && !isdigit(c) && c != '_') { return false; }
}
return true;
@@ -69,16 +69,16 @@ S_validate_micro_sym(const char *micro_sym) {
CFCFunction*
CFCFunction_init(CFCFunction *self, CFCParcel *parcel, const char *exposure,
const char *class_name, const char *class_nickname,
- const char *micro_sym, CFCType *return_type,
+ const char *name, CFCType *return_type,
CFCParamList *param_list, CFCDocuComment *docucomment,
int is_inline) {
- if (!S_validate_micro_sym(micro_sym)) {
+ if (!S_validate_function_name(name)) {
CFCBase_decref((CFCBase*)self);
- CFCUtil_die("Invalid micro_sym: '%s'", micro_sym);
+ CFCUtil_die("Invalid function name: '%s'", name);
}
CFCCallable_init((CFCCallable*)self, parcel, exposure, class_name,
- class_nickname, micro_sym, return_type, param_list,
+ class_nickname, name, return_type, param_list,
docucomment);
self->is_inline = is_inline;
return self;
@@ -135,8 +135,8 @@ CFCFunction_short_func_sym(CFCFunction *self) {
}
const char*
-CFCFunction_micro_sym(CFCFunction *self) {
- return CFCSymbol_micro_sym((CFCSymbol*)self);
+CFCFunction_get_name(CFCFunction *self) {
+ return CFCSymbol_get_name((CFCSymbol*)self);
}
int
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCFunction.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCFunction.h b/compiler/src/CFCFunction.h
index 402a214..3c786ab 100644
--- a/compiler/src/CFCFunction.h
+++ b/compiler/src/CFCFunction.h
@@ -38,8 +38,7 @@ struct CFCClass;
* @param class_name The full name of the class in whose namespace the
* function resides.
* @param class_nickname The C nickname for the class.
- * @param micro_sym The lower case name of the function, without any
- * namespacing prefixes.
+ * @param name The name of the function, without any namespacing prefixes.
* @param return_type A Clownfish::CFC::Model::Type representing the
* function's return type.
* @param param_list A Clownfish::CFC::Model::ParamList representing the
@@ -52,14 +51,14 @@ struct CFCClass;
CFCFunction*
CFCFunction_new(struct CFCParcel *parcel, const char *exposure,
const char *class_name, const char *class_nickname,
- const char *micro_sym, struct CFCType *return_type,
+ const char *name, struct CFCType *return_type,
struct CFCParamList *param_list,
struct CFCDocuComment *docucomment, int is_inline);
CFCFunction*
CFCFunction_init(CFCFunction *self, struct CFCParcel *parcel,
const char *exposure, const char *class_name,
- const char *class_nickname, const char *micro_sym,
+ const char *class_nickname, const char *name,
struct CFCType *return_type, struct CFCParamList *param_list,
struct CFCDocuComment *docucomment, int is_inline);
@@ -99,7 +98,7 @@ const char*
CFCFunction_short_func_sym(CFCFunction *self);
const char*
-CFCFunction_micro_sym(CFCFunction *self);
+CFCFunction_get_name(CFCFunction *self);
int
CFCFunction_public(CFCFunction *self);
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCGoClass.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCGoClass.c b/compiler/src/CFCGoClass.c
index 79fa880..3c8afb7 100644
--- a/compiler/src/CFCGoClass.c
+++ b/compiler/src/CFCGoClass.c
@@ -207,7 +207,7 @@ CFCGoClass_go_typing(CFCGoClass *self) {
if (!CFCMethod_novel(method)) {
continue;
}
- const char *sym = CFCMethod_get_macro_sym(method);
+ const char *sym = CFCMethod_get_name(method);
if (!CFCClass_fresh_method(self->client, sym)) {
continue;
}
@@ -289,7 +289,7 @@ S_lazy_init_method_bindings(CFCGoClass *self) {
if (!CFCMethod_novel(method)) {
continue;
}
- const char *sym = CFCMethod_get_macro_sym(method);
+ const char *sym = CFCMethod_get_name(method);
if (!CFCClass_fresh_method(self->client, sym)) {
continue;
}
@@ -342,7 +342,7 @@ CFCGoClass_spec_method(CFCGoClass *self, const char *name, const char *sig) {
for (int i = 0; self->method_bindings[i] != NULL; i++) {
CFCGoMethod *candidate = self->method_bindings[i];
CFCMethod *meth = CFCGoMethod_get_client(candidate);
- if (meth && strcmp(name, CFCMethod_get_macro_sym(meth)) == 0) {
+ if (meth && strcmp(name, CFCMethod_get_name(meth)) == 0) {
binding = candidate;
break;
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCGoMethod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCGoMethod.c b/compiler/src/CFCGoMethod.c
index fb05659..37f7bdd 100644
--- a/compiler/src/CFCGoMethod.c
+++ b/compiler/src/CFCGoMethod.c
@@ -93,7 +93,7 @@ S_lazy_init_sig(CFCGoMethod *self) {
CFCMethod *method = self->method;
CFCParcel *parcel = CFCMethod_get_parcel(method);
CFCType *return_type = CFCMethod_get_return_type(method);
- char *name = CFCGoFunc_go_meth_name(CFCMethod_get_macro_sym(method));
+ char *name = CFCGoFunc_go_meth_name(CFCMethod_get_name(method));
char *go_ret_type = CFCType_is_void(return_type)
? CFCUtil_strdup("")
: CFCGoTypeMap_go_type_name(return_type, parcel);
@@ -186,7 +186,7 @@ CFCGoMethod_func_def(CFCGoMethod *self, CFCClass *invoker) {
CFCParcel *parcel = CFCClass_get_parcel(invoker);
CFCParamList *param_list = CFCMethod_get_param_list(novel_method);
CFCType *ret_type = CFCMethod_get_return_type(novel_method);
- char *name = CFCGoFunc_go_meth_name(CFCMethod_get_macro_sym(novel_method));
+ char *name = CFCGoFunc_go_meth_name(CFCMethod_get_name(novel_method));
char *first_line = CFCGoFunc_func_start(parcel, name, invoker,
param_list, ret_type, true);
char *cfunc;
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCGoTypeMap.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCGoTypeMap.c b/compiler/src/CFCGoTypeMap.c
index dd3f374..9872d10 100644
--- a/compiler/src/CFCGoTypeMap.c
+++ b/compiler/src/CFCGoTypeMap.c
@@ -190,7 +190,7 @@ CFCGoTypeMap_go_meth_receiever(const char *struct_name,
size_t max_required = 2;
if (param_list != NULL && CFCParamList_num_vars(param_list) > 0) {
CFCVariable **vars = CFCParamList_get_variables(param_list);
- const char *orig = CFCVariable_micro_sym(vars[0]);
+ const char *orig = CFCVariable_get_name(vars[0]);
max_required = strlen(orig) + 1;
}
if (buf_len < max_required) {
@@ -211,7 +211,7 @@ CFCGoTypeMap_go_meth_receiever(const char *struct_name,
CFCVariable **vars = CFCParamList_get_variables(param_list);
size_t num_vars = CFCParamList_num_vars(param_list);
for (int i = 1; i < num_vars; i++) {
- const char *name = CFCVariable_micro_sym(vars[i]);
+ const char *name = CFCVariable_get_name(vars[i]);
if (strcmp(name, buf) == 0) {
// Bah, a clash. Use the original name, even though it's
// probably "self" which isn't good Go style.
@@ -230,7 +230,7 @@ CFCGoTypeMap_go_arg_name(CFCParamList *param_list, size_t tick, char *buf,
CFCUtil_die("Index out of range: %d >= %d", (int)tick, (int)num_vars);
}
CFCVariable **vars = CFCParamList_get_variables(param_list);
- const char *orig = CFCVariable_micro_sym(vars[tick]);
+ const char *orig = CFCVariable_get_name(vars[tick]);
size_t max_required = strlen(orig) + 2;
if (buf_len < max_required || buf_len < 5) {
CFCUtil_die("Buffer length too short: %d", buf_len);
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCMethod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCMethod.c b/compiler/src/CFCMethod.c
index ba5399d..ad9d945 100644
--- a/compiler/src/CFCMethod.c
+++ b/compiler/src/CFCMethod.c
@@ -37,7 +37,6 @@
struct CFCMethod {
CFCCallable callable;
CFCMethod *novel_method;
- char *macro_sym;
char *full_override_sym;
char *host_alias;
char *short_imp_func;
@@ -56,32 +55,32 @@ static const CFCMeta CFCMETHOD_META = {
CFCMethod*
CFCMethod_new(CFCParcel *parcel, const char *exposure, const char *class_name,
- const char *class_nickname, const char *macro_sym,
+ const char *class_nickname, const char *name,
CFCType *return_type, CFCParamList *param_list,
CFCDocuComment *docucomment, int is_final, int is_abstract) {
CFCMethod *self = (CFCMethod*)CFCBase_allocate(&CFCMETHOD_META);
return CFCMethod_init(self, parcel, exposure, class_name, class_nickname,
- macro_sym, return_type, param_list, docucomment,
+ name, return_type, param_list, docucomment,
is_final, is_abstract);
}
static int
-S_validate_macro_sym(const char *macro_sym) {
- if (!macro_sym || !strlen(macro_sym)) { return false; }
+S_validate_meth_name(const char *meth_name) {
+ if (!meth_name || !strlen(meth_name)) { return false; }
int need_upper = true;
int need_letter = true;
- for (;; macro_sym++) {
- if (need_upper && !isupper(*macro_sym)) { return false; }
- if (need_letter && !isalpha(*macro_sym)) { return false; }
+ for (;; meth_name++) {
+ if (need_upper && !isupper(*meth_name)) { return false; }
+ if (need_letter && !isalpha(*meth_name)) { return false; }
need_upper = false;
need_letter = false;
// We've reached NULL-termination without problems, so succeed.
- if (!*macro_sym) { return true; }
+ if (!*meth_name) { return true; }
- if (!isalnum(*macro_sym)) {
- if (*macro_sym != '_') { return false; }
+ if (!isalnum(*meth_name)) {
+ if (*meth_name != '_') { return false; }
need_upper = true;
}
}
@@ -90,25 +89,20 @@ S_validate_macro_sym(const char *macro_sym) {
CFCMethod*
CFCMethod_init(CFCMethod *self, CFCParcel *parcel, const char *exposure,
const char *class_name, const char *class_nickname,
- const char *macro_sym, CFCType *return_type,
+ const char *name, CFCType *return_type,
CFCParamList *param_list, CFCDocuComment *docucomment,
int is_final, int is_abstract) {
- // Validate macro_sym, derive micro_sym.
- if (!S_validate_macro_sym(macro_sym)) {
+ // Validate name.
+ if (!S_validate_meth_name(name)) {
CFCBase_decref((CFCBase*)self);
- CFCUtil_die("Invalid macro_sym: '%s'",
- macro_sym ? macro_sym : "[NULL]");
- }
- char *micro_sym = CFCUtil_strdup(macro_sym);
- for (size_t i = 0; micro_sym[i] != '\0'; i++) {
- micro_sym[i] = tolower(micro_sym[i]);
+ CFCUtil_die("Invalid name: '%s'",
+ name ? name : "[NULL]");
}
- // Super-init and clean up derived micro_sym.
+ // Super-init.
CFCCallable_init((CFCCallable*)self, parcel, exposure, class_name,
- class_nickname, micro_sym, return_type, param_list,
+ class_nickname, name, return_type, param_list,
docucomment);
- FREEMEM(micro_sym);
// Verify that the first element in the arg list is a self.
CFCVariable **args = CFCParamList_get_variables(param_list);
@@ -129,7 +123,6 @@ CFCMethod_init(CFCMethod *self, CFCParcel *parcel, const char *exposure,
}
self->novel_method = NULL;
- self->macro_sym = CFCUtil_strdup(macro_sym);
self->full_override_sym = NULL;
self->host_alias = NULL;
self->is_final = is_final;
@@ -139,7 +132,7 @@ CFCMethod_init(CFCMethod *self, CFCParcel *parcel, const char *exposure,
// Derive name of implementing function.
self->short_imp_func
= CFCUtil_sprintf("%s_%s_IMP", CFCMethod_get_class_nickname(self),
- self->macro_sym);
+ name);
self->imp_func = CFCUtil_sprintf("%s%s", CFCMethod_get_PREFIX(self),
self->short_imp_func);
@@ -158,7 +151,6 @@ CFCMethod_resolve_types(CFCMethod *self) {
void
CFCMethod_destroy(CFCMethod *self) {
CFCBase_decref((CFCBase*)self->novel_method);
- FREEMEM(self->macro_sym);
FREEMEM(self->full_override_sym);
FREEMEM(self->host_alias);
FREEMEM(self->short_imp_func);
@@ -169,7 +161,9 @@ CFCMethod_destroy(CFCMethod *self) {
int
CFCMethod_compatible(CFCMethod *self, CFCMethod *other) {
if (!other) { return false; }
- if (strcmp(self->macro_sym, other->macro_sym)) { return false; }
+ const char *name = CFCMethod_get_name(self);
+ const char *other_name = CFCMethod_get_name(other);
+ if (strcmp(name, other_name)) { return false; }
int my_public = CFCMethod_public(self);
int other_public = CFCMethod_public(other);
if (!!my_public != !!other_public) { return false; }
@@ -194,8 +188,8 @@ CFCMethod_compatible(CFCMethod *self, CFCMethod *other) {
return false;
}
- const char *my_sym = CFCVariable_micro_sym(my_args[i]);
- const char *other_sym = CFCVariable_micro_sym(other_args[i]);
+ const char *my_sym = CFCVariable_get_name(my_args[i]);
+ const char *other_sym = CFCVariable_get_name(other_args[i]);
if (strcmp(my_sym, other_sym) != 0) {
return false;
}
@@ -224,10 +218,11 @@ void
CFCMethod_override(CFCMethod *self, CFCMethod *orig) {
// Check that the override attempt is legal.
if (CFCMethod_final(orig)) {
+ const char *orig_name = CFCMethod_get_name(orig);
const char *orig_class = CFCMethod_get_class_name(orig);
const char *my_class = CFCMethod_get_class_name(self);
CFCUtil_die("Attempt to override final method '%s' from '%s' by '%s'",
- orig->macro_sym, orig_class, my_class);
+ orig_name, orig_class, my_class);
}
if (!CFCMethod_compatible(self, orig)) {
const char *func = CFCMethod_imp_func(self);
@@ -249,9 +244,10 @@ CFCMethod_finalize(CFCMethod *self) {
const char *exposure = CFCMethod_get_exposure(self);
const char *class_name = CFCMethod_get_class_name(self);
const char *class_nickname = CFCMethod_get_class_nickname(self);
+ const char *name = CFCMethod_get_name(self);
CFCMethod *finalized
= CFCMethod_new(parcel, exposure, class_name, class_nickname,
- self->macro_sym, self->callable.return_type,
+ name, self->callable.return_type,
self->callable.param_list,
self->callable.docucomment, true,
self->is_abstract);
@@ -278,13 +274,15 @@ CFCMethod_set_host_alias(CFCMethod *self, const char *alias) {
CFCUtil_die("Missing required param 'alias'");
}
if (!self->is_novel) {
+ const char *name = CFCMethod_get_name(self);
CFCUtil_die("Can't set_host_alias %s -- method %s not novel in %s",
- alias, self->macro_sym, CFCMethod_get_class_name(self));
+ alias, name, CFCMethod_get_class_name(self));
}
if (self->host_alias) {
+ const char *name = CFCMethod_get_name(self);
if (strcmp(self->host_alias, alias) == 0) { return; }
CFCUtil_die("Can't set_host_alias %s -- already set to %s for method"
- " %s in %s", alias, self->host_alias, self->macro_sym,
+ " %s in %s", alias, self->host_alias, name,
CFCMethod_get_class_name(self));
}
self->host_alias = CFCUtil_strdup(alias);
@@ -299,8 +297,9 @@ CFCMethod_get_host_alias(CFCMethod *self) {
void
CFCMethod_exclude_from_host(CFCMethod *self) {
if (!self->is_novel) {
+ const char *name = CFCMethod_get_name(self);
CFCUtil_die("Can't exclude_from_host -- method %s not novel in %s",
- self->macro_sym, CFCMethod_get_class_name(self));
+ name, CFCMethod_get_class_name(self));
}
self->is_excluded = true;
}
@@ -330,7 +329,8 @@ S_short_method_sym(CFCMethod *self, CFCClass *invoker, const char *postfix) {
else {
nickname = CFCMethod_get_class_nickname(self);
}
- return CFCUtil_sprintf("%s_%s%s", nickname, self->macro_sym, postfix);
+ const char *name = CFCMethod_get_name(self);
+ return CFCUtil_sprintf("%s_%s%s", nickname, name, postfix);
}
static char*
@@ -345,8 +345,8 @@ S_full_method_sym(CFCMethod *self, CFCClass *invoker, const char *postfix) {
PREFIX = CFCMethod_get_PREFIX(self);
nickname = CFCMethod_get_class_nickname(self);
}
- return CFCUtil_sprintf("%s%s_%s%s", PREFIX, nickname, self->macro_sym,
- postfix);
+ const char *name = CFCMethod_get_name(self);
+ return CFCUtil_sprintf("%s%s_%s%s", PREFIX, nickname, name, postfix);
}
char*
@@ -365,8 +365,8 @@ CFCMethod_full_offset_sym(CFCMethod *self, CFCClass *invoker) {
}
const char*
-CFCMethod_get_macro_sym(CFCMethod *self) {
- return self->macro_sym;
+CFCMethod_get_name(CFCMethod *self) {
+ return CFCSymbol_get_name((CFCSymbol*)self);
}
char*
@@ -384,9 +384,9 @@ CFCMethod_full_override_sym(CFCMethod *self) {
if (!self->full_override_sym) {
const char *Prefix = CFCMethod_get_Prefix(self);
const char *nickname = CFCMethod_get_class_nickname(self);
+ const char *name = CFCMethod_get_name(self);
self->full_override_sym
- = CFCUtil_sprintf("%s%s_%s_OVERRIDE", Prefix, nickname,
- self->macro_sym);
+ = CFCUtil_sprintf("%s%s_%s_OVERRIDE", Prefix, nickname, name);
}
return self->full_override_sym;
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCMethod.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCMethod.h b/compiler/src/CFCMethod.h
index 3549214..7cbee5e 100644
--- a/compiler/src/CFCMethod.h
+++ b/compiler/src/CFCMethod.h
@@ -45,7 +45,7 @@ struct CFCDocuComment;
* if not supplied.
* @param class_name See Clownfish::CFC::Model::Function.
* @param class_nickname See Clownfish::CFC::Model::Function.
- * @param macro_sym - The mixed case name which will be used when invoking the
+ * @param name - The mixed case name which will be used when invoking the
* method.
* @param return_type See Clownfish::CFC::Model::Function.
* @param param_list - A Clownfish::CFC::Model::ParamList. The first element
@@ -57,7 +57,7 @@ struct CFCDocuComment;
CFCMethod*
CFCMethod_new(struct CFCParcel *parcel, const char *exposure,
const char *class_name, const char *class_nickname,
- const char *macro_sym, struct CFCType *return_type,
+ const char *name, struct CFCType *return_type,
struct CFCParamList *param_list,
struct CFCDocuComment *docucomment, int is_final,
int is_abstract);
@@ -65,7 +65,7 @@ CFCMethod_new(struct CFCParcel *parcel, const char *exposure,
CFCMethod*
CFCMethod_init(CFCMethod *self, struct CFCParcel *parcel,
const char *exposure, const char *class_name,
- const char *class_nickname, const char *macro_sym,
+ const char *class_nickname, const char *name,
struct CFCType *return_type, struct CFCParamList *param_list,
struct CFCDocuComment *docucomment, int is_final,
int is_abstract);
@@ -151,7 +151,7 @@ char*
CFCMethod_full_offset_sym(CFCMethod *self, struct CFCClass *invoker);
const char*
-CFCMethod_get_macro_sym(CFCMethod *self);
+CFCMethod_get_name(CFCMethod *self);
/** Create the typedef symbol for this method, e.g "Claw_Pinch_t".
* @param invoker Class for which the symbol is created. If invoker is NULL,
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCParamList.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCParamList.c b/compiler/src/CFCParamList.c
index 06b5e0e..897a7db 100644
--- a/compiler/src/CFCParamList.c
+++ b/compiler/src/CFCParamList.c
@@ -106,7 +106,7 @@ S_generate_c_strings(CFCParamList *self) {
c_string_size += sizeof(", ");
c_string_size += strlen(CFCVariable_local_c(var));
name_list_size += sizeof(", ");
- name_list_size += strlen(CFCVariable_micro_sym(var));
+ name_list_size += strlen(CFCVariable_get_name(var));
}
if (self->variadic) {
c_string_size += sizeof(", ...");
@@ -123,7 +123,7 @@ S_generate_c_strings(CFCParamList *self) {
for (size_t i = 0; i < self->num_vars; i++) {
CFCVariable *var = self->variables[i];
strcat(self->c_string, CFCVariable_local_c(var));
- strcat(self->name_list, CFCVariable_micro_sym(var));
+ strcat(self->name_list, CFCVariable_get_name(var));
if (i == self->num_vars - 1) {
if (self->variadic) {
strcat(self->c_string, ", ...");
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCPerlClass.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlClass.c b/compiler/src/CFCPerlClass.c
index 7ff21dc..c185249 100644
--- a/compiler/src/CFCPerlClass.c
+++ b/compiler/src/CFCPerlClass.c
@@ -282,13 +282,13 @@ CFCPerlClass_constructor_bindings(CFCClass *klass) {
// Iterate over the list of possible initialization functions.
for (size_t i = 0; functions[i] != NULL; i++) {
CFCFunction *function = functions[i];
- const char *micro_sym = CFCFunction_micro_sym(function);
+ const char *func_name = CFCFunction_get_name(function);
const char *alias = NULL;
// Find user-specified alias.
if (perl_class == NULL) {
// Bind init() to new() when possible.
- if (strcmp(micro_sym, "init") == 0
+ if (strcmp(func_name, "init") == 0
&& CFCFunction_can_be_bound(function)
) {
alias = NEW;
@@ -296,12 +296,12 @@ CFCPerlClass_constructor_bindings(CFCClass *klass) {
}
else {
for (size_t j = 0; j < perl_class->num_cons; j++) {
- if (strcmp(micro_sym, perl_class->cons_inits[j]) == 0) {
+ if (strcmp(func_name, perl_class->cons_inits[j]) == 0) {
alias = perl_class->cons_aliases[j];
if (!CFCFunction_can_be_bound(function)) {
CFCUtil_die("Can't bind %s as %s"
" -- types can't be mapped",
- micro_sym, alias);
+ func_name, alias);
}
break;
}
@@ -310,7 +310,7 @@ CFCPerlClass_constructor_bindings(CFCClass *klass) {
// Automatically bind init() to new() when possible.
if (!alias
&& !perl_class->exclude_cons
- && strcmp(micro_sym, "init") == 0
+ && strcmp(func_name, "init") == 0
&& CFCFunction_can_be_bound(function)
) {
int saw_new = 0;
@@ -331,7 +331,7 @@ CFCPerlClass_constructor_bindings(CFCClass *klass) {
// Create the binding, add it to the array.
CFCPerlConstructor *cons_binding
- = CFCPerlConstructor_new(klass, alias, micro_sym);
+ = CFCPerlConstructor_new(klass, alias, func_name);
size_t size = (num_bound + 2) * sizeof(CFCPerlConstructor*);
bound = (CFCPerlConstructor**)REALLOCATE(bound, size);
bound[num_bound] = cons_binding;
@@ -501,16 +501,16 @@ CFCPerlClass_method_metadata_code(CFCPerlClass *self) {
CFCMethod *method = fresh_methods[i];
if (!CFCMethod_novel(method)) { continue; }
- const char *macro_sym = CFCMethod_get_macro_sym(method);
+ const char *meth_name = CFCMethod_get_name(method);
const char *alias = CFCMethod_get_host_alias(method);
if (alias) {
code = CFCUtil_cat(code, " CFISH_Class_Add_Host_Method_Alias(",
- class_var, ", \"", alias, "\", \"", macro_sym,
+ class_var, ", \"", alias, "\", \"", meth_name,
"\");\n", NULL);
}
if (CFCMethod_excluded_from_host(method)) {
code = CFCUtil_cat(code, " CFISH_Class_Exclude_Host_Method(",
- class_var, ", \"", macro_sym, "\");\n", NULL);
+ class_var, ", \"", meth_name, "\");\n", NULL);
}
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCPerlConstructor.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlConstructor.c b/compiler/src/CFCPerlConstructor.c
index 9f82ab7..a0cc170 100644
--- a/compiler/src/CFCPerlConstructor.c
+++ b/compiler/src/CFCPerlConstructor.c
@@ -65,7 +65,7 @@ CFCPerlConstructor_init(CFCPerlConstructor *self, CFCClass *klass,
CFCFunction **funcs = CFCClass_functions(klass);
for (size_t i = 0; funcs[i] != NULL; i++) {
CFCFunction *func = funcs[i];
- const char *func_name = CFCFunction_micro_sym(func);
+ const char *func_name = CFCFunction_get_name(func);
if (strcmp(initializer, func_name) == 0) {
self->init_func = (CFCFunction*)CFCBase_incref((CFCBase*)func);
break;
@@ -106,7 +106,7 @@ CFCPerlConstructor_xsub_def(CFCPerlConstructor *self) {
CFCVariable *var = arg_vars[i];
CFCType *type = CFCVariable_get_type(var);
if (CFCType_is_object(type) && CFCType_decremented(type)) {
- const char *name = CFCVariable_micro_sym(var);
+ const char *name = CFCVariable_get_name(var);
refcount_mods
= CFCUtil_cat(refcount_mods, "\n CFISH_INCREF(arg_", name,
");", NULL);
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCPerlMethod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlMethod.c b/compiler/src/CFCPerlMethod.c
index 637be28..92e4d2f 100644
--- a/compiler/src/CFCPerlMethod.c
+++ b/compiler/src/CFCPerlMethod.c
@@ -130,7 +130,7 @@ CFCPerlMethod_perl_name(CFCMethod *method) {
}
// Derive Perl name by lowercasing.
- const char *name = CFCMethod_get_macro_sym(method);
+ const char *name = CFCMethod_get_name(method);
char *perl_name = CFCUtil_strdup(name);
for (size_t i = 0; perl_name[i] != '\0'; i++) {
perl_name[i] = tolower(perl_name[i]);
@@ -179,7 +179,7 @@ S_xsub_body(CFCPerlMethod *self) {
CFCType *type = CFCVariable_get_type(var);
if (CFCType_is_object(type) && CFCType_decremented(type)) {
body = CFCUtil_cat(body, "CFISH_INCREF(arg_",
- CFCVariable_micro_sym(var), ");\n ", NULL);
+ CFCVariable_get_name(var), ");\n ", NULL);
}
}
@@ -238,8 +238,8 @@ S_xsub_def_labeled_params(CFCPerlMethod *self) {
CFCVariable *self_var = arg_vars[0];
CFCType *self_type = CFCVariable_get_type(self_var);
CFCType *return_type = CFCMethod_get_return_type(method);
- const char *self_type_c = CFCType_to_c(self_type);
- const char *self_micro_sym = CFCVariable_micro_sym(self_var);
+ const char *self_type_c = CFCType_to_c(self_type);
+ const char *self_name = CFCVariable_get_name(self_var);
char *arg_decls = CFCPerlSub_arg_declarations((CFCPerlSub*)self);
char *meth_type_c = CFCMethod_full_typedef(method, NULL);
char *self_assign = S_self_assign_statement(self, self_type);
@@ -278,7 +278,7 @@ S_xsub_def_labeled_params(CFCPerlMethod *self) {
"}\n";
char *xsub_def
= CFCUtil_sprintf(pattern, c_name, c_name, self_type_c, arg_decls,
- meth_type_c, retval_decl, self_micro_sym,
+ meth_type_c, retval_decl, self_name,
allot_params, self_assign, body);
FREEMEM(arg_decls);
@@ -314,10 +314,10 @@ S_xsub_def_positional_args(CFCPerlMethod *self) {
}
}
char *xs_name_list = num_vars > 0
- ? CFCUtil_strdup(CFCVariable_micro_sym(arg_vars[0]))
+ ? CFCUtil_strdup(CFCVariable_get_name(arg_vars[0]))
: CFCUtil_strdup("");
for (unsigned i = 1; i < num_vars; i++) {
- const char *var_name = CFCVariable_micro_sym(arg_vars[i]);
+ const char *var_name = CFCVariable_get_name(arg_vars[i]);
if (i < min_required) {
xs_name_list = CFCUtil_cat(xs_name_list, ", ", var_name, NULL);
}
@@ -343,7 +343,7 @@ S_xsub_def_positional_args(CFCPerlMethod *self) {
for (unsigned i = 1; i < num_vars; i++) {
CFCVariable *var = arg_vars[i];
const char *val = arg_inits[i];
- const char *var_name = CFCVariable_micro_sym(var);
+ const char *var_name = CFCVariable_get_name(var);
CFCType *var_type = CFCVariable_get_type(var);
const char *type_c = CFCType_to_c(var_type);
@@ -493,7 +493,7 @@ S_callback_start(CFCMethod *method) {
CFCVariable **arg_vars = CFCParamList_get_variables(param_list);
for (int i = 1; arg_vars[i] != NULL; i++) {
CFCVariable *var = arg_vars[i];
- const char *name = CFCVariable_micro_sym(var);
+ const char *name = CFCVariable_get_name(var);
CFCType *type = CFCVariable_get_type(var);
const char *c_type = CFCType_to_c(type);
@@ -572,7 +572,7 @@ S_callback_refcount_mods(CFCMethod *method) {
for (int i = 0; arg_vars[i] != NULL; i++) {
CFCVariable *var = arg_vars[i];
CFCType *type = CFCVariable_get_type(var);
- const char *name = CFCVariable_micro_sym(var);
+ const char *name = CFCVariable_get_name(var);
if (!CFCType_is_object(type)) {
continue;
}
@@ -595,7 +595,7 @@ S_invalid_callback_body(CFCMethod *method) {
CFCVariable **param_vars = CFCParamList_get_variables(param_list);
char *unused = CFCUtil_strdup("");
for (int i = 0; param_vars[i] != NULL; i++) {
- const char *name = CFCVariable_micro_sym(param_vars[i]);
+ const char *name = CFCVariable_get_name(param_vars[i]);
unused = CFCUtil_cat(unused, " CFISH_UNUSED_VAR(", name, ");\n",
NULL);
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCPerlPod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlPod.c b/compiler/src/CFCPerlPod.c
index 17e6a43..a192987 100644
--- a/compiler/src/CFCPerlPod.c
+++ b/compiler/src/CFCPerlPod.c
@@ -249,11 +249,11 @@ CFCPerlPod_gen_subroutine_pod(CFCPerlPod *self, CFCFunction *func,
// Get documentation, which may be inherited.
CFCDocuComment *docucomment = CFCFunction_get_docucomment(func);
if (!docucomment) {
- const char *micro_sym = CFCFunction_micro_sym(func);
+ const char *func_name = CFCFunction_get_name(func);
CFCClass *parent = klass;
while (NULL != (parent = CFCClass_get_parent(parent))) {
CFCFunction *parent_func
- = (CFCFunction*)CFCClass_method(parent, micro_sym);
+ = (CFCFunction*)CFCClass_method(parent, func_name);
if (!parent_func) { break; }
docucomment = CFCFunction_get_docucomment(parent_func);
if (docucomment) { break; }
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCPerlSub.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlSub.c b/compiler/src/CFCPerlSub.c
index 32e4720..588e569 100644
--- a/compiler/src/CFCPerlSub.c
+++ b/compiler/src/CFCPerlSub.c
@@ -93,7 +93,7 @@ CFCPerlSub_params_hash_def(CFCPerlSub *self) {
for (int i = 1; arg_vars[i] != NULL; i++) {
CFCVariable *var = arg_vars[i];
- const char *micro_sym = CFCVariable_micro_sym(var);
+ const char *var_name = CFCVariable_get_name(var);
const char *val = vals[i];
val = val == NULL
? "undef"
@@ -104,7 +104,7 @@ CFCPerlSub_params_hash_def(CFCPerlSub *self) {
: strcmp(val, "false") == 0
? "0"
: val;
- def = CFCUtil_cat(def, "\n ", micro_sym, " => ", val, ",", NULL);
+ def = CFCUtil_cat(def, "\n ", var_name, " => ", val, ",", NULL);
}
def = CFCUtil_cat(def, "\n);\n", NULL);
@@ -190,7 +190,7 @@ CFCPerlSub_arg_declarations(CFCPerlSub *self) {
CFCVariable *arg_var = arg_vars[i];
CFCType *type = CFCVariable_get_type(arg_var);
const char *type_str = CFCType_to_c(type);
- const char *var_name = CFCVariable_micro_sym(arg_var);
+ const char *var_name = CFCVariable_get_name(arg_var);
decls = CFCUtil_cat(decls, " ", type_str, " arg_", var_name,
";\n", NULL);
}
@@ -206,7 +206,7 @@ CFCPerlSub_arg_name_list(CFCPerlSub *self) {
char *name_list = CFCUtil_strdup("arg_self");
for (size_t i = 1; i < num_vars; i++) {
- const char *var_name = CFCVariable_micro_sym(arg_vars[i]);
+ const char *var_name = CFCVariable_get_name(arg_vars[i]);
name_list = CFCUtil_cat(name_list, ", arg_", var_name, NULL);
}
@@ -225,7 +225,7 @@ CFCPerlSub_build_allot_params(CFCPerlSub *self) {
for (size_t i = 1; i < num_vars; i++) {
CFCVariable *arg_var = arg_vars[i];
const char *val = arg_inits[i];
- const char *var_name = CFCVariable_micro_sym(arg_var);
+ const char *var_name = CFCVariable_get_name(arg_var);
if (val == NULL) {
CFCType *arg_type = CFCVariable_get_type(arg_var);
val = CFCType_is_object(arg_type)
@@ -245,7 +245,7 @@ CFCPerlSub_build_allot_params(CFCPerlSub *self) {
CFCVariable *var = arg_vars[i];
const char *val = arg_inits[i];
int required = val ? 0 : 1;
- const char *name = CFCVariable_micro_sym(var);
+ const char *name = CFCVariable_get_name(var);
CFCType *type = CFCVariable_get_type(var);
char *arg = S_allot_params_arg(type, name, required);
allot_params
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCSymbol.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCSymbol.c b/compiler/src/CFCSymbol.c
index 20d06a3..ddf5d62 100644
--- a/compiler/src/CFCSymbol.c
+++ b/compiler/src/CFCSymbol.c
@@ -36,10 +36,10 @@ static const CFCMeta CFCSYMBOL_META = {
CFCSymbol*
CFCSymbol_new(struct CFCParcel *parcel, const char *exposure,
const char *class_name, const char *class_nickname,
- const char *micro_sym) {
+ const char *name) {
CFCSymbol *self = (CFCSymbol*)CFCBase_allocate(&CFCSYMBOL_META);
return CFCSymbol_init(self, parcel, exposure, class_name, class_nickname,
- micro_sym);
+ name);
}
static int
@@ -122,7 +122,7 @@ S_validate_identifier(const char *identifier) {
CFCSymbol*
CFCSymbol_init(CFCSymbol *self, struct CFCParcel *parcel,
const char *exposure, const char *class_name,
- const char *class_nickname, const char *micro_sym) {
+ const char *class_nickname, const char *name) {
// Validate.
CFCUTIL_NULL_CHECK(parcel);
if (!S_validate_exposure(exposure)) {
@@ -133,9 +133,9 @@ CFCSymbol_init(CFCSymbol *self, struct CFCParcel *parcel,
CFCBase_decref((CFCBase*)self);
CFCUtil_die("Invalid class_name: '%s'", class_name);
}
- if (!micro_sym || !S_validate_identifier(micro_sym)) {
+ if (!name || !S_validate_identifier(name)) {
CFCBase_decref((CFCBase*)self);
- CFCUtil_die("Invalid micro_sym: '%s'", micro_sym ? micro_sym : "[NULL]");
+ CFCUtil_die("Invalid name: '%s'", name ? name : "[NULL]");
}
// Derive class_nickname if necessary, then validate.
@@ -167,11 +167,11 @@ CFCSymbol_init(CFCSymbol *self, struct CFCParcel *parcel,
self->exposure = CFCUtil_strdup(exposure);
self->class_name = CFCUtil_strdup(class_name);
self->class_nickname = CFCUtil_strdup(real_nickname);
- self->micro_sym = CFCUtil_strdup(micro_sym);
+ self->name = CFCUtil_strdup(name);
// Derive short_sym and full_sym.
char *nickname = self->class_nickname ? self->class_nickname : "";
- self->short_sym = CFCUtil_sprintf("%s_%s", nickname, micro_sym);
+ self->short_sym = CFCUtil_sprintf("%s_%s", nickname, name);
self->full_sym
= CFCUtil_sprintf("%s%s", CFCParcel_get_prefix(self->parcel),
self->short_sym);
@@ -185,7 +185,7 @@ CFCSymbol_destroy(CFCSymbol *self) {
FREEMEM(self->exposure);
FREEMEM(self->class_name);
FREEMEM(self->class_nickname);
- FREEMEM(self->micro_sym);
+ FREEMEM(self->name);
FREEMEM(self->short_sym);
FREEMEM(self->full_sym);
CFCBase_destroy((CFCBase*)self);
@@ -193,7 +193,7 @@ CFCSymbol_destroy(CFCSymbol *self) {
int
CFCSymbol_equals(CFCSymbol *self, CFCSymbol *other) {
- if (strcmp(self->micro_sym, other->micro_sym) != 0) { return false; }
+ if (strcmp(self->name, other->name) != 0) { return false; }
if (!CFCParcel_equals(self->parcel, other->parcel)) { return false; }
if (strcmp(self->exposure, other->exposure) != 0) { return false; }
if (self->class_name) {
@@ -259,8 +259,8 @@ CFCSymbol_get_exposure(CFCSymbol *self) {
}
const char*
-CFCSymbol_micro_sym(CFCSymbol *self) {
- return self->micro_sym;
+CFCSymbol_get_name(CFCSymbol *self) {
+ return self->name;
}
const char*
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCSymbol.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCSymbol.h b/compiler/src/CFCSymbol.h
index 98cdc83..c47b405 100644
--- a/compiler/src/CFCSymbol.h
+++ b/compiler/src/CFCSymbol.h
@@ -40,7 +40,7 @@ struct CFCSymbol {
char *exposure;
char *class_name;
char *class_nickname;
- char *micro_sym;
+ char *name;
char *short_sym;
char *full_sym;
};
@@ -64,17 +64,17 @@ CFCSymbol_validate_class_name_component(const char *name);
* @param class_nickname The C nickname associated with the supplied class
* name. If not supplied, will be derived if possible from C<class_name> by
* extracting the last class name component.
- * @param micro_sym The local identifier for the symbol.
+ * @param name The local identifier for the symbol.
*/
CFCSymbol*
CFCSymbol_new(struct CFCParcel *parcel, const char *exposure,
const char *class_name, const char *class_nickname,
- const char *micro_sym);
+ const char *name);
CFCSymbol*
CFCSymbol_init(CFCSymbol *self, struct CFCParcel *parcel, const char *exposure,
const char *class_name, const char *class_nickname,
- const char *micro_sym);
+ const char *name);
void
CFCSymbol_destroy(CFCSymbol *self);
@@ -118,10 +118,10 @@ CFCSymbol_private(CFCSymbol *self);
int
CFCSymbol_local(CFCSymbol *self);
-/** Accessor for the Symbol's micro_sym.
+/** Accessor for the Symbol's name.
*/
const char*
-CFCSymbol_micro_sym(CFCSymbol *self);
+CFCSymbol_get_name(CFCSymbol *self);
/** Returns the C representation for the symbol minus the parcel's prefix,
* e.g. "Lobster_average_lifespan".
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCTestClass.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTestClass.c b/compiler/src/CFCTestClass.c
index 2342d03..a35399e 100644
--- a/compiler/src/CFCTestClass.c
+++ b/compiler/src/CFCTestClass.c
@@ -40,7 +40,7 @@ static void
S_run_tests(CFCTest *test);
static int
-S_has_symbol(CFCSymbol **symbols, const char *micro_sym);
+S_has_symbol(CFCSymbol **symbols, const char *name);
const CFCTestBatch CFCTEST_BATCH_CLASS = {
"Clownfish::CFC::Model::Class",
@@ -281,13 +281,13 @@ S_run_tests(CFCTest *test) {
OK(test, S_has_symbol(member_vars, "mom"), "parsed member var");
OK(test, S_has_symbol(member_vars, "squishy"), "parsed member var");
OK(test, S_has_symbol(functions, "init"), "parsed function");
- OK(test, S_has_symbol(methods, "destroy"), "parsed parcel method");
- OK(test, S_has_symbol(methods, "bury"), "parsed public method");
- OK(test, S_has_symbol(methods, "scratch"),
+ OK(test, S_has_symbol(methods, "Destroy"), "parsed parcel method");
+ OK(test, S_has_symbol(methods, "Bury"), "parsed public method");
+ OK(test, S_has_symbol(methods, "Scratch"),
"parsed public abstract nullable method");
- CFCMethod *scratch = CFCClass_fresh_method(klass, "scratch");
- OK(test, scratch != NULL, "find method 'scratch'");
+ CFCMethod *scratch = CFCClass_fresh_method(klass, "Scratch");
+ OK(test, scratch != NULL, "find method 'Scratch'");
OK(test, CFCType_nullable(CFCMethod_get_return_type(scratch)),
"public abstract incremented nullable flagged as nullable");
@@ -342,9 +342,9 @@ S_run_tests(CFCTest *test) {
}
static int
-S_has_symbol(CFCSymbol **symbols, const char *micro_sym) {
+S_has_symbol(CFCSymbol **symbols, const char *name) {
for (int i = 0; symbols[i]; ++i) {
- if (strcmp(CFCSymbol_micro_sym(symbols[i]), micro_sym) == 0) {
+ if (strcmp(CFCSymbol_get_name(symbols[i]), name) == 0) {
return 1;
}
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/50575077/compiler/src/CFCTestMethod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCTestMethod.c b/compiler/src/CFCTestMethod.c
index 5cf0df2..43be233 100644
--- a/compiler/src/CFCTestMethod.c
+++ b/compiler/src/CFCTestMethod.c
@@ -82,14 +82,14 @@ S_run_basic_tests(CFCTest *test) {
}
{
- CFCMethod *macro_sym_differs
+ CFCMethod *name_differs
= CFCMethod_new(neato_parcel, NULL, "Neato::Foo", "Foo", "Eat",
return_type, param_list, NULL, 0, 0);
- OK(test, !CFCMethod_compatible(method, macro_sym_differs),
- "different macro_sym spoils compatible");
- OK(test, !CFCMethod_compatible(macro_sym_differs, method),
+ OK(test, !CFCMethod_compatible(method, name_differs),
+ "different name spoils compatible");
+ OK(test, !CFCMethod_compatible(name_differs, method),
"... reversed");
- CFCBase_decref((CFCBase*)macro_sym_differs);
+ CFCBase_decref((CFCBase*)name_differs);
}
{