Re: [fpc-pascal] GLPT v0.1.1 released

2018-10-10 Thread dhkblaszyk


I created a new branch called GL-version. Accepting pull requests! 😉 


Verzonden vanaf mijn Samsung-apparaat

 Oorspronkelijk bericht 
Van: Ryan Joseph  
Datum: 10-10-18  05:23  (GMT+01:00) 
Aan: FPC-Pascal users discussions  
Onderwerp: Re: [fpc-pascal] GLPT v0.1.1 released 



> On Oct 9, 2018, at 12:19 PM, Ingemar Ragnemalm  wrote:
> 
> All your demos are old-style. I can't even see a single shader anywhere. I 
> think you should use modern OpenGL more. For instance, I have made a modern 
> version of the dear old Gears demo:

There’s not even a way to switch the OpenGL version yet so the project is 
effectively not ready for use (it’s stuck on 2.1 on OS X for example).

I suggest he just adds a record to the parameters when creating a window for 
the simplest solution. SDL uses a constants and setter/getter functions but a 
simple record is better.

type
  GLPT_Context = record
    doubleBuffer: boolean;
    colorSize: byte;
    depthSize: byte;
    stencilSize: byte;
    profile: byte;
    minorVersion: byte;
    majorVersion: byte;
  end;


Regards,
Ryan Joseph

___
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

[fpc-pascal] Get variable name at runtime

2013-03-04 Thread dhkblaszyk
 Hi,

How can I retrieve a variable name at runtime? I know about RTTI
on classes, what about simple type variables?

Regards, Darius

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

Re: [fpc-pascal] Forward struct declaration in C

2013-02-22 Thread dhkblaszyk
Thanks Sven and Michael,

I will do as you proposed and simply use a pointer for now. Later once the
code has been ported I will have a look to refactor the code.

Regards, Darius




> On 22.02.2013 09:57, dhkblas...@zeelandnet.nl wrote:
>> Hi,
>>
>> I'm porting a piece of software to FPC but I got stuck at a forward
>> struct
>> declaration. The situation is as folows.
>>
>> Header 1 declares:
>>  struct TaskHandle__;
>>  typedef void (*CallBackProcPtr)(struct TaskHandle__ *task);
>>
>> And Header2 provdes:
>>  typedef struct TaskHandle__ { int unused; } *TaskHandle
>>
>> However header 2 already references header 1 because it already contains
>> some other type definitions, so I cannot reference header 2 in header 1
>> because of a circular dependency. Can FPC do something similar to C and
>> define a forward record?
>
> A: You could move the declaration of TaskHandle__ to a common unit which
> is used by the other two units.
>
> B: As the TaskHandle__ type seems rather simple move it to the Header 1
> unit with a comment "was originally declared in Header 1" (because
> Header 2 already uses Header 1)
>
> C: You could treat the "task" parmeter for the callback simply as a
> pointer... (of course you reduce static typing with this)
>
> 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


[fpc-pascal] Forward struct declaration in C

2013-02-22 Thread dhkblaszyk
Hi,

I'm porting a piece of software to FPC but I got stuck at a forward struct
declaration. The situation is as folows.

Header 1 declares:
struct TaskHandle__;
typedef void (*CallBackProcPtr)(struct TaskHandle__ *task);

And Header2 provdes:
typedef struct TaskHandle__ { int unused; } *TaskHandle

However header 2 already references header 1 because it already contains
some other type definitions, so I cannot reference header 2 in header 1
because of a circular dependency. Can FPC do something similar to C and
define a forward record?

Regards, Darius

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


Re: [fpc-pascal] problems compiling FPC

2012-10-16 Thread dhkblaszyk
  

I heard you the first time, don't worry. Just don't clown around so
much. It was a perfectly normal reply on your mail. I will do as you
proposed. 

On 16 okt '12, mar...@stack.nl wrote: 

> In our previous
episode, dhkblas...@zeelandnet.nl [1]said:
> 
>> The starting compiler
is also from SVN (21955).
> 
> [bold][font
size=1][color=red][style=blink]
> The starting compiler is only
guaranteed to work if it is the last release.
> And only the last
release, 2.6.0.
> 
> Anything else can break at any time. 
>
[/style][/color][/font][/bold]
> 
>
___
> fpc-pascal maillist -
fpc-pascal@lists.freepascal.org [2]
>
http://lists.freepascal.org/mailman/listinfo/fpc-pascal [3]

 


Links:
--
[1] mailto:dhkblas...@zeelandnet.nl
[2]
mailto:fpc-pascal@lists.freepascal.org
[3]
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] problems compiling FPC

2012-10-16 Thread dhkblaszyk
  

The starting compiler is also from SVN (21955). 

On 16 okt '12,
mar...@stack.nl wrote: 

> In our previous episode,
dhkblas...@zeelandnet.nl [1]said:
> 
>> I am trying to update my FPC
from SVN, but for some reason I keep on getting a compilation error. The
last build was from 21955 (23rd July 2012). See below for the makefile
output.
> 
> The crucial bit of information, the version of the starting
compiler, is
> missing.
> 
> It should be 2.6.0, and nothing else.
>
___
> fpc-pascal maillist -
fpc-pascal@lists.freepascal.org [2]
>
http://lists.freepascal.org/mailman/listinfo/fpc-pascal [3]

 


Links:
--
[1] mailto:dhkblas...@zeelandnet.nl
[2]
mailto:fpc-pascal@lists.freepascal.org
[3]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] problems compiling FPC

2012-10-16 Thread dhkblaszyk
  

Hi, 

I am trying to update my FPC from SVN, but for some reason I
keep on getting a compilation error. The last build was from 21955 (23rd
July 2012). See below for the makefile output. 

Regards, Darius


C:lazarusfpctrunk>make all
make compiler_cycle RELEASE=1
make[1]:
Entering directory `C:/lazarus/fpc/trunk'
make -C compiler
cycle
make[2]: Entering directory `C:/lazarus/fpc/trunk/compiler'
make
tempclean ppc3.exe
make[3]: Entering directory
`C:/lazarus/fpc/trunk/compiler'
/pp/bin/i386-win32/rm.exe -f
ppcross386.exe ppc.exe ppc1.exe ppc2.exe ppc3.exe ./msg2inc.exe pp1.wpo
pp2.wpo
make 'OLDFPC=' next CYCLELEVEL=1
make[4]: Entering directory
`C:/lazarus/fpc/trunk/compiler'
make rtlclean rtl
make[5]: Entering
directory `C:/lazarus/fpc/trunk/compiler'
make -C
C:/lazarus/fpc/trunk/rtl clean
make[6]: Entering directory
`C:/lazarus/fpc/trunk/rtl'
/pp/bin/i386-win32/rm.exe -f
fpcmade.i386-win32 Package.fpc ppas.sh script.res
link.res
/pp/bin/i386-win32/rm.exe -f *.s *_ppas.bat
make -C win32
clean
make[7]: Entering directory
`C:/lazarus/fpc/trunk/rtl/win32'
/pp/bin/i386-win32/rm.exe -f
C:/lazarus/fpc/trunk/rtl/units/i386-win32/system.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/uuchar.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/objpas.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/macpas.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/iso7185.ppu
C:/l
zarus/fpc/trunk/rtl/units/i386-win32/buildrtl.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/lineinfo.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/lnfodwrf.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/sysinitpas.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/sysinitcyg.ppu
C:/lazarus/fpc/trunk/rtl/
nits/i386-win32/sysinitgprof.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/ctypes.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/strings.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/heaptrc.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/matrix.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/windows.pp

C:/lazarus/fpc/trunk/rtl/units/i386-win32/winsock.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/winsock2.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/initc.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/cmem.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/dynlibs.ppu
C:/lazarus/fpc/trunk/rtl/units/i
86-win32/signals.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/dos.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/crt.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/objects.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/messages.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/rtlconsts.ppu
C:/lazarus/fp
/trunk/rtl/units/i386-win32/sysconst.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/sysutils.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/math.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/types.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/strutils.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/dat
utils.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/varutils.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/variants.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/typinfo.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/fgl.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/classes.ppu
C:/lazarus/fpc/trunk/
tl/units/i386-win32/convutils.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/stdconvs.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/cpu.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/mmx.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/charset.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/character.ppu
:/lazarus/fpc/trunk/rtl/units/i386-win32/ucomplex.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/getopts.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/winevent.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/sockets.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/printer.ppu
C:/lazarus/fpc/trunk/rtl/uni
s/i386-win32/video.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/mouse.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/keyboard.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/fmtbcd.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/winsysut.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/sharemem.ppu
C:/laz
rus/fpc/trunk/rtl/units/i386-win32/exeinfo.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/fpintres.ppu
C:/lazarus/fpc/trunk/rtl/units/i386-win32/windirs.ppu
/pp/bin/i386-win32/rm.exe
-f C:/lazarus/fpc/trunk/rtl/units/i386-win32/math.rst
C:/lazarus/fpc/trunk/rtl/units/i386-win32/varutils.rst
C:/lazarus/fpc/trunk/rtl/units/i386-win32/typinfo.rst
C:/lazarus/fpc/trunk/rtl/units/i386-win32/variants.rst
C:/lazarus/fpc/trunk/rtl/units/i386-win32/classes.rst
C
/lazarus/fpc/trunk/rtl/units/i386-win32/dateutils.rst
C:/lazarus/fpc/trunk/rtl/units/i386-win32/sysconst.rst
/pp/bin/i386-win32/rm.exe
-f fpcmade.i386-win32 Package.fpc ppas.sh script.res
link.res
/pp/bin/i386-win32/rm.exe -f *.s *_ppas.bat
make[7]: Leaving
directory `C:/lazarus/fpc/trunk/rtl/win32'
make[6]: Leaving directory
`C:/lazarus/fpc/trunk/rtl'
make -C C:/lazarus/fpc/trunk/rtl 'OPT= '
all
make[6]: Entering directory `C:/lazarus/fpc/trunk/rtl'
make -C win32
al

Re: [fpc-pascal] Memory alignment with FPC

2012-10-11 Thread dhkblaszyk
  

On 11 okt '12, Jonas Maebe wrote: 

> On 11 Oct 2012, at 15:23,
dhkblas...@zeelandnet.nl [1] wrote: 
> 
>> Thanks, I think everything is
clear now. My plan now is to
>> respect default padding and write
records in one go to disk. The padding
>> value will be written to the
file header so the records can be read back
>> one variable at a time
when padding differs, otherwise they will be read
>> back in one go
again. This will sure come at a cost, but only if the
>> file is shared
between different ABI's (as is the case when sharing
>> between
different endianess). The result will be that the data
>> structures
will be at default padding internally allways making optimal
>> use of
the CPU. 
>> 
>> So is there a way to get the padding value at
runtime?
> 
> No. You really should write the fields one by one. Yes,
it's slower. That's the cost of portability. You can always optimize by
first writing them to a buffer and then writing the buffer in one go. 
>
Jonas

Sorry I keep asking questions, but why write them one by one? If
I would store the offset each variable has at the time of writing (only
need to do one time per record type), I could easily make the loading
work (even if the ABI changes when the file is read back). What makes
you prefer writing the variables one by one over once at a time?


Darius 

  

Links:
--
[1] mailto:dhkblas...@zeelandnet.nl
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Memory alignment with FPC

2012-10-11 Thread dhkblaszyk
  

On 11 okt '12, Jonas Maebe wrote: 

> On 11 Oct 2012, at 15:00,
dhkblas...@zeelandnet.nl [1]wrote:
> 
>> So misalignment of for instance
a double (or whatever type) will only happen if the record is packed and
the packed value is smaller than what the ABI prescribes, correct?
> 
>
Yes.
> 
>> Let's assume I set the record to packed 16bytes, this would
make reading and writing records as a whole safe on all platform/
architecture combinations right? Apart from a few padding bytes, what
are the performance penalties of doing this then? Why would there be
penalties?
> 
> The cpu cache will contain lots of unused padding
bytes.

