hexsha
stringlengths 40
40
| size
int64 3
1.05M
| ext
stringclasses 163
values | lang
stringclasses 53
values | max_stars_repo_path
stringlengths 3
945
| max_stars_repo_name
stringlengths 4
112
| max_stars_repo_head_hexsha
stringlengths 40
78
| max_stars_repo_licenses
listlengths 1
10
| max_stars_count
float64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 3
945
| max_issues_repo_name
stringlengths 4
113
| max_issues_repo_head_hexsha
stringlengths 40
78
| max_issues_repo_licenses
listlengths 1
10
| max_issues_count
float64 1
116k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 3
945
| max_forks_repo_name
stringlengths 4
113
| max_forks_repo_head_hexsha
stringlengths 40
78
| max_forks_repo_licenses
listlengths 1
10
| max_forks_count
float64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 3
1.05M
| avg_line_length
float64 1
966k
| max_line_length
int64 1
977k
| alphanum_fraction
float64 0
1
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
47c5b8feacfa6e374c069f31264da97ea8b60657 | 417 | dpr | Pascal | tests/sample-conv/DUSampleConv.dpr | alessandro-savoiardo/DBXtoUD | 2479deed9467a13527095f70d878927679bf1901 | [
"MIT"
]
| null | null | null | tests/sample-conv/DUSampleConv.dpr | alessandro-savoiardo/DBXtoUD | 2479deed9467a13527095f70d878927679bf1901 | [
"MIT"
]
| null | null | null | tests/sample-conv/DUSampleConv.dpr | alessandro-savoiardo/DBXtoUD | 2479deed9467a13527095f70d878927679bf1901 | [
"MIT"
]
| null | null | null | program DUSampleConv;
uses
Vcl.Forms,
DUS.Main.Form in 'DUS.Main.Form.pas' {DUSMainForm},
DUS.DataSet.Data in 'DUS.DataSet.Data.pas' {DUSDataSetData: TDataModule},
DUS.Main.Data in 'DUS.Main.Data.pas' {DUSMainData: TDataModule};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TDUSMainForm, DUSMainForm);
Application.Run;
end.
| 24.529412 | 76 | 0.717026 |
fc4f0300b2dc587789f2625817f346862352b219 | 177 | dpr | Pascal | windows/src/ext/jedi/jcl/donations/dcl/demos/Perf/Perf.dpr | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/ext/jedi/jcl/donations/dcl/demos/Perf/Perf.dpr | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/ext/jedi/jcl/donations/dcl/demos/Perf/Perf.dpr | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | program Perf;
uses
Forms,
Unit1 in 'Unit1.pas' {frmPerf};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TfrmPerf, frmPerf);
Application.Run;
end.
| 12.642857 | 44 | 0.706215 |
47a97f153a536d7c507e86f170eabc6e4099b092 | 121 | pas | Pascal | Pascal/area_retan.pas | 71460-4-F/LIP_2018-1 | 7515cb2d3df1dd24f72305be24ae9409392bd802 | [
"MIT"
]
| null | null | null | Pascal/area_retan.pas | 71460-4-F/LIP_2018-1 | 7515cb2d3df1dd24f72305be24ae9409392bd802 | [
"MIT"
]
| null | null | null | Pascal/area_retan.pas | 71460-4-F/LIP_2018-1 | 7515cb2d3df1dd24f72305be24ae9409392bd802 | [
"MIT"
]
| null | null | null |
program area_triangulo;
var a, b, area: integer;
begin
readln(a);
readln(b);
area := a * b;
writeln(area);
end.
| 9.307692 | 24 | 0.628099 |
479479c1eb3b258597e88794bb7ab08291a72ca4 | 3,137 | pas | Pascal | DW.Androidapi.JNI.TextureView.pas | ImperiumDelphi/Camera | 04e33a50fff620afb8390ccd7a1d95588504e107 | [
"Apache-2.0"
]
| 4 | 2021-02-10T22:25:02.000Z | 2021-11-29T10:01:18.000Z | DW.Androidapi.JNI.TextureView.pas | yhdgs/Camera | 04e33a50fff620afb8390ccd7a1d95588504e107 | [
"Apache-2.0"
]
| null | null | null | DW.Androidapi.JNI.TextureView.pas | yhdgs/Camera | 04e33a50fff620afb8390ccd7a1d95588504e107 | [
"Apache-2.0"
]
| 1 | 2022-03-25T05:22:31.000Z | 2022-03-25T05:22:31.000Z | unit DW.Androidapi.JNI.TextureView;
interface
uses
// Android
Androidapi.JNIBridge, Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.JavaTypes, Androidapi.JNI.Os, Androidapi.JNI.Util;
type
JTextureView = interface;//android.view.TextureView
JTextureView_SurfaceTextureListener = interface;//android.view.TextureView$SurfaceTextureListener
JTextureViewClass = interface(JViewClass)
['{B61657F8-975F-44DD-98BD-627EDAEAA15D}']
{class} function init(context: JContext): JTextureView; cdecl; overload;
{class} function init(context: JContext; attrs: JAttributeSet): JTextureView; cdecl; overload;
{class} function init(context: JContext; attrs: JAttributeSet; defStyleAttr: Integer): JTextureView; cdecl; overload;
{class} function init(context: JContext; attrs: JAttributeSet; defStyleAttr: Integer; defStyleRes: Integer): JTextureView; cdecl; overload;
end;
[JavaSignature('android/view/TextureView')]
JTextureView = interface(JView)
['{F0FC4FB8-64C8-4BA6-B768-A4E67C9397CC}']
procedure buildLayer; cdecl;
procedure draw(canvas: JCanvas); cdecl;
function getBitmap: JBitmap; cdecl; overload;
function getBitmap(width: Integer; height: Integer): JBitmap; cdecl; overload;
function getLayerType: Integer; cdecl;
function getSurfaceTexture: JSurfaceTexture; cdecl;
function getSurfaceTextureListener: JTextureView_SurfaceTextureListener; cdecl;
function getTransform(transform: JMatrix): JMatrix; cdecl;
function isAvailable: Boolean; cdecl;
function isOpaque: Boolean; cdecl;
function lockCanvas: JCanvas; cdecl; overload;
function lockCanvas(dirty: JRect): JCanvas; cdecl; overload;
procedure setLayerPaint(paint: JPaint); cdecl;
procedure setLayerType(layerType: Integer; paint: JPaint); cdecl;
procedure setOpaque(opaque: Boolean); cdecl;
procedure setSurfaceTexture(surfaceTexture: JSurfaceTexture); cdecl;
procedure setSurfaceTextureListener(listener: JTextureView_SurfaceTextureListener); cdecl;
procedure setTransform(transform: JMatrix); cdecl;
procedure unlockCanvasAndPost(canvas: JCanvas); cdecl;
end;
TJTextureView = class(TJavaGenericImport<JTextureViewClass, JTextureView>) end;
JTextureView_SurfaceTextureListenerClass = interface(IJavaClass)
['{079709DF-C144-4083-888E-2318271F676F}']
end;
[JavaSignature('android/view/TextureView$SurfaceTextureListener')]
JTextureView_SurfaceTextureListener = interface(IJavaInstance)
['{1E496A42-F10C-4473-BDE1-43960E671F09}']
procedure onSurfaceTextureAvailable(surface: JSurfaceTexture; width: Integer; height: Integer); cdecl;
function onSurfaceTextureDestroyed(surface: JSurfaceTexture): Boolean; cdecl;
procedure onSurfaceTextureUpdated(surface: JSurfaceTexture); cdecl;
procedure onSurfaceTextureSizeChanged(surface: JSurfaceTexture; width: Integer; height: Integer); cdecl;
end;
TJTextureView_SurfaceTextureListener = class(TJavaGenericImport<JTextureView_SurfaceTextureListenerClass, JTextureView_SurfaceTextureListener>) end;
implementation
end.
| 49.015625 | 151 | 0.7708 |
85b903ddc052a68f0c9411b07fee7a302e9077d7 | 735 | pas | Pascal | VAnim/Config Source Code/UpdateButtonFormUnit.pas | vjay82/VAnim | c690a7a05f5e30527b0213be56719c991e832f65 | [
"Beerware"
]
| null | null | null | VAnim/Config Source Code/UpdateButtonFormUnit.pas | vjay82/VAnim | c690a7a05f5e30527b0213be56719c991e832f65 | [
"Beerware"
]
| null | null | null | VAnim/Config Source Code/UpdateButtonFormUnit.pas | vjay82/VAnim | c690a7a05f5e30527b0213be56719c991e832f65 | [
"Beerware"
]
| null | null | null | unit UpdateButtonFormUnit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TUpdateButtonForm = class(TForm)
UpdateButton: TButton;
Button1: TButton;
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
UpdateButtonForm: TUpdateButtonForm;
implementation
{$R *.dfm}
procedure TUpdateButtonForm.FormCreate(Sender: TObject);
begin
show;
end;
procedure TUpdateButtonForm.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:= caFree;
end;
end.
| 18.375 | 77 | 0.708844 |
fc968773f79065a13901ad5eca9552dfb639c3c6 | 96 | pas | Pascal | toolchain/pascompl/test/reject/iso7185prt0048.pas | besm6/mesm6 | 308b524c78a65e5aaba15b5b9e37f3fd83fc2c53 | [
"MIT"
]
| 37 | 2019-03-12T17:19:46.000Z | 2022-02-04T00:25:55.000Z | toolchain/pascompl/test/reject/iso7185prt0048.pas | besm6/mesm6 | 308b524c78a65e5aaba15b5b9e37f3fd83fc2c53 | [
"MIT"
]
| 13 | 2019-03-05T06:10:14.000Z | 2020-11-30T09:30:52.000Z | toolchain/pascompl/test/reject/iso7185prt0048.pas | besm6/mesm6 | 308b524c78a65e5aaba15b5b9e37f3fd83fc2c53 | [
"MIT"
]
| 4 | 2019-03-23T15:51:56.000Z | 2020-07-28T22:34:42.000Z | {
PRT test 48: Bad directive
}
program iso7185prt0048;
procedure x; bark;
begin
x
end. | 6.4 | 26 | 0.677083 |
fc587acbafed7d971d02cb20c48a78892257a77e | 1,583 | pas | Pascal | Reportes/RptPagoAplicacionesMensualForm.pas | alexismzt/SOFOM | 57ca73e9f7fbb51521149ea7c0fdc409c22cc6f7 | [
"Apache-2.0"
]
| null | null | null | Reportes/RptPagoAplicacionesMensualForm.pas | alexismzt/SOFOM | 57ca73e9f7fbb51521149ea7c0fdc409c22cc6f7 | [
"Apache-2.0"
]
| 51 | 2018-07-25T15:39:25.000Z | 2021-04-21T17:40:57.000Z | Reportes/RptPagoAplicacionesMensualForm.pas | alexismzt/SOFOM | 57ca73e9f7fbb51521149ea7c0fdc409c22cc6f7 | [
"Apache-2.0"
]
| 1 | 2021-02-23T17:27:06.000Z | 2021-02-23T17:27:06.000Z | unit RptPagoAplicacionesMensualForm;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, _ReportForm, dxSkinsCore, dxSkinBlack,
dxSkinBlue, dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkRoom,
dxSkinDarkSide, dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMoneyTwins,
dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013White,
dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus,
dxSkinSilver, dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008,
dxSkinTheAsphaltWorld, dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010,
dxSkinWhiteprint, dxSkinXmas2008Blue, dxSkinscxPCPainter, cxPCdxBarPopupMenu,
cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters, Vcl.ImgList,
System.Actions, Vcl.ActnList, Data.DB, Vcl.StdCtrls, Vcl.ExtCtrls, cxPC,
cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxSpinEdit, cxDBEdit;
type
TfrmRptPagoAplicacionesMensual = class(T_frmReport)
Label1: TLabel;
cxDBSpinEdit1: TcxDBSpinEdit;
private
{ Private declarations }
public
{ Public declarations }
end;
implementation
{$R *.dfm}
uses RptPagoAplicacionesMensualDM;
end.
| 39.575 | 99 | 0.804169 |
47ab00aa2f3b726dd8fa151f47abb42009b95da2 | 70,723 | pas | Pascal | references/embarcadero/rio/10_3_2/patched/fmx/FMX.Dialogs.Win.pas | marlonnardi/alcinoe | 5e14b2fca7adcc38e483771055b5623501433334 | [
"Apache-2.0"
]
| 1 | 2019-01-27T14:00:28.000Z | 2019-01-27T14:00:28.000Z | references/embarcadero/rio/10_3_2/patched/fmx/FMX.Dialogs.Win.pas | marlonnardi/alcinoe | 5e14b2fca7adcc38e483771055b5623501433334 | [
"Apache-2.0"
]
| 2 | 2019-06-23T00:02:43.000Z | 2019-10-12T22:39:28.000Z | references/embarcadero/rio/10_3_2/patched/fmx/FMX.Dialogs.Win.pas | marlonnardi/alcinoe | 5e14b2fca7adcc38e483771055b5623501433334 | [
"Apache-2.0"
]
| null | null | null | {*******************************************************}
{ }
{ Delphi FireMonkey Platform }
{ Copyright(c) 2014-2018 Embarcadero Technologies, Inc. }
{ All rights reserved }
{ }
{*******************************************************}
unit FMX.Dialogs.Win;
interface
{$SCOPEDENUMS ON}
uses
Winapi.ShlObj, Winapi.Windows, System.UITypes, System.SysUtils, System.Classes, System.Generics.Collections,
FMX.Dialogs;
type
EPlatformVersionException = class(Exception);
TFileDialogShareViolationResponse = (Default = FDESVR_DEFAULT, Accept = FDESVR_ACCEPT, Refuse = FDESVR_REFUSE);
TFileDialogOption = (OverWritePrompt, StrictFileTypes, NoChangeDir, PickFolders, ForceFileSystem, AllNonStorageItems,
NoValidate, AllowMultiSelect, PathMustExist, FileMustExist, CreatePrompt, ShareAware, NoReadOnlyReturn,
NoTestFileCreate, HideMRUPlaces, HidePinnedPlaces, NoDereferenceLinks, DontAddToRecent, ForceShowHidden,
DefaultNoMiniMode, ForcePreviewPaneOn);
TFileDialogOptions = set of TFileDialogOption;
TFileDialogCloseEvent = procedure(Sender: TObject; var CanClose: Boolean) of object;
TFileTypeItem = class(TCollectionItem)
private
FDisplayName: string;
FFileMask: string;
protected
function GetDisplayName: string; override;
public
constructor Create(Collection: TCollection); override;
published
property DisplayName: string read FDisplayName write FDisplayName;
property FileMask: string read FFileMask write FFileMask;
end;
TFileTypeItems = class(TCollection)
private
function GetItem(Index: Integer): TFileTypeItem;
procedure SetItem(Index: Integer; const Value: TFileTypeItem);
public
function Add: TFileTypeItem;
function FilterSpecArray: TComdlgFilterSpecArray;
property Items[Index: Integer]: TFileTypeItem read GetItem write SetItem; default;
end;
TFavoriteLinkItem = class(TCollectionItem)
private
FLocation: string;
protected
function GetDisplayName: string; override;
published
property Location: string read FLocation write FLocation;
end;
TFavoriteLinkItems = class;
TFavoriteLinkItemsEnumerator = class
private
FIndex: Integer;
FCollection: TFavoriteLinkItems;
public
constructor Create(ACollection: TFavoriteLinkItems);
function GetCurrent: TFavoriteLinkItem;
function MoveNext: Boolean;
property Current: TFavoriteLinkItem read GetCurrent;
end;
TFavoriteLinkItems = class(TCollection)
private
function GetItem(Index: Integer): TFavoriteLinkItem;
procedure SetItem(Index: Integer; const Value: TFavoriteLinkItem);
public
function Add: TFavoriteLinkItem;
function GetEnumerator: TFavoriteLinkItemsEnumerator;
property Items[Index: Integer]: TFavoriteLinkItem read GetItem write SetItem; default;
end;
TCustomFileDialog = class(TComponent)
private
FClientGuid: string;
FDefaultExtension: string;
FDefaultFolder: string;
FDialog: IFileDialog;
FFavoriteLinks: TFavoriteLinkItems;
FFileName: TFileName;
FFileNameLabel: string;
FFiles: TStrings;
FFileTypeIndex: Cardinal;
FFileTypes: TFileTypeItems;
FHandle: HWND;
FOkButtonLabel: string;
FOptions: TFileDialogOptions;
FShellItem: IShellItem;
FShellItems: IShellItemArray;
FTitle: string;
FOnExecute: TNotifyEvent;
FOnFileOkClick: TFileDialogCloseEvent;
FActualFolder: TFileName;
function GetDefaultFolder: string;
function GetFileName: TFileName;
function GetFiles: TStrings;
procedure SetClientGuid(const Value: string);
procedure SetDefaultFolder(const Value: string);
procedure SetFavoriteLinks(const Value: TFavoriteLinkItems);
procedure SetFileName(const Value: TFileName);
procedure SetFileTypes(const Value: TFileTypeItems);
strict protected
function CreateFileDialog: IFileDialog; virtual; abstract;
procedure DoOnExecute; dynamic;
function DoOnFileOkClick: Boolean; dynamic;
function GetFileNames(Items: IShellItemArray): HResult; dynamic;
function GetItemName(Item: IShellItem; var ItemName: TFileName): HResult; dynamic;
function GetResults: HResult; virtual;
protected
function FileOkClick: HResult; dynamic;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function Execute: Boolean; overload; virtual;
function Execute(ParentWnd: HWND): Boolean; overload; virtual;
property ClientGuid: string read FClientGuid write SetClientGuid;
property DefaultExtension: string read FDefaultExtension write FDefaultExtension;
property DefaultFolder: string read GetDefaultFolder write SetDefaultFolder;
property Dialog: IFileDialog read FDialog;
property FavoriteLinks: TFavoriteLinkItems read FFavoriteLinks write SetFavoriteLinks;
property FileName: TFileName read GetFileName write SetFileName;
property FileNameLabel: string read FFileNameLabel write FFileNameLabel;
property Files: TStrings read GetFiles;
property FileTypes: TFileTypeItems read FFileTypes write SetFileTypes;
property FileTypeIndex: Cardinal read FFileTypeIndex write FFileTypeIndex default 1;
property Handle: HWND read FHandle;
property OkButtonLabel: string read FOkButtonLabel write FOkButtonLabel;
property Options: TFileDialogOptions read FOptions write FOptions;
property ShellItem: IShellItem read FShellItem;
property ShellItems: IShellItemArray read FShellItems;
property Title: string read FTitle write FTitle;
property OnExecute: TNotifyEvent read FOnExecute write FOnExecute;
property OnFileOkClick: TFileDialogCloseEvent read FOnFileOkClick write FOnFileOkClick;
end;
{ TFileOpenDialog }
TCustomFileOpenDialog = class(TCustomFileDialog)
strict protected
function CreateFileDialog: IFileDialog; override;
function GetResults: HResult; override;
end;
TFileOpenDialog = class(TCustomFileOpenDialog)
published
property ClientGuid;
property DefaultExtension;
property DefaultFolder;
property FavoriteLinks;
property FileName;
property FileNameLabel;
property FileTypes;
property FileTypeIndex;
property OkButtonLabel;
property Options;
property Title;
property OnExecute;
property OnFileOkClick;
end;
{ TFileSaveDialog }
TCustomFileSaveDialog = class(TCustomFileDialog)
strict protected
function CreateFileDialog: IFileDialog; override;
end;
TFileSaveDialog = class(TCustomFileSaveDialog)
published
property ClientGuid;
property DefaultExtension;
property DefaultFolder;
property FavoriteLinks;
property FileName;
property FileNameLabel;
property FileTypes;
property FileTypeIndex;
property OkButtonLabel;
property Options;
property Title;
property OnExecute;
property OnFileOkClick;
end;
TFileDialogWrapper = class(TObject)
private
procedure AssignFileTypes;
procedure AssignOptions;
function GetFileName: TFileName;
function GetFiles: TStrings;
function GetHandle: HWND;
procedure OnFileOkEvent(Sender: TObject; var CanClose: Boolean);
protected
FFileDialog: TCustomFileDialog;
FOpenDialog: TOpenDialog;
function CreateFileDialog: TCustomFileDialog; virtual; abstract;
public
constructor Create(const OpenDialog: TOpenDialog);
destructor Destroy; override;
function Execute(ParentWnd: HWND; AType: TDialogType = TDialogType.Standard): Boolean;
property FileName: TFileName read GetFileName;
property Files: TStrings read GetFiles;
property Handle: HWND read GetHandle;
end;
TFileOpenDialogWrapper = class(TFileDialogWrapper)
private
procedure OnExecuteEvent(Sender: TObject);
protected
function CreateFileDialog: TCustomFileDialog; override;
end;
TFileSaveDialogWrapper = class(TFileDialogWrapper)
protected
function CreateFileDialog: TCustomFileDialog; override;
end;
implementation
uses
Winapi.Messages, Winapi.CommDlg, Winapi.CommCtrl, Winapi.ActiveX, System.IOUtils, System.StrUtils, System.Variants,
FMX.Platform, FMX.Consts, FMX.Forms, FMX.Printer, FMX.Dialogs.Default, FMX.Printer.Win, FMX.Helpers.Win,
FMX.Platform.Win, FMX.DialogHelper, FMX.Types;
{ TFileDialogFileType }
constructor TFileTypeItem.Create(Collection: TCollection);
begin
inherited;
end;
{ TFilePlaces }
function TFavoriteLinkItems.Add: TFavoriteLinkItem;
begin
Result := TFavoriteLinkItem(inherited Add);
end;
function TFavoriteLinkItems.GetEnumerator: TFavoriteLinkItemsEnumerator;
begin
Result := TFavoriteLinkItemsEnumerator.Create(Self);
end;
function TFavoriteLinkItems.GetItem(Index: Integer): TFavoriteLinkItem;
begin
Result := TFavoriteLinkItem(inherited GetItem(Index));
end;
procedure TFavoriteLinkItems.SetItem(Index: Integer; const Value: TFavoriteLinkItem);
begin
inherited SetItem(Index, Value);
end;
{ TFileTypeItem }
function TFileTypeItem.GetDisplayName: string;
begin
if FDisplayName <> '' then
Result := FDisplayName
else
Result := inherited GetDisplayName;
end;
{ TFilePlacesEnumerator }
constructor TFavoriteLinkItemsEnumerator.Create(ACollection: TFavoriteLinkItems);
begin
inherited Create;
FIndex := -1;
FCollection := ACollection;
end;
function TFavoriteLinkItemsEnumerator.GetCurrent: TFavoriteLinkItem;
begin
Result := FCollection[FIndex];
end;
function TFavoriteLinkItemsEnumerator.MoveNext: Boolean;
begin
Result := FIndex < FCollection.Count - 1;
if Result then
Inc(FIndex);
end;
{ TFilePlaceItem }
function TFavoriteLinkItem.GetDisplayName: string;
begin
if FLocation <> '' then
Result := FLocation
else
Result := inherited GetDisplayName;
end;
{ TFileDialogFileTypes }
function TFileTypeItems.Add: TFileTypeItem;
begin
Result := TFileTypeItem(inherited Add);
end;
function TFileTypeItems.FilterSpecArray: TComdlgFilterSpecArray;
var
I: Integer;
begin
SetLength(Result, Count);
for I := 0 to Count - 1 do
begin
Result[I].pszName := PChar(Items[I].DisplayName);
Result[I].pszSpec := PChar(Items[I].FileMask);
end;
end;
function TFileTypeItems.GetItem(Index: Integer): TFileTypeItem;
begin
Result := TFileTypeItem(inherited GetItem(Index));
end;
procedure TFileTypeItems.SetItem(Index: Integer; const Value: TFileTypeItem);
begin
inherited SetItem(Index, Value);
end;
{ TCustomFileDialog }
constructor TCustomFileDialog.Create(AOwner: TComponent);
begin
inherited;
FFiles := TStringList.Create;
FFileTypeIndex := 1;
FFileTypes := TFileTypeItems.Create(TFileTypeItem);
FHandle := 0;
FOptions := [];
FFavoriteLinks := TFavoriteLinkItems.Create(TFavoriteLinkItem);
FShellItem := nil;
FShellItems := nil;
end;
destructor TCustomFileDialog.Destroy;
begin
FFiles.Free;
FFileTypes.Free;
FFavoriteLinks.Free;
FShellItem := nil;
FShellItems := nil;
inherited;
end;
procedure TCustomFileDialog.DoOnExecute;
begin
if Assigned(FOnExecute) then
FOnExecute(Self);
end;
function TCustomFileDialog.DoOnFileOkClick: Boolean;
begin
Result := True;
if Assigned(FOnFileOkClick) then
FOnFileOkClick(Self, Result);
end;
function TCustomFileDialog.Execute: Boolean;
begin
Result := Execute();
end;
function TCustomFileDialog.Execute(ParentWnd: HWND): Boolean;
const
CDialogOptions: array [TFileDialogOption] of DWORD = (FOS_OVERWRITEPROMPT, FOS_STRICTFILETYPES, FOS_NOCHANGEDIR,
FOS_PICKFOLDERS, FOS_FORCEFILESYSTEM, FOS_ALLNONSTORAGEITEMS, FOS_NOVALIDATE, FOS_ALLOWMULTISELECT,
FOS_PATHMUSTEXIST, FOS_FILEMUSTEXIST, FOS_CREATEPROMPT, FOS_SHAREAWARE, FOS_NOREADONLYRETURN, FOS_NOTESTFILECREATE,
FOS_HIDEMRUPLACES, FOS_HIDEPINNEDPLACES, FOS_NODEREFERENCELINKS, FOS_DONTADDTORECENT, FOS_FORCESHOWHIDDEN,
FOS_DEFAULTNOMINIMODE, FOS_FORCEPREVIEWPANEON);
var
LPlace: TFavoriteLinkItem;
LShellItem: IShellItem;
LDialogOptions: Cardinal;
LDialogOption: TFileDialogOption;
begin
if Win32MajorVersion < 6 then
raise EPlatformVersionException.CreateResFmt(@SWindowsVistaRequired, [ClassName]);
Result := False;
FDialog := CreateFileDialog;
if FDialog <> nil then
try
with FDialog do
begin
// ClientGuid, DefaultExt, FileName, Title, OkButtonLabel, FileNameLabel
if FClientGuid <> '' then
SetClientGuid(StringToGUID(FClientGuid));
if FDefaultExtension <> '' then
SetDefaultExtension(PChar(FDefaultExtension));
if FFileName <> '' then
SetFileName(PChar(FFileName));
if FFileNameLabel <> '' then
SetFileNameLabel(PChar(FFileNameLabel));
if FOkButtonLabel <> '' then
SetOkButtonLabel(PChar(FOkButtonLabel));
if FTitle <> '' then
SetTitle(PChar(FTitle));
// DefaultFolder
if FDefaultFolder <> '' then
begin
if Succeeded(SHCreateItemFromParsingName(PChar(FDefaultFolder), nil,
StringToGUID(SID_IShellItem), LShellItem)) then
SetFolder(LShellItem);
end;
// FileTypes, FileTypeIndex
if FFileTypes.Count > 0 then
begin
FDialog.SetFileTypes(FFileTypes.Count, FFileTypes.FilterSpecArray);
SetFileTypeIndex(FFileTypeIndex);
end;
// Options
LDialogOptions := 0;
for LDialogOption in Options do
LDialogOptions := LDialogOptions or CDialogOptions[LDialogOption];
SetOptions(LDialogOptions);
// Additional Places
for LPlace in FFavoriteLinks do
if Succeeded(SHCreateItemFromParsingName(PChar(LPlace.Location), nil,
StringToGUID(SID_IShellItem), LShellItem)) then
AddPlace(LShellItem, FDAP_BOTTOM);
// Show dialog and get results
DoOnExecute;
try
Result := Succeeded(Show(ParentWnd));
if Result then
Result := Succeeded(GetResults);
finally
SetActiveWindow(ParentWnd);
end;
end;
finally
FDialog := nil;
end;
end;
function TCustomFileDialog.FileOkClick: HResult;
const
CResults: array [Boolean] of HResult = (S_FALSE, S_OK);
begin
Result := GetResults;
if Succeeded(Result) then
Result := CResults[DoOnFileOkClick];
Files.Clear;
end;
function TCustomFileDialog.GetDefaultFolder: string;
begin
Result := FDefaultFolder;
end;
function TCustomFileDialog.GetFileName: TFileName;
var
LFileName: TFileName;
pszFileName: LPCWSTR;
begin
if (FDialog <> nil) and Succeeded(FDialog.GetFolder(FShellItem)) and Succeeded(GetItemName(FShellItem, LFileName))
then
if FFiles.Count = 0 then
begin
if Succeeded(FDialog.GetFileName(pszFileName)) then
try
FFileName := TPath.Combine(LFileName, pszFileName);
finally
CoTaskMemFree(pszFileName);
end
else
FFileName := ''
end
else
FFileName := TPath.Combine(LFileName, FFiles[0]);
Result := FFileName;
end;
function TCustomFileDialog.GetFileNames(Items: IShellItemArray): HResult;
var
Count, I: Integer;
ItemCount: Cardinal;
LEnumerator: IEnumShellItems;
LShellItems: array of IShellItem;
begin
Files.Clear;
Result := Items.EnumItems(LEnumerator);
if Succeeded(Result) then
begin
Result := Items.GetCount(ItemCount);
if Succeeded(Result) then
begin
SetLength(LShellItems, ItemCount);
Result := LEnumerator.Next(ItemCount, LShellItems[0], @Count);
if Succeeded(Result) then
for I := 0 to Count - 1 do
begin
GetItemName(LShellItems[I], FFileName);
Files.Add(FFileName);
end;
end;
if Files.Count > 0 then
FFileName := Files[0];
end;
end;
function TCustomFileDialog.GetFiles: TStrings;
begin
Result := FFiles;
end;
function TCustomFileDialog.GetItemName(Item: IShellItem; var ItemName: TFileName): HResult;
var
pszItemName: LPCWSTR;
begin
Result := Item.GetDisplayName(SIGDN_FILESYSPATH, pszItemName);
if Failed(Result) then
Result := Item.GetDisplayName(SIGDN_NORMALDISPLAY, pszItemName);
if Succeeded(Result) then
try
ItemName := pszItemName;
finally
CoTaskMemFree(pszItemName);
end;
end;
function TCustomFileDialog.GetResults: HResult;
begin
Result := FDialog.GetResult(FShellItem);
if Succeeded(Result) then
begin
Result := GetItemName(FShellItem, FFileName);
// Patch for Vista and Windows Server 2008 bug
if (TFileDialogOption.PickFolders in FOptions) and (Win32MajorVersion = 6) and (Win32MinorVersion = 0) then
begin
if not TDirectory.Exists(FFileName) then
FFileName := FActualFolder;
end;
FFiles.Clear;
FFiles.Add(FFileName);
end;
end;
procedure TCustomFileDialog.SetClientGuid(const Value: string);
begin
if Value <> FClientGuid then
begin
if Value <> '' then
StringToGUID(Value);
FClientGuid := Value;
end;
end;
procedure TCustomFileDialog.SetDefaultFolder(const Value: string);
begin
if FDefaultFolder <> Value then
FDefaultFolder := Value;
end;
procedure TCustomFileDialog.SetFileName(const Value: TFileName);
begin
if Value <> FFileName then
FFileName := Value;
end;
procedure TCustomFileDialog.SetFileTypes(const Value: TFileTypeItems);
begin
if Value <> nil then
FFileTypes.Assign(Value);
end;
procedure TCustomFileDialog.SetFavoriteLinks(const Value: TFavoriteLinkItems);
begin
if Value <> nil then
FFavoriteLinks.Assign(Value);
end;
{ TFileDialogWrapper }
constructor TFileDialogWrapper.Create(const OpenDialog: TOpenDialog);
begin
inherited Create;
FOpenDialog := OpenDialog;
FFileDialog := CreateFileDialog;
end;
destructor TFileDialogWrapper.Destroy;
begin
FFileDialog.Free;
inherited;
end;
procedure TFileDialogWrapper.AssignFileTypes;
var
I, J: Integer;
FilterStr: string;
begin
FilterStr := FOpenDialog.Filter;
J := 1;
I := AnsiPos('|', FilterStr);
while I <> 0 do
with FFileDialog.FileTypes.Add do
begin
DisplayName := Copy(FilterStr, J, I - J);
if not SysLocale.FarEast then
J := PosEx('|', FilterStr, I + 1)
else
begin
J := AnsiPos('|', Copy(FilterStr, I + 1, MAXINT));
if J <> 0 then
J := J + (I + 1) - 1;
end;
if J = 0 then
J := Length(FilterStr) + 1;
FileMask := Copy(FilterStr, I + 1, J - I - 1);
Inc(J);
if not SysLocale.FarEast then
I := PosEx('|', FilterStr, J)
else
begin
I := AnsiPos('|', Copy(FilterStr, J, MAXINT));
if I <> 0 then
I := I + J - 1
else if J < Length(FilterStr) then
I := Length(FilterStr) + 1;
end;
end;
end;
procedure TFileDialogWrapper.AssignOptions;
const
CDialogOptionsMap: array [TOpenOption] of TFileDialogOptions = ([] { ReadOnly } , [TFileDialogOption.OverWritePrompt],
[] { HideReadOnly } , [TFileDialogOption.NoChangeDir], [] { ShowHelp } , [TFileDialogOption.NoValidate],
[TFileDialogOption.AllowMultiSelect], [TFileDialogOption.StrictFileTypes], [TFileDialogOption.PathMustExist],
[TFileDialogOption.FileMustExist], [TFileDialogOption.CreatePrompt], [TFileDialogOption.ShareAware],
[TFileDialogOption.NoReadOnlyReturn], [TFileDialogOption.NoTestFileCreate], [] { NoNetworkButton } ,
[] { NoLongNames } , [] { OldStyleDialog } , [TFileDialogOption.NoDereferenceLinks], [] { EnableIncludeNotify } ,
[] { EnableSizing } , [TFileDialogOption.DontAddToRecent], [TFileDialogOption.ForceShowHidden]);
var
LOption: TOpenOption;
begin
for LOption := Low(LOption) to High(LOption) do
if LOption in FOpenDialog.Options then
FFileDialog.Options := FFileDialog.Options + CDialogOptionsMap[LOption];
if TOpenOptionEx.ofExNoPlacesBar in FOpenDialog.OptionsEx then
FFileDialog.Options := FFileDialog.Options + [TFileDialogOption.HidePinnedPlaces];
end;
function TFileDialogWrapper.Execute(ParentWnd: HWND; AType: TDialogType): Boolean;
begin
FFileDialog.DefaultExtension := FOpenDialog.DefaultExt;
FFileDialog.DefaultFolder := FOpenDialog.InitialDir;
FFileDialog.FileName := FOpenDialog.FileName;
FFileDialog.FileTypeIndex := FOpenDialog.FilterIndex;
FFileDialog.Title := FOpenDialog.Title;
if Assigned(FOpenDialog.OnCanClose) then
FFileDialog.OnFileOkClick := OnFileOkEvent;
AssignFileTypes;
AssignOptions;
if AType = TDialogType.Directory then
FFileDialog.Options := FFileDialog.Options + [TFileDialogOption.PickFolders];
Result := FFileDialog.Execute(ParentWnd);
if Result then
begin
FOpenDialog.FileName := FFileDialog.FileName;
FOpenDialog.Files.Assign(FFileDialog.Files);
FOpenDialog.FilterIndex := FFileDialog.FileTypeIndex;
end;
end;
function TFileDialogWrapper.GetFileName: TFileName;
begin
Result := FFileDialog.FileName;
end;
function TFileDialogWrapper.GetFiles: TStrings;
begin
Result := FFileDialog.Files;
end;
function TFileDialogWrapper.GetHandle: HWND;
begin
Result := FFileDialog.Handle;
end;
procedure TFileDialogWrapper.OnFileOkEvent(Sender: TObject; var CanClose: Boolean);
begin
with FOpenDialog do
begin
FileName := FFileDialog.FileName;
Files.Assign(FFileDialog.Files);
end;
FOpenDialog.OnCanClose(FOpenDialog, CanClose);
end;
{ TFileOpenDialogWrapper }
function TFileOpenDialogWrapper.CreateFileDialog: TCustomFileDialog;
begin
Result := TFileOpenDialog.Create(nil);
Result.OnExecute := OnExecuteEvent;
end;
procedure TFileOpenDialogWrapper.OnExecuteEvent(Sender: TObject);
var
LOptions: Cardinal;
begin
if FOpenDialog.ClassName = 'TOpenPictureDialog' then // do not localize
begin
FFileDialog.Dialog.GetOptions(LOptions);
LOptions := LOptions or FOS_FORCEPREVIEWPANEON;
FFileDialog.Dialog.SetOptions(LOptions);
end;
end;
{ TFileSaveDialogWrapper }
function TFileSaveDialogWrapper.CreateFileDialog: TCustomFileDialog;
begin
Result := TFileSaveDialog.Create(nil);
end;
{ TCustomFileOpenDialog }
function TCustomFileOpenDialog.CreateFileDialog: IFileDialog;
var
LGuid: TGUID;
begin
LGuid := CLSID_FileOpenDialog;
CoCreateInstance(LGuid, nil, CLSCTX_INPROC_SERVER, StringToGUID(SID_IFileOpenDialog), Result);
end;
function TCustomFileOpenDialog.GetResults: HResult;
begin
if not (TFileDialogOption.AllowMultiSelect in Options) then
Result := inherited GetResults
else
begin
Result := (Dialog as IFileOpenDialog).GetResults(FShellItems);
if Succeeded(Result) then
Result := GetFileNames(FShellItems);
end;
end;
{ TCustomFileSaveDialog }
function TCustomFileSaveDialog.CreateFileDialog: IFileDialog;
var
LGuid: TGUID;
begin
LGuid := CLSID_FileSaveDialog;
CoCreateInstance(LGuid, nil, CLSCTX_INPROC_SERVER, StringToGUID(SID_IFileSaveDialog), Result);
end;
type
TFMXDialogService = class(TInterfacedObject, IFMXDialogService, IFMXDialogServiceSync, IFMXDialogServiceAsync)
public const
MsgCaptions: array [TMsgDlgType] of string = (SMsgDlgWarning, SMsgDlgError, SMsgDlgInformation, SMsgDlgConfirm, '');
MsgIcons: array [TMsgDlgType] of UINT = (MB_ICONWARNING, MB_ICONERROR, MB_ICONINFORMATION, MB_ICONQUESTION, 0);
private type
TDialogData = record
Dialog: HWND;
Buttons: array [idOK .. idContinue] of HWND;
CustomButtons: array [idOK .. idContinue] of HWND;
Rects: array [idOK .. idContinue] of TRect;
MsgDlgButtons: TMsgDlgButtons;
end;
PDialogData = ^TDialogData;
strict private
class var FCurrent: TFMXDialogService;
class function GetCurrent: TFMXDialogService; static;
private
FOldHook: HHOOK;
FFont: HFONT;
FHookList: TList<TDialogData>;
function GetCount: Integer;
function GetFont: HFONT;
{ IFMXDialogService }
function DialogOpenFiles(const ADialog: TOpenDialog; var AFiles: TStrings; AType: TDialogType): Boolean;
function DialogPrint(var ACollate, APrintToFile: Boolean; var AFromPage, AToPage, ACopies: Integer;
AMinPage, AMaxPage: Integer; var APrintRange: TPrintRange; AOptions: TPrintDialogOptions): Boolean;
function PageSetupGetDefaults(var AMargin, AMinMargin: TRect; var APaperSize: TPointF; AUnits: TPageMeasureUnits;
AOptions: TPageSetupDialogOptions): Boolean;
function DialogPageSetup(var AMargin, AMinMargin: TRect; var APaperSize: TPointF; var AUnits: TPageMeasureUnits;
AOptions: TPageSetupDialogOptions): Boolean;
function DialogSaveFiles(const ADialog: TOpenDialog; var AFiles: TStrings): Boolean;
function DialogPrinterSetup: Boolean;
function GetHWND: HWND;
function MessageDialog(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons;
const ADefaultButton: TMsgDlgBtn; const AX, AY: Integer; const AHelpCtx: THelpContext;
const AHelpFileName: string): Integer; overload;
procedure MessageDialog(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons;
const ADefaultButton: TMsgDlgBtn; const AX, AY: Integer; const AHelpCtx: THelpContext; const AHelpFileName: string;
const ACloseDialogProc: TInputCloseDialogProc); overload;
function InputQuery(const ACaption: string; const APrompts: array of string; var AValues: array of string;
const ACloseQueryFunc: TInputCloseQueryFunc = nil): Boolean; overload;
procedure InputQuery(const ACaption: string; const APrompts, ADefaultValues: array of string;
const ACloseQueryProc: TInputCloseQueryProc); overload;
{ IFMXDialogServiceSync }
/// <summary>Show a simple message box with an 'Ok' button to close it.</summary>
procedure ShowMessageSync(const AMessage: string);
/// <summary>Shows custom message dialog with specified buttons on it.</summary>
function MessageDialogSync(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons;
const ADefaultButton: TMsgDlgBtn; const AHelpCtx: THelpContext): Integer;
/// <summary>Shows an input message dialog with the specified promps and values on it. Values are modified within it.</summary>
function InputQuerySync(const ACaption: string; const APrompts: array of string; var AValues: array of string): Boolean;
{ IFMXDialogServiceAsync }
/// <summary>Show a simple message box with an 'Ok' button to close it.</summary>
procedure ShowMessageAsync(const AMessage: string); overload;
/// <summary>Show a simple message box with an 'Ok' button to close it.</summary>
procedure ShowMessageAsync(const AMessage: string; const ACloseDialogProc: TInputCloseDialogProc); overload;
/// <summary>Show a simple message box with an 'Ok' button to close it.</summary>
procedure ShowMessageAsync(const AMessage: string; const ACloseDialogEvent: TInputCloseDialogEvent;
const AContext: TObject = nil); overload;
/// <summary>Shows custom message dialog with specified buttons on it.</summary>
procedure MessageDialogAsync(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons;
const ADefaultButton: TMsgDlgBtn; const AHelpCtx: THelpContext; const ACloseDialogProc: TInputCloseDialogProc); overload;
/// <summary>Shows custom message dialog with specified buttons on it.</summary>
procedure MessageDialogAsync(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons;
const ADefaultButton: TMsgDlgBtn; const AHelpCtx: THelpContext; const ACloseDialogEvent: TInputCloseDialogEvent;
const AContext: TObject = nil); overload;
/// <summary>Shows an input message dialog with the specified promps and values on it. Values are modified within it.</summary>
procedure InputQueryAsync(const ACaption: string; const APrompts: array of string; const ADefaultValues: array of string;
const ACloseQueryProc: TInputCloseQueryProc); overload;
/// <summary>Shows an input message dialog with the specified promps and values on it. Values are modified within it.</summary>
procedure InputQueryAsync(const ACaption: string; const APrompts: array of string; const ADefaultValues: array of string;
const ACloseQueryEvent: TInputCloseQueryWithResultEvent; const AContext: TObject = nil); overload;
public
destructor Destroy; override;
class property Current: TFMXDialogService read GetCurrent;
property Font: HFONT read GetFont;
property OldHook: HHOOK read FOldHook;
function NeedInit: Boolean;
function InitLastData(const ADialog: HWND): Boolean;
function GetData(const ADialog: HWND; var AData: TDialogData): Boolean;
function SetData(const ADialog: HWND; const AData: TDialogData): Boolean;
procedure BeginHook(const AMsgDlgButtons: TMsgDlgButtons);
function ConvertResult(const ModalResult: Integer): Integer;
procedure EndHook;
end;
{ TFMXDialogService }
destructor TFMXDialogService.Destroy;
begin
FreeAndNil(FHookList);
if FOldHook <> 0 then
UnhookWindowsHookEx(FOldHook);
if FFont <> 0 then
DeleteObject(FFont);
inherited;
end;
class function TFMXDialogService.GetCurrent: TFMXDialogService;
begin
if FCurrent = nil then
FCurrent := TFMXDialogService.Create;
Result := FCurrent;
end;
function DialogHook(Wnd: HWND; Msg: UINT; WParam: WParam; LParam: LParam): UINT_PTR; stdcall;
begin
Result := 0;
end;
procedure GetFileNames(var OpenFileName: TOpenFilenameW; var AFileName: TFileName; var AFiles: TStrings;
AOptions: TOpenOptions);
var
Separator: Char;
function ExtractFileName(P: PChar; var S: TFileName): PChar;
begin
Result := AnsiStrScan(P, Separator);
if Result = nil then
begin
S := P;
Result := StrEnd(P);
end
else
begin
SetString(S, P, Result - P);
Inc(Result);
end;
end;
procedure ExtractFileNames(P: PChar);
var
DirName, FileName: TFileName;
begin
P := ExtractFileName(P, DirName);
P := ExtractFileName(P, FileName);
if FileName = '' then
AFiles.Add(DirName)
else
begin
DirName := IncludeTrailingPathDelimiter(DirName);
repeat
if (FileName[1] <> TPath.DirectorySeparatorChar) and ((Length(FileName) <= 3) or
(FileName[2] <> TPath.VolumeSeparatorChar) or (FileName[3] <> TPath.DirectorySeparatorChar)) then
FileName := DirName + FileName;
AFiles.Add(FileName);
P := ExtractFileName(P, FileName);
until FileName = '';
end;
end;
begin
Separator := #0;
if (TOpenOption.ofAllowMultiSelect in AOptions) and (TOpenOption.ofOldStyleDialog in AOptions) then
Separator := ' ';
if TOpenOption.ofAllowMultiSelect in AOptions then
begin
ExtractFileNames(OpenFileName.lpstrFile);
AFileName := AFiles[0];
end
else
begin
ExtractFileName(OpenFileName.lpstrFile, AFileName);
AFiles.Add(AFileName);
end;
end;
function TFMXDialogService.DialogOpenFiles(const ADialog: TOpenDialog; var AFiles: TStrings;
AType: TDialogType): Boolean;
const
FileNameBufferLen = High(Word) - 16;
OpenOptions: array [TOpenOption] of DWORD = (OFN_READONLY, OFN_OVERWRITEPROMPT, OFN_HIDEREADONLY, OFN_NOCHANGEDIR,
OFN_SHOWHELP, OFN_NOVALIDATE, OFN_ALLOWMULTISELECT, OFN_EXTENSIONDIFFERENT, OFN_PATHMUSTEXIST, OFN_FILEMUSTEXIST,
OFN_CREATEPROMPT, OFN_SHAREAWARE, OFN_NOREADONLYRETURN, OFN_NOTESTFILECREATE, OFN_NONETWORKBUTTON, OFN_NOLONGNAMES,
OFN_EXPLORER, OFN_NODEREFERENCELINKS, OFN_ENABLEINCLUDENOTIFY, OFN_ENABLESIZING, OFN_DONTADDTORECENT,
OFN_FORCESHOWHIDDEN);
var
OpenFile: TOpenFilenameW;
FileDialogWrapper: TFileDialogWrapper;
FileNameBuffer: PChar;
FileNameBufferSize: Integer;
InitialDir, Filter, DefaultExt: string;
FileName: TFileName;
Option: TOpenOption;
WindowList: Pointer;
OwnerHwnd: HWND;
function AllocFilterStr(const S: string): string;
var
SepPos: Integer;
SB: TStringBuilder;
begin
Result := '';
if S <> '' then
begin
Result := S + #0; // double null terminators
SB := TStringBuilder.Create(Result);
try
SepPos := Result.IndexOf('|');
while SepPos >= 0 do
begin
SB.Chars[SepPos] := #0; // adjust because OP strings are 1-offset
Result := SB.ToString;
Inc(SepPos);
SepPos := Result.IndexOf('|', SepPos);
end;
Result := SB.ToString + #0; // add final null terminator
finally
SB.Free;
end;
end;
end;
begin
OwnerHwnd := GetHWND;
if Win32MajorVersion >= 6 then
begin
// This requires Windows Vista or later
FileDialogWrapper := TFileOpenDialogWrapper.Create(ADialog);
try
WindowList := nil;
try
WindowList := DisableTaskWindows(OwnerHwnd);
Result := FileDialogWrapper.Execute(OwnerHwnd, AType);
if Result then
AFiles.Assign(FileDialogWrapper.Files);
finally
EnableTaskWindows(WindowList);
end;
finally
FileDialogWrapper.Free;
end;
Exit;
end;
InitialDir := ADialog.InitialDir;
DefaultExt := ADialog.DefaultExt;
Filter := AllocFilterStr(ADialog.Filter);
FileName := ADialog.FileName;
if (FileName <> '') and (FileName[Length(FileName)] = PathDelim) then
begin
// if the filename contains a directory, set the initial directory
// and clear
InitialDir := string(FileName).Substring(0, string(FileName).Length - 1);
FileName := '';
end;
if (DefaultExt = '') or (DefaultExt = null) then
DefaultExt := '*';
FileNameBuffer := AllocMem(FileNameBufferLen * SizeOf(Char) + 2);
if Length(FileName) > FileNameBufferLen then
FileNameBufferSize := FileNameBufferLen
else
FileNameBufferSize := Length(FileName);
Move(PChar(FileName)^, FileNameBuffer^, FileNameBufferSize * SizeOf(Char));
if (Filter = '') or (Filter = null) then
Filter := 'All File Types(*.*)' + #0 + '*.*' + #0 + #0; // Default -> avoid empty combobox
AFiles.Clear;
FillChar(OpenFile, SizeOf(OpenFile), 0);
OpenFile.hInstance := hInstance;
OpenFile.lStructSize := SizeOf(OpenFile);
OpenFile.hWndOwner := OwnerHwnd;
OpenFile.nFilterIndex := 0;
OpenFile.lpstrFile := FileNameBuffer;
OpenFile.lpstrFilter := PChar(Filter);
if ADialog.Title <> '' then
OpenFile.lpstrTitle := PChar(ADialog.Title);
OpenFile.lpstrInitialDir := PChar(InitialDir);
OpenFile.lpstrDefExt := PChar(DefaultExt);
OpenFile.lpstrFile := FileNameBuffer;
OpenFile.nMaxFile := FileNameBufferLen + 1; // Size in TCHARs
OpenFile.nFilterIndex := ADialog.FilterIndex;
OpenFile.Flags := OFN_EXPLORER;
for Option := Low(Option) to High(Option) do
if Option in ADialog.Options then
OpenFile.Flags := OpenFile.Flags or OpenOptions[Option];
if TOpenOption.ofOldStyleDialog in ADialog.Options then
begin
OpenFile.Flags := OpenFile.Flags and (not OFN_EXPLORER);
OpenFile.lpfnHook := DialogHook;
OpenFile.Flags := OpenFile.Flags or OFN_ENABLEHOOK;
end;
WindowList := nil;
try
WindowList := DisableTaskWindows(OpenFile.hWndOwner);
Result := GetOpenFileNameW(OpenFile);
finally
EnableTaskWindows(WindowList);
end;
if Result then
begin
FileName := FileNameBuffer;
GetFileNames(OpenFile, FileName, AFiles, ADialog.Options);
ADialog.FileName := FileName;
if (OpenFile.Flags and OFN_EXTENSIONDIFFERENT) <> 0 then
ADialog.Options := ADialog.Options + [TOpenOption.ofExtensionDifferent]
else
ADialog.Options := ADialog.Options - [TOpenOption.ofExtensionDifferent];
if (OpenFile.Flags and OFN_READONLY) <> 0 then
ADialog.Options := ADialog.Options + [TOpenOption.ofReadOnly]
else
ADialog.Options := ADialog.Options - [TOpenOption.ofReadOnly];
ADialog.FilterIndex := OpenFile.nFilterIndex;
end;
FreeMem(FileNameBuffer);
end;
function TFMXDialogService.DialogSaveFiles(const ADialog: TOpenDialog; var AFiles: TStrings): Boolean;
const
FileNameBufferLen = 1000;
OpenOptions: array [TOpenOption] of DWORD = (OFN_READONLY, OFN_OVERWRITEPROMPT, OFN_HIDEREADONLY, OFN_NOCHANGEDIR,
OFN_SHOWHELP, OFN_NOVALIDATE, OFN_ALLOWMULTISELECT, OFN_EXTENSIONDIFFERENT, OFN_PATHMUSTEXIST, OFN_FILEMUSTEXIST,
OFN_CREATEPROMPT, OFN_SHAREAWARE, OFN_NOREADONLYRETURN, OFN_NOTESTFILECREATE, OFN_NONETWORKBUTTON, OFN_NOLONGNAMES,
OFN_EXPLORER, OFN_NODEREFERENCELINKS, OFN_ENABLEINCLUDENOTIFY, OFN_ENABLESIZING, OFN_DONTADDTORECENT,
OFN_FORCESHOWHIDDEN);
var
SaveFile: TOpenFilenameW;
FileDialogWrapper: TFileDialogWrapper;
FileNameBuffer: PChar;
FileNameBufferSize: Integer;
InitialDir, Filter, DefaultExt: string;
FileName: TFileName;
Option: TOpenOption;
WindowList: Pointer;
OwnerHwnd: HWND;
function AllocFilterStr(const S: string): string;
var
SepPos: Integer;
SB: TStringBuilder;
begin
Result := '';
if S <> '' then
begin
Result := S + #0; // double null terminators
SB := TStringBuilder.Create(Result);
try
SepPos := Result.IndexOf('|');
while SepPos >= 0 do
begin
SB.Chars[SepPos] := #0; // adjust because OP strings are 1-offset
Result := SB.ToString;
Inc(SepPos);
SepPos := Result.IndexOf('|', SepPos);
end;
Result := SB.ToString + #0; // add final null terminator
finally
SB.Free;
end;
end;
end;
begin
OwnerHwnd := GetHWND;
if Win32MajorVersion >= 6 then
begin
// This requires Windows Vista or later
FileDialogWrapper := TFileSaveDialogWrapper.Create(ADialog);
try
WindowList := nil;
try
WindowList := DisableTaskWindows(OwnerHwnd);
Result := FileDialogWrapper.Execute(OwnerHwnd);
if Result then
AFiles.Assign(FileDialogWrapper.Files);
finally
EnableTaskWindows(WindowList);
end;
finally
FileDialogWrapper.Free;
end;
Exit;
end;
InitialDir := ADialog.InitialDir;
DefaultExt := ADialog.DefaultExt;
Filter := AllocFilterStr(ADialog.Filter);
if (ADialog.FileName <> '') and (ADialog.FileName[Length(ADialog.FileName)] = PathDelim) then
begin
// if the filename contains a directory, set the initial directory
// and clear the filename
InitialDir := ExcludeTrailingPathDelimiter(ADialog.FileName);
ADialog.FileName := '';
end;
if (DefaultExt = '') or (DefaultExt = null) then
DefaultExt := '*';
FileNameBuffer := AllocMem(FileNameBufferLen * 2 + 2);
if Length(ADialog.FileName) > FileNameBufferLen then
FileNameBufferSize := FileNameBufferLen
else
FileNameBufferSize := Length(ADialog.FileName);
Move(PChar(ADialog.FileName)^, FileNameBuffer^, FileNameBufferSize * 2);
if (Filter = '') or (Filter = null) then
Filter := 'All File Types(*.*)' + #0 + '*.*' + #0 + #0;
// Default -> avoid empty combobox
AFiles.Clear;
FillChar(SaveFile, SizeOf(SaveFile), 0);
SaveFile.hInstance := hInstance;
SaveFile.lStructSize := SizeOf(SaveFile);
SaveFile.nFilterIndex := 0;
SaveFile.hWndOwner := OwnerHwnd;
SaveFile.lpstrFile := FileNameBuffer;
SaveFile.lpstrFilter := PChar(Filter);
if ADialog.Title <> '' then
SaveFile.lpstrTitle := PChar(ADialog.Title);
SaveFile.lpstrInitialDir := PChar(InitialDir);
SaveFile.lpstrDefExt := PChar(DefaultExt);
SaveFile.lpstrFile := FileNameBuffer;
SaveFile.nMaxFile := FileNameBufferLen + 1; // Size in TCHARs
SaveFile.nFilterIndex := ADialog.FilterIndex;
SaveFile.Flags := OFN_EXPLORER;
for Option := Low(Option) to High(Option) do
if Option in ADialog.Options then
SaveFile.Flags := SaveFile.Flags or OpenOptions[Option];
if TOpenOption.ofAllowMultiSelect in ADialog.Options then
SaveFile.Flags := SaveFile.Flags or OFN_ALLOWMULTISELECT;
WindowList := nil;
try
WindowList := DisableTaskWindows(SaveFile.hWndOwner);
Result := GetSaveFileName(SaveFile);
finally
EnableTaskWindows(WindowList);
end;
if Result then
FileName := FileNameBuffer;
GetFileNames(SaveFile, FileName, AFiles, ADialog.Options);
ADialog.FileName := FileName;
if (SaveFile.Flags and OFN_EXTENSIONDIFFERENT) <> 0 then
ADialog.Options := ADialog.Options + [TOpenOption.ofExtensionDifferent]
else
ADialog.Options := ADialog.Options - [TOpenOption.ofExtensionDifferent];
if (SaveFile.Flags and OFN_READONLY) <> 0 then
ADialog.Options := ADialog.Options + [TOpenOption.ofReadOnly]
else
ADialog.Options := ADialog.Options - [TOpenOption.ofReadOnly];
ADialog.FilterIndex := SaveFile.nFilterIndex;
FreeMem(FileNameBuffer);
end;
procedure GetPrinter(var DeviceMode, DeviceNames: HGLOBAL);
var
Device, Driver, Port: array [0 .. 1023] of Char;
DevNames: PDevNames;
Offset: PChar;
begin
(Printer as TPrinterWin).GetPrinter(Device, Driver, Port, DeviceMode);
if DeviceMode <> 0 then
begin
DeviceNames := GlobalAlloc(GHND, SizeOf(TDevNames) + (StrLen(Device) + StrLen(Driver) + StrLen(Port) + 3) *
SizeOf(Char));
DevNames := PDevNames(GlobalLock(DeviceNames));
try
Offset := PChar(PByte(DevNames) + SizeOf(TDevNames));
DevNames^.wDriverOffset := Offset - PChar(DevNames);
Offset := StrECopy(Offset, Driver) + 1;
DevNames^.wDeviceOffset := Offset - PChar(DevNames);
Offset := StrECopy(Offset, Device) + 1;
DevNames^.wOutputOffset := Offset - PChar(DevNames);;
StrCopy(Offset, Port);
finally
GlobalUnlock(DeviceNames);
end;
end;
end;
procedure SetPrinter(DeviceMode, DeviceNames: HGLOBAL);
var
DevNames: PDevNames;
begin
DevNames := PDevNames(GlobalLock(DeviceNames));
try
(Printer as TPrinterWin).SetPrinter(PChar(DevNames) + DevNames^.wDeviceOffset,
PChar(DevNames) + DevNames^.wDriverOffset, PChar(DevNames) + DevNames^.wOutputOffset, DeviceMode);
finally
GlobalUnlock(DeviceNames);
GlobalFree(DeviceNames);
end;
end;
function CopyData(Handle: THandle): THandle;
var
Src, Dest: PChar;
Size: Integer;
begin
if Handle <> 0 then
begin
Size := GlobalSize(Handle);
Result := GlobalAlloc(GHND, Size);
if Result <> 0 then
try
Src := GlobalLock(Handle);
Dest := GlobalLock(Result);
if (Src <> nil) and (Dest <> nil) then
Move(Src^, Dest^, Size);
finally
GlobalUnlock(Handle);
GlobalUnlock(Result);
end
end
else
Result := 0;
end;
function TFMXDialogService.DialogPrint(var ACollate, APrintToFile: Boolean; var AFromPage, AToPage, ACopies: Integer;
AMinPage, AMaxPage: Integer; var APrintRange: TPrintRange; AOptions: TPrintDialogOptions): Boolean;
const
PrintRanges: array [TPrintRange] of Integer = (PD_ALLPAGES, PD_SELECTION, PD_PAGENUMS);
var
PrintDlgRec: TPrintDlg;
DevHandle: HGLOBAL;
WindowList: Pointer;
begin
FillChar(PrintDlgRec, SizeOf(PrintDlgRec), 0);
PrintDlgRec.hInstance := hInstance;
PrintDlgRec.lStructSize := SizeOf(PrintDlgRec);
PrintDlgRec.hWndOwner := GetHWND;
GetPrinter(DevHandle, PrintDlgRec.hDevNames);
PrintDlgRec.hDevMode := CopyData(DevHandle);
PrintDlgRec.Flags := PrintRanges[APrintRange];
if ACollate then
Inc(PrintDlgRec.Flags, PD_COLLATE);
if not (TPrintDialogOption.poPrintToFile in AOptions) then
Inc(PrintDlgRec.Flags, PD_HIDEPRINTTOFILE);
if not (TPrintDialogOption.poPageNums in AOptions) then
Inc(PrintDlgRec.Flags, PD_NOPAGENUMS);
if not (TPrintDialogOption.poSelection in AOptions) then
Inc(PrintDlgRec.Flags, PD_NOSELECTION);
if TPrintDialogOption.poDisablePrintToFile in AOptions then
Inc(PrintDlgRec.Flags, PD_DISABLEPRINTTOFILE);
if APrintToFile then
Inc(PrintDlgRec.Flags, PD_PRINTTOFILE);
if TPrintDialogOption.poHelp in AOptions then
Inc(PrintDlgRec.Flags, PD_SHOWHELP);
if not (TPrintDialogOption.poWarning in AOptions) then
Inc(PrintDlgRec.Flags, PD_NOWARNING);
PrintDlgRec.nFromPage := AFromPage;
PrintDlgRec.nToPage := AToPage;
PrintDlgRec.nMinPage := AMinPage;
PrintDlgRec.nMaxPage := AMaxPage;
WindowList := nil;
try
WindowList := DisableTaskWindows(PrintDlgRec.hWndOwner);
Result := PrintDlg(PrintDlgRec);
finally
EnableTaskWindows(WindowList);
end;
if Result then
begin
SetPrinter(PrintDlgRec.hDevMode, PrintDlgRec.hDevNames);
ACollate := PrintDlgRec.Flags and PD_COLLATE <> 0;
APrintToFile := PrintDlgRec.Flags and PD_PRINTTOFILE <> 0;
if PrintDlgRec.Flags and PD_SELECTION <> 0 then
APrintRange := TPrintRange.prSelection
else if PrintDlgRec.Flags and PD_PAGENUMS <> 0 then
APrintRange := TPrintRange.prPageNums
else
APrintRange := TPrintRange.prAllPages;
AFromPage := PrintDlgRec.nFromPage;
AToPage := PrintDlgRec.nToPage;
end
else
begin
if PrintDlgRec.hDevMode <> 0 then
begin
GlobalFree(PrintDlgRec.hDevMode);
PrintDlgRec.hDevMode := 0;
end;
if PrintDlgRec.hDevNames <> 0 then
begin
GlobalFree(PrintDlgRec.hDevNames);
PrintDlgRec.hDevNames := 0;
end;
end;
end;
function TFMXDialogService.DialogPrinterSetup: Boolean;
var
PrintDlgRec: TPrintDlg;
DevHandle: THandle;
WindowList: Pointer;
begin
FillChar(PrintDlgRec, SizeOf(PrintDlgRec), 0);
PrintDlgRec.lStructSize := SizeOf(PrintDlgRec);
PrintDlgRec.hInstance := SysInit.hInstance;
GetPrinter(DevHandle, PrintDlgRec.hDevNames);
PrintDlgRec.hDevMode := CopyData(DevHandle);
PrintDlgRec.Flags := PD_PRINTSETUP;
PrintDlgRec.hWndOwner := GetHWND;
WindowList := nil;
try
WindowList := DisableTaskWindows(PrintDlgRec.hWndOwner);
Result := PrintDlg(PrintDlgRec);
finally
EnableTaskWindows(WindowList);
end;
if Result then
SetPrinter(PrintDlgRec.hDevMode, PrintDlgRec.hDevNames)
else
begin
if PrintDlgRec.hDevMode <> 0 then
GlobalFree(PrintDlgRec.hDevMode);
if PrintDlgRec.hDevNames <> 0 then
GlobalFree(PrintDlgRec.hDevNames);
end;
end;
function TFMXDialogService.PageSetupGetDefaults(var AMargin, AMinMargin: TRect; var APaperSize: TPointF;
AUnits: TPageMeasureUnits; AOptions: TPageSetupDialogOptions): Boolean;
var
PageSetupDlgRec: TPageSetupDlg;
WindowList: Pointer;
begin
Result := False;
if TPrinterWin(Printer).Count = 0 then
Exit;
FillChar(PageSetupDlgRec, SizeOf(PageSetupDlgRec), 0);
PageSetupDlgRec.lStructSize := SizeOf(PageSetupDlgRec);
PageSetupDlgRec.hInstance := SysInit.hInstance;
case AUnits of
// pmDefault : Read from locale settings by the dialog
TPageMeasureUnits.pmInches:
Inc(PageSetupDlgRec.Flags, PSD_INTHOUSANDTHSOFINCHES);
TPageMeasureUnits.pmMillimeters:
Inc(PageSetupDlgRec.Flags, PSD_INHUNDREDTHSOFMILLIMETERS);
end;
if TPageSetupDialogOption.psoDefaultMinMargins in AOptions then
Inc(PageSetupDlgRec.Flags, PSD_DEFAULTMINMARGINS);
if TPageSetupDialogOption.psoDisableMargins in AOptions then
Inc(PageSetupDlgRec.Flags, PSD_DISABLEMARGINS);
if TPageSetupDialogOption.psoDisableOrientation in AOptions then
Inc(PageSetupDlgRec.Flags, PSD_DISABLEORIENTATION);
if TPageSetupDialogOption.psoDisablePagePainting in AOptions then
Inc(PageSetupDlgRec.Flags, PSD_DISABLEPAGEPAINTING);
if TPageSetupDialogOption.psoDisablePaper in AOptions then
Inc(PageSetupDlgRec.Flags, PSD_DISABLEPAPER);
if TPageSetupDialogOption.psoDisablePrinter in AOptions then
Inc(PageSetupDlgRec.Flags, PSD_DISABLEPRINTER);
PageSetupDlgRec.ptPaperSize.X := Round(APaperSize.X);
PageSetupDlgRec.ptPaperSize.Y := Round(APaperSize.Y);
PageSetupDlgRec.rtMinMargin.Left := AMinMargin.Left;
PageSetupDlgRec.rtMinMargin.Top := AMinMargin.Top;
PageSetupDlgRec.rtMinMargin.Right := AMinMargin.Right;
PageSetupDlgRec.rtMinMargin.Bottom := AMinMargin.Bottom;
PageSetupDlgRec.rtMargin.Left := AMargin.Left;
PageSetupDlgRec.rtMargin.Top := AMargin.Top;
PageSetupDlgRec.rtMargin.Right := AMargin.Right;
PageSetupDlgRec.rtMargin.Bottom := AMargin.Bottom;
PageSetupDlgRec.Flags := PageSetupDlgRec.Flags or PSD_RETURNDEFAULT;
PageSetupDlgRec.hDevNames := 0;
PageSetupDlgRec.hDevMode := 0;
PageSetupDlgRec.hWndOwner := GetHWND;
WindowList := nil;
try
WindowList := DisableTaskWindows(PageSetupDlgRec.hWndOwner);
Result := PageSetupDlg(PageSetupDlgRec);
finally
EnableTaskWindows(WindowList);
end;
if Result then
begin
APaperSize.X := PageSetupDlgRec.ptPaperSize.X;
APaperSize.Y := PageSetupDlgRec.ptPaperSize.Y;
AMargin.Left := PageSetupDlgRec.rtMargin.Left;
AMargin.Top := PageSetupDlgRec.rtMargin.Top;
AMargin.Right := PageSetupDlgRec.rtMargin.Right;
AMargin.Bottom := PageSetupDlgRec.rtMargin.Bottom;
if PageSetupDlgRec.hDevMode <> 0 then
begin
GlobalFree(PageSetupDlgRec.hDevMode);
PageSetupDlgRec.hDevMode := 0;
end;
if PageSetupDlgRec.hDevNames <> 0 then
begin
GlobalFree(PageSetupDlgRec.hDevNames);
PageSetupDlgRec.hDevNames := 0;
end;
end;
end;
function TFMXDialogService.DialogPageSetup(var AMargin, AMinMargin: TRect; var APaperSize: TPointF;
var AUnits: TPageMeasureUnits; AOptions: TPageSetupDialogOptions): Boolean;
var
PageSetupDlgRec: TPageSetupDlg;
DevHandle: THandle;
WindowList: Pointer;
begin
FillChar(PageSetupDlgRec, SizeOf(PageSetupDlgRec), 0);
PageSetupDlgRec.lStructSize := SizeOf(PageSetupDlgRec);
PageSetupDlgRec.hInstance := SysInit.hInstance;
GetPrinter(DevHandle, PageSetupDlgRec.hDevNames);
PageSetupDlgRec.hDevMode := CopyData(DevHandle);
PageSetupDlgRec.hWndOwner := GetHWND;
case AUnits of
TPageMeasureUnits.pmInches:
Inc(PageSetupDlgRec.Flags, PSD_INTHOUSANDTHSOFINCHES);
TPageMeasureUnits.pmMillimeters:
Inc(PageSetupDlgRec.Flags, PSD_INHUNDREDTHSOFMILLIMETERS);
end;
if TPageSetupDialogOption.psoDefaultMinMargins in AOptions then
Inc(PageSetupDlgRec.Flags, PSD_DEFAULTMINMARGINS);
if TPageSetupDialogOption.psoDisableMargins in AOptions then
Inc(PageSetupDlgRec.Flags, PSD_DISABLEMARGINS);
if TPageSetupDialogOption.psoDisableOrientation in AOptions then
Inc(PageSetupDlgRec.Flags, PSD_DISABLEORIENTATION);
if TPageSetupDialogOption.psoDisablePagePainting in AOptions then
Inc(PageSetupDlgRec.Flags, PSD_DISABLEPAGEPAINTING);
if TPageSetupDialogOption.psoDisablePaper in AOptions then
Inc(PageSetupDlgRec.Flags, PSD_DISABLEPAPER);
if TPageSetupDialogOption.psoDisablePrinter in AOptions then
Inc(PageSetupDlgRec.Flags, PSD_DISABLEPRINTER);
if TPageSetupDialogOption.psoMargins in AOptions then
begin
Inc(PageSetupDlgRec.Flags, PSD_MARGINS);
PageSetupDlgRec.rtMargin.Left := AMargin.Left;
PageSetupDlgRec.rtMargin.Top := AMargin.Top;
PageSetupDlgRec.rtMargin.Right := AMargin.Right;
PageSetupDlgRec.rtMargin.Bottom := AMargin.Bottom;
end;
if TPageSetupDialogOption.psoMinMargins in AOptions then
begin
Inc(PageSetupDlgRec.Flags, PSD_MINMARGINS);
PageSetupDlgRec.rtMinMargin.Left := AMinMargin.Left;
PageSetupDlgRec.rtMinMargin.Top := AMinMargin.Top;
PageSetupDlgRec.rtMinMargin.Right := AMinMargin.Right;
PageSetupDlgRec.rtMinMargin.Bottom := AMinMargin.Bottom;
end;
if TPageSetupDialogOption.psoShowHelp in AOptions then
Inc(PageSetupDlgRec.Flags, PSD_SHOWHELP);
if not (TPageSetupDialogOption.psoWarning in AOptions) then
Inc(PageSetupDlgRec.Flags, PSD_NOWARNING);
if TPageSetupDialogOption.psoNoNetworkButton in AOptions then
Inc(PageSetupDlgRec.Flags, PSD_NONETWORKBUTTON);
// Set the user defined margins and page size
// ptPaperSize.X := APaperSize.X;
// ptPaperSize.Y := APaperSize.Y;
WindowList := nil;
try
WindowList := DisableTaskWindows(PageSetupDlgRec.hWndOwner);
Result := PageSetupDlg(PageSetupDlgRec);
finally
EnableTaskWindows(WindowList);
end;
if Result then
begin
APaperSize.X := PageSetupDlgRec.ptPaperSize.X;
APaperSize.Y := PageSetupDlgRec.ptPaperSize.Y;
AMargin.Left := PageSetupDlgRec.rtMargin.Left;
AMargin.Top := PageSetupDlgRec.rtMargin.Top;
AMargin.Right := PageSetupDlgRec.rtMargin.Right;
AMargin.Bottom := PageSetupDlgRec.rtMargin.Bottom;
SetPrinter(PageSetupDlgRec.hDevMode, PageSetupDlgRec.hDevNames)
end
else
begin
if PageSetupDlgRec.hDevMode <> 0 then
begin
GlobalFree(PageSetupDlgRec.hDevMode);
PageSetupDlgRec.hDevMode := 0;
end;
if PageSetupDlgRec.hDevNames <> 0 then
begin
GlobalFree(PageSetupDlgRec.hDevNames);
PageSetupDlgRec.hDevNames := 0;
end;
end;
end;
function EnumButtons(Wnd: HWND; Data: TFMXDialogService.PDialogData): BOOL; stdcall;
const
MaxStrLen = 64;
var
PStr: PChar;
I: Integer;
begin
PStr := StrAlloc(MaxStrLen);
try
GetClassName(Wnd, PStr, MaxStrLen);
if string.Compare(PStr, WC_BUTTON, [coIgnoreCase]) = 0 then
begin
I := GetWindowLong(Wnd, GWL_ID);
if (I >= Low(Data.Buttons)) and (I <= High(Data.Buttons)) then
begin
Data.Buttons[I] := Wnd;
GetWindowRect(Wnd, Data.Rects[I]);
Winapi.Windows.ScreenToClient(Data.Dialog, Data.Rects[I].TopLeft);
Winapi.Windows.ScreenToClient(Data.Dialog, Data.Rects[I].BottomRight);
end;
end;
finally
StrDispose(PStr);
end;
Result := True;
end;
function MessageDialogHook(nCode: Integer; AwParam: WParam; AlParam: LParam): LRESULT; stdcall;
const
HideButtonFlafs = SWP_NOZORDER or SWP_NOACTIVATE or SWP_NOSENDCHANGING or SWP_SHOWWINDOW;
procedure HideRetry(const Data: TFMXDialogService.TDialogData);
var
R: TRect;
begin
ShowWindow(Data.Buttons[IDRETRY], SW_HIDE);
R := Data.Rects[IDRETRY];
SetWindowPos(Data.Buttons[IDABORT], HWND_NOTOPMOST, R.Left, R.Top, R.Width, R.Height, HideButtonFlafs);
end;
function GetButtonText(const Data: TFMXDialogService.TDialogData; const Id: Integer): string;
var
L: Integer;
Wnd: HWND;
begin
Result := '';
if (Id >= Low(Data.Buttons)) and (Id <= High(Data.Buttons)) then
begin
if Data.Buttons[Id] <> 0 then
Wnd := Data.Buttons[Id]
else
Wnd := Data.CustomButtons[Id];
if Wnd <> 0 then
begin
L := GetWindowTextLength(Wnd);
SetLength(Result, L + 1);
GetWindowText(Wnd, PChar(Result), L + 1);
SetLength(Result, L);
end;
end;
end;
procedure SetButtonText(const Data: TFMXDialogService.TDialogData; const Id: Integer; const Caption: string);
begin
if (Id >= Low(Data.Buttons)) and (Id <= High(Data.Buttons)) then
begin
if Data.Buttons[Id] <> 0 then
SetWindowText(Data.Buttons[Id], PChar(Caption));
if Data.CustomButtons[Id] <> 0 then
SetWindowText(Data.CustomButtons[Id], PChar(Caption));
end;
end;
function TextSize(const Wnd: HWND; const S: string): TRect;
var
DC: HDC;
OldFont: HFONT;
begin
DC := GetDc(Wnd);
try
OldFont := SelectObject(DC, TFMXDialogService.Current.Font);
try
Result := TRect.Create(0, 0, 2000, 2000);
DrawText(DC, PChar(S), -1, Result, DT_CALCRECT);
finally
SelectObject(DC, OldFont);
end;
finally
ReleaseDC(Wnd, DC);
end;
end;
procedure SetButtonRect(var Data: TFMXDialogService.TDialogData; const Id, Padding, Margin: Integer; var R: TRect);
var
Wnd: HWND;
begin
if (Id >= Low(Data.CustomButtons)) and (Id <= High(Data.CustomButtons)) then
begin
if Data.Buttons[Id] <> 0 then
Wnd := Data.Buttons[Id]
else
Wnd := Data.CustomButtons[Id];
if Wnd <> 0 then
begin
R.Right := R.Left + TextSize(Wnd, GetButtonText(Data, Id)).Width + Padding;
R.Offset(-R.Width - Margin, 0);
SetWindowPos(Wnd, HWND_NOTOPMOST, R.Left, R.Top, R.Width, R.Height, HideButtonFlafs);
Data.Rects[Id] := R;
end;
end;
end;
function CreateButton(var Data: TFMXDialogService.TDialogData; const Id: Integer; const Caption: string): Boolean;
var
I: Integer;
LStyle, LExStyle, LParent, L: NativeInt;
begin
Result := False;
if (Id >= Low(Data.CustomButtons)) and (Id <= High(Data.CustomButtons)) then
begin
LStyle := 0;
LExStyle := 0;
LParent := 0;
for I := Low(Data.Buttons) to High(Data.Buttons) do
if Data.Buttons[I] <> 0 then
begin
LStyle := GetWindowLong(Data.Buttons[I], GWL_STYLE) and (not BS_DEFPUSHBUTTON);
LExStyle := GetWindowLong(Data.Buttons[I], GWL_EXSTYLE);
LParent := GetWindowLong(Data.Buttons[I], GWL_HWNDPARENT);
Break;
end;
if LParent <> 0 then
begin
Data.CustomButtons[Id] := CreateWindowEx(LExStyle, WC_BUTTON, PChar(Caption), LStyle, 0, Id * 22, 60, 20,
LParent, 0, hInstance, nil);
SetWindowLong(Data.CustomButtons[Id], GWL_ID, Id);
L := 0;
SendMessage(Data.CustomButtons[Id], WM_SETFONT, TFMXDialogService.Current.Font, L);
end;
end;
end;
var
Data: TFMXDialogService.TDialogData;
I, Padding, Margin: Integer;
R: TRect;
begin
case nCode of
HCBT_ACTIVATE:
begin
if TFMXDialogService.Current.InitLastData(AwParam) and TFMXDialogService.Current.GetData(AwParam, Data) then
begin
if Data.MsgDlgButtons * mbAbortIgnore = mbAbortIgnore then
HideRetry(Data)
else if Data.MsgDlgButtons * mbYesAllNoAllCancel = mbYesAllNoAllCancel then
begin
R := TextSize(Data.Buttons[IDYES], GetButtonText(Data, Data.Buttons[IDYES]));
Padding := (Data.Rects[IDYES].Height - R.Height) div 2;
Margin := Data.Rects[IDNO].Left - Data.Rects[IDYES].Left - Data.Rects[IDNO].Width;
CreateButton(Data, IDRETRY, Translate(SMsgDlgYestoAll));
CreateButton(Data, IDIGNORE, Translate(SMsgDlgNoToAll));
SetButtonText(Data, IDYES, Translate(SMsgDlgYes));
SetButtonText(Data, IDNO, Translate(SMsgDlgNO));
SetButtonText(Data, IDCANCEL, Translate(SMsgDlgCancel));
SetButtonText(Data, IDHELP, Translate(SMsgDlgHelp));
R := Data.Rects[IDCANCEL];
R.Left := R.Right + Margin;
SetButtonRect(Data, IDCANCEL, Padding, Margin, R);
SetButtonRect(Data, IDIGNORE, Padding, Margin, R);
SetButtonRect(Data, IDNO, Padding, Margin, R);
SetButtonRect(Data, IDRETRY, Padding, Margin, R);
SetButtonRect(Data, IDYES, Padding, Margin, R);
TFMXDialogService.Current.SetData(AwParam, Data);
end;
end;
end;
HCBT_DESTROYWND:
if TFMXDialogService.Current.GetData(AwParam, Data) then
begin
for I := Low(Data.CustomButtons) to High(Data.CustomButtons) do
if Data.CustomButtons[I] <> 0 then
begin
DestroyWindow(Data.CustomButtons[I]);
Data.CustomButtons[I] := 0;
end;
TFMXDialogService.Current.SetData(AwParam, Data);
end;
end;
Result := CallNextHookEx(TFMXDialogService.Current.OldHook, nCode, AwParam, AlParam);
end;
procedure TFMXDialogService.BeginHook(const AMsgDlgButtons: TMsgDlgButtons);
var
Rec: TDialogData;
begin
if GetCount = 0 then
FOldHook := SetWindowsHookEx(WH_CBT, @MessageDialogHook, 0, GetCurrentThreadId);
if FOldHook <> 0 then
begin
if FHookList = nil then
FHookList := TList<TDialogData>.Create;
FillChar(Rec, SizeOf(Rec), 0);
Rec.MsgDlgButtons := AMsgDlgButtons;
FHookList.Add(Rec);
end;
end;
procedure TFMXDialogService.EndHook;
begin
if GetCount > 0 then
begin
FHookList.Delete(FHookList.Count - 1);
if GetCount = 0 then
begin
if FOldHook <> 0 then
begin
UnhookWindowsHookEx(FOldHook);
FOldHook := 0;
end;
if FFont <> 0 then
begin
CheckWinapiResult(DeleteObject(FFont));
FFont := 0;
end;
end;
end;
end;
function TFMXDialogService.ConvertResult(const ModalResult: Integer): Integer;
begin
Result := ModalResult;
if (GetCount > 0) and (FHookList[GetCount - 1].MsgDlgButtons * mbYesAllNoAllCancel = mbYesAllNoAllCancel) then
begin
case ModalResult of
IDRETRY:
Result := mrYesToAll;
IDIGNORE:
Result := mrNoToAll;
end;
end;
end;
function TFMXDialogService.GetCount: Integer;
begin
if FHookList <> nil then
Result := FHookList.Count
else
Result := 0;
end;
function TFMXDialogService.NeedInit: Boolean;
begin
Result := (GetCount > 0) and (FHookList[GetCount - 1].Dialog = 0);
end;
function TFMXDialogService.InitLastData(const ADialog: HWND): Boolean;
var
Data: TDialogData;
begin
Result := (ADialog <> 0) and (ADialog <> INVALID_HANDLE_VALUE) and NeedInit;
if Result then
begin
Data := FHookList[GetCount - 1];
Data.Dialog := ADialog;
EnumChildWindows(Data.Dialog, @EnumButtons, LParam(@Data));
FHookList[GetCount - 1] := Data;
end;
end;
function TFMXDialogService.GetData(const ADialog: HWND; var AData: TDialogData): Boolean;
var
I: Integer;
begin
if (ADialog <> 0) and (ADialog <> INVALID_HANDLE_VALUE) then
for I := GetCount - 1 downto 0 do
if FHookList[I].Dialog = ADialog then
begin
AData := FHookList[I];
Exit(True);
end;
Result := False;
end;
function TFMXDialogService.GetFont: HFONT;
var
NonClientMetrics: TNonClientMetrics;
Siz: Integer;
begin
if FFont = 0 then
begin
Siz := NonClientMetrics.SizeOf;
FillChar(NonClientMetrics, Siz, 0);
NonClientMetrics.cbSize := Siz;
CheckWinapiResult(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @NonClientMetrics, 0));
FFont := CheckWinapiHandle(CreateFontIndirect(NonClientMetrics.lfMessageFont));
end;
Result := FFont;
end;
function TFMXDialogService.GetHWND: HWND;
begin
if (Screen <> nil) and (Screen.ActiveForm <> nil) then
Result := FormToHWND(Screen.ActiveForm)
else
Result := ApplicationHWND;
end;
function TFMXDialogService.SetData(const ADialog: HWND; const AData: TDialogData): Boolean;
var
I: Integer;
Data: TDialogData;
begin
if (ADialog <> 0) and (ADialog <> INVALID_HANDLE_VALUE) then
for I := GetCount - 1 downto 0 do
if FHookList[I].Dialog = ADialog then
begin
Data := AData;
Data.Dialog := ADialog;
FHookList[I] := Data;
Exit(True);
end;
Result := False;
end;
function TFMXDialogService.MessageDialog(const AMessage: string; const ADialogType: TMsgDlgType;
const AButtons: TMsgDlgButtons; const ADefaultButton: TMsgDlgBtn; const AX, AY: Integer; const AHelpCtx: THelpContext;
const AHelpFileName: string): Integer;
var
Params: tagMSGBOXPARAMSW;
LButtons: TMsgDlgButtons;
begin
FillChar(Params, SizeOf(Params), 0);
Params.cbSize := SizeOf(Params);
Params.hInstance := hInstance;
Params.hWndOwner := GetHWND;
Params.dwContextHelpId := AHelpCtx;
if ADialogType <> TMsgDlgType.mtCustom then
Params.lpszCaption := PChar(Translate(MsgCaptions[ADialogType]))
else
Params.lpszCaption := PChar(Application.Title);
Params.lpszText := PChar(AMessage);
LButtons := AButtons - [TMsgDlgBtn.mbHelp];
if LButtons = [TMsgDlgBtn.mbOK] then
begin
Params.dwStyle := MB_OK;
case ADefaultButton of
TMsgDlgBtn.mbHelp:
Params.dwStyle := Params.dwStyle or MB_DEFBUTTON2;
end;
end
else if LButtons = mbOkCancel then
begin
Params.dwStyle := MB_OKCANCEL;
case ADefaultButton of
TMsgDlgBtn.mbCancel:
Params.dwStyle := Params.dwStyle or MB_DEFBUTTON2;
TMsgDlgBtn.mbHelp:
Params.dwStyle := Params.dwStyle or MB_DEFBUTTON3;
end;
end
else if (LButtons = mbYesAllNoAllCancel) or (LButtons = mbYesNoCancel) then
begin
Params.dwStyle := MB_YESNOCANCEL;
case ADefaultButton of
TMsgDlgBtn.mbNo:
Params.dwStyle := Params.dwStyle or MB_DEFBUTTON2;
TMsgDlgBtn.mbCancel:
Params.dwStyle := Params.dwStyle or MB_DEFBUTTON3;
TMsgDlgBtn.mbHelp:
Params.dwStyle := Params.dwStyle or MB_DEFBUTTON4;
end;
end
else if (LButtons = mbAbortRetryIgnore) or (LButtons = mbAbortIgnore) then
begin
Params.dwStyle := MB_ABORTRETRYIGNORE;
case ADefaultButton of
TMsgDlgBtn.mbRetry:
Params.dwStyle := Params.dwStyle or MB_DEFBUTTON2;
TMsgDlgBtn.mbCancel:
Params.dwStyle := Params.dwStyle or MB_DEFBUTTON3;
TMsgDlgBtn.mbHelp:
Params.dwStyle := Params.dwStyle or MB_DEFBUTTON4;
end;
end
else if (LButtons = mbYesNo) then
begin
Params.dwStyle := MB_YESNO;
case ADefaultButton of
TMsgDlgBtn.mbNo:
Params.dwStyle := Params.dwStyle or MB_DEFBUTTON2;
TMsgDlgBtn.mbHelp:
Params.dwStyle := Params.dwStyle or MB_DEFBUTTON3;
end;
end
else if (LButtons = [TMsgDlgBtn.mbRetry, TMsgDlgBtn.mbCancel]) then
begin
Params.dwStyle := MB_RETRYCANCEL;
case ADefaultButton of
TMsgDlgBtn.mbCancel:
Params.dwStyle := Params.dwStyle or MB_DEFBUTTON2;
TMsgDlgBtn.mbHelp:
Params.dwStyle := Params.dwStyle or MB_DEFBUTTON3;
end;
end;
if TMsgDlgBtn.mbHelp in AButtons then
Params.dwStyle := Params.dwStyle or MB_HELP;
Params.dwStyle := Params.dwStyle or MsgIcons[ADialogType];
if (LButtons = mbYesAllNoAllCancel) or (LButtons = mbAbortIgnore) then
begin
TFMXDialogService.Current.BeginHook(AButtons);
try
Result := MessageBoxIndirect(Params);
Result := TFMXDialogService.Current.ConvertResult(Result);
finally
TFMXDialogService.Current.EndHook;
end;
end
else
Result := MessageBoxIndirect(Params);
end;
procedure TFMXDialogService.MessageDialog(const AMessage: string; const ADialogType: TMsgDlgType;
const AButtons: TMsgDlgButtons; const ADefaultButton: TMsgDlgBtn; const AX, AY: Integer; const AHelpCtx: THelpContext;
const AHelpFileName: string; const ACloseDialogProc: TInputCloseDialogProc);
var
LRESULT: TModalResult;
begin
LRESULT := MessageDialog(AMessage, ADialogType, AButtons, ADefaultButton, AX, AY, AHelpCtx, AHelpFileName);
if Assigned(ACloseDialogProc) then
ACloseDialogProc(LRESULT);
end;
procedure TFMXDialogService.InputQuery(const ACaption: string; const APrompts, ADefaultValues: array of string;
const ACloseQueryProc: TInputCloseQueryProc);
var
Result: TModalResult;
LValues: array of string;
I: Integer;
begin
Result := mrCancel;
SetLength(LValues, Length(ADefaultValues));
for I := Low(ADefaultValues) to High(ADefaultValues) do
LValues[I] := ADefaultValues[I];
if InputQuery(ACaption, APrompts, LValues) then
Result := mrOk;
if Assigned(ACloseQueryProc) then
ACloseQueryProc(Result, LValues);
end;
function TFMXDialogService.InputQuery(const ACaption: string; const APrompts: array of string;
var AValues: array of string; const ACloseQueryFunc: TInputCloseQueryFunc): Boolean;
begin
Result := DefaultInputQuery(ACaption, APrompts, AValues, ACloseQueryFunc);
end;
{ IFMXDialogServiceSync }
procedure TFMXDialogService.ShowMessageSync(const AMessage: string);
begin
MessageDialogSync(AMessage, TMsgDlgType.mtCustom, [TMsgDlgBtn.mbOK], TMsgDlgBtn.mbOK, 0);
end;
function TFMXDialogService.MessageDialogSync(const AMessage: string; const ADialogType: TMsgDlgType;
const AButtons: TMsgDlgButtons; const ADefaultButton: TMsgDlgBtn; const AHelpCtx: THelpContext): Integer;
begin
MessageDialogCheckInUIThread;
Result := MessageDialog(AMessage, ADialogType, AButtons, ADefaultButton, 0,0, 0, '');
end;
function TFMXDialogService.InputQuerySync(const ACaption: string; const APrompts: array of string; var AValues: array of string): Boolean;
var
LResult: Boolean;
LValues: array of string;
begin
MessageDialogCheckInUIThread;
TDialogHelper.InputQuery(ACaption, APrompts, AValues,
procedure(const AResult: TModalResult; const Values: array of string)
begin
LResult := AResult = mrOk;
SetLength(LValues, Length(Values));
TArray.Copy<String>(Values, LValues, Length(Values));
end,
True);
Result := LResult;
TArray.Copy<String>(LValues, AValues, Length(AValues));
end;
{ IFMXDialogServiceAsync }
procedure TFMXDialogService.ShowMessageAsync(const AMessage: string);
var
LProc: TInputCloseDialogProc;
begin
LProc := nil;
ShowMessageAsync(AMessage, LProc);
end;
procedure TFMXDialogService.ShowMessageAsync(const AMessage: string; const ACloseDialogProc: TInputCloseDialogProc);
begin
MessageDialogCheckInUIThread;
TDialogHelper.ShowMessage(AMessage, ACloseDialogProc, False);
end;
procedure TFMXDialogService.ShowMessageAsync(const AMessage: string; const ACloseDialogEvent: TInputCloseDialogEvent;
const AContext: TObject);
begin
ShowMessageAsync(AMessage,
procedure(const AResult: TModalResult)
begin
if Assigned(ACloseDialogEvent) then
ACloseDialogEvent(AContext, AResult);
end);
end;
procedure TFMXDialogService.MessageDialogAsync(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons;
const ADefaultButton: TMsgDlgBtn; const AHelpCtx: THelpContext; const ACloseDialogProc: TInputCloseDialogProc);
begin
MessageDialogCheckInUIThread;
TDialogHelper.MessageDialog(AMessage, ADialogType, AButtons, ADefaultButton, AHelpCtx, ACloseDialogProc, False);
end;
procedure TFMXDialogService.MessageDialogAsync(const AMessage: string; const ADialogType: TMsgDlgType; const AButtons: TMsgDlgButtons;
const ADefaultButton: TMsgDlgBtn; const AHelpCtx: THelpContext; const ACloseDialogEvent: TInputCloseDialogEvent;
const AContext: TObject);
begin
MessageDialogAsync(AMessage, ADialogType, AButtons, ADefaultButton, AHelpCtx,
procedure(const AResult: TModalResult)
begin
if Assigned(ACloseDialogEvent) then
ACloseDialogEvent(AContext, AResult);
end);
end;
procedure TFMXDialogService.InputQueryAsync(const ACaption: string; const APrompts: array of string;
const ADefaultValues: array of string; const ACloseQueryProc: TInputCloseQueryProc);
begin
MessageDialogCheckInUIThread;
TDialogHelper.InputQuery(ACaption, APrompts, ADefaultValues, ACloseQueryProc, False);
end;
procedure TFMXDialogService.InputQueryAsync(const ACaption: string; const APrompts: array of string;
const ADefaultValues: array of string; const ACloseQueryEvent: TInputCloseQueryWithResultEvent; const AContext: TObject);
begin
InputQueryAsync(ACaption, APrompts, ADefaultValues,
procedure(const AResult: TModalResult; const AValues: array of string)
begin
if Assigned(ACloseQueryEvent) then
ACloseQueryEvent(AContext, AResult, AValues);
end);
end;
initialization
TPlatformServices.Current.AddPlatformService(IFMXDialogService, TFMXDialogService.Current);
TPlatformServices.Current.AddPlatformService(IFMXDialogServiceSync, TFMXDialogService.Current);
TPlatformServices.Current.AddPlatformService(IFMXDialogServiceAsync, TFMXDialogService.Current);
end.
| 32.955732 | 138 | 0.724121 |
83ff24a19e2b77f8407f7929e6bb51b7fa8d5715 | 2,180 | pas | Pascal | proj1.pas | MelyMelo8/algo-project | 95ec22509b488ed0517c11e937d4a6d8f056baf7 | [
"MIT"
]
| null | null | null | proj1.pas | MelyMelo8/algo-project | 95ec22509b488ed0517c11e937d4a6d8f056baf7 | [
"MIT"
]
| null | null | null | proj1.pas | MelyMelo8/algo-project | 95ec22509b488ed0517c11e937d4a6d8f056baf7 | [
"MIT"
]
| 1 | 2019-05-16T07:54:29.000Z | 2019-05-16T07:54:29.000Z | unit proj1;
{$mode objfpc}{$H+}
{$codepage UTF8}
{$I-}
(*
Ce fichier définit les fonctions nécessaires à la première question du projet, à savoir la création de mots de manière complètement aléatoire. N'utilisant aucun fichier, aucune table de probabilité, ce programme s'en trouve réduit au strict minimum.
Comme dans les autres fichiers de projet, la fonction p1_main est appelée par le programme mère afin de générer un certain nombre de mots. Les variables n et s sont respectivement utilisées pour définir le nombre de mots et la longueur de ceux-ci.
- 'alphabet' contient la liste de tout les caractères qu'il est possible de retrouver dans un mot. Le caractère spécial 'ø' est utilisé pour définir la fin d'un mot, il ne sera jamais affiché en sortie
- 'creemotaleatoire' est une fonction qui crée un mot de contenu et longueur aléatoire, à partir de la taille minimale. Pour faire simple, la fonction ajoute des caractères un par un au mot jusqu'à trouver 'ø', indiquant la fin du mot
- 'p1_main' est la procédure principale, appelée par le programme mère, et affiche n mots générés
Author: Arthur Blaise (blaisearth@eisti.fr) - ©2018-2019
*)
// public - - - - - - - - - - - - - - - - - - - - - - - - -
interface
USES cwstring, crt ;
CONST alphabet : widestring ='abcdefghijklmnopqrstuvwxyzàâéèêëîïôùûüÿæœç-ø' ;
function creemotaleatoire(taille:integer):widestring;
procedure p1_main(n,s:integer);
// private - - - - - - - - - - - - - - - - - - - - - - - - -
implementation
function creemotaleatoire (taille : integer):widestring ;
var res : widestring;
c : widestring;
begin
res :='';
c := alphabet[random(length(alphabet))];
while length(res)<taille do
begin
while c<>'ø' do
begin
res := res + c;
c := alphabet[random(length(alphabet))+1];
end;
while c='ø' do
c := alphabet[random(length(alphabet))+1];
end;
creemotaleatoire := res;
end;
procedure p1_main(n,s:integer);
var i:integer;
Begin
randomize;
for i:=1 to n do
writeln(creemotaleatoire(s));
end;
end.
| 35.737705 | 249 | 0.658716 |
fcbd14cf9f4b09519cbb138543f7d0fd6f06ad87 | 5,324 | pas | Pascal | ksAwsHttpIndy.pas | edwinyzh/ksAws | 6e0c047ba2fa7b45479ed5897478635a38b0b5c1 | [
"Apache-2.0"
]
| 1 | 2021-02-10T22:11:21.000Z | 2021-02-10T22:11:21.000Z | ksAwsHttpIndy.pas | edwinyzh/ksAws | 6e0c047ba2fa7b45479ed5897478635a38b0b5c1 | [
"Apache-2.0"
]
| null | null | null | ksAwsHttpIndy.pas | edwinyzh/ksAws | 6e0c047ba2fa7b45479ed5897478635a38b0b5c1 | [
"Apache-2.0"
]
| null | null | null | {*******************************************************************************
* *
* ksAwsHttpIndy - ksAws TIdHttp Interface *
* *
* https://github.com/gmurt/ksAws *
* *
* Copyright 2020 Graham Murt *
* *
* email: graham@kernow-software.co.uk *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
* Unless required by applicable law or agreed to in writing, software *
* distributed under the License is distributed on an "AS IS" BASIS, *
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
* See the License for the specific language governing permissions and *
* limitations under the License. *
* *
*******************************************************************************}
unit ksAwsHttpIndy;
interface
uses ksAwsHttpIntf;
function CreateksAwsHttpIndy: IksAwsHttp;
implementation
uses Classes, IdHttp, IdSSL, IdSSLOpenSSL, SysUtils;
var
ASsl: TIdSSLIOHandlerSocketOpenSSL;
type
TksAwsIndyHttp = class(TInterfacedObject, IksAwsHttp)
private
function CreateHttp(AHeaders: TStrings): TIdHttp;
protected
function Get(AUrl: string; AHeaders: TStrings; const AResponseStream: TStream = nil): TksAwsHttpResponse;
function Put(AUrl, APayload: string; AHeaders: TStrings; const AResponseStream: TStream = nil): TksAwsHttpResponse;
function Post(AUrl, APayload: string; AHeaders: TStrings; const AResponseStream: TStream = nil): TksAwsHttpResponse;
function Delete(AUrl: string; AHeaders: TStrings; const AResponseStream: TStream = nil): TksAwsHttpResponse;
end;
function CreateksAwsHttpIndy: IksAwsHttp;
begin
Result := TksAwsIndyHttp.Create;
end;
{ TksAwsIndyHttp }
function ResponseToKsResponse(AIdResponse: TIdHTTPResponse): TksAwsHttpResponse;
begin
Result.StatusCode := AIdResponse.ResponseCode;
Result.ETag := AIdResponse.ETag;
Result.LastModified := DateToStr(AIdResponse.LastModified);
end;
function TksAwsIndyHttp.CreateHttp(AHeaders: TStrings): TIdHttp;
var
ICount: integer;
begin
Result := TIdHTTP.Create;
Result.IOHandler := ASsl;
for ICount := 0 to AHeaders.Count-1 do
Result.Request.CustomHeaders.Values[AHeaders.Names[ICount]] := AHeaders.ValueFromIndex[ICount];
end;
function TksAwsIndyHttp.Delete(AUrl: string; AHeaders: TStrings;
const AResponseStream: TStream): TksAwsHttpResponse;
var
AHttp: TIdHttp;
begin
AHttp := CreateHttp(AHeaders);
AHttp.Delete(AUrl, AResponseStream);
Result.ContentText := '';
Result := ResponseToKsResponse(AHttp.Response);
end;
function TksAwsIndyHttp.Get(AUrl: string; AHeaders: TStrings;
const AResponseStream: TStream = nil): TksAwsHttpResponse;
var
AHttp: TIdHttp;
begin
AHttp := CreateHttp(AHeaders);
try
if AResponseStream <> nil then
AHttp.Get(AUrl, AResponseStream)
else
Result.ContentText := AHttp.Get(AUrl);
Result := ResponseToKsResponse(AHttp.Response);
finally
AHttp.Free;
end;
end;
function TksAwsIndyHttp.Post(AUrl, APayload: string; AHeaders: TStrings;
const AResponseStream: TStream = nil): TksAwsHttpResponse;
var
AHttp: TIdHttp;
AContentStream: TStringStream;
AResponse: TStringStream;
begin
AHttp := CreateHttp(AHeaders);
AContentStream := TStringStream.Create(APayload);
AResponse := TStringStream.Create;
try
AHttp.Post(AUrl, AContentStream, AResponse);
Result.ContentText := AResponse.DataString;
if AResponseStream <> nil then
begin
AResponse.Position := 0;
AResponseStream.CopyFrom(AResponse, AResponse.Size);
end;
Result := ResponseToKsResponse(AHttp.Response);
finally
AHttp.Free;
AContentStream.Free;
AResponse.Free;
end;
end;
function TksAwsIndyHttp.Put(AUrl, APayload: string; AHeaders: TStrings;
const AResponseStream: TStream): TksAwsHttpResponse;
var
AHttp: TIdHttp;
AContentStream: TStringStream;
begin
AHttp := CreateHttp(AHeaders);
AContentStream := TStringStream.Create(APayload);
try
AHttp.Put(AUrl, AContentStream, AResponseStream);
Result := ResponseToKsResponse(AHttp.Response);
finally
AHttp.Free;
AContentStream.Free;
end;
end;
initialization
ASsl := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
finalization
ASsl.Free;
end.
| 34.128205 | 120 | 0.589406 |
477a91c71564805fef8ae1888211c0e107a36f3b | 24,900 | pas | Pascal | post3/pp_3.pas | zag82/magnum3d | 7ce784b8579b1aa5a1fc3e6dc8b1b1a4eb79d48d | [
"MIT"
]
| null | null | null | post3/pp_3.pas | zag82/magnum3d | 7ce784b8579b1aa5a1fc3e6dc8b1b1a4eb79d48d | [
"MIT"
]
| null | null | null | post3/pp_3.pas | zag82/magnum3d | 7ce784b8579b1aa5a1fc3e6dc8b1b1a4eb79d48d | [
"MIT"
]
| null | null | null | unit pp_3;
interface
uses openGL, cm_ini, vi_3,
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ExtCtrls;
type
TfmPostProcessor3 = class(TForm)
Timer1: TTimer;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormResize(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormPaint(Sender: TObject);
procedure FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
private
{ Private declarations }
public
{ Public declarations }
DC : HDC;
hrc : HGLRC;
procedure SetDCPixelFormat;
end;
var
fmPostProcessor3: TfmPostProcessor3;
implementation
{$R *.DFM}
uses p3_data, gl_ob, cmVars, cmData, comPlx, pre_proc, ComVars, graph_3;
const
FLightAmbient : Array[0..3] of GLfloat = (0.5, 0.5, 0.5, 1.0);
FLightDiffuse : Array[0..3] of GLfloat = (0.5, 0.5, 0.5, 1.0);
FLightSpecular: Array[0..3] of GLfloat = (0.5, 0.5, 0.5, 1.0);
var
fontOffset : GLuint;
rasters : Array [0..94, 0..12] of GLUByte = (
($00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00),
($00, $00, $18, $18, $00, $00, $18, $18, $18, $18, $18, $18, $18),
($00, $00, $00, $00, $00, $00, $00, $00, $00, $36, $36, $36, $36),
($00, $00, $00, $66, $66, $ff, $66, $66, $ff, $66, $66, $00, $00),
($00, $00, $18, $7e, $ff, $1b, $1f, $7e, $f8, $d8, $ff, $7e, $18),
($00, $00, $0e, $1b, $db, $6e, $30, $18, $0c, $76, $db, $d8, $70),
($00, $00, $7f, $c6, $cf, $d8, $70, $70, $d8, $cc, $cc, $6c, $38),
($00, $00, $00, $00, $00, $00, $00, $00, $00, $18, $1c, $0c, $0e),
($00, $00, $0c, $18, $30, $30, $30, $30, $30, $30, $30, $18, $0c),
($00, $00, $30, $18, $0c, $0c, $0c, $0c, $0c, $0c, $0c, $18, $30),
($00, $00, $00, $00, $99, $5a, $3c, $ff, $3c, $5a, $99, $00, $00),
($00, $00, $00, $18, $18, $18, $ff, $ff, $18, $18, $18, $00, $00),
($00, $00, $30, $18, $1c, $1c, $00, $00, $00, $00, $00, $00, $00),
($00, $00, $00, $00, $00, $00, $ff, $ff, $00, $00, $00, $00, $00),
($00, $00, $00, $38, $38, $00, $00, $00, $00, $00, $00, $00, $00),
($00, $60, $60, $30, $30, $18, $18, $0c, $0c, $06, $06, $03, $03),
($00, $00, $3c, $66, $c3, $e3, $f3, $db, $cf, $c7, $c3, $66, $3c),
($00, $00, $7e, $18, $18, $18, $18, $18, $18, $18, $78, $38, $18),
($00, $00, $ff, $c0, $c0, $60, $30, $18, $0c, $06, $03, $e7, $7e),
($00, $00, $7e, $e7, $03, $03, $07, $7e, $07, $03, $03, $e7, $7e),
($00, $00, $0c, $0c, $0c, $0c, $0c, $ff, $cc, $6c, $3c, $1c, $0c),
($00, $00, $7e, $e7, $03, $03, $07, $fe, $c0, $c0, $c0, $c0, $ff),
($00, $00, $7e, $e7, $c3, $c3, $c7, $fe, $c0, $c0, $c0, $e7, $7e),
($00, $00, $30, $30, $30, $30, $18, $0c, $06, $03, $03, $03, $ff),
($00, $00, $7e, $e7, $c3, $c3, $e7, $7e, $e7, $c3, $c3, $e7, $7e),
($00, $00, $7e, $e7, $03, $03, $03, $7f, $e7, $c3, $c3, $e7, $7e),
($00, $00, $00, $38, $38, $00, $00, $38, $38, $00, $00, $00, $00),
($00, $00, $30, $18, $1c, $1c, $00, $00, $1c, $1c, $00, $00, $00),
($00, $00, $06, $0c, $18, $30, $60, $c0, $60, $30, $18, $0c, $06),
($00, $00, $00, $00, $ff, $ff, $00, $ff, $ff, $00, $00, $00, $00),
($00, $00, $60, $30, $18, $0c, $06, $03, $06, $0c, $18, $30, $60),
($00, $00, $18, $00, $00, $18, $18, $0c, $06, $03, $c3, $c3, $7e),
($00, $00, $3f, $60, $cf, $db, $d3, $dd, $c3, $7e, $00, $00, $00),
($00, $00, $c3, $c3, $c3, $c3, $ff, $c3, $c3, $c3, $66, $3c, $18),
($00, $00, $fe, $c7, $c3, $c3, $c7, $fe, $c7, $c3, $c3, $c7, $fe),
($00, $00, $7e, $e7, $c0, $c0, $c0, $c0, $c0, $c0, $c0, $e7, $7e),
($00, $00, $fc, $ce, $c7, $c3, $c3, $c3, $c3, $c3, $c7, $ce, $fc),
($00, $00, $ff, $c0, $c0, $c0, $c0, $fc, $c0, $c0, $c0, $c0, $ff),
($00, $00, $c0, $c0, $c0, $c0, $c0, $c0, $fc, $c0, $c0, $c0, $ff),
($00, $00, $7e, $e7, $c3, $c3, $cf, $c0, $c0, $c0, $c0, $e7, $7e),
($00, $00, $c3, $c3, $c3, $c3, $c3, $ff, $c3, $c3, $c3, $c3, $c3),
($00, $00, $7e, $18, $18, $18, $18, $18, $18, $18, $18, $18, $7e),
($00, $00, $7c, $ee, $c6, $06, $06, $06, $06, $06, $06, $06, $06),
($00, $00, $c3, $c6, $cc, $d8, $f0, $e0, $f0, $d8, $cc, $c6, $c3),
($00, $00, $ff, $c0, $c0, $c0, $c0, $c0, $c0, $c0, $c0, $c0, $c0),
($00, $00, $c3, $c3, $c3, $c3, $c3, $c3, $db, $ff, $ff, $e7, $c3),
($00, $00, $c7, $c7, $cf, $cf, $df, $db, $fb, $f3, $f3, $e3, $e3),
($00, $00, $7e, $e7, $c3, $c3, $c3, $c3, $c3, $c3, $c3, $e7, $7e),
($00, $00, $c0, $c0, $c0, $c0, $c0, $fe, $c7, $c3, $c3, $c7, $fe),
($00, $00, $3f, $6e, $df, $db, $c3, $c3, $c3, $c3, $c3, $66, $3c),
($00, $00, $c3, $c6, $cc, $d8, $f0, $fe, $c7, $c3, $c3, $c7, $fe),
($00, $00, $7e, $e7, $03, $03, $07, $7e, $e0, $c0, $c0, $e7, $7e),
($00, $00, $18, $18, $18, $18, $18, $18, $18, $18, $18, $18, $ff),
($00, $00, $7e, $e7, $c3, $c3, $c3, $c3, $c3, $c3, $c3, $c3, $c3),
($00, $00, $18, $3c, $3c, $66, $66, $c3, $c3, $c3, $c3, $c3, $c3),
($00, $00, $c3, $e7, $ff, $ff, $db, $db, $c3, $c3, $c3, $c3, $c3),
($00, $00, $c3, $66, $66, $3c, $3c, $18, $3c, $3c, $66, $66, $c3),
($00, $00, $18, $18, $18, $18, $18, $18, $3c, $3c, $66, $66, $c3),
($00, $00, $ff, $c0, $c0, $60, $30, $7e, $0c, $06, $03, $03, $ff),
($00, $00, $3c, $30, $30, $30, $30, $30, $30, $30, $30, $30, $3c),
($00, $03, $03, $06, $06, $0c, $0c, $18, $18, $30, $30, $60, $60),
($00, $00, $3c, $0c, $0c, $0c, $0c, $0c, $0c, $0c, $0c, $0c, $3c),
($00, $00, $00, $00, $00, $00, $00, $00, $00, $c3, $66, $3c, $18),
($ff, $ff, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00),
($00, $00, $00, $00, $00, $00, $00, $00, $00, $18, $38, $30, $70),
($00, $00, $7f, $c3, $c3, $7f, $03, $c3, $7e, $00, $00, $00, $00),
($00, $00, $fe, $c3, $c3, $c3, $c3, $fe, $c0, $c0, $c0, $c0, $c0),
($00, $00, $7e, $c3, $c0, $c0, $c0, $c3, $7e, $00, $00, $00, $00),
($00, $00, $7f, $c3, $c3, $c3, $c3, $7f, $03, $03, $03, $03, $03),
($00, $00, $7f, $c0, $c0, $fe, $c3, $c3, $7e, $00, $00, $00, $00),
($00, $00, $30, $30, $30, $30, $30, $fc, $30, $30, $30, $33, $1e),
($7e, $c3, $03, $03, $7f, $c3, $c3, $c3, $7e, $00, $00, $00, $00),
($00, $00, $c3, $c3, $c3, $c3, $c3, $c3, $fe, $c0, $c0, $c0, $c0),
($00, $00, $18, $18, $18, $18, $18, $18, $18, $00, $00, $18, $00),
($38, $6c, $0c, $0c, $0c, $0c, $0c, $0c, $0c, $00, $00, $0c, $00),
($00, $00, $c6, $cc, $f8, $f0, $d8, $cc, $c6, $c0, $c0, $c0, $c0),
($00, $00, $7e, $18, $18, $18, $18, $18, $18, $18, $18, $18, $78),
($00, $00, $db, $db, $db, $db, $db, $db, $fe, $00, $00, $00, $00),
($00, $00, $c6, $c6, $c6, $c6, $c6, $c6, $fc, $00, $00, $00, $00),
($00, $00, $7c, $c6, $c6, $c6, $c6, $c6, $7c, $00, $00, $00, $00),
($c0, $c0, $c0, $fe, $c3, $c3, $c3, $c3, $fe, $00, $00, $00, $00),
($03, $03, $03, $7f, $c3, $c3, $c3, $c3, $7f, $00, $00, $00, $00),
($00, $00, $c0, $c0, $c0, $c0, $c0, $e0, $fe, $00, $00, $00, $00),
($00, $00, $fe, $03, $03, $7e, $c0, $c0, $7f, $00, $00, $00, $00),
($00, $00, $1c, $36, $30, $30, $30, $30, $fc, $30, $30, $30, $00),
($00, $00, $7e, $c6, $c6, $c6, $c6, $c6, $c6, $00, $00, $00, $00),
($00, $00, $18, $3c, $3c, $66, $66, $c3, $c3, $00, $00, $00, $00),
($00, $00, $c3, $e7, $ff, $db, $c3, $c3, $c3, $00, $00, $00, $00),
($00, $00, $c3, $66, $3c, $18, $3c, $66, $c3, $00, $00, $00, $00),
($c0, $60, $60, $30, $18, $3c, $66, $66, $c3, $00, $00, $00, $00),
($00, $00, $ff, $60, $30, $18, $0c, $06, $ff, $00, $00, $00, $00),
($00, $00, $0f, $18, $18, $18, $38, $f0, $38, $18, $18, $18, $0f),
($18, $18, $18, $18, $18, $18, $18, $18, $18, $18, $18, $18, $18),
($00, $00, $f0, $18, $18, $18, $1c, $0f, $1c, $18, $18, $18, $f0),
($00, $00, $00, $00, $00, $00, $06, $8f, $f1, $60, $00, $00, $00));
posit : Array [0..3] of GLFloat = (12, 12, 12.5, 1);
ps2:array[0..3]of GLFloat= (12, 12, 12.5, 1);//(-12, 12, 12.5, 1);
ps3:array[0..3]of GLFloat=(12, -12, 12.5, 1);
ps4:array[0..3]of GLFloat=(-12,-12, 12.5, 1);
procedure makeRasterFont;
var
i : GLuint;
begin
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
fontOffset := glGenLists (128);
For i := 32 to 126 do begin
glNewList(i + fontOffset, GL_COMPILE);
glBitmap(8, 13, transX,-TransY, 10.0, 0.0, @rasters[i-32]);
glEndList;
end;
end;
procedure printString(s : String);
begin
glPushAttrib (GL_LIST_BIT);
glListBase(fontOffset);
glCallLists(length(s), GL_UNSIGNED_BYTE, PChar(s));
glPopAttrib;
end;
procedure TfmPostProcessor3.SetDCPixelFormat;
var
pfd : TPixelFormatDescriptor;
nPixelFormat : Integer;
begin
FillChar (pfd, SizeOf (pfd), 0);
pfd.dwFlags := PFD_DRAW_TO_WINDOW or PFD_SUPPORT_OPENGL or PFD_DOUBLEBUFFER;
nPixelFormat := ChoosePixelFormat(dc,@pfd);
SetPixelFormat (dc, nPixelFormat, @pfd);
end;
procedure TfmPostProcessor3.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
if pCanClose then
Action:=caFree
else
Action:=caMinimize;
end;
procedure TfmPostProcessor3.FormCreate(Sender: TObject);
begin
fmPreprocessor.Timer1.Enabled:=false;
DC := GetDC(Handle);
SetDCPixelFormat;
hrc := wglCreateContext(DC);
wglMakeCurrent(DC, hrc);
glClearColor (0.5, 0.5, 0.5, 1.0);
///////////////////////
glEnable(GL_DEPTH_TEST);
makeRasterFont;
end;
procedure TfmPostProcessor3.FormDestroy(Sender: TObject);
begin
wglMakeCurrent(0,0);
wglDeleteContext(hrc);
ReleaseDC(Handle, DC);
DeleteDC(DC);
if fmPreprocessor<>nil then fmPreprocessor.Timer1.Enabled:=true;
end;
procedure TfmPostProcessor3.Timer1Timer(Sender: TObject);
begin
InvalidateRect(Handle,nil,false);
end;
procedure TfmPostProcessor3.FormResize(Sender: TObject);
begin
InvalidateRect(Handle, nil, False);
end;
procedure TfmPostProcessor3.FormMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
Down:=true;
LastX:=X;
LastY:=Y;
btn:=Button;
end;
procedure TfmPostProcessor3.FormMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
if down then
begin
if btn=mbLeft then
begin
if angleX<360 then angleX:=angleX+360*(Y-LastY)/ClientHeight else angleX:=0;
if angleZ<360 then angleZ:=angleZ+360*(X-LastX)/ClientWidth else angleZ:=0;
LastX:=X;
LastY:=Y;
end
else
begin
transX:=transX+4*(X-LastX)/ClientWidth/pr_zoom;
transY:=transY+4*(Y-LastY)/ClientHeight/pr_zoom;
LastX:=X;
LastY:=Y;
end;
InvalidateRect(Handle,nil,false);
end
else
begin
// posit[0]:=-2+4*(X{-LastX})/ClientWidth;
// posit[1]:=2-4*(Y{-LastY})/ClientHeight;
LastX:=X;
LastY:=Y;
end;
end;
procedure TfmPostProcessor3.FormMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
Down:=false;
end;
procedure TfmPostProcessor3.FormPaint(Sender: TObject);
var i,j,k:int;
mgo:TMGObject;
blc:TBlock;
sec:TSector;
ttb:TTriBlock;
tts:TTRiSec;
im:int;
cl:TColor;
r,g,b:float;
v:TVector;
a,a_min,a_max,a_mod:float;
n1,n2:int;
mm,si,co:float;
procedure DrawAxProf(k:int);
begin
mm:=sqrt(sqr(crX[k])+sqr(crY[k]));
if mm<1e-30 then mm:=1;
si:=crY[k]/mm;
co:=crX[k]/mm;
a:=GetValue(k);
if v_Plane=0 then
glVertex3f(glX(crX[k])+0.1*pr_scale*a/a_mod*co,glX(crY[k])+0.1*pr_scale*a/a_mod*si,glX(crZ[k]))
else
glVertex3f(glX(crX[k])-0.1*pr_scale*a/a_mod*si,glX(crY[k])+0.1*pr_scale*a/a_mod*co,glX(crZ[k]));
end;
begin
wglMakeCurrent(DC, hrc);
glViewport(0, 0, ClientWidth, ClientHeight);
glMatrixMode (GL_PROJECTION);
glLoadIdentity;
glMatrixMode (GL_MODELVIEW);
glLoadIdentity;
glOrtho(-2, 2, -2, 2, -2, 50);
glEnable(GL_COLOR_MATERIAL);
glShadeModel(GL_smooth);
// shifting and rotation
glClear (GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glTranslatef(0.0, 0.0, -10.0);
// turn on/off the light
glScalef(pr_zoom,pr_zoom,pr_zoom);
glTranslatef(transX,-transY,0);
if bLight then
begin
glPOintSize(10);
glColor3f(0.0,1.0,0.0);
glBegin(GL_POINTS);
glVertex3f(posit[0],posit[1],posit[2]);
glEnd;
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
// glEnable(GL_LIGHT1);
// glEnable(GL_LIGHT2);
// glEnable(GL_LIGHT3);
glLightfv(GL_LIGHT0, GL_POSITION, @posit);
// glLightfv(GL_LIGHT1, GL_POSITION, @ps2);
// glLightfv(GL_LIGHT2, GL_POSITION, @ps3);
// glLightfv(GL_LIGHT3, GL_POSITION, @ps4);
end
else
begin
glDisable(GL_LIGHTING);
glDisable(GL_LIGHT0);
end;
glRotatef(angleX,1,0,0);
glRotatef(angleY,0,1,0);
glRotatef(angleZ,0,0,1);
/////////////
// wire objects
if bObject then
begin
for i:=0 to ob.Count-1 do
begin
mgo:=TMGObject(ob.Items[i]);
im:=mgo.GetMaterial;
cl:=mt.mmColor[im];
cl2gl(cl,r,g,b);
glColor3f(r,g,b);
if mgo is TBlock then
begin
blc:=TBlock(mgo);
oglWireBlock(blc);
end
else if mgo is TSector then
begin
sec:=TSector(mgo);
oglWireSector(sec);
end
else if mgo is TTriBlock then
begin
ttb:=TTriBlock(mgo);
oglWireTriBlock(ttb);
end
else if mgo is TTriSec then
begin
tts:=TTriSec(mgo);
oglWireTriSec(tts);
end;
end;
end;
/////////////
// solid objects
if bSolid then
begin
for i:=1 to NElements do
begin
if (ATopology[i][0]=mt.DefaultMaterial)and(not bAir) then continue;
im:=ATopology[i][0];
cl:=mt.mmColor[im];
cl2gl(cl,r,g,b);
glColor3f(r,g,b);
oglSolidTetrahedron(i);
end;
end;
/////////////
// mesh
if bMesh then
begin
glColor3f(0,0.75,0);
for i:=1 to NElements do
begin
if (ATopology[i][0]=mt.DefaultMaterial)and(not bAir) then continue;
oglWireTetrahedron(i);
end;
end;
/////////////
// axis
if bBound then
begin
glColor3f(0,0,0);
glBegin(GL_lines);
glVertex3f(0.0,0.0,0.0);
glVertex3f(1.1,0.0,0.0);
glVertex3f(0.0,0.0,0.0);
glVertex3f(0.0,1.1,0.0);
glVertex3f(0.0,0.0,0.0);
glVertex3f(0.0,0.0,1.1);
glEnd;
// axis names
glRasterPos3f(1.1,0,0);
printString('X');
glRasterPos3f(0,1.1,0);
printString('Y');
glRasterPos3f(0,0,1.1);
printString('Z');
// Bounds
glColor3f(0,0,0);
oglBound3D;
end;
///////////////
// fields
if v_Visualisation=1 then // map
begin
a_mod:=GetVecScale;
GetScalarScale(a_min,a_max);
if a_mod<1e-30 then a_mod:=1;
for i:=1 to nCubes do
begin
if GetVector(i,v) then
begin // vector
glLineWidth(1.0);
glColor3f (0.0, 0.0, 1.0);
glBegin(GL_LINES);
glVertex3f(glX(crX[i]),glX(crY[i]),glX(crZ[i]));
glVertex3f(glX(crX[i])-0.1*pr_scale*v.x/a_mod,glX(crY[i])-0.1*pr_scale*v.y/a_mod,glX(crZ[i])-0.1*pr_scale*v.z/a_mod);
glEnd;
end
else
begin
glPointSize(pr_scale*2);
if (a_max-a_min)>1e-30 then
cl:=RBColor((v.x-a_min)/(a_max-a_min))
else
cl:=RBColor((v.x-a_min));
cl2gl(cl,r,g,b);
glColor3f(r,g,b);
glBegin(GL_POINTS);
glVertex3f(glX(crX[i]),glX(crY[i]),glX(crZ[i]));
glEnd;
end;
end;
end;
if v_Visualisation=2 then // projection
begin
a_mod:=GetVecScale;
GetScalarScale(a_min,a_max);
if a_mod<1e-30 then a_mod:=1;
case v_Plane of
0:begin n1:=v_ny; n2:=v_nz; end;
1:begin n1:=v_nx; n2:=v_nz; end;
2:begin n1:=v_nx; n2:=v_ny; end;
end;
DrawPlane;
for i:=1 to n1 do
for j:=1 to n2 do
begin
Case v_plane of
0:k:=Num2Cube(v_ProfDist,i,j);
1:k:=Num2Cube(i,v_ProfDist,j);
2:k:=Num2Cube(i,j,v_ProfDist);
end;
if GetVector(k,v) then
begin // vector
glLineWidth(1.0);
glColor3f (0.0, 0.0, 1.0);
if axa.mesh_s=1 then // carthesian
begin
glBegin(GL_LINES);
glVertex3f(glX(crX[k]),glX(crY[k]),glX(crZ[k]));
Case v_Plane of
0:glVertex3f(glX(crX[k]),glX(crY[k])-0.1*pr_scale*v.y/a_mod,glX(crZ[k])-0.1*pr_scale*v.z/a_mod);
1:glVertex3f(glX(crX[k])-0.1*pr_scale*v.x/a_mod,glX(crY[k]),glX(crZ[k])-0.1*pr_scale*v.z/a_mod);
2:glVertex3f(glX(crX[k])-0.1*pr_scale*v.x/a_mod,glX(crY[k])-0.1*pr_scale*v.y/a_mod,glX(crZ[k]));
end;
glEnd;
end
else // cylindrical
begin
mm:=sqrt(sqr(crX[k])+sqr(crY[k]));
if mm<1e-30 then mm:=1;
si:=crY[k]/mm;
co:=crX[k]/mm;
glBegin(GL_LINES);
glVertex3f(glX(crX[k]),glX(crY[k]),glX(crZ[k]));
Case v_Plane of
0:glVertex3f(glX(crX[k])+0.1*pr_scale*v.ph/a_mod*si,glX(crY[k])-0.1*pr_scale*v.ph/a_mod*co,glX(crZ[k])-0.1*pr_scale*v.z/a_mod);
1:glVertex3f(glX(crX[k])-0.1*pr_scale*v.r/a_mod*co,glX(crY[k])-0.1*pr_scale*v.r/a_mod*si,glX(crZ[k])-0.1*pr_scale*v.z/a_mod);
2:glVertex3f(glX(crX[k])-0.1*pr_scale*v.x/a_mod,glX(crY[k])-0.1*pr_scale*v.y/a_mod,glX(crZ[k]));
end;
glEnd;
end;
end
else
begin
glPointSize(pr_scale*2);
if (a_max-a_min)>1e-30 then
cl:=RBColor((v.x-a_min)/(a_max-a_min))
else
cl:=RBColor((v.x-a_min));
cl2gl(cl,r,g,b);
glColor3f(r,g,b);
glBegin(GL_POINTS);
glVertex3f(glX(crX[k]),glX(crY[k]),glX(crZ[k]));
glEnd;
end;
end;
end;
if v_Visualisation=3 then // profile
begin
FillGraphVal;
a_mod:=GetVecScale;
GetScalarScale(a_min,a_max);
if a_mod<1e-30 then a_mod:=1;
case v_Plane of
0:begin n1:=v_ny; n2:=v_nz; end;
1:begin n1:=v_nx; n2:=v_nz; end;
2:begin n1:=v_nx; n2:=v_ny; end;
end;
DrawPlane;
glLineWidth(1.0);
for i:=1 to n1-1 do
for j:=1 to n2-1 do
begin
glColor3f (0.0, 0.0, 1.0);
if axa.mesh_s=1 then // carthesian
Case v_plane of
0:begin
glBegin(GL_QUADS);
k:=Num2Cube(v_ProfDist,i,j); a:=GetValue(k); glVertex3f(glX(crX[k])+0.1*pr_scale*a/a_mod,glX(crY[k]),glX(crZ[k]));
k:=Num2Cube(v_ProfDist,i+1,j); a:=GetValue(k); glVertex3f(glX(crX[k])+0.1*pr_scale*a/a_mod,glX(crY[k]),glX(crZ[k]));
k:=Num2Cube(v_ProfDist,i+1,j+1); a:=GetValue(k); glVertex3f(glX(crX[k])+0.1*pr_scale*a/a_mod,glX(crY[k]),glX(crZ[k]));
k:=Num2Cube(v_ProfDist,i,j+1); a:=GetValue(k); glVertex3f(glX(crX[k])+0.1*pr_scale*a/a_mod,glX(crY[k]),glX(crZ[k]));
glEnd;
end;
1:begin
glBegin(GL_QUADS);
k:=Num2Cube(i,v_ProfDist,j); a:=GetValue(k); glVertex3f(glX(crX[k]),glX(crY[k])+0.1*pr_scale*a/a_mod,glX(crZ[k]));
k:=Num2Cube(i+1,v_ProfDist,j); a:=GetValue(k); glVertex3f(glX(crX[k]),glX(crY[k])+0.1*pr_scale*a/a_mod,glX(crZ[k]));
k:=Num2Cube(i+1,v_ProfDist,j+1); a:=GetValue(k); glVertex3f(glX(crX[k]),glX(crY[k])+0.1*pr_scale*a/a_mod,glX(crZ[k]));
k:=Num2Cube(i,v_ProfDist,j+1); a:=GetValue(k); glVertex3f(glX(crX[k]),glX(crY[k])+0.1*pr_scale*a/a_mod,glX(crZ[k]));
glEnd;
end;
2:begin
glBegin(GL_QUADS);
k:=Num2Cube(i,j,v_ProfDist); a:=GetValue(k); glVertex3f(glX(crX[k]),glX(crY[k]),glX(crZ[k])+0.1*pr_scale*a/a_mod);
k:=Num2Cube(i+1,j,v_ProfDist); a:=GetValue(k); glVertex3f(glX(crX[k]),glX(crY[k]),glX(crZ[k])+0.1*pr_scale*a/a_mod);
k:=Num2Cube(i+1,j+1,v_ProfDist); a:=GetValue(k); glVertex3f(glX(crX[k]),glX(crY[k]),glX(crZ[k])+0.1*pr_scale*a/a_mod);
k:=Num2Cube(i,j+1,v_ProfDist); a:=GetValue(k); glVertex3f(glX(crX[k]),glX(crY[k]),glX(crZ[k])+0.1*pr_scale*a/a_mod);
glEnd;
end;
end
else // cylindrical
begin
Case v_plane of
0:begin
glBegin(GL_QUADS);
k:=Num2Cube(v_ProfDist,i,j); DrawAxProf(k);
k:=Num2Cube(v_ProfDist,i+1,j); DrawAxProf(k);
k:=Num2Cube(v_ProfDist,i+1,j+1); DrawAxProf(k);
k:=Num2Cube(v_ProfDist,i,j+1); DrawAxProf(k);
glEnd;
end;
1:begin
glBegin(GL_QUADS);
k:=Num2Cube(i,v_ProfDist,j); DrawAxProf(k);
k:=Num2Cube(i+1,v_ProfDist,j); DrawAxProf(k);
k:=Num2Cube(i+1,v_ProfDist,j+1); DrawAxProf(k);
k:=Num2Cube(i,v_ProfDist,j+1); DrawAxProf(k);
glEnd;
end;
2:begin
glBegin(GL_QUADS);
k:=Num2Cube(i,j,v_ProfDist); a:=GetValue(k); glVertex3f(glX(crX[k]),glX(crY[k]),glX(crZ[k])+0.1*pr_scale*a/a_mod);
k:=Num2Cube(i+1,j,v_ProfDist); a:=GetValue(k); glVertex3f(glX(crX[k]),glX(crY[k]),glX(crZ[k])+0.1*pr_scale*a/a_mod);
k:=Num2Cube(i+1,j+1,v_ProfDist); a:=GetValue(k); glVertex3f(glX(crX[k]),glX(crY[k]),glX(crZ[k])+0.1*pr_scale*a/a_mod);
k:=Num2Cube(i,j+1,v_ProfDist); a:=GetValue(k); glVertex3f(glX(crX[k]),glX(crY[k]),glX(crZ[k])+0.1*pr_scale*a/a_mod);
glEnd;
end;
end
end;
end;
glEnable(GL_POINT_SMOOTH);
glPointSize(5);
glColor3f(1.0,1.0,0.0);
glBegin(GL_POINTS);
for i:=1 to gr_Num do
begin
if axa.mesh_s=1 then // carthesian
Case v_plane of
0:begin if v_Dir=1 then k:=Num2Cube(v_ProfDist,i,v_GrapDist) else k:=Num2Cube(v_ProfDist,v_GrapDist,i); a:=GetValue(k); glVertex3f(glX(crX[k])+0.1*pr_scale*a/a_mod,glX(crY[k]),glX(crZ[k])); end;
1:begin if v_Dir=0 then k:=Num2Cube(i,v_ProfDist,v_GrapDist) else k:=Num2Cube(v_GrapDist,v_ProfDist,i); a:=GetValue(k); glVertex3f(glX(crX[k]),glX(crY[k])+0.1*pr_scale*a/a_mod,glX(crZ[k])); end;
2:begin if v_Dir=0 then k:=Num2Cube(i,v_GrapDist,v_ProfDist) else k:=Num2Cube(v_GrapDist,i,v_ProfDist); a:=GetValue(k); glVertex3f(glX(crX[k]),glX(crY[k]),glX(crZ[k])+0.1*pr_scale*a/a_mod); end;
end
else // cylindrical
Case v_plane of
0:begin if v_Dir=1 then k:=Num2Cube(v_ProfDist,i,v_GrapDist) else k:=Num2Cube(v_ProfDist,v_GrapDist,i); DrawAxProf(k); end;
1:begin if v_Dir=0 then k:=Num2Cube(i,v_ProfDist,v_GrapDist) else k:=Num2Cube(v_GrapDist,v_ProfDist,i); DrawAxProf(k); end;
2:begin if v_Dir=0 then k:=Num2Cube(i,v_GrapDist,v_ProfDist) else k:=Num2Cube(v_GrapDist,i,v_ProfDist); a:=GetValue(k); glVertex3f(glX(crX[k]),glX(crY[k]),glX(crZ[k])+0.1*pr_scale*a/a_mod); end;
end
end;
glEnd;
glDisable(GL_POINT_SMOOTH);
if (bGraphReDraw)and(fmVInspector3.cbx.Checked) then
begin
fmGraph3.LoadGraphic;
bGraphReDraw:=false;
end;
end;
if v_Visualisation=4 then // slices
begin
createTri;
end;
////////////////////////////
// Value vision
if bValue then
begin
k:=Num2Cube(vDir1,vDir2,vDir3);
glEnable(GL_POINT_SMOOTH);
glPointSize(10);
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_POINTS);
if axa.mesh_s=1 then // carthesian
glVertex3f(glX(crX[k]),glX(crY[k]),glX(crZ[k]))
else
glVertex3f(glX(crR[k]*cos(crFi[k])),glX(crR[k]*sin(crFi[k])),glX(crZ[k]));
glEnd;
glDisable(GL_POINT_SMOOTH);
end;
// restore previous settings
glScalef(1/pr_zoom,1/pr_zoom,1/pr_zoom);
glRotatef(angleX,-1,0,0);
glRotatef(angleY,0,-1,0);
glRotatef(angleZ,0,0,-1);
glTranslatef(-transX,transY,0);
glTranslatef(0.0, 0.0, 10.0);
glFlush();
SwapBuffers(DC);
end;
procedure TfmPostProcessor3.FormKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
Case Key of
VK_UP: posit[1]:=posit[1]+0.1;
VK_DOWN: posit[1]:=posit[1]-0.1;
VK_Left: posit[0]:=posit[0]-0.1;
VK_RIGHT:posit[0]:=posit[0]+0.1;
VK_F5: posit[2]:=posit[2]+0.1;
VK_F6: posit[2]:=posit[2]-0.1;
VK_F7: posit[3]:=posit[3]+0.1;
VK_F8: posit[3]:=posit[3]-0.1;
end;
Self.Caption:=FloatToStrF(posit[0],ffFixed,5,2)+':'+
FloatToStrF(posit[1],ffFixed,5,2)+':'+
FloatToStrF(posit[2],ffFixed,5,2)+':'+
FloatToStrF(posit[3],ffFixed,5,2);
end;
end.
| 37.053571 | 203 | 0.534739 |
fccfc1c88a8e8359eb6d4e6b2f9acaf758911943 | 4,122 | pas | Pascal | src/bodymovin.Struct.pas | snakeice/lottie-player | 7083fc29c55a6ab70a421c55c396f79f1001a148 | [
"MIT"
]
| 1 | 2019-09-06T13:38:15.000Z | 2019-09-06T13:38:15.000Z | src/bodymovin.Struct.pas | snakeice/lottie-player | 7083fc29c55a6ab70a421c55c396f79f1001a148 | [
"MIT"
]
| null | null | null | src/bodymovin.Struct.pas | snakeice/lottie-player | 7083fc29c55a6ab70a421c55c396f79f1001a148 | [
"MIT"
]
| 1 | 2019-09-06T13:38:17.000Z | 2019-09-06T13:38:17.000Z | unit bodymovin.Struct;
interface
uses
System.Generics.Collections, System.JSON;
type
ILayer = Interface
end;
IAsset = Interface
end;
IShape = interface
end;
TCharacterShape = class
FShape: IShape;
end;
TChars = class
private
// Character
FCharacter: Char;
// Font family
FFontFamily: string;
// Font size
FSize: Extended;
// Font Style
FStyle: string;
// Width
FWidth: Extended;
// Character Properties
FData: TArray<TCharacterShape>;
public
function ToString: string; override;
property Ch: Char read FCharacter write FCharacter;
property fFamily: string read FFontFamily write FFontFamily;
property size: Extended read FSize write FSize;
property style: string read FStyle write FStyle;
property w: Extended read FWidth write FWidth;
property &property: TArray<TCharacterShape> read FData write FData;
constructor Create(AData: TJSONObject);
end;
TAnimationData = class
// In Point of the Time Ruler. Sets the initial Frame of the animation.
FInPoint,
// Out Point of the Time Ruler. Sets the final Frame of the animation
FOutPoint,
// Frame rate
FFrameRate,
// Composition Width
FWidth,
// Composition Height
FHeight: Extended;
// Bodymovin Version
FVersion: string;
Flayers: array of ILayer;
FAssets: array of IAsset;
FChars: TArray<TChars>;
private
procedure ParseChars(AChars: TJSONArray);
published
function ToString: string; override;
property ip: Extended read FInPoint write FInPoint;
property op: Extended read FOutPoint write FOutPoint;
property fr: Extended read FFrameRate write FFrameRate;
property w: Extended read FWidth write FWidth;
property h: Extended read FHeight write FHeight;
property v: string read FVersion write FVersion;
property chars: TArray<TChars> read FChars write FChars;
constructor Create(AData: string);
end;
implementation
uses
System.Sysutils;
{ TAnimationData }
constructor TAnimationData.Create(AData: string);
var
LDataJson: TJSONObject;
LTmpArray: TJSONArray;
begin
LDataJson := TJSONObject.ParseJSONValue(AData) as TJSONObject;
try
LDataJson.TryGetValue<Extended>('ip', FInPoint);
LDataJson.TryGetValue<Extended>('op', FOutPoint);
LDataJson.TryGetValue<Extended>('fr', FFrameRate);
LDataJson.TryGetValue<Extended>('w', FWidth);
LDataJson.TryGetValue<Extended>('h', FHeight);
LDataJson.TryGetValue<string>('v', FVersion);
if LDataJson.TryGetValue<TJSONArray>('chars', LTmpArray) then
ParseChars(LTmpArray);
finally
LDataJson.DisposeOf;
end;
end;
procedure TAnimationData.ParseChars(AChars: TJSONArray);
var
LIndex: Integer;
begin
SetLength(FChars, AChars.Count);
for LIndex := 0 to AChars.Count - 1 do
chars[LIndex] := TChars.Create(AChars.Items[LIndex] as TJSONObject);
end;
function TAnimationData.ToString: string;
var
LChar: TChars;
begin
Result :=
'In Point: ' + FInPoint.ToString + sLineBreak +
'Out Point: ' + FOutPoint.ToString + sLineBreak +
'Frame rate: ' + FFrameRate.ToString + sLineBreak +
'Composition Width: ' + FWidth.ToString + sLineBreak +
'Composition Height: ' + FHeight.ToString + sLineBreak +
'Bodymovin Version: ' + FVersion + sLineBreak +
'Chars: [';
for LChar in FChars do
begin
Result := Result + sLineBreak + '{ ' + sLineBreak + LChar.ToString + sLineBreak + '},';
end;
Result := Result + ']';
end;
{ TChars }
constructor TChars.Create(AData: TJSONObject);
begin
AData.TryGetValue<Char>('ch', FCharacter);
AData.TryGetValue<string>('fFamily', FFontFamily);
AData.TryGetValue<Extended>('size', FSize);
AData.TryGetValue<string>('style', FStyle);
AData.TryGetValue<Extended>('w', FWidth);
end;
function TChars.ToString: string;
begin
Result :=
' Character: "' + FCharacter + '"' + sLineBreak +
' Font family: ' + FFontFamily + sLineBreak +
' Font size: ' + FSize.ToString + sLineBreak +
' Font Style: ' + FStyle +
' Width: ' + FWidth.ToString;
end;
end.
| 25.134146 | 93 | 0.692625 |
f1da6d0fc8caa27eb4116f3424ff994670285303 | 1,182 | pas | Pascal | Source/FindUnit.StringPositionList.pas | Slipinir/RFindUnit | fda073d0b8efe4ec482bf2b8af9772e275699741 | [
"MIT"
]
| 80 | 2016-01-27T19:28:36.000Z | 2021-10-04T18:47:46.000Z | Source/FindUnit.StringPositionList.pas | Slipinir/RFindUnit | fda073d0b8efe4ec482bf2b8af9772e275699741 | [
"MIT"
]
| 68 | 2016-01-24T14:24:09.000Z | 2020-12-18T10:42:42.000Z | Source/FindUnit.StringPositionList.pas | Slipinir/RFindUnit | fda073d0b8efe4ec482bf2b8af9772e275699741 | [
"MIT"
]
| 37 | 2016-02-17T05:25:24.000Z | 2021-11-24T17:00:32.000Z | unit FindUnit.StringPositionList;
interface
uses
System.Classes,
FindUnit.Header,
System.Generics.Collections,
System.SysUtils;
type
TStringPositionList = class(TList<TStringPosition>)
private
FDuplicates: TDuplicates;
function IsDuplicated(Item: TStringPosition): Boolean;
public
function Add(const Value: TStringPosition): Integer;
property Duplicates: TDuplicates read FDuplicates write FDuplicates;
end;
implementation
{ TStringPositionList }
function TStringPositionList.Add(const Value: TStringPosition): Integer;
begin
Result := 0;
case Duplicates of
dupIgnore:
begin
if not IsDuplicated(Value) then
Result := inherited Add(Value);
end;
dupAccept: Result := inherited Add(Value);
dupError:
begin
if IsDuplicated(Value) then
raise Exception.Create('Duplicated item');
Result := inherited Add(Value);
end;
end;
end;
function TStringPositionList.IsDuplicated(Item: TStringPosition): Boolean;
var
I: Integer;
begin
Result := False;
for I := 0 to Count -1 do
if Item.Value = Items[i].Value then
begin
Result := True;
Exit;
end;
end;
end.
| 19.064516 | 74 | 0.700508 |
858c53a3126e77fa9c0a04f137da3dcb513cff37 | 2,740 | pas | Pascal | Source/uContentConfiguration.pas | SenorTacoo/FibbageXLCustomQuestionsEditor | 9fbf3982e4f3faaaf2779c6a47c79333f6570e83 | [
"MIT"
]
| 1 | 2022-01-10T22:12:29.000Z | 2022-01-10T22:12:29.000Z | Source/uContentConfiguration.pas | SenorTacoo/FibbageXLCustomQuestionsEditor | 9fbf3982e4f3faaaf2779c6a47c79333f6570e83 | [
"MIT"
]
| 1 | 2022-01-22T00:32:11.000Z | 2022-03-27T08:45:16.000Z | Source/uContentConfiguration.pas | SenorTacoo/FibbageXLCustomQuestionsEditor | 9fbf3982e4f3faaaf2779c6a47c79333f6570e83 | [
"MIT"
]
| null | null | null | unit uContentConfiguration;
interface
uses
uInterfaces,
System.IOUtils,
System.StrUtils,
System.SysUtils,
System.Classes;
type
TContentConfiguration = class(TInterfacedObject, IContentConfiguration)
private
FRawCfg: TStringList;
public
constructor Create;
destructor Destroy; override;
procedure SetName(const AName: string);
procedure SetPath(const APath: string);
procedure SetShowCategoryDuplicated(AValue: Boolean);
procedure SetShowTooFewSuggestions(AValue: Boolean);
function GetName: string;
function GetPath: string;
function GetShowCategoryDuplicated: Boolean;
function GetShowTooFewSuggestions: Boolean;
function Initialize(const APath: string): Boolean;
procedure Save(const APath: string); overload;
procedure Save; overload;
end;
implementation
{ TContentConfiguration }
constructor TContentConfiguration.Create;
begin
inherited;
FRawCfg := TStringList.Create;
FRawCfg.StrictDelimiter := True;
end;
destructor TContentConfiguration.Destroy;
begin
FRawCfg.Free;
inherited;
end;
function TContentConfiguration.GetName: string;
begin
Result := FRawCfg.Values['ProjectName'];
if Result.IsEmpty then
Result := GetPath;
end;
function TContentConfiguration.GetPath: string;
begin
Result := FRawCfg.Values['ProjectPath'];
end;
function TContentConfiguration.GetShowCategoryDuplicated: Boolean;
begin
Result := StrToBoolDef(FRawCfg.Values['ShowCategoryDuplicated'], True);
end;
function TContentConfiguration.GetShowTooFewSuggestions: Boolean;
begin
Result := StrToBoolDef(FRawCfg.Values['ShowTooFewSuggestions'], True);
end;
function TContentConfiguration.Initialize(const APath: string): Boolean;
begin
Result := False;
if FileExists(TPath.Combine(APath, '.fcqeinfo')) then
begin
Result := True;
FRawCfg.LoadFromFile(TPath.Combine(APath, '.fcqeinfo'));
end;
SetPath(APath);
end;
procedure TContentConfiguration.Save(const APath: string);
begin
if GetPath <> APath then
SetPath(APath);
ForceDirectories(APath);
FRawCfg.SaveToFile(TPath.Combine(APath, '.fcqeinfo'));
end;
procedure TContentConfiguration.Save;
begin
Save(GetPath);
end;
procedure TContentConfiguration.SetName(const AName: string);
begin
FRawCfg.Values['ProjectName'] := AName;
end;
procedure TContentConfiguration.SetPath(const APath: string);
begin
FRawCfg.Values['ProjectPath'] := APath;
end;
procedure TContentConfiguration.SetShowCategoryDuplicated(AValue: Boolean);
begin
FRawCfg.Values['ShowCategoryDuplicated'] := BoolToStr(AValue, True);
end;
procedure TContentConfiguration.SetShowTooFewSuggestions(AValue: Boolean);
begin
FRawCfg.Values['ShowTooFewSuggestions'] := BoolToStr(AValue, True);
end;
end.
| 23.02521 | 75 | 0.771168 |
fcb6afddad57d466ac3ff22994b5445534d9f628 | 1,693 | pas | Pascal | itools/kspmessages.pas | Tallefer/kspnew | 57c69ac319c19e61ceb23e5a02759b98c9e4f8cd | [
"BSD-3-Clause"
]
| 1 | 2018-10-06T02:12:58.000Z | 2018-10-06T02:12:58.000Z | itools/kspmessages.pas | Tallefer/kspnew | 57c69ac319c19e61ceb23e5a02759b98c9e4f8cd | [
"BSD-3-Clause"
]
| null | null | null | itools/kspmessages.pas | Tallefer/kspnew | 57c69ac319c19e61ceb23e5a02759b98c9e4f8cd | [
"BSD-3-Clause"
]
| 1 | 2018-10-06T02:13:13.000Z | 2018-10-06T02:13:13.000Z | {
--------------------------------------------------------------------
Copyright (c) 2009 KSP Developers Team
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
}
unit KSPMessages;
{$MODE Delphi}
interface
uses Classes, SysUtils;
type
TPathChar = array[0..MAX_PATH] of char;
type
TFileRenamed = record
Old: TPathChar;
New: TPathChar;
end;
implementation
end.
| 33.86 | 73 | 0.756645 |
fc1ea2de0fa2ef30e974d9feddd7c0135e44a402 | 1,625 | pas | Pascal | Functions + Other Stuff/Algo/Classroom Exercices/JeanLucMohammedExam.pas | Jev1337/CS-Studies | c9a67f2946b519e99c1012a59095d9d5063f9aac | [
"Apache-2.0"
]
| 1 | 2021-04-28T15:02:53.000Z | 2021-04-28T15:02:53.000Z | Functions + Other Stuff/Algo/Classroom Exercices/JeanLucMohammedExam.pas | Jev1337/Pascal-Studies | c9a67f2946b519e99c1012a59095d9d5063f9aac | [
"Apache-2.0"
]
| 1 | 2021-05-23T12:04:28.000Z | 2021-05-23T17:28:03.000Z | Functions + Other Stuff/Algo/Classroom Exercices/JeanLucMohammedExam.pas | Jev1337/Pascal-Studies | c9a67f2946b519e99c1012a59095d9d5063f9aac | [
"Apache-2.0"
]
| null | null | null | Program JeanLucMomo;
Uses Wincrt;
Type
mat = Array[1..225,1..225] Of Char;
Var
N: Integer;
M: mat;
F: Text;
Function verif(ch:String): Boolean;
Var
test: Boolean;
i: Integer;
Begin
i := 0;
Repeat
i := i+1;
test := Upcase(ch[i]) In ['A'..'Z','0'..'9'];
Until (test = False) Or (i=Length(ch)) ;
verif := test;
End;
Procedure Transfert(Var res:String;N:Integer;m:mat);
Var
i,j: Integer;
Begin
For i:= 1 To n Do
res := res+M[i,i];
For i:= 2 To n Do
For j:= 1 To i-1 Do
res := res+M[i,j];
For i:= 1 To n-1 Do
For j:=i+1 To n Do
res := res+M[i,j];
End;
Function Tri(ch:String): String;
Var
permut: Boolean;
i: Integer;
aux: Char;
Begin
Repeat
permut := False;
For i:= 1 To Length(ch)-1 Do
If ch[i] > ch[i+1] Then
Begin
aux := ch[i];
ch[i] := ch[i+1];
ch[i+1] := aux;
permut := True;
End;
Until permut=False;
tri := ch;
End;
Procedure Remplir(Var M:mat; Var N:Integer; Var f:Text);
Var
i,j: Integer;
ch,res: String;
Begin
Rewrite(f);
Repeat
Writeln('Veuillez Saisir N agences: ');
Readln(n);
Until (n In [3..15])
Repeat
Writeln('Veuillez Saisir le mot de passe: ');
Readln(ch);
Until verif(ch) And (Length(ch) <= n*n);
While Length(ch) <> n*n Do
ch := ch+ Chr(Random(26)+Ord('A'));
For i:= 1 To n Do
For j:= 1 To n Do
Begin
M[i,j] := ch[1];
Delete(ch,1,1);
End;
res := '';
Transfert(Res,N,M);
i := 0;
Repeat
Writeln(f,tri(Copy(res,1,n)));
Delete(res,1,n);
Until res='';
Close(f);
End;
Begin
Assign(F,'Mots.txt');
Remplir(M,N,F);
End.
| 18.055556 | 56 | 0.552 |
c30531238da6be3daae0685d6bf9969a6db8864f | 1,692 | dfm | Pascal | Scripts/Delphiscript Scripts/SCH/UpdateFootprintLocations/UpdateFootprintPathsOfComps.dfm | spoilsport/Yazgac-Libraries | 276edeca757c524f7b6c04495d07bd41f6a2f691 | [
"MIT"
]
| null | null | null | Scripts/Delphiscript Scripts/SCH/UpdateFootprintLocations/UpdateFootprintPathsOfComps.dfm | spoilsport/Yazgac-Libraries | 276edeca757c524f7b6c04495d07bd41f6a2f691 | [
"MIT"
]
| null | null | null | Scripts/Delphiscript Scripts/SCH/UpdateFootprintLocations/UpdateFootprintPathsOfComps.dfm | spoilsport/Yazgac-Libraries | 276edeca757c524f7b6c04495d07bd41f6a2f691 | [
"MIT"
]
| null | null | null | object Form_UpdatePath: TForm_UpdatePath
Left = 24
Top = 14
BorderStyle = bsDialog
Caption = 'Update PCB Model Paths...'
ClientHeight = 199
ClientWidth = 367
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Microsoft Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poOwnerFormCenter
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 11
Top = 12
Width = 120
Height = 13
Caption = 'Choose a Footprint Name'
end
object Bevel1: TBevel
Left = 8
Top = 160
Width = 352
Height = 2
end
object Label2: TLabel
Left = 192
Top = 16
Width = 134
Height = 13
Caption = 'Footprint with different Paths'
end
object lFootPrintLocation: TLabel
Left = 192
Top = 136
Width = 53
Height = 13
Caption = 'New Path: '
end
object XPBitBtnOK: TXPBitBtn
Left = 205
Top = 168
Width = 75
Height = 25
Caption = 'OK'
TabOrder = 0
OnClick = XPBitBtnOKClick
end
object XPBitBtnCancel: TXPBitBtn
Left = 284
Top = 168
Width = 75
Height = 25
Caption = 'Cancel'
TabOrder = 1
OnClick = XPBitBtnCancelClick
end
object ComboBox_FootprintNames: TComboBox
Left = 8
Top = 32
Width = 145
Height = 21
ItemHeight = 13
TabOrder = 2
OnClick = ComboBox_FootprintNamesClick
end
object ListBox_DiffPaths: TListBox
Left = 192
Top = 32
Width = 160
Height = 97
ItemHeight = 13
TabOrder = 3
OnClick = ListBox_DiffPathsClick
end
end
| 20.634146 | 47 | 0.60461 |
47d93a948bd35c7e0f004dc3c2db08730c8d42bd | 5,880 | pas | Pascal | iscbase/database/parsesql/ZSqLiteToken.pas | isyscore/isc-fpbase | ce2469c977eba901005982dc7f89fee2d0718f76 | [
"MIT"
]
| 3 | 2021-06-10T12:33:29.000Z | 2021-12-13T06:59:48.000Z | iscbase/database/parsesql/ZSqLiteToken.pas | isyscore/isc-fpbase | ce2469c977eba901005982dc7f89fee2d0718f76 | [
"MIT"
]
| null | null | null | iscbase/database/parsesql/ZSqLiteToken.pas | isyscore/isc-fpbase | ce2469c977eba901005982dc7f89fee2d0718f76 | [
"MIT"
]
| null | null | null | {*********************************************************}
{ }
{ Zeos Database Objects }
{ String tokenizing classes for SQLite }
{ }
{ Originally written by Sergey Seroukhov }
{ }
{*********************************************************}
{@********************************************************}
{ Copyright (c) 1999-2020 Zeos Development Group }
{ }
{ License Agreement: }
{ }
{ This library is distributed in the hope that it will be }
{ useful, but WITHOUT ANY WARRANTY; without even the }
{ implied warranty of MERCHANTABILITY or FITNESS FOR }
{ A PARTICULAR PURPOSE. See the GNU Lesser General }
{ Public License for more details. }
{ }
{ The source code of the ZEOS Libraries and packages are }
{ distributed under the Library GNU General Public }
{ License (see the file COPYING / COPYING.ZEOS) }
{ with the following modification: }
{ As a special exception, the copyright holders of this }
{ library give you permission to link this library with }
{ independent modules to produce an executable, }
{ regardless of the license terms of these independent }
{ modules, and to copy and distribute the resulting }
{ executable under terms of your choice, provided that }
{ you also meet, for each linked independent module, }
{ the terms and conditions of the license of that module. }
{ An independent module is a module which is not derived }
{ from or based on this library. If you modify this }
{ library, you may extend this exception to your version }
{ of the library, but you are not obligated to do so. }
{ If you do not wish to do so, delete this exception }
{ statement from your version. }
{ }
{ }
{ The project web site is located on: }
{ https://zeoslib.sourceforge.io/ (FORUM) }
{ http://sourceforge.net/p/zeoslib/tickets/ (BUGTRACKER)}
{ svn://svn.code.sf.net/p/zeoslib/code-0/trunk (SVN) }
{ }
{ http://www.sourceforge.net/projects/zeoslib. }
{ }
{ }
{ Zeos Development Group. }
{********************************************************@}
unit ZSqLiteToken;
interface
{$I ZParseSql.inc}
{$IFNDEF ZEOS_DISABLE_SQLITE}
uses
Classes, {$IFDEF MSEgui}mclasses,{$ENDIF}
ZTokenizer, ZGenericSqlToken;
type
{** Implements a SQLite-specific number state object. }
TZSQLiteNumberState = TZGenericSQLNoHexNumberState;
{** Implements a SQLite-specific quote string state object. }
TZSQLiteQuoteState = TZGenericSQLBracketQuoteState;
{**
This state will either delegate to a comment-handling
state, or return a token with just a slash in it.
}
TZSQLiteCommentState = TZGenericSQLCommentState;
{** Implements a symbol state object. }
TZSQLiteSymbolState = class (TZSymbolState)
public
constructor Create;
end;
{** Implements a word state object. }
TZSQLiteWordState = class (TZGenericSQLWordState)
public
constructor Create;
end;
{** Implements a default tokenizer object. }
TZSQLiteTokenizer = class (TZTokenizer)
protected
procedure CreateTokenStates; override;
end;
{$ENDIF ZEOS_DISABLE_SQLITE}
implementation
{$IFNDEF ZEOS_DISABLE_SQLITE}
{$IFDEF FAST_MOVE}uses ZFastCode;{$ENDIF}
{ TZSQLiteSymbolState }
{**
Creates this SQLite-specific symbol state object.
}
constructor TZSQLiteSymbolState.Create;
begin
inherited Create;
Add('<=');
Add('>=');
Add('<>');
Add('!=');
Add('==');
Add('<<');
Add('>>');
Add('||');
end;
{ TZSQLiteWordState }
{**
Constructs this SQLite-specific word state object.
}
constructor TZSQLiteWordState.Create;
begin
SetWordChars(#0, #255, False);
SetWordChars('a', 'z', True);
SetWordChars('A', 'Z', True);
SetWordChars('0', '9', True);
SetWordChars('_', '_', True);
end;
{ TZSQLiteTokenizer }
{**
Constructs a tokenizer with a default state table (as
described in the class comment).
}
procedure TZSQLiteTokenizer.CreateTokenStates;
begin
WhitespaceState := TZWhitespaceState.Create;
SymbolState := TZSQLiteSymbolState.Create;
NumberState := TZSQLiteNumberState.Create;
QuoteState := TZSQLiteQuoteState.Create;
WordState := TZSQLiteWordState.Create;
CommentState := TZSQLiteCommentState.Create;
SetCharacterState(#0, #32, WhitespaceState);
SetCharacterState(#33, #191, SymbolState);
SetCharacterState(#192, High(Char), WordState);
SetCharacterState('a', 'z', WordState);
SetCharacterState('A', 'Z', WordState);
SetCharacterState('_', '_', WordState);
SetCharacterState('0', '9', NumberState);
SetCharacterState('.', '.', NumberState);
SetCharacterState('"', '"', QuoteState);
SetCharacterState(#39, #39, QuoteState);
SetCharacterState('[', '[', QuoteState);
SetCharacterState(']', ']', QuoteState);
SetCharacterState('/', '/', CommentState);
SetCharacterState('-', '-', CommentState);
end;
{$ENDIF ZEOS_DISABLE_SQLITE}
end.
| 33.988439 | 64 | 0.547449 |
fcfaa4f92591b3c8b313aaee2aa2c2eea40fe850 | 6,918 | dfm | Pascal | Client/fTreeNodeFieldEditFrame.dfm | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| null | null | null | Client/fTreeNodeFieldEditFrame.dfm | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| null | null | null | Client/fTreeNodeFieldEditFrame.dfm | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| 3 | 2021-06-30T10:11:17.000Z | 2021-07-01T09:13:29.000Z | inherited TreeNodeFieldEditFrame: TTreeNodeFieldEditFrame
Width = 417
Height = 49
HorzScrollBar.Visible = False
VertScrollBar.Visible = False
Constraints.MaxHeight = 49
object gbTreeNode: TGroupBox [0]
Left = 0
Top = 0
Width = 417
Height = 49
Align = alClient
Caption = ' Node '
TabOrder = 0
DesignSize = (
417
49)
object pnlTreeNode: TPanel
Left = 8
Top = 16
Width = 401
Height = 22
Anchors = [akLeft, akTop, akRight]
BevelOuter = bvNone
Constraints.MaxHeight = 22
Constraints.MinHeight = 22
TabOrder = 0
object pnlTreeNodeName: TPanel
Left = 0
Top = 0
Width = 254
Height = 22
Align = alClient
Anchors = []
BevelOuter = bvNone
TabOrder = 0
DesignSize = (
254
22)
object edtTreeNodeName: TDBEdit
Left = 0
Top = 0
Width = 253
Height = 21
Anchors = [akLeft, akTop, akRight, akBottom]
DataField = 'NODE_NAME'
DataSource = dsTreeNode
ReadOnly = True
TabOrder = 0
end
end
object pnlTreeNodeNo: TPanel
Left = 254
Top = 0
Width = 111
Height = 22
Align = alRight
BevelOuter = bvNone
TabOrder = 1
DesignSize = (
111
22)
object edtTreeNodeNo: TJvDBComboEdit
Left = 0
Top = 0
Width = 111
Height = 21
BeepOnError = False
DataField = 'NODE_NO'
DataSource = dsTreeNode
ButtonWidth = 37
Anchors = [akLeft, akTop, akRight, akBottom]
Constraints.MaxHeight = 21
Constraints.MinHeight = 21
TabOrder = 0
OnChange = edtTreeNodeNoChange
end
object pnlEditButtons: TPanel
Left = 71
Top = 2
Width = 38
Height = 18
Anchors = [akTop, akRight, akBottom]
BevelOuter = bvNone
ParentShowHint = False
ShowHint = True
TabOrder = 1
object btnInvokeTreeEditor: TSpeedButton
Left = 1
Top = 0
Width = 18
Height = 18
Action = actInvokeTreeEditor
Glyph.Data = {
4E000000424D4E000000000000003E000000280000000C000000040000000100
010000000000100000000000000000000000020000000200000000000000FFFF
FF00FFF0000039C0000039C00000FFF00000}
end
object btnClearFieldValues: TSpeedButton
Left = 20
Top = 0
Width = 18
Height = 18
Action = actClearFieldValues
Glyph.Data = {
9E020000424D9E0200000000000036000000280000000E0000000E0000000100
1800000000006802000000000000000000000000000000000000FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00
FFFF00FF0000000000FF00FFFF00FFFF00FF000000FF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FF0000000000000000FF00FFFF00FF0000
00000000FF00FF000000000000FF00FFFF00FFFF00FFFF00FFFF00FF0000FF00
FF000000000000FF00FF000000FF00FF000000000084000084000000FF00FFFF
00FFFF00FFFF00FF0000FF00FFFF00FFFF00FF000000FF00FF0000000000FF00
00FF0000FF000084000000FF00FFFF00FFFF00FF0000000000000000FF00FFFF
00FFFF00FF0000000000FF0000FF0000FF0000FF000084000000FF00FFFF00FF
0000000000000000FF00FF000000FF00FFFF00FF0000000000FF0000FF0000FF
000000008484000000FF00FF0000FF00FF000000000000FF00FF000000FF00FF
FF00FF0000000000FF00000000FFFF0000000084840000000000FF00FFFF00FF
FF00FFFF00FFFF00FFFF00FFFF00FFFF00FF00000000FFFF00000000FFFF0000
000084840000FF00FFFF00FFFF00FF000000FF00FFFF00FFFF00FFFF00FFFF00
FF00000000FFFF00000000FFFF0084840000FF00FFFF00FFFF00FFFF00FFFF00
FFFF00FFFF00FFFF00FFFF00FFFF00FF00000000FFFF00FFFF00FFFF0000FF00
FFFF00FF000000FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF00
000000FFFF00FFFF0000FF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FF00000000FFFF0000FF00FFFF00FFFF00FFFF
00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FFFF00FF
0000}
end
end
end
object pnlRightButtons: TPanel
Left = 365
Top = 0
Width = 36
Height = 22
Align = alRight
AutoSize = True
BevelOuter = bvNone
ParentShowHint = False
ShowHint = True
TabOrder = 2
object tlbDocButton: TToolBar
Left = 0
Top = 0
Width = 36
Height = 22
Align = alRight
AutoSize = True
ButtonWidth = 36
EdgeInner = esNone
Images = dmMain.ilDocs
TabOrder = 0
object btnDocumentation: TToolButton
Left = 0
Top = 0
Action = actTreeNodeDoc
end
end
end
end
end
inherited alActions: TActionList
Left = 80
Top = 8
inherited actClearFieldValues: TAction
ImageIndex = 102
end
object actInvokeTreeEditor: TAction
ImageIndex = 101
OnExecute = actInvokeTreeEditorExecute
OnUpdate = actInvokeTreeEditorUpdate
end
object actTreeNodeDoc: TAction
OnExecute = actTreeNodeDocExecute
OnUpdate = actTreeNodeDocUpdate
end
end
inherited dsData: TDataSource
Left = 112
Top = 8
end
object cdsTreeNode: TAbmesClientDataSet
Aggregates = <>
Params = <>
Left = 168
object cdsTreeNodeNODE_CODE: TAbmesFloatField
FieldName = 'NODE_CODE'
OnChange = cdsTreeNodeNODE_CODEChange
end
object cdsTreeNodeNODE_NAME: TAbmesWideStringField
FieldName = 'NODE_NAME'
OnChange = cdsTreeNodeNODE_NAMEChange
OnGetText = cdsTreeNodeNODE_NAMEGetText
Size = 100
end
object cdsTreeNodeNODE_NO: TAbmesWideStringField
FieldName = 'NODE_NO'
OnChange = cdsTreeNodeNODE_NOChange
Size = 50
end
object cdsTreeNodeDOC_BRANCH_CODE: TAbmesFloatField
FieldName = 'DOC_BRANCH_CODE'
end
object cdsTreeNodeDOC_CODE: TAbmesFloatField
FieldName = 'DOC_CODE'
end
object cdsTreeNodeHAS_DOCUMENTATION: TAbmesFloatField
FieldName = 'HAS_DOCUMENTATION'
FieldValueType = fvtBoolean
end
end
object dsTreeNode: TDataSource
DataSet = cdsTreeNode
Left = 200
end
end
| 31.880184 | 79 | 0.609714 |
fc78ad6cc2d9616047b83a1d011f303ce8bb88e9 | 1,308 | dfm | Pascal | Demos/DB/DBClient/udmMain.dfm | megatkurniawan/NetCom7 | 052027c74f8e5aee9e936125931b1510b5739b25 | [
"MIT"
]
| 139 | 2020-04-13T10:05:09.000Z | 2022-03-16T00:35:50.000Z | Demos/DB/DBClient/udmMain.dfm | mrandreastoth/NetCom7 | 1bb22d8e8f66ca6fd7b70925024525f845a8899d | [
"MIT"
]
| 22 | 2020-04-15T03:17:53.000Z | 2022-02-09T13:08:31.000Z | Demos/DB/DBClient/udmMain.dfm | mrandreastoth/NetCom7 | 1bb22d8e8f66ca6fd7b70925024525f845a8899d | [
"MIT"
]
| 34 | 2020-04-13T11:26:35.000Z | 2022-01-26T04:23:44.000Z | object dmMain: TdmMain
OldCreateOrder = False
OnCreate = DataModuleCreate
Height = 351
Width = 376
object ncClientSource: TncClientSource
Port = 18753
EncryptionKey = 'SetEncryptionKey'
Host = 'localhost'
Left = 56
Top = 36
end
object ncDBDataset1: TncDBDataset
CursorType = ctStatic
LockType = ltBatchOptimistic
Source = ncClientSource
PeerCommandHandler = 'DBServer'
SQL.Strings = (
'select * from Customers')
Parameters = <>
Left = 112
Top = 116
end
object DataSource1: TDataSource
DataSet = ncDBDataset1
Left = 196
Top = 116
end
object ncDBDataset2: TncDBDataset
CursorType = ctStatic
LockType = ltBatchOptimistic
Source = ncClientSource
PeerCommandHandler = 'DBServer'
SQL.Strings = (
'select * from Orders'
'where FKCustomersID=:ID')
DataSource = DataSource1
IndexFieldNames = 'FKCustomersID'
Parameters = <
item
Name = 'ID'
Size = -1
Value = Null
end>
Left = 112
Top = 184
end
object DataSource2: TDataSource
DataSet = ncDBDataset2
Left = 196
Top = 184
end
object ADOQuery1: TADOQuery
Parameters = <>
Left = 56
Top = 276
end
end
| 22.169492 | 41 | 0.610092 |
839f2200d3a4174bada993cdb811e9464a4bc5ca | 17,396 | pas | Pascal | HODLER_Multiplatform_Win_And_iOS_Linux/additionalUnits/CryptoLib/src/Interfaces/ClpIECInterface.pas | devilking6105/HODLER-Open-Source-Multi-Asset-Wallet | 2554bce0ad3e3e08e4617787acf93176243ce758 | [
"Unlicense"
]
| 35 | 2018-11-04T12:02:34.000Z | 2022-02-15T06:00:19.000Z | HODLER_Multiplatform_Win_And_iOS_Linux/additionalUnits/CryptoLib/src/Interfaces/ClpIECInterface.pas | Ecoent/HODLER-Open-Source-Multi-Asset-Wallet | a8c54ecfc569d0ee959b6f0e7826c4ee4b5c4848 | [
"Unlicense"
]
| 85 | 2018-10-23T17:09:20.000Z | 2022-01-12T07:12:54.000Z | HODLER_Multiplatform_Win_And_iOS_Linux/additionalUnits/CryptoLib/src/Interfaces/ClpIECInterface.pas | Ecoent/HODLER-Open-Source-Multi-Asset-Wallet | a8c54ecfc569d0ee959b6f0e7826c4ee4b5c4848 | [
"Unlicense"
]
| 34 | 2018-10-30T00:40:37.000Z | 2022-02-15T06:00:15.000Z | { *********************************************************************************** }
{ * CryptoLib Library * }
{ * Copyright (c) 2018 - 20XX Ugochukwu Mmaduekwe * }
{ * Github Repository <https://github.com/Xor-el> * }
{ * Distributed under the MIT software license, see the accompanying file LICENSE * }
{ * or visit http://www.opensource.org/licenses/mit-license.php. * }
{ * Acknowledgements: * }
{ * * }
{ * Thanks to Sphere 10 Software (http://www.sphere10.com/) for sponsoring * }
{ * development of this library * }
{ * ******************************************************************************* * }
(* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *)
unit ClpIECInterface;
{$I ..\Include\CryptoLib.inc}
interface
uses
Generics.Collections,
ClpIPreCompCallback,
ClpIECFieldElement,
ClpCryptoLibTypes,
ClpIFiniteField,
ClpIPreCompInfo,
ClpBigInteger;
type
IECCurve = interface;
IECPoint = interface(IInterface)
['{625704AF-950B-4B39-976B-573A8DC42790}']
function GetIsInfinity: Boolean;
function GetIsCompressed: Boolean;
function GetpreCompTable: TDictionary<String, IPreCompInfo>;
procedure SetpreCompTable(const Value: TDictionary<String, IPreCompInfo>);
function GetCurve: IECCurve;
function GetCurveCoordinateSystem: Int32;
function GetAffineXCoord: IECFieldElement;
function GetAffineYCoord: IECFieldElement;
function GetXCoord: IECFieldElement;
function GetYCoord: IECFieldElement;
function GetCompressionYTilde: Boolean;
function SatisfiesOrder(): Boolean;
function SatisfiesCurveEquation(): Boolean;
function Detach(): IECPoint;
function RawXCoord: IECFieldElement;
function RawYCoord: IECFieldElement;
function RawZCoords: TCryptoLibGenericArray<IECFieldElement>;
function CreateScaledPoint(const sx, sy: IECFieldElement): IECPoint;
procedure CheckNormalized();
property CurveCoordinateSystem: Int32 read GetCurveCoordinateSystem;
property CompressionYTilde: Boolean read GetCompressionYTilde;
function GetDetachedPoint(): IECPoint;
function GetZCoord(index: Int32): IECFieldElement;
function GetZCoords(): TCryptoLibGenericArray<IECFieldElement>;
function IsNormalized(): Boolean;
/// <summary>
/// Normalization ensures that any projective coordinate is 1, and
/// therefore that the x, y <br />coordinates reflect those of the
/// equivalent point in an affine coordinate system.
/// </summary>
/// <returns>
/// a new ECPoint instance representing the same point, but with
/// normalized coordinates
/// </returns>
function Normalize(): IECPoint; overload;
function Normalize(const zInv: IECFieldElement): IECPoint; overload;
function ImplIsValid(decompressed, checkOrder: Boolean): Boolean;
function IsValid(): Boolean;
function IsValidPartial(): Boolean;
function ScaleX(const scale: IECFieldElement): IECPoint;
function ScaleY(const scale: IECFieldElement): IECPoint;
function GetEncoded(): TCryptoLibByteArray; overload;
function GetEncoded(compressed: Boolean): TCryptoLibByteArray; overload;
function Add(const b: IECPoint): IECPoint;
function Subtract(const b: IECPoint): IECPoint;
function Negate(): IECPoint;
function TimesPow2(e: Int32): IECPoint;
function Twice(): IECPoint;
function Multiply(b: TBigInteger): IECPoint;
function TwicePlus(const b: IECPoint): IECPoint;
function ThreeTimes(): IECPoint;
function Equals(const other: IECPoint): Boolean;
function GetHashCode(): {$IFDEF DELPHI}Int32; {$ELSE}PtrInt; {$ENDIF DELPHI}
function ToString(): String;
property preCompTable: TDictionary<String, IPreCompInfo>
read GetpreCompTable write SetpreCompTable;
/// <summary>
/// Returns the affine x-coordinate after checking that this point is
/// normalized.
/// </summary>
/// <value>
/// The affine x-coordinate of this point
/// </value>
/// <exception cref="ClpCryptoLibTypes|EInvalidOperationCryptoLibException">
/// if the point is not normalized
/// </exception>
property AffineXCoord: IECFieldElement read GetAffineXCoord;
/// <summary>
/// Returns the affine y-coordinate after checking that this point is
/// normalized.
/// </summary>
/// <value>
/// The affine y-coordinate of this point
/// </value>
/// <exception cref="ClpCryptoLibTypes|EInvalidOperationCryptoLibException">
/// if the point is not normalized
/// </exception>
property AffineYCoord: IECFieldElement read GetAffineYCoord;
/// <summary>
/// Returns the x-coordinate. <br />Caution: depending on the curve's
/// coordinate system, this may not be the same value as in an <br />
/// affine coordinate system; use Normalize() to get a point where the
/// coordinates have their <br />affine values, or use AffineXCoord if
/// you expect the point to already have been normalized.
/// </summary>
/// <value>
/// the x-coordinate of this point
/// </value>
property XCoord: IECFieldElement read GetXCoord;
/// <summary>
/// Returns the y-coordinate. <br />Caution: depending on the curve's
/// coordinate system, this may not be the same value as in an <br />
/// affine coordinate system; use Normalize() to get a point where the
/// coordinates have their <br />affine values, or use AffineYCoord if
/// you expect the point to already have been normalized.
/// </summary>
/// <value>
/// the y-coordinate of this point
/// </value>
property YCoord: IECFieldElement read GetYCoord;
property curve: IECCurve read GetCurve;
property IsInfinity: Boolean read GetIsInfinity;
property IsCompressed: Boolean read GetIsCompressed;
end;
IECPointBase = interface(IECPoint)
['{66AF58F3-2A82-41AA-B01F-AA4A67CA5E80}']
end;
IAbstractFpPoint = interface(IECPointBase)
['{57991B0C-7994-4130-93DC-02FEB42E131B}']
end;
IFpPoint = interface(IAbstractFpPoint)
['{4113EEFE-A0F1-439B-97FD-921CA1E0A814}']
function Two(const x: IECFieldElement): IECFieldElement;
function Three(const x: IECFieldElement): IECFieldElement;
function Four(const x: IECFieldElement): IECFieldElement;
function Eight(const x: IECFieldElement): IECFieldElement;
function DoubleProductFromSquares(const a, b, aSquared,
bSquared: IECFieldElement): IECFieldElement;
function CalculateJacobianModifiedW(const Z: IECFieldElement;
const ZSquared: IECFieldElement): IECFieldElement;
function GetJacobianModifiedW(): IECFieldElement;
function TwiceJacobianModified(calculateW: Boolean): IFpPoint;
end;
IAbstractF2mPoint = interface(IECPointBase)
['{D5231494-74E4-4400-A2FE-8E512411515C}']
function Tau(): IAbstractF2mPoint;
function TauPow(pow: Int32): IAbstractF2mPoint;
end;
IF2mPoint = interface(IAbstractF2mPoint)
['{ADFE17E0-6A08-430A-970F-353DE2B9426C}']
end;
// type
/// **
// * Interface for classes encapsulating a point multiplication algorithm
// * for <code>ECPoint</code>s.
// */
IECMultiplier = interface(IInterface)
['{08D01BBB-38C1-4416-867A-D42FAB51E3CB}']
// /**
// * Multiplies the <code>ECPoint p</code> by <code>k</code>, i.e.
// * <code>p</code> is added <code>k</code> times to itself.
// * @param p The <code>ECPoint</code> to be multiplied.
// * @param k The factor by which <code>p</code> is multiplied.
// * @return <code>p</code> multiplied by <code>k</code>.
// */
function Multiply(const p: IECPoint; const k: TBigInteger): IECPoint;
end;
// type
IECPointMap = interface(IInterface)
['{73C2B23F-C05D-4916-8E30-14275F1051B6}']
function Map(const p: IECPoint): IECPoint;
end;
// type
IECEndomorphism = interface(IInterface)
['{DFEE6FD7-C820-401D-8AD3-4DA9A7509DFD}']
function GetPointMap: IECPointMap;
function GetHasEfficientPointMap: Boolean;
property PointMap: IECPointMap read GetPointMap;
property HasEfficientPointMap: Boolean read GetHasEfficientPointMap;
end;
// type
IConfig = interface;
IECLookupTable = interface;
IECCurve = interface(IInterface)
['{F340C8A1-034D-4845-BDE7-A5F55FFDE71B}']
procedure SetCoord(const Value: Int32);
procedure SetEndomorphism(const Value: IECEndomorphism);
procedure SetMultiplier(const Value: IECMultiplier);
function GetFieldSize: Int32;
function GetInfinity: IECPoint;
function GetField: IFiniteField;
function GetA: IECFieldElement;
function GetB: IECFieldElement;
function GetOrder: TBigInteger;
function GetCofactor: TBigInteger;
function GetCoordinateSystem: Int32;
function CloneCurve(): IECCurve;
function CreateRawPoint(const x, y: IECFieldElement;
withCompression: Boolean): IECPoint; overload;
function CreateRawPoint(const x, y: IECFieldElement;
const zs: TCryptoLibGenericArray<IECFieldElement>;
withCompression: Boolean): IECPoint; overload;
function CreateDefaultMultiplier(): IECMultiplier;
procedure CheckPoint(const point: IECPoint);
procedure CheckPoints(const points
: TCryptoLibGenericArray<IECPoint>); overload;
procedure CheckPoints(const points: TCryptoLibGenericArray<IECPoint>;
off, len: Int32); overload;
function DecompressPoint(yTilde: Int32; const X1: TBigInteger): IECPoint;
property FieldSize: Int32 read GetFieldSize;
function FromBigInteger(const x: TBigInteger): IECFieldElement;
function IsValidFieldElement(const x: TBigInteger): Boolean;
function Configure(): IConfig;
function ValidatePoint(const x, y: TBigInteger): IECPoint; overload;
function ValidatePoint(const x, y: TBigInteger; withCompression: Boolean)
: IECPoint; overload;
deprecated 'Per-point compression property will be removed';
function CreateCacheSafeLookupTable(const points
: TCryptoLibGenericArray<IECPoint>; off, len: Int32): IECLookupTable;
function CreatePoint(const x, y: TBigInteger): IECPoint; overload;
function CreatePoint(const x, y: TBigInteger; withCompression: Boolean)
: IECPoint; overload;
deprecated 'Per-point compression property will be removed';
function SupportsCoordinateSystem(coord: Int32): Boolean;
function GetPreCompInfo(const point: IECPoint; const name: String)
: IPreCompInfo;
/// <summary>
/// Compute a <c>PreCompInfo</c> for a point on this curve, under a given
/// name. Used by <c>ECMultiplier</c> to save the precomputation for this <c>
/// ECPoint</c> for use by subsequent multiplication.
/// </summary>
/// <param name="point">
/// The <c>ECPoint</c> to store precomputations for.
/// </param>
/// <param name="name">
/// A <c>String</c> used to index precomputations of different types.
/// </param>
/// <param name="callback">
/// Called to calculate the <c>PreCompInfo</c>
/// </param>
function Precompute(const point: IECPoint; const name: String;
const callback: IPreCompCallback): IPreCompInfo;
function ImportPoint(const p: IECPoint): IECPoint;
/// <summary>
/// Normalization ensures that any projective coordinate is 1, and
/// therefore that the x, y coordinates reflect those of the equivalent
/// point in an affine coordinate system. Where more than one point is to
/// be normalized, this method will generally be more efficient than
/// normalizing each point separately.
/// </summary>
/// <param name="points">
/// An array of points that will be updated in place with their normalized
/// versions, where necessary
/// </param>
procedure NormalizeAll(const points
: TCryptoLibGenericArray<IECPoint>); overload;
/// <summary>
/// Normalization ensures that any projective coordinate is 1, and
/// therefore that the x, y coordinates reflect those of the equivalent
/// point in an affine coordinate system. Where more than one point is to
/// be normalized, this method will generally be more efficient than
/// normalizing each point separately. An (optional) z-scaling factor can
/// be applied; effectively each z coordinate is scaled by this value prior
/// to normalization (but only one actual multiplication is needed).
/// </summary>
/// <param name="points">
/// An array of points that will be updated in place with their normalized
/// versions, where necessary
/// </param>
/// <param name="off">
/// The start of the range of points to normalize
/// </param>
/// <param name="len">
/// The length of the range of points to normalize
/// </param>
/// <param name="iso">
/// The (optional) z-scaling factor - can be null
/// </param>
procedure NormalizeAll(const points: TCryptoLibGenericArray<IECPoint>;
off, len: Int32; const iso: IECFieldElement); overload;
function GetEndomorphism(): IECEndomorphism;
/// <summary>
/// Sets the default <c>ECMultiplier</c>, unless already set.
/// </summary>
function GetMultiplier(): IECMultiplier;
/// <summary>
/// Decode a point on this curve from its ASN.1 encoding. The different
/// encodings are taken account of, including point compression for <br /><c>
/// F</c><b>p</b> (X9.62 s 4.2.1 pg 17).
/// </summary>
/// <returns>
/// The decoded point.
/// </returns>
function DecodePoint(const encoded: TCryptoLibByteArray): IECPoint;
property coord: Int32 write SetCoord;
property Endomorphism: IECEndomorphism write SetEndomorphism;
property Multiplier: IECMultiplier write SetMultiplier;
property Infinity: IECPoint read GetInfinity;
property field: IFiniteField read GetField;
property a: IECFieldElement read GetA;
property b: IECFieldElement read GetB;
property Order: TBigInteger read GetOrder;
property Cofactor: TBigInteger read GetCofactor;
property CoordinateSystem: Int32 read GetCoordinateSystem;
function Equals(const other: IECCurve): Boolean;
function GetHashCode(): {$IFDEF DELPHI}Int32; {$ELSE}PtrInt;
{$ENDIF DELPHI}
end;
IConfig = interface(IInterface)
['{F4BD2FCC-FC9B-4FBB-8A3B-CC9031739D9F}']
function SetCoordinateSystem(coord: Int32): IConfig;
function SetEndomorphism(const Endomorphism: IECEndomorphism): IConfig;
function SetMultiplier(const Multiplier: IECMultiplier): IConfig;
function CreateCurve(): IECCurve;
end;
IECLookupTable = interface(IInterface)
['{A1839961-4FBF-42EF-BF8B-6084064A05C1}']
function GetSize: Int32;
function Lookup(index: Int32): IECPoint;
property Size: Int32 read GetSize;
end;
type
IDefaultLookupTable = interface(IECLookupTable)
['{094881EB-24A6-41A3-BAD6-D6DAB13DD17D}']
end;
type
IAbstractFpCurve = interface(IECCurve)
['{D37FE528-66B3-4449-A95C-8658A9A89B85}']
end;
type
IDefaultF2mLookupTable = interface(IECLookupTable)
['{0C019049-9839-4322-BAF5-8E5D39BC426D}']
end;
type
IFpCurve = interface(IAbstractFpCurve)
['{73E49F8B-C63F-4F91-8F40-A4C3B15F47FF}']
function GetQ: TBigInteger;
property q: TBigInteger read GetQ;
end;
type
IAbstractF2mCurve = interface(IECCurve)
['{97782F77-89D4-410A-9343-518FAB97F349}']
/// <summary>
/// Returns true if this is a Koblitz curve (ABC curve).
/// </summary>
/// <returns>
/// true if this is a Koblitz curve (ABC curve), false otherwise
/// </returns>
function GetIsKoblitz: Boolean;
// /**
// * Solves a quadratic equation <code>z<sup>2</sup> + z = beta</code>(X9.62
// * D.1.6) The other solution is <code>z + 1</code>.
// *
// * @param beta
// * The value to solve the qradratic equation for.
// * @return the solution for <code>z<sup>2</sup> + z = beta</code> or
// * <code>null</code> if no solution exists.
// */
function SolveQuadraticEquation(const beta: IECFieldElement)
: IECFieldElement;
// /**
// * @return the auxiliary values <code>s<sub>0</sub></code> and
// * <code>s<sub>1</sub></code> used for partial modular reduction for
// * Koblitz curves.
// */
function GetSi(): TCryptoLibGenericArray<TBigInteger>;
property IsKoblitz: Boolean read GetIsKoblitz;
end;
type
IF2mCurve = interface(IAbstractF2mCurve)
['{B1C98330-51ED-4C0C-91B1-319223483147}']
function GetM: Int32;
function GetK1: Int32;
function GetK2: Int32;
function GetK3: Int32;
/// <summary>
/// Return true if curve uses a Trinomial basis.
/// </summary>
/// <returns>
/// return true if curve Trinomial, false otherwise.
/// </returns>
function IsTrinomial(): Boolean;
property m: Int32 read GetM;
property k1: Int32 read GetK1;
property k2: Int32 read GetK2;
property k3: Int32 read GetK3;
end;
implementation
end.
| 32.884688 | 87 | 0.670327 |
83603a7672c6eddce7d7a7e9e2022f23ead6fda0 | 778 | pas | Pascal | src/command/generate/Eagle.Alfred.Command.Generate.Service.pas | deveagletec/alfred | 8c31ec5d869beac1882a0697998e34fcb0481264 | [
"MIT"
]
| 3 | 2019-09-10T14:45:52.000Z | 2021-06-23T15:20:39.000Z | src/command/generate/Eagle.Alfred.Command.Generate.Service.pas | deveagletec/alfred | 8c31ec5d869beac1882a0697998e34fcb0481264 | [
"MIT"
]
| 13 | 2019-01-31T15:12:54.000Z | 2020-11-12T00:20:12.000Z | src/command/generate/Eagle.Alfred.Command.Generate.Service.pas | deveagletec/alfred | 8c31ec5d869beac1882a0697998e34fcb0481264 | [
"MIT"
]
| 1 | 2021-06-23T15:20:58.000Z | 2021-06-23T15:20:58.000Z | unit Eagle.Alfred.Command.Generate.Service;
interface
uses
Eagle.Alfred,
Eagle.Alfred.Core.Attributes,
Eagle.Alfred.Command.Generate.CrudFile;
type
[Command('generate', 'service', 'Generates a Service')]
TGenerateServiceCommand = class(TGenerateCrudFileCommand)
public
procedure Execute; override;
end;
implementation
{ TGenerateViewCommand }
procedure TGenerateServiceCommand.Execute;
begin
FCodeGenerator.GenerateService(FModuleName, FName);
FConsoleIO.WriteInfo('Created Service');
if FSkipTests then
Exit;
FCodeGenerator.GenerateTest(FModuleName, 'Service', FName);
FConsoleIO.WriteInfo('Created Service Test');
end;
initialization
TAlfred.GetInstance.Register(TGenerateServiceCommand);
end.
| 20.473684 | 62 | 0.744216 |
470d753c3aec67781cf6328a206f5790a2b08cd6 | 233 | pas | Pascal | CodeForces.com/regular_rounds/#330/A.pas | mstrechen/cp | ffac439840a71f70580a0ef197e47479e167a0eb | [
"MIT"
]
| null | null | null | CodeForces.com/regular_rounds/#330/A.pas | mstrechen/cp | ffac439840a71f70580a0ef197e47479e167a0eb | [
"MIT"
]
| null | null | null | CodeForces.com/regular_rounds/#330/A.pas | mstrechen/cp | ffac439840a71f70580a0ef197e47479e167a0eb | [
"MIT"
]
| null | null | null | var n,m:longint;
tmp1,tmp2:longint;
count:longint=0;
i,j:longint;
BEGIN
read(n,m);
for i:=1 to n do
for j:=1 to m do
begin
read(tmp1);
read(tmp2);
if tmp1+tmp2>0 then inc(count);
end;
write(count);
END. | 15.533333 | 35 | 0.600858 |
fc836585ffcdd3018846e6061fbad0562fd88969 | 47,902 | pas | Pascal | src/contrib/jcl/JclTD32.pas | mrook/grendel | 428e2518868bcd459201e92e5338bae90b95fb59 | [
"BSD-3-Clause"
]
| null | null | null | src/contrib/jcl/JclTD32.pas | mrook/grendel | 428e2518868bcd459201e92e5338bae90b95fb59 | [
"BSD-3-Clause"
]
| null | null | null | src/contrib/jcl/JclTD32.pas | mrook/grendel | 428e2518868bcd459201e92e5338bae90b95fb59 | [
"BSD-3-Clause"
]
| null | null | null | {**************************************************************************************************}
{ }
{ Project JEDI Code Library (JCL) }
{ }
{ The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); }
{ you may not use this file except in compliance with the License. You may obtain a copy of the }
{ License at http://www.mozilla.org/MPL/ }
{ }
{ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF }
{ ANY KIND, either express or implied. See the License for the specific language governing rights }
{ and limitations under the License. }
{ }
{ The Original Code is JclTD32.pas. }
{ }
{ The Initial Developers of the Original Code are documented in the accompanying help file }
{ JCLHELP.hlp. Portions created by these individuals are Copyright (C) of these individuals. }
{ }
{**************************************************************************************************}
{ }
{ Borland TD32 symbolic debugging information support routines and classes. }
{ }
{ Unit owner: Flier Lu }
{ }
{**************************************************************************************************}
// $Id: JclTD32.pas,v 1.2 2004/04/14 21:55:07 ***REMOVED*** Exp $
unit JclTD32;
interface
{$I jcl.inc}
{$IFDEF SUPPORTS_WEAKPACKAGEUNIT}
{$WEAKPACKAGEUNIT ON}
{$ENDIF SUPPORTS_WEAKPACKAGEUNIT}
uses
{$IFDEF MSWINDOWS}
Windows,
{$ENDIF MSWINDOWS}
Classes, SysUtils, Contnrs,
JclBase, JclFileUtils, JclPeImage;
{ TODO -cDOC : Original code: "Flier Lu" <flier_lu@yahoo.com.cn> }
//--------------------------------------------------------------------------------------------------
// TD32 constants and structures
//--------------------------------------------------------------------------------------------------
{*******************************************************************************
[-----------------------------------------------------------------------]
[ Symbol and Type OMF Format Borland Executable Files ]
[-----------------------------------------------------------------------]
Introduction
This section describes the format used to embed debugging information into
the executable file.
Debug Information Format
The format encompasses a block of data which goes at the end of the .EXE
file, i.e., after the header plus load image, overlays, and
Windows/Presentation Manager resource compiler information. The lower
portion of the file is unaffected by the additional data.
The last eight bytes of the file contain a signature and a long file offset
from the end of the file (lfoBase). The signature is FBxx, where xx is the
version number. The long offset indicates the position in the file
(relative to the end of the file) of the base address. For the LX format
executables, the base address is determined by looking at the executable
header.
The signatures have the following meanings:
FB09 The signature for a Borland 32 bit symbol file.
The value
lfaBase=length of the file - lfoBase
gives the base address of the start of the Symbol and Type OMF information
relative to the beginning of the file. All other file offsets in the
Symbol and Type OMF are relative to the lfaBase. At the base address the
signature is repeated, followed by the long displacement to the subsection
directory (lfoDir). All subsections start on a long word boundary and are
designed to maintain natural alignment internally in each subsection and
within the subsection directory.
Subsection Directory
The subsection directory has the format
Directory header
Directory entry 0
Directory entry 1
.
.
.
Directory entry n
There is no requirement for a particular subsection of a particular module to exist.
The following is the layout of the FB09 debug information in the image:
FB09 Header
sstModule [1]
.
.
.
sstModule [n]
sstAlignSym [1]
sstSrcModule [1]
.
.
.
sstAlignSym [n]
sstSrcModule [n]
sstGlobalSym
sstGlobalTypes
sstNames
SubSection Directory
FB09 Trailer
*******************************************************************************}
const
Borland32BitSymbolFileSignatureForDelphi = $39304246; // 'FB09'
Borland32BitSymbolFileSignatureForBCB = $41304246; // 'FB0A'
type
{ Signature structure }
PJclTD32FileSignature = ^TJclTD32FileSignature;
TJclTD32FileSignature = packed record
Signature: DWORD;
Offset: DWORD;
end;
const
{ Subsection Types }
SUBSECTION_TYPE_MODULE = $120;
SUBSECTION_TYPE_TYPES = $121;
SUBSECTION_TYPE_SYMBOLS = $124;
SUBSECTION_TYPE_ALIGN_SYMBOLS = $125;
SUBSECTION_TYPE_SOURCE_MODULE = $127;
SUBSECTION_TYPE_GLOBAL_SYMBOLS = $129;
SUBSECTION_TYPE_GLOBAL_TYPES = $12B;
SUBSECTION_TYPE_NAMES = $130;
type
{ Subsection directory header structure }
{ The directory header structure is followed by the directory entries
which specify the subsection type, module index, file offset, and size.
The subsection directory gives the location (LFO) and size of each subsection,
as well as its type and module number if applicable. }
PDirectoryEntry = ^TDirectoryEntry;
TDirectoryEntry = packed record
SubsectionType: Word; // Subdirectory type
ModuleIndex: Word; // Module index
Offset: DWORD; // Offset from the base offset lfoBase
Size: DWORD; // Number of bytes in subsection
end;
{ The subsection directory is prefixed with a directory header structure
indicating size and number of subsection directory entries that follow. }
PDirectoryHeader = ^TDirectoryHeader;
TDirectoryHeader = packed record
Size: Word; // Length of this structure
DirEntrySize: Word; // Length of each directory entry
DirEntryCount: DWORD; // Number of directory entries
lfoNextDir: DWORD; // Offset from lfoBase of next directory.
Flags: DWORD; // Flags describing directory and subsection tables.
DirEntries: array [0..0] of TDirectoryEntry;
end;
{*******************************************************************************
SUBSECTION_TYPE_MODULE $120
This describes the basic information about an object module including code
segments, module name, and the number of segments for the modules that
follow. Directory entries for sstModules precede all other subsection
directory entries.
*******************************************************************************}
type
PSegmentInfo = ^TSegmentInfo;
TSegmentInfo = packed record
Segment: Word; // Segment that this structure describes
Flags: Word; // Attributes for the logical segment.
// The following attributes are defined:
// $0000 Data segment
// $0001 Code segment
Offset: DWORD; // Offset in segment where the code starts
Size: DWORD; // Count of the number of bytes of code in the segment
end;
PSegmentInfoArray = ^TSegmentInfoArray;
TSegmentInfoArray = array [0..32767] of TSegmentInfo;
PModuleInfo = ^TModuleInfo;
TModuleInfo = packed record
OverlayNumber: Word; // Overlay number
LibraryIndex: Word; // Index into sstLibraries subsection
// if this module was linked from a library
SegmentCount: Word; // Count of the number of code segments
// this module contributes to
DebuggingStyle: Word; // Debugging style for this module.
NameIndex: DWORD; // Name index of module.
TimeStamp: DWORD; // Time stamp from the OBJ file.
Reserved: array [0..2] of DWORD; // Set to 0.
Segments: array [0..0] of TSegmentInfo;
// Detailed information about each segment
// that code is contributed to.
// This is an array of cSeg count segment
// information descriptor structures.
end;
{*******************************************************************************
SUBSECTION_TYPE_SOURCE_MODULE $0127
This table describes the source line number to addressing mapping
information for a module. The table permits the description of a module
containing multiple source files with each source file contributing code to
one or more code segments. The base addresses of the tables described
below are all relative to the beginning of the sstSrcModule table.
Module header
Information for source file 1
Information for segment 1
.
.
.
Information for segment n
.
.
.
Information for source file n
Information for segment 1
.
.
.
Information for segment n
*******************************************************************************}
type
{ The line number to address mapping information is contained in a table with
the following format: }
PLineMappingEntry = ^TLineMappingEntry;
TLineMappingEntry = packed record
SegmentIndex: Word; // Segment index for this table
PairCount: Word; // Count of the number of source line pairs to follow
Offsets: array [0..0] of DWORD;
// An array of 32-bit offsets for the offset
// within the code segment ofthe start of ine contained
// in the parallel array linenumber.
(*
{ This is an array of 16-bit line numbers of the lines in the source file
that cause code to be emitted to the code segment.
This array is parallel to the offset array.
If cPair is not even, then a zero word is emitted to
maintain natural alignment in the sstSrcModule table. }
LineNumbers: array [0..PairCount - 1] of Word;
*)
end;
TOffsetPair = packed record
StartOffset: DWORD;
EndOffset: DWORD;
end;
POffsetPairArray = ^TOffsetPairArray;
TOffsetPairArray = array [0..32767] of TOffsetPair;
{ The file table describes the code segments that receive code from this
source file. Source file entries have the following format: }
PSourceFileEntry = ^TSourceFileEntry;
TSourceFileEntry = packed record
SegmentCount: Word; // Number of segments that receive code from this source file.
NameIndex: DWORD; // Name index of Source file name.
BaseSrcLines: array [0..0] of DWORD;
// An array of offsets for the line/address mapping
// tables for each of the segments that receive code
// from this source file.
(*
{ An array of two 32-bit offsets per segment that
receives code from this module. The first offset
is the offset within the segment of the first byte
of code from this module. The second offset is the
ending address of the code from this module. The
order of these pairs corresponds to the ordering of
the segments in the seg array. Zeros in these
entries means that the information is not known and
the file and line tables described below need to be
examined to determine if an address of interest is
contained within the code from this module. }
SegmentAddress: array [0..SegmentCount - 1] of TOffsetPair;
Name: ShortString; // Count of the number of bytes in source file name
*)
end;
{ The module header structure describes the source file and code segment
organization of the module. Each module header has the following format: }
PSourceModuleInfo = ^TSourceModuleInfo;
TSourceModuleInfo = packed record
FileCount: Word; // The number of source file scontributing code to segments
SegmentCount: Word; // The number of code segments receiving code from this module
BaseSrcFiles: array [0..0] of DWORD;
(*
// This is an array of base offsets from the beginning of the sstSrcModule table
BaseSrcFiles: array [0..FileCount - 1] of DWORD;
{ An array of two 32-bit offsets per segment that
receives code from this module. The first offset
is the offset within the segment of the first byte
of code from this module. The second offset is the
ending address of the code from this module. The
order of these pairs corresponds to the ordering of
the segments in the seg array. Zeros in these
entries means that the information is not known and
the file and line tables described below need to be
examined to determine if an address of interest is
contained within the code from this module. }
SegmentAddress: array [0..SegmentCount - 1] of TOffsetPair;
{ An array of segment indices that receive code from
this module. If the number of segments is not
even, a pad word is inserted to maintain natural
alignment. }
SegmentIndexes: array [0..SegmentCount - 1] of Word;
*)
end;
{*******************************************************************************
SUBSECTION_TYPE_GLOBAL_TYPES $12b
This subsection contains the packed type records for the executable file.
The first long word of the subsection contains the number of types in the
table. This count is followed by a count-sized array of long offsets to
the corresponding type record. As the sstGlobalTypes subsection is
written, each type record is forced to start on a long word boundary.
However, the length of the type string is NOT adjusted by the pad count.
The remainder of the subsection contains the type records.
*******************************************************************************}
type
PGlobalTypeInfo = ^TGlobalTypeInfo;
TGlobalTypeInfo = packed record
Count: DWORD; // count of the number of types
// offset of each type string from the beginning of table
Offsets: array [0..0] of DWORD;
end;
const
{ Symbol type defines }
SYMBOL_TYPE_COMPILE = $0001; // Compile flags symbol
SYMBOL_TYPE_REGISTER = $0002; // Register variable
SYMBOL_TYPE_CONST = $0003; // Constant symbol
SYMBOL_TYPE_UDT = $0004; // User-defined Type
SYMBOL_TYPE_SSEARCH = $0005; // Start search
SYMBOL_TYPE_END = $0006; // End block, procedure, with, or thunk
SYMBOL_TYPE_SKIP = $0007; // Skip - Reserve symbol space
SYMBOL_TYPE_CVRESERVE = $0008; // Reserved for Code View internal use
SYMBOL_TYPE_OBJNAME = $0009; // Specify name of object file
SYMBOL_TYPE_BPREL16 = $0100; // BP relative 16:16
SYMBOL_TYPE_LDATA16 = $0101; // Local data 16:16
SYMBOL_TYPE_GDATA16 = $0102; // Global data 16:16
SYMBOL_TYPE_PUB16 = $0103; // Public symbol 16:16
SYMBOL_TYPE_LPROC16 = $0104; // Local procedure start 16:16
SYMBOL_TYPE_GPROC16 = $0105; // Global procedure start 16:16
SYMBOL_TYPE_THUNK16 = $0106; // Thunk start 16:16
SYMBOL_TYPE_BLOCK16 = $0107; // Block start 16:16
SYMBOL_TYPE_WITH16 = $0108; // With start 16:16
SYMBOL_TYPE_LABEL16 = $0109; // Code label 16:16
SYMBOL_TYPE_CEXMODEL16 = $010A; // Change execution model 16:16
SYMBOL_TYPE_VFTPATH16 = $010B; // Virtual function table path descriptor 16:16
SYMBOL_TYPE_BPREL32 = $0200; // BP relative 16:32
SYMBOL_TYPE_LDATA32 = $0201; // Local data 16:32
SYMBOL_TYPE_GDATA32 = $0202; // Global data 16:32
SYMBOL_TYPE_PUB32 = $0203; // Public symbol 16:32
SYMBOL_TYPE_LPROC32 = $0204; // Local procedure start 16:32
SYMBOL_TYPE_GPROC32 = $0205; // Global procedure start 16:32
SYMBOL_TYPE_THUNK32 = $0206; // Thunk start 16:32
SYMBOL_TYPE_BLOCK32 = $0207; // Block start 16:32
SYMBOL_TYPE_WITH32 = $0208; // With start 16:32
SYMBOL_TYPE_LABEL32 = $0209; // Label 16:32
SYMBOL_TYPE_CEXMODEL32 = $020A; // Change execution model 16:32
SYMBOL_TYPE_VFTPATH32 = $020B; // Virtual function table path descriptor 16:32
{*******************************************************************************
Global and Local Procedure Start 16:32
SYMBOL_TYPE_LPROC32 $0204
SYMBOL_TYPE_GPROC32 $0205
The symbol records define local (file static) and global procedure
definition. For C/C++, functions that are declared static to a module are
emitted as Local Procedure symbols. Functions not specifically declared
static are emitted as Global Procedures.
For each SYMBOL_TYPE_GPROC32 emitted, an SYMBOL_TYPE_GPROCREF symbol
must be fabricated and emitted to the SUBSECTION_TYPE_GLOBAL_SYMBOLS section.
*******************************************************************************}
type
TSymbolProcInfo = packed record
pParent: DWORD;
pEnd: DWORD;
pNext: DWORD;
Size: DWORD; // Length in bytes of this procedure
DebugStart: DWORD; // Offset in bytes from the start of the procedure to
// the point where the stack frame has been set up.
DebugEnd: DWORD; // Offset in bytes from the start of the procedure to
// the point where the procedure is ready to return
// and has calculated its return value, if any.
// Frame and register variables an still be viewed.
Offset: DWORD; // Offset portion of the segmented address of
// the start of the procedure in the code segment
Segment: Word; // Segment portion of the segmented address of
// the start of the procedure in the code segment
ProcType: DWORD; // Type of the procedure type record
NearFar: Byte; // Type of return the procedure makes:
// 0 near
// 4 far
Reserved: Byte;
NameIndex: DWORD; // Name index of procedure
end;
type
{ Symbol Information Records }
PSymbolInfo = ^TSymbolInfo;
TSymbolInfo = packed record
Size: Word;
SymbolType: Word;
case Word of
SYMBOL_TYPE_LPROC32, SYMBOL_TYPE_GPROC32:
(Proc: TSymbolProcInfo;);
end;
PSymbolInfos = ^TSymbolInfos;
TSymbolInfos = packed record
Signature: DWORD;
Symbols: array [0..0] of TSymbolInfo;
end;
{$IFDEF SUPPORTS_EXTSYM}
{$EXTERNALSYM Borland32BitSymbolFileSignatureForDelphi}
{$EXTERNALSYM Borland32BitSymbolFileSignatureForBCB}
{$EXTERNALSYM SUBSECTION_TYPE_MODULE}
{$EXTERNALSYM SUBSECTION_TYPE_TYPES}
{$EXTERNALSYM SUBSECTION_TYPE_SYMBOLS}
{$EXTERNALSYM SUBSECTION_TYPE_ALIGN_SYMBOLS}
{$EXTERNALSYM SUBSECTION_TYPE_SOURCE_MODULE}
{$EXTERNALSYM SUBSECTION_TYPE_GLOBAL_SYMBOLS}
{$EXTERNALSYM SUBSECTION_TYPE_GLOBAL_TYPES}
{$EXTERNALSYM SUBSECTION_TYPE_NAMES}
{$EXTERNALSYM SYMBOL_TYPE_COMPILE}
{$EXTERNALSYM SYMBOL_TYPE_REGISTER}
{$EXTERNALSYM SYMBOL_TYPE_CONST}
{$EXTERNALSYM SYMBOL_TYPE_UDT}
{$EXTERNALSYM SYMBOL_TYPE_SSEARCH}
{$EXTERNALSYM SYMBOL_TYPE_END}
{$EXTERNALSYM SYMBOL_TYPE_SKIP}
{$EXTERNALSYM SYMBOL_TYPE_CVRESERVE}
{$EXTERNALSYM SYMBOL_TYPE_OBJNAME}
{$EXTERNALSYM SYMBOL_TYPE_BPREL16}
{$EXTERNALSYM SYMBOL_TYPE_LDATA16}
{$EXTERNALSYM SYMBOL_TYPE_GDATA16}
{$EXTERNALSYM SYMBOL_TYPE_PUB16}
{$EXTERNALSYM SYMBOL_TYPE_LPROC16}
{$EXTERNALSYM SYMBOL_TYPE_GPROC16}
{$EXTERNALSYM SYMBOL_TYPE_THUNK16}
{$EXTERNALSYM SYMBOL_TYPE_BLOCK16}
{$EXTERNALSYM SYMBOL_TYPE_WITH16}
{$EXTERNALSYM SYMBOL_TYPE_LABEL16}
{$EXTERNALSYM SYMBOL_TYPE_CEXMODEL16}
{$EXTERNALSYM SYMBOL_TYPE_VFTPATH16}
{$EXTERNALSYM SYMBOL_TYPE_BPREL32}
{$EXTERNALSYM SYMBOL_TYPE_LDATA32}
{$EXTERNALSYM SYMBOL_TYPE_GDATA32}
{$EXTERNALSYM SYMBOL_TYPE_PUB32}
{$EXTERNALSYM SYMBOL_TYPE_LPROC32}
{$EXTERNALSYM SYMBOL_TYPE_GPROC32}
{$EXTERNALSYM SYMBOL_TYPE_THUNK32}
{$EXTERNALSYM SYMBOL_TYPE_BLOCK32}
{$EXTERNALSYM SYMBOL_TYPE_WITH32}
{$EXTERNALSYM SYMBOL_TYPE_LABEL32}
{$EXTERNALSYM SYMBOL_TYPE_CEXMODEL32}
{$EXTERNALSYM SYMBOL_TYPE_VFTPATH32}
{$ENDIF SUPPORTS_EXTSYM}
//--------------------------------------------------------------------------------------------------
// TD32 information related classes
//--------------------------------------------------------------------------------------------------
type
TJclModuleInfo = class(TObject)
private
FNameIndex: DWORD;
FSegments: PSegmentInfoArray;
FSegmentCount: Integer;
function GetSegment(const Idx: Integer): TSegmentInfo;
protected
constructor Create(pModInfo: PModuleInfo);
public
property NameIndex: DWORD read FNameIndex;
property SegmentCount: Integer read FSegmentCount; //GetSegmentCount;
property Segment[const Idx: Integer]: TSegmentInfo read GetSegment; default;
end;
TJclLineInfo = class(TObject)
private
FLineNo: DWORD;
FOffset: DWORD;
protected
constructor Create(ALineNo, AOffset: DWORD);
public
property LineNo: DWORD read FLineNo;
property Offset: DWORD read FOffset;
end;
TJclSourceModuleInfo = class(TObject)
private
FLines: TObjectList;
FSegments: POffsetPairArray;
FSegmentCount: Integer;
FNameIndex: DWORD;
function GetLine(const Idx: Integer): TJclLineInfo;
function GetLineCount: Integer;
function GetSegment(const Idx: Integer): TOffsetPair;
protected
constructor Create(pSrcFile: PSourceFileEntry; Base: DWORD);
public
destructor Destroy; override;
function FindLine(const AAddr: DWORD; var ALine: TJclLineInfo): Boolean;
property NameIndex: DWORD read FNameIndex;
property LineCount: Integer read GetLineCount;
property Line[const Idx: Integer]: TJclLineInfo read GetLine; default;
property SegmentCount: Integer read FSegmentCount; //GetSegmentCount;
property Segment[const Idx: Integer]: TOffsetPair read GetSegment;
end;
TJclSymbolInfo = class(TObject)
private
FSymbolType: Word;
protected
constructor Create(pSymInfo: PSymbolInfo); virtual;
property SymbolType: Word read FSymbolType;
end;
TJclProcSymbolInfo = class(TJclSymbolInfo)
private
FNameIndex: DWORD;
FOffset: DWORD;
FSize: DWORD;
protected
constructor Create(pSymInfo: PSymbolInfo); override;
public
property NameIndex: DWORD read FNameIndex;
property Offset: DWORD read FOffset;
property Size: DWORD read FSize;
end;
TJclLocalProcSymbolInfo = class(TJclProcSymbolInfo);
TJclGlobalProcSymbolInfo = class(TJclProcSymbolInfo);
//--------------------------------------------------------------------------------------------------
// TD32 parser
//--------------------------------------------------------------------------------------------------
TJclTD32InfoParser = class(TObject)
private
FBase: Pointer;
FData: TCustomMemoryStream;
FNames: TList;
FModules: TObjectList;
FSourceModules: TObjectList;
FSymbols: TObjectList;
FValidData: Boolean;
function GetName(const Idx: Integer): string;
function GetNameCount: Integer;
function GetSymbol(const Idx: Integer): TJclSymbolInfo;
function GetSymbolCount: Integer;
function GetModule(const Idx: Integer): TJclModuleInfo;
function GetModuleCount: Integer;
function GetSourceModule(const Idx: Integer): TJclSourceModuleInfo;
function GetSourceModuleCount: Integer;
protected
procedure Analyse;
procedure AnalyseNames(const pSubsection: Pointer; const Size: DWORD); virtual;
procedure AnalyseAlignSymbols(pSymbols: PSymbolInfos; const Size: DWORD); virtual;
procedure AnalyseModules(pModInfo: PModuleInfo; const Size: DWORD); virtual;
procedure AnalyseSourceModules(pSrcModInfo: PSourceModuleInfo; const Size: DWORD); virtual;
procedure AnalyseUnknownSubSection(const pSubsection: Pointer; const Size: DWORD); virtual;
function LfaToVa(Lfa: DWORD): Pointer;
public
constructor Create(const ATD32Data: TCustomMemoryStream); // Data mustn't be freed before the class is destroyed
destructor Destroy; override;
function FindModule(const AAddr: DWORD; var AMod: TJclModuleInfo): Boolean;
function FindSourceModule(const AAddr: DWORD; var ASrcMod: TJclSourceModuleInfo): Boolean;
function FindProc(const AAddr: DWORD; var AProc: TJclProcSymbolInfo): Boolean;
class function IsTD32Sign(const Sign: TJclTD32FileSignature): Boolean;
class function IsTD32DebugInfoValid(const DebugData: Pointer; const DebugDataSize: LongWord): Boolean;
property Data: TCustomMemoryStream read FData;
property Names[const Idx: Integer]: string read GetName;
property NameCount: Integer read GetNameCount;
property Symbols[const Idx: Integer]: TJclSymbolInfo read GetSymbol;
property SymbolCount: Integer read GetSymbolCount;
property Modules[const Idx: Integer]: TJclModuleInfo read GetModule;
property ModuleCount: Integer read GetModuleCount;
property SourceModules[const Idx: Integer]: TJclSourceModuleInfo read GetSourceModule;
property SourceModuleCount: Integer read GetSourceModuleCount;
property ValidData: Boolean read FValidData;
end;
//--------------------------------------------------------------------------------------------------
// TD32 scanner with source location methods
//--------------------------------------------------------------------------------------------------
TJclTD32InfoScanner = class(TJclTD32InfoParser)
public
function LineNumberFromAddr(AAddr: DWORD; var Offset: Integer): Integer; overload;
function LineNumberFromAddr(AAddr: DWORD): Integer; overload;
function ProcNameFromAddr(AAddr: DWORD): string; overload;
function ProcNameFromAddr(AAddr: DWORD; var Offset: Integer): string; overload;
function ModuleNameFromAddr(AAddr: DWORD): string;
function SourceNameFromAddr(AAddr: DWORD): string;
end;
//--------------------------------------------------------------------------------------------------
// PE Image with TD32 information and source location support
//--------------------------------------------------------------------------------------------------
TJclPeBorTD32Image = class(TJclPeBorImage)
private
FIsTD32DebugPresent: Boolean;
FTD32DebugData: TCustomMemoryStream;
FTD32Scanner: TJclTD32InfoScanner;
protected
procedure AfterOpen; override;
procedure Clear; override;
procedure ClearDebugData;
procedure CheckDebugData;
function IsDebugInfoInImage(var DataStream: TCustomMemoryStream): Boolean;
function IsDebugInfoInTds(var DataStream: TCustomMemoryStream): Boolean;
public
property IsTD32DebugPresent: Boolean read FIsTD32DebugPresent;
property TD32DebugData: TCustomMemoryStream read FTD32DebugData;
property TD32Scanner: TJclTD32InfoScanner read FTD32Scanner;
end;
implementation
uses
JclResources, JclSysUtils;
const
TurboDebuggerSymbolExt = '.tds';
//==================================================================================================
// TJclModuleInfo
//==================================================================================================
constructor TJclModuleInfo.Create(pModInfo: PModuleInfo);
begin
Assert(Assigned(pModInfo));
inherited Create;
FNameIndex := pModInfo.NameIndex;
FSegments := @pModInfo.Segments[0];
FSegmentCount := pModInfo.SegmentCount;
end;
//--------------------------------------------------------------------------------------------------
function TJclModuleInfo.GetSegment(const Idx: Integer): TSegmentInfo;
begin
Assert((0 <= Idx) and (Idx < FSegmentCount));
Result := FSegments[Idx];
end;
//==================================================================================================
// TJclLineInfo
//==================================================================================================
constructor TJclLineInfo.Create(ALineNo, AOffset: DWORD);
begin
inherited Create;
FLineNo := ALineNo;
FOffset := AOffset;
end;
//==================================================================================================
// TJclSourceModuleInfo
//==================================================================================================
constructor TJclSourceModuleInfo.Create(pSrcFile: PSourceFileEntry; Base: DWORD);
type
PArrayOfWord = ^TArrayOfWord;
TArrayOfWord = array [0..0] of Word;
var
I, J: Integer;
pLineEntry: PLineMappingEntry;
begin
Assert(Assigned(pSrcFile));
inherited Create;
FNameIndex := pSrcFile.NameIndex;
FLines := TObjectList.Create;
{$RANGECHECKS OFF}
for I := 0 to pSrcFile.SegmentCount - 1 do
begin
pLineEntry := PLineMappingEntry(Base + pSrcFile.BaseSrcLines[I]);
for J := 0 to pLineEntry.PairCount - 1 do
FLines.Add(TJclLineInfo.Create(
PArrayOfWord(@pLineEntry.Offsets[pLineEntry.PairCount])^[J],
pLineEntry.Offsets[J]));
end;
FSegments := @pSrcFile.BaseSrcLines[pSrcFile.SegmentCount];
FSegmentCount := pSrcFile.SegmentCount;
{$IFDEF RANGECHECKS_ON}
{$RANGECHECKS ON}
{$ENDIF RANGECHECKS_ON}
end;
//--------------------------------------------------------------------------------------------------
destructor TJclSourceModuleInfo.Destroy;
begin
FreeAndNil(FLines);
inherited Destroy;
end;
//--------------------------------------------------------------------------------------------------
function TJclSourceModuleInfo.GetLine(const Idx: Integer): TJclLineInfo;
begin
Result := TJclLineInfo(FLines.Items[Idx]);
end;
//--------------------------------------------------------------------------------------------------
function TJclSourceModuleInfo.GetLineCount: Integer;
begin
Result := FLines.Count;
end;
//--------------------------------------------------------------------------------------------------
function TJclSourceModuleInfo.GetSegment(const Idx: Integer): TOffsetPair;
begin
Assert((0 <= Idx) and (Idx < FSegmentCount));
Result := FSegments[Idx];
end;
//--------------------------------------------------------------------------------------------------
function TJclSourceModuleInfo.FindLine(const AAddr: DWORD; var ALine: TJclLineInfo): Boolean;
var
I: Integer;
begin
for I := 0 to LineCount - 1 do
with Line[I] do
begin
if AAddr = Offset then
begin
Result := True;
ALine := Line[I];
Exit;
end
else
if (I > 1) and (Line[I - 1].Offset < AAddr) and (AAddr < Offset) then
begin
Result := True;
ALine := Line[I-1];
Exit;
end;
end;
Result := False;
ALine := nil;
end;
//==================================================================================================
// TJclSymbolInfo
//==================================================================================================
constructor TJclSymbolInfo.Create(pSymInfo: PSymbolInfo);
begin
Assert(Assigned(pSymInfo));
inherited Create;
FSymbolType := pSymInfo.SymbolType;
end;
//==================================================================================================
// TJclProcSymbolInfo
//==================================================================================================
constructor TJclProcSymbolInfo.Create(pSymInfo: PSymbolInfo);
begin
Assert(Assigned(pSymInfo));
inherited Create(pSymInfo);
with pSymInfo^ do
begin
FNameIndex := Proc.NameIndex;
FOffset := Proc.Offset;
FSize := Proc.Size;
end;
end;
//==================================================================================================
// TJclTD32InfoParser
//==================================================================================================
constructor TJclTD32InfoParser.Create(const ATD32Data: TCustomMemoryStream);
begin
Assert(Assigned(ATD32Data));
inherited Create;
FNames := TList.Create;
FModules := TObjectList.Create;
FSourceModules := TObjectList.Create;
FSymbols := TObjectList.Create;
FNames.Add(nil);
FData := ATD32Data;
FBase := FData.Memory;
FValidData := IsTD32DebugInfoValid(FBase, FData.Size);
if FValidData then
Analyse;
end;
//--------------------------------------------------------------------------------------------------
destructor TJclTD32InfoParser.Destroy;
begin
FreeAndNil(FSymbols);
FreeAndNil(FSourceModules);
FreeAndNil(FModules);
FreeAndNil(FNames);
inherited Destroy;
end;
//--------------------------------------------------------------------------------------------------
procedure TJclTD32InfoParser.Analyse;
var
I: Integer;
pDirHeader: PDirectoryHeader;
pSubsection: Pointer;
begin
pDirHeader := PDirectoryHeader(LfaToVa(PJclTD32FileSignature(LfaToVa(0)).Offset));
while True do
begin
Assert(pDirHeader.DirEntrySize = SizeOf(TDirectoryEntry));
{$RANGECHECKS OFF}
for I := 0 to pDirHeader.DirEntryCount - 1 do
with pDirHeader.DirEntries[I] do
begin
pSubsection := LfaToVa(Offset);
case SubsectionType of
SUBSECTION_TYPE_MODULE:
AnalyseModules(pSubsection, Size);
SUBSECTION_TYPE_ALIGN_SYMBOLS:
AnalyseAlignSymbols(pSubsection, Size);
SUBSECTION_TYPE_SOURCE_MODULE:
AnalyseSourceModules(pSubsection, Size);
SUBSECTION_TYPE_NAMES:
AnalyseNames(pSubsection, Size);
else
AnalyseUnknownSubSection(pSubsection, Size);
end;
end;
{$IFDEF RANGECHECKS_ON}
{$RANGECHECKS ON}
{$ENDIF RANGECHECKS_ON}
if pDirHeader.lfoNextDir <> 0 then
pDirHeader := PDirectoryHeader(LfaToVa(pDirHeader.lfoNextDir))
else
Break;
end;
end;
//--------------------------------------------------------------------------------------------------
procedure TJclTD32InfoParser.AnalyseNames(const pSubsection: Pointer; const Size: DWORD);
var
I, Count, Len: Integer;
pszName: PChar;
begin
Count := PDWORD(pSubsection)^;
pszName := PChar(DWORD(pSubsection) + SizeOf(DWORD));
for I := 0 to Count - 1 do
begin
// Get the length of the name
Len := Ord(pszName^);
Inc(pszName);
// Get the name
FNames.Add(pszName);
// skip the length of name and a NULL at the end
Inc(pszName, Len + 1);
end;
end;
//--------------------------------------------------------------------------------------------------
procedure TJclTD32InfoParser.AnalyseAlignSymbols(pSymbols: PSymbolInfos; const Size: DWORD);
var
Offset: DWORD;
pInfo: PSymbolInfo;
Symbol: TJclSymbolInfo;
begin
Offset := DWORD(@pSymbols.Symbols[0]) - DWORD(pSymbols);
while Offset < Size do
begin
pInfo := PSymbolInfo(DWORD(pSymbols) + Offset);
case pInfo.SymbolType of
SYMBOL_TYPE_LPROC32:
Symbol := TJclLocalProcSymbolInfo.Create(pInfo);
SYMBOL_TYPE_GPROC32:
Symbol := TJclGlobalProcSymbolInfo.Create(pInfo);
else
Symbol := nil;
end;
if Assigned(Symbol) then
FSymbols.Add(Symbol);
Inc(Offset, pInfo.Size + SizeOf(pInfo.Size));
end;
end;
//--------------------------------------------------------------------------------------------------
procedure TJclTD32InfoParser.AnalyseModules(pModInfo: PModuleInfo; const Size: DWORD);
begin
FModules.Add(TJclModuleInfo.Create(pModInfo));
end;
//--------------------------------------------------------------------------------------------------
procedure TJclTD32InfoParser.AnalyseSourceModules(pSrcModInfo: PSourceModuleInfo; const Size: DWORD);
var
I: Integer;
pSrcFile: PSourceFileEntry;
begin
{$RANGECHECKS OFF}
for I := 0 to pSrcModInfo.FileCount - 1 do
begin
pSrcFile := PSourceFileEntry(DWORD(pSrcModInfo) + pSrcModInfo.BaseSrcFiles[I]);
if pSrcFile.NameIndex > 0 then
FSourceModules.Add(TJclSourceModuleInfo.Create(pSrcFile, DWORD(pSrcModInfo)));
end;
{$IFDEF RANGECHECKS_ON}
{$RANGECHECKS ON}
{$ENDIF RANGECHECKS_ON}
end;
//--------------------------------------------------------------------------------------------------
procedure TJclTD32InfoParser.AnalyseUnknownSubSection(const pSubsection: Pointer; const Size: DWORD);
begin
// do nothing
end;
//--------------------------------------------------------------------------------------------------
function TJclTD32InfoParser.GetModule(const Idx: Integer): TJclModuleInfo;
begin
Result := TJclModuleInfo(FModules.Items[Idx]);
end;
//--------------------------------------------------------------------------------------------------
function TJclTD32InfoParser.GetModuleCount: Integer;
begin
Result := FModules.Count;
end;
//--------------------------------------------------------------------------------------------------
function TJclTD32InfoParser.GetName(const Idx: Integer): string;
begin
Result := PChar(FNames.Items[Idx]);
end;
//--------------------------------------------------------------------------------------------------
function TJclTD32InfoParser.GetNameCount: Integer;
begin
Result := FNames.Count;
end;
//--------------------------------------------------------------------------------------------------
function TJclTD32InfoParser.GetSourceModule(const Idx: Integer): TJclSourceModuleInfo;
begin
Result := TJclSourceModuleInfo(FSourceModules.Items[Idx]);
end;
//--------------------------------------------------------------------------------------------------
function TJclTD32InfoParser.GetSourceModuleCount: Integer;
begin
Result := FSourceModules.Count;
end;
//--------------------------------------------------------------------------------------------------
function TJclTD32InfoParser.GetSymbol(const Idx: Integer): TJclSymbolInfo;
begin
Result := TJclSymbolInfo(FSymbols.Items[Idx]);
end;
//--------------------------------------------------------------------------------------------------
function TJclTD32InfoParser.GetSymbolCount: Integer;
begin
Result := FSymbols.Count;
end;
//--------------------------------------------------------------------------------------------------
function TJclTD32InfoParser.FindModule(const AAddr: DWORD;
var AMod: TJclModuleInfo): Boolean;
var
I, J: Integer;
begin
if ValidData then
for I := 0 to ModuleCount - 1 do
with Modules[I] do
for J := 0 to SegmentCount - 1 do
begin
if AAddr >= FSegments[J].Offset then
begin
if AAddr - FSegments[J].Offset <= Segment[J].Size then
begin
Result := True;
AMod := Modules[I];
Exit;
end;
end;
end;
Result := False;
AMod := nil;
end;
//--------------------------------------------------------------------------------------------------
function TJclTD32InfoParser.FindSourceModule(const AAddr: DWORD;
var ASrcMod: TJclSourceModuleInfo): Boolean;
var
I, J: Integer;
begin
if ValidData then
for I := 0 to SourceModuleCount - 1 do
with SourceModules[I] do
for J := 0 to SegmentCount - 1 do
with Segment[J] do
if (StartOffset <= AAddr) and (AAddr < EndOffset) then
begin
Result := True;
ASrcMod := SourceModules[I];
Exit;
end;
Result := False;
ASrcMod := nil;
end;
//--------------------------------------------------------------------------------------------------
function TJclTD32InfoParser.FindProc(const AAddr: DWORD; var AProc: TJclProcSymbolInfo): Boolean;
var
I: Integer;
begin
if ValidData then
for I := 0 to SymbolCount - 1 do
if Symbols[I].InheritsFrom(TJclProcSymbolInfo) then
with Symbols[I] as TJclProcSymbolInfo do
if (Offset <= AAddr) and (AAddr < Offset + Size) then
begin
Result := True;
AProc := TJclProcSymbolInfo(Symbols[I]);
Exit;
end;
Result := False;
AProc := nil;
end;
//--------------------------------------------------------------------------------------------------
class function TJclTD32InfoParser.IsTD32DebugInfoValid(
const DebugData: Pointer; const DebugDataSize: LongWord): Boolean;
var
Sign: TJclTD32FileSignature;
EndOfDebugData: LongWord;
begin
Assert(not IsBadReadPtr(DebugData, DebugDataSize));
Result := False;
EndOfDebugData := LongWord(DebugData) + DebugDataSize;
if DebugDataSize > SizeOf(Sign) then
begin
Sign := PJclTD32FileSignature(EndOfDebugData - SizeOf(Sign))^;
if IsTD32Sign(Sign) and (Sign.Offset <= DebugDataSize) then
begin
Sign := PJclTD32FileSignature(EndOfDebugData - Sign.Offset)^;
Result := IsTD32Sign(Sign);
end;
end;
end;
//--------------------------------------------------------------------------------------------------
class function TJclTD32InfoParser.IsTD32Sign(const Sign: TJclTD32FileSignature): Boolean;
begin
Result := (Sign.Signature = Borland32BitSymbolFileSignatureForDelphi) or
(Sign.Signature = Borland32BitSymbolFileSignatureForBCB);
end;
//--------------------------------------------------------------------------------------------------
function TJclTD32InfoParser.LfaToVa(Lfa: DWORD): Pointer;
begin
Result := Pointer(DWORD(FBase) + Lfa)
end;
//==================================================================================================
// TJclTD32InfoScanner
//==================================================================================================
function TJclTD32InfoScanner.LineNumberFromAddr(AAddr: DWORD): Integer;
var
Dummy: Integer;
begin
Result := LineNumberFromAddr(AAddr, Dummy);
end;
//--------------------------------------------------------------------------------------------------
function TJclTD32InfoScanner.LineNumberFromAddr(AAddr: DWORD; var Offset: Integer): Integer;
var
ASrcMod: TJclSourceModuleInfo;
ALine: TJclLineInfo;
begin
if FindSourceModule(AAddr, ASrcMod) and ASrcMod.FindLine(AAddr, ALine) then
begin
Result := ALine.LineNo;
Offset := AAddr - ALine.Offset;
end
else
begin
Result := 0;
Offset := 0;
end;
end;
//--------------------------------------------------------------------------------------------------
function TJclTD32InfoScanner.ModuleNameFromAddr(AAddr: DWORD): string;
var
AMod: TJclModuleInfo;
begin
if FindModule(AAddr, AMod) then
Result := Names[AMod.NameIndex]
else
Result := '';
end;
//--------------------------------------------------------------------------------------------------
function TJclTD32InfoScanner.ProcNameFromAddr(AAddr: DWORD): string;
var
Dummy: Integer;
begin
Result := ProcNameFromAddr(AAddr, Dummy);
end;
//--------------------------------------------------------------------------------------------------
function TJclTD32InfoScanner.ProcNameFromAddr(AAddr: DWORD; var Offset: Integer): string;
var
AProc: TJclProcSymbolInfo;
function FormatProcName(const ProcName: string): string;
var
pchSecondAt, P: PChar;
begin
Result := ProcName;
if (Length(ProcName) > 0) and (ProcName[1] = '@') then
begin
pchSecondAt := StrScan(PChar(Copy(ProcName, 2, Length(ProcName) - 1)), '@');
if pchSecondAt <> nil then
begin
Inc(pchSecondAt);
Result := pchSecondAt;
P := PChar(Result);
while P^ <> #0 do
begin
if (pchSecondAt^ = '@') and ((pchSecondAt - 1)^ <> '@') then
P^ := '.';
Inc(P);
Inc(pchSecondAt);
end;
end;
end;
end;
begin
if FindProc(AAddr, AProc) then
begin
Result := FormatProcName(Names[AProc.NameIndex]);
Offset := AAddr - AProc.Offset;
end
else
begin
Result := '';
Offset := 0;
end;
end;
//--------------------------------------------------------------------------------------------------
function TJclTD32InfoScanner.SourceNameFromAddr(AAddr: DWORD): string;
var
ASrcMod: TJclSourceModuleInfo;
begin
if FindSourceModule(AAddr, ASrcMod) then
Result := Names[ASrcMod.NameIndex];
end;
//==================================================================================================
// TJclPeBorTD32Image
//==================================================================================================
procedure TJclPeBorTD32Image.AfterOpen;
begin
inherited AfterOpen;
CheckDebugData;
end;
//--------------------------------------------------------------------------------------------------
procedure TJclPeBorTD32Image.CheckDebugData;
begin
FIsTD32DebugPresent := IsDebugInfoInImage(FTD32DebugData);
if not FIsTD32DebugPresent then
FIsTD32DebugPresent := IsDebugInfoInTds(FTD32DebugData);
if FIsTD32DebugPresent then
begin
FTD32Scanner := TJclTD32InfoScanner.Create(FTD32DebugData);
if not FTD32Scanner.ValidData then
begin
ClearDebugData;
if not NoExceptions then
raise EJclError.CreateResRecFmt(@RsHasNotTD32Info, [FileName]);
end;
end;
end;
//--------------------------------------------------------------------------------------------------
procedure TJclPeBorTD32Image.Clear;
begin
ClearDebugData;
inherited Clear;
end;
//--------------------------------------------------------------------------------------------------
procedure TJclPeBorTD32Image.ClearDebugData;
begin
FIsTD32DebugPresent := False;
FreeAndNil(FTD32Scanner);
FreeAndNil(FTD32DebugData);
end;
//--------------------------------------------------------------------------------------------------
function TJclPeBorTD32Image.IsDebugInfoInImage(var DataStream: TCustomMemoryStream): Boolean;
var
DebugDir: TImageDebugDirectory;
BugDataStart: Pointer;
DebugDataSize: Integer;
begin
Result := False;
DataStream := nil;
if IsBorlandImage and (DebugList.Count = 1) then
begin
DebugDir := DebugList[0];
if DebugDir._Type = IMAGE_DEBUG_TYPE_UNKNOWN then
begin
BugDataStart := RvaToVa(DebugDir.AddressOfRawData);
DebugDataSize := DebugDir.SizeOfData;
Result := TJclTD32InfoParser.IsTD32DebugInfoValid(BugDataStart, DebugDataSize);
if Result then
DataStream := TJclReferenceMemoryStream.Create(BugDataStart, DebugDataSize);
end;
end;
end;
//--------------------------------------------------------------------------------------------------
function TJclPeBorTD32Image.IsDebugInfoInTds(var DataStream: TCustomMemoryStream): Boolean;
var
TdsFileName: TFileName;
TempStream: TCustomMemoryStream;
begin
Result := False;
DataStream := nil;
TdsFileName := ChangeFileExt(FileName, TurboDebuggerSymbolExt);
if FileExists(TdsFileName) then
begin
TempStream := TJclFileMappingStream.Create(TdsFileName);
try
Result := TJclTD32InfoParser.IsTD32DebugInfoValid(TempStream.Memory, TempStream.Size);
if Result then
DataStream := TempStream
else
TempStream.Free;
except
TempStream.Free;
raise;
end;
end;
end;
end.
| 35.378139 | 116 | 0.5777 |
fcf600baac73af1a87ca793f8af107ad1d6ecf2c | 1,679 | pas | Pascal | main/personmodel.pas | joshluisaac/onLazarus | c46328f694195a913334c88a791afef023d6a212 | [
"Apache-2.0"
]
| null | null | null | main/personmodel.pas | joshluisaac/onLazarus | c46328f694195a913334c88a791afef023d6a212 | [
"Apache-2.0"
]
| null | null | null | main/personmodel.pas | joshluisaac/onLazarus | c46328f694195a913334c88a791afef023d6a212 | [
"Apache-2.0"
]
| null | null | null | unit PersonModel;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
type
Tperson = class
private
FfirstName : String;
FmiddleName : String;
FlastName : String;
public
constructor create(firstName : String; middleName : String; lastName : String);
function getFirstName() : String;
function getMiddleName() : String;
function getLastName() : String;
function format(): string;
procedure setFirstName(firstName : String);
procedure setMiddleName(middleName : String);
procedure setLastName(lastName : String);
end;
implementation
function Tperson.format(): string;
var formattedMsg : string;
begin
formattedMsg := '';
formattedMsg:= 'First Name :' + #9 + self.FfirstName + sLineBreak;
formattedMsg:= formattedMsg + 'Middle Name :' + #9 + self.FmiddleName + sLineBreak;
formattedMsg:= formattedMsg + 'Last Name :' + #9 + self.FlastName;
Result := formattedMsg;
end;
function Tperson.getFirstName(): String;
begin
Result := self.FfirstName;
end;
procedure Tperson.setFirstName(firstName: string);
begin
self.FfirstName := firstName;
end;
function Tperson.getMiddleName(): String;
begin
Result := self.FmiddleName;
end;
procedure Tperson.setMiddleName(middleName: string);
begin
self.FmiddleName := middleName;
end;
function Tperson.getLastName(): String;
begin
Result := self.FlastName;
end;
procedure Tperson.setLastName(lastName: string);
begin
self.FlastName := lastName;
end;
constructor Tperson.create(firstName : String; middleName : String; lastName : String);
begin
self.FfirstName := firstName;
self.FmiddleName := middleName;
self.FlastName := lastName;
end;
end.
| 20.728395 | 88 | 0.719476 |
fcbae8a678fcd41507c967734a4496a5356223f0 | 71,025 | dfm | Pascal | source/uBD.dfm | roneysousa/infoimobiliaria | c15ea09fd7fe2f79a4d6b0f2affe29192f022c18 | [
"MIT"
]
| null | null | null | source/uBD.dfm | roneysousa/infoimobiliaria | c15ea09fd7fe2f79a4d6b0f2affe29192f022c18 | [
"MIT"
]
| null | null | null | source/uBD.dfm | roneysousa/infoimobiliaria | c15ea09fd7fe2f79a4d6b0f2affe29192f022c18 | [
"MIT"
]
| null | null | null | object dmBD: TdmBD
OldCreateOrder = False
OnCreate = DataModuleCreate
Left = 233
Top = 194
Height = 381
Width = 544
object tbClientes: TTable
AfterPost = tbClientesAfterPost
DatabaseName = 'NETIMO'
TableName = 'SACCLI.db'
Left = 24
Top = 56
object tbClientesCLI_CDCLIE: TStringField
Alignment = taRightJustify
DisplayLabel = 'C'#243'digo'
DisplayWidth = 10
FieldName = 'CLI_CDCLIE'
Size = 7
end
object tbClientesCLI_NMCLIE: TStringField
DisplayLabel = 'Cliente'
DisplayWidth = 42
FieldName = 'CLI_NMCLIE'
Size = 40
end
object tbClientesCLI_DTATUA: TDateField
Alignment = taRightJustify
DisplayWidth = 10
FieldName = 'CLI_DTATUA'
Visible = False
EditMask = '99/99/9999;1;_'
end
object tbClientesCLI_DTNASC: TDateField
Alignment = taRightJustify
DisplayWidth = 10
FieldName = 'CLI_DTNASC'
Visible = False
EditMask = '99/99/9999;1;_'
end
object tbClientesCLI_ENCLIE: TStringField
DisplayWidth = 40
FieldName = 'CLI_ENCLIE'
Visible = False
Size = 40
end
object tbClientesCLI_BAIRRO: TStringField
DisplayWidth = 20
FieldName = 'CLI_BAIRRO'
Visible = False
end
object tbClientesCLI_NMCONJ: TStringField
DisplayWidth = 40
FieldName = 'CLI_NMCONJ'
Visible = False
Size = 40
end
object tbClientesCLI_NRFONE: TStringField
Alignment = taRightJustify
DisplayWidth = 13
FieldName = 'CLI_NRFONE'
Visible = False
EditMask = '(99)9999-9999;1;_'
Size = 13
end
object tbClientesCLI_NUMFAX: TStringField
Alignment = taRightJustify
DisplayWidth = 13
FieldName = 'CLI_NUMFAX'
Visible = False
EditMask = '(99)9999-9999;1;_'
Size = 13
end
object tbClientesCLI_CONT01: TStringField
DisplayWidth = 20
FieldName = 'CLI_CONT01'
Visible = False
end
object tbClientesCLI_FONE01: TStringField
Alignment = taRightJustify
DisplayWidth = 13
FieldName = 'CLI_FONE01'
Visible = False
EditMask = '9999-9999;1;_'
Size = 13
end
object tbClientesCLI_CIDADE: TStringField
DisplayWidth = 20
FieldName = 'CLI_CIDADE'
Visible = False
end
object tbClientesCLI_CEPCLI: TStringField
Alignment = taRightJustify
DisplayWidth = 9
FieldName = 'CLI_CEPCLI'
Visible = False
EditMask = '99999-999;1;_'
Size = 9
end
object tbClientesCLI_IDEINS: TStringField
Alignment = taRightJustify
DisplayWidth = 14
FieldName = 'CLI_IDEINS'
Visible = False
Size = 14
end
object tbClientesCLI_NRCGC: TStringField
Alignment = taRightJustify
DisplayWidth = 18
FieldName = 'CLI_NRCGC'
Visible = False
EditMask = '99.999.999/9999-99;1;_'
Size = 18
end
object tbClientesCLI_NRINS: TStringField
Alignment = taRightJustify
DisplayWidth = 17
FieldName = 'CLI_NRINS'
Visible = False
EditMask = '99.999999-9/99999;1;_'
Size = 17
end
object tbClientesCLI_OREMIS: TStringField
DisplayWidth = 5
FieldName = 'CLI_OREMIS'
Visible = False
Size = 5
end
object tbClientesCLI_UFEMIS: TStringField
DisplayWidth = 2
FieldName = 'CLI_UFEMIS'
Visible = False
Size = 2
end
object tbClientesCLI_UFCLIE: TStringField
DisplayWidth = 2
FieldName = 'CLI_UFCLIE'
Visible = False
Size = 2
end
object tbClientesCLI_NOMEMP: TStringField
DisplayWidth = 40
FieldName = 'CLI_NOMEMP'
Visible = False
Size = 40
end
object tbClientesCLI_NOMPAI: TStringField
DisplayWidth = 40
FieldName = 'CLI_NOMPAI'
Visible = False
Size = 40
end
object tbClientesCLI_NOMMAE: TStringField
DisplayWidth = 40
FieldName = 'CLI_NOMMAE'
Visible = False
Size = 40
end
object tbClientesCLI_NOMFUN: TStringField
DisplayWidth = 20
FieldName = 'CLI_NOMFUN'
Visible = False
end
object tbClientesCLI_ENDEMP: TStringField
DisplayWidth = 40
FieldName = 'CLI_ENDEMP'
Visible = False
Size = 40
end
object tbClientesCLI_BAIEMP: TStringField
DisplayWidth = 20
FieldName = 'CLI_BAIEMP'
Visible = False
end
object tbClientesCLI_CIDEMP: TStringField
DisplayWidth = 20
FieldName = 'CLI_CIDEMP'
Visible = False
end
object tbClientesCLI_UFEMPR: TStringField
DisplayWidth = 2
FieldName = 'CLI_UFEMPR'
Visible = False
Size = 2
end
object tbClientesCLI_FONEMP: TStringField
Alignment = taRightJustify
DisplayWidth = 13
FieldName = 'CLI_FONEMP'
Visible = False
EditMask = '(99)9999-9999;1;_'
Size = 13
end
object tbClientesCLI_VLREND: TCurrencyField
DisplayWidth = 10
FieldName = 'CLI_VLREND'
Visible = False
end
object tbClientesCLI_DTCADA: TDateField
DisplayWidth = 10
FieldName = 'CLI_DTCADA'
Visible = False
end
object tbClientesCLI_DTADMI: TDateField
Alignment = taRightJustify
DisplayWidth = 10
FieldName = 'CLI_DTADMI'
Visible = False
EditMask = '99/99/9999;1;_'
end
object tbClientesCLI_DTSAID: TDateField
Alignment = taRightJustify
DisplayWidth = 10
FieldName = 'CLI_DTSAID'
Visible = False
EditMask = '99/99/9999;1;_'
end
object tbClientesCLI_SEXO: TStringField
DisplayWidth = 10
FieldName = 'CLI_SEXO'
Visible = False
Size = 10
end
object tbClientesCLI_TPPESS: TBooleanField
DisplayWidth = 5
FieldName = 'CLI_TPPESS'
Visible = False
end
object tbClientesCLI_CPFCGC: TStringField
Alignment = taRightJustify
DisplayWidth = 18
FieldName = 'CLI_CPFCGC'
Visible = False
EditMask = '999.999.999-99;1;_'
Size = 18
end
object tbClientesCLI_TPSITU: TStringField
DisplayWidth = 8
FieldName = 'CLI_TPSITU'
Visible = False
Size = 8
end
object tbClientesCLI_NMSITU: TStringField
DisplayWidth = 40
FieldName = 'CLI_NMSITU'
Visible = False
Size = 40
end
object tbClientesCLI_NMCONJUGUE: TStringField
DisplayWidth = 40
FieldName = 'CLI_NMCONJUGUE'
Visible = False
Size = 40
end
object tbClientesCLI_RGCONJ: TStringField
Alignment = taRightJustify
DisplayWidth = 14
FieldName = 'CLI_RGCONJ'
Visible = False
Size = 14
end
object tbClientesCLI_CPFCON: TStringField
Alignment = taRightJustify
DisplayWidth = 18
FieldName = 'CLI_CPFCON'
Visible = False
Size = 18
end
object tbClientesCLI_OECONJ: TStringField
DisplayWidth = 5
FieldName = 'CLI_OECONJ'
Visible = False
Size = 5
end
object tbClientesCLI_EMAIL: TStringField
DisplayWidth = 30
FieldName = 'CLI_EMAIL'
Visible = False
Size = 30
end
object tbClientesCLI_NACION: TStringField
DisplayWidth = 20
FieldName = 'CLI_NACION'
Visible = False
end
object tbClientesCLI_NATURA: TStringField
DisplayWidth = 20
FieldName = 'CLI_NATURA'
Visible = False
end
object tbClientesCLI_ESTCIV: TStringField
DisplayWidth = 11
FieldName = 'CLI_ESTCIV'
Visible = False
Size = 11
end
object tbClientesCLI_CDUSUA: TStringField
FieldName = 'CLI_CDUSUA'
Size = 3
end
end
object tbParametros: TTable
AfterPost = tbParametrosAfterPost
DatabaseName = 'NETIMO'
TableName = 'SACPAR.db'
Left = 24
Top = 8
object tbParametrosPAR_NMEMPR: TStringField
FieldName = 'PAR_NMEMPR'
Size = 50
end
object tbParametrosPAR_ENEMPR: TStringField
FieldName = 'PAR_ENEMPR'
Size = 40
end
object tbParametrosPAR_BAEMPR: TStringField
FieldName = 'PAR_BAEMPR'
end
object tbParametrosPAR_CIEMPR: TStringField
FieldName = 'PAR_CIEMPR'
end
object tbParametrosPAR_CEPEMP: TStringField
FieldName = 'PAR_CEPEMP'
EditMask = '99999-999;1;_'
Size = 9
end
object tbParametrosPAR_UFEMPR: TStringField
FieldName = 'PAR_UFEMPR'
Size = 2
end
object tbParametrosPAR_CGCEMP: TStringField
FieldName = 'PAR_CGCEMP'
EditMask = '99.999.999/9999-99;1;_'
Size = 18
end
object tbParametrosPAR_INSEST: TStringField
FieldName = 'PAR_INSEST'
Size = 17
end
object tbParametrosPAR_NRFONE: TStringField
FieldName = 'PAR_NRFONE'
EditMask = '(99)9999-9999;1;_'
Size = 13
end
object tbParametrosPAR_NUMFAX: TStringField
FieldName = 'PAR_NUMFAX'
EditMask = '(99)9999-9999;1;_'
Size = 13
end
object tbParametrosPAR_CDFORN: TFloatField
FieldName = 'PAR_CDFORN'
end
object tbParametrosPAR_CDCLIE: TFloatField
FieldName = 'PAR_CDCLIE'
end
object tbParametrosPAR_NRSEQU: TFloatField
FieldName = 'PAR_NRSEQU'
end
object tbParametrosPAR_DTATUA: TDateField
FieldName = 'PAR_DTATUA'
end
object tbParametrosPAR_CDIMOV: TFloatField
FieldName = 'PAR_CDIMOV'
end
object tbParametrosPAR_CDPROD: TFloatField
FieldName = 'PAR_CDPROD'
end
object tbParametrosPAR_CDPAGA: TSmallintField
FieldName = 'PAR_CDPAGA'
end
object tbParametrosPAR_CDCOMP: TStringField
FieldName = 'PAR_CDCOMP'
Size = 10
end
object tbParametrosPAR_NRCOMP: TFloatField
FieldName = 'PAR_NRCOMP'
end
object tbParametrosPAR_NRRECE: TFloatField
FieldName = 'PAR_NRRECE'
end
object tbParametrosPAR_NMCEDE: TStringField
FieldName = 'PAR_NMCEDE'
end
object tbParametrosPAR_CONTA: TStringField
FieldName = 'PAR_CONTA'
Size = 12
end
object tbParametrosPAR_NRAGEN: TStringField
FieldName = 'PAR_NRAGEN'
Size = 5
end
object tbParametrosPAR_LOCPAG: TStringField
FieldName = 'PAR_LOCPAG'
Size = 50
end
object tbParametrosPAR_NRDOCU: TFloatField
FieldName = 'PAR_NRDOCU'
end
object tbParametrosPAR_CDCONT: TFloatField
FieldName = 'PAR_CDCONT'
end
object tbParametrosPAR_CDEMPR: TFloatField
FieldName = 'PAR_CDEMPR'
end
object tbParametrosPAR_CDINDI: TFloatField
FieldName = 'PAR_CDINDI'
end
object tbParametrosPAR_CDBALA: TFloatField
FieldName = 'PAR_CDBALA'
end
object tbParametrosPAR_CDCORR: TFloatField
FieldName = 'PAR_CDCORR'
end
object tbParametrosPAR_CDPRES: TFloatField
FieldName = 'PAR_CDPRES'
end
object tbParametrosPAR_CDBANC: TStringField
FieldName = 'PAR_CDBANC'
Size = 3
end
object tbParametrosPAR_CDSTIM: TStringField
FieldName = 'PAR_CDSTIM'
Size = 3
end
object tbParametrosPAR_NRVEND: TFloatField
FieldName = 'PAR_NRVEND'
end
object tbParametrosPAR_CDUSUA: TFloatField
FieldName = 'PAR_CDUSUA'
end
object tbParametrosPAR_IMAGEM: TGraphicField
FieldName = 'PAR_IMAGEM'
BlobType = ftGraphic
end
end
object tbFornecedores: TTable
AfterPost = tbFornecedoresAfterPost
DatabaseName = 'NETIMO'
TableName = 'SACFOR.db'
TableType = ttParadox
Left = 24
Top = 104
object tbFornecedoresFOR_CDFORN: TStringField
Alignment = taRightJustify
FieldName = 'FOR_CDFORN'
Size = 5
end
object tbFornecedoresFOR_NMFORN: TStringField
FieldName = 'FOR_NMFORN'
Size = 15
end
object tbFornecedoresFOR_RAFORN: TStringField
FieldName = 'FOR_RAFORN'
Size = 40
end
object tbFornecedoresFOR_CGCFOR: TStringField
FieldName = 'FOR_CGCFOR'
EditMask = '99.999.999/9999-99;1;_'
Size = 18
end
object tbFornecedoresFOR_ENDERE: TStringField
FieldName = 'FOR_ENDERE'
Size = 40
end
object tbFornecedoresFOR_BAIRRO: TStringField
FieldName = 'FOR_BAIRRO'
end
object tbFornecedoresFOR_NRFONE: TStringField
FieldName = 'FOR_NRFONE'
EditMask = '(99)9999-9999;1;_'
Size = 13
end
object tbFornecedoresFOR_FAXFOR: TStringField
FieldName = 'FOR_FAXFOR'
EditMask = '(99)9999-9999;1;_'
Size = 13
end
object tbFornecedoresFOR_NRRAMA: TStringField
FieldName = 'FOR_NRRAMA'
EditMask = '9999;1;_'
Size = 4
end
object tbFornecedoresFOR_NRTELE: TStringField
FieldName = 'FOR_NRTELE'
EditMask = '9999-9999;1;_'
Size = 9
end
object tbFornecedoresFOR_CIDADE: TStringField
FieldName = 'FOR_CIDADE'
end
object tbFornecedoresFOR_UFFORN: TStringField
FieldName = 'FOR_UFFORN'
Size = 2
end
object tbFornecedoresFOR_CEPFOR: TStringField
FieldName = 'FOR_CEPFOR'
EditMask = '99999-999;1;_'
Size = 9
end
object tbFornecedoresFOR_INESTA: TStringField
FieldName = 'FOR_INESTA'
EditMask = '99.999999-9/99999;1;_'
Size = 17
end
object tbFornecedoresFOR_CDUSUA: TStringField
FieldName = 'FOR_CDUSUA'
Size = 3
end
end
object tbTiposImovel: TTable
AfterPost = tbTiposImovelAfterPost
DatabaseName = 'NETIMO'
TableName = 'SACTPI.db'
Left = 24
Top = 200
object tbTiposImovelTPI_CDTIPO: TStringField
FieldName = 'TPI_CDTIPO'
Size = 3
end
object tbTiposImovelTPI_NMDESC: TStringField
FieldName = 'TPI_NMDESC'
Size = 30
end
end
object tbImoveis: TTable
AfterPost = tbImoveisAfterPost
DatabaseName = 'NETIMO'
IndexFieldNames = 'IMO_CDIMOV'
TableName = 'SACIMO.db'
Left = 24
Top = 152
object tbImoveisIMO_CDIMOV: TStringField
DisplayWidth = 12
FieldName = 'IMO_CDIMOV'
Size = 10
end
object tbImoveisIMO_NMTIPO: TStringField
DisplayLabel = 'Descri'#231#227'o'
DisplayWidth = 20
FieldKind = fkLookup
FieldName = 'IMO_NMTIPO'
LookupDataSet = tbTiposImovel
LookupKeyFields = 'TPI_CDTIPO'
LookupResultField = 'TPI_NMDESC'
KeyFields = 'IMO_TPIMOV'
Size = 12
Lookup = True
end
object tbImoveisIMO_VLIMOV: TCurrencyField
DisplayLabel = 'Valor'
DisplayWidth = 15
FieldName = 'IMO_VLIMOV'
end
object tbImoveisIMO_FLIMOV: TStringField
DisplayLabel = 'Situa'#231#227'o'
DisplayWidth = 11
FieldName = 'IMO_FLIMOV'
Size = 10
end
object tbImoveisIMO_CDEMPR: TStringField
DisplayWidth = 10
FieldName = 'IMO_CDEMPR'
Visible = False
Size = 10
end
object tbImoveisIMO_CDCLIE: TStringField
DisplayWidth = 7
FieldName = 'IMO_CDCLIE'
Visible = False
Size = 7
end
object tbImoveisIMO_NMCLIE: TStringField
DisplayWidth = 40
FieldKind = fkLookup
FieldName = 'IMO_NMCLIE'
LookupDataSet = tbClientes
LookupKeyFields = 'CLI_CDCLIE'
LookupResultField = 'CLI_NMCLIE'
KeyFields = 'IMO_CDCLIE'
Visible = False
Size = 40
Lookup = True
end
object tbImoveisIMO_TPIMOV: TStringField
DisplayLabel = 'Tipo Im'#243'vel'
DisplayWidth = 3
FieldName = 'IMO_TPIMOV'
Visible = False
Size = 3
end
object tbImoveisIMO_ENDIMO: TStringField
DisplayWidth = 40
FieldName = 'IMO_ENDIMO'
Visible = False
Size = 40
end
object tbImoveisIMO_BAIRRO: TStringField
DisplayWidth = 30
FieldName = 'IMO_BAIRRO'
Visible = False
Size = 30
end
object tbImoveisIMO_CIDADE: TStringField
DisplayWidth = 30
FieldName = 'IMO_CIDADE'
Visible = False
Size = 30
end
object tbImoveisIMO_UFIMOV: TStringField
DisplayWidth = 2
FieldName = 'IMO_UFIMOV'
Visible = False
Size = 2
end
object tbImoveisIMO_CEDPIMO: TStringField
DisplayWidth = 9
FieldName = 'IMO_CEDPIMO'
Visible = False
EditMask = '99999-999;1;_'
Size = 9
end
object tbImoveisIMO_NRQUAR: TSmallintField
DisplayWidth = 10
FieldName = 'IMO_NRQUAR'
Visible = False
end
object tbImoveisIMO_NRBANH: TSmallintField
DisplayWidth = 10
FieldName = 'IMO_NRBANH'
Visible = False
end
object tbImoveisIMO_DTTERM: TDateField
DisplayWidth = 10
FieldName = 'IMO_DTTERM'
Visible = False
EditMask = '99/99/9999;1;_'
end
object tbImoveisIMO_FLGARA: TBooleanField
DisplayWidth = 5
FieldName = 'IMO_FLGARA'
Visible = False
end
object tbImoveisIMO_AREA: TFloatField
DisplayWidth = 10
FieldName = 'IMO_AREA'
Visible = False
end
object tbImoveisIMO_OBSERV: TMemoField
DisplayWidth = 10
FieldName = 'IMO_OBSERV'
Visible = False
BlobType = ftMemo
Size = 240
end
object tbImoveisIMO_NRIMOV: TStringField
Alignment = taRightJustify
DisplayWidth = 10
FieldName = 'IMO_NRIMOV'
Visible = False
Size = 10
end
object tbImoveisIMO_NMEMPR: TStringField
DisplayWidth = 30
FieldKind = fkLookup
FieldName = 'IMO_NMEMPR'
LookupDataSet = tbEmpredim
LookupKeyFields = 'EMP_CDEMPR'
LookupResultField = 'EMP_NMEMPR'
KeyFields = 'IMO_CDEMPR'
Visible = False
Size = 30
Lookup = True
end
object tbImoveisIMO_QTCOMO: TSmallintField
FieldName = 'IMO_QTCOMO'
end
object tbImoveisIMO_DTINIC: TDateField
FieldName = 'IMO_DTINIC'
EditMask = '99/99/9999;1;_'
end
object tbImoveisIMO_QTMESE: TSmallintField
FieldName = 'IMO_QTMESE'
end
object tbImoveisIMO_QTVAGA: TSmallintField
FieldName = 'IMO_QTVAGA'
end
object tbImoveisIMO_MEFRET: TFloatField
FieldName = 'IMO_MEFRET'
end
object tbImoveisIMO_MEFUND: TFloatField
FieldName = 'IMO_MEFUND'
end
object tbImoveisIMO_CDUSUA: TStringField
FieldName = 'IMO_CDUSUA'
Size = 3
end
end
object BancoDados: TDatabase
AliasName = 'NETIMO'
DatabaseName = 'NETIMO'
SessionName = 'Default'
TransIsolation = tiDirtyRead
Left = 352
Top = 16
end
object Session1: TSession
Left = 352
Top = 64
end
object tbContPagar: TTable
AfterPost = tbContPagarAfterPost
OnCalcFields = tbContPagarCalcFields
DatabaseName = 'NETIMO'
IndexFieldNames = 'PAG_NRCOMP'
TableName = 'SACPAG.db'
Left = 96
Top = 8
object tbContPagarPAG_NRCOMP: TStringField
Alignment = taRightJustify
FieldName = 'PAG_NRCOMP'
Size = 7
end
object tbContPagarPAG_CDCOMP: TStringField
Alignment = taRightJustify
FieldName = 'PAG_CDCOMP'
Size = 10
end
object tbContPagarPAG_CDLOJA: TStringField
Alignment = taRightJustify
FieldName = 'PAG_CDLOJA'
Size = 3
end
object tbContPagarPAG_NRPEDI: TStringField
Alignment = taRightJustify
FieldName = 'PAG_NRPEDI'
Size = 10
end
object tbContPagarPAG_NRPARC: TStringField
Alignment = taRightJustify
FieldName = 'PAG_NRPARC'
Size = 2
end
object tbContPagarPAG_DTCOMP: TDateField
FieldName = 'PAG_DTCOMP'
EditMask = '99/99/9999;1;_'
end
object tbContPagarPAG_DTVENC: TDateField
FieldName = 'PAG_DTVENC'
EditMask = '99/99/9999;1;_'
end
object tbContPagarPAG_DTPAGA: TDateField
FieldName = 'PAG_DTPAGA'
EditMask = '99/99/9999;1;_'
end
object tbContPagarPAG_CDFORN: TStringField
FieldName = 'PAG_CDFORN'
Size = 5
end
object tbContPagarPAG_TMGARA: TStringField
FieldName = 'PAG_TMGARA'
end
object tbContPagarPAG_NRNOTA: TStringField
FieldName = 'PAG_NRNOTA'
Size = 10
end
object tbContPagarPAG_NRSERI: TStringField
FieldName = 'PAG_NRSERI'
Size = 2
end
object tbContPagarPAG_CDNATU: TStringField
FieldName = 'PAG_CDNATU'
Size = 2
end
object tbContPagarPAG_NMDESC: TStringField
FieldName = 'PAG_NMDESC'
Size = 50
end
object tbContPagarPAG_VLCOMP: TCurrencyField
FieldName = 'PAG_VLCOMP'
end
object tbContPagarPAG_VLPARC: TCurrencyField
FieldName = 'PAG_VLPARC'
end
object tbContPagarPAG_VLJURO: TCurrencyField
FieldName = 'PAG_VLJURO'
currency = False
end
object tbContPagarPAG_VLDESC: TCurrencyField
FieldName = 'PAG_VLDESC'
currency = False
end
object tbContPagarPAG_VLDEAN: TCurrencyField
FieldName = 'PAG_VLDEAN'
end
object tbContPagarPAG_FLSITU: TStringField
FieldName = 'PAG_FLSITU'
Size = 1
end
object tbContPagarPAG_CDUSUA: TStringField
FieldName = 'PAG_CDUSUA'
Size = 3
end
object tbContPagarPAG_CDPAGA: TStringField
FieldName = 'PAG_CDPAGA'
Size = 2
end
object tbContPagarPAG_CDBANC: TStringField
FieldName = 'PAG_CDBANC'
EditMask = '999;1;_'
Size = 3
end
object tbContPagarPAG_NRAGEN: TStringField
Alignment = taRightJustify
FieldName = 'PAG_NRAGEN'
Size = 5
end
object tbContPagarPAG_NRCONT: TStringField
Alignment = taRightJustify
FieldName = 'PAG_NRCONT'
Size = 12
end
object tbContPagarPAG_NRCHEQ: TStringField
Alignment = taRightJustify
FieldName = 'PAG_NRCHEQ'
Size = 7
end
object tbContPagarPAG_ANOTAC: TMemoField
FieldName = 'PAG_ANOTAC'
BlobType = ftMemo
Size = 200
end
object tbContPagarPAG_NMFORN: TStringField
FieldKind = fkLookup
FieldName = 'PAG_NMFORN'
LookupDataSet = tbFornecedores
LookupKeyFields = 'FOR_CDFORN'
LookupResultField = 'FOR_NMFORN'
KeyFields = 'PAG_CDFORN'
Size = 30
Lookup = True
end
object tbContPagarPAG_DIASAT: TIntegerField
FieldKind = fkCalculated
FieldName = 'PAG_DIASAT'
Calculated = True
end
object tbContPagarPAG_FLPRED: TBooleanField
FieldName = 'PAG_FLPRED'
end
object tbContPagarPAG_DTPRED: TDateField
Alignment = taRightJustify
FieldName = 'PAG_DTPRED'
EditMask = '99/99/9999;1;_'
end
object tbContPagarPAG_QTDIAS: TFloatField
FieldName = 'PAG_QTDIAS'
end
object tbContPagarPAG_FLEMPR: TBooleanField
FieldName = 'PAG_FLEMPR'
end
object tbContPagarPAG_CDEMPR: TStringField
FieldName = 'PAG_CDEMPR'
Size = 5
end
end
object tbContReceber: TTable
AfterPost = tbContReceberAfterPost
OnCalcFields = tbContReceberCalcFields
DatabaseName = 'NETIMO'
TableName = 'SACREC.db'
Left = 96
Top = 56
object tbContReceberREC_NRRECE: TStringField
Alignment = taRightJustify
FieldName = 'REC_NRRECE'
Size = 13
end
object tbContReceberREC_NRSEQU: TStringField
Alignment = taRightJustify
FieldName = 'REC_NRSEQU'
Size = 10
end
object tbContReceberREC_NRPARC: TStringField
Alignment = taRightJustify
FieldName = 'REC_NRPARC'
Size = 2
end
object tbContReceberREC_CDLOJA: TStringField
Alignment = taRightJustify
FieldName = 'REC_CDLOJA'
EditMask = '999;1;_'
Size = 3
end
object tbContReceberREC_CDUSUA: TStringField
Alignment = taRightJustify
FieldName = 'REC_CDUSUA'
Size = 3
end
object tbContReceberREC_CDCLIE: TStringField
Alignment = taRightJustify
FieldName = 'REC_CDCLIE'
EditMask = '9999999;1;_'
Size = 7
end
object tbContReceberREC_DTCADA: TDateField
Alignment = taRightJustify
FieldName = 'REC_DTCADA'
EditMask = '99/99/9999;1;_'
end
object tbContReceberREC_DTVENC: TDateField
Alignment = taRightJustify
FieldName = 'REC_DTVENC'
EditMask = '99/99/9999;1;_'
end
object tbContReceberREC_DTRECE: TDateField
Alignment = taRightJustify
FieldName = 'REC_DTRECE'
EditMask = '99/99/9999;1;_'
end
object tbContReceberREC_HORECE: TStringField
Alignment = taRightJustify
FieldName = 'REC_HORECE'
EditMask = '99:99;1;_'
Size = 5
end
object tbContReceberREC_VLTOTA: TCurrencyField
FieldName = 'REC_VLTOTA'
end
object tbContReceberREC_VLDESC: TCurrencyField
FieldName = 'REC_VLDESC'
currency = False
end
object tbContReceberREC_VLJURO: TCurrencyField
FieldName = 'REC_VLJURO'
currency = False
end
object tbContReceberREC_VLPARC: TCurrencyField
FieldName = 'REC_VLPARC'
end
object tbContReceberREC_VLPAGO: TCurrencyField
FieldName = 'REC_VLPAGO'
end
object tbContReceberREC_CDMODA: TStringField
FieldName = 'REC_CDMODA'
Size = 2
end
object tbContReceberREC_VLMODA: TCurrencyField
FieldName = 'REC_VLMODA'
end
object tbContReceberREC_VLDEBI: TCurrencyField
FieldName = 'REC_VLDEBI'
end
object tbContReceberREC_NRAUTE: TStringField
FieldName = 'REC_NRAUTE'
Size = 13
end
object tbContReceberREC_FLCAIX: TStringField
FieldName = 'REC_FLCAIX'
Size = 1
end
object tbContReceberREC_NRCONC: TStringField
FieldName = 'REC_NRCONC'
Size = 7
end
object tbContReceberREC_LJORIG: TStringField
FieldName = 'REC_LJORIG'
Size = 3
end
object tbContReceberREC_FLRECE: TStringField
FieldName = 'REC_FLRECE'
Size = 1
end
object tbContReceberREC_NMDESC: TStringField
FieldName = 'REC_NMDESC'
Size = 40
end
object tbContReceberREC_NMCLIE: TStringField
FieldKind = fkLookup
FieldName = 'REC_NMCLIE'
LookupDataSet = tbClientes
LookupKeyFields = 'CLI_CDCLIE'
LookupResultField = 'CLI_NMCLIE'
KeyFields = 'REC_CDCLIE'
Size = 40
Lookup = True
end
object tbContReceberREC_DIASAT: TIntegerField
FieldKind = fkCalculated
FieldName = 'REC_DIASAT'
Calculated = True
end
object tbContReceberREC_CDBANC: TStringField
FieldName = 'REC_CDBANC'
Size = 3
end
object tbContReceberREC_NRAGEN: TStringField
FieldName = 'REC_NRAGEN'
Size = 5
end
object tbContReceberREC_NRCONT: TStringField
FieldName = 'REC_NRCONT'
Size = 12
end
object tbContReceberREC_NRCHEQ: TStringField
FieldName = 'REC_NRCHEQ'
Size = 7
end
object tbContReceberREC_FLPRED: TBooleanField
FieldName = 'REC_FLPRED'
end
object tbContReceberREC_DTPRED: TDateField
FieldName = 'REC_DTPRED'
EditMask = '99/99/9999;1;_'
end
object tbContReceberREC_CDEMPR: TStringField
FieldName = 'REC_CDEMPR'
Size = 5
end
object tbContReceberREC_CDCONT: TStringField
FieldName = 'REC_CDCONT'
Size = 10
end
object tbContReceberREC_CDPRES: TStringField
FieldName = 'REC_CDPRES'
Size = 13
end
object tbContReceberREC_TPPRES: TStringField
FieldName = 'REC_TPPRES'
Size = 1
end
object tbContReceberREC_FLPARC: TBooleanField
FieldName = 'REC_FLPARC'
end
object tbContReceberREC_VLANTE: TCurrencyField
FieldName = 'REC_VLANTE'
end
object tbContReceberREC_QTDIAS: TFloatField
FieldName = 'REC_QTDIAS'
end
end
object tbEscritorio: TTable
AfterPost = tbEscritorioAfterPost
DatabaseName = 'NETIMO'
TableName = 'SACLOJ.db'
Left = 96
Top = 104
object tbEscritorioLOJ_CDLOJA: TStringField
Alignment = taRightJustify
FieldName = 'LOJ_CDLOJA'
Size = 3
end
object tbEscritorioLOJ_NMLOJA: TStringField
FieldName = 'LOJ_NMLOJA'
Size = 40
end
object tbEscritorioLOJ_NMRAZA: TStringField
FieldName = 'LOJ_NMRAZA'
Size = 40
end
object tbEscritorioLOJ_CGCLOJ: TStringField
Alignment = taRightJustify
FieldName = 'LOJ_CGCLOJ'
EditMask = '99.999.999/9999-99;1;_'
Size = 18
end
object tbEscritorioLOJ_ENDERE: TStringField
FieldName = 'LOJ_ENDERE'
Size = 40
end
object tbEscritorioLOJ_BAIRRO: TStringField
FieldName = 'LOJ_BAIRRO'
end
object tbEscritorioLOJ_CIDADE: TStringField
FieldName = 'LOJ_CIDADE'
end
object tbEscritorioLOJ_UFLOJA: TStringField
FieldName = 'LOJ_UFLOJA'
Size = 2
end
object tbEscritorioLOJ_CEPLOJ: TStringField
Alignment = taRightJustify
FieldName = 'LOJ_CEPLOJ'
EditMask = '99999-999;1;_'
Size = 9
end
object tbEscritorioLOJ_NRFONE: TStringField
Alignment = taRightJustify
FieldName = 'LOJ_NRFONE'
EditMask = '(99)9999-9999;1;_'
Size = 13
end
object tbEscritorioLOJ_INESTA: TStringField
Alignment = taRightJustify
FieldName = 'LOJ_INESTA'
EditMask = '99.999999-9/99999;1;_'
Size = 17
end
object tbEscritorioLOJ_NRSEQU: TStringField
Alignment = taRightJustify
FieldName = 'LOJ_NRSEQU'
Size = 10
end
object tbEscritorioLOJ_DTCAIX: TDateField
FieldName = 'LOJ_DTCAIX'
EditMask = '99/99/9999;1;_'
end
object tbEscritorioLOJ_NRVEND: TStringField
Alignment = taRightJustify
FieldName = 'LOJ_NRVEND'
Size = 7
end
object tbEscritorioLOJ_CDCAIX: TStringField
FieldName = 'LOJ_CDCAIX'
Size = 3
end
end
object tbBancos: TTable
AfterPost = tbBancosAfterPost
DatabaseName = 'NETIMO'
TableName = 'SACBAN.db'
Left = 96
Top = 152
object tbBancosBAN_CDBANC: TStringField
Alignment = taRightJustify
FieldName = 'BAN_CDBANC'
Size = 3
end
object tbBancosBAN_NMBANC: TStringField
FieldName = 'BAN_NMBANC'
Size = 30
end
end
object tbCheques: TTable
AfterPost = tbChequesAfterPost
DatabaseName = 'NETIMO'
TableName = 'SACCHE.db'
Left = 96
Top = 200
object tbChequesCHE_NRVEND: TStringField
Alignment = taRightJustify
FieldName = 'CHE_NRVEND'
Size = 7
end
object tbChequesCHE_CDLOJA: TStringField
Alignment = taRightJustify
FieldName = 'CHE_CDLOJA'
Size = 3
end
object tbChequesCHE_CDRESP: TStringField
Alignment = taRightJustify
FieldName = 'CHE_CDRESP'
Size = 7
end
object tbChequesCHE_CDBANC: TStringField
Alignment = taRightJustify
FieldName = 'CHE_CDBANC'
Size = 3
end
object tbChequesCHE_CDCLIE: TStringField
FieldName = 'CHE_CDCLIE'
Size = 7
end
object tbChequesCHE_NRAGEN: TStringField
Alignment = taRightJustify
FieldName = 'CHE_NRAGEN'
Size = 5
end
object tbChequesCHE_NRCONT: TStringField
Alignment = taRightJustify
FieldName = 'CHE_NRCONT'
Size = 12
end
object tbChequesCHE_NRDOCU: TStringField
Alignment = taRightJustify
FieldName = 'CHE_NRDOCU'
Size = 8
end
object tbChequesCHE_VLDOCU: TCurrencyField
FieldName = 'CHE_VLDOCU'
end
object tbChequesCHE_VLDESC: TCurrencyField
FieldName = 'CHE_VLDESC'
end
object tbChequesCHE_VLACRE: TCurrencyField
FieldName = 'CHE_VLACRE'
end
object tbChequesCHE_VLJURO: TCurrencyField
FieldName = 'CHE_VLJURO'
end
object tbChequesCHE_NMSACA: TStringField
FieldName = 'CHE_NMSACA'
Size = 40
end
object tbChequesCHE_DTRECE: TDateField
Alignment = taRightJustify
FieldName = 'CHE_DTRECE'
EditMask = '99/99/9999;1;_'
end
object tbChequesCHE_DTVENC: TDateField
Alignment = taRightJustify
FieldName = 'CHE_DTVENC'
EditMask = '99/99/9999;1;_'
end
object tbChequesCHE_DTPAGA: TDateField
Alignment = taRightJustify
FieldName = 'CHE_DTPAGA'
end
object tbChequesCHE_QTDIAS: TSmallintField
FieldName = 'CHE_QTDIAS'
end
object tbChequesCHE_FLSITU: TStringField
FieldName = 'CHE_FLSITU'
Size = 1
end
object tbChequesCHE_FLBLOQ: TStringField
FieldName = 'CHE_FLBLOQ'
Size = 1
end
object tbChequesCHE_DTDEV1: TDateField
Alignment = taRightJustify
FieldName = 'CHE_DTDEV1'
EditMask = '99/99/9999;1;_'
end
object tbChequesCHE_CDDEV1: TStringField
FieldName = 'CHE_CDDEV1'
Size = 2
end
object tbChequesCHE_DTDEV2: TDateField
Alignment = taRightJustify
FieldName = 'CHE_DTDEV2'
EditMask = '99/99/9999;1;_'
end
object tbChequesCHE_CDDEV2: TStringField
FieldName = 'CHE_CDDEV2'
Size = 2
end
object tbChequesCHE_DTPROR: TDateField
Alignment = taRightJustify
FieldName = 'CHE_DTPROR'
EditMask = '99/99/9999;1;_'
end
object tbChequesCHE_CDUSUA: TStringField
FieldName = 'CHE_CDUSUA'
Size = 3
end
object tbChequesCHE_NMBANC: TStringField
FieldKind = fkLookup
FieldName = 'CHE_NMBANC'
LookupDataSet = tbBancos
LookupKeyFields = 'BAN_CDBANC'
LookupResultField = 'BAN_NMBANC'
KeyFields = 'CHE_CDBANC'
Size = 30
Lookup = True
end
end
object tbCheqCli: TTable
AfterPost = tbCheqCliAfterPost
DatabaseName = 'NETIMO'
TableName = 'SACCLC.db'
Left = 296
Top = 8
object tbCheqCliCLC_CDCLIE: TStringField
FieldName = 'CLC_CDCLIE'
Size = 7
end
object tbCheqCliCLC_NMCLIE: TStringField
FieldName = 'CLC_NMCLIE'
Size = 40
end
object tbCheqCliCLC_ENCLIE: TStringField
FieldName = 'CLC_ENCLIE'
Size = 40
end
object tbCheqCliCLC_BAIRRO: TStringField
FieldName = 'CLC_BAIRRO'
end
object tbCheqCliCLC_CIDADE: TStringField
FieldName = 'CLC_CIDADE'
end
object tbCheqCliCLC_NRFONE: TStringField
FieldName = 'CLC_NRFONE'
EditMask = '(99)9999-9999;1;_'
Size = 13
end
object tbCheqCliCLC_NRIDEN: TStringField
FieldName = 'CLC_NRIDEN'
Size = 11
end
object tbCheqCliCLC_OREMIS: TStringField
FieldName = 'CLC_OREMIS'
Size = 4
end
object tbCheqCliCLC_UFEMIS: TStringField
FieldName = 'CLC_UFEMIS'
Size = 2
end
object tbCheqCliCLC_NRCPF: TStringField
FieldName = 'CLC_NRCPF'
Size = 14
end
object tbCheqCliCLC_NRCGC: TStringField
FieldName = 'CLC_NRCGC'
EditMask = '99.999.999/9999-99;1;_'
Size = 18
end
object tbCheqCliCLC_FLSITU: TStringField
FieldName = 'CLC_FLSITU'
Size = 1
end
object tbCheqCliCLC_QTDEVO: TSmallintField
FieldName = 'CLC_QTDEVO'
end
object tbCheqCliCLC_CDBANC: TStringField
FieldName = 'CLC_CDBANC'
Size = 3
end
object tbCheqCliCLC_NRAGEN: TStringField
FieldName = 'CLC_NRAGEN'
Size = 5
end
object tbCheqCliCLC_NRCONT: TStringField
FieldName = 'CLC_NRCONT'
Size = 12
end
object tbCheqCliCLC_FLPREF: TStringField
FieldName = 'CLC_FLPREF'
Size = 1
end
end
object tbBoletos: TTable
DatabaseName = 'NETIMO'
TableName = 'SACBOL.db'
Left = 296
Top = 56
object tbBoletosBOL_NRFATU: TStringField
Alignment = taRightJustify
FieldName = 'BOL_NRFATU'
Size = 10
end
object tbBoletosBOL_NRRECE: TStringField
Alignment = taRightJustify
FieldName = 'BOL_NRRECE'
Size = 7
end
object tbBoletosBOL_CDCLIE: TStringField
Alignment = taRightJustify
FieldName = 'BOL_CDCLIE'
Size = 7
end
object tbBoletosBOL_LOCPAG: TStringField
FieldName = 'BOL_LOCPAG'
Size = 50
end
object tbBoletosBOL_DTVENC: TDateField
Alignment = taRightJustify
FieldName = 'BOL_DTVENC'
EditMask = '99/99/9999;1;_'
end
object tbBoletosBOL_NMCEDE: TStringField
FieldName = 'BOL_NMCEDE'
Size = 50
end
object tbBoletosBOL_DTDOCU: TDateField
Alignment = taRightJustify
FieldName = 'BOL_DTDOCU'
EditMask = '99/99/9999;1;_'
end
object tbBoletosBOL_NRDOCU: TStringField
Alignment = taRightJustify
FieldName = 'BOL_NRDOCU'
Size = 10
end
object tbBoletosBOL_ACEITE: TStringField
FieldName = 'BOL_ACEITE'
Size = 1
end
object tbBoletosBOL_VLDOCU: TCurrencyField
FieldName = 'BOL_VLDOCU'
end
object tbBoletosBOL_NMSACA: TStringField
FieldName = 'BOL_NMSACA'
Size = 40
end
object tbBoletosBOL_ENDERE: TStringField
FieldName = 'BOL_ENDERE'
Size = 40
end
object tbBoletosBOL_CEPSAC: TStringField
FieldName = 'BOL_CEPSAC'
EditMask = '99999-999;1;_'
Size = 9
end
object tbBoletosBOL_BAIRRO: TStringField
FieldName = 'BOL_BAIRRO'
end
object tbBoletosBOL_CIDADE: TStringField
FieldName = 'BOL_CIDADE'
end
object tbBoletosBOL_UFSACA: TStringField
FieldName = 'BOL_UFSACA'
Size = 2
end
object tbBoletosBOL_NRCPF: TStringField
Alignment = taRightJustify
FieldName = 'BOL_NRCPF'
Size = 14
end
object tbBoletosBOL_NRCGC: TStringField
Alignment = taRightJustify
FieldName = 'BOL_NRCGC'
EditMask = '99.999.999/9999-99;1;_'
Size = 18
end
object tbBoletosBOL_TPPESS: TStringField
FieldName = 'BOL_TPPESS'
Size = 1
end
object tbBoletosBOL_VLDESC: TCurrencyField
FieldName = 'BOL_VLDESC'
currency = False
end
object tbBoletosBOL_VLJURO: TCurrencyField
FieldName = 'BOL_VLJURO'
currency = False
end
end
object tbMovBoleto: TTable
DatabaseName = 'NETIMO'
TableName = 'SACBOM.db'
Left = 296
Top = 104
object tbMovBoletoBOM_NRFATU: TStringField
FieldName = 'BOM_NRFATU'
Size = 10
end
object tbMovBoletoBOM_CDCLIEN: TStringField
FieldName = 'BOM_CDCLIEN'
Size = 7
end
object tbMovBoletoBOM_DTREFE: TStringField
FieldName = 'BOM_DTREFE'
Size = 6
end
object tbMovBoletoBOM_NMCRED: TStringField
FieldName = 'BOM_NMCRED'
end
object tbMovBoletoBOM_NMPLAN: TStringField
FieldName = 'BOM_NMPLAN'
Size = 7
end
object tbMovBoletoBOM_VLPARC: TCurrencyField
FieldName = 'BOM_VLPARC'
end
object tbMovBoletoBOM_TPMOVI: TStringField
FieldName = 'BOM_TPMOVI'
Size = 1
end
end
object tbContratos: TTable
AfterPost = tbContratosAfterPost
DatabaseName = 'NETIMO'
IndexFieldNames = 'CTC_CDCONT'
TableName = 'SACCTC.db'
Left = 168
Top = 8
object tbContratosCTC_CDCLIEN: TStringField
Alignment = taRightJustify
DisplayLabel = 'C'#243'digo'
DisplayWidth = 8
FieldName = 'CTC_CDCLIEN'
Size = 7
end
object tbContratosCTC_NMCLIE: TStringField
FieldName = 'CTC_NMCLIE'
Size = 40
end
object tbContratosCTC_CDCONT: TStringField
Alignment = taRightJustify
DisplayWidth = 10
FieldName = 'CTC_CDCONT'
Visible = False
Size = 10
end
object tbContratosCTC_CDEMPR: TStringField
Alignment = taRightJustify
DisplayWidth = 7
FieldName = 'CTC_CDEMPR'
Visible = False
Size = 7
end
object tbContratosCTC_NMEMPR: TStringField
DisplayWidth = 30
FieldKind = fkLookup
FieldName = 'CTC_NMEMPR'
LookupDataSet = tbEmpredim
LookupKeyFields = 'EMP_CDEMPR'
LookupResultField = 'EMP_NMEMPR'
KeyFields = 'CTC_CDEMPR'
Visible = False
Size = 30
Lookup = True
end
object tbContratosCTC_CDIMOV: TStringField
Alignment = taRightJustify
DisplayWidth = 10
FieldName = 'CTC_CDIMOV'
Visible = False
Size = 10
end
object tbContratosCTC_VLIMOV: TCurrencyField
DisplayWidth = 10
FieldName = 'CTC_VLIMOV'
Visible = False
end
object tbContratosCTC_VLENTR: TCurrencyField
DisplayWidth = 10
FieldName = 'CTC_VLENTR'
Visible = False
end
object tbContratosCTC_DTENTR: TDateField
Alignment = taRightJustify
DisplayWidth = 10
FieldName = 'CTC_DTENTR'
Visible = False
EditMask = '99/99/9999;1;_'
end
object tbContratosCTC_QTBALO: TSmallintField
DisplayWidth = 10
FieldName = 'CTC_QTBALO'
Visible = False
end
object tbContratosCTC_TOBALO: TCurrencyField
DisplayWidth = 10
FieldName = 'CTC_TOBALO'
Visible = False
end
object tbContratosCTC_QTPRES: TSmallintField
DisplayWidth = 10
FieldName = 'CTC_QTPRES'
Visible = False
end
object tbContratosCTC_VLPRES: TCurrencyField
DisplayWidth = 10
FieldName = 'CTC_VLPRES'
Visible = False
end
object tbContratosCTC_DTPRES: TDateField
Alignment = taRightJustify
DisplayWidth = 10
FieldName = 'CTC_DTPRES'
Visible = False
EditMask = '99/99/9999;1;_'
end
object tbContratosCTC_DTCONT: TDateField
Alignment = taRightJustify
DisplayWidth = 10
FieldName = 'CTC_DTCONT'
Visible = False
EditMask = '99/99/9999;1;_'
end
object tbContratosCTC_DTENTG: TDateField
Alignment = taRightJustify
DisplayWidth = 10
FieldName = 'CTC_DTENTG'
Visible = False
EditMask = '99/99/9999;1;_'
end
object tbContratosCTC_CDINDI: TStringField
Alignment = taRightJustify
DisplayWidth = 5
FieldName = 'CTC_CDINDI'
Visible = False
Size = 5
end
object tbContratosCTC_INDENT: TStringField
Alignment = taRightJustify
DisplayWidth = 5
FieldName = 'CTC_INDENT'
Visible = False
Size = 5
end
object tbContratosCTC_VLIMOV2: TCurrencyField
DisplayWidth = 10
FieldKind = fkLookup
FieldName = 'CTC_VLIMOV2'
LookupDataSet = tbImoveis
LookupKeyFields = 'IMO_CDIMOV'
LookupResultField = 'IMO_VLIMOV'
KeyFields = 'CTC_CDIMOV'
Visible = False
Lookup = True
end
object tbContratosCTC_VLSALD: TCurrencyField
DisplayWidth = 10
FieldName = 'CTC_VLSALD'
Visible = False
end
object tbContratosCTC_FLADIT: TBooleanField
DisplayWidth = 5
FieldName = 'CTC_FLADIT'
Visible = False
end
object tbContratosCTC_DTVENC: TDateField
FieldName = 'CTC_DTVENC'
EditMask = '99/99/9999;1;_'
end
object tbContratosCTC_VLPAGA: TCurrencyField
FieldName = 'CTC_VLPAGA'
end
object tbContratosCTC_QTPAGA: TSmallintField
FieldName = 'CTC_QTPAGA'
end
object tbContratosCTC_DTADIT: TDateField
FieldName = 'CTC_DTADIT'
EditMask = '99/99/9999;1;_'
end
object tbContratosCTC_QTPRAD: TSmallintField
FieldName = 'CTC_QTPRAD'
end
object tbContratosCTC_QTADPG: TSmallintField
FieldName = 'CTC_QTADPG'
end
object tbContratosCTC_VLPRAD: TCurrencyField
FieldName = 'CTC_VLPRAD'
end
object tbContratosCTC_CDUSUA: TStringField
Alignment = taRightJustify
DisplayWidth = 3
FieldName = 'CTC_CDUSUA'
Visible = False
Size = 3
end
object tbContratosCTC_VLCHAV: TCurrencyField
FieldName = 'CTC_VLCHAV'
end
object tbContratosCTC_VLMULT: TCurrencyField
FieldName = 'CTC_VLMULT'
currency = False
end
object tbContratosCTC_JUROS: TCurrencyField
FieldName = 'CTC_JUROS'
currency = False
end
object tbContratosCTC_INDATU: TStringField
FieldName = 'CTC_INDATU'
Size = 5
end
object tbContratosCTC_VLINDI: TCurrencyField
FieldName = 'CTC_VLINDI'
currency = False
end
object tbContratosCTC_VLIND2: TCurrencyField
FieldName = 'CTC_VLIND2'
currency = False
end
object tbContratosCTC_FLACUM: TBooleanField
FieldName = 'CTC_FLACUM'
end
object tbContratosCTC_FLACU2: TBooleanField
Alignment = taRightJustify
FieldName = 'CTC_FLACU2'
end
object tbContratosCTC_ENDIMO: TStringField
FieldKind = fkLookup
FieldName = 'CTC_ENDIMO'
LookupDataSet = tbImoveis
LookupKeyFields = 'IMO_CDIMOV'
LookupResultField = 'IMO_ENDIMO'
KeyFields = 'CTC_CDIMOV'
Size = 40
Lookup = True
end
object tbContratosCTC_NRIMOV: TIntegerField
FieldKind = fkLookup
FieldName = 'CTC_NRIMOV'
LookupDataSet = tbImoveis
LookupKeyFields = 'IMO_CDIMOV'
LookupResultField = 'IMO_NRIMOV'
KeyFields = 'CTC_CDIMOV'
Lookup = True
end
object tbContratosCTC_BAIRRO: TStringField
FieldKind = fkLookup
FieldName = 'CTC_BAIRRO'
LookupDataSet = tbImoveis
LookupKeyFields = 'IMO_CDIMOV'
LookupResultField = 'IMO_BAIRRO'
KeyFields = 'CTC_CDIMOV'
Size = 30
Lookup = True
end
object tbContratosCTC_DTPREE: TDateField
Alignment = taRightJustify
FieldName = 'CTC_DTPREE'
EditMask = '99/99/9999;1;_'
end
object tbContratosCTC_DTMUIN: TDateField
Alignment = taRightJustify
FieldName = 'CTC_DTMUIN'
EditMask = '99/99/9999;1;_'
end
object tbContratosCTC_DTATUA: TDateField
Alignment = taRightJustify
FieldName = 'CTC_DTATUA'
EditMask = '99/99/9999;1;_'
end
object tbContratosCTC_QTBAPG: TSmallintField
FieldName = 'CTC_QTBAPG'
end
end
object tbEmpredim: TTable
AfterPost = tbEmpredimAfterPost
DatabaseName = 'NETIMO'
TableName = 'SACEMP.db'
Left = 168
Top = 56
object tbEmpredimEMP_CDEMPR: TStringField
Alignment = taRightJustify
FieldName = 'EMP_CDEMPR'
Size = 5
end
object tbEmpredimEMP_NMEMPR: TStringField
FieldName = 'EMP_NMEMPR'
Size = 30
end
object tbEmpredimEMP_QTIMOV: TSmallintField
FieldName = 'EMP_QTIMOV'
end
object tbEmpredimEMP_LOCAL: TStringField
FieldName = 'EMP_LOCAL'
Size = 50
end
object tbEmpredimEMP_QTATUL: TSmallintField
FieldName = 'EMP_QTATUL'
end
object tbEmpredimEMP_QTREST: TSmallintField
FieldName = 'EMP_QTREST'
end
object tbEmpredimEMP_AREMPE: TFloatField
FieldName = 'EMP_AREMPE'
end
object tbEmpredimEMP_PEEMPR: TFloatField
FieldName = 'EMP_PEEMPR'
end
object tbEmpredimEMP_LINORT: TStringField
FieldName = 'EMP_LINORT'
Size = 40
end
object tbEmpredimEMP_LIMSUL: TStringField
FieldName = 'EMP_LIMSUL'
Size = 40
end
object tbEmpredimEMP_LILEST: TStringField
FieldName = 'EMP_LILEST'
Size = 40
end
object tbEmpredimEMP_LIOEST: TStringField
FieldName = 'EMP_LIOEST'
Size = 40
end
object tbEmpredimEMP_CDUSUA: TStringField
FieldName = 'EMP_CDUSUA'
Size = 3
end
end
object tbIndices: TTable
AfterPost = tbIndicesAfterPost
DatabaseName = 'NETIMO'
IndexFieldNames = 'IND_CDINDI'
TableName = 'SACIND.db'
Left = 168
Top = 104
object tbIndicesIND_CDINDI: TStringField
Alignment = taRightJustify
DisplayLabel = 'CODIGO'
DisplayWidth = 6
FieldName = 'IND_CDINDI'
Size = 5
end
object tbIndicesIND_NMDESC: TStringField
DisplayLabel = 'INDICE'
DisplayWidth = 20
FieldName = 'IND_NMDESC'
end
object tbIndicesIND_VLPERC: TCurrencyField
DisplayWidth = 10
FieldName = 'IND_VLPERC'
Visible = False
currency = False
end
object tbIndicesIND_VLCORR: TCurrencyField
DisplayWidth = 10
FieldName = 'IND_VLCORR'
Visible = False
currency = False
end
object tbIndicesIND_JUACUM: TBooleanField
DisplayWidth = 5
FieldName = 'IND_JUACUM'
Visible = False
end
object tbIndicesIND_PECORR: TCurrencyField
FieldName = 'IND_PECORR'
end
object tbIndicesIND_VLJURO: TCurrencyField
FieldName = 'IND_VLJURO'
currency = False
end
object tbIndicesIND_PEJURO: TCurrencyField
FieldName = 'IND_PEJURO'
end
object tbIndicesIND_CDUSUA: TStringField
FieldName = 'IND_CDUSUA'
Size = 3
end
end
object tbBaloes: TTable
BeforePost = tbBaloesBeforePost
AfterPost = tbBaloesAfterPost
DatabaseName = 'NETIMO'
TableName = 'SACBAL.db'
Left = 168
Top = 152
object tbBaloesBAL_CDSEQU: TFloatField
FieldName = 'BAL_CDSEQU'
end
object tbBaloesBAL_CDCONT: TStringField
Alignment = taRightJustify
FieldName = 'BAL_CDCONT'
Size = 10
end
object tbBaloesBAL_CDCLIE: TStringField
Alignment = taRightJustify
FieldName = 'BAL_CDCLIE'
Size = 7
end
object tbBaloesBAL_NRBALA: TSmallintField
FieldName = 'BAL_NRBALA'
end
object tbBaloesBAL_VLBALA: TCurrencyField
FieldName = 'BAL_VLBALA'
end
object tbBaloesBAL_DTCADA: TDateField
Alignment = taRightJustify
FieldName = 'BAL_DTCADA'
EditMask = '99/99/9999;1;_'
end
object tbBaloesBAL_DTVENC: TDateField
Alignment = taRightJustify
FieldName = 'BAL_DTVENC'
EditMask = '99/99/9999;1;_'
end
object tbBaloesBAL_DTPAGA: TDateField
Alignment = taRightJustify
FieldName = 'BAL_DTPAGA'
EditMask = '99/99/9999;1;_'
end
object tbBaloesBAL_FLSITU: TStringField
FieldName = 'BAL_FLSITU'
Size = 1
end
end
object tbCorrecInd: TTable
AfterPost = tbCorrecIndAfterPost
DatabaseName = 'NETIMO'
TableName = 'SACCOR.db'
Left = 168
Top = 208
object tbCorrecIndCOR_NRCORR: TStringField
Alignment = taRightJustify
FieldName = 'COR_NRCORR'
Size = 10
end
object tbCorrecIndCOR_CDINDI: TStringField
Alignment = taRightJustify
FieldName = 'COR_CDINDI'
Size = 5
end
object tbCorrecIndCOR_NMINDI: TStringField
FieldKind = fkLookup
FieldName = 'COR_NMINDI'
LookupDataSet = tbIndices
LookupKeyFields = 'IND_CDINDI'
LookupResultField = 'IND_NMDESC'
KeyFields = 'COR_CDINDI'
Lookup = True
end
object tbCorrecIndCOR_VLPERC: TCurrencyField
FieldName = 'COR_VLPERC'
currency = False
end
object tbCorrecIndCOR_VLCORR: TCurrencyField
FieldName = 'COR_VLCORR'
currency = False
end
object tbCorrecIndCOR_VLACUM: TFloatField
FieldName = 'COR_VLACUM'
end
object tbCorrecIndCOR_DTCORR: TDateField
Alignment = taRightJustify
FieldName = 'COR_DTCORR'
EditMask = '99/99/9999;1;_'
end
object tbCorrecIndCOR_VLJURO: TCurrencyField
FieldName = 'COR_VLJURO'
end
object tbCorrecIndCOR_PEJURO: TCurrencyField
FieldName = 'COR_PEJURO'
currency = False
end
object tbCorrecIndCOR_CDUSUA: TStringField
Alignment = taRightJustify
FieldName = 'COR_CDUSUA'
Size = 3
end
object tbCorrecIndCOR_MES: TStringField
FieldName = 'COR_MES'
Size = 15
end
end
object tbPrestacoes: TTable
AfterPost = tbPrestacoesAfterPost
OnCalcFields = tbPrestacoesCalcFields
DatabaseName = 'NETIMO'
IndexFieldNames = 'PRE_CDCLIE'
MasterFields = 'CTC_CDCLIEN'
MasterSource = frmManuPrestacoes.dsContrato
TableName = 'SACPRE.db'
Left = 232
Top = 8
object tbPrestacoesPRE_CDPRES: TStringField
FieldName = 'PRE_CDPRES'
Size = 13
end
object tbPrestacoesPRE_CDCONT: TStringField
FieldName = 'PRE_CDCONT'
Size = 10
end
object tbPrestacoesPRE_CDCLIE: TStringField
FieldName = 'PRE_CDCLIE'
Size = 7
end
object tbPrestacoesPRE_CDEMPR: TStringField
FieldName = 'PRE_CDEMPR'
Size = 5
end
object tbPrestacoesPRE_CDIMOV: TStringField
FieldName = 'PRE_CDIMOV'
Size = 10
end
object tbPrestacoesPRE_NRPRES: TStringField
FieldName = 'PRE_NRPRES'
Size = 7
end
object tbPrestacoesPRE_CDINDI: TStringField
FieldName = 'PRE_CDINDI'
Size = 5
end
object tbPrestacoesPRE_VLPRES: TCurrencyField
FieldName = 'PRE_VLPRES'
end
object tbPrestacoesPRE_JUANTE: TCurrencyField
FieldName = 'PRE_JUANTE'
end
object tbPrestacoesPRE_INDANT: TCurrencyField
FieldName = 'PRE_INDANT'
end
object tbPrestacoesPRE_VLANTE: TCurrencyField
FieldName = 'PRE_VLANTE'
end
object tbPrestacoesPRE_PECORR: TCurrencyField
FieldName = 'PRE_PECORR'
currency = False
end
object tbPrestacoesPRE_VLCORR: TCurrencyField
FieldName = 'PRE_VLCORR'
end
object tbPrestacoesPRE_VLSUBT: TCurrencyField
FieldName = 'PRE_VLSUBT'
end
object tbPrestacoesPRE_PEJURO: TCurrencyField
FieldName = 'PRE_PEJURO'
currency = False
end
object tbPrestacoesPRE_VLJURO: TCurrencyField
FieldName = 'PRE_VLJURO'
end
object tbPrestacoesPRE_FLJUAC: TBooleanField
FieldName = 'PRE_FLJUAC'
end
object tbPrestacoesPRE_VLJUAC: TCurrencyField
FieldName = 'PRE_VLJUAC'
end
object tbPrestacoesPRE_TOTAL: TCurrencyField
FieldName = 'PRE_TOTAL'
end
object tbPrestacoesPRE_SALDDE: TCurrencyField
FieldName = 'PRE_SALDDE'
end
object tbPrestacoesPRE_DTCADA: TDateField
FieldName = 'PRE_DTCADA'
end
object tbPrestacoesPRE_DTVENC: TDateField
Alignment = taRightJustify
FieldName = 'PRE_DTVENC'
end
object tbPrestacoesPRE_DTPAGA: TDateField
Alignment = taRightJustify
FieldName = 'PRE_DTPAGA'
end
object tbPrestacoesPRE_FLSITU: TStringField
FieldName = 'PRE_FLSITU'
Size = 1
end
object tbPrestacoesPRE_OBSERV: TMemoField
FieldName = 'PRE_OBSERV'
BlobType = ftMemo
Size = 240
end
object tbPrestacoesPRE_FLADIT: TBooleanField
FieldName = 'PRE_FLADIT'
end
object tbPrestacoesPRE_DTADIT: TDateField
FieldName = 'PRE_DTADIT'
end
object tbPrestacoesPRE_PRADIT: TSmallintField
FieldName = 'PRE_PRADIT'
end
object tbPrestacoesPRE_VLPRAD: TCurrencyField
FieldName = 'PRE_VLPRAD'
end
object tbPrestacoesPRE_DTVCAD: TDateField
FieldName = 'PRE_DTVCAD'
end
object tbPrestacoesPRE_CDUSUA: TStringField
FieldName = 'PRE_CDUSUA'
Size = 3
end
object tbPrestacoesPRE_USAREC: TStringField
FieldName = 'PRE_USAREC'
Size = 3
end
object tbPrestacoesPRE_NMCLIE: TStringField
FieldKind = fkLookup
FieldName = 'PRE_NMCLIE'
LookupDataSet = tbClientes
LookupKeyFields = 'CLI_CDCLIE'
LookupResultField = 'CLI_NMCLIE'
KeyFields = 'PRE_CDCLIE'
Size = 40
Lookup = True
end
object tbPrestacoesPRE_NMINDI: TStringField
FieldKind = fkLookup
FieldName = 'PRE_NMINDI'
LookupDataSet = tbIndices
LookupKeyFields = 'IND_CDINDI'
LookupResultField = 'IND_NMDESC'
KeyFields = 'PRE_CDINDI'
Lookup = True
end
object tbPrestacoesPRE_NMEMPR: TStringField
FieldKind = fkLookup
FieldName = 'PRE_NMEMPR'
LookupDataSet = tbEmpredim
LookupKeyFields = 'EMP_CDEMPR'
LookupResultField = 'EMP_NMEMPR'
KeyFields = 'PRE_CDEMPR'
Size = 30
Lookup = True
end
object tbPrestacoesPRE_VLIMOV: TCurrencyField
FieldName = 'PRE_VLIMOV'
end
object tbPrestacoesPRE_PREST: TSmallintField
FieldName = 'PRE_PREST'
end
object tbPrestacoesPRE_VLMULT: TCurrencyField
FieldName = 'PRE_VLMULT'
currency = False
end
object tbPrestacoesPRE_DIASAT: TFloatField
FieldName = 'PRE_DIASAT'
end
object tbPrestacoesPRE_JURVCT: TFloatField
FieldName = 'PRE_JURVCT'
end
object tbPrestacoesPRE_TPPRES: TStringField
FieldName = 'PRE_TPPRES'
Size = 1
end
object tbPrestacoesPRE_VLSUBT_CALC: TCurrencyField
FieldKind = fkCalculated
FieldName = 'PRE_VLSUBT_CALC'
Calculated = True
end
object tbPrestacoesPRE_VLCORR_CALC: TCurrencyField
FieldKind = fkCalculated
FieldName = 'PRE_VLCORR_CALC'
Calculated = True
end
object tbPrestacoesPRE_TOTAL_CALC: TCurrencyField
FieldKind = fkCalculated
FieldName = 'PRE_TOTAL_CALC'
Calculated = True
end
object tbPrestacoesPRE_VLJURO_CALC: TCurrencyField
FieldKind = fkCalculated
FieldName = 'PRE_VLJURO_CALC'
Calculated = True
end
object tbPrestacoesPRE_QTDIAS_CALC: TFloatField
FieldKind = fkCalculated
FieldName = 'PRE_QTDIAS_CALC'
Calculated = True
end
object tbPrestacoesPRE_FLATRA: TStringField
FieldName = 'PRE_FLATRA'
Size = 1
end
object tbPrestacoesPRE_DTATUA: TDateField
FieldName = 'PRE_DTATUA'
end
object tbPrestacoesPRE_HORECE: TStringField
Alignment = taRightJustify
FieldName = 'PRE_HORECE'
EditMask = '99:99;1;_'
Size = 5
end
object tbPrestacoesPRE_VLPAGO: TCurrencyField
FieldName = 'PRE_VLPAGO'
end
object tbPrestacoesPRE_CDMODA: TStringField
FieldName = 'PRE_CDMODA'
Size = 2
end
object tbPrestacoesPRE_NRAGEN: TStringField
Alignment = taRightJustify
FieldName = 'PRE_NRAGEN'
Size = 5
end
object tbPrestacoesPRE_NRCHEQ: TStringField
Alignment = taRightJustify
FieldName = 'PRE_NRCHEQ'
Size = 7
end
object tbPrestacoesPRE_FLPRED: TBooleanField
FieldName = 'PRE_FLPRED'
end
object tbPrestacoesPRE_DTPRED: TDateField
Alignment = taRightJustify
FieldName = 'PRE_DTPRED'
EditMask = '99/99/9999;1;_'
end
object tbPrestacoesPRE_FLPARC: TBooleanField
FieldName = 'PRE_FLPARC'
end
object tbPrestacoesPRE_NMDESC: TStringField
FieldName = 'PRE_NMDESC'
Size = 40
end
object tbPrestacoesPRE_CDBANC: TStringField
FieldName = 'PRE_CDBANC'
Size = 3
end
object tbPrestacoesPRE_NRCONT: TStringField
FieldName = 'PRE_NRCONT'
Size = 12
end
object tbPrestacoesPRE_DTBASE: TDateField
Alignment = taRightJustify
FieldName = 'PRE_DTBASE'
EditMask = '99/99/9999;1;_'
end
object tbPrestacoesPRE_VLATUAL: TFloatField
FieldName = 'PRE_VLATUAL'
end
object tbPrestacoesPRE_VLACUM: TFloatField
FieldName = 'PRE_VLACUM'
end
object tbPrestacoesPRE_FL60DIA: TBooleanField
FieldName = 'PRE_FL60DIA'
end
object tbPrestacoesPRE_FL30DIA: TStringField
FieldName = 'PRE_FL30DIA'
Size = 1
end
object tbPrestacoesPRE_FL60DIA2: TStringField
FieldName = 'PRE_FL60DIA2'
Size = 1
end
object tbPrestacoesPRE_QTDIAS: TIntegerField
FieldKind = fkCalculated
FieldName = 'PRE_QTDIAS'
Calculated = True
end
object tbPrestacoesPRE_VLBASE_CALC: TFloatField
FieldKind = fkCalculated
FieldName = 'PRE_VLBASE_CALC'
Calculated = True
end
object tbPrestacoesPRE_DIVENC: TFloatField
FieldName = 'PRE_DIVENC'
end
object tbPrestacoesPRE_DTLIMI: TDateField
Alignment = taRightJustify
FieldName = 'PRE_DTLIMI'
EditMask = '99/99/9999;1;_'
end
end
object qryAtualizar: TQuery
DatabaseName = 'NETIMO'
SQL.Strings = (
'Select * from SACPRE')
Left = 296
Top = 152
object qryAtualizarPRE_CDPRES: TStringField
FieldName = 'PRE_CDPRES'
Origin = 'NETIMO."SACPRE.DB".PRE_CDPRES'
Size = 13
end
object qryAtualizarPRE_CDCONT: TStringField
FieldName = 'PRE_CDCONT'
Origin = 'NETIMO."SACPRE.DB".PRE_CDCONT'
Size = 10
end
object qryAtualizarPRE_CDCLIE: TStringField
FieldName = 'PRE_CDCLIE'
Origin = 'NETIMO."SACPRE.DB".PRE_CDCLIE'
Size = 7
end
object qryAtualizarPRE_CDEMPR: TStringField
FieldName = 'PRE_CDEMPR'
Origin = 'NETIMO."SACPRE.DB".PRE_CDEMPR'
Size = 5
end
object qryAtualizarPRE_NRPRES: TStringField
FieldName = 'PRE_NRPRES'
Origin = 'NETIMO."SACPRE.DB".PRE_NRPRES'
Size = 7
end
object qryAtualizarPRE_VLIMOV: TCurrencyField
FieldName = 'PRE_VLIMOV'
Origin = 'NETIMO."SACPRE.DB".PRE_VLIMOV'
end
object qryAtualizarPRE_VLPRES: TCurrencyField
FieldName = 'PRE_VLPRES'
Origin = 'NETIMO."SACPRE.DB".PRE_VLPRES'
end
object qryAtualizarPRE_VLANTE: TCurrencyField
FieldName = 'PRE_VLANTE'
Origin = 'NETIMO."SACPRE.DB".PRE_VLANTE'
end
object qryAtualizarPRE_PECORR: TCurrencyField
FieldName = 'PRE_PECORR'
Origin = 'NETIMO."SACPRE.DB".PRE_PECORR'
end
object qryAtualizarPRE_VLCORR: TCurrencyField
FieldName = 'PRE_VLCORR'
Origin = 'NETIMO."SACPRE.DB".PRE_VLCORR'
end
object qryAtualizarPRE_VLSUBT: TCurrencyField
FieldName = 'PRE_VLSUBT'
Origin = 'NETIMO."SACPRE.DB".PRE_VLSUBT'
end
object qryAtualizarPRE_PEJURO: TCurrencyField
FieldName = 'PRE_PEJURO'
Origin = 'NETIMO."SACPRE.DB".PRE_PEJURO'
end
object qryAtualizarPRE_VLJURO: TCurrencyField
FieldName = 'PRE_VLJURO'
Origin = 'NETIMO."SACPRE.DB".PRE_VLJURO'
end
object qryAtualizarPRE_FLJUAC: TBooleanField
FieldName = 'PRE_FLJUAC'
Origin = 'NETIMO."SACPRE.DB".PRE_FLJUAC'
end
object qryAtualizarPRE_VLJUAC: TCurrencyField
FieldName = 'PRE_VLJUAC'
Origin = 'NETIMO."SACPRE.DB".PRE_VLJUAC'
end
object qryAtualizarPRE_TOTAL: TCurrencyField
FieldName = 'PRE_TOTAL'
Origin = 'NETIMO."SACPRE.DB".PRE_TOTAL'
end
object qryAtualizarPRE_FLSITU: TStringField
FieldName = 'PRE_FLSITU'
Origin = 'NETIMO."SACPRE.DB".PRE_FLSITU'
Size = 1
end
end
object tbSitImovel: TTable
AfterPost = tbSitImovelAfterPost
DatabaseName = 'NETIMO'
TableName = 'SACSIT.db'
Left = 232
Top = 64
object tbSitImovelSIT_CDSITU: TStringField
FieldName = 'SIT_CDSITU'
Size = 3
end
object tbSitImovelSIT_NMDESC: TStringField
FieldName = 'SIT_NMDESC'
Size = 15
end
object tbSitImovelSIT_DTRESE: TDateField
FieldName = 'SIT_DTRESE'
EditMask = '99/99/9999;1;_'
end
end
object tbUsuarios: TTable
AfterPost = tbCorrecIndAfterPost
DatabaseName = 'NETIMO'
TableName = 'SACSEN.db'
Left = 232
Top = 128
object tbUsuariosSEN_CDUSUA: TStringField
FieldName = 'SEN_CDUSUA'
Size = 3
end
object tbUsuariosSEN_NMUSUA: TStringField
FieldName = 'SEN_NMUSUA'
Size = 40
end
object tbUsuariosSEN_SNATUA: TStringField
FieldName = 'SEN_SNATUA'
Size = 6
end
object tbUsuariosSEN_NMCARG: TStringField
FieldName = 'SEN_NMCARG'
Size = 30
end
object tbUsuariosSEN_NMTERM: TStringField
FieldName = 'SEN_NMTERM'
end
end
object tbHistorico: TTable
AfterPost = tbHistoricoAfterPost
DatabaseName = 'NETIMO'
TableName = 'SACHIT.db'
Left = 304
Top = 200
object tbHistoricoHIS_CDHIST: TAutoIncField
FieldName = 'HIS_CDHIST'
ReadOnly = True
end
object tbHistoricoHIS_CDCLIE: TStringField
Alignment = taRightJustify
FieldName = 'HIS_CDCLIE'
Size = 7
end
object tbHistoricoHIS_CDCONT: TStringField
Alignment = taRightJustify
FieldName = 'HIS_CDCONT'
Size = 10
end
object tbHistoricoHIS_CDRECE: TStringField
Alignment = taRightJustify
FieldName = 'HIS_CDRECE'
Size = 13
end
object tbHistoricoHIS_TPPRES: TStringField
Alignment = taRightJustify
FieldName = 'HIS_TPPRES'
Size = 1
end
object tbHistoricoHIS_NRPRES: TFloatField
FieldName = 'HIS_NRPRES'
end
object tbHistoricoHIS_DTPAGA: TDateField
FieldName = 'HIS_DTPAGA'
EditMask = '99/99/9999;1;_'
end
object tbHistoricoHIS_HOPAGA: TTimeField
FieldName = 'HIS_HOPAGA'
EditMask = '99:99;1;_'
end
object tbHistoricoHIS_VLPAGO: TCurrencyField
FieldName = 'HIS_VLPAGO'
end
object tbHistoricoHIS_VLREST: TCurrencyField
FieldName = 'HIS_VLREST'
end
object tbHistoricoHIS_CDMODA: TStringField
Alignment = taRightJustify
FieldName = 'HIS_CDMODA'
Size = 2
end
object tbHistoricoHIS_CDUSUA: TStringField
Alignment = taRightJustify
FieldName = 'HIS_CDUSUA'
Size = 3
end
end
object qryPrestacoes: TQuery
DatabaseName = 'NETIMO'
SQL.Strings = (
'Select * from SACPRE')
Left = 232
Top = 184
object qryPrestacoesPRE_CDPRES: TStringField
FieldName = 'PRE_CDPRES'
Origin = 'NETIMO."SACPRE.DB".PRE_CDPRES'
Size = 13
end
object qryPrestacoesPRE_CDCONT: TStringField
FieldName = 'PRE_CDCONT'
Origin = 'NETIMO."SACPRE.DB".PRE_CDCONT'
Size = 10
end
object qryPrestacoesPRE_CDCLIE: TStringField
FieldName = 'PRE_CDCLIE'
Origin = 'NETIMO."SACPRE.DB".PRE_CDCLIE'
Size = 7
end
object qryPrestacoesPRE_CDEMPR: TStringField
FieldName = 'PRE_CDEMPR'
Origin = 'NETIMO."SACPRE.DB".PRE_CDEMPR'
Size = 5
end
object qryPrestacoesPRE_CDIMOV: TStringField
FieldName = 'PRE_CDIMOV'
Origin = 'NETIMO."SACPRE.DB".PRE_CDIMOV'
Size = 10
end
object qryPrestacoesPRE_NRPRES: TStringField
FieldName = 'PRE_NRPRES'
Origin = 'NETIMO."SACPRE.DB".PRE_NRPRES'
Size = 7
end
object qryPrestacoesPRE_PREST: TSmallintField
FieldName = 'PRE_PREST'
Origin = 'NETIMO."SACPRE.DB".PRE_PREST'
end
object qryPrestacoesPRE_CDINDI: TStringField
FieldName = 'PRE_CDINDI'
Origin = 'NETIMO."SACPRE.DB".PRE_CDINDI'
Size = 5
end
object qryPrestacoesPRE_VLIMOV: TCurrencyField
FieldName = 'PRE_VLIMOV'
Origin = 'NETIMO."SACPRE.DB".PRE_VLIMOV'
end
object qryPrestacoesPRE_VLPRES: TCurrencyField
FieldName = 'PRE_VLPRES'
Origin = 'NETIMO."SACPRE.DB".PRE_VLPRES'
end
object qryPrestacoesPRE_INDANT: TCurrencyField
FieldName = 'PRE_INDANT'
Origin = 'NETIMO."SACPRE.DB".PRE_INDANT'
end
object qryPrestacoesPRE_VLANTE: TCurrencyField
FieldName = 'PRE_VLANTE'
Origin = 'NETIMO."SACPRE.DB".PRE_VLANTE'
end
object qryPrestacoesPRE_PECORR: TCurrencyField
FieldName = 'PRE_PECORR'
Origin = 'NETIMO."SACPRE.DB".PRE_PECORR'
currency = False
end
object qryPrestacoesPRE_VLCORR: TCurrencyField
FieldName = 'PRE_VLCORR'
Origin = 'NETIMO."SACPRE.DB".PRE_VLCORR'
end
object qryPrestacoesPRE_VLSUBT: TCurrencyField
FieldName = 'PRE_VLSUBT'
Origin = 'NETIMO."SACPRE.DB".PRE_VLSUBT'
end
object qryPrestacoesPRE_PEJURO: TCurrencyField
FieldName = 'PRE_PEJURO'
Origin = 'NETIMO."SACPRE.DB".PRE_PEJURO'
currency = False
end
object qryPrestacoesPRE_VLJURO: TCurrencyField
FieldName = 'PRE_VLJURO'
Origin = 'NETIMO."SACPRE.DB".PRE_VLJURO'
end
object qryPrestacoesPRE_JURVCT: TFloatField
FieldName = 'PRE_JURVCT'
Origin = 'NETIMO."SACPRE.DB".PRE_JURVCT'
end
object qryPrestacoesPRE_FLJUAC: TBooleanField
FieldName = 'PRE_FLJUAC'
Origin = 'NETIMO."SACPRE.DB".PRE_FLJUAC'
end
object qryPrestacoesPRE_VLJUAC: TCurrencyField
FieldName = 'PRE_VLJUAC'
Origin = 'NETIMO."SACPRE.DB".PRE_VLJUAC'
end
object qryPrestacoesPRE_VLMULT: TCurrencyField
FieldName = 'PRE_VLMULT'
Origin = 'NETIMO."SACPRE.DB".PRE_VLMULT'
currency = False
end
object qryPrestacoesPRE_TOTAL: TCurrencyField
FieldName = 'PRE_TOTAL'
Origin = 'NETIMO."SACPRE.DB".PRE_TOTAL'
end
object qryPrestacoesPRE_SALDDE: TCurrencyField
FieldName = 'PRE_SALDDE'
Origin = 'NETIMO."SACPRE.DB".PRE_SALDDE'
end
object qryPrestacoesPRE_DTCADA: TDateField
FieldName = 'PRE_DTCADA'
Origin = 'NETIMO."SACPRE.DB".PRE_DTCADA'
end
object qryPrestacoesPRE_DTVENC: TDateField
FieldName = 'PRE_DTVENC'
Origin = 'NETIMO."SACPRE.DB".PRE_DTVENC'
end
object qryPrestacoesPRE_DTPAGA: TDateField
FieldName = 'PRE_DTPAGA'
Origin = 'NETIMO."SACPRE.DB".PRE_DTPAGA'
end
object qryPrestacoesPRE_UTDTVE: TDateField
FieldName = 'PRE_UTDTVE'
Origin = 'NETIMO."SACPRE.DB".PRE_UTDTVE'
end
object qryPrestacoesPRE_DIASAT: TFloatField
FieldName = 'PRE_DIASAT'
Origin = 'NETIMO."SACPRE.DB".PRE_DIASAT'
end
object qryPrestacoesPRE_FLATRA: TStringField
FieldName = 'PRE_FLATRA'
Origin = 'NETIMO."SACPRE.DB".PRE_FLATRA'
Size = 1
end
object qryPrestacoesPRE_FLSITU: TStringField
FieldName = 'PRE_FLSITU'
Origin = 'NETIMO."SACPRE.DB".PRE_FLSITU'
Size = 1
end
object qryPrestacoesPRE_FLADIT: TBooleanField
FieldName = 'PRE_FLADIT'
Origin = 'NETIMO."SACPRE.DB".PRE_FLADIT'
end
object qryPrestacoesPRE_DTADIT: TDateField
FieldName = 'PRE_DTADIT'
Origin = 'NETIMO."SACPRE.DB".PRE_DTADIT'
end
object qryPrestacoesPRE_PRADIT: TSmallintField
FieldName = 'PRE_PRADIT'
Origin = 'NETIMO."SACPRE.DB".PRE_PRADIT'
end
object qryPrestacoesPRE_VLPRAD: TCurrencyField
FieldName = 'PRE_VLPRAD'
Origin = 'NETIMO."SACPRE.DB".PRE_VLPRAD'
end
object qryPrestacoesPRE_DTVCAD: TDateField
FieldName = 'PRE_DTVCAD'
Origin = 'NETIMO."SACPRE.DB".PRE_DTVCAD'
end
object qryPrestacoesPRE_TPPRES: TStringField
FieldName = 'PRE_TPPRES'
Origin = 'NETIMO."SACPRE.DB".PRE_TPPRES'
Size = 1
end
object qryPrestacoesPRE_DTATUA: TDateField
FieldName = 'PRE_DTATUA'
Origin = 'NETIMO."SACPRE.DB".PRE_DTATUA'
end
object qryPrestacoesPRE_NMINDI: TStringField
FieldKind = fkLookup
FieldName = 'PRE_NMINDI'
LookupDataSet = tbIndices
LookupKeyFields = 'IND_CDINDI'
LookupResultField = 'IND_NMDESC'
KeyFields = 'PRE_CDINDI'
Lookup = True
end
object qryPrestacoesPRE_VLSUBT_CALC: TFloatField
FieldKind = fkCalculated
FieldName = 'PRE_VLSUBT_CALC'
Calculated = True
end
object qryPrestacoesPRE_VLCORR_CALC: TFloatField
FieldKind = fkCalculated
FieldName = 'PRE_VLCORR_CALC'
Calculated = True
end
object qryPrestacoesPRE_TOTAL_CALC: TFloatField
FieldKind = fkCalculated
FieldName = 'PRE_TOTAL_CALC'
Calculated = True
end
object qryPrestacoesPRE_VLJURO_CALC: TFloatField
FieldKind = fkCalculated
FieldName = 'PRE_VLJURO_CALC'
Calculated = True
end
object qryPrestacoesPRE_QTDIAS_CALC: TFloatField
FieldKind = fkCalculated
FieldName = 'PRE_QTDIAS_CALC'
Calculated = True
end
end
end
| 27.327818 | 54 | 0.663879 |
47735d07c9273430acc768b0b7755e43bed103e5 | 3,458 | pas | Pascal | youtube_download.pas | seryal/wevido | c76ed224a3b74f5cf0351460e1ce9c4ff9c9b90a | [
"MIT"
]
| 8 | 2021-12-22T17:12:51.000Z | 2022-03-15T15:01:48.000Z | youtube_download.pas | seryal/wevido | c76ed224a3b74f5cf0351460e1ce9c4ff9c9b90a | [
"MIT"
]
| null | null | null | youtube_download.pas | seryal/wevido | c76ed224a3b74f5cf0351460e1ce9c4ff9c9b90a | [
"MIT"
]
| 1 | 2021-12-23T07:02:50.000Z | 2021-12-23T07:02:50.000Z | program youtube_download;
{$mode objfpc}{$H+}
uses {$IFDEF UNIX}
cthreads, {$ENDIF}
Classes,
SysUtils,
videodownloader,
CustApp,
crt;
type
{ TMyApplication }
TMyApplication = class(TCustomApplication)
private
Fx, Fy: tcrtcoord;
procedure RecvHandler(AFilePath: string; AProgress, ASize: int64);
protected
FDownloader: IDownLoader;
procedure DoRun; override;
function CreateDownloader(AUrl: string): IDownLoader;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure WriteHelp; virtual;
end;
{ TMyApplication }
procedure TMyApplication.RecvHandler(AFilePath: string; AProgress, ASize: int64);
begin
if ASize = 0 then
exit;
GotoXY(fx, fy);
WriteLn(trim(FormatFloat('### ### ### ### ###', AProgress)), '/',
trim(FormatFloat('### ### ### ### ###', ASize)),
' ');
end;
procedure TMyApplication.DoRun;
var
ErrorMsg: string;
url: string;
filename: TFileName;
info: TVideoInfo;
i: integer;
downloadurl: TDownloadUrl;
begin
DefaultSystemCodePage := CP_UTF8;
// quick check parameters
ErrorMsg := CheckOptions('h', 'help');
if ErrorMsg <> '' then
begin
ShowException(Exception.Create(ErrorMsg));
Terminate;
Exit;
end;
// parse parameters
if HasOption('h', 'help') then
begin
WriteHelp;
Terminate;
Exit;
end;
url := ParamStr(1);
if ParamStr(2) <> '' then
filename := ParamStr(2)
else
filename := 'downloaded.mp4';
writeln(url);
FDownloader := CreateDownloader(url);
if not Assigned(FDownloader) then
begin
writeln('Resource not found');
end
else
begin
FDownloader.OnDataReceived := @RecvHandler;
FDownloader.SetWebURL(url);
info := FDownloader.GetInfo;
writeln('Title - ', info.VideoName);
writeln('Author - ', info.Author);
writeln('Length - ', info.Length, ' seconds');
for downloadurl in info.DownloadUrls do
begin
TextColor(Yellow);
Write(' - ', downloadurl.mimeType, ': ');
TextColor(LightCyan);
writeln(downloadurl.quality, ' - ', downloadurl.QualityLabel);
TextColor(LightGray);
writeln('"', downloadurl.Link, '"');
end;
writeln('----');
writeln('Download default URL.');
writeln('----');
writeln('');
fx := WhereX;
fy := WhereY - 1;
FDownloader.DownLoad(filename);
WriteLn('Download complete');
end;
{ add your program here }
// stop program loop
// readln;
Terminate;
end;
function TMyApplication.CreateDownloader(AUrl: string): IDownLoader;
begin
Result := nil;
if pos('youtube.com', AUrl) <> 0 then
Result := TYouTubeVideo.Create
else
if (pos('yapfiles.ru', AUrl) <> 0) then
Result := TYapVideo.Create;
end;
constructor TMyApplication.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
StopOnException := True;
end;
destructor TMyApplication.Destroy;
begin
inherited Destroy;
end;
procedure TMyApplication.WriteHelp;
begin
{ add your help code here }
writeln('Usage: ', ExeName, ' -h');
end;
var
Application: TMyApplication;
begin
Application := TMyApplication.Create(nil);
Application.Title := 'My Application';
Application.Run;
Application.Free;
end.
| 22.309677 | 83 | 0.622036 |
fc97aaeec985fccce017bb6dbabbeb4150882996 | 22,913 | pas | Pascal | stackmodeu.pas | h0lmes/terry | 60ea4cc6a2fcff0ab488452cabce490171472970 | [
"MIT"
]
| 8 | 2015-01-10T07:27:00.000Z | 2022-03-29T06:53:13.000Z | stackmodeu.pas | h0lmes/terry | 60ea4cc6a2fcff0ab488452cabce490171472970 | [
"MIT"
]
| 1 | 2021-12-07T21:37:04.000Z | 2021-12-07T21:37:04.000Z | stackmodeu.pas | h0lmes/tdock | 99fc4197edd9e740a2a69c350aff25d6c3300b11 | [
"MIT"
]
| 2 | 2016-07-16T02:10:43.000Z | 2020-08-14T08:39:31.000Z | unit stackmodeu;
{$mode delphi}
interface
uses Classes, SysUtils, Math, declu;
const
MODE_COUNT = 9;
MAX_DISTORT = 10;
PI = 3.14159;
DEFMODE_BIG = 4;
DEFMODE_SMALL = 1;
type
TStackItemData = packed record
x: integer;
y: integer;
s: integer;
alpha: integer;
angle: single;
hint_align: integer;
hint_alpha: integer;
end;
TStackModeController = class(TObject)
private
names: array [0..MODE_COUNT] of string;
function GetFan(Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
function GetFanAlt(Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
function GetTable(Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
function GetCards(Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
function GetLine(Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
function GetDoubleLine(Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
function GetSun(Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
function GetParallelWave(Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
function GetParallel(Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
public
constructor Create;
function GetModeCount: integer;
function GetModeName(Mode: integer): string;
function GetStep(Mode: integer; ItemCount: integer): extended;
function GetItemData(Mode: integer; Opening, ShowHint: boolean; Progress: extended;
Index, ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
end;
var
mc: TStackModeController;
implementation
//------------------------------------------------------------------------------
constructor TStackModeController.Create;
begin
names[0] := 'Auto';
names[1] := 'Fan';
names[2] := 'Fan Alt';
names[3] := 'Table';
names[4] := 'Cards';
names[5] := 'Line';
names[6] := 'Double Line';
names[7] := 'Sun';
names[8] := 'Parallel Wave';
names[9] := 'Parallel';
end;
//------------------------------------------------------------------------------
function TStackModeController.GetModeCount: integer;
begin
result := MODE_COUNT + 1;
end;
//------------------------------------------------------------------------------
function TStackModeController.GetModeName(Mode: integer): string;
begin
result := names[mode];
end;
//------------------------------------------------------------------------------
function TStackModeController.GetStep(Mode: integer; ItemCount: integer): extended;
begin
if mode = 0 then
begin
if itemCount > 15 then mode := DEFMODE_BIG else mode := DEFMODE_SMALL;
end;
case Mode of
7, 8:
begin
result := 0.1 / ItemCount;
if result < 0.01 then result := 0.01;
end;
else result := 0.05;
end;
end;
//------------------------------------------------------------------------------
function TStackModeController.GetItemData(Mode: integer; Opening, ShowHint: boolean; Progress: extended;
Index, ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
begin
if Mode = 0 then
begin
if ItemCount > 15 then Mode := DEFMODE_BIG else Mode := DEFMODE_SMALL;
end;
if Progress < 0 then Progress := 0;
if Progress > 1 then Progress := 1;
case Mode of
1: result := GetFan (Opening, ShowHint, Index, Progress, ItemCount, Site, ItemSize, Offset, Distort);
2: result := GetFanAlt (Opening, ShowHint, Index, Progress, ItemCount, Site, ItemSize, Offset, Distort);
3: result := GetTable (Opening, ShowHint, Index, Progress, ItemCount, Site, ItemSize, Offset, Distort);
4: result := GetCards (Opening, ShowHint, Index, Progress, ItemCount, Site, ItemSize, Offset, Distort);
5: result := GetLine (Opening, ShowHint, Index, Progress, ItemCount, Site, ItemSize, Offset, Distort);
6: result := GetDoubleLine (Opening, ShowHint, Index, Progress, ItemCount, Site, ItemSize, Offset, Distort);
7: result := GetSun (Opening, ShowHint, Index, Progress, ItemCount, Site, ItemSize, Offset, Distort);
8: result := GetParallelWave(Opening, ShowHint, Index, Progress, ItemCount, Site, ItemSize, Offset, Distort);
9: result := GetParallel (Opening, ShowHint, Index, Progress, ItemCount, Site, ItemSize, Offset, Distort);
end;
end;
//------------------------------------------------------------------------------
function TStackModeController.GetFan(Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
var
x, y: extended;
begin
result.x := 0;
result.y := 0;
result.alpha := 0;
result.angle := 0;
result.s := ItemSize;
result.alpha := round(255 * max(0, (progress - index / ItemCount) * 1 / (1 - index / ItemCount)));
result.hint_alpha := 0;
if Progress = 1 then result.hint_alpha := 255;
// one degree per step (per icon) //
inc(index);
x := (ItemSize + 4) * index * cos(progress * index / 360 * PI * Distort) * progress;
y := (ItemSize + 4) * index * sin(progress * index / 360 * PI * Distort) * progress;
x := x + 4 + Offset;
result.angle := progress * index * Distort;
case Site of
0: begin
result.x := round(x);
result.y := round(y);
result.hint_align := HA_VERTICAL_TOP;
end;
2: begin
result.x := -round(x);
result.y := round(y);
result.angle := 360 - result.angle;
result.hint_align := HA_VERTICAL_TOP;
end;
1: begin
result.x := -round(y);
result.y := round(x);
result.hint_align := HA_HORIZONTAL_RIGHT;
end;
3: begin
result.x := -round(y);
result.y := -round(x);
result.angle := 360 - result.angle;
result.hint_align := HA_HORIZONTAL_RIGHT;
end;
end;
end;
//------------------------------------------------------------------------------
function TStackModeController.GetFanAlt(Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
var
x, y: extended;
begin
result.x := 0;
result.y := 0;
result.alpha := 0;
result.angle := 0;
result.s := ItemSize;
result.alpha := round(255 * max(0, (progress - index / ItemCount) * 1 / (1 - index / ItemCount)));
result.hint_alpha := 0;
if Progress = 1 then result.hint_alpha := 255;
// one degree per step (per icon) //
inc(index);
x := (ItemSize + 4) * index * cos(progress * index / 360 * PI * Distort) * progress;
y := (ItemSize + 4) * index * sin(progress * index / 360 * PI * Distort) * progress;
x := x + 4 + Offset;
result.angle := 360 - progress * index * Distort;
case Site of
0: begin
result.x := round(x);
result.y := -round(y);
result.hint_align := HA_VERTICAL_BOTTOM;
end;
2: begin
result.x := -round(x);
result.y := -round(y);
result.angle := 360 - result.angle;
result.hint_align := HA_VERTICAL_BOTTOM;
end;
1: begin
result.x := round(y);
result.y := round(x);
result.hint_align := HA_HORIZONTAL_LEFT;
end;
3: begin
result.x := round(y);
result.y := -round(x);
result.angle := 360 - result.angle;
result.hint_align := HA_HORIZONTAL_LEFT;
end;
end;
end;
//------------------------------------------------------------------------------
function TStackModeController.GetTable(Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
var
cols, rows, hSpace, vSpace: integer;
x, y, d, s: extended;
begin
result.x := 0;
result.y := 0;
result.alpha := 0;
result.angle := 0;
hSpace := 50;
vSpace := 40;
if not ShowHint then vSpace := 10;
s := 0.9 + (sin(progress * PI / 2) * 0.1);
result.alpha := round(255 * progress);
result.hint_alpha := 255;
result.hint_align := HA_HORIZONTAL_BOTTOM;
d := Distort * 3;
result.s := ItemSize;
cols := ceil(sqrt(ItemCount));
rows := ceil(ItemCount / cols);
if rows * cols > ItemCount then
begin
inc(cols);
rows := ceil(ItemCount / cols);
end;
if rows * cols > ItemCount then
begin
dec(cols);
rows := ceil(ItemCount / cols);
end;
Offset += 20 + vSpace;
case Site of
0: begin
x := (Offset + ItemSize div 2) + (ItemSize + hSpace + d) * (index mod cols);
if (index div cols = rows - 1) and (ItemCount mod cols <> 0) then x := x + (ItemSize + hSpace + d) * (cols - ItemCount mod cols) / 2;
y := (ItemSize + vSpace) * (index div cols) - (ItemSize + vSpace) * (rows - 1) / 2;
result.x := round(x * s);
result.y := round(y * s);
end;
2: begin
x := progress * (Offset + ItemSize div 2) + (ItemSize + hSpace + d) * (cols - 1 - index mod cols);
if (index div cols = rows - 1) and (ItemCount mod cols <> 0) then x := x + (ItemSize + hSpace + d) * (cols - ItemCount mod cols) / 2;
y := (ItemSize + vSpace) * (index div cols) - (ItemSize + vSpace) * (rows - 1) / 2;
result.x := -round(x * s);
result.y := round(y * s);
end;
1: begin
x := (ItemSize + hSpace + d) * (index mod cols) - (ItemSize + hSpace + d) * (cols - 1) / 2;
if (index div cols = rows - 1) and (ItemCount mod cols <> 0) then x := x + (ItemSize + hSpace + d) * (cols - ItemCount mod cols) / 2;
y := (Offset + ItemSize div 2) + (ItemSize + vSpace) * (index div cols);
result.x := round(x * s);
result.y := round(y * s);
end;
3: begin
x := (ItemSize + hSpace + d) * (index mod cols) - (ItemSize + hSpace + d) * (cols - 1) / 2;
if (index div cols = rows - 1) and (ItemCount mod cols <> 0) then x := x + (ItemSize + hSpace + d) * (cols - ItemCount mod cols) / 2;
y := (Offset + ItemSize div 2) + (ItemSize + vSpace) * (rows - 1 - index div cols);
result.x := round(x * s);
result.y := -round(y * s);
end;
end;
end;
//------------------------------------------------------------------------------
function TStackModeController.GetCards(Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
var
cols, rows, hSpace, vSpace: integer;
x, y, d: extended;
begin
result.x := 0;
result.y := 0;
result.alpha := 0;
result.angle := 0;
hSpace := 50;
vSpace := 40;
if not ShowHint then vSpace := 10;
//s := 0.9 + (sin(progress * PI / 2) * 0.1);
result.alpha := round(255 * progress);
result.hint_alpha := 0;
if Progress = 1 then result.hint_alpha := 255;
result.hint_align := HA_HORIZONTAL_BOTTOM;
d := Distort * 3;
result.s := ItemSize;
cols := ceil(sqrt(ItemCount));
rows := ceil(ItemCount / cols);
if rows * cols > ItemCount then
begin
inc(cols);
rows := ceil(ItemCount / cols);
end;
if rows * cols > ItemCount then
begin
dec(cols);
rows := ceil(ItemCount / cols);
end;
Offset += 20 + vSpace;
case Site of
0: begin
y := (ItemSize + vSpace) * (index div cols) * progress - (ItemSize + vSpace) * (rows - 1) * progress / 2;
y := y * (1 - power(cos(progress * PI / 2), 2 / 3));
result.x := round(progress * (Offset + ItemSize div 2) + (ItemSize + vSpace + d) * (index mod cols) * progress);
result.y := round(y);
end;
2: begin
y := (ItemSize + vSpace) * (index div cols) * progress - (ItemSize + vSpace) * (rows - 1) * progress / 2;
y := y * (1 - power(cos(progress * PI / 2), 1 / 2));
result.x := -round(progress * (Offset + ItemSize div 2) + (ItemSize + vSpace + d) * (cols - 1 - index mod cols) * progress);
result.y := round(y);
end;
1: begin
x := (ItemSize + hSpace + d) * (index mod cols) * progress - (ItemSize + hSpace + d) * (cols - 1) * progress / 2;
x := x * (1 - power(cos(progress * PI / 2), 1 / 2));
result.x := round(x);
result.y := round(progress * (Offset + ItemSize div 2) + (ItemSize + vSpace) * (index div cols) * progress);
end;
3: begin
x := (ItemSize + hSpace + d) * (index mod cols) * progress - (ItemSize + hSpace + d) * (cols - 1) * progress / 2;
x := x * (1 - power(cos(progress * PI / 2), 1 / 2));
result.x := round(x);
result.y := -round(progress * (Offset + ItemSize div 2) + (ItemSize + vSpace) * (rows - 1 - index div cols) * progress);
end;
end;
end;
//------------------------------------------------------------------------------
function TStackModeController.GetLine(Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
var
x, y, d: extended;
begin
result.x := 0;
result.y := 0;
result.alpha := 0;
result.angle := 0;
Distort *= 2;
// simultaneous item count = 4 //
d := (progress * (ItemCount+4-1) / ItemCount - index / ItemCount) * ItemCount / 4;
if d < 0 then d := 0;
if d > 1 then d := 1;
d := sin(d * PI / 2);
result.s := round(ItemSize * d);
result.alpha := round(255 * d);
result.hint_alpha := trunc(max(progress - 0.5, 0) * 510);
x := ItemSize + 4 + Offset + (ItemSize + Distort + 4) * index;
y := 0;
result.angle := 0;
case Site of
0: begin
result.x := round(x);
result.y := round(y);
result.hint_align := HA_VERTICAL_TOP;
end;
2: begin
result.x := -round(x);
result.y := round(y);
result.hint_align := HA_VERTICAL_TOP;
end;
1: begin
result.x := -round(y);
result.y := round(x);
result.hint_align := HA_HORIZONTAL_RIGHT;
end;
3: begin
result.x := -round(y);
result.y := -round(x);
result.hint_align := HA_HORIZONTAL_RIGHT;
end;
end;
end;
//------------------------------------------------------------------------------
function TStackModeController.GetDoubleLine(Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
var
x, y, d: extended;
begin
result.x := 0;
result.y := 0;
result.alpha := 0;
result.angle := 0;
Distort *= 2;
// simultaneous item count = 4 //
d := (progress * (ItemCount+4-1) / ItemCount - trunc(index div 2) / ItemCount) * ItemCount / 4;
if d < 0 then d := 0;
if d > 1 then d := 1;
d := sin(d * PI / 2);
result.s := round(ItemSize * d);
result.alpha := round(255 * d);
result.hint_alpha := trunc(max(progress - 0.5, 0) * 510);
result.angle := 0;
x := ItemSize + 4 + Offset + (ItemSize + Distort + 4) * (index div 2);
y := ItemSize div 2 + 2 + Distort;
if index mod 2 = 0 then y := -y;
case Site of
0: begin
result.x := round(x);
result.y := round(y);
result.hint_align := HA_VERTICAL_BOTTOM;
if index mod 2 = 0 then result.hint_align := HA_VERTICAL_TOP;
end;
2: begin
result.x := -round(x);
result.y := round(y);
result.hint_align := HA_VERTICAL_BOTTOM;
if index mod 2 = 0 then result.hint_align := HA_VERTICAL_TOP;
end;
1: begin
result.x := -round(y);
result.y := round(x);
result.hint_align := HA_HORIZONTAL_LEFT;
if index mod 2 = 0 then result.hint_align := HA_HORIZONTAL_RIGHT;
end;
3: begin
result.x := -round(y);
result.y := -round(x);
result.hint_align := HA_HORIZONTAL_LEFT;
if index mod 2 = 0 then result.hint_align := HA_HORIZONTAL_RIGHT;
end;
end;
end;
//------------------------------------------------------------------------------
function TStackModeController.GetSun(
Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
var
x, y, ItemProgress, r, degreesPerStep, radiusMultiplier: extended;
SimultItemCount: integer;
begin
result.x := 0;
result.y := 0;
result.alpha := 0;
result.angle := 0;
radiusMultiplier := 9;
SimultItemCount := ItemCount * 2;
if Opening then
ItemProgress := (Progress * (ItemCount + SimultItemCount - 1) / ItemCount - index / ItemCount) * ItemCount / SimultItemCount
else
ItemProgress := (Progress * (ItemCount + SimultItemCount - 1) / ItemCount - index / ItemCount) * ItemCount / SimultItemCount;
//ItemProgress := (Progress * (ItemCount + SimultItemCount - 1) / ItemCount - (ItemCount - index - 1) / ItemCount) * ItemCount / SimultItemCount;
ItemProgress := 0.5 + ItemProgress * 0.5;
// (0 * (14 + 28 - 1) / 14 - 0 / 14) * 14 / 28
// (0 * (14 + 28 - 1) / 14 - (14 - 0 - 1) / 14) * 14 / 28
if ItemProgress < 0 then ItemProgress := 0;
if ItemProgress > 1 then ItemProgress := 1;
ItemProgress := sin(ItemProgress * PI / 2);
result.alpha := round(max(ItemProgress - 0.75, 0) * 1020);
result.hint_alpha := round(max(ItemProgress - 0.75, 0) * 1020);
r := (ItemSize + 3) * 20 * radiusMultiplier / 2 / PI * (1 + Distort / 10);
degreesPerStep := 18 / radiusMultiplier;
if Opening then
begin
x := r * cos((index - (ItemCount - 1) / 2) * PI * degreesPerStep / 180) * (0.5 + ItemProgress / 2) * sin(ItemProgress * 1.3 * PI / 2) / sin(1.3 * PI / 2);
y := r * sin((index - (ItemCount - 1) / 2) * PI * degreesPerStep / 180) * (0.5 + ItemProgress / 2) * sin(ItemProgress * 1.3 * PI / 2) / sin(1.3 * PI / 2);
result.s := round(ItemSize * ItemProgress * sin(ItemProgress * 1.3 * PI / 2) / sin(1.3 * PI / 2));
end else begin
x := r * cos((index - (ItemCount - 1) / 2) * PI * degreesPerStep / 180) * (0.5 + ItemProgress / 2);
y := r * sin((index - (ItemCount - 1) / 2) * PI * degreesPerStep / 180) * (0.5 + ItemProgress / 2);
result.s := round(ItemSize * ItemProgress);
end;
x := x + Offset + ItemSize * 1.5 - r * cos(((ItemCount + 1) / 2) * PI * degreesPerStep / 180);
result.angle := (index - (ItemCount - 1) / 2) * degreesPerStep;
case Site of
0: begin
result.hint_align := HA_HORIZONTAL_RIGHT;
result.x := round(x);
result.y := round(y);
if result.angle < 0 then result.angle := 360 + result.angle;
end;
2: begin
result.hint_align := HA_HORIZONTAL_LEFT;
result.x := -round(x);
result.y := round(y);
result.angle := -result.angle;
if result.angle < 0 then result.angle := 360 + result.angle;
end;
1: begin
result.hint_align := HA_VERTICAL_BOTTOM;
result.x := round(y);
result.y := round(x);
result.angle := -result.angle;
if result.angle < 0 then result.angle := 360 + result.angle;
end;
3: begin
result.hint_align := HA_VERTICAL_TOP;
result.x := round(y);
result.y := -round(x);
if result.angle < 0 then result.angle := 360 + result.angle;
end;
end;
end;
//------------------------------------------------------------------------------
function TStackModeController.GetParallelWave(Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
var
x, y, d: extended;
begin
result.x := 0;
result.y := 0;
result.alpha := 0;
result.angle := 0;
// simultaneous item count = 4 //
if Opening then d := (progress * (ItemCount+4-1) / ItemCount - index / ItemCount) * ItemCount / 4
else d := (progress * (ItemCount+4-1) / ItemCount - (ItemCount - index - 1) / ItemCount) * ItemCount / 4;
if d < 0 then d := 0;
if d > 1 then d := 1;
d := sin(d * PI / 2);
x := Offset + d * ItemSize * 2.5 - ItemSize;
if Opening then
begin
y := (ItemSize + 3 + abs(Distort * 2)) * ((index - (ItemCount - 1) / 2));
result.s := round(ItemSize * d * sin(d * 1.3 * PI / 2) / sin(1.3 * PI / 2));
end else begin
y := (ItemSize + 3 + abs(Distort * 2)) * ((index - (ItemCount - 1) / 2));
result.s := round(ItemSize * d);
end;
result.angle := 0;
result.alpha := round(255 * d);
result.hint_alpha := round(max(d - 0.5, 0) * 510);
case Site of
0: begin
result.hint_align := HA_HORIZONTAL_RIGHT;
result.x := round(x);
result.y := round(y);
end;
2: begin
result.hint_align := HA_HORIZONTAL_LEFT;
result.x := -round(x);
result.y := round(y);
result.angle := -result.angle;
end;
1: begin
result.hint_align := HA_VERTICAL_BOTTOM;
result.x := round(y);
result.y := round(x);
result.angle := -result.angle;
end;
3: begin
result.hint_align := HA_VERTICAL_TOP;
result.x := round(y);
result.y := -round(x);
end;
end;
end;
//------------------------------------------------------------------------------
function TStackModeController.GetParallel(Opening, ShowHint: boolean; Index: integer; Progress: extended;
ItemCount, Site, ItemSize, Offset, Distort: integer): TStackItemData;
var
x, y, p: extended;
begin
result.x := 0;
result.y := 0;
result.alpha := 0;
result.angle := 0;
p := 0.7 + (sin(progress * PI / 2) * 0.3);
result.alpha := round(255 * Progress);
result.hint_alpha := round(max(Progress - 0.5, 0) * 510);
result.s := ItemSize;
result.angle := 0;
x := Offset + p * ItemSize * 2.5 - ItemSize;
y := (ItemSize + 3 + abs(Distort * 2)) * ((index - (ItemCount - 1) / 2)) * p;
case Site of
0: begin
result.hint_align := HA_HORIZONTAL_RIGHT;
result.x := round(x);
result.y := round(y);
end;
2: begin
result.hint_align := HA_HORIZONTAL_LEFT;
result.x := -round(x);
result.y := round(y);
result.angle := -result.angle;
end;
1: begin
result.hint_align := HA_VERTICAL_BOTTOM;
result.x := round(y);
result.y := round(x);
result.angle := -result.angle;
end;
3: begin
result.hint_align := HA_VERTICAL_TOP;
result.x := round(y);
result.y := -round(x);
end;
end;
end;
//------------------------------------------------------------------------------
initialization
mc := TStackModeController.Create;
finalization
mc.free;
end.
| 36.837621 | 158 | 0.572382 |
475183352a8103604c3c5f1d3d8d3ab8c7564195 | 359 | lpr | Pascal | test_cac.lpr | NicolasKieffer/click_me | 47c6208a5a492cca61fb4eeb9fad39feb3f7a07e | [
"MIT"
]
| null | null | null | test_cac.lpr | NicolasKieffer/click_me | 47c6208a5a492cca61fb4eeb9fad39feb3f7a07e | [
"MIT"
]
| null | null | null | test_cac.lpr | NicolasKieffer/click_me | 47c6208a5a492cca61fb4eeb9fad39feb3f7a07e | [
"MIT"
]
| null | null | null | program test_cac;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, Unit1
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
| 16.318182 | 48 | 0.70195 |
47fb5dd2ae76e2624c8c523200717e54d77b5250 | 3,534 | pas | Pascal | sourceprinter.pas | nextjob/CodeSharkFC | 7db5ca941233844f3251920240200891c942b050 | [
"Unlicense"
]
| 2 | 2020-01-18T13:41:18.000Z | 2020-07-31T01:37:30.000Z | sourceprinter.pas | nextjob/CodeSharkFC | 7db5ca941233844f3251920240200891c942b050 | [
"Unlicense"
]
| 1 | 2020-01-25T13:19:43.000Z | 2020-01-25T13:19:43.000Z | sourceprinter.pas | nextjob/CodeSharkFC | 7db5ca941233844f3251920240200891c942b050 | [
"Unlicense"
]
| 3 | 2020-01-25T12:41:35.000Z | 2020-09-12T00:26:13.000Z | { Copyright (C) 2006 Darius Blaszijk
This source is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 2 of the License, or (at your option)
any later version.
This code is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
details.
A copy of the GNU General Public License is available on the World Wide Web
at <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by writing
to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
}
unit SourcePrinter;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Printers, Graphics, PrintersDlgs, ExtCtrls, GraphType;
type
TSourcePrinter = class(TObject)
private
FFont: TFont;
FShowLineNumbers: boolean;
LineHeight: double;
LinesPerPage: integer;
FMargin: integer;
PageCount: integer;
PrintDialog: TPrintDialog;
procedure PrintPage(Text: TStrings; PageNum: integer);
public
constructor Create;
destructor Destroy; override;
procedure Execute(Text: TStrings);
published
property Font: TFont read FFont write FFont;
property ShowLineNumbers: boolean read FShowLineNumbers write FShowLineNumbers;
property Margin: integer read FMargin write FMargin;
end;
implementation
constructor TSourcePrinter.Create;
begin
FFont := TFont.Create;
FFont.Name := 'Courier New';
FFont.Size := 10;
FFont.Color := clBlack;
PrintDialog := TPrintDialog.Create(nil);
ShowLineNumbers := True;
{$ifdef Linux}
Margin := 30;
{$else}
Margin := 0;
{$endif}
end;
destructor TSourcePrinter.Destroy;
begin
FFont.Free;
PrintDialog.Free;
end;
procedure TSourcePrinter.PrintPage(Text: TStrings; PageNum: integer);
var
l: integer;
s: string;
LineNum: integer;
begin
//print all lines on the current page
for l := 1 to LinesPerPage do
begin
LineNum := Pred(PageNum) * LinesPerPage + l;
//check if end of text is reached
if LineNum <= Text.Count then
begin
if ShowLineNumbers then
s := Format('%4d: ',[LineNum])
else
s := ' ';
s := s + Text[Pred(LineNum)];
Printer.Canvas.TextOut(Margin, Round(LineHeight * l), s);
end;
end;
end;
procedure TSourcePrinter.Execute(Text: TStrings);
var
p: integer;
//copies: integer;
begin
if PrintDialog.Execute then
begin
Printer.Title := 'Printers4LazIDE: Source Code Printer Package';
Printer.BeginDoc;
Printer.Canvas.Font := FFont;
//calculate page dimensions
LineHeight := Printer.Canvas.TextHeight('X') * 1.2;
LinesPerPage := Round(Printer.PageHeight / LineHeight -3);
PageCount := Text.Count div LinesPerPage;
if Text.Count mod LinesPerPage <> 0 then
Inc(PageCount);
try
//print each page
for p := 1 to PageCount do
begin
PrintPage(Text, p);
//create a new page
if p <> PageCount then
Printer.NewPage;
end;
Printer.EndDoc;
except
on E:Exception do
begin
Printer.Abort;
raise Exception.Create(e.message);
end;
end;
end;
end;
end.
| 24.713287 | 84 | 0.652801 |
fc85ce6c1324f45029e673cdb5d65a2a27a79439 | 298 | pas | Pascal | Curvas.pas | hsuderow/Scanning-Tunneling-Spectroscopy | ddf208a369f66a3218cebff42731ed5bb8e6ee8d | [
"CC0-1.0"
]
| null | null | null | Curvas.pas | hsuderow/Scanning-Tunneling-Spectroscopy | ddf208a369f66a3218cebff42731ed5bb8e6ee8d | [
"CC0-1.0"
]
| null | null | null | Curvas.pas | hsuderow/Scanning-Tunneling-Spectroscopy | ddf208a369f66a3218cebff42731ed5bb8e6ee8d | [
"CC0-1.0"
]
| null | null | null | unit Curvas;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm1 = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
end.
| 12.416667 | 76 | 0.634228 |
fc5417ffb550c7b1a5167e48311843a583b1c2e0 | 255 | dpr | Pascal | Example/C2WClientExampleD2010.dpr | corp2world/c2w-delphi-client | cbebdf9560340a9d27eac2ad01d129ee1626940e | [
"Apache-2.0"
]
| null | null | null | Example/C2WClientExampleD2010.dpr | corp2world/c2w-delphi-client | cbebdf9560340a9d27eac2ad01d129ee1626940e | [
"Apache-2.0"
]
| null | null | null | Example/C2WClientExampleD2010.dpr | corp2world/c2w-delphi-client | cbebdf9560340a9d27eac2ad01d129ee1626940e | [
"Apache-2.0"
]
| null | null | null | program C2WClientExample;
{$APPTYPE CONSOLE}
uses
C2WClient in 'C2WClient.pas',
SuperObject in '..\SO\SuperObject.pas',
C2WDataModels in '..\Core\C2WDataModels.pas',
C2WHttpService in '..\Core\C2WHttpService.pas';
begin
ExecuteExample;
end.
| 19.615385 | 49 | 0.733333 |
472cf1f922b3c4d791926bc5d8da81e98ae6b2b8 | 435 | pas | Pascal | Test/SimpleScripts/class_scoping1.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 79 | 2015-03-18T10:46:13.000Z | 2022-03-17T18:05:11.000Z | Test/SimpleScripts/class_scoping1.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 6 | 2016-03-29T14:39:00.000Z | 2020-09-14T10:04:14.000Z | Test/SimpleScripts/class_scoping1.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 25 | 2016-05-04T13:11:38.000Z | 2021-09-29T13:34:31.000Z | unit test;
interface
type
TTest1 = class
protected
Field : Integer;
end;
implementation
type
TTest2 = class
private
procedure Internal;
begin
end;
end;
TTest3 = class
Field1: TTest1;
Field2: TTest2;
procedure Here;
end;
procedure TTest3.Here;
begin
Print(IntToStr(Field1.Field));
Field2.Internal;
end;
end. | 13.181818 | 34 | 0.549425 |
fcfe4197212a33a9bfa5ce3a842b170de9a75a25 | 4,074 | pas | Pascal | src/Libs/Protocol/Implementations/NullProtocolProcessorImpl.pas | zamronypj/fano-framework | 559e385be5e1d26beada94c46eb8e760c4d855da | [
"MIT"
]
| 78 | 2019-01-31T13:40:48.000Z | 2022-03-22T17:26:54.000Z | src/Libs/Protocol/Implementations/NullProtocolProcessorImpl.pas | zamronypj/fano-framework | 559e385be5e1d26beada94c46eb8e760c4d855da | [
"MIT"
]
| 24 | 2020-01-04T11:50:53.000Z | 2022-02-17T09:55:23.000Z | src/Libs/Protocol/Implementations/NullProtocolProcessorImpl.pas | zamronypj/fano-framework | 559e385be5e1d26beada94c46eb8e760c4d855da | [
"MIT"
]
| 9 | 2018-11-05T03:43:24.000Z | 2022-01-21T17:23:30.000Z | {*!
* Fano Web Framework (https://fanoframework.github.io)
*
* @link https://github.com/fanoframework/fano
* @copyright Copyright (c) 2018 - 2021 Zamrony P. Juhara
* @license https://github.com/fanoframework/fano/blob/master/LICENSE (MIT)
*}
unit NullProtocolProcessorImpl;
interface
{$MODE OBJFPC}
{$H+}
uses
StreamAdapterIntf,
CloseableIntf,
ReadyListenerIntf,
StreamIdIntf,
ProtocolProcessorIntf;
type
(*!-----------------------------------------------
* null class having capability to process
* stream from web server
*
* @author Zamrony P. Juhara <zamronypj@yahoo.com>
*-----------------------------------------------*)
TNullProtocolProcessor = class(TInterfacedObject, IProtocolProcessor)
private
fStream : IStreamAdapter;
public
constructor create();
destructor destroy(); override;
(*!------------------------------------------------
* process request stream
*-----------------------------------------------*)
function process(
const stream : IStreamAdapter;
const streamCloser : ICloseable;
const streamId : IStreamId
) : boolean;
(*!------------------------------------------------
* get StdIn stream for complete request
*-----------------------------------------------*)
function getStdIn() : IStreamAdapter;
(*!------------------------------------------------
* set listener to be notified when request is ready
*-----------------------------------------------
* @return current instance
*-----------------------------------------------*)
function setReadyListener(const listener : IReadyListener) : IProtocolProcessor;
(*!------------------------------------------------
* get number of bytes of complete request based
* on information buffer
*-----------------------------------------------
* @return number of bytes of complete request
*-----------------------------------------------*)
function expectedSize(const buff : IStreamAdapter) : int64;
end;
implementation
uses
NullStreamAdapterImpl;
constructor TNullProtocolProcessor.create();
begin
inherited create();
fStream := TNullStreamAdapter.create();
end;
destructor TNullProtocolProcessor.destroy();
begin
fStream := nil;
inherited destroy();
end;
(*!------------------------------------------------
* process request stream
*-----------------------------------------------*)
function TNullProtocolProcessor.process(
const stream : IStreamAdapter;
const streamCloser : ICloseable;
const streamId : IStreamId
) : boolean;
begin
//intentionally does nothing
result := true;
end;
(*!------------------------------------------------
* get StdIn stream for complete request
*-----------------------------------------------*)
function TNullProtocolProcessor.getStdIn() : IStreamAdapter;
begin
result := fStream;
end;
(*!------------------------------------------------
* set listener to be notified when request is ready
*-----------------------------------------------
* @return current instance
*-----------------------------------------------*)
function TNullProtocolProcessor.setReadyListener(const listener : IReadyListener) : IProtocolProcessor;
begin
result := self;
end;
(*!------------------------------------------------
* get number of bytes of complete request based
* on information buffer
*-----------------------------------------------
* @return number of bytes of complete request
*-----------------------------------------------*)
function TNullProtocolProcessor.expectedSize(const buff : IStreamAdapter) : int64;
begin
//intentionally return empty size
result := 0;
end;
end.
| 31.338462 | 107 | 0.457536 |
479a87c192b5db7cc39a5c5fce403b4235bb284b | 314 | dpr | Pascal | windows/src/ext/jedi/jvcl/jvcl/examples/JvChartDemo/JvChartDemo.dpr | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/ext/jedi/jvcl/jvcl/examples/JvChartDemo/JvChartDemo.dpr | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/ext/jedi/jvcl/jvcl/examples/JvChartDemo/JvChartDemo.dpr | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | program JvChartDemo;
uses
Forms,
JvChartDemoFm in 'JvChartDemoFm.pas' {JvChartDemoForm},
StatsClasses in 'StatsClasses.pas',
JvChart in '..\..\run\JvChart.pas';
{$R *.res}
begin
Application.Title := 'JvChart Demo';
Application.CreateForm(TJvChartDemoForm, JvChartDemoForm);
Application.Run;
end.
| 18.470588 | 60 | 0.729299 |
c3372819cac0fd87c3669cf10889f166c1287501 | 41,239 | pas | Pascal | additional/synapse/sslinux.pas | Tallefer/kspnew | 57c69ac319c19e61ceb23e5a02759b98c9e4f8cd | [
"BSD-3-Clause"
]
| 14 | 2019-07-28T15:06:31.000Z | 2022-03-03T03:25:44.000Z | synapse/sslinux.pas | crossrw/iec104 | af8158226c1f7b68bb3447c91bf1b0549edf600b | [
"MIT"
]
| 1 | 2021-05-01T15:14:25.000Z | 2021-05-01T15:14:25.000Z | synapse/sslinux.pas | crossrw/iec104 | af8158226c1f7b68bb3447c91bf1b0549edf600b | [
"MIT"
]
| 4 | 2019-07-28T15:23:33.000Z | 2022-03-06T09:30:50.000Z | {==============================================================================|
| Project : Ararat Synapse | 002.000.008 |
|==============================================================================|
| Content: Socket Independent Platform Layer - Linux definition include |
|==============================================================================|
| Copyright (c)1999-2003, Lukas Gebauer |
| All rights reserved. |
| |
| Redistribution and use in source and binary forms, with or without |
| modification, are permitted provided that the following conditions are met: |
| |
| Redistributions of source code must retain the above copyright notice, this |
| list of conditions and the following disclaimer. |
| |
| Redistributions in binary form must reproduce the above copyright notice, |
| this list of conditions and the following disclaimer in the documentation |
| and/or other materials provided with the distribution. |
| |
| Neither the name of Lukas Gebauer nor the names of its contributors may |
| be used to endorse or promote products derived from this software without |
| specific prior written permission. |
| |
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
| AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR |
| ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
| DAMAGE. |
|==============================================================================|
| The Initial Developer of the Original Code is Lukas Gebauer (Czech Republic).|
| Portions created by Lukas Gebauer are Copyright (c)2003. |
| All Rights Reserved. |
|==============================================================================|
| Contributor(s): |
|==============================================================================|
| History: see HISTORY.HTM from distribution package |
| (Found at URL: http://www.ararat.cz/synapse/) |
|==============================================================================}
{:@exclude}
{$IFDEF LINUX}
//{$DEFINE FORCEOLDAPI}
{Note about define FORCEOLDAPI:
If you activate this compiler directive, then is allways used old socket API
for name resolution. If you leave this directive inactive, then the new API
is used, when running system allows it.
For IPv6 support you must have new API!
}
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
{$H+}
interface
uses
SyncObjs, SysUtils, Classes,
synafpc,
Libc;
function InitSocketInterface(stack: string): Boolean;
function DestroySocketInterface: Boolean;
const
WinsockLevel = $0202;
type
u_char = Char;
u_short = Word;
u_int = Integer;
u_long = Longint;
pu_long = ^u_long;
pu_short = ^u_short;
TSocket = u_int;
TAddrFamily = integer;
TMemory = pointer;
const
DLLStackName = 'libc.so.6';
cLocalhost = '127.0.0.1';
cAnyHost = '0.0.0.0';
cBroadcast = '255.255.255.255';
c6Localhost = '::1';
c6AnyHost = '::0';
c6Broadcast = 'ffff::1';
cAnyPort = '0';
type
DWORD = Integer;
__fd_mask = LongWord;
const
__FD_SETSIZE = 1024;
__NFDBITS = 8 * sizeof(__fd_mask);
type
__fd_set = {packed} record
fds_bits: packed array[0..(__FD_SETSIZE div __NFDBITS)-1] of __fd_mask;
end;
TFDSet = __fd_set;
PFDSet = ^TFDSet;
const
FIONREAD = $541B;
FIONBIO = $5421;
FIOASYNC = $5452;
type
PTimeVal = ^TTimeVal;
TTimeVal = packed record
tv_sec: Longint;
tv_usec: Longint;
end;
const
IPPROTO_IP = 0; { Dummy }
IPPROTO_ICMP = 1; { Internet Control Message Protocol }
IPPROTO_IGMP = 2; { Internet Group Management Protocol}
IPPROTO_TCP = 6; { TCP }
IPPROTO_UDP = 17; { User Datagram Protocol }
IPPROTO_IPV6 = 41;
IPPROTO_ICMPV6 = 58;
IPPROTO_RAW = 255;
IPPROTO_MAX = 256;
type
PInAddr = ^TInAddr;
TInAddr = packed record
case integer of
0: (S_bytes: packed array [0..3] of byte);
1: (S_addr: u_long);
end;
PSockAddrIn = ^TSockAddrIn;
TSockAddrIn = packed record
case Integer of
0: (sin_family: u_short;
sin_port: u_short;
sin_addr: TInAddr;
sin_zero: array[0..7] of Char);
1: (sa_family: u_short;
sa_data: array[0..13] of Char)
end;
TIP_mreq = record
imr_multiaddr: TInAddr; { IP multicast address of group }
imr_interface: TInAddr; { local IP address of interface }
end;
PInAddr6 = ^TInAddr6;
TInAddr6 = packed record
case integer of
0: (S6_addr: packed array [0..15] of byte);
1: (u6_addr8: packed array [0..15] of byte);
2: (u6_addr16: packed array [0..7] of word);
3: (u6_addr32: packed array [0..3] of integer);
end;
PSockAddrIn6 = ^TSockAddrIn6;
TSockAddrIn6 = packed record
sin6_family: u_short; // AF_INET6
sin6_port: u_short; // Transport level port number
sin6_flowinfo: u_long; // IPv6 flow information
sin6_addr: TInAddr6; // IPv6 address
sin6_scope_id: u_long; // Scope Id: IF number for link-local
// SITE id for site-local
end;
TIPv6_mreq = record
ipv6mr_multiaddr: TInAddr6; // IPv6 multicast address.
ipv6mr_interface: integer; // Interface index.
padding: u_long;
end;
PHostEnt = ^THostEnt;
THostent = record
h_name: PChar;
h_aliases: PPChar;
h_addrtype: Integer;
h_length: Cardinal;
case Byte of
0: (h_addr_list: PPChar);
1: (h_addr: PPChar);
end;
PNetEnt = ^TNetEnt;
TNetEnt = record
n_name: PChar;
n_aliases: PPChar;
n_addrtype: Integer;
n_net: uint32_t;
end;
PServEnt = ^TServEnt;
TServEnt = record
s_name: PChar;
s_aliases: PPChar;
s_port: Integer;
s_proto: PChar;
end;
PProtoEnt = ^TProtoEnt;
TProtoEnt = record
p_name: PChar;
p_aliases: ^PChar;
p_proto: u_short;
end;
const
INADDR_ANY = $00000000;
INADDR_LOOPBACK = $7F000001;
INADDR_BROADCAST = $FFFFFFFF;
INADDR_NONE = $FFFFFFFF;
ADDR_ANY = INADDR_ANY;
INVALID_SOCKET = TSocket(NOT(0));
SOCKET_ERROR = -1;
Const
IP_TOS = 1; { int; IP type of service and precedence. }
IP_TTL = 2; { int; IP time to live. }
IP_HDRINCL = 3; { int; Header is included with data. }
IP_OPTIONS = 4; { ip_opts; IP per-packet options. }
IP_ROUTER_ALERT = 5; { bool }
IP_RECVOPTS = 6; { bool }
IP_RETOPTS = 7; { bool }
IP_PKTINFO = 8; { bool }
IP_PKTOPTIONS = 9;
IP_PMTUDISC = 10; { obsolete name? }
IP_MTU_DISCOVER = 10; { int; see below }
IP_RECVERR = 11; { bool }
IP_RECVTTL = 12; { bool }
IP_RECVTOS = 13; { bool }
IP_MULTICAST_IF = 32; { in_addr; set/get IP multicast i/f }
IP_MULTICAST_TTL = 33; { u_char; set/get IP multicast ttl }
IP_MULTICAST_LOOP = 34; { i_char; set/get IP multicast loopback }
IP_ADD_MEMBERSHIP = 35; { ip_mreq; add an IP group membership }
IP_DROP_MEMBERSHIP = 36; { ip_mreq; drop an IP group membership }
SOL_SOCKET = 1;
SO_DEBUG = 1;
SO_REUSEADDR = 2;
SO_TYPE = 3;
SO_ERROR = 4;
SO_DONTROUTE = 5;
SO_BROADCAST = 6;
SO_SNDBUF = 7;
SO_RCVBUF = 8;
SO_KEEPALIVE = 9;
SO_OOBINLINE = 10;
SO_NO_CHECK = 11;
SO_PRIORITY = 12;
SO_LINGER = 13;
SO_BSDCOMPAT = 14;
SO_REUSEPORT = 15;
SO_PASSCRED = 16;
SO_PEERCRED = 17;
SO_RCVLOWAT = 18;
SO_SNDLOWAT = 19;
SO_RCVTIMEO = 20;
SO_SNDTIMEO = 21;
{ Security levels - as per NRL IPv6 - don't actually do anything }
SO_SECURITY_AUTHENTICATION = 22;
SO_SECURITY_ENCRYPTION_TRANSPORT = 23;
SO_SECURITY_ENCRYPTION_NETWORK = 24;
SO_BINDTODEVICE = 25;
{ Socket filtering }
SO_ATTACH_FILTER = 26;
SO_DETACH_FILTER = 27;
SOMAXCONN = 128;
IPV6_UNICAST_HOPS = 16;
IPV6_MULTICAST_IF = 17;
IPV6_MULTICAST_HOPS = 18;
IPV6_MULTICAST_LOOP = 19;
IPV6_JOIN_GROUP = 20;
IPV6_LEAVE_GROUP = 21;
MSG_NOSIGNAL = $4000; // Do not generate SIGPIPE.
// getnameinfo constants
NI_MAXHOST = 1025;
NI_MAXSERV = 32;
NI_NOFQDN = $4;
NI_NUMERICHOST = $1;
NI_NAMEREQD = $8;
NI_NUMERICSERV = $2;
NI_DGRAM = $10;
const
SOCK_STREAM = 1; { stream socket }
SOCK_DGRAM = 2; { datagram socket }
SOCK_RAW = 3; { raw-protocol interface }
SOCK_RDM = 4; { reliably-delivered message }
SOCK_SEQPACKET = 5; { sequenced packet stream }
{ TCP options. }
TCP_NODELAY = $0001;
{ Address families. }
AF_UNSPEC = 0; { unspecified }
AF_INET = 2; { internetwork: UDP, TCP, etc. }
AF_INET6 = 10; { Internetwork Version 6 }
AF_MAX = 24;
{ Protocol families, same as address families for now. }
PF_UNSPEC = AF_UNSPEC;
PF_INET = AF_INET;
PF_INET6 = AF_INET6;
PF_MAX = AF_MAX;
type
{ Structure used by kernel to store most addresses. }
PSockAddr = ^TSockAddr;
TSockAddr = TSockAddrIn;
{ Structure used by kernel to pass protocol information in raw sockets. }
PSockProto = ^TSockProto;
TSockProto = packed record
sp_family: u_short;
sp_protocol: u_short;
end;
type
PAddrInfo = ^TAddrInfo;
TAddrInfo = record
ai_flags: integer; // AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST.
ai_family: integer; // PF_xxx.
ai_socktype: integer; // SOCK_xxx.
ai_protocol: integer; // 0 or IPPROTO_xxx for IPv4 and IPv6.
ai_addrlen: u_int; // Length of ai_addr.
ai_addr: PSockAddr; // Binary address.
ai_canonname: PChar; // Canonical name for nodename.
ai_next: PAddrInfo; // Next structure in linked list.
end;
const
// Flags used in "hints" argument to getaddrinfo().
AI_PASSIVE = $1; // Socket address will be used in bind() call.
AI_CANONNAME = $2; // Return canonical name in first ai_canonname.
AI_NUMERICHOST = $4; // Nodename must be a numeric address string.
type
{ Structure used for manipulating linger option. }
PLinger = ^TLinger;
TLinger = packed record
l_onoff: integer;
l_linger: integer;
end;
const
MSG_OOB = $01; // Process out-of-band data.
MSG_PEEK = $02; // Peek at incoming messages.
const
WSAEINTR = EINTR;
WSAEBADF = EBADF;
WSAEACCES = EACCES;
WSAEFAULT = EFAULT;
WSAEINVAL = EINVAL;
WSAEMFILE = EMFILE;
WSAEWOULDBLOCK = EWOULDBLOCK;
WSAEINPROGRESS = EINPROGRESS;
WSAEALREADY = EALREADY;
WSAENOTSOCK = ENOTSOCK;
WSAEDESTADDRREQ = EDESTADDRREQ;
WSAEMSGSIZE = EMSGSIZE;
WSAEPROTOTYPE = EPROTOTYPE;
WSAENOPROTOOPT = ENOPROTOOPT;
WSAEPROTONOSUPPORT = EPROTONOSUPPORT;
WSAESOCKTNOSUPPORT = ESOCKTNOSUPPORT;
WSAEOPNOTSUPP = EOPNOTSUPP;
WSAEPFNOSUPPORT = EPFNOSUPPORT;
WSAEAFNOSUPPORT = EAFNOSUPPORT;
WSAEADDRINUSE = EADDRINUSE;
WSAEADDRNOTAVAIL = EADDRNOTAVAIL;
WSAENETDOWN = ENETDOWN;
WSAENETUNREACH = ENETUNREACH;
WSAENETRESET = ENETRESET;
WSAECONNABORTED = ECONNABORTED;
WSAECONNRESET = ECONNRESET;
WSAENOBUFS = ENOBUFS;
WSAEISCONN = EISCONN;
WSAENOTCONN = ENOTCONN;
WSAESHUTDOWN = ESHUTDOWN;
WSAETOOMANYREFS = ETOOMANYREFS;
WSAETIMEDOUT = ETIMEDOUT;
WSAECONNREFUSED = ECONNREFUSED;
WSAELOOP = ELOOP;
WSAENAMETOOLONG = ENAMETOOLONG;
WSAEHOSTDOWN = EHOSTDOWN;
WSAEHOSTUNREACH = EHOSTUNREACH;
WSAENOTEMPTY = ENOTEMPTY;
WSAEPROCLIM = -1;
WSAEUSERS = EUSERS;
WSAEDQUOT = EDQUOT;
WSAESTALE = ESTALE;
WSAEREMOTE = EREMOTE;
WSASYSNOTREADY = -2;
WSAVERNOTSUPPORTED = -3;
WSANOTINITIALISED = -4;
WSAEDISCON = -5;
WSAHOST_NOT_FOUND = HOST_NOT_FOUND;
WSATRY_AGAIN = TRY_AGAIN;
WSANO_RECOVERY = NO_RECOVERY;
WSANO_DATA = -6;
EAI_BADFLAGS = -1; { Invalid value for `ai_flags' field. }
EAI_NONAME = -2; { NAME or SERVICE is unknown. }
EAI_AGAIN = -3; { Temporary failure in name resolution. }
EAI_FAIL = -4; { Non-recoverable failure in name res. }
EAI_NODATA = -5; { No address associated with NAME. }
EAI_FAMILY = -6; { `ai_family' not supported. }
EAI_SOCKTYPE = -7; { `ai_socktype' not supported. }
EAI_SERVICE = -8; { SERVICE not supported for `ai_socktype'. }
EAI_ADDRFAMILY = -9; { Address family for NAME not supported. }
EAI_MEMORY = -10; { Memory allocation failure. }
EAI_SYSTEM = -11; { System error returned in `errno'. }
const
WSADESCRIPTION_LEN = 256;
WSASYS_STATUS_LEN = 128;
type
PWSAData = ^TWSAData;
TWSAData = packed record
wVersion: Word;
wHighVersion: Word;
szDescription: array[0..WSADESCRIPTION_LEN] of Char;
szSystemStatus: array[0..WSASYS_STATUS_LEN] of Char;
iMaxSockets: Word;
iMaxUdpDg: Word;
lpVendorInfo: PChar;
end;
function IN6_IS_ADDR_UNSPECIFIED(const a: PInAddr6): boolean;
function IN6_IS_ADDR_LOOPBACK(const a: PInAddr6): boolean;
function IN6_IS_ADDR_LINKLOCAL(const a: PInAddr6): boolean;
function IN6_IS_ADDR_SITELOCAL(const a: PInAddr6): boolean;
function IN6_IS_ADDR_MULTICAST(const a: PInAddr6): boolean;
function IN6_ADDR_EQUAL(const a: PInAddr6; const b: PInAddr6):boolean;
procedure SET_IN6_IF_ADDR_ANY (const a: PInAddr6);
procedure SET_LOOPBACK_ADDR6 (const a: PInAddr6);
var
in6addr_any, in6addr_loopback : TInAddr6;
procedure FD_CLR(Socket: TSocket; var FDSet: TFDSet);
function FD_ISSET(Socket: TSocket; var FDSet: TFDSet): Boolean;
procedure FD_SET(Socket: TSocket; var FDSet: TFDSet);
procedure FD_ZERO(var FDSet: TFDSet);
{=============================================================================}
type
TWSAStartup = function(wVersionRequired: Word; var WSData: TWSAData): Integer;
cdecl;
TWSACleanup = function: Integer;
cdecl;
TWSAGetLastError = function: Integer;
cdecl;
TGetServByName = function(name, proto: PChar): PServEnt;
cdecl;
TGetServByPort = function(port: Integer; proto: PChar): PServEnt;
cdecl;
TGetProtoByName = function(name: PChar): PProtoEnt;
cdecl;
TGetProtoByNumber = function(proto: Integer): PProtoEnt;
cdecl;
TGetHostByName = function(name: PChar): PHostEnt;
cdecl;
TGetHostByAddr = function(addr: Pointer; len, Struc: Integer): PHostEnt;
cdecl;
TGetHostName = function(name: PChar; len: Integer): Integer;
cdecl;
TShutdown = function(s: TSocket; how: Integer): Integer;
cdecl;
TSetSockOpt = function(s: TSocket; level, optname: Integer; optval: PChar;
optlen: Integer): Integer;
cdecl;
TGetSockOpt = function(s: TSocket; level, optname: Integer; optval: PChar;
var optlen: Integer): Integer;
cdecl;
TSendTo = function(s: TSocket; const Buf; len, flags: Integer; addrto: PSockAddr;
tolen: Integer): Integer;
cdecl;
TSend = function(s: TSocket; const Buf; len, flags: Integer): Integer;
cdecl;
TRecv = function(s: TSocket; var Buf; len, flags: Integer): Integer;
cdecl;
TRecvFrom = function(s: TSocket; var Buf; len, flags: Integer; from: PSockAddr;
var fromlen: Integer): Integer;
cdecl;
Tntohs = function(netshort: u_short): u_short;
cdecl;
Tntohl = function(netlong: u_long): u_long;
cdecl;
TListen = function(s: TSocket; backlog: Integer): Integer;
cdecl;
TIoctlSocket = function(s: TSocket; cmd: DWORD; var arg: integer): Integer;
cdecl;
TInet_ntoa = function(inaddr: TInAddr): PChar;
cdecl;
TInet_addr = function(cp: PChar): u_long;
cdecl;
Thtons = function(hostshort: u_short): u_short;
cdecl;
Thtonl = function(hostlong: u_long): u_long;
cdecl;
TGetSockName = function(s: TSocket; name: PSockAddr; var namelen: Integer): Integer;
cdecl;
TGetPeerName = function(s: TSocket; name: PSockAddr; var namelen: Integer): Integer;
cdecl;
TConnect = function(s: TSocket; name: PSockAddr; namelen: Integer): Integer;
cdecl;
TCloseSocket = function(s: TSocket): Integer;
cdecl;
TBind = function(s: TSocket; addr: PSockAddr; namelen: Integer): Integer;
cdecl;
TAccept = function(s: TSocket; addr: PSockAddr; var addrlen: Integer): TSocket;
cdecl;
TTSocket = function(af, Struc, Protocol: Integer): TSocket;
cdecl;
TSelect = function(nfds: Integer; readfds, writefds, exceptfds: PFDSet;
timeout: PTimeVal): Longint;
cdecl;
TGetAddrInfo = function(NodeName: PChar; ServName: PChar; Hints: PAddrInfo;
var Addrinfo: PAddrInfo): integer;
cdecl;
TFreeAddrInfo = procedure(ai: PAddrInfo);
cdecl;
TGetNameInfo = function( addr: PSockAddr; namelen: Integer; host: PChar;
hostlen: DWORD; serv: PChar; servlen: DWORD; flags: integer): integer;
cdecl;
var
WSAStartup: TWSAStartup = nil;
WSACleanup: TWSACleanup = nil;
WSAGetLastError: TWSAGetLastError = nil;
GetServByName: TGetServByName = nil;
GetServByPort: TGetServByPort = nil;
GetProtoByName: TGetProtoByName = nil;
GetProtoByNumber: TGetProtoByNumber = nil;
GetHostByName: TGetHostByName = nil;
GetHostByAddr: TGetHostByAddr = nil;
ssGetHostName: TGetHostName = nil;
Shutdown: TShutdown = nil;
SetSockOpt: TSetSockOpt = nil;
GetSockOpt: TGetSockOpt = nil;
ssSendTo: TSendTo = nil;
ssSend: TSend = nil;
ssRecv: TRecv = nil;
ssRecvFrom: TRecvFrom = nil;
ntohs: Tntohs = nil;
ntohl: Tntohl = nil;
Listen: TListen = nil;
IoctlSocket: TIoctlSocket = nil;
Inet_ntoa: TInet_ntoa = nil;
Inet_addr: TInet_addr = nil;
htons: Thtons = nil;
htonl: Thtonl = nil;
ssGetSockName: TGetSockName = nil;
ssGetPeerName: TGetPeerName = nil;
ssConnect: TConnect = nil;
CloseSocket: TCloseSocket = nil;
ssBind: TBind = nil;
ssAccept: TAccept = nil;
Socket: TTSocket = nil;
Select: TSelect = nil;
GetAddrInfo: TGetAddrInfo = nil;
FreeAddrInfo: TFreeAddrInfo = nil;
GetNameInfo: TGetNameInfo = nil;
function LSWSAStartup(wVersionRequired: Word; var WSData: TWSAData): Integer; cdecl;
function LSWSACleanup: Integer; cdecl;
function LSWSAGetLastError: Integer; cdecl;
var
SynSockCS: SyncObjs.TCriticalSection;
SockEnhancedApi: Boolean;
SockWship6Api: Boolean;
type
TVarSin = packed record
case integer of
0: (AddressFamily: u_short);
1: (
case sin_family: u_short of
AF_INET: (sin_port: u_short;
sin_addr: TInAddr;
sin_zero: array[0..7] of Char);
AF_INET6: (sin6_port: u_short;
sin6_flowinfo: u_long;
sin6_addr: TInAddr6;
sin6_scope_id: u_long);
);
end;
function SizeOfVarSin(sin: TVarSin): integer;
function Bind(s: TSocket; const addr: TVarSin): Integer;
function Connect(s: TSocket; const name: TVarSin): Integer;
function GetSockName(s: TSocket; var name: TVarSin): Integer;
function GetPeerName(s: TSocket; var name: TVarSin): Integer;
function GetHostName: string;
function Send(s: TSocket; Buf: TMemory; len, flags: Integer): Integer;
function Recv(s: TSocket; Buf: TMemory; len, flags: Integer): Integer;
function SendTo(s: TSocket; Buf: TMemory; len, flags: Integer; addrto: TVarSin): Integer;
function RecvFrom(s: TSocket; Buf: TMemory; len, flags: Integer; var from: TVarSin): Integer;
function Accept(s: TSocket; var addr: TVarSin): TSocket;
function IsNewApi(Family: integer): Boolean;
function SetVarSin(var Sin: TVarSin; IP, Port: string; Family, SockProtocol, SockType: integer; PreferIP4: Boolean): integer;
function GetSinIP(Sin: TVarSin): string;
function GetSinPort(Sin: TVarSin): Integer;
procedure ResolveNameToIP(Name: string; Family, SockProtocol, SockType: integer; const IPList: TStrings);
function ResolveIPToName(IP: string; Family, SockProtocol, SockType: integer): string;
function ResolvePort(Port: string; Family, SockProtocol, SockType: integer): Word;
{==============================================================================}
implementation
var
SynSockCount: Integer = 0;
LibHandle: TLibHandle = 0;
Libwship6Handle: TLibHandle = 0;
function IN6_IS_ADDR_UNSPECIFIED(const a: PInAddr6): boolean;
begin
Result := ((a^.u6_addr32[0] = 0) and (a^.u6_addr32[1] = 0) and
(a^.u6_addr32[2] = 0) and (a^.u6_addr32[3] = 0));
end;
function IN6_IS_ADDR_LOOPBACK(const a: PInAddr6): boolean;
begin
Result := ((a^.u6_addr32[0] = 0) and (a^.u6_addr32[1] = 0) and
(a^.u6_addr32[2] = 0) and
(a^.u6_addr8[12] = 0) and (a^.u6_addr8[13] = 0) and
(a^.u6_addr8[14] = 0) and (a^.u6_addr8[15] = 1));
end;
function IN6_IS_ADDR_LINKLOCAL(const a: PInAddr6): boolean;
begin
Result := ((a^.u6_addr8[0] = $FE) and (a^.u6_addr8[1] = $80));
end;
function IN6_IS_ADDR_SITELOCAL(const a: PInAddr6): boolean;
begin
Result := ((a^.u6_addr8[0] = $FE) and (a^.u6_addr8[1] = $C0));
end;
function IN6_IS_ADDR_MULTICAST(const a: PInAddr6): boolean;
begin
Result := (a^.u6_addr8[0] = $FF);
end;
function IN6_ADDR_EQUAL(const a: PInAddr6; const b: PInAddr6): boolean;
begin
Result := (CompareMem( a, b, sizeof(TInAddr6)));
end;
procedure SET_IN6_IF_ADDR_ANY (const a: PInAddr6);
begin
FillChar(a^, sizeof(TInAddr6), 0);
end;
procedure SET_LOOPBACK_ADDR6 (const a: PInAddr6);
begin
FillChar(a^, sizeof(TInAddr6), 0);
a^.u6_addr8[15] := 1;
end;
{=============================================================================}
var
{$IFNDEF VER1_0} //FTP version 1.0.x
errno_loc: function: PInteger cdecl = nil;
{$ELSE}
errno_loc: function: PInteger = nil; cdecl;
{$ENDIF}
function LSWSAStartup(wVersionRequired: Word; var WSData: TWSAData): Integer;
begin
with WSData do
begin
wVersion := wVersionRequired;
wHighVersion := $202;
szDescription := 'Synsock - Synapse Platform Independent Socket Layer';
szSystemStatus := 'Running on Linux';
iMaxSockets := 32768;
iMaxUdpDg := 8192;
end;
Result := 0;
end;
function LSWSACleanup: Integer;
begin
Result := 0;
end;
function LSWSAGetLastError: Integer;
var
p: PInteger;
begin
p := errno_loc;
Result := p^;
end;
function __FDELT(Socket: TSocket): Integer;
begin
Result := Socket div __NFDBITS;
end;
function __FDMASK(Socket: TSocket): __fd_mask;
begin
Result := LongWord(1) shl (Socket mod __NFDBITS);
end;
function FD_ISSET(Socket: TSocket; var fdset: TFDSet): Boolean;
begin
Result := (fdset.fds_bits[__FDELT(Socket)] and __FDMASK(Socket)) <> 0;
end;
procedure FD_SET(Socket: TSocket; var fdset: TFDSet);
begin
fdset.fds_bits[__FDELT(Socket)] := fdset.fds_bits[__FDELT(Socket)] or __FDMASK(Socket);
end;
procedure FD_CLR(Socket: TSocket; var fdset: TFDSet);
begin
fdset.fds_bits[__FDELT(Socket)] := fdset.fds_bits[__FDELT(Socket)] and (not __FDMASK(Socket));
end;
procedure FD_ZERO(var fdset: TFDSet);
var
I: Integer;
begin
with fdset do
for I := Low(fds_bits) to High(fds_bits) do
fds_bits[I] := 0;
end;
{=============================================================================}
function SizeOfVarSin(sin: TVarSin): integer;
begin
case sin.sin_family of
AF_INET:
Result := SizeOf(TSockAddrIn);
AF_INET6:
Result := SizeOf(TSockAddrIn6);
else
Result := 0;
end;
end;
{=============================================================================}
function Bind(s: TSocket; const addr: TVarSin): Integer;
begin
Result := ssBind(s, @addr, SizeOfVarSin(addr));
end;
function Connect(s: TSocket; const name: TVarSin): Integer;
begin
Result := ssConnect(s, @name, SizeOfVarSin(name));
end;
function GetSockName(s: TSocket; var name: TVarSin): Integer;
var
len: integer;
begin
len := SizeOf(name);
FillChar(name, len, 0);
Result := ssGetSockName(s, @name, Len);
end;
function GetPeerName(s: TSocket; var name: TVarSin): Integer;
var
len: integer;
begin
len := SizeOf(name);
FillChar(name, len, 0);
Result := ssGetPeerName(s, @name, Len);
end;
function GetHostName: string;
var
s: string;
begin
Result := '';
setlength(s, 255);
ssGetHostName(pchar(s), Length(s) - 1);
Result := Pchar(s);
end;
function Send(s: TSocket; Buf: TMemory; len, flags: Integer): Integer;
begin
Result := ssSend(s, Buf^, len, flags);
end;
function Recv(s: TSocket; Buf: TMemory; len, flags: Integer): Integer;
begin
Result := ssRecv(s, Buf^, len, flags);
end;
function SendTo(s: TSocket; Buf: TMemory; len, flags: Integer; addrto: TVarSin): Integer;
begin
Result := ssSendTo(s, Buf^, len, flags, @addrto, SizeOfVarSin(addrto));
end;
function RecvFrom(s: TSocket; Buf: TMemory; len, flags: Integer; var from: TVarSin): Integer;
var
x: integer;
begin
x := SizeOf(from);
Result := ssRecvFrom(s, Buf^, len, flags, @from, x);
end;
function Accept(s: TSocket; var addr: TVarSin): TSocket;
var
x: integer;
begin
x := SizeOf(addr);
Result := ssAccept(s, @addr, x);
end;
{=============================================================================}
function IsNewApi(Family: integer): Boolean;
begin
Result := SockEnhancedApi;
if not Result then
Result := (Family = AF_INET6) and SockWship6Api;
end;
function SetVarSin(var Sin: TVarSin; IP, Port: string; Family, SockProtocol, SockType: integer; PreferIP4: Boolean): integer;
type
pu_long = ^u_long;
var
ProtoEnt: PProtoEnt;
ServEnt: PServEnt;
HostEnt: PHostEnt;
r: integer;
Hints1, Hints2: TAddrInfo;
Sin1, Sin2: TVarSin;
TwoPass: boolean;
function GetAddr(const IP, port: string; Hints: TAddrInfo; var Sin: TVarSin): integer;
var
Addr: PAddrInfo;
begin
Addr := nil;
try
FillChar(Sin, Sizeof(Sin), 0);
if Hints.ai_socktype = SOCK_RAW then
begin
Hints.ai_socktype := 0;
Hints.ai_protocol := 0;
Result := synsock.GetAddrInfo(PChar(IP), nil, @Hints, Addr);
end
else
begin
if (IP = cAnyHost) or (IP = c6AnyHost) then
begin
Hints.ai_flags := AI_PASSIVE;
Result := synsock.GetAddrInfo(nil, PChar(Port), @Hints, Addr);
end
else
if (IP = cLocalhost) or (IP = c6Localhost) then
begin
Result := synsock.GetAddrInfo(nil, PChar(Port), @Hints, Addr);
end
else
begin
Result := synsock.GetAddrInfo(PChar(IP), PChar(Port), @Hints, Addr);
end;
end;
if Result = 0 then
if (Addr <> nil) then
Move(Addr^.ai_addr^, Sin, Addr^.ai_addrlen);
finally
if Assigned(Addr) then
synsock.FreeAddrInfo(Addr);
end;
end;
begin
Result := 0;
FillChar(Sin, Sizeof(Sin), 0);
if not IsNewApi(family) then
begin
SynSockCS.Enter;
try
Sin.sin_family := AF_INET;
ProtoEnt := synsock.GetProtoByNumber(SockProtocol);
ServEnt := nil;
if ProtoEnt <> nil then
ServEnt := synsock.GetServByName(PChar(Port), ProtoEnt^.p_name);
if ServEnt = nil then
Sin.sin_port := synsock.htons(StrToIntDef(Port, 0))
else
Sin.sin_port := ServEnt^.s_port;
if IP = cBroadcast then
Sin.sin_addr.s_addr := u_long(INADDR_BROADCAST)
else
begin
Sin.sin_addr.s_addr := synsock.inet_addr(PChar(IP));
if Sin.sin_addr.s_addr = u_long(INADDR_NONE) then
begin
HostEnt := synsock.GetHostByName(PChar(IP));
Result := synsock.WSAGetLastError;
if HostEnt <> nil then
Sin.sin_addr.S_addr := u_long(Pu_long(HostEnt^.h_addr_list^)^);
end;
end;
finally
SynSockCS.Leave;
end;
end
else
begin
FillChar(Hints1, Sizeof(Hints1), 0);
FillChar(Hints2, Sizeof(Hints2), 0);
TwoPass := False;
if Family = AF_UNSPEC then
begin
if PreferIP4 then
begin
Hints1.ai_family := AF_INET;
Hints2.ai_family := AF_INET6;
TwoPass := True;
end
else
begin
Hints2.ai_family := AF_INET;
Hints1.ai_family := AF_INET6;
TwoPass := True;
end;
end
else
Hints1.ai_family := Family;
Hints1.ai_socktype := SockType;
Hints1.ai_protocol := SockProtocol;
Hints2.ai_socktype := Hints1.ai_socktype;
Hints2.ai_protocol := Hints1.ai_protocol;
r := GetAddr(IP, Port, Hints1, Sin1);
Result := r;
sin := sin1;
if r <> 0 then
if TwoPass then
begin
r := GetAddr(IP, Port, Hints2, Sin2);
Result := r;
if r = 0 then
sin := sin2;
end;
end;
end;
function GetSinIP(Sin: TVarSin): string;
var
p: PChar;
host, serv: string;
hostlen, servlen: integer;
r: integer;
begin
Result := '';
if not IsNewApi(Sin.AddressFamily) then
begin
p := synsock.inet_ntoa(Sin.sin_addr);
if p <> nil then
Result := p;
end
else
begin
hostlen := NI_MAXHOST;
servlen := NI_MAXSERV;
setlength(host, hostlen);
setlength(serv, servlen);
r := getnameinfo(@sin, SizeOfVarSin(sin), PChar(host), hostlen,
PChar(serv), servlen, NI_NUMERICHOST + NI_NUMERICSERV);
if r = 0 then
Result := PChar(host);
end;
end;
function GetSinPort(Sin: TVarSin): Integer;
begin
if (Sin.sin_family = AF_INET6) then
Result := synsock.ntohs(Sin.sin6_port)
else
Result := synsock.ntohs(Sin.sin_port);
end;
procedure ResolveNameToIP(Name: string; Family, SockProtocol, SockType: integer; const IPList: TStrings);
type
TaPInAddr = array[0..250] of PInAddr;
PaPInAddr = ^TaPInAddr;
var
Hints: TAddrInfo;
Addr: PAddrInfo;
AddrNext: PAddrInfo;
r: integer;
host, serv: string;
hostlen, servlen: integer;
RemoteHost: PHostEnt;
IP: u_long;
PAdrPtr: PaPInAddr;
i: Integer;
s: string;
InAddr: TInAddr;
begin
IPList.Clear;
if not IsNewApi(Family) then
begin
IP := synsock.inet_addr(PChar(Name));
if IP = u_long(INADDR_NONE) then
begin
SynSockCS.Enter;
try
RemoteHost := synsock.GetHostByName(PChar(Name));
if RemoteHost <> nil then
begin
PAdrPtr := PAPInAddr(RemoteHost^.h_addr_list);
i := 0;
while PAdrPtr^[i] <> nil do
begin
InAddr := PAdrPtr^[i]^;
s := Format('%d.%d.%d.%d', [InAddr.S_bytes[0], InAddr.S_bytes[1],
InAddr.S_bytes[2], InAddr.S_bytes[3]]);
IPList.Add(s);
Inc(i);
end;
end;
finally
SynSockCS.Leave;
end;
end
else
IPList.Add(Name);
end
else
begin
Addr := nil;
try
FillChar(Hints, Sizeof(Hints), 0);
Hints.ai_family := AF_UNSPEC;
Hints.ai_socktype := SockType;
Hints.ai_protocol := SockProtocol;
Hints.ai_flags := 0;
r := synsock.GetAddrInfo(PChar(Name), nil, @Hints, Addr);
if r = 0 then
begin
AddrNext := Addr;
while not(AddrNext = nil) do
begin
if not(((Family = AF_INET6) and (AddrNext^.ai_family = AF_INET))
or ((Family = AF_INET) and (AddrNext^.ai_family = AF_INET6))) then
begin
hostlen := NI_MAXHOST;
servlen := NI_MAXSERV;
setlength(host, hostlen);
setlength(serv, servlen);
r := getnameinfo(AddrNext^.ai_addr, AddrNext^.ai_addrlen,
PChar(host), hostlen, PChar(serv), servlen,
NI_NUMERICHOST + NI_NUMERICSERV);
if r = 0 then
begin
host := PChar(host);
IPList.Add(host);
end;
end;
AddrNext := AddrNext^.ai_next;
end;
end;
finally
if Assigned(Addr) then
synsock.FreeAddrInfo(Addr);
end;
end;
if IPList.Count = 0 then
IPList.Add(cAnyHost);
end;
function ResolvePort(Port: string; Family, SockProtocol, SockType: integer): Word;
var
ProtoEnt: PProtoEnt;
ServEnt: PServEnt;
Hints: TAddrInfo;
Addr: PAddrInfo;
r: integer;
begin
Result := 0;
if not IsNewApi(Family) then
begin
SynSockCS.Enter;
try
ProtoEnt := synsock.GetProtoByNumber(SockProtocol);
ServEnt := nil;
if ProtoEnt <> nil then
ServEnt := synsock.GetServByName(PChar(Port), ProtoEnt^.p_name);
if ServEnt = nil then
Result := StrToIntDef(Port, 0)
else
Result := synsock.htons(ServEnt^.s_port);
finally
SynSockCS.Leave;
end;
end
else
begin
Addr := nil;
try
FillChar(Hints, Sizeof(Hints), 0);
Hints.ai_family := AF_UNSPEC;
Hints.ai_socktype := SockType;
Hints.ai_protocol := Sockprotocol;
Hints.ai_flags := AI_PASSIVE;
r := synsock.GetAddrInfo(nil, PChar(Port), @Hints, Addr);
if (r = 0) and Assigned(Addr) then
begin
if Addr^.ai_family = AF_INET then
Result := synsock.htons(Addr^.ai_addr^.sin_port);
if Addr^.ai_family = AF_INET6 then
Result := synsock.htons(PSockAddrIn6(Addr^.ai_addr)^.sin6_port);
end;
finally
if Assigned(Addr) then
synsock.FreeAddrInfo(Addr);
end;
end;
end;
function ResolveIPToName(IP: string; Family, SockProtocol, SockType: integer): string;
var
Hints: TAddrInfo;
Addr: PAddrInfo;
r: integer;
host, serv: string;
hostlen, servlen: integer;
RemoteHost: PHostEnt;
IPn: u_long;
begin
Result := IP;
if not IsNewApi(Family) then
begin
IPn := synsock.inet_addr(PChar(IP));
if IPn <> u_long(INADDR_NONE) then
begin
SynSockCS.Enter;
try
RemoteHost := GetHostByAddr(@IPn, SizeOf(IPn), AF_INET);
if RemoteHost <> nil then
Result := RemoteHost^.h_name;
finally
SynSockCS.Leave;
end;
end;
end
else
begin
Addr := nil;
try
FillChar(Hints, Sizeof(Hints), 0);
Hints.ai_family := AF_UNSPEC;
Hints.ai_socktype := SockType;
Hints.ai_protocol := SockProtocol;
Hints.ai_flags := 0;
r := synsock.GetAddrInfo(PChar(IP), nil, @Hints, Addr);
if (r = 0) and Assigned(Addr)then
begin
hostlen := NI_MAXHOST;
servlen := NI_MAXSERV;
setlength(host, hostlen);
setlength(serv, servlen);
r := getnameinfo(Addr^.ai_addr, Addr^.ai_addrlen,
PChar(host), hostlen, PChar(serv), servlen,
NI_NUMERICSERV);
if r = 0 then
Result := PChar(host);
end;
finally
if Assigned(Addr) then
synsock.FreeAddrInfo(Addr);
end;
end;
end;
{=============================================================================}
function InitSocketInterface(stack: string): Boolean;
begin
Result := False;
SockEnhancedApi := False;
if stack = '' then
stack := DLLStackName;
SynSockCS.Enter;
try
if SynSockCount = 0 then
begin
SockEnhancedApi := False;
SockWship6Api := False;
Libc.Signal(Libc.SIGPIPE, TSignalHandler(Libc.SIG_IGN));
LibHandle := LoadLibrary(PChar(Stack));
if LibHandle <> 0 then
begin
errno_loc := GetProcAddress(LibHandle, PChar('__errno_location'));
CloseSocket := GetProcAddress(LibHandle, PChar('close'));
IoctlSocket := GetProcAddress(LibHandle, PChar('ioctl'));
WSAGetLastError := LSWSAGetLastError;
WSAStartup := LSWSAStartup;
WSACleanup := LSWSACleanup;
ssAccept := GetProcAddress(LibHandle, PChar('accept'));
ssBind := GetProcAddress(LibHandle, PChar('bind'));
ssConnect := GetProcAddress(LibHandle, PChar('connect'));
ssGetPeerName := GetProcAddress(LibHandle, PChar('getpeername'));
ssGetSockName := GetProcAddress(LibHandle, PChar('getsockname'));
GetSockOpt := GetProcAddress(LibHandle, PChar('getsockopt'));
Htonl := GetProcAddress(LibHandle, PChar('htonl'));
Htons := GetProcAddress(LibHandle, PChar('htons'));
Inet_Addr := GetProcAddress(LibHandle, PChar('inet_addr'));
Inet_Ntoa := GetProcAddress(LibHandle, PChar('inet_ntoa'));
Listen := GetProcAddress(LibHandle, PChar('listen'));
Ntohl := GetProcAddress(LibHandle, PChar('ntohl'));
Ntohs := GetProcAddress(LibHandle, PChar('ntohs'));
ssRecv := GetProcAddress(LibHandle, PChar('recv'));
ssRecvFrom := GetProcAddress(LibHandle, PChar('recvfrom'));
Select := GetProcAddress(LibHandle, PChar('select'));
ssSend := GetProcAddress(LibHandle, PChar('send'));
ssSendTo := GetProcAddress(LibHandle, PChar('sendto'));
SetSockOpt := GetProcAddress(LibHandle, PChar('setsockopt'));
ShutDown := GetProcAddress(LibHandle, PChar('shutdown'));
Socket := GetProcAddress(LibHandle, PChar('socket'));
GetHostByAddr := GetProcAddress(LibHandle, PChar('gethostbyaddr'));
GetHostByName := GetProcAddress(LibHandle, PChar('gethostbyname'));
GetProtoByName := GetProcAddress(LibHandle, PChar('getprotobyname'));
GetProtoByNumber := GetProcAddress(LibHandle, PChar('getprotobynumber'));
GetServByName := GetProcAddress(LibHandle, PChar('getservbyname'));
GetServByPort := GetProcAddress(LibHandle, PChar('getservbyport'));
ssGetHostName := GetProcAddress(LibHandle, PChar('gethostname'));
{$IFNDEF FORCEOLDAPI}
GetAddrInfo := GetProcAddress(LibHandle, PChar('getaddrinfo'));
FreeAddrInfo := GetProcAddress(LibHandle, PChar('freeaddrinfo'));
GetNameInfo := GetProcAddress(LibHandle, PChar('getnameinfo'));
SockEnhancedApi := Assigned(GetAddrInfo) and Assigned(FreeAddrInfo)
and Assigned(GetNameInfo);
{$ENDIF}
Result := True;
end;
end
else Result := True;
if Result then
Inc(SynSockCount);
finally
SynSockCS.Leave;
end;
end;
function DestroySocketInterface: Boolean;
begin
SynSockCS.Enter;
try
Dec(SynSockCount);
if SynSockCount < 0 then
SynSockCount := 0;
if SynSockCount = 0 then
begin
if LibHandle <> 0 then
begin
FreeLibrary(libHandle);
LibHandle := 0;
end;
if LibWship6Handle <> 0 then
begin
FreeLibrary(LibWship6Handle);
LibWship6Handle := 0;
end;
end;
finally
SynSockCS.Leave;
end;
Result := True;
end;
initialization
begin
SynSockCS := SyncObjs.TCriticalSection.Create;
SET_IN6_IF_ADDR_ANY (@in6addr_any);
SET_LOOPBACK_ADDR6 (@in6addr_loopback);
end;
finalization
begin
SynSockCS.Free;
end;
{$ENDIF}
| 31.384323 | 126 | 0.597614 |
472d2cd5aac872adb70a32b60d0a14fa74ae642a | 1,467 | pas | Pascal | src/constraints/DValidation.Constraints.Email.pas | msnts/DValidation | d174eb639e7a5c93474d4e4c75fccaf00abe57de | [
"Apache-2.0"
]
| 6 | 2018-11-26T18:53:03.000Z | 2021-06-29T11:51:11.000Z | src/constraints/DValidation.Constraints.Email.pas | msnts/DValidation | d174eb639e7a5c93474d4e4c75fccaf00abe57de | [
"Apache-2.0"
]
| null | null | null | src/constraints/DValidation.Constraints.Email.pas | msnts/DValidation | d174eb639e7a5c93474d4e4c75fccaf00abe57de | [
"Apache-2.0"
]
| 1 | 2021-06-28T02:34:46.000Z | 2021-06-28T02:34:46.000Z | { ******************************************************************************
Copyright 2017 Marcos Santos
Contact: marcos.santos@outlook.com
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*****************************************************************************}
unit DValidation.Constraints.Email;
interface
uses
System.SysUtils,
System.RegularExpressions,
DValidation.Constraints.Constraint;
type
TPatternFlags = TRegExOption;
EmailAttribute = class(SimpleConstraintAttribute)
const
DEFAULT_MESSAGE = '{validation.constraints.Email.message}';
private
FRegexp: string;
FFlags: TPatternFlags;
protected
function GetMessage: string; override;
public
property Regexp: string read FRegexp;
property Flags: TPatternFlags read FFlags;
end;
implementation
{ EmailAttribute }
function EmailAttribute.GetMessage: string;
begin
if FMessage.IsEmpty then
Exit(DEFAULT_MESSAGE);
Result := FMessage;
end;
end.
| 25.293103 | 80 | 0.679618 |
47c734a0531d0cabc15e60f2f461e7a2bfb33c23 | 2,277 | pas | Pascal | Source/Services/SQS/Base/Model/AWS.SQS.Model.DeleteMessageBatchRequestEntry.pas | herux/aws-sdk-delphi | 4ef36e5bfc536b1d9426f78095d8fda887f390b5 | [
"Apache-2.0"
]
| 67 | 2021-07-28T23:47:09.000Z | 2022-03-15T11:48:35.000Z | Source/Services/SQS/Base/Model/AWS.SQS.Model.DeleteMessageBatchRequestEntry.pas | gabrielbaltazar/aws-sdk-delphi | ea1713b227a49cbbc5a2e1bf04cbf2de1f9b611a | [
"Apache-2.0"
]
| 5 | 2021-09-01T09:31:16.000Z | 2022-03-16T18:19:21.000Z | Source/Services/SQS/Base/Model/AWS.SQS.Model.DeleteMessageBatchRequestEntry.pas | gabrielbaltazar/aws-sdk-delphi | ea1713b227a49cbbc5a2e1bf04cbf2de1f9b611a | [
"Apache-2.0"
]
| 13 | 2021-07-29T02:41:16.000Z | 2022-03-16T10:22:38.000Z | unit AWS.SQS.Model.DeleteMessageBatchRequestEntry;
interface
uses
Bcl.Types.Nullable;
type
TDeleteMessageBatchRequestEntry = class;
IDeleteMessageBatchRequestEntry = interface
function GetId: string;
procedure SetId(const Value: string);
function GetReceiptHandle: string;
procedure SetReceiptHandle(const Value: string);
function Obj: TDeleteMessageBatchRequestEntry;
function IsSetId: Boolean;
function IsSetReceiptHandle: Boolean;
property Id: string read GetId write SetId;
property ReceiptHandle: string read GetReceiptHandle write SetReceiptHandle;
end;
TDeleteMessageBatchRequestEntry = class
strict private
FId: Nullable<string>;
FReceiptHandle: Nullable<string>;
function GetId: string;
procedure SetId(const Value: string);
function GetReceiptHandle: string;
procedure SetReceiptHandle(const Value: string);
strict protected
function Obj: TDeleteMessageBatchRequestEntry;
public
constructor Create(const AId: string; const AReceiptHandle: string); overload;
function IsSetId: Boolean;
function IsSetReceiptHandle: Boolean;
property Id: string read GetId write SetId;
property ReceiptHandle: string read GetReceiptHandle write SetReceiptHandle;
end;
implementation
{ TDeleteMessageBatchRequestEntry }
function TDeleteMessageBatchRequestEntry.Obj: TDeleteMessageBatchRequestEntry;
begin
Result := Self;
end;
constructor TDeleteMessageBatchRequestEntry.Create(const AId: string; const AReceiptHandle: string);
begin
inherited Create;
Id := AId;
ReceiptHandle := AReceiptHandle;
end;
function TDeleteMessageBatchRequestEntry.GetId: string;
begin
Result := FId.ValueOrDefault;
end;
procedure TDeleteMessageBatchRequestEntry.SetId(const Value: string);
begin
FId := Value;
end;
function TDeleteMessageBatchRequestEntry.IsSetId: Boolean;
begin
Result := FId.HasValue;
end;
function TDeleteMessageBatchRequestEntry.GetReceiptHandle: string;
begin
Result := FReceiptHandle.ValueOrDefault;
end;
procedure TDeleteMessageBatchRequestEntry.SetReceiptHandle(const Value: string);
begin
FReceiptHandle := Value;
end;
function TDeleteMessageBatchRequestEntry.IsSetReceiptHandle: Boolean;
begin
Result := FReceiptHandle.HasValue;
end;
end.
| 25.875 | 100 | 0.789635 |
fcee1e7741e7c79b8e631bd76df6b31331b60831 | 217 | lpr | Pascal | Libraries/KControls/demos/kmemo/KMemoDemoLaz.lpr | jomael/Concepts | 82d18029e41d55e897d007f826c021cdf63e53f8 | [
"Apache-2.0"
]
| 62 | 2016-01-20T16:26:25.000Z | 2022-02-28T14:25:52.000Z | Libraries/KControls/demos/kmemo/KMemoDemoLaz.lpr | jomael/Concepts | 82d18029e41d55e897d007f826c021cdf63e53f8 | [
"Apache-2.0"
]
| null | null | null | Libraries/KControls/demos/kmemo/KMemoDemoLaz.lpr | jomael/Concepts | 82d18029e41d55e897d007f826c021cdf63e53f8 | [
"Apache-2.0"
]
| 20 | 2016-09-08T00:15:22.000Z | 2022-01-26T13:13:08.000Z | program KMemoDemoLaz;
uses
Interfaces,
Forms,
Main;
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.
| 13.5625 | 46 | 0.732719 |
fc11be4b7b67f4a304287962022c85512b0e9fa1 | 12,130 | pas | Pascal | src/solutionunit.pas | jzombi/guillottine | 87a5674117d29c4d2b343e9fbb9b2df04ec9c111 | [
"MIT"
]
| null | null | null | src/solutionunit.pas | jzombi/guillottine | 87a5674117d29c4d2b343e9fbb9b2df04ec9c111 | [
"MIT"
]
| 7 | 2015-08-31T07:37:40.000Z | 2016-04-14T12:35:44.000Z | src/solutionunit.pas | jzombi/guillottine | 87a5674117d29c4d2b343e9fbb9b2df04ec9c111 | [
"MIT"
]
| null | null | null | unit solutionunit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
Buttons, StdCtrls, Grids, math, SetupUnit, solver, simplesolver, rectangle;
type
{ TTransformation }
TTransformation = object
offsetX, offsetY, scaleX, scaleY : real;
constructor Init;
procedure AutoFit(solution: TSolution; width, height: real);
procedure CenterStretchKeepAspect(tx1, ty1, tx2, ty2, sx1, sy1, sx2, sy2 : real);
function transform(rectangle: TRectangle):TRectangle;
end;
type
{ TSolverThread }
TSolverThread = class(TThread)
private
Solver : TSimpleSolver;
FSolution : TSolution;
SpaceList: TSheetList;
PieceList: TPieceList;
CutWidth: integer;
FStopped: boolean;
public
procedure stop;
procedure Execute; override;
property Solution: TSolution read FSolution;
constructor Create(ASpaceList: TSheetList; APieceList: TPieceList; ACutWidth: integer);
property Stopped: boolean read FStopped;
//destructor Destroy; override;
end;
type
{ TSolutionForm }
TSolutionForm = class(TForm)
SolverStartStopButton: TButton;
SaveImageButton: TButton;
Image1: TImage;
Label1: TLabel;
SaveDialog1: TSaveDialog;
Timer1: TTimer;
procedure SolverStartStopButtonClick(Sender: TObject);
procedure SaveImageButtonClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure SolverTerminated(Sender: TObject);
procedure ShowSolution(Solution: TSolution);
procedure Timer1Timer(Sender: TObject);
procedure UpdateStep;
private
{ private declarations }
public
{ public declarations }
end;
var
SolutionForm: TSolutionForm;
implementation
var SolverThread: TSolverThread;
{$R *.lfm}
resourcestring
rsStep = 'Step';
rsStart = 'Start';
rsStop = 'Stop';
{ TSolverThread }
constructor TSolverThread.Create(ASpaceList: TSheetList; APieceList: TPieceList; ACutWidth: integer);
begin
CutWidth := ACutWidth;
PieceList := APieceList;
SpaceList := ASpaceList;
FSolution.Valid := false;
solver := nil;
inherited Create(false);
end;
procedure TSolverThread.stop;
begin
if Assigned(solver) then
solver.StopSolver;
end;
procedure TSolverThread.Execute;
begin
FStopped := False;
if not Assigned(solver) then begin
solver := TSimpleSolver.Create(SpaceList, PieceList, CutWidth);
FSolution := solver.Search;
FreeAndNil(solver);
end;
FStopped := True;
end;
{destructor TSolverThread.Destroy;
begin
stop;
while not stopped do Sleep(100);
inherited Destroy;
end;}
{ TSolutionForm }
function GetCount(RectType: string; input: TStringGrid):integer;
var ii : integer;
begin
GetCount:=0;
for ii:=1 to input.RowCount-1 do begin
if UpCase(input.Cells[0, ii]) = UpCase(RectType) then begin
Inc(GetCount);
end;
end;
end;
function GetSpaceList(input: TStringGrid):TSheetList;
var ii, kk : integer;
count : integer;
sheet : TSheet;
name, namecount : string;
xx, yy, width, height : integer;
elemcount : integer;
begin
count := GetCount('space', input);
GetSpaceList.Init(count);
for ii:=1 to input.RowCount-1 do begin
if UpCase(input.Cells[0, ii]) = 'SPACE' then begin
elemcount := StrToIntDef(input.Cells[7, ii], 1);
name := input.Cells[1, ii];
xx := StrToIntDef(input.Cells[2, ii], 0);
yy := StrToIntDef(input.Cells[3, ii], 0);
width := StrToIntDef(input.Cells[4, ii], 0);
height := StrToIntDef(input.Cells[5, ii], 0);
for kk:=1 to elemcount do begin
namecount := name;
if elemcount > 1 then namecount := namecount + '_' + IntToStr(kk);
sheet.Init(namecount, xx, yy, width, height);
GetSpaceList.Append(sheet);
end;
end;
end;
end;
function GetPieceList(input: TStringGrid):TPieceList;
var ii, kk : integer;
count : integer;
piece : TPiece;
name, namecount : string;
width, height : integer;
rotatable : boolean;
elemcount : integer;
begin
count := GetCount('piece', input);
GetPieceList.Init(count);
for ii:=1 to input.RowCount-1 do begin
if UpCase(input.Cells[0, ii]) = 'PIECE' then begin
elemcount := StrToIntDef(input.Cells[7, ii], 1);
name := input.Cells[1, ii];
width := StrToIntDef(input.Cells[4, ii], 0);
height := StrToIntDef(input.Cells[5, ii], 0);
rotatable := false;
if UpCase(input.Cells[6, ii])='TRUE' then
rotatable:=true;
for kk:=1 to elemcount do begin
namecount := name;
if elemcount > 1 then namecount := namecount + '_' + IntToStr(kk);
piece.Init(namecount, width, height, 0, rotatable, false);
GetPieceList.Append(piece);
end;
end;
end;
end;
procedure TSolutionForm.SolverStartStopButtonClick(Sender: TObject);
var piecelist : TPieceList;
spacelist : TSheetList;
cutwidth : integer;
begin
if Assigned(SolverThread) and SolverThread.Stopped then begin
SolverThread.stop;
SolverThread.WaitFor;
FreeAndNil(SolverThread);
end;
if Assigned(SolverThread) then begin
SolverThread.stop;
SolverThread.WaitFor;
FreeAndNil(SolverThread);
SolverStartStopButton.Caption:=rsStart;
end else begin
piecelist := GetPieceList(SetupForm.PiecesGrid);
spacelist := GetSpaceList(SetupForm.PiecesGrid);
cutwidth := StrToIntDef(SetupForm.CutWidthEdit.Text, 0);
SolverThread := TSolverThread.Create(spacelist, piecelist, cutwidth);
SolverThread.OnTerminate := @self.SolverTerminated;
SolverThread.Start;
Label1.Caption := rsStep + ': 0';
SolverStartStopButton.Caption := rsStop;
end;
end;
procedure TSolutionForm.SaveImageButtonClick(Sender: TObject);
begin
If SaveDialog1.Execute then begin
Image1.Picture.SaveToFile(SaveDialog1.FileName);
end;
end;
procedure TSolutionForm.FormCreate(Sender: TObject);
begin
SolverThread := nil;
Image1.Canvas.Clear;
Image1.Canvas.Brush.Color:=clWhite;
Image1.Canvas.FillRect(0, 0, Image1.Canvas.Width, Image1.Canvas.Height);
end;
procedure TSolutionForm.FormDestroy(Sender: TObject);
begin
if Assigned(SolverThread) then begin
SolverThread.stop;
SolverThread.WaitFor;
FreeAndNil(SolverThread);
end;
end;
procedure TSolutionForm.SolverTerminated(Sender: TObject);
begin
SolverStartStopButton.Caption:=rsStart;
ShowSolution(SolverThread.Solution);
UpdateStep;
end;
procedure TSolutionForm.Timer1Timer(Sender: TObject);
begin
UpdateStep;
end;
procedure TSolutionForm.UpdateStep;
begin
if Assigned(SolverThread) and Assigned(SolverThread.Solver) then begin
Label1.Caption := rsStep + ': ' + IntToStr(SolverThread.Solver.Step);
end else if Assigned(SolverThread) then begin
Label1.Caption := rsStep + ': ' + IntToStr(SolverThread.Solution.Step);
end;
end;
function GetTRect(rectangle: TRectangle; transformation: TTransformation):TRect;
begin
rectangle := transformation.transform(rectangle);
GetTRect.Left:=Round(rectangle.Left);
GetTRect.Top:=Round(rectangle.Top);
GetTRect.Bottom:=Round(rectangle.Top+rectangle.Height);
GetTRect.Right:=Round(rectangle.Left+rectangle.Width);
end;
procedure TSolutionForm.ShowSolution(Solution: TSolution);
var ii : integer;
cut : TCut;
space : TSheet;
placedbox : TPlacedPiece;
rect : TRect;
transformation : TTransformation;
tw, th : integer;
placedname : string;
begin
Image1.Canvas.Brush.Color:=clWhite;
Image1.Canvas.FillRect(0, 0, Image1.Canvas.Width, Image1.Canvas.Height);
if Solution.Valid then begin
transformation.Init;
transformation.AutoFit(Solution, Image1.Canvas.Width, Image1.Canvas.Height);
Image1.Canvas.Pen.Color:=clBlack;
for ii:=0 to Solution.OrigSheetList.size-1 do begin
space:=Solution.OrigSheetList.data[ii];
rect := GetTRect(space, transformation);
Image1.Canvas.Frame(rect);
end;
for ii:=0 to Solution.PlacedList.size-1 do begin
placedbox:=Solution.PlacedList.data[ii];
rect := GetTRect(placedbox, transformation);
Image1.Canvas.Frame(rect);
Image1.Canvas.Brush.Color:=clGray;
Inc(rect.Left);
Inc(rect.Top);
Dec(rect.Right);
Dec(Rect.Bottom);
Image1.Canvas.FillRect(rect);
placedname := placedbox.Name;
if placedbox.Rotated then
placedname := placedname + '*';
th := Image1.Canvas.TextHeight(placedbox.Name);
tw := Image1.Canvas.TextWidth(placedbox.Name);
Image1.Canvas.TextOut((rect.Right - rect.Left - tw) div 2 + rect.Left,
(rect.Bottom - rect.Top - th) div 2 + rect.Top,
placedname);
end;
Image1.Canvas.Pen.Color:=clRed;
for ii:=0 to Solution.CutList.size-1 do begin
cut:=Solution.CutList.data[ii];
rect := GetTRect(cut, transformation);
if cut.Direction = dirHorizontal then begin
rect.Top := Round(rect.Top+(rect.Bottom-rect.Top)/2);
rect.Bottom := rect.Top;
end else begin
rect.Left := Round(rect.Left+(rect.Right-rect.Left)/2);
rect.Right := rect.Left;
end;
Image1.Canvas.Line(rect);
end;
Image1.Canvas.Refresh;
end;
end;
{ TTransformaton }
constructor TTransformation.Init;
begin
offsetX := 0;
offsetY := 0;
scaleX := 1;
scaleY := 1;
end;
procedure TTransformation.CenterStretchKeepAspect(tx1, ty1, tx2, ty2 : real;
sx1, sy1, sx2, sy2 : real);
begin
{Assume that x2>x1, y2>y1}
if (tx2-tx1)*(sy2-sy1) > (ty2-ty1)*(sx2-sx1) then begin
scaleY := (ty2-ty1)/(sy2-sy1);
offsetY := ty1/scaleY-sy1;
scaleX := scaleY;
offsetX := (tx1 + 0.5*(tx2-tx1))/scaleX - (sx1 + 0.5*(sx2-sx1));
end else begin
scaleX := (tx2-tx1)/(sx2-sx1);
offsetX := tx1/scaleX-sx1;
scaleY := scaleX;
offsetY := (ty1 + 0.5*(ty2-ty1))/scaleY - (sy1 + 0.5*(sy2-sy1));
end;
end;
procedure TTransformation.AutoFit(solution: TSolution; width, height: real);
var sheet : TSheet;
minx, miny, maxx, maxy : real;
ii : integer;
margin : real;
begin
minx := 0;
miny := 0;
maxx := width;
maxy := height;
for ii:=0 to Solution.OrigSheetList.size-1 do begin
sheet:=Solution.OrigSheetList.data[ii];
if (ii = 0) or (sheet.Left < minx) then
minx := sheet.Left;
if (ii = 0) or (sheet.Top < miny) then
miny := sheet.Top;
if (ii = 0) or (sheet.Left + sheet.Width > maxx) then
maxx := sheet.Left + sheet.Width;
if (ii = 0) or (sheet.Top + sheet.Height > maxy) then
maxy := sheet.Top + sheet.Height;
end;
margin := 0.025*min(width, height);
CenterStretchKeepAspect(margin, margin, width-margin, height-margin,
minx, miny, maxx, maxy);
end;
function TTransformation.transform(rectangle: TRectangle):TRectangle;
begin
transform.Init(rectangle.Name,
Round((rectangle.Left + offsetX) * scaleX),
Round((rectangle.Top + offsetY) * scaleY),
Round(rectangle.Width * scaleX),
Round(rectangle.Height * scaleY));
end;
end.
| 30.631313 | 101 | 0.620363 |
477c618366cbc451628e814ff200650bd26d6f98 | 2,045 | dpr | Pascal | PBaccarat.dpr | shardros/Baccarat | ebe17a61275de6b3ebfd300a13da1c167a2c4191 | [
"MIT"
]
| null | null | null | PBaccarat.dpr | shardros/Baccarat | ebe17a61275de6b3ebfd300a13da1c167a2c4191 | [
"MIT"
]
| null | null | null | PBaccarat.dpr | shardros/Baccarat | ebe17a61275de6b3ebfd300a13da1c167a2c4191 | [
"MIT"
]
| null | null | null | program PBaccarat;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
UCardClasses in '..\Downloads\UCardClasses.pas',
UBaccarat in '..\Downloads\UBaccarat.pas';
type
TGameUI = class
public
procedure Display(Game: TBaccarat);
procedure DisplayDraw(Game: TBaccarat);
procedure FinalResult(Game: TBaccarat);
end;
{ TGameUI }
procedure TGameUI.Display(Game: TBaccarat);
//displays players' hands and scores
var
c: TCard;
begin
writeln('Player''s cards: ');
for c in Game.PHand.Cards do
writeln(c.GetRankAsString + ' of ' + c.GetSuitAsString);
writeln;
writeln('Banker''s cards: ');
for c in Game.BHand.Cards do
writeln(c.GetRankAsString + ' of ' + c.GetSuitAsString);
writeln;
writeln('Player Score: ', Game.PScore);
writeln('Banker Score: ', Game.BScore);
writeln;
end;
procedure TGameUI.DisplayDraw(Game: TBaccarat);
//displays outcome of draw phase of game
begin
case Game.PHand.Size of
2:
writeln('The Player has stood');
3:
writeln('The Player has drawn the ' + Game.PHand.Cards[2].GetRankAsString
+ ' of ' + Game.PHand.Cards[2].GetSuitAsString);
end;
case Game.BHand.Size of
2:
writeln('The Banker has stood');
3:
writeln('The Banker has drawn the ' + Game.BHand.Cards[2].GetRankAsString
+ ' of ' + Game.BHand.Cards[2].GetSuitAsString);
end;
writeln;
end;
procedure TGameUI.FinalResult(Game: TBaccarat);
//displays outcome of game
begin
if Game.PScore > Game.BScore then
writeln('The Player has won');
if Game.BScore > Game.PScore then
writeln('The Banker has won');
if Game.PScore = Game.BScore then
writeln('It''s a tie');
end;
// main program
var
GameUI: TGameUI;
Game: TBaccarat;
begin
GameUI := TGameUI.Create;
Game := TBaccarat.Create;
Game.Deal;
GameUI.Display(Game);
if (game.PScore or game.BScore) < 7 then begin
Game.PhaseII;
GameUI.DisplayDraw(Game);
GameUI.Display(Game);
end;
GameUI.FinalResult(Game);
readln;
Game.Free;
GameUI.Free;
end.
| 21.302083 | 79 | 0.674817 |
fcbba634af283a9b700275c64f6d6a694e50e371 | 1,326 | dfm | Pascal | Lab5 Animation/Animation (Gascov)/007 EleventhOfSeptember/EleventhOfSeptember.dfm | Oreder/DelphiProPart2nd | 27a13b4f87209938e7d7850eadd0831ff719d808 | [
"MIT"
]
| null | null | null | Lab5 Animation/Animation (Gascov)/007 EleventhOfSeptember/EleventhOfSeptember.dfm | Oreder/DelphiProPart2nd | 27a13b4f87209938e7d7850eadd0831ff719d808 | [
"MIT"
]
| null | null | null | Lab5 Animation/Animation (Gascov)/007 EleventhOfSeptember/EleventhOfSeptember.dfm | Oreder/DelphiProPart2nd | 27a13b4f87209938e7d7850eadd0831ff719d808 | [
"MIT"
]
| 1 | 2021-02-26T11:24:13.000Z | 2021-02-26T11:24:13.000Z | object Form1: TForm1
Left = 272
Top = 98
BorderStyle = bsDialog
Caption = '11 Sep'
ClientHeight = 600
ClientWidth = 800
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 13
object Image1: TImage
Left = 0
Top = 0
Width = 800
Height = 600
end
object Timer1: TTimer
Enabled = False
Interval = 10
OnTimer = Timer1Timer
end
object Timer2: TTimer
Enabled = False
Interval = 1
OnTimer = Timer2Timer
Left = 32
end
object Timer3: TTimer
Enabled = False
Interval = 100
OnTimer = Timer3Timer
Left = 64
end
object Timer4: TTimer
Enabled = False
Interval = 10
OnTimer = Timer4Timer
Top = 32
end
object Timer5: TTimer
Enabled = False
Interval = 1
OnTimer = Timer5Timer
Left = 32
Top = 32
end
object Timer6: TTimer
Enabled = False
Interval = 100
OnTimer = Timer6Timer
Left = 64
Top = 32
end
object Timer7: TTimer
Interval = 1
OnTimer = Timer7Timer
Top = 64
end
object Timer8: TTimer
Enabled = False
Interval = 1
OnTimer = Timer8Timer
Left = 32
Top = 64
end
end
| 17.918919 | 32 | 0.628205 |
c34b19a9b1f5f5cc892495ae32f976dcb706bb2f | 3,680 | pas | Pascal | junk/car2000/UTSKRIFTER.pas | aspenryd/Car | 1d812ab60825f0900ac161638e0d375894997204 | [
"MIT"
]
| 1 | 2018-07-22T13:13:16.000Z | 2018-07-22T13:13:16.000Z | junk/car2000/UTSKRIFTER.pas | aspenryd/Car | 1d812ab60825f0900ac161638e0d375894997204 | [
"MIT"
]
| null | null | null | junk/car2000/UTSKRIFTER.pas | aspenryd/Car | 1d812ab60825f0900ac161638e0d375894997204 | [
"MIT"
]
| 2 | 2018-03-29T13:57:55.000Z | 2018-07-22T13:13:18.000Z | {
==========================================================
=== (c) CopyRight 2003 ; All rights reserved ===
==========================================================
Filename
Utskrifter.pas
}
{ $HDR$}
{**********************************************************************}
{ Unit archived using Team Coherence }
{ Team Coherence is Copyright 2002 by Quality Software Components }
{ }
{ For further information / comments, visit our WEB site at }
{ http://www.TeamCoherence.com }
{**********************************************************************}
{}
{ $Log: 13106: UTSKRIFTER.pas
{
{ Rev 1.1 2003-10-14 11:35:26 peter
{ Fixar kring combobox + cust_id kontroll vid delbetalare.
}
{
{ Rev 1.0 2003-03-20 14:00:30 peter
}
{
{ Rev 1.0 2003-03-17 14:41:46 Supervisor
{ nytt
}
{
{ Rev 1.0 2003-03-17 14:36:00 Supervisor
{ Nystart och fixar
}
{
{ Rev 1.0 2003-03-17 09:25:30 Supervisor
{ Start av vc
}
unit Utskrifter;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, eqprn, ComCtrls;
type
TFrmUtskrift = class(TForm)
GroupBox1: TGroupBox;
ComboBox1: TComboBox;
ComboBox2: TComboBox;
Edit1: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
LblVal: TLabel;
Label1: TLabel;
Label2: TLabel;
CBGranska: TCheckBox;
DateTimePicker1: TDateTimePicker;
Label3: TLabel;
procedure FormCreate(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure ComboBox2Enter(Sender: TObject);
procedure ComboBox2Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
FrmUtskrift: TFrmUtskrift;
implementation
{$R *.DFM}
procedure TFrmUtskrift.FormCreate(Sender: TObject);
begin
combobox1.ItemIndex := 0;
Combobox2.itemindex := 0;
end;
procedure TFrmUtskrift.BitBtn1Click(Sender: TObject);
begin
if ComboBox1.ItemIndex = 0 then
begin
if ComboBox2.ItemIndex = 0 then
eqprn.PrintAvtal(strtoint(edit1.text), 0, 1, cbgranska.checked);
if ComboBox2.ItemIndex = 2 then
eqprn.PrintRegDatAvt(edit1.text, DateToStr(DateTimePicker1.Date), 1, cbgranska.checked);
end;
if ComboBox1.ItemIndex = 1 then
begin
if ComboBox2.ItemIndex = 0 then
eqprn.PrintKvitto(StrToInt(edit1.Text),0, 0, 1, cbgranska.checked);
if combobox2.itemindex = 1 then
// dmcrystal.PrintKvitto(0, strtoint(edit1.text), 1, cbgranska.checked);
eqprn.PrintKvitto(0, 0, StrToInt(edit1.Text), 1, CBGranska.Checked);
if Combobox2.itemindex = 2 then
eqprn.PrintRegDatKvi(Edit1.Text, DateToStr(DateTimePicker1.Date), 1, cbgranska.checked);
end;
end;
procedure TFrmUtskrift.ComboBox2Enter(Sender: TObject);
begin
if ComboBox1.ItemIndex = 0 then
ComboBox2.Items.Strings[1] := ''
else
ComboBox2.Items.Strings[1] := 'FakturaNr (ENummer)';
end;
procedure TFrmUtskrift.ComboBox2Change(Sender: TObject);
begin
if ComboBox2.ItemIndex = 2 then begin
DateTimePicker1.Visible := true;
Label3.Visible := true;
Label2.Caption := 'Reg. Nr:';
DateTimePicker1.TabOrder := 3;
CBGranska.TabOrder := 4;
BitBtn1.TabOrder := 5;
BitBtn2.TabOrder := 6;
end else begin
DateTimePicker1.Visible := false;
Label3.Visible := false;
Label2.Caption := 'Nummer:';
DateTimePicker1.TabOrder := 6;
CBGranska.TabOrder := 3;
BitBtn1.TabOrder := 4;
BitBtn2.TabOrder := 5;
end;
end;
end.
| 26.099291 | 96 | 0.602174 |
4757b2051203fee7fc25ccd3f6f4d41ee78eb5e7 | 1,674 | pas | Pascal | SourceCode/Common/Functions/Casbin.Functions.IPMatch.pas | kyle-mccarthy/Casbin4D | 36c30d4aea7aea73938dc07eb6c8796fdcf64c43 | [
"Apache-2.0"
]
| null | null | null | SourceCode/Common/Functions/Casbin.Functions.IPMatch.pas | kyle-mccarthy/Casbin4D | 36c30d4aea7aea73938dc07eb6c8796fdcf64c43 | [
"Apache-2.0"
]
| null | null | null | SourceCode/Common/Functions/Casbin.Functions.IPMatch.pas | kyle-mccarthy/Casbin4D | 36c30d4aea7aea73938dc07eb6c8796fdcf64c43 | [
"Apache-2.0"
]
| null | null | null | /// <summary>
/// Determines whether an IP address ip1 matches the pattern of ip2
/// ip1 and ip2 can be an IP address or a CIDR pattern
/// eg. '192.168.2.123' matches '192.168.2.0/24'
/// </summary>
function IPMatch (const aArgs: array of string): Boolean;
var
ip1: string;
ip2: string;
index: integer;
IPArr1: TStringDynArray;
IPArr2: TStringDynArray;
function validIP(const aIP: string): Boolean; //PALOFF
var
strArr: TStringDynArray;
i: Integer;
numIP: integer;
begin
Result:=True;
strArr:=SplitString(aIP, '.');
if Length(strArr)<>4 then
Result:=false
else
begin
for i:=0 to Length(strArr)-1 do
begin
if not (TryStrToInt(strArr[i], numIP)
and (numIP>=0) and (numIP<=255)) then
begin
Result:=False;
Exit;
end;
end;
end;
end;
begin
if Length(aArgs)<>2 then
raise Exception.Create('Wrong number of arguments in IPMatch');
ip1:=trim(aArgs[0]);
ip2:=trim(aArgs[1]);
index:=Pos('/', ip1, low(string));
if index<>0 then
ip1:=Copy(ip1, Low(string), index-1);
index:=Pos('/', ip2, low(string));
if index<>0 then
ip2:=Copy(ip2, Low(string), index-1);
if not validIP(ip1) then
raise Exception.Create('Invalid IP: '+ip1+' in IPMatch');
if not validIP(ip2) then
raise Exception.Create('Invalid IP: '+ip2+' in IPMatch');
if ip1=ip2 then
begin
Result:=True;
Exit;
end;
IPArr1:=SplitString(ip1, '.');
IPArr2:=SplitString(ip2, '.');
Result:= (IPArr1[0]=IPArr2[0]) and (IPArr1[1]=IPArr2[1])
and (IPArr1[2]=IPArr2[2]);
end;
| 23.577465 | 69 | 0.591995 |
47b5226caa5e468ab18bb44d10fb3c79f5eb0481 | 169 | dpr | Pascal | demos/ALNNTPClient/_source/ALNNTPClientDemo.dpr | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| 851 | 2018-02-05T09:54:56.000Z | 2022-03-24T23:13:10.000Z | demos/ALNNTPClient/_source/ALNNTPClientDemo.dpr | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| 200 | 2018-02-06T18:52:39.000Z | 2022-03-24T19:59:14.000Z | demos/ALNNTPClient/_source/ALNNTPClientDemo.dpr | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| 197 | 2018-03-20T20:49:55.000Z | 2022-03-21T17:38:14.000Z | program ALNNTPClientDemo;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.RES}
begin
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
| 13 | 41 | 0.650888 |
c35fd9c321b47a38a3f5c3be0294ac8da7780654 | 1,193 | pas | Pascal | Core/DW.OSLog.Win.pas | AndersondaCampo/Kastri | 4352181b56ab9569b086eae3e79e5dc8d6082c30 | [
"MIT"
]
| 3 | 2021-04-26T05:41:50.000Z | 2021-09-27T16:56:36.000Z | Core/DW.OSLog.Win.pas | AndersondaCampo/Kastri | 4352181b56ab9569b086eae3e79e5dc8d6082c30 | [
"MIT"
]
| null | null | null | Core/DW.OSLog.Win.pas | AndersondaCampo/Kastri | 4352181b56ab9569b086eae3e79e5dc8d6082c30 | [
"MIT"
]
| 1 | 2021-03-05T20:48:34.000Z | 2021-03-05T20:48:34.000Z | unit DW.OSLog.Win;
{*******************************************************}
{ }
{ Kastri }
{ }
{ Delphi Worlds Cross-Platform Library }
{ }
{ Copyright 2020 Dave Nottage under MIT license }
{ which is located in the root folder of this library }
{ }
{*******************************************************}
{$I DW.GlobalDefines.inc}
interface
uses
// DW
DW.OSLog;
type
/// <remarks>
/// DO NOT ADD ANY FMX UNITS TO THESE FUNCTIONS
/// </remarks>
TPlatformOSLog = record
public
class procedure Log(const ALogType: TLogType; const AMsg: string); static;
end;
implementation
uses
// RTL
System.SysUtils,
// Windows
Winapi.Windows;
{ TPlatformOSLog }
class procedure TPlatformOSLog.Log(const ALogType: TLogType; const AMsg: string);
begin
OutputDebugString(PChar(cLogTypeCaptions[ALogType] + ': ' + AMsg));
end;
end.
| 25.382979 | 82 | 0.42917 |
f135ad7d589f9eee03d4bbd5b6d44a1a18702916 | 1,499 | pas | Pascal | windows/src/ext/jedi/jvcl/tests/archive/jvcl/source/JvGroupHeaderEditor.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/ext/jedi/jvcl/tests/archive/jvcl/source/JvGroupHeaderEditor.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/ext/jedi/jvcl/tests/archive/jvcl/source/JvGroupHeaderEditor.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | {$I JVCL.INC}
{$I WINDOWSONLY.INC}
unit JvGroupHeaderEditor;
interface
uses
Windows, Forms, Graphics, ImgList,
{$IFDEF COMPILER6_UP}
DesignIntf, DesignEditors, DesignMenus, VCLEditors,
{$ELSE}
DsgnIntf,
{$ENDIF}
SysUtils, Classes, Dialogs, Controls;
type
TJvGroupHeaderEditor = class(TComponentEditor)
public
function GetVerbCount: Integer; override;
function GetVerb(Index: Integer): string; override;
procedure ExecuteVerb(Index: Integer); override;
procedure Edit; override;
end;
implementation
uses
JvTypes, JvGroupHeader;
//=== TJvGroupHeaderEditor ===================================================
function TJvGroupHeaderEditor.GetVerbCount: Integer;
begin
Result := 2;
end;
function TJvGroupHeaderEditor.GetVerb(Index: Integer): string;
begin
case Index of
0:
Result := 'Standard/Flat';
1:
Result := 'Web';
end;
end;
procedure TJvGroupHeaderEditor.ExecuteVerb(Index: Integer);
begin
case Index of
0:
with TJvGroupHeader(Component) do
begin
BevelOptions.Style := bsLowered;
Font.Style := [];
end;
1:
with TJvGroupHeader(Component) do
begin
BevelOptions.Style := bsShape;
BevelOptions.Brush.Color := $00A97A1B;
BevelOptions.Pen.Color := $00E1AD40;
BevelOptions.Height := 3;
Font.Style := [fsBold];
end;
end;
end;
procedure TJvGroupHeaderEditor.Edit;
begin
// We don't need to add band on double click
end;
end.
| 20.256757 | 78 | 0.657772 |
85ba7f132966ac070a38f707599c6e646b4d679c | 15,912 | pas | Pascal | Projekty/Robocze/WPZ/UPenWPZ.pas | jarowlod/OTIS-2 | 194b470b9d0106cd6350f10cf73f0610f7b74705 | [
"MIT"
]
| 1 | 2020-09-01T14:03:10.000Z | 2020-09-01T14:03:10.000Z | Projekty/Robocze/WPZ/UPenWPZ.pas | jarowlod/OTIS-2 | 194b470b9d0106cd6350f10cf73f0610f7b74705 | [
"MIT"
]
| null | null | null | Projekty/Robocze/WPZ/UPenWPZ.pas | jarowlod/OTIS-2 | 194b470b9d0106cd6350f10cf73f0610f7b74705 | [
"MIT"
]
| null | null | null | unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, TplGradientUnit, BCListBox, DBDateTimePicker,
rxdbgrid, rxmemds, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls,
EditBtn, Spin, fpjson, jsonparser, dateutils;
type
TOrzeczenie = record
art: string;
lat: integer;
msc: integer;
dni: integer;
zastepcza: Boolean;
koniec_kary: TDate;
Sdni: integer;
end;
{ TWPZ }
TWPZ = class
private
data_osadzenia: TDate;
owz : Boolean;
ulamek : string;
OBS_obostrzenie: Boolean;
OBS_po_ilu : integer; // wpz po ilu dniach
uwagi : string;
WPZ : TDate;
przepustki : TDate;
postpenit : TDate;
orzeczenia : array of TOrzeczenie;
// zmienne pomocnicze
fisObliczono: Boolean;
fSumaKar : integer; // suma kar zasadniczych
fKomunikaty: TStringList;
function WymiarKaryDni(dane: TOrzeczenie): integer;
function SumojKary: integer;
function GetUlamekArt: string;
procedure validateWPZ;
procedure validatePrzepustki;
procedure validatePostpenit;
function SprawdzWarunki: Boolean; // sprawdza czy można wyliczyc WPZ
function ObliczOBS: Boolean;
function ObliczKaryZastepcze: Boolean;
procedure ObliczUlamek;
procedure ObliczOwz;
function ObliczDozywocie: Boolean;
public
constructor Create;
destructor Destroy; override;
procedure Oblicz;
function SaveToStr: String;
procedure LoadFromStr(value: string);
procedure ParseFromDOC(value: string);
function Count: integer;
function IndexWPZ: integer; // index ostatniej kary zasadniczej
function AddOrzeczenie(Vart: string; Vlat, Vmsc,Vdni: integer; Vzastepcza: Boolean; Vkoniec_kary: TDate): integer;
end;
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
ComboBox1: TComboBox;
DateEdit1: TDateEdit;
DateEdit2: TDateEdit;
DateEdit3: TDateEdit;
DateEdit4: TDateEdit;
GroupBox1: TGroupBox;
GroupBox2: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Memo1: TMemo;
Memo2: TMemo;
Panel1: TPanel;
plGradient1: TplGradient;
RxDBGrid1: TRxDBGrid;
RxDBGrid2: TRxDBGrid;
RxMemoryData1: TRxMemoryData;
SpinEdit1: TSpinEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
public
WPZ: TWPZ;
end;
function DeleteRepeatedSpaces(s: string):string;
var
Form1: TForm1;
implementation
const NullDate = 0.0;
{$R *.frm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Lines.LoadFromFile('Dane\przyklad_1.json');
WPZ:= TWPZ.Create;
WPZ.LoadFromStr(Memo1.Text);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Memo1.Clear;
Memo1.Append(WPZ.ulamek);
Memo1.Append(DateToStr(WPZ.data_osadzenia));
Memo1.Append('wpz: '+ DateToStr(WPZ.WPZ));
if WPZ.WPZ = NullDate then Memo1.Append('NullDate');
Memo1.Append(WPZ.orzeczenia[0].art);
Memo1.Append(WPZ.orzeczenia[1].art);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Memo1.Clear;
Memo1.Append(WPZ.SaveToStr);
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
WPZ.Oblicz;
Memo1.Clear;
Memo1.Text:= WPZ.fKomunikaty.Text;
end;
{ TWPZ }
function TWPZ.WymiarKaryDni(dane: TOrzeczenie): integer;
begin
Result:= dane.lat*365 + dane.msc*30 + dane.dni;
end;
function TWPZ.SumojKary: integer;
var i: integer;
begin
Result:= 0;
for i:=0 to Count-1 do
if not orzeczenia[i].zastepcza then Result+= orzeczenia[i].Sdni;
end;
function TWPZ.GetUlamekArt: string;
var i: integer;
ranga: integer;
begin
ranga:=0; // 1/2
Result:= '1/2';
for i:=0 to Count-1 do
if not orzeczenia[i].zastepcza then
begin
if (orzeczenia[i].Sdni=0)and(ranga<4) then
begin
ranga:= 4;
Result:= 'po 25';
fKomunikaty.Append('Wykryto karę dożywocia w wierszu '+IntToStr(i+1));
end else
if (orzeczenia[i].lat=25)and(ranga<3) then
begin
ranga:= 3;
Result:= 'po 15';
fKomunikaty.Append('Wykryto karę 25 lat w wierszu '+IntToStr(i+1));
end else
if (orzeczenia[i].art.IndexOf(' 64§1')>=0)and(ranga<1) then
begin
ranga:=1;
Result:='2/3';
fKomunikaty.Append('Wykryto art.64§1 w wierszu '+IntToStr(i+1));
end else
if (orzeczenia[i].art.IndexOf(' 64§2')>=0)and(ranga<2) then
begin
ranga:=2;
Result:='3/4';
fKomunikaty.Append('Wykryto art.64§2 w wierszu '+IntToStr(i+1));
end else
if (orzeczenia[i].art.IndexOf(' 65§1')>=0)and(ranga<2) then
begin
ranga:=2;
Result:='3/4';
fKomunikaty.Append('Wykryto art.65§1 w wierszu '+IntToStr(i+1));
end;
end;
end;
procedure TWPZ.validateWPZ;
var wpz_po15: TDate;
begin
// górne ograniczenie
// wpz nie może być większe niż po 15 latach (dla 1/2, 2/3, 3/4, i po 15 latach)
if (not OBS_obostrzenie)and(fSumaKar>=(15*365)) then
begin
wpz_po15:= IncDay(orzeczenia[IndexWPZ].koniec_kary, -(fSumaKar-(15*365)));
if WPZ > wpz_po15 then
begin
WPZ:= wpz_po15;
fKomunikaty.Append('WPZ ograniczone; max po 15 latach.');
end;
end;
// dolne ograniczenie
if WPZ < data_osadzenia then
begin
WPZ:= data_osadzenia; // validate
fKomunikaty.Append('WPZ z dniem osadzenia.');
end;
end;
procedure TWPZ.validatePrzepustki;
begin
if przepustki < data_osadzenia then
begin
przepustki:= data_osadzenia; // validate
fKomunikaty.Append('Przepustki z dniem osadzenia.');
end;
end;
procedure TWPZ.validatePostpenit;
begin
if postpenit < data_osadzenia then
begin
postpenit:= data_osadzenia; // validate
fKomunikaty.Append('Postpenit z dniem osadzenia.');
end;
end;
function TWPZ.SprawdzWarunki: Boolean;
begin
Result:= true;
if data_osadzenia=NullDate then begin fKomunikaty.Append('Brak daty osadzenia.'); Result:= False; end;
if Count = 0 then begin fKomunikaty.Append('Brak wprowadzonych orzeczeń.'); Result:= False; end;
// if (IndexWPZ>=0)and(data_osadzenia>orzeczenia[IndexWPZ]) then begin fKomunikaty.Append('Data osadzenia jest większa od daty końca kary zasadniczej.'); Result:= fasle; end;
end;
function TWPZ.ObliczOBS: Boolean;
var odKonca: integer;
begin
Result:= false;
if OBS_obostrzenie then
begin
fKomunikaty.Append('Obostrzenie: po '+IntTostr(OBS_po_ilu)+' dniach. Uwzględnia okresy zaliczenia kary.');
odKonca:= fSumaKar - OBS_po_ilu;
WPZ:= IncDay(orzeczenia[IndexWPZ].koniec_kary, -odKonca);
validateWPZ;
przepustki:= IncDay(WPZ, -Trunc(OBS_po_ilu / 2));
validatePrzepustki;
postpenit:= IncDay(WPZ, -(6*30));
validatePostpenit;
fisObliczono:= true;
Result:= true;
end;
end;
function TWPZ.ObliczKaryZastepcze: Boolean;
begin
Result:= false;
// brak uprawnien do WPZ, mamy tylko kary zastępcze
if (Count>0)and(IndexWPZ=-1) then
begin
WPZ := NullDate;
przepustki:= NullDate;
postpenit := IncDay(orzeczenia[Count-1].koniec_kary, -(6*30));
validatePostpenit;
fKomunikaty.Append('Brak uprawnien do WPZ. Kary zastępcze.');
fisObliczono:= true;
Result:= true;
end;
end;
procedure TWPZ.ObliczUlamek;
var dni_od_konca: integer;
dni_do_przpustki: integer;
begin
fisObliczono:= false;
// sprawdzamy czy wprowadzono jakieś orzeczenia
if IndexWPZ= -1 then begin fKomunikaty.Append('Brak kary zasadniczej.'); exit; end;
if ulamek = '1/2' then
begin
dni_od_konca:= Trunc(fSumaKar/2);
dni_do_przpustki:= Trunc(dni_od_konca/2);
end else
if ulamek = '2/3' then
begin
dni_od_konca:= Trunc(fSumaKar/3);
dni_do_przpustki:= dni_od_konca;
end else
if ulamek = '3/4' then
begin
dni_od_konca:= Trunc(fSumaKar/4);
dni_do_przpustki:= dni_od_konca+Trunc(dni_od_konca/2);
end else
if ulamek = 'po 15' then
begin
dni_od_konca:= fSumaKar-(15*365);
dni_do_przpustki:= 2737; // 1/2 z 15 lat = 2737
end else // skazany na 25 lat
if ulamek = 'po 25' then if ObliczDozywocie then exit; // skazany na dożywocie
// sprawdzamy czy jest wprowadzony koniec kary w ostatnim orzeczeniu
if orzeczenia[IndexWPZ].koniec_kary = NullDate then begin fKomunikaty.Append('Brak daty końca kary.'); exit; end;
fKomunikaty.Append('Obliczono po: '+ulamek);
wpz:= IncDay(orzeczenia[IndexWPZ].koniec_kary, -dni_od_konca);
validateWPZ;
przepustki:= IncDay(wpz, -dni_do_przpustki);
validatePrzepustki;
postpenit:= IncDay(wpz, -(6*30));
validatePostpenit;
fisObliczono:= true;
end;
procedure TWPZ.ObliczOwz;
var owz_wpz: TDate;
i: integer;
dni_do_wpz: integer;
begin
fKomunikaty.Append('Zastosowano owz.');
// oblicz po roku od osadzenia
owz_wpz:= IncDay(data_osadzenia, 365);
// przesuwamy owz_wpz o kary zastępcze które są przed wyliczoną datą
for i:=0 to Count-1 do
begin
if (orzeczenia[i].zastepcza)and(owz_wpz >= orzeczenia[i].koniec_kary) then
begin
owz_wpz:= IncDay(owz_wpz, orzeczenia[i].Sdni);
end;
end;
// wpz nie może być wcześniej niż po roku od osadzenia
if wpz<owz_wpz then
begin
wpz:= owz_wpz;
// jeśli wpz wypada puźniej niż koniec kary to brak uprawnień
if wpz>orzeczenia[IndexWPZ].koniec_kary then
begin
fKomunikaty.Append('Zastosowano art. 81. Bez uprawnień do WPZ. Kara krótsza niż rok.');
wpz:= NullDate;
przepustki:= NullDate;
postpenit:= IncDay(orzeczenia[Count-1].koniec_kary, -(6*30)); // 6 msc przed końcem kary
validatePostpenit;
fisObliczono:= true;
exit;
end;
// przepustki po połowie kary (od osadzenia do wpz)
dni_do_wpz:= DaysBetween(data_osadzenia, wpz);
przepustki:= IncDay(wpz, -Trunc(dni_do_wpz / 2));
validatePrzepustki;
postpenit:= IncDay(wpz, -(6*30));
validatePostpenit;
fKomunikaty.Append('Zastosowano art. 81. Po roku od osadzenia, uwazględniono przesunięcie o kary zastępcze.');
fisObliczono:= true;
end;
end;
function TWPZ.ObliczDozywocie: Boolean;
begin
wpz:= IncDay(data_osadzenia, (25*365)); // po 25 latach od osadzenia
przepustki:= IncDay(wpz, -4562); // 25 lat / 2 = 4562 dni
validatePrzepustki;
postpenit:= IncDay(wpz, -(6*30));
validatePostpenit;
fKomunikaty.Append('Obliczono wpz dla dożywocia.');
fisObliczono:= true;
Result:= true;
end;
constructor TWPZ.Create;
begin
inherited Create;
fKomunikaty:= TStringList.Create;
fisObliczono:= false;
end;
destructor TWPZ.Destroy;
begin
FreeAndNil(fKomunikaty);
inherited Destroy;
end;
procedure TWPZ.Oblicz;
begin
// inicjiujemy obliczenia
fSumaKar:= SumojKary;
fisObliczono:= false;
if not SprawdzWarunki then exit;
if ObliczKaryZastepcze then exit;
if ObliczOBS then exit;
ObliczUlamek;
if (owz)and(fisObliczono) then ObliczOwz;
end;
function TWPZ.SaveToStr: String;
var JObj, JObjDane: TJSONObject;
JArr: TJSONArray;
i: integer;
begin
// object to json to str
DefaultFormatSettings.ShortDateFormat:='dd/mm/yyyy';
//JData:= TJSONData.Create;
JObj:= TJSONObject.Create; //(JData);
//JDane:= TJSONData.Create;
JObjDane:= TJSONObject.Create;//(JDane);
JObjDane.Add('data_osadzenia', DateToStr(data_osadzenia));
JObjDane.Add('owz', owz);
JObjDane.Add('ulamek', ulamek);
JObjDane.Add('OBS_obostrzenie', OBS_obostrzenie);
JObjDane.Add('OBS_po_ilu', OBS_po_ilu);
JObjDane.Add('uwagi', uwagi);
JObjDane.Add('WPZ', DateToStr(wpz));
JObjDane.Add('przepustki', DateToStr(przepustki));
JObjDane.Add('postpenit', DateToStr(postpenit));
JObj.Add('dane', JObjDane);
JArr:= TJSONArray.Create;
for i:=0 to Count-1 do
begin
//JDane:= TJSONData.Create;
JObjDane:= TJSONObject.Create;//(JDane);
JObjDane.Add('art', orzeczenia[i].art);
JObjDane.Add('lat', orzeczenia[i].lat);
JObjDane.Add('msc', orzeczenia[i].msc);
JObjDane.Add('dni', orzeczenia[i].dni);
JObjDane.Add('zastepcza', orzeczenia[i].zastepcza);
JObjDane.Add('koniec_kary', DateToStr(orzeczenia[i].koniec_kary));
JArr.Add(JObjDane);
end;
TJSONObject(JObj.Find('dane')).Add('orzeczenia', JArr);
Result:= JObj.FormatJSON();
end;
procedure TWPZ.LoadFromStr(value: string);
var JData: TJSONData;
JObj: TJSONObject;
JArr: TJSONArray;
i: integer;
begin
// str_json to object
DefaultFormatSettings.ShortDateFormat:='dd/mm/yyyy';
JData:= GetJSON(value);
JObj:= TJSONObject(JData.FindPath('dane'));
data_osadzenia := StrToDateDef(JObj.Get('data_osadzenia',''), NullDate);
owz := JObj.Get('owz', false);
ulamek := JObj.Get('ulamek','1/2');
OBS_obostrzenie:= JObj.Get('OBS_obostrzenie', false);
OBS_po_ilu := JObj.Get('OBS_po_ilu', 0);
uwagi := JObj.Get('uwagi','');
WPZ := StrToDateDef(JObj.Get('wpz',''), NullDate);
przepustki := StrToDateDef(JObj.Get('przepustki',''), NullDate);
postpenit := StrToDateDef(JObj.Get('postpenit',''), NullDate);
JArr:= TJSONArray(JData.FindPath('dane.orzeczenia'));
SetLength(orzeczenia, JArr.Count);
for i:=0 to JArr.Count-1 do
begin
JObj:= TJSONObject(JArr[i]);
orzeczenia[i].art:= JObj.Get('art', '');
orzeczenia[i].lat:= JObj.Get('lat',0);
orzeczenia[i].msc:= JObj.Get('msc',0);
orzeczenia[i].dni:= JObj.Get('dni',0);
orzeczenia[i].zastepcza:= JObj.Get('zastepcza', false);
orzeczenia[i].koniec_kary:= StrToDateDef(JObj.Get('koniec_kary',''), NullDate);
orzeczenia[i].Sdni:= WymiarKaryDni(orzeczenia[i]);
end;
fSumaKar:= SumojKary;
FreeAndNil(JData);
end;
procedure TWPZ.ParseFromDOC(value: string);
var dane: TStringList;
i: integer;
begin
// dane z skopiowane z dokumentu wygenerowanego przez Noe.NET
DefaultFormatSettings.ShortDateFormat:='dd/mm/yyyy';
dane:= TStringList.Create;
dane.Text:= value;
SetLength(orzeczenia, 0);
i:=0;
while i <= dane.Count-1 do
begin
if dane[i].IndexOf('Sąd') >=0 then
begin
SetLength(orzeczenia, Count+1);
orzeczenia[Count-1].art:= DeleteRepeatedSpaces(dane[i]); inc(i);
orzeczenia[Count-1].lat:= StrToIntDef(Trim(dane[i]),0); inc(i);
orzeczenia[Count-1].msc:= StrToIntDef(Trim(dane[i]),0); inc(i,2);
orzeczenia[Count-1].dni:= StrToIntDef(Trim(dane[i]),0); inc(i,2);
orzeczenia[Count-1].koniec_kary:= StrToDateDef(Trim(dane[i]), NullDate); inc(i,2);
orzeczenia[Count-1].Sdni:= WymiarKaryDni(orzeczenia[Count-1]);
orzeczenia[Count-1].zastepcza:= (orzeczenia[Count-1].dni>0);
end;
inc(i);
end;
fSumaKar:= SumojKary;
FreeAndNil(dane);
end;
function TWPZ.Count: integer;
begin
Result:= Length(orzeczenia);
end;
function TWPZ.IndexWPZ: integer;
var i: integer;
begin
Result:= -1;
for i:=0 to Count-1 do
if not orzeczenia[i].zastepcza then Result:= i;
end;
function TWPZ.AddOrzeczenie(Vart: string; Vlat, Vmsc, Vdni: integer;
Vzastepcza: Boolean; Vkoniec_kary: TDate): integer;
begin
SetLength(orzeczenia, Count+1);
Result:= Count-1;
with orzeczenia[Result] do
begin
art:= Vart;
lat:= Vlat;
msc:= Vmsc;
dni:= Vdni;
zastepcza:= Vzastepcza;
koniec_kary:= Vkoniec_kary;
Sdni:= WymiarKaryDni(orzeczenia[Result]);
end;
fSumaKar:= SumojKary;
// Oblicz;
end;
function DeleteRepeatedSpaces(s: string):string;
var i:integer;
begin
Result := '';
s:= Trim(s);
if Length(s)=0 then exit;
for i := 1 to Length(S)-1 do begin
if not ((s[i]=' ') and (s[i-1]=' ')) then begin
Result := Result + s[i];
end;
end;
end;
end.
| 26.214168 | 175 | 0.677162 |
fc477119ec4fe702ffcec01de05c22918dd0a0d2 | 6,165 | pas | Pascal | Source/PXL.Sysfs.Types.pas | ultibohub/Asphyre | fae5a358774bc41a94df6080b302316589322407 | [
"Intel"
]
| 5 | 2018-08-23T02:58:11.000Z | 2021-02-28T05:10:08.000Z | Source/PXL.Sysfs.Types.pas | amikey/asphyre | aed59514d5687184ada034d9c3776e0b7130644c | [
"Intel"
]
| 1 | 2017-09-03T06:53:03.000Z | 2017-09-03T06:53:03.000Z | Source/PXL.Sysfs.Types.pas | amikey/asphyre | aed59514d5687184ada034d9c3776e0b7130644c | [
"Intel"
]
| 4 | 2016-10-31T09:49:17.000Z | 2021-06-09T00:40:43.000Z | unit PXL.Sysfs.Types;
{
This file is part of Asphyre Framework, also known as Platform eXtended Library (PXL).
Copyright (c) 2000 - 2016 Yuriy Kotsarenko
The contents of this file are subject to the Mozilla Public License Version 2.0 (the "License");
you may not use this file except in compliance with the License. You may obtain a copy of the
License at http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
KIND, either express or implied. See the License for the specific language governing rights and
limitations under the License.
}
interface
{$INCLUDE PXL.Config.inc}
uses
SysUtils, PXL.TypeDef;
type
ESysfsGeneric = class(Exception);
ESysfsFileOpen = class(ESysfsGeneric);
ESysfsFileOpenWrite = class(ESysfsFileOpen);
ESysfsFileOpenRead = class(ESysfsFileOpen);
ESysfsFileOpenReadWrite = class(ESysfsFileOpen);
ESysfsFileAccess = class(ESysfsGeneric);
ESysfsFileWrite = class(ESysfsFileAccess);
ESysfsFileRead = class(ESysfsFileAccess);
ESysfsFileMemoryMap = class(ESysfsFileAccess);
ESysfsInvalidParams = class(ESysfsGeneric);
procedure WriteTextToFile(const FileName, Text: StdString);
function TryWriteTextToFile(const FileName, Text: StdString): Boolean;
function ReadCharFromFile(const FileName: StdString): StdChar;
function TryReadCharFromFile(const FileName: StdString; out Value: StdChar): Boolean;
function ReadTextFromFile(const FileName: StdString): StdString;
function TryReadTextFromFile(const FileName: StdString; out Value: StdString): Boolean;
resourcestring
SCannotOpenFileForWriting = 'Cannot open file <%s> for writing.';
SCannotOpenFileForReading = 'Cannot open file <%s> for reading.';
SCannotOpenFileForReadingWriting = 'Cannot open file <%s> for reading and writing.';
SCannotWriteTextToFile = 'Cannot write text <%s> to file <%s>.';
SCannotReadTextFromFile = 'Cannot read text from file <%s>.';
SCannotMemoryMapFile = 'Cannot map file <%s> to memory.';
SInvalidParameters = 'The specified parameters are invalid.';
implementation
uses
BaseUnix;
const
PercentualLengthDiv = 4;
StringBufferSize = 8;
procedure WriteTextToFile(const FileName, Text: StdString);
var
Handle: TUntypedHandle;
begin
Handle := fpopen(FileName, O_WRONLY);
if Handle < 0 then
raise ESysfsFileOpenWrite.Create(Format(SCannotOpenFileForWriting, [FileName]));
try
if fpwrite(Handle, Text[1], Length(Text)) <> Length(Text) then
raise ESysfsFileWrite.Create(Format(SCannotWriteTextToFile, [Text, FileName]));
finally
fpclose(Handle);
end;
end;
function TryWriteTextToFile(const FileName, Text: StdString): Boolean;
var
Handle: TUntypedHandle;
begin
Handle := fpopen(FileName, O_WRONLY);
if Handle < 0 then
Exit(False);
try
Result := fpwrite(Handle, Text[1], Length(Text)) = Length(Text);
finally
fpclose(Handle);
end;
end;
function ReadCharFromFile(const FileName: StdString): StdChar;
var
Handle: TUntypedHandle;
begin
Handle := fpopen(FileName, O_RDONLY);
if Handle < 0 then
raise ESysfsFileOpenRead.Create(Format(SCannotOpenFileForReading, [FileName]));
try
{$IF SIZEOF(STDCHAR) > 1}
Result := #0;
{$ENDIF}
if fpread(Handle, Result, 1) <> 1 then
raise ESysfsFileRead.Create(Format(SCannotReadTextFromFile, [FileName]));
finally
fpclose(Handle);
end;
end;
function TryReadCharFromFile(const FileName: StdString; out Value: StdChar): Boolean;
var
Handle: TUntypedHandle;
begin
Handle := fpopen(FileName, O_RDONLY);
if Handle < 0 then
Exit(False);
try
{$IF SIZEOF(STDCHAR) > 1}
Value := #0;
{$ENDIF}
Result := fpread(Handle, Value, 1) = 1;
finally
fpclose(Handle);
end;
end;
function ReadTextFromFile(const FileName: StdString): StdString;
var
Handle: TUntypedHandle;
Buffer: array[0..StringBufferSize - 1] of Byte;
I, BytesRead, TextLength, NewTextLength: Integer;
begin
TextLength := 0;
Handle := fpopen(FileName, O_RDONLY);
if Handle < 0 then
raise ESysfsFileOpenRead.Create(Format(SCannotOpenFileForReading, [FileName]));
try
SetLength(Result, StringBufferSize);
repeat
BytesRead := fpread(Handle, Buffer[0], StringBufferSize);
if (BytesRead < 0) or ((BytesRead = 0) and (TextLength <= 0)) then
raise ESysfsFileRead.Create(Format(SCannotReadTextFromFile, [FileName]));
if Length(Result) < TextLength + BytesRead then
begin
NewTextLength := Length(Result) + StringBufferSize + (Length(Result) div PercentualLengthDiv);
SetLength(Result, NewTextLength);
end;
for I := 0 to BytesRead - 1 do
Result[1 + TextLength + I] := Chr(Buffer[I]);
Inc(TextLength, BytesRead);
until BytesRead <= 0;
finally
fpclose(Handle);
end;
SetLength(Result, TextLength);
end;
function TryReadTextFromFile(const FileName: StdString; out Value: StdString): Boolean;
var
Handle: TUntypedHandle;
Buffer: array[0..StringBufferSize - 1] of Byte;
I, BytesRead, TextLength, NewTextLength: Integer;
begin
TextLength := 0;
Handle := fpopen(FileName, O_RDONLY);
if Handle < 0 then
begin
SetLength(Value, 0);
Exit(False);
end;
try
SetLength(Value, StringBufferSize);
repeat
BytesRead := fpread(Handle, Buffer[0], StringBufferSize);
if (BytesRead < 0) or ((BytesRead = 0) and (TextLength <= 0)) then
begin
SetLength(Value, 0);
Exit(False);
end;
if Length(Value) < TextLength + BytesRead then
begin
NewTextLength := Length(Value) + StringBufferSize + (Length(Value) div PercentualLengthDiv);
SetLength(Value, NewTextLength);
end;
for I := 0 to BytesRead - 1 do
Value[1 + TextLength + I] := Chr(Buffer[I]);
Inc(TextLength, BytesRead);
until BytesRead <= 0;
finally
fpclose(Handle);
end;
SetLength(Value, TextLength);
Result := True;
end;
end.
| 29.357143 | 103 | 0.688564 |
c3042946c1651310d35f6565014a795b1ef6d6bf | 6,181 | pas | Pascal | Capitulo3/Exemplo2/ClientClassesUnit1.pas | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 10 | 2017-08-02T00:44:41.000Z | 2021-10-13T21:11:28.000Z | Capitulo3/Exemplo2/ClientClassesUnit1.pas | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 10 | 2019-12-30T04:09:37.000Z | 2022-03-02T06:06:19.000Z | Capitulo3/Exemplo2/ClientClassesUnit1.pas | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 9 | 2017-04-29T16:12:21.000Z | 2020-11-11T22:16:32.000Z | //
// Created by the DataSnap proxy generator.
// 25/03/2017 14:55:04
//
unit ClientClassesUnit1;
interface
uses System.JSON, Datasnap.DSProxyRest, Datasnap.DSClientRest, Data.DBXCommon, Data.DBXClient, Data.DBXDataSnap, Data.DBXJSON, Datasnap.DSProxy, System.Classes, System.SysUtils, Data.DB, Data.SqlExpr, Data.DBXDBReaders, Data.DBXCDSReaders, Data.DBXJSONReflect;
type
TServerMethods1Client = class(TDSAdminRestClient)
private
FtmrValorAtualTimerCommand: TDSRestCommand;
FDSServerModuleCreateCommand: TDSRestCommand;
FEchoStringCommand: TDSRestCommand;
FReverseStringCommand: TDSRestCommand;
FGetValorDolarAtualCommand: TDSRestCommand;
public
constructor Create(ARestConnection: TDSRestConnection); overload;
constructor Create(ARestConnection: TDSRestConnection; AInstanceOwner: Boolean); overload;
destructor Destroy; override;
procedure tmrValorAtualTimer(Sender: TObject);
procedure DSServerModuleCreate(Sender: TObject);
function EchoString(Value: string; const ARequestFilter: string = ''): string;
function ReverseString(Value: string; const ARequestFilter: string = ''): string;
function GetValorDolarAtual(const ARequestFilter: string = ''): Currency;
end;
const
TServerMethods1_tmrValorAtualTimer: array [0..0] of TDSRestParameterMetaData =
(
(Name: 'Sender'; Direction: 1; DBXType: 37; TypeName: 'TObject')
);
TServerMethods1_DSServerModuleCreate: array [0..0] of TDSRestParameterMetaData =
(
(Name: 'Sender'; Direction: 1; DBXType: 37; TypeName: 'TObject')
);
TServerMethods1_EchoString: array [0..1] of TDSRestParameterMetaData =
(
(Name: 'Value'; Direction: 1; DBXType: 26; TypeName: 'string'),
(Name: ''; Direction: 4; DBXType: 26; TypeName: 'string')
);
TServerMethods1_ReverseString: array [0..1] of TDSRestParameterMetaData =
(
(Name: 'Value'; Direction: 1; DBXType: 26; TypeName: 'string'),
(Name: ''; Direction: 4; DBXType: 26; TypeName: 'string')
);
TServerMethods1_GetValorDolarAtual: array [0..0] of TDSRestParameterMetaData =
(
(Name: ''; Direction: 4; DBXType: 25; TypeName: 'Currency')
);
implementation
procedure TServerMethods1Client.tmrValorAtualTimer(Sender: TObject);
begin
if FtmrValorAtualTimerCommand = nil then
begin
FtmrValorAtualTimerCommand := FConnection.CreateCommand;
FtmrValorAtualTimerCommand.RequestType := 'POST';
FtmrValorAtualTimerCommand.Text := 'TServerMethods1."tmrValorAtualTimer"';
FtmrValorAtualTimerCommand.Prepare(TServerMethods1_tmrValorAtualTimer);
end;
if not Assigned(Sender) then
FtmrValorAtualTimerCommand.Parameters[0].Value.SetNull
else
begin
FMarshal := TDSRestCommand(FtmrValorAtualTimerCommand.Parameters[0].ConnectionHandler).GetJSONMarshaler;
try
FtmrValorAtualTimerCommand.Parameters[0].Value.SetJSONValue(FMarshal.Marshal(Sender), True);
if FInstanceOwner then
Sender.Free
finally
FreeAndNil(FMarshal)
end
end;
FtmrValorAtualTimerCommand.Execute;
end;
procedure TServerMethods1Client.DSServerModuleCreate(Sender: TObject);
begin
if FDSServerModuleCreateCommand = nil then
begin
FDSServerModuleCreateCommand := FConnection.CreateCommand;
FDSServerModuleCreateCommand.RequestType := 'POST';
FDSServerModuleCreateCommand.Text := 'TServerMethods1."DSServerModuleCreate"';
FDSServerModuleCreateCommand.Prepare(TServerMethods1_DSServerModuleCreate);
end;
if not Assigned(Sender) then
FDSServerModuleCreateCommand.Parameters[0].Value.SetNull
else
begin
FMarshal := TDSRestCommand(FDSServerModuleCreateCommand.Parameters[0].ConnectionHandler).GetJSONMarshaler;
try
FDSServerModuleCreateCommand.Parameters[0].Value.SetJSONValue(FMarshal.Marshal(Sender), True);
if FInstanceOwner then
Sender.Free
finally
FreeAndNil(FMarshal)
end
end;
FDSServerModuleCreateCommand.Execute;
end;
function TServerMethods1Client.EchoString(Value: string; const ARequestFilter: string): string;
begin
if FEchoStringCommand = nil then
begin
FEchoStringCommand := FConnection.CreateCommand;
FEchoStringCommand.RequestType := 'GET';
FEchoStringCommand.Text := 'TServerMethods1.EchoString';
FEchoStringCommand.Prepare(TServerMethods1_EchoString);
end;
FEchoStringCommand.Parameters[0].Value.SetWideString(Value);
FEchoStringCommand.Execute(ARequestFilter);
Result := FEchoStringCommand.Parameters[1].Value.GetWideString;
end;
function TServerMethods1Client.ReverseString(Value: string; const ARequestFilter: string): string;
begin
if FReverseStringCommand = nil then
begin
FReverseStringCommand := FConnection.CreateCommand;
FReverseStringCommand.RequestType := 'GET';
FReverseStringCommand.Text := 'TServerMethods1.ReverseString';
FReverseStringCommand.Prepare(TServerMethods1_ReverseString);
end;
FReverseStringCommand.Parameters[0].Value.SetWideString(Value);
FReverseStringCommand.Execute(ARequestFilter);
Result := FReverseStringCommand.Parameters[1].Value.GetWideString;
end;
function TServerMethods1Client.GetValorDolarAtual(const ARequestFilter: string): Currency;
begin
if FGetValorDolarAtualCommand = nil then
begin
FGetValorDolarAtualCommand := FConnection.CreateCommand;
FGetValorDolarAtualCommand.RequestType := 'GET';
FGetValorDolarAtualCommand.Text := 'TServerMethods1.GetValorDolarAtual';
FGetValorDolarAtualCommand.Prepare(TServerMethods1_GetValorDolarAtual);
end;
FGetValorDolarAtualCommand.Execute(ARequestFilter);
Result := FGetValorDolarAtualCommand.Parameters[0].Value.AsCurrency;
end;
constructor TServerMethods1Client.Create(ARestConnection: TDSRestConnection);
begin
inherited Create(ARestConnection);
end;
constructor TServerMethods1Client.Create(ARestConnection: TDSRestConnection; AInstanceOwner: Boolean);
begin
inherited Create(ARestConnection, AInstanceOwner);
end;
destructor TServerMethods1Client.Destroy;
begin
FtmrValorAtualTimerCommand.DisposeOf;
FDSServerModuleCreateCommand.DisposeOf;
FEchoStringCommand.DisposeOf;
FReverseStringCommand.DisposeOf;
FGetValorDolarAtualCommand.DisposeOf;
inherited;
end;
end.
| 35.728324 | 260 | 0.781265 |
83d173f9c04fe0998618e266a73c019171121ab8 | 8,168 | pas | Pascal | components/jcl/examples/windows/debug/tools/MapToJdbgMain.pas | padcom/delcos | dc9e8ac8545c0e6c0b4e963d5baf0dc7d72d2bf0 | [
"Apache-2.0"
]
| 15 | 2016-08-24T07:32:49.000Z | 2021-11-16T11:25:00.000Z | components/jcl/examples/windows/debug/tools/MapToJdbgMain.pas | CWBudde/delcos | 656384c43c2980990ea691e4e52752d718fb0277 | [
"Apache-2.0"
]
| 1 | 2016-08-24T19:00:34.000Z | 2016-08-25T19:02:14.000Z | components/jcl/examples/windows/debug/tools/MapToJdbgMain.pas | padcom/delcos | dc9e8ac8545c0e6c0b4e963d5baf0dc7d72d2bf0 | [
"Apache-2.0"
]
| 4 | 2015-11-06T12:15:36.000Z | 2018-10-08T15:17:17.000Z | {**************************************************************************************************}
{ }
{ Project JEDI Code Library (JCL) }
{ }
{ The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); }
{ you may not use this file except in compliance with the License. You may obtain a copy of the }
{ License at http://www.mozilla.org/MPL/ }
{ }
{ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF }
{ ANY KIND, either express or implied. See the License for the specific language governing rights }
{ and limitations under the License. }
{ }
{ The Original Code is MapToJdbgMain.pas. }
{ }
{ The Initial Developer of the Original Code is Petr Vones. }
{ Portions created by Petr Vones are Copyright (C) of Petr Vones. }
{ }
{ Contributors: }
{ Michael Chernyshev }
{ }
{**************************************************************************************************}
{ }
{ Last modified: $Date:: 2010-08-08 10:59:23 +0200 (dim., 08 août 2010) $ }
{ Revision: $Rev:: 3280 $ }
{ Author: $Author:: outchy $ }
{ }
{**************************************************************************************************}
unit MapToJdbgMain;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, ImgList, ActnList, Menus, ToolWin;
type
TMainForm = class(TForm)
ToolBar1: TToolBar;
MainMenu1: TMainMenu;
ActionList1: TActionList;
ImageList1: TImageList;
StatusBar1: TStatusBar;
Exit1: TAction;
Open1: TAction;
Convert1: TAction;
File1: TMenuItem;
Open2: TMenuItem;
N1: TMenuItem;
Exit2: TMenuItem;
OpenDialog1: TOpenDialog;
FilesListView: TListView;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
ToolButton3: TToolButton;
Run1: TMenuItem;
Convert2: TMenuItem;
procedure Exit1Execute(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Open1Execute(Sender: TObject);
procedure Convert1Execute(Sender: TObject);
procedure Convert1Update(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
MainForm: TMainForm;
implementation
{$R *.DFM}
uses
JclCounter, JclDebug, JclFileUtils, JclUnitConv;
resourcestring
RsConverting = 'Converting ...';
RsConversionStatus = '%d file(s) converted, Conversion time: %5.3f sec.';
RsLinkerBugs = 'Linker bugs: %d';
procedure TMainForm.FormCreate(Sender: TObject);
var
MapFileName, ExeFileName: TFileName;
LinkerBugUnit: string;
MapFileSize, JclDebugDataSize, LineNumberErrors: Integer;
begin
if ParamCount = 1 then
begin
MapFileName := ParamStr(1);
if MapFileName <> '' then
begin
if not ConvertMapFileToJdbgFile(MapFileName) then
ExitCode := 1;
Application.ShowMainForm := False;
Application.Terminate;
end;
end
else
if ParamCount = 2 then
begin
MapFileName := ParamStr(1);
ExeFileName := ParamStr(2);
if (MapFileName <> '') and (ExeFileName <> '') then
begin
if not InsertDebugDataIntoExecutableFile(ExeFileName, MapFileName, LinkerBugUnit, MapFileSize, JclDebugDataSize, LineNumberErrors) then
ExitCode := 1;
Application.ShowMainForm := False;
Application.Terminate;
end;
end;
end;
procedure TMainForm.Exit1Execute(Sender: TObject);
begin
Close;
end;
procedure TMainForm.Open1Execute(Sender: TObject);
var
I, FileSize: Integer;
begin
with OpenDialog1 do
begin
FileName := '';
if Execute then
begin
with FilesListView.Items do
begin
BeginUpdate;
try
Clear;
for I := 0 to Files.Count - 1 do
with Add do
begin
Caption := PathExtractFileNameNoExt(Files[I]);
FileSize := FileGetSize(Files[I]);
SubItems.AddObject(IntToStr(FileSize), Pointer(FileSize));
SubItems.Add('');
SubItems.Add('');
SubItems.Add(Files[I]);
SubItems.Add('');
SubItems.Add('');
ImageIndex := 1;
end;
finally
EndUpdate;
end;
end;
StatusBar1.Panels[0].Text := '';
end;
end;
end;
procedure TMainForm.Convert1Execute(Sender: TObject);
var
I, JdbgFileSize, FilesConverted, LineNumberErrors, LinkerBugCnt: Integer;
MapFileName, JdbgFileName: TFileName;
Ratio: Extended;
LinkerBugUnit: string;
Cnt: TJclCounter;
begin
Screen.Cursor := crHourGlass;
try
with FilesListView do
begin
StatusBar1.Panels[0].Text := RsConverting;
StatusBar1.Panels[1].Text := '';
StatusBar1.Update;
Items.BeginUpdate;
for I := 0 to Items.Count - 1 do
with Items[I] do
begin
SubItems[1] := '';
SubItems[2] := '';
SubItems[4] := '';
SubItems[5] := '';
ImageIndex := 1;
end;
Items.EndUpdate;
Update;
FilesConverted := 0;
LinkerBugCnt := 0;
StartCount(Cnt);
for I := 0 to Items.Count - 1 do
begin
with Items[I] do
begin
MapFileName := SubItems[3];
JdbgFileName := ChangeFileExt(MapFileName, JclDbgFileExtension);
if ConvertMapFileToJdbgFile(MapFileName, LinkerBugUnit, LineNumberErrors) then
begin
ImageIndex := 3;
JdbgFileSize := FileGetSize(JdbgFileName);
Ratio := JdbgFileSize * 100 / Integer(SubItems.Objects[0]);
SubItems[1] := IntToStr(JdbgFileSize);
SubItems[2] := Format('%3.1f %%', [Ratio]);
SubItems[4] := LinkerBugUnit;
if LinkerBugUnit <> '' then
Inc(LinkerBugCnt);
if LineNumberErrors > 0 then
SubItems[5] := IntToStr(LineNumberErrors);
Inc(FilesConverted);
end
else
begin
SubItems[0] := '';
ImageIndex := 4;
end;
end;
Update;
end;
StatusBar1.Panels[0].Text := Format(RsConversionStatus, [FilesConverted, StopCount(Cnt)]);
StatusBar1.Panels[1].Text := Format(RsLinkerBugs, [LinkerBugCnt]);
end;
finally
Screen.Cursor := crDefault;
end;
end;
procedure TMainForm.Convert1Update(Sender: TObject);
begin
Convert1.Enabled := FilesListView.Items.Count > 0;
end;
end.
| 35.668122 | 142 | 0.472698 |
f12faa26b2a64906062eebbd0cb1f408d46918e1 | 279 | pas | Pascal | src/DM/UDmrel.pas | schrsistemas/mestre-escola-delphi | d2482a6fc212c69733faad41e6d1fdc5c13d0fbe | [
"MIT"
]
| 1 | 2021-05-29T00:59:43.000Z | 2021-05-29T00:59:43.000Z | src/DM/UDmrel.pas | schrsistemas/mestre-escola-delphi | d2482a6fc212c69733faad41e6d1fdc5c13d0fbe | [
"MIT"
]
| 1 | 2021-05-29T07:12:51.000Z | 2021-05-29T07:15:10.000Z | src/DM/UDmrel.pas | schrsistemas/mestre-escola-delphi | d2482a6fc212c69733faad41e6d1fdc5c13d0fbe | [
"MIT"
]
| null | null | null | unit UDmrel;
interface
uses
System.SysUtils, System.Classes;
type
TDmRel = class(TDataModule)
private
{ Private declarations }
public
{ Public declarations }
end;
var
DmRel: TDmRel;
implementation
{%CLASSGROUP 'Vcl.Controls.TControl'}
{$R *.dfm}
end.
| 10.730769 | 37 | 0.691756 |
83435fb0e3465bf40897ce1f05f257e58ae7986d | 1,716 | dfm | Pascal | Capitulo8/2.10.TesteUnitario/Form.Principal.dfm | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 10 | 2017-08-02T00:44:41.000Z | 2021-10-13T21:11:28.000Z | Capitulo8/2.10.TesteUnitario/Form.Principal.dfm | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 10 | 2019-12-30T04:09:37.000Z | 2022-03-02T06:06:19.000Z | Capitulo8/2.10.TesteUnitario/Form.Principal.dfm | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 9 | 2017-04-29T16:12:21.000Z | 2020-11-11T22:16:32.000Z | object frmPrincipal: TfrmPrincipal
Left = 0
Top = 0
Caption = 'Teste Unit'#225'rio'
ClientHeight = 339
ClientWidth = 564
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
PixelsPerInch = 96
TextHeight = 13
object Button1: TButton
Left = 24
Top = 24
Width = 129
Height = 57
Caption = 'Button1'
TabOrder = 0
OnClick = Button1Click
end
object Button2: TButton
Left = 24
Top = 104
Width = 75
Height = 25
Caption = 'Button2'
TabOrder = 1
OnClick = Button2Click
end
object IdHTTP1: TIdHTTP
IOHandler = IdSSLIOHandlerSocketOpenSSL1
AllowCookies = True
ProxyParams.BasicAuthentication = False
ProxyParams.ProxyPort = 0
Request.ContentLength = -1
Request.ContentRangeEnd = -1
Request.ContentRangeStart = -1
Request.ContentRangeInstanceLength = -1
Request.Accept = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
Request.BasicAuthentication = False
Request.UserAgent = 'Mozilla/3.0 (compatible; Indy Library)'
Request.Ranges.Units = 'bytes'
Request.Ranges = <>
HTTPOptions = [hoForceEncodeParams]
Left = 272
Top = 144
end
object IdSSLIOHandlerSocketOpenSSL1: TIdSSLIOHandlerSocketOpenSSL
MaxLineAction = maException
Port = 0
DefaultPort = 0
SSLOptions.Method = sslvSSLv23
SSLOptions.SSLVersions = [sslvSSLv2, sslvSSLv3, sslvTLSv1, sslvTLSv1_1, sslvTLSv1_2]
SSLOptions.Mode = sslmUnassigned
SSLOptions.VerifyMode = []
SSLOptions.VerifyDepth = 0
Left = 272
Top = 192
end
end
| 26 | 88 | 0.68648 |
c319b2d50536726c609f3e92e3514b6ca3d924ea | 1,617 | pas | Pascal | Examples/Source/DecoratorsTest/speedtests.pas | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 11 | 2017-06-17T05:13:45.000Z | 2021-07-11T13:18:48.000Z | Examples/Source/DecoratorsTest/speedtests.pas | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 2 | 2019-03-05T12:52:40.000Z | 2021-12-03T12:34:26.000Z | Examples/Source/DecoratorsTest/speedtests.pas | joecare99/Public | 9eee060fbdd32bab33cf65044602976ac83f4b83 | [
"MIT"
]
| 6 | 2017-09-07T09:10:09.000Z | 2022-02-19T20:19:58.000Z | unit speedtests;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, fpcunit, testregistry, testdecorator;
type
{ TRepeatedTest }
TRepeatedTest = class(TTestSetup)
private
FRepeatCount: integer;
public
procedure OneTimeSetup; override;
procedure OneTimeTeardown; override;
function CountTestCases: integer; override;
procedure BasicRun(AResult: TTestResult); override;
property RepeatCount: integer read FRepeatCount write FRepeatCount;
end;
TMySpeedTest = class(TTestCase)
public
constructor Create; override;
published
procedure TestSpeed;
procedure TestSpeed2;
procedure TestSpeed3;
procedure TestSpeed4;
end;
implementation
{ TMySpeedTest }
constructor TMySpeedTest.Create;
begin
inherited Create;
Writeln('calling.... constructor TMySpeedTest.Create');
end;
procedure TMySpeedTest.TestSpeed;
begin
Check(true);
end;
procedure TMySpeedTest.TestSpeed2;
begin
Check(true);
end;
procedure TMySpeedTest.TestSpeed3;
begin
Check(true);
end;
procedure TMySpeedTest.TestSpeed4;
begin
Check(true);
end;
{ TRepeatedTest }
procedure TRepeatedTest.OneTimeSetup;
begin
FRepeatCount := 5;
end;
procedure TRepeatedTest.OneTimeTeardown;
begin
//
end;
function TRepeatedTest.CountTestCases: integer;
begin
Result := inherited CountTestCases * FRepeatCount;
end;
procedure TRepeatedTest.BasicRun(AResult: TTestResult);
var
i: integer;
begin
i := FRepeatCount;
while i > 0 do
begin
inherited BasicRun(AResult);
dec(i);
end;
end;
initialization
RegisterTestDecorator(TRepeatedTest, TMySpeedTest);
end.
| 16.009901 | 72 | 0.750155 |
4797f43ae29809429abee0afd38e58cf0a2022ec | 345 | dpr | Pascal | Components/samples/Hex-Viewer/Project1.dpr | fobricia/old-DIE | 77cb7fc4bc81c79da896936873f09f6fbdd02d57 | [
"BSD-2-Clause"
]
| 11 | 2015-05-02T16:13:45.000Z | 2022-02-06T23:48:39.000Z | Components/samples/Hex-Viewer/Project1.dpr | fobricia/old-DIE | 77cb7fc4bc81c79da896936873f09f6fbdd02d57 | [
"BSD-2-Clause"
]
| null | null | null | Components/samples/Hex-Viewer/Project1.dpr | fobricia/old-DIE | 77cb7fc4bc81c79da896936873f09f6fbdd02d57 | [
"BSD-2-Clause"
]
| 4 | 2015-08-19T04:55:32.000Z | 2020-08-07T00:40:14.000Z | program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {fmHexViewer},
uprinting in 'uprinting.pas' {fmPrinting},
uprintprogress in 'uprintprogress.pas' {dlgPrintProgress},
ufinddialog in 'ufinddialog.pas' {dlgFind};
{$R *.RES}
begin
Application.Initialize;
Application.CreateForm(TfmHexViewer, fmHexViewer);
Application.Run;
end.
| 20.294118 | 60 | 0.744928 |
83b0952fc8464f61d60269643e5584c82a2e52eb | 69,999 | pas | Pascal | Laba_1/Unit1.pas | ArtyomButrim/TI_First_Lab | a2332cfeadc39ef2d930c78514b7fcc051437d35 | [
"MIT"
]
| null | null | null | Laba_1/Unit1.pas | ArtyomButrim/TI_First_Lab | a2332cfeadc39ef2d930c78514b7fcc051437d35 | [
"MIT"
]
| 1 | 2020-02-27T07:58:51.000Z | 2020-02-28T06:44:56.000Z | Laba_1/Unit1.pas | ArtyomButrim/TI_First_Lab | a2332cfeadc39ef2d930c78514b7fcc051437d35 | [
"MIT"
]
| null | null | null | unit Unit1;
//Приложение для кодировки и раскодировки текста
interface
//Используемые модули
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, StrUtils;
//Объявление констант
Const
n=4;
alf=['q','Q','w','W','e','E','S','r','R','t','T','y','Y','U','I','O','P','A','u','D','F','G','H','J','K','L','Z','X','C','V','B','N','M','i','o','p','a','s','d','f','g','h','j','k','l','l','z','x','c','v','b','n','m'];
alf2=['й','ц','у','к','е','н','г','ш','щ','з','х','ъ','ф','ы','в','а','п','р','о','л','д','ж','э','я','ч','с','м','и','т','ь','б','ю','ё','Ё','Й','Ц','К','У','Е','Н','Г','Ш','Щ','З','Х','Ъ','Ф','Ы','В','А','П','Р','О','Л','Д','Ж','Э','Я','Ч','С','М','И','Т','Ь','Б','Ю'];
max=['Ё','Й','Ц','К','У','Е','Н','Г','Ш','Щ','З','Х','Ъ','Ф','Ы','В','А','П','Р','О','Л','Д','Ж','Э','Я','Ч','С','М','И','Т','Ь','Б','Ю'];
min=['й','ц','у','к','е','н','г','ш','щ','з','х','ъ','ф','ы','в','а','п','р','о','л','д','ж','э','я','ч','с','м','и','т','ь','б','ю','ё'];
//n-число строк и столбцов в матрице
//alf- буквы английского алфавита
//alf2- буквы русского алфавита
//max- большие буквы русского алфавита
//min- маленькие буквы русского алфавита
//Объявление типов
type
Matrix= array[1..n,1..n] of String; //Матрица 4х4
TEncrypter = class(TForm)
HelpText2: TLabel;
TypeOfEncr: TComboBox;
TextOfKey: TLabel;
KeyOfEncr: TEdit;
DoThis: TButton;
CloseBtn: TButton;
Decrypt: TButton;
Errorlb: TLabel;
ErrorText: TMemo;
ChipherTextlb: TLabel;
UseTextFromFile: TCheckBox;
ResultText: TMemo;
PlainTextForEncr: TMemo;
Plaintext: TLabel;
procedure DoThisClick(Sender: TObject);
procedure CloseBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure TypeOfEncrChange(Sender: TObject);
procedure EncrOrDecrKeyPress(Sender: TObject; var Key: Char);
procedure TypeOfEncrKeyPress(Sender: TObject; var Key: Char);
procedure EncrOrDecrChange(Sender: TObject);
procedure DecryptClick(Sender: TObject);
procedure UseTextFromFileClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
Procedure FirstLook();
Procedure ColEncr2(const key: String);
//Объявление переменных
var
Encrypter: TEncrypter;
mask: Matrix =(('x','o','o','o'),('o','o','o','x'),('o','o','x','o'),('o','x','o','o'));
//mask- вспомогательная матрица, используемая для шифрования(расшифрования) текста методом поворачивающейся решётки
implementation
{$R *.dfm}
//Процедура обнуляющая все значения на форме
Procedure FirstLook();
begin
Encrypter.TypeOfEncr.ItemIndex:=-1;
Encrypter.KeyOfEncr.Text:='';
Encrypter.keyOfEncr.Enabled:=False;
Encrypter.DoThis.Enabled:=false;
Encrypter.Decrypt.Enabled:=false;
end;
//Процедура поворота матрицы на 90 градусов вправо
procedure Povorot(var mass1:Matrix);
var
mass2: Matrix;
i,j:Integer;
//mass2- вспомогательная матрица
//i,j- счётчики цикла
begin
mass2 := mass1;
for i := 1 to n do
begin
for j := 1 to n do
begin
mass1[j, n - i + 1] := mass2[i, j];
end;
end;
end;
//Процедура для шифрования и дешифрования текста столбцовым методом
Procedure ColEncr3(const key: String);
var
matr: array[1..500,1..500] of String; //матрица для шифрования(расшифрования) текста
i,j,x,col,row:integer; //Счётчики цикла
File1,File2:Text; //Текстовый файлы
k: real; //переменная для определения числа строк матрицы
min:integer; //перменная для упорядочивания массива
lengthstr, sizet: integer; //размер текста
str: string; //переменная для временного хранения строки
tmpn1,tmpn2:Integer; //Переменные для временного хранения элементов массивов
tmp1,tmp2: char; //переменные для определения порядка хода символов ключа
mass: array[1..500] of integer; //массив, определяющий порядок хода символов ключа
mass2: array[1..500] of integer; //массив, определяющий порядок вывода символов в текстовый файл
tmp: char; //Временная переменная
lengthkey: integer;
mass3: array[1..500] of Char; //переменная для определения наличия символов другого языка в ключе
mass4: array[1..500] of Char;
Textstr: String;
mass5: array[1..500] of String;
begin
j:=1;
//Определение вхождения в ключ символов другого языка
lengthkey:=0;
For i:=1 to length(key) do
begin
if key[i] in alf then
begin
lengthkey:=lengthkey+1;
mass3[j]:=key[i];
inc(j);
end;
end;
//Если ключ содержит символ другого языка, то вывод сообщения об этом, иначе дальнейшее выполнение программы
if lengthkey=0 then
begin
Encrypter.ErrorText.Lines.Add('Ключ содержит только символы не входящие в английский язык!');
assignFile(File2,'Encr-Decr.txt');
Textstr:='';
lengthstr:=0;
for i:=0 to encrypter.PlainTextForEncr.Lines.Count do
begin
str:=Encrypter.PlainTextForEncr.Lines[i];
for j:=1 to length(Str) do
begin
if (str[j] in alf) then
begin
lengthstr:=lengthstr+1;
end;
end;
Textstr:=Textstr+str;
end;
rewrite(file2);
if lengthstr>0 then
begin
lengthstr:=1;
while length(textstr)>=lengthstr do
begin
if Textstr[lengthstr] in alf then
begin
write(file2,UpCase(Textstr[lengthstr]));
lengthstr:=lengthstr+1;
end
else
begin
lengthstr:=lengthstr+1;
end;
end;
end
else
begin
rewrite(file2);
end;
reset(file2);
readln(file2,str);
Encrypter.ResultText.Lines.Add(str);
closefile(file2);
end
else
begin
//расШифрование
assignFile(File2,'Encr-Decr.txt');
Textstr:='';
lengthstr:=0;
for i:=0 to encrypter.PlainTextForEncr.Lines.Count do
begin
str:=Encrypter.PlainTextForEncr.Lines[i];
for j:=1 to length(Str) do
begin
if (str[j] in alf) or (str[j]=' ') then
begin
lengthstr:=lengthstr+1;
end;
end;
Textstr:=Textstr+str;
end;
//Если нет символов данного языка в файле, то вывод сообщения об этом, иначе - дальнешее выполнение программы
If lengthstr=0 then
begin
Encrypter.ErrorText.Lines.Add('Текстовое поле пусто или содержит только символы не английского языка');
Rewrite(File2);
CloseFile(File2);
end
else
begin
sizet:=lengthstr;
//Определение порядка следования символов в ключе
tmp1:='A';
tmp2:='a';
x:=1;
for i := 1 to 26 do
begin
for j := 1 to lengthkey do
begin
if (mass3[j]=tmp1) or (mass3[j]=tmp2) then
begin
mass2[j]:=x;
inc(x);
end;
end;
tmp1:=succ(tmp1);
tmp2:=succ(tmp2);
end;
for i := 1 to lengthkey do
begin
mass[i]:=i;
end;
// Сортировка массивов для определения последовательности заполнения матрицы для расшифровки
for i := 1 to lengthkey-1 do
begin
min:=i;
for j := i+1 to lengthkey do
begin
if mass2[min]>mass2[j] then
begin
min:=j;
end;
end;
tmpn1:=mass2[i];
mass2[i]:=mass2[min];
mass2[min]:=tmpn1;
tmpn2:=mass[min];
mass[min]:=mass[i];
mass[i]:=tmpn2;
end;
//Определение кол-ва строк в матрице
j:=lengthkey;
k:=sizet/j;
if k-trunc(k)<>0 then
begin
x:=trunc(k)+1;
end
else
begin
x:=trunc(k);
end;
col:=j;
row:=x;
//Заполнение матрицы для расшифровки
lengthstr:=1;
for i := 1 to col do
begin
for j := 1 to row do
begin
if Textstr[lengthstr] in alf then
begin
matr[j][mass[i]]:=UpCase(Textstr[lengthstr]);
lengthstr:=lengthstr+1;
end
else
begin
if Textstr[lengthstr]=' ' then
begin
matr[j][mass[i]]:='';
lengthstr:=lengthstr+1;
end
else
begin
repeat
lengthstr:=lengthstr+1;
until
textstr[lengthstr] in alf;
if lengthstr<=sizet then
begin
matr[j][mass[i]]:=UpCase(textstr[lengthstr]);
lengthstr:=lengthstr+1;
end;
end;
end;
end;
end;
//Вывод Расшифрованного текста в текстовый файл
Rewrite(File2);
for i := 1 to row do
begin
for j := 1 to col do
begin
write(File2,matr[i][j]);
end;
end;
Reset(File2);
Readln(File2,Str);
Encrypter.ResultText.Lines.Add(str);
CloseFile(File2);
end;
end;
end;
//Процедура для шифрования и дешифрования текста столбцовым методом
Procedure ColEncr2(const key: String);
var
matr: array[1..500,1..500] of String; //матрица для шифрования(расшифрования) текста
i,j,x,col,row:integer; //Счётчики цикла
File1,File2:Text; //Текстовый файлы
k: real; //переменная для определения числа строк матрицы
min:integer; //перменная для упорядочивания массива
lengthstr, sizet: integer; //размер текста
str: string; //переменная для временного хранения строки
tmpn1,tmpn2:Integer; //Переменные для временного хранения элементов массивов
tmp1,tmp2: char; //переменные для определения порядка хода символов ключа
mass: array[1..500] of integer; //массив, определяющий порядок хода символов ключа
mass2: array[1..500] of integer; //массив, определяющий порядок вывода символов в текстовый файл
tmp: char; //Временная переменная
lengthkey: integer;
mass3: array[1..500] of Char; //переменная для определения наличия символов другого языка в ключе
mass4: array[1..500] of Char;
Textstr:String;
mass5: array[1..500] of string;
begin
j:=1;
//Определение вхождения в ключ символов другого языка
lengthkey:=0;
For i:=1 to length(key) do
begin
if key[i] in alf then
begin
lengthkey:=lengthkey+1;
mass3[j]:=key[i];
inc(j);
end;
end;
//Если ключ содержит символ другого языка, то вывод сообщения об этом, иначе дальнейшее выполнение программы
if lengthkey=0 then
begin
Encrypter.ErrorText.Lines.Add('Ключ содержит только символы не входящие в английский язык!');
AssignFile(File2,'Decr-Encr.txt');
Textstr:='';
lengthstr:=0;
for i:=0 to encrypter.PlainTextForEncr.Lines.Count do
begin
str:=Encrypter.PlainTextForEncr.Lines[i];
for j:=1 to length(Str) do
begin
if (str[j] in alf) then
begin
lengthstr:=lengthstr+1;
end;
end;
Textstr:=Textstr+str;
end;
rewrite(file2);
if lengthstr>0 then
begin
lengthstr:=1;
While length(textstr)>=lengthstr do
begin
if Textstr[lengthstr] in alf then
begin
write(file2,UpCase(Textstr[lengthstr]));
lengthstr:=lengthstr+1;
end
else
begin
lengthstr:=lengthstr+1;
end;
end;
end
else
begin
rewrite(file2);
end;
reset(file2);
readln(file2,str);
Encrypter.ResultText.Lines.Add(str);
closefile(file2);
end
else
begin //Шифрование
AssignFile(File2,'Decr-Encr.txt');
j:=lengthkey;
//Определение количества символов нужного тязыка, входящих в текст
lengthstr:=0;
textstr:='';
for i:=0 to Encrypter.PlainTextForEncr.Lines.Count do
begin
str:=encrypter.PlainTextForEncr.Lines[i];
for j := 1 to length(str) do
begin
if str[j] in alf then
begin
lengthstr:=Lengthstr+1;
end;
end;
textstr:=textstr+str;
end;
//Если нужных символов нет вывод сообщения, иначе - дальнейшее выполнение программы
if lengthstr=0 then
begin
Encrypter.ErrorText.Lines.Add('Текстовое поле пусто или содержит только символы не принадлежащие английскому языку');
rewrite(File2);
closeFile(file2);
end
else
begin
sizet:=lengthstr;
j:=lengthkey;
//Определение количества строк в матрице шифрования
k:=lengthstr/j;
if k-trunc(k)<>0 then
begin
x:=trunc(k)+1;
end
else
begin
x:=trunc(k);
end;
col:=j;
row:=x;
lengthstr:=1;
//Заполнение матрицы для шифрования
for i := 1 to row do
begin
for j := 1 to col do
begin
if (lengthstr>length(Textstr)) then
begin
matr[i][j]:=' ';
lengthstr:=lengthstr+1;
end
else
begin
if Textstr[lengthstr] in alf then
begin
matr[i][j]:=Upcase(Textstr[lengthstr]);
lengthstr:=lengthstr+1;
end
else
begin
repeat
lengthstr:=lengthstr+1;
until
(Textstr[lengthstr] in alf) or (Lengthstr>Length(TextStr));
if Lengthstr<=length(Textstr) then
begin
matr[i,j]:=Upcase(Textstr[lengthstr]);
lengthstr:=lengthstr+1;
end;
end;
end;
end;
end;
//Определение порядка хода символов в ключе
tmp1:='A';
tmp2:='a';
x:=1;
for i := 1 to 26 do
begin
for j := 1 to lengthkey do
begin
if (mass3[j]=tmp1) or (mass3[j]=tmp2) then
begin
mass2[j]:=x;
inc(x);
end;
end;
tmp1:=succ(tmp1);
tmp2:=succ(tmp2);
end;
for i := 1 to lengthkey do
begin
mass[i]:=i;
end;
//Сортировка массивов, для определения порядка следования при выводе зашифрованного текста
for i := 1 to lengthkey-1 do
begin
min:=i;
for j := i+1 to lengthkey do
begin
if mass2[min]>mass2[j] then
begin
min:=j;
end;
end;
tmpn1:=mass2[i];
mass2[i]:=mass2[min];
mass2[min]:=tmpn1;
tmpn2:=mass[min];
mass[min]:=mass[i];
mass[i]:=tmpn2;
end;
//Запись в файл шифротектса
Rewrite(File2);
for i := 1 to col do
begin
for j := 1 to row do
begin
write(File2,matr[j][mass[i]]);
end;
end;
Reset(File2);
Readln(File2,Str);
Close(File2);
Encrypter.ResultText.Lines.Add(str);
end;
end;
end;
//Процедура для шифрования и дешифрования текста столбцовым методом
Procedure ColEncr(const key: String);
var
matr: array[1..500,1..500] of String; //матрица для шифрования(расшифрования) текста
i,j,x,col,row:integer; //Счётчики цикла
File1,File2:Text; //Текстовый файлы
k: real; //переменная для определения числа строк матрицы
min:integer; //перменная для упорядочивания массива
lengthstr, sizet: integer; //размер текста
str: string; //переменная для временного хранения строки
tmpn1,tmpn2:Integer; //Переменные для временного хранения элементов массивов
tmp1,tmp2: char; //переменные для определения порядка хода символов ключа
mass: array[1..500] of integer; //массив, определяющий порядок хода символов ключа
mass2: array[1..500] of integer; //массив, определяющий порядок вывода символов в текстовый файл
tmp: char; //Временная переменная
lengthkey: integer;
mass3: array[1..500] of Char;
Textstr2:String; //переменная для определения наличия символов другого языка в ключе
begin
j:=1;
//Определение вхождения в ключ символов другого языка
lengthkey:=0;
For i:=1 to length(key) do
begin
if key[i] in alf then
begin
lengthkey:=lengthkey+1;
mass3[j]:=key[i];
inc(j);
end;
end;
//Если ключ содержит символ другого языка, то вывод сообщения об этом, иначе дальнейшее выполнение программы
if lengthkey=0 then
begin
Encrypter.ErrorText.Lines.Add('Ключ содержит только символы не входящие в английский язык!');
AssignFile(File1,'Encr.txt');
AssignFile(File2,'Decr-Encr.txt');
Reset(File1);
TextStr2:='';
//Определение количества символов нужного тязыка, входящих в текст
lengthstr:=0;
while not Eof(File1) do
begin
readln(File1,str);
for i := 1 to length(str) do
begin
if str[i] in alf then
begin
lengthstr:=Lengthstr+1;
end;
end;
TextStr2:=Textstr2+str;
end;
rewrite(file2);
if lengthstr>0 then
begin
lengthstr:=1;
while length(textstr2)>=lengthstr do
begin
if Textstr2[lengthstr] in alf then
begin
write(file2,UpCase(Textstr2[lengthstr]));
lengthstr:=lengthstr+1;
end
else
begin
lengthstr:=lengthstr+1;
end;
end;
end
else
begin
rewrite(file2);
end;
reset(file2);
readln(file2,str);
Encrypter.ResultText.Lines.Add(str);
closefile(file2);
Closefile(file1);
end
else
begin
AssignFile(File1,'Encr.txt');
AssignFile(File2,'Decr-Encr.txt');
Reset(File1);
j:=lengthkey;
TextStr2:='';
//Определение количества символов нужного тязыка, входящих в текст
lengthstr:=0;
while not Eof(File1) do
begin
readln(File1,str);
for i := 1 to length(str) do
begin
if str[i] in alf then
begin
lengthstr:=Lengthstr+1;
end;
end;
TextStr2:=Textstr2+str;
end;
//Если нужных символов нет вывод сообщения, иначе - дальнейшее выполнение программы
if lengthstr=0 then
begin
Encrypter.ErrorText.Lines.Add('Файл с текстом пуст или содержит только символы не принадлежащие английскому языку');
Rewrite(file2);
Closefile(file2);
end
else
begin
sizet:=lengthstr;
//Определение количества строк в матрице шифрования
k:=lengthstr/j;
if k-trunc(k)<>0 then
begin
x:=trunc(k)+1;
end
else
begin
x:=trunc(k);
end;
col:=j;
row:=x;
lengthstr:=1;
x:=0;
//Заполнение матрицы для шифрования
for i := 1 to row do
begin
for j := 1 to col do
begin
if x>sizet then
begin
matr[i][j]:=' ';
lengthstr:=lengthstr+1;
x:=x+1;
end
else
begin
if TextStr2[lengthstr] in alf then
begin
matr[i][j]:=UpCase(Textstr2[lengthstr]);
lengthstr:=lengthstr+1;
x:=x+1;
end
else
begin
repeat
lengthstr:=lengthstr+1;
until
(Textstr2[lengthstr] in alf) or (Lengthstr>Length(TextStr2));
if Lengthstr<=Length(Textstr2) then
begin
matr[i,j]:=UpCase(Textstr2[lengthstr]);
lengthstr:=lengthstr+1;
x:=x+1;
end
else
begin
matr[i][j]:=' ';
lengthstr:=lengthstr+1;
x:=x+1;
end;
end;
end;
end;
end;
//Определение порядка хода символов в ключе
tmp1:='A';
tmp2:='a';
x:=1;
for i := 1 to 26 do
begin
for j := 1 to lengthkey do
begin
if (mass3[j]=tmp1) or (mass3[j]=tmp2) then
begin
mass2[j]:=x;
inc(x);
end;
end;
tmp1:=succ(tmp1);
tmp2:=succ(tmp2);
end;
for i := 1 to lengthkey do
begin
mass[i]:=i;
end;
//Сортировка массивов, для определения порядка следования при выводе зашифрованного текста
for i := 1 to lengthkey-1 do
begin
min:=i;
for j := i+1 to lengthkey do
begin
if mass2[min]>mass2[j] then
begin
min:=j;
end;
end;
tmpn1:=mass2[i];
mass2[i]:=mass2[min];
mass2[min]:=tmpn1;
tmpn2:=mass[min];
mass[min]:=mass[i];
mass[i]:=tmpn2;
end;
//Запись в файл шифротектса
Rewrite(File2);
for i := 1 to col do
begin
for j := 1 to row do
begin
write(File2,matr[j][mass[i]]);
end;
end;
Reset(File2);
Readln(File2,Str);
Close(File2);
Encrypter.ResultText.Lines.Add(str);
Close(File1);
end;
end;
end;
//Процедура для шифрования и дешифрования текста столбцовым методом
Procedure ColEncr4(const key: String);
var
matr: array[1..500,1..500] of String; //матрица для шифрования(расшифрования) текста
i,j,x,col,row:integer; //Счётчики цикла
File1,File2:Text; //Текстовый файлы
k: real; //переменная для определения числа строк матрицы
min:integer; //перменная для упорядочивания массива
lengthstr, sizet: integer; //размер текста
str: string; //переменная для временного хранения строки
tmpn1,tmpn2:Integer; //Переменные для временного хранения элементов массивов
tmp1,tmp2: char; //переменные для определения порядка хода символов ключа
mass: array[1..500] of integer; //массив, определяющий порядок хода символов ключа
mass2: array[1..500] of integer; //массив, определяющий порядок вывода символов в текстовый файл
tmp: char; //Временная переменная
lengthkey: integer;
mass3: array[1..500] of Char; //переменная для определения наличия символов другого языка в ключе
Textstr2: String;
begin
j:=1;
//Определение вхождения в ключ символов другого языка
lengthkey:=0;
For i:=1 to length(key) do
begin
if key[i] in alf then
begin
lengthkey:=lengthkey+1;
mass3[j]:=key[i];
inc(j);
end;
end;
//Если ключ содержит символ другого языка, то вывод сообщения об этом, иначе дальнейшее выполнение программы
if lengthkey=0 then
begin
Encrypter.ErrorText.Lines.Add('Ключ содержит только символы не входящие в английский язык!');
AssignFile(File1,'Decr-Encr.txt');
assignFile(File2,'Encr-Decr.txt');
Textstr2:='';
//Определение количества символов, пригодных для расшифровки
Reset(File1);
lengthstr:=0;
while not Eof(File1) do
begin
readln(File1,str);
for i := 1 to length(str) do
begin
if (str[i] in alf) then
begin
lengthstr:=Lengthstr+1;
end;
end;
Textstr2:=textstr2+str;
end;
rewrite(file2);
if lengthstr>0 then
begin
lengthstr:=1;
while length(textstr2)>=lengthstr do
begin
if Textstr2[lengthstr] in alf then
begin
write(file2,UpCase(Textstr2[lengthstr]));
lengthstr:=lengthstr+1;
end
else
begin
lengthstr:=lengthstr+1;
end;
end;
end
else
begin
rewrite(file2);
end;
reset(file2);
readln(file2,str);
Encrypter.ResultText.Lines.Add(str);
closefile(file2);
Closefile(file1);
end
else
begin
AssignFile(File1,'Decr-Encr.txt');
assignFile(File2,'Encr-Decr.txt');
Textstr2:='';
//Определение количества символов, пригодных для расшифровки
Reset(File1);
lengthstr:=0;
while not Eof(File1) do
begin
readln(File1,str);
for i := 1 to length(str) do
begin
if (str[i] in alf) or (str[i]=' ') then
begin
lengthstr:=Lengthstr+1;
end;
end;
Textstr2:=textstr2+str;
end;
//Если нет символов данного языка в файле, то вывод сообщения об этом, иначе - дальнешее выполнение программы
If lengthstr=0 then
begin
Encrypter.ErrorText.Lines.Add('Файл с текстом пуст или содержит только символы не принадлежащие английскому языку');
Rewrite(file2);
CloseFile(File2);
end
else
begin
//Определение порядка следования символов в ключе
tmp1:='A';
tmp2:='a';
x:=1;
for i := 1 to 26 do
begin
for j := 1 to lengthkey do
begin
if (mass3[j]=tmp1) or (mass3[j]=tmp2) then
begin
mass2[j]:=x;
inc(x);
end;
end;
tmp1:=succ(tmp1);
tmp2:=succ(tmp2);
end;
for i := 1 to lengthkey do
begin
mass[i]:=i;
end;
// Сортировка массивов для определения последовательности заполнения матрицы для расшифровки
for i := 1 to lengthkey-1 do
begin
min:=i;
for j := i+1 to lengthkey do
begin
if mass2[min]>mass2[j] then
begin
min:=j;
end;
end;
tmpn1:=mass2[i];
mass2[i]:=mass2[min];
mass2[min]:=tmpn1;
tmpn2:=mass[min];
mass[min]:=mass[i];
mass[i]:=tmpn2;
end;
//Определение кол-ва строк в матрице
j:=lengthkey;
k:=lengthstr/j;
if k-trunc(k)<>0 then
begin
x:=trunc(k)+1;
end
else
begin
x:=trunc(k);
end;
col:=j;
row:=x;
//Заполнение матрицы для расшифровки
x:=0;
lengthstr:=1;
for i := 1 to col do
begin
for j := 1 to row do
begin
if Textstr2[lengthstr] in alf then
begin
matr[j][mass[i]]:=UpCase(Textstr2[lengthstr]);
lengthstr:=lengthstr+1;
x:=x+1;
end
else
begin
if Textstr2[lengthstr]=' ' then
begin
matr[j][mass[i]]:='';
lengthstr:=lengthstr+1;
x:=x+1;
end
else
begin
repeat
lengthstr:=lengthstr+1;
until
(Textstr2[lengthstr] in alf) or (lengthstr>length(textstr2));
If lengthstr<=length(textstr2) then
begin
matr[j][mass[i]]:=UpCase(textstr2[lengthstr]);
lengthstr:=lengthstr+1;
x:=x+1;
end;
end;
end;
end;
end;
//Вывод Расшифрованного текста в текстовый файл
Rewrite(File2);
for i := 1 to row do
begin
for j := 1 to col do
begin
write(File2,matr[i][j]);
end;
end;
Reset(File2);
Readln(File2,Str);
Encrypter.ResultText.Lines.Add(str);
CloseFile(File2);
end;
CloseFile(File1);
end;
end;
//Процедура шифрования методом поворачивающейся решётки
Procedure TurnGrid(const key: String);
var
a: Matrix; //Матрица 4х4
str: String; //Переменная для временного хранения строки
i,j,k,num,x, lengthstr, num2: integer; //Счётчики цикла
File1,file2: Text; //Текстовый файлы
mass: array[1..10000] of String; //Массив для хранения символов шифротекста
mass2: array[1..10000] of String; //Массив для хранения символов расшифрованного текста
size: Integer; //размер текста
Bykva: Char; //Переменная для содержания символа английского алфавита
ost, dop: Integer;
Textstr2: String; //Переменные для хранения остатка от целочисленного деления и цифры, необходимой для выполнения цикла
begin
AssignFile(File1,'Encr2.txt');
AssignFile(File2,'Decr-Encr2.txt');
//Определение количества нужных символов, входимых в текст
Reset(File1);
lengthstr:=0;
textstr2:='';
while not Eof(File1) do
begin
readln(File1,str);
for i := 1 to length(str) do
begin
if str[i] in alf then
begin
lengthstr:=Lengthstr+1;
end;
end;
TextStr2:=Textstr2+str;
end;
//Если нужных символов нет, то вывести сообщение, иначе - дальнейшее выполнение программы
if lengthstr=0 then
begin
Encrypter.ErrorText.Lines.Add('Файл с текстом пуст или содержит только символы не принадлежащие английскому языку');
rewrite(file2);
closefile(file2);
end
else
begin
size:= lengthstr;
//заполнение массива символами текста
x:=0;
lengthstr:=1;
for i := 1 to size do
begin
if textstr2[lengthstr] in alf then
begin
mass[i]:=UpCase(textstr2[lengthstr]);
lengthstr:=lengthstr+1;
x:=x+1;
end
else
begin
repeat
lengthstr:=lengthstr+1;
until
Textstr2[lengthstr] in alf;
mass[i]:=UpCase(Textstr2[lengthstr]);
lengthstr:=lengthstr+1;
x:=x+1;
end;
end;
Rewrite(File2);
//Определение дополнительного слагаемого
ost:=size mod 16;
if ost<>0 then
begin
dop:=16-ost;
end
else
begin
dop:=0;
end;
//Шифрование методом поворачивающейся решётки
num:=1;
Bykva:='A';
while num<size+dop do
begin
k:=0;
while k<>4 do
begin
for i := 1 to n do
begin
for j := 1 to n do
begin
if mask[i,j]='x' then
begin
if num<=size then
begin
a[i,j]:=mass[num];
num:=num+1;
end
else
begin
a[i,j]:=Bykva;
Bykva:=Succ(Bykva);
num:=num+1;
end;
end;
end;
end;
Povorot(mask);
k:=k+1;
end;
//Вывод шифротекста в файл
for i := 1 to n do
begin
for j := 1 to n do
begin
write(File2,a[i][j]);
end;
end;
end;
Reset(File2);
Readln(File2,Str);
Encrypter.ResultText.Lines.Add(str);
CloseFile(file2);
CloseFile(file1);
end;
end;
//Процедура шифрования методом поворачивающейся решётки
Procedure TurnGrid4(const key: String);
var
a: Matrix; //Матрица 4х4
str: String; //Переменная для временного хранения строки
i,j,k,num,x, lengthstr, num2: integer; //Счётчики цикла
File1,file2: Text; //Текстовый файлы
mass: array[1..10000] of String; //Массив для хранения символов шифротекста
mass2: array[1..10000] of String; //Массив для хранения символов расшифрованного текста
size: Integer; //размер текста
Bykva: Char; //Переменная для содержания символа английского алфавита
ost, dop: Integer;
textstr2: String; //Переменные для хранения остатка от целочисленного деления и цифры, необходимой для выполнения цикла
begin
AssignFile(File1,'Decr-Encr2.txt');
AssignFile(File2,'Encr-Decr2.txt');
Reset(File1);
//Определение кол-ва подходящих символов, использующихся в кодировке
textstr2:='';
lengthstr:=0;
while not Eof(File1) do
begin
readln(File1,str);
for i := 1 to length(str) do
begin
if str[i] in alf then
begin
lengthstr:=Lengthstr+1;
end;
end;
Textstr2:=textstr2+str;
end;
//Если символов для кодировки нет, вывести сообщение об этом, иначе - дальнейшее выполнение программы
if lengthstr=0 then
begin
Encrypter.ErrorText.Lines.Add('Файл с текстом пуст или содержит только символы не принадлежащие английскому языку');
rewrite(file2);
closeFile(file2);
end
else
begin
size:= lengthstr;
//заполнение массива символами шифротекста
lengthstr:=1;
for i := 1 to size do
begin
if Textstr2[lengthstr] in alf then
begin
mass[i]:=UpCase(Textstr2[lengthstr]);
lengthstr:=lengthstr+1;
end
else
begin
repeat
lengthstr:=lengthstr+1;
until
Textstr2[lengthstr] in alf;
mass[i]:=UpCase(Textstr2[lengthstr]);
lengthstr:=lengthstr+1;
end;
end;
//расшифровка текста
num:=1;
num2:=1;
while num<size do
begin
for i:=1 to n do
begin
for j:=1 to n do
begin
a[i,j]:=mass[num];
num:=num+1;
end;
end;
k:=0;
while k<>4 do
begin
for i:=1 to n do
begin
for j:=1 to n do
begin
if mask[i,j]='x' then
begin
mass2[num2]:=a[i,j];
inc(num2);
end;
end;
end;
Povorot(mask);
inc(k);
end;
end;
//Вывод полученного текста в файл
Rewrite(File2);
for i:=1 to num2 do
begin
Write(File2,mass2[i]);
end;
Reset(File2);
Readln(File2,Str);
Encrypter.ResultText.Lines.Add(str);
CloseFile(File2);
CloseFile(file1);
end;
end;
//Процедура шифрования методом поворачивающейся решётки
Procedure TurnGrid3(const key: String);
var
a: Matrix; //Матрица 4х4
str: String; //Переменная для временного хранения строки
i,j,k,num,x, lengthstr, num2: integer; //Счётчики цикла
File1,file2: Text; //Текстовый файлы
mass: array[1..10000] of String; //Массив для хранения символов шифротекста
mass2: array[1..10000] of String; //Массив для хранения символов расшифрованного текста
size: Integer; //размер текста
Bykva: Char; //Переменная для содержания символа английского алфавита
ost, dop: Integer; //Переменные для хранения остатка от целочисленного деления и цифры, необходимой для выполнения цикла
textstr: String;
begin
AssignFile(File2,'Encr-Decr2.txt');
Textstr:='';
lengthstr:=0;
//Определение кол-ва подходящих символов, использующихся в кодировке
For i:= 0 to Encrypter.PlainTextForEncr.Lines.Count do
begin
str:=Encrypter.PlainTextForEncr.Lines[i];
for j := 1 to length(str) do
begin
if str[j] in alf then
begin
lengthstr:=Lengthstr+1;
end;
end;
Textstr:=textstr+str;
end;
//Если символов для кодировки нет, вывести сообщение об этом, иначе - дальнейшее выполнение программы
if lengthstr=0 then
begin
Encrypter.ErrorText.Lines.Add('Текстовое поле пусто или содержит только символы не принадлежащие английскому языку');
rewrite(file2);
closefile(file2);
end
else
begin
size:= lengthstr;
j:=1;
lengthstr:=0;
//заполнение массива символами шифротекста
for i := 1 to length(TextStr) do
begin
if Textstr[lengthstr] in alf then
begin
mass[j]:=UpCase(Textstr[lengthstr]);
lengthstr:=lengthstr+1;
j:=j+1;
end
else
begin
repeat
lengthstr:=lengthstr+1;
until
Textstr[lengthstr] in alf;
mass[j]:=UpCase(Textstr[lengthstr]);
lengthstr:=lengthstr+1;
j:=j+1;
end;
end;
//расшифровка текста
num:=1;
num2:=1;
while num<size do
begin
for i:=1 to n do
begin
for j:=1 to n do
begin
a[i,j]:=mass[num];
num:=num+1;
end;
end;
k:=0;
while k<>4 do
begin
for i:=1 to n do
begin
for j:=1 to n do
begin
if mask[i,j]='x' then
begin
mass2[num2]:=a[i,j];
inc(num2);
end;
end;
end;
Povorot(mask);
inc(k);
end;
end;
//Вывод полученного текста в файл
Rewrite(File2);
for i:=1 to num2 do
begin
Write(File2,mass2[i]);
end;
Reset(File2);
Readln(File2,Str);
Encrypter.ResultText.Lines.Add(str);
CloseFile(File2);
end;
end;
//Процедура шифрования методом поворачивающейся решётки
Procedure TurnGrid2(const key: String);
var
a: Matrix; //Матрица 4х4
str: String; //Переменная для временного хранения строки
i,j,k,num,x, lengthstr, num2: integer; //Счётчики цикла
File1,file2: Text; //Текстовый файлы
mass: array[1..10000] of String; //Массив для хранения символов шифротекста
mass2: array[1..10000] of String; //Массив для хранения символов расшифрованного текста
size: Integer; //размер текста
Bykva: Char; //Переменная для содержания символа английского алфавита
ost, dop: Integer;
Textstr: String; //Переменные для хранения остатка от целочисленного деления и цифры, необходимой для выполнения цикла
begin
AssignFile(File2,'Decr-Encr2.txt');
//Определение количества нужных символов, входимых в текст
Textstr:='';
lengthstr:=0;
for i:= 0 to Encrypter.PlainTextForEncr.Lines.Count do
begin
str:=Encrypter.PlainTextForEncr.Lines[i];
for j := 1 to length(str) do
begin
if str[j] in alf then
begin
lengthstr:=Lengthstr+1;
end;
end;
Textstr:=textstr+str;
end;
//Если нужных символов нет, то вывести сообщение, иначе - дальнейшее выполнение программы
if lengthstr=0 then
begin
Encrypter.ErrorText.Lines.Add('Текстовое поле пусто или содержит только символы не принадлежащие английскому языку');
Rewrite(file2);
Closefile(file2);
end
else
begin
size:= lengthstr;
Lengthstr:= 1;
j:=1;
//заполнение массива символами текста
for i := 1 to length(Textstr) do
begin
if Textstr[lengthstr] in alf then
begin
mass[j]:=UpCase(textstr[lengthstr]);
lengthstr:=lengthstr+1;
j:=j+1;
end
else
begin
repeat
lengthstr:=lengthstr+1;
until
textstr[lengthstr] in alf;
mass[j]:=UpCase(textstr[lengthstr]);
lengthstr:=lengthstr+1;
j:=j+1;
end;
end;
Rewrite(File2);
//Определение дополнительного слагаемого
ost:=size mod 16;
if ost<>0 then
begin
dop:=16-ost;
end
else
begin
dop:=0;
end;
//Шифрование методом поворачивающейся решётки
num:=1;
Bykva:='A';
while num<size+dop do
begin
k:=0;
while k<>4 do
begin
for i := 1 to n do
begin
for j := 1 to n do
begin
if mask[i,j]='x' then
begin
if num<=size then
begin
a[i,j]:=mass[num];
num:=num+1;
end
else
begin
a[i,j]:=Bykva;
Bykva:=Succ(Bykva);
num:=num+1;
end;
end;
end;
end;
Povorot(mask);
k:=k+1;
end;
//Вывод шифротекста в файл
for i := 1 to n do
begin
for j := 1 to n do
begin
write(File2,a[i][j]);
end;
end;
end;
Reset(File2);
Readln(File2,Str);
Encrypter.ResultText.Lines.Add(str);
CloseFile(file2);
end;
end;
//Процедура шифрования методом шифра Виженера
Procedure VigChiper(const key: String);
var
str: String; //Переменная, для временного хранения строки
i,j,k,lengthstr: integer; //переменные цикла
File1,File2: Text; //Текстовые файлы
mass: array[1..3,1..10000] of Char; //Матрица для хранения символов исходного текста, символов ключа, а также символов шифротекста
mass2: array[1..33] of Char; //Массив, содержащий символы маленьких русских букв
mass3: array[1..33] of Char;
mass4: array[1..10000] of Char; //Массив содержащий символы больших русских букв
size,Lengthkey: Integer; //Размер текста
x: char; //Переменная для цикла
tmp, tmp1, tmp2: integer;
textstr2: String; //Индексы символов, используемые в формуле для шифрования и дешифрования //Переменная для опредения наличия символов другого языка в ключе
begin
j:=1;
//Определение вхождения в ключ символов другого языка
lengthkey:=0;
For i:=1 to length(key) do
begin
if key[i] in alf2 then
begin
lengthkey:=lengthkey+1;
mass4[j]:=key[i];
inc(j);
end;
end;
//Заполнение массива маленткими символами русского алфавита
x:='а';
for i:= 1 to 33 do
begin
if i=7 then
begin
mass2[i]:='ё';
end
else
begin
mass2[i]:=x;
x:=succ(x);
end;
end;
//Заполнение массив большими символами русского алфавита
x:='А';
for i:= 1 to 33 do
begin
if i=7 then
begin
mass3[i]:='Ё';
end
else
begin
mass3[i]:=x;
x:=succ(x);
end;
end;
//Если символы другого языка есть в ключе, вывести сообщение об этом, иначе - дальнейшее выполнение программы
if lengthkey=0 then
begin
Encrypter.ErrorText.Lines.Add('Ключ содержит только символы не входящие в русский язык!');
AssignFile(File1,'Encr3.txt');
AssignFile(File2,'Decr-Encr3.txt');
//Определение количества символов использующихся в шифрование
Reset(File1);
lengthstr:=0;
Textstr2:='';
while not Eof(File1) do
begin
readln(File1,str);
for i := 1 to length(str) do
begin
if str[i] in alf2 then
begin
lengthstr:=Lengthstr+1;
end;
end;
Textstr2:=textstr2+str;
end;
rewrite(file2);
if lengthstr>0 then
begin
lengthstr:=1;
while length(textstr2)>=lengthstr do
begin
if Textstr2[lengthstr] in alf2 then
begin
if Textstr2[lengthstr] in max then
begin
for i:=1 to 33 do
begin
if mass3[i]=Textstr2[lengthstr] then
begin
j:=i;
end;
end;
end
else
begin
for i:=1 to 33 do
begin
if mass2[i]=Textstr2[lengthstr] then
begin
j:=i;
end;
end;
end;
write(file2,mass3[j]);
lengthstr:=lengthstr+1;
end
else
begin
lengthstr:=lengthstr+1;
end;
end;
end
else
begin
rewrite(file2);
end;
reset(file2);
readln(file2,str);
Encrypter.ResultText.Lines.Add(str);
closefile(file2);
Closefile(file1);
end
else
begin
AssignFile(File1,'Encr3.txt');
AssignFile(File2,'Decr-Encr3.txt');
//Определение количества символов использующихся в шифрование
Reset(File1);
lengthstr:=0;
Textstr2:='';
while not Eof(File1) do
begin
readln(File1,str);
for i := 1 to length(str) do
begin
if str[i] in alf2 then
begin
lengthstr:=Lengthstr+1;
end;
end;
Textstr2:=textstr2+str;
end;
//Если символов, пригодных для шифрования нет, то вывести сообщение об этом, иначе - дальнейшее выполнение программы
if lengthstr=0 then
begin
Encrypter.ErrorText.Lines.Add('Файл с текстом пуст или содержит только символы не принадлежащие русскому языку');
Rewrite(file2);
Closefile(file2);
end
else
begin
size:= lengthstr;
//Заполненеи матрицы символами исходного текста
lengthstr:=1;
for i := 1 to size do
begin
if Textstr2[lengthstr] in alf2 then
begin
mass[1,i]:=UpCase(Textstr2[lengthstr]);
lengthstr:=lengthstr+1;
end
else
begin
repeat
lengthstr:=lengthstr+1;
until
Textstr2[lengthstr] in alf2;
mass[1,i]:=UpCase(Textstr2[lengthstr]);
lengthstr:=lengthstr+1;
end;
end;
//Дополнение матрицы символами самогенерирующегося ключа
j:=1;
for i := 1 to size do
begin
if lengthkey>=i then
begin
mass[2][i]:=mass4[i];
end
else
begin
mass[2][i]:=mass[1][j];
j:=j+1;
end;
end;
//Шифрование текста
for i:=1 to size do
begin
if mass[1][i] in max then
begin
for j:=1 to 33 do
begin
if mass3[j]=mass[1][i] then
begin
tmp1:=j;
end;
end;
end
else
begin
for j:=1 to 33 do
begin
if mass2[j]=mass[1][i] then
begin
tmp1:=j;
end;
end;
end;
if mass[2][i] in max then
begin
for j:=1 to 33 do
begin
if mass3[j]=mass[2][i] then
begin
tmp2:=j;
end;
end;
end
else
begin
for j:=1 to 33 do
begin
if mass2[j]=mass[2][i] then
begin
tmp2:=j;
end;
end;
end;
tmp:=(tmp1+tmp2-1) mod 33;
if tmp=0 then
begin
tmp:=33;
end;
if mass[1][i] in max then
begin
mass[3][i]:=mass3[tmp];
end
else
begin
mass[3][i]:=mass3[tmp];
end;
end;
//Вывод символов шифротекста в файл
Rewrite(File2);
for i:= 1 to size do
begin
write(File2,UpCase(mass[3][i]));
end;
Reset(File2);
Readln(File2,Str);
Encrypter.ResultText.Lines.Add(str);
CloseFile(File2);
CloseFile(file1);
end;
end;
end;
//Процедура шифрования методом шифра Виженера
Procedure VigChiper2(const key: String);
var
str: String; //Переменная, для временного хранения строки
i,j,k,lengthstr: integer; //переменные цикла
File1,File2: Text; //Текстовые файлы
mass: array[1..3,1..10000] of Char; //Матрица для хранения символов исходного текста, символов ключа, а также символов шифротекста
mass2: array[1..33] of Char; //Массив, содержащий символы маленьких русских букв
mass3: array[1..33] of Char;
mass4: array[1..10000] of Char; //Массив содержащий символы больших русских букв
size,Lengthkey: Integer; //Размер текста
x: char; //Переменная для цикла
tmp, tmp1, tmp2: integer; //Индексы символов, используемые в формуле для шифрования и дешифрования //Переменная для опредения наличия символов другого языка в ключе
Textstr:String;
begin
j:=1;
//Определение вхождения в ключ символов другого языка
lengthkey:=0;
For i:=1 to length(key) do
begin
if key[i] in alf2 then
begin
lengthkey:=lengthkey+1;
mass4[j]:=key[i];
inc(j);
end;
end;
//Заполнение массива маленткими символами русского алфавита
x:='а';
for i:= 1 to 33 do
begin
if i=7 then
begin
mass2[i]:='ё';
end
else
begin
mass2[i]:=x;
x:=succ(x);
end;
end;
//Заполнение массив большими символами русского алфавита
x:='А';
for i:= 1 to 33 do
begin
if i=7 then
begin
mass3[i]:='Ё';
end
else
begin
mass3[i]:=x;
x:=succ(x);
end;
end;
//Если символы другого языка есть в ключе, вывести сообщение об этом, иначе - дальнейшее выполнение программы
if lengthkey=0 then
begin
Encrypter.ErrorText.Lines.Add('Ключ содержит только символы не входящие в русский язык!');
AssignFile(File2,'Decr-Encr3.txt');
lengthstr:=0;
Textstr:='';
//Определение количества символов использующихся в шифрование
For i:=0 to Encrypter.PlainTextForEncr.Lines.Count do
begin
str:=Encrypter.PlainTextForEncr.Lines[i];
for j := 1 to length(str) do
begin
if str[j] in alf2 then
begin
lengthstr:=Lengthstr+1;
end;
end;
Textstr:=textstr+str;
end;
rewrite(file2);
if lengthstr>0 then
begin
lengthstr:=1;
while length(textstr)>=lengthstr do
begin
if Textstr[lengthstr] in alf2 then
begin
if Textstr[lengthstr] in max then
begin
for i:=1 to 33 do
begin
if mass3[i]=Textstr[lengthstr] then
begin
j:=i;
end;
end;
end
else
begin
for i:=1 to 33 do
begin
if mass2[i]=Textstr[lengthstr] then
begin
j:=i;
end;
end;
end;
write(file2,mass3[j]);
lengthstr:=lengthstr+1;
end
else
begin
lengthstr:=lengthstr+1;
end;
end;
end
else
begin
rewrite(file2);
end;
reset(file2);
readln(file2,str);
Encrypter.ResultText.Lines.Add(str);
closefile(file2);
end
else
begin
AssignFile(File2,'Decr-Encr3.txt');
lengthstr:=0;
Textstr:='';
//Определение количества символов использующихся в шифрование
For i:=0 to Encrypter.PlainTextForEncr.Lines.Count do
begin
str:=Encrypter.PlainTextForEncr.Lines[i];
for j := 1 to length(str) do
begin
if str[j] in alf2 then
begin
lengthstr:=Lengthstr+1;
end;
end;
Textstr:=textstr+str;
end;
//Если символов, пригодных для шифрования нет, то вывести сообщение об этом, иначе - дальнейшее выполнение программы
if lengthstr=0 then
begin
Encrypter.ErrorText.Lines.Add('Текстовое поле пусто или содержит только символы не принадлежащие русскому языку');
Rewrite(file2);
Closefile(file2);
end
else
begin
size:= lengthstr;
//Заполненеи матрицы символами исходного текста
lengthstr:=1;
j:=1;
for i := 1 to Length(TextStr) do
begin
if Textstr[lengthstr] in alf2 then
begin
mass[1,j]:=UpCase(Textstr[lengthstr]);
j:=j+1;
lengthstr:=lengthstr+1;
end
else
begin
repeat
lengthstr:=lengthstr+1;
until
Textstr[lengthstr] in alf2;
mass[1,j]:=UpCase(Textstr[lengthstr]);
j:=j+1;
lengthstr:=lengthstr+1;
end;
end;
//Дополнение матрицы символами самогенерирующегося ключа
j:=1;
for i := 1 to size do
begin
if lengthkey>=i then
begin
mass[2][i]:=mass4[i];
end
else
begin
mass[2][i]:=mass[1][j];
j:=j+1;
end;
end;
//Шифрование текста
for i:=1 to size do
begin
if mass[1][i] in max then
begin
for j:=1 to 33 do
begin
if mass3[j]=mass[1][i] then
begin
tmp1:=j;
end;
end;
end
else
begin
for j:=1 to 33 do
begin
if mass2[j]=mass[1][i] then
begin
tmp1:=j;
end;
end;
end;
if mass[2][i] in max then
begin
for j:=1 to 33 do
begin
if mass3[j]=mass[2][i] then
begin
tmp2:=j;
end;
end;
end
else
begin
for j:=1 to 33 do
begin
if mass2[j]=mass[2][i] then
begin
tmp2:=j;
end;
end;
end;
tmp:=(tmp1+tmp2-1) mod 33;
if tmp=0 then
begin
tmp:=33;
end;
if mass[1][i] in max then
begin
mass[3][i]:=mass3[tmp];
end
else
begin
mass[3][i]:=mass3[tmp];
end;
end;
//Вывод символов шифротекста в файл
Rewrite(File2);
for i:= 1 to size do
begin
write(File2,UpCase(mass[3][i]));
end;
Reset(File2);
Readln(File2,Str);
Encrypter.ResultText.Lines.Add(str);
CloseFile(File2);
end;
end;
end;
//Процедура шифрования методом шифра Виженера
Procedure VigChiper3(const key: String);
var
str: String; //Переменная, для временного хранения строки
i,j,k,lengthstr: integer; //переменные цикла
File1,File2: Text; //Текстовые файлы
mass: array[1..3,1..10000] of Char; //Матрица для хранения символов исходного текста, символов ключа, а также символов шифротекста
mass2: array[1..33] of Char; //Массив, содержащий символы маленьких русских букв
mass3: array[1..33] of Char;
mass4: array[1..10000] of Char; //Массив содержащий символы больших русских букв
size,Lengthkey: Integer; //Размер текста
x: char; //Переменная для цикла
tmp, tmp1, tmp2: integer; //Индексы символов, используемые в формуле для шифрования и дешифрования //Переменная для опредения наличия символов другого языка в ключе
Textstr:String;
begin
j:=1;
//Определение вхождения в ключ символов другого языка
lengthkey:=0;
For i:=1 to length(key) do
begin
if key[i] in alf2 then
begin
lengthkey:=lengthkey+1;
mass4[j]:=key[i];
inc(j);
end;
end;
//Заполнение массива маленткими символами русского алфавита
x:='а';
for i:= 1 to 33 do
begin
if i=7 then
begin
mass2[i]:='ё';
end
else
begin
mass2[i]:=x;
x:=succ(x);
end;
end;
//Заполнение массив большими символами русского алфавита
x:='А';
for i:= 1 to 33 do
begin
if i=7 then
begin
mass3[i]:='Ё';
end
else
begin
mass3[i]:=x;
x:=succ(x);
end;
end;
//Если символы другого языка есть в ключе, вывести сообщение об этом, иначе - дальнейшее выполнение программы
if lengthkey=0 then
begin
Encrypter.ErrorText.Lines.Add('Ключ содержит только символы не входящие в русский язык!');
AssignFile(File2,'Encr-Decr3.txt');
//??????????? ?????????? ????????, ????????? ??? ??????????
Textstr:='';
lengthstr:=0;
For i:=0 to Encrypter.PlainTextForEncr.Lines.Count do
begin
str:=Encrypter.PlainTextForEncr.Lines[i];
for j := 1 to length(str) do
begin
if str[j] in alf2 then
begin
lengthstr:=Lengthstr+1;
end;
end;
Textstr:=Textstr+str;
end;
rewrite(file2);
if lengthstr>0 then
begin
lengthstr:=1;
while length(textstr)>=lengthstr do
begin
if Textstr[lengthstr] in alf2 then
begin
if Textstr[lengthstr] in max then
begin
for i:=1 to 33 do
begin
if mass3[i]=Textstr[lengthstr] then
begin
j:=i;
end;
end;
end
else
begin
for i:=1 to 33 do
begin
if mass2[i]=Textstr[lengthstr] then
begin
j:=i;
end;
end;
end;
write(file2,mass3[j]);
lengthstr:=lengthstr+1;
end
else
begin
lengthstr:=lengthstr+1;
end;
end;
end
else
begin
rewrite(file2);
end;
reset(file2);
readln(file2,str);
Encrypter.ResultText.Lines.Add(str);
closefile(file2);
end
else
begin
AssignFile(File2,'Encr-Decr3.txt');
//??????????? ?????????? ????????, ????????? ??? ??????????
Textstr:='';
lengthstr:=0;
For i:=0 to Encrypter.PlainTextForEncr.Lines.Count do
begin
str:=Encrypter.PlainTextForEncr.Lines[i];
for j := 1 to length(str) do
begin
if str[j] in alf2 then
begin
lengthstr:=Lengthstr+1;
end;
end;
Textstr:=Textstr+str;
end;
//???? ???????? ?????????? ??? ?????????? ???, ?? ??????? ????????? ?? ????, ????? ?????????? ?????????? ?????????
if lengthstr=0 then
begin
Encrypter.ErrorText.Lines.Add('Текстовое поле пусто или содержит только символы не принадлежащие русскому языку');
Rewrite(File2);
Closefile(file2);
end
else
begin
size:= lengthstr;
//?????????? ??????? ????????? ??????????????? ??????
j:=1;
lengthstr:=1;
for i := 1 to length(TextStr) do
begin
if Textstr[lengthstr] in alf2 then
begin
mass[1,j]:=UpCase(Textstr[lengthstr]);
lengthstr:=lengthstr+1;
j:=j+1;
end
else
begin
repeat
lengthstr:=lengthstr+1;
until
Textstr[lengthstr] in alf2;
mass[1,j]:=UpCase(Textstr[lengthstr]);
j:=j+1;
lengthstr:=lengthstr+1;
end;
end;
//?????????? ??????? ????????? ?????
for i := 1 to lengthkey do
begin
mass[2,i]:=mass4[i];
end;
//??????????? ?????? ? ????????? ??????????? ??????? ????????? ??????????????????? ????? ? ????????? ??????????????? ??????
k:=lengthkey+1;
for i:=1 to size do
begin
if mass[1][i] in max then
begin
for j:=1 to 33 do
begin
if mass3[j]=mass[1][i] then
begin
tmp1:=j;
end;
end;
end
else
begin
for j:=1 to 33 do
begin
if mass2[j]=mass[1][i] then
begin
tmp1:=j;
end;
end;
end;
if mass[2][i] in max then
begin
for j:=1 to 33 do
begin
if mass3[j]=mass[2][i] then
begin
tmp2:=j;
end;
end;
end
else
begin
for j:=1 to 33 do
begin
if mass2[j]=mass[2][i] then
begin
tmp2:=j;
end;
end;
end;
tmp:=(tmp1-tmp2+34)mod 33;
if tmp=0 then
begin
tmp:=33;
end;
if mass[1][i] in max then
begin
mass[3][i]:=mass3[tmp];
mass[2,k]:=mass3[tmp];
k:=k+1;
end
else
begin
mass[3][i]:=mass3[tmp];
mass[2,k]:=mass3[tmp];
k:=k+1;
end;
end;
//????? ??????????????? ?????? ? ????
Rewrite(File2);
for i:= 1 to size do
begin
write(File2,UpCase(mass[3][i]));
end;
Reset(File2);
Readln(File2,Str);
Encrypter.ResultText.Lines.Add(str);
CloseFile(File2);
end;
end;
end;
//Процедура шифрования методом шифра Виженера
Procedure VigChiper4(const key: String);
var
str: String; //Переменная, для временного хранения строки
i,j,k,lengthstr: integer; //переменные цикла
File1,File2: Text; //Текстовые файлы
mass: array[1..3,1..10000] of Char; //Матрица для хранения символов исходного текста, символов ключа, а также символов шифротекста
mass2: array[1..33] of Char; //Массив, содержащий символы маленьких русских букв
mass3: array[1..33] of Char;
mass4: array[1..10000] of Char; //Массив содержащий символы больших русских букв
size,Lengthkey: Integer; //Размер текста
x: char; //Переменная для цикла
tmp, tmp1, tmp2: integer;
Textstr2: String; //Индексы символов, используемые в формуле для шифрования и дешифрования //Переменная для опредения наличия символов другого языка в ключе
begin
j:=1;
//Определение вхождения в ключ символов другого языка
lengthkey:=0;
For i:=1 to length(key) do
begin
if key[i] in alf2 then
begin
lengthkey:=lengthkey+1;
mass4[j]:=key[i];
inc(j);
end;
end;
//Заполнение массива маленткими символами русского алфавита
x:='а';
for i:= 1 to 33 do
begin
if i=7 then
begin
mass2[i]:='ё';
end
else
begin
mass2[i]:=x;
x:=succ(x);
end;
end;
//Заполнение массив большими символами русского алфавита
x:='А';
for i:= 1 to 33 do
begin
if i=7 then
begin
mass3[i]:='Ё';
end
else
begin
mass3[i]:=x;
x:=succ(x);
end;
end;
//Если символы другого языка есть в ключе, вывести сообщение об этом, иначе - дальнейшее выполнение программы
if lengthkey=0 then
begin
Encrypter.ErrorText.Lines.Add('Ключ содержит только символы не входящие в русский язык!');
AssignFile(File1,'Decr-Encr3.txt');
AssignFile(File2,'Encr-Decr3.txt');
//Определение количества символов, пригодных для шифрования
Reset(File1);
Textstr2:='';
lengthstr:=0;
while not Eof(File1) do
begin
readln(File1,str);
for i := 1 to length(str) do
begin
if str[i] in alf2 then
begin
lengthstr:=Lengthstr+1;
end;
end;
Textstr2:=Textstr2+str;
end;
rewrite(file2);
if lengthstr>0 then
begin
lengthstr:=1;
while length(textstr2)>=lengthstr do
begin
if Textstr2[lengthstr] in alf2 then
begin
if Textstr2[lengthstr] in max then
begin
for i:=1 to 33 do
begin
if mass3[i]=Textstr2[lengthstr] then
begin
j:=i;
end;
end;
end
else
begin
for i:=1 to 33 do
begin
if mass2[i]=Textstr2[lengthstr] then
begin
j:=i;
end;
end;
end;
write(file2,mass3[j]);
lengthstr:=lengthstr+1;
end
else
begin
lengthstr:=lengthstr+1;
end;
end;
end
else
begin
rewrite(file2);
end;
reset(file2);
readln(file2,str);
Encrypter.ResultText.Lines.Add(str);
closefile(file2);
Closefile(file1);
end
else
begin
AssignFile(File1,'Decr-Encr3.txt');
AssignFile(File2,'Encr-Decr3.txt');
//Определение количества символов, пригодных для шифрования
Reset(File1);
Textstr2:='';
lengthstr:=0;
while not Eof(File1) do
begin
readln(File1,str);
for i := 1 to length(str) do
begin
if str[i] in alf2 then
begin
lengthstr:=Lengthstr+1;
end;
end;
Textstr2:=Textstr2+str;
end;
//Если символов приигодных для шифрования нет, то вывести сообщение об этом, иначе продолжить выполнение программы
if lengthstr=0 then
begin
Encrypter.ErrorText.Lines.Add('Файл с текстом пуст или содержит только символы не принадлежащие русскому языку');
Rewrite(file2);
Closefile(File2)
end
else
begin
size:= lengthstr;
//Заполнение матрицы символами закодированного текста
lengthstr:=1;
for i := 1 to size do
begin
if Textstr2[lengthstr] in alf2 then
begin
mass[1,i]:=UpCase(Textstr2[lengthstr]);
lengthstr:=lengthstr+1;
end
else
begin
repeat
lengthstr:=lengthstr+1;
until
Textstr2[lengthstr] in alf2;
mass[1,i]:=UpCase(Textstr2[lengthstr]);
lengthstr:=lengthstr+1;
end;
end;
//Дополнение матрицы символами ключа
for i := 1 to lengthkey do
begin
mass[2,i]:=mass4[i];
end;
//Расшифровка текста с далнейшим дополнением матрицы символами самогенерирующегося ключа и символами расшифрованного текста
k:=lengthkey+1;
for i:=1 to size do
begin
if mass[1][i] in max then
begin
for j:=1 to 33 do
begin
if mass3[j]=mass[1][i] then
begin
tmp1:=j;
end;
end;
end
else
begin
for j:=1 to 33 do
begin
if mass2[j]=mass[1][i] then
begin
tmp1:=j;
end;
end;
end;
if mass[2][i] in max then
begin
for j:=1 to 33 do
begin
if mass3[j]=mass[2][i] then
begin
tmp2:=j;
end;
end;
end
else
begin
for j:=1 to 33 do
begin
if mass2[j]=mass[2][i] then
begin
tmp2:=j;
end;
end;
end;
tmp:=(tmp1-tmp2+34)mod 33;
if tmp=0 then
begin
tmp:=33;
end;
if mass[1][i] in max then
begin
mass[3][i]:=mass3[tmp];
mass[2,k]:=mass3[tmp];
k:=k+1;
end
else
begin
mass[3][i]:=mass3[tmp];
mass[2,k]:=mass3[tmp];
k:=k+1;
end;
end;
//Вывод расшифрованного текста в файл
Rewrite(File2);
for i:= 1 to size do
begin
write(File2,UpCase(mass[3][i]));
end;
Reset(File2);
Readln(File2,Str);
Encrypter.ResultText.Lines.Add(str);
CloseFile(File2);
CloseFile(file1);
end;
end;
end;
//Процедура нажатия на кнопку "Выполнить"
procedure TEncrypter.DoThisClick(Sender: TObject);
var
numEncrDecr: Byte;
TextForEncr: String; //индексы выбранных значений в ComboBox-ах
KeyEncr: String; //Введённый ключ
begin
Encrypter.ResultText.Lines.Clear;
Encrypter.ErrorText.Lines.Clear;
KeyEncr:= Encrypter.KeyOfEncr.Text;
numEncrDecr:=Encrypter.TypeOfEncr.ItemIndex;
if UseTextFromFile.Checked=True then
begin
case numEncrDecr of
0:ColEncr(keyEncr);
1:TurnGrid(KeyEncr);
2:VigChiper(KeyEncr);
end;
end
else
begin
case numEncrDecr of
0:ColEncr2(keyEncr);
1:TurnGrid2(keyEncr);
2:VigChiper2(keyEncr);
end;
end;
end;
//Процедура нажатия на кнопку "Закрыть"
procedure TEncrypter.CloseBtnClick(Sender: TObject);
begin
Encrypter.Close();
end;
//Процедура для обозначения некоторых параметров формы
procedure TEncrypter.FormCreate(Sender: TObject);
begin
Encrypter.KeyOfEncr.Enabled:=False;
end;
//Процедура изменения значения ComboBox-а
procedure TEncrypter.TypeOfEncrChange(Sender: TObject);
begin
if (Encrypter.TypeOfEncr.ItemIndex=1) then
begin
Encrypter.DoThis.Enabled:=True;
Encrypter.Decrypt.Enabled:=True;
Encrypter.KeyOfEncr.Enabled:=False;
Encrypter.KeyOfEncr.Text:='';
end
else
begin
Encrypter.KeyOfEncr.Enabled:=True;
Encrypter.KeyOfEncr.Text:='';
end;
end;
//Запрет ввода в поля comboBox
procedure TEncrypter.EncrOrDecrKeyPress(Sender: TObject; var Key: Char);
begin
key:=#0;
end;
//Запрет ввода в поля comboBox
procedure TEncrypter.TypeOfEncrKeyPress(Sender: TObject; var Key: Char);
begin
key:=#0;
end;
//Процедура изменения значения поля ComboBox-а
procedure TEncrypter.EncrOrDecrChange(Sender: TObject);
begin
If (Encrypter.TypeOfEncr.ItemIndex=1) then
begin
Encrypter.DoThis.Enabled:=true;
Encrypter.Decrypt.Enabled:=true;
end;
if (Encrypter.TypeOfEncr.ItemIndex=0) or(Encrypter.TypeOfEncr.ItemIndex=2) then
begin
Encrypter.KeyOfEncr.Enabled:=true;
end;
end;
procedure TEncrypter.DecryptClick(Sender: TObject);
var
numEncrDecr: Byte; //индексы выбранных значений в ComboBox-ах
KeyEncr,TextForEncr: String; //Введённый ключ
begin
Encrypter.ResultText.Lines.Clear;
Encrypter.ErrorText.Lines.Clear;
KeyEncr:= Encrypter.KeyOfEncr.Text;
numEncrDecr:=Encrypter.TypeOfEncr.ItemIndex;
if UseTextFromFile.Checked=True then
begin
case numEncrDecr of
0:ColEncr4(keyEncr);
1:TurnGrid4(KeyEncr);
2:VigChiper4(KeyEncr);
end;
end
else
begin
case numEncrDecr of
0:ColEncr3(keyEncr);
1:TurnGrid3(keyEncr);
2:VigChiper3(keyEncr);
end;
end;
end;
procedure TEncrypter.UseTextFromFileClick(Sender: TObject);
begin
if Encrypter.UseTextFromFile.Checked=True then
begin
Encrypter.UseTextFromFile.Checked:=False;
end
else
begin
Encrypter.UseTextFromFile.Checked:=True;
end;
end;
end.
| 25.125269 | 273 | 0.541936 |
fc06f58a013207309617264412453b454daee450 | 3,738 | pas | Pascal | tsr/0007.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| 11 | 2015-12-12T05:13:15.000Z | 2020-10-14T13:32:08.000Z | tsr/0007.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| null | null | null | tsr/0007.pas | nickelsworth/swag | 7c21c0da2291fc249b9dc5cfe121a7672a4ffc08 | [
"BSD-2-Clause"
]
| 8 | 2017-05-05T05:24:01.000Z | 2021-07-03T20:30:09.000Z | {ok i would like some info on how to remove a tsr
Follow these steps:
I tested out some TSR code today and came up With this. It's been
debugged and Functions as advertised. not as clean as I'd like,
but it works.
}
{**********************************************
* CLICK.PAS by Larry Hadley 2-02-1993 *
* donated to the public domain. if you use *
* this code or derive from it, credit would *
* be appreciated. *
********************************************** }
{$S-,N-}
{$M 1024, 0, 0}
Program CLICK;
Uses
Crt,Dos;
Var
SavedInt09h,
SavedInt66h :Pointer;
Procedure keyClick;
begin
Sound(50);
Delay(1);
NoSound;
end;
Procedure Int09h; interrupt;
begin
keyClick; { Sound click everytime called -
this is clumsy because key releases as
well as keypresses are signalled. Good
thing this is For demo only! :-) }
Asm
pushf { push flags to simulate "int" call }
call SavedInt09h { pass control to original int09 handler -
necessary to allow keyboard use. Also
demo's chaining of interrupts. }
end;
end;
Procedure Int66h(AX, BX, CX, DX, SI, DI, DS, ES, BP:Word); interrupt;
Var
int09new :Pointer;
begin
if AX<>$FFFF then
Exit; { not our call, leave }
GetIntVec($09, int09new);
if int09new<>@int09h then
Exit; { interrupt vectors have been changed. }
SetIntVec($09, SavedInt09h); { restore interrupt vectors }
SetIntVec($66, SavedInt66h);
MemW[PrefixSeg:$16] := BX; { modify PSP to return to calling }
MemW[PrefixSeg:$0A] := DI; { Program... }
MemW[PrefixSeg:$0C] := ES;
Asm
mov ah, $50
mov bx, PrefixSeg
push ds
int $21 { set conText }
pop ds
end;
AX := 0; { tell caller "no error" }
end;
begin { main - t.s.r. init code }
GetIntVec($09, SavedInt09h);
GetIntVec($66, SavedInt66h);
SetIntVec($09, #Int09h);
SetIntVec($66, @Int66h);
Writeln('Click TSR installed.');
Keep(0);
end.
{************************************************
* CLICKU.PAS by Larry Hadley 2-02-1993 *
* CLICK T.S.R. removal Program *
* released into the public domain. if you use *
* this code or derive from it, credit would be *
* appreciated. *
************************************************}
{$S-,N-}
Program CLICKU;
Uses
Dos;
Var
rtn_seg,
rtn_ofs : Word;
return : Pointer;
Label int66_error;
Procedure Exit_Label; { ...to provide an address For Dos return to }
begin
Halt(0); { I haven't been able to establish For sure that
this code regains control here. BTW, Brian I have
code to save DS and restore upon return to this
Program if you're interested. This would allow
using global Variables to save SS:SP. Int 21h func
$4C destroys DS (and just about everything else)
on Exit...}
end;
begin
return := @exit_Label;
rtn_seg := SEG(return^);
rtn_ofs := ofS(return^);
Asm
mov ax, $FFFF
mov bx, PrefixSeg
mov es, rtn_seg
mov di, rtn_ofs { pass parms in Registers ax, bx, es, di}
int $66 { call i.s.r. uninstall Function }
cmp ax, 0
jne int66_error { i.s.r. has returned error }
end;
Writeln('Click TSR uninstalled.');
Asm
mov ah, $4C
int $21 { Dos terminate }
end;
int66_error:
Writeln('Error removing TSR.');
Halt(1);
end.
| 25.958333 | 70 | 0.536116 |
c31bccd02ff4c4f9bf4393112b2d48f0e33f7a57 | 70,787 | pas | Pascal | code/parsimos_unit.pas | JeanRNH/ParsIMoS | 9451683601eb905d42337a553db35e57c42b802f | [
"ECL-2.0",
"Apache-2.0"
]
| 1 | 2018-11-28T10:21:32.000Z | 2018-11-28T10:21:32.000Z | code/parsimos_unit.pas | JeanRNH/ParsIMoS | 9451683601eb905d42337a553db35e57c42b802f | [
"ECL-2.0",
"Apache-2.0"
]
| null | null | null | code/parsimos_unit.pas | JeanRNH/ParsIMoS | 9451683601eb905d42337a553db35e57c42b802f | [
"ECL-2.0",
"Apache-2.0"
]
| 2 | 2018-11-28T09:53:26.000Z | 2020-08-04T13:43:04.000Z | {
This file is part of ParsIMoS, a software for parsing input files for IMoS.
Author
Jean R. N. Haler - jean.haler@ulg.ac.be (University of Liège - Mass Spectrometry Laboratory)
Developed with the beta testers
Christopher Kune - c.kune@ulg.ac.be (University of Liège - Mass Spectrometry Laboratory)
Dr. Johann Far - johann.far@ulg.ac.be (University of Liège - Mass Spectrometry Laboratory)
Supervisor
Prof. Edwin De Pauw - e.depauw@ulg.ac.be (University of Liège - Mass Spectrometry Laboratory)
parsimos@outlook.com
—————————————————————————————————————————————
Copyright (c) 2016-2017 University of Liège
Licensed under the Apache License, Version 2.0 (the "License »); you may not use
this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.
—————————————————————————————————————————————
}
unit parsimos_unit;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ComCtrls, ExtCtrls, fpspreadsheet, fpstypes, xlsxooxml, fpsUtils, StrUtils, fileinfo,
winpeimagereader, elfreader, machoreader;
type
{ TForm1 }
TForm1 = class(TForm)
btnConvert: TButton;
btnInfo: TButton;
btnloadlastparam: TButton;
BtnBrowseInputFile: TButton;
BtnCopyFromAtomIdentif: TButton;
BtnBrowseSelectionFile: TButton;
BtnAddmorefiles: TButton;
ChkboxNoCharge: TCheckBox;
Chkboxmobcal: TCheckBox;
ChkboxAtomIdentifsamesect: TCheckBox;
ChkboxAtomIdentifothersect: TCheckBox;
ChkboxChargesamesect: TCheckBox;
ChkboxChargeothersect: TCheckBox;
ChkboxInputFile: TCheckBox;
ChkboxAPT: TCheckBox;
ChkboxGauss: TCheckBox;
ChkboxMull: TCheckBox;
ChkboxNBO: TCheckBox;
Chkboxatomidentletter: TCheckBox;
Chkboxatomidentinteg: TCheckBox;
ChkboxAll: TCheckBox;
ChkboxSelect: TCheckBox;
CBFormat: TComboBox;
GBgeneral: TGroupBox;
GBparams: TGroupBox;
Label12: TLabel;
lblOutputFormat: TLabel;
Label7: TLabel;
lbledtChargeotherline: TLabeledEdit;
lblcompany: TLabel;
lbledtAtomIdentifotherline: TLabeledEdit;
lbledtfirstline: TLabeledEdit;
lblversion: TLabel;
Logo_ULg: TImage;
Logo_MSLab: TImage;
Logo_FNRS: TImage;
lblLoadedFiles: TLabel;
Label11: TLabel;
Label4: TLabel;
Label5: TLabel;
lbledtemptylin: TLabeledEdit;
lbledtatomchargcol: TLabeledEdit;
lbledtxcoordcol: TLabeledEdit;
lbledtatomidentcol: TLabeledEdit;
lbledtnumcoltot: TLabeledEdit;
lbledtnumsets: TLabeledEdit;
lbledtnumatoms: TLabeledEdit;
lbledtcharge: TLabeledEdit;
lbledtmass: TLabeledEdit;
lbledtycoordcol: TLabeledEdit;
lbledtzcoordcol: TLabeledEdit;
lblpercentage: TLabel;
MemoDisplayInputName: TMemo;
ProgressBar1: TProgressBar;
procedure BtnAddmorefilesClick(Sender: TObject);
procedure BtnAddmorefilesMouseEnter(Sender: TObject);
procedure BtnBrowseInputFileClick(Sender: TObject);
procedure BtnBrowseInputFileMouseEnter(Sender: TObject);
procedure btnConvertClick(Sender: TObject);
procedure BtnCopyFromAtomIdentifClick(Sender: TObject);
procedure btnInfoClick(Sender: TObject);
procedure btnloadlastparamClick(Sender: TObject);
procedure BtnBrowseSelectionFileClick(Sender: TObject);
procedure BtnBrowseSelectionFileMouseEnter(Sender: TObject);
procedure CBFormatChange(Sender: TObject);
procedure ChkboxAllChange(Sender: TObject);
procedure ChkboxAPTChange(Sender: TObject);
procedure ChkboxAtomIdentifothersectChange(Sender: TObject);
procedure ChkboxAtomIdentifsamesectChange(Sender: TObject);
procedure ChkboxatomidentintegChange(Sender: TObject);
procedure ChkboxatomidentletterChange(Sender: TObject);
procedure ChkboxChargeothersectChange(Sender: TObject);
procedure ChkboxChargesamesectChange(Sender: TObject);
procedure ChkboxGaussChange(Sender: TObject);
procedure ChkboxInputFileChange(Sender: TObject);
procedure ChkboxmobcalChange(Sender: TObject);
procedure ChkboxMullChange(Sender: TObject);
procedure ChkboxNBOChange(Sender: TObject);
procedure ChkboxNoChargeChange(Sender: TObject);
procedure ChkboxSelectChange(Sender: TObject);
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure lbledtAtomIdentifotherlineMouseEnter(Sender: TObject);
procedure lbledtChargeotherlineMouseEnter(Sender: TObject);
procedure lbledtxcoordcolExit(Sender: TObject);
procedure MemoDisplayInputNameMouseEnter(Sender: TObject);
private
{ private declarations }
DelimitersList, inputPandF:TStringList; //Local variables for this form
selectPandF:string;
AtomNameRadius:array of array of string;
public
{ public declarations }
FileContents:TStringList; //Global variables for this form
end;
var
Form1: TForm1;
implementation
uses
newsearchstring;
{$R *.lfm}
{ TForm1 }
function FindDelimiters(const Source:String; const DelimitersList:TStringLIst; var FoundDelimitersList:TStringList):integer; //Find the delimiters present in a given section; will only be used on the first line of each section
var //whole sections are encoded the same way -> one check is sufficient
sourcestring, car{, controlstring}:string;
counter{, i}:integer;
Found:boolean;
begin
sourcestring:=source;
counter:=1;
Found:=False;
while (counter <= Length(sourcestring)) do
begin
car:=Copy(sourcestring,counter,1); //first, second,.... character in line is copied and analyzed
Found:=False;
if (DelimitersList.IndexOf(car) >= 0) then //Search in the complete delimiterlist; if the delimiter is found, the function gives the element number (>=0); otherwise it will yield '-1' ('-1' means it isn't a delimiter)
Found:=True;
if (Found = True) then
begin //Save the delimiters which were found (search based on the complete delimiterslist)
if (FoundDelimitersList.Count = 0) then //first found delimiter saved to the list
FoundDelimitersList.Add(car);
if (FoundDelimitersList.Count <> 0) then //once the list contains elements: search if we had already found the delimiter or if it is a new one from the complete delimiterlist
begin
if (FoundDelimitersList.IndexOf(car) = -1) then //check if it is a new delimiter which has not yet been encountered in the string ('-1') and save it . if the delimiter was already saved, the function gives the element number (>=0)
FoundDelimitersList.Add(car);
end;
end;
counter:=counter+1; //if no delimiter is found, continue search with next element in the string
end;
{controlstring:='';
for i:=0 to (FoundDelimitersList.Count-1) do
controlstring:=controlstring+'Delim'+FoundDelimitersList[i]+'Delim';
ShowMessage('Number of found Delimiters: '+IntToStr(FoundDelimitersList.Count));
ShowMessage('Found these delimiters: '+controlstring);}
result:=FoundDelimitersList.Count;
end;
function SplitLineAsList(const Source:String; const FoundDelimitersList:TStringList; var LineasList:TStringList):integer; //Parser Function
var
sourcestring, res, car{, controlstring}:string;
counter{, i}:integer;
begin
sourcestring:=Trim(Source);
counter:=1;
res:='';
while (counter <= Length(sourcestring)) do
begin
car:=Copy(sourcestring,counter,1); //first character in line is copied and analyzed
if (FoundDelimitersList.IndexOf(car) = -1) then //search if car is one of the previously identified delimiters; -1 :no, >= :yes
res:=res+car;
if (FoundDelimitersList.IndexOf(car) >= 0) then //once a delimiter is found the string is saved as an element in the StringList if the string isn't empty
begin
if (res <> '') then
begin
LineasList.Add(res);
res:=''
end;
end;
counter:=counter+1;
end;
LineasList.Add(res); //last string in the line before char(13) or equivalent ('enter')
res:='';
{controlstring:='';
for i:=0 to (LineasList.Count-1) do
controlstring:=controlstring+char(13)+LineasList[i];
ShowMessage('Parsed line: '+controlstring);}
result:=LineasList.Count; //number of elements we parsed between the delimiters
end;
procedure TForm1.btnConvertClick(Sender: TObject); //Conversion/Parse Button
var
Param_backup: text;
Para: AnsiString;
Workbk: TsWorkbook;
Worksh: TsWorksheet;
Xcoord, Ycoord, Zcoord, Charge,AtomIdentif: array of string;
inputstream:TFileStream;
SelectContents,FoundDelimitersList, LineasList: TStringList;
sheetnumtot, sheetnum, firstline, filecount, selectcount, i, k, l, lengthmax, NumberOfAtoms, chargetot, emptylines: integer;
colx, coly, colz, colatomid, colatomcharg: integer;
line, dir, newfilename:string;
perc, mass, summedmass:real;
hit, found, Stopping, trymulliken, nomulliken:boolean;
begin
{Securities if parameter is missing -> program won't crash}
if (ChkboxInputFile.Checked=False) then
begin
ShowMessage('Please select an input file.');
BtnBrowseInputFileClick(Sender);
end;
if ChkboxGauss.Checked=true then
begin
if lbledtnumatoms.Text='' then
begin
lbledtnumatoms.Color:=clRed;
lbledtnumatoms.Text:=inputbox('Missing parameter detected','Please insert the number of atoms','');
lbledtnumatoms.Color:=clDefault;
end;
end;
if ChkboxGauss.Checked=false then
begin
if lbledtnumatoms.Text='' then
begin
lbledtnumatoms.Color:=clRed;
lbledtnumatoms.Text:=inputbox('Missing parameter detected','Please insert the number of atoms','');
lbledtnumatoms.Color:=clDefault;
end;
if lbledtfirstline.Text='' then
begin
lbledtfirstline.Color:=clRed;
lbledtfirstline.Text:=inputbox('Missing parameter detected','Please insert the line number of the first coordinate set','');
lbledtfirstline.Color:=clDefault;
end;
if lbledtnumsets.Text='' then
begin
lbledtnumsets.Color:=clRed;
lbledtnumsets.Text:=inputbox('Missing parameter detected','Please insert the number of structures/sets of coordinates','');
lbledtnumsets.Color:=clDefault;
end;
if lbledtnumcoltot.Text='' then
begin
lbledtnumcoltot.Color:=clRed;
lbledtnumcoltot.Text:=inputbox('Missing parameter detected','Please insert the number of columns','');
lbledtnumcoltot.Color:=clDefault;
end;
if lbledtxcoordcol.Text='' then
begin
lbledtxcoordcol.Color:=clRed;
lbledtxcoordcol.Text:=inputbox('Missing parameter detected','Please insert the X coordinates column number','');
lbledtxcoordcol.Color:=clDefault;
end;
if lbledtycoordcol.Text='' then
begin
lbledtycoordcol.Color:=clRed;
lbledtycoordcol.Text:=inputbox('Missing parameter detected','Please insert the Y coordinates column number','');
lbledtycoordcol.Color:=clDefault;
end;
if lbledtzcoordcol.Text='' then
begin
lbledtzcoordcol.Color:=clRed;
lbledtzcoordcol.Text:=inputbox('Missing parameter detected','Please insert the Z coordinates column number','');
lbledtzcoordcol.Color:=clDefault;
end;
if lbledtatomidentcol.Text='' then
begin
lbledtatomidentcol.Color:=clRed;
lbledtatomidentcol.Text:=inputbox('Missing parameter detected','Please insert the atom identifiers column number','');
lbledtatomidentcol.Color:=clDefault;
end;
if ChkboxNoCharge.Checked=False then
begin
if lbledtatomchargcol.Text='' then
begin
lbledtatomchargcol.Color:=clRed;
lbledtatomchargcol.Text:=inputbox('Missing parameter detected','Please insert the atom charges column number','');
lbledtatomchargcol.Color:=clDefault;
end;
end;
if lbledtemptylin.Text='' then
begin
lbledtemptylin.Color:=clRed;
lbledtemptylin.Text:=inputbox('Missing parameter detected','Please insert the number of lines between sets of coordinates','');
lbledtemptylin.Color:=clDefault;
end;
if (ChkboxChargeothersect.Checked=True) then
begin
if (lbledtChargeotherline.Text='') then
begin
lbledtChargeotherline.Color:=clRed;
lbledtChargeotherline.Text:=inputbox('Missing parameter detected','Please insert the line number from where to start reading the atom charges','');
lbledtChargeotherline.Color:=clDefault;
end;
end;
if (ChkboxAtomIdentifothersect.Checked=True) then
begin
if (lbledtAtomIdentifotherline.Text='') then
begin
lbledtAtomIdentifotherline.Color:=clRed;
lbledtAtomIdentifotherline.Text:=inputbox('Missing parameter detected','Please insert the line number from where to start reading the atom identifiers','');
lbledtAtomIdentifotherline.Color:=clDefault;
end;
end;
end;
dir:=ProgramDirectory; //directory of the inputs = directory of the .exe
SetCurrentDir(dir);
Para:='Last_parameters.par'; //Backup of last parameters used for encoding
AssignFile(Param_backup, Para);
Rewrite(Param_backup);
writeln(Param_backup,'List of the parameters used for the last encoding.');
writeln(Param_backup,DateTimeToStr(Now));
writeln(Param_backup); //3 lines of comments
writeln(Param_backup,'File(s) to encode:',chr(9),IntToStr(inputPandF.Count));
for i:=0 to (inputPandF.Count-1) do
begin
writeln(Param_backup,'File:',chr(9),inputPandF[i]);
end;
writeln(Param_backup,'Output file format:',chr(9),CBFormat.ItemIndex);
writeln(Param_backup,'Gaussian input:',chr(9),ChkboxGauss.Checked);
writeln(Param_backup,'Mulliken charges:',chr(9),ChkboxMull.Checked);
writeln(Param_backup,'APT charges:',chr(9),ChkboxAPT.Checked);
writeln(Param_backup,'NBO charges:',chr(9),ChkboxNBO.Checked);
writeln(Param_backup,'Number of Atoms:',chr(9),lbledtnumatoms.Text);
if lbledtmass.Text='' then
writeln(Param_backup,'Total Mass:',chr(9),'0')
else
writeln(Param_backup,'Total Mass:',chr(9),lbledtmass.Text);
if lbledtcharge.Text='' then
writeln(Param_backup,'Total Charge:',chr(9),'0')
else
writeln(Param_backup,'Total Charge:',chr(9),lbledtcharge.Text);
writeln(Param_backup,'Convert entire input:',chr(9),ChkboxAll.Checked);
writeln(Param_backup,'Convert selection:',chr(9),ChkboxSelect.Checked);
writeln(Param_backup,'First line number:',chr(9),lbledtfirstline.Text);
writeln(Param_backup,'Sets of coordinates:',chr(9),lbledtnumsets.Text);
writeln(Param_backup,'Number of columns:',chr(9),lbledtnumcoltot.Text);
writeln(Param_backup,'X Coordinates column:',chr(9),lbledtxcoordcol.Text);
writeln(Param_backup,'Y Coordinates column:',chr(9),lbledtycoordcol.Text);
writeln(Param_backup,'Z Coordinates column:',chr(9),lbledtzcoordcol.Text);
writeln(Param_backup,'Atom identifier column:',chr(9),lbledtatomidentcol.Text);
writeln(Param_backup,'Atom identifier is a letter:',chr(9),Chkboxatomidentletter.Checked);
writeln(Param_backup,'Atom identifier is an integer:',chr(9),Chkboxatomidentinteg.Checked);
writeln(Param_backup,'Atom identifier in same section:',chr(9),ChkboxAtomIdentifsamesect.Checked);
writeln(Param_backup,'Atom identifier in other section:',chr(9),ChkboxAtomIdentifothersect.Checked);
writeln(Param_backup,'Atom identifier in other line:',chr(9),lbledtAtomIdentifotherline.Text);
writeln(Param_backup,'Atom charge column:',chr(9),lbledtatomchargcol.Text);
writeln(Param_backup,'Atom charge in same section:',chr(9),ChkboxChargesamesect.Checked);
writeln(Param_backup,'Atom charge in other section:',chr(9),ChkboxChargeothersect.Checked);
writeln(Param_backup,'Atom charge in other line:',chr(9),lbledtChargeotherline.Text);
writeln(Param_backup,'Lines between sets of coordinates:',chr(9),lbledtemptylin.Text);
writeln(Param_backup,'Mobcal input:',chr(9),Chkboxmobcal.Checked);
writeln(Param_backup,'No charge:',chr(9),ChkboxNoCharge.Checked);
if (ChkboxSelect.Checked=True) then
writeln(Param_backup,'File with selection of sets of coordinates:',chr(9),selectPandF)
else
writeln(Param_backup,'File with selection of sets of coordinates:',chr(9));
CloseFile(Param_backup);
if (ChkboxSelect.Checked=True) then
begin
SelectContents:=TStringList.Create;
inputstream:=TFileStream.Create(selectPandF,fmOpenRead); //Load input file
SelectContents.LoadfromStream(inputstream);
inputstream.Free;
end;
FileContents:=TStringList.Create;
LineasList:=TStringList.Create;
FoundDelimitersList:=TStringList.Create;
for filecount:=0 to (inputPandF.Count-1) do //several inputs -> one after the other
begin
inputstream:=TFileStream.Create(inputPandF[filecount],fmOpenRead);//Load input file
FileContents.LoadfromStream(inputstream);
inputstream.Free;
for i:=0 to (FileContents.Count-1) do //Substitute false paragraph sign which keeps file as 1 single line
begin
if ((FileContents[i]=char(255)) or (FileContents[i]=char(160)) or (FileContents[i]=#160)) then
FileContents[i]:=char(13);
end;
if (Chkboxmobcal.Checked=False) then
NumberOfAtoms:= StrToInt(lbledtnumatoms.Text)
else
begin
NumberOfAtoms:= StrToInt(FileContents[2]);
sheetnumtot:=StrToInt(FileContents[1]);
end;
emptylines:= StrToInt(lbledtemptylin.Text);
SetLength(Xcoord,NumberOfAtoms); //give suitable sizes to data matrices/vectors
SetLength(Ycoord,NumberOfAtoms);
SetLength(Zcoord,NumberOfAtoms);
SetLength(Charge,NumberOfAtoms);
SetLength(AtomIdentif,NumberOfAtoms);
colx:= StrToInt(lbledtxcoordcol.Text);
coly:= StrToInt(lbledtycoordcol.Text);
colz:= StrToInt(lbledtzcoordcol.Text);
colatomid:= StrToInt(lbledtatomidentcol.Text);
colatomcharg:= StrToInt(lbledtatomchargcol.Text);
if (Chkboxmobcal.Checked=False) then
begin
if (ChkboxAll.Checked=True) then
begin
sheetnumtot:= StrToInt(lbledtnumsets.Text); //number of coordinate sets
end;
end;
if (ChkboxAll.Checked=True) then
begin
firstline:= StrToInt(lbledtfirstline.Text)-1; //line from which we will begin parsing (coordinates,...)
end;
if (ChkboxGauss.Checked=True) then
begin
sheetnumtot:=StrToInt(lbledtnumsets.Text); //number of sets of coordinates; encoded by default; firstline to be determined afterwards (different for coordinates, charges etc.)
end;
if (ChkboxSelect.Checked=True) then
begin
selectcount:=1; //counter of sets of coordinates; maximum:SelectContents.Count-1; -1 b/c 1 line description
sheetnumtot:= (SelectContents.Count-1); //number of selected structures = number of line in selection.txt (SelectContents) & + 1line of comments
firstline:= (((StrToInt(SelectContents[selectcount])-1)*NumberOfAtoms) + ((StrToInt(SelectContents[selectcount])-1)*emptylines) + (StrToInt(lbledtfirstline.Text)-1)); //1st set of selected coordinates + jump empty lines + lines for description (mobcal etc.)
ShowMessage('First Set: '+SelectContents[selectcount] +sLineBreak+'Firstline: '+IntToStr(firstline));
end;
//ShowMessage('Number of atoms: '+IntToStr(NumberOfAtoms)+sLineBreak+'Number of sets of coordinates: '+IntToStr(sheetnumtot));
ProgressBar1.Hide; //Progress Bar for encoding
ProgressBar1.Position:=0;
ProgressBar1.Max:=sheetnumtot;
lblpercentage.Hide;
if (ChkboxGauss.Checked=True) then //Gaussian input firstline definition for x,y,z coordinates
begin
found:=False; //Optimized geometries
k:=0;
while ((found=False) and (k<=(FileContents.Count-1))) do
begin
if (AnsiContainsText(Trim(FileContents[k]),'optimization completed')=False) then k:=k+1
else
begin
l:=k;
while ((found=False) and (l<=(FileContents.Count-1))) do
begin
if (AnsiContainsText(Trim(FileContents[l]),'standard orientation')=False) then l:=l+1
else
begin
firstline:=l+5;
found:=True;
end;
end;
end;
end;
if (found=False) then //Non-optomized geometries -> Single Point Energy SPE calculations
begin
k:=0;
ShowMessage('No optimized geometry found.' +sLineBreak+ '...continuing with input geometry.');
while ((found=False) and (k<=(FileContents.Count-1))) do
begin
if (AnsiContainsText(Trim(FileContents[k]),'input orientation')=False) then k:=k+1
else
begin
firstline:=k+5;
found:=True;
end;
end;
end;
end;
Workbk:=TsWorkbook.Create; //Create spreadsheet workbook
Stopping:=False;
for sheetnum:=0 to (sheetnumtot-1) do //counter begins at 0 -> sheetnumtot-1
begin //loop for reading data & writing into Excel
if (ChkboxSelect.Checked=True) then
Worksh:=Workbk.AddWorksheet('struct'+SelectContents[selectcount]) //Create the needed worksheets + give names according to number of the selected structure
else
Worksh:=Workbk.AddWorksheet('struct'+IntToStr(sheetnum+1)); //Create the needed worksheets + give names according to number of structure; counter begins at 0
summedmass:=0;
ProgressBar1.Show;
lblpercentage.Show;
ProgressBar1.Position:=ProgressBar1.Position+1;
perc:=Round(((sheetnum+1)/sheetnumtot)*100);
if (inputPandF.Count=1) then
lblpercentage.Caption:=(FloatToStr(perc)+'%')
else
lblpercentage.Caption:=(IntToStr(filecount+1)+'/'+IntToStr(inputPandF.Count)+' '+FloatToStr(perc)+'%');
Application.ProcessMessages; //Refresh the interface
FoundDelimitersList.Clear;
for i:=0 to (NumberOfAtoms-1) do
begin
if (ChkboxAll.Checked=True) then
lengthmax:=sheetnumtot*NumberOfAtoms + (StrToInt(lbledtfirstline.Text)-1) + (sheetnumtot-1)*emptylines; //sheetnumtot is the total number of sets of coordinates
if (ChkboxSelect.Checked=True) then
lengthmax:=firstline + NumberOfAtoms-1;
if (ChkboxGauss.Checked=True) then
lengthmax:=firstline + NumberOfAtoms-1;
if (((i + firstline) <= lengthmax) and ((i+firstline) <= (firstline+NumberOfAtoms-1))) then //firstline will be increased from set to set
begin
line:=FileContents[i + firstline]; //i+firstline is the number of the line to be parsed
LineasList.Clear;
if (FoundDelimitersList.Count = 0) then //Will only take place for the first line of the section -> we select the delimiters actually found from all encoded delimiters
begin //a given section will be encoded the same way -> only do it once
FindDelimiters(line, DelimitersList, FoundDelimitersList);
end;
SplitLineAsList(line, FoundDelimitersList, LineasList); //Parsing function
if ((ChkboxGauss.Checked=True) and (i=0)) then //depending on Gaussian version: 5 or 6 columns total where coordinates have to be read -> adjust colx, coly,colz; only do it once i=0
begin //read last 3 columns -> x,y,z
colx:=LineasList.Count-2;
coly:=LineasList.Count-1;
colz:=LineasList.Count;
end;
XCoord[i]:=LineasList[colx-1]; //LineasList begins at 0
YCoord[i]:=LineasList[coly-1];
ZCoord[i]:=LineasList[colz-1];
if (ChkboxGauss.Checked=False) then //other inputs than Gaussian where the atomidentifiers and charges are written in the same lines as the coordinates
begin
if (ChkboxAtomIdentifsamesect.Checked = True) then
AtomIdentif[i]:=LineasList[colatomid-1];
if (ChkboxNoCharge.Checked=False) then
begin
if (ChkboxChargesamesect.Checked = True) then
Charge[i]:=LineasList[colatomcharg-1];
end
else
Charge[i]:='';
end;
//ShowMessage(XCoord[i]+sLineBreak+YCoord[i]+sLineBreak+ZCoord[i]+sLineBreak+AtomIdentif[i]+sLineBreak+Charge[i]);
if ((sheetnum=0) and (LineasList.Count > (StrToInt(lbledtnumcoltot.Text)))) then //Message Box if problem encountered
begin
case QuestionDlg ('Attention: Too many columns detected',
'Too many columns detected.'+sLineBreak+'At least one delimiter was not read correctly.',
mtCustom,[mrYes,'Ok, continue', mrNo, 'Please abort the conversion and Save', 'IsDefault'],'') of
mrNo: Stopping:=True;
end;
if (Stopping=True) then
begin
newfilename:=ChangeFileExt(ExtractFileName(inputPandF[filecount]),'');
Workbk.WriteToFile(ExtractFilePath(inputPandF[filecount])+newfilename+'.xlsx',sfOOXML,True); //Save the workbook in Directory from the input file
Workbk.Free;
FileContents.Free;
inputPandF.Free;
DelimitersList.Free;
halt(1);
end;
end;
LineasList.Clear;
end;
end;
if (ChkboxGauss.Checked = False) then //Get Atom Identifiers from other section than the coordinates etc. but non Gaussian input
begin
if (ChkboxAtomIdentifothersect.Checked = True) then
begin
FoundDelimitersList.Clear;
firstline:=StrToInt(lbledtAtomIdentifotherline.Text)-1;
for i:=0 to (NumberOfAtoms-1) do
begin
lengthmax:=firstline + NumberOfAtoms-1;
if (((i + firstline) <= lengthmax) and ((i+firstline) <= (firstline+NumberOfAtoms-1))) then //firstline will be increased from set to set
begin
line:=FileContents[i + firstline]; //i+firstline is the number of the line to be parsed
LineasList.Clear;
if (FoundDelimitersList.Count = 0) then //Will only take place for the first line of the section -> we select the delimiters actually found from all encoded delimiters
begin //a given section will be encoded the same way -> only do it once
FindDelimiters(line, DelimitersList, FoundDelimitersList);
end;
SplitLineAsList(line, FoundDelimitersList, LineasList); //Parsing function
AtomIdentif[i]:=LineasList[colatomid-1];
LineasList.Clear;
end;
end;
end;
end;
if (ChkboxGauss.Checked = False) then //Get charges from other section than the coordinates etc. but non Gaussian input
begin
if (ChkboxChargeothersect.Checked = True) then
begin
FoundDelimitersList.Clear;
firstline:=StrToInt(lbledtChargeotherline.Text)-1;
for i:=0 to (NumberOfAtoms-1) do
begin
lengthmax:=firstline + NumberOfAtoms-1;
if (((i + firstline) <= lengthmax) and ((i+firstline) <= (firstline+NumberOfAtoms-1))) then //firstline will be increased from set to set
begin
line:=FileContents[i + firstline]; //i+firstline is the number of the line to be parsed
LineasList.Clear;
if (FoundDelimitersList.Count = 0) then //Will only take place for the first line of the section -> we select the delimiters actually found from all encoded delimiters
begin //a given section will be encoded the same way -> only do it once
FindDelimiters(line, DelimitersList, FoundDelimitersList);
end;
SplitLineAsList(line, FoundDelimitersList, LineasList); //Parsing function
Charge[i]:=LineasList[colatomcharg-1];
LineasList.Clear;
end;
end;
end;
end;
found:=False;
if (ChkboxGauss.Checked=True) then //Gaussian input firstline definition for other charges than Mulliken & atom identifiers
begin
trymulliken:=False;
if ((ChkboxAPT.Checked=True) or (ChkboxNBO.Checked=True)) then //APT or NBO
begin
FoundDelimitersList.Clear;
k:=firstline;
while ((found=False) and (k<=(FileContents.Count-1))) do
begin
if ((ChkboxAPT.Checked=True) and (AnsiContainsText(Trim(FileContents[k]),'apt atomic charges')=True)) then
begin
firstline:=k+2;
found:=True;
end;
if ((ChkboxNBO.Checked=True) and (AnsiContainsText(Trim(FileContents[k]),'natural population analysis')=True)) then
begin
firstline:=k+6;
found:=True;
end;
k:=k+1;
end;
if ((ChkboxAPT.Checked=True) and (k=FileContents.Count)) then //Search terms for APT charges were not found
begin //Search for new search terms for APT charges -> Form2
Form2.Caption:='APT Search Terms';
Form2.lbldescription.Caption:='No APT charges were found using the default search term.';
Form2.btnContwithMulliken.Show;
Form2.ShowModal;
if (Form2.directlyMulliken=True) then trymulliken:=True;
if (Form2.Resumeparsing=True) then
begin
firstline:=Form2.newsearchfirstline-1;
colatomid:=Form2.newsearchcolatomid;
colatomcharg:=Form2.newsearchcolatomcharg;
end;
end;
if ((ChkboxNBO.Checked=True) and (k=FileContents.Count)) then //Search terms for NBO charges were not found
begin //Search for new search terms for NBO charges -> Form2
Form2.Caption:='NBO Search Terms';
Form2.lbldescription.Caption:='No NBO charges were found using the default search term.';
Form2.btnContwithMulliken.Show;
Form2.ShowModal;
if (Form2.directlyMulliken=True) then
begin
trymulliken:=True;
colatomid:=2; //Default for mulliken; stored value was read in GUI for NBO -> '1' instead of '2'
end;
if (Form2.Resumeparsing=True) then
begin
firstline:=Form2.newsearchfirstline-1;
colatomid:=Form2.newsearchcolatomid;
colatomcharg:=Form2.newsearchcolatomcharg;
end;
end;
if ((Form2.Resumeparsing=True) or (found=True)) then
begin
for i:=0 to (NumberOfAtoms-1) do
begin
lengthmax:=firstline + NumberOfAtoms-1;
if (((i + firstline) <= lengthmax) and ((i+firstline) <= (firstline+NumberOfAtoms-1))) then //firstline will be increased from set to set
begin
line:=FileContents[i + firstline]; //i+firstline is the number of the line to be parsed
LineasList.Clear;
if (FoundDelimitersList.Count = 0) then //Will only take place for the first line of the section -> we select the delimiters actually found from all encoded delimiters
begin //a given section will be encoded the same way -> only do it once
FindDelimiters(line, DelimitersList, FoundDelimitersList);
end;
SplitLineAsList(line, FoundDelimitersList, LineasList); //Parsing function
AtomIdentif[i]:=LineasList[colatomid-1];
Charge[i]:=LineasList[colatomcharg-1];
LineasList.Clear;
end;
end;
end;
end;
if ((trymulliken=True) or (ChkboxMull.Checked=True)) then //Gaussian input firstline definition for charges (Mulliken) & atom identifiers
begin
found:=False;
k:=firstline;
nomulliken:=True;
while ((found=False) and (k<=(FileContents.Count-1))) do
begin
if (AnsiContainsText(Trim(FileContents[k]),'mulliken atomic charges')=True) then
begin
firstline:=k+2;
found:=True;
nomulliken:=False;
end;
if (AnsiContainsText(Trim(FileContents[k]),'total atomic charges')=True) then
begin
firstline:=k+2;
found:=True;
nomulliken:=False;
end;
k:=k+1;
end;
if (nomulliken=True) then //Search for new search terms for mulliken charges -> Form2
begin
Form2.Caption:='Mulliken Search Terms';
Form2.lbldescription.Caption:='No Mulliken charges were found using the default search term.';
Form2.btnContwithMulliken.Hide;
Form2.ShowModal;
firstline:=Form2.newsearchfirstline-1;
colatomid:=Form2.newsearchcolatomid;
colatomcharg:=Form2.newsearchcolatomcharg;
nomulliken:=False;
end;
FoundDelimitersList.Clear;
for i:=0 to (NumberOfAtoms-1) do
begin
lengthmax:=firstline + NumberOfAtoms-1;
if (((i + firstline) <= lengthmax) and ((i+firstline) <= (firstline+NumberOfAtoms-1))) then //firstline will be increased from set to set
begin
line:=FileContents[i + firstline]; //i+firstline is the number of the line to be parsed
LineasList.Clear;
if (FoundDelimitersList.Count = 0) then //Will only take place for the first line of the section -> we select the delimiters actually found from all encoded delimiters
begin //a given section will be encoded the same way -> only do it once
FindDelimiters(line, DelimitersList, FoundDelimitersList);
end;
SplitLineAsList(line, FoundDelimitersList, LineasList); //Parsing function
AtomIdentif[i]:=LineasList[colatomid-1];
if (ChkboxNoCharge.Checked=False) then
begin
Charge[i]:=LineasList[colatomcharg-1];
end
else
Charge[i]:='';
LineasList.Clear;
end;
end;
end;
end;
for k:=0 to (NumberOfAtoms-1) do //write the matrices/vectors: indexes: row, column, what-to-write. row & column begin at 0 -> 0,0 =A1
begin
Worksh.WriteNumber(k,1,StrToFloat(XCoord[k]));
Worksh.WriteNumber(k,2,StrToFloat(YCoord[k]));
Worksh.WriteNumber(k,3,StrToFloat(ZCoord[k]));
if (ChkboxNoCharge.Checked=false) then
Worksh.WriteNumber(k,5,StrToFloat(Charge[k]));
hit:=False; //for an unknown atom (not in list)
if (Chkboxatomidentletter.Checked=True) then //if input N, C, O etc. -> conversion into numbers for Excel
begin
for l:=0 to (Length(AtomNameRadius)-2) do //-2 b/c last one is 'Other'
begin
if (AtomIdentif[k]=AtomNameRadius[l,1]) then
begin
hit:=True;
Worksh.WriteCellValueAsString(k,0,AtomIdentif[k]); //write atom symbol
Worksh.WriteNumber(k,7,StrToInt(AtomNameRadius[l,0])); //write atom def number
Worksh.WriteNumber(k,4,StrToFloat(AtomNameRadius[l,2])); //write radius
summedmass:=summedmass + StrToInt(AtomNameRadius[l,0]);
end;
end;
end;
if (Chkboxatomidentinteg.Checked=True) then
begin
for l:=0 to (Length(AtomNameRadius)-2) do //"other" will be associates to 400 as atom identifier
begin
if AtomNameRadius[l,0]=AtomIdentif[k] then
begin
hit:=True;
Worksh.WriteCellValueAsString(k,0,AtomNameRadius[l,1]); //write atom symbol
Worksh.WriteNumber(k,7,StrToInt(AtomIdentif[k])); //write atom def number
Worksh.WriteNumber(k,4,StrToFloat(AtomNameRadius[l,2])); //write radius
summedmass:=summedmass + StrToInt(AtomIdentif[k]);
end;
end;
end;
if (hit=False) then //if an atom in unknown (not listed) -> write "other" & show a message once
begin
Worksh.WriteCellValueAsString(k,0,AtomNameRadius[(Length(AtomNameRadius)-1),1]); //write atom symbol
Worksh.WriteNumber(k,7,StrToInt(AtomNameRadius[(Length(AtomNameRadius)-1),0])); //write atom def number
Worksh.WriteNumber(k,4,StrToFloat(AtomNameRadius[(Length(AtomNameRadius)-1),2])); //write radius
summedmass:=summedmass + StrToInt(AtomNameRadius[(Length(AtomNameRadius)-1),0]);
if (sheetnum=0) then //Message if "other" atom found; write only once (sheetnum=0)
begin
case QuestionDlg ('Attention: Atom identifier','Unknown atom identifier encountered.'
+sLineBreak+sLineBreak+'It is being encoded as'
+sLineBreak+'"Other"'
+sLineBreak+'Default mass: 400'
+sLineBreak+'Default radius: 2'
+sLineBreak+sLineBreak+'Line number '+IntToStr(k+1),mtCustom,[mrYes,'Yes, I know', mrNo, 'Please abort the conversion and Save', 'IsDefault'],'') of
mrNo: Stopping:=True;
end;
if (Stopping=True) then
begin
newfilename:=ChangeFileExt(ExtractFileName(inputPandF[filecount]),'');
if CBFormat.ItemIndex=0 then Workbk.WriteToFile(ExtractFilePath(inputPandF[filecount])+newfilename+'.xls',sfExcel8,True); //Save the workbook in Directory from the input file
if CBFormat.ItemIndex=1 then Workbk.WriteToFile(ExtractFilePath(inputPandF[filecount])+newfilename+'.xlsx',sfOOXML,True);
if CBFormat.ItemIndex=2 then Workbk.WriteToFile(ExtractFilePath(inputPandF[filecount])+newfilename+'.ods',sfOpenDocument,True);
if CBFormat.ItemIndex=3 then Workbk.WriteToFile(ExtractFilePath(inputPandF[filecount])+newfilename+'.csv',sfCSV,True);
Workbk.Free;
FileContents.Free;
inputPandF.Free;
DelimitersList.Free;
halt(1);
end;
end;
end;
hit:=False; //initialize hit for next atoms/atom identifiers
end;
Worksh.WriteCellValueAsString(0,6,'Total Charge');
Worksh.WriteCellValueAsString(2,6,'Total Mass');
if (lbledtcharge.Text<>'') then
begin
chargetot:= StrToInt(lbledtcharge.Text);
Worksh.WriteNumber(1,6,chargetot); //write total charge in G2 if encoded in GUI
end;
if (lbledtmass.Text='') or (lbledtmass.Text='0') then
begin
Worksh.WriteNumber(3,6,summedmass); //calculate & write total mass if not encoded in GUI (!Attention for 400 atom!)
end
else
begin
mass:=StrToFloat(lbledtmass.Text);
Worksh.WriteNumber(3,6,mass); //write total mass if encoded in GUI
end;
if (ChkboxAll.Checked=True) then //continue parsing if multiple structures -> new def for firstline
begin
firstline:=firstline + NumberOfAtoms + emptylines;
end;
if (ChkboxSelect.Checked=True) then //continue parsing if multiple selected structures -> new def for firstline; selectcount is counter for sets max:SelectContents.Count-1; -1 b/c 1 line description
begin
selectcount:=selectcount+1;
if (selectcount<=(SelectContents.Count-1)) then
begin
firstline:= (((StrToInt(SelectContents[selectcount])-1)*NumberOfAtoms) + ((StrToInt(SelectContents[selectcount])-1)*emptylines) + (StrToInt(lbledtfirstline.Text)-1));
//ShowMessage('New first line: '+IntToStr(firstline));
end;
end;
end;
FoundDelimitersList.Clear;
LineasList.Clear;
FileContents.Clear;
newfilename:=ChangeFileExt(ExtractFileName(inputPandF[filecount]),''); //Save the workbook in Directory from the input file //Output file formats
if CBFormat.ItemIndex=0 then Workbk.WriteToFile(ExtractFilePath(inputPandF[filecount])+newfilename+'.xls',sfExcel8,True);
if CBFormat.ItemIndex=1 then Workbk.WriteToFile(ExtractFilePath(inputPandF[filecount])+newfilename+'.xlsx',sfOOXML,True);
if CBFormat.ItemIndex=2 then Workbk.WriteToFile(ExtractFilePath(inputPandF[filecount])+newfilename+'.ods',sfOpenDocument,True);
if CBFormat.ItemIndex=3 then Workbk.WriteToFile(ExtractFilePath(inputPandF[filecount])+newfilename+'.csv',sfCSV,True);
Workbk.Free;
end;
if (ChkboxSelect.Checked=True) then
begin
SelectContents.Clear;
SelectContents.Free;
end;
FileContents.Free;
FoundDelimitersList.Free;
LineasList.Free;
ShowMessage('Parsing finished...enjoy');
end;
procedure TForm1.BtnCopyFromAtomIdentifClick(Sender: TObject); //Copy other section line number for Charge from Atom Identifier if the same
begin
lbledtChargeotherline.Text:=lbledtAtomIdentifotherline.Text;
end;
procedure WriteToMemo(Memo:TMemo;inputfiles:TstringList;inputselectfile:string); //Write all input files in Memo
var
i: integer;
begin
Memo.Clear; //Begin everytime from scratch: if reloaded file -> will not be written twice into memobox
if (Form1.ChkboxInputFile.Checked = True) then
begin
for i:=0 to (inputfiles.Count-1) do
begin
Memo.Lines.Add('IN '+IntToStr(i+1));
Memo.Lines.Add(inputfiles[i]);
end;
Form1.lblLoadedFiles.Caption:='Loaded Files: '+IntToStr(inputfiles.Count);
end;
if (Form1.ChkboxSelect.Checked = True) then
begin
Memo.Lines.Add('SELECTION');
Memo.Lines.Add(inputselectfile);
Form1.lblLoadedFiles.Caption:='Loaded Files: '+IntToStr(inputfiles.Count+1);
end;
Memo.SelStart:=0; //Show at line 1
end;
procedure TForm1.BtnBrowseInputFileClick(Sender: TObject); //Browse to get input files name and path (files from same directory)
var
i:integer;
OpenFileBrow:TOpenDialog;
begin
OpenFileBrow:=TOpenDialog.Create(self);
//OpenFileBrow.Filter:='Text files only (.txt)|*.txt;*.TXT'; //restrict to only open .txt files
OpenFileBrow.Title:='Open the input file(s) which need(s) parsing';
OpenFileBrow.Options:=[ofAllowMultiSelect];
if (OpenFileBrow.Execute) then
begin
inputPandF.Clear;
for i:=0 to (OpenFileBrow.Files.Count-1) do
begin
inputPandF.Add(OpenFileBrow.Files.Strings[i])
end;
ChkboxInputFile.Checked:=True;
WriteToMemo(MemoDisplayInputName,inputPandF,selectPandF);
end
else
begin
ChkboxInputFile.Checked:=False;
BtnAddmorefiles.Enabled:=False;
end;
{if (inputPandF.Count<>0) then //Add files from different folder, keeping the other files as well
begin
BtnAddmorefiles.Enabled:=True;
end; }
OpenFileBrow.Free;
end;
procedure TForm1.BtnAddmorefilesClick(Sender: TObject); //Add files from different folder, keeping the other files as well
var
i:integer;
OpenmoreFileBrow:TOpenDialog;
begin
OpenmoreFileBrow:=TOpenDialog.Create(self);
//OpenFileBrow.Filter:='Text files only (.txt)|*.txt;*.TXT'; //restrict to only open .txt files
OpenmoreFileBrow.Title:='Open the input file which needs parsing';
OpenmoreFileBrow.Options:=[ofAllowMultiSelect];
if (OpenmoreFileBrow.Execute) then
begin
for i:=0 to (OpenmoreFileBrow.Files.Count-1) do
begin
inputPandF.Add(OpenmoreFileBrow.Files.Strings[i])
end;
ChkboxInputFile.Checked:=True;
WriteToMemo(MemoDisplayInputName,inputPandF,selectPandF);
end
else
begin
ChkboxInputFile.Checked:=False;
end;
OpenmoreFileBrow.Free;
end;
procedure TForm1.BtnBrowseInputFileMouseEnter(Sender: TObject); //ShowHint for Browse Button
begin
BtnBrowseInputFile.ShowHint:=True;
BtnBrowseInputFile.Hint:='Select input file(s) from same directory, subjected to identical parsing parameters.'
+sLineBreak+'Clears all previously selected files.'
+sLineBreak+'If parsing doesn''t work, try .txt file format.';
end;
procedure TForm1.BtnAddmorefilesMouseEnter(Sender: TObject); //ShowHint for AddmoreFiles Button
begin
BtnAddmoreFiles.ShowHint:=True;
BtnAddmoreFiles.Hint:='Select more input file(s) from different directories, subjected to identical parsing parameters.'
+sLineBreak+'Does not clear previously selected files.'
+sLineBreak+'If parsing doesn''t work, try .txt file format.';
end;
procedure TForm1.btnInfoClick(Sender: TObject); //Info Button
begin
ShowMessage(
'** If parsing your input(s) doesn''t work, try a ".txt" input file format. Several inputs can be loaded at the same time if the parsing parameters are identical.'
+sLineBreak+ '** You can put the total CHARGE state and the total MASS of your ion in the "Total Charge" and "Total Mass" boxes. '
+sLineBreak+ 'They are OPTIONAL. The charge must be integer; the mass can be real.'
+ ' You can leave the boxes blank. The MASS will then be calculated automatically. ! SPECIAL ATOMS will be given the atomic number "400" !'
+sLineBreak+ '** ATOMS can be defined using LETTERS (H, C, N, O,...). If using ATOMIC NUMBERS, please make sure they are INTEGER values; the digits should be rounded to the nearest integer value.'
+sLineBreak+ '** The number of structures/sets of coordinates does not have to be given if using a file with a SELECTION of STRUCTURES to be parsed.'
+sLineBreak+'The file can only be in ".txt" format and will be read starting @line#2. Please encode one structure/set of coordinates per line.'
+sLineBreak+ '** GAUSSIAN inputs are read even if no geometry optimization was performed. If no optimized geometry is found, the input structure will be read. '
+'Do not change any automatically encoded parameters.'
+sLineBreak+ '** MOBCAL inputs can be parsed together even if not containing the same number of atoms. The parameters are read in the mobcal input.'
+sLineBreak+ 'Please do not forget to change the atom identifiers from real to integer values.'
+sLineBreak+ '** ATOM IDENTIFIERS and CHARGES can be read from DIFFERENT SECTIONS of the input file. You need to provide the line number(s) of the file where the atom identifiers/charges begin being described.'
+ ' You need to provide as well the column number of the identifiers/charges. Begin line counting considering the very first line of the input as line "1".'
+'Charges can be ignored (not parsed) by choosing "N/A".'
+sLineBreak+'** You can RELOAD the parameters used for your last encoding by clicking on the "Load last parameters" button.'
+sLineBreak+'** You can change the DELIMITERS LIBRARY in the file "Lib_Delimiters.par". Only use 1 delimiter per line. The first line is a file description.'
+sLineBreak+'You can add/modify/change ATOM DESCRIPTIONS & VDW RADII in the file "Lib_Atoms_VDW.par". The last descriptor must remain the descriptor "Other". The file is tab-delimited containing 2 lines of file descriptions.'
+sLineBreak+'** A detailed tutorial of ParsIMoS can be found in the program installation files/application bundle.');
ShowMessage('ParsIMoS is distributed under Apache License, Version 2.0.'
+sLineBreak+sLineBreak+ 'University of Liège, Belgium'
+sLineBreak+ 'Jean R. N. Haler (FRIA, F.R.S.-FNRS), jean.haler'+char(64)+'ulg.ac.be'
+sLineBreak+ 'Christopher Kune, c.kune'+char(64)+'ulg.ac.be'
+sLineBreak+ 'Dr. Johann Far, johann.far'+char(64)+'ulg.ac.be'
+sLineBreak+ 'Prof. Edwin De Pauw, e.depauw'+char(64)+'ulg.ac.be'
+sLineBreak+sLineBreak+ 'parsimos'+char(64)+'outlook.com');
end;
procedure TForm1.btnloadlastparamClick(Sender: TObject); //Load last parameters used for encoding
var
Paramfile:text;
i,j,counter, inputfilecount: integer;
Params,List: TStringList;
car,temp,res:string;
gotloaded:boolean;
begin
AssignFile(Paramfile,'Last_parameters.par'); //Backup of last parameters used for encoding
Reset(Paramfile); //opens file; 3 lines of comments
Params:= TStringList.Create;
List:= TStringList.Create;
Params.Clear;
List.Clear;
Params.LoadFromFile('Last_parameters.par');
j:=Params.Count-3;
counter:=1;
for i:=0 to (j-1) do
begin
res:='';
car:=Copy(Params.Strings[i+3],counter,1); //3 lines of comments -> i+3
while (car <> chr(9)) do
begin
counter:=counter+1;
car:=Copy(Params.Strings[i+3],counter,1);
end;
while ((car=chr(9)) and ((counter+1)<=Length(Params.Strings[i+3]))) do
begin
counter:=counter+1;
temp:=Copy(Params.Strings[i+3],counter,1);
res:=res+temp;
end;
List.Add(res);
counter:=1;
end;
inputfilecount:=StrToInt(List[0]); //path + filename
gotloaded:=False;
inputPandF.Clear;
for i:=0 to (inputfilecount-1) do
begin
if (FileExists(List[i+1]) = True) then //check if file is still in same directory
begin
inputPandF.Add(List[i+1]);
gotloaded:=True;
end
else
begin
ShowMessage('Unable to load input file.'+sLineBreak+List[i+1]);
end;
end;
if (gotloaded = True) then
begin
ChkboxInputFile.Checked:=True;
end;
CBFormat.ItemIndex:= StrToInt(List[inputfilecount+1]);
ChkboxGauss.Checked:=StrToBool(List[inputfilecount+2]);
ChkboxMull.Checked:=StrToBool(List[inputfilecount+3]);
ChkboxAPT.Checked:=StrToBool(List[inputfilecount+4]);
ChkboxNBO.Checked:=StrToBool(List[inputfilecount+5]);
lbledtnumatoms.Text:= List[inputfilecount+6];
lbledtmass.Text:= List[inputfilecount+7];
lbledtcharge.Text:= List[inputfilecount+8];
ChkboxAll.Checked:=StrToBool(List[inputfilecount+9]);
//ChkboxSelect.Checked:=StrToBool(List[10]);
lbledtfirstline.Text:= List[inputfilecount+11];
lbledtnumsets.Text:= List[inputfilecount+12];
lbledtnumcoltot.Text:= List[inputfilecount+13];
lbledtxcoordcol.Text:= List[inputfilecount+14];
lbledtycoordcol.Text:= List[inputfilecount+15];
lbledtzcoordcol.Text:= List[inputfilecount+16];
lbledtatomidentcol.Text:=List[inputfilecount+17];
Chkboxatomidentletter.Checked:=StrToBool(List[inputfilecount+18]);
Chkboxatomidentinteg.Checked:=StrToBool(List[inputfilecount+19]);
ChkboxAtomIdentifsamesect.Checked:=StrToBool(List[inputfilecount+20]);
ChkboxAtomIdentifothersect.Checked:=StrToBool(List[inputfilecount+21]);
lbledtAtomIdentifotherline.Text:=List[inputfilecount+22];
lbledtatomchargcol.Text:=List[inputfilecount+23];
ChkboxChargesamesect.Checked:=StrToBool(List[inputfilecount+24]);
ChkboxChargeothersect.Checked:=StrToBool(List[inputfilecount+25]);
lbledtChargeotherline.Text:=List[inputfilecount+26];
lbledtemptylin.Text:= List[inputfilecount+27];
Chkboxmobcal.Checked:=StrToBool(List[inputfilecount+28]);
ChkboxNoCharge.Checked:=StrToBool(List[inputfilecount+29]);
if (List[inputfilecount+30] = '') then
begin
selectPandF:='';
ChkboxSelect.Checked:=False;
end
else
begin
if (FileExists(List[inputfilecount+30]) = True) then //check if file is still in same directory
begin
selectPandF:=List[inputfilecount+30]; //path + filename
ChkboxSelect.Checked:=True;
end
else
begin
selectPandF:='';
ShowMessage('Unable to load the file containing the selection of sets of coordinates.'+sLineBreak+selectPandF);
end;
end;
if ((gotloaded = True) or (selectPandF <> '')) then
begin
WriteToMemo(MemoDisplayInputName,inputPandF,selectPandF);
end;
gotloaded:=False;
Params.Clear;
List.Clear;
Params.Free;
List.Free;
CloseFile(Paramfile);
end;
procedure TForm1.BtnBrowseSelectionFileClick(Sender: TObject); //Get file with frame selection
var
OpenSelectionBrow:TOpenDialog;
begin
OpenSelectionBrow:=TOpenDialog.Create(self);
OpenSelectionBrow.Filter:='Text files only (.txt)|*.txt;*.TXT'; //restrict to only open .txt files
OpenSelectionBrow.Title:='Open the file containing the selected sets of coordinates';
if (OpenSelectionBrow.Execute) then
begin
selectPandF:=OpenSelectionBrow.FileName;
ChkboxSelect.Checked:=True;
WriteToMemo(MemoDisplayInputName,inputPandF,selectPandF);
end
else
begin
ChkboxSelect.Checked:=False;
end;
OpenSelectionBrow.Free;
end;
procedure TForm1.BtnBrowseSelectionFileMouseEnter(Sender: TObject); //ShowHint for Frame Selection Button
begin
BtnBrowseSelectionFile.ShowHint:=True;
BtnBrowseSelectionFile.Hint:='The file can only be in ".txt" format and will be read starting @line#2.'
+sLineBreak+'Please encode one structure/set of coordinates per line.';
end;
procedure TForm1.CBFormatChange(Sender: TObject);
begin
if CBFormat.ItemIndex=0 then btnConvert.Caption:='Convert to .xls';
if CBFormat.ItemIndex=1 then btnConvert.Caption:='Convert to .xlsx';
if CBFormat.ItemIndex=2 then btnConvert.Caption:='Convert to .ods';
if CBFormat.ItemIndex=3 then btnConvert.Caption:='Convert to .csv';
end;
procedure TForm1.ChkboxAllChange(Sender: TObject);
begin
if ChkboxAll.Checked=True then
begin
ChkboxSelect.Checked:=False;
lbledtnumsets.Color:=clDefault;
lbledtnumsets.Text:='';
end;
if ChkboxGauss.Checked=True then
ChkboxAll.Checked:=False;
end;
procedure TForm1.ChkboxSelectChange(Sender: TObject); //Chkbox Frame Selection
begin
if (ChkboxSelect.Checked=False) then
begin
ShowMessage('No file with a selection of sets of coordinates was loaded.');
ChkboxAll.Checked:=True;
ChkboxSelect.Enabled:=False;
WriteToMemo(MemoDisplayInputName,inputPandF,selectPandF);
end;
if (ChkboxSelect.Checked=True) then
begin
if (MemoDisplayInputName.Visible=False) then
begin
lblLoadedFiles.Show;
MemoDisplayInputName.Show;
end;
ChkboxSelect.Enabled:=True;
ChkboxAll.Checked:=False;
lbledtnumsets.Color:=clGrayText;
lbledtnumsets.Text:='0';
end;
if ChkboxGauss.Checked=True then
ChkboxSelect.Checked:=False;
end;
procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction); //Free memory
begin
DelimitersList.Free;
inputPandF.Free;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
FileVerInfo: TFileVersionInfo;
atomparIN, delimIN:text;
atompar, delimiterinput, linetoparse, dir{, controlstring}:string;
Templist, LineList:TStringList;
i:integer;
begin
lblpercentage.Parent:=ProgressBar1; //Put the label showing the % in the middle of the progressbar
lblpercentage.AutoSize:=False;
lblpercentage.Transparent:=True;
lblpercentage.Top:=0;
lblpercentage.Left:=0;
lblpercentage.Width:=ProgressBar1.ClientWidth;
lblpercentage.Height:= ProgressBar1.ClientHeight;
lblpercentage.Alignment:=taCenter;
lblpercentage.Layout:=tlCenter;
lblpercentage.Caption:='';
inputPandF:=TStringList.Create;
FileVerInfo:=TFileVersionInfo.Create(nil);
try
FileVerInfo.FileName:=paramstr(0);
FileVerInfo.ReadFileInfo;
{writeln('File description: ',FileVerInfo.VersionStrings.Values['FileDescription']);
writeln('Internal name: ',FileVerInfo.VersionStrings.Values['InternalName']);
writeln('Legal copyright: ',FileVerInfo.VersionStrings.Values['LegalCopyright']);
writeln('Original filename: ',FileVerInfo.VersionStrings.Values['OriginalFilename']);
writeln('Product name: ',FileVerInfo.VersionStrings.Values['ProductName']);
writeln('File version: ',FileVerInfo.VersionStrings.Values['ProductVersion']);}
lblcompany.Caption:=FileVerInfo.VersionStrings.Values['CompanyName'];
lblversion.Caption:=' v. ' + FileVerInfo.VersionStrings.Values['FileVersion'];
finally
FileVerInfo.Free;
end;
CBFormat.Items.Add('.xls'); //binary xls format used by Excel ("BIFF" = "Binary Interchange File Format") -> sfExcel8
CBFormat.Items.Add('.xlsx'); //newer xlsx format introduced by Excel2007 -> sfOOXML
CBFormat.Items.Add('.ods'); //OpenOffice/LibreOffice -> sfOpenDocument
CBFormat.Items.Add('.csv'); //comma-delimited text files; they can be understood by any text editor and all spreadsheet programs, but do not contain formatting information -> sfCSV
CBFormat.ItemIndex:=1;
dir:=ProgramDirectory; //directory of the parameter files = directory of the .exe
SetCurrentDir(dir);
delimiterinput:=('Lib_Delimiters.par'); //Load Delimiter library
AssignFile(delimIN,delimiterinput);
Reset(delimIN); //opens file & reads parameters for atom identification & radii
DelimitersList:=TStringList.Create;
DelimitersList.Clear;
DelimitersList.LoadFromFile(delimiterinput);
DelimitersList.Delete(0); //Delete the line of description
{controlstring:='';
for i:=0 to (DelimitersList.Count-1) do
begin
controlstring:=controlstring+'d'+DelimitersList[i];
end;
ShowMessage('All delimiters: '+controlstring); }
CloseFile(delimIN);
atompar:=('Lib_Atoms_VDW.par'); //Load Atom parameter library
AssignFile(atomparIN,atompar);
Reset(atomparIN); //opens file & reads parameters for atom identification & radii
Templist:=TStringList.Create;
Templist.Clear;
Templist.LoadFromFile(atompar);
SetLength(AtomNameRadius,Templist.Count-2,3); //Templist.count-2 b/c 2-line description; 3 b/c 3 parameter columns //possibility to add new atoms etc.
LineList:=TStringList.Create;
LineList.Clear;
for i:=0 to (Templist.Count-3) do //Templist.count-3 b/c 2-line description
begin
linetoparse:=Templist[i+2]; //+2 b/c 2-line description
SplitLineAsList(linetoparse,DelimitersList,LineList); //use DelimitersList and not FoundDelimitersList in case someone did not encode correctly
AtomNameRadius[i,0]:=LineList[0]; //Integer Atom Identifier [line, column]
AtomNameRadius[i,1]:=LineList[1]; //Letter Atom Identifier
AtomNameRadius[i,2]:=LineList[2]; //VDW Radius Atom
LineList.Clear;
end;
LineList.Clear;
LineList.Free;
CloseFile(atomparIN);
Templist.Clear;
Templist.Free;
{controlstring:=AtomNameRadius[0,0]+' '+AtomNameRadius[0,1]+' '+AtomNameRadius[0,2];
ShowMessage('First line Atom parameters: '+controlstring);
controlstring:=AtomNameRadius[Length(AtomNameRadius)-1,0]+' '+AtomNameRadius[Length(AtomNameRadius)-1,1]+' '+AtomNameRadius[Length(AtomNameRadius)-1,2];
ShowMessage('Last line Atom parameters: '+controlstring); }
end;
procedure TForm1.lbledtAtomIdentifotherlineMouseEnter(Sender: TObject); //ShowHint for atom identifiers in other section; give line
begin
lbledtAtomIdentifotherline.ShowHint:=True;
lbledtAtomIdentifotherline.Hint:='Begin counting considering the very first line of the input as line "1"'
end;
procedure TForm1.lbledtChargeotherlineMouseEnter(Sender: TObject); //ShowHint for charge in other section; give line
begin
lbledtChargeotherline.ShowHint:=True;
lbledtChargeotherline.Hint:='Begin counting considering the very first line of the input as line "1"'
end;
procedure TForm1.ChkboxatomidentintegChange(Sender: TObject);
begin
if Chkboxatomidentinteg.Checked=True then
begin
Chkboxatomidentletter.Checked:=False;
Label5.Show;
end;
end;
procedure TForm1.ChkboxatomidentletterChange(Sender: TObject);
begin
if Chkboxatomidentletter.Checked=True then
begin
Chkboxatomidentinteg.Checked:=False;
Label5.Hide;
end;
end;
procedure TForm1.ChkboxChargeothersectChange(Sender: TObject);
begin
if (ChkboxChargeothersect.Checked=True) then
begin
ChkboxChargesamesect.Checked:=False;
ChkboxNoCharge.Checked:=False;
lbledtChargeotherline.Show;
BtnCopyFromAtomIdentif.Show;
end
end;
procedure TForm1.ChkboxChargesamesectChange(Sender: TObject);
begin
if (ChkboxChargesamesect.Checked=True) then
begin
ChkboxChargeothersect.Checked:=False;
ChkboxNoCharge.Checked:=False;
lbledtChargeotherline.Hide;
lbledtChargeotherline.Text:='';
BtnCopyFromAtomIdentif.Hide;
end
end;
procedure TForm1.ChkboxGaussChange(Sender: TObject); //GUI encoding for Gaussian inputs
begin
if ChkboxGauss.Checked=true then
begin
ChkboxMull.Visible:=true;
ChkboxAPT.Visible:=true;
ChkboxNBO.Visible:=true;
Chkboxmobcal.Visible:=False;
end;
if ChkboxGauss.Checked=false then
begin
ChkboxMull.Visible:=false;
ChkboxAPT.Visible:=false;
ChkboxNBO.Visible:=false;
Chkboxmobcal.Visible:=True;
end;
if ChkboxGauss.Checked=true then
begin
ChkboxAll.Checked:=False;
ChkboxSelect.Checked:=False;
Chkboxmobcal.Checked:=False;
lbledtfirstline.Text:='1';
lbledtnumsets.Text:='1';
lbledtnumcoltot.Text:='6';
lbledtxcoordcol.Text:='0';
lbledtycoordcol.Text:='0';
lbledtzcoordcol.Text:='0';
lbledtatomidentcol.Text:='2';
Chkboxatomidentletter.Checked:=true;
Chkboxatomidentinteg.Checked:=false;
lbledtatomchargcol.Text:='3';
ChkboxAtomIdentifsamesect.Checked:=False;
ChkboxAtomIdentifothersect.Checked:=True;
lbledtAtomIdentifotherline.Text:='0';
lbledtemptylin.Text:='0';
ChkboxChargesamesect.Checked:=False;
ChkboxChargeothersect.Checked:=True;
lbledtChargeotherline.Text:='0';
lbledtfirstline.Color:=clGray;
lbledtnumsets.Color:=clGray;
lbledtnumcoltot.Color:=clGray;
lbledtnumcoltot.Color:=clGray;
lbledtxcoordcol.Color:=clGray;
lbledtycoordcol.Color:=clGray;
lbledtzcoordcol.Color:=clGray;
lbledtatomidentcol.Color:=clGray;
lbledtatomchargcol.Color:=clGray;
lbledtemptylin.Color:=clGray;
lbledtAtomIdentifotherline.Color:=clGray;
lbledtChargeotherline.Color:=clGray;
end;
if ChkboxGauss.Checked=false then
begin
ChkboxAll.Checked:=True;
lbledtfirstline.Text:='';
lbledtnumsets.Text:='';
lbledtnumcoltot.Text:='5';
lbledtxcoordcol.Text:='';
lbledtycoordcol.Text:='';
lbledtzcoordcol.Text:='';
lbledtatomidentcol.Text:='';
Chkboxatomidentletter.Checked:=true;
Chkboxatomidentinteg.Checked:=false;
ChkboxAtomIdentifsamesect.Checked:=True;
ChkboxAtomIdentifothersect.Checked:=False;
lbledtAtomIdentifotherline.Text:='';
lbledtatomchargcol.Text:='';
ChkboxChargesamesect.Checked:=True;
ChkboxChargeothersect.Checked:=False;
lbledtChargeotherline.Text:='';
lbledtemptylin.Text:='1';
lbledtfirstline.Color:=clDefault;
lbledtnumsets.Color:=clDefault;
lbledtnumcoltot.Color:=clDefault;
lbledtnumcoltot.Color:=clDefault;
lbledtxcoordcol.Color:=clDefault;
lbledtycoordcol.Color:=clDefault;
lbledtzcoordcol.Color:=clDefault;
lbledtatomidentcol.Color:=clDefault;
lbledtatomchargcol.Color:=clDefault;
lbledtemptylin.Color:=clDefault;
lbledtAtomIdentifotherline.Color:=clDefault;
lbledtChargeotherline.Color:=clDefault;
end;
end;
procedure TForm1.ChkboxInputFileChange(Sender: TObject); //Check uncheck input file
begin
if (ChkboxInputFile.Checked=False) then
begin
ShowMessage('No input file selected.');
BtnAddmorefiles.Enabled:=False;
ChkboxInputFile.Enabled:=False;
MemoDisplayInputName.Hide;
MemoDisplayInputName.Clear;
lblLoadedFiles.Hide;
end;
if (ChkboxInputFile.Checked=True) then
begin
MemoDisplayInputName.Show;
lblLoadedFiles.Show;
ChkboxInputFile.Enabled:=True;
BtnAddmorefiles.Enabled:=True;
end;
end;
procedure TForm1.ChkboxmobcalChange(Sender: TObject);
begin
if (Chkboxmobcal.Checked=True) then
begin
lbledtnumatoms.Text:='0'; //will be read in input for mobcal
lbledtnumatoms.Color:=clGray;
lbledtfirstline.Text:='7';
lbledtnumsets.Text:='0'; //will be read in input for mobcal
lbledtnumsets.Color:=clGray;
lbledtnumcoltot.Text:='5';
lbledtxcoordcol.Text:='1';
lbledtycoordcol.Text:='2';
lbledtzcoordcol.Text:='3';
lbledtatomidentcol.Text:='4';
Chkboxatomidentinteg.Checked:=True;
ChkboxAtomIdentifsamesect.Checked:=True;
lbledtatomchargcol.Text:='5';
ChkboxChargesamesect.Checked:=True;
lbledtemptylin.Text:='1';
ChkboxGauss.Checked:=False;
ChkboxAll.Checked:=True;
end;
if (Chkboxmobcal.Checked=False) then
begin
lbledtnumatoms.Text:='';
lbledtnumatoms.Color:=clDefault;
lbledtfirstline.Text:='';
lbledtnumsets.Text:='';
lbledtnumsets.Color:=clDefault;
lbledtnumcoltot.Text:='';
lbledtxcoordcol.Text:='';
lbledtycoordcol.Text:='';
lbledtzcoordcol.Text:='';
lbledtatomidentcol.Text:='';
Chkboxatomidentinteg.Checked:=True;
ChkboxAtomIdentifsamesect.Checked:=True;
lbledtatomchargcol.Text:='';
ChkboxChargesamesect.Checked:=True;
lbledtemptylin.Text:='1';
end;
end;
procedure TForm1.ChkboxMullChange(Sender: TObject);
begin
if ChkboxMull.Checked=true then
begin
ChkboxNBO.Checked:=false;
ChkboxAPT.Checked:=false;
ChkboxNoCharge.Checked:=false;
lbledtatomidentcol.Text:='2'; //Default for other charges, e.g. APT and Mulliken
end;
end;
procedure TForm1.ChkboxAPTChange(Sender: TObject);
begin
if ChkboxAPT.Checked=true then
begin
ChkboxMull.Checked:=false;
ChkboxNBO.Checked:=false;
ChkboxNoCharge.Checked:=false;
lbledtatomidentcol.Text:='2'; //Default for other charges, e.g. APT and Mulliken
end;
end;
procedure TForm1.ChkboxAtomIdentifothersectChange(Sender: TObject);
begin
if (ChkboxAtomIdentifothersect.Checked=True) then
begin
ChkboxAtomIdentifsamesect.Checked:=False;
lbledtAtomIdentifotherline.Show;
end
else
ChkboxAtomIdentifsamesect.Checked:=True;
end;
procedure TForm1.ChkboxAtomIdentifsamesectChange(Sender: TObject);
begin
if (ChkboxAtomIdentifsamesect.Checked=True) then
begin
ChkboxAtomIdentifothersect.Checked:=False;
lbledtAtomIdentifotherline.Hide;
lbledtAtomIdentifotherline.Text:='';
end
else
ChkboxAtomIdentifothersect.Checked:=True;
end;
procedure TForm1.ChkboxNBOChange(Sender: TObject);
begin
if ChkboxNBO.Checked=true then
begin
ChkboxMull.Checked:=false;
ChkboxAPT.Checked:=false;
ChkboxNoCharge.Checked:=false;
lbledtatomidentcol.Text:='1';
end;
end;
procedure TForm1.ChkboxNoChargeChange(Sender: TObject);
begin
if ChkboxNoCharge.Checked=True then
begin
ChkboxMull.Checked:=False;
ChkboxAPT.Checked:=False;
ChkboxNBO.Checked:=False;
ChkboxChargeothersect.Checked:=False;
ChkboxChargesamesect.Checked:=False;
lbledtChargeotherline.Hide;
lbledtChargeotherline.Text:='';
BtnCopyFromAtomIdentif.Hide;
lbledtatomchargcol.Text:='0';
lbledtatomchargcol.Color:=clGray;
end;
if ChkboxNoCharge.Checked=False then
lbledtatomchargcol.Color:=clDefault;
end;
procedure TForm1.lbledtxcoordcolExit(Sender: TObject);
begin
if (lbledtxcoordcol.Text<>'') then
begin
lbledtycoordcol.Text:=IntToStr(StrToInt(lbledtxcoordcol.Text)+1);
lbledtzcoordcol.Text:=IntToStr(StrToInt(lbledtxcoordcol.Text)+2);
end;
end;
procedure TForm1.MemoDisplayInputNameMouseEnter(Sender: TObject);
begin
MemoDisplayInputName.ScrollBars:=ssAutoBoth;
end;
end.
| 42.060012 | 265 | 0.660192 |
fcfd7d22ebbd6faa33c85cdf8178226b091ac8cd | 5,997 | pas | Pascal | _ConectionDmod.pas | NetVaIT/Estandar | 1961b92ce444a133b340c8020720f1c7231b830a | [
"Apache-2.0"
]
| null | null | null | _ConectionDmod.pas | NetVaIT/Estandar | 1961b92ce444a133b340c8020720f1c7231b830a | [
"Apache-2.0"
]
| null | null | null | _ConectionDmod.pas | NetVaIT/Estandar | 1961b92ce444a133b340c8020720f1c7231b830a | [
"Apache-2.0"
]
| null | null | null | (******************************************************************************
Proyecto Delphi Standard
Copyright (C) 2008-2015 - Jesus Huante Caballero
******************************************************************************)
unit _ConectionDmod;
interface
uses
SysUtils, Classes, Controls, DB, ADODB, Vcl.Dialogs, System.UITypes, _Utils;
type
T_dmConection = class(TDataModule)
ADOConnection: TADOConnection;
adoqUsuarios: TADOQuery;
adoqUsuariosIdUsuario: TAutoIncField;
adoqUsuariosIdPersona: TIntegerField;
adoqUsuariosRazonSocial: TStringField;
adoqUsuariosLogin: TStringField;
adoqUsuariosPassword: TStringField;
adoqUsuariosPermisoMenu: TStringField;
adoqUsuariosPermisoOpcion: TStringField;
adoqUsuariosPermisosFuncion: TStringField;
ADOQryRespaldo: TADOQuery;
procedure ADOConnectionConnectComplete(Connection: TADOConnection;
const Error: Error; var EventStatus: TEventStatus);
procedure ADOConnectionDisconnect(Connection: TADOConnection;
var EventStatus: TEventStatus);
private
{ Private declarations }
// FNombreOperador: String;
// FOperador: String;
FConectionCaption: String;
// FIndiceOperador: Integer;
FExePath: string;
FADMIN_PROD: String;
FNombrePersona: string;
FIdUsuario: Integer;
FIdPersona: Integer;
FUsuario: string;
FPerOpcion: String; //Aban Abr. 25/16
FPerMenu: String; //Aban Abr. 25/16
FPerFuncion: String; //Aban Abr. 25/16
procedure SetExePath(const Value: string);
public
{ Public declarations }
function TryToConnect: Boolean;
function Login: Boolean;
procedure Logout;
function EnabledAction(pTag: Integer): Boolean;
property ExePath: string read FExePath write SetExePath;
property ConectionCaption: String read FConectionCaption;
property IdUsuario: Integer read FIdUsuario;
property Usuario: string read FUsuario;
property IdPersona: Integer read FIdPersona;
property NombrePersona: string read FNombrePersona;
// property IndiceOperador: Integer read FIndiceOperador;
// property Operador: String read FOperador;
// property NombreOperador: String read FNombreOperador;
property ADMIN_PROD: String read FADMIN_PROD;
property PerMenu:String read FPerMenu; //Aban Abr. 25/16
property PerOpcion:String read FPerOpcion; //Aban Abr. 25/16
property PerFuncion:String read FPerFuncion; //Aban Abr. 25/16
end;
var
_dmConection: T_dmConection;
implementation
uses _LoginForm;
{$R *.dfm}
{ T_dmConection }
procedure T_dmConection.ADOConnectionConnectComplete(Connection: TADOConnection;
const Error: Error; var EventStatus: TEventStatus);
begin
case EventStatus of
esOK: FConectionCaption:= 'Conectado a: ' + Connection.DefaultDatabase;
// begin
// if adocTME.Connected
// then FConectionCaption:= 'Conectado a: ' + Connection.DefaultDatabase
// else FConectionCaption:= 'Desconectado';
// end;
esErrorsOccured: FConectionCaption:= 'Error: ' + Error.Description;
esCantDeny: FConectionCaption:= 'Acceso denegado';
esCancel: ;
esUnwantedEvent: ;
end;
end;
function T_dmConection.TryToConnect: Boolean;
begin
Result:= True;
try
ADOConnection.Open;
ADOConnection.Close;
except
MessageDlg(strNotConnectToDB, mtError, [mbOK], 0);
Result:= False;
end;
end;
procedure T_dmConection.ADOConnectionDisconnect(Connection: TADOConnection;
var EventStatus: TEventStatus);
begin
case EventStatus of
esOK: FConectionCaption:= 'Desconectado';
esErrorsOccured: FConectionCaption:= 'Error';
esCantDeny: FConectionCaption:= 'Acceso denegado';
esCancel: ;
esUnwantedEvent: ;
end;
end;
function T_dmConection.EnabledAction(pTag: Integer): Boolean;
var
vValor: String;
begin
vValor:= Copy(FADMIN_PROD, pTag, 1);
Result := vValor = '1';
end;
function T_dmConection.Login: Boolean;
var
frmLogin: T_frmLogin;
EnterApp: Boolean;
function LoginCorrect: Boolean;
begin
adoqUsuarios.Open;
if adoqUsuarios.Locate('Login', frmLogin.User, []) then
if (frmLogin.Password = Trim(adoqusuariosPassword.AsString)) then
begin
Result:= True;
FIdUsuario:= adoqUsuariosIdUsuario.Value;
FUsuario:= adoqUsuariosLogin.AsString;
FIdPersona:= adoqUsuariosIdPersona.Value;
FNombrePersona:= adoqUsuariosRazonSocial.AsString;
// FADMIN_PROD:= adoqOperadoresADMIN_PROD.Value;
FPerMenu:=adoqUsuariosPermisoMenu.Value; //Abr 25/16
FPerOpcion:=adoqUsuariosPermisoOpcion.Value; //Abr 25/16
FPerFuncion:=adoqUsuariosPermisosFuncion.Value; //Abr 26/16
end
else
begin
MessageDlg(strIncorrectPass, mtInformation, [mbOK], 0);
Result:= False;
end
else
begin
MessageDlg(strIncorrectUser, mtInformation, [mbOK], 0);
Result:= False;
end;
adoqUsuarios.Close;
end;
begin
try
Result:= False;
frmLogin:= T_frmLogin.Create(nil);
repeat
if frmLogin.ShowModal = mrOk then
begin
ADOConnection.Open;
if LoginCorrect then
begin
EnterApp := True;
Result := True;
end
else
begin
ADOConnection.Close;
EnterApp := False;
end;
end
else
begin
EnterApp := True;
Result := False;
end;
until EnterApp;
finally
FreeAndNil(frmLogin);
end;
end;
procedure T_dmConection.Logout;
begin
FUsuario:= '';
FNombrePersona:= '';
ADOConnection.Close;
end;
procedure T_dmConection.SetExePath(const Value: string);
begin
FExePath := Value;
ADOConnection.Close;
ADOConnection.ConnectionString := strConectionFileName + Value + strConectionADOFile;
end;
end.
| 28.831731 | 88 | 0.664165 |
fcb2874513db7038ba65be7e700a6c31678a714c | 11,764 | pas | Pascal | references/mORMot/SQLite3/Samples/27 - CrossPlatform Clients/mORMotClient.pas | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| 851 | 2018-02-05T09:54:56.000Z | 2022-03-24T23:13:10.000Z | references/mORMot/SQLite3/Samples/27 - CrossPlatform Clients/mORMotClient.pas | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| 200 | 2018-02-06T18:52:39.000Z | 2022-03-24T19:59:14.000Z | references/mORMot/SQLite3/Samples/27 - CrossPlatform Clients/mORMotClient.pas | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| 197 | 2018-03-20T20:49:55.000Z | 2022-03-21T17:38:14.000Z | /// remote access to a mORMot server using SynCrossPlatform* units
// - retrieved from http://localhost:888/root/wrapper/CrossPlatform/mORMotClient.pas
// at 2014-12-10 21:28:46 using "CrossPlatform.pas.mustache" template
unit mORMotClient;
{
WARNING:
This unit has been generated by a mORMot 1.18.626 server.
Any manual modification of this file may be lost after regeneration.
Synopse mORMot framework. Copyright (C) 2014 Arnaud Bouchez
Synopse Informatique - https://synopse.info
This unit is released under a MPL/GPL/LGPL tri-license,
and therefore may be freely included in any application.
This unit would work on Delphi 6 and later, under all supported platforms
(including MacOSX, and NextGen iPhone/iPad), and the Free Pascal Compiler.
}
interface
uses
SynCrossPlatformJSON,
SynCrossPlatformSpecific,
SynCrossPlatformREST;
type // define some enumeration types, used below
TPeopleSexe = (sFemale, sMale);
TRecordEnum = (reOne, reTwo, reLast);
type // define some record types, used as properties below
TTestCustomJSONArraySimpleArray = record
F: String;
G: array of String;
H: record
H1: Integer;
H2: String;
H3: record
H3a: Boolean;
H3b: TSQLRawBlob;
end;
end;
I: TDateTime;
J: array of record
J1: Byte;
J2: TGUID;
J3: TRecordEnum;
end;
end;
TSimpleRecord = record
A: Integer;
B: Integer;
C: String;
end;
type // define some dynamic array types, used as properties below
TPeopleSexeDynArray = array of Byte;
TSimpleRecordDynArray = array of TSimpleRecord;
type
/// map "People" table
TSQLRecordPeople = class(TSQLRecord)
protected
fFirstName: String;
fLastName: String;
fData: TSQLRawBlob;
fYearOfBirth: Integer;
fYearOfDeath: Word;
fSexe: TPeopleSexe;
fSimple: TTestCustomJSONArraySimpleArray;
public
property Simple: TTestCustomJSONArraySimpleArray read fSimple write fSimple;
published
property FirstName: String read fFirstName write fFirstName;
property LastName: String read fLastName write fLastName;
property Data: TSQLRawBlob read fData write fData;
property YearOfBirth: Integer read fYearOfBirth write fYearOfBirth;
property YearOfDeath: Word read fYearOfDeath write fYearOfDeath;
property Sexe: TPeopleSexe read fSexe write fSexe;
end;
/// service implemented by TServiceCalculator
// - you can access this service as such:
// !var aCalculator: ICalculator;
// !begin
// ! aCalculator := TCalculator.Create(aClient);
// ! // now you can use aCalculator methods
// !...
ICalculator = interface(IServiceAbstract)
['{9A60C8ED-CEB2-4E09-87D4-4A16F496E5FE}']
function Add(const n1: Integer; const n2: Integer): Integer;
procedure ToText(const Value: Currency; const Curr: String; var Sexe: TPeopleSexe; var Name: String);
function RecordToText(var Rec: TTestCustomJSONArraySimpleArray): String;
function GetPeople(const id: TID; out People: TSQLRecordPeople; out Sexes: TPeopleSexeDynArray; var arr: TSimpleRecordDynArray): Boolean;
end;
/// implements ICalculator from http://localhost:888/root/Calculator
// - this service will run in sicShared mode
TServiceCalculator = class(TServiceClientAbstract,ICalculator)
public
constructor Create(aClient: TSQLRestClientURI); override;
function Add(const n1: Integer; const n2: Integer): Integer;
procedure ToText(const Value: Currency; const Curr: String; var Sexe: TPeopleSexe; var Name: String);
function RecordToText(var Rec: TTestCustomJSONArraySimpleArray): String;
function GetPeople(const id: TID; out People: TSQLRecordPeople; out Sexes: TPeopleSexeDynArray; var arr: TSimpleRecordDynArray): Boolean;
end;
const
/// the server port, corresponding to http://localhost:888
SERVER_PORT = 888;
/// return the database Model corresponding to this server
function GetModel: TSQLModel;
/// create a TSQLRestClientHTTP instance and connect to the server
// - it will use by default port 888
// - secure connection will be established via TSQLRestServerAuthenticationDefault
// with the supplied credentials - on connection or authentication error,
// this function will raise a corresponding exception
function GetClient(const aServerAddress, aUserName,aPassword: string;
aServerPort: integer=SERVER_PORT): TSQLRestClientHTTP;
// publish some low-level helpers for variant conversion
// - used internally: you should not need those functions in your end-user code
function Variant2TPeopleSexe(const _variant: variant): TPeopleSexe;
function Variant2TRecordEnum(const _variant: variant): TRecordEnum;
function Variant2TTestCustomJSONArraySimpleArray(_variant: variant): TTestCustomJSONArraySimpleArray;
function TTestCustomJSONArraySimpleArray2Variant(const _record: TTestCustomJSONArraySimpleArray): variant;
function Variant2TSimpleRecord(_variant: variant): TSimpleRecord;
function TSimpleRecord2Variant(const _record: TSimpleRecord): variant;
function Variant2TPeopleSexeDynArray(const _variant: variant): TPeopleSexeDynArray;
function TPeopleSexeDynArray2Variant(const _array: TPeopleSexeDynArray): variant;
function Variant2TSimpleRecordDynArray(const _variant: variant): TSimpleRecordDynArray;
function TSimpleRecordDynArray2Variant(const _array: TSimpleRecordDynArray): variant;
implementation
{ Some helpers for enumerates types }
function Variant2TPeopleSexe(const _variant: variant): TPeopleSexe;
begin
result := TPeopleSexe(VariantToEnum(_variant,['sFemale','sMale']));
end;
function Variant2TRecordEnum(const _variant: variant): TRecordEnum;
begin
result := TRecordEnum(VariantToEnum(_variant,['reOne','reTwo','reLast']));
end;
{ Some helpers for record types }
function Variant2TTestCustomJSONArraySimpleArray(_variant: variant): TTestCustomJSONArraySimpleArray;
var _a: integer;
_arr: PJSONVariantData;
begin
result.F := _variant.F;
_arr := JSONVariantDataSafe(_variant.G,jvArray);
SetLength(result.G,_arr^.Count);
for _a := 0 to high(result.G) do
result.G[_a] := _arr^.Values[_a];
result.H.H1 := _variant.H.H1;
result.H.H2 := _variant.H.H2;
result.H.H3.H3a := _variant.H.H3.H3a;
result.H.H3.H3b := VariantToBlob(_variant.H.H3.H3b);
result.I := Iso8601ToDateTime(_variant.I);
_arr := JSONVariantDataSafe(_variant.J,jvArray);
SetLength(result.J,_arr^.Count);
for _a := 0 to high(result.J) do
with result.J[_a] do begin
J1 := _arr^.Values[_a].J1;
J2 := VariantToGUID(_arr^.Values[_a].J2);
J3 := Variant2TRecordEnum(_arr^.Values[_a].J3);
end;
end;
function TTestCustomJSONArraySimpleArray2Variant(const _record: TTestCustomJSONArraySimpleArray): variant;
var i: integer;
res: TJSONVariantData;
begin
res.Init;
res.SetPath('F',_record.F);
with res.EnsureData('G')^ do
for i := 0 to high(_record.G) do
AddValue(_record.G[i]);
res.SetPath('H.H1',_record.H.H1);
res.SetPath('H.H2',_record.H.H2);
res.SetPath('H.H3.H3a',_record.H.H3.H3a);
res.SetPath('H.H3.H3b',BlobToVariant(_record.H.H3.H3b));
res.SetPath('I',DateTimeToIso8601(_record.I));
with res.EnsureData('J')^ do
for i := 0 to high(_record.J) do
with AddItem^, _record.J[i] do begin
AddNameValue('J1',J1);
AddNameValue('J2',GUIDToVariant(J2));
AddNameValue('J3',ord(J3));
end;
result := variant(res);
end;
function Variant2TSimpleRecord(_variant: variant): TSimpleRecord;
begin
result.A := _variant.A;
result.B := _variant.B;
result.C := _variant.C;
end;
function TSimpleRecord2Variant(const _record: TSimpleRecord): variant;
var res: TJSONVariantData;
begin
res.Init;
res.SetPath('A',_record.A);
res.SetPath('B',_record.B);
res.SetPath('C',_record.C);
result := variant(res);
end;
{ Some helpers for dynamic array types }
function Variant2TPeopleSexeDynArray(const _variant: variant): TPeopleSexeDynArray;
var i: integer;
arr: PJSONVariantData;
begin
arr := JSONVariantDataSafe(_variant,jvArray);
SetLength(result,arr^.Count);
for i := 0 to arr^.Count-1 do
result[i] := (arr^.Values[i]);
end;
function TPeopleSexeDynArray2Variant(const _array: TPeopleSexeDynArray): variant;
var i: integer;
res: TJSONVariantData;
begin
res.Init;
for i := 0 to high(_array) do
res.AddValue((_array[i]));
result := variant(res);
end;
function Variant2TSimpleRecordDynArray(const _variant: variant): TSimpleRecordDynArray;
var i: integer;
arr: PJSONVariantData;
begin
arr := JSONVariantDataSafe(_variant,jvArray);
SetLength(result,arr^.Count);
for i := 0 to arr^.Count-1 do
result[i] := Variant2TSimpleRecord(arr^.Values[i]);
end;
function TSimpleRecordDynArray2Variant(const _array: TSimpleRecordDynArray): variant;
var i: integer;
res: TJSONVariantData;
begin
res.Init;
for i := 0 to high(_array) do
res.AddValue(TSimpleRecord2Variant(_array[i]));
result := variant(res);
end;
function GetModel: TSQLModel;
begin
result := TSQLModel.Create([TSQLAuthUser,TSQLAuthGroup,TSQLRecordPeople],'root');
end;
function GetClient(const aServerAddress, aUserName,aPassword: string;
aServerPort: integer): TSQLRestClientHTTP;
begin
result := TSQLRestClientHTTP.Create(aServerAddress,aServerPort,GetModel,true); // aOwnModel=true
try
if (not result.Connect) or (result.ServerTimeStamp=0) then
raise ERestException.CreateFmt('Impossible to connect to %s:%d server',
[aServerAddress,aServerPort]);
if not result.SetUser(TSQLRestServerAuthenticationDefault,aUserName,aPassword) then
raise ERestException.CreateFmt('%s:%d server rejected "%s" credentials',
[aServerAddress,aServerPort,aUserName]);
except
result.Free;
raise;
end;
end;
{ TServiceCalculator }
constructor TServiceCalculator.Create(aClient: TSQLRestClientURI);
begin
fServiceName := 'Calculator';
fServiceURI := 'Calculator';
fInstanceImplementation := sicShared;
fContractExpected := '814F1362B19B2F4D';
inherited Create(aClient);
end;
function TServiceCalculator.Add(const n1: Integer; const n2: Integer): Integer;
var res: TVariantDynArray;
begin
fClient.CallRemoteService(self,'Add',1, // raise EServiceException on error
[n1,n2],res);
Result := res[0];
end;
procedure TServiceCalculator.ToText(const Value: Currency; const Curr: String; var Sexe: TPeopleSexe; var Name: String);
var res: TVariantDynArray;
begin
fClient.CallRemoteService(self,'ToText',2, // raise EServiceException on error
[Value,Curr,ord(Sexe),Name],res);
Sexe := Variant2TPeopleSexe(res[0]);
Name := res[1];
end;
function TServiceCalculator.RecordToText(var Rec: TTestCustomJSONArraySimpleArray): String;
var res: TVariantDynArray;
begin
fClient.CallRemoteService(self,'RecordToText',2, // raise EServiceException on error
[TTestCustomJSONArraySimpleArray2Variant(Rec)],res);
Rec := Variant2TTestCustomJSONArraySimpleArray(res[0]);
Result := res[1];
end;
function TServiceCalculator.GetPeople(const id: TID; out People: TSQLRecordPeople; out Sexes: TPeopleSexeDynArray; var arr: TSimpleRecordDynArray): Boolean;
var res: TVariantDynArray;
begin
fClient.CallRemoteService(self,'GetPeople',4, // raise EServiceException on error
[id,TSimpleRecordDynArray2Variant(arr)],res);
People := TSQLRecordPeople.CreateFromVariant(res[0]);
Sexes := Variant2TPeopleSexeDynArray(res[1]);
arr := Variant2TSimpleRecordDynArray(res[2]);
Result := res[3];
end;
end. | 34.6 | 157 | 0.725349 |
fc7fcc56cfd09be5c7d92abb1bbc9f6b797d6559 | 3,672 | dfm | Pascal | Capitulo8/2.3.HerancaVisual/Form.Login.dfm | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 10 | 2017-08-02T00:44:41.000Z | 2021-10-13T21:11:28.000Z | Capitulo8/2.3.HerancaVisual/Form.Login.dfm | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 10 | 2019-12-30T04:09:37.000Z | 2022-03-02T06:06:19.000Z | Capitulo8/2.3.HerancaVisual/Form.Login.dfm | diondcm/exemplos-delphi | 16b4d195981e5f3161d0a2c62f778bec5ba9f3d4 | [
"MIT"
]
| 9 | 2017-04-29T16:12:21.000Z | 2020-11-11T22:16:32.000Z | inherited frmLogin: TfrmLogin
Caption = 'Logar'
ClientHeight = 215
ExplicitHeight = 254
PixelsPerInch = 96
TextHeight = 13
inherited Image1: TImage
AlignWithMargins = True
Left = 10
Top = 10
Height = 195
Margins.Left = 10
Margins.Top = 10
Margins.Bottom = 10
Align = alLeft
ExplicitLeft = 8
ExplicitTop = 8
end
object Panel1: TPanel
Left = 112
Top = 32
Width = 289
Height = 145
TabOrder = 0
object Label1: TLabel
Left = 8
Top = 24
Width = 25
Height = 13
Caption = 'Login'
end
object Label2: TLabel
Left = 8
Top = 51
Width = 30
Height = 13
Caption = 'Senha'
end
object EditLogin: TEdit
Left = 72
Top = 21
Width = 150
Height = 21
TabOrder = 0
end
object EditSenha: TEdit
Left = 72
Top = 48
Width = 121
Height = 21
TabOrder = 1
end
object ButtonCancelar: TBitBtn
Left = 104
Top = 112
Width = 82
Height = 25
Cancel = True
Caption = 'Cancel'
Glyph.Data = {
DE010000424DDE01000000000000760000002800000024000000120000000100
0400000000006801000000000000000000001000000000000000000000000000
80000080000000808000800000008000800080800000C0C0C000808080000000
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
333333333333333333333333000033338833333333333333333F333333333333
0000333911833333983333333388F333333F3333000033391118333911833333
38F38F333F88F33300003339111183911118333338F338F3F8338F3300003333
911118111118333338F3338F833338F3000033333911111111833333338F3338
3333F8330000333333911111183333333338F333333F83330000333333311111
8333333333338F3333383333000033333339111183333333333338F333833333
00003333339111118333333333333833338F3333000033333911181118333333
33338333338F333300003333911183911183333333383338F338F33300003333
9118333911183333338F33838F338F33000033333913333391113333338FF833
38F338F300003333333333333919333333388333338FFF830000333333333333
3333333333333333333888330000333333333333333333333333333333333333
0000}
NumGlyphs = 2
TabOrder = 2
OnClick = ButtonCancelarClick
end
object BitBtn2: TBitBtn
Left = 208
Top = 112
Width = 75
Height = 25
Caption = 'OK'
Default = True
Glyph.Data = {
DE010000424DDE01000000000000760000002800000024000000120000000100
0400000000006801000000000000000000001000000000000000000000000000
80000080000000808000800000008000800080800000C0C0C000808080000000
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333
3333333333333333333333330000333333333333333333333333F33333333333
00003333344333333333333333388F3333333333000033334224333333333333
338338F3333333330000333422224333333333333833338F3333333300003342
222224333333333383333338F3333333000034222A22224333333338F338F333
8F33333300003222A3A2224333333338F3838F338F33333300003A2A333A2224
33333338F83338F338F33333000033A33333A222433333338333338F338F3333
0000333333333A222433333333333338F338F33300003333333333A222433333
333333338F338F33000033333333333A222433333333333338F338F300003333
33333333A222433333333333338F338F00003333333333333A22433333333333
3338F38F000033333333333333A223333333333333338F830000333333333333
333A333333333333333338330000333333333333333333333333333333333333
0000}
NumGlyphs = 2
TabOrder = 3
OnClick = BitBtn2Click
end
end
end
| 33.081081 | 72 | 0.739107 |
fc22e7576d65f3b66b1caece091c5277a279ec23 | 239 | pas | Pascal | Test/SimpleScripts/consts.pas | synapsea/DW-Script | b36c2e57f0285c217f8f0cae8e4e158d21127163 | [
"Condor-1.1"
]
| 1 | 2022-02-18T22:14:44.000Z | 2022-02-18T22:14:44.000Z | Test/SimpleScripts/consts.pas | synapsea/DW-Script | b36c2e57f0285c217f8f0cae8e4e158d21127163 | [
"Condor-1.1"
]
| null | null | null | Test/SimpleScripts/consts.pas | synapsea/DW-Script | b36c2e57f0285c217f8f0cae8e4e158d21127163 | [
"Condor-1.1"
]
| null | null | null | const ONE = 1;
const TWO = ONE + ONE;
const MINUS_ONE = -ONE;
procedure PrintOut(value : Integer = MINUS_ONE);
begin
PrintLn(IntToStr(value));
end;
PrintOut();
PrintOut(TWO+MINUS_ONE-ONE);
PrintOut(ONE);
PrintOut(TWO);
PrintOut($100); | 17.071429 | 48 | 0.711297 |
fcaac7342707acc040dc53eb2bc5361885df4e3a | 815 | pas | Pascal | untCalculo.pas | fabriciosilvaJr/Calculadora | e41926a717380e78ec33ffab971590ea7495b685 | [
"MIT"
]
| null | null | null | untCalculo.pas | fabriciosilvaJr/Calculadora | e41926a717380e78ec33ffab971590ea7495b685 | [
"MIT"
]
| null | null | null | untCalculo.pas | fabriciosilvaJr/Calculadora | e41926a717380e78ec33ffab971590ea7495b685 | [
"MIT"
]
| null | null | null | unit untCalculo;
interface
type
TSomar = class
function SomaValores(n1,n2:real): string;
end;
type
TSubtrair = class
function SubtrairValores(n1, n2: real): string;
end;
type
TMultiplicar = class
function MultiplicarValores(n1, n2: real): string;
end;
type
TDiv = class
function DivValores(n1, n2: real): string;
end;
implementation
uses System.SysUtils;
{ TCalculo }
function TSomar.SomaValores(n1, n2: real): string;
begin
result:= FloatToStr(n1+n2);
end;
function TSubtrair.SubtrairValores(n1,n2:real): string;
begin
result:= FloatToStr(n1-n2);
end;
function TMultiplicar.MultiplicarValores(n1, n2: real): string;
begin
result:= FloatToStr(n1*n2);
end;
function Tdiv.DivValores(n1, n2: real): string;
begin
result:= FloatToStr(n1/n2);
end;
end.
| 11.478873 | 63 | 0.70184 |
47411fac0aa3682e7a7937c7430676fadb6b0b4d | 1,099 | dpr | Pascal | Experiments/StructureViewer/StructureViewer.dpr | atkins126/READCOM_App | 8425eaa5c134caee33a89dc77b57593a418a4eda | [
"MIT"
]
| null | null | null | Experiments/StructureViewer/StructureViewer.dpr | atkins126/READCOM_App | 8425eaa5c134caee33a89dc77b57593a418a4eda | [
"MIT"
]
| null | null | null | Experiments/StructureViewer/StructureViewer.dpr | atkins126/READCOM_App | 8425eaa5c134caee33a89dc77b57593a418a4eda | [
"MIT"
]
| null | null | null | program StructureViewer;
uses
System.StartUpCopy,
FMX.Forms,
uMainForm in 'uMainForm.pas' {MainForm},
uHidableFrame in 'uHidableFrame.pas' {HidableFrame: TFrame},
Zoomicon.Introspection.FMX.StructureView in '..\..\Zoomicon.Introspection\Zoomicon.Introspection.FMX.StructureView.pas' {StructureView: TFrame},
Zoomicon.Helpers.FMX.ImgList.ImageListHelpers in '..\..\Zooming.Helpers\Zoomicon.Helpers.FMX.ImgList\Zoomicon.Helpers.FMX.ImgList.ImageListHelpers.pas',
Zoomicon.Helpers.FMX.Controls.ControlHelpers in '..\..\Zooming.Helpers\Zoomicon.Helpers.FMX.Controls\Zoomicon.Helpers.FMX.Controls.ControlHelpers.pas',
Zoomicon.Helpers.RTL.ClassListHelpers in '..\..\Zooming.Helpers\Zoomicon.Helpers.RTL\Zoomicon.Helpers.RTL.ClassListHelpers.pas',
Zoomicon.Helpers.FMX.TreeView.TreeViewHelpers in '..\..\Zooming.Helpers\Zoomicon.Helpers.FMX.TreeView\Zoomicon.Helpers.FMX.TreeView.TreeViewHelpers.pas';
{$R *.res}
begin
{$IFDEF DEBUG}
ReportMemoryLeaksOnShutdown := True;
{$ENDIF}
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.
| 43.96 | 155 | 0.786169 |
c351e6d600353237d9024ca9e7212a7213543c05 | 6,304 | pas | Pascal | windows/src/developer/TIKE/dialogs/languages/Keyman.Developer.UI.UfrmSelectBCP47Language.pas | ermshiperete/keyman | 0eeef1b5794fd698447584e531e2a6c1ef4c05aa | [
"MIT"
]
| 1 | 2021-03-08T09:31:47.000Z | 2021-03-08T09:31:47.000Z | windows/src/developer/TIKE/dialogs/languages/Keyman.Developer.UI.UfrmSelectBCP47Language.pas | ermshiperete/keyman | 0eeef1b5794fd698447584e531e2a6c1ef4c05aa | [
"MIT"
]
| null | null | null | windows/src/developer/TIKE/dialogs/languages/Keyman.Developer.UI.UfrmSelectBCP47Language.pas | ermshiperete/keyman | 0eeef1b5794fd698447584e531e2a6c1ef4c05aa | [
"MIT"
]
| null | null | null | (*
Name: UfrmSelectBCP47Language
Copyright: Copyright (C) SIL International.
Date: 7 Dec 2017
Authors: mcdurdin
*)
unit Keyman.Developer.UI.UfrmSelectBCP47Language;
interface
uses
System.Classes,
System.SysUtils,
System.Variants,
Winapi.Messages,
Winapi.Windows,
Vcl.Controls,
Vcl.Dialogs,
Vcl.Forms,
Vcl.Graphics,
Vcl.StdCtrls,
UfrmTike,
BCP47Tag, Vcl.ExtCtrls;
type
TfrmSelectBCP47Language = class(TTikeForm)
cmdOK: TButton;
cmdCancel: TButton;
lblLanguageTag: TLabel;
lblScriptTag: TLabel;
lblRegionTag: TLabel;
cbLanguageTag: TComboBox;
cbScriptTag: TComboBox;
cbRegionTag: TComboBox;
lblBCP47Code: TLabel;
editBCP47Code: TEdit;
lblValidateCode: TLabel;
lblLanguageName: TLabel;
lblScriptName: TLabel;
lblRegionName: TLabel;
lblLinkToW3C: TLinkLabel;
Label1: TLabel;
editLanguageName: TEdit;
cmdResetLanguageName: TButton;
procedure cbLanguageTagChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure cbScriptTagChange(Sender: TObject);
procedure cbRegionTagChange(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure lblLinkToW3CLinkClick(Sender: TObject; const Link: string;
LinkType: TSysLinkType);
procedure cmdResetLanguageNameClick(Sender: TObject);
procedure editLanguageNameChange(Sender: TObject);
private
tag: TBCP47Tag;
FCustomLanguageName: Boolean;
function GetLanguageID: string;
function GetLanguageName: string;
procedure RefreshLanguageName;
procedure SetLanguageID(const Value: string);
procedure SetLanguageName(const Value: string);
function LookupLanguageName: string;
protected
function GetHelpTopic: string; override;
public
{ Public declarations }
property LanguageID: string read GetLanguageID write SetLanguageID;
property LanguageName: string read GetLanguageName write SetLanguageName;
end;
implementation
uses
System.Generics.Collections,
Keyman.Developer.System.HelpTopics,
Keyman.System.CanonicalLanguageCodeUtils,
Keyman.System.KMXFileLanguages,
Keyman.System.LanguageCodeUtils,
utilexecute;
{$R *.dfm}
{ TfrmSelectBCP47Language }
procedure TfrmSelectBCP47Language.FormCreate(Sender: TObject);
procedure PopulateComboBoxFromDict(cb: TComboBox; dict: TDictionary<string, string>);
var
i: Integer;
a: TArray<TPair<string,string>>;
begin
cb.Items.BeginUpdate;
try
a := dict.ToArray;
for i := 0 to Length(a) - 1 do
cb.Items.Add(a[i].Key);
finally
cb.Items.EndUpdate;
end;
end;
begin
inherited;
tag := TBCP47Tag.Create('');
PopulateComboBoxFromDict(cbLanguageTag, TLanguageCodeUtils.BCP47Languages);
PopulateComboBoxFromDict(cbScriptTag, TLanguageCodeUtils.BCP47Scripts);
PopulateComboBoxFromDict(cbRegionTag, TLanguageCodeUtils.BCP47Regions);
end;
procedure TfrmSelectBCP47Language.FormDestroy(Sender: TObject);
begin
inherited;
FreeAndNil(tag);
end;
function TfrmSelectBCP47Language.GetHelpTopic: string;
begin
Result := SHelpTopic_Context_SelectBCP47Language;
end;
function TfrmSelectBCP47Language.GetLanguageID: string;
begin
Result := tag.Tag;
end;
function TfrmSelectBCP47Language.GetLanguageName: string;
begin
Result := editLanguageName.Text;
end;
procedure TfrmSelectBCP47Language.lblLinkToW3CLinkClick(Sender: TObject;
const Link: string; LinkType: TSysLinkType);
begin
TUtilExecute.URL(Link);
end;
function TfrmSelectBCP47Language.LookupLanguageName: string;
begin
Result := TLanguageCodeUtils.LanguageName(lblLanguageName.Caption, lblScriptName.Caption, lblRegionName.Caption);
end;
procedure TfrmSelectBCP47Language.cmdResetLanguageNameClick(Sender: TObject);
begin
editLanguageName.Text := LookupLanguageName;
FCustomLanguageName := False;
end;
procedure TfrmSelectBCP47Language.editLanguageNameChange(Sender: TObject);
begin
FCustomLanguageName := True;
end;
procedure TfrmSelectBCP47Language.cbLanguageTagChange(Sender: TObject);
var
t: string;
begin
inherited;
tag.Language := TKMXFileLanguages.TranslateISO6393ToBCP47(cbLanguageTag.Text);
t := TCanonicalLanguageCodeUtils.FindBestTag(Tag.Tag);
if t <> '' then
begin
with TBCP47Tag.Create(t) do
try
cbScriptTag.Text := Script;
Self.tag.Script := Script;
finally
Free;
end;
end
else
begin
cbScriptTag.Text := '';
tag.Script := '';
end;
FCustomLanguageName := False; // Always reset when entering a language tag.
RefreshLanguageName;
end;
procedure TfrmSelectBCP47Language.cbRegionTagChange(Sender: TObject);
begin
inherited;
tag.Region := cbRegionTag.Text;
RefreshLanguageName;
end;
procedure TfrmSelectBCP47Language.cbScriptTagChange(Sender: TObject);
begin
inherited;
tag.Script := cbScriptTag.Text;
RefreshLanguageName;
end;
procedure TfrmSelectBCP47Language.RefreshLanguageName;
var
msg: string;
function GetDictEntry(subtag: string; dict: TDictionary<string,string>): string;
begin
if subtag = '' then
Result := ''
else if not dict.TryGetValue(subtag, Result) then
Result := subtag;
end;
begin
editBCP47Code.Text := tag.Tag;
lblLanguageName.Caption := GetDictEntry(tag.Language, TLanguageCodeUtils.BCP47Languages);
lblScriptName.Caption := GetDictEntry(tag.Script, TLanguageCodeUtils.BCP47Scripts);
lblRegionName.Caption := GetDictEntry(tag.Region, TLanguageCodeUtils.BCP47Regions);
if not FCustomLanguageName then
begin
editLanguageName.Text := LookupLanguageName;
FCustomLanguageName := False;
end;
cmdOK.Enabled := tag.IsValid(True, msg);
if not cmdOK.Enabled
then lblValidateCode.Caption := msg
else lblValidateCode.Caption := 'This is a valid BCP 47 tag';
end;
procedure TfrmSelectBCP47Language.SetLanguageID(const Value: string);
begin
tag.Tag := Value;
cbLanguageTag.Text := tag.Language;
cbRegionTag.Text := tag.Region;
cbScriptTag.Text := tag.Script;
RefreshLanguageName;
FCustomLanguageName := editLanguageName.Text <> LookupLanguageName;
end;
procedure TfrmSelectBCP47Language.SetLanguageName(const Value: string);
begin
editLanguageName.Text := Value;
FCustomLanguageName := editLanguageName.Text <> LookupLanguageName;
end;
end.
| 26.266667 | 115 | 0.753966 |
c325076855e69d0f6c9336d697eb727aca62aec3 | 2,302 | pas | Pascal | windows/src/global/delphi/general/UnitDrawArrow.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/global/delphi/general/UnitDrawArrow.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/global/delphi/general/UnitDrawArrow.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | unit UnitDrawArrow;
interface
uses Windows, Graphics;
procedure ArrowTo(Canvas: TCanvas; X, Y: Integer; bFill: Boolean = True; nWidth: Integer = 7; fTheta: Extended = 0.5); overload;
procedure ArrowTo(Canvas: TCanvas; Point: TPoint; bFill: Boolean = True; nWidth: Integer = 7; fTheta: Extended = 0.5); overload;
implementation
uses Math, Classes, System.Types;
procedure ArrowTo(Canvas: TCanvas; X, Y: Integer; bFill: Boolean = True; nWidth: Integer = 7; fTheta: Extended = 0.5);
begin
ArrowTo(Canvas, Point(X,Y), bFill, nWidth, fTheta);
end;
procedure ArrowTo(Canvas: TCanvas; Point: TPoint; bFill: Boolean = True; nWidth: Integer = 7; fTheta: Extended = 0.5);
var
pFrom, pBase: TPoint;
aptPoly: array[0..2] of TPoint;
vecLine, vecLeft: array[0..1] of Extended;
fLength, th, ta: Extended;
begin;
// get from point
MoveToEx(Canvas.Handle, 0, 0, @pFrom);
// set to point
aptPoly[0].x := Point.x;
aptPoly[0].y := Point.y;
// build the line vector
vecLine[0] := aptPoly[0].x - pFrom.x;
vecLine[1] := aptPoly[0].y - pFrom.y;
// build the arrow base vector - normal to the line
vecLeft[0] := -vecLine[1];
vecLeft[1] := vecLine[0];
// setup length parameters
fLength := sqrt(vecLine[0] * vecLine[0] + vecLine[1] * vecLine[1]);
th := nWidth / (2.0 * fLength);
ta := nWidth / (2.0 * (tan(fTheta) / 2.0) * fLength);
// find the base of the arrow
pBase.x := Trunc(aptPoly[0].x + -ta * vecLine[0]);
pBase.y := Trunc(aptPoly[0].y + -ta * vecLine[1]);
// build the points on the sides of the arrow
aptPoly[1].x := Trunc(pBase.x + th * vecLeft[0]);
aptPoly[1].y := Trunc(pBase.y + th * vecLeft[1]);
aptPoly[2].x := Trunc(pBase.x + -th * vecLeft[0]);
aptPoly[2].y := Trunc(pBase.y + -th * vecLeft[1]);
MoveToEx(Canvas.Handle, pFrom.x, pFrom.y, nil);
if bFill then
begin
// draw we're fillin'...
LineTo(Canvas.Handle, aptPoly[0].x, aptPoly[0].y);
Polygon(Canvas.Handle, aptPoly, 3);
end
else
begin
// ... or even jes chillin'...
LineTo(Canvas.Handle, pBase.x, pBase.y);
LineTo(Canvas.Handle, aptPoly[1].x, aptPoly[1].y);
LineTo(Canvas.Handle, aptPoly[0].x, aptPoly[0].y);
LineTo(Canvas.Handle, aptPoly[2].x, aptPoly[2].y);
LineTo(Canvas.Handle, pBase.x, pBase.y);
MoveToEx(Canvas.Handle, aptPoly[0].x, aptPoly[0].y, nil);
end;
end;
end.
| 29.896104 | 128 | 0.657255 |
f1eb815d2cf48fcc1c550a167e24e486cb60541f | 1,221 | pas | Pascal | ReplaceConfirmUnit.pas | winsys/ms | d35137fd1f0a5142e03c47345cdb81509b6d96e5 | [
"MIT"
]
| null | null | null | ReplaceConfirmUnit.pas | winsys/ms | d35137fd1f0a5142e03c47345cdb81509b6d96e5 | [
"MIT"
]
| null | null | null | ReplaceConfirmUnit.pas | winsys/ms | d35137fd1f0a5142e03c47345cdb81509b6d96e5 | [
"MIT"
]
| null | null | null | unit ReplaceConfirmUnit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TReplaceConfirmForm = class(TForm)
Label1: TLabel;
Label2: TLabel;
CheckBox1: TCheckBox;
Button1: TButton;
Button2: TButton;
Label3: TLabel;
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
ReplaceConfirmForm: TReplaceConfirmForm;
implementation
uses Main, DataUnit;
{$R *.DFM}
procedure TReplaceConfirmForm.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
if ModalResult=mrYes
then ReplaceALL:=CheckBox1.Checked;
CanClose:=true;
end;
procedure TReplaceConfirmForm.FormShow(Sender: TObject);
begin
SetLanguage(Label1, rplMsg1);
SetLanguage(Label2, rplMsg2);
SetLanguage(Label3);
SetLanguage(CheckBox1, rplMsg3);
SetLanguage(Button1, msBtn1);
SetLanguage(Button2, msBtn2);
if Label3.Left+Label3.Width+30 > Label1.Left+Label1.Width+30
then Width:=Label3.Left+Label3.Width+30
else Width:=Label1.Left+Label1.Width+30;
if Width<267 then Width:=267;
end;
end.
| 21.421053 | 75 | 0.738739 |
fcfaaa35351b6045c41e5c7104406592658aa6fa | 72,102 | pas | Pascal | crypto/rsa/mp_ratio.pas | amikey/delphi-crypto | a79895f25bff69819f354e9bf27c19e2f00fed19 | [
"Unlicense"
]
| 6 | 2019-02-15T02:47:02.000Z | 2021-08-02T22:34:34.000Z | crypto/rsa/mp_ratio.pas | amikey/delphi-crypto | a79895f25bff69819f354e9bf27c19e2f00fed19 | [
"Unlicense"
]
| null | null | null | crypto/rsa/mp_ratio.pas | amikey/delphi-crypto | a79895f25bff69819f354e9bf27c19e2f00fed19 | [
"Unlicense"
]
| 7 | 2020-05-04T21:44:13.000Z | 2021-04-02T12:42:23.000Z | unit mp_ratio;
{Multi precision rational arithmetic routines}
interface
{$ifdef VirtualPascal}
{$X+} {needed for pchars/RESULT}
{$endif}
{$i STD.INC}
{$ifdef BIT16}
{$N+}
{$X+} {needed for pchars}
{$endif}
uses
BTypes, mp_types;
{$i mp_conf.inc}
(*************************************************************************
DESCRIPTION : Multi precision rational arithmetic routines
REQUIREMENTS : BP7, D1-D7/D9-D10/D12, FPC, VP
EXTERNAL DATA : (mp_types)
MEMORY USAGE : heap
DISPLAY MODE : ---
REFERENCES : [ 3] Knuth,D.E.: TAOCP Vol 2, Seminumerical Algorithms
[14] IMath library by M.J. Fromberger
[22] LiDIA - A Library for Computational Number Theory
Version Date Author Modification
------- -------- ------- ------------------------------------------
1.0.00 11.04.07 W.Ehrhardt Initial version: mpr_init, mpr_clear
1.0.01 11.04.07 we s_mpr_normalize, mpr_set_int, mpr_(a)decimal
1.0.02 11.04.07 we mpr_copy, mpr_abs, mpr_chs, mpr_zero
1.0.03 11.04.07 we mpr_add, mpr_sub, mpr_init_xx, mpr_clear_xx
1.0.04 11.04.07 we mpr_inv, mpr_mul, mpr_div, mpr_exch
1.0.05 12.04.07 we mpr_read_radix
1.0.06 12.04.07 we mpr_cmp, mpr_cmp_mag, functions mpr_is_??
1.0.07 13.04.07 we mpr_expt, xx.used tests in mpr_is_eq
1.0.08 13.04.07 we GCDs in mpr_mul, mpr_div, s_mpr_add_sub
1.0.09 14.04.07 we improved mpr_is_ne/ge/le
1.0.10 14.04.07 we mpr_toradix_n, mpr_radix_str, mpr_write_radix etc
1.0.11 15.04.07 we improved s_mpr_add_sub
1.0.12 15.04.07 we improved mpr_write_radix
1.0.13 15.04.07 we mpr_set1, mpr_?op?_mpi
1.0.14 16.04.07 we speedup s_mpr_add_sub (about 20%)
1.0.15 22.04.07 we mpr_read_decimal
1.0.16 22.04.07 we mpr_ceil, mpr_floor, mpr_frac, mpr_trunc
1.0.17 29.04.07 we mpr_tofloat_n, mpr_tofloat_str
1.0.18 29.04.07 we fix rounding in mpr_tofloat_n
1.0.19 30.04.07 we s_mpr_tofloat_n, mpr_tofloat_astr
1.0.20 30.04.07 we mpr_round, mpr_is0, mpr_is_mp
1.0.21 01.05.07 we mpr_todouble
1.0.22 06.05.07 we mpr_read_float_radix/decimal, bugfix s_mpr_cmp_mag
1.0.23 06.05.07 we mpr_read_double
1.0.24 11.05.07 we bugfix mpr_radix_size
1.0.25 13.05.07 we Corrected some exception strings
1.0.26 13.05.07 we MPAF prefix in assert strings
1.2.00 07.09.07 we mpr_checksum
1.2.01 17.09.07 we "uses mp_base, mp_numth" in implementation
1.3.00 04.11.07 we mpr_init with mp_allocprec
1.3.01 12.11.07 we Fix memory leak(s) if MPC_HaltOnError is not defined
1.3.02 14.11.07 we mpr_radix_astr: prefill result with #0
1.5.00 31.01.08 we {$x+} for VP and D1
1.6.00 06.06.08 we function mp_gcd1 is used
1.7.00 14.09.08 we s_mpr_normalize no gcd if |num|=1 or |den|=1
1.8.00 09.10.08 we use mp_set1
1.9.00 02.12.08 we Uses BTypes: char8, pchar8
1.10.00 21.01.09 we changes related to (s)mp_divrem
1.11.01 01.04.09 we mpr_harmonic, improved mpr_todouble
1.14.00 13.02.10 we MPC_MAXRadix64 adjustments
1.15.00 13.05.10 we mp_fract_sep
1.15.01 20.05.10 we mpr_div_int, mpr_mul_int
1.15.02 21.05.10 we mpr_div_2, mpr_mul_2
1.15.04 22.05.10 we mpr_div_2k, mpr_mul_2k
**************************************************************************)
(*-------------------------------------------------------------------------
This code uses material/ideas from the following 3rd party libraries:
IMATH 1.1+ by Michael J. Fromberger
See the file '3rdparty.mpa' for the licenses.
----------------------------------------------------------------------------*)
(*-------------------------------------------------------------------------
(C) Copyright 2007-2010 Wolfgang Ehrhardt
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from
the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software in
a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
----------------------------------------------------------------------------*)
procedure mpr_abs(const a: mp_rat; var b: mp_rat);
{-absolute value, b = |a|}
procedure mpr_add(const a,b: mp_rat; var c: mp_rat);
{-add two mp_rats: c = a+b}
procedure mpr_add_mpi(const a: mp_rat; const b: mp_int; var c: mp_rat);
{-add mp_int to mp_rat: c = a+b}
{$ifdef BIT32}
function mpr_adecimal(const a: mp_rat): ansistring;
{-convert to radix representation ansistring, max 65000 digits}
{$endif}
procedure mpr_ceil(const a: mp_rat; var b: mp_int);
{-return b := ceil(a)}
function mpr_checksum(const a: mp_rat): longint;
{-return a checksum for a, -1 if mp_error<>MP_OKAY, -2 if not initialized}
procedure mpr_chs(const a: mp_rat; var b: mp_rat);
{-change sign, b = -a}
function mpr_cmp(const a,b: mp_rat): integer;
{-compare two mp_rats (signed), return sign(a-b)}
function mpr_cmp_mag(const a,b: mp_rat): integer;
{-compare magnitude of two mp_rats (unsigned), return sign(|a|-|b|)}
procedure mpr_clear(var a: mp_rat);
{-free an mp_rat}
procedure mpr_clear2(var a,b: mp_rat);
{-clear 2 mp_rats}
procedure mpr_clear3(var a,b,c: mp_rat);
{-clear 3 mp_rats}
procedure mpr_clear4(var a,b,c,d: mp_rat);
{-clear 4 mp_rats}
procedure mpr_clear5(var a,b,c,d,e: mp_rat);
{-clear 5 mp_rats}
procedure mpr_clear6(var a,b,c,d,e,f: mp_rat);
{-clear 6 mp_rats}
procedure mpr_clear_multi(var vi: array of mp_rat);
{-clear a vector of mp_rats}
procedure mpr_clear_multi_p(const pv: array of pmp_rat);
{-clear a list of mp_rats given as a ptr vector}
procedure mpr_copy(const a: mp_rat; var b: mp_rat);
{-copy an mp_rat, b: = a}
function mpr_decimal(const a: mp_rat): mp_string;
{-convert a to decimal, max 255 chars}
procedure mpr_div(const a,b: mp_rat; var c: mp_rat);
{-divide two mp_rats: c = a/b, b<>0}
procedure mpr_div_2(const a: mp_rat; var b: mp_rat);
{-divide mp_rat by 2: b = a/2}
procedure mpr_div_2k(const a: mp_rat; k: longint; var b: mp_rat);
{-divide mp_rat by 2^k: b = a/2^k}
procedure mpr_div_int(const a: mp_rat; b: longint; var c: mp_rat);
{-divide mp_rat by longint: c = a/b, b<>0}
procedure mpr_div_mpi(const a: mp_rat; const b: mp_int; var c: mp_rat);
{-divide mp_rat by mp_int: c = a/b, b<>0}
procedure mpr_exch(var a,b: mp_rat);
{-exchange two mp_rats}
procedure mpr_expt(const a: mp_rat; b: longint; var c: mp_rat);
{-calculate c = a^b, a<>0 for b<0, 0^0=1}
procedure mpr_floor(const a: mp_rat; var b: mp_int);
{-return b := floor(a)}
procedure mpr_frac(const a: mp_rat; var b: mp_rat);
{-return b := frac(a) = a - trunc(a)}
procedure mpr_harmonic(n: longint; var hn: mp_rat);
{-Compute the harmonic number hn = sum(1/i, i=1..n) with binary splitting}
procedure mpr_init(var a: mp_rat);
{-initialize an mp_rat}
procedure mpr_init2(var a,b: mp_rat);
{-initialize 2 mp_rats}
procedure mpr_init3(var a,b,c: mp_rat);
{-initialize 3 mp_rats}
procedure mpr_init4(var a,b,c,d: mp_rat);
{-initialize 4 mp_rats}
procedure mpr_init5(var a,b,c,d,e: mp_rat);
{-initialize 5 mp_rats}
procedure mpr_init6(var a,b,c,d,e,f: mp_rat);
{-initialize 6 mp_rats}
procedure mpr_init_copy(var a: mp_rat; const b: mp_rat);
{-create a, then copy b into it}
procedure mpr_init_multi(var vi: array of mp_rat);
{-initialize a vector of mp_rats.}
{ On error the already initialized mp_rats will be cleared}
procedure mpr_init_multi_p(var pv: array of pmp_rat);
{-initialize a list of mp_rats given as a ptr vector.}
{ On error the already initialized mp_rats will be cleared}
procedure mpr_init_size(var a: mp_rat; nsize, dsize: word);
{-initialize an mp_rat to given number of digits}
procedure mpr_inv(const a: mp_rat; var b: mp_rat);
{-invert an mp_rat, b = 1/a, a<>0}
function mpr_is_eq(const a,b: mp_rat): boolean;
{-return a = b}
function mpr_is_ge(const a,b: mp_rat): boolean;
{-return a >= b}
function mpr_is_gt(const a,b: mp_rat): boolean;
{-return a > b}
function mpr_is_le(const a,b: mp_rat): boolean;
{-return a <= b}
function mpr_is_lt(const a,b: mp_rat): boolean;
{-return a < b}
function mpr_is_mp(const a: mp_rat): boolean;
{-return true if a is initialized and a.den=1}
function mpr_is_ne(const a,b: mp_rat): boolean;
{-return a <> b}
function mpr_is0(const a: mp_rat): boolean;
{-return a=0}
procedure mpr_mul(const a,b: mp_rat; var c: mp_rat);
{-multiply two mp_rats: c = a*b}
procedure mpr_mul_2(const a: mp_rat; var b: mp_rat);
{-multiply mp_rat by 2: b = 2*a}
procedure mpr_mul_2k(const a: mp_rat; k: longint; var b: mp_rat);
{-multiply mp_rat by 2^k: b = a*2^k}
procedure mpr_mul_int(const a: mp_rat; b: longint; var c: mp_rat);
{-multiply mp_rat by longint: c = a*b}
procedure mpr_mul_mpi(const a: mp_rat; const b: mp_int; var c: mp_rat);
{-multiply mp_rat and mp_int: c = a*b}
function mpr_not_init(const a: mp_rat): boolean;
{-sanity check if a is initialized, does not catch all cases!}
procedure mpr_output_decimal(const a: mp_rat);
{-write decimal representation to output}
procedure mpr_output_radix(const a: mp_rat; radix: word);
{-write radix representation to output}
{$ifdef BIT32}
function mpr_radix_astr(const a: mp_rat; radix: word): ansistring;
{-convert to radix representation ansistring, max 65000 digits}
{$endif}
function mpr_radix_size(const a: mp_rat; radix: word): longint;
{-return size of ASCII representation (incl. sign and #0)}
function mpr_radix_str(const a: mp_rat; radix: word): mp_string;
{-convert to radix representation, max 255 digits}
procedure mpr_read_decimal(var a: mp_rat; str: pchar8);
{-read a ASCII decimal string radix into a. str may contain a single '/'}
procedure mpr_read_double(var a: mp_rat; d: double);
{-convert d to an mp_rat}
procedure mpr_read_float_decimal(var a: mp_rat; str: pchar8);
{-read a ASCII float decimal string into a. str may contain a single '.'}
procedure mpr_read_float_radix(var a: mp_rat; str: pchar8; radix: word);
{-read a ASCII float radix string into a. str may contain a single '.'}
procedure mpr_read_radix(var a: mp_rat; str: pchar8; radix: word);
{-read a ASCII radix string into a. str may contain a single '/'}
procedure mpr_round(const a: mp_rat; var b: mp_int);
{-return b := round(a), round(-a)=-round(a), round(n+0.5)=n+1}
procedure mpr_set(var a: mp_rat; const n, d: mp_int);
{-set a to n/d, d<>0}
procedure mpr_set1(var a: mp_rat; const n: mp_int);
{-set a to n/1}
procedure mpr_set_int(var a: mp_rat; n, d: longint);
{-set a to n/d, d<>0}
procedure mpr_sub(const a,b: mp_rat; var c: mp_rat);
{-subtract two mp_rats: c = a-b}
procedure mpr_sub_mpi(const a: mp_rat; const b: mp_int; var c: mp_rat);
{-subtract mp_int from mp_rat: c = a-b}
function mpr_todouble(const a: mp_rat): double;
{-convert a to double, +-inf if too large, 0 if too small}
{$ifdef BIT32}
function mpr_tofloat_astr(const a: mp_rat; radix, prec: word): ansistring;
{-convert to float representation with prec, max 65000 digits}
{$endif}
procedure mpr_tofloat_n(const a: mp_rat; str: pchar8; radix, prec, maxlen: word);
{-convert to float format for a given radix, prec digits after '.'}
function mpr_tofloat_str(const a: mp_rat; radix, prec: word): mp_string;
{-convert to float representation, prec digits after '.', max 255 chars}
procedure mpr_toradix_n(const a: mp_rat; str: pchar8; radix, maxlen: word);
{-convert an mp_rat to an ASCII string for a given radix (2..MAXRadix)}
procedure mpr_trunc(const a: mp_rat; var b: mp_int);
{-return b := trunc(a)}
procedure mpr_write_decimal(var tf: system.text; const a: mp_rat);
{-write decimal representation to file tf}
procedure mpr_write_radix(var tf: system.text; const a: mp_rat; radix: word);
{-write radix representation to file tf}
procedure mpr_zero(var a: mp_rat);
{-set a to zero}
{#Z+}
{---------------------------------------------------------------------------}
{- 'Internal' functions, don't use them unless you know what you are doing -}
{---------------------------------------------------------------------------}
{#Z-}
procedure s_mpr_add_sub(const a,b: mp_rat; var c: mp_rat; sub: boolean);
{-add or subtract two mp_rats}
procedure s_mpr_normalize(var a: mp_rat);
{-normalize a, assumes a is initialized}
procedure s_mpr_normsign(var a: mp_rat);
{-make denominator positive, assumes a is initialized}
procedure s_mpr_qr(const num, den: mp_int; var q,r: mp_int);
{-calculate q := abs(num) div abs(den); r := abs(num) mod abs(den), no init check}
procedure s_mpr_tofloat_n(const a: mp_rat; var str: pchar8; radix, prec, maxlen: word);
{-convert to float format for a given radix, prec digits after '.', assumes a is initialized}
procedure szf_toradix_n(const a: mp_int; radix,prec,maxlen: word; var str: pchar8);
{-convert a positive mp_int to ASCII for a given radix, no init check,}
{ prec digits, leading zeros, on return str points to the final #0 char}
implementation
uses
mp_base, mp_numth;
{---------------------------------------------------------------------------}
procedure s_mpr_normsign(var a: mp_rat);
{-make denominator positive, assumes a is initialized}
begin
if mp_error<>MP_OKAY then exit;
with a do begin
{make denominator positive}
if den.sign=MP_NEG then begin
den.sign := MP_ZPOS;
if num.used>0 then num.sign := num.sign xor (MP_NEG xor MP_ZPOS);
end;
end;
end;
{---------------------------------------------------------------------------}
procedure s_mpr_normalize(var a: mp_rat);
{-normalize a, assumes a is initialized}
var
gcd: mp_int;
begin
if mp_error<>MP_OKAY then exit;
with a do begin
{sanity check for zero denominator}
if mp_is0(den) then begin
{$ifdef MPC_HaltOnError}
{$ifdef MPC_UseExceptions}
raise MPXRange.Create('s_mpr_normalize: a.den=0');
{$else}
RunError(MP_RTE_RANGE);
{$endif}
{$else}
set_mp_error(MP_RANGE);
exit;
{$endif}
end;
{normalize 0/? to 0/1}
if mp_is0(num) then begin
mp_set1(den);
exit;
end;
if not (mp_is1a(num) or mp_is1a(den)) then begin
{If the gcd of the numerator and denominator is <> 1 then divide it out}
mp_init(gcd);
if mp_error<>MP_OKAY then exit;
if not mp_gcd1(num, den, gcd) then begin
mp_div(num, gcd, num);
mp_div(den, gcd, den);
end;
mp_clear(gcd);
end;
{make denominator positive}
if den.sign=MP_NEG then begin
den.sign := MP_ZPOS;
if num.used>0 then num.sign := num.sign xor (MP_NEG xor MP_ZPOS);
end;
end;
end;
{---------------------------------------------------------------------------}
procedure s_mpr_add_sub(const a,b: mp_rat; var c: mp_rat; sub: boolean);
{-add or subtract two mp_rats}
var
t1,t2,g: mp_int;
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mpr_not_init(b) or mpr_not_init(c) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('s_mpr_add_sup');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
{if b is zero just copy a}
if b.num.used=0 then begin
mpr_copy(a,c);
exit;
end;
{easy out if a is zero}
if a.num.used=0 then begin
{if we subtract c := -b else c := b}
if sub then mpr_chs(b,c) else mpr_copy(b,c);
exit;
end;
if mp_is_eq(a.den, b.den) then begin
{denominators are equal}
{c.num = a.num * b.den + a.den * b.num}
{c.den = a.den * b.den }
if sub then mp_sub(a.num, b.num, c.num)
else mp_add(a.num, b.num, c.num);
mp_copy(a.den, c.den);
s_mpr_normalize(c);
exit;
end;
mp_init3(t1,t2,g);
if mp_error<>MP_OKAY then exit;
if mp_gcd1(a.den, b.den, g) then begin
{gcd of denominators is 1}
mp_mul(a.num, b.den, t1);
mp_mul(b.num, a.den, t2);
if sub then mp_sub(t1,t2,c.num) else mp_add(t1,t2,c.num);
if c.num.used=0 then mp_set1(c.den)
else mp_mul(a.den,b.den,c.den);
end
else begin
{Speedup by calculating second gcd here before calculating c.den. The}
{result is a product of smaller factors in c.den compared to first }
{multiply greater factors and divide the product during normalization}
{Formulas:
g = gcd(a.den, b.den)
n = a.num*(b.den/g) +/- b.num*(a.den/g)
h = gcd(n,g)
c.num = n/h;
c.den = (a.den/g)*(b.den/h)
Implementation: h overwrites g; t1,t2 used to accumulate n
t1 = a.den/g
t2 = b.den/g
c.num = a.num*(b.den/g) +/- b.num*(a.den/g) = a.num*t2 +/- b.num*t1
g = gcd(c.num,g)
c.num = c.num/g
c.den = t1*(b.den/h)
}
mp_div(a.den, g, t1);
mp_div(b.den, g, t2);
mp_mul(a.num, t2, t2);
mp_mul(b.num, t1, c.num);
if sub then mp_sub(t2, c.num, c.num) else mp_add(t2, c.num, c.num);
if mp_gcd1(c.num,g,g) then mp_mul(b.den, t1, c.den)
else begin
mp_div(c.num, g, c.num);
mp_div(b.den, g, t2);
mp_mul(t1,t2,c.den);
end;
end;
mp_clear3(t1,t2,g);
end;
{---------------------------------------------------------------------------}
function s_mpr_cmp_mag(const a,b: mp_rat): integer;
{-compare magnitude of two mp_rats (unsigned), return sign(|a|-|b|), no init check}
var
dsad,dsbd,dsx,dsy: word;
bsad,bsbd,bsx,bsy: longint;
x,y: mp_int;
begin
{Value for last alternative, keep D6+ happy}
s_mpr_cmp_mag := 0;
if mp_error<>MP_OKAY then exit;
if a.num.used=0 then begin
{a is zero; if b<>0 then return -1 else 0}
if b.num.used=0 then s_mpr_cmp_mag := -1;
exit;
end;
if b.num.used=0 then begin
{b is zero, a <> 0, return +1}
s_mpr_cmp_mag := +1;
exit;
end;
dsad := a.den.used;
dsbd := b.den.used;
{$ifdef MPC_USE_Assert}
{only if assert supported by compiler or debug}
assert((dsad>0) and (dsbd>0), MPAF+'(a.den.used>0) and (b.den.used>0) in s_mpr_cmp_mag');
{$endif}
{In the general case we have to compare x=a.num*b.den with y=b.num*a.den}
{Before actually calculating the products some checks are made based on}
{the digit and bit sizes}
{Check based on digit sizes}
dsx := a.num.used+dsbd;
dsy := b.num.used+dsad;
if dsx > dsy+1 then begin
s_mpr_cmp_mag := 1;
exit;
end;
if dsy > dsx+1 then begin
s_mpr_cmp_mag := -1;
exit;
end;
{Check based on bit sizes}
bsad := mp_bitsize(a.den);
bsbd := mp_bitsize(b.den);
bsx := mp_bitsize(a.num)+bsbd;
bsy := mp_bitsize(b.num)+bsad;
if bsx > bsy+1 then begin
s_mpr_cmp_mag := 1;
exit;
end;
if bsy > bsx+1 then begin
s_mpr_cmp_mag := -1;
exit;
end;
{If the denominators have the same bit size check whether they are equal}
if (bsad=bsbd) and mp_is_eq(a.den, b.den) then begin
{If the denominators are equal, we just compare the numerators}
s_mpr_cmp_mag := mp_cmp_mag(a.num, b.num);
exit;
end;
{The hard case: cross multiply and compare}
mp_init2(x,y);
if mp_error=MP_OKAY then begin
{We have to compare x=a.num*b.den with y=b.num*a.den}
mp_mul(a.num,b.den,x);
mp_mul(b.num,a.den,y);
s_mpr_cmp_mag := mp_cmp_mag(x, y);
mp_clear2(x,y);
end;
end;
{---------------------------------------------------------------------------}
procedure s_mpr_qr(const num, den: mp_int; var q,r: mp_int);
{-calculate q := abs(num) div abs(den); r := abs(num) mod abs(den), no init check}
begin
mp_abs(num,q);
mp_abs(den,r);
mp_divrem(q,r,@q,@r);
end;
{---------------------------------------------------------------------------}
procedure s_mpr_tofloat_n(const a: mp_rat; var str: pchar8; radix, prec, maxlen: word);
{-convert to float format for a given radix, prec digits after '.', assumes a is initialized}
var
n,r,f,p: mp_int;
intplus: boolean;
begin
if mp_error<>MP_OKAY then exit;
{check range of radix/maxlen}
if (radix < 2) or (radix > MAXRadix) or (prec>=maxlen) or (maxlen=0) then begin
{$ifdef MPC_HaltOnError}
{$ifdef MPC_UseExceptions}
raise MPXRange.Create('s_mpr_tofloat_n: radix/prec out of range or maxlen too small');
{$else}
RunError(MP_RTE_RANGE);
{$endif}
{$else}
set_mp_error(MP_RANGE);
exit;
{$endif}
end;
str^ := #0;
mp_init4(n,r,f,p);
if mp_error<>MP_OKAY then exit;
intplus := mp_show_plus;
{calculate n,r with |a| = n + r/a.den}
s_mpr_qr(a.num,a.den,n,r);
{if Maxlen is too small return empty string}
if maxlen >= mp_radix_size(n, radix)+prec then begin
{We have to calculate the frac(a) approximation first in order}
{to decide if the string starts with '-' for a<0, trunc(a)=0!}
{Multiply by power of radix: p := r*radix^prec}
mp_set_pow(p,radix,prec);
mp_mul(p,r,r);
if mp_roundfloat and not mp_is1(a.den) then begin
{Rounding: calculate f=(2*r0*radix^prec + a.den)/(2*a.den)}
mp_shl(a.den,1,f);
mp_shl1(r);
mp_add(r,a.den,r);
mp_divrem(r,f,@f,@r);
if mp_is_ge(f,p) then begin
{Here f=(2*r0*radix^prec+a.den)/(2*a.den) is >= radix^prec, so the}
{rounding propagates to the left of the radix point! Increment the}
{integer part, and subtract radix*prec from f; f remains positive.}
mp_inc(n);
mp_sub(f,p,f);
end;
end
else begin
{truncate, no special action}
mp_divrem(r,a.den,@f,@r);
end;
if a.num.sign=MP_NEG then begin
if n.used=0 then begin
{if a<0, trunc(a)=0, f<>0 then insert '-'}
if (maxlen>0) and (f.used<>0) then begin
str^ := '-';
inc(str);
dec(maxlen);
{do not show '+' for n=0}
intplus := false;
end;
end
else n.sign := MP_NEG;
end;
s_mp_toradix_n(n,radix,intplus,maxlen,str);
if mp_error<>MP_OKAY then exit;
if (maxlen>2) and (prec>0) then begin
str^ := '.';
inc(str);
dec(maxlen);
szf_toradix_n(f,radix,prec,maxlen,str);
end;
end;
mp_clear4(n,r,f,p);
end;
{---------------------------------------------------------------------------}
procedure szf_toradix_n(const a: mp_int; radix,prec,maxlen: word; var str: pchar8);
{-convert a positive mp_int to ASCII for a given radix, no init check,}
{ prec digits, leading zeros, on return str points to the final #0 char}
var
digs: word;
s0: pchar8;
t: mp_int;
d,rp: mp_digit;
i,ri: integer;
prmap: ^TRadixCMap;
begin
if mp_error<>MP_OKAY then exit;
digs:=1+prec; {prec digits and #0}
if a.sign=MP_NEG then begin
{$ifdef MPC_HaltOnError}
{$ifdef MPC_UseExceptions}
raise MPXRange.Create('szf_toradix_n: a < 0');
{$else}
RunError(MP_RTE_RANGE);
{$endif}
{$else}
set_mp_error(MP_RANGE);
exit;
{$endif}
end;
{check range of radix/maxlen, here digs = minimum maxlen}
if (radix < 2) or (radix > MAXRadix) or (maxlen < digs) then begin
{$ifdef MPC_HaltOnError}
{$ifdef MPC_UseExceptions}
raise MPXRange.Create('szf_toradix_n: radix/prec out of range or maxlen too small');
{$else}
RunError(MP_RTE_RANGE);
{$endif}
{$else}
set_mp_error(MP_RANGE);
exit;
{$endif}
end;
mp_init_copy(t,a);
if mp_error<>MP_OKAY then exit;
{use local pointer to radix map}
if mp_uppercase or (radix>36) then prmap := @mp_ucrmap else prmap := @mp_lcrmap;
{get number of ASCII digits and radix power that fit into an mp_digit}
ri := mp_radexp[radix];
rp := mp_radpow[radix];
{remember first digits position}
s0 := str;
{initialize digit counter}
digs := 0;
while (mp_error=MP_OKAY) and (prec>0) do begin
{radix division loop: divide by rp and get ri ASCII digits}
mp_div_d(t, rp, @t, d);
{special flag: no trailing '0' in last chunk}
for i:=1 to ri do begin
str^ := prmap^[d mod radix];
inc(str);
d := d div radix;
inc(digs);
dec(prec);
if prec=0 then break;
end;
end;
if mp_error=MP_OKAY then begin
{reverse the digits part of the string}
mp_reverse(s0^, digs);
{append a #0 so the string is properly terminated}
str^ := #0;
end;
mp_clear(t);
end;
{---------------------------------------------------------------------------}
procedure mpr_add(const a,b: mp_rat; var c: mp_rat);
{-add two mp_rats: c = a+b}
begin
s_mpr_add_sub(a,b,c,false);
end;
{---------------------------------------------------------------------------}
procedure mpr_add_mpi(const a: mp_rat; const b: mp_int; var c: mp_rat);
{-add mp_int to mp_rat: c = a+b}
var
t: mp_rat;
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mp_not_init(b) or mpr_not_init(c) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_add_mpi');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
mpr_init(t);
if mp_error=MP_OKAY then begin
mpr_set1(t,b);
mpr_add(a,t,c);
mpr_clear(t);
end;
end;
{---------------------------------------------------------------------------}
procedure mpr_abs(const a: mp_rat; var b: mp_rat);
{-absolute value, b = |a|}
begin
mpr_copy(a, b);
if mp_error=MP_OKAY then with b do begin
{force the sign of b to positive}
num.sign := MP_ZPOS;
den.sign := MP_ZPOS;
end;
end;
{$ifdef BIT32}
{---------------------------------------------------------------------------}
function mpr_adecimal(const a: mp_rat): ansistring;
{-convert to decimal ansistring, max 65000 digits}
begin
mpr_adecimal := mpr_radix_astr(a, 10);
end;
{$endif}
{---------------------------------------------------------------------------}
procedure mpr_ceil(const a: mp_rat; var b: mp_int);
{-return b := ceil(a)}
var
r: mp_int;
asig: integer;
begin
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mp_not_init(b) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_ceil');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
if mp_error<>MP_OKAY then exit;
mp_init(r);
if mp_error<>MP_OKAY then exit;
asig := a.num.sign;
s_mpr_qr(a.num,a.den,b,r);
if (asig=MP_ZPOS) and (r.used<>0) then mp_inc(b);
if asig=MP_NEG then b.sign := MP_NEG;
mp_clear(r);
end;
{---------------------------------------------------------------------------}
function mpr_checksum(const a: mp_rat): longint;
{-return a checksum for a, -1 if mp_error<>MP_OKAY, -2 if not initialized}
var
adler: longint;
begin
mpr_checksum := -1;
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) then begin
mpr_checksum := -2;
exit;
end;
{$endif}
adler := 1;
with a.num do begin
s_mp_checksum(adler,@used, sizeof(used));
s_mp_checksum(adler,@sign, sizeof(sign));
s_mp_checksum(adler,pdigits, longint(used)*sizeof(mp_digit));
end;
with a.den do begin
s_mp_checksum(adler,@used, sizeof(used));
s_mp_checksum(adler,@sign, sizeof(sign));
s_mp_checksum(adler,pdigits, longint(used)*sizeof(mp_digit));
end;
mpr_checksum := adler;
end;
{---------------------------------------------------------------------------}
procedure mpr_chs(const a: mp_rat; var b: mp_rat);
{-change sign, b = -a}
begin
if mp_error<>MP_OKAY then exit;
mpr_copy(a, b);
if mp_error=MP_OKAY then with b do begin
if num.used>0 then num.sign := num.sign xor (MP_NEG xor MP_ZPOS);
s_mpr_normsign(b);
end;
end;
{---------------------------------------------------------------------------}
procedure mpr_clear(var a: mp_rat);
{-free an mp_rat}
begin
with a do mp_clear2(num, den);
end;
{---------------------------------------------------------------------------}
procedure mpr_clear2(var a,b: mp_rat);
{-clear 2 mp_rats}
begin
mpr_clear(a);
mpr_clear(b);
end;
{---------------------------------------------------------------------------}
procedure mpr_clear3(var a,b,c: mp_rat);
{-clear 3 mp_rats}
begin
mpr_clear2(a,b);
mpr_clear(c);
end;
{---------------------------------------------------------------------------}
procedure mpr_clear4(var a,b,c,d: mp_rat);
{-clear 4 mp_rats}
begin
mpr_clear2(a,b);
mpr_clear2(c,d);
end;
{---------------------------------------------------------------------------}
procedure mpr_clear5(var a,b,c,d,e: mp_rat);
{-clear 5 mp_rats}
begin
mpr_clear2(a,b);
mpr_clear2(c,d);
mpr_clear(e);
end;
{---------------------------------------------------------------------------}
procedure mpr_clear6(var a,b,c,d,e,f: mp_rat);
{-clear 6 mp_rats}
begin
mpr_clear2(a,b);
mpr_clear2(c,d);
mpr_clear2(e,f);
end;
{---------------------------------------------------------------------------}
procedure mpr_clear_multi(var vi: array of mp_rat);
{-clear a vector of mp_rats}
var
i: integer;
begin
for i:=low(vi) to high(vi) do mpr_clear(vi[i]);
end;
{---------------------------------------------------------------------------}
procedure mpr_clear_multi_p(const pv: array of pmp_rat);
{-clear a list of mp_rats given as a ptr vector}
var
i: integer;
begin
for i:=low(pv) to high(pv) do mpr_clear(pv[i]^);
end;
{---------------------------------------------------------------------------}
function mpr_cmp(const a,b: mp_rat): integer;
{-compare two mp_rats (signed), return sign(a-b)}
begin
{Value for last alternative, keep D6+ happy}
mpr_cmp := 0;
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mpr_not_init(b) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_cmp');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
{compare based on sign}
if a.num.sign<>b.num.sign then begin
if a.num.sign=MP_NEG then mpr_cmp := -1 else mpr_cmp := 1;
exit;
end;
{compare magnitude}
if a.num.sign=MP_NEG then begin
{if negative compare opposite direction}
mpr_cmp := s_mpr_cmp_mag(b, a);
end
else mpr_cmp := s_mpr_cmp_mag(a, b);
end;
{---------------------------------------------------------------------------}
function mpr_cmp_mag(const a,b: mp_rat): integer;
{-compare magnitude of two mp_rats (unsigned), return sign(|a|-|b|)}
begin
{Value for last alternative, keep D6+ happy}
mpr_cmp_mag := 0;
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mpr_not_init(b) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_cmp_mag');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
mpr_cmp_mag := s_mpr_cmp_mag(a, b);
end;
{---------------------------------------------------------------------------}
procedure mpr_copy(const a: mp_rat; var b: mp_rat);
{-copy an mp_rat, b: = a}
begin
if mp_error<>MP_OKAY then exit;
{ArgCheck in mp_copy}
mp_copy(a.num, b.num);
mp_copy(a.den, b.den);
end;
{---------------------------------------------------------------------------}
procedure mpr_div(const a,b: mp_rat; var c: mp_rat);
{-divide two mp_rats: c = a/b, b<>0}
var
g1,g2,t1,t2,t3: mp_int;
is11,is21: boolean;
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mpr_not_init(b) or mpr_not_init(c) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_div');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
if b.num.used=0 then begin
{$ifdef MPC_HaltOnError}
{$ifdef MPC_UseExceptions}
raise MPXRange.Create('mpr_div: b=0');
{$else}
RunError(MP_RTE_RANGE);
{$endif}
{$else}
set_mp_error(MP_RANGE);
exit;
{$endif}
end;
{if a is zero, so is c}
if a.num.used=0 then begin
mpr_zero(c);
exit;
end;
if @a=@b then begin
{a and b same varibale <>0, so c=1}
mpr_set_int(c,1,1);
exit;
end;
{(a.num/a.den)/(b.num/d.den) = (a.num*b.den)/(a.den*b.num), so we}
{use same technique as in mpr_mul, but here are two differences: }
{1. a third temporary must be used before we can store c.num and }
{2. c.den can be negative and the results must be sign-normalized}
mp_init5(g1,g2,t1,t2,t3);
if mp_error=MP_OKAY then begin
is11 := mp_gcd1(a.num, b.num, g1);
is21 := mp_gcd1(a.den, b.den, g2);
{c.num = (a.num/g1)*(b.den/g2)}
if is11 then mp_copy(a.num, t1) else mp_div(a.num, g1, t1);
if is21 then mp_copy(b.den, t2) else mp_div(b.den, g2, t2);
mp_mul(t1,t2,t3);
{c.den = (b.num/g1)*(a.den/g2)}
if is11 then mp_copy(b.num, t1) else mp_div(b.num, g1, t1);
if is21 then mp_copy(a.den, t2) else mp_div(a.den, g2, t2);
mp_mul(t1,t2,c.den);
mp_exch(t3,c.num);
s_mpr_normsign(c);
mp_clear5(g1,g2,t1,t2,t3);
end;
end;
{---------------------------------------------------------------------------}
procedure mpr_div_2(const a: mp_rat; var b: mp_rat);
{-divide mp_rat by 2: b = a/2}
begin
mpr_copy(a,b);
if (mp_error<>MP_OKAY) or mpr_is0(b) then exit;
if mp_iseven(b.num) then mp_shr1(b.num)
else mp_shl1(b.den);
end;
{---------------------------------------------------------------------------}
procedure mpr_div_2k(const a: mp_rat; k: longint; var b: mp_rat);
{-divide mp_rat by 2^k: b = a/2^k}
var
s: longint;
begin
if k<0 then mpr_mul_2k(a,abs(k),b)
else if k=1 then mpr_div_2(a,b)
else begin
mpr_copy(a,b);
if (mp_error<>MP_OKAY) or mpr_is0(b) or (k=0) then exit;
with b do begin
if mp_isodd(num) then mp_shl(den,k,den)
else begin
s := mp_cnt_lsb(num);
if s >= k then mp_shr(num,k,num)
else begin
mp_shr(num,s,num);
mp_shl(den,k-s,den);
end;
end;
end;
end;
end;
{---------------------------------------------------------------------------}
procedure mpr_div_int(const a: mp_rat; b: longint; var c: mp_rat);
{-divide mp_rat by longint: c = a/b, b<>0}
var
g: longint;
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mpr_not_init(c) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_div_int');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
if b=0 then begin
{$ifdef MPC_HaltOnError}
{$ifdef MPC_UseExceptions}
raise MPXRange.Create('mpr_div_int: b=0');
{$else}
RunError(MP_RTE_RANGE);
{$endif}
{$else}
set_mp_error(MP_RANGE);
exit;
{$endif}
end;
{if a is zero, so is c}
if a.num.used=0 then begin
mpr_zero(c);
exit;
end;
g := mp_gcd_int(a.num,b);
if g=1 then begin
mp_copy(a.num, c.num);
mp_mul_int(a.den, b, c.den);
end
else begin
mp_mul_int(a.den, b div g, c.den);
mp_div_int(a.num, g, @c.num, b);
end;
s_mpr_normsign(c);
end;
{---------------------------------------------------------------------------}
procedure mpr_div_mpi(const a: mp_rat; const b: mp_int; var c: mp_rat);
{-divide mp_rat by mp_int: c = a/b, b<>0}
var
t: mp_rat;
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mp_not_init(b) or mpr_not_init(c) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_div_mpi');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
mpr_init(t);
if mp_error=MP_OKAY then begin
mpr_set1(t,b);
mpr_div(a,t,c);
mpr_clear(t);
end;
end;
{---------------------------------------------------------------------------}
function mpr_decimal(const a: mp_rat): mp_string;
{-convert r to decimal, max 255 chars}
begin
mpr_decimal := mpr_radix_str(a, 10);
end;
{---------------------------------------------------------------------------}
procedure mpr_exch(var a,b: mp_rat);
{-exchange two mp_rats}
var
t: mp_rat;
begin
if mp_error<>MP_OKAY then exit;
t := a;
a := b;
b := t;
end;
{---------------------------------------------------------------------------}
procedure mpr_expt(const a: mp_rat; b: longint; var c: mp_rat);
{-calculate c = a^b, a<>0 for b<0, 0^0=1}
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mpr_not_init(c) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_expt');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
{Handle a=0}
if a.den.used=0 then begin
if b<0 then begin
{$ifdef MPC_HaltOnError}
{$ifdef MPC_UseExceptions}
raise MPXRange.Create('mpr_expt: a=0, b<0');
{$else}
RunError(MP_RTE_RANGE);
{$endif}
{$else}
set_mp_error(MP_RANGE);
{$endif}
end
else if b>0 then mpr_zero(c)
else mpr_set_int(c,1,1);
exit;
end;
{Setup for exponentiation and handle easy cases}
if b<0 then begin
mpr_inv(a,c);
b := abs(b);
end
else begin
if b=0 then mpr_set_int(c,1,1) else mpr_copy(a,c);
end;
if b<=1 then exit;
{here we have to calculate c^b, b>1. Since rats are always stored}
{in lowest terms, calculate c.num^b/c.den^b without normalization}
mp_expt_int(c.num, b, c.num);
mp_expt_int(c.den, b, c.den);
end;
{---------------------------------------------------------------------------}
procedure mpr_floor(const a: mp_rat; var b: mp_int);
{-return b := floor(a)}
var
r: mp_int;
asig: integer;
begin
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mp_not_init(b) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_floor');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
if mp_error<>MP_OKAY then exit;
mp_init(r);
if mp_error<>MP_OKAY then exit;
asig := a.num.sign;
s_mpr_qr(a.num,a.den,b,r);
if (asig=MP_NEG) and (b.used<>0) then b.sign := MP_NEG;
if (asig=MP_NEG) and (r.used<>0) then mp_dec(b);
mp_clear(r);
end;
{---------------------------------------------------------------------------}
procedure mpr_frac(const a: mp_rat; var b: mp_rat);
{-return b := frac(a) = a - trunc(a)}
var
t: mp_int;
begin
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mpr_not_init(b) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_frac');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
if mp_error<>MP_OKAY then exit;
mp_init(t);
if mp_error<>MP_OKAY then exit;
mpr_trunc(a,t);
mpr_sub_mpi(a,t,b);
mp_clear(t);
end;
{---------------------------------------------------------------------------}
procedure mpr_harmonic(n: longint; var hn: mp_rat);
{-Compute the harmonic number hn = sum(1/i, i=1..n) with binary splitting}
procedure bs_harm(a,b: longint; var r: mp_rat);
{-binary splitting calculation of sum(1/i, a<=i<b)}
var
l: mp_rat;
m: longint;
begin
{See Alg. 4 in Fredrik Johansson's 'How (not) to compute harmonic numbers'}
{http://fredrik-j.blogspot.com/2009/02/how-not-to-compute-harmonic-numbers.html}
if b-a=1 then begin
mpr_set_int(r,1,a);
end
else begin
mpr_init(l);
if mp_error=MP_OKAY then begin
m := (a+b) div 2;
bs_harm(a,m,l);
bs_harm(m,b,r);
mpr_add(l,r,r);
mpr_clear(l);
end;
end;
end;
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(hn) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_harmonic');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
if n<1 then mpr_zero(hn)
else bs_harm(1,n+1,hn);
end;
{---------------------------------------------------------------------------}
procedure mpr_init(var a: mp_rat);
{-initialize an mp_rat}
begin
mpr_init_size(a,0,0);
end;
{---------------------------------------------------------------------------}
procedure mpr_init2(var a,b: mp_rat);
{-initialize 2 mp_rats}
var
pa: array[0..1] of pmp_rat;
begin
pa[0] := @a;
pa[1] := @b;
mpr_init_multi_p(pa);
end;
{---------------------------------------------------------------------------}
procedure mpr_init3(var a,b,c: mp_rat);
{-initialize 3 mp_rats}
var
pa: array[0..2] of pmp_rat;
begin
pa[0] := @a;
pa[1] := @b;
pa[2] := @c;
mpr_init_multi_p(pa);
end;
{---------------------------------------------------------------------------}
procedure mpr_init4(var a,b,c,d: mp_rat);
{-initialize 4 mp_rats}
var
pa: array[0..3] of pmp_rat;
begin
pa[0] := @a;
pa[1] := @b;
pa[2] := @c;
pa[3] := @d;
mpr_init_multi_p(pa);
end;
{---------------------------------------------------------------------------}
procedure mpr_init5(var a,b,c,d,e: mp_rat);
{-initialize 5 mp_rats}
var
pa: array[0..4] of pmp_rat;
begin
pa[0] := @a;
pa[1] := @b;
pa[2] := @c;
pa[3] := @d;
pa[4] := @e;
mpr_init_multi_p(pa);
end;
{---------------------------------------------------------------------------}
procedure mpr_init6(var a,b,c,d,e,f: mp_rat);
{-initialize 6 mp_rats}
var
pa: array[0..5] of pmp_rat;
begin
pa[0] := @a;
pa[1] := @b;
pa[2] := @c;
pa[3] := @d;
pa[4] := @e;
pa[5] := @f;
mpr_init_multi_p(pa);
end;
{---------------------------------------------------------------------------}
procedure mpr_init_copy(var a: mp_rat; const b: mp_rat);
{-create a, then copy b into it}
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(b) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_init_copy');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
mp_init_copy(a.num, b.num); if mp_error<>MP_OKAY then exit;
mp_init_copy(a.den, b.den); if mp_error<>MP_OKAY then mp_clear(a.num);
end;
{---------------------------------------------------------------------------}
procedure mpr_init_multi(var vi: array of mp_rat);
{-initialize a vector of mp_rats}
{ on error the already initialized mp_rats will be cleared}
var
i,k: integer;
begin
if mp_error<>MP_OKAY then exit;
for i:=low(vi) to high(vi) do begin
mpr_init(vi[i]);
if mp_error<>MP_OKAY then begin
{error, clear all previous mp_rats}
for k:=low(vi) to i-1 do mpr_clear(vi[k]);
break;
end;
end;
end;
{---------------------------------------------------------------------------}
procedure mpr_init_multi_p(var pv: array of pmp_rat);
{-initialize a list of mp_rats given as a ptr vector}
{ on error the already initialized mp_rats will be cleared}
var
i,k: integer;
begin
if mp_error<>MP_OKAY then exit;
for i:=low(pv) to high(pv) do begin
mpr_init(pv[i]^);
if mp_error<>MP_OKAY then begin
{error, clear all previous mp_rats}
for k:=low(pv) to i-1 do mpr_clear(pv[k]^);
break;
end;
end;
end;
{---------------------------------------------------------------------------}
procedure mpr_init_size(var a: mp_rat; nsize, dsize: word);
{-initialize an mp_rat to given number of digits}
begin
if mp_error<>MP_OKAY then exit;
with a do begin
mp_init_size(num, nsize);
if mp_error=MP_OKAY then begin
mp_init_size(den, dsize);
if mp_error=MP_OKAY then begin
mp_set1(den);
if mp_error<>MP_OKAY then mpr_clear(a);
end
else mp_clear(num);
end;
end;
end;
{---------------------------------------------------------------------------}
procedure mpr_inv(const a: mp_rat; var b: mp_rat);
{-invert an mp_rat, b = 1/a, a<>0}
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mpr_not_init(b) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_inv');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
if a.den.used=0 then begin
{$ifdef MPC_HaltOnError}
{$ifdef MPC_UseExceptions}
raise MPXRange.Create('mpr_inv: a=0');
{$else}
RunError(MP_RTE_RANGE);
{$endif}
{$else}
set_mp_error(MP_RANGE);
exit;
{$endif}
end;
if @a=@b then begin
{a and b same variable, exchange numerator and denominator}
mp_exch(b.num,b.den);
end
else begin
mp_copy(a.num, b.den);
mp_copy(a.den, b.num);
end;
{a should be normalized, so adjust only the signs of b}
s_mpr_normsign(b);
end;
{---------------------------------------------------------------------------}
function mpr_is0(const a: mp_rat): boolean;
{-return a=0}
begin
mpr_is0 := (a.num.magic=MP_MAGIC) and (a.num.pdigits<>nil) and (a.num.used=0)
and (a.den.magic=MP_MAGIC) and (a.den.pdigits<>nil) and (a.den.used>0);
end;
{---------------------------------------------------------------------------}
function mpr_is_eq(const a,b: mp_rat): boolean;
{-return a = b}
begin
{No need to use mpr_cmp, normalized rats are equal if the numerators and}
{denominators are equal, short cuts for a<>b are done with xx.used tests}
mpr_is_eq := (a.num.used=b.num.used) and (a.den.used=b.den.used)
and mp_is_eq(a.num, b.num) and mp_is_eq(a.den, b.den)
end;
{---------------------------------------------------------------------------}
function mpr_is_ge(const a,b: mp_rat): boolean;
{-return a >= b}
begin
mpr_is_ge := mpr_is_eq(a,b) or mpr_is_gt(a,b);
end;
{---------------------------------------------------------------------------}
function mpr_is_gt(const a,b: mp_rat): boolean;
{-return a > b}
begin
mpr_is_gt := mpr_cmp(a,b)=MP_GT;
end;
{---------------------------------------------------------------------------}
function mpr_is_le(const a,b: mp_rat): boolean;
{-return a <= b}
begin
mpr_is_le := mpr_is_eq(a,b) or mpr_is_lt(a,b);
end;
{---------------------------------------------------------------------------}
function mpr_is_lt(const a,b: mp_rat): boolean;
{-return a < b}
begin
mpr_is_lt := mpr_cmp(a,b)=MP_LT;
end;
{---------------------------------------------------------------------------}
function mpr_is_mp(const a: mp_rat): boolean;
{-return true if a is initialized and a.den=1}
begin
mpr_is_mp := (a.num.magic=MP_MAGIC) and (a.num.pdigits<>nil) and mp_is1(a.den);
end;
{---------------------------------------------------------------------------}
function mpr_is_ne(const a,b: mp_rat): boolean;
{-return a <> b}
begin
mpr_is_ne := mp_is_ne(a.num, b.num) or mp_is_ne(a.den, b.den);
end;
{---------------------------------------------------------------------------}
procedure mpr_mul(const a,b: mp_rat; var c: mp_rat);
{-multiply two mp_rats: c = a*b}
var
g1,g2,t1,t2: mp_int;
is11,is21: boolean;
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mpr_not_init(b) or mpr_not_init(c) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_mul');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
{if a or b is zero, so is z}
if (a.num.used=0) or (b.num.used=0) then begin
mpr_zero(c);
exit;
end;
{if a==b just do two squares}
if @a=@b then begin
mp_sqr(a.num, c.num);
mp_sqr(a.den, c.den);
exit;
end;
mp_init4(g1,g2,t1,t2);
if mp_error=MP_OKAY then begin
is11 := mp_gcd1(a.num, b.den, g1);
is21 := mp_gcd1(a.den, b.num, g2);
{c.num = (a.num/g1)*(b.num/g2)}
if is11 then mp_copy(a.num, t1) else mp_div(a.num, g1, t1);
if is21 then mp_copy(b.num, t2) else mp_div(b.num, g2, t2);
mp_mul(t1,t2,c.num);
{c.den = (b.den/g1)*(a.den/g2)}
if is11 then mp_copy(b.den, t1) else mp_div(b.den, g1, t1);
if is21 then mp_copy(a.den, t2) else mp_div(a.den, g2, t2);
mp_mul(t1,t2,c.den);
mp_clear4(g1,g2,t1,t2);
end;
end;
{---------------------------------------------------------------------------}
procedure mpr_mul_2(const a: mp_rat; var b: mp_rat);
{-multiply mp_rat by 2: b = 2*a}
begin
mpr_copy(a,b);
if (mp_error<>MP_OKAY) or mpr_is0(b) then exit;
if mp_iseven(b.den) then mp_shr1(b.den)
else mp_shl1(b.num);
end;
{---------------------------------------------------------------------------}
procedure mpr_mul_2k(const a: mp_rat; k: longint; var b: mp_rat);
{-multiply mp_rat by 2^k: b = a*2^k}
var
s: longint;
begin
if k<0 then mpr_div_2k(a,abs(k),b)
else if k=1 then mpr_mul_2(a,b)
else begin
mpr_copy(a,b);
if (mp_error<>MP_OKAY) or mpr_is0(b) or (k=0) then exit;
with b do begin
if mp_isodd(den) then mp_shl(num,k,num)
else begin
s := mp_cnt_lsb(den);
if s >= k then mp_shr(den,k,den)
else begin
mp_shl(num,k-s,num);
mp_shr(den,s,den);
end;
end;
end;
end;
end;
{---------------------------------------------------------------------------}
procedure mpr_mul_int(const a: mp_rat; b: longint; var c: mp_rat);
{-multiply mp_rat by longint: c = a*b}
var
g: longint;
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mpr_not_init(c) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_mul_int');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
if (b=0) or (a.num.used=0) then begin
mpr_zero(c);
exit;
end
else if abs(b)=1 then begin
if b>0 then mpr_copy(a,c)
else mpr_chs(a,c);
exit;
end;
g := mp_gcd_int(a.den,b);
if g=1 then begin
mp_mul_int(a.num, b, c.num);
mp_copy(a.den, c.den);
end
else begin
mp_mul_int(a.num, b div g, c.num);
mp_div_int(a.den, g, @c.den, b);
end;
s_mpr_normsign(c);
end;
{---------------------------------------------------------------------------}
procedure mpr_mul_mpi(const a: mp_rat; const b: mp_int; var c: mp_rat);
{-multiply mp_rat and mp_int: c = a*b}
var
t: mp_rat;
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mp_not_init(b) or mpr_not_init(c) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_mul_mpi');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
mpr_init(t);
if mp_error=MP_OKAY then begin
mpr_set1(t,b);
mpr_mul(a,t,c);
mpr_clear(t);
end;
end;
{---------------------------------------------------------------------------}
procedure mpr_output_decimal(const a: mp_rat);
{-write decimal representation to output}
begin
mpr_write_decimal(output, a);
end;
{---------------------------------------------------------------------------}
procedure mpr_output_radix(const a: mp_rat; radix: word);
{-write radix representation to output}
begin
mpr_write_radix(output, a, radix);
end;
{---------------------------------------------------------------------------}
function mpr_not_init(const a: mp_rat): boolean;
{-sanity check if a is initialized, does not catch all cases!}
begin
mpr_not_init := mp_not_init(a.num) or mp_not_init(a.den);
end;
{$ifdef BIT32}
{---------------------------------------------------------------------------}
function mpr_radix_astr(const a: mp_rat; radix: word): ansistring;
{-convert to radix representation ansistring, max 65000 digits}
const
LMAX=65000;
var
l,ls: longint;
{$ifndef RESULT}
Result: ansistring;
{$endif}
begin
{arg checks are done by mp_radix_size}
ls := mpr_radix_size(a, radix);
if mp_error<>MP_OKAY then begin
mpr_radix_astr := '';
exit;
end;
if ls<=LMAX then begin
SetLength(Result, ls);
for l:=1 to length(Result) do Result[l] := #0;
mpr_toradix_n(a, @Result[1], radix, word(ls));
if mp_error=MP_OKAY then begin
l := length(Result);
{trim trailing #0}
while (l>0) and (Result[l]=#0) do dec(l);
if l<>length(Result) then SetLength(Result, l);
{$ifndef RESULT}
mpr_radix_astr := Result;
{$endif}
end
else mpr_radix_astr := '';
end
else mpr_radix_astr := '';
end;
{$endif}
{---------------------------------------------------------------------------}
function mpr_radix_size(const a: mp_rat; radix: word): longint;
{-return size of ASCII representation (incl. sign and #0)}
var
digs: longint;
begin
mpr_radix_size := 0;
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_radix_size');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
{check range of the radix}
if (radix < 2) or (radix > MAXRadix) then begin
{$ifdef MPC_HaltOnError}
{$ifdef MPC_UseExceptions}
raise MPXRange.Create('mpr_radix_size: radix out of range');
{$else}
RunError(MP_RTE_RANGE);
{$endif}
{$else}
set_mp_error(MP_RANGE);
exit;
{$endif}
end;
digs := mp_radix_size(a.num, radix);
if not mp_is1(a.den) then begin
{add size of den, counts '/' and #0 cancel}
digs := digs + mp_radix_size(a.den, radix);
{den is positive but no '+' is generated}
if mp_show_plus then dec(digs);
end;
mpr_radix_size := digs;
end;
{---------------------------------------------------------------------------}
function mpr_radix_str(const a: mp_rat; radix: word): mp_string;
{-convert to radix representation, max 255 digits}
var
i: integer;
ls: longint;
iostr: string[255];
begin
{arg checks are done by mp_radix_size}
mpr_radix_str := '';
ls := mpr_radix_size(a, radix);
if mp_error<>MP_OKAY then exit;
if ls<=255 then mpr_toradix_n(a, @iostr[1], radix, 255);
if (ls>255) or (mp_error<>MP_OKAY) then exit;
iostr[0] := #255;
for i:=1 to 255 do begin
if iostr[i]=#0 then begin
iostr[0] := char8(i-1);
break;
end;
end;
mpr_radix_str := iostr;
end;
{---------------------------------------------------------------------------}
procedure mpr_read_decimal(var a: mp_rat; str: pchar8);
{-read a ASCII decimal string into a. str may contain a single '/'}
begin
{the denominator can have sign characters}
mpr_read_radix(a,str,10);
end;
{---------------------------------------------------------------------------}
procedure mpr_read_double(var a: mp_rat; d: double);
{-convert d to an mp_rat}
var
m: double;
e: longint;
i: integer;
dig: mp_digit;
neg: boolean;
begin
if mp_error<>MP_OKAY then exit;
{mpr_zero does ArgCheck!}
mpr_zero(a);
if d=0.0 then exit;
neg := d<0.0;
d := abs(d);
frexpd(d,m,e);
for i:=0 to succ(54 div DIGIT_BIT) do begin
if m=0.0 then break;
mp_lshd(a.num,1);
m := ldexpd(m,DIGIT_BIT);
dig := trunc(m) and MP_MASK;
{This should reduce the number of mantissa bits by DIGIT_BIT, the}
{for loop is used to avoid an infinite loop due to rounding errors}
m := m - dig;
dec(e,DIGIT_BIT);
mp_add_d(a.num,dig,a.num);
end;
if e<0 then mp_shl(a.den,-e,a.den)
else mp_shl(a.num,e,a.num);
s_mpr_normalize(a);
if neg then mpr_chs(a,a);
end;
{---------------------------------------------------------------------------}
procedure mpr_read_float_decimal(var a: mp_rat; str: pchar8);
{-read a ASCII float decimal string into a. str may contain a single '.'}
begin
mpr_read_float_radix(a, str, 10);
end;
{---------------------------------------------------------------------------}
procedure mpr_read_float_radix(var a: mp_rat; str: pchar8; radix: word);
{-read a ASCII float radix string into a. str may contain a single '.'}
var
fs: pchar8;
t: mp_int;
c: char8;
neg: boolean;
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_read_float_radix');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
mp_init(t);
if mp_error<>MP_OKAY then exit;
{skip leading white space}
repeat
c := upcase(str^);
if c=#0 then begin
{$ifdef MPC_HaltOnError}
{$ifdef MPC_UseExceptions}
raise MPXBadArg.Create('mpr_read_float_radix: invalid syntax');
{$else}
RunError(MP_RTE_BADARG);
{$endif}
{$else}
mp_clear(t);
set_mp_error(MP_BADARG);
exit;
{$endif}
end;
if (c<>' ') and (c<>#9) then break;
inc(str);
until false;
neg := false;
if c='-' then begin
neg := true;
inc(str);
end
else if c='+' then inc(str);
if c=mp_fract_sep{'.'} then mp_zero(t)
else begin
{read integer part until '.' or #0}
s_mp_read_radix(t,str,radix,mp_fract_sep{'.'},false);
end;
if str^=mp_fract_sep{'.'} then begin
{read floating part into numerator}
inc(str);
{remember starting position of floating part}
fs := str;
s_mp_read_radix(a.num,str,radix,#0,false);
if str<>fs then begin
{set denominator to radix^(number of floating digits)}
mp_set_pow(a.den,radix,str-fs);
{normalize and add integer part}
s_mpr_normalize(a);
mpr_add_mpi(a,t,a);
end
else mpr_set1(a,t);
end
else mpr_set1(a,t);
if neg then mpr_chs(a,a);
mp_clear(t);
end;
{---------------------------------------------------------------------------}
procedure mpr_read_radix(var a: mp_rat; str: pchar8; radix: word);
{-read a ASCII radix string into a. str may contain a single '/'}
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_read_radix');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
s_mp_read_radix(a.num,str,radix,'/',true);
if str^='/' then begin
inc(str);
s_mp_read_radix(a.den,str,radix,#0,false);
end
else mp_set1(a.den);
s_mpr_normalize(a);
end;
{---------------------------------------------------------------------------}
procedure mpr_round(const a: mp_rat; var b: mp_int);
{-return b := round(a), round(-a)=-round(a), round(n+0.5)=n+1}
var
n,d: mp_int;
asig: integer;
begin
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mp_not_init(b) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_round');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
if mp_error<>MP_OKAY then exit;
mp_init2(n,d);
if mp_error<>MP_OKAY then exit;
asig := a.num.sign;
{round(n/d) = trunc((2|n|+d)/(2d))}
mp_abs(a.num,n);
mp_shl1(n);
mp_add(n,a.den,n);
mp_shl(a.den,1,d);
s_mpr_qr(n,d,b,d);
if asig=MP_NEG then b.sign := MP_NEG;
mp_clear2(n,d);
end;
{---------------------------------------------------------------------------}
procedure mpr_set(var a: mp_rat; const n, d: mp_int);
{-set a to n/d, d<>0}
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mp_not_init(n) or mp_not_init(d) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_set');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
if (@a.num=@n) or (@a.num=@d) or (@a.den=@n) or (@a.den=@d) then begin
{$ifdef MPC_HaltOnError}
{$ifdef MPC_UseExceptions}
raise MPXBadArg.Create('mpr_set: invalid addr');
{$else}
RunError(MP_RTE_BADARG);
{$endif}
{$else}
set_mp_error(MP_BADARG);
exit;
{$endif}
end;
{$endif}
if d.used=0 then begin
{$ifdef MPC_HaltOnError}
{$ifdef MPC_UseExceptions}
raise MPXRange.Create('mpr_set: d=0');
{$else}
RunError(MP_RTE_RANGE);
{$endif}
{$else}
set_mp_error(MP_RANGE);
exit;
{$endif}
end;
mp_copy(n, a.num);
mp_copy(d, a.den);
if mp_error<>MP_OKAY then exit;
s_mpr_normalize(a);
end;
{---------------------------------------------------------------------------}
procedure mpr_set_int(var a: mp_rat; n, d: longint);
{-set a to n/d, d<>0}
begin
if mp_error<>MP_OKAY then exit;
{mp_set_int does MPC_ArgCheck}
{cannot divide by zero}
if d=0 then begin
{$ifdef MPC_HaltOnError}
{$ifdef MPC_UseExceptions}
raise MPXRange.Create('mpr_set_int: d=0');
{$else}
RunError(MP_RTE_RANGE);
{$endif}
{$else}
set_mp_error(MP_RANGE);
exit;
{$endif}
end;
mp_set_int(a.num, n);
mp_set_int(a.den, d);
s_mpr_normalize(a);
end;
{---------------------------------------------------------------------------}
procedure mpr_set1(var a: mp_rat; const n: mp_int);
{-set a to n/1}
begin
if mp_error<>MP_OKAY then exit;
{Argcheck by mp_copy and mp_set}
mp_copy(n, a.num);
mp_set(a.den, 1);
{no need to call normalize}
end;
{---------------------------------------------------------------------------}
procedure mpr_sub(const a,b: mp_rat; var c: mp_rat);
{-subtract two mp_rats: c = a-b}
begin
s_mpr_add_sub(a,b,c,true);
end;
{---------------------------------------------------------------------------}
procedure mpr_sub_mpi(const a: mp_rat; const b: mp_int; var c: mp_rat);
{-subtract mp_int from mp_rat: c = a-b}
var
t: mp_rat;
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mp_not_init(b) or mpr_not_init(c) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_sub_mpi');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
mpr_init(t);
if mp_error=MP_OKAY then begin
mpr_set1(t,b);
mpr_sub(a,t,c);
mpr_clear(t);
end;
end;
{---------------------------------------------------------------------------}
function mpr_todouble(const a: mp_rat): double;
{-convert a to double, +-inf if too large, 0 if too small}
var
bsn,bsd,scn,scd: longint; {bitsizes and shift counts}
an,ad: mp_int;
begin
mpr_todouble := 0.0;
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_todouble');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
if mpr_is0(a) then exit
else if mpr_is_mp(a) then begin
{a is an mp_int use mp_todouble}
mpr_todouble := mp_todouble(a.num);
exit;
end;
mp_init2(an,ad);
if mp_error=MP_OKAY then begin
{get approximation for log2(a)}
bsn := mp_bitsize(a.num);
bsd := mp_bitsize(a.den);
if bsn-bsd>1024 then begin
{quotient too large return +-inf}
if a.num.sign=MP_NEG then mpr_todouble := DblNegInf
else mpr_todouble := DblPosInf;
end
else if bsn-bsd < -1024 then begin
{quotient too small return zero}
mpr_todouble := 0.0;
end
else begin
{shift num and den into range 0..2^64}
if bsn>64 then scn := bsn-64 else scn := 0;
if bsd>64 then scd := bsd-64 else scd := 0;
mp_shr(a.num, scn, an);
mp_shr(a.den, scd, ad);
{result := ((a.num*2^-scn)/(a.den*2^-scd))*2^(scn-scd)}
mpr_todouble := ldexpd(mp_todouble(an)/mp_todouble(ad),scn - scd);
end;
mp_clear2(an,ad);
end;
end;
{$ifdef BIT32}
{---------------------------------------------------------------------------}
function mpr_tofloat_astr(const a: mp_rat; radix, prec: word): ansistring;
{-convert to float representation with prec, max 65000 digits}
const
LMAX=65000;
var
l: longint;
s0,s1: pchar8;
{$ifndef RESULT}
Result: ansistring;
{$endif}
begin
mpr_tofloat_astr := '';
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_tofloat_astr');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
SetLength(Result, LMAX);
s0 := pchar8(@Result[1]);
s1 := s0;
s_mpr_tofloat_n(a, s1, radix, prec, LMAX);
if mp_error=MP_OKAY then begin
l := (s1-s0)+1;
{trim trailing #0}
while (l>0) and (Result[l]=#0) do dec(l);
SetLength(Result, l);
{$ifndef RESULT}
mpr_tofloat_astr := Result;
{$endif}
end
else mpr_tofloat_astr := '';
end;
{$endif}
{---------------------------------------------------------------------------}
procedure mpr_tofloat_n(const a: mp_rat; str: pchar8; radix, prec, maxlen: word);
{-convert to float format for a given radix, prec digits after '.'}
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_tofloat_n');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
s_mpr_tofloat_n(a, str, radix, prec, maxlen);
end;
{---------------------------------------------------------------------------}
function mpr_tofloat_str(const a: mp_rat; radix, prec: word): mp_string;
{-convert to float representation with prec, max 255 digits}
var
i: integer;
iostr: string[255];
begin
{arg checks are done by mpr_tofloat_n}
mpr_tofloat_str := '';
if mp_error<>MP_OKAY then exit;
mpr_tofloat_n(a, @iostr[1], radix, prec, 255);
if mp_error<>MP_OKAY then exit;
iostr[0] := #255;
for i:=1 to 255 do begin
if iostr[i]=#0 then begin
iostr[0] := char8(i-1);
break;
end;
end;
mpr_tofloat_str := iostr;
end;
{---------------------------------------------------------------------------}
procedure mpr_toradix_n(const a: mp_rat; str: pchar8; radix, maxlen: word);
{-convert an mp_rat to an ASCII string for a given radix (2..MAXRadix)}
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_toradix_n');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
s_mp_toradix_n(a.num,radix,mp_show_plus,maxlen,str);
if mp_error<>MP_OKAY then exit;
if (not mp_is1(a.den)) and (maxlen>2) then begin
str^ := '/';
inc(str);
dec(maxlen);
s_mp_toradix_n(a.den,radix,false,maxlen,str);
end;
end;
{---------------------------------------------------------------------------}
procedure mpr_trunc(const a: mp_rat; var b: mp_int);
{-return b := trunc(a)}
var
r: mp_int;
asig: integer;
begin
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) or mp_not_init(b) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_trunc');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
if mp_error<>MP_OKAY then exit;
mp_init(r);
if mp_error<>MP_OKAY then exit;
asig := a.num.sign;
s_mpr_qr(a.num,a.den,b,r);
if asig=MP_NEG then b.sign := MP_NEG;
mp_clear(r);
end;
{---------------------------------------------------------------------------}
procedure mpr_write_decimal(var tf: system.text; const a: mp_rat);
{-write decimal representation to file tf}
begin
mpr_write_radix(tf, a, 10);
end;
{---------------------------------------------------------------------------}
procedure mpr_write_radix(var tf: system.text; const a: mp_rat; radix: word);
{-write radix representation to file tf}
begin
if mp_error<>MP_OKAY then exit;
{$ifdef MPC_ArgCheck}
if mpr_not_init(a) then begin
{$ifdef MPC_HaltOnArgCheck}
{$ifdef MPC_UseExceptions}
raise MPXNotInit.Create('mpr_write_radix');
{$else}
RunError(MP_RTE_NOTINIT);
{$endif}
{$else}
set_mp_error(MP_NOTINIT);
exit;
{$endif}
end;
{$endif}
mp_write_radix(tf,a.num,radix);
if not mp_is1(a.den) then begin
write(tf,'/');
s_mp_write_radix(tf,a.den,radix,false);
end;
end;
{---------------------------------------------------------------------------}
procedure mpr_zero(var a: mp_rat);
{-set a to zero}
begin
{arg checks are done by mpr_zero/set}
if mp_error<>MP_OKAY then exit;
mp_zero(a.num);
mp_set1(a.den);
end;
{---------------------------------------------------------------------------}
{---------------------------------------------------------------------------}
end.
| 27.311364 | 95 | 0.568375 |
fcff780911358c987f34d373de08eefa5eff8540 | 770 | pas | Pascal | Binaries/Examples/Demo.pas | CWBudde/PascalPrimer | cfaedf6761aeeabbac25792c7c0634aeb7f7a303 | [
"MIT"
]
| 6 | 2015-06-08T13:12:22.000Z | 2020-12-04T14:56:13.000Z | Binaries/Examples/Demo.pas | CWBudde/PascalPrimer | cfaedf6761aeeabbac25792c7c0634aeb7f7a303 | [
"MIT"
]
| 2 | 2018-08-31T00:35:47.000Z | 2021-11-09T12:58:01.000Z | Binaries/Examples/Demo.pas | CWBudde/PascalPrimer | cfaedf6761aeeabbac25792c7c0634aeb7f7a303 | [
"MIT"
]
| 4 | 2017-03-12T22:42:55.000Z | 2021-02-25T22:48:10.000Z | Center;
Clear(clWhite);
MoveTo(0.5 * ClientWidth - 10, 0.5 * ClientHeight);
CursorAngle := 0;
AntiAliasedLine := True;
const Steps = 157;
const Interval = 10;
for var i := 0 to Steps - 1 do
begin
if i < (Steps div 2) then
CursorColor := ComposeColor(i / (Steps div 2), 0, (Steps div 2 - i) / (Steps div 2))
else
CursorColor := ComposeColor(
1 - (i - (Steps div 2)) / (Steps div 2), 0,
1 - ((Steps div 2 - (i - Steps div 2)) / (Steps div 2)));
Draw(90);
Delay(10);
TurnLeft(45);
Draw(60);
TurnRight(0.5 * 360 / Steps);
TurnRight(180);
Draw(76);
TurnRight(45);
end; | 27.5 | 88 | 0.468831 |
c3352a41103149bcbb6cb5ee3d064a3097ac6751 | 1,317 | pas | Pascal | src/PinNoEntry.pas | tobia/VeeCad | dffbcef00d19c5013f0c14a8d97f8893bac49cf1 | [
"MIT"
]
| null | null | null | src/PinNoEntry.pas | tobia/VeeCad | dffbcef00d19c5013f0c14a8d97f8893bac49cf1 | [
"MIT"
]
| null | null | null | src/PinNoEntry.pas | tobia/VeeCad | dffbcef00d19c5013f0c14a8d97f8893bac49cf1 | [
"MIT"
]
| null | null | null | unit PinNoEntry;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TPinNoEntryForm = class(TForm)
NumberTEdit: TEdit;
Label1: TLabel;
Button1: TButton;
Button2: TButton;
WarningTLabel: TLabel;
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
FPinName : string;
procedure SetPinName( value : string );
public
{ Public declarations }
property PinName : string read FPinName write SetPinName;
end;
var
PinNoEntryForm: TPinNoEntryForm;
implementation
{$R *.DFM}
procedure TPinNoEntryForm.FormShow(Sender: TObject);
begin
WarningTLabel.Caption := '';
NumberTEdit.SetFocus;
NumberTEdit.SelectAll;
end;
procedure TPinNoEntryForm.SetPinName( value : string );
begin
FPinName := Trim(value);
NumberTEdit.Text := FPinName;
end;
procedure TPinNoEntryForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
if ModalResult <> mrOK then begin
exit;
end;
FPinName := Trim( NumberTEdit.Text );
if FPinName = '' then begin
WarningTLabel.Caption := 'Pin Name is blank!';
NumberTEdit.Text := FPinName;
CanClose := False;
end;
end;
end.
| 20.261538 | 81 | 0.693242 |
f15321a7ef3b0f7c12916fb6a9cea9a4c7823bad | 934 | dfm | Pascal | source/CapturaCam.dfm | roneysousa/info_financeiro | 1e5135396b2c02ee47658a71ef83855cddfb73eb | [
"MIT"
]
| 1 | 2021-01-31T20:00:45.000Z | 2021-01-31T20:00:45.000Z | source/CapturaCam.dfm | roneysousa/info_financeiro | 1e5135396b2c02ee47658a71ef83855cddfb73eb | [
"MIT"
]
| null | null | null | source/CapturaCam.dfm | roneysousa/info_financeiro | 1e5135396b2c02ee47658a71ef83855cddfb73eb | [
"MIT"
]
| 1 | 2021-01-31T20:00:47.000Z | 2021-01-31T20:00:47.000Z | object fCaptura: TfCaptura
Left = 248
Top = 241
BorderIcons = [biSystemMenu]
BorderStyle = bsSingle
Caption = 'Captura Cam'
ClientHeight = 347
ClientWidth = 337
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnDestroy = FormDestroy
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object camCamera: TCamera
Left = 8
Top = 8
Width = 321
Height = 281
FichierVideo = 'Video.avi'
FichierImage = 'Imagem.bmp'
end
object btnConfirma: TButton
Left = 16
Top = 295
Width = 137
Height = 46
Caption = '&Confirmar'
ModalResult = 1
TabOrder = 1
end
object btnCancelar: TButton
Left = 167
Top = 295
Width = 146
Height = 46
Caption = 'Canc&elar'
ModalResult = 2
TabOrder = 2
end
end
| 19.458333 | 32 | 0.643469 |
f1a77182f15dde36471b4e83ee337dc28f1e2170 | 749 | lpr | Pascal | cbd/parcial/generadores/gen02.lpr | sergiocarp10/unlp-info-s5 | d9cb457f2b44278ae495bafe67cedda3c7f2c102 | [
"Apache-2.0"
]
| 4 | 2021-03-14T20:45:38.000Z | 2022-03-09T04:31:24.000Z | cbd/parcial/generadores/gen02.lpr | sergiocarp10/unlp-info-s5 | d9cb457f2b44278ae495bafe67cedda3c7f2c102 | [
"Apache-2.0"
]
| 7 | 2021-03-21T01:08:38.000Z | 2021-05-30T10:47:20.000Z | cbd/parcial/generadores/gen02.lpr | sergiocarp10/unlp-info-s5 | d9cb457f2b44278ae495bafe67cedda3c7f2c102 | [
"Apache-2.0"
]
| 1 | 2021-05-29T20:06:54.000Z | 2021-05-29T20:06:54.000Z | program gen02;
uses sysutils;
// Declaración de tipos de variables
type
tString = string[30];
tEspecie = record
num:integer;
alturaMax:real;
nomCientifico:tString;
nomVulgar:tString;
color:tString;
alturaMaxAlcanzar:real;
end;
tArchivo = file of tEspecie;
var
arch:tArchivo;
esp:tEspecie;
i:integer;
begin
assign(arch,'ej02.dat');
rewrite(arch);
randomize;
for i:=1 to 10 do begin
esp.alturaMax:=random(1000)/100;
esp.alturaMaxAlcanzar:=esp.alturaMax+random(500)/100;
esp.color:=concat('color',intToStr(i));
esp.nomCientifico:=concat('nomCientifico',intToStr(i));
esp.nomVulgar:=concat('nomVulgar',intToStr(i));
esp.num:=i;
write(arch,esp);
end;
close(arch);
end.
| 18.268293 | 59 | 0.675567 |
47d18f6eb05f1e0af68f41294ac549631f4c549a | 196,659 | pas | Pascal | Server/FHIR.Server.Web.pas | niaz819/fhirserver | fee45e1e57053a776b893dba543f700dd9cb9075 | [
"BSD-3-Clause"
]
| null | null | null | Server/FHIR.Server.Web.pas | niaz819/fhirserver | fee45e1e57053a776b893dba543f700dd9cb9075 | [
"BSD-3-Clause"
]
| null | null | null | Server/FHIR.Server.Web.pas | niaz819/fhirserver | fee45e1e57053a776b893dba543f700dd9cb9075 | [
"BSD-3-Clause"
]
| null | null | null | Unit FHIR.Server.Web;
{
Copyright (c) 2011+, HL7 and Health Intersections Pty Ltd (http://www.healthintersections.com.au)
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
}
{$IFDEF FPC}
{$MODE Delphi}
{$ENDIF}
{
how security works for the FHIR Server
The FHIR Server offers 2 end-points - secure, and insecure.
The insecure API grants full access to the store, and never applies any security, on the specified port and path.
You can turn this on or off by controlling seting the port in the ini file that controls the server
[web]
http=[port]
base=/path
The server can also provide a secure end-point:
[web]
https=[port]
secure=/path ; must be a different port to the unsecured end-point.
modes=
The modes setting controls which kind of security models are applied to the interface.
It is a comma separated list of the following codes:
oauth - OAuth2 using the Smart-on-fhir profile. Users must use a registered client, and idenitfy themselves
notes:
- clients are configured in auth.ini
- user accounts / default right are configured through the SCIM server
owin - Client must authenticate using the owin protocol, and then pass the owin token in the bearer.
notes:
- client details are configured.... where....?
- client is trusted, and users are not authenticated. Client has access to all resources
cert - Client must provide an SSL certificate, which must be pre-registered on the server.
notes:
- client certificates are registered in auth.ini. See notes there
- how users are handled depends on settings in auth.ini
}
Interface
Uses
{$IFDEF MSWINDOWS} Windows, ActiveX, ComObj, {$ELSE} FHIR.Support.Osx, {$ENDIF}
SysUtils, Classes, IniFiles, System.Generics.Collections, {JCL JclDebug,} EncdDecd, {$IFNDEF VER260} System.NetEncoding, {$ENDIF}
IdMultipartFormData, IdHeaderList, IdCustomHTTPServer, IdHTTPServer, IdTCPServer, IdContext, IdSSLOpenSSL, IdHTTP, IdCookie, IdZLibCompressorBase,
IdCompressorZLib, IdZLib, IdSSLOpenSSLHeaders, IdSchedulerOfThreadPool, IdGlobalProtocols, FHIR.Web.Socket,
FHIR.Support.Base, FHIR.Support.Utilities, FHIR.Support.Certs, FHIR.Support.Logging, FHIR.Support.Stream, FHIR.Support.Collections, FHIR.Support.Threads, FHIR.Support.JSON, FHIR.Support.MXml,
{$IFDEF MSWINDOWS} FHIR.Support.MsXml, {$ENDIF} FHIR.Support.Service,
FHIR.Web.Parsers, FHIR.Database.Manager, FHIR.Web.HtmlGen, FHIR.Database.Dialects, FHIR.Web.Rdf, FHIR.Web.GraphQL, FHIR.Web.Twilio,
FHIR.Base.Objects, FHIR.Base.Parser, FHIR.Base.Lang, FHIR.Base.Xhtml, FHIR.Base.Utilities, FHIR.Base.Common, FHIR.Base.Factory,
FHIR.Smart.Utilities, FHIR.CdsHooks.Utilities, FHIR.CdsHooks.Client,
FHIR.Tools.GraphQL, FHIR.Tools.NDJsonParser,
{$IFNDEF NO_CONVERSION} FHIR.XVersion.Convertors,{$ENDIF}
FHIR.Tx.Server, FHIR.Tx.Manager, FHIR.Snomed.Expressions, FHIR.Loinc.Services, FHIR.Loinc.Publisher, FHIR.Tx.Web, FHIR.Tx.Service,
FHIR.Server.Tags, FHIR.Server.Session, FHIR.Server.Storage, FHIR.Server.Security, FHIR.Server.XhtmlComp, FHIR.Snomed.Services, FHIR.Snomed.Publisher, FHIR.Server.Ini,
FHIR.Scim.Server,
FHIR.Server.AuthMgr, FHIR.Server.ReverseClient, FHIR.CdsHooks.Server, FHIR.Server.WebSource, FHIR.Server.Analytics, FHIR.Server.BundleBuilder, FHIR.Server.Factory,
FHIR.Server.UserMgr, FHIR.Server.Context, FHIR.Server.Constants, FHIR.Server.Utilities, FHIR.Server.Jwt, FHIR.Server.Javascript, FHIR.Server.Subscriptions;
Const
OWIN_TOKEN_PATH = 'oauth/token';
Type
ERestfulAuthenticationNeeded = class(ERestfulException)
private
FMsg: String;
public
constructor Create(Const sContext : String; sMessage, sCaption, lang : String); overload;
Property Msg: String read FMsg;
end;
TFhirWebServer = class;
TFhirWebServerEndpoint = class;
TFhirServerMaintenanceThread = class(TThread)
private
FServer: TFhirWebServer;
FLastSweep: TDateTime;
protected
procedure Execute; override;
public
constructor Create(server: TFhirWebServer);
end;
TFhirServerSubscriptionThread = class(TThread)
private
FServer: TFhirWebServer;
protected
procedure Execute; override;
public
constructor Create(server: TFhirWebServer);
end;
TFhirServerEmailThread = class(TThread)
private
FServer: TFhirWebServer;
protected
procedure Execute; override;
public
constructor Create(server: TFhirWebServer);
end;
TAsyncTaskThread = class(TThread)
private
FKey : integer;
FServer : TFhirWebServerEndPoint;
FRequest : TFHIRRequest;
FFormat : TFHIRFormat;
files : TFslMap<TFslFile>;
FBundle : TFHIRBundleW;
procedure SetRequest(const Value: TFHIRRequest);
procedure SetServer(const Value: TFhirWebServerEndPoint);
procedure status(status : TAsyncTaskStatus; message : String);
procedure details;
procedure callback(IntParam: Integer; StrParam: String);
procedure saveOutcome(response : TFHIRResponse);
procedure doGetBundleBuilder(request : TFHIRRequest; context : TFHIRResponse; aType : TBundleType; out builder : TFhirBundleBuilder);
protected
procedure Execute; override;
public
constructor Create();
destructor Destroy; override;
procedure kill;
property Key : integer read FKey write FKey;
property Format : TFHIRFormat read FFormat write FFormat;
Property Server : TFhirWebServerEndPoint read FServer write SetServer;
Property Request : TFHIRRequest read FRequest write SetRequest;
end;
TFHIRWebServerClientInfo = class(TFslObject)
private
FContext: TIdContext;
FActivity: String;
FSession: TFHIRSession;
FCount: integer;
FStart: cardinal;
procedure SetSession(const Value: TFHIRSession);
public
destructor Destroy; Override;
property Context: TIdContext read FContext write FContext;
property Session: TFHIRSession read FSession write SetSession;
property Activity: String read FActivity write FActivity;
property Count: integer read FCount write FCount;
end;
TFHIRWebServerPatientViewContext = class(TFslObject)
private
FContext : TFHIRServerContext;
FCards: TFslList<TCDSHookCard>;
FErrors: TStringList;
FManager: TCDSHooksManager;
procedure SetManager(const Value: TCDSHooksManager);
public
constructor Create(context : TFHIRServerContext);
destructor Destroy; Override;
property manager: TCDSHooksManager read FManager write SetManager;
property Errors: TStringList read FErrors;
property cards: TFslList<TCDSHookCard> read FCards;
end;
TFhirWebServerEndpoint = class (TFslObject)
private
FWebServer : TFHIRWebServer;
FAuthServer: TAuth2Server;
FCDSHooksServer: TCDSHooksServer;
FTerminologyWebServer: TTerminologyWebServer;
FContext : TFHIRServerContext;
FPath: String;
FPatientHooks: TFslMap<TFHIRWebServerPatientViewContext>;
FAdaptors: TFslMap<TFHIRFormatAdaptor>;
carry: TFslZipReader; // for uploading support
carryName: String;
FCode: String;
function factory : TFHIRFactory;
function OAuthPath(secure: boolean): String;
function readVersion(mt : String) : TFHIRVersion;
Procedure ReadTags(header: String; request: TFHIRRequest); overload;
procedure cacheResponse(response: TIdHTTPResponseInfo; caching: TFHIRCacheControl);
function EndPointDesc(secure: boolean): String;
function loadFromRsaDer(cert : string) : TJWKList;
function parseFile(fmt: TFHIRFormat; name: String): TFHIRResourceV;
function EncodeVersionsJson(r: TFHIRResourceV): TBytes;
function EncodeVersionsXml(r: TFHIRResourceV): TBytes;
function processProvenanceHeader(header, lang: String): TFhirResourceV;
function LookupReference(Context: TFHIRRequest; id: String): TResourceWithReference;
function patientAppList(base, id : String) : string;
procedure GetPatients(details : TFslStringDictionary);
function processRegistration(request : TIdHTTPRequestInfo; session : TFhirSession) : String;
function HandleWebPatient(request: TFHIRRequest; response: TFHIRResponse; secure: boolean): TDateTime;
procedure GetWebUILink(resource: TFhirResourceV; base, statedType, id, ver: String; var link, text: String);
function getReferencesByType(t : String) : String;
Procedure RunPostHandler(request : TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; Session: TFHIRSession; claimed, actual: String; secure: boolean);
procedure PopulateConformance(sender: TObject; conf: TFhirCapabilityStatementW);
Procedure HandleOWinToken(AContext: TIdContext; secure: boolean; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo);
Procedure HandleRequest(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; ssl, secure: boolean; path: String; logId : String; esession: TFHIRSession; cert: TIdX509);
procedure doGetBundleBuilder(request : TFHIRRequest; context : TFHIRResponse; aType : TBundleType; out builder : TFhirBundleBuilder);
{$IFDEF MSWINDOWS}
function transform1(resource: TFhirResourceV; lang, xslt: String; saveOnly: boolean): string;
function HandleWebQuestionnaire(request: TFHIRRequest; response: TFHIRResponse): TDateTime;
function HandleWebQuestionnaireInstance(request: TFHIRRequest; response: TFHIRResponse): TDateTime;
function HandleWebProfile(request: TFHIRRequest; response: TFHIRResponse): TDateTime;
{$ENDIF}
Procedure HandleWebSockets(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; ssl, secure: boolean; path: String);
Function BuildFhirHomePage(compList : TFslList<TFHIRCompartmentId>; logId, lang, host, sBaseURL: String; Session: TFHIRSession; secure: boolean): String;
Function BuildFhirUploadPage(lang, host, sBaseURL: String; aType: String; Session: TFHIRSession): String;
Function BuildFhirAuthenticationPage(lang, host, path, logId, Msg: String; secure: boolean): String;
function GetResource(Session: TFHIRSession; rtype: String; lang, id, ver, op: String): TFhirResourceV;
function CheckSessionOK(Session: TFHIRSession; ip: string): boolean;
function FindResource(Session: TFHIRSession; rtype: String; lang, params: String): TFhirResourceV;
function HandleWebPost(request: TFHIRRequest; response: TFHIRResponse): TDateTime;
function HandleWebEdit(request: TFHIRRequest; response: TFHIRResponse): TDateTime;
function HandleWebUIRequest(request: TFHIRRequest; response: TFHIRResponse; secure: boolean): TDateTime;
procedure startHooks(ctxt: TFHIRWebServerPatientViewContext; patient: TFHIRPatientW; url: String);
function HandleWebPatientHooks(request: TFHIRRequest; response: TFHIRResponse; secure: boolean): TDateTime;
function HandleWebCreate(request: TFHIRRequest; response: TFHIRResponse): TDateTime;
function makeTaskRedirect(base, id : String; msg : String; fmt : TFHIRFormat; names : TStringList) : string;
procedure CheckAsyncTasks;
Procedure ProcessScimRequest(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo);
Procedure ProcessAsyncRequest(Context: TOperationContext; request: TFHIRRequest; response: TFHIRResponse);
Procedure ProcessTaskRequest(Context: TOperationContext; request: TFHIRRequest; response: TFHIRResponse);
procedure SendError(response: TIdHTTPResponseInfo; logid : string; status: word; format: TFHIRFormat; lang, message, url: String; e: exception; Session: TFHIRSession; addLogins: boolean; path: String; relativeReferenceAdjustment: integer; code: TFHIRIssueType);
Procedure ReturnProcessedFile(request : TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; Session: TFHIRSession; path: String; secure: boolean; variables: TFslStringDictionary = nil); overload;
Procedure ReturnProcessedFile(request : TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; Session: TFHIRSession; claimed, actual: String; secure: boolean; variables: TFslStringDictionary = nil); overload;
Procedure ReturnSpecFile(response: TIdHTTPResponseInfo; stated, path: String; secure : boolean);
procedure checkRequestByJs(context : TOperationContext; request : TFHIRRequest);
Procedure ProcessRequest(Context: TOperationContext; request: TFHIRRequest; response: TFHIRResponse);
procedure OnCDSResponse(manager: TCDSHooksManager; server: TRegisteredFHIRServer; Context: TObject; response: TCDSHookResponse; error: String);
function DoSearch(Session: TFHIRSession; rtype: string; lang, params: String): TFHIRBundleW;
Function ProcessZip(lang: String; oStream: TStream; name, base: String; init: boolean; ini: TFHIRServerIniFile; Context: TOperationContext; var cursor: integer): TFHIRBundleW;
function BuildRequest(lang, sBaseURL, sHost, sOrigin, sClient, sContentLocation, sCommand, sResource, sContentType, sContentAccept, sContentEncoding,
sCookie, provenance, sBearer: String; oPostStream: TStream; oResponse: TFHIRResponse; var aFormat: TFHIRFormat; var redirect: boolean; form: TMimeMessage;
bAuth, secure: boolean; out relativeReferenceAdjustment: integer; var style : TFHIROutputStyle; Session: TFHIRSession; cert: TIdX509): TFHIRRequest;
Procedure PlainRequest(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; id : String);
Procedure SecureRequest(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; cert : TIdX509; id : String);
Procedure ProcessOutput(oRequest: TFHIRRequest; oResponse: TFHIRResponse; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; relativeReferenceAdjustment: integer; style : TFHIROutputStyle; gzip: boolean);
public
constructor Create(code : String; path : String; server : TFHIRWebServer; context : TFHIRServerContext);
destructor Destroy; override;
property CDSHooksServer: TCDSHooksServer read FCDSHooksServer;
property path : String read FPath;
function ClientAddress(secure: boolean): String;
property code : String read FCode;
property Context : TFHIRServerContext read FContext;
property AuthServer : TAuth2Server read FAuthServer;
Procedure Transaction(stream: TStream; init : boolean; name, base: String; ini: TFHIRServerIniFile; callback: TInstallerCallback); overload;
Procedure Transaction(bundle : TFHIRBundleW; init : boolean; name, base: String; callback: TInstallerCallback); overload;
end;
TFhirWebServer = Class(TFslObject)
Private
FSettings : TFHIRServerSettings;
FLock: TFslLock;
// base web server configuration
FActive: boolean;
// can start without actually making the web servers available - for internal use e.g. loading...
FName: String; // name of this server
FOwnerName: String; // name of the org that adminsiters the service
FHomePage: String;
FAdminEmail: String; // stated administrator
FFacebookLike: boolean;
FHostSms: String; // for status update messages
FSourceProvider: TFHIRWebServerSourceProvider;
FJsPath : String;
// web configuration
FHost: String;
FActualPort: integer;
FActualSSLPort: integer;
FCertFile: String;
FRootCertFile: String;
FSSLPassword: String;
FInLog : TLogger;
FOutLog : TLogger;
// security admin
FUseOAuth: boolean;
FOWinSecurityPlain: boolean;
FOWinSecuritySecure: boolean;
FServeMissingCertificate: boolean;
FServeUnknownCertificate: boolean;
FCertificateIdList: TStringList;
FServeMissingJWT: boolean;
FServeUnverifiedJWT: boolean;
FJWTAuthorities: TFslStringDictionary;
FGoogle : TGoogleAnalyticsProvider;
// operational fields
FPlainServer: TIdHTTPServer;
FSSLServer: TIdHTTPServer;
FIOHandler: TIdServerIOHandlerSSLOpenSSL;
FTotalCount: cardinal;
FRestCount: cardinal;
FStartTime: cardinal;
FTotalTime: cardinal;
FRestTime: cardinal;
FClients: TFslList<TFHIRWebServerClientInfo>;
FEndPoints : TFslList<TFhirWebServerEndpoint>;
FMaintenanceThread: TFhirServerMaintenanceThread;
FSubscriptionThread: TFhirServerSubscriptionThread;
FEmailThread: TFhirServerEmailThread;
FPatientViewServers: TFslStringDictionary;
FIsTerminologyServerOnly: boolean;
FThreads : TList<TAsyncTaskThread>;
FOnRegisterJs: TRegisterJavascriptEvent;
procedure convertFromVersion(stream : TStream; format : TFHIRFormat; version : TFHIRVersion; lang : String);
procedure convertToVersion(stream : TStream; format : TFHIRFormat; version : TFHIRVersion; lang : String);
function WebDump: String;
Procedure ReturnProcessedFile(request : TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; path: String; secure: boolean; variables: TFslStringDictionary = nil); overload;
Procedure ReturnProcessedFile(request : TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; claimed, actual: String; secure: boolean; variables: TFslStringDictionary = nil); overload;
Procedure ReturnSpecFile(response: TIdHTTPResponseInfo; stated, path: String; secure : boolean);
function hasInternalSSLToken(request: TIdHTTPRequestInfo): boolean;
procedure logRequest(secure : boolean; id : String; request : TIdHTTPRequestInfo);
procedure logResponse(id : String; resp : TIdHTTPResponseInfo);
// Procedure ReadTags(Headers: TIdHeaderList; Request : TFHIRRequest); overload;
Procedure CreatePostStream(AContext: TIdContext; AHeaders: TIdHeaderList; var VPostStream: TStream);
Procedure ParseAuthenticationHeader(AContext: TIdContext; const AAuthType, AAuthData: String; var VUsername, VPassword: String; var VHandled: boolean);
procedure MarkEntry(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo);
procedure MarkExit(AContext: TIdContext);
Procedure ReverseProxy(proxy: TReverseProxyInfo; AContext: TIdContext; request: TIdHTTPRequestInfo; Session: TFHIRSession; response: TIdHTTPResponseInfo; secure: boolean);
Procedure PlainRequest(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo);
Procedure SecureRequest(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo);
function extractFileData(lang : String; form: TMimeMessage; const name: String; var sContentType: String): TStream;
Procedure StartServer(active: boolean);
Procedure StopServer;
procedure SSLPassword(var Password: String);
function encodeAsyncResponseAsJson(request : TFHIRRequest; reqUrl : String; secure : boolean; fmt : TFHIRFormat; transactionTime : TDateTimeEx; names : TStringList) : string;
procedure DoConnect(AContext: TIdContext);
procedure DoDisconnect(AContext: TIdContext);
Function WebDesc: String;
function loadMultipartForm(const request: TStream; const contentType: String; var upload: boolean): TMimeMessage;
function DoVerifyPeer(Certificate: TIdX509; AOk: boolean; ADepth, AError: integer): boolean;
Procedure ReturnDiagnostics(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; ssl, secure: boolean);
Procedure RecordExchange(req: TFHIRRequest; resp: TFHIRResponse; e: exception = nil);
procedure smsStatus(Msg: String);
procedure SetSourceProvider(const Value: TFHIRWebServerSourceProvider);
procedure StopAsyncTasks;
function endpointList: String;
Public
constructor Create(settings : TFHIRServerSettings; name: String);
destructor Destroy; Override;
procedure loadConfiguration(ini : TFHIRServerIniFile);
Procedure Start(active: boolean);
Procedure Stop;
Property SourceProvider: TFHIRWebServerSourceProvider read FSourceProvider write SetSourceProvider;
property host: String read FHost;
property EndPoints : TFslList<TFhirWebServerEndpoint> read FEndPoints;
function EndPoint(name : String) : TFhirWebServerEndpoint;
property SSLPort: integer read FActualSSLPort;
property UseOAuth: boolean read FUseOAuth write FUseOAuth;
property OWinSecurityPlain: boolean read FOWinSecurityPlain write FOWinSecurityPlain;
property OWinSecuritySecure: boolean read FOWinSecuritySecure write FOWinSecuritySecure;
property ServeMissingCertificate: boolean read FServeMissingCertificate write FServeMissingCertificate;
property ServeUnknownCertificate: boolean read FServeUnknownCertificate write FServeUnknownCertificate;
property CertificateIdList: TStringList read FCertificateIdList;
property ServeMissingJWT: boolean read FServeMissingJWT write FServeMissingJWT;
property ServeUnverifiedJWT: boolean read FServeUnverifiedJWT write FServeUnverifiedJWT;
property JWTAuthorities: TFslStringDictionary read FJWTAuthorities;
property settings : TFHIRServerSettings read FSettings;
property IsTerminologyServerOnly: boolean read FIsTerminologyServerOnly write FIsTerminologyServerOnly;
function registerEndPoint(code, path : String; context : TFHIRServerContext; ini : TFHIRServerIniFile) : TFhirWebServerEndpoint;
property OnRegisterJs : TRegisterJavascriptEvent read FOnRegisterJs write FOnRegisterJs;
End;
Function ProcessPath(base, path: String): string;
Implementation
Uses
{$IFDEF MSWINDOWS}
Registry,
{$ENDIF}
FHIR.Web.Facebook;
Function GetMimeTypeForExt(AExt: String): String;
{$IFDEF MSWINDOWS}
Var
fReg: TRegistry;
{$ENDIF}
Begin
result := '';
AExt := lowercase(AExt);
if (AExt = '.css') Then
result := 'text/css'
Else if AExt = '.ico' Then
result := 'image/x-icon'
Else if AExt = '.png' Then
result := 'image/png'
Else if AExt = '.gif' Then
result := 'image/gif'
Else if AExt = '.jpg' Then
result := 'image/jpeg'
Else if AExt = '.mpg' Then
result := 'video/mpeg'
Else if AExt = '.js' Then
result := 'text/javascript'
Else
Begin
{$IFDEF MSWINDOWS}
Try
fReg := TRegistry.Create;
Try
fReg.RootKey := HKEY_LOCAL_MACHINE;
fReg.OpenKeyReadOnly('Software\Classes\' + AExt);
result := fReg.ReadString('Content Type');
fReg.CloseKey;
Finally
fReg.Free;
End;
Except
End;
{$ENDIF}
End;
If result = '' Then
result := 'application/octet-stream';
end;
{ TFhirWebServerEndpoint }
constructor TFhirWebServerEndpoint.create(code : String; path: String; server : TFHIRWebServer; context: TFHIRServerContext);
begin
inherited create;
FPath := path;
FCode := code;
FWebServer := server;
FContext := context;
FPatientHooks := TFslMap<TFHIRWebServerPatientViewContext>.Create;
FAdaptors := TFslMap<TFHIRFormatAdaptor>.Create;
// FAdaptors.Add('dataPoints', TOpenMHealthAdaptor.Create);
// FAuthServer: TAuth2Server;
// FCDSHooksServer: TCDSHooksServer;
FTerminologyWebServer := TTerminologyWebServer.create(FContext.TerminologyServer.Link, FContext.ValidatorContext.link, FPath, '?', ReturnProcessedFile);
end;
destructor TFhirWebServerEndpoint.Destroy;
begin
FContext.Free;
FCDSHooksServer.Free;
FTerminologyWebServer.Free;
FAuthServer.Free;
carry.Free;
FAdaptors.Free;
FPatientHooks.Free;
inherited;
end;
function TFhirWebServerEndpoint.DoSearch(Session: TFHIRSession; rtype: string; lang, params: String): TFHIRBundleW;
var
request: TFHIRRequest;
response: TFHIRResponse;
Context: TOperationContext;
begin
request := TFHIRRequest.Create(FContext.ValidatorContext.link, roRest, FContext.Indexes.Compartments.link);
Context := TOperationContext.Create;
try
response := TFHIRResponse.Create(FContext.ValidatorContext.link);
try
response.OnCreateBuilder := doGetBundleBuilder;
request.Session := Session.link;
request.ResourceName := rtype;
request.lang := lang;
request.LoadParams(params);
request.CommandType := fcmdSearch;
checkRequestByJs(context, request);
ProcessRequest(Context, request, response);
result := factory.wrapBundle(response.resource.link);
finally
response.Free;
request.Free;
end;
finally
Context.Free;
end;
end;
procedure TFhirWebServerEndpoint.Transaction(bundle: TFHIRBundleW; init: boolean; name, base: String; callback: TInstallerCallback);
var
req: TFHIRRequest;
resp: TFHIRResponse;
// op : TFHIRNativeOperationEngine;
Context: TOperationContext;
begin
// if init then
// op := FServerContext.Storage.createOperationContext('en');
Context := TOperationContext.Create(true, callback, 'Load from ' + name);
try
req := TFHIRRequest.Create(FContext.ValidatorContext.link, roUpload, FContext.Indexes.Compartments.link);
try
req.CommandType := fcmdTransaction;
req.resource := bundle.Resource.link;
req.resource.tags['duplicates'] := 'ignore';
req.Session := FContext.SessionManager.CreateImplicitSession('n/a', FContext.Globals.OwnerName, 'Service Manager', systemInternal, true, false);
req.Session.allowAll;
req.LoadParams('');
req.baseUrl := FContext.Globals.Bases[0];
Context.message := 'Process ' + name;
// GJSHost.registry := FContext.EventScriptRegistry.link;
resp := TFHIRResponse.Create(FContext.ValidatorContext.link);
try
resp.OnCreateBuilder := doGetBundleBuilder;
checkRequestByJs(context, req);
ProcessRequest(Context, req, resp);
finally
resp.Free;
end;
finally
req.Free;
end;
finally
Context.Free;
end;
end;
function TFhirWebServerEndpoint.parseFile(fmt : TFHIRFormat; name : String) : TFHIRResourceV;
var
p : TFHIRParser;
f : TFileStream;
begin
p := factory.makeParser(FContext.ValidatorContext.link, fmt, 'en');
try
f := TFileStream.Create(name, fmOpenRead);
try
result := p.parseResource(f)
finally
f.Free;
end;
finally
p.Free;
end;
end;
procedure TFhirWebServerEndpoint.Transaction(stream: TStream; init : boolean; name, base: String; ini: TFHIRServerIniFile; callback: TInstallerCallback);
var
req: TFHIRRequest;
resp: TFHIRResponse;
// op : TFHIRNativeOperationEngine;
cursor: integer;
Context: TOperationContext;
b : TFHIRBundleW;
begin
// if init then
// op := FServerContext.Storage.createOperationContext('en');
Context := TOperationContext.Create(true, callback, 'Load from ' + name);
try
req := TFHIRRequest.Create(FContext.ValidatorContext.link, roUpload, FContext.Indexes.Compartments.link);
try
req.CommandType := fcmdTransaction;
if ExtractFileExt(name) = '.xml' then
req.resource := ParseFile(ffXml, name)
else if ExtractFileExt(name) = '.json' then
req.resource := ParseFile(ffJson, name)
else
begin
b := ProcessZip('en', stream, name, base, init, ini, Context, cursor);
try
req.resource := b.Resource.link;
finally
b.free;
end;
end;
if req.Resource.fhirType <> 'Bundle' then
begin
b := factory.wrapBundle(factory.makeResource('Bundle'));
try
b.type_ := btTransaction;
b.addEntry('', req.Resource.link);
req.resource := b.Resource.link;
finally
b.Free;
end;
end;
req.resource.tags['duplicates'] := 'ignore';
req.Session := FContext.SessionManager.CreateImplicitSession('n/a', FContext.Globals.OwnerName, 'Service Manager', systemInternal, true, false);
req.Session.allowAll;
req.LoadParams('');
req.baseUrl := FContext.Globals.Bases[0];
Context.message := 'Process ' + name;
GJSHost.registry := FContext.EventScriptRegistry.link;
resp := TFHIRResponse.Create(FContext.ValidatorContext.link);
try
resp.OnCreateBuilder := doGetBundleBuilder;
checkRequestByJs(context, req);
ProcessRequest(Context, req, resp);
finally
resp.Free;
end;
finally
req.Free;
end;
finally
Context.Free;
end;
end;
function TFhirWebServerEndpoint.patientAppList(base, id : String): string;
var
b : TStringBuilder;
apps : TFslList<TRegisteredClientInformation>;
app : TRegisteredClientInformation;
begin
b := TStringBuilder.Create;
try
apps := TFslList<TRegisteredClientInformation>.create;
try
FContext.Storage.fetchClients(apps);
for app in apps do
begin
if app.patientContext then
begin
b.Append(' <li><a href="');
b.Append(app.url);
b.Append('?iss=https://');
b.Append(base);
b.Append('&launch=');
b.Append(id);
b.Append('">');
b.Append(FormatTextToXml(app.name, xmlText));
b.Append('</a></li>'#13#10);
end;
end;
finally
apps.Free;
end;
result := b.ToString;
finally
b.Free;
end;
end;
procedure TFhirWebServerEndpoint.PlainRequest(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; id : String);
var
Session: TFHIRSession;
sp : TFHIRWebServerSourceProvider;
c: integer;
check: boolean;
begin
Session := nil;
try
if (request.AuthUsername = INTERNAL_SECRET) then
FContext.SessionManager.GetSession(request.AuthPassword, Session, check);
if (Session = nil) then
begin
c := request.Cookies.GetCookieIndex(FHIR_COOKIE_NAME);
if c > -1 then
FContext.SessionManager.GetSession(request.Cookies[c].CookieText.Substring(FHIR_COOKIE_NAME.Length + 1), Session, check);
end;
if FWebServer.OWinSecurityPlain and (((Session = nil) and (request.Document <> FPath + OWIN_TOKEN_PATH)) or not FContext.UserProvider.allowInsecure) then
begin
response.ResponseNo := 401;
response.ResponseText := 'Unauthorized';
response.ContentText := 'Authorization is required (OWin at ' + FPath + OWIN_TOKEN_PATH + ')';
response.CustomHeaders.AddValue('WWW-Authenticate', 'Bearer');
end
else if FWebServer.OWinSecurityPlain and FContext.UserProvider.allowInsecure and (request.Document = FPath + OWIN_TOKEN_PATH) then
HandleOWinToken(AContext, false, request, response);
sp := FWebServer.FSourceProvider;
if sp.exists(sp.AltFile(request.Document, FPath)) then
ReturnSpecFile(response, request.Document, sp.AltFile(request.Document, FPath), false)
else if request.Document.EndsWith('.hts') and sp.exists(ChangeFileExt(sp.AltFile(request.Document, FPath), '.html')) then
ReturnProcessedFile(request, response, Session, request.Document, ChangeFileExt(sp.AltFile(request.Document, FPath), '.html'), false)
else if request.Document.EndsWith('.phs') and sp.exists(ChangeFileExt(sp.AltFile(request.Document, FPath), '.html')) then
runPostHandler(request, response, Session, request.Document, ChangeFileExt(sp.AltFile(request.Document, FPath), '.html'), false)
else if request.Document = '/.well-known/openid-configuration' then
FAuthServer.HandleDiscovery(AContext, request, response)
else if request.Document.StartsWith(FPath + '/cds-services') and FCDSHooksServer.active then
FCDSHooksServer.HandleRequest(false, FPath, Session, AContext, request, response)
else if request.Document.StartsWith(AppendForwardSlash(FPath) + 'websockets', false) then
HandleWebSockets(AContext, request, response, false, false, FPath)
else if (FTerminologyWebServer <> nil) and FTerminologyWebServer.handlesRequest(request.Document) then
FTerminologyWebServer.Process(AContext, request, Session, response, false)
else if request.Document.StartsWith(FPath, false) then
HandleRequest(AContext, request, response, false, false, FPath, id, Session, nil)
else if request.Document.StartsWith(AppendForwardSlash(FPath) + 'FSecurePath', false) then
HandleWebSockets(AContext, request, response, false, false, FPath)
else
begin
response.ResponseNo := 404;
response.ContentText := 'Document ' + request.Document + ' not found';
end;
finally
session.Free;
end;
end;
procedure TFhirWebServerEndPoint.PopulateConformance(sender: TObject; conf: TFhirCapabilityStatementW);
begin
if FAuthServer <> nil then
conf.addSmartExtensions(
ExcludeTrailingPathDelimiter(FContext.FormalURLSecure) + FAuthServer.AuthPath,
ExcludeTrailingPathDelimiter(FContext.FormalURLSecure) + FAuthServer.TokenPath,
ExcludeTrailingPathDelimiter(FContext.FormalURLSecure) + FAuthServer.RegisterPath)
else
conf.addSmartExtensions('', '', ''); // just set cors
end;
procedure TFhirWebServerEndPoint.secureRequest(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; cert : TIdX509; id : String);
var
Session: TFHIRSession;
sp : TFHIRWebServerSourceProvider;
check: boolean;
c: integer;
JWT: TJWT;
begin
Session := nil;
try
check := false;
if (request.AuthUsername = INTERNAL_SECRET) then
if request.AuthPassword.StartsWith('urn:') then
FContext.SessionManager.GetSession(request.AuthPassword, Session, check)
else
begin
JWT := TJWTUtils.unpack(request.AuthPassword, false, nil);
// todo: change this to true, and validate the JWT, under the right conditions
try
if cert = nil then
Session := FContext.SessionManager.getSessionFromJWT(request.RemoteIP, 'Unknown', systemUnknown, JWT)
else
Session := FContext.SessionManager.getSessionFromJWT(request.RemoteIP, cert.CanonicalName, systemFromCertificate, JWT);
finally
JWT.Free;
end;
end;
if (Session = nil) then
begin
c := request.Cookies.GetCookieIndex(FHIR_COOKIE_NAME);
if c > -1 then
FContext.SessionManager.GetSession(request.Cookies[c].CookieText.Substring(FHIR_COOKIE_NAME.Length + 1), Session, check);
// actually, in this place, we ignore check. we just established the session
end;
sp := FWebServer.FSourceProvider;
if request.Document.StartsWith(FAuthServer.path) then
FAuthServer.HandleRequest(AContext, request, Session, response)
else if FWebServer.OWinSecuritySecure and (request.Document = URLPath([FPath, OWIN_TOKEN_PATH])) then
HandleOWinToken(AContext, true, request, response)
else if sp.exists(sp.AltFile(request.Document, FPath)) then
ReturnSpecFile(response, request.Document, sp.AltFile(request.Document, FPath), true)
else if request.Document.EndsWith('.hts') and sp.exists(ChangeFileExt(sp.AltFile(request.Document, FPath), '.html')) then
ReturnProcessedFile(request, response, Session, request.Document, ChangeFileExt(sp.AltFile(request.Document, FPath), '.html'), true)
else if request.Document.StartsWith(FPath, false) then
HandleRequest(AContext, request, response, true, true, FPath, id, Session, cert)
else if FWebServer.OWinSecuritySecure and ((Session = nil) and (request.Document <> URLPath([FPath, OWIN_TOKEN_PATH]))) then
begin
response.ResponseNo := 401;
response.ResponseText := 'Unauthorized';
response.ContentText := 'Authorization is required (OWin at ' + FPath + OWIN_TOKEN_PATH + ')';
response.CustomHeaders.AddValue('WWW-Authenticate', 'Bearer');
end
else if request.Document.StartsWith('/scim') then
ProcessScimRequest(AContext, request, response)
else if request.Document = '/.well-known/openid-configuration' then
FAuthServer.HandleDiscovery(AContext, request, response)
else if request.Document.StartsWith(FPath, false) then
HandleRequest(AContext, request, response, true, true, FPath, id, session, cert)
else if (FTerminologyWebServer <> nil) and FTerminologyWebServer.handlesRequest(request.Document) then
FTerminologyWebServer.Process(AContext, request, Session, response, true)
else if request.Document.StartsWith(FPath + '/cds-services') and FCDSHooksServer.active then
FCDSHooksServer.HandleRequest(true, FPath, Session, AContext, request, response)
else if request.Document = FPath then
ReturnProcessedFile(request, response, Session, '/hompage.html', sp.AltFile('/homepage.html', FPath), true)
else
begin
response.ResponseNo := 404;
response.ContentText := 'Document ' + request.Document + ' not found';
end;
finally
session.Free;
end;
end;
procedure TFhirWebServerEndPoint.HandleOWinToken(AContext: TIdContext; secure: boolean; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo);
var
pm: TParseMap;
json: TJsonObject;
userkey: integer;
Session: TFHIRSession;
begin
response.ResponseNo := 400;
response.ResponseText := 'Request Error';
if request.contentType <> 'application/x-www-form-urlencoded' then
response.ContentText := 'Unknown content type - must be application/x-www-form-urlencoded'
else
begin
try
if request.PostStream <> Nil then
pm := TParseMap.Create(StreamToString(request.PostStream, TEncoding.UTF8))
else
pm := TParseMap.Create(request.UnparsedParams);
try
if pm.GetVar('grant_type') <> 'password' then
response.ContentText := 'Unknown content type - must be ''password'''
else if not FContext.UserProvider.CheckLogin(pm.GetVar('username'), pm.GetVar('password'), userkey) then
response.ContentText := 'Unknown username/password'
else
begin
Session := FContext.SessionManager.CreateImplicitSession(request.RemoteIP, pm.GetVar('username'), 'Anonymous', systemFromOWin, false, true);
try
Session.ExternalUserKey := userkey;
json := TJsonObject.Create;
try
json.str['access_token'] := Session.Cookie;
json.num['expires_in'] := inttostr(trunc((Session.Expires - TDateTimeEx.makeUTC.DateTime) / DATETIME_SECOND_ONE));
json.str['token_type'] := 'bearer';
response.ResponseNo := 200;
response.ResponseText := 'OK';
response.contentType := 'application/json';
response.ContentText := TJSONWriter.writeObjectStr(json, true);
finally
json.Free;
end;
finally
Session.Free;
end;
end;
finally
pm.Free;
end;
except
on e: exception do
response.ContentText := e.message;
end;
end;
end;
function asLinkHeader(links : TFslStringDictionary) : String;
var
s : String;
begin
result := '';
for s in links.Keys do
begin
if (result <> '') then
result := result +', ';
result := result + '<'+links[s]+'>;rel='+s;
end;
end;
function processIfModifiedSince(Value: String): TDateTime;
begin
if Value <> '' then
result := GMTToLocalDateTime(Value)
else
result := 0;
end;
function processIfMatch(Value: string): String;
begin
if Value.StartsWith('W/') then
Value := Value.Substring(2);
if Value.StartsWith('"') and Value.EndsWith('"') then
result := copy(Value, 2, Length(Value) - 2)
else
result := Value;
end;
Procedure TFhirWebServerEndpoint.HandleRequest(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; ssl, secure: boolean; path: String; logId : String; esession: TFHIRSession; cert: TIdX509);
var
sHost: string;
oRequest: TFHIRRequest;
oResponse: TFHIRResponse;
sCookie: string;
sContentType: String;
oStream: TStream;
sDoc: String;
s: String;
aFormat: TFHIRFormat;
lang: String;
sPath: String;
redirect: boolean;
form: TMimeMessage;
relativeReferenceAdjustment: integer;
style : TFHIROutputStyle;
c: integer;
domain: String;
sBearer: String;
noErrCode, upload: boolean;
Context: TOperationContext;
Session: TFHIRSession;
Begin
noErrCode := false;
upload := false;
Session := nil;
try
if ssl then
sHost := 'https://' + request.host
else
sHost := 'http://' + request.host;
domain := request.host;
if domain.Contains(':') then
domain := domain.Substring(0, domain.IndexOf(':'));
lang := request.AcceptLanguage;
s := request.contentType;
if pos(';', s) > 0 then
s := copy(s, 1, pos(';', s) - 1); // only read up to the first ';'
if SameText(s, 'application/x-www-form-urlencoded') or (request.UnparsedParams <> '') then
sDoc := request.Document + '?' + request.UnparsedParams
else
sDoc := request.Document;
try
sContentType := request.contentType;
if s.StartsWith('multipart/form-data', true) then
begin
form := FWebServer.loadMultipartForm(request.PostStream, request.contentType, upload);
end
else
form := nil;
try
if s.StartsWith('multipart/form-data', true) then
begin
oStream := FWebServer.extractFileData(Lang, form, 'file', sContentType);
// though this might not return the data if we have an operation request
end
else if request.PostStream <> nil then
begin
oStream := TMemoryStream.Create;
oStream.CopyFrom(request.PostStream, request.PostStream.Size);
oStream.Position := 0;
end
else
oStream := TStringStream.Create(request.UnparsedParams);
try
oResponse := TFHIRResponse.Create(FContext.ValidatorContext.link);
try
oResponse.OnCreateBuilder := doGetBundleBuilder;
response.CustomHeaders.Add('Access-Control-Allow-Origin: *');
// response.CustomHeaders.add('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
response.CustomHeaders.Add('Access-Control-Expose-Headers: Content-Location, Location');
response.CustomHeaders.Add('Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE');
// response.CustomHeaders.add('Access-Control-Expose-Headers: *');
if request.RawHeaders.Values['Access-Control-Request-Headers'] <> '' then
response.CustomHeaders.Add('Access-Control-Allow-Headers: ' + request.RawHeaders.Values['Access-Control-Request-Headers']);
if request.RawHeaders.Values[REVERSE_HOST_HEADER] <> '' then
sHost := request.RawHeaders.Values[REVERSE_HOST_HEADER];
if request.RawHeaders.Values['X-Request-Id'] <> '' then
response.CustomHeaders.Add('X-Request-Id: ' + request.RawHeaders.Values['X-Request-Id']);
oRequest := nil;
Try
if request.AuthUsername = INTERNAL_SECRET then
sCookie := request.AuthPassword
else
begin
c := request.Cookies.GetCookieIndex(FHIR_COOKIE_NAME);
if c > -1 then
sCookie := request.Cookies[c].CookieText.Substring(FHIR_COOKIE_NAME.Length + 1);
end;
sBearer := sCookie;
oRequest := BuildRequest(lang, path, sHost, request.CustomHeaders.Values['Origin'], request.RemoteIP,
request.CustomHeaders.Values['content-location'], request.Command, sDoc, sContentType, request.Accept, request.ContentEncoding, sCookie,
request.RawHeaders.Values['X-Provenance'], sBearer, oStream, oResponse, aFormat, redirect, form, secure, ssl, relativeReferenceAdjustment, style,
esession, cert);
try
oRequest.externalRequestId := request.RawHeaders.Values['X-Request-Id'];
oRequest.internalRequestId := logId;
if TFHIRWebServerClientInfo(AContext.Data).Session = nil then
TFHIRWebServerClientInfo(AContext.Data).Session := oRequest.Session.link;
oRequest.IfMatch := processIfMatch(request.RawHeaders.Values['If-Match']);
oRequest.IfNoneMatch := processIfMatch(request.RawHeaders.Values['If-None-Match']);
oRequest.IfNoneExist := request.RawHeaders.Values['If-None-Exist'];
oRequest.IfModifiedSince := processIfModifiedSince(request.RawHeaders.Values['If-Modified-Since']);
oRequest.strictSearch := request.RawHeaders.Values['Prefer'] = 'handling=strict';
noErrCode := StringArrayExistsInsensitive(['yes', 'true', '1'], oRequest.Parameters.GetVar('nohttperr')) or
StringArrayExistsInsensitive(['yes', 'true', '1'], oRequest.Parameters.GetVar('_nohttperr'));
ReadTags(request.RawHeaders.Values['Category'], oRequest);
Session := oRequest.Session.link;
// allow scripting to change anything about the request
GJsHost.previewRequest(Session, oRequest);
if redirect then
begin
if oRequest.Session <> nil then
begin
FAuthServer.setCookie(response, FHIR_COOKIE_NAME, oRequest.Session.Cookie, domain, '', oRequest.Session.Expires, false);
cacheResponse(response, cacheNotAtAll);
response.redirect(oRequest.Session.OriginalUrl);
end
else
response.redirect(oRequest.baseUrl);
end
else if oRequest.CommandType = fcmdNull then
begin
response.CustomHeaders.Add('Access-Control-Request-Method: GET, POST, PUT, PATCH, DELETE');
cacheResponse(response, cacheNormal);
end
else if oRequest.CommandType = fcmdUnknown then
begin
cacheResponse(response, oResponse.CacheControl);
if oResponse.format = ffXhtml then
begin
response.ResponseNo := 200;
response.contentType := 'text/html; charset=UTF-8';
response.FreeContentStream := true;
response.ContentStream := StringToUTF8Stream(BuildFhirHomePage(oRequest.SessionCompartments, logId, lang, sHost, path, oRequest.Session, secure));
end
else
begin
response.ResponseNo := 404;
response.ContentText := 'Document ' + request.Document + ' not found';
end;
end
else if (oRequest.CommandType = fcmdUpload) and (oRequest.resource = nil) Then
begin
cacheResponse(response, oResponse.CacheControl);
response.ResponseNo := 200;
response.contentType := 'text/html; charset=UTF-8';
response.FreeContentStream := true;
response.ContentStream := StringToUTF8Stream(BuildFhirUploadPage(lang, sHost, '', oRequest.ResourceName, oRequest.Session));
end
else if (oRequest.CommandType = fcmdConformanceStmt) and (oRequest.ResourceName <> '') then
begin
cacheResponse(response, oResponse.CacheControl);
response.ResponseNo := 200;
response.contentType := 'text/html; charset=UTF-8';
// no - just use * response.CustomHeaders.add('Access-Control-Allow-Origin: '+request.RawHeaders.Values['Origin']);
response.CustomHeaders.Add('Access-Control-Request-Method: GET, POST, PUT, PATCH, DELETE');
response.FreeContentStream := true;
response.ContentStream := StringToUTF8Stream('OK');
end
else
begin
try
Context := TOperationContext.Create;
try
Context.upload := upload;
checkRequestByJs(context, oRequest);
if (oRequest.CommandType = fcmdOperation) then
FWebServer.FGoogle.recordEvent(request.Document, '$'+oRequest.OperationName, oRequest.Session.UserName, request.RemoteIP, request.UserAgent)
else
FWebServer.FGoogle.recordEvent(request.Document, CODES_TFHIRCommandType[oRequest.CommandType], oRequest.Session.UserName, request.RemoteIP, request.UserAgent);
if oRequest.CommandType = fcmdWebUI then
HandleWebUIRequest(oRequest, oResponse, secure)
else if oRequest.commandType in [fcmdTask, fcmdDeleteTask] then
ProcessTaskRequest(Context, oRequest, oResponse)
else if (request.RawHeaders.Values['Prefer'] = 'respond-async') or (oRequest.Parameters.GetVar('_async') = 'true') then
ProcessAsyncRequest(Context, oRequest, oResponse)
else
ProcessRequest(Context, oRequest, oResponse);
finally
Context.Free;
end;
except
on e: EAbort do
begin
if oResponse.HTTPCode < 300 then
begin
recordStack(e);
raise;
end;
end;
on e: exception do
begin
recordStack(e);
raise;
end;
end;
cacheResponse(response, oResponse.CacheControl);
FWebServer.RecordExchange(oRequest, oResponse);
ProcessOutput(oRequest, oResponse, request, response, relativeReferenceAdjustment, style, request.AcceptEncoding.Contains('gzip'));
// no - just use * if request.RawHeaders.Values['Origin'] <> '' then
// response.CustomHeaders.add('Access-Control-Allow-Origin: '+request.RawHeaders.Values['Origin']);
if oResponse.versionId <> '' then
response.ETag := 'W/"' + oResponse.versionId + '"';
response.LastModified := oResponse.lastModifiedDate;
// todo: timezone
response.CustomHeaders.Add('X-GDPR-Disclosure: All access to this server is logged as AuditEvent Resources, and these store your ip address '+
'(and logged in user, if one exists). Also, your IP address is logged with Google Analytics for building geomaps of server usage. Your continued '+
'use of the API constitutes agreement to these terms. See [link] for erasure requests');
if oResponse.tags.Count > 0 then
response.CustomHeaders.Add('Category: ' + oResponse.tags.AsHeader);
if oResponse.links.Count > 0 then
response.CustomHeaders.Add('Link: ' + asLinkHeader(oResponse.links));
if oResponse.originalId <> '' then
response.CustomHeaders.Add('X-Original-Location: ' + oResponse.originalId);
if oResponse.Progress <> '' then
response.CustomHeaders.Add('X-Progress: ' + oResponse.Progress);
if oResponse.ContentLocation <> '' then
response.CustomHeaders.Add('Content-Location: ' + oResponse.ContentLocation);
if oResponse.Location <> '' then
response.Location := oResponse.Location;
end;
if noErrCode then
response.ResponseNo := 200;
FWebServer.RecordExchange(oRequest, oResponse);
except
on e: exception do
begin
FWebServer.RecordExchange(oRequest, oResponse, e);
raise;
end;
end;
finally
oRequest.Free;
end;
Finally
oResponse.Free;
End;
finally
oStream.Free;
end;
finally
form.Free;
end;
except
on e: ERestfulAuthenticationNeeded do
begin
if aFormat = ffXhtml then
begin
response.ResponseNo := 200;
response.contentType := 'text/html; charset=UTF-8';
response.FreeContentStream := true;
response.ContentStream := StringToUTF8Stream(BuildFhirAuthenticationPage(lang, sHost, sPath + sDoc, logId, e.Msg, ssl));
end
else
SendError(response, logId, e.status, aFormat, lang, e.message, sPath, e, Session, true, sPath + sDoc, relativeReferenceAdjustment, itLogin);
end;
on e: ETerminologyError do
begin
if noErrCode then
SendError(response, logId, 200, aFormat, lang, e.message, sPath, e, Session, false, path, relativeReferenceAdjustment, itNotSupported)
else
SendError(response, logId, HTTP_ERR_BUSINESS_RULES_FAILED, aFormat, lang, e.message, sPath, e, Session, false, path, relativeReferenceAdjustment,
itNotSupported);
end;
on e: ETerminologySetup do
begin
if noErrCode then
SendError(response, logId, 200, aFormat, lang, e.message, sPath, e, Session, false, path, relativeReferenceAdjustment, itNotSupported)
else
SendError(response, logId, HTTP_ERR_BUSINESS_RULES_FAILED, aFormat, lang, e.message, sPath, e, Session, false, path, relativeReferenceAdjustment,
itNotSupported);
end;
on e: ETooCostly do
begin
if noErrCode then
SendError(response, logId, 200, aFormat, lang, e.message, sPath, e, Session, false, path, relativeReferenceAdjustment, itTooCostly)
else
SendError(response, logId, HTTP_ERR_BUSINESS_RULES_FAILED, aFormat, lang, e.message, sPath, e, Session, false, path, relativeReferenceAdjustment,
itTooCostly);
end;
on e: ERestfulException do
begin
if noErrCode then
SendError(response, logId, 200, aFormat, lang, e.message, sPath, e, Session, false, path, relativeReferenceAdjustment, e.code)
else
SendError(response, logId, e.status, aFormat, lang, e.message, sPath, e, Session, false, path, relativeReferenceAdjustment, e.code);
end;
on e: exception do
begin
if noErrCode then
SendError(response, logId, 200, aFormat, lang, e.message, sPath, e, Session, false, path, relativeReferenceAdjustment, itNull)
else
SendError(response, logId, HTTP_ERR_INTERNAL, aFormat, lang, e.message, sPath, e, Session, false, path, relativeReferenceAdjustment, itNull);
end;
end;
finally
Session.Free;
end;
end;
procedure TFhirWebServerEndPoint.startHooks(ctxt: TFHIRWebServerPatientViewContext; patient: TFHIRPatientW; url: String);
var
server: TRegisteredFHIRServer;
req: TCDSHookRequest;
s, u, i : String;
be: TFHIRBundleEntryW;
begin
for s in FWebServer.FPatientViewServers.Keys do
begin
server := TRegisteredFHIRServer.Create;
try
server.name := s;
StringSplit(FWebServer.FPatientViewServers[s], '|', u, i);
server.fhirEndpoint := u;
server.addCdsHook(i, TCDSHooks.patientView);
ctxt.manager.registerServer(server);
finally
server.Free;
end;
end;
req := TCDSHookRequest.Create;
try
req.hook := TCDSHooks.patientView;
req.hookInstance := ctxt.FContext.FormalURLPlain; // arbitrary global
req.patient := patient.id;
be := factory.wrapBundleEntry(factory.makeByName('Bundle.entry'));
req.preFetch.Add('patient', be);
be.resource := patient.Resource.link;
ctxt.manager.makeRequest(req, OnCDSResponse, ctxt);
finally
req.Free;
end;
end;
{$IFDEF MSWINDOWS}
function TFhirWebServerEndPoint.HandleWebCreate(request: TFHIRRequest; response: TFHIRResponse): TDateTime;
//var
// profile: TFhirStructureDefinition;
// builder: TQuestionnaireBuilder;
// questionnaire: TFHIRQuestionnaire;
// s, id, fid: String;
begin
// // get the right questionnaire
// if request.Parameters.GetVar('profile').StartsWith('Profile/') then
// begin
// id := request.Parameters.GetVar('profile').Substring(8);
// profile := GetResource(request.Session, 'StructureDefinition', request.lang, id, '', '') as TFhirStructureDefinition;
// end
// else
// profile := FindResource(request.Session, 'StructureDefinition', request.lang, 'url=' + request.Parameters.GetVar('profile')) as TFhirStructureDefinition;
// try
// id := profile.id;
// fid := request.baseUrl + 'StructureDefinition/' + id + '/$questionnaire';
// s := FContext.QuestionnaireCache.getForm(frtStructureDefinition, id);
// if s = '' then
// begin
// builder := TQuestionnaireBuilder.Create(request.lang);
// try
// questionnaire := FContext.QuestionnaireCache.getQuestionnaire(frtStructureDefinition, id);
// try
// if questionnaire = nil then
// begin
// builder.profile := profile.link;
// builder.OnExpand := FContext.Storage.ExpandVS;
// builder.onLookupCode := FContext.Storage.LookupCode;
// builder.QuestionnaireId := fid;
// builder.onLookupReference := LookupReference;
// builder.Context := request.link;
//
// builder.build;
// questionnaire := builder.questionnaire.link;
// FContext.QuestionnaireCache.putQuestionnaire(frtStructureDefinition, id, questionnaire, builder.Dependencies);
// end;
// // convert to xhtml
// s := transform1(questionnaire, request.lang, 'QuestionnaireToHTML.xslt', true);
// FContext.QuestionnaireCache.putForm(frtStructureDefinition, id, s, builder.Dependencies);
// finally
// questionnaire.Free;
// end;
// // insert page headers:
// s := s.Replace('<!--header insertion point-->', TFHIRXhtmlComposer.PageLinks);
// s := s.Replace('<!--body top insertion point-->', TFHIRXhtmlComposer.header(request.Session, request.baseUrl, request.lang, SERVER_VERSION) +
// '<p><a href="' + builder.QuestionnaireId + '">Questionnaire for this form</a>.' + ' The QuestionnaireAnswers should be submitted as a POST to <i>' +
// request.baseUrl + '$qa-post</i> with a questionnaire reference of <a href="' + builder.QuestionnaireId + '">' + builder.QuestionnaireId +
// '</a></p>'#13#10);
// s := s.Replace('<!--body bottom insertion point-->', TFHIRXhtmlComposer.Footer(request.baseUrl, request.lang, request.internalRequestId, false));
// s := s.Replace('var questionnaireAnswersEndpoint = null;', 'var questionnaireAnswersEndpoint = "' + request.baseUrl + '$qa-post";');
// finally
// builder.Free;
// end;
// end;
//
// response.Body := s;
// result := Now; // don't want anyone caching anything
// response.contentType := 'text/html; charset=UTF-8';
// finally
// profile.Free;
// end;
raise EFslException.Create('not done yet');
end;
{$ENDIF}
function TFhirWebServerEndPoint.HandleWebEdit(request: TFHIRRequest; response: TFHIRResponse): TDateTime;
//var
// typ, id, ver: String;
// r: TFhirResource;
// s: String;
// comp: TFHIRComposer;
begin
raise EFslException.Create('not done yet');
// result := 0;
//
// // get the right questionnaire
// StringSplit(request.id, '/', typ, s);
// StringSplit(s, '/', id, ver);
// if not(StringArrayExistsSensitive(CODES_TFhirResourceType, typ) or FContext.ValidatorContext.hasCustomResource(typ)) then
// raise EFHIRException.CreateLang('MSG_UNKNOWN_TYPE', request.Lang, [typ]);
//
// r := GetResource(request.Session, typ, request.lang, id, '', '');
// try
// if r is TFhirOperationOutcome then
// begin
// response.resource := r.link;
// response.HTTPCode := 500;
// response.message := 'Internal Error';
// end
// else
// begin
//
// if request.Parameters.GetVar('srcformat') = 'json' then
// comp := TFHIRJsonComposer.Create(FContext.ValidatorContext.link, OutputStylePretty, request.lang)
// else
// comp := TFHIRXMLComposer.Create(FContext.ValidatorContext.link, OutputStylePretty, request.lang);
// try
// comp.LogId := request.internalRequestId;
// s := comp.Compose(r);
// finally
// comp.Free;
// end;
//
// s := '<?xml version="1.0" encoding="UTF-8"?>' + #13#10 + '<!DOCTYPE HTML "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' + #13#10 + '' +
// #13#10 + '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">' + #13#10 + '<head>' + #13#10 +
// ' <meta charset="utf-8" http-equiv="X-UA-Compatible" content="IE=edge" />' + #13#10 + ' <title>Direct Edit for /' + typ + '/' + id + '</title>' +
// #13#10 + TFHIRXhtmlComposer.PageLinks + FHIR_JS + '</head>' + #13#10 + '' + #13#10 + '<body>' + #13#10 + '' + #13#10 +
// TFHIRXhtmlComposer.header(request.Session, request.baseUrl, request.lang, SERVER_VERSION) + '<h2>Direct Edit for ' + request.id + '</h2>' + #13#10 +
// '<form action="' + request.baseUrl + '_web/' + typ + '/' + id + '/$post" method="POST">'#13#10 + ' <input type="hidden" name="srcformat" value="' +
// request.Parameters.GetVar('srcformat') + '"/>'#13#10 + ' <textarea cols="80" rows="24" name="source" style="white-space:pre">' +
// FormatXMLForTextArea(s) + #13#10'</textarea><br/>'#13#10 + ' <input type="submit" value="Save"/>'#13#10 + '</form>'#13#10 +
// TFHIRXhtmlComposer.Footer(request.baseUrl, request.lang, request.internalRequestId, true);
//
// response.Body := s;
// result := Now; // don't want anyone caching anything
// response.contentType := 'text/html; charset=UTF-8';
// end;
// finally
// r.Free;
// end;
end;
function TFhirWebServerEndPoint.HandleWebPost(request: TFHIRRequest; response: TFHIRResponse): TDateTime;
var
s, typ, id, ver: String;
p: TParseMap;
prsr: TFHIRParser;
Context: TOperationContext;
begin
StringSplit(request.id, '/', typ, s);
StringSplit(s, '/', id, ver);
request.id := id;
if not StringArrayExistsSensitive(factory.ResourceNames, typ) {or FContext.ValidatorContext.hasCustomResource(typ))} then
raise EFHIRException.CreateLang('MSG_UNKNOWN_TYPE', request.lang, [typ]);
request.ResourceName := typ;
request.CommandType := fcmdUpdate;
Context := TOperationContext.Create;
try
p := TParseMap.Create(TEncoding.UTF8.GetString(request.Source.AsBytes), true);
try
if p.GetVar('srcformat') = 'json' then
prsr := FContext.Factory.makeParser(FContext.ValidatorContext.Link, ffJson, request.lang)
else
prsr := FContext.Factory.makeParser(FContext.ValidatorContext.Link, ffXml, request.lang);
try
s := p.GetVar('source');
prsr.Source := TStringStream.Create(s, TEncoding.UTF8);
try
prsr.Parse;
request.resource := prsr.resource.link;
checkRequestByJs(context, request);
ProcessRequest(Context, request, response);
if response.HTTPCode < 300 then
begin
response.HTTPCode := 303;
response.Location := request.baseUrl + typ + '/' + id;
end;
finally
prsr.Source.Free;
end;
finally
prsr.Free;
end;
finally
p.Free;
end;
result := 0;
finally
Context.Free;
end;
end;
{$IFDEF MSWINDOWS}
function TFhirWebServerEndPoint.HandleWebProfile(request: TFHIRRequest; response: TFHIRResponse): TDateTime;
//var
// id, ver, fullid: String;
// profile: TFhirStructureDefinition;
// builder: TQuestionnaireBuilder;
// questionnaire: TFHIRQuestionnaire;
// s: String;
begin
raise EFslException.Create('not done yet');
// // get the right questionnaire
// StringSplit(request.id.Substring(8), '/', id, ver);
// profile := GetResource(request.Session, 'StructureDefinition', request.lang, id, ver, '') as TFhirStructureDefinition;
// try
// fullid := request.baseUrl + 'StructureDefinition/' + id + '/$questionnaire';
// s := FContext.QuestionnaireCache.getForm(frtStructureDefinition, id);
// if s = '' then
// begin
// builder := TQuestionnaireBuilder.Create(request.lang);
// try
// questionnaire := FContext.QuestionnaireCache.getQuestionnaire(frtStructureDefinition, id);
// try
// if questionnaire = nil then
// begin
// builder.profile := profile.link;
// builder.OnExpand := FContext.Storage.ExpandVS;
// builder.onLookupCode := FContext.Storage.LookupCode;
// builder.onLookupReference := LookupReference;
// builder.Context := request.link;
// builder.QuestionnaireId := fullid;
// builder.build;
// questionnaire := builder.questionnaire.link;
// FContext.QuestionnaireCache.putQuestionnaire(frtStructureDefinition, id, questionnaire, builder.Dependencies);
// end;
// // convert to xhtml
// s := transform1(questionnaire, request.lang, 'QuestionnaireToHTML.xslt', true);
// FContext.QuestionnaireCache.putForm(frtStructureDefinition, id, s, builder.Dependencies);
// finally
// questionnaire.Free;
// end;
// finally
// builder.Free;
// end;
// end;
// // insert page headers:
// s := s.Replace('<!--header insertion point-->', TFHIRXhtmlComposer.PageLinks);
// s := s.Replace('<!--body top insertion point-->', TFHIRXhtmlComposer.header(request.Session, request.baseUrl, request.lang, SERVER_VERSION));
// s := s.Replace('<!--body bottom insertion point-->', TFHIRXhtmlComposer.Footer(request.baseUrl, request.lang, request.internalRequestId, false));
// s := s.Replace('var questionnaireAnswersEndpoint = null;', 'var questionnaireAnswersEndpoint = "' + request.baseUrl + '$qa-post";');
// response.Body := s;
// result := Now; // don't want anyone caching anything
// response.contentType := 'text/html; charset=UTF-8';
// finally
// profile.Free;
// end;
end;
{$ENDIF}
function TFhirWebServerEndPoint.HandleWebPatient(request: TFHIRRequest; response: TFHIRResponse; secure: boolean): TDateTime;
var
id, ver: String;
s, xhtml: String;
patient: TFHIRPatientW;
hookid: String;
hooks: TFHIRWebServerPatientViewContext;
begin
result := 0;
StringSplit(request.id.Substring(8), '/', id, ver);
hookid := NewGuidId;
hooks := TFHIRWebServerPatientViewContext.Create(FContext.Link);
hooks.manager := TCDSHooksManager.Create;
FWebServer.FLock.Lock;
try
FPatientHooks.Add(hookid, hooks);
finally
FWebServer.FLock.Unlock;
end;
patient := factory.wrapPatient(GetResource(request.Session, 'Patient', request.lang, id, ver, ''));
try
xhtml := factory.getXhtml(patient.Resource).AsPlainText;
startHooks(hooks, patient, request.baseUrl);
finally
patient.Free;
end;
s := FWebServer.FSourceProvider.getSource('patient.html');
s := s.Replace('[%id%]', FWebServer.FName, [rfReplaceAll]);
s := s.Replace('[%hookid%]', hookid, [rfReplaceAll]);
s := s.Replace('[%ver%]', factory.versionString, [rfReplaceAll]);
s := s.Replace('[%web%]', FWebServer.WebDesc, [rfReplaceAll]);
s := s.Replace('[%patient-details%]', xhtml, [rfReplaceAll]);
if FWebServer.FActualSSLPort = 443 then
s := s.Replace('[%patient-app-list%]', patientAppList(FWebServer.FHost + FPath, id), [rfReplaceAll])
else
s := s.Replace('[%patient-app-list%]', patientAppList(FWebServer.FHost + ':' + inttostr(FWebServer.FActualSSLPort) + FPath, id), [rfReplaceAll]);
s := s.Replace('[%patient-id%]', id, [rfReplaceAll]);
s := s.Replace('[%admin%]', FWebServer.FAdminEmail, [rfReplaceAll]);
if FWebServer.FActualPort = 80 then
s := s.Replace('[%host%]', FWebServer.FHost, [rfReplaceAll])
else
s := s.Replace('[%host%]', FWebServer.FHost + ':' + inttostr(FWebServer.FActualPort), [rfReplaceAll]);
if FWebServer.FActualSSLPort = 443 then
s := s.Replace('[%securehost%]', FWebServer.FHost, [rfReplaceAll])
else
s := s.Replace('[%securehost%]', FWebServer.FHost + ':' + inttostr(FWebServer.FActualSSLPort), [rfReplaceAll]);
if FWebServer.FActualPort = 80 then
s := s.Replace('[%baseOpen%]', FWebServer.FHost + FPath, [rfReplaceAll])
else
s := s.Replace('[%baseOpen%]', FWebServer.FHost + ':' + inttostr(FWebServer.FActualPort) + FPath, [rfReplaceAll]);
if FWebServer.FActualSSLPort = 443 then
s := s.Replace('[%baseSecure%]', FWebServer.FHost + FPath, [rfReplaceAll])
else
s := s.Replace('[%baseSecure%]', FWebServer.FHost + ':' + inttostr(FWebServer.FActualSSLPort) + FPath, [rfReplaceAll]);
s := s.Replace('[%root%]', FPath, [rfReplaceAll]);
s := s.Replace('[%endpoints%]', EndPointDesc(secure), [rfReplaceAll]);
response.Body := s;
response.contentType := 'text/html; charset=UTF-8';
end;
function TFhirWebServerEndPoint.HandleWebPatientHooks(request: TFHIRRequest; response: TFHIRResponse; secure: boolean): TDateTime;
var
id: String;
// s, xhtml : String;
// patient : TFHIRPatient;
// hookid : String;
hooks: TFHIRWebServerPatientViewContext;
begin
result := 0;
id := request.id.Substring(13);
FWebServer.FLock.Lock;
try
if FPatientHooks.TryGetValue(id, hooks) then
hooks.link
else
hooks := nil;
finally
FWebServer.FLock.Unlock;
end;
if hooks <> nil then
begin
try
while hooks.manager.waiting do
sleep(1000);
FWebServer.FLock.Lock;
try
response.Body := presentAsHtml(hooks.cards, nil, hooks.Errors);
FPatientHooks.Remove(id);
finally
FWebServer.FLock.Unlock;
end;
response.HTTPCode := 200;
response.contentType := 'text/html; charset=UTF-8';
finally
hooks.Free;
end;
end;
end;
function TFhirWebServerEndPoint.HandleWebQuestionnaire(request: TFHIRRequest; response: TFHIRResponse): TDateTime;
var
id, ver: String;
questionnaire: TFHIRResourceV;
s: String;
begin
// get the right questionnaire
StringSplit(request.id.Substring(14), '/', id, ver);
questionnaire := GetResource(request.Session, 'Questionnaire', request.lang, id, ver, '');
try
// convert to xhtml
s := transform1(questionnaire, request.lang, 'QuestionnaireToHTML.xslt', false);
// insert page headers:
s := s.Replace('<!--header insertion point-->', TFHIRXhtmlComposer.PageLinks);
s := s.Replace('<!--body top insertion point-->', TFHIRXhtmlComposer.header(factory, request.Session, request.baseUrl, request.lang, SERVER_VERSION));
s := s.Replace('<!--body bottom insertion point-->', TFHIRXhtmlComposer.Footer(factory, request.baseUrl, request.lang, request.internalRequestId, false));
s := s.Replace('var questionnaireAnswersEndpoint = null;', 'var questionnaireAnswersEndpoint = "' + request.baseUrl + '/QuestionnaireAnswers";');
response.Body := s;
result := Now; // don't want anyone caching anything
response.contentType := 'text/html; charset=UTF-8';
finally
questionnaire.Free;
end;
end;
function TFhirWebServerEndPoint.HandleWebQuestionnaireInstance(request: TFHIRRequest; response: TFHIRResponse): TDateTime;
//var
// typ, id, ver: String;
// r: TFhirResourceV;
// qa: TFhirQuestionnaireResponse;
// q: TFHIRQuestionnaire;
// s, j: String;
// json: TFHIRJsonComposer;
begin
raise EFslException.Create('Not done yet');
// result := 0;
//
// // get the right questionnaire
// StringSplit(request.id, '/', typ, s);
// StringSplit(s, '/', id, ver);
// if not(StringArrayExistsSensitive(CODES_TFhirResourceType, typ) or FContext.ValidatorContext.hasCustomResource(typ)) then
// raise EFHIRException.CreateLang('MSG_UNKNOWN_TYPE', request.lang, [typ]);
//
// r := GetResource(request.Session, typ, request.lang, id, ver, 'qa-edit');
// try
// if r is TFhirOperationOutcome then
// begin
// response.resource := r.link;
// response.HTTPCode := 500;
// response.message := 'Internal Error';
// end
// else
// begin
// qa := r as TFhirQuestionnaireResponse;
// q := (FindContainedResource(qa, qa.questionnaire) as TFHIRQuestionnaire).link;
// if q = nil then
// raise EFHIRException.CreateLang('CANNOT_FIND', request.lang, ['Questionnaire', qa.questionnaireElement.reference.Substring(1)]);
//
// // convert to xhtml
// s := transform1(q, request.lang, 'QuestionnaireToHTML.xslt', true);
//
// // make clean qa
// qa.questionnaireElement.reference := 'Questionnaire/' + qa.questionnaireElement.reference.Substring(1);
// qa.containedList.Clear;
// json := TFHIRJsonComposer.Create(request.Context.link, OutputStyleNormal, request.lang);
// try
// j := json.Compose(qa);
// finally
// json.Free;
// end;
//
// // insert page headers:
// s := s.Replace('<!--header insertion point-->', TFHIRXhtmlComposer.PageLinks);
// s := s.Replace('<!--body top insertion point-->', TFHIRXhtmlComposer.header(request.Session, request.baseUrl, request.lang, SERVER_VERSION));
// s := s.Replace('<!--body bottom insertion point-->', TFHIRXhtmlComposer.Footer(request.baseUrl, request.lang, request.internalRequestId, false));
// // insert the answer:
// s := s.Replace('var QuestionnaireResponse=null;', 'var QuestionnaireResponse=' + j + ';');
// response.Body := s;
// result := Now; // don't want anyone caching anything
// response.contentType := 'text/html; charset=UTF-8';
// end;
// finally
// r.Free;
// end;
end;
procedure TFhirWebServerEndPoint.HandleWebSockets(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; ssl, secure: boolean; path: String);
var
ws: TIdWebSocket;
begin
ws := TIdWebSocket.Create(nil);
try
if ws.open(AContext, request, response) then
FContext.SubscriptionManager.HandleWebSocket(ws);
finally
ws.Free;
end;
end;
function TFhirWebServerEndPoint.HandleWebUIRequest(request: TFHIRRequest; response: TFHIRResponse; secure: boolean): TDateTime;
begin
if request.id.EndsWith('$edit') then
result := HandleWebEdit(request, response)
else if request.id.EndsWith('$post') then
result := HandleWebPost(request, response)
{$IFDEF MSWINDOWS}
else if request.id.EndsWith('$qa-edit') then
result := HandleWebQuestionnaireInstance(request, response)
else if request.id.StartsWith('Questionnaire/') then
result := HandleWebQuestionnaire(request, response)
else if request.id.StartsWith('StructureDefinition/') then
result := HandleWebProfile(request, response)
{$ENDIF}
else if request.id.StartsWith('PatientHooks/') then
result := HandleWebPatientHooks(request, response, secure)
else if request.id = 'Create' then
result := HandleWebCreate(request, response)
else if request.id.StartsWith('Patient/') then
result := HandleWebPatient(request, response, secure)
else
raise EFHIRException.CreateLang('MSG_UNKNOWN_CONTENT', request.lang, [request.id, 'web UI']);
end;
procedure TFhirWebServerEndpoint.SendError(response: TIdHTTPResponseInfo; logid : string; status: word; format: TFHIRFormat; lang, message, url: String; e: exception; Session: TFHIRSession; addLogins: boolean; path: String; relativeReferenceAdjustment: integer; code: TFhirIssueType);
var
issue: TFhirOperationOutcomeW;
oComp: TFHIRComposer;
iss : TFhirOperationOutcomeIssueW;
begin
response.ResponseNo := status;
response.FreeContentStream := true;
if format = ffUnspecified then
begin
response.contentType := 'text/plain';
response.ContentStream := StringToUTF8Stream(message);
end
else
begin
issue := factory.wrapOperationOutcome(factory.makeResource('OperationOutcome'));
try
factory.setXhtml(issue.Resource, TFHIRXhtmlParser.Parse(lang, xppReject, [], '<div><p>' + FormatTextToXML(message, xmlText) + '</p></div>'));
iss := factory.makeIssue(isError, code, '', message);
try
iss.diagnostics := ExceptionStack(e);
issue.addIssue(iss, false);
finally
iss.Free;
end;
response.ContentStream := TMemoryStream.Create;
oComp := nil;
case format of
ffXml:
oComp := factory.makeComposer(FContext.ValidatorContext.link, ffXml, lang, OutputStyleNormal);
ffXhtml:
begin
oComp := TFHIRXhtmlComposer.Create(FContext.ValidatorContext.link, OutputStyleNormal, lang, AppendForwardSlash(url));
TFHIRXhtmlComposer(oComp).Version := SERVER_VERSION;
TFHIRXhtmlComposer(oComp).Session := Session.link;
TFHIRXhtmlComposer(oComp).relativeReferenceAdjustment := relativeReferenceAdjustment;
end;
ffJson, ffNDJson:
oComp := factory.makeComposer(FContext.ValidatorContext.link, ffJson, lang, OutputStyleNormal);
ffText:
oComp := TFHIRTextComposer.Create(FContext.ValidatorContext.link, OutputStyleNormal, lang);
end;
try
response.contentType := oComp.MimeType;
oComp.LogId := logId;
oComp.Compose(response.ContentStream, issue.Resource);
response.ContentStream.Position := 0;
finally
oComp.Free;
end;
finally
issue.Free;
end;
end;
end;
function extractProp(contentType, name: String): string;
begin
if contentType.Contains(name + '=') then
begin
result := contentType.Substring(contentType.IndexOf(name + '=') + name.Length + 1);
if result.Contains(';') then
result := result.Substring(0, result.IndexOf(';'));
end
else
result := '';
end;
Function TFhirWebServerEndpoint.BuildRequest(lang, sBaseURL, sHost, sOrigin, sClient, sContentLocation, sCommand, sResource, sContentType, sContentAccept,
sContentEncoding, sCookie, provenance, sBearer: String; oPostStream: TStream; oResponse: TFHIRResponse; var aFormat: TFHIRFormat; var redirect: boolean;
form: TMimeMessage; bAuth, secure: boolean; out relativeReferenceAdjustment: integer; var style : TFHIROutputStyle; Session: TFHIRSession; cert: TIdX509)
: TFHIRRequest;
Var
sURL, Msg: String;
oRequest: TFHIRRequest;
parser: TFHIRParser;
check: boolean;
comp: TIdCompressorZLib;
mem: TMemoryStream;
cursor: integer;
bundle: TFHIRBundleW;
b : TBytes;
Begin
relativeReferenceAdjustment := 0;
result := nil;
oRequest := TFHIRRequest.Create(FContext.ValidatorContext.link, roRest, FContext.Indexes.Compartments.link);
try
oRequest.lang := lang;
oResponse.origin := sOrigin;
oRequest.PostFormat := ffUnspecified;
oResponse.format := ffUnspecified;
oRequest.secure := secure;
aFormat := ffUnspecified;
oRequest.baseUrl := sHost + AppendForwardSlash(sBaseURL);
oRequest.url := sHost + sResource;
oRequest.lastModifiedDate := 0; // Xml
// oRequest.contentLocation := sContentLocation; // for version aware updates
oRequest.form := form.link;
oRequest.provenance := processProvenanceHeader(provenance, lang);
If Not StringStartsWithSensitive(sResource, sBaseURL) Then
begin
if StringStartsWith(sResource, '/images/', false) then
Raise ERestfulException.Create('TFhirWebServer.HTTPRequest', HTTP_ERR_NOTFOUND, itNotFound, 'images not served', lang)
else
Raise ERestfulException.Create('TFhirWebServer.HTTPRequest', HTTP_ERR_NOTFOUND, itNotFound, 'MSG_NO_MODULE', lang, [sResource]);
end;
sURL := copy(sResource, Length(sBaseURL) + 1, $FFF);
sURL := oRequest.preanalyse(sURL);
if (sCommand <> 'GET') then
begin
oRequest.Version := readVersion(sContentType);
oRequest.PostFormat := mimeTypeToFormat(sContentType, oRequest.PostFormat);
if (sContentType <> 'application/x-www-form-urlencoded') and oRequest.Parameters.VarExists('_format') and (form = nil) and (oRequest.Parameters.GetVar('_format') <> '') then
sContentType := oRequest.Parameters.GetVar('_format');
end;
oResponse.Version := readVersion(sContentAccept);
if oRequest.Parameters.VarExists('_format') and (oRequest.Parameters.GetVar('_format') <> '') then
sContentAccept := oRequest.Parameters.GetVar('_format');
oResponse.format := mimeTypeListToFormat(sContentAccept, oResponse.Format);
if oRequest.Parameters.VarExists('_pretty') and (oRequest.Parameters.GetVar('_pretty') = 'true') then
style := OutputStylePretty
else if sContentAccept.Contains('pretty=') and (extractProp(sContentAccept, 'pretty') = 'true') then
style := OutputStylePretty
else
style := OutputStyleNormal;
aFormat := oResponse.format;
// ok, now that we've read the content types, security check
if bAuth and not(sURL = 'metadata') then
begin
if sURL = 'logout' then
begin
FContext.SessionManager.EndSession(sCookie, sClient);
oRequest.Session := nil;
redirect := true;
end
else if (sURL = 'internal') then
redirect := true
else if (Session <> nil) and FContext.SessionManager.isOkSession(Session) then
oRequest.Session := Session.link
else if (sURL <> 'auth-login') and FContext.SessionManager.GetSession(sCookie, Session, check) then
begin
if check and not CheckSessionOK(Session, sClient) then
Raise ERestfulAuthenticationNeeded.Create('TFhirWebServer.HTTPRequest', 'MSG_AUTH_REQUIRED', Msg, lang);
oRequest.Session := Session
end
else if (secure and FContext.SessionManager.isOkBearer(sBearer, sClient, Session)) then
oRequest.Session := Session
else
Raise ERestfulAuthenticationNeeded.Create('TFhirWebServer.HTTPRequest', 'MSG_AUTH_REQUIRED', Msg, lang);
end
else if cert <> nil then
oRequest.Session := FContext.SessionManager.CreateImplicitSession(sClient, cert.CanonicalName, 'Anonymous', systemFromCertificate, false, false)
else
oRequest.Session := FContext.SessionManager.CreateImplicitSession(sClient, 'Unknown', 'Anonymous', systemUnknown, false, false);
if not redirect then
begin
oRequest.analyse(sCommand, sURL, relativeReferenceAdjustment, FAdaptors);
if (oRequest.CommandType <> fcmdNull) then
begin
if (oRequest.CommandType in [fcmdTransaction, fcmdBatch, fcmdUpdate, fcmdPatch, fcmdValidate, fcmdCreate]) or
((oRequest.CommandType in [fcmdUpload, fcmdSearch, fcmdWebUI, fcmdOperation]) and (sCommand = 'POST') and (oPostStream <> nil) and
(oPostStream.Size > 0)) or ((oRequest.CommandType in [fcmdDelete]) and ((sCommand = 'DELETE')) and (oPostStream <> nil) and (oPostStream.Size > 0) and
(sContentType <> '')) Then
begin
oRequest.CopyPost(oPostStream);
if (sContentType = 'application/x-zip-compressed') or (sContentType = 'application/zip') then
begin
bundle := ProcessZip(lang, oPostStream, NewGuidURN, 'http://hl7.org/fhir', false, nil, nil, cursor);
try
oRequest.resource := bundle.Resource.link;
finally
bundle.Free;
end;
end
else
begin
oRequest.Source := TFslBuffer.Create;
if sContentEncoding = 'gzip' then
begin
mem := TMemoryStream.Create;
comp := TIdCompressorZLib.Create(nil);
try
comp.DecompressStream(oPostStream, mem, 0);
mem.Position := 0;
oRequest.Source.LoadFromStream(mem);
finally
comp.Free;
mem.Free;
end;
end
else
oRequest.Source.LoadFromStream(oPostStream);
oPostStream.Position := 0;
if (oRequest.ResourceName = 'Binary') and (oRequest.PostFormat = ffUnspecified) then
begin
SetLength(b, oPostStream.Size - oPostStream.Position);
if oPostStream.Size - oPostStream.Position > 0 then
oPostStream.Read(b[0], oPostStream.Size - oPostStream.Position);
oRequest.resource := factory.makeBinary(b, sContentType);
end
else if (oRequest.Adaptor <> nil) then
oRequest.Adaptor.Load(oRequest, oPostStream)
else if (oRequest.CommandType = fcmdPatch) and (sContentType = 'application/json-patch+json') then
begin
oRequest.patchJson := TJsonParser.ParseNode(oPostStream) as TJsonArray
end
else if (oRequest.CommandType = fcmdPatch) and (sContentType = 'application/xml-patch+xml') then
begin
oRequest.patchXml := TMXmlParser.Parse(oPostStream, [xpResolveNamespaces]);
end
else if (oRequest.CommandType in [fcmdOperation, fcmdSearch]) and (sContentType = 'application/x-www-form-urlencoded') then
begin
oRequest.resource := factory.makeParamsFromForm(oPostStream);
end
else if (oRequest.CommandType = fcmdOperation) and (sContentType = 'application/graphql') then
begin
oRequest.GraphQL := TGraphQLParser.Parse(oPostStream);
end
else if (oRequest.CommandType = fcmdOperation) and (oRequest.OperationName = 'graphql') and (sContentType = 'application/json') then
begin
oRequest.GraphQL := TGraphQLParser.parseJson(oPostStream);
end
else if oRequest.CommandType <> fcmdWebUI then
try
if oRequest.Version <> factory.version then
begin
FWebServer.convertFromVersion(oPostStream, oRequest.PostFormat, oRequest.Version, oRequest.Lang);
oRequest.CopyPost(oPostStream);
end;
if oRequest.PostFormat = ffUnspecified then
oRequest.PostFormat := detectFormat(oPostStream);
if (oRequest.Version = fhirVersionRelease4) and (oRequest.PostFormat = ffunspecified) then
Raise ERestfulException.Create('TFhirWebServerEndpoint.BuildRequest', HTTP_ERR_NOT_UNSUPPORTED_MEDIA_TYPE, itUnknown, 'Unsupported media type: '+sContentType, lang);
parser := factory.makeParser(FContext.ValidatorContext.link, oRequest.PostFormat, lang);
try
oRequest.resource := parser.parseresource(oPostStream);
if (oRequest.CommandType = fcmdTransaction) and (oRequest.resource.fhirType <> 'Bundle') then
begin
bundle := factory.wrapBundle(factory.makeResource('Bundle'));
try
bundle.type_ := btTransactionResponse;
oRequest.resource.id := FhirGUIDToString(CreateGUID);
bundle.addEntry('', oRequest.resource.link);
oRequest.resource := bundle.Resource.link;
finally
bundle.Free;
end;
end;
finally
parser.Free;
end;
except
on e: exception do
if oRequest.CommandType = fcmdValidate then
oResponse.message := e.message
else
begin
recordStack(e);
raise;
end;
end;
end;
end;
end;
end;
if (oRequest.Version = fhirVersionRelease4) and (oResponse.Format = ffunspecified) then
Raise ERestfulException.Create('TFhirWebServerEndpoint.BuildRequest', HTTP_ERR_NOT_ACCEPTABLE, itUnknown, 'Accept header not supported: '+sContentAccept, lang);
result := oRequest.link;
Finally
oRequest.Free;
End;
End;
Function TFhirWebServerEndpoint.ProcessZip(lang: String; oStream: TStream; name, base: String; init: boolean; ini: TFHIRServerIniFile; Context: TOperationContext; var cursor: integer): TFHIRBundleW;
var
rdr: TFslZipReader;
p: TFHIRParser;
i: integer;
s: TFslVCLStream;
e: TFHIRBundleEntryW;
bnd: TFHIRBundleW;
inc: TStringList;
istart, iend: integer;
function ok(res: TFhirResourceV): boolean;
begin
result := (inc.Count = 0) or (inc.IndexOf(res.fhirType) > -1);
end;
begin
inc := TStringList.Create;
result := factory.wrapBundle(factory.makeResource('Bundle'));
try
result.type_ := btTransaction;
result.id := NewGuidURN;
// result.base := base;
rdr := carry.link as TFslZipReader;
try
if (rdr = nil) or (name <> carryName) then
begin
rdr.Free;
carry.Free;
rdr := TFslZipReader.Create;
s := TFslVCLStream.Create;
s.stream := oStream;
rdr.stream := s;
rdr.Parts := TFslZipPartList.Create;
rdr.ReadZip;
carry := rdr.link as TFslZipReader;
carryName := name;
end;
if (init) or (ini = nil) then
begin
istart := 0;
iend := rdr.Parts.Count - 1;
end
else
begin
istart := 0;
iend := istart + 1000;
if iend > rdr.Parts.Count - 1 then
iend := rdr.Parts.Count - 1;
end;
for i := istart to iend Do
begin
if Context <> nil then
Context.progress(trunc(100 * (i - istart) / (iend - istart)));
if not StringArrayExistsInsensitive(['.info', '.internals', '.zip'], extractFileExt(rdr.Parts[i].name)) then
begin
if DebugConsoleMessages then
writeln('Parse ' + rdr.Parts[i].name);
if (rdr.Parts[i].name <> 'package.json') then
begin
if rdr.Parts[i].name.EndsWith('.json') then
p := FContext.Factory.makeParser(FContext.ValidatorContext.Link, ffJson, lang)
else if rdr.Parts[i].name.EndsWith('.map') then
p := TFHIRTextParser.Create(FContext.ValidatorContext.link, lang)
else
p := FContext.Factory.makeParser(FContext.ValidatorContext.Link, ffXml, lang);
try
p.Source := TBytesStream.Create(rdr.Parts[i].AsBytes);
p.AllowUnknownContent := true;
p.Parse;
if p.resource.fhirType = 'Bundle' then
begin
bnd := factory.wrapBundle(p.resource.Link);
try
case bnd.type_ of
btDocument, btMessage, btHistory, btSearchset, btCollection:
for e in bnd.entries.forEnum do
if ok(e.resource) then
result.addEntry(e, false);
btTransaction, btTransactionResponse:
; // we ignore these for now
end;
finally
bnd.Free;
end;
end
else if (p.resource.fhirType <> 'Parameters') and ok(p.resource) then
begin
result.addEntry('', p.resource.link);
end;
finally
p.Source.Free;
p.Free;
end;
end;
end;
end;
if iend < rdr.Parts.Count - 1 then
cursor := iend + 1
else
cursor := -1;
finally
rdr.Free;
end;
result.link;
finally
result.Free;
inc.Free;
end;
end;
Procedure TFhirWebServerEndpoint.ProcessOutput(oRequest: TFHIRRequest; oResponse: TFHIRResponse; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo;
relativeReferenceAdjustment: integer; style : TFHIROutputStyle; gzip: boolean);
var
oComp: TFHIRComposer;
b: TBytes;
stream: TStream;
ownsStream: boolean;
comp: TIdCompressorZLib;
Body: boolean;
res: TFhirResourceV;
bin : TFHIRBinaryW;
meta : TFhirMetaW;
begin
ownsStream := false;
gzip := false;
response.ResponseNo := oResponse.HTTPCode;
response.contentType := oResponse.contentType;
res := oResponse.resource;
if (res = nil) and (oResponse.outcome <> nil) then
res := oResponse.outcome.Resource;
Body := (request.Command = 'GET') or (request.RawHeaders.Values['Prefer'] <> 'return=minimal') or (oResponse.format = ffXhtml);
if Body and (request.RawHeaders.Values['Prefer'] = 'return=OperationOutcome') and (oResponse.outcome <> nil) then
res := oResponse.outcome.Resource;
if oResponse.Stream <> nil then
stream := TVCLStream.Create(oResponse.Stream.Link)
else
stream := TMemoryStream.Create;
try
ownsStream := true;
if res <> nil then
Begin
if Body then
begin
if res.fhirType = 'Binary' then
begin
bin := factory.wrapBinary(res.link);
try
b := bin.content;
if (Length(b) > 0) and (Body) then
stream.Write(b[0], Length(b));
stream.Position := 0;
response.contentType := bin.contentType;
if StrToBoolDef(oRequest.Parameters.GetVar('no-attachment'), false) then
response.ContentDisposition := 'attachment;';
response.Expires := Now + 0.25;
finally
bin.Free;
end;
end
// special $versions support
else if (oResponse.format = ffJson) and (request.Accept = 'application/json') and (oResponse.Resource.fhirType = 'Parameters') and (oRequest.OperationName = 'versions') then
begin
response.contentType := 'application/json';
b := EncodeVersionsJson(oResponse.Resource);
stream.Write(b, length(b));
end
else if (oResponse.format = ffXml) and (request.Accept = 'application/xml') and (oResponse.Resource.fhirType = 'Parameters') and (oRequest.OperationName = 'versions') then
begin
response.contentType := 'application/xml';
b := EncodeVersionsXml(oResponse.Resource);
stream.Write(b, length(b));
end
else if (oRequest.Adaptor <> nil) then
begin
oRequest.Adaptor.Compose(oResponse, stream);
response.contentType := oRequest.Adaptor.MimeType;
end
else
begin
// response.Expires := Now; //don't want anyone caching anything
response.Pragma := 'no-cache';
if oResponse.format = ffJson then
oComp := factory.makeComposer(FContext.ValidatorContext.link, ffJson, oRequest.lang, style)
else if oResponse.format = ffXhtml then
begin
oComp := TFHIRXhtmlComposer.Create(FContext.ValidatorContext.link, style, oRequest.lang, oRequest.baseUrl);
TFHIRXhtmlComposer(oComp).baseUrl := AppendForwardSlash(oRequest.baseUrl);
TFHIRXhtmlComposer(oComp).Version := SERVER_VERSION;
TFHIRXhtmlComposer(oComp).Session := oRequest.Session.link;
TFHIRXhtmlComposer(oComp).tags := oResponse.tags.link;
TFHIRXhtmlComposer(oComp).relativeReferenceAdjustment := relativeReferenceAdjustment;
TFHIRXhtmlComposer(oComp).OnGetLink := GetWebUILink;
TFHIRXhtmlComposer(oComp).OperationName := oRequest.OperationName;
TFHIRXhtmlComposer(oComp).Links := oResponse.links.link;
// response.Expires := 0;
response.Pragma := '';
end
else if oResponse.format = ffNDJson then
oComp := TFHIRNDJsonComposer.Create(FContext.ValidatorContext.link, style, oRequest.lang)
else if oResponse.format = ffXml then
oComp := factory.makeComposer(FContext.ValidatorContext.link, ffXml, oRequest.lang, style)
else if oResponse.format = ffText then
oComp := TFHIRTextComposer.Create(FContext.ValidatorContext.link, style, oRequest.lang)
else if (factory.version <> fhirVersionRelease2) and ((oResponse.format = ffTurtle) or (res._source_format = ffTurtle)) then
begin
oComp := factory.makeComposer(FContext.ValidatorContext.link, ffTurtle, oRequest.lang, style);
if (res <> nil) and (res.id <> '') then
TFHIRTurtleComposerBase(oComp).url := AppendForwardSlash(oRequest.baseUrl) + res.fhirType + '/' + res.id;
end
else if res._source_format = ffJson then
oComp := factory.makeComposer(FContext.ValidatorContext.link, ffJson, oRequest.lang, style)
else
oComp := factory.makeComposer(FContext.ValidatorContext.link, ffXml, oRequest.lang, style);
try
response.contentType := oComp.MimeType;
oComp.SummaryOption := oRequest.Summary;
oComp.ElementToCompose.Assign(oRequest.Elements);
if (oComp.ElementToCompose.Count > 0) or (oComp.SummaryOption in [soSummary, soText, soData]) then
begin
meta := factory.wrapMeta(res);
try
if not meta.HasTag('http://hl7.org/fhir/v3/ObservationValue', 'SUBSETTED') then
meta.addTag('http://hl7.org/fhir/v3/ObservationValue', 'SUBSETTED', 'Subsetted');
finally
meta.Free;
end;
end;
oComp.LogId := oRequest.internalRequestId;
oComp.Compose(stream, res);
finally
oComp.Free;
end;
if oResponse.Version <> factory.version then
FWebServer.convertToVersion(stream, oResponse.Format, oResponse.Version, oRequest.lang);
end;
end
end
else if oResponse.Stream = nil then
begin
if response.contentType = '' then
response.contentType := 'text/plain';
b := TEncoding.UTF8.GetBytes(oResponse.Body);
stream.Write(b, Length(b));
end;
stream.Position := 0;
if gzip and (stream.Size > 0) then
begin
response.ContentStream := TMemoryStream.Create;
comp := TIdCompressorZLib.Create(nil);
try
comp.CompressStream(stream, response.ContentStream, 9, GZIP_WINBITS, 9, 0);
finally
comp.Free;
end;
response.ContentStream.Position := 0;
response.ContentEncoding := 'gzip';
end
else
begin
response.ContentStream := stream;
ownsStream := false;
end;
finally
if ownsStream then
stream.Free;
end;
end;
function TFhirWebServerEndpoint.processProvenanceHeader(header, lang: String): TFHIRResourceV;
var
json: TFHIRParser;
ss: TStringStream;
begin
if header = '' then
result := nil
else
begin
ss := TStringStream.Create(header, TEncoding.UTF8);
try
json := FContext.Factory.makeParser(FContext.ValidatorContext.Link, ffJson, lang);
try
json.Source := ss;
json.Parse;
result := json.resource.link;
finally
json.Free;
end;
finally
ss.Free;
end;
end;
end;
function TFhirWebServerEndpoint.processRegistration(request: TIdHTTPRequestInfo; session : TFhirSession): String;
var
pm : TParseMap;
client : TRegisteredClientInformation;
s : String;
jwks : TJWKList;
json : TJsonObject;
begin
if session = nil then
raise EFHIRException.Createlang('MSG_AUTH_REQUIRED', request.AcceptLanguage);
pm := TParseMap.create(request.UnparsedParams);
try
client := TRegisteredClientInformation.Create;
try
client.name := pm.GetVar('client_name').Trim;
if client.name = '' then
raise EFHIRException.Createlang('INFO_MISSING', request.AcceptLanguage, ['client_name']);
client.url := pm.GetVar('client_uri').Trim;
client.logo := pm.GetVar('logo_uri').Trim;
client.softwareId := pm.GetVar('software_id').Trim;
client.softwareVersion := pm.GetVar('software_version').Trim;
client.PatientContext := pm.getVar('ctxt-patient') <> '';
case StrToIntDef(pm.GetVar('mode'), 0) of
1: begin
client.mode := rcmOAuthClient;
client.secret := NewGuidId;
client.redirects.Text := pm.GetVar('redirect_uris');
end;
2: begin
client.mode := rcmOAuthClient;
client.redirects.Text := pm.GetVar('redirect_uris');
end;
3: begin
client.mode := rcmBackendServices;
client.issuer := pm.GetVar('issuer').Trim;
if (client.issuer = '') then
raise EFHIRException.Createlang('INFO_MISSING', request.AcceptLanguage, ['issuer']);
s := pm.GetVar('public_key').Trim;
if s = '' then
raise EFHIRException.Createlang('INFO_MISSING', request.AcceptLanguage, ['A public key is required']);
if s.StartsWith('-----BEGIN CERTIFICATE-----') then
jwks := loadFromRsaDer(s)
else
jwks := TJWKList.create(s);
try
json := TJsonObject.Create;
try
jwks.writeToJson(json);
client.publicKey := TJSONWriter.writeObjectStr(json);
finally
json.free;
end;
finally
jwks.free;
end;
end;
else
raise EFHIRException.Createlang('MSG_UNKNOWN_CONTENT', request.AcceptLanguage, ['Mode', 'Processing Registration']);
end;
if client.secret <> '' then
result := '<p><b>Success</b><br/>Your client has been Registered and assigned a client_id of "'+FContext.Storage.storeClient(client, session.Key)+'". Use "'+client.secret+'" as your client secret</p>'
else
result := '<p><b>Success</b><br/>Your client has been Registered and assigned a client_id of "'+FContext.Storage.storeClient(client, session.Key)+'"</p>'
finally
client.Free;
end;
finally
pm.free;
end;
end;
procedure TFhirWebServerEndpoint.ProcessAsyncRequest(Context: TOperationContext; request: TFHIRRequest; response: TFHIRResponse);
var
thread : TAsyncTaskThread;
id : String;
begin
if not (request.CommandType in [fcmdSearch, fcmdHistoryInstance, fcmdHistoryType, fcmdHistorySystem, fcmdTransaction, fcmdBatch, fcmdUpload, fcmdOperation]) then
raise EFHIRException.CreateLang('NO_ASYNC', request.Lang);
thread := TAsyncTaskThread.create;
FWebServer.FLock.Lock;
try
FWebServer.FThreads.add(thread);
finally
FWebServer.FLock.Unlock;
end;
id := NewGuidId;
if request.Parameters.VarExists('_outputFormat') then
thread.Format := mimeTypeToFormat(request.Parameters.GetVar('_outputFormat'))
else
thread.Format := response.Format;
thread.key := FContext.Storage.createAsyncTask(request.url, id, thread.Format, request.secure);
thread.server := self.link as TFhirWebServerEndPoint;
thread.request := request.Link;
thread.Start;
response.HTTPCode := 202;
response.Message := 'Accepted';
response.ContentLocation := request.baseUrl+'task/'+id;
if response.format = ffXhtml then
begin
response.ContentType := 'text/html';
response.Body := makeTaskRedirect(request.baseUrl, id, 'Preparing', thread.Format, nil);
end;
end;
procedure TFhirWebServerEndpoint.ProcessRequest(Context: TOperationContext; request: TFHIRRequest; response: TFHIRResponse);
var
op: TFHIROperationEngine;
t: cardinal;
us, cs: String;
begin
FWebServer.FLock.Lock;
try
inc(FWebServer.FRestCount);
finally
FWebServer.FLock.Unlock;
end;
if request.internalRequestId = '' then
request.internalRequestId := FContext.Globals.nextRequestId;
t := GetTickCount;
op := FContext.Storage.createOperationContext(request.lang);
try
op.OnPopulateConformance := PopulateConformance;
op.Execute(Context, request, response);
FContext.Storage.yield(op, nil);
except
on e: exception do
begin
FContext.Storage.yield(op, e);
raise;
end;
end;
t := GetTickCount - t;
FWebServer.FLock.Lock;
try
inc(FWebServer.FRestCount);
inc(FWebServer.FRestTime, t);
finally
FWebServer.FLock.Unlock;
end;
if request.Session = nil then // during OAuth only
us := 'user=(in-oauth)'
else
us := 'user=' + request.Session.UserName;
if request.CommandType = fcmdOperation then
cs := '$' + request.OperationName
else
cs := 'cmd=' + CODES_TFHIRCommandType[request.CommandType];
end;
procedure TFhirWebServerEndpoint.ProcessScimRequest(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo);
var
sCookie: String;
c: integer;
Session: TFHIRSession;
check: boolean;
begin
if request.AuthUsername = 'Bearer' then
sCookie := request.AuthPassword
else
begin
c := request.Cookies.GetCookieIndex(FHIR_COOKIE_NAME);
if c > -1 then
sCookie := request.Cookies[c].CookieText.Substring(FHIR_COOKIE_NAME.Length + 1);
end;
if (sCookie <> '') and request.Document.StartsWith('/scim/logout') then
begin
FContext.SessionManager.EndSession(sCookie, request.RemoteIP);
response.redirect('/closed');
end
else if (FContext.SessionManager.GetSession(sCookie, Session, check)) then
begin
try
if check and not CheckSessionOK(Session, request.RemoteIP) then
Raise ERestfulAuthenticationNeeded.Create('TFhirWebServer.HTTPRequest', 'MSG_AUTH_REQUIRED', 'Session Expired', request.AcceptLanguage);
if not Session.canAdministerUsers then
Raise ERestfulAuthenticationNeeded.Create('TFhirWebServer.HTTPRequest', 'MSG_AUTH_REQUIRED', 'This Session is not authorised to manage users', request.AcceptLanguage);
FContext.UserProvider.ProcessRequest(AContext, request, response, Session);
finally
Session.Free;
end;
end
else
Raise ERestfulAuthenticationNeeded.Create('TFhirWebServer.HTTPRequest', 'MSG_AUTH_REQUIRED', 'Authentication required', request.AcceptLanguage);
end;
procedure TFhirWebServerEndpoint.ProcessTaskRequest(Context: TOperationContext; request: TFHIRRequest; response: TFHIRResponse);
var
status : TAsyncTaskStatus;
message, s, originalRequest : String;
transactionTime, expires : TDateTimeEx;
secure : boolean;
names : TStringList;
outcome : TBytes;
fmt : TFHIRFormat;
key : integer;
n, f : string;
zip : TFslZipWriter;
m : TFslMemoryStream;
p : TFHIRParser;
begin
names := TStringList.Create;
try
if FContext.Storage.fetchTaskDetails(request.Id, key, status, fmt, secure, message, originalRequest, transactionTime, expires, names, outcome) then
begin
if request.CommandType = fcmdDeleteTask then
begin
FContext.Storage.MarkTaskDeleted(key);
for n in names do
begin
f := FHIR.Support.Utilities.Path([FContext.TaskFolder, 'task-'+inttostr(key)+'-'+n+EXT_WEB_TFHIRFormat[fmt]]);
if FileExists(f) then
DeleteFile(f);
end;
response.HTTPCode := 204;
response.Message := 'Deleted';
end
else if request.subId <> '' then
begin
if request.SubId = 'zip' then
begin
m := TFslMemoryStream.Create;
try
zip := TFslZipWriter.Create;
try
zip.Stream := m.Link;
for n in names do
begin
f := FHIR.Support.Utilities.Path([FContext.TaskFolder, 'task-'+inttostr(key)+'-'+n+EXT_WEB_TFHIRFormat[fmt]]);
zip.addFile(n+EXT_WEB_TFHIRFormat[fmt], f);
end;
zip.WriteZip;
finally
zip.Free;
end;
m.Position := 0;
response.HTTPCode := 200;
response.Message := 'OK';
response.Stream := m.Link;
response.ContentType := 'application/zip';
FContext.Storage.recordDownload(key, request.subId);
finally
m.Free;
end;
end
else
begin
f := FHIR.Support.Utilities.Path([FContext.TaskFolder, 'task-'+inttostr(key)+'-'+request.SubId]);
if not FileExists(f) then
begin
response.HTTPCode := 500;
response.Message := 'Server Error';
response.resource := factory.BuildOperationOutcome(request.Lang, 'The source for file '+ExtractFileName(f)+' could not be found');
end
else
begin
response.HTTPCode := 200;
response.Message := 'OK';
response.Stream := TFslFile.create(f, fmOpenRead + fmShareDenyWrite);
response.ContentType := MIMETYPES_TFHIRFormat[response.format];
FContext.Storage.recordDownload(key, request.subId);
end;
end;
end
else
begin
case status of
atsCreated, atsWaiting, atsProcessing :
begin
response.HTTPCode := 202;
response.Message := 'Accepted';
response.ContentLocation := request.baseUrl+'task/'+request.id;
if response.format = ffXhtml then
begin
response.ContentType := 'text/html';
response.Body := makeTaskRedirect(request.baseUrl, request.id, '', response.Format, nil);
end;
response.Progress := Message;
end;
atsComplete:
begin
// check format
response.HTTPCode := 200;
response.Message := 'OK';
for s in names do
response.links.add(s, request.baseUrl+'task/'+request.id+'/'+s+EXT_WEB_TFHIRFormat[fmt]);
response.links.add('collection', request.baseUrl+'task/'+request.id+'.zip');
if response.format = ffXhtml then
begin
response.ContentType := 'text/html';
response.Body := makeTaskRedirect(request.baseUrl, request.id, '', fmt, names);
end
else
begin
response.ContentType := 'application/json';
response.Body := FWebServer.encodeAsyncResponseAsJson(request, originalRequest, secure, fmt, transactionTime, names);
end;
end;
atsTerminated, atsError :
begin
response.HTTPCode := 500;
response.Message := 'Error';
fmt := ffJson;
if length(outcome) > 0 then
begin
p := factory.makeParser(FContext.ValidatorContext.link, fmt, 'en');
try
response.resource := p.parseResource(outcome);
finally
p.Free;
end;
end
else
response.resource := factory.BuildOperationOutcome(request.Lang, message);
end;
atsAborted:
begin
response.HTTPCode := 400;
response.Message := 'Error';
response.resource := factory.BuildOperationOutcome(request.Lang, 'This task has been cancelled');
end;
atsDeleted:
begin
response.HTTPCode := 404;
response.Message := 'Not found';
response.Resource := factory.BuildOperationOutcome('en', 'Task has been deleted', itUnknown);
end;
end;
end
end
else
begin
response.HTTPCode := 404;
response.Message := 'Not found';
response.Resource := factory.BuildOperationOutcome('en', 'Unknown task', itUnknown);
end;
finally
names.Free;
end;
end;
function port(actual, default : integer) : String;
begin
if actual = default then
result := ''
else
result := ':' + inttostr(actual);
end;
function TFhirWebServerEndpoint.BuildFhirAuthenticationPage(lang, host, path, logId, Msg: String; secure: boolean): String;
var
authurl: string;
begin
authurl := OAuthPath(secure);
result := '<?xml version="1.0" encoding="UTF-8"?>'#13#10 + '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'#13#10 +
' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'#13#10 + ''#13#10 +
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'#13#10 + '<head>'#13#10 +
' <meta charset="utf-8" http-equiv="X-UA-Compatible" content="IE=edge" />' + #13#10 + ' <title>FHIR RESTful Server - FHIR v' + Factory.versionString
+ '</title>'#13#10 + TFHIRXhtmlComposer.PageLinks + #13#10 + FHIR_JS + '</head>'#13#10 + ''#13#10 + '<body>'#13#10 + ''#13#10 +
TFHIRXhtmlComposer.header(factory, nil, FPath, lang, SERVER_VERSION) + '<h2>' + FWebServer.FOwnerName + ' ' + GetFhirMessage('NAME_SERVER', lang) + '</h2>'#13#10;
result := result + '<p>'#13#10 + GetFhirMessage('MSG_AUTH_REQUIRED', lang) + '</p>'#13#10;
if Msg <> '' then
result := result + '<p><b>' + FormatTextToHTML(Msg) + '</b></p>'#13#10;
result := result + '<p><a href="' + FAuthServer.BasePath + '/auth?client_id=c.1&response_type=code&scope=openid%20profile%20user/*.*%20' + SCIM_ADMINISTRATOR
+ '&redirect_uri=' + authurl + '/internal&aud=' + authurl + '&state=' + FAuthServer.MakeLoginToken(path, apGoogle) + '">Login using OAuth</a></p>' + #13#10;
if FWebServer.FActualSSLPort <> 0 then
result := result + '<p>Or use the <a href="http://' + FWebServer.FHost + port(FWebServer.FActualPort, 80) + FPath + '">unsecured API</a>.</p>'#13#10;
result := result + '<p> </p>'#13#10 +
'<p>This server uses <a href="http://fhir-docs.smarthealthit.org/argonaut-dev/authorization/">Smart App Launch</a> for OAuth logins</p>'#13#10;
result := result + TFHIRXhtmlComposer.Footer(factory, lang, lang, logid);
end;
function TFhirWebServerEndpoint.BuildFhirHomePage(compList : TFslList<TFHIRCompartmentId>; logId, lang, host, sBaseURL: String; Session: TFHIRSession; secure: boolean): String;
var
counts: TStringList;
a: String;
s: String;
names: TStringList;
profiles: TFslStringMatch;
i, j, ix: integer;
b: TStringBuilder;
pol: String;
begin
logt('home page: ' + Session.scopes);
counts := TStringList.Create;
try
for a in FContext.ValidatorContext.allResourceNames do
begin
ix := counts.Add(a);
if (compList.Empty) or FContext.Indexes.Compartments.existsInCompartment('Patient', a) then
counts.Objects[ix] := TObject(0)
else
counts.Objects[ix] := TObject(-1);
end;
pol := FContext.Storage.ProfilesAsOptionList;
profiles := TFslStringMatch.Create;
try
profiles.forced := true;
FContext.Storage.FetchResourceCounts(compList, counts);
s := host + sBaseURL;
b := TStringBuilder.Create;
try
b.Append('<?xml version="1.0" encoding="UTF-8"?>'#13#10 + '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'#13#10 +
' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'#13#10 + ''#13#10 +
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'#13#10 + '<head>'#13#10 +
' <meta charset="utf-8" http-equiv="X-UA-Compatible" content="IE=edge" />' + #13#10 + ' <title>FHIR RESTful Server - FHIR v' +
Factory.versionString + '</title>'#13#10 + TFHIRXhtmlComposer.PageLinks + FHIR_JS + '</head>'#13#10 + ''#13#10 + '<body>'#13#10 +
TFHIRXhtmlComposer.header(factory, Session, sBaseURL, lang, SERVER_VERSION));
b.Append('<h2>' + FWebServer.FOwnerName + ' ' + GetFhirMessage('NAME_SERVER', lang) + '</h2>'#13#10);
if Session <> nil then
if secure then
begin
b.Append('<p>Welcome ' + FormatTextToXML(Session.SessionName, xmlText) + '</p>'#13#10);
end
else if FWebServer.FActualSSLPort = 0 then
b.Append('<p>Welcome ' + FormatTextToXML(Session.SessionName, xmlText) + '</p>'#13#10)
else
b.Append('<p>Welcome ' + FormatTextToXML(Session.SessionName, xmlText) + ' (or use <a href="https://' + FWebServer.FHost + port(FWebServer.FActualSSLPort, 443) + FPath +
'">Secure API</a>)</p>'#13#10);
b.Append('<p>'#13#10 + StringFormat(GetFhirMessage('MSG_HOME_PAGE_1', lang), ['<a href="http://hl7.org/fhir">http://hl7.org/fhir</a>']) + #13#10 +
StringFormat(GetFhirMessage('MSG_HOME_PAGE_2', lang), [s]) +
' This server defines some <a href="local.hts">extensions to the API</a>, and also offers <a href="/tx">Terminology Services</a>' + #13#10);
if Session.canGetUser and (Session.User <> nil) and not Session.isAnonymous then
begin
b.Append('. You can also <a href="registerclient.html">Register a client</a>.'+#13#10);
b.Append(' or <a href="token.hts">get your bearer token</a> (use this to get access to the secure API without needing OAuth login).</p>');
end
else
begin
b.Append('. If you login through OAuth, you can also Register a client'+#13#10);
b.Append(' or get your bearer token (use this to get access to the secure API without needing OAuth login in the application).</p>');
end;
b.Append('<p>GDPR-Disclosure: All access to this server is logged as AuditEvent Resources, and these store your ip address (and '+'logged in user, if one exists). Also, your IP address is logged with Google Analytics for building geomaps of server usage. Your continued use of the API constitutes agreement to these terms. See [link] for erasure requests.</p>');
b.Append(
'</p>'#13#10 + '<hr/>'#13#10 + ''#13#10 + '<p>' + GetFhirMessage('SYSTEM_OPERATIONS', lang) + ':</p><ul><li> <a href="' + sBaseURL + '/metadata">' +
GetFhirMessage('CONF_PROFILE', lang) + '</a> ' + '(' + GetFhirMessage('OR', lang) + ' <a href="' + sBaseURL +
'/metadata?_format=text/xml">as xml</a> (' + GetFhirMessage('OR', lang) + ' <a href="' + sBaseURL +
'/metadata?_format=application/json">JSON</a>)</li>' + #13#10);
if not FWebServer.FIsTerminologyServerOnly then
b.Append('<li><a class="tag" href="' + sBaseURL + '/$meta">' + GetFhirMessage('SYSTEM_TAGS', lang) + '</a></li>');
b.Append('<li><a href="' + sBaseURL + '/_search">' + GetFhirMessage('GENERAL_SEARCH', lang) + '</a></li>');
if not FWebServer.FIsTerminologyServerOnly then
b.Append('<li><a href="' + sBaseURL + '/_history">' + StringFormat(GetFhirMessage('MSG_HISTORY', lang), [GetFhirMessage('NAME_SYSTEM', lang)]) +
'</a> (History of all resources)</li>' + #13#10);
if not FWebServer.FIsTerminologyServerOnly then
b.Append('<li><a href="#upload">' + GetFhirMessage('NAME_UPLOAD_SERVICES', lang) + '</a></li>' + #13#10);
if not FWebServer.FIsTerminologyServerOnly then
b.Append('<li>Create/Edit a new resource based on the profile: <form action="' + sBaseURL + '/_web/Create" method="GET"><select name="profile">' + pol
+ '</select> <input type="submit" value="GO"></form></li>' + #13#10);
if (Session.canAdministerUsers) then
b.Append('<li><a href="/scim/web">Manage Users</a></li>' + #13#10);
b.Append('</ul>' + #13#10 + ''#13#10 + '<hr/>'#13#10 + '<p>' + GetFhirMessage('MSG_HOME_PAGE_3', lang) + '</p>' + #13#10);
b.Append('<table class="lines">'#13#10 +
'<tr><th>' + GetFhirMessage('NAME_TYPE', lang) + '</th>' + '<th>' + GetFhirMessage('NAME_STORED', lang) + '</th>' + '<th colspan="4">' +
GetFhirMessage('NAME_OPERATIONS', lang) + '</th><td style="border-left: 1px solid grey"/><th>' + GetFhirMessage('NAME_TYPE', lang) + '</th>' + '<th>'
+ GetFhirMessage('NAME_STORED', lang) + '</th>' + '<th colspan="4">' + GetFhirMessage('NAME_OPERATIONS', lang) + '</th></tr>'#13#10);
names := TStringList.Create;
Try
for a in FContext.ValidatorContext.allResourceNames do
begin
ix := counts.IndexOf(a);
if (ix >= 0) and (integer(counts.Objects[ix]) > -1) and (FContext.ResConfig[a].Supported) then
names.Add(a);
end;
names.Sort;
j := 0;
if names.count > 0 then
begin
for i := 0 to names.Count div 2 do
begin
inc(j);
if j mod 2 = 1 then
b.Append('<tr bgcolor="#F0F0F0">')
else
b.Append('<tr bgcolor="#FFFFFF">');
a := names[i];
ix := counts.IndexOf(a);
b.Append(TFHIRXhtmlComposer.ResourceLinks(a, lang, sBaseURL, integer(counts.Objects[ix]), true, true, Session.canRead(a)));
b.Append('<td style="border-left: 1px solid grey"/>');
if (i + names.Count div 2) + 1 < names.Count then
begin
a := names[1 + i + names.Count div 2];
ix := counts.IndexOf(a);
b.Append(TFHIRXhtmlComposer.ResourceLinks(a, lang, sBaseURL, integer(counts.Objects[ix]), true, true, Session.canRead(a)));
end;
b.Append('</tr>');
end;
end;
finally
names.Free;
end;
b.Append('</table>'#13#10);
if not FWebServer.FIsTerminologyServerOnly then
b.Append('<hr/><h2>' + GetFhirMessage('NAME_UPLOAD_SERVICES', lang) + '</h2>'#13#10 +
'<a name="upload"> </a><form enctype="multipart/form-data" method="POST">' + #13#10 +
'<p><input type="hidden" name="_format" value="text/html"/><br/>' + #13#10 + '' + GetFhirMessage('MSG_CONTENT_MESSAGE', lang) + '.<br/><br/>' +
#13#10 + '' + GetFhirMessage('MSG_CONTENT_UPLOAD', lang) + ': <br/><input type="file" name="file" size="60"/><br/>' + #13#10 + '' +
GetFhirMessage('MSG_CONTENT_PASTE', lang) + ':<br/> <textarea name="src" cols="70" rows="5"/>' + #13#10 + '</textarea><br/><br/>' + #13#10 +
'<table class="none"><tr><td>Operation:</td><td> <select size="1" name="op">' + #13#10 + ' <option value="transaction">Transaction</option>' +
#13#10 + ' <option value="batch">Batch</option>' + #13#10 + ' <option value="validation">Validation</option>' + #13#10 + '</select></td></tr>' +
#13#10 + '<tr><td>Profile:</td><td> <select size="1" name="profile">' + #13#10 + '<option value=""></option>' + #13#10 + pol +
'</select> (if validating, use the selected profile)</td></tr></table><br/>' + #13#10 + '<input type="submit" value="' +
GetFhirMessage('NAME_UPLOAD', lang) + '"/>'#13#10 + '</p></form>'#13#10);
b.Append(TFHIRXhtmlComposer.Footer(factory, sBaseURL, lang, logId));
result := b.ToString;
finally
b.Free;
end;
finally
profiles.Free;
end;
finally
counts.Free;
end;
end;
function TFhirWebServerEndpoint.BuildFhirUploadPage(lang, host, sBaseURL: String; aType: String; Session: TFHIRSession): String;
var
s: String;
begin
s := host + sBaseURL;
result := '<?xml version="1.0" encoding="UTF-8"?>'#13#10 + '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'#13#10 +
' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'#13#10 + ''#13#10 +
'<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">'#13#10 + '<head>'#13#10 +
' <meta charset="utf-8" http-equiv="X-UA-Compatible" content="IE=edge" />' + #13#10 + ' <title>' + StringFormat(GetFhirMessage('UPLOAD', lang),
[aType]) + '</title>'#13#10 + ' <link rel="Stylesheet" href="/css/fhir.css" type="text/css" media="screen" />'#13#10 + FHIR_JS + '</head>'#13#10 +
''#13#10 + '<body>'#13#10 + ''#13#10 + '<div class="header">'#13#10 + ' <a href="http://www.hl7.org/fhir" title="' +
GetFhirMessage('MSG_HOME_PAGE_TITLE', lang) + '"><img border="0" src="/img/flame16.png" style="vertical-align: text-bottom"/> <b>FHIR</b></a>'#13#10 +
''#13#10 + ' © HL7.org 2011-2013'#13#10 + ' '#13#10 + ' ' + FWebServer.FOwnerName + ' ' + GetFhirMessage('NAME_SERVER', lang) + ''#13#10 +
' '#13#10 + ' FHIR ' + GetFhirMessage('NAME_VERSION', lang) + ' ' + Factory.versionString + ''#13#10;
if Session <> nil then
result := result + ' ' + FormatTextToXML(Session.SessionName, xmlText);
result := result + ' <a href="' + s + '">' + GetFhirMessage('MSG_BACK_HOME', lang) + '</a>'#13#10 + '</div>'#13#10 + ''#13#10 +
'<div id="div-cnt" class="content">'#13#10 + '<h2>' + StringFormat(GetFhirMessage('UPLOAD', lang), [aType]) + '</h2>'#13#10 + '<form action="' + s +
lowercase(aType) + '/upload" enctype="multipart/form-data" method="POST">' + #13#10 + '<input type="hidden" name="format" size="text/html"/><br/>' + #13#10
+ '' + GetFhirMessage('MSG_CONTENT_UPLOAD', lang) + ': <input type="file" name="file" size="60"/><br/>' + #13#10 +
'<input type="submit" value="Upload"/>'#13#10 + '</form>'#13#10 + ''#13#10 + '<p><br/><a href="' + s + '">' + GetFhirMessage('MSG_BACK_HOME', lang) +
'</a></p>' + '</div>'#13#10 + '</body>'#13#10 + '</html>'#13#10 + ''#13#10
end;
function TFhirWebServerEndpoint.LookupReference(Context: TFHIRRequest; id: String): TResourceWithReference;
var
store: TFHIROperationEngine;
begin
store := FContext.Storage.createOperationContext(TFHIRRequest(Context).lang);
try
result := store.LookupReference(Context, id);
FContext.Storage.yield(store, nil);
except
on e: exception do
begin
FContext.Storage.yield(store, e);
raise;
end;
end;
end;
function TFhirWebServerEndpoint.makeTaskRedirect(base, id: String; msg : String; fmt : TFHIRFormat; names: TStringList): string;
var
s, n, body, r : String;
begin
s := FWebServer.FSourceProvider.getSource('task-redirect.html');
if (names <> nil) and (names.count > 0) then
begin
r := '';
body := '<p>';
for n in names do
body := body+'<a href="'+base+'task/'+id+'/'+n+EXT_WEB_TFHIRFormat[fmt]+'">'+n+EXT_WEB_TFHIRFormat[fmt]+'</a><br/>'+#13#10;
body := body+'</p>';
end
else
begin
body := '<p>';
body := body+'Working: '+msg;
body := body+'</p>';
body := body+'<p>';
body := body+'<a href="'+base+'task/'+id+'">Try Again</a>';
body := body+'</p>';
r := '<META HTTP-EQUIV="Refresh" CONTENT="30;URL='+base+'task/'+id+'"/>'
end;
result := s.Replace('${body}', body);
result := result.Replace('${redirect}', r);
result := result.Replace('${title}', 'Task '+id);
end;
procedure TFhirWebServerEndpoint.doGetBundleBuilder(request : TFHIRRequest; context: TFHIRResponse; aType: TBundleType; out builder: TFhirBundleBuilder);
var
b : TFHIRBundleW;
begin
if context.Format = ffNDJson then
raise EFHIRException.CreateLang('NDJSON-ASYNC', request.Lang);
b := factory.wrapBundle(factory.makeResource('Bundle'));
b.type_ := aType;
builder := TFHIRBundleBuilderSimple.Create(factory.link, b);
end;
function TFhirWebServerEndpoint.EncodeVersionsJson(r : TFHIRResourceV): TBytes;
var
j : TJsonObject;
a : TJsonArray;
p : TFhirParametersW;
pp : TFhirParametersParameterW;
s : String;
begin
p := factory.wrapParams(r.link);
try
j := TJsonObject.create;
try
a := j.forceArr['versions'];
for pp in p.parameterList do
if pp.name = 'version' then
a.add(pp.value.primitiveValue);
s := TJSONWriter.writeObjectStr(j, true);
finally
j.free;
end;
result := TEncoding.UTF8.GetBytes(s);
finally
p.free;
end;
end;
function TFhirWebServerEndpoint.EncodeVersionsXml(r : TFHIRResourceV): TBytes;
var
x : TMXmlDocument;
p : TFhirParametersW;
pp : TFhirParametersParameterW;
s : String;
begin
p := factory.wrapParams(r.link);
try
x := TMXmlDocument.Create;
try
for pp in p.parameterList do
if pp.name = 'version' then
x.addElement('version').addText(pp.value.primitiveValue);
s := x.ToXml(true);
finally
x.free;
end;
result := TEncoding.UTF8.GetBytes(s);
finally
p.free;
end;
end;
function TFhirWebServerEndPoint.factory: TFHIRFactory;
begin
result := FContext.Factory;
end;
function TFhirWebServerEndpoint.GetResource(Session: TFHIRSession; rtype: string; lang, id, ver, op: String): TFhirResourceV;
var
request: TFHIRRequest;
response: TFHIRResponse;
Context: TOperationContext;
begin
result := nil;
request := TFHIRRequest.Create(FContext.ValidatorContext.link, roRest, FContext.Indexes.Compartments.link);
response := TFHIRResponse.Create(FContext.ValidatorContext.link);
try
response.OnCreateBuilder := doGetBundleBuilder;
request.Session := Session.link;
request.ResourceName := rtype;
request.lang := lang;
request.id := id;
request.LoadParams('');
if (op <> '') then
begin
request.CommandType := fcmdOperation;
request.OperationName := op;
end
else if (ver = '') then
request.CommandType := fcmdRead
else
begin
request.CommandType := fcmdVersionRead;
request.SubId := ver;
end;
Context := TOperationContext.Create;
try
checkRequestByJs(context, request);
ProcessRequest(Context, request, response);
finally
Context.Free;
end;
if response.resource <> nil then
result := response.resource.link
else
raise EFHIRException.CreateLang('MSG_NO_MATCH', lang, [rtype + '/' + id + '/_history/' + ver]);
finally
response.Free;
request.Free;
end;
end;
function TFhirWebServerEndpoint.FindResource(Session: TFHIRSession; rtype: string; lang, params: String): TFhirResourceV;
var
request: TFHIRRequest;
response: TFHIRResponse;
Context: TOperationContext;
b : TFHIRBundleW;
be : TFhirBundleEntryW;
begin
result := nil;
request := TFHIRRequest.Create(FContext.ValidatorContext.link, roRest, FContext.Indexes.Compartments.link);
response := TFHIRResponse.Create(FContext.ValidatorContext.link);
try
response.OnCreateBuilder := doGetBundleBuilder;
request.Session := Session.link;
request.ResourceName := rtype;
request.lang := lang;
request.LoadParams(params);
request.CommandType := fcmdSearch;
Context := TOperationContext.Create;
try
checkRequestByJs(context, request);
ProcessRequest(Context, request, response);
finally
Context.Free;
end;
if (response.resource <> nil) and (response.Resource.fhirType = 'Bundle') then
begin
b := factory.wrapBundle(response.Resource.link);
try
for be in b.entries.forEnum do
if be.resource <> nil then
exit(be.resource.link);
finally
b.Free;
end;
end;
raise EFHIRException.CreateLang('MSG_NO_MATCH', lang, [rtype + '?' + params]);
finally
response.Free;
request.Free;
end;
end;
procedure TFhirWebServerEndpoint.GetPatients(details: TFslStringDictionary);
var
b : TFHIRBundleW;
be : TFhirBundleEntryW;
p : TFhirPatientW;
begin
b := DoSearch(nil, 'Patient', 'en', '_summary=true&__wantObject=true');
try
for be in b.entries.forEnum do
begin
p := factory.wrapPatient(be.resource.link);
try
details.Add(p.id, p.nameSummary);
finally
p.Free;
end;
end;
finally
b.Free;
end;
end;
function TFhirWebServerEndpoint.getReferencesByType(t: String): String;
var
bundle : TFHIRBundleW;
entry : TFhirBundleEntryW;
b : TStringBuilder;
s : String;
begin
bundle := nil;
b := TStringBuilder.create;
try
for s in t.trim.Split(['|']) do
begin
bundle := DoSearch(nil, s, 'en', '_summary=true&__wantObject=true&_sort=name&_count=50');
for entry in bundle.entries.forEnum do
begin
b.Append('<option value="');
b.Append(entry.resource.id);
b.Append('">');
// if entry.resource is TFhirPatient then
// b.Append(HumanNamesAsText(TFhirPatient(entry.resource).nameList))
// else if entry.resource is TFhirRelatedPerson then
// !{$IFDEF FHIR2}
// b.Append(HumanNameAsText(TFhirRelatedPerson(entry.resource).name))
// {$ELSE}
// b.Append(HumanNamesAsText(TFhirRelatedPerson(entry.resource).nameList))
// {$ENDIF}
// else if entry.resource is TFhirOrganization then
// b.Append(TFhirOrganization(entry.resource).name)
// else
b.Append('??');
b.Append(' (');
b.Append(entry.resource.fhirType);
b.Append('/');
b.Append(entry.resource.id);
b.Append(')</option>');
end;
end;
result := b.ToString;
finally
b.Free;
bundle.Free;
end;
end;
procedure TFhirWebServerEndpoint.GetWebUILink(resource: TFhirResourceV; base, statedType, id, ver: String; var link, text: String);
var
tail: String;
begin
link := '';
if (resource <> nil) and (id <> '') then
begin
tail := id;
if ver <> '' then
tail := tail + '/' + ver;
if resource.fhirType = 'Questionnaire' then
begin
text := 'Try out the Questionnaire as a web form';
if statedType = 'Profile' then
link := FPath + '/_web/StructureDefinition/' + tail
else
link := FPath + '/_web/Questionnaire/' + tail;
end;
if resource.fhirType = 'StructureDefinition' then
begin
link := FPath + '/_web/StructureDefinition/' + tail;
text := 'Try out the Profile as a questionnaire based web form';
end;
if resource.fhirType = 'ValueSet' then
begin
link := FPath + '/ValueSet/' + id + '/$expand?filter=';
text := 'Expand this value set';
end;
if resource.fhirType = 'Patient' then
begin
link := FPath + '/_web/Patient/' + id;
text := 'Patient Record Page';
end;
end;
end;
function TFhirWebServerEndPoint.OAuthPath(secure: boolean): String;
begin
if secure then
begin
if FWebServer.FActualSSLPort = 443 then
result := 'https://' + FWebServer.FHost + FPath
else
result := 'https://' + FWebServer.FHost + ':' + inttostr(FWebServer.FActualSSLPort) + FPath;
end
else
begin
if FWebServer.FActualPort = 80 then
result := 'http://' + FWebServer.FHost + FPath
else
result := 'http://' + FWebServer.FHost + ':' + inttostr(FWebServer.FActualPort) + FPath;
end;
end;
procedure TFhirWebServerEndpoint.OnCDSResponse(manager: TCDSHooksManager; server: TRegisteredFHIRServer; Context: TObject; response: TCDSHookResponse; error: String);
var
ctxt: TFHIRWebServerPatientViewContext;
begin
ctxt := TFHIRWebServerPatientViewContext(Context);
FWebServer.FLock.Lock;
try
if error <> '' then
ctxt.Errors.Add(error + ' (from ' + server.name + ')')
else if response = nil then
ctxt.Errors.Add('Unknown Error (from ' + server.name + ')')
else
ctxt.cards.AddAll(response.cards);
finally
FWebServer.FLock.Unlock;
end;
end;
procedure TFhirWebServerEndpoint.CheckAsyncTasks;
var
tasks : TFslList<TAsyncTaskInformation>;
task : TAsyncTaskInformation;
n, fn : string;
begin
tasks := TFslList<TAsyncTaskInformation>.create;
try
FContext.Storage.fetchExpiredTasks(tasks);
for task in tasks do
begin
FContext.Storage.MarkTaskDeleted(task.key);
for n in task.names do
begin
fn := FHIR.Support.Utilities.Path([FContext.TaskFolder, 'task-'+inttostr(task.key)+'-'+n+EXT_WEB_TFHIRFormat[task.format]]);
if FileExists(fn) then
DeleteFile(fn);
end;
end;
finally
tasks.free;
end;
end;
function TFhirWebServerEndpoint.CheckSessionOK(Session: TFHIRSession; ip: string): boolean;
var
id, name, email, Msg: String;
begin
if Session.providerCode = apGoogle then
result := GoogleGetDetails(Session.InnerToken, FAuthServer.GoogleAppKey, '', id, name, email, Msg)
else if Session.providerCode = apFacebook then
result := FacebookGetDetails(Session.InnerToken, id, name, email, Msg)
else
result := false;
if result then
result := Session.id = id;
if result then
FContext.SessionManager.MarkSessionChecked(Session.Cookie)
else
FContext.SessionManager.EndSession(Session.Cookie, ip);
end;
function TFhirWebServerEndpoint.ClientAddress(secure: boolean): String;
begin
if secure then
result := 'https://localhost:' + inttostr(FWebServer.FActualSSLPort) + FPath
else
result := 'http://localhost:' + inttostr(FWebServer.FActualPort) + FPath;
end;
procedure TFhirWebServerEndPoint.RunPostHandler(request : TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; Session: TFHIRSession; claimed, actual: String; secure: boolean);
//var
// handler : TFHIRServerPostHandler;
// params : TParseMap;
// variables: TFslStringDictionary;
// s : string;
begin
raise EFslException.Create('Not handled at this time');
// params := TParseMap.create(request.UnparsedParams);
// try
// s := params.GetVar('handler');
// !{$IFDEF FHIR3}
// if s = 'coverage' then
// handler := TFHIRServerCoveragePostHandler.Create
// else {$ENDIF}
// raise EFHIRException.create('Unknown Handler');
// try
// handler.secure := secure;
// handler.params := params.Link;
// handler.context := FContext.Link;
// handler.session := Session.Link;
// variables := handler.execute;
// try
// ReturnProcessedFile(request, response, session, claimed, actual, secure, variables);
// finally
// variables.Free;
// end;
// finally
// handler.Free;
// end;
// finally
// params.Free;
// end;
end;
procedure TFhirWebServerEndPoint.ReturnProcessedFile(request : TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; Session: TFHIRSession; path: String; secure: boolean; variables: TFslStringDictionary = nil);
begin
ReturnProcessedFile(request, response, Session, path, path, secure, variables);
end;
procedure TFhirWebServerEndPoint.ReturnProcessedFile(request : TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; Session: TFHIRSession; claimed, actual: String; secure: boolean; variables: TFslStringDictionary = nil);
var
s, n, p, v, t: String;
begin
logt('script: ' + claimed);
s := FWebServer.FSourceProvider.getSource(actual);
// actions....
// if s.Contains('<!--[%clientregistration%]-->') then
// begin
// s := s.Replace('<!--[%clientregistration%]-->', processRegistration(request, session), [rfReplaceAll]);
// end;
s := s.Replace('[%id%]', FWebServer.FName, [rfReplaceAll]);
s := s.Replace('[%specurl%]', factory.specUrl, [rfReplaceAll]);
s := s.Replace('[%ver%]', Factory.versionString, [rfReplaceAll]);
s := s.Replace('[%path%]', FPath, [rfReplaceAll]);
s := s.Replace('[%spath%]', FPath, [rfReplaceAll]);
s := s.Replace('[%web%]', FWebServer.WebDesc, [rfReplaceAll]);
s := s.Replace('[%admin%]', FWebServer.FAdminEmail, [rfReplaceAll]);
if (Session = nil) then
s := s.Replace('[%logout%]', 'User: [n/a]', [rfReplaceAll])
else
s := s.Replace('[%logout%]', '| User: ' + Session.SessionName + ' <a href="/closed/logout" title="Log Out"><img src="/logout.png"></a> ',
[rfReplaceAll]);
if FWebServer.FActualPort = 80 then
s := s.Replace('[%host%]', FWebServer.FHost, [rfReplaceAll])
else
s := s.Replace('[%host%]', FWebServer.FHost + ':' + inttostr(FWebServer.FActualPort), [rfReplaceAll]);
if (Session <> nil) and Session.canGetUser and (Session.User <> nil) then
s := s.Replace('[%jwt%]', Session.JWTPacked, [rfReplaceAll])
else
s := s.Replace('[%jwt%]', 'JWT not available', [rfReplaceAll]);
if FWebServer.FActualSSLPort = 443 then
s := s.Replace('[%securehost%]', FWebServer.FHost, [rfReplaceAll])
else
s := s.Replace('[%securehost%]', FWebServer.FHost + ':' + inttostr(FWebServer.FActualSSLPort), [rfReplaceAll]);
// if s.Contains('[%fitbit-redirect%]') then
// s := s.Replace('[%fitbit-redirect%]', FitBitInitiate(FAuthServer.ini.ReadString(voVersioningNotApplicable, 'fitbit', 'secret', ''), // secret,
// FAuthServer.ini.ReadString(voVersioningNotApplicable, 'fitbit', 'key', ''), // key
// NewGuidId, // nonce
// 'https://local.healthintersections.com.au:961/closed/_web/fitbit.html')
// // callback
// , [rfReplaceAll]);
s := s.Replace('[%endpoints%]', EndPointDesc(secure), [rfReplaceAll]);
if variables <> nil then
for n in variables.Keys do
s := s.Replace('[%' + n + '%]', variables[n], [rfReplaceAll]);
while s.contains('[%options-reference') do
begin
StringSplit(s, '[%options-reference', p, v);
StringSplit(v, '%]', v, t);
v := getReferencesByType(v);
s := p+v+t;
end;
response.Expires := Now + 1;
response.ContentStream := TBytesStream.Create(TEncoding.UTF8.GetBytes(s));
response.FreeContentStream := true;
response.contentType := 'text/html; charset=UTF-8';
end;
procedure TFhirWebServerEndPoint.ReturnSpecFile(response: TIdHTTPResponseInfo; stated, path: String; secure : boolean);
var
src : String;
begin
if not secure and path.EndsWith('.html') then
begin
src := FWebServer.FSourceProvider.getSource(path);
if src.Contains('<!--[%requires-secure=true%]-->') then
begin
response.Expires := Now + 1;
response.Redirect(Context.FormalURLSecure+stated);
exit;
end;
end;
response.Expires := Now + 1;
response.ContentStream := FWebServer.FSourceProvider.asStream(path);
response.FreeContentStream := true;
response.contentType := GetMimeTypeForExt(ExtractFileExt(path));
end;
procedure TFhirWebServerEndPoint.cacheResponse(response: TIdHTTPResponseInfo; caching: TFHIRCacheControl);
begin
case caching of
cacheNotAtAll:
response.CacheControl := 'no-cache, no-store, must-revalidate';
cacheAsException:
response.CacheControl := 'public, max-age=600, error';
cacheNormal:
response.CacheControl := 'public, max-age=600';
cacheLong:
response.CacheControl := 'public, max-age=31536000';
end;
end;
{$IFDEF MSWINDOWS}
function TFhirWebServerEndPoint.transform1(resource: TFhirResourceV; lang, xslt: String; saveOnly: boolean): string;
var
xml: TFHIRComposer;
msx: TMsXmlParser;
b: TBytesStream;
v: variant;
doc, src: IXMLDOMDocument2;
xform: IXSLTemplate;
proc: IXSLProcessor;
url: String;
begin
// result := transform2(resource, lang, xslt);
// exit;
b := TBytesStream.Create;
try
xml := factory.makeComposer(Context.ValidatorContext.link, ffXml, lang, OutputStyleNormal);
try
xml.Compose(b, resource);
finally
xml.Free;
end;
b.Position := 0;
msx := TMsXmlParser.Create;
try
doc := msx.Parse(b);
finally
msx.Free;
end;
finally
b.Free;
end;
logt(doc.documentElement.namespaceURI + ', ' + doc.documentElement.nodeName);
v := CreateOLEObject('MSXML2.FreeThreadedDOMDocument.6.0');
src := IUnknown(TVarData(v).VDispatch) as IXMLDOMDocument2;
src.async := false;
src.resolveExternals := false;
src.validateOnParse := false;
src.setProperty('AllowDocumentFunction', true);
if not src.loadXML(FWebServer.FSourceProvider.getSource(xslt)) then
raise EXmlException.create('unable to parse XSLT: ' + src.parseError.reason);
v := CreateOLEObject('MSXML2.XSLTemplate.6.0');
xform := IUnknown(TVarData(v).VDispatch) as IXSLTemplate;
xform.stylesheet := src;
proc := xform.createProcessor;
proc.Input := doc;
proc.addParameter('useMicrosoft', 'true', '');
if FWebServer.FActualPort <> 0 then
url := 'http://' + FWebServer.FHost + ':' + inttostr(FWebServer.FActualPort)
else
url := 'https://' + FWebServer.FHost + ':' + inttostr(FWebServer.FActualSSLPort);
if saveOnly then
proc.addParameter('saveOnly', 'true', '');
proc.addParameter('expansionServer', url + FPath, '');
proc.addParameter('iconPath', url, '');
proc.addParameter('jQueryPath', url + '/js', '');
proc.Transform;
result := proc.Output;
end;
{$ENDIF}
function TFhirWebServerEndPoint.loadFromRsaDer(cert: string): TJWKList;
var
fn : String;
begin
fn := FHIR.Support.Utilities.Path([SystemTemp, TDateTimeEx.makeUTC.toString('yyyymmmddhhnnss')+'.'+inttostr(HashStringToCode32(cert))+'.cer']);
StringToFile(cert, fn, TEncoding.UTF8);
try
result := TJWKList.create;
try
result.Add(TJWTUtils.loadKeyFromRSACert(ansiString(fn)));
result.Link;
finally
result.Free;
end;
finally
DeleteFile(fn);
end;
end;
procedure TFhirWebServerEndPoint.checkRequestByJs(context: TOperationContext; request: TFHIRRequest);
begin
// js-todo - figure out which scripts to run, and then run them
end;
// procedure TFhirWebServer.ReadTags(Headers: TIdHeaderList; Request: TFHIRRequest);
// var
// i : integer;
// begin
// for i := 0 to Headers.Count - 1 do
// if Headers.Names[i] = 'Category' then
// ReadTags(Headers.Strings[i], Request);
// end;
//
Procedure TFhirWebServerEndPoint.ReadTags(header: String; request: TFHIRRequest);
// var
// s, s1, l, r, n, v : string;
// cat : TFHIRAtomCategory;
begin
// raise EFHIRException.create('todo');
end;
function TFhirWebServerEndPoint.readVersion(mt : String): TFHIRVersion;
var
i, s, p, pi,l,r : string;
begin
result := factory.version;
for i in mt.Split([',']) do
begin
s := i.Trim;
if s.StartsWith('application/fhir.r') and (s.Length > 18) then
case s[19] of
'2': exit(fhirVersionRelease2);
'3': exit(fhirVersionRelease3);
'4': exit(fhirVersionRelease4);
end
else for p in s.Split([';']) do
begin
pi := p.Trim;
StringSplit(pi, '=', l, r);
if l = 'fhir-version' then
begin
if r = 'r3' then
exit(fhirVersionRelease3)
else if r = '3.0' then
exit(fhirVersionRelease3)
else if r = '3.0.1' then
exit(fhirVersionRelease3)
else if r = 'r2' then
exit(fhirVersionRelease2)
else if r = '1.0' then
exit(fhirVersionRelease2)
else if r = '1.0.2' then
exit(fhirVersionRelease2)
else if r = 'r4' then
exit(fhirVersionRelease4)
else if r = '3.2' then
exit(fhirVersionRelease4)
else if r = '3.2.0' then
exit(fhirVersionRelease4)
end;
end;
end;
end;
function TFhirWebServerEndPoint.EndPointDesc(secure: boolean): String;
begin
result := '';
if (secure) then
begin
if FPath <> '' then
result := result + ' <li><a href="http://' + FWebServer.FHost + port(FWebServer.FActualPort, 80) + FPath + '">Unsecured access at ' + FPath +
'</a> - direct access with no security considerations</li>'#13#10;
if FWebServer.FActualSSLPort <> 0 then
result := result + ' <li><a href="' + FPath + '">Secured access at ' + FPath +
'</a> - Login required using <a href="http://fhir-docs.smarthealthit.org/argonaut-dev/authorization/">SMART-ON-FHIR</a></li>'#13#10;
end
else
begin
result := result + ' <li><a href="' + FPath + '">Unsecured access at ' + FPath +
'</a> - direct access with no security considerations</li>'#13#10;
if FPath <> '' then
result := result + ' <li><a href="https://' + FWebServer.FHost + port(FWebServer.FActualSSLPort, 443) + FPath + '">Secured access at ' + FPath +
'</a> - Login required using <a href="http://fhir-docs.smarthealthit.org/argonaut-dev/authorization/">SMART-ON-FHIR</a></li>'#13#10;
end;
end;
{ TFhirWebServer }
Constructor TFhirWebServer.Create(settings : TFHIRServerSettings; name: String);
Begin
Inherited Create;
FLock := TFslLock.Create('fhir-rest');
FThreads := TList<TAsyncTaskThread>.create;
FEndPoints := TFslList<TFhirWebServerEndpoint>.create;
FCertificateIdList := TStringList.Create;
FName := Name;
FInLog := nil;
FSettings := settings;
FClients := TFslList<TFHIRWebServerClientInfo>.Create;
FPatientViewServers := TFslStringDictionary.Create;
FGoogle := TGoogleAnalyticsProvider.Create;
// FAuthRequired := ini.ReadString('fhir', 'oauth-secure', '') = '1';
// FAppSecrets := ini.ReadString('fhir', 'oauth-secrets', '');
End;
Destructor TFhirWebServer.Destroy;
Begin
StopAsyncTasks;
FEndPoints.Free;
FSettings.Free;
FPatientViewServers.Free;
FClients.Free;
FThreads.Free;
FLock.Free;
FCertificateIdList.Free;
FSourceProvider.Free;
FInLog.Free;
FOutLog.Free;
FGoogle.Free;
Inherited;
End;
Function ProcessPath(base, path: String): string;
var
s: String;
begin
base := base.Substring(0, base.Length - 1);
if path.StartsWith('..\') then
begin
s := base;
while path.StartsWith('..\') do
begin
path := path.Substring(3);
s := ExtractFilePath(s);
s := s.Substring(0, s.Length - 1);
end;
result := IncludeTrailingPathDelimiter(s) + IncludeTrailingPathDelimiter(path);
end
else
result := IncludeTrailingPathDelimiter(path);
end;
procedure TFhirWebServer.loadConfiguration(ini : TFHIRServerIniFile);
var
fn: String;
txu: String;
begin
FJsPath := ini.admin['js-path'];
fn := ini.admin['logging-in'];
if (fn <> '') and ((fn <> '-')) then
begin
if (FolderExists('c:\temp')) then
FInLog := TLogger.Create('c:\temp\'+fn)
else
FInLog := TLogger.Create(IncludeTrailingPathDelimiter(SystemTemp)+fn);
FInLog.Policy.FullPolicy := lfpChop;
FInLog.Policy.MaximumSize := 100*1024*1024;
FInLog.Policy.AllowExceptions := false;
end;
fn := ini.admin['logging-out'];
if (fn <> '') and ((fn <> '-')) then
begin
if (FolderExists('c:\temp')) then
FOutLog := TLogger.Create('c:\temp\'+fn)
else
FOutLog := TLogger.Create(IncludeTrailingPathDelimiter(SystemTemp)+fn);
FOutLog.Policy.FullPolicy := lfpChop;
FOutLog.Policy.MaximumSize := 300*1024*1024;
FOutLog.Policy.AllowExceptions := false;
end;
// web identity / configuration
FHomePage := 'homepage.html';
FFacebookLike := ini.identityProviders['facebook.com']['like'] = 'true';
FHost := ini.web['host'];
// web server configuration
FActualPort := StrToIntDef(ini.web['http'], 0);
FActualSSLPort := StrToIntDef(ini.web['https'], 0);
FCertFile := ini.web['certname'];
FRootCertFile := ini.web['cacertname'];
FSSLPassword := ini.web['password'];
FUseOAuth := ini.web['oauth'] <> 'false';
FOWinSecuritySecure := ini.web['owin'] = 'true';
FOWinSecurityPlain := ini.web['owin-http'] = 'true';
FServeMissingCertificate := ini.web['no-cert'] = 'true';
FServeUnknownCertificate := ini.web['unknown-cert'] = 'true';
FServeMissingJWT := ini.web['no-jwt'] = 'true';
FServeUnverifiedJWT := ini.web['unverified-jwt'] = 'true';
// if ini.SectionExists(voVersioningNotApplicable, 'patient-view') then
// begin
// ts := TStringList.Create;
// try
// ini.ReadSection(voVersioningNotApplicable, 'patient-view', ts);
// for s in ts do
// FPatientViewServers.Add(s, ini.ReadString(voVersioningNotApplicable, 'patient-view', s, ''));
// finally
// ts.Free;
// end;
// end;
FOwnerName := ini.admin['ownername'];
if FOwnerName = '' then
FOwnerName := 'Health Intersections';
FAdminEmail := ini.admin['email'];
if FAdminEmail = '' then
raise EFHIRException.create('Ad admin email is required');
FHostSms := ini.admin['owner-sms'];
if FActualPort = 80 then
txu := 'http://' + FHost
else
txu := 'http://' + FHost + ':' + inttostr(FActualPort);
if ini.web['clients'] = '' then
raise EIOException.create('No Authorization file found');
FGoogle.serverId := ini.web['googleid'];
end;
procedure TFhirWebServer.DoConnect(AContext: TIdContext);
var
ci: TFHIRWebServerClientInfo;
begin
InterlockedIncrement(GCounterWebConnections);
{$IFDEF MSWINDOWS}
CoInitialize(nil);
{$ENDIF}
GJsHost := TJsHost.Create(FJsPath);
OnRegisterJs(self, GJsHost);
// GJsHost.registry := ServerContext.EventScriptRegistry.Link;
AContext.Connection.IOHandler.MaxLineLength := 100 * 1024;
FLock.Lock;
try
ci := TFHIRWebServerClientInfo.Create;
FClients.Add(ci);
AContext.Data := ci;
ci.Context := AContext;
finally
FLock.Unlock;
end;
end;
procedure TFhirWebServer.DoDisconnect(AContext: TIdContext);
begin
InterlockedDecrement(GCounterWebConnections);
FLock.Lock;
try
FClients.Remove(TFHIRWebServerClientInfo(AContext.Data));
AContext.Data := nil;
finally
FLock.Unlock;
end;
GJsHost.Free;
GJshost := nil;
{$IFDEF MSWINDOWS}
CoUninitialize;
{$ENDIF}
end;
function TFhirWebServer.DoVerifyPeer(Certificate: TIdX509; AOk: boolean; ADepth, AError: integer): boolean;
var
i: integer;
begin
result := ServeUnknownCertificate or FCertificateIdList.Find(Certificate.FingerprintAsString, i);
end;
function TFhirWebServer.encodeAsyncResponseAsJson(request : TFHIRRequest; reqUrl : String; secure : boolean; fmt : TFHIRFormat; transactionTime: TDateTimeEx; names: TStringList): string;
var
j, o : TJsonObject;
a : TJsonArray;
s : String;
begin
j := TJsonObject.Create;
try
j.str['transactionTime'] := transactionTime.toXML;
j.str['request'] := reqUrl;
j.bool['secure'] := secure;
a := j.forceArr['output'];
for s in names do
begin
o := a.addObject;
o.str['url'] := request.baseUrl+'task/'+request.id+'/'+s+EXT_WEB_TFHIRFormat[fmt];
o.str['type'] := s;
end;
result := TJSONWriter.writeObjectStr(j, true);
finally
j.Free;
end;
end;
function TFhirWebServer.EndPoint(name: String): TFhirWebServerEndpoint;
var
t : TFhirWebServerEndpoint;
begin
result := nil;
for t in FEndPoints do
if t.code = name then
exit(t);
end;
Procedure TFhirWebServer.Start(active: boolean);
Begin
logt('Start Web Server:');
if (FActualPort = 0) then
logt(' http: not active')
else
logt(' http: listen on ' + inttostr(FActualPort));
if (FActualSSLPort = 0) then
logt(' https: not active')
else
logt(' https: listen on ' + inttostr(FActualSSLPort));
FActive := active;
FStartTime := GetTickCount;
StartServer(active);
if (active) then
begin
FMaintenanceThread := TFhirServerMaintenanceThread.Create(self);
FSubscriptionThread := TFhirServerSubscriptionThread.Create(self);
FEmailThread := TFhirServerEmailThread.Create(self);
end;
smsStatus('The server ' + FHost + ' for ' + FSettings.OwnerName + ' has started');
End;
procedure TFhirWebServer.smsStatus(Msg: String);
var
client: TTwilioClient;
begin
try
client := TTwilioClient.Create;
try
client.Account := FSettings.SMSAccount;
if (client.Account <> '') and (FHostSms <> '') then
begin
client.Token := FSettings.SMSToken;
client.From := FSettings.SMSFrom;
client.dest := FHostSms;
client.Body := Msg;
client.send;
end;
finally
client.Free;
end;
except
end;
end;
Procedure TFhirWebServer.Stop;
Begin
if FActive then
smsStatus('The server ' + FHost + ' for ' + FSettings.OwnerName + ' is stopping');
if FSubscriptionThread <> nil then
FSubscriptionThread.Terminate;
if FMaintenanceThread <> nil then
FMaintenanceThread.Terminate;
if FEmailThread <> nil then
FEmailThread.Terminate;
StopServer;
End;
procedure TFhirWebServer.StopAsyncTasks;
var
task : TAsyncTaskThread;
done : boolean;
i : integer;
ep : TFhirWebServerEndpoint;
begin
done := false;
FLock.Lock;
try
for task in FThreads do
begin
task.Terminate;
done := true;
end;
finally
FLock.Unlock;
end;
if done then
begin
i := 0;
repeat
sleep(100);
inc(i);
done := true;
FLock.Lock;
try
for task in FThreads do
done := false;
finally
FLock.Unlock;
end;
until done or (i = 10);
if not done then
begin
FLock.Lock;
try
for task in FThreads do
begin
task.kill;
for ep in FEndPoints do
ep.FContext.Storage.updateAsyncTaskStatus(task.Key, atsTerminated, 'Terminated due to system shut down');
end;
finally
FLock.Unlock;
end;
end;
end;
end;
Procedure TFhirWebServer.StartServer(active: boolean);
Begin
if FActualPort > 0 then
begin
FPlainServer := TIdHTTPServer.Create(Nil);
FPlainServer.Scheduler := TIdSchedulerOfThreadPool.Create(nil);
TIdSchedulerOfThreadPool(FPlainServer.Scheduler).PoolSize := 20;
FPlainServer.ServerSoftware := 'Health Intersections FHIR Server';
FPlainServer.ParseParams := false;
FPlainServer.DefaultPort := FActualPort;
FPlainServer.KeepAlive := false;
FPlainServer.OnCreatePostStream := CreatePostStream;
FPlainServer.OnCommandGet := PlainRequest;
FPlainServer.OnCommandOther := PlainRequest;
FPlainServer.OnConnect := DoConnect;
FPlainServer.OnDisconnect := DoDisconnect;
FPlainServer.OnParseAuthentication := ParseAuthenticationHeader;
FPlainServer.active := active;
end;
if FActualSSLPort > 0 then
begin
If Not FileExists(FCertFile) Then
raise EIOException.create('SSL Certificate "' + FCertFile + ' could not be found');
If Not FileExists(ChangeFileExt(FCertFile, '.key')) Then
raise EIOException.create('SSL Certificate Private Key "' + ChangeFileExt(FCertFile, '.key') + ' could not be found');
If (FRootCertFile <> '') and (Not FileExists(FRootCertFile)) Then
raise EIOException.create('SSL Certificate "' + FRootCertFile + ' could not be found');
FSSLServer := TIdHTTPServer.Create(Nil);
FSSLServer.Scheduler := TIdSchedulerOfThreadPool.Create(nil);
TIdSchedulerOfThreadPool(FSSLServer.Scheduler).PoolSize := 20;
FSSLServer.ServerSoftware := 'Health Intersections FHIR Server';
FSSLServer.ParseParams := false;
FSSLServer.DefaultPort := FActualSSLPort;
FSSLServer.KeepAlive := false;
FSSLServer.OnCreatePostStream := CreatePostStream;
FIOHandler := TIdServerIOHandlerSSLOpenSSL.Create(Nil);
FSSLServer.IOHandler := FIOHandler;
FIOHandler.SSLOptions.Method := sslvSSLv23;
FIOHandler.SSLOptions.Mode := sslmServer;
// SSL v3 / TLS 1 required for older versions of DotNet
FIOHandler.SSLOptions.SSLVersions := [sslvSSLv3, {$IFNDEF NCTS}sslvTLSv1, {$ENDIF} sslvTLSv1_2];
FIOHandler.SSLOptions.CipherList := {$IFDEF NCTS}'ALL:!SSLv2:!DES:!RC4:!MD5:!SHA-1'{$ELSE}'ALL:!SSLv2:!DES'{$ENDIF};
FIOHandler.SSLOptions.CertFile := FCertFile;
FIOHandler.SSLOptions.KeyFile := ChangeFileExt(FCertFile, '.key');
FIOHandler.SSLOptions.RootCertFile := FRootCertFile;
if not FServeMissingCertificate then
FIOHandler.SSLOptions.VerifyMode := [sslvrfPeer, sslvrfFailIfNoPeerCert, sslvrfClientOnce]
else
FIOHandler.SSLOptions.VerifyMode := [sslvrfPeer, sslvrfClientOnce];
FIOHandler.SSLOptions.VerifyDepth := 2;
FIOHandler.OnVerifyPeer := DoVerifyPeer;
// FIOHandler.SSLOptions.
FIOHandler.OnGetPassword := SSLPassword;
FSSLServer.OnCommandGet := SecureRequest;
FSSLServer.OnCommandOther := SecureRequest;
FSSLServer.OnConnect := DoConnect;
FSSLServer.OnDisconnect := DoDisconnect;
FSSLServer.OnParseAuthentication := ParseAuthenticationHeader;
FSSLServer.active := active;
LoadEAYExtensions;
end;
end;
Procedure TFhirWebServer.StopServer;
Begin
if FSSLServer <> nil then
begin
FSSLServer.active := false;
FSSLServer.Scheduler.Free;
FreeAndNil(FSSLServer);
FreeAndNil(FIOHandler);
UnloadEAYExtensions;
end;
if FPlainServer <> nil then
begin
FPlainServer.active := false;
FPlainServer.Scheduler.Free;
FreeAndNil(FPlainServer);
end;
End;
function TFhirWebServer.WebDesc: String;
begin
if (FActualPort = 0) then
result := 'HTTPS is supported on Port ' + inttostr(FActualSSLPort) + '.'
else if FActualSSLPort = 0 then
result := 'HTTP is supported on Port ' + inttostr(FActualPort) + '.'
else
result := 'HTTPS is supported on Port ' + inttostr(FActualSSLPort) + '. HTTP is supported on Port ' + inttostr(FActualPort) + '.'
end;
function TFhirWebServer.WebDump: String;
var
b: TStringBuilder;
ci: TFHIRWebServerClientInfo;
begin
b := TStringBuilder.Create;
try
b.Append('<table>'#13#10);
b.Append('<tr><td>IP address</td><td>Count</td><td>Session</td><td>Activity</td><td>Length</td></tr>'#13#10);
FLock.Lock;
try
for ci in FClients do
begin
b.Append('<tr><td>');
b.Append(ci.Context.Binding.PeerIP);
b.Append('</td><td>');
b.Append(inttostr(ci.Count));
b.Append('</td><td>');
if (ci.Session <> nil) then
b.Append(inttostr(ci.Session.Key));
b.Append('</td><td>');
b.Append(ci.FActivity);
b.Append('</td><td>');
if ci.FStart > 0 then
b.Append(inttostr(GetTickCount - ci.FStart));
b.Append('</td></tr>'#13#10);
end;
finally
FLock.Unlock;
end;
b.Append('</table>'#13#10);
result := b.ToString;
finally
b.Free;
end;
end;
Procedure TFhirWebServer.CreatePostStream(AContext: TIdContext; AHeaders: TIdHeaderList; var VPostStream: TStream);
Begin
VPostStream := TMemoryStream.Create;
End;
procedure TFhirWebServer.ParseAuthenticationHeader(AContext: TIdContext; const AAuthType, AAuthData: String; var VUsername, VPassword: String;
var VHandled: boolean);
begin
VHandled := SameText(AAuthType, 'Bearer');
VUsername := INTERNAL_SECRET;
VPassword := AAuthData;
end;
Procedure TFhirWebServer.PlainRequest(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo);
var
id : string;
t: cardinal;
ep : TFhirWebServerEndpoint;
ok : boolean;
sp : TFHIRWebServerSourceProvider;
begin
InterlockedIncrement(GCounterWebRequests);
t := GetTickCount;
SetThreadName('WebRequest - '+request.Document);
MarkEntry(AContext, request, response);
try
id := FSettings.nextRequestId;
logRequest(false, id, request);
response.CustomHeaders.Add('X-Request-Id: '+id);
if (request.CommandType = hcOption) then
begin
response.ResponseNo := 200;
response.ContentText := 'ok';
response.CustomHeaders.Add('Access-Control-Allow-Credentials: true');
response.CustomHeaders.Add('Access-Control-Allow-Origin: *');
response.CustomHeaders.Add('Access-Control-Expose-Headers: Content-Location, Location');
response.CustomHeaders.Add('Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE');
if request.RawHeaders.Values['Access-Control-Request-Headers'] <> '' then
response.CustomHeaders.Add('Access-Control-Allow-Headers: ' + request.RawHeaders.Values['Access-Control-Request-Headers']);
end
else
begin
ok := false;
for ep in FEndPoints do
if request.Document.StartsWith(ep.path) then
begin
ok := true;
ep.PlainRequest(AContext, request, response, id);
end;
if not ok then
begin
sp := FSourceProvider;
if request.Document = '/diagnostics' then
ReturnDiagnostics(AContext, request, response, false, false)
else if sp.exists(sp.AltFile(request.Document, '/')) then
ReturnSpecFile(response, request.Document, sp.AltFile(request.Document, '/'), false)
else if request.Document = '/' then
ReturnProcessedFile(request, response, '/' + FHomePage, FSourceProvider.AltFile('/' + FHomePage, ''), false)
else
begin
response.ResponseNo := 404;
response.ContentText := 'Document ' + request.Document + ' not found';
end;
end;
end;
logResponse(id, response);
t := GetTickCount - t;
logt(id+' http: '+request.RawHTTPCommand+' from '+AContext.Binding.PeerIP+' => '+inttostr(response.ResponseNo)+' in '+inttostr(t)+'ms . mem= '+MemoryStatus);
response.CloseConnection := true;
finally
InterlockedDecrement(GCounterWebRequests);
MarkExit(AContext);
SetThreadName('');
end;
end;
Procedure TFhirWebServer.SecureRequest(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo);
var
cert: TIdX509;
id : String;
t: cardinal;
ok : boolean;
ep: TFhirWebServerEndpoint;
begin
InterlockedIncrement(GCounterWebRequests);
t := GetTickCount;
cert := (AContext.Connection.IOHandler as TIdSSLIOHandlerSocketOpenSSL).SSLSocket.PeerCert;
MarkEntry(AContext, request, response);
try
id := FSettings.nextRequestId;
logRequest(true, id, request);
response.CustomHeaders.Add('X-Request-Id: '+id);
if (request.CommandType = hcOption) then
begin
response.ResponseNo := 200;
response.ContentText := 'ok';
response.CustomHeaders.Add('Access-Control-Allow-Credentials: true');
response.CustomHeaders.Add('Access-Control-Allow-Origin: *');
response.CustomHeaders.Add('Access-Control-Expose-Headers: Content-Location, Location');
response.CustomHeaders.Add('Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE');
if request.RawHeaders.Values['Access-Control-Request-Headers'] <> '' then
response.CustomHeaders.Add('Access-Control-Allow-Headers: ' + request.RawHeaders.Values['Access-Control-Request-Headers']);
end
else
begin
ok := false;
for ep in FEndPoints do
if request.Document.StartsWith(ep.path) then
begin
ok := true;
ep.SecureRequest(AContext, request, response, cert, id);
end;
if not ok then
begin
if request.Document = '/diagnostics' then
ReturnDiagnostics(AContext, request, response, false, false)
else if request.Document = '/' then
ReturnProcessedFile(request, response, '/' + FHomePage, FSourceProvider.AltFile('/' + FHomePage, ''), true)
else
begin
response.ResponseNo := 404;
response.ContentText := 'Document ' + request.Document + ' not found';
end;
end;
end;
logResponse(id, response);
t := GetTickCount - t;
logt(id+' https: '+inttostr(t)+'ms '+request.RawHTTPCommand+' '+inttostr(t)+' for '+AContext.Binding.PeerIP+' => '+inttostr(response.ResponseNo)+'. mem= '+MemoryStatus);
if GService <> nil then
logt(GService.ThreadStatus);
finally
InterlockedDecrement(GCounterWebRequests);
MarkExit(AContext);
end;
end;
function TFhirWebServer.hasInternalSSLToken(request: TIdHTTPRequestInfo): boolean;
begin
result := false; // requesst.RawHeaders.Values[SECURE_TOKEN_HEADER] = FSecureToken;
end;
procedure TFhirWebServer.SetSourceProvider(const Value: TFHIRWebServerSourceProvider);
begin
FSourceProvider.Free;
FSourceProvider := Value;
end;
procedure TFhirWebServer.SSLPassword(var Password: String);
begin
Password := FSSLPassword;
end;
function sNow: String;
begin
result := FormatDateTime('c', Now);
end;
function TFhirWebServer.loadMultipartForm(const request: TStream; const contentType: String; var upload: boolean): TMimeMessage;
var
m: TMimeMessage;
mp: TMimePart;
begin
m := TMimeMessage.Create;
Try
m.ReadFromStream(request, contentType);
result := m;
upload := false;
for mp in m.Parts do
if SameText(mp.FileName, 'cda.zip') then
upload := true;
Except
on e: exception do
begin
m.Free;
recordStack(e);
raise;
end;
End;
end;
function isText(ct : String) : boolean;
begin
result := ct.Contains('text/') or
ct.Contains('application/fhir') or
ct.Contains('xml') or
ct.Contains('json') or
ct.Contains('turtle');
end;
procedure TFhirWebServer.logRequest(secure : boolean; id: String; request: TIdHTTPRequestInfo);
var
package : TFslBytesBuilder;
b : TBytes;
begin
if FInLog = nil then
exit;
package := TFslBytesBuilder.Create;
try
package.addUtf8('-----------------------------------------------------------------'#13#10);
package.addUtf8(id);
package.addUtf8(' @ ');
package.addUtf8(TDateTimeEx.makeUTC.toXML);
if secure then
package.addUtf8(' (https)');
package.addUtf8(#13#10);
package.addUtf8(request.RawHTTPCommand);
package.addUtf8(#13#10);
package.addUtf8(request.RawHeaders.Text);
if request.PostStream <> nil then
begin
package.addUtf8(#13#10);
SetLength(b, request.PostStream.Size);
request.PostStream.Read(b[0], length(b));
request.PostStream.Position := 0;
if isText(request.ContentType) and (request.ContentEncoding = '') then
package.Append(b)
else
package.addBase64(b);
package.addUtf8(#13#10);
end
else if request.ContentType = 'application/x-www-form-urlencoded' then
begin
package.addUtf8(#13#10);
package.addUtf8(request.UnparsedParams);
package.addUtf8(#13#10);
end;
FInLog.WriteToLog(package.AsBytes);
finally
package.Free;
end;
end;
procedure TFhirWebServer.logResponse(id: String; resp: TIdHTTPResponseInfo);
procedure log(msg : String);
var
package : TFslBytesBuilder;
b : TBytes;
begin
package := TFslBytesBuilder.Create;
try
package.addUtf8('-----------------------------------------------------------------'#13#10);
package.addUtf8(id);
package.addUtf8(' @ ');
package.addUtf8(TDateTimeEx.makeUTC.toXML);
if (msg <> '') then
package.addUtf8(' '+msg);
package.addUtf8(#13#10);
package.addUtf8(inttostr(resp.ResponseNo)+' '+resp.ResponseText);
package.addUtf8(#13#10);
package.addUtf8(resp.RawHeaders.Text);
if resp.ContentStream <> nil then
begin
package.addUtf8(#13#10);
SetLength(b, resp.ContentStream.Size);
if (length(b) > 0) then
resp.ContentStream.Read(b[0], length(b));
resp.ContentStream.Position := 0;
if isText(resp.ContentType) and (resp.ContentEncoding = '') then
package.Append(b)
else
package.addBase64(b);
package.addUtf8(#13#10);
end
else if resp.ContentText <> '' then
begin
package.addUtf8(#13#10);
package.addUtf8(resp.ContentText);
package.addUtf8(#13#10);
end;
FOutLog.WriteToLog(package.AsBytes);
finally
package.Free;
end;
end;
begin
if FOutLog = nil then
exit;
try
resp.WriteHeader;
log('');
except
on e : exception do
begin
log(e.Message);
raise;
end;
end;
end;
procedure TFhirWebServer.MarkEntry(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo);
var
ci: TFHIRWebServerClientInfo;
begin
ci := TFHIRWebServerClientInfo(AContext.Data);
FLock.Lock;
try
ci.Activity := request.Command + ' ' + request.Document + '?' + request.UnparsedParams;
ci.Count := ci.Count + 1;
inc(FTotalCount);
ci.FStart := GetTickCount;
finally
FLock.Unlock;
end;
end;
procedure TFhirWebServer.MarkExit(AContext: TIdContext);
var
ci: TFHIRWebServerClientInfo;
begin
ci := TFHIRWebServerClientInfo(AContext.Data);
FLock.Lock;
try
ci.Activity := '';
inc(FTotalTime, GetTickCount - ci.FStart);
ci.FStart := 0;
finally
FLock.Unlock;
end;
end;
function TFhirWebServer.extractFileData(lang : String; form: TMimeMessage; const name: String; var sContentType: String): TStream;
var
sLeft, sRight: String;
iLoop: integer;
oPart: TMimePart;
sHeader: String;
sName: String;
sFilename: String;
sContent: String;
begin
result := nil;
For iLoop := 0 To form.Parts.Count - 1 Do
Begin
oPart := form.Parts[iLoop];
sHeader := oPart.ContentDisposition;
StringSplit(sHeader, ';', sLeft, sHeader);
If trim(sLeft) = 'form-data' Then
Begin
StringSplit(trim(sHeader), ';', sLeft, sHeader);
StringSplit(trim(sLeft), '=', sLeft, sRight);
If trim(sLeft) = 'name' Then
sName := RemoveQuotes(trim(sRight));
StringSplit(trim(sHeader), '=', sLeft, sRight);
If trim(sLeft) = 'filename' Then
sFilename := RemoveQuotes(trim(sRight));
If (result = nil) and (sName <> '') And (sFilename <> '') And (oPart.content.Size > 0) Then
begin
result := TBytesStream.Create(oPart.content.AsBytes);
sContentType := oPart.Mediatype;
end
else if (result = nil) and (sName = 'src') then
begin
sContent := BytesAsString(oPart.content.AsBytes);
result := TStringStream.Create(oPart.content.AsBytes); // trim
if StringStartsWith(sContent, '<', false) then
sContentType := 'application/fhir+xml'
else if StringStartsWith(sContent, '{', false) then
sContentType := 'application/fhir+json'
else
raise EFHIRException.CreateLang('FORMAT_UNRECOGNIZED', lang, [sContent]);
end;
End
End;
end;
Constructor ERestfulAuthenticationNeeded.Create(Const sContext : String; sMessage, sCaption, lang : String);
begin
inherited Create(sContext, HTTP_ERR_UNAUTHORIZED, itLogin, sMessage, lang);
FMsg := sCaption;
end;
procedure TFhirWebServer.convertFromVersion(stream: TStream; format : TFHIRFormat; version: TFHIRVersion; lang : String);
var
b : TBytes;
begin
{$IfDEF NO_CONVERSION}
raise EFHIRException.create('Version Conversion Services are not made available on this server');
{$ELSE}
b := StreamToBytes(stream);
b := TFhirVersionConvertors.convertResource(b, format, OutputStyleNormal, lang, version, CURRENT_FHIR_VERSION);
stream.Size := 0;
stream.Write(b, 0, length(b));
stream.Position := 0;
{$ENDIF}
end;
procedure TFhirWebServer.convertToVersion(stream: TStream; format : TFHIRFormat; version: TFHIRVersion; lang : String);
var
b : TBytes;
begin
{$IfDEF NO_CONVERSION}
raise EFHIRException.create('Version Conversion Services are not made available on this server');
{$ELSE}
b := StreamToBytes(stream);
b := TFhirVersionConvertors.convertResource(b, format, OutputStyleNormal, lang, CURRENT_FHIR_VERSION, version);
stream.Size := 0;
stream.Write(b, 0, length(b));
stream.Position := 0;
{$ENDIF}
end;
procedure TFhirWebServer.RecordExchange(req: TFHIRRequest; resp: TFHIRResponse; e: exception);
//var
// op: TFhirTestScriptSetupActionOperation;
begin
// if req.Session = nil then
// exit;
// if req.Session.TestScript = nil then
// exit;
// op := TFhirTestScriptSetupActionOperation.Create;
// req.Session.TestScript.testList.Append.actionList.Append.operation := op;
// if req.CommandType = fcmdOperation then
// op.type_ := TFHIRCoding.Create('http://hl7.org/fhir/testscript-operation-codes', req.OperationName)
// else
// op.type_ := TFHIRCoding.Create('http://hl7.org/fhir/testscript-operation-codes', CODES_TFHIRCommandType[req.CommandType].ToLower);
// op.resourceElement := TFhirCode.Create(req.ResourceName);
// if resp.format = ffJson then
// op.Accept := !{$IFDEF FHIR4} 'application/fhir+json'{$ELSE}ContentTypeJson{$ENDIF}
// else
// op.Accept := !{$IFDEF FHIR4} 'application/fhir+xml'{$ELSE}ContentTypeXml{$ENDIF};
// op.params := req.Parameters.Source;
// op.requestHeaderList.Add('Host', req.baseUrl);
// op.requestHeaderList.Add('Content-Type', MIMETYPES_TFHIRFormat[req.PostFormat]);
// if (req.lastModifiedDate <> 0) then
// op.requestHeaderList.Add('Last-Modified', DateTimeToXMLDateTimeTimeZoneString(req.lastModifiedDate, TimeZoneBias));
// op.requestHeaderList.Add('Language', req.lang);
// op.requestHeaderList.Add('if-match', req.IfMatch);
// op.requestHeaderList.Add('if-none-match', req.IfNoneMatch);
// if (req.IfModifiedSince <> 0) then
// op.requestHeaderList.Add('if-modified-since', DateTimeToXMLDateTimeTimeZoneString(req.IfModifiedSince, TimeZoneBias));
// op.requestHeaderList.Add('if-none-exist', req.IfNoneExist);
// if req.provenance <> nil then
// op.requestHeaderList.Add('X-Provenance', ComposeJson(FServerContext.ValidatorContext, req.provenance));
// op.url := req.url;
end;
function TFhirWebServer.registerEndPoint(code, path: String; context: TFHIRServerContext; ini : TFHIRServerIniFile): TFhirWebServerEndpoint;
begin
result := TFhirWebServerEndpoint.create(code, path, self, context);
FEndPoints.Add(result);
context.userProvider.OnProcessFile := result.ReturnProcessedFile;
result.FAuthServer := TAuth2Server.Create(context.Factory.link, ini, FHost, inttostr(sslPort), path);
result.FAuthServer.UserProvider := context.userProvider.Link;
result.FAuthServer.ServerContext := context.Link;
result.FAuthServer.EndPoint := result.ClientAddress(true);
result.FAuthServer.OnProcessFile := result.ReturnProcessedFile;
result.FAuthServer.OnGetPatients := result.GetPatients;
result.FAuthServer.Active := true;
context.JWTServices := TJWTServices.Create;
context.JWTServices.Cert := FCertFile;
context.JWTServices.Password := FSSLPassword;
context.JWTServices.DatabaseId := context.DatabaseId;
context.JWTServices.Host := FHost;
// context.JWTServices.JWKAddress := ?;
end;
procedure TFhirWebServer.ReturnDiagnostics(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; ssl, secure: boolean);
var
vars: TFslStringDictionary;
ep : TFhirWebServerEndpoint;
begin
vars := TFslStringDictionary.Create;
try
vars.Add('status.db', FormatTextToHTML(KDBManagers.dump));
vars.Add('live.connections', inttostr(GCounterWebConnections));
vars.Add('live.requests', inttostr(GCounterWebRequests));
vars.Add('live.requests.kernel', inttostr(GCounterFHIRRequests));
vars.Add('status.locks', FormatTextToHTML(DumpLocks));
vars.Add('status.thread.maintenance', FSettings.MaintenanceThreadStatus);
vars.Add('status.thread.subscriptions', FSettings.SubscriptionThreadStatus);
vars.Add('status.thread.email', FSettings.EmailThreadStatus);
for ep in FEndPoints do
begin
vars.Add('status.'+ep.Code+'.sessions', ep.FContext.SessionManager.DumpSessions);
vars.Add('status.'+ep.Code+'.tx', ep.FContext.TerminologyServer.Summary);
vars.Add('status.'+ep.Code+'.cdsclient', inttostr(ep.FPatientHooks.Count));
end;
vars.Add('status.web', WebDump);
vars.Add('status.web-total-count', inttostr(FTotalCount));
vars.Add('status.web-rest-count', inttostr(FRestCount));
vars.Add('status.web-total-time', inttostr(FTotalTime));
vars.Add('status.web-rest-time', inttostr(FRestTime));
vars.Add('status.run-time', DescribePeriod((GetTickCount - FStartTime) * DATETIME_MILLISECOND_ONE));
vars.Add('status.run-time.ms', inttostr(GetTickCount - FStartTime));
ReturnProcessedFile(request, response, 'Diagnostics', FSourceProvider.AltFile('/diagnostics.html', ''), false, vars);
finally
vars.Free;
end;
end;
procedure TFhirWebServer.ReturnProcessedFile(request : TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; path: String; secure: boolean; variables: TFslStringDictionary = nil);
begin
ReturnProcessedFile(request, response, path, path, secure, variables);
end;
function TFhirWebServer.endpointList : String;
var
b : TStringBuilder;
ep : TFhirWebServerEndpoint;
begin
b := TStringBuilder.create;
try
b.append('<ul>');
for ep in FEndPoints do
b.Append('<li><a href="/'+ep.FPath+'">'+ep.FPath+'</a>: v'+ep.factory.versionString+'</li>');
b.append('</ul>');
result := b.toString;
finally
b.free;
end;
end;
procedure TFhirWebServer.ReturnProcessedFile(request : TIdHTTPRequestInfo; response: TIdHTTPResponseInfo; claimed, actual: String; secure: boolean; variables: TFslStringDictionary = nil);
var
s, n: String;
begin
logt('script: ' + claimed);
s := FSourceProvider.getSource(actual);
s := s.Replace('[%id%]', FName, [rfReplaceAll]);
s := s.Replace('[%specurl%]', 'http://hl7.org/fhir', [rfReplaceAll]);
s := s.Replace('[%web%]', WebDesc, [rfReplaceAll]);
s := s.Replace('[%admin%]', FAdminEmail, [rfReplaceAll]);
s := s.Replace('[%logout%]', 'User: [n/a]', [rfReplaceAll]);
s := s.Replace('[%endpoints%]', endpointList, [rfReplaceAll]);
if FActualPort = 80 then
s := s.Replace('[%host%]', FHost, [rfReplaceAll])
else
s := s.Replace('[%host%]', FHost + ':' + inttostr(FActualPort), [rfReplaceAll]);
if FActualSSLPort = 443 then
s := s.Replace('[%securehost%]', FHost, [rfReplaceAll])
else
s := s.Replace('[%securehost%]', FHost + ':' + inttostr(FActualSSLPort), [rfReplaceAll]);
// if s.Contains('[%fitbit-redirect%]') then
// s := s.Replace('[%fitbit-redirect%]', FitBitInitiate(FAuthServer.ini.ReadString(voVersioningNotApplicable, 'fitbit', 'secret', ''), // secret,
// FAuthServer.ini.ReadString(voVersioningNotApplicable, 'fitbit', 'key', ''), // key
// NewGuidId, // nonce
// 'https://local.healthintersections.com.au:961/closed/_web/fitbit.html')
// // callback
// , [rfReplaceAll]);
// s := s.Replace('[%endpoints%]', EndPointDesc(secure), [rfReplaceAll]);
if variables <> nil then
for n in variables.Keys do
s := s.Replace('[%' + n + '%]', variables[n], [rfReplaceAll]);
response.Expires := Now + 1;
response.ContentStream := TBytesStream.Create(TEncoding.UTF8.GetBytes(s));
response.FreeContentStream := true;
response.contentType := 'text/html; charset=UTF-8';
end;
procedure TFhirWebServer.ReturnSpecFile(response: TIdHTTPResponseInfo; stated, path: String; secure: boolean);
begin
response.Expires := Now + 1;
response.ContentStream := SourceProvider.asStream(path);
response.FreeContentStream := true;
response.contentType := GetMimeTypeForExt(ExtractFileExt(path));
end;
procedure TFhirWebServer.ReverseProxy(proxy: TReverseProxyInfo; AContext: TIdContext; request: TIdHTTPRequestInfo; Session: TFHIRSession; response: TIdHTTPResponseInfo; secure: boolean);
var
client: TReverseClient;
begin
client := TReverseClient.Create;
try
client.proxy := proxy.link;
client.Context := AContext;
client.request := request;
client.response := response;
// if secure then
// client.SecureToken := FSecureToken;
client.Execute;
finally
client.Free;
end;
end;
// procedure TFhirWebServer.DoSendFHIR(iMsgKey, SrcID: Integer; request: TFHIRRequest; response: TFHIRResponse);
// var
// client : TFhirHTTPClient;
// begin
// client := TFhirHTTPClient.create(FBaseURL, false);
// try
// FClientLock.Lock('MakeClient');
// Try
// FClients.Add(client);
// Finally
// FClientLock.Unlock;
// End;
// try
// if (request.CommandType = fcmdUpdate) and (request.id = '') then
// request.id := 'test';
//
// client.doRequest(request, response);
// finally
// FClientLock.Lock('CloseClient');
// Try
// FClients.Remove(client);
// Finally
// FClientLock.Unlock;
// End;
// end;
// finally
// client.free;
// end;
// end;
//
{ TFHIRWebServerClientInfo }
destructor TFHIRWebServerClientInfo.Destroy;
begin
FSession.Free;
inherited;
end;
procedure TFHIRWebServerClientInfo.SetSession(const Value: TFHIRSession);
begin
FSession.Free;
FSession := Value;
end;
{ TFHIRWebServerPatientViewContext }
constructor TFHIRWebServerPatientViewContext.Create(context : TFHIRServerContext);
begin
inherited Create;
FContext := context;
FCards := TFslList<TCDSHookCard>.Create;
FErrors := TStringList.Create;
end;
destructor TFHIRWebServerPatientViewContext.Destroy;
begin
FContext.Free;
FErrors.Free;
FCards.Free;
FManager.Free;
inherited;
end;
procedure TFHIRWebServerPatientViewContext.SetManager(const Value: TCDSHooksManager);
begin
FManager.Free;
FManager := Value;
end;
{ TFhirServerMaintenanceThread }
constructor TFhirServerMaintenanceThread.Create(server: TFhirWebServer);
begin
FreeOnTerminate := true;
FServer := server;
FLastSweep := Now;
inherited Create;
end;
procedure TFhirServerMaintenanceThread.Execute;
var
ep : TFhirWebServerEndpoint;
begin
SetThreadName('Server Maintenance Thread');
logt('Starting TFhirServerMaintenanceThread');
try
FServer.FSettings.MaintenanceThreadStatus := 'starting';
{$IFDEF MSWINDOWS}
CoInitialize(nil);
{$ENDIF}
GJsHost := TJsHost.Create(FServer.FJsPath);
FServer.OnRegisterJs(self, GJsHost);
// GJsHost.registry := FServer.ServerContext.EventScriptRegistry.Link;
repeat
FServer.Settings.MaintenanceThreadStatus := 'sleeping';
sleep(1000);
if not terminated and (FLastSweep < Now - (DATETIME_SECOND_ONE * 5)) then
begin
try
FServer.Settings.MaintenanceThreadStatus := 'Sweeping Sessions';
for ep in FServer.FEndPoints do
ep.FContext.Storage.Sweep;
if not FServer.settings.ForLoad then
FServer.FGoogle.commit;
except
end;
FLastSweep := Now;
end;
if not FServer.settings.ForLoad then
begin
if (not terminated) then
try
FServer.Settings.MaintenanceThreadStatus := 'Building Indexes';
for ep in FServer.FEndPoints do
ep.FContext.TerminologyServer.BuildIndexes(false);
except
end;
end;
if (not terminated) then
try
FServer.Settings.MaintenanceThreadStatus := 'Processing Observations';
for ep in FServer.FEndPoints do
ep.FContext.Storage.ProcessObservations;
except
end;
if (not terminated) then
try
FServer.Settings.MaintenanceThreadStatus := 'Checking Async Tasks';
for ep in FServer.FEndPoints do
ep.CheckAsyncTasks;
except
end;
until terminated;
try
FServer.Settings.MaintenanceThreadStatus := 'dead';
except
end;
try
FServer.FMaintenanceThread := nil;
except
end;
GJsHost.Free;
GJsHost := nil;
{$IFDEF MSWINDOWS}
CoUninitialize;
{$ENDIF}
logt('Ending TFhirServerMaintenanceThread');
except
logt('Failing TFhirServerMaintenanceThread');
end;
SetThreadName('');
end;
{ TFhirServerSubscriptionThread }
constructor TFhirServerSubscriptionThread.Create(server: TFhirWebServer);
begin
FreeOnTerminate := true;
FServer := server;
inherited Create;
end;
procedure TFhirServerSubscriptionThread.Execute;
var
ep : TFhirWebServerEndpoint;
begin
SetThreadName('Server Subscription Thread');
GJsHost := TJsHost.Create(FServer.FJsPath);
FServer.OnRegisterJs(self, GJsHost);
// GJsHost.registry := FServer.ServerContext.EventScriptRegistry.Link;
logt('Starting TFhirServerSubscriptionThread');
try
FServer.Settings.SubscriptionThreadStatus := 'starting';
repeat
FServer.Settings.SubscriptionThreadStatus := 'sleeping';
sleep(1000);
if FServer.FActive then
begin
FServer.Settings.SubscriptionThreadStatus := 'processing subscriptions';
for ep in FServer.FEndPoints do
ep.FContext.Storage.ProcessSubscriptions;
end;
until terminated;
try
FServer.Settings.SubscriptionThreadStatus := 'dead';
except
end;
try
FServer.FSubscriptionThread := nil;
except
end;
logt('Ending TFhirServerSubscriptionThread');
except
logt('Failing TFhirServerSubscriptionThread');
end;
GJsHost.Free;
GJsHost := nil;
SetThreadName('');
end;
{ TFhirServerEmailThread }
constructor TFhirServerEmailThread.Create(server: TFhirWebServer);
begin
FreeOnTerminate := true;
FServer := server;
inherited Create;
end;
procedure TFhirServerEmailThread.Execute;
var
i: integer;
ep : TFhirWebServerEndpoint;
begin
SetThreadName('Server Email Thread');
GJsHost := TJsHost.Create(FServer.FJsPath);
FServer.OnRegisterJs(self, GJsHost);
// GJsHost.registry := FServer.ServerContext.EventScriptRegistry.Link;
logt('Starting TFhirServerEmailThread');
try
FServer.Settings.EmailThreadStatus := 'starting';
repeat
FServer.Settings.EmailThreadStatus := 'sleeping';
i := 0;
while not terminated and (i < 60) do
begin
sleep(1000);
inc(i);
end;
if FServer.FActive and not terminated then
begin
FServer.Settings.EmailThreadStatus := 'processing Emails';
for ep in FServer.FEndPoints do
ep.FContext.Storage.ProcessEmails;
end;
until terminated;
try
FServer.Settings.EmailThreadStatus := 'dead';
except
end;
try
FServer.FEmailThread := nil;
except
end;
logt('Ending TFhirServerEmailThread');
except
logt('Failing TFhirServerEmailThread');
end;
GJsHost.Free;
GJsHost := nil;
SetThreadName('');
end;
type
TFHIRBundleBuilderNDJson = class (TFHIRBundleBuilder)
private
FFileBase : String;
FFiles : TFslMap<TFslFile>;
function fileForType(rType : String) : TFslFile;
procedure writeResource(res : TFHIRResourceV); overload;
procedure writeResource(rType : String; cnt : TFslBuffer); overload;
public
constructor Create(factory : TFHIRFactory; bundle : TFHIRBundleW; fileBase : String; files : TFslMap<TFslFile>);
destructor Destroy; override;
procedure addEntry(entry : TFhirBundleEntryW; first : boolean); override;
function moveToFirst(res : TFhirResourceV) : TFhirBundleEntryW; override;
function getBundle : TFHIRResourceV; override;
end;
{ TFHIRBundleBuilderNDJson }
constructor TFHIRBundleBuilderNDJson.Create(factory : TFHIRFactory; bundle: TFHIRBundleW; fileBase: String; files : TFslMap<TFslFile>);
begin
inherited Create(factory, bundle);
FFileBase := fileBase;
FFiles := files;
end;
destructor TFHIRBundleBuilderNDJson.Destroy;
begin
writeResource(FBundle.Resource);
Ffiles.Free;
inherited;
end;
function TFHIRBundleBuilderNDJson.fileForType(rType: String): TFslFile;
begin
if not FFiles.TryGetValue(rType, result) then
begin
result := TFslFile.Create(FFileBase+'-'+rType+'.ndjson', fmCreate);
FFiles.Add(rType, result);
end;
end;
procedure TFHIRBundleBuilderNDJson.addEntry(entry: TFhirBundleEntryW; first : boolean);
begin
if (entry.resource.Tag <> nil) and (entry.resource.Tag is TFslBuffer) then
writeResource(entry.Tags['type'], entry.Tag as TFslBuffer)
else if entry.resource <> nil then
writeResource(entry.resource);
entry.Tag := nil;
entry.resource := nil;
FBundle.addEntry(entry, first);
end;
function TFHIRBundleBuilderNDJson.getBundle: TFHIRResourceV;
begin
result := nil; // although we have bundle internally, we don't return it directly (only use ND-JSON is asymc mode, and return a list of files)
end;
function TFHIRBundleBuilderNDJson.moveToFirst(res: TFhirResourceV): TFhirBundleEntryW;
begin
raise EFHIRException.create('Not done yet');
end;
procedure TFHIRBundleBuilderNDJson.writeResource(res: TFHIRResourceV);
var
f : TFslFile;
json : TFHIRComposer;
b : ansichar;
begin
f := fileForType(res.fhirType);
if f.Size > 0 then
begin
b := #10;
f.Write(b, 1);
end;
json := FFactory.makeComposer(nil, ffJson, 'en', OutputStyleNormal);
try
json.Compose(f, res);
finally
json.Free;
end;
end;
procedure TFHIRBundleBuilderNDJson.writeResource(rType: String; cnt: TFslBuffer);
var
f : TFslFile;
b : ansiChar;
begin
f := fileForType(rType);
if f.Size > 0 then
begin
b := #10;
f.Write(b, 1);
end;
cnt.SaveToStream(f);
end;
{ TAsyncTaskThread }
procedure TAsyncTaskThread.callback(IntParam: Integer; StrParam: String);
begin
status(atsProcessing, StrParam);
end;
constructor TAsyncTaskThread.Create;
begin
inherited Create(true); // suspended
end;
destructor TAsyncTaskThread.Destroy;
begin
Files.free;
FRequest.Free;
FServer.Free;
FBundle.Free;
inherited;
end;
procedure TAsyncTaskThread.details;
begin
if FBundle <> nil then
FServer.Context.Storage.setAsyncTaskDetails(key, FBundle.timestamp, Fbundle.Links['self']);
end;
procedure TAsyncTaskThread.doGetBundleBuilder(request : TFHIRRequest; context: TFHIRResponse; aType: TBundleType; out builder: TFhirBundleBuilder);
begin
FBundle := FServer.factory.wrapBundle(fserver.factory.makeResource('Bundle'));
FBundle.type_ := aType;
if context.Format = ffNDJson then
begin
files := TFslMap<TFslFile>.create;
builder := TFHIRBundleBuilderNDJson.Create(FServer.factory.link, FBundle.link, IncludeTrailingPathDelimiter(FServer.Context.TaskFolder)+'task-'+inttostr(FKey), files.link)
end
else
builder := TFHIRBundleBuilderSimple.Create(FServer.factory.link, FBundle.link);
end;
procedure TAsyncTaskThread.Execute;
var
response : TFHIRResponse;
op: TFHIROperationEngine;
t: cardinal;
us, cs: String;
ctxt : TOperationContext;
begin
t := 0;
SetThreadName('Server Async Thread');
GJsHost := TJsHost.Create(FServer.FWebServer.FJsPath);
try
FServer.FWebServer.OnRegisterJs(self, GJsHost);
status(atsWaiting, 'Waiting to start');
sleep(100);
response := TFHIRResponse.Create(FServer.Context.ValidatorContext.link);
try
response.format := FFormat;
response.OnCreateBuilder := doGetBundleBuilder;
t := GetTickCount;
if request.Session = nil then // during OAuth only
us := 'user=(in-oauth)'
else
us := 'user=' + request.Session.UserName;
if request.CommandType = fcmdOperation then
cs := '$' + request.OperationName
else
cs := 'cmd=' + CODES_TFHIRCommandType[request.CommandType];
status(atsProcessing, 'Processing');
logt('Start Task ('+inttostr(key)+'): ' + cs + ', type=' + request.ResourceName + ', id=' + request.id + ', ' + us + ', params=' + request.Parameters.Source);
op := FServer.Context.Storage.createOperationContext(request.lang);
try
op.OnPopulateConformance := FServer.PopulateConformance;
ctxt := TOperationContext.create(false, callback, 'starting');
try
op.Execute(ctxt, request, response);
finally
ctxt.Free;
end;
FServer.Context.Storage.yield(op, nil);
except
on e: exception do
begin
FServer.Context.Storage.yield(op, e);
raise;
end;
end;
details;
saveOutcome(response);
status(atsComplete, 'Complete');
t := GetTickCount - t;
logt('Finish Task ('+inttostr(key)+'): ' + cs + ', type=' + request.ResourceName + ', id=' + request.id + ', ' + us + ', params=' + request.Parameters.Source + '. rt = ' + inttostr(t)+'ms');
finally
response.Free;
end;
except
on e : exception do
begin
logt('Error Task ('+inttostr(key)+'): ' + cs + ', type=' + request.ResourceName + ', id=' + request.id + ', ' + us + ', params=' + request.Parameters.Source + '. rt = ' + inttostr(t)+'ms: '+e.Message);
status(atsError, e.Message);
end;
end;
FServer.FWebServer.FLock.Lock;
try
FServer.FWebServer.FThreads.Remove(self);
finally
FServer.FWebServer.FLock.Unlock;
end;
FreeOnTerminate := true;
GJsHost.Free;
GJsHost := nil;
SetThreadName('');
end;
procedure TAsyncTaskThread.kill;
begin
TerminateThread(ThreadHandle, 1);
end;
procedure TAsyncTaskThread.saveOutcome;
var
names : TStringList;
f : TFileStream;
n : String;
c : TFHIRComposer;
begin
names := TStringList.Create;
try
if files = nil then
begin
names.Add('content');
f := TFileStream.Create(Path([FServer.Context.TaskFolder, 'task-'+inttostr(key)+'-content'+EXT_WEB_TFHIRFormat[format]]), fmCreate);
try
if fFormat = ffNDJson then
c := FServer.factory.makeComposer(fserver.Context.ValidatorContext.link, ffJson, 'en', OutputStyleNormal)
else
c := FServer.factory.makeComposer(fserver.Context.ValidatorContext.link, Format, 'en', OutputStyleNormal);
try
c.Compose(f, response.Resource);
finally
c.Free;
end;
finally
f.Free;
end;
end
else
begin
for n in files.Keys do
names.Add(n);
files.Clear;
end;
FServer.Context.Storage.MarkTaskForDownload(key, names);
finally
names.Free;
end;
end;
procedure TAsyncTaskThread.SetRequest(const Value: TFHIRRequest);
begin
FRequest.Free;
FRequest := Value;
end;
procedure TAsyncTaskThread.SetServer(const Value: TFhirWebServerEndPoint);
begin
FServer.Free;
FServer := Value;
end;
procedure TAsyncTaskThread.status(status: TAsyncTaskStatus; message: String);
begin
FServer.Context.Storage.updateAsyncTaskStatus(key, status, message);
end;
Initialization
IdSSLOpenSSLHeaders.Load;
End.
| 37.870017 | 370 | 0.667114 |
47d6073335cbbc794d3c1f050b0308d357be88a5 | 464 | pas | Pascal | lazproj/dexeddesigncontrols.pas | mindfocus/dexed | 74ff4edd7265c7835d9b157997f221203c0f50cc | [
"BSL-1.0"
]
| 22 | 2019-10-17T12:47:02.000Z | 2020-06-06T11:51:02.000Z | lazproj/dexeddesigncontrols.pas | mindfocus/dexed | 74ff4edd7265c7835d9b157997f221203c0f50cc | [
"BSL-1.0"
]
| 6 | 2019-10-18T03:54:31.000Z | 2020-09-09T13:01:33.000Z | lazproj/dexeddesigncontrols.pas | mindfocus/dexed | 74ff4edd7265c7835d9b157997f221203c0f50cc | [
"BSL-1.0"
]
| 5 | 2019-11-06T08:21:55.000Z | 2020-11-07T00:28:25.000Z | { This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package.
}
unit DexedDesignControls;
{$warn 5023 off : no warning about unused units}
interface
uses
u_dsgncontrols, LazarusPackageIntf;
implementation
procedure Register;
begin
RegisterUnit('u_dsgncontrols', @u_dsgncontrols.Register);
end;
initialization
RegisterPackage('DexedDesignControls', @Register);
end.
| 20.173913 | 63 | 0.75 |
f17812c59c217c0bb9d9cf8173ecaf748bc8fd70 | 777 | pas | Pascal | sample/URecordManagerView.pas | walwalwalides/glue | c67de39e9fbf944927b3fab43ea1e694f2b6879a | [
"Apache-2.0"
]
| 10 | 2018-03-25T20:49:47.000Z | 2021-06-28T02:34:02.000Z | sample/URecordManagerView.pas | walwalwalides/glue | c67de39e9fbf944927b3fab43ea1e694f2b6879a | [
"Apache-2.0"
]
| 1 | 2020-04-11T00:11:16.000Z | 2020-04-11T00:11:16.000Z | sample/URecordManagerView.pas | msnts/glue | be3347cde05e45a28438cc3bbcb82989c9dc257f | [
"Apache-2.0"
]
| 4 | 2017-07-03T13:53:59.000Z | 2020-04-10T22:44:45.000Z | unit URecordManagerView;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, Vcl.StdCtrls, Vcl.Grids,
Vcl.DBGrids, Glue, Glue.Attributes;
type
[ViewModel('URecordManagerViewModel.TRecordManagerViewModel')]
TRecordManagerView = class(TForm)
DBGrid1: TDBGrid;
DataSource1: TDataSource;
[Command('OnAddClick')]
BtnAdd: TButton;
BtnEdit: TButton;
BtnDelete: TButton;
private
{ Private declarations }
public
{ Public declarations }
end;
var
RecordManagerView: TRecordManagerView;
implementation
{$R *.dfm}
initialization
TGlue.RegisterType(TRecordManagerView, 'FrmManager');
end.
| 21 | 99 | 0.707851 |
fcb2f1ccd5c4c139a0a37474f23dda45c8b2d531 | 81,403 | pas | Pascal | Source/rmkThemes/TBXAthenTheme.pas | sharov-artem/TBX | 4982cf02765672376ae887711b8820d63a0d71af | [
"MIT"
]
| 42 | 2015-02-02T22:39:21.000Z | 2022-01-19T15:28:20.000Z | Source/rmkThemes/TBXAthenTheme.pas | sharov-artem/TBX | 4982cf02765672376ae887711b8820d63a0d71af | [
"MIT"
]
| 16 | 2019-02-02T19:54:54.000Z | 2019-02-28T05:22:36.000Z | Source/rmkThemes/TBXAthenTheme.pas | sharov-artem/TBX | 4982cf02765672376ae887711b8820d63a0d71af | [
"MIT"
]
| 14 | 2015-06-17T07:40:11.000Z | 2020-12-17T06:34:49.000Z | {*
* "Athen" Theme for TBX
* Copyright 2004-2013 Roy Magne Klever. All rights reserved.
*
* The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom
* the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*}
unit TBXAthenTheme;
interface
uses
Windows, Messages, Graphics, TBXThemes, ImgList;
{$DEFINE ALTERNATIVE_DISABLED_STYLE} // remove the asterisk to change appearance of disabled images
type
TItemPart = (ipBody, ipText, ipFrame);
TBtnItemState = (bisNormal, bisDisabled, bisSelected, bisPressed, bisHot,
bisDisabledHot, bisSelectedHot, bisPopupParent);
TMenuItemState = (misNormal, misDisabled, misHot, misDisabledHot);
TWinFramePart = (wfpBorder, wfpCaption, wfpCaptionText);
TWinFrameState = (wfsActive, wfsInactive);
TTBXAthenTheme = class(TTBXTheme)
private
procedure TBXSysCommand(var Message: TMessage); message TBX_SYSCOMMAND;
protected
{ View/Window Colors }
MenubarColor: TColor;
ToolbarColor: TColor;
PopupColor: TColor;
DockPanelColor: TColor;
PopupFrameColor: TColor;
WinFrameColors: array[TWinFrameState, TWinFramePart] of TColor;
PnlFrameColors: array[TWinFrameState, TWinFramePart] of TColor;
MenuItemColors: array[TMenuItemState, TItemPart] of TColor;
BtnItemColors: array[TBtnItemState, TItemPart] of TColor;
{ Other Colors }
DragHandleColor: TColor;
PopupSeparatorColor: TColor;
ToolbarSeparatorColor: TColor;
IconShadowColor: TColor;
StatusPanelFrameColor: TColor;
procedure SetupColorCache; virtual;
protected
{ Internal Methods }
function GetPartColor(const ItemInfo: TTBXItemInfo; ItemPart: TItemPart):
TColor;
function GetBtnColor(const ItemInfo: TTBXItemInfo; ItemPart: TItemPart):
TColor;
public
constructor Create(const AName: string); override;
destructor Destroy; override;
{ Metrics access}
function GetBooleanMetrics(Index: Integer): Boolean; override;
function GetImageOffset(Canvas: TCanvas; const ItemInfo: TTBXItemInfo;
ImageList: TCustomImageList): TPoint; override;
function GetIntegerMetrics(Index: Integer): Integer; override;
function GetItemColor(const ItemInfo: TTBXItemInfo): TColor; override;
function GetItemTextColor(const ItemInfo: TTBXItemInfo): TColor; override;
function GetItemImageBackground(const ItemInfo: TTBXItemInfo): TColor;
override;
procedure GetMargins(MarginID: Integer; out Margins: TTBXMargins); override;
function GetPopupShadowType: Integer; override;
procedure GetViewBorder(ViewType: Integer; out Border: TPoint); override;
function GetViewColor(AViewType: Integer): TColor; override;
procedure GetViewMargins(ViewType: Integer; out Margins: TTBXMargins);
override;
{ Painting routines }
procedure PaintBackgnd(Canvas: TCanvas; const ADockRect, ARect, AClipRect:
TRect; AColor: TColor; Transparent: Boolean; AViewType: Integer);
override;
procedure PaintButton(Canvas: TCanvas; const ARect: TRect; const ItemInfo:
TTBXItemInfo); override;
procedure PaintCaption(Canvas: TCanvas; const ARect: TRect; const ItemInfo:
TTBXItemInfo; const ACaption: string; AFormat: Cardinal; Rotated:
Boolean);
override;
procedure PaintCheckMark(Canvas: TCanvas; ARect: TRect; const ItemInfo:
TTBXItemInfo); override;
procedure PaintChevron(Canvas: TCanvas; ARect: TRect; const ItemInfo:
TTBXItemInfo); override;
procedure PaintDock(Canvas: TCanvas; const ClientRect, DockRect: TRect;
DockPosition: Integer); override;
procedure PaintDockPanelNCArea(Canvas: TCanvas; R: TRect; const
DockPanelInfo: TTBXDockPanelInfo); override;
procedure PaintDropDownArrow(Canvas: TCanvas; const ARect: TRect; const
ItemInfo: TTBXItemInfo); override;
procedure PaintEditButton(Canvas: TCanvas; const ARect: TRect; var ItemInfo:
TTBXItemInfo; ButtonInfo: TTBXEditBtnInfo); override;
procedure PaintEditFrame(Canvas: TCanvas; const ARect: TRect; var ItemInfo:
TTBXItemInfo; const EditInfo: TTBXEditInfo); override;
procedure PaintFloatingBorder(Canvas: TCanvas; const ARect: TRect; const
WindowInfo: TTBXWindowInfo); override;
procedure PaintFrame(Canvas: TCanvas; const ARect: TRect; const ItemInfo:
TTBXItemInfo); override;
procedure PaintImage(Canvas: TCanvas; ARect: TRect; const ItemInfo:
TTBXItemInfo; ImageList: TCustomImageList; ImageIndex: Integer); override;
procedure PaintMDIButton(Canvas: TCanvas; ARect: TRect; const ItemInfo:
TTBXItemInfo; ButtonKind: Cardinal); override;
procedure PaintMenuItem(Canvas: TCanvas; const ARect: TRect; var ItemInfo:
TTBXItemInfo); override;
procedure PaintMenuItemFrame(Canvas: TCanvas; const ARect: TRect; const
ItemInfo: TTBXItemInfo); override;
procedure PaintPageScrollButton(Canvas: TCanvas; const ARect: TRect;
ButtonType: Integer; Hot: Boolean); override;
procedure PaintPopupNCArea(Canvas: TCanvas; R: TRect; const PopupInfo:
TTBXPopupInfo); override;
procedure PaintSeparator(Canvas: TCanvas; ARect: TRect; ItemInfo:
TTBXItemInfo; Horizontal, LineSeparator: Boolean); override;
procedure PaintToolbarNCArea(Canvas: TCanvas; R: TRect; const ToolbarInfo:
TTBXToolbarInfo); override;
procedure PaintFrameControl(Canvas: TCanvas; R: TRect; Kind, State: Integer;
Params: Pointer); override;
procedure PaintStatusBar(Canvas: TCanvas; R: TRect; Part: Integer);
override;
end;
implementation
{.$R tbx_glyphs.res}
uses
TBXUtils, TB2Common, TB2Item, Classes, Controls, Commctrl, Forms, rmkThemes;
var
StockImgList: TImageList;
CounterLock: Integer;
GradientBmp: TBitmap;
gradCol1, gradCol2,
gradHandle1, gradHandle2, gradHandle3,
gradBL, gradTL: TColor;
procedure InitializeStock;
begin
StockImgList := TImageList.Create(nil);
StockImgList.Handle := ImageList_LoadBitmap(HInstance, 'TBXGLYPHS', 16, 0,
clWhite);
GradientBmp := TBitmap.Create;
GradientBmp.PixelFormat := pf24bit;
end;
procedure FinalizeStock;
begin
GradientBmp.Free;
StockImgList.Free;
end;
{ TTBXAthenTheme }
procedure RoundFrame(Canvas: TCanvas; R: TRect; RL, RR: Integer);
begin
with Canvas, R do
begin
Dec(Right);
Dec(Bottom);
PolyLine([
Point(Left + RL, Top),
Point(Right - RR, Top),
Point(Right, Top + RR),
Point(Right, Bottom - RR),
Point(Right - RR, Bottom),
Point(Left + RL, Bottom),
Point(Left, Bottom - RL),
Point(Left, Top + RL),
Point(Left + RL, Top)
]);
Inc(Right);
Inc(Bottom);
end;
end;
function TTBXAthenTheme.GetBooleanMetrics(Index: Integer): Boolean;
begin
case Index of
TMB_OFFICEXPPOPUPALIGNMENT: Result := false;
TMB_EDITHEIGHTEVEN: Result := False;
TMB_PAINTDOCKBACKGROUND: Result := True;
TMB_SOLIDTOOLBARNCAREA: Result := True;
TMB_SOLIDTOOLBARCLIENTAREA: Result := True;
else
Result := False;
end;
end;
function TTBXAthenTheme.GetIntegerMetrics(Index: Integer): Integer;
const
DEFAULT = -1;
begin
case Index of
TMI_SPLITBTN_ARROWWIDTH: Result := 12;
TMI_DROPDOWN_ARROWWIDTH: Result := 8;
TMI_DROPDOWN_ARROWMARGIN: Result := 3;
TMI_MENU_IMGTEXTSPACE: Result := 0;
TMI_MENU_LCAPTIONMARGIN: Result := 8;
TMI_MENU_RCAPTIONMARGIN: Result := 3;
TMI_MENU_SEPARATORSIZE: Result := 3;
TMI_MENU_MDI_DW: Result := 2;
TMI_MENU_MDI_DH: Result := 2;
TMI_TLBR_SEPARATORSIZE: Result := 6;
TMI_EDIT_MENURIGHTINDENT: Result := 1;
TMI_EDIT_FRAMEWIDTH: Result := 1;
TMI_EDIT_TEXTMARGINHORZ: Result := 2;
TMI_EDIT_TEXTMARGINVERT: Result := 2;
TMI_EDIT_BTNWIDTH: Result := 14;
else
Result := DEFAULT;
end;
end;
function TTBXAthenTheme.GetViewColor(AViewType: Integer): TColor;
begin
Result := clBtnFace;
if (AViewType and VT_TOOLBAR) = VT_TOOLBAR then
begin
if (AViewType and TVT_MENUBAR) = TVT_MENUBAR then
Result := MenubarColor
else
Result := ToolbarColor;
end
else if (AViewType and VT_POPUP) = VT_POPUP then
begin
if (AViewType and PVT_LISTBOX) = PVT_LISTBOX then
Result := clWindow
else
Result := PopupColor;
end
else if (AViewType and VT_DOCKPANEL) = VT_DOCKPANEL then
Result := DockPanelColor;
end;
function TTBXAthenTheme.GetBtnColor(const ItemInfo: TTBXItemInfo; ItemPart:
TItemPart): TColor;
const
BFlags1: array[Boolean] of TBtnItemState = (bisDisabled, bisDisabledHot);
BFlags2: array[Boolean] of TBtnItemState = (bisSelected, bisSelectedHot);
BFlags3: array[Boolean] of TBtnItemState = (bisNormal, bisHot);
var
B: TBtnItemState;
Embedded: Boolean;
begin
with ItemInfo do
begin
Embedded := (ViewType and VT_TOOLBAR = VT_TOOLBAR) and
(ViewType and TVT_EMBEDDED = TVT_EMBEDDED);
if not Enabled then
B := BFlags1[HoverKind = hkKeyboardHover]
else if ItemInfo.IsPopupParent then
B := bisPopupParent
else if Pushed then
B := bisPressed
else if Selected then
B := BFlags2[HoverKind <> hkNone]
else
B := BFlags3[HoverKind <> hkNone];
Result := BtnItemColors[B, ItemPart];
if Embedded then
begin
if (ItemPart = ipBody) and (Result = clNone) then
Result := ToolbarColor;
if ItemPart = ipFrame then
begin
if Selected then
Result := clWindowFrame
else if (Result = clNone) then
Result := clBtnShadow;
end;
end;
end;
end;
function TTBXAthenTheme.GetPartColor(const ItemInfo: TTBXItemInfo; ItemPart:
TItemPart): TColor;
const
MFlags1: array[Boolean] of TMenuItemState = (misDisabled, misDisabledHot);
MFlags2: array[Boolean] of TMenuItemState = (misNormal, misHot);
BFlags1: array[Boolean] of TBtnItemState = (bisDisabled, bisDisabledHot);
BFlags2: array[Boolean] of TBtnItemState = (bisSelected, bisSelectedHot);
BFlags3: array[Boolean] of TBtnItemState = (bisNormal, bisHot);
var
IsMenuItem, Embedded: Boolean;
M: TMenuItemState;
B: TBtnItemState;
begin
with ItemInfo do
begin
IsMenuItem := ((ViewType and PVT_POPUPMENU) = PVT_POPUPMENU) and
((ItemOptions and IO_TOOLBARSTYLE) = 0);
Embedded := ((ViewType and VT_TOOLBAR) = VT_TOOLBAR) and
((ViewType and TVT_EMBEDDED) = TVT_EMBEDDED);
if IsMenuItem then
begin
if not Enabled then
M := MFlags1[HoverKind = hkKeyboardHover]
else
M := MFlags2[HoverKind <> hkNone];
Result := MenuItemColors[M, ItemPart];
end
else
begin
if not Enabled then
B := BFlags1[HoverKind = hkKeyboardHover]
else if ItemInfo.IsPopupParent then
B := bisPopupParent
else if Pushed then
B := bisPressed
else if Selected then
B := BFlags2[HoverKind <> hkNone]
else
B := BFlags3[HoverKind <> hkNone];
Result := BtnItemColors[B, ItemPart];
if Embedded and (Result = clNone) then
begin
if ItemPart = ipBody then
Result := ToolbarColor;
if ItemPart = ipFrame then
Result := clBtnShadow;
end;
end;
end;
end;
procedure DrawButtonBitmap(Canvas: TCanvas; R: TRect; Color: TColor);
const
{$IFNDEF SMALL_CLOSE_BUTTON}
Pattern: array[0..15] of Byte =
($C3, 0, $66, 0, $3C, 0, $18, 0, $3C, 0, $66, 0, $C3, 0, 0, 0);
{$ELSE}
Pattern: array[0..15] of Byte =
(0, 0, $63, 0, $36, 0, $1C, 0, $1C, 0, $36, 0, $63, 0, 0, 0);
{$ENDIF}
var
Bmp: TBitmap;
W, H: Integer;
Index: Integer;
begin
Bmp := TBitmap.Create;
try
Bmp.Handle := CreateBitmap(8, 8, 1, 1, @Pattern);
Index := SaveDC(Canvas.Handle);
Canvas.Brush.Color := Color;
SetTextColor(Canvas.Handle, clBlack);
SetBkColor(Canvas.Handle, clWhite);
W := 8;
H := 7;
with R do
begin
BitBlt(Canvas.Handle, (Left + Right - W + 1) div 2, (Top + Bottom - H) div
2, W, H,
Bmp.Canvas.Handle, 0, 0, ROP_DSPDxax);
end;
RestoreDC(Canvas.Handle, Index);
finally
Bmp.Free;
end;
end;
function TTBXAthenTheme.GetItemColor(const ItemInfo: TTBXItemInfo): TColor;
begin
Result := GetPartColor(ItemInfo, ipBody);
if Result = clNone then
Result := GetViewColor(ItemInfo.ViewType);
end;
function TTBXAthenTheme.GetItemTextColor(const ItemInfo: TTBXItemInfo): TColor;
begin
Result := GetPartColor(ItemInfo, ipText);
end;
function TTBXAthenTheme.GetItemImageBackground(const ItemInfo: TTBXItemInfo):
TColor;
begin
Result := GetBtnColor(ItemInfo, ipBody);
if Result = clNone then
result := GetViewColor(ItemInfo.ViewType);
end;
procedure TTBXAthenTheme.GetViewBorder(ViewType: Integer; out Border: TPoint);
const
XMetrics: array[Boolean] of Integer = (SM_CXDLGFRAME, SM_CXFRAME);
YMetrics: array[Boolean] of Integer = (SM_CYDLGFRAME, SM_CYFRAME);
var
Resizable: Boolean;
procedure SetBorder(X, Y: Integer);
begin
Border.X := X;
Border.Y := Y;
end;
begin
if (ViewType and VT_TOOLBAR) = VT_TOOLBAR then
begin
if (ViewType and TVT_FLOATING) = TVT_FLOATING then
begin
Resizable := (ViewType and TVT_RESIZABLE) = TVT_RESIZABLE;
Border.X := GetSystemMetrics(XMetrics[Resizable]) - 1;
Border.Y := GetSystemMetrics(YMetrics[Resizable]) - 1;
end
else
SetBorder(2, 2);
end
else if (ViewType and VT_POPUP) = VT_POPUP then
begin
if (ViewType and PVT_POPUPMENU) = PVT_POPUPMENU then
Border.X := 1
else
Border.X := 2;
Border.Y := 2;
end
else if (ViewType and VT_DOCKPANEL) = VT_DOCKPANEL then
begin
if (ViewType and DPVT_FLOATING) = DPVT_FLOATING then
begin
Resizable := (ViewType and DPVT_RESIZABLE) = DPVT_RESIZABLE;
Border.X := GetSystemMetrics(XMetrics[Resizable]) - 1;
Border.Y := GetSystemMetrics(YMetrics[Resizable]) - 1;
end
else
SetBorder(2, 2);
end
else
SetBorder(0, 0);
end;
procedure TTBXAthenTheme.GetMargins(MarginID: Integer; out Margins:
TTBXMargins);
begin
with Margins do
case MarginID of
MID_TOOLBARITEM:
begin
LeftWidth := 2;
RightWidth := 2;
TopHeight := 2;
BottomHeight := 2;
end;
MID_STATUSPANE:
begin
LeftWidth := 1;
RightWidth := 3;
TopHeight := 1;
BottomHeight := 1;
end;
MID_MENUITEM:
begin
LeftWidth := 1;
RightWidth := 1;
TopHeight := 3;
BottomHeight := 3;
end;
else
LeftWidth := 0;
RightWidth := 0;
TopHeight := 0;
BottomHeight := 0;
end;
end;
procedure TTBXAthenTheme.PaintBackgnd(Canvas: TCanvas; const ADockRect, ARect,
AClipRect: TRect;
AColor: TColor; Transparent: Boolean; AViewType: Integer);
var
R: TRect;
IsHoriz: boolean;
begin
if TBXLoColor then
inherited
else if not Transparent then
with Canvas do
begin
IntersectRect(R, ARect, AClipRect);
if not RectVisible(Handle, R) then
Exit;
AColor := ColorToRGB(AColor);
if ((AViewType and VT_TOOLBAR = VT_TOOLBAR) and (AViewType and TVT_EMBEDDED
= TVT_EMBEDDED)) or
((AViewType and VT_POPUP) = VT_POPUP) then
begin
FillRectEx(Canvas.Handle, R, AColor);
end
else
begin
if (ADockRect.Top = 0) and
(ADockRect.Left = 0) and
(ADockRect.Right = 0) and
(ADockRect.Bottom = 0) then
IsHoriz := (ARect.Right > ARect.Bottom)
else
IsHoriz := Abs(R.Right - R.Left) > Abs(R.Bottom - R.Top);
if IsHoriz then
begin
R.Top := R.Top - 1;
R.Bottom := R.Bottom + 1;
GradientGlass(Canvas, R, false, TGTopBottom);
R.Top := R.Top + 1;
R.Bottom := R.Bottom - 1;
end
else
begin
R.Left := R.Left - 1;
R.Right := R.Right + 1;
GradientGlass(Canvas, R, false, TGLeftRight);
R.Right := R.Right - 1;
R.Left := R.Left + 1;
end;
end;
end;
end;
procedure TTBXAthenTheme.PaintCaption(Canvas: TCanvas;
const ARect: TRect; const ItemInfo: TTBXItemInfo; const ACaption: string;
AFormat: Cardinal; Rotated: Boolean);
var
R: TRect;
begin
with ItemInfo, Canvas do
begin
R := ARect;
Brush.Style := bsClear;
if Font.Color = clNone then
Font.Color := GetPartColor(ItemInfo, ipText);
if not Rotated then
Windows.DrawText(Handle, PChar(ACaption), Length(ACaption), R, AFormat)
else
DrawRotatedText(Handle, ACaption, R, AFormat);
Brush.Style := bsSolid;
end;
end;
procedure TTBXAthenTheme.PaintCheckMark(Canvas: TCanvas; ARect: TRect; const
ItemInfo: TTBXItemInfo);
var
X, Y: Integer;
begin
X := (ARect.Left + ARect.Right) div 2 - 2;
Y := (ARect.Top + ARect.Bottom) div 2 + 1;
Canvas.Pen.Color := GetBtnColor(ItemInfo, ipText);
Canvas.Polyline([Point(X - 2, Y - 2), Point(X, Y), Point(X + 4, Y - 4),
Point(X + 4, Y - 3), Point(X, Y + 1), Point(X - 2, Y - 1), Point(X - 2, Y -
2)]);
end;
procedure TTBXAthenTheme.PaintChevron(Canvas: TCanvas; ARect: TRect; const
ItemInfo: TTBXItemInfo);
const
Pattern: array[Boolean, 0..15] of Byte = (
($CC, 0, $66, 0, $33, 0, $66, 0, $CC, 0, 0, 0, 0, 0, 0, 0),
($88, 0, $D8, 0, $70, 0, $20, 0, $88, 0, $D8, 0, $70, 0, $20, 0));
var
R2: TRect;
Bmp: TBitmap;
begin
R2 := ARect;
PaintButton(Canvas, ARect, ItemInfo);
if not ItemInfo.IsVertical then
begin
R2.Top := 4;
R2.Bottom := R2.Top + 5;
Inc(R2.Left, 2);
R2.Right := R2.Left + 8;
end
else
begin
R2.Left := R2.Right - 9;
R2.Right := R2.Left + 5;
Inc(R2.Top, 2);
R2.Bottom := R2.Top + 8;
end;
Bmp := TBitmap.Create;
try
Bmp.Handle := CreateBitmap(8, 8, 1, 1, @Pattern[ItemInfo.IsVertical]);
Canvas.Brush.Color := GetPartColor(ItemInfo, ipText);
SetTextColor(Canvas.Handle, clBlack);
SetBkColor(Canvas.Handle, clWhite);
with R2 do
BitBlt(Canvas.Handle, Left, Top, Right - Left,
Bottom - Top, Bmp.Canvas.Handle, 0, 0, ROP_DSPDxax);
finally
Bmp.Free;
end;
end;
procedure TTBXAthenTheme.PaintEditButton(Canvas: TCanvas; const ARect: TRect;
var ItemInfo: TTBXItemInfo; ButtonInfo: TTBXEditBtnInfo);
const
ArrowColor: array[Boolean] of TColor = (clBtnText, clMenuText);
var
BtnDisabled, BtnHot, BtnPressed, Embedded: Boolean;
R, BR: TRect;
X, Y: Integer;
C, LowC: TColor;
SaveItemInfoPushed: Boolean;
procedure PaintEnabled(R: TRect; Pressed: Boolean);
begin
if Pressed then
begin
C := LowC;
end
else if BtnHot then
C := LowC
else if (Embedded) or (ItemInfo.ViewType = PVT_CHEVRONMENU) then
begin
FillRectEx(Canvas.Handle, R, clWhite);
FrameRectEx(Canvas.Handle, R, clSilver, True);
end
else
FrameRectEx(Canvas.Handle, R, $00D0D0D0, True); // rmkO
end;
begin
LowC := clSilver;
with Canvas, ItemInfo do
begin
R := ARect;
Inc(R.Left);
Embedded := ((ViewType and VT_TOOLBAR) = VT_TOOLBAR) and
((ViewType and TVT_EMBEDDED) = TVT_EMBEDDED);
if ButtonInfo.ButtonType = EBT_DROPDOWN then
begin
BtnDisabled := (ButtonInfo.ButtonState and EBDS_DISABLED) <> 0;
BtnHot := (ButtonInfo.ButtonState and EBDS_HOT) <> 0;
BtnPressed := (ButtonInfo.ButtonState and EBDS_PRESSED) <> 0;
if not BtnDisabled then
begin
if BtnPressed or BtnHot then
begin
if BtnPressed then
GradientFill(Canvas, R, clWhite, clSilver, TGTopBottom)
else
begin
if (ItemInfo.ViewType and VT_POPUP) <> 0 then
begin
GradientGlass(Canvas, R, false, TGTopBottom);
Pen.Color := MenuItemColors[misHot, ipFrame];
MoveTo(R.Left, R.Top);
LineTo(R.Left, R.Bottom);
end
else
GradientGlass(Canvas, R, true, TGTopBottom);
end;
end
else
DrawLineEx(Canvas.Handle, R.Left - 1, R.Top + 1, R.Left - 1, R.Bottom
- 1, $00D0D0D0);
PaintEnabled(R, BtnPressed);
DrawLineEx(Canvas.Handle, R.Left - 1, R.Top + 1, R.Left - 1, R.Bottom -
1, clWhite)
end;
if BtnDisabled then
FrameRectEx(Canvas.Handle, R, BtnItemColors[bisDisabled, ipFrame],
True);
PaintDropDownArrow(Canvas, R, ItemInfo);
end
else if ButtonInfo.ButtonType = EBT_SPIN then
begin
BtnDisabled := (ButtonInfo.ButtonState and EBSS_DISABLED) <> 0;
BtnHot := (ButtonInfo.ButtonState and EBSS_HOT) <> 0;
{ Upper button }
BR := R;
BR.Bottom := (R.Top + R.Bottom + 1) div 2;
BtnPressed := (ButtonInfo.ButtonState and EBSS_UP) <> 0;
SaveItemInfoPushed := ItemInfo.Pushed;
ItemInfo.Pushed := BtnPressed;
if not BtnDisabled then
begin
if BtnPressed or BtnHot or Embedded then
begin
// BR = Button Rectangle
if BtnPressed then
GradientFill(Canvas, BR, clWhite, clSilver, TGTopBottom)
else if BtnHot then
begin
if ((ItemInfo.ViewType and VT_POPUP) <> 0) then
begin
GradientGlass(Canvas, BR, false, TGTopBottom);
Pen.Color := MenuItemColors[misHot, ipFrame];
MoveTo(BR.Left, BR.Top);
LineTo(BR.Left, BR.Bottom);
end
else
GradientGlass(Canvas, BR, true, TGTopBottom);
end;
end
else if (ItemInfo.ViewType and VT_TOOLBAR) = VT_TOOLBAR then
begin
if not Embedded then
begin
Pen.Color := clWhite;
end
else
Pen.Color := GetBtnColor(ItemInfo, ipFrame);
end;
PaintEnabled(BR, (ButtonInfo.ButtonState and EBSS_UP) <> 0);
end;
X := (BR.Left + BR.Right) div 2;
Y := (BR.Top + BR.Bottom - 1) div 2;
Pen.Color := GetPartColor(ItemInfo, ipText);
Brush.Color := Pen.Color;
Polygon([Point(X - 2, Y + 1), Point(X + 2, Y + 1), Point(X, Y - 1)]);
BR := R;
BR.Top := (R.Top + R.Bottom) div 2;
BtnPressed := (ButtonInfo.ButtonState and EBSS_DOWN) <> 0;
ItemInfo.Pushed := BtnPressed;
if not BtnDisabled then
begin
if BtnPressed or BtnHot or Embedded then
begin
if BtnPressed then
GradientFill(Canvas, BR, clWhite, clSilver, TGTopBottom)
else if BtnHot then
begin
if ((ItemInfo.ViewType and VT_POPUP) <> 0) then
begin
GradientGlass(Canvas, BR, false, TGTopBottom);
Pen.Color := MenuItemColors[misHot, ipFrame];
MoveTo(BR.Left, BR.Bottom - 1);
LineTo(BR.Left, BR.Top);
LineTo(BR.Right, BR.Top);
end
else
GradientGlass(Canvas, BR, true, TGTopBottom);
end;
end
else if (ItemInfo.ViewType and VT_TOOLBAR) = VT_TOOLBAR then
begin
if not Embedded then
begin
Pen.Color := clWindow;
end
else
Pen.Color := GetBtnColor(ItemInfo, ipFrame);
end;
PaintEnabled(BR, (ButtonInfo.ButtonState and EBSS_UP) <> 0);
end;
X := (BR.Left + BR.Right) div 2;
Y := (BR.Top + BR.Bottom) div 2;
Pen.Color := GetPartColor(ItemInfo, ipText);
Brush.Color := Pen.Color;
Polygon([Point(X - 2, Y - 1), Point(X + 2, Y - 1), Point(X, Y + 1)]);
ItemInfo.Pushed := SaveItemInfoPushed;
end;
end;
end;
procedure TTBXAthenTheme.PaintEditFrame(Canvas: TCanvas;
const ARect: TRect; var ItemInfo: TTBXItemInfo; const EditInfo: TTBXEditInfo);
var
R: TRect;
W: Integer;
begin
R := ARect;
PaintFrame(Canvas, R, ItemInfo);
W := EditFrameWidth;
InflateRect(R, -W, -W);
with EditInfo do
if RightBtnWidth > 0 then
Dec(R.Right, RightBtnWidth - 2);
if ItemInfo.Enabled then
begin
if ItemInfo.HoverKind = hkNone then
Canvas.Brush.Color := $00D0D0D0 // Should be central...
else
Canvas.Brush.Color := clWhite;
Canvas.FrameRect(R);
Canvas.Brush.Color := clWhite;
end;
if not ItemInfo.Enabled then
begin
if ItemInfo.HoverKind = hkNone then
Canvas.Brush.Color := BtnItemColors[bisDisabled, ipFrame]
else
Canvas.Brush.Color := clWhite;
Canvas.FrameRect(R);
Canvas.Brush.Color := clWhite;
end;
InflateRect(R, -1, -1);
if ItemInfo.Enabled then
Canvas.FillRect(R);
if EditInfo.RightBtnWidth > 0 then
begin
R := ARect;
InflateRect(R, -W, -W);
R.Left := R.Right - EditInfo.RightBtnWidth;
PaintEditButton(Canvas, R, ItemInfo, EditInfo.RightBtnInfo);
end;
end;
procedure TTBXAthenTheme.PaintDropDownArrow(Canvas: TCanvas;
const ARect: TRect; const ItemInfo: TTBXItemInfo);
var
X, Y: Integer;
begin
with ARect, Canvas do
begin
X := (Left + Right) div 2;
Y := (Top + Bottom) div 2 - 1;
Pen.Color := GetPartColor(ItemInfo, ipText);
Brush.Color := Pen.Color;
if ItemInfo.IsVertical then
Polygon([Point(X, Y + 2), Point(X, Y - 2), Point(X - 2, Y)])
else
Polygon([Point(X - 2, Y), Point(X + 2, Y), Point(X, Y + 2)]);
end;
end;
procedure TTBXAthenTheme.PaintButton(Canvas: TCanvas; const ARect: TRect; const
ItemInfo: TTBXItemInfo);
const
ZERO_RECT: TRect = (Left: 0; Top: 0; Right: 0; Bottom: 0);
var
R: TRect;
RL, RR: Integer;
ShowHover, Embedded: Boolean;
begin
R := ARect;
with ItemInfo, Canvas do
begin
ShowHover := (Enabled and (HoverKind <> hkNone)) or
(not Enabled and (HoverKind = hkKeyboardHover));
Embedded := (ViewType and VT_TOOLBAR = VT_TOOLBAR) and
(ViewType and TVT_EMBEDDED = TVT_EMBEDDED);
RL := 2;
RR := 2;
if ComboPart = cpSplitRight then
begin
Dec(R.Left);
Dec(RL);
end;
if ComboPart = cpSplitLeft then
Dec(RR);
if (ItemInfo.ItemOptions and IO_TOOLBARSTYLE) = 0 then
begin
RR := 1;
RL := 1;
end;
if Embedded and not ShowHover then
begin
if Enabled then
begin
InflateRect(R, -1, -1);
FillRectEx(Canvas.Handle, R, ToolBarColor);
InflateRect(R, 1, 1);
SmartFrame(Canvas, R, RL, RR, $00B0B0B0, clNone);
end
else
SmartFrame(Canvas, R, RL, RR, $00C0C0C0, clNone);
end;
if ((ViewType and TVT_MENUBAR) = TVT_MENUBAR) then
begin
if ((Pushed or Selected) and Enabled) or ShowHover then
GradientGlass(Canvas, R, true, TGTopBottom);
Exit;
end;
if (Pushed or Selected) and Enabled then
begin
InflateRect(R, -1, -1);
if not Pushed and (HoverKind = hkNone) then
begin
GradientGlass(Canvas, R, true, TGTopBottom);
InflateRect(R, 1, 1);
SmartFrame(Canvas, R, RL, RR, Blend(BtnItemColors[bisHot, ipFrame],
clBlack, 90), clNone);
end
else
begin
GradientFill(Canvas, R, clWhite, clSilver, TGTopBottom);
InflateRect(R, 1, 1);
SmartFrame(Canvas, R, RL, RR, $00B0B0B0, $00D0D0D0);
end;
if Selected and (not Pushed) and (HoverKind <> hkNone) then
begin
GradientGlass(Canvas, R, true, TGTopBottom);
SmartFrame(Canvas, R, RL, RR, BtnItemColors[bisHot, ipFrame], clNone);
end;
end
else if ShowHover or ((ItemOptions and IO_DESIGNING) <> 0) then
begin
InflateRect(R, -1, -1);
GradientGlass(Canvas, R, true, TGTopBottom);
InflateRect(R, 1, 1);
SmartFrame(Canvas, R, RL, RR, GetBtnColor(ItemInfo, ipFrame), clNone);
end;
if ComboPart = cpSplitRight then
PaintDropDownArrow(Canvas, R, ItemInfo);
end;
end;
procedure TTBXAthenTheme.PaintFloatingBorder(Canvas: TCanvas; const ARect:
TRect;
const WindowInfo: TTBXWindowInfo);
const
WinStates: array[Boolean] of TWinFramestate = (wfsInactive, wfsActive);
function GetBtnItemState(BtnState: Integer): TBtnItemState;
begin
if not WindowInfo.Active then
Result := bisDisabled
else if (BtnState and CDBS_PRESSED) <> 0 then
Result := bisPressed
else if (BtnState and CDBS_HOT) <> 0 then
Result := bisHot
else
Result := bisNormal;
end;
var
WinState: TWinFrameState;
BtnItemState: TBtnItemState;
SaveIndex, X, Y: Integer;
Sz: TPoint;
R: TRect;
BodyColor, CaptionColor, CaptionText: TColor;
IsDockPanel: Boolean;
procedure DrawGlyph(C: TColor);
var
Bmp: TBitmap;
DC: HDC;
begin
Bmp := TBitmap.Create;
try
Bmp.Monochrome := True;
StockImgList.GetBitmap(0, Bmp);
Canvas.Brush.Color := C;
DC := Canvas.Handle;
SetTextColor(DC, clBlack);
SetBkColor(DC, clWhite);
BitBlt(DC, X, Y, StockImgList.Width, StockImgList.Height,
Bmp.Canvas.Handle, 0, 0, ROP_DSPDxax);
finally
Bmp.Free;
end;
end;
begin
with Canvas do
begin
WinState := WinStates[WindowInfo.Active];
IsDockPanel := (WindowInfo.ViewType and VT_DOCKPANEL) = VT_DOCKPANEL;
BodyColor := Brush.Color;
if (WRP_BORDER and WindowInfo.RedrawPart) <> 0 then
begin
R := ARect;
if not IsDockPanel then
Brush.Color := WinFrameColors[WinState, wfpBorder]
else
Brush.Color := PnlFrameColors[WinState, wfpBorder];
SaveIndex := SaveDC(Canvas.Handle);
Sz := WindowInfo.FloatingBorderSize;
with R, Sz do
ExcludeClipRect(Canvas.Handle, Left + X, Top + Y, Right - X, Bottom -
Y);
FillRect(R);
RestoreDC(Canvas.Handle, SaveIndex);
InflateRect(R, -Sz.X, -Sz.Y);
Pen.Color := BodyColor;
with R do
if not IsDockPanel then
Canvas.Polyline([
Point(Left, Top - 1), Point(Right - 1, Top - 1),
Point(Right, Top), Point(Right, Bottom - 1),
Point(Right - 1, Bottom),
Point(Left, Bottom), Point(Left - 1, Bottom - 1),
Point(Left - 1, Top), Point(Left, Top - 1)
])
else
Canvas.Polyline([
Point(Left, Top - 1), Point(Right - 1, Top - 1),
Point(Right, Top), Point(Right, Bottom),
Point(Left - 1, Bottom),
Point(Left - 1, Top), Point(Left, Top - 1)
]);
end;
if not WindowInfo.ShowCaption then
Exit;
if (WindowInfo.ViewType and VT_TOOLBAR) = VT_TOOLBAR then
begin
CaptionColor := WinFrameColors[WinState, wfpCaption];
CaptionText := WinFrameColors[WinState, wfpCaptionText];
end
else
begin
CaptionColor := PnlFrameColors[WinState, wfpCaption];
CaptionText := PnlFrameColors[WinState, wfpCaptionText];
end;
{ Caption }
if (WRP_CAPTION and WindowInfo.RedrawPart) <> 0 then
begin
R := Rect(0, 0, WindowInfo.ClientWidth, GetSystemMetrics(SM_CYSMCAPTION) -
1);
with WindowInfo.FloatingBorderSize do
OffsetRect(R, X, Y);
DrawLineEx(Canvas.Handle, R.Left, R.Bottom, R.Right, R.Bottom, BodyColor);
if ((CDBS_VISIBLE and WindowInfo.CloseButtonState) <> 0) and
((WRP_CLOSEBTN and WindowInfo.RedrawPart) <> 0) then
Dec(R.Right, GetSystemMetrics(SM_CYSMCAPTION) - 1);
Brush.Color := CaptionColor;
GradientGlass(Canvas, R, false, TGTopBottom);
InflateRect(R, -2, 0);
Font.Assign(SmCaptionFont);
Font.Color := CaptionText;
Brush.Style := bsClear;
DrawText(Canvas.Handle, WindowInfo.Caption, -1, R,
DT_SINGLELINE or DT_VCENTER or DT_END_ELLIPSIS or DT_HIDEPREFIX);
end;
{ Close button }
if (CDBS_VISIBLE and WindowInfo.CloseButtonState) <> 0 then
begin
R := Rect(0, 0, WindowInfo.ClientWidth, GetSystemMetrics(SM_CYSMCAPTION) -
1);
with WindowInfo.FloatingBorderSize do
OffsetRect(R, X, Y);
R.Left := R.Right - (R.Bottom - R.Top);
DrawLineEx(Canvas.Handle, R.Left - 1, R.Bottom, R.Right, R.Bottom,
BodyColor);
Brush.Color := CaptionColor;
GradientGlass(Canvas, R, false, TGTopBottom); // rmkB
BtnItemState := GetBtnItemState(WindowInfo.CloseButtonState);
if BtnItemState = bisHot then
begin
FrameRectEx(Canvas.Handle, R, BtnItemColors[bisHot, ipFrame], True);
GradientGlass(Canvas, R, true, TGTopBottom)
end
else if BtnItemState = bisPressed then
begin
FrameRectEx(Canvas.Handle, R, $00D0D0D0, True);
GradientFill(Canvas, R, clWhite, clSilver, TGTopBottom);
end;
with R do
begin
X := (Left + Right - StockImgList.Width + 1) div 2;
Y := (Top + Bottom - StockImgList.Height) div 2;
end;
DrawButtonBitmap(Canvas, R, clBlack);
end;
end;
end;
procedure TTBXAthenTheme.PaintFrame(Canvas: TCanvas; const ARect: TRect; const
ItemInfo: TTBXItemInfo);
var
R: TRect;
E: Boolean;
begin
R := ARect;
with ItemInfo do
begin
E := Enabled or (not Enabled and (HoverKind = hkKeyboardHover));
if not E then
begin
InflateRect(R, -1, -1);
FrameRectEx(Canvas.Handle, R, ToolBarColor, true);
end
else if E and (HoverKind <> hkNone) or
((ItemOptions and IO_DESIGNING) <> 0) then
begin
InflateRect(R, -1, -1);
GradientGlass(Canvas, R, false, TGTopBottom);
if Pushed then
if (ItemInfo.ViewType and VT_POPUP) <> 0 then
Canvas.Pen.Color := MenuItemColors[misHot, ipFrame]
else
Canvas.Pen.Color := BtnItemColors[bisSelected, ipFrame]
else if (ItemInfo.ViewType and VT_POPUP) <> 0 then
Canvas.Pen.Color := MenuItemColors[misHot, ipFrame]
else
Canvas.Pen.Color := GetPartColor(ItemInfo, ipFrame);
InflateRect(R, 1, 1);
RoundFrame(Canvas, R, 1, 1);
end;
end;
end;
function TTBXAthenTheme.GetImageOffset(Canvas: TCanvas;
const ItemInfo: TTBXItemInfo; ImageList: TCustomImageList): TPoint;
begin
Result.X := 0;
if not (ImageList is TTBCustomImageList) then
with ItemInfo do
if Enabled and (HoverKind <> hkNone) and
not (Selected or Pushed and not IsPopupParent) then
Result.X := -1;
Result.Y := Result.X
end;
procedure TTBXAthenTheme.PaintImage(Canvas: TCanvas; ARect: TRect;
const ItemInfo: TTBXItemInfo; ImageList: TCustomImageList; ImageIndex:
Integer);
var
HiContrast: Boolean;
begin
with ItemInfo do
begin
if ImageList is TTBCustomImageList then
begin
TTBCustomImageList(ImageList).DrawState(Canvas, ARect.Left, ARect.Top,
ImageIndex, Enabled, (HoverKind <> hkNone), Selected);
Exit;
end;
{$IFNDEF ALTERNATIVE_DISABLED_STYLE}
HiContrast := IsDarkColor(GetItemImageBackground(ItemInfo), 64);
if not Enabled then
begin
DrawTBXIconFlatShadow(Canvas, ARect, ImageList, ImageIndex,
BtnItemColors[bisDisabled, ipText]);
end
else if Selected or Pushed or (HoverKind <> hkNone) then
begin
if not (Selected or Pushed and not IsPopupParent) then
begin
OffsetRect(ARect, 1, 1);
DrawTBXIconFullShadow(Canvas, ARect, ImageList, ImageIndex,
IconShadowColor);
OffsetRect(ARect, -2, -2);
end;
DrawTBXIcon(Canvas, ARect, ImageList, ImageIndex, HiContrast);
end
else if HiContrast or TBXHiContrast or TBXLoColor then
DrawTBXIcon(Canvas, ARect, ImageList, ImageIndex, HiContrast)
else
HighlightTBXIcon(Canvas, ARect, ImageList, ImageIndex, clWindow, 178);
{$ELSE}
HiContrast := ColorIntensity(GetItemImageBackground(ItemInfo)) < 80;
if not Enabled then
begin
if not HiContrast then
DrawTBXIconShadow(Canvas, ARect, ImageList, ImageIndex, 0)
else
DrawTBXIconFlatShadow(Canvas, ARect, ImageList, ImageIndex,
clBtnShadow);
end
else if Selected or Pushed or (HoverKind <> hkNone) then
begin
//if not (Selected or Pushed and not IsPopupParent) then
if Selected or Pushed then
// OffsetRect(ARect, 1, 1)
else
begin
OffsetRect(ARect, 1, 1);
DrawTBXIconShadow(Canvas, ARect, ImageList, ImageIndex, 1);
OffsetRect(ARect, 1, 1);
DrawTBXIconShadow(Canvas, ARect, ImageList, ImageIndex, 1);
OffsetRect(ARect, -2, -2);
end;
DrawTBXIcon(Canvas, ARect, ImageList, ImageIndex, HiContrast);
end
else if HiContrast or TBXHiContrast or TBXLoColor then
DrawTBXIcon(Canvas, ARect, ImageList, ImageIndex, HiContrast)
else // rmk 14.04.2003 Removed washed out glyphs
HighlightTBXIcon(Canvas, ARect, ImageList, ImageIndex, clWindow, {178}
255);
{$ENDIF}
end;
end;
procedure TTBXAthenTheme.PaintMDIButton(Canvas: TCanvas; ARect: TRect;
const ItemInfo: TTBXItemInfo; ButtonKind: Cardinal);
var
Index: Integer;
X, Y: Integer;
Bmp: TBitmap;
begin
PaintButton(Canvas, ARect, ItemInfo);
with ARect do
begin
X := (Left + Right - StockImgList.Width) div 2;
Y := (Top + Bottom - StockImgList.Height) div 2;
end;
case ButtonKind of
DFCS_CAPTIONMIN: Index := 2;
DFCS_CAPTIONRESTORE: Index := 3;
DFCS_CAPTIONCLOSE: Index := 0;
else
Exit;
end;
Bmp := TBitmap.Create;
Bmp.Monochrome := True;
StockImgList.GetBitmap(Index, Bmp);
Canvas.Brush.Color := GetPartColor(ItemInfo, ipText);
SetTextColor(Canvas.Handle, clBlack);
SetBkColor(Canvas.Handle, clWhite);
BitBlt(Canvas.Handle, X, Y, StockImgList.Width, StockImgList.Height,
Bmp.Canvas.Handle, 0, 0, ROP_DSPDxax);
Bmp.Free;
end;
procedure TTBXAthenTheme.PaintMenuItemFrame(Canvas: TCanvas; const ARect: TRect;
const ItemInfo: TTBXItemInfo);
var
R: TRect;
begin
R := ARect;
if (ItemInfo.ViewType and PVT_TOOLBOX) <> PVT_TOOLBOX then
with Canvas do
begin
R.Right := R.Left + ItemInfo.PopupMargin + 2;
Brush.Color := clWhite;
FillRect(R);
Inc(R.Left);
R.Right := ARect.Right - 1;
end;
PaintFrame(Canvas, R, ItemInfo);
end;
procedure TTBXAthenTheme.PaintMenuItem(Canvas: TCanvas; const ARect: TRect; var
ItemInfo: TTBXItemInfo);
const
ZERO_RECT: TRect = (Left: 0; Top: 0; Right: 0; Bottom: 0);
var
R, R2: TRect;
X, Y: Integer;
ArrowWidth: Integer;
ClrText: TColor;
procedure DrawArrow(AColor: TColor);
begin
Canvas.Pen.Color := AColor;
Canvas.Brush.Color := AColor;
Canvas.Polygon([Point(X, Y - 3), Point(X, Y + 3), Point(X + 3, Y)]);
end;
procedure PaintButton(Canvas: TCanvas; const ARect: TRect; const ItemInfo:
TTBXItemInfo);
var
R: TRect;
RL, RR: Integer;
ShowHover, Embedded: Boolean;
begin
R := ARect;
with ItemInfo, Canvas do
begin
ShowHover := (Enabled and (HoverKind <> hkNone)) or
(not Enabled and (HoverKind = hkKeyboardHover));
Embedded := (ViewType and VT_TOOLBAR = VT_TOOLBAR) and
(ViewType and TVT_EMBEDDED = TVT_EMBEDDED);
RL := 2;
RR := 2;
if ComboPart = cpSplitRight then
begin
Dec(R.Left);
Dec(RL);
end;
if ComboPart = cpSplitLeft then
Dec(RR);
if (ItemInfo.ItemOptions and IO_TOOLBARSTYLE) = 0 then
begin
RR := 1;
RL := 1;
end;
if Embedded and not ShowHover then
begin
if Enabled then
begin
InflateRect(R, -1, -1);
FillRectEx(Canvas.Handle, R, ToolBarColor);
InflateRect(R, 1, 1);
Pen.Color := Blend(clHighLight, clWindow, 20);
end
else
Pen.Color := Blend(clHighLight, clWindow, 15);
SmartFrame(Canvas, R, RL, RR, Pen.Color, clNone);
end;
if (Pushed or Selected) and Enabled then
begin
if not Pushed and (HoverKind = hkNone) then
begin
GradientGlass(Canvas, R, true, TGTopBottom);
Pen.Color := clSilver;
SmartFrame(Canvas, R, 1, 1, Pen.Color, clNone);
Pen.Color := Blend(BtnItemColors[bisHot, ipFrame], clBlack, 90);
SmartFrame(Canvas, R, 2, 2, Pen.Color, clNone);
end
else
begin
GradientGlass(Canvas, R, true, TGTopBottom);
Pen.Color := BtnItemColors[bisHot, ipFrame]
end;
InflateRect(R, 1, 1);
end
else if ShowHover or ((ItemOptions and IO_DESIGNING) <> 0) then
begin
Canvas.Pen.Color := Blend(clred, clWindow, 40);
SmartFrame(Canvas, R, RL, RR, Pen.Color, clNone);
end;
if ComboPart = cpSplitRight then
PaintDropDownArrow(Canvas, R, ItemInfo);
end;
end;
begin
with Canvas, ItemInfo do
begin
ArrowWidth := GetSystemMetrics(SM_CXMENUCHECK);
PaintMenuItemFrame(Canvas, ARect, ItemInfo);
ClrText := GetPartColor(ItemInfo, ipText);
R := ARect;
if (ItemOptions and IO_COMBO) <> 0 then
begin
X := R.Right - ArrowWidth - 1;
if not ItemInfo.Enabled then
Pen.Color := ClrText
else if HoverKind = hkMouseHover then
Pen.Color := PopupSeparatorColor
else
Pen.Color := PopupSeparatorColor;
MoveTo(X, R.Top + 1);
LineTo(X, R.Bottom - 1);
end;
if (ItemOptions and IO_SUBMENUITEM) <> 0 then
begin
Y := ARect.Bottom div 2;
X := ARect.Right - ArrowWidth * 2 div 3 - 1;
DrawArrow(ClrText);
end;
if ((Selected) and (Enabled)) then
begin
R2 := Arect;
InflateRect(R2, -1, -1);
R.Left := R2.Left;
R.Right := R.Left + ItemInfo.PopupMargin;
if HoverKind = hkMouseHover then
InflateRect(R, -1, -1); // smaller button in menu?
PaintButton(Canvas, R, ItemInfo);
end;
end;
end;
procedure TTBXAthenTheme.PaintPopupNCArea(Canvas: TCanvas; R: TRect; const
PopupInfo: TTBXPopupInfo);
var
PR: TRect;
begin
with Canvas do
begin
Brush.Color := PopupFrameColor;
FrameRect(R);
InflateRect(R, -1, -1);
Brush.Color := PopupColor;
FillRect(R);
if not IsRectEmpty(PopupInfo.ParentRect) then
begin
PR := PopupInfo.ParentRect;
if not IsRectEmpty(PR) then
with PR do
begin
Pen.Color := ToolbarColor;
if Bottom = R.Top then
begin
if Left <= R.Left then
Left := R.Left - 1;
if Right >= R.Right then
Right := R.Right + 1;
MoveTo(Left + 1, Bottom - 1);
LineTo(Right - 1, Bottom - 1);
end
else if Top = R.Bottom then
begin
if Left <= R.Left then
Left := R.Left - 1;
if Right >= R.Right then
Right := R.Right + 1;
MoveTo(Left + 1, Top);
LineTo(Right - 1, Top);
end;
if Right = R.Left then
begin
if Top <= R.Top then
Top := R.Top - 1;
if Bottom >= R.Bottom then
Bottom := R.Bottom + 1;
MoveTo(Right - 1, Top + 1);
LineTo(Right - 1, Bottom - 1);
end
else if Left = R.Right then
begin
if Top <= R.Top then
Top := R.Top - 1;
if Bottom >= R.Bottom then
Bottom := R.Bottom + 1;
MoveTo(Left, Top + 1);
LineTo(Left, Bottom - 1);
end;
end;
end;
end;
end;
procedure TTBXAthenTheme.PaintSeparator(Canvas: TCanvas; ARect: TRect;
ItemInfo: TTBXItemInfo; Horizontal, LineSeparator: Boolean);
var
IsToolbox: Boolean;
R: TRect;
begin
with ItemInfo, ARect, Canvas do
begin
if Horizontal then
begin
IsToolbox := (ViewType and PVT_TOOLBOX) = PVT_TOOLBOX;
if ((ItemOptions and IO_TOOLBARSTYLE) = 0) and not IsToolBox then
begin
R := ARect;
R.Right := ItemInfo.PopupMargin + 2;
Brush.Color := ToolbarColor;
Inc(Left, ItemInfo.PopupMargin + 9);
Pen.Color := PopupSeparatorColor;
end
else
Pen.Color := ToolbarSeparatorColor;
if (ItemInfo.ViewType and VT_TOOLBAR) = VT_TOOLBAR then
begin
Top := Bottom div 2 + 1;
Left := Left + 4;
Right := Right - 2;
Bottom := Top + 1;
DrawLineEx(Canvas.Handle, Left, Top, Right, Top, clWhite);
Top := Top - 1;
Left := Left - 1;
Right := Right - 1;
DrawLineEx(Canvas.Handle, Left, Top, Right, Top, gradCol1);
end
else
begin
Top := Bottom div 2;
MoveTo(Left, Top);
LineTo(Right, Top);
end;
end
else if enabled then
begin
Top := Top + 4;
Bottom := Bottom - 2;
Left := Right div 2;
DrawLineEx(Canvas.Handle, Left, Top, Left, Bottom, clWhite);
Top := Top - 1;
Left := Left - 1;
Bottom := Bottom - 1;
DrawLineEx(Canvas.Handle, Left, Top, Left, Bottom, gradCol1);
end;
end;
end;
procedure TTBXAthenTheme.PaintToolbarNCArea(Canvas: TCanvas; R: TRect;
const ToolbarInfo: TTBXToolbarInfo);
const
DragHandleOffsets: array[Boolean, DHS_DOUBLE..DHS_SINGLE] of Integer = ((2, 0,
1), (5, 0, 5));
function GetBtnItemState(BtnState: Integer): TBtnItemState;
begin
if (BtnState and CDBS_PRESSED) <> 0 then
Result := bisPressed
else if (BtnState and CDBS_HOT) <> 0 then
Result := bisHot
else
Result := bisNormal;
end;
var
Sz: Integer;
R2: TRect;
I: Integer;
BtnVisible, Horz: Boolean;
BtnItemState: TBtnItemState;
begin
with Canvas do
begin
with R do
begin
if (Toolbarinfo.IsVertical) then
begin
GradientGlass(Canvas, R, false, TGLeftRight);
R2 := R;
R2.Top := R.Bottom - 1;
R2.Bottom := R2.Bottom + 1;
if ToolbarInfo.BorderStyle <> bsSingle then
exit;
GradientFill(Canvas, R2, gradBL, Blend(gradBL, gradCol2, 30),
TGLeftRight);
Pen.Color := gradBL;
MoveTo(Right - 1, Top + 1);
LineTo(Right - 1, Bottom - 1);
Pixels[Left, Top] := Blend(gradCol1, gradCol2, 60);
Pixels[Left, Bottom - 2] := Blend(gradCol1, gradCol2, 60);
Pixels[Left, Bottom - 1] := $00E0E0E0;
Pixels[Right - 2, Top] := Blend(gradCol1, gradCol2, 35);
Pixels[Right - 1, Top] := Blend(gradCol2, gradBL, 50);
Pixels[Right - 1, Bottom - 1] := gradCol1;
Pixels[Right - 2, Bottom - 2] := Blend(gradCol1, gradBL, 50);
end
else
begin
GradientGlass(Canvas, R, false, TGTopBottom);
R2 := R;
R2.Top := R.Top + 1;
R2.Left := R2.Right - 1;
if ToolbarInfo.BorderStyle <> bsSingle then
exit;
GradientFill(Canvas, R2, gradBL, Blend(gradBL, gradCol2, 45),
TGTopBottom);
Pen.Color := gradBL;
MoveTo(Left + 1, Bottom - 1);
LineTo(Right - 1, Bottom - 1);
Pixels[Left, Top] := Blend(gradCol1, gradCol2, 60);
Pixels[Left, Bottom - 1] := $00E0E0E0;
Pixels[Left, Bottom - 2] := Blend(gradCol1, gradBL, 50);
Pixels[Right - 2, Top] := Blend(gradCol1, gradCol2, 35);
Pixels[Right - 1, Top] := $00E0E0E0;
Pixels[Right - 1, Bottom - 1] := $00E0E0E0;
Pixels[Right - 2, Bottom - 2] := Blend(gradCol1, gradBL, 50);
end;
end;
InflateRect(R, -2, -2);
if not ToolbarInfo.AllowDrag then
Exit;
BtnVisible := (ToolbarInfo.CloseButtonState and CDBS_VISIBLE) <> 0;
Sz := GetTBXDragHandleSize(ToolbarInfo);
Horz := not ToolbarInfo.IsVertical;
if Horz then
R.Right := R.Left + Sz
else
R.Bottom := R.Top + Sz;
{ Drag Handle }
if ToolbarInfo.DragHandleStyle <> DHS_NONE then
begin
R2 := R;
if Horz then
begin
Inc(R2.Left, DragHandleOffsets[BtnVisible,
ToolbarInfo.DragHandleStyle]);
if BtnVisible then
Inc(R2.Top, Sz - 2);
R2.Right := R2.Left + 3;
end
else
begin
Inc(R2.Top, DragHandleOffsets[BtnVisible, ToolbarInfo.DragHandleStyle]);
if BtnVisible then
Dec(R2.Right, Sz - 2);
R2.Bottom := R2.Top + 3;
end;
Pen.Color := DragHandleColor;
if Horz then
begin
I := R2.Top + 3;
while I < R2.Bottom - 3 do
begin
Pen.Color := $00A0A0A0;
MoveTo(R2.Left, I);
LineTo(R2.Right, I);
Pen.Color := clWhite;
MoveTo(R2.Left, I + 1);
LineTo(R2.Right, I + 1);
Inc(I, 2);
end;
end
else
begin
I := R2.Left + 3;
while I < R2.Right - 3 do
begin
Pen.Color := clGray;
MoveTo(I, R2.Top);
LineTo(I, R2.Bottom);
Pen.Color := clWhite;
MoveTo(I + 1, R2.Top);
LineTo(I + 1, R2.Bottom);
Inc(I, 2);
end;
end;
end;
{ Close button }
if BtnVisible then
begin
R2 := R;
if Horz then
begin
Dec(R2.Right);
R2.Bottom := R2.Top + R2.Right - R2.Left;
end
else
begin
Dec(R2.Bottom);
R2.Left := R2.Right - R2.Bottom + R2.Top;
end;
BtnItemState := GetBtnItemState(ToolbarInfo.CloseButtonState);
if BtnItemState = bisHot then
begin
FrameRectEx(Canvas.Handle, R2, BtnItemColors[bisHot, ipFrame], True);
GradientGlass(Canvas, R2, true, TGTopBottom);
DrawButtonBitmap(Canvas, R2, clBlack);
end
else if BtnItemState = bisPressed then
begin
GradientFill(Canvas, R2, clWhite, clSilver, TGTopBottom);
FrameRectEx(Canvas.Handle, R2, $00D0D0D0, True);
DrawButtonBitmap(Canvas, R2, clBlack);
end
else
begin
FrameRectEx(Canvas.Handle, R2, BtnItemColors[BtnItemState, ipFrame],
True);
DrawButtonBitmap(Canvas, R2, clBlack);
end;
end;
end;
end;
procedure TTBXAthenTheme.PaintDock(Canvas: TCanvas; const ClientRect,
DockRect: TRect; DockPosition: Integer);
var
R: TRect;
begin
Canvas.Pen.Width := 0;
Canvas.Brush.Style := bsSolid;
Canvas.Brush.Color := $00E0E0E0;
R := DockRect;
InFlateRect(R, 1, 1);
Canvas.Rectangle(R);
end;
procedure TTBXAthenTheme.PaintDockPanelNCArea(Canvas: TCanvas; R: TRect; const
DockPanelInfo: TTBXDockPanelInfo);
function GetBtnItemState(BtnState: Integer): TBtnItemState;
begin
if (BtnState and CDBS_PRESSED) <> 0 then
Result := bisPressed
else if (BtnState and CDBS_HOT) <> 0 then
Result := bisHot
else
Result := bisNormal;
end;
var
C, HeaderColor: TColor;
I, Sz, Flags: Integer;
R2: TRect;
BtnItemState: TBtnItemState;
begin
with Canvas, DockPanelInfo do
begin
C := Brush.Color; // Dock panel passes its body color in Canvas.Brush
I := ColorIntensity(ColorToRGB(clBtnFace));
R2 := R;
if not TBXLoColor and (I in [64..250]) then
begin
FrameRectEx(Canvas.Handle, R, clBtnFace, True);
FrameRectEx(Canvas.Handle, R, C, True);
with R do
begin
Pixels[Left, Top] := clBtnFace;
if IsVertical then
Pixels[Right - 1, Top] := clBtnFace
else
Pixels[Left, Bottom - 1] := clBtnFace;
end;
end
else
begin
FrameRectEx(Canvas.Handle, R, C, True);
if I < 64 then
Brush.Bitmap := AllocPatternBitmap(C, clWhite)
else
Brush.Bitmap := AllocPatternBitmap(C, clBtnShadow);
FrameRect(R);
with R do
begin
Pixels[Left, Top] := C;
if IsVertical then
Pixels[Right - 1, Top] := C
else
Pixels[Left, Bottom - 1] := C;
end;
InflateRect(R, -1, -1);
FrameRectEx(Canvas.Handle, R, C, True);
end;
R := R2;
InflateRect(R, -BorderSize.X, -BorderSize.Y);
Sz := GetSystemMetrics(SM_CYSMCAPTION);
if IsVertical then
begin
R.Bottom := R.Top + Sz - 1;
DrawLineEx(Canvas.Handle, R.Left, R.Bottom, R.Right, R.Bottom, C);
HeaderColor := clBtnFace;
R.Bottom := R.Bottom + 1;
GradientGlass(Canvas, R, false, TGTopBottom);
R.Bottom := R.Bottom - 1;
end
else
begin
R.Right := R.Left + Sz - 1;
DrawLineEx(Canvas.Handle, R.Right, R.Top, R.Right, R.Bottom, C);
HeaderColor := clBtnFace;
R.Right := R.Right + 1;
GradientGlass(Canvas, R, false, TGLeftRight);
R.Right := R.Right - 1;
end;
if (CDBS_VISIBLE and CloseButtonState) <> 0 then
begin
R2 := R;
if IsVertical then
begin
R2.Left := R2.Right - Sz + 1;
R.Right := R2.Left;
end
else
begin
R2.Top := R2.Bottom - Sz + 1;
R.Bottom := R2.Top;
end;
BtnItemState := GetBtnItemState(CloseButtonState);
if BtnItemState = bisHot then
begin
FrameRectEx(Canvas.Handle, R2, BtnItemColors[bisHot, ipFrame], True);
if IsVertical then
GradientGlass(Canvas, R2, true, TGTopBottom)
else
GradientGlass(Canvas, R2, true, TGLeftRight);
DrawButtonBitmap(Canvas, R2, clBlack);
end
else if BtnItemState = bisPressed then
begin
if IsVertical then
GradientFill(Canvas, R2, clWhite, clSilver, TGTopBottom)
else
GradientFill(Canvas, R2, clWhite, clSilver, TGLeftRight);
FrameRectEx(Canvas.Handle, R2, $00D0D0D0, True);
DrawButtonBitmap(Canvas, R2, clBlack);
end
else
begin
FrameRectEx(Canvas.Handle, R2, BtnItemColors[BtnItemState, ipFrame],
True);
DrawButtonBitmap(Canvas, R2, clBlack);
end;
end;
if IsVertical then
InflateRect(R, -4, 0)
else
InflateRect(R, 0, -4);
Font.Assign(SmCaptionFont);
Font.Color := clBlack;
Brush.Color := HeaderColor;
Brush.Style := bsClear;
Flags := DT_SINGLELINE or DT_VCENTER or DT_END_ELLIPSIS or DT_HIDEPREFIX;
if IsVertical then
DrawText(Canvas.Handle, Caption, -1, R, Flags)
else
DrawRotatedText(Canvas.Handle, string(Caption), R, Flags);
end;
end;
procedure TTBXAthenTheme.SetupColorCache;
var
DC: HDC;
HotBtnFace, DisabledText: TColor;
procedure Undither(var C: TColor);
begin
if C <> clNone then
C := GetNearestColor(DC, ColorToRGB(C));
end;
begin
DC := StockCompatibleBitmap.Canvas.Handle;
gradCol1 := clSilver;
gradCol2 := clWhite;
gradHandle1 := clBtnFace;
gradHandle2 := clGray;
gradHandle3 := clWhite;
gradBL := Blend(clGray, gradCol1, 30);
gradTL := Blend(gradCol1, gradCol2, 50);
{ View/Window Colors }
MenubarColor := clWhite;
ToolbarColor := gradCol2;
PopupColor := clWhite;
DockPanelColor := PopupColor;
PopupFrameColor := $00C0C0C0;
HotBtnFace := Blend(clHighlight, clWindow, 20);
SetContrast(HotBtnFace, ToolbarColor, 50);
DisabledText := Blend(clBtnshadow, clWindow, 90);
WinFrameColors[wfsActive, wfpBorder] := $00909090;
WinFrameColors[wfsActive, wfpCaption] := clWhite;
WinFrameColors[wfsActive, wfpCaptionText] := clBlack;
SetContrast(WinFrameColors[wfsActive, wfpCaptionText], clBtnShadow, 180);
WinFrameColors[wfsInactive, wfpBorder] := WinFrameColors[wfsActive,
wfpBorder];
WinFrameColors[wfsInactive, wfpCaption] := clBtnFace;
WinFrameColors[wfsInactive, wfpCaptionText] := DisabledText;
SetContrast(WinFrameColors[wfsInactive, wfpCaptionText], clBtnFace, 120);
PnlFrameColors[wfsActive, wfpBorder] := $00909090;
PnlFrameColors[wfsActive, wfpCaption] := clWhite;
PnlFrameColors[wfsActive, wfpCaptionText] := clBlack;
PnlFrameColors[wfsInactive, wfpBorder] := clBtnShadow;
PnlFrameColors[wfsInactive, wfpCaption] := clBtnFace;
PnlFrameColors[wfsInactive, wfpCaptionText] := DisabledText;
SetContrast(PnlFrameColors[wfsInactive, wfpCaptionText], clBtnFace, 120);
BtnItemColors[bisNormal, ipBody] := clNone;
BtnItemColors[bisNormal, ipText] := clBtnText;
SetContrast(BtnItemColors[bisNormal, ipText], ToolbarColor, 180);
BtnItemColors[bisNormal, ipFrame] := clNone;
BtnItemColors[bisDisabled, ipBody] := clNone;
BtnItemColors[bisDisabled, ipText] := DisabledText;
SetContrast(BtnItemColors[bisDisabled, ipText], ToolbarColor, 80);
BtnItemColors[bisDisabled, ipFrame] := $00D0D0D0;
BtnItemColors[bisSelected, ipBody] := Blend(clHighlight, Blend(clBtnFace,
clWindow, 50), 10);
SetContrast(BtnItemColors[bisSelected, ipBody], ToolbarColor, 5);
BtnItemColors[bisSelected, ipText] := BtnItemColors[bisNormal, ipText];
BtnItemColors[bisSelected, ipFrame] := $00D0D0D0;
BtnItemColors[bisPressed, ipBody] := Blend(clHighlight, clWindow, 30);
BtnItemColors[bisPressed, ipText] := clBlack;
BtnItemColors[bisPressed, ipFrame] := clRed;
BtnItemColors[bisHot, ipBody] := HotBtnFace;
BtnItemColors[bisHot, ipText] := clMenuText;
SetContrast(BtnItemColors[bisHot, ipText], BtnItemColors[bisHot, ipBody],
180);
BtnItemColors[bisHot, ipFrame] := Blend($00E0A030, $00D0D0D0, 60);
BtnItemColors[bisDisabledHot, ipBody] := HotBtnFace;
BtnItemColors[bisDisabledHot, ipText] := DisabledText;
BtnItemColors[bisDisabledHot, ipFrame] := clHighlight;
BtnItemColors[bisSelectedHot, ipBody] := Blend(clHighlight, clWindow, 50);
SetContrast(BtnItemColors[bisSelectedHot, ipBody], ToolbarColor, 30);
BtnItemColors[bisSelectedHot, ipText] := clBlack;
SetContrast(BtnItemColors[bisSelectedHot, ipText],
BtnItemColors[bisSelectedHot, ipBody], 180);
BtnItemColors[bisSelectedHot, ipFrame] := clHighlight;
SetContrast(BtnItemColors[bisSelectedHot, ipFrame],
BtnItemColors[bisSelectedHot, ipBody], 100);
BtnItemColors[bisPopupParent, ipBody] := ToolbarColor;
BtnItemColors[bisPopupParent, ipText] := BtnItemColors[bisNormal, ipText];
BtnItemColors[bisPopupParent, ipFrame] := Blend($00E0A030, $00D0D0D0, 60);
//PopupFrameColor;
MenuItemColors[misNormal, ipBody] := clNone;
MenuItemColors[misNormal, ipText] := clWindowText;
SetContrast(MenuItemColors[misNormal, ipText], PopupColor, 180);
MenuItemColors[misNormal, ipFrame] := clNone;
MenuItemColors[misDisabled, ipBody] := clNone;
MenuItemColors[misDisabled, ipText] := Blend(clGrayText, clWindow, 70);
SetContrast(MenuItemColors[misDisabled, ipText], PopupColor, 80);
MenuItemColors[misDisabled, ipFrame] := clNone;
MenuItemColors[misHot, ipBody] := BtnItemColors[bisHot, ipBody];
MenuItemColors[misHot, ipText] := BtnItemColors[bisHot, ipText];
MenuItemColors[misHot, ipFrame] := clSilver;
MenuItemColors[misDisabledHot, ipBody] := PopupColor;
MenuItemColors[misDisabledHot, ipText] := Blend(clGrayText, clWindow, 70);
MenuItemColors[misDisabledHot, ipFrame] := clHighlight;
DragHandleColor := Blend(clBtnShadow, clWindow, 75);
SetContrast(DragHandleColor, ToolbarColor, 85);
IconShadowColor := Blend(clBlack, HotBtnFace, 25);
ToolbarSeparatorColor := Blend(clBtnShadow, clWindow, 70);
SetContrast(ToolbarSeparatorColor, ToolbarColor, 50);
PopupSeparatorColor := ToolbarSeparatorColor;
StatusPanelFrameColor := Blend(clWindow, clBtnFace, 30);
SetContrast(StatusPanelFrameColor, clBtnFace, 30);
Undither(MenubarColor);
Undither(ToolbarColor);
Undither(PopupColor);
Undither(DockPanelColor);
Undither(PopupFrameColor);
Undither(WinFrameColors[wfsActive, wfpBorder]);
Undither(WinFrameColors[wfsActive, wfpCaption]);
Undither(WinFrameColors[wfsActive, wfpCaptionText]);
Undither(WinFrameColors[wfsInactive, wfpBorder]);
Undither(WinFrameColors[wfsInactive, wfpCaption]);
Undither(WinFrameColors[wfsInactive, wfpCaptionText]);
Undither(PnlFrameColors[wfsActive, wfpBorder]);
Undither(PnlFrameColors[wfsActive, wfpCaption]);
Undither(PnlFrameColors[wfsActive, wfpCaptionText]);
Undither(PnlFrameColors[wfsInactive, wfpBorder]);
Undither(PnlFrameColors[wfsInactive, wfpCaption]);
Undither(PnlFrameColors[wfsInactive, wfpCaptionText]);
Undither(BtnItemColors[bisNormal, ipBody]);
Undither(BtnItemColors[bisNormal, ipText]);
Undither(BtnItemColors[bisNormal, ipFrame]);
Undither(BtnItemColors[bisDisabled, ipBody]);
Undither(BtnItemColors[bisDisabled, ipText]);
Undither(BtnItemColors[bisDisabled, ipFrame]);
Undither(BtnItemColors[bisSelected, ipBody]);
Undither(BtnItemColors[bisSelected, ipText]);
Undither(BtnItemColors[bisSelected, ipFrame]);
Undither(BtnItemColors[bisPressed, ipBody]);
Undither(BtnItemColors[bisPressed, ipText]);
Undither(BtnItemColors[bisPressed, ipFrame]);
Undither(BtnItemColors[bisHot, ipBody]);
Undither(BtnItemColors[bisHot, ipText]);
Undither(BtnItemColors[bisHot, ipFrame]);
Undither(BtnItemColors[bisDisabledHot, ipBody]);
Undither(BtnItemColors[bisDisabledHot, ipText]);
Undither(BtnItemColors[bisDisabledHot, ipFrame]);
Undither(BtnItemColors[bisSelectedHot, ipBody]);
Undither(BtnItemColors[bisSelectedHot, ipText]);
Undither(BtnItemColors[bisSelectedHot, ipFrame]);
Undither(BtnItemColors[bisPopupParent, ipBody]);
Undither(BtnItemColors[bisPopupParent, ipText]);
Undither(BtnItemColors[bisPopupParent, ipFrame]);
Undither(MenuItemColors[misNormal, ipBody]);
Undither(MenuItemColors[misNormal, ipText]);
Undither(MenuItemColors[misNormal, ipFrame]);
Undither(MenuItemColors[misDisabled, ipBody]);
Undither(MenuItemColors[misDisabled, ipText]);
Undither(MenuItemColors[misDisabled, ipFrame]);
Undither(MenuItemColors[misHot, ipBody]);
Undither(MenuItemColors[misHot, ipText]);
Undither(MenuItemColors[misHot, ipFrame]);
Undither(MenuItemColors[misDisabledHot, ipBody]);
Undither(MenuItemColors[misDisabledHot, ipText]);
Undither(MenuItemColors[misDisabledHot, ipFrame]);
Undither(DragHandleColor);
Undither(IconShadowColor);
Undither(ToolbarSeparatorColor);
Undither(PopupSeparatorColor);
Undither(StatusPanelFrameColor);
end;
function TTBXAthenTheme.GetPopupShadowType: Integer;
begin
Result := PST_WINDOWS2K;
end;
constructor TTBXAthenTheme.Create(const AName: string);
begin
inherited;
if CounterLock = 0 then
InitializeStock;
Inc(CounterLock);
AddTBXSysChangeNotification(Self);
SetupColorCache;
end;
destructor TTBXAthenTheme.Destroy;
begin
RemoveTBXSysChangeNotification(Self);
Dec(CounterLock);
if CounterLock = 0 then
FinalizeStock;
inherited;
end;
procedure TTBXAthenTheme.GetViewMargins(ViewType: Integer;
out Margins: TTBXMargins);
begin
Margins.LeftWidth := 0;
Margins.TopHeight := 0;
Margins.RightWidth := 0;
Margins.BottomHeight := 0;
end;
procedure TTBXAthenTheme.PaintPageScrollButton(Canvas: TCanvas;
const ARect: TRect; ButtonType: Integer; Hot: Boolean);
var
R: TRect;
X, Y, Sz: Integer;
begin
R := ARect;
InflateRect(R, -1, -1);
if Hot then
begin
GradientGlass(Canvas, R, true, TGTopBottom);
Canvas.Pen.Color := BtnItemColors[bisHot, ipFrame];
end
else
begin
Canvas.Brush.Color := clWhite;
Canvas.FillRect(R);
Canvas.Pen.Color := $00D0D0D0;
end;
InflateRect(R, 1, 1);
RoundFrame(Canvas, R, 1, 1);
Canvas.Pen.Color := clBtnFace;
with R do
begin
Canvas.Pixels[Left, Top] := clBtnFace;
Canvas.Pixels[Right + 1, Top] := clBtnFace;
Canvas.Pixels[Right + 1, Bottom + 1] := clBtnFace;
Canvas.Pixels[Left, Bottom + 1] := clBtnFace;
end;
{ Arrow }
X := (R.Left + R.Right) div 2;
Y := (R.Top + R.Bottom) div 2;
Sz := Min(X - R.Left, Y - R.Top) * 3 div 4;
Canvas.Pen.Color := clBtnText;
Canvas.Brush.Color := Canvas.Pen.Color;
case ButtonType of
PSBT_UP:
begin
Inc(Y, Sz div 2);
Canvas.Polygon([Point(X + Sz, Y), Point(X, Y - Sz), Point(X - Sz, Y)]);
end;
PSBT_DOWN:
begin
Y := (R.Top + R.Bottom - 1) div 2;
Dec(Y, Sz div 2);
Canvas.Polygon([Point(X + Sz, Y), Point(X, Y + Sz), Point(X - Sz, Y)]);
end;
PSBT_LEFT:
begin
Inc(X, Sz div 2);
Canvas.Polygon([Point(X, Y + Sz), Point(X - Sz, Y), Point(X, Y - Sz)]);
end;
PSBT_RIGHT:
begin
X := (R.Left + R.Right - 1) div 2;
Dec(X, Sz div 2);
Canvas.Polygon([Point(X, Y + Sz), Point(X + Sz, Y), Point(X, Y - Sz)]);
end;
end;
end;
procedure TTBXAthenTheme.PaintFrameControl(Canvas: TCanvas; R: TRect; Kind,
State: Integer; Params: Pointer);
type
PRGBTripleArray = ^TRGBTripleArray;
TRGBTripleArray = array[0..1024] of TRGBTriple;
TGradientColors = array[0..255] of TRGBTriple;
const
Offs: array[0..10] of integer = (3, 1, 1, 0, 0, 0, 0, 0, 1, 1, 3);
var
X, Y: Integer;
rc1, gc1, bc1, rc2, gc2, bc2, rc3, gc3, bc3,
y1, i, GSize: Integer;
Row: PRGBTripleArray;
GradCol: TRGBTriple;
Brush: HBrush;
procedure RadioGradient(const DC: HDC; const ARect: TRect;
const StartColor, EndColor: TColor;
const NewG, Aqua: Boolean);
var
GSize: Integer;
rc1, rc2, gc1, gc2, bc1, bc2, rc3, gc3, bc3, rc4, gc4, bc4,
r, g, b, y1, Counter, i, d1, d2, d3: Integer;
Brush: HBrush;
begin
if Aqua then
begin
rc1 := $F0;
rc2 := $80;
rc3 := $70;
rc4 := $B0;
gc1 := $F8;
gc2 := $B0;
gc3 := $E8;
gc4 := $FF;
bc1 := $FF;
bc2 := $E0;
bc3 := $F0;
bc4 := $FF;
end
else
begin
rc1 := $F0;
rc2 := $C0;
rc3 := $D8;
rc4 := $F0;
gc1 := $F0;
gc2 := $C0;
gc3 := $D8;
gc4 := $F0;
bc1 := $F0;
bc2 := $C0;
bc3 := $D8;
bc4 := $F0;
end;
if NewG then
begin
GSize := (ARect.Bottom - ARect.Top) - 1;
y1 := GSize div 3;
d1 := y1;
d2 := y1 + y1;
for i := 0 to y1 do
begin
r := rc1 + (((rc2 - rc1) * (i)) div y1);
g := gc1 + (((gc2 - gc1) * (i)) div y1);
b := bc1 + (((bc2 - bc1) * (i)) div y1);
if r < 0 then
r := 0
else if r > 255 then
r := 255;
if g < 0 then
g := 0
else if g > 255 then
g := 255;
if b < 0 then
b := 0
else if b > 255 then
b := 255;
Brush := CreateSolidBrush(
RGB(r, g, b));
Windows.FillRect(DC, Rect(ARect.Left + Offs[i], ARect.Top + i,
ARect.Right - Offs[i], ARect.Top + i + 1), Brush);
DeleteObject(Brush);
end;
for i := y1 to d2 do
begin
r := rc2 + (((rc3 - rc2) * (i - d1)) div y1);
g := gc2 + (((gc3 - gc2) * (i - d1)) div y1);
b := bc2 + (((bc3 - bc2) * (i - d1)) div y1);
if r < 0 then
r := 0
else if r > 255 then
r := 255;
if g < 0 then
g := 0
else if g > 255 then
g := 255;
if b < 0 then
b := 0
else if b > 255 then
b := 255;
Brush := CreateSolidBrush(
RGB(r, g, b));
Windows.FillRect(DC, Rect(ARect.Left + Offs[i], ARect.Top + i,
ARect.Right - Offs[i], ARect.Top + i + 1), Brush);
DeleteObject(Brush);
end;
for i := d2 to GSize do
begin
r := rc3 + (((rc4 - rc3) * (i - d2)) div y1);
g := gc3 + (((gc4 - gc3) * (i - d2)) div y1);
b := bc3 + (((bc4 - bc3) * (i - d2)) div y1);
if r < 0 then
r := 0
else if r > 255 then
r := 255;
if g < 0 then
g := 0
else if g > 255 then
g := 255;
if b < 0 then
b := 0
else if b > 255 then
b := 255;
Brush := CreateSolidBrush(
RGB(r, g, b));
Windows.FillRect(DC, Rect(ARect.Left + Offs[i], ARect.Top + i,
ARect.Right - Offs[i], ARect.Top + i + 1), Brush);
DeleteObject(Brush);
end;
end
else
begin
rc1 := GetRValue(ColorToRGB(StartColor));
gc1 := GetGValue(ColorToRGB(StartColor));
bc1 := GetBValue(ColorToRGB(StartColor));
rc2 := GetRValue(ColorToRGB(EndColor));
gc2 := GetGValue(ColorToRGB(EndColor));
bc2 := GetBValue(ColorToRGB(EndColor));
rc3 := rc2 + (((rc1 - rc2) * 15) div 9);
gc3 := gc2 + (((gc1 - gc2) * 15) div 9);
bc3 := bc2 + (((bc1 - bc2) * 15) div 9);
if rc3 < 0 then
rc3 := 0
else if rc3 > 255 then
rc3 := 255;
if gc3 < 0 then
gc3 := 0
else if gc3 > 255 then
gc3 := 255;
if bc3 < 0 then
bc3 := 0
else if bc3 > 255 then
bc3 := 255;
GSize := (ARect.Bottom - ARect.Top) - 1;
y1 := GSize div 2;
for i := 0 to y1 - 1 do
begin
Brush := CreateSolidBrush(
RGB(Byte(rc2 + (((rc1 - rc2) * i) div y1)),
Byte(gc2 + (((gc1 - gc2) * i) div y1)),
Byte(bc2 + (((bc1 - bc2) * i) div y1))));
Windows.FillRect(Canvas.Handle, Rect(ARect.Left + Offs[i], ARect.Top +
i, ARect.Right - Offs[i], ARect.Top + i + 1), Brush);
DeleteObject(Brush);
end;
if rc1 > rc2 then
begin
rc3 := rc1;
gc3 := gc1;
bc3 := bc1;
end;
for i := y1 to GSize do
begin
Brush := CreateSolidBrush(
RGB(Byte(rc3 + (((rc1 - rc3) * i) div GSize)),
Byte(gc3 + (((gc1 - gc3) * i) div GSize)),
Byte(bc3 + (((bc1 - bc3) * i) div GSize))));
Windows.FillRect(Canvas.Handle, Rect(ARect.Left + Offs[i], ARect.Top +
i, ARect.Right - Offs[i], ARect.Top + i + 1), Brush);
DeleteObject(Brush);
end;
end;
end;
function TextColor: TColor;
begin
if Boolean(State and PFS_DISABLED) then
Result := BtnItemColors[bisDisabled, ipText]
else if Boolean(State and PFS_PUSHED) then
Result := BtnItemColors[bisPressed, ipText]
else if Boolean(State and PFS_MIXED) then
Result := clBtnShadow
else if Boolean(State and PFS_HOT) then
Result := BtnItemColors[bisHot, ipText]
else
Result := BtnItemColors[bisNormal, ipText];
end;
begin
with Canvas do
case Kind of
PFC_CHECKBOX:
begin
if Boolean(State and PFS_HOT) then
begin
InflateRect(R, -1, -1);
if Boolean(State and PFS_PUSHED) then
begin
if Boolean(State and (PFS_CHECKED or PFS_MIXED)) then
GradientFill(Canvas, R, clWhite, clSilver,
TGTopBottom)
else
GradientFill(Canvas, R, clWhite, clSilver,
TGTopBottom);
Pen.Color := clSilver;
end
else if Boolean(State and (PFS_CHECKED or PFS_MIXED)) then
begin
if 1 = 1 then
begin
GradientGlass(Canvas, R, true, TGTopBottom);
Pen.Color := BtnItemColors[bisHot, ipFrame];
end
else
begin
GradientGlass(Canvas, R, true, TGTopBottom);
Pen.Color := clSilver;
end;
end
else
begin
GradientGlass(Canvas, R, true, TGTopBottom);
Pen.Color := BtnItemColors[bisHot, ipFrame];
end;
InflateRect(R, 1, 1);
RoundFrame(Canvas, R, 1, 1);
end
else
begin
if Boolean(State and (PFS_CHECKED or PFS_MIXED)) then
begin
InflateRect(R, -1, -1);
GradientGlass(Canvas, R, true, TGTopBottom);
//Pen.Color := BtnItemColors[bisSelected, ipFrame]; //clSilver;
Pen.Color := BtnItemColors[bisHot, ipFrame]; //clSilver;
InflateRect(R, 1, 1);
end
else
begin
InflateRect(R, -1, -1);
GradientFill(Canvas, R, clWhite, clSilver,
TGTopBottom);
Pen.Color := clSilver;
InflateRect(R, 1, 1);
end;
RoundFrame(Canvas, R, 1, 1);
Pen.Style := psSolid;
Brush.Style := bsSolid;
end;
if Boolean(State and (PFS_CHECKED or PFS_MIXED)) then
begin
X := (R.Left + R.Right) div 2 - 1;
Y := (R.Top + R.Bottom) div 2 + 1;
Pen.Color := TextColor;
Brush.Color := Pen.Color;
Polygon([Point(X - 2, Y), Point(X, Y + 2), Point(X + 4, Y - 2),
Point(X + 4, Y - 4), Point(X, Y), Point(X - 2, Y - 2), Point(X -
2, Y)]);
end;
end;
PFC_RADIOBUTTON:
begin
if Boolean(State and PFS_HOT) then
begin
InflateRect(R, -1, -1);
if Boolean(State and PFS_PUSHED) then
begin
if Boolean(State and (PFS_CHECKED or PFS_MIXED)) then
RadioGradient(Canvas.Handle, R, clWhite, clSilver, false, false)
else
RadioGradient(Canvas.Handle, R, clWhite, clSilver, false,
false);
Pen.Color := clSilver;
end
else if Boolean(State and (PFS_CHECKED or PFS_MIXED)) then
begin
if 1 = 1 then
begin
RadioGradient(Canvas.Handle, R, clNavy, clWhite, true, true);
Pen.Color := BtnItemColors[bisHot, ipFrame];
end
else
begin
RadioGradient(Canvas.Handle, R, clWhite, clNavy, false, true);
Pen.Color := clSilver;
end;
end
else
begin
RadioGradient(Canvas.Handle, R, clNavy, clWhite, true, true);
Pen.Color := BtnItemColors[bisHot, ipFrame];
end;
InflateRect(R, 1, 1);
Brush.Style := bsClear;
X := R.Left;
Y := R.Top;
Polygon([Point(X, Y + 8), Point(X, Y + 4), Point(X + 1, Y + 3),
Point(X + 1, Y + 2), Point(X + 2, Y + 1), Point(X + 3, Y + 1),
Point(X + 4, Y), Point(X + 8, Y), Point(X + 9, Y + 1),
Point(X + 10, Y + 1), Point(X + 11, Y + 2), Point(X + 11, Y +
3),
Point(X + 12, Y + 4), Point(X + 12, Y + 8), Point(X + 11, Y +
9),
Point(X + 11, Y + 10), Point(X + 10, Y + 11), Point(X + 9, Y +
11),
Point(X + 8, Y + 12), Point(X + 4, Y + 12), Point(X + 3, Y +
11),
Point(X + 2, Y + 11), Point(X + 1, Y + 10), Point(X + 1, Y +
9)]);
end
else
begin
if Boolean(State and (PFS_CHECKED or PFS_MIXED)) then
begin
InflateRect(R, -1, -1);
RadioGradient(Canvas.Handle, R, clWhite, clSilver, true, true);
Pen.Color := BtnItemColors[bisSelected, ipFrame];
InflateRect(R, 1, 1);
end
else
begin
InflateRect(R, -1, -1);
RadioGradient(Canvas.Handle, R, clWhite, clSilver, false, false);
Pen.Color := clSilver;
InflateRect(R, 1, 1);
end;
Brush.Style := bsClear;
X := R.Left;
Y := R.Top;
Polygon([Point(X, Y + 8), Point(X, Y + 4), Point(X + 1, Y + 3),
Point(X + 1, Y + 2), Point(X + 2, Y + 1), Point(X + 3, Y + 1),
Point(X + 4, Y), Point(X + 8, Y), Point(X + 9, Y + 1),
Point(X + 10, Y + 1), Point(X + 11, Y + 2), Point(X + 11, Y +
3),
Point(X + 12, Y + 4), Point(X + 12, Y + 8), Point(X + 11, Y +
9),
Point(X + 11, Y + 10), Point(X + 10, Y + 11), Point(X + 9, Y +
11),
Point(X + 8, Y + 12), Point(X + 4, Y + 12), Point(X + 3, Y +
11),
Point(X + 2, Y + 11), Point(X + 1, Y + 10), Point(X + 1, Y +
9)]);
end;
InflateRect(R, -1, -1);
Pen.Style := psSolid;
Brush.Style := bsClear;
if Boolean(State and PFS_CHECKED) then
begin
InflateRect(R, -3, -3);
Pen.Color := TextColor;
Brush.Color := Pen.Color;
with R do
Ellipse(Left, Top, Right, Bottom);
end;
end;
end;
end;
procedure TTBXAthenTheme.PaintStatusBar(Canvas: TCanvas; R: TRect; Part:
Integer);
var
Hi, Lo: TColor;
D, Sz, i: Integer;
procedure DiagLine(C: TColor);
begin
with R do
DrawLineEx(Canvas.Handle, Right - 1 - D, Bottom - 1, Right, Bottom - D -
2, C);
Inc(D);
end;
begin
with Canvas do
case Part of
SBP_BODY:
begin
GradientGlass(Canvas, R, false, TGTopBottom);
end;
SBP_PANE, SBP_LASTPANE:
begin
if Part = SBP_PANE then
Dec(R.Right, 3);
DrawLineEx(Canvas.Handle, R.Right, R.Top + 4, R.Right, R.Bottom - 3,
clBtnShadow);
DrawLineEx(Canvas.Handle, R.Right + 1, R.Top + 5, R.Right + 1, R.Bottom
- 2, clBtnHighLight);
end;
SBP_GRIPPER:
begin
Sz := Min(R.Right - R.Left, R.Bottom - R.Top);
Lo := NearestMixedColor(clBtnFace, clBtnHighlight, 64);
Hi := NearestMixedColor(clBtnFace, clBtnShadow, 64);
D := 2;
for I := 1 to 3 do
begin
case Sz of
0..8:
begin
DiagLine(Lo);
DiagLine(Hi);
end;
9..12:
begin
DiagLine(Lo);
DiagLine(Hi);
Inc(D);
end;
else
DiagLine(Lo);
Inc(D, 1);
DiagLine(Hi);
Inc(D, 1);
end;
end;
end;
end;
end;
procedure TTBXAthenTheme.TBXSysCommand(var Message: TMessage);
begin
if Message.WParam = TSC_VIEWCHANGE then
SetupColorCache;
end;
initialization
RegisterTBXTheme('Athen', TTBXAthenTheme);
end.
| 31.649689 | 100 | 0.592632 |
c351d90a002a1e9e7969c66b2fed3ae2a0ccd627 | 832 | dfm | Pascal | Unit5.dfm | jerfweb/TabelasProtheus | 7e7178706efe1e67dea122be57a3655a1ad6cfd4 | [
"MIT"
]
| 3 | 2019-01-04T18:45:56.000Z | 2019-05-03T16:49:37.000Z | Unit5.dfm | jerfweb/TabelasProtheus | 7e7178706efe1e67dea122be57a3655a1ad6cfd4 | [
"MIT"
]
| 1 | 2019-01-03T12:08:38.000Z | 2021-08-04T19:27:40.000Z | Unit5.dfm | glauberlima/TabelasProtheus | 7e7178706efe1e67dea122be57a3655a1ad6cfd4 | [
"MIT"
]
| 2 | 2015-01-16T17:04:29.000Z | 2019-01-04T18:45:44.000Z | object frmIndexar: TfrmIndexar
Left = 331
Top = 232
BorderIcons = []
BorderStyle = bsSingle
Caption = 'Indexando tabela...'
ClientHeight = 50
ClientWidth = 285
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poMainFormCenter
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 10
Top = 8
Width = 36
Height = 13
Caption = 'Tabela:'
end
object lbTabela: TLabel
Left = 10
Top = 24
Width = 265
Height = 13
AutoSize = False
Caption = '###'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = [fsBold]
ParentFont = False
end
end
| 20.292683 | 34 | 0.638221 |
47c72bd5b32483ab30a266115a2c55e3d06365d6 | 737 | dfm | Pascal | 21-web-UniGui-HelloWorld/Main.dfm | DeveloppeurPascal/demos-Paris-20180329 | 7be51a86a96462eaf08844450a56de2d92f93311 | [
"MIT"
]
| 5 | 2020-03-17T16:10:02.000Z | 2021-11-16T11:24:57.000Z | 21-web-UniGui-HelloWorld/Main.dfm | DeveloppeurPascal/demos-Paris-20180329 | 7be51a86a96462eaf08844450a56de2d92f93311 | [
"MIT"
]
| null | null | null | 21-web-UniGui-HelloWorld/Main.dfm | DeveloppeurPascal/demos-Paris-20180329 | 7be51a86a96462eaf08844450a56de2d92f93311 | [
"MIT"
]
| 5 | 2020-02-17T17:59:23.000Z | 2021-04-12T02:21:05.000Z | object MainForm: TMainForm
Left = 0
Top = 0
ClientHeight = 242
ClientWidth = 472
Caption = 'MainForm'
OldCreateOrder = False
MonitoredKeys.Keys = <>
OnCreate = UniFormCreate
PixelsPerInch = 96
TextHeight = 13
object UniLabel1: TUniLabel
Left = 16
Top = 16
Width = 46
Height = 13
Hint = ''
Caption = 'UniLabel1'
TabOrder = 0
end
object UniEdit1: TUniEdit
Left = 16
Top = 43
Width = 121
Hint = ''
Text = 'UniEdit1'
TabOrder = 1
end
object UniBitBtn1: TUniBitBtn
Left = 16
Top = 84
Width = 75
Height = 25
Hint = ''
Caption = 'UniBitBtn1'
TabOrder = 2
OnClick = UniBitBtn1Click
end
end
| 18.425 | 32 | 0.571235 |
4796799fee0e24afee09ce06f267c05859f66baf | 30,310 | dfm | Pascal | references/jcl/jcl/experts/projectanalyzer/JclProjectAnalyzerFrm.dfm | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| 851 | 2018-02-05T09:54:56.000Z | 2022-03-24T23:13:10.000Z | references/jcl/jcl/experts/projectanalyzer/JclProjectAnalyzerFrm.dfm | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| 200 | 2018-02-06T18:52:39.000Z | 2022-03-24T19:59:14.000Z | references/jcl/jcl/experts/projectanalyzer/JclProjectAnalyzerFrm.dfm | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| 197 | 2018-03-20T20:49:55.000Z | 2022-03-21T17:38:14.000Z | object ProjectAnalyzerForm: TProjectAnalyzerForm
Left = 362
Top = 263
BorderIcons = [biSystemMenu]
BorderStyle = bsSizeToolWin
Caption = 'Project Analyzer'
ClientHeight = 459
ClientWidth = 595
Color = clBtnFace
Constraints.MinHeight = 250
Constraints.MinWidth = 290
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
ShowHint = True
OnCreate = FormCreate
OnDestroy = FormDestroy
PixelsPerInch = 96
TextHeight = 13
object UnitListView: TListView
Left = 0
Top = 40
Width = 595
Height = 400
Align = alClient
Columns = <
item
Caption = 'RsName'
ImageIndex = 0
Width = 150
end
item
Alignment = taRightJustify
Caption = 'RsSize'
Width = 70
end
item
Caption = 'RsGroup'
Width = 85
end
item
Caption = 'RsPackage'
Width = 90
end>
ReadOnly = True
RowSelect = True
PopupMenu = PopupMenuUnitView
SmallImages = ExplorerItemImages
TabOrder = 0
ViewStyle = vsReport
OnColumnClick = UnitListViewColumnClick
OnCompare = UnitListViewCompare
end
object ToolBarMain: TToolBar
Left = 0
Top = 0
Width = 595
Height = 40
AutoSize = True
ButtonHeight = 36
ButtonWidth = 95
Caption = 'ToolBarMain'
EdgeBorders = [ebTop, ebBottom]
Images = ExplorerItemImages
Indent = 4
PopupMenu = PopupMenuToolbar
ShowCaptions = True
TabOrder = 1
object ToolButtonCopy: TToolButton
Left = 4
Top = 0
Action = ActionCopy
end
object ToolButtonSave: TToolButton
Left = 99
Top = 0
Action = ActionSave
end
object ToolButtonSeparator1: TToolButton
Left = 194
Top = 0
Width = 8
ImageIndex = 3
Style = tbsSeparator
end
object ToolButtonDetails: TToolButton
Left = 202
Top = 0
Action = ActionShowDetails
Grouped = True
Style = tbsCheck
end
object ToolButtonSummary: TToolButton
Left = 297
Top = 0
Action = ActionShowSummary
Grouped = True
Style = tbsCheck
end
object ToolButtonDfms: TToolButton
Left = 392
Top = 0
Action = ActionShowDfms
Grouped = True
Style = tbsCheck
end
object ToolButtonSeparator2: TToolButton
Left = 487
Top = 0
Width = 8
ImageIndex = 18
Style = tbsSeparator
end
object ToolButtonShowPackages: TToolButton
Left = 495
Top = 0
Action = ActionShowPackages
end
end
object StatusBarMain: TStatusBar
Left = 0
Top = 440
Width = 595
Height = 19
Panels = <
item
Width = 50
end>
SimplePanel = False
end
object ExplorerItemImages: TImageList
Left = 8
Top = 392
Bitmap = {
494C010113001500040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000005000000001001000000000000028
0000000000000000000000000000000000000000000000000000000000000000
000000000000EF3D0000EF3DEF3D000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000FF0300000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000F75E0000F75EF75E000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000FF03
FF7FFF03FF031F00000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000F75EF75EF75EF75E000000000000FF7FFF7FFF7FFF7FFF7FFF7F
FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F00000000000000000000FF7F007CFF7F
FF7FFF03FF03FF03007CFF030000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7F00000000FF7F00000000
FF7F000000000000FF7F00000000FF7F0000000000000000FF7FFF03007CFF03
FF7FFF03FF031F00007C1F00FF03000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7FFF7FFF7FFF7FFF7FFF7F
FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F0000000000000000FF7FFF7F007CFF7F
FF7FFF03FF03FF03007CFF03FF03000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7FFF7FFF7FFF7FFF7FFF7F
FF7F0000FF7FFF7FFF7FFF7FFF7FFF7F00000000FF7F00000000FF7F00000000
FF7FFF7F00000000000000000000FF7F0000000000000000FF7FFF03007CFF03
FF7FFF03FF031F00007C1F00FF03000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7FFF7FFF7FFF7FFF7FFF7F
FF7F0000FF7FFF7FFF7FFF7FFF7FFF7F00000000FF7FFF03FF03FF03FF03FF03
FF7FFF7F0000FF7F007CFF7F1F00FF7F0000000000000000FF7FFF7F007CFF7F
FF7F1042FF03FF03007CFF03FF03000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7F00000000FF7F00000000
F75E00001F001F001F00007C1F001F0000000000FF7FFF7FFF7FFF7FFF7FFF7F
FF7FFF7F0000FF7F007CFF7F1F00FF7F0000000000000000FF7FFF03007C1042
10420000FF7F1000007C1F00FF03000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7FFF7FFF7FFF7FFF7FFF7F
FF7FFF7F00000000007C007C007C000000000000FF7F0000000000000000FF7F
FF7FFF7F0000FF7FFF7FFF7F1F00FF7F0000000000000000FF7F10421042FF7F
000010420000FF7F10001000FF03000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7F0000000000000000FF7F
0000FF7F0000007C007C007C007C007C00000000FF7F0000000000000000FF7F
FF7FFF7F0000FF7FFF7FFF7FFF7FFF7F00000000000010421042FF7FFF7F0000
1863104218630000FF7FFF7F1000100000000000000000000000000000000000
0000000000000000000000000000000000000000FF7FFF7FFF7FFF7FFF7FFF7F
FF7FFF7F007C007C007C007C007C007C007C0000FF7FFF7FFF7FFF7FFF7FFF7F
FF7FFF7FFF7FFF7FFF7FFF7FFF7FFF7F00000000FF7FFF7FFF7F000000001863
000000001863186300000000FF7FFF7FFF7F0000000000000000000000000000
0000000000000000000000000000000000000000FF7F00000000FF7F00000000
0000000000000000007C007C007C0000000000001F001F001F001F001F001F00
1F001F001F001F001F001F001F001F0000000000000000000000FF7F10420000
E07FE07F000010421042FF7F0000000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7FFF7FFF7FFF7F0000FF7F
FF7F000000000000007C007C007C000000000000F75EF75E1F001F001F001F00
1F001F001F001F001F001F00F75EF75E0000000000000000FF7FFF7F0000E07F
E07FE07FE07F0000FF7FFF7FFF7F000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7F0000F75EFF7F0000FF7F
000000000000EF3D007C007C007C000000000000000000000000000000000000
00000000000000000000000000000000000000000000FF7FFF7FFF7F0000E07F
E07FE07FE07F0000FF7FFF7FFF7FFF7F00000000000000000000000000000000
0000000000000000000000000000000000000000FF7FFF7FFF7FFF7F00000000
0000007C007C007C007C007C0000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000FF7FFF7F0000
E07FE07F0000FF7FFF7FFF7F0000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000FF7F
00000000FF7FFF7F000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
E07FEF3DFF7FFF7FFF7FFF7FFF7FE07F00000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
E07FEF3DFF7FFF7FFF7FFF7FFF7FE07F00000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000007C00400040
0000000000000000004000400000000000000000000000000000000000000000
E07FEF3DFF7FFF7FFF7FFF7FFF7FE07F00000000104210421042104210421042
1042104210421042104210421042104200000000000010421042104210421042
1042104210421042104210421042000000000000000000000000007C007C0040
004000000000007C007C00401042000000000000000000000000000000000000
E07FEF3DFF7FFF7FFF7FFF7FFF7FE07F000000001042FF7FE07F1863E07F1863
E07F1863E07F1863E07F1863E07F10420000000000001042FF7FE07F1863E07F
1863E07F1863E07F1863E07F10420000000000000000000000000000007C007C
00400000007C007C007C00401042000000000000000000000000000000000000
000000000000EF3DEF3D00000000EF3D000000001042FF7F1863E07F1863E07F
1863E07F1863E07F1863E07F18631042000000001042FF7FE07F1863E07F1863
E07F1863E07F1863E07F1863000010420000000000000000007C00001042007C
007C007C007C0040004000420000000000000000FF7FFF7FFF7FFF7FFF7FFF7F
FF7FFF7F000000000000EF3DEF3DE07F000000001042FF7FE07F1863E07F1863
E07F1863E07F1863E07F1863E07F1042000000001042FF7F1863E07F1863E07F
1863E07F1863E07F18631042000010420000000000000000007C007C0000007C
007C007C007CE07F004200420042000000000000FF7FFF7FFF7FFF7FFF7FFF7F
FF7FFF7F000000000000EF3DE07FE07F000000001042FF7F1863E07F1863E07F
1863E07F1863E07F1863E07F1863104200001042FF7F1863E07F1863E07F1863
E07F1863E07F1863E07F0000104210420000000000000000007C007C007C0000
007C007C007CE07F004200420042000000000000FF7F00000000FF7F00000000
0000FF7F000000000000007C00000000EF3D00001042FF7FE07F1863E07F1863
E07F1863E07F1863E07F1863E07F104200001042FF7FFF7FFF7FFF7FFF7FFF7F
FF7FFF7FFF7FFF7F10420000186310420000000000000000007C007C0040007C
007C007C007C0042004200000000000000000000FF7FFF7FFF7FFF7FFF7FFF7F
FF7FFF7F00000000007C007C007C0000000000001042FF7F1863E07F1863E07F
1863E07F1863E07F1863E07F1863104200001042104210421042104210421042
104210421042104210421042E07F10420000000000000000007C007C0040007C
007C007C00400040104210420000000000000000FF7F0000000000000000FF7F
0000FF7F0000007C007C007C007C007C000000001042FF7FE07F1863E07F1863
E07F1863E07F1863E07F1863E07F1042000000001042FF7F1863E07F1863E07F
1863E07F1863E07F1863E07F186310420000000000000000007C0040007C007C
007C007C007C0040004010420000000000000000FF7FFF7FFF7FFF7FFF7FFF7F
FF7FFF7F007C007C007C007C007C007C007C00001042FF7FFF7FFF7FFF7FFF7F
FF7FFF7FFF7FFF7FFF7FFF7FFF7F1042000000001042FF7FE07F1863E07F1863
E07F1863FF7FFF7FFF7FFF7FFF7F104200000000000000000000007C007C007C
007C1002007C007C004000400040000000000000FF7F00000000FF7F00000000
0000000000000000007C007C007C00000000000010421863E07F1863E07F1863
E07F1863104210421042104210421042000000001042FF7F1863E07F1863E07F
1863FF7F10421042104210421042104200000000000000000000007C007C007C
000000001F00007C007C007C0040000000000000FF7FFF7FFF7FFF7F0000FF7F
FF7F000000000000007C007C007C000000000000000010421863E07F1863E07F
186310420000000000000000000000000000000000001042FF7FFF7FFF7FFF7F
FF7F104200000000000000000000000000000000000000000000000000000000
0000100210021F001000007C0000000000000000FF7F0000F75EFF7F0000FF7F
000000000000EF3D007C007C007C000000000000000000001042104210421042
1042000000000000000000000000000000000000000000001042104210421042
1042000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000FF7FFF7FFF7FFF7F00000000
0000007C007C007C007C007C0000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000001042104210420000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000001863
1863104210420000000010421042104200000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000104210420000000000000000000000000000186318631863
1863104210421042104200000000104210420000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000010421042000000000000000018631863186318631863
1863104210421042104210420000104200000000000000000000000010421042
1042000000000000000000000000000000000000000000000000000010421042
1042000000000000000000000000000000000000000000000000000010420000
000000001042004200420000104200000000104218631863186318631863FF7F
FF7F104210421042104210420000000000000000000000000000000000000000
1042104200001042104210421042000000000000000000000000000000000000
104210420000104210421042104200000000000000000000007C000010421042
1042004200420042004200420000000000001042186318631863FF7FFF7F1042
1042FF7FFF7F1042104210420000000000000000000000000000E003E0030002
00001042E003E003E003E0031042000000000000000000000000E07FE07F0042
00001042E07FE07FE07FE07F104200000000000000000000007C007C00001042
10420042E07F00420042004200420000000010421863FF7FFF7F104210420000
104210420000FF7FFF7F1042000000000000000000000000E003E003E0030002
000010420002E003E003E003104200000000000000000000E07FE07FE07F0042
000010420042E07FE07FE07F104200000000000000000000007C007C007C0000
00000042E07FE07F004200420042000000001042FF7F10421042007C007C0042
00420042004200000000FF7F00000000000000001042E003E003E00310420002
000000000000E003E003E00310420000000000001042E07FE07FE07F10420042
000000000000E07FE07FE07F104200000000000000000000007C007C00400040
004000000000004200420000000000000000000010421042007C007C007C0042
E07F00420042004200000000000000000000000000001042E003104210420002
00020002E003E003E003E003104200000000000000001042E07F104210420042
00420042E07FE07FE07FE07F104200000000000000000000007C007C00400000
000010421042104210421042000000000000000000000000007C007C00400042
1042104200000000000000000000000000000000000000001042000010420002
0002E003E003E0030000E0030000000000000000000000001042000010420042
0042E07FE07FE07F0000E07F000000000000000000000000007C004000000000
10421F0010021F0000001042000000000000000000000000007C004000400000
0000000010421042104210420000000000000000000000000000000010420002
E003E003E0030000000000000000000000000000000000000000000010420042
E07FE07FE07F0000000000000000000000000000000000000000000000000000
0000100210021F00000010420000000000000000000000000040004000001042
186318631042104210421042104200000000000000000000000000001042E003
E003E0030000000000000000000000000000000000000000000000001042E07F
E07FE07F00000000000000000000000000000000000000000000000000000000
000000001F001F00000010420000000000000000000000001042186318631863
1863186310421042104210421042000000000000000000000000000000001042
E003000000000000000000000000000000000000000000000000000000001042
E07F000000000000000000000000000000000000000000000000000000000000
0000100210021F001000000000000000000000001042FF7F1863186318631863
1042104218631863186318630000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000001042FF7F186310421042
1863186318630000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000001042104218631863
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000104210421042000000000000000000000000000000000000
0000000000000000104210421042000000000000000000000000000000000000
0000000000000000000000000000000000000000000000001042000000001042
0000000010420000000010420000000000000000000000000000000000000000
0000000000000000000000001042104200000000000000000000000000000000
0000000000000000000000001042104200000000000000000000000000000000
0000104200000000000000000000000000000000000000001042000000001042
0000000010421042104210420000000000000000000000000000104200000000
0000000010420042004200420000104210420000000000000000104200000000
0000000010420042104200420000104200000000000000000000000010421042
1042186310420000000000000000000000000000104210420000104210420000
1042104200000000104210421042104200000000000000001042104210420000
0000000000420042004200420042000010420000000000001042104210420000
00000000004210420000000000420000104200000000000010421042FF7F1863
FF7F186310421042000000000000000000000000000000001042104200001042
0000104200420042000010420000000000000000007C00000000104210421042
1042004200420042004200420042000010420000007C00000000104210421042
1042004210420000000000000000000010420000000010421863FF7F1863FF7F
18631863104210421042000000000000000000000000007C0000104210421042
0042004200420042004200000000000000000000007C007C007C000010421042
10420042E07F0042004200420042004200000000007C1042007C000010421042
104200421042104200000000000000421042000000001042FF7F1863FF7F1863
FF7F1863104210421042104200000000000000001042007C007C000010421042
0042E07F00420042004200421042104200000000007C007C007C007C00000000
10420042E07FE07F004200420042004200000000007C10420000007C00000000
10420042E07F1042104200000000004200000000000010421863FF7FFF7F1863
18631863104210421042104200000000000000000000007C007C007C00000000
0042E07FE07F0042004200420000000000000000007C007C007C004000400040
000000001042E07FE07F00420042000000000000007C10420000000010421042
000000000000E07F10421042004200000000000000001042FF7F186318631863
18631863186310421042104200000000000000000000007C007C004000400040
0000000000420042000010420000000000000000007C007C0040004000400040
0000000000000042004200420000000000000000007C10421042104200400040
0000000000000042004200420000000000000000000010421863186318631863
18631863186318631042104200000000000000001042007C007C004010420000
1042104210421042104200001042104200000000007C007C0040004000000000
1042104210421042104210421042000000000000007C10420040004000000000
1042104210421042104210421042000000000000000010421863186318631863
18631863186318631042104200000000000000000000007C0040000000001042
1F0010021F000000104210420000000000000000007C00400000000000001042
00001F0010021F001F0000001042000000000000007C00400000000000001042
10421F0010021F001F0000001042000000000000000000001042186318631863
1863186318631863186310421042000000000000000000001042000000001042
100210021F000000104210420000000000000000000000000000000000000000
FF0300001F001F001F000000104200000000000000000000000000000000FF03
1042000000000000000000001042000000000000000000000000104218631863
1863186318631042104200000000000000000000104210420000104210420000
10421F001F000000104200001042104200000000000000000000000000000000
0000100210021F001F0000001042000000000000000000000000000000000000
1042000000000000000000001042000000000000000000000000000010421863
1863104210420000000000000000000000000000000000001042000000001042
100210021F001000000010420000000000000000000000000000000000000000
FF0300001F001F001F000000104200000000000000000000000000000000FF03
1042000000000000000000001042000000000000000000000000000000001042
1042000000000000000000000000000000000000000000001042000000001042
0000000010420000000010420000000000000000000000000000000000000000
0000100210021F001F0010000000000000000000000000000000000000000000
1042104210421042104210000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
FF03FF03FF03FF03FF03FF030000000000000000000000000000000000000000
FF03FF03FF03FF03FF03FF030000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000001042104210420000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000001863
1863104210420000000010421042104200000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000186318631863
1863104210421042104200000000104210420000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000018631863186318631863
1863104210421042104210420000104200000000000000000000000010421042
1042000000000000000000000000000000000000000000000000000000000000
1042FF7F00000000000000000000000000000000000000000000FF7FFF7FFF7F
FF7FFF7FFF7FFF7FFF7F0000000000000000104218631863186318631863FF7F
FF7F104210421042104210420000000000000000000000000000000000000000
1042104200001042104210421042000000000000000000000000000000001042
1042FF7FFF7F0000000000000000000000000000000000000000104210420000
000000000000FF7FFF7F00000000000000001042186318631863FF7FFF7F1042
1042FF7FFF7F104210421042000000000000000000000000007C000010420002
00001042E003E003E003E0031042000000000000000000000000000000001042
00000000FF7F0000000000000000000000000000000000000000000010420000
000000000000FF7F0000000000000000000010421863FF7FFF7F104210420000
104210420000FF7FFF7F1042000000000000000000000000007C007C00001042
E07F10420002E003E003E0031042000000000000000000000000000010421042
00000000FF7FFF7F000000000000000000000000000000000000000010421042
00000000FF7FFF7F000000000000000000001042FF7F10421042007C007C0042
00420042004200000000FF7F00000000000000001042007C007C007C00000000
E07F00000000E003E003E0031042000000000000000000000000000010420000
000000000000FF7F000000000000000000000000000000000000000000001042
00000000FF7F000000000000000000000000000010421042007C007C007C0042
E07F00420042004210421042000000000000000000001042007C007C007C0000
00000002E003E003E003E0031042000000000000000000000000104210420000
000000000000FF7FFF7F00000000000000000000000000000000000000001042
1042FF7FFF7F000000000000000000000000000000000000007C007C00400042
E07FE07F0042004200420000000000000000000000000000007C007C00400040
0040E003E003E0031002E0030000000000000000000000000000104210421042
1042104210421042104200000000000000000000000000000000000000000000
1042FF7F0000000000000000000000000000000000000000007C007C00401042
104200420042000000000000000000000000000000000000007C004010420002
E003E003E0031F00000010420000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000007C00401F001002
1F0000000000000000000000000000000000000000000000000000001042E003
E003E00310021F00000010420000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000010021002
1F00000000000000000000000000000000000000000000000000000000001042
E00310021F001F00000010420000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000001F00
1F00000000000000000000000000000000000000000000000000000000000000
0000100210021F00100000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000010021002
1F00100000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000424D3E000000000000003E000000
2800000040000000500000000100010000000000800200000000000000000000
000000000000000000000000FFFFFF00FF00FFFFFC1F0000FF000000F0070000
FF000000C0010000FF000000C001000000000000C001000000000000C0010000
00000000C001000000000000C001000000230000C00100000001000080000000
0000000000000000002300008000000000630000C001000000C3000080000000
0107FFFFC001000003FFFFFFF0070000FFFFFFFFFFFFFC00FFFFFFFFFFFFFC00
C000E000F1E7FC008000C000F0C3FC008000C000F883000080008000E0030000
80008000E003000080000000E003000080000000E00F002380000000E0070001
80008000E007000080008000F003002380018001F1830063C07FC07FFF0700C3
E0FFE0FFFFFF0107FFFFFFFFFFFF03FFFFFFFC07FFFFFFFFFFFFF001FFFFFFFF
FFE7C000FFFFFFFFFFC30001F8FFF8FFFB830003F043F043E0030003E003E003
E0030003C003C003E003000380038003E0CF8007C003C003E307E003E817E817
E607E001F83FF83FFF07E001F87FF87FFF87C003FCFFFCFFFF0F8007FFFFFFFF
FFFFC03FFFFFFFFFFFFFE1FFFFFFFFFFFFFFFFFFFFE3FFE3FFFFEDB7FFC1FFC1
FF3FED87F780F781F81F8001E380E398E00FE5078000803CC007C0078001801C
C00380018001900DC003C007808398C3C003C19781C781C7C003800186038603
C003CC079D039C03E003EC07FE83FCF3F00F8001FF03FEF3F83FEC17FE83FCF3
FCFFEDB7FF07FE07FFFFFFFFFE07FE07FFFFFFFFFC07FFFFFFFFFFFFF001FFFF
FFFFFFFFC000FFFFFFFFFFFF0001F8FFFE7FF00F0003F043FC3FF3CF0003E003
FDBFFBDF0003C003F99FF99F00038003FBDFFDBF8007C003F3CFFC3FE00FE007
F00FFE7FE03FE007FFFFFFFFE07FF807FFFFFFFFF87FFC07FFFFFFFFFC7FFF0F
FFFFFFFFF87FFFFFFFFFFFFFFFFFFFFF00000000000000000000000000000000
000000000000}
end
object ActionListProjectAnalyser: TActionList
Images = ExplorerItemImages
Left = 40
Top = 392
object ActionCopy: TAction
Caption = 'RsCopy'
Hint = 'Copy to clipboard'
ImageIndex = 15
OnExecute = ActionCopyExecute
end
object ActionSave: TAction
Caption = 'RsSave'
Hint = 'Save to text file'
ImageIndex = 16
OnExecute = ActionSaveExecute
end
object ActionShowDetails: TAction
Tag = 1
Caption = 'RsDetails'
Hint = 'Detailed view'
ImageIndex = 3
OnExecute = ActionShowDetailsExecute
OnUpdate = ActionShowDetailsUpdate
end
object ActionShowSummary: TAction
Tag = 1
Caption = 'RsSummary'
Checked = True
Hint = 'Summary view'
ImageIndex = 2
OnExecute = ActionShowSummaryExecute
OnUpdate = ActionShowSummaryUpdate
end
object ActionShowDfms: TAction
Tag = 1
Caption = 'RsForms'
Hint = 'Forms list'
ImageIndex = 17
OnExecute = ActionShowDfmsExecute
OnUpdate = ActionShowDfmsUpdate
end
object ActionShowPackages: TAction
Caption = 'RsShowPackages'
Checked = True
ImageIndex = 18
OnExecute = ActionShowPackagesExecute
OnUpdate = ActionShowPackagesUpdate
end
end
object PopupMenuUnitView: TPopupMenu
Left = 72
Top = 392
object MenuItemDetails: TMenuItem
Action = ActionShowDetails
end
object MenuItemSummary: TMenuItem
Action = ActionShowSummary
end
object MenuItemDfms: TMenuItem
Action = ActionShowDfms
end
object MenuItemSeparator: TMenuItem
Caption = '-'
end
object MenuItemCopy: TMenuItem
Action = ActionCopy
end
object MenuItemSave: TMenuItem
Action = ActionSave
end
end
object PopupMenuToolbar: TPopupMenu
Left = 104
Top = 392
object TextLabelsItem: TMenuItem
Caption = 'RsTextLabels'
Checked = True
OnClick = TextLabelsItemClick
end
end
object SaveDialogProjectAnalyser: TSaveDialog
DefaultExt = 'txt'
Filter = 'Text files (*.txt)|*.txt|All Files (*.*)|*.*'
Options = [ofOverwritePrompt, ofHideReadOnly, ofPathMustExist, ofEnableSizing]
Left = 136
Top = 392
end
end
| 52.897033 | 83 | 0.837644 |
47fe04c7729733ceace03a7a889ec064bf193298 | 3,944 | pas | Pascal | Components/JVCL/qexamples/JvDSADialogs/DSAExamplesCustom2.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| null | null | null | Components/JVCL/qexamples/JvDSADialogs/DSAExamplesCustom2.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| null | null | null | Components/JVCL/qexamples/JvDSADialogs/DSAExamplesCustom2.pas | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| 1 | 2019-12-24T08:39:18.000Z | 2019-12-24T08:39:18.000Z | {******************************************************************************}
{* WARNING: JEDI VCL To CLX Converter generated unit. *}
{* Manual modifications will be lost on next release. *}
{******************************************************************************}
{******************************************************************
JEDI-VCL Demo
Copyright (C) 2002 Project JEDI
Original author:
Contributor(s):
You may retrieve the latest version of this file at the JEDI-JVCL
home page, located at http://jvcl.sourceforge.net
The contents of this file are used with permission, subject to
the Mozilla Public License Version 1.1 (the "License"); you may
not use this file except in compliance with the License. You may
obtain a copy of the License at
http://www.mozilla.org/MPL/MPL-1_1Final.html
Software distributed under the License is distributed on an
"AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
******************************************************************}
unit DSAExamplesCustom2;
interface
uses
QWindows, QMessages, SysUtils, Classes, QGraphics, QControls, QForms, QDialogs,
QStdCtrls, JvQComponent, JvQDSADialogs;
type
TfrmDSAExamplesCustomDlg2 = class(TForm)
lblMessage: TLabel;
rbNone: TRadioButton;
rbUnlock: TRadioButton;
rbReportError: TRadioButton;
cbSuppress: TCheckBox;
btnOK: TButton;
JvDSADialog: TJvDSADialog;
procedure JvDSADialogApplyKeys(Sender: TObject;
const DSAInfo: TDSARegItem; const Storage: TDSAStorage);
procedure JvDSADialogUpdateKeys(Sender: TObject;
const DSAInfo: TDSARegItem; const Storage: TDSAStorage);
procedure UpdateBtnState(Sender: TObject);
procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
public
{ Public declarations }
procedure SelectRBByIndex(Value: Integer);
function SelectedRBIndex: Integer;
end;
function DoCustomDSA2: string;
implementation
{$R *.xfm}
function DoCustomDSA2: string;
begin
with TfrmDSAExamplesCustomDlg2.Create(Screen.ActiveForm) do
try
ShowModal;
case SelectedRBIndex of
0:
Result := 'Do nothing';
1:
Result := 'Unlock file';
2:
Result := 'Report error and stop';
else
Result := 'Unknown state: ' + IntToStr(SelectedRBIndex);
end;
finally
Free;
end;
end;
{ TfrmDSAExamplesCustomDlg2 }
procedure TfrmDSAExamplesCustomDlg2.SelectRBByIndex(Value: Integer);
begin
case Value of
0:
rbNone.Checked := True;
1:
rbUnlock.Checked := True;
2:
rbReportError.Checked := True;
else
ShowMessage('Unknown Action value read: ' + IntToStr(Value));
end;
end;
function TfrmDSAExamplesCustomDlg2.SelectedRBIndex: Integer;
begin
if rbNone.Checked then
Result := 0
else if rbUnlock.Checked then
Result := 1
else if rbReportError.Checked then
Result := 2
else
Result := -1;
end;
procedure TfrmDSAExamplesCustomDlg2.JvDSADialogApplyKeys(Sender: TObject;
const DSAInfo: TDSARegItem; const Storage: TDSAStorage);
begin
// Read the index of the checked radio button and apply it.
SelectRBByIndex(Storage.ReadInteger(DSAInfo, 'Action'));
end;
procedure TfrmDSAExamplesCustomDlg2.JvDSADialogUpdateKeys(Sender: TObject;
const DSAInfo: TDSARegItem; const Storage: TDSAStorage);
begin
// Store the index of the radio button that is checked.
Storage.WriteInteger(DSAInfo, 'Action', SelectedRBIndex);
end;
procedure TfrmDSAExamplesCustomDlg2.UpdateBtnState(Sender: TObject);
begin
btnOK.Enabled := rbNone.Checked or rbUnlock.Checked or rbReportError.Checked;
end;
procedure TfrmDSAExamplesCustomDlg2.FormCloseQuery(Sender: TObject;
var CanClose: Boolean);
begin
CanClose := btnOK.Enabled;
end;
end.
| 27.971631 | 81 | 0.668864 |
4750f04f76d47b07201e1fd2971d9f0411112a57 | 479,093 | pas | Pascal | Source/Skia.Api.pas | PonyPC/skia4delphi | 23f730a28af20256772dbb17cd2f7c2284daf581 | [
"MIT",
"BSD-3-Clause"
]
| null | null | null | Source/Skia.Api.pas | PonyPC/skia4delphi | 23f730a28af20256772dbb17cd2f7c2284daf581 | [
"MIT",
"BSD-3-Clause"
]
| null | null | null | Source/Skia.Api.pas | PonyPC/skia4delphi | 23f730a28af20256772dbb17cd2f7c2284daf581 | [
"MIT",
"BSD-3-Clause"
]
| null | null | null | {************************************************************************}
{ }
{ Skia4Delphi }
{ }
{ Copyright (c) 2011-2022 Google LLC. }
{ Copyright (c) 2021-2022 Skia4Delphi Project. }
{ }
{ Use of this source code is governed by a BSD-style license that can be }
{ found in the LICENSE file. }
{ }
{************************************************************************}
unit Skia.API;
interface
{$ALIGN ON}
{$MINENUMSIZE 4}
{$IF NOT DEFINED(IOS) or NOT DEFINED(CPUARM)}
{$DEFINE SK_DYNAMIC_LOADING}
{$ENDIF}
{$IFDEF SK_DYNAMIC_LOADING}
uses
{ Delphi }
{$IFDEF MSWINDOWS}
Winapi.Windows,
{$ENDIF}
System.SysUtils;
{$ENDIF}
type
{$REGION 'C types'}
bool = System.Boolean;
{$IF CompilerVersion < 31}
char = System.AnsiChar;
{$ELSE}
char = System.UTF8Char;
{$ENDIF}
char16_t = System.Char;
double = System.Double;
float = System.Single;
int16_t = System.SmallInt;
int32_t = System.Integer;
int64_t = System.Int64;
int8_t = System.ShortInt;
intptr_t = System.NativeInt;
long = System.LongInt;
size_t = System.NativeUInt;
uint16_t = System.Word;
uint32_t = System.Cardinal;
uint64_t = System.UInt64;
uint8_t = System.Byte;
uintptr_t = System.NativeUInt;
pbool = ^bool;
pchar = ^char;
pchar16_t = ^char16_t;
pdouble = ^double;
pfloat = ^float;
pint16_t = ^int16_t;
pint32_t = ^int32_t;
pint64_t = ^int64_t;
pint8_t = ^int8_t;
pintptr_t = ^intptr_t;
plong = ^long;
psize_t = ^size_t;
puint16_t = ^uint16_t;
puint32_t = ^uint32_t;
puint64_t = ^uint64_t;
puint8_t = ^uint8_t;
puintptr_t = ^uintptr_t;
{$ENDREGION}
{$REGION 'Skia types'}
{$REGION 'include/c/sk4d_types.h'}
gr_backendformat_t = THandle;
gr_backendrendertarget_t = THandle;
gr_backendtexture_t = THandle;
gr_directcontext_t = THandle;
sk_animcodecplayer_t = THandle;
sk_blender_t = THandle;
sk_canvas_t = THandle;
sk_codec_t = THandle;
sk_colorfilter_t = THandle;
sk_colorspace_t = THandle;
sk_colorspaceiccprofile_t = THandle;
sk_data_t = THandle;
sk_document_t = THandle;
sk_dynamicmemorywstream_t = THandle;
sk_filestream_t = THandle;
sk_filewstream_t = THandle;
sk_font_t = THandle;
sk_fontmgr_t = THandle;
sk_image_t = THandle;
sk_imagefilter_t = THandle;
sk_maskfilter_t = THandle;
sk_memorystream_t = THandle;
sk_opbuilder_t = THandle;
sk_paint_t = THandle;
sk_path_t = THandle;
sk_pathbuilder_t = THandle;
sk_patheffect_t = THandle;
sk_pathiterator_t = THandle;
sk_pathmeasure_t = THandle;
sk_pathrawiter_t = THandle;
sk_picture_t = THandle;
sk_picturerecorder_t = THandle;
sk_pixmap_t = THandle;
sk_refcnt_t = THandle;
sk_region_t = THandle;
sk_regioncliperator_t = THandle;
sk_regioniterator_t = THandle;
sk_regionspanerator_t = THandle;
sk_rrect_t = THandle;
sk_runtimeeffect_t = THandle;
sk_shader_t = THandle;
sk_stream_t = THandle;
sk_streamadapter_t = THandle;
sk_string_t = THandle;
sk_surface_t = THandle;
sk_textblob_t = THandle;
sk_tracememorydump_t = THandle;
sk_tracememorydumpbaseclass_t = THandle;
sk_typeface_t = THandle;
sk_vertices_t = THandle;
sk_wstream_t = THandle;
sk_wstreamadapter_t = THandle;
pgr_backendformat_t = ^gr_backendformat_t;
pgr_backendrendertarget_t = ^gr_backendrendertarget_t;
pgr_backendtexture_t = ^gr_backendtexture_t;
pgr_directcontext_t = ^gr_directcontext_t;
psk_animcodecplayer_t = ^sk_animcodecplayer_t;
psk_blender_t = ^sk_blender_t;
psk_canvas_t = ^sk_canvas_t;
psk_codec_t = ^sk_codec_t;
psk_colorfilter_t = ^sk_colorfilter_t;
psk_colorspace_t = ^sk_colorspace_t;
psk_colorspaceiccprofile_t = ^sk_colorspaceiccprofile_t;
psk_data_t = ^sk_data_t;
psk_document_t = ^sk_document_t;
psk_dynamicmemorywstream_t = ^sk_dynamicmemorywstream_t;
psk_filestream_t = ^sk_filestream_t;
psk_filewstream_t = ^sk_filewstream_t;
psk_font_t = ^sk_font_t;
psk_fontmgr_t = ^sk_fontmgr_t;
psk_image_t = ^sk_image_t;
psk_imagefilter_t = ^sk_imagefilter_t;
psk_maskfilter_t = ^sk_maskfilter_t;
psk_memorystream_t = ^sk_memorystream_t;
psk_opbuilder_t = ^sk_opbuilder_t;
psk_paint_t = ^sk_paint_t;
psk_path_t = ^sk_path_t;
psk_pathbuilder_t = ^sk_pathbuilder_t;
psk_patheffect_t = ^sk_patheffect_t;
psk_pathiterator_t = ^sk_pathiterator_t;
psk_pathmeasure_t = ^sk_pathmeasure_t;
psk_pathrawiter_t = ^sk_pathrawiter_t;
psk_picture_t = ^sk_picture_t;
psk_picturerecorder_t = ^sk_picturerecorder_t;
psk_pixmap_t = ^sk_pixmap_t;
psk_refcnt_t = ^sk_refcnt_t;
psk_region_t = ^sk_region_t;
psk_regioncliperator_t = ^sk_regioncliperator_t;
psk_regioniterator_t = ^sk_regioniterator_t;
psk_regionspanerator_t = ^sk_regionspanerator_t;
psk_rrect_t = ^sk_rrect_t;
psk_runtimeeffect_t = ^sk_runtimeeffect_t;
psk_shader_t = ^sk_shader_t;
psk_stream_t = ^sk_stream_t;
psk_streamadapter_t = ^sk_streamadapter_t;
psk_string_t = ^sk_string_t;
psk_surface_t = ^sk_surface_t;
psk_textblob_t = ^sk_textblob_t;
psk_tracememorydump_t = ^sk_tracememorydump_t;
psk_tracememorydumpbaseclass_t = ^sk_tracememorydumpbaseclass_t;
psk_typeface_t = ^sk_typeface_t;
psk_vertices_t = ^sk_vertices_t;
psk_wstream_t = ^sk_wstream_t;
psk_wstreamadapter_t = ^sk_wstreamadapter_t;
gr_backendapi_t = (
OPEN_GL_GR_BACKENDAPI,
METAL_GR_BACKENDAPI = 2
);
pgr_backendapi_t = ^gr_backendapi_t;
gr_surfaceorigin_t = (
TOP_LEFT_GR_SURFACEORIGIN,
BOTTOM_LEFT_GR_SURFACEORIGIN
);
pgr_surfaceorigin_t = ^gr_surfaceorigin_t;
sk_alphatype_t = (
UNKNOWN_SK_ALPHATYPE,
OPAQUE_SK_ALPHATYPE,
PREMUL_SK_ALPHATYPE,
UNPREMUL_SK_ALPHATYPE
);
psk_alphatype_t = ^sk_alphatype_t;
sk_blendmode_t = (
CLEAR_SK_BLENDMODE,
SRC_SK_BLENDMODE,
DEST_SK_BLENDMODE,
SRC_OVER_SK_BLENDMODE,
DEST_OVER_SK_BLENDMODE,
SRC_IN_SK_BLENDMODE,
DEST_IN_SK_BLENDMODE,
SRC_OUT_SK_BLENDMODE,
DEST_OUT_SK_BLENDMODE,
SRC_A_TOP_SK_BLENDMODE,
DEST_A_TOP_SK_BLENDMODE,
XOR_SK_BLENDMODE,
PLUS_SK_BLENDMODE,
MODULATE_SK_BLENDMODE,
SCREEN_SK_BLENDMODE,
OVERLAY_SK_BLENDMODE,
DARKEN_SK_BLENDMODE,
LIGHTEN_SK_BLENDMODE,
COLOR_DODGE_SK_BLENDMODE,
COLOR_BURN_SK_BLENDMODE,
HARD_LIGHT_SK_BLENDMODE,
SOFT_LIGHT_SK_BLENDMODE,
DIFFERENCE_SK_BLENDMODE,
EXCLUSION_SK_BLENDMODE,
MULTIPLY_SK_BLENDMODE,
HUE_SK_BLENDMODE,
SATURATION_SK_BLENDMODE,
COLOR_SK_BLENDMODE,
LUMINOSITY_SK_BLENDMODE
);
psk_blendmode_t = ^sk_blendmode_t;
sk_blurstyle_t = (
NORMAL_SK_BLURSTYLE,
SOLID_SK_BLURSTYLE,
OUTER_SK_BLURSTYLE,
INNER_SK_BLURSTYLE
);
psk_blurstyle_t = ^sk_blurstyle_t;
sk_clipop_t = (
DIFFERENCE_SK_CLIPOP,
INTERSECT_SK_CLIPOP
);
psk_clipop_t = ^sk_clipop_t;
sk_colorchannel_t = (
R_SK_COLORCHANNEL,
G_SK_COLORCHANNEL,
B_SK_COLORCHANNEL,
A_SK_COLORCHANNEL
);
psk_colorchannel_t = ^sk_colorchannel_t;
sk_colortype_t = (
UNKNOWN_SK_COLORTYPE,
ALPHA8_SK_COLORTYPE,
RGB565_SK_COLORTYPE,
ARGB4444_SK_COLORTYPE,
RGBA8888_SK_COLORTYPE,
RGB888X_SK_COLORTYPE,
BGRA8888_SK_COLORTYPE,
RGBA1010102_SK_COLORTYPE,
BGRA1010102_SK_COLORTYPE,
RGB101010X_SK_COLORTYPE,
BGR101010X_SK_COLORTYPE,
GRAY8_SK_COLORTYPE,
RGBAF16_SK_COLORTYPE,
RGBAF16CLAMPED_SK_COLORTYPE,
RGBAF32_SK_COLORTYPE,
RG88_SK_COLORTYPE,
ALPHAF16_SK_COLORTYPE,
RGF16_SK_COLORTYPE,
ALPHA16_SK_COLORTYPE,
RG1616_SK_COLORTYPE,
RGBA16161616_SK_COLORTYPE,
SRGBA8888_SK_COLORTYPE
);
psk_colortype_t = ^sk_colortype_t;
sk_drawpointsmode_t = (
POINTS_SK_DRAWPOINTSMODE,
LINES_SK_DRAWPOINTSMODE,
POLYGON_DRAWPOINTSMODE
);
psk_drawpointsmode_t = ^sk_drawpointsmode_t;
sk_encodedimageformat_t = (
BMP_SK_ENCODEDIMAGEFORMAT,
GIF_SK_ENCODEDIMAGEFORMAT,
ICO_SK_ENCODEDIMAGEFORMAT,
JPEG_SK_ENCODEDIMAGEFORMAT,
PNG_SK_ENCODEDIMAGEFORMAT,
WBMP_SK_ENCODEDIMAGEFORMAT,
WEBP_SK_ENCODEDIMAGEFORMAT,
PKM_SK_ENCODEDIMAGEFORMAT,
KTX_SK_ENCODEDIMAGEFORMAT,
ASTC_SK_ENCODEDIMAGEFORMAT,
DNG_SK_ENCODEDIMAGEFORMAT,
HEIF_SK_ENCODEDIMAGEFORMAT,
AVIF_SK_ENCODEDIMAGEFORMAT
);
psk_encodedimageformat_t = ^sk_encodedimageformat_t;
sk_filtermode_t = (
NEAREST_SK_FILTERMODE,
LINEAR_SK_FILTERMODE
);
psk_filtermode_t = ^sk_filtermode_t;
sk_fontedging_t = (
ALIAS_SK_FONTEDGING,
ANTI_ALIAS_SK_FONTEDGING,
SUBPIXEL_ANTI_ALIAS_SK_FONTEDGING
);
psk_fontedging_t = ^sk_fontedging_t;
sk_fonthinting_t = (
NONE_SK_FONTHINTING,
SLIGHT_SK_FONTHINTING,
NORMAL_SK_FONTHINTING,
FULL_SK_FONTHINTING
);
psk_fonthinting_t = ^sk_fonthinting_t;
sk_fontslant_t = (
UPRIGHT_SK_FONTSLANT,
ITALIC_SK_FONTSLANT,
OBLIQUE_SK_FONTSLANT
);
psk_fontslant_t = ^sk_fontslant_t;
sk_contrastinvertstyle_t = (
NO_INVERT_SK_CONTRASTINVERTSTYLE,
INVERT_BRIGHTNESS_SK_CONTRASTINVERTSTYLE,
INVERT_LIGHTNESS_SK_CONTRASTINVERTSTYLE
);
psk_contrastinvertstyle_t = ^sk_contrastinvertstyle_t;
sk_imagecachinghint_t = (
ALLOW_SK_IMAGECACHINGHINT,
DISALLOW_SK_IMAGECACHINGHINT
);
psk_imagecachinghint_t = ^sk_imagecachinghint_t;
sk_latticerecttype_t = (
DEFAULT_SK_LATTICERECTTYPE,
TRANSPARENT_SK_LATTICERECTTYPE,
FIXED_COLOR_SK_LATTICERECTTYPE
);
psk_latticerecttype_t = ^sk_latticerecttype_t;
sk_mipmapmode_t = (
NONE_SK_MIPMAPMODE,
NEAREST_SK_MIPMAPMODE,
LINEAR_SK_MIPMAPMODE
);
psk_mipmapmode_t = ^sk_mipmapmode_t;
sk_paintstyle_t = (
FILL_SK_PAINTSTYLE,
STROKE_SK_PAINTSTYLE,
STROKE_AND_FILL_SK_PAINTSTYLE
);
psk_paintstyle_t = ^sk_paintstyle_t;
sk_patharcsize_t = (
SMALL_SK_ARCSIZE,
LARGE_SK_ARCSIZE
);
psk_patharcsize_t = ^sk_patharcsize_t;
sk_pathdirection_t = (
CW_SK_PATHDIRECTION,
CCW_SK_PATHDIRECTION
);
psk_pathdirection_t = ^sk_pathdirection_t;
sk_patheffect1dstyle_t = (
TRANSLATE_SK_PATHEFFECT1DSTYLE,
ROTATE_SK_PATHEFFECT1DSTYLE,
MORPH_SK_PATHEFFECT1DSTYLE
);
psk_patheffect1dstyle_t = ^sk_patheffect1dstyle_t;
sk_patheffecttrimmode_t = (
NORMAL_SK_PATHEFFECTTRIMMODE,
INVERTED_SK_PATHEFFECTTRIMMODE
);
psk_patheffecttrimmode_t = ^sk_patheffecttrimmode_t;
sk_pathfilltype_t = (
WINDING_SK_PATHFILLTYPE,
EVEN_ODD_SK_PATHFILLTYPE,
INVERSE_WINDING_SK_PATHFILLTYPE,
INVERSE_EVEN_ODD_SK_PATHFILLTYPE
);
psk_pathfilltype_t = ^sk_pathfilltype_t;
sk_pathop_t = (
DIFFERENCE_SK_PATHOP,
INTERSECT_SK_PATHOP,
UNION_SK_PATHOP,
XOR_SK_PATHOP,
REVERSE_DIFFERENCE_SK_PATHOP
);
psk_pathop_t = ^sk_pathop_t;
sk_pathverb_t = (
MOVE_SK_PATHVERB,
LINE_SK_PATHVERB,
QUAD_SK_PATHVERB,
CONIC_SK_PATHVERB,
CUBIC_SK_PATHVERB,
CLOSE_SK_PATHVERB
);
psk_pathverb_t = ^sk_pathverb_t;
sk_pixelgeometry_t = (
UNKNOWN_SK_PIXELGEOMETRY,
RGB_HORIZONTAL_SK_PIXELGEOMETRY,
BGR_HORIZONTAL_SK_PIXELGEOMETRY,
RGB_VERTICAL_SK_PIXELGEOMETRY,
BGR_VERTICAL_SK_PIXELGEOMETRY
);
psk_pixelgeometry_t = ^sk_pixelgeometry_t;
sk_regionop_t = (
DIFFERENCE_SK_REGIONOP,
INTERSECT_SK_REGIONOP,
UNION_SK_REGIONOP,
XOR_SK_REGIONOP,
REVERSE_DIFFERENCE_SK_REGIONOP,
REPLACE_SK_REGIONOP
);
psk_regionop_t = ^sk_regionop_t;
sk_rrectcorner_t = (
UPPER_LEFT_SK_RRECTCORNER,
UPPER_RIGHT_SK_RRECTCORNER,
LOWER_RIGHT_SK_RRECTCORNER,
LOWER_LEFT_SK_RRECTCORNER
);
psk_rrectcorner_t = ^sk_rrectcorner_t;
sk_runtimeeffectchildtype_t = (
SHADER_SK_RUNTIMEEFFECTCHILDTYPE,
COLOR_FILTER_SK_RUNTIMEEFFECTCHILDTYPE,
BLENDER_FILTER_SK_RUNTIMEEFFECTCHILDTYPE
);
psk_runtimeeffectchildtype_t = ^sk_runtimeeffectchildtype_t;
sk_runtimeeffectuniformtype_t = (
FLOAT_SK_RUNTIMEEFFECTUNIFORMTYPE,
FLOAT2_SK_RUNTIMEEFFECTUNIFORMTYPE,
FLOAT3_SK_RUNTIMEEFFECTUNIFORMTYPE,
FLOAT4_SK_RUNTIMEEFFECTUNIFORMTYPE,
FLOAT2X2_SK_RUNTIMEEFFECTUNIFORMTYPE,
FLOAT3X3_SK_RUNTIMEEFFECTUNIFORMTYPE,
FLOAT4X4_SK_RUNTIMEEFFECTUNIFORMTYPE,
INT_SK_RUNTIMEEFFECTUNIFORMTYPE,
INT2_SK_RUNTIMEEFFECTUNIFORMTYPE,
INT3_SK_RUNTIMEEFFECTUNIFORMTYPE,
INT4_SK_RUNTIMEEFFECTUNIFORMTYPE
);
psk_runtimeeffectuniformtype_t = ^sk_runtimeeffectuniformtype_t;
sk_srcrectconstraint_t = (
CLOSE_SK_SRCRECTCONSTRAINT,
FAST_SK_SRCRECTCONSTRAINT
);
psk_srcrectconstraint_t = ^sk_srcrectconstraint_t;
sk_strokecap_t = (
BUTT_SK_STROKECAP,
ROUND_SK_STROKECAP,
SQUARE_SK_STROKECAP
);
psk_strokecap_t = ^sk_strokecap_t;
sk_strokejoin_t = (
MITER_SK_STROKEJOIN,
ROUND_SK_STROKEJOIN,
BEVEL_SK_STROKEJOIN
);
psk_strokejoin_t = ^sk_strokejoin_t;
sk_textencoding_t = (
UTF8_SK_TEXTENCODING,
UTF16_SK_TEXTENCODING,
UTF32_SK_TEXTENCODING,
GLYPH_ID_SK_TEXTENCODING
);
psk_textencoding_t = ^sk_textencoding_t;
sk_tilemode_t = (
CLAMP_SK_TILEMODE,
REPEAT_SK_TILEMODE,
MIRROR_SK_TILEMODE,
DECAL_SK_TILEMODE
);
psk_tilemode_t = ^sk_tilemode_t;
sk_vertexmode_t = (
TRIANGLES_SK_VERTEXMODE,
TRIANGLE_STRIP_SK_VERTEXMODE,
TRIANGLE_FAN_SK_VERTEXMODE
);
psk_vertexmode_t = ^sk_vertexmode_t;
sk_color_t = uint32_t;
sk_glyphid_t = uint16_t;
sk_unichar_t = int32_t;
psk_color_t = ^sk_color_t;
psk_glyphid_t = ^sk_glyphid_t;
psk_unichar_t = ^sk_unichar_t;
sk_color4f_t = record
r: float;
g: float;
b: float;
a: float;
end;
psk_color4f_t = ^sk_color4f_t;
sk_colormatrix_t = record
m_11: float;
m_12: float;
m_13: float;
m_14: float;
m_15: float;
m_21: float;
m_22: float;
m_23: float;
m_24: float;
m_25: float;
m_31: float;
m_32: float;
m_33: float;
m_34: float;
m_35: float;
m_41: float;
m_42: float;
m_43: float;
m_44: float;
m_45: float;
end;
psk_colormatrix_t = ^sk_colormatrix_t;
sk_colorspaceprimaries_t = record
rx: float;
ry: float;
gx: float;
gy: float;
bx: float;
by: float;
wx: float;
wy: float;
end;
psk_colorspaceprimaries_t = ^sk_colorspaceprimaries_t;
sk_colorspacetransferfn_t = record
g: float;
a: float;
b: float;
c: float;
d: float;
e: float;
f: float;
end;
psk_colorspacetransferfn_t = ^sk_colorspacetransferfn_t;
sk_colorspacexyz_t = record
m_11: float;
m_12: float;
m_13: float;
m_21: float;
m_22: float;
m_23: float;
m_31: float;
m_32: float;
m_33: float;
end;
psk_colorspacexyz_t = ^sk_colorspacexyz_t;
sk_cubicresampler_t = record
b: float;
c: float;
end;
psk_cubicresampler_t = ^sk_cubicresampler_t;
sk_datetime_t = record
time_zone_minutes : int16_t;
year : uint16_t;
month : uint8_t;
day_of_week : uint8_t;
day : uint8_t;
hour : uint8_t;
minute : uint8_t;
second : uint8_t;
end;
psk_datetime_t = ^sk_datetime_t;
sk_fontmetrics_t = record
flags : uint32_t;
top : float;
ascent : float;
descent : float;
bottom : float;
leading : float;
avg_char_width : float;
max_char_width : float;
x_min : float;
x_max : float;
x_height : float;
cap_height : float;
underline_thickness : float;
underline_position : float;
strikeout_thickness : float;
strikeout_position : float;
end;
psk_fontmetrics_t = ^sk_fontmetrics_t;
sk_fontstyle_t = record
weight : int32_t;
width : int32_t;
slant : sk_fontslant_t;
end;
psk_fontstyle_t = ^sk_fontstyle_t;
sk_highcontrastconfig_t = record
grayscale : bool;
invert_style : sk_contrastinvertstyle_t;
contrast : float;
end;
psk_highcontrastconfig_t = ^sk_highcontrastconfig_t;
sk_imageinfo_t = record
width : int32_t;
height : int32_t;
color_type : sk_colortype_t;
alpha_type : sk_alphatype_t;
color_space : sk_colorspace_t;
end;
psk_imageinfo_t = ^sk_imageinfo_t;
sk_ipoint_t = record
x: int32_t;
y: int32_t;
end;
psk_ipoint_t = ^sk_ipoint_t;
sk_irect_t = record
left : int32_t;
top : int32_t;
right : int32_t;
bottom : int32_t;
end;
psk_irect_t = ^sk_irect_t;
sk_isize_t = record
width : int32_t;
height : int32_t;
end;
psk_isize_t = ^sk_isize_t;
sk_lattice_t = record
x_divs : pint32_t;
y_divs : pint32_t;
rect_types : psk_latticerecttype_t;
x_count : int32_t;
y_count : int32_t;
bounds : psk_irect_t;
colors : psk_color_t;
end;
psk_lattice_t = ^sk_lattice_t;
sk_matrix_t = record
m_11: float;
m_12: float;
m_13: float;
m_21: float;
m_22: float;
m_23: float;
m_31: float;
m_32: float;
m_33: float;
end;
psk_matrix_t = ^sk_matrix_t;
sk_matrix44_t = record
m_11: float;
m_12: float;
m_13: float;
m_14: float;
m_21: float;
m_22: float;
m_23: float;
m_24: float;
m_31: float;
m_32: float;
m_33: float;
m_34: float;
m_41: float;
m_42: float;
m_43: float;
m_44: float;
end;
psk_matrix44_t = ^sk_matrix44_t;
sk_point_t = record
x: float;
y: float;
end;
psk_point_t = ^sk_point_t;
sk_pathiteratorelem_t = record
verb : sk_pathverb_t;
points : array[0..3] of sk_point_t;
conic_weight : float;
end;
psk_pathiteratorelem_t = ^sk_pathiteratorelem_t;
sk_pdfmetadata_t = record
title : MarshaledAString;
author : MarshaledAString;
subject : MarshaledAString;
keywords : MarshaledAString;
creator : MarshaledAString;
producer : MarshaledAString;
creation : sk_datetime_t;
modified : sk_datetime_t;
raster_dpi : float;
pdfa : bool;
encoding_quality : int32_t;
end;
psk_pdfmetadata_t = ^sk_pdfmetadata_t;
sk_point3_t = record
x: float;
y: float;
z: float;
end;
psk_point3_t = ^sk_point3_t;
sk_rect_t = record
left : float;
top : float;
right : float;
bottom : float;
end;
psk_rect_t = ^sk_rect_t;
sk_rotationscalematrix_t = record
s_cos : float;
s_sin : float;
t_x : float;
t_y : float;
end;
psk_rotationscalematrix_t = ^sk_rotationscalematrix_t;
sk_samplingoptions_t = record
use_cubic : bool;
cubic : sk_cubicresampler_t;
filter : sk_filtermode_t;
mipmap : sk_mipmapmode_t;
end;
psk_samplingoptions_t = ^sk_samplingoptions_t;
sk_size_t = record
width : float;
height : float;
end;
psk_size_t = ^sk_size_t;
sk_surfaceprops_t = record
flags : uint32_t;
pixel_geometry : sk_pixelgeometry_t;
end;
psk_surfaceprops_t = ^sk_surfaceprops_t;
sk_vector_t = sk_point_t;
psk_vector_t = ^sk_vector_t;
sk_font_path_proc = procedure (const path: sk_path_t; const matrix: psk_matrix_t; context: Pointer); cdecl;
sk_image_raster_release_proc = procedure (const pixels: Pointer; context: Pointer); cdecl;
sk_image_texture_release_proc = procedure (context: Pointer); cdecl;
sk_surface_raster_release_proc = procedure (pixels, context: Pointer); cdecl;
sk_streamadapter_procs_t = record
get_length : function (context: Pointer): size_t; cdecl;
get_position : function (context: Pointer): size_t; cdecl;
read : function (context: Pointer; buffer: Pointer; size: size_t): size_t; cdecl;
seek : function (context: Pointer; position: size_t): bool; cdecl;
end;
psk_streamadapter_procs_t = ^sk_streamadapter_procs_t;
sk_wstreamadapter_procs_t = record
write: function (context: Pointer; const buffer: Pointer; size: size_t): bool; cdecl;
end;
psk_wstreamadapter_procs_t = ^sk_wstreamadapter_procs_t;
sk_tracememorydumpbaseclass_procs_t = record
dump_numeric_value : procedure (context: Pointer; const dump_name, value_name, units: MarshaledAString; value: uint64_t); cdecl;
dump_string_value : procedure (context: Pointer; const dump_name, value_name, value: MarshaledAString); cdecl;
end;
psk_tracememorydumpbaseclass_procs_t = ^sk_tracememorydumpbaseclass_procs_t;
// GPU
gr_contextoptions_t = record
buffer_map_threshold : int32_t;
do_manual_mipmapping : bool;
allow_path_mask_caching : bool;
glyph_cache_texture_maximum_bytes : size_t;
avoid_stencil_buffers : bool;
runtime_program_cache_size : int32_t;
end;
pgr_contextoptions_t = ^gr_contextoptions_t;
// GPU - OpenGL
gr_gl_interface_t = THandle;
pgr_gl_interface_t = ^gr_gl_interface_t;
gl_enum_t = uint32_t;
gl_uint_t = uint32_t;
pgl_enum_t = ^gl_enum_t;
pgl_uint_t = ^gl_uint_t;
gr_gl_framebufferinfo_t = record
fboid : gl_uint_t;
format : gl_enum_t;
end;
pgr_gl_framebufferinfo_t = ^gr_gl_framebufferinfo_t;
gr_gl_textureinfo_t = record
target : gl_enum_t;
id : gl_uint_t;
format : gl_enum_t;
end;
pgr_gl_textureinfo_t = ^gr_gl_textureinfo_t;
gr_gl_get_proc = function (context: Pointer; const name: MarshaledAString): Pointer; cdecl;
// GPU - Metal
gr_mtl_handle_t = Pointer;
gr_mtl_textureinfo_t = record
texture: gr_mtl_handle_t;
end;
pgr_mtl_textureinfo_t = ^gr_mtl_textureinfo_t;
gr_mtl_backendcontext_t = record
device : gr_mtl_handle_t;
queue : gr_mtl_handle_t;
binary_archive : gr_mtl_handle_t;
end;
pgr_mtl_backendcontext_t = ^gr_mtl_backendcontext_t;
{$ENDREGION}
{$REGION 'modules/particles/include/sk4d_particles_types.h'}
sk_particleeffect_t = THandle;
psk_particleeffect_t = ^sk_particleeffect_t;
sk_particleuniform_t = record
columns : int32_t;
rows : int32_t;
slot : int32_t;
end;
psk_particleuniform_t = ^sk_particleuniform_t;
{$ENDREGION}
{$REGION 'modules/skottie/include/sk4d_skottie_types.h'}
sk_skottieanimation_t = THandle;
psk_skottieanimation_t = ^sk_skottieanimation_t;
{$ENDREGION}
{$REGION 'modules/skparagraph/include/sk4d_paragraph_types.h'}
sk_paragraph_t = THandle;
sk_paragraphbuilder_t = THandle;
sk_paragraphstyle_t = THandle;
sk_strutstyle_t = THandle;
sk_textstyle_t = THandle;
sk_typefacefontprovider_t = THandle;
psk_paragraph_t = ^sk_paragraph_t;
psk_paragraphbuilder_t = ^sk_paragraphbuilder_t;
psk_paragraphstyle_t = ^sk_paragraphstyle_t;
psk_strutstyle_t = ^sk_strutstyle_t;
psk_textstyle_t = ^sk_textstyle_t;
psk_typefacefontprovider_t = ^sk_typefacefontprovider_t;
sk_affinity_t = (
UPSTREAM_SK_AFFINITY,
DOWNSTREAM_SK_AFFINITY
);
psk_affinity_t = ^sk_affinity_t;
sk_placeholderalignment_t = (
BASELINE_SK_PLACEHOLDERALIGNMENT,
ABOVE_BASELINE_SK_PLACEHOLDERALIGNMENT,
BELOW_BASELINE_SK_PLACEHOLDERALIGNMENT,
TOP_SK_PLACEHOLDERALIGNMENT,
BOTTOM_SK_PLACEHOLDERALIGNMENT,
MIDDLE_SK_PLACEHOLDERALIGNMENT
);
psk_placeholderalignment_t = ^sk_placeholderalignment_t;
sk_rectheightstyle_t = (
TIGHT_SK_RECTHEIGHTSTYLE,
MAX_SK_RECTHEIGHTSTYLE,
INCLUDE_LINE_SPACING_MIDDLE_SK_RECTHEIGHTSTYLE,
INCLUDE_LINE_SPACING_TOP_SK_RECTHEIGHTSTYLE,
INCLUDE_LINE_SPACING_BOTTOM_SK_RECTHEIGHTSTYLE,
STRUT_SK_RECTHEIGHTSTYLE
);
psk_rectheightstyle_t = ^sk_rectheightstyle_t;
sk_rectwidthstyle_t = (
TIGHT_SK_RECTWIDTHSTYLE,
MAX_SK_RECTWIDTHSTYLE
);
psk_rectwidthstyle_t = ^sk_rectwidthstyle_t;
sk_textalign_t = (
LEFT_SK_TEXTALIGN,
RIGHT_SK_TEXTALIGN,
CENTER_SK_TEXTALIGN,
JUSTIFY_SK_TEXTALIGN,
START_SK_TEXTALIGN,
TERMINATE_SK_TEXTALIGN
);
psk_textalign_t = ^sk_textalign_t;
sk_textbaseline_t = (
ALPHABETIC_SK_TEXTBASELINE,
IDEOGRAPHIC_SK_TEXTBASELINE
);
psk_textbaseline_t = ^sk_textbaseline_t;
sk_textdecorationstyle_t = (
SOLID_SK_TEXTDECORATIONSTYLE,
DOUBLE_SK_TEXTDECORATIONSTYLE,
DOTTED_SK_TEXTDECORATIONSTYLE,
DASHED_SK_TEXTDECORATIONSTYLE,
WAVY_SK_TEXTDECORATIONSTYLE
);
psk_textdecorationstyle_t = ^sk_textdecorationstyle_t;
sk_textdirection_t = (
RIGHT_TO_LEFT_SK_TEXTDIRECTION,
LEFT_TO_RIGHT_SK_TEXTDIRECTION
);
psk_textdirection_t = ^sk_textdirection_t;
sk_metrics_t = record
start_index : size_t;
end_index : size_t;
end_excluding_whitespaces : size_t;
end_including_newline : size_t;
is_hard_break : bool;
ascent : double;
descent : double;
height : double;
width : double;
left : double;
baseline : double;
line_number : size_t;
end;
psk_metrics_t = ^sk_metrics_t;
sk_placeholderstyle_t = record
width : float;
height : float;
alignment : sk_placeholderalignment_t;
baseline : sk_textbaseline_t;
baseline_offset : float;
end;
psk_placeholderstyle_t = ^sk_placeholderstyle_t;
sk_positionaffinity_t = record
position: int32_t;
affinity: sk_affinity_t;
end;
psk_positionaffinity_t = ^sk_positionaffinity_t;
sk_textbox_t = record
rect : sk_rect_t;
direction : sk_textdirection_t;
end;
psk_textbox_t = ^sk_textbox_t;
sk_textshadow_t = record
color : sk_color_t;
offset : sk_point_t;
blur_radius : double;
end;
psk_textshadow_t = ^sk_textshadow_t;
{$ENDREGION}
{$REGION 'modules/skresources/include/sk4d_resources_types.h'}
sk_resourceprovider_t = THandle;
sk_resourceproviderbaseclass_t = THandle;
psk_resourceprovider_t = ^sk_resourceprovider_t;
psk_resourceproviderbaseclass_t = ^sk_resourceproviderbaseclass_t;
sk_resourceproviderbaseclass_procs_t = record
load: function (context: Pointer; const path, name: MarshaledAString): sk_data_t; cdecl;
end;
psk_resourceproviderbaseclass_procs_t = ^sk_resourceproviderbaseclass_procs_t;
{$ENDREGION}
{$REGION 'modules/skshaper/include/sk4d_shaper_types.h'}
sk_shaper_t = THandle;
psk_shaper_t = ^sk_shaper_t;
{$ENDREGION}
{$REGION 'modules/skunicode/include/sk4d_unicode_types.h'}
sk_unicode_t = THandle;
psk_unicode_t = ^sk_unicode_t;
sk_breaktype_t = (
WORDS_SK_BREAKTYPE,
GRAPHEMES_SK_BREAKTYPE,
LINES_SK_BREAKTYPE
);
psk_breaktype_t = ^sk_breaktype_t;
sk_direction_t = (
LEFT_TO_RIGHT_SK_DIRECTION,
RIGHT_TO_LEFT_SK_DIRECTION
);
psk_direction_t = ^sk_direction_t;
sk_unicode_bidi_region_proc = procedure (start, &end: int32_t; level: uint8_t; context: Pointer); cdecl;
sk_unicode_break_proc = procedure (position, status: int32_t; context: Pointer); cdecl;
sk_unicode_codepoint_proc = procedure (unichar: sk_unichar_t; start, &end: int32_t; context: Pointer); cdecl;
{$ENDREGION}
{$REGION 'modules/svg/include/sk4d_svg_types.h'}
sk_svgdom_t = THandle;
sk_svgsvg_t = THandle;
sk_svgnode_t = THandle;
psk_svgdom_t = ^sk_svgdom_t;
psk_svgsvg_t = ^sk_svgsvg_t;
psk_svgnode_t = ^sk_svgnode_t;
sk_svglengthunit_t = (
UNKNOWN_SK_SVGLENGTHUNIT,
NUMBER_SK_SVGLENGTHUNIT,
PERCENTAGE_SK_SVGLENGTHUNIT,
EMS_SK_SVGLENGTHUNIT,
EXS_SK_SVGLENGTHUNIT,
PX_SK_SVGLENGTHUNIT,
CM_SK_SVGLENGTHUNIT,
MM_SK_SVGLENGTHUNIT,
IN_SK_SVGLENGTHUNIT,
PT_SK_SVGLENGTHUNIT,
PC_SK_SVGLENGTHUNIT
);
psk_svglengthunit_t = ^sk_svglengthunit_t;
sk_svgaspectalign_t = (
X_MIN_Y_MIN_SK_SVGASPECTALIGN,
X_MID_Y_MIN_SK_SVGASPECTALIGN,
X_MAX_Y_MIN_SK_SVGASPECTALIGN,
X_MIN_Y_MID_SK_SVGASPECTALIGN = 4,
X_MID_Y_MID_SK_SVGASPECTALIGN,
X_MAX_Y_MID_SK_SVGASPECTALIGN,
X_MIN_Y_MAX_SK_SVGASPECTALIGN = 8,
X_MID_Y_MAX_SK_SVGASPECTALIGN,
X_MAX_Y_MAX_SK_SVGASPECTALIGN,
NONE_SK_SVGASPECTALIGN = 16
);
psk_svgaspectalign_t = ^sk_svgaspectalign_t;
sk_svgaspectscale_t = (
MEET_SK_SVGASPECTSCALE,
SLICE_SK_SVGASPECTSCALE
);
psk_svgaspectscale_t = ^sk_svgaspectscale_t;
sk_svglength_t = record
value: float;
&unit: sk_svglengthunit_t;
end;
psk_svglength_t = ^sk_svglength_t;
sk_svgpreserveaspectratio_t = record
align: sk_svgaspectalign_t;
scale: sk_svgaspectscale_t;
end;
psk_svgpreserveaspectratio_t = ^sk_svgpreserveaspectratio_t;
{$ENDREGION}
{$ENDREGION}
{$REGION 'Skia API'}
{$IFDEF SK_DYNAMIC_LOADING}
ESkiaAPI = class(Exception);
{$ENDIF}
{ TSkiaAPI }
TSkiaAPI = class sealed
public const
{$IF DEFINED(MSWINDOWS)}
LibName = 'sk4d.dll';
{$ELSEIF DEFINED(MACOS)}
{$IF DEFINED(IOS) and DEFINED(CPUARM)}
LibName = 'sk4d.a';
{$ELSE}
LibName = 'sk4d.dylib';
{$ENDIF}
{$ELSE}
LibName = 'libsk4d.so';
{$ENDIF}
{$IFDEF SK_DYNAMIC_LOADING}
strict private class var
[Volatile] FRefCount: Integer;
FLibHandle: HMODULE;
{$ENDIF}
{$IF DEFINED(MSWINDOWS) or DEFINED(SK_DYNAMIC_LOADING)}
strict private
class constructor Create;
{$IFDEF SK_DYNAMIC_LOADING}
class destructor Destroy;
{$ENDIF}
{$ENDIF}
public
class procedure Initialize;
class procedure Terminate;
{$REGION 'include/c/gr4d_backendsurface.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_backendrendertarget_create_gl {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(width, height, sample_count, stencil_bits: int32_t; const framebuffer_info: pgr_gl_framebufferinfo_t): gr_backendrendertarget_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_backendrendertarget_create_mtl {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(width, height: int32_t; const texture_info: pgr_mtl_textureinfo_t): gr_backendrendertarget_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}gr4d_backendrendertarget_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: gr_backendrendertarget_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_backendrendertarget_get_backend_api {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: gr_backendrendertarget_t): gr_backendapi_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_backendrendertarget_get_height {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: gr_backendrendertarget_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_backendrendertarget_get_sample_count {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: gr_backendrendertarget_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_backendrendertarget_get_stencil_bits {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: gr_backendrendertarget_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_backendrendertarget_get_width {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: gr_backendrendertarget_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_backendrendertarget_is_valid {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: gr_backendrendertarget_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_backendtexture_create_gl {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(width, height: int32_t; is_mipmapped: bool; const texture_info: pgr_gl_textureinfo_t): gr_backendtexture_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_backendtexture_create_mtl {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(width, height: int32_t; is_mipmapped: bool; const texture_info: pgr_mtl_textureinfo_t): gr_backendtexture_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}gr4d_backendtexture_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: gr_backendtexture_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_backendtexture_get_backend_api {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: gr_backendtexture_t): gr_backendapi_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_backendtexture_get_gl_framebuffer_info{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: gr_backendtexture_t; out texture_info: gr_gl_textureinfo_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_backendtexture_get_height {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: gr_backendtexture_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_backendtexture_get_width {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: gr_backendtexture_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_backendtexture_has_mipmaps {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: gr_backendtexture_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_backendtexture_is_valid {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: gr_backendtexture_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/gr4d_directcontext.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}gr4d_directcontext_abandon_context {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: gr_directcontext_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}gr4d_directcontext_dump_memory_statistics {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: gr_directcontext_t; trace_memory_dump: sk_tracememorydump_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}gr4d_directcontext_flush {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: gr_directcontext_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}gr4d_directcontext_flush_and_submit {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: gr_directcontext_t; sync_cpu: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}gr4d_directcontext_free_gpu_resources {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: gr_directcontext_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_directcontext_get_backend_api {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: gr_directcontext_t): gr_backendapi_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_directcontext_get_max_surface_sample_count_for_color_type{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: gr_directcontext_t; color_type: sk_colortype_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_directcontext_get_resource_cache_limit {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: gr_directcontext_t): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}gr4d_directcontext_get_resource_cache_usage {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: gr_directcontext_t; out resources: int32_t; out resources_bytes: size_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_directcontext_is_abandoned {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: gr_directcontext_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_directcontext_make_gl {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const gl_interface: gr_gl_interface_t; const options: pgr_contextoptions_t): gr_directcontext_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_directcontext_make_metal {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const backend_context: pgr_mtl_backendcontext_t; const options: pgr_contextoptions_t): gr_directcontext_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}gr4d_directcontext_perform_deferred_cleanup {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: gr_directcontext_t; milliseconds: int64_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}gr4d_directcontext_purge_unlocked_resources {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: gr_directcontext_t; scratch_resources_only: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}gr4d_directcontext_purge_unlocked_resources2 {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: gr_directcontext_t; bytes_to_purge: size_t; prefer_scratch_resources: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}gr4d_directcontext_release_resources_and_abandon_context {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: gr_directcontext_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}gr4d_directcontext_reset_context {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: gr_directcontext_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}gr4d_directcontext_set_resource_cache_limit {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: gr_directcontext_t; value: size_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_directcontext_submit {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: gr_directcontext_t; sync_cpu: bool): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/gr4d_gl_interface.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_gl_interface_has_extension {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: gr_gl_interface_t; const name: MarshaledAString): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_gl_interface_make_assembled {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(context: Pointer; proc: gr_gl_get_proc): gr_gl_interface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_gl_interface_make_assembled_gl {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(context: Pointer; proc: gr_gl_get_proc): gr_gl_interface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_gl_interface_make_assembled_gles {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(context: Pointer; proc: gr_gl_get_proc): gr_gl_interface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_gl_interface_make_assembled_webgl{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(context: Pointer; proc: gr_gl_get_proc): gr_gl_interface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_gl_interface_make_native {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): gr_gl_interface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}gr4d_gl_interface_validate {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: gr_gl_interface_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_blender.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_blender_make_arithmetic{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(k1, k2, k3, k4: float; enforce_premultiplied_color: bool): sk_blender_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_blender_make_mode {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(mode: sk_blendmode_t): sk_blender_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_canvas.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_clear {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; color: sk_color_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_clear2 {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const color: psk_color4f_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_discard {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_clip_path {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const path: sk_path_t; op: sk_clipop_t; anti_alias: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_clip_rect {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const rect: psk_rect_t; op: sk_clipop_t; anti_alias: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_clip_region {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const region: sk_region_t; op: sk_clipop_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_clip_rrect {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const rrect: sk_rrect_t; op: sk_clipop_t; anti_alias: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_clip_shader {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; shader: sk_shader_t; op: sk_clipop_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_concat {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const matrix: psk_matrix44_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_concat2 {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const matrix: psk_matrix_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_annotation {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const rect: psk_rect_t; const key: MarshaledAString; const value: Pointer; size: size_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_arc {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const oval: psk_rect_t; start_angle, sweep_angle: float; use_center: bool; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_atlas {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const atlas: sk_image_t; const transforms: psk_rotationscalematrix_t; const sprites: psk_rect_t; const colors: psk_color_t; count: int32_t; blend_mode: sk_blendmode_t; const sampling: psk_samplingoptions_t; const cull_rect: psk_rect_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_circle {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const center: psk_point_t; radius: float; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_color {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; color: sk_color_t; blend_mode: sk_blendmode_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_color2 {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const color: psk_color4f_t; blend_mode: sk_blendmode_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_glyphs {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; count: int32_t; const glyphs: psk_glyphid_t; const positions: psk_point_t; const origin: psk_point_t; const font: sk_font_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_glyphs2 {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; count: int32_t; const glyphs: psk_glyphid_t; const matrices: psk_rotationscalematrix_t; const origin: psk_point_t; const font: sk_font_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_image {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const image: sk_image_t; x, y: float; const sampling: psk_samplingoptions_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_image_lattice {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const image: sk_image_t; const lattice: psk_lattice_t; const dest: psk_rect_t; filter_mode: sk_filtermode_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_image_nine {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const image: sk_image_t; const center: psk_irect_t; const dest: psk_rect_t; filter_mode: sk_filtermode_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_image_rect {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const image: sk_image_t; const src, dest: psk_rect_t; const sampling: psk_samplingoptions_t; const paint: sk_paint_t; constraint: sk_srcrectconstraint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_line {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const point1, point2: psk_point_t; paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_oval {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const oval: psk_rect_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_paint {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_patch {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const cubics: psk_point_t; const colors: psk_color_t; const tex_coords: psk_point_t; blend_mode: sk_blendmode_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_path {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const path: sk_path_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_picture {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const picture: sk_picture_t; const matrix: psk_matrix_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_point {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const point: psk_point_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_points {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; mode: sk_drawpointsmode_t; count: size_t; const points: psk_point_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_rect {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const rect: psk_rect_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_region {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const region: sk_region_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_rrect {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const rrect: sk_rrect_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_rrect2 {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const rect: psk_rect_t; radius_x, radius_y: float; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_rrect_difference {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const outer, inner: sk_rrect_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_simple_text {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const text: Pointer; size: size_t; encoding: sk_textencoding_t; x, y: float; const font: sk_font_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_text_blob {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const text_blob: sk_textblob_t; x, y: float; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_draw_vertices {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const vertices: sk_vertices_t; blend_mode: sk_blendmode_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_get_device_clip_bounds {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_canvas_t; out result: sk_irect_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_get_local_clip_bounds {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_canvas_t; out result: sk_rect_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_get_local_to_device {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_canvas_t; out result: sk_matrix44_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_get_local_to_device_as_3x3{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_canvas_t; out result: sk_matrix_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_canvas_get_save_count {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_canvas_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_canvas_quick_reject {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_canvas_t; const rect: psk_rect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_canvas_quick_reject2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_canvas_t; const path: sk_path_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_reset_matrix {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_restore {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_restore_to_count {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; save_count: int32_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_rotate {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; degrees: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_rotate2 {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; degrees, px, py: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_canvas_save {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_canvas_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_canvas_save_layer {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_canvas_t; const rect: psk_rect_t; const paint: sk_paint_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_canvas_save_layer_alpha {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_canvas_t; const rect: psk_rect_t; alpha: uint8_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_scale {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; sx, sy: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_set_matrix {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const matrix: psk_matrix44_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_set_matrix2 {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; const matrix: psk_matrix_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_skew {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; kx, ky: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_canvas_translate {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_canvas_t; dx, dy: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_codec.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_codec_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(codec: sk_codec_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_codec_get_dimensions {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_codec_t; out result: sk_isize_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_codec_get_image {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_codec_t; color_type: sk_colortype_t; alpha_type: sk_alphatype_t; color_space: sk_colorspace_t): sk_image_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_codec_get_pixels {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_codec_t; pixels: Pointer; row_bytes: size_t; color_type: sk_colortype_t; alpha_type: sk_alphatype_t; color_space: sk_colorspace_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_codec_make_from_file {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const file_name: MarshaledAString): sk_codec_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_codec_make_with_copy {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const data: Pointer; size: size_t): sk_codec_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_codec_make_without_copy {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const data: Pointer; size: size_t): sk_codec_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_animcodecplayer_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_animcodecplayer_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_animcodecplayer_get_dimensions {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_animcodecplayer_t; out result: sk_isize_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_animcodecplayer_get_duration {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_animcodecplayer_t): uint32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_animcodecplayer_get_frame {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_animcodecplayer_t): sk_image_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_animcodecplayer_make_from_file {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const file_name: MarshaledAString): sk_animcodecplayer_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_animcodecplayer_make_from_stream{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(stream: sk_stream_t): sk_animcodecplayer_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_animcodecplayer_seek {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_animcodecplayer_t; milliseconds: uint32_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_colorfilter.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorfilter_make_blend {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(color: sk_color_t; mode: sk_blendmode_t): sk_colorfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorfilter_make_compose {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(outer, inner: sk_colorfilter_t): sk_colorfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorfilter_make_high_contrast {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const config: psk_highcontrastconfig_t): sk_colorfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorfilter_make_hsla_matrix {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const matrix: psk_colormatrix_t): sk_colorfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorfilter_make_lighting {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(multiply, add: sk_color_t): sk_colorfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorfilter_make_linear_to_srgb_gamma{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_colorfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorfilter_make_luma_color {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_colorfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorfilter_make_matrix {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const matrix: psk_colormatrix_t): sk_colorfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorfilter_make_overdraw {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const colors: psk_color_t): sk_colorfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorfilter_make_table {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const tablea_a, tablea_r, tablea_g, tablea_b: puint8_t): sk_colorfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_colorspace.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspace_gamma_close_to_srgb {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_colorspace_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspace_gamma_is_linear {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_colorspace_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspace_is_equal {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self, color_space: sk_colorspace_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspace_is_numerical_transfer_fn {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_colorspace_t; out transfer_function: sk_colorspacetransferfn_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspace_is_srgb {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_colorspace_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspace_make {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const profile: sk_colorspaceiccprofile_t): sk_colorspace_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspace_make_linear_gamma {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_colorspace_t): sk_colorspace_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspace_make_rgb {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const transfer_function: psk_colorspacetransferfn_t; const xyz: psk_colorspacexyz_t): sk_colorspace_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspace_make_srgb {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_colorspace_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspace_make_srgb_gamma {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_colorspace_t): sk_colorspace_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspace_make_srgb_linear {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_colorspace_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_colorspace_ref {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_colorspace_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspace_to_profile {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_colorspace_t): sk_colorspaceiccprofile_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspace_to_xyz {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_colorspace_t; out xyz: sk_colorspacexyz_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_colorspace_unref {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_colorspace_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_colorspaceiccprofile_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_colorspaceiccprofile_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspaceiccprofile_get_buffer {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_colorspaceiccprofile_t; size: puint32_t): puint8_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspaceiccprofile_make_with_parse{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const buffer: Pointer; size: size_t): sk_colorspaceiccprofile_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspaceiccprofile_to_xyz {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_colorspaceiccprofile_t; out dest: sk_colorspacexyz_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspaceprimaries_to_xyz {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: psk_colorspaceprimaries_t; out xyz: sk_colorspacexyz_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspacetransferfn_invert {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: psk_colorspacetransferfn_t; out transfer_function: sk_colorspacetransferfn_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_colorspacetransferfn_transform {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: psk_colorspacetransferfn_t; x: float): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_data.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_data_make_empty {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_data_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_data_make_with_copy{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const data: Pointer; size: size_t): sk_data_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_document.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_document_begin_page{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_document_t; width, height: float; const content: psk_rect_t): sk_canvas_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_document_close {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_document_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_document_end_page {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_document_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_document_make_pdf {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(w_stream: sk_wstream_t): sk_document_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_document_make_pdf2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(w_stream: sk_wstream_t; const metadata: psk_pdfmetadata_t): sk_document_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_document_make_xps {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(w_stream: sk_wstream_t; dpi: float): sk_document_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_document_terminate {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_document_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_font.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(typeface: sk_typeface_t; size, sx, kx: float): sk_font_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_create2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const font: sk_font_t): sk_font_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_font_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_baseline_snap {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_edging {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t): sk_fontedging_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_embedded_bitmaps {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_embolden {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_force_auto_hinting {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_glyphs {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t; const text: Pointer; size: size_t; encoding: sk_textencoding_t; result: psk_glyphid_t; max_count: int32_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_glyphs_count {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t; const text: Pointer; size: size_t; encoding: sk_textencoding_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_hinting {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t): sk_fonthinting_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_get_horizontal_positions{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_font_t; const glyphs: psk_glyphid_t; count: int32_t; result: pfloat; origin: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_intercepts {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t; const glyphs: psk_glyphid_t; count: int32_t; const positions: psk_point_t; const bounds: pfloat; result: pfloat; const paint: sk_paint_t): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_linear_metrics {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_metrics {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t; metrics: psk_fontmetrics_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_path {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t; glyph: sk_glyphid_t): sk_path_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_get_paths {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_font_t; const glyphs: psk_glyphid_t; count: int32_t; proc: sk_font_path_proc; proc_context: Pointer); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_get_positions {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_font_t; const glyphs: psk_glyphid_t; count: int32_t; result: psk_point_t; const origin: psk_point_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_scale_x {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_size {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_skew_x {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_subpixel {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_typeface {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t): sk_typeface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_get_typeface_or_default {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t): sk_typeface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_get_widths_bounds {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_font_t; const glyphs: psk_glyphid_t; count: int32_t; widths: pfloat; bounds: psk_rect_t; const paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_is_equal {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self, font: sk_font_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_measure_text {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t; const text: Pointer; size: size_t; encoding: sk_textencoding_t; bounds: psk_rect_t; const paint: sk_paint_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_set_baseline_snap {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_font_t; value: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_set_edging {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_font_t; value: sk_fontedging_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_set_embedded_bitmaps {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_font_t; value: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_set_embolden {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_font_t; value: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_set_force_auto_hinting {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_font_t; value: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_set_hinting {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_font_t; value: sk_fonthinting_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_set_linear_metrics {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_font_t; value: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_set_scale_x {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_font_t; value: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_set_size {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_font_t; value: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_set_skew_x {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_font_t; value: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_set_subpixel {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_font_t; value: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_set_typeface {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_font_t; typeface: sk_typeface_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_font_unichar_to_glyph {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_font_t; unichar: sk_unichar_t): sk_glyphid_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_font_unichars_to_glyphs {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_font_t; const unichars: psk_unichar_t; count: int32_t; result: psk_glyphid_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_graphics.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_graphics_allow_jit {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_graphics_dump_memory_statistics {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(trace_memory_dump: sk_tracememorydump_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_graphics_get_font_cache_count_limit {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_graphics_get_font_cache_count_used {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_graphics_get_font_cache_limit {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_graphics_get_font_cache_used {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_graphics_get_resource_cache_single_allocation_byte_limit{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_graphics_get_resource_cache_total_byte_limit {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_graphics_get_resource_cache_total_bytes_used {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_graphics_init {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_graphics_purge_all_caches {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_graphics_purge_font_cache {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_graphics_purge_resource_cache {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_graphics_set_font_cache_count_limit {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(value: int32_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_graphics_set_font_cache_limit {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(value: size_t): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_graphics_set_resource_cache_single_allocation_byte_limit{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(value: size_t): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_graphics_set_resource_cache_total_byte_limit {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(value: size_t): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_image.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_image_encode_to_file {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_image_t; const file_name: MarshaledAString; format: sk_encodedimageformat_t; quality: int32_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_image_encode_to_stream {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_image_t; w_stream: sk_wstream_t; format: sk_encodedimageformat_t; quality: int32_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_get_alpha_type {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t): sk_alphatype_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_get_color_space {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t): sk_colorspace_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_get_color_type {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t): sk_colortype_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_get_height {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_image_get_image_info {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_image_t; out result: sk_imageinfo_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_get_unique_id {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t): uint32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_get_width {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_is_lazy_generated {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_is_texture_backed {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_is_valid {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t; context: gr_directcontext_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_make_from_adopted_texture{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(context: gr_directcontext_t; const texture: gr_backendtexture_t; origin: gr_surfaceorigin_t; color_type: sk_colortype_t; alpha_type: sk_alphatype_t; color_space: sk_colorspace_t): sk_image_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_make_from_encoded_file {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const file_name: MarshaledAString): sk_image_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_make_from_encoded_stream {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(stream: sk_stream_t): sk_image_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_make_from_raster {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const pixmap: sk_pixmap_t; proc: sk_image_raster_release_proc; proc_context: Pointer): sk_image_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_make_from_texture {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(context: gr_directcontext_t; const texture: gr_backendtexture_t; origin: gr_surfaceorigin_t; color_type: sk_colortype_t; alpha_type: sk_alphatype_t; color_space: sk_colorspace_t; proc: sk_image_texture_release_proc; proc_context: Pointer): sk_image_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_make_non_texture_image {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t): sk_image_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_make_raster_copy {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const pixmap: sk_pixmap_t): sk_image_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_make_raster_image {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t): sk_image_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_make_shader {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t; tile_mode_x, tile_mode_y: sk_tilemode_t; const sampling: psk_samplingoptions_t; const local_matrix: psk_matrix_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_make_subset {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t; const subset: psk_irect_t; context: gr_directcontext_t): sk_image_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_make_texture_image {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t; context: gr_directcontext_t; is_mipmapped: bool): sk_image_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_make_with_filter {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t; context: gr_directcontext_t; const filter: sk_imagefilter_t; const subset, clip_bounds: psk_irect_t; out out_subset: sk_irect_t; out offset: sk_ipoint_t): sk_image_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_peek_pixels {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t): sk_pixmap_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_read_pixels {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t; context: gr_directcontext_t; const dest: sk_pixmap_t; src_x, src_y: int32_t; caching_hint: sk_imagecachinghint_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_image_scale_pixels {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_image_t; const dest: sk_pixmap_t; const sampling: psk_samplingoptions_t; caching_hint: sk_imagecachinghint_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_imageencoder.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imageencoder_encode_to_file {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const file_name: MarshaledAString; const src: sk_pixmap_t; format: sk_encodedimageformat_t; quality: int32_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imageencoder_encode_to_stream{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(w_stream: sk_wstream_t; const src: sk_pixmap_t; format: sk_encodedimageformat_t; quality: int32_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_imagefilter.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_alpha_threshold {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const region: sk_region_t; inner_min, outer_max: float; input: sk_imagefilter_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_arithmetic {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(k1, k2, k3, k4: float; enforce_premultiplied_color: bool; background, foreground: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_blend {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(mode: sk_blendmode_t; background, foreground: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_blur {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(sigma_x, sigma_y: float; tile_mode: sk_tilemode_t; input: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_colorfilter {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(color_filter: sk_colorfilter_t; input: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_compose {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(inner, outer: sk_imagefilter_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_dilate {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(radius_x, radius_y: float; input: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_displacement_map {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(x_channel_selector, y_channel_selector: sk_colorchannel_t; scale: float; displacement, input: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_distant_lit_diffuse {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const direction: psk_point3_t; light_color: sk_color_t; surface_scale, kd: float; input: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_distant_lit_specular{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const direction: psk_point3_t; light_color: sk_color_t; surface_scale, ks, shininess: float; input: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_drop_shadow {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(dx, dy, sigma_x, sigma_y: float; color: sk_color_t; input: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_drop_shadow_only {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(dx, dy, sigma_x, sigma_y: float; color: sk_color_t; input: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_erode {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(radius_x, radius_y: float; input: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_image {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(image: sk_image_t; const src, dest: psk_rect_t; const sampling: psk_samplingoptions_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_magnifier {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const src: psk_rect_t; inset: float; input: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_matrix_convolution {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const kernel_size: psk_isize_t; const kernel: pfloat; gain, bias: float; const kernel_offset: psk_ipoint_t; tile_mode: sk_tilemode_t; convolve_alpha: bool; input: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_matrix_transform {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const matrix: psk_matrix_t; const sampling: psk_samplingoptions_t; input: sk_imagefilter_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_merge {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const filters: psk_imagefilter_t; count: int32_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_offset {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(dx, dy: float; input: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_picture {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(picture: sk_picture_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_point_lit_diffuse {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const location: psk_point3_t; light_color: sk_color_t; surface_scale, kd: float; input: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_point_lit_specular {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const location: psk_point3_t; light_color: sk_color_t; surface_scale, ks, shininess: float; input: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_shader {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(shader: sk_shader_t; dither: bool; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_spot_lit_diffuse {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const location, target: psk_point3_t; falloff_exponent, cutoff_angle: float; light_color: sk_color_t; surface_scale, kd: float; input: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_spot_lit_specular {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const location, target: psk_point3_t; falloff_exponent, cutoff_angle: float; light_color: sk_color_t; surface_scale, ks, shininess: float; input: sk_imagefilter_t; const crop_rect: psk_rect_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_tile {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const src, dest: psk_rect_t; input: sk_imagefilter_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_imagefilter_make_with_local_matrix {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_imagefilter_t; const local_matrix: psk_matrix_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_maskfilter.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_maskfilter_make_blur {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(style: sk_blurstyle_t; sigma: float; respect_ctm: bool): sk_maskfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_maskfilter_make_shader {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(shader: sk_shader_t): sk_maskfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_maskfilter_make_table {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const table: puint8_t): sk_maskfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_maskfilter_make_table_clip {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(min, max: uint8_t): sk_maskfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_maskfilter_make_table_gamma{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(gamma: float): sk_maskfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_paint.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_paint_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_create2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const paint: sk_paint_t): sk_paint_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_get_alpha {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paint_t): uint8_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_get_alphaf {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paint_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_get_anti_alias {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paint_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_get_blender {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paint_t): sk_blender_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_get_color {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paint_t): sk_color_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_get_colorf {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_paint_t; out result: sk_color4f_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_get_color_filter {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paint_t): sk_colorfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_get_dither {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paint_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_get_fill_path {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paint_t; const path: sk_path_t; const cull_rect: psk_rect_t; res_scale: float): sk_path_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_get_image_filter {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paint_t): sk_imagefilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_get_mask_filter {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paint_t): sk_maskfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_get_path_effect {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paint_t): sk_patheffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_get_shader {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paint_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_get_stroke_cap {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paint_t): sk_strokecap_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_get_stroke_join {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paint_t): sk_strokejoin_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_get_stroke_miter {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paint_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_get_stroke_width {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paint_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paint_get_style {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paint_t): sk_paintstyle_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_reset {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_alpha {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; value: uint8_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_alphaf {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; value: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_antialias {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; value: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_argb {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; a, r, g, b: uint8_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_blender {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; value: sk_blender_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_color {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; value: sk_color_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_colorf {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; const value: psk_color4f_t; color_space: sk_colorspace_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_color_filter {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; value: sk_colorfilter_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_dither {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; value: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_image_filter {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; value: sk_imagefilter_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_mask_filter {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; value: sk_maskfilter_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_path_effect {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; value: sk_patheffect_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_shader {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; value: sk_shader_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_stroke_cap {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; value: sk_strokecap_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_stroke_join {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; value: sk_strokejoin_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_stroke_miter {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; value: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_stroke_width {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; value: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paint_set_style {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paint_t; value: sk_paintstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_path.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_opbuilder_add {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_opbuilder_t; const path: sk_path_t; op: sk_pathop_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_opbuilder_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_opbuilder_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_opbuilder_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_opbuilder_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_opbuilder_detach {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_opbuilder_t): sk_path_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_contains {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_path_t; x, y: float): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_convert_conic_to_quads{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const point1, point2, point3: psk_point_t; weight: float; points: psk_point_t; power2: int32_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const svg: MarshaledAString): sk_path_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_create2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(stream: sk_stream_t): sk_path_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_path_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_path_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_path_get_bounds {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_path_t; out result: sk_rect_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_get_fill_type {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_path_t): sk_pathfilltype_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_get_last_point {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_path_t; out result: sk_point_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_get_segment_masks {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_path_t): uint32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_path_get_tight_bounds {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_path_t; out result: sk_rect_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_interpolate {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self, cending: sk_path_t; weight: float): sk_path_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_is_convex {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_path_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_is_empty {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_path_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_is_finite {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_path_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_is_interpolatable {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self, path: sk_path_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_is_last_contour_closed{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_path_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_is_line {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_path_t; lines: psk_point_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_is_oval {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_path_t; oval: psk_rect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_is_rect {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_path_t; rect: psk_rect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_is_rrect {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_path_t; rrect: sk_rrect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_path_serialize_to_stream {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_path_t; w_stream: sk_wstream_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_to_svg {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_path_t): sk_string_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_path_transform {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_path_t; const matrix: psk_matrix_t): sk_path_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pathiterator_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const path: sk_path_t; force_close: bool): sk_pathiterator_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathiterator_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathiterator_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pathiterator_next {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_pathiterator_t; out elem: sk_pathiteratorelem_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_pathbuilder.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_add_arc {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const oval: psk_rect_t; start_angle, sweep_angle: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_add_circle {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; center_x, center_y, radius: float; direction: sk_pathdirection_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_add_oval {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const oval: psk_rect_t; direction: sk_pathdirection_t; start_index: uint32_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_add_path {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const path: sk_path_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_add_polygon {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; polygon: psk_point_t; count: int32_t; is_closed: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_add_rect {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const rect: psk_rect_t; direction: sk_pathdirection_t; start_index: uint32_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_add_rrect {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const rrect: sk_rrect_t; direction: sk_pathdirection_t; start_index: uint32_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_arc_to {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const radius: psk_point_t; x_axis_rotate: float; large_arc: sk_patharcsize_t; sweep: sk_pathdirection_t; const xy: psk_point_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_arc_to2 {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const oval: psk_rect_t; start_angle, sweep_angle: float; force_move_to: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_arc_to3 {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const point1, point2: psk_point_t; radius: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_close {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_conic_to {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const point1, point2: psk_point_t; weight: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pathbuilder_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_pathbuilder_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pathbuilder_create2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const path_builder: sk_pathbuilder_t): sk_pathbuilder_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_cubic_to {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const point1, point2, point3: psk_point_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pathbuilder_detach {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_pathbuilder_t): sk_path_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_get_bounds {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_pathbuilder_t; out result: sk_rect_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pathbuilder_get_fill_type {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_pathbuilder_t): sk_pathfilltype_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_inc_reserve {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; extra_point_count, extra_verb_count: int32_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_line_to {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const cpoint: psk_point_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_move_to {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const cpoint: psk_point_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_offset {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; dx, dy: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_polyline_to {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const points: psk_point_t; count: int32_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_quad_to {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const point1, point2: psk_point_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_r_conic_to {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const point1, point2: psk_point_t; weight: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_r_cubic_to {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const point1, point2, point3: psk_point_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_r_line_to {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const point: psk_point_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_r_quad_to {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; const point1, point2: psk_point_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_reset {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_set_filltype {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t; value: sk_pathfilltype_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pathbuilder_snapshot {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_pathbuilder_t): sk_path_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathbuilder_toggle_inverse_filltype{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathbuilder_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_patheffect.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_patheffect_make_1dpath {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const path: sk_path_t; advance, phase: float; style: sk_patheffect1dstyle_t): sk_patheffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_patheffect_make_2dline {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(width: float; const matrix: psk_matrix_t): sk_patheffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_patheffect_make_2dpath {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const matrix: psk_matrix_t; const path: sk_path_t): sk_patheffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_patheffect_make_compose {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(outer, inner: sk_patheffect_t): sk_patheffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_patheffect_make_corner {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(radius: float): sk_patheffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_patheffect_make_dash {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const intervals: pfloat; count: int32_t; phase: float): sk_patheffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_patheffect_make_discrete {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(seg_length, deviation: float; seed_assist: uint32_t): sk_patheffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_patheffect_make_matrix {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const matrix: psk_matrix_t): sk_patheffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_patheffect_make_merge {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(effect1, effect2: sk_patheffect_t; op: sk_pathop_t): sk_patheffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_patheffect_make_stroke {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(width: float; join: sk_strokejoin_t; cap: sk_strokecap_t; miter: float): sk_patheffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_patheffect_make_stroke_and_fill{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_patheffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_patheffect_make_sum {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(effect1, effect2: sk_patheffect_t): sk_patheffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_patheffect_make_translate {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(dx, dy: float): sk_patheffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_patheffect_make_trim {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(start, stop: float; mode: sk_patheffecttrimmode_t): sk_patheffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_pathmeasure.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pathmeasure_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const path: sk_path_t; force_closed: bool; res_scale: float): sk_pathmeasure_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pathmeasure_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pathmeasure_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pathmeasure_get_length {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_pathmeasure_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pathmeasure_get_matrix {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_pathmeasure_t; distance: float; out matrix: sk_matrix_t; matrix_flags: uint32_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pathmeasure_get_position_and_tangent{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_pathmeasure_t; distance: float; out position: sk_point_t; out tangent: sk_vector_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pathmeasure_get_segment {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_pathmeasure_t; start, stop: float; start_with_move_to: bool): sk_path_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pathmeasure_is_closed {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_pathmeasure_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pathmeasure_next_contour {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_pathmeasure_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_picture.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_picture_get_cull_rect {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_picture_t; out result: sk_rect_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_picture_make_from_stream {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(stream: sk_stream_t): sk_picture_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_picture_make_shader {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_picture_t; tile_mode_x, tile_mode_y: sk_tilemode_t; filter_mode: sk_filtermode_t; const local_matrix: psk_matrix_t; const tile_rect: psk_rect_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_picture_playback {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_picture_t; canvas: sk_canvas_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_picture_serialize_to_stream{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_picture_t; w_stream: sk_wstream_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_picturerecorder.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_picturerecorder_begin_recording {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_picturerecorder_t; const bounds: psk_rect_t): sk_canvas_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_picturerecorder_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_picturerecorder_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_picturerecorder_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_picturerecorder_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_picturerecorder_finish_recording {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_picturerecorder_t): sk_picture_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_picturerecorder_finish_recording2{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_picturerecorder_t; const cull_rect: psk_rect_t): sk_picture_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_pixmap.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pixmap_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const image_info: psk_imageinfo_t; const pixels: Pointer; row_bytes: size_t): sk_pixmap_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pixmap_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pixmap_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pixmap_erase {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_pixmap_t; color: sk_color_t; const area: psk_irect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pixmap_erase2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_pixmap_t; const color: psk_color4f_t; color_space: sk_colorspace_t; const area: psk_irect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pixmap_extract_subset {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_pixmap_t; dest: sk_pixmap_t; const area: psk_irect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pixmap_get_alpha {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_pixmap_t; x, y: int32_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pixmap_get_alpha_type {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_pixmap_t): sk_alphatype_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pixmap_get_color {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_pixmap_t; x, y: int32_t): sk_color_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pixmap_get_color_space{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_pixmap_t): sk_colorspace_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pixmap_get_color_type {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_pixmap_t): sk_colortype_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pixmap_get_height {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_pixmap_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pixmap_get_image_info {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_pixmap_t; out result: sk_imageinfo_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pixmap_get_pixel_addr {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_pixmap_t; x, y: int32_t): Pointer; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pixmap_get_pixels {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_pixmap_t): Pointer; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pixmap_get_row_bytes {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_pixmap_t): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pixmap_get_width {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_pixmap_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pixmap_read_pixels {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self, dest: sk_pixmap_t; src_x, src_y: int32_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_pixmap_scale_pixels {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self, dest: sk_pixmap_t; const sampling: psk_samplingoptions_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_pixmap_set_colorspace {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_pixmap_t; value: sk_colorspace_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_refcnt.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_refcnt_ref {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_refcnt_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_refcnt_unref{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_refcnt_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_region.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_contains {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self, region: sk_region_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_contains2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_region_t; const rect: psk_irect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_contains3 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_region_t; x, y: int32_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_region_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_create2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const region: sk_region_t): sk_region_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_region_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_region_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_get_boundary_path {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_region_t): sk_path_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_region_get_bounds {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_region_t; out result: sk_irect_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_intersects {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self, region: sk_region_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_intersects2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_region_t; const rect: psk_irect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_is_complex {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_region_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_is_empty {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_region_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_is_equal {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self, region: sk_region_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_is_rect {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_region_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_op {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_region_t; const region: sk_region_t; op: sk_regionop_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_op2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_region_t; const rect: psk_irect_t; op: sk_regionop_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_quick_contains {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_region_t; const rect: psk_irect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_quick_reject {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self, region: sk_region_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_quick_reject2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_region_t; const rect: psk_irect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_region_set_empty {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_region_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_set_path {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_region_t; const path: sk_path_t; const clip: sk_region_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_set_rect {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_region_t; const rect: psk_irect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_region_set_rects {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_region_t; const rects: psk_irect_t; count: int32_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_region_translate {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_region_t; x, y: int32_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_regioncliperator_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const region: sk_region_t; const clip: psk_irect_t): sk_regioncliperator_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_regioncliperator_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_regioncliperator_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_regioncliperator_get_current{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_regioncliperator_t; out result: sk_irect_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_regioncliperator_move_next {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_regioncliperator_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_regioniterator_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const region: sk_region_t): sk_regioniterator_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_regioniterator_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_regioniterator_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_regioniterator_get_current {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_regioniterator_t; out result: sk_irect_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_regioniterator_move_next {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_regioniterator_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_regioniterator_reset {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_regioniterator_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_regionspanerator_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const region: sk_region_t; y, left, right: int32_t): sk_regionspanerator_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_regionspanerator_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_regionspanerator_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_regionspanerator_next {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_regionspanerator_t; out elem: sk_ipoint_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_rrect.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_rrect_contains {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_rrect_t; const rect: psk_rect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_rrect_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_rrect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_rrect_create2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const rrect: sk_rrect_t): sk_rrect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_rrect_deflate {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_rrect_t; dx, dy: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_rrect_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_rrect_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_rrect_get_height {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_rrect_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_rrect_get_radii {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_rrect_t; corner: sk_rrectcorner_t; out result: sk_vector_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_rrect_get_rect {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_rrect_t; out result: sk_rect_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_rrect_get_simple_radii{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_rrect_t; out result: sk_vector_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_rrect_get_width {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_rrect_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_rrect_inflate {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_rrect_t; dx, dy: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_rrect_is_complex {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_rrect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_rrect_is_empty {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_rrect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_rrect_is_equal {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self, rrect: sk_rrect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_rrect_is_nine_patch {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_rrect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_rrect_is_oval {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_rrect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_rrect_is_rect {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_rrect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_rrect_is_simple {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_rrect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_rrect_is_valid {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_rrect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_rrect_offset {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_rrect_t; dx, dy: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_rrect_set_empty {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_rrect_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_rrect_set_nine_patch {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_rrect_t; const rect: psk_rect_t; radius_left, radius_top, radius_right, radius_bottom: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_rrect_set_oval {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_rrect_t; const rect: psk_rect_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_rrect_set_rect {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_rrect_t; const rect: psk_rect_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_rrect_set_rect2 {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_rrect_t; const rect: psk_rect_t; const radii: psk_vector_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_rrect_set_rect3 {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_rrect_t; const rect: psk_rect_t; radius_x, radius_y: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_rrect_transform {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_rrect_t; const matrix: psk_matrix_t): sk_rrect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_runtimeeffect.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_runtimeeffect_get_child_count {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_runtimeeffect_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_runtimeeffect_get_child_name {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_runtimeeffect_t; index: int32_t): MarshaledAString; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_runtimeeffect_get_child_type {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_runtimeeffect_t; index: int32_t): sk_runtimeeffectchildtype_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_runtimeeffect_get_uniform_count {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_runtimeeffect_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_runtimeeffect_get_uniform_data_size {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_runtimeeffect_t): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_runtimeeffect_get_uniform_name {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_runtimeeffect_t; index: int32_t): MarshaledAString; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_runtimeeffect_get_uniform_offset {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_runtimeeffect_t; index: int32_t): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_runtimeeffect_get_uniform_type {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_runtimeeffect_t; index: int32_t): sk_runtimeeffectuniformtype_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_runtimeeffect_get_uniform_type_count{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_runtimeeffect_t; index: int32_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_runtimeeffect_index_of_child {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_runtimeeffect_t; const name: MarshaledAString): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_runtimeeffect_index_of_uniform {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_runtimeeffect_t; const name: MarshaledAString): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_runtimeeffect_make_blender {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_runtimeeffect_t; const uniforms: Pointer; children: psk_blender_t): sk_blender_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_runtimeeffect_make_color_filter {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_runtimeeffect_t; const uniforms: Pointer; children: psk_colorfilter_t): sk_colorfilter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_runtimeeffect_make_for_blender {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const sksl: MarshaledAString; error_text: sk_string_t): sk_runtimeeffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_runtimeeffect_make_for_color_filter {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const sksl: MarshaledAString; error_text: sk_string_t): sk_runtimeeffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_runtimeeffect_make_for_shader {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const sksl: MarshaledAString; error_text: sk_string_t): sk_runtimeeffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_runtimeeffect_make_shader {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_runtimeeffect_t; const uniforms: Pointer; children: psk_shader_t; const local_matrix: psk_matrix_t; opaque: bool): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_shader.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_shader_make_blend {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(mode: sk_blendmode_t; dest, src: sk_shader_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_shader_make_color {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(color: sk_color_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_shader_make_color2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const color: psk_color4f_t; color_space: sk_colorspace_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_shader_make_gradient_linear {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const points: psk_point_t; const colors: psk_color_t; const positions: pfloat; count: int32_t; tile_mode: sk_tilemode_t; const local_matrix: psk_matrix_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_shader_make_gradient_linear2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const points: psk_point_t; const colors: psk_color4f_t; color_space: sk_colorspace_t; const positions: pfloat; count: int32_t; tile_mode: sk_tilemode_t; const local_matrix: psk_matrix_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_shader_make_gradient_radial {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const center: psk_point_t; radius: float; const colors: psk_color_t; const positions: pfloat; count: int32_t; tile_mode: sk_tilemode_t; const local_matrix: psk_matrix_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_shader_make_gradient_radial2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const center: psk_point_t; radius: float; const colors: psk_color4f_t; color_space: sk_colorspace_t; const positions: pfloat; count: int32_t; tile_mode: sk_tilemode_t; const local_matrix: psk_matrix_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_shader_make_gradient_sweep {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(center_x, center_y: float; const colors: psk_color_t; const positions: pfloat; count: int32_t; tile_mode: sk_tilemode_t; start_angle, end_angle: float; const local_matrix: psk_matrix_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_shader_make_gradient_sweep2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(center_x, center_y: float; const colors: psk_color4f_t; color_space: sk_colorspace_t; const positions: pfloat; count: int32_t; tile_mode: sk_tilemode_t; start_angle, end_angle: float; const local_matrix: psk_matrix_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_shader_make_gradient_two_point_conical {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const start: psk_point_t; start_radius: float; const &end: psk_point_t; end_radius: float; const colors: psk_color_t; const positions: pfloat; count: int32_t; tile_mode: sk_tilemode_t; const local_matrix: psk_matrix_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_shader_make_gradient_two_point_conical2{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const start: psk_point_t; start_radius: float; const &end: psk_point_t; end_radius: float; const colors: psk_color4f_t; color_space: sk_colorspace_t; const positions: pfloat; count: int32_t; tile_mode: sk_tilemode_t; const local_matrix: psk_matrix_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_shader_make_perlin_noise_fractal_noise {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(base_frequency_x, base_frequency_y: float; num_octaves: int32_t; seed: float; const tile_size: psk_isize_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_shader_make_perlin_noise_turbulence {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(base_frequency_x, base_frequency_y: float; num_octaves: int32_t; seed: float; const tile_size: psk_isize_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_shader_make_with_color_filter {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_shader_t; color_filter: sk_colorfilter_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_shader_make_with_local_matrix {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_shader_t; const local_matrix: psk_matrix_t): sk_shader_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_stream.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_streamadapter_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(context: Pointer): sk_streamadapter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_streamadapter_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_streamadapter_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_streamadapter_set_procs {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const procs: psk_streamadapter_procs_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_wstreamadapter_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(context: Pointer): sk_wstreamadapter_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_wstreamadapter_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_wstreamadapter_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_wstreamadapter_set_procs{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const procs: psk_wstreamadapter_procs_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_string.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_string_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_string_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_string_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_string_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_string_get_text{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_string_t): MarshaledAString; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_string_set_text{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_string_t; const value: MarshaledAString); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_surface.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_surface_draw {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_surface_t; canvas: sk_canvas_t; x, y: float; paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_surface_flush {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_surface_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_surface_flush_and_submit {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_surface_t; sync_cpu: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_surface_get_canvas {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_surface_t): sk_canvas_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_surface_get_props {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_surface_t; out result: sk_surfaceprops_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_surface_make_from_ca_metal_layer{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(context: gr_directcontext_t; layer: gr_mtl_handle_t; origin: gr_surfaceorigin_t; sample_count: int32_t; color_type: sk_colortype_t; color_space: sk_colorspace_t; const props: psk_surfaceprops_t; out drawable: gr_mtl_handle_t): sk_surface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_surface_make_from_mtk_view {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(context: gr_directcontext_t; layer: gr_mtl_handle_t; origin: gr_surfaceorigin_t; sample_count: int32_t; color_type: sk_colortype_t; color_space: sk_colorspace_t; const props: psk_surfaceprops_t): sk_surface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_surface_make_from_render_target {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(context: gr_directcontext_t; const render_target: gr_backendrendertarget_t; origin: gr_surfaceorigin_t; color_type: sk_colortype_t; color_space: sk_colorspace_t; const props: psk_surfaceprops_t): sk_surface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_surface_make_from_texture {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(context: gr_directcontext_t; const texture: gr_backendtexture_t; origin: gr_surfaceorigin_t; sample_count: int32_t; color_type: sk_colortype_t; color_space: sk_colorspace_t; const props: psk_surfaceprops_t): sk_surface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_surface_make_image_snapshot {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_surface_t): sk_image_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_surface_make_image_snapshot2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_surface_t; const bounds: psk_irect_t): sk_image_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_surface_make_raster {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const image_info: psk_imageinfo_t; row_bytes: size_t; const props: psk_surfaceprops_t): sk_surface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_surface_make_raster_direct {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const pixmap: sk_pixmap_t; proc: sk_surface_raster_release_proc; proc_context: Pointer; const props: psk_surfaceprops_t): sk_surface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_surface_make_render_target {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(context: gr_directcontext_t; is_budgeted: bool; const image_info: psk_imageinfo_t; sample_count: int32_t; origin: gr_surfaceorigin_t; const props: psk_surfaceprops_t; should_create_with_mips: bool): sk_surface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_surface_peek_pixels {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_surface_t): sk_pixmap_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_surface_read_pixels {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_surface_t; const dest: sk_pixmap_t; src_x, src_y: int32_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF} {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF} {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_svgcanvas.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_svgcanvas_make{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const bounds: psk_rect_t; w_stream: sk_wstream_t; flags: uint32_t): sk_canvas_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF} {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF} {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_textblob.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textblob_get_intercepts {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_textblob_t; const bounds: pfloat; result: pfloat; const paint: sk_paint_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textblob_make_from_text {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const text: Pointer; size: size_t; const font: sk_font_t; encoding: sk_textencoding_t): sk_textblob_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textblob_make_from_text_horizontally_positioned{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const text: Pointer; size: size_t; const x_positions: pfloat; y: float; const font: sk_font_t; encoding: sk_textencoding_t): sk_textblob_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textblob_make_from_text_positioned {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const text: Pointer; size: size_t; const positions: psk_point_t; const font: sk_font_t; encoding: sk_textencoding_t): sk_textblob_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textblob_make_from_text_transform {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const text: Pointer; size: size_t; const matrices: psk_rotationscalematrix_t; const font: sk_font_t; encoding: sk_textencoding_t): sk_textblob_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textblob_ref {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_textblob_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textblob_unref {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_textblob_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_tracememorydump.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_tracememorydumpbaseclass_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(detailed_dump, dump_wrapped_objects: bool; context: Pointer): sk_tracememorydumpbaseclass_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_tracememorydumpbaseclass_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_tracememorydumpbaseclass_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_tracememorydumpbaseclass_set_procs{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const procs: psk_tracememorydumpbaseclass_procs_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_typeface.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_typeface_get_family_name {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_typeface_t): sk_string_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_typeface_get_slant {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_typeface_t): sk_fontslant_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_typeface_get_style {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_typeface_t; out result: sk_fontstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_typeface_get_weight {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_typeface_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_typeface_get_width {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_typeface_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_typeface_make_default {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_typeface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_typeface_make_from_file {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const file_name: MarshaledAString; ttc_index: int32_t): sk_typeface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_typeface_make_from_stream{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(stream: sk_stream_t; ttc_index: int32_t): sk_typeface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_typeface_make_from_name {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const family_name: MarshaledAString; const style: psk_fontstyle_t): sk_typeface_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_version.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_version_get_build {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_version_get_major {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_version_get_milestone{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_version_get_minor {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_vertices.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_vertices_make_copy{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(vertex_mode: sk_vertexmode_t; vertex_count: int32_t; const positions, textures: psk_point_t; const colors: psk_color_t; index_count: int32_t; const indices: puint16_t): sk_vertices_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_vertices_ref {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_vertices_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_vertices_unref {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_vertices_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'modules/particles/include/sk4d_particleeffect.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_particleeffect_get_position {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_particleeffect_t; out result: sk_point_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_particleeffect_get_rate {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_particleeffect_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_particleeffect_get_uniform {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_particleeffect_t; index: size_t; out result: sk_particleuniform_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_particleeffect_get_uniform_count {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_particleeffect_t): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_particleeffect_get_uniform_data {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_particleeffect_t): pfloat; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_particleeffect_get_uniform_data_count{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_particleeffect_t): int32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_particleeffect_get_uniform_name {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_particleeffect_t; index: size_t): sk_string_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_particleeffect_init {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_particleeffect_make_from_file {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const file_name: MarshaledAString): sk_particleeffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_particleeffect_make_from_stream {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(stream: sk_stream_t; resource_provider: sk_resourceprovider_t): sk_particleeffect_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_particleeffect_render {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_particleeffect_t; canvas: sk_canvas_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_particleeffect_set_position {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_particleeffect_t; const value: psk_point_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_particleeffect_set_rate {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_particleeffect_t; value: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_particleeffect_set_uniform {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_particleeffect_t; const name: MarshaledAString; const data: pfloat; count: int32_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_particleeffect_start {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_particleeffect_t; now: double; looping: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_particleeffect_update {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_particleeffect_t; now: double); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skottie/include/sk4d_skottie.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_skottieanimation_get_duration {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_skottieanimation_t): double; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_skottieanimation_get_fps {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_skottieanimation_t): double; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_skottieanimation_get_in_point {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_skottieanimation_t): double; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_skottieanimation_get_out_point {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_skottieanimation_t): double; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_skottieanimation_get_size {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_skottieanimation_t; out result: sk_size_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_skottieanimation_get_version {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_skottieanimation_t): MarshaledAString; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_skottieanimation_make_from_file {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const file_name: MarshaledAString): sk_skottieanimation_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_skottieanimation_make_from_stream{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(stream: sk_stream_t; resource_provider: sk_resourceprovider_t): sk_skottieanimation_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_skottieanimation_ref {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_skottieanimation_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_skottieanimation_render {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_skottieanimation_t; canvas: sk_canvas_t; const dest: psk_rect_t; render_flags: uint32_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_skottieanimation_seek_frame {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_skottieanimation_t; tick: double); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_skottieanimation_seek_frame_time {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_skottieanimation_t; tick: double); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_skottieanimation_unref {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_skottieanimation_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skparagraph/include/sk4d_paragraph.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraph_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraph_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraph_did_exceed_max_lines {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_paragraph_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraph_get_alphabetic_baseline {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_paragraph_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraph_get_glyph_position_at_coordinate{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraph_t; dx, dy: float; out result: sk_positionaffinity_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraph_get_height {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_paragraph_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraph_get_ideographic_baseline {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_paragraph_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraph_get_line_metrics {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_paragraph_t; result: psk_metrics_t): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraph_get_longest_line {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_paragraph_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraph_get_max_intrinsic_width {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_paragraph_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraph_get_max_width {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_paragraph_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraph_get_min_intrinsic_width {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_paragraph_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraph_get_rects_for_placeholders {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_paragraph_t; result: psk_textbox_t): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraph_get_rects_for_range {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_paragraph_t; start, &end: uint32_t; rect_height_style: sk_rectheightstyle_t; rect_width_style: sk_rectwidthstyle_t; result: psk_textbox_t): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraph_get_word_boundary {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraph_t; offset: uint32_t; out start, &end: uint32_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraph_layout {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraph_t; width: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraph_paint {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraph_t; canvas: sk_canvas_t; x, y: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraph_to_path {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_paragraph_t): sk_path_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skparagraph/include/sk4d_paragraphbuilder.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraphbuilder_add_placeholder{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraphbuilder_t; const placeholder: psk_placeholderstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraphbuilder_add_text {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraphbuilder_t; const text: pchar; size: size_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraphbuilder_build {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_paragraphbuilder_t): sk_paragraph_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraphbuilder_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const paragraph_style: sk_paragraphstyle_t): sk_paragraphbuilder_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraphbuilder_create2 {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const paragraph_style: sk_paragraphstyle_t; font_provider: sk_typefacefontprovider_t; enable_font_fallback: bool): sk_paragraphbuilder_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraphbuilder_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraphbuilder_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraphbuilder_pop {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraphbuilder_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraphbuilder_push_style {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraphbuilder_t; const text_style: sk_textstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skparagraph/include/sk4d_paragraphstyle.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_paragraphstyle_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraphstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_disable_hinting {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraphstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_get_ellipsis {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paragraphstyle_t): sk_string_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_get_height {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paragraphstyle_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_get_max_lines {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paragraphstyle_t): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_get_strut_style {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paragraphstyle_t): sk_strutstyle_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_get_text_align {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paragraphstyle_t): sk_textalign_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_get_text_direction {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paragraphstyle_t): sk_textdirection_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_get_text_height_behaviors{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paragraphstyle_t): uint32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_get_text_style {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_paragraphstyle_t): sk_textstyle_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_set_ellipsis {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraphstyle_t; const value: MarshaledAString); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_set_height {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraphstyle_t; value: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_set_max_lines {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraphstyle_t; value: size_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_set_strut_style {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraphstyle_t; const value: sk_strutstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_set_text_align {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraphstyle_t; value: sk_textalign_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_set_text_direction {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraphstyle_t; value: sk_textdirection_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_set_text_height_behaviors{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraphstyle_t; value: uint32_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_paragraphstyle_set_text_style {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_paragraphstyle_t; value: sk_textstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_strutstyle_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_strutstyle_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_strutstyle_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_strutstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_strutstyle_get_enabled {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_strutstyle_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_strutstyle_get_font_families {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_strutstyle_t; const result: PMarshaledAString): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_strutstyle_get_font_size {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_strutstyle_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_strutstyle_get_font_style {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_strutstyle_t; out result: sk_fontstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_strutstyle_get_force_height {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_strutstyle_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_strutstyle_get_half_leading {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_strutstyle_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_strutstyle_get_height_multiplier {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_strutstyle_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_strutstyle_get_leading {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_strutstyle_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_strutstyle_is_equal {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_strutstyle_t; const strut_style: sk_strutstyle_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_strutstyle_set_enabled {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_strutstyle_t; value: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_strutstyle_set_font_families {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_strutstyle_t; const values: PMarshaledAString; count: size_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_strutstyle_set_font_size {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_strutstyle_t; value: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_strutstyle_set_font_style {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_strutstyle_t; value: psk_fontstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_strutstyle_set_force_height {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_strutstyle_t; value: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_strutstyle_set_half_leading {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_strutstyle_t; value: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_strutstyle_set_height_multiplier {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_strutstyle_t; value: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_strutstyle_set_leading {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_strutstyle_t; value: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skparagraph/include/sk4d_textstyle.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_add_font_feature {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t; const feature: MarshaledAString; value: int32_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_add_shadow {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t; const shadow: psk_textshadow_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_clear_background_color {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_clear_foreground_color {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textstyle_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_textstyle_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textstyle_get_background {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_textstyle_t): sk_paint_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textstyle_get_color {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_textstyle_t): sk_color_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textstyle_get_decoration_color {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_textstyle_t): sk_color_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textstyle_get_decoration_style {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_textstyle_t): sk_textdecorationstyle_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textstyle_get_decoration_thickness{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_textstyle_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textstyle_get_decorations {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_textstyle_t): uint32_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textstyle_get_font_families {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_textstyle_t; const result: PMarshaledAString): size_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_get_font_metrics {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_textstyle_t; out result: sk_fontmetrics_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textstyle_get_font_size {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_textstyle_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_get_font_style {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_textstyle_t; out result: sk_fontstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textstyle_get_foreground {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_textstyle_t): sk_paint_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textstyle_get_half_leading {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_textstyle_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textstyle_get_height_multiplier {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_textstyle_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textstyle_get_letter_spacing {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_textstyle_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textstyle_get_locale {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_textstyle_t): sk_string_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textstyle_get_word_spacing {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_textstyle_t): float; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_textstyle_is_equal {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self, text_style: sk_textstyle_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_reset_font_features {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_reset_shadows {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_set_background_color {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t; paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_set_color {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t; value: sk_color_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_set_decoration_color {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t; value: sk_color_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_set_decoration_style {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t; value: sk_textdecorationstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_set_decoration_thickness{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t; value: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_set_decorations {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t; value: uint32_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_set_font_families {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t; const values: PMarshaledAString; count: size_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_set_font_size {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t; value: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_set_font_style {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t; const value: psk_fontstyle_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_set_foreground_color {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t; paint: sk_paint_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_set_half_leading {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t; value: bool); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_set_height_multiplier {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t; value: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_set_letter_spacing {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t; value: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_set_locale {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t; const value: MarshaledAString); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_textstyle_set_word_spacing {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_textstyle_t; value: float); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skparagraph/include/sk4d_typefacefontprovider.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_typefacefontprovider_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_typefacefontprovider_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_typefacefontprovider_register_typeface {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_typefacefontprovider_t; typeface: sk_typeface_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_typefacefontprovider_register_typeface2{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_typefacefontprovider_t; typeface: sk_typeface_t; const family_name: MarshaledAString); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skresources/include/sk4d_resources.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_resourceproviderbaseclass_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(predecode: bool; context: Pointer): sk_resourceproviderbaseclass_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_resourceproviderbaseclass_set_procs{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const procs: psk_resourceproviderbaseclass_procs_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skshaper/include/sk4d_shaper.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_shaper_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_shaper_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_shaper_destroy{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_shaper_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_shaper_shape {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_shaper_t; const text: pchar; size: size_t; const font: sk_font_t; left_to_right: bool; width: float; const offset: psk_point_t; end_point: psk_point_t): sk_textblob_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skunicode/include/sk4d_unicode.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_unicode_create {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(): sk_unicode_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_unicode_destroy {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_unicode_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_unicode_for_each_bidi_region{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_unicode_t; const text: puint16_t; units: int32_t; direction: sk_direction_t; proc: sk_unicode_bidi_region_proc; context: Pointer); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_unicode_for_each_break {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_unicode_t; const text: pchar16_t; units: int32_t; &type: sk_breaktype_t; proc: sk_unicode_break_proc; context: Pointer); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_unicode_for_each_codepoint {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_unicode_t; const text: pchar16_t; units: int32_t; proc: sk_unicode_codepoint_proc; context: Pointer); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'modules/svg/include/sk4d_svgdom.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_svgdom_find_node_by_id {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_svgdom_t; const id: MarshaledAString): sk_svgnode_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_svgdom_get_root {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_svgdom_t): sk_svgsvg_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_svgdom_make_from_file {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const file_name: MarshaledAString): sk_svgdom_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_svgdom_make_from_stream {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(stream: sk_stream_t; resource_provider: sk_resourceprovider_t): sk_svgdom_t; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_svgdom_render {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_svgdom_t; canvas: sk_canvas_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_svgdom_set_container_size{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_svgdom_t; const size: psk_size_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'modules/svg/include/sk4d_svgnode.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_svgnode_set_attribute{$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(self: sk_svgnode_t; const name, value: MarshaledAString): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$REGION 'modules/svg/include/sk4d_svgsvg.h'}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_svgsvg_get_height {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_svgsvg_t; out result: sk_svglength_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_svgsvg_get_intrinsic_size {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_svgsvg_t; const view_port: psk_size_t; dpi: float; out result: sk_size_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_svgsvg_get_preserve_aspect_ratio{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_svgsvg_t; out result: sk_svgpreserveaspectratio_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class function {$ELSE}class var {$ENDIF}sk4d_svgsvg_get_view_box {$IFDEF SK_DYNAMIC_LOADING}: function {$ENDIF}(const self: sk_svgsvg_t; out result: sk_rect_t): bool; cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_svgsvg_get_width {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_svgsvg_t; out result: sk_svglength_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_svgsvg_get_x {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_svgsvg_t; out result: sk_svglength_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_svgsvg_get_y {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(const self: sk_svgsvg_t; out result: sk_svglength_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_svgsvg_set_height {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_svgsvg_t; value: psk_svglength_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_svgsvg_set_preserve_aspect_ratio{$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_svgsvg_t; value: psk_svgpreserveaspectratio_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_svgsvg_set_view_box {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_svgsvg_t; view_box: psk_rect_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_svgsvg_set_width {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_svgsvg_t; value: psk_svglength_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_svgsvg_set_x {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_svgsvg_t; value: psk_svglength_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$IFNDEF SK_DYNAMIC_LOADING}class procedure {$ELSE}class var {$ENDIF}sk4d_svgsvg_set_y {$IFDEF SK_DYNAMIC_LOADING}: procedure {$ENDIF}(self: sk_svgsvg_t; value: psk_svglength_t); cdecl; {$IFNDEF SK_DYNAMIC_LOADING}static;{$ENDIF}
{$ENDREGION}
{$IFDEF SK_DYNAMIC_LOADING}
class property LibHandle: HMODULE read FLibHandle;
{$ENDIF}
end;
{$ENDREGION}
implementation
{$IF DEFINED(MSWINDOWS) or (DEFINED(ANDROID) and DEFINED(SK_DYNAMIC_LOADING))}
uses
{ Delphi }
{$IFDEF MSWINDOWS}
System.Math;
{$ELSE}
System.IOUtils;
{$ENDIF}
{$ENDIF}
{$REGION 'Dynamic loading utils'}
{$IFDEF SK_DYNAMIC_LOADING}
function GetProcAddress(AModule: HMODULE; AName: System.PChar): Pointer;
begin
{$IFDEF MSWINDOWS}
Result := Winapi.Windows.GetProcAddress(AModule, AName);
{$ELSE}
Result := System.SysUtils.GetProcAddress(AModule, AName);
{$ENDIF}
if Result = nil then
raise ESkiaAPI.CreateFmt('"%s" function address could not be retrieved from Skia library', [AName]) at ReturnAddress;
end;
{$ENDIF}
{$ENDREGION}
{$REGION 'Skia API'}
{ TSkiaAPI }
{$IF DEFINED(MSWINDOWS) or DEFINED(SK_DYNAMIC_LOADING)}
class constructor TSkiaAPI.Create;
begin
{$IFDEF MSWINDOWS}
SetExceptionMask(exAllArithmeticExceptions);
{$ENDIF}
{$IFDEF SK_DYNAMIC_LOADING}
Initialize;
{$ENDIF}
end;
{$ENDIF}
{$IFDEF SK_DYNAMIC_LOADING}
class destructor TSkiaAPI.Destroy;
begin
Terminate;
end;
{$ENDIF}
class procedure TSkiaAPI.Initialize;
begin
{$IFDEF SK_DYNAMIC_LOADING}
if AtomicIncrement(FRefCount) = 1 then
begin
// Some Android devices, normally old, need the full path of the library,
// and other devices, normally new, do not accept the full path.
{$IFDEF ANDROID}
FLibHandle := SafeLoadLibrary(TSkiaAPI.LibName);
if FLibHandle = 0 then
FLibHandle := SafeLoadLibrary(TPath.Combine(TPath.GetLibraryPath, TSkiaAPI.LibName));
{$ELSE}
FLibHandle := SafeLoadLibrary(TSkiaAPI.LibName);
{$ENDIF}
if FLibHandle = 0 then
raise ESkiaAPI.Create('Skia library could not be loaded');
{$ELSE}
end;
{$ENDIF}
{$REGION 'include/c/gr4d_backendsurface.h'}
{$IFDEF SK_DYNAMIC_LOADING}
gr4d_backendrendertarget_create_gl := GetProcAddress(FLibHandle, 'gr4d_backendrendertarget_create_gl');
gr4d_backendrendertarget_create_mtl := GetProcAddress(FLibHandle, 'gr4d_backendrendertarget_create_mtl');
gr4d_backendrendertarget_destroy := GetProcAddress(FLibHandle, 'gr4d_backendrendertarget_destroy');
gr4d_backendrendertarget_get_backend_api := GetProcAddress(FLibHandle, 'gr4d_backendrendertarget_get_backend_api');
gr4d_backendrendertarget_get_height := GetProcAddress(FLibHandle, 'gr4d_backendrendertarget_get_height');
gr4d_backendrendertarget_get_sample_count := GetProcAddress(FLibHandle, 'gr4d_backendrendertarget_get_sample_count');
gr4d_backendrendertarget_get_stencil_bits := GetProcAddress(FLibHandle, 'gr4d_backendrendertarget_get_stencil_bits');
gr4d_backendrendertarget_get_width := GetProcAddress(FLibHandle, 'gr4d_backendrendertarget_get_width');
gr4d_backendrendertarget_is_valid := GetProcAddress(FLibHandle, 'gr4d_backendrendertarget_is_valid');
gr4d_backendtexture_create_gl := GetProcAddress(FLibHandle, 'gr4d_backendtexture_create_gl');
gr4d_backendtexture_create_mtl := GetProcAddress(FLibHandle, 'gr4d_backendtexture_create_mtl');
gr4d_backendtexture_destroy := GetProcAddress(FLibHandle, 'gr4d_backendtexture_destroy');
gr4d_backendtexture_get_backend_api := GetProcAddress(FLibHandle, 'gr4d_backendtexture_get_backend_api');
gr4d_backendtexture_get_gl_framebuffer_info := GetProcAddress(FLibHandle, 'gr4d_backendtexture_get_gl_framebuffer_info');
gr4d_backendtexture_get_height := GetProcAddress(FLibHandle, 'gr4d_backendtexture_get_height');
gr4d_backendtexture_get_width := GetProcAddress(FLibHandle, 'gr4d_backendtexture_get_width');
gr4d_backendtexture_has_mipmaps := GetProcAddress(FLibHandle, 'gr4d_backendtexture_has_mipmaps');
gr4d_backendtexture_is_valid := GetProcAddress(FLibHandle, 'gr4d_backendtexture_is_valid');
{$ELSE}
class function TSkiaAPI.gr4d_backendrendertarget_create_gl; external TSkiaAPI.LibName name 'gr4d_backendrendertarget_create_gl';
class function TSkiaAPI.gr4d_backendrendertarget_create_mtl; external TSkiaAPI.LibName name 'gr4d_backendrendertarget_create_mtl';
class procedure TSkiaAPI.gr4d_backendrendertarget_destroy; external TSkiaAPI.LibName name 'gr4d_backendrendertarget_destroy';
class function TSkiaAPI.gr4d_backendrendertarget_get_backend_api; external TSkiaAPI.LibName name 'gr4d_backendrendertarget_get_backend_api';
class function TSkiaAPI.gr4d_backendrendertarget_get_height; external TSkiaAPI.LibName name 'gr4d_backendrendertarget_get_height';
class function TSkiaAPI.gr4d_backendrendertarget_get_sample_count; external TSkiaAPI.LibName name 'gr4d_backendrendertarget_get_sample_count';
class function TSkiaAPI.gr4d_backendrendertarget_get_stencil_bits; external TSkiaAPI.LibName name 'gr4d_backendrendertarget_get_stencil_bits';
class function TSkiaAPI.gr4d_backendrendertarget_get_width; external TSkiaAPI.LibName name 'gr4d_backendrendertarget_get_width';
class function TSkiaAPI.gr4d_backendrendertarget_is_valid; external TSkiaAPI.LibName name 'gr4d_backendrendertarget_is_valid';
class function TSkiaAPI.gr4d_backendtexture_create_gl; external TSkiaAPI.LibName name 'gr4d_backendtexture_create_gl';
class function TSkiaAPI.gr4d_backendtexture_create_mtl; external TSkiaAPI.LibName name 'gr4d_backendtexture_create_mtl';
class procedure TSkiaAPI.gr4d_backendtexture_destroy; external TSkiaAPI.LibName name 'gr4d_backendtexture_destroy';
class function TSkiaAPI.gr4d_backendtexture_get_backend_api; external TSkiaAPI.LibName name 'gr4d_backendtexture_get_backend_api';
class function TSkiaAPI.gr4d_backendtexture_get_gl_framebuffer_info; external TSkiaAPI.LibName name 'gr4d_backendtexture_get_gl_framebuffer_info';
class function TSkiaAPI.gr4d_backendtexture_get_height; external TSkiaAPI.LibName name 'gr4d_backendtexture_get_height';
class function TSkiaAPI.gr4d_backendtexture_get_width; external TSkiaAPI.LibName name 'gr4d_backendtexture_get_width';
class function TSkiaAPI.gr4d_backendtexture_has_mipmaps; external TSkiaAPI.LibName name 'gr4d_backendtexture_has_mipmaps';
class function TSkiaAPI.gr4d_backendtexture_is_valid; external TSkiaAPI.LibName name 'gr4d_backendtexture_is_valid';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/gr4d_directcontext.h'}
{$IFDEF SK_DYNAMIC_LOADING}
gr4d_directcontext_abandon_context := GetProcAddress(FLibHandle, 'gr4d_directcontext_abandon_context');
gr4d_directcontext_dump_memory_statistics := GetProcAddress(FLibHandle, 'gr4d_directcontext_dump_memory_statistics');
gr4d_directcontext_flush := GetProcAddress(FLibHandle, 'gr4d_directcontext_flush');
gr4d_directcontext_flush_and_submit := GetProcAddress(FLibHandle, 'gr4d_directcontext_flush_and_submit');
gr4d_directcontext_free_gpu_resources := GetProcAddress(FLibHandle, 'gr4d_directcontext_free_gpu_resources');
gr4d_directcontext_get_backend_api := GetProcAddress(FLibHandle, 'gr4d_directcontext_get_backend_api');
gr4d_directcontext_get_max_surface_sample_count_for_color_type := GetProcAddress(FLibHandle, 'gr4d_directcontext_get_max_surface_sample_count_for_color_type');
gr4d_directcontext_get_resource_cache_limit := GetProcAddress(FLibHandle, 'gr4d_directcontext_get_resource_cache_limit');
gr4d_directcontext_get_resource_cache_usage := GetProcAddress(FLibHandle, 'gr4d_directcontext_get_resource_cache_usage');
gr4d_directcontext_is_abandoned := GetProcAddress(FLibHandle, 'gr4d_directcontext_is_abandoned');
gr4d_directcontext_make_gl := GetProcAddress(FLibHandle, 'gr4d_directcontext_make_gl');
gr4d_directcontext_make_metal := GetProcAddress(FLibHandle, 'gr4d_directcontext_make_metal');
gr4d_directcontext_perform_deferred_cleanup := GetProcAddress(FLibHandle, 'gr4d_directcontext_perform_deferred_cleanup');
gr4d_directcontext_purge_unlocked_resources := GetProcAddress(FLibHandle, 'gr4d_directcontext_purge_unlocked_resources');
gr4d_directcontext_purge_unlocked_resources2 := GetProcAddress(FLibHandle, 'gr4d_directcontext_purge_unlocked_resources2');
gr4d_directcontext_release_resources_and_abandon_context := GetProcAddress(FLibHandle, 'gr4d_directcontext_release_resources_and_abandon_context');
gr4d_directcontext_reset_context := GetProcAddress(FLibHandle, 'gr4d_directcontext_reset_context');
gr4d_directcontext_set_resource_cache_limit := GetProcAddress(FLibHandle, 'gr4d_directcontext_set_resource_cache_limit');
gr4d_directcontext_submit := GetProcAddress(FLibHandle, 'gr4d_directcontext_submit');
{$ELSE}
class procedure TSkiaAPI.gr4d_directcontext_abandon_context; external TSkiaAPI.LibName name 'gr4d_directcontext_abandon_context';
class procedure TSkiaAPI.gr4d_directcontext_dump_memory_statistics; external TSkiaAPI.LibName name 'gr4d_directcontext_dump_memory_statistics';
class procedure TSkiaAPI.gr4d_directcontext_flush; external TSkiaAPI.LibName name 'gr4d_directcontext_flush';
class procedure TSkiaAPI.gr4d_directcontext_flush_and_submit; external TSkiaAPI.LibName name 'gr4d_directcontext_flush_and_submit';
class procedure TSkiaAPI.gr4d_directcontext_free_gpu_resources; external TSkiaAPI.LibName name 'gr4d_directcontext_free_gpu_resources';
class function TSkiaAPI.gr4d_directcontext_get_backend_api; external TSkiaAPI.LibName name 'gr4d_directcontext_get_backend_api';
class function TSkiaAPI.gr4d_directcontext_get_max_surface_sample_count_for_color_type; external TSkiaAPI.LibName name 'gr4d_directcontext_get_max_surface_sample_count_for_color_type';
class function TSkiaAPI.gr4d_directcontext_get_resource_cache_limit; external TSkiaAPI.LibName name 'gr4d_directcontext_get_resource_cache_limit';
class procedure TSkiaAPI.gr4d_directcontext_get_resource_cache_usage; external TSkiaAPI.LibName name 'gr4d_directcontext_get_resource_cache_usage';
class function TSkiaAPI.gr4d_directcontext_is_abandoned; external TSkiaAPI.LibName name 'gr4d_directcontext_is_abandoned';
class function TSkiaAPI.gr4d_directcontext_make_gl; external TSkiaAPI.LibName name 'gr4d_directcontext_make_gl';
class function TSkiaAPI.gr4d_directcontext_make_metal; external TSkiaAPI.LibName name 'gr4d_directcontext_make_metal';
class procedure TSkiaAPI.gr4d_directcontext_perform_deferred_cleanup; external TSkiaAPI.LibName name 'gr4d_directcontext_perform_deferred_cleanup';
class procedure TSkiaAPI.gr4d_directcontext_purge_unlocked_resources; external TSkiaAPI.LibName name 'gr4d_directcontext_purge_unlocked_resources';
class procedure TSkiaAPI.gr4d_directcontext_purge_unlocked_resources2; external TSkiaAPI.LibName name 'gr4d_directcontext_purge_unlocked_resources2';
class procedure TSkiaAPI.gr4d_directcontext_release_resources_and_abandon_context; external TSkiaAPI.LibName name 'gr4d_directcontext_release_resources_and_abandon_context';
class procedure TSkiaAPI.gr4d_directcontext_reset_context; external TSkiaAPI.LibName name 'gr4d_directcontext_reset_context';
class procedure TSkiaAPI.gr4d_directcontext_set_resource_cache_limit; external TSkiaAPI.LibName name 'gr4d_directcontext_set_resource_cache_limit';
class function TSkiaAPI.gr4d_directcontext_submit; external TSkiaAPI.LibName name 'gr4d_directcontext_submit';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/gr4d_gl_interface.h'}
{$IFDEF SK_DYNAMIC_LOADING}
gr4d_gl_interface_has_extension := GetProcAddress(FLibHandle, 'gr4d_gl_interface_has_extension');
gr4d_gl_interface_make_assembled := GetProcAddress(FLibHandle, 'gr4d_gl_interface_make_assembled');
gr4d_gl_interface_make_assembled_gl := GetProcAddress(FLibHandle, 'gr4d_gl_interface_make_assembled_gl');
gr4d_gl_interface_make_assembled_gles := GetProcAddress(FLibHandle, 'gr4d_gl_interface_make_assembled_gles');
gr4d_gl_interface_make_assembled_webgl := GetProcAddress(FLibHandle, 'gr4d_gl_interface_make_assembled_webgl');
gr4d_gl_interface_make_native := GetProcAddress(FLibHandle, 'gr4d_gl_interface_make_native');
gr4d_gl_interface_validate := GetProcAddress(FLibHandle, 'gr4d_gl_interface_validate');
{$ELSE}
class function TSkiaAPI.gr4d_gl_interface_has_extension; external TSkiaAPI.LibName name 'gr4d_gl_interface_has_extension';
class function TSkiaAPI.gr4d_gl_interface_make_assembled; external TSkiaAPI.LibName name 'gr4d_gl_interface_make_assembled';
class function TSkiaAPI.gr4d_gl_interface_make_assembled_gl; external TSkiaAPI.LibName name 'gr4d_gl_interface_make_assembled_gl';
class function TSkiaAPI.gr4d_gl_interface_make_assembled_gles; external TSkiaAPI.LibName name 'gr4d_gl_interface_make_assembled_gles';
class function TSkiaAPI.gr4d_gl_interface_make_assembled_webgl; external TSkiaAPI.LibName name 'gr4d_gl_interface_make_assembled_webgl';
class function TSkiaAPI.gr4d_gl_interface_make_native; external TSkiaAPI.LibName name 'gr4d_gl_interface_make_native';
class function TSkiaAPI.gr4d_gl_interface_validate; external TSkiaAPI.LibName name 'gr4d_gl_interface_validate';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_blender.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_blender_make_arithmetic := GetProcAddress(FLibHandle, 'sk4d_blender_make_arithmetic');
sk4d_blender_make_mode := GetProcAddress(FLibHandle, 'sk4d_blender_make_mode');
{$ELSE}
class function TSkiaAPI.sk4d_blender_make_arithmetic; external TSkiaAPI.LibName name 'sk4d_blender_make_arithmetic';
class function TSkiaAPI.sk4d_blender_make_mode; external TSkiaAPI.LibName name 'sk4d_blender_make_mode';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_canvas.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_canvas_clear := GetProcAddress(FLibHandle, 'sk4d_canvas_clear');
sk4d_canvas_clear2 := GetProcAddress(FLibHandle, 'sk4d_canvas_clear2');
sk4d_canvas_destroy := GetProcAddress(FLibHandle, 'sk4d_canvas_destroy');
sk4d_canvas_discard := GetProcAddress(FLibHandle, 'sk4d_canvas_discard');
sk4d_canvas_clip_path := GetProcAddress(FLibHandle, 'sk4d_canvas_clip_path');
sk4d_canvas_clip_rect := GetProcAddress(FLibHandle, 'sk4d_canvas_clip_rect');
sk4d_canvas_clip_region := GetProcAddress(FLibHandle, 'sk4d_canvas_clip_region');
sk4d_canvas_clip_rrect := GetProcAddress(FLibHandle, 'sk4d_canvas_clip_rrect');
sk4d_canvas_clip_shader := GetProcAddress(FLibHandle, 'sk4d_canvas_clip_shader');
sk4d_canvas_concat := GetProcAddress(FLibHandle, 'sk4d_canvas_concat');
sk4d_canvas_concat2 := GetProcAddress(FLibHandle, 'sk4d_canvas_concat2');
sk4d_canvas_draw_annotation := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_annotation');
sk4d_canvas_draw_arc := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_arc');
sk4d_canvas_draw_atlas := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_atlas');
sk4d_canvas_draw_circle := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_circle');
sk4d_canvas_draw_color := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_color');
sk4d_canvas_draw_color2 := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_color2');
sk4d_canvas_draw_glyphs := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_glyphs');
sk4d_canvas_draw_glyphs2 := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_glyphs2');
sk4d_canvas_draw_image := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_image');
sk4d_canvas_draw_image_lattice := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_image_lattice');
sk4d_canvas_draw_image_nine := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_image_nine');
sk4d_canvas_draw_image_rect := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_image_rect');
sk4d_canvas_draw_line := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_line');
sk4d_canvas_draw_oval := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_oval');
sk4d_canvas_draw_paint := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_paint');
sk4d_canvas_draw_patch := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_patch');
sk4d_canvas_draw_path := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_path');
sk4d_canvas_draw_picture := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_picture');
sk4d_canvas_draw_point := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_point');
sk4d_canvas_draw_points := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_points');
sk4d_canvas_draw_rect := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_rect');
sk4d_canvas_draw_region := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_region');
sk4d_canvas_draw_rrect := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_rrect');
sk4d_canvas_draw_rrect2 := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_rrect2');
sk4d_canvas_draw_rrect_difference := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_rrect_difference');
sk4d_canvas_draw_simple_text := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_simple_text');
sk4d_canvas_draw_text_blob := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_text_blob');
sk4d_canvas_draw_vertices := GetProcAddress(FLibHandle, 'sk4d_canvas_draw_vertices');
sk4d_canvas_get_device_clip_bounds := GetProcAddress(FLibHandle, 'sk4d_canvas_get_device_clip_bounds');
sk4d_canvas_get_local_clip_bounds := GetProcAddress(FLibHandle, 'sk4d_canvas_get_local_clip_bounds');
sk4d_canvas_get_local_to_device := GetProcAddress(FLibHandle, 'sk4d_canvas_get_local_to_device');
sk4d_canvas_get_local_to_device_as_3x3 := GetProcAddress(FLibHandle, 'sk4d_canvas_get_local_to_device_as_3x3');
sk4d_canvas_get_save_count := GetProcAddress(FLibHandle, 'sk4d_canvas_get_save_count');
sk4d_canvas_quick_reject := GetProcAddress(FLibHandle, 'sk4d_canvas_quick_reject');
sk4d_canvas_quick_reject2 := GetProcAddress(FLibHandle, 'sk4d_canvas_quick_reject2');
sk4d_canvas_reset_matrix := GetProcAddress(FLibHandle, 'sk4d_canvas_reset_matrix');
sk4d_canvas_restore := GetProcAddress(FLibHandle, 'sk4d_canvas_restore');
sk4d_canvas_restore_to_count := GetProcAddress(FLibHandle, 'sk4d_canvas_restore_to_count');
sk4d_canvas_rotate := GetProcAddress(FLibHandle, 'sk4d_canvas_rotate');
sk4d_canvas_rotate2 := GetProcAddress(FLibHandle, 'sk4d_canvas_rotate2');
sk4d_canvas_save := GetProcAddress(FLibHandle, 'sk4d_canvas_save');
sk4d_canvas_save_layer := GetProcAddress(FLibHandle, 'sk4d_canvas_save_layer');
sk4d_canvas_save_layer_alpha := GetProcAddress(FLibHandle, 'sk4d_canvas_save_layer_alpha');
sk4d_canvas_scale := GetProcAddress(FLibHandle, 'sk4d_canvas_scale');
sk4d_canvas_set_matrix := GetProcAddress(FLibHandle, 'sk4d_canvas_set_matrix');
sk4d_canvas_set_matrix2 := GetProcAddress(FLibHandle, 'sk4d_canvas_set_matrix2');
sk4d_canvas_skew := GetProcAddress(FLibHandle, 'sk4d_canvas_skew');
sk4d_canvas_translate := GetProcAddress(FLibHandle, 'sk4d_canvas_translate');
{$ELSE}
class procedure TSkiaAPI.sk4d_canvas_clear; external TSkiaAPI.LibName name 'sk4d_canvas_clear';
class procedure TSkiaAPI.sk4d_canvas_clear2; external TSkiaAPI.LibName name 'sk4d_canvas_clear2';
class procedure TSkiaAPI.sk4d_canvas_destroy; external TSkiaAPI.LibName name 'sk4d_canvas_destroy';
class procedure TSkiaAPI.sk4d_canvas_discard; external TSkiaAPI.LibName name 'sk4d_canvas_discard';
class procedure TSkiaAPI.sk4d_canvas_clip_path; external TSkiaAPI.LibName name 'sk4d_canvas_clip_path';
class procedure TSkiaAPI.sk4d_canvas_clip_rect; external TSkiaAPI.LibName name 'sk4d_canvas_clip_rect';
class procedure TSkiaAPI.sk4d_canvas_clip_region; external TSkiaAPI.LibName name 'sk4d_canvas_clip_region';
class procedure TSkiaAPI.sk4d_canvas_clip_rrect; external TSkiaAPI.LibName name 'sk4d_canvas_clip_rrect';
class procedure TSkiaAPI.sk4d_canvas_clip_shader; external TSkiaAPI.LibName name 'sk4d_canvas_clip_shader';
class procedure TSkiaAPI.sk4d_canvas_concat; external TSkiaAPI.LibName name 'sk4d_canvas_concat';
class procedure TSkiaAPI.sk4d_canvas_concat2; external TSkiaAPI.LibName name 'sk4d_canvas_concat2';
class procedure TSkiaAPI.sk4d_canvas_draw_annotation; external TSkiaAPI.LibName name 'sk4d_canvas_draw_annotation';
class procedure TSkiaAPI.sk4d_canvas_draw_arc; external TSkiaAPI.LibName name 'sk4d_canvas_draw_arc';
class procedure TSkiaAPI.sk4d_canvas_draw_atlas; external TSkiaAPI.LibName name 'sk4d_canvas_draw_atlas';
class procedure TSkiaAPI.sk4d_canvas_draw_circle; external TSkiaAPI.LibName name 'sk4d_canvas_draw_circle';
class procedure TSkiaAPI.sk4d_canvas_draw_color; external TSkiaAPI.LibName name 'sk4d_canvas_draw_color';
class procedure TSkiaAPI.sk4d_canvas_draw_color2; external TSkiaAPI.LibName name 'sk4d_canvas_draw_color2';
class procedure TSkiaAPI.sk4d_canvas_draw_glyphs; external TSkiaAPI.LibName name 'sk4d_canvas_draw_glyphs';
class procedure TSkiaAPI.sk4d_canvas_draw_glyphs2; external TSkiaAPI.LibName name 'sk4d_canvas_draw_glyphs2';
class procedure TSkiaAPI.sk4d_canvas_draw_image; external TSkiaAPI.LibName name 'sk4d_canvas_draw_image';
class procedure TSkiaAPI.sk4d_canvas_draw_image_lattice; external TSkiaAPI.LibName name 'sk4d_canvas_draw_image_lattice';
class procedure TSkiaAPI.sk4d_canvas_draw_image_nine; external TSkiaAPI.LibName name 'sk4d_canvas_draw_image_nine';
class procedure TSkiaAPI.sk4d_canvas_draw_image_rect; external TSkiaAPI.LibName name 'sk4d_canvas_draw_image_rect';
class procedure TSkiaAPI.sk4d_canvas_draw_line; external TSkiaAPI.LibName name 'sk4d_canvas_draw_line';
class procedure TSkiaAPI.sk4d_canvas_draw_oval; external TSkiaAPI.LibName name 'sk4d_canvas_draw_oval';
class procedure TSkiaAPI.sk4d_canvas_draw_paint; external TSkiaAPI.LibName name 'sk4d_canvas_draw_paint';
class procedure TSkiaAPI.sk4d_canvas_draw_patch; external TSkiaAPI.LibName name 'sk4d_canvas_draw_patch';
class procedure TSkiaAPI.sk4d_canvas_draw_path; external TSkiaAPI.LibName name 'sk4d_canvas_draw_path';
class procedure TSkiaAPI.sk4d_canvas_draw_picture; external TSkiaAPI.LibName name 'sk4d_canvas_draw_picture';
class procedure TSkiaAPI.sk4d_canvas_draw_point; external TSkiaAPI.LibName name 'sk4d_canvas_draw_point';
class procedure TSkiaAPI.sk4d_canvas_draw_points; external TSkiaAPI.LibName name 'sk4d_canvas_draw_points';
class procedure TSkiaAPI.sk4d_canvas_draw_rect; external TSkiaAPI.LibName name 'sk4d_canvas_draw_rect';
class procedure TSkiaAPI.sk4d_canvas_draw_region; external TSkiaAPI.LibName name 'sk4d_canvas_draw_region';
class procedure TSkiaAPI.sk4d_canvas_draw_rrect; external TSkiaAPI.LibName name 'sk4d_canvas_draw_rrect';
class procedure TSkiaAPI.sk4d_canvas_draw_rrect2; external TSkiaAPI.LibName name 'sk4d_canvas_draw_rrect2';
class procedure TSkiaAPI.sk4d_canvas_draw_rrect_difference; external TSkiaAPI.LibName name 'sk4d_canvas_draw_rrect_difference';
class procedure TSkiaAPI.sk4d_canvas_draw_simple_text; external TSkiaAPI.LibName name 'sk4d_canvas_draw_simple_text';
class procedure TSkiaAPI.sk4d_canvas_draw_text_blob; external TSkiaAPI.LibName name 'sk4d_canvas_draw_text_blob';
class procedure TSkiaAPI.sk4d_canvas_draw_vertices; external TSkiaAPI.LibName name 'sk4d_canvas_draw_vertices';
class procedure TSkiaAPI.sk4d_canvas_get_device_clip_bounds; external TSkiaAPI.LibName name 'sk4d_canvas_get_device_clip_bounds';
class procedure TSkiaAPI.sk4d_canvas_get_local_clip_bounds; external TSkiaAPI.LibName name 'sk4d_canvas_get_local_clip_bounds';
class procedure TSkiaAPI.sk4d_canvas_get_local_to_device; external TSkiaAPI.LibName name 'sk4d_canvas_get_local_to_device';
class procedure TSkiaAPI.sk4d_canvas_get_local_to_device_as_3x3; external TSkiaAPI.LibName name 'sk4d_canvas_get_local_to_device_as_3x3';
class function TSkiaAPI.sk4d_canvas_get_save_count; external TSkiaAPI.LibName name 'sk4d_canvas_get_save_count';
class function TSkiaAPI.sk4d_canvas_quick_reject; external TSkiaAPI.LibName name 'sk4d_canvas_quick_reject';
class function TSkiaAPI.sk4d_canvas_quick_reject2; external TSkiaAPI.LibName name 'sk4d_canvas_quick_reject2';
class procedure TSkiaAPI.sk4d_canvas_reset_matrix; external TSkiaAPI.LibName name 'sk4d_canvas_reset_matrix';
class procedure TSkiaAPI.sk4d_canvas_restore; external TSkiaAPI.LibName name 'sk4d_canvas_restore';
class procedure TSkiaAPI.sk4d_canvas_restore_to_count; external TSkiaAPI.LibName name 'sk4d_canvas_restore_to_count';
class procedure TSkiaAPI.sk4d_canvas_rotate; external TSkiaAPI.LibName name 'sk4d_canvas_rotate';
class procedure TSkiaAPI.sk4d_canvas_rotate2; external TSkiaAPI.LibName name 'sk4d_canvas_rotate2';
class function TSkiaAPI.sk4d_canvas_save; external TSkiaAPI.LibName name 'sk4d_canvas_save';
class function TSkiaAPI.sk4d_canvas_save_layer; external TSkiaAPI.LibName name 'sk4d_canvas_save_layer';
class function TSkiaAPI.sk4d_canvas_save_layer_alpha; external TSkiaAPI.LibName name 'sk4d_canvas_save_layer_alpha';
class procedure TSkiaAPI.sk4d_canvas_scale; external TSkiaAPI.LibName name 'sk4d_canvas_scale';
class procedure TSkiaAPI.sk4d_canvas_set_matrix; external TSkiaAPI.LibName name 'sk4d_canvas_set_matrix';
class procedure TSkiaAPI.sk4d_canvas_set_matrix2; external TSkiaAPI.LibName name 'sk4d_canvas_set_matrix2';
class procedure TSkiaAPI.sk4d_canvas_skew; external TSkiaAPI.LibName name 'sk4d_canvas_skew';
class procedure TSkiaAPI.sk4d_canvas_translate; external TSkiaAPI.LibName name 'sk4d_canvas_translate';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_codec.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_codec_destroy := GetProcAddress(FLibHandle, 'sk4d_codec_destroy');
sk4d_codec_get_dimensions := GetProcAddress(FLibHandle, 'sk4d_codec_get_dimensions');
sk4d_codec_get_image := GetProcAddress(FLibHandle, 'sk4d_codec_get_image');
sk4d_codec_get_pixels := GetProcAddress(FLibHandle, 'sk4d_codec_get_pixels');
sk4d_codec_make_from_file := GetProcAddress(FLibHandle, 'sk4d_codec_make_from_file');
sk4d_codec_make_with_copy := GetProcAddress(FLibHandle, 'sk4d_codec_make_with_copy');
sk4d_codec_make_without_copy := GetProcAddress(FLibHandle, 'sk4d_codec_make_without_copy');
sk4d_animcodecplayer_destroy := GetProcAddress(FLibHandle, 'sk4d_animcodecplayer_destroy');
sk4d_animcodecplayer_get_dimensions := GetProcAddress(FLibHandle, 'sk4d_animcodecplayer_get_dimensions');
sk4d_animcodecplayer_get_duration := GetProcAddress(FLibHandle, 'sk4d_animcodecplayer_get_duration');
sk4d_animcodecplayer_get_frame := GetProcAddress(FLibHandle, 'sk4d_animcodecplayer_get_frame');
sk4d_animcodecplayer_make_from_file := GetProcAddress(FLibHandle, 'sk4d_animcodecplayer_make_from_file');
sk4d_animcodecplayer_make_from_stream := GetProcAddress(FLibHandle, 'sk4d_animcodecplayer_make_from_stream');
sk4d_animcodecplayer_seek := GetProcAddress(FLibHandle, 'sk4d_animcodecplayer_seek');
{$ELSE}
class procedure TSkiaAPI.sk4d_codec_destroy; external TSkiaAPI.LibName name 'sk4d_codec_destroy';
class procedure TSkiaAPI.sk4d_codec_get_dimensions; external TSkiaAPI.LibName name 'sk4d_codec_get_dimensions';
class function TSkiaAPI.sk4d_codec_get_image; external TSkiaAPI.LibName name 'sk4d_codec_get_image';
class function TSkiaAPI.sk4d_codec_get_pixels; external TSkiaAPI.LibName name 'sk4d_codec_get_pixels';
class function TSkiaAPI.sk4d_codec_make_from_file; external TSkiaAPI.LibName name 'sk4d_codec_make_from_file';
class function TSkiaAPI.sk4d_codec_make_with_copy; external TSkiaAPI.LibName name 'sk4d_codec_make_with_copy';
class function TSkiaAPI.sk4d_codec_make_without_copy; external TSkiaAPI.LibName name 'sk4d_codec_make_without_copy';
class procedure TSkiaAPI.sk4d_animcodecplayer_destroy; external TSkiaAPI.LibName name 'sk4d_animcodecplayer_destroy';
class procedure TSkiaAPI.sk4d_animcodecplayer_get_dimensions; external TSkiaAPI.LibName name 'sk4d_animcodecplayer_get_dimensions';
class function TSkiaAPI.sk4d_animcodecplayer_get_duration; external TSkiaAPI.LibName name 'sk4d_animcodecplayer_get_duration';
class function TSkiaAPI.sk4d_animcodecplayer_get_frame; external TSkiaAPI.LibName name 'sk4d_animcodecplayer_get_frame';
class function TSkiaAPI.sk4d_animcodecplayer_make_from_file; external TSkiaAPI.LibName name 'sk4d_animcodecplayer_make_from_file';
class function TSkiaAPI.sk4d_animcodecplayer_make_from_stream; external TSkiaAPI.LibName name 'sk4d_animcodecplayer_make_from_stream';
class function TSkiaAPI.sk4d_animcodecplayer_seek; external TSkiaAPI.LibName name 'sk4d_animcodecplayer_seek';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_colorfilter.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_colorfilter_make_blend := GetProcAddress(FLibHandle, 'sk4d_colorfilter_make_blend');
sk4d_colorfilter_make_compose := GetProcAddress(FLibHandle, 'sk4d_colorfilter_make_compose');
sk4d_colorfilter_make_high_contrast := GetProcAddress(FLibHandle, 'sk4d_colorfilter_make_high_contrast');
sk4d_colorfilter_make_hsla_matrix := GetProcAddress(FLibHandle, 'sk4d_colorfilter_make_hsla_matrix');
sk4d_colorfilter_make_lighting := GetProcAddress(FLibHandle, 'sk4d_colorfilter_make_lighting');
sk4d_colorfilter_make_linear_to_srgb_gamma := GetProcAddress(FLibHandle, 'sk4d_colorfilter_make_linear_to_srgb_gamma');
sk4d_colorfilter_make_luma_color := GetProcAddress(FLibHandle, 'sk4d_colorfilter_make_luma_color');
sk4d_colorfilter_make_matrix := GetProcAddress(FLibHandle, 'sk4d_colorfilter_make_matrix');
sk4d_colorfilter_make_overdraw := GetProcAddress(FLibHandle, 'sk4d_colorfilter_make_overdraw');
sk4d_colorfilter_make_table := GetProcAddress(FLibHandle, 'sk4d_colorfilter_make_table');
{$ELSE}
class function TSkiaAPI.sk4d_colorfilter_make_blend; external TSkiaAPI.LibName name 'sk4d_colorfilter_make_blend';
class function TSkiaAPI.sk4d_colorfilter_make_compose; external TSkiaAPI.LibName name 'sk4d_colorfilter_make_compose';
class function TSkiaAPI.sk4d_colorfilter_make_high_contrast; external TSkiaAPI.LibName name 'sk4d_colorfilter_make_high_contrast';
class function TSkiaAPI.sk4d_colorfilter_make_hsla_matrix; external TSkiaAPI.LibName name 'sk4d_colorfilter_make_hsla_matrix';
class function TSkiaAPI.sk4d_colorfilter_make_lighting; external TSkiaAPI.LibName name 'sk4d_colorfilter_make_lighting';
class function TSkiaAPI.sk4d_colorfilter_make_linear_to_srgb_gamma; external TSkiaAPI.LibName name 'sk4d_colorfilter_make_linear_to_srgb_gamma';
class function TSkiaAPI.sk4d_colorfilter_make_luma_color; external TSkiaAPI.LibName name 'sk4d_colorfilter_make_luma_color';
class function TSkiaAPI.sk4d_colorfilter_make_matrix; external TSkiaAPI.LibName name 'sk4d_colorfilter_make_matrix';
class function TSkiaAPI.sk4d_colorfilter_make_overdraw; external TSkiaAPI.LibName name 'sk4d_colorfilter_make_overdraw';
class function TSkiaAPI.sk4d_colorfilter_make_table; external TSkiaAPI.LibName name 'sk4d_colorfilter_make_table';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_colorspace.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_colorspace_gamma_close_to_srgb := GetProcAddress(FLibHandle, 'sk4d_colorspace_gamma_close_to_srgb');
sk4d_colorspace_gamma_is_linear := GetProcAddress(FLibHandle, 'sk4d_colorspace_gamma_is_linear');
sk4d_colorspace_is_equal := GetProcAddress(FLibHandle, 'sk4d_colorspace_is_equal');
sk4d_colorspace_is_numerical_transfer_fn := GetProcAddress(FLibHandle, 'sk4d_colorspace_is_numerical_transfer_fn');
sk4d_colorspace_is_srgb := GetProcAddress(FLibHandle, 'sk4d_colorspace_is_srgb');
sk4d_colorspace_make := GetProcAddress(FLibHandle, 'sk4d_colorspace_make');
sk4d_colorspace_make_linear_gamma := GetProcAddress(FLibHandle, 'sk4d_colorspace_make_linear_gamma');
sk4d_colorspace_make_rgb := GetProcAddress(FLibHandle, 'sk4d_colorspace_make_rgb');
sk4d_colorspace_make_srgb := GetProcAddress(FLibHandle, 'sk4d_colorspace_make_srgb');
sk4d_colorspace_make_srgb_gamma := GetProcAddress(FLibHandle, 'sk4d_colorspace_make_srgb_gamma');
sk4d_colorspace_make_srgb_linear := GetProcAddress(FLibHandle, 'sk4d_colorspace_make_srgb_linear');
sk4d_colorspace_ref := GetProcAddress(FLibHandle, 'sk4d_colorspace_ref');
sk4d_colorspace_to_profile := GetProcAddress(FLibHandle, 'sk4d_colorspace_to_profile');
sk4d_colorspace_to_xyz := GetProcAddress(FLibHandle, 'sk4d_colorspace_to_xyz');
sk4d_colorspace_unref := GetProcAddress(FLibHandle, 'sk4d_colorspace_unref');
sk4d_colorspaceiccprofile_destroy := GetProcAddress(FLibHandle, 'sk4d_colorspaceiccprofile_destroy');
sk4d_colorspaceiccprofile_get_buffer := GetProcAddress(FLibHandle, 'sk4d_colorspaceiccprofile_get_buffer');
sk4d_colorspaceiccprofile_make_with_parse := GetProcAddress(FLibHandle, 'sk4d_colorspaceiccprofile_make_with_parse');
sk4d_colorspaceiccprofile_to_xyz := GetProcAddress(FLibHandle, 'sk4d_colorspaceiccprofile_to_xyz');
sk4d_colorspaceprimaries_to_xyz := GetProcAddress(FLibHandle, 'sk4d_colorspaceprimaries_to_xyz');
sk4d_colorspacetransferfn_invert := GetProcAddress(FLibHandle, 'sk4d_colorspacetransferfn_invert');
sk4d_colorspacetransferfn_transform := GetProcAddress(FLibHandle, 'sk4d_colorspacetransferfn_transform');
{$ELSE}
class function TSkiaAPI.sk4d_colorspace_gamma_close_to_srgb; external TSkiaAPI.LibName name 'sk4d_colorspace_gamma_close_to_srgb';
class function TSkiaAPI.sk4d_colorspace_gamma_is_linear; external TSkiaAPI.LibName name 'sk4d_colorspace_gamma_is_linear';
class function TSkiaAPI.sk4d_colorspace_is_equal; external TSkiaAPI.LibName name 'sk4d_colorspace_is_equal';
class function TSkiaAPI.sk4d_colorspace_is_numerical_transfer_fn; external TSkiaAPI.LibName name 'sk4d_colorspace_is_numerical_transfer_fn';
class function TSkiaAPI.sk4d_colorspace_is_srgb; external TSkiaAPI.LibName name 'sk4d_colorspace_is_srgb';
class function TSkiaAPI.sk4d_colorspace_make; external TSkiaAPI.LibName name 'sk4d_colorspace_make';
class function TSkiaAPI.sk4d_colorspace_make_linear_gamma; external TSkiaAPI.LibName name 'sk4d_colorspace_make_linear_gamma';
class function TSkiaAPI.sk4d_colorspace_make_rgb; external TSkiaAPI.LibName name 'sk4d_colorspace_make_rgb';
class function TSkiaAPI.sk4d_colorspace_make_srgb; external TSkiaAPI.LibName name 'sk4d_colorspace_make_srgb';
class function TSkiaAPI.sk4d_colorspace_make_srgb_gamma; external TSkiaAPI.LibName name 'sk4d_colorspace_make_srgb_gamma';
class function TSkiaAPI.sk4d_colorspace_make_srgb_linear; external TSkiaAPI.LibName name 'sk4d_colorspace_make_srgb_linear';
class procedure TSkiaAPI.sk4d_colorspace_ref; external TSkiaAPI.LibName name 'sk4d_colorspace_ref';
class function TSkiaAPI.sk4d_colorspace_to_profile; external TSkiaAPI.LibName name 'sk4d_colorspace_to_profile';
class function TSkiaAPI.sk4d_colorspace_to_xyz; external TSkiaAPI.LibName name 'sk4d_colorspace_to_xyz';
class procedure TSkiaAPI.sk4d_colorspace_unref; external TSkiaAPI.LibName name 'sk4d_colorspace_unref';
class procedure TSkiaAPI.sk4d_colorspaceiccprofile_destroy; external TSkiaAPI.LibName name 'sk4d_colorspaceiccprofile_destroy';
class function TSkiaAPI.sk4d_colorspaceiccprofile_get_buffer; external TSkiaAPI.LibName name 'sk4d_colorspaceiccprofile_get_buffer';
class function TSkiaAPI.sk4d_colorspaceiccprofile_make_with_parse; external TSkiaAPI.LibName name 'sk4d_colorspaceiccprofile_make_with_parse';
class function TSkiaAPI.sk4d_colorspaceiccprofile_to_xyz; external TSkiaAPI.LibName name 'sk4d_colorspaceiccprofile_to_xyz';
class function TSkiaAPI.sk4d_colorspaceprimaries_to_xyz; external TSkiaAPI.LibName name 'sk4d_colorspaceprimaries_to_xyz';
class function TSkiaAPI.sk4d_colorspacetransferfn_invert; external TSkiaAPI.LibName name 'sk4d_colorspacetransferfn_invert';
class function TSkiaAPI.sk4d_colorspacetransferfn_transform; external TSkiaAPI.LibName name 'sk4d_colorspacetransferfn_transform';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_data.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_data_make_empty := GetProcAddress(FLibHandle, 'sk4d_data_make_empty');
sk4d_data_make_with_copy := GetProcAddress(FLibHandle, 'sk4d_data_make_with_copy');
{$ELSE}
class function TSkiaAPI.sk4d_data_make_empty; external TSkiaAPI.LibName name 'sk4d_data_make_empty';
class function TSkiaAPI.sk4d_data_make_with_copy; external TSkiaAPI.LibName name 'sk4d_data_make_with_copy';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_document.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_document_begin_page := GetProcAddress(FLibHandle, 'sk4d_document_begin_page');
sk4d_document_close := GetProcAddress(FLibHandle, 'sk4d_document_close');
sk4d_document_end_page := GetProcAddress(FLibHandle, 'sk4d_document_end_page');
sk4d_document_make_pdf := GetProcAddress(FLibHandle, 'sk4d_document_make_pdf');
sk4d_document_make_pdf2 := GetProcAddress(FLibHandle, 'sk4d_document_make_pdf2');
sk4d_document_make_xps := GetProcAddress(FLibHandle, 'sk4d_document_make_xps');
sk4d_document_terminate := GetProcAddress(FLibHandle, 'sk4d_document_terminate');
{$ELSE}
class function TSkiaAPI.sk4d_document_begin_page; external TSkiaAPI.LibName name 'sk4d_document_begin_page';
class procedure TSkiaAPI.sk4d_document_close; external TSkiaAPI.LibName name 'sk4d_document_close';
class procedure TSkiaAPI.sk4d_document_end_page; external TSkiaAPI.LibName name 'sk4d_document_end_page';
class function TSkiaAPI.sk4d_document_make_pdf; external TSkiaAPI.LibName name 'sk4d_document_make_pdf';
class function TSkiaAPI.sk4d_document_make_pdf2; external TSkiaAPI.LibName name 'sk4d_document_make_pdf2';
class function TSkiaAPI.sk4d_document_make_xps; external TSkiaAPI.LibName name 'sk4d_document_make_xps';
class procedure TSkiaAPI.sk4d_document_terminate; external TSkiaAPI.LibName name 'sk4d_document_terminate';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_font.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_font_create := GetProcAddress(FLibHandle, 'sk4d_font_create');
sk4d_font_create2 := GetProcAddress(FLibHandle, 'sk4d_font_create2');
sk4d_font_destroy := GetProcAddress(FLibHandle, 'sk4d_font_destroy');
sk4d_font_get_baseline_snap := GetProcAddress(FLibHandle, 'sk4d_font_get_baseline_snap');
sk4d_font_get_edging := GetProcAddress(FLibHandle, 'sk4d_font_get_edging');
sk4d_font_get_embedded_bitmaps := GetProcAddress(FLibHandle, 'sk4d_font_get_embedded_bitmaps');
sk4d_font_get_embolden := GetProcAddress(FLibHandle, 'sk4d_font_get_embolden');
sk4d_font_get_force_auto_hinting := GetProcAddress(FLibHandle, 'sk4d_font_get_force_auto_hinting');
sk4d_font_get_glyphs := GetProcAddress(FLibHandle, 'sk4d_font_get_glyphs');
sk4d_font_get_glyphs_count := GetProcAddress(FLibHandle, 'sk4d_font_get_glyphs_count');
sk4d_font_get_hinting := GetProcAddress(FLibHandle, 'sk4d_font_get_hinting');
sk4d_font_get_horizontal_positions := GetProcAddress(FLibHandle, 'sk4d_font_get_horizontal_positions');
sk4d_font_get_intercepts := GetProcAddress(FLibHandle, 'sk4d_font_get_intercepts');
sk4d_font_get_linear_metrics := GetProcAddress(FLibHandle, 'sk4d_font_get_linear_metrics');
sk4d_font_get_metrics := GetProcAddress(FLibHandle, 'sk4d_font_get_metrics');
sk4d_font_get_path := GetProcAddress(FLibHandle, 'sk4d_font_get_path');
sk4d_font_get_paths := GetProcAddress(FLibHandle, 'sk4d_font_get_paths');
sk4d_font_get_positions := GetProcAddress(FLibHandle, 'sk4d_font_get_positions');
sk4d_font_get_scale_x := GetProcAddress(FLibHandle, 'sk4d_font_get_scale_x');
sk4d_font_get_size := GetProcAddress(FLibHandle, 'sk4d_font_get_size');
sk4d_font_get_skew_x := GetProcAddress(FLibHandle, 'sk4d_font_get_skew_x');
sk4d_font_get_subpixel := GetProcAddress(FLibHandle, 'sk4d_font_get_subpixel');
sk4d_font_get_typeface := GetProcAddress(FLibHandle, 'sk4d_font_get_typeface');
sk4d_font_get_typeface_or_default := GetProcAddress(FLibHandle, 'sk4d_font_get_typeface_or_default');
sk4d_font_get_widths_bounds := GetProcAddress(FLibHandle, 'sk4d_font_get_widths_bounds');
sk4d_font_is_equal := GetProcAddress(FLibHandle, 'sk4d_font_is_equal');
sk4d_font_measure_text := GetProcAddress(FLibHandle, 'sk4d_font_measure_text');
sk4d_font_set_baseline_snap := GetProcAddress(FLibHandle, 'sk4d_font_set_baseline_snap');
sk4d_font_set_edging := GetProcAddress(FLibHandle, 'sk4d_font_set_edging');
sk4d_font_set_embedded_bitmaps := GetProcAddress(FLibHandle, 'sk4d_font_set_embedded_bitmaps');
sk4d_font_set_embolden := GetProcAddress(FLibHandle, 'sk4d_font_set_embolden');
sk4d_font_set_force_auto_hinting := GetProcAddress(FLibHandle, 'sk4d_font_set_force_auto_hinting');
sk4d_font_set_hinting := GetProcAddress(FLibHandle, 'sk4d_font_set_hinting');
sk4d_font_set_linear_metrics := GetProcAddress(FLibHandle, 'sk4d_font_set_linear_metrics');
sk4d_font_set_scale_x := GetProcAddress(FLibHandle, 'sk4d_font_set_scale_x');
sk4d_font_set_size := GetProcAddress(FLibHandle, 'sk4d_font_set_size');
sk4d_font_set_skew_x := GetProcAddress(FLibHandle, 'sk4d_font_set_skew_x');
sk4d_font_set_subpixel := GetProcAddress(FLibHandle, 'sk4d_font_set_subpixel');
sk4d_font_set_typeface := GetProcAddress(FLibHandle, 'sk4d_font_set_typeface');
sk4d_font_unichar_to_glyph := GetProcAddress(FLibHandle, 'sk4d_font_unichar_to_glyph');
sk4d_font_unichars_to_glyphs := GetProcAddress(FLibHandle, 'sk4d_font_unichars_to_glyphs');
{$ELSE}
class function TSkiaAPI.sk4d_font_create; external TSkiaAPI.LibName name 'sk4d_font_create';
class function TSkiaAPI.sk4d_font_create2; external TSkiaAPI.LibName name 'sk4d_font_create2';
class procedure TSkiaAPI.sk4d_font_destroy; external TSkiaAPI.LibName name 'sk4d_font_destroy';
class function TSkiaAPI.sk4d_font_get_baseline_snap; external TSkiaAPI.LibName name 'sk4d_font_get_baseline_snap';
class function TSkiaAPI.sk4d_font_get_edging; external TSkiaAPI.LibName name 'sk4d_font_get_edging';
class function TSkiaAPI.sk4d_font_get_embedded_bitmaps; external TSkiaAPI.LibName name 'sk4d_font_get_embedded_bitmaps';
class function TSkiaAPI.sk4d_font_get_embolden; external TSkiaAPI.LibName name 'sk4d_font_get_embolden';
class function TSkiaAPI.sk4d_font_get_force_auto_hinting; external TSkiaAPI.LibName name 'sk4d_font_get_force_auto_hinting';
class function TSkiaAPI.sk4d_font_get_glyphs; external TSkiaAPI.LibName name 'sk4d_font_get_glyphs';
class function TSkiaAPI.sk4d_font_get_glyphs_count; external TSkiaAPI.LibName name 'sk4d_font_get_glyphs_count';
class function TSkiaAPI.sk4d_font_get_hinting; external TSkiaAPI.LibName name 'sk4d_font_get_hinting';
class procedure TSkiaAPI.sk4d_font_get_horizontal_positions; external TSkiaAPI.LibName name 'sk4d_font_get_horizontal_positions';
class function TSkiaAPI.sk4d_font_get_intercepts; external TSkiaAPI.LibName name 'sk4d_font_get_intercepts';
class function TSkiaAPI.sk4d_font_get_linear_metrics; external TSkiaAPI.LibName name 'sk4d_font_get_linear_metrics';
class function TSkiaAPI.sk4d_font_get_metrics; external TSkiaAPI.LibName name 'sk4d_font_get_metrics';
class function TSkiaAPI.sk4d_font_get_path; external TSkiaAPI.LibName name 'sk4d_font_get_path';
class procedure TSkiaAPI.sk4d_font_get_paths; external TSkiaAPI.LibName name 'sk4d_font_get_paths';
class procedure TSkiaAPI.sk4d_font_get_positions; external TSkiaAPI.LibName name 'sk4d_font_get_positions';
class function TSkiaAPI.sk4d_font_get_scale_x; external TSkiaAPI.LibName name 'sk4d_font_get_scale_x';
class function TSkiaAPI.sk4d_font_get_size; external TSkiaAPI.LibName name 'sk4d_font_get_size';
class function TSkiaAPI.sk4d_font_get_skew_x; external TSkiaAPI.LibName name 'sk4d_font_get_skew_x';
class function TSkiaAPI.sk4d_font_get_subpixel; external TSkiaAPI.LibName name 'sk4d_font_get_subpixel';
class function TSkiaAPI.sk4d_font_get_typeface; external TSkiaAPI.LibName name 'sk4d_font_get_typeface';
class function TSkiaAPI.sk4d_font_get_typeface_or_default; external TSkiaAPI.LibName name 'sk4d_font_get_typeface_or_default';
class procedure TSkiaAPI.sk4d_font_get_widths_bounds; external TSkiaAPI.LibName name 'sk4d_font_get_widths_bounds';
class function TSkiaAPI.sk4d_font_is_equal; external TSkiaAPI.LibName name 'sk4d_font_is_equal';
class function TSkiaAPI.sk4d_font_measure_text; external TSkiaAPI.LibName name 'sk4d_font_measure_text';
class procedure TSkiaAPI.sk4d_font_set_baseline_snap; external TSkiaAPI.LibName name 'sk4d_font_set_baseline_snap';
class procedure TSkiaAPI.sk4d_font_set_edging; external TSkiaAPI.LibName name 'sk4d_font_set_edging';
class procedure TSkiaAPI.sk4d_font_set_embedded_bitmaps; external TSkiaAPI.LibName name 'sk4d_font_set_embedded_bitmaps';
class procedure TSkiaAPI.sk4d_font_set_embolden; external TSkiaAPI.LibName name 'sk4d_font_set_embolden';
class procedure TSkiaAPI.sk4d_font_set_force_auto_hinting; external TSkiaAPI.LibName name 'sk4d_font_set_force_auto_hinting';
class procedure TSkiaAPI.sk4d_font_set_hinting; external TSkiaAPI.LibName name 'sk4d_font_set_hinting';
class procedure TSkiaAPI.sk4d_font_set_linear_metrics; external TSkiaAPI.LibName name 'sk4d_font_set_linear_metrics';
class procedure TSkiaAPI.sk4d_font_set_scale_x; external TSkiaAPI.LibName name 'sk4d_font_set_scale_x';
class procedure TSkiaAPI.sk4d_font_set_size; external TSkiaAPI.LibName name 'sk4d_font_set_size';
class procedure TSkiaAPI.sk4d_font_set_skew_x; external TSkiaAPI.LibName name 'sk4d_font_set_skew_x';
class procedure TSkiaAPI.sk4d_font_set_subpixel; external TSkiaAPI.LibName name 'sk4d_font_set_subpixel';
class procedure TSkiaAPI.sk4d_font_set_typeface; external TSkiaAPI.LibName name 'sk4d_font_set_typeface';
class function TSkiaAPI.sk4d_font_unichar_to_glyph; external TSkiaAPI.LibName name 'sk4d_font_unichar_to_glyph';
class procedure TSkiaAPI.sk4d_font_unichars_to_glyphs; external TSkiaAPI.LibName name 'sk4d_font_unichars_to_glyphs';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_graphics.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_graphics_allow_jit := GetProcAddress(FLibHandle, 'sk4d_graphics_allow_jit');
sk4d_graphics_dump_memory_statistics := GetProcAddress(FLibHandle, 'sk4d_graphics_dump_memory_statistics');
sk4d_graphics_get_font_cache_count_limit := GetProcAddress(FLibHandle, 'sk4d_graphics_get_font_cache_count_limit');
sk4d_graphics_get_font_cache_count_used := GetProcAddress(FLibHandle, 'sk4d_graphics_get_font_cache_count_used');
sk4d_graphics_get_font_cache_limit := GetProcAddress(FLibHandle, 'sk4d_graphics_get_font_cache_limit');
sk4d_graphics_get_font_cache_used := GetProcAddress(FLibHandle, 'sk4d_graphics_get_font_cache_used');
sk4d_graphics_get_resource_cache_single_allocation_byte_limit := GetProcAddress(FLibHandle, 'sk4d_graphics_get_resource_cache_single_allocation_byte_limit');
sk4d_graphics_get_resource_cache_total_byte_limit := GetProcAddress(FLibHandle, 'sk4d_graphics_get_resource_cache_total_byte_limit');
sk4d_graphics_get_resource_cache_total_bytes_used := GetProcAddress(FLibHandle, 'sk4d_graphics_get_resource_cache_total_bytes_used');
sk4d_graphics_init := GetProcAddress(FLibHandle, 'sk4d_graphics_init');
sk4d_graphics_purge_all_caches := GetProcAddress(FLibHandle, 'sk4d_graphics_purge_all_caches');
sk4d_graphics_purge_font_cache := GetProcAddress(FLibHandle, 'sk4d_graphics_purge_font_cache');
sk4d_graphics_purge_resource_cache := GetProcAddress(FLibHandle, 'sk4d_graphics_purge_resource_cache');
sk4d_graphics_set_font_cache_count_limit := GetProcAddress(FLibHandle, 'sk4d_graphics_set_font_cache_count_limit');
sk4d_graphics_set_font_cache_limit := GetProcAddress(FLibHandle, 'sk4d_graphics_set_font_cache_limit');
sk4d_graphics_set_resource_cache_single_allocation_byte_limit := GetProcAddress(FLibHandle, 'sk4d_graphics_set_resource_cache_single_allocation_byte_limit');
sk4d_graphics_set_resource_cache_total_byte_limit := GetProcAddress(FLibHandle, 'sk4d_graphics_set_resource_cache_total_byte_limit');
{$ELSE}
class procedure TSkiaAPI.sk4d_graphics_allow_jit; external TSkiaAPI.LibName name 'sk4d_graphics_allow_jit';
class procedure TSkiaAPI.sk4d_graphics_dump_memory_statistics; external TSkiaAPI.LibName name 'sk4d_graphics_dump_memory_statistics';
class function TSkiaAPI.sk4d_graphics_get_font_cache_count_limit; external TSkiaAPI.LibName name 'sk4d_graphics_get_font_cache_count_limit';
class function TSkiaAPI.sk4d_graphics_get_font_cache_count_used; external TSkiaAPI.LibName name 'sk4d_graphics_get_font_cache_count_used';
class function TSkiaAPI.sk4d_graphics_get_font_cache_limit; external TSkiaAPI.LibName name 'sk4d_graphics_get_font_cache_limit';
class function TSkiaAPI.sk4d_graphics_get_font_cache_used; external TSkiaAPI.LibName name 'sk4d_graphics_get_font_cache_used';
class function TSkiaAPI.sk4d_graphics_get_resource_cache_single_allocation_byte_limit; external TSkiaAPI.LibName name 'sk4d_graphics_get_resource_cache_single_allocation_byte_limit';
class function TSkiaAPI.sk4d_graphics_get_resource_cache_total_byte_limit; external TSkiaAPI.LibName name 'sk4d_graphics_get_resource_cache_total_byte_limit';
class function TSkiaAPI.sk4d_graphics_get_resource_cache_total_bytes_used; external TSkiaAPI.LibName name 'sk4d_graphics_get_resource_cache_total_bytes_used';
class procedure TSkiaAPI.sk4d_graphics_init; external TSkiaAPI.LibName name 'sk4d_graphics_init';
class procedure TSkiaAPI.sk4d_graphics_purge_all_caches; external TSkiaAPI.LibName name 'sk4d_graphics_purge_all_caches';
class procedure TSkiaAPI.sk4d_graphics_purge_font_cache; external TSkiaAPI.LibName name 'sk4d_graphics_purge_font_cache';
class procedure TSkiaAPI.sk4d_graphics_purge_resource_cache; external TSkiaAPI.LibName name 'sk4d_graphics_purge_resource_cache';
class function TSkiaAPI.sk4d_graphics_set_font_cache_count_limit; external TSkiaAPI.LibName name 'sk4d_graphics_set_font_cache_count_limit';
class function TSkiaAPI.sk4d_graphics_set_font_cache_limit; external TSkiaAPI.LibName name 'sk4d_graphics_set_font_cache_limit';
class function TSkiaAPI.sk4d_graphics_set_resource_cache_single_allocation_byte_limit; external TSkiaAPI.LibName name 'sk4d_graphics_set_resource_cache_single_allocation_byte_limit';
class function TSkiaAPI.sk4d_graphics_set_resource_cache_total_byte_limit; external TSkiaAPI.LibName name 'sk4d_graphics_set_resource_cache_total_byte_limit';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_image.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_image_encode_to_file := GetProcAddress(FLibHandle, 'sk4d_image_encode_to_file');
sk4d_image_encode_to_stream := GetProcAddress(FLibHandle, 'sk4d_image_encode_to_stream');
sk4d_image_get_alpha_type := GetProcAddress(FLibHandle, 'sk4d_image_get_alpha_type');
sk4d_image_get_color_space := GetProcAddress(FLibHandle, 'sk4d_image_get_color_space');
sk4d_image_get_color_type := GetProcAddress(FLibHandle, 'sk4d_image_get_color_type');
sk4d_image_get_height := GetProcAddress(FLibHandle, 'sk4d_image_get_height');
sk4d_image_get_image_info := GetProcAddress(FLibHandle, 'sk4d_image_get_image_info');
sk4d_image_get_unique_id := GetProcAddress(FLibHandle, 'sk4d_image_get_unique_id');
sk4d_image_get_width := GetProcAddress(FLibHandle, 'sk4d_image_get_width');
sk4d_image_is_lazy_generated := GetProcAddress(FLibHandle, 'sk4d_image_is_lazy_generated');
sk4d_image_is_texture_backed := GetProcAddress(FLibHandle, 'sk4d_image_is_texture_backed');
sk4d_image_is_valid := GetProcAddress(FLibHandle, 'sk4d_image_is_valid');
sk4d_image_make_from_adopted_texture := GetProcAddress(FLibHandle, 'sk4d_image_make_from_adopted_texture');
sk4d_image_make_from_encoded_file := GetProcAddress(FLibHandle, 'sk4d_image_make_from_encoded_file');
sk4d_image_make_from_encoded_stream := GetProcAddress(FLibHandle, 'sk4d_image_make_from_encoded_stream');
sk4d_image_make_from_raster := GetProcAddress(FLibHandle, 'sk4d_image_make_from_raster');
sk4d_image_make_from_texture := GetProcAddress(FLibHandle, 'sk4d_image_make_from_texture');
sk4d_image_make_non_texture_image := GetProcAddress(FLibHandle, 'sk4d_image_make_non_texture_image');
sk4d_image_make_raster_copy := GetProcAddress(FLibHandle, 'sk4d_image_make_raster_copy');
sk4d_image_make_raster_image := GetProcAddress(FLibHandle, 'sk4d_image_make_raster_image');
sk4d_image_make_shader := GetProcAddress(FLibHandle, 'sk4d_image_make_shader');
sk4d_image_make_subset := GetProcAddress(FLibHandle, 'sk4d_image_make_subset');
sk4d_image_make_texture_image := GetProcAddress(FLibHandle, 'sk4d_image_make_texture_image');
sk4d_image_make_with_filter := GetProcAddress(FLibHandle, 'sk4d_image_make_with_filter');
sk4d_image_peek_pixels := GetProcAddress(FLibHandle, 'sk4d_image_peek_pixels');
sk4d_image_read_pixels := GetProcAddress(FLibHandle, 'sk4d_image_read_pixels');
sk4d_image_scale_pixels := GetProcAddress(FLibHandle, 'sk4d_image_scale_pixels');
{$ELSE}
class procedure TSkiaAPI.sk4d_image_encode_to_file; external TSkiaAPI.LibName name 'sk4d_image_encode_to_file';
class procedure TSkiaAPI.sk4d_image_encode_to_stream; external TSkiaAPI.LibName name 'sk4d_image_encode_to_stream';
class function TSkiaAPI.sk4d_image_get_alpha_type; external TSkiaAPI.LibName name 'sk4d_image_get_alpha_type';
class function TSkiaAPI.sk4d_image_get_color_space; external TSkiaAPI.LibName name 'sk4d_image_get_color_space';
class function TSkiaAPI.sk4d_image_get_color_type; external TSkiaAPI.LibName name 'sk4d_image_get_color_type';
class function TSkiaAPI.sk4d_image_get_height; external TSkiaAPI.LibName name 'sk4d_image_get_height';
class procedure TSkiaAPI.sk4d_image_get_image_info; external TSkiaAPI.LibName name 'sk4d_image_get_image_info';
class function TSkiaAPI.sk4d_image_get_unique_id; external TSkiaAPI.LibName name 'sk4d_image_get_unique_id';
class function TSkiaAPI.sk4d_image_get_width; external TSkiaAPI.LibName name 'sk4d_image_get_width';
class function TSkiaAPI.sk4d_image_is_lazy_generated; external TSkiaAPI.LibName name 'sk4d_image_is_lazy_generated';
class function TSkiaAPI.sk4d_image_is_texture_backed; external TSkiaAPI.LibName name 'sk4d_image_is_texture_backed';
class function TSkiaAPI.sk4d_image_is_valid; external TSkiaAPI.LibName name 'sk4d_image_is_valid';
class function TSkiaAPI.sk4d_image_make_from_adopted_texture; external TSkiaAPI.LibName name 'sk4d_image_make_from_adopted_texture';
class function TSkiaAPI.sk4d_image_make_from_encoded_file; external TSkiaAPI.LibName name 'sk4d_image_make_from_encoded_file';
class function TSkiaAPI.sk4d_image_make_from_encoded_stream; external TSkiaAPI.LibName name 'sk4d_image_make_from_encoded_stream';
class function TSkiaAPI.sk4d_image_make_from_raster; external TSkiaAPI.LibName name 'sk4d_image_make_from_raster';
class function TSkiaAPI.sk4d_image_make_from_texture; external TSkiaAPI.LibName name 'sk4d_image_make_from_texture';
class function TSkiaAPI.sk4d_image_make_non_texture_image; external TSkiaAPI.LibName name 'sk4d_image_make_non_texture_image';
class function TSkiaAPI.sk4d_image_make_raster_copy; external TSkiaAPI.LibName name 'sk4d_image_make_raster_copy';
class function TSkiaAPI.sk4d_image_make_raster_image; external TSkiaAPI.LibName name 'sk4d_image_make_raster_image';
class function TSkiaAPI.sk4d_image_make_shader; external TSkiaAPI.LibName name 'sk4d_image_make_shader';
class function TSkiaAPI.sk4d_image_make_subset; external TSkiaAPI.LibName name 'sk4d_image_make_subset';
class function TSkiaAPI.sk4d_image_make_texture_image; external TSkiaAPI.LibName name 'sk4d_image_make_texture_image';
class function TSkiaAPI.sk4d_image_make_with_filter; external TSkiaAPI.LibName name 'sk4d_image_make_with_filter';
class function TSkiaAPI.sk4d_image_peek_pixels; external TSkiaAPI.LibName name 'sk4d_image_peek_pixels';
class function TSkiaAPI.sk4d_image_read_pixels; external TSkiaAPI.LibName name 'sk4d_image_read_pixels';
class function TSkiaAPI.sk4d_image_scale_pixels; external TSkiaAPI.LibName name 'sk4d_image_scale_pixels';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_imageencoder.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_imageencoder_encode_to_file := GetProcAddress(FLibHandle, 'sk4d_imageencoder_encode_to_file');
sk4d_imageencoder_encode_to_stream := GetProcAddress(FLibHandle, 'sk4d_imageencoder_encode_to_stream');
{$ELSE}
class function TSkiaAPI.sk4d_imageencoder_encode_to_file; external TSkiaAPI.LibName name 'sk4d_imageencoder_encode_to_file';
class function TSkiaAPI.sk4d_imageencoder_encode_to_stream; external TSkiaAPI.LibName name 'sk4d_imageencoder_encode_to_stream';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_imagefilter.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_imagefilter_make_alpha_threshold := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_alpha_threshold');
sk4d_imagefilter_make_arithmetic := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_arithmetic');
sk4d_imagefilter_make_blend := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_blend');
sk4d_imagefilter_make_blur := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_blur');
sk4d_imagefilter_make_colorfilter := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_colorfilter');
sk4d_imagefilter_make_compose := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_compose');
sk4d_imagefilter_make_dilate := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_dilate');
sk4d_imagefilter_make_displacement_map := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_displacement_map');
sk4d_imagefilter_make_distant_lit_diffuse := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_distant_lit_diffuse');
sk4d_imagefilter_make_distant_lit_specular := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_distant_lit_specular');
sk4d_imagefilter_make_drop_shadow := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_drop_shadow');
sk4d_imagefilter_make_drop_shadow_only := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_drop_shadow_only');
sk4d_imagefilter_make_erode := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_erode');
sk4d_imagefilter_make_image := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_image');
sk4d_imagefilter_make_magnifier := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_magnifier');
sk4d_imagefilter_make_matrix_convolution := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_matrix_convolution');
sk4d_imagefilter_make_matrix_transform := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_matrix_transform');
sk4d_imagefilter_make_merge := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_merge');
sk4d_imagefilter_make_offset := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_offset');
sk4d_imagefilter_make_picture := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_picture');
sk4d_imagefilter_make_point_lit_diffuse := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_point_lit_diffuse');
sk4d_imagefilter_make_point_lit_specular := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_point_lit_specular');
sk4d_imagefilter_make_shader := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_shader');
sk4d_imagefilter_make_spot_lit_diffuse := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_spot_lit_diffuse');
sk4d_imagefilter_make_spot_lit_specular := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_spot_lit_specular');
sk4d_imagefilter_make_tile := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_tile');
sk4d_imagefilter_make_with_local_matrix := GetProcAddress(FLibHandle, 'sk4d_imagefilter_make_with_local_matrix');
{$ELSE}
class function TSkiaAPI.sk4d_imagefilter_make_alpha_threshold; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_alpha_threshold';
class function TSkiaAPI.sk4d_imagefilter_make_arithmetic; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_arithmetic';
class function TSkiaAPI.sk4d_imagefilter_make_blend; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_blend';
class function TSkiaAPI.sk4d_imagefilter_make_blur; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_blur';
class function TSkiaAPI.sk4d_imagefilter_make_colorfilter; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_colorfilter';
class function TSkiaAPI.sk4d_imagefilter_make_compose; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_compose';
class function TSkiaAPI.sk4d_imagefilter_make_dilate; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_dilate';
class function TSkiaAPI.sk4d_imagefilter_make_displacement_map; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_displacement_map';
class function TSkiaAPI.sk4d_imagefilter_make_distant_lit_diffuse; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_distant_lit_diffuse';
class function TSkiaAPI.sk4d_imagefilter_make_distant_lit_specular; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_distant_lit_specular';
class function TSkiaAPI.sk4d_imagefilter_make_drop_shadow; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_drop_shadow';
class function TSkiaAPI.sk4d_imagefilter_make_drop_shadow_only; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_drop_shadow_only';
class function TSkiaAPI.sk4d_imagefilter_make_erode; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_erode';
class function TSkiaAPI.sk4d_imagefilter_make_image; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_image';
class function TSkiaAPI.sk4d_imagefilter_make_magnifier; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_magnifier';
class function TSkiaAPI.sk4d_imagefilter_make_matrix_convolution; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_matrix_convolution';
class function TSkiaAPI.sk4d_imagefilter_make_matrix_transform; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_matrix_transform';
class function TSkiaAPI.sk4d_imagefilter_make_merge; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_merge';
class function TSkiaAPI.sk4d_imagefilter_make_offset; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_offset';
class function TSkiaAPI.sk4d_imagefilter_make_picture; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_picture';
class function TSkiaAPI.sk4d_imagefilter_make_point_lit_diffuse; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_point_lit_diffuse';
class function TSkiaAPI.sk4d_imagefilter_make_point_lit_specular; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_point_lit_specular';
class function TSkiaAPI.sk4d_imagefilter_make_shader; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_shader';
class function TSkiaAPI.sk4d_imagefilter_make_spot_lit_diffuse; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_spot_lit_diffuse';
class function TSkiaAPI.sk4d_imagefilter_make_spot_lit_specular; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_spot_lit_specular';
class function TSkiaAPI.sk4d_imagefilter_make_tile; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_tile';
class function TSkiaAPI.sk4d_imagefilter_make_with_local_matrix; external TSkiaAPI.LibName name 'sk4d_imagefilter_make_with_local_matrix';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_maskfilter.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_maskfilter_make_blur := GetProcAddress(FLibHandle, 'sk4d_maskfilter_make_blur');
sk4d_maskfilter_make_shader := GetProcAddress(FLibHandle, 'sk4d_maskfilter_make_shader');
sk4d_maskfilter_make_table := GetProcAddress(FLibHandle, 'sk4d_maskfilter_make_table');
sk4d_maskfilter_make_table_clip := GetProcAddress(FLibHandle, 'sk4d_maskfilter_make_table_clip');
sk4d_maskfilter_make_table_gamma := GetProcAddress(FLibHandle, 'sk4d_maskfilter_make_table_gamma');
{$ELSE}
class function TSkiaAPI.sk4d_maskfilter_make_blur; external TSkiaAPI.LibName name 'sk4d_maskfilter_make_blur';
class function TSkiaAPI.sk4d_maskfilter_make_shader; external TSkiaAPI.LibName name 'sk4d_maskfilter_make_shader';
class function TSkiaAPI.sk4d_maskfilter_make_table; external TSkiaAPI.LibName name 'sk4d_maskfilter_make_table';
class function TSkiaAPI.sk4d_maskfilter_make_table_clip; external TSkiaAPI.LibName name 'sk4d_maskfilter_make_table_clip';
class function TSkiaAPI.sk4d_maskfilter_make_table_gamma; external TSkiaAPI.LibName name 'sk4d_maskfilter_make_table_gamma';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_paint.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_paint_create := GetProcAddress(FLibHandle, 'sk4d_paint_create');
sk4d_paint_create2 := GetProcAddress(FLibHandle, 'sk4d_paint_create2');
sk4d_paint_destroy := GetProcAddress(FLibHandle, 'sk4d_paint_destroy');
sk4d_paint_get_alpha := GetProcAddress(FLibHandle, 'sk4d_paint_get_alpha');
sk4d_paint_get_alphaf := GetProcAddress(FLibHandle, 'sk4d_paint_get_alphaf');
sk4d_paint_get_anti_alias := GetProcAddress(FLibHandle, 'sk4d_paint_get_anti_alias');
sk4d_paint_get_blender := GetProcAddress(FLibHandle, 'sk4d_paint_get_blender');
sk4d_paint_get_color := GetProcAddress(FLibHandle, 'sk4d_paint_get_color');
sk4d_paint_get_colorf := GetProcAddress(FLibHandle, 'sk4d_paint_get_colorf');
sk4d_paint_get_color_filter := GetProcAddress(FLibHandle, 'sk4d_paint_get_color_filter');
sk4d_paint_get_dither := GetProcAddress(FLibHandle, 'sk4d_paint_get_dither');
sk4d_paint_get_fill_path := GetProcAddress(FLibHandle, 'sk4d_paint_get_fill_path');
sk4d_paint_get_image_filter := GetProcAddress(FLibHandle, 'sk4d_paint_get_image_filter');
sk4d_paint_get_mask_filter := GetProcAddress(FLibHandle, 'sk4d_paint_get_mask_filter');
sk4d_paint_get_path_effect := GetProcAddress(FLibHandle, 'sk4d_paint_get_path_effect');
sk4d_paint_get_shader := GetProcAddress(FLibHandle, 'sk4d_paint_get_shader');
sk4d_paint_get_stroke_cap := GetProcAddress(FLibHandle, 'sk4d_paint_get_stroke_cap');
sk4d_paint_get_stroke_join := GetProcAddress(FLibHandle, 'sk4d_paint_get_stroke_join');
sk4d_paint_get_stroke_miter := GetProcAddress(FLibHandle, 'sk4d_paint_get_stroke_miter');
sk4d_paint_get_stroke_width := GetProcAddress(FLibHandle, 'sk4d_paint_get_stroke_width');
sk4d_paint_get_style := GetProcAddress(FLibHandle, 'sk4d_paint_get_style');
sk4d_paint_reset := GetProcAddress(FLibHandle, 'sk4d_paint_reset');
sk4d_paint_set_alpha := GetProcAddress(FLibHandle, 'sk4d_paint_set_alpha');
sk4d_paint_set_alphaf := GetProcAddress(FLibHandle, 'sk4d_paint_set_alphaf');
sk4d_paint_set_antialias := GetProcAddress(FLibHandle, 'sk4d_paint_set_antialias');
sk4d_paint_set_argb := GetProcAddress(FLibHandle, 'sk4d_paint_set_argb');
sk4d_paint_set_blender := GetProcAddress(FLibHandle, 'sk4d_paint_set_blender');
sk4d_paint_set_color := GetProcAddress(FLibHandle, 'sk4d_paint_set_color');
sk4d_paint_set_colorf := GetProcAddress(FLibHandle, 'sk4d_paint_set_colorf');
sk4d_paint_set_color_filter := GetProcAddress(FLibHandle, 'sk4d_paint_set_color_filter');
sk4d_paint_set_dither := GetProcAddress(FLibHandle, 'sk4d_paint_set_dither');
sk4d_paint_set_image_filter := GetProcAddress(FLibHandle, 'sk4d_paint_set_image_filter');
sk4d_paint_set_mask_filter := GetProcAddress(FLibHandle, 'sk4d_paint_set_mask_filter');
sk4d_paint_set_path_effect := GetProcAddress(FLibHandle, 'sk4d_paint_set_path_effect');
sk4d_paint_set_shader := GetProcAddress(FLibHandle, 'sk4d_paint_set_shader');
sk4d_paint_set_stroke_cap := GetProcAddress(FLibHandle, 'sk4d_paint_set_stroke_cap');
sk4d_paint_set_stroke_join := GetProcAddress(FLibHandle, 'sk4d_paint_set_stroke_join');
sk4d_paint_set_stroke_miter := GetProcAddress(FLibHandle, 'sk4d_paint_set_stroke_miter');
sk4d_paint_set_stroke_width := GetProcAddress(FLibHandle, 'sk4d_paint_set_stroke_width');
sk4d_paint_set_style := GetProcAddress(FLibHandle, 'sk4d_paint_set_style');
{$ELSE}
class function TSkiaAPI.sk4d_paint_create; external TSkiaAPI.LibName name 'sk4d_paint_create';
class function TSkiaAPI.sk4d_paint_create2; external TSkiaAPI.LibName name 'sk4d_paint_create2';
class procedure TSkiaAPI.sk4d_paint_destroy; external TSkiaAPI.LibName name 'sk4d_paint_destroy';
class function TSkiaAPI.sk4d_paint_get_alpha; external TSkiaAPI.LibName name 'sk4d_paint_get_alpha';
class function TSkiaAPI.sk4d_paint_get_alphaf; external TSkiaAPI.LibName name 'sk4d_paint_get_alphaf';
class function TSkiaAPI.sk4d_paint_get_anti_alias; external TSkiaAPI.LibName name 'sk4d_paint_get_anti_alias';
class function TSkiaAPI.sk4d_paint_get_blender; external TSkiaAPI.LibName name 'sk4d_paint_get_blender';
class function TSkiaAPI.sk4d_paint_get_color; external TSkiaAPI.LibName name 'sk4d_paint_get_color';
class procedure TSkiaAPI.sk4d_paint_get_colorf; external TSkiaAPI.LibName name 'sk4d_paint_get_colorf';
class function TSkiaAPI.sk4d_paint_get_color_filter; external TSkiaAPI.LibName name 'sk4d_paint_get_color_filter';
class function TSkiaAPI.sk4d_paint_get_dither; external TSkiaAPI.LibName name 'sk4d_paint_get_dither';
class function TSkiaAPI.sk4d_paint_get_fill_path; external TSkiaAPI.LibName name 'sk4d_paint_get_fill_path';
class function TSkiaAPI.sk4d_paint_get_image_filter; external TSkiaAPI.LibName name 'sk4d_paint_get_image_filter';
class function TSkiaAPI.sk4d_paint_get_mask_filter; external TSkiaAPI.LibName name 'sk4d_paint_get_mask_filter';
class function TSkiaAPI.sk4d_paint_get_path_effect; external TSkiaAPI.LibName name 'sk4d_paint_get_path_effect';
class function TSkiaAPI.sk4d_paint_get_shader; external TSkiaAPI.LibName name 'sk4d_paint_get_shader';
class function TSkiaAPI.sk4d_paint_get_stroke_cap; external TSkiaAPI.LibName name 'sk4d_paint_get_stroke_cap';
class function TSkiaAPI.sk4d_paint_get_stroke_join; external TSkiaAPI.LibName name 'sk4d_paint_get_stroke_join';
class function TSkiaAPI.sk4d_paint_get_stroke_miter; external TSkiaAPI.LibName name 'sk4d_paint_get_stroke_miter';
class function TSkiaAPI.sk4d_paint_get_stroke_width; external TSkiaAPI.LibName name 'sk4d_paint_get_stroke_width';
class function TSkiaAPI.sk4d_paint_get_style; external TSkiaAPI.LibName name 'sk4d_paint_get_style';
class procedure TSkiaAPI.sk4d_paint_reset; external TSkiaAPI.LibName name 'sk4d_paint_reset';
class procedure TSkiaAPI.sk4d_paint_set_alpha; external TSkiaAPI.LibName name 'sk4d_paint_set_alpha';
class procedure TSkiaAPI.sk4d_paint_set_alphaf; external TSkiaAPI.LibName name 'sk4d_paint_set_alphaf';
class procedure TSkiaAPI.sk4d_paint_set_antialias; external TSkiaAPI.LibName name 'sk4d_paint_set_antialias';
class procedure TSkiaAPI.sk4d_paint_set_argb; external TSkiaAPI.LibName name 'sk4d_paint_set_argb';
class procedure TSkiaAPI.sk4d_paint_set_blender; external TSkiaAPI.LibName name 'sk4d_paint_set_blender';
class procedure TSkiaAPI.sk4d_paint_set_color; external TSkiaAPI.LibName name 'sk4d_paint_set_color';
class procedure TSkiaAPI.sk4d_paint_set_colorf; external TSkiaAPI.LibName name 'sk4d_paint_set_colorf';
class procedure TSkiaAPI.sk4d_paint_set_color_filter; external TSkiaAPI.LibName name 'sk4d_paint_set_color_filter';
class procedure TSkiaAPI.sk4d_paint_set_dither; external TSkiaAPI.LibName name 'sk4d_paint_set_dither';
class procedure TSkiaAPI.sk4d_paint_set_image_filter; external TSkiaAPI.LibName name 'sk4d_paint_set_image_filter';
class procedure TSkiaAPI.sk4d_paint_set_mask_filter; external TSkiaAPI.LibName name 'sk4d_paint_set_mask_filter';
class procedure TSkiaAPI.sk4d_paint_set_path_effect; external TSkiaAPI.LibName name 'sk4d_paint_set_path_effect';
class procedure TSkiaAPI.sk4d_paint_set_shader; external TSkiaAPI.LibName name 'sk4d_paint_set_shader';
class procedure TSkiaAPI.sk4d_paint_set_stroke_cap; external TSkiaAPI.LibName name 'sk4d_paint_set_stroke_cap';
class procedure TSkiaAPI.sk4d_paint_set_stroke_join; external TSkiaAPI.LibName name 'sk4d_paint_set_stroke_join';
class procedure TSkiaAPI.sk4d_paint_set_stroke_miter; external TSkiaAPI.LibName name 'sk4d_paint_set_stroke_miter';
class procedure TSkiaAPI.sk4d_paint_set_stroke_width; external TSkiaAPI.LibName name 'sk4d_paint_set_stroke_width';
class procedure TSkiaAPI.sk4d_paint_set_style; external TSkiaAPI.LibName name 'sk4d_paint_set_style';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_path.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_opbuilder_add := GetProcAddress(FLibHandle, 'sk4d_opbuilder_add');
sk4d_opbuilder_create := GetProcAddress(FLibHandle, 'sk4d_opbuilder_create');
sk4d_opbuilder_destroy := GetProcAddress(FLibHandle, 'sk4d_opbuilder_destroy');
sk4d_opbuilder_detach := GetProcAddress(FLibHandle, 'sk4d_opbuilder_detach');
sk4d_path_contains := GetProcAddress(FLibHandle, 'sk4d_path_contains');
sk4d_path_convert_conic_to_quads := GetProcAddress(FLibHandle, 'sk4d_path_convert_conic_to_quads');
sk4d_path_create := GetProcAddress(FLibHandle, 'sk4d_path_create');
sk4d_path_create2 := GetProcAddress(FLibHandle, 'sk4d_path_create2');
sk4d_path_destroy := GetProcAddress(FLibHandle, 'sk4d_path_destroy');
sk4d_path_get_bounds := GetProcAddress(FLibHandle, 'sk4d_path_get_bounds');
sk4d_path_get_fill_type := GetProcAddress(FLibHandle, 'sk4d_path_get_fill_type');
sk4d_path_get_last_point := GetProcAddress(FLibHandle, 'sk4d_path_get_last_point');
sk4d_path_get_segment_masks := GetProcAddress(FLibHandle, 'sk4d_path_get_segment_masks');
sk4d_path_get_tight_bounds := GetProcAddress(FLibHandle, 'sk4d_path_get_tight_bounds');
sk4d_path_interpolate := GetProcAddress(FLibHandle, 'sk4d_path_interpolate');
sk4d_path_is_convex := GetProcAddress(FLibHandle, 'sk4d_path_is_convex');
sk4d_path_is_empty := GetProcAddress(FLibHandle, 'sk4d_path_is_empty');
sk4d_path_is_finite := GetProcAddress(FLibHandle, 'sk4d_path_is_finite');
sk4d_path_is_interpolatable := GetProcAddress(FLibHandle, 'sk4d_path_is_interpolatable');
sk4d_path_is_last_contour_closed := GetProcAddress(FLibHandle, 'sk4d_path_is_last_contour_closed');
sk4d_path_is_line := GetProcAddress(FLibHandle, 'sk4d_path_is_line');
sk4d_path_is_oval := GetProcAddress(FLibHandle, 'sk4d_path_is_oval');
sk4d_path_is_rect := GetProcAddress(FLibHandle, 'sk4d_path_is_rect');
sk4d_path_is_rrect := GetProcAddress(FLibHandle, 'sk4d_path_is_rrect');
sk4d_path_serialize_to_stream := GetProcAddress(FLibHandle, 'sk4d_path_serialize_to_stream');
sk4d_path_to_svg := GetProcAddress(FLibHandle, 'sk4d_path_to_svg');
sk4d_path_transform := GetProcAddress(FLibHandle, 'sk4d_path_transform');
sk4d_pathiterator_create := GetProcAddress(FLibHandle, 'sk4d_pathiterator_create');
sk4d_pathiterator_destroy := GetProcAddress(FLibHandle, 'sk4d_pathiterator_destroy');
sk4d_pathiterator_next := GetProcAddress(FLibHandle, 'sk4d_pathiterator_next');
{$ELSE}
class procedure TSkiaAPI.sk4d_opbuilder_add; external TSkiaAPI.LibName name 'sk4d_opbuilder_add';
class function TSkiaAPI.sk4d_opbuilder_create; external TSkiaAPI.LibName name 'sk4d_opbuilder_create';
class procedure TSkiaAPI.sk4d_opbuilder_destroy; external TSkiaAPI.LibName name 'sk4d_opbuilder_destroy';
class function TSkiaAPI.sk4d_opbuilder_detach; external TSkiaAPI.LibName name 'sk4d_opbuilder_detach';
class function TSkiaAPI.sk4d_path_contains; external TSkiaAPI.LibName name 'sk4d_path_contains';
class function TSkiaAPI.sk4d_path_convert_conic_to_quads; external TSkiaAPI.LibName name 'sk4d_path_convert_conic_to_quads';
class function TSkiaAPI.sk4d_path_create; external TSkiaAPI.LibName name 'sk4d_path_create';
class function TSkiaAPI.sk4d_path_create2; external TSkiaAPI.LibName name 'sk4d_path_create2';
class procedure TSkiaAPI.sk4d_path_destroy; external TSkiaAPI.LibName name 'sk4d_path_destroy';
class procedure TSkiaAPI.sk4d_path_get_bounds; external TSkiaAPI.LibName name 'sk4d_path_get_bounds';
class function TSkiaAPI.sk4d_path_get_fill_type; external TSkiaAPI.LibName name 'sk4d_path_get_fill_type';
class function TSkiaAPI.sk4d_path_get_last_point; external TSkiaAPI.LibName name 'sk4d_path_get_last_point';
class function TSkiaAPI.sk4d_path_get_segment_masks; external TSkiaAPI.LibName name 'sk4d_path_get_segment_masks';
class procedure TSkiaAPI.sk4d_path_get_tight_bounds; external TSkiaAPI.LibName name 'sk4d_path_get_tight_bounds';
class function TSkiaAPI.sk4d_path_interpolate; external TSkiaAPI.LibName name 'sk4d_path_interpolate';
class function TSkiaAPI.sk4d_path_is_convex; external TSkiaAPI.LibName name 'sk4d_path_is_convex';
class function TSkiaAPI.sk4d_path_is_empty; external TSkiaAPI.LibName name 'sk4d_path_is_empty';
class function TSkiaAPI.sk4d_path_is_finite; external TSkiaAPI.LibName name 'sk4d_path_is_finite';
class function TSkiaAPI.sk4d_path_is_interpolatable; external TSkiaAPI.LibName name 'sk4d_path_is_interpolatable';
class function TSkiaAPI.sk4d_path_is_last_contour_closed; external TSkiaAPI.LibName name 'sk4d_path_is_last_contour_closed';
class function TSkiaAPI.sk4d_path_is_line; external TSkiaAPI.LibName name 'sk4d_path_is_line';
class function TSkiaAPI.sk4d_path_is_oval; external TSkiaAPI.LibName name 'sk4d_path_is_oval';
class function TSkiaAPI.sk4d_path_is_rect; external TSkiaAPI.LibName name 'sk4d_path_is_rect';
class function TSkiaAPI.sk4d_path_is_rrect; external TSkiaAPI.LibName name 'sk4d_path_is_rrect';
class procedure TSkiaAPI.sk4d_path_serialize_to_stream; external TSkiaAPI.LibName name 'sk4d_path_serialize_to_stream';
class function TSkiaAPI.sk4d_path_to_svg; external TSkiaAPI.LibName name 'sk4d_path_to_svg';
class function TSkiaAPI.sk4d_path_transform; external TSkiaAPI.LibName name 'sk4d_path_transform';
class function TSkiaAPI.sk4d_pathiterator_create; external TSkiaAPI.LibName name 'sk4d_pathiterator_create';
class procedure TSkiaAPI.sk4d_pathiterator_destroy; external TSkiaAPI.LibName name 'sk4d_pathiterator_destroy';
class function TSkiaAPI.sk4d_pathiterator_next; external TSkiaAPI.LibName name 'sk4d_pathiterator_next';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_pathbuilder.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_pathbuilder_add_arc := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_add_arc');
sk4d_pathbuilder_add_circle := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_add_circle');
sk4d_pathbuilder_add_oval := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_add_oval');
sk4d_pathbuilder_add_path := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_add_path');
sk4d_pathbuilder_add_polygon := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_add_polygon');
sk4d_pathbuilder_add_rect := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_add_rect');
sk4d_pathbuilder_add_rrect := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_add_rrect');
sk4d_pathbuilder_arc_to := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_arc_to');
sk4d_pathbuilder_arc_to2 := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_arc_to2');
sk4d_pathbuilder_arc_to3 := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_arc_to3');
sk4d_pathbuilder_close := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_close');
sk4d_pathbuilder_conic_to := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_conic_to');
sk4d_pathbuilder_create := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_create');
sk4d_pathbuilder_create2 := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_create2');
sk4d_pathbuilder_cubic_to := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_cubic_to');
sk4d_pathbuilder_destroy := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_destroy');
sk4d_pathbuilder_detach := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_detach');
sk4d_pathbuilder_get_bounds := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_get_bounds');
sk4d_pathbuilder_get_fill_type := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_get_fill_type');
sk4d_pathbuilder_inc_reserve := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_inc_reserve');
sk4d_pathbuilder_line_to := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_line_to');
sk4d_pathbuilder_move_to := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_move_to');
sk4d_pathbuilder_offset := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_offset');
sk4d_pathbuilder_polyline_to := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_polyline_to');
sk4d_pathbuilder_quad_to := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_quad_to');
sk4d_pathbuilder_r_conic_to := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_r_conic_to');
sk4d_pathbuilder_r_cubic_to := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_r_cubic_to');
sk4d_pathbuilder_r_line_to := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_r_line_to');
sk4d_pathbuilder_r_quad_to := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_r_quad_to');
sk4d_pathbuilder_reset := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_reset');
sk4d_pathbuilder_set_filltype := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_set_filltype');
sk4d_pathbuilder_snapshot := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_snapshot');
sk4d_pathbuilder_toggle_inverse_filltype := GetProcAddress(FLibHandle, 'sk4d_pathbuilder_toggle_inverse_filltype');
{$ELSE}
class procedure TSkiaAPI.sk4d_pathbuilder_add_arc; external TSkiaAPI.LibName name 'sk4d_pathbuilder_add_arc';
class procedure TSkiaAPI.sk4d_pathbuilder_add_circle; external TSkiaAPI.LibName name 'sk4d_pathbuilder_add_circle';
class procedure TSkiaAPI.sk4d_pathbuilder_add_oval; external TSkiaAPI.LibName name 'sk4d_pathbuilder_add_oval';
class procedure TSkiaAPI.sk4d_pathbuilder_add_path; external TSkiaAPI.LibName name 'sk4d_pathbuilder_add_path';
class procedure TSkiaAPI.sk4d_pathbuilder_add_polygon; external TSkiaAPI.LibName name 'sk4d_pathbuilder_add_polygon';
class procedure TSkiaAPI.sk4d_pathbuilder_add_rect; external TSkiaAPI.LibName name 'sk4d_pathbuilder_add_rect';
class procedure TSkiaAPI.sk4d_pathbuilder_add_rrect; external TSkiaAPI.LibName name 'sk4d_pathbuilder_add_rrect';
class procedure TSkiaAPI.sk4d_pathbuilder_arc_to; external TSkiaAPI.LibName name 'sk4d_pathbuilder_arc_to';
class procedure TSkiaAPI.sk4d_pathbuilder_arc_to2; external TSkiaAPI.LibName name 'sk4d_pathbuilder_arc_to2';
class procedure TSkiaAPI.sk4d_pathbuilder_arc_to3; external TSkiaAPI.LibName name 'sk4d_pathbuilder_arc_to3';
class procedure TSkiaAPI.sk4d_pathbuilder_close; external TSkiaAPI.LibName name 'sk4d_pathbuilder_close';
class procedure TSkiaAPI.sk4d_pathbuilder_conic_to; external TSkiaAPI.LibName name 'sk4d_pathbuilder_conic_to';
class function TSkiaAPI.sk4d_pathbuilder_create; external TSkiaAPI.LibName name 'sk4d_pathbuilder_create';
class function TSkiaAPI.sk4d_pathbuilder_create2; external TSkiaAPI.LibName name 'sk4d_pathbuilder_create2';
class procedure TSkiaAPI.sk4d_pathbuilder_cubic_to; external TSkiaAPI.LibName name 'sk4d_pathbuilder_cubic_to';
class procedure TSkiaAPI.sk4d_pathbuilder_destroy; external TSkiaAPI.LibName name 'sk4d_pathbuilder_destroy';
class function TSkiaAPI.sk4d_pathbuilder_detach; external TSkiaAPI.LibName name 'sk4d_pathbuilder_detach';
class procedure TSkiaAPI.sk4d_pathbuilder_get_bounds; external TSkiaAPI.LibName name 'sk4d_pathbuilder_get_bounds';
class function TSkiaAPI.sk4d_pathbuilder_get_fill_type; external TSkiaAPI.LibName name 'sk4d_pathbuilder_get_fill_type';
class procedure TSkiaAPI.sk4d_pathbuilder_inc_reserve; external TSkiaAPI.LibName name 'sk4d_pathbuilder_inc_reserve';
class procedure TSkiaAPI.sk4d_pathbuilder_line_to; external TSkiaAPI.LibName name 'sk4d_pathbuilder_line_to';
class procedure TSkiaAPI.sk4d_pathbuilder_move_to; external TSkiaAPI.LibName name 'sk4d_pathbuilder_move_to';
class procedure TSkiaAPI.sk4d_pathbuilder_offset; external TSkiaAPI.LibName name 'sk4d_pathbuilder_offset';
class procedure TSkiaAPI.sk4d_pathbuilder_polyline_to; external TSkiaAPI.LibName name 'sk4d_pathbuilder_polyline_to';
class procedure TSkiaAPI.sk4d_pathbuilder_quad_to; external TSkiaAPI.LibName name 'sk4d_pathbuilder_quad_to';
class procedure TSkiaAPI.sk4d_pathbuilder_r_conic_to; external TSkiaAPI.LibName name 'sk4d_pathbuilder_r_conic_to';
class procedure TSkiaAPI.sk4d_pathbuilder_r_cubic_to; external TSkiaAPI.LibName name 'sk4d_pathbuilder_r_cubic_to';
class procedure TSkiaAPI.sk4d_pathbuilder_r_line_to; external TSkiaAPI.LibName name 'sk4d_pathbuilder_r_line_to';
class procedure TSkiaAPI.sk4d_pathbuilder_r_quad_to; external TSkiaAPI.LibName name 'sk4d_pathbuilder_r_quad_to';
class procedure TSkiaAPI.sk4d_pathbuilder_reset; external TSkiaAPI.LibName name 'sk4d_pathbuilder_reset';
class procedure TSkiaAPI.sk4d_pathbuilder_set_filltype; external TSkiaAPI.LibName name 'sk4d_pathbuilder_set_filltype';
class function TSkiaAPI.sk4d_pathbuilder_snapshot; external TSkiaAPI.LibName name 'sk4d_pathbuilder_snapshot';
class procedure TSkiaAPI.sk4d_pathbuilder_toggle_inverse_filltype; external TSkiaAPI.LibName name 'sk4d_pathbuilder_toggle_inverse_filltype';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_patheffect.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_patheffect_make_1dpath := GetProcAddress(FLibHandle, 'sk4d_patheffect_make_1dpath');
sk4d_patheffect_make_2dline := GetProcAddress(FLibHandle, 'sk4d_patheffect_make_2dline');
sk4d_patheffect_make_2dpath := GetProcAddress(FLibHandle, 'sk4d_patheffect_make_2dpath');
sk4d_patheffect_make_compose := GetProcAddress(FLibHandle, 'sk4d_patheffect_make_compose');
sk4d_patheffect_make_corner := GetProcAddress(FLibHandle, 'sk4d_patheffect_make_corner');
sk4d_patheffect_make_dash := GetProcAddress(FLibHandle, 'sk4d_patheffect_make_dash');
sk4d_patheffect_make_discrete := GetProcAddress(FLibHandle, 'sk4d_patheffect_make_discrete');
sk4d_patheffect_make_matrix := GetProcAddress(FLibHandle, 'sk4d_patheffect_make_matrix');
sk4d_patheffect_make_merge := GetProcAddress(FLibHandle, 'sk4d_patheffect_make_merge');
sk4d_patheffect_make_stroke := GetProcAddress(FLibHandle, 'sk4d_patheffect_make_stroke');
sk4d_patheffect_make_stroke_and_fill := GetProcAddress(FLibHandle, 'sk4d_patheffect_make_stroke_and_fill');
sk4d_patheffect_make_sum := GetProcAddress(FLibHandle, 'sk4d_patheffect_make_sum');
sk4d_patheffect_make_translate := GetProcAddress(FLibHandle, 'sk4d_patheffect_make_translate');
sk4d_patheffect_make_trim := GetProcAddress(FLibHandle, 'sk4d_patheffect_make_trim');
{$ELSE}
class function TSkiaAPI.sk4d_patheffect_make_1dpath; external TSkiaAPI.LibName name 'sk4d_patheffect_make_1dpath';
class function TSkiaAPI.sk4d_patheffect_make_2dline; external TSkiaAPI.LibName name 'sk4d_patheffect_make_2dline';
class function TSkiaAPI.sk4d_patheffect_make_2dpath; external TSkiaAPI.LibName name 'sk4d_patheffect_make_2dpath';
class function TSkiaAPI.sk4d_patheffect_make_compose; external TSkiaAPI.LibName name 'sk4d_patheffect_make_compose';
class function TSkiaAPI.sk4d_patheffect_make_corner; external TSkiaAPI.LibName name 'sk4d_patheffect_make_corner';
class function TSkiaAPI.sk4d_patheffect_make_dash; external TSkiaAPI.LibName name 'sk4d_patheffect_make_dash';
class function TSkiaAPI.sk4d_patheffect_make_discrete; external TSkiaAPI.LibName name 'sk4d_patheffect_make_discrete';
class function TSkiaAPI.sk4d_patheffect_make_matrix; external TSkiaAPI.LibName name 'sk4d_patheffect_make_matrix';
class function TSkiaAPI.sk4d_patheffect_make_merge; external TSkiaAPI.LibName name 'sk4d_patheffect_make_merge';
class function TSkiaAPI.sk4d_patheffect_make_stroke; external TSkiaAPI.LibName name 'sk4d_patheffect_make_stroke';
class function TSkiaAPI.sk4d_patheffect_make_stroke_and_fill; external TSkiaAPI.LibName name 'sk4d_patheffect_make_stroke_and_fill';
class function TSkiaAPI.sk4d_patheffect_make_sum; external TSkiaAPI.LibName name 'sk4d_patheffect_make_sum';
class function TSkiaAPI.sk4d_patheffect_make_translate; external TSkiaAPI.LibName name 'sk4d_patheffect_make_translate';
class function TSkiaAPI.sk4d_patheffect_make_trim; external TSkiaAPI.LibName name 'sk4d_patheffect_make_trim';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_pathmeasure.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_pathmeasure_create := GetProcAddress(FLibHandle, 'sk4d_pathmeasure_create');
sk4d_pathmeasure_destroy := GetProcAddress(FLibHandle, 'sk4d_pathmeasure_destroy');
sk4d_pathmeasure_get_length := GetProcAddress(FLibHandle, 'sk4d_pathmeasure_get_length');
sk4d_pathmeasure_get_matrix := GetProcAddress(FLibHandle, 'sk4d_pathmeasure_get_matrix');
sk4d_pathmeasure_get_position_and_tangent := GetProcAddress(FLibHandle, 'sk4d_pathmeasure_get_position_and_tangent');
sk4d_pathmeasure_get_segment := GetProcAddress(FLibHandle, 'sk4d_pathmeasure_get_segment');
sk4d_pathmeasure_is_closed := GetProcAddress(FLibHandle, 'sk4d_pathmeasure_is_closed');
sk4d_pathmeasure_next_contour := GetProcAddress(FLibHandle, 'sk4d_pathmeasure_next_contour');
{$ELSE}
class function TSkiaAPI.sk4d_pathmeasure_create; external TSkiaAPI.LibName name 'sk4d_pathmeasure_create';
class procedure TSkiaAPI.sk4d_pathmeasure_destroy; external TSkiaAPI.LibName name 'sk4d_pathmeasure_destroy';
class function TSkiaAPI.sk4d_pathmeasure_get_length; external TSkiaAPI.LibName name 'sk4d_pathmeasure_get_length';
class function TSkiaAPI.sk4d_pathmeasure_get_matrix; external TSkiaAPI.LibName name 'sk4d_pathmeasure_get_matrix';
class function TSkiaAPI.sk4d_pathmeasure_get_position_and_tangent; external TSkiaAPI.LibName name 'sk4d_pathmeasure_get_position_and_tangent';
class function TSkiaAPI.sk4d_pathmeasure_get_segment; external TSkiaAPI.LibName name 'sk4d_pathmeasure_get_segment';
class function TSkiaAPI.sk4d_pathmeasure_is_closed; external TSkiaAPI.LibName name 'sk4d_pathmeasure_is_closed';
class function TSkiaAPI.sk4d_pathmeasure_next_contour; external TSkiaAPI.LibName name 'sk4d_pathmeasure_next_contour';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_picture.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_picture_get_cull_rect := GetProcAddress(FLibHandle, 'sk4d_picture_get_cull_rect');
sk4d_picture_make_from_stream := GetProcAddress(FLibHandle, 'sk4d_picture_make_from_stream');
sk4d_picture_make_shader := GetProcAddress(FLibHandle, 'sk4d_picture_make_shader');
sk4d_picture_playback := GetProcAddress(FLibHandle, 'sk4d_picture_playback');
sk4d_picture_serialize_to_stream := GetProcAddress(FLibHandle, 'sk4d_picture_serialize_to_stream');
{$ELSE}
class procedure TSkiaAPI.sk4d_picture_get_cull_rect; external TSkiaAPI.LibName name 'sk4d_picture_get_cull_rect';
class function TSkiaAPI.sk4d_picture_make_from_stream; external TSkiaAPI.LibName name 'sk4d_picture_make_from_stream';
class function TSkiaAPI.sk4d_picture_make_shader; external TSkiaAPI.LibName name 'sk4d_picture_make_shader';
class procedure TSkiaAPI.sk4d_picture_playback; external TSkiaAPI.LibName name 'sk4d_picture_playback';
class procedure TSkiaAPI.sk4d_picture_serialize_to_stream; external TSkiaAPI.LibName name 'sk4d_picture_serialize_to_stream';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_picturerecorder.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_picturerecorder_begin_recording := GetProcAddress(FLibHandle, 'sk4d_picturerecorder_begin_recording');
sk4d_picturerecorder_create := GetProcAddress(FLibHandle, 'sk4d_picturerecorder_create');
sk4d_picturerecorder_destroy := GetProcAddress(FLibHandle, 'sk4d_picturerecorder_destroy');
sk4d_picturerecorder_finish_recording := GetProcAddress(FLibHandle, 'sk4d_picturerecorder_finish_recording');
sk4d_picturerecorder_finish_recording2 := GetProcAddress(FLibHandle, 'sk4d_picturerecorder_finish_recording2');
{$ELSE}
class function TSkiaAPI.sk4d_picturerecorder_begin_recording; external TSkiaAPI.LibName name 'sk4d_picturerecorder_begin_recording';
class function TSkiaAPI.sk4d_picturerecorder_create; external TSkiaAPI.LibName name 'sk4d_picturerecorder_create';
class procedure TSkiaAPI.sk4d_picturerecorder_destroy; external TSkiaAPI.LibName name 'sk4d_picturerecorder_destroy';
class function TSkiaAPI.sk4d_picturerecorder_finish_recording; external TSkiaAPI.LibName name 'sk4d_picturerecorder_finish_recording';
class function TSkiaAPI.sk4d_picturerecorder_finish_recording2; external TSkiaAPI.LibName name 'sk4d_picturerecorder_finish_recording2';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_pixmap.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_pixmap_create := GetProcAddress(FLibHandle, 'sk4d_pixmap_create');
sk4d_pixmap_destroy := GetProcAddress(FLibHandle, 'sk4d_pixmap_destroy');
sk4d_pixmap_erase := GetProcAddress(FLibHandle, 'sk4d_pixmap_erase');
sk4d_pixmap_erase2 := GetProcAddress(FLibHandle, 'sk4d_pixmap_erase2');
sk4d_pixmap_extract_subset := GetProcAddress(FLibHandle, 'sk4d_pixmap_extract_subset');
sk4d_pixmap_get_alpha := GetProcAddress(FLibHandle, 'sk4d_pixmap_get_alpha');
sk4d_pixmap_get_alpha_type := GetProcAddress(FLibHandle, 'sk4d_pixmap_get_alpha_type');
sk4d_pixmap_get_color := GetProcAddress(FLibHandle, 'sk4d_pixmap_get_color');
sk4d_pixmap_get_color_space := GetProcAddress(FLibHandle, 'sk4d_pixmap_get_color_space');
sk4d_pixmap_get_color_type := GetProcAddress(FLibHandle, 'sk4d_pixmap_get_color_type');
sk4d_pixmap_get_height := GetProcAddress(FLibHandle, 'sk4d_pixmap_get_height');
sk4d_pixmap_get_image_info := GetProcAddress(FLibHandle, 'sk4d_pixmap_get_image_info');
sk4d_pixmap_get_pixel_addr := GetProcAddress(FLibHandle, 'sk4d_pixmap_get_pixel_addr');
sk4d_pixmap_get_pixels := GetProcAddress(FLibHandle, 'sk4d_pixmap_get_pixels');
sk4d_pixmap_get_row_bytes := GetProcAddress(FLibHandle, 'sk4d_pixmap_get_row_bytes');
sk4d_pixmap_get_width := GetProcAddress(FLibHandle, 'sk4d_pixmap_get_width');
sk4d_pixmap_read_pixels := GetProcAddress(FLibHandle, 'sk4d_pixmap_read_pixels');
sk4d_pixmap_scale_pixels := GetProcAddress(FLibHandle, 'sk4d_pixmap_scale_pixels');
sk4d_pixmap_set_colorspace := GetProcAddress(FLibHandle, 'sk4d_pixmap_set_colorspace');
{$ELSE}
class function TSkiaAPI.sk4d_pixmap_create; external TSkiaAPI.LibName name 'sk4d_pixmap_create';
class procedure TSkiaAPI.sk4d_pixmap_destroy; external TSkiaAPI.LibName name 'sk4d_pixmap_destroy';
class function TSkiaAPI.sk4d_pixmap_erase; external TSkiaAPI.LibName name 'sk4d_pixmap_erase';
class function TSkiaAPI.sk4d_pixmap_erase2; external TSkiaAPI.LibName name 'sk4d_pixmap_erase2';
class function TSkiaAPI.sk4d_pixmap_extract_subset; external TSkiaAPI.LibName name 'sk4d_pixmap_extract_subset';
class function TSkiaAPI.sk4d_pixmap_get_alpha; external TSkiaAPI.LibName name 'sk4d_pixmap_get_alpha';
class function TSkiaAPI.sk4d_pixmap_get_alpha_type; external TSkiaAPI.LibName name 'sk4d_pixmap_get_alpha_type';
class function TSkiaAPI.sk4d_pixmap_get_color; external TSkiaAPI.LibName name 'sk4d_pixmap_get_color';
class function TSkiaAPI.sk4d_pixmap_get_color_space; external TSkiaAPI.LibName name 'sk4d_pixmap_get_color_space';
class function TSkiaAPI.sk4d_pixmap_get_color_type; external TSkiaAPI.LibName name 'sk4d_pixmap_get_color_type';
class function TSkiaAPI.sk4d_pixmap_get_height; external TSkiaAPI.LibName name 'sk4d_pixmap_get_height';
class procedure TSkiaAPI.sk4d_pixmap_get_image_info; external TSkiaAPI.LibName name 'sk4d_pixmap_get_image_info';
class function TSkiaAPI.sk4d_pixmap_get_pixel_addr; external TSkiaAPI.LibName name 'sk4d_pixmap_get_pixel_addr';
class function TSkiaAPI.sk4d_pixmap_get_pixels; external TSkiaAPI.LibName name 'sk4d_pixmap_get_pixels';
class function TSkiaAPI.sk4d_pixmap_get_row_bytes; external TSkiaAPI.LibName name 'sk4d_pixmap_get_row_bytes';
class function TSkiaAPI.sk4d_pixmap_get_width; external TSkiaAPI.LibName name 'sk4d_pixmap_get_width';
class function TSkiaAPI.sk4d_pixmap_read_pixels; external TSkiaAPI.LibName name 'sk4d_pixmap_read_pixels';
class function TSkiaAPI.sk4d_pixmap_scale_pixels; external TSkiaAPI.LibName name 'sk4d_pixmap_scale_pixels';
class procedure TSkiaAPI.sk4d_pixmap_set_colorspace; external TSkiaAPI.LibName name 'sk4d_pixmap_set_colorspace';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_refcnt.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_refcnt_ref := GetProcAddress(FLibHandle, 'sk4d_refcnt_ref');
sk4d_refcnt_unref := GetProcAddress(FLibHandle, 'sk4d_refcnt_unref');
{$ELSE}
class procedure TSkiaAPI.sk4d_refcnt_ref; external TSkiaAPI.LibName name 'sk4d_refcnt_ref';
class procedure TSkiaAPI.sk4d_refcnt_unref; external TSkiaAPI.LibName name 'sk4d_refcnt_unref';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_region.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_region_contains := GetProcAddress(FLibHandle, 'sk4d_region_contains');
sk4d_region_contains2 := GetProcAddress(FLibHandle, 'sk4d_region_contains2');
sk4d_region_contains3 := GetProcAddress(FLibHandle, 'sk4d_region_contains3');
sk4d_region_create := GetProcAddress(FLibHandle, 'sk4d_region_create');
sk4d_region_create2 := GetProcAddress(FLibHandle, 'sk4d_region_create2');
sk4d_region_destroy := GetProcAddress(FLibHandle, 'sk4d_region_destroy');
sk4d_region_get_boundary_path := GetProcAddress(FLibHandle, 'sk4d_region_get_boundary_path');
sk4d_region_get_bounds := GetProcAddress(FLibHandle, 'sk4d_region_get_bounds');
sk4d_region_intersects := GetProcAddress(FLibHandle, 'sk4d_region_intersects');
sk4d_region_intersects2 := GetProcAddress(FLibHandle, 'sk4d_region_intersects2');
sk4d_region_is_complex := GetProcAddress(FLibHandle, 'sk4d_region_is_complex');
sk4d_region_is_empty := GetProcAddress(FLibHandle, 'sk4d_region_is_empty');
sk4d_region_is_equal := GetProcAddress(FLibHandle, 'sk4d_region_is_equal');
sk4d_region_is_rect := GetProcAddress(FLibHandle, 'sk4d_region_is_rect');
sk4d_region_op := GetProcAddress(FLibHandle, 'sk4d_region_op');
sk4d_region_op2 := GetProcAddress(FLibHandle, 'sk4d_region_op2');
sk4d_region_quick_contains := GetProcAddress(FLibHandle, 'sk4d_region_quick_contains');
sk4d_region_quick_reject := GetProcAddress(FLibHandle, 'sk4d_region_quick_reject');
sk4d_region_quick_reject2 := GetProcAddress(FLibHandle, 'sk4d_region_quick_reject2');
sk4d_region_set_empty := GetProcAddress(FLibHandle, 'sk4d_region_set_empty');
sk4d_region_set_path := GetProcAddress(FLibHandle, 'sk4d_region_set_path');
sk4d_region_set_rect := GetProcAddress(FLibHandle, 'sk4d_region_set_rect');
sk4d_region_set_rects := GetProcAddress(FLibHandle, 'sk4d_region_set_rects');
sk4d_region_translate := GetProcAddress(FLibHandle, 'sk4d_region_translate');
sk4d_regioncliperator_create := GetProcAddress(FLibHandle, 'sk4d_regioncliperator_create');
sk4d_regioncliperator_destroy := GetProcAddress(FLibHandle, 'sk4d_regioncliperator_destroy');
sk4d_regioncliperator_get_current := GetProcAddress(FLibHandle, 'sk4d_regioncliperator_get_current');
sk4d_regioncliperator_move_next := GetProcAddress(FLibHandle, 'sk4d_regioncliperator_move_next');
sk4d_regioniterator_create := GetProcAddress(FLibHandle, 'sk4d_regioniterator_create');
sk4d_regioniterator_destroy := GetProcAddress(FLibHandle, 'sk4d_regioniterator_destroy');
sk4d_regioniterator_get_current := GetProcAddress(FLibHandle, 'sk4d_regioniterator_get_current');
sk4d_regioniterator_move_next := GetProcAddress(FLibHandle, 'sk4d_regioniterator_move_next');
sk4d_regioniterator_reset := GetProcAddress(FLibHandle, 'sk4d_regioniterator_reset');
sk4d_regionspanerator_create := GetProcAddress(FLibHandle, 'sk4d_regionspanerator_create');
sk4d_regionspanerator_destroy := GetProcAddress(FLibHandle, 'sk4d_regionspanerator_destroy');
sk4d_regionspanerator_next := GetProcAddress(FLibHandle, 'sk4d_regionspanerator_next');
{$ELSE}
class function TSkiaAPI.sk4d_region_contains; external TSkiaAPI.LibName name 'sk4d_region_contains';
class function TSkiaAPI.sk4d_region_contains2; external TSkiaAPI.LibName name 'sk4d_region_contains2';
class function TSkiaAPI.sk4d_region_contains3; external TSkiaAPI.LibName name 'sk4d_region_contains3';
class function TSkiaAPI.sk4d_region_create; external TSkiaAPI.LibName name 'sk4d_region_create';
class function TSkiaAPI.sk4d_region_create2; external TSkiaAPI.LibName name 'sk4d_region_create2';
class procedure TSkiaAPI.sk4d_region_destroy; external TSkiaAPI.LibName name 'sk4d_region_destroy';
class function TSkiaAPI.sk4d_region_get_boundary_path; external TSkiaAPI.LibName name 'sk4d_region_get_boundary_path';
class procedure TSkiaAPI.sk4d_region_get_bounds; external TSkiaAPI.LibName name 'sk4d_region_get_bounds';
class function TSkiaAPI.sk4d_region_intersects; external TSkiaAPI.LibName name 'sk4d_region_intersects';
class function TSkiaAPI.sk4d_region_intersects2; external TSkiaAPI.LibName name 'sk4d_region_intersects2';
class function TSkiaAPI.sk4d_region_is_complex; external TSkiaAPI.LibName name 'sk4d_region_is_complex';
class function TSkiaAPI.sk4d_region_is_empty; external TSkiaAPI.LibName name 'sk4d_region_is_empty';
class function TSkiaAPI.sk4d_region_is_equal; external TSkiaAPI.LibName name 'sk4d_region_is_equal';
class function TSkiaAPI.sk4d_region_is_rect; external TSkiaAPI.LibName name 'sk4d_region_is_rect';
class function TSkiaAPI.sk4d_region_op; external TSkiaAPI.LibName name 'sk4d_region_op';
class function TSkiaAPI.sk4d_region_op2; external TSkiaAPI.LibName name 'sk4d_region_op2';
class function TSkiaAPI.sk4d_region_quick_contains; external TSkiaAPI.LibName name 'sk4d_region_quick_contains';
class function TSkiaAPI.sk4d_region_quick_reject; external TSkiaAPI.LibName name 'sk4d_region_quick_reject';
class function TSkiaAPI.sk4d_region_quick_reject2; external TSkiaAPI.LibName name 'sk4d_region_quick_reject2';
class procedure TSkiaAPI.sk4d_region_set_empty; external TSkiaAPI.LibName name 'sk4d_region_set_empty';
class function TSkiaAPI.sk4d_region_set_path; external TSkiaAPI.LibName name 'sk4d_region_set_path';
class function TSkiaAPI.sk4d_region_set_rect; external TSkiaAPI.LibName name 'sk4d_region_set_rect';
class function TSkiaAPI.sk4d_region_set_rects; external TSkiaAPI.LibName name 'sk4d_region_set_rects';
class procedure TSkiaAPI.sk4d_region_translate; external TSkiaAPI.LibName name 'sk4d_region_translate';
class function TSkiaAPI.sk4d_regioncliperator_create; external TSkiaAPI.LibName name 'sk4d_regioncliperator_create';
class procedure TSkiaAPI.sk4d_regioncliperator_destroy; external TSkiaAPI.LibName name 'sk4d_regioncliperator_destroy';
class procedure TSkiaAPI.sk4d_regioncliperator_get_current; external TSkiaAPI.LibName name 'sk4d_regioncliperator_get_current';
class function TSkiaAPI.sk4d_regioncliperator_move_next; external TSkiaAPI.LibName name 'sk4d_regioncliperator_move_next';
class function TSkiaAPI.sk4d_regioniterator_create; external TSkiaAPI.LibName name 'sk4d_regioniterator_create';
class procedure TSkiaAPI.sk4d_regioniterator_destroy; external TSkiaAPI.LibName name 'sk4d_regioniterator_destroy';
class procedure TSkiaAPI.sk4d_regioniterator_get_current; external TSkiaAPI.LibName name 'sk4d_regioniterator_get_current';
class function TSkiaAPI.sk4d_regioniterator_move_next; external TSkiaAPI.LibName name 'sk4d_regioniterator_move_next';
class procedure TSkiaAPI.sk4d_regioniterator_reset; external TSkiaAPI.LibName name 'sk4d_regioniterator_reset';
class function TSkiaAPI.sk4d_regionspanerator_create; external TSkiaAPI.LibName name 'sk4d_regionspanerator_create';
class procedure TSkiaAPI.sk4d_regionspanerator_destroy; external TSkiaAPI.LibName name 'sk4d_regionspanerator_destroy';
class function TSkiaAPI.sk4d_regionspanerator_next; external TSkiaAPI.LibName name 'sk4d_regionspanerator_next';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_rrect.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_rrect_contains := GetProcAddress(FLibHandle, 'sk4d_rrect_contains');
sk4d_rrect_create := GetProcAddress(FLibHandle, 'sk4d_rrect_create');
sk4d_rrect_create2 := GetProcAddress(FLibHandle, 'sk4d_rrect_create2');
sk4d_rrect_deflate := GetProcAddress(FLibHandle, 'sk4d_rrect_deflate');
sk4d_rrect_destroy := GetProcAddress(FLibHandle, 'sk4d_rrect_destroy');
sk4d_rrect_get_height := GetProcAddress(FLibHandle, 'sk4d_rrect_get_height');
sk4d_rrect_get_radii := GetProcAddress(FLibHandle, 'sk4d_rrect_get_radii');
sk4d_rrect_get_rect := GetProcAddress(FLibHandle, 'sk4d_rrect_get_rect');
sk4d_rrect_get_simple_radii := GetProcAddress(FLibHandle, 'sk4d_rrect_get_simple_radii');
sk4d_rrect_get_width := GetProcAddress(FLibHandle, 'sk4d_rrect_get_width');
sk4d_rrect_inflate := GetProcAddress(FLibHandle, 'sk4d_rrect_inflate');
sk4d_rrect_is_complex := GetProcAddress(FLibHandle, 'sk4d_rrect_is_complex');
sk4d_rrect_is_empty := GetProcAddress(FLibHandle, 'sk4d_rrect_is_empty');
sk4d_rrect_is_equal := GetProcAddress(FLibHandle, 'sk4d_rrect_is_equal');
sk4d_rrect_is_nine_patch := GetProcAddress(FLibHandle, 'sk4d_rrect_is_nine_patch');
sk4d_rrect_is_oval := GetProcAddress(FLibHandle, 'sk4d_rrect_is_oval');
sk4d_rrect_is_rect := GetProcAddress(FLibHandle, 'sk4d_rrect_is_rect');
sk4d_rrect_is_simple := GetProcAddress(FLibHandle, 'sk4d_rrect_is_simple');
sk4d_rrect_is_valid := GetProcAddress(FLibHandle, 'sk4d_rrect_is_valid');
sk4d_rrect_offset := GetProcAddress(FLibHandle, 'sk4d_rrect_offset');
sk4d_rrect_set_empty := GetProcAddress(FLibHandle, 'sk4d_rrect_set_empty');
sk4d_rrect_set_nine_patch := GetProcAddress(FLibHandle, 'sk4d_rrect_set_nine_patch');
sk4d_rrect_set_oval := GetProcAddress(FLibHandle, 'sk4d_rrect_set_oval');
sk4d_rrect_set_rect := GetProcAddress(FLibHandle, 'sk4d_rrect_set_rect');
sk4d_rrect_set_rect2 := GetProcAddress(FLibHandle, 'sk4d_rrect_set_rect2');
sk4d_rrect_set_rect3 := GetProcAddress(FLibHandle, 'sk4d_rrect_set_rect3');
sk4d_rrect_transform := GetProcAddress(FLibHandle, 'sk4d_rrect_transform');
{$ELSE}
class function TSkiaAPI.sk4d_rrect_contains; external TSkiaAPI.LibName name 'sk4d_rrect_contains';
class function TSkiaAPI.sk4d_rrect_create; external TSkiaAPI.LibName name 'sk4d_rrect_create';
class function TSkiaAPI.sk4d_rrect_create2; external TSkiaAPI.LibName name 'sk4d_rrect_create2';
class procedure TSkiaAPI.sk4d_rrect_deflate; external TSkiaAPI.LibName name 'sk4d_rrect_deflate';
class procedure TSkiaAPI.sk4d_rrect_destroy; external TSkiaAPI.LibName name 'sk4d_rrect_destroy';
class function TSkiaAPI.sk4d_rrect_get_height; external TSkiaAPI.LibName name 'sk4d_rrect_get_height';
class procedure TSkiaAPI.sk4d_rrect_get_radii; external TSkiaAPI.LibName name 'sk4d_rrect_get_radii';
class procedure TSkiaAPI.sk4d_rrect_get_rect; external TSkiaAPI.LibName name 'sk4d_rrect_get_rect';
class procedure TSkiaAPI.sk4d_rrect_get_simple_radii; external TSkiaAPI.LibName name 'sk4d_rrect_get_simple_radii';
class function TSkiaAPI.sk4d_rrect_get_width; external TSkiaAPI.LibName name 'sk4d_rrect_get_width';
class procedure TSkiaAPI.sk4d_rrect_inflate; external TSkiaAPI.LibName name 'sk4d_rrect_inflate';
class function TSkiaAPI.sk4d_rrect_is_complex; external TSkiaAPI.LibName name 'sk4d_rrect_is_complex';
class function TSkiaAPI.sk4d_rrect_is_empty; external TSkiaAPI.LibName name 'sk4d_rrect_is_empty';
class function TSkiaAPI.sk4d_rrect_is_equal; external TSkiaAPI.LibName name 'sk4d_rrect_is_equal';
class function TSkiaAPI.sk4d_rrect_is_nine_patch; external TSkiaAPI.LibName name 'sk4d_rrect_is_nine_patch';
class function TSkiaAPI.sk4d_rrect_is_oval; external TSkiaAPI.LibName name 'sk4d_rrect_is_oval';
class function TSkiaAPI.sk4d_rrect_is_rect; external TSkiaAPI.LibName name 'sk4d_rrect_is_rect';
class function TSkiaAPI.sk4d_rrect_is_simple; external TSkiaAPI.LibName name 'sk4d_rrect_is_simple';
class function TSkiaAPI.sk4d_rrect_is_valid; external TSkiaAPI.LibName name 'sk4d_rrect_is_valid';
class procedure TSkiaAPI.sk4d_rrect_offset; external TSkiaAPI.LibName name 'sk4d_rrect_offset';
class procedure TSkiaAPI.sk4d_rrect_set_empty; external TSkiaAPI.LibName name 'sk4d_rrect_set_empty';
class procedure TSkiaAPI.sk4d_rrect_set_nine_patch; external TSkiaAPI.LibName name 'sk4d_rrect_set_nine_patch';
class procedure TSkiaAPI.sk4d_rrect_set_oval; external TSkiaAPI.LibName name 'sk4d_rrect_set_oval';
class procedure TSkiaAPI.sk4d_rrect_set_rect; external TSkiaAPI.LibName name 'sk4d_rrect_set_rect';
class procedure TSkiaAPI.sk4d_rrect_set_rect2; external TSkiaAPI.LibName name 'sk4d_rrect_set_rect2';
class procedure TSkiaAPI.sk4d_rrect_set_rect3; external TSkiaAPI.LibName name 'sk4d_rrect_set_rect3';
class function TSkiaAPI.sk4d_rrect_transform; external TSkiaAPI.LibName name 'sk4d_rrect_transform';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_runtimeeffect.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_runtimeeffect_get_child_count := GetProcAddress(FLibHandle, 'sk4d_runtimeeffect_get_child_count');
sk4d_runtimeeffect_get_child_name := GetProcAddress(FLibHandle, 'sk4d_runtimeeffect_get_child_name');
sk4d_runtimeeffect_get_child_type := GetProcAddress(FLibHandle, 'sk4d_runtimeeffect_get_child_type');
sk4d_runtimeeffect_get_uniform_count := GetProcAddress(FLibHandle, 'sk4d_runtimeeffect_get_uniform_count');
sk4d_runtimeeffect_get_uniform_data_size := GetProcAddress(FLibHandle, 'sk4d_runtimeeffect_get_uniform_data_size');
sk4d_runtimeeffect_get_uniform_name := GetProcAddress(FLibHandle, 'sk4d_runtimeeffect_get_uniform_name');
sk4d_runtimeeffect_get_uniform_offset := GetProcAddress(FLibHandle, 'sk4d_runtimeeffect_get_uniform_offset');
sk4d_runtimeeffect_get_uniform_type := GetProcAddress(FLibHandle, 'sk4d_runtimeeffect_get_uniform_type');
sk4d_runtimeeffect_get_uniform_type_count := GetProcAddress(FLibHandle, 'sk4d_runtimeeffect_get_uniform_type_count');
sk4d_runtimeeffect_index_of_child := GetProcAddress(FLibHandle, 'sk4d_runtimeeffect_index_of_child');
sk4d_runtimeeffect_index_of_uniform := GetProcAddress(FLibHandle, 'sk4d_runtimeeffect_index_of_uniform');
sk4d_runtimeeffect_make_blender := GetProcAddress(FLibHandle, 'sk4d_runtimeeffect_make_blender');
sk4d_runtimeeffect_make_color_filter := GetProcAddress(FLibHandle, 'sk4d_runtimeeffect_make_color_filter');
sk4d_runtimeeffect_make_for_blender := GetProcAddress(FLibHandle, 'sk4d_runtimeeffect_make_for_blender');
sk4d_runtimeeffect_make_for_color_filter := GetProcAddress(FLibHandle, 'sk4d_runtimeeffect_make_for_color_filter');
sk4d_runtimeeffect_make_for_shader := GetProcAddress(FLibHandle, 'sk4d_runtimeeffect_make_for_shader');
sk4d_runtimeeffect_make_shader := GetProcAddress(FLibHandle, 'sk4d_runtimeeffect_make_shader');
{$ELSE}
class function TSkiaAPI.sk4d_runtimeeffect_get_child_count; external TSkiaAPI.LibName name 'sk4d_runtimeeffect_get_child_count';
class function TSkiaAPI.sk4d_runtimeeffect_get_child_name; external TSkiaAPI.LibName name 'sk4d_runtimeeffect_get_child_name';
class function TSkiaAPI.sk4d_runtimeeffect_get_child_type; external TSkiaAPI.LibName name 'sk4d_runtimeeffect_get_child_type';
class function TSkiaAPI.sk4d_runtimeeffect_get_uniform_count; external TSkiaAPI.LibName name 'sk4d_runtimeeffect_get_uniform_count';
class function TSkiaAPI.sk4d_runtimeeffect_get_uniform_data_size; external TSkiaAPI.LibName name 'sk4d_runtimeeffect_get_uniform_data_size';
class function TSkiaAPI.sk4d_runtimeeffect_get_uniform_name; external TSkiaAPI.LibName name 'sk4d_runtimeeffect_get_uniform_name';
class function TSkiaAPI.sk4d_runtimeeffect_get_uniform_offset; external TSkiaAPI.LibName name 'sk4d_runtimeeffect_get_uniform_offset';
class function TSkiaAPI.sk4d_runtimeeffect_get_uniform_type; external TSkiaAPI.LibName name 'sk4d_runtimeeffect_get_uniform_type';
class function TSkiaAPI.sk4d_runtimeeffect_get_uniform_type_count; external TSkiaAPI.LibName name 'sk4d_runtimeeffect_get_uniform_type_count';
class function TSkiaAPI.sk4d_runtimeeffect_index_of_child; external TSkiaAPI.LibName name 'sk4d_runtimeeffect_index_of_child';
class function TSkiaAPI.sk4d_runtimeeffect_index_of_uniform; external TSkiaAPI.LibName name 'sk4d_runtimeeffect_index_of_uniform';
class function TSkiaAPI.sk4d_runtimeeffect_make_blender; external TSkiaAPI.LibName name 'sk4d_runtimeeffect_make_blender';
class function TSkiaAPI.sk4d_runtimeeffect_make_color_filter; external TSkiaAPI.LibName name 'sk4d_runtimeeffect_make_color_filter';
class function TSkiaAPI.sk4d_runtimeeffect_make_for_blender; external TSkiaAPI.LibName name 'sk4d_runtimeeffect_make_for_blender';
class function TSkiaAPI.sk4d_runtimeeffect_make_for_color_filter; external TSkiaAPI.LibName name 'sk4d_runtimeeffect_make_for_color_filter';
class function TSkiaAPI.sk4d_runtimeeffect_make_for_shader; external TSkiaAPI.LibName name 'sk4d_runtimeeffect_make_for_shader';
class function TSkiaAPI.sk4d_runtimeeffect_make_shader; external TSkiaAPI.LibName name 'sk4d_runtimeeffect_make_shader';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_shader.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_shader_make_blend := GetProcAddress(FLibHandle, 'sk4d_shader_make_blend');
sk4d_shader_make_color := GetProcAddress(FLibHandle, 'sk4d_shader_make_color');
sk4d_shader_make_color2 := GetProcAddress(FLibHandle, 'sk4d_shader_make_color2');
sk4d_shader_make_gradient_linear := GetProcAddress(FLibHandle, 'sk4d_shader_make_gradient_linear');
sk4d_shader_make_gradient_linear2 := GetProcAddress(FLibHandle, 'sk4d_shader_make_gradient_linear2');
sk4d_shader_make_gradient_radial := GetProcAddress(FLibHandle, 'sk4d_shader_make_gradient_radial');
sk4d_shader_make_gradient_radial2 := GetProcAddress(FLibHandle, 'sk4d_shader_make_gradient_radial2');
sk4d_shader_make_gradient_sweep := GetProcAddress(FLibHandle, 'sk4d_shader_make_gradient_sweep');
sk4d_shader_make_gradient_sweep2 := GetProcAddress(FLibHandle, 'sk4d_shader_make_gradient_sweep2');
sk4d_shader_make_gradient_two_point_conical := GetProcAddress(FLibHandle, 'sk4d_shader_make_gradient_two_point_conical');
sk4d_shader_make_gradient_two_point_conical2 := GetProcAddress(FLibHandle, 'sk4d_shader_make_gradient_two_point_conical2');
sk4d_shader_make_perlin_noise_fractal_noise := GetProcAddress(FLibHandle, 'sk4d_shader_make_perlin_noise_fractal_noise');
sk4d_shader_make_perlin_noise_turbulence := GetProcAddress(FLibHandle, 'sk4d_shader_make_perlin_noise_turbulence');
sk4d_shader_make_with_color_filter := GetProcAddress(FLibHandle, 'sk4d_shader_make_with_color_filter');
sk4d_shader_make_with_local_matrix := GetProcAddress(FLibHandle, 'sk4d_shader_make_with_local_matrix');
{$ELSE}
class function TSkiaAPI.sk4d_shader_make_blend; external TSkiaAPI.LibName name 'sk4d_shader_make_blend';
class function TSkiaAPI.sk4d_shader_make_color; external TSkiaAPI.LibName name 'sk4d_shader_make_color';
class function TSkiaAPI.sk4d_shader_make_color2; external TSkiaAPI.LibName name 'sk4d_shader_make_color2';
class function TSkiaAPI.sk4d_shader_make_gradient_linear; external TSkiaAPI.LibName name 'sk4d_shader_make_gradient_linear';
class function TSkiaAPI.sk4d_shader_make_gradient_linear2; external TSkiaAPI.LibName name 'sk4d_shader_make_gradient_linear2';
class function TSkiaAPI.sk4d_shader_make_gradient_radial; external TSkiaAPI.LibName name 'sk4d_shader_make_gradient_radial';
class function TSkiaAPI.sk4d_shader_make_gradient_radial2; external TSkiaAPI.LibName name 'sk4d_shader_make_gradient_radial2';
class function TSkiaAPI.sk4d_shader_make_gradient_sweep; external TSkiaAPI.LibName name 'sk4d_shader_make_gradient_sweep';
class function TSkiaAPI.sk4d_shader_make_gradient_sweep2; external TSkiaAPI.LibName name 'sk4d_shader_make_gradient_sweep2';
class function TSkiaAPI.sk4d_shader_make_gradient_two_point_conical; external TSkiaAPI.LibName name 'sk4d_shader_make_gradient_two_point_conical';
class function TSkiaAPI.sk4d_shader_make_gradient_two_point_conical2; external TSkiaAPI.LibName name 'sk4d_shader_make_gradient_two_point_conical2';
class function TSkiaAPI.sk4d_shader_make_perlin_noise_fractal_noise; external TSkiaAPI.LibName name 'sk4d_shader_make_perlin_noise_fractal_noise';
class function TSkiaAPI.sk4d_shader_make_perlin_noise_turbulence; external TSkiaAPI.LibName name 'sk4d_shader_make_perlin_noise_turbulence';
class function TSkiaAPI.sk4d_shader_make_with_color_filter; external TSkiaAPI.LibName name 'sk4d_shader_make_with_color_filter';
class function TSkiaAPI.sk4d_shader_make_with_local_matrix; external TSkiaAPI.LibName name 'sk4d_shader_make_with_local_matrix';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_stream.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_streamadapter_create := GetProcAddress(FLibHandle, 'sk4d_streamadapter_create');
sk4d_streamadapter_destroy := GetProcAddress(FLibHandle, 'sk4d_streamadapter_destroy');
sk4d_streamadapter_set_procs := GetProcAddress(FLibHandle, 'sk4d_streamadapter_set_procs');
sk4d_wstreamadapter_create := GetProcAddress(FLibHandle, 'sk4d_wstreamadapter_create');
sk4d_wstreamadapter_destroy := GetProcAddress(FLibHandle, 'sk4d_wstreamadapter_destroy');
sk4d_wstreamadapter_set_procs := GetProcAddress(FLibHandle, 'sk4d_wstreamadapter_set_procs');
{$ELSE}
class function TSkiaAPI.sk4d_streamadapter_create; external TSkiaAPI.LibName name 'sk4d_streamadapter_create';
class procedure TSkiaAPI.sk4d_streamadapter_destroy; external TSkiaAPI.LibName name 'sk4d_streamadapter_destroy';
class procedure TSkiaAPI.sk4d_streamadapter_set_procs; external TSkiaAPI.LibName name 'sk4d_streamadapter_set_procs';
class function TSkiaAPI.sk4d_wstreamadapter_create; external TSkiaAPI.LibName name 'sk4d_wstreamadapter_create';
class procedure TSkiaAPI.sk4d_wstreamadapter_destroy; external TSkiaAPI.LibName name 'sk4d_wstreamadapter_destroy';
class procedure TSkiaAPI.sk4d_wstreamadapter_set_procs; external TSkiaAPI.LibName name 'sk4d_wstreamadapter_set_procs';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_string.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_string_create := GetProcAddress(FLibHandle, 'sk4d_string_create');
sk4d_string_destroy := GetProcAddress(FLibHandle, 'sk4d_string_destroy');
sk4d_string_get_text := GetProcAddress(FLibHandle, 'sk4d_string_get_text');
sk4d_string_set_text := GetProcAddress(FLibHandle, 'sk4d_string_set_text');
{$ELSE}
class function TSkiaAPI.sk4d_string_create; external TSkiaAPI.LibName name 'sk4d_string_create';
class procedure TSkiaAPI.sk4d_string_destroy; external TSkiaAPI.LibName name 'sk4d_string_destroy';
class function TSkiaAPI.sk4d_string_get_text; external TSkiaAPI.LibName name 'sk4d_string_get_text';
class procedure TSkiaAPI.sk4d_string_set_text; external TSkiaAPI.LibName name 'sk4d_string_set_text';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_surface.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_surface_draw := GetProcAddress(FLibHandle, 'sk4d_surface_draw');
sk4d_surface_flush := GetProcAddress(FLibHandle, 'sk4d_surface_flush');
sk4d_surface_flush_and_submit := GetProcAddress(FLibHandle, 'sk4d_surface_flush_and_submit');
sk4d_surface_get_canvas := GetProcAddress(FLibHandle, 'sk4d_surface_get_canvas');
sk4d_surface_get_props := GetProcAddress(FLibHandle, 'sk4d_surface_get_props');
sk4d_surface_make_from_ca_metal_layer := GetProcAddress(FLibHandle, 'sk4d_surface_make_from_ca_metal_layer');
sk4d_surface_make_from_mtk_view := GetProcAddress(FLibHandle, 'sk4d_surface_make_from_mtk_view');
sk4d_surface_make_from_render_target := GetProcAddress(FLibHandle, 'sk4d_surface_make_from_render_target');
sk4d_surface_make_from_texture := GetProcAddress(FLibHandle, 'sk4d_surface_make_from_texture');
sk4d_surface_make_image_snapshot := GetProcAddress(FLibHandle, 'sk4d_surface_make_image_snapshot');
sk4d_surface_make_image_snapshot2 := GetProcAddress(FLibHandle, 'sk4d_surface_make_image_snapshot2');
sk4d_surface_make_raster := GetProcAddress(FLibHandle, 'sk4d_surface_make_raster');
sk4d_surface_make_raster_direct := GetProcAddress(FLibHandle, 'sk4d_surface_make_raster_direct');
sk4d_surface_make_render_target := GetProcAddress(FLibHandle, 'sk4d_surface_make_render_target');
sk4d_surface_peek_pixels := GetProcAddress(FLibHandle, 'sk4d_surface_peek_pixels');
sk4d_surface_read_pixels := GetProcAddress(FLibHandle, 'sk4d_surface_read_pixels');
{$ELSE}
class procedure TSkiaAPI.sk4d_surface_draw; external TSkiaAPI.LibName name 'sk4d_surface_draw';
class procedure TSkiaAPI.sk4d_surface_flush; external TSkiaAPI.LibName name 'sk4d_surface_flush';
class procedure TSkiaAPI.sk4d_surface_flush_and_submit; external TSkiaAPI.LibName name 'sk4d_surface_flush_and_submit';
class function TSkiaAPI.sk4d_surface_get_canvas; external TSkiaAPI.LibName name 'sk4d_surface_get_canvas';
class procedure TSkiaAPI.sk4d_surface_get_props; external TSkiaAPI.LibName name 'sk4d_surface_get_props';
class function TSkiaAPI.sk4d_surface_make_from_ca_metal_layer; external TSkiaAPI.LibName name 'sk4d_surface_make_from_ca_metal_layer';
class function TSkiaAPI.sk4d_surface_make_from_mtk_view; external TSkiaAPI.LibName name 'sk4d_surface_make_from_mtk_view';
class function TSkiaAPI.sk4d_surface_make_from_render_target; external TSkiaAPI.LibName name 'sk4d_surface_make_from_render_target';
class function TSkiaAPI.sk4d_surface_make_from_texture; external TSkiaAPI.LibName name 'sk4d_surface_make_from_texture';
class function TSkiaAPI.sk4d_surface_make_image_snapshot; external TSkiaAPI.LibName name 'sk4d_surface_make_image_snapshot';
class function TSkiaAPI.sk4d_surface_make_image_snapshot2; external TSkiaAPI.LibName name 'sk4d_surface_make_image_snapshot2';
class function TSkiaAPI.sk4d_surface_make_raster; external TSkiaAPI.LibName name 'sk4d_surface_make_raster';
class function TSkiaAPI.sk4d_surface_make_raster_direct; external TSkiaAPI.LibName name 'sk4d_surface_make_raster_direct';
class function TSkiaAPI.sk4d_surface_make_render_target; external TSkiaAPI.LibName name 'sk4d_surface_make_render_target';
class function TSkiaAPI.sk4d_surface_peek_pixels; external TSkiaAPI.LibName name 'sk4d_surface_peek_pixels';
class function TSkiaAPI.sk4d_surface_read_pixels; external TSkiaAPI.LibName name 'sk4d_surface_read_pixels';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_svgcanvas.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_svgcanvas_make := GetProcAddress(FLibHandle, 'sk4d_svgcanvas_make');
{$ELSE}
class function TSkiaAPI.sk4d_svgcanvas_make; external TSkiaAPI.LibName name 'sk4d_svgcanvas_make';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_textblob.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_textblob_get_intercepts := GetProcAddress(FLibHandle, 'sk4d_textblob_get_intercepts');
sk4d_textblob_make_from_text := GetProcAddress(FLibHandle, 'sk4d_textblob_make_from_text');
sk4d_textblob_make_from_text_horizontally_positioned := GetProcAddress(FLibHandle, 'sk4d_textblob_make_from_text_horizontally_positioned');
sk4d_textblob_make_from_text_positioned := GetProcAddress(FLibHandle, 'sk4d_textblob_make_from_text_positioned');
sk4d_textblob_make_from_text_transform := GetProcAddress(FLibHandle, 'sk4d_textblob_make_from_text_transform');
sk4d_textblob_ref := GetProcAddress(FLibHandle, 'sk4d_textblob_ref');
sk4d_textblob_unref := GetProcAddress(FLibHandle, 'sk4d_textblob_unref');
{$ELSE}
class function TSkiaAPI.sk4d_textblob_get_intercepts; external TSkiaAPI.LibName name 'sk4d_textblob_get_intercepts';
class function TSkiaAPI.sk4d_textblob_make_from_text; external TSkiaAPI.LibName name 'sk4d_textblob_make_from_text';
class function TSkiaAPI.sk4d_textblob_make_from_text_horizontally_positioned; external TSkiaAPI.LibName name 'sk4d_textblob_make_from_text_horizontally_positioned';
class function TSkiaAPI.sk4d_textblob_make_from_text_positioned; external TSkiaAPI.LibName name 'sk4d_textblob_make_from_text_positioned';
class function TSkiaAPI.sk4d_textblob_make_from_text_transform; external TSkiaAPI.LibName name 'sk4d_textblob_make_from_text_transform';
class procedure TSkiaAPI.sk4d_textblob_ref; external TSkiaAPI.LibName name 'sk4d_textblob_ref';
class procedure TSkiaAPI.sk4d_textblob_unref; external TSkiaAPI.LibName name 'sk4d_textblob_unref';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_tracememorydump.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_tracememorydumpbaseclass_create := GetProcAddress(FLibHandle, 'sk4d_tracememorydumpbaseclass_create');
sk4d_tracememorydumpbaseclass_destroy := GetProcAddress(FLibHandle, 'sk4d_tracememorydumpbaseclass_destroy');
sk4d_tracememorydumpbaseclass_set_procs := GetProcAddress(FLibHandle, 'sk4d_tracememorydumpbaseclass_set_procs');
{$ELSE}
class function TSkiaAPI.sk4d_tracememorydumpbaseclass_create; external TSkiaAPI.LibName name 'sk4d_tracememorydumpbaseclass_create';
class procedure TSkiaAPI.sk4d_tracememorydumpbaseclass_destroy; external TSkiaAPI.LibName name 'sk4d_tracememorydumpbaseclass_destroy';
class procedure TSkiaAPI.sk4d_tracememorydumpbaseclass_set_procs; external TSkiaAPI.LibName name 'sk4d_tracememorydumpbaseclass_set_procs';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_typeface.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_typeface_get_family_name := GetProcAddress(FLibHandle, 'sk4d_typeface_get_family_name');
sk4d_typeface_get_slant := GetProcAddress(FLibHandle, 'sk4d_typeface_get_slant');
sk4d_typeface_get_style := GetProcAddress(FLibHandle, 'sk4d_typeface_get_style');
sk4d_typeface_get_weight := GetProcAddress(FLibHandle, 'sk4d_typeface_get_weight');
sk4d_typeface_get_width := GetProcAddress(FLibHandle, 'sk4d_typeface_get_width');
sk4d_typeface_make_default := GetProcAddress(FLibHandle, 'sk4d_typeface_make_default');
sk4d_typeface_make_from_file := GetProcAddress(FLibHandle, 'sk4d_typeface_make_from_file');
sk4d_typeface_make_from_stream := GetProcAddress(FLibHandle, 'sk4d_typeface_make_from_stream');
sk4d_typeface_make_from_name := GetProcAddress(FLibHandle, 'sk4d_typeface_make_from_name');
{$ELSE}
class function TSkiaAPI.sk4d_typeface_get_family_name; external TSkiaAPI.LibName name 'sk4d_typeface_get_family_name';
class function TSkiaAPI.sk4d_typeface_get_slant; external TSkiaAPI.LibName name 'sk4d_typeface_get_slant';
class procedure TSkiaAPI.sk4d_typeface_get_style; external TSkiaAPI.LibName name 'sk4d_typeface_get_style';
class function TSkiaAPI.sk4d_typeface_get_weight; external TSkiaAPI.LibName name 'sk4d_typeface_get_weight';
class function TSkiaAPI.sk4d_typeface_get_width; external TSkiaAPI.LibName name 'sk4d_typeface_get_width';
class function TSkiaAPI.sk4d_typeface_make_default; external TSkiaAPI.LibName name 'sk4d_typeface_make_default';
class function TSkiaAPI.sk4d_typeface_make_from_file; external TSkiaAPI.LibName name 'sk4d_typeface_make_from_file';
class function TSkiaAPI.sk4d_typeface_make_from_stream; external TSkiaAPI.LibName name 'sk4d_typeface_make_from_stream';
class function TSkiaAPI.sk4d_typeface_make_from_name; external TSkiaAPI.LibName name 'sk4d_typeface_make_from_name';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_version.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_version_get_build := GetProcAddress(FLibHandle, 'sk4d_version_get_build');
sk4d_version_get_major := GetProcAddress(FLibHandle, 'sk4d_version_get_major');
sk4d_version_get_milestone := GetProcAddress(FLibHandle, 'sk4d_version_get_milestone');
sk4d_version_get_minor := GetProcAddress(FLibHandle, 'sk4d_version_get_minor');
{$ELSE}
class function TSkiaAPI.sk4d_version_get_build; external TSkiaAPI.LibName name 'sk4d_version_get_build';
class function TSkiaAPI.sk4d_version_get_major; external TSkiaAPI.LibName name 'sk4d_version_get_major';
class function TSkiaAPI.sk4d_version_get_milestone; external TSkiaAPI.LibName name 'sk4d_version_get_milestone';
class function TSkiaAPI.sk4d_version_get_minor; external TSkiaAPI.LibName name 'sk4d_version_get_minor';
{$ENDIF}
{$ENDREGION}
{$REGION 'include/c/sk4d_vertices.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_vertices_make_copy := GetProcAddress(FLibHandle, 'sk4d_vertices_make_copy');
sk4d_vertices_ref := GetProcAddress(FLibHandle, 'sk4d_vertices_ref');
sk4d_vertices_unref := GetProcAddress(FLibHandle, 'sk4d_vertices_unref');
{$ELSE}
class function TSkiaAPI.sk4d_vertices_make_copy; external TSkiaAPI.LibName name 'sk4d_vertices_make_copy';
class procedure TSkiaAPI.sk4d_vertices_ref; external TSkiaAPI.LibName name 'sk4d_vertices_ref';
class procedure TSkiaAPI.sk4d_vertices_unref; external TSkiaAPI.LibName name 'sk4d_vertices_unref';
{$ENDIF}
{$ENDREGION}
{$REGION 'modules/particles/include/sk4d_particleeffect.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_particleeffect_get_position := GetProcAddress(FLibHandle, 'sk4d_particleeffect_get_position');
sk4d_particleeffect_get_rate := GetProcAddress(FLibHandle, 'sk4d_particleeffect_get_rate');
sk4d_particleeffect_get_uniform := GetProcAddress(FLibHandle, 'sk4d_particleeffect_get_uniform');
sk4d_particleeffect_get_uniform_count := GetProcAddress(FLibHandle, 'sk4d_particleeffect_get_uniform_count');
sk4d_particleeffect_get_uniform_data := GetProcAddress(FLibHandle, 'sk4d_particleeffect_get_uniform_data');
sk4d_particleeffect_get_uniform_data_count := GetProcAddress(FLibHandle, 'sk4d_particleeffect_get_uniform_data_count');
sk4d_particleeffect_get_uniform_name := GetProcAddress(FLibHandle, 'sk4d_particleeffect_get_uniform_name');
sk4d_particleeffect_init := GetProcAddress(FLibHandle, 'sk4d_particleeffect_init');
sk4d_particleeffect_make_from_file := GetProcAddress(FLibHandle, 'sk4d_particleeffect_make_from_file');
sk4d_particleeffect_make_from_stream := GetProcAddress(FLibHandle, 'sk4d_particleeffect_make_from_stream');
sk4d_particleeffect_render := GetProcAddress(FLibHandle, 'sk4d_particleeffect_render');
sk4d_particleeffect_set_position := GetProcAddress(FLibHandle, 'sk4d_particleeffect_set_position');
sk4d_particleeffect_set_rate := GetProcAddress(FLibHandle, 'sk4d_particleeffect_set_rate');
sk4d_particleeffect_set_uniform := GetProcAddress(FLibHandle, 'sk4d_particleeffect_set_uniform');
sk4d_particleeffect_start := GetProcAddress(FLibHandle, 'sk4d_particleeffect_start');
sk4d_particleeffect_update := GetProcAddress(FLibHandle, 'sk4d_particleeffect_update');
{$ELSE}
class procedure TSkiaAPI.sk4d_particleeffect_get_position; external TSkiaAPI.LibName name 'sk4d_particleeffect_get_position';
class function TSkiaAPI.sk4d_particleeffect_get_rate; external TSkiaAPI.LibName name 'sk4d_particleeffect_get_rate';
class procedure TSkiaAPI.sk4d_particleeffect_get_uniform; external TSkiaAPI.LibName name 'sk4d_particleeffect_get_uniform';
class function TSkiaAPI.sk4d_particleeffect_get_uniform_count; external TSkiaAPI.LibName name 'sk4d_particleeffect_get_uniform_count';
class function TSkiaAPI.sk4d_particleeffect_get_uniform_data; external TSkiaAPI.LibName name 'sk4d_particleeffect_get_uniform_data';
class function TSkiaAPI.sk4d_particleeffect_get_uniform_data_count; external TSkiaAPI.LibName name 'sk4d_particleeffect_get_uniform_data_count';
class function TSkiaAPI.sk4d_particleeffect_get_uniform_name; external TSkiaAPI.LibName name 'sk4d_particleeffect_get_uniform_name';
class procedure TSkiaAPI.sk4d_particleeffect_init; external TSkiaAPI.LibName name 'sk4d_particleeffect_init';
class function TSkiaAPI.sk4d_particleeffect_make_from_file; external TSkiaAPI.LibName name 'sk4d_particleeffect_make_from_file';
class function TSkiaAPI.sk4d_particleeffect_make_from_stream; external TSkiaAPI.LibName name 'sk4d_particleeffect_make_from_stream';
class procedure TSkiaAPI.sk4d_particleeffect_render; external TSkiaAPI.LibName name 'sk4d_particleeffect_render';
class procedure TSkiaAPI.sk4d_particleeffect_set_position; external TSkiaAPI.LibName name 'sk4d_particleeffect_set_position';
class procedure TSkiaAPI.sk4d_particleeffect_set_rate; external TSkiaAPI.LibName name 'sk4d_particleeffect_set_rate';
class function TSkiaAPI.sk4d_particleeffect_set_uniform; external TSkiaAPI.LibName name 'sk4d_particleeffect_set_uniform';
class procedure TSkiaAPI.sk4d_particleeffect_start; external TSkiaAPI.LibName name 'sk4d_particleeffect_start';
class procedure TSkiaAPI.sk4d_particleeffect_update; external TSkiaAPI.LibName name 'sk4d_particleeffect_update';
{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skottie/include/sk4d_skottie.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_skottieanimation_get_duration := GetProcAddress(FLibHandle, 'sk4d_skottieanimation_get_duration');
sk4d_skottieanimation_get_fps := GetProcAddress(FLibHandle, 'sk4d_skottieanimation_get_fps');
sk4d_skottieanimation_get_in_point := GetProcAddress(FLibHandle, 'sk4d_skottieanimation_get_in_point');
sk4d_skottieanimation_get_out_point := GetProcAddress(FLibHandle, 'sk4d_skottieanimation_get_out_point');
sk4d_skottieanimation_get_size := GetProcAddress(FLibHandle, 'sk4d_skottieanimation_get_size');
sk4d_skottieanimation_get_version := GetProcAddress(FLibHandle, 'sk4d_skottieanimation_get_version');
sk4d_skottieanimation_make_from_file := GetProcAddress(FLibHandle, 'sk4d_skottieanimation_make_from_file');
sk4d_skottieanimation_make_from_stream := GetProcAddress(FLibHandle, 'sk4d_skottieanimation_make_from_stream');
sk4d_skottieanimation_ref := GetProcAddress(FLibHandle, 'sk4d_skottieanimation_ref');
sk4d_skottieanimation_render := GetProcAddress(FLibHandle, 'sk4d_skottieanimation_render');
sk4d_skottieanimation_seek_frame := GetProcAddress(FLibHandle, 'sk4d_skottieanimation_seek_frame');
sk4d_skottieanimation_seek_frame_time := GetProcAddress(FLibHandle, 'sk4d_skottieanimation_seek_frame_time');
sk4d_skottieanimation_unref := GetProcAddress(FLibHandle, 'sk4d_skottieanimation_unref');
{$ELSE}
class function TSkiaAPI.sk4d_skottieanimation_get_duration; external TSkiaAPI.LibName name 'sk4d_skottieanimation_get_duration';
class function TSkiaAPI.sk4d_skottieanimation_get_fps; external TSkiaAPI.LibName name 'sk4d_skottieanimation_get_fps';
class function TSkiaAPI.sk4d_skottieanimation_get_in_point; external TSkiaAPI.LibName name 'sk4d_skottieanimation_get_in_point';
class function TSkiaAPI.sk4d_skottieanimation_get_out_point; external TSkiaAPI.LibName name 'sk4d_skottieanimation_get_out_point';
class procedure TSkiaAPI.sk4d_skottieanimation_get_size; external TSkiaAPI.LibName name 'sk4d_skottieanimation_get_size';
class function TSkiaAPI.sk4d_skottieanimation_get_version; external TSkiaAPI.LibName name 'sk4d_skottieanimation_get_version';
class function TSkiaAPI.sk4d_skottieanimation_make_from_file; external TSkiaAPI.LibName name 'sk4d_skottieanimation_make_from_file';
class function TSkiaAPI.sk4d_skottieanimation_make_from_stream; external TSkiaAPI.LibName name 'sk4d_skottieanimation_make_from_stream';
class procedure TSkiaAPI.sk4d_skottieanimation_ref; external TSkiaAPI.LibName name 'sk4d_skottieanimation_ref';
class procedure TSkiaAPI.sk4d_skottieanimation_render; external TSkiaAPI.LibName name 'sk4d_skottieanimation_render';
class procedure TSkiaAPI.sk4d_skottieanimation_seek_frame; external TSkiaAPI.LibName name 'sk4d_skottieanimation_seek_frame';
class procedure TSkiaAPI.sk4d_skottieanimation_seek_frame_time; external TSkiaAPI.LibName name 'sk4d_skottieanimation_seek_frame_time';
class procedure TSkiaAPI.sk4d_skottieanimation_unref; external TSkiaAPI.LibName name 'sk4d_skottieanimation_unref';
{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skparagraph/include/sk4d_paragraph.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_paragraph_destroy := GetProcAddress(FLibHandle, 'sk4d_paragraph_destroy');
sk4d_paragraph_did_exceed_max_lines := GetProcAddress(FLibHandle, 'sk4d_paragraph_did_exceed_max_lines');
sk4d_paragraph_get_alphabetic_baseline := GetProcAddress(FLibHandle, 'sk4d_paragraph_get_alphabetic_baseline');
sk4d_paragraph_get_glyph_position_at_coordinate := GetProcAddress(FLibHandle, 'sk4d_paragraph_get_glyph_position_at_coordinate');
sk4d_paragraph_get_height := GetProcAddress(FLibHandle, 'sk4d_paragraph_get_height');
sk4d_paragraph_get_ideographic_baseline := GetProcAddress(FLibHandle, 'sk4d_paragraph_get_ideographic_baseline');
sk4d_paragraph_get_line_metrics := GetProcAddress(FLibHandle, 'sk4d_paragraph_get_line_metrics');
sk4d_paragraph_get_longest_line := GetProcAddress(FLibHandle, 'sk4d_paragraph_get_longest_line');
sk4d_paragraph_get_max_intrinsic_width := GetProcAddress(FLibHandle, 'sk4d_paragraph_get_max_intrinsic_width');
sk4d_paragraph_get_max_width := GetProcAddress(FLibHandle, 'sk4d_paragraph_get_max_width');
sk4d_paragraph_get_min_intrinsic_width := GetProcAddress(FLibHandle, 'sk4d_paragraph_get_min_intrinsic_width');
sk4d_paragraph_get_rects_for_placeholders := GetProcAddress(FLibHandle, 'sk4d_paragraph_get_rects_for_placeholders');
sk4d_paragraph_get_rects_for_range := GetProcAddress(FLibHandle, 'sk4d_paragraph_get_rects_for_range');
sk4d_paragraph_get_word_boundary := GetProcAddress(FLibHandle, 'sk4d_paragraph_get_word_boundary');
sk4d_paragraph_layout := GetProcAddress(FLibHandle, 'sk4d_paragraph_layout');
sk4d_paragraph_paint := GetProcAddress(FLibHandle, 'sk4d_paragraph_paint');
sk4d_paragraph_to_path := GetProcAddress(FLibHandle, 'sk4d_paragraph_to_path');
{$ELSE}
class procedure TSkiaAPI.sk4d_paragraph_destroy; external TSkiaAPI.LibName name 'sk4d_paragraph_destroy';
class function TSkiaAPI.sk4d_paragraph_did_exceed_max_lines; external TSkiaAPI.LibName name 'sk4d_paragraph_did_exceed_max_lines';
class function TSkiaAPI.sk4d_paragraph_get_alphabetic_baseline; external TSkiaAPI.LibName name 'sk4d_paragraph_get_alphabetic_baseline';
class procedure TSkiaAPI.sk4d_paragraph_get_glyph_position_at_coordinate; external TSkiaAPI.LibName name 'sk4d_paragraph_get_glyph_position_at_coordinate';
class function TSkiaAPI.sk4d_paragraph_get_height; external TSkiaAPI.LibName name 'sk4d_paragraph_get_height';
class function TSkiaAPI.sk4d_paragraph_get_ideographic_baseline; external TSkiaAPI.LibName name 'sk4d_paragraph_get_ideographic_baseline';
class function TSkiaAPI.sk4d_paragraph_get_line_metrics; external TSkiaAPI.LibName name 'sk4d_paragraph_get_line_metrics';
class function TSkiaAPI.sk4d_paragraph_get_longest_line; external TSkiaAPI.LibName name 'sk4d_paragraph_get_longest_line';
class function TSkiaAPI.sk4d_paragraph_get_max_intrinsic_width; external TSkiaAPI.LibName name 'sk4d_paragraph_get_max_intrinsic_width';
class function TSkiaAPI.sk4d_paragraph_get_max_width; external TSkiaAPI.LibName name 'sk4d_paragraph_get_max_width';
class function TSkiaAPI.sk4d_paragraph_get_min_intrinsic_width; external TSkiaAPI.LibName name 'sk4d_paragraph_get_min_intrinsic_width';
class function TSkiaAPI.sk4d_paragraph_get_rects_for_placeholders; external TSkiaAPI.LibName name 'sk4d_paragraph_get_rects_for_placeholders';
class function TSkiaAPI.sk4d_paragraph_get_rects_for_range; external TSkiaAPI.LibName name 'sk4d_paragraph_get_rects_for_range';
class procedure TSkiaAPI.sk4d_paragraph_get_word_boundary; external TSkiaAPI.LibName name 'sk4d_paragraph_get_word_boundary';
class procedure TSkiaAPI.sk4d_paragraph_layout; external TSkiaAPI.LibName name 'sk4d_paragraph_layout';
class procedure TSkiaAPI.sk4d_paragraph_paint; external TSkiaAPI.LibName name 'sk4d_paragraph_paint';
class function TSkiaAPI.sk4d_paragraph_to_path; external TSkiaAPI.LibName name 'sk4d_paragraph_to_path';
{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skparagraph/include/sk4d_paragraphbuilder.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_paragraphbuilder_add_placeholder := GetProcAddress(FLibHandle, 'sk4d_paragraphbuilder_add_placeholder');
sk4d_paragraphbuilder_add_text := GetProcAddress(FLibHandle, 'sk4d_paragraphbuilder_add_text');
sk4d_paragraphbuilder_build := GetProcAddress(FLibHandle, 'sk4d_paragraphbuilder_build');
sk4d_paragraphbuilder_create := GetProcAddress(FLibHandle, 'sk4d_paragraphbuilder_create');
sk4d_paragraphbuilder_create2 := GetProcAddress(FLibHandle, 'sk4d_paragraphbuilder_create2');
sk4d_paragraphbuilder_destroy := GetProcAddress(FLibHandle, 'sk4d_paragraphbuilder_destroy');
sk4d_paragraphbuilder_pop := GetProcAddress(FLibHandle, 'sk4d_paragraphbuilder_pop');
sk4d_paragraphbuilder_push_style := GetProcAddress(FLibHandle, 'sk4d_paragraphbuilder_push_style');
{$ELSE}
class procedure TSkiaAPI.sk4d_paragraphbuilder_add_placeholder; external TSkiaAPI.LibName name 'sk4d_paragraphbuilder_add_placeholder';
class procedure TSkiaAPI.sk4d_paragraphbuilder_add_text; external TSkiaAPI.LibName name 'sk4d_paragraphbuilder_add_text';
class function TSkiaAPI.sk4d_paragraphbuilder_build; external TSkiaAPI.LibName name 'sk4d_paragraphbuilder_build';
class function TSkiaAPI.sk4d_paragraphbuilder_create; external TSkiaAPI.LibName name 'sk4d_paragraphbuilder_create';
class function TSkiaAPI.sk4d_paragraphbuilder_create2; external TSkiaAPI.LibName name 'sk4d_paragraphbuilder_create2';
class procedure TSkiaAPI.sk4d_paragraphbuilder_destroy; external TSkiaAPI.LibName name 'sk4d_paragraphbuilder_destroy';
class procedure TSkiaAPI.sk4d_paragraphbuilder_pop; external TSkiaAPI.LibName name 'sk4d_paragraphbuilder_pop';
class procedure TSkiaAPI.sk4d_paragraphbuilder_push_style; external TSkiaAPI.LibName name 'sk4d_paragraphbuilder_push_style';
{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skparagraph/include/sk4d_paragraphstyle.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_paragraphstyle_create := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_create');
sk4d_paragraphstyle_destroy := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_destroy');
sk4d_paragraphstyle_disable_hinting := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_disable_hinting');
sk4d_paragraphstyle_get_ellipsis := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_get_ellipsis');
sk4d_paragraphstyle_get_height := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_get_height');
sk4d_paragraphstyle_get_max_lines := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_get_max_lines');
sk4d_paragraphstyle_get_strut_style := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_get_strut_style');
sk4d_paragraphstyle_get_text_align := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_get_text_align');
sk4d_paragraphstyle_get_text_direction := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_get_text_direction');
sk4d_paragraphstyle_get_text_height_behaviors := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_get_text_height_behaviors');
sk4d_paragraphstyle_get_text_style := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_get_text_style');
sk4d_paragraphstyle_set_ellipsis := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_set_ellipsis');
sk4d_paragraphstyle_set_height := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_set_height');
sk4d_paragraphstyle_set_max_lines := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_set_max_lines');
sk4d_paragraphstyle_set_strut_style := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_set_strut_style');
sk4d_paragraphstyle_set_text_align := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_set_text_align');
sk4d_paragraphstyle_set_text_direction := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_set_text_direction');
sk4d_paragraphstyle_set_text_height_behaviors := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_set_text_height_behaviors');
sk4d_paragraphstyle_set_text_style := GetProcAddress(FLibHandle, 'sk4d_paragraphstyle_set_text_style');
sk4d_strutstyle_create := GetProcAddress(FLibHandle, 'sk4d_strutstyle_create');
sk4d_strutstyle_destroy := GetProcAddress(FLibHandle, 'sk4d_strutstyle_destroy');
sk4d_strutstyle_get_enabled := GetProcAddress(FLibHandle, 'sk4d_strutstyle_get_enabled');
sk4d_strutstyle_get_font_families := GetProcAddress(FLibHandle, 'sk4d_strutstyle_get_font_families');
sk4d_strutstyle_get_font_size := GetProcAddress(FLibHandle, 'sk4d_strutstyle_get_font_size');
sk4d_strutstyle_get_font_style := GetProcAddress(FLibHandle, 'sk4d_strutstyle_get_font_style');
sk4d_strutstyle_get_force_height := GetProcAddress(FLibHandle, 'sk4d_strutstyle_get_force_height');
sk4d_strutstyle_get_half_leading := GetProcAddress(FLibHandle, 'sk4d_strutstyle_get_half_leading');
sk4d_strutstyle_get_height_multiplier := GetProcAddress(FLibHandle, 'sk4d_strutstyle_get_height_multiplier');
sk4d_strutstyle_get_leading := GetProcAddress(FLibHandle, 'sk4d_strutstyle_get_leading');
sk4d_strutstyle_is_equal := GetProcAddress(FLibHandle, 'sk4d_strutstyle_is_equal');
sk4d_strutstyle_set_enabled := GetProcAddress(FLibHandle, 'sk4d_strutstyle_set_enabled');
sk4d_strutstyle_set_font_families := GetProcAddress(FLibHandle, 'sk4d_strutstyle_set_font_families');
sk4d_strutstyle_set_font_size := GetProcAddress(FLibHandle, 'sk4d_strutstyle_set_font_size');
sk4d_strutstyle_set_font_style := GetProcAddress(FLibHandle, 'sk4d_strutstyle_set_font_style');
sk4d_strutstyle_set_force_height := GetProcAddress(FLibHandle, 'sk4d_strutstyle_set_force_height');
sk4d_strutstyle_set_half_leading := GetProcAddress(FLibHandle, 'sk4d_strutstyle_set_half_leading');
sk4d_strutstyle_set_height_multiplier := GetProcAddress(FLibHandle, 'sk4d_strutstyle_set_height_multiplier');
sk4d_strutstyle_set_leading := GetProcAddress(FLibHandle, 'sk4d_strutstyle_set_leading');
{$ELSE}
class function TSkiaAPI.sk4d_paragraphstyle_create; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_create';
class procedure TSkiaAPI.sk4d_paragraphstyle_destroy; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_destroy';
class procedure TSkiaAPI.sk4d_paragraphstyle_disable_hinting; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_disable_hinting';
class function TSkiaAPI.sk4d_paragraphstyle_get_ellipsis; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_get_ellipsis';
class function TSkiaAPI.sk4d_paragraphstyle_get_height; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_get_height';
class function TSkiaAPI.sk4d_paragraphstyle_get_max_lines; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_get_max_lines';
class function TSkiaAPI.sk4d_paragraphstyle_get_strut_style; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_get_strut_style';
class function TSkiaAPI.sk4d_paragraphstyle_get_text_align; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_get_text_align';
class function TSkiaAPI.sk4d_paragraphstyle_get_text_direction; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_get_text_direction';
class function TSkiaAPI.sk4d_paragraphstyle_get_text_height_behaviors; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_get_text_height_behaviors';
class function TSkiaAPI.sk4d_paragraphstyle_get_text_style; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_get_text_style';
class procedure TSkiaAPI.sk4d_paragraphstyle_set_ellipsis; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_set_ellipsis';
class procedure TSkiaAPI.sk4d_paragraphstyle_set_height; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_set_height';
class procedure TSkiaAPI.sk4d_paragraphstyle_set_max_lines; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_set_max_lines';
class procedure TSkiaAPI.sk4d_paragraphstyle_set_strut_style; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_set_strut_style';
class procedure TSkiaAPI.sk4d_paragraphstyle_set_text_align; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_set_text_align';
class procedure TSkiaAPI.sk4d_paragraphstyle_set_text_direction; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_set_text_direction';
class procedure TSkiaAPI.sk4d_paragraphstyle_set_text_height_behaviors; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_set_text_height_behaviors';
class procedure TSkiaAPI.sk4d_paragraphstyle_set_text_style; external TSkiaAPI.LibName name 'sk4d_paragraphstyle_set_text_style';
class function TSkiaAPI.sk4d_strutstyle_create; external TSkiaAPI.LibName name 'sk4d_strutstyle_create';
class procedure TSkiaAPI.sk4d_strutstyle_destroy; external TSkiaAPI.LibName name 'sk4d_strutstyle_destroy';
class function TSkiaAPI.sk4d_strutstyle_get_enabled; external TSkiaAPI.LibName name 'sk4d_strutstyle_get_enabled';
class function TSkiaAPI.sk4d_strutstyle_get_font_families; external TSkiaAPI.LibName name 'sk4d_strutstyle_get_font_families';
class function TSkiaAPI.sk4d_strutstyle_get_font_size; external TSkiaAPI.LibName name 'sk4d_strutstyle_get_font_size';
class procedure TSkiaAPI.sk4d_strutstyle_get_font_style; external TSkiaAPI.LibName name 'sk4d_strutstyle_get_font_style';
class function TSkiaAPI.sk4d_strutstyle_get_force_height; external TSkiaAPI.LibName name 'sk4d_strutstyle_get_force_height';
class function TSkiaAPI.sk4d_strutstyle_get_half_leading; external TSkiaAPI.LibName name 'sk4d_strutstyle_get_half_leading';
class function TSkiaAPI.sk4d_strutstyle_get_height_multiplier; external TSkiaAPI.LibName name 'sk4d_strutstyle_get_height_multiplier';
class function TSkiaAPI.sk4d_strutstyle_get_leading; external TSkiaAPI.LibName name 'sk4d_strutstyle_get_leading';
class function TSkiaAPI.sk4d_strutstyle_is_equal; external TSkiaAPI.LibName name 'sk4d_strutstyle_is_equal';
class procedure TSkiaAPI.sk4d_strutstyle_set_enabled; external TSkiaAPI.LibName name 'sk4d_strutstyle_set_enabled';
class procedure TSkiaAPI.sk4d_strutstyle_set_font_families; external TSkiaAPI.LibName name 'sk4d_strutstyle_set_font_families';
class procedure TSkiaAPI.sk4d_strutstyle_set_font_size; external TSkiaAPI.LibName name 'sk4d_strutstyle_set_font_size';
class procedure TSkiaAPI.sk4d_strutstyle_set_font_style; external TSkiaAPI.LibName name 'sk4d_strutstyle_set_font_style';
class procedure TSkiaAPI.sk4d_strutstyle_set_force_height; external TSkiaAPI.LibName name 'sk4d_strutstyle_set_force_height';
class procedure TSkiaAPI.sk4d_strutstyle_set_half_leading; external TSkiaAPI.LibName name 'sk4d_strutstyle_set_half_leading';
class procedure TSkiaAPI.sk4d_strutstyle_set_height_multiplier; external TSkiaAPI.LibName name 'sk4d_strutstyle_set_height_multiplier';
class procedure TSkiaAPI.sk4d_strutstyle_set_leading; external TSkiaAPI.LibName name 'sk4d_strutstyle_set_leading';
{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skparagraph/include/sk4d_textstyle.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_textstyle_add_font_feature := GetProcAddress(FLibHandle, 'sk4d_textstyle_add_font_feature');
sk4d_textstyle_add_shadow := GetProcAddress(FLibHandle, 'sk4d_textstyle_add_shadow');
sk4d_textstyle_clear_background_color := GetProcAddress(FLibHandle, 'sk4d_textstyle_clear_background_color');
sk4d_textstyle_clear_foreground_color := GetProcAddress(FLibHandle, 'sk4d_textstyle_clear_foreground_color');
sk4d_textstyle_create := GetProcAddress(FLibHandle, 'sk4d_textstyle_create');
sk4d_textstyle_destroy := GetProcAddress(FLibHandle, 'sk4d_textstyle_destroy');
sk4d_textstyle_get_background := GetProcAddress(FLibHandle, 'sk4d_textstyle_get_background');
sk4d_textstyle_get_color := GetProcAddress(FLibHandle, 'sk4d_textstyle_get_color');
sk4d_textstyle_get_decoration_color := GetProcAddress(FLibHandle, 'sk4d_textstyle_get_decoration_color');
sk4d_textstyle_get_decoration_style := GetProcAddress(FLibHandle, 'sk4d_textstyle_get_decoration_style');
sk4d_textstyle_get_decoration_thickness := GetProcAddress(FLibHandle, 'sk4d_textstyle_get_decoration_thickness');
sk4d_textstyle_get_decorations := GetProcAddress(FLibHandle, 'sk4d_textstyle_get_decorations');
sk4d_textstyle_get_font_families := GetProcAddress(FLibHandle, 'sk4d_textstyle_get_font_families');
sk4d_textstyle_get_font_metrics := GetProcAddress(FLibHandle, 'sk4d_textstyle_get_font_metrics');
sk4d_textstyle_get_font_size := GetProcAddress(FLibHandle, 'sk4d_textstyle_get_font_size');
sk4d_textstyle_get_font_style := GetProcAddress(FLibHandle, 'sk4d_textstyle_get_font_style');
sk4d_textstyle_get_foreground := GetProcAddress(FLibHandle, 'sk4d_textstyle_get_foreground');
sk4d_textstyle_get_half_leading := GetProcAddress(FLibHandle, 'sk4d_textstyle_get_half_leading');
sk4d_textstyle_get_height_multiplier := GetProcAddress(FLibHandle, 'sk4d_textstyle_get_height_multiplier');
sk4d_textstyle_get_letter_spacing := GetProcAddress(FLibHandle, 'sk4d_textstyle_get_letter_spacing');
sk4d_textstyle_get_locale := GetProcAddress(FLibHandle, 'sk4d_textstyle_get_locale');
sk4d_textstyle_get_word_spacing := GetProcAddress(FLibHandle, 'sk4d_textstyle_get_word_spacing');
sk4d_textstyle_is_equal := GetProcAddress(FLibHandle, 'sk4d_textstyle_is_equal');
sk4d_textstyle_reset_font_features := GetProcAddress(FLibHandle, 'sk4d_textstyle_reset_font_features');
sk4d_textstyle_reset_shadows := GetProcAddress(FLibHandle, 'sk4d_textstyle_reset_shadows');
sk4d_textstyle_set_background_color := GetProcAddress(FLibHandle, 'sk4d_textstyle_set_background_color');
sk4d_textstyle_set_color := GetProcAddress(FLibHandle, 'sk4d_textstyle_set_color');
sk4d_textstyle_set_decoration_color := GetProcAddress(FLibHandle, 'sk4d_textstyle_set_decoration_color');
sk4d_textstyle_set_decoration_style := GetProcAddress(FLibHandle, 'sk4d_textstyle_set_decoration_style');
sk4d_textstyle_set_decoration_thickness := GetProcAddress(FLibHandle, 'sk4d_textstyle_set_decoration_thickness');
sk4d_textstyle_set_decorations := GetProcAddress(FLibHandle, 'sk4d_textstyle_set_decorations');
sk4d_textstyle_set_font_families := GetProcAddress(FLibHandle, 'sk4d_textstyle_set_font_families');
sk4d_textstyle_set_font_size := GetProcAddress(FLibHandle, 'sk4d_textstyle_set_font_size');
sk4d_textstyle_set_font_style := GetProcAddress(FLibHandle, 'sk4d_textstyle_set_font_style');
sk4d_textstyle_set_foreground_color := GetProcAddress(FLibHandle, 'sk4d_textstyle_set_foreground_color');
sk4d_textstyle_set_half_leading := GetProcAddress(FLibHandle, 'sk4d_textstyle_set_half_leading');
sk4d_textstyle_set_height_multiplier := GetProcAddress(FLibHandle, 'sk4d_textstyle_set_height_multiplier');
sk4d_textstyle_set_letter_spacing := GetProcAddress(FLibHandle, 'sk4d_textstyle_set_letter_spacing');
sk4d_textstyle_set_locale := GetProcAddress(FLibHandle, 'sk4d_textstyle_set_locale');
sk4d_textstyle_set_word_spacing := GetProcAddress(FLibHandle, 'sk4d_textstyle_set_word_spacing');
{$ELSE}
class procedure TSkiaAPI.sk4d_textstyle_add_font_feature; external TSkiaAPI.LibName name 'sk4d_textstyle_add_font_feature';
class procedure TSkiaAPI.sk4d_textstyle_add_shadow; external TSkiaAPI.LibName name 'sk4d_textstyle_add_shadow';
class procedure TSkiaAPI.sk4d_textstyle_clear_background_color; external TSkiaAPI.LibName name 'sk4d_textstyle_clear_background_color';
class procedure TSkiaAPI.sk4d_textstyle_clear_foreground_color; external TSkiaAPI.LibName name 'sk4d_textstyle_clear_foreground_color';
class function TSkiaAPI.sk4d_textstyle_create; external TSkiaAPI.LibName name 'sk4d_textstyle_create';
class procedure TSkiaAPI.sk4d_textstyle_destroy; external TSkiaAPI.LibName name 'sk4d_textstyle_destroy';
class function TSkiaAPI.sk4d_textstyle_get_background; external TSkiaAPI.LibName name 'sk4d_textstyle_get_background';
class function TSkiaAPI.sk4d_textstyle_get_color; external TSkiaAPI.LibName name 'sk4d_textstyle_get_color';
class function TSkiaAPI.sk4d_textstyle_get_decoration_color; external TSkiaAPI.LibName name 'sk4d_textstyle_get_decoration_color';
class function TSkiaAPI.sk4d_textstyle_get_decoration_style; external TSkiaAPI.LibName name 'sk4d_textstyle_get_decoration_style';
class function TSkiaAPI.sk4d_textstyle_get_decoration_thickness; external TSkiaAPI.LibName name 'sk4d_textstyle_get_decoration_thickness';
class function TSkiaAPI.sk4d_textstyle_get_decorations; external TSkiaAPI.LibName name 'sk4d_textstyle_get_decorations';
class function TSkiaAPI.sk4d_textstyle_get_font_families; external TSkiaAPI.LibName name 'sk4d_textstyle_get_font_families';
class procedure TSkiaAPI.sk4d_textstyle_get_font_metrics; external TSkiaAPI.LibName name 'sk4d_textstyle_get_font_metrics';
class function TSkiaAPI.sk4d_textstyle_get_font_size; external TSkiaAPI.LibName name 'sk4d_textstyle_get_font_size';
class procedure TSkiaAPI.sk4d_textstyle_get_font_style; external TSkiaAPI.LibName name 'sk4d_textstyle_get_font_style';
class function TSkiaAPI.sk4d_textstyle_get_foreground; external TSkiaAPI.LibName name 'sk4d_textstyle_get_foreground';
class function TSkiaAPI.sk4d_textstyle_get_half_leading; external TSkiaAPI.LibName name 'sk4d_textstyle_get_half_leading';
class function TSkiaAPI.sk4d_textstyle_get_height_multiplier; external TSkiaAPI.LibName name 'sk4d_textstyle_get_height_multiplier';
class function TSkiaAPI.sk4d_textstyle_get_letter_spacing; external TSkiaAPI.LibName name 'sk4d_textstyle_get_letter_spacing';
class function TSkiaAPI.sk4d_textstyle_get_locale; external TSkiaAPI.LibName name 'sk4d_textstyle_get_locale';
class function TSkiaAPI.sk4d_textstyle_get_word_spacing; external TSkiaAPI.LibName name 'sk4d_textstyle_get_word_spacing';
class function TSkiaAPI.sk4d_textstyle_is_equal; external TSkiaAPI.LibName name 'sk4d_textstyle_is_equal';
class procedure TSkiaAPI.sk4d_textstyle_reset_font_features; external TSkiaAPI.LibName name 'sk4d_textstyle_reset_font_features';
class procedure TSkiaAPI.sk4d_textstyle_reset_shadows; external TSkiaAPI.LibName name 'sk4d_textstyle_reset_shadows';
class procedure TSkiaAPI.sk4d_textstyle_set_background_color; external TSkiaAPI.LibName name 'sk4d_textstyle_set_background_color';
class procedure TSkiaAPI.sk4d_textstyle_set_color; external TSkiaAPI.LibName name 'sk4d_textstyle_set_color';
class procedure TSkiaAPI.sk4d_textstyle_set_decoration_color; external TSkiaAPI.LibName name 'sk4d_textstyle_set_decoration_color';
class procedure TSkiaAPI.sk4d_textstyle_set_decoration_style; external TSkiaAPI.LibName name 'sk4d_textstyle_set_decoration_style';
class procedure TSkiaAPI.sk4d_textstyle_set_decoration_thickness; external TSkiaAPI.LibName name 'sk4d_textstyle_set_decoration_thickness';
class procedure TSkiaAPI.sk4d_textstyle_set_decorations; external TSkiaAPI.LibName name 'sk4d_textstyle_set_decorations';
class procedure TSkiaAPI.sk4d_textstyle_set_font_families; external TSkiaAPI.LibName name 'sk4d_textstyle_set_font_families';
class procedure TSkiaAPI.sk4d_textstyle_set_font_size; external TSkiaAPI.LibName name 'sk4d_textstyle_set_font_size';
class procedure TSkiaAPI.sk4d_textstyle_set_font_style; external TSkiaAPI.LibName name 'sk4d_textstyle_set_font_style';
class procedure TSkiaAPI.sk4d_textstyle_set_foreground_color; external TSkiaAPI.LibName name 'sk4d_textstyle_set_foreground_color';
class procedure TSkiaAPI.sk4d_textstyle_set_half_leading; external TSkiaAPI.LibName name 'sk4d_textstyle_set_half_leading';
class procedure TSkiaAPI.sk4d_textstyle_set_height_multiplier; external TSkiaAPI.LibName name 'sk4d_textstyle_set_height_multiplier';
class procedure TSkiaAPI.sk4d_textstyle_set_letter_spacing; external TSkiaAPI.LibName name 'sk4d_textstyle_set_letter_spacing';
class procedure TSkiaAPI.sk4d_textstyle_set_locale; external TSkiaAPI.LibName name 'sk4d_textstyle_set_locale';
class procedure TSkiaAPI.sk4d_textstyle_set_word_spacing; external TSkiaAPI.LibName name 'sk4d_textstyle_set_word_spacing';
{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skparagraph/include/sk4d_typefacefontprovider.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_typefacefontprovider_create := GetProcAddress(FLibHandle, 'sk4d_typefacefontprovider_create');
sk4d_typefacefontprovider_register_typeface := GetProcAddress(FLibHandle, 'sk4d_typefacefontprovider_register_typeface');
sk4d_typefacefontprovider_register_typeface2 := GetProcAddress(FLibHandle, 'sk4d_typefacefontprovider_register_typeface2');
{$ELSE}
class function TSkiaAPI.sk4d_typefacefontprovider_create; external TSkiaAPI.LibName name 'sk4d_typefacefontprovider_create';
class procedure TSkiaAPI.sk4d_typefacefontprovider_register_typeface; external TSkiaAPI.LibName name 'sk4d_typefacefontprovider_register_typeface';
class procedure TSkiaAPI.sk4d_typefacefontprovider_register_typeface2; external TSkiaAPI.LibName name 'sk4d_typefacefontprovider_register_typeface2';
{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skresources/include/sk4d_resources.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_resourceproviderbaseclass_create := GetProcAddress(FLibHandle, 'sk4d_resourceproviderbaseclass_create');
sk4d_resourceproviderbaseclass_set_procs := GetProcAddress(FLibHandle, 'sk4d_resourceproviderbaseclass_set_procs');
{$ELSE}
class function TSkiaAPI.sk4d_resourceproviderbaseclass_create; external TSkiaAPI.LibName name 'sk4d_resourceproviderbaseclass_create';
class procedure TSkiaAPI.sk4d_resourceproviderbaseclass_set_procs; external TSkiaAPI.LibName name 'sk4d_resourceproviderbaseclass_set_procs';
{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skshaper/include/sk4d_shaper.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_shaper_create := GetProcAddress(FLibHandle, 'sk4d_shaper_create');
sk4d_shaper_destroy := GetProcAddress(FLibHandle, 'sk4d_shaper_destroy');
sk4d_shaper_shape := GetProcAddress(FLibHandle, 'sk4d_shaper_shape');
{$ELSE}
class function TSkiaAPI.sk4d_shaper_create; external TSkiaAPI.LibName name 'sk4d_shaper_create';
class procedure TSkiaAPI.sk4d_shaper_destroy; external TSkiaAPI.LibName name 'sk4d_shaper_destroy';
class function TSkiaAPI.sk4d_shaper_shape; external TSkiaAPI.LibName name 'sk4d_shaper_shape';
{$ENDIF}
{$ENDREGION}
{$REGION 'modules/skunicode/include/sk4d_unicode.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_unicode_create := GetProcAddress(FLibHandle, 'sk4d_unicode_create');
sk4d_unicode_destroy := GetProcAddress(FLibHandle, 'sk4d_unicode_destroy');
sk4d_unicode_for_each_bidi_region := GetProcAddress(FLibHandle, 'sk4d_unicode_for_each_bidi_region');
sk4d_unicode_for_each_break := GetProcAddress(FLibHandle, 'sk4d_unicode_for_each_break');
sk4d_unicode_for_each_codepoint := GetProcAddress(FLibHandle, 'sk4d_unicode_for_each_codepoint');
{$ELSE}
class function TSkiaAPI.sk4d_unicode_create; external TSkiaAPI.LibName name 'sk4d_unicode_create';
class procedure TSkiaAPI.sk4d_unicode_destroy; external TSkiaAPI.LibName name 'sk4d_unicode_destroy';
class procedure TSkiaAPI.sk4d_unicode_for_each_bidi_region; external TSkiaAPI.LibName name 'sk4d_unicode_for_each_bidi_region';
class procedure TSkiaAPI.sk4d_unicode_for_each_break; external TSkiaAPI.LibName name 'sk4d_unicode_for_each_break';
class procedure TSkiaAPI.sk4d_unicode_for_each_codepoint; external TSkiaAPI.LibName name 'sk4d_unicode_for_each_codepoint';
{$ENDIF}
{$ENDREGION}
{$REGION 'modules/svg/include/sk4d_svgdom.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_svgdom_find_node_by_id := GetProcAddress(FLibHandle, 'sk4d_svgdom_find_node_by_id');
sk4d_svgdom_get_root := GetProcAddress(FLibHandle, 'sk4d_svgdom_get_root');
sk4d_svgdom_make_from_file := GetProcAddress(FLibHandle, 'sk4d_svgdom_make_from_file');
sk4d_svgdom_make_from_stream := GetProcAddress(FLibHandle, 'sk4d_svgdom_make_from_stream');
sk4d_svgdom_render := GetProcAddress(FLibHandle, 'sk4d_svgdom_render');
sk4d_svgdom_set_container_size := GetProcAddress(FLibHandle, 'sk4d_svgdom_set_container_size');
{$ELSE}
class function TSkiaAPI.sk4d_svgdom_find_node_by_id; external TSkiaAPI.LibName name 'sk4d_svgdom_find_node_by_id';
class function TSkiaAPI.sk4d_svgdom_get_root; external TSkiaAPI.LibName name 'sk4d_svgdom_get_root';
class function TSkiaAPI.sk4d_svgdom_make_from_file; external TSkiaAPI.LibName name 'sk4d_svgdom_make_from_file';
class function TSkiaAPI.sk4d_svgdom_make_from_stream; external TSkiaAPI.LibName name 'sk4d_svgdom_make_from_stream';
class procedure TSkiaAPI.sk4d_svgdom_render; external TSkiaAPI.LibName name 'sk4d_svgdom_render';
class procedure TSkiaAPI.sk4d_svgdom_set_container_size; external TSkiaAPI.LibName name 'sk4d_svgdom_set_container_size';
{$ENDIF}
{$ENDREGION}
{$REGION 'modules/svg/include/sk4d_svgnode.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_svgnode_set_attribute := GetProcAddress(FLibHandle, 'sk4d_svgnode_set_attribute');
{$ELSE}
class function TSkiaAPI.sk4d_svgnode_set_attribute; external TSkiaAPI.LibName name 'sk4d_svgnode_set_attribute';
{$ENDIF}
{$ENDREGION}
{$REGION 'modules/svg/include/sk4d_svgsvg.h'}
{$IFDEF SK_DYNAMIC_LOADING}
sk4d_svgsvg_get_height := GetProcAddress(FLibHandle, 'sk4d_svgsvg_get_height');
sk4d_svgsvg_get_intrinsic_size := GetProcAddress(FLibHandle, 'sk4d_svgsvg_get_intrinsic_size');
sk4d_svgsvg_get_preserve_aspect_ratio := GetProcAddress(FLibHandle, 'sk4d_svgsvg_get_preserve_aspect_ratio');
sk4d_svgsvg_get_view_box := GetProcAddress(FLibHandle, 'sk4d_svgsvg_get_view_box');
sk4d_svgsvg_get_width := GetProcAddress(FLibHandle, 'sk4d_svgsvg_get_width');
sk4d_svgsvg_get_x := GetProcAddress(FLibHandle, 'sk4d_svgsvg_get_x');
sk4d_svgsvg_get_y := GetProcAddress(FLibHandle, 'sk4d_svgsvg_get_y');
sk4d_svgsvg_set_height := GetProcAddress(FLibHandle, 'sk4d_svgsvg_set_height');
sk4d_svgsvg_set_preserve_aspect_ratio := GetProcAddress(FLibHandle, 'sk4d_svgsvg_set_preserve_aspect_ratio');
sk4d_svgsvg_set_view_box := GetProcAddress(FLibHandle, 'sk4d_svgsvg_set_view_box');
sk4d_svgsvg_set_width := GetProcAddress(FLibHandle, 'sk4d_svgsvg_set_width');
sk4d_svgsvg_set_x := GetProcAddress(FLibHandle, 'sk4d_svgsvg_set_x');
sk4d_svgsvg_set_y := GetProcAddress(FLibHandle, 'sk4d_svgsvg_set_y');
{$ELSE}
class procedure TSkiaAPI.sk4d_svgsvg_get_height; external TSkiaAPI.LibName name 'sk4d_svgsvg_get_height';
class procedure TSkiaAPI.sk4d_svgsvg_get_intrinsic_size; external TSkiaAPI.LibName name 'sk4d_svgsvg_get_intrinsic_size';
class procedure TSkiaAPI.sk4d_svgsvg_get_preserve_aspect_ratio; external TSkiaAPI.LibName name 'sk4d_svgsvg_get_preserve_aspect_ratio';
class function TSkiaAPI.sk4d_svgsvg_get_view_box; external TSkiaAPI.LibName name 'sk4d_svgsvg_get_view_box';
class procedure TSkiaAPI.sk4d_svgsvg_get_width; external TSkiaAPI.LibName name 'sk4d_svgsvg_get_width';
class procedure TSkiaAPI.sk4d_svgsvg_get_x; external TSkiaAPI.LibName name 'sk4d_svgsvg_get_x';
class procedure TSkiaAPI.sk4d_svgsvg_get_y; external TSkiaAPI.LibName name 'sk4d_svgsvg_get_y';
class procedure TSkiaAPI.sk4d_svgsvg_set_height; external TSkiaAPI.LibName name 'sk4d_svgsvg_set_height';
class procedure TSkiaAPI.sk4d_svgsvg_set_preserve_aspect_ratio; external TSkiaAPI.LibName name 'sk4d_svgsvg_set_preserve_aspect_ratio';
class procedure TSkiaAPI.sk4d_svgsvg_set_view_box; external TSkiaAPI.LibName name 'sk4d_svgsvg_set_view_box';
class procedure TSkiaAPI.sk4d_svgsvg_set_width; external TSkiaAPI.LibName name 'sk4d_svgsvg_set_width';
class procedure TSkiaAPI.sk4d_svgsvg_set_x; external TSkiaAPI.LibName name 'sk4d_svgsvg_set_x';
class procedure TSkiaAPI.sk4d_svgsvg_set_y; external TSkiaAPI.LibName name 'sk4d_svgsvg_set_y';
{$ENDIF}
{$ENDREGION}
{$IFDEF SK_DYNAMIC_LOADING}
end;
end;
{$ENDIF}
class procedure TSkiaAPI.Terminate;
begin
{$IFDEF SK_DYNAMIC_LOADING}
if AtomicDecrement(FRefCount) = 0 then
FreeLibrary(FLibHandle);
{$ENDIF}
end;
{$ENDREGION}
{$REGION 'Static linking loaders'}
{$IFDEF IOS}
procedure libcpp; external '/usr/lib/libc++.dylib';
procedure libcompiler_rt; external '/usr/lib/clang/lib/darwin/libclang_rt.ios.a';
{$ENDIF}
{$ENDREGION}
end.
| 120.708743 | 900 | 0.667417 |
6a03b0a5743dda8cf603dae436eedb2644bfa948 | 53,659 | pas | Pascal | Engine/Libs/VMTInfo.pas | RadiianArts/TERRA-Engine | 965184178dda836197c436ef47e048e1db5382af | [
"Apache-2.0"
]
| 104 | 2015-01-18T02:02:11.000Z | 2022-02-22T11:53:06.000Z | Engine/Libs/VMTInfo.pas | maciej-izak-tests/TERRA-Engine | 7ef17e6b67968a40212fbb678135af0000246097 | [
"Apache-2.0"
]
| 13 | 2015-07-18T18:53:15.000Z | 2021-10-04T10:31:01.000Z | Engine/Libs/VMTInfo.pas | maciej-izak-tests/TERRA-Engine | 7ef17e6b67968a40212fbb678135af0000246097 | [
"Apache-2.0"
]
| 47 | 2015-01-17T21:50:12.000Z | 2022-02-15T13:49:02.000Z | unit VMTInfo;
interface
uses Classes, TypInfo;
type
// The type info interfaces apply to any type for which the
// compiler stores runtime type information (RTTI).
ITypeInfo = interface
['{6CF8D121-16D3-11D3-B1A8-00105AA9C2AD}']
function GetKind: TTypeKind;
function GetName:TERRAString;
function GetTypeInfo: PTypeInfo;
function GetTypeData: PTypeData;
property Kind: TTypeKind read GetKind;
property Name:TERRAString read GetName;
property TypeInfo: PTypeInfo read GetTypeInfo;
property TypeData: PTypeData read GetTypeData;
end;
IOrdinalTypeInfo = interface(ITypeInfo)
['{6CF8D122-16D3-11D3-B1A8-00105AA9C2AD}']
function GetOrdType: TOrdType;
property OrdType: TOrdType read GetOrdType;
end;
ICharTypeInfo = interface(IOrdinalTypeInfo)
['{A89454C1-1AA9-11D3-B1A8-00105AA9C2AD}']
function GetMinValue: Char;
function GetMaxValue: Char;
property MinValue: Char read GetMinValue;
property MaxValue: Char read GetMaxValue;
end;
IWideCharTypeInfo = interface(IOrdinalTypeInfo)
['{A89454C2-1AA9-11D3-B1A8-00105AA9C2AD}']
function GetMinValue: WideChar;
function GetMaxValue: WideChar;
property MinValue: WideChar read GetMinValue;
property MaxValue: WideChar read GetMaxValue;
end;
IRangeTypeInfo = interface(IOrdinalTypeInfo)
['{6CF8D123-16D3-11D3-B1A8-00105AA9C2AD}']
function GetMinValue: Integer;
function GetMaxValue: Integer;
property MinValue: Integer read GetMinValue;
property MaxValue: Integer read GetMaxValue;
end;
IIntegerTypeInfo = interface(IRangeTypeInfo)
['{A89454C3-1AA9-11D3-B1A8-00105AA9C2AD}']
end;
IEnumTypeInfo = interface(IRangeTypeInfo)
['{6CF8D124-16D3-11D3-B1A8-00105AA9C2AD}']
function GetBaseType: IEnumTypeInfo;
function GetNames(Index: Integer):TERRAString;
function GetNameCount: Integer;
function IsSubRange: Boolean;
property NameCount: Integer read GetNameCount;
property Names[Index: Integer]:TERRAString read GetNames;
property BaseType: IEnumTypeInfo read GetBaseType;
end;
ISetTypeInfo = interface(IOrdinalTypeInfo)
['{6CF8D125-16D3-11D3-B1A8-00105AA9C2AD}']
function GetCompType: IEnumTypeInfo;
property CompType: IEnumTypeInfo read GetCompType;
end;
IInt64TypeInfo = interface(ITypeInfo)
['{6CF8D126-16D3-11D3-B1A8-00105AA9C2AD}']
function GetMinValue: Int64;
function GetMaxValue: Int64;
property MinValue: Int64 read GetMinValue;
property MaxValue: Int64 read GetMaxValue;
end;
IFloatTypeInfo = interface(ITypeInfo)
['{6CF8D127-16D3-11D3-B1A8-00105AA9C2AD}']
function GetFloatType: TFloatType;
property FloatType: TFloatType read GetFloatType;
end;
IShortStringTypeInfo = interface(ITypeInfo)
['{6CF8D128-16D3-11D3-B1A8-00105AA9C2AD}']
function GetMaxLength: Integer;
property MaxLength: Integer read GetMaxLength;
end;
TStoredType = (ptStaticMethod, ptVirtualMethod, ptField, ptConstant);
TProcType = ptStaticMethod..ptField;
IPropInfo = interface
['{6CF8D12D-16D3-11D3-B1A8-00105AA9C2AD}']
function GetPropType: ITypeInfo;
function GetReader: Pointer;
function GetWriter: Pointer;
function GetStoredProc: Pointer;
function GetIndex: Integer;
function GetDefault: LongInt;
function GetNameIndex: SmallInt;
function GetName:TERRAString;
function GetReaderType: TProcType;
function GetWriterType: TProcType;
function GetStoredType: TStoredType;
function GetReaderValue: Integer;
function GetWriterValue: Integer;
function GetStoredValue: Integer;
function HasDefault: Boolean;
function HasIndex: Boolean;
property PropType: ITypeInfo read GetPropType;
property Reader: Pointer read GetReader;
property Writer: Pointer read GetWriter;
property StoredProc: Pointer read GetStoredProc;
property ReaderType: TProcType read GetReaderType;
property WriterType: TProcType read GetWriterType;
property StoredType: TStoredType read GetStoredType;
// Values are field offsets, virtual method numbers, or constant ordinals
property ReaderValue: Integer read GetReaderValue;
property WriterValue: Integer read GetWriterValue;
property StoredValue: Integer read GetStoredValue;
property Index: Integer read GetIndex;
property Default: LongInt read GetDefault;
property NameIndex: SmallInt read GetNameIndex;
property Name:TERRAString read GetName;
end;
IClassTypeInfo = interface(ITypeInfo)
['{6CF8D129-16D3-11D3-B1A8-00105AA9C2AD}']
function GetClassType: TClass;
function GetParentInfo: IClassTypeInfo;
function GetPropCount: Integer;
function GetUnitName:TERRAString;
function GetProperties(Index: Integer): IPropInfo;
property ClassType: TClass read GetClassType;
property ParentInfo: IClassTypeInfo read GetParentInfo;
property PropCount: Integer read GetPropCount;
property UnitName:TERRAString read GetUnitName;
property Properties[Index: Integer]: IPropInfo read GetProperties;
end;
IParamInfo = interface
['{6CF8D12B-16D3-11D3-B1A8-00105AA9C2AD}']
function GetFlags: TParamFlags;
function GetName:TERRAString;
function GetTypeName:TERRAString;
property Flags: TParamFlags read GetFlags;
property Name:TERRAString read GetName;
property TypeName:TERRAString read GetTypeName;
end;
IMethodTypeInfo = interface(ITypeInfo)
['{6CF8D12A-16D3-11D3-B1A8-00105AA9C2AD}']
function GetMethodKind: TMethodKind;
function GetParamCount: Byte;
function GetParams(Index: Integer): IParamInfo;
function GetResultType:TERRAString;
property MethodKind: TMethodKind read GetMethodKind;
property ParamCount: Byte read GetParamCount;
property Params[Index: Integer]: IParamInfo read GetParams;
property ResultType:TERRAString read GetResultType;
end;
IInterfaceTypeInfo = interface(ITypeInfo)
['{6CF8D12C-16D3-11D3-B1A8-00105AA9C2AD}']
function GetIntfParent: IInterfaceTypeInfo;
function GetIntfFlags: TIntfFlagsBase;
function GetGuid: TGUID;
function GetIntfUnit:TERRAString;
property IntfParent: IInterfaceTypeInfo read GetIntfParent;
property IntfFlags: TIntfFlagsBase read GetIntfFlags;
property Guid: TGUID read GetGuid;
property IntfUnit:TERRAString read GetIntfUnit;
end;
// The VMT interfaces apply only to classes with RTTI, that is,
// classes compiled with the $M+ directive or derived from classes
// that were compiled with $M+ (such as TPersistent).
IVmtInitEntry = interface
['{4C479B91-113D-11D3-B1A6-00105AA9C2AD}']
function GetOffset: Integer; // byte offset of field in object
function GetTypeName:TERRAString; // name of the field's type
function GetTypeKind: TTypeKind; // kind of the field's type
property Offset: Integer read GetOffset;
property TypeName:TERRAString read GetTypeName;
property TypeKind: TTypeKind read GetTypeKind;
end;
IVmtInitAggregate = interface(IVmtInitEntry)
['{4C479B92-113D-11D3-B1A6-00105AA9C2AD}']
function GetCount: Integer; // number of sub-items
function GetInitializer(Index: Integer): IVmtInitEntry;
property Count: Integer read GetCount;
property Initializer[Index: Integer]: IVmtInitEntry read GetInitializer; default;
end;
IVmtInitRecord = interface(IVmtInitAggregate)
['{4C479B93-113D-11D3-B1A6-00105AA9C2AD}']
function GetRecordSize: Integer;
property RecordSize: Integer read GetRecordSize;
end;
IVmtInitArray = interface(IVmtInitAggregate)
['{4C479B94-113D-11D3-B1A6-00105AA9C2AD}']
function GetElementSize: Integer;
property ElementSize: Integer read GetElementSize;
end;
{ Automation entry flags }
TVmtAutoFlag = (afMethod, afPropGet, afPropSet, afVirtual);
TVmtAutoFlags = set of TVmtAutoFlag;
TVmtAutoType = type Byte; // a Variant type code, e.g., varInteger
IVmtAutoParam = interface
['{E8476685-1615-11D3-B1A8-00105AA9C2AD}']
function GetAutoType: TVmtAutoType;
function GetIsByRef: Boolean; // true if passed by reference
property AutoType: TVmtAutoType read GetAutoType;
property IsByRef: Boolean read GetIsByRef;
end;
IVmtAutoEntry = interface
['{E8476686-1615-11D3-B1A8-00105AA9C2AD}']
function GetDispID: Integer;
function GetName:TERRAString;
function GetFlags: TVmtAutoFlags;
function GetAddress: Pointer;
function GetParamCount: Integer;
function GetParam(Index: Integer): IVmtAutoParam;
function GetResultType: TVmtAutoType;
property Address: Pointer read GetAddress;
property Count: Integer read GetParamCount;
property DispID: Integer read GetDispID;
property Flags: TVmtAutoFlags read GetFlags;
property Name:TERRAString read GetName;
property Params[Index: Integer]: IVmtAutoParam read GetParam; default;
property ResultType: TVmtAutoType read GetResultType;
end;
IVmtMethodParam = interface
['{30099302-17CF-11D3-B1A8-00105AA9C2AD}']
function GetName:TERRAString;
function GetType: ITypeInfo;
function GetTypeInfo: PTypeInfo;
property Name:TERRAString read GetName;
property ParamType: ITypeInfo read GetType;
property TypeInfo: PTypeInfo read GetTypeInfo;
end;
IVmtMethod = interface
['{30099301-17CF-11D3-B1A8-00105AA9C2AD}']
function GetAddress: Pointer;
function GetName:TERRAString;
function GetParamCount: Integer;
function GetParams(Index: Integer): IVmtMethodParam;
function HasParamInfo: Boolean;
property Address: Pointer read GetAddress;
property Name:TERRAString read GetName;
property ParamCount: Integer read GetParamCount;
property Params[Index: Integer]: IVmtMethodParam read GetParams;
end;
IVmtField = interface
['{30099303-17CF-11D3-B1A8-00105AA9C2AD}']
function GetOffset: Integer;
function GetClass: TClass;
function GetClassIndex: Word;
function GetName:TERRAString;
function GetType: IClassTypeInfo;
property Offset: Integer read GetOffset;
property ClassIndex: Word read GetClassIndex;
property FieldClass: TClass read GetClass;
property Name:TERRAString read GetName;
property FieldType: IClassTypeInfo read GetType;
end;
IVmtInfo = interface
['{102C2541-160F-11D3-B1A8-00105AA9C2AD}']
function GetFieldClassTable: Pointer;
function GetClass(Index: Integer): TClass;
function GetClassCount: Integer;
function GetClassName:TERRAString;
function GetClassType: TClass;
function GetDynamicTable: Pointer;
function GetDynamicAddress(Index: Integer): Pointer;
function GetDynamicNumber(Index: Integer): SmallInt;
function FindDynamicAddress(Number: SmallInt): POinter;
function GetDynamicMethodCount: Integer;
function GetFieldTable: Pointer;
function GetField(Index: Integer): IVmtField;
function GetFieldType(Index: Integer): TClass;
function GetFieldCount: Integer;
function GetMethodTable: Pointer;
function GetMethod(Index: Integer): IVmtMethod;
function GetMethodCount: Integer;
function GetParentVmt: IVmtInfo;
function GetInitTable: Pointer;
function GetInitCount: Integer;
function GetInitEntry(Index: Integer): IVmtInitEntry;
function GetAutoTable: Pointer;
function GetTypeInfo: PTypeInfo;
function GetIntfTable: Pointer;
function GetInterfaceCount: Integer;
function GetInterfaceEntry(Index: Integer): TInterfaceEntry;
function GetAutoCount: Integer;
function GetAutoEntry(Index: Integer): IVmtAutoEntry;
function GetVmt: Pointer;
function GetInstanceSize: Integer;
function GetSafeCallException: Pointer;
function GetAfterConstruction: Pointer;
function GetBeforeDestruction: Pointer;
function GetDispatch: Pointer;
function GetDefaultHandler: Pointer;
function GetNewInstance: Pointer;
function GetFreeInstance: Pointer;
function GetDestroy: Pointer;
property Vmt: Pointer read GetVmt;
property ParentVmt: IVmtInfo read GetParentVmt;
property ClassName:TERRAString read GetClassName;
property MethodTable: Pointer read GetMethodTable;
property MethodCount: Integer read GetMethodCount;
property Methods[Index: Integer]: IVmtMethod read GetMethod;
property FieldTable: Pointer read GetFieldTable;
property FieldCount: Integer read GetFieldCount;
property Fields[Index: Integer]: IVmtField read GetField;
property FieldType[Index: Integer]: TClass read GetFieldType;
property FieldClassTable: Pointer read GetFieldClassTable;
property ClassCount: Integer read GetClassCount;
property Classes[Index: Integer]: TClass read GetClass;
property DynamicTable: Pointer read GetDynamicTable;
property DynamicMethodCount: Integer read GetDynamicMethodCount;
property DynamicMethods[Index: Integer]: Pointer read GetDynamicAddress;
property MessageNumbers[Index: Integer]: SmallInt read GetDynamicNumber;
property Messages[Index: SmallInt]: Pointer read FindDynamicAddress;
property InitTable: Pointer read GetInitTable;
property InitializerCount: Integer read GetInitCount;
property Initializer[Index: Integer]: IVmtInitEntry read GetInitEntry;
property AutoTable: Pointer read GetAutoTable;
property AutoCount: Integer read GetAutoCount;
property AutoEntry[Index: Integer]: IVmtAutoEntry read GetAutoEntry;
property IntfTable: Pointer read GetIntfTable;
property InterfaceCount: Integer read GetInterfaceCount;
property Interfaces[Index: Integer]: TInterfaceEntry read GetInterfaceEntry;
property TypeInfo: PTypeInfo read GetTypeInfo;
end;
// The following methods create interfaces for class references,
// object references, or type information.
function GetVmtInfo(ClassRef: TClass): IVmtInfo;
function GetTypeInfo(TypeInfo: PTypeInfo): ITypeInfo;
implementation
uses Windows, ComObj, SysUtils, Consts;
// Any out-of-bounds error for an array property calls IndexError.
procedure IndexError(Index: Integer);
begin
WriteLn('IndexError:' ,Index);
ReadLn;
Halt;
end;
// Convert a character value to a printable string.
function CharToStr(Ch: Char):TERRAString; overload;
begin
if Ch in [' ' .. '~'] then
Result := '''' + Ch + ''''
else
Result := Format('#%d', [Ord(Ch)]);
end;
function CharToStr(Ch: WideChar):TERRAString; overload;
begin
if Ch in [WideChar(' ') .. WideChar('~')] then
Result := '''' + Char(Ch) + ''''
else
Result := Format('#%d', [Ord(Ch)]);
end;
// Convert a Variant type code to a type name.
function VarTypeToString(VarType: Integer):TERRAString;
begin
case VarType of
varStrArg:
Result := 'string';
varSmallint:
Result := 'SmallInt';
varInteger:
Result := 'Integer';
varSingle:
Result := 'Single';
varDouble:
Result := 'Double';
varCurrency:
Result := 'Currency';
varDate:
Result := 'TDateTime';
varOleStr:
Result := 'WideString';
varDispatch:
Result := 'IDispatch';
varBoolean:
Result := 'Boolean';
varVariant:
Result := 'Variant';
varUnknown:
Result := 'IUnknown';
else
Result := 'unknown';
end;
end;
type
{ Published method record }
PMethod = ^TMethod;
TMethod = packed record
Size: Word; { Size of the TVmtMethod record. }
Address: Pointer; { Pointer to the method entry point. }
Name: ShortString; { Name of the published method. }
// Some methods have an additional 4 zero bytes, which means the method
// takes no parameters.
// Some methods have an additional 6 bytes, followed by a series of
// TMethodParam records, for each parameter.
// It seems that only stdcall methods have this extra information.
// You can identify the extra info by the TMethod.Size value being
// too big for just the Size, Address, and Name members.
end;
PMethodParam = ^TMethodParam;
TMethodParam = packed record
TypeInfo: PPTypeInfo;
Name: ShortString;
// The name is followed by a trailing #0 byte.
end;
{ Published method table }
PMethodTable = ^TMethodTable;
TMethodTable = packed record
Count: Word;
Methods: array[0..MaxListSize] of Byte;
{ Methods: array[1..Count] of TVmtMethod; }
end;
{ Field class table }
PFieldClassTable = ^TFieldClassTable;
TFieldClassTable = packed record
Count: Word;
Classes: packed array[0..MaxListSize] of ^TClass;
{ Classes: packed array[1..Count] of ^TClass; }
end;
{ Published field record }
PField = ^TField;
TField = packed record
Offset: Integer; { Byte offset of field in the object. }
ClassIndex: Word; { Index in the FieldClassTable of the field's type. }
Name: ShortString; { Name of the published field. }
end;
{ Published field table }
PFieldTable = ^TFieldTable;
TFieldTable = packed record
Count: Word;
FieldClassTable: PFieldClassTable;
Fields: packed array[0..MaxListSize] of Byte;
{ Fields: packed array [1..Count] of TVmtField; }
end;
{ Dynamic method table }
PDynMethodTable = ^TDynMethodTable;
TDynMethodTable = packed record
Count: Word;
Data: packed array[0..MaxListSize] of Byte;
{ Indexes: packed array[1..Count] of SmallInt;
Addresses: packed array[1..Count] of Pointer; }
end;
PDynIndexes = ^TDynIndexes;
TDynIndexes = packed array[0..MaxListSize] of SmallInt;
PDynAddresses = ^TDynAddresses;
TDynAddresses = packed array[0..MaxListSize] of Pointer;
{ Initialization/finalization record }
PTypeKind = ^TTypeKind;
PInitTable = ^TInitTable;
PInitRecord = ^TInitRecord;
TInitRecord = packed record
InitTable: ^PInitTable;
Offset: Integer; { offset of field in object }
end;
PInitArray = ^TInitArray;
TInitArray = array[0..MaxListSize] of TInitRecord;
{ Initialization/finalization table }
TInitTable = packed record
TypeKind: Byte;
Data: packed array[0..MaxListSize] of Byte;
{ TypeName: ShortString;
DataSize: Integer;
Count: Integer;
Records: array[1..Count] of TInitRecord; }
end;
{ OLE Automation Table (see OleAuto.pas) }
const
{ Parameter type masks }
atTypeMask = $7F;
atByRef = $80;
MaxAutoEntries = 4095;
MaxAutoParams = 255;
type
{ Automation entry parameter list }
PAutoParamList = ^TAutoParamList;
TAutoParamList = packed record
ReturnType: TVmtAutoType;
Count: Byte;
Types: array[0..MaxAutoParams] of TVmtAutoType;
end;
{ Automation entry flags }
{ Automation table entry }
PAutoEntry = ^TAutoEntry;
TAutoEntry = packed record
DispID: Integer;
Name: PShortString;
Flags: Integer; { Lower byte is TVmtAutoFlags }
Params: PAutoParamList;
Address: Pointer;
end;
{ Automation table layout }
PAutoTable = ^TAutoTable;
TAutoTable = packed record
Count: Integer;
Entries: array[0..MaxAutoEntries] of TAutoEntry;
end;
{ Virtual Method Table }
PVmt = ^TVmt;
TVmt = record
SelfPtr: TClass;
IntfTable: PInterfaceTable;
AutoTable: PAutoTable;
InitTable: PInitTable;
TypeInfo: PTypeInfo;
FieldTable: PFieldTable;
MethodTable: PMethodTable;
DynMethodTable: PDynMethodTable;
ClassName: PShortString;
InstanceSize: Integer;
ClassParent: ^TClass;
SafeCallException: Pointer; { The following hidden fields point to }
AfterConstruction: Pointer; { special virtual methods that are }
BeforeDestruction: Pointer; { inherited from TObject. }
Dispatch: Pointer;
DefaultHandler: Pointer;
NewInstance: Pointer;
FreeInstance: Pointer;
Destroy: Pointer;
{ Here begin the virtual method pointers.
Each virtual method is stored as a code pointer, e.g.,
VirtualMethodTable: array[0..Count] of Pointer;
The compiler does not store the Count of the number of method
pointers in the table. }
end;
// The classes below implement the VmtInfo interfaces.
TVmtAutoParam = class(TInterfacedObject, IVmtAutoParam)
private
fParam: Byte;
public
constructor Create(Param: TVmtAutoType);
function GetAutoType: TVmtAutoType;
function GetIsByRef: Boolean; // true if passed by reference
end;
TVmtAutoEntry = class(TInterfacedObject, IVmtAutoEntry)
private
fEntry: PAutoEntry;
property Entry: PAutoEntry read fEntry;
public
constructor Create(Entry: PAutoEntry);
function GetDispID: Integer;
function GetName:TERRAString;
function GetFlags: TVmtAutoFlags;
function GetAddress: Pointer;
function GetParamCount: Integer;
function GetParam(Index: Integer): IVmtAutoParam;
function GetResultType: TVmtAutoType;
end;
TVmtInitEntry = class(TInterfacedObject, IVmtInitEntry)
private
fTable: PInitTable;
fOffset: Integer;
property Table: PInitTable read fTable;
public
constructor Create(Table: PInitTable; Offset: Integer = 0);
function GetOffset: Integer; // byte offset of field in object
function GetTypeName:TERRAString; // name of the field's type
function GetTypeKind: TTypeKind; // kind of the field's type
property Offset: Integer read GetOffset;
property TypeName:TERRAString read GetTypeName;
property TypeKind: TTypeKind read GetTypeKind;
end;
TVmtInitAggregate = class(TVmtInitEntry, IVmtInitAggregate)
function GetInitArray: PInitArray;
protected
property InitArray: PInitArray read GetInitArray;
function GetDataSize: Integer;
public
function GetCount: Integer; // number of sub-items
function GetInitializer(Index: Integer): IVmtInitEntry;
property Count: Integer read GetCount;
property Initializer[Index: Integer]: IVmtInitEntry read GetInitializer;
end;
TVmtInitRecord = class(TVmtInitAggregate, IVmtInitRecord)
public
function GetRecordSize: Integer;
property RecordSize: Integer read GetRecordSize;
end;
TVmtInitArray = class(TVmtInitAggregate, IVmtInitArray)
public
function GetElementSize: Integer;
property ElementSize: Integer read GetElementSize;
end;
TVmtMethod = class(TInterfacedObject, IVmtMethod)
private
fMethod: PMethod;
fParamCount: Integer;
procedure CountParams;
protected
function GetBaseSize: Integer; // size of Size, Address, and Name
function HasParamInfo: Boolean; // True if the method has parameter info
function GetParamData(Index: Integer): PMethodParam;
property Method: PMethod read fMethod;
public
constructor Create(Method: PMethod);
function GetAddress: Pointer;
function GetName:TERRAString;
function GetParamCount: Integer;
function GetParams(Index: Integer): IVmtMethodParam;
property Address: Pointer read GetAddress;
property Name:TERRAString read GetName;
property ParamCount: Integer read GetParamCount;
property Params[Index: Integer]: IVmtMethodParam read GetParams;
end;
TVmtField = class(TInterfacedObject, IVmtField)
private
fField: PField;
fClass: TClass;
protected
property Field: PField read fField;
public
constructor Create(Field: PField; FieldClass: TClass);
function GetOffset: Integer;
function GetClassIndex: Word;
function GetName:TERRAString;
function GetClass: TClass;
function GetType: IClassTypeInfo;
property Offset: Integer read GetOffset;
property ClassIndex: Word read GetClassIndex;
property Name:TERRAString read GetName;
property FieldClass: TClass read GetClass;
property FieldType: IClassTypeInfo read GetType;
end;
TVmtInfo = class(TInterfacedObject, IVmtInfo)
private
fVmt: PVmt;
fInitRecord: IVmtInitRecord;
function GetInitRecord: IVmtInitRecord;
protected
property Vmt: PVmt read fVmt;
property InitRecord: IVmtInitRecord read GetInitRecord;
public
constructor Create(ClassRef: TClass);
function GetInstanceSize: Integer;
function GetSafeCallException: Pointer;
function GetAfterConstruction: Pointer;
function GetBeforeDestruction: Pointer;
function GetDispatch: Pointer;
function GetDefaultHandler: Pointer;
function GetNewInstance: Pointer;
function GetFreeInstance: Pointer;
function GetDestroy: Pointer;
function GetFieldClassTable: Pointer;
function GetClass(Index: Integer): TClass;
function GetClassCount: Integer;
function GetClassName:TERRAString;
function GetClassType: TClass;
function GetDynamicTable: Pointer;
function GetDynamicAddress(Index: Integer): Pointer;
function GetDynamicNumber(Index: Integer): SmallInt;
function FindDynamicAddress(Number: SmallInt): Pointer;
function GetDynamicMethodCount: Integer;
function GetFieldTable: Pointer;
function GetField(Index: Integer): IVmtField;
function GetFieldType(Index: Integer): TClass;
function GetFieldCount: Integer;
function GetMethodTable: Pointer;
function GetMethod(Index: Integer): IVmtMethod;
function GetMethodCount: Integer;
function GetParentVmt: IVmtInfo;
function GetInitTable: Pointer;
function GetInitCount: Integer;
function GetInitEntry(Index: Integer): IVmtInitEntry;
function GetAutoTable: Pointer;
function GetAutoCount: Integer;
function GetAutoEntry(Index: Integer): IVmtAutoEntry;
function GetTypeInfo: PTypeInfo;
function GetIntfTable: Pointer;
function GetInterfaceCount: Integer;
function GetInterfaceEntry(Index: Integer): TInterfaceEntry;
function GetVmt: Pointer;
end;
TVmtTypeInfo = class(TInterfacedObject, ITypeInfo)
private
fTypeInfo: PTypeInfo;
fTypeData: PTypeData;
public
constructor Create(TypeInfo: PTypeInfo); virtual;
class function CreateTypeInfo(TypeInfo: PTypeInfo): TVmtTypeInfo;
function GetKind: TTypeKind;
function GetName:TERRAString;
function GetTypeInfo: PTypeInfo;
function GetTypeData: PTypeData;
property TypeInfo: PTypeInfo read fTypeInfo;
property TypeData: PTypeData read GetTypeData;
end;
TVmtOrdinalTypeInfo = class(TVmtTypeInfo, IOrdinalTypeInfo)
public
function GetOrdType: TOrdType;
end;
TVmtRangeTypeInfo = class(TVmtOrdinalTypeInfo, IRangeTypeInfo)
public
function GetMinValue: Integer;
function GetMaxValue: Integer;
end;
TVmtIntegerTypeInfo = class(TVmtRangeTypeInfo, IIntegerTypeInfo)
public
end;
TVmtCharTypeInfo = class(TVmtRangeTypeInfo, ICharTypeInfo)
public
function GetMinValue: Char;
function GetMaxValue: Char;
end;
TVmtWideCharTypeInfo = class(TVmtRangeTypeInfo, IWideCharTypeInfo)
public
function GetMinValue: WideChar;
function GetMaxValue: WideChar;
end;
TVmtEnumTypeInfo = class(TVmtRangeTypeInfo, IEnumTypeInfo)
private
fNames: TStrings;
property Names: TStrings read fNames;
public
constructor Create(TypeInfo: PTypeInfo); override;
Procedure Release; override;
function GetBaseType: IEnumTypeInfo;
function GetNames(Index: Integer):TERRAString;
function GetNameCount: Integer;
function IsSubRange: Boolean;
end;
TVmtSetTypeInfo = class(TVmtOrdinalTypeInfo, ISetTypeInfo)
public
function GetCompType: IEnumTypeInfo;
end;
TVmtInt64TypeInfo = class(TVmtTypeInfo, IInt64TypeInfo)
public
function GetMinValue: Int64;
function GetMaxValue: Int64;
end;
TVmtFloatTypeInfo = class(TVmtTypeInfo, IFloatTypeInfo)
public
function GetFloatType: TFloatType;
end;
TVmtShortStringTypeInfo = class(TVmtTypeInfo, IShortStringTypeInfo)
public
function GetMaxLength: Integer;
end;
TVmtPropInfo = class(TInterfacedObject, IPropInfo)
private
fPropInfo: PPropInfo;
property PropInfo: PPropInfo read fPropInfo;
public
constructor Create(PropInfo: PPropInfo);
function GetPropType: ITypeInfo;
function GetReader: Pointer;
function GetWriter: Pointer;
function GetStoredProc: Pointer;
function GetReaderType: TProcType;
function GetWriterType: TProcType;
function GetStoredType: TStoredType;
function GetReaderValue: Integer;
function GetWriterValue: Integer;
function GetStoredValue: Integer;
function GetIndex: Integer;
function GetDefault: LongInt;
function GetNameIndex: SmallInt;
function GetName:TERRAString;
function HasDefault: Boolean;
function HasIndex: Boolean;
end;
TVmtClassTypeInfo = class(TVmtTypeInfo, IClassTypeInfo)
private
fPropList: PPropList;
property PropList: PPropList read fPropList;
public
constructor Create(TypeInfo: PTypeInfo); override;
Procedure Release; override;
function GetClassType: TClass;
function GetParentInfo: IClassTypeInfo;
function GetPropCount: Integer;
function GetUnitName:TERRAString;
function GetProperties(Index: Integer): IPropInfo;
end;
TVmtParamInfo = class(TInterfacedObject, IParamInfo)
private
fParamData: PTERRAChar;
public
constructor Create(Data: Pointer);
function GetFlags: TParamFlags;
function GetName:TERRAString;
function GetTypeName:TERRAString;
end;
TVmtMethodTypeInfo = class(TVmtTypeInfo, IMethodTypeInfo)
private
fParams: array of Pointer;
fResultType: PShortString;
procedure GetParamList;
public
constructor Create(TypeInfo: PTypeInfo); override;
function GetMethodKind: TMethodKind;
function GetParamCount: Byte;
function GetParams(Index: Integer): IParamInfo;
function GetResultType:TERRAString;
end;
TVmtInterfaceTypeInfo = class(TVmtTypeInfo, IInterfaceTypeInfo)
public
function GetIntfParent: IInterfaceTypeInfo;
function GetIntfFlags: TIntfFlagsBase;
function GetGuid: TGUID;
function GetIntfUnit:TERRAString;
end;
TVmtMethodParam = class(TInterfacedObject, IVmtMethodParam)
private
fParam: PMethodParam;
protected
property Param: PMethodParam read fParam;
public
constructor Create(Param: PMethodParam);
function GetName:TERRAString;
function GetType: ITypeInfo;
function GetTypeInfo: PTypeInfo;
property Name:TERRAString read GetName;
property ParamType: ITypeInfo read GetType;
property TypeInfo: PTypeInfo read GetTypeInfo;
end;
function GetVmtInfo(ClassRef: TClass): IVmtInfo;
begin
Result := TVmtInfo.Create(ClassRef)
end;
function GetTypeInfo(TypeInfo: PTypeInfo): ITypeInfo;
begin
Result := TVmtTypeInfo.CreateTypeInfo(TypeInfo);
end;
{ TVmtInitEntry }
constructor TVmtInitEntry.Create(Table: PInitTable; Offset: Integer);
begin
inherited Create;
fTable := Table;
fOffset := Offset;
end;
function TVmtInitEntry.GetOffset: Integer;
begin
Result := fOffset;
end;
function TVmtInitEntry.GetTypeKind: TTypeKind;
begin
Result := TTypeKind(Table.TypeKind);
end;
function TVmtInitEntry.GetTypeName:TERRAString;
begin
Result := PShortString(@Table.Data)^;
end;
{ TVmtInitAggregate }
function TVmtInitAggregate.GetCount: Integer;
var
Ptr: PByte;
begin
if Table = nil then
Result := 0
else
begin
Ptr := PByte(@Table.Data);
{ Skip over the TypeName and the DataSize. }
Inc(Ptr, Ptr^ + 1 + SizeOf(Integer));
Result := PInteger(Ptr)^;
end;
end;
function TVmtInitAggregate.GetDataSize: Integer;
var
Ptr: PByte;
begin
Ptr := PByte(@Table.Data);
{ Skip over the TypeName. }
Inc(Ptr, Ptr^ + 1);
Result := PInteger(Ptr)^;
end;
function TVmtInitAggregate.GetInitArray: PInitArray;
var
Ptr: PByte;
begin
Ptr := PByte(@Table.Data);
{ Skip over the TypeName, DataSize, and Count. }
Inc(Ptr, Ptr^ + 1 + 2*SizeOf(Integer));
Result := PInitArray(Ptr);
end;
function TVmtInitAggregate.GetInitializer(Index: Integer): IVmtInitEntry;
var
Table: PInitTable;
Kind: TTypeKind;
begin
if (Index < 0) or (Index >= Count) then
IndexError(Index);
Table := InitArray[Index].InitTable^;
if Table = nil then
Kind := tkUnknown
else
Kind := TTypeKind(Table.TypeKind);
case Kind of
tkArray:
Result := TVmtInitArray.Create(InitArray[Index].InitTable^, InitArray[Index].Offset);
tkRecord:
Result := TVmtInitRecord.Create(InitArray[Index].InitTable^, InitArray[Index].Offset);
else
Result := TVmtInitAggregate.Create(InitArray[Index].InitTable^, InitArray[Index].Offset);
end;
end;
{ TVmtInitRecord }
function TVmtInitRecord.GetRecordSize: Integer;
begin
Result := GetDataSize
end;
{ TVmtInitArray }
function TVmtInitArray.GetElementSize: Integer;
begin
Result := GetDataSize
end;
{ TVmtInfo }
constructor TVmtInfo.Create(ClassRef: TClass);
begin
fVmt := PVmt(ClassRef);
Dec(fVmt);
end;
function TVmtInfo.GetClass(Index: Integer): TClass;
begin
if (Index < 0) or (Index >= GetClassCount) then
IndexError(Index);
Result := Vmt.FieldTable.FieldClassTable.Classes[Index]^;
end;
function TVmtInfo.GetClassCount: Integer;
begin
if Vmt.FieldTable = nil then
Result := 0
else
Result := Vmt.FieldTable.FieldClassTable.Count;
end;
function TVmtInfo.GetClassName:TERRAString;
begin
Result := Vmt.ClassName^;
end;
function TVmtInfo.GetClassType: TClass;
begin
Result := Vmt.SelfPtr;
end;
function TVmtInfo.GetDynamicMethodCount: Integer;
begin
if Vmt.DynMethodTable = nil then
Result := 0
else
Result := Vmt.DynMethodTable.Count;
end;
function TVmtInfo.GetField(Index: Integer): IVmtField;
var
I: Integer;
Offset: Integer;
Field: PField;
begin
if (Index < 0) or (Index >= GetFieldCount) then
IndexError(Index);
Offset := 0;
for I := 0 to Index-1 do
Offset := Offset +
SizeOf(Integer) +
SizeOf(Word) +
Length(PField(@Vmt.FieldTable.Fields[Offset]).Name) +
1 (* for the name length *);
Field := PField(@Vmt.FieldTable.Fields[Offset]);
Result := TVmtField.Create(Field, Vmt.FieldTable.FieldClassTable.Classes[Field.ClassIndex]^);
end;
function TVmtInfo.GetFieldCount: Integer;
begin
if Vmt.FieldTable = nil then
Result := 0
else
Result := Vmt.FieldTable.Count;
end;
function TVmtInfo.GetFieldType(Index: Integer): TClass;
begin
Result := GetClass(GetField(Index).ClassIndex)
end;
function TVmtInfo.GetInitCount: Integer;
begin
Result := InitRecord.Count;
end;
function TVmtInfo.GetInitEntry(Index: Integer): IVmtInitEntry;
begin
Result := InitRecord[Index];
end;
function TVmtInfo.GetMethod(Index: Integer): IVmtMethod;
var
I: Integer;
Method: PMethod;
begin
if (Index < 0) or (Index >= GetMethodCount) then
IndexError(Index);
Method := PMethod(@Vmt.MethodTable.Methods[0]);
for I := 1 to Index do
Method := PMethod(PTERRAChar(Method) + Method.Size);
Result := TVmtMethod.Create(Method);
end;
function TVmtInfo.GetMethodCount: Integer;
begin
if Vmt.MethodTable = nil then
Result := 0
else
Result := Vmt.MethodTable.Count;
end;
function TVmtInfo.GetParentVmt: IVmtInfo;
begin
if Vmt.ClassParent = nil then
Result := nil
else
Result := GetVmtInfo(Vmt.ClassParent^);
end;
function TVmtInfo.FindDynamicAddress(Number: SmallInt): Pointer;
var
I: Integer;
Indexes: PDynIndexes;
Addresses: PDynAddresses;
begin
Result := nil;
if Vmt.DynMethodTable = nil then
Exit;
Indexes := PDynIndexes(@Vmt.DynMethodTable.Data);
Addresses := PDynAddresses(PTERRAChar(Indexes) + GetDynamicMethodCount*SizeOf(SmallInt));
for I := 0 to GetDynamicMethodCount-1 do
if Indexes[I] = Number then
begin
Result := Addresses[I];
Break;
end;
end;
function TVmtInfo.GetDynamicAddress(Index: Integer): Pointer;
var
Ptr: PByte;
begin
if (Index < 0) or (Index >= GetDynamicMethodCount) then
IndexError(Index);
Ptr := PByte(@Vmt.DynMethodTable.Data);
Inc(Ptr, Vmt.DynMethodTable.Count * SizeOf(SmallInt));
Result := PDynAddresses(Ptr)[Index];
end;
function TVmtInfo.GetDynamicNumber(Index: Integer): SmallInt;
begin
if (Index < 0) or (Index >= GetDynamicMethodCount) then
IndexError(Index);
Result := PDynIndexes(@Vmt.DynMethodTable.Data)[Index];
end;
function TVmtInfo.GetInitRecord: IVmtInitRecord;
begin
if fInitRecord = nil then
fInitRecord := TVmtInitRecord.Create(Vmt.InitTable);
Result := fInitRecord;
end;
function TVmtInfo.GetAfterConstruction: Pointer;
begin
Result := Vmt.AfterConstruction;
end;
function TVmtInfo.GetBeforeDestruction: Pointer;
begin
Result := Vmt.BeforeDestruction
end;
function TVmtInfo.GetDefaultHandler: Pointer;
begin
Result := Vmt.DefaultHandler
end;
function TVmtInfo.GetDestroy: Pointer;
begin
Result := Vmt.Release
end;
function TVmtInfo.GetDispatch: Pointer;
begin
Result := Vmt.Dispatch
end;
function TVmtInfo.GetFreeInstance: Pointer;
begin
Result := Vmt.FreeInstance
end;
function TVmtInfo.GetInstanceSize: Integer;
begin
Result := Vmt.InstanceSize
end;
function TVmtInfo.GetNewInstance: Pointer;
begin
Result := Vmt.NewInstance
end;
function TVmtInfo.GetSafeCallException: Pointer;
begin
Result := Vmt.SafeCallException
end;
function TVmtInfo.GetVmt: Pointer;
begin
Result := Vmt;
end;
function TVmtInfo.GetAutoTable: Pointer;
begin
Result := Vmt.AutoTable
end;
function TVmtInfo.GetDynamicTable: Pointer;
begin
Result := Vmt.DynMethodTable
end;
function TVmtInfo.GetFieldClassTable: Pointer;
begin
if Vmt.FieldTable = nil then
Result := nil
else
Result := Vmt.FieldTable.FieldClassTable;
end;
function TVmtInfo.GetFieldTable: Pointer;
begin
Result := Vmt.FieldTable
end;
function TVmtInfo.GetInitTable: Pointer;
begin
Result := Vmt.InitTable
end;
function TVmtInfo.GetIntfTable: Pointer;
begin
Result := Vmt.IntfTable
end;
function TVmtInfo.GetMethodTable: Pointer;
begin
Result := Vmt.MethodTable
end;
function TVmtInfo.GetTypeInfo: PTypeInfo;
begin
Result := Vmt.TypeInfo
end;
function TVmtInfo.GetInterfaceCount: Integer;
begin
if Vmt.IntfTable = nil then
Result := 0
else
Result := Vmt.IntfTable.EntryCount;
end;
function TVmtInfo.GetInterfaceEntry(Index: Integer): TInterfaceEntry;
begin
if (Index < 0) or (Index >= GetInterfaceCount) then
IndexError(Index);
Result := Vmt.IntfTable.Entries[Index];
end;
function TVmtInfo.GetAutoCount: Integer;
begin
if Vmt.AutoTable = nil then
Result := 0
else
Result := Vmt.AutoTable.Count;
end;
function TVmtInfo.GetAutoEntry(Index: Integer): IVmtAutoEntry;
begin
if (Index < 0) or (Index >= GetAutoCount) then
IndexError(Index);
Result := TVmtAutoEntry.Create(@Vmt.AutoTable.Entries[Index]);
end;
{ TVmtAutoParam }
constructor TVmtAutoParam.Create(Param: TVmtAutoType);
begin
inherited Create;
fParam := Param;
end;
function TVmtAutoParam.GetAutoType: TVmtAutoType;
begin
Result := fParam and atTypeMask;
end;
function TVmtAutoParam.GetIsByRef: Boolean;
begin
Result := (fParam and atByRef) <> 0;
end;
{ TVmtAutoEntry }
constructor TVmtAutoEntry.Create(Entry: PAutoEntry);
begin
inherited Create;
fEntry := Entry;
end;
function TVmtAutoEntry.GetAddress: Pointer;
begin
Result := Entry.Address;
end;
function TVmtAutoEntry.GetDispID: Integer;
begin
Result := Entry.DispID;
end;
function TVmtAutoEntry.GetFlags: TVmtAutoFlags;
var
Tmp: Byte;
begin
Tmp := Entry.Flags;
Result := TVmtAutoFlags(Tmp);
end;
function TVmtAutoEntry.GetName:TERRAString;
begin
Result := Entry.Name^;
end;
function TVmtAutoEntry.GetParam(Index: Integer): IVmtAutoParam;
begin
if (Index < 0) or (Index >= GetParamCount) then
IndexError(Index);
Result := TVmtAutoParam.Create(Entry.Params.Types[Index]);
end;
function TVmtAutoEntry.GetParamCount: Integer;
begin
Result := Entry.Params.Count;
end;
function TVmtAutoEntry.GetResultType: TVmtAutoType;
begin
Result := TVmtAutoType(Entry.Params.ReturnType);
end;
{ TVmtTypeInfo }
constructor TVmtTypeInfo.Create(TypeInfo: PTypeInfo);
begin
inherited Create;
fTypeInfo := TypeInfo;
end;
function TVmtTypeInfo.GetKind: TTypeKind;
begin
Result := TypeInfo.Kind;
end;
function TVmtTypeInfo.GetName:TERRAString;
begin
Result := TypeInfo.Name;
end;
function TVmtTypeInfo.GetTypeData: PTypeData;
begin
if fTypeData = nil then
fTypeData := TypInfo.GetTypeData(TypeInfo);
Result := fTypeData;
end;
function TVmtTypeInfo.GetTypeInfo: PTypeInfo;
begin
Result := fTypeInfo;
end;
class function TVmtTypeInfo.CreateTypeInfo(TypeInfo: PTypeInfo): TVmtTypeInfo;
begin
case TypeInfo.Kind of
tkInteger:
Result := TVmtIntegerTypeInfo.Create(TypeInfo);
tkChar:
Result := TVmtCharTypeInfo.Create(TypeInfo);
tkWChar:
Result := TVmtWideCharTypeInfo.Create(TypeInfo);
tkInt64:
Result := TVmtInt64TypeInfo.Create(TypeInfo);
tkEnumeration:
Result := TVmtEnumTypeInfo.Create(TypeInfo);
tkFloat:
Result := TVmtFloatTypeInfo.Create(TypeInfo);
tkString:
Result := TVmtShortStringTypeInfo.Create(TypeInfo);
tkSet:
Result := TVmtSetTypeInfo.Create(TypeInfo);
tkClass:
Result := TVmtClassTypeInfo.Create(TypeInfo);
tkMethod:
Result := TVmtMethodTypeInfo.Create(TypeInfo);
tkInterface:
Result := TVmtInterfaceTypeInfo.Create(TypeInfo);
else
Result := TVmtTypeInfo.Create(TypeInfo);
end;
end;
// The hash value is the PTypeInfo pointer. Two type info interfaces are the
// same when their type info pointers are the same.
{ TVmtOrdinalTypeInfo }
function TVmtOrdinalTypeInfo.GetOrdType: TOrdType;
begin
Result := TypeData.OrdType;
end;
{ TVmtRangeTypeInfo }
function TVmtRangeTypeInfo.GetMaxValue: Integer;
begin
Result := TypeData.MaxValue;
end;
function TVmtRangeTypeInfo.GetMinValue: Integer;
begin
Result := TypeData.MinValue;
end;
{ TVmtIntegerTypeInfo }
function TVmtCharTypeInfo.GetMaxValue: Char;
begin
Result := Char(inherited GetMaxValue)
end;
function TVmtCharTypeInfo.GetMinValue: Char;
begin
Result := Char(inherited GetMinValue)
end;
{ TVmtWideCharTypeInfo }
function TVmtWideCharTypeInfo.GetMaxValue: WideChar;
begin
Result := WideChar(inherited GetMaxValue)
end;
function TVmtWideCharTypeInfo.GetMinValue: WideChar;
begin
Result := WideChar(inherited GetMinValue)
end;
{ TVmtEnumTypeInfo }
constructor TVmtEnumTypeInfo.Create(TypeInfo: PTypeInfo);
var
Ptr: PShortString;
I: Integer;
BaseTypeData: PTypeData;
begin
Assert(TypeInfo.Kind = tkEnumeration);
inherited;
// The names are stored with the base enumerated type. Copy the names
// into the subrange type. It's a little wasteful, but only a little.
fNames := TStringList.Create;
BaseTypeData := TypInfo.GetTypeData(TypeData.BaseType^);
Ptr := PShortString(@BaseTypeData.NameList);
for I := BaseTypeData.MinValue to BaseTypeData.MaxValue do
begin
Names.Add(Ptr^);
Ptr := PShortString(PTERRAChar(Ptr) + Length(Ptr^) + 1);
end;
end;
Procedure TVmtEnumTypeInfo.Release;
begin
fNames.Free;
fNames := nil;
inherited;
end;
function TVmtEnumTypeInfo.GetBaseType: IEnumTypeInfo;
begin
Result := TVmtEnumTypeInfo.Create(TypeData.BaseType^);
end;
function TVmtEnumTypeInfo.GetNameCount: Integer;
begin
Result := Names.Count;
end;
function TVmtEnumTypeInfo.GetNames(Index: Integer):TERRAString;
begin
Result := Names[Index];
end;
function TVmtEnumTypeInfo.IsSubRange: Boolean;
begin
Result := TypeData.BaseType^ <> TypeInfo;
end;
{ TVmtSetTypeInfo }
function TVmtSetTypeInfo.GetCompType: IEnumTypeInfo;
begin
Result := TVmtEnumTypeInfo.Create(TypeData.CompType^);
end;
{ TVmtInt64TypeInfo }
function TVmtInt64TypeInfo.GetMaxValue: Int64;
begin
Result := TypeData.MaxInt64Value
end;
function TVmtInt64TypeInfo.GetMinValue: Int64;
begin
Result := TypeData.MinInt64Value
end;
{ TVmtFloatTypeInfo }
function TVmtFloatTypeInfo.GetFloatType: TFloatType;
begin
Result := TypeData.FloatType;
end;
{ TVmtShortStringTypeInfo }
function TVmtShortStringTypeInfo.GetMaxLength: Integer;
begin
Result := TypeData.MaxLength;
end;
{ TVmtPropInfo }
constructor TVmtPropInfo.Create(PropInfo: PPropInfo);
begin
inherited Create;
fPropInfo := PropInfo;
end;
function TVmtPropInfo.GetDefault: LongInt;
begin
Result := PropInfo.Default
end;
function TVmtPropInfo.GetIndex: Integer;
begin
Result := PropInfo.Index
end;
function TVmtPropInfo.GetName:TERRAString;
begin
Result := PropInfo.Name
end;
function TVmtPropInfo.GetNameIndex: SmallInt;
begin
Result := PropInfo.NameIndex
end;
function TVmtPropInfo.GetPropType: ITypeInfo;
begin
Result := TVmtTypeInfo.CreateTypeInfo(PropInfo.PropType^);
end;
function GetProcType(Value: Pointer): TStoredType;
begin
if (Integer(Value) and $FFFFFF00) = 0 then
Result := ptConstant
else if (Integer(Value) and $FF000000) = $FE000000 then
Result := ptVirtualMethod
else if (Integer(Value) and $FF000000) = $FF000000 then
Result := ptField
else
Result := ptStaticMethod
end;
function GetProcValue(Value: Pointer): Integer;
begin
case GetProcType(Value) of
ptVirtualMethod, ptField:
Result := Integer(Value) and $00FFFFFF;
else
Result := Integer(Value);
end;
end;
function TVmtPropInfo.GetReader: Pointer;
begin
Result := PropInfo.GetProc
end;
function TVmtPropInfo.GetReaderType: TProcType;
begin
Result := GetProcType(GetReader)
end;
function TVmtPropInfo.GetReaderValue: Integer;
begin
Result := GetProcValue(GetReader)
end;
function TVmtPropInfo.GetStoredProc: Pointer;
begin
Result := PropInfo.StoredProc
end;
function TVmtPropInfo.GetStoredType: TStoredType;
begin
Result := GetProcType(GetStoredProc)
end;
function TVmtPropInfo.GetStoredValue: Integer;
begin
Result := GetProcValue(GetStoredProc)
end;
function TVmtPropInfo.GetWriter: Pointer;
begin
Result := PropInfo.SetProc
end;
function TVmtPropInfo.GetWriterType: TProcType;
begin
Result := GetProcType(GetWriter)
end;
function TVmtPropInfo.GetWriterValue: Integer;
begin
Result := GetProcValue(GetWriter)
end;
function TVmtPropInfo.HasDefault: Boolean;
begin
Result := GetDefault <> Low(LongInt);
end;
function TVmtPropInfo.HasIndex: Boolean;
begin
Result := GetIndex <> Low(Integer);
end;
{ TVmtClassTypeInfo }
constructor TVmtClassTypeInfo.Create(TypeInfo: PTypeInfo);
begin
Assert(TypeInfo.Kind = tkClass);
inherited;
GetMem(fPropList, GetPropCount * SizeOf(TPropInfo));
GetPropInfos(TypeInfo, PropList);
end;
Procedure TVmtClassTypeInfo.Release;
begin
FreeMem(PropList);
fPropList := nil;
inherited;
end;
function TVmtClassTypeInfo.GetClassType: TClass;
begin
Result := TypeData.ClassType
end;
function TVmtClassTypeInfo.GetParentInfo: IClassTypeInfo;
begin
Result := TVmtClassTypeInfo.Create(TypeData.ParentInfo^);
end;
function TVmtClassTypeInfo.GetPropCount: Integer;
begin
Result := TypeData.PropCount
end;
function TVmtClassTypeInfo.GetProperties(Index: Integer): IPropInfo;
begin
if (Index < 0) or (Index >= GetPropCount) then
IndexError(Index);
Result := TVmtPropInfo.Create(PropList[Index]);
end;
function TVmtClassTypeInfo.GetUnitName:TERRAString;
begin
Result := TypeData.UnitName
end;
{ TVmtParamInfo }
constructor TVmtParamInfo.Create(Data: Pointer);
begin
inherited Create;
fParamData := Data;
end;
function TVmtParamInfo.GetFlags: TParamFlags;
type
PParamFlags = ^TParamFlags;
begin
Result := PParamFlags(fParamData)^
end;
function TVmtParamInfo.GetName:TERRAString;
begin
Result := PShortString(fParamData + 1)^;
end;
function TVmtParamInfo.GetTypeName:TERRAString;
begin
Result := PShortString(fParamData + 1 + Length(GetName) + 1)^;
end;
{ TVmtMethodTypeInfo }
constructor TVmtMethodTypeInfo.Create(TypeInfo: PTypeInfo);
begin
Assert(TypeInfo.Kind = tkMethod);
inherited;
GetParamList;
end;
function TVmtMethodTypeInfo.GetMethodKind: TMethodKind;
begin
Result := TypeData.MethodKind
end;
function TVmtMethodTypeInfo.GetParamCount: Byte;
begin
Result := TypeData.ParamCount
end;
procedure TVmtMethodTypeInfo.GetParamList;
var
Ptr: PByte;
I: Integer;
begin
if fResultType = nil then
begin
SetLength(fParams, TypeData.ParamCount);
Ptr := PByte(@TypeData.ParamList);
for I := 0 to TypeData.ParamCount-1 do
begin
fParams[I] := Ptr;
Inc(Ptr, 1); // skip type flags;
Inc(Ptr, Ptr^ + 1); // skip param name
Inc(Ptr, Ptr^ + 1); // skip type name
end;
fResultType := PShortString(Ptr);
end;
end;
function TVmtMethodTypeInfo.GetParams(Index: Integer): IParamInfo;
begin
Result := TVmtParamInfo.Create(fParams[Index]);
end;
function TVmtMethodTypeInfo.GetResultType:TERRAString;
begin
Result := fResultType^;
end;
{ TVmtInterfaceTypeInfo }
function TVmtInterfaceTypeInfo.GetGuid: TGUID;
begin
Result := TypeData.Guid
end;
function TVmtInterfaceTypeInfo.GetIntfFlags: TIntfFlagsBase;
begin
Result := TypeData.IntfFlags
end;
function TVmtInterfaceTypeInfo.GetIntfParent: IInterfaceTypeInfo;
begin
Result := TVmtInterfaceTypeInfo.Create(TypeData.IntfParent^);
end;
function TVmtInterfaceTypeInfo.GetIntfUnit:TERRAString;
begin
Result := TypeData.IntfUnit
end;
{ TVmtField }
constructor TVmtField.Create(Field: PField; FieldClass: TClass);
begin
inherited Create;
fField := Field;
fClass := FieldClass;
end;
function TVmtField.GetClass: TClass;
begin
Result := fClass;
end;
function TVmtField.GetClassIndex: Word;
begin
Result := Field.ClassIndex;
end;
function TVmtField.GetName:TERRAString;
begin
Result := Field.Name;
end;
function TVmtField.GetOffset: Integer;
begin
Result := Field.Offset;
end;
function TVmtField.GetType: IClassTypeInfo;
begin
Result := TVmtClassTypeInfo.Create(FieldClass.ClassInfo);
end;
{ TVmtMethod }
constructor TVmtMethod.Create(Method: PMethod);
begin
inherited Create;
fMethod := Method;
CountParams;
end;
function TVmtMethod.GetAddress: Pointer;
begin
Result := Method.Address;
end;
function TVmtMethod.GetBaseSize: Integer;
begin
Result := SizeOf(Word) + SizeOf(Pointer) + Length(Method.Name) + 1;
end;
function TVmtMethod.GetName:TERRAString;
begin
Result := Method.Name;
end;
// The parameters begin 6 bytes after the base method record.
const
MethodPadding = 6;
procedure TVmtMethod.CountParams;
var
ParamPtr: PMethodParam;
ParamSize: Integer;
TotalSize: Integer;
begin
fParamCount := 0;
TotalSize := GetBaseSize + MethodPadding;
if Method.Size > TotalSize then
begin
ParamPtr := PMethodParam(PTERRAChar(Method) + TotalSize);
// Loop through all the method parameters.
while Method.Size - TotalSize > SizeOf(PTypeInfo) do
begin
// Increment the pointer past the TypeInfo pointer, the param name,
// its length, and a trailing #0 byte.
ParamSize := SizeOf(PTypeInfo) + Length(ParamPtr.Name) + 2;
ParamPtr := PMethodParam(PTERRAChar(ParamPtr) + ParamSize);
Inc(TotalSize, ParamSize);
Inc(fParamCount);
end;
end;
end;
function TVmtMethod.GetParamData(Index: Integer): PMethodParam;
var
I: Integer;
begin
if (Index < 0) or (Index >= GetParamCount) then
IndexError(Index);
Result := PMethodParam(PTERRAChar(Method) + GetBaseSize + MethodPadding);
for I := 0 to Index-1 do
// Increment the pointer past the TypeInfo pointer, the param name,
// its length, and a trailing #0 byte.
Result := PMethodParam(PTERRAChar(Result) +
SizeOf(PTypeInfo) + Length(Result.Name) + 2);
end;
function TVmtMethod.GetParams(Index: Integer): IVmtMethodParam;
begin
Result := TVmtMethodParam.Create(GetParamData(Index));
end;
function TVmtMethod.HasParamInfo: Boolean;
begin
Result := Method.Size > GetBaseSize;
end;
function TVmtMethod.GetParamCount: Integer;
begin
Result := fParamCount;
end;
{ TVmtMethodParam }
constructor TVmtMethodParam.Create(Param: PMethodParam);
begin
inherited Create;
fParam := Param;
end;
function TVmtMethodParam.GetName:TERRAString;
begin
Result := Param.Name;
end;
function TVmtMethodParam.GetType: ITypeInfo;
begin
Result := TVmtTypeInfo.CreateTypeInfo(TypeInfo);
end;
function TVmtMethodParam.GetTypeInfo: PTypeInfo;
begin
Result := Param.TypeInfo^
end;
end.
| 27.489242 | 96 | 0.714903 |
47c05146545fb2616b483a23a82e50e9667475fe | 11,728 | pas | Pascal | source/extends/go/mneGoClasses.pas | parmaja/minied | 6a027031ae1e266e7f2bf61e6c6a5cf3062de8b4 | [
"MIT"
]
| 46 | 2015-06-12T16:47:35.000Z | 2022-03-13T06:21:50.000Z | source/extends/go/mneGoClasses.pas | parmaja/minied | 6a027031ae1e266e7f2bf61e6c6a5cf3062de8b4 | [
"MIT"
]
| 86 | 2015-11-14T19:29:34.000Z | 2022-03-26T02:47:36.000Z | source/extends/go/mneGoClasses.pas | parmaja/minied | 6a027031ae1e266e7f2bf61e6c6a5cf3062de8b4 | [
"MIT"
]
| 19 | 2016-07-02T10:53:38.000Z | 2021-09-27T21:23:07.000Z | unit mneGoClasses;
{$mode objfpc}{$H+}
{**
* Mini Edit
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Zaher Goirkey <zaher at parmaja dot com>
*
*}
interface
uses
Messages, Forms, SysUtils, StrUtils, Variants, Classes, Controls, Graphics, LazFileUtils,
Contnrs, LCLintf, LCLType, Dialogs, EditorOptions, SynEditHighlighter,
SynEditSearch, SynEdit, Registry, EditorEngine, mnXMLRttiProfile, mnXMLUtils,
SynEditTypes, SynCompletion, SynHighlighterHashEntries, EditorProfiles,
gdbClasses, mnSynHighlighterGo,
EditorClasses, mneClasses, mnMsgBox,
mneCompilerProjectFrames, mneGoTendencyFrames, EditorRun,
mneRunFrames;
type
{ TGoFile }
TGoFile = class(TSourceEditorFile)
protected
public
procedure NewContent; override;
procedure OpenInclude; override;
function CanOpenInclude: Boolean; override;
end;
{ TGoFileCategory }
TGoFileCategory = class(TCodeFileCategory)
private
protected
procedure InitMappers; override;
function DoCreateHighlighter: TSynCustomHighlighter; override;
procedure InitCompletion(vSynEdit: TCustomSynEdit); override;
procedure DoAddKeywords; override;
public
end;
{ TGoProjectOptions }
TGoProjectOptions = class(TEditorProjectOptions)
private
FCompilerType: Integer;
public
procedure CreateOptionsFrame(AOwner: TComponent; AProject: TEditorProject; AddFrame: TAddFrameCallBack); override;
published
property CompilerType: Integer read FCompilerType write FCompilerType default 0;
end;
{ TGoTendency }
TGoTendency = class(TEditorTendency)
private
FUseCfg: boolean;
protected
function CreateDebugger: TEditorDebugger; override;
procedure Created; override;
procedure DoRun(Info: TmneRunInfo); override;
public
constructor Create; override;
function CreateOptions: TEditorProjectOptions; override;
procedure CreateOptionsFrame(AOwner: TComponent; ATendency: TEditorTendency; AddFrame: TAddFrameCallBack); override;
procedure SendMessage(S: string; vMessageType: TNotifyMessageType); override; //Please handle errors format in RunItems
published
property UseCfg: boolean read FUseCfg write FUseCfg default false;
end;
implementation
uses
IniFiles, mnStreams, mnUtils, mnSynHighlighterMultiProc, SynEditStrConst, mneGoProjectFrames, LCLProc;
{ TGoProject }
procedure TGoProjectOptions.CreateOptionsFrame(AOwner: TComponent; AProject: TEditorProject; AddFrame: TAddFrameCallBack);
var
aFrame: TFrame;
begin
aFrame := TCompilerProjectFrame.Create(AOwner);
(aFrame as TCompilerProjectFrame).Project := AProject;
aFrame.Caption := 'Compiler';
AddFrame(aFrame);
aFrame := TGoProjectFrame.Create(AOwner);
(aFrame as TGoProjectFrame).Project := AProject;
aFrame.Caption := 'Options';
AddFrame(aFrame);
end;
{ TGoFile }
procedure TGoFile.NewContent;
begin
SynEdit.Text := cGoSample;
end;
{ TGoFile }
procedure TGoFile.OpenInclude;
var
P: TPoint;
Attri: TSynHighlighterAttributes;
aToken: string;
aTokenType: integer;
aStart: integer;
function TryOpen: boolean;
begin
if (aToken[1] = '/') or (aToken[1] = '\') then
aToken := RightStr(aToken, Length(aToken) - 1);
aToken := Engine.ExpandFile(aToken);
Result := FileExists(aToken);
if Result then
Engine.Files.OpenFile(aToken);
end;
begin
inherited;
if Engine.Files.Current <> nil then
begin
if Engine.Files.Current.Group.Category is TGoFileCategory then
begin
P := SynEdit.CaretXY;
SynEdit.GetHighlighterAttriAtRowColEx(P, aToken, aTokenType, aStart, Attri);
aToken := DequoteStr(aToken);
//if (aToken <> '') and (TtkTokenKind(aTokenType) = tkString) then
begin
aToken := StringReplace(aToken, '/', '\', [rfReplaceAll, rfIgnoreCase]);
if not TryOpen then
begin
aToken := ExtractFileName(aToken);
TryOpen;
end;
end;
end;
end;
end;
function TGoFile.CanOpenInclude: Boolean;
var
P: TPoint;
Attri: TSynHighlighterAttributes;
aToken: string;
aTokenType: integer;
aStart: integer;
begin
Result := False;
if (Group <> nil) then
begin
if Group.Category is TGoFileCategory then
begin
P := SynEdit.CaretXY;
aToken := '';
SynEdit.GetHighlighterAttriAtRowColEx(P, aToken, aTokenType, aStart, Attri);
//Result := (aToken <> '') and (TtkTokenKind(aTokenType) = tkString);
end;
end;
end;
{ TGoTendency }
procedure TGoTendency.DoRun(Info: TmneRunInfo);
var
//i: Integer;
aPath: string;
aRunItem: TmneRunItem;
begin
Engine.Session.Run.Clear;
Engine.SendAction(eaClearOutput);
if rnaCompile in Info.Actions then
begin
aRunItem := Engine.Session.Run.Add;
aRunItem.Info.Run.Silent := True;
aRunItem.Info.Run.Command := Info.Command;
if aRunItem.Info.Run.Command = '' then
begin
{$ifdef windows}
aRunItem.Info.Run.Command := 'go.exe';
{$else}
aRunItem.Info.Run.Command := 'go';
{$endif}
end;
aRunItem.Info.Run.Silent := True;
aRunItem.MessageType := msgtInteractive;
aRunItem.Info.Title := ExtractFileNameWithoutExt(Info.MainFile);
aRunItem.Info.CurrentDirectory := Info.Root;
aRunItem.Info.Run.AddParam('build');
{if RunOptions.ConfigFile <> '' then
aRunItem.Info.Run.AddParam('@' + Engine.EnvReplace(RunOptions.ConfigFile))
else if UseCfg then
begin
if FileExists(ChangeFileExt(Info.MainFile, '.cfg')) then
aRunItem.Info.Run.AddParam('@' + ExtractFileNameWithoutExt(ExtractFileName(Info.MainFile))+'.cfg');
end;}
if Info.OutputFile <> '' then
aRunItem.Info.Run.AddParam('-o "' + Info.OutputFile+'"');
if rnaDebug in Info.Actions then
aRunItem.Info.Run.AddParam('-tags debug')
else
begin
aRunItem.Info.Run.AddParam('-tags release');
aRunItem.Info.Run.AddParam('-ldflags "-s -w"');
end;
{
for i := 0 to RunOptions.Paths.Count - 1 do
begin
aPath := Trim(RunOptions.Paths[i]);
if aPath <>'' then
begin
if RunOptions.ExpandPaths then
aPath := Engine.ExpandFile(aPath);
if not DirectoryExists(aPath) then
raise EEditorException.Create('Path not exists: ' + aPath);
aRunItem.Info.Run.AddParam('-I' + aPath);
end;
end;}
aPath := Info.MainFile;
if RunOptions.ExpandPaths then
aPath := Engine.ExpandFile(aPath);
if not FileExists(aPath) then
raise EEditorException.Create('File not exists: ' + aPath);
aRunItem.Info.Run.AddParam('"'+aPath+'"');
aRunItem.Info.StatusMessage := 'Compiling ' + Info.OutputFile;
end;
if rnaExecute in Info.Actions then
begin
aRunItem := Engine.Session.Run.Add;
aRunItem.Info.Run.Pause := Info.Pause;
aRunItem.Info.Run.Console := Info.Console;
aRunItem.Info.CurrentDirectory := Info.Root;
aRunItem.Info.StartDebug := rnaDebug in Info.Actions;
aRunItem.Info.Title := ExtractFileName(Info.OutputFile);
aRunItem.Info.Run.Command := Info.RunFile;
aRunItem.Info.Run.AddParam(RunOptions.Params);
aRunItem.Info.Run.AddParam(Engine.Session.Project.RunOptions.Params);
aRunItem.Info.StatusMessage := 'Running ' + Info.OutputFile;
end;
Engine.Session.Run.Start(Debugger, Info.Root);
end;
constructor TGoTendency.Create;
begin
inherited Create;
end;
procedure TGoTendency.CreateOptionsFrame(AOwner: TComponent; ATendency: TEditorTendency; AddFrame: TAddFrameCallBack);
var
aFrame: TRunFrameOptions;
aTendencyFrame: TGoTendencyFrame;
begin
aFrame := TRunFrameOptions.Create(AOwner);
aFrame.Options := ATendency.RunOptions;
aFrame.Caption := 'Options';
AddFrame(aFrame);
aTendencyFrame := TGoTendencyFrame.Create(AOwner);
aTendencyFrame.Tendency := ATendency;
aTendencyFrame.Caption := 'Go Options';
AddFrame(aTendencyFrame);
end;
function PosForward(S: string; vChar: string): Integer;
begin
Result := PosEx(vChar, S);
end;
function PosBackword(S: string; vChar: Char): Integer;
var
i: Integer;
begin
Result := -1;
for i := Length(S) downto 1 do
begin
if S[i] = vChar then
begin
Result := i;
break;
end;
end;
end;
procedure TGoTendency.SendMessage(S: string; vMessageType: TNotifyMessageType);
var
aMsg: TMessageInfo;
p: Integer;
begin
if (S <> '') and (vMessageType = msgtInteractive)
and (S[1] <> '#') then
begin
begin
aMsg := Default(TMessageInfo);
aMsg.Processed := True;
aMsg.MessageType := vMessageType;
p := PosForward(S, ':');
if p > 0 then
begin
aMsg.FileName := ExpandToPath(Trim(MidStr(s, 1, p - 1)), Engine.Session.Run.CurrentDirectory);
s := Trim(MidStr(S, p + 1, MaxInt));
p := PosForward(s, ':');
if p > 0 then
begin
aMsg.Line := StrToIntDef(MidStr(s, 1, p - 1), 0);
s := MidStr(s, p + 1, MaxInt);
p := PosForward(s, ':');
if p > 0 then
begin
aMsg.Column := StrToIntDef(MidStr(s, 1, p - 1), 0);
end;
end;
aMsg.Message1 := s;
end;
end;
Engine.SendMessage(S, aMsg);
end
else
inherited;
end;
function TGoTendency.CreateDebugger: TEditorDebugger;
begin
Result := TGDBDebug.Create;
end;
function TGoTendency.CreateOptions: TEditorProjectOptions;
begin
Result := TGoProjectOptions.Create;
end;
procedure TGoTendency.Created;
begin
FCapabilities := [capExecute, capDebug, capTrace, capCompile, capLink];
FHaveOptions := True;
FTitle := 'Go Lang';
FDescription := 'Go Files, *.Go';
FName := 'Go';
{$ifdef windows}
OutputExtension := '.exe';
{$endif}
FImageIndex := -1;
AddGroup('cfg', 'cfg');
AddGroup('ini', 'ini');
AddGroup('txt', 'txt');
end;
{ TGoFileCategory }
function TGoFileCategory.DoCreateHighlighter: TSynCustomHighlighter;
begin
Result := TSynGoSyn.Create(nil);
end;
procedure TGoFileCategory.InitCompletion(vSynEdit: TCustomSynEdit);
begin
inherited;
FCompletion.EndOfTokenChr := '${}()[].<>/\:!&*+-=%;';
IdentifierID := ord(mnSynHighlighterMultiProc.tkIdentifier);
end;
procedure TGoFileCategory.DoAddKeywords;
begin
EnumerateKeywords(Ord(tkKeyword), sGoKeywords, Highlighter.IdentChars, @DoAddCompletion);
EnumerateKeywords(Ord(tkFunction), sGoFunctions, Highlighter.IdentChars, @DoAddCompletion);
end;
procedure TGoFileCategory.InitMappers;
begin
with Highlighter as TSynGoSyn do
begin
Mapper.Add(WhitespaceAttri, attDefault);
Mapper.Add(CommentAttri, attComment);
Mapper.Add(KeywordAttri, attKeyword);
Mapper.Add(DocumentAttri, attDocument);
Mapper.Add(TypeAttri, attDataType);
Mapper.Add(FunctionAttri, attCommon);
Mapper.Add(IdentifierAttri, attIdentifier);
Mapper.Add(TextAttri, attText);
Mapper.Add(NumberAttri, attNumber);
Mapper.Add(StringAttri, attQuotedString);
Mapper.Add(SymbolAttri, attSymbol);
Mapper.Add(VariableAttri, attVariable);
Mapper.Add(ProcessorAttri, attDirective);
end;
end;
initialization
with Engine do
begin
Tendencies.Add(TGoTendency);
Categories.Add(TGoFileCategory.Create(TGoTendency, 'Go', 'Go language',[fckPublish]));
Groups.Add(TGoFile, 'Go', 'Go', TGoFileCategory, ['.go'], [fgkAssociated, fgkBrowsable, fgkMain], [capExecute, capDebug]);
end;
end.
| 28.328502 | 127 | 0.670873 |
fca810c553d3bd96f7aac2b24a1acc4feedd87c4 | 193 | pas | Pascal | Source/Services/Translate/Base/Model/AWS.Translate.Model.InvalidRequestException.pas | juliomar/aws-sdk-delphi | 995a0af808c7f66122fc6a04763d68203f8502eb | [
"Apache-2.0"
]
| 67 | 2021-07-28T23:47:09.000Z | 2022-03-15T11:48:35.000Z | Source/Services/Translate/Base/Model/AWS.Translate.Model.InvalidRequestException.pas | juliomar/aws-sdk-delphi | 995a0af808c7f66122fc6a04763d68203f8502eb | [
"Apache-2.0"
]
| 5 | 2021-09-01T09:31:16.000Z | 2022-03-16T18:19:21.000Z | Source/Services/Translate/Base/Model/AWS.Translate.Model.InvalidRequestException.pas | landgraf-dev/aws-sdk-delphi | 995a0af808c7f66122fc6a04763d68203f8502eb | [
"Apache-2.0"
]
| 13 | 2021-07-29T02:41:16.000Z | 2022-03-16T10:22:38.000Z | unit AWS.Translate.Model.InvalidRequestException;
interface
uses
AWS.Translate.Exception;
type
EInvalidRequestException = class(EAmazonTranslateException)
end;
implementation
end.
| 12.866667 | 61 | 0.80829 |
fcfc4cee8c2cbdac4bbecc08a62f92f5a396fde6 | 3,945 | dfm | Pascal | demos/Players/APEPlayer/Main.dfm | JoseJimeniz/newac | a755625536a3c5e42484e067300a8541fe2840b9 | [
"DOC",
"Unlicense"
]
| 1 | 2016-05-18T16:29:30.000Z | 2016-05-18T16:29:30.000Z | demos/Players/APEPlayer/Main.dfm | JoseJimeniz/newac | a755625536a3c5e42484e067300a8541fe2840b9 | [
"DOC",
"Unlicense"
]
| null | null | null | demos/Players/APEPlayer/Main.dfm | JoseJimeniz/newac | a755625536a3c5e42484e067300a8541fe2840b9 | [
"DOC",
"Unlicense"
]
| 1 | 2018-09-28T12:51:23.000Z | 2018-09-28T12:51:23.000Z | object Form1: TForm1
Left = 488
Top = 378
Caption = 'Monkey'#39's Audio Player'
ClientHeight = 182
ClientWidth = 326
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnClose = FormClose
PixelsPerInch = 96
TextHeight = 13
object Label4: TLabel
Left = 168
Top = 8
Width = 3
Height = 13
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
end
object Label6: TLabel
Left = 232
Top = 8
Width = 46
Height = 13
Caption = 'Total time'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
end
object Label7: TLabel
Left = 280
Top = 8
Width = 3
Height = 13
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
end
object Label8: TLabel
Left = 96
Top = 8
Width = 3
Height = 13
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
end
object Label1: TLabel
Left = 8
Top = 72
Width = 23
Height = 13
Caption = 'Artist'
end
object Label2: TLabel
Left = 8
Top = 88
Width = 29
Height = 13
Caption = 'Album'
end
object Label3: TLabel
Left = 8
Top = 104
Width = 20
Height = 13
Caption = 'Title'
end
object BitBtn1: TBitBtn
Left = 8
Top = 40
Width = 65
Height = 25
Caption = 'Play...'
TabOrder = 0
OnClick = BitBtn1Click
end
object BitBtn2: TBitBtn
Left = 88
Top = 40
Width = 49
Height = 25
Caption = 'Pause'
NumGlyphs = 2
TabOrder = 1
OnClick = BitBtn2Click
end
object BitBtn3: TBitBtn
Left = 152
Top = 40
Width = 49
Height = 25
Caption = 'Stop'
NumGlyphs = 2
TabOrder = 2
OnClick = BitBtn3Click
end
object StatusBar1: TStatusBar
Left = 0
Top = 163
Width = 326
Height = 19
Panels = <
item
Width = 50
end>
end
object Panel1: TPanel
Left = 0
Top = 149
Width = 326
Height = 14
Align = alBottom
BevelOuter = bvNone
TabOrder = 4
end
object ProgressBar1: TProgressBar
Left = 0
Top = 138
Width = 326
Height = 11
Align = alBottom
TabOrder = 5
end
object ForwardButton: TButton
Left = 216
Top = 40
Width = 33
Height = 25
Caption = '>>'
TabOrder = 6
OnClick = ForwardButtonClick
end
object BackwardButton: TButton
Left = 256
Top = 40
Width = 33
Height = 25
Caption = '<<'
TabOrder = 7
OnClick = BackwardButtonClick
end
object CheckBox1: TCheckBox
Left = 8
Top = 8
Width = 73
Height = 17
Caption = 'Loop'
TabOrder = 8
OnClick = CheckBox1Click
end
object OpenDialog1: TOpenDialog
Filter = 'Monkey'#39's Audio Files|*.ape'
Left = 80
Top = 120
end
object MACIn1: TMACIn
Loop = False
EndSample = -1
StartSample = 0
Left = 8
Top = 120
end
object DXAudioOut1: TDXAudioOut
Input = MACIn1
OnDone = AudioOut1Done
OnProgress = AudioOut1Progress
OnThreadException = DXAudioOut1ThreadException
DeviceNumber = 0
Latency = 80
PrefetchData = True
PollingInterval = 200
FramesInBuffer = 65536
SpeedFactor = 1.000000000000000000
Left = 48
Top = 120
end
end
| 19.924242 | 51 | 0.567047 |
c3640a8962d5ecc276d490a20b59c056193dbbca | 399 | pas | Pascal | ALG-1/lista_01/desafio_ex102/desafio_ex102.pas | leommartin/ERE-2-UFPR | b6dfe367507566b4bd7fa10aa15ed7567880a4d2 | [
"MIT"
]
| null | null | null | ALG-1/lista_01/desafio_ex102/desafio_ex102.pas | leommartin/ERE-2-UFPR | b6dfe367507566b4bd7fa10aa15ed7567880a4d2 | [
"MIT"
]
| null | null | null | ALG-1/lista_01/desafio_ex102/desafio_ex102.pas | leommartin/ERE-2-UFPR | b6dfe367507566b4bd7fa10aa15ed7567880a4d2 | [
"MIT"
]
| null | null | null | program desafio_ex102;
var centena,dezena,unidade,num,quarto_dig,new_num: longint;
begin
read(num);
centena:= num div 100;
dezena:= (num mod 100) div 10;
unidade:= num mod 10;
quarto_dig := centena + (3*dezena) + (5*unidade);
quarto_dig := quarto_dig mod 7;
new_num := centena*1000 + dezena*100+ unidade*10 + quarto_dig;
writeln(new_num);
end.
| 21 | 66 | 0.631579 |
cdc93d7add383ad82cb8c6c7e9834c6dea80031c | 1,374 | pas | Pascal | crypto/prng/t_rnd_93.pas | amikey/delphi-crypto | a79895f25bff69819f354e9bf27c19e2f00fed19 | [
"Unlicense"
]
| 6 | 2019-02-15T02:47:02.000Z | 2021-08-02T22:34:34.000Z | crypto/prng/t_rnd_93.pas | amikey/delphi-crypto | a79895f25bff69819f354e9bf27c19e2f00fed19 | [
"Unlicense"
]
| null | null | null | crypto/prng/t_rnd_93.pas | amikey/delphi-crypto | a79895f25bff69819f354e9bf27c19e2f00fed19 | [
"Unlicense"
]
| 7 | 2020-05-04T21:44:13.000Z | 2021-04-02T12:42:23.000Z | {Simple test for xor4096 unit, we Apr.2007}
program t_rnd_93;
{$i STD.INC}
{$ifdef win32}
{$ifndef VirtualPascal}
{$apptype console}
{$endif}
{$endif}
{$ifndef FPC}
{$N+}
{$endif}
uses
{$ifdef WINCRT}
wincrt,
{$endif}
hrtimer, xor4096;
const
LOOPS = 10;
var
ctx: xor4096_ctx;
{---------------------------------------------------------------------------}
function GenerateCycles: longint;
var
i: integer;
cyc0, cyc1, cyc2: comp;
t1,t2,c1,c2: longint;
begin
c1 := MaxLongint;
c2 := MaxLongint;
for i:=1 to LOOPS do begin
ReadTSC(cyc0);
xor4096_next(ctx);
ReadTSC(cyc1);
xor4096_next(ctx);
xor4096_next(ctx);
xor4096_next(ctx);
xor4096_next(ctx);
xor4096_next(ctx);
ReadTSC(cyc2);
t2 := round(cyc2-cyc1);
t1 := round(cyc1-cyc0);
if t1<c1 then c1 := t1;
if t2<c2 then c2 := t2;
end;
GenerateCycles := (c2-c1+1) shr 2;
end;
var
CBlk: longint;
CPB : double;
begin
writeln('Test for xor4096 unit (c) 2007 W.Ehrhardt');
writeln('xor4096 selftest: ',xor4096_selftest);
fillchar(ctx, sizeof(ctx),0);
xor4096_init(ctx, 0);
CBlK := GenerateCycles;
CPB := CBlk/4.0;
writeln(' CPU Frequency: ', CPUFrequency/1E6:1:1);
writeln(' Generate: ', CBlk);
writeln(' Cycles/Byte: ', CPB:1:1);
writeln(' MB/s: ', CPUFrequency/CPB/1E6:1:3);
end.
| 18.821918 | 77 | 0.582242 |
83eeff7d1e72ebe15223188ef3cf914dbfded693 | 33,186 | pas | Pascal | references/Grijjy-ErrorReporting/Grijjy.ErrorReporting.pas | juliomar/alcinoe | 4e59270f6a9258beed02676c698829e83e636b51 | [
"Apache-2.0"
]
| 851 | 2018-02-05T09:54:56.000Z | 2022-03-24T23:13:10.000Z | references/Grijjy-ErrorReporting/Grijjy.ErrorReporting.pas | jonahzheng/alcinoe | be21f1d6b9e22aa3d75faed4027097c1f444ee6f | [
"Apache-2.0"
]
| 200 | 2018-02-06T18:52:39.000Z | 2022-03-24T19:59:14.000Z | references/Grijjy-ErrorReporting/Grijjy.ErrorReporting.pas | jonahzheng/alcinoe | be21f1d6b9e22aa3d75faed4027097c1f444ee6f | [
"Apache-2.0"
]
| 197 | 2018-03-20T20:49:55.000Z | 2022-03-21T17:38:14.000Z | unit Grijjy.ErrorReporting;
{ Some building blocks for creating an exception logger for iOS or Android.
It traps unhandled exceptions and logs them with a stack trace (aka call
stack).
It can also trap exceptions on Windows and macOS, but it does not create a
call stack on those platforms. }
interface
uses
System.SysUtils,
System.Messaging;
type
{ Signature of the TApplication.OnException event }
TgoExceptionEvent = procedure(Sender: TObject; E: Exception) of object;
type
{ A single entry in a stack trace }
TgoCallStackEntry = record
public
{ The address of the code in the call stack. }
CodeAddress: UIntPtr;
{ The address of the start of the routine in the call stack. The CodeAddress
value always lies inside the routine that starts at RoutineAddress.
This, the value "CodeAddress - RoutineAddress" is the offset into the
routine in the call stack. }
RoutineAddress: UIntPtr;
{ The (base) address of the module where CodeAddress is found. }
ModuleAddress: UIntPtr;
{ The name of the routine at CodeAddress, if available. }
RoutineName: String;
{ The name of the module where CodeAddress is found. If CodeAddress is
somewhere inside your (Delphi) code, then this will be the name of the
executable module (or .so file on Android). }
ModuleName: String;
public
{ Clears the entry (sets everything to 0) }
procedure Clear;
end;
type
{ A call stack (aka stack trace) is just an array of call stack entries. }
TgoCallStack = TArray<TgoCallStackEntry>;
type
{ Represents an exception report. When an unhandled exception is encountered,
it creates an exception report and broadcasts is using a
TgoExceptionReportMessage }
IgoExceptionReport = interface
['{A949A858-3B30-4C39-9A18-AD2A86B4BD9F}']
{$REGION 'Internal Declarations'}
function _GetExceptionMessage: String;
function _GetExceptionLocation: TgoCallStackEntry;
function _GetCallStack: TgoCallStack;
function _GetReport: String;
{$ENDREGION 'Internal Declarations'}
{ The exception message (the value of the Exception.Message property) }
property ExceptionMessage: String read _GetExceptionMessage;
{ The location (address) of the exception. This is of type
TgoCallStackEntry, so it also contains information about where and in
which routine the exception happened. }
property ExceptionLocation: TgoCallStackEntry read _GetExceptionLocation;
{ The call stack (aka stack trace) leading up the the exception. This
also includes calls into the exception handler itself. }
property CallStack: TgoCallStack read _GetCallStack;
{ A textual version of the exception. Contains the exception messages as
well as a textual representation of the call stack. }
property Report: String read _GetReport;
end;
type
{ A type of TMessage that is used to broadcast exception reports.
Subscribe to this message (using
TMessageManager.DefaultManager.SubscribeToMessage) to get notified about
exception reports.
@bold(Important): This message is sent from the thread where the exception
occured, which may not always be the UI thread. So don't update the UI from
this message, or synchronize it with the main thread. }
TgoExceptionReportMessage = class(TMessage)
{$REGION 'Internal Declarations'}
private
FReport: IgoExceptionReport;
{$ENDREGION 'Internal Declarations'}
public
{ Used internally to create the message. }
constructor Create(const AReport: IgoExceptionReport);
{ The exception report. }
property Report: IgoExceptionReport read FReport;
end;
type
{ Main class for reporting exceptions. To enable exception reporting, you
need to do the following:
* Let the exception logger capture unhandled FMX exceptions by calling:
Application.OnException := TgoExceptionReporter.ExceptionHandler;
* Subscribe to the TgoExceptionReportMessage message to get notified of
exception reports:
TMessageManager.DefaultManager.SubscribeToMessage(
TgoExceptionReportMessage, HandleExceptionReport);
* In this message handler, you can handle the report in any way you want.
For example:
* You can email it to your development team.
* You can send it to your cloud backend.
* You can show it to the user. However, note that the message may be sent
from another thread than the UI thread, so you need to synchronize any
UI calls with the main thread.
* You can send it to a service like HockeyApp.
* etc.
However, because the app may be unstable now (depending on the type of
exception) it may be safest to just write the report to disk and terminate
the app (by calling Halt). Then, the next time the app starts up, and can
check for this file and handle the report at that point.
NOTE FOR ANDROID: For symbolication to work on Android, you need to set the
following linker option:
* Go to "Project | Options..."
* Select the target "All configurations - Android platform"
* Go to the page "Delphi Compiler | Linking"
* Set "Options passed to the LD linker" to:
--version-script=goExports.vsr
Make sure goExports.vsr is available in the search path, or set it using
an absolute or relative path, as in:
--version-script=..\goExports.vsr
If you only want symbolication for your Release (play store) build, then
select the target "Release configuration - Android platform" instead (or any
other configuration you want). }
TgoExceptionReporter = class
{$REGION 'Internal Declarations'}
private class var
FInstance: TgoExceptionReporter;
class function GetExceptionHandler: TgoExceptionEvent; static;
class function GetMaxCallStackDepth: Integer; static;
class procedure SetMaxCallStackDepth(const Value: Integer); static;
private
FMaxCallStackDepth: Integer;
FModuleAddress: UIntPtr;
FReportingException: Boolean;
private
constructor InternalCreate(const ADummy: Integer = 0);
procedure ReportException(const AExceptionObject: TObject;
const AExceptionAddress: Pointer);
private
class function GetCallStack(const AStackInfo: Pointer): TgoCallStack; static;
class function GetCallStackEntry(var AEntry: TgoCallStackEntry): Boolean; static;
private
{ Global hooks }
procedure GlobalHandleException(Sender: TObject; E: Exception);
class procedure GlobalExceptionAcquiredHandler(Obj: {$IFDEF AUTOREFCOUNT}TObject{$ELSE}Pointer{$ENDIF}); static;
class procedure GlobalExceptHandler(ExceptObject: TObject; ExceptAddr: Pointer); static;
class function GlobalGetExceptionStackInfo(P: PExceptionRecord): Pointer; static;
class procedure GlobalCleanUpStackInfo(Info: Pointer); static;
{$ENDREGION 'Internal Declarations'}
public
{ Don't call the constructor manually. This is a singleton. }
constructor Create;
{ Set to Application.OnException handler event to this value to report
unhandled exceptions in the main (UI) thread.
For example:
Application.OnException := TgoExceptionReporter.ExceptionHandler; }
class property ExceptionHandler: TgoExceptionEvent read GetExceptionHandler;
{ Maximum depth of the call stack that is retrieved when an exception
occurs. Defaults to 20.
Every time an exception is raised, we retrieve a call stack. This adds a
little overhead, but raising exceptions is already an "expensive"
operation anyway.
You can limit this overhead by decreasing the maximum number of entries
in the call stack. You can also increase this number of you want a more
detailed call stack.
Set to 0 to disable call stacks altogether. }
class property MaxCallStackDepth: Integer read GetMaxCallStackDepth write SetMaxCallStackDepth;
end;
implementation
uses
System.Classes,
{$IF Defined(IOS) or Defined(ANDROID)}
Posix.Dlfcn,
Posix.Stdlib,
{$ENDIF}
Grijjy.SymbolTranslator;
{$RANGECHECKS OFF}
type
TgoExceptionReport = class(TInterfacedObject, IgoExceptionReport)
private
FCallStack: TgoCallStack;
FExceptionLocation: TgoCallStackEntry;
FExceptionMessage: String;
FReport: String;
private
function BuildReport: String;
class function AddressToString(const AAddress: UIntPtr): String; static;
protected
{ IgoExceptionReport }
function _GetExceptionMessage: String;
function _GetExceptionLocation: TgoCallStackEntry;
function _GetCallStack: TgoCallStack;
function _GetReport: String;
public
constructor Create(const AExceptionMessage: String;
const AExceptionLocation: TgoCallStackEntry;
const ACallStack: TgoCallStack);
end;
{ TgoExceptionReport }
class function TgoExceptionReport.AddressToString(
const AAddress: UIntPtr): String;
begin
{$IFDEF CPU64BITS}
Result := '$' + IntToHex(AAddress, 16);
{$ELSE}
Result := '$' + IntToHex(AAddress, 8);
{$ENDIF}
end;
function TgoExceptionReport.BuildReport: String;
var
SB: TStringBuilder;
Entry: TgoCallStackEntry;
begin
SB := TStringBuilder.Create;
try
SB.AppendLine(FExceptionMessage);
SB.Append('At address: ');
SB.Append(AddressToString(FExceptionLocation.CodeAddress));
if (FExceptionLocation.RoutineName <> '') then
begin
SB.Append(' (');
SB.Append(FExceptionLocation.RoutineName);
SB.Append(' + ');
SB.Append(FExceptionLocation.CodeAddress - FExceptionLocation.RoutineAddress);
SB.AppendLine(')');
end
else
SB.AppendLine;
SB.AppendLine;
if (FCallStack <> nil) then
begin
SB.AppendLine('Call stack:');
for Entry in FCallStack do
begin
SB.AppendFormat('%-25s %s', [ExtractFilename(Entry.ModuleName),
AddressToString(Entry.CodeAddress)]);
if (Entry.RoutineName <> '') then
begin
SB.Append(' ');
SB.Append(Entry.RoutineName);
SB.Append(' + ');
SB.Append(Entry.CodeAddress - Entry.RoutineAddress);
end;
SB.AppendLine;
end;
end;
Result := SB.ToString;
finally
SB.Free;
end;
end;
constructor TgoExceptionReport.Create(const AExceptionMessage: String;
const AExceptionLocation: TgoCallStackEntry; const ACallStack: TgoCallStack);
begin
inherited Create;
FExceptionMessage := AExceptionMessage;
FExceptionLocation := AExceptionLocation;
FCallStack := ACallStack;
end;
function TgoExceptionReport._GetCallStack: TgoCallStack;
begin
Result := FCallStack;
end;
function TgoExceptionReport._GetExceptionLocation: TgoCallStackEntry;
begin
Result := FExceptionLocation;
end;
function TgoExceptionReport._GetExceptionMessage: String;
begin
Result := FExceptionMessage;
end;
function TgoExceptionReport._GetReport: String;
begin
if (FReport = '') then
FReport := BuildReport;
Result := FReport;
end;
{ TgoExceptionReportMessage }
constructor TgoExceptionReportMessage.Create(const AReport: IgoExceptionReport);
begin
inherited Create;
FReport := AReport;
end;
{ TgoCallStackEntry }
procedure TgoCallStackEntry.Clear;
begin
CodeAddress := 0;
RoutineAddress := 0;
ModuleAddress := 0;
RoutineName := '';
ModuleName := '';
end;
{ TgoExceptionReporter }
constructor TgoExceptionReporter.Create;
begin
raise EInvalidOperation.Create('Invalid singleton constructor call');
end;
class function TgoExceptionReporter.GetExceptionHandler: TgoExceptionEvent;
begin
{ HandleException is usually called in response to the FMX
Application.OnException event, which is called for exceptions that aren't
handled in the main thread. This event is only fired for exceptions that
occur in the main (UI) thread though. }
if Assigned(FInstance) then
Result := FInstance.GlobalHandleException
else
Result := nil;
end;
class function TgoExceptionReporter.GetMaxCallStackDepth: Integer;
begin
if Assigned(FInstance) then
Result := FInstance.FMaxCallStackDepth
else
Result := 20;
end;
class procedure TgoExceptionReporter.GlobalCleanUpStackInfo(Info: Pointer);
begin
{ Free memory allocated by GlobalGetExceptionStackInfo }
if (Info <> nil) then
FreeMem(Info);
end;
class procedure TgoExceptionReporter.GlobalExceptHandler(ExceptObject: TObject;
ExceptAddr: Pointer);
begin
if Assigned(FInstance) then
FInstance.ReportException(ExceptObject, ExceptAddr);
end;
class procedure TgoExceptionReporter.GlobalExceptionAcquiredHandler(
Obj: {$IFDEF AUTOREFCOUNT}TObject{$ELSE}Pointer{$ENDIF});
begin
if Assigned(FInstance) then
FInstance.ReportException(Obj, ExceptAddr);
end;
procedure TgoExceptionReporter.GlobalHandleException(Sender: TObject; E: Exception);
begin
ReportException(E, ExceptAddr);
end;
constructor TgoExceptionReporter.InternalCreate(const ADummy: Integer);
{$IF Defined(IOS) or Defined(ANDROID)}
var
Info: dl_info;
{$ENDIF}
begin
inherited Create;
FMaxCallStackDepth := 20;
{ Assign the global ExceptionAcquired procedure to our own implementation (it
is nil by default). This procedure gets called for unhandled exceptions that
happen in other threads than the main thread. }
ExceptionAcquired := @GlobalExceptionAcquiredHandler;
{ The global ExceptProc method can be called for certain unhandled exception.
By default, it calls the ExceptHandler procedure in the System.SysUtils
unit, which shows the exception message and terminates the app.
We set it to our own implementation. }
ExceptProc := @GlobalExceptHandler;
{ We hook into the global static GetExceptionStackInfoProc and
CleanUpStackInfoProc methods of the Exception class to provide a call stack
for the exception. These methods are unassigned by default.
The Exception.GetExceptionStackInfoProc method gets called soon after the
exception is created, before the call stack is unwound. This is the only
place where we can get the call stack at the point closest to the exception
as possible. The Exception.CleanUpStackInfoProc just frees the memory
allocated by GetExceptionStackInfoProc. }
Exception.GetExceptionStackInfoProc := GlobalGetExceptionStackInfo;
Exception.CleanUpStackInfoProc := GlobalCleanUpStackInfo;
{$IF Defined(IOS) or Defined(ANDROID)}
{ Get address of current module. We use this to see if an entry in the call
stack is part of this module.
We use the dladdr API as a "trick" to get the address of this method, which
is obviously part of this module. }
if (dladdr(UIntPtr(@TgoExceptionReporter.InternalCreate), Info) <> 0) then
FModuleAddress := UIntPtr(Info.dli_fbase);
{$ENDIF}
end;
procedure TgoExceptionReporter.ReportException(const AExceptionObject: TObject;
const AExceptionAddress: Pointer);
var
E: Exception;
ExceptionMessage: String;
CallStack: TgoCallStack;
ExceptionLocation: TgoCallStackEntry;
Report: IgoExceptionReport;
I: Integer;
begin
{ Ignore exception that occur while we are already reporting another
exception. That can happen when the original exception left the application
in such a state that other exceptions would happen (cascading errors). }
if (FReportingException) then
Exit;
FReportingException := True;
try
CallStack := nil;
if (AExceptionObject = nil) then
ExceptionMessage := 'Unknown Error'
else if (AExceptionObject is EAbort) then
Exit // do nothing
else if (AExceptionObject is Exception) then
begin
E := Exception(AExceptionObject);
ExceptionMessage := E.Message;
if (E.StackInfo <> nil) then
begin
CallStack := GetCallStack(E.StackInfo);
for I := 0 to Length(Callstack) - 1 do
begin
{ If entry in call stack is for this module, then try to translate
the routine name to Pascal. }
if (CallStack[I].ModuleAddress = FModuleAddress) then
CallStack[I].RoutineName := goCppSymbolToPascal(CallStack[I].RoutineName);
end;
end;
end
else
ExceptionMessage := 'Unknown Error (' + AExceptionObject.ClassName + ')';
ExceptionLocation.Clear;
ExceptionLocation.CodeAddress := UIntPtr(AExceptionAddress);
GetCallStackEntry(ExceptionLocation);
if (ExceptionLocation.ModuleAddress = FModuleAddress) then
ExceptionLocation.RoutineName := goCppSymbolToPascal(ExceptionLocation.RoutineName);
Report := TgoExceptionReport.Create(ExceptionMessage, ExceptionLocation, CallStack);
try
TMessageManager.DefaultManager.SendMessage(Self,
TgoExceptionReportMessage.Create(Report));
except
{ Ignore any exceptions in the report message handler. }
end;
finally
FReportingException := False;
end;
end;
class procedure TgoExceptionReporter.SetMaxCallStackDepth(const Value: Integer);
begin
if Assigned(FInstance) then
FInstance.FMaxCallStackDepth := Value;
end;
{$IF Defined(IOS)}
(*****************************************************************************)
(*** iOS specific ************************************************************)
(*****************************************************************************)
const
libSystem = '/usr/lib/libSystem.dylib';
function backtrace(buffer: PPointer; size: Integer): Integer;
external libSystem name 'backtrace';
function cxa_demangle(const mangled_name: MarshaledAString;
output_buffer: MarshaledAString; length: NativeInt;
out status: Integer): MarshaledAString; cdecl;
external libSystem name '__cxa_demangle';
type
TCallStack = record
{ Number of entries in the call stack }
Count: Integer;
{ The entries in the call stack }
Stack: array [0..0] of UIntPtr;
end;
PCallStack = ^TCallStack;
class function TgoExceptionReporter.GlobalGetExceptionStackInfo(
P: PExceptionRecord): Pointer;
var
CallStack: PCallStack;
begin
{ Don't call into FInstance here. That would only add another entry to the
call stack. Instead, retrieve the entire call stack from within this method.
Just return nil if we are already reporting an exception, or call stacks
are disabled. }
if (FInstance = nil) or (FInstance.FReportingException) or (FInstance.FMaxCallStackDepth <= 0) then
Exit(nil);
{ Allocate a PCallStack record large enough to hold just MaxCallStackDepth
entries }
GetMem(CallStack, SizeOf(Integer{TCallStack.Count}) +
FInstance.FMaxCallStackDepth * SizeOf(Pointer));
{ Use backtrace API to retrieve call stack }
CallStack.Count := backtrace(@CallStack.Stack, FInstance.FMaxCallStackDepth);
Result := CallStack;
end;
class function TgoExceptionReporter.GetCallStack(
const AStackInfo: Pointer): TgoCallStack;
var
CallStack: PCallStack;
I: Integer;
begin
{ Convert TCallStack to TgoCallStack }
CallStack := AStackInfo;
SetLength(Result, CallStack.Count);
for I := 0 to CallStack.Count - 1 do
begin
Result[I].CodeAddress := CallStack.Stack[I];
GetCallStackEntry(Result[I]);
end;
end;
{$ELSEIF Defined(ANDROID64)}
(*****************************************************************************)
(*** Android64 specific ******************************************************)
(*****************************************************************************)
function cxa_demangle(const mangled_name: MarshaledAString;
output_buffer: MarshaledAString; length: NativeInt;
out status: Integer): MarshaledAString; cdecl;
external 'libc++abi.a' name '__cxa_demangle';
type
_PUnwind_Context = Pointer;
_Unwind_Ptr = UIntPtr;
type
_Unwind_Reason_code = Integer;
const
_URC_NO_REASON = 0;
_URC_FOREIGN_EXCEPTION_CAUGHT = 1;
_URC_FATAL_PHASE2_ERROR = 2;
_URC_FATAL_PHASE1_ERROR = 3;
_URC_NORMAL_STOP = 4;
_URC_END_OF_STACK = 5;
_URC_HANDLER_FOUND = 6;
_URC_INSTALL_CONTEXT = 7;
_URC_CONTINUE_UNWIND = 8;
type
_Unwind_Trace_Fn = function(context: _PUnwind_Context; userdata: Pointer): _Unwind_Reason_code; cdecl;
const
LIB_UNWIND = 'libunwind.a';
procedure _Unwind_Backtrace(fn: _Unwind_Trace_Fn; userdata: Pointer); cdecl; external LIB_UNWIND;
function _Unwind_GetIP(context: _PUnwind_Context): _Unwind_Ptr; cdecl; external LIB_UNWIND;
type
TCallStack = record
{ Number of entries in the call stack }
Count: Integer;
{ The entries in the call stack }
Stack: array [0..0] of UIntPtr;
end;
PCallStack = ^TCallStack;
function UnwindCallback(AContext: _PUnwind_Context; AUserData: Pointer): _Unwind_Reason_code; cdecl;
var
Callstack: PCallstack;
begin
Callstack := AUserData;
if (TgoExceptionReporter.FInstance = nil) or (Callstack.Count >= TgoExceptionReporter.FInstance.FMaxCallStackDepth) then
Exit(_URC_END_OF_STACK);
Callstack.Stack[Callstack.Count] := _Unwind_GetIP(AContext);
Inc(Callstack.Count);
Result := _URC_NO_REASON;
end;
class function TgoExceptionReporter.GlobalGetExceptionStackInfo(
P: PExceptionRecord): Pointer;
var
CallStack: PCallStack;
begin
{ Don't call into FInstance here. That would only add another entry to the
call stack. Instead, retrieve the entire call stack from within this method.
Just return nil if we are already reporting an exception, or call stacks
are disabled. }
if (FInstance = nil) or (FInstance.FReportingException) or (FInstance.FMaxCallStackDepth <= 0) then
Exit(nil);
{ Allocate a PCallStack record large enough to hold just MaxCallStackDepth
entries }
GetMem(CallStack, SizeOf(Integer{TCallStack.Count}) +
FInstance.FMaxCallStackDepth * SizeOf(Pointer));
{ Use _Unwind_Backtrace API to retrieve call stack }
CallStack.Count := 0;
_Unwind_Backtrace(UnwindCallback, Callstack);
Result := CallStack;
end;
class function TgoExceptionReporter.GetCallStack(
const AStackInfo: Pointer): TgoCallStack;
var
CallStack: PCallStack;
I: Integer;
begin
{ Convert TCallStack to TgoCallStack }
CallStack := AStackInfo;
SetLength(Result, CallStack.Count);
for I := 0 to CallStack.Count - 1 do
begin
Result[I].CodeAddress := CallStack.Stack[I];
GetCallStackEntry(Result[I]);
end;
end;
{$ELSEIF Defined(ANDROID)}
(*****************************************************************************)
(*** Android specific ********************************************************)
(*****************************************************************************)
type
TGetFramePointer = function: NativeUInt; cdecl;
const
{ We need a function to get the frame pointer. The address of this frame
pointer is stored in register R7.
In assembly code, the function would look like this:
ldr R0, [R7] // Retrieve frame pointer
bx LR // Return to caller
The R0 register is used to store the function result.
The "bx LR" line means "return to the address stored in the LR register".
The LR (Link Return) register is set by the calling routine to the address
to return to.
We could create a text file with this code, assemble it to a static library,
and link that library into this unit. However, since the routine is so
small, it assembles to just 8 bytes, which we store in an array here. }
GET_FRAME_POINTER_CODE: array [0..7] of Byte = (
$00, $00, $97, $E5, // ldr R0, [R7]
$1E, $FF, $2F, $E1); // bx LR
var
{ Now define a variable of a procedural type, that is assigned to the
assembled code above }
GetFramePointer: TGetFramePointer = @GET_FRAME_POINTER_CODE;
function cxa_demangle(const mangled_name: MarshaledAString;
output_buffer: MarshaledAString; length: NativeInt;
out status: Integer): MarshaledAString; cdecl;
external {$IF (RTLVersion < 34)}'libgnustl_static.a'{$ELSE}'libc++abi.a'{$ENDIF} name '__cxa_demangle';
type
{ For each entry in the call stack, we save 7 values for inspection later.
See GlobalGetExceptionStackInfo for explaination. }
TStackValues = array [0..6] of UIntPtr;
type
TCallStack = record
{ Number of entries in the call stack }
Count: Integer;
{ The entries in the call stack }
Stack: array [0..0] of TStackValues;
end;
PCallStack = ^TCallStack;
class function TgoExceptionReporter.GlobalGetExceptionStackInfo(
P: PExceptionRecord): Pointer;
const
{ On most Android systems, each thread has a stack of 1MB }
MAX_STACK_SIZE = 1024 * 1024;
var
MaxCallStackDepth, Count: Integer;
FramePointer, MinStack, MaxStack: UIntPtr;
Address: Pointer;
CallStack: PCallStack;
begin
{ Don't call into FInstance here. That would only add another entry to the
call stack. Instead, retrieve the entire call stack from within this method.
Just return nil if we are already reporting an exception, or call stacks
are disabled. }
if (FInstance = nil) or (FInstance.FReportingException) or (FInstance.FMaxCallStackDepth <= 0) then
Exit(nil);
MaxCallStackDepth := FInstance.FMaxCallStackDepth;
{ Allocate a PCallStack record large enough to hold just MaxCallStackDepth
entries }
GetMem(CallStack, SizeOf(Integer{TCallStack.Count}) +
MaxCallStackDepth * SizeOf(TStackValues));
(*We manually walk the stack to create a stack trace. This is possible since
Delphi creates a stack frame for each routine, by starting each routine with
a prolog. This prolog is similar to the one used by the iOS ABI (Application
Binary Interface, see
https://developer.apple.com/library/content/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARMv7FunctionCallingConventions.html
The prolog looks like this:
* Push all registers that need saving. Always push the R7 and LR registers.
* Set R7 (frame pointer) to the location in the stack where the previous
value of R7 was just pushed.
A minimal prolog (used in many small functions) looks like this:
push {R7, LR}
mov R7, SP
We are interested in the value of the LR (Link Return) register. This
register contains the address to return to after the routine finishes. We
can use this address to look up the symbol (routine name). Using the
example prolog above, we can get to the LR value and walk the stack like
this:
1. Set FramePointer to the value of the R7 register.
2. At this location in the stack, you will find the previous value of the
R7 register. Lets call this PreviousFramePointer.
3. At the next location in the stack, we will find the LR register. Add its
value to our stack trace so we can use it later to look up the routine
name at this address.
4. Set FramePointer to PreviousFramePointer and go back to step 2, until
FramePointer is 0 or falls outside of the stack.
Unfortunately, Delphi doesn't follow the iOS ABI exactly, and it may push
other registers between R7 and LR. For example:
push {R4, R5, R6, R7, R8, R9, LR}
add R7, SP, #12
Here, it pushed 3 registers (R4-R6) before R7, so in the second line it sets
R7 to point 12 bytes into the stack (so it still points to the previous R7,
as required). However, it also pushed registers R8 and R9, before it pushes
the LR register. This means we cannot assume that the LR register will be
directly located after the R7 register in the stack. There may be (up to 6)
registers in between. We don't know which one represents LR, so we just
store all 7 values after R7, and later try to figure out which one
represents LR (in the GetCallStack method). *)
FramePointer := GetFramePointer;
{ The stack grows downwards, so all entries in the call stack leading to this
call have addresses greater than FramePointer. We don't know what the start
and end address of the stack is for this thread, but we do know that the
stack is at most 1MB in size, so we only investigate entries from
FramePointer to FramePointer + 1MB. }
MinStack := FramePointer;
MaxStack := MinStack + MAX_STACK_SIZE;
{ Now we can walk the stack using the algorithm described above. }
Count := 0;
while (Count < MaxCallStackDepth) and (FramePointer <> 0)
and (FramePointer >= MinStack) and (FramePointer < MaxStack) do
begin
{ The first value at FramePointer contains the previous value of R7.
Store the 7 values after that. }
Address := Pointer(FramePointer + SizeOf(UIntPtr));
Move(Address^, CallStack.Stack[Count], SizeOf(TStackValues));
Inc(Count);
{ The FramePointer points to the previous value of R7, which contains the
previous FramePointer. }
FramePointer := PNativeUInt(FramePointer)^;
end;
CallStack.Count := Count;
Result := CallStack;
end;
class function TgoExceptionReporter.GetCallStack(
const AStackInfo: Pointer): TgoCallStack;
var
CallStack: PCallStack;
I, J: Integer;
FoundLR: Boolean;
begin
{ Convert TCallStack to TgoCallStack }
CallStack := AStackInfo;
SetLength(Result, CallStack.Count);
for I := 0 to CallStack.Count - 1 do
begin
{ For each entry in the call stack, we have up to 7 values now that may
represent the LR register. Most of the time, it will be the first value.
We try to find the correct LR value by passing up to all 7 addresses to
the dladdr API (by calling GetCallStackEntry). If the API call succeeds,
we assume we found the value of LR. However, this is not fool proof
because an address value we pass to dladdr may be a valid code address,
but not the LR value we are looking for.
Also, the LR value contains the address of the next instruction after the
call instruction. Delphi usually uses the BL or BLX instruction to call
another routine. These instructions takes 4 bytes, so LR will be set to 4
bytes after the BL(X) instruction (the return address). However, we want
to know at what address the call was made, so we need to subtract 4
bytes.
There is one final complication here: the lowest bit of the LR register
indicates the mode the CPU operates in (ARM or Thumb). We need to clear
this bit to get to the actual address, by AND'ing it with "not 1". }
FoundLR := False;
for J := 0 to Length(CallStack.Stack[I]) - 1 do
begin
Result[I].CodeAddress := (CallStack.Stack[I, J] and not 1) - 4;
if GetCallStackEntry(Result[I]) then
begin
{ Assume we found LR }
FoundLR := True;
Break;
end;
end;
if (not FoundLR) then
{ None of the 7 values were valid.
Set CodeAddress to 0 to signal we couldn't find LR. }
Result[I].CodeAddress := 0;
end;
end;
{$ELSE}
(*****************************************************************************)
(*** Non iOS/Android *********************************************************)
(*****************************************************************************)
class function TgoExceptionReporter.GlobalGetExceptionStackInfo(
P: PExceptionRecord): Pointer;
begin
{ Call stacks are only supported on iOS and Android }
Result := nil;
end;
class function TgoExceptionReporter.GetCallStack(
const AStackInfo: Pointer): TgoCallStack;
begin
{ Call stacks are only supported on iOS and Android }
Result := nil;
end;
class function TgoExceptionReporter.GetCallStackEntry(
var AEntry: TgoCallStackEntry): Boolean;
begin
{ Call stacks are only supported on iOS and Android }
Result := False;
end;
{$ENDIF}
{$IF Defined(IOS) or Defined(ANDROID)}
class function TgoExceptionReporter.GetCallStackEntry(
var AEntry: TgoCallStackEntry): Boolean;
var
Info: dl_info;
Status: Integer;
Demangled: MarshaledAString;
begin
Result := (dladdr(AEntry.CodeAddress, Info) <> 0) and (Info.dli_saddr <> nil);
if (Result) then
begin
AEntry.RoutineAddress := UIntPtr(Info.dli_saddr);
AEntry.ModuleAddress := UIntPtr(Info.dli_fbase);
Demangled := cxa_demangle(Info.dli_sname, nil, 0, Status);
if (Demangled = nil) then
AEntry.RoutineName := String(Info.dli_sname)
else
begin
AEntry.RoutineName := String(Demangled);
Posix.Stdlib.free(Demangled);
end;
AEntry.ModuleName := String(Info.dli_fname);
end;
end;
{$ENDIF}
initialization
TgoExceptionReporter.FInstance := TgoExceptionReporter.InternalCreate;
finalization
FreeAndNil(TgoExceptionReporter.FInstance);
end.
| 35.876757 | 146 | 0.6924 |
fcb1a01122e69e4686086c694279ba2e93d6e798 | 238 | dpr | Pascal | Components/jcl/examples/common/pcre/QPCREDemo.dpr | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| null | null | null | Components/jcl/examples/common/pcre/QPCREDemo.dpr | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| null | null | null | Components/jcl/examples/common/pcre/QPCREDemo.dpr | sabatex/Delphi | 0efbe6eb38bf8aa2bf269d1866741266e90b9cbf | [
"MIT"
]
| 1 | 2019-12-24T08:39:18.000Z | 2019-12-24T08:39:18.000Z | program QPCREDemo;
uses
QForms,
QPCREDemoMain in 'QPCREDemoMain.pas' {frmMain};
{$R *.res}
begin
Application.Initialize;
Application.Title := 'JclPCRE Demo';
Application.CreateForm(TfrmMain, frmMain);
Application.Run;
end.
| 15.866667 | 49 | 0.731092 |
f15181a6efb68c492be19b5e73864fe32449958f | 15,307 | pas | Pascal | ufrmAutoGetItMain.pas | atkins126/AutoGetIt | 5fb963097ef75751374c832a982d8b13d378c874 | [
"MIT"
]
| 30 | 2021-02-25T01:15:19.000Z | 2022-02-02T20:25:13.000Z | ufrmAutoGetItMain.pas | atkins126/AutoGetIt | 5fb963097ef75751374c832a982d8b13d378c874 | [
"MIT"
]
| 10 | 2021-02-27T17:10:07.000Z | 2021-07-26T21:33:37.000Z | ufrmAutoGetItMain.pas | atkins126/AutoGetIt | 5fb963097ef75751374c832a982d8b13d378c874 | [
"MIT"
]
| 9 | 2021-02-28T16:06:00.000Z | 2022-01-07T03:36:49.000Z | unit ufrmAutoGetItMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, System.Actions, Vcl.ActnList,
System.ImageList, Vcl.ImgList, Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls,
DosCommand, Vcl.CheckLst, Vcl.ComCtrls, Vcl.Menus;
type
TfrmAutoGetItMain = class(TForm)
pnlTop: TPanel;
btnRefresh: TBitBtn;
aclAutoGetit: TActionList;
actRefresh: TAction;
cmbRADVersions: TComboBox;
Label1: TLabel;
DosCommand: TDosCommand;
lbPackages: TCheckListBox;
actInstallChecked: TAction;
rgrpSortBy: TRadioGroup;
chkInstalledOnly: TCheckBox;
edtNameFilter: TLabeledEdit;
StatusBar: TStatusBar;
mnuCheckListPopup: TPopupMenu;
actSaveCheckedList: TAction;
actCheckAll: TAction;
CheckAll1: TMenuItem;
Savedcheckeditems1: TMenuItem;
actUncheckAll: TAction;
UncheckAll1: TMenuItem;
N1: TMenuItem;
InstallChecked1: TMenuItem;
N2: TMenuItem;
chkAcceptEULAs: TCheckBox;
btnInstallSelected: TBitBtn;
actUninstallChecked: TAction;
UninstallChecked1: TMenuItem;
FileOpenDialogSavedChecks: TFileOpenDialog;
FileSaveDialogSavedChecks: TFileSaveDialog;
actLoadCheckedList: TAction;
dlgClearChecksFirst: TTaskDialog;
actLoadCheckedList1: TMenuItem;
actInstallOne: TAction;
Installhighlightedpackage1: TMenuItem;
actUninstallOne: TAction;
Uninstallhighlightedpackage1: TMenuItem;
Label2: TLabel;
procedure FormCreate(Sender: TObject);
procedure DosCommandNewLine(ASender: TObject; const ANewLine: string; AOutputType: TOutputType);
procedure DosCommandTerminated(Sender: TObject);
procedure actRefreshExecute(Sender: TObject);
procedure actInstallCheckedExecute(Sender: TObject);
procedure actCheckAllExecute(Sender: TObject);
procedure actUncheckAllExecute(Sender: TObject);
procedure actUninstallCheckedExecute(Sender: TObject);
procedure actSaveCheckedListExecute(Sender: TObject);
procedure actLoadCheckedListExecute(Sender: TObject);
procedure actInstallOneExecute(Sender: TObject);
procedure actUninstallOneExecute(Sender: TObject);
procedure lbPackagesClick(Sender: TObject);
procedure rgrpSortByClick(Sender: TObject);
private
const
BDS_USER_ROOT = '\Software\Embarcadero\BDS\';
type
TGetItArgsFunction = reference to function (const GetItName: string): string;
var
FPastFirstItem: Boolean;
FFinished: Boolean;
FInstallAborted: Boolean;
procedure SetExecLine(const Value: string);
procedure SetDownloadTime(const Value: Integer);
procedure SetPackageCount(const Value: Integer);
procedure LoadRADVersionsCombo;
procedure CleanPackageList;
procedure ProcessCheckedPackages(GetItArgsFunc: TGetItArgsFunction);
function BDSRootPath(const BDSVersion: string): string;
function BDSBinDir: string;
function GetItInstallCmd(const GetItPackageName: string): string;
function GetItUninstallCmd(const GetItPackageName: string): string;
function ParseGetItName(const GetItLine: string): string;
function CountChecked: Integer;
function SelectedBDSVersion: string;
property PackageCount: Integer write SetPackageCount;
property DownloadTime: Integer write SetDownloadTime;
property ExecLine: string write SetExecLine;
end;
var
frmAutoGetItMain: TfrmAutoGetItMain;
implementation
{$R *.dfm}
uses
System.Diagnostics, System.Win.Registry, System.StrUtils, System.IOUtils,
ufrmInstallLog;
const
GETIT_VR_NOT_SUPPORTED_MSG = 'This version of Delphi''s GetItCmd.exe is not supported.';
procedure TfrmAutoGetItMain.FormCreate(Sender: TObject);
begin
LoadRADVersionsCombo;
lbPackages.Items.Clear;
end;
function TfrmAutoGetItMain.GetItInstallCmd(const GetItPackageName: string): string;
begin
if StartsText('19', cmbRADVersions.Text) or StartsText('20', cmbRADVersions.Text) then
Result := Format('-accept_eulas -i"%s"', [GetItPackageName])
else if StartsText('21', cmbRADVersions.Text) then
Result := Format('-ae -i="%s"', [GetItPackageName])
else
raise ENotImplemented.Create(GETIT_VR_NOT_SUPPORTED_MSG);
end;
function TfrmAutoGetItMain.GetItUninstallCmd(const GetItPackageName: string): string;
begin
if StartsText('19', cmbRADVersions.Text) or StartsText('20', cmbRADVersions.Text) then
Result := Format('-u"%s"', [GetItPackageName])
else if StartsText('21', cmbRADVersions.Text) then
Result := Format('-u="%s"', [GetItPackageName])
else
raise ENotImplemented.Create(GETIT_VR_NOT_SUPPORTED_MSG);
end;
procedure TfrmAutoGetItMain.lbPackagesClick(Sender: TObject);
begin
actInstallOne.Enabled := (lbPackages.ItemIndex > -1) and (lbPackages.ItemIndex < lbPackages.Items.Count);
actUninstallOne.Enabled := (lbPackages.ItemIndex > -1) and (lbPackages.ItemIndex < lbPackages.Items.Count);
if actInstallOne.Enabled then begin
actInstallOne.Caption := 'Install ' + ParseGetItName(lbPackages.Items[lbPackages.ItemIndex]);
actUninstallOne.Caption := 'Uninstall ' + ParseGetItName(lbPackages.Items[lbPackages.ItemIndex]);
end else begin
actInstallOne.Caption := 'Install ...';
actUninstallOne.Caption := 'Uninstall ...';
end;
end;
procedure TfrmAutoGetItMain.actInstallCheckedExecute(Sender: TObject);
begin
actInstallChecked.Enabled := False;
actRefresh.Enabled := False;
try
ProcessCheckedPackages(function (const GetItName: string): string
begin
Result := GetItInstallCmd(GetItName);
end);
finally
actInstallChecked.Enabled := True;
actRefresh.Enabled := True;
end;
end;
procedure TfrmAutoGetItMain.actUninstallCheckedExecute(Sender: TObject);
begin
actUninstallChecked.Enabled := False;
actRefresh.Enabled := False;
try
ProcessCheckedPackages(function (const GetItName: string): string
begin
Result := GetItUninstallCmd(GetItName);
end);
finally
actUninstallChecked.Enabled := True;
actRefresh.Enabled := True;
end;
end;
procedure TfrmAutoGetItMain.actInstallOneExecute(Sender: TObject);
begin
actInstallOne.Enabled := False;
actRefresh.Enabled := False;
try
frmInstallLog.Initialize;
frmInstallLog.ProcessGetItPackage(BDSBinDir,
GetItInstallCmd(ParseGetItName(lbPackages.Items[lbPackages.ItemIndex])),
1, 1, FInstallAborted);
frmInstallLog.NotifyFinished;
finally
actInstallOne.Enabled := True;
actRefresh.Enabled := True;
end;
end;
procedure TfrmAutoGetItMain.actUninstallOneExecute(Sender: TObject);
begin
actUninstallOne.Enabled := False;
actRefresh.Enabled := False;
try
frmInstallLog.Initialize;
frmInstallLog.ProcessGetItPackage(BDSBinDir,
GetItUninstallCmd(ParseGetItName(lbPackages.Items[lbPackages.ItemIndex])),
1, 1, FInstallAborted);
frmInstallLog.NotifyFinished;
finally
actUninstallOne.Enabled := True;
actRefresh.Enabled := True;
end;
end;
procedure TfrmAutoGetItMain.actRefreshExecute(Sender: TObject);
var
SortField: string;
CmdLineArgs: string;
begin
actRefresh.Enabled := False;
try
lbPackages.Items.Clear;
FPastFirstItem := False;
FFinished := False;
case rgrpSortBy.ItemIndex of
0: SortField := 'name';
1: SortField := 'vendor';
2: SortField := 'date';
end;
DosCommand.CurrentDir := BDSBinDir;
if StartsText('19', cmbRADVersions.Text) or StartsText('20', cmbRADVersions.Text) then
CmdLineArgs := Format('-listavailable:%s -sort:%s -filter:%s ', [edtNameFilter.Text, SortField,
IfThen(chkInstalledOnly.Checked, 'Installed', 'All')])
else if StartsText('21', cmbRADVersions.Text) then
CmdLineArgs := Format('--list=%s --sort=%s --filter=%s', [
edtNameFilter.Text, SortField,
IfThen(chkInstalledOnly.Checked, 'installed', 'all')])
else
raise ENotImplemented.Create(GETIT_VR_NOT_SUPPORTED_MSG);
DosCommand.CommandLine := 'GetItCmd.exe ' + CmdLineArgs;
ExecLine := TPath.Combine(DosCommand.CurrentDir, DosCommand.CommandLine);
Screen.Cursor := crHourGlass;
try
var CmdTime := TStopWatch.Create;
CmdTime.Start;
DosCommand.Execute;
repeat
Application.ProcessMessages;
until FFinished;
CleanPackageList;
CmdTime.Stop;
DownloadTime := cmdTime.Elapsed.Seconds;
PackageCount := lbPackages.Items.Count;
finally
Screen.Cursor := crDefault;
end;
actInstallChecked.Enabled := lbPackages.Items.Count > 0;
actUninstallChecked.Enabled := lbPackages.Items.Count > 0;
finally
actRefresh.Enabled := True;
end;
end;
procedure TfrmAutoGetItMain.actSaveCheckedListExecute(Sender: TObject);
var
GetItName: string;
CheckedList: TStringList;
begin
CheckedList := TStringList.Create;
try
for var i := 0 to lbPackages.Count - 1 do
if lbPackages.Checked[i] then begin
GetItName := ParseGetItName(lbPackages.Items[i]);
CheckedList.Add(GetItName);
end;
FileSaveDialogSavedChecks.FileName := 'AutoGetIt for RAD Studio ' + cmbRADVersions.Text;
if FileSaveDialogSavedChecks.Execute then
CheckedList.SaveToFile(FileSaveDialogSavedChecks.FileName);
finally
CheckedList.Free;
end;
end;
procedure TfrmAutoGetItMain.actLoadCheckedListExecute(Sender: TObject);
var
GetItPos: Integer;
CheckedList: TStringList;
begin
CheckedList := TStringList.Create;
try
FileOpenDialogSavedChecks.FileName := 'AutoGetIt for RAD Studio ' + cmbRADVersions.Text;
if FileOpenDialogSavedChecks.Execute then begin
CheckedList.LoadFromFile(FileOpenDialogSavedChecks.FileName);
if CountChecked > 0 then begin
if dlgClearChecksFirst.Execute then
case dlgClearChecksFirst.ModalResult of
mrCancel:
Exit;
mrYes:
actUncheckAll.Execute;
end;
end;
for var i := 0 to CheckedList.Count - 1 do begin
for GetItPos := 0 to lbPackages.Items.Count - 1 do
if StartsText(CheckedList[i], lbPackages.Items[GetItPos]) then
lbPackages.Checked[GetItPos] := True;
end;
end;
finally
CheckedList.Free;
end;
end;
procedure TfrmAutoGetItMain.actCheckAllExecute(Sender: TObject);
begin
lbPackages.CheckAll(TCheckBoxState.cbChecked);
end;
procedure TfrmAutoGetItMain.actUncheckAllExecute(Sender: TObject);
begin
lbPackages.CheckAll(TCheckBoxState.cbUnchecked);
end;
function TfrmAutoGetItMain.BDSBinDir: string;
begin
Result := TPath.Combine(BDSRootPath(SelectedBDSVersion), 'bin');
end;
function TfrmAutoGetItMain.BDSRootPath(const BDSVersion: string): string;
begin
var reg := TRegistry.Create;
try
reg.RootKey := HKEY_CURRENT_USER;
if reg.OpenKey(BDS_USER_ROOT + BDSVersion, False) then
Result := reg.ReadString('RootDir');
finally
reg.Free;
end;
end;
procedure TfrmAutoGetItMain.CleanPackageList;
{ Not sure if there's a bug in DosCommand or what but the list of packages
often contains cut-off entries that are then completed on the next line,
like it misinterpreted a line break, so this routine goes through and
deletes those partial entries by checking to see if the previous line
is the start of the current line.
}
var
LastPackage: string;
begin
LastPackage := EmptyStr;
for var i := lbPackages.Count - 1 downto 1 do begin
LastPackage := lbPackages.Items[i-1];
if (LastPackage.Length > 0) and StartsText(LastPackage, lbPackages.Items[i]) then
lbPackages.Items.Delete(i - 1)
else
end;
end;
function TfrmAutoGetItMain.CountChecked: Integer;
begin
Result := 0;
for var i := 0 to lbPackages.Count - 1 do
if lbPackages.Checked[i] then
Result := Result + 1;
end;
procedure TfrmAutoGetItMain.DosCommandNewLine(ASender: TObject; const ANewLine: string; AOutputType: TOutputType);
begin
if not FPastFirstItem then begin
if StartsText('--', ANewLine) then
FPastFirstItem := True;
end else if ContainsText(ANewLine, 'command finished') then
FFinished := True
else if not FFinished and (Trim(ANewLine).Length > 0) then
if lbPackages.Items.IndexOf(ANewLine) = -1 then
lbPackages.Items.Add(ANewLine);
end;
procedure TfrmAutoGetItMain.DosCommandTerminated(Sender: TObject);
begin
FFinished := True;
end;
procedure TfrmAutoGetItMain.LoadRADVersionsCombo;
const
MAX_VERSIONS = 3;
BDS_VERSIONS: array[1..MAX_VERSIONS] of string = ('19.0', '20.0', '21.0');
DELPHI_NAMES: array[1..MAX_VERSIONS] of string = ('10.2 Tokyo', '10.3 Rio', '10.4 Sydney');
begin
cmbRADVersions.Items.Clear;
var reg := TRegistry.Create;
try
reg.RootKey := HKEY_CURRENT_USER;
// find and list all versions of RAD studio installed
for var i := 1 to MAX_VERSIONS do
if reg.OpenKey(BDS_USER_ROOT + BDS_VERSIONS[i], False) then begin
// make sure a root path is listed before adding this version
if Length(BDSRootPath(BDS_VERSIONS[i])) > 0 then
cmbRADVersions.Items.Insert(0, BDS_VERSIONS[i] + ' - Delphi ' + DELPHI_NAMES[i]);
end;
if cmbRADVersions.Items.Count > 0 then
cmbRADVersions.ItemIndex := 0
else begin
cmbRADVersions.Style := TComboBoxStyle.csSimple;
cmbRADVersions.Text := '<None Found>';
cmbRADVersions.Enabled := False;
end;
finally
reg.Free;
end;
end;
function TfrmAutoGetItMain.ParseGetItName(const GetItLine: string): string;
begin
var space := Pos(' ', GetItLine);
Result := LeftStr(GetItLine, space - 1);
end;
procedure TfrmAutoGetItMain.ProcessCheckedPackages(GetItArgsFunc: TGetItArgsFunction);
var
GetItLine: string;
GetItName: string;
count, total: Integer;
begin
FInstallAborted := False;
total := CountChecked;
count := 0;
frmInstallLog.Initialize;
for var i := 0 to lbPackages.Count - 1 do begin
if lbPackages.Checked[i] then begin
GetItLine := lbPackages.Items[i];
GetItName := ParseGetItName(GetItLine);
Inc(count);
frmInstallLog.ProcessGetItPackage(BDSBinDir, GetItArgsFunc(GetItName),
Count, Total, FInstallAborted)
end;
if FInstallAborted then
Break;
end;
frmInstallLog.NotifyFinished;
end;
procedure TfrmAutoGetItMain.rgrpSortByClick(Sender: TObject);
begin
if (StartsText('19', cmbRADVersions.Text) or StartsText('20', cmbRADVersions.Text)) and
(rgrpSortBy.ItemIndex = 2) then
begin
rgrpSortBy.ItemIndex := 0;
ShowMessage('Sorting by Date not available with GetItCmd for RAD Studio 19 or 20');
end;
end;
function TfrmAutoGetItMain.SelectedBDSVersion: string;
begin
Result := Trim(Copy(cmbRADVersions.Text, 1, Pos(' ', cmbRADVersions.Text) - 1));
end;
procedure TfrmAutoGetItMain.SetDownloadTime(const Value: Integer);
begin
StatusBar.Panels[1].Text := Format('%d seconds', [Value]);
StatusBar.Update;
end;
procedure TfrmAutoGetItMain.SetExecLine(const Value: string);
begin
StatusBar.Panels[2].Text := Value;
StatusBar.Update;
end;
procedure TfrmAutoGetItMain.SetPackageCount(const Value: Integer);
begin
StatusBar.Panels[0].Text := Format('%d packages', [Value]);
StatusBar.Update;
end;
end.
| 31.238776 | 114 | 0.723264 |
c347950ab6831df0e9fb40d06aa2ff326e731e84 | 10,133 | pas | Pascal | fpcdws/dwsMathComplexFunctions.pas | noshbar/c_dwscript | c2df9341a9f22d2974d1235f3968a4a3d9f3b32a | [
"Condor-1.1"
]
| 4 | 2018-09-18T07:35:52.000Z | 2021-02-18T18:21:54.000Z | fpcdws/dwsMathComplexFunctions.pas | noshbar/c_dwscript | c2df9341a9f22d2974d1235f3968a4a3d9f3b32a | [
"Condor-1.1"
]
| null | null | null | fpcdws/dwsMathComplexFunctions.pas | noshbar/c_dwscript | c2df9341a9f22d2974d1235f3968a4a3d9f3b32a | [
"Condor-1.1"
]
| 1 | 2020-10-30T07:24:05.000Z | 2020-10-30T07:24:05.000Z | {**********************************************************************}
{ }
{ "The contents of this file are subject to the Mozilla Public }
{ License Version 1.1 (the "License"); you may not use this }
{ file except in compliance with the License. You may obtain }
{ a copy of the License at http://www.mozilla.org/MPL/ }
{ }
{ Software distributed under the License is distributed on an }
{ "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express }
{ or implied. See the License for the specific language }
{ governing rights and limitations under the License. }
{ }
{ Copyright Creative IT. }
{ Current maintainer: Eric Grange }
{ }
{**********************************************************************}
unit dwsMathComplexFunctions;
{$I dws.inc}
interface
uses
SysUtils,
dwsUtils, dwsXPlatform,
dwsFunctions, dwsSymbols, dwsExprs, dwsStrings, dwsOperators, dwsExprList,
dwsTokenizer,dwsMagicExprs, dwsUnitSymbols, dwsDataContext;
type
TComplexMakeExpr = class(TInternalMagicDataFunction)
public
procedure DoEval(const args : TExprBaseListExec; var result : IDataContext); override;
end;
TComplexToStrExpr = class(TInternalMagicStringFunction)
public
procedure DoEvalAsString(const args : TExprBaseListExec; var Result : UnicodeString); override;
end;
TAbsComplexExpr = class(TUnaryOpFloatExpr)
function EvalAsFloat(exec : TdwsExecution) : Double; override;
end;
TComplexOpExpr = class(TInternalMagicDataFunction);
TComplexNegOpExpr = class(TComplexOpExpr)
public
procedure DoEval(const args : TExprBaseListExec; var result : IDataContext); override;
end;
TComplexAddOpExpr = class(TComplexOpExpr)
public
procedure DoEval(const args : TExprBaseListExec; var result : IDataContext); override;
end;
TComplexSubOpExpr = class(TComplexOpExpr)
public
procedure DoEval(const args : TExprBaseListExec; var result : IDataContext); override;
end;
TComplexMultOpExpr = class(TComplexOpExpr)
public
procedure DoEval(const args : TExprBaseListExec; var result : IDataContext); override;
end;
TComplexDivOpExpr = class(TComplexOpExpr)
public
procedure DoEval(const args : TExprBaseListExec; var result : IDataContext); override;
end;
const
SYS_COMPLEX = 'TComplex';
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// ------------------------------------------------------------------
implementation
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// RegisterComplexType
//
procedure RegisterComplexType(systemTable : TSystemSymbolTable; unitSyms : TUnitMainSymbols;
unitTable : TSymbolTable);
var
typComplex : TRecordSymbol;
begin
typComplex:=TRecordSymbol.Create(SYS_COMPLEX, nil);
typComplex.AddField(TFieldSymbol.Create('Re', systemTable.TypFloat, cvPublic));
typComplex.AddField(TFieldSymbol.Create('Im', systemTable.TypFloat, cvPublic));
systemTable.AddSymbol(typComplex);
end;
// RegisterComplexOperators
//
procedure RegisterComplexOperators(systemTable : TSystemSymbolTable;
unitTable : TSymbolTable; operators : TOperators);
var
typComplex : TRecordSymbol;
begin
typComplex:=systemTable.FindTypeSymbol(SYS_COMPLEX, cvMagic) as TRecordSymbol;
operators.RegisterOperator(ttPLUS, unitTable.FindSymbol('ComplexAdd', cvMagic) as TFuncSymbol, typComplex, typComplex);
operators.RegisterOperator(ttMINUS, unitTable.FindSymbol('ComplexSub', cvMagic) as TFuncSymbol, typComplex, typComplex);
operators.RegisterOperator(ttTIMES, unitTable.FindSymbol('ComplexMult', cvMagic) as TFuncSymbol, typComplex, typComplex);
operators.RegisterOperator(ttDIVIDE, unitTable.FindSymbol('ComplexDiv', cvMagic) as TFuncSymbol, typComplex, typComplex);
end;
// HandleComplexAbs
//
function HandleComplexAbs(prog : TdwsProgram; argExpr : TTypedExpr) : TTypedExpr;
var
typComplex : TRecordSymbol;
begin
typComplex:=prog.Root.SystemTable.SymbolTable.FindTypeSymbol(SYS_COMPLEX, cvMagic) as TRecordSymbol;
if argExpr.Typ.IsOfType(typComplex) then
Result:=TAbsComplexExpr.Create(prog, argExpr)
else Result:=nil;
end;
// ------------------
// ------------------ TComplexMakeExpr ------------------
// ------------------
// DoEval
//
procedure TComplexMakeExpr.DoEval(const args : TExprBaseListExec; var result : IDataContext);
begin
result.AsFloat[0]:=args.AsFloat[0];
result.AsFloat[1]:=args.AsFloat[1];
end;
// ------------------
// ------------------ TComplexToStrExpr ------------------
// ------------------
// DoEvalAsString
//
procedure TComplexToStrExpr.DoEvalAsString(const args : TExprBaseListExec; var Result : UnicodeString);
var
cmplxData : IDataContext;
r, i : Double;
begin
cmplxData:=TDataExpr(args.ExprBase[0]).DataPtr[args.Exec];
r:=cmplxData.AsFloat[0];
i:=cmplxData.AsFloat[1];
if i>0 then
Result:=UnicodeFormat('%f + %fi', [r, i])
else if i<0 then
Result:=UnicodeFormat('%f - %fi', [r, Abs(i)])
else Result:=UnicodeFormat('%f', [r]);
end;
// ------------------
// ------------------ TAbsComplexExpr ------------------
// ------------------
// EvalAsFloat
//
function TAbsComplexExpr.EvalAsFloat(exec : TdwsExecution) : Double;
var
cmplxData : IDataContext;
begin
cmplxData:=TDataExpr(Expr).DataPtr[exec];
Result:=Sqrt(Sqr(cmplxData.AsFloat[0])+Sqr(cmplxData.AsFloat[1]));
end;
// ------------------
// ------------------ TComplexNegOpExpr ------------------
// ------------------
// DoEval
//
procedure TComplexNegOpExpr.DoEval(const args : TExprBaseListExec; var result : IDataContext);
var
v : IDataContext;
begin
v:=TDataExpr(args.ExprBase[0]).DataPtr[args.Exec];
result.AsFloat[0]:=-v.AsFloat[0];
result.AsFloat[1]:=-v.AsFloat[1];
end;
// ------------------
// ------------------ TComplexAddOpExpr ------------------
// ------------------
// DoEval
//
procedure TComplexAddOpExpr.DoEval(const args : TExprBaseListExec; var result : IDataContext);
var
leftData, rightData : IDataContext;
begin
leftData:=TDataExpr(args.ExprBase[0]).DataPtr[args.Exec];
rightData:=TDataExpr(args.ExprBase[1]).DataPtr[args.Exec];
result[0]:=leftData[0]+rightData[0];
result[1]:=leftData[1]+rightData[1];
end;
// ------------------
// ------------------ TComplexSubOpExpr ------------------
// ------------------
// DoEval
//
procedure TComplexSubOpExpr.DoEval(const args : TExprBaseListExec; var result : IDataContext);
var
leftData, rightData : IDataContext;
begin
leftData:=TDataExpr(args.ExprBase[0]).DataPtr[args.Exec];
rightData:=TDataExpr(args.ExprBase[1]).DataPtr[args.Exec];
result[0]:=leftData[0]-rightData[0];
result[1]:=leftData[1]-rightData[1];
end;
// ------------------
// ------------------ TComplexMultOpExpr ------------------
// ------------------
// DoEval
//
procedure TComplexMultOpExpr.DoEval(const args : TExprBaseListExec; var result : IDataContext);
var
leftData, rightData : IDataContext;
begin
leftData:=TDataExpr(args.ExprBase[0]).DataPtr[args.Exec];
rightData:=TDataExpr(args.ExprBase[1]).DataPtr[args.Exec];
result[0]:=leftData[0]*rightData[0]-leftData[1]*rightData[1];
result[1]:=leftData[1]*rightData[0]+leftData[0]*rightData[1];
end;
// ------------------
// ------------------ TComplexDivOpExpr ------------------
// ------------------
// DoEval
//
procedure TComplexDivOpExpr.DoEval(const args : TExprBaseListExec; var result : IDataContext);
var
leftData, rightData : IDataContext;
d : Double;
begin
leftData:=TDataExpr(args.ExprBase[0]).DataPtr[args.Exec];
rightData:=TDataExpr(args.ExprBase[1]).DataPtr[args.Exec];
d:=Sqr(rightData[0])+Sqr(rightData[1]);
result[0]:=(leftData[0]*rightData[0]+leftData[1]*rightData[1])/d;
result[1]:=(leftData[1]*rightData[0]-leftData[0]*rightData[1])/d;
end;
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// ------------------------------------------------------------------
initialization
// ------------------------------------------------------------------
// ------------------------------------------------------------------
// ------------------------------------------------------------------
dwsInternalUnit.AddSymbolsRegistrationProc(RegisterComplexType);
dwsInternalUnit.AddOperatorsRegistrationProc(RegisterComplexOperators);
dwsInternalUnit.AddAbsHandler(HandleComplexAbs);
RegisterInternalFunction(TComplexMakeExpr, 'Complex', ['real', SYS_FLOAT, 'imaginary', SYS_FLOAT], SYS_COMPLEX, [iffStateLess]);
RegisterInternalStringFunction(TComplexToStrExpr, 'ComplexToStr', ['&c', SYS_COMPLEX], [iffStateLess]);
RegisterInternalFunction(TComplexNegOpExpr, 'ComplexNeg', ['&v', SYS_COMPLEX], SYS_COMPLEX, [iffStateLess]);
RegisterInternalFunction(TComplexAddOpExpr, 'ComplexAdd', ['&left', SYS_COMPLEX, '&right', SYS_COMPLEX], SYS_COMPLEX, [iffStateLess]);
RegisterInternalFunction(TComplexSubOpExpr, 'ComplexSub', ['&left', SYS_COMPLEX, '&right', SYS_COMPLEX], SYS_COMPLEX, [iffStateLess]);
RegisterInternalFunction(TComplexMultOpExpr, 'ComplexMult', ['&left', SYS_COMPLEX, '&right', SYS_COMPLEX], SYS_COMPLEX, [iffStateLess]);
RegisterInternalFunction(TComplexDivOpExpr, 'ComplexDiv', ['&left', SYS_COMPLEX, '&right', SYS_COMPLEX], SYS_COMPLEX, [iffStateLess]);
end.
| 36.44964 | 139 | 0.58571 |
6a94f0ecf902d075e52ca3c7ce3e5f8d6b8e8867 | 1,169 | dfm | Pascal | Chapter03/Builder/BuilderMain.dfm | PacktPublishing/Hands-On-Design-Patterns-with-Delphi | 30f6ab51e61d583f822be4918f4b088e2255cd82 | [
"MIT"
]
| 38 | 2019-02-28T06:22:52.000Z | 2022-03-16T12:30:43.000Z | Chapter03/Builder/BuilderMain.dfm | alefragnani/Hands-On-Design-Patterns-with-Delphi | 3d29e5b2ce9e99e809a6a9a178c3f5e549a8a03d | [
"MIT"
]
| null | null | null | Chapter03/Builder/BuilderMain.dfm | alefragnani/Hands-On-Design-Patterns-with-Delphi | 3d29e5b2ce9e99e809a6a9a178c3f5e549a8a03d | [
"MIT"
]
| 18 | 2019-03-29T08:36:14.000Z | 2022-03-30T00:31:28.000Z | object frmBuilder: TfrmBuilder
Left = 0
Top = 0
Caption = 'Builder pattern'
ClientHeight = 360
ClientWidth = 723
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
DesignSize = (
723
360)
PixelsPerInch = 96
TextHeight = 13
object btnMakeJSON: TButton
Left = 16
Top = 16
Width = 137
Height = 50
Caption = 'Make JSON'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -15
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
TabOrder = 0
OnClick = btnMakeJSONClick
end
object btnMakeXML: TButton
Left = 16
Top = 80
Width = 137
Height = 50
Caption = 'Make XML'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -15
Font.Name = 'Tahoma'
Font.Style = []
ParentFont = False
TabOrder = 1
OnClick = btnMakeXMLClick
end
object outMemo: TMemo
Left = 168
Top = 16
Width = 537
Height = 329
Anchors = [akLeft, akTop, akRight, akBottom]
TabOrder = 2
end
end
| 20.155172 | 48 | 0.626176 |
fcafd0f9f4ececa2b11f9af37cc33febfe30386c | 16,562 | pas | Pascal | windows/src/ext/jedi/jvcl/donations/Colors/JvFullColorDialogs.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 219 | 2017-06-21T03:37:03.000Z | 2022-03-27T12:09:28.000Z | windows/src/ext/jedi/jvcl/donations/Colors/JvFullColorDialogs.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 4,451 | 2017-05-29T02:52:06.000Z | 2022-03-31T23:53:23.000Z | windows/src/ext/jedi/jvcl/donations/Colors/JvFullColorDialogs.pas | bravogeorge/keyman | c0797e36292de903d7313214d1f765e3d9a2bf4d | [
"MIT"
]
| 72 | 2017-05-26T04:08:37.000Z | 2022-03-03T10:26:20.000Z | {-----------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/MPL-1.1.html
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is: ColorDialogs.pas, released on 2004-09-11.
The Initial Developer of the Original Code is Florent Ouchet [ouchet dott florent att laposte dott net]
Portions created by Florent Ouchet are Copyright (C) 2004 Florent Ouchet.
All Rights Reserved.
Contributor(s): -
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
located at http://jvcl.sourceforge.net
Known Issues:
-----------------------------------------------------------------------------}
// $Id$
unit JvFullColorDialogs;
{$I jvcl.inc}
interface
uses
Classes, Graphics, Forms,
JvFullColorSpaces, JvFullColorRotate;
type
TJvFullColorDialogOption =
(foFullOpen, foPreventExpand, foShowHelp,
foAllowSpaceChange, foConvertToOriginalSpace,
foShowNewPreview, foShowOldPreview,
foShowPredefined, foAllowVariable,
foNoneAndDefault, foShowApply);
TJvFullColorDialogOptions = set of TJvFullColorDialogOption;
TJvFullColorCircleDialogOption =
(coFullOpen, coPreventExpand,
coShowHelp, coAllowSpaceChange,
coShowNewPreview, coShowOldPreview,
coCommon, coRed, coGreen, coBlue,
coShowSaturation, coDefaultRange,
coShowApply);
TJvFullColorCircleDialogOptions = set of TJvFullColorCircleDialogOption;
const
JvDefaultFullColorDialogOptions =
[foFullOpen, foAllowSpaceChange, foAllowVariable,
foShowNewPreview, foShowOldPreview, foShowPredefined, foShowApply];
JvDefaultColorCircleDialogOptions =
[coFullOpen, coAllowSpaceChange,
coShowNewPreview, coShowOldPreview,
coCommon, coRed, coGreen, coBlue,
coShowSaturation, coShowApply];
type
TJvAxisType = (atCommon, atRed, atGreen, atBlue);
TJvFullColorEvent = procedure(Sender: TObject; AFullColor: TJvFullColor) of object;
TJvColorCircleEvent = procedure(Sender: TObject) of object;// AxisType: TJvAxisType;
// NewFullColor: TJvFullColor) of object;
TJvFullColorDialog = class;
TJvFullColorCircleDialog = class;
TJvBaseFullColorForm = class;
TJvBaseColorCircleForm = class;
TJvFullColorDialog = class(TComponent)
private
FOptions: TJvFullColorDialogOptions;
FTitle: string;
FFullColor: TJvFullColor;
FOnApply: TJvFullColorEvent;
FForm: TJvBaseFullColorForm;
FOnCloseQuery: TCloseQueryEvent;
FOnShow: TNotifyEvent;
FHelpContext: THelpContext;
FOldColorSpace: TJvFullColorSpaceID;
function GetFullColor: TJvFullColor;
procedure SetFullColor(const Value: TJvFullColor);
procedure SetHelpContext(const Value: THelpContext);
procedure SetOptions(const Value: TJvFullColorDialogOptions);
procedure SetTitle(const Value: string);
function GetColor: TColor;
protected
procedure FormApply(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
property OldColorSpace: TJvFullColorSpaceID read FOldColorSpace;
public
constructor Create(AOwner: TComponent); override;
function Execute: Boolean;
property Form: TJvBaseFullColorForm read FForm;
property Color: TColor read GetColor;
published
// (rom) set default values
property FullColor: TJvFullColor read GetFullColor write SetFullColor;
property Options: TJvFullColorDialogOptions read FOptions write SetOptions default JvDefaultFullColorDialogOptions;
property Title: string read FTitle write SetTitle;
property HelpContext: THelpContext read FHelpContext write SetHelpContext;
property OnApply: TJvFullColorEvent read FOnApply write FOnApply;
property OnShow: TNotifyEvent read FOnShow write FOnShow;
property OnCloseQuery: TCloseQueryEvent read FOnCloseQuery write FOnCloseQuery;
end;
TJvFullColorCircleDialog = class(TComponent)
private
FTitle: string;
FForm: TJvBaseColorCircleForm;
FHelpContext: THelpContext;
FOnCloseQuery: TCloseQueryEvent;
FOnShow: TNotifyEvent;
FOptions: TJvFullColorCircleDialogOptions;
FOnApply: TJvColorCircleEvent;
FDelta: TJvColorDelta;
procedure SetHelpContext(const Value: THelpContext);
procedure SetOptions(const Value: TJvFullColorCircleDialogOptions);
procedure SetTitle(const Value: string);
procedure SetDelta(const Index: TJvRotateColor; const Value: TJvAxisDelta);
procedure SetColorID(const Value: TJvFullColorSpaceID);
protected
procedure FormApply(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
public
constructor Create(AOwner: TComponent); override;
function Execute: Boolean;
property Form: TJvBaseColorCircleForm read FForm;
property RedDelta: TJvAxisDelta index rcRed read FDelta.AxisRed write SetDelta;
property GreenDelta: TJvAxisDelta index rcGreen read FDelta.AxisGreen write SetDelta;
property BlueDelta: TJvAxisDelta index rcBlue read FDelta.AxisBlue write SetDelta;
property ColorID: TJvFullColorSpaceID read FDelta.ColorID write SetColorID;
property Delta: TJvColorDelta read FDelta;
published
// (rom) set default values
property Options: TJvFullColorCircleDialogOptions
read FOptions write SetOptions default JvDefaultColorCircleDialogOptions;
property Title: string read FTitle write SetTitle;
property HelpContext: THelpContext read FHelpContext write SetHelpContext;
property OnApply: TJvColorCircleEvent read FOnApply write FOnApply;
property OnShow: TNotifyEvent read FOnShow write FOnShow;
property OnCloseQuery: TCloseQueryEvent read FOnCloseQuery write FOnCloseQuery;
end;
TJvBaseFullColorForm = class(TForm)
private
FFullColor: TJvFullColor;
FOptions: TJvFullColorDialogOptions;
FOnApply: TNotifyEvent;
protected
procedure SetOptions(const Value: TJvFullColorDialogOptions); virtual;
procedure SetFullColor(const Value: TJvFullColor); virtual;
public
constructor Create(AOwner: TComponent; AFullColor: TJvFullColor;
AOptions: TJvFullColorDialogOptions); reintroduce;
property Options: TJvFullColorDialogOptions read FOptions write SetOptions;
property FullColor: TJvFullColor read FFullColor write SetFullColor;
property OnApply: TNotifyEvent read FOnApply write FOnApply;
end;
TFullColorFormClass = class of TJvBaseFullColorForm;
TJvBaseColorCircleForm = class(TForm)
private
FDelta: TJvColorDelta;
FOnApply: TNotifyEvent;
FOptions: TJvFullColorCircleDialogOptions;
protected
procedure SetOptions(const Value: TJvFullColorCircleDialogOptions); virtual;
procedure SetRedDelta(const Value: TJvAxisDelta); virtual;
procedure SetGreenDelta(const Value: TJvAxisDelta); virtual;
procedure SetBlueDelta(const Value: TJvAxisDelta); virtual;
procedure SetColorID(const Value: TJvFullColorSpaceID); virtual;
procedure SetDelta(const Value: TJvColorDelta); virtual;
public
property Options: TJvFullColorCircleDialogOptions read FOptions write SetOptions;
property RedDelta: TJvAxisDelta read FDelta.AxisRed write SetRedDelta;
property GreenDelta: TJvAxisDelta read FDelta.AxisGreen write SetGreenDelta;
property BlueDelta: TJvAxisDelta read FDelta.AxisBlue write SetBlueDelta;
property ColorID: TJvFullColorSpaceID read FDelta.ColorID write SetColorID;
property Delta: TJvColorDelta read FDelta write SetDelta;
property OnApply: TNotifyEvent read FOnApply write FOnApply;
end;
TJvColorCircleBaseFormClass = class of TJvBaseColorCircleForm;
var
FullColorFormClass: TFullColorFormClass;
ColorCircleBaseFormClass: TJvColorCircleBaseFormClass;
resourcestring
RsExpandedCaption = '<< &Hide';
RsCollapsedCaption = '&Panels >>';
procedure Register;
implementation
uses
{$IFDEF UNITVERSIONING}
JclUnitVersioning,
{$ENDIF UNITVERSIONING}
Controls, SysUtils;
//=== { TJvFullColorDialog } =================================================
constructor TJvFullColorDialog.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FOptions := JvDefaultFullColorDialogOptions;
FFullColor := fclRGBWhite;
end;
function TJvFullColorDialog.Execute: Boolean;
var
NewColor: TJvFullColor;
begin
Result := False;
if (Form <> nil) or (FullColorFormClass = nil) then
Exit;
FOldColorSpace := ColorSpaceManager.GetColorSpaceID(FullColor);
FForm := FullColorFormClass.Create(Application, FullColor, Options);
with Form do
begin
if Title <> '' then
Caption := Title;
OnApply := FormApply;
OnClose := FormClose;
OnShow := FormShow;
HelpContext := Self.HelpContext;
Result := (ShowModal = mrOk);
NewColor := FullColor;
end;
FreeAndNil(FForm);
with ColorSpaceManager do
if foConvertToOriginalSpace in Options then
NewColor := ConvertToID(NewColor, OldColorSpace);
FFullColor := NewColor;
end;
procedure TJvFullColorDialog.FormApply(Sender: TObject);
var
Color: TJvFullColor;
begin
if Assigned(FForm) then
begin
Color := Form.FullColor;
if foConvertToOriginalSpace in Options then
Color := ColorSpaceManager.ConvertToID(Color, OldColorSpace);
if Assigned(FOnApply) then
FOnApply(Self, Color);
end;
end;
procedure TJvFullColorDialog.FormClose(Sender: TObject; var Action: TCloseAction);
var
Allow: Boolean;
begin
Allow := True;
if Assigned(FOnCloseQuery) then
FOnCloseQuery(Self, Allow);
if Allow then
Action := caFree
else
Action := caNone;
end;
procedure TJvFullColorDialog.FormShow(Sender: TObject);
begin
if Assigned(FOnShow) then
FOnShow(Self);
end;
function TJvFullColorDialog.GetColor: TColor;
begin
Result := ColorSpaceManager.ConvertToColor(FullColor);
end;
function TJvFullColorDialog.GetFullColor: TJvFullColor;
begin
if Form <> nil then
FFullColor := Form.FullColor;
Result := FFullColor;
end;
procedure TJvFullColorDialog.SetFullColor(const Value: TJvFullColor);
begin
FFullColor := Value;
if Form <> nil then
Form.FullColor := Value;
end;
procedure TJvFullColorDialog.SetHelpContext(const Value: THelpContext);
begin
if FHelpContext <> Value then
begin
FHelpContext := Value;
if Assigned(FForm) then
Form.HelpContext := Value;
end;
end;
procedure TJvFullColorDialog.SetOptions(const Value: TJvFullColorDialogOptions);
begin
if FOptions <> Value then
begin
FOptions := Value;
if Assigned(FForm) then
Form.Options := Value;
end;
end;
procedure TJvFullColorDialog.SetTitle(const Value: string);
begin
if FTitle <> Value then
begin
FTitle := Value;
if Assigned(FForm) then
Form.Caption := Value;
end;
end;
//=== { TJvBaseFullColorForm } ===============================================
constructor TJvBaseFullColorForm.Create(AOwner: TComponent;
AFullColor: TJvFullColor; AOptions: TJvFullColorDialogOptions);
begin
inherited Create(AOwner);
FOptions := AOptions;
FFullColor := AFullColor;
end;
procedure TJvBaseFullColorForm.SetFullColor(const Value: TJvFullColor);
begin
FFullColor := Value;
end;
procedure TJvBaseFullColorForm.SetOptions(const Value: TJvFullColorDialogOptions);
begin
FOptions := Value;
end;
//=== { TJvBaseColorCircleForm } =============================================
procedure TJvBaseColorCircleForm.SetBlueDelta(const Value: TJvAxisDelta);
begin
FDelta.AxisBlue := Value;
end;
procedure TJvBaseColorCircleForm.SetColorID(const Value: TJvFullColorSpaceID);
begin
FDelta.ColorID := Value;
end;
procedure TJvBaseColorCircleForm.SetDelta(const Value: TJvColorDelta);
begin
FDelta := Value;
end;
procedure TJvBaseColorCircleForm.SetGreenDelta(const Value: TJvAxisDelta);
begin
FDelta.AxisGreen := Value;
end;
procedure TJvBaseColorCircleForm.SetOptions(const Value: TJvFullColorCircleDialogOptions);
begin
FOptions := Value;
end;
procedure TJvBaseColorCircleForm.SetRedDelta(const Value: TJvAxisDelta);
begin
FDelta.AxisRed := Value;
end;
//=== { TJvColorCircleDialog } ===============================================
constructor TJvFullColorCircleDialog.Create(AOwner: TComponent);
procedure InitAxe (out Value: TJvAxisDelta);
var
Index: TJvAxisIndex;
begin
for Index := Low(TJvAxisIndex) to High(TJvAxisIndex) do
begin
Value[Index].Value := 0;
Value[Index].SaturationMethod := smLoop;
end;
end;
begin
inherited Create(AOwner);
FOptions := JvDefaultColorCircleDialogOptions;
InitAxe(FDelta.AxisRed);
InitAxe(FDelta.AxisGreen);
InitAxe(FDelta.AxisBlue);
FDelta.ColorID := csRGB;
end;
function TJvFullColorCircleDialog.Execute: Boolean;
begin
Result := False;
if (Form <> nil) or (ColorCircleBaseFormClass = nil) then
Exit;
FForm := ColorCircleBaseFormClass.Create(Application);
with Form do
begin
if Title <> '' then
Caption := Title;
Options := Self.Options;
ColorID := Self.ColorID;
RedDelta := Self.RedDelta;
GreenDelta := Self.GreenDelta;
BlueDelta := Self.BlueDelta;
OnApply := FormApply;
OnClose := FormClose;
OnShow := FormShow;
HelpContext := Self.HelpContext;
Result := (ShowModal = mrOk);
Self.FDelta.AxisRed := RedDelta;
Self.FDelta.AxisGreen := GreenDelta;
Self.FDelta.AxisBlue := BlueDelta;
Self.FDelta.ColorID := ColorID;
end;
FreeAndNil(FForm);
end;
procedure TJvFullColorCircleDialog.FormApply(Sender: TObject);
begin
if FForm<>nil then
begin
FDelta.ColorID := FForm.ColorID;
FDelta.AxisRed := FForm.RedDelta;
FDelta.AxisGreen := FForm.GreenDelta;
FDelta.AxisBlue := FForm.BlueDelta;
if Assigned(FOnApply) then
FOnApply(Self);
end;
end;
procedure TJvFullColorCircleDialog.FormClose(Sender: TObject; var Action: TCloseAction);
var
Allow: Boolean;
begin
if FForm<>nil then
begin
FDelta.ColorID := FForm.ColorID;
FDelta.AxisRed := FForm.RedDelta;
FDelta.AxisGreen := FForm.GreenDelta;
FDelta.AxisBlue := FForm.BlueDelta;
Allow := True;
if Assigned(FOnCloseQuery) then
FOnCloseQuery(Self, Allow);
if Allow then
Action := caFree
else
Action := caNone;
end;
end;
procedure TJvFullColorCircleDialog.FormShow(Sender: TObject);
begin
if FForm<>nil then
begin
FDelta.ColorID := FForm.ColorID;
FDelta.AxisRed := FForm.RedDelta;
FDelta.AxisGreen := FForm.GreenDelta;
FDelta.AxisBlue := FForm.BlueDelta;
if Assigned(FOnShow) then
FOnShow(Self);
end;
end;
procedure TJvFullColorCircleDialog.SetColorID(
const Value: TJvFullColorSpaceID);
begin
FDelta.ColorID := Value;
if FForm <> nil then
FForm.SetColorID(Value);
end;
procedure TJvFullColorCircleDialog.SetDelta(const Index: TJvRotateColor;
const Value: TJvAxisDelta);
begin
case Index of
rcRed :
begin
FDelta.AxisRed := Value;
if FForm <> nil then
FForm.SetRedDelta(Value);
end;
rcGreen :
begin
FDelta.AxisGreen := Value;
if FForm <> nil then
FForm.SetGreenDelta(Value);
end;
rcBlue :
begin
FDelta.AxisBlue := Value;
if FForm <> nil then
FForm.SetBlueDelta(Value);
end;
end;
end;
procedure TJvFullColorCircleDialog.SetHelpContext(const Value: THelpContext);
begin
FHelpContext := Value;
if FForm <> nil then
FForm.HelpContext := Value;
end;
procedure TJvFullColorCircleDialog.SetOptions(const Value: TJvFullColorCircleDialogOptions);
begin
FOptions := Value;
if FForm <> nil then
FForm.Options := Value;
end;
procedure TJvFullColorCircleDialog.SetTitle(const Value: string);
begin
FTitle := Value;
if FForm <> nil then
FForm.Caption := Value;
end;
procedure Register;
begin
RegisterComponents('Jv Colors', [TJvFullColorDialog, TJvFullColorCircleDialog]);
end;
{$IFDEF UNITVERSIONING}
const
UnitVersioning: TUnitVersionInfo = (
RCSfile: '$RCSfile$';
Revision: '$Revision$';
Date: '$Date$';
LogPath: 'JVCL\run'
);
initialization
RegisterUnitVersion(HInstance, UnitVersioning);
finalization
UnregisterUnitVersion(HInstance);
{$ENDIF UNITVERSIONING}
end.
| 29.158451 | 119 | 0.734875 |
fc33dd518f63f73d9522e03da8250d7b443eab36 | 241 | pas | Pascal | Test/FailureScripts/default_constructor.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 79 | 2015-03-18T10:46:13.000Z | 2022-03-17T18:05:11.000Z | Test/FailureScripts/default_constructor.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 6 | 2016-03-29T14:39:00.000Z | 2020-09-14T10:04:14.000Z | Test/FailureScripts/default_constructor.pas | skolkman/dwscript | b9f99d4b8187defac3f3713e2ae0f7b83b63d516 | [
"Condor-1.1"
]
| 25 | 2016-05-04T13:11:38.000Z | 2021-09-29T13:34:31.000Z | type
TMyClass = class
constructor Hello; default;
constructor World; default;
end;
type
TMyClass2 = class (TMyClass)
constructor World; default;
procedure Dummy; default;
end;
{$FATAL 'done'} | 18.538462 | 34 | 0.614108 |
fc05e601919d0d3a0f8724cff1778c1876322402 | 2,346 | dfm | Pascal | src/UnitNametableOffset.dfm | arlm/nesst | 7ed50a87128764acd7e646a64a7cd1b7af05e199 | [
"OLDAP-2.4",
"OLDAP-2.3"
]
| 2 | 2021-09-20T12:52:27.000Z | 2021-12-29T02:48:35.000Z | src/UnitNametableOffset.dfm | arlm/nesst | 7ed50a87128764acd7e646a64a7cd1b7af05e199 | [
"OLDAP-2.4",
"OLDAP-2.3"
]
| null | null | null | src/UnitNametableOffset.dfm | arlm/nesst | 7ed50a87128764acd7e646a64a7cd1b7af05e199 | [
"OLDAP-2.4",
"OLDAP-2.3"
]
| null | null | null | object FormNameOffset: TFormNameOffset
Left = 0
Top = 0
BorderIcons = []
BorderStyle = bsSingle
Caption = 'offset/replace'
ClientHeight = 184
ClientWidth = 243
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poMainFormCenter
Scaled = False
OnCreate = FormCreate
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 16
object GroupBox1: TGroupBox
Left = 0
Top = 0
Width = 243
Height = 184
Align = alClient
TabOrder = 0
object LabelFromTo: TLabel
Left = 96
Top = 27
Width = 33
Height = 16
Alignment = taRightJustify
Caption = 'range'
Layout = tlBottom
end
object LabelOffset: TLabel
Left = 97
Top = 69
Width = 32
Height = 16
Alignment = taRightJustify
Caption = 'offset'
end
object LabelInfo: TLabel
Left = 12
Top = 104
Width = 22
Height = 16
Caption = 'Info'
end
object ButtonOk: TButton
Left = 77
Top = 148
Width = 75
Height = 25
Caption = 'Ok'
TabOrder = 0
OnClick = ButtonOkClick
end
object ButtonCancel: TButton
Left = 158
Top = 148
Width = 75
Height = 25
Caption = 'Cancel'
TabOrder = 1
OnClick = ButtonCancelClick
end
object EditFrom: TEdit
Left = 135
Top = 24
Width = 42
Height = 24
MaxLength = 4
TabOrder = 2
Text = '0'
OnChange = EditFromChange
OnKeyPress = EditFromKeyPress
OnMouseDown = EditFromMouseDown
end
object EditTo: TEdit
Left = 191
Top = 24
Width = 42
Height = 24
MaxLength = 4
TabOrder = 3
Text = '255'
OnChange = EditFromChange
OnKeyPress = EditFromKeyPress
OnMouseDown = EditFromMouseDown
end
object EditOffset: TEdit
Left = 135
Top = 66
Width = 42
Height = 24
MaxLength = 4
TabOrder = 4
Text = '0'
OnChange = EditFromChange
OnKeyPress = EditFromKeyPress
OnMouseDown = EditFromMouseDown
end
end
end
| 21.522936 | 39 | 0.554561 |
f12030ab8a1fb135d8ab1c6d84265d2540950721 | 33,599 | pas | Pascal | Libraries/Spring4D/Source/Core/Container/Spring.Container.Registration.pas | jpluimers/Concepts | 78598ab6f1b4206bbc4ed9c7bc15705ad4ade1fe | [
"Apache-2.0"
]
| 2 | 2020-01-04T08:19:10.000Z | 2020-02-19T22:25:38.000Z | Libraries/Spring4D/Source/Core/Container/Spring.Container.Registration.pas | jpluimers/Concepts | 78598ab6f1b4206bbc4ed9c7bc15705ad4ade1fe | [
"Apache-2.0"
]
| null | null | null | Libraries/Spring4D/Source/Core/Container/Spring.Container.Registration.pas | jpluimers/Concepts | 78598ab6f1b4206bbc4ed9c7bc15705ad4ade1fe | [
"Apache-2.0"
]
| 1 | 2020-02-19T22:25:42.000Z | 2020-02-19T22:25:42.000Z | {***************************************************************************}
{ }
{ Spring Framework for Delphi }
{ }
{ Copyright (c) 2009-2016 Spring4D Team }
{ }
{ http://www.spring4d.org }
{ }
{***************************************************************************}
{ }
{ Licensed under the Apache License, Version 2.0 (the "License"); }
{ you may not use this file except in compliance with the License. }
{ You may obtain a copy of the License at }
{ }
{ http://www.apache.org/licenses/LICENSE-2.0 }
{ }
{ Unless required by applicable law or agreed to in writing, software }
{ distributed under the License is distributed on an "AS IS" BASIS, }
{ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }
{ See the License for the specific language governing permissions and }
{ limitations under the License. }
{ }
{***************************************************************************}
{$I Spring.inc}
unit Spring.Container.Registration;
interface
uses
Rtti,
Spring,
Spring.Collections,
{$IFDEF DELPHIXE_UP}
Spring.VirtualInterface,
{$ENDIF}
Spring.Container.Common,
Spring.Container.Core;
type
/// <summary>
/// TComponentRegistry
/// </summary>
TComponentRegistry = class(TInterfacedObject, IComponentRegistry)
private
fKernel: IKernel;
fModels: IList<TComponentModel>;
fDefaultRegistrations: IDictionary<PTypeInfo, TComponentModel>;
fUnnamedRegistrations: IMultiMap<PTypeInfo, TComponentModel>;
fServiceTypeMappings: IMultiMap<PTypeInfo, TComponentModel>;
fServiceNameMappings: IDictionary<string, TComponentModel>;
fOnChanged: ICollectionChangedEvent<TComponentModel>;
function GetOnChanged: ICollectionChangedEvent<TComponentModel>;
protected
procedure CheckIsNonGuidInterface(const serviceType: TRttiType);
{$IFDEF DELPHIXE_UP}
function InternalResolveParams(const method: TRttiMethod;
const args: TArray<TValue>; paramResolution: TParamResolution): TArray<TValue>;
procedure InternalRegisterFactory(const model: TComponentModel;
const invokeEvent: TVirtualInterfaceInvokeEvent);
{$ENDIF}
procedure RegisterUnnamed(const model: TComponentModel; serviceType: PTypeInfo);
procedure Validate(const componentType, serviceType: TRttiType; var serviceName: string);
public
constructor Create(const kernel: IKernel);
function RegisterComponent(componentTypeInfo: PTypeInfo): TComponentModel;
procedure RegisterService(const model: TComponentModel; serviceType: PTypeInfo); overload;
procedure RegisterService(const model: TComponentModel; serviceType: PTypeInfo;
const serviceName: string); overload;
procedure RegisterDefault(const model: TComponentModel; serviceType: PTypeInfo);
{$IFDEF DELPHIXE_UP}
procedure RegisterFactory(const model: TComponentModel;
paramResolution: TParamResolution = TParamResolution.ByName); overload;
procedure RegisterFactory(const model: TComponentModel;
const resolvedServiceName: string;
paramResolution: TParamResolution = TParamResolution.ByName); overload;
{$ENDIF}
procedure UnregisterAll;
function HasService(serviceType: PTypeInfo): Boolean; overload;
function HasService(const serviceName: string): Boolean; overload;
function HasService(serviceType: PTypeInfo; const serviceName: string): Boolean; overload;
function HasDefault(serviceType: PTypeInfo): Boolean;
function FindOne(componentType: PTypeInfo): TComponentModel; overload;
function FindOne(const serviceName: string): TComponentModel; overload;
function FindOne(serviceType: PTypeInfo; const argument: TValue): TComponentModel; overload;
function FindDefault(serviceType: PTypeInfo): TComponentModel;
function FindAll: IEnumerable<TComponentModel>; overload;
function FindAll(serviceType: PTypeInfo): IEnumerable<TComponentModel>; overload;
end;
/// <summary>
/// Internal helper for non-generic fluent style registration of a type.
/// </summary>
TRegistration = class sealed(TInterfacedObject, IRegistration)
private
fKernel: IKernel;
fModel: TComponentModel;
constructor Create(const kernel: IKernel; componentType: PTypeInfo);
{$IFDEF DELPHIXE_UP}
procedure InterceptedBy(const interceptorRef: TInterceptorReference; where: TWhere); overload;
{$ENDIF}
public
function Implements(serviceType: PTypeInfo): IRegistration; overload;
function Implements(serviceType: PTypeInfo; const serviceName: string): IRegistration; overload;
function DelegateTo(const delegate: TActivatorDelegate): IRegistration; overload;
{$REGION 'Typed Injections'}
function InjectConstructor: IRegistration; overload;
function InjectConstructor(const parameterTypes: array of PTypeInfo): IRegistration; overload;
function InjectProperty(const propertyName: string): IRegistration; overload;
function InjectMethod(const methodName: string): IRegistration; overload;
function InjectMethod(const methodName: string; const parameterTypes: array of PTypeInfo): IRegistration; overload;
function InjectField(const fieldName: string): IRegistration; overload;
{$ENDREGION}
{$REGION 'Named/Valued Injections'}
function InjectConstructor(const arguments: array of TValue): IRegistration; overload;
function InjectProperty(const propertyName: string; const value: TValue): IRegistration; overload;
function InjectMethod(const methodName: string; const arguments: array of TValue): IRegistration; overload;
function InjectField(const fieldName: string; const value: TValue): IRegistration; overload;
{$ENDREGION}
function AsSingleton(refCounting: TRefCounting = TRefCounting.Unknown): IRegistration;
function AsSingletonPerThread(refCounting: TRefCounting = TRefCounting.Unknown): IRegistration;
function AsTransient: IRegistration;
function AsPooled(minPoolSize, maxPoolSize: Integer): IRegistration;
function AsCustom(const lifetimeManager: IInterface): IRegistration;
function PerResolve: IRegistration;
function AsDefault: IRegistration; overload;
function AsDefault(serviceType: PTypeInfo): IRegistration; overload;
{$IFDEF DELPHIXE_UP}
function AsFactory(paramResolution: TParamResolution = TParamResolution.ByName): IRegistration; overload;
function AsFactory(const resolvedServiceName: string;
paramResolution: TParamResolution = TParamResolution.ByName): IRegistration; overload;
function InterceptedBy(interceptorType: PTypeInfo;
where: TWhere = TWhere.Last): IRegistration; overload;
function InterceptedBy(const name: string;
where: TWhere = TWhere.Last): IRegistration; overload;
{$ENDIF}
end;
/// <summary>
/// Internal helper for generic fluent style registration of a type.
/// </summary>
TRegistration<T> = record
private
fRegistration: IRegistration;
// prevent some bug with wrong reference counting in
// records containing only one field of an interface type
{$IFDEF DELPHI2010}{$HINTS OFF}fDummy: Pointer;{$ENDIF}
constructor Create(const kernel: IKernel);
function GetModel: TComponentModel;
public
function Implements(serviceType: PTypeInfo): TRegistration<T>; overload;
function Implements(serviceType: PTypeInfo; const serviceName: string): TRegistration<T>; overload;
function Implements<TServiceType>: TRegistration<T>; overload;
function Implements<TServiceType>(const serviceName: string): TRegistration<T>; overload;
function DelegateTo(const delegate: TActivatorDelegate<T>): TRegistration<T>; overload;
{$REGION 'Typed Injections'}
function InjectConstructor: TRegistration<T>; overload;
function InjectConstructor(const parameterTypes: array of PTypeInfo): TRegistration<T>; overload;
function InjectProperty(const propertyName: string): TRegistration<T>; overload;
function InjectMethod(const methodName: string): TRegistration<T>; overload;
function InjectMethod(const methodName: string; const parameterTypes: array of PTypeInfo): TRegistration<T>; overload;
function InjectField(const fieldName: string): TRegistration<T>; overload;
{$ENDREGION}
{$REGION 'Named/Valued Injections'}
function InjectConstructor(const arguments: array of TValue): TRegistration<T>; overload;
function InjectProperty(const propertyName: string; const value: TValue): TRegistration<T>; overload;
function InjectMethod(const methodName: string; const arguments: array of TValue): TRegistration<T>; overload;
function InjectField(const fieldName: string; const value: TValue): TRegistration<T>; overload;
{$ENDREGION}
function AsSingleton(refCounting: TRefCounting = TRefCounting.Unknown): TRegistration<T>;
function AsSingletonPerThread(refCounting: TRefCounting = TRefCounting.Unknown): TRegistration<T>;
function AsTransient: TRegistration<T>;
function AsPooled(minPoolSize, maxPoolSize: Integer): TRegistration<T>;
function PerResolve: TRegistration<T>;
function AsDefault: TRegistration<T>; overload;
function AsDefault(serviceType: PTypeInfo): TRegistration<T>; overload;
function AsDefault<TServiceType>: TRegistration<T>; overload;
function AsCustom<TLifetimeManagerType: class, constructor, ILifetimeManager>: TRegistration<T>;
{$IFDEF DELPHIXE_UP}
function AsFactory(paramResolution: TParamResolution = TParamResolution.ByName): TRegistration<T>; overload;
function AsFactory(const resolvedServiceName: string;
paramResolution: TParamResolution = TParamResolution.ByName): TRegistration<T>; overload;
function InterceptedBy(interceptorType: PTypeInfo;
where: TWhere = TWhere.Last): TRegistration<T>; overload;
function InterceptedBy(const name: string;
where: TWhere = TWhere.Last): TRegistration<T>; overload;
function InterceptedBy<TInterceptorType>(
where: TWhere = TWhere.Last): TRegistration<T>; overload;
{$ENDIF}
property Model: TComponentModel read GetModel;
end;
/// <summary>
/// Provides both generic and non-generic fluent-style registration
/// methods.
/// </summary>
/// <remarks>
/// TRegistration(T) is defined as record and the constructors of
/// TRegistration and TRegistration(T) are private because they serve as
/// helpers to provide generic and non-generic fluent-style registration
/// with only necessary methods.
/// </remarks>
TRegistrationManager = class
private
fKernel: IKernel;
public
constructor Create(const kernel: IKernel);
function RegisterType<TComponentType>: TRegistration<TComponentType>; overload;
function RegisterType(componentType: PTypeInfo): IRegistration; overload;
end;
implementation
uses
SysUtils,
TypInfo,
Spring.Collections.Events,
Spring.Collections.Extensions,
Spring.Collections.Lists,
Spring.Container.Resolvers,
Spring.Container.ResourceStrings,
Spring.Reflection;
{$REGION 'TComponentRegistry'}
constructor TComponentRegistry.Create(const kernel: IKernel);
begin
{$IFDEF SPRING_ENABLE_GUARD}
Guard.CheckNotNull(kernel, 'kernel');
{$ENDIF}
inherited Create;
fKernel := kernel;
fOnChanged := TCollectionChangedEventImpl<TComponentModel>.Create;
fModels := TCollections.CreateObjectList<TComponentModel>(True);
fModels.OnChanged.Add(fOnChanged.Invoke);
fDefaultRegistrations := TCollections.CreateDictionary<PTypeInfo, TComponentModel>;
fDefaultRegistrations.OnValueChanged.Add(fOnChanged.Invoke);
fUnnamedRegistrations := TCollections.CreateMultiMap<PTypeInfo, TComponentModel>;
fUnnamedRegistrations.OnValueChanged.Add(fOnChanged.Invoke);
fServiceTypeMappings := TCollections.CreateMultiMap<PTypeInfo, TComponentModel>;
fServiceTypeMappings.OnValueChanged.Add(fOnChanged.Invoke);
fServiceNameMappings := TCollections.CreateDictionary<string, TComponentModel>;
fServiceNameMappings.OnValueChanged.Add(fOnChanged.Invoke);
end;
procedure TComponentRegistry.CheckIsNonGuidInterface(const serviceType: TRttiType);
begin
if serviceType.IsInterface and not serviceType.AsInterface.HasGuid
and not TType.IsDelegate(serviceType.Handle) then
raise ERegistrationException.CreateResFmt(@SMissingGuid, [serviceType.DefaultName]);
end;
procedure TComponentRegistry.Validate(const componentType, serviceType: TRttiType;
var serviceName: string);
begin
CheckIsNonGuidInterface(serviceType);
if not serviceType.IsAssignableFrom(componentType)
and not componentType.IsInterface then
raise ERegistrationException.CreateResFmt(@SIncompatibleTypes, [
componentType.DefaultName, serviceType.DefaultName]);
if serviceName = '' then
serviceName := serviceType.DefaultName + '@' + componentType.DefaultName;
if HasService(serviceName) then
raise ERegistrationException.CreateResFmt(@SDuplicateServiceName, [serviceName]);
end;
procedure TComponentRegistry.UnregisterAll;
begin
fOnChanged.Enabled := False;
try
fServiceNameMappings.Clear;
fServiceTypeMappings.Clear;
fDefaultRegistrations.Clear;
fUnnamedRegistrations.Clear;
fModels.Clear;
finally
fOnChanged.Enabled := True;
end;
end;
procedure TComponentRegistry.RegisterService(const model: TComponentModel;
serviceType: PTypeInfo);
begin
RegisterService(model, serviceType, '');
end;
procedure TComponentRegistry.RegisterService(const model: TComponentModel;
serviceType: PTypeInfo; const serviceName: string);
var
internalServiceName: string;
begin
{$IFDEF SPRING_ENABLE_GUARD}
Guard.CheckNotNull(model, 'model');
Guard.CheckNotNull(serviceType, 'serviceType');
{$ENDIF}
internalServiceName := serviceName;
Validate(model.ComponentType, serviceType.RttiType, internalServiceName);
model.Services[internalServiceName] := serviceType;
fServiceTypeMappings.Add(serviceType, model);
fServiceNameMappings.Add(internalServiceName, model);
if serviceName = '' then
begin
RegisterDefault(model, serviceType);
RegisterUnnamed(model, serviceType);
end;
end;
procedure TComponentRegistry.RegisterUnnamed(const model: TComponentModel;
serviceType: PTypeInfo);
begin
fUnnamedRegistrations.Add(serviceType, model);
end;
procedure TComponentRegistry.RegisterDefault(const model: TComponentModel;
serviceType: PTypeInfo);
begin
if not model.HasService(serviceType) then
raise ERegistrationException.CreateResFmt(@SServiceNotFound, [
serviceType.TypeName]);
fDefaultRegistrations.AddOrSetValue(serviceType, model);
end;
{$IFDEF DELPHIXE_UP}
type
TVirtualInterfaceHack = class(TInterfacedObject)
private
type
{$POINTERMATH ON}
PVTable = ^Pointer;
{$POINTERMATH OFF}
var VTable: PVTable;
end;
function TComponentRegistry.InternalResolveParams(const method: TRttiMethod;
const args: TArray<TValue>; paramResolution: TParamResolution): TArray<TValue>;
var
params: TArray<TRttiParameter>;
i: Integer;
begin
case paramResolution of
TParamResolution.ByName:
begin
SetLength(Result, Length(args) - 1);
params := method.GetParameters;
for i := 0 to High(params) do
Result[i] := TNamedValue.Create(params[i].Name, args[i + 1]);
end
else
Result := Copy(args, 1);
end;
end;
procedure TComponentRegistry.InternalRegisterFactory(
const model: TComponentModel; const invokeEvent: TVirtualInterfaceInvokeEvent);
var
methods: TArray<TRttiMethod>;
maxVirtualIndex: SmallInt;
method: TRttiMethod;
begin
methods := model.ComponentType.GetMethods;
if Length(methods) = 0 then
raise ERegistrationException.CreateResFmt(@SUnsupportedFactoryType, [
model.ComponentTypeName]);
for method in methods do
if not Assigned(method.ReturnType)
or method.Parameters.Any(TParameterFilters.HasFlags([pfOut])) then
raise ERegistrationException.CreateResFmt(@SUnsupportedFactoryMethod, [
model.ComponentTypeName, method.ToString]);
maxVirtualIndex := 2;
for method in methods do
if maxVirtualIndex < method.VirtualIndex then
maxVirtualIndex := method.VirtualIndex;
model.ActivatorDelegate :=
function: TValue
var
factory: TVirtualInterface;
intf: IInterface;
begin
factory := TVirtualInterface.Create(model.ComponentTypeInfo, invokeEvent);
if TType.IsDelegate(model.ComponentTypeInfo) then
if maxVirtualIndex > 3 then
TVirtualInterfaceHack(factory).VTable[3] :=
TVirtualInterfaceHack(factory).VTable[maxVirtualIndex];
factory.QueryInterface(model.ComponentTypeInfo.TypeData.Guid, intf);
TValue.Make(@intf, model.ComponentTypeInfo, Result);
end;
end;
procedure TComponentRegistry.RegisterFactory(const model: TComponentModel;
paramResolution: TParamResolution);
var
invokeEvent: TVirtualInterfaceInvokeEvent;
begin
invokeEvent :=
procedure(method: TRttiMethod; const args: TArray<TValue>; out result: TValue)
var
arguments: TArray<TValue>;
begin
arguments := InternalResolveParams(method, args, paramResolution);
result := (fKernel as IKernelInternal).Resolve(
method.ReturnType.Handle, arguments);
end;
InternalRegisterFactory(model, invokeEvent);
end;
procedure TComponentRegistry.RegisterFactory(const model: TComponentModel;
const resolvedServiceName: string; paramResolution: TParamResolution);
var
invokeEvent: TVirtualInterfaceInvokeEvent;
begin
invokeEvent :=
procedure(method: TRttiMethod; const args: TArray<TValue>; out result: TValue)
var
arguments: TArray<TValue>;
begin
arguments := InternalResolveParams(method, args, paramResolution);
result := (fKernel as IKernelInternal).Resolve(
resolvedServiceName, arguments);
end;
InternalRegisterFactory(model, invokeEvent);
end;
{$ENDIF}
function TComponentRegistry.RegisterComponent(
componentTypeInfo: PTypeInfo): TComponentModel;
begin
{$IFDEF SPRING_ENABLE_GUARD}
Guard.CheckNotNull(componentTypeInfo, 'componentTypeInfo');
{$ENDIF}
Result := TComponentModel.Create(componentTypeInfo.RttiType);
fModels.Add(Result);
end;
function TComponentRegistry.FindOne(const serviceName: string): TComponentModel;
begin
fServiceNameMappings.TryGetValue(serviceName, Result);
end;
function TComponentRegistry.FindOne(componentType: PTypeInfo): TComponentModel;
begin
{$IFDEF SPRING_ENABLE_GUARD}
Guard.CheckNotNull(componentType, 'componentType');
{$ENDIF}
Result := fModels.FirstOrDefault(
function(const model: TComponentModel): Boolean
begin
Result := model.ComponentTypeInfo = componentType;
end);
end;
function TComponentRegistry.FindOne(serviceType: PTypeInfo;
const argument: TValue): TComponentModel;
var
serviceName: string;
begin
if argument.IsEmpty then
begin
if not HasService(serviceType) then
raise EResolveException.CreateResFmt(@SCannotResolveType, [
serviceType.TypeName])
else
begin
Result := FindDefault(serviceType);
if not Assigned(Result) then
raise EResolveException.CreateResFmt(@SNoDefaultFound, [
serviceType.TypeName]);
end;
end
else if argument.IsString then
begin
serviceName := argument.AsString;
Result := FindOne(serviceName);
if not Assigned(Result) then
raise EResolveException.CreateResFmt(@SServiceNotFound, [serviceName]);
if not IsAssignableFrom(serviceType, Result.Services[serviceName]) then
raise EResolveException.CreateResFmt(@SCannotResolveType, [
serviceType.TypeName]);
end
else
raise EResolveException.CreateResFmt(@SCannotResolveType, [
serviceType.TypeName]);
end;
function TComponentRegistry.GetOnChanged: ICollectionChangedEvent<TComponentModel>;
begin
Result := fOnChanged;
end;
function TComponentRegistry.FindDefault(
serviceType: PTypeInfo): TComponentModel;
begin
{$IFDEF SPRING_ENABLE_GUARD}
Guard.CheckNotNull(serviceType, 'serviceType');
{$ENDIF}
if not fDefaultRegistrations.TryGetValue(serviceType, Result) then
fServiceTypeMappings[serviceType].TryGetSingle(Result);
end;
function TComponentRegistry.FindAll: IEnumerable<TComponentModel>;
begin
Result := fModels;
end;
function TComponentRegistry.FindAll(
serviceType: PTypeInfo): IEnumerable<TComponentModel>;
var
models: IReadOnlyList<TComponentModel>;
unnamedModels: IReadOnlyList<TComponentModel>;
begin
{$IFDEF SPRING_ENABLE_GUARD}
Guard.CheckNotNull(serviceType, 'serviceType');
{$ENDIF}
if fServiceTypeMappings.TryGetValues(serviceType, models) then
begin
if fUnnamedRegistrations.TryGetValues(serviceType, unnamedModels) then
Result := TExceptIterator<TComponentModel>.Create(models, unnamedModels)
else
Result := models;
end
else
Result := TEnumerable.Empty<TComponentModel>;
end;
function TComponentRegistry.HasService(serviceType: PTypeInfo): Boolean;
begin
{$IFDEF SPRING_ENABLE_GUARD}
Guard.CheckNotNull(serviceType, 'serviceType');
{$ENDIF}
Result := fServiceTypeMappings.ContainsKey(serviceType);
end;
function TComponentRegistry.HasService(const serviceName: string): Boolean;
begin
Result := fServiceNameMappings.ContainsKey(serviceName);
end;
function TComponentRegistry.HasService(serviceType: PTypeInfo;
const serviceName: string): Boolean;
var
model: TComponentModel;
begin
{$IFDEF SPRING_ENABLE_GUARD}
Guard.CheckNotNull(serviceType, 'serviceType');
{$ENDIF}
Result := fServiceNameMappings.TryGetValue(serviceName, model)
and model.HasService(serviceType);
end;
function TComponentRegistry.HasDefault(serviceType: PTypeInfo): Boolean;
begin
Result := fDefaultRegistrations.ContainsKey(serviceType)
or (fServiceTypeMappings[serviceType].Count = 1);
end;
{$ENDREGION}
{$REGION 'TRegistration'}
constructor TRegistration.Create(const kernel: IKernel;
componentType: PTypeInfo);
begin
{$IFDEF SPRING_ENABLE_GUARD}
Guard.CheckNotNull(kernel, 'kernel');
Guard.CheckNotNull(componentType, 'componentType');
{$ENDIF}
fKernel := kernel;
fModel := fKernel.Registry.RegisterComponent(componentType);
end;
function TRegistration.Implements(serviceType: PTypeInfo): IRegistration;
begin
fKernel.Registry.RegisterService(fModel, serviceType);
Result := Self;
end;
function TRegistration.Implements(serviceType: PTypeInfo;
const serviceName: string): IRegistration;
begin
fKernel.Registry.RegisterService(fModel, serviceType, serviceName);
Result := Self;
end;
function TRegistration.DelegateTo(const delegate: TActivatorDelegate): IRegistration;
begin
fModel.ActivatorDelegate := delegate;
Result := Self;
end;
function TRegistration.InjectConstructor: IRegistration;
begin
fKernel.Injector.InjectConstructor(fModel);
Result := Self;
end;
function TRegistration.InjectConstructor(
const parameterTypes: array of PTypeInfo): IRegistration;
begin
fKernel.Injector.InjectConstructor(fModel, parameterTypes);
Result := Self;
end;
function TRegistration.InjectProperty(
const propertyName: string): IRegistration;
begin
fKernel.Injector.InjectProperty(fModel, propertyName);
Result := Self;
end;
function TRegistration.InjectMethod(const methodName: string;
const parameterTypes: array of PTypeInfo): IRegistration;
begin
fKernel.Injector.InjectMethod(fModel, methodName, parameterTypes);
Result := Self;
end;
function TRegistration.InjectMethod(const methodName: string): IRegistration;
begin
fKernel.Injector.InjectMethod(fModel, methodName);
Result := Self;
end;
function TRegistration.InjectField(const fieldName: string): IRegistration;
begin
fKernel.Injector.InjectField(fModel, fieldName);
Result := Self;
end;
function TRegistration.InjectConstructor(
const arguments: array of TValue): IRegistration;
begin
fKernel.Injector.InjectConstructor(fModel, arguments);
Result := Self;
end;
function TRegistration.InjectProperty(const propertyName: string;
const value: TValue): IRegistration;
begin
fKernel.Injector.InjectProperty(fModel, propertyName, value);
Result := Self;
end;
function TRegistration.InjectMethod(const methodName: string;
const arguments: array of TValue): IRegistration;
begin
fKernel.Injector.InjectMethod(fModel, methodName, arguments);
Result := Self;
end;
function TRegistration.InjectField(const fieldName: string;
const value: TValue): IRegistration;
begin
fKernel.Injector.InjectField(fModel, fieldName, value);
Result := Self;
end;
function TRegistration.AsSingleton(refCounting: TRefCounting): IRegistration;
begin
fModel.LifetimeType := TLifetimeType.Singleton;
fModel.RefCounting := refCounting;
Result := Self;
end;
function TRegistration.AsSingletonPerThread(refCounting: TRefCounting): IRegistration;
begin
fModel.LifetimeType := TLifetimeType.SingletonPerThread;
fModel.RefCounting := refCounting;
Result := Self;
end;
function TRegistration.AsTransient: IRegistration;
begin
fModel.LifetimeType := TLifetimeType.Transient;
Result := Self;
end;
function TRegistration.AsPooled(minPoolSize, maxPoolSize: Integer): IRegistration;
begin
fModel.LifetimeType := TLifetimeType.Pooled;
fModel.MinPoolsize := minPoolSize;
fModel.MaxPoolsize := maxPoolSize;
Result := Self;
end;
function TRegistration.AsDefault: IRegistration;
var
serviceType: PTypeInfo;
begin
for serviceType in fModel.Services.Values do
fKernel.Registry.RegisterDefault(fModel, serviceType);
Result := Self;
end;
function TRegistration.AsCustom(
const lifetimeManager: IInterface): IRegistration;
begin
fModel.LifetimeType := TLifetimeType.Custom;
fModel.LifetimeManager := lifetimeManager as ILifetimeManager;
Result := Self;
end;
function TRegistration.AsDefault(serviceType: PTypeInfo): IRegistration;
begin
fKernel.Registry.RegisterDefault(fModel, serviceType);
Result := Self;
end;
{$IFDEF DELPHIXE_UP}
function TRegistration.AsFactory(
paramResolution: TParamResolution): IRegistration;
begin
fKernel.Registry.RegisterFactory(fModel, paramResolution);
Result := Self;
end;
function TRegistration.AsFactory(const resolvedServiceName: string;
paramResolution: TParamResolution = TParamResolution.ByName): IRegistration;
begin
fKernel.Registry.RegisterFactory(fModel, resolvedServiceName, paramResolution);
Result := Self;
end;
procedure TRegistration.InterceptedBy(
const interceptorRef: TInterceptorReference; where: TWhere);
begin
case where of
TWhere.First: fModel.Interceptors.Insert(0, interceptorRef);
else
fModel.Interceptors.Add(interceptorRef);
end;
end;
function TRegistration.InterceptedBy(interceptorType: PTypeInfo;
where: TWhere): IRegistration;
begin
InterceptedBy(TInterceptorReference.Create(interceptorType), where);
Result := Self;
end;
function TRegistration.InterceptedBy(const name: string;
where: TWhere): IRegistration;
begin
InterceptedBy(TInterceptorReference.Create(name), where);
Result := Self;
end;
{$ENDIF}
function TRegistration.PerResolve: IRegistration;
begin
fModel.LifetimeType := TLifetimeType.PerResolve;
Result := Self;
end;
{$ENDREGION}
{$REGION 'TRegistration<T>'}
constructor TRegistration<T>.Create(const kernel: IKernel);
begin
fRegistration := TRegistration.Create(kernel, TypeInfo(T));
end;
function TRegistration<T>.Implements(serviceType: PTypeInfo): TRegistration<T>;
begin
fRegistration.Implements(serviceType);
Result := Self;
end;
function TRegistration<T>.Implements(serviceType: PTypeInfo;
const serviceName: string): TRegistration<T>;
begin
fRegistration.Implements(serviceType, serviceName);
Result := Self;
end;
function TRegistration<T>.Implements<TServiceType>: TRegistration<T>;
begin
Result := Implements(TypeInfo(TServiceType));
end;
function TRegistration<T>.Implements<TServiceType>(
const serviceName: string): TRegistration<T>;
begin
Result := Implements(TypeInfo(TServiceType), serviceName);
end;
function TRegistration<T>.DelegateTo(
const delegate: TActivatorDelegate<T>): TRegistration<T>;
begin
fRegistration.DelegateTo(
function: TValue
begin
Result := TValue.From<T>(delegate());
end);
Result := Self;
end;
function TRegistration<T>.GetModel: TComponentModel;
begin
Result := (fRegistration as TRegistration).fModel;
end;
function TRegistration<T>.InjectConstructor: TRegistration<T>;
begin
fRegistration.InjectConstructor;
Result := Self;
end;
function TRegistration<T>.InjectConstructor(
const parameterTypes: array of PTypeInfo): TRegistration<T>;
begin
fRegistration.InjectConstructor(parameterTypes);
Result := Self;
end;
function TRegistration<T>.InjectProperty(
const propertyName: string): TRegistration<T>;
begin
fRegistration.InjectProperty(propertyName);
Result := Self;
end;
function TRegistration<T>.InjectMethod(const methodName: string;
const parameterTypes: array of PTypeInfo): TRegistration<T>;
begin
fRegistration.InjectMethod(methodName, parameterTypes);
Result := Self;
end;
function TRegistration<T>.InjectMethod(
const methodName: string): TRegistration<T>;
begin
fRegistration.InjectMethod(methodName);
Result := Self;
end;
function TRegistration<T>.InjectField(
const fieldName: string): TRegistration<T>;
begin
fRegistration.InjectField(fieldName);
Result := Self;
end;
function TRegistration<T>.InjectConstructor(
const arguments: array of TValue): TRegistration<T>;
begin
fRegistration.InjectConstructor(arguments);
Result := Self;
end;
function TRegistration<T>.InjectProperty(const propertyName: string;
const value: TValue): TRegistration<T>;
begin
fRegistration.InjectProperty(propertyName, value);
Result := Self;
end;
function TRegistration<T>.InjectMethod(const methodName: string;
const arguments: array of TValue): TRegistration<T>;
begin
fRegistration.InjectMethod(methodName, arguments);
Result := Self;
end;
function TRegistration<T>.InjectField(const fieldName: string;
const value: TValue): TRegistration<T>;
begin
fRegistration.InjectField(fieldName, value);
Result := Self;
end;
function TRegistration<T>.AsSingleton(refCounting: TRefCounting): TRegistration<T>;
begin
fRegistration.AsSingleton(refCounting);
Result := Self;
end;
function TRegistration<T>.AsSingletonPerThread(refCounting: TRefCounting): TRegistration<T>;
begin
fRegistration.AsSingletonPerThread(refCounting);
Result := Self;
end;
function TRegistration<T>.AsTransient: TRegistration<T>;
begin
fRegistration.AsTransient;
Result := Self;
end;
function TRegistration<T>.AsPooled(minPoolSize, maxPoolSize: Integer): TRegistration<T>;
begin
fRegistration.AsPooled(minPoolSize, maxPoolSize);
Result := Self;
end;
function TRegistration<T>.AsDefault: TRegistration<T>;
begin
fRegistration.AsDefault;
Result := Self;
end;
function TRegistration<T>.AsCustom<TLifetimeManagerType>: TRegistration<T>;
begin
fRegistration.AsCustom(TLifetimeManagerType.Create);
Result := Self;
end;
function TRegistration<T>.AsDefault(serviceType: PTypeInfo): TRegistration<T>;
begin
fRegistration.AsDefault(serviceType);
Result := Self;
end;
function TRegistration<T>.AsDefault<TServiceType>: TRegistration<T>;
begin
Result := AsDefault(TypeInfo(TServiceType));
end;
{$IFDEF DELPHIXE_UP}
function TRegistration<T>.AsFactory(paramResolution: TParamResolution): TRegistration<T>;
begin
fRegistration.AsFactory(paramResolution);
Result := Self;
end;
function TRegistration<T>.AsFactory(const resolvedServiceName: string;
paramResolution: TParamResolution): TRegistration<T>;
begin
fRegistration.AsFactory(resolvedServiceName, paramResolution);
Result := Self;
end;
function TRegistration<T>.InterceptedBy(interceptorType: PTypeInfo;
where: TWhere): TRegistration<T>;
begin
fRegistration.InterceptedBy(interceptorType, where);
Result := Self;
end;
function TRegistration<T>.InterceptedBy(const name: string;
where: TWhere): TRegistration<T>;
begin
fRegistration.InterceptedBy(name, where);
Result := Self;
end;
function TRegistration<T>.InterceptedBy<TInterceptorType>(
where: TWhere = TWhere.Last): TRegistration<T>;
begin
fRegistration.InterceptedBy(TypeInfo(TInterceptorType), where);
Result := Self;
end;
{$ENDIF}
function TRegistration<T>.PerResolve: TRegistration<T>;
begin
fRegistration.PerResolve;
Result := Self;
end;
{$ENDREGION}
{$REGION 'TRegistrationManager'}
constructor TRegistrationManager.Create(const kernel: IKernel);
begin
inherited Create;
fKernel := kernel;
end;
function TRegistrationManager.RegisterType(
componentType: PTypeInfo): IRegistration;
begin
{$IFDEF SPRING_ENABLE_GUARD}
Guard.CheckNotNull(componentType, 'componentType');
{$ENDIF}
Result := TRegistration.Create(fKernel, componentType);
end;
function TRegistrationManager.RegisterType<TComponentType>: TRegistration<TComponentType>;
begin
Result := TRegistration<TComponentType>.Create(fKernel);
end;
{$ENDREGION}
end.
| 32.337825 | 122 | 0.748594 |
f1dcac4eb22c81529042ad57b1b8ce9f1a55baeb | 2,883 | pas | Pascal | Server/xProductStoreDocItem.pas | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| null | null | null | Server/xProductStoreDocItem.pas | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| null | null | null | Server/xProductStoreDocItem.pas | Sembium/Sembium3 | 0179c38c6a217f71016f18f8a419edd147294b73 | [
"Apache-2.0"
]
| 3 | 2021-06-30T10:11:17.000Z | 2021-07-01T09:13:29.000Z |
{*********************************************************************************}
{ }
{ XML Data Binding }
{ }
{ Generated on: 29.8.2005 15:37:53 }
{ Generated from: XMLSchemas\Public\ProductStoreDocItem.xsd }
{ }
{*********************************************************************************}
unit xProductStoreDocItem;
interface
uses xmldom, XMLDoc, XMLIntf, xBaseObjectDocItem, xTProductStore;
type
{ Forward Decls }
IXMLTProductStoreDocItem = interface;
{ IXMLTProductStoreDocItem }
IXMLTProductStoreDocItem = interface(IXMLTBaseObjectDocItem)
['{6CE803EC-784E-4725-B121-6CEFA07D9CF2}']
{ Property Accessors }
function Get_ProductStore: IXMLTProductStore;
{ Methods & Properties }
property ProductStore: IXMLTProductStore read Get_ProductStore;
end;
{ Forward Decls }
TXMLTProductStoreDocItem = class;
{ TXMLTProductStoreDocItem }
TXMLTProductStoreDocItem = class(TXMLTBaseObjectDocItem, IXMLTProductStoreDocItem)
protected
{ IXMLTProductStoreDocItem }
function Get_ProductStore: IXMLTProductStore;
public
procedure AfterConstruction; override;
end;
{ Global Functions }
function GetProductStoreDocItem(Doc: IXMLDocument): IXMLTProductStoreDocItem;
function LoadProductStoreDocItem(const FileName: WideString): IXMLTProductStoreDocItem;
function NewProductStoreDocItem: IXMLTProductStoreDocItem;
const
TargetNamespace = '';
implementation
{ Global Functions }
function GetProductStoreDocItem(Doc: IXMLDocument): IXMLTProductStoreDocItem;
begin
Result := Doc.GetDocBinding('ProductStoreDocItem', TXMLTProductStoreDocItem, TargetNamespace) as IXMLTProductStoreDocItem;
end;
function LoadProductStoreDocItem(const FileName: WideString): IXMLTProductStoreDocItem;
begin
Result := LoadXMLDocument(FileName).GetDocBinding('ProductStoreDocItem', TXMLTProductStoreDocItem, TargetNamespace) as IXMLTProductStoreDocItem;
end;
function NewProductStoreDocItem: IXMLTProductStoreDocItem;
begin
Result := NewXMLDocument.GetDocBinding('ProductStoreDocItem', TXMLTProductStoreDocItem, TargetNamespace) as IXMLTProductStoreDocItem;
end;
{ TXMLTProductStoreDocItem }
procedure TXMLTProductStoreDocItem.AfterConstruction;
begin
RegisterChildNode('ProductStore', TXMLTProductStore);
inherited;
end;
function TXMLTProductStoreDocItem.Get_ProductStore: IXMLTProductStore;
begin
Result := ChildNodes['ProductStore'] as IXMLTProductStore;
end;
end.
| 32.393258 | 147 | 0.634062 |
85bfed9d0291abd5355fe26d08920d6d591dcbb6 | 4,644 | dpr | Pascal | references/UIB/misc/DBExpress/Install.dpr | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| 851 | 2018-02-05T09:54:56.000Z | 2022-03-24T23:13:10.000Z | references/UIB/misc/DBExpress/Install.dpr | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| 200 | 2018-02-06T18:52:39.000Z | 2022-03-24T19:59:14.000Z | references/UIB/misc/DBExpress/Install.dpr | zekiguven/alcinoe | e55c5368ee8bfe7cd6d92424c29ab07d8a3e844c | [
"Apache-2.0"
]
| 197 | 2018-03-20T20:49:55.000Z | 2022-03-21T17:38:14.000Z | program Install;
{$APPTYPE CONSOLE}
uses
Windows, SysUtils, Registry, Inifiles;
type
TDriverInfo = record
Name: string;
DLL: string;
LIB: string;
EXT: string;
end;
const
DBExpressKey = '\SOFTWARE\Borland\DBExpress';
DriversKey = 'Driver Registry File';
ConnectionsKey = 'Connection Registry File';
InstalledDrivers = 'Installed Drivers';
DriverInfos: array[0..7] of TDriverInfo = (
(Name: 'UIB Interbase6'; DLL: 'dbexpUIBint6.dll'; LIB: 'GDS32.DLL'; EXT: '.ib'),
(Name: 'UIB Interbase65'; DLL: 'dbexpUIBint65.dll'; LIB: 'GDS32.DLL'; EXT: '.ib'),
(Name: 'UIB Interbase7'; DLL: 'dbexpUIBint7.dll'; LIB: 'GDS32.DLL'; EXT: '.ib'),
(Name: 'UIB Interbase71'; DLL: 'dbexpUIBint71.dll'; LIB: 'GDS32.DLL'; EXT: '.ib'),
(Name: 'UIB FireBird102'; DLL: 'dbexpUIBfire102.dll'; LIB: 'GDS32.DLL'; EXT: '.fdb'),
(Name: 'UIB FireBird103'; DLL: 'dbexpUIBfire103.dll'; LIB: 'GDS32.DLL'; EXT: '.fdb'),
(Name: 'UIB FireBird15'; DLL: 'dbexpUIBfire15.dll'; LIB: 'fbclient.dll'; EXT: '.fdb'),
(Name: 'UIB Yaffil'; DLL: 'dbexpUIByaffil.dll'; LIB: 'GDS32.DLL'; EXT: '.gdb')
);
var
Reg: TRegistry;
dbxconnections: TIniFile;
dbxdrivers: TIniFile;
i: Integer;
begin
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
if not Reg.OpenKey(DBExpressKey, False) then
begin
Reg.RootKey := HKEY_CURRENT_USER;
if not Reg.OpenKey(DBExpressKey, False) then
Exit;
end;
begin
dbxdrivers := TIniFile.Create(Reg.ReadString(DriversKey));
dbxconnections := TIniFile.Create(Reg.ReadString(ConnectionsKey));
try
for i := low(DriverInfos) to high(DriverInfos) do
if (dbxdrivers.ReadInteger(InstalledDrivers, DriverInfos[i].Name, 0) <> 1) then
begin
with dbxdrivers do
begin
WriteInteger(InstalledDrivers, DriverInfos[i].Name, 1);
WriteString(DriverInfos[i].Name, 'GetDriverFunc', 'getSQLDriverINTERBASE');
WriteString(DriverInfos[i].Name, 'LibraryName', DriverInfos[i].DLL);
WriteString(DriverInfos[i].Name, 'VendorLib', DriverInfos[i].LIB);
WriteInteger(DriverInfos[i].Name, 'BlobSize', -1);
WriteString(DriverInfos[i].Name, 'CommitRetain', 'False');
WriteString(DriverInfos[i].Name, 'Database', 'database'+ DriverInfos[i].EXT);
WriteString(DriverInfos[i].Name, 'ErrorResourceFile', '');
WriteString(DriverInfos[i].Name, 'LocaleCode', '0000');
WriteString(DriverInfos[i].Name, 'Password', 'masterkey');
WriteString(DriverInfos[i].Name, 'RoleName', 'RoleName');
WriteString(DriverInfos[i].Name, 'ServerCharSet', '');
WriteInteger(DriverInfos[i].Name, 'SQLDialect', 3);
WriteString(DriverInfos[i].Name, 'Interbase TransIsolation', 'ReadCommited');
WriteString(DriverInfos[i].Name, 'User_Name', 'SYSDBA');
WriteString(DriverInfos[i].Name, 'WaitOnLocks', 'True');
end;
with dbxconnections do
begin
WriteInteger(DriverInfos[i].Name + ' Connection', 'BlobSize', -1);
WriteString(DriverInfos[i].Name + ' Connection', 'CommitRetain', 'False');
WriteString(DriverInfos[i].Name + ' Connection', 'Database', 'database'+ DriverInfos[i].EXT);
WriteString(DriverInfos[i].Name + ' Connection', 'DriverName', DriverInfos[i].Name);
WriteString(DriverInfos[i].Name + ' Connection', 'ErrorResourceFile', '');
WriteString(DriverInfos[i].Name + ' Connection', 'LocaleCode', '0000');
WriteString(DriverInfos[i].Name + ' Connection', 'Password', 'masterkey');
WriteString(DriverInfos[i].Name + ' Connection', 'RoleName', 'RoleName');
WriteString(DriverInfos[i].Name + ' Connection', 'ServerCharSet', '');
WriteInteger(DriverInfos[i].Name + ' Connection', 'SQLDialect', 3);
WriteString(DriverInfos[i].Name + ' Connection', 'Interbase TransIsolation', 'ReadCommited');
WriteString(DriverInfos[i].Name + ' Connection', 'User_Name', 'SYSDBA');
WriteString(DriverInfos[i].Name + ' Connection', 'WaitOnLocks', 'True');
end;
Writeln(DriverInfos[i].Name + ' installed');
end;
finally
dbxdrivers.Free;
dbxconnections.Free;
end;
end;
finally
Reg.Free;
end;
end.
| 44.653846 | 108 | 0.597976 |
fcb084ff9f5ba48bf348213eed3b27dad36b8386 | 8,163 | pas | Pascal | define_types.pas | neurolabusc/fiberQuant | 3fbd1fa60a652d8cd61f3ab496bae6c0a090f003 | [
"BSD-2-Clause"
]
| null | null | null | define_types.pas | neurolabusc/fiberQuant | 3fbd1fa60a652d8cd61f3ab496bae6c0a090f003 | [
"BSD-2-Clause"
]
| null | null | null | define_types.pas | neurolabusc/fiberQuant | 3fbd1fa60a652d8cd61f3ab496bae6c0a090f003 | [
"BSD-2-Clause"
]
| null | null | null | unit define_types;
interface
{$MODE DELPHI}
//uses graphics;
const
NaN : double = 1/0;
kTab = chr(9);
kCR = chr (13);
kDel = #127 ; // Delete
kBS = #8 ; // Backspace
UNIXeoln = chr(10);
type
TRGBA = packed record //Next: analyze Format Header structure
R,G,B,A : byte;
end;
TPoint4f = packed record
X: single;
Y: single;
Z: single;
W: single
end;
TPoint3f = packed record
X: single;
Y: single;
Z: single
end;
TPoint3i = packed record
X: longint; //ensure 32-bit for simple GIfTI writing
Y: longint;
Z: longint;
end;
TFaces = array of TPoint3i;
TVertices = array of TPoint3f;
TVertexRGBA = array of TRGBA;
TInts = array of integer;
TFloats = array of single;
TMat33 = array [1..3, 1..3] of single;
TMat44 = array [1..4, 1..4] of single;
TFByte = File of Byte;
TStrRA = Array of String;
TUnitRect = record
L,T,R,B: single;
end;
procedure FilenameParts (lInName: string; var lPath,lName,lExt: string);
procedure SensibleUnitRect (var U: TUnitRect);
procedure SortSingle(var lLo,lHi: single);
function RealToStr(lR: double; lDec: integer): string;
function RGBA(lR,lG,lB,lA: byte): TRGBA;
function CreateUnitRect (L,T,R,B: single) : TUnitRect;
procedure IntBound (var lVal: integer; lMin, lMax: integer);
function UnitBound (lS: single): single;
procedure ReadLnBin(var f: TFByte; var s: string);
procedure SwapSingle(var s : single);
procedure SwapLongInt(var s : LongInt);
procedure SwapLongWord(var s : LongWord);
function asSingle(i : longint): single; overload;
function asSingle(b0,b1,b2,b3: byte): single; overload;
function asInt(s : single): longint;
function specialsingle (var s:single): boolean; //isFinite
//function asRGBA(clr: TColor): TRGBA;
function ExtractFileExtGzUpper(FileName: string): string;
implementation
uses sysutils;
function ExtractFileExtGzUpper(FileName: string): string;
//the file 'img.nii.gz' returns '.NII.GZ', not just '.gz'
var
lPath,lName,lExt: string;
begin
//result := UpperCase(ExtractFileExt(FileName));
FilenameParts (FileName, lPath,lName,lExt);
result := UpperCase(lExt);
end;
procedure IntBound (var lVal: integer; lMin, lMax: integer);
begin
if lVal < lMin then lVal := lMin;
if lVal > lMax then lVal := lMax;
end;
function specialsingle (var s:single): boolean;
//returns true if s is Infinity, NAN or Indeterminate
//4byte IEEE: msb[31] = signbit, bits[23-30] exponent, bits[0..22] mantissa
//exponent of all 1s = Infinity, NAN or Indeterminate
const kSpecialExponent = 255 shl 23;
var Overlay: LongInt absolute s;
begin
if ((Overlay and kSpecialExponent) = kSpecialExponent) then
RESULT := true
else
RESULT := false;
end;
function asSingle(i : longint): single; overload;
type
swaptype = packed record
case byte of
0:(Lng : longint);
1:(Sngl : single);
end;
swaptypep = ^swaptype;
var
inguy:swaptypep;
begin
inguy := @i; //assign address of s to inguy
result := inguy^.Sngl;
end; // asSingle()
function asSingle(b0,b1,b2,b3: byte): single; overload;
type
swaptype = packed record
case byte of
0:(b0,b1,b2,b3 : byte);
1:(Sngl : single);
end;
//swaptypep = ^swaptype;
var
//inguy:swaptypep;
outguy:swaptype;
begin //should work with both little and big endian, as order is same
outguy.b0 := b0;
outguy.b1 := b1;
outguy.b2 := b2;
outguy.b3 := b3;
result := outguy.Sngl;
end; // asSingle()
function asInt(s : single): longint;
type
swaptype = packed record
case byte of
0:(Lng : longint);
1:(Sngl : single);
end;
swaptypep = ^swaptype;
var
inguy:swaptypep;
begin
inguy := @s; //assign address of s to inguy
result := inguy^.Lng;
end; // asInt()
procedure SwapSingle(var s : single);
type
swaptype = packed record
case byte of
0:(Word1,Word2 : word);
1:(Sngl : single);
end;
swaptypep = ^swaptype;
var
inguy:swaptypep;
outguy:swaptype;
begin
inguy := @s; //assign address of s to inguy
outguy.Word1 := swap(inguy^.Word2);
outguy.Word2 := swap(inguy^.Word1);
s := outguy.Sngl;
end; // SwapSingle()
procedure SwapLongInt(var s : LongInt);
type
swaptype = packed record
case byte of
0:(Word1,Word2 : word); //word is 16 bit
1:(Long:LongInt);
end;
swaptypep = ^swaptype;
var
inguy:swaptypep;
outguy:swaptype;
begin
inguy := @s; //assign address of s to inguy
outguy.Word1 := swap(inguy^.Word2);
outguy.Word2 := swap(inguy^.Word1);
s := outguy.Long;
end; // SwapLongInt()
procedure SwapLongWord(var s : LongWord);
type
swaptype = packed record
case byte of
0:(Word1,Word2 : word); //word is 16 bit
1:(Long:LongWord);
end;
swaptypep = ^swaptype;
var
inguy:swaptypep;
outguy:swaptype;
begin
inguy := @s; //assign address of s to inguy
outguy.Word1 := swap(inguy^.Word2);
outguy.Word2 := swap(inguy^.Word1);
s := outguy.Long;
end; // SwapLongWord()
procedure ReadLnBin(var f: TFByte; var s: string);
const
kEOLN = $0A;
var
bt : Byte;
begin
s := '';
while (not EOF(f)) do begin
Read(f,bt);
if bt = kEOLN then exit;
s := s + Chr(bt);
end;
end;
function RGBA(lR,lG,lB,lA: byte): TRGBA;
//set red,green,blue and alpha of a Quad
begin
result.r := lR;
result.g := lG;
result.b := lB;
result.a := lA;
end;
function RealToStr(lR: double; lDec: integer): string;
begin
result := FloatToStrF(lR, ffFixed,7,lDec);
end;
procedure FilenameParts (lInName: string; var lPath,lName,lExt: string);
var
lX: string;
begin
lPath := ExtractFilePath(lInName);
lName := ExtractFileName(lInName);
lExt := ExtractFileExt(lInName);
if lExt = '' then exit;
Delete(lName, length(lName)-length(lExt)+1, length(lExt)); //nam.ext -> nam
lX := lExt;
if UpperCase(lX) <> '.GZ' then exit;
lExt := ExtractFileExt(lName);
Delete(lName, length(lName)-length(lExt)+1, length(lExt)); //nam.ext -> nam
lExt := lExt + lX;
//showmessage(lName+':'+lExt);
end;
(*function FilenameParts (lInName: string; var lPath,lName,lExt: string): boolean;
var
lLen,lPos,lExtPos,lPathPos: integer;
begin
result := false;
lPath := '';
lName := '';
lExt := '';
lLen := length(lInName);
if lLen < 1 then exit;
//next find final pathdelim
lPathPos := lLen;
while (lPathPos > 0) and (lInName[lPathPos] <> '\') and (lInName[lPathPos] <> '/') do
dec(lPathPos);
if (lInName[lPathPos] = '\') or (lInName[lPathPos] = '/') then begin
for lPos := 1 to lPathPos do
lPath := lPath + lInName[lPos];
end;
// else
// dec(lPathPos);
inc(lPathPos);
//next find first ext
lExtPos := 1;
while (lExtPos <= lLen) and (lInName[lExtPos] <> '.') do
inc(lExtPos);
if (lInName[lExtPos] = '.') then begin
for lPos := lExtPos to lLen do
lExt := lExt + lInName[lPos];
end;
// else
// inc(lExtPos);
dec(lExtPos);
//next extract filename
//fx(lPathPos,lExtPos);
if (lPathPos <= lExtPos) then
for lPos := lPathPos to lExtPos do
lName := lName + lInName[lPos];
result := true;
end; *)
procedure SortSingle(var lLo,lHi: single);
var lSwap: single;
begin
if lLo > lHi then begin
lSwap := lLo;
lLo := lHi;
lHi := lSwap;
end; //if Lo>Hi
end; //proc SortSingle
function UnitBound (lS: single): single;
begin
if lS < 0 then
result := 0
else if lS > 1 then
result := 1
else
result := lS;
end;
procedure SensibleUnitRect (var U: TUnitRect);
begin
U.L := UnitBound(U.L);
U.T := UnitBound(U.T);
U.R := UnitBound(U.R);
U.B := UnitBound(U.B);
//left should be lower value than right
SortSingle(U.L,U.R);
if U.L = U.R then begin
if U.R < 0.1 then
U.R := 0.1
else
U.L := U.R -0.1;
end;
//bottom should lower value than top
SortSingle(U.B,U.T);
if U.B = U.T then begin
if U.T < 0.1 then
U.T := 0.1
else
U.B := U.T -0.1;
end;
end;
function CreateUnitRect (L,T,R,B: single) : TUnitRect;
begin
result.L := UnitBound(L);
result.T := UnitBound(T);
result.R := UnitBound(R);
result.B := UnitBound(B);
end;
end.
| 23.868421 | 89 | 0.638613 |
fc8e2ef182490e5ac999f929795fcb953868ff9b | 5,978 | pas | Pascal | DecimalToBinary.pas | juanpenia/Pascal-dtb | 22d7c67efc556977787d7dc9490b19b884b3aa07 | [
"MIT"
]
| null | null | null | DecimalToBinary.pas | juanpenia/Pascal-dtb | 22d7c67efc556977787d7dc9490b19b884b3aa07 | [
"MIT"
]
| null | null | null | DecimalToBinary.pas | juanpenia/Pascal-dtb | 22d7c67efc556977787d7dc9490b19b884b3aa07 | [
"MIT"
]
| null | null | null | {
MIT License
Copyright © 2018 Juan Peña
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
}
Program DecimalToBinary;
Uses sysutils, Math;
var
operation, binary: integer;
number: longint;
str: string;
procedure SelectConvertionType;
begin
WriteLn('Please, select a type of conversion: ');
WriteLn('0 for Binary.');
WriteLn('1 for Signed Binary. ');
WriteLn('2 for One''s Complement.');
WriteLn('3 for Two''s Complement.');
WriteLn('4 for Excess 2^n-1.');
readln(operation);
end;
procedure CheckType;
begin
if(operation = 0) then
writeln('Binary');
if(operation = 1) then
writeln('Signed Binary');
if(operation = 2) then
writeln('One''s Complement');
if(operation = 3) then
writeln('Two''s Complement');
if(operation = 4) then
writeln('Excess 2^n-1');
if(operation >= 5) or (operation < 0) then begin
writeln('Invalid operation. Please, insert a valid operation.');
writeln;
SelectConvertionType;
CheckType;
end;
writeln;
end;
{
procedure ResetVars; // for later usage
begin
number:= 0;
str:= '';
binary:= 0;
end;
}
function Excess(number: integer): integer;
var
MSB: integer; // Most Significant Bit
begin
// ---
MSB:= 0;
while (number > 0) do begin
number:= number div 2;
MSB:= MSB + 1;
end;
Excess:= Round(power(2, (MSB)));
end;
procedure AskNumber;
begin
writeln('Please, write a number and then press Enter.');
writeln('');
write('Your number is: ');
end;
procedure ConvertToBinary;
begin
// ================================ [Binary] ================================
if(operation = 0) then begin
readln(number);
if(number < 0) then begin
writeln('You have inserted an invalid number. Please, input a number greater or equal to 0.');
writeln();
AskNumber;
readln(number);
end;
while(number > 0) do begin
binary := number mod 2;
number := number div 2;
str:= IntToStr(binary) + str;
end;
writeln('Which in binary equals to: ', str);
end;
// ============================ [Signed Binary] ============================
if(operation = 1) then begin
readln(number);
if(number < 0) then begin
number:= abs(number);
while(number > 0) do begin
binary := number mod 2;
number := number div 2;
str:= IntToStr(binary) + str;
end;
str:= '1' + str;
end
else begin
while(number > 0) do begin
binary := number mod 2;
number := number div 2;
str:= IntToStr(binary) + str;
end;
str:= '0' + str;
end;
//
writeln('Which in binary equals to: ', str);
end;
// =========================== [One's complement] ===========================
if(operation = 2) then begin
readln(number);
if(number < 0) then begin
while(number < 0) do begin
binary := number mod 2;
number := number div 2;
if(binary = 0)
then binary:= 1
else binary:= 0;
str:= IntToStr(binary) + str;
end;
str:= '1' + str;
end
else begin
while(number > 0) do begin
binary := number mod 2;
number := number div 2;
str:= IntToStr(binary) + str;
end;
str:= '0' + str;
end;
writeln('Which in binary equals to: ', str);
end;
// =========================== [Two's complement] ===========================
if(operation = 3) then begin
readln(number);
if(number < 0) then begin
number := number + 1;
while(number < 0) do begin
binary := number mod 2;
number := number div 2;
if(binary = 0)
then binary:= 1
else binary:= 0;
str:= IntToStr(binary) + str;
end;
str:= '1' + str;
end
else begin
while(number > 0) do begin
binary := number mod 2;
number := number div 2;
str:= IntToStr(binary) + str;
end;
str:= '0' + str;
end;
//
writeln('Which in binary equals to: ', str);
end;
// ============================= [Excess 2⁽ⁿ⁻¹⁾] =============================
if(operation = 4) then begin
readln(number);
if(number < 0) then begin
number:= abs(number);
number:= number + Excess(number);
while(number > 0) do begin
binary := number mod 2;
number := number div 2;
str:= IntToStr(binary) + str;
end;
end
else begin
number:= number + Excess(number);
while(number > 0) do begin
binary := number mod 2;
number := number div 2;
str:= IntToStr(binary) + str;
end;
end;
//
writeln('Which in binary equals to: ', str);
end;
end;
Begin
SelectConvertionType;
CheckType;
AskNumber;
ConvertToBinary;
//ResetVars;
readln(); // sin esta linea el programa de mierda se cierra y no vemos el result wey
// without that line, the program exits and we don't see the result 'wey'
End.
| 21.977941 | 461 | 0.5818 |
Subsets and Splits