[fpc-pascal] Including binary data making easy

Mark Morgan Lloyd markMLl.fpc-pascal at telemetry.co.uk
Wed Aug 29 11:59:01 CEST 2012


Rainer Stratmann wrote:
> Am Wednesday 29 August 2012 10:58:52 schrieb Mark Morgan Lloyd:
>> Looking at the earlier thread, what you appear to be suggesting is some
>> way of using $i for pulling binary data into your program. However, $i
>> is by definition for including source fragments, if you want to merge
>> something that cannot be a valid source fragment (e.g. because it
>> contains illegal characters, or because sequences such as \n\r must be
>> preserved) ...
> 
> You are trying to make a very simple thing complicated.
> I know bytes with values from 0 to 255. I do not see an illegal character/byte 
> there. If you read exactly I did not type $i but $ir which I think is not 
> reserved for another thing.

Yes, I saw what you wrote. /You're/ the one trying to make life 
difficult, since you seem to think that it's going to be easier for the 
core developers to change the compiler (i.e. extend $i or possibly $r) 
than it is for you to learn how to use a makefile (or to do something 
equivalent with Lazarus's "Execute before" facility).

Jonas and others have already suggested that you use data2inc or 
bin2obj. You objected on the basis that you might forget to run it: 
that's hardly our problem.

I'm not denying that some variant of what you're asking could be useful. 
For example, in various cases I've needed to build the specification of 
a scripting language into a program, and having something like your 
extended $i that ensured that quotes etc. were properly escaped (i.e. 
the expansion of $i is guaranteed never to break Pascal syntax) could be 
useful. But in practice there are other ways of doing it.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]



More information about the fpc-pascal mailing list