Thanks, I think everything is clear now. My plan now is to
respect default padding and write records in one go to disk. The padding
value will be written to the file header so the records can be read back
one variable at a time when padding differs, otherwise they will be read
back in one go again. This will sure come at a cost, but only if the
file is shared between different ABI's (as is the case when sharing
between different endianess). The result will be that the data
structures will be at default padding internally allways making optimal
use of the CPU. 

So is there a way to get the padding value at runtime?


Darius 

Links:
--
[1] mailto:dhkblas...@zeelandnet.nl
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Memory alignment with FPC

2012-10-11 Thread dhkblaszyk
  

On 11 okt '12, Jonas Maebe wrote: 

> As mentioned before, it not
only depends on the platform, but also on the contents of the
object/record. E.g., a badly misaligned double will generally give much
worse performance even on Intel. 
> 
>> This makes me wonder if
>>
choosing a proper value for $PACKRECORDS could make my file readable
>>
safely on all platforms, only needing to convert the endianess if
>>
applicable. This would not force me to do manual padding in my
structs.
>> Say I use a value of 16 would that cover all ABI's FPC
currently
>> supports?
> 
> Yes.

So misalignment of for instance a
double (or whatever type) will only happen if the record is packed and
the packed value is smaller than what the ABI prescribes, correct?


Let's assume I set the record to packed 16bytes, this would make
reading and writing records as a whole safe on all platform/architecture
combinations right? Apart from a few padding bytes, what are the
performance penalties of doing this then? Why would there be penalties?


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

Re: [fpc-pascal] Memory alignment with FPC

2012-10-11 Thread dhkblaszyk
  

On 10 okt '12, dhkblas...@zeelandnet.nl wrote: 

> One more
question, when using packed records, is there anything to say about
performance? Are there some tests anywhere that show how the performance
is impacted?

I did some performance tests on win32 and it appears that
both packed and unpacked objects and records all show exactly the same
performance. Writing the individual variables in a record or object to
file takes about 5.5 times longer than writing them at once. If someone
wants my test app to run it on other platforms please let me know then I
can post the code. I will do more testing later on mac and linux32. I'm
interested how win64 and linux64 behave in this respect. So if someone
has these architectures please let me know. 

This makes me wonder if
choosing a proper value for $PACKRECORDS could make my file readable
safely on all platforms, only needing to convert the endianess if
applicable. This would not force me to do manual padding in my structs.
Say I use a value of 16 would that cover all ABI's FPC currently
supports? 

Jonas: do you have an overview of the alignment on all
architectures that FPC supports? Perhaps you could pinpoint where in the
compiler this is handled? If appreciated I could make a patch to include
this info in the documentation in the future. 

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

Re: [fpc-pascal] Memory alignment with FPC

2012-10-10 Thread dhkblaszyk
  

On 10 okt '12, Jonas Maebe wrote: 

> On 10 Oct 2012, at 12:02,
dhkblas...@zeelandnet.nl [1] wrote: 
> 
>> Does FPC ensure the same
memory alignment for records and objects
>> over different platforms?
>

> No, alignment is defined by the platform ABI. 
> 
>> If I want to be
sure to have the same
>> alignment must I use packed (with possibly some
aligning assigned)
>> records instead in combination with data types
that are guaranteed to be
>> of the same size over the different
platforms (eg byte, word, single) ?
> 
> Yes. 
> When
> m
> 
>> r are
they undefined? 
>> 
>> They are undefined. 
>> Jonas

One more
question, when using packed records, is there anything to say about
performance? Are there some tests anywhere that show how the performance
is impacted? 

Darius 
  

Links:
--
[1]
mailto:dhkblas...@zeelandnet.nl
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Memory alignment with FPC

2012-10-10 Thread dhkblaszyk
  

On 10 okt '12, Sven Barth wrote: 

> Am 10.10.2012 12:02, schrieb
dhkblas...@zeelandnet.nl: [1]
> 
>> Does FPC ensure the same memory
alignment for records and objects over different platforms? If I want to
be sure to have the same alignment must I use packed (with possibly some
aligning assigned) records instead in combination with data types that
are guaranteed to be of the same size over the different platforms (eg
byte, word, single) ? Or do unpacked records behave the same over
different platforms?
> 
> Please note that you might also need to take
care of different endianess 
> (big endian vs. little endian) if you
want to transfer such record data 
> (e.g. through files) between
systems with different endianess. In that 
> case you'll need to write
the record field by field and convert the 
> endianess in one of the two
cases...
> 
> Regards,
> Sven
>
___
> fpc-pascal maillist -
fpc-pascal@lists.freepascal.org [2]
>
http://lists.freepascal.org/mailman/listinfo/fpc-pascal [3]

Thanks
Jonas and Sven... Endianess is indeed an issue I will be handling. It's
my understanding now that by storing data in a packed record I will have
the same behaviour (when it comes to aligning data in memory) over all
platforms and architectures. Same applies to packed objects. However
when objects have methods, does that change memory alignment (compared
to different architectures)? Is there any impact when I start using
object inheritance? 

The background behind my questions is the
implementation of an IFF reader/writer in FPC. The reader/writer will be
generated from available data types (simple ones as well as objects and
records). To simplify the code I want to make use of the abstraction
that FPC gives me. 

Regards, Darius 

  

Links:
--
[1]
mailto:dhkblas...@zeelandnet.nl:
[2]
mailto:fpc-pascal@lists.freepascal.org
[3]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Memory alignment with FPC

2012-10-10 Thread dhkblaszyk
  

Does FPC ensure the same memory alignment for records and objects
over different platforms? If I want to be sure to have the same
alignment must I use packed (with possibly some aligning assigned)
records instead in combination with data types that are guaranteed to be
of the same size over the different platforms (eg byte, word, single) ?
Or do unpacked records behave the same over different platforms? 

When
memory is alligned (either with {$PACKRECORDS N} or unpacked, are the
padding bytes quaranteed to be #0 or are they undefined? 

Any help
appreciated. 

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

[fpc-pascal] Re: using macros

2012-10-02 Thread dhkblaszyk
  

On 1 okt '12, dhkblas...@zeelandnet.nl wrote: 

> I need to
translate this: #define mymalloc(x,y) (x*)malloc((y)* sizeof(x)) 
> 
>
Is it possible using macro's in FPC or do I need to convert it to a
procedure? How would I cast the pointer in the latter case (without
having to change the sourcecode significantly)? 
> 
> Regards,
Darius

Thanks all, I decided to use an inline function and not to cast
the return pointer. However, I've got another interesting one. Does
someone have an idea how I could implement this? 

#define MYPRINT(var1)
printf(# var1 ":%dn", var1) 

Calling the macro as such :
MYPRINT(sizeof(int)); 

will yield: sizeof(int):4, which is useful for
debugging. 

Will I need RTTI for this? I never used it before so I
might be wrong. 

Darius

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

[fpc-pascal] using macros

2012-10-01 Thread dhkblaszyk
  

I need to translate this: #define mymalloc(x,y) (x*)malloc((y)*
sizeof(x)) 

Is it possible using macro's in FPC or do I need to convert
it to a procedure? How would I cast the pointer in the latter case
(without having to change the sourcecode significantly)? 

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

Re: [fpc-pascal] Re: Assigning pointer address

2012-10-01 Thread dhkblaszyk
  

On 1 okt '12, Reinier Olislagers wrote: 

> On 1-10-2012 13:55,
dhkblaszyk-47ckw973qwsgtviba+r...@public.gmane.org [4]wrote:
> 
>> On 1
okt '12, michael.vancanneyt-0is9kj9s...@public.gmane.org [3]wrote: 
>>

>>> On Mon, 1 Oct 2012, dhkblas...@zeelandnet.nl
[2]dhkblaszyk-47ckw973qwsgtviba+r...@public.gmane.org>wrote: 
>>> 
>>>>
Hi Tomas, Thanks for clarifying. I will use PtrUInt to store the pointer
address in. BTW: the documentation it says not to use PtrInt because
it's signed and therefore smaller than a pointer (as in max value). Also
there seems to be an error in the documentation. On
http://www.freepascal.org/docs-html/rtl/system/ptruint.html [1] [4] it
is described that PtrUInt is an alias to DWord. However, it depends on
the architecture which type it actually is. Could someone please correct
the docs?
>>> What do you want to see corrected ? On 32-bit systems, it
is a DWord. The docs were generated on such a system, so you get this
definition.
>> If possible I would like to see a remark mentioning that
it's a QWord on 64bit and Word on 16bit. That by itself would make thing
clearer already.
> 
> That sounds good (vaguely remember that PtrUint
also depends on OS, but
> leaving it to more knowledgeable people to
updat the docs anyway)
> 
>> In the ideal case fpdoc should be adjusted
so it can handle these defines. However this will be very complex I
assume.
> 
> IIUC, size PtrUint varies by architecture, which is more or
less the
> point of PtrUint.
> Having this variation documented as
Darius suggested above makes things
> much clearer, because the
programmer may be working on one platform and
> programming for another
(with {$IFDEFS}...).
> 
> Letting fpdoc predict this seems like a way to
madness.
> 
> ___
>
fpc-pascal maillist - fpc-pascal@lists.freepascal.org [5]
>
http://lists.freepascal.org/mailman/listinfo/fpc-pascal [6]

Nah, I
wasn't thinking about letting fpdoc predict anything. Instead though it
would be nice to introduce something that helps the documenter flag a
certain piece of code and let fpdoc know that it should show
alternatives or instead a separate piece of code (similar as examples
does). 

Darius 

  

Links:
--
[1]
http://www.freepascal.org/docs-html/rtl/system/ptruint.html
[2]
mailto:dhkblas...@zeelandnet.nl
[3]
mailto:michael.vancanneyt-0is9kj9s...@public.gmane.org
[4]
mailto:dhkblaszyk-47ckw973qwsgtviba+r...@public.gmane.org
[5]
mailto:fpc-pascal@lists.freepascal.org
[6]
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] Assigning pointer address

2012-10-01 Thread dhkblaszyk
  

On 1 okt '12, michael.vancann...@wisa.be wrote: 

> On Mon, 1 Oct
2012, dhkblas...@zeelandnet.nl [2]wrote:
> 
>> Hi Tomas, Thanks for
clarifying. I will use PtrUInt to store the pointer address in. BTW: the
documentation it says not to use PtrInt because it's signed and
therefore smaller than a pointer (as in max value). Also there seems to
be an error in the documentation. On
http://www.freepascal.org/docs-html/rtl/system/ptruint.html [1] [4] it
is described that PtrUInt is an alias to DWord. However, it depends on
the architecture which type it actually is. Could someone please correct
the docs?
> 
> What do you want to see corrected ?
> 
> On 32-bit
systems, it is a DWord. The docs were generated on such a system,
> so
you get this definition.
> 
> Michael.
>
___
> fpc-pascal maillist -
fpc-pascal@lists.freepascal.org [3]
>
http://lists.freepascal.org/mailman/listinfo/fpc-pascal [4]

If possible
I would like to see a remark mentioning that it's a QWord on 64bit and
Word on 16bit. That by itself would make thing clearer already. 

In the
ideal case fpdoc should be adjusted so it can handle these defines.
However this will be very complex I assume. 

Darius 
 


Links:
--
[1]
http://www.freepascal.org/docs-html/rtl/system/ptruint.html
[2]
mailto:dhkblas...@zeelandnet.nl
[3]
mailto:fpc-pascal@lists.freepascal.org
[4]
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] Assigning pointer address

2012-10-01 Thread dhkblaszyk
  

Hi Tomas, 

