[Lazarus] Where is the System Unit source?

Salvatore Coppola coppolastudio at gmail.com
Thu Nov 15 13:32:55 CET 2012


Maybe the follow can help
Byte	 0 .. 255	 1
Shortint	 -128 .. 127	 1
Smallint	 -32768 .. 32767	 2
Word	 0 .. 65535	 2
Integer	 either smallint or longint	 size 2 or 4
Cardinal	 longword	 4
Longint	 -2147483648 .. 2147483647	 4
Longword	 0 .. 4294967295	 4
Int64	-9223372036854775808 .. 9223372036854775807	 8
QWord	 0 .. 18446744073709551615	 8

http://www.freepascal.org/docs-html/ref/refsu5.html


2012/11/14 Curt Carpenter <1cjcarpenter at att.net>:
> Hello Sven.
>
> Thank you for the help.
>
> I tried this code:
>
> procedure test;
> var c: integer;
>       loc,hic: byte;
> begin
>     c := 1000;
>     hic := hi(c);
>     loc := lo(c);
> end;
>
> The result is always hic = 0 and loc = 0 for me.
>
> I have looked in ninl.pas as you suggested, and found the in_lo_xxxxxx
> items around line 2780 in that file.  I note that in_lo_integer  and
> in_hi_integer do not appear among the items listed.
>
> In fpc/rtl/inc/system.inc,   I find Hi(b:byte): byte declared.
> in fpc/rtl/inc/systemh.inc, I find only declarations for hi and lo.
>
> I'm guessing that somehow hi(i:integer): byte  and lo(i:integer): byte got
> dropped from the code base somehow (but remained in the fpc documentation).
>
> Perhaps it's located somewhere that I have not looked yet?
>
> Anyway -- thanks to all who gave me some pointers!   I don't have the skill
> to try to suggest a fix, if in fact one is required. The work-around for me
> is to simply use word rather than integer types.
>
> Regards,
> Curt Carpenter
>
>
> On 11/14/2012 4:50 AM, Sven Barth wrote:
>>
>> 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
>>
>> --
>> _______________________________________________
>> Lazarus mailing list
>> Lazarus at lists.lazarus.freepascal.org
>> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
>>
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus




More information about the Lazarus mailing list