[fpc-pascal] OData and Office365 REST API support
Hello, Long overdue, I have finally committed the initial version of the odata package in the FPC repository. This package provides the base for OData integration in your applications. OData is a standard adopted by the OASIS group: it describes data exchange through REST APIs. OData V4 and OData V2 are supported. The workings of the OData integration are demonstrated in the conversion of the MS Office365 Unified REST API. (MS Graph). This allows seamless integration of all Office365 components in your application. Additionally, the (huge) Sharepoint Online REST API (which uses V2 of the OData protocol) has also been converted. All this, with some sample programs and the conversion tool for OData metadata files, is committed in FPC's subversion, revision 34097. Suggestions, testing: all welcome. Enjoy, Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OData and Office365 REST API support
On Mon, Jul 11, 2016 at 10:50 AM, Michael Van Canneyt < mich...@freepascal.org> wrote: > Long overdue, I have finally committed the initial version of the odata > package in the FPC repository. > Is it worth its own repository, similar to googleapis? thanks, Dmitry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] can the compiler zero any out parameter of procedure/function automatically?
I just found the cause of a strange bug is because I forgot to zero the out parameter of a procedure like. procedure FindEvent (out TheEvent : TNotifyEvent); begin TheEvent := nil;//I forgot to add this line before all the processing, which sometimes did not assign to TheEvent at all long code... end; when later, I called. var aEvent : TNotifyEvent; FindEvent(aEvent); if assigned(aEvent) then aEvent(nil); -> cause serious error that crash the program. I know it is my responsibility to initialize out parameters, but I think the compiler could help us by initializing all out parameters. Am I the only one with this view? Dennis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Why is WinCE target missing the Windows IsCharAlpha() API
Hi, Why is FPC WinCE target missing the Windows IsCharAlpha() API definition, including some others (I'll try and make a more complete list soon). MSDN: IsCharAlpha (Windows CE 5.0) https://msdn.microsoft.com/en-us/library/ms885690.aspx But as the requirements show, this API was included since WinCE 1.0. I was testing with the official FPC 2.6.4 ARM cross-compiler for WinCE. Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] can the compiler zero any out parameter of procedure/function automatically?
Dennis wrote: > I know it is my responsibility to initialize out parameters, but I think > the compiler could help us by initializing all out parameters. The compiler will fill out-parameters with garbage if you use the -gt command line parameter, which can help you detect such problems more easily. If you forget to assign a value to an out-parameter in a particular case, having it return nil by default could easily be just as wrong as it returning any other random value. For that reason, there is no support for automatically initialising out-parameters. Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OData and Office365 REST API support
On Mon, 11 Jul 2016, Dmitry Boyarintsev wrote: On Mon, Jul 11, 2016 at 10:50 AM, Michael Van Canneyt < mich...@freepascal.org> wrote: Long overdue, I have finally committed the initial version of the odata package in the FPC repository. Is it worth its own repository, similar to googleapis? googleapis also does not have an own repository ? Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] can the compiler zero any out parameter of procedure/function automatically?
Jonas Maebe wrote: Dennis wrote: I know it is my responsibility to initialize out parameters, but I think the compiler could help us by initializing all out parameters. The compiler will fill out-parameters with garbage if you use the -gt command line parameter, which can help you detect such problems more easily. If you forget to assign a value to an out-parameter in a particular case, having it return nil by default could easily be just as wrong as it returning any other random value. For that reason, there is no support for automatically initialising out-parameters. How about issue a compiler warning if one forgets to zero any out parameter? Dennis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OData and Office365 REST API support
On Mon, Jul 11, 2016 at 1:05 PM, Michael Van Canneyt wrote: > > googleapis also does not have an own repository ? > > They don't, but maybe they should. It's just taking more and more time to check out trunk. thanks, Dmitry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OData and Office365 REST API support
On Mon, 11 Jul 2016, Dmitry Boyarintsev wrote: On Mon, Jul 11, 2016 at 1:05 PM, Michael Van Canneyt wrote: googleapis also does not have an own repository ? They don't, but maybe they should. It's just taking more and more time to check out trunk. How often do you check out trunk ? I can't remember when I last did that. I think I have explained my reasoning for including this in FPC SVN before: I consider these things as fundamental as the Win32 API or MacOS or libc headers. The world is more and more connected. More and more web APIs exist. That they happen to work over the net is irrelevant; As such, I consider web APIs an essential part of the compiler (or indeed any) toolchain. In fact I think FPC is woefully behind in this department... Michael. PS. Maybe switching to git alone may make a checkout less painful, if we may believe some supporters... But that is the topic of a separate thread :-) ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OData and Office365 REST API support
On Mon, Jul 11, 2016 at 2:32 PM, Michael Van Canneyt wrote: > As such, I consider web APIs an essential part of the compiler (or indeed > any) toolchain. In fact I think FPC is woefully behind in this department... > Then I have API design question.Is it possible not to bind web-apis to fcl-web package? If my application is already using some other HTTP library (synapse or indy), I'd like to keep using it, even for the new API, rather than having code duplicating functionality (which would be fcl-web). thanks, Dmitry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OData and Office365 REST API support
On 2016-07-11 19:32, Michael Van Canneyt wrote: > Maybe switching to git alone may make a checkout less painful I have no doubts. ;-) Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OData and Office365 REST API support
2016-07-11 16:23 GMT-03:00 Graeme Geldenhuys : > On 2016-07-11 19:32, Michael Van Canneyt wrote: > > Maybe switching to git alone may make a checkout less painful > > I have no doubts. ;-) > > Regarding the checkout it would be slower than the svn checkout since git retrieves all the revision history. In a project with such long history, it will take a while to complete the checkout. In the other side, IMO git has advantages that outweight this drawback. Luiz ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OData and Office365 REST API support
On Mon, 11 Jul 2016, Dmitry Boyarintsev wrote: On Mon, Jul 11, 2016 at 2:32 PM, Michael Van Canneyt wrote: As such, I consider web APIs an essential part of the compiler (or indeed any) toolchain. In fact I think FPC is woefully behind in this department... Then I have API design question.Is it possible not to bind web-apis to fcl-web package? Yes, absolutely. If my application is already using some other HTTP library (synapse or indy), I'd like to keep using it, even for the new API, rather than having code duplicating functionality (which would be fcl-web). Aha !! I am VERY glad you asked this question. I had the same consideration when creating it :-) :-) In fact, the web-apis are bound only to fpwebclient and restbase units: I put restbase.pp in fcl-web only because, well, a REST API _is_ web based. But I could put it in a separate package just as well :-) fpwebclient contains only TFPAbstractWebclient. This is an abstract class, for which I have 2 ready-made descendents: - fphttpwebclient (which is in fcl-web and uses fphttpclient) - synapsewebclient (it uses httpsend. I have the source in private, but I can publish it anywhere you want) Both work equally well, I have used both in production. The only reason I didn't yet implement a version for lnet or Indy, is because I didn't have the time... But anyone looking at the code for synapse or fphttpwebclient can make a descendant in less than half an hour. We could put the source code for all non-strict-FPC descendants in the fpcprojects repository, or I could publish them on my github page. (Which is very empty at the moment) Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OData and Office365 REST API support
On Mon, Jul 11, 2016 at 5:12 PM, Michael Van Canneyt wrote: > I am VERY glad you asked this question. I had the same consideration when > creating it :-) :-) > [snip] > Got it. Thank you for clarification. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Why is WinCE target missing the Windows IsCharAlpha() API
Am 11.07.2016 17:58 schrieb "Graeme Geldenhuys" < mailingli...@geldenhuys.co.uk>: > > Hi, > > Why is FPC WinCE target missing the Windows IsCharAlpha() API > definition, including some others (I'll try and make a more complete > list soon). Probably because it was forgotten to be added... Please file a bug report. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OData and Office365 REST API support
Am 11.07.2016 20:31 schrieb "Michael Van Canneyt" : > > > > On Mon, 11 Jul 2016, Dmitry Boyarintsev wrote: > >> On Mon, Jul 11, 2016 at 1:05 PM, Michael Van Canneyt < mich...@freepascal.org >>> >>> wrote: >> >> >>> >>> googleapis also does not have an own repository ? >>> >>> They don't, but maybe they should. >> >> It's just taking more and more time to check out trunk. > > > How often do you check out trunk ? I can't remember when I last did that. > > I think I have explained my reasoning for including this in FPC SVN before: I consider these things as fundamental as the Win32 API or MacOS or libc headers. The world is more and more connected. More and more web APIs exist. That they happen to work over the net is irrelevant; > > As such, I consider web APIs an essential part of the compiler (or indeed any) toolchain. In fact I think FPC is woefully behind in this department... I personally(!) would prefer this and quite some other packages of the packages dir to be in an official repo for fppkg. Especially the googleapis package (and I'd guess this one as well) does really add quite a bit of compilation time on my older machines... Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] OData and Office365 REST API support
On 2016-07-11 20:31, Luiz Americo Pereira Camara wrote: > Regarding the checkout it would be slower than the svn checkout since git > retrieves all the revision history. Only if you want the full history - you have a choice. For example... git clone --depth 8 https://github.com/graemeg/freepascal fpc-3.1.1 ...will only have a history of 8 commits per branch after the initial checkout. This took 18 seconds on my system. I’m based in the UK, and I gather Github is in the USA somewhere. That time is just the initial checkout. After that you do a ‘git pull’ and it will take 1-3 seconds to update with the latest code changes. The actual download size is minimal, as git only downloads compressed commit deltas after the initial clone. > In the other side, IMO git has advantages that outweight this drawback. +1000 But that’s not for this discussion. Regards, Graeme ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Surprise. Comparison of method is only done on the routine address
I always thought comparison of methods is done on both the data and the code part. TMethod = record Code : CodePointer; Data : Pointer; end; But the following proves it is NOT. What is the rationale behind such behavior? -- program compare_events; {$mode objfpc}{$H+} uses classes; type TA=class procedure Proc(aSender : TObject);virtual; end; TB=class(TA) procedure Proc(aSender : TObject);override; end; TC=Class(TA) end; var E1,E2,E3 : TNotifyEvent; A : TA; B : TB; C : TC; procedure TB.Proc(aSender: TObject); begin inherited Proc(aSender); end; procedure TA.Proc(aSender: TObject); begin end; begin a := TA.Create; B := TB.Create; C := TC.Create; try E1 := @(A.Proc); E2 := @(B.Proc); E3 := @(C.Proc); if E1 = E2 then Writeln('A.Proc = B.Proc') else Writeln('A.Proc <> B.Proc'); if E1 = E3 then Writeln('A.Proc = C.Proc') else Writeln('A.Proc <> C.Proc') ; Readln; finally A.Free; B.Free; C.Free; end; end. {===the program gives the following output} A.Proc <> B.Proc A.Proc = C.Proc {end of output} ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal