Re: [fpc-pascal] Does FPC 2.8.0 can actually still be called Pascal ?

2013-03-02 Thread ik
On Fri, Mar 1, 2013 at 1:11 PM, ik ido...@gmail.com wrote:
 On Fri, Mar 1, 2013 at 8:56 AM, Jürgen Hestermann
 juergen.hesterm...@gmx.de wrote:

 Am 2013-03-01 04:41, schrieb dmitry boyarintsev:

 All the new strange features doesn't really matter as long as:
 1) the backward compatibility is in place (and or guidelines are given
 how to make the code compatible with minimal efforts)
 2) executable size doesn't suffer much ;)
 3) the new target is supported and the existing code can be applied to it.


 The problem with this is that you cannot read code written by others anymore
 unless you learn *all* details about the large number of added features.
 And that's meanwhile like learning 2-3 other languagues and no longer
 the easy to learn Pascal of earlier times.

 +1

People at Delphi are unwilling to call themselves Pascal developers
(Or Object Pascal), but Delphi developers, now I understand the lack
of cooperation that the FPC developers talk about.

But if Delphi devs, does not wish to see themselves as Pascal
developers, then how does FPC implementing Delphi dialect can help ?
Or is it just a core group of people ?




 ___
 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] Does FPC 2.8.0 can actually still be called Pascal ?

2013-03-01 Thread ik
On Fri, Mar 1, 2013 at 8:56 AM, Jürgen Hestermann
juergen.hesterm...@gmx.de wrote:

 Am 2013-03-01 04:41, schrieb dmitry boyarintsev:

 All the new strange features doesn't really matter as long as:
 1) the backward compatibility is in place (and or guidelines are given
 how to make the code compatible with minimal efforts)
 2) executable size doesn't suffer much ;)
 3) the new target is supported and the existing code can be applied to it.


 The problem with this is that you cannot read code written by others anymore
 unless you learn *all* details about the large number of added features.
 And that's meanwhile like learning 2-3 other languagues and no longer
 the easy to learn Pascal of earlier times.

+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


[fpc-pascal] pascal compiler for ardurino

2013-02-26 Thread ik
Hello,

Is there a Pascal compiler for Ardurino (instead of the existed build
in language or C) ?

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


Re: [fpc-pascal] pascal compiler for ardurino

2013-02-26 Thread ik
On Tue, Feb 26, 2013 at 9:49 PM, Ralf A. Quint free...@gmx.net wrote:
 At 11:07 AM 2/26/2013, ik wrote:

 Hello,

 Is there a Pascal compiler for Ardurino (instead of the existed build
 in language or C) ?


 Don't know anything Arduino specific (their forums seem to be overrun by C
 language nazis), but for the AVR micro controllers in general I know of 3
 commercial products:

 mikroPascal Pro (http://www.mikroe.com/mikropascal/avr/)
 Embedded Pascal for AVR (http://users.iafrica.com/r/ra/rainier/pAVR.htm)
 Pascal-scm for Amtel AVR (http://www.e-lab.de/AVRco/index_en.html)

 All three have some kind of evaluation version, however usually limited to
 4KB or 8KB of flash code

 There used to be a free (no open source AFAIK though) Pheline Pascal AVR
 (http://www.mikrocontroller.net/topic/140480), but that hasn't been
 maintained in years (and is German language only)...


Thanks

 Ralf
 ___
 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] Semi OT: Database-free application lecture

2013-02-25 Thread ik
Hello,

I gave today a lecture named database-free applications[1].
The lecture explain an idea of how to design complex systems and break
them apart etc...

The lecture is in English and so does my slide notes, and I think that
people here can enjoy the idea as well.

[1] https://github.com/ik5/database_free_application_lecture
Please note that it's only the sources, and you need also to use git
submodule to get the presentation system to work.

I hope this will help, and feel free to ask me questions in the
subject if you have any

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


Re: [fpc-pascal] Semi OT: Database-free application lecture

2013-02-25 Thread ik
On Mon, Feb 25, 2013 at 11:28 PM, Sven Barth
pascaldra...@googlemail.com wrote:
 On 25.02.2013 21:57, ik wrote:

 Hello,

 I gave today a lecture named database-free applications[1].
 The lecture explain an idea of how to design complex systems and break
 them apart etc...

 The lecture is in English and so does my slide notes, and I think that
 people here can enjoy the idea as well.

 [1] https://github.com/ik5/database_free_application_lecture
 Please note that it's only the sources, and you need also to use git
 submodule to get the presentation system to work.

 I hope this will help, and feel free to ask me questions in the
 subject if you have any


 Somehow I fail to see how this talk relates to database free... Somewhere
 you'll need to have the data anyway.

The idea is to break thinks into small parts.
99.9 of the things you do, need to know only specific parts, but not
everything :)
It's all there btw ...


 Regards,
 Sven

 PS: I like the idea of using HTML5/JS as a presentation mechanism, though I
 the navigation is a bit... confusing (right, down, down, down, right, down,
 down, right...)
use space and it will go the proper direction, the tool allow you to
create sub sections, so each sub section is a whole subject
 ___
 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] is resourcestring translation thread safe ?

2013-02-21 Thread ik
Hello,

Let's say I have a multi-threaded cgi (such as brook framework), and I
use resourcestring to translate strings.
Does the translation of resourcestring will be based on a thread -
that is a copy for each thread, or will it be globally changed ?

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


Re: [fpc-pascal] is resourcestring translation thread safe ?

2013-02-21 Thread ik
On Thu, Feb 21, 2013 at 8:06 PM, Sven Barth pascaldra...@googlemail.com wrote:
 On 21.02.2013 17:55, ik wrote:

 Hello,

 Let's say I have a multi-threaded cgi (such as brook framework), and I
 use resourcestring to translate strings.
 Does the translation of resourcestring will be based on a thread -
 that is a copy for each thread, or will it be globally changed ?


 It's globally. There is one resourcestring table for each unit and this will
 be changed through calls to SetResourceStrings (
 http://community.freepascal.org/docs-html/rtl/objpas/setresourcestrings.html
 ).

I know it, but the question is, is it thread safe, so each thread can
translate it differently on the same process at run time ?


 Regards,
 Sven

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


Re: [fpc-pascal] is resourcestring translation thread safe ?

2013-02-21 Thread ik
On Thu, Feb 21, 2013 at 9:07 PM, Sven Barth pascaldra...@googlemail.com wrote:
 On 21.02.2013 19:14, ik wrote:

 On Thu, Feb 21, 2013 at 8:06 PM, Sven Barth pascaldra...@googlemail.com
 wrote:

 On 21.02.2013 17:55, ik wrote:


 Hello,

 Let's say I have a multi-threaded cgi (such as brook framework), and I
 use resourcestring to translate strings.
 Does the translation of resourcestring will be based on a thread -
 that is a copy for each thread, or will it be globally changed ?



 It's globally. There is one resourcestring table for each unit and this
 will
 be changed through calls to SetResourceStrings (

 http://community.freepascal.org/docs-html/rtl/objpas/setresourcestrings.html
 ).


 I know it, but the question is, is it thread safe, so each thread can
 translate it differently on the same process at run time ?


 There is one table for each unit in which each resource string of the unit
 is located exactly once with one translation. Does this answer your
 question?

Thanks



 Regards,
 Sven



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


Re: [fpc-pascal] What's a unit?

2013-02-19 Thread ik
On Tue, Feb 19, 2013 at 3:31 PM, Mark Morgan Lloyd
markmll.fpc-pas...@telemetry.co.uk wrote:
 Does a unit- rather than something it contains- have any sort of
 representation which is recognisably distinct from an object?

 I've got a situation where if a library (.dll or .so) is opened under
 program control it is represented by an object, with entry points expressed
 as methods. Alternatively, if it's statically linked then it's represented
 by a unit, with entry points represented by procedures and functions. That
 allows me to write things like

 caps := LibCapShim.cap_get_proc;  // LibCapShim is object or unit

It's a namespace. It can be a namespace of a unit, record, instance of
class or object.

 if caps  nil then
   try
 caplist := capability;
 r := LibCapShim.cap_set_flag(caps, flag, 1, @caplist, Ord(value));

 which is OK at the application level irrespective of how the program's
 built.

 What I can't do, without a conditional directive, is check whether the
 object representing the library is nil (because the dll/so isn't available).
 Instead I'm having to do

 {$ifdef USE_DYNAMIC_LIBCAP }
   if LibCapShim = nil then  (* Initialisation failed*)
 exit;
 {$endif}
   caps := LibCapShim.cap_get_proc;

 and so on. There's obviously ways around this, but they tend to rely on
 adding validity functions outside the object. Is there any way of doing
 something like

 if LibCapShim is TObject then
   if LibCapShim = nil then  (* Initialisation failed*)
 exit;

 without the compiler objecting when it finds itself looking at a unit name
 in isolation?

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

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


Re: [fpc-pascal] OT a bit - Planet Object Pascal

2013-02-18 Thread ik
On Mon, Feb 18, 2013 at 3:54 AM, waldo kitty wkitt...@windstream.net wrote:
 On 2/17/2013 19:40, Rainer Stratmann wrote:

 Am Sunday 17 February 2013 18:45:50 schrieb Florian Klämpfl:

 Am 17.02.2013 18:10, schrieb ik:

 Nice, Pascal is at the same level of usage and exposure as gcc, Linux
 kernel and llvm,


 And you think some fancy webpage filled with java script (which is
 turned off in my browser) would change this?


 In my opinion it would be ok to make the webpage a little bit more
 eyecandy.


 eyecandy isn't worth any more than regular candy... candy is candy which is
 only a sweet to attract those who can't/won't stomach the reality of the
 basics...

https://plus.google.com/u/0/112026213399155142823/posts/ERWneYjmyMD

Just for you :)

My last post in this whole subject. You know my opinion, it looks like
too many people outside the projects feels the same, but not inside of
it, enjoy.


   a spoon full of sugar helps the medicine go down...


 That can be done also without java script(!)


 agreed... but too many are wrapped up in making candy to suck on rather than
 a real meal that actually satisfies the hunger...


 ___
 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] OT a bit - Planet Object Pascal

2013-02-17 Thread ik
On Sun, Feb 17, 2013 at 10:13 AM, Florian Klämpfl flor...@freepascal.orgwrote:

 Am 16.02.2013 20:45, schrieb geneb:
  On Sat, 16 Feb 2013, Michael Van Canneyt wrote:
 
  I tried something like this before and I was suprised at the dearth of
  Lazarus and FreePascal bloggers. Getting Lazarus and FPC developers,
  (let alone users) to blog about their experiences is like pulling
  teeth.I think a law should be passed requiring FPC users to blog about
  their usage and experiences at least twice a year.
 
  Maybe not everyone is so enthousiast about blogs as you ?
 
  I agree with Florian; I prefer to work on FPC.
 
  While I can certainly understand your point of view, the more people
  that are talking about FPC and Lazarus, the more people that will become
  exposed to it.

 Isn't the svn rss feed not the best opportunity to talk about
 fpc/lazarus :)?


When I hear stuff like sure pascal is cool but lack of good string
support, I think that it is more self explanatory then anything.

At the local open source community I'm a known evangelist for Object
Pascal, and my blog is full of code, text etc, regarding stuff in object
pascal.
Some of the people over here that actually started using FPC/Lazarus
arrived due to my blog posts, so spreading the word is very important imho.

Ido



 ___
 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] OT a bit - Planet Object Pascal

2013-02-17 Thread ik
On Sun, Feb 17, 2013 at 11:35 AM, Florian Klämpfl flor...@freepascal.orgwrote:

 Am 17.02.2013 09:55, schrieb ik:
 
 
  On Sun, Feb 17, 2013 at 10:13 AM, Florian Klämpfl
  flor...@freepascal.org mailto:flor...@freepascal.org wrote:
 
  Am 16.02.2013 20:45, schrieb geneb:
   On Sat, 16 Feb 2013 tel:2013, Michael Van Canneyt wrote:
  
   I tried something like this before and I was suprised at the
  dearth of
   Lazarus and FreePascal bloggers. Getting Lazarus and FPC
 developers,
   (let alone users) to blog about their experiences is like pulling
   teeth.I think a law should be passed requiring FPC users to blog
  about
   their usage and experiences at least twice a year.
  
   Maybe not everyone is so enthousiast about blogs as you ?
  
   I agree with Florian; I prefer to work on FPC.
  
   While I can certainly understand your point of view, the more
 people
   that are talking about FPC and Lazarus, the more people that will
  become
   exposed to it.
 
  Isn't the svn rss feed not the best opportunity to talk about
  fpc/lazarus :)?
 
 
  When I hear stuff like sure pascal is cool but lack of good string
  support, I think that it is more self explanatory then anything.
 
  At the local open source community I'm a known evangelist for Object
  Pascal, and my blog is full of code, text etc, regarding stuff in object
  pascal.
  Some of the people over here that actually started using FPC/Lazarus
  arrived due to my blog posts, so spreading the word is very important
 imho.

 It is. But some might code, others might evangelize. What I wanted to
 say: those who are interested what happens in FPC in detail might follow
 also the svn rss feed. There is simply no need for the developers to
 blog about this.


I disagree on this, but that's ok


 ___
 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] OT a bit - Planet Object Pascal

2013-02-17 Thread ik
On Sun, Feb 17, 2013 at 11:43 AM, Florian Klämpfl flor...@freepascal.orgwrote:

 Am 17.02.2013 10:40, schrieb ik:
   When I hear stuff like sure pascal is cool but lack of good string
   support, I think that it is more self explanatory then anything.
  
   At the local open source community I'm a known evangelist for
 Object
   Pascal, and my blog is full of code, text etc, regarding stuff in
  object
   pascal.
   Some of the people over here that actually started using
 FPC/Lazarus
   arrived due to my blog posts, so spreading the word is very
  important imho.
 
  It is. But some might code, others might evangelize. What I wanted to
  say: those who are interested what happens in FPC in detail might
 follow
  also the svn rss feed. There is simply no need for the developers to
  blog about this.
 
 
  I disagree on this, but that's ok

 As soon as you start working seriously on the compiler, I'll start to
 blog ;)


You mean like the things that I write for a living that actually being used
country wide by big companies ?

Pascal is only one programming language I use, and only for hobby, not for
make a living, and that's partly because of you.
You prefer to create new features, but keep it to yourself, and hoping that
someone will catch-up.
It does not work like this, specially with Pascal.

But what do I know, I don't write software ...




 ___
 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] OT a bit - Planet Object Pascal

2013-02-17 Thread ik
On Sun, Feb 17, 2013 at 1:58 PM, Florian Klämpfl flor...@freepascal.orgwrote:

 Am 17.02.2013 10:53, schrieb ik:
 
  Pascal is only one programming language I use, and only for hobby, not
  for make a living,

 The same applies here.

  and that's partly because of you.

 Well and partly you :) I'am pretty sure that some of the developers
 would blog about their work if somebody pays them for blogging. But you
 don't do so (obviously I understand this), they have to earn their
 living by other means.


I'm a freelancer for the past 6 years, so please pay me on all of the
amount
of time I spent talking, lecturing and evangelist FPC and Lazarus on my own
expense.

You never see me ask for it, because I do it because I want to see Pascal
in the industry.
I do it because I have need to see it used, to make programming fun again,
or for any
other reason.



  You prefer to create new features, but keep it to yourself, and hoping
  that someone will catch-up.

 You miss the point. My time for fpc is limited and fixed. If I write
 blog entries instead of coding, fpc will evolve slower. If I spent 25%
 of all of my fpc time on blogging instead of improving fpc, maybe pascal
 would be dead now because no advanced OSS compiler is available and it
 would be only my private pet compiler I use to compile my chess programs
 and the controll software for our model railway.


When I know why Florian (and others) started FPC/K, why do they implement
feature X, and not feature Y, when I understand the story of the core
developers,
It's easier to relate to things.

I can talk about a feature that you or anyone else added or removed, but I
can't
bring the whole story of it.

Why is it that FPC/K now exists for 20 years as an open source project, and
you
can't earn money for developing it, while Linus that have an OS that exists
for 21
years can ?

This type of things are important more then you think.

But not only this, take a look at the freepascal.org web site: animated gif
(from the 90's),
the whole way of thinking there is not designer oriented - It does not
invite new people
to the project, does not provide a proper place to be etc...

It's not easy to find documentation for things, some are at the wiki, some
at the /doc-html/ path
and many does not exists.

So you are working on all this cool features and is the fastest compiler in
the world, and you can
do everything you wanted with pascal and many things you don't (and it's
not a c++ like
technology garbage can). But no new blood see it, use it or can be
attracted to it, so what's
the point ? unless it's pure hobby and all of this does not matter ...



  It does not work like this, specially with Pascal.

 How do you know so? Developers quickly realize if a tool is no evolving
 and all advertisement is only buzz and will quickly use other tools.


Developers, doctors, and all the people who have a profession does not
choose a tool that
they know nothing about, and if they have too much choice, they usually
choose the one that
everyone(tm) choose, not because it is good for them, but because everyone
is using it.

It was proven so many times over and over again, you can find on the web
people such as
Dan Ariely have a lot of talks and books about it, if you have time for
such things ...
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] OT a bit - Planet Object Pascal

2013-02-17 Thread ik
On Sun, Feb 17, 2013 at 5:05 PM, Florian Klämpfl flor...@freepascal.org wrote:

 Am 17.02.2013 15:36, schrieb ik:
 
 
  On Sun, Feb 17, 2013 tel:2013 at 1:58 PM, Florian Klämpfl
  Why is it that FPC/K now exists for 20 years as an open source project,
  and you
  can't earn money for developing it,

 Actually, I'am not interested in earning money with it.

   while Linus that have an OS that
  exists for 21
  years can ?
 
  This type of things are important more then you think.

 For what? For the fun? FPC is probably by far the most successful non
 company supported oss compiler so I'am sure I know what is important.


Yes to solve everything but keep it for yourself :P



 
  But not only this, take a look at the freepascal.org
  http://freepascal.org web site: animated gif (from the 90's),

 Ever looked at gcc.gnu.org, kernel.org, llvm.org etc.?


Nice, Pascal is at the same level of usage and exposure as gcc, Linux
kernel and llvm,
nothing more to do, 0xPascal maybe, just to show that 201x can have
something new ?



  the whole way of thinking there is not designer oriented - It does not
  invite new people
  to the project,
  does not provide a proper place to be etc...

 Why should I care? They might use the tools they like, I use the tools I
 like.

 
  It's not easy to find documentation for things, some are at the wiki,

 A compiler is not a toy, and I know that serious programmers find the
 needed docs.


Sure that compile is a toy, it can't do much, just parse something and
move it to be something else :P

And documentation should be at one place, including new features,
workarounds etc... for old versions.
Look at:

http://ruby-doc.org/
http://www.python.org/doc/
http://perldoc.perl.org/
http://golang.org/doc/
http://docs.oracle.com/javase/7/docs/api/
http://docs.embarcadero.com/products/rad_studio/
https://developer.mozilla.org/en/docs/JavaScript
http://msdn.microsoft.com/en-us/library/
https://developers.google.com/

Should I continue, or do you get my point ?



  some at the /doc-html/ path
  and many does not exists.
 
  So you are working on all this cool features and is the fastest compiler
  in the world, and you can
  do everything you wanted with pascal and many things you don't (and it's
  not a c++ like
  technology garbage can). But no new blood see it, use it or can be
  attracted to it, so what's
  the point ?

 FPC is still growing so what is your point?

If a tree fall in the forest and no one hear about it, did it made a sound ?

My point is that features are good, but when on one knows about it, then
what's the point of it all ?


 ___
 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] OT a bit - Planet Object Pascal

2013-02-17 Thread ik
On Sun, Feb 17, 2013 at 9:31 PM, Frank Church vfcli...@gmail.com wrote:
 On 17 February 2013 17:10, ik ido...@gmail.com wrote:
 On Sun, Feb 17, 2013 at 5:05 PM, Florian Klämpfl flor...@freepascal.org 
 wrote:

 Am 17.02.2013 15:36, schrieb ik:
 
 
  On Sun, Feb 17, 2013 tel:2013 at 1:58 PM, Florian Klämpfl
  Why is it that FPC/K now exists for 20 years as an open source project,
  and you
  can't earn money for developing it,

 Actually, I'am not interested in earning money with it.

   while Linus that have an OS that
  exists for 21
  years can ?
 
  This type of things are important more then you think.

 For what? For the fun? FPC is probably by far the most successful non
 company supported oss compiler so I'am sure I know what is important.


 Yes to solve everything but keep it for yourself :P



 
  But not only this, take a look at the freepascal.org
  http://freepascal.org web site: animated gif (from the 90's),

 Ever looked at gcc.gnu.org, kernel.org, llvm.org etc.?


 Nice, Pascal is at the same level of usage and exposure as gcc, Linux
 kernel and llvm,
 nothing more to do, 0xPascal maybe, just to show that 201x can have
 something new ?



  the whole way of thinking there is not designer oriented - It does not
  invite new people
  to the project,
  does not provide a proper place to be etc...

 Why should I care? They might use the tools they like, I use the tools I
 like.

 
  It's not easy to find documentation for things, some are at the wiki,

 A compiler is not a toy, and I know that serious programmers find the
 needed docs.


 Sure that compile is a toy, it can't do much, just parse something and
 move it to be something else :P

 And documentation should be at one place, including new features,
 workarounds etc... for old versions.
 Look at:

 http://ruby-doc.org/
 http://www.python.org/doc/
 http://perldoc.perl.org/
 http://golang.org/doc/
 http://docs.oracle.com/javase/7/docs/api/
 http://docs.embarcadero.com/products/rad_studio/
 https://developer.mozilla.org/en/docs/JavaScript
 http://msdn.microsoft.com/en-us/library/
 https://developers.google.com/

 Should I continue, or do you get my point ?



  some at the /doc-html/ path
  and many does not exists.
 
  So you are working on all this cool features and is the fastest compiler
  in the world, and you can
  do everything you wanted with pascal and many things you don't (and it's
  not a c++ like
  technology garbage can). But no new blood see it, use it or can be
  attracted to it, so what's
  the point ?

 FPC is still growing so what is your point?

 If a tree fall in the forest and no one hear about it, did it made a sound ?

 My point is that features are good, but when on one knows about it, then
 what's the point of it all ?


 ___
 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

 To Id in particular and others like minds I think there is something
 which isn't quite understood here. The compiler and the language ie
 FPC is quite a separate thing from the development tools and

FPC implement things. It does not implement all of Pascal ISO, and it
add a lot of things on it's own


 libraries, toolchains and the areas where it is applied. For instance
 if you read fpc-devel you will see that it is targetted at a wide
 range of CPUs and embedded devices, and that is not an area where the
 latest language developments are of much interest. Rightly or wrongly
 the compiler developers have become the focus where all matters FPC
 related are centred and this shouldn't be the case.

 I had my issues with this a long time ago and I even blogged about it
 - 
 https://devblog.brahmancreations.com/content/observations-on-freepascal-and-lazarus-development,
 and it also resulted in
 https://devblog.brahmancreations.com/content/build-scripts-for-installing-freepascal-and-lazarus-from-source
 (which has resulted in almost 60.000 hits to date, LOL) but I have
 come to understand why things are the way they are.

 Some of your comparisons with other language projects are not quite
 fair. You mentioned Ruby, Python, Java but this comparison is not
 appropriate. Leaving aside the quality of documentation, something
 must be noted here. The languages you mentioned are more or less owned
 by a few individuals/corporations/committees who determine EXACTLY how
 the language is defined, the primary libraries and how they are
 implemented. There is only one Matz, one Guido, and one Oracle.

Yet, Google was able to create Dalvik
(http://en.wikipedia.org/wiki/Dalvik_%28software%29)
by using Sun/Oracle API, there are numerous implementation of
Ruby (http://jruby.org/, http://rubini.us/ for example) and Python
(http://www.jython.org/, http://pypy.org/), a lot more people

Re: [fpc-pascal] OT a bit - Planet Object Pascal

2013-02-17 Thread ik
On Sun, Feb 17, 2013 at 10:57 PM, Frank Church vfcli...@gmail.com wrote:
 On 17 February 2013 19:35, Florian Klämpfl flor...@freepascal.org wrote:
 Am 17.02.2013 20:31, schrieb Frank Church:
 One more thing lest I forget. The official FPC documentation is very
 good, especially for documents created by volunteers and hobbyists.
 That it is not accompanied by examples

 c:\fpc\docsdir ex*.pp /s | grep -c ex
 668

 What do I miss?

 I am referring to the HTML docs at -
 http://www.freepascal.org/docs.var. it's not the type that users can
 leave comments and examples in, like PHP for instance.

 I am not complaining about the official docs, I actually praised them,
 but users come to Lazarus and FPC with expectations based on what they
 see in other projects and that is the cause of the complaints.

and the complains are justified. fpc as a project lack of people to do things.
for ruby the Rails project brought a lot of people to develop with the language.
at python it was django. what is the project that will make people to
try and use pascal ?
how can you find new blood to bring to the projects ?
how can you make sure that people are interested ?


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



 --
 Frank Church

 ===
 http://devblog.brahmancreations.com
 ___
 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] OT a bit - Planet Object Pascal

2013-02-17 Thread ik
On Sun, Feb 17, 2013 at 10:59 PM, Leonardo M. Ramé martinr...@yahoo.com wrote:

 From: ik ido...@gmail.com
To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org
Sent: Sunday, February 17, 2013 5:30 PM
Subject: Re: [fpc-pascal] OT a bit - Planet Object Pascal


I don't need an IDE to develop Pascal, unlike Java for example, I can use VIM
(and actually sometimes do), to develop. A language that must be with IDE
sucks big time.

 Whaaat? I don't like java, but don't you know you can use javac command 
 line?, and program in any text editor?.

Try to develop an application/library with Java using using an editor
such as vim, and you will want to kill yourself.
too many files (each class has it's own file), the path where you
place the files is part of the namespace.
ant is not very simple to use, and if you use tools such as spring in
get harder.
it's not simple to detect without reading documentation what are the
exception that are thrown back, and almost every error with java is an
exception.

you can't really use java without an ide for normal projects, only for
simple ones, and I speak from experience.



 Leonardo M. Ramé
 http://leonardorame.blogspot.com

 ___
 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] OT a bit - Planet Object Pascal

2013-02-17 Thread ik
On Sun, Feb 17, 2013 at 11:24 PM, Frank Church vfcli...@gmail.com wrote:
 On 17 February 2013 20:30, ik ido...@gmail.com wrote:
 On Sun, Feb 17, 2013 at 9:31 PM, Frank Church vfcli...@gmail.com wrote:
 On 17 February 2013 17:10, ik ido...@gmail.com wrote:
 On Sun, Feb 17, 2013 at 5:05 PM, Florian Klämpfl flor...@freepascal.org 
 wrote:

 Am 17.02.2013 15:36, schrieb ik:
 
 
  On Sun, Feb 17, 2013 tel:2013 at 1:58 PM, Florian Klämpfl
  Why is it that FPC/K now exists for 20 years as an open source project,
  and you
  can't earn money for developing it,

 Actually, I'am not interested in earning money with it.

   while Linus that have an OS that
  exists for 21
  years can ?
 
  This type of things are important more then you think.

 For what? For the fun? FPC is probably by far the most successful non
 company supported oss compiler so I'am sure I know what is important.


 Yes to solve everything but keep it for yourself :P



 
  But not only this, take a look at the freepascal.org
  http://freepascal.org web site: animated gif (from the 90's),

 Ever looked at gcc.gnu.org, kernel.org, llvm.org etc.?


 Nice, Pascal is at the same level of usage and exposure as gcc, Linux
 kernel and llvm,
 nothing more to do, 0xPascal maybe, just to show that 201x can have
 something new ?



  the whole way of thinking there is not designer oriented - It does not
  invite new people
  to the project,
  does not provide a proper place to be etc...

 Why should I care? They might use the tools they like, I use the tools I
 like.

 
  It's not easy to find documentation for things, some are at the wiki,

 A compiler is not a toy, and I know that serious programmers find the
 needed docs.


 Sure that compile is a toy, it can't do much, just parse something and
 move it to be something else :P

 And documentation should be at one place, including new features,
 workarounds etc... for old versions.
 Look at:

 http://ruby-doc.org/
 http://www.python.org/doc/
 http://perldoc.perl.org/
 http://golang.org/doc/
 http://docs.oracle.com/javase/7/docs/api/
 http://docs.embarcadero.com/products/rad_studio/
 https://developer.mozilla.org/en/docs/JavaScript
 http://msdn.microsoft.com/en-us/library/
 https://developers.google.com/

 Should I continue, or do you get my point ?



  some at the /doc-html/ path
  and many does not exists.
 
  So you are working on all this cool features and is the fastest compiler
  in the world, and you can
  do everything you wanted with pascal and many things you don't (and it's
  not a c++ like
  technology garbage can). But no new blood see it, use it or can be
  attracted to it, so what's
  the point ?

 FPC is still growing so what is your point?

 If a tree fall in the forest and no one hear about it, did it made a sound 
 ?

 My point is that features are good, but when on one knows about it, then
 what's the point of it all ?


 ___
 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

 To Id in particular and others like minds I think there is something
 which isn't quite understood here. The compiler and the language ie
 FPC is quite a separate thing from the development tools and

 FPC implement things. It does not implement all of Pascal ISO, and it
 add a lot of things on it's own


 libraries, toolchains and the areas where it is applied. For instance
 if you read fpc-devel you will see that it is targetted at a wide
 range of CPUs and embedded devices, and that is not an area where the
 latest language developments are of much interest. Rightly or wrongly
 the compiler developers have become the focus where all matters FPC
 related are centred and this shouldn't be the case.

 I had my issues with this a long time ago and I even blogged about it
 - 
 https://devblog.brahmancreations.com/content/observations-on-freepascal-and-lazarus-development,
 and it also resulted in
 https://devblog.brahmancreations.com/content/build-scripts-for-installing-freepascal-and-lazarus-from-source
 (which has resulted in almost 60.000 hits to date, LOL) but I have
 come to understand why things are the way they are.

 Some of your comparisons with other language projects are not quite
 fair. You mentioned Ruby, Python, Java but this comparison is not
 appropriate. Leaving aside the quality of documentation, something
 must be noted here. The languages you mentioned are more or less owned
 by a few individuals/corporations/committees who determine EXACTLY how
 the language is defined, the primary libraries and how they are
 implemented. There is only one Matz, one Guido, and one Oracle.

 Yet, Google was able to create Dalvik
 (http://en.wikipedia.org/wiki/Dalvik_%28software%29)
 by using Sun/Oracle API, there are numerous implementation

Re: [fpc-pascal] OT a bit - Planet Object Pascal

2013-02-16 Thread ik
On Sat, Feb 16, 2013 at 10:44 AM, Frank Church vfcli...@gmail.com wrote:

 On 13 February 2013 11:34, ik ido...@gmail.com wrote:
  Hello,
 
  I'ved created an RSS aggregation site for Object Pascal related blogs:
  http://planet.objpas.org/
 
  This is a test run, and the look and feel will be changed in the feature.
  If you have a blog or can provide RSS for FPC/Lazarus news please send
  me an email with the feed details and I'll add you.
 
  Ido
  ___
  fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
  http://lists.freepascal.org/mailman/listinfo/fpc-pascal

 I tried something like this before and I was suprised at the dearth of
 Lazarus and FreePascal bloggers. Getting Lazarus and FPC developers,
 (let alone users) to blog about their experiences is like pulling
 teeth.I think a law should be passed requiring FPC users to blog about
 their usage and experiences at least twice a year.

 I just visited and it was the same South American bloggers like Silvio
 Clecio, Leonardo Rame. You do get a number of Delphi developers
 though.
  I am hoping my attempt was premature. The Lazarus forum should have a
 bold banner saying reading What FPC or Lazarus feature have you
 blogged about this year? Making it this month or this quarter may
 just be too much.


You have also my blog (mostly in Hebrew, to keep Pascal in the
conversation, and provide local information).
Yes, with FPC/Lazarus most does not keep blogs, I created some interviews
once with FPC developers, and Florian
asked me what do you prefer, someone who develop the compiler or someone
who talk :)


 --
 Frank Church

 ===
 http://devblog.brahmancreations.com
 ___
 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] OT a bit - Planet Object Pascal

2013-02-13 Thread ik
Hello,

I'ved created an RSS aggregation site for Object Pascal related blogs:
http://planet.objpas.org/

This is a test run, and the look and feel will be changed in the feature.
If you have a blog or can provide RSS for FPC/Lazarus news please send
me an email with the feed details and I'll add you.

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


[fpc-pascal] pointer address safety

2013-01-31 Thread ik
Hello,

What is the safest (no memory corruption etc...) way to use format
string, and by using '%P' pass a class memory address ?

Does casting to Pointer good, or is it unsafe ?

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


[fpc-pascal] TFPSMap return wrong pointer address

2013-01-31 Thread ik
Hello,

I'm trying to use TFPSMap, to store a class using a key.

While the key seems to be saved properly, and easy to find, the data
pointer that returns is wrong.
The adding of the data can be found here:
https://github.com/ik5/split_lazarus/blob/master/src/untlazsplitview_code.pas#L244

Here is the debug information that I can see it:

1. Saving:

TSplitView.ToggleSplitView - ActiveEditor (7FEEC39733C0)
TSplitView.ToggleSplitView - Looked for an item index: -1
TSplitView.ToggleSplitView - No Item was found
TSplitView.ToggleSplitView - Added new item index: 0
TSplitView.ToggleSplitView - tab (7FEEC1234C80),
SplitEditor(7FEEC218C610), Splitter (7FEEC219CDD0)
TSplitView.SetEditor - Editor (7FEEC218C610)
TSplitView.SetSplitter - Splitter (7FEEC219CDD0)
TSplitView.ToggleSplitView - done execution

2. Retrieving:
TSplitView.ToggleSplitView - ActiveEditor (7FEEC39733C0)
TSplitView.ToggleSplitView - Looked for an item index: 0
TSplitView.ToggleSplitView - Found the item
TSplitView.ToggleSplitView - tab (7FEEBB2FCD00),
SplitEditor(), Splitter ()
TSplitView.ToggleSplitView - CleanResources - Going to free
SplitEditor () and Splitter ()
TSplitView.ToggleSplitView - CleanResources - tab.SplitEditor is not allocated
TSplitView.ToggleSplitView - CleanResources - Going to free tab.Splitter
TSplitView.SetEditor - Editor (

Am I doing something wrong here ?
If so, what is the best way to solve it ?


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


[fpc-pascal] Re: TFPSMap return wrong pointer address

2013-01-31 Thread ik
On Thu, Jan 31, 2013 at 9:35 PM, ik ido...@gmail.com wrote:
 Hello,

 I'm trying to use TFPSMap, to store a class using a key.

 While the key seems to be saved properly, and easy to find, the data
 pointer that returns is wrong.
 The adding of the data can be found here:
 https://github.com/ik5/split_lazarus/blob/master/src/untlazsplitview_code.pas#L244

 Here is the debug information that I can see it:

 1. Saving:

 TSplitView.ToggleSplitView - ActiveEditor (7FEEC39733C0)
 TSplitView.ToggleSplitView - Looked for an item index: -1
 TSplitView.ToggleSplitView - No Item was found
 TSplitView.ToggleSplitView - Added new item index: 0
 TSplitView.ToggleSplitView - tab (7FEEC1234C80),
 SplitEditor(7FEEC218C610), Splitter (7FEEC219CDD0)
 TSplitView.SetEditor - Editor (7FEEC218C610)
 TSplitView.SetSplitter - Splitter (7FEEC219CDD0)
 TSplitView.ToggleSplitView - done execution

 2. Retrieving:
 TSplitView.ToggleSplitView - ActiveEditor (7FEEC39733C0)
 TSplitView.ToggleSplitView - Looked for an item index: 0
 TSplitView.ToggleSplitView - Found the item
 TSplitView.ToggleSplitView - tab (7FEEBB2FCD00),
 SplitEditor(), Splitter ()
 TSplitView.ToggleSplitView - CleanResources - Going to free
 SplitEditor () and Splitter ()
 TSplitView.ToggleSplitView - CleanResources - tab.SplitEditor is not 
 allocated
 TSplitView.ToggleSplitView - CleanResources - Going to free tab.Splitter

The above was wrong, the checking did find that it was not allocated,
the text itself was wrong, and fixed it

 TSplitView.SetEditor - Editor (

 Am I doing something wrong here ?
 If so, what is the best way to solve it ?


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


Re: [fpc-pascal] pointer address safety

2013-01-31 Thread ik
On Thu, Jan 31, 2013 at 10:25 PM, Sven Barth
pascaldra...@googlemail.com wrote:
 On 31.01.2013 19:55, ik wrote:

 Hello,

 What is the safest (no memory corruption etc...) way to use format
 string, and by using '%P' pass a class memory address ?

 Does casting to Pointer good, or is it unsafe ?


 As Format does not support objects being provided to it you MUST even cast
 to Pointer if you want it printed. :)

 And as classes instances are implicit pointers there is no problem...

Thanks :)


 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] Re: TFPSMap return wrong pointer address

2013-01-31 Thread ik
On Thu, Jan 31, 2013 at 9:44 PM, ik ido...@gmail.com wrote:
 On Thu, Jan 31, 2013 at 9:35 PM, ik ido...@gmail.com wrote:
 Hello,

 I'm trying to use TFPSMap, to store a class using a key.

 While the key seems to be saved properly, and easy to find, the data
 pointer that returns is wrong.
 The adding of the data can be found here:
 https://github.com/ik5/split_lazarus/blob/master/src/untlazsplitview_code.pas#L244

 Here is the debug information that I can see it:

 1. Saving:

 TSplitView.ToggleSplitView - ActiveEditor (7FEEC39733C0)
 TSplitView.ToggleSplitView - Looked for an item index: -1
 TSplitView.ToggleSplitView - No Item was found
 TSplitView.ToggleSplitView - Added new item index: 0
 TSplitView.ToggleSplitView - tab (7FEEC1234C80),
 SplitEditor(7FEEC218C610), Splitter (7FEEC219CDD0)
 TSplitView.SetEditor - Editor (7FEEC218C610)
 TSplitView.SetSplitter - Splitter (7FEEC219CDD0)
 TSplitView.ToggleSplitView - done execution

 2. Retrieving:
 TSplitView.ToggleSplitView - ActiveEditor (7FEEC39733C0)
 TSplitView.ToggleSplitView - Looked for an item index: 0
 TSplitView.ToggleSplitView - Found the item
 TSplitView.ToggleSplitView - tab (7FEEBB2FCD00),
 SplitEditor(), Splitter ()
 TSplitView.ToggleSplitView - CleanResources - Going to free
 SplitEditor () and Splitter ()
 TSplitView.ToggleSplitView - CleanResources - tab.SplitEditor is not 
 allocated
 TSplitView.ToggleSplitView - CleanResources - Going to free tab.Splitter

 The above was wrong, the checking did find that it was not allocated,
 the text itself was wrong, and fixed it

 TSplitView.SetEditor - Editor (


Forgot to mention: FPC 2.6.0 with Arch Linux 64 bit

 Am I doing something wrong here ?
 If so, what is the best way to solve it ?


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


Re: [fpc-pascal] Changing variable in conditional

2013-01-08 Thread ik
On Tue, Jan 8, 2013 at 10:44 AM, Krzysztof dib...@wp.pl wrote:
 Hi,

 I like when Free Pascal trying to implement best practices from other
 languages. That was with increment variable using assign operator: i += 1.
 Anyway, few days ago I analyzed C++ code and I liked one syntax:

 if ( ( i = GetSomeValue ) = 10 ) {
   // variable i already has value returned by GetSomeValue
 }

 I wonder if FPC has equivalent for this.

No, and thanks Wirth for that, and for FPC/Delphi devs for not adding it up.
It's one of the worst possible features ever existed in programming
languages, and the cause for many bugs


 Regards

 ___
 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] length for long ansistring = segment fault

2012-12-03 Thread ik
Hello,

When I try to get the length of AnsiString, it returns me segment fault.
I'm not sure if I'm doing something wrong:

var
  s : AnsiString;
  l : word;

begin
  SetLength(s, 1024);
  FillChar(s, 1024, '*');
  l := Length(s); // seg fault here
  writeln(l);
end.

Am I doing here something wrong ?

fpc 2.6.0 x86_64 linux

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


Re: [fpc-pascal] length for long ansistring = segment fault

2012-12-03 Thread ik
On Mon, Dec 3, 2012 at 12:13 PM, Michael Van Canneyt
mich...@freepascal.org wrote:


 On Mon, 3 Dec 2012, ik wrote:

 Hello,

 When I try to get the length of AnsiString, it returns me segment fault.
 I'm not sure if I'm doing something wrong:

 var
  s : AnsiString;
  l : word;

 begin
  SetLength(s, 1024);
  FillChar(s, 1024, '*');


 You are overwriting the pointer. S is (behind the scenes) a pointer to a
 memory area. You should do FillChar(s[1], 1024, '*');

Right :( Thanks


 Michael.
 ___
 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] length for long ansistring = segment fault

2012-12-03 Thread ik
On Mon, Dec 3, 2012 at 1:00 PM, Michael Van Canneyt
mich...@freepascal.org wrote:


 On Mon, 3 Dec 2012, Jonas Maebe wrote:


 On 03 Dec 2012, at 11:52, Michael Van Canneyt wrote:

 On Mon, 3 Dec 2012, Jonas Maebe wrote:

 On 03 Dec 2012, at 11:13, Michael Van Canneyt wrote:

 You are overwriting the pointer. S is (behind the scenes) a pointer to
 a memory area. You should do FillChar(s[1], 1024, '*');


 Or use http://www.freepascal.org/docs-html/rtl/system/stringofchar.html


 I was considering answering with that too, but I didn't feel like
 checking how it is implemented, to judge the speed penalty :)


 It definitely doesn't have the ask the mailing list because I made a
 mistake-penalty :)


 Checked anyway now. Stringofchar uses fillchar internally, so it's better to
 use that.

I completely forgot about it, if I would remember it, I would have
used it in the first place


 Michael.

 ___
 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] Casting UTF8String, WideString and UnicodeString into AnsiString and vice versa

2012-12-03 Thread ik
Hello,

I made casting of UTF8String, WideString and UnicodeString to AnsiString:
https://github.com/ik5/fp-msgpack/blob/master/src/msgpack.pas#L452

As an example.

My tests works. but are there things/contents that can break this
casting, or change the content itself in some way ?

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


Re: [fpc-pascal] Casting UTF8String, WideString and UnicodeString into AnsiString and vice versa

2012-12-03 Thread ik
On Mon, Dec 3, 2012 at 7:31 PM, Jonas Maebe jonas.ma...@elis.ugent.be wrote:

 On 03 Dec 2012, at 18:12, ik wrote:

 I made casting of UTF8String, WideString and UnicodeString to AnsiString:
 https://github.com/ik5/fp-msgpack/blob/master/src/msgpack.pas#L452

 As an example.

 My tests works. but are there things/contents that can break this
 casting, or change the content itself in some way ?

 It creates a new temporary string with the default code page for that string 
 type (e.g., DefaultSystemCodePage for ansistring), and converts the original 
 string's content to this new encoding.

Isn't that only 2.7.1 feature ?!



 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


Re: [fpc-pascal] Change Endian of String types

2012-11-26 Thread ik
On Mon, Nov 26, 2012 at 10:29 AM, Vincent Snijders
vincent.snijd...@gmail.com wrote:


 2012/11/26 ik ido...@gmail.com

 Hello,

 Is there a way to convert endian of a string (from little to big and
 vice versa) ?

 What kind of string you want to convert? For example a PChar is trivial.

ShortString, AnsiString, UTF8String, WideString and UnicodeString :)


 Vincent

 ___
 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] Change Endian of String types

2012-11-26 Thread ik
On Mon, Nov 26, 2012 at 10:42 AM, ik ido...@gmail.com wrote:
 On Mon, Nov 26, 2012 at 10:29 AM, Vincent Snijders
 vincent.snijd...@gmail.com wrote:


 2012/11/26 ik ido...@gmail.com

 Hello,

 Is there a way to convert endian of a string (from little to big and
 vice versa) ?

 What kind of string you want to convert? For example a PChar is trivial.

 ShortString, AnsiString, UTF8String, WideString and UnicodeString :)

Should ReverseString work just as well ? :)



 Vincent

 ___
 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] Change Endian of String types

2012-11-25 Thread ik
Hello,

Is there a way to convert endian of a string (from little to big and
vice versa) ?

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


[fpc-pascal] chr does not return an error when number bigger then byte enters

2012-11-14 Thread ik
Hello,

I'ved started a crossaide against PHP
(http://idkn.wordpress.com/2012/11/14/why-php-must-be-abandoned-in-my-opinion/),
due to few issues it have such as chr(256) will return ascii 0.
But then I tested it with FPC, and it acts exactly the same, while
many programming languages report on such value range check error.

begin
  writeln(chr(256)); // because it is constant, the compiler only yell warning
end.

Why does FPC allow such value to enter chr without raising something up ?

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


[fpc-pascal] array of const with cdecl procedure

2012-11-11 Thread ik
Hello,

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

I created something like this:

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

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


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

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


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

2012-11-11 Thread ik
On Sun, Nov 11, 2012 at 2:54 PM, Sven Barth pascaldra...@googlemail.com wrote:
 On 11.11.2012 13:40, ik wrote:

 Hello,

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

 I created something like this:

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

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


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


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

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


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


Re: [fpc-pascal] wayland support for FPC

2012-11-09 Thread ik
On Thu, Nov 8, 2012 at 11:38 PM, Sven Barth pascaldra...@googlemail.com wrote:
 On 08.11.2012 22:35, ik wrote:

 Hello,

 It seems that many GUI toolkits are slowly starting to move to wayland
 (http://wayland.freedesktop.org/), that moved to v1.0
 Is there anyone who currently working on binding for it for FPC ?


 It might be better to ask this on the Lazarus list as Wayland support seems
 to require more than just the API binding (at least as far as I have
 understood it).

I'm not sure why, because as far as I know, it replaces the X11
protocol, not gdk, Qt etc...
It also provide compositing window manager based support - that is to
create window managers (such as kwin).

But I'll ask there as well :)


 Regards,
 Sven

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


Re: [fpc-pascal] wayland support for FPC

2012-11-09 Thread ik
On Fri, Nov 9, 2012 at 1:06 PM, Graeme Geldenhuys
gra...@geldenhuys.co.uk wrote:
 On 2012-11-09 10:42, Marco van de Voort wrote:
 IOW, I wouldn't desperately try to support Wayland native at this point.

 That can be done if the native api turns out to be stable, Wayland truely
 takes over X11, and all distros package it.

 Now it is just asking for pain IMHO.

 +1
 That's exactly how I feel. There has been too many attempts to displace
 X11 - and they all tanked. Wayland does seems to have more backing than
 its predecessors though.

 Bottom line, existing X11 apps will apparently continue to run on
 Wayland. So we have time…

Qt5 afaik, does not support X11 anymore, only wayland, and that's the
main path most Linux toolkits takes today.
v1.0 suppose to provide stable API afaik, that's what opendesktop
wrote at least.

I looked at the API headers, and it looks very simple +-, but I'm not
going to bind it at this time.


 Regards,
   - Graeme -

 ___
 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] working witg UCS4Char

2012-11-09 Thread ik
Hello,

I'm trying to work with UCS4Char (for this:
https://github.com/ik5/fp-msgpack), but I can't figure out how to do
it.
For example, if do the following:

---
{$H+}
uses cwstring;

var
 ch : UCS4Char;

begin
  ch := #$233B4;
  writeln(ch);
end.
---

I get the following error:
ppcx64 test.pas
Free Pascal Compiler version 2.6.0 [2012/05/17] for x86_64
Copyright (c) 1993-2011 by Florian Klaempfl and others
Target OS: Linux for x86-64
Compiling test.pas
test.pas(8,9) Error: Illegal char constant
test.pas(8,9) Error: Incompatible types: got Constant String
expected UCS4Char
test.pas(11) Fatal: There were 2 errors compiling module, stopping
Fatal: Compilation aborted


And if I do it without the hash, then it's just a number

So how can I use it ?

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


Re: [fpc-pascal] working witg UCS4Char

2012-11-09 Thread ik
On Fri, Nov 9, 2012 at 5:16 PM, Jonas Maebe jonas.ma...@elis.ugent.be wrote:

 On 09 Nov 2012, at 16:06, ik wrote:

 And if I do it without the hash, then it's just a number


 UCS4Char is in fact just a number, and UCS4String is just a dynamic array of
 cardinal. UCS4 is not implemented as a complete string type in FPC (or
 Delphi, for that matter).

Cardinal is a bit problematic type, you mean longword. :)

Thanks



 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


Re: [fpc-pascal] working witg UCS4Char

2012-11-09 Thread ik
On Fri, Nov 9, 2012 at 6:12 PM, Tomas Hajny xhaj...@hajny.biz wrote:
 On Fri, November 9, 2012 17:01, ik wrote:
 On Fri, Nov 9, 2012 at 5:16 PM, Jonas Maebe jonas.ma...@elis.ugent.be
 wrote:
 On 09 Nov 2012, at 16:06, ik wrote:

 And if I do it without the hash, then it's just a number


 UCS4Char is in fact just a number, and UCS4String is just a dynamic
 array of
 cardinal. UCS4 is not implemented as a complete string type in FPC (or
 Delphi, for that matter).

 Cardinal is a bit problematic type, you mean longword. :)

 Why do you see cardinal as a problematic type? At least for FPC it is a
 simple alias to longword (and it has actually existed even before longword
 in FPC).

At least with Delphi it has unclear what exactly the size of it.
And the following code:
https://github.com/ik5/fp-msgpack/blob/master/src/msgpack.pas#L528

Used to be with Cardinal (the only difference), and It never acted as expected.
The only thing I changed was from cardinal to longword, and it acts as expected.


 Tomas


 ___
 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] working witg UCS4Char

2012-11-09 Thread ik
On Fri, Nov 9, 2012 at 6:56 PM, Tomas Hajny xhaj...@hajny.biz wrote:
 On Fri, November 9, 2012 17:38, ik wrote:
 On Fri, Nov 9, 2012 at 6:12 PM, Tomas Hajny xhaj...@hajny.biz wrote:
 On Fri, November 9, 2012 17:01, ik wrote:
 On Fri, Nov 9, 2012 at 5:16 PM, Jonas Maebe jonas.ma...@elis.ugent.be
 wrote:
 On 09 Nov 2012, at 16:06, ik wrote:

 And if I do it without the hash, then it's just a number


 UCS4Char is in fact just a number, and UCS4String is just a dynamic
 array of
 cardinal. UCS4 is not implemented as a complete string type in FPC (or
 Delphi, for that matter).

 Cardinal is a bit problematic type, you mean longword. :)

 Why do you see cardinal as a problematic type? At least for FPC it is
 a
 simple alias to longword (and it has actually existed even before
 longword
 in FPC).

 At least with Delphi it has unclear what exactly the size of it.
 And the following code:
 https://github.com/ik5/fp-msgpack/blob/master/src/msgpack.pas#L528

 Used to be with Cardinal (the only difference), and It never acted as
 expected.
 The only thing I changed was from cardinal to longword, and it acts as
 expected.

 With Delphi or with FPC? As already mentioned, FPC defines cardinal as an
 alias to longword (and UInt32 mentioned in your reference as an alias to
 cardinal) so there should be no difference between cardinal, longword and
 UInt32 (and in the past, cardinal was even the primary type in FPC
 directly known by the compiler).

 With Delphi, I believe that very old Delphi versions defined cardinal as a
 31-bit type (i.e. simply the non-negative part of the longint range), but
 I also believe (while not using Delphi at all myself) that all currently
 relevant Delphi versions (i.e. not considering things like Delphi 1.0 and
 Delphi 2.0 which probably didn't support longword anyway) define cardinal
 as equal to longword.

With FPC. The value was saved wrong.
The only thing that I changed in my code was moving from Cardinal to LongWord.

I do not own Delphi or Windows copy for many years now :)


 Tomas


 ___
 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] wayland support for FPC

2012-11-08 Thread ik
Hello,

It seems that many GUI toolkits are slowly starting to move to wayland
(http://wayland.freedesktop.org/), that moved to v1.0
Is there anyone who currently working on binding for it for FPC ?

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


[fpc-pascal] What is the size of AnsiChar

2012-11-05 Thread ik
Hello,

As I understand, AnsiString and AnsiChar contain the environment type
of string (it can be ISO8859x, utf-8 etc...).
If that so, how can I know the size (in bytes) of AnsiChar ?

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


Re: [fpc-pascal] What is the size of AnsiChar

2012-11-05 Thread ik
On Mon, Nov 5, 2012 at 1:18 PM, Tomas Hajny xhaj...@hajny.biz wrote:
 On Mon, November 5, 2012 11:49, ik wrote:


 Hello Ido,

 As I understand, AnsiString and AnsiChar contain the environment type
 of string (it can be ISO8859x, utf-8 etc...).
 If that so, how can I know the size (in bytes) of AnsiChar ?

 As far as I understand it, AnsiChar is always 1 byte, i.e. it cannot hold
 (whole) multi-byte encoded characters like UTF-8 (at least at the moment;
 I'm not sure if this is supposed to stay like that also in the future or
 not).

Thank you


 HTH

 Tomas


 ___
 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] Testing if exception raised in fpcUnit

2012-11-05 Thread ik
Hello,

I wish to test if a method has raised an exception for a value
(something that should make the test pass) or not.

For example:

function TestNum(ch : Char) : Byte;
begin
  if UpCase(ch) in ['A'..'F', '0'..'9'] then
...
  else
raise Exception.Create('Invalid char was given.');
end;

I want to test the code with Char like 'y' for example, to make sure
that it does raises the exception.


Does AssertException is the proper method for such test ?

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


Re: [fpc-pascal] Testing if exception raised in fpcUnit

2012-11-05 Thread ik
On Mon, Nov 5, 2012 at 2:45 PM, Michael Van Canneyt
mich...@freepascal.org wrote:


 On Mon, 5 Nov 2012, ik wrote:

 Hello,

 I wish to test if a method has raised an exception for a value
 (something that should make the test pass) or not.

 For example:

 function TestNum(ch : Char) : Byte;
 begin
  if UpCase(ch) in ['A'..'F', '0'..'9'] then
...
  else
raise Exception.Create('Invalid char was given.');
 end;

 I want to test the code with Char like 'y' for example, to make sure
 that it does raises the exception.


 Does AssertException is the proper method for such test ?


 Yes.

So how do I do it ?

TRunMethod = procedure of object;

If I pass it a function, it don't really like it:

AssertException(ExceptionWasNotRaisd, EMsgPackWrongType, @MsgPackType.AsByte);

convert_testcase.pas(592,60) Error: Incompatible type for arg no. 3:
Got procedure variable type of function:Byte of object;Register,
expected procedure variable type of procedure of object;Register



 Michael.
 ___
 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] Testing if exception raised in fpcUnit

2012-11-05 Thread ik
On Mon, Nov 5, 2012 at 3:15 PM, Graeme Geldenhuys
gra...@geldenhuys.co.uk wrote:
 On 2012-11-05 13:07, Michael Van Canneyt wrote:

 This will not detect if no exception is raised, only if the right
 exception is raised in case one is raised.


 You are correct. An extra test is needed just before the except block.
 As your example shows, simply calling Fail(...) if no exception was raised.

That's what I'ved done

Thanks :)



 Regards,
   - Graeme -

 ___
 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] weird printout of char

2012-11-05 Thread ik
Hello,

I have a program like this:

-
program print;
begin
  writeln(#$d790); // Should print א
end.
--

I print this to a file:

./program  file

In hex editor the value 3F A0

It also the same on normal terminal.

I'm using Free Pascal Compiler version 2.6.0 [2012/05/17] for x86_64
Under Linux.

What am I missing or doing wrong ?

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


Re: [fpc-pascal] weird printout of char

2012-11-05 Thread ik
On Mon, Nov 5, 2012 at 4:39 PM, Jonas Maebe jonas.ma...@elis.ugent.be wrote:

 On 05 Nov 2012, at 15:25, ik wrote:

 I have a program like this:

 -
 program print;
 begin
  writeln(#$d790); // Should print א
 end.
 --

 [snip]

 What am I missing or doing wrong ?


 a) add uses cwstring to get a full unicodestring manager in your program

When using cwstring, it writes $ED $9E $90 $0A
The Only correct char here is $0A (\n).

 b) the unicode code point for א is $05d0, not $d790

I'm trying to use UTF-8, not UTF-16 ($05d0 is UTF-16 values)



 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


Re: [fpc-pascal] weird printout of char

2012-11-05 Thread ik
On Mon, Nov 5, 2012 at 3:41 PM, Ewald
bloody.middlefin...@yellowcouch.org wrote:
 Try this: (a char is only one byte, you're trying to print a multi-byte
 character: print multiple one-byte characters)
 WriteLn(#$d7, #$90);

Breaking it into two bytes works.



 On 11/05/2012 03:25 PM, ik wrote:
 Hello,

 I have a program like this:

 -
 program print;
 begin
   writeln(#$d790); // Should print א
 end.
 --

 I print this to a file:

 ./program  file

 In hex editor the value 3F A0

 It also the same on normal terminal.

 I'm using Free Pascal Compiler version 2.6.0 [2012/05/17] for x86_64
 Under Linux.

 What am I missing or doing wrong ?

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



 --
 Ewald

 Events don't necessarily happen in chronological order; yet somehow they do 
 persist to happen. Sometimes.

 ___
 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] weird printout of char

2012-11-05 Thread ik
On Mon, Nov 5, 2012 at 5:38 PM, Jonas Maebe jonas.ma...@elis.ugent.be wrote:

 ik wrote on ma, 05 nov 2012:


 On Mon, Nov 5, 2012 at 4:39 PM, Jonas Maebe jonas.ma...@elis.ugent.be
 wrote:


 On 05 Nov 2012, at 15:25, ik wrote:

 I have a program like this:

 -
 program print;
 begin
  writeln(#$d790); // Should print א

 [snip]

 I'm trying to use UTF-8, not UTF-16 ($05d0 is UTF-16 values)


 #$ means define a widechar constant with this value, and widechars are
 always UTF-16. As mentioned in your later mail, if you want to define
 individual byte values, you have to define them as individual bytes.

you are right, sorry.
All work and not enough sleep ... :)




 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] FPCUnit checking Single values

2012-11-02 Thread ik
Hello,

I'm trying to check Single value.

I'm doing the following:

a := 1.1;
b := 1.1;
CheckEquals(a, b, Format('val %f does not equal %f', [a, b]));

It reports an error, one of them are 1.1 and the other is 1,10 .
I know about the possible drifts of floating points, but how can I
create a test for such type of values ?

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


Re: [fpc-pascal] FPCUnit checking Single values

2012-11-02 Thread ik
On Fri, Nov 2, 2012 at 4:01 PM,  michael.vancann...@wisa.be wrote:


 On Fri, 2 Nov 2012, ik wrote:

 Hello,

 I'm trying to check Single value.

 I'm doing the following:

 a := 1.1;
 b := 1.1;
 CheckEquals(a, b, Format('val %f does not equal %f', [a, b]));

 It reports an error, one of them are 1.1 and the other is 1,10 .
 I know about the possible drifts of floating points, but how can I
 create a test for such type of values ?


 Use the delta:

 class procedure AssertEquals(const AMessage: string; Expected, Actual,
 Delta: double); overload;

 or, if you insist on using the Delphi compatibility layer:

 class procedure CheckNotEquals(expected: extended; actual: extended; delta:
 extended = 0; msg: string = ''); overload; virtual;

Thanks, and It helped me also find that the current drift was a bug in
my own code as well :)


 Michael.
 ___
 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] convert floating point to bcd and vice versa

2012-11-01 Thread ik
Hello,

I need to convert floating point (Single and Double) to an array of
bytes (BCD) and vice versa.
Are there any existed implementation for it ?

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


Re: [fpc-pascal] convert floating point to bcd and vice versa

2012-11-01 Thread ik
On Thu, Nov 1, 2012 at 3:17 PM, Ewald
bloody.middlefin...@yellowcouch.org wrote:
 On 11/01/2012 12:22 PM, ik wrote:
 Hello,

 I need to convert floating point (Single and Double) to an array of
 bytes
 PByte(@YourVariable)[0]
 through
 PByte(@YourVariable)[SizeOf(YourVariable)-1] ?

 Or, if you have an array of SizeOf(YourVariable) bytes, you could do
 something like this:
 Move(YourVariable, YourArray[0], SizeOf(YourVariable))

 (note that you might want to take endianess into account, but I don't
 know if this applies to floats as it does to integers)

Thanks


 --
 Ewald

 Events don't necessarily happen in chronological order; yet somehow they do 
 persist to happen. Sometime.

 ___
 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] Two and one compliment converting functions

2012-10-30 Thread ik
Hello,

Does FPC contain any functions to convert between One Compliment
(http://en.wikipedia.org/wiki/Ones%27_complement)
to Two Compliment (http://en.wikipedia.org/wiki/Two%27s_complement)
and vice versa ?

I ask this before I'll implement it on my own :)

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


Re: [fpc-pascal] OT: Creating a site to contain Pascal units, libraries etc

2012-10-30 Thread ik
On Tue, Oct 30, 2012 at 2:29 AM, Jeppe Græsdal Johansen
jjoha...@student.aau.dk wrote:
 Den 30-10-2012 01:04, ik skrev:

 Hello,

 There are many places such as GitHub, Google Code, Sourceforge etc,
 that hosts a lot of open source projects, libraries etc for
 FPC/Pascal.
 On the other hand we have fppkg that can have repositories and able to
 allow us remote download and install of code.

 Ruby has the following web site that allow you to find and have a
 single place to install such things:
 https://rubygems.org/

 I think that web site like this, with the ability to add fppkg sources
 that other can look for and install will benefit everyone, reduce
 duplicate work, and
 help us find Pascal tools :)

 What do you think ?

 Ido

 * I sent it originally for FPC-Others, but it does not appear there
 even in the archive
 ___
 fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
 http://lists.freepascal.org/mailman/listinfo/fpc-pascal

 I like the idea, but who can make such a site?

 There are many different more or less dormant or noisy pages around the net
 sometimes with sourcecode, but much of the time dead links. And when you
 finally end up those places things are locked into broad categories with
 1000's of entries to wade through. And there's no way to measure how good
 the stuff actually is except for downloading it and looking at it, finding
 out when it was last updated, licenses, supportt, etc.

 Some ideas:
 - Allow limited hosting of open-source text source files(they compress well
 so it doesn't take up much hosting space).
 - Allow projects to be tagged with arbitrary tags instead of having
 categories, and let users vote tags up or down.
 - Require basic information which can be easily presented: Source license,
 tested+supported platforms, external requirements, contact information, etc.
 - If the project dies then allow users to specify new locations that
 eventual forked source can be found at.


My idea is more about finding tools then to host them.
fppkg allow us to create packages to be installed from remote, and
also look for such things.
So why not harness it to the point that we can find libraries and
tools at one place, regardless of the place the code actually hosts ?

 Regards,
 Jeppe

 ___
 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] Range check error while evaluating constants

2012-10-30 Thread ik
Hello,

I have the following function:

function OneToTwoComplement(AValue: QWord): QWord;
begin
  Result := (AValue xor $) + 1;
end;

What am I missing here that makes the compiler complain about Range
check error while evaluating constants ?
Why doesn't it complain on :

function OneToTwoComplement(AValue: Int64): Int64;
begin
  Result := (Abs(AValue) xor $) + 1;
end;


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


[fpc-pascal] Re: Range check error while evaluating constants

2012-10-30 Thread ik
On Tue, Oct 30, 2012 at 4:26 PM, ik ido...@gmail.com wrote:
 Hello,

 I have the following function:

 function OneToTwoComplement(AValue: QWord): QWord;
 begin
   Result := (AValue xor $) + 1;
 end;

 What am I missing here that makes the compiler complain about Range
 check error while evaluating constants ?
 Why doesn't it complain on :

 function OneToTwoComplement(AValue: Int64): Int64;
 begin
   Result := (Abs(AValue) xor $) + 1;
 end;


 Thanks,
 Ido

How I love to be completely ignored
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Range check error while evaluating constants

2012-10-30 Thread ik
On Tue, Oct 30, 2012 at 10:10 PM, Mark Morgan Lloyd
markmll.fpc-pas...@telemetry.co.uk wrote:
 ik wrote:

 Hello,

 I have the following function:

 function OneToTwoComplement(AValue: QWord): QWord;
 begin
   Result := (AValue xor $) + 1;
 end;

 What am I missing here that makes the compiler complain about Range
 check error while evaluating constants ?
 Why doesn't it complain on :

 function OneToTwoComplement(AValue: Int64): Int64;
 begin
   Result := (Abs(AValue) xor $) + 1;
 end;


 What happens in the first case if you cast that constant to a QWord?

The compiler stop reporting warnings


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

 [Opinions above are the author's, not those of his employers or colleagues]

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


Re: [fpc-pascal] Best way to transfer data between applications?

2012-10-29 Thread ik
On Mon, Oct 29, 2012 at 5:52 AM, 印場 乃亜 shir...@galapagossoftware.com wrote:
 Greetings,

 I am familiar with the basic underlying methods available for transferring 
 data between processes on Windows and Unix, i.e. Pipes, Shared memory, and 
 TCP/IP - but what I am not familiar with is any higher level functionality 
 that may be available on FPC.

 As an example:  I have one application with a daemon that uses the IPC 
 component to write to a file in CSV format, and then the user application 
 reads this (GPS location) data via IPC.  Then I have to re-convert this 
 string data into a series of floating point values manually, though.  The IPC 
 component doesn't seem to be reliable on all platforms either (it sometimes 
 blocks on OS X, and at least the debug client doesn't seem to work at all on 
 Windows 7).

 Another disadvantage is that the sequence of launching the applications 
 matters, and what's more, it seems there can only be one client per 
 server in many cases.

 More to the point, if I want to pass around structures, records, etc.between 
 processes - what is the best day?  For example, Javascript uses JSON.  I know 
 there are JSON libraries and various other libraries for Pascal - but I don't 
 know what is the most standard way.  (I think this kind of 
 marshalling/unmarshalling may be more standard in Java and C#, but I don't 
 know the normal way in Delphi/FPC).

 I would prefer to use built-in functionality, rather than learn yet another 
 library - and if learning a library, I would prefer to use one with lots of 
 users that is actively maintained.  Likewise, I would prefer to actually 
 pass the data, rather than just pass a pointer to it.  I plan to have the 
 processes run on the same machine, so I don't need a solution that works with 
 networking, though that would be fine, of course.

 Along the same lines, a convenient way to call functions/procedures with 
 parameters from the other process would be greatly appreciated.  (i.e. 
 something like RPC that handles OOP).

I'm writing at the moment support for msgpack (http://msgpack.org/) in
plain FPC (object pascal style):
https://github.com/ik5/fp-msgpack

I will also implement the rpc version.

MsgPack allow you to take data, including JSON and convert it into
bytes that represent the data.
It contain smaller version of the same way that JSON does it for example.



 Thank you,
  Noah Silva


 ___
 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] OT: Creating a site to contain Pascal units, libraries etc

2012-10-29 Thread ik
Hello,

There are many places such as GitHub, Google Code, Sourceforge etc,
that hosts a lot of open source projects, libraries etc for
FPC/Pascal.
On the other hand we have fppkg that can have repositories and able to
allow us remote download and install of code.

Ruby has the following web site that allow you to find and have a
single place to install such things:
https://rubygems.org/

I think that web site like this, with the ability to add fppkg sources
that other can look for and install will benefit everyone, reduce
duplicate work, and
help us find Pascal tools :)

What do you think ?

Ido

* I sent it originally for FPC-Others, but it does not appear there
even in the archive
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] creating msgpack port to Pascal

2012-10-10 Thread ik
Hi List,

I've started working on porting msgpack (messagepack.org) to native
FreePascal code: (https://github.com/ik5/fp-msgpack).
If you do not know it, then it's a way to move data around with
minimal amount of bytes in process.
It was designed to take things like JSON and translate it into bytes
that takes less space.

It compresses data (I call it packing) to a byte notation, and you
can unpack it back again to the original data.
Numbers bigger then a byte, are always saves as Big Endian, and you
can it support also strings (it called raw in the terminology),
arrays and maps (key value) objects.

It's not made for human readability but for network connections for example.

With my implementation I had the following idea is to do things:
1. Create low level API (procedure based)
2. Create higher level API (classes that binds things togather)
3. Create JSON to msgpack to JSNO converters.

However I dislike the API way that I'm currently started to do, and I
am looking for better ideas in the subject.

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


[fpc-pascal] What version of FPC should I use to develop android application ?

2012-09-27 Thread ik
Hello,

In order to use FPC jvm for android, what version should I be using of FPC ?
I tried to compile FPC 2.7.1 r22465. It complains on:

symdef.pas(620,38) Error: Identifier not found TAsmList

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


[fpc-pascal] does FPC support static variable inside a procedure ?

2012-09-27 Thread ik
Hello,

Is there a way to create a static variable inside a procedure ?
The following code:

procedure static_variable;
var static_var : Integer = -1;
begin
  inc(static_var);
  writeln('static_var ', static_var);
end;

begin
  while true do
begin
  static_variable;
  sleep(1000);
end;
end.


Always print 0 as the answer.

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


Re: [fpc-pascal] variant.inc(82, 10) Error: Illegal type conversion: Text to TextRec

2012-08-24 Thread ik
On Sat, Aug 25, 2012 at 1:07 AM, Sven Barth pascaldra...@googlemail.comwrote:

 Am 24.08.2012 21:21 schrieb Jonas Maebe jonas.ma...@elis.ugent.be:

 
 
  On 24 Aug 2012, at 20:52, ik wrote:
 
   For two weeks now, I have the following error message with FPC 2.7.1:
   variant.inc(82,10) Error: Illegal type conversion: Text to TextRec
  
   I'm currently on r22233. Arch Linux 64 bit.
   The last build of FPC 2.7.1 I made was:
   Free Pascal Compiler version 2.7.1 [2012/08/04] for x86_64
  
   Is it something with my old build, or is it an known issue that have
 not
   been fixed yet ?
 
  It is something with your old build, namely the fact that it is not the
 latest release (2.6.0 at this time). Building svn versions is only
 supported if your starting compiler is the latest release.

 Sometimes I wonder if we should put this on some prominent place on the
 website...

Amm, it's a big problem.

You are saying that the development version can not compile itself.
And I can never test it myself, or use tools such as development version of
Lazarus for example, that should use it.


 Regards,
 Sven

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

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

Re: [fpc-pascal] variant.inc(82, 10) Error: Illegal type conversion: Text to TextRec

2012-08-24 Thread ik
On Sat, Aug 25, 2012 at 1:48 AM, Jonas Maebe jonas.ma...@elis.ugent.bewrote:


 On 25 Aug 2012, at 00:37, ik wrote:

  On Sat, Aug 25, 2012 at 1:07 AM, Sven Barth pascaldra...@googlemail.com
 wrote:
 
  Am 24.08.2012 21:21 schrieb Jonas Maebe jonas.ma...@elis.ugent.be:
 
  It is something with your old build, namely the fact that it is not the
  latest release (2.6.0 at this time). Building svn versions is only
  supported if your starting compiler is the latest release.
 
  Sometimes I wonder if we should put this on some prominent place on the
  website...
 
  Amm, it's a big problem.

 What would be a big problem, would be having to support compilation of the
 current svn reversion with every possible earlier svn reversion.


Doesn't 2.7.1 is the current development version ?



  You are saying that the development version can not compile itself.

 It can, but only the same svn revision. To compile a new revision, you
 always have to start from the latest release.

  And I can never test it myself, or use tools such as development version
 of
  Lazarus for example, that should use it.

 I don't understand what you mean with this.


 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] printing each Friday the 13 using Pascal

2012-08-06 Thread ik
Hi list,

A friend of mine started a hobby project:
Printing every Friday the 13, in a range of 5
yearshttp://blogs.perl.org/users/sawyer_x/2012/07/yet-another-friday-the-13th.html
.

I lack of the time for doing it at the moment, and I wish to add to his
github https://github.com/xsawyerx/yet-another-friday-the-13th/ also
Pascal (and show how much simpler it is then C) implementation.
Is there anyone here that might be interested in this ?

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

[fpc-pascal] Writing an outlook addons in FPC

2012-06-24 Thread ik
Hello,

What is require in order to develop addons for MS Outlook using FPC ?
Are there any existed headers that where bind to Pascal that does it ?

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

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-21 Thread ik
On Wed, Jun 20, 2012 at 2:15 PM, Inoussa OUEDRAOGO inouss...@gmail.comwrote:

  Think of a plug-able system.  I have an engine, and code to execute.
  Instead of compile everything to an ELF/PE, I place code on dynamic shard
  library, and load it on run time when needed.
 
  The idea is that the engine will not be rewritten for every new request
  (that comes often), because it's logic (almost) never changes, but to
 load
  code on demand that often changes, provide additional functions, changes
 of
  logic, bug fixes etc...

 WST library server implementation could be a elegant solution : it is
 web-services that are
 locally located in dynamic library(DLL)/shared object(so) instead of
 being remote. The main
  executable acts as client while the server's implementation as
 provided as shared objects.
 No TCP is used, only memory through the WST's library protocol. No
 SOAP serialization
 as you can use the WST's custom binary messaging format that is very fast.

 To resume :
  * The main executable defines a WSDL schema that contains the types
 (think of this as IDL)
  * The servers implement the service exposed in the schema.
  * The main executable loads the servers using the library protocol

 Main benefits are :
  * much larger type system available (wsdl, WST contains a type library
 editor)
  * you could later even add remote servers without changing your main
 application,
just create the service with the desired location parameters.


Thank you, I'll check it out. My problem is something like with WDSL idea.





 --
 Inoussa O.


Ido


 ___
 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] Adding method dynamically to a class

2012-06-20 Thread ik
On Wed, Jun 20, 2012 at 8:33 AM, LacaK la...@zoznam.sk wrote:

 **
 Class helpers would not help ?

 http://wiki.freepascal.org/Helper_types



They can, but there is a protocol that I'm trying to create that provides
me information what to execute (out of white list). The thing is, that the
first request maps the methods to be used, and there could be 2 or 200. To
implement 200 methods that might be used is not a good idea imho, but
adding the proper method to the instance/class will work much better.

It's easy to do in dynamic language, and I might need to implement it there
instead :(



 -Laco.



   Hello,

 Is there a way to tell in run-time that a specific function/procedure
 should belong to a class ?

 For example, let's say I have the following class:

 Type
   TTest = class
 procedure Foo;
   end;

 And I have also:

 procedure Bar;
 ...
 end;



 ___
 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] Adding method dynamically to a class

2012-06-20 Thread ik
On Wed, Jun 20, 2012 at 10:20 AM, michael.vancann...@wisa.be wrote:



 On Wed, 20 Jun 2012, ik wrote:

  On Wed, Jun 20, 2012 at 8:33 AM, LacaK la...@zoznam.sk wrote:

  **

 Class helpers would not help ?

 http://wiki.freepascal.org/**Helper_typeshttp://wiki.freepascal.org/Helper_types



 They can, but there is a protocol that I'm trying to create that provides
 me information what to execute (out of white list). The thing is, that the
 first request maps the methods to be used, and there could be 2 or 200. To
 implement 200 methods that might be used is not a good idea imho, but
 adding the proper method to the instance/class will work much better.


 I don't understand this argument. The available methods must have an
 implementation somewhere anyway. That means your code does not get smaller
 by adding them dynamically.  Somewhere you must choose which method to
 execute, and whether it is allowed or not, so this logic must be present
 also. None of this requires dynamically adding methods as
 far as I can see, or is made easier by dynamically adding methods.

 So finally, what is gained by adding them dynamically ? Or what forces you
 to even consider this path ?


Think of a plug-able system.  I have an engine, and code to execute.
Instead of compile everything to an ELF/PE, I place code on dynamic shard
library, and load it on run time when needed.

The idea is that the engine will not be rewritten for every new request
(that comes often), because it's logic (almost) never changes, but to load
code on demand that often changes, provide additional functions, changes of
logic, bug fixes etc...

The idea of implementing it like so, came to me after few years now of
having the need to recreate the whole logic based of the code for every new
demand from the client (both as human, and as software). The main code
almost never changes, but so many additions, that I'm starting to use the
dynamic execution of methods, and now I realize, that if I'll extract it to
a shard library, it will be much easier to change, add etc... only the
actual need, and not to touch other stuff, and that requires me to design
an engine instead.

Regardless of that idea, it can be very interesting in learning how to do
it imho :)



 Michael


Ido


 __**_
 fpc-pascal maillist  -  
 fpc-pascal@lists.freepascal.**orgfpc-pascal@lists.freepascal.org
 http://lists.freepascal.org/**mailman/listinfo/fpc-pascalhttp://lists.freepascal.org/mailman/listinfo/fpc-pascal

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

Re: RE : RE : [fpc-pascal] Dynamically Execute method

2012-06-19 Thread ik
On Tue, Jun 19, 2012 at 10:38 AM, Ludo Brands ludo.bra...@free.fr wrote:


  As Bern said you can't call an object method without passing
  the reference to the instance. In this case you are lucky
  because TMyClass.SayHi doesn't use any properties or class
  vars. Add a property to TMyClass and try to writeln that
  property and you will see it fails. What you are doing here
  is calling SayHi as if it where a class method.
 

 Here is the correct way of doing it:

 function ExecMethod(Instance : TObject; Name : String) : Boolean;
 type
  TProc= procedure of object;
 var
  method : TMethod;
  exec:tproc;
 begin
  method.Data := Pointer(Instance);
  method.Code := Instance.MethodAddress(Name);
  Exec:=TProc(Method);
  Result := Assigned(method.Code);
  if Result then Exec;
 end;

 Output:

 From MyClass : Hi World from 482800
 Hi World from 482800
 From MyClass2 : Hi World from 482816
 Hi World from 482816

 Ludo


Thank you Ludo, Mattias and Bernd.
It works well now :)



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



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

[fpc-pascal] Adding method dynamically to a class

2012-06-19 Thread ik
Hello,

Is there a way to tell in run-time that a specific function/procedure
should belong to a class ?

For example, let's say I have the following class:

Type
  TTest = class
procedure Foo;
  end;

And I have also:

procedure Bar;
...
end;

Is there a way to make at some point of my code execution, that Bar will be
a method of TTest ?
Or maybe for a specific instance of TTest ?

Thanks,

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

Re: [fpc-pascal] Adding method dynamically to a class

2012-06-19 Thread ik
On Tue, Jun 19, 2012 at 4:13 PM, Mattias Gaertner nc-gaert...@netcologne.de
 wrote:

 **


 ik ido...@gmail.com hat am 19. Juni 2012 um 14:22 geschrieben:

   Hello,

 Is there a way to tell in run-time that a specific function/procedure
 should belong to a class ?

 For example, let's say I have the following class:

 Type
   TTest = class
 procedure Foo;
   end;

 And I have also:

 procedure Bar;
 ...
 end;

 Is there a way to make at some point of my code execution, that Bar will
 be a method of TTest ?
 Or maybe for a specific instance of TTest ?



 Do you mean that TTest.MethodAddress('bar') should return your Bar?


Yes, after adding it (glue) to the TTest class/instance.
Like with  some dynamic languages that allow you to create/attach methods
on run time.

 Yes.



 Mattias





 ___
 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] Dynamically Execute method

2012-06-18 Thread ik
Hi,

I'm playing a bit with the notion of execute a method dynamically on demand.
I'ved created the following PoC:
https://gist.github.com/2950789

It works, but for some strange reason, I find myself feeling that I'm
missing something, or it should be done differently.
Does this code written properly, or should I do it differently ?

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

Re: [fpc-pascal] Dynamically Execute method

2012-06-18 Thread ik
On Tue, Jun 19, 2012 at 12:51 AM, Bernd prof7...@googlemail.com wrote:

 2012/6/18 ik ido...@gmail.com:
  Hi,
 
  I'm playing a bit with the notion of execute a method dynamically on
 demand.
  I'ved created the following PoC:
  https://gist.github.com/2950789

 Souldn't this be

 Exec: procedure of object;

 instead of only procedure? Imho one pointer alone can not be enough,
 it should need the address of the procedure *and* the address of the
 object instance. Does your example work with multiple instances of the
 same class? If yes then I really don't understand why. But I also did
 not test it myself.


Seems to work for me, updated the example: https://gist.github.com/2950789

Or am O missing something ?


 ___
 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] header translation question, 64 bit problem

2012-06-17 Thread ik
On Sun, Jun 17, 2012 at 2:02 AM, Bernd prof7...@googlemail.com wrote:

 Hi,

 I am translating parts of the libpurple headers. Now I seem to have a
 problem with this:


 typedef enum
 {
PURPLE_PLUGIN_UNKNOWN  = -1,  /** Unknown type.*/
PURPLE_PLUGIN_STANDARD = 0,   /** Standard plugin. */
PURPLE_PLUGIN_LOADER, /** Loader plugin.   */
PURPLE_PLUGIN_PROTOCOL/** Protocol plugin. */

 } PurplePluginType;


 typedef int PurplePluginPriority;


 struct _PurplePluginInfo
 {
unsigned int magic;
unsigned int major_version;
unsigned int minor_version;
PurplePluginType type;   // -- maybe this is the
 problem?
char *ui_requirement;
unsigned long flags;
GList *dependencies;
PurplePluginPriority priority;

char *id;
char *name;
char *version;
char *summary;
char *description;
char *author;
char *homepage;

/**
 * If a plugin defines a 'load' function, and it returns FALSE,
 * then the plugin will not be loaded.
 */
gboolean (*load)(PurplePlugin *plugin);
gboolean (*unload)(PurplePlugin *plugin);
void (*destroy)(PurplePlugin *plugin);

void *ui_info; /** Used only by UI-specific plugins to build a
 preference screen with a custom UI */
void *extra_info;
PurplePluginUiInfo *prefs_info; /** Used by any plugin to display
 preferences.  If #ui_info has been specified, this will be ignored. */

/**
 * This callback has a different use depending on whether this
 * plugin type is PURPLE_PLUGIN_STANDARD or PURPLE_PLUGIN_PROTOCOL.
 *
 * If PURPLE_PLUGIN_STANDARD then the list of actions will show up
 * in the Tools menu, under a submenu with the name of the plugin.
 * context will be NULL.
 *
 * If PURPLE_PLUGIN_PROTOCOL then the list of actions will show up
 * in the Accounts menu, under a submenu with the name of the
 * account.  context will be set to the PurpleConnection for that
 * account.  This callback will only be called for online accounts.
 */
GList *(*actions)(PurplePlugin *plugin, gpointer context);

void (*_purple_reserved1)(void);
void (*_purple_reserved2)(void);
void (*_purple_reserved3)(void);
void (*_purple_reserved4)(void);
 };



 I have translated it as follows:


you have few problems here.
1. Please use ctypes instead, they are set to work properly with 64 bit
etc.. and are properly sized to fit C's type sizes.
For example C's int, is not equal to Pascal's Integer, but to longint of
Pascal




 {$calling cdecl}

 type
  TPurplePluginType = (
PURPLE_PLUGIN_UNKNOWN  := -1,  // Unknown type.
PURPLE_PLUGIN_STANDARD := 0,   // Standard plugin.
PURPLE_PLUGIN_LOADER,  // Loader plugin.
PURPLE_PLUGIN_PROTOCOL // Protocol plugin.
  );

  TPurplePluginPriority = Integer;

  TPurplePluginInfo = packed record
magic: Integer;
major_version: Integer;
minor_version: Integer;
plugintype: TPurplePluginType;
ui_requirement: PChar;
flags: LongInt;
dependencies: PGList;
priority: TPurplePluginPriority;
id: PChar;
name: PChar;
version: PChar;
summary: PChar;
description: PChar;
author: PChar;
homepage: PChar;
load: function(plugin: PPurplePlugin): GBoolean;
unload: function(plugin: PPurplePlugin): GBoolean;
destroy: procedure(plugin: PPurplePlugin);
ui_info: Pointer;
extra_info: Pointer;
prefs_info: PPurplePluginUiInfo;
actions: function(plugin: PPurplePlugin; context: Pointer): PGList;

_purple_reserved1: Pointer;
_purple_reserved2: Pointer;
_purple_reserved3: Pointer;
_purple_reserved4: Pointer;


This 4 types are actually callback rather then simple pointers. It will
work, but personally I prefer it as a callback when I can avoid general
Pointer.


  end;

 This works perfectly well on windows 32 bit and Linux 32 bit but today
 someone helped me compile it on linux x86_64 and from the debug output
 of libpurple it seems that when I pass it this record initialized with
 my values it *can* detect that plugintype is set to
 PURPLE_PLUGIN_PROTOCOL because then it will try to read extra_info and
 it thinks it is null, probably it is off a few bytes.

 I cannot test this myself because I don't have a 64 bit Linux. When an
 experienced programmer (should be most on this list) looks at this
 header what is the obvious thing that might break it on 64 bit?
 Pointers should be ok, but what is with int and Integer and what is
 with enums? And are there maybe also certain compiler switches that
 influence it?  What might be wrong?

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


[fpc-pascal] Linux elf with signed checksum

2012-05-28 Thread ik
Hello,

I see that most of the ELF on my system, contain a signature like so:

ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked
(uses shared libs), for GNU/Linux 2.6.32,
BuildID[sha1]=0x39645af26ea483eaae81df45bf34701580506115, stripped

There are two very interesting signatures here that does not exists when
creating an ELF with FPC:
1. GNU/Linux 2.6.32
2. BuildID[sha1]=0x39645af26ea483eaae81df45bf34701580506115

The second part is more interesting for this subject: It signs a checksum
of the ELF file, so any change to it will break the checksum.
It helps you to discover for example root-kits.

Is it a compiler based signature, or something from the build itself ?
If it's from the compiler itself, what is the requirement to add such
support for FPC ?

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

Re: [fpc-pascal] Linux elf with signed checksum

2012-05-28 Thread ik
On Mon, May 28, 2012 at 3:34 PM, Jonas Maebe jonas.ma...@elis.ugent.bewrote:


 On 28 May 2012, at 14:09, ik wrote:

  The second part is more interesting for this subject: It signs a checksum
  of the ELF file, so any change to it will break the checksum.
  It helps you to discover for example root-kits.
 
  Is it a compiler based signature, or something from the build itself ?

 The first google hit I get for BuildID is this page:
 http://fedoraproject.org/wiki/Releases/FeatureBuildId

 It explains everything, including the linker option to use (--build-id).


Thank you




 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] have anyone binded librsync to pascal yet ?

2012-05-25 Thread ik
Hello,

Is there anyone who binded librsync into Pascal/FPC ?

Thanks,

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

[fpc-pascal] making FPC more code optimized

2012-04-29 Thread ik
Hello,

Here is something that I'm asking without really know anything about
the subject, so please bear with me.

I'ved asked few places that works with Pascal (Delphi and FPC), why
does they use C as the infrastructure, and they all say that there is
not even one Pascal compiler that makes the code optimized and fast
running with low resources, while many C compilers does have such
features.
For them it's not the language, but the compilers that are problematic.

I'm not talking about killer feature that never exists, but what
stops FPC and/or other Pascal compilers to be more optimized, with
lower footprint, and faster code like with C compilers for example ?
Is there anything that can be done to make them there as well ?

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


Re: [fpc-pascal] Re: making FPC more code optimized

2012-04-29 Thread ik
On Sun, Apr 29, 2012 at 12:58, Reinier Olislagers
reinierolislag...@gmail.com wrote:
 On 29-4-2012 11:40, ik wrote:
 Hello,

 Here is something that I'm asking without really know anything about
 the subject, so please bear with me.

 I'ved asked few places that works with Pascal (Delphi and FPC), why
 does they use C as the infrastructure, and they all say that there is
 not even one Pascal compiler that makes the code optimized and fast
 running with low resources, while many C compilers does have such
 features.
 For them it's not the language, but the compilers that are problematic.

 I'm not talking about killer feature that never exists, but what
 stops FPC and/or other Pascal compilers to be more optimized, with
 lower footprint, and faster code like with C compilers for example ?
 Is there anything that can be done to make them there as well ?

 Ido,

 I don't quite understand what you mean perhaps you could expand a bit...

 Are you saying:
 1. FPC is using C infrastructure and you want to use something else.
 What do you mean by that? I don't understand.
 Oh, perhaps you mean that some companies/institutions are switching from
 FPC/Delphi to C?

Not at all.

 2. FPC does not generate small, fast code?
 Are you describing some particular performance problems that might
 perhaps be addressed or is this a general comment?
 Are you talking about a specific embedded platform perhaps?

I'm working at the moment on a distributed service that I'm writing in OP.
If I need to control high availability, and process many requests,
then C will have much faster implementation for it (not only in how I
write it, but in the way that it is translated to machine code).

Let's take simple program:

 pascal code 

program hello;

begin
  writeln('Hello World');
end.

- pascal code 

vs c code:

-- c code -
#include stdio.h

int main(int argc, char ** argv) {
  printf(Hello World\n);
  return 0;
}

-- c code --

The code executable will be not only smaller, but takes less memory to
run, and will be more optimized.


 Anyway, to me as a user on a desktop platform, FPC is plenty fast enough.

 With today's processors, having a compiler that works on Windows, OSX
 and Linux is a much bigger advantage than perhaps getting the last ounce
 of performance out of the compiler but I understand the needs of
 embedded developers can be different.

Desktop today is changing to smart phones, so it's more and more
embedded like development.
FPC with JVM is one of the smartest implementation of a compiler imho.
It makes you keep your language, but distribute your code in many
platforms.
Next can be also supporting the MS .NET runtime library, and making
Pascal as the only current programming language that can be used on
all the environments that really matters today.

But all of that is not important, if C code that does exactly what the
Pascal code, can do it with less resources.


 IIRC, e.g. on the Size Matters wiki FAQ page, some strategies for
 stripping FPC for embedded development are mentioned. Perhaps the people
 you are talking to are not aware of those methods?

They are aware of them, but still, both Linux and Windows (afaik),
loads the whole executable to memory. Smaller executable, and dynamic
executable are taking less memory.

But I'm talking about how the code is implemented when it is converted
into assembler.
The C code is more efficient and optimized when it is translated
into machine code at the end. It also has less memory footprint and
there-for, you can use the same machine to do more.

I'm looking to understand, what is required by the compiler to make it
create better outcome that will make it the same if not better then
the C code, making the choice in Pascal for people like myself and
others (that does willing to use it that is), to know that they can
create good infrastructures using Pascal.
I prefer Pascal to any other compiled language, without thinking
twice, as long as it answers my needs.



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

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


[fpc-pascal] compiling jvmbackend

2012-04-10 Thread ik
Hello,

I'm trying to compile jvmbacked (once again after a long time).
It seems to work well at first with the following cli make:

sudo make CROSSOPT=-O2 -g -FD/usr/share/java/  CPU_TARGET=jvm
OS_TARGET=android INSTALL_PREFIX=/usr/ FPC=/usr/bin/ppcx64 all
crossinstall

But then I get the following error message:

make[4]: Leaving directory
`/home/ik/projects/foss/fpc/jvmbackend/rtl/android/jvm'
fpcmake -p -Tjvm-android Makefile.fpc
Processing Makefile.fpc
Error: No targets set
make[3]: *** [fpc_install] Error 1
make[3]: Leaving directory `/home/ik/projects/foss/fpc/jvmbackend/rtl'
make[2]: *** [rtl_install] Error 2
make[2]: Leaving directory `/home/ik/projects/foss/fpc/jvmbackend'
make[1]: *** [installbase] Error 2
make[1]: Leaving directory `/home/ik/projects/foss/fpc/jvmbackend'
make: *** [crossinstall] Error 2

What am I missing here ?

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


Re: [fpc-pascal] compiling jvmbackend

2012-04-10 Thread ik
‎On Tue, Apr 10, 2012 at 17:15, Jonas Maebe jonas.ma...@elis.ugent.be wrote:
 ik wrote on Tue, 10 Apr 2012:


 Hello,

 I'm trying to compile jvmbacked (once again after a long time).
 It seems to work well at first with the following cli make:

 sudo make CROSSOPT=-O2 -g -FD/usr/share/java/  CPU_TARGET=jvm
 OS_TARGET=android INSTALL_PREFIX=/usr/ FPC=/usr/bin/ppcx64 all
 crossinstall

 But then I get the following error message:

 make[4]: Leaving directory
 `/home/ik/projects/foss/fpc/jvmbackend/rtl/android/jvm'
 fpcmake -p -Tjvm-android Makefile.fpc
 Processing Makefile.fpc
 Error: No targets set


 You have to make sure that the fpcmake in your path supports the JVM target
 (i.e., it has to be compiled from the jvmbackend branch; you can compile it
 by going into the jvmbackend/utils/fpcm directory and typing make all)

Thanks, It worked well



 Jonas

Ido



 ___
 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] fpweb and security

2012-02-27 Thread ik
Hello,

I'm thinking now to use fpweb for a web application I need to build,
but the application is going to be over the internet, and I'm
interesting in knowing about few security issues that are supported or
not.

Does it have any CSRF protection ?
What other if any security tools does it have ?

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


Re: [fpc-pascal] OT: Amazing new development tools

2012-02-26 Thread ik
On Sun, Feb 26, 2012 at 13:25, zeljko zel...@holobit.net wrote:
 On Sunday 26 of February 2012 11:43:38 Michael Van Canneyt wrote:


 I don't see him doing this in huge corporate administrative business

 programs where hundreds of database tables are involved.


 and that tables can contain billion of rows ... so visualisation won't be so
 snappy :)

It depends on your tests. That visualization is for test driven
development (http://en.wikipedia.org/wiki/Test-driven_development).

In Ruby I use Cucumber for such things, and then you can provide also
a table with possible values to see how it will react.



 zeljko


 ___
 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] does the following translation of a c struct to FPC is correct ?

2012-02-26 Thread ik
Hello,

I translated the following struct

struct iphdr {
#if defined(__LITTLE_ENDIAN_BITFIELD)
__u8ihl:4,
version:4;
#elif defined (__BIG_ENDIAN_BITFIELD)
__u8version:4,
ihl:4;
#else
#error  Please fix asm/byteorder.h
#endif
__u8tos;
__be16  tot_len;
__be16  id;
__be16  frag_off;
__u8ttl;
__u8protocol;
__sum16 check;
__be32  saddr;
__be32  daddr;
/*The options start here. */
};

to the following Pascal record:


iphdr= record
{$IFDEF ENDIAN_LITTLE}
  jhl : Cardinal; // __u8   ihl:4,
  version : Cardinal; // version:4
{$ELSE}
  version : Cardinal; // __u8 version:4,
  jhl : Cardinal; // version:4
{$ENDIF}
  tos  : cuint8;
  tot_len  : cint16;
  id   : cint16;
  frag_off : cint16;
  ttl  : cint8;
  protocol : cint8;
  check: cuint16;
  saddr: cint32;
  daddr: cint32;
  end;

The problem is, that I get weird data in the fields, so I think I did
not translate it properly, but can't figure out what have I missed.

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


[fpc-pascal] Re: does the following translation of a c struct to FPC is correct ?

2012-02-26 Thread ik
Answering myself:

On Sun, Feb 26, 2012 at 14:54, ik ido...@gmail.com wrote:
 Hello,

 I translated the following struct

 struct iphdr {
 #if defined(__LITTLE_ENDIAN_BITFIELD)
        __u8    ihl:4,
                version:4;
 #elif defined (__BIG_ENDIAN_BITFIELD)
        __u8    version:4,
                ihl:4;
 #else
 #error  Please fix asm/byteorder.h
 #endif
        __u8    tos;
        __be16  tot_len;
        __be16  id;
        __be16  frag_off;
        __u8    ttl;
        __u8    protocol;
        __sum16 check;
        __be32  saddr;
        __be32  daddr;
        /*The options start here. */
 };

 to the following Pascal record:


 iphdr    = record
 {$IFDEF ENDIAN_LITTLE}
              jhl     : Cardinal; // __u8       ihl:4,
   cuchar; // instead of Cardinal

              version : Cardinal; // version:4
 {$ELSE}
              version : Cardinal; // __u8 version:4,
              jhl     : Cardinal; // version:4
 {$ENDIF}
              tos      : cuint8;
              tot_len  : cint16;
              id       : cint16;
              frag_off : cint16;
              ttl      : cint8;
              protocol : cint8;
              check    : cuint16;
              saddr    : cint32;
              daddr    : cint32;
  end;

 The problem is, that I get weird data in the fields, so I think I did
 not translate it properly, but can't figure out what have I missed.

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

Re: [fpc-pascal] does the following translation of a c struct to FPC is correct ?

2012-02-26 Thread ik
On Sun, Feb 26, 2012 at 15:08, Jonas Maebe jonas.ma...@elis.ugent.be wrote:

 On 26 Feb 2012, at 13:54, ik wrote:

 to the following Pascal record:


 iphdr    = record
 {$IFDEF ENDIAN_LITTLE}
              jhl     : Cardinal; // __u8      ihl:4,
              version : Cardinal; // version:4

 The :4 in C means 4 bits, not 4 bytes. The correct translation in the 
 general case for bitfields is hard, because FPC does not support C-compatible 
 bitpacking (it depends on the type of the bitfield, e.g. int a:4; and char 
 a:4 have different alignment rules). In this case, this should match the C 
 layout:

 {$packrecords c}
 iphdr    = record
             bitfields = bitpacked record
 {$IFDEF ENDIAN_LITTLE}
               jhl: 0..(1 shl 4)-1;
               version: 0..(1 shl 4)-1;
 {$ELSE}
               jhl: 0..(1 shl 4)-1;
               version: 0..(1 shl 4)-1;
 {$ENDIF}
             end;
             tos      : cuint8;
             tot_len  : cint16;
             id       : cint16;
             frag_off : cint16;
             ttl      : cint8;
             protocol : cint8;
             check    : cuint16;
             saddr    : cint32;
             daddr    : cint32;
  end;

 You will then of course have to use iphdrvar.bitfields.jhl instead of 
 iphdrvar.jhl.

I'ved replaced it to

iphdr= bitpacked record
{$IFDEF ENDIAN_LITTLE}
  jhl : 0..(1 shl 4)-1; // __u8 ihl:4,
  version : 0..(1 shl 4)-1; // version:4
{$ELSE}
  version : 0..(1 shl 4)-1; // __u8 version:4,
  jhl : 0..(1 shl 4)-1; // version:4
{$ENDIF}
  tos  : cuint8;
  tot_len  : cint16;
  id   : cint16;
  frag_off : cint16;
  ttl  : cint8;
  protocol : cint8;
  check: cuint16;
  saddr: cint32;
  daddr: cint32;
  end;

And now all of the problems that I continue to find gone away.

Thank you



 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


Re: [fpc-pascal] does the following translation of a c struct to FPC is correct ?

2012-02-26 Thread ik
On Sun, Feb 26, 2012 at 15:19, Jonas Maebe jonas.ma...@elis.ugent.be wrote:

 On 26 Feb 2012, at 14:16, ik wrote:

 I'ved replaced it to

 iphdr    = bitpacked record

 This is wrong. The record is a C record, and hence follows {$packrecord c} 
 rules. bitpacked record overrides any current {$packrecords x} setting. 
 That is the reason why I used the nested bitpacked record.

 And now all of the problems that I continue to find gone away.

 You may get lucky, but it's still wrong.

I understand, so I'll change it, to your way



 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] OT: Amazing new development tools

2012-02-25 Thread ik
Hello,

I found the following amazing lecture that present a new idea of a
development tool, that I think will interest you all:

http://vimeo.com/36579366

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


[fpc-pascal] Reactor Pattern for Pascal ?

2012-02-21 Thread ik
Hello,

I'm looking for an open source based implementation (but not limiting
for commercial usage) of Reactor Pattern
(http://en.wikipedia.org/wiki/Reactor_pattern) to have something like
Ruby's EventMachine .

Does anyone know of such implementation ?

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


Re: [fpc-pascal] benchmarking functions

2012-02-17 Thread ik
On Fri, Feb 17, 2012 at 10:06, Graeme Geldenhuys
graemeg.li...@gmail.com wrote:
 On 16 February 2012 18:10, ik ido...@gmail.com wrote:
 Hello,

 What is the best way measure execution time of functions ?


 You can also use fpprofiler. Search the wiki for more info.

Thank I'll look for it, and also gprof that Henry suggested



 --
 Regards,
   - Graeme -


 ___
 fpGUI - a cross-platform Free Pascal GUI toolkit
 http://fpgui.sourceforge.net
 ___
 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] benchmarking functions

2012-02-16 Thread ik
Hello,

What is the best way measure execution time of functions ?

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


Re: [fpc-pascal] Re: TLinkedList

2012-02-15 Thread ik
On Wed, Feb 15, 2012 at 11:19, Juha Manninen juha.mannine...@gmail.com wrote:
 2012/2/15, Jorge Aldo G. de F. Junior jagf...@gmail.com:
 i once read a textbook about generics (C++ generics) showing how C++

 C++ does not have generics, it has templates. Templates syntax is
 complex, you can do actual programming with it. IMO, using all its
 capacity leads to over-engineered and unreadable code.
 I read about a plan to add Java style generics syntax to C++, in
 addition to templates. I guess it will not happen. C++ has enough
 syntax already.

You really do not understand the state of mind of C++ :)
C++ is like a big pot on a camp fire.
They just throw everything inside, and hope you choose only the food
you like to eat, but usually ends up eating fast food instead (Qt,
Boost etc...)



 code can end up being FASTER than C equivalent due to lack of type
 checks...
[...]
 the point being made was that object orientation is not necessarely
 bloat but leads to better written code. (not always true, but...)

 Code can still be fast even if it is bloated in size. Object
 orientation helps in writing readable and maintainable code but that
 is yet another issue.
 The code duplication we discussed here has no advantage for speed. It
 is quite useless duplication.


 From Sven Barth:
 Free Pascal is a native language. There aren't much alternatives to code 
 duplication.

 Yes there is. The same container code can be reused (when possible),
 just like Java does.
 Free Pascal is native, Java generates byte-code, but that is irrelevant here.

 I was planning to use generics in many places in Lazarus code but now
 I must rethink...
 Lazarus executable is quite big already.

 Juha
 ___
 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


  1   2   3   4   5   >