lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nwelln...@apache.org
Subject [1/2] git commit: Cease using CHY short names
Date Sat, 12 Jul 2014 13:19:57 GMT
Repository: lucy-clownfish
Updated Branches:
  refs/heads/master fb9f9efb8 -> 8e50ecb1f


Cease using CHY short names


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

Branch: refs/heads/master
Commit: 8e50ecb1fe7faf2f8144e317cd5d9821aca00f7c
Parents: 42a6757
Author: Nick Wellnhofer <wellnhofer@aevum.de>
Authored: Wed Jul 9 18:27:15 2014 +0200
Committer: Nick Wellnhofer <wellnhofer@aevum.de>
Committed: Sat Jul 12 15:15:02 2014 +0200

----------------------------------------------------------------------
 runtime/core/Clownfish/Num.c                   | 3 +--
 runtime/core/Clownfish/Obj.c                   | 9 ++++-----
 runtime/core/Clownfish/Test/TestCharBuf.c      | 5 ++---
 runtime/core/Clownfish/Test/TestObj.c          | 3 +--
 runtime/core/Clownfish/Test/Util/TestMemory.c  | 7 +++----
 runtime/core/Clownfish/TestHarness/TestUtils.c | 3 +--
 6 files changed, 12 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/8e50ecb1/runtime/core/Clownfish/Num.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Num.c b/runtime/core/Clownfish/Num.c
index 24a6de7..774e578 100644
--- a/runtime/core/Clownfish/Num.c
+++ b/runtime/core/Clownfish/Num.c
@@ -23,7 +23,6 @@
 #define C_CFISH_FLOAT64
 #define C_CFISH_BOOLNUM
 #define CFISH_USE_SHORT_NAMES
-#define CHY_USE_SHORT_NAMES
 
 #include "charmony.h"
 
