Re: [fpc-pascal] Pathscale: alternative debugger on Linux?

2012-11-11 Thread Reinier Olislagers
On 11-11-2012 6:55, microc...@zoho.com wrote:
> On Sat, Nov 10, 2012 at 07:57:09PM +0100, Jonas Maebe wrote: > > On 10
> Nov 2012, at 19:38, microc...@zoho.com wrote: > > > On Sat, Nov 10, 2012
> at 06:20:29PM +0100, Reinier Olislagers wrote: > >> Has anybody tried
> the Pathscale debugger on Linux x64/FreeBSD? > >> > >> I haven't myself,
> just heard that they open sourced their compiler suite. > >> > >> A
> download page seems to be here: > >>
> http://www.pathscale.com/ekopath-compiler-suite > > > > "Starting at
> $1795" > > That's if you want a supported official release. The page
> linked above > offers a free download of a nightly snapshot.
> I saw that, but I did not understand whether the license agreement
> linked off the main page (177K PDF) also applies to the nightly release.
> That license agreement seems to say you can only use it for 20 days.
> Until they come out and say it, I have to ASSume there isn't any version


"I saw that... do not understand license...looks like sales trial...assume"

Well, actually you will get a clear license text when running the
installer. It seems you get a license[1] valid until termination by either
- you with a 20 day notice period
- by Pathscale if you're in breach of contract.
No trial.

For fun(!?) I also skimmed the PDF license agreeement on their site [2]
which seemed very similar (may be the same) to the license given by the
installer.

So I'm glad they generously offer this.


[1]
5.1.Term.  This License will take effect as of the Effective date, and
will remain in effect until terminated (i) by Customer with or without
cause, upon twenty (20) days written notice to Pathscale, or (ii) by
Pathscale upon written notice to Customer in the event Customer is in
material breach of this License and will have failed to cure such breach
within thirty (30) days of receipt of written notice thereof from Pathscale.

[2]
http://www.pathscale.com/pdf/PathScale_Software_License.pdf
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] synapse and OS/2

2012-11-11 Thread Tomas Hajny
On 10 Nov 12, at 20:29, waldo kitty wrote:


> before i get too much further along on this project, i guess i should ask 
> about 
> the ssleay32 and libeay32 libraries on OS/2...
> 
> i'm developing this project on windows with the ultimate goal of copying the 
> source files over to my OS/2 (eCS2) box and compiling it there with FPC... i 
> have another project that uses only about four of the synapse39 files and 
> they 
> required some modification to compile on OS/2 with EMX... i'm concerned that 
> i 

Have you submitted your OS/2-specific changes to the Synapse 
developer so that they could be included in the project for future 
versions?


> may run into the same problem with synapse40 as well as not being able to 
> have 
> the needed ssleay32 and libeay32 files for accessing https sites...
 .
 .

I don't have direct experience with using Synapse (under OS/2 or 
otherwise), but two more general comments:

- If these libraries are supposed to come from OpenSSL, I've found a 
note in some Internet discussions that libeay32.dll is name used in 
the Windows port of OpenSSL for libcrypto (available for OS/2 as 
either crypto.dll or kcrypto.dll/kcrypt10.dll - see my second note 
below) and similarly ssleay32.dll is Windows specific name for libssl 
(available for OS/2 as either ssl.dll or kssl.dll/kssl10.dll).

