You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2014/04/27 01:11:39 UTC
[lucy-commits] [09/54] [abbrv] Remove bundled Clownfish.
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/compiler/src/CFCType.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCType.h b/clownfish/compiler/src/CFCType.h
deleted file mode 100644
index fbf18e7..0000000
--- a/clownfish/compiler/src/CFCType.h
+++ /dev/null
@@ -1,281 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** Clownfish::CFC::Model::Type - A variable's type.
- */
-
-#ifndef H_CFCTYPE
-#define H_CFCTYPE
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct CFCType CFCType;
-struct CFCClass;
-struct CFCParcel;
-
-#define CFCTYPE_CONST 0x00000001
-#define CFCTYPE_NULLABLE 0x00000002
-#define CFCTYPE_VOID 0x00000004
-#define CFCTYPE_INCREMENTED 0x00000008
-#define CFCTYPE_DECREMENTED 0x00000010
-#define CFCTYPE_OBJECT 0x00000020
-#define CFCTYPE_PRIMITIVE 0x00000040
-#define CFCTYPE_INTEGER 0x00000080
-#define CFCTYPE_FLOATING 0x00000100
-#define CFCTYPE_STRING_TYPE 0x00000200
-#define CFCTYPE_VA_LIST 0x00000400
-#define CFCTYPE_ARBITRARY 0x00000800
-#define CFCTYPE_COMPOSITE 0x00001000
-
-/** Generic constructor.
- *
- * @param flags Flags which apply to the Type. Supplying incompatible flags
- * will trigger an error.
- * @param parcel A Clownfish::CFC::Model::Parcel.
- * @param specifier The C name for the type, not including any indirection or
- * array subscripts.
- * @param indirection integer indicating level of indirection. Example: the C
- * type "float**" has a specifier of "float" and indirection 2.
- */
-CFCType*
-CFCType_new(int flags, struct CFCParcel *parcel, const char *specifier,
- int indirection);
-
-CFCType*
-CFCType_init(CFCType *self, int flags, struct CFCParcel *parcel,
- const char *specifier, int indirection);
-
-/** Return a Type representing an integer primitive.
- *
- * Support is limited to a subset of the standard C integer types:
- *
- * int8_t
- * int16_t
- * int32_t
- * int64_t
- * uint8_t
- * uint16_t
- * uint32_t
- * uint64_t
- * char
- * short
- * int
- * long
- * size_t
- *
- * Many others are not supported: "signed" or "unsigned" anything, "long
- * long", "ptrdiff_t", "off_t", etc.
- *
- * The following Charmonizer typedefs are supported:
- *
- * bool
- *
- * @param flags Allowed flags: CONST, INTEGER, PRIMITIVE.
- * @param specifier Must match one of the supported types.
- */
-CFCType*
-CFCType_new_integer(int flags, const char *specifier);
-
-/** Return a Type representing a floating point primitive.
- *
- * @param flags Allowed flags: CONST, FLOATING, PRIMITIVE.
- * @param specifier Must be either 'float' or 'double'.
- */
-CFCType*
-CFCType_new_float(int flags, const char *specifier);
-
-/** Create a Type representing an object.
- *
- * The supplied <code>specifier</code> must match the last component of the
- * class name -- i.e. for the class "Crustacean::Lobster" it must be
- * "Lobster".
- *
- * The Parcel's prefix will be prepended to the specifier by new_object().
- *
- * @param flags Allowed flags: OBJECT, STRING_TYPE, CONST, NULLABLE,
- * INCREMENTED, DECREMENTED.
- * @param parcel A Clownfish::CFC::Model::Parcel.
- * @param specifier Required. Must follow the rules for
- * Clownfish::CFC::Model::Class class name components.
- * @param indirection Level of indirection. Must be 1 if supplied.
- */
-CFCType*
-CFCType_new_object(int flags, struct CFCParcel *parcel, const char *specifier,
- int indirection);
-
-/** Constructor for a composite type which is made up of repetitions of a
- * single, uniform subtype.
- *
- * @param flags Allowed flags: COMPOSITE, NULLABLE
- * @param child The Clownfish::CFC::Model::Type which the composite is
- * comprised of.
- * @param indirection integer indicating level of indirection. Example: the C
- * type "float**" has indirection 2.
- * @param array A string describing an array postfix.
- */
-CFCType*
-CFCType_new_composite(int flags, CFCType *child, int indirection,
- const char *array);
-
-/** Return a Clownfish::CFC::Model::Type representing a the 'void' keyword in
- * C. It can be used either for a void return type, or in conjuction with
- * with new_composite() to support the <code>void*</code> opaque pointer type.
- *
- * @param is_const Should be true if the type is const. (Useful in the
- * context of <code>const void*</code>).
- */
-CFCType*
-CFCType_new_void(int is_const);
-
-/** Create a Type representing C's va_list, from stdarg.h.
- */
-CFCType*
-CFCType_new_va_list(void);
-
-/** "Arbitrary" types are a hack that spares us from having to support C types
- * with complex declaration syntaxes -- such as unions, structs, enums, or
- * function pointers -- from within Clownfish itself.
- *
- * The only constraint is that the <code>specifier</code> must end in "_t".
- * This allows us to create complex types in a C header file...
- *
- * typedef union { float f; int i; } floatint_t;
- *
- * ... pound-include the C header, then use the resulting typedef in a
- * Clownfish header file and have it parse as an "arbitrary" type.
- *
- * floatint_t floatint;
- *
- * If <code>parcel</code> is supplied and <code>specifier</code> begins with a
- * capital letter, the Parcel's prefix will be prepended to the specifier:
- *
- * foo_t -> foo_t # no prefix prepending
- * Lobster_foo_t -> crust_Lobster_foo_t # prefix prepended
- *
- * @param specifier The name of the type, which must end in "_t".
- * @param parcel A Clownfish::CFC::Model::Parcel.
- */
-CFCType*
-CFCType_new_arbitrary(struct CFCParcel *parcel, const char *specifier);
-
-/** Find the actual class of an object variable without prefix.
- */
-void
-CFCType_resolve(CFCType *self, struct CFCClass **classes);
-
-void
-CFCType_destroy(CFCType *self);
-
-/** Returns true if two Clownfish::CFC::Model::Type objects are equivalent.
- */
-int
-CFCType_equals(CFCType *self, CFCType *other);
-
-/** Weak checking of type which allows for covariant return types. Calling
- * this method on anything other than an object type is an error.
- */
-int
-CFCType_similar(CFCType *self, CFCType *other);
-
-void
-CFCType_set_specifier(CFCType *self, const char *specifier);
-
-const char*
-CFCType_get_specifier(CFCType *self);
-
-/** Return the name of the VTable variable which corresponds to the object
- * type. Returns NULL for non-object types.
- */
-const char*
-CFCType_get_vtable_var(CFCType *self);
-
-int
-CFCType_get_indirection(CFCType *self);
-
-/* Return the parcel in which the Type is used. Note that for class types,
- * this is not neccessarily the parcel where class is defined.
- */
-struct CFCParcel*
-CFCType_get_parcel(CFCType *self);
-
-/** Return the C representation of the type.
- */
-const char*
-CFCType_to_c(CFCType *self);
-
-size_t
-CFCType_get_width(CFCType *self);
-
-const char*
-CFCType_get_array(CFCType *self);
-
-int
-CFCType_const(CFCType *self);
-
-void
-CFCType_set_nullable(CFCType *self, int nullable);
-
-int
-CFCType_nullable(CFCType *self);
-
-/** Returns true if the Type is incremented. Only applicable to object Types.
- */
-int
-CFCType_incremented(CFCType *self);
-
-/** Returns true if the Type is decremented. Only applicable to object Types.
- */
-int
-CFCType_decremented(CFCType *self);
-
-int
-CFCType_is_void(CFCType *self);
-
-int
-CFCType_is_object(CFCType *self);
-
-int
-CFCType_is_primitive(CFCType *self);
-
-int
-CFCType_is_integer(CFCType *self);
-
-int
-CFCType_is_floating(CFCType *self);
-
-/** Returns true if $type represents a Clownfish type which holds unicode
- * strings.
- */
-int
-CFCType_is_string_type(CFCType *self);
-
-int
-CFCType_is_va_list(CFCType *self);
-
-int
-CFCType_is_arbitrary(CFCType *self);
-
-int
-CFCType_is_composite(CFCType *self);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* H_CFCTYPE */
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/compiler/src/CFCUtil.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCUtil.c b/clownfish/compiler/src/CFCUtil.c
deleted file mode 100644
index 7d8f7a5..0000000
--- a/clownfish/compiler/src/CFCUtil.c
+++ /dev/null
@@ -1,539 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "charmony.h"
-
-#include <string.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <errno.h>
-#include <sys/stat.h>
-
-// For mkdir.
-#ifdef CHY_HAS_DIRECT_H
- #include <direct.h>
-#endif
-
-#ifndef true
- #define true 1
- #define false 0
-#endif
-
-#include "CFCUtil.h"
-
-void
-CFCUtil_null_check(const void *arg, const char *name, const char *file,
- int line) {
- if (!arg) {
- CFCUtil_die("%s cannot be NULL at %s line %d", name, file, line);
- }
-}
-
-char*
-CFCUtil_strdup(const char *string) {
- if (!string) { return NULL; }
- return CFCUtil_strndup(string, strlen(string));
-}
-
-char*
-CFCUtil_strndup(const char *string, size_t len) {
- if (!string) { return NULL; }
- char *copy = (char*)MALLOCATE(len + 1);
- memcpy(copy, string, len);
- copy[len] = '\0';
- return copy;
-}
-
-#if defined(CHY_HAS_C99_SNPRINTF) || defined(CHY_HAS__SCPRINTF)
-
-char*
-CFCUtil_sprintf(const char *fmt, ...) {
- va_list args;
-
- va_start(args, fmt);
-#if defined(CHY_HAS_C99_SNPRINTF)
- int size = vsnprintf(NULL, 0, fmt, args);
- if (size < 0) { CFCUtil_die("snprintf failed"); }
-#else
- int size = _vscprintf(fmt, args);
- if (size < 0) { CFCUtil_die("_scprintf failed"); }
-#endif
- va_end(args);
-
- char *string = (char*)MALLOCATE((size_t)size + 1);
- va_start(args, fmt);
- vsprintf(string, fmt, args);
- va_end(args);
-
- return string;
-}
-
-#elif defined(CHY_HAS__SNPRINTF)
-
-char*
-CFCUtil_sprintf(const char *fmt, ...) {
- for (size_t size = 32; size * 2 > size; size *= 2) {
- char *string = (char*)MALLOCATE(size);
- va_list args;
- va_start(args, fmt);
- int result = _vsnprintf(string, size, fmt, args);
- va_end(args);
- if (result >= 0 && (size_t)result < size) { return string; }
- FREEMEM(string);
- }
- CFCUtil_die("_snprintf failed");
- return NULL;
-}
-
-#else
- #error "snprintf or replacement not available."
-#endif
-
-char*
-CFCUtil_cat(char *string, ...) {
- va_list args;
- char *appended;
- CFCUTIL_NULL_CHECK(string);
- size_t size = strlen(string) + 1;
- va_start(args, string);
- while (NULL != (appended = va_arg(args, char*))) {
- size += strlen(appended);
- string = (char*)REALLOCATE(string, size);
- strcat(string, appended);
- }
- va_end(args);
- return string;
-}
-
-void
-CFCUtil_trim_whitespace(char *text) {
- if (!text) {
- return;
- }
-
- // Find start.
- char *ptr = text;
- while (*ptr != '\0' && isspace(*ptr)) { ptr++; }
-
- // Find end.
- size_t orig_len = strlen(text);
- char *limit = text + orig_len;
- for (; limit > text; limit--) {
- if (!isspace(*(limit - 1))) { break; }
- }
-
- // Modify string in place and NULL-terminate.
- while (ptr < limit) {
- *text++ = *ptr++;
- }
- *text = '\0';
-}
-
-void*
-CFCUtil_wrapped_malloc(size_t count, const char *file, int line) {
- void *pointer = malloc(count);
- if (pointer == NULL && count != 0) {
- if (sizeof(long) >= sizeof(size_t)) {
- fprintf(stderr, "Can't malloc %lu bytes at %s line %d\n",
- (unsigned long)count, file, line);
- }
- else {
- fprintf(stderr, "malloc failed at %s line %d\n", file, line);
- }
- exit(1);
- }
- return pointer;
-}
-
-void*
-CFCUtil_wrapped_calloc(size_t count, size_t size, const char *file, int line) {
- void *pointer = calloc(count, size);
- if (pointer == NULL && count != 0) {
- if (sizeof(long) >= sizeof(size_t)) {
- fprintf(stderr,
- "Can't calloc %lu elements of size %lu at %s line %d\n",
- (unsigned long)count, (unsigned long)size, file, line);
- }
- else {
- fprintf(stderr, "calloc failed at %s line %d\n", file, line);
- }
- exit(1);
- }
- return pointer;
-}
-
-void*
-CFCUtil_wrapped_realloc(void *ptr, size_t size, const char *file, int line) {
- void *pointer = realloc(ptr, size);
- if (pointer == NULL && size != 0) {
- if (sizeof(long) >= sizeof(size_t)) {
- fprintf(stderr, "Can't realloc %lu bytes at %s line %d\n",
- (unsigned long)size, file, line);
- }
- else {
- fprintf(stderr, "realloc failed at %s line %d\n", file, line);
- }
- exit(1);
- }
- return pointer;
-}
-
-void
-CFCUtil_wrapped_free(void *ptr) {
- free(ptr);
-}
-
-int
-CFCUtil_current(const char *orig, const char *dest) {
- // If the destination file doesn't exist, we're not current.
- struct stat dest_stat;
- if (stat(dest, &dest_stat) == -1) {
- return false;
- }
-
- // If the source file is newer than the dest, we're not current.
- struct stat orig_stat;
- if (stat(orig, &orig_stat) == -1) {
- CFCUtil_die("Missing source file '%s'", orig);
- }
- if (orig_stat.st_mtime > dest_stat.st_mtime) {
- return false;
- }
-
- // Current!
- return 1;
-}
-
-void
-CFCUtil_write_file(const char *filename, const char *content, size_t len) {
- FILE *fh = fopen(filename, "w+");
- if (fh == NULL) {
- CFCUtil_die("Couldn't open '%s': %s", filename, strerror(errno));
- }
- fwrite(content, sizeof(char), len, fh);
- if (fclose(fh)) {
- CFCUtil_die("Error when closing '%s': %s", filename, strerror(errno));
- }
-}
-
-char*
-CFCUtil_slurp_text(const char *file_path, size_t *len_ptr) {
- FILE *const file = fopen(file_path, "r");
- char *contents;
- size_t binary_len;
- long text_len;
-
- /* Sanity check. */
- if (file == NULL) {
- CFCUtil_die("Error opening file '%s': %s", file_path, strerror(errno));
- }
-
- /* Find length; return NULL if the file has a zero-length. */
- binary_len = CFCUtil_flength(file);
- if (binary_len == 0) {
- *len_ptr = 0;
- return NULL;
- }
-
- /* Allocate memory and read the file. */
- contents = (char*)MALLOCATE(binary_len * sizeof(char) + 1);
- text_len = fread(contents, sizeof(char), binary_len, file);
-
- /* Weak error check, because CRLF might result in fewer chars read. */
- if (text_len <= 0) {
- CFCUtil_die("Tried to read %ld bytes of '%s', got return code %ld",
- (long)binary_len, file_path, (long)text_len);
- }
-
- /* NULL-terminate. */
- contents[text_len] = '\0';
-
- /* Set length pointer for benefit of caller. */
- *len_ptr = text_len;
-
- /* Clean up. */
- if (fclose(file)) {
- CFCUtil_die("Error closing file '%s': %s", file_path, strerror(errno));
- }
-
- return contents;
-}
-
-int
-CFCUtil_write_if_changed(const char *path, const char *content, size_t len) {
- FILE *f = fopen(path, "r");
- if (f) { // Does file exist?
- if (fclose(f)) {
- CFCUtil_die("Error closing file '%s': %s", path, strerror(errno));
- }
- size_t existing_len;
- char *existing = CFCUtil_slurp_text(path, &existing_len);
- int changed = true;
- if (existing_len == len && strcmp(content, existing) == 0) {
- changed = false;
- }
- FREEMEM(existing);
- if (changed == false) {
- return false;
- }
- }
- CFCUtil_write_file(path, content, len);
- return true;
-}
-
-long
-CFCUtil_flength(void *file) {
- FILE *f = (FILE*)file;
- const long bookmark = (long)ftell(f);
- long check_val;
- long len;
-
- /* Seek to end of file and check length. */
- check_val = fseek(f, 0, SEEK_END);
- if (check_val == -1) { CFCUtil_die("fseek error : %s\n", strerror(errno)); }
- len = (long)ftell(f);
- if (len == -1) { CFCUtil_die("ftell error : %s\n", strerror(errno)); }
-
- /* Return to where we were. */
- check_val = fseek(f, bookmark, SEEK_SET);
- if (check_val == -1) { CFCUtil_die("fseek error : %s\n", strerror(errno)); }
-
- return len;
-}
-
-// Note: this has to be defined before including the Perl headers because they
-// redefine stat() in an incompatible way on certain systems (Windows).
-int
-CFCUtil_is_dir(const char *path) {
- struct stat stat_buf;
- int stat_check = stat(path, &stat_buf);
- if (stat_check == -1) {
- return false;
- }
- return (stat_buf.st_mode & S_IFDIR) ? true : false;
-}
-
-int
-CFCUtil_make_path(const char *path) {
- CFCUTIL_NULL_CHECK(path);
- char *target = CFCUtil_strdup(path);
- size_t orig_len = strlen(target);
- size_t len = orig_len;
- for (size_t i = 0; i <= len; i++) {
- if (target[i] == CHY_DIR_SEP_CHAR || i == len) {
- target[i] = 0; // NULL-terminate.
- struct stat stat_buf;
- int stat_check = stat(target, &stat_buf);
- if (stat_check != -1) {
- if (!(stat_buf.st_mode & S_IFDIR)) {
- CFCUtil_die("%s isn't a directory", target);
- }
- }
- else {
- int success = CFCUtil_make_dir(target);
- if (!success) {
- FREEMEM(target);
- return false;
- }
- }
- target[i] = CHY_DIR_SEP_CHAR;
- }
- }
-
- FREEMEM(target);
- return true;
-}
-
-void
-CFCUtil_walk(const char *path, CFCUtil_walk_callback_t callback,
- void *context) {
- // If it's a valid file system entry, invoke the callback.
- struct stat stat_buf;
- int stat_check = stat(path, &stat_buf);
- if (stat_check == -1) {
- return;
- }
- callback(path, context);
-
- // Recurse into directories.
- if (!(stat_buf.st_mode & S_IFDIR)) {
- return;
- }
- void *dirhandle = CFCUtil_opendir(path);
- const char *entry = NULL;
- while (NULL != (entry = CFCUtil_dirnext(dirhandle))) {
- if (strcmp(entry, ".") == 0 || strcmp(entry, "..") == 0) {
- continue;
- }
- char *subpath = CFCUtil_sprintf("%s" CHY_DIR_SEP "%s", path, entry);
- CFCUtil_walk(subpath, callback, context);
- FREEMEM(subpath);
- }
- CFCUtil_closedir(dirhandle, path);
-}
-
-int
-CFCUtil_make_dir(const char *dir) {
- return !chy_makedir(dir, 0777);
-}
-
-/******************************** WINDOWS **********************************/
-#if (defined(CHY_HAS_WINDOWS_H) && !defined(__CYGWIN__))
-
-#include <windows.h>
-
-typedef struct WinDH {
- HANDLE handle;
- WIN32_FIND_DATA *find_data;
- char path[MAX_PATH + 1];
- int first_time;
-} WinDH;
-
-void*
-CFCUtil_opendir(const char *dir) {
- size_t dirlen = strlen(dir);
- if (dirlen >= MAX_PATH - 2) {
- CFCUtil_die("Exceeded MAX_PATH(%d): %s", (int)MAX_PATH, dir);
- }
- WinDH *dh = (WinDH*)CALLOCATE(1, sizeof(WinDH));
- dh->find_data = (WIN32_FIND_DATA*)MALLOCATE(sizeof(WIN32_FIND_DATA));
-
- // Tack on wildcard needed by FindFirstFile.
- sprintf(dh->path, "%s\\*", dir);
-
- dh->handle = FindFirstFile(dh->path, dh->find_data);
- if (dh->handle == INVALID_HANDLE_VALUE) {
- CFCUtil_die("Can't open dir '%s'", dh->path);
- }
- dh->first_time = true;
-
- return dh;
-}
-
-const char*
-CFCUtil_dirnext(void *dirhandle) {
- WinDH *dh = (WinDH*)dirhandle;
- if (dh->first_time) {
- dh->first_time = false;
- }
- else {
- if ((FindNextFile(dh->handle, dh->find_data) == 0)) {
- if (GetLastError() != ERROR_NO_MORE_FILES) {
- CFCUtil_die("Error occurred while reading '%s'",
- dh->path);
- }
- return NULL;
- }
- }
- return dh->find_data->cFileName;
-}
-
-void
-CFCUtil_closedir(void *dirhandle, const char *dir) {
- WinDH *dh = (WinDH*)dirhandle;
- if (!FindClose(dh->handle)) {
- CFCUtil_die("Error occurred while closing dir '%s'", dir);
- }
- FREEMEM(dh->find_data);
- FREEMEM(dh);
-}
-
-/******************************** UNIXEN ***********************************/
-#elif defined(CHY_HAS_DIRENT_H)
-
-#include <dirent.h>
-
-void*
-CFCUtil_opendir(const char *dir) {
- DIR *dirhandle = opendir(dir);
- if (!dirhandle) {
- CFCUtil_die("Failed to opendir for '%s': %s", dir, strerror(errno));
- }
- return dirhandle;
-}
-
-const char*
-CFCUtil_dirnext(void *dirhandle) {
- struct dirent *entry = readdir((DIR*)dirhandle);
- return entry ? entry->d_name : NULL;
-}
-
-void
-CFCUtil_closedir(void *dirhandle, const char *dir) {
- if (closedir((DIR*)dirhandle) == -1) {
- CFCUtil_die("Error closing dir '%s': %s", dir, strerror(errno));
- }
-}
-
-#else
- #error "Need either dirent.h or windows.h"
-#endif // CHY_HAS_DIRENT_H vs. CHY_HAS_WINDOWS_H
-
-/***************************************************************************/
-
-#ifdef CFCPERL
-
-#include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
-#include "ppport.h"
-
-void
-CFCUtil_die(const char* format, ...) {
- SV *errsv = get_sv("@", 1);
- va_list args;
- va_start(args, format);
- sv_vsetpvf_mg(errsv, format, &args);
- va_end(args);
- croak(NULL);
-}
-
-void
-CFCUtil_warn(const char* format, ...) {
- SV *mess = newSVpv("", 0);
- va_list args;
- va_start(args, format);
- sv_vsetpvf(mess, format, &args);
- va_end(args);
- fprintf(stderr, "%s\n", SvPV_nolen(mess));
- SvREFCNT_dec(mess);
-}
-
-#else
-
-void
-CFCUtil_die(const char* format, ...) {
- va_list args;
- va_start(args, format);
- vfprintf(stderr, format, args);
- va_end(args);
- fprintf(stderr, "\n");
- exit(1);
-}
-
-void
-CFCUtil_warn(const char* format, ...) {
- va_list args;
- va_start(args, format);
- vfprintf(stderr, format, args);
- va_end(args);
- fprintf(stderr, "\n");
-}
-
-#endif /* CFCPERL */
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/compiler/src/CFCUtil.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCUtil.h b/clownfish/compiler/src/CFCUtil.h
deleted file mode 100644
index 961bccf..0000000
--- a/clownfish/compiler/src/CFCUtil.h
+++ /dev/null
@@ -1,193 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** Clownfish::CFC::Util - Miscellaneous helper functions.
- *
- * Clownfish::CFC::Util provides a few convenience functions used internally by
- * other Clownfish modules.
- */
-
-#ifndef H_CFCUTIL
-#define H_CFCUTIL
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stddef.h>
-
-/** Create an inner Perl object with a refcount of 1. For use in actual
- * Perl-space, it is necessary to wrap this inner object in an RV.
- */
-void*
-CFCUtil_make_perl_obj(void *ptr, const char *klass);
-
-/** Throw an error if the supplied argument is NULL.
- */
-void
-CFCUtil_null_check(const void *arg, const char *name, const char *file, int line);
-#define CFCUTIL_NULL_CHECK(arg) \
- CFCUtil_null_check(arg, #arg, __FILE__, __LINE__)
-
-/** Portable, NULL-safe implementation of strdup().
- */
-char*
-CFCUtil_strdup(const char *string);
-
-/** Portable, NULL-safe implementation of strndup().
- */
-char*
-CFCUtil_strndup(const char *string, size_t len);
-
-/** Return a dynamically allocated string with content defined by a printf
- * format string and additional arguments. Similar to asprintf().
- */
-char*
-CFCUtil_sprintf(const char *fmt, ...);
-
-/** Concatenate a NULL-terminated list of strings onto the first, reallocating
- * with each argument.
- */
-char*
-CFCUtil_cat(char *string, ...);
-
-/** Trim whitespace from the beginning and the end of a string.
- */
-void
-CFCUtil_trim_whitespace(char *text);
-
-/** Attempt to allocate memory with malloc, but print an error and exit if the
- * call fails.
- */
-void*
-CFCUtil_wrapped_malloc(size_t count, const char *file, int line);
-
-/** Attempt to allocate memory with calloc, but print an error and exit if the
- * call fails.
- */
-void*
-CFCUtil_wrapped_calloc(size_t count, size_t size, const char *file, int line);
-
-/** Attempt to allocate memory with realloc, but print an error and exit if
- * the call fails.
- */
-void*
-CFCUtil_wrapped_realloc(void *ptr, size_t size, const char *file, int line);
-
-/** Free memory. (Wrapping is necessary in cases where memory allocated
- * within Clownfish has to be freed in an external environment where "free"
- * may have been redefined.)
- */
-void
-CFCUtil_wrapped_free(void *ptr);
-
-#define MALLOCATE(_count) \
- CFCUtil_wrapped_malloc((_count), __FILE__, __LINE__)
-#define CALLOCATE(_count, _size) \
- CFCUtil_wrapped_calloc((_count), (_size), __FILE__, __LINE__)
-#define REALLOCATE(_ptr, _count) \
- CFCUtil_wrapped_realloc((_ptr), (_count), __FILE__, __LINE__)
-#define FREEMEM(_ptr) \
- CFCUtil_wrapped_free(_ptr)
-
-/** Given two filepaths, return true if the second exists and has a
- * modification time which more recent than that of the first.
- */
-int
-CFCUtil_current(const char *orig, const char *dest);
-
-/* Open a file (truncating if necessary) and write [content] to it. CFCUtil_die() if
- * an error occurs.
- */
-void
-CFCUtil_write_file(const char *filename, const char *content, size_t len);
-
-/** Test whether there's a file at <code>path</code> which already matches
- * <code>content</code> exactly. If something has changed, write the file.
- * Otherwise do nothing (and avoid bumping the file's modification time).
- *
- * @return true if the file was written, false otherwise.
- */
-int
-CFCUtil_write_if_changed(const char *path, const char *content, size_t len);
-
-/* Read an entire file (as text) into memory.
- */
-char*
-CFCUtil_slurp_text(const char *file_path, size_t *len_ptr);
-
-/* Get the length of a file (may overshoot on text files under DOS).
- */
-long
-CFCUtil_flength(void *file);
-
-/* Platform-agnostic opendir wrapper.
- */
-void*
-CFCUtil_opendir(const char *dir);
-
-/* Platform-agnostic readdir wrapper.
- */
-const char*
-CFCUtil_dirnext(void *dirhandle);
-
-/* Platform-agnostic closedir wrapper.
- */
-void
-CFCUtil_closedir(void *dirhandle, const char *dir);
-
-/* Returns true if the supplied path is a directory, false otherwise.
- */
-int
-CFCUtil_is_dir(const char *path);
-
-/* Create the specified directory. Returns true on success, false on failure.
- */
-int
-CFCUtil_make_dir(const char *dir);
-
-/* Create the specified path including all subdirectories. Returns true on
- * success, false on failure. Intermediate directories may be left behind on
- * failure.
- */
-int
-CFCUtil_make_path(const char *path);
-
-/* Walk the file system, recursing into subdirectories. Invoke the supplied
- * callback for each valid, accessible file system entry.
- */
-typedef void
-(*CFCUtil_walk_callback_t)(const char *path, void *context);
-void
-CFCUtil_walk(const char *dir, CFCUtil_walk_callback_t callback,
- void *context);
-
-/* Print an error message to stderr and exit.
- */
-void
-CFCUtil_die(const char *format, ...);
-
-/* Print an error message to stderr.
- */
-void
-CFCUtil_warn(const char *format, ...);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* H_CFCUTIL */
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/compiler/src/CFCVariable.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCVariable.c b/clownfish/compiler/src/CFCVariable.c
deleted file mode 100644
index 4292e35..0000000
--- a/clownfish/compiler/src/CFCVariable.c
+++ /dev/null
@@ -1,166 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <string.h>
-
-#ifndef true
- #define true 1
- #define false 0
-#endif
-
-#define CFC_NEED_SYMBOL_STRUCT_DEF
-#include "CFCSymbol.h"
-#include "CFCVariable.h"
-#include "CFCParcel.h"
-#include "CFCType.h"
-#include "CFCUtil.h"
-
-struct CFCVariable {
- struct CFCSymbol symbol;
- CFCType *type;
- char *local_c;
- char *global_c;
- char *local_dec;
- int inert;
-};
-
-static const CFCMeta CFCVARIABLE_META = {
- "Clownfish::CFC::Model::Variable",
- sizeof(CFCVariable),
- (CFCBase_destroy_t)CFCVariable_destroy
-};
-
-static void
-S_generate_c_strings(CFCVariable *self);
-
-CFCVariable*
-CFCVariable_new(struct CFCParcel *parcel, const char *exposure,
- const char *class_name, const char *class_cnick,
- const char *micro_sym, struct CFCType *type, int inert) {
- CFCVariable *self = (CFCVariable*)CFCBase_allocate(&CFCVARIABLE_META);
- return CFCVariable_init(self, parcel, exposure, class_name, class_cnick,
- micro_sym, type, inert);
-}
-
-CFCVariable*
-CFCVariable_init(CFCVariable *self, struct CFCParcel *parcel,
- const char *exposure, const char *class_name,
- const char *class_cnick, const char *micro_sym,
- struct CFCType *type, int inert) {
- // Validate params.
- CFCUTIL_NULL_CHECK(type);
- if (!parcel) {
- parcel = CFCParcel_default_parcel();
- }
-
- // Default exposure to "local".
- const char *real_exposure = exposure ? exposure : "local";
-
- CFCSymbol_init((CFCSymbol*)self, parcel, real_exposure, class_name,
- class_cnick, micro_sym);
-
- // Assign type, inert.
- self->type = (CFCType*)CFCBase_incref((CFCBase*)type);
- self->inert = !!inert;
-
- self->local_c = NULL;
- self->local_dec = NULL;
- self->global_c = NULL;
-
- return self;
-}
-
-void
-CFCVariable_resolve_type(CFCVariable *self, struct CFCClass **classes) {
- CFCType_resolve(self->type, classes);
-}
-
-void
-CFCVariable_destroy(CFCVariable *self) {
- CFCBase_decref((CFCBase*)self->type);
- FREEMEM(self->local_c);
- FREEMEM(self->global_c);
- FREEMEM(self->local_dec);
- CFCSymbol_destroy((CFCSymbol*)self);
-}
-
-int
-CFCVariable_equals(CFCVariable *self, CFCVariable *other) {
- if (!CFCType_equals(self->type, other->type)) { return false; }
- return CFCSymbol_equals((CFCSymbol*)self, (CFCSymbol*)other);
-}
-
-// Cache various C string representations.
-static void
-S_generate_c_strings(CFCVariable *self) {
- const char *type_str = CFCType_to_c(self->type);
- const char *postfix = "";
- if (CFCType_is_composite(self->type)
- && CFCType_get_array(self->type) != NULL
- ) {
- postfix = CFCType_get_array(self->type);
- }
- const char *micro_sym = CFCVariable_micro_sym(self);
- self->local_c = CFCUtil_sprintf("%s %s%s", type_str, micro_sym, postfix);
- self->local_dec = CFCUtil_sprintf("%s;", self->local_c);
- const char *full_sym = CFCVariable_full_sym(self);
- self->global_c = CFCUtil_sprintf("%s %s%s", type_str, full_sym, postfix);
-}
-
-CFCType*
-CFCVariable_get_type(CFCVariable *self) {
- return self->type;
-}
-
-int
-CFCVariable_inert(CFCVariable *self) {
- return self->inert;
-}
-
-const char*
-CFCVariable_local_c(CFCVariable *self) {
- if (!self->local_c) { S_generate_c_strings(self); }
- return self->local_c;
-}
-
-const char*
-CFCVariable_global_c(CFCVariable *self) {
- if (!self->global_c) { S_generate_c_strings(self); }
- return self->global_c;
-}
-
-const char*
-CFCVariable_local_declaration(CFCVariable *self) {
- if (!self->local_dec) { S_generate_c_strings(self); }
- return self->local_dec;
-}
-
-const char*
-CFCVariable_micro_sym(CFCVariable *self) {
- return CFCSymbol_micro_sym((CFCSymbol*)self);
-}
-
-const char*
-CFCVariable_short_sym(CFCVariable *self) {
- return CFCSymbol_short_sym((CFCSymbol*)self);
-}
-
-const char*
-CFCVariable_full_sym(CFCVariable *self) {
- return CFCSymbol_full_sym((CFCSymbol*)self);
-}
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/compiler/src/CFCVariable.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCVariable.h b/clownfish/compiler/src/CFCVariable.h
deleted file mode 100644
index 7263de7..0000000
--- a/clownfish/compiler/src/CFCVariable.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef H_CFCVARIABLE
-#define H_CFCVARIABLE
-
-/** Clownfish::CFC::Model::Variable - A Clownfish variable.
- *
- * A variable, having a L<Type|Clownfish::CFC::Model::Type>, a micro_sym (i.e.
- * name), an exposure, and optionally, a location in the global namespace
- * hierarchy.
- *
- * Variable objects which exist only within a local scope, e.g. those within
- * parameter lists, do not need to know about class. In contrast, inert class
- * vars, for example, need to know class information so that they can declare
- * themselves properly.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct CFCVariable CFCVariable;
-struct CFCClass;
-struct CFCParcel;
-struct CFCType;
-
-/**
- * @param type A Clownfish::CFC::Model::Type.
- * @param micro_sym The variable's name, without any namespacing prefixes.
- * @param exposure See Clownfish::CFC::Model::Symbol.
- * @param class_name See Clownfish::CFC::Model::Symbol.
- * @param class_cnick See Clownfish::CFC::Model::Symbol.
- */
-CFCVariable*
-CFCVariable_new(struct CFCParcel *parcel, const char *exposure,
- const char *class_name, const char *class_cnick,
- const char *micro_sym, struct CFCType *type, int inert);
-
-CFCVariable*
-CFCVariable_init(CFCVariable *self, struct CFCParcel *parcel,
- const char *exposure, const char *class_name,
- const char *class_cnick, const char *micro_sym,
- struct CFCType *type, int inert);
-
-void
-CFCVariable_resolve_type(CFCVariable *self, struct CFCClass **classes);
-
-void
-CFCVariable_destroy(CFCVariable *self);
-
-int
-CFCVariable_equals(CFCVariable *self, CFCVariable *other);
-
-struct CFCType*
-CFCVariable_get_type(CFCVariable *self);
-
-int
-CFCVariable_inert(CFCVariable *self);
-
-
-/** Returns a string with the Variable's C type and its
- * <code>micro_sym</code>. For instance:
- *
- * int32_t average_lifespan
- */
-const char*
-CFCVariable_local_c(CFCVariable *self);
-
-/** Returns a string with the Variable's C type and its fully qualified name
- * within the global namespace. For example:
- *
- * int32_t crust_Lobster_average_lifespan
- */
-const char*
-CFCVariable_global_c(CFCVariable *self);
-
-/** Returns C code appropriate for declaring the variable in a local scope,
- * such as within a struct definition, or as an automatic variable within a C
- * function. For example:
- *
- * int32_t average_lifespan;
- */
-const char*
-CFCVariable_local_declaration(CFCVariable *self);
-
-const char*
-CFCVariable_micro_sym(CFCVariable *self);
-
-const char*
-CFCVariable_short_sym(CFCVariable *self);
-
-const char*
-CFCVariable_full_sym(CFCVariable *self);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* H_CFCVARIABLE */
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/compiler/src/CFCVersion.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCVersion.c b/clownfish/compiler/src/CFCVersion.c
deleted file mode 100644
index 671ff36..0000000
--- a/clownfish/compiler/src/CFCVersion.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <string.h>
-#include <ctype.h>
-
-#ifndef true
- #define true 1
- #define false 0
-#endif
-
-#define CFC_NEED_BASE_STRUCT_DEF
-#include "CFCBase.h"
-#include "CFCVersion.h"
-#include "CFCUtil.h"
-
-struct CFCVersion {
- CFCBase base;
- uint32_t *numbers;
- size_t num_numbers;
- char *vstring;
-};
-
-static const CFCMeta CFCVERSION_META = {
- "Clownfish::CFC::Model::Version",
- sizeof(CFCVersion),
- (CFCBase_destroy_t)CFCVersion_destroy
-};
-
-CFCVersion*
-CFCVersion_new(const char *vstring) {
- CFCVersion *self = (CFCVersion*)CFCBase_allocate(&CFCVERSION_META);
- return CFCVersion_init(self, vstring);
-}
-
-CFCVersion*
-CFCVersion_init(CFCVersion *self, const char *vstring) {
- CFCUTIL_NULL_CHECK(vstring);
- if (*vstring != 'v' || !isdigit(vstring[1])) {
- CFCBase_decref((CFCBase*)self);
- CFCUtil_die("Bad version string: '%s'", vstring);
- }
- self->vstring = CFCUtil_strdup(vstring);
- vstring++;
- uint32_t num = 0;
- self->num_numbers = 0;
- self->numbers = (uint32_t*)CALLOCATE(1, sizeof(uint32_t));
- while (1) {
- if (isdigit(*vstring)) {
- num = num * 10 + *vstring - '0';
- }
- else {
- if (*vstring != 0 && *vstring != '.') {
- CFCBase_decref((CFCBase*)self);
- CFCUtil_die("Bad version string: '%s'", self->vstring);
- }
- size_t size = (self->num_numbers + 1) * sizeof(uint32_t);
- self->numbers = (uint32_t*)REALLOCATE(self->numbers, size);
- self->numbers[self->num_numbers++] = num;
- if (*vstring == 0) {
- break;
- }
- num = 0;
- }
- vstring++;
- }
-
- return self;
-}
-
-void
-CFCVersion_destroy(CFCVersion *self) {
- FREEMEM(self->numbers);
- FREEMEM(self->vstring);
- CFCBase_destroy((CFCBase*)self);
-}
-
-int
-CFCVersion_compare_to(CFCVersion *self, CFCVersion *other) {
- for (size_t i = 0;
- i < self->num_numbers || i < other->num_numbers;
- i++
- ) {
- uint32_t my_number = i >= self->num_numbers
- ? 0
- : self->numbers[i];
- uint32_t other_number = i >= other->num_numbers
- ? 0
- : other->numbers[i];
- if (my_number > other_number) {
- return 1;
- }
- else if (other_number > my_number) {
- return -1;
- }
- }
- return 0;
-}
-
-uint32_t
-CFCVersion_get_major(CFCVersion *self) {
- return self->numbers[0];
-}
-
-const char*
-CFCVersion_get_vstring(CFCVersion *self) {
- return self->vstring;
-}
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/compiler/src/CFCVersion.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCVersion.h b/clownfish/compiler/src/CFCVersion.h
deleted file mode 100644
index e81a012..0000000
--- a/clownfish/compiler/src/CFCVersion.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-/** Clownfish::CFC::Model::Version - Version number.
- *
- * A version number, comprised of one or more unsigned integers. Digits
- * beyond the first are treated as implicit zeros for the purposes of
- * comparision, so that v1.2 and v1.2.0 are equivalent.
- */
-#ifndef H_CFCVERSION
-#define H_CFCVERSION
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "charmony.h"
-
-typedef struct CFCVersion CFCVersion;
-
-/**
- * @param vstring - A version string consisting of a lower-case 'v' followed
- * by one or more unsigned integers separated by dots.
-*/
-CFCVersion*
-CFCVersion_new(const char *vstring);
-
-CFCVersion*
-CFCVersion_init(CFCVersion *self, const char *vstring);
-
-void
-CFCVersion_destroy(CFCVersion *self);
-
-int
-CFCVersion_compare_to(CFCVersion *self, CFCVersion *other);
-
-const char*
-CFCVersion_get_vstring(CFCVersion *self);
-
-uint32_t
-CFCVersion_get_major(CFCVersion *self);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* H_CFCVERSION */
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/devel/benchmarks/method_dispatch/.gitignore
----------------------------------------------------------------------
diff --git a/clownfish/devel/benchmarks/method_dispatch/.gitignore b/clownfish/devel/benchmarks/method_dispatch/.gitignore
deleted file mode 100644
index a82daf4..0000000
--- a/clownfish/devel/benchmarks/method_dispatch/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-dso.dylib
-dso.so
-exe
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/devel/benchmarks/method_dispatch/Makefile.darwin
----------------------------------------------------------------------
diff --git a/clownfish/devel/benchmarks/method_dispatch/Makefile.darwin b/clownfish/devel/benchmarks/method_dispatch/Makefile.darwin
deleted file mode 100644
index f49451c..0000000
--- a/clownfish/devel/benchmarks/method_dispatch/Makefile.darwin
+++ /dev/null
@@ -1,31 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-CFLAGS = -std=gnu99 -Wextra -O2 -fomit-frame-pointer -DHAS_ALIAS
-
-all : bench
-
-dso.dylib : dso.c dso.h oo.h
- gcc $(CFLAGS) -Wl,-alias,_thunk3,_Obj_Hello_THUNK -shared dso.c -o $@
-
-exe : exe.c dso.h oo.h dso.dylib
- gcc $(CFLAGS) exe.c dso.dylib -o $@
-
-bench : exe
- ./exe
-
-clean :
- rm -f dso.dylib exe
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/devel/benchmarks/method_dispatch/Makefile.linux
----------------------------------------------------------------------
diff --git a/clownfish/devel/benchmarks/method_dispatch/Makefile.linux b/clownfish/devel/benchmarks/method_dispatch/Makefile.linux
deleted file mode 100644
index 80d2c8f..0000000
--- a/clownfish/devel/benchmarks/method_dispatch/Makefile.linux
+++ /dev/null
@@ -1,31 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-CFLAGS = -std=gnu99 -Wextra -O2 -fomit-frame-pointer
-
-all : bench
-
-dso.so : dso.c dso.h oo.h
- gcc $(CFLAGS) -shared -fPIC dso.c -o $@
-
-exe : exe.c dso.h oo.h dso.so
- gcc $(CFLAGS) -fPIE exe.c dso.so -o $@
-
-bench : exe
- LD_LIBRARY_PATH=. ./exe
-
-clean :
- rm -f dso.so exe
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/devel/benchmarks/method_dispatch/dso.c
----------------------------------------------------------------------
diff --git a/clownfish/devel/benchmarks/method_dispatch/dso.c b/clownfish/devel/benchmarks/method_dispatch/dso.c
deleted file mode 100644
index 28a30e2..0000000
--- a/clownfish/devel/benchmarks/method_dispatch/dso.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "dso.h"
-
-static void Obj_hello(obj_t *obj);
-
-void thunk3(obj_t *obj);
-
-class_t *OBJ;
-size_t Obj_Hello_OFFSET;
-method_t Obj_Hello_THUNK_PTR;
-
-void
-bootstrap() {
- size_t method_idx = 3;
- size_t class_size = offsetof(class_t, vtable)
- + (method_idx + 1) * sizeof(method_t);
-
- OBJ = (class_t*)calloc(1, class_size);
-
- OBJ->name = "Obj";
- OBJ->class_size = class_size;
-
- Obj_Hello_OFFSET = offsetof(class_t, vtable)
- + method_idx * sizeof(method_t);
- OBJ->vtable[method_idx] = Obj_hello;
- Obj_Hello_THUNK_PTR = thunk3;
-}
-
-obj_t*
-Obj_new() {
- obj_t *self = (obj_t *)malloc(sizeof(obj_t));
-
- self->refcount = 1;
- self->klass = OBJ;
- self->value = 0;
-
- return self;
-}
-
-static void
-Obj_hello(obj_t *obj) {
- ++obj->value;
-}
-
-void
-thunk3(obj_t *obj) {
- obj->klass->vtable[3](obj);
-}
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/devel/benchmarks/method_dispatch/dso.h
----------------------------------------------------------------------
diff --git a/clownfish/devel/benchmarks/method_dispatch/dso.h b/clownfish/devel/benchmarks/method_dispatch/dso.h
deleted file mode 100644
index fe1a07f..0000000
--- a/clownfish/devel/benchmarks/method_dispatch/dso.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef DSO_H
-#define DSO_H
-
-#include "oo.h"
-
-extern class_t *OBJ;
-extern size_t Obj_Hello_OFFSET;
-extern method_t Obj_Hello_THUNK_PTR;
-#define Obj_Hello_FIXED_OFFSET (5 * sizeof(void*))
-
-void bootstrap();
-
-obj_t *Obj_new(void);
-
-void Obj_Hello_THUNK(obj_t *obj);
-
-#endif /* DSO_H */
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/devel/benchmarks/method_dispatch/exe.c
----------------------------------------------------------------------
diff --git a/clownfish/devel/benchmarks/method_dispatch/exe.c b/clownfish/devel/benchmarks/method_dispatch/exe.c
deleted file mode 100644
index 1747386..0000000
--- a/clownfish/devel/benchmarks/method_dispatch/exe.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <inttypes.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/time.h>
-
-#include "dso.h"
-
-#define CPUFREQ UINT64_C(2800000000)
-#define NOINLINE __attribute__ ((noinline))
-uint64_t iterations;
-#define ITERATIONS iterations
-
-static inline method_t
-Obj_Hello_PTR(obj_t *obj) {
- class_t *klass = obj->klass;
- return *(method_t*)((char*)klass + Obj_Hello_OFFSET);
-}
-
-static inline void
-Obj_Hello(obj_t *obj) {
- class_t *klass = obj->klass;
- method_t method = *(method_t*)((char*)klass + Obj_Hello_OFFSET);
- method(obj);
-}
-
-static inline void
-Obj_Hello_FIXED(obj_t *obj) {
- class_t *klass = obj->klass;
- method_t method = *(method_t*)((char*)klass + Obj_Hello_FIXED_OFFSET);
- method(obj);
-}
-
-void
-loop_with_method_ptr(obj_t *obj) {
- method_t method = Obj_Hello_PTR(obj);
-
- for (uint64_t i = 0; i < ITERATIONS; ++i) {
- method(obj);
- }
-}
-
-void
-loop_with_wrapper(obj_t *obj) {
- for (uint64_t i = 0; i < ITERATIONS; ++i) {
- Obj_Hello(obj);
- }
-}
-
-void
-loop_with_fixed_offset_wrapper(obj_t *obj) {
- for (uint64_t i = 0; i < ITERATIONS; ++i) {
- Obj_Hello_FIXED(obj);
- }
-}
-
-#ifdef HAS_ALIAS
-void
-loop_with_thunk(obj_t *obj) {
- for (uint64_t i = 0; i < ITERATIONS; ++i) {
- Obj_Hello_THUNK(obj);
- }
-}
-
-void
-loop_with_thunk_ptr(obj_t *obj) {
- for (uint64_t i = 0; i < ITERATIONS; ++i) {
- Obj_Hello_THUNK_PTR(obj);
- }
-}
-#endif
-
-NOINLINE void
-single_call_with_wrapper(obj_t *obj) {
- Obj_Hello(obj);
-}
-
-void
-call_with_wrapper(obj_t *obj) {
- for (uint64_t i = 0; i < ITERATIONS; ++i) {
- single_call_with_wrapper(obj);
- }
-}
-
-#ifdef HAS_ALIAS
-NOINLINE void
-single_call_with_thunk(obj_t *obj) {
- Obj_Hello_THUNK(obj);
-}
-
-void
-call_with_thunk_ptr(obj_t *obj) {
- for (uint64_t i = 0; i < ITERATIONS; ++i) {
- single_call_with_thunk(obj);
- }
-}
-
-NOINLINE void
-single_call_with_thunk_ptr(obj_t *obj) {
- Obj_Hello_THUNK_PTR(obj);
-}
-
-void
-call_with_thunk(obj_t *obj) {
- for (uint64_t i = 0; i < ITERATIONS; ++i) {
- single_call_with_thunk(obj);
- }
-}
-#endif
-
-void
-loop_with_simulated_inline(obj_t *obj) {
- for (uint64_t i = 0; i < ITERATIONS; ++i) {
- obj->value++;
- }
-}
-
-static void
-bench(method_t fn, const char *name) {
- obj_t *obj = Obj_new();
-
- struct timeval t0;
- gettimeofday(&t0, NULL);
-
- fn(obj);
-
- struct timeval t1;
- gettimeofday(&t1, NULL);
-
- if (obj->value != ITERATIONS) {
- fprintf(stderr, "Unexpected obj->value: %" PRIu64 "\n", obj->value);
- abort();
- }
-
- uint64_t usec = (uint64_t)(t1.tv_sec - t0.tv_sec) * 1000000
- + (t1.tv_usec - t0.tv_usec);
- printf("cycles/call with %s: %f\n", name,
- ((double)usec * CPUFREQ) / (1000000.0 * ITERATIONS));
-}
-
-int
-main(int argc, char **argv) {
- if (argc > 1) {
- iterations = strtoll(argv[1], NULL, 10);
- }
- else {
- iterations = UINT64_C(1000000000);
- }
- bootstrap();
-
- bench(loop_with_method_ptr, "method ptr loop");
- bench(loop_with_wrapper, "wrapper loop");
- bench(loop_with_fixed_offset_wrapper, "fixed offset wrapper loop");
-#ifdef HAS_ALIAS
- bench(loop_with_thunk, "thunk loop");
- bench(loop_with_thunk_ptr, "thunk ptr loop");
-#endif
- bench(call_with_wrapper, "wrapper");
-#ifdef HAS_ALIAS
- bench(call_with_thunk, "thunk");
- bench(call_with_thunk_ptr, "thunk ptr");
-#endif
- bench(loop_with_simulated_inline, "simulated inline");
-
- return 0;
-}
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/devel/benchmarks/method_dispatch/oo.h
----------------------------------------------------------------------
diff --git a/clownfish/devel/benchmarks/method_dispatch/oo.h b/clownfish/devel/benchmarks/method_dispatch/oo.h
deleted file mode 100644
index d2d0190..0000000
--- a/clownfish/devel/benchmarks/method_dispatch/oo.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef OO_H
-#define OO_H
-
-#include <stddef.h>
-#include <stdint.h>
-
-typedef struct class_t class_t;
-
-typedef struct obj_t {
- size_t refcount;
- class_t *klass;
- uint64_t value;
-} obj_t;
-
-typedef void (*method_t)(obj_t *obj);
-
-struct class_t {
- char *name;
- size_t class_size;
- method_t vtable[1];
-};
-
-#endif /* OO_H */
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/c/.gitignore
----------------------------------------------------------------------
diff --git a/clownfish/runtime/c/.gitignore b/clownfish/runtime/c/.gitignore
deleted file mode 100644
index d75d0aa..0000000
--- a/clownfish/runtime/c/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
-/Makefile
-/autogen/
-/charmonizer
-/charmony.h
-/libcfish.*.dylib
-/libcfish.dylib
-/libcfish.so
-/libcfish.so.*
-/t/test_cfish
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/c/INSTALL
----------------------------------------------------------------------
diff --git a/clownfish/runtime/c/INSTALL b/clownfish/runtime/c/INSTALL
deleted file mode 100644
index 5566b50..0000000
--- a/clownfish/runtime/c/INSTALL
+++ /dev/null
@@ -1,46 +0,0 @@
-Build instructions for the Clownfish C library
-==============================================
-
-Building under UNIX and derivatives or Cygwin
----------------------------------------------
-
- $ ./configure
- $ make
- $ make test
-
-Building under Windows
-----------------------
-
-You need MSVC or gcc as C compiler and nmake or mingw32-make as make utility.
-
-When using cmd.exe configure with:
-
- $ configure.bat
-
-When using the MSYS shell configure with:
-
- $ ./configure
-
-When building with nmake run:
-
- $ nmake
- $ nmake test
-
-When building with mingw32-make run:
-
- $ mingw32-make
- $ mingw32-make test
-
-Configuration
--------------
-
- ./configure [ options ] [ -- cflags ]
-
-Options include
-
- --enable-coverage
- Enable code coverage. Create HTML pages with coverage data using
- lcov by running "make coverage".
- --disable-threads
- Disable thread support.
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/c/cfc_header
----------------------------------------------------------------------
diff --git a/clownfish/runtime/c/cfc_header b/clownfish/runtime/c/cfc_header
deleted file mode 100644
index d982cf9..0000000
--- a/clownfish/runtime/c/cfc_header
+++ /dev/null
@@ -1,23 +0,0 @@
-/***********************************************
-
- !!!! DO NOT EDIT !!!!
-
- This file was auto-generated by cfc.
-
- ***********************************************/
-
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/c/configure
----------------------------------------------------------------------
diff --git a/clownfish/runtime/c/configure b/clownfish/runtime/c/configure
deleted file mode 100755
index ae1f4f9..0000000
--- a/clownfish/runtime/c/configure
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-(cd ../../compiler/c && ./configure "$@") || exit
-echo
-
-echo Configuring Clownfish runtime...
-
-probe_clang() { clang -v; }
-probe_gcc() { gcc -v; }
-
-if [ -z "$CC" ]; then
- case $(uname) in
- Darwin*) compilers="clang gcc";;
- *) compilers="gcc clang";;
- esac
-
- for compiler in $compilers; do
- if probe_$compiler >/dev/null 2>&1; then
- CC=$compiler
- break
- fi
- done
-
- if [ -z "$CC" ]; then
- CC=cc
- fi
-fi
-
-echo "Using C compiler '$CC'"
-
-command="$CC ../common/charmonizer.c -o charmonizer"
-echo $command
-$command || exit
-
-echo Running charmonizer
-./charmonizer --cc=$CC --enable-c --enable-makefile "$@"
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/c/configure.bat
----------------------------------------------------------------------
diff --git a/clownfish/runtime/c/configure.bat b/clownfish/runtime/c/configure.bat
deleted file mode 100644
index 07a3d1a..0000000
--- a/clownfish/runtime/c/configure.bat
+++ /dev/null
@@ -1,50 +0,0 @@
-@echo off
-
-rem Licensed to the Apache Software Foundation (ASF) under one or more
-rem contributor license agreements. See the NOTICE file distributed with
-rem this work for additional information regarding copyright ownership.
-rem The ASF licenses this file to You under the Apache License, Version 2.0
-rem (the "License"); you may not use this file except in compliance with
-rem the License. You may obtain a copy of the License at
-rem
-rem http://www.apache.org/licenses/LICENSE-2.0
-rem
-rem Unless required by applicable law or agreed to in writing, software
-rem distributed under the License is distributed on an "AS IS" BASIS,
-rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-rem See the License for the specific language governing permissions and
-rem limitations under the License.
-
-cd ..\..\compiler\c
-call configure.bat
-cd ..\..\..\c
-echo.
-
-echo Configuring Clownfish runtime...
-
-cl >nul 2>nul
-if not errorlevel 1 goto found_cl
-
-gcc -v >nul 2>nul
-if not errorlevel 1 goto found_gcc
-
-echo No C compiler found
-exit /b 1
-
-:found_cl
-echo Using C compiler 'cl'
-echo cl /nologo ..\common\charmonizer.c
-cl /nologo ..\common\charmonizer.c
-if errorlevel 1 exit /b 1
-echo Running charmonizer
-charmonizer.exe --cc=cl --enable-c --enable-makefile %*
-exit /b
-
-:found_gcc
-echo Using C compiler 'gcc'
-echo gcc ..\common\charmonizer.c -o charmonizer.exe
-gcc ..\common\charmonizer.c -o charmonizer.exe
-if errorlevel 1 exit /b 1
-echo Running charmonizer
-charmonizer.exe --cc=gcc --enable-c --enable-makefile %*
-exit /b
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/c/install.sh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/c/install.sh b/clownfish/runtime/c/install.sh
deleted file mode 100755
index 31d5a53..0000000
--- a/clownfish/runtime/c/install.sh
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/bin/sh
-
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements. See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set -e
-
-version=0.3.0
-major_version=0.3
-
-usage()
-{
- echo "Usage: install.sh --prefix path"
-}
-
-while [ -n "${1+set}" ]; do
- case "$1" in
- -h|--help|-\?)
- usage
- exit
- ;;
- --prefix)
- if [ -z "${2+set}" ]; then
- echo "--prefix requires an argument."
- exit 1
- fi
- prefix=$2
- shift 2
- ;;
- *)
- echo "Invalid option: '$1'" 1>&2
- usage
- exit 1
- ;;
- esac
-done
-
-if [ -z "$prefix" ]; then
- echo "No prefix specified."
- usage
- exit 1
-fi
-
-case $(uname) in
- Darwin*)
- lib_file=libcfish.$version.dylib
- if [ ! -f $lib_file ]; then
- echo "$lib_file not found. Did you run make?"
- exit 1
- fi
- mkdir -p $prefix/lib
- cp $lib_file $prefix/lib
- install_name=$prefix/lib/libcfish.$major_version.dylib
- ln -sf $lib_file $install_name
- ln -sf $lib_file $prefix/lib/libcfish.dylib
- install_name_tool -id $install_name $prefix/lib/$lib_file
- ;;
- *)
- lib_file=libcfish.so.$version
- if [ ! -f $lib_file ]; then
- echo "$lib_file not found. Did you run make?"
- exit 1
- fi
- mkdir -p $prefix/lib
- cp $lib_file $prefix/lib
- soname=libcfish.so.$major_version
- ln -sf $lib_file $prefix/lib/$soname
- ln -sf $soname $prefix/lib/libcfish.so
- ;;
-esac
-
-mkdir -p $prefix/include
-cp autogen/include/cfish_hostdefs.h $prefix/include
-cp autogen/include/cfish_parcel.h $prefix/include
-cp autogen/include/cfish_platform.h $prefix/include
-cp -R autogen/include/Clownfish $prefix/include
-
-cp -R autogen/man $prefix
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/c/src/Clownfish/Err.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/c/src/Clownfish/Err.c b/clownfish/runtime/c/src/Clownfish/Err.c
deleted file mode 100644
index 112a9b1..0000000
--- a/clownfish/runtime/c/src/Clownfish/Err.c
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define CHY_USE_SHORT_NAMES
-#define CFISH_USE_SHORT_NAMES
-#define C_CFISH_ERR
-
-#include "charmony.h"
-
-#include <setjmp.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "Clownfish/Err.h"
-#include "Clownfish/String.h"
-#include "Clownfish/Util/Memory.h"
-#include "Clownfish/VTable.h"
-
-/* TODO: Thread safety */
-static Err *current_error;
-static Err *thrown_error;
-static jmp_buf *current_env;
-
-void
-Err_init_class(void) {
-}
-
-Err*
-Err_get_error() {
- return current_error;
-}
-
-void
-Err_set_error(Err *error) {
- if (current_error) {
- DECREF(current_error);
- }
- current_error = error;
-}
-
-void
-Err_do_throw(Err *error) {
- if (current_env) {
- thrown_error = error;
- longjmp(*current_env, 1);
- }
- else {
- String *message = Err_Get_Mess(error);
- char *utf8 = Str_To_Utf8(message);
- fprintf(stderr, "%s", utf8);
- FREEMEM(utf8);
- exit(EXIT_FAILURE);
- }
-}
-
-void*
-Err_To_Host_IMP(Err *self) {
- UNUSED_VAR(self);
- THROW(ERR, "TODO");
- UNREACHABLE_RETURN(void*);
-}
-
-void
-Err_throw_mess(VTable *vtable, String *message) {
- UNUSED_VAR(vtable);
- Err *err = Err_new(message);
- Err_do_throw(err);
-}
-
-void
-Err_warn_mess(String *message) {
- char *utf8 = Str_To_Utf8(message);
- fprintf(stderr, "%s", utf8);
- FREEMEM(utf8);
- DECREF(message);
-}
-
-Err*
-Err_trap(Err_Attempt_t routine, void *context) {
- jmp_buf env;
- jmp_buf *prev_env = current_env;
- current_env = &env;
-
- if (!setjmp(env)) {
- routine(context);
- }
-
- current_env = prev_env;
-
- Err *error = thrown_error;
- thrown_error = NULL;
- return error;
-}
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/c/src/Clownfish/LockFreeRegistry.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/c/src/Clownfish/LockFreeRegistry.c b/clownfish/runtime/c/src/Clownfish/LockFreeRegistry.c
deleted file mode 100644
index 23efef1..0000000
--- a/clownfish/runtime/c/src/Clownfish/LockFreeRegistry.c
+++ /dev/null
@@ -1,33 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define C_CFISH_LOCKFREEREGISTRY
-#define CHY_USE_SHORT_NAMES
-#define CFISH_USE_SHORT_NAMES
-
-#include "charmony.h"
-
-#include "Clownfish/LockFreeRegistry.h"
-#include "Clownfish/Err.h"
-
-void*
-LFReg_To_Host_IMP(LockFreeRegistry *self) {
- UNUSED_VAR(self);
- THROW(ERR, "TODO");
- UNREACHABLE_RETURN(void*);
-}
-
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/c/src/Clownfish/Obj.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/c/src/Clownfish/Obj.c b/clownfish/runtime/c/src/Clownfish/Obj.c
deleted file mode 100644
index 6616747..0000000
--- a/clownfish/runtime/c/src/Clownfish/Obj.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define C_CFISH_OBJ
-#define CHY_USE_SHORT_NAMES
-#define CFISH_USE_SHORT_NAMES
-
-#include "charmony.h"
-
-#include "Clownfish/Obj.h"
-#include "Clownfish/Err.h"
-
-uint32_t
-Obj_Get_RefCount_IMP(Obj *self) {
- return self->refcount;
-}
-
-Obj*
-Obj_Inc_RefCount_IMP(Obj *self) {
- self->refcount++;
- return self;
-}
-
-uint32_t
-Obj_Dec_RefCount_IMP(Obj *self) {
- uint32_t modified_refcount = INT32_MAX;
- switch (self->refcount) {
- case 0:
- THROW(ERR, "Illegal refcount of 0");
- break; // useless
- case 1:
- modified_refcount = 0;
- Obj_Destroy(self);
- break;
- default:
- modified_refcount = --self->refcount;
- break;
- }
- return modified_refcount;
-}
-
-void*
-Obj_To_Host_IMP(Obj *self) {
- UNUSED_VAR(self);
- THROW(ERR, "TODO");
- UNREACHABLE_RETURN(void*);
-}
-
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/c/src/Clownfish/VTable.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/c/src/Clownfish/VTable.c b/clownfish/runtime/c/src/Clownfish/VTable.c
deleted file mode 100644
index 5617900..0000000
--- a/clownfish/runtime/c/src/Clownfish/VTable.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define CHY_USE_SHORT_NAMES
-#define CFISH_USE_SHORT_NAMES
-#define C_CFISH_OBJ
-#define C_CFISH_VTABLE
-
-#include "charmony.h"
-
-#include "Clownfish/VTable.h"
-#include "Clownfish/String.h"
-#include "Clownfish/Err.h"
-#include "Clownfish/Util/Memory.h"
-#include "Clownfish/VArray.h"
-
-Obj*
-VTable_Make_Obj_IMP(VTable *self) {
- Obj *obj = (Obj*)Memory_wrapped_calloc(self->obj_alloc_size, 1);
- obj->vtable = self;
- obj->refcount = 1;
- return obj;
-}
-
-Obj*
-VTable_Init_Obj_IMP(VTable *self, void *allocation) {
- Obj *obj = (Obj*)allocation;
- obj->vtable = self;
- obj->refcount = 1;
- return obj;
-}
-
-Obj*
-VTable_Foster_Obj_IMP(VTable *self, void *host_obj) {
- UNUSED_VAR(self);
- UNUSED_VAR(host_obj);
- THROW(ERR, "TODO");
- UNREACHABLE_RETURN(Obj*);
-}
-
-void
-VTable_register_with_host(VTable *singleton, VTable *parent) {
- UNUSED_VAR(singleton);
- UNUSED_VAR(parent);
-}
-
-VArray*
-VTable_fresh_host_methods(String *class_name) {
- UNUSED_VAR(class_name);
- return VA_new(0);
-}
-
-String*
-VTable_find_parent_class(String *class_name) {
- UNUSED_VAR(class_name);
- THROW(ERR, "TODO");
- UNREACHABLE_RETURN(String*);
-}
-
-void*
-VTable_To_Host_IMP(VTable *self) {
- UNUSED_VAR(self);
- THROW(ERR, "TODO");
- UNREACHABLE_RETURN(void*);
-}
-
http://git-wip-us.apache.org/repos/asf/lucy/blob/1704c275/clownfish/runtime/c/t/test_cfish.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/c/t/test_cfish.c b/clownfish/runtime/c/t/test_cfish.c
deleted file mode 100644
index 0e3152d..0000000
--- a/clownfish/runtime/c/t/test_cfish.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <stdlib.h>
-
-#include "Clownfish/TestHarness/TestFormatter.h"
-#include "Clownfish/TestHarness/TestSuite.h"
-#include "Clownfish/Test.h"
-
-int
-main() {
- cfish_TestFormatter *formatter;
- cfish_TestSuite *suite;
- bool success;
-
- testcfish_bootstrap_parcel();
-
- formatter = (cfish_TestFormatter*)cfish_TestFormatterCF_new();
- suite = testcfish_Test_create_test_suite();
- success = CFISH_TestSuite_Run_All_Batches(suite, formatter);
-
- CFISH_DECREF(formatter);
- CFISH_DECREF(suite);
- return success ? EXIT_SUCCESS : EXIT_FAILURE;
-}
-