Re: [fpc-pascal] Warning for anybody else using Linux Mint Debian ('Betsy')

2017-03-07 Thread Mattias Gaertner

> brian  hat am 8. März 2017 um 00:16 geschrieben:
>[...]
> > /usr/bin/ld: /usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o: 
> > unrecognized relocation (0x2a) in section `.text'
> > /usr/bin/ld: final link failed: Bad value
>[...]
> Trying to build a simple 'Hello, World' from the 3.0.2 FP IDE also
> failed with a linker error.
> 
> There are reports of this error "unrecognized relocation (0x2a) in
> section `.text'" with the *testing* version of plain Debian, but Betsy
> is based on Jessie (stable), NOT testing, and the library versions on
> this system *are* the ones from stable, I checked the versions.
> 
> Downgrading to FPC 3.0.0 and Lazarus 1.6.2-1 means that everything
> works again as expected.
> 
> I don't pretend to understand what has happened to cause this error on
> a system based on stable rather than testing, but as far as users with
> my configuration are concerned, there appears to be a barrier to
> upgrading, at least at the moment.

You are not alone:
http://bugs.freepascal.org/view.php?id=31490

Mattias
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Warning for anybody else using Linux Mint Debian ('Betsy')

2017-03-07 Thread brian
Upgrading to Lazarus 1.6.4 and FPC 3.0.2 as obtained from SourceForge
breaks things irretrievably on Linux Mint Debian 64-bit running on an
AMD Phenom x2 system. I first noticed this when trying to rebuild the
Lazarus IDE generated the following error

> /usr/bin/ld: /usr/lib/fpc/3.0.2/units/x86_64-linux/rtl/cprt0.o: unrecognized 
> relocation (0x2a) in section `.text'
> /usr/bin/ld: final link failed: Bad value
> /usr/share/lazarus/1.6.4/ide/lazarus.pp(154,1) Error: (9013) Error while 
> linking
> /usr/share/lazarus/1.6.4/ide/lazarus.pp(154,1) Fatal: (10026) There were 1 
> errors compiling module, stopping
> Fatal: (1018) Compilation aborted
> make[2]: *** [lazarus] Error 1
> make[1]: *** [idepkg] Error 2
> make: *** [idepkg] Error 2

Trying to build a simple 'Hello, World' from the 3.0.2 FP IDE also
failed with a linker error.

There are reports of this error "unrecognized relocation (0x2a) in
section `.text'" with the *testing* version of plain Debian, but Betsy
is based on Jessie (stable), NOT testing, and the library versions on
this system *are* the ones from stable, I checked the versions.

Downgrading to FPC 3.0.0 and Lazarus 1.6.2-1 means that everything
works again as expected.

I don't pretend to understand what has happened to cause this error on
a system based on stable rather than testing, but as far as users with
my configuration are concerned, there appears to be a barrier to
upgrading, at least at the moment.


Brian.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] lldb problems with Xcode 8.2.1

2017-03-07 Thread Jeremy Thompson
> This is fixed in the latest Xcode 8.3 beta.

> You’ll still need to use Jonas’ suggestion of upgrading to FPC 3.0.2 and use 
> the -godwarfcpp option to get lldb/Xcode to do the right thing once a 
> breakpoint is triggered.

I have upgraded to FPC 3.0.2 and added in the Xcode 8.3 beta.  I am able to see 
local variables when pausing the program.  I am still unable to get breakpoints 
working.  I still end up with this error if I try and manually set them:

Breakpoint 2: no locations (pending).
WARNING:  Unable to resolve breakpoint to any actual locations.


Adding or removing breakpoints in Xcode makes no difference either.  Is there 
something else I should be looking at? Here are my flags for the compiler:

-Mmacpas -godwarfcpp -CRiot -ghlttt -gl -O-

Thanks,
Jeremy


signature.asc
Description: Message signed with OpenPGP
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Vojtěch Čihák

Hi,
 
there are different informations about *.wav, so maybe there are different 
impementations too.
See:
http://soundfile.sapp.org/doc/WaveFormat/
and
https://blogs.msdn.microsoft.com/dawate/2009/06/23/intro-to-audio-programming-part-2-demystifying-the-wav-format/
 
The first says that 8-bit is unsigned, the second says signed.
The first does not mention floats, the second says 32-bits but only -1.0 to 1.0.
 
V.
 
__

Od: fredvs 
Komu: fpc-pascal@lists.freepascal.org
Datum: 07.03.2017 22:39
Předmět: Re: [fpc-pascal] Adding a array of float in ressource and use it ?


OK, Sven you win (and http://stackoverflow.com  
should follow fpc forum).
But you will not convince me that c does better than fpc, maybe equal but
surely not better. 


Huh, saving a buffer of float into wav file format, with correct header,
--->
loaded by audacity > horrible noise.

loaded by fpc (via uos) > perfet sound.

But is maybe because wav format accept only in theory data from float.
(and that wav file are (nearly) always encoded from 32 bit integer and
converted into float32).

But that is a other story.