- OpenSSL is available for OS/2 in at least two flavours / ports. One 
of them uses the original libc port created with EMX (emxlibc.dll). 
This port for OpenSSL 0.9.7a is available on Hobbes 
(http://hobbes.nmsu.edu); I don't know whether there is similar EMX 
port/binary available for a later OpenSSL version. In addition, there 
are builds using kLibC (libc06*.dll - in particular libc063.dll) 
which is a more recent libc port included with the latest GCC ports 
for OS/2. These ports were provided by some Japan user. An older 
version based on OpenSSL 0.9.8n is also available on Hobbes, but the 
latest builds are only available from his website 
(http://bauxite.sakura.ne.jp/software/os2/#openssl; the URL included 
with the build on Hobbes is not valid any longer). Notes on his page 
indicate that it should be still possible to compile OpenSSL with the 
original EMX GCC but there is no binary provided for this on that 
page. Now - which version to use probably depends on whether you need 
to use other libraries using libc or not. If you do, you should 
probably use the same libc version also for openssl. If you don't, 
you can probably choose either of them (although I assume that the 
later version might be better protected from attacks).

Hope this helps

Tomas

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


[fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread ik
Hello,

I'm trying to write a shard library of my own that you can use with C
as well. I'm using mode fpc, and not objfpc.

I created something like this:

...
procedure varargs_example(params : array of consts); cdecl;
...

The compiler report an error:
Error:Type identifier expected
Fatal: Syntax error, ")" expected but "CONST" found


Please note that I need to access the "params" variable inside my code.
How can I implement it correctly with FPC 2.6.0 ?

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


Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Sven Barth

On 11.11.2012 13:40, ik wrote:

Hello,

I'm trying to write a shard library of my own that you can use with C
as well. I'm using mode fpc, and not objfpc.

I created something like this:

...
procedure varargs_example(params : array of consts); cdecl;
...

The compiler report an error:
Error:Type identifier expected
Fatal: Syntax error, ")" expected but "CONST" found


Please note that I need to access the "params" variable inside my code.
How can I implement it correctly with FPC 2.6.0 ?


You can not write cdecl functions with variable argument lists in FPC. 
You can only access such functions exported from C code. See also here: 
http://wiki.freepascal.org/User_Changes_2.6.0#Array_of_const_parameters_and_cdecl_routines


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


Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread ik
On Sun, Nov 11, 2012 at 2:54 PM, Sven Barth  wrote:
> On 11.11.2012 13:40, ik wrote:
>>
>> Hello,
>>
>> I'm trying to write a shard library of my own that you can use with C
>> as well. I'm using mode fpc, and not objfpc.
>>
>> I created something like this:
>>
>> ...
>> procedure varargs_example(params : array of consts); cdecl;
>> ...
>>
>> The compiler report an error:
>> Error:Type identifier expected
>> Fatal: Syntax error, ")" expected but "CONST" found
>>
>>
>> Please note that I need to access the "params" variable inside my code.
>> How can I implement it correctly with FPC 2.6.0 ?
>
>
> You can not write cdecl functions with variable argument lists in FPC. You
> can only access such functions exported from C code. See also here:
> http://wiki.freepascal.org/User_Changes_2.6.0#Array_of_const_parameters_and_cdecl_routines

I know this one, but here I'm the one who write the code that is
exported to C and not vice versa.
How can I write it in a way that C can also use it ?

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


Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Sven Barth

On 11.11.2012 13:58, ik wrote:

On Sun, Nov 11, 2012 at 2:54 PM, Sven Barth  wrote:

On 11.11.2012 13:40, ik wrote:


Hello,

I'm trying to write a shard library of my own that you can use with C
as well. I'm using mode fpc, and not objfpc.

I created something like this:

...
procedure varargs_example(params : array of consts); cdecl;
...

The compiler report an error:
Error:Type identifier expected
Fatal: Syntax error, ")" expected but "CONST" found


Please note that I need to access the "params" variable inside my code.
How can I implement it correctly with FPC 2.6.0 ?



You can not write cdecl functions with variable argument lists in FPC. You
can only access such functions exported from C code. See also here:
http://wiki.freepascal.org/User_Changes_2.6.0#Array_of_const_parameters_and_cdecl_routines


I know this one, but here I'm the one who write the code that is
exported to C and not vice versa.
How can I write it in a way that C can also use it ?


Yes and this is exactly what the change states. You can not write 
"varargs" functions in Pascal that can be accessed from C.


The only solution would be to basically do something like the TVarRec 
record does: have a record of which one field is a "type specifier" and 
the remaining is a union out of the different supported types. You then 
pass a Pointer to the first element of an array of that type and the 
length of the array to the Pascal function. The negative point is of 
course that you'll need to instantiate, populate and afterwards free the 
array you pass to the pascal function.


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


Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Bernd
2012/11/11 Sven Barth :

> Yes and this is exactly what the change states. You can not write "varargs"
> functions in Pascal that can be accessed from C.

Wouldn't it be possible to write a function in pascal that declares a
simple longint parameter instead of the varargs and then inside the
function use the stack pointer (the address of that argument) to read
the entire list from the stack directly? Since in cdecl the caller
will clean up the stack after the function call this should not cause
any problems?

something along these lines (for example if a list of longints should
be passed):

procedure FakeVararg(dummy: LongInt);
var
  Start: PLongInt;
  First, Second, Third: LongInt;

begin
  Start := PLongInt(@dummy);

  First := Start[0];
  Second := Start[1];
  Third := Start[2];

end;

(or something very similar to this, not sure if the above code works
already, not tested)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Jonas Maebe

On 11 Nov 2012, at 20:42, Bernd wrote:

> Wouldn't it be possible to write a function in pascal that declares a
> simple longint parameter instead of the varargs and then inside the
> function use the stack pointer (the address of that argument) to read
> the entire list from the stack directly?

No, because the C varargs calling convention does not simply pass the 
parameters on the stack on most platforms.


Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Bernd
2012/11/11 Jonas Maebe :

> No, because the C varargs calling convention does not simply pass the 
> parameters on the stack on most platforms.

Where else are the arguments if not on the stack? Everything I have
read so far about varargs and cdecl says they are on the stack.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Jonas Maebe

On 11 Nov 2012, at 20:57, Bernd wrote:

> 2012/11/11 Jonas Maebe :
> 
>> No, because the C varargs calling convention does not simply pass the 
>> parameters on the stack on most platforms.
> 
> Where else are the arguments if not on the stack?

In registers.

> Everything I have
> read so far about varargs and cdecl says they are on the stack.

Then you probably only read about i386 ABIs (and maybe m68k).


Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Bernd
2012/11/11 Jonas Maebe :

> Then you probably only read about i386 ABIs (and maybe m68k).

But a bunch of ifdefs should do the trick then, it should still be
possible to implement every possible implementation in pascal somehow.

Is there a document somewhere that specifies how exactly cdecl varargs
is implemented on the different platforms? I could no find anything.
Since fpc can *call* vararg functions the knowledge about how exactly
they are implemented on all the different platforms must exist
somewhere?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] Re: Can JCF handle Generics?

2012-11-11 Thread bsquared

On 11/10/2012 08:31 PM, leledumbo wrote:

It can (modify the parser of course), and AFAIR, in the Lazarus trunk it
already handles some.



--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/Can-JCF-handle-Generics-tp5711920p5711924.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/mailman/listinfo/fpc-pascal


Thank you for your response.

It seems to stop with an error when I declare a specialized type.

--
Regards,
Brian

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


Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Jonas Maebe

On 11 Nov 2012, at 21:17, Bernd wrote:

> 2012/11/11 Jonas Maebe :
> 
>> Then you probably only read about i386 ABIs (and maybe m68k).
> 
> But a bunch of ifdefs should do the trick then, it should still be
> possible to implement every possible implementation in pascal somehow.

No, it is not possible. There are no Pascal (or C, for that matter) expressions 
that map to particular registers on entry into the function.

> Is there a document somewhere that specifies how exactly cdecl varargs
> is implemented on the different platforms?

There is one such document per ABI. These individual ABI documents are located 
all over the web. E.g. the official x86-64 ABI can be found at 
http://www.x86-64.org/documentation/abi.pdf, while the one for Win64 can be 
found at http://msdn.microsoft.com/en-us/library/ms235286.aspx

> I could no find anything.
> Since fpc can *call* vararg functions the knowledge about how exactly
> they are implemented on all the different platforms must exist
> somewhere?

It's much easier to construct it on the caller side than on the callee side. On 
the caller side, the information can be statically determined at compile time 
based on the types and order of the passed parameters. On the callee side, the 
information has to be dynamically determined. Moreover, the location of a cdecl 
varargs parameter generally depends on the number *and* types of the previous 
varargs parameters, so an expressions such as params[i] or even params[1] could 
never be supported. That's why in C you also have to use the 
va_start/va_arg/va_copy/va_end intrinsics to sequentially walk all such 
parameters.


Jonas___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] synapse and OS/2

