lucy-clownfish git commit: Change timestamp in write_if_changed test

2016-04-09 Thread nwellnhof
Repository: lucy-clownfish
Updated Branches:
  refs/heads/master e4a94bca5 -> 00acd7c12


Change timestamp in write_if_changed test

Might fix CLOWNFISH-68.


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

Branch: refs/heads/master
Commit: 00acd7c121edc9ed58a630215d307731ead76c91
Parents: e4a94bc
Author: Nick Wellnhofer 
Authored: Sat Apr 9 15:31:39 2016 +0200
Committer: Nick Wellnhofer 
Committed: Sat Apr 9 15:31:39 2016 +0200

--
 compiler/perl/t/001-util.t | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/00acd7c1/compiler/perl/t/001-util.t
--
diff --git a/compiler/perl/t/001-util.t b/compiler/perl/t/001-util.t
index 745bb69..57f1494 100644
--- a/compiler/perl/t/001-util.t
+++ b/compiler/perl/t/001-util.t
@@ -39,14 +39,14 @@ ok( !current( $foo_txt, "nonexistent_file" ),
 "not current when dest file mising"
 );
 
-my $one_second_ago = time() - 1;
-utime( $one_second_ago, $one_second_ago, $foo_txt )
+my $ten_seconds_ago = time() - 10;
+utime( $ten_seconds_ago, $ten_seconds_ago, $foo_txt )
 or die "utime failed";
 write_if_changed( $foo_txt, "foo" );
