[Lazarus] Tool to convert a multiline text to a pascal string constant

Michael Van Canneyt michael at freepascal.org
Thu Feb 11 12:06:24 CET 2016



On Thu, 11 Feb 2016, Michalis Kamburelis wrote:

> 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.

As the author of bin2obj, I thank you for these words :-)

> 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:)

Patches certainly accepted. 
I use bin2obj in production today still...

Michael.




More information about the Lazarus mailing list