picolisp

Unnamed repository; edit this file to name it for gitweb.
git clone https://logand.com/git/picolisp.git/
Log | Files | Refs | README | LICENSE

commit c17a6dbf0a12ae6b4d85b7ff64af150408ca5004
parent 1523c30a1b9a29cc6909b19af2fd91821fb015c1
Author: Alexander Burger <abu@software-lab.de>
Date:   Fri,  5 Jul 2013 10:55:04 +0200

Allow top-level 'yield' (resume coroutine with value)
Diffstat:
Mersatz/picolisp.jar | 0
Mlib/map | 22+++++++++++-----------
Msrc/vers.h | 2+-
Msrc64/err.l | 3++-
Msrc64/flow.l | 23++++++++++++++++++-----
Msrc64/tags | 222++++++++++++++++++++++++++++++++++++++++----------------------------------------
Msrc64/version.l | 4++--
7 files changed, 145 insertions(+), 131 deletions(-)

diff --git a/ersatz/picolisp.jar b/ersatz/picolisp.jar Binary files differ. diff --git a/lib/map b/lib/map @@ -1,5 +1,5 @@ -! (2908 . "@src64/flow.l") -$ (3010 . "@src64/flow.l") +! (2921 . "@src64/flow.l") +$ (3023 . "@src64/flow.l") % (2572 . "@src64/big.l") & (2807 . "@src64/big.l") * (2389 . "@src64/big.l") @@ -46,7 +46,7 @@ bool (1724 . "@src64/flow.l") box (828 . "@src64/flow.l") box? (1131 . "@src64/sym.l") by (1669 . "@src64/apply.l") -bye (3458 . "@src64/flow.l") +bye (3471 . "@src64/flow.l") bytes (2973 . "@src64/subr.l") caaaar (271 . "@src64/subr.l") caaadr (288 . "@src64/subr.l") @@ -62,7 +62,7 @@ caddar (409 . "@src64/subr.l") cadddr (435 . "@src64/subr.l") caddr (156 . "@src64/subr.l") cadr (45 . "@src64/subr.l") -call (3110 . "@src64/flow.l") +call (3123 . "@src64/flow.l") car (5 . "@src64/subr.l") case (1965 . "@src64/flow.l") catch (2467 . "@src64/flow.l") @@ -115,7 +115,7 @@ diff (2590 . "@src64/subr.l") dir (3163 . "@src64/main.l") dm (545 . "@src64/flow.l") do (2141 . "@src64/flow.l") -e (2971 . "@src64/flow.l") +e (2984 . "@src64/flow.l") echo (4434 . "@src64/io.l") env (609 . "@src64/main.l") eof (3549 . "@src64/io.l") @@ -141,7 +141,7 @@ flip (1700 . "@src64/subr.l") flush (5143 . "@src64/io.l") fold (3521 . "@src64/sym.l") for (2230 . "@src64/flow.l") -fork (3284 . "@src64/flow.l") +fork (3297 . "@src64/flow.l") format (2089 . "@src64/big.l") free (1960 . "@src64/db.l") from (3568 . "@src64/io.l") @@ -169,12 +169,12 @@ inc (2256 . "@src64/big.l") index (2638 . "@src64/subr.l") info (3056 . "@src64/main.l") intern (1007 . "@src64/sym.l") -ipid (3229 . "@src64/flow.l") +ipid (3242 . "@src64/flow.l") isa (967 . "@src64/flow.l") job (1429 . "@src64/flow.l") journal (971 . "@src64/db.l") key (3401 . "@src64/io.l") -kill (3261 . "@src64/flow.l") +kill (3274 . "@src64/flow.l") last (2045 . "@src64/subr.l") le0 (2693 . "@src64/big.l") length (2742 . "@src64/subr.l") @@ -239,7 +239,7 @@ on (1717 . "@src64/sym.l") onOff (1747 . "@src64/sym.l") one (1780 . "@src64/sym.l") open (4360 . "@src64/io.l") -opid (3245 . "@src64/flow.l") +opid (3258 . "@src64/flow.l") opt (3354 . "@src64/main.l") or (1640 . "@src64/flow.l") out (4236 . "@src64/io.l") @@ -324,7 +324,7 @@ tail (1912 . "@src64/subr.l") tell (3285 . "@src64/io.l") text (1407 . "@src64/sym.l") throw (2493 . "@src64/flow.l") -tick (3197 . "@src64/flow.l") +tick (3210 . "@src64/flow.l") till (3635 . "@src64/io.l") time (2861 . "@src64/main.l") touch (1181 . "@src64/sym.l") @@ -352,7 +352,7 @@ wr (5268 . "@src64/io.l") xchg (1672 . "@src64/sym.l") xor (1701 . "@src64/flow.l") x| (2887 . "@src64/big.l") -yield (2752 . "@src64/flow.l") +yield (2753 . "@src64/flow.l") yoke (1197 . "@src64/subr.l") zap (1195 . "@src64/sym.l") zero (1765 . "@src64/sym.l") diff --git a/src/vers.h b/src/vers.h @@ -1 +1 @@ -static byte Version[4] = {3,1,3,1}; +static byte Version[4] = {3,1,3,2}; diff --git a/src64/err.l b/src64/err.l @@ -1,4 +1,4 @@ -# 25may13abu +# 05jul13abu # (c) Software Lab. Alexander Burger # Debug print routine @@ -157,6 +157,7 @@ ld (EnvProtect) 0 # Reset environments ld (EnvIntern) pico ld (EnvTask) Nil + ld (EnvCo7) 0 ld (EnvArgs) 0 ld (EnvNext) 0 ld (EnvMake) 0 diff --git a/src64/flow.l b/src64/flow.l @@ -1,4 +1,4 @@ -# 13jun13abu +# 05jul13abu # (c) Software Lab. Alexander Burger (code 'redefMsgEC) @@ -2548,7 +2548,8 @@ (code 'doCo 2) push X ld X (E CDR) # Get tag - call evSymX_E # Evaluate to a symbol + ld E (X) # Eval 'sym' + eval atom (X CDR) # 'prg'? if z # Yes push Y @@ -2754,9 +2755,6 @@ push Y push Z ld X E - ld Z (EnvCo7) # Get main - null Z # Any? - jz yieldErrX # No ld Y (E CDR) ld E (Y) # Eval 'any' eval @@ -2787,6 +2785,21 @@ end ld E (L I) # Get result drop + ld Z (EnvCo7) # Get main + null Z # Any? + if z # No + null Y # Target coroutine? + jz yieldErrX # No + push L # Else resume with argument + sub S "EnvMid-EnvCo" # Space for env + push Y # Save 'seg' + push (StkLimit) # and 'lim' + push Z # Link (NULL) + ld (EnvCo7) S # Close coroutine frame + ld Z S # Point Z to main frame + save (EnvCo) (EnvMid) (Z III) # Save environment + jmp resumeCoroutine # Resume + end null L # Stack? if nz # Yes ld C (Z (pack III "+(EnvMid-EnvCo)")) # Main routine's link diff --git a/src64/tags b/src64/tags @@ -753,102 +753,102 @@ sys/x86-64.freeBsd.defs.l,1994 fishAXY1640,41196 doBy1669,41750 -./err.l,1927 +./err.l,1928 dbgS5,73 errnoEXY24,572 errEXYZ33,734 -unwindC_Z175,4436 -needSymAX351,9432 -needSymEX363,9631 -needVarAX374,9820 -needVarEX384,9997 -checkVarAX393,10164 -checkVarYX401,10300 -checkVarEX409,10436 -protErrEX414,10544 -symNsErrEX418,10594 -stkErr423,10669 -stkErrE425,10694 -stkErrX427,10720 -stkErrEX429,10746 -argErrAX434,10834 -argErrEX436,10861 -numErrAX440,10909 -numErrEX442,10936 -cntErrAX446,10984 -cntErrCX448,11011 -cntErrEX450,11038 -symErrAX454,11086 -symErrYX456,11113 -symErrEX458,11140 -extErrEX462,11188 -pairErrAX466,11236 -pairErrEX468,11264 -atomErrAX472,11314 -atomErrEX474,11342 -lstErrAX478,11392 -lstErrEX480,11419 -varErrAX484,11467 -varErrEX486,11494 -divErrX490,11542 -renErrEX495,11599 -makeErrX499,11647 -reentErrEX504,11706 -yieldErrX508,11758 -yieldErrEX510,11786 -msgErrYX514,11838 -msgErrAX516,11865 -msgErrEX518,11892 -brkErrX522,11940 -openErrEX528,12010 -closeErrX532,12061 -closeErrEX534,12089 -pipeErrX538,12142 -forkErrX543,12202 -waitPidErrX548,12261 -badFdErrEX553,12327 -noFdErrX557,12379 -eofErr562,12438 -suparErrE568,12504 -badInputErrB573,12565 -badDotErrE581,12656 -selectErrX586,12716 -wrBytesErr591,12780 -wrChildErr597,12855 -wrSyncErrX603,12930 -wrJnlErr608,12994 -wrLogErr614,13065 -truncErrX620,13136 -dbSyncErrX625,13198 -trSyncErrX630,13262 -lockErr635,13326 -dbfErrX641,13395 -jnlErrX646,13452 -idErrXL651,13509 -dbRdErr656,13583 -dbWrErr662,13652 -dbSizErr668,13721 -tellErr674,13791 -ipSocketErrX680,13859 -ipGetsocknameErrX685,13927 -ipV6onlyErrX690,14005 -ipReuseaddrErrX695,14073 -ipBindErrX700,14147 -ipListenErrX705,14211 -udpOvflErr710,14279 -undefinedCE717,14378 -undefinedCX719,14408 -undefinedEX721,14438 -dlErrX725,14491 -ret733,14637 -retc735,14658 -retnc738,14688 -retz741,14719 -retnz744,14749 -retNull747,14780 -retNil750,14815 -retT753,14851 -retE_E756,14886 +unwindC_Z176,4453 +needSymAX352,9449 +needSymEX364,9648 +needVarAX375,9837 +needVarEX385,10014 +checkVarAX394,10181 +checkVarYX402,10317 +checkVarEX410,10453 +protErrEX415,10561 +symNsErrEX419,10611 +stkErr424,10686 +stkErrE426,10711 +stkErrX428,10737 +stkErrEX430,10763 +argErrAX435,10851 +argErrEX437,10878 +numErrAX441,10926 +numErrEX443,10953 +cntErrAX447,11001 +cntErrCX449,11028 +cntErrEX451,11055 +symErrAX455,11103 +symErrYX457,11130 +symErrEX459,11157 +extErrEX463,11205 +pairErrAX467,11253 +pairErrEX469,11281 +atomErrAX473,11331 +atomErrEX475,11359 +lstErrAX479,11409 +lstErrEX481,11436 +varErrAX485,11484 +varErrEX487,11511 +divErrX491,11559 +renErrEX496,11616 +makeErrX500,11664 +reentErrEX505,11723 +yieldErrX509,11775 +yieldErrEX511,11803 +msgErrYX515,11855 +msgErrAX517,11882 +msgErrEX519,11909 +brkErrX523,11957 +openErrEX529,12027 +closeErrX533,12078 +closeErrEX535,12106 +pipeErrX539,12159 +forkErrX544,12219 +waitPidErrX549,12278 +badFdErrEX554,12344 +noFdErrX558,12396 +eofErr563,12455 +suparErrE569,12521 +badInputErrB574,12582 +badDotErrE582,12673 +selectErrX587,12733 +wrBytesErr592,12797 +wrChildErr598,12872 +wrSyncErrX604,12947 +wrJnlErr609,13011 +wrLogErr615,13082 +truncErrX621,13153 +dbSyncErrX626,13215 +trSyncErrX631,13279 +lockErr636,13343 +dbfErrX642,13412 +jnlErrX647,13469 +idErrXL652,13526 +dbRdErr657,13600 +dbWrErr663,13669 +dbSizErr669,13738 +tellErr675,13808 +ipSocketErrX681,13876 +ipGetsocknameErrX686,13944 +ipV6onlyErrX691,14022 +ipReuseaddrErrX696,14090 +ipBindErrX701,14164 +ipListenErrX706,14228 +udpOvflErr711,14296 +undefinedCE718,14395 +undefinedCX720,14425 +undefinedEX722,14455 +dlErrX726,14508 +ret734,14654 +retc736,14675 +retnc739,14705 +retz742,14736 +retnz745,14766 +retNull748,14797 +retNil751,14832 +retT754,14868 +retE_E757,14903 ./sym.l,1776 cmpLongAX_F5,78 @@ -1111,24 +1111,24 @@ sys/x86-64.freeBsd.defs.l,1994 throwErrZX2518,58492 doFinally2524,58583 doCo2548,59123 -resumeCoroutine2576,60042 -doYield2752,66117 -closeCoFilesC2894,70051 -doBreak2908,70314 -brkLoadE_E2916,70466 -doE2971,72066 -doTrace3010,72832 -traceCY3082,74747 -doCall3110,75235 -doTick3197,77427 -doIpid3229,78424 -doOpid3245,78712 -doKill3261,79007 -doFork3284,79442 -forkLispX_FE3297,79663 -doBye3458,84223 -byeE3470,84395 -finishE3482,84706 +resumeCoroutine2577,60035 +doYield2753,66110 +closeCoFilesC2907,70453 +doBreak2921,70716 +brkLoadE_E2929,70868 +doE2984,72468 +doTrace3023,73234 +traceCY3095,75149 +doCall3123,75637 +doTick3210,77829 +doIpid3242,78826 +doOpid3258,79114 +doKill3274,79409 +doFork3297,79844 +forkLispX_FE3310,80065 +doBye3471,84625 +byeE3483,84797 +finishE3495,85108 ./subr.l,2147 doCar5,71 diff --git a/src64/version.l b/src64/version.l @@ -1,6 +1,6 @@ -# 29jun13abu +# 05jul13abu # (c) Software Lab. Alexander Burger -(de *Version 3 1 3 1) +(de *Version 3 1 3 2) # vi:et:ts=3:sw=3