Viva fpc.

Fre;D





-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Adding-a-array-of-float-in-ressource-and-use-it-tp5727765p5727801.html
 

Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal 

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Sven Barth via fpc-pascal
On 07.03.2017 22:39, fredvs wrote:
> OK, Sven you win (and http://stackoverflow.com should follow fpc forum).
> But you will not convince me that c does better than fpc, maybe equal but
> surely not better. 

Despite me definitely favoring Object Pascal as well, I can't you have
spreading incorrect information on C, can I? ;)

Regards,
Sven

___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread fredvs
OK, Sven you win (and http://stackoverflow.com should follow fpc forum).
But you will not convince me that c does better than fpc, maybe equal but
surely not better. 

Huh, saving a buffer of float into wav file format, with correct header,
--->
loaded by audacity > horrible noise.

loaded by fpc (via uos) > perfet sound.

But is maybe because wav format accept only in theory data from float.
(and that wav file are (nearly) always encoded from 32 bit integer and
converted into float32).

But that is a other story.

Viva fpc.

Fre;D





-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Adding-a-array-of-float-in-ressource-and-use-it-tp5727765p5727801.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Sven Barth via fpc-pascal
On 07.03.2017 16:30, fredvs wrote:
>>> Many thanks Sven for your help.
>>> Do you agree if I add your name into the list of the "great contributors"
>>> of
>>> uos (https://github.com/fredvs/uos) ?
>> I don't think that's necessary. I'm merely doing my "job"...
> 
> OK, I understand. (But I ask it always when I get great help, it is a matter
> of conscience and respect.)
> 
>>> Huh? Of course you can do that rather similary in C as well.
>> Indeed. You can do exactly the same. You can do this: 
> 
> Huh in C, in one shot, like fpc does, without conversion and working?

The following code reads the floatbuf.txt file that my Pascal example
code generated and correctly prints 3.141500 42 times:

=== code begin ===

#include 

int main()
{
float* floatbuf;
FILE* file;

file = fopen("floatbuf.txt", "rb");
if (!file)
{
printf("Failed to open file\n");
return 1;
}

floatbuf = malloc(sizeof(float) * 42);
if (fread(floatbuf, sizeof(float), 42, file) != 42)
{
printf("Failed to read data\n");
fclose(file);
free(floatbuf);
return 1;
}

for (int i = 0; i < 42; i++)
printf("%f\n", (double)floatbuf[i]);

fclose(file);
free(floatbuf);

return 0;
}

=== code end ===

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread fredvs
>> Many thanks Sven for your help.
>> Do you agree if I add your name into the list of the "great contributors"
>> of
>> uos (https://github.com/fredvs/uos) ?
> I don't think that's necessary. I'm merely doing my "job"...

OK, I understand. (But I ask it always when I get great help, it is a matter
of conscience and respect.)

>> Huh? Of course you can do that rather similary in C as well.
> Indeed. You can do exactly the same. You can do this: 

Huh in C, in one shot, like fpc does, without conversion and working?

> (just a stab in the dark here, unless we take the time to look into Fred's
> github ?) 

The code of uos_AddFromRessource(...) is not yet committed, I have to clean
and control all before, but, of course it will be a great honor if you take
a look in uos code.
And mainly if you find something wrong in the main loop or in the concept of
uos.

For example, I got a advice that some data of uos are reference counted and
that is bad.
OK, but how to know if data are reference counted and why is it bad?
(I did code for reference counted only for dynamic-loading of libraries).

A other advice was that is not good that each player is a thread.
OK, but how could you make the main program-thread still work if players are
not independent thread?

Voila.

PS: There is a uos forum here: http://uos.2369694.n4.nabble.com 

Many thanks for your Sven, Michael and Lukasz.

Fre;D



-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Adding-a-array-of-float-in-ressource-and-use-it-tp5727765p5727799.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Lukasz Sokol
Hi,

On 07/03/17 13:23, Michael Van Canneyt wrote:
> 
>> Huh? Of course you can do that rather similary in C as well.
> 
> Indeed. You can do exactly the same. You can do this:
> 
> {$mode objfpc}
> uses classes;
> 
> 
> Type
>   Float = Double;
>   TFloatArray = Array of Float;
> 
> Procedure TestRW(X : TFloatArray);
> 
> Var
>   F : TFileStream;
>   Y : TFloatArray;
>   I : Integer;
> 
> begin
>   // Write
>   F:=TFileStream.Create('float.dat',fmCreate);
>   try

so here is what I am seeing in Fre;D's code, that he managed to paste in one of 
the previous
messages :

// "FileBuffer.Data.Seek(0, soFromBeginning);"

  F.Seek(0, soFromBeginning);   /// this it would be in Michaels' code 

I don't think it matters if you newly create the stream... 
looks like something (probably) performed by the constructor already;

(just a stab in the dark here, unless we take the time to look into Fred's 
github ?)

-L.

> F.WriteBuffer(X[0],Length(X)*SizeOf(Float));
>   finally
> F.Free;
>   end;
>   // Read
>   F:=TFileStream.Create('float.dat',fmOpenRead);
>   try
> SetLength(Y,F.Size div SizeOf(Float));
> F.ReadBuffer(Y[0],F.Size);
>   finally
> F.Free;
>   end;
>   // Check
>   If Length(Y)<>Length(X) then
> Writeln('Wrong length')
>   else For I:=0 to Length(X)-1 do
> if (X[i]<>Y[i]) then
>   Writeln('Wrong element at pos ',i,': ',X[i]<>Y[i]);
> end;
> 
> var
>   X : TFloatArray;
>   I : Integer;
> 
> begin
>   SetLength(X,10);
>   Writeln('Floats');
>   For I:=0 to Length(X)-1 do
>  X[i]:=10+(1/(1+I));
>   TestRW(X);
>   Writeln('integers');
>   For I:=0 to Length(X)-1 do
>  X[i]:=10+I;
>   TestRW(X);
> end.
> 
> Michael.


___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Michael Van Canneyt



On Tue, 7 Mar 2017, Sven Barth via fpc-pascal wrote:


Am 07.03.2017 13:49 schrieb "fredvs" :



To access a file stored as a resource you need to use TResourceStream.


Ho my Dog, I did not know this one.
More than perfect, many thanks Sven.

PS: About array of float into TFileStream, after Googling a while, it s

not

possible to do directly like fpc does for C compilers.
You need a conversion (like explained by Lukasz Sokol).
And it is the reason why I am (once again) very impressed by fpc.


Huh? Of course you can do that rather similary in C as well.


Indeed. You can do exactly the same. You can do this:

{$mode objfpc}
uses classes;


Type
  Float = Double;
  TFloatArray = Array of Float;

Procedure TestRW(X : TFloatArray);

Var
  F : TFileStream;
  Y : TFloatArray;
  I : Integer;

begin
  // Write
  F:=TFileStream.Create('float.dat',fmCreate);
  try
F.WriteBuffer(X[0],Length(X)*SizeOf(Float));
  finally
F.Free;
  end;
  // Read
  F:=TFileStream.Create('float.dat',fmOpenRead);
  try
SetLength(Y,F.Size div SizeOf(Float));
F.ReadBuffer(Y[0],F.Size);
  finally
F.Free;
  end;
  // Check
  If Length(Y)<>Length(X) then
Writeln('Wrong length')
  else For I:=0 to Length(X)-1 do
if (X[i]<>Y[i]) then
  Writeln('Wrong element at pos ',i,': ',X[i]<>Y[i]);
end;

var
  X : TFloatArray;
  I : Integer;

begin
  SetLength(X,10);
  Writeln('Floats');
  For I:=0 to Length(X)-1 do
 X[i]:=10+(1/(1+I));
  TestRW(X);
  Writeln('integers');
  For I:=0 to Length(X)-1 do
 X[i]:=10+I;
  TestRW(X);
end.

Michael.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Sven Barth via fpc-pascal
Am 07.03.2017 13:49 schrieb "fredvs" :
>
> > To access a file stored as a resource you need to use TResourceStream.
>
> Ho my Dog, I did not know this one.
> More than perfect, many thanks Sven.
>
> PS: About array of float into TFileStream, after Googling a while, it s
not
> possible to do directly like fpc does for C compilers.
> You need a conversion (like explained by Lukasz Sokol).
> And it is the reason why I am (once again) very impressed by fpc.

Huh? Of course you can do that rather similary in C as well.

> Many thanks Sven for your help.
> Do you agree if I add your name into the list of the "great contributors"
of
> uos (https://github.com/fredvs/uos) ?
>

I don't think that's necessary. I'm merely doing my "job"...

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread fredvs
> To access a file stored as a resource you need to use TResourceStream.

Ho my Dog, I did not know this one.
More than perfect, many thanks Sven.

PS: About array of float into TFileStream, after Googling a while, it s not
possible to do directly like fpc does for C compilers.
You need a conversion (like explained by Lukasz Sokol).
And it is the reason why I am (once again) very impressed by fpc.

Many thanks Sven for your help. 
Do you agree if I add your name into the list of the "great contributors" of
uos (https://github.com/fredvs/uos) ?

Fre;D





-
Many thanks ;-)
--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Adding-a-array-of-float-in-ressource-and-use-it-tp5727765p5727795.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Adding a array of float in ressource and use it ?

2017-03-07 Thread Sven Barth via fpc-pascal
Am 06.03.2017 23:57 schrieb "fredvs" :
>
> Re-hello.
>
> Ok, I do not find yet the guilty in my code, I will re-try a other day.
> By the way, your code is working perfectly Sven.
>
> Now, last part of the question: how to convert that file stored into
> ressource but without to write to the disk (only memory stream)?
>
> A TFileStream could be used but it needs a path.
> And in ressource there is no path to use in
> TFileStream.Create('/the/path/filename', fmOpenRead);
>
> What could be the solution ?

To access a file stored as a resource you need to use TResourceStream.

Regards,
Sven
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal