Recent

Author Topic: lazutf8.pas debuging errors  (Read 2582 times)

Freeruner

  • Newbie
  • Posts: 2
lazutf8.pas debuging errors
« on: December 08, 2020, 07:21:30 pm »
Hi!

I was very exiting when I find PascalSCADA . And even more, when I find Lazarus.
The reason is that in late 80's and early 90's I typed "few" lines in Pascal, but later Delphi and C++ replaced it and my needs were changed before I learn them.
Now, when I'm looking for available SCADA SW, the Pascal SCADA seems to me perfect choice. Well done!!
Somewhere in PascalSCADA is mentioned that this is not "Out of the Box" product, and I need also LAZARUS SW. which is OK.
I downloaded lazarus-2.0.10-fpc-3.2.0-win64.exe and installed it.
During installation I had some issues regarding the path of FPC sources, but I maneged to point to right one ( path $(LazarusDir)fpc\$(FPCVer)\source was not recognized ).
Later I managed to open and run Lazarus as New Program, and I managed to compile and build few programs ( SchoolFreeware ).
The problems starts when I open new project as Applications.
Even if I open empty application and try to Run it I'm gating errors. Compiling errors goes on lazutf8.pas function UTF8LengthFast.
errors are fallowing:
lazutf8.pas(514,8) Error: Identifier not found "Pint8"
lazutf8.pas(514,14) Error: Error in type definition
lazutf8.pas(528,21) Error: Illegal qualifier
lazutf8.pas(528,42) Error: Illegal qualifier
lazutf8.pas(529,5) Error: Operator is not overloaded: inc "<erroneous type>"
lazutf8.pas(545,21) Error: Illegal qualifier
lazutf8.pas(545,42) Error: Illegal qualifier
lazutf8.pas(546,5) Error: Operator is not overloaded: inc "<erroneous type>"

And code is:
function UTF8LengthFast(p: PChar; ByteCount: PtrInt): PtrInt;
const
{$ifdef CPU32}
  ONEMASK   =$01010101;
  EIGHTYMASK=$80808080;
{$endif}
{$ifdef CPU64}
  ONEMASK   =$0101010101010101;
  EIGHTYMASK=$8080808080808080;
{$endif}
var
  pnx: PPtrInt absolute p; // To get contents of text in PtrInt blocks. x refers to 32 or 64 bits
  pn8: pint8 absolute pnx; // To read text as Int8 in the initial and final loops
  ix: PtrInt absolute pnx; // To read text as PtrInt in the block loop
  nx: PtrInt;              // values processed in block loop
  i,cnt,e: PtrInt;
begin
  Result := 0;
  e := ix+ByteCount; // End marker
  // Handle any initial misaligned bytes.
  cnt := (not (ix-1)) and (sizeof(PtrInt)-1);
  if cnt>ByteCount then
    cnt := ByteCount;
  for i := 1 to cnt do
  begin
    // Is this byte NOT the first byte of a character?
    Result += (pn8^ shr 7) and ((not pn8^) shr 6);
    inc(pn8);
  end;
  // Handle complete blocks
  for i := 1 to (ByteCount-cnt) div sizeof(PtrInt) do
  begin
    // Count bytes which are NOT the first byte of a character.
    nx := ((pnx^ and EIGHTYMASK) shr 7) and ((not pnx^) shr 6);
    {$push}{$overflowchecks off} // "nx * ONEMASK" causes an arithmetic overflow.
    Result += (nx * ONEMASK) >> ((sizeof(PtrInt) - 1) * 8);
    {$pop}
    inc(pnx);
  end;
  // Take care of any left-over bytes.
  while ix<e do
  begin
    // Is this byte NOT the first byte of a character?
    Result += (pn8^ shr 7) and ((not pn8^) shr 6);
    inc(pn8);
  end;
  Result := ByteCount - Result;
end;

Before I sadly Uninstall everything. I'm interestrd if anyone have an Idea how to fix this errors and why they appear.
Not to forget, I'm running Lazarus on Win 7 Pro SP1, 64bit; i7.

Best regards,

Freeruner.




« Last Edit: December 08, 2020, 10:45:18 pm by Freeruner »

winni

  • Hero Member
  • *****
  • Posts: 2663
Re: lazutf8.pas debuging errors
« Reply #1 on: December 08, 2020, 10:57:43 pm »
Hi!

I think these errors result in the strange way you build your house.

Starting with the balkony.
Then the walls.
And finally the basement.

I would first install the basement: fpc
Then the walls: Lazarus
And finallly PascalSCADA - if you like.

This error is definitly a result of your strange order of installing:

Code: Text  [Select][+][-]
  1. lazutf8.pas(514,8) Error: Identifier not found "Pint8"

Pint8 is part of of the basic unit system which is installed with fpc.

But as you installed Lazarus before fpc there are some lost connections.


Do it the other way round.

Winni

Freeruner

  • Newbie
  • Posts: 2
Re: lazutf8.pas debuging errors
« Reply #2 on: December 08, 2020, 11:17:30 pm »
Thank You Winni for Your advice.
I've done Your way the first time.
I'm going to try again.

Best regards,

Freeruner.

 

TinyPortal © 2005-2018