/* generated by Id 1.1 at ,$ */ /* with the command: -I../stage1/ -c BlockClosure.st -o ../stage2/BlockClosure.o.c */ #include static struct __libid *_libid= 0; #ifdef ID_DEBUG # define _enter(info) void *__id_debug= _libid->enter(info) # define _line(lno) _libid->line(lno) # define _leave() _libid->leave(__id_debug) # define _backtrace() _libid->backtrace() #else # define _enter(info) (void)info # define _line(lno) # define _leave() # define _backtrace() "(no debugging information)\n" #endif #define _return _leave(); return #define _sendv(MSG, N, RCV, ARG...) ({ \ struct __send _s= { (MSG), (N), (RCV) }; \ ((_imp_t)(_libid->bindv(&_s)))(&_s, _s.receiver, _s.receiver, ##ARG); \ }) #define _superv(TYP, MSG, N, RCV, ARG...) ({ \ struct __send _s= { (MSG), (N), (TYP) }; \ _imp_t _imp= _libid->bindv(&_s); \ _s.receiver= (RCV); \ _imp(&_s, _s.receiver, _s.receiver, ##ARG); \ }) static oop s_value_value_= 0; static oop s_value_value_value_= 0; static oop s_function_5f_arity_5f_= 0; static oop s_value_5f_= 0; static oop s_arity= 0; static oop s__5fimport_= 0; static oop s_errorArgumentCount_= 0; static oop s_size_5f_value_5f_= 0; static oop s_printString= 0; static oop s_value_value_value_value_= 0; static oop s_value_value_value_value_value_= 0; static oop s_whileFalse_= 0; static oop s_ifFalse_= 0; static oop s_function_5f_arity_5f_outer_state_nlr_5f_= 0; static oop s_value_= 0; static oop s_whileTrue_= 0; static oop s__2c= 0; static oop s_ifTrue_= 0; static oop s_whileFalse= 0; static oop s_error_= 0; static oop s_value= 0; static oop s_whileTrue= 0; static oop s_repeat= 0; static struct _Selector { const char *name; oop *addr; } _Selectors[]= { { "value:value:", &s_value_value_ }, { "value:value:value:", &s_value_value_value_ }, { "function_:arity_:", &s_function_5f_arity_5f_ }, { "value_:", &s_value_5f_ }, { "arity", &s_arity }, { "_import:", &s__5fimport_ }, { "errorArgumentCount:", &s_errorArgumentCount_ }, { "size_:value_:", &s_size_5f_value_5f_ }, { "printString", &s_printString }, { "value:value:value:value:", &s_value_value_value_value_ }, { "value:value:value:value:value:", &s_value_value_value_value_value_ }, { "whileFalse:", &s_whileFalse_ }, { "ifFalse:", &s_ifFalse_ }, { "function_:arity_:outer:state:nlr_:", &s_function_5f_arity_5f_outer_state_nlr_5f_ }, { "value:", &s_value_ }, { "whileTrue:", &s_whileTrue_ }, { ",", &s__2c }, { "ifTrue:", &s_ifTrue_ }, { "whileFalse", &s_whileFalse }, { "error:", &s_error_ }, { "value", &s_value }, { "whileTrue", &s_whileTrue }, { "repeat", &s_repeat }, { 0, 0 } }; struct t__object { struct _vtable *_vtable[0]; }; struct t__selector { struct _vtable *_vtable[0]; oop v__size; oop v__elements; }; struct t__assoc { struct _vtable *_vtable[0]; oop v_key; oop v_value; }; struct t__closure { struct _vtable *_vtable[0]; oop v__method; oop v_data; }; struct t__vector { struct _vtable *_vtable[0]; oop v__size; }; struct t__vtable { struct _vtable *_vtable[0]; oop v__tally; oop v_bindings; oop v_delegate; }; struct t_Object { struct _vtable *_vtable[0]; }; struct t_UndefinedObject { struct _vtable *_vtable[0]; }; struct t_StaticBlockClosure { struct _vtable *_vtable[0]; oop v__function; oop v__arity; }; struct t_BlockClosure { struct _vtable *_vtable[0]; oop v__function; oop v__arity; oop v_outer; oop v_state; oop v__nlr; }; struct t_Magnitude { struct _vtable *_vtable[0]; }; struct t_Character { struct _vtable *_vtable[0]; oop v_value; }; struct t_Number { struct _vtable *_vtable[0]; }; struct t_Fraction { struct _vtable *_vtable[0]; oop v_numerator; oop v_denominator; }; struct t_Float { struct _vtable *_vtable[0]; }; struct t_Integer { struct _vtable *_vtable[0]; }; struct t_SmallInteger { struct _vtable *_vtable[0]; }; struct t_LargePositiveInteger { struct _vtable *_vtable[0]; oop v_bytes; }; struct t_LargeNegativeInteger { struct _vtable *_vtable[0]; oop v_bytes; }; struct t_Collection { struct _vtable *_vtable[0]; }; struct t_SequenceableCollection { struct _vtable *_vtable[0]; }; struct t_ArrayedCollection { struct _vtable *_vtable[0]; oop v_size; }; struct t_Array { struct _vtable *_vtable[0]; oop v_size; oop v__pointers; }; struct t_ImmutableArray { struct _vtable *_vtable[0]; oop v_size; oop v__pointers; }; struct t_WordArray { struct _vtable *_vtable[0]; oop v_size; oop v__words; }; struct t_ImmutableWordArray { struct _vtable *_vtable[0]; oop v_size; oop v__words; }; struct t_ByteArray { struct _vtable *_vtable[0]; oop v_size; oop v__bytes; }; struct t_ImmutableByteArray { struct _vtable *_vtable[0]; oop v_size; oop v__bytes; }; struct t_String { struct _vtable *_vtable[0]; oop v_size; oop v__bytes; }; struct t_ImmutableString { struct _vtable *_vtable[0]; oop v_size; oop v__bytes; }; struct t_Symbol { struct _vtable *_vtable[0]; oop v_size; oop v__bytes; }; struct t_nil { struct _vtable *_vtable[0]; }; struct t_true { struct _vtable *_vtable[0]; }; struct t_false { struct _vtable *_vtable[0]; }; struct t_CharacterTable { struct _vtable *_vtable[0]; oop v_size; oop v__pointers; }; static oop l_4= 0; static oop l_5= 0; static oop l_6= 0; static oop l_8= 0; static oop l_10= 0; static oop l_12= 0; static oop l_14= 0; static oop l_16= 0; static oop l_18= 0; static oop v__object= 0; static oop v_Object= 0; static oop v_UndefinedObject= 0; static oop v_StaticBlockClosure= 0; static oop v_BlockClosure= 0; static oop v_Magnitude= 0; static oop v_Number= 0; static oop v_Integer= 0; static oop v_SmallInteger= 0; static oop v_LargePositiveInteger= 0; static oop v_Collection= 0; static oop v_SequenceableCollection= 0; static oop v_ArrayedCollection= 0; static oop v_Array= 0; static oop v_WordArray= 0; static oop v_ByteArray= 0; static oop v_String= 0; static oop v_ImmutableString= 0; static oop v_nil= 0; static oop v_true= 0; static struct __methodinfo __info1= { "function_:arity_:", "StaticBlockClosure", "/Users/piumarta/src/idst/object/st80/BlockClosure.st", 0, 30, 42, 0 }; static oop StaticBlockClosure__function_5f_arity_5f_(oop v__closure, oop v_stateful_self, oop v_self, oop v__implementationAddress, oop v__argumentCount) { _enter(&__info1); oop _1= 0; _line(30); { # define self ((struct t_StaticBlockClosure *)v_self) # ifndef STAGE1 v_stateful_self= # endif v_self= _libid->alloc(v_self, sizeof(*self)); # undef self } _1= 0; _1= v__argumentCount; ((struct t_StaticBlockClosure *)v_stateful_self)->v__arity= _1; _1= v__implementationAddress; ((struct t_StaticBlockClosure *)v_stateful_self)->v__function= _1; _1= v_self; _leave(); return _1; _leave(); } static struct __methodinfo __info2= { "arity", "StaticBlockClosure", "/Users/piumarta/src/idst/object/st80/BlockClosure.st", 0, 42, 44, &__info1 }; static oop StaticBlockClosure__arity(oop v__closure, oop v_stateful_self, oop v_self) { _enter(&__info2); oop _1= 0; oop _2= 0; _line(42); _1= v_SmallInteger; _2= ((struct t_StaticBlockClosure *)v_stateful_self)->v__arity; _line(42); _1=_sendv(s_value_5f_, 2, _1, _2); _leave(); return _1; _leave(); } static struct __methodinfo __info3= { "errorArgumentCount:", "StaticBlockClosure", "/Users/piumarta/src/idst/object/st80/BlockClosure.st", 0, 44, 51, &__info2 }; static oop StaticBlockClosure__errorArgumentCount_(oop v__closure, oop v_stateful_self, oop v_self, oop v_actual) { _enter(&__info3); oop _1= 0; oop _2= 0; oop _3= 0; _line(44); _1= v_self; _2= l_4; _3= v_self; _line(46); _3=_sendv(s_arity, 1, _3); _line(46); _3=_sendv(s_printString, 1, _3); _line(46); _2=_sendv(s__2c, 2, _2, _3); _3= l_5; _line(46); _2=_sendv(s__2c, 2, _2, _3); _3= v_actual; _line(46); _3=_sendv(s_printString, 1, _3); _line(46); _2=_sendv(s__2c, 2, _2, _3); _3= l_6; _line(46); _2=_sendv(s__2c, 2, _2, _3); _line(46); _1=_sendv(s_error_, 2, _1, _2); _1= v_self; _leave(); return _1; _leave(); } static struct __methodinfo __info7= { "value", "StaticBlockClosure", "/Users/piumarta/src/idst/object/st80/BlockClosure.st", 0, 51, 57, &__info3 }; static oop StaticBlockClosure__value(oop v__closure, oop v_stateful_self, oop v_self) { _enter(&__info7); oop _1= 0; oop _2= 0; _line(51); { # define self ((struct t_StaticBlockClosure *)v_self) if ((long)self->v__arity == 0) return ((_imp_t)(self->v__function))(0, v_self); # undef self } _1= 0; _1= v_self; _2= l_8; _line(54); _1=_sendv(s_errorArgumentCount_, 2, _1, _2); _leave(); return _1; _leave(); } static struct __methodinfo __info9= { "value:", "StaticBlockClosure", "/Users/piumarta/src/idst/object/st80/BlockClosure.st", 0, 57, 63, &__info7 }; static oop StaticBlockClosure__value_(oop v__closure, oop v_stateful_self, oop v_self, oop v_a) { _enter(&__info9); oop _1= 0; oop _2= 0; _line(57); { # define self ((struct t_StaticBlockClosure *)v_self) if ((long)self->v__arity == 1) return ((_imp_t)(self->v__function))(0, v_self, v_a); # undef self } _1= 0; _1= v_self; _2= l_10; _line(60); _1=_sendv(s_errorArgumentCount_, 2, _1, _2); _leave(); return _1; _leave(); } static struct __methodinfo __info11= { "value:value:", "StaticBlockClosure", "/Users/piumarta/src/idst/object/st80/BlockClosure.st", 0, 63, 69, &__info9 }; static oop StaticBlockClosure__value_value_(oop v__closure, oop v_stateful_self, oop v_self, oop v_a, oop v_b) { _enter(&__info11); oop _1= 0; oop _2= 0; _line(63); { # define self ((struct t_StaticBlockClosure *)v_self) if ((long)self->v__arity == 2) return ((_imp_t)(self->v__function))(0, v_self, v_a, v_b); # undef self } _1= 0; _1= v_self; _2= l_12; _line(66); _1=_sendv(s_errorArgumentCount_, 2, _1, _2); _leave(); return _1; _leave(); } static struct __methodinfo __info13= { "value:value:value:", "StaticBlockClosure", "/Users/piumarta/src/idst/object/st80/BlockClosure.st", 0, 69, 75, &__info11 }; static oop StaticBlockClosure__value_value_value_(oop v__closure, oop v_stateful_self, oop v_self, oop v_a, oop v_b, oop v_c) { _enter(&__info13); oop _1= 0; oop _2= 0; _line(69); { # define self ((struct t_StaticBlockClosure *)v_self) if ((long)self->v__arity == 3) return ((_imp_t)(self->v__function))(0, v_self, v_a, v_b, v_c); # undef self } _1= 0; _1= v_self; _2= l_14; _line(72); _1=_sendv(s_errorArgumentCount_, 2, _1, _2); _leave(); return _1; _leave(); } static struct __methodinfo __info15= { "value:value:value:value:", "StaticBlockClosure", "/Users/piumarta/src/idst/object/st80/BlockClosure.st", 0, 75, 81, &__info13 }; static oop StaticBlockClosure__value_value_value_value_(oop v__closure, oop v_stateful_self, oop v_self, oop v_a, oop v_b, oop v_c, oop v_d) { _enter(&__info15); oop _1= 0; oop _2= 0; _line(75); { # define self ((struct t_StaticBlockClosure *)v_self) if ((long)self->v__arity == 4) return ((_imp_t)(self->v__function))(0, v_self, v_a, v_b, v_c, v_d); # undef self } _1= 0; _1= v_self; _2= l_16; _line(78); _1=_sendv(s_errorArgumentCount_, 2, _1, _2); _leave(); return _1; _leave(); } static struct __methodinfo __info17= { "value:value:value:value:value:", "StaticBlockClosure", "/Users/piumarta/src/idst/object/st80/BlockClosure.st", 0, 81, 89, &__info15 }; static oop StaticBlockClosure__value_value_value_value_value_(oop v__closure, oop v_stateful_self, oop v_self, oop v_a, oop v_b, oop v_c, oop v_d, oop v_e) { _enter(&__info17); oop _1= 0; oop _2= 0; _line(81); { # define self ((struct t_StaticBlockClosure *)v_self) if ((long)self->v__arity == 5) return ((_imp_t)(self->v__function))(0, v_self, v_a, v_b, v_c, v_d, v_e); # undef self } _1= 0; _1= v_self; _2= l_18; _line(84); _1=_sendv(s_errorArgumentCount_, 2, _1, _2); _leave(); return _1; _leave(); } static struct __methodinfo __info19= { "whileTrue", "StaticBlockClosure", "/Users/piumarta/src/idst/object/st80/BlockClosure.st", 0, 89, 94, &__info17 }; static oop StaticBlockClosure__whileTrue(oop v__closure, oop v_stateful_self, oop v_self) { _enter(&__info19); oop _1= 0; _line(89); /* whileTrue: */ goto _l2; _l1:; { _1= v_nil; } _l2:; { _1= v_self; _line(91); _1=_sendv(s_value, 1, _1); } if (_1) goto _l1; _1= 0; _1= v_self; _leave(); return _1; _leave(); } static struct __methodinfo __info20= { "whileTrue:", "StaticBlockClosure", "/Users/piumarta/src/idst/object/st80/BlockClosure.st", 0, 94, 102, &__info19 }; static oop StaticBlockClosure__whileTrue_(oop v__closure, oop v_stateful_self, oop v_self, oop v_aBlock) { _enter(&__info20); oop _1= 0; oop _2= 0; _line(94); /* ifTrue: */ _1= 0; _2= v_self; _line(96); _2=_sendv(s_value, 1, _2); if (!_2) goto _l3; { _1= v_aBlock; _line(98); _1=_sendv(s_value, 1, _1); _1= v_self; _2= v_aBlock; _line(99); _1=_sendv(s_whileTrue_, 2, _1, _2); } _l3:; _1= v_self; _leave(); return _1; _leave(); } static struct __methodinfo __info21= { "whileFalse", "StaticBlockClosure", "/Users/piumarta/src/idst/object/st80/BlockClosure.st", 0, 102, 107, &__info20 }; static oop StaticBlockClosure__whileFalse(oop v__closure, oop v_stateful_self, oop v_self) { _enter(&__info21); oop _1= 0; _line(102); /* whileFalse: */ goto _l5; _l4:; { _1= v_nil; } _l5:; { _1= v_self; _line(104); _1=_sendv(s_value, 1, _1); } if (!_1) goto _l4; _1= 0; _1= v_self; _leave(); return _1; _leave(); } static struct __methodinfo __info22= { "whileFalse:", "StaticBlockClosure", "/Users/piumarta/src/idst/object/st80/BlockClosure.st", 0, 107, 115, &__info21 }; static oop StaticBlockClosure__whileFalse_(oop v__closure, oop v_stateful_self, oop v_self, oop v_aBlock) { _enter(&__info22); oop _1= 0; oop _2= 0; _line(107); /* ifFalse: */ _1= 0; _2= v_self; _line(109); _2=_sendv(s_value, 1, _2); if (_2) goto _l6; { _1= v_aBlock; _line(111); _1=_sendv(s_value, 1, _1); _1= v_self; _2= v_aBlock; _line(112); _1=_sendv(s_whileFalse_, 2, _1, _2); } _l6:; _1= v_self; _leave(); return _1; _leave(); } static struct __methodinfo __info23= { "repeat", "StaticBlockClosure", "/Users/piumarta/src/idst/object/st80/BlockClosure.st", 0, 115, 121, &__info22 }; static oop StaticBlockClosure__repeat(oop v__closure, oop v_stateful_self, oop v_self) { _enter(&__info23); oop _1= 0; _line(115); /* whileTrue: */ goto _l8; _l7:; { _1= v_self; _line(117); _1=_sendv(s_value, 1, _1); } _l8:; { _1= v_true; } if (_1) goto _l7; _1= 0; _1= v_self; _leave(); return _1; _leave(); } static struct __methodinfo __info24= { "function_:arity_:outer:state:nlr_:", "BlockClosure", "/Users/piumarta/src/idst/object/st80/BlockClosure.st", 0, 126, 141, &__info23 }; static oop BlockClosure__function_5f_arity_5f_outer_state_nlr_5f_(oop v__closure, oop v_stateful_self, oop v_self, oop v__implementationAddress, oop v__argumentCount, oop v_outerBlock, oop v_variableArray, oop v__dynamicEnvironment) { _enter(&__info24); oop _1= 0; _line(126); { # define self ((struct t_BlockClosure *)v_self) # ifndef STAGE1 v_stateful_self= # endif v_self= _libid->alloc(v_self, sizeof(*self)); # undef self } _1= 0; _1= v__implementationAddress; ((struct t_BlockClosure *)v_stateful_self)->v__function= _1; _1= v__argumentCount; ((struct t_BlockClosure *)v_stateful_self)->v__arity= _1; _1= v_outerBlock; ((struct t_BlockClosure *)v_stateful_self)->v_outer= _1; _1= v_variableArray; ((struct t_BlockClosure *)v_stateful_self)->v_state= _1; _1= v__dynamicEnvironment; ((struct t_BlockClosure *)v_stateful_self)->v__nlr= _1; _1= v_self; _leave(); return _1; _leave(); } static struct __methodinfo __info= { "__id__init__", "", "BlockClosure.st", 0, 0, 0, &__info24 }; void __id__init__BlockClosure(struct __libid *__libid) { if (_libid) return; if (!(_libid= __libid)) { fprintf(stderr, "init _libid %p\n", __libid); abort(); } # define GC_add_roots _libid->gc_addRoots GC_INIT(); { struct _Selector *s= 0; for (s= _Selectors; s->name; ++s) *s->addr= _libid->intern(s->name); } _enter(&__info); _libid->infos(&__info, &__info1); _sendv(s__5fimport_, 3, _libid->_object, "Object", "__id__init__Object"); v__object= _libid->import("_object"); v_Object= _libid->import("Object"); v_UndefinedObject= _libid->import("UndefinedObject"); v_StaticBlockClosure= _libid->import("StaticBlockClosure"); v_BlockClosure= _libid->import("BlockClosure"); v_Magnitude= _libid->import("Magnitude"); v_Number= _libid->import("Number"); v_Integer= _libid->import("Integer"); v_SmallInteger= _libid->import("SmallInteger"); v_LargePositiveInteger= _libid->import("LargePositiveInteger"); v_Collection= _libid->import("Collection"); v_SequenceableCollection= _libid->import("SequenceableCollection"); v_ArrayedCollection= _libid->import("ArrayedCollection"); v_Array= _libid->import("Array"); v_WordArray= _libid->import("WordArray"); v_ByteArray= _libid->import("ByteArray"); v_String= _libid->import("String"); v_ImmutableString= _libid->import("ImmutableString"); v_nil= _libid->import("nil"); v_true= _libid->import("true"); _libid->method(v_StaticBlockClosure, s_function_5f_arity_5f_, (_imp_t)StaticBlockClosure__function_5f_arity_5f_); _libid->method(v_StaticBlockClosure, s_arity, (_imp_t)StaticBlockClosure__arity); l_4= _sendv(s_size_5f_value_5f_, 3, v_ImmutableString, 19, "this block expects "); l_5= _sendv(s_size_5f_value_5f_, 3, v_ImmutableString, 25, " arguments (invoked with "); l_6= _sendv(s_size_5f_value_5f_, 3, v_ImmutableString, 1, ")"); _libid->method(v_StaticBlockClosure, s_errorArgumentCount_, (_imp_t)StaticBlockClosure__errorArgumentCount_); l_8= _sendv(s_value_5f_, 2, v_SmallInteger, 0); _libid->method(v_StaticBlockClosure, s_value, (_imp_t)StaticBlockClosure__value); l_10= _sendv(s_value_5f_, 2, v_SmallInteger, 1); _libid->method(v_StaticBlockClosure, s_value_, (_imp_t)StaticBlockClosure__value_); l_12= _sendv(s_value_5f_, 2, v_SmallInteger, 1); _libid->method(v_StaticBlockClosure, s_value_value_, (_imp_t)StaticBlockClosure__value_value_); l_14= _sendv(s_value_5f_, 2, v_SmallInteger, 1); _libid->method(v_StaticBlockClosure, s_value_value_value_, (_imp_t)StaticBlockClosure__value_value_value_); l_16= _sendv(s_value_5f_, 2, v_SmallInteger, 1); _libid->method(v_StaticBlockClosure, s_value_value_value_value_, (_imp_t)StaticBlockClosure__value_value_value_value_); l_18= _sendv(s_value_5f_, 2, v_SmallInteger, 1); _libid->method(v_StaticBlockClosure, s_value_value_value_value_value_, (_imp_t)StaticBlockClosure__value_value_value_value_value_); _libid->method(v_StaticBlockClosure, s_whileTrue, (_imp_t)StaticBlockClosure__whileTrue); _libid->method(v_StaticBlockClosure, s_whileTrue_, (_imp_t)StaticBlockClosure__whileTrue_); _libid->method(v_StaticBlockClosure, s_whileFalse, (_imp_t)StaticBlockClosure__whileFalse); _libid->method(v_StaticBlockClosure, s_whileFalse_, (_imp_t)StaticBlockClosure__whileFalse_); _libid->method(v_StaticBlockClosure, s_repeat, (_imp_t)StaticBlockClosure__repeat); _libid->method(v_BlockClosure, s_function_5f_arity_5f_outer_state_nlr_5f_, (_imp_t)BlockClosure__function_5f_arity_5f_outer_state_nlr_5f_); _leave(); }