Thanks for clarifying. I will use PtrUInt to store the
pointer address in. BTW: the documentation it says not to use PtrInt
because it's signed and therefore smaller than a pointer (as in max
value). 

Also there seems to be an error in the documentation. On
http://www.freepascal.org/docs-html/rtl/system/ptruint.html [4] it is
described that PtrUInt is an alias to DWord. However, it depends on the
architecture which type it actually is. Could someone please correct the
docs? 

TIA 

Regards, Darius 

On 1 okt '12, Tomas Hajny wrote: 

> On
Mon, October 1, 2012 10:43, dhkblas...@zeelandnet.nl [1]wrote:
> 
>
Hi,
> 
>> I want to ask if casting an integer to a pointer is valid over
all platforms. See below: p: PInteger; v: longint; [...] v := 4235423; p
:= PInteger(v); Of course, the value of the pointer adress may vary, but
in general is this a valid way to assign a pointer? Or will some
platforms or architecture give problems?
> 
> Use PtrInt (signed) or
PtrUInt (unsigned) types instead of longint, etc.
> The former two are
guaranteed to work for all architectures and platforms.
> Your
particular example fails on all 64-bit architectures (among others)
>
immediately.
> 
> Tomas
> 
>
___
> fpc-pascal maillist -
fpc-pascal@lists.freepascal.org [2]
>
http://lists.freepascal.org/mailman/listinfo/fpc-pascal [3]

 


Links:
--
[1] mailto:dhkblas...@zeelandnet.nl
[2]
mailto:fpc-pascal@lists.freepascal.org
[3]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[4]
http://www.freepascal.org/docs-html/rtl/system/ptruint.html
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Problem compiling

2012-08-05 Thread dhkblaszyk
  

Hi, 

I get: 

text.inc(199,34) Error: Illegal type conversion:
"Text" to "TextRec" 

after updating the compiler sources from SVN.


Free Pascal Compiler version 2.7.1 [2012/05/22] for i386 

Anyone have
an idea what could be wrong? 

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

Re: [fpc-pascal] Converting from seconds to TTime: easiest way?

2012-06-20 Thread dhkblaszyk
  

Try 

MyTTime := HugeNumberOfSecondsInteger / (3600 * 24); 

On 20
jun '12, Reinier Olislagers wrote: 

> Morning list,
> 
> I'm trying to
convert a large number of seconds to a TTime.
> 
> To my surprise -
without a Delphi background ;) - EncodeTime only takes
> up to 59
seconds... ;)
> Same for EncodeTimeInterval
> 
> So I ended up with
something like:
> 
> IncSecond(EncodeTime(0,0,0,0),
HugeNumberOfSecondsInteger);
> 
> is this the best way to do this or is
there some smarter way I've missed?
> 
> Thanks,
> Reinier
>
___
> fpc-pascal maillist -
fpc-pascal@lists.freepascal.org [1]
>
http://lists.freepascal.org/mailman/listinfo/fpc-pascal [2]

 


Links:
--
[1] mailto:fpc-pascal@lists.freepascal.org
[2]
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] Parameters to Format()

2012-05-25 Thread dhkblaszyk
  

You should do: 

type 

 MyVarArray = array of variant; 

and then


procedure TUnyokedFrontendForm.OutputWriteF(const str: widestring;

values: MyVarArray; fg: TColor= clBlack; bg: TColor= clDefault);


Darius 

On 25 mei '12, Mark Morgan Lloyd wrote: 

> How should I put
this?
> 
> procedure TUnyokedFrontendForm.OutputWriteF(const str:
widestring; 
> values: array of variant; fg: TColor= clBlack; bg:
TColor= clDefault);
> 
> var scratch: widestring;
> 
> begin
> scratch
:= Format(str, values);
> 
> As above, I get
> 
>
unyokedfrontendcode.pas(354,32) Error: Incompatible type for arg no. 2:

> Got "Open Array Of Variant", expected "Array Of Const"
> 
> I was
caught by this one years ago, and at the time the Delphi 
> developers I
was in contact with had no easy solution.

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

[fpc-pascal] Strange compile error

2012-05-17 Thread dhkblaszyk
  

Hi, 

I have a simple application that uses glut and opencv.
However as soon as I add the opencv wrapper unit to the uses clause I
get: 

video.pp(10,1) Fatal: Syntax error, "UNIT" expected but "PROGRAM"
found 

The compiler does not recognize the main unit anymore. I have
searched the opencv.pas file but I could not find anything strange
there. Has anyone got an idea of what might be happening? 

TIA,
Darius

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

Re: [fpc-pascal] InstantFPC and argv

2012-05-04 Thread dhkblaszyk
  

On 4 mei '12, michael.vancann...@wisa.be wrote: 

> On Fri, 4 May
2012, michael.vancann...@wisa.be [3]wrote:
> 
>> On Fri, 4 May 2012,
dhkblas...@zeelandnet.nl [1]wrote: 
>> 
>>> I'm creating a script to be
executed by instantfpc when I noticed that paramstr(0) does not reflect
the location of the script but the location of the cached executable. Is
there a way to alter this location programatically to the script
location? Is there an alternative way?
>> The solution can be found on
http://www.freepascal.org/docs-html/prog/progsu38.html [2] Const
ScriptName = {$INCLUDE FILE};
> 
> Come to think of it, probably not
100% what you want. 
> It will contain the name of the temporary script
file.
> 
> Michael.
> ___
>
fpc-pascal maillist - fpc-pascal@lists.freepascal.org [4]
>
http://lists.freepascal.org/mailman/listinfo/fpc-pascal [5]

Indeed,
it's not. ScriptName will contain "configure.ppx.pas". What I want it
that ParamStr(0) will contain the full filename to the script file
instead of the compiled version. This should be the default behaviour
imho b ecause it's an "executable" script and not a source file anymore.


Regards, Darius 

  

Links:
--
[1]
mailto:dhkblas...@zeelandnet.nl
[2]
http://www.freepascal.org/docs-html/prog/progsu38.html
[3]
mailto:michael.vancann...@wisa.be
[4]
mailto:fpc-pascal@lists.freepascal.org
[5]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] InstantFPC and argv

2012-05-04 Thread dhkblaszyk
  

I'm creating a script to be executed by instantfpc when I noticed
that paramstr(0) does not reflect the location of the script but the
location of the cached executable. Is there a way to alter this location
programatically to the script location? Is there an alternative way?


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

Re: [fpc-pascal] c to pascal converters

2012-05-03 Thread dhkblaszyk
  

c2pas32 often gives acceptable results. 

On 3 mei '12,
mar...@stack.nl wrote: 

> Hello,
> 
> I'm in the process of converting
an old MSVC6 application to FPC/Delphi,
> so I'm thinking about using a
c to pascal converter.
> 
> The code is older 6-10kloc, and is plain C
in a MFC C++ framework. It does
> nothing but processing samples (array
handling and transformation), and
> drawing a graph of it. There are
some more I/O related tasks, but they don't
> need to be converted
because of changing hardware.
> 
> A converter would preferably convert
method bodies (copy and past to new
> file no problem) to Pascal.
> 
>
The code is fairly straightforward but uses a lot of in-code variable
>
declarations (often arrays) and a lot of for loops that are not of the
>
standard form. 
> 
> I'm mostly only interested in getting the relevant
for and while loops
> converted without too much trouble. 
> 
> I tried
two things on the net (Al Gun's c2pas and an older simtel one) and
>
they are mostly based on substitution and worse, they do these
substitions
> indiscriminately. (e.g. they do statement like
substitutions in for()
> expressions)
> 
> Something that just do grunt
work, but leaves code alone when in doubt would
> already be progress.
>

> Does anybody have good experiences with this or the other converter?
(e.g.
> for the softfpu units of FPC)
> 
> Marco
>
___
> fpc-pascal maillist -
fpc-pascal@lists.freepascal.org [1]
>
http://lists.freepascal.org/mailman/listinfo/fpc-pascal [2]

 


Links:
--
[1] mailto:fpc-pascal@lists.freepascal.org
[2]
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] Re: Problems with assigning pointers

2012-04-11 Thread dhkblaszyk
  

Hi Sven en Vincent, 

Thanks for your hints. Indeed the dynamic
array was the problem. I have now replaced it by a linked list of
verts/edges/faces. It now works perfectly. 

Regards, Darius 

On 11 apr
'12, Sven Barth wrote: 

> Am 10.04.2012 22:16, schrieb Vincent
Snijders:
> 
>> Op 10 april 2012 22:06 heeft Darius Blaszyk het volgende
geschreven: 
>> 
>>> Here's a minimal example that has the bug. First of
all the first output is wrong as it says 0,50 instead of 20,50 (so the x
item is overwritten). The second printed output differs from the first,
so again the x item is overwritten. I'm clueless. program test; {$mode
objfpc}{$H+} type TVertex = record x: double; y: double; end; PVertex =
^TVertex; TEdge = record v1: PVertex; v2: PVertex; end; var vert_count:
integer = 0; vert_list: array of TVertex; edge_count: integer = 0;
edge_list: array of TEdge; function add_vert(x, y: double): PVertex;
begin Inc(vert_count); SetLength(vert_list, vert_count);
vert_list[vert_count - 1].x := x; vert_list[vert_count - 1].y := y;
Result := @vert_list[vert_count - 1];
>> I think this is not correct. If
you increase the size of vert_list, then the array may be relocated and
Result isn't a valid pointer anymore.
> 
> This is indeed the problem.
>

>>> end; procedure add_edge(v1, v2: PVertex); begin Inc(edge_count);
SetLength(edge_list, edge_count); WriteLn(v1^.x,' ',v1^.y); // this
edge_list[edge_count - 1].v1 := v1; WriteLn(v1^.x,' ',v1^.y); // outputs
the same thing as this edge_list[edge_count - 1].v2 := v2; end; var v1:
PVertex; v2: PVertex; begin v1 := add_vert(20, 50); v2 := add_vert(220,
50);
> 
> Your pointer to v1 is already invalid here, because the second

> "add_vert" already changed the location of the array and thus the new

> pointer locations are also different.
> add_edge(v1, v2); readln;
end. 
> 
>> "TVertex". You then need to do a "New(Result)" in your
"add_vertex" function and add that "Result" to the enlarged array.
Similiary you'll need to do a
> " in some "remove_vertex" procedure.
Regards, Sven ___ fpc-pascal
maillist - fpc-pascal@lists.freepascal.org [2]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal [3]

 


Links:
--
[1] mailto:dhkblas...@zeelandnet.nl
[2]
mailto:fpc-pascal@lists.freepascal.org
[3]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Problems with assigning pointers

2012-04-10 Thread dhkblaszyk
  

I have some issues when assigning a pointer to a pointer variable.
Consider this: 

 TVertex = record
 x: double;
 y: double;
 end;

PVertex = ^TVertex; 

 TEdge = record
 v1: PVertex;
 v2: PVertex;
 end; 


I have assigned a value to a vertex variable. In my code I have an
array of TEdge. When I try to assign a vertex to the edge element in the
array the x value suddenly is changed to 3e-308 (or something similar).
I don't understand why, perhaps someone could help me to figure this
out.The code I'm using to assign the value is shown below. To my
knowledge assigning a pointer this way is perfectly legal not?


procedure add_edge(v1, v2: PVertex);
begin
 inc(edge_count);

SetLength(edge_list, edge_count); 

 edge_list[edge_count - 1].v1 := v1;
//___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Looking for NSOpenGLView example

2012-04-10 Thread dhkblaszyk
  

Hi, 

I'm looking for an example of how to use NSOpenGLView. I
would like to create a "native" opengl window on Mac. Sofar I have found
only some snippets but nothing that actually shows how to setup and use
a native window. I will prepare a demo app so it can be included in the
examples of the cocoaint package for any future users. 

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

Re: [fpc-pascal] Group arguments from overloaded functions in fpdoc

2012-01-06 Thread dhkblaszyk
> In our previous episode, dhkblas...@zeelandnet.nl said:
>> > See also
>> > http://bugs.freepascal.org/view.php?id=14843
>> >
>> Could XML attributes be used to distinguish overloaded functions? eg
>>  
>> boolean result
>> integer result
>>   
>>
>> It should be relatively easy to implement I presume, not break any
>> existing documentation and it would solve the overload problem.
>
> The result-type is not enough to disambiguate overloaded versions. You
> would
> need a full signature.

You're right. We could calculate the checksum of the function declaration
section and use that as a unique identifier.

Darius

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


Re: [fpc-pascal] Group arguments from overloaded functions in fpdoc

2012-01-06 Thread dhkblaszyk
> In our previous episode, michael.vancann...@wisa.be said:
>> >> On a side note,
>> >>
>> >> 1) for overloaded functions it seems
>> > that only one result string is possible to define. As seen in the XML
>> > file:(no desitinction based on result type)
>>
>> Correct.
>
> See also
> http://bugs.freepascal.org/view.php?id=14843
>
Could XML attributes be used to distinguish overloaded functions? eg
 
boolean result
integer result
  

It should be relatively easy to implement I presume, not break any
existing documentation and it would solve the overload problem.

Regards, Darius

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


Re: [fpc-pascal] Group arguments from overloaded functions in fpdoc

2012-01-05 Thread dhkblaszyk
  

Resending the email. The images are here:


http://imagebin.org/192019 [3] 

http://imagebin.org/192020 [4]


http://imagebin.org/192021 [5] 

On 6 jan '12,
dhkblas...@zeelandnet.nl wrote: 

> I checked doxygen
(http://www.stack.nl/~dimitri/doxygen/examples/overload/html/class_test.html#a8e7b46ceaf7bd2ab94114b390b3288ca
[1]), but it does not seem to list the variables. Pasdoc does not seem
to group overloaded functions, but rather list them separate in a table
(http://pasdoc.sourceforge.net/autodoc/html/PasDoc_Gen.TDocGenerator.html#WriteConverted
[2]) 
> 
> On a side note, 
> 
> 1) for overloaded functions it seems
that only one result string is possible to define. As seen in the XML
file:(no desitinction based on result type) 
> 
> 2) string variables or
result types do not show in my documentation (as do more complex result
types as arrays, please look to the screenshots) seems to be a bug?? 
>

> Anyway, I have created a mockup for a slightly modified result from
fpdoc as seen in the screenshots. What has changed: 
> 
> 1) All
arguments are mixed into one table 
> 
> 2) The result types are also
put in a result table (needs modification in the XML as described above)

> 
> 3) initialized variables (style: integer = 0) are automatically
added to the description eg (default = 0) 
> 
> A second mockup adds the
argument and result type description as "comments" to the declaration
section. This eliminates the need to have a variable section completely.
It also adds the possibility to add different comments per overloaded
function even on variable level. Personally I like the comments approach
as it makes the documentation page nice and compact. 
> 
> Regards,
Darius 
> 
>>> When you have overloaded functions, fpdoc will group them
on one page. The arguments however are listed in two separate arguments
sections. It would be nice to have the arguments merged in one section.
I do not know how to display the arguments though (no idea what others
do like pasdoc or doxygen). Should only the unique arguments be shown
(perhaps sorted alphabetically?), should there be a table with arguments
per overloaded function?
>> 
>> It is already a table.
>> 
>>> More
importantly, would a patch of this sort be approved? Can the authorities
comment on this please? ;-)
>> 
>> If you find a nice solution: Of
course. Maybe a single table will be more clear. Function results may be
more difficult: Function A(b) : C; Function A(d) : E; But I agree that
the current situation is not ideal.

  

Links:
--
[1]
http://www.stack.nl/~dimitri/doxygen/examples/overload/html/class_test.html#a8e7b46ceaf7bd2ab94114b390b3288ca
[2]
http://pasdoc.sourceforge.net/autodoc/html/PasDoc_Gen.TDocGenerator.html#WriteConverted
[3]
http://imagebin.org/192019
[4] http://imagebin.org/192020
[5]
http://imagebin.org/192021
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Group arguments from overloaded functions in fpdoc

2012-01-05 Thread dhkblaszyk
  

Resending the email. The images are here:


http://imagebin.org/192019 [3] 

http://imagebin.org/192020 [4]


http://imagebin.org/192021 [5] 

On 6 jan '12,
dhkblas...@zeelandnet.nl wrote: 

> I checked doxygen
(http://www.stack.nl/~dimitri/doxygen/examples/overload/html/class_test.html#a8e7b46ceaf7bd2ab94114b390b3288ca
[1]), but it does not seem to list the variables. Pasdoc does not seem
to group overloaded functions, but rather list them separate in a table
(http://pasdoc.sourceforge.net/autodoc/html/PasDoc_Gen.TDocGenerator.html#WriteConverted
[2]) 
> 
> On a side note, 
> 
> 1) for overloaded functions it seems
that only one result string is possible to define. As seen in the XML
file:(no desitinction based on result type) 
> 
> 2) string variables or
result types do not show in my documentation (as do more complex result
types as arrays, please look to the screenshots) seems to be a bug?? 
>

> Anyway, I have created a mockup for a slightly modified result from
fpdoc as seen in the screenshots. What has changed: 
> 
> 1) All
arguments are mixed into one table 
> 
> 2) The result types are also
put in a result table (needs modification in the XML as described above)

> 
> 3) initialized variables (style: integer = 0) are automatically
added to the description eg (default = 0) 
> 
> A second mockup adds the
argument and result type description as "comments" to the declaration
section. This eliminates the need to have a variable section completely.
It also adds the possibility to add different comments per overloaded
function even on variable level. Personally I like the comments approach
as it makes the documentation page nice and compact. 
> 
> Regards,
Darius 
> 
>>> When you have overloaded functions, fpdoc will group them
on one page. The arguments however are listed in two separate arguments
sections. It would be nice to have the arguments merged in one section.
I do not know how to display the arguments though (no idea what others
do like pasdoc or doxygen). Should only the unique arguments be shown
(perhaps sorted alphabetically?), should there be a table with arguments
per overloaded function?
>> 
>> It is already a table.
>> 
>>> More
importantly, would a patch of this sort be approved? Can the authorities
comment on this please? ;-)
>> 
>> If you find a nice solution: Of
course. Maybe a single table will be more clear. Function results may be
more difficult: Function A(b) : C; Function A(d) : E; But I agree that
the current situation is not ideal.

  

Links:
--
[1]
http://www.stack.nl/~dimitri/doxygen/examples/overload/html/class_test.html#a8e7b46ceaf7bd2ab94114b390b3288ca
[2]
http://pasdoc.sourceforge.net/autodoc/html/PasDoc_Gen.TDocGenerator.html#WriteConverted
[3]
http://imagebin.org/192019
[4] http://imagebin.org/192020
[5]
http://imagebin.org/192021
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Group arguments from overloaded functions in fpdoc

2012-01-05 Thread dhkblaszyk


When you have overloaded functions, fpdoc will group them on one page. The arguments however are listed in two separate arguments sections. It would be nice to have the arguments merged in one section. I do not know how to display the arguments though (no idea what others do like pasdoc or doxygen). Should only the unique arguments be shown (perhaps sorted alphabetically?), should there be a table with arguments per overloaded function?
More importantly, would a patch of this sort be approved? Can the authorities comment on this please? 
 
Regards, Darius
 

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

Re: [fpc-pascal] FPDoc visibility sections

2012-01-04 Thread dhkblaszyk
  

I filed the report here:
http://bugs.freepascal.org/view.php?id=21022 [4] 

BTW, it think it has
to do with overloaded methods. Whenever fpdoc encounters such methods it
will enclose them in visibility directives. 

Regards, Darius 

On 4 jan
'12, Michael Van Canneyt wrote: 

> On Wed, 4 Jan 2012,
dhkblas...@zeelandnet.nl [3]wrote:
> 
>> Found some strange behaviour
imho. For some reason there are extra visibility sections inserted in my
documentation, instead of following the source. I expected fpdoc to
respect the visibility directives instead of deciding autonomously when
to place one. See for example:
documentation:http://lazarus-ccr.svn.sourceforge.net/viewvc/lazarus-ccr/components/nvidia-widgets/doc/nvwidgets/uicontext.html
[1] sources (starting from line 209):
http://lazarus-ccr.svn.sourceforge.net/viewvc/lazarus-ccr/components/nvidia-widgets/src/nvwidgets/nvWidgets.pas?revision=2227&view=markup
[2] Is there a way to manage this behaviour?
> 
> No. It's a bug.
> 
>
Please enter a bug report, and post a sample unit and description
file.
> 
> Michael.

  

Links:
--
[1]
http://lazarus-ccr.svn.sourceforge.net/viewvc/lazarus-ccr/components/nvidia-widgets/doc/nvwidgets/uicontext.html
[2]
http://lazarus-ccr.svn.sourceforge.net/viewvc/lazarus-ccr/components/nvidia-widgets/src/nvwidgets/nvWidgets.pas?revision=2227|+|amp|+|view=markup
[3]
mailto:dhkblas...@zeelandnet.nl
[4]
http://bugs.freepascal.org/view.php?id=21022
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] FPDoc visibility sections

2012-01-04 Thread dhkblaszyk
  

Found some strange behaviour imho. For some reason there are extra
visibility sections inserted in my documentation, instead of following
the source. I expected fpdoc to respect the visibility directives
instead of deciding autonomously when to place one. 

See for example:


documentation:http://lazarus-ccr.svn.sourceforge.net/viewvc/lazarus-ccr/components/nvidia-widgets/doc/nvwidgets/uicontext.html
[1] 

sources (starting from line 209):
http://lazarus-ccr.svn.sourceforge.net/viewvc/lazarus-ccr/components/nvidia-widgets/src/nvwidgets/nvWidgets.pas?revision=2227&view=markup
[2] 

Is there a way to manage this behaviour? 

Regards, Darius


Links:
--
[1]
http://lazarus-ccr.svn.sourceforge.net/viewvc/lazarus-ccr/components/nvidia-widgets/doc/nvwidgets/uicontext.html
[2]
http://lazarus-ccr.svn.sourceforge.net/viewvc/lazarus-ccr/components/nvidia-widgets/src/nvwidgets/nvWidgets.pas?revision=2227|+|amp|+|view=markup
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Problems with fpdoc

2012-01-02 Thread dhkblaszyk
  

Thanks for the help. After also re-reading the documentation I now
better understand how to use fpdoc. No more error messages anymore


However, including an image in the documentation does not work
unfortunately. After generating the chm file the image is not shown and
an alternative text is displayed. 

At line 244 of this file:
http://lazarus-ccr.svn.sourceforge.net/viewvc/lazarus-ccr/components/nvidia-widgets/doc/nvwidgets.xml?revision=2215&view=markup
[8] 

you can see the syntax. The image (nvwidgets.png) is located in
the same directory as the .xml file is and from where the chm file is
generated from. 

All relevant files and scripts are in SVN. 

Regards,
Darius 

On 2 jan '12, michael.vancann...@wisa.be wrote: 

> On Mon, 2
Jan 2012, dhkblas...@zeelandnet.nl [5]wrote:
> 
>> Here's the xml file.
See attached. The problem code is around line 235.
> 
> With Strings do
For i:=Count-1 downto 0 do Delete(i); 
> 
> Is wrong. the tag must be at
the same level as a
> 
> tag, and cannot appear in a 
> 
> tag. It
should be 
> 
> some text 
> 
> With Strings do For i:=Count-1 downto 0
do Delete(i); 
> 
> more text 
> 
> Michael. 
> 
>> As for the img tag,
thanks for that, i'll start using it. Regards, Darius On 2 jan '12,
michael.vancann...@wisa.be [1]wrote:On Mon, 2 Jan 2012,
dhkblas...@zeelandnet.nl [2][1]wrote: 
>> 
 Hi, I seem
>> to have
some problems using fpdoc in combination with html tags. When I enter
some text (taken from the documentation) I get compilation errors: Text
used: With Strings do For i:=Count-1 downto 0 do Delete(i); Compilation
errors: [] Invalid description (illegal XML element: "#text") [] Invalid
paragraph content [] Invalid description (illegal XML element: "#text")
If I drop the tags, I still get compilation errors (just not the 2nd
one) but to my surprise the pascal code is shown in the .chm file.
However any text after this code section is ignored. So my question is,
how am I supposed to use html tags inside the documentation? Is there a
special switch needed? 
>> 
>>> Can you post the
>> actual XML you used
in a separate mail ? Because the above is useless, I just see plain
text. I'm using: 2.7.1 [2011/12/27] for i386 On a side note, I would
like to include image
>> 
>>> chm file? Yes, an 'img' tag exists. This
is
>> umented. It does NOT use the HTML syntax, though. Michael.
___
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>> 
>>> 
> 
>
___ fpc-pascal maillist -
fpc-pascal@lists.freepascal.org [6]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal [7]

 


Links:
--
[1] mailto:michael.vancann...@wisa.be
[2]
mailto:dhkblas...@zeelandnet.nl
[3]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[4]
mailto:dhkblas...@zeelandnet.nl
[5] mailto:dhkblas...@zeelandnet.nl
[6]
mailto:fpc-pascal@lists.freepascal.org
[7]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[8]
http://lazarus-ccr.svn.sourceforge.net/viewvc/lazarus-ccr/components/nvidia-widgets/doc/nvwidgets.xml?revision=2215|+|amp|+|view=markup
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Problems with fpdoc

2012-01-02 Thread dhkblaszyk
  

Hi, 

I seem to have some problems using fpdoc in combination with
html tags. When I enter some text (taken from the documentation) I get
compilation errors: 

Text used: 

With Strings do 
 For i:=Count-1
downto 0 do 
 Delete(i); 

Compilation errors: 
[] Invalid description
(illegal XML element: "#text")
[] Invalid paragraph content
[] Invalid
description (illegal XML element: "#text") 

If I drop the  tags, I
still get compilation errors (just not the 2nd one) but to my surprise
the pascal code is shown in the .chm file. However any text after this
code section is ignored. So my question is, how am I supposed to use
html tags inside the documentation? Is there a special switch needed?


I'm using: 2.7.1 [2011/12/27] for i386 

On a side note, I would like
to include images in my documentation. How to do this? Is simply putting
a  tag enough and will these links be embedded in the chm file?


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

Re: [fpc-pascal] Contributed units on freepascal site

2011-12-22 Thread dhkblaszyk
  

On 22 dec '11, Jonas Maebe wrote: 

> On 22 Dec 2011, at 14:37,
dhkblas...@zeelandnet.nl [1]wrote:
> 
>> The contributed unit section on
the freepascal site does not work anymore. Can someone please have a
look and fix this? Is there an alternative link available?
> 
> The
location of the page changed, and there's an "alternative" link
available on the front page of http://www.freepascal.org [2] under
"Contributed units".

Well, that is exactly the link I'm talking about.
Clicking on this link will open an new page, the title is shown, but no
information. The browser shows an error occurred on the page. 

Webpage
error details 

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows
NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET
CLR 3.5.30729; .NET4.0C; .NET4.0E; .NET CLR 1.1.4322;
InfoPath.2)
Timestamp: Thu, 22 Dec 2011 13:52:30 UTC 

Message: Expected
identifier, string or number
Line: 365
Char: 7
Code: 0
URI:
http://www.freepascal.org/contrib/contribs.js [3] 

Message: 'fpWeb' is
undefined
Line: 23
Char: 5
Code: 0
URI:
http://www.freepascal.org/contrib/contribs.html [4] 

Regards, Darius 
 


Links:
--
[1] mailto:dhkblas...@zeelandnet.nl
[2]
http://www.freepascal.org
[3]
http://www.freepascal.org/contrib/contribs.js
[4]
http://www.freepascal.org/contrib/contribs.html
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Contributed units on freepascal site

2011-12-22 Thread dhkblaszyk
  

The contributed unit section on the freepascal site does not work
anymore. Can someone please have a look and fix this? Is there an
alternative link available? 

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

Re: [fpc-pascal] Memory leak

2011-12-18 Thread dhkblaszyk
  

On 18 dec '11, Jonas Maebe wrote: 

> If you use freemem or
reallocmem, then you will get a memory leak because freemem/reallocmem
do not finalize the memory before freeing it. You have to manually call
finalize() on the records inside that memory block prior to freeing them
via freemem/reallocmem. dispose on the other hand will finalize the
freed memory automatically.

I searched the documentation. Are finalize
and initialize documented at all? 

Regards, Darius 

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

Re: [fpc-pascal] Memory leak

2011-12-18 Thread dhkblaszyk
  

On 18 dec '11, Jonas Maebe wrote: 

> On 18 Dec 2011, at 15:45,
dhkblas...@zeelandnet.nl [1]wrote:
> 
>> It was an ansistring indeed,
and finalize did the trick! Thanks for your help. How does New and
Dispose work btw? Do they use RTTI to call finalize appropriatly?
> 
>
Yes.
> 
>> I tried searching the New and Dispose implementations in the
RTL sources, but I just could not find them. What unit are they in?
> 
>
They are compiler internals. The compiler translates them into an
appropriate combination of getmem/initialize or
finalize/freemem.

Thanks Jonas, that makes things more clear for me.


Regards, Darius 

  

Links:
--
[1]
mailto:dhkblas...@zeelandnet.nl
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Memory leak

2011-12-18 Thread dhkblaszyk
  

On 18 dec '11, Jonas Maebe wrote: 

> On 18 Dec 2011, at 14:04,
dhkblas...@zeelandnet.nl [1]wrote:
> 
>> mytest^.name :=
Format('%s.%.3d', ['name', 1]); This assigns 'name.001' to the pointer
variable but causes a memleak. If I assign the same value as string
constant no memleak occurs, so it must be something related to format.
>

> It's related to
> a) the type of "name" (I assume it's an ansistring
or unicodestring)
> b) how you free the memory to which mytest points
>

> If you use freemem or reallocmem, then you will get a memory leak
because freemem/reallocmem do not finalize the memory before freeing it.
You have to manually call finalize() on the records inside that memory
block prior to freeing them via freemem/reallocmem. dispose on the other
hand will finalize the freed memory automatically.
> 
>
Jonas___
> fpc-pascal
maillist - fpc-pascal@lists.freepascal.org [2]
>
http://lists.freepascal.org/mailman/listinfo/fpc-pascal [3]

It was an
ansistring indeed, and finalize did the trick! Thanks for your help. How
does New and Dispose work btw? Do they use RTTI to call finalize
appropriatly? I tried searching the New and Dispose implementations in
the RTL sources, but I just could not find them. What unit are they in?


Regards, Darius 

Links:
--
[1]
mailto:dhkblas...@zeelandnet.nl
[2]
mailto:fpc-pascal@lists.freepascal.org
[3]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] Memory leak

2011-12-18 Thread dhkblaszyk
  

While dabbling with pointers, I came across a memleak for which I
don't understand why it happens. Hopefully someone can help me with it.


mytest^.name := Format('%s.%.3d', ['name', 1]); 

This assigns
'name.001' to the pointer variable but causes a memleak. If I assign the
same value as string constant no memleak occurs, so it must be something
related to format. 

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

Re: [fpc-pascal] initializing pointer values

2011-12-16 Thread dhkblaszyk
  

On 16 dec '11, Michael Van Canneyt wrote: 

> On Fri, 16 Dec 2011,
dhkblas...@zeelandnet.nl [1]wrote:
> 
>> On implementing a linked list I
hit to some unexpected (doesn't mean incorrect though) behaviour. ptest
= ^test; test = record p: pointer; end; new(mytest); When I allocate
"mytest" the pointer variable "p" is initialized as $ instead of
nil as I did suspect. In my code though I am relying on the fact that
new pointers are indeed nil so I can allocate them accordingly. How can
I force and rely on the fact that p is always nil? What is the correct
procedure here?
> 
> Newly allocated memory is never zeroed out. You
must do this manually with FillChar or FillWord.
> This is only done
automatically for class instances.
> 
> I will add a note to the docs.
>

> Michael.

I wasn't sure about this, but now I know. 

Thanks Michael.


  

Links:
--
[1] mailto:dhkblas...@zeelandnet.nl
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

[fpc-pascal] initializing pointer values

2011-12-16 Thread dhkblaszyk
  

On implementing a linked list I hit to some unexpected (doesn't
mean incorrect though) behaviour. 

 ptest = ^test;
 test = record
 p:
pointer;
 end; 

 new(mytest); 

When I allocate "mytest" the pointer
variable "p" is initialized as $ instead of nil as I did
suspect. In my code though I am relying on the fact that new pointers
are indeed nil so I can allocate them accordingly. How can I force and
rely on the fact that p is always nil? What is the correct procedure
here? 

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

[fpc-pascal] HDR imaging

2011-09-27 Thread dhkblaszyk
   ZeelandNet Webmail   

Has anyone ever used HDR images in a
freepascal application. I'm looking for a native library or a binding to
a lib eg OpenEXR.

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

[fpc-pascal] Virtual inline methods

2011-08-18 Thread dhkblaszyk
   ZeelandNet Webmail   

I'm porting a piece of code from C++ and
there they use virtual inline methods. I tried it in FPC but it accepts
either virtual OR inline methods. Is this a bug, or a feature that I
don't understand enough about?

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

Re: [fpc-pascal] Quitting simplehttpserver

2011-08-10 Thread dhkblaszyk


On Wed, 10 Aug 2011 12:06:15 +0200,  wrote:  
Nevermind, I overlooked
the deactivation code in the example.

Darius

I've been trying the
simplehttpserver and found a problem, but I have no idea what is goiing
on. When I request a page, everything works fine, but when I try to
request a non existing page and then go back to the existing page, the
server quits. I have tried GDB, but I get no backtrace at all. Also
heaptrace does not show any unfreed memory, which indicates the server
has quit nicely and tidied up everything. Is this a known issue? I would
say it's a bug, but maybe I'm missing something here.

Regards, Darius


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

[fpc-pascal] Quitting simplehttpserver

2011-08-10 Thread dhkblaszyk
   ZeelandNet Webmail   
I've been trying the simplehttpserver and
found a problem, but I have no idea what is goiing on. When I request a
page, everything works fine, but when I try to request a non existing
page and then go back to the existing page, the server quits. I have
tried GDB, but I get no backtrace at all. Also heaptrace does not show
any unfreed memory, which indicates the server has quit nicely and
tidied up everything. Is this a known issue? I would say it's a bug, but
maybe I'm missing something here.

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

Re: [fpc-pascal] Platform independent alternatives

2011-06-23 Thread dhkblaszyk
On Thu, 23 Jun 2011 15:38:18 -0300, Flávio Etrusco 
 wrote:

On Thu, Jun 23, 2011 at 3:18 PM,   wrote:

Hi,

I'm porting an app from Delphi to Lazarus when I came across a 
couple of
functions from the windows unit. Can anyone help me finding the 
platform

independent alternatives?

TerminateThread


You shouldn't use it, generally speaking.


You're right, I rewrote it so it doesn't use threads anymore. Thanks 
anyway.


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


[fpc-pascal] Platform independent alternatives

2011-06-23 Thread dhkblaszyk
   ZeelandNet Webmail   Hi,

I'm porting an app from Delphi to Lazarus
when I came across a couple of functions from the windows unit. Can
anyone help me finding the platform independent
alternatives?

TerminateThread
WaitForSingleObject
CloseHandle

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

Re: [fpc-pascal] Re: better understanding of fpdoc

2011-05-20 Thread dhkblaszyk

3. How can I "compile" fpDoc using fppkg ?


no idea.


fppkg does not compile anything, fpmake does. See: 
http://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg20238.html


Though the report is not closed, the patch was comitted.

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


Re: Re: [fpc-pascal] accessing files from a function

2011-05-16 Thread dhkblaszyk


On Mon, 16 May 2011 10:28:19 +, johnelee1...@googlemail.com
wrote:  

> thanks all - btw it wasn't the real code just an example I
made up , the while loop wasn't needed- mistake! 
>
>But the q still
remains - having three functions would still give the problem I have
now- that when doing a file_read (my function flag=1) would say 'file
not open' because the handles are volatile & local to file reset - >that
was the point of my original email. Seems as if there is no solution?

>John

Of course there is. As was stated earlier you need to make the
filehandle a global not a local variable. You could also handle it
differently and use a TStringList instead. 

var
 s: TStrings;

s :=
TStringList.Create;
s.LoadFromFile('MyFile.txt');
//do something with
line 12
writeln(s[12]);
s.Free

Regards, Darius 

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

[fpc-pascal] Message methods

2011-04-19 Thread dhkblaszyk
   ZeelandNet Webmail   Hi,

I'm trying to understand how message
methods work in FPC. For this I created a simple app that shows a
message. I also created a second (identical form) and I expected that
all message methods related to MY_MESSAGE would be executed when I
pressed either one or the other button. This did not happen however even
when dispatching through the Application object. Can someone explain me
please?

Regards, Darius

 TForm1 = class(TForm)
 Button1: TButton;

Button2: TButton;
 procedure Button1Click(Sender: TObject);
 procedure
Button2Click(Sender: TObject);
 procedure MessageReceiver(var msg:
TMsg); message MY_MESSAGE;
 private
 { private declarations }
 public
 {
public declarations }
 end; 

var
 Form1: TForm1; 

implementation 

{$R
*.lfm} 

{ TForm1 } 

procedure TForm1.Button1Click(Sender:
TObject);
begin
 msg.MSGID := MY_MESSAGE;
 msg.Data := 'Hello World!';

Dispatch(msg);
end; 

procedure TForm1.Button2Click(Sender:
TObject);
begin
 Form2.Show;
end; 

procedure TForm1.MessageReceiver(var
msg: TMsg);
begin
 ShowMessage(msg.Data);
end;___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Font reading library

2011-04-12 Thread dhkblaszyk
On Tue, 12 Apr 2011 13:33:35 +0200, Helmut Hartl 
 wrote:

(Have a look at : http://www.freetype.org/freetype1/index.html,
and the name of the authors ...)

What's special with the name of the authors
nothing - but a name compare should have revealed the strong 
indication

that fornix has nothing to do with it (which i cannot comment as i
dont care about fornix anyway)
and that freetype2 originated from freetype1 which was written in
pascal years ago.
(as you already know)
I was mislead by wikipedia: 
http://en.wikipedia.org/w/index.php?title=FreeType&oldid=417331396 which 
lead me to the fornix project. It's not that I own fornix shares or 
somehing ;)


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


