Re: [fpc-pascal] [OT] Sven, don't defect to the dark side!

2013-03-12 Thread Sven Barth
Am 12.03.2013 21:48 schrieb "Sven Barth" : > > First and foremost: this is very offtopic, so I'm moving this over to fpc-other. If someone answers to my mail, then please ensure that you only answer to fpc-pascal. Thank you. Of course I meant "only answer to fpc-other". I shouldn't write such mail

Re: [fpc-pascal] [OT] Sven, don't defect to the dark side!

2013-03-12 Thread Sven Barth
First and foremost: this is very offtopic, so I'm moving this over to fpc-other. If someone answers to my mail, then please ensure that you only answer to fpc-pascal. Thank you. On 12.03.2013 13:57, Reinier Olislagers wrote: Sad enough that you're almost no student anymore (presumably equals h

Re: [fpc-pascal] fcl-xml

2013-03-12 Thread dev . dliw
> > Is this worth a feature request / bug on mantis? > > Yes. Issue #24032 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] fcl-xml

2013-03-12 Thread Michael Van Canneyt
On Tue, 12 Mar 2013, dev.d...@gmail.com wrote: Using Xpath I believe would be something like this: I was missing an If: function ElementById(id: string; doc: TXMLDocument): TDOMElement; var v: TXPathVariable; begin [..] end; This does indeed work - thank you :) It's an acceptable soluti

Re: [fpc-pascal] fcl-xml

2013-03-12 Thread dev . dliw
> > Using Xpath I believe would be something like this: > I was missing an If: > > function ElementById(id: string; doc: TXMLDocument): TDOMElement; > var >v: TXPathVariable; > begin >[..] > end; This does indeed work - thank you :) It's an acceptable solution for me, as I will need XPath any

Re: [fpc-pascal] fcl-xml

