Skip to content

Instantly share code, notes, and snippets.

View Mikoangelo's full-sized avatar

Mikael Høilund Mikoangelo

  • Meta.io
  • Denmark
View GitHub Profile
module Compiler
compiler :'g++'
warnings :all
if Purpose == :debug
debug :on
optimization_level 0
macro :DEBUG
else
abort_on_warning
> 017ecc2 refs/heads/master (refs/heads/master) Added copy-pasted, semi-ported 32-bit codes.
> 6dec641 refs/heads/master Added dummy non-immediate float handlers. Temporarily.
> 6d9f9fa refs/heads/master Refactored snow_continuation_get_stack_bounds into arch-specific files.
> 88f17fe refs/heads/master Added SnRegisters and macros in arch.h
| > af3e708 refs/stash (refs/stash) WIP on master: 51d2c0f... it (not a keyword, but a magic local var. might change
| |\
|/ /
| > 0cba345 refs/stash index on master: 51d2c0f... it (not a keyword, but a magic local var. might change.)
|/
> 51d2c0f refs/heads/32bit (refs/remotes/origin/master, refs/heads/32bit) it (not a keyword, but a magic local var
>> foo, bar = { a: { a: 0, b: 0 }, b: { x: 10, y: 20 }}, { b: { y: 0, z: 30 }, c: { c: 0, d: 0 }}
=> [{:a=>{:a=>0, :b=>0}, :b=>{:x=>10, :y=>20}}, {:b=>{:y=>0, :z=>30}, :c=>{:c=>0, :d=>0}}]
>> foo.merge(bar) do |key, a, b| [key, a, b] end
=> {:a=>{:a=>0, :b=>0}, :b=>[:b, {:x=>10, :y=>20}, {:y=>0, :z=>30}], :c=>{:c=>0, :d=>0}}
>> recursive_merge = proc do |key, a, b| if Hash === a and Hash === b; a.merge(b, &recursive_merge) else a end end
=> #<Proc:0x137fb8@(irb):23>
>> foo.merge(bar, &recursive_merge)
=> {:a=>{:a=>0, :b=>0}, :b=>{:x=>10, :y=>20, :z=>30}, :c=>{:c=>0, :d=>0}}
>> foo.merge(bar, &(recursive_merge = proc { |key, a, b| if Hash === a and Hash === b; a.merge(b, &recursive_merge) else a end }))
=> {:a=>{:a=>0, :b=>0}, :b=>{:x=>10, :y=>20, :z=>30}, :c=>{:c=>0, :d=>0}}
#!/usr/bin/env snow
Array.merge_sort: {
if .length > 1
// Split.
left: @()
right: @()
midpoint: .length / 2
.each [elem, index] {
if index < midpoint
left << elem
#0 0x00007fff82e28f16 in __kill ()
#1 0x00007fff82e99f6d in abort ()
#2 0x00007fff82e908c1 in __assert_rtn ()
#3 0x00000001000677b3 in string_equals (self=@0x7fff5fbfc760, args=@0x7fff5fbfc800) at SnowString.cpp:112
#4 0x000000010004bfbe in snow::Function::call (this=0x101000390, self=@0x7fff5fbfc760, args=@0x7fff5fbfc800) at Function.cpp:28
#5 0x000000010006240c in snow::call_with_arguments (self=@0x7fff5fbfc900, function_or_object=@0x7fff5fbfc8f0, args=@0x7fff5fbfc800) at Runtime.cpp:54
#6 0x00000001000622a7 in snow::call_with_arguments (self=@0x7fff5fbfc900, function_or_object=@0x7fff5fbfc8f0, num_args=1, args_data=0x7fff5fbfc820) at Runtime.cpp:38
#7 0x0000000100062107 in va_call (self=@0x7fff5fbfc900, function_or_object=@0x7fff5fbfc8f0, num_args=1, ap=@0x7fff5fbfc8c0) at Runtime.cpp:21
#8 0x0000000100062229 in snow::call_internal (self=0x1004004a0, function_or_object=0x101000390, num_args=1) at Runtime.cpp:28
#9 0x00000001003e86cb in ?? ()
http://j.meta.io/d0dade6407ac42514cf442eb1026b53f.png
diff --git a/main.cpp b/main.cpp
index eed351b..24f1556 100644
--- a/main.cpp
+++ b/main.cpp
@@ -2,6 +2,9 @@
#include "parser/Driver.h"
#include "codegen/Codegen.h"
#include "runtime/Exception.h"
+#include "runtime/Array.h"
+#include "runtime/Global.h"
diff --git a/src/runtime/Array.cpp b/src/runtime/Array.cpp
index 5879076..be55571 100644
--- a/src/runtime/Array.cpp
+++ b/src/runtime/Array.cpp
@@ -2,6 +2,7 @@
#include "Runtime.h"
#include "SnowString.h"
#include "Function.h"
+#include "Exception.h"
#include <sstream>
#0 0x92324b78 in pthread_mutex_lock ()
#1 0x00177f31 in omp_set_lock (lock=0x96bac) at ../../../gcc-4.4.0/libgomp/config/posix/lock.c:58
#2 0x000455cd in snow::ThreadLocal<snow::HandleScope*>::object_for_thread (this=0x96ba0, num=0) at ThreadLocal.h:81
#3 0x0004543b in snow::ThreadLocal<snow::HandleScope*>::object (this=0x96ba0) at ThreadLocal.h:70
#4 0x00045390 in snow::ThreadLocal<snow::HandleScope*>::operator snow::HandleScope* (this=0x96ba0) at ThreadLocal.h:67
#5 0x00045203 in snow::HandleScope::current () at Handle.cpp:60
#6 0x00044e8f in HandleScope (this=0xbf800164) at Handle.cpp:11
#7 0x000430bd in snow::Function::call_with_arguments (this=0x1001f20, _self=0xffff9e89, _args=@0xbf800210) at Function.cpp:20
#8 0x0004352a in snow::Function::va_call (this=0x1001f20, _self=0xffff9e89, num_args=1, ap=@0xbf8002f8) at Function.cpp:58
#9 0x00054f54 in va_call (self=0xffff9e89, function_or_object=0x1001f20, num_args=1, ap=@0xbf8002f8) at Runtime.cpp:20
/*
* $Id: sftp_write_nonblock.c,v 1.13 2009/03/31 12:20:36 bagder Exp $
*
* Sample showing how to do SFTP non-blocking write transfers.
*
* The sample code has default values for host name, user name, password
* and path to copy, but you can specify them on the command line like:
*
* "sftp 192.168.0.1 user password sftp_write_nonblock.c /tmp/sftp_write_nonblock.c"
*/