Skip to content

Instantly share code, notes, and snippets.

View shirok's full-sized avatar

Shiro Kawai shirok

View GitHub Profile
diff --git a/src/system.c b/src/system.c
index ba35faa..cb7a0eb 100644
--- a/src/system.c
+++ b/src/system.c
@@ -1071,9 +1071,11 @@ struct timespec *Scm_GetTimeSpec(ScmObj t, struct timespec *spec)
spec->tv_sec = ct->sec;
#endif /*!SCM_EMULATE_INT64*/
spec->tv_nsec = ct->nsec;
- if (SCM_EXACTP(t)) {
+ if (SCM_INTP(t)) {
@shirok
shirok / gist:1172508
Created August 26, 2011 01:47
converting json to N-triples
#!/usr/bin/env gosh
;; A quick-and-dirty hack to convert json to N-triples format.
;; Usage: <script-name> x.json y.json ...
;; The output is written to stdout.
;; NB: JSON itself isn't as strict as other format; especially,
;; the meanings of literals and predicates aren't uniquely identifierd
;; in the json file (i.e. json object may have an property "title", but
;; does it mean <http://purl.org/dc/elements/1.1/title>, or some application-
(defun arabic->roman (n) (if (< 0 n 4000) (format nil "~@R" n) (error "oob")))
(let ((tab (loop for n from 1 to 3999 collect `(,(format nil "~@R" n) . ,n))))
(defun roman->arabic (r) (or (cdr (assoc r tab :test #'equalp)) (error "huh?"))))
(use srfi-1)
(use slib)
(require 'format)
(define (arabic->roman n) (if (< 0 n 4000) (format "~@R" n) (error "oob")))
(define roman->arabic
(let1 tab (map (^n `(,(format "~@R" n) . ,n)) (iota 3999 1))
(^r (cond [(assoc r tab string-ci=?) => cdr] [else (error "huh?")]))))
(use gauche.threads)
(define (runonce fn)
(let1 state (atom #f) ; once run, becomes (list result)
(values (^[] (atomic state boolean)) ;has-run?
(^[] (atomic-update! state (^_ #f))) ;reset
(^ args ;once
(car (atomic-update! state (^p (or p `(,(apply fn args))))))))))
diff --git a/src/gauche/regexp.h b/src/gauche/regexp.h
index 298b86a..2c1a348 100644
--- a/src/gauche/regexp.h
+++ b/src/gauche/regexp.h
@@ -49,6 +49,11 @@ struct ScmRegexpRec {
int numSets; /* # of charsets in sets */
int flags; /* internal; CASE_FOLD, BOL_ANCHORED etc. */
ScmString *mustMatch;
+ ScmObj laset; /* lookahead set (char-set) or #f.
+ If not #f, it represents the condition that can
diff --git a/test/control.scm b/test/control.scm
index 4631c41..69e9d46 100644
--- a/test/control.scm
+++ b/test/control.scm
@@ -49,9 +49,12 @@
(cond-expand
[gauche.sys.pthreads
(test* "job-wait, job-kill" '(killed foo)
- (let* ([job (make-job (^[] (sys-sleep 10)) :waitable #t)]
+ (let* ([gate (make-mtqueue :max-length 0)]
diff --git a/configure.ac b/configure.ac
index 9078aa3..2eae81d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -562,11 +562,15 @@ case $host in
# -no-cpp-precomp is not related to shared library, but needed to
# get src/{vm.c,char.c} compiled -skimu
# [Shiro] Darwin 1.3 and later needs different flags
+ CPPFLAGS="$CPPFLAGS -no-cpp-precomp"
case $host_os in
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -273,7 +273,7 @@ char-data : gen-unicode.scm
char.$(OBJEXT) : char.c char_attr.c
-winmain.$(OBJEXT) : main.c
+winmain.$(OBJEXT) : main.c $(HEADERS)
symbol.$(OBJEXT) : builtin-syms.c
;;
;; Implementation of John Nash's enciphering-deciphering machine described in
;; https://www.nsa.gov/Portals/70/documents/news-features/declassified-documents/nash-letters/nash_letters1.pdf
;;
(use gauche.sequence)
(use gauche.generator)
(use srfi-1)
(use srfi-43)
(use srfi-60)