@@ -369,7 +368,7 @@ Bool_Clone_IMP(BoolNum *self) {
 
 int32_t
 Bool_Hash_Sum_IMP(BoolNum *self) {
-    int64_t hash_sum = PTR_TO_I64(self) + self->value;
+    int64_t hash_sum = CHY_PTR_TO_I64(self) + self->value;
     return (int32_t)hash_sum;
 }
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/8e50ecb1/runtime/core/Clownfish/Obj.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Obj.c b/runtime/core/Clownfish/Obj.c
index db6e44b..69320fd 100644
--- a/runtime/core/Clownfish/Obj.c
+++ b/runtime/core/Clownfish/Obj.c
@@ -17,7 +17,6 @@
 #define C_CFISH_OBJ
 #define C_CFISH_CLASS
 #define CFISH_USE_SHORT_NAMES
-#define CHY_USE_SHORT_NAMES
 
 #include "charmony.h"
 
@@ -45,7 +44,7 @@ Obj_Destroy_IMP(Obj *self) {
 
 int32_t
 Obj_Hash_Sum_IMP(Obj *self) {
-    int64_t hash_sum = PTR_TO_I64(self);
+    int64_t hash_sum = CHY_PTR_TO_I64(self);
     return (int32_t)hash_sum;
 }
 
@@ -70,10 +69,10 @@ Obj_Equals_IMP(Obj *self, Obj *other) {
 
 String*
 Obj_To_String_IMP(Obj *self) {
-#if (SIZEOF_PTR == 4)
+#if (CHY_SIZEOF_PTR == 4)
     return Str_newf("%o@0x%x32", Obj_Get_Class_Name(self), self);
-#elif (SIZEOF_PTR == 8)
-    int64_t   iaddress   = PTR_TO_I64(self);
+#elif (CHY_SIZEOF_PTR == 8)
+    int64_t   iaddress   = CHY_PTR_TO_I64(self);
     uint64_t  address    = (uint64_t)iaddress;
     uint32_t  address_hi = address >> 32;
     uint32_t  address_lo = address & 0xFFFFFFFF;

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/8e50ecb1/runtime/core/Clownfish/Test/TestCharBuf.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestCharBuf.c b/runtime/core/Clownfish/Test/TestCharBuf.c
index 4070ae7..d6d4d50 100644
--- a/runtime/core/Clownfish/Test/TestCharBuf.c
+++ b/runtime/core/Clownfish/Test/TestCharBuf.c
@@ -17,7 +17,6 @@
 #include <string.h>
 #include <stdio.h>
 
-#define CHY_USE_SHORT_NAMES
 #define CFISH_USE_SHORT_NAMES
 #define TESTCFISH_USE_SHORT_NAMES
 
@@ -265,9 +264,9 @@ test_vcatf_x32(TestBatchRunner *runner) {
     char buf[64];
     unsigned long num = INT32_MAX;
     CharBuf *got = S_get_cb("foo ");
-#if (SIZEOF_LONG == 4)
+#if (CHY_SIZEOF_LONG == 4)
     sprintf(buf, "foo bar %.8lx baz", num);
-#elif (SIZEOF_INT == 4)
+#elif (CHY_SIZEOF_INT == 4)
     sprintf(buf, "foo bar %.8x baz", (unsigned)num);
 #endif
     wanted = Str_new_from_trusted_utf8(buf, strlen(buf));

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/8e50ecb1/runtime/core/Clownfish/Test/TestObj.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/TestObj.c b/runtime/core/Clownfish/Test/TestObj.c
index 7b4a955..1f6a470 100644
--- a/runtime/core/Clownfish/Test/TestObj.c
+++ b/runtime/core/Clownfish/Test/TestObj.c
@@ -16,7 +16,6 @@
 
 #include <stdio.h>
 
-#define CHY_USE_SHORT_NAMES
 #define CFISH_USE_SHORT_NAMES
 #define TESTCFISH_USE_SHORT_NAMES
 
@@ -89,7 +88,7 @@ test_Equals(TestBatchRunner *runner) {
 static void
 test_Hash_Sum(TestBatchRunner *runner) {
     Obj *testobj = S_new_testobj();
-    int64_t address64 = PTR_TO_I64(testobj);
+    int64_t address64 = CHY_PTR_TO_I64(testobj);
     int32_t address32 = (int32_t)address64;
     TEST_TRUE(runner, (Obj_Hash_Sum(testobj) == address32),
               "Hash_Sum uses memory address");

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/8e50ecb1/runtime/core/Clownfish/Test/Util/TestMemory.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Test/Util/TestMemory.c b/runtime/core/Clownfish/Test/Util/TestMemory.c
index 0f1278f..9bab8d4 100644
--- a/runtime/core/Clownfish/Test/Util/TestMemory.c
+++ b/runtime/core/Clownfish/Test/Util/TestMemory.c
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-#define CHY_USE_SHORT_NAMES
 #define CFISH_USE_SHORT_NAMES
 #define TESTCFISH_USE_SHORT_NAMES
 
@@ -49,8 +48,8 @@ test_oversize__growth_rate(TestBatchRunner *runner) {
         }
         if (size > 0) {
             growth_count += 1;
-            double growth_rate = U64_TO_DOUBLE(next_size) /
-                                 U64_TO_DOUBLE(size);
+            double growth_rate = CHY_U64_TO_DOUBLE(next_size) /
+                                 CHY_U64_TO_DOUBLE(size);
             double sum = growth_rate + (growth_count - 1) * average_growth_rate;
             average_growth_rate = sum / growth_count;
             if (average_growth_rate < 1.1) {
@@ -71,7 +70,7 @@ test_oversize__growth_rate(TestBatchRunner *runner) {
 
     for (int minimum = 1; minimum < 8; minimum++) {
         uint64_t next_size = Memory_oversize(minimum, sizeof(void*));
-        double growth_rate = U64_TO_DOUBLE(next_size) / (double)minimum;
+        double growth_rate = CHY_U64_TO_DOUBLE(next_size) / (double)minimum;
         TEST_TRUE(runner, growth_rate > 1.2,
                   "Growth rate is higher for smaller arrays (%d, %.3f)", minimum,
                   growth_rate);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/8e50ecb1/runtime/core/Clownfish/TestHarness/TestUtils.c
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/TestHarness/TestUtils.c b/runtime/core/Clownfish/TestHarness/TestUtils.c
index 3bf4d12..a9614ed 100644
--- a/runtime/core/Clownfish/TestHarness/TestUtils.c
+++ b/runtime/core/Clownfish/TestHarness/TestUtils.c
@@ -17,7 +17,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define CHY_USE_SHORT_NAMES
 #define CFISH_USE_SHORT_NAMES
 
 #include "charmony.h"
@@ -65,7 +64,7 @@ TestUtils_random_f64s(double *buf, size_t count) {
     double *f64s = buf ? buf : (double*)CALLOCATE(count, sizeof(double));
     for (size_t i = 0; i < count; i++) {
         uint64_t num = TestUtils_random_u64();
-        f64s[i] = U64_TO_DOUBLE(num) / UINT64_MAX;
+        f64s[i] = CHY_U64_TO_DOUBLE(num) / UINT64_MAX;
     }
     return f64s;
 }


Mime
View raw message