2012-11-11 Thread waldo kitty

On 11/11/2012 07:05, Tomas Hajny wrote:

On 10 Nov 12, at 20:29, waldo kitty wrote:


before i get too much further along on this project, i guess i should ask about
the ssleay32 and libeay32 libraries on OS/2...

i'm developing this project on windows with the ultimate goal of copying the
source files over to my OS/2 (eCS2) box and compiling it there with FPC... i
have another project that uses only about four of the synapse39 files and they
required some modification to compile on OS/2 with EMX... i'm concerned that i


Have you submitted your OS/2-specific changes to the Synapse
developer so that they could be included in the project for future
versions?


i didn't make them... someone else did to help me with compiling on OS/2 with 
EMX... i will have to dig back into my saved messages to locate what they sent 
me and who it was... basically all they did was to add a few $IFDEF for OS/2... 
they also created one pas file with some initialization routines...


i can send what i have but i don't know where to send to... plus, these are only 
the 4 or 5 files that my one project needed for mime translation stuffs...



may run into the same problem with synapse40 as well as not being able to have
the needed ssleay32 and libeay32 files for accessing https sites...

  .
  .

I don't have direct experience with using Synapse (under OS/2 or
otherwise), but two more general comments:


hummm... i'm hoping that i won't run into a wall with this :/


