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 2011/05/02 01:50:38 UTC
[lucy-commits] svn commit: r1098445 [2/23] - in /incubator/lucy/trunk: charmonizer/
charmonizer/src/Charmonizer/ charmonizer/src/Charmonizer/Core/
charmonizer/src/Charmonizer/Probe/ charmonizer/src/Charmonizer/Test/
clownfish/lib/ clownfish/lib/Clownfish/Binding/ clo...
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.c Sun May 1 23:50:24 2011
@@ -30,7 +30,7 @@
static chaz_bool_t
S_machine_is_big_endian();
-static char sizes_code[] =
+static char sizes_code[] =
QUOTE( #include "_charm.h" )
QUOTE( int main () { )
QUOTE( Charm_Setup; )
@@ -51,7 +51,7 @@ static char type64_code[] =
QUOTE( return 0; )
QUOTE( } );
-static char literal64_code[] =
+static char literal64_code[] =
QUOTE( #include "_charm.h" )
QUOTE( #define big 9000000000000000000%s )
QUOTE( int main() )
@@ -63,14 +63,13 @@ static char literal64_code[] =
QUOTE( } );
void
-Integers_run(void)
-{
+Integers_run(void) {
char *output;
size_t output_len;
- int sizeof_char = -1;
- int sizeof_short = -1;
- int sizeof_int = -1;
- int sizeof_ptr = -1;
+ int sizeof_char = -1;
+ int sizeof_short = -1;
+ int sizeof_int = -1;
+ int sizeof_ptr = -1;
int sizeof_long = -1;
int sizeof_long_long = -1;
int sizeof___int64 = -1;
@@ -104,7 +103,7 @@ Integers_run(void)
output = CC_capture_output(sizes_code, strlen(sizes_code), &output_len);
if (output != NULL) {
char *end_ptr = output;
-
+
sizeof_char = strtol(output, &end_ptr, 10);
output = end_ptr;
sizeof_short = strtol(output, &end_ptr, 10);
@@ -177,7 +176,8 @@ Integers_run(void)
}
else {
sprintf(code_buf, literal64_code, "i64");
- output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
+ output = CC_capture_output(code_buf, strlen(code_buf),
+ &output_len);
if (output != NULL) {
strcpy(i64_t_postfix, "i64");
}
@@ -223,10 +223,12 @@ Integers_run(void)
ConfWriter_append_conf("#define CHY_SIZEOF_LONG %d\n", sizeof_long);
ConfWriter_append_conf("#define CHY_SIZEOF_PTR %d\n", sizeof_ptr);
if (has_long_long) {
- ConfWriter_append_conf("#define CHY_SIZEOF_LONG_LONG %d\n", sizeof_long_long);
+ ConfWriter_append_conf("#define CHY_SIZEOF_LONG_LONG %d\n",
+ sizeof_long_long);
}
if (has___int64) {
- ConfWriter_append_conf("#define CHY_SIZEOF___INT64 %d\n", sizeof___int64);
+ ConfWriter_append_conf("#define CHY_SIZEOF___INT64 %d\n",
+ sizeof___int64);
}
/* Write affirmations, typedefs and maximums/minimums. */
@@ -235,16 +237,16 @@ Integers_run(void)
ConfWriter_append_conf("#include <stdint.h>\n");
}
else {
- /* we support only the following subset of stdint.h
- * int8_t
- * int16_t
- * int32_t
- * int64_t
- * uint8_t
- * uint16_t
- * uint32_t
- * uint64_t
- */
+ /* we support only the following subset of stdint.h
+ * int8_t
+ * int16_t
+ * int32_t
+ * int64_t
+ * uint8_t
+ * uint16_t
+ * uint32_t
+ * uint64_t
+ */
if (has_8) {
ConfWriter_append_conf(
"typedef signed char int8_t;\n"
@@ -297,22 +299,25 @@ Integers_run(void)
if (has_32) {
ConfWriter_append_conf("#define CHY_HAS_I32_T\n");
ConfWriter_append_conf("typedef %s chy_i32_t;\n", i32_t_type);
- ConfWriter_append_conf("typedef unsigned %s chy_u32_t;\n", i32_t_type);
- ConfWriter_append_conf("#define CHY_I32_MAX 0x7FFFFFFF%s\n", i32_t_postfix);
+ ConfWriter_append_conf("typedef unsigned %s chy_u32_t;\n",
+ i32_t_type);
+ ConfWriter_append_conf("#define CHY_I32_MAX 0x7FFFFFFF%s\n",
+ i32_t_postfix);
ConfWriter_append_conf("#define CHY_I32_MIN (-I32_MAX - 1)\n");
ConfWriter_append_conf("#define CHY_U32_MAX (I32_MAX * 2%s + 1%s)\n",
- u32_t_postfix, u32_t_postfix);
+ u32_t_postfix, u32_t_postfix);
}
if (has_64) {
ConfWriter_append_conf("#define CHY_HAS_I64_T\n");
ConfWriter_append_conf("typedef %s chy_i64_t;\n", i64_t_type);
- ConfWriter_append_conf("typedef unsigned %s chy_u64_t;\n", i64_t_type);
+ ConfWriter_append_conf("typedef unsigned %s chy_u64_t;\n",
+ i64_t_type);
ConfWriter_append_conf("#define CHY_I64_MAX 0x7FFFFFFFFFFFFFFF%s\n",
- i64_t_postfix);
+ i64_t_postfix);
ConfWriter_append_conf("#define CHY_I64_MIN (-I64_MAX - 1%s)\n",
- i64_t_postfix);
+ i64_t_postfix);
ConfWriter_append_conf("#define CHY_U64_MAX (I64_MAX * 2%s + 1%s)\n",
- u64_t_postfix, u64_t_postfix);
+ u64_t_postfix, u64_t_postfix);
}
/* Create the I64P and U64P printf macros. */
@@ -328,7 +333,7 @@ Integers_run(void)
};
/* Buffer to hold the code, and its start and end. */
- static char format_64_code[] =
+ static char format_64_code[] =
QUOTE( #include "_charm.h" )
QUOTE( int main() { )
QUOTE( Charm_Setup; )
@@ -340,13 +345,15 @@ Integers_run(void)
/* Try to print 2**64-1, and see if we get it back intact. */
sprintf(code_buf, format_64_code, options[i], u64_t_postfix);
output = CC_capture_output(code_buf, strlen(code_buf),
- &output_len);
+ &output_len);
- if ( output_len != 0
+ if (output_len != 0
&& strcmp(output, "18446744073709551615") == 0
- ) {
- ConfWriter_append_conf("#define CHY_I64P \"%sd\"\n", options[i]);
- ConfWriter_append_conf("#define CHY_U64P \"%su\"\n", options[i]);
+ ) {
+ ConfWriter_append_conf("#define CHY_I64P \"%sd\"\n",
+ options[i]);
+ ConfWriter_append_conf("#define CHY_U64P \"%su\"\n",
+ options[i]);
break;
}
}
@@ -357,11 +364,14 @@ Integers_run(void)
if (has_32) {
if (strcmp(i32_t_postfix, "") == 0) {
ConfWriter_append_conf("#define CHY_I32_C(n) n\n");
- ConfWriter_append_conf("#define CHY_U32_C(n) n##%s\n", u32_t_postfix);
+ ConfWriter_append_conf("#define CHY_U32_C(n) n##%s\n",
+ u32_t_postfix);
}
else {
- ConfWriter_append_conf("#define CHY_I32_C(n) n##%s\n", i32_t_postfix);
- ConfWriter_append_conf("#define CHY_U32_C(n) n##%s\n", u32_t_postfix);
+ ConfWriter_append_conf("#define CHY_I32_C(n) n##%s\n",
+ i32_t_postfix);
+ ConfWriter_append_conf("#define CHY_U32_C(n) n##%s\n",
+ u32_t_postfix);
}
}
if (has_64) {
@@ -373,11 +383,11 @@ Integers_run(void)
if (has_64) {
if (sizeof_ptr == 8) {
ConfWriter_append_conf("#define CHY_PTR_TO_I64(ptr) "
- "((chy_i64_t)(chy_u64_t)(ptr))\n");
+ "((chy_i64_t)(chy_u64_t)(ptr))\n");
}
else {
ConfWriter_append_conf("#define CHY_PTR_TO_I64(ptr) "
- "((chy_i64_t)(chy_u32_t)(ptr))\n");
+ "((chy_i64_t)(chy_u32_t)(ptr))\n");
}
}
@@ -393,7 +403,7 @@ Integers_run(void)
/* Shorten. */
ConfWriter_start_short_names();
- if ( S_machine_is_big_endian() ) {
+ if (S_machine_is_big_endian()) {
ConfWriter_shorten_macro("BIG_END");
}
else {
@@ -456,15 +466,14 @@ Integers_run(void)
ConfWriter_shorten_macro("PTR_TO_I64");
}
ConfWriter_end_short_names();
-
+
ConfWriter_end_module();
}
static chaz_bool_t
-S_machine_is_big_endian()
-{
+S_machine_is_big_endian() {
long one = 1;
- return !(*((char *)(&one)));
+ return !(*((char*)(&one)));
}
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.h
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.h?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.h (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Integers.h Sun May 1 23:50:24 2011
@@ -124,7 +124,7 @@
*/
#ifndef H_CHAZ_INTEGERS
-#define H_CHAZ_INTEGERS
+#define H_CHAZ_INTEGERS
#ifdef __cplusplus
extern "C" {
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/LargeFiles.c Sun May 1 23:50:24 2011
@@ -74,7 +74,7 @@ S_probe_pread64(unbuff_combo *combo);
/* Determine whether we can use sparse files.
*/
-static chaz_bool_t
+static chaz_bool_t
S_check_sparse_files();
/* Helper for check_sparse_files().
@@ -97,8 +97,7 @@ static char pread64_command[10];
static char off64_type[10];
void
-LargeFiles_run(void)
-{
+LargeFiles_run(void) {
chaz_bool_t success = false;
chaz_bool_t found_lseek = false;
chaz_bool_t found_pread64 = false;
@@ -138,7 +137,8 @@ LargeFiles_run(void)
found_lseek = S_probe_lseek(&combo);
if (found_lseek) {
strcpy(lseek_command, combo.lseek_command);
- ConfWriter_append_conf("#define chy_lseek64 %s\n", lseek_command);
+ ConfWriter_append_conf("#define chy_lseek64 %s\n",
+ lseek_command);
break;
}
}
@@ -147,7 +147,8 @@ LargeFiles_run(void)
found_pread64 = S_probe_pread64(&combo);
if (found_pread64) {
strcpy(pread64_command, combo.pread64_command);
- ConfWriter_append_conf("#define chy_pread64 %s\n", pread64_command);
+ ConfWriter_append_conf("#define chy_pread64 %s\n",
+ pread64_command);
found_pread64 = true;
break;
}
@@ -186,12 +187,12 @@ LargeFiles_run(void)
}
ConfWriter_end_short_names();
}
-
+
ConfWriter_end_module();
}
/* Code for checking ftello64 and friends. */
-static char off64_code[] =
+static char off64_code[] =
QUOTE( %s )
QUOTE( #include "_charm.h" )
QUOTE( int main() { )
@@ -208,23 +209,22 @@ static char off64_code[] =
static chaz_bool_t
-S_probe_off64(off64_combo *combo)
-{
+S_probe_off64(off64_combo *combo) {
char *output = NULL;
size_t output_len;
- size_t needed = sizeof(off64_code)
- + (2 * strlen(combo->offset64_type))
- + strlen(combo->fopen_command)
- + strlen(combo->ftell_command)
- + strlen(combo->fseek_command)
- + 20;
+ size_t needed = sizeof(off64_code)
+ + (2 * strlen(combo->offset64_type))
+ + strlen(combo->fopen_command)
+ + strlen(combo->ftell_command)
+ + strlen(combo->fseek_command)
+ + 20;
char *code_buf = (char*)malloc(needed);
chaz_bool_t success = false;
/* Prepare the source code. */
- sprintf(code_buf, off64_code, combo->includes, combo->offset64_type,
- combo->fopen_command, combo->offset64_type, combo->ftell_command,
- combo->fseek_command);
+ sprintf(code_buf, off64_code, combo->includes, combo->offset64_type,
+ combo->fopen_command, combo->offset64_type, combo->ftell_command,
+ combo->fseek_command);
/* Verify compilation and that the offset type has 8 bytes. */
output = CC_capture_output(code_buf, strlen(code_buf), &output_len);
@@ -244,7 +244,7 @@ S_probe_off64(off64_combo *combo)
}
/* Code for checking 64-bit lseek. */
-static char lseek_code[] =
+static char lseek_code[] =
QUOTE( %s )
QUOTE( #include "_charm.h" )
QUOTE( int main() { )
@@ -259,12 +259,13 @@ static char lseek_code[] =
QUOTE( } );
static chaz_bool_t
-S_probe_lseek(unbuff_combo *combo)
-{
+S_probe_lseek(unbuff_combo *combo) {
char *output = NULL;
size_t output_len;
- size_t needed = sizeof(lseek_code) + strlen(combo->includes)
- + strlen(combo->lseek_command) + 20;
+ size_t needed = sizeof(lseek_code)
+ + strlen(combo->includes)
+ + strlen(combo->lseek_command)
+ + 20;
char *code_buf = (char*)malloc(needed);
chaz_bool_t success = false;
@@ -286,7 +287,7 @@ S_probe_lseek(unbuff_combo *combo)
/* Code for checking 64-bit pread. The pread call will fail, but that's fine
* as long as it compiles. */
-static char pread64_code[] =
+static char pread64_code[] =
QUOTE( %s )
QUOTE( #include "_charm.h" )
QUOTE( int main() { )
@@ -299,12 +300,13 @@ static char pread64_code[] =
QUOTE( } );
static chaz_bool_t
-S_probe_pread64(unbuff_combo *combo)
-{
+S_probe_pread64(unbuff_combo *combo) {
char *output = NULL;
size_t output_len;
- size_t needed = sizeof(pread64_code) + strlen(combo->includes)
- + strlen(combo->pread64_command) + 20;
+ size_t needed = sizeof(pread64_code)
+ + strlen(combo->includes)
+ + strlen(combo->pread64_command)
+ + 20;
char *code_buf = (char*)malloc(needed);
chaz_bool_t success = false;
@@ -320,9 +322,8 @@ S_probe_pread64(unbuff_combo *combo)
return success;
}
-static chaz_bool_t
-S_check_sparse_files()
-{
+static chaz_bool_t
+S_check_sparse_files() {
Stat st_a, st_b;
/* Bail out if we can't stat() a file. */
@@ -350,23 +351,22 @@ S_check_sparse_files()
else {
return false;
}
-}
+}
static void
-S_test_sparse_file(long offset, Stat *st)
-{
+S_test_sparse_file(long offset, Stat *st) {
FILE *sparse_fh;
/* Make sure the file's not there, then open. */
Util_remove_and_verify("_charm_sparse");
- if ( (sparse_fh = fopen("_charm_sparse", "w+")) == NULL )
+ if ((sparse_fh = fopen("_charm_sparse", "w+")) == NULL)
Util_die("Couldn't open file '_charm_sparse'");
/* Seek fh to [offset], write a byte, close file. */
- if ( (fseek(sparse_fh, offset, SEEK_SET)) == -1) {
+ if ((fseek(sparse_fh, offset, SEEK_SET)) == -1) {
Util_die("seek failed: %s", strerror(errno));
}
- if ( (fprintf(sparse_fh, "X")) != 1 ) {
+ if ((fprintf(sparse_fh, "X")) != 1) {
Util_die("fprintf failed");
}
if (fclose(sparse_fh)) {
@@ -380,35 +380,34 @@ S_test_sparse_file(long offset, Stat *st
}
/* Open a file, seek to a loc, print a char, and communicate success. */
-static char create_bigfile_code[] =
+static char create_bigfile_code[] =
QUOTE( #include "_charm.h" )
QUOTE( int main() { )
QUOTE( FILE *fh = fopen("_charm_large_file_test", "w+"); )
QUOTE( int check_seek; )
QUOTE( Charm_Setup; )
- /* Bail unless seek succeeds. */
+ /* Bail unless seek succeeds. */
QUOTE( check_seek = %s(fh, 5000000000, SEEK_SET); )
QUOTE( if (check_seek == -1) )
QUOTE( exit(1); )
- /* Bail unless we write successfully. */
+ /* Bail unless we write successfully. */
QUOTE( if (fprintf(fh, "X") != 1) )
QUOTE( exit(1); )
QUOTE( if (fclose(fh)) )
QUOTE( exit(1); )
- /* Communicate success to Charmonizer. */
+ /* Communicate success to Charmonizer. */
QUOTE( printf("1"); )
QUOTE( return 0; )
QUOTE( } );
static chaz_bool_t
-S_can_create_big_files()
-{
+S_can_create_big_files() {
char *output;
size_t output_len;
FILE *truncating_fh;
size_t needed = strlen(create_bigfile_code)
- + strlen(fseek_command)
- + 10;
+ + strlen(fseek_command)
+ + 10;
char *code_buf = (char*)malloc(needed);
/* Concat the source strings, compile the file, capture output. */
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.c Sun May 1 23:50:24 2011
@@ -25,16 +25,15 @@
#include <stdio.h>
#include <stdlib.h>
-static char alloca_code[] =
- "#include <%s>\n"
+static char alloca_code[] =
+ "#include <%s>\n"
QUOTE( int main() { )
QUOTE( void *foo = %s(1); )
QUOTE( return 0; )
QUOTE( } );
void
-Memory_run(void)
-{
+Memory_run(void) {
chaz_bool_t has_sys_mman_h = false;
chaz_bool_t has_alloca_h = false;
chaz_bool_t has_malloc_h = false;
@@ -80,7 +79,7 @@ Memory_run(void)
}
if (!has_alloca) {
sprintf(code_buf, alloca_code, "stdio.h", /* stdio.h is filler */
- "__builtin_alloca");
+ "__builtin_alloca");
if (CC_test_compile(code_buf, strlen(code_buf))) {
has_builtin_alloca = true;
ConfWriter_append_conf("#define chy_alloca __builtin_alloca\n");
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.h
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.h?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.h (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/Memory.h Sun May 1 23:50:24 2011
@@ -18,7 +18,7 @@
*/
#ifndef H_CHAZ_MEMORY
-#define H_CHAZ_MEMORY
+#define H_CHAZ_MEMORY
#ifdef __cplusplus
extern "C" {
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.c Sun May 1 23:50:24 2011
@@ -24,10 +24,9 @@
void
-UnusedVars_run(void)
-{
+UnusedVars_run(void) {
ConfWriter_start_module("UnusedVars");
-
+
/* Write the macros (no test, these are the same everywhere). */
ConfWriter_append_conf("#define CHY_UNUSED_VAR(x) ((void)x)\n");
ConfWriter_append_conf("#define CHY_UNREACHABLE_RETURN(type) return (type)0\n");
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.h
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.h?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.h (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/UnusedVars.h Sun May 1 23:50:24 2011
@@ -18,7 +18,7 @@
*/
#ifndef H_CHAZ_UNUSED_VARS
-#define H_CHAZ_UNUSED_VARS
+#define H_CHAZ_UNUSED_VARS
#ifdef __cplusplus
extern "C" {
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.c Sun May 1 23:50:24 2011
@@ -25,7 +25,7 @@
/* Code for verifying ISO-style variadic macros. */
-static char iso_code[] =
+static char iso_code[] =
QUOTE( #include "_charm.h" )
QUOTE( #define ISO_TEST(fmt, ...) \\ )
" printf(fmt, __VA_ARGS__) \n"
@@ -36,7 +36,7 @@ static char iso_code[] =
QUOTE( } );
/* Code for verifying GNU-style variadic macros. */
-static char gnuc_code[] =
+static char gnuc_code[] =
QUOTE( #include "_charm.h" )
QUOTE( #define GNU_TEST(fmt, args...) printf(fmt, ##args) )
QUOTE( int main() { )
@@ -46,8 +46,7 @@ static char gnuc_code[] =
QUOTE( } );
void
-VariadicMacros_run(void)
-{
+VariadicMacros_run(void) {
char *output;
size_t output_len;
chaz_bool_t has_varmacros = false;
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.h
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.h?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.h (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Probe/VariadicMacros.h Sun May 1 23:50:24 2011
@@ -18,7 +18,7 @@
*/
#ifndef H_CHAZ_VARIADIC_MACROS
-#define H_CHAZ_VARIADIC_MACROS
+#define H_CHAZ_VARIADIC_MACROS
#ifdef __cplusplus
extern "C" {
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Test.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Test.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Test.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Test.c Sun May 1 23:50:24 2011
@@ -43,17 +43,16 @@ Test_init(void) {
}
}
-TestBatch*
+TestBatch*
Test_new_batch(const char *batch_name, unsigned num_tests,
- TestBatch_test_func_t test_func)
-{
+ TestBatch_test_func_t test_func) {
TestBatch *batch = (TestBatch*)malloc(sizeof(TestBatch));
/* Assign. */
batch->num_tests = num_tests;
batch->name = strdup(batch_name);
batch->test_func = test_func;
-
+
/* Initialize. */
batch->test_num = 0;
batch->num_passed = 0;
@@ -66,21 +65,18 @@ Test_new_batch(const char *batch_name, u
}
void
-Test_plan(TestBatch *batch)
-{
+Test_plan(TestBatch *batch) {
printf("1..%u\n", batch->num_tests);
}
static void
-S_TestBatch_destroy(TestBatch *batch)
-{
+S_TestBatch_destroy(TestBatch *batch) {
free(batch->name);
free(batch);
}
static void
-S_TestBatch_run_test(TestBatch *batch)
-{
+S_TestBatch_run_test(TestBatch *batch) {
/* Print start. */
PLAN(batch);
@@ -89,8 +85,7 @@ S_TestBatch_run_test(TestBatch *batch)
}
void
-Test_test_true(TestBatch *batch, int value, const char *pat, ...)
-{
+Test_test_true(TestBatch *batch, int value, const char *pat, ...) {
va_list args;
/* Increment test number. */
@@ -105,13 +100,12 @@ Test_test_true(TestBatch *batch, int val
printf("not ok %u - ", batch->test_num);
batch->num_failed++;
}
-
+
PRINT_SUPPLIED_MESS(pat, args);
}
void
-Test_test_false(TestBatch *batch, int value, const char *pat, ...)
-{
+Test_test_false(TestBatch *batch, int value, const char *pat, ...) {
va_list args;
/* Increment test number. */
@@ -126,37 +120,35 @@ Test_test_false(TestBatch *batch, int va
printf("not ok %u - ", batch->test_num);
batch->num_failed++;
}
-
+
PRINT_SUPPLIED_MESS(pat, args);
}
-void
-Test_test_str_eq(TestBatch *batch, const char *got, const char *expected,
- const char *pat, ...)
-{
+void
+Test_test_str_eq(TestBatch *batch, const char *got, const char *expected,
+ const char *pat, ...) {
va_list args;
-
+
/* Increment test number. */
batch->test_num++;
-
+
/* Test condition and pass or fail. */
if (strcmp(expected, got) == 0) {
printf("ok %u - ", batch->test_num);
batch->num_passed++;
}
else {
- printf("not ok %u - Expected '%s', got '%s'\n ", batch->test_num,
- expected, got);
+ printf("not ok %u - Expected '%s', got '%s'\n ", batch->test_num,
+ expected, got);
batch->num_failed++;
}
-
+
PRINT_SUPPLIED_MESS(pat, args);
}
-void
-Test_pass(TestBatch *batch, const char *pat, ...)
-{
+void
+Test_pass(TestBatch *batch, const char *pat, ...) {
va_list args;
/* Increment test number. */
@@ -169,9 +161,8 @@ Test_pass(TestBatch *batch, const char *
PRINT_SUPPLIED_MESS(pat, args);
}
-void
-Test_fail(TestBatch *batch, const char *pat, ...)
-{
+void
+Test_fail(TestBatch *batch, const char *pat, ...) {
va_list args;
/* Increment test number. */
@@ -184,10 +175,9 @@ Test_fail(TestBatch *batch, const char *
PRINT_SUPPLIED_MESS(pat, args);
}
-void
-Test_test_int_eq(TestBatch *batch, long got, long expected,
- const char *pat, ...)
-{
+void
+Test_test_int_eq(TestBatch *batch, long got, long expected,
+ const char *pat, ...) {
va_list args;
/* Increment test number. */
@@ -198,41 +188,39 @@ Test_test_int_eq(TestBatch *batch, long
batch->num_passed++;
}
else {
- printf("not ok %u - Expected '%ld', got '%ld'\n ", batch->test_num,
- expected, got);
+ printf("not ok %u - Expected '%ld', got '%ld'\n ", batch->test_num,
+ expected, got);
batch->num_failed++;
}
-
+
PRINT_SUPPLIED_MESS(pat, args);
}
-void
-Test_test_float_eq(TestBatch *batch, double got, double expected,
- const char *pat, ...)
-{
+void
+Test_test_float_eq(TestBatch *batch, double got, double expected,
+ const char *pat, ...) {
va_list args;
- double diff = expected/got;
+ double diff = expected / got;
/* Increment test number. */
batch->test_num++;
-
+
/* Evaluate condition and pass or fail. */
if (diff > 0.00001) {
printf("ok %u - ", batch->test_num);
batch->num_passed++;
}
else {
- printf("not ok %u - Expected '%f', got '%f'\n ", batch->test_num,
- expected, got);
+ printf("not ok %u - Expected '%f', got '%f'\n ", batch->test_num,
+ expected, got);
batch->num_failed++;
}
-
+
PRINT_SUPPLIED_MESS(pat, args);
}
void
-Test_skip(TestBatch *batch, const char *pat, ...)
-{
+Test_skip(TestBatch *batch, const char *pat, ...) {
va_list args;
/* Increment test number. */
@@ -246,11 +234,10 @@ Test_skip(TestBatch *batch, const char *
}
void
-Test_report_skip_remaining(TestBatch *batch, const char *pat, ...)
-{
+Test_report_skip_remaining(TestBatch *batch, const char *pat, ...) {
va_list args;
unsigned remaining = batch->num_tests - batch->test_num;
-
+
/* Indicate that tests are being skipped, update skip counter. */
printf("# Skipping all %u remaining tests: ", remaining);
PRINT_SUPPLIED_MESS(pat, args);
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Test.h
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Test.h?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Test.h (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Test.h Sun May 1 23:50:24 2011
@@ -49,7 +49,7 @@ struct chaz_TestBatch {
unsigned test_num;
unsigned num_tests;
unsigned num_passed;
- unsigned num_failed;
+ unsigned num_failed;
unsigned num_skipped;
chaz_TestBatch_destroy_t destroy;
chaz_TestBatch_test_func_t test_func;
@@ -63,7 +63,7 @@ chaz_Test_init(void);
/* Constructor for TestBatch.
*/
-chaz_TestBatch*
+chaz_TestBatch*
chaz_Test_new_batch(const char *batch_name, unsigned num_tests,
chaz_TestBatch_test_func_t test_func);
@@ -81,7 +81,7 @@ chaz_Test_new_batch(const char *batch_na
/* Print a message indicating that a test was skipped and update batch.
*/
#define CHAZ_TEST_SKIP(batch, message) \
- chaz_Test_skip(batch, message)
+ chaz_Test_skip(batch, message)
/* Print a message indicating that all remaining tests will be skipped and
* return.
@@ -95,37 +95,37 @@ chaz_Test_new_batch(const char *batch_na
void
chaz_Test_plan(chaz_TestBatch *batch);
-void
-chaz_Test_test_true(chaz_TestBatch *batch, int expression,
+void
+chaz_Test_test_true(chaz_TestBatch *batch, int expression,
const char *pat, ...);
-void
-chaz_Test_test_false(chaz_TestBatch *batch, int expression,
+void
+chaz_Test_test_false(chaz_TestBatch *batch, int expression,
const char *pat, ...);
-void
-chaz_Test_test_str_eq(chaz_TestBatch *batch, const char *got,
+void
+chaz_Test_test_str_eq(chaz_TestBatch *batch, const char *got,
const char *expected, const char *pat, ...);
-void
+void
chaz_Test_pass(chaz_TestBatch *batch, const char *pat, ...);
-void
+void
chaz_Test_fail(chaz_TestBatch *batch, const char *pat, ...);
-void
-chaz_Test_test_int_eq(chaz_TestBatch *batch, long got, long expected,
+void
+chaz_Test_test_int_eq(chaz_TestBatch *batch, long got, long expected,
const char *pat, ...);
-void
-chaz_Test_test_float_eq(chaz_TestBatch *batch, double got,
+void
+chaz_Test_test_float_eq(chaz_TestBatch *batch, double got,
double expected, const char *pat, ...);
void
chaz_Test_skip(chaz_TestBatch *batch, const char *pat, ...);
void
-chaz_Test_report_skip_remaining(chaz_TestBatch* batch,
+chaz_Test_report_skip_remaining(chaz_TestBatch* batch,
const char *pat, ...);
#ifdef CHAZ_USE_SHORT_NAMES
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.c Sun May 1 23:50:24 2011
@@ -19,12 +19,11 @@
#include <stdlib.h>
#include <stdio.h>
#include "Charmonizer/Test/AllTests.h"
-
+
static TestBatch **batches = NULL;
void
-AllTests_init()
-{
+AllTests_init() {
Test_init();
/* Create a null-terminated array of test batches to iterate over. */
@@ -40,14 +39,13 @@ AllTests_init()
}
void
-AllTests_run()
-{
+AllTests_run() {
int total_tests = 0;
int total_passed = 0;
int total_failed = 0;
int total_skipped = 0;
int i;
-
+
/* Sanity check. */
if (batches == NULL) {
fprintf(stderr, "Must call AllTests_init() first.");
@@ -64,12 +62,12 @@ AllTests_run()
total_skipped += batch->num_skipped;
batch->destroy(batch);
}
-
+
/* Print totals. */
printf("=============================\n");
printf("TOTAL TESTS: %d\nTOTAL PASSED: %d\nTOTAL FAILED: %d\n"
- "TOTAL SKIPPED: %d\n",
- total_tests, total_passed, total_failed, total_skipped);
+ "TOTAL SKIPPED: %d\n",
+ total_tests, total_passed, total_failed, total_skipped);
}
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.h
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.h?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.h (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/AllTests.h Sun May 1 23:50:24 2011
@@ -49,25 +49,25 @@ chaz_AllTests_run();
* fallbacks.
*/
-chaz_TestBatch*
+chaz_TestBatch*
chaz_TestDirManip_prepare();
-chaz_TestBatch*
+chaz_TestBatch*
chaz_TestFuncMacro_prepare();
-chaz_TestBatch*
+chaz_TestBatch*
chaz_TestHeaders_prepare();
-chaz_TestBatch*
+chaz_TestBatch*
chaz_TestIntegers_prepare();
-chaz_TestBatch*
+chaz_TestBatch*
chaz_TestLargeFiles_prepare();
-chaz_TestBatch*
+chaz_TestBatch*
chaz_TestUnusedVars_prepare();
-chaz_TestBatch*
+chaz_TestBatch*
chaz_TestVariadicMacros_prepare();
void
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestDirManip.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestDirManip.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestDirManip.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestDirManip.c Sun May 1 23:50:24 2011
@@ -38,19 +38,17 @@
#endif
TestBatch*
-TestDirManip_prepare()
-{
+TestDirManip_prepare() {
return Test_new_batch("Integers", 6, TestDirManip_run);
}
void
-TestDirManip_run(TestBatch *batch)
-{
+TestDirManip_run(TestBatch *batch) {
TEST_INT_EQ(batch, 0, makedir("_chaz_test_dir", 0777), "makedir");
TEST_INT_EQ(batch, 0, makedir("_chaz_test_dir" DIR_SEP "deep", 0777),
- "makedir with DIR_SEP");
+ "makedir with DIR_SEP");
TEST_INT_EQ(batch, 0, rmdir("_chaz_test_dir" DIR_SEP "deep"),
- "rmdir with DIR_SEP");
+ "rmdir with DIR_SEP");
TEST_INT_EQ(batch, 0, rmdir("_chaz_test_dir"), "rmdir");
#ifdef CHY_HAS_DIRENT_D_NAMLEN
{
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestFuncMacro.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestFuncMacro.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestFuncMacro.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestFuncMacro.c Sun May 1 23:50:24 2011
@@ -22,39 +22,36 @@
#include "Charmonizer/Test/AllTests.h"
TestBatch*
-TestFuncMacro_prepare()
-{
+TestFuncMacro_prepare() {
return Test_new_batch("FuncMacro", 4, TestFuncMacro_run);
}
#ifdef INLINE
-static INLINE char* S_inline_function()
-{
+static INLINE char* S_inline_function() {
return "inline works";
}
#endif
void
-TestFuncMacro_run(TestBatch *batch)
-{
+TestFuncMacro_run(TestBatch *batch) {
#ifdef HAS_FUNC_MACRO
- TEST_STR_EQ(batch, FUNC_MACRO, "chaz_TestFuncMacro_run",
- "FUNC_MACRO");
+ TEST_STR_EQ(batch, FUNC_MACRO, "chaz_TestFuncMacro_run",
+ "FUNC_MACRO");
#else
SKIP(batch, "no FUNC_MACRO");
#endif
#ifdef HAS_ISO_FUNC_MACRO
TEST_STR_EQ(batch, __func__, "chaz_TestFuncMacro_run",
- "HAS_ISO_FUNC_MACRO");
+ "HAS_ISO_FUNC_MACRO");
#else
SKIP(batch, "no ISO_FUNC_MACRO");
#endif
#ifdef HAS_GNUC_FUNC_MACRO
- TEST_STR_EQ(batch, __FUNCTION__, "chaz_TestFuncMacro_run",
- "HAS_GNUC_FUNC_MACRO");
+ TEST_STR_EQ(batch, __FUNCTION__, "chaz_TestFuncMacro_run",
+ "HAS_GNUC_FUNC_MACRO");
#else
SKIP(batch, "no GNUC_FUNC_MACRO");
#endif
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestHeaders.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestHeaders.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestHeaders.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestHeaders.c Sun May 1 23:50:24 2011
@@ -146,14 +146,12 @@
#endif
TestBatch*
-TestHeaders_prepare()
-{
+TestHeaders_prepare() {
return Test_new_batch("Headers", 2, TestHeaders_run);
}
void
-TestHeaders_run(TestBatch *batch)
-{
+TestHeaders_run(TestBatch *batch) {
PASS(batch, "Compiled successfully with all detected headers");
/* Don't bother checking all -- just use stdio as an example. */
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestIntegers.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestIntegers.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestIntegers.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestIntegers.c Sun May 1 23:50:24 2011
@@ -26,16 +26,14 @@
#endif
TestBatch*
-TestIntegers_prepare()
-{
+TestIntegers_prepare() {
return Test_new_batch("Integers", 37, TestIntegers_run);
}
void
-TestIntegers_run(TestBatch *batch)
-{
+TestIntegers_run(TestBatch *batch) {
{
- long one= 1;
+ long one = 1;
long big_endian = !(*((char *)(&one)));
#ifdef BIG_END
TEST_TRUE(batch, big_endian, "BIG_END");
@@ -47,7 +45,7 @@ TestIntegers_run(TestBatch *batch)
#endif
#endif
}
-
+
TEST_INT_EQ(batch, SIZEOF_CHAR, sizeof(char), "SIZEOF_CHAR");
TEST_INT_EQ(batch, SIZEOF_SHORT, sizeof(short), "SIZEOF_SHORT");
TEST_INT_EQ(batch, SIZEOF_INT, sizeof(int), "SIZEOF_INT");
@@ -55,10 +53,10 @@ TestIntegers_run(TestBatch *batch)
TEST_INT_EQ(batch, SIZEOF_PTR, sizeof(void*), "SIZEOF_PTR");
#ifdef HAS_LONG_LONG
- TEST_INT_EQ(batch, SIZEOF_LONG_LONG, sizeof(long long),
- "HAS_LONG_LONG and SIZEOF_LONG_LONG");
+ TEST_INT_EQ(batch, SIZEOF_LONG_LONG, sizeof(long long),
+ "HAS_LONG_LONG and SIZEOF_LONG_LONG");
#endif
-
+
#ifdef HAS_INTTYPES_H
TEST_INT_EQ(batch, sizeof(int8_t), 1, "HAS_INTTYPES_H");
#else
@@ -116,8 +114,8 @@ TestIntegers_run(TestBatch *batch)
int64_t foo = -100;
uint64_t bar = U64_C(18000000000000000000);
TEST_TRUE(batch, (foo == -100), "int64_t is signed");
- TEST_TRUE(batch, (bar == U64_C(18000000000000000000)),
- "uint64_t is unsigned");
+ TEST_TRUE(batch, (bar == U64_C(18000000000000000000)),
+ "uint64_t is unsigned");
TEST_TRUE(batch, (sizeof(int64_t) == 8), "int64_t is 8 bytes");
TEST_TRUE(batch, (sizeof(uint64_t) == 8), "uint64_t is 8 bytes");
sprintf(buf, "%"I64P, foo);
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestLargeFiles.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestLargeFiles.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestLargeFiles.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestLargeFiles.c Sun May 1 23:50:24 2011
@@ -27,14 +27,12 @@
#include "Charmonizer/Test/AllTests.h"
TestBatch*
-TestLargeFiles_prepare()
-{
+TestLargeFiles_prepare() {
return Test_new_batch("LargeFiles", 10, TestLargeFiles_run);
}
void
-TestLargeFiles_run(TestBatch *batch)
-{
+TestLargeFiles_run(TestBatch *batch) {
FILE *fh;
off64_t offset;
int check_val;
@@ -43,7 +41,7 @@ TestLargeFiles_run(TestBatch *batch)
/* A little over 4 GB, and a little over 2 GB. */
off64_t gb4_plus = ((off64_t)0x7FFFFFFF << 1) + 100;
off64_t gb2_plus = (off64_t)0x7FFFFFFF + 200;
-
+
/* Gb4_plus modulo 4 GB (wrap is intentional). */
i32_t wrap_gb4 = (i32_t)gb4_plus;
@@ -53,7 +51,8 @@ TestLargeFiles_run(TestBatch *batch)
SKIP_REMAINING(batch, "No large file support");
#endif
#ifndef CHAZ_HAS_SPARSE_FILES
- SKIP_REMAINING(batch, "Can't verify large file support without sparse files");
+ SKIP_REMAINING(batch,
+ "Can't verify large file support without sparse files");
#endif
#ifndef CHAZ_CAN_CREATE_BIG_FILES
SKIP_REMAINING(batch, "Unsafe to create 5GB sparse files on this system");
@@ -94,8 +93,8 @@ TestLargeFiles_run(TestBatch *batch)
/* Truncate, just in case the call to remove fails. */
fh = fopen64("_charm_large_file_test", "w+");
- if (fh != NULL) {
- fclose(fh);
+ if (fh != NULL) {
+ fclose(fh);
}
remove("_charm_large_file_test");
}
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestUnusedVars.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestUnusedVars.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestUnusedVars.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestUnusedVars.c Sun May 1 23:50:24 2011
@@ -21,13 +21,11 @@
#include "Charmonizer/Test/AllTests.h"
TestBatch*
-TestUnusedVars_prepare()
-{
+TestUnusedVars_prepare() {
return Test_new_batch("UnusedVars", 2, TestUnusedVars_run);
}
void
-TestUnusedVars_run(TestBatch *batch)
-{
+TestUnusedVars_run(TestBatch *batch) {
#ifdef UNUSED_VAR
PASS(batch, "UNUSED_VAR macro is defined");
#else
Modified: incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestVariadicMacros.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestVariadicMacros.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestVariadicMacros.c (original)
+++ incubator/lucy/trunk/charmonizer/src/Charmonizer/Test/TestVariadicMacros.c Sun May 1 23:50:24 2011
@@ -23,21 +23,19 @@
#include "Charmonizer/Test/AllTests.h"
TestBatch*
-TestVariadicMacros_prepare()
-{
+TestVariadicMacros_prepare() {
return Test_new_batch("VariadicMacros", 4, TestVariadicMacros_run);
}
void
-TestVariadicMacros_run(TestBatch *batch)
-{
+TestVariadicMacros_run(TestBatch *batch) {
char buf[10];
chaz_bool_t really_has_var_macs = false;
#if defined(HAS_ISO_VARIADIC_MACROS) || defined(HAS_GNUC_VARIADIC_MACROS)
#ifdef HAS_VARIADIC_MACROS
PASS(batch, "#defines agree");
- #else
+ #else
FAIL(batch, 0, "#defines agree");
#endif
#else
Modified: incubator/lucy/trunk/clownfish/lib/Clownfish.xs
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/lib/Clownfish.xs?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/lib/Clownfish.xs (original)
+++ incubator/lucy/trunk/clownfish/lib/Clownfish.xs Sun May 1 23:50:24 2011
@@ -41,16 +41,15 @@
default: croak("Internal error. ix: %d", ix); \
} \
if (ix % 2 == 0) { \
- XPUSHs( sv_2mortal(retval) ); \
+ XPUSHs(sv_2mortal(retval)); \
XSRETURN(1); \
} \
else { \
XSRETURN(0); \
- }
+ }
static SV*
-S_cfcbase_to_perlref(void *thing)
-{
+S_cfcbase_to_perlref(void *thing) {
if (thing) {
SV *perl_obj = (SV*)CFCBase_get_perl_obj((CFCBase*)thing);
return newRV(perl_obj);
@@ -62,8 +61,7 @@ S_cfcbase_to_perlref(void *thing)
// Transform a NULL-terminated array of CFCBase* into a Perl arrayref.
static SV*
-S_array_of_cfcbase_to_av(CFCBase **things)
-{
+S_array_of_cfcbase_to_av(CFCBase **things) {
AV *av = newAV();
size_t i;
for (i = 0; things[i] != NULL; i++) {
@@ -125,21 +123,21 @@ _create(klass, parcel, exposure_sv, clas
bool is_final;
bool is_inert;
CODE:
- const char *exposure = SvOK(exposure_sv)
- ? SvPV_nolen(exposure_sv) : NULL;
- const char *class_name = SvOK(class_name_sv)
- ? SvPV_nolen(class_name_sv) : NULL;
- const char *cnick = SvOK(cnick_sv)
- ? SvPV_nolen(cnick_sv) : NULL;
- const char *micro_sym = SvOK(micro_sym_sv)
- ? SvPV_nolen(micro_sym_sv) : NULL;
- const char *source_class = SvOK(source_class_sv)
- ? SvPV_nolen(source_class_sv) : NULL;
- const char *parent_class_name = SvOK(parent_class_name_sv)
- ? SvPV_nolen(parent_class_name_sv) : NULL;
+ const char *exposure =
+ SvOK(exposure_sv) ? SvPV_nolen(exposure_sv) : NULL;
+ const char *class_name =
+ SvOK(class_name_sv) ? SvPV_nolen(class_name_sv) : NULL;
+ const char *cnick =
+ SvOK(cnick_sv) ? SvPV_nolen(cnick_sv) : NULL;
+ const char *micro_sym =
+ SvOK(micro_sym_sv) ? SvPV_nolen(micro_sym_sv) : NULL;
+ const char *source_class =
+ SvOK(source_class_sv) ? SvPV_nolen(source_class_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, cnick,
- micro_sym, docucomment, source_class, parent_class_name, is_final,
- is_inert);
+ micro_sym, docucomment, source_class,
+ parent_class_name, is_final, is_inert);
RETVAL = S_cfcbase_to_perlref(self);
CFCBase_decref((CFCBase*)self);
OUTPUT: RETVAL
@@ -167,7 +165,7 @@ PPCODE:
void
_clear_registry(...)
-PPCODE:
+PPCODE:
CFCClass_clear_registry();
void
@@ -275,7 +273,7 @@ ALIAS:
final = 14
inert = 16
get_struct_sym = 18
- full_struct_sym = 20
+ full_struct_sym = 20
short_vtable_var = 22
full_vtable_var = 24
full_vtable_type = 26
@@ -299,9 +297,9 @@ PPCODE:
break;
case 5: {
CFCClass *parent = NULL;
- if ( SvOK(ST(1))
+ if (SvOK(ST(1))
&& sv_derived_from(ST(1), "Clownfish::Class")
- ) {
+ ) {
IV objint = SvIV((SV*)SvRV(ST(1)));
parent = INT2PTR(CFCClass*, objint);
}
@@ -369,44 +367,40 @@ PPCODE:
retval = S_cfcbase_to_perlref(docucomment);
}
break;
- case 32:
+ case 32:
retval = S_array_of_cfcbase_to_av(
(CFCBase**)CFCClass_children(self));
break;
- case 34:
- retval = S_array_of_cfcbase_to_av(
- (CFCBase**)CFCClass_functions(self));
+ case 34:
+ retval = S_array_of_cfcbase_to_av((CFCBase**)CFCClass_functions(self));
break;
case 36:
- retval = S_array_of_cfcbase_to_av(
- (CFCBase**)CFCClass_methods(self));
+ retval = S_array_of_cfcbase_to_av((CFCBase**)CFCClass_methods(self));
break;
case 38:
- retval = S_array_of_cfcbase_to_av(
- (CFCBase**)CFCClass_member_vars(self));
+ retval = S_array_of_cfcbase_to_av((CFCBase**)CFCClass_member_vars(self));
break;
case 40:
- retval = S_array_of_cfcbase_to_av(
- (CFCBase**)CFCClass_inert_vars(self));
+ retval = S_array_of_cfcbase_to_av((CFCBase**)CFCClass_inert_vars(self));
break;
case 42: {
- CFCClass **ladder = CFCClass_tree_to_ladder(self);
- retval = S_array_of_cfcbase_to_av((CFCBase**)ladder);
- FREEMEM(ladder);
- break;
- }
+ CFCClass **ladder = CFCClass_tree_to_ladder(self);
+ retval = S_array_of_cfcbase_to_av((CFCBase**)ladder);
+ FREEMEM(ladder);
+ break;
+ }
case 44: {
- CFCMethod **novel = CFCClass_novel_methods(self);
- retval = S_array_of_cfcbase_to_av((CFCBase**)novel);
- FREEMEM(novel);
- break;
- }
+ CFCMethod **novel = CFCClass_novel_methods(self);
+ retval = S_array_of_cfcbase_to_av((CFCBase**)novel);
+ FREEMEM(novel);
+ break;
+ }
case 46: {
- CFCVariable **novel = CFCClass_novel_member_vars(self);
- retval = S_array_of_cfcbase_to_av((CFCBase**)novel);
- FREEMEM(novel);
- break;
- }
+ CFCVariable **novel = CFCClass_novel_member_vars(self);
+ retval = S_array_of_cfcbase_to_av((CFCBase**)novel);
+ FREEMEM(novel);
+ break;
+ }
END_SET_OR_GET_SWITCH
}
@@ -458,29 +452,29 @@ PPCODE:
}
break;
case 8: {
- AV *av = newAV();
- const char **names = CFCDocuComment_get_param_names(self);
- size_t i;
- for (i = 0; names[i] != NULL; i++) {
- SV *val_sv = newSVpvn(names[i], strlen(names[i]));
- av_store(av, i, val_sv);
+ AV *av = newAV();
+ const char **names = CFCDocuComment_get_param_names(self);
+ size_t i;
+ for (i = 0; names[i] != NULL; i++) {
+ SV *val_sv = newSVpvn(names[i], strlen(names[i]));
+ av_store(av, i, val_sv);
+ }
+ retval = newRV((SV*)av);
+ SvREFCNT_dec(av);
+ break;
}
- retval = newRV((SV*)av);
- SvREFCNT_dec(av);
- break;
- }
case 10: {
- AV *av = newAV();
- const char **docs = CFCDocuComment_get_param_docs(self);
- size_t i;
- for (i = 0; docs[i] != NULL; i++) {
- SV *val_sv = newSVpvn(docs[i], strlen(docs[i]));
- av_store(av, i, val_sv);
+ AV *av = newAV();
+ const char **docs = CFCDocuComment_get_param_docs(self);
+ size_t i;
+ for (i = 0; docs[i] != NULL; i++) {
+ SV *val_sv = newSVpvn(docs[i], strlen(docs[i]));
+ av_store(av, i, val_sv);
+ }
+ retval = newRV((SV*)av);
+ SvREFCNT_dec(av);
+ break;
}
- retval = newRV((SV*)av);
- SvREFCNT_dec(av);
- break;
- }
case 12: {
const char *rv = CFCDocuComment_get_retval(self);
retval = rv ? newSVpvn(rv, strlen(rv)) : newSV(0);
@@ -548,16 +542,16 @@ ALIAS:
get_source_class = 4
guard_name = 6
guard_start = 8
- guard_close = 10
+ guard_close = 10
blocks = 12
classes = 14
PPCODE:
{
START_SET_OR_GET_SWITCH
- case 1:
+ case 1:
CFCFile_set_modified(self, !!SvTRUE(ST(1)));
break;
- case 2:
+ case 2:
retval = newSViv(CFCFile_get_modified(self));
break;
case 4: {
@@ -585,7 +579,7 @@ PPCODE:
break;
case 14:
retval = S_array_of_cfcbase_to_av(
- (CFCBase**)CFCFile_classes(self));
+ (CFCBase**)CFCFile_classes(self));
break;
END_SET_OR_GET_SWITCH
}
@@ -604,14 +598,14 @@ CODE:
RETVAL = newSV(buf_size);
SvPOK_on(RETVAL);
char *buf = SvPVX(RETVAL);
- switch(ix) {
- case 1:
+ switch (ix) {
+ case 1:
CFCFile_c_path(self, buf, buf_size, base_dir);
break;
- case 2:
+ case 2:
CFCFile_h_path(self, buf, buf_size, base_dir);
break;
- case 3:
+ case 3:
CFCFile_cfh_path(self, buf, buf_size, base_dir);
break;
default:
@@ -637,16 +631,17 @@ _new(klass, parcel, exposure_sv, class_n
CFCDocuComment *docucomment;
int is_inline;
CODE:
- const char *exposure = SvOK(exposure_sv)
- ? SvPV_nolen(exposure_sv) : NULL;
- const char *class_name = SvOK(class_name_sv)
- ? SvPV_nolen(class_name_sv) : NULL;
- const char *class_cnick = SvOK(class_cnick_sv)
- ? SvPV_nolen(class_cnick_sv) : NULL;
- const char *micro_sym = SvOK(micro_sym_sv)
- ? SvPV_nolen(micro_sym_sv) : NULL;
- CFCFunction *self = CFCFunction_new(parcel, exposure, class_name, class_cnick,
- micro_sym, return_type, param_list, docucomment, is_inline);
+ const char *exposure =
+ SvOK(exposure_sv) ? SvPV_nolen(exposure_sv) : NULL;
+ const char *class_name =
+ SvOK(class_name_sv) ? SvPV_nolen(class_name_sv) : NULL;
+ const char *class_cnick =
+ SvOK(class_cnick_sv) ? SvPV_nolen(class_cnick_sv) : NULL;
+ const char *micro_sym =
+ SvOK(micro_sym_sv) ? SvPV_nolen(micro_sym_sv) : NULL;
+ CFCFunction *self = CFCFunction_new(parcel, exposure, class_name,
+ class_cnick, micro_sym, return_type,
+ param_list, docucomment, is_inline);
RETVAL = S_cfcbase_to_perlref(self);
CFCBase_decref((CFCBase*)self);
OUTPUT: RETVAL
@@ -682,7 +677,7 @@ PPCODE:
}
break;
case 6: {
- CFCDocuComment *docucomment
+ CFCDocuComment *docucomment
= CFCFunction_get_docucomment(self);
retval = S_cfcbase_to_perlref(docucomment);
}
@@ -791,15 +786,15 @@ _new(klass, parcel, exposure_sv, class_n
int is_final;
int is_abstract;
CODE:
- const char *exposure = SvOK(exposure_sv)
- ? SvPV_nolen(exposure_sv) : NULL;
- const char *class_name = SvOK(class_name_sv)
- ? SvPV_nolen(class_name_sv) : NULL;
- const char *class_cnick = SvOK(class_cnick_sv)
- ? SvPV_nolen(class_cnick_sv) : NULL;
+ const char *exposure =
+ SvOK(exposure_sv) ? SvPV_nolen(exposure_sv) : NULL;
+ const char *class_name =
+ SvOK(class_name_sv) ? SvPV_nolen(class_name_sv) : NULL;
+ const char *class_cnick =
+ SvOK(class_cnick_sv) ? SvPV_nolen(class_cnick_sv) : NULL;
CFCMethod *self = CFCMethod_new(parcel, exposure, class_name, class_cnick,
- macro_sym, return_type, param_list, docucomment, is_final,
- is_abstract);
+ macro_sym, return_type, param_list,
+ docucomment, is_final, is_abstract);
RETVAL = S_cfcbase_to_perlref(self);
CFCBase_decref((CFCBase*)self);
OUTPUT: RETVAL
@@ -844,25 +839,31 @@ ALIAS:
full_offset_sym = 3
CODE:
size_t size = 0;
- switch(ix) {
- case 1: size = CFCMethod_short_method_sym(self, invoker, NULL, 0);
- break;
- case 2: size = CFCMethod_full_method_sym(self, invoker, NULL, 0);
- break;
- case 3: size = CFCMethod_full_offset_sym(self, invoker, NULL, 0);
- break;
+ switch (ix) {
+ case 1:
+ size = CFCMethod_short_method_sym(self, invoker, NULL, 0);
+ break;
+ case 2:
+ size = CFCMethod_full_method_sym(self, invoker, NULL, 0);
+ break;
+ case 3:
+ size = CFCMethod_full_offset_sym(self, invoker, NULL, 0);
+ break;
default: croak("Unexpected ix: %d", ix);
}
RETVAL = newSV(size);
SvPOK_on(RETVAL);
char *buf = SvPVX(RETVAL);
- switch(ix) {
- case 1: CFCMethod_short_method_sym(self, invoker, buf, size);
- break;
- case 2: CFCMethod_full_method_sym(self, invoker, buf, size);
- break;
- case 3: CFCMethod_full_offset_sym(self, invoker, buf, size);
- break;
+ switch (ix) {
+ case 1:
+ CFCMethod_short_method_sym(self, invoker, buf, size);
+ break;
+ case 2:
+ CFCMethod_full_method_sym(self, invoker, buf, size);
+ break;
+ case 3:
+ CFCMethod_full_offset_sym(self, invoker, buf, size);
+ break;
default: croak("Unexpected ix: %d", ix);
}
SvCUR_set(RETVAL, strlen(buf));
@@ -968,36 +969,36 @@ PPCODE:
{
START_SET_OR_GET_SWITCH
case 2: {
- AV *av = newAV();
- CFCVariable **vars = CFCParamList_get_variables(self);
- size_t i;
- size_t num_vars = CFCParamList_num_vars(self);
- for (i = 0; i < num_vars; i++) {
- SV *ref = S_cfcbase_to_perlref(vars[i]);
- av_store(av, i, ref);
+ AV *av = newAV();
+ CFCVariable **vars = CFCParamList_get_variables(self);
+ size_t i;
+ size_t num_vars = CFCParamList_num_vars(self);
+ for (i = 0; i < num_vars; i++) {
+ SV *ref = S_cfcbase_to_perlref(vars[i]);
+ av_store(av, i, ref);
+ }
+ retval = newRV((SV*)av);
+ SvREFCNT_dec(av);
+ break;
}
- retval = newRV((SV*)av);
- SvREFCNT_dec(av);
- break;
- }
case 4: {
- AV *av = newAV();
- const char **values = CFCParamList_get_initial_values(self);
- size_t i;
- size_t num_vars = CFCParamList_num_vars(self);
- for (i = 0; i < num_vars; i++) {
- if (values[i] != NULL) {
- SV *val_sv = newSVpvn(values[i], strlen(values[i]));
- av_store(av, i, val_sv);
- }
- else {
- av_store(av, i, newSV(0));
+ AV *av = newAV();
+ const char **values = CFCParamList_get_initial_values(self);
+ size_t i;
+ size_t num_vars = CFCParamList_num_vars(self);
+ for (i = 0; i < num_vars; i++) {
+ if (values[i] != NULL) {
+ SV *val_sv = newSVpvn(values[i], strlen(values[i]));
+ av_store(av, i, val_sv);
+ }
+ else {
+ av_store(av, i, newSV(0));
+ }
}
+ retval = newRV((SV*)av);
+ SvREFCNT_dec(av);
+ break;
}
- retval = newRV((SV*)av);
- SvREFCNT_dec(av);
- break;
- }
case 6:
retval = newSViv(CFCParamList_variadic(self));
break;
@@ -1110,16 +1111,19 @@ _new(klass, parcel, exposure, class_name
SV *class_cnick_sv;
SV *micro_sym_sv;
CODE:
- const char *class_name = SvOK(class_name_sv)
- ? SvPV_nolen(class_name_sv) : NULL;
- const char *class_cnick = SvOK(class_cnick_sv)
- ? SvPV_nolen(class_cnick_sv) : NULL;
- const char *micro_sym = SvOK(micro_sym_sv)
- ? SvPV_nolen(micro_sym_sv) : NULL;
+ const char *class_name = SvOK(class_name_sv)
+ ? SvPV_nolen(class_name_sv)
+ : NULL;
+ const char *class_cnick = SvOK(class_cnick_sv)
+ ? SvPV_nolen(class_cnick_sv)
+ : NULL;
+ const char *micro_sym = SvOK(micro_sym_sv)
+ ? SvPV_nolen(micro_sym_sv)
+ : NULL;
CFCSymbol *self = CFCSymbol_new(parcel, exposure, class_name, class_cnick,
- micro_sym);
+ micro_sym);
RETVAL = newSV(0);
- sv_setref_pv(RETVAL, klass, (void*)self);
+ sv_setref_pv(RETVAL, klass, (void*)self);
OUTPUT: RETVAL
int
@@ -1164,16 +1168,16 @@ PPCODE:
break;
case 4: {
const char *class_name = CFCSymbol_get_class_name(self);
- retval = class_name
- ? newSVpvn(class_name, strlen(class_name))
- : newSV(0);
+ retval = class_name
+ ? newSVpvn(class_name, strlen(class_name))
+ : newSV(0);
}
break;
case 6: {
const char *class_cnick = CFCSymbol_get_class_cnick(self);
- retval = class_cnick
- ? newSVpvn(class_cnick, strlen(class_cnick))
- : newSV(0);
+ retval = class_cnick
+ ? newSVpvn(class_cnick, strlen(class_cnick))
+ : newSV(0);
}
break;
case 8: {
@@ -1238,8 +1242,8 @@ _new(klass, flags, parcel, specifier, in
int indirection;
const char *c_string;
CODE:
- CFCType *self = CFCType_new(flags, parcel, specifier, indirection,
- c_string);
+ CFCType *self = CFCType_new(flags, parcel, specifier, indirection,
+ c_string);
RETVAL = S_cfcbase_to_perlref(self);
CFCBase_decref((CFCBase*)self);
OUTPUT: RETVAL
@@ -1440,7 +1444,7 @@ ALIAS:
get_indirection = 6
set_c_string = 7
to_c = 8
- const = 10
+ const = 10
set_nullable = 11
nullable = 12
is_void = 14
@@ -1529,9 +1533,9 @@ PPCODE:
break;
case 38: {
const char *array = CFCType_get_array(self);
- retval = array
- ? newSVpvn(array, strlen(array))
- : newSV(0);
+ retval = array
+ ? newSVpvn(array, strlen(array))
+ : newSV(0);
}
break;
END_SET_OR_GET_SWITCH
@@ -1591,12 +1595,15 @@ _new(klass, parcel, exposure, class_name
SV *micro_sym_sv;
SV *type_sv;
CODE:
- const char *class_name = SvOK(class_name_sv)
- ? SvPV_nolen(class_name_sv) : NULL;
- const char *class_cnick = SvOK(class_cnick_sv)
- ? SvPV_nolen(class_cnick_sv) : NULL;
- const char *micro_sym = SvOK(micro_sym_sv)
- ? SvPV_nolen(micro_sym_sv) : NULL;
+ const char *class_name = SvOK(class_name_sv)
+ ? SvPV_nolen(class_name_sv)
+ : NULL;
+ const char *class_cnick = SvOK(class_cnick_sv)
+ ? SvPV_nolen(class_cnick_sv)
+ : NULL;
+ const char *micro_sym = SvOK(micro_sym_sv)
+ ? SvPV_nolen(micro_sym_sv)
+ : NULL;
CFCType *type = NULL;
if (SvOK(type_sv) && sv_derived_from(type_sv, "Clownfish::Type")) {
IV objint = SvIV((SV*)SvRV(type_sv));
@@ -1606,7 +1613,7 @@ CODE:
croak("Param 'type' is not a Clownfish::Type");
}
CFCVariable *self = CFCVariable_new(parcel, exposure, class_name,
- class_cnick, micro_sym, type);
+ class_cnick, micro_sym, type);
RETVAL = S_cfcbase_to_perlref(self);
CFCBase_decref((CFCBase*)self);
OUTPUT: RETVAL
Modified: incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core.pm?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core.pm (original)
+++ incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core.pm Sun May 1 23:50:24 2011
@@ -136,8 +136,7 @@ typedef void
Lucy_ ## _class_nick ## _ ## _meth_name ## _OFFSET)
static CHY_INLINE cfish_method_t
-cfish_method(const void *vtable, size_t offset)
-{
+cfish_method(const void *vtable, size_t offset) {
union { char *cptr; cfish_method_t *fptr; } ptr;
ptr.cptr = (char*)vtable + offset;
return ptr.fptr[0];
@@ -151,10 +150,9 @@ cfish_method(const void *vtable, size_t
extern size_t cfish_VTable_offset_of_parent;
static CHY_INLINE cfish_method_t
-cfish_super_method(const void *vtable, size_t offset)
-{
+cfish_super_method(const void *vtable, size_t offset) {
char *vt_as_char = (char*)vtable;
- cfish_VTable **parent_ptr
+ cfish_VTable **parent_ptr
= (cfish_VTable**)(vt_as_char + cfish_VTable_offset_of_parent);
return cfish_method(*parent_ptr, offset);
}
Modified: incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core/Class.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core/Class.pm?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core/Class.pm (original)
+++ incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core/Class.pm Sun May 1 23:50:24 2011
@@ -96,7 +96,7 @@ $vt_type $vt = {
0, /* flags */
NULL, /* "void *x" member reserved for future use */
sizeof($struct_sym), /* obj_alloc_size */
- offsetof(cfish_VTable, methods)
+ offsetof(cfish_VTable, methods)
+ $num_methods * sizeof(cfish_method_t), /* vt_alloc_size */
&$cb_var, /* callbacks */
{
@@ -275,7 +275,7 @@ $vt
$vtable_object
#ifdef $short_names_macro
- #define $short_struct $full_struct
+ #define $short_struct $full_struct
#define $short_vt_var $vtable_var
$short_names
#endif /* $short_names_macro */
Modified: incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core/Method.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core/Method.pm?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core/Method.pm (original)
+++ incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Core/Method.pm Sun May 1 23:50:24 2011
@@ -59,8 +59,7 @@ sub _virtual_method_def {
return <<END_STUFF;
extern size_t $full_offset_sym;
static CHY_INLINE $return_type
-$full_method_sym($params)
-{
+$full_method_sym($params) {
char *const method_address = *(char**)self + $full_offset_sym;
const $typedef method = *(($typedef*)method_address);
${maybe_return}method(($common_struct*)$arg_names);
@@ -205,8 +204,7 @@ sub _invalid_callback_def {
}
return <<END_CALLBACK_DEF;
void
-$override_sym($params)
-{
+$override_sym($params) {
$unused;
CFISH_THROW(CFISH_ERR, "Can't override $full_method_sym via binding");
}
@@ -220,8 +218,7 @@ sub _void_callback_def {
my $params = $method->get_param_list->to_c;
return <<END_CALLBACK_DEF;
void
-$override_sym($params)
-{
+$override_sym($params) {
cfish_Host_callback($callback_params);
}
END_CALLBACK_DEF
@@ -241,8 +238,7 @@ sub _primitive_callback_def {
: confess("unrecognized type: $return_type_str");
return <<END_CALLBACK_DEF;
$return_type_str
-$override_sym($params)
-{
+$override_sym($params) {
return ($return_type_str)$nat_func($callback_params);
}
END_CALLBACK_DEF
@@ -277,8 +273,7 @@ sub _obj_callback_def {
return <<END_CALLBACK_DEF;
$return_type_str
-$override_sym($params)
-{
+$override_sym($params) {
$return_type_str retval = ($return_type_str)$cb_func_name($callback_params);
${nullable_check}${decrement}return retval;
}
@@ -312,8 +307,7 @@ sub abstract_method_def {
return <<END_ABSTRACT_DEF;
$return_type_str
-$full_func_sym($params)
-{
+$full_func_sym($params) {
cfish_CharBuf *klass = self ? Cfish_Obj_Get_Class_Name((cfish_Obj*)self) : $vtable->name;$unused
CFISH_THROW(CFISH_ERR, "Abstract method '$macro_sym' not defined by %o", klass);$ret_statement
}
Modified: incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Perl.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Perl.pm?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Perl.pm (original)
+++ incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Perl.pm Sun May 1 23:50:24 2011
@@ -212,7 +212,7 @@ init_autobindings()
PPCODE:
{
char* file = __FILE__;
- CHY_UNUSED_VAR(cv);
+ CHY_UNUSED_VAR(cv);
CHY_UNUSED_VAR(items); $xs_init
}
@@ -406,8 +406,7 @@ $self->{header}
$pound_includes
void
-$self->{boot_func}()
-{
+$self->{boot_func}() {
AV *isa;
cfish_ZombieCharBuf *alias = CFISH_ZCB_WRAP_STR("", 0);
$registrations
Modified: incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Perl/Constructor.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Perl/Constructor.pm?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Perl/Constructor.pm (original)
+++ incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Perl/Constructor.pm Sun May 1 23:50:24 2011
@@ -75,12 +75,11 @@ sub xsub_def {
# DESTROY.
my $self_var = $arg_vars->[0];
my $self_type = $self_var->get_type->to_c;
- my $self_assign = qq|$self_type self = ($self_type)XSBind_new_blank_obj( ST(0) );|;
+ my $self_assign = qq|$self_type self = ($self_type)XSBind_new_blank_obj(ST(0));|;
return <<END_STUFF;
XS($c_name);
-XS($c_name)
-{
+XS($c_name) {
dXSARGS;
CHY_UNUSED_VAR(cv);
if (items < 1) { CFISH_THROW(CFISH_ERR, "Usage: %s(class_name, ...)", GvNAME(CvGV(cv))); }
@@ -97,7 +96,7 @@ XS($c_name)
else {
ST(0) = newSV(0);
}
- sv_2mortal( ST(0) );
+ sv_2mortal(ST(0));
XSRETURN(1);
}
Modified: incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Perl/Method.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Perl/Method.pm?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Perl/Method.pm (original)
+++ incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Perl/Method.pm Sun May 1 23:50:24 2011
@@ -167,8 +167,7 @@ sub _xsub_def_positional_args {
return <<END_STUFF;
XS($c_name);
-XS($c_name)
-{
+XS($c_name) {
dXSARGS;
CHY_UNUSED_VAR(cv);
SP -= items;
@@ -204,8 +203,7 @@ sub _xsub_def_labeled_params {
return <<END_STUFF;
XS($c_name);
-XS($c_name)
-{
+XS($c_name) {
dXSARGS;
CHY_UNUSED_VAR(cv);
$num_args_check;
Modified: incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Perl/TypeMap.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Perl/TypeMap.pm?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Perl/TypeMap.pm (original)
+++ incubator/lucy/trunk/clownfish/lib/Clownfish/Binding/Perl/TypeMap.pm Sun May 1 23:50:24 2011
@@ -26,50 +26,50 @@ our @EXPORT_OK = qw( from_perl to_perl )
# Convert from a Perl scalar to a primitive type.
my %primitives_from_perl = (
- double => sub {"SvNV( $_[0] )"},
- float => sub {"(float)SvNV( $_[0] )"},
- int => sub {"(int)SvIV( $_[0] )"},
- short => sub {"(short)SvIV( $_[0] )"},
+ double => sub {"SvNV($_[0])"},
+ float => sub {"(float)SvNV($_[0])"},
+ int => sub {"(int)SvIV($_[0])"},
+ short => sub {"(short)SvIV($_[0])"},
long => sub {
"((sizeof(long) <= sizeof(IV)) ? "
. "(long)SvIV($_[0]) : (long)SvNV($_[0]))"
},
- size_t => sub {"(size_t)SvIV( $_[0] )"},
- uint64_t => sub {"(uint64_t)SvNV( $_[0] )"},
- uint32_t => sub {"(uint32_t)SvUV( $_[0] )"},
- uint16_t => sub {"(uint16_t)SvUV( $_[0] )"},
- uint8_t => sub {"(uint8_t)SvUV( $_[0] )"},
- int64_t => sub {"(int64_t)SvNV( $_[0] )"},
- int32_t => sub {"(int32_t)SvIV( $_[0] )"},
- int16_t => sub {"(int16_t)SvIV( $_[0] )"},
- int8_t => sub {"(int8_t)SvIV( $_[0] )"},
- chy_bool_t => sub {"SvTRUE( $_[0] ) ? 1 : 0"},
+ size_t => sub {"(size_t)SvIV($_[0])"},
+ uint64_t => sub {"(uint64_t)SvNV($_[0])"},
+ uint32_t => sub {"(uint32_t)SvUV($_[0])"},
+ uint16_t => sub {"(uint16_t)SvUV($_[0])"},
+ uint8_t => sub {"(uint8_t)SvUV($_[0])"},
+ int64_t => sub {"(int64_t)SvNV($_[0])"},
+ int32_t => sub {"(int32_t)SvIV($_[0])"},
+ int16_t => sub {"(int16_t)SvIV($_[0])"},
+ int8_t => sub {"(int8_t)SvIV($_[0])"},
+ chy_bool_t => sub {"SvTRUE($_[0]) ? 1 : 0"},
);
# Convert from a primitive type to a Perl scalar.
my %primitives_to_perl = (
- double => sub {"newSVnv( $_[0] )"},
- float => sub {"newSVnv( $_[0] )"},
- int => sub {"newSViv( $_[0] )"},
- short => sub {"newSViv( $_[0] )"},
+ double => sub {"newSVnv($_[0])"},
+ float => sub {"newSVnv($_[0])"},
+ int => sub {"newSViv($_[0])"},
+ short => sub {"newSViv($_[0])"},
long => sub {
"((sizeof(long) <= sizeof(IV)) ? "
. "newSViv((IV)$_[0]) : newSVnv((NV)$_[0]))";
},
- size_t => sub {"newSViv( $_[0] )"},
+ size_t => sub {"newSViv($_[0])"},
uint64_t => sub {
"sizeof(UV) == 8 ? newSVuv((UV)$_[0]) : newSVnv((NV)$_[0])";
},
- uint32_t => sub {"newSVuv( $_[0] )"},
- uint16_t => sub {"newSVuv( $_[0] )"},
- uint8_t => sub {"newSVuv( $_[0] )"},
+ uint32_t => sub {"newSVuv($_[0])"},
+ uint16_t => sub {"newSVuv($_[0])"},
+ uint8_t => sub {"newSVuv($_[0])"},
int64_t => sub {
"sizeof(IV) == 8 ? newSViv((IV)$_[0]) : newSVnv((NV)$_[0])";
},
- int32_t => sub {"newSViv( $_[0] )"},
- int16_t => sub {"newSViv( $_[0] )"},
- int8_t => sub {"newSViv( $_[0] )"},
- chy_bool_t => sub {"newSViv( $_[0] )"},
+ int32_t => sub {"newSViv($_[0])"},
+ int16_t => sub {"newSViv($_[0])"},
+ int8_t => sub {"newSViv($_[0])"},
+ chy_bool_t => sub {"newSViv($_[0])"},
);
sub from_perl {
@@ -119,7 +119,7 @@ sub to_perl {
if ( $type_str eq 'void*' ) {
# Assume that void* is a reference SV -- either a hashref or an
# arrayref.
- return "newRV_inc( (SV*)($cf_var) )";
+ return "newRV_inc((SV*)($cf_var))";
}
}
Modified: incubator/lucy/trunk/clownfish/src/CFCBase.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCBase.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/src/CFCBase.c (original)
+++ incubator/lucy/trunk/clownfish/src/CFCBase.c Sun May 1 23:50:24 2011
@@ -24,22 +24,19 @@
#include "CFCUtil.h"
CFCBase*
-CFCBase_allocate(size_t size, const char *klass)
-{
+CFCBase_allocate(size_t size, const char *klass) {
CFCBase *self = (CFCBase*)CALLOCATE(size, 1);
self->perl_obj = CFCUtil_make_perl_obj(self, klass);
return self;
}
void
-CFCBase_destroy(CFCBase *self)
-{
+CFCBase_destroy(CFCBase *self) {
FREEMEM(self);
}
CFCBase*
-CFCBase_incref(CFCBase *self)
-{
+CFCBase_incref(CFCBase *self) {
if (self) {
SvREFCNT_inc((SV*)self->perl_obj);
}
@@ -47,8 +44,7 @@ CFCBase_incref(CFCBase *self)
}
unsigned
-CFCBase_decref(CFCBase *self)
-{
+CFCBase_decref(CFCBase *self) {
if (!self) { return 0; }
unsigned modified_refcount = SvREFCNT((SV*)self->perl_obj) - 1;
/* When the SvREFCNT for this Perl object falls to zero, DESTROY will be
@@ -60,14 +56,12 @@ CFCBase_decref(CFCBase *self)
}
void*
-CFCBase_get_perl_obj(CFCBase *self)
-{
+CFCBase_get_perl_obj(CFCBase *self) {
return self->perl_obj;
}
const char*
-CFCBase_get_cfc_class(CFCBase *self)
-{
+CFCBase_get_cfc_class(CFCBase *self) {
return HvNAME(SvSTASH((SV*)self->perl_obj));
}
Modified: incubator/lucy/trunk/clownfish/src/CFCCBlock.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCCBlock.c?rev=1098445&r1=1098444&r2=1098445&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/src/CFCCBlock.c (original)
+++ incubator/lucy/trunk/clownfish/src/CFCCBlock.c Sun May 1 23:50:24 2011
@@ -30,31 +30,27 @@ struct CFCCBlock {
};
CFCCBlock*
-CFCCBlock_new(const char *contents)
-{
+CFCCBlock_new(const char *contents) {
CFCCBlock *self = (CFCCBlock*)CFCBase_allocate(sizeof(CFCCBlock),
- "Clownfish::CBlock");
+ "Clownfish::CBlock");
return CFCCBlock_init(self, contents);
}
CFCCBlock*
-CFCCBlock_init(CFCCBlock *self, const char *contents)
-{
+CFCCBlock_init(CFCCBlock *self, const char *contents) {
CFCUTIL_NULL_CHECK(contents);
self->contents = CFCUtil_strdup(contents);
return self;
}
void
-CFCCBlock_destroy(CFCCBlock *self)
-{
+CFCCBlock_destroy(CFCCBlock *self) {
FREEMEM(self->contents);
CFCBase_destroy((CFCBase*)self);
}
const char*
-CFCCBlock_get_contents(CFCCBlock *self)
-{
+CFCCBlock_get_contents(CFCCBlock *self) {
return self->contents;
}