- Timestamp:
- 11/09/08 21:26:02 (2 months ago)
- Location:
- v6/smop
- Files:
-
- 17 modified
- 1 moved
-
CMakeLists.txt (modified) (1 diff)
-
include/smop_identifiers.h (modified) (1 diff)
-
src/idconst_decl_all.h (modified) (1 diff)
-
src/idconst_init_all.c (modified) (2 diffs)
-
src/lowlevel.sm0p (modified) (2 diffs)
-
src/native_bool.c (modified) (1 diff)
-
src/native_int.ri (moved) (moved from v6/smop/src/native_int.c) (5 diffs)
-
src/s1p_array.c (modified) (1 diff)
-
src/s1p_grep.sm0p (modified) (1 diff)
-
src/s1p_lexicalscope.ri (modified) (2 diffs)
-
src/s1p_lexicalscope.sm0p (modified) (2 diffs)
-
src/s1p_scalar.c (modified) (1 diff)
-
test/32_array_iterator.m0ld (modified) (1 diff)
-
test/34_array_unshift.m0ld (modified) (1 diff)
-
test/35_array_grep.m0ld (modified) (2 diffs)
-
test/36_adhoc_signature.m0ld (modified) (1 diff)
-
test/37_multisub.m0ld (modified) (4 diffs)
-
test/38_ritest.m0ld (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
v6/smop/CMakeLists.txt
r22915 r22940 109 109 src/s1p_attribute.ri 110 110 src/s1p_hash_bvalue.ri 111 src/native_int.ri 111 112 ) 112 113 compile_ri (${ri_file}) -
v6/smop/include/smop_identifiers.h
r22711 r22940 12 12 extern SMOP__Object* SMOP__ID__BIND; /* "BIND" */ 13 13 extern SMOP__Object* SMOP__ID__bless; /* "bless" */ 14 extern SMOP__Object* SMOP__ID__ bool; /* "bool" */14 extern SMOP__Object* SMOP__ID__true; /* "true" */ 15 15 extern SMOP__Object* SMOP__ID__BUILDALL; /* "BUILDALL" */ 16 16 extern SMOP__Object* SMOP__ID__BUILD; /* "BUILD" */ -
v6/smop/src/idconst_decl_all.h
r22711 r22940 3 3 SMOP__Object* SMOP__ID__BIND; 4 4 SMOP__Object* SMOP__ID__bless; 5 SMOP__Object* SMOP__ID__ bool;5 SMOP__Object* SMOP__ID__true; 6 6 SMOP__Object* SMOP__ID__BUILDALL; 7 7 SMOP__Object* SMOP__ID__BUILD; -
v6/smop/src/idconst_init_all.c
r22711 r22940 3 3 SMOP__ID__BIND = SMOP__NATIVE__idconst_create_nolist( "BIND" ); 4 4 SMOP__ID__bless = SMOP__NATIVE__idconst_create_nolist( "bless" ); 5 SMOP__ID__ bool = SMOP__NATIVE__idconst_create_nolist( "bool" );5 SMOP__ID__true = SMOP__NATIVE__idconst_create_nolist( "true" ); 6 6 SMOP__ID__BUILDALL = SMOP__NATIVE__idconst_create_nolist( "BUILDALL" ); 7 7 SMOP__ID__BUILD = SMOP__NATIVE__idconst_create_nolist( "BUILD" ); … … 118 118 constlist[2] = SMOP__ID__BIND; 119 119 constlist[3] = SMOP__ID__bless; 120 constlist[4] = SMOP__ID__ bool;120 constlist[4] = SMOP__ID__true; 121 121 constlist[5] = SMOP__ID__BUILDALL; 122 122 constlist[6] = SMOP__ID__BUILD; -
v6/smop/src/lowlevel.sm0p
r22923 r22940 156 156 157 157 if ((SMOP__Object*)SMOP_RI(value) == SMOP__INTPTR__InterpreterInstance || 158 (SMOP__Object*)SMOP_RI(value) == SMOP__NATIVE__capture || 159 (SMOP__Object*)SMOP_RI(value) == SMOP__NATIVE__int || 160 (SMOP__Object*)SMOP_RI(value) == SMOP__NATIVE__uint) { 158 (SMOP__Object*)SMOP_RI(value) == SMOP__NATIVE__capture) { 161 159 162 160 SMOP_DISPATCH(interpreter, SMOP_RI(value), SMOP__ID__DESTROYALL, value); … … 179 177 smop_lowlevel_free(value); 180 178 } else if ((SMOP__Object*)SMOP_RI(value) == SMOP__INTPTR__InterpreterInstance || 181 (SMOP__Object*)SMOP_RI(value) == SMOP__NATIVE__capture || 182 (SMOP__Object*)SMOP_RI(value) == SMOP__NATIVE__int || 183 (SMOP__Object*)SMOP_RI(value) == SMOP__NATIVE__uint) { 179 (SMOP__Object*)SMOP_RI(value) == SMOP__NATIVE__capture) { 184 180 185 181 SMOP_DISPATCH(interpreter, SMOP_RI(value), SMOP__ID__DESTROYALL, value); -
v6/smop/src/native_bool.c
r22663 r22940 19 19 ___INVOCANT_RI_SHOULD_MATCH___; 20 20 SMOP__Object* ret = SMOP__NATIVE__bool_false; 21 if (identifier == SMOP__ID__ bool) {21 if (identifier == SMOP__ID__true) { 22 22 ret = SMOP_REFERENCE(interpreter,invocant); 23 23 } else if (identifier == SMOP__ID__defined) { -
v6/smop/src/native_int.ri
r22299 r22940 1 #include <stdlib.h> 2 #include <smop.h> 3 #include <smop_lowlevel.h> 4 #include <smop_s1p.h> 5 #include <stdio.h> 6 7 SMOP__Object* SMOP__NATIVE__int; 8 9 typedef struct smop_native_int_struct { 10 SMOP__Object__BASE 11 int intvalue; 12 } smop_native_int_struct; 13 14 static SMOP__Object* int_message(SMOP__Object* interpreter, 15 SMOP__ResponderInterface* self, 16 SMOP__Object* identifier, 17 SMOP__Object* capture) { 18 19 ___CONST_IDENTIFIER_ONLY___; 20 21 SMOP__Object* ret = SMOP__NATIVE__bool_false; 22 23 if (identifier == SMOP__ID__infix_num_gt) { 24 25 ___NATIVE_CAPTURE_ONLY___; 26 ___INVOCANT_RI_SHOULD_MATCH___; 27 1 %prefix smop_native_int 2 %RI SMOP__NATIVE__int 3 %RI.id Native int 4 %attr int intvalue 5 %method infix:> 28 6 SMOP__Object* other = SMOP__NATIVE__capture_positional(interpreter,capture,0); 29 7 if (SMOP_RI(other) == (SMOP__ResponderInterface*)SMOP__NATIVE__int) { 30 //fprintf(stderr,"native int: %d > %d\n", SMOP__NATIVE__int_fetch(invocant),31 // SMOP__NATIVE__int_fetch(other));32 8 if (SMOP__NATIVE__int_fetch(invocant) > SMOP__NATIVE__int_fetch(other)) { 33 9 ret = SMOP__NATIVE__bool_true; … … 38 14 ___UNKNOWN_METHOD___; 39 15 } 40 41 16 SMOP_RELEASE(interpreter, other); 42 SMOP_RELEASE(interpreter,invocant); 43 44 } else if (identifier == SMOP__ID__defined) { 45 ret = SMOP__NATIVE__bool_true; 46 47 } else if (identifier == SMOP__ID__FETCH) { 48 ___NATIVE_CAPTURE_ONLY___; 49 ___INVOCANT_RI_SHOULD_MATCH___; 50 ret = invocant; 51 52 } else if (identifier == SMOP__ID__infix_num_ge) { 53 54 ___NATIVE_CAPTURE_ONLY___; 55 ___INVOCANT_RI_SHOULD_MATCH___; 56 17 %method infix:>= 57 18 SMOP__Object* other = SMOP__NATIVE__capture_positional(interpreter,capture,0); 58 19 if (SMOP_RI(other) == (SMOP__ResponderInterface*)SMOP__NATIVE__int) { 59 //fprintf(stderr,"native int: %d > %d\n", SMOP__NATIVE__int_fetch(invocant),60 // SMOP__NATIVE__int_fetch(other));61 20 if (SMOP__NATIVE__int_fetch(invocant) >= SMOP__NATIVE__int_fetch(other)) { 62 21 ret = SMOP__NATIVE__bool_true; … … 67 26 ___UNKNOWN_METHOD___; 68 27 } 69 70 28 SMOP_RELEASE(interpreter, other); 71 SMOP_RELEASE(interpreter,invocant); 72 73 } else if (identifier == SMOP__ID__DESTROYALL) { 74 // notthing 75 } else if (identifier == SMOP__ID__new) { 76 29 %method defined 30 ret = SMOP__NATIVE__bool_true; 31 %method FETCH 32 ___VALUE_FETCH___; 33 %method STORE 34 ___VALUE_STORE___; 35 %method new 77 36 SMOP__Object* other = SMOP__NATIVE__capture_positional(interpreter,capture,0); 78 37 if (other && SMOP_RI(other) == (SMOP__ResponderInterface*)SMOP__NATIVE__int) { … … 84 43 return SMOP__NATIVE__int_create(0); 85 44 } 86 87 } else if (identifier == SMOP__ID__postfix_plusplus) { 88 89 ___NATIVE_CAPTURE_ONLY___; 90 ___INVOCANT_RI_SHOULD_MATCH___; 91 45 %method postfix:++ 92 46 smop_lowlevel_wrlock(invocant); 93 47 ((smop_native_int_struct*)invocant)->intvalue++; 94 48 smop_lowlevel_unlock(invocant); 95 96 SMOP_RELEASE(interpreter, invocant); 97 98 } else { 99 ___UNKNOWN_METHOD___; 100 } 101 102 SMOP_RELEASE(interpreter,capture); 103 return ret; 104 } 105 106 107 void smop_native_int_init() { 108 SMOP__NATIVE__int = calloc(1,sizeof(SMOP__ResponderInterface)); 109 ((SMOP__ResponderInterface*)SMOP__NATIVE__int)->MESSAGE = int_message; 110 ((SMOP__ResponderInterface*)SMOP__NATIVE__int)->REFERENCE = smop_lowlevel_generic_reference; 111 ((SMOP__ResponderInterface*)SMOP__NATIVE__int)->RELEASE = smop_lowlevel_generic_release; 112 ((SMOP__ResponderInterface*)SMOP__NATIVE__int)->id = "Native int"; 113 } 114 115 void smop_native_int_destr() { 116 free(SMOP__NATIVE__int); 117 } 118 49 %method DESTROYALL 50 %{ 119 51 SMOP__Object* SMOP__NATIVE__int_create(int value) { 120 52 SMOP__Object* ret = smop_lowlevel_alloc(sizeof(smop_native_int_struct)); … … 130 62 return v; 131 63 } 64 %} -
v6/smop/src/s1p_array.c
r22729 r22940 134 134 SMOP_RELEASE(interpreter,invocant->array); 135 135 136 } else if (identifier == SMOP__ID__ bool) {136 } else if (identifier == SMOP__ID__true) { 137 137 ret = SMOP__NATIVE__bool_true; 138 138 -
v6/smop/src/s1p_grep.sm0p
r22543 r22940 129 129 my $capture = ¢SMOP__S1P__Capturize."capturize"($item); 130 130 my $result = $code."postcircumfix:( )"($capture); 131 my $bool = $result." bool"();131 my $bool = $result."true"(); 132 132 if $bool { goto in } else { goto fetch_item }; 133 133 -
v6/smop/src/s1p_lexicalscope.ri
r22725 r22940 19 19 SMOP_REFERENCE(interpreter, ret); 20 20 21 %method bool21 %method true 22 22 ret = SMOP__NATIVE__bool_true; 23 23 … … 84 84 else: 85 85 my $outer = $invocant."outer"(); 86 my $outer_true = $outer." bool"();86 my $outer_true = $outer."true"(); 87 87 my $outer_cell = $outer."FETCH"(); 88 88 if $outer_true {goto than2} else {goto else2}; -
v6/smop/src/s1p_lexicalscope.sm0p
r22512 r22940 44 44 SMOP_REFERENCE(interpreter, ret); 45 45 46 } else if (identifier == SMOP__ID__ bool) {46 } else if (identifier == SMOP__ID__true) { 47 47 ret = SMOP__NATIVE__bool_true; 48 48 … … 143 143 else: 144 144 my $outer = $invocant."outer"(); 145 my $outer_true = $outer." bool"();145 my $outer_true = $outer."true"(); 146 146 my $outer_cell = $outer."FETCH"(); 147 147 if $outer_true {goto than2} else {goto else2}; -
v6/smop/src/s1p_scalar.c
r22730 r22940 43 43 SMOP_REFERENCE(interpreter,ret); 44 44 45 } else if (SMOP__ID__ bool== identifier) {45 } else if (SMOP__ID__true == identifier) { 46 46 SMOP__Object* cell = SMOP__S1P__Scalar_FETCH(scalar); 47 47 ret = SMOP_DISPATCH(interpreter, SMOP_RI(cell), 48 SMOP__ID__ bool,48 SMOP__ID__true, 49 49 SMOP__NATIVE__capture_delegate(interpreter, 50 50 SMOP_REFERENCE(interpreter,cell), -
v6/smop/test/32_array_iterator.m0ld
r22268 r22940 23 23 my $elems = $list."elems"(); 24 24 my $greater = $elems."infix:>"(0); 25 my $bool = $greater." bool"();25 my $bool = $greater."true"(); 26 26 27 27 if $bool { goto iteration } else { goto end }; -
v6/smop/test/34_array_unshift.m0ld
r22289 r22940 23 23 my $elems = $list."elems"(); 24 24 my $greater = $elems."infix:>"(0); 25 my $bool = $greater." bool"();25 my $bool = $greater."true"(); 26 26 27 27 if $bool { goto iteration } else { goto end }; -
v6/smop/test/35_array_grep.m0ld
r22543 r22940 34 34 35 35 my $greater = $it."infix:>"(3); 36 my $bool = $greater." bool"();36 my $bool = $greater."true"(); 37 37 38 38 my $out_scalar = ¢SMOP__S1P__RootNamespace."postcircumfix:{ }"("$*OUT"); … … 64 64 65 65 my $greater = $it."infix:>"(3); 66 my $bool = $greater." bool"();66 my $bool = $greater."true"(); 67 67 68 68 my $continuation = $interpreter."continuation"(); -
v6/smop/test/36_adhoc_signature.m0ld
r22525 r22940 64 64 65 65 my $accepts = $signature."ACCEPTS"(1); 66 my $accepts_bool = $accepts." bool"();66 my $accepts_bool = $accepts."true"(); 67 67 if $accepts_bool { goto then } else { goto else }; 68 68 -
v6/smop/test/37_multisub.m0ld
r22692 r22940 23 23 my $cap = ¢SMOP__S1P__Capturize."capturize"($p1, ¢SMOP__NATIVE__int); 24 24 my $cmp = ¢SMOP__S1P__ritest."postcircumfix:( )"($cap); 25 my $bool = $cmp." bool"();25 my $bool = $cmp."true"(); 26 26 27 27 if $bool { goto nexttest } else { goto false }; … … 29 29 $cap = ¢SMOP__S1P__Capturize."capturize"($p2, ¢SMOP__NATIVE__int); 30 30 $cmp = ¢SMOP__S1P__ritest."postcircumfix:( )"($cap); 31 $bool = $cmp." bool"();31 $bool = $cmp."true"(); 32 32 33 33 if $bool { goto true } else { goto false }; … … 67 67 my $cap = ¢SMOP__S1P__Capturize."capturize"($p1, ¢SMOP__NATIVE__bool); 68 68 my $cmp = ¢SMOP__S1P__ritest."postcircumfix:( )"($cap); 69 my $bool = $cmp." bool"();69 my $bool = $cmp."true"(); 70 70 71 71 if $bool { goto nexttest } else { goto false }; … … 73 73 $cap = ¢SMOP__S1P__Capturize."capturize"($p2, ¢SMOP__NATIVE__bool); 74 74 $cmp = ¢SMOP__S1P__ritest."postcircumfix:( )"($cap); 75 $bool = $cmp." bool"();75 $bool = $cmp."true"(); 76 76 77 77 if $bool { goto true } else { goto false }; -
v6/smop/test/38_ritest.m0ld
r22543 r22940 10 10 my $capture = ¢SMOP__S1P__Capturize."capturize"(1, ¢SMOP__NATIVE__int); 11 11 my $test = ¢SMOP__S1P__ritest."postcircumfix:( )"($capture); 12 my $bool = $test." bool"();12 my $bool = $test."true"(); 13 13 14 14 if $bool { goto isint } else { goto notint }; … … 24 24 $capture = ¢SMOP__S1P__Capturize."capturize"("test", ¢SMOP__NATIVE__int); 25 25 $test = ¢SMOP__S1P__ritest."postcircumfix:( )"($capture); 26 $bool = $test." bool"();26 $bool = $test."true"(); 27 27 28 28 if $bool { goto isint2 } else { goto notint2 };
