Skip to content

Instantly share code, notes, and snippets.

@[Link("ncurses")]
lib NcursesPrivate
fun acs_map : Char*
end
lib Ncurses
fun initscr
ACS_ULCORNER = NcursesPrivate.acs_map()['l'.to_i]
end
$ CXX=/usr/local/bin/clang++ CC=/usr/local/bin/clang gmake
Using /usr/local/bin/llvm-config [version=4.0.0]
/usr/local/bin/clang++ -c -o src/llvm/ext/llvm_ext.o src/llvm/ext/llvm_ext.cc `/usr/local/bin/llvm-config --cxxflags`
warning: unknown warning option '-Wno-maybe-uninitialized'; did you mean '-Wno-uninitialized'? [-Wunknown-warning-option]
1 warning generated.
/usr/local/bin/clang -fPIC -c -o src/ext/sigfault.o src/ext/sigfault.c
ar -rcs src/ext/libcrystal.a src/ext/sigfault.o
CRYSTAL_CONFIG_PATH=`pwd`/src ./bin/crystal build -o .build/crystal src/compiler/crystal.cr -D without_openssl -D without_zlib
Invalid memory access (signal 11) at address 0x7f7fffbefff8
[0x126cb6138336] *CallStack::print_backtrace:Int32 +118
@wmoxam
wmoxam / test.cr
Last active October 11, 2016 06:34
class Any
alias Type = Array(Int32) | String | Nil
getter raw : Type
def initialize(raw)
@raw = raw.as Type
end
def foo
if @raw.responds_to?(:each)
@wmoxam
wmoxam / Running compiler specs
Last active October 6, 2016 04:38
Testing ysbaddaden:openbsd-support
$ CC=/usr/local/bin/clang crystal run spec/compiler_spec.cr
Using compiled compiler at .build/crystal
/usr/local/lib/libevent_core.so.1.1: warning: warning: random() may return deterministic values, is that what you want?
/usr/local/lib/libxml2.so.15.1: warning: warning: strcat() is almost always misused, please use strlcat()
/usr/local/lib/libxml2.so.15.1: warning: warning: strcpy() is almost always misused, please use strlcpy()
/usr/local/lib/libevent_core.so.1.1: warning: warning: random() may return deterministic values, is that what you want?
/usr/local/lib/libyaml.so.0.0: warning: warning: sprintf() is often misused, please use snprintf()
$ crystal build --release --stats -o .build/crystal src/compiler/crystal.cr -D without_openssl -D without_zlib
Using compiled compiler at .build/crystal
Parse: 00:00:00.0014303 ( 0.19MB)
Semantic (top level): 00:00:00.7784125 ( 67.32MB)
Semantic (new): 00:00:00.0041213 ( 67.32MB)
Semantic (type declarations): 00:00:00.0730781 ( 75.32MB)
Semantic (abstract def check): 00:00:00.0011441 ( 75.32MB)
Semantic (cvars initializers): 00:00:00.0223832 ( 75.32MB)
Semantic (ivars initializers): 00:00:00.0325921 ( 83.32MB)
Semantic (main): /usr/local/lib/libevent_core.so.1.1: warning: warning: random() may return deterministic values, is that what you want?
require "thread"
puts Thread.current.current_fiber.inspect
Thread.new { puts Thread.current.current_fiber.inspect }.join
$ crystal threads.cr
#<Thread:0x1023dffc0 @th=nil, @exception=nil, @detached=false, @func=#<Proc(Nil):0x102073f60>, @current_fiber=#<Fiber:0x1023def50: main>>
Invalid memory access (signal 11) at address 0x48
Invalid memory access (signal 11) at address 0x48
Invalid memory access (signal 11) at address 0x48
[4329024091] *CallStack::print_backtrace:Int32 +107
[4329024091] *CallStack::print_backtrace:Int32 +107
[4329024091] *CallStack::print_backtrace:Int32 +107
[4329009207] __crystal_sigfault_handler +55
# Also see: http://wmoxam.com/crystal-openbsd.html
doas pkg_add -i git llvm boehm-gc libevent pcre gmake bash
git clone git@github.com:wmoxam/crystal.git
cd crystal
git checkout tags/0.20.3
wget http://wmoxam.com/public/crystal-0.20.3.tar.gz
$ crystal eval 'puts "hi"'
/usr/local/lib/libevent_core.so.1.1: warning: warning: random() may return deterministic values, is that what you want?
hi
$
@wmoxam
wmoxam / Specs
Last active September 9, 2016 05:16
[wmoxam:~/projects/crystal] $ CC=/usr/local/bin/clang gmake spec
./bin/crystal build -o .build/all_spec spec/all_spec.cr
Using compiled compiler at .build/crystal
/usr/local/lib/libevent_core.so.1.1: warning: warning: random() may return deterministic values, is that what you want?
Warning: benchmarking without the `--release` flag won't yield useful results
/usr/local/lib/libxml2.so.15.1: warning: warning: strcat() is almost always misused, please use strlcat()
/usr/local/lib/libgmp.so.9.0: warning: warning: vsprintf() is often misused, please use vsnprintf()
/usr/local/lib/libevent_core.so.1.1: warning: warning: random() may return deterministic values, is that what you want?
/usr/local/lib/libgmp.so.9.0: warning: warning: strcpy() is almost always misused, please use strlcpy()
/usr/local/lib/libyaml.so.0.0: warning: warning: sprintf() is often misused, please use snprintf()