diff options
| author | ruki <[email protected]> | 2021-09-04 00:58:26 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-09-04 00:58:26 +0800 |
| commit | c4b3c9836293e77fcfc87b3e8f788cc974b1e59a (patch) | |
| tree | ce9d93b6a99b750d31d73982e929f16e122a3cb6 /tests/projects/pascal/shared/src/foo.pas | |
| parent | 836284af26a6d4edb1670cd6266d31c16b43ba2c (diff) | |
add pascal shared template
Diffstat (limited to 'tests/projects/pascal/shared/src/foo.pas')
| -rw-r--r-- | tests/projects/pascal/shared/src/foo.pas | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/tests/projects/pascal/shared/src/foo.pas b/tests/projects/pascal/shared/src/foo.pas index d1952cf21..788950f46 100644 --- a/tests/projects/pascal/shared/src/foo.pas +++ b/tests/projects/pascal/shared/src/foo.pas @@ -1,23 +1,19 @@ library foo; -function SubStr(CString: PChar;FromPos,ToPos: Longint): PChar; cdecl; - -var - Length: Integer; +{$mode objfpc}{$H+} +function fib(n : Int64) : Int64; cdecl; begin - Length := StrLen(CString); - SubStr := CString + Length; - if (FromPos > 0) and (ToPos >= FromPos) then + if n > 1 then begin - if Length >= FromPos then - SubStr := CString + FromPos; - if Length > ToPos then - CString[ToPos+1] := #0; - end; + Result := fib(n - 1) + fib(n - 2); + end + else + Result := 1; end; exports - SubStr; - + fib; end. + + |
