CBFalconer wrote:
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.
I'm not aware of this. (And I think this would make huge packed array rather useless.) `Pack' and `Unpack' can be used for conversions between packed and unpacked arrays, but AFAIK component access to packed arrays is allowed as usual (except for `var' parameters, EP 6.7.3.3).
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.
According to EP 6.4.3.6 (note 6) `Text' is basically a `file of Char' with special additional properties. No mentioning of `packed' there at all. Maybe you're thinking of strings as packed arrays of Char, but I don't see this for `Text' files.
Frank