[Snek] [keith-packard/snek] 7e7d08: Add dictionaries
Keith Packard
noreply at github.com
Fri Mar 1 22:42:47 PST 2019
Branch: refs/heads/master
Home: https://github.com/keith-packard/snek
Commit: 7e7d0887a7ed45764dbad976db4e0dff46f9ae8b
https://github.com/keith-packard/snek/commit/7e7d0887a7ed45764dbad976db4e0dff46f9ae8b
Author: Keith Packard <keithp at keithp.com>
Date: 2019-02-26 (Tue, 26 Feb 2019)
Changed paths:
M snek-code.c
M snek-duino/snek-duino.c
M snek-gram.ll
M snek-lex.c
M snek-list.c
M snek-memory.c
M snek-print.c
M snek.h
Log Message:
-----------
Add dictionaries
Implemented as lists with even elements being the indices and odd
elements being the values.
Signed-off-by: Keith Packard <keithp at keithp.com>
Commit: 29fb80c03efbe78aa4a9318d72a6e65f14fd8b5e
https://github.com/keith-packard/snek/commit/29fb80c03efbe78aa4a9318d72a6e65f14fd8b5e
Author: Keith Packard <keithp at keithp.com>
Date: 2019-02-26 (Tue, 26 Feb 2019)
Changed paths:
M test/Makefile
A test/dict.py
Log Message:
-----------
Add test/dict.py
Simple dictionary tests
Signed-off-by: Keith Packard <keithp at keithp.com>
Commit: 41fb11b7787c2f444e1e503510cf651a4cc605b6
https://github.com/keith-packard/snek/commit/41fb11b7787c2f444e1e503510cf651a4cc605b6
Author: Keith Packard <keithp at keithp.com>
Date: 2019-02-27 (Wed, 27 Feb 2019)
Changed paths:
M snek-code.c
Log Message:
-----------
Fix signed/unsigned error when fetching list values in snek_in_step
Need to cast to unsigned to make sure the value is in range.
Signed-off-by: Keith Packard <keithp at keithp.com>
Commit: 92ab443a0594ebc9faca09867fcae59f9caf75d4
https://github.com/keith-packard/snek/commit/92ab443a0594ebc9faca09867fcae59f9caf75d4
Author: Keith Packard <keithp at keithp.com>
Date: 2019-02-27 (Wed, 27 Feb 2019)
Changed paths:
M snek-code.c
M snek-error.c
M snek-list.c
M snek-string.c
M snek.h
Log Message:
-----------
Make dict fetch of non-existant entries fail.
And report such failures with the right value.
Signed-off-by: Keith Packard <keithp at keithp.com>
Commit: b95a1a0b85066780f557e783e0aab55ccd38118c
https://github.com/keith-packard/snek/commit/b95a1a0b85066780f557e783e0aab55ccd38118c
Author: Keith Packard <keithp at keithp.com>
Date: 2019-02-27 (Wed, 27 Feb 2019)
Changed paths:
M snek-gram.ll
Log Message:
-----------
Make del support just one name.
Multiple name support isn't useful.
Signed-off-by: Keith Packard <keithp at keithp.com>
Commit: 906954f4cc8f4793704ac28105e08da7fc3c6967
https://github.com/keith-packard/snek/commit/906954f4cc8f4793704ac28105e08da7fc3c6967
Author: Keith Packard <keithp at keithp.com>
Date: 2019-02-27 (Wed, 27 Feb 2019)
Changed paths:
M snek-code.c
M snek-string.c
M snek.h
Log Message:
-----------
Handle non-pool addrs in snek_stash_push/pop_string
This removes a bit of special casing code in various callers
Signed-off-by: Keith Packard <keithp at keithp.com>
Commit: 5a0a36b098fe6cfe675149f370fb10194e4902b0
https://github.com/keith-packard/snek/commit/5a0a36b098fe6cfe675149f370fb10194e4902b0
Author: Keith Packard <keithp at keithp.com>
Date: 2019-02-28 (Thu, 28 Feb 2019)
Changed paths:
M snek-memory.c
Log Message:
-----------
Switch binary search memory manager search code to allow unsigned types
This slightly modifies the binary search code. Before, it was:
l = 0; r = size-1;
while (l <= r)
m = (l + r) >> 1;
if (value[m] < key)
l = m + 1;
else
r = m - 1;
However, in this case r can be -1, so it must be a signed type.
If we bias r by 1, it will never be -1 and we can use an unsigned type:
l = 0; r = size;
while (l < r)
m = (l + r - 1) >> 1;
if (value[m] < key)
l = m + 1;
else
r = m;
Signed-off-by: Keith Packard <keithp at keithp.com>
Commit: 21adcc9461f421917ae396c08b1b5b29a7700bfc
https://github.com/keith-packard/snek/commit/21adcc9461f421917ae396c08b1b5b29a7700bfc
Author: Keith Packard <keithp at keithp.com>
Date: 2019-03-01 (Fri, 01 Mar 2019)
Changed paths:
M snek-list.c
M snek-print.c
M snek.h
Log Message:
-----------
Make snek_list_data global and use it everywhere
Get rid of snek_pool_addr(list->data) usage.
Signed-off-by: Keith Packard <keithp at keithp.com>
Commit: 53645d296bece66ca4c1cbed65741eff5891cc91
https://github.com/keith-packard/snek/commit/53645d296bece66ca4c1cbed65741eff5891cc91
Author: Keith Packard <keithp at keithp.com>
Date: 2019-03-01 (Fri, 01 Mar 2019)
Changed paths:
M snek-frame.c
Log Message:
-----------
Replace snek_pool_addr(frame->prev) with snek_frame_prev(frame)
Looks cleaner this way.
Signed-off-by: Keith Packard <keithp at keithp.com>
Commit: b7565481239066374578f021e5ddb26cae4a5eab
https://github.com/keith-packard/snek/commit/b7565481239066374578f021e5ddb26cae4a5eab
Author: Keith Packard <keithp at keithp.com>
Date: 2019-03-01 (Fri, 01 Mar 2019)
Changed paths:
M snek-code.c
M snek-list.c
M snek-poly.c
M snek.h
Log Message:
-----------
Replace snek_poly_equal and snek_poly_less with snek_poly_cmp
This single function returns <0, =0, >0 depending on the relation of
the two values, saving a bunch of space compared with having two
separate functions.
snek_poly_cmp provides a global order for all snek values, permitting
comparisons of strings, list and tuples in addition to floats.
Signed-off-by: Keith Packard <keithp at keithp.com>
Commit: 4a5a7b5028cc88c3d647ae254f50231801ee3b66
https://github.com/keith-packard/snek/commit/4a5a7b5028cc88c3d647ae254f50231801ee3b66
Author: Keith Packard <keithp at keithp.com>
Date: 2019-03-01 (Fri, 01 Mar 2019)
Changed paths:
M snek-memory.c
Log Message:
-----------
Use 'leftmost' binary search in memory manager
This requires one less operation per loop iteration and runs at the
same speed.
Signed-off-by: Keith Packard <keithp at keithp.com>
Commit: 6b08d4c5fcc4facc6552a2fdecd9ea714ab647fc
https://github.com/keith-packard/snek/commit/6b08d4c5fcc4facc6552a2fdecd9ea714ab647fc
Author: Keith Packard <keithp at keithp.com>
Date: 2019-03-01 (Fri, 01 Mar 2019)
Changed paths:
M snek-list.c
Log Message:
-----------
Use binary search for dict insertion
It's a reasonable addition, even if the code is a bit larger.
Signed-off-by: Keith Packard <keithp at keithp.com>
Commit: d99b53b4de38858378ab9331e6dfa97c4aa68f38
https://github.com/keith-packard/snek/commit/d99b53b4de38858378ab9331e6dfa97c4aa68f38
Author: Keith Packard <keithp at keithp.com>
Date: 2019-03-01 (Fri, 01 Mar 2019)
Changed paths:
M snek-list.c
Log Message:
-----------
Build immediate dicts in sorted order
Insert key/value pairs one at a time
Signed-off-by: Keith Packard <keithp at keithp.com>
Commit: 1357b78c85cbc20d3a256febaad75e86b96ea40b
https://github.com/keith-packard/snek/commit/1357b78c85cbc20d3a256febaad75e86b96ea40b
Author: Keith Packard <keithp at keithp.com>
Date: 2019-03-01 (Fri, 01 Mar 2019)
Changed paths:
M test/dict.py
Log Message:
-----------
Add dict tests that check for order-independence
Signed-off-by: Keith Packard <keithp at keithp.com>
Compare: https://github.com/keith-packard/snek/compare/256565b04102...1357b78c85cb
More information about the Snek
mailing list