LazBarcode: Major update with many more barcodes.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8205 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-03-09 22:33:06 +00:00
parent 7034ab1715
commit 406e8bbb45
81 changed files with 12418 additions and 1151 deletions

View File

@ -0,0 +1,86 @@
unit lbc_common;
{$mode objfpc}{$H+}
interface
uses
SysUtils, Types, zint;
function ustrlen(const AData: TByteDynArray): NativeInt;
procedure ustrcpy(var ATarget: TByteDynArray; const ASource: TByteDynArray);
procedure ustrcpy(var ATarget: TByteDynArray; const ASource: String);
procedure uconcat(var ADest: TByteDynArray; const ASource: TByteDynArray);
procedure uconcat(var ADest: TByteDynArray; const ASource: TCharDynArray);
procedure uconcat(var ADest: TByteDynArray; const ASource: String);
implementation
{ Local replacement for strlen() with uint8_t strings }
function ustrlen(const AData: TByteDynArray): NativeInt;
var
i: NativeInt;
begin
Result := High(AData) - Low(AData) + 1;
for i := Low(AData) to High(AData) do
if AData[i] = 0 then
begin
Result := i - Low(AData);
break;
end;
end;
{ Local replacement for strcpy() with uint8_t strings }
procedure ustrcpy(var ATarget: TByteDynArray; const ASource: TByteDynArray);
var
len: NativeInt;
begin
len := ustrlen(ASource);
if len > 0 then
begin
Move(ASource[0], ATarget[0], Len+1);
ATarget[len] := 0; // Be sure we have zero terminal
end;
end;
procedure ustrcpy(var ATarget: TByteDynArray; const ASource: String);
var
len: NativeInt;
begin
len := Length(ASource);
if len > 0 then
begin
Move(ASource[1], ATarget[0], Len+1);
ATarget[len] := 0;
end;
end;
{ Concatinates dest[] with the contents of source[], copying /0 as well }
procedure uconcat(var ADest: TByteDynArray; const ASource: TByteDynArray);
var
j, n: NativeInt;
begin
j := ustrlen(ADest);
n := ustrlen(ASource);
Move(ASource[0], ADest[j], n);
ADest[j+n] := 0;
end;
procedure uconcat(var ADest: TByteDynArray; const ASource: TCharDynArray);
var
j, n: NativeInt;
begin
j := ustrlen(ADest);
n := System.strlen(PChar(ASource));
Move(ASource[0], ADest[j], n);
ADest[j+n] := 0;
end;
procedure uconcat(var ADest: TByteDynArray; const ASource: String);
begin
uconcat(ADest, PChar(ASource));
end;
end.