This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (make-locative accessor modifier) | |
(cons accessor modifier)) | |
(define (locative-ref loc) | |
((car loc))) | |
(define (locative-set! loc value) | |
((cdr loc) value)) | |
(set! (setter locative-ref) locative-set!) ; srfi-17: generalized set! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import (scheme base) | |
(scheme write) | |
(gauche partcont)) | |
(define-syntax PEG:reify | |
(syntax-rules () | |
((_ expr) | |
(reset (PEG:unit expr))))) | |
(define (PEG:reflect x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <type_traits> | |
#include <typeinfo> | |
#include <typeindex> | |
template<typename T> struct Key; | |
template<> struct Key<int> { static constexpr std::size_t value = 0; }; | |
template<> struct Key<float> { static constexpr std::size_t value = 1; }; | |
template<typename T, typename U> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[yuichi@joestar build]$ find .. -name "*.[ch]" | xargs grep "[^_a-z]\\(realloc\\|malloc\\|free\\|calloc\\)(" | |
../extlib/benz/include/picrin/xhash.h: x->buckets = realloc(x->buckets, (x->size + 1) * sizeof(xh_entry *)); | |
../extlib/benz/include/picrin/xhash.h: free(x->buckets); | |
../extlib/benz/include/picrin/xhash.h: e = malloc(x->voffset + x->vwidth); | |
../extlib/benz/include/picrin/xhash.h: free(q); | |
../extlib/benz/include/picrin/xhash.h: free(q); | |
../extlib/benz/include/picrin/xhash.h: free(e); | |
../extlib/benz/include/picrin/xhash.h: free(x->buckets); | |
../extlib/benz/include/picrin.h: free(ptr); | |
../extlib/benz/include/picrin.h: return realloc(ptr, size); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[yuichi@joestar build]$ make -C ../etc nm | |
git show -s --format=%H; echo '****'; clang -shared -pedantic -Wno-overlength-strings -ansi -D"PIC_ENABLE_FLOAT=0" -D"PIC_ENABLE_LIBC=0" -fno-stack-protector -o libbenz.dylib -I../extlib/benz/include ../extlib/benz/*.c; nm -u libbenz.dylib | |
3d52d56c067d2731921529b0f2443629201523d6 | |
**** | |
dyld_stub_binder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[yuichi@*** build]$ nm -u lib/libpicrin.dylib | |
__DefaultRuneLocale | |
__Exit | |
___assert_rtn | |
___bzero | |
___maskrune | |
___memset_chk | |
___snprintf_chk | |
___stack_chk_fail | |
___stack_chk_guard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PIC_INLINE int | |
xvfprintf(xFILE *stream, const char *fmt, va_list ap) | |
{ | |
int flags, width, precision, length; | |
enum { | |
ALT = 1, | |
ZERO = 2, | |
LEFT = 4, | |
SIGN = 8, | |
SPACE = 16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
まず、nominalな継承関係はないので、ここでの継承関係とはクラス<A>と<B>の包含関係が | |
A \subset B | |
であることします。ようするに | |
(instanceof? x A) => (instanceof? x B) | |
みたいな感じですね。これを実現するためにクラス間の継承関係を*あとづけ*できるようにします。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(import (picrin foreign)) | |
(define libm (foreign-library "libm.so.6")) | |
(define cosh (foreign-function libm "cosh" (list double) double)) | |
(define sinh (foreign-function libm "sinh" (list double) double)) | |
(define libc (foreign-library "libc.so.6")) | |
(define tm (foreign-struct int 'tm_sec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; = class system = | |
(define-library (picrin class) | |
(import (scheme base)) | |
(define-record-type class-type | |
(make-class membership) | |
class? | |
(membership class-membership)) |