Re: [fpc-pascal] Read JSON from file

2015-08-06 Thread Michael Van Canneyt
On Fri, 7 Aug 2015, Michael Van Canneyt wrote: On Fri, 7 Aug 2015, Felipe Monteiro de Carvalho wrote: On Thu, Aug 6, 2015 at 10:37 PM, Chris Moody wrote: For my current project, I download a file from a server that contains JSON code. I'm not sure how to read it into something that GetJS

Re: [fpc-pascal] Read JSON from file

2015-08-06 Thread Michael Van Canneyt
On Fri, 7 Aug 2015, Felipe Monteiro de Carvalho wrote: On Thu, Aug 6, 2015 at 10:37 PM, Chris Moody wrote: For my current project, I download a file from a server that contains JSON code. I'm not sure how to read it into something that GetJSON is able to handle. My first thought was using T

Re: [fpc-pascal] alignment of records

2015-08-06 Thread Jonas Maebe
Xiangrong Fang wrote: ​OK, as a matter of fact, the stuff was copied from output of h2pas conversion program. :-) Then it seems that h2pas is pretty broken. However, another issue: if I use this : ​{$CODEALIGN RECORDMIN=4} It worked. No, it didn't. The record definition was still wrong.

Re: [fpc-pascal] Read JSON from file

2015-08-06 Thread Michael Van Canneyt
On Thu, 6 Aug 2015, Chris Moody wrote: Hi all, For my current project, I download a file from a server that contains JSON code. I'm not sure how to read it into something that GetJSON is able to handle. My first thought was using TStrings, however not sure how to convert a TString into T

Re: [fpc-pascal] alignment of records

2015-08-06 Thread Xiangrong Fang
> > By using the correct types for the fields: > http://www.freepascal.org/docs-html/rtl/ctypes/index-3.html > > E.g., "unsigned long" is not (always) the same as "dword". > ​ > > ​OK, as a matter of fact, the stuff was copied from output of h2pas conversion program. :-) I will use ctypes to test

Re: [fpc-pascal] alignment of records

2015-08-06 Thread Jonas Maebe
Xiangrong Fang wrote: It seems that $packrecord does not work at all. It works fine. I did some research and found this document: http://www.freepascal.org/docs-html/ref/refsu19.html The documentation seems to be outdated regarding the alignment of arrays. Arrays probably used to be align

Re: [fpc-pascal] alignment of records

2015-08-06 Thread Jonas Maebe
Xiangrong Fang wrote: program test; {$mode objfpc}{$PACKRECORDS C} type ifmap = record mem_start: dword; mem_end: dword; base_addr: word; irq: byte; dma: byte; port: byte; end; begin WriteLn('ifmap=', SizeOf(ifmap)); end. The C struct's size is 24, but pas

Re: [fpc-pascal] Read JSON from file

2015-08-06 Thread Felipe Monteiro de Carvalho
On Thu, Aug 6, 2015 at 10:37 PM, Chris Moody wrote: > For my current project, I download a file from a server that contains JSON > code. I'm not sure how to read it into something that GetJSON is able to > handle. > > My first thought was using TStrings, however not sure how to convert a > TString

Re: [fpc-pascal] alignment of records

2015-08-06 Thread Xiangrong Fang
It seems that $packrecord does not work at all. I did some research and found this document: http://www.freepascal.org/docs-html/ref/refsu19.html compiled and ran the example on that page, I got: ​​Size Trec1 : 4 Offset B : 2 Size Trec2 : 3 Offset B : 1 Size Trec3 : 2 Offset B : 1 Size Trec4 :

[fpc-pascal] alignment of records

2015-08-06 Thread Xiangrong Fang
Hi All, I try to port a program from C to Pascal, see the following example: #include #include #include void main() { printf("ifmap=%ld\n", sizeof(struct ifmap)); } I converted it to: est.c test.pas X program test; {$mode objfpc}{$PACKRECORDS C} type ifmap = record mem_sta

