[fpc-devel] XML / SAX - Removing redundancies

2014-03-12 Thread Daniel Gaspary
I have uploaded a patch[1] to remove the TSaxInputSource, it is
redundant with TXmlInputSource from XmlReader unit.

I believe the TSAXXMLReader.Parse method have almost the same
functionality of xmltextreader.TXMLTextReader.

I would like to know if and how it can be modified. The base class,
TSaxReader, needs much more changing and could affect users of the
class.

Thank you,

 Daniel


[1] http://bugs.freepascal.org/view.php?id=25854
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] XML / SAX - Removing redundancies

2014-03-12 Thread Michael Van Canneyt



On Tue, 11 Mar 2014, Daniel Gaspary wrote:


I have uploaded a patch[1] to remove the TSaxInputSource, it is
redundant with TXmlInputSource from XmlReader unit.

I believe the TSAXXMLReader.Parse method have almost the same
functionality of xmltextreader.TXMLTextReader.

I would like to know if and how it can be modified. The base class,
TSaxReader, needs much more changing and could affect users of the
class.


It can be changed. What else do you want to know ?

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


Re: [fpc-devel] FPC and Windows Phone 8

2014-03-12 Thread Michael Schnell

On 03/11/2014 01:08 PM, Vsevolod Alekseyev wrote:

How interesting. Where's you hear this?
It's an obvious conclusion from your statement that any non-Thumb code 
crashes.


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


Re: [fpc-devel] FPC and Windows Phone 8

2014-03-12 Thread Michael Schnell

On 03/11/2014 03:12 PM, Vsevolod Alekseyev wrote:
For the record, all modern mobile SDKs that I know of use Thumb as the 
default instruction set for native code compilation. And with Thumb-2 
on ARMv7 cores, the performance is on par between ARM and Thumb. The 
original Thumb, years ago, was compiled to ARM, but not any longer


I did not do any research on Thumb myself, but I did some regarding MIPS 
(running on PIC32) that also can run in modes with 32 Bit and 16 Bit 
instructions words.


It's obvious that it depends on the hardware environment such as the 
size and relative speed (regarding the CPU) of the 1st level cache if 
code runs faster with 32 Bit instruction words.


Small code snippets with many iterations with limited data memory usage 
(such as calculation of PI) tend to run faster with 32 instruction words.


With MIPS you can call 32 or 16 bit functions without any Mode-Switch 
overhead, so Math libraries should be done in 32 Bit, While a database 
supposedly is better compiled to 16 Bit.


-Michael

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


Re: [fpc-devel] FPC and Windows Phone 8

2014-03-12 Thread Michael Schnell

On 03/11/2014 02:02 PM, Vsevolod Alekseyev wrote:

Just ask Delphi with their funky register-based convention :)


I did a research on many different CPUs for a future project and found 
that - like with Delphi - with many modern GNU C compilers registers are 
used for the first few function arguments (in fact not for 68K :-) ).


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


Re: [fpc-devel] XML / SAX - Removing redundancies

2014-03-12 Thread Sergei Gorelkin

12.03.2014 1:32, Daniel Gaspary пишет:

I have uploaded a patch[1] to remove the TSaxInputSource, it is
redundant with TXmlInputSource from XmlReader unit.

I believe the TSAXXMLReader.Parse method have almost the same
functionality of xmltextreader.TXMLTextReader.

I would like to know if and how it can be modified. The base class,
TSaxReader, needs much more changing and could affect users of the
class.


I had an idea of replacing SAX with proxy to TXMLTextReader once I've written the latter, but it 
appears that SAX is just beyond redemption. One case is that it reports attribute names in LocalName 
property instead of QualifiedName, which means that any code using SAX reads them from wrong place 
and *will* break if SAX is made compliant.


OTOH, if we go for breaking user's code, then it is much better to drop SAX altogether and switch 
over to TXMLTextReader.


From these points of view the best way is probably to document TXMLTextReader, deprecate SAX and 
leave it alone.


All above is about sax-xml; sax-html, unfortunately, does not have a better 
alternative in FPC packages.

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


Re: [fpc-devel] FPC and Windows Phone 8

2014-03-12 Thread Sven Barth
Am 12.03.2014 10:31 schrieb Michael Schnell mschn...@lumino.de:

 On 03/11/2014 02:02 PM, Vsevolod Alekseyev wrote:

 Just ask Delphi with their funky register-based convention :)


 I did a research on many different CPUs for a future project and found
that - like with Delphi - with many modern GNU C compilers registers are
used for the first few function arguments (in fact not for 68K :-) ).

Which is a pity as it has a nice amount of registers to spare :P

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


Re: [fpc-devel] FPC and Windows Phone 8

2014-03-12 Thread Michael Schnell

On 03/12/2014 12:17 PM, Sven Barth wrote:


 (in fact not for 68K :-) ).

Which is a pity as it has a nice amount of registers to spare :P

I suppose nobody wanted to stand up and change the old fashioned 
STDCALL default ABI for sake of speed.


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


Re: [fpc-devel] FPC and Windows Phone 8

2014-03-12 Thread Vsevolod Alekseyev
It's one possible implementation, but hardly the only one. In fact, this
kind of implementation would have testable consequences - specifically, a
*short* amount of ARM would be able to run unmolested in a debuggerless
environment - i. e. if no interrupts come while in ARM mode. I'll try it
when I get a chance.

 It's an obvious conclusion from your statement that any non-Thumb code
crashes.


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


Re: [fpc-devel] XML / SAX - Removing redundancies

2014-03-12 Thread Daniel Gaspary
On Wed, Mar 12, 2014 at 8:06 AM, Sergei Gorelkin
sergei_gorel...@mail.ru wrote:
 OTOH, if we go for breaking user's code, then it is much better to drop SAX
 altogether and switch over to TXMLTextReader.
 From these points of view the best way is probably to document
 TXMLTextReader, deprecate SAX and leave it alone.

Seems to be the best alternative.

On other topic, a new StaX[1] class, using TXMLTextReader, seems need
not too many work to accomplish. Am I sub estimating  It ?

Daniel

[1] http://www.vogella.com/tutorials/JavaXML/article.html#javastax
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] FPC and Windows Phone 8

2014-03-12 Thread Michael Schnell

On 03/12/2014 02:17 PM, Vsevolod Alekseyev wrote:

It's one possible implementation, but hardly the only one. In fact, this
kind of implementation would have testable consequences - specifically, a
*short* amount of ARM would be able to run unmolested in a debuggerless
environment - i. e. if no interrupts come while in ARM mode. I'll try it
when I get a chance.

You can't prevent interrupts when in Usermode. So even a short function 
will crash sometimes.


When you do a non-Thumb function that does not call any other function 
same only can be influenced by an interrupt. So if it crashes at all, 
you know that the interrupt logic of the OS is buggy.


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


Re: [fpc-devel] XML / SAX - Removing redundancies

2014-03-12 Thread Daniel Gaspary
On Wed, Mar 12, 2014 at 11:04 AM, Daniel Gaspary dgasp...@gmail.com wrote:
 On other topic, a new StaX[1] class, using TXMLTextReader,

I mean, *classes*.

Creating the writer part too.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] XML / SAX - Removing redundancies

2014-03-12 Thread Sergei Gorelkin

12.03.2014 18:10, Daniel Gaspary пишет:

On Wed, Mar 12, 2014 at 11:04 AM, Daniel Gaspary dgasp...@gmail.com wrote:

On other topic, a new StaX[1] class, using TXMLTextReader,


I mean, *classes*.

Creating the writer part too.


Why would you want to use S[t]AX approach in the first place? The interface of .net-based 
XML[Text]Reader and XMLWriter is IMHO much more straightforward and easy to use.


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


Re: [fpc-devel] XML / SAX - Removing redundancies

2014-03-12 Thread Daniel Gaspary
On Wed, Mar 12, 2014 at 11:42 AM, Sergei Gorelkin
sergei_gorel...@mail.ru wrote:
 Why would you want to use S[t]AX approach in the first place?

No special reason at the moment. I didn't examine TXmlTextReader so much yet.

 The interface of .net-based XML[Text]Reader and XMLWriter is IMHO
 much more straightforward and easy to use.

A xmlwriter unit, equivalent to xmlreader, would be interesting.To
have a XML writer independent of DOM.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] XML / SAX - Removing redundancies

2014-03-12 Thread Sergei Gorelkin

12.03.2014 18:58, Daniel Gaspary пишет:

On Wed, Mar 12, 2014 at 11:42 AM, Sergei Gorelkin
sergei_gorel...@mail.ru wrote:

Why would you want to use S[t]AX approach in the first place?


No special reason at the moment. I didn't examine TXmlTextReader so much yet.


The interface of .net-based XML[Text]Reader and XMLWriter is IMHO
much more straightforward and easy to use.


A xmlwriter unit, equivalent to xmlreader, would be interesting.To
have a XML writer independent of DOM.


Here I fully agree, and in the meantime I've already committed some initial changes to TXMLWriter to 
make it function like .net XMLTextWriter.


Regards,
Sergei



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


Re: [fpc-devel] arm-embedded target does not compile in trunk since revision 26964 (Some AVR related changes)

2014-03-12 Thread Michael Ring
As there was no reaction I created a patch, question is if this patch 
can be generally applied or if this version of patch should be specific 
for arm targets. I guess it should be universal because it matches the 
other definitions that also use pChar in the same file.




[ring@macbookpro fpc]$ svn diff rtl/embedded/sysfile.inc
Index: rtl/embedded/sysfile.inc
===
--- rtl/embedded/sysfile.inc(revision 27114)
+++ rtl/embedded/sysfile.inc(working copy)
@@ -69,7 +69,7 @@
 begin
 end;

-procedure do_open(var f;p:PFileTextRecChar;flags:longint; pchangeable: 
boolean);

+procedure do_open(var f;p:pChar;flags:longint; pchangeable: boolean);
 begin
 end;




Am 07.03.14 16:35, schrieb Michael Ring:

Error Message is:

*/bin/mkdir -p /Users/ring/devel/fpc/rtl/units/arm-embedded
/Users/ring/devel/fpc/compiler/ppcrossarm -Cparmv7m @rtl.cfg -Ur 
-Tembedded -Parm -XParm-none-eabi- -Xr -Ur -Xs -O2 -n -Fi../inc 
-Fi../arm -FE. -FU/Users/ring/devel/fpc/rtl/units/arm-embedded -darm 
-dRELEASE -O- -gw2 -Us -Sg system.pp
system.inc(1581,25) Error: Incompatible type for arg no. 2: Got 
PChar, expected PFileTextRecChar
system.inc(1772,8) Warning: Implicit string type conversion from 
RawByteString to UnicodeString

system.pp(257) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted


*


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


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


Re: [fpc-devel] arm-embedded target does not compile in trunk since revision 26964 (Some AVR related changes)

2014-03-12 Thread Jeppe Græsdal Johansen

Den 12-03-2014 16:51, Michael Ring skrev:
As there was no reaction I created a patch, question is if this patch 
can be generally applied or if this version of patch should be 
specific for arm targets. I guess it should be universal because it 
matches the other definitions that also use pChar in the same file.

Hi Michael,

Just fixed this a slightly different way. Sorry for the delay.

Best Regards,
Jeppe
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] XML / SAX - Removing redundancies

2014-03-12 Thread Daniel Gaspary
On Wed, Mar 12, 2014 at 12:18 PM, Sergei Gorelkin
sergei_gorel...@mail.ru wrote:
 Here I fully agree, and in the meantime I've already committed some initial
 changes to TXMLWriter to make it function like .net XMLTextWriter.

Are these changes at trunk? Fcl or LazUtils?

About DOM independence... something against XPath Scanner (at least)
becoming a dom independent unit?
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] XML / SAX - Removing redundancies

2014-03-12 Thread Michael Van Canneyt



On Wed, 12 Mar 2014, Daniel Gaspary wrote:


On Wed, Mar 12, 2014 at 12:18 PM, Sergei Gorelkin
sergei_gorel...@mail.ru wrote:

Here I fully agree, and in the meantime I've already committed some initial
changes to TXMLWriter to make it function like .net XMLTextWriter.


Are these changes at trunk? Fcl or LazUtils?

About DOM independence... something against XPath Scanner (at least)
becoming a dom independent unit?


Curious: How can XPath become dom independent ?
I thought the result of XPath was a series of DOM nodes ?

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


Re: [fpc-devel] XML / SAX - Removing redundancies

2014-03-12 Thread Daniel Gaspary
On Wed, Mar 12, 2014 at 2:23 PM, Michael Van Canneyt
mich...@freepascal.org wrote:
 Curious: How can XPath become dom independent ?
 I thought the result of XPath was a series of DOM nodes ?

Yes, it is. But I'm thinking about using the XPath expressions in other classes.

Maybe a TXmlTextReader descendent with support to some kind of
realtime XPath Filter

Like executing an Event Procedure every time a specific XPath
Expression is matched.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] arm-embedded target does not compile in trunk since revision 26964 (Some AVR related changes)

2014-03-12 Thread Michael Ring

Thank you Jeppe,

I did not want to look impatient, was just wondering if this problem 
somehow did not catch attention... ;-)


Michael

Am 12.03.14 17:41, schrieb Jeppe Græsdal Johansen:

Den 12-03-2014 16:51, Michael Ring skrev:
As there was no reaction I created a patch, question is if this patch 
can be generally applied or if this version of patch should be 
specific for arm targets. I guess it should be universal because it 
matches the other definitions that also use pChar in the same file.

Hi Michael,

Just fixed this a slightly different way. Sorry for the delay.

Best Regards,
Jeppe


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


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


Re: [fpc-devel] XML / SAX - Removing redundancies

2014-03-12 Thread Michael Van Canneyt



On Wed, 12 Mar 2014, Daniel Gaspary wrote:


On Wed, Mar 12, 2014 at 2:23 PM, Michael Van Canneyt
mich...@freepascal.org wrote:

Curious: How can XPath become dom independent ?
I thought the result of XPath was a series of DOM nodes ?


Yes, it is. But I'm thinking about using the XPath expressions in other classes.


Maybe a TXmlTextReader descendent with support to some kind of
realtime XPath Filter

Like executing an Event Procedure every time a specific XPath
Expression is matched.


I seriously doubt this is doable, since XPath works directly on the DOM tree ?

What can be achieved at the most seems to be the parsing of the expression and 
the resulting parse tree.
Which, I agree, would be useful to have available as a separate set of classes.

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


Re: [fpc-devel] XML / SAX - Removing redundancies

2014-03-12 Thread Daniel Gaspary
On Wed, Mar 12, 2014 at 2:36 PM, Michael Van Canneyt
mich...@freepascal.org wrote:
 What can be achieved at the most seems to be the parsing of the expression
 and the resulting parse tree.

Is exactly what I'm trying to say(my lack of English grammar skills
doesn't help). :)

 I seriously doubt this is doable, since XPath works directly on the DOM tree
 ?

Is possible if TXmlReader keeps track of the it's current path. Let's say:

TMyXmlReader = class(TXmlTextReader)
private
 FPath: TStrings; //or another dedicated new CLass to keep a
list of nodes.
public
Register(XPathExpression: string; MethodToCall);
end;

At each step of processing, FPath is updated and is compared to XPathExpression.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] XML / SAX - Removing redundancies

2014-03-12 Thread Daniel Gaspary
On Wed, Mar 12, 2014 at 3:23 PM, Sergei Gorelkin
sergei_gorel...@mail.ru wrote:
 A certain subset of expressions (forward iteration only) can be handled that
 way, yes.
 But in general, XPath requires a source with non-sequential access.

Beyond this use case, could be useful to other implementations of XML,
tree based ones.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] XML / SAX - Removing redundancies

2014-03-12 Thread Sergei Gorelkin

12.03.2014 21:46, Daniel Gaspary пишет:

