Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-03

fpc registry unit

14 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

John Lee

Think I'm missing something! I need the/a fpc registry unit - I can't seem to find it on svn - lots of references to it! Pls send or point me to it.

Code extract (from synaser) that I need to work is
var reg:tregistry;
...
    reg.RootKey := HKEY_LOCAL_MACHINE;
    reg.OpenKey('\HARDWARE\DEVICEMAP\SERIALCOMM', false);
    reg.GetValueNames(l);
    for n := 0 to l.Count - 1 do
      v.Add(reg.ReadString(l[n]));
    Result := v.CommaText;

I have found a registry unit (registry.pas) on internet but it looks old & only has stuff like ROpenKey(const Key: String; const KeyBuf: PChar):Longint; export;

John

Reply by email

Howard Page-Clark
to John Lee
John Lee wrote
Think I'm missing something! I need the/a fpc registry unit - I can't seem to find it on svn - lots of references to it! Pls send or point me to it.

If you use Lazarus, just make sure FCL is a declared dependency in your project, and add

uses registry;

to the relevant unit.

registry.pp is in ...\packages\fcl-registry\

Reply by email

Sven Barth
to John Lee
John Lee wrote 5 lines
Thanks - just want a simple unit, I'm not using lazarus. If I go to this directory and try to compile registry with v2.6.2, win32, it then uses inifiles so that's needed and not part of the fpc 2.6.2 distribution afaik. Where can I find that please?

If you download a 2.6.2 release and install it everything will already be in please. You just need to use the registry unit.

Nevertheless the unit IniFiles is located in $fpcdir/packages/fcl-base/src

Regards,
Sven

Reply by email

John Lee
to Sven Barth

Thanks all for your help - found the .ppu and .o at last - I note than inifiles itself needs some other stupid unit! ! I think you'll agree it is all more than somewhat compllcated tho' - can't see why registry unit is part of fcl tho - surely it is a simple routine for reading the registry - not rocket science- just a windows utility so should be eg in \rtl\ or objpas or something like that so one can easily find it and compile it with whatever version of fpc w/o hassle and fighting with n dependencies which don't add any real value.

Everything should be as simple as possible... as the great man said!.

John

Sven Barth wrote 22 lines
On 01.03.2013 19:57, John Lee wrote: > Thanks - just want a simple unit, I'm not using lazarus. > > If I go to this directory and try to compile registry with v2.6.2, > win32, it then uses inifiles so that's needed and not part of the fpc > 2.6.2 distribution afaik. Where can I find that please? > If you download a 2.6.2 release and install it everything will already be in please. You just need to use the registry unit. Nevertheless the unit IniFiles is located in $fpcdir/packages/fcl-base/src Regards, Sven ______________________________**_________________ fpc-pascal maillist - http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal>

Reply by email

Sven Barth
to John Lee
John Lee wrote 10 lines
Thanks all for your help - found the .ppu and .o at last - I note than inifiles itself needs some other stupid unit! ! I think you'll agree it is all more than somewhat compllcated tho' - can't see why registry unit is part of fcl tho - surely it is a simple routine for reading the registry - not rocket science- just a windows utility so should be eg in \rtl\ or objpas or something like that so one can easily find it and compile it with whatever version of fpc w/o hassle and fighting with n dependencies which don't add any real value. Everything should be as simple as possible... as the great man said!.

It *is* simple. When you do an installation of FPC a "fpc.cfg" is created where all the unit paths included with the installation are already included. So the only thing you need to do is to add "registry" to your "uses" clause, compile and be happy.

And "registry" is part of the FCL, because it is no base unit.

Regards,
Sven

Reply by email

Mark Morgan Lloyd
to Sven Barth
Sven Barth wrote 5 lines
> Everything should be as simple as possible... as the great man said!. It *is* simple. When you do an installation of FPC a "fpc.cfg" is created where all the unit paths included with the installation are already included.

Provided that, on any given system, you've initially installed from the binary release files or from a correctly built distro-specific package. I normally build from svn, but am used to having to copy /etc/fpc.cfg when bootstrapping as the one "out of tree" file.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

John Lee
to Sven Barth: It *is* simple. When you do an installation of FPC a "fpc.cfg" is created where all the…

Registry is not part of rtl because it's not a base unit??? This is my point it uses 200 other f*** units that aren't really needed!

So you are saying if one wants a single 50 line unit & does a complex procedure eg installi ng 10^10 lines of fpc etc then it is simple? And of course you have to do this for every version of fpc you want to use!

And, of course as I've seen, the size of the .exe from v2.2.2 cf v2.6.2 is twice as large because of all the c*** included by the various uses..

This is all simple? Not in my dictionary's definition! Dooooooh

J

BTW, the other impact is that the size of the .exe

Sven Barth wrote 28 lines
On 01.03.2013 21:57, John Lee wrote: > Thanks all for your help - found the .ppu and .o at last - I note than > inifiles itself needs some other stupid unit! ! I think you'll agree it > is all more than somewhat compllcated tho' - can't see why registry unit > is part of fcl tho - surely it is a simple routine for reading the > registry - not rocket science- just a windows utility so should be eg in > \rtl\ or objpas or something like that so one can easily find it and > compile it with whatever version of fpc w/o hassle and fighting with n > dependencies which don't add any real value. > > Everything should be as simple as possible... as the great man said!. > It *is* simple. When you do an installation of FPC a "fpc.cfg" is created where all the unit paths included with the installation are already included. So the only thing you need to do is to add "registry" to your "uses" clause, compile and be happy. And "registry" is part of the FCL, because it is no base unit. Regards, Sven ______________________________**_________________ fpc-pascal maillist - http://lists.freepascal.org/**mailman/listinfo/fpc-pascal<http://lists.freepascal.org/mailman/listinfo/fpc-pascal>

Reply by email

Marco van de Voort
to John Lee

In our previous episode, John Lee said:

Registry is not part of rtl because it's not a base unit???

Yes. The registry is not needed for bootstrapping the compiler, or internally in the RTL. This is roughly the definition of the RTL, though there is some history there.

On non Windows, registry also depends on, among others, the XML classes for emulation

This is my point it uses 200 other f*** units that aren't really needed!

Apparently they are needed, or otherwise they wouldn't be included.

So you are saying if one wants a single 50 line unit & does a complex procedure eg installi ng 10^10 lines of fpc etc then it is simple? And of course you have to do this for every version of fpc you want to use!

Yes. That is what is said yes. The most minimalistic scenarios are not pre-prepared in the distribution. OTOH this was all the case with 2.2.2 too.

And, of course as I've seen, the size of the .exe from v2.2.2 cf v2.6.2 is twice as large because of all the c*** included by the various uses..

Another neverending debate. Enough has been said about this.

This is all simple? Not in my dictionary's definition! Dooooooh

Just install the distribution, and don't worry so much about EXE sizes, that is the simple solution

Reply by email

leledumbo
to John Lee: Registry is not part of rtl because it's not a base unit??? This is my point it uses 200…
Registry is not part of rtl because it's not a base unit??? This is my

point it uses 200 other f*** units that aren't really needed!

YOU don't use those 200 units, but the UNIT YOU USE needs them. Get the point?
Even though you don't, what about other people? FPC is not released just for you, dude. Stop being selfish...

So you are saying if one wants a single 50 line unit & does a complex procedure eg installi ng 10^10 lines of fpc etc then it is simple? And of course you have to do this for every version of fpc you want to use!

Simple, just grab the installer (win or mac), or take from repository (lin), or compile from source (all).
You don't seem to understand the basic concept how modular programming (unit) works, and FPC packages is highly modular. We won't include everything in a single unit, that's SILLY.

And, of course as I've seen, the size of the .exe from v2.2.2 cf v2.6.2 is twice as large because of all the c*** included by the various uses..

Not really, code size increase can come from anything. Feature support, unstripped binaries, change in debug info format, etc. but so what? How big is that anyway? Twice? You must be kidding, if you do everything properly, the size increase won't even touch 20%. I have an application that I've developed since 2008 (https://code.google.com/p/express-gui) and you can see the "increase" in size of the binaries from time to time (search All Downloads to see everything since 2008). Increase? Yeah if you count backwards...

This is all simple? Not in my dictionary's definition! Dooooooh

Then expand it, your dictionary is too localized and narrow

View this message in context: http://free-pascal-general.1045716.n5.nabble.com/fpc-registry-unit-tp5713265p5713290.html Sent from the Free Pascal - General mailing list .

Reply by email

Mark Morgan Lloyd
to leledumbo
Show quoted text 11 lines
> Registry is not part of rtl because it's not a base unit??? This is my > point it uses 200 other f*** units that aren't really needed! > > So you are saying if one wants a single 50 line unit & does a complex > procedure eg installi ng 10^10 lines of fpc etc then it is simple? And of > course you have to do this for every version of fpc you want to use! > > And, of course as I've seen, the size of the .exe from v2.2.2 cf v2.6.2 > is twice as large because of all the c*** included by the various uses.. > > This is all simple? Not in my dictionary's definition! Dooooooh

What on earth brought that rant on? Being charitable, I have to assume that somebody was "tired and emotional".

John: the registry unit is fairly straightforward: it imports four units in total:

   {$ifndef XMLREG}
     Windows,
   {$endif XMLREG}
     Classes,
     SysUtils,
     inifiles;

The xmlreg unit pulls in various XML stuff which obviously has an overhead. But where on earth do you get this "200 other units" idea?

If you find a unit that imports something else with no reason (which will usually cause a compile-time warning), then raise it here or report it as a bug. Similarly, if you find that smartlinking leaves something in the executable that should be removed then raise it. Finally, if you find something in the documentation that you don't understand then raise it here since if you don't get it then it's probably obscure to other less-experienced users as well. Most of us won't jump down your throat unless you start cussing :-/

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Sven Barth
to John Lee: Registry is not part of rtl because it's not a base unit??? This is my point it uses 200…
John Lee wrote
Registry is not part of rtl because it's not a base unit??? This is my point it uses 200 other f*** units that aren't really needed!

Not needed by you perhaps. The Registry unit also provides the TRegIniFile out of Delphi compatiblity which is a TIniFile descendant of which the name value pairs are stored in the registry.

So you are saying if one wants a single 50 line unit & does a complex procedure eg installi ng 10^10 lines of fpc etc then it is simple? And of course you have to do this for every version of fpc you want to use!

You install the FPC distribution once and then you have access to all the units provided with FPC. And in normal cases the compiler will recognize if you don't use certain code or certain classes in a unit and then it will not link in the corresponding code (e.g. the TRegIniFile mentioned above will not be in your final executable if you don't use it). The compiler needs all used units however during the parsing phase to check whether everything is ok.

And, of course as I've seen, the size of the .exe from v2.2.2 cf v2.6.2 is twice as large because of all the c*** included by the various uses..

You need to give explicit examples and what compiler options you used. These can make a big difference.

This is all simple? Not in my dictionary's definition! Dooooooh

Yes, it is simple.

Regards,
Sven

Reply by email

John Lee
to leledumbo: point it uses 200 other f*** units that aren't really needed! YOU don't use those 200…
leledumbo wrote 10 lines
> Registry is not part of rtl because it's not a base unit??? This is my point it uses 200 other f*** units that aren't really needed! YOU don't use those 200 units, but the UNIT YOU USE needs them. Get the point? Even though you don't, what about other people? FPC is not released just for you, dude. Stop being selfish... Well aware of other fpcers needs - was just complaining about the problems

in finding a suitable small unit - dude! I think after 500 years of fpc ing (or it sometimes seems like that) I'm entitled to make the 'overcomplex' argument even if, dude, you don't agree.

Show quoted text 13 lines
> So you are saying if one wants a single 50 line unit & does a complex > procedure eg installi ng 10^10 lines of fpc etc then it is simple? And of > course you have to do this for every version of fpc you want to use! Simple, just grab the installer (win or mac), or take from repository (lin), or compile from source (all). You don't seem to understand the basic concept how modular programming (unit) works, and FPC packages is highly modular. We won't include everything in a single unit, that's SILLY. Think I'm as well aware of such ideas - been here for somewhat longer than

you I suspect!

Show quoted text 17 lines
> And, of course as I've seen, the size of the .exe from v2.2.2 cf v2.6.2 > is twice as large because of all the c*** included by the various uses.. Not really, code size increase can come from anything. Feature support, unstripped binaries, change in debug info format, etc. but so what? How big is that anyway? Twice? You must be kidding, if you do everything properly, the size increase won't even touch 20%. I have an application that I've developed since 2008 (https://code.google.com/p/express-gui) and you can see the "increase" in size of the binaries from time to time (search All Downloads to see everything since 2008). Increase? Yeah if you count backwards... > This is all simple? Not in my dictionary's definition! Dooooooh Then expand it, your dictionary is too localized and narrow

A dictionary def can't be expanded as you put it - simple is simple

Reply by email