2013-03-12 Thread Daniel Gaspary
On Tue, Mar 12, 2013 at 11:17 AM, Daniel Gaspary wrote: > Using Xpath I believe would be something like this: I was missing an If: function ElementById(id: string; doc: TXMLDocument): TDOMElement; var v: TXPathVariable; begin result:=nil; try v:=EvaluateXPathExpression('//*[

Re: [fpc-pascal] [OT] Sven, don't defect to the dark side!

2013-03-12 Thread Mark Morgan Lloyd
Reinier Olislagers wrote: Permitting myself a small tongue-in-cheek interruption of the regular activities on this mailing list: Sad enough that you're almost no student anymore (presumably equals having to do real work instead of improving FPC and incidentally studying), but this is really goin

Re: [fpc-pascal] fcl-xml

2013-03-12 Thread Daniel Gaspary
Using Xpath I believe would be something like this: function ElementById(id: string; doc: TXMLDocument): TDOMElement; var v: TXPathVariable; begin result:=nil; try v:=EvaluateXPathExpression('//*[@id=' + QuotedStr(id)+']', doc.DocumentElement); result:=TD

Re: [fpc-pascal] fcl-xml

2013-03-12 Thread dev . dliw
A little side note to my statement: > and I don't have a DTD In this case the behaviour of the parser is even right... W3C: Note: Attributes with the name "ID" or "id" are not of type ID unless so defined -- http://stackoverflow.com/questions/3423430/java-xml-dom-how-are-id-a

Re: [fpc-pascal] fcl-xml

2013-03-12 Thread dev . dliw
> Maybe the bug is that it checks case sensitive: > > procedure TXMLTextReader.ParseAttlistDecl; > ... > Found := FSource.Matches(AttrDataTypeNames[dt]); ParseAttlistDecl isn't called a single time... - to me it sounds like "Parse Attribute *declaration*" - and I don't have a DTD (the

[fpc-pascal] [OT] Sven, don't defect to the dark side!

2013-03-12 Thread Reinier Olislagers
Permitting myself a small tongue-in-cheek interruption of the regular activities on this mailing list: Sad enough that you're almost no student anymore (presumably equals having to do real work instead of improving FPC and incidentally studying), but this is really going to far ;) : http://www.re

Re: [fpc-pascal] fcl-xml

2013-03-12 Thread Mattias Gaertner
On Tue, 12 Mar 2013 12:21:10 +0100 dev.d...@gmail.com wrote: >[...] > Just rechecked again... > The debugger clearly says, that reader.IDMap / FIDMap is nil... > [Before the second assignement - of course :) ] > > >It seems to be started, but not finished. > If so, what needs to be done? Maybe t

Re: [fpc-pascal] fcl-xml

2013-03-12 Thread dev . dliw
Hi, > The XMLTextReader creates the map, and passes it on to the final document. // Trunk procedure TLoader.ProcessXML(ADoc: TDOMDocument; AReader: TXMLTextReader); begin [...] doc.IDs := reader.IDMap; reader.IDMap := nil; end; // 2.6.2 === snip === doc.IDs := FIDMap; FIDMap := nil;

Re: [fpc-pascal] Re: JSON & me - blind again?

2013-03-12 Thread Michael Van Canneyt
On Tue, 12 Mar 2013, Reinier Olislagers wrote: On 12-3-2013 11:44, Michael Van Canneyt wrote: Thanks for the help, Michael. On Tue, 12 Mar 2013, Reinier Olislagers wrote: //===> the line below works - so CommJSON is a valid object, right? if Assigned(CommJSON) then It is assigned,

[fpc-pascal] Re: JSON & me - blind again?

2013-03-12 Thread Reinier Olislagers
On 12-3-2013 11:44, Michael Van Canneyt wrote: Thanks for the help, Michael. > On Tue, 12 Mar 2013, Reinier Olislagers wrote: >> //===> the line below works - so CommJSON is a valid object, right? >>if Assigned(CommJSON) then > > It is assigned, but not necessarily valid. If you freed Co

Re: [fpc-pascal] fcl-xml

2013-03-12 Thread Michael Van Canneyt
On Tue, 12 Mar 2013, Mattias Gaertner wrote: On Tue, 12 Mar 2013 11:52:06 +0100 (CET) Michael Van Canneyt wrote: [...] Is getElementById supposed to work properly or is it something that needs to be implemented? Trying to understand what the parser does (not that easy), I got the feeling t

Re: [fpc-pascal] fcl-xml

2013-03-12 Thread Mattias Gaertner
On Tue, 12 Mar 2013 11:52:06 +0100 (CET) Michael Van Canneyt wrote: >[...] > > Is getElementById supposed to work properly or is it something that needs to > > be implemented? > > Trying to understand what the parser does (not that easy), I got the feeling > > that no Hashtable for the IDs is cre

Re: [fpc-pascal] fcl-xml

2013-03-12 Thread Mattias Gaertner
On Tue, 12 Mar 2013 10:39:35 +0100 dev.d...@gmail.com wrote: > Hi, > working with fcl-xml some questions came together. Every hint is appreciated. > > 1. > No matter what I do and which (short & valid) xml file I use - getElementById > is always nil (tested with trunk and latest stable 2.6.2) an

Re: [fpc-pascal] fcl-xml

2013-03-12 Thread Michael Van Canneyt
On Tue, 12 Mar 2013, dev.d...@gmail.com wrote: Hi, working with fcl-xml some questions came together. Every hint is appreciated. 1. No matter what I do and which (short & valid) xml file I use - getElementById is always nil (tested with trunk and latest stable 2.6.2) and the same applies to T

Re: [fpc-pascal] JSON & me - blind again?

2013-03-12 Thread Michael Van Canneyt
On Tue, 12 Mar 2013, Reinier Olislagers wrote: Hi list, (FPC 2.6.0 or trunk) Been fiddling a bit too long and strongly suspect PEBKAC/PICNIC (and my seemingly perennial refusal to adapt to Object Pascal's way of dealing with object references). Thanks for your suggestions! See the ===> ma

[fpc-pascal] JSON & me - blind again?

2013-03-12 Thread Reinier Olislagers
Hi list, (FPC 2.6.0 or trunk) Been fiddling a bit too long and strongly suspect PEBKAC/PICNIC (and my seemingly perennial refusal to adapt to Object Pascal's way of dealing with object references). Thanks for your suggestions! See the ===> marks below var CurrentPage: integer; RequestResu

[fpc-pascal] fcl-xml

2013-03-12 Thread dev . dliw
Hi, working with fcl-xml some questions came together. Every hint is appreciated. 1. No matter what I do and which (short & valid) xml file I use - getElementById is always nil (tested with trunk and latest stable 2.6.2) and the same applies to TXMLDocument.IDs. I tried with ReadXMLFile and TDOM

Re: [fpc-pascal] Porting C macro

2013-03-12 Thread Flávio Etrusco
On Tue, Mar 12, 2013 at 5:30 AM, Darius Blaszyk wrote: > function GETNEXT(x: pLList): pLList; inline; > begin > exit(pLList(pchar(x) - pchar(pLList(nil)^.next))); > end; > > And let LList be declared as: > > LList = record > len: integer; > next, prev: pLList; > name: PChar; > nextname: PCha

Re: [fpc-pascal] Set size limit

2013-03-12 Thread Flávio Etrusco
On Mon, Mar 11, 2013 at 10:54 AM, Daniel Gaspary wrote: > On Mon, Mar 11, 2013 at 10:43 AM, Jonas Maebe > wrote: >> A set is basically a bitpacked array of boolean. Element X is set to true if >> you add X to the set, and to false if you remove it again. That means that >> if you have a set with

Re: [fpc-pascal] Porting C macro

2013-03-12 Thread Darius Blaszyk
Flávio Etrusco schreef op 12 mrt '13: > On 3/11/13, Darius Blaszyk wrote: > >> I'm stuck porting a macro from C. Below is the original define. The part I'm struggeling with is the right most part after the - sign. #define GETNEXT(x) ((LList *)(((char *) x) - ((char *) & (((LList *)0)^.next))

Re: [fpc-pascal] Set size limit

2013-03-12 Thread Mark Morgan Lloyd
Ewald wrote: Once upon a time, Mark Morgan Lloyd said: No, because the elements in a set are dictated by their position. A set that can contain anything between 0 and 256 elements occupies 8 bytes in memory with the (bit representing the) 0 element at one end and the (bit representing the) 256 e