シェルスクリプト言語xyzshのソースコード。
Révision | 956cbb8d0e73207f2bf48d7c410c14cab7a92c10 (tree) |
---|---|
l'heure | 2013-01-06 00:10:33 |
Auteur | ab25cq <ab25cq@gmai...> |
Commiter | ab25cq |
1.2.9
@@ -1,4 +1,28 @@ | ||
1 | 1 | |
2 | +2013 1月6日 version 1.2.9 | |
3 | + | |
4 | + 1. defとclassに-copy-stackframeオプションがつきました。xyzsh.xyzshで定義されているtimes関数で使われてます。 | |
5 | + | |
6 | + 今までは | |
7 | + | |
8 | + > ls | var -local a b c; times 3 ( a ) | |
9 | + run time error | |
10 | + not found variable(a) | |
11 | + | |
12 | + とtimesのブロック内から外のローカル変数にアクセスできませんでしたが | |
13 | + | |
14 | + これからは | |
15 | + | |
16 | + > ls | var -local a b c ; times 3 ( a ) | |
17 | + bin | |
18 | + bin | |
19 | + bin | |
20 | + | |
21 | + のようにブロックの外のローカル変数にアクセスできます。 | |
22 | + times内で定義したローカル変数はtimesのブロックの外に出ると消えます。 | |
23 | + | |
24 | + 2. ダイナミックライブラリーのバージョンアップ | |
25 | + | |
2 | 26 | 2013 4th January version 1.2.8 |
3 | 27 | |
4 | 28 | 1. Refactoring. |
@@ -2,9 +2,16 @@ Fedoraなど各環境でコンパイルと日本語を通したselectorのチェ | ||
2 | 2 | |
3 | 3 | 端末のサイズを変えたときに画面が乱れる mfiler4 |
4 | 4 | |
5 | -Detected!! at file: src/block.c line:919 function:expand_env_to_command() addr:7f95128197d0 | |
6 | - Detected!! at file: src/block.c line:919 function:expand_env_to_command() addr:7f951292dbb0 | |
5 | +block -runがrun_functionになっているのはおかしい | |
7 | 6 | |
7 | +引数のブロックを格納する変数 BLOCKS | |
8 | 8 | |
9 | - Detected!! at file: src/block.c line:919 function:expand_env_to_command() addr:7ff502820bb0 | |
10 | - Detected!! at file: src/block.c line:919 function:expand_env_to_command() addr:7ff502806d50 | |
9 | +ヘルプの整理 | |
10 | + | |
11 | +xyzshのソースの整理 | |
12 | + | |
13 | +ASSERTマクロをもっと使う | |
14 | + | |
15 | +エラー出力のリダイレクト %2> | |
16 | + | |
17 | +変数に新規オブジェクトの作成機能はあるが代入の機能がない。 |
@@ -3024,7 +3024,7 @@ fi | ||
3024 | 3024 | ##################################################################### |
3025 | 3025 | # check operating systems |
3026 | 3026 | ##################################################################### |
3027 | -SO_VERSION=1.5.5 | |
3027 | +SO_VERSION=1.5.8 | |
3028 | 3028 | |
3029 | 3029 | { $as_echo "$as_me:${as_lineno-$LINENO}: checking Operating System" >&5 |
3030 | 3030 | $as_echo_n "checking Operating System... " >&6; } |
@@ -32,7 +32,7 @@ AC_SUBST(SYSTEM_MIGEMODIR) | ||
32 | 32 | ##################################################################### |
33 | 33 | # check operating systems |
34 | 34 | ##################################################################### |
35 | -SO_VERSION=1.5.6 | |
35 | +SO_VERSION=1.5.8 | |
36 | 36 | AC_SUBST(SO_VERSION) |
37 | 37 | AC_MSG_CHECKING(Operating System) |
38 | 38 |
@@ -542,6 +542,22 @@ def 関数名(ブロック) | ||
542 | 542 | aaa |
543 | 543 | -def |
544 | 544 | bbb |
545 | +-copy-stackframe スタックフレーム(ローカル変数の入れ物)を新しく作る際に現在のスタックフレームの内容をコピーします。 | |
546 | +(例) | |
547 | +> vim a.xyzsh | |
548 | +def times -copy-stackframe ( | |
549 | + print 0 | var -local _i | |
550 | + while(_i | -lt $ARGV[0]) ( | |
551 | + | eval $(block) | |
552 | + ++ _i | |
553 | + ) | |
554 | +) | |
555 | +> load a.xyzsh; print Hello | var -local a; times 3 ( a ) | |
556 | +Hello | |
557 | +Hello | |
558 | +Hello | |
559 | + | |
560 | +このオプションがないとtimes 3 ( a ) でaが見つからないエラーが出る。 | |
545 | 561 | - |
546 | 562 | class クラス名(ブロック) |
547 | 563 | - |
@@ -555,6 +571,22 @@ class クラス名(ブロック) | ||
555 | 571 | aaa |
556 | 572 | -def |
557 | 573 | bbb |
574 | +-copy-stackframe スタックフレーム(ローカル変数の入れ物)を新しく作る際に現在のスタックフレームの内容をコピーします。 | |
575 | +(例) | |
576 | +> vim a.xyzsh | |
577 | +class times -copy-stackframe ( | |
578 | + print 0 | var -local _i | |
579 | + while(_i | -lt $ARGV[0]) ( | |
580 | + | eval $(block) | |
581 | + ++ _i | |
582 | + ) | |
583 | +) | |
584 | +> load a.xyzsh; print Hello | var -local a; times 3 ( a ) | |
585 | +Hello | |
586 | +Hello | |
587 | +Hello | |
588 | + | |
589 | +このオプションがないとtimes 3 ( a ) でaが見つからないエラーが出る。 | |
558 | 590 | - |
559 | 591 | inherit 引数|オプション|ブロック |
560 | 592 | - |
@@ -1410,6 +1442,22 @@ If you omit the block, output the function source. | ||
1410 | 1442 | aaa |
1411 | 1443 | -def |
1412 | 1444 | bbb |
1445 | +-copy-stackframe When making new stackframe, xyzsh copys variables in old stackframe to new one. | |
1446 | +(ex) | |
1447 | +> vim a.xyzsh | |
1448 | +class times -copy-stackframe ( | |
1449 | + print 0 | var -local _i | |
1450 | + while(_i | -lt $ARGV[0]) ( | |
1451 | + | eval $(block) | |
1452 | + ++ _i | |
1453 | + ) | |
1454 | +) | |
1455 | +> load a.xyzsh; print Hello | var -local a; times 3 ( a ) | |
1456 | +Hello | |
1457 | +Hello | |
1458 | +Hello | |
1459 | + | |
1460 | +If there is not -copy-stackframe option, xyzsh raises an error which is "not found a variable" on "times 3 ( a )" code. | |
1413 | 1461 | - |
1414 | 1462 | class (class name) (block) |
1415 | 1463 | - |
@@ -750,9 +750,9 @@ void block_delete_stack(sObject* self) | ||
750 | 750 | if(SBLOCK(self).mSource) FREE(SBLOCK(self).mSource); |
751 | 751 | } |
752 | 752 | |
753 | -////////////////////////////////////////////////////////////////////////// | |
753 | +//////////////////////////////////////////////////// | |
754 | 754 | // some functions |
755 | -///////////////////////////////////////////////////////////////////////// | |
755 | +//////////////////////////////////////////////////// | |
756 | 756 | void block_view(sObject* self) |
757 | 757 | { |
758 | 758 | printf("mStatmentsNum %d\n", SBLOCK(self).mStatmentsNum); |
@@ -13,7 +13,7 @@ static int options_hash_fun(char* key) | ||
13 | 13 | return value % XYZSH_OPTION_MAX; |
14 | 14 | } |
15 | 15 | |
16 | -sObject* class_new_from_gc(sObject* parent, BOOL user_object) | |
16 | +sObject* class_new_from_gc(sObject* parent, BOOL user_object, BOOL no_stackframe) | |
17 | 17 | { |
18 | 18 | sObject* self = gc_get_free_object(T_CLASS, user_object); |
19 | 19 |
@@ -26,11 +26,13 @@ sObject* class_new_from_gc(sObject* parent, BOOL user_object) | ||
26 | 26 | SCLASS(self).mOptions = MALLOC(sizeof(option_hash_it)*XYZSH_OPTION_MAX); |
27 | 27 | memset(SCLASS(self).mOptions, 0, sizeof(option_hash_it)*XYZSH_OPTION_MAX); |
28 | 28 | |
29 | + SCLASS(self).mFlags = no_stackframe ? FUN_FLAGS_NO_STACKFRAME : 0; | |
30 | + | |
29 | 31 | return self; |
30 | 32 | } |
31 | 33 | |
32 | 34 | |
33 | -sObject* class_clone_from_stack_block_gc(sObject* block, BOOL user_object, sObject* parent) | |
35 | +sObject* class_clone_from_stack_block_to_gc(sObject* block, BOOL user_object, sObject* parent, BOOL no_stackframe) | |
34 | 36 | { |
35 | 37 | sObject* self = gc_get_free_object(T_CLASS, user_object); |
36 | 38 |
@@ -42,11 +44,12 @@ sObject* class_clone_from_stack_block_gc(sObject* block, BOOL user_object, sObje | ||
42 | 44 | SCLASS(self).mArgBlocks = NULL; |
43 | 45 | SCLASS(self).mOptions = MALLOC(sizeof(option_hash_it)*XYZSH_OPTION_MAX); |
44 | 46 | memset(SCLASS(self).mOptions, 0, sizeof(option_hash_it)*XYZSH_OPTION_MAX); |
47 | + SCLASS(self).mFlags = no_stackframe ? FUN_FLAGS_NO_STACKFRAME : 0; | |
45 | 48 | |
46 | 49 | return self; |
47 | 50 | } |
48 | 51 | |
49 | -sObject* class_clone_from_stack_block_stack(sObject* block, sObject* parent) | |
52 | +sObject* class_clone_from_stack_block_to_stack(sObject* block, sObject* parent, BOOL no_stackframe) | |
50 | 53 | { |
51 | 54 | sObject* self = stack_get_free_object(T_CLASS); |
52 | 55 |
@@ -59,6 +62,8 @@ sObject* class_clone_from_stack_block_stack(sObject* block, sObject* parent) | ||
59 | 62 | SCLASS(self).mOptions = MALLOC(sizeof(option_hash_it)*XYZSH_OPTION_MAX); |
60 | 63 | memset(SCLASS(self).mOptions, 0, sizeof(option_hash_it)*XYZSH_OPTION_MAX); |
61 | 64 | |
65 | + SCLASS(self).mFlags = no_stackframe ? FUN_FLAGS_NO_STACKFRAME : 0; | |
66 | + | |
62 | 67 | return self; |
63 | 68 | } |
64 | 69 |
@@ -352,7 +352,6 @@ BOOL cmd_raise(sObject* nextin, sObject* nextout, sRunInfo* runinfo) | ||
352 | 352 | return TRUE; |
353 | 353 | } |
354 | 354 | |
355 | - | |
356 | 355 | BOOL cmd_sweep(sObject* nextin, sObject* nextout, sRunInfo* runinfo) |
357 | 356 | { |
358 | 357 | sCommand* command = runinfo->mCommand; |
@@ -853,13 +852,15 @@ BOOL cmd_block(sObject* nextin, sObject* nextout, sRunInfo* runinfo) | ||
853 | 852 | |
854 | 853 | if(SFUN(fun).mArgBlocks && block_num < vector_count(SFUN(fun).mArgBlocks)) { |
855 | 854 | sObject* block = vector_item(SFUN(fun).mArgBlocks, block_num); |
856 | - sObject* fun = fun_clone_from_stack_block_stack(block, NULL); | |
857 | 855 | |
858 | - if(!run_function(fun, nextin, nextout, runinfo, command->mArgsRuntime + 2, command->mArgsNumRuntime -2, command->mBlocks, command->mBlocksNum)) | |
856 | + int rcode = 0; | |
857 | + if(!run(block, nextin, nextout, &rcode, runinfo->mCurrentObject, runinfo->mRunningObject)) | |
859 | 858 | { |
859 | + sCommand* command = runinfo->mCommand; | |
860 | + err_msg_adding("run time error", runinfo->mSName, runinfo->mSLine, command->mArgs[0]); | |
861 | + runinfo->mRCode = rcode; | |
860 | 862 | return FALSE; |
861 | 863 | } |
862 | - //runinfo->mRCode = runinfo->mRCode; | |
863 | 864 | } |
864 | 865 | } |
865 | 866 | else { |
@@ -58,10 +58,12 @@ static BOOL entry_fun(sObject* nextin, sObject* nextout, sRunInfo* runinfo, sObj | ||
58 | 58 | sObject* object = runinfo->mCurrentObject; |
59 | 59 | sCommand* command = runinfo->mCommand; |
60 | 60 | |
61 | + BOOL no_stackframe = sCommand_option_item(command, "-copy-stackframe"); | |
62 | + | |
61 | 63 | if(type == T_CLASS) |
62 | - block = class_clone_from_stack_block_gc(block, TRUE, NULL); // block is a stack object, so change the memory manager from stack to gc | |
64 | + block = class_clone_from_stack_block_to_gc(block, TRUE, NULL, no_stackframe); // block is a stack object, so change the memory manager from stack to gc | |
63 | 65 | else |
64 | - block = fun_clone_from_stack_block_gc(block, TRUE, NULL); // block is a stack object, so change the memory manager from stack to gc | |
66 | + block = fun_clone_from_stack_block_to_gc(block, TRUE, NULL, no_stackframe); // block is a stack object, so change the memory manager from stack to gc | |
65 | 67 | |
66 | 68 | if(sCommand_option_item(command, "-inherit")) { |
67 | 69 | sObject* parent = uobject_item(object, command->mArgsRuntime[1]); |
@@ -1209,7 +1211,7 @@ BOOL cmd_mrun(sObject* nextin, sObject* nextout, sRunInfo* runinfo) | ||
1209 | 1211 | sCommand* command = runinfo->mCommand; |
1210 | 1212 | |
1211 | 1213 | if(command->mBlocksNum == 1) { |
1212 | - sObject* klass = class_clone_from_stack_block_stack(command->mBlocks[0], NULL); | |
1214 | + sObject* klass = class_clone_from_stack_block_to_stack(command->mBlocks[0], NULL, sCommand_option_item(command, "-copy-stackframe")); | |
1213 | 1215 | |
1214 | 1216 | int rcode = 0; |
1215 | 1217 | if(!run(SCLASS(klass).mBlock, nextin, nextout, &rcode, runinfo->mRecieverObject, runinfo->mRunningObject)) { |
@@ -13,7 +13,7 @@ static int options_hash_fun(char* key) | ||
13 | 13 | return value % XYZSH_OPTION_MAX; |
14 | 14 | } |
15 | 15 | |
16 | -sObject* fun_new_from_gc(sObject* parent, BOOL user_object) | |
16 | +sObject* fun_new_from_gc(sObject* parent, BOOL user_object, BOOL no_stackframe) | |
17 | 17 | { |
18 | 18 | sObject* self = gc_get_free_object(T_FUN, user_object); |
19 | 19 |
@@ -29,6 +29,8 @@ sObject* fun_new_from_gc(sObject* parent, BOOL user_object) | ||
29 | 29 | SFUN(self).mOptions = MALLOC(sizeof(option_hash_it)*XYZSH_OPTION_MAX); |
30 | 30 | memset(SFUN(self).mOptions, 0, sizeof(option_hash_it)*XYZSH_OPTION_MAX); |
31 | 31 | |
32 | + SFUN(self).mFlags = no_stackframe ? FUN_FLAGS_NO_STACKFRAME : 0; | |
33 | + | |
32 | 34 | return self; |
33 | 35 | } |
34 | 36 |
@@ -47,10 +49,12 @@ sObject* fun_new_from_stack(sObject* parent) | ||
47 | 49 | SFUN(self).mOptions = MALLOC(sizeof(option_hash_it)*XYZSH_OPTION_MAX); |
48 | 50 | memset(SFUN(self).mOptions, 0, sizeof(option_hash_it)*XYZSH_OPTION_MAX); |
49 | 51 | |
52 | + SFUN(self).mFlags = 0; | |
53 | + | |
50 | 54 | return self; |
51 | 55 | } |
52 | 56 | |
53 | -sObject* fun_clone_from_stack_block_gc(sObject* block, BOOL user_object, sObject* parent) | |
57 | +sObject* fun_clone_from_stack_block_to_gc(sObject* block, BOOL user_object, sObject* parent, BOOL no_stackframe) | |
54 | 58 | { |
55 | 59 | sObject* self = gc_get_free_object(T_FUN, user_object); |
56 | 60 |
@@ -65,10 +69,12 @@ sObject* fun_clone_from_stack_block_gc(sObject* block, BOOL user_object, sObject | ||
65 | 69 | SFUN(self).mOptions = MALLOC(sizeof(option_hash_it)*XYZSH_OPTION_MAX); |
66 | 70 | memset(SFUN(self).mOptions, 0, sizeof(option_hash_it)*XYZSH_OPTION_MAX); |
67 | 71 | |
72 | + SFUN(self).mFlags = no_stackframe ? FUN_FLAGS_NO_STACKFRAME : 0; | |
73 | + | |
68 | 74 | return self; |
69 | 75 | } |
70 | 76 | |
71 | -sObject* fun_clone_from_stack_block_stack(sObject* block, sObject* parent) | |
77 | +sObject* fun_clone_from_stack_block_to_stack(sObject* block, sObject* parent, BOOL no_stackframe) | |
72 | 78 | { |
73 | 79 | sObject* self = stack_get_free_object(T_FUN); |
74 | 80 |
@@ -83,6 +89,8 @@ sObject* fun_clone_from_stack_block_stack(sObject* block, sObject* parent) | ||
83 | 89 | SFUN(self).mOptions = MALLOC(sizeof(option_hash_it)*XYZSH_OPTION_MAX); |
84 | 90 | memset(SFUN(self).mOptions, 0, sizeof(option_hash_it)*XYZSH_OPTION_MAX); |
85 | 91 | |
92 | + SFUN(self).mFlags = no_stackframe ? FUN_FLAGS_NO_STACKFRAME : 0; | |
93 | + | |
86 | 94 | return self; |
87 | 95 | } |
88 | 96 |
@@ -418,7 +418,7 @@ int hash_gc_children_mark(sObject* self) | ||
418 | 418 | while(it) { |
419 | 419 | sObject* item = it->mItem; |
420 | 420 | |
421 | - if((item->mFlg & GC_MARK) == 0) { | |
421 | + if(item && (item->mFlg & GC_MARK) == 0) { | |
422 | 422 | item->mFlg |= GC_MARK; |
423 | 423 | count++; |
424 | 424 | count += object_gc_children_mark(item); |
@@ -301,7 +301,7 @@ int list_gc_children_mark(sObject* self) | ||
301 | 301 | for(it= SLIST(self).mEntryIt; it; it=it->mNextIt) { |
302 | 302 | sObject* item = it->mItem; |
303 | 303 | |
304 | - if((item->mFlg & GC_MARK) == 0) { | |
304 | + if(item && (item->mFlg & GC_MARK) == 0) { | |
305 | 305 | item->mFlg |= GC_MARK; |
306 | 306 | count ++; |
307 | 307 | count += object_gc_children_mark(item); |
@@ -581,10 +581,28 @@ BOOL run_function(sObject* fun, sObject* nextin, sObject* nextout, sRunInfo* run | ||
581 | 581 | sRunInfo* runinfo2 = SFUN(fun).mRunInfo; |
582 | 582 | SFUN(fun).mRunInfo = runinfo; |
583 | 583 | |
584 | - sObject* stackframe = UOBJECT_NEW_GC(8, gXyzshObject, "_stackframe", FALSE); | |
585 | - vector_add(gStackFrames, stackframe); | |
586 | - //uobject_init(stackframe); | |
587 | - SFUN(fun).mLocalObjects = stackframe; | |
584 | + BOOL no_stackframe = SFUN(fun).mFlags & FUN_FLAGS_NO_STACKFRAME; | |
585 | + | |
586 | + if(!no_stackframe) { | |
587 | + sObject* stackframe = UOBJECT_NEW_GC(8, gXyzshObject, "_stackframe", FALSE); | |
588 | + vector_add(gStackFrames, stackframe); | |
589 | + //uobject_init(stackframe); | |
590 | + SFUN(fun).mLocalObjects = stackframe; | |
591 | + } else { | |
592 | + sObject* stackframe_before = vector_item(gStackFrames, vector_count(gStackFrames)-1); | |
593 | + sObject* stackframe = UOBJECT_NEW_GC(8, gXyzshObject, "_stackframe", FALSE); | |
594 | + vector_add(gStackFrames, stackframe); | |
595 | + //uobject_init(stackframe); | |
596 | + SFUN(fun).mLocalObjects = stackframe; | |
597 | + | |
598 | + uobject_it* it = uobject_loop_begin(stackframe_before); | |
599 | + while(it) { | |
600 | + sObject* object = uobject_loop_item(it); | |
601 | + char* key = uobject_loop_key(it); | |
602 | + uobject_put(stackframe, key, object); | |
603 | + it = uobject_loop_next(it); | |
604 | + } | |
605 | + } | |
588 | 606 | |
589 | 607 | sObject* argv2 = VECTOR_NEW_GC(16, FALSE); |
590 | 608 | int i; |
@@ -631,7 +649,7 @@ BOOL run_function(sObject* fun, sObject* nextin, sObject* nextout, sRunInfo* run | ||
631 | 649 | |
632 | 650 | (void)vector_pop_back(gStackFrames); |
633 | 651 | |
634 | -runinfo->mRCode = rcode; | |
652 | + runinfo->mRCode = rcode; | |
635 | 653 | |
636 | 654 | SFUN(fun).mLocalObjects = local_objects; |
637 | 655 | SFUN(fun).mArgBlocks = arg_blocks; |
@@ -688,7 +706,7 @@ static BOOL run_object(sObject* object, sObject* nextin, sObject* nextout, sRunI | ||
688 | 706 | |
689 | 707 | case T_CLASS: { |
690 | 708 | sCommand* command = runinfo->mCommand; |
691 | - if(!run_function(object, nextin, nextout, runinfo, command->mArgsRuntime + 1, command->mArgsNumRuntime -1, command->mBlocks, command->mBlocksNum)){ | |
709 | + if(!run_function(object, nextin, nextout, runinfo, command->mArgsRuntime + 1, command->mArgsNumRuntime -1, command->mBlocks, command->mBlocksNum)) { | |
692 | 710 | return FALSE; |
693 | 711 | } |
694 | 712 | } |
@@ -326,7 +326,7 @@ int uobject_gc_children_mark(sObject* self) | ||
326 | 326 | while(it) { |
327 | 327 | sObject* item = it->mItem; |
328 | 328 | |
329 | - if((item->mFlg & GC_MARK) == 0) { | |
329 | + if(item && (item->mFlg & GC_MARK) == 0) { | |
330 | 330 | item->mFlg |= GC_MARK; |
331 | 331 | count++; |
332 | 332 |
@@ -231,7 +231,7 @@ int vector_gc_children_mark(sObject* self) | ||
231 | 231 | for(i=0; i<SVECTOR(self).mCount; i++) { |
232 | 232 | sObject* item = SVECTOR(self).mTable[i]; |
233 | 233 | |
234 | - if((item->mFlg & GC_MARK) == 0) { | |
234 | + if(item && (item->mFlg & GC_MARK) == 0) { | |
235 | 235 | item->mFlg |= GC_MARK; |
236 | 236 | count++; |
237 | 237 |
@@ -85,7 +85,7 @@ static void xyzsh_read_rc() | ||
85 | 85 | |
86 | 86 | void xyzsh_init(enum eAppType app_type, BOOL no_runtime_script) |
87 | 87 | { |
88 | - setenv("XYZSH_VERSION", "1.2.8", 1); | |
88 | + setenv("XYZSH_VERSION", "1.2.9", 1); | |
89 | 89 | setenv("XYZSH_DATAROOTDIR", DATAROOTDIR, 1); |
90 | 90 | |
91 | 91 | setlocale(LC_ALL, ""); |
@@ -25,13 +25,11 @@ void sCommand_add_env_block(sCommand* self, sObject* block, BOOL double_dollar, | ||
25 | 25 | void sCommand_add_env(sCommand* self, MANAGED char* name, MANAGED char* key, BOOL key_env, BOOL double_dollar); |
26 | 26 | void sCommand_add_redirect_to_command(sCommand* self, MANAGED char* name, BOOL env, BOOL glob, int redirect); |
27 | 27 | |
28 | -sObject* fun_clone_from_stack_block_gc(sObject* block, BOOL user_object, sObject* parent); | |
29 | -sObject* fun_clone_from_stack_block_stack(sObject* block, sObject* parent); | |
28 | +sObject* fun_clone_from_stack_block_to_gc(sObject* block, BOOL user_object, sObject* parent, BOOL no_stackframe); | |
29 | +sObject* fun_clone_from_stack_block_to_stack(sObject* block, sObject* parent, BOOL no_stackframe); | |
30 | 30 | |
31 | -sObject* make_stack_fun_from_stack_block(sObject* self); | |
32 | - | |
33 | -sObject* class_clone_from_stack_block_gc(sObject* block, BOOL user_object, sObject* parent); | |
34 | -sObject* class_clone_from_stack_block_stack(sObject* block, sObject* parent); | |
31 | +sObject* class_clone_from_stack_block_to_gc(sObject* block, BOOL user_object, sObject* parent, BOOL no_stackframe); | |
32 | +sObject* class_clone_from_stack_block_to_stack(sObject* block, sObject* parent, BOOL no_stackframe); | |
35 | 33 | |
36 | 34 | #endif |
37 | 35 |
@@ -276,6 +276,8 @@ struct block_obj | ||
276 | 276 | struct _sObject; |
277 | 277 | struct _sRunInfo; |
278 | 278 | |
279 | +#define FUN_FLAGS_NO_STACKFRAME 0x01 | |
280 | + | |
279 | 281 | typedef struct |
280 | 282 | { |
281 | 283 | struct _sObject* mBlock; |
@@ -287,6 +289,8 @@ typedef struct | ||
287 | 289 | |
288 | 290 | option_hash_it* mOptions; |
289 | 291 | struct _sRunInfo* mRunInfo; |
292 | + | |
293 | + char mFlags; | |
290 | 294 | } fun_obj; |
291 | 295 | |
292 | 296 | typedef fun_obj class_obj; |
@@ -498,8 +502,8 @@ void nfun_delete_gc(sObject* self); | ||
498 | 502 | BOOL nfun_put_option_with_argument(sObject* self, MANAGED char* key); |
499 | 503 | BOOL nfun_option_with_argument_item(sObject* self, char* key); |
500 | 504 | |
501 | -sObject* fun_new_from_gc(sObject* parent, BOOL user_object); | |
502 | -#define FUN_NEW_GC(o, o2) fun_new_from_gc(o, o2) | |
505 | +sObject* fun_new_from_gc(sObject* parent, BOOL user_object, BOOL no_stackframe); | |
506 | +#define FUN_NEW_GC(o, o2, o3) fun_new_from_gc(o, o2, o3) | |
503 | 507 | void fun_delete_gc(sObject* self); |
504 | 508 | int fun_gc_children_mark(sObject* self); |
505 | 509 | #define FUN_NEW_STACK(o) fun_new_from_stack(o) |
@@ -508,8 +512,8 @@ void fun_delete_stack(sObject* self); | ||
508 | 512 | BOOL fun_put_option_with_argument(sObject* self, MANAGED char* key); |
509 | 513 | BOOL fun_option_with_argument_item(sObject* self, char* key); |
510 | 514 | |
511 | -sObject* class_new_from_gc(sObject* parent, BOOL user_object); | |
512 | -#define CLASS_NEW_GC(o, o2) class_fun_new_from_gc(o, o2) | |
515 | +sObject* class_new_from_gc(sObject* parent, BOOL user_object, BOOL no_stackframe); | |
516 | +#define CLASS_NEW_GC(o, o2, o3) class_fun_new_from_gc(o, o2, o3) | |
513 | 517 | void class_delete_gc(sObject* self); |
514 | 518 | void class_delete_stack(sObject* self); |
515 | 519 | BOOL class_option_with_argument_item(sObject* self, char* key); |
@@ -80,11 +80,11 @@ EOS > ~/.xyzsh/macro | ||
80 | 80 | ) |
81 | 81 | ) |
82 | 82 | |
83 | -def times ( | |
84 | - print 0 | var -local i | |
85 | - while(i | -lt $ARGV[0]) ( | |
83 | +def times -copy-stackframe ( | |
84 | + print 0 | var -local _i | |
85 | + while(_i | -lt $ARGV[0]) ( | |
86 | 86 | | eval $(block) |
87 | - ++ i | |
87 | + ++ _i | |
88 | 88 | ) |
89 | 89 | ) |
90 | 90 |