You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2014/07/12 15:20:09 UTC

[1/3] git commit: refs/heads/master - Don't include charmony.h from Lucy/Util/ToolSet.h

Repository: lucy
Updated Branches:
  refs/heads/master 88e48633b -> f8631ab5e


Don't include charmony.h from Lucy/Util/ToolSet.h

External projects can now use Lucy/Util/ToolSet.h without depending on
Charmonizer.


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

Branch: refs/heads/master
Commit: f8631ab5e48076851cfe6f11c8a6d6715c4eee3a
Parents: a6a6a25
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Jul 9 19:35:36 2014 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat Jul 12 15:16:56 2014 +0200

----------------------------------------------------------------------
 core/Lucy/Util/ToolSet.h | 2 --
 1 file changed, 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/f8631ab5/core/Lucy/Util/ToolSet.h
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/ToolSet.h b/core/Lucy/Util/ToolSet.h
index 8e18190..b3f20dd 100644
--- a/core/Lucy/Util/ToolSet.h
+++ b/core/Lucy/Util/ToolSet.h
@@ -30,9 +30,7 @@ extern "C" {
 
 #define CFISH_USE_SHORT_NAMES
 #define LUCY_USE_SHORT_NAMES
-#define CHY_USE_SHORT_NAMES
 
-#include "charmony.h"
 #include <limits.h>
 #include <stddef.h>
 #include <stdlib.h>


[2/3] git commit: refs/heads/master - Cease using CHY short names

Posted by nw...@apache.org.
Cease using CHY short names

Also include charmony.h directly from .c files where needed preparing
for the next commit.


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

Branch: refs/heads/master
Commit: a6a6a2588acde85134e8158294cdd710d5f28d00
Parents: 3bf78f0
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Jul 9 19:29:58 2014 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat Jul 12 15:16:56 2014 +0200

----------------------------------------------------------------------
 c/src/Lucy/Analysis/RegexTokenizer.c          |  6 +++---
 core/Lucy/Search/Collector/SortCollector.c    | 20 ++++++++++++--------
 core/Lucy/Search/Matcher.c                    |  1 -
 core/Lucy/Store/CompoundFileReader.c          |  4 +++-
 core/Lucy/Store/FSDirHandle.c                 |  2 ++
 core/Lucy/Store/FSFileHandle.c                | 13 ++++++++-----
 core/Lucy/Store/FSFolder.c                    | 18 ++++++++++--------
 core/Lucy/Store/Folder.c                      |  4 +++-
 core/Lucy/Store/InStream.c                    | 22 +++++++++++++---------
 core/Lucy/Store/OutStream.c                   |  6 ++++--
 core/Lucy/Test/Search/TestSortSpec.c          |  6 ++++--
 core/Lucy/Test/Store/TestCompoundFileWriter.c |  2 ++
 core/Lucy/Test/Store/TestFSDirHandle.c        |  2 ++
 core/Lucy/Test/Store/TestFSFolder.c           |  2 ++
 core/Lucy/Test/Store/TestIOChunks.c           |  4 +++-
 core/Lucy/Test/Store/TestIOPrimitives.c       |  2 ++
 core/Lucy/Util/Debug.c                        |  1 -
 17 files changed, 73 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/a6a6a258/c/src/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Analysis/RegexTokenizer.c b/c/src/Lucy/Analysis/RegexTokenizer.c
index 09f20aa..ab51012 100644
--- a/c/src/Lucy/Analysis/RegexTokenizer.c
+++ b/c/src/Lucy/Analysis/RegexTokenizer.c
@@ -28,7 +28,7 @@
 #include "Lucy/Analysis/Token.h"
 #include "Lucy/Analysis/Inversion.h"
 
-#if defined(HAS_PCRE_H)
+#if defined(CHY_HAS_PCRE_H)
 
 #include <pcre.h>
 
@@ -156,7 +156,7 @@ S_count_code_points(const char *string, size_t len) {
     return num_code_points;
 }
 
-#else // HAS_PCRE_H
+#else // CHY_HAS_PCRE_H
 
 bool
 RegexTokenizer_is_available(void) {
@@ -202,5 +202,5 @@ RegexTokenizer_Tokenize_Utf8_IMP(RegexTokenizer *self, const char *string,
           " without PCRE.");
 }
 
-#endif // HAS_PCRE_H
+#endif // CHY_HAS_PCRE_H
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/a6a6a258/core/Lucy/Search/Collector/SortCollector.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Collector/SortCollector.c b/core/Lucy/Search/Collector/SortCollector.c
index 801d5c0..80561b0 100644
--- a/core/Lucy/Search/Collector/SortCollector.c
+++ b/core/Lucy/Search/Collector/SortCollector.c
@@ -18,6 +18,8 @@
 #define C_LUCY_MATCHDOC
 #include "Lucy/Util/ToolSet.h"
 
+#include "charmony.h"
+
 #include "Lucy/Search/Collector/SortCollector.h"
 #include "Lucy/Index/SegReader.h"
 #include "Lucy/Index/SortCache.h"
@@ -101,7 +103,7 @@ SortColl_init(SortCollector *self, Schema *schema, SortSpec *sort_spec,
     SortCollectorIVARS *const ivars = SortColl_IVARS(self);
     ivars->total_hits    = 0;
     ivars->bubble_doc    = INT32_MAX;
-    ivars->bubble_score  = F32_NEGINF;
+    ivars->bubble_score  = CHY_F32_NEGINF;
     ivars->seg_doc_max   = 0;
 
     // Assign.
@@ -155,7 +157,7 @@ SortColl_init(SortCollector *self, Schema *schema, SortSpec *sort_spec,
 
     // Prepare a MatchDoc-in-waiting.
     VArray *values = ivars->need_values ? VA_new(num_rules) : NULL;
-    float   score  = ivars->need_score  ? F32_NEGINF : F32_NAN;
+    float   score  = ivars->need_score  ? CHY_F32_NEGINF : CHY_F32_NAN;
     ivars->bumped = MatchDoc_new(INT32_MAX, score, values);
     DECREF(values);
 
@@ -231,8 +233,8 @@ SortColl_Set_Reader_IMP(SortCollector *self, SegReader *reader) {
     MatchDocIVARS *const bumped_ivars = MatchDoc_IVARS(ivars->bumped);
     bumped_ivars->doc_id = INT32_MAX;
     ivars->bubble_doc    = INT32_MAX;
-    bumped_ivars->score  = ivars->need_score ? F32_NEGINF : F32_NAN;
-    ivars->bubble_score  = ivars->need_score ? F32_NEGINF : F32_NAN;
+    bumped_ivars->score  = ivars->need_score ? CHY_F32_NEGINF : CHY_F32_NAN;
+    ivars->bubble_score  = ivars->need_score ? CHY_F32_NEGINF : CHY_F32_NAN;
     ivars->actions       = ivars->auto_actions;
 
     // Obtain sort caches. Derive actions array for this segment.
@@ -285,7 +287,7 @@ SortColl_Collect_IMP(SortCollector *self, int32_t doc_id) {
         MatchDocIVARS *const match_doc_ivars = MatchDoc_IVARS(match_doc);
         match_doc_ivars->doc_id = doc_id + ivars->base;
 
-        if (ivars->need_score && match_doc_ivars->score == F32_NEGINF) {
+        if (ivars->need_score && match_doc_ivars->score == CHY_F32_NEGINF) {
             match_doc_ivars->score = Matcher_Score(ivars->matcher);
         }
 
@@ -321,15 +323,17 @@ SortColl_Collect_IMP(SortCollector *self, int32_t doc_id) {
 
             // Recycle.
             MatchDoc_IVARS(ivars->bumped)->score = ivars->need_score
-                                                   ? F32_NEGINF
-                                                   : F32_NAN;
+                                                   ? CHY_F32_NEGINF
+                                                   : CHY_F32_NAN;
         }
         else {
             // The queue isn't full yet, so create a fresh MatchDoc.
             VArray *values = ivars->need_values
                              ? VA_new(ivars->num_rules)
                              : NULL;
-            float fake_score = ivars->need_score ? F32_NEGINF : F32_NAN;
+            float fake_score = ivars->need_score
+                               ? CHY_F32_NEGINF
+                               : CHY_F32_NAN;
             ivars->bumped = MatchDoc_new(INT32_MAX, fake_score, values);
             DECREF(values);
         }

http://git-wip-us.apache.org/repos/asf/lucy/blob/a6a6a258/core/Lucy/Search/Matcher.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Matcher.c b/core/Lucy/Search/Matcher.c
index 2003369..2d70175 100644
--- a/core/Lucy/Search/Matcher.c
+++ b/core/Lucy/Search/Matcher.c
@@ -17,7 +17,6 @@
 #define C_LUCY_MATCHER
 #define CFISH_USE_SHORT_NAMES
 #define LUCY_USE_SHORT_NAMES
-#define CHY_USE_SHORT_NAMES
 
 #include "Lucy/Search/Matcher.h"
 #include "Clownfish/Err.h"

http://git-wip-us.apache.org/repos/asf/lucy/blob/a6a6a258/core/Lucy/Store/CompoundFileReader.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/CompoundFileReader.c b/core/Lucy/Store/CompoundFileReader.c
index edf31c6..afc8cd4 100644
--- a/core/Lucy/Store/CompoundFileReader.c
+++ b/core/Lucy/Store/CompoundFileReader.c
@@ -18,6 +18,8 @@
 #define C_LUCY_CFREADERDIRHANDLE
 #include "Lucy/Util/ToolSet.h"
 
+#include "charmony.h"
+
 #include "Lucy/Store/CompoundFileReader.h"
 #include "Lucy/Store/CompoundFileWriter.h"
 #include "Lucy/Store/FileHandle.h"
@@ -94,7 +96,7 @@ CFReader_do_open(CompoundFileReader *self, Folder *folder) {
             String *orig = (String*)VA_Fetch(files, i);
             if (Str_Starts_With(orig, folder_name)) {
                 Obj *record = Hash_Delete(ivars->records, (Obj*)orig);
-                size_t offset = folder_name_len + sizeof(DIR_SEP) - 1;
+                size_t offset = folder_name_len + sizeof(CHY_DIR_SEP) - 1;
                 size_t len    = Str_Length(orig) - offset;
                 String *filename = Str_SubString(orig, offset, len);
                 Hash_Store(ivars->records, (Obj*)filename, (Obj*)record);

http://git-wip-us.apache.org/repos/asf/lucy/blob/a6a6a258/core/Lucy/Store/FSDirHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSDirHandle.c b/core/Lucy/Store/FSDirHandle.c
index 8a04fa1..f17ea15 100644
--- a/core/Lucy/Store/FSDirHandle.c
+++ b/core/Lucy/Store/FSDirHandle.c
@@ -21,6 +21,8 @@
 #include <errno.h>
 #include <sys/stat.h>
 
+#include "charmony.h"
+
 #include "Lucy/Util/ToolSet.h"
 #include "Clownfish/Err.h"
 #include "Clownfish/VArray.h"

http://git-wip-us.apache.org/repos/asf/lucy/blob/a6a6a258/core/Lucy/Store/FSFileHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFileHandle.c b/core/Lucy/Store/FSFileHandle.c
index c4e95d3..74f5ffc 100644
--- a/core/Lucy/Store/FSFileHandle.c
+++ b/core/Lucy/Store/FSFileHandle.c
@@ -17,6 +17,8 @@
 #define C_LUCY_FSFILEHANDLE
 #include "Lucy/Util/ToolSet.h"
 
+#include "charmony.h"
+
 #include <errno.h>
 #include <stdio.h>
 #include <fcntl.h> // open, POSIX flags
@@ -54,7 +56,7 @@ SI_posix_flags(uint32_t fh_flags) {
     return posix_flags;
 }
 
-#define IS_64_BIT (SIZEOF_PTR == 8 ? 1 : 0)
+#define IS_64_BIT (CHY_SIZEOF_PTR == 8 ? 1 : 0)
 
 // Memory map a region of the file with shared (read-only) permissions.  If
 // the requested length is 0, return NULL.  If an error occurs, return NULL
@@ -115,7 +117,7 @@ FSFH_do_open(FSFileHandle *self, String *path, uint32_t flags) {
         }
         else {
             // Derive length.
-            ivars->len = lseek64(ivars->fd, INT64_C(0), SEEK_END);
+            ivars->len = chy_lseek64(ivars->fd, INT64_C(0), SEEK_END);
             if (ivars->len == -1) {
                 Err_set_error(Err_new(Str_newf("lseek64 on %o failed: %s",
                                                ivars->path, strerror(errno))));
@@ -123,7 +125,8 @@ FSFH_do_open(FSFileHandle *self, String *path, uint32_t flags) {
                 return NULL;
             }
             else {
-                int64_t check_val = lseek64(ivars->fd, INT64_C(0), SEEK_SET);
+                int64_t check_val
+                    = chy_lseek64(ivars->fd, INT64_C(0), SEEK_SET);
                 if (check_val == -1) {
                     Err_set_error(Err_new(Str_newf("lseek64 on %o failed: %s",
                                                    ivars->path, strerror(errno))));
@@ -343,14 +346,14 @@ SI_init_read_only(FSFileHandle *self, FSFileHandleIVARS *ivars) {
     }
 
     // Derive len.
-    ivars->len = lseek64(ivars->fd, INT64_C(0), SEEK_END);
+    ivars->len = chy_lseek64(ivars->fd, INT64_C(0), SEEK_END);
     if (ivars->len == -1) {
         Err_set_error(Err_new(Str_newf("lseek64 on %o failed: %s", ivars->path,
                                        strerror(errno))));
         return false;
     }
     else {
-        int64_t check_val = lseek64(ivars->fd, INT64_C(0), SEEK_SET);
+        int64_t check_val = chy_lseek64(ivars->fd, INT64_C(0), SEEK_SET);
         if (check_val == -1) {
             Err_set_error(Err_new(Str_newf("lseek64 on %o failed: %s",
                                            ivars->path, strerror(errno))));

http://git-wip-us.apache.org/repos/asf/lucy/blob/a6a6a258/core/Lucy/Store/FSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/FSFolder.c b/core/Lucy/Store/FSFolder.c
index abbae12..9d4d03f 100644
--- a/core/Lucy/Store/FSFolder.c
+++ b/core/Lucy/Store/FSFolder.c
@@ -17,6 +17,8 @@
 #define C_LUCY_FSFOLDER
 #include "Lucy/Util/ToolSet.h"
 
+#include "charmony.h"
+
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -271,10 +273,10 @@ FSFolder_Local_Find_Folder_IMP(FSFolder *self, String *name) {
 static String*
 S_fullpath(FSFolder *self, String *path) {
     FSFolderIVARS *const ivars = FSFolder_IVARS(self);
-    String *fullpath = Str_newf("%o%s%o", ivars->path, DIR_SEP, path);
+    String *fullpath = Str_newf("%o%s%o", ivars->path, CHY_DIR_SEP, path);
     String *retval;
-    if (DIR_SEP[0] != '/') {
-        retval = Str_Swap_Chars(fullpath, '/', DIR_SEP[0]);
+    if (CHY_DIR_SEP[0] != '/') {
+        retval = Str_Swap_Chars(fullpath, '/', CHY_DIR_SEP[0]);
         DECREF(fullpath);
     }
     else {
@@ -294,13 +296,13 @@ S_fullpath_ptr(FSFolder *self, String *path) {
 
     char *buf = (char*)MALLOCATE(full_size + 1);
     memcpy(buf, folder_ptr, folder_size);
-    buf[folder_size] = DIR_SEP[0];
+    buf[folder_size] = CHY_DIR_SEP[0];
     memcpy(buf + folder_size + 1, path_ptr, path_size);
     buf[full_size] = '\0';
 
-    if (DIR_SEP[0] != '/') {
+    if (CHY_DIR_SEP[0] != '/') {
         for (size_t i = 0; i < full_size; ++i) {
-            if (buf[i] == '/') { buf[i] = DIR_SEP[0]; }
+            if (buf[i] == '/') { buf[i] = CHY_DIR_SEP[0]; }
         }
     }
 
@@ -395,7 +397,7 @@ S_hard_link(char *from8, char *to8) {
 
 static bool
 S_is_absolute(String *path) {
-    return Str_Starts_With_Utf8(path, DIR_SEP, 1);
+    return Str_Starts_With_Utf8(path, CHY_DIR_SEP, 1);
 }
 
 static String*
@@ -404,7 +406,7 @@ S_absolutify(String *path) {
 
     char *cwd = getcwd(NULL, 0);
     if (!cwd) { THROW(ERR, "getcwd failed"); }
-    String *abs_path = Str_newf("%s" DIR_SEP "%o", cwd, path);
+    String *abs_path = Str_newf("%s" CHY_DIR_SEP "%o", cwd, path);
     free(cwd);
 
     return abs_path;

http://git-wip-us.apache.org/repos/asf/lucy/blob/a6a6a258/core/Lucy/Store/Folder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/Folder.c b/core/Lucy/Store/Folder.c
index 86776a8..7ec92b6 100644
--- a/core/Lucy/Store/Folder.c
+++ b/core/Lucy/Store/Folder.c
@@ -19,6 +19,8 @@
 #include <ctype.h>
 #include <limits.h>
 
+#include "charmony.h"
+
 #include "Lucy/Store/Folder.h"
 #include "Lucy/Store/CompoundFileReader.h"
 #include "Lucy/Store/CompoundFileWriter.h"
@@ -41,7 +43,7 @@ Folder_init(Folder *self, String *path) {
     }
     else {
         // Copy path, strip trailing slash or equivalent.
-        if (Str_Ends_With_Utf8(path, DIR_SEP, strlen(DIR_SEP))) {
+        if (Str_Ends_With_Utf8(path, CHY_DIR_SEP, strlen(CHY_DIR_SEP))) {
             ivars->path = Str_SubString(path, 0, Str_Length(path) - 1);
         }
         else {

http://git-wip-us.apache.org/repos/asf/lucy/blob/a6a6a258/core/Lucy/Store/InStream.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/InStream.c b/core/Lucy/Store/InStream.c
index 9e7380e..366caca 100644
--- a/core/Lucy/Store/InStream.c
+++ b/core/Lucy/Store/InStream.c
@@ -17,6 +17,8 @@
 #define C_LUCY_INSTREAM
 #include "Lucy/Util/ToolSet.h"
 
+#include "charmony.h"
+
 #include "Lucy/Store/InStream.h"
 #include "Lucy/Store/FileHandle.h"
 #include "Lucy/Store/FSFileHandle.h"
@@ -270,7 +272,7 @@ static CFISH_INLINE int64_t
 SI_tell(InStream *self) {
     InStreamIVARS *const ivars = InStream_IVARS(self);
     char *fw_buf = FileWindow_Get_Buf(ivars->window);
-    int64_t pos_in_buf = PTR_TO_I64(ivars->buf) - PTR_TO_I64(fw_buf);
+    int64_t pos_in_buf = CHY_PTR_TO_I64(ivars->buf) - CHY_PTR_TO_I64(fw_buf);
     return pos_in_buf + FileWindow_Get_Offset(ivars->window) - ivars->offset;
 }
 
@@ -287,7 +289,8 @@ InStream_Length_IMP(InStream *self) {
 char*
 InStream_Buf_IMP(InStream *self, size_t request) {
     InStreamIVARS *const ivars = InStream_IVARS(self);
-    const int64_t bytes_in_buf = PTR_TO_I64(ivars->limit) - PTR_TO_I64(ivars->buf);
+    const int64_t bytes_in_buf
+        = CHY_PTR_TO_I64(ivars->limit) - CHY_PTR_TO_I64(ivars->buf);
 
     /* It's common for client code to overestimate how much is needed, because
      * the request has to figure in worst-case for compressed data.  However,
@@ -318,12 +321,12 @@ void
 InStream_Advance_Buf_IMP(InStream *self, char *buf) {
     InStreamIVARS *const ivars = InStream_IVARS(self);
     if (buf > ivars->limit) {
-        int64_t overrun = PTR_TO_I64(buf) - PTR_TO_I64(ivars->limit);
+        int64_t overrun = CHY_PTR_TO_I64(buf) - CHY_PTR_TO_I64(ivars->limit);
         THROW(ERR, "Supplied value is %i64 bytes beyond end of buffer",
               overrun);
     }
     else if (buf < ivars->buf) {
-        int64_t underrun = PTR_TO_I64(ivars->buf) - PTR_TO_I64(buf);
+        int64_t underrun = CHY_PTR_TO_I64(ivars->buf) - CHY_PTR_TO_I64(buf);
         THROW(ERR, "Can't Advance_Buf backwards: (underrun: %i64))", underrun);
     }
     else {
@@ -339,7 +342,8 @@ InStream_Read_Bytes_IMP(InStream *self, char* buf, size_t len) {
 static CFISH_INLINE void
 SI_read_bytes(InStream *self, char* buf, size_t len) {
     InStreamIVARS *const ivars = InStream_IVARS(self);
-    const int64_t available = PTR_TO_I64(ivars->limit) - PTR_TO_I64(ivars->buf);
+    const int64_t available
+        = CHY_PTR_TO_I64(ivars->limit) - CHY_PTR_TO_I64(ivars->buf);
     if (available >= (int64_t)len) {
         // Request is entirely within buffer, so copy.
         memcpy(buf, ivars->buf, len);
@@ -404,7 +408,7 @@ static CFISH_INLINE uint32_t
 SI_read_u32(InStream *self) {
     uint32_t retval;
     SI_read_bytes(self, (char*)&retval, 4);
-#ifdef LITTLE_END
+#ifdef CHY_LITTLE_END
     retval = NumUtil_decode_bigend_u32((char*)&retval);
 #endif
     return retval;
@@ -424,7 +428,7 @@ static CFISH_INLINE uint64_t
 SI_read_u64(InStream *self) {
     uint64_t retval;
     SI_read_bytes(self, (char*)&retval, 8);
-#ifdef LITTLE_END
+#ifdef CHY_LITTLE_END
     retval = NumUtil_decode_bigend_u64((char*)&retval);
 #endif
     return retval;
@@ -444,7 +448,7 @@ float
 InStream_Read_F32_IMP(InStream *self) {
     union { float f; uint32_t u32; } duo;
     SI_read_bytes(self, (char*)&duo, sizeof(float));
-#ifdef LITTLE_END
+#ifdef CHY_LITTLE_END
     duo.u32 = NumUtil_decode_bigend_u32(&duo.u32);
 #endif
     return duo.f;
@@ -454,7 +458,7 @@ double
 InStream_Read_F64_IMP(InStream *self) {
     union { double d; uint64_t u64; } duo;
     SI_read_bytes(self, (char*)&duo, sizeof(double));
-#ifdef LITTLE_END
+#ifdef CHY_LITTLE_END
     duo.u64 = NumUtil_decode_bigend_u64(&duo.u64);
 #endif
     return duo.d;

http://git-wip-us.apache.org/repos/asf/lucy/blob/a6a6a258/core/Lucy/Store/OutStream.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Store/OutStream.c b/core/Lucy/Store/OutStream.c
index 63af1e4..f61466e 100644
--- a/core/Lucy/Store/OutStream.c
+++ b/core/Lucy/Store/OutStream.c
@@ -17,6 +17,8 @@
 #define C_LUCY_OUTSTREAM
 #include "Lucy/Util/ToolSet.h"
 
+#include "charmony.h"
+
 #include "Lucy/Store/OutStream.h"
 #include "Lucy/Store/FileHandle.h"
 #include "Lucy/Store/FSFileHandle.h"
@@ -222,7 +224,7 @@ OutStream_Write_U8_IMP(OutStream *self, uint8_t value) {
 
 static CFISH_INLINE void
 SI_write_u32(OutStream *self, OutStreamIVARS *ivars, uint32_t value) {
-#ifdef BIG_END
+#ifdef CHY_BIG_END
     SI_write_bytes(self, ivars, &value, 4);
 #else
     char  buf[4];
@@ -244,7 +246,7 @@ OutStream_Write_U32_IMP(OutStream *self, uint32_t value) {
 
 static CFISH_INLINE void
 SI_write_u64(OutStream *self, OutStreamIVARS *ivars, uint64_t value) {
-#ifdef BIG_END
+#ifdef CHY_BIG_END
     SI_write_bytes(self, ivars, &value, 8);
 #else
     char  buf[sizeof(uint64_t)];

http://git-wip-us.apache.org/repos/asf/lucy/blob/a6a6a258/core/Lucy/Test/Search/TestSortSpec.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Search/TestSortSpec.c b/core/Lucy/Test/Search/TestSortSpec.c
index 467e045..46a43d2 100644
--- a/core/Lucy/Test/Search/TestSortSpec.c
+++ b/core/Lucy/Test/Search/TestSortSpec.c
@@ -21,6 +21,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include "charmony.h"
+
 #include "Clownfish/TestHarness/TestBatchRunner.h"
 #include "Clownfish/TestHarness/TestUtils.h"
 #include "Lucy/Test.h"
@@ -295,13 +297,13 @@ S_random_int64() {
 static Obj*
 S_random_float32() {
     uint64_t num = TestUtils_random_u64();
-    return (Obj*)Float32_new(U64_TO_DOUBLE(num) * (10.0 / UINT64_MAX));
+    return (Obj*)Float32_new(CHY_U64_TO_DOUBLE(num) * (10.0 / UINT64_MAX));
 }
 
 static Obj*
 S_random_float64() {
     uint64_t num = TestUtils_random_u64();
-    return (Obj*)Float64_new(U64_TO_DOUBLE(num) * (10.0 / UINT64_MAX));
+    return (Obj*)Float64_new(CHY_U64_TO_DOUBLE(num) * (10.0 / UINT64_MAX));
 }
 
 static VArray*

http://git-wip-us.apache.org/repos/asf/lucy/blob/a6a6a258/core/Lucy/Test/Store/TestCompoundFileWriter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestCompoundFileWriter.c b/core/Lucy/Test/Store/TestCompoundFileWriter.c
index a41575d..8c139a9 100644
--- a/core/Lucy/Test/Store/TestCompoundFileWriter.c
+++ b/core/Lucy/Test/Store/TestCompoundFileWriter.c
@@ -17,6 +17,8 @@
 #define TESTLUCY_USE_SHORT_NAMES
 #include "Lucy/Util/ToolSet.h"
 
+#include "charmony.h"
+
 #include "Clownfish/TestHarness/TestBatchRunner.h"
 #include "Lucy/Test.h"
 #include "Lucy/Test/Store/TestCompoundFileWriter.h"

http://git-wip-us.apache.org/repos/asf/lucy/blob/a6a6a258/core/Lucy/Test/Store/TestFSDirHandle.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFSDirHandle.c b/core/Lucy/Test/Store/TestFSDirHandle.c
index 2e87b3c..5568255 100644
--- a/core/Lucy/Test/Store/TestFSDirHandle.c
+++ b/core/Lucy/Test/Store/TestFSDirHandle.c
@@ -17,6 +17,8 @@
 #define TESTLUCY_USE_SHORT_NAMES
 #include "Lucy/Util/ToolSet.h"
 
+#include "charmony.h"
+
 // rmdir
 #ifdef CHY_HAS_DIRECT_H
   #include <direct.h>

http://git-wip-us.apache.org/repos/asf/lucy/blob/a6a6a258/core/Lucy/Test/Store/TestFSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFSFolder.c b/core/Lucy/Test/Store/TestFSFolder.c
index f26cd7b..5d41705 100644
--- a/core/Lucy/Test/Store/TestFSFolder.c
+++ b/core/Lucy/Test/Store/TestFSFolder.c
@@ -17,6 +17,8 @@
 #define TESTLUCY_USE_SHORT_NAMES
 #include "Lucy/Util/ToolSet.h"
 
+#include "charmony.h"
+
 // mkdir, rmdir
 #ifdef CHY_HAS_DIRECT_H
   #include <direct.h>

http://git-wip-us.apache.org/repos/asf/lucy/blob/a6a6a258/core/Lucy/Test/Store/TestIOChunks.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestIOChunks.c b/core/Lucy/Test/Store/TestIOChunks.c
index ce22121..1df0651 100644
--- a/core/Lucy/Test/Store/TestIOChunks.c
+++ b/core/Lucy/Test/Store/TestIOChunks.c
@@ -20,6 +20,8 @@
 #include <stdlib.h>
 #include <time.h>
 
+#include "charmony.h"
+
 #define TESTLUCY_USE_SHORT_NAMES
 #include "Lucy/Util/ToolSet.h"
 #include "Clownfish/TestHarness/TestBatchRunner.h"
@@ -104,7 +106,7 @@ test_Buf(TestBatchRunner *runner) {
 
     int64_t  expected = InStream_Length(instream) - InStream_Tell(instream);
     char    *buff     = InStream_Buf(instream, 100000);
-    int64_t  got      = PTR_TO_I64(ivars->limit) - PTR_TO_I64(buff);
+    int64_t  got      = CHY_PTR_TO_I64(ivars->limit) - CHY_PTR_TO_I64(buff);
     TEST_TRUE(runner, got == expected,
               "Requests greater than file size get pared down");
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/a6a6a258/core/Lucy/Test/Store/TestIOPrimitives.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestIOPrimitives.c b/core/Lucy/Test/Store/TestIOPrimitives.c
index dd3cdb5..66caf76 100644
--- a/core/Lucy/Test/Store/TestIOPrimitives.c
+++ b/core/Lucy/Test/Store/TestIOPrimitives.c
@@ -20,6 +20,8 @@
 #include <stdlib.h>
 #include <time.h>
 
+#include "charmony.h"
+
 #define TESTLUCY_USE_SHORT_NAMES
 #include "Lucy/Util/ToolSet.h"
 #include "Clownfish/TestHarness/TestBatchRunner.h"

http://git-wip-us.apache.org/repos/asf/lucy/blob/a6a6a258/core/Lucy/Util/Debug.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Util/Debug.c b/core/Lucy/Util/Debug.c
index aa88c7e..df529b9 100644
--- a/core/Lucy/Util/Debug.c
+++ b/core/Lucy/Util/Debug.c
@@ -17,7 +17,6 @@
 #define C_LUCY_DEBUG
 #define CFISH_USE_SHORT_NAMES
 #define LUCY_USE_SHORT_NAMES
-#define CHY_USE_SHORT_NAMES
 
 #include "Lucy/Util/Debug.h"
 


[3/3] git commit: refs/heads/master - Switch from CHY_UNUSED_VAR to CFISH_UNUSED_VAR

Posted by nw...@apache.org.
Switch from CHY_UNUSED_VAR to CFISH_UNUSED_VAR


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

Branch: refs/heads/master
Commit: 3bf78f0387ecec462b1bc1c227a6c513e7814129
Parents: 88e4863
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Jul 9 18:38:29 2014 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat Jul 12 15:16:56 2014 +0200

----------------------------------------------------------------------
 c/src/Lucy/Analysis/RegexTokenizer.c |  3 ---
 c/src/Lucy/Document/Doc.c            |  3 ---
 c/src/Lucy/Index/DocReader.c         |  1 -
 c/src/Lucy/Index/Inverter.c          |  1 -
 common/charmonizer.c                 | 20 ++++++++++++++++----
 common/charmonizer.main              |  2 --
 core/Lucy/Analysis/Analyzer.c        |  2 +-
 core/Lucy/Search/Query.c             |  2 +-
 perl/xs/Lucy/Document/Doc.c          |  3 +--
 9 files changed, 19 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/3bf78f03/c/src/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Analysis/RegexTokenizer.c b/c/src/Lucy/Analysis/RegexTokenizer.c
index b3d7a6a..09f20aa 100644
--- a/c/src/Lucy/Analysis/RegexTokenizer.c
+++ b/c/src/Lucy/Analysis/RegexTokenizer.c
@@ -15,12 +15,9 @@
  */
 
 #define C_LUCY_REGEXTOKENIZER
-#define CHY_USE_SHORT_NAMES
 #define CFISH_USE_SHORT_NAMES
 #define LUCY_USE_SHORT_NAMES
 
-#include "charmony.h"
-
 #include <string.h>
 
 #include "Lucy/Analysis/RegexTokenizer.h"

http://git-wip-us.apache.org/repos/asf/lucy/blob/3bf78f03/c/src/Lucy/Document/Doc.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Document/Doc.c b/c/src/Lucy/Document/Doc.c
index 9c73303..3b832d5 100644
--- a/c/src/Lucy/Document/Doc.c
+++ b/c/src/Lucy/Document/Doc.c
@@ -15,12 +15,9 @@
  */
 
 #define C_LUCY_DOC
-#define CHY_USE_SHORT_NAMES
 #define CFISH_USE_SHORT_NAMES
 #define LUCY_USE_SHORT_NAMES
 
-#include "charmony.h"
-
 #include "Lucy/Document/Doc.h"
 #include "Clownfish/String.h"
 #include "Clownfish/Err.h"

http://git-wip-us.apache.org/repos/asf/lucy/blob/3bf78f03/c/src/Lucy/Index/DocReader.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Index/DocReader.c b/c/src/Lucy/Index/DocReader.c
index a887fea..0e97ecf 100644
--- a/c/src/Lucy/Index/DocReader.c
+++ b/c/src/Lucy/Index/DocReader.c
@@ -16,7 +16,6 @@
 
 #define C_LUCY_DOCREADER
 #define C_LUCY_DEFAULTDOCREADER
-#define CHY_USE_SHORT_NAMES
 #define CFISH_USE_SHORT_NAMES
 #define LUCY_USE_SHORT_NAMES
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/3bf78f03/c/src/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/c/src/Lucy/Index/Inverter.c b/c/src/Lucy/Index/Inverter.c
index b5882c2..c235a66 100644
--- a/c/src/Lucy/Index/Inverter.c
+++ b/c/src/Lucy/Index/Inverter.c
@@ -16,7 +16,6 @@
 
 #define C_LUCY_INVERTER
 #define C_LUCY_INVERTERENTRY
-#define CHY_USE_SHORT_NAMES
 #define CFISH_USE_SHORT_NAMES
 #define LUCY_USE_SHORT_NAMES
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/3bf78f03/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/common/charmonizer.c b/common/charmonizer.c
index 2be5f43..441f752 100644
--- a/common/charmonizer.c
+++ b/common/charmonizer.c
@@ -89,6 +89,8 @@ chaz_SharedLib_export_filename(chaz_SharedLib *lib);
 #ifndef H_CHAZ_CFLAGS
 #define H_CHAZ_CFLAGS
 
+/* #include "Charmonizer/Core/SharedLibrary.h" */
+
 #define CHAZ_CFLAGS_STYLE_POSIX  1
 #define CHAZ_CFLAGS_STYLE_GNU    2
 #define CHAZ_CFLAGS_STYLE_MSVC   3
@@ -490,7 +492,7 @@ chaz_HeadCheck_contains_member(const char *struct_name, const char *member,
 #define H_CHAZ_MAKE
 
 /* #include "Charmonizer/Core/CFlags.h" */
-/* #include "Charmonizer/Core/SharedLib.h" */
+/* #include "Charmonizer/Core/SharedLibrary.h" */
 
 typedef struct chaz_MakeFile chaz_MakeFile;
 typedef struct chaz_MakeVar chaz_MakeVar;
@@ -1537,7 +1539,7 @@ void chaz_VariadicMacros_run(void);
 #line 17 "src/Charmonizer/Core/SharedLibrary.c"
 #include <string.h>
 #include <stdlib.h>
-/* #include "Charmonizer/Core/SharedLib.h" */
+/* #include "Charmonizer/Core/SharedLibrary.h" */
 /* #include "Charmonizer/Core/Compiler.h" */
 /* #include "Charmonizer/Core/Util.h" */
 /* #include "Charmonizer/Core/OperatingSystem.h" */
@@ -1661,6 +1663,7 @@ S_get_prefix() {
 #include <string.h>
 #include <stdlib.h>
 /* #include "Charmonizer/Core/CFlags.h" */
+/* #include "Charmonizer/Core/Compiler.h" */
 /* #include "Charmonizer/Core/Util.h" */
 /* #include "Charmonizer/Core/OperatingSystem.h" */
 /* #include "Charmonizer/Core/SharedLibrary.h" */
@@ -3696,6 +3699,7 @@ chaz_HeadCheck_maybe_add_to_cache(const char *header_name, int exists) {
 
 #line 17 "src/Charmonizer/Core/Make.c"
 #include <ctype.h>
+#include <stdlib.h>
 #include <string.h>
 /* #include "Charmonizer/Core/Make.h" */
 /* #include "Charmonizer/Core/Compiler.h" */
@@ -4686,6 +4690,7 @@ chaz_OS_rmdir(const char *filepath) {
 #include <stdlib.h>
 #include <string.h>
 /* #include "Charmonizer/Core/Util.h" */
+/* #include "Charmonizer/Core/OperatingSystem.h" */
 
 /* Global verbosity setting. */
 int chaz_Util_verbosity = 1;
@@ -4894,6 +4899,7 @@ chaz_Util_can_open_file(const char *file_path) {
 /* #include "Charmonizer/Core/ConfWriterRuby.h" */
 /* #include "Charmonizer/Core/Util.h" */
 /* #include "Charmonizer/Core/Compiler.h" */
+/* #include "Charmonizer/Core/Make.h" */
 /* #include "Charmonizer/Core/OperatingSystem.h" */
 
 int
@@ -5146,6 +5152,8 @@ chaz_Booleans_run(void) {
 
 #line 17 "src/Charmonizer/Probe/BuildEnv.c"
 /* #include "Charmonizer/Core/HeaderChecker.h" */
+/* #include "Charmonizer/Core/CFlags.h" */
+/* #include "Charmonizer/Core/Compiler.h" */
 /* #include "Charmonizer/Core/ConfWriter.h" */
 /* #include "Charmonizer/Probe/BuildEnv.h" */
 
@@ -5361,6 +5369,8 @@ chaz_DirManip_run(void) {
 
 #line 17 "src/Charmonizer/Probe/Floats.c"
 /* #include "Charmonizer/Core/HeaderChecker.h" */
+/* #include "Charmonizer/Core/CFlags.h" */
+/* #include "Charmonizer/Core/Compiler.h" */
 /* #include "Charmonizer/Core/ConfWriter.h" */
 /* #include "Charmonizer/Core/Util.h" */
 /* #include "Charmonizer/Probe/Floats.h" */
@@ -6716,6 +6726,7 @@ chaz_Memory_probe_alloca(void) {
 
 #line 17 "src/Charmonizer/Probe/RegularExpressions.c"
 /* #include "Charmonizer/Core/HeaderChecker.h" */
+/* #include "Charmonizer/Core/Compiler.h" */
 /* #include "Charmonizer/Core/ConfWriter.h" */
 /* #include "Charmonizer/Probe/RegularExpressions.h" */
 
@@ -6764,6 +6775,8 @@ chaz_RegularExpressions_run(void) {
 /* #include "Charmonizer/Core/ConfWriter.h" */
 /* #include "Charmonizer/Probe/Strings.h" */
 
+#include <stdlib.h>
+
 /* Check for C99-compatible snprintf and possible replacements.
  */
 static void
@@ -6936,6 +6949,7 @@ chaz_UnusedVars_run(void) {
 /* #include "Charmonizer/Probe/VariadicMacros.h" */
 #include <string.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 
 /* Code for verifying ISO-style variadic macros. */
@@ -7028,7 +7042,6 @@ chaz_VariadicMacros_run(void) {
 /* #include "Charmonizer/Probe/LargeFiles.h" */
 /* #include "Charmonizer/Probe/Memory.h" */
 /* #include "Charmonizer/Probe/SymbolVisibility.h" */
-/* #include "Charmonizer/Probe/UnusedVars.h" */
 /* #include "Charmonizer/Probe/VariadicMacros.h" */
 /* #include "Charmonizer/Core/HeaderChecker.h" */
 /* #include "Charmonizer/Core/ConfWriter.h" */
@@ -7465,7 +7478,6 @@ int main(int argc, const char **argv) {
     chaz_LargeFiles_run();
     chaz_Memory_run();
     chaz_RegularExpressions_run();
-    chaz_UnusedVars_run();
     chaz_VariadicMacros_run();
 
     /* Write custom postamble. */

http://git-wip-us.apache.org/repos/asf/lucy/blob/3bf78f03/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/common/charmonizer.main b/common/charmonizer.main
index 1263de0..fd3d0f3 100644
--- a/common/charmonizer.main
+++ b/common/charmonizer.main
@@ -30,7 +30,6 @@
 #include "Charmonizer/Probe/LargeFiles.h"
 #include "Charmonizer/Probe/Memory.h"
 #include "Charmonizer/Probe/SymbolVisibility.h"
-#include "Charmonizer/Probe/UnusedVars.h"
 #include "Charmonizer/Probe/VariadicMacros.h"
 #include "Charmonizer/Core/HeaderChecker.h"
 #include "Charmonizer/Core/ConfWriter.h"
@@ -467,7 +466,6 @@ int main(int argc, const char **argv) {
     chaz_LargeFiles_run();
     chaz_Memory_run();
     chaz_RegularExpressions_run();
-    chaz_UnusedVars_run();
     chaz_VariadicMacros_run();
 
     /* Write custom postamble. */

http://git-wip-us.apache.org/repos/asf/lucy/blob/3bf78f03/core/Lucy/Analysis/Analyzer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/Analyzer.c b/core/Lucy/Analysis/Analyzer.c
index 281d13b..ca37005 100644
--- a/core/Lucy/Analysis/Analyzer.c
+++ b/core/Lucy/Analysis/Analyzer.c
@@ -68,7 +68,7 @@ Analyzer_Dump_IMP(Analyzer *self) {
 
 Obj*
 Analyzer_Load_IMP(Analyzer *self, Obj *dump) {
-    CHY_UNUSED_VAR(self);
+    UNUSED_VAR(self);
     Hash *source = (Hash*)CERTIFY(dump, HASH);
     String *class_name
         = (String*)CERTIFY(Hash_Fetch_Utf8(source, "_class", 6), STRING);

http://git-wip-us.apache.org/repos/asf/lucy/blob/3bf78f03/core/Lucy/Search/Query.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Query.c b/core/Lucy/Search/Query.c
index 889a822..49b41cb 100644
--- a/core/Lucy/Search/Query.c
+++ b/core/Lucy/Search/Query.c
@@ -64,7 +64,7 @@ Query_Dump_IMP(Query *self) {
 
 Obj*
 Query_Load_IMP(Query *self, Obj *dump) {
-    CHY_UNUSED_VAR(self);
+    UNUSED_VAR(self);
     Hash *source = (Hash*)CERTIFY(dump, HASH);
     String *class_name
         = (String*)CERTIFY(Hash_Fetch_Utf8(source, "_class", 6), STRING);

http://git-wip-us.apache.org/repos/asf/lucy/blob/3bf78f03/perl/xs/Lucy/Document/Doc.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Document/Doc.c b/perl/xs/Lucy/Document/Doc.c
index 987f293..398bcd8 100644
--- a/perl/xs/Lucy/Document/Doc.c
+++ b/perl/xs/Lucy/Document/Doc.c
@@ -15,7 +15,6 @@
  */
 
 #define C_LUCY_DOC
-#include "charmony.h"
 #include "XSBind.h"
 #include "Lucy/Document/Doc.h"
 #include "Lucy/Store/InStream.h"
@@ -202,7 +201,7 @@ LUCY_Doc_Load_IMP(lucy_Doc *self, cfish_Obj *dump) {
                             CFISH_Hash_Fetch_Utf8(source, "fields", 6),
                             CFISH_HASH);
     SV *fields_sv = XSBind_cfish_to_perl((cfish_Obj*)fields);
-    CHY_UNUSED_VAR(self);
+    CFISH_UNUSED_VAR(self);
 
     lucy_DocIVARS *const loaded_ivars = lucy_Doc_IVARS(loaded);
     loaded_ivars->doc_id = (int32_t)CFISH_Obj_To_I64(doc_id);