On Wed, Mar 12, 2014 at 2:36 PM, Michael Van Canneyt
mich...@freepascal.org wrote:

What can be achieved at the most seems to be the parsing of the expression
and the resulting parse tree.


Is exactly what I'm trying to say(my lack of English grammar skills
doesn't help). :)


I seriously doubt this is doable, since XPath works directly on the DOM tree
?


Is possible if TXmlReader keeps track of the it's current path. Let's say:

TMyXmlReader = class(TXmlTextReader)
private
  FPath: TStrings; //or another dedicated new CLass to keep a
list of nodes.
public
 Register(XPathExpression: string; MethodToCall);
end;

At each step of processing, FPath is updated and is compared to XPathExpression.


A certain subset of expressions (forward iteration only) can be handled that 
way, yes.
But in general, XPath requires a source with non-sequential access.

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


Re: [fpc-devel] fpHttpClient heartbeat

2014-03-12 Thread Leonardo M . Ramé


 From: Michael Van Canneyt mich...@freepascal.org
To: Leonardo M. Ramé martinr...@yahoo.com; FPC developers' list 
fpc-devel@lists.freepascal.org 
Sent: Sunday, March 9, 2014 6:22 AM
Subject: Re: [fpc-devel] fpHttpClient heartbeat
 



On Sat, 8 Mar 2014, Leonardo M. Ramé wrote:



 From: Michael Van Canneyt mich...@freepascal.org
 To: FPC developers' list fpc-devel@lists.freepascal.org
 Sent: Saturday, March 8, 2014 2:42 PM
 Subject: Re: [fpc-devel] fpHttpClient heartbeat


 On Sat, 8 Mar 2014, Leonardo M. Ramé wrote:

 Hi, does anyone know if fpHttpClient has something similar to the 
 HeartBeat option of Synapse?, this feature is useful for
 implementing download progress bars, for example.

 It has an onprogress event, this is implemented in trunk.

 Michael.



 Sorry Michael, I cannot find that event, is in 
 packages/fcl-web/src/base/fphttpclient.pp ?.

My apologies, I wrote from memory.

Less than a month ago I implemented:

     Property AllowRedirect : Boolean Read FAllowRedirect Write FAllowRedirect;
     // Maximum number of redirects. When this number is reached, an exception 
is raised.
     Property MaxRedirects : Byte Read FMaxRedirects Write FMaxRedirects 
default DefMaxRedirects;
     // Called On redirect. Dest URL can be edited.
     // If The DEST url is empty on return, the method is aborted (with 
redirect status).
     Property OnRedirect : TRedirectEvent Read FOnRedirect Write FOnRedirect;
     // Authentication.
     // When set, they override the credentials found in the URI.
     // They also override any Authenticate: header in Requestheaders.
     Property UserName : String Read FUserName Write FUserName;
     Property Password : String Read FPassword Write FPassword;
     // If a request returns a 401, then the OnPassword event is fired.
     // It can modify the username/password and set RepeatRequest to true;
     Property OnPassword : TPasswordEvent Read FOnPassword Write FOnPassword;
     // Called whenever data is read from the connection.
     Property OnDataReceived : TDataEvent Read FOnDataReceived Write 
FOnDataReceived;
     // Called when headers have been processed.
     Property OnHeaders : TNotifyEvent Read FOnHeaders Write FOnHeaders;


OnDataReceived and OnHeaders is probably what you are looking for. Sorry for 
the fuzzyness.


Michael.

 
Hi Michael, I noted you created the httpget.pas demo on 
fcl-web/examples/httpclient, that's exactly what I'm looking for.

One little addition to the example can be exception handling, I noted there's 
an EHTTPClient exception raised when an error response is received (404, 500, 
etc).


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

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


Re: [fpc-devel] arm-embedded target does not compile in trunk since revision 26964 (Some AVR related changes)

2014-03-12 Thread Sven Barth
Am 12.03.2014 18:36 schrieb Michael Ring m...@michael-ring.org:
 I did not want to look impatient, was just wondering if this problem
somehow did not catch attention... ;-)
It's usually best to report things like that on the bugtracker.

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