[Lazarus] Tool to convert a multiline text to a pascal string constant
Michalis Kamburelis
michalis.kambi at gmail.com
Thu Feb 11 11:08:12 CET 2016
Marco van de Voort wrote:
> On Wed, Feb 03, 2016 at 07:07:46AM +0100, Michalis Kamburelis wrote:
>>
>> As part of PasDoc project we have developed simple file_to_pascal_string
>> utility for this purpose. Just get
>> http://svn.code.sf.net/p/pasdoc/code/trunk/source/tools/file_to_pascal_string.dpr
>> and compile it.
>
> Kind of redundant if two such tools come with FPC (data2inc and bin2obj)
>
Hm, I admit I simply didn't know about them long time ago, when creating
file_to_pascal_xxx utilities in PasDoc:)
Looking at them now:
1. They both have quite longer code than our simple
file_to_pascal_string.dpr / file_to_pascal_data.dpr...
In particular data2inc wants to do much more (being able to process a
special file format like data2inc.exm). Although it can do the simple
thing when invoked with -b option.
But bin2obj is cool, almost exactly what we need, and could replace
file_to_pascal_string and file_to_pascal_data indeed.
2. However, neither of them produces a string with line endings
expressed as LineEnding constant (so it's OS-specific when output). And
we actually like that:) Both bin2obj and data2inc encode the text to a
series of characters, and newlines are expressed by explicit chars (like
#10 when input has Unix line endings).
But that's a minor thing indeed. If we would know about bin2obj back
then, we would probably use it:)
Thanks!
Michalis
More information about the Lazarus
mailing list