- If these libraries are supposed to come from OpenSSL, I've found a
note in some Internet discussions that libeay32.dll is name used in
the Windows port of OpenSSL for libcrypto (available for OS/2 as
either crypto.dll or kcrypto.dll/kcrypt10.dll - see my second note
below) and similarly ssleay32.dll is Windows specific name for libssl
(available for OS/2 as either ssl.dll or kssl.dll/kssl10.dll).


ahh... all i know is that they were referenced as being needed for accessing 
https sites... without them, even with one of the specified ssl plugins, ssl 
still wouldn't work...



- OpenSSL is available for OS/2 in at least two flavours / ports. One
of them uses the original libc port created with EMX (emxlibc.dll).
This port for OpenSSL 0.9.7a is available on Hobbes
(http://hobbes.nmsu.edu); I don't know whether there is similar EMX
port/binary available for a later OpenSSL version.


cool! that may be what i'll need to use... that plus whatever code changes to 
synapse to load them... i do not recall if synapse has any OS/2 related defines 
or code... i don't recall seeing any notation of such in the docs or synapse 
code that i've looked at... everything seems to only state windows and linux...


maybe one of the first things to do is for me to get the files and extra init 
code to someone who knows what they are doing and then let's see if one can get 
all of synapse to compile on OS/2 with FPC by starting off with the blcksock unit...



In addition, there are builds using kLibC (libc06*.dll - in particular
libc063.dll) which is a more recent libc port included with the latest
GCC ports for OS/2.


currently, all my FPC compiles are configured to use EMX because that's what i'm 
familiar with... i do have those libc files for a couple of other tools, though...



These ports were provided by some Japan user. An older
version based on OpenSSL 0.9.8n is also available on Hobbes, but the
latest builds are only available from his website
(http://bauxite.sakura.ne.jp/software/os2/#openssl; the URL included
with the build on Hobbes is not valid any longer). Notes on his page
indicate that it should be still possible to compile OpenSSL with the
original EMX GCC but there is no binary provided for this on that
page. Now - which version to use probably depends on whether you need
to use other libraries using libc or not. If you do, you should
probably use the same libc version also for openssl. If you don't,
you can probably choose either of them (although I assume that the
later version might be better protected from attacks).


i think i understand... i'll sleep on it and see if a fully grok it on the 
morrow after i get up...



Hope this helps


it beats sloughing thru it all getting it to work with the barest of examples 
like i've been having to do... the docs are ok telling what something does but 
there are no example in the docs on how to do or use the routines... one such 
example is a note about having to prepare the POST vars and contents the same 
way one would prepare them for a GET but no where was anything offered that 
actually showed such... i took a wild guess and came up with a routine that 
works... it is based on storing the var names and their values in two arrays and 
then counting thru them but if i had no clue how they were supposed to be formed 
in the first place... well...


)\/(ark
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread Mark Morgan Lloyd

Jonas Maebe wrote:


Is there a document somewhere that specifies how exactly cdecl varargs
is implemented on the different platforms?


There is one such document per ABI. These individual ABI documents are located 
all over the web. E.g. the official x86-64 ABI can be found at 
http://www.x86-64.org/documentation/abi.pdf, while the one for Win64 can be 
found at http://msdn.microsoft.com/en-us/library/ms235286.aspx


I started trying to make a list of resources at 
http://wiki.lazarus.freepascal.org/Assembler_and_ABI_Resources but it's 
still largely just placeholders.


--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal