Re: [fpc-pascal] dynamic array contents and system.move

2010-04-27 Thread Jürgen Hestermann

There is a lot of ambigouity with dynamic arrays.

There certainly is if you expect them to work like regular arrays. They are a 
quite different datatype.

At least it should always mean the same independent from context.

It does always mean the same, just like a class instance always means the same. 
It's just that implicit dereferencing is applied as soon as you try to access 
an element (again, like with classes).


That means that identifiers for open arrays are always pointers, 'just' with an 
automatic dereferencing when using square brackets for indexing? Then it should 
be possible to dereference such identifiers with ^ but it's not. Why? That's 
the inconcistency I mean: There is no strict logic behind it.

An identifier should always refer to a memory address/location. If the type of the data at that memory location is a pointer then it should be possible to change the expression to the memory address of the data by dereferencing it with ^. But for dynamic arrays (and AnsiStrings and other modern structures) this is no longer the case which leads to a lot of confusion. To me it's a design flaw. 


And the help does not tell about the internals (motto: you don't need to bother about the 
internals) but if someone follows this advice and it does not work as expected then here in the list 
all say don't use it if you don't know about the internals. But then why not tell the internals 
in the documentation? If I construct a heavily nested data structure with records and pointers to records how 
do I know that these special things like AnsiStrings etc. don't work as all the other types that 
made the Pascal language so popular. It was clear and easy to understand but now it is no longer.

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


Re: [fpc-pascal] dynamic array contents and system.move

2010-04-27 Thread ajv

I dit not follow this thread, but maybe it helps.
Dynamic arrays are located on the heap  and are reference counted.
The command System.Move will bypass the reference counting.
For this reason and to be sure the data is available when you need it 
use System.Move on stack located arrays an strings only.



On 04/27/2010 08:04 AM, Jürgen Hestermann wrote:

There is a lot of ambigouity with dynamic arrays.
There certainly is if you expect them to work like regular arrays. 
They are a quite different datatype.

At least it should always mean the same independent from context.
It does always mean the same, just like a class instance always means 
the same. It's just that implicit dereferencing is applied as soon as 
you try to access an element (again, like with classes).


That means that identifiers for open arrays are always pointers, 
'just' with an automatic dereferencing when using square brackets for 
indexing? Then it should be possible to dereference such identifiers 
with ^ but it's not. Why? That's the inconcistency I mean: There is no 
strict logic behind it.


An identifier should always refer to a memory address/location. If the 
type of the data at that memory location is a pointer then it should 
be possible to change the expression to the memory address of the data 
by dereferencing it with ^. But for dynamic arrays (and AnsiStrings 
and other modern structures) this is no longer the case which leads 
to a lot of confusion. To me it's a design flaw.
And the help does not tell about the internals (motto: you don't need 
to bother about the internals) but if someone follows this advice and 
it does not work as expected then here in the list all say don't use 
it if you don't know about the internals. But then why not tell the 
internals in the documentation? If I construct a heavily nested data 
structure with records and pointers to records how do I know that 
these special things like AnsiStrings etc. don't work as all the 
other types that made the Pascal language so popular. It was clear and 
easy to understand but now it is no longer.


___
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] State of FPC docs.rant

2010-04-27 Thread Marco van de Voort
In our previous episode, Joseph Montanez said:
 I just spent 2 hours on FPDoc's trying to get how to use it. Automatic
 documentation was dead easy but the whole XML integration part was a
 nightmare, so I gave up reading the docs on how to use the doc.
 Instead I figure Hey there must be examples of this right? ... *digs
 through source* ... 5 mins later figured it out.

(You might also want to have a look at the fixdocs.sh script, it is what I
use to generate the CHM docs:

http://www.stack.nl/~marcov/doc-chm.zip

)

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


[fpc-pascal] pointer magic

2010-04-27 Thread spir ☣
Hello,

Two basic questions about pointer targets (I call target what is pointed to).

-1- untyped pointer allocation
In case of an untyped pointer, I read the compiler considers the target'size is 
1 byte. There certainly is an operation to allocate memory for the target 
according to an existing piece of data. Something like
data := something
new(p,data);
// Either p points to data where it was
// or a new memory area is silently reserved,
// data copied there, and p holds its address.

-2- reflexive pointing
The following works, but I do not understand how.

=== code ===
program LinkedList;

uses
Classes, SysUtils;  //, Variants;

// typed list version
type
List = ^Node;
Node = record
next : List;
data : ^Integer;
end;

var
endNode : List;

procedure defineEndNode();
begin
new(endNode);
with endNode^ do begin
new(data);
data^ := 0;
next := endNode;
end;
end;

//[...]

begin
// end node flag
defineEndNode();
writeln(endNode^.data^);
//[...]
end.
=== /code ==

The issue is: ^endNode holding a pointer to endNode, how is this kind of 
infinite self-referencing loop resolved by the compiler, at definition time?

PS: How else terminate a linked list in Pascal? (I must put something in the 
.next field of the last actual node, and this thing must be a List, ie a node 
pointer.)


Denis


vit esse estrany ☣

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


Re: [fpc-pascal] State of FPC docs.rant

2010-04-27 Thread Graeme Geldenhuys
On 27 April 2010 02:00, John wrote:

 I think you missed my point.  I don't need 'new developer' documentation for
 OOP.  What I can't understand is how the documentation system itself works,
 ie, how to go about using it to contribute documentation.


* Download 'fpdoc.pdf' or 'fpdoc.ps' and read all about tools lake
'makeskel', 'fpdoc' etc.
  This is the documentation for the FPC Documentation tools.
* Checkout out the latest fpc docs repository.
* Now you can edit the XML documentents eg: classes.xml with any text editor.
  OR
  You can use the integrated FPDoc Editor included with Lazarus IDE
(if you are using
  Lazarus).
* To tell Lazarus IDE where the XML documentation are on you hard drive.
   Add the path via:  Environment  Options  FPDoc Editor
   To open the FPDoc Editor:  View  FPDoc Editor

You you then see something like this:
http://wiki.freepascal.org/New_IDE_features_since#Integrated_Documentation_Editor

If you now make changes in the FPDoc Editor window. Most common
formatting has toolbar buttons in the editor window. Once you done
editing the text, generate a patch and submit to Mantis.

  cd path_to_fpcdocs_svn
  svn status -q
  svn diff  my_changes.patch


I don't know if there is official documentation describing this
process. There is another README.DOCS file inside the root directory
of the checked out fpc docs repository.

I also remembered writing the following very basic instructions for
the developers working on tiOPF. tiOPF also uses fpdoc-style
documentation.

   http://opensoft.homeip.net/wiki/wiki.cgi?p=fpdoc-usage-summary

-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] State of FPC docs.rant

2010-04-27 Thread Graeme Geldenhuys
On 27 April 2010 04:39, Joseph Montanez jmonta...@gorilla3d.com wrote:

 Spent another hour making a pretty example, found out there was no CSS
 file generated, and made my own:
 http://www.gorilla3d.com/fpdoc/animal/tanimal.talk.html

Nice. I reported the missing CSS file issue years ago. I thought it
was fixed - I guess not.


-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] dynamic array contents and system.move

2010-04-27 Thread Florian Klaempfl
Jürgen Hestermann schrieb:
 There is a lot of ambigouity with dynamic arrays.
 There certainly is if you expect them to work like regular arrays.
 They are a quite different datatype.
 At least it should always mean the same independent from context.
 It does always mean the same, just like a class instance always means
 the same. It's just that implicit dereferencing is applied as soon as
 you try to access an element (again, like with classes).
 
 That means that identifiers for open arrays are always pointers, 'just'
 with an automatic dereferencing when using square brackets for indexing?
 Then it should be possible to dereference such identifiers with ^ but
 it's not. 

A file type is actually also a record and you cannot access the fields
without an explict type cast.

 Why? That's the inconcistency I mean: There is no strict logic
 behind it.

Logic is nice but sometimes it makes no sense especially since you're
not supposed to access dyn. arrays by ^ becuase it usually breaks the
automatic management of dyn. arrays.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] pointer magic

2010-04-27 Thread cobines
2010/4/27 spir ☣ denis.s...@gmail.com:
 -1- untyped pointer allocation
 In case of an untyped pointer, I read the compiler considers the target'size 
 is 1 byte. There certainly is an operation to allocate memory for the target 
 according to an existing piece of data. Something like
    data := something
    new(p,data);
    // Either p points to data where it was
    // or a new memory area is silently reserved,
    // data copied there, and p holds its address.

New(p) doesn't work for untyped pointers, you have to use GetMem,
FreeMem for example, where you give the amount of memory in bytes to
allocate. After allocating memory you have to set/copy the data
yourself.

Target size of untyped pointer is 1 byte for pointer arithmetics. For example:

var
  p: Pointer;
  pl: ^Node;
begin
  p := someNode.next;
  pl := someNode.next;
  p := p + 1;   // + 1 byte
  pl := pl + 1;  // + SizeOf(Node) bytes
end;

 -2- reflexive pointing
 The following works, but I do not understand how.
...
 The issue is: ^endNode holding a pointer to endNode, how is this kind of 
 infinite self-referencing loop resolved by the compiler, at definition time?

The compiler doesn't care what value is written there, as long as type
is compatible.

 PS: How else terminate a linked list in Pascal? (I must put something in the 
 .next field of the last actual node, and this thing must be a List, ie a node 
 pointer.)

Put 'nil', and then while traversing the list when you encounter that
pointer to next node is nil then you are at the end of the list.

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


Re: [fpc-pascal] dynamic array contents and system.move

2010-04-27 Thread Doug Chamberlin

On 4/27/2010 2:04 AM, Jürgen Hestermann wrote:
An identifier should always refer to a memory address/location. If the 
type of the data at that memory location is a pointer then it should 
be possible to change the expression to the memory address of the data 
by dereferencing it with ^. But for dynamic arrays (and AnsiStrings 
and other modern structures) this is no longer the case which leads 
to a lot of confusion. To me it's a design flaw.


I agree that the introduction of managed data types is inconsistent with 
previous Pascal data types. Perhaps it is a design flaw to have changed 
the semantics of reference-counted data types. Perhaps not. 
Nevertheless, it has been this way for many, many years and will not be 
changed at this point.


And the help does not tell about the internals (motto: you don't need 
to bother about the internals) but if someone follows this advice and 
it does not work as expected then here in the list all say don't use 
it if you don't know about the internals. But then why not tell the 
internals in the documentation? If I construct a heavily nested data 
structure with records and pointers to records how do I know that 
these special things like AnsiStrings etc. don't work as all the 
other types that made the Pascal language so popular. It was clear and 
easy to understand but now it is no longer.


Correct. The language is no longer as simple and clear and easy as it was.

The rule now is that you need to know if the data types you use are 
managed (reference-counted) or not. If they are, you must be aware that 
lower-level operations such as Move and FillChar will not work the way 
they did with earlier data types. That is one of the things you trade 
for the convenience of having some details managed for you when using 
managed data.


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


[fpc-pascal] Question about Deleting elements in Dynamic Array

2010-04-27 Thread Bihar Anwar
Just say, I have a dynamic array with size=5, and I want to delete elements 
from the index 0 to 2. Is there a trick (the fastest way) to delete those 
elements (0 to 2) without moving activities?

I've tried to make the dynamic array just pointing to 3rd element and set a new 
length for it, but fpc generates an unhandled exception.

var
  a: array of string;

SetLength(a, 5);
a[0] := 'aa'; a[1] := 'bb'; a[2] := 'cc'; a[3] := 'dd'; a[4] := 'ee';

a := @sl[3];   // this is the trick, but it doesn't work.
SetLength(a, 2)


Thank's in advance.



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


Re: [fpc-pascal] Question about Deleting elements in Dynamic Array

2010-04-27 Thread dmitry boyarintsev
On Tue, Apr 27, 2010 at 5:42 PM, Bihar Anwar bihar_an...@rocketmail.com wrote:
 Just say, I have a dynamic array with size=5, and I want to delete elements 
 from the index 0 to 2. Is there a trick (the fastest way) to delete those 
 elements (0 to 2) without moving activities?

You won't do it faster than this:

var
 a: array of string;
 i : integer;

SetLength(a, 5);
a[0] := 'aa'; a[1] := 'bb'; a[2] := 'cc'; a[3] := 'dd'; a[4] := 'ee';

a[0]:=a[3];
a[1]:=a[4];
SetLength(a,2);

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


Re: [fpc-pascal] State of FPC docs.rant

2010-04-27 Thread Florian Klaempfl
David Emerson schrieb:

 I'm far more comfortable using git than svn, and if there was such a repo it 
 would help lower the barrier to entry for me at least. 

I created a mercurial mirror: http://florianklaempfl.de:8000/fpcdocs/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] XML Iteration

2010-04-27 Thread Lee Jenkins


This isn't still true for latter version of FPC like 2.4.1, right?

http://wiki.freepascal.org/XML_Tutorial#Printing_the_names_of_nodes

A quick note on navigating the DOM tree: When you need to access nodes in 
sequence, it is best to use FirstChild and NextSibling properties (to iterate 
forward), or LastChild and PreviousSibling  (to iterate backward). For random 
access it is possible to use ChildNodes  or GetElementsByTagName methods, but 
these will create a TDOMNodeList object which eventually must be freed. This 
differs from other DOM implementations like MSXML, because FCL implementation is 
object-based, not interface-based. 


I think I read that had been fixed.

Thanks,

--
Warm Regards,

Lee

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


Re: [fpc-pascal] fcl-passrc example program, and a couple of bugreports

2010-04-27 Thread Michael Van Canneyt



On Mon, 26 Apr 2010, Michalis Kamburelis wrote:


All the talk about the Pascal parser in fcl-passrc got me interested
recently. I did some experiments, and I thought I mention here:

1. I added a simplest example how to use fcl-passrc to the wiki:

http://wiki.freepascal.org/fcl-passrc


This is useful, thank you :-)



2. And reported a couple of bugs found in fpdoc (tested on PasDoc's
testsuite):

http://bugs.freepascal.org/view.php?id=16340
http://bugs.freepascal.org/view.php?id=16341
http://bugs.freepascal.org/view.php?id=16342
http://bugs.freepascal.org/view.php?id=16343
http://bugs.freepascal.org/view.php?id=16344
http://bugs.freepascal.org/view.php?id=16345
http://bugs.freepascal.org/view.php?id=16346
http://bugs.freepascal.org/view.php?id=16347


As soon as I get around to some bugfixing, I'll have a look at these.


Some other failures were found (see the testcase: ok_dispid_method.pas,
ok_dot_unitname.pas in pasdoc svn), but these were language features not
handled by the FPC at all for now.

Also, program files are not parsed by fcl-passrc, it's limited to units
for now. We would like to be able to eventually parse program files too.


I am all for it. It should not be hard to handle this; It's like parsing
an implementation block, with an extra flag that it should expect a
begin/end instead of initialization/finalization block.

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


Re: [fpc-pascal] Question about Deleting elements in Dynamic Array

2010-04-27 Thread Henry Vermaak
On 27 April 2010 14:42, Bihar Anwar bihar_an...@rocketmail.com wrote:
 Just say, I have a dynamic array with size=5, and I want to delete elements 
 from the index 0 to 2. Is there a trick (the fastest way) to delete those 
 elements (0 to 2) without moving activities?

 I've tried to make the dynamic array just pointing to 3rd element and set a 
 new length for it, but fpc generates an unhandled exception.

 var
  a: array of string;

 SetLength(a, 5);
 a[0] := 'aa'; a[1] := 'bb'; a[2] := 'cc'; a[3] := 'dd'; a[4] := 'ee';

 a := @sl[3];       // this is the trick, but it doesn't work.
 SetLength(a, 2)

I think the right way to do this is:

a := copy(a, 3, length(a) - 3);

Presumably copy optimizes this adequately.

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


Re: [fpc-pascal] State of FPC docs.rant

2010-04-27 Thread Michael Van Canneyt



On Sun, 25 Apr 2010, Joseph Montanez wrote:


Okay,

Since there hasn't been a clear response on this I've started my own
website, to start documenting more of the use of each library. However
doing so I am finding some clear issues, and that is some of these
units are not finished all the way. Is there some list of missing
functionality somewhere for these units? Knowing this would help
contributers figure out what units need help.

http://fpc-docs.gorilla3d.com/built-in-units

fcl-image - Ability to write text on canvas has 'NotImplemented So
trying to use any text operations will fail, but there is place
holders on type type fonts.


You must include the freetype engine for this to work; that is why
the base classes don't support it, because we want them to be independent
of external libraries. Therefor it works using a plugin system.

so a simple 'uses ftfont' will add font support.



sqlite - Every single query has Testing: (Query) outputted in the
console. I looked in the unit and found its clearly there with
WriteLn(). I also trying to figure out what the second parameter of
Query does, Its a TStrings... maybe a prepared statement. I have to
read the source code a bit more to find out. I find it weird that both
2.2 and 2.4 have this test print. Does anyone use the unit sqlite
included with FPC?


No, because: You should probably use the sqlite3 units instead. 
sqlite is for sqlite2, and that is WAY too old :-)


But I have removed the debug statements. Thanks for reporting it.

Michael.





On Thu, Apr 22, 2010 at 11:12 PM, Thierry Coq t...@free.fr wrote:

Joseph, Vincent,

+1

Add me to the list here.

I also offer to help, especially for writing UML diagrams to help people
visualize, including use cases, class diagrams and scenarios. Every
component I publish has unit testing and UML diagrams, if only a few.

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





--
Joseph Montanez
Web Developer
Gorilla3D
Design, Develop, Deploy
___
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] How to convert ISO format string in FreePascal

2010-04-27 Thread Frank Church
I want to convert a time stamp in -mm-dd hh:mm:ss format to a
TDatetime in FPC but can't find but haven't found a way yet. My
attempt is based on the method here,
https://forums.codegear.com/thread.jspa?threadID=16074, but
StrToDateTime in FPC does not use the FormatSettings parameter.

function // function TryStrToDate(const S: string; out Value:
TDateTime; const FormatSettings: TFormatSettings): Boolean;
// function TryStrToTime(const S: string; out Value: TDateTime; const
FormatSettings: TFormatSettings): Boolean;
// function TryStrToDateTime(const S: string; out Value: TDateTime;
const FormatSettings: TFormatSettings): Boolean;
(const S: string): TDateTime;

The references to FormatSettings are commented out, they appear to be
an abandoned attempt

// function TryStrToDate(const S: string; out Value: TDateTime; const
FormatSettings: TFormatSettings): Boolean;
// function TryStrToTime(const S: string; out Value: TDateTime; const
FormatSettings: TFormatSettings): Boolean;
// function TryStrToDateTime(const S: string; out Value: TDateTime;
const FormatSettings: TFormatSettings): Boolean;

function StrToDateTimeDef(const S: string; const Defvalue :
TDateTime): TDateTime;

I switched to using the unixtime value which is also present in the
records I am using, but it does not allow for Daylight Savings Time
and is currently an hour behind. Is there some way the FreePascal
libraries can adjust for DST? Is there some other unit I can use or
work through?

1272379859.203125 gives 2010-04-27 14:50:59 instead of 2010-04-27
15:50:59 in the UK.

My current code is based on TDateTime(25569 + (StrToInt(epoch) *
1.0)/86400.0).

-- 
Frank Church

===
http://devblog.brahmancreations.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] dynamic array contents and system.move

2010-04-27 Thread Jürgen Hestermann

A file type is actually also a record and you cannot access the fields
without an explict type cast.


At least a file identifier always means the same memory address (where the 
record data is stored). If needed (for some special purpose) I *can* typecast 
it because I know the address of the data (@myfile). But when using the 
identifier of a dynamic array then this identifier does not always mean the 
same address of the array but sometimes means the pointer to it. That makes it 
illogical.


Logic is nice but sometimes it makes no sense especially since you're
not supposed to access dyn. arrays by ^ becuase it usually breaks the
automatic management of dyn. arrays.


That's something the user should decide. The language should not build up 
artificial obstacles to obfuscate what is happening in the background. If you 
only copy the data to somewhere else (which is *not* a dynamic array) then 
there is no need to bother about reference count etc.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


[fpc-pascal] What project management tool does FPC developers use?

2010-04-27 Thread Frank Church
What project management tool does FPC and Lazarus developers use? I
mean besides mantis for bug tracking?
I am thinking along the lines of JIRA, Redmine, Fogbugz etc.

It is hard to get a view of what things are progressing or what needs doing,

-- 
Frank Church

===
http://devblog.brahmancreations.com
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] XML Iteration

2010-04-27 Thread Frank Church
I am glad to see someone with an interest in FPCs XML. Do you have
some experience with XPath usage in PFC/Lazarus?

On 27 April 2010 16:14, Lee Jenkins l...@datatrakpos.com wrote:

 This isn't still true for latter version of FPC like 2.4.1, right?

 http://wiki.freepascal.org/XML_Tutorial#Printing_the_names_of_nodes

 A quick note on navigating the DOM tree: When you need to access nodes in
 sequence, it is best to use FirstChild and NextSibling properties (to
 iterate forward), or LastChild and PreviousSibling  (to iterate backward).
 For random access it is possible to use ChildNodes  or GetElementsByTagName
 methods, but these will create a TDOMNodeList object which eventually must
 be freed. This differs from other DOM implementations like MSXML, because
 FCL implementation is object-based, not interface-based. 

 I think I read that had been fixed.

 Thanks,

 --
 Warm Regards,

 Lee

 ___
 fpc-pascal maillist  -  fpc-pas...@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


Re: [fpc-pascal] What project management tool does FPC developers use?

2010-04-27 Thread Jonas Maebe

On 27 Apr 2010, at 18:05, Frank Church wrote:

 What project management tool does FPC and Lazarus developers use? I
 mean besides mantis for bug tracking?
 I am thinking along the lines of JIRA, Redmine, Fogbugz etc.

As far as FPC is concerned: none.

 It is hard to get a view of what things are progressing or what needs doing,

There's only the bug tracker, svn commit logs and mailing list discussions for 
that currently.


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


Re: [fpc-pascal] XML Iteration

2010-04-27 Thread Lee Jenkins

Frank Church wrote:

I am glad to see someone with an interest in FPCs XML. Do you have
some experience with XPath usage in PFC/Lazarus?



No, other than some cursory google searches.  I figured I'd be asking about that 
myself soon.


--
Warm Regards,

Lee


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


Re: [fpc-pascal] XML Iteration

2010-04-27 Thread Luiz Americo Pereira Camara

Frank Church escreveu:

I am glad to see someone with an interest in FPCs XML. Do you have
some experience with XPath usage in PFC/Lazarus?

  


In this program: 
http://www.silvioprog.com.br/downloads/Cliente_SOAP_SAH.zip?attredirects=0d=1 
you can find a simple usage of XPath + WST


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


[fpc-pascal] Bridging FPC and Delphi

2010-04-27 Thread Anthony Walter
I was on freenode irc #fpc earlier and asked some questions but not enough
people were online to get an answer.

My question was/is:

 Will there ever again come a point where FPC attempts to bring in more
compatibility with Delphi? Specifically, in regards to operator overloading
and generic language syntax. 

I'd really like to use generics in my cross platform graphic widgets toolkit
and have it continue to work with both Delphi and FPC, but as of right I
can't tolerate the enormous amounts of {$IFDEFs} required to do so.

For those interested, here is a video showcasing a very old version (circa
2004) of my toolkit. Compiles on Windows (Delphi 7) and Linux (FPC).

http://www.youtube.com/watch?v=iqeFZ2zhszU

Screens from my picture browser (circa 2006) :

http://imagebot.org/snapshops/photo-grid-animate.jpg
http://imagebot.org/snapshops/3d-picture-gallery.jpg
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] XML Iteration

2010-04-27 Thread Frank Church
Thanks for the link. What is WST? My searches turn up something
related to eclipse.

On 27 April 2010 17:50, Luiz Americo Pereira Camara luiz...@oi.com.br wrote:
 Frank Church escreveu:

 I am glad to see someone with an interest in FPCs XML. Do you have
 some experience with XPath usage in PFC/Lazarus?



 In this program:
 http://www.silvioprog.com.br/downloads/Cliente_SOAP_SAH.zip?attredirects=0d=1
 you can find a simple usage of XPath + WST

 Luiz
 ___
 fpc-pascal maillist  -  fpc-pas...@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


Re: [fpc-pascal] How to convert ISO format string in FreePascal

2010-04-27 Thread José Mejuto
Hello FPC-Pascal,

Tuesday, April 27, 2010, 5:43:30 PM, you wrote:

FC I switched to using the unixtime value which is also present in the
FC records I am using, but it does not allow for Daylight Savings Time
FC and is currently an hour behind. Is there some way the FreePascal
FC libraries can adjust for DST? Is there some other unit I can use or
FC work through?
FC 1272379859.203125 gives 2010-04-27 14:50:59 instead of 2010-04-27
FC 15:50:59 in the UK.
FC My current code is based on TDateTime(25569 + (StrToInt(epoch) *
FC 1.0)/86400.0).

If you want DST time in historic mode you can use PascalTZ
http://wiki.lazarus.freepascal.org/PascalTZ as unixtime is GMT.

-- 
Best regards,
 José

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


Re: [fpc-pascal] fcl-passrc example program, and a couple of bugreports

2010-04-27 Thread Sven Barth

Hi!

On 27.04.2010 17:19, Michael Van Canneyt wrote:



Also, program files are not parsed by fcl-passrc, it's limited to units
for now. We would like to be able to eventually parse program files too.


I am all for it. It should not be hard to handle this; It's like parsing
an implementation block, with an extra flag that it should expect a
begin/end instead of initialization/finalization block.



I don't know whether you know that or fcl-passrc supports that, but the 
begin/end block is also possible in a unit:


=== code begin ===
unit unitbegin;

interface

function Foo: Integer;

implementation

function Foo: Integer;
begin
  Foo := 42;
end;

begin
  Writeln(Foo);
end.
=== code end ===

This compiles without errors and the begin/end block is treated as an 
initialization block.


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


Re: [fpc-pascal] fcl-passrc example program, and a couple of bugreports

2010-04-27 Thread Michael Van Canneyt



On Tue, 27 Apr 2010, Sven Barth wrote:


Hi!

On 27.04.2010 17:19, Michael Van Canneyt wrote:



Also, program files are not parsed by fcl-passrc, it's limited to units
for now. We would like to be able to eventually parse program files too.


I am all for it. It should not be hard to handle this; It's like parsing
an implementation block, with an extra flag that it should expect a
begin/end instead of initialization/finalization block.



I don't know whether you know that or fcl-passrc supports that, but the 
begin/end block is also possible in a unit:


It supports that, but for a program, the begin/end is mandatory, so
fcl-passrc needs to be notified. Like I said, it should be easily added.

Michael.


=== code begin ===
unit unitbegin;

interface

function Foo: Integer;

implementation

function Foo: Integer;
begin
 Foo := 42;
end;

begin
 Writeln(Foo);
end.
=== code end ===

This compiles without errors and the begin/end block is treated as an 
initialization block.


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] Question about Deleting elements in Dynamic Array

2010-04-27 Thread Bihar Anwar
- Original Message 

From: Henry Vermaak henry.verm...@gmail.com
To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org
Sent: Tue, April 27, 2010 10:19:45 PM

I think the right way to do this is:
a := copy(a, 3, length(a) - 3);
Presumably copy optimizes this adequately.

Henry
___

Would Move() be faster, instead of Copy()?



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


Re: [fpc-pascal] dynamic array contents and system.move

2010-04-27 Thread Florian Klaempfl
Jürgen Hestermann schrieb:
 A file type is actually also a record and you cannot access the fields
 without an explict type cast.
 
 At least a file identifier always means the same memory address (where
 the record data is stored). If needed (for some special purpose) I *can*
 typecast it because I know the address of the data (@myfile). But when
 using the identifier of a dynamic array then this identifier does not
 always mean the same address of the array but sometimes means the
 pointer to it.

What nonsense is this? I fear you've simply no clue about the usage,
internals and purpose of dyn. arrays so I stop this discussion.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] What project management tool does FPC developers use?

2010-04-27 Thread Florian Klaempfl
Frank Church schrieb:
 What project management tool does FPC and Lazarus developers use? I
 mean besides mantis for bug tracking?

None, simply because we don't have any time budgets/resources but people
are working as soon as they find time.

 I am thinking along the lines of JIRA, Redmine, Fogbugz etc.
 
 It is hard to get a view of what things are progressing or what needs doing,

See mantis ;)
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Bridging FPC and Delphi

2010-04-27 Thread Florian Klaempfl
Anthony Walter schrieb:
 I was on freenode irc #fpc earlier and asked some questions but not
 enough people were online to get an answer.
 
 My question was/is:
 
  Will there ever again come a point where FPC attempts to bring in
 more compatibility with Delphi? 

Nobody can predict if sometimes in the future somebody will contribute a
patch regarding this.

 Specifically, in regards to operator
 overloading and generic language syntax. 
 
 I'd really like to use generics in my cross platform graphic widgets
 toolkit and have it continue to work with both Delphi and FPC, but as of
 right I can't tolerate the enormous amounts of {$IFDEFs} required to do so.
 
 For those interested, here is a video showcasing a very old version
 (circa 2004) of my toolkit. Compiles on Windows (Delphi 7) and Linux (FPC).
 
 http://www.youtube.com/watch?v=iqeFZ2zhszU
 
 Screens from my picture browser (circa 2006) :
 
 http://imagebot.org/snapshops/photo-grid-animate.jpg
 http://imagebot.org/snapshops/3d-picture-gallery.jpg
 
 
 
 
 ___
 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] Bridging FPC and Delphi

2010-04-27 Thread Anthony Walter
When I google search for FPC generics tohe top result links here:

http://wiki.freepascal.org/Generics

Two cases:

1) type generic TListT = class // ... as is now, the word generic is
redundant

2) type TListT = class // ... better and in line with Delphi

It seems both were on the suggested list. How did version case 1 win out? To
me it would seem that pascal has always been about:

[type block] [identifier] = [type declare] ;
[const block] [identifier] = [const declare];
[var block] [identifier, [identifier, ...]] : [var declare];

Where identifier was always the first token to begin a type, var, or const
block. Oh well, I hope someday we can revert Free Pascal the language to
case 2.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Bridging FPC and Delphi

2010-04-27 Thread Florian Klaempfl
Anthony Walter schrieb:
 When I google search for FPC generics tohe top result links here:
 
 http://wiki.freepascal.org/Generics
 
 Two cases:
 
 1) type generic TListT = class // ... as is now, the word generic is
 redundant
 
 2) type TListT = class // ... better and in line with Delphi
 
 It seems both were on the suggested list. How did version case 1 win
 out? 

I told you this already months before. type generic is a compromise
because there was even the idea to make generic an own section like

var
  ...
type
  ...
generics
  ...

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


Re: [fpc-pascal] Bridging FPC and Delphi

2010-04-27 Thread Anthony Walter
Technical limitations aside, at this point what would be needed from the
community to get the generic syntax changed? Supposing I had the soruce code
changes to accommodate the change to remove the generic keyword, what
would be needed from the community to approve moving that change into the
language?
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Bridging FPC and Delphi

2010-04-27 Thread Florian Klaempfl
Anthony Walter schrieb:
 Technical limitations aside, at this point what would be needed from the
 community to get the generic syntax changed? 

1) Delphi mode only
2) not breaking old code i.e. accepting both variants
3) more Delphi generic compatibility

 Supposing I had the soruce
 code changes to accommodate the change to remove the generic keyword,
 what would be needed from the community to approve moving that change
 into the language?
 
 
 
 
 ___
 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] Bridging FPC and Delphi

2010-04-27 Thread Graeme Geldenhuys
On 27 April 2010 20:14, Anthony Walter sys...@gmail.com wrote:

 1) type generic TListT = class // ... as is now, the word generic is
 redundant

 2) type TListT = class // ... better and in line with Delphi

To be honest, this is a slightly unfair case, saying Free Pascal must
become Delphi compatible, when Free Pascal had generics support
*before* Delphi did. Maybe Delphi should become more Free Pascal
compatible.


 It seems both were on the suggested list. How did version case 1 win out? To
 me it would seem that pascal has always been about:

I can list quite a few examples where Delphi breaks the normal pascal
like syntax too. Yet nobody complains about that.

Our company also wanted to have common code and be able to switch
between Delphi and the Free Pascal compiler. But then we simply came
to the conclusion that Free Pascal is an excellent compiler on its
own, and we really don't need Delphi support any more. We made the
switch 5 years ago (to only work with Free Pascal), and have never
regretted our decision.

I just think the being delphi compatible every step of the way, will
hold Free Pascal Compiler back, having to always wait for Embarcadero
to catch-up with what developers want (and we know how slow Delphi can
move - last few years showing this). And that means Free Pascal will
*always* be one step behind. Free Pascal is powerful enough to stand
on its own. It has many unique features Delphi cannot compete with.
Simply switch to Free Pascal as the only compiler and continue to take
advantage of what FPC has to offer.

Just my 2c worth.

-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] XML Iteration

2010-04-27 Thread Luiz Americo Pereira Camara

Frank Church escreveu:

Thanks for the link. What is WST? My searches turn up something
related to eclipse.

  


Web Services Toolkit: http://wiki.lazarus.freepascal.org/Web_Service_Toolkit

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


Re: [fpc-pascal] Bridging FPC and Delphi

2010-04-27 Thread Anthony Walter
Graeme:

To be honest, this is a slightly unfair case, saying Free Pascal must
become Delphi compatible, when Free Pascal had generics support
*before* Delphi did. Maybe Delphi should become more Free Pascal
compatible.

I've preemptively disabled this argument so many times in the past. It's
become passe.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] How to convert ISO format string in FreePascal

2010-04-27 Thread Luiz Americo Pereira Camara

Frank Church escreveu:

I want to convert a time stamp in -mm-dd hh:mm:ss format to a
TDatetime in FPC but can't find but haven't found a way yet.


A very simple function i use:

function XMLDateTime2DateTime(const XMLDateTime: String): TDateTime;
var
 DateOnly: String;
 TPos: Integer;
begin
 TPos := Pos('T', XMLDateTime);
 if TPos  0 then
   DateOnly := Copy(XMLDateTime, 1, TPos - 1)
 else
   DateOnly := XMLDateTime;
 Result := ScanDateTime('-mm-dd', DateOnly);
end;


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


Re: [fpc-pascal] How to convert ISO format string in FreePascal

2010-04-27 Thread Graeme Geldenhuys
On 27 April 2010 17:43, Frank Church vfcli...@googlemail.com wrote:
 I want to convert a time stamp in -mm-dd hh:mm:ss format to a
 TDatetime in FPC but can't find but haven't found a way yet.


I have written the following for the tiOPF project and us it in our
company projects for all date/time values (including storage in
database fields).

See attached file for the relevant functions. The code has been some
unit tests as well, and can be found in the tiOPF testing framework.
tiOPF is hosted on SourceForge.

NOTE:
I do not manage weeks or timezone information in the ISO 8601 standard.

Some constants I forgot to add to the txt file.

  { Summary of ISO 8601  http://www.cl.cam.ac.uk/~mgk25/iso-time.html }
  cIntlDateTimeStor = 'mmddThhmmss';// for storage
  cIntlDateTimeDisp = '-mm-dd hh:mm:ss';  // for display
  CIntlDateDisp = '-mm-dd';  // for display

-- 
Regards,
  - Graeme -


___
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
// Seaches sStr and replaces sDel with sIns
// Case sensitive.
function tiStrTran(AValue, ADel, AIns : string): string;
var
  i : integer;
  sToChange : string;
begin
  result := '';
  sToChange := AValue;
  i := pos(ADel, sToChange);
  while i  0 do begin
result := result + copy(sToChange, 1, i-1) + AIns;
delete(sToChange, 1, i+length(ADel)-1);
i := pos(ADel, sToChange);
  end;
  result := result + sToChange;
end;

function tiDateTimeAsIntlDateStor(const ADateTime: TDateTime): string;
begin
  Result := FormatDateTime(cIntlDateTimeStor, ADateTime);
  if Pos('18991230', Result) = 1 then
Result := tiStrTran(Result, '18991230', '');
end;


function tiDateTimeAsIntlDateDisp(const ADateTime: TDateTime): string;
begin
  Result := FormatDateTime(cIntlDateTimeDisp, ADateTime);
  if Pos('1899-12-30', Result) = 1 then
Result := tiStrTran(Result, '1899-12-30', '-00-00');
end;

function tiDateAsIntlDateDisp(const ADateTime: TDateTime): string;
begin
  Result := FormatDateTime(CIntlDateDisp, ADateTime);
  if Pos('1899-12-30', Result) = 1 then
Result := tiStrTran(Result, '1899-12-30', '-00-00');
end;

function tiIntlDateStorAsDateTime(const AValue: string): TDateTime;
var
  lY, lM, lD, lH, lMi, lS: Word;
begin
  if Trim(AValue) = '' then
  begin
Result := 0;
Exit; //==
  end;
  
//  1 2
// 12345678901234567890123
// mmddThhmmss
  lY := StrToInt(Copy(AValue, 1, 4));
  lM := StrToInt(Copy(AValue, 5, 2));
  lD := StrToInt(Copy(AValue, 7, 2));
  lH := StrToInt(Copy(AValue, 10, 2));
  lMi := StrToInt(Copy(AValue, 12, 2));
  lS := StrToInt(Copy(AValue, 14, 2));
  
  { Cannot EncodeDate if any part equals 0. EncodeTime is okay. }
  if (lY = 0) or (lM = 0) or (lD = 0) then
Result := EncodeTime(lH, lMi, lS, 0)
  else
Result := EncodeDate(lY, lM, lD) + EncodeTime(lH, lMi, lS, 0);
end;


function tiIntlDateDispAsDateTime(const AValue: string): TDateTime;
var
  lY, lM, lD, lH, lMi, lS: Word;
begin
  if Trim(AValue) = '' then
  begin
Result := 0;
Exit; //==
  end;

//  1 2
// 12345678901234567890123
// -mm-dd hh:mm:ss
  lY := StrToInt(Copy(AValue, 1, 4));
  lM := StrToInt(Copy(AValue, 6, 2));
  lD := StrToInt(Copy(AValue, 9, 2));
  lH := StrToInt(Copy(AValue, 12, 2));
  lMi := StrToInt(Copy(AValue, 15, 2));
  lS := StrToInt(Copy(AValue, 18, 2));

  { Cannot EncodeDate if any part equals 0. EncodeTime is okay. }
  if (lY = 0) or (lM = 0) or (lD = 0) then
Result := EncodeTime(lH, lMi, lS, 0)
  else
Result := EncodeDate(lY, lM, lD) + EncodeTime(lH, lMi, lS, 0);
end;

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

Re: [fpc-pascal] Bridging FPC and Delphi

2010-04-27 Thread Florian Klaempfl
Anthony Walter schrieb:
 Graeme:
 
 To be honest, this is a slightly unfair case, saying Free Pascal must
 become Delphi compatible, when Free Pascal had generics support
 *before* Delphi did. Maybe Delphi should become more Free Pascal
 compatible.
 
 I've preemptively disabled this argument so many times in the past. 

Really? I didn't see a single patch of you so far.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] fcl-passrc example program, and a couple of bugreports

2010-04-27 Thread Marco van de Voort
In our previous episode, Michael Van Canneyt said:
 
 As soon as I get around to some bugfixing, I'll have a look at these.

Shouldn't we create some testsuite for fcl-passrc? (or have a flag in the
existing testsuite to exclude tests from fcl-passrc or real compiler tests
or so?)
 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] XML Iteration

2010-04-27 Thread Marco van de Voort
In our previous episode, Lee Jenkins said:
 This isn't still true for latter version of FPC like 2.4.1, right?
 
 http://wiki.freepascal.org/XML_Tutorial#Printing_the_names_of_nodes
 
 A quick note on navigating the DOM tree: When you need to access nodes in 
 sequence, it is best to use FirstChild and NextSibling properties (to iterate 
 forward), or LastChild and PreviousSibling  (to iterate backward). For random 
 access it is possible to use ChildNodes  or GetElementsByTagName methods, but 
 these will create a TDOMNodeList object which eventually must be freed. This 
 differs from other DOM implementations like MSXML, because FCL implementation 
 is 
 object-based, not interface-based. 
 
 I think I read that had been fixed.

Most, if not all trunk XML fixes have been merged to 2.4.1. And there were
a lot of them, thanks to Sergei.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Bridging FPC and Delphi

2010-04-27 Thread Marco van de Voort
In our previous episode, Anthony Walter said:
 Technical limitations aside, at this point what would be needed from the
 community to get the generic syntax changed?

Patches.

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


Re: [fpc-pascal] How to convert ISO format string in FreePascal

2010-04-27 Thread Marco van de Voort
In our previous episode, Frank Church said:
 attempt is based on the method here,
 https://forums.codegear.com/thread.jspa?threadID=16074, but
 StrToDateTime in FPC does not use the FormatSettings parameter.

Datetime handling has been rewritten since 2.4.0, and this is already merged
back to 2.4.1 afaik. (though there are still open tickets iirc)

For 2.4.0 you could try to use scandatetime:

http://www.freepascal.org/docs-html/rtl/dateutils/scandatetime.html
 
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Bridging FPC and Delphi

2010-04-27 Thread Anthony Walter
Technical limitations aside, at this point what would be needed from the
community to get the generic syntax changed?:

: Patches.

I believe there would first need to be some sort ofg consensus within the
community about the changing the syntax.
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Bridging FPC and Delphi

2010-04-27 Thread Felipe Monteiro de Carvalho
On Tue, Apr 27, 2010 at 10:18 PM, Anthony Walter sys...@gmail.com wrote:
 I believe there would first need to be some sort ofg consensus within the
 community about the changing the syntax.

If both syntaxes are supported I don't think many people will be against it.

-- 
Felipe Monteiro de Carvalho
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] What project management tool does FPC developers use?

2010-04-27 Thread Vincent Snijders

Florian Klaempfl schreef:

Frank Church schrieb:

What project management tool does FPC and Lazarus developers use? I
mean besides mantis for bug tracking?


None, simply because we don't have any time budgets/resources but people
are working as soon as they find time.


I am thinking along the lines of JIRA, Redmine, Fogbugz etc.

It is hard to get a view of what things are progressing or what needs doing,


See mantis ;)


Mantis is important. For releases there is a sort of todo list in the wiki:
http://wiki.lazarus.freepascal.org/Lazarus_0.9.28_release_plan
and
http://wiki.lazarus.freepascal.org/Release_2.4.0

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


Re: [fpc-pascal] Question about Deleting elements in Dynamic Array

2010-04-27 Thread Henry Vermaak
On 27 April 2010 18:34, Bihar Anwar bihar_an...@rocketmail.com wrote:

 Would Move() be faster, instead of Copy()?

I guess so, have you tried to benchmark?  If you really need speed,
why don't you allocate the memory directly?

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


Re: [fpc-pascal] Question about Deleting elements in Dynamic Array

2010-04-27 Thread Bihar Anwar
Ok, I'll try to observe the compiled code using debugger and benchmark it if 
needed. BTW, what do you mean by allocating memory directly? Is there another 
way to allocate memory for dynamic array besides using SetLength()?



- Original Message 
From: Henry Vermaak henry.verm...@gmail.com
To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org
Sent: Wed, April 28, 2010 4:12:26 AM
Subject: Re: [fpc-pascal] Question about Deleting elements in Dynamic Array

On 27 April 2010 18:34, Bihar Anwar bihar_an...@rocketmail.com wrote:

 Would Move() be faster, instead of Copy()?

I guess so, have you tried to benchmark?  If you really need speed,
why don't you allocate the memory directly?

Henry
___
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] Question about Deleting elements in Dynamic Array

2010-04-27 Thread dmitry boyarintsev
On Wed, Apr 28, 2010 at 7:24 AM, Bihar Anwar bihar_an...@rocketmail.com wrote:
 Ok, I'll try to observe the compiled code using debugger and benchmark it if 
 needed. BTW, what do you mean by allocating memory directly? Is there another 
 way to allocate memory for dynamic array besides using SetLength()?

Copy() (from the existing dynamic array).
___
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


Re: [fpc-pascal] Question about Deleting elements in Dynamic Array

2010-04-27 Thread Bihar Anwar
I've tried to use Move() instead of Copy(). Any objection with the following 
code?

var
  a: array of string;

SetLength(a, 5);
a[0] := 'aa'; a[1] := 'bb'; a[2] := 'cc'; a[3] := 'dd'; a[4] := 'ee';

System.Move(a[3], a[0], 2 * SizeOf(string) );// instead of  a := Copy(a, 3, 
2);
SetLength(a, 2);



- Original Message 
From: dmitry boyarintsev skalogryz.li...@gmail.com
To: FPC-Pascal users discussions fpc-pascal@lists.freepascal.org
Sent: Wed, April 28, 2010 10:31:09 AM
Subject: Re: [fpc-pascal] Question about Deleting elements in Dynamic Array

On Wed, Apr 28, 2010 at 7:24 AM, Bihar Anwar bihar_an...@rocketmail.com wrote:
 Ok, I'll try to observe the compiled code using debugger and benchmark it if 
 needed. BTW, what do you mean by allocating memory directly? Is there another 
 way to allocate memory for dynamic array besides using SetLength()?

Copy() (from the existing dynamic array).
___
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] type constraints in generics?

2010-04-27 Thread leledumbo

 I would like to limit the actual type in this list to be a child class of
TObject. Is 
 this possible and if yes, how can it be done?

I don't think it's currently supported. It will be, if someone is willing to
do it.

 In a more general question, what are the differences between the FPC 
 generics and the C# generics (the ones used by the newer versions of 
 Delphi)? In addition to the syntax, of course?

To the best of my knowledge, FPC generics are based on C++ one, while C# one
seems to be coming from Java. FPC one is simply hold as a macro by the
compiler when it's declared and written with all generic types resolved when
it's specialized. It's all done at compile time. In C# case, it's the
runtime environment who is responsible for this. That's why C# one is more
dynamic.
-- 
View this message in context: 
http://old.nabble.com/type-constraints-in-generics--tp28375014p28384859.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.

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


Re: [fpc-pascal] Bridging FPC and Delphi

2010-04-27 Thread leledumbo

Question: who wants to add it?


Felipe Monteiro de Carvalho wrote:
 
 On Tue, Apr 27, 2010 at 10:18 PM, Anthony Walter sys...@gmail.com wrote:
 I believe there would first need to be some sort ofg consensus within the
 community about the changing the syntax.
 
 If both syntaxes are supported I don't think many people will be against
 it.
 
 -- 
 Felipe Monteiro de Carvalho
 ___
 fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
 http://lists.freepascal.org/mailman/listinfo/fpc-pascal
 
 

-- 
View this message in context: 
http://old.nabble.com/Bridging-FPC-and-Delphi-tp28379407p28384862.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.

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


Re: [fpc-pascal] pointer magic

2010-04-27 Thread Thierry Coq

...
In addition, when starting to use Pascal, don't use pointers, and don't 
invent linked lists, it's been done so many times.
Go look up the source code in contnrs.pp to understand lists and 
containers already available in FPC.


Most programming can be done without untyped pointers.
Best regards,
Thierry



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