-is( stat($foo_txt)->mtime, $one_second_ago,
+is( stat($foo_txt)->mtime, $ten_seconds_ago,
 "write_if_changed does nothing if contents not changed" );
 write_if_changed( $foo_txt, "foofoo" );
-ok( stat($foo_txt)->mtime != $one_second_ago,
+ok( stat($foo_txt)->mtime != $ten_seconds_ago,
 "write_if_changed writes if contents changed"
 );
 



lucy-clownfish git commit: Change timestamp in write_if_changed test

2016-04-09 Thread nwellnhof
Repository: lucy-clownfish
Updated Branches:
  refs/heads/0.5 cf9d70341 -> 0ff0d586d


Change timestamp in write_if_changed test

Might fix CLOWNFISH-68.


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

Branch: refs/heads/0.5
Commit: 0ff0d586dc98523df9d58f72c53f91ea49946ba3
Parents: cf9d703
Author: Nick Wellnhofer 
Authored: Sat Apr 9 15:31:39 2016 +0200
Committer: Nick Wellnhofer 
Committed: Sat Apr 9 15:37:46 2016 +0200

--
 compiler/perl/t/001-util.t | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0ff0d586/compiler/perl/t/001-util.t
--
diff --git a/compiler/perl/t/001-util.t b/compiler/perl/t/001-util.t
index 745bb69..57f1494 100644
--- a/compiler/perl/t/001-util.t
+++ b/compiler/perl/t/001-util.t
@@ -39,14 +39,14 @@ ok( !current( $foo_txt, "nonexistent_file" ),
 "not current when dest file mising"
 );
 
-my $one_second_ago = time() - 1;
-utime( $one_second_ago, $one_second_ago, $foo_txt )
+my $ten_seconds_ago = time() - 10;
+utime( $ten_seconds_ago, $ten_seconds_ago, $foo_txt )
 or die "utime failed";
 write_if_changed( $foo_txt, "foo" );
-is( stat($foo_txt)->mtime, $one_second_ago,
+is( stat($foo_txt)->mtime, $ten_seconds_ago,
 "write_if_changed does nothing if contents not changed" );
 write_if_changed( $foo_txt, "foofoo" );
-ok( stat($foo_txt)->mtime != $one_second_ago,
+ok( stat($foo_txt)->mtime != $ten_seconds_ago,
 "write_if_changed writes if contents changed"
 );
 



[3/5] lucy-clownfish git commit: Check code point range in Str_BaseX_To_I64

2016-04-09 Thread nwellnhof
Check code point range in Str_BaseX_To_I64

Avoid undefined behavior when calling ctype.h functions.


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

Branch: refs/heads/master
Commit: 8e136edacf5e531101e8bbf165fe7a8b1e005264
Parents: a6bfd28
Author: Nick Wellnhofer 
Authored: Wed Apr 6 13:29:23 2016 +0200
Committer: Nick Wellnhofer 
Committed: Wed Apr 6 13:29:23 2016 +0200

--
 runtime/core/Clownfish/String.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/8e136eda/runtime/core/Clownfish/String.c
--
diff --git a/runtime/core/Clownfish/String.c b/runtime/core/Clownfish/String.c
index f619673..633aa80 100644
--- a/runtime/core/Clownfish/String.c
+++ b/runtime/core/Clownfish/String.c
@@ -243,7 +243,7 @@ Str_BaseX_To_I64_IMP(String *self, uint32_t base) {
 
 // Accumulate.
 while (code_point != STR_OOB) {
-if (isalnum(code_point)) {
+if (code_point <= 127 && isalnum(code_point)) {
 int32_t addend = isdigit(code_point)
  ? code_point - '0'
  : tolower(code_point) - 'a' + 10;



[1/5] lucy-clownfish git commit: Add safe ctype.h wrappers

2016-04-09 Thread nwellnhof
Repository: lucy-clownfish
Updated Branches:
  refs/heads/master bd503cb73 -> e4a94bca5


Add safe ctype.h wrappers

>From the C99 spec:

The header  declares several functions useful for
classifying and mapping characters. In all cases the argument is an
int, the value of which shall be representable as an unsigned char
or shall equal the value of the macro EOF. If the argument has any
other value, the behavior is undefined.

The behavior of these functions is affected by the current locale.

Implementations using a superset of ASCII are assumed.


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

Branch: refs/heads/master
Commit: fb28c3c8c707a6c289553a7480922134bfb0e110
Parents: 658d118
Author: Nick Wellnhofer 
Authored: Wed Apr 6 13:03:44 2016 +0200
Committer: Nick Wellnhofer 
Committed: Wed Apr 6 13:03:44 2016 +0200

--
 compiler/src/CFCUtil.c | 49 +
 compiler/src/CFCUtil.h | 27 +
 2 files changed, 76 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/fb28c3c8/compiler/src/CFCUtil.c
--
diff --git a/compiler/src/CFCUtil.c b/compiler/src/CFCUtil.c
index f505cac..83c30e2 100644
--- a/compiler/src/CFCUtil.c
+++ b/compiler/src/CFCUtil.c
@@ -308,6 +308,55 @@ CFCUtil_wrapped_free(void *ptr) {
 free(ptr);
 }
 
+// Avoid -Wtype-limits warning.
+#if CHAR_MAX <= 127
+  #define IS_ASCII(c) ((c) >= 0)
+#else
+  #define IS_ASCII(c) ((c) >= 0 && (c) <= 127)
+#endif
+
+int
+CFCUtil_isalnum(char c) {
+return IS_ASCII(c) && isalnum(c);
+}
+
+int
+CFCUtil_isalpha(char c) {
+return IS_ASCII(c) && isalpha(c);
+}
+
+int
+CFCUtil_isdigit(char c) {
+return IS_ASCII(c) && isdigit(c);
+}
+
+int
+CFCUtil_islower(char c) {
+return IS_ASCII(c) && islower(c);
+}
+
+int
+CFCUtil_isspace(char c) {
+return IS_ASCII(c) && isspace(c);
+}
+
+int
+CFCUtil_isupper(char c) {
+return IS_ASCII(c) && isupper(c);
+}
+
+char
+CFCUtil_tolower(char c) {
+if (!IS_ASCII(c)) { return c; }
+return (char)tolower(c);
+}
+
+char
+CFCUtil_toupper(char c) {
+if (!IS_ASCII(c)) { return c; }
+return (char)toupper(c);
+}
+
 int
 CFCUtil_current(const char *orig, const char *dest) {
 // If the destination file doesn't exist, we're not current.

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/fb28c3c8/compiler/src/CFCUtil.h
--
diff --git a/compiler/src/CFCUtil.h b/compiler/src/CFCUtil.h
index 73286ef..ea66400 100644
--- a/compiler/src/CFCUtil.h
+++ b/compiler/src/CFCUtil.h
@@ -153,6 +153,33 @@ CFCUtil_wrapped_free(void *ptr);
 #define FREEMEM(_ptr) \
 CFCUtil_wrapped_free(_ptr)
 
+/** Safe wrappers for ctype.h functions.
+ */
+
+int
+CFCUtil_isalnum(char c);
+
+int
+CFCUtil_isalpha(char c);
+
+int
+CFCUtil_isdigit(char c);
+
+int
+CFCUtil_islower(char c);
+
+int
+CFCUtil_isspace(char c);
+
+int
+CFCUtil_isupper(char c);
+
+char
+CFCUtil_tolower(char c);
+
+char
+CFCUtil_toupper(char c);
+
 /** Given two filepaths, return true if the second exists and has a
  * modification time which more recent than that of the first.
  */



[4/5] lucy-clownfish git commit: Remove unneeded ctype.h includes

2016-04-09 Thread nwellnhof
Remove unneeded ctype.h includes


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

Branch: refs/heads/master
Commit: 2fda55327d59ec11b88ce1056e91b46e833ff406
Parents: 8e136ed
Author: Nick Wellnhofer 
Authored: Wed Apr 6 13:31:30 2016 +0200
Committer: Nick Wellnhofer 
Committed: Wed Apr 6 13:31:30 2016 +0200

--
 runtime/core/Clownfish/ByteBuf.c | 1 -
 runtime/core/Clownfish/CharBuf.c | 1 -
 runtime/core/Clownfish/Class.c   | 1 -
 runtime/core/Clownfish/Err.c | 1 -
 runtime/perl/xs/XSBind.c | 1 -
 5 files changed, 5 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/2fda5532/runtime/core/Clownfish/ByteBuf.c
--
diff --git a/runtime/core/Clownfish/ByteBuf.c b/runtime/core/Clownfish/ByteBuf.c
index 96d31b6..dc03cf5 100644
--- a/runtime/core/Clownfish/ByteBuf.c
+++ b/runtime/core/Clownfish/ByteBuf.c
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "Clownfish/Class.h"
 #include "Clownfish/ByteBuf.h"

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/2fda5532/runtime/core/Clownfish/CharBuf.c
--
diff --git a/runtime/core/Clownfish/CharBuf.c b/runtime/core/Clownfish/CharBuf.c
index 3867249..5bd5c03 100644
--- a/runtime/core/Clownfish/CharBuf.c
+++ b/runtime/core/Clownfish/CharBuf.c
@@ -24,7 +24,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "Clownfish/CharBuf.h"
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/2fda5532/runtime/core/Clownfish/Class.c
--
diff --git a/runtime/core/Clownfish/Class.c b/runtime/core/Clownfish/Class.c
index 8c5cdfe..4608866 100644
--- a/runtime/core/Clownfish/Class.c
+++ b/runtime/core/Clownfish/Class.c
@@ -23,7 +23,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include "Clownfish/Class.h"
 #include "Clownfish/String.h"

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/2fda5532/runtime/core/Clownfish/Err.c
--
diff --git a/runtime/core/Clownfish/Err.c b/runtime/core/Clownfish/Err.c
index dd398e7..82daf02 100644
--- a/runtime/core/Clownfish/Err.c
+++ b/runtime/core/Clownfish/Err.c
@@ -23,7 +23,6 @@
 
 #include 
 #include 
-#include 
 
 #include "Clownfish/Err.h"
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/2fda5532/runtime/perl/xs/XSBind.c
--
diff --git a/runtime/perl/xs/XSBind.c b/runtime/perl/xs/XSBind.c
index 17f0266..515e752 100644
--- a/runtime/perl/xs/XSBind.c
+++ b/runtime/perl/xs/XSBind.c
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-#include 
 #include 
 
 #define C_CFISH_OBJ



[5/5] lucy-clownfish git commit: Merge branch 'ctype-fixes'

2016-04-09 Thread nwellnhof
Merge branch 'ctype-fixes'

Fixes CLOWNFISH-90.


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

Branch: refs/heads/master
Commit: e4a94bca5510dd5e11876de3a3918f7d0b7073cd
Parents: bd503cb 2fda553
Author: Nick Wellnhofer 
Authored: Sat Apr 9 15:19:35 2016 +0200
Committer: Nick Wellnhofer 
Committed: Sat Apr 9 15:19:35 2016 +0200

--
 compiler/src/CFCCHtml.c  |  1 -
 compiler/src/CFCCallable.c   |  1 -
 compiler/src/CFCClass.c  | 13 -
 compiler/src/CFCDocuComment.c| 20 +++--
 compiler/src/CFCFile.c   |  5 ++--
 compiler/src/CFCFileSpec.c   |  1 -
 compiler/src/CFCFunction.c   |  5 ++--
 compiler/src/CFCGo.c |  1 -
 compiler/src/CFCGoFunc.c |  3 +-
 compiler/src/CFCGoMethod.c   |  1 -
 compiler/src/CFCGoTypeMap.c  | 13 -
 compiler/src/CFCHierarchy.c  |  1 -
 compiler/src/CFCMethod.c |  7 ++---
 compiler/src/CFCParcel.c | 11 
 compiler/src/CFCPerl.c   |  8 +++---
 compiler/src/CFCPerlClass.c  |  2 +-
 compiler/src/CFCPerlMethod.c |  3 +-
 compiler/src/CFCPerlPod.c| 13 -
 compiler/src/CFCPyClass.c|  3 +-
 compiler/src/CFCPyMethod.c   |  5 ++--
 compiler/src/CFCPython.c |  5 ++--
 compiler/src/CFCRuby.c   |  8 +++---
 compiler/src/CFCSymbol.c |  5 ++--
 compiler/src/CFCType.c   | 13 -
 compiler/src/CFCUri.c|  5 ++--
 compiler/src/CFCUtil.c   | 53 +--
 compiler/src/CFCUtil.h   | 27 ++
 compiler/src/CFCVersion.c|  5 ++--
 runtime/core/Clownfish/ByteBuf.c |  1 -
 runtime/core/Clownfish/CharBuf.c |  1 -
 runtime/core/Clownfish/Class.c   |  1 -
 runtime/core/Clownfish/Err.c |  1 -
 runtime/core/Clownfish/String.c  |  2 +-
 runtime/perl/xs/XSBind.c |  1 -
 34 files changed, 150 insertions(+), 95 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/e4a94bca/runtime/core/Clownfish/CharBuf.c
--



[2/5] lucy-clownfish git commit: Switch to safe ctype.h wrappers

2016-04-09 Thread nwellnhof
Switch to safe ctype.h wrappers


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

Branch: refs/heads/master
Commit: a6bfd289edd6dba8cd73aed9b655fd56ae52b20b
Parents: fb28c3c
Author: Nick Wellnhofer 
Authored: Wed Apr 6 13:24:36 2016 +0200
Committer: Nick Wellnhofer 
Committed: Wed Apr 6 13:24:36 2016 +0200

--
 compiler/src/CFCCHtml.c   |  1 -
 compiler/src/CFCCallable.c|  1 -
 compiler/src/CFCClass.c   | 13 ++---
 compiler/src/CFCDocuComment.c | 20 
 compiler/src/CFCFile.c|  5 ++---
 compiler/src/CFCFileSpec.c|  1 -
 compiler/src/CFCFunction.c|  5 +++--
 compiler/src/CFCGo.c  |  1 -
 compiler/src/CFCGoFunc.c  |  3 +--
 compiler/src/CFCGoMethod.c|  1 -
 compiler/src/CFCGoTypeMap.c   | 13 ++---
 compiler/src/CFCHierarchy.c   |  1 -
 compiler/src/CFCMethod.c  |  7 +++
 compiler/src/CFCParcel.c  | 11 +--
 compiler/src/CFCPerl.c|  8 
 compiler/src/CFCPerlClass.c   |  2 +-
 compiler/src/CFCPerlMethod.c  |  3 +--
 compiler/src/CFCPerlPod.c | 13 ++---
 compiler/src/CFCPyClass.c |  3 +--
 compiler/src/CFCPyMethod.c|  5 ++---
 compiler/src/CFCPython.c  |  5 ++---
 compiler/src/CFCRuby.c|  8 
 compiler/src/CFCSymbol.c  |  5 ++---
 compiler/src/CFCType.c| 13 ++---
 compiler/src/CFCUri.c |  5 ++---
 compiler/src/CFCUtil.c|  4 ++--
 compiler/src/CFCVersion.c |  5 ++---
 27 files changed, 73 insertions(+), 89 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/a6bfd289/compiler/src/CFCCHtml.c
--
diff --git a/compiler/src/CFCCHtml.c b/compiler/src/CFCCHtml.c
index a054cb8..222f5fd 100644
--- a/compiler/src/CFCCHtml.c
+++ b/compiler/src/CFCCHtml.c
@@ -14,7 +14,6 @@
  * limitations under the License.
  */
 
-#include 
 #include 
 #include 
 #include 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/a6bfd289/compiler/src/CFCCallable.c
--
diff --git a/compiler/src/CFCCallable.c b/compiler/src/CFCCallable.c
index ccb3931..8071761 100644
--- a/compiler/src/CFCCallable.c
+++ b/compiler/src/CFCCallable.c
@@ -15,7 +15,6 @@
  */
 
 #include 
-#include 
 
 #ifndef true
 #define true 1

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/a6bfd289/compiler/src/CFCClass.c
--
diff --git a/compiler/src/CFCClass.c b/compiler/src/CFCClass.c
index 77e0158..319b1ae 100644
--- a/compiler/src/CFCClass.c
+++ b/compiler/src/CFCClass.c
@@ -16,7 +16,6 @@
 
 #include 
 #include 
-#include 
 
 #ifndef true
   #define true 1
@@ -139,22 +138,22 @@ CFCClass_validate_class_name(const char *class_name) {
 for (;;substring++) {
 if (*substring == 0)  { return false; }
 else if (*substring == ':')   { return false; }
-else if (islower(*substring)) { break; }
+else if (CFCUtil_islower(*substring)) { break; }
 }
 
 // Must be UpperCamelCase, separated by "::".
 const char *ptr = class_name;
-if (!isupper(*ptr)) { return false; }
+if (!CFCUtil_isupper(*ptr)) { return false; }
 while (*ptr != 0) {
 if (*ptr == 0) { break; }
 else if (*ptr == ':') {
 ptr++;
 if (*ptr != ':') { return false; }
 ptr++;
-if (!isupper(*ptr)) { return false; }
+if (!CFCUtil_isupper(*ptr)) { return false; }
 ptr++;
 }
-else if (!isalnum(*ptr)) { return false; }
+else if (!CFCUtil_isalnum(*ptr)) { return false; }
 else { ptr++; }
 }
 
@@ -178,7 +177,7 @@ S_validate_nickname(const char *nickname) {
 if (strlen(nickname)) { return true; }
 else { break; }
 }
-else if (!isupper(*ptr)) { break; }
+else if (!CFCUtil_isupper(*ptr)) { break; }
 }
 
 // Same as one component of a class name.
@@ -274,7 +273,7 @@ CFCClass_do_create(CFCClass *self, struct CFCParcel *parcel,
 char *short_class_var = (char*)MALLOCATE(struct_sym_len + 1);
 size_t i;
 for (i = 0; i < struct_sym_len; i++) {
-short_class_var[i] = (char)toupper(struct_sym[i]);
+short_class_var[i] = CFCUtil_toupper(struct_sym[i]);
 }
 short_class_var[struct_sym_len] = '\0';
 self->short_class_var = short_class_var;

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/a6bfd289/compiler/src/CFCDocuComment.c
---