Re: [fpc-pascal] Read JSON from file

2015-08-06 Thread leledumbo
> I download a file from a server that contains JSON code. I'm not sure how to read it into something that GetJSON is able to handle. Can't you figure out from the function interface: http://www.freepascal.org/docs-html/fcl/fpjson/getjson.html -- View this message in context: http://free-pasc

[fpc-pascal] Read JSON from file

2015-08-06 Thread Chris Moody
Hi all, For my current project, I download a file from a server that contains JSON code. I'm not sure how to read it into something that GetJSON is able to handle. My first thought was using TStrings, however not sure how to convert a TString into TStream. Any assistance would be much appr

Re: [fpc-pascal] which GUI (noob)

2015-08-06 Thread waldo kitty
On 08/06/2015 12:30 PM, Graeme Geldenhuys wrote: On 2015-08-06 15:43, Graeme Geldenhuys wrote: 1. Run Lazarus and open the fpgui_toolkit.lpk package found in the fpGUI code: /src/corelib/[x11|gdi]/fpgui_toolkit.lpk Click "Compile". It was brought to my attention that the above is som

Re: [fpc-pascal] which GUI (noob)

2015-08-06 Thread Graeme Geldenhuys
On 2015-08-06 15:43, Graeme Geldenhuys wrote: > 1. Run Lazarus and open the fpgui_toolkit.lpk package found in the >fpGUI code: /src/corelib/[x11|gdi]/fpgui_toolkit.lpk >Click "Compile". It was brought to my attention that the above is somewhat ambiguous. I meant for the text [x11|gdi] t

Re: [fpc-pascal] blowfish in fpc

2015-08-06 Thread Graeme Geldenhuys
On 2015-08-06 16:33, Xiangrong Fang wrote: > I would like to know if the FPC implementation of BlowFish is considered > secure or not? I personally have no idea. But for completeness, there is also the open source project called DCPCrypt [1] which contains another Blowfish implementation, which m

[fpc-pascal] blowfish in fpc

2015-08-06 Thread Xiangrong Fang
Hi All, I would like to know if the FPC implementation of BlowFish is considered secure or not? Especially: 1) Does it has the bug mentioned here: https://www.schneier.com/blowfish-bug.txt 2) Does it operate in ECB mode or CBC mode (or any other mode)? I am sorry that by just looking at the co

Re: [fpc-pascal] which GUI (noob)

2015-08-06 Thread Graeme Geldenhuys
On 2015-08-06 15:26, Peter wrote: > I was unsure how to > get Lazarus to use fpgui in the first place. Anyway, its here, for > anyone interested. Correction. Those instructions mentioned in the URL you posted is to create a LCL-fpGUI application. The LCL-fpGUI widgetset is not feature complete, an

Re: [fpc-pascal] which GUI (noob)

2015-08-06 Thread Peter
On 04/08/15 16:20, Graeme Geldenhuys wrote: > On 2015-08-04 16:11, Peter wrote: >> I have not used Lazarus for a while, but I think you can use it as an >> IDE, while using fpGUI as a component set. Perhaps someone can confirm? > > I believe I answered that in an earlier reply. > > http://lists

Re: [fpc-pascal] another xml question

2015-08-06 Thread Marc Santhoff
On Do, 2015-08-06 at 01:11 -0700, Chris Moody wrote: > Hi Marc, > > Thanks for the feedback. One more question and I think I'm done for now > and able to finish the program I'm writing: > > If FindNode does not locate a node with the given name, what does it > return? I don't know. It looks li

Re: [fpc-pascal] another xml question

2015-08-06 Thread Chris Moody
Hi Marc, Thanks for the feedback. One more question and I think I'm done for now and able to finish the program I'm writing: If FindNode does not locate a node with the given name, what does it return? Thanks, Chris On 07/24/2015 01:34 PM, Marc Santhoff wrote: On Fr, 2015-07-24 at 11:57