But I've problems in writing out the .pbc, especially Const_Table, type
PFC_KEY / PARROT_ARG_SC (and _NC if one would use these).
The problem seems to be, that all other key types can be looked up by
key.cache->int_val, but not _SC and _NC as there value is the contents
of another string or number constant.
So packing a packfile seems not to be reversible.
I see currently 3 possible ways to workaround this problem:
1) make another indirection in reading an _SC or _NC key, so that
key.cache->int_val is the index into the constant table and not the
string_val or the num_val itself.
2) don't use ->data as the key->next pointer but some structure
data -> { int idx, PMC *next } and store the constant index there.
3)
The easierst solution (for me): provide the possibility to call a
callback, that fills the packed structure with the required data.
Actually I have also this packed data, because on building the keys I
assemble this packed data, which on PackFile_Constant_unpack_key()
generates all the PMCs for runtime.
1) and 2) would be a general solution but require a major rewrite of key
functions / access and have drawback for speed / memory usage.
3) is "if you want to packout _SC keys, do it yourself" ;-)
Comments welcome,
leo