Commit 807d5b34
807d5b344156Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 6 files · +2 added · ~4 modified
Description
runtime,codegen: Array#pack / String#unpack as libspinel_rt.a TU
`String#unpack` was unresolved entirely; `Array#pack` only handled the literal "C*" shape. Move the directive parser into a separate translation unit (`lib/sp_pack.c`) so sp_runtime.h stays small. The TU calls into the main file's GC via a thin sp_ext_* shim layer (the GC helpers in sp_runtime.h are static, so a sibling TU can't reach them directly).
Supported specifiers: C/c/n/N/v/V/s/S/l/L/q/Q/a/A/Z/x. unpack returns a poly_array (int / string elements per directive); pack works on int_array (numeric only) and poly_array (mixed).
Fixes #889
Co-Authored-By: Claude Opus 4.7 [email protected]
Details
- Commit
- 807d5b344156
- Parent
- 3a49dca8ca44
MakefilemodifiedView file
@mkdir -p build $(CC) -c -O2 -Wno-all $(SEC_FLAGS) -Ilib lib/sp_crypto.c -o build/sp_crypto.obuild/sp_pack.o: lib/sp_pack.c lib/mruby_shim.h @mkdir -p build $(CC) -c -O2 -Wno-all $(SEC_FLAGS) -Ilib lib/sp_pack.c -o build/sp_pack.oSP_RT_LIB = lib/libspinel_rt.a$(SP_RT_LIB): $(RE_OBJ) build/sp_bigint.o build/sp_crypto.o$(SP_RT_LIB): $(RE_OBJ) build/sp_bigint.o build/sp_crypto.o build/sp_pack.o ar rcs $@ $^regexp: $(SP_RT_LIB)lib/sp_pack.caddedView file
Loading diff…
lib/sp_runtime.hmodifiedView file
Loading diff…
spinel_analyze.rbmodifiedView file
Loading diff…
spinel_codegen.rbmodifiedView file
Loading diff…
test/array_pack_string_unpack.rbaddedView file
Loading diff…