[fpc-pascal] Problems with GetMem

2011-04-09 Thread dhkblaszyk
   ZeelandNet Webmail   

I get strange errors when using GetMem. In my
app I keep on allocating and freeing memory in a variable. At a certain
moment I do keep getting a SIGSEGV on the GetMem call when trying to
allocate exactly 128bytes. However allocating other sizes seems to work
just fine. Is there some logical explanation what could be going on
here? Is there a way for me to test the cause? I have tried to create a
simple example that reproduces the error but without success, if needed
I will post the entire library source, just wanted to ask first if I
miss something obvious.

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

Re: [fpc-pascal] Font reading library

2011-04-01 Thread dhkblaszyk
On Fri, 1 Apr 2011 18:44:02 +0200 (CEST), Michael Van Canneyt 
 wrote:

On Fri, 1 Apr 2011, Darius Blaszyk wrote:

As it happens, I stumbled across this one just now. Supposedly this 
is a native freetype implementation. I did not check it out yet, so if 
you get to it, please let me know how it works for you. I'm also 
interested in implementing this for you own library.



http://www.koders.com/delphi/fidEAE4D251909342259720229735A9CBF6C74B15AB.aspx?s=delphi+freetype#L40


Hm. It would be good to have this as an alternative to freetype in 
fcl-image.

Is it still maintained ?


I doubt it. The freetype library originates from here: 
http://sourceforge.net/projects/fornix/ as far as I can tell. The last 
release from this project is already more than 3y old.

But I agree, it would be interesting to have it included.

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


Re: [fpc-pascal] fpGUI powered by OpenGL

2010-12-20 Thread dhkblaszyk

But why is it not possible to integrate this with the regular fpGUI ?
Can you explain in a couple of sentences ?


Can't remember having said that it was impossible with the current 
approach. In fact it is perfectly doable. However (free)glut and opengl 
are already available on a large number of platforms/targets. So if 
fpGUI is built upon these libs then you immediately take the benefit of 
being able to support these platforms. Additionally you don't have to 
implement a "complex" interface between the different platforms this is 
handled already by glut and opengl for you. So in effect it could make 
fpGUI simpler. And the last plus is having a hardware accelerated gui. 
It just means it's lightning fast and that's a plus for UI's.
Thats not all however, there are minusses. By using glut, you limit 
yourself to the supported platforms/targets. So if new platforms/targets 
come along then there is no way (unless you supply patches to the 
project) to add them. With the current approach you're free to do it 
yourself. Also the API is plain rigid. This means you'll have to adapt 
to that and live with it (notice it's a plus and minus depending on how 
you look at it). (That is why I would like to see a fpGlut some day ;) 
and believe me it will come to that eventually!)


I probably forgot a few plusses and minusses, but that's about it as 
far as I'm concerned. Also I don't mean to say that using an opengl/glut 
backend is superior to the current ones. It just has other benefits I 
suppose.


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


Re: [fpc-pascal] Re: fpGUI powered by OpenGL

2010-12-20 Thread dhkblaszyk
On Mon, 20 Dec 2010 04:51:52 -0800 (PST), leledumbo 
 wrote:

Nice :)
We could benefit from hardware accelerated OpenGL graphics with this. 
Have

you implemented all the required low level backend?


No not yet. I have only done the absolute minimum sofar. Yesterday I 
got u bunch of widgets running, but the drawing was not correct. Also no 
events (apart from the drawing wich I hacked together) are fired 
correctly anymore. But al this is fixable, be it that it will most 
likely not fit the current implementation.


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


Re: [fpc-pascal] Unexpected duplicate identifiers

2008-12-22 Thread dhkblaszyk
> I've got a class that looks in part like this:
>
> TTextStore= CLASS(TStringList)
>  PRIVATE
>PROCEDURE NeverSort(sort: BOOLEAN);
>  PUBLIC
>FUNCTION HereDocument(CONST name: STRING; VAR strings:
> TStringList): BOOLEAN;
>PROCEDURE Sort; OVERRIDE;
>
> FPC 2.2.0 is giving me duplicate identifier errors for "sort" and
> "strings" above.
>
> I've got nothing against going through the comparatively small amount of
> code affected but I'm a little mystified as to why this is happening:
> the rather elderly version of Delphi I'm using doesn't object, and I
> don't see why there should be a conflict between the class procedure and
> procedure parameter names.

Add {$mode delphi} to the top of your unit. ObjFPC mode is more strict.

Darius

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


Re: [fpc-pascal] streaming file from zip into my app

2007-11-30 Thread dhkblaszyk
> What de- and encoding is it, are you talking of character sets or
> encryption?

I was referring to compression. It should be trivial to implement, but I
never got around it. So if you have interest and want to patch it please
do, I will apply it.

Darius

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


Re: [fpc-pascal] Capture HeadTrace output to file?

2007-11-30 Thread dhkblaszyk
> [ Charset ISO-8859-1 unsupported, converting... ]
>> Hi,
>>
>> If I compile a project the -gh (Heaptrc unit), how to I capture the
>> output generated when I quite the application to a file?
>>
>>
>> I tried the normal:   $./text > out.log
>>
>> But that doesn't work... the out.log is empty.
>
>   ./something >&  out.log
>
> however units like crt might make this not possible. The exact solution
> for
> that differs with application.

You can also set an environment variable.

http://www.freepascal.org/docs-html/rtl/heaptrc/environment.html

Darius



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


Re: [fpc-pascal] streaming file from zip into my app

2007-11-30 Thread dhkblaszyk
> Hi,
>
> I'd like to unzip one file from a zip archive and use it directly as
> input for something else (sax or self written parser).
>
> Since the unzip package form the "extra" dir only writes to disc files:
>
> Is there any alternative source for writing from zip to a stream instead
> of a file?
>
> Or even better: is any fpc source for extracting the document info from
> Openoffice.org files already written? ;)

Hi Marc,

You can have a look at TZipFile
(http://wiki.lazarus.freepascal.org/ZipFile). The only problem still with
it is that it does not support decoding / encoding. But the basis is there
already.
You can access a zipfile as if it's a filesystem.

Darius


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


Re: [fpc-pascal] streaming file from zip into my app

2007-11-30 Thread dhkblaszyk
> Hi,
>
> I'd like to unzip one file from a zip archive and use it directly as
> input for something else (sax or self written parser).
>
> Since the unzip package form the "extra" dir only writes to disc files:
>
> Is there any alternative source for writing from zip to a stream instead
> of a file?
>
> Or even better: is any fpc source for extracting the document info from
> Openoffice.org files already written? ;)

Hi Marc,

You can have a look at TZipFile
(http://wiki.lazarus.freepascal.org/ZipFile). The only problem still with
it is that it does not support decoding / encoding. But the basis is there
already.
You can access a zipfile as if it's a filesystem.

Darius


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


Re: [fpc-pascal] Duplicating palette of TFPCustomImage

2007-11-01 Thread dhkblaszyk
I found the problem. When using Merge the new palette colors are appended
and with Build the new palette colors are in order of appearance in the
image, which is total nonsense imho. Anyway I've implemented a Copy
function, that makes an exact copy of a supplied palette. Will submit a
patch for it later this evening.

Darius

> Hi,
>
> I'm entering unknown territories with TFPCustomImage. What I would like to
> do is, to duplicate the palette of a loaded image to a newly created image
> in memory. Something like:
>
> NewImg := TFPMemoryImage.Create(OrgImg.Width, OrgImg.Height);
> NewImg.Palette.Build(OrgImg);
>
> I also tried
>
> NewImg.Palette.Merge(OrgImg.Palette);
>
> But both yield image distortions when copying the pixels one by one.
>
> What is the correct way of doing this?
>
> Darius
>
>
>
>
> ___
> 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


[fpc-pascal] Duplicating palette of TFPCustomImage

2007-11-01 Thread dhkblaszyk
Hi,

I'm entering unknown territories with TFPCustomImage. What I would like to
do is, to duplicate the palette of a loaded image to a newly created image
in memory. Something like:

NewImg := TFPMemoryImage.Create(OrgImg.Width, OrgImg.Height);
NewImg.Palette.Build(OrgImg);

I also tried

NewImg.Palette.Merge(OrgImg.Palette);

But both yield image distortions when copying the pixels one by one.

What is the correct way of doing this?

Darius




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


Re: [fpc-pascal] What does this warning mean?

2007-09-12 Thread dhkblaszyk
> Hi All,
>
> "drawing.pp(19,42) Warning: Constructing a class "TFPImageCanvas" with
> abstract methods".
> Thanks!
> jk

For more information:

http://delphibasics.co.uk/RTL.asp?Name=Abstract

Darius

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


Re: [fpc-pascal] Unknown usage of function FixPath

2007-08-14 Thread dhkblaszyk
>> Maybe we can make a TCustomInstaller and TInstaller where the TInstaller
>> will default to install a
>> FPC package (=units) in the default location so the units work
>> out-of-the-box for fppkg and fpc.
>> The TCustomInstaller can be the base for a complete custom installation
>> of independent projects.
>
> Excellent idea !
>
> Michael.

Am I pushing my luck if I propose a TFPCInstaller for FPC? ;)

