Recent

Author Topic: data2pas 0.6.0 released  (Read 3107 times)

yamer

  • Jr. Member
  • **
  • Posts: 87
data2pas 0.6.0 released
« on: May 26, 2015, 09:59:37 am »
data2pas is a command line tool to convert text or binary data into pascal constants. It takes in entry a text file describing the data and outputs one or more pascal file that you can include in your own source code. It’s a tool similar to data2inc but using a more ‘pascalish’ syntax.

This version adds resource strings data type.

http://yann.merignac.free.fr/data2pas.html

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: data2pas 0.6.0 released
« Reply #1 on: February 17, 2016, 03:29:48 pm »
This looks like a very useful tool. I wish to include some small resource files in Windows and Linux executables (png and wav files).

data2pas will embed them, but I don't know how to use them in the program as png and wav files. Do you have any pointers or suggestions? Any help would be much appreciated!

Cheers,
VTwin 
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

yamer

  • Jr. Member
  • **
  • Posts: 87
Re: data2pas 0.6.0 released
« Reply #2 on: February 17, 2016, 05:27:53 pm »
Most of the time I read the data encoded by data2pas with a TMemoryStream.

Something like :
Code: Pascal  [Select][+][-]
  1. const
  2.   Data : ......;
  3. var
  4.   S : TMemoryStream;
  5. begin
  6.   try
  7.     S := TMemoryStream.Create;
  8.     S.SetSize(SizeOf(Data));
  9.     S.WriteBuffer(@Data, SizeOf(Data));
  10.     S.Seek(0, soFromBeginning);
  11.  
  12.     ....
  13.   finally
  14.     S.Free;
  15.   end;  
  16.  

VTwin

  • Hero Member
  • *****
  • Posts: 1215
  • Former Turbo Pascal 3 user
Re: data2pas 0.6.0 released
« Reply #3 on: February 17, 2016, 09:43:58 pm »
Thank you yamer, I will see if I can make that work.

Cheers,
VTwin
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 12.1: Lazarus 2.2.6 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 2.2.6 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 2.2.6 (64 bit on VBox)

 

TinyPortal © 2005-2018