[Lazarus] Where is the System Unit source?

Sven Barth pascaldragon at googlemail.com
Wed Nov 14 11:50:07 CET 2012


Am 14.11.2012 05:19, schrieb Curt Carpenter:
> Hello.
>
> I am using Lazarus 0.9.30.4 with FPC 2.6.0 under Windows XP.
>
> In my system, the two functions "hi(x)" and "lo(x)" don't seem to work 
> if the argument x is an integer variable (although both functions work 
> fine if x is a WORD variable).
>
Why do you come to the conclusion that they work incorrectly? Do you 
have an example where you can state what you expect and what you get?

> To see if I could figure out why this is, I started trying to find the 
> System unit that contains these two functions.  I haven't been able to 
> locate it though.

The hi and lo functions are compiler intrinsics and are not visible in 
code (the compiler generates specific code for them). If you still want 
to explore: they are implemented in compiler/ninl.pas (look for 
"in_XX_YYY" where "XX" is either "hi" or "lo" and "YYY" is "word", 
"long" or "qword").

>
> Could anyone tell me where I'll find the system unit source?  I have 
> the source for FPC, but can's seem to find system.pas anywhere.
>
The system units are called "system.pp" (not .pas) and are located for 
each target in rtl/TARGET/system.pp (these usually include files from 
rtl/inc or rtl/TARGET or rtl/PLATFORM) (example for TARGET is win32 or 
linux, example for PLATFORM is i386 or arm)

Regards,
Sven




More information about the Lazarus mailing list