Darius

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


Re: [fpc-pascal] Unknown usage of function FixPath

2007-08-14 Thread dhkblaszyk
>> 1) why is the colon converted to a slash which yields invalid paths (at
>> least
>> on windows)
>> 2) although fpmake initially was developed to be a make tool for FPC, it
>> can
>> (and will be) used for other projects. Therefore I would propose not to
>> initialize FBaseInstallDir with the FPC directory. But rather raise an
>> exception if the basedir is not set in fpmake.pp (when issued an install
>> command only ofcourse). This will make setting this variable mandatory.
>
> I suggest that we introduce a boolean property in TInstaller:
>   FPCProject
> by default set to True.

Why would you like to initialize BaseInstallDir? It will just increases
the chance of installing the files in the wrong place. Consider a tool in
a project/FPC (which is placed somewhere higher up the tree). If you don't
set the BaseInstall dir it gets placed in c:\program files\whatever, but
the base directory should be c:\program files\projectname\whatever (or
c:\fpc\whatever resp c:\fpc\utils\whatever). The basedir should probably
be set as an env string in any case (whith more complex projects involved)
or just hardcoded (for simple ones). Anyway something up to the developer
to decide and not to fix in fpmkunit.

Just my 2c

Darius

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


Re: [fpc-pascal] Inconsistencies in fpmake?

2007-08-13 Thread dhkblaszyk
>
>
> On Mon, 13 Aug 2007, [EMAIL PROTECTED] wrote:
>
>> >> I was doing some tests with fpmake and came across what appears to be
>> an
>> >> inconsistency.
>> >>
>> >> When fpmaking a program a units/cpu-os is created but the commandline
>> >> parameters for FPC are "-FE." which causes the tool and possible
>> other
>> >> units to be placed in the directory where the program is located.
>> >> When calling "fpmake clean", the clean algorithm cannot find either
>> the
>> >> .ppu/.o or the .exe files as it searches the units directory and not
>> the
>> >> root dir.
>> >>
>> >> I would like to patch this inconsistency, but I am not sure what the
>> >> consensus is on fpmaking tools.
>> >>
>> >> 1) should -FU.units/cpu-os be used, so all compiled stuff is
>> separated
>> >> from the executable which will result in the root dir
>> >> 2) should -FE. be used as it is now, but the units directory not be
>> >> created anymore and the clean algorithm adjusted so it searches the
>> >> right directory?
>> >
>> > Solution 1) needs to be fixed. This is a prerequisite for good
>> > cross-compiling support. Maybe even
>> > the executables need to be placed in a bin/cpu-os directory and
>> symlinked
>> > (or copied) to the
>> > current dir.
>>
>> Sounds like a good idea. Shall I prepare a patch for it?
>>
>> I'm just wondering about the symlink/copy of the executable. Shouldn't
>> that be a task for "fmake install"?
>
> I also think so; I don't think the copy/symlink is necessary; The binary
> should
> simply be outputted in the bin/os-cpu directory.

What compiler switches are preferred? -FE / -FU or -FU / -o? Don't know if
it differs that much. AFAIK Lazarus uses the latter.

> fpmake can write a message like 'Writing binary to bin/os-cpu directory'
> so
> the user knows where to look.

Ofcourse.

Darius

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


Re: [fpc-pascal] Inconsistencies in fpmake?

2007-08-13 Thread dhkblaszyk
>> I was doing some tests with fpmake and came across what appears to be an
>> inconsistency.
>>
>> When fpmaking a program a units/cpu-os is created but the commandline
>> parameters for FPC are "-FE." which causes the tool and possible other
>> units to be placed in the directory where the program is located.
>> When calling "fpmake clean", the clean algorithm cannot find either the
>> .ppu/.o or the .exe files as it searches the units directory and not the
>> root dir.
>>
>> I would like to patch this inconsistency, but I am not sure what the
>> consensus is on fpmaking tools.
>>
>> 1) should -FU.units/cpu-os be used, so all compiled stuff is separated
>> from the executable which will result in the root dir
>> 2) should -FE. be used as it is now, but the units directory not be
>> created anymore and the clean algorithm adjusted so it searches the
>> right directory?
>
> Solution 1) needs to be fixed. This is a prerequisite for good
> cross-compiling support. Maybe even
> the executables need to be placed in a bin/cpu-os directory and symlinked
> (or copied) to the
> current dir.

Sounds like a good idea. Shall I prepare a patch for it?

I'm just wondering about the symlink/copy of the executable. Shouldn't
that be a task for "fmake install"?

Darius

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


[fpc-pascal] strange "with" usage

2007-06-08 Thread dhkblaszyk
In a delphi app I came across the following syntax;

with PropInfo^, PropType^^ do

Which results in a "Error: Illegal qualifier". Has anyone an idea of what
is meant here and how to port that to FPC? I'm puzzled.

Darius

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


Re: [fpc-pascal] fpcUnit todo list

2006-11-09 Thread dhkblaszyk
>> On 09/11/06, Florian Klaempfl <[EMAIL PROTECTED]> wrote:
>>> First, I would prefer a patch to the fpcunit which makes the unit
>>> itself
>>> indenpendend from other stuff (xml) so it can be used in the fpc
>>> test suite :)
>>
>> The xml used is the xmlwriter unit - part of FPC.  Is this a problem?
>
> The problem is that the xml stuff must be built before you can run
> the testsuite with fpcunit tests included (since the fpcunit package
> depends on the xml stuff). This means that before you can start
> running the testsuite, your compiler has to be stable and complete
> enough to compile packages and fcl. That's not reasonable.

Wait a minute But you need a stable enough compiler to compile the
testsuite right? Hmm either you're inconsistent or you plan to test only
the RTL and compiler itself, am I right?

Darius

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


[fpc-pascal] zstream.pp strange dependency?

2006-09-21 Thread dhkblaszyk
I have encountered a strange phenomenon, and I would like to fix it, if it
weren't for the fact that I have no idea why it appears.

So what happened? When using the zstreams.pp unit in a  sample project I
get an error message "Fatal: Can't find unit FPReadPNG". I searched all
sources to find out which one is using the FPReadPNG unit that could be
called in return by any unit coming from zstreams, but no success. I'm
clueless here. Does anyone have a suggestion where to look, or an
explanation why this is happening?

Please note that I've been mixing 2.1.1 sources (zipper and zstream) with
a 2.0.2 and 2.0.4 compiler. I don't expect that this is the cause of this
err message, but perhaps it is.

Below is a list of messages I took from the lazarus messages window.

Darius

Hint: Start of reading config file C:\lazarus\pp\bin\i386-win32\fpc.cfg
Hint: End of reading config file C:\lazarus\pp\bin\i386-win32\fpc.cfg
Free Pascal Compiler version 2.0.2 [2006/05/28] for i386
Copyright (c) 1993-2005 by Florian Klaempfl
Target OS: Win32 for i386
Compiling project1.lpr
Compiling zstream.pp
zstream.pp(125,3) Hint: Local variable "strm" does not seem to be initialized
zstream.pp(140,32) Hint: Conversion between ordinals and pointers is not
portable
zstream.pp(140,51) Hint: Conversion between ordinals and pointers is not
portable
zstream.pp(140,76) Hint: Conversion between ordinals and pointers is not
portable
zstream.pp(140,26) Hint: Conversion between ordinals and pointers is not
portable
zstream.pp(162,11) Hint: Type "PByte" redefinition
zstream.pp(164,3) Hint: Local variable "strm" does not seem to be initialized
zstream.pp(183,32) Hint: Conversion between ordinals and pointers is not
portable
zstream.pp(183,51) Hint: Conversion between ordinals and pointers is not
portable
zstream.pp(183,76) Hint: Conversion between ordinals and pointers is not
portable
zstream.pp(183,26) Hint: Conversion between ordinals and pointers is not
portable
zstream.pp(203,28) Hint: Type size mismatch, possible loss of data / range
check error
zstream.pp(71,23) Hint: Parameter "Buffer" not used
zstream.pp(71,31) Hint: Parameter "Count" not used
zstream.pp(280,34) Hint: Type size mismatch, possible loss of data / range
check error
zstream.pp(346,27) Warning: Mixing signed expressions and longwords gives
a 64bit result
zstream.pp(350,34) Hint: Type size mismatch, possible loss of data / range
check error
zstream.pp(355,20) Warning: Mixing signed expressions and longwords gives
a 64bit result
zstream.pp(87,26) Hint: Parameter "Buffer" not used
zstream.pp(87,34) Hint: Parameter "Count" not used
zstream.pp(382,22) Warning: Mixing signed expressions and longwords gives
a 64bit result
zstream.pp(388,9) Hint: Local variable "Buf" does not seem to be initialized
zstream.pp(1,1) Fatal: Can't find unit FPReadPNG


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


Re: [fpc-pascal] fpcUnit testing Exceptions

2006-07-14 Thread dhkblaszyk
Graeme,

I would try and test this:

AssertException('Failing on 3', EUnknownSlideType,
TRunMethod(@si.SlideTypeDB));

Haven't been able to test though, but it's what comes to mind. Perhaps it
helps.

Darius


> Hi,
>
> Is it possible to test the code below using the AssertException()
> call?  I am sure it must be, I am just not sure how to use it.
>
> This is the work-around I have now, untill I can figure out how to use
> AssertException() correctly.
> 
>   try
> si.SetSlideName('006~sa.swf');
> si.SlideTypeDB;  { <<== method raises an error if type unknown }
>   except
> on E: exception do
> begin
>   AssertEquals('Failing on 3', EUnknownSlideType.ClassName,
> E.ClassName);
> end;
>   end;
> 
>
> I tried the following, but got a compiler error on each one.
>
> -
>   si.SetSlideName('006~sa.swf');
>   { none of the following worked... }
>   AssertException('Failing on 3', EUnknownSlideType, @si.SlideTypeDB);
>   AssertException('Failing on 3', EUnknownSlideType, [EMAIL PROTECTED]);
>   AssertException('Failing on 3', EUnknownSlideType, si.^SlideTypeDB);
> -
>
> Regards,
>   Graeme.
>
>
> --
> There's no place like 127.0.0.1
> ___
> 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] Modify XML Document

2006-06-22 Thread dhkblaszyk
Felipe,

Have a look at the lazdocfrm.pas file located in lazarus/ide. for a
working example.

Darius


> Hello,
>
> I am trying to use the units XMLRead, XMLWrite, DOM to modify the
> structure of a XML file.
>
> Reading the XML file is very easy and works very well, but I am lost
> about how to modify it´s structure. Specifically I want to add a new
> "brother" to a node. I try to create a DomNode and then add it, but I
> cannot change the NodeName property. So how can I change the name of a
> newly created node??
>
> Also, how can I add a new Attribute to a DomNode??
>
> The following code will give an error because NodeName is read-only:
>
> var
>   NovoNo: TDomNode;
> begin
> Posicao := TreeView1.Selected.Index;
>
> NovoNo := TDomNode.Create(XMLDoc);
> NovoNo.NodeName := 'categoria';
> XMLDoc.DocumentElement.InsertBefore(NovoNo,
>  XMLDoc.DocumentElement.ChildNodes.Item[Posicao]);
>
> I looked at the examples on fpcsrc, but there are only very basic ones
> about xml.
>
> Any help e very welcome.
>
> thanks a lot,
> --
> Felipe Monteiro de Carvalho
> ___
> 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] Polymorphism question

2006-03-03 Thread dhkblaszyk
I made a typo which I didn't notice, thanks for the replies.

> On Fri, 03 Mar 2006 04:52:36 -0300, <[EMAIL PROTECTED]> wrote:
>
>> (I sent this mail yesterday but somehow it didn't get trough, therefore
>> a
>> new try)
>>
>> I would like to declare a polymorph class. The class has several
>> properties and it's the read and write specifiers that I want to be
>> virtual abstract. So derived classes override the read and write
>> specifiers. The problem however is that I get an EAbstractError. The
>> property is still considered to be abstract according to the compiler.
>> So
>> what did I wrong? I have added an example below.
>> Is it perhaps not allowed to use this construct? What would then be the
>> best way?
>> Darius
>>
>> <>
>>
>> unit MyTest;
>>
>> {$mode objfpc}{$H+}
>>
>> interface
>>
>> uses
>>   Classes, ComCtrls, SysUtils;
>>
>> type
>>   TCustomClass = class
>>   private
>> //virtual mehods
>> function GetMyProperty: string; virtual; abstract;
>> procedure SetMyProperty(Value: string); virtual; abstract;
>>   published
>>
>> property MyProperty: string Read GetMyProperty Write SetMyProperty;
>>   end;
>>
>>   TMyClass = class(TCustomClass)
>>   private
>> FMyProperty: string;
>>
>> function GetMyProperty: string; overload;
>> procedure SetMyProperty(Value: string); overload;
>>   published
>> property MyProperty;
>>   end;
>>
>> implementation
>>
>> function TMyClass .GetMyProperty: string;
>> begin
>>   Result := FMyProperty;
>> end;
>>
>> procedure TMyClass .SetMyProperty(Value: string);
>> begin
>>   if Value = FMyProperty then
>> exit;
>>
>>   FMyProperty := Value;
>> end;
>> end.
>>
>>
>>
>> ___
>> fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
>>
>
> Try override instead of overload
>
> --
> Rodrigo Palhano
> -
> Equipe SpeedCASE
>
> ___
> 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


[fpc-pascal] Polymorphism question

2006-03-03 Thread dhkblaszyk
(I sent this mail yesterday but somehow it didn't get trough, therefore a
new try)

I would like to declare a polymorph class. The class has several
properties and it's the read and write specifiers that I want to be
virtual abstract. So derived classes override the read and write
specifiers. The problem however is that I get an EAbstractError. The
property is still considered to be abstract according to the compiler. So
what did I wrong? I have added an example below.
Is it perhaps not allowed to use this construct? What would then be the
best way?
Darius

<>

unit MyTest;

{$mode objfpc}{$H+}

interface

uses
  Classes, ComCtrls, SysUtils;

type
  TCustomClass = class
  private
//virtual mehods
function GetMyProperty: string; virtual; abstract;
procedure SetMyProperty(Value: string); virtual; abstract;
  published

property MyProperty: string Read GetMyProperty Write SetMyProperty;
  end;

  TMyClass = class(TCustomClass)
  private
FMyProperty: string;

function GetMyProperty: string; overload;
procedure SetMyProperty(Value: string); overload;
  published
property MyProperty;
  end;

implementation

function TMyClass .GetMyProperty: string;
begin
  Result := FMyProperty;
end;

procedure TMyClass .SetMyProperty(Value: string);
begin
  if Value = FMyProperty then
exit;

  FMyProperty := Value;
end;
end.



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


Re: [fpc-pascal] Remote FreePascal compile service, feedback requested

2005-12-05 Thread dhkblaszyk
One thing I would like to add to the discussion is support for the LCL.
Dunno if it was explicitly the puurpose to do that already, but I thought
I should mention it anyway.

Darius

> We (still) use FreePascal quite a bit in our first/second-year education,
> in particular, in , our Programming Education And
> Contest Hosting verification system.
>
> I was thinking of adding a remote FreePascal service along the following
> lines.  You go to its web interface, browse for your source files
> (possibly a whole zip archive) on your local machine, enter command-line
> options, and let our server compile your stuff with a (selectable)
> version of fpc (under Linux), then you get back the results (possibly
> also in a zip archive).  Mabye we can support cross compiles as well.
>
> Why do this?  Because that way people can use/try FreePascal without
> installing anything.
>
> Furthermore, we plan to support several versions of FreePascal in
> parallel.  That way, it may also be useful to the FreePascal community.
> E.g. when diagnosing a problem.
>
> Here are some questions:
>
>   1.  Do you think this service would be useful?
>
>   2.  Do you think the interface described above is good enough?
>   Suggestions for refinements would be appreciated.
>
>   3.  Are there any security risks that we may have overlooked?
>   Of course, we will impose certain limitation to avoid resource
>   hogging.  But maybe there are ways to put together a malicious
>   source file that makes the compiler misbehave ...
>
>   4.  Whatever else comes to your mind ...
>
> Best regards,
>
>   Tom Verhoeff
> --
> E-MAIL: T.Verhoeff @ TUE.NL | Fac. of Math. & Computing Science
> PHONE:  +31 40 247 41 25| Eindhoven University of Technology
> FAX:+31 40 247 54 04| PO Box 513, NL-5600 MB Eindhoven
> http://www.win.tue.nl/~wstomv/  | The Netherlands
> ___
> 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] Path, Search Path and Source Path

2005-12-04 Thread dhkblaszyk
Please switch for Lazarus specific questions to the lazarus mailinglist.

About your question, check Environment | Environment options. The tab
files contains all paths to your FPC directory.

Darius

> Hi,
>
> I have just compiled both FPC and Lazarus from SVN
> and except for one very miniscule glitch both worked
> out great.
>
> I do however one problem: When I try to compile anything
> in Lazarus, I get an error saying this or the other unit
> is not found.
>
> I suspect it's all because I have not supplied the necessary
> path information .
>
> I haven't. Because I am not sure where/how I can add those
> pieces of information.
>
> Is there a GUI way of doing this; or are there files on disk
> that I should update?
>
> BTW, I am referring to Windows platform.
>
> ___
> 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


[fpc-pascal] Download file

2005-11-17 Thread dhkblaszyk
Question:
I would like to download a file via HTTP, how can I achieve that in a
platform independent way? What components to use and is there some code
suited for dummy's available.

Darius

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


[fpc-pascal] ShellExecute alternative

2005-11-12 Thread dhkblaszyk
I'm using ShellExecute in my application on numerous occasions. What is
considered to be an OS independent alternative here?? Or do I ifdef it for
each platform??

Darius Blaszijk

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


[fpc-pascal] strange compiler message

2005-11-07 Thread dhkblaszyk
Hi,

When I want to compile a unit, I get a strange error message:

Warning: Comment level 2 found

The lines involved do contain comments that use brackets {}.

Anybody any ideas what might be causing the compiler messages??

Darius Blaszijk

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


[fpc-pascal] question on pointers

2005-11-06 Thread dhkblaszyk
I have a question on copying data to a pointer array. I'm not that into
pointers, so I can't figure out what I'm missing here. I have included
sample code below, and I get a SF on the line where I assign the data to
the pointer.
Is it perhaps that I need to assign memory to the pointer data??

Darius

procedure TForm1.Button1Click(Sender: TObject);
type
  myfloat = extended;
  pmyfloat = ^myfloat;

var
  test: array of pmyfloat;
  test2: array of myfloat;
begin
  setlength(test, 1);

  setlength(test2, 1);
  test2[0] := 3.141;

  test[0]^ := test2[0];

  ShowMessage(floattostr(test[0]^));
end;


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


Re: [fpc-pascal] Question on method pointers

2005-11-05 Thread dhkblaszyk
It works, thanks

>
> On 05 Nov 2005, at 20:21, [EMAIL PROTECTED] wrote:
>
>> I have a variable that is of this type and I want to assign the
>> result of
>> this function to a variable of type extended. I was thinking to do
>> it like
>> this;
>>
>> var MyFuncVar: TMyFunc;
>> 
>> MyResult := MyFuncVar;
>>
>> But obviously it does not work. On delphi it does, so how can I
>> make it
>> work on FPC??
>
> It should work in Delphi mode. In other modes, use
>
> MyResult := MyFunc();
>
> (which also works in Delphi if I'm not mistaken)
>
>
> Jonas
> ___
> 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


[fpc-pascal] Question on method pointers

2005-11-05 Thread dhkblaszyk
I have a question regarding the assignment of the result of a function.
The function is declared as such:

TMyFunc = function : extended of Object;

I have a variable that is of this type and I want to assign the result of
this function to a variable of type extended. I was thinking to do it like
this;

var MyFuncVar: TMyFunc;

MyResult := MyFuncVar;

But obviously it does not work. On delphi it does, so how can I make it
work on FPC??

Kind regards, Darius Blaszijk

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


Re: [fpc-pascal] FPDoc question

2005-09-26 Thread dhkblaszyk
> If you look at cvsmodule fpcdoc, there is a baseunix.xml

I see now thanks. It apears that example is also a non documented tag,
next to topic. Is there some way to find more information other that look
in the source of fpdoc??

Darius

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


[fpc-pascal] FPDoc question

2005-09-25 Thread dhkblaszyk
I have two questions regarding FPDoc;

- can I find somewhere a description on topic tags?? I have searched the
reference manual, but it seems it's not documented there.
- how can I add examples to my documentation. I understand how to add
formatted code, but what I mean is shown here:
http://community.freepascal.org:1/docs-html/rtl/baseunix/fpaccess.html

Darius

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


[fpc-pascal] Extending FPDoc

2005-09-16 Thread dhkblaszyk
Hi there,

For Lazarus I have made a tool called LazDoc that attempts to integrate a
documentation editing tool with the IDE. Depending on the position of the
cursor on the source editor, the appropriate documentation tag is searched
and then selected in the editor.
Anyway, while I was working on the tool, I realized that some additional
tags would be very usefull.

todo:
Here you can enter todo items in your code. Later after documentation
generation, an additional summary page is generated with an overview of
the todo items.

notes:
Here you can enter notes in your source. They coud be remarks for instance
for other developers, or just plain reminders for yourself.

I don't know how others feel about this, but it's sure I cannot do it
myself. Perhaps someone can help me here?? Just an explanation on how to
handle and where to look would also be nice.

Darius Blaszijk




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


[fpc-pascal] Extending FPDoc

2005-09-16 Thread dhkblaszyk
Hi there,

For Lazarus I have made a tool called LazDoc that attempts to integrate a
documentation editing tool with the IDE. Depending on the position of the
cursor on the source editor, the appropriate documentation tag is searched
and then selected in the editor.
Anyway, while I was working on the tool, I realized that some additional
tags would be very usefull.

todo:
Here you can enter todo items in your code. Later after documentation
generation, an additional summary page is generated with an overview of
the todo items.

notes:
Here you can enter notes in your source. They coud be remarks for instance
for other developers, or just plain reminders for yourself.

I don't know how others feel about this, but it's sure I cannot do it
myself. Perhaps someone can help me here?? Just an explanation on how to
handle and where to look would also be nice.

Darius Blaszijk




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


[fpc-pascal] XMLcfg question

2005-09-06 Thread dhkblaszyk
I'm working with XMLcfg to do read and write to XML files. I want to
extract data from the following XML file where element name is "second",
how can I achieve that??

Darius


  


   
  second description
  

   
  second description
  


  
  
  

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