Allow Clownfish URIs without "cfish:" scheme
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/c0f9515f Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/c0f9515f Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/c0f9515f Branch: refs/heads/master Commit: c0f9515f9ab91c8ad0ccd558e549e0e7841538f1 Parents: 520a87e Author: Nick Wellnhofer <[email protected]> Authored: Sun Jul 26 19:58:32 2015 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Thu Aug 6 18:19:19 2015 +0200 ---------------------------------------------------------------------- compiler/src/CFCBindCore.c | 2 +- compiler/src/CFCUri.c | 12 ++++++------ runtime/core/Clownfish/CharBuf.cfh | 4 ++-- runtime/core/Clownfish/Class.cfh | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/c0f9515f/compiler/src/CFCBindCore.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCBindCore.c b/compiler/src/CFCBindCore.c index 5c8eae2..e5b23ce 100644 --- a/compiler/src/CFCBindCore.c +++ b/compiler/src/CFCBindCore.c @@ -239,7 +239,7 @@ S_write_parcel_h(CFCBindCore *self, CFCParcel *parcel) { "(*cfish_destroy_t)(void *vself);\n" "extern CFISH_VISIBLE uint32_t CFISH_Obj_Destroy_OFFSET;\n" "\n" - "/** Invoke the [](cfish:.Destroy) method found in `klass` on\n" + "/** Invoke the [](.Destroy) method found in `klass` on\n" " * `self`.\n" " *\n" " * TODO: Eliminate this function if we can arrive at a proper SUPER syntax.\n" http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/c0f9515f/compiler/src/CFCUri.c ---------------------------------------------------------------------- diff --git a/compiler/src/CFCUri.c b/compiler/src/CFCUri.c index 8c7c555..2a7cd5d 100644 --- a/compiler/src/CFCUri.c +++ b/compiler/src/CFCUri.c @@ -57,7 +57,7 @@ S_next_component(char **iter); int CFCUri_is_clownfish_uri(const char *uri) { - return strncmp(uri, "cfish:", 6) == 0; + return strncmp(uri, "cfish:", 6) == 0 || !strchr(uri, ':'); } CFCUri* @@ -70,10 +70,6 @@ CFCUri* CFCUri_init(CFCUri *self, const char *uri, CFCClass *doc_class) { CFCUTIL_NULL_CHECK(uri); - if (strncmp(uri, "cfish:", 6) != 0) { - CFCUtil_die("Invalid clownfish URI: %s", uri); - } - self->string = CFCUtil_strdup(uri); self->doc_class = (CFCClass*)CFCBase_incref((CFCBase*)doc_class); @@ -93,7 +89,11 @@ CFCUri_destroy(CFCUri *self) { static void S_parse(CFCUri *self) { - const char *uri_part = self->string + sizeof("cfish:") - 1; + const char *uri_part = self->string; + + if (strncmp(uri_part, "cfish:", 6) == 0) { + uri_part += 6; + } if (strcmp(uri_part, "@null") == 0) { self->type = CFC_URI_NULL; http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/c0f9515f/runtime/core/Clownfish/CharBuf.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/CharBuf.cfh b/runtime/core/Clownfish/CharBuf.cfh index 6e7cc56..788c0d4 100644 --- a/runtime/core/Clownfish/CharBuf.cfh +++ b/runtime/core/Clownfish/CharBuf.cfh @@ -92,7 +92,7 @@ final class Clownfish::CharBuf nickname CB * hex: %x32 * * Note that all Clownfish Objects, including CharBufs, are printed via - * %o (which invokes [](cfish:Obj.To_String)). + * %o (which invokes [](Obj.To_String)). */ void VCatF(CharBuf *self, const char *pattern, va_list args); @@ -143,7 +143,7 @@ final class Clownfish::CharBuf nickname CB To_String(CharBuf *self); /** Return the content of the CharBuf as String and clear the CharBuf. - * This is more efficient than [](cfish:.To_String). + * This is more efficient than [](.To_String). */ public incremented String* Yield_String(CharBuf *self); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/c0f9515f/runtime/core/Clownfish/Class.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Class.cfh b/runtime/core/Clownfish/Class.cfh index c32d316..ab08415 100644 --- a/runtime/core/Clownfish/Class.cfh +++ b/runtime/core/Clownfish/Class.cfh @@ -48,7 +48,7 @@ final class Clownfish::Class inherits Clownfish::Obj { * will be created using [parent] as a base. * * If [parent] is NULL, an attempt will be made to find it using - * [](cfish:.find_parent_class). If the attempt fails, an error will + * [](.find_parent_class). If the attempt fails, an error will * result. */ inert Class*
