Frank Heckenbach wrote:
CBFalconer wrote:
At some time in the future it would also be possible to implement offset non-symettric ranges with this syntax. E.G. "packed -64 .. 191;" could indicate a one byte quantity, whose zero value is actually represented by 0x40 (in C nomenclature). Such a mechanism can also handle unsigned ranges. This is pure blue-skying.
This should be possible. I'm not sure if the effort (internally subtracting/adding 64 before/after each operation) is worth it. But if someone wants to try it ...
Shouldn't add much. Consider the equivalence to array indexing, when the base index is non-zero. It only has to be implemented at load/store of such a value, just like an array index.
As I said, if you like to try it ...
I think a better analogy (in GPC, at least) would be packed arrays. For regular arrays, indexing means internally computing some address, and that's independent of whether it's used for loading or storing. For packed arrays that's different (loading means (roughly) `and' and `shift', storing means load, `and', `shift', `or'). There are two places (loading and storing) in GPC that deal with packed arrays. Maybe this could be done in their vicinity ...
IIRC packed arrays have to be accessed with pack and unpack standard procedures for strict compliance. Many systems don't enforce this.
The primary purpose of packed is to save storage space, and to distinguish between text and arrays of char. In addition I believe a text file is a "PACKED FILE OF char", while a "FILE OF char" is a different animal.