Re: [fpc-pascal] Searchable docs online
On Sun, 8 Jul 2018, Ryan Joseph wrote: Just tried to use https://www.freepascal.org/docsearch/docsearch.html and it seems to have a bug (not working, errors in the JS console). Awaiting the source on svn also. :) Possibly, I have been doing some experiments. I have re-enabled it. It is now also referred to from the main docs page: https://www.freepascal.org/docs.var The search term edit box now has type-ahead enabled. Sources (webpage/server) can be found on: https://svn.freepascal.org/svn/html/docsearch/ The server needs the latest fpindexer: https://svn.freepascal.org/svn/fpc/trunk/packages/fpindexer/ The indexer works using postgres, but sqlite, firebird (in fact any SQLDB DB) are also supported. There is also support for a custom file format. The "client" is written in pas2js. So it comprises now a full-fledged example of how FPC can be used as a full-stack web development environment. In a couple of moments, I will commit a more general version of the HTML searchengine under fpindexer examples. Michael. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to find address of record member
On 08/07/2018 19:08, Bo Berglund wrote: But typecasting the operation fixed the problem: offs := Cardinal(@FAppData.Info) - Cardinal(@FAppData); No compiler errors here anymore. May be a result of {$TYPEDADDRESS On} which may be default in some mode switches. Untyped pointers seem to be subtract-able. But typed pointers of different type. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Searchable docs online
Just tried to use https://www.freepascal.org/docsearch/docsearch.html and it seems to have a bug (not working, errors in the JS console). Awaiting the source on svn also. :) Regards, Ryan Joseph ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to find address of record member
On Sun, 08 Jul 2018 18:28:34 +0200, Bo Berglund wrote: >I tried this: >var > offs: word; >begin > ... > offs := @FAppData.Info - @FAppData; //Info is 4th member of record > address := AppBase + (AppNumber -1) * (SizeOf(TAppData) div 2) + >offs; > >But it was not accepted by the compiler (on the offs := line)... >Error: Operator not applicable to this operand type But typecasting the operation fixed the problem: offs := Cardinal(@FAppData.Info) - Cardinal(@FAppData); No compiler errors here anymore. -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to find address of record member
On Sun, 8 Jul 2018 17:16:01 +0200, Martin wrote: >On 08/07/2018 17:07, Bo Berglund wrote: >> Say I have a record type defined like this: >> >>TAppData = packed record //Total 8 bytes per app >> ActiveToken: word; //Matches constant for app if active >> Option: word; //16 option bits >> ExpDate: word; //Integer TDateTime values >> Info: word;//16 info bits >>end; >> >> The data is stored in a security dongle memory which can be accessed >> only a word at a time by its word address 0..55. >> >> I want to write my code such that the address to the individual member >> is calculated automatically so if the record type is modified it will >> still work. >> > >var AppData: TAppData absolute 0; >begin >writeln( ptrint( @AppData.Option )); > >You can also take a variable without "absolute" >@AppData.Option - @AppData I tried this: var offs: word; begin ... offs := @FAppData.Info - @FAppData; //Info is 4th member of record address := AppBase + (AppNumber -1) * (SizeOf(TAppData) div 2) + offs; But it was not accepted by the compiler (on the offs := line)... Error: Operator not applicable to this operand type FAppData is declared in the class definition like this: TDongle = class private { Private declarations } FAppNumber, FKeySerial, FKeyFound: boolean; FAppData: TAppData; I don't know the command 'absolute' and how it can be applied here in a class definition. -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] Benchmarks
I am curious, Has anyone benchmarked the new AMD Ryzen vs Intel chips with FreePascal. 10 years or so ago, I had a multi core AMD Desktop and an Intel based laptop. With FreePascal the laptop was outperforming the desktop. When I upgraded that machine, I upgraded to Intel since I use FreePascal a lot. I was wondering if the situation was still the same? Terry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] How to find address of record member
On 08/07/2018 17:07, Bo Berglund wrote: Say I have a record type defined like this: TAppData = packed record //Total 8 bytes per app ActiveToken: word; //Matches constant for app if active Option: word; //16 option bits ExpDate: word; //Integer TDateTime values Info: word;//16 info bits end; The data is stored in a security dongle memory which can be accessed only a word at a time by its word address 0..55. I want to write my code such that the address to the individual member is calculated automatically so if the record type is modified it will still work. var AppData: TAppData absolute 0; begin writeln( ptrint( @AppData.Option )); You can also take a variable without "absolute" @AppData.Option - @AppData ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
[fpc-pascal] How to find address of record member
Say I have a record type defined like this: TAppData = packed record //Total 8 bytes per app ActiveToken: word; //Matches constant for app if active Option: word; //16 option bits ExpDate: word; //Integer TDateTime values Info: word;//16 info bits end; The data is stored in a security dongle memory which can be accessed only a word at a time by its word address 0..55. I want to write my code such that the address to the individual member is calculated automatically so if the record type is modified it will still work. So far I have this for the setter: //Info is 4th member of record address := AppBase + (AppNumber -1) * (SizeOf(TAppData) div 2) + 3; WriteMemory(address, Value); Appbase is defined in a global constants unit as where the array of app records in dongle memory starts. While programming I have found that mistakes are easy if fixed offset constants are used, like 3 in the example. Is there some way to get the address within the record of a member value? -- Bo Berglund Developer in Sweden ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal