Re: [fpc-pascal] Error when trying to make tests for target AVR

2018-01-06 Thread Christo
On Sun, 2018-01-07 at 05:59 +0200, Christo wrote:
> __missing_command_FPCMAKE -p -Tavr-embedded Makefile.fpc

Adding fpc_baseinfo to the make command revealed that FPCMAKE was not defined 
(I guess it should
have been obvious from the error message in the first place). I added the path 
to fpcmake
(FPCMAKE=path_to_fpcmake) to the make command line and the tests are now 
running.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

[fpc-pascal] Error when trying to make tests for target AVR

2018-01-06 Thread Christo
I'm trying to run the test suite for AVR by executing the following make 
statement:

make FPC=~/fpc/3.1.1/compiler/ppcx64 TEST_FPC=~/fpc/3.1.1/compiler/ppcrossavr
TEST_CPU_TARGET=avr TEST_OS_TARGET=embedded TEST_SUBARCH=avr5 TEST_OPT="-XPavr-"

from the /tests folder. Make terminates with the error, see below for the last 
couple of lines of output:
make -C tstunits FPC_VERSION= FPC=/home/christo/fpc/3.1.1/compiler/ppcrossavr 
CPU_TARGET=avr OS_TARGET=embedded SUBARCH=avr5 'OPT=-XPavr- -Fd' CCOMPILER= 
BINUTILSPREFIX=
make[2]: Entering directory '/home/christo/fpc/3.1.1/tests/tstunits'
make -C ../../rtl all 'OPT= -n' 'CROSSOPT=-XPavr- -Fd'
make[3]: Entering directory '/home/christo/fpc/3.1.1/rtl'
make -C embedded all
make[4]: Entering directory '/home/christo/fpc/3.1.1/rtl/embedded'
make[4]: Leaving directory '/home/christo/fpc/3.1.1/rtl/embedded'
make[3]: Leaving directory '/home/christo/fpc/3.1.1/rtl'
make -C ../../rtl install 
INSTALL_PREFIX=/home/christo/fpc/3.1.1/tests/tstunits/tmp 
INSTALL_UNITDIR=/home/christo/fpc/3.1.1/tests/tstunits/avr-embedded OPT= 
CROSSOPT=
make[3]: Entering directory '/home/christo/fpc/3.1.1/rtl'
make -C embedded all
make[4]: Entering directory '/home/christo/fpc/3.1.1/rtl/embedded'
make[4]: Leaving directory '/home/christo/fpc/3.1.1/rtl/embedded'

__missing_command_FPCMAKE -p -Tavr-embedded Makefile.fpc

make[3]: __missing_command_FPCMAKE: Command not found
Makefile:1450: recipe for target 'fpc_install' failed
make[3]: *** [fpc_install] Error 127

I've tried 3.0.4 as starting compiler but got the same error.  I can generate a 
cross compiler for AVR normally.  Any idea what is missing/wrong here?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Final Methods support

2018-01-06 Thread Marcos Douglas B. Santos
On Sat, Jan 6, 2018 at 2:41 PM, Sven Barth via fpc-pascal
 wrote:
> Am 06.01.2018 17:31 schrieb "Marcos Douglas B. Santos" :
>
> Does FPC have support for final methods?
>
> Please see ->
> http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Methods_(Delphi)#Final_Methods
>
>
> Should be supported since 2009, so that would be from at least 2.6.0.

Ok, thanks!

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

Re: [fpc-pascal] re-engineering tool

2018-01-06 Thread Marco van de Voort
In our previous episode, Marc Santhoff said:
> Since I'm confronted with the task of analyzing a pile of object pascal
> sources I'd like to know:
> 
> Is there any tool that can help me?

I've used Peganza's pascal analyser in the past, for D7 code. I haven't
used it in a while though.
 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Final Methods support

2018-01-06 Thread Sven Barth via fpc-pascal
Am 06.01.2018 17:31 schrieb "Marcos Douglas B. Santos" :

Does FPC have support for final methods?

Please see ->
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/
Methods_(Delphi)#Final_Methods


Should be supported since 2009, so that would be from at least 2.6.0.

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

Re: [fpc-pascal] String message methods and the self parameter

2018-01-06 Thread Sven Barth via fpc-pascal
Am 06.01.2018 17:25 schrieb "Ewald" :

Hi,

When reading https://www.freepascal.org/docs-html/ref/refsu31.html#
x82-1040006.5.7 I stumbled on the following text at the bottom of the page:

"In addition to this mechanism, a string message method accepts a self
parameter:
Procedure StrMsgHandler(Data: Pointer;
Self: TMyObject); Message ’OnClick’;

When encountering such a method, the compiler will generate code that loads
the Self parameter into the object instance pointer. The result of this is
that it is possible to pass Self as a parameter to such a method.

Remark: The type of the Self parameter must be of the same class as the
class the method is defined in."

1. This code snippet fails to compile with the message "Message handlers
can take only one call by ref. parameter" (revision 30487, $mode objfpc)
2. "[...] When encountering such a method, [...]": What are the exact
criteria: the parameter name, the parameter type, ...?
3. Can anybody explain what the part "The result of this is that it is
possible to pass Self as a parameter to such a method." entails? How can it
be passed with DispatchStr?
4. Can somebody give an example on how to use this functionality?


