[fpc-pascal] getopts unit vs CustApp parameter handling

2016-05-03 Thread Graeme Geldenhuys
Hi,

Is the getopts unit deprecated or not recommended for usage? The reason
I ask is because I see CustApp has similar functionality to the getopts
unit, but the custapp has it’s own implementation - it doesn’t use the
getopts unit at all.

Or am I not understanding the purpose of the getopts unit correctly?

Regards,
  Graeme

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

Re: [fpc-pascal] getopts unit vs CustApp parameter handling

2016-05-03 Thread Michael Van Canneyt



On Tue, 3 May 2016, Graeme Geldenhuys wrote:


Hi,

Is the getopts unit deprecated or not recommended for usage?


It is not deprecated.


The reason
I ask is because I see CustApp has similar functionality to the getopts
unit, but the custapp has it’s own implementation - it doesn’t use the
getopts unit at all.


Correct. getopts is roughly based on the unix getopts mechanism.



Or am I not understanding the purpose of the getopts unit correctly?


They serve the same purpose, but function differently.

Simply use the one whose interface you like best.

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

[fpc-pascal] intel vs att asm (fstp instruction) (osx/clang features)

2016-05-03 Thread Dmitry Boyarintsev
Hello,

I'm dealing with the following code (from ZenGL library), targeting OSX
---
{$mode delphi}

procedure m_SinCos( Angle : Single; out s, c : Single ); assembler;
asm
  FLD Angle
  FSINCOS
  FSTP [EDX]
  FSTP [EAX]
end;

var
  s,c: single;
begin
  m_SinCos(0,s,c);
end.
---

The latest Xcode 7.0 tools does recognize the generated assembler (fpc
trunk):
-
# [5] FLD Angle
flds 8(%ebp)
# [6] FSINCOS
fsincos
# [7] FSTP [EDX]
fstp (%edx)
# [8] FSTP [EAX]
fstp (%eax)
-

as a problem:

Assembling program
test.s:21:2: error: ambiguous instructions require an explicit suffix
(could be 'fstps', 'fstpl', or 'fstpt')
fstp(%edx)
^
test.s:23:2: error: ambiguous instructions require an explicit suffix
(could be 'fstps', 'fstpl', or 'fstpt')
fstp(%eax)

One interested could search the internet for the problem encountered with
other platforms, and find out that the newer clang is somewhat backward
incompatible.

My first attempt was to replace to put the suggested FSTPS instruction in
place:
FSTPS [EDX]
However, the compiler stopped me, complaining about "FSTPS" is not a
recognized instruction.

The next approach was to rewrite the function into at&t syntax. (The actual
implementation could be found at sincos() of RTL math unit).

Is it a yet to be developed feature for FPC to satisfy demands of external
tools relies on?

I presume since the compiler parses intel asm and translates it into at&t
asm, it should take into consideration requirements of the latest osx
building tools.
Or is it already supported and I'm just missing a compiler switch?

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