[fpc-pascal] cpu_relax() in freepascal

2017-10-29 Thread Matias Vara
Hello everyone,

I want to implement the cpu_relax() function in order to use it inside
loops. However before, I would like to know if the fpc compiler is doing an
optimization of this kind.

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

Re: [fpc-pascal] FPC vs. Lazarus regarding some units...

2017-10-29 Thread Juha Manninen
On Sun, Oct 29, 2017 at 5:28 PM,   wrote:
> does the delphi conversion system convert those MMSystem calls
> to something else?

Now the converter just removes MMSystem from uses section.
I don't know how it should be converted. Maybe it should be left untouched.

> i remember seeing something about that back when i was trying to
> convert a delphi project several years ago... that brought some more changes
> and fixes to the delphi conversion process...

I don't remember details.
Anyway the unit names in uses section that are replaced / removed,
including MMSystem, can be configured by user.

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

Re: [fpc-pascal] FPC vs. Lazarus regarding some units...

2017-10-29 Thread wkitty42

On 10/29/2017 07:07 AM, Juha Manninen wrote:

On Sun, Oct 29, 2017 at 2:53 AM, Cleverson Casarin Uliana
 wrote:

Why some units like the mentioned MMSystem are
delivered with Lazarus but not with FPC?


MMSystem is not delivered with Lazarus. I don't know what you are writing about.



does the delphi conversion system convert those MMSystem calls to something 
else? i remember seeing something about that back when i was trying to convert a 
delphi project several years ago... that brought some more changes and fixes to 
the delphi conversion process...



--
 NOTE: No off-list assistance is given without prior approval.
   *Please keep mailing list traffic on the list unless*
   *a signed and pre-paid contract is in effect with us.*
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Problem with array of const

2017-10-29 Thread Tony Whyman
I've fallen into various traps with array of const before. I would 
always recommend that:


1. Test the vType before accessing the argument value and raise an 
exception if it is not what is expected. You are dealing with a free 
union and the compiler may not always do what you expect it to.


2. Values such as VAnsiString are best dealt with as PChars as otherwise 
you can quickly get into problems with reference counts.


For example:

program test_args;

procedure test(name: string; args: array of const);
begin
  writeln(name);

  case args[0].vType of

  vtAnsiString:
    writeln(strpas(PAnsiChar(args[0].VAnsiString)));
  else
    raise Exception.Create('Unexpected vtype');
  end;

end;

begin
  test('name', ['arg']);
end.

Use of "strpas" is probably unnecessary in the above, but it does 
illustrate the point.



On 28/10/17 23:59, Darius Blaszyk wrote:
Consider the application below. When I run it I do get the following 
output:


name
rgname�F&{---C000-0046}

In other words I lose the first character (a) from the arguments 
supplied and the string returns with a lot of garbage. What am I doing 
wrong here?


Rgds, Darius

program test_args;

procedure test(name: string; args: array of const);
begin
  writeln(name);
  writeln(args[0].VString^);
end;

begin
  test('name', ['arg']);
end.


___
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] FPC vs. Lazarus regarding some units...

2017-10-29 Thread Cleverson Casarin Uliana

Em 29/10/2017 11:25, Marco van de Voort escreveu:

Reading your messages, I suspect your originally misconfigured FPC,
including only RTL, and not packages.


It's possible yes, thanks for the hint, will be more careful this time. :)

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

Re: [fpc-pascal] FPC vs. Lazarus regarding some units...

2017-10-29 Thread Marco van de Voort
In our previous episode, Cleverson Casarin Uliana said:
> > MMSystem is delivered with fpc (at least with my current version: 3.0.4rc1).
> > 
> Good to know, it wasn't the case some 3-4 years ago.

At least since 2005 (cvs->svn change) 

Reading your messages, I suspect your originally misconfigured FPC,
including only RTL, and not packages. 

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

Re: [fpc-pascal] FPC vs. Lazarus regarding some units...

2017-10-29 Thread Cleverson Casarin Uliana

Em 29/10/2017 09:47, Bart escreveu:

MMSystem is delivered with fpc (at least with my current version: 3.0.4rc1).


Good to know, it wasn't the case some 3-4 years ago.

Thank you all who answered.
Cleverson
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] FPC vs. Lazarus regarding some units...

2017-10-29 Thread Bart
On Sun, Oct 29, 2017 at 12:07 PM, Juha Manninen
 wrote:
> On Sun, Oct 29, 2017 at 2:53 AM, Cleverson Casarin Uliana
>  wrote:
>> Why some units like the mentioned MMSystem are
>> delivered with Lazarus but not with FPC?
>
> MMSystem is not delivered with Lazarus. I don't know what you are writing 
> about.


MMSystem is delivered with fpc (at least with my current version: 3.0.4rc1).

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

Re: [fpc-pascal] FPC vs. Lazarus regarding some units...

2017-10-29 Thread Juha Manninen
On Sun, Oct 29, 2017 at 2:53 AM, Cleverson Casarin Uliana
 wrote:
> Why some units like the mentioned MMSystem are
> delivered with Lazarus but not with FPC?

MMSystem is not delivered with Lazarus. I don't know what you are writing about.

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

Re: [fpc-pascal] FPC vs. Lazarus regarding some units...

2017-10-29 Thread Graeme Geldenhuys

On 2017-10-29 00:53, Cleverson Casarin Uliana wrote:

I was wondering if I must get
Lazarus again or the standalone FPC is enough.


If your programs don't rely on the VCL (Delphi's Visual Component 
Library. ie: TButton, TForm etc), that means they shouldn't need to rely 
on the LCL, so then only using FPC should be fine.


Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] FPC vs. Lazarus regarding some units...

2017-10-29 Thread Cleverson Casarin Uliana

Hello, beginer here:

Some years ago, I tried to port an old Delphi program to FreePascal, and 
discovered I had to use the entire Lazarus and not FPC alone due to some 
units missing, e.g. MMSystem. I then installed Lazarus and was able to 
compile most of the software, but since it was mostly for fun, I leaved 
it somewhat incomplete by that time.


Now I'd like to try it again. Since that program doesn't require a fancy 
desktop interface, and since I'm already accustomed to another text 
editor (which serves me well as an IDE), I was wondering if I must get 
Lazarus again or the standalone FPC is enough.


Because I don't know very well the FPC/Lazarus ecosystem, I'm actually 
curious: Why some units like the mentioned MMSystem are delivered with 
Lazarus but not with FPC? In case I install FPC and some unit gets 
missing, is it possible to get it without getting the entire Lazarus and 
all its overhead?


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

Re: [fpc-pascal] Is there any pascal interface to TensorFlow or other neural network tools?

2017-10-29 Thread Dennis Poon



Michael Van Canneyt wrote:



On Sat, 28 Oct 2017, Dennis wrote:


or even neural network libraries written in Pascal?

I know there are many python interfaces/libraries but I hope to use 
Pascal entirely so that I don't have to run a python server along 
side my Free Pascal program.


Or, is it possible to call python from Free pascal?

If not, in the worst case, I have to write  python tcp/ip server to 
accepts commands from (and send back results to ) my FPC program.


Tensorflow has a C library interface, the c_api.h header can be easily
translated with h2pas.

https://github.com/tensorflow/tensorflow/blob/master/tensorflow/c/c_api.h

I did a quick run, it translates quite well.

Michael.


That's good news. Thanks a lot.

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