Judging from the implementation inside the RTL I'd say that this is a bug
in the documentation. String message methods work like ordinal ones and
take only one parameter.

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

[fpc-pascal] Final Methods support

2018-01-06 Thread Marcos Douglas B. Santos
Does FPC have support for final methods?

Please see ->
http://docwiki.embarcadero.com/RADStudio/Tokyo/en/Methods_(Delphi)#Final_Methods

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

[fpc-pascal] String message methods and the self parameter

2018-01-06 Thread Ewald
Hi,

When reading 
https://www.freepascal.org/docs-html/ref/refsu31.html#x82-1040006.5.7 I 
stumbled on the following text at the bottom of the page:

"In addition to this mechanism, a string message method accepts a self 
parameter:
Procedure StrMsgHandler(Data: Pointer;  
Self: TMyObject); Message ’OnClick’;

When encountering such a method, the compiler will generate code that loads the 
Self parameter into the object instance pointer. The result of this is that it 
is possible to pass Self as a parameter to such a method.

Remark: The type of the Self parameter must be of the same class as the class 
the method is defined in."

1. This code snippet fails to compile with the message "Message handlers can 
take only one call by ref. parameter" (revision 30487, $mode objfpc)
2. "[...] When encountering such a method, [...]": What are the exact criteria: 
the parameter name, the parameter type, ...?
3. Can anybody explain what the part "The result of this is that it is possible 
to pass Self as a parameter to such a method." entails? How can it be passed 
with DispatchStr?
4. Can somebody give an example on how to use this functionality?

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

Re: [fpc-pascal] Translate C code

2018-01-06 Thread Sven Barth via fpc-pascal
Am 06.01.2018 12:23 schrieb "Ryan Joseph" :



> On Jan 6, 2018, at 5:25 PM, Karoly Balogh (Charlie/SGR) <
char...@scenergy.dfmk.hu> wrote:
>
> So it doesn't crash, because it never loads from this "invalid" address it
> calculates.

Are we talking about the address on the stack at compile time? If no memory
was ever allocated (which I thought nil suggested) then I don’t see where
it’s getting an address of anything.


In this case Nil does in fact have the address 0. Thus the address of a
field in a record with address 0 is its offset in the record.

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

Re: [fpc-pascal] Translate C code

2018-01-06 Thread Ryan Joseph


> On Jan 6, 2018, at 5:25 PM, Karoly Balogh (Charlie/SGR) 
>  wrote:
> 
> So it doesn't crash, because it never loads from this "invalid" address it
> calculates.

Are we talking about the address on the stack at compile time? If no memory was 
ever allocated (which I thought nil suggested) then I don’t see where it’s 
getting an address of anything.

For anyone interested can you recode that function to more Pascal? It feels 
like we’re going needlessly low level when another method would make more sense.

Regards,
Ryan Joseph

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

Re: [fpc-pascal] Translate C code

2018-01-06 Thread Giuliano Colla

Il 06/01/2018 01:39, Darius Blaszyk ha scritto:

#define MEMNEXT(x) ((MyStruct *)(((char *) x) - ((char *) & 
(((MyStruct *)0)->next


h2pas translates it into the enclosed file.
Hope that it helps.

Giuliano




darius.pp
Description: application/wine-extension-pp
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Translate C code

2018-01-06 Thread Karoly Balogh (Charlie/SGR)
Hi,

On Sat, 6 Jan 2018, Ryan Joseph wrote:

> Also why does @(PMyStruct(nil)^.next not crash? Dereferencing and taking
> the addressing of a nil pointer sounds like a bad idea.

Because it doesn't do the actual dereferencing, because next's *VALUE* is
never used, only it's address (due to the @ operator). Which is basically
a fixed address of zero (nil) + a constant added together.

So it doesn't crash, because it never loads from this "invalid" address it
calculates.

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

[fpc-pascal] re-engineering tool

2018-01-06 Thread Marc Santhoff
Hi!

Since I'm confronted with the task of analyzing a pile of object pascal
sources I'd like to know:

Is there any tool that can help me?

Automatically generating a visual class diagram having uses and
aggregation of other classes would be very helpful.

Any hints?
TIA,
Marc

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

Re: [fpc-pascal] Translate C code

2018-01-06 Thread Ryan Joseph


> On Jan 6, 2018, at 1:49 PM, Karoly Balogh (Charlie/SGR) 
>  wrote:
> 
> type
>  PMyStruct = ^TMyStruct;
>  TMyStruct = record
>some, fields: integer;
>next: PMyStruct;
>  end;
> 
> function MEMNEXT(x: Pointer): PMyStruct;
> begin
>  MEMNEXT:=PMyStruct(PByte(x)-PByte(@(PMyStruct(nil)^.next)));
> end;

I’m curious about how this is intended to be used. What would the value of x 
be? This looks like a confusing way to write sizeof(TMyStruct) - 
Sizeof(pointer) but I’m confused myself.

Also why does @(PMyStruct(nil)^.next not crash? Dereferencing and taking the 
addressing of a nil pointer sounds like a bad idea.

Regards,
Ryan Joseph

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

Re: [fpc-pascal] Translate C code

2018-01-06 Thread Darius Blaszyk
Well, not sure why one needs to do this abomination, without knowing 
the

data structure it operates on, but nevertheless, you can do the same in
Free Pascal, but you better turn the macro into a function:


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