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
f11d52ec9e77a47a73e722a24a940ed91ef92b91
3,870
pas
Pascal
SpaceX-API/Models/Dragon/DragonHeatshield.pas
cddigi/SpaceX_API
dc8c3b62478faec29b46a8317c690a99075e26f1
[ "MIT" ]
1
2021-07-23T23:32:14.000Z
2021-07-23T23:32:14.000Z
SpaceX-API/Models/Dragon/DragonHeatshield.pas
cddigi/SpaceX_API
dc8c3b62478faec29b46a8317c690a99075e26f1
[ "MIT" ]
2
2021-07-30T12:54:07.000Z
2021-09-10T18:01:13.000Z
SpaceX-API/Models/Dragon/DragonHeatshield.pas
cddigi/SpaceX_API_Lazarus
dc8c3b62478faec29b46a8317c690a99075e26f1
[ "MIT" ]
null
null
null
unit DragonHeatshield; {$mode objfpc}{$H+} interface uses Classes, SysUtils, BaseModel; type IBaseDragonHeatShield = interface(IBaseModel) ['{7C494FB6-2264-494F-942A-DA84F2243A72}'] function GetDevPartner: string; function GetMaterial: string; function GetSizeMeters: Double; function GetTemperatureDegrees: LongWord; procedure SetDevPartner(AValue: string); procedure SetMaterial(AValue: string); procedure SetSizeMeters(AValue: Double); procedure SetTemperatureDegrees(AValue: LongWord); end; IDragonHeatShield = interface(IBaseDragonHeatShield) ['{C215AC24-CECB-4F6D-87E7-670B1F4187F5}'] property DevPartner: string read GetDevPartner write SetDevPartner; property Material: string read GetMaterial write SetMaterial; property SizeMeters: Double read GetSizeMeters write SetSizeMeters; property TemperatureDegrees: LongWord read GetTemperatureDegrees write SetTemperatureDegrees; end; function NewDragonHeatShield: IDragonHeatShield; implementation uses Variants; type { TDragonHeatshield } TDragonHeatshield = class(TBaseModel, IDragonHeatShield) private FDevPartner: string; FMaterial: string; FSizeMeters: Double; FTemperatureDegrees: LongWord; function GetDevPartner: string; function GetMaterial: string; function GetSizeMeters: Double; function GetTemperatureDegrees: LongWord; procedure SetDevPartner(AValue: string); procedure SetDevPartner(AValue: Variant); procedure SetMaterial(AValue: string); procedure SetMaterial(AValue: Variant); procedure SetSizeMeters(AValue: Double); procedure SetSizeMeters(AValue: Variant); procedure SetTemperatureDegrees(AValue: LongWord); procedure SetTemperatureDegrees(AValue: Variant); public function ToString: string; override; published property dev_partner: Variant write SetDevPartner; property material: Variant write SetMaterial; property size_meters: Variant write SetSizeMeters; property temp_degrees: Variant write SetTemperatureDegrees; end; function NewDragonHeatShield: IDragonHeatShield; begin Result := TDragonHeatshield.Create; end; { TDragonHeatshield } function TDragonHeatshield.GetDevPartner: string; begin Result := FDevPartner; end; function TDragonHeatshield.GetMaterial: string; begin Result := FMaterial; end; function TDragonHeatshield.GetSizeMeters: Double; begin Result := FSizeMeters; end; function TDragonHeatshield.GetTemperatureDegrees: LongWord; begin Result := FTemperatureDegrees; end; procedure TDragonHeatshield.SetDevPartner(AValue: string); begin FDevPartner := AValue; end; procedure TDragonHeatshield.SetDevPartner(AValue: Variant); begin if VarIsNull(AValue) then AValue := ''; FDevPartner := AValue; end; procedure TDragonHeatshield.SetMaterial(AValue: string); begin FMaterial := AValue; end; procedure TDragonHeatshield.SetMaterial(AValue: Variant); begin if VarIsNull(AValue) then AValue := ''; FMaterial := AValue; end; procedure TDragonHeatshield.SetSizeMeters(AValue: Double); begin FSizeMeters := AValue; end; procedure TDragonHeatshield.SetSizeMeters(AValue: Variant); begin if VarIsNull(AValue) then AValue := 0; FSizeMeters := AValue; end; procedure TDragonHeatshield.SetTemperatureDegrees(AValue: LongWord); begin FTemperatureDegrees := AValue; end; procedure TDragonHeatshield.SetTemperatureDegrees(AValue: Variant); begin if VarIsNull(AValue) then AValue := 0; FTemperatureDegrees := AValue; end; function TDragonHeatshield.ToString: string; begin Result := Format('' + 'Dev Partner: %s' + LineEnding + 'Material: %s' + LineEnding + 'Size Meters: %f' + LineEnding + 'Temperature Degrees: %u' , [ GetDevPartner, GetMaterial, GetSizeMeters, GetTemperatureDegrees ]); end; end.
23.173653
97
0.759173
f1d08fbc8333d323c8a8d4f8c5a2c0787b3423bf
6,160
pas
Pascal
library/fsl/fsl_websocket.pas
atkins126/fhirserver
b6c2527f449ba76ce7c06d6b1c03be86cf4235aa
[ "BSD-3-Clause" ]
132
2015-02-02T00:22:40.000Z
2021-08-11T12:08:08.000Z
library/fsl/fsl_websocket.pas
atkins126/fhirserver
b6c2527f449ba76ce7c06d6b1c03be86cf4235aa
[ "BSD-3-Clause" ]
113
2015-03-20T01:55:20.000Z
2021-10-08T16:15:28.000Z
library/fsl/fsl_websocket.pas
atkins126/fhirserver
b6c2527f449ba76ce7c06d6b1c03be86cf4235aa
[ "BSD-3-Clause" ]
49
2015-04-11T14:59:43.000Z
2021-03-30T10:29:18.000Z
unit fsl_websocket; { 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. } interface Uses SysUtils, Classes, IdGlobal, IdException, IdComponent, IdTCPConnection, IdContext, IdCustomHTTPServer, IdHashSHA, IdCoderMIME; Type TIdWebSocketOperation = (wsoNoOp, wsoText, wsoBinary, wsoClose); TIdWebSocketCommand = record op : TIdWebSocketOperation; text : String; bytes : TIdBytes; status : integer; end; TIdWebSocket = class (TIdComponent) private FConnection : TIdTCPConnection; FRequest: TIdHTTPRequestInfo; procedure pong; public function open(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo) : boolean; function IsOpen : boolean; function read(wait : boolean) : TIdWebSocketCommand; procedure write(s : String); procedure close; Property Request : TIdHTTPRequestInfo read FRequest; end; implementation { TIdWebSocket } function TIdWebSocket.IsOpen: boolean; begin result := assigned(FConnection.IOHandler); end; function TIdWebSocket.open(AContext: TIdContext; request: TIdHTTPRequestInfo; response: TIdHTTPResponseInfo): boolean; var s : String; hash : TIdHashSHA1; base64 : TIdEncoderMIME; begin FRequest := request; if request.RawHeaders.Values['Upgrade'] <> 'websocket' then raise EIdException.create('Only web sockets supported on this end-point'); s := request.RawHeaders.Values['Sec-WebSocket-Key']+'258EAFA5-E914-47DA-95CA-C5AB0DC85B11'; base64 := TIdEncoderMIME.Create(nil); hash := TIdHashSHA1.Create; try s := base64.EncodeBytes(hash.HashString(s, IndyTextEncoding_ASCII)); finally hash.Free; base64.Free; end; response.ResponseNo := 101; response.ResponseText := 'Switching Protocols'; response.CustomHeaders.AddValue('Upgrade', 'websocket'); response.Connection := 'Upgrade'; response.CustomHeaders.AddValue('Sec-WebSocket-Accept', s); if (request.rawHeaders.IndexOfName('Sec-WebSocket-Protocol') > -1) then response.CustomHeaders.AddValue('Sec-WebSocket-Protocol', 'chat'); response.WriteHeader; FConnection := AContext.Connection; result := true; end; procedure TIdWebSocket.pong; var b : byte; begin b := $80 + $10; // close FConnection.IOHandler.write(b); b := 0; FConnection.IOHandler.write(b); end; function TIdWebSocket.read(wait : boolean) : TIdWebSocketCommand; var h, l : byte; fin : boolean; op : byte; mk : TIdBytes; len : cardinal; i : integer; begin FillChar(result, sizeof(TIdWebSocketCommand), 0); if not wait and not FConnection.IOHandler.CheckForDataOnSource then result.op := wsoNoOp else begin h := FConnection.IOHandler.ReadByte; fin := (h and $80) > 1; if not fin then raise EIdException.create('Multiple frames not done yet'); op := h and $0F; l := FConnection.IOHandler.ReadByte; // ? msk := (l and $80) > 0; len := l and $7F; if len = 126 then len := FConnection.IOHandler.ReadUInt16 else if len = 127 then len := FConnection.IOHandler.ReadUInt32; FConnection.IOHandler.ReadBytes(mk, 4); FConnection.IOHandler.ReadBytes(result.bytes, len); for i := 0 to length(result.bytes) - 1 do result.bytes[i] := result.bytes[i] xor mk[i mod 4]; case op of 1: begin result.op := wsoText; result.text := IndyTextEncoding_UTF8.GetString(result.bytes); end; 2: result.op := wsoText; 8: result.op := wsoClose; 9: begin pong(); result := read(wait); end; else raise EIdException.create('Unknown OpCode '+inttostr(op)); end; end; end; procedure TIdWebSocket.write(s: String); var b : byte; w : word; bs : TIDBytes; begin b := $80 + $01; // text frame, last FConnection.IOHandler.write(b); if (length(s) <= 125) then begin b := length(s); FConnection.IOHandler.write(b); end else if (length(s) <= $FFFF) then begin b := 126; FConnection.IOHandler.write(b); w := length(s); FConnection.IOHandler.write(w); end else begin b := 127; FConnection.IOHandler.write(b); FConnection.IOHandler.write(length(s)); end; bs := IndyTextEncoding_UTF8.GetBytes(s); FConnection.IOHandler.write(bs); end; procedure TIdWebSocket.close; var b : byte; begin b := $80 + $08; // close FConnection.IOHandler.write(b); b := 0; FConnection.IOHandler.write(b); FConnection.IOHandler.Close; end; end.
29.902913
119
0.689286
f1baa7c39122e0c0597b2ffcfc62d56d077859de
3,953
pas
Pascal
code/OSEnvironmentInfo.pas
VencejoSoftware/ooOS
bef2c8aba55e1a5f1d38fb257906759f439697c2
[ "BSD-3-Clause" ]
1
2022-01-04T02:18:09.000Z
2022-01-04T02:18:09.000Z
code/OSEnvironmentInfo.pas
VencejoSoftware/ooOS
bef2c8aba55e1a5f1d38fb257906759f439697c2
[ "BSD-3-Clause" ]
null
null
null
code/OSEnvironmentInfo.pas
VencejoSoftware/ooOS
bef2c8aba55e1a5f1d38fb257906759f439697c2
[ "BSD-3-Clause" ]
2
2019-11-21T03:06:24.000Z
2021-01-26T04:47:10.000Z
{$REGION 'documentation'} { Copyright (c) 2018, Vencejo Software Distributed under the terms of the Modified BSD License The full license is distributed with this software } { Environment variable list information @created(22/05/2018) @author Vencejo Software <www.vencejosoft.com> } {$ENDREGION} unit OSEnvironmentInfo; interface {$IFDEF FPC} {$IFDEF UNIX} {$DEFINE USE_LINUX} {$ENDIF} {$ENDIF} uses {$IFDEF USE_LINUX} unix, {$ELSE} Windows, {$ENDIF} SysUtils, Generics.Collections; type {$REGION 'documentation'} { @abstract(Object list to store environment variables) @member( LoadItemFromText Load list parsing a text @param(Text Text to parse) ) } {$ENDREGION} TEnvironmentValueList = class sealed(TDictionary<string, string>) public procedure LoadItemFromText(const Text: String); end; {$REGION 'documentation'} { @abstract(Object to get environment variable list) Obtain environment variable list information @member( Variables List of environment variables @return(List object) ) @member( ValueByKey Get variable from his key @param(Key Variable identifier) @return(Variable text value) ) } {$ENDREGION} IOSEnvironmentInfo = interface ['{A4840FF5-82A2-46F7-8537-90438D696AF9}'] function Variables: TEnvironmentValueList; function ValueByKey(const Key: String): String; end; {$REGION 'documentation'} { @abstract(Implementation of @link(IOSEnvironmentInfo)) @member(Variables @seealso(IOSEnvironmentInfo.Variables)) @member(ValueByKey @seealso(IOSEnvironmentInfo.ValueByKey)) @member( FillList Using OS information fill list parsing text @param(List List object of variables) ) @member( Create Object constructor ) @member( Destroy Object destructor ) @member( New Create a new @classname as interface ) } {$ENDREGION} TOSEnvironmentInfo = class sealed(TInterfacedObject, IOSEnvironmentInfo) strict private _Variables: TEnvironmentValueList; private procedure FillList(const List: TEnvironmentValueList); public function Variables: TEnvironmentValueList; function ValueByKey(const Key: String): String; constructor Create; destructor Destroy; override; class function New: IOSEnvironmentInfo; end; implementation { TEnvironmentValueList } procedure TEnvironmentValueList.LoadItemFromText(const Text: String); var Key, Value: String; PosAsig: Integer; begin PosAsig := Pos('=', Text); if PosAsig > 1 then begin Key := UpperCase(Copy(Text, 1, Pred(PosAsig))); Value := Copy(Text, Succ(PosAsig)); if not ContainsKey(Key) then Add(Key, Value); end; end; { TOSEnvironmentInfo } function TOSEnvironmentInfo.Variables: TEnvironmentValueList; begin if _Variables.Count < 1 then FillList(_Variables); Result := _Variables; end; procedure TOSEnvironmentInfo.FillList(const List: TEnvironmentValueList); {$IFDEF USE_LINUX} var Count: Integer; begin for Count := 0 to GetEnvironmentVariableCount do List.LoadItemFromText(GetEnvironmentString(Count)); {$ELSE} var PEnvironmentStrs: PChar; begin List.Clear; PEnvironmentStrs := Windows.GetEnvironmentStrings; try if Assigned(PEnvironmentStrs) then while PEnvironmentStrs^ <> #0 do begin List.LoadItemFromText(PEnvironmentStrs); Inc(PEnvironmentStrs, Succ(Length(PEnvironmentStrs))); end; finally Windows.FreeEnvironmentStrings(PEnvironmentStrs); end; {$ENDIF} end; function TOSEnvironmentInfo.ValueByKey(const Key: String): String; begin if not Variables.TryGetValue(UpperCase(Key), Result) then Result := EmptyStr; end; constructor TOSEnvironmentInfo.Create; begin _Variables := TEnvironmentValueList.Create; end; destructor TOSEnvironmentInfo.Destroy; begin _Variables.Free; inherited; end; class function TOSEnvironmentInfo.New: IOSEnvironmentInfo; begin Result := TOSEnvironmentInfo.Create; end; end.
21.961111
74
0.739185
f1b4ae85a8d2e3a31e875a7abcf1ac32737d6ea3
268
dpr
Pascal
TWinEventHook_DEMO.dpr
JensBorrisholt/TWinEventHook
897b086c7191f25e2170c267f0c090c869f2363c
[ "MIT" ]
13
2019-09-20T13:23:52.000Z
2022-02-05T11:40:24.000Z
TWinEventHook_DEMO.dpr
azrael11/TWinEventHook
897b086c7191f25e2170c267f0c090c869f2363c
[ "MIT" ]
1
2019-11-12T02:59:34.000Z
2019-11-12T02:59:34.000Z
TWinEventHook_DEMO.dpr
azrael11/TWinEventHook
897b086c7191f25e2170c267f0c090c869f2363c
[ "MIT" ]
8
2019-09-20T13:23:54.000Z
2021-06-02T07:58:39.000Z
program TWinEventHook_DEMO; uses Vcl.Forms, MainU in 'MainU.pas' {Form1}, WinEventHook in 'WinEventHook.pas'; {$R *.res} begin Application.Initialize; Application.MainFormOnTaskbar := True; Application.CreateForm(TForm1, Form1); Application.Run; end.
16.75
40
0.735075
8375dfa384fcb66ea294c7493251d00248576569
96,718
pas
Pascal
lazarus/synedit/test/testsynbeautifier.pas
rarnu/golcl-liblcl
6f238af742857921062365656a1b13b44b2330ce
[ "Apache-2.0" ]
null
null
null
lazarus/synedit/test/testsynbeautifier.pas
rarnu/golcl-liblcl
6f238af742857921062365656a1b13b44b2330ce
[ "Apache-2.0" ]
null
null
null
lazarus/synedit/test/testsynbeautifier.pas
rarnu/golcl-liblcl
6f238af742857921062365656a1b13b44b2330ce
[ "Apache-2.0" ]
null
null
null
unit TestSynBeautifier; {$mode objfpc}{$H+} interface uses Classes, SysUtils, testregistry, TestBase, TestHighlightPas, SynEdit, SynEditTextTrimmer, SynEditKeyCmds, SynBeautifier, SynEditTypes, SynBeautifierPascal, LCLType, LCLProc; type TCallBackData = record LinePos: Integer; Indent: Integer; // Indent in spaces (Logical = Physical) RelativeToLinePos: Integer; // Intend specifies +/- offset from intend on RTLine // 0: for absolute indent IndentChars: String ; // use the following string to indent; maybe empty, single char, or string IndentCharsFromLinePos: Integer; // Line for tab/space mix; set to -1 if unknown end; { TTestSynBeautifier } TTestSynBeautifier = class(TTestBaseHighlighterPas) protected procedure TestRedoUndo(Name: String; Text: Array of String; X, Y: Integer; Data: Array of const; SelX: Integer = -1; SelY: Integer = -1); protected FGetIndentCallBackResult: Boolean; FCallBackData: Array of TCallBackData; FGotLogCaret, FGotOldLogCaret: TPoint; FGotFirstLinePos, FGotLastLinePos: Integer; FGotReason: TSynEditorCommand; function GetIndentCallBack( Sender: TObject; // the beautifier {%H-}Editor: TObject; // the synedit LogCaret, OldLogCaret: TPoint; FirstLinePos, LastLinePos: Integer; Reason: TSynEditorCommand; // what caused the evnt SetIndentProc: TSynBeautifierSetIndentProc ): boolean; published (* Test includes: - no indent if switched off - indent after VK_RETURN - indent after CTRL-VK_N (TODO) * handling split indent (return in the middle of the leading space; next line is already part indented) * VK_Return on pos=1, keeps indent. line without indent will *not* be indented * with/without trim spaces * undo/redo/group-undo * correct indent from tabs (include split indent) * correct indent from several lines above (skip empty lines to find indent) VK_RETURN only * indent modes: sbitSpace, sbitCopySpaceTab, sbitPositionCaret *) procedure DefaultIndent; (* - no un-indent if switched off - un-indent after VK_BACK (if at end of leading whitespace) - no un-indent after VK_BACK (if not at end of leading whitespace) - act on empty line (only leading whitespace; no chars follow) (with/without trim space) - unindent after empty line (find indent from lines above) - handle tabs, in leading whitespace (TODO) - no unindent, if selection (none persistent) Todo: decide on none-overwritable block - TODO: fix group undo *) procedure DefaultUnIndent; procedure IndentCallBack; procedure IndentPasComment; end; implementation { TTestSynBeautifier } var SkipGroupUndo: Boolean; procedure TTestSynBeautifier.TestRedoUndo(Name: String; Text: array of String; X, Y: Integer; Data: array of const; SelX: Integer; SelY: Integer); function data2txt(n: Integer): String; begin if n < 0 then exit(LinesToText(Text)); Result := ''; case data[n].VType of vtString: Result := data[n].VString^; vtAnsiString: Result := AnsiString(data[n].VAnsiString); vtChar: Result := data[n].VChar; end; end; var i: integer; st: TShiftState; begin PushBaseName(Name + '(no group-undo)'); SetLines(Text); if (SelX >= 0) then SetCaretAndSel(SelX, SelY, X, Y) else SetCaret(X, Y); SynEdit.Options := SynEdit.Options - [eoGroupUndo]; for i := 0 to length(data) div 4 - 1 do begin st := []; if data[i*4+0].vinteger in [VK_A..VK_Z] then st := [ssCtrl]; DoKeyPress(data[i*4+0].vinteger, st); TestIsCaret('Key #'+IntToStr(i), data[i*4+1].vinteger, data[i*4+2].vinteger); TestIsFullText('Key #'+IntToStr(i), data2txt(i*4+3)); end; for i := length(data) div 4 - 2 downto -1 do begin SynEdit.Undo; if i >= 0 then TestIsCaret('Undo #'+IntToStr(i+1), data[i*4+1].vinteger, data[i*4+2].vinteger) else TestIsCaret('Undo #'+IntToStr(i+1), x, y); TestIsFullText('Undo #'+IntToStr(i+1), data2txt(i*4+3)); end; for i := 0 to length(data) div 4 - 1 do begin SynEdit.Redo; TestIsCaret('Redo #'+IntToStr(i), data[i*4+1].vinteger, data[i*4+2].vinteger); TestIsFullText('Redo #'+IntToStr(i), data2txt(i*4+3)); end; for i := length(data) div 4 - 2 downto -1 do begin SynEdit.Undo; if i >= 0 then TestIsCaret('2nd Undo Key #'+IntToStr(i+1), data[i*4+1].vinteger, data[i*4+2].vinteger) else TestIsCaret('2nd Undo Key #'+IntToStr(i+1), x, y); TestIsFullText('2nd Undo #'+IntToStr(i+1), data2txt(i*4+3)); end; if SkipGroupUndo then begin PopBaseName; exit; end; PopPushBaseName(Name + '(group-undo)'); SetLines(Text); if (SelX >= 0) then SetCaretAndSel(SelX, SelY, X, Y) else SetCaret(X, Y); SynEdit.Options := SynEdit.Options + [eoGroupUndo]; for i := 0 to length(data) div 4 - 1 do begin st := []; if data[i*4+0].vinteger in [VK_A..VK_Z] then st := [ssCtrl]; DoKeyPress(data[i*4+0].vinteger, st); TestIsCaret('Key #'+IntToStr(i), data[i*4+1].vinteger, data[i*4+2].vinteger); TestIsFullText('Key #'+IntToStr(i), data2txt(i*4+3)); end; SynEdit.Undo; TestIsCaret('Undo', x, y); TestIsFullText('Undo', Text); SynEdit.Redo; i := length(data) div 4 - 1; TestIsCaret('Redo', data[i*4+1].vinteger, data[i*4+2].vinteger); TestIsFullText('Redo', data2txt(i*4+3)); SynEdit.Undo; TestIsCaret('2nd Undo', x, y); TestIsFullText('2nd Undo', Text); PopBaseName; end; procedure TTestSynBeautifier.DefaultIndent; function TestText: TStringArray; begin SetLength(Result, 11); Result[0] := ' a;'; Result[1] := ' b'; Result[2] := ''; Result[3] := ' c'; Result[5] := ''; Result[6] := ''; Result[7] := #9+'x'; Result[8] := #32#9#32#32#9+'x'; // 8 indent ( 5 logical) Result[9] := ' c'; Result[10] := ''; end; function ExpText(rpl: array of const): String; begin Result := LinesToText(LinesReplace(TestText, rpl)) end; function TestText2: TStringArray; begin SetLength(Result, 6); Result[0] := ' a;'; Result[1] := 'b'; // not indent Result[2] := ' a;'; Result[3] := ''; Result[4] := 'b'; // not indent, after empty line Result[5] := ''; end; function ExpText2(rpl: array of const): String; begin Result := LinesToText(LinesReplace(TestText2, rpl)) end; begin SkipGroupUndo := False; ReCreateEdit; SynEdit.TabWidth := 4; SynEdit.TrimSpaceType := settMoveCaret; {%region ***** Test WITHOUT indent (no trim) *****} BaseTestName := 'DefaultIndent (no indent, no trim)'; SynEdit.Options := SynEdit.Options - [eoTrimTrailingSpaces, eoScrollPastEol, eoAutoIndent]; TestRedoUndo('Return EOL', TestText, 5,1, [ VK_RETURN, 1, 2, ExpText([ -2, '']) ] ); TestRedoUndo('Return empty line', TestText, 1,3, [ VK_RETURN, 1, 4, ExpText([ -4, '']) ] ); TestRedoUndo('Return after space', TestText, 5,2, [ VK_RETURN, 1, 3, ExpText([ 2, ' ', 'b']) ] ); // NOT trimmed TestRedoUndo('Return before space', TestText, 1,2, [ VK_RETURN, 1, 3, ExpText([ -2, '']) ] ); TestRedoUndo('Return mid space', TestText, 4,2, [ VK_RETURN, 1, 3, ExpText([ 2, ' ', ' b']) ] ); // NOT trimmed // VK_N will be ctrl-n (special detection in TestRedoUndo TestRedoUndo('CTRL-N EOL', TestText, 5,1, [ VK_N, 5, 1, ExpText([ -2, '']) ] ); {%endregion} {%region ***** Test WITHOUT indent (trim) *****} BaseTestName := 'DefaultIndent (trim, no indent)'; SynEdit.Options := SynEdit.Options - [eoScrollPastEol, eoAutoIndent] + [eoTrimTrailingSpaces]; TestRedoUndo('Return EOL', TestText, 5,1, [ VK_RETURN, 1, 2, ExpText([ -2, '']) ] ); TestRedoUndo('Return empty line', TestText, 1,3, [ VK_RETURN, 1, 4, ExpText([ -4, '']) ] ); TestRedoUndo('Return after space', TestText, 5,2, [ VK_RETURN, 1, 3, ExpText([ 2, '', 'b']) ] ); // trimmed TestRedoUndo('Return before space', TestText, 1,2, [ VK_RETURN, 1, 3, ExpText([ -2, '']) ] ); TestRedoUndo('Return mid space', TestText, 4,2, [ VK_RETURN, 1, 3, ExpText([ 2, '', ' b']) ] ); // trimmed {%endregion} {%region ***** Test WITHOUT trim *****} {%region sbitSpaces} BaseTestName := 'DefaultIndent (no trim)'; TSynBeautifier(SynEdit.Beautifier).IndentType := sbitSpace; SynEdit.Options := SynEdit.Options - [eoTrimTrailingSpaces, eoScrollPastEol, eoTabsToSpaces] + [eoAutoIndent]; TSynBeautifier(SynEdit.Beautifier).IndentType := sbitSpace; TestRedoUndo('Return EOL', TestText, 5,1, [ VK_RETURN, 3, 2, ExpText([ -2, ' ']) ] ); TestRedoUndo('Return EOL+EOT', TestText, 5,10,[ VK_RETURN, 4,11, ExpText([ -11,' ']) ] ); TestRedoUndo('Return empty line', TestText, 1,3, [ VK_RETURN, 5, 4, ExpText([ -4, ' ']) ] ); TestRedoUndo('Return after space', TestText, 5,2, [ VK_RETURN, 5, 3, ExpText([ -2, ' ']) ] ); // NOT trimmed TestRedoUndo('Return before space', TestText, 1,2, [ VK_RETURN, 1, 3, ExpText([ -2, '']) ] ); TestRedoUndo('Return mid space', TestText, 4,2, [ VK_RETURN, 4, 3, ExpText([ -2, ' ']) ] ); // NOT trimmed TestRedoUndo('Many Return EOL', TestText, 5,1, [ VK_RETURN, 3, 2, ExpText([ -2, ' ']), VK_RETURN, 3, 3, ExpText([ -2, ' ', ' ']), VK_RETURN, 3, 4, ExpText([ -2, ' ', ' ', ' ']) ]); TestRedoUndo('Many Return EOL+EOT', TestText, 5,10, [ VK_RETURN, 4,11, ExpText([ -11, ' ']), VK_RETURN, 4,12, ExpText([ -11, ' ', ' ']), VK_RETURN, 4,13, ExpText([ -11, ' ', ' ', ' ']) ]); TestRedoUndo('Many Return empty line', TestText, 1,3, [ VK_RETURN, 5, 4, ExpText([ -4, ' ']), VK_RETURN, 5, 5, ExpText([ -4, ' ', ' ']), VK_RETURN, 5, 6, ExpText([ -4, ' ', ' ', ' ']) ]); TestRedoUndo('Many Return after space', TestText, 5,2, [ VK_RETURN, 5, 3, ExpText([ -2, ' ']), // NOT trimmed VK_RETURN, 5, 4, ExpText([ -2, ' ', ' ']), // NOT trimmed VK_RETURN, 5, 5, ExpText([ -2, ' ', ' ', ' ']) // NOT trimmed ]); TestRedoUndo('Many Return before space', TestText, 1,2, [ VK_RETURN, 1, 3, ExpText([ -2, '']), VK_RETURN, 1, 4, ExpText([ -2, '', '']), VK_RETURN, 1, 5, ExpText([ -2, '', '', '']) ]); TestRedoUndo('Many Return mid space', TestText, 4,2, [ VK_RETURN, 4, 3, ExpText([ -2, ' ']), // NOT trimmed VK_RETURN, 4, 4, ExpText([ -2, ' ', ' ']), // NOT trimmed VK_RETURN, 4, 5, ExpText([ -2, ' ', ' ', ' ']) // NOT trimmed ]); TestRedoUndo('Return multi empty', TestText, 1,7, [ VK_RETURN, 4, 8, ExpText([ -8, ' ']) ] ); TestRedoUndo('Return at pos1 of unindeted', TestText2, 1,2, [ VK_RETURN, 1, 3, ExpText2([ -2, '']) ] ); TestRedoUndo('Return at pos1 of unindeted 2', TestText2, 1,5, [ VK_RETURN, 1, 6, ExpText2([ -5, '']) ] ); // caret pos are logical TestRedoUndo('Return after tab', TestText, 6,9, [ VK_RETURN, 9,10, ExpText([ 9, #32#9#32#32#9, ' x']) ] ); TestRedoUndo('Return before tab', TestText, 1,9, [ VK_RETURN, 1,10, ExpText([-9, '']) ] ); TestRedoUndo('Return middle tab 1', TestText, 3,9, [ VK_RETURN, 5,10, ExpText([ 9, #32#9, ' '+#32#32#9+'x']) ] ); TestRedoUndo('Return middle tab 2', TestText, 4,9, [ VK_RETURN, 6,10, ExpText([ 9, #32#9#32, ' '+#32#9+'x']) ] ); TestRedoUndo('Return tab EOL', TestText, 7,9, [ VK_RETURN, 9,10, ExpText([-10, ' ']) ] ); {%endregion} (* *** *) {%region sbitCopySpaceTab} PushBaseName('CopySpaceTab'); TSynBeautifier(SynEdit.Beautifier).IndentType := sbitCopySpaceTab; TestRedoUndo('Return after space', TestText, 5,2, [ VK_RETURN, 5, 3, ExpText([ -2, ' ']) ] ); // NOT trimmed TestRedoUndo('Return before space', TestText, 1,2, [ VK_RETURN, 1, 3, ExpText([ -2, '']) ] ); TestRedoUndo('Return mid space', TestText, 4,2, [ VK_RETURN, 4, 3, ExpText([ -2, ' ']) ] ); // NOT trimmed TestRedoUndo('Return after tab', TestText, 6,9, [ VK_RETURN, 6,10, ExpText([ 9, #32#9#32#32#9, #32#9#32#32#9+'x']) ] ); TestRedoUndo('Return before tab', TestText, 1,9, [ VK_RETURN, 1,10, ExpText([-9, '']) ] ); TestRedoUndo('Return middle tab 1', TestText, 3,9, [ VK_RETURN, 3,10, ExpText([ 9, #32#9, #32#9#32#32#9+'x']) ] ); TestRedoUndo('Return middle tab 2', TestText, 4,9, [ VK_RETURN, 4,10, ExpText([ 9, #32#9#32, #32#9#32#32#9+'x']) ] ); TestRedoUndo('Return tab EOL', TestText, 7,9, [ VK_RETURN, 6,10, ExpText([-10, #32#9#32#32#9]) ] ); TestRedoUndo('Many Return tab EOL', TestText, 7,9, [ VK_RETURN, 6,10, ExpText([-10, #32#9#32#32#9]), VK_RETURN, 6,11, ExpText([-10, #32#9#32#32#9, #32#9#32#32#9]), VK_RETURN, 6,12, ExpText([-10, #32#9#32#32#9, #32#9#32#32#9, #32#9#32#32#9]) ]); {%endregion} (* *** *) {%region sbitPosCaret} PopPushBaseName('PosCaret'); TSynBeautifier(SynEdit.Beautifier).IndentType := sbitPositionCaret; TestRedoUndo('Return after space', TestText, 5,2, [ VK_RETURN, 5, 3, ExpText([ -2, ' ']) ] ); // NOT trimmed TestRedoUndo('Return before space', TestText, 1,2, [ VK_RETURN, 1, 3, ExpText([ -2, '']) ] ); TestRedoUndo('Return mid space', TestText, 4,2, [ VK_RETURN, 4, 3, ExpText([ -2, ' ']) ] ); // NOT trimmed TestRedoUndo('Return eol', TestText, 6,2, [ VK_RETURN, 5, 3, ExpText([ -3, '']) ] ); // position only TestRedoUndo('Many Return eol', TestText, 6,2, [ // position only VK_RETURN, 5, 3, ExpText([ -3, '']), VK_RETURN, 5, 4, ExpText([ -3, '', '']), VK_RETURN, 5, 5, ExpText([ -3, '', '', '']) ]); TestRedoUndo('Return after tab', TestText, 6,9, [ VK_RETURN, 9,10, ExpText([ 9, #32#9#32#32#9, ' '+'x']) ] ); TestRedoUndo('Return before tab', TestText, 1,9, [ VK_RETURN, 1,10, ExpText([-9, '']) ] ); TestRedoUndo('Return middle tab 1', TestText, 3,9, [ VK_RETURN, 5,10, ExpText([ 9, #32#9, ' '+#32#32#9+'x']) ] ); TestRedoUndo('Return middle tab 2', TestText, 4,9, [ VK_RETURN, 6,10, ExpText([ 9, #32#9#32, ' '+#32#9+'x']) ] ); TestRedoUndo('Return tab EOL', TestText, 7,9, [ VK_RETURN, 9,10, ExpText([-10, '']) ] ); // pos only TestRedoUndo('Many Return tab EOL', TestText, 7,9, [ VK_RETURN, 9,10, ExpText([-10, '']), // pos only VK_RETURN, 9,11, ExpText([-10, '', '']), VK_RETURN, 9,12, ExpText([-10, '', '', '']) ]); {%endregion} {%region CTRL-N} PopPushBaseName('SpaceOnly'); // VK_N will be ctrl-n (special detection in TestRedoUndo TSynBeautifier(SynEdit.Beautifier).IndentType := sbitSpace; TestRedoUndo('CTRL-N EOL', TestText, 5,1, [ VK_N, 5, 1, ExpText([ -2, ' ']) ] ); TestRedoUndo('Many CTRL-N EOL', TestText, 5,1, [ VK_N, 5, 1, ExpText([ -2, ' ']), VK_N, 5, 1, ExpText([ -2, ' ', ' ']), VK_N, 5, 1, ExpText([ -2, ' ', ' ', ' ']) ]); TestRedoUndo('CTRL-N empty line', TestText, 1,3, [ VK_N, 1, 3, ExpText([ -4, ' ']) ] ); // TODO: should it? TestRedoUndo('CTRL-N pos1 unindeted',TestText2, 1,2, [ VK_N, 1, 2, ExpText2([ -2, '']) ] ); // TODO: must not TestRedoUndo('CTRL-N after space', TestText, 5,2, [ VK_N, 5, 2, ExpText([ -2, ' ']) ] ); // NOT trimmed TestRedoUndo('CTRL-N before space', TestText, 1,2, [ VK_N, 1, 2, ExpText([ -2, '']) ] ); // TODO: indents too much TestRedoUndo('CTRL-N mid space', TestText, 4,2, [ VK_N, 4, 2, ExpText([ -2, ' ']) ] ); // NOT trimmed PopPushBaseName('CopySpacetab'); TSynBeautifier(SynEdit.Beautifier).IndentType := sbitCopySpaceTab; TestRedoUndo('CTRL-N EOL', TestText, 5,1, [ VK_N, 5, 1, ExpText([ -2, ' ']) ] ); PopPushBaseName('PosOnly'); TSynBeautifier(SynEdit.Beautifier).IndentType := sbitPositionCaret; TestRedoUndo('CTRL-N EOL', TestText, 5,1, [ VK_N, 5, 1, ExpText([ -2, '']) ] ); {%endregion} {%endregion} {%region ***** Test WITH trim *****} {%region sbitSpaces} BaseTestName := 'DefaultIndent (trim)'; TSynBeautifier(SynEdit.Beautifier).IndentType := sbitSpace; SynEdit.Options := SynEdit.Options - [eoScrollPastEol] + [eoTrimTrailingSpaces, eoAutoIndent]; TSynBeautifier(SynEdit.Beautifier).IndentType := sbitSpace; //, sbitCopySpaceTab, sbitPositionCaret TestRedoUndo('Return EOL', TestText, 5,1, [ VK_RETURN, 3, 2, ExpText([ -2, ' ']) ] ); TestRedoUndo('Return EOL+EOT', TestText, 5,10,[ VK_RETURN, 4,11, ExpText([ -11,' ']) ] ); TestRedoUndo('Return empty line', TestText, 1,3, [ VK_RETURN, 5, 4, ExpText([ -4, ' ']) ] ); TestRedoUndo('Return after space', TestText, 5,2, [ VK_RETURN, 5, 3, ExpText([ -2, '']) ] ); // trimmed TestRedoUndo('Return before space', TestText, 1,2, [ VK_RETURN, 1, 3, ExpText([ -2, '']) ] ); TestRedoUndo('Return mid space', TestText, 4,2, [ VK_RETURN, 4, 3, ExpText([ -2, '']) ] ); // trimmed TestRedoUndo('Many Return EOL', TestText, 5,1, [ VK_RETURN, 3, 2, ExpText([ -2, ' ']), VK_RETURN, 3, 3, ExpText([ -2, '', ' ']), // trimmed VK_RETURN, 3, 4, ExpText([ -2, '', '', ' ']) ]); TestRedoUndo('Many Return EOL+EOT', TestText, 5,10, [ VK_RETURN, 4,11, ExpText([ -11, ' ']), VK_RETURN, 4,12, ExpText([ -11, '', ' ']), // trimmed VK_RETURN, 4,13, ExpText([ -11, '', '', ' ']) ]); TestRedoUndo('Many Return empty line', TestText, 1,3, [ VK_RETURN, 5, 4, ExpText([ -4, ' ']), VK_RETURN, 5, 5, ExpText([ -4, '', ' ']), // trimmed VK_RETURN, 5, 6, ExpText([ -4, '', '', ' ']) ]); TestRedoUndo('Many Return after space', TestText, 5,2, [ VK_RETURN, 5, 3, ExpText([ -2, '']), // trimmed VK_RETURN, 5, 4, ExpText([ -2, '', '']), // trimmed VK_RETURN, 5, 5, ExpText([ -2, '', '', '']) // trimmed ]); TestRedoUndo('Many Return before space', TestText, 1,2, [ VK_RETURN, 1, 3, ExpText([ -2, '']), VK_RETURN, 1, 4, ExpText([ -2, '', '']), VK_RETURN, 1, 5, ExpText([ -2, '', '', '']) ]); TestRedoUndo('Many Return mid space', TestText, 4,2, [ VK_RETURN, 4, 3, ExpText([ -2, '']), // trimmed VK_RETURN, 4, 4, ExpText([ -2, '', '']), // trimmed VK_RETURN, 4, 5, ExpText([ -2, '', '', '']) // trimmed ]); TestRedoUndo('Return multi empty', TestText, 1,7, [ VK_RETURN, 4, 8, ExpText([ -8, ' ']) ] ); TestRedoUndo('Return at pos1 of unindeted', TestText2, 1,2, [ VK_RETURN, 1, 3, ExpText2([ -2, '']) ] ); TestRedoUndo('Return at pos1 of unindeted 2', TestText2, 1,5, [ VK_RETURN, 1, 6, ExpText2([ -5, '']) ] ); // caret pos are logical TestRedoUndo('Return after tab', TestText, 6,9, [ VK_RETURN, 9,10, ExpText([ 9, '', ' x']) ] ); TestRedoUndo('Return before tab', TestText, 1,9, [ VK_RETURN, 1,10, ExpText([-9, '']) ] ); TestRedoUndo('Return middle tab 1', TestText, 3,9, [ VK_RETURN, 5,10, ExpText([ 9, '', ' '+#32#32#9+'x']) ] ); TestRedoUndo('Return middle tab 2', TestText, 4,9, [ VK_RETURN, 6,10, ExpText([ 9, '', ' '+#32#9+'x']) ] ); TestRedoUndo('Return tab EOL', TestText, 7,9, [ VK_RETURN, 9,10, ExpText([-10, ' ']) ] ); {%endregion} (* *** *) {%region sbitCopySpaceTab} PushBaseName('CopySpaceTab'); TSynBeautifier(SynEdit.Beautifier).IndentType := sbitCopySpaceTab; TestRedoUndo('Return after space', TestText, 5,2, [ VK_RETURN, 5, 3, ExpText([ -2, '']) ] ); // trimmed TestRedoUndo('Return before space', TestText, 1,2, [ VK_RETURN, 1, 3, ExpText([ -2, '']) ] ); TestRedoUndo('Return mid space', TestText, 4,2, [ VK_RETURN, 4, 3, ExpText([ -2, '']) ] ); // trimmed TestRedoUndo('Return after tab', TestText, 6,9, [ VK_RETURN, 6,10, ExpText([ 9, '', #32#9#32#32#9+'x']) ] ); TestRedoUndo('Return before tab', TestText, 1,9, [ VK_RETURN, 1,10, ExpText([-9, '']) ] ); TestRedoUndo('Return middle tab 1', TestText, 3,9, [ VK_RETURN, 3,10, ExpText([ 9, '', #32#9#32#32#9+'x']) ] ); TestRedoUndo('Return middle tab 2', TestText, 4,9, [ VK_RETURN, 4,10, ExpText([ 9, '', #32#9#32#32#9+'x']) ] ); TestRedoUndo('Return tab EOL', TestText, 7,9, [ VK_RETURN, 6,10, ExpText([-10, #32#9#32#32#9]) ] ); TestRedoUndo('Many Return tab EOL', TestText, 7,9, [ VK_RETURN, 6,10, ExpText([-10, #32#9#32#32#9]), VK_RETURN, 6,11, ExpText([-10, '', #32#9#32#32#9]), VK_RETURN, 6,12, ExpText([-10, '', '', #32#9#32#32#9]) ]); {%endregion} (* *** *) {%region sbitPosCaret} PopPushBaseName('PosCaret'); TSynBeautifier(SynEdit.Beautifier).IndentType := sbitPositionCaret; TestRedoUndo('Return after space', TestText, 5,2, [ VK_RETURN, 5, 3, ExpText([ -2, '']) ] ); // trimmed TestRedoUndo('Return before space', TestText, 1,2, [ VK_RETURN, 1, 3, ExpText([ -2, '']) ] ); TestRedoUndo('Return mid space', TestText, 4,2, [ VK_RETURN, 4, 3, ExpText([ -2, '']) ] ); //trimmed TestRedoUndo('Return eol', TestText, 6,2, [ VK_RETURN, 5, 3, ExpText([ -3, '']) ] ); // position only TestRedoUndo('Many Return eol', TestText, 6,2, [ // position only VK_RETURN, 5, 3, ExpText([ -3, '']), VK_RETURN, 5, 4, ExpText([ -3, '', '']), VK_RETURN, 5, 5, ExpText([ -3, '', '', '']) ]); TestRedoUndo('Return after tab', TestText, 6,9, [ VK_RETURN, 9,10, ExpText([ 9, '', ' '+'x']) ] ); TestRedoUndo('Return before tab', TestText, 1,9, [ VK_RETURN, 1,10, ExpText([-9, '']) ] ); TestRedoUndo('Return middle tab 1', TestText, 3,9, [ VK_RETURN, 5,10, ExpText([ 9, '', ' '+#32#32#9+'x']) ] ); TestRedoUndo('Return middle tab 2', TestText, 4,9, [ VK_RETURN, 6,10, ExpText([ 9, '', ' '+#32#9+'x']) ] ); TestRedoUndo('Return tab EOL', TestText, 7,9, [ VK_RETURN, 9,10, ExpText([-10, '']) ] ); // pos only TestRedoUndo('Many Return tab EOL', TestText, 7,9, [ VK_RETURN, 9,10, ExpText([-10, '']), // pos only VK_RETURN, 9,11, ExpText([-10, '', '']), VK_RETURN, 9,12, ExpText([-10, '', '', '']) ]); {%endregion} {%region CTRL-N} PopPushBaseName('SpaceOnly'); // VK_N will be ctrl-n (special detection in TestRedoUndo TSynBeautifier(SynEdit.Beautifier).IndentType := sbitSpace; TestRedoUndo('CTRL-N EOL', TestText, 5,1, [ VK_N, 5, 1, ExpText([ -2, '']) ] ); // trimmed TestRedoUndo('CTRL-N pos1 unindeted',TestText2, 1,2, [ VK_N, 1, 2, ExpText2([ -2, '']) ] ); // TODO: must not TestRedoUndo('CTRL-N after space', TestText, 5,2, [ VK_N, 5, 2, ExpText([ -2, ' ']) ] ); TestRedoUndo('CTRL-N before space', TestText, 1,2, [ VK_N, 1, 2, ExpText([ -2, '']) ] ); // TODO: indents too much TestRedoUndo('CTRL-N mid space', TestText, 4,2, [ VK_N, 4, 2, ExpText([ -2, ' ']) ] ); {%endregion} {%endregion} end; procedure TTestSynBeautifier.DefaultUnIndent; function TestText: TStringArray; begin SetLength(Result, 11); Result[0] := ' a;'; Result[1] := ' b'; Result[2] := ' c'; Result[3] := ''; Result[4] := ' d'; Result[5] := ''; Result[6] := ' x'; Result[7] := ''; Result[8] := ' y'; Result[9] := ' z'; Result[10]:= ''; end; function ExpText(rpl: array of const): String; begin Result := LinesToText(LinesReplace(TestText, rpl)) end; function TestText2: TStringArray; begin SetLength(Result, 4); Result[0] := ' a;'; Result[1] := ' b'; Result[2] := ' '; Result[3] := ''; end; function ExpText2(rpl: array of const): String; begin Result := LinesToText(LinesReplace(TestText2, rpl)) end; begin SkipGroupUndo := False; ReCreateEdit; SynEdit.TabWidth := 4; SynEdit.TrimSpaceType := settMoveCaret; BaseTestName := 'UnIndent pff'; SynEdit.Options := SynEdit.Options - [eoTrimTrailingSpaces, eoScrollPastEol, eoAutoIndent]; SynEdit.Options2 := SynEdit.Options2 - [eoPersistentBlock]; TestRedoUndo('simple', TestText, 5,2, [ VK_BACK, 4,2, ExpText([ 2, ' b']) ] ); TestRedoUndo('not at indent-end', TestText, 4,2, [ VK_BACK, 3,2, ExpText([ 2, ' b']) ] ); BaseTestName := 'UnIndent'; SynEdit.Options := SynEdit.Options + [eoAutoIndent] - [eoTrimTrailingSpaces, eoScrollPastEol]; TestRedoUndo('simple', TestText, 5,2, [ VK_BACK, 3,2, ExpText([ 2, ' b']) ] ); TestRedoUndo('simple twice', TestText, 5,2, [ VK_BACK, 3,2, ExpText([ 2, ' b']), VK_BACK, 1,2, ExpText([ 2, 'b']) ]); TestRedoUndo('not at indent-end', TestText, 4,2, [ VK_BACK, 3,2, ExpText([ 2, ' b']) ] ); TestRedoUndo('2 level', TestText, 7,3, [ VK_BACK, 5,3, ExpText([ 3, ' c']), VK_BACK, 3,3, ExpText([ 3, ' c']), VK_BACK, 1,3, ExpText([ 3, 'c']) ]); TestRedoUndo('2 lvl, not indent-end', TestText, 6,3, [ VK_BACK, 5,3, ExpText([ 3, ' c']) ] ); TestRedoUndo('2 lvl, not indent-end 2', TestText, 5,3, [ VK_BACK, 4,3, ExpText([ 3, ' c']) ] ); TestRedoUndo('below empty line', TestText, 7,5, [ VK_BACK, 5,5, ExpText([ 5, ' d']) ] ); TestRedoUndo('below empty, not I-End', TestText, 6,5, [ VK_BACK, 5,5, ExpText([ 5, ' d']) ] ); TestRedoUndo('below empty, not I-End 2',TestText, 5,5, [ VK_BACK, 4,5, ExpText([ 5, ' d']) ] ); TestRedoUndo('below empty line, many', TestText, 7,5, [ VK_BACK, 5,5, ExpText([ 5, ' d']), VK_BACK, 3,5, ExpText([ 5, ' d']), VK_BACK, 1,5, ExpText([ 5, 'd']) ]); TestRedoUndo('unindent single space', TestText, 6,10, [ VK_BACK, 5,10, ExpText([ 10, ' z']) ] ); TestRedoUndo('empty line in many', TestText, 6,10, [ VK_BACK, 5,10, ExpText([ 10, ' z']), VK_BACK, 3,10, ExpText([ 10, ' z']), VK_BACK, 1,10, ExpText([ 10, 'z']) ]); SkipGroupUndo := True; // The first VK_BACK is deletet, not unindent, therefore it's 2 different undo SynEdit.Options := SynEdit.Options - [eoTrimTrailingSpaces]; TestRedoUndo('only indent, no text', TestText, 8,3, [ VK_BACK, 7,3, ExpText([ 3, ' ']), VK_BACK, 5,3, ExpText([ 3, ' ']), VK_BACK, 3,3, ExpText([ 3, ' ']), VK_BACK, 1,3, ExpText([ 3, '']) ]); SynEdit.Options := SynEdit.Options + [eoTrimTrailingSpaces]; TestRedoUndo('only indent, no text (trim)', TestText, 8,3, [ VK_BACK, 7,3, ExpText([ 3, ' ']), VK_BACK, 5,3, ExpText([ 3, ' ']), VK_BACK, 3,3, ExpText([ 3, ' ']), VK_BACK, 1,3, ExpText([ 3, '']) ]); SynEdit.Options := SynEdit.Options - [eoTrimTrailingSpaces]; SkipGroupUndo := False; TestRedoUndo('no unindent (selection)', TestText, 5,2, [ VK_BACK, 4,2, ExpText([ 2, ' b']) ], 4,2); TestRedoUndo('no unindent (selection)', TestText, 5,2, [ VK_BACK, 1,2, ExpText([ 2, 'b']) ], 1,2); SynEdit.Options2 := SynEdit.Options2 + [eoPersistentBlock]; TestRedoUndo('unindent (persist selection)', TestText, 5,2, [ VK_BACK, 3,2, ExpText([ 2, ' b']) ], 4,2); TestRedoUndo('unindent (persist selection)', TestText, 5,2, [ VK_BACK, 3,2, ExpText([ 2, ' b']) ], 1,2); SynEdit.Options2 := SynEdit.Options2 - [eoPersistentBlock]; BaseTestName := 'UnIndent, with 1st line indended most'; SynEdit.Options := SynEdit.Options - [eoTrimTrailingSpaces{, eoScrollPastEol}]; SynEdit.Options2 := SynEdit.Options2 - [eoPersistentBlock]; TestRedoUndo('extra indent on first', TestText2, 7,3, [ VK_BACK, 5,3, ExpText2([ 3, ' ']), VK_BACK, 1,3, ExpText2([ 3, '']) ] ); end; function TTestSynBeautifier.GetIndentCallBack(Sender: TObject; Editor: TObject; LogCaret, OldLogCaret: TPoint; FirstLinePos, LastLinePos: Integer; Reason: TSynEditorCommand; SetIndentProc: TSynBeautifierSetIndentProc): boolean; var i: integer; begin FGotLogCaret := LogCaret; FGotOldLogCaret := OldLogCaret; FGotFirstLinePos := FirstLinePos; FGotLastLinePos := LastLinePos; FGotReason := Reason; for i := 0 to high(FCallBackData) do SetIndentProc( FCallBackData[i].LinePos, FCallBackData[i].Indent, FCallBackData[i].RelativeToLinePos, FCallBackData[i].IndentChars, FCallBackData[i].IndentCharsFromLinePos ); Result := FGetIndentCallBackResult; end; procedure TTestSynBeautifier.IndentCallBack; function TestText: TStringArray; begin SetLength(Result, 13); Result[0] := ' a;'; Result[1] := #9+'b'; Result[2] := ' c'; Result[3] := ''; Result[4] := #32#9+' d'; Result[5] := ''; Result[6] := ' x'; Result[7] := ''; Result[8] := ' y'; Result[9] := ' z'; Result[10]:= ' mn'; Result[11]:= ' op'; Result[12]:= ''; end; function ExpText(rpl: array of const): String; begin Result := LinesToText(LinesReplace(TestText, rpl)) end; procedure SetCB(Res: Boolean; Action: array of const); var i: integer; begin FGetIndentCallBackResult := Res; FGotLogCaret := Point(-3, -33); FGotOldLogCaret := Point(-3, -33); FGotFirstLinePos := -99; FGotLastLinePos := -99; FGotReason := 27997; SetLength(FCallBackData, length(Action) div 5); for i := 0 to length(Action) div 5 - 1 do begin FCallBackData[i].LinePos := Action[i*5 + 0].VInteger; FCallBackData[i].Indent := Action[i*5 + 1].VInteger; FCallBackData[i].RelativeToLinePos := Action[i*5 + 2].VInteger; case Action[i*5 + 3].VType of vtString: FCallBackData[i].IndentChars := AnsiString(Action[i*5 + 3].VString); vtAnsiString: FCallBackData[i].IndentChars := AnsiString(Action[i*5 + 3].VAnsiString); vtChar: FCallBackData[i].IndentChars := Action[i*5 + 3].VChar; end; FCallBackData[i].IndentCharsFromLinePos := Action[i*5 + 4].VInteger; end; end; procedure TestCbArgs(Name: String; OldX, OldY, NewX, NewY, FirstLine, LastLine, Reason: integer); begin AssertEquals(Name + 'CB-Args: Got Caret.x Before', OldX, FGotOldLogCaret.x); AssertEquals(Name + 'CB-Args: Got Caret.y Before', OldY, FGotOldLogCaret.y); AssertEquals(Name + 'CB-Args: Got Caret.x After', NewX, FGotLogCaret.x); // x=1 => before auto indent AssertEquals(Name + 'CB-Args: Got Caret.y After', NewY, FGotLogCaret.y); AssertEquals(Name + 'CB-Args: FirstLine', FirstLine, FGotFirstLinePos); AssertEquals(Name + 'CB-Args: LastLine', LastLine, FGotLastLinePos); AssertEquals(Name + 'CB-Args: Reason', Reason, FGotReason); end; begin ReCreateEdit; try SynEdit.Beautifier.OnGetDesiredIndent := @GetIndentCallBack; SynEdit.TabWidth := 4; SynEdit.TrimSpaceType := settMoveCaret; BaseTestName := 'Callback (no trim)'; SynEdit.Options := SynEdit.Options + [eoAutoIndent] - [eoTrimTrailingSpaces, eoScrollPastEol]; TSynBeautifier(SynEdit.Beautifier).IndentType := sbitSpace; // sbitCopySpaceTab; SetCB(False, []); TestRedoUndo('cb result = false', TestText, 3,2, [ VK_RETURN, 5,3, ExpText([ -3, ' ']) ] ); TestCbArgs('cb result = false', 3,2, 1,3, 3,3, ecLineBreak); SetCB(True, []); TestRedoUndo('cb result = true ', TestText, 3,2, [ VK_RETURN, 1,3, ExpText([ -3, '']) ] ); TestCbArgs('cb result = true', 3,2, 1,3, 3,3, ecLineBreak); // LinPos, Indend, RelativeLinePos=0, Char(s), indentFromLine=-1, SetCB(True, [2, 2, 0, '', -1, 3, 3, 0, '', -1 ]); TestRedoUndo('cb absolute', TestText, 3,2, [ VK_RETURN, 1,3, ExpText([ 2, ' b', ' ']) ] ); // caret is NOT adjusted TestCbArgs('cb absolute', 3,2, 1,3, 3,3, ecLineBreak); SetCB(True, [2, 3, 0, '', -1, 3, 3, 0, '', 2, 4, 2, 0, '', -1 ]); TestRedoUndo('cb absolute 2', TestText, 3,2, [ VK_RETURN, 1,3, ExpText([ 2, 2, ' b', ' ', ' c']) ] ); TestCbArgs('cb absolute 2', 3,2, 1,3, 3,3, ecLineBreak); SetCB(True, [2, 7, 0, '', 2, 3, 6, 0, '', 2 ]); TestRedoUndo('cb absolute, keep-cur', TestText, 3,2, [ VK_RETURN, 1,3, ExpText([ 2, #9+' b', #9+' ']) ] ); TestCbArgs('cb absolute, keep-cur', 3,2, 1,3, 3,3, ecLineBreak); SetCB(True, [2, -2, 2, '', -1, 3, 3, 2, '', -1 ]); TestRedoUndo('cb relative ', TestText, 3,2, [ VK_RETURN, 1,3, ExpText([ 2, ' b', ' ']) ] ); TestCbArgs('cb relative ', 3,2, 1,3, 3,3, ecLineBreak); SetCB(True, [2, 3, 2, '', -1, 3, -1, 2, '', -1 ]); TestRedoUndo('cb relative 2', TestText, 3,2, [ VK_RETURN, 1,3, ExpText([ 2, ' b', ' ']) ] ); TestCbArgs('cb relative 2', 3,2, 1,3, 3,3, ecLineBreak); SetCB(True, [2, 3, 2, '', -1, 3, 1, 3, '', -1 ]); TestRedoUndo('cb relative 3', TestText, 3,2, [ VK_RETURN, 1,3, ExpText([ 2, ' b', ' ']) ] ); TestCbArgs('cb relative 3', 3,2, 1,3, 3,3, ecLineBreak); SetCB(True, [2, 3, 2, '', 2, 3, 0, 2, '', 2 ]); TestRedoUndo('cb relative, keep', TestText, 3,2, [ VK_RETURN, 1,3, ExpText([ 2, #9+' b', #9+' ']) ] ); TestCbArgs('cb relative, keep', 3,2, 1,3, 3,3, ecLineBreak); SetCB(True, [1, 9, 0, #9, -1]); TestRedoUndo('cb abs; char=tab', TestText, 5,1, [ VK_RETURN, 1,2, ExpText([ 1, #9#9+' a;', '']) ] ); TestCbArgs('cb abs; char=tab', 5,1, 1,2, 2,2, ecLineBreak); (* Paste *) ClipBoardText := '1'; SetCB(True, []); TestRedoUndo('paste 1 lines, noaction', TestText, 5,11, [ VK_V, 6,11, ExpText([ 11, ' mn1']) ] ); TestCbArgs('paste 1 lines, noaction', 5,11, 6,11, 11,11, ecPaste); ClipBoardText := '1'+LineEnding+'2'; SetCB(True, []); TestRedoUndo('paste 2 lines, noaction', TestText, 5,11, [ VK_V, 2,12, ExpText([ 11, ' mn1', '2']) ] ); TestCbArgs('paste 2 lines, noaction', 5,11, 2,12, 11,12, ecPaste); ClipBoardText := '1'+LineEnding+'2'+LineEnding+'3'; SetCB(True, []); TestRedoUndo('paste 3 lines, noaction', TestText, 5,11, [ VK_V, 2,13, ExpText([ 11, ' mn1', '2', '3']) ] ); TestCbArgs('paste 3 lines, noaction', 5,11, 2,13, 11,13, ecPaste); ClipBoardText := '1'+LineEnding+'2'+LineEnding+'3'+LineEnding+'4'; SetCB(True, []); TestRedoUndo('paste 4 lines, noaction', TestText, 5,11, [ VK_V, 2,14, ExpText([ 11, ' mn1', '2', '3', '4']) ] ); TestCbArgs('paste 4 lines, noaction', 5,11, 2,14, 11,14, ecPaste); ClipBoardText := '1'+LineEnding+'2'+LineEnding+'3'+LineEnding+'4'+LineEnding; SetCB(True, []); TestRedoUndo('paste 4+ lines, noaction', TestText, 5,11, [ VK_V, 1,15, ExpText([ 11, ' mn1', '2', '3', '4', '']) ] ); TestCbArgs('paste 4+ lines, noaction', 5,11, 1,15, 11,15, ecPaste); ClipBoardText := '1'+LineEnding+'2'+LineEnding+'3'+LineEnding+'4'; SetCB(True, []); TestRedoUndo('paste 4 lines on empty, noaction', TestText, 1,8, [ VK_V, 2,11, ExpText([ 8, '1', '2', '3', '4']) ] ); TestCbArgs('paste 4 lines on empty, noaction', 1,8, 2,11, 8,11, ecPaste); ClipBoardText := '1'+LineEnding+'2'+LineEnding+'3'+LineEnding+'4'+LineEnding +'5'; SetCB(True, []); TestRedoUndo('paste 5 lines, noaction', TestText, 5,11, [ VK_V, 2,15, ExpText([ 11, ' mn1', '2', '3', '4', '5']) ] ); TestCbArgs('paste 5 lines, noaction', 5,11, 2,15, 11,15, ecPaste); ClipBoardText := '1'+LineEnding+'2'; SetCB(True, []); TestRedoUndo('paste 2 lines middle, noaction', TestText, 4,11, [ VK_V, 2,12, ExpText([ 11, ' m1', '2n']) ] ); TestCbArgs('paste 2 lines middle, noaction', 4,11, 2,12, 11,12, ecPaste); ClipBoardText := '1'+LineEnding+'2'+LineEnding+'3'; SetCB(True, []); TestRedoUndo('paste 3 lines middle, noaction', TestText, 4,11, [ VK_V, 2,13, ExpText([ 11, ' m1', '2', '3n']) ] ); TestCbArgs('paste 3 lines middle, noaction', 4,11, 2,13, 11,13, ecPaste); BaseTestName := 'Callback (trim)'; SynEdit.Options := SynEdit.Options + [eoTrimTrailingSpaces, eoAutoIndent] - [eoScrollPastEol]; (* Paste *) ClipBoardText := '1'; SetCB(True, []); TestRedoUndo('paste 1 lines, noaction', TestText, 5,11, [ VK_V, 6,11, ExpText([ 11, ' mn1']) ] ); TestCbArgs('paste 1 lines, noaction', 5,11, 6,11, 11,11, ecPaste); ClipBoardText := '1'+LineEnding+'2'; SetCB(True, []); TestRedoUndo('paste 2 lines, noaction', TestText, 5,11, [ VK_V, 2,12, ExpText([ 11, ' mn1', '2']) ] ); TestCbArgs('paste 2 lines, noaction', 5,11, 2,12, 11,12, ecPaste); ClipBoardText := '1'+LineEnding+'2'+LineEnding+'3'; SetCB(True, []); TestRedoUndo('paste 3 lines, noaction', TestText, 5,11, [ VK_V, 2,13, ExpText([ 11, ' mn1', '2', '3']) ] ); TestCbArgs('paste 3 lines, noaction', 5,11, 2,13, 11,13, ecPaste); ClipBoardText := '1'+LineEnding+'2'+LineEnding+'3'+LineEnding+'4'; SetCB(True, []); TestRedoUndo('paste 4 lines, noaction', TestText, 5,11, [ VK_V, 2,14, ExpText([ 11, ' mn1', '2', '3', '4']) ] ); TestCbArgs('paste 4 lines, noaction', 5,11, 2,14, 11,14, ecPaste); ClipBoardText := '1'+LineEnding+'2'+LineEnding+'3'+LineEnding+'4'+LineEnding; SetCB(True, []); TestRedoUndo('paste 4+ lines, noaction', TestText, 5,11, [ VK_V, 1,15, ExpText([ 11, ' mn1', '2', '3', '4', '']) ] ); TestCbArgs('paste 4+ lines, noaction', 5,11, 1,15, 11,15, ecPaste); ClipBoardText := '1'+LineEnding+'2'+LineEnding+'3'+LineEnding+'4'; SetCB(True, []); TestRedoUndo('paste 4 lines on empty, noaction', TestText, 1,8, [ VK_V, 2,11, ExpText([ 8, '1', '2', '3', '4']) ] ); TestCbArgs('paste 4 lines on empty, noaction', 1,8, 2,11, 8,11, ecPaste); ClipBoardText := '1'+LineEnding+'2'+LineEnding+'3'+LineEnding+'4'+LineEnding +'5'; SetCB(True, []); TestRedoUndo('paste 5 lines, noaction', TestText, 5,11, [ VK_V, 2,15, ExpText([ 11, ' mn1', '2', '3', '4', '5']) ] ); TestCbArgs('paste 5 lines, noaction', 5,11, 2,15, 11,15, ecPaste); ClipBoardText := '1'+LineEnding+'2'; SetCB(True, []); TestRedoUndo('paste 2 lines middle, noaction', TestText, 4,11, [ VK_V, 2,12, ExpText([ 11, ' m1', '2n']) ] ); TestCbArgs('paste 2 lines middle, noaction', 4,11, 2,12, 11,12, ecPaste); ClipBoardText := '1'+LineEnding+'2'+LineEnding+'3'; SetCB(True, []); TestRedoUndo('paste 3 lines middle, noaction', TestText, 4,11, [ VK_V, 2,13, ExpText([ 11, ' m1', '2', '3n']) ] ); TestCbArgs('paste 3 lines middle, noaction', 4,11, 2,13, 11,13, ecPaste); finally SynEdit.Beautifier.OnGetDesiredIndent := nil; end; end; procedure TTestSynBeautifier.IndentPasComment; var Beautifier: TSynBeautifierPascal; BaseName, BaseConf: String; BaseText: TStringArray; BaseStep: Integer; CurrentText: TStringArray; ParentIndentType: TSynBeautifierIndentType; PIName: string; LoopMatchFirst, LoopIndentApplyNoMatch, LoopIndentAdds, LoopIndentMax: Integer; ExtraIndentFlags: TSynCommentIndentFlags; MatchLine: TSynCommentMatchLine; type TTestFlags = set of (tfExpLineDiffUseBase); procedure ConfigBeautifier(AType: TSynCommentType; AIndentMode: TSynCommentIndentFlags; AIndentFirstLineMax: Integer; AIndentFirstLineExtra: String; ACommentMode: TSynCommentContineMode; AMatchMode: TSynCommentMatchMode; AMatchLine: TSynCommentMatchLine; ACommentIndent: TSynBeautifierIndentType; AMatch: String; APrefix: String; AExtenbSlash: TSynCommentExtendMode = sceNever ); begin writestr(BaseConf, AType,':', ' IMode=', dbgs(AIndentMode), ' IMax=', AIndentFirstLineMax, ' IExtra=', AIndentFirstLineExtra, ' CMode=', ACommentMode, ' CMatch=', AMatchMode, ' CLine=', AMatchLine, ' M=''', AMatch, ''' R=''', APrefix, ''' CIndent=', ACommentIndent ); case AType of sctAnsi: with Beautifier do begin AnsiIndentMode := AIndentMode; AnsiIndentFirstLineMax := AIndentFirstLineMax; AnsiIndentFirstLineExtra := AIndentFirstLineExtra; AnsiCommentMode := ACommentMode; AnsiMatchMode := AMatchMode; AnsiMatchLine := AMatchLine; AnsiCommentIndent := ACommentIndent; AnsiMatch := AMatch; AnsiPrefix := APrefix; end; sctBor: with Beautifier do begin BorIndentMode := AIndentMode; BorIndentFirstLineMax := AIndentFirstLineMax; BorIndentFirstLineExtra := AIndentFirstLineExtra; BorCommentMode := ACommentMode; BorMatchMode := AMatchMode; BorMatchLine := AMatchLine; BorCommentIndent := ACommentIndent; BorMatch := AMatch; BorPrefix := APrefix; end; sctSlash: with Beautifier do begin ExtendSlashCommentMode := AExtenbSlash; SlashIndentMode := AIndentMode; SlashIndentFirstLineMax := AIndentFirstLineMax; SlashIndentFirstLineExtra := AIndentFirstLineExtra; SlashCommentMode := ACommentMode; SlashMatchMode := AMatchMode; SlashMatchLine := AMatchLine; SlashCommentIndent := ACommentIndent; SlashMatch := AMatch; SlashPrefix := APrefix; end; end; end; function BaseLinesToText: String; var i, j, k: Integer; begin i := 0; j := 30; k := length(BaseText); Result := ' '; while k > 0 do if BaseText[k - 1] = '' then dec(k) else break; while i < k do if BaseText[i] = '' then inc(i) else break; Result := Result + ' '+ IntToStr(i)+':'; while (i < k) and (j>0) do begin Result := Result + copy(BaseText[i], 1, j); if Length(BaseText[i]) > j then Result := Result + '...' else Result := Result + '#13'; j := j - Length(BaseText[i]); inc(i); end; end; Procedure DoSetText(ABaseName: String; ALines: TStringArray); begin BaseName := ABaseName; BaseStep := 0; BaseText := ALines; CurrentText := BaseText; SetLines(ALines); BaseName := BaseName + BaseLinesToText; DebugLn(BaseConf); end; Procedure DoSetText(ABaseName: String; ALines: array of const); begin BaseName := ABaseName; BaseStep := 0; BaseText := nil; SetLength(BaseText, 10); BaseText := LinesReplace(BaseText, ALines); CurrentText := BaseText; SetLines(BaseText); BaseName := BaseName + BaseLinesToText; DebugLn(BaseConf); end; // Caret is logical Procedure DoNewLine(AName: string; AStartX, AStartY: Integer; ExpX, ExpY: Integer; ExpLineDiff: array of const; AFlags: TTestFlags = []); begin SynEdit.TestTypeText(AStartX, AStartY, #13); if tfExpLineDiffUseBase in AFlags then CurrentText := LinesReplace(BaseText, ExpLineDiff) else CurrentText := LinesReplace(CurrentText, ExpLineDiff); inc(BaseStep); debugln([Format('[%s (%d)] %s -- Enter at (%d, %d)', [BaseName, BaseStep, AName, AStartX, AStartY])]); debugln([dbgs(SynEdit.LogicalCaretXY), ': ', DbgStr(SynEdit.TestFullText)]); TestIsCaret(Format('[%s (%d)] %s -- Enter at (%d, %d) -- Exp Caret (%d, %d) :: %s', [BaseName, BaseStep, AName, AStartX, AStartY, ExpX, ExpY, BaseConf]), ExpX, ExpY); TestIsText(Format('[%s (%d)] %s -- Enter at (%d, %d) -> (%d, %d) - Exp Text (Changes: %d) :: %s', [BaseName, BaseStep, AName, AStartX, AStartY, ExpX, ExpY, length(ExpLineDiff), BaseConf]), CurrentText); end; begin Beautifier := TSynBeautifierPascal.Create(nil); try ReCreateEdit; SynEdit.Beautifier := Beautifier; SynEdit.Options := SynEdit.Options - [eoTrimTrailingSpaces];// + [eoScrollPastEol]; SynEdit.TabWidth := 4; UseFullText := True; Beautifier.IndentType := sbitCopySpaceTab; {%region Bor (Curly) } ConfigBeautifier(sctBor, [sciAddTokenLen, sciAddPastTokenIndent], 0, '', sccPrefixMatch, scmMatchAfterOpening, sclMatchPrev, sbitSpace, '^ ?([\*#])', '$1'); DoSetText('Curly simple 1', [2, ' {* abc']); DoNewLine('', 7, 2, 6, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('', 7, 3, 6, 4, [3, ' * b', ' * c' ]); // 3:" * b|c" => 4:" * |c" DoNewLine('', 7, 4, 6, 5, [4, ' * c', ' * ' ]); // 4:" * c|" DoNewLine('', 5, 3, 5, 4, [3, ' *', ' * b' ]); // 3:" *| b" DoSetText('Curly simple 2', [2, ' {* abc', ' * ']); DoNewLine('', 5, 3, 5, 4, [3, ' * ', ' * ']); DoSetText('Curly simple 3', [2, ' {*', ' *']); DoNewLine('', 4, 3, 4, 4, [3, ' *', ' *']); DoSetText('Curly, not matching', [2, ' {+ abc']); DoNewLine('', 7, 2, 3, 3, [2, ' {+ a', ' bc']); // 2:" {* a|bc" DoSetText('Curly Nested 1', [2, ' {* abc {', ' # def']); DoNewLine('', 9, 3, 8, 4, [3, ' # d', ' # ef']); // 2:" {# d|ef" // Todo: Nested that matches the "{", and uses smartSpace. ConfigBeautifier(sctBor, [sciAddTokenLen, sciAddPastTokenIndent], 0, '', sccPrefixMatch, scmMatchOpening, sclMatchPrev, sbitSpace, '^\{ ?([\*#])', '$1'); DoSetText('Bor Nested 1', [2, ' { * abc ', ' { # def']); // Todo: smart, must detect, that prevline = nest open // DoNewLine('', 10, 3, 9, 4, [3, ' { # d', ' # ef']); // 2:" {# d|ef" {%region Bor (Curly) --- TSynCommentIndentFlag (Pre-PerfixIndent) } PushBaseName('Curly - TSynCommentIndentFlag'); // sbitSpace, sbitCopySpaceTab, sbitPositionCaret for ParentIndentType := low(TSynBeautifierIndentType) to sbitPositionCaret // high(TSynBeautifierIndentType) do begin Beautifier.IndentType := ParentIndentType; WriteStr(PIName, ParentIndentType); PushBaseName(PIName); // sclMatchFirst; for LoopMatchFirst := 0 to 1 do begin if LoopMatchFirst = 0 then MatchLine := sclMatchPrev else MatchLine := sclMatchFirst; PushBaseName(dbgs(MatchLine)); // sciApplyIndentForNoMatch for LoopIndentApplyNoMatch := 0 to 1 do begin // sciAddTokenLen, sciAddPastTokenIndent; for LoopIndentAdds := 0 to 3 do begin ExtraIndentFlags := []; if LoopIndentApplyNoMatch = 1 then begin ExtraIndentFlags := ExtraIndentFlags + [sciApplyIndentForNoMatch]; PushBaseName('ApplyIndNoMatch'); end else PushBaseName(''); if (LoopIndentAdds and 1) = 1 then begin ExtraIndentFlags := ExtraIndentFlags + [sciAddTokenLen]; PushBaseName('AddTokLen'); end else PushBaseName(''); if (LoopIndentAdds and 2) = 2 then begin ExtraIndentFlags := ExtraIndentFlags + [sciAddPastTokenIndent]; PushBaseName('AddPastTokInd'); end else PushBaseName(''); {%region [] use default indent} PushBaseName('IndType=[]'); // AnsiIndentFirstLineMax, indent is >= 2, so it is not affeceted by 1 or 2 for LoopIndentMax := 0 to 2 do begin if LoopIndentMax = 1 then Continue; // TODO: add tests // MaxIndent was extended to act on default indent to (first line only) PushBaseName('Max='+IntToStr(LoopIndentMax)); ConfigBeautifier(sctBor, [] + ExtraIndentFlags, LoopIndentMax, '', sccPrefixMatch, scmMatchAfterOpening, MatchLine, sbitSpace, '^\s*\*', '*'); if not (sciAddTokenLen in ExtraIndentFlags) then begin // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 5, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 6, 3, 5, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent in comment "{ *" / matching DoSetText('"{ *" matching', [2, ' { * abc']); if not (sciAddPastTokenIndent in ExtraIndentFlags) then begin DoNewLine('after 1st', 9, 2, 5, 3, [2, ' { * a', ' * bc']); // 2:" { * a|bc" DoNewLine('any line', 6, 3, 5, 4, [3, ' * b', ' * c']); // 3:" * b|c" end else begin DoNewLine('after 1st', 9, 2, 7, 3, [2, ' { * a', ' * bc']); // 2:" { * a|bc" DoNewLine('any line', 8, 3, 7, 4, [3, ' * b', ' * c']); // 3:" * b|c" end; // Indent tabs / matching if (ParentIndentType in [sbitCopySpaceTab]) and (LoopIndentMax = 0) then begin DoSetText('tabs matching', [2, #9' {*'#9' abc']); DoNewLine('after 1st', 8, 2, 6, 3, [2, #9' {*'#9' a', #9' *'#9' bc']); // 2:"_ {*_ a|bc" DoNewLine('any line', 7, 3, 6, 4, [3, #9' *'#9' b', #9' *'#9' c']); // 3:" * b|c" end; // Indent, not BOL / matching DoSetText('not BOL matching', [2, ' ;{* abc']); DoNewLine('after 1st', 8, 2, 5, 3, [2, ' ;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 6, 3, 5, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent / NOT matching DoSetText('not matching', [2, ' {+ abc']); DoNewLine('after 1st', 7, 2, 3, 3, [2, ' {+ a', ' bc']); // 2:" {+ a|bc" DoNewLine('any line', 4, 3, 3, 4, [3, ' b', ' c']); // 3:" b|c" end else begin // [sciAddTokenLen] // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 6, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 7, 3, 6, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent in comment "{ *" / matching DoSetText('"{ *" matching', [2, ' { * abc']); if not (sciAddPastTokenIndent in ExtraIndentFlags) then begin DoNewLine('after 1st', 9, 2, 6, 3, [2, ' { * a', ' * bc']); // 2:" { * a|bc" DoNewLine('any line', 7, 3, 6, 4, [3, ' * b', ' * c']); // 3:" * b|c" end else begin DoNewLine('after 1st', 9, 2, 8, 3, [2, ' { * a', ' * bc']); // 2:" { * a|bc" DoNewLine('any line', 9, 3, 8, 4, [3, ' * b', ' * c']); // 3:" * b|c" end; // Indent tabs / matching if (ParentIndentType in [sbitCopySpaceTab]) and (LoopIndentMax = 0) then begin DoSetText('tabs matching', [2, #9' {*'#9' abc']); DoNewLine('after 1st', 8, 2, 7, 3, [2, #9' {*'#9' a', #9' *'#9' bc']); // 2:"_ {*_ a|bc" DoNewLine('any line', 8, 3, 7, 4, [3, #9' *'#9' b', #9' *'#9' c']); // 3:" * b|c" end; // Indent, not BOL / matching DoSetText('not BOL matching', [2, ' ;{* abc']); DoNewLine('after 1st', 8, 2, 6, 3, [2, ' ;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 7, 3, 6, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent / NOT matching DoSetText('not matching', [2, ' {+ abc']); if sciApplyIndentForNoMatch in ExtraIndentFlags then begin DoNewLine('after 1st', 7, 2, 4, 3, [2, ' {+ a', ' bc']); // 2:" {+ a|bc" DoNewLine('any line', 5, 3, 4, 4, [3, ' b', ' c']); // 3:" b|c" end else begin DoNewLine('after 1st', 7, 2, 3, 3, [2, ' {+ a', ' bc']); // 2:" {+ a|bc" DoNewLine('any line', 4, 3, 3, 4, [3, ' b', ' c']); // 3:" b|c" end; end; PopBaseName; end; // LoopIndentMax; PushBaseName('Max='+IntToStr(10)); ConfigBeautifier(sctBor, [sciAlignOpenOnce, sciAlignOpenSkipBOL] + ExtraIndentFlags, 0, '', sccPrefixMatch, scmMatchAfterOpening, MatchLine, sbitSpace, '^\s*\*', '*'); if not (sciAddTokenLen in ExtraIndentFlags) then begin // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 5, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 6, 3, 5, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent, not BOL / matching // sciAlignOpenOnce applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 8, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 9, 3, 8, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Check_that_Indent_is_NOT_restored // SEE Check_that_Indent_is_restored // Indent, not BOL / matching // sciAlignOpenOnce applied DoSetText('NOT restore Align', [2, ' ;;;{* abc', ' *']); if ParentIndentType = sbitPositionCaret then DoNewLine('after 2nd', 4, 3, 5, 4, [3, ' *', ' *']) // NOT added post indent of 1 else DoNewLine('after 2nd', 4, 3, 5, 4, [3, ' *', ' * ']); // added post indent of 1 end else begin // [sciAddTokenLen] // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 6, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 7, 3, 6, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent, not BOL / matching // sciAlignOpenOnce applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 9, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 10, 3, 9, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Check_that_Indent_is_NOT_restored // SEE Check_that_Indent_is_restored // Indent, not BOL / matching // sciAlignOpenOnce applied DoSetText('NOT restore Align', [2, ' ;;;{* abc', ' *']); if ParentIndentType = sbitPositionCaret then DoNewLine('after 2nd', 4, 3, 5, 4, [3, ' *', ' *']) else DoNewLine('after 2nd', 4, 3, 5, 4, [3, ' *', ' * ']); end; PopBaseName; PushBaseName('Etra=" " + Max=10'); ConfigBeautifier(sctBor, [sciAlignOpenOnce, sciAlignOpenSkipBOL] + ExtraIndentFlags, 0, ' ', sccPrefixMatch, scmMatchAfterOpening, MatchLine, sbitSpace, '^\s*\*', '*'); if not (sciAddTokenLen in ExtraIndentFlags) then begin // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 5, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 6, 3, 5, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent, not BOL / matching // sciAlignOpenOnce applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 8, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 9, 3, 8, 4, [3, ' * b', ' * c']); // 3:" * b|c" end else begin // [sciAddTokenLen] // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 6, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 7, 3, 6, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent, not BOL / matching // sciAlignOpenOnce applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 9, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 10, 3, 9, 4, [3, ' * b', ' * c']); // 3:" * b|c" end; PopBaseName; PushBaseName('Etra=" " + Max=0'); ConfigBeautifier(sctBor, [] + ExtraIndentFlags, 0, ' ', sccPrefixMatch, scmMatchAfterOpening, MatchLine, sbitSpace, '^\s*\*', '*'); if not (sciAddTokenLen in ExtraIndentFlags) then begin // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 5, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 6, 3, 5, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent, not BOL / matching // AnsiIndentFirstLineMax applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 10, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 11, 3, 10, 4, [3, ' * b', ' * c']); // 3:" * b|c" end else begin // [sciAddTokenLen] // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 6, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 7, 3, 6, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent, not BOL / matching // AnsiIndentFirstLineMax applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 11, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 12, 3, 11, 4, [3, ' * b', ' * c']); // 3:" * b|c" end; PopBaseName; PopBaseName; {%endregion [] use default indent} {%region [sciNone] } PushBaseName('IndType=[]'); // AnsiIndentFirstLineMax, indent is >= 2, so it is not affeceted by 1 or 2 for LoopIndentMax := 0 to 2 do begin PushBaseName('Max='+IntToStr(LoopIndentMax)); ConfigBeautifier(sctBor, [sciNone] + ExtraIndentFlags, LoopIndentMax, '', sccPrefixMatch, scmMatchAfterOpening, MatchLine, sbitSpace, '^\s*\*', '*'); if not (sciAddTokenLen in ExtraIndentFlags) then begin // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 3, 3, [2, ' {* a', '* bc']); // 2:" {* a|bc" DoNewLine('any line', 4, 3, 3, 4, [3, '* b', '* c']); // 3:"* b|c" // Indent in comment "{ *" / matching DoSetText('"{ *" matching', [2, ' { * abc']); if not (sciAddPastTokenIndent in ExtraIndentFlags) then begin DoNewLine('after 1st', 9, 2, 3, 3, [2, ' { * a', '* bc']); // 2:" { * a|bc" DoNewLine('any line', 4, 3, 3, 4, [3, '* b', '* c']); // 3:"* b|c" end else begin DoNewLine('after 1st', 9, 2, 5, 3, [2, ' { * a', ' * bc']); // 2:" { * a|bc" DoNewLine('any line', 6, 3, 3, 4, [3, ' * b', '* c']); // 3:" * b|c" end; // Indent tabs / matching if ParentIndentType in [sbitCopySpaceTab] then begin DoSetText('tabs matching', [2, #9' {*'#9' abc']); DoNewLine('after 1st', 8, 2, 4, 3, [2, #9' {*'#9' a', '*'#9' bc']); // 2:"_ {*_ a|bc" DoNewLine('any line', 5, 3, 4, 4, [3, '*'#9' b', '*'#9' c']); // 3:" * b|c" end; // Indent, not BOL / matching DoSetText('not BOL matching', [2, ' ;{* abc']); DoNewLine('after 1st', 8, 2, 3, 3, [2, ' ;{* a', '* bc']); // 2:" ;{* a|bc" DoNewLine('any line', 4, 3, 3, 4, [3, '* b', '* c']); // 3:" * b|c" // Indent / NOT matching DoSetText('not matching', [2, ' {+ abc']); if sciApplyIndentForNoMatch in ExtraIndentFlags then begin DoNewLine('after 1st', 7, 2, 1, 3, [2, ' {+ a', 'bc']); // 2:" {+ a|bc" DoNewLine('any line', 2, 3, 1, 4, [3, 'b', 'c']); // 3:" b|c" end else begin DoNewLine('after 1st', 7, 2, 3, 3, [2, ' {+ a', ' bc']); // 2:" {+ a|bc" DoNewLine('any line', 4, 3, 3, 4, [3, ' b', ' c']); // 3:" b|c" end; end else begin // [sciAddTokenLen] // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 4, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 5, 3, 3, 4, [3, ' * b', '* c']); // 3:" * b|c" // Indent in comment "{ *" / matching DoSetText('"{ *" matching', [2, ' { * abc']); if not (sciAddPastTokenIndent in ExtraIndentFlags) then begin DoNewLine('after 1st', 9, 2, 4, 3, [2, ' { * a', ' * bc']); // 2:" { * a|bc" DoNewLine('any line', 5, 3, 3, 4, [3, ' * b', '* c']); // 3:" * b|c" end else begin DoNewLine('after 1st', 9, 2, 6, 3, [2, ' { * a', ' * bc']); // 2:" { * a|bc" DoNewLine('any line', 7, 3, 3, 4, [3, ' * b', '* c']); // 3:" * b|c" end; // Indent tabs / matching if ParentIndentType in [sbitCopySpaceTab] then begin DoSetText('tabs matching', [2, #9' {*'#9' abc']); DoNewLine('after 1st', 8, 2, 5, 3, [2, #9' {*'#9' a', ' *'#9' bc']); // 2:"_ {*_ a|bc" DoNewLine('any line', 6, 3, 4, 4, [3, ' *'#9' b', '*'#9' c']); // 3:" * b|c" end; // Indent, not BOL / matching DoSetText('not BOL matching', [2, ' ;{* abc']); DoNewLine('after 1st', 8, 2, 4, 3, [2, ' ;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 5, 3, 3, 4, [3, ' * b', '* c']); // 3:" * b|c" // Indent / NOT matching DoSetText('not matching', [2, ' {+ abc']); if sciApplyIndentForNoMatch in ExtraIndentFlags then begin DoNewLine('after 1st', 7, 2, 2, 3, [2, ' {+ a', ' bc']); // 2:" {+ a|bc" DoNewLine('any line', 3, 3, 1, 4, [3, ' b', 'c']); // 3:" b|c" end else begin DoNewLine('after 1st', 7, 2, 3, 3, [2, ' {+ a', ' bc']); // 2:" {+ a|bc" DoNewLine('any line', 4, 3, 3, 4, [3, ' b', ' c']); // 3:" b|c" end; end; PopBaseName; end; // LoopIndentMax; PushBaseName('Max='+IntToStr(10)); ConfigBeautifier(sctBor, [sciNone, sciAlignOpenOnce, sciAlignOpenSkipBOL] + ExtraIndentFlags, 0, '', sccPrefixMatch, scmMatchAfterOpening, MatchLine, sbitSpace, '^\s*\*', '*'); if not (sciAddTokenLen in ExtraIndentFlags) then begin // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 3, 3, [2, ' {* a', '* bc']); // 2:" {* a|bc" DoNewLine('any line', 4, 3, 3, 4, [3, '* b', '* c']); // 3:"* b|c" // Indent, not BOL / matching // sciAlignOpenOnce applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 8, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 9, 3, 3, 4, [3, ' * b', '* c']); // 3:" * b|c" end else begin // [sciAddTokenLen] // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 4, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 5, 3, 3, 4, [3, ' * b', '* c']); // 3:" * b|c" // Indent, not BOL / matching // sciAlignOpenOnce applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 9, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 10, 3, 3, 4, [3, ' * b', '* c']); // 3:" * b|c" end; PopBaseName; (* **** PushBaseName('Etra=" " + Max=10'); ConfigBeautifier(sctBor, [sciNone] + ExtraIndentFlags, 10, ' ', sccPrefixMatch, scmMatchAfterOpening, MatchLine, sbitSpace, '^\s*\*', '*'); if not (sciAddTokenLen in ExtraIndentFlags) then begin // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 5, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 6, 3, 5, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent, not BOL / matching // AnsiIndentFirstLineMax applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 8, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 9, 3, 8, 4, [3, ' * b', ' * c']); // 3:" * b|c" end else begin // [sciAddTokenLen] // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 6, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 7, 3, 6, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent, not BOL / matching // AnsiIndentFirstLineMax applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 9, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 10, 3, 9, 4, [3, ' * b', ' * c']); // 3:" * b|c" end; PopBaseName; PushBaseName('Etra=" " + Max=0'); ConfigBeautifier(sctBor, [sciNone] + ExtraIndentFlags, 0, ' ', sccPrefixMatch, scmMatchAfterOpening, MatchLine, sbitSpace, '^\s*\*', '*'); if not (sciAddTokenLen in ExtraIndentFlags) then begin // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 5, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 6, 3, 5, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent, not BOL / matching // AnsiIndentFirstLineMax applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 10, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 11, 3, 10, 4, [3, ' * b', ' * c']); // 3:" * b|c" end else begin // [sciAddTokenLen] // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 6, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 7, 3, 6, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent, not BOL / matching // AnsiIndentFirstLineMax applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 11, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 12, 3, 11, 4, [3, ' * b', ' * c']); // 3:" * b|c" end; PopBaseName; **** *) PopBaseName; {%endregion [sciNone] } {%region [sciAlignOpen] } PushBaseName('IndType=[sciAlignOpen]'); PushBaseName('Max='+IntToStr(LoopIndentMax)); ConfigBeautifier(sctBor, [sciAlignOpen] + ExtraIndentFlags, 0, '', sccPrefixMatch, scmMatchAfterOpening, MatchLine, sbitSpace, '^\s*\*', '*'); // most are default, because the opening is at start if not (sciAddTokenLen in ExtraIndentFlags) then begin // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 5, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 6, 3, 5, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent in comment "{ *" / matching DoSetText('"{ *" matching', [2, ' { * abc']); if not (sciAddPastTokenIndent in ExtraIndentFlags) then begin DoNewLine('after 1st', 9, 2, 5, 3, [2, ' { * a', ' * bc']); // 2:" { * a|bc" DoNewLine('any line', 6, 3, 5, 4, [3, ' * b', ' * c']); // 3:" * b|c" end else begin DoNewLine('after 1st', 9, 2, 7, 3, [2, ' { * a', ' * bc']); // 2:" { * a|bc" DoNewLine('any line', 8, 3, 7, 4, [3, ' * b', ' * c']); // 3:" * b|c" end; // Indent tabs / matching if ParentIndentType in [sbitCopySpaceTab] then begin DoSetText('tabs matching', [2, #9' {*'#9' abc']); DoNewLine('after 1st', 8, 2, 6, 3, [2, #9' {*'#9' a', #9' *'#9' bc']); // 2:"_ {*_ a|bc" DoNewLine('any line', 7, 3, 6, 4, [3, #9' *'#9' b', #9' *'#9' c']); // 3:" * b|c" end; // Indent, not BOL / matching DoSetText('not BOL matching', [2, ' ;{* abc']); DoNewLine('after 1st', 8, 2, 6, 3, [2, ' ;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 7, 3, 6, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent / NOT matching DoSetText('not matching', [2, ' {+ abc']); DoNewLine('after 1st', 7, 2, 3, 3, [2, ' {+ a', ' bc']); // 2:" {+ a|bc" DoNewLine('any line', 4, 3, 3, 4, [3, ' b', ' c']); // 3:" b|c" end else begin // [sciAddTokenLen] // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 6, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 7, 3, 6, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent in comment "{ *" / matching DoSetText('"{ *" matching', [2, ' { * abc']); if not (sciAddPastTokenIndent in ExtraIndentFlags) then begin DoNewLine('after 1st', 9, 2, 6, 3, [2, ' { * a', ' * bc']); // 2:" { * a|bc" DoNewLine('any line', 7, 3, 6, 4, [3, ' * b', ' * c']); // 3:" * b|c" end else begin DoNewLine('after 1st', 9, 2, 8, 3, [2, ' { * a', ' * bc']); // 2:" { * a|bc" DoNewLine('any line', 9, 3, 8, 4, [3, ' * b', ' * c']); // 3:" * b|c" end; // Indent tabs / matching if ParentIndentType in [sbitCopySpaceTab] then begin DoSetText('tabs matching', [2, #9' {*'#9' abc']); DoNewLine('after 1st', 8, 2, 7, 3, [2, #9' {*'#9' a', #9' *'#9' bc']); // 2:"_ {*_ a|bc" DoNewLine('any line', 8, 3, 7, 4, [3, #9' *'#9' b', #9' *'#9' c']); // 3:" * b|c" end; // Indent, not BOL / matching DoSetText('not BOL matching', [2, ' ;{* abc']); DoNewLine('after 1st', 8, 2, 7, 3, [2, ' ;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 8, 3, 7, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent / NOT matching DoSetText('not matching', [2, ' {+ abc']); if sciApplyIndentForNoMatch in ExtraIndentFlags then begin DoNewLine('after 1st', 7, 2, 4, 3, [2, ' {+ a', ' bc']); // 2:" {+ a|bc" DoNewLine('any line', 5, 3, 4, 4, [3, ' b', ' c']); // 3:" b|c" end else begin DoNewLine('after 1st', 7, 2, 3, 3, [2, ' {+ a', ' bc']); // 2:" {+ a|bc" DoNewLine('any line', 4, 3, 3, 4, [3, ' b', ' c']); // 3:" b|c" end; end; PopBaseName; PushBaseName('Max='+IntToStr(10)); ConfigBeautifier(sctBor, [sciAlignOpen] + ExtraIndentFlags, 10, '', sccPrefixMatch, scmMatchAfterOpening, MatchLine, sbitSpace, '^\s*\*', '*'); if not (sciAddTokenLen in ExtraIndentFlags) then begin // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 5, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 6, 3, 5, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent, not BOL / matching // AnsiIndentFirstLineMax applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 8, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 9, 3, 8, 4, [3, ' * b', ' * c']); // 3:" * b|c" end else begin // [sciAddTokenLen] // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 6, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 7, 3, 6, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent, not BOL / matching // AnsiIndentFirstLineMax applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 9, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 10, 3, 9, 4, [3, ' * b', ' * c']); // 3:" * b|c" end; PopBaseName; PushBaseName('Max='+IntToStr(4)); // actually cut off at 4 ConfigBeautifier(sctBor, [sciAlignOpen] + ExtraIndentFlags, 4, '', sccPrefixMatch, scmMatchAfterOpening, MatchLine, sbitSpace, '^\s*\*', '*'); if not (sciAddTokenLen in ExtraIndentFlags) then begin // Indent, not BOL / matching // AnsiIndentFirstLineMax applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 7, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 8, 3, 7, 4, [3, ' * b', ' * c']); // 3:" * b|c" end else begin // [sciAddTokenLen] // Indent, not BOL / matching // AnsiIndentFirstLineMax applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 8, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 9, 3, 8, 4, [3, ' * b', ' * c']); // 3:" * b|c" end; PopBaseName; (* **** PushBaseName('Etra=" " + Max=10'); ConfigBeautifier(sctBor, [sciAlignOpen] + ExtraIndentFlags, 10, ' ', sccPrefixMatch, scmMatchAfterOpening, MatchLine, sbitSpace, '^\s*\*', '*'); if not (sciAddTokenLen in ExtraIndentFlags) then begin // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 5, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 6, 3, 5, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent, not BOL / matching // AnsiIndentFirstLineMax applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 8, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 9, 3, 8, 4, [3, ' * b', ' * c']); // 3:" * b|c" end else begin // [sciAddTokenLen] // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 6, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 7, 3, 6, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent, not BOL / matching // AnsiIndentFirstLineMax applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 9, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 10, 3, 9, 4, [3, ' * b', ' * c']); // 3:" * b|c" end; PopBaseName; PushBaseName('Etra=" " + Max=0'); ConfigBeautifier(sctBor, [sciAlignOpen] + ExtraIndentFlags, 0, ' ', sccPrefixMatch, scmMatchAfterOpening, MatchLine, sbitSpace, '^\s*\*', '*'); if not (sciAddTokenLen in ExtraIndentFlags) then begin // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 5, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 6, 3, 5, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent, not BOL / matching // AnsiIndentFirstLineMax applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 10, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 11, 3, 10, 4, [3, ' * b', ' * c']); // 3:" * b|c" end else begin // [sciAddTokenLen] // Indent / matching DoSetText('matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 6, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoNewLine('any line', 7, 3, 6, 4, [3, ' * b', ' * c']); // 3:" * b|c" // Indent, not BOL / matching // AnsiIndentFirstLineMax applied DoSetText('not BOL matching', [2, ' ;;;{* abc']); DoNewLine('after 1st', 10, 2, 11, 3, [2, ' ;;;{* a', ' * bc']); // 2:" ;{* a|bc" DoNewLine('any line', 12, 3, 11, 4, [3, ' * b', ' * c']); // 3:" * b|c" end; PopBaseName; **** *) // Check_that_Indent_is_restored SEE Check_that_Indent_is_NOT_restored PushBaseName('Max='+IntToStr(10)); ConfigBeautifier(sctBor, [sciAlignOpen] + ExtraIndentFlags, 0, '', sccPrefixMatch, scmMatchAfterOpening, MatchLine, sbitSpace, '^\s*\*', '*'); if not (sciAddTokenLen in ExtraIndentFlags) then begin // Indent, not BOL / matching // AnsiIndentFirstLineMax applied DoSetText('restore Align', [2, ' ;;;{* abc', ' *']); if ParentIndentType = sbitPositionCaret then DoNewLine('after 2nd', 4, 3, 8, 4, [3, ' *', ' *']) else DoNewLine('after 2nd', 4, 3, 8, 4, [3, ' *', ' * ']); DoSetText('restore Align', [2, ' ;;;{* abc', ' *', ' *']); if ParentIndentType = sbitPositionCaret then DoNewLine('any line', 4, 4, 8, 5, [4, ' *', ' *']) else DoNewLine('any line', 4, 4, 8, 5, [4, ' *', ' * ']); end else begin // [sciAddTokenLen] // Indent, not BOL / matching // AnsiIndentFirstLineMax applied DoSetText('restore Align', [2, ' ;;;{* abc', ' *']); if ParentIndentType = sbitPositionCaret then DoNewLine('after 2nd', 4, 3, 9, 4, [3, ' *', ' *']) else DoNewLine('after 2nd', 4, 3, 9, 4, [3, ' *', ' * ']); DoSetText('restore Align', [2, ' ;;;{* abc', ' *', ' *']); if ParentIndentType = sbitPositionCaret then DoNewLine('any line', 4, 4, 9, 5, [4, ' *', ' *']) else DoNewLine('any line', 4, 4, 9, 5, [4, ' *', ' * ']); end; PopBaseName; PopBaseName; {%endregion [sciAlignOpen] } PopBaseName; end; //LoopIndentAdds PopBaseName; PopBaseName; end; // LoopIndentApplyNoMatch PopBaseName; end; // LoopMatchFirst PopBaseName; end; Beautifier.IndentType := sbitCopySpaceTab; PopBaseName; {%endregion Bor (Curly) --- Pre-PerfixIndent } // sccNoPrefix; ConfigBeautifier(sctBor, [sciAddTokenLen], 0, '', sccNoPrefix, scmMatchAfterOpening, sclMatchPrev, sbitSpace, '^\s*\*', '*'); DoSetText('sccNoPrefix; matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 4, 3, [2, ' {* a', ' bc']); // 2:" {* a|bc" DoSetText('sccNoPrefix; NOT matching', [2, ' {+ abc']); DoNewLine('after 1st', 7, 2, 3, 3, [2, ' {+ a', ' bc']); // 2:" {* a|bc" Beautifier.BorIndentMode := [sciAddTokenLen, sciApplyIndentForNoMatch]; DoSetText('sccNoPrefix; NOT matching, apply', [2, ' {+ abc']); DoNewLine('after 1st', 7, 2, 4, 3, [2, ' {+ a', ' bc']); // 2:" {* a|bc" // sccPrefixMatch; ConfigBeautifier(sctBor, [sciAddTokenLen], 0, '', sccPrefixMatch, scmMatchAfterOpening, sclMatchPrev, sbitSpace, '^\s*\*', '*'); DoSetText('sccPrefixMatch; matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 6, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoSetText('sccPrefixMatch; NOT matching', [2, ' {+ abc']); DoNewLine('after 1st', 7, 2, 3, 3, [2, ' {+ a', ' bc']); // 2:" {* a|bc" Beautifier.BorIndentMode := [sciAddTokenLen, sciApplyIndentForNoMatch]; DoSetText('sccPrefixMatch; NOT matching, apply', [2, ' {+ abc']); DoNewLine('after 1st', 7, 2, 4, 3, [2, ' {+ a', ' bc']); // 2:" {* a|bc" // sccPrefixAlways; ConfigBeautifier(sctBor, [sciAddTokenLen], 0, '', sccPrefixAlways, scmMatchAfterOpening, sclMatchPrev, sbitSpace, '^\s*\*', '*'); DoSetText('sccPrefixAlways; matching', [2, ' {* abc']); DoNewLine('after 1st', 7, 2, 6, 3, [2, ' {* a', ' * bc']); // 2:" {* a|bc" DoSetText('sccPrefixAlways; NOT matching', [2, ' {+ abc']); DoNewLine('after 1st', 7, 2, 5, 3, [2, ' {+ a', ' *bc']); // 2:" {* a|bc" Beautifier.BorIndentMode := [sciAddTokenLen, sciApplyIndentForNoMatch]; DoSetText('sccPrefixAlways; NOT matching, apply', [2, ' {+ abc']); DoNewLine('after 1st', 7, 2, 5, 3, [2, ' {+ a', ' *bc']); // 2:" {* a|bc" {%endregion Bor (Curly) } {%region Ansi ( * } ConfigBeautifier(sctAnsi, [sciAddTokenLen, sciAddPastTokenIndent], 0, '', sccPrefixMatch, scmMatchAfterOpening, sclMatchPrev, sbitSpace, '^ ?\*', '*'); DoSetText('Ansi 2', [2, ' (* * ']); DoNewLine('', 8, 2, 8, 3, [2, ' (* * ', ' * ']); // 2:" (* * |" DoSetText('Ansi 3', [2, ' (* *']); DoNewLine('', 7, 2, 7, 3, [2, ' (* *', ' *']); // 2:" (* *|" ConfigBeautifier(sctAnsi, [sciAddTokenLen], 0, '', sccPrefixMatch, scmMatchAtAsterisk, sclMatchPrev, sbitSpace, '^\*', '*'); DoSetText('Ansi 1', [2, ' (* abc']); DoNewLine('', 7, 2, 6, 3, [2, ' (* a', ' * bc']); // 2:" (* a|bc" // scmMatchAfterOpening ConfigBeautifier(sctAnsi, [sciAddTokenLen, sciAddPastTokenIndent], 0, '', sccPrefixMatch, scmMatchAfterOpening, sclMatchPrev, sbitSpace, '^\+', '+'); DoSetText('scmMatchAfterOpening match Ansi', [2, ' (*+ ab']); DoNewLine('', 8, 2, 7, 3, [2, ' (*+ a', ' + b']); // 2:" (*+ a|b" DoSetText('scmMatchAfterOpening NO match Ansi', [2, ' (*- ab']); DoNewLine('', 8, 2, 3, 3, [2, ' (*- a', ' b']); // 2:" (*+ a|b" // scmMatchOpening ConfigBeautifier(sctAnsi, [sciAddTokenLen, sciAddPastTokenIndent], 0, '', sccPrefixMatch, scmMatchOpening, sclMatchPrev, sbitSpace, '^\(\*\+', '+'); DoSetText('scmMatchOpening match Ansi', [2, ' (*+ ab']); DoNewLine('', 8, 2, 7, 3, [2, ' (*+ a', ' + b']); // 2:" (*+ a|b" DoSetText('scmMatchOpening NO match Ansi', [2, ' (*- ab']); DoNewLine('', 8, 2, 3, 3, [2, ' (*- a', ' b']); // 2:" (*+ a|b" // scmMatchWholeLine; ConfigBeautifier(sctAnsi, [sciAddTokenLen, sciAddPastTokenIndent], 0, '', sccPrefixMatch, scmMatchWholeLine, sclMatchPrev, sbitSpace, '^ \(\*\+', '+'); DoSetText('scmMatchWholeLine; match Ansi', [2, ' (*+ ab']); DoNewLine('', 8, 2, 7, 3, [2, ' (*+ a', ' + b']); // 2:" (*+ a|b" DoSetText('scmMatchWholeLine; NO match Ansi', [2, ' (*- ab']); DoNewLine('', 8, 2, 3, 3, [2, ' (*- a', ' b']); // 2:" (*+ a|b" // scmMatchAtAsterisk; ConfigBeautifier(sctAnsi, [sciAddTokenLen, sciAddPastTokenIndent], 0, '', sccPrefixMatch, scmMatchAtAsterisk, sclMatchPrev, sbitSpace, '^\*\+', '*+'); DoSetText('scmMatchAtAsterisk; match Ansi', [2, ' (*+ ab']); DoNewLine('', 8, 2, 7, 3, [2, ' (*+ a', ' *+ b']); // 2:" (*+ a|b" DoSetText('scmMatchAtAsterisk; NO match Ansi', [2, ' (*- ab']); DoNewLine('', 8, 2, 3, 3, [2, ' (*- a', ' b']); // 2:" (*+ a|b" {%endregion Ansi ( * } {%region Slash // } ConfigBeautifier(sctSlash, [sciAddTokenLen, sciAddPastTokenIndent], 0, '', sccPrefixMatch, scmMatchAfterOpening, sclMatchPrev, sbitSpace, '^ ?\*', '*', sceMatching); DoSetText('Slash No match', [2, ' // abc']); DoNewLine('', 7, 2, 3, 3, [2, ' // a', ' bc']); // 2:" // a|bc" DoSetText('Slash ', [2, ' // * abc']); DoNewLine('', 9, 2, 8, 3, [2, ' // * a', ' // * bc']); // 2:" // * a|bc" ConfigBeautifier(sctSlash, [sciAddTokenLen, sciAddPastTokenIndent], 0, '', sccPrefixMatch, scmMatchAfterOpening, sclMatchPrev, sbitSpace, '^ ?\*', '*', sceSplitLine); DoSetText('Slash No match, EOL', [2, ' // abc']); DoNewLine('', 9, 2, 3, 3, [2, ' // abc', ' ']); // 2:" // abc|" DoSetText('Slash No match, past EOL', [2, ' // abc']); DoNewLine('', 10, 2, 3, 3, [2, ' // abc', ' ']); // 2:" // abc |" DoSetText('Slash No match, split', [2, ' // abc']); DoNewLine('', 7, 2, 6, 3, [2, ' // a', ' // bc']); // 2:" // a|bc" // aligOpen (single and multiline) ConfigBeautifier(sctSlash, [sciAlignOpen, sciAddTokenLen, sciAddPastTokenIndent], 0, '', sccPrefixAlways, scmMatchAfterOpening, sclMatchPrev, sbitSpace, '^.?', '', sceAlways); DoSetText('Slash sciAlignOpen', [2, ' ;;; // abc']); DoNewLine('first', 11, 2, 10, 3, [2, ' ;;; // a', ' // bc']); // 2:" // a|bc" DoNewLine('any', 11, 3, 10, 4, [3, ' // b', ' // c']); // 2:" // b|c" //DoSetText('Slash sciAlignOpen realign', [2, ' ;;; // abc', ' // de']); //DoNewLine('2nd', 9, 3, 10, 4, [3, ' // d', ' // e']); // 3:" // d|e" // //DoSetText('Slash sciAlignOpen realign', [2, ' ;;; // abc', ' //', ' // de']); //DoNewLine('3rd', 9, 4, 10, 5, [4, ' // d', ' // e']); // 3:" // d|e" {%endregion Slash // } finally SynEdit.Beautifier := nil; FreeAndNil(Beautifier); end; // TODO: extra/smart indent only allowed, if MATCHED end; initialization RegisterTest(TTestSynBeautifier); end.
50.087002
192
0.461021
f1c97ae2fc508004df278b462c82feac4be0529a
5,273
pas
Pascal
vm/nga-pascal/bridge.pas
crcx/retroforth
1486cd9e970feef5edb08fdee58046cb64397e9a
[ "ISC" ]
65
2016-11-05T09:10:06.000Z
2022-03-05T17:01:51.000Z
vm/nga-pascal/bridge.pas
crcx/retroforth
1486cd9e970feef5edb08fdee58046cb64397e9a
[ "ISC" ]
null
null
null
vm/nga-pascal/bridge.pas
crcx/retroforth
1486cd9e970feef5edb08fdee58046cb64397e9a
[ "ISC" ]
10
2020-12-03T00:02:46.000Z
2021-11-11T18:57:09.000Z
// ******************************************************** // Copyright (c) 2016 Rob Judd <judd@ob-wan.com> // Based on C version by Charles Childers et al // ISC License - see included file LICENSE // ******************************************************** unit bridge; {$mode objfpc}{$H+} {$macro on} interface {$include 'nga.inc'} const D_OFFSET_LINK = 0; D_OFFSET_XT = 1; D_OFFSET_CLASS = 2; D_OFFSET_NAME = 4; TIB = 1471; var Dictionary, Heap, Compiler, notfound : Cell; string_data : array[0..8191] of Char; function stack_pop() : Cell; procedure stack_push(value : Cell); procedure string_inject(str : PChar; buffer : Integer); function string_extract(at : Cell) : PChar; function d_link(dt : Cell) : Integer; function d_xt(dt : Cell) : Integer; function d_class(dt : Cell) : Integer; function d_name(dt : Cell) : Integer; function d_count_entries(Dictionary : Cell) : Cell; function d_lookup(Dictionary : cell; name : PChar) : Cell; function d_xt_for(Name : PChar; Dictionary : Cell) : Cell; function d_class_for(Name : PChar; Dictionary : Cell) : Cell; procedure execute(cel : Cell); procedure update_rx(); procedure evaluate(s: PChar); procedure read_token(var fil : File; token_buffer : PChar); overload; procedure read_token(token_buffer : PChar); overload; implementation uses SysUtils, nga in 'nga.pas'; function stack_pop() : Cell; begin dec(sp); result := data[sp + 1]; end; procedure stack_push(value : Cell); begin inc(sp); data[sp] := value; end; procedure string_inject(str : PChar; buffer : Integer); var i : Integer = 0; m : Integer; begin m := strlen(str); while m > 0 do begin memory[buffer + i] := Cell(str[i]); memory[buffer + i + 1] := 0; dec(m); inc(i); end; end; function string_extract(at : Cell) : PChar; var i : Cell = 0; starting : Cell; begin starting := at; while (memory[starting] <> 0) and (i < 8192) do begin string_data[i] := Char(memory[starting]); inc(i); inc(starting); end; string_data[i] := #0; result := string_data; end; function d_link(dt : Cell) : Integer; begin result := dt + D_OFFSET_LINK; end; function d_xt(dt : Cell) : Integer; begin result := dt + D_OFFSET_XT; end; function d_class(dt : Cell) : Integer; begin result := dt + D_OFFSET_CLASS; end; function d_name(dt : Cell) : Integer; begin result := dt + D_OFFSET_NAME; end; function d_count_entries(Dictionary : Cell) : Cell; var count : Cell = 0; i : Cell; begin i := Dictionary; while memory[i] <> 0 do begin inc(count); i := memory[i]; end; result := count; end; function d_lookup(Dictionary : cell; name : PChar) : Cell; var dt : Cell = 0; i : Cell; dname : PChar; begin i := Dictionary; while (memory[i] <> 0) and (i <> 0) do begin dname := string_extract(d_name(i)); if strcomp(dname, name) = 0 then begin dt := i; i := 0; end else i := memory[i]; end; result := dt; end; function d_xt_for(Name : PChar; Dictionary : Cell) : Cell; begin result := memory[d_xt(d_lookup(Dictionary, Name))]; end; function d_class_for(Name : PChar; Dictionary : Cell) : Cell; begin result := memory[d_class(d_lookup(Dictionary, Name))]; end; procedure execute(cel : Cell); var opcode, i : Cell; begin ap := 1; ip := cel; while ip < IMAGE_SIZE - 1 do begin if ip = notfound then writeln(format('%s ?', [string_extract(TIB)])); opcode := memory[ip]; if ngaValidatePackedOpcodes(opcode) <> 0 then ngaProcessPackedOpcodes(opcode) else if (opcode >= 0) and (opcode < 27) then ngaProcessOpcode(opcode) else case opcode of 1000: begin write(Char(data[sp])); dec(sp); end; 1001: begin read(i); stack_push(i); end; else begin writeln('Invalid instruction!'); writeln(format(' at %d, opcode %d', [ip, opcode])); halt(); end; end; inc(ip); if ap = 0 then ip := IMAGE_SIZE - 1; end; end; procedure update_rx(); begin Dictionary := memory[2]; Heap := memory[3]; Compiler := d_xt_for('Compiler', Dictionary); notfound := d_xt_for('err:notfound', Dictionary); end; procedure evaluate(s: PChar); var interpret : Cell; begin if strlen(s) = 0 then exit(); update_rx(); interpret := d_xt_for('interpret', Dictionary); string_inject(s, TIB); stack_push(TIB); execute(interpret); end; // Read from file, assumed to be open already procedure read_token(var fil : File; token_buffer : PChar); overload; var count : Integer = 0; f : File of Char; ch : Char; begin f := fil; repeat begin read(f, ch); token_buffer[count] := ch; inc(count); end; until (ch = #13) or (ch = #10) or (ch = ' ') or eof(f); token_buffer[count - 1] := #0; end; // Read from stdin procedure read_token(token_buffer : PChar); overload; var count : Integer = 0; ch : Char; begin repeat begin read(ch); if (ch = #8) and (count <> 0) then dec(count) else begin token_buffer[count] := ch; inc(count); end; end; until (ch = #13) or (ch = #10) or (ch = ' ') or eof; token_buffer[count - 1] := #0; end; end.
20.437984
69
0.607434
f15610f7d8b7c6c3cd36e2fb430b52f302ffbff0
15,152
pas
Pascal
package/indy-10.2.0.3/fpc/IdUserAccounts.pas
RonaldoSurdi/Sistema-gerenciamento-websites-delphi
8cc7eec2d05312dc41f514bbd5f828f9be9c579e
[ "MIT" ]
1
2022-02-28T11:28:18.000Z
2022-02-28T11:28:18.000Z
package/indy-10.2.0.3/fpc/IdUserAccounts.pas
RonaldoSurdi/Sistema-gerenciamento-websites-delphi
8cc7eec2d05312dc41f514bbd5f828f9be9c579e
[ "MIT" ]
null
null
null
package/indy-10.2.0.3/fpc/IdUserAccounts.pas
RonaldoSurdi/Sistema-gerenciamento-websites-delphi
8cc7eec2d05312dc41f514bbd5f828f9be9c579e
[ "MIT" ]
null
null
null
{ $Project$ $Workfile$ $Revision$ $DateUTC$ $Id$ This file is part of the Indy (Internet Direct) project, and is offered under the dual-licensing agreement described on the Indy website. (http://www.indyproject.org/) Copyright: (c) 1993-2005, Chad Z. Hower and the Indy Pit Crew. All rights reserved. } { $Log$ } { Rev 1.5 10/26/2004 10:51:40 PM JPMugaas Updated ref. Rev 1.4 7/6/2004 4:53:46 PM DSiders Corrected spelling of Challenge in properties, methods, types. Rev 1.3 2004.02.03 5:44:40 PM czhower Name changes Rev 1.2 2004.01.22 2:05:16 PM czhower TextIsSame Rev 1.1 1/21/2004 4:21:08 PM JPMugaas InitComponent Rev 1.0 11/13/2002 08:04:16 AM JPMugaas } unit IdUserAccounts; { Original Author: Sergio Perry Date: 24/04/2001 2002-05-03 - Andrew P.Rybin - TIdCustomUserManager,TIdSimpleUserManager,UserId - universal TIdUserManagerAuthenticationEvent> Sender: TObject } interface {$i IdCompilerDefines.inc} uses Classes, IdException, IdGlobal, IdBaseComponent, IdComponent, IdStrings; type TIdUserHandle = Cardinal;//ptr,object,collection.item.id or THandle TIdUserAccess = Integer; //<0-denied, >=0-accept; ex: 0-guest,1-user,2-power user,3-admin var IdUserHandleNone: TIdUserHandle = High(Cardinal)-1; //Special handle: empty handle IdUserHandleBroadcast: TIdUserHandle = High(Cardinal); //Special handle IdUserAccessDenied: TIdUserAccess = Low(Integer); //Special access type TIdCustomUserManagerOption = (umoCaseSensitiveUsername, umoCaseSensitivePassword); TIdCustomUserManagerOptions = set of TIdCustomUserManagerOption; TIdUserManagerAuthenticationEvent = procedure(Sender: TObject; {TIdCustomUserManager, TIdPeerThread, etc} const AUsername: String; var VPassword: String; var VUserHandle: TIdUserHandle; var VUserAccess: TIdUserAccess) of object; TIdUserManagerLogoffEvent = procedure(Sender: TObject; var VUserHandle: TIdUserHandle) of object; TIdCustomUserManager = class(TIdBaseComponent) protected FDomain: String; FOnAfterAuthentication: TIdUserManagerAuthenticationEvent; //3 FOnBeforeAuthentication: TIdUserManagerAuthenticationEvent;//1 FOnLogoffUser: TIdUserManagerLogoffEvent;//4 // procedure DoBeforeAuthentication(const AUsername: String; var VPassword: String; var VUserHandle: TIdUserHandle; var VUserAccess: TIdUserAccess); virtual; // Descendants must override this method: procedure DoAuthentication (const AUsername: String; var VPassword: String; var VUserHandle: TIdUserHandle; var VUserAccess: TIdUserAccess); virtual; abstract; procedure DoAfterAuthentication (const AUsername: String; var VPassword: String; var VUserHandle: TIdUserHandle; var VUserAccess: TIdUserAccess); virtual; procedure DoLogoffUser(var VUserHandle: TIdUserHandle); virtual; function GetOptions: TIdCustomUserManagerOptions; virtual; procedure SetDomain(const AValue: String); virtual; procedure SetOptions(const AValue: TIdCustomUserManagerOptions); virtual; // props property Domain: String read FDomain write SetDomain; property Options: TIdCustomUserManagerOptions read GetOptions write SetOptions; // events property OnBeforeAuthentication: TIdUserManagerAuthenticationEvent read FOnBeforeAuthentication write FOnBeforeAuthentication; property OnAfterAuthentication: TIdUserManagerAuthenticationEvent read FOnAfterAuthentication write FOnAfterAuthentication; property OnLogoffUser: TIdUserManagerLogoffEvent read FOnLogoffUser write FOnLogoffUser; public //Challenge user is a nice backdoor for some things we will do in a descendent class function ChallengeUser(var VIsSafe : Boolean; const AUserName : String) : String; virtual; function AuthenticateUser(const AUsername, APassword: String): Boolean; overload; function AuthenticateUser(const AUsername, APassword: String; var VUserHandle: TIdUserHandle): TIdUserAccess; overload; class function IsRegisteredUser(AUserAccess: TIdUserAccess): Boolean; procedure LogoffUser(AUserHandle: TIdUserHandle); virtual; procedure UserDisconnected(const AUser : String); virtual; End;//TIdCustomUserManager //============================================================================= // * TIdSimpleUserManager * //============================================================================= TIdSimpleUserManager = class(TIdCustomUserManager) protected FOptions: TIdCustomUserManagerOptions; FOnAuthentication: TIdUserManagerAuthenticationEvent; // procedure DoAuthentication (const AUsername: String; var VPassword: String; var VUserHandle: TIdUserHandle; var VUserAccess: TIdUserAccess); override; function GetOptions: TIdCustomUserManagerOptions; override; procedure SetOptions(const AValue: TIdCustomUserManagerOptions); override; published property Domain; property Options; // events property OnBeforeAuthentication; property OnAuthentication: TIdUserManagerAuthenticationEvent read FOnAuthentication write FOnAuthentication; property OnAfterAuthentication; property OnLogoffUser; End;//TIdSimpleUserManager //============================================================================= // * TIdUserManager * //============================================================================= const IdUserAccountDefaultAccess = 0;//guest type TIdUserManager = class; TIdUserAccount = class(TCollectionItem) protected FAttributes: TStrings; FData: TObject; FUserName: string; FPassword: string; FRealName: string; FAccess: TIdUserAccess; // procedure SetAttributes(const AValue: TStrings); procedure SetPassword(const AValue: String); virtual; public constructor Create(ACollection: TCollection); override; destructor Destroy; override; // function CheckPassword(const APassword: String): Boolean; virtual; // property Data: TObject read FData write FData; published property Access: TIdUserAccess read FAccess write FAccess default IdUserAccountDefaultAccess; property Attributes: TStrings read FAttributes write SetAttributes; property UserName: string read FUserName write FUserName; property Password: string read FPassword write SetPassword; property RealName: string read FRealName write FRealName; End;//TIdUserAccount TIdUserAccounts = class(TOwnedCollection) protected FCaseSensitiveUsernames: Boolean; FCaseSensitivePasswords: Boolean; // function GetAccount(const AIndex: Integer): TIdUserAccount; function GetByUsername(const AUsername: String): TIdUserAccount; procedure SetAccount(const AIndex: Integer; AAccountValue: TIdUserAccount); public function Add: TIdUserAccount; reintroduce; constructor Create(AOwner: TIdUserManager); // property CaseSensitiveUsernames: Boolean read FCaseSensitiveUsernames write FCaseSensitiveUsernames; property CaseSensitivePasswords: Boolean read FCaseSensitivePasswords write FCaseSensitivePasswords; property UserNames[const AUserName: String]: TIdUserAccount read GetByUsername; default; property Items[const AIndex: Integer]: TIdUserAccount read GetAccount write SetAccount; end;//TIdUserAccounts TIdUserManager = class(TIdCustomUserManager) protected FAccounts: TIdUserAccounts; // procedure DoAuthentication (const AUsername: String; var VPassword: String; var VUserHandle: TIdUserHandle; var VUserAccess: TIdUserAccess); override; function GetOptions: TIdCustomUserManagerOptions; override; procedure SetAccounts(AValue: TIdUserAccounts); procedure SetOptions(const AValue: TIdCustomUserManagerOptions); override; procedure InitComponent; override; public destructor Destroy; override; published property Accounts: TIdUserAccounts read FAccounts write SetAccounts; property Options; // events property OnBeforeAuthentication; property OnAfterAuthentication; End;//TIdUserManager implementation uses SysUtils; { How add UserAccounts to your component: 1) property UserAccounts: TIdCustomUserManager read FUserAccounts write SetUserAccounts; 2) procedure SetUserAccounts(const AValue: TIdCustomUserManager); begin FUserAccounts := AValue; if Assigned(FUserAccounts) then begin FUserAccounts.FreeNotification(Self); end; end; 3) procedure Notification(AComponent: TComponent; Operation: TOperation); begin inherited Notification(AComponent, Operation); ... if (Operation = opRemove) and (AComponent = FUserAccounts) then begin FUserAccounts := NIL; end; end; 4) ... if Assigned(FUserAccounts) then begin FAuthenticated := FUserAccounts.AuthenticateUser(FUsername, ASender.UnparsedParams); if FAuthenticated then else } { TIdCustomUserManager } function TIdCustomUserManager.AuthenticateUser(const AUsername, APassword: String): Boolean; var LUserHandle: TIdUserHandle; Begin Result := IsRegisteredUser(AuthenticateUser(AUsername, APassword, LUserHandle)); LogoffUser(LUserHandle); End;//AuthenticateUser function TIdCustomUserManager.AuthenticateUser(const AUsername, APassword: String; var VUserHandle: TIdUserHandle): TIdUserAccess; var LPassword: String; Begin LPassword := APassword; VUserHandle := IdUserHandleNone; Result := IdUserAccessDenied; DoBeforeAuthentication(AUsername, LPassword, VUserHandle, Result); DoAuthentication(AUsername, LPassword, VUserHandle, Result); DoAfterAuthentication(AUsername, LPassword, VUserHandle, Result); End;// class function TIdCustomUserManager.IsRegisteredUser(AUserAccess: TIdUserAccess): Boolean; Begin Result := AUserAccess>=0; End; procedure TIdCustomUserManager.DoBeforeAuthentication(const AUsername: String; var VPassword: String; var VUserHandle: TIdUserHandle; var VUserAccess: TIdUserAccess); Begin if Assigned(FOnBeforeAuthentication) then begin FOnBeforeAuthentication(SELF,AUsername,VPassword,VUserHandle,VUserAccess); end; End;// procedure TIdCustomUserManager.DoAfterAuthentication(const AUsername: String; var VPassword: String; var VUserHandle: TIdUserHandle; var VUserAccess: TIdUserAccess); Begin if Assigned(FOnAfterAuthentication) then begin FOnAfterAuthentication(SELF,AUsername,VPassword,VUserHandle,VUserAccess); end; End;// function TIdCustomUserManager.GetOptions: TIdCustomUserManagerOptions; Begin Result := []; End;// procedure TIdCustomUserManager.SetOptions(const AValue: TIdCustomUserManagerOptions); Begin End; procedure TIdCustomUserManager.SetDomain(const AValue: String); begin if FDomain<>AValue then begin FDomain := AValue; end; end; procedure TIdCustomUserManager.LogoffUser(AUserHandle: TIdUserHandle); Begin DoLogoffUser(AUserHandle); End;//free resources, unallocate handles, etc... //============================================================================= procedure TIdCustomUserManager.DoLogoffUser(var VUserHandle: TIdUserHandle); Begin if Assigned(FOnLogoffUser) then begin FOnLogoffUser(SELF, VUserHandle); end; End;// function TIdCustomUserManager.ChallengeUser(var VIsSafe : Boolean; const AUserName: String): String; begin VIsSafe := True; Result := ''; end; procedure TIdCustomUserManager.UserDisconnected(const AUser: String); begin end; { TIdUserAccount } function TIdUserAccount.CheckPassword(const APassword: String): Boolean; begin if (Collection as TIdUserAccounts).CaseSensitivePasswords then begin Result := Password = APassword; end else begin Result := TextIsSame(Password, APassword); end; end; constructor TIdUserAccount.Create(ACollection: TCollection); begin inherited Create(ACollection); FAttributes := TStringList.Create; FAccess := IdUserAccountDefaultAccess; end; destructor TIdUserAccount.Destroy; begin FreeAndNil(FAttributes); inherited Destroy; end; procedure TIdUserAccount.SetAttributes(const AValue: TStrings); begin FAttributes.Assign(AValue); end; procedure TIdUserAccount.SetPassword(const AValue: String); begin FPassword := AValue; end; { TIdUserAccounts } constructor TIdUserAccounts.Create(AOwner: TIdUserManager); begin inherited Create(AOwner, TIdUserAccount); end; function TIdUserAccounts.GetAccount(const AIndex: Integer): TIdUserAccount; begin Result := TIdUserAccount(inherited Items[AIndex]); end; function TIdUserAccounts.GetByUsername(const AUsername: String): TIdUserAccount; var i: Integer; begin Result := nil; if CaseSensitiveUsernames then begin for i := 0 to Count - 1 do begin if AUsername = Items[i].UserName then begin Result := Items[i]; Break; end; end; end else begin for i := 0 to Count - 1 do begin if TextIsSame(AUsername, Items[i].UserName) then begin Result := Items[i]; Break; end; end; end; end; procedure TIdUserAccounts.SetAccount(const AIndex: Integer; AAccountValue: TIdUserAccount); begin inherited SetItem(AIndex, AAccountValue); end; function TIdUserAccounts.Add: TIdUserAccount; begin Result := inherited Add as TIdUserAccount; end; { IdUserAccounts - Main Component } procedure TIdUserManager.InitComponent; begin inherited; FAccounts := TIdUserAccounts.Create(Self); end; destructor TIdUserManager.Destroy; begin FreeAndNil(FAccounts); inherited Destroy; end; procedure TIdUserManager.DoAuthentication(const AUsername: String; var VPassword: String; var VUserHandle: TIdUserHandle; var VUserAccess: TIdUserAccess); var LUser: TIdUserAccount; begin VUserHandle := IdUserHandleNone; VUserAccess := IdUserAccessDenied; LUser := Accounts[AUsername]; if Assigned(LUser) then begin if LUser.CheckPassword(VPassword) then begin VUserHandle := LUser.ID; VUserAccess := LUser.Access; end; end; end; procedure TIdUserManager.SetAccounts(AValue: TIdUserAccounts); begin FAccounts.Assign(AValue); end; function TIdUserManager.GetOptions: TIdCustomUserManagerOptions; Begin Result := []; if FAccounts.CaseSensitiveUsernames then begin Include(Result, umoCaseSensitiveUsername); end; if FAccounts.CaseSensitivePasswords then begin Include(Result, umoCaseSensitivePassword); end; End;// procedure TIdUserManager.SetOptions(const AValue: TIdCustomUserManagerOptions); Begin FAccounts.CaseSensitiveUsernames := umoCaseSensitiveUsername in AValue; FAccounts.CaseSensitivePasswords := umoCaseSensitivePassword in AValue; End;// { TIdSimpleUserManager } procedure TIdSimpleUserManager.DoAuthentication(const AUsername: String; var VPassword: String; var VUserHandle: TIdUserHandle; var VUserAccess: TIdUserAccess); Begin if Assigned(FOnAuthentication) then begin FOnAuthentication(SELF,AUsername,VPassword,VUserHandle,VUserAccess); end; End;// function TIdSimpleUserManager.GetOptions: TIdCustomUserManagerOptions; Begin Result := FOptions; End;// procedure TIdSimpleUserManager.SetOptions( const AValue: TIdCustomUserManagerOptions); Begin FOptions := AValue; End;// end.
31.765199
130
0.751188
f145ecf3d581a7dca88680cbfb04c7ba96c6fd51
10,321
dfm
Pascal
frmApkInstaller.dfm
crocer211/W1nDro1d
614d7dde33c58f5c6906f3783e6c31a4a7117fd8
[ "MIT" ]
null
null
null
frmApkInstaller.dfm
crocer211/W1nDro1d
614d7dde33c58f5c6906f3783e6c31a4a7117fd8
[ "MIT" ]
null
null
null
frmApkInstaller.dfm
crocer211/W1nDro1d
614d7dde33c58f5c6906f3783e6c31a4a7117fd8
[ "MIT" ]
null
null
null
object frmInstaller: TfrmInstaller Left = 0 Top = 0 Caption = 'APK Installer' ClientHeight = 445 ClientWidth = 636 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clHighlight Font.Height = -11 Font.Name = 'Segoe UI Variable Display' Font.Style = [] Font.Quality = fqClearTypeNatural FormStyle = fsStayOnTop OldCreateOrder = False Position = poOwnerFormCenter StyleElements = [seFont, seClient] StyleName = 'Windows' OnClick = FormClick OnCreate = FormCreate OnDestroy = FormDestroy DesignSize = ( 636 445) PixelsPerInch = 96 TextHeight = 14 object lbAPKDisplayName: TLabel Left = 24 Top = 44 Width = 481 Height = 72 Anchors = [akLeft, akTop, akRight] AutoSize = False Caption = 'APK Display Name' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -27 Font.Name = 'Segoe UI Variable Display Semib' Font.Style = [fsBold] Font.Quality = fqClearTypeNatural ParentFont = False end object lbPublisher: TLabel Left = 24 Top = 144 Width = 58 Height = 16 Caption = 'Publisher:' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'Segoe UI Variable Display' Font.Style = [] Font.Quality = fqClearTypeNatural ParentFont = False end object lbVersion: TLabel Left = 24 Top = 166 Width = 47 Height = 16 Caption = 'Version:' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'Segoe UI Variable Display' Font.Style = [] Font.Quality = fqClearTypeNatural ParentFont = False end object lbCertificate: TLabel Left = 24 Top = 122 Width = 41 Height = 16 Caption = 'Signer:' Font.Charset = DEFAULT_CHARSET Font.Color = clHighlight Font.Height = -13 Font.Name = 'Segoe UI Variable Display' Font.Style = [] Font.Quality = fqClearTypeNatural ParentFont = False OnClick = lbCertificateClick end object lbCapabilities: TLabel Left = 24 Top = 204 Width = 67 Height = 16 Caption = 'Capabilities' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'Segoe UI Variable Display' Font.Style = [] Font.Quality = fqClearTypeNatural ParentFont = False end object eApkImage: TEsImage Left = 520 Top = 49 Width = 90 Height = 90 Stretch = Fill end object btnLaunch: TButton Left = 497 Top = 360 Width = 113 Height = 30 Anchors = [akRight, akBottom] Caption = 'Launch' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'Segoe UI Variable Display' Font.Style = [] Font.Quality = fqClearTypeNatural ParentFont = False TabOrder = 1 end object apkInstallerMemo: TMemo Left = 24 Top = 226 Width = 409 Height = 143 BevelInner = bvNone BevelOuter = bvNone BorderStyle = bsNone Ctl3D = True Font.Charset = DEFAULT_CHARSET Font.Color = clGray Font.Height = -13 Font.Name = 'Segoe UI Variable Display' Font.Style = [] Font.Quality = fqClearTypeNatural Lines.Strings = ( 'Memo1') ParentColor = True ParentCtl3D = False ParentFont = False ReadOnly = True TabOrder = 2 WordWrap = False end object pnlAbout: TPanel Left = 8 Top = 248 Width = 273 Height = 153 Anchors = [akLeft, akBottom] BevelOuter = bvNone TabOrder = 3 Visible = False object lbAbout: TLabel Left = 16 Top = 16 Width = 41 Height = 18 Caption = 'About' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -16 Font.Name = 'Segoe UI Variable Display' Font.Style = [] Font.Quality = fqClearTypeNatural ParentFont = False end object lbInsVersion: TLabel Left = 16 Top = 39 Width = 143 Height = 16 Caption = 'APK Installer 1.0.211028' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'Segoe UI Variable Display' Font.Style = [] Font.Quality = fqClearTypeNatural ParentFont = False end object Label1: TLabel Left = 16 Top = 62 Width = 214 Height = 16 Caption = #169' 2021 Codigobit. All rights reserved.' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'Segoe UI Variable Display' Font.Style = [] Font.Quality = fqClearTypeNatural ParentFont = False end object Shape1: TShape Left = 0 Top = 0 Width = 273 Height = 153 Align = alClient Pen.Color = clMedGray Pen.Mode = pmMask Shape = stRoundRect ExplicitLeft = 208 ExplicitTop = 88 ExplicitWidth = 65 ExplicitHeight = 65 end object lnkWebSite: TLinkLabel Left = 20 Top = 85 Width = 63 Height = 20 Cursor = crHandPoint Caption = '<a href="https://codigobit.net">Codigobit</a>' Font.Charset = DEFAULT_CHARSET Font.Color = clHighlight Font.Height = -13 Font.Name = 'Segoe UI Variable Display' Font.Style = [] Font.Quality = fqClearTypeNatural ParentFont = False TabOrder = 0 OnLinkClick = lnkWebSiteLinkClick end object lnkRepository: TLinkLabel Left = 20 Top = 112 Width = 114 Height = 20 Cursor = crHandPoint Caption = '<a href="https://github.com/vhanla/W1nDro1d">GitHub Repository</' + 'a>' Font.Charset = DEFAULT_CHARSET Font.Color = clHighlight Font.Height = -13 Font.Name = 'Segoe UI Variable Display' Font.Style = [] Font.Quality = fqClearTypeNatural ParentFont = False TabOrder = 1 OnLinkClick = lnkRepositoryLinkClick end end object pnlCaption: TPanel Left = 0 Top = 0 Width = 636 Height = 30 Align = alTop BevelOuter = bvNone ShowCaption = False TabOrder = 4 OnMouseDown = pnlCaptionMouseDown object UWPQuickButton3: TUWPQuickButton Left = 546 Top = 0 Height = 30 CustomBackColor.Enabled = False CustomBackColor.Color = clBlack CustomBackColor.LightColor = 13619151 CustomBackColor.DarkColor = 3947580 ButtonStyle = qbsMax Caption = #57347 Align = alRight Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'Segoe MDL2 Assets' Font.Style = [] ParentFont = False ExplicitLeft = 296 ExplicitHeight = 32 end object UWPQuickButton2: TUWPQuickButton Left = 501 Top = 0 Height = 30 CustomBackColor.Enabled = False CustomBackColor.Color = clBlack CustomBackColor.LightColor = 13619151 CustomBackColor.DarkColor = 3947580 ButtonStyle = qbsMin Caption = #57608 Align = alRight Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'Segoe MDL2 Assets' Font.Style = [] ParentColor = False ParentFont = False ExplicitLeft = 296 ExplicitHeight = 32 end object UWPQuickButton1: TUWPQuickButton Left = 591 Top = 0 Height = 30 CustomBackColor.Enabled = False CustomBackColor.Color = clBlack CustomBackColor.LightColor = 13619151 CustomBackColor.DarkColor = 3947580 ButtonStyle = qbsQuit Caption = #57610 Align = alRight Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'Segoe MDL2 Assets' Font.Style = [] ParentFont = False ExplicitLeft = 296 ExplicitHeight = 32 end end object ActivityIndicator1: TActivityIndicator Left = 304 Top = 168 Anchors = [akLeft, akTop, akRight, akBottom] end object Button1: TButton Left = 8 Top = 407 Width = 33 Height = 30 Anchors = [akLeft, akBottom] Caption = '?' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'Segoe UI Variable Display' Font.Style = [] Font.Quality = fqClearTypeNatural ParentFont = False TabOrder = 6 OnClick = Button1Click end object SynEdit1: TSynEdit Left = 86 Top = 122 Width = 512 Height = 223 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'Consolas' Font.Style = [] Font.Quality = fqClearTypeNatural TabOrder = 7 Visible = False UseCodeFolding = False Gutter.Font.Charset = DEFAULT_CHARSET Gutter.Font.Color = clWindowText Gutter.Font.Height = -11 Gutter.Font.Name = 'Consolas' Gutter.Font.Style = [] Highlighter = SynUNIXShellScriptSyn1 Lines.Strings = ( 'SynEdit1') end object btnReUnInstall: TButton Left = 378 Top = 360 Width = 113 Height = 29 Anchors = [akRight, akBottom] Caption = 'Install' ElevationRequired = True Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'Segoe UI Variable Display' Font.Style = [] Font.Quality = fqClearTypeNatural ParentFont = False TabOrder = 0 end object btnLog: TButton Left = 47 Top = 407 Width = 33 Height = 30 Caption = 'Log' TabOrder = 8 OnClick = btnLogClick end object DCAapt: TDosCommand InputToOutput = False MaxTimeAfterBeginning = 0 MaxTimeAfterLastOutput = 0 OnExecuteError = DCAaptExecuteError OnNewLine = DCAaptNewLine OnTerminated = DCAaptTerminated OnTerminateProcess = DCAaptTerminateProcess Left = 440 Top = 56 end object SynUNIXShellScriptSyn1: TSynUNIXShellScriptSyn Options.AutoDetectEnabled = False Options.AutoDetectLineLimit = 0 Options.Visible = False Left = 272 Top = 152 end object DCPKCS7: TDosCommand InputToOutput = False MaxTimeAfterBeginning = 0 MaxTimeAfterLastOutput = 0 Left = 368 Top = 48 end end
24.632458
76
0.629978
4703c3ac41aa7928840db4ed65ab3009096be801
139
pas
Pascal
toolchain/pascompl/test/reject/iso7185prt0145.pas
besm6/mesm6
308b524c78a65e5aaba15b5b9e37f3fd83fc2c53
[ "MIT" ]
37
2019-03-12T17:19:46.000Z
2022-02-04T00:25:55.000Z
toolchain/pascompl/test/reject/iso7185prt0145.pas
besm6/mesm6
308b524c78a65e5aaba15b5b9e37f3fd83fc2c53
[ "MIT" ]
13
2019-03-05T06:10:14.000Z
2020-11-30T09:30:52.000Z
toolchain/pascompl/test/reject/iso7185prt0145.pas
besm6/mesm6
308b524c78a65e5aaba15b5b9e37f3fd83fc2c53
[ "MIT" ]
4
2019-03-23T15:51:56.000Z
2020-07-28T22:34:42.000Z
{ PRT test 145: Missing "do" on for statement } program iso7185prt0145; var i, a, b: integer; begin for i := 1 to 10 a := b end.
8.6875
43
0.618705
f1b01907e533bbe5a44ad19206376ab5017b2b20
6,560
pas
Pascal
Source/Core/AWS.Internal.RuntimePipeline.pas
herux/aws-sdk-delphi
4ef36e5bfc536b1d9426f78095d8fda887f390b5
[ "Apache-2.0" ]
67
2021-07-28T23:47:09.000Z
2022-03-15T11:48:35.000Z
Source/Core/AWS.Internal.RuntimePipeline.pas
gabrielbaltazar/aws-sdk-delphi
ea1713b227a49cbbc5a2e1bf04cbf2de1f9b611a
[ "Apache-2.0" ]
5
2021-09-01T09:31:16.000Z
2022-03-16T18:19:21.000Z
Source/Core/AWS.Internal.RuntimePipeline.pas
gabrielbaltazar/aws-sdk-delphi
ea1713b227a49cbbc5a2e1bf04cbf2de1f9b611a
[ "Apache-2.0" ]
13
2021-07-29T02:41:16.000Z
2022-03-16T10:22:38.000Z
unit AWS.Internal.RuntimePipeline; interface uses System.SysUtils, Bcl.Logging, AWS.Runtime.Contexts, AWS.Internal.PipelineHandler; type /// <summary> /// A runtime pipeline contains a collection of handlers which represent /// different stages of request and response processing. /// </summary> TRuntimePipeLine = class strict private FLogger: ILogger; FHandler: IPipelineHandler; class function GetInnermostHandler(AHandler: IPipelineHandler): IPipelineHandler; procedure SetHandlerProperties(AHandler: IPipelineHandler); procedure InsertHandler(AHandler, ACurrent: IPipelineHandler); public /// <summary> /// Constructor for RuntimePipeline. /// </summary> /// <param name="AHandler">The handler with which the pipeline is initalized.</param> constructor Create(AHandler: IPipelineHandler = nil; ALogger: ILogger = nil); overload; destructor Destroy; override; /// <summary> /// Constructor for RuntimePipeline. /// </summary> /// <param name="AHandlers">List of handlers with which the pipeline is initalized.</param> constructor Create(const AHandlers: TArray<IPipelineHandler>); overload; /// <summary> /// Retrieves a list of handlers, in the order of their execution. /// </summary> /// <returns>Handlers in the current pipeline.</returns> function Handlers: TArray<IPipelineHandler>; /// <summary> /// Retrieves current handlers, in the order of their execution. /// </summary> /// <returns>Handlers in the current pipeline.</returns> function EnumerateHandlers: TArray<IPipelineHandler>; /// <summary> /// The top-most handler in the pipeline. /// </summary> property Handler: IPipelineHandler read FHandler; /// <summary> /// Invokes the pipeline synchronously. /// </summary> /// <param name="AExecutionContext">Request context</param> /// <returns>Response context</returns> function InvokeSync(AExecutionContext: TExecutionContext): TResponseContext; /// <summary> /// Adds a new handler to the top of the pipeline. /// </summary> /// <param name="AHandler">The handler to be added to the pipeline.</param> procedure AddHandler(AHandler: IPipelineHandler); procedure AddHandlerAfter<T: TPipelineHandler>(AHandler: IPipelineHandler); procedure AddHandlerBefore<T: TPipelineHandler>(AHandler: IPipelineHandler); end; implementation { TRuntimePipeLine } constructor TRuntimePipeLine.Create(AHandler: IPipelineHandler = nil; ALogger: ILogger = nil); begin inherited Create; if FLogger = nil then FLogger := LogManager.GetLogger(TRuntimePipeline) else FLogger := ALogger; if AHandler <> nil then begin FHandler := AHandler; FHandler.Logger := FLogger; end; end; procedure TRuntimePipeLine.AddHandler(AHandler: IPipelineHandler); var InnerMostHandler: IPipelineHandler; begin InnerMostHandler := GetInnermostHandler(AHandler); if FHandler <> nil then begin InnerMostHandler.InnerHandler := FHandler; FHandler.OuterHandler := InnerMostHandler; end; FHandler := AHandler; SetHandlerProperties(AHandler); end; procedure TRuntimePipeLine.AddHandlerAfter<T>(AHandler: IPipelineHandler); var Current: IPipelineHandler; begin if AHandler = nil then raise EArgumentNilException.Create('AHandler'); Current := FHandler; while Current <> nil do begin if (Current as TObject).ClassType = T then begin InsertHandler(AHandler, Current); SetHandlerProperties(AHandler); Exit; end; Current := Current.InnerHandler; end; raise EInvalidOpException.CreateFmt('Cannot find a handler of type %s', [T.ClassName]); end; procedure TRuntimePipeLine.AddHandlerBefore<T>(AHandler: IPipelineHandler); var Current: IPipelineHandler; begin if AHandler = nil then raise EArgumentNilException.Create('AHandler'); if (FHandler as TObject).ClassType = T then begin // Add the handler to the top of the pipeline AddHandler(AHandler); SetHandlerProperties(AHandler); Exit; end; Current := FHandler; while Current <> nil do begin if (Current.InnerHandler <> nil) and ((Current.InnerHandler as TObject).ClassType = T) then begin InsertHandler(AHandler, Current); SetHandlerProperties(AHandler); Exit; end; Current := Current.InnerHandler; end; raise EInvalidOpException.CreateFmt('Cannot find a handler of type %s', [T.ClassName]); end; constructor TRuntimePipeLine.Create(const AHandlers: TArray<IPipelineHandler>); var Handler: IPipelineHandler; begin inherited Create; FLogger := LogManager.GetLogger(TRuntimePipeline); for Handler in AHandlers do AddHandler(Handler); end; destructor TRuntimePipeLine.Destroy; var Current: IPipelineHandler; begin // Clear cyclical interface references to properly destroy the handlers Current := FHandler; while Current <> nil do begin Current.OuterHandler := nil; Current := Current.InnerHandler; end; inherited; end; function TRuntimePipeLine.EnumerateHandlers: TArray<IPipelineHandler>; var LocalHandler: IPipelineHandler; begin SetLength(Result, 0); LocalHandler := Self.Handler; while LocalHandler <> nil do begin SetLength(Result, Length(Result) + 1); Result[Length(Result) - 1] := LocalHandler; LocalHandler := LocalHandler.InnerHandler; end; end; class function TRuntimePipeLine.GetInnermostHandler(AHandler: IPipelineHandler): IPipelineHandler; var Current: IPipelineHandler; begin Current := AHandler; while (Current.InnerHandler <> nil) do Current := Current.InnerHandler; Result := Current; end; function TRuntimePipeLine.Handlers: TArray<IPipelineHandler>; begin Result := EnumerateHandlers; end; procedure TRuntimePipeLine.InsertHandler(AHandler, ACurrent: IPipelineHandler); var Next: IPipelineHandler; InnerMostHandler: IPipelineHandler; begin Next := ACurrent.InnerHandler; ACurrent.InnerHandler := AHandler; AHandler.OuterHandler := ACurrent; if Next <> nil then begin InnerMostHandler := GetInnermostHandler(AHandler); InnerMostHandler.InnerHandler := Next; Next.OuterHandler := InnerMostHandler; end; end; function TRuntimePipeLine.InvokeSync(AExecutionContext: TExecutionContext): TResponseContext; begin FHandler.InvokeSync(AExecutionContext); Result := AExecutionContext.ResponseContext; end; procedure TRuntimePipeLine.SetHandlerProperties(AHandler: IPipelineHandler); begin AHandler.Logger := FLogger; end; end.
27.679325
98
0.731707
f19239871d4178b18b000e26bd99533f3e81fea8
12,008
pas
Pascal
Libraries/DatabaseLib/dwsUIBDatabase.pas
skolkman/dwscript
b9f99d4b8187defac3f3713e2ae0f7b83b63d516
[ "Condor-1.1" ]
12
2015-01-02T08:27:25.000Z
2021-07-16T16:59:01.000Z
Libraries/DatabaseLib/dwsUIBDatabase.pas
skolkman/dwscript
b9f99d4b8187defac3f3713e2ae0f7b83b63d516
[ "Condor-1.1" ]
1
2018-04-02T21:31:37.000Z
2018-04-02T21:31:37.000Z
Libraries/DatabaseLib/dwsUIBDatabase.pas
skolkman/dwscript
b9f99d4b8187defac3f3713e2ae0f7b83b63d516
[ "Condor-1.1" ]
6
2015-01-02T08:27:13.000Z
2020-06-08T07:03:33.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 } { } {**********************************************************************} { This unit wraps Unified InterBase from Henri Gourvest (www.progdigy.com) http://sourceforge.net/projects/uib/ } unit dwsUIBDatabase; interface uses Classes, Variants, SysUtils, uib, uiblib, uibmetadata, dwsUtils, dwsExprs, dwsDatabase, dwsStack, dwsXPlatform, dwsDataContext, dwsSymbols; type TdwsUIBDataBase = class (TdwsDataBase, IdwsDataBase) private FDB : TUIBDataBase; FTransaction : TUIBTransaction; protected property DB : TUIBDataBase read FDB write FDB; property Transaction : TUIBTransaction read FTransaction write FTransaction; public constructor Create(const parameters : array of String); destructor Destroy; override; procedure BeginTransaction; procedure Commit; procedure Rollback; function InTransaction : Boolean; function CanReleaseToPool : String; procedure Exec(const sql : String; const parameters : TData; context : TExprBase); function Query(const sql : String; const parameters : TData; context : TExprBase) : IdwsDataSet; function VersionInfoText : String; end; TdwsUIBDataSet = class (TdwsDataSet) private FDB : TdwsUIBDataBase; FQuery : TUIBQuery; protected procedure DoPrepareFields; override; public constructor Create(db : TdwsUIBDataBase; const sql : String; const parameters : TData); destructor Destroy; override; function Eof : Boolean; override; procedure Next; override; function FieldCount : Integer; override; end; TdwsUIBDataField = class (TdwsDataField) protected function GetName : String; override; function GetDataType : TdwsDataFieldType; override; function GetDeclaredType : String; override; public constructor Create(dataSet : TdwsUIBDataSet; fieldIndex : Integer); function IsNull : Boolean; override; function AsString : String; override; function AsInteger : Int64; override; function AsFloat : Double; override; function AsBoolean : Boolean; override; function AsBlob : RawByteString; override; end; // IdwsBlob = interface // ['{018C9441-3177-49E1-97EF-EA5F2584FA60}'] // end; TdwsUIBDataBaseFactory = class (TdwsDataBaseFactory) public function CreateDataBase(const parameters : TStringDynArray) : IdwsDataBase; override; end; // ------------------------------------------------------------------ // ------------------------------------------------------------------ // ------------------------------------------------------------------ implementation // ------------------------------------------------------------------ // ------------------------------------------------------------------ // ------------------------------------------------------------------ procedure AssignParameters(var rq : TUIBQuery; const params : TData); var i : Integer; p : PVarData; rqParams : TSQLParams; begin rqParams:=rq.Params; for i:=0 to Length(params)-1 do begin p:=PVarData(@params[i]); case p.VType of varInt64 : rqParams.AsInt64[i]:=p.VInt64; varDouble : rqParams.AsDouble[i]:=p.VDouble; varUString : rqParams.AsString[i]:=String(p.VUString); varBoolean : rqParams.AsBoolean[i]:=p.VBoolean; varNull : rqParams.IsNull[i]:=True; else rqParams.AsVariant[i]:=PVariant(p)^; end; end; end; // ------------------ // ------------------ TdwsUIBDataBaseFactory ------------------ // ------------------ // CreateDataBase // function TdwsUIBDataBaseFactory.CreateDataBase(const parameters : TStringDynArray) : IdwsDataBase; var db : TdwsUIBDataBase; begin db:=TdwsUIBDataBase.Create(parameters); Result:=db; end; // ------------------ // ------------------ TdwsUIBDataBase ------------------ // ------------------ // Create // constructor TdwsUIBDataBase.Create(const parameters : array of String); var dbName, userName, pwd : String; begin if FDB=nil then begin if Length(parameters)>0 then dbName:=TdwsDataBase.ApplyPathVariables(parameters[0]); if Length(parameters)>1 then userName:=parameters[1] else userName:='SYSDBA'; if Length(parameters)>2 then pwd:=parameters[2] else pwd:='masterkey'; try FDB:=TUIBDataBase.Create{$ifndef UIB_NO_COMPONENT}(nil){$endif}; FDB.DatabaseName:=dbName; FDB.UserName:=userName; FDB.PassWord:=pwd; FDB.Connected:=True; except RefCount:=0; raise; end; end; if FTransaction=nil then begin FTransaction:=TUIBTransaction.Create{$ifndef UIB_NO_COMPONENT}(nil){$endif}; FTransaction.DataBase:=FDB; end; end; // Destroy // destructor TdwsUIBDataBase.Destroy; begin FTransaction.Free; FDB.Free; inherited; end; // BeginTransaction // procedure TdwsUIBDataBase.BeginTransaction; begin FTransaction.StartTransaction; end; // Commit // procedure TdwsUIBDataBase.Commit; begin FTransaction.Commit; end; // Rollback // procedure TdwsUIBDataBase.Rollback; begin FTransaction.RollBack; end; // InTransaction // function TdwsUIBDataBase.InTransaction : Boolean; begin Result:=FTransaction.InTransaction; end; // CanReleasetoPool // function TdwsUIBDataBase.CanReleasetoPool : String; begin // Note: UIB can't have datasets open outside transactions if InTransaction then Result:='in transaction' else Result:=''; end; // Exec // procedure TdwsUIBDataBase.Exec(const sql : String; const parameters : TData; context : TExprBase); var rq : TUIBQuery; begin rq:=TUIBQuery.Create{$ifndef UIB_NO_COMPONENT}(nil){$endif}; try rq.Transaction:=FTransaction; rq.SQL.Text:=sql; AssignParameters(rq, parameters); rq.Execute; except rq.Close; raise; end; end; // Query // function TdwsUIBDataBase.Query(const sql : String; const parameters : TData; context : TExprBase) : IdwsDataSet; var ds : TdwsUIBDataSet; begin ds:=TdwsUIBDataSet.Create(Self, sql, parameters); Result:=ds; end; // VersionInfoText // function TdwsUIBDataBase.VersionInfoText : String; begin Result:='UIB '+DB.InfoVersion; end; // ------------------ // ------------------ TdwsUIBDataSet ------------------ // ------------------ // Create // constructor TdwsUIBDataSet.Create(db : TdwsUIBDataBase; const sql : String; const parameters : TData); begin FDB:=db; inherited Create(db); FQuery:=TUIBQuery.Create{$ifndef UIB_NO_COMPONENT}(nil){$endif}; try FQuery.FetchBlobs:=True; FQuery.Transaction:=db.FTransaction; FQuery.SQL.Text:=sql; FQuery.Prepare(True); AssignParameters(FQuery, parameters); FQuery.Open; except RefCount:=0; raise; end; end; // Destroy // destructor TdwsUIBDataSet.Destroy; begin FQuery.Free; inherited; end; // Eof // function TdwsUIBDataSet.Eof : Boolean; begin Result:=FQuery.Eof; end; // Next // procedure TdwsUIBDataSet.Next; begin FQuery.Next; end; // FieldCount // function TdwsUIBDataSet.FieldCount : Integer; begin Result:=FQuery.Fields.FieldCount; end; // DoPrepareFields // procedure TdwsUIBDataSet.DoPrepareFields; var i, n : Integer; begin n:=FQuery.Fields.FieldCount; SetLength(FFields, n); for i:=0 to n-1 do FFields[i]:=TdwsUIBDataField.Create(Self, i); end; // ------------------ // ------------------ TdwsUIBDataField ------------------ // ------------------ // Create // constructor TdwsUIBDataField.Create(dataSet : TdwsUIBDataSet; fieldIndex : Integer); begin inherited Create(dataSet, fieldIndex); end; // IsNull // function TdwsUIBDataField.IsNull : Boolean; begin Result:=TdwsUIBDataSet(DataSet).FQuery.Fields.IsNull[Index]; end; // GetName // function TdwsUIBDataField.GetName : String; begin Result:=TdwsUIBDataSet(DataSet).FQuery.Fields.SqlName[Index]; end; // GetDataType // function TdwsUIBDataField.GetDataType : TdwsDataFieldType; var uibft : TUIBFieldType; begin uibft:=TdwsUIBDataSet(DataSet).FQuery.Fields.FieldType[Index]; case uibft of uftNumeric, uftFloat, uftDoublePrecision : Result:=dftFloat; uftChar, uftVarchar, uftCstring : Result:=dftString; uftSmallint, uftInteger, uftInt64 : Result:=dftInteger; uftTimestamp, uftDate, uftTime : Result:=dftDateTime; uftBlob, uftBlobId : Result:=dftBlob; {$IFDEF IB7_UP} uftBoolean : Result:=dftBoolean; {$ENDIF} {$IFDEF FB25_UP} uftNull : Result:=dftNull; {$ENDIF} else Result:=dftUnknown; end; end; // GetDeclaredType // function TdwsUIBDataField.GetDeclaredType : String; const cFieldTypes: array [TUIBFieldType] of string = ('', 'NUMERIC', 'CHAR', 'VARCHAR', 'CSTRING', 'SMALLINT', 'INTEGER', 'QUAD', 'FLOAT', 'DOUBLE PRECISION', 'TIMESTAMP', 'BLOB', 'BLOBID', 'DATE', 'TIME', 'BIGINT' , 'ARRAY'{$IFDEF IB7_UP}, 'BOOLEAN' {$ENDIF} {$IFDEF FB25_UP}, 'NULL'{$ENDIF}); begin Result:=cFieldTypes[TdwsUIBDataSet(DataSet).FQuery.Fields.FieldType[Index]]; end; // AsString // function TdwsUIBDataField.AsString : String; begin Result:=TdwsUIBDataSet(DataSet).FQuery.Fields.AsString[Index]; end; // AsInteger // function TdwsUIBDataField.AsInteger : Int64; begin Result:=TdwsUIBDataSet(DataSet).FQuery.Fields.AsInteger[Index]; end; // AsFloat // function TdwsUIBDataField.AsFloat : Double; begin Result:=TdwsUIBDataSet(DataSet).FQuery.Fields.AsDouble[Index]; end; // AsBoolean // function TdwsUIBDataField.AsBoolean : Boolean; begin Result:=TdwsUIBDataSet(DataSet).FQuery.Fields.AsBoolean[Index]; end; // AsBlob // function TdwsUIBDataField.AsBlob : RawByteString; begin Result:=TdwsUIBDataSet(DataSet).FQuery.Fields.AsRawByteString[Index]; end; // ------------------------------------------------------------------ // ------------------------------------------------------------------ // ------------------------------------------------------------------ initialization // ------------------------------------------------------------------ // ------------------------------------------------------------------ // ------------------------------------------------------------------ TdwsDatabase.RegisterDriver('UIB', TdwsUIBDataBaseFactory.Create); end.
27.541284
113
0.566955
83460e89acfb49c8879382dc49ee15e0547eb234
42,498
pas
Pascal
numcpulib/NumCPULib.pas
Moehre2/fpcupdeluxe
a427ed6e3b503b8ba295f8a818ca909c5a5bb34f
[ "zlib-acknowledgement" ]
198
2018-12-12T04:32:15.000Z
2022-03-10T03:37:09.000Z
numcpulib/NumCPULib.pas
djwisdom/fpcupdeluxe
07a9ab12480f4c619e968d7f899ca2e13dade32b
[ "zlib-acknowledgement" ]
425
2018-11-13T12:53:45.000Z
2022-03-29T14:39:59.000Z
numcpulib/NumCPULib.pas
djwisdom/fpcupdeluxe
07a9ab12480f4c619e968d7f899ca2e13dade32b
[ "zlib-acknowledgement" ]
55
2018-11-20T12:03:11.000Z
2022-03-28T06:34:08.000Z
{ *********************************************************************************** } { * NumCPULib Library * } { * Copyright (c) 2019 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. * } { * ******************************************************************************* * } (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) unit NumCPULib; {$DEFINE DELPHI} {$IFDEF FPC} {$UNDEF DELPHI} {$MODE DELPHI} // Disable Hints. {$HINTS OFF} {$IFDEF CPU386} {$DEFINE NUMCPULIB_X86} {$ENDIF} {$IFDEF CPUX64} {$DEFINE NUMCPULIB_X86_64} {$ENDIF} {$IFDEF CPUARM} {$DEFINE NUMCPULIB_ARM} {$ENDIF} {$IFDEF CPUAARCH64} {$DEFINE NUMCPULIB_AARCH64} {$ENDIF} {$IF DEFINED(NUMCPULIB_ARM) OR DEFINED(NUMCPULIB_AARCH64)} {$DEFINE NUMCPULIB_ARMCPU} {$IFEND} {$IFDEF IPHONESIM} {$DEFINE NUMCPULIB_IOSSIM} {$ENDIF} {$IF DEFINED(MSWINDOWS)} {$DEFINE NUMCPULIB_MSWINDOWS} {$ELSEIF DEFINED(UNIX)} {$DEFINE NUMCPULIB_UNIX} {$IF DEFINED(BSD)} {$IF DEFINED(DARWIN)} {$DEFINE NUMCPULIB_APPLE} {$IF DEFINED(NUMCPULIB_ARM) OR DEFINED(NUMCPULIB_AARCH64)} {$DEFINE NUMCPULIB_IOS} {$ELSE} {$DEFINE NUMCPULIB_MACOS} {$IFEND} {$ELSEIF DEFINED(FREEBSD) OR DEFINED(NETBSD) OR DEFINED(OPENBSD) OR DEFINED(DRAGONFLY)} {$DEFINE NUMCPULIB_GENERIC_BSD} {$IFEND} {$ELSEIF DEFINED(ANDROID)} {$DEFINE NUMCPULIB_ANDROID} {$ELSEIF DEFINED(LINUX)} {$DEFINE NUMCPULIB_LINUX} {$ELSEIF DEFINED(SOLARIS)} {$DEFINE NUMCPULIB_SOLARIS} {$ELSE} {$DEFINE NUMCPULIB_UNDEFINED_UNIX_VARIANTS} {$IFEND} {$ELSE} //{$MESSAGE ERROR 'UNSUPPORTED TARGET.'} {$IFEND} {$IFDEF NUMCPULIB_ANDROID} {$DEFINE NUMCPULIB_LINUX} {$ENDIF} {$IF DEFINED(NUMCPULIB_GENERIC_BSD) OR DEFINED(NUMCPULIB_APPLE)} {$DEFINE NUMCPULIB_HAS_SYSCTL} {$IFEND} {$IF DEFINED(NUMCPULIB_LINUX) OR DEFINED(NUMCPULIB_GENERIC_BSD) OR DEFINED(NUMCPULIB_SOLARIS) OR DEFINED(NUMCPULIB_APPLE)} {$DEFINE NUMCPULIB_HAS_SYSCONF} {$IFEND} {$IF DEFINED(NUMCPULIB_LINUX) OR DEFINED(NUMCPULIB_SOLARIS)} {$DEFINE NUMCPULIB_WILL_PARSE_DATA} {$IFEND} {$ENDIF FPC} (* &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& *) {$IFDEF DELPHI} // XE3 and Above {$IF CompilerVersion >= 24.0} {$DEFINE DELPHIXE3_UP} {$LEGACYIFEND ON} {$ZEROBASEDSTRINGS OFF} {$IFEND} {$IFDEF CPU386} {$DEFINE NUMCPULIB_X86} {$ENDIF} {$IFDEF CPUX64} {$DEFINE NUMCPULIB_X86_64} {$ENDIF} {$IFDEF CPUARM32} {$DEFINE NUMCPULIB_ARM} {$ENDIF} {$IFDEF CPUARM64} {$DEFINE NUMCPULIB_AARCH64} {$ENDIF} {$IF DEFINED(NUMCPULIB_ARM) OR DEFINED(NUMCPULIB_AARCH64)} {$DEFINE NUMCPULIB_ARMCPU} {$IFEND} {$IFDEF IOS} {$IFNDEF CPUARM} {$DEFINE NUMCPULIB_IOSSIM} {$ENDIF} {$ENDIF} {$IFDEF IOS} {$DEFINE NUMCPULIB_IOS} {$ENDIF} {$IFDEF MSWINDOWS} {$DEFINE NUMCPULIB_MSWINDOWS} {$ENDIF} {$IFDEF MACOS} {$IFNDEF IOS} {$DEFINE NUMCPULIB_MACOS} {$ENDIF} {$ENDIF} {$IFDEF ANDROID} {$DEFINE NUMCPULIB_ANDROID} {$ENDIF} {$IF DEFINED(NUMCPULIB_IOS) OR DEFINED(NUMCPULIB_MACOS)} {$DEFINE NUMCPULIB_APPLE} {$IFEND} {$IF DEFINED(LINUX) OR DEFINED(NUMCPULIB_ANDROID)} {$DEFINE NUMCPULIB_LINUX} {$IFEND} {$IF DEFINED(NUMCPULIB_APPLE)} {$DEFINE NUMCPULIB_HAS_SYSCTL} {$IFEND} {$IF DEFINED(NUMCPULIB_LINUX) OR DEFINED(NUMCPULIB_APPLE)} {$DEFINE NUMCPULIB_HAS_SYSCONF} {$IFEND} {$IF DEFINED(NUMCPULIB_MSWINDOWS)} // XE2 and Above {$IF CompilerVersion >= 23.0} {$DEFINE DELPHIXE2_UP} {$DEFINE HAS_GET_LOGICAL_PROCESSOR_INFORMATION_INBUILT} {$IFEND} {$IFEND} {$IFDEF NUMCPULIB_LINUX} {$DEFINE NUMCPULIB_WILL_PARSE_DATA} {$ENDIF} {$ENDIF DELPHI} interface uses {$IFDEF NUMCPULIB_MSWINDOWS} Windows, {$ENDIF} // ENDIF NUMCPULIB_MSWINDOWS // ================================================================// {$IFDEF NUMCPULIB_HAS_SYSCONF} {$IFDEF FPC} unixtype, {$IFDEF LINUX} Linux, {$ENDIF} // ENDIF LINUX {$ELSE} Posix.Unistd, {$ENDIF} // ENDIF FPC {$ENDIF} // ENDIF NUMCPULIB_HAS_SYSCONF // ================================================================// {$IFDEF NUMCPULIB_HAS_SYSCTL} {$IFDEF FPC} sysctl, {$ELSE} Posix.SysTypes, Posix.SysSysctl, {$ENDIF} // ENDIF FPC {$ENDIF} // ENDIF NUMCPULIB_HAS_SYSCTL // ================================================================// {$IFDEF NUMCPULIB_APPLE} {$IFDEF NUMCPULIB_MACOS} {$IFDEF FPC} CocoaAll, {$ELSE} Macapi.AppKit, {$ENDIF} // ENDIF FPC {$ENDIF} // ENDIF NUMCPULIB_MACOS {$ENDIF} // ENDIF NUMCPULIB_APPLE // ================================================================// {$IFDEF NUMCPULIB_WILL_PARSE_DATA} {$IFDEF NUMCPULIB_SOLARIS} Process, {$ENDIF} // ENDIF NUMCPULIB_SOLARIS Classes, StrUtils, {$ENDIF} // ENDIF NUMCPULIB_WILL_PARSE_DATA // ================================================================// SysUtils; type /// <summary> /// <para> /// A class with utilities to determine the number of CPUs available on /// the current system. /// </para> /// <para> /// This information can be used as a guide to how many tasks can be /// run in parallel. /// </para> /// <para> /// There are many properties of the system architecture that will /// affect parallelism, for example memory access speeds (for all the /// caches and RAM) and the physical architecture of the processor, so /// the number of CPUs should be used as a rough guide only. /// </para> /// </summary> TNumCPULib = class sealed(TObject) strict private // ================================================================// {$IFDEF NUMCPULIB_HAS_SYSCONF} class function GetAppropriateSysConfNumber(): Int32; static; {$ENDIF} // ================================================================// {$IFDEF NUMCPULIB_HAS_SYSCTL} {$IFDEF NUMCPULIB_APPLE} class function GetValueUsingSysCtlByName(const AName: String) : UInt64; static; {$ENDIF} class function GetLogicalCPUCountUsingSysCtl(): UInt32; static; {$ENDIF} // ================================================================// {$IFDEF NUMCPULIB_MSWINDOWS} const KERNEL32 = 'kernel32.dll'; {$IFNDEF HAS_GET_LOGICAL_PROCESSOR_INFORMATION_INBUILT} type TLogicalProcessorRelationship = (RelationProcessorCore = 0, RelationNumaNode = 1, RelationCache = 2, RelationProcessorPackage = 3, RelationGroup = 4, RelationAll = $FFFF); TProcessorCacheType = (CacheUnified, CacheInstruction, CacheData, CacheTrace); TCacheDescriptor = record Level: Byte; Associativity: Byte; LineSize: Word; Size: DWORD; pcType: TProcessorCacheType; end; PSystemLogicalProcessorInformation = ^TSystemLogicalProcessorInformation; TSystemLogicalProcessorInformation = record ProcessorMask: ULONG_PTR; Relationship: TLogicalProcessorRelationship; case Int32 of 0: (Flags: Byte); 1: (NodeNumber: DWORD); 2: (Cache: TCacheDescriptor); 3: (Reserved: array [0 .. 1] of ULONGLONG); end; KAffinity = NativeUInt; TGroupAffinity = record Mask: KAffinity; Group: Word; Reserved: array [0 .. 2] of Word; end; TProcessorRelationship = record Flags: Byte; Reserved: array [0 .. 20] of Byte; GroupCount: Word; GroupMask: array [0 .. 0] of TGroupAffinity; end; TNumaNodeRelationship = record NodeNumber: DWORD; Reserved: array [0 .. 19] of Byte; GroupMask: TGroupAffinity; end; TCacheRelationship = record Level: Byte; Associativity: Byte; LineSize: Word; CacheSize: DWORD; _Type: TProcessorCacheType; Reserved: array [0 .. 19] of Byte; GroupMask: TGroupAffinity; end; TProcessorGroupInfo = record MaximumProcessorCount: Byte; ActiveProcessorCount: Byte; Reserved: array [0 .. 37] of Byte; ActiveProcessorMask: KAffinity; end; TGroupRelationship = record MaximumGroupCount: Word; ActiveGroupCount: Word; Reserved: array [0 .. 19] of Byte; GroupInfo: array [0 .. 0] of TProcessorGroupInfo; end; PSystemLogicalProcessorInformationEx = ^ TSystemLogicalProcessorInformationEx; TSystemLogicalProcessorInformationEx = record Relationship: TLogicalProcessorRelationship; Size: DWORD; case Int32 of 0: (Processor: TProcessorRelationship); 1: (NumaNode: TNumaNodeRelationship); 2: (Cache: TCacheRelationship); 3: (Group: TGroupRelationship); end; MEMORYSTATUSEX = record dwLength : DWORD; dwMemoryLoad : DWORD; ullTotalPhys : uint64; ullAvailPhys : uint64; ullTotalPageFile : uint64; ullAvailPageFile : uint64; ullTotalVirtual : uint64; ullAvailVirtual : uint64; ullAvailExtendedVirtual : uint64; end; TMemoryStatusEx = MEMORYSTATUSEX; {$ENDIF} // ================================================================// type TGetLogicalProcessorInformation = function(Buffer: {$IFNDEF HAS_GET_LOGICAL_PROCESSOR_INFORMATION_INBUILT}TNumCPULib.{$ENDIF}PSystemLogicalProcessorInformation; var ReturnLength: DWORD): BOOL; stdcall; TGetLogicalProcessorInformationEx = function(RelationshipType : TLogicalProcessorRelationship; Buffer: {$IFNDEF HAS_GET_LOGICAL_PROCESSOR_INFORMATION_INBUILT}TNumCPULib.{$ENDIF}PSystemLogicalProcessorInformationEx; var ReturnLength: DWORD): BOOL; stdcall; TGetGlobalMemoryStatus = procedure(var Buffer:MemoryStatus); stdcall; TGetGlobalMemoryStatusEx = function(var Buffer:TMemoryStatusEx): BOOL; stdcall; class var FIsGetLogicalProcessorInformationAvailable, FIsGetLogicalProcessorInformationAvailableEx: Boolean; FGetLogicalProcessorInformation: TGetLogicalProcessorInformation; FGetLogicalProcessorInformationEx: TGetLogicalProcessorInformationEx; FIsGetGlobalMemoryStatusAvailable, FIsGetGlobalMemoryStatusAvailableEx: Boolean; FGetGlobalMemoryStatus: TGetGlobalMemoryStatus; FGetGlobalMemoryStatusEx: TGetGlobalMemoryStatusEx; // ================================================================// type TProcessorInformation = record LogicalProcessorCount: UInt32; ProcessorCoreCount: UInt32; end; type TProcessorInformationEx = record LogicalProcessorCount: UInt32; ProcessorCoreCount: UInt32; end; // ================================================================// class function GetProcedureAddress(ModuleHandle: THandle; const AProcedureName: String; var AFunctionFound: Boolean): Pointer; static; class function IsGetLogicalProcessorInformationAvailable(): Boolean; static; class function IsGetLogicalProcessorInformationExAvailable(): Boolean; static; class function CountSetBits(ABitMask: NativeUInt): UInt32; static; class function GetProcessorInfo(): TProcessorInformation; static; class function GetProcessorInfoEx(): TProcessorInformationEx; static; class function IsGetGlobalMemoryStatusAvailable(): Boolean; static; class function IsGetGlobalMemoryStatusAvailableEx(): Boolean; static; class function GetPhysicalMemoryEx(): UInt32; class function GetPhysicalMemory(): UInt32; class function GetLogicalCPUCountWindows(): UInt32; static; class function GetPhysicalCPUCountWindows(): UInt32; static; class function GetTotalPhysicalMemoryWindows(): UInt32; static; {$ENDIF} // ================================================================// {$IFDEF NUMCPULIB_APPLE} class function GetLogicalCPUCountApple(): UInt32; static; class function GetPhysicalCPUCountApple(): UInt32; static; class function GetTotalPhysicalMemoryApple(): UInt32; static; {$ENDIF} // ================================================================// {$IFDEF NUMCPULIB_WILL_PARSE_DATA} type TNumCPULibStringArray = array of String; class function SplitString(const AInputString: String; ADelimiter: Char) : TNumCPULibStringArray; static; class function ParseLastString(const AInputString: String): String; static; class function ParseInt32(const AInputString: String; ADefault: Int32): Int32; class function ParseLastInt32(const AInputString: String; ADefault: Int32) : Int32; static; class function BeginsWith(const AInputString, ASubString: string; AIgnoreCase: Boolean; AOffset: Int32 = 1): Boolean; static; {$ENDIF} // ================================================================// {$IFDEF NUMCPULIB_LINUX} type TLogicalProcessor = record private var ProcessorNumber, PhysicalProcessorNumber, PhysicalPackageNumber: UInt32; public class function Create(AProcessorNumber, APhysicalProcessorNumber, APhysicalPackageNumber: UInt32): TLogicalProcessor; static; end; class procedure ReadFileContents(const AFilePath: String; var AOutputParameters: TStringList); static; class function GetLogicalCPUCountLinux(): UInt32; static; class function GetPhysicalCPUCountLinux(): UInt32; static; class function GetTotalPhysicalMemoryLinux(): UInt32; static; class function GetTotalSwapMemoryLinux(): UInt32; static; {$ENDIF} // ================================================================// {$IFDEF NUMCPULIB_SOLARIS} class procedure ExecuteAndParseProcessOutput(const ACallingProcess: String; AInputParameters: TStringList; var AOutputParameters: TStringList); class function GetLogicalCPUCountSolaris(): UInt32; static; class function GetPhysicalCPUCountSolaris(): UInt32; static; class function GetTotalPhysicalMemorySolaris(): UInt32; static; {$ENDIF} // ================================================================// {$IFDEF NUMCPULIB_GENERIC_BSD} class function GetLogicalCPUCountGenericBSD(): UInt32; static; {$ENDIF} // ================================================================// class procedure Boot(); static; class constructor NumCPULib(); public /// <summary> /// This function will get the number of logical cores. Sometimes this is /// different from the number of physical cores. /// </summary> class function GetLogicalCPUCount(): UInt32; static; /// <summary> /// This function will get the number of physical cores. /// </summary> class function GetPhysicalCPUCount(): UInt32; static; class function GetTotalPhysicalMemory(): UInt32; static; class function GetTotalSwapMemory(): UInt32; static; end; {$IFDEF NUMCPULIB_HAS_SYSCONF} {$IFDEF FPC} function sysconf(i: cint): clong; cdecl; external 'c' name 'sysconf'; {$ENDIF} {$ENDIF} implementation { TNumCPULib } class procedure TNumCPULib.Boot(); begin {$IFDEF NUMCPULIB_MSWINDOWS} FIsGetLogicalProcessorInformationAvailable := IsGetLogicalProcessorInformationAvailable(); FIsGetLogicalProcessorInformationAvailableEx := IsGetLogicalProcessorInformationExAvailable(); FIsGetGlobalMemoryStatusAvailable := IsGetGlobalMemoryStatusAvailable(); FIsGetGlobalMemoryStatusAvailableEx := IsGetGlobalMemoryStatusAvailableEx(); {$ENDIF} end; class constructor TNumCPULib.NumCPULib; begin TNumCPULib.Boot(); end; // ================================================================// {$IFDEF NUMCPULIB_HAS_SYSCONF} class function TNumCPULib.GetAppropriateSysConfNumber(): Int32; begin // On ARM targets, processors could be turned off to save power So we // use `_SC_NPROCESSORS_CONF` to get the real number. // ****************************************************************// // NUMCPULIB_LINUX {$IFDEF NUMCPULIB_LINUX} {$IFDEF NUMCPULIB_ARMCPU} {$IFDEF NUMCPULIB_ANDROID} Result := 96; // _SC_NPROCESSORS_CONF {$ELSE} // Devices like RPI Result := 83; // _SC_NPROCESSORS_CONF {$ENDIF} {$ELSE} // for non ARM Linux like CPU's {$IFDEF NUMCPULIB_ANDROID} Result := 97; // _SC_NPROCESSORS_ONLN {$ELSE} Result := 84; // _SC_NPROCESSORS_ONLN {$ENDIF} // ENDIF NUMCPULIB_ANDROID {$ENDIF} // ENDIF NUMCPULIB_ARMCPU {$ENDIF} // ENDIF NUMCPULIB_LINUX // ****************************************************************// // NUMCPULIB_GENERIC_BSD {$IFDEF NUMCPULIB_GENERIC_BSD} {$IF DEFINED(FREEBSD) OR DEFINED(DRAGONFLY)} Result := 58; // _SC_NPROCESSORS_ONLN {$IFEND} {$IFDEF OPENBSD} Result := 503; // _SC_NPROCESSORS_ONLN {$ENDIF} {$IFDEF NETBSD} Result := 1002; // _SC_NPROCESSORS_ONLN {$ENDIF} {$ENDIF} // ENDIF NUMCPULIB_GENERIC_BSD // ****************************************************************// // NUMCPULIB_SOLARIS {$IFDEF NUMCPULIB_SOLARIS} {$IFDEF NUMCPULIB_ARMCPU} Result := 14; // _SC_NPROCESSORS_CONF {$ELSE} Result := 15; // _SC_NPROCESSORS_ONLN {$ENDIF} {$ENDIF} // ENDIF NUMCPULIB_SOLARIS // ****************************************************************// // NUMCPULIB_APPLE {$IFDEF NUMCPULIB_APPLE} {$IFDEF NUMCPULIB_ARMCPU} Result := 57; // _SC_NPROCESSORS_CONF {$ELSE} Result := 58; // _SC_NPROCESSORS_ONLN {$ENDIF} {$ENDIF} // ENDIF NUMCPULIB_APPLE end; {$ENDIF} // ================================================================// {$IFDEF NUMCPULIB_HAS_SYSCTL} {$IFDEF NUMCPULIB_APPLE} class function TNumCPULib.GetValueUsingSysCtlByName (const AName: String): UInt64; var LLen: size_t; begin LLen := System.SizeOf(Result); {$IFDEF FPC} fpsysctlbyname(PChar(AName), @Result, @LLen, nil, 0); {$ELSE} SysCtlByName(PAnsiChar(AName), @Result, @LLen, nil, 0); {$ENDIF} end; {$ENDIF} class function TNumCPULib.GetLogicalCPUCountUsingSysCtl(): UInt32; var LMib: array [0 .. 1] of Int32; LLen: size_t; begin LMib[0] := CTL_HW; LMib[1] := HW_NCPU; LLen := System.SizeOf(Result); {$IFDEF FPC} {$IF DEFINED(VER3_0_0) OR DEFINED(VER3_0_2)} fpsysctl(PChar(@LMib), 2, @Result, @LLen, nil, 0); {$ELSE} fpsysctl(@LMib, 2, @Result, @LLen, nil, 0); {$IFEND} {$ELSE} sysctl(@LMib, 2, @Result, @LLen, nil, 0); {$ENDIF} end; {$ENDIF} // ================================================================// {$IFDEF NUMCPULIB_MSWINDOWS} class function TNumCPULib.CountSetBits(ABitMask: NativeUInt): UInt32; var LShift, LIdx: UInt32; LBitTest: NativeUInt; begin LShift := (System.SizeOf(NativeUInt) * 8) - 1; Result := 0; LBitTest := NativeUInt(1) shl LShift; LIdx := 0; while LIdx <= LShift do begin if (ABitMask and LBitTest) <> 0 then begin System.Inc(Result); end; LBitTest := LBitTest shr 1; System.Inc(LIdx); end; end; class function TNumCPULib.GetProcessorInfo(): TProcessorInformation; var LReturnLength: DWORD; LProcInfo, LCurrentInfo: PSystemLogicalProcessorInformation; begin LReturnLength := 0; Result := Default (TProcessorInformation); FGetLogicalProcessorInformation(nil, LReturnLength); if GetLastError <> ERROR_INSUFFICIENT_BUFFER then begin RaiseLastOSError; end else begin System.GetMem(LProcInfo, LReturnLength); try if not FGetLogicalProcessorInformation(LProcInfo, LReturnLength) then begin RaiseLastOSError; end else begin LCurrentInfo := LProcInfo; while (NativeUInt(LCurrentInfo) - NativeUInt(LProcInfo)) < LReturnLength do begin case LCurrentInfo.Relationship of RelationProcessorCore: begin System.Inc(Result.ProcessorCoreCount); Result.LogicalProcessorCount := Result.LogicalProcessorCount + CountSetBits(LCurrentInfo.ProcessorMask); end; end; LCurrentInfo := PSystemLogicalProcessorInformation (NativeUInt(LCurrentInfo) + System.SizeOf(TSystemLogicalProcessorInformation)); end; end; finally System.FreeMem(LProcInfo); end; end; end; class function TNumCPULib.GetProcessorInfoEx: TProcessorInformationEx; var LReturnLength: DWORD; LProcInfo, LCurrentInfo: PSystemLogicalProcessorInformationEx; LIdx: Int32; begin LReturnLength := 0; Result := Default (TProcessorInformationEx); FGetLogicalProcessorInformationEx(RelationAll, nil, LReturnLength); if GetLastError <> ERROR_INSUFFICIENT_BUFFER then begin RaiseLastOSError; end else begin System.GetMem(LProcInfo, LReturnLength); try if not FGetLogicalProcessorInformationEx(RelationAll, LProcInfo, LReturnLength) then begin RaiseLastOSError; end else begin LCurrentInfo := LProcInfo; while (NativeUInt(LCurrentInfo) - NativeUInt(LProcInfo)) < LReturnLength do begin case LCurrentInfo.Relationship of RelationProcessorCore: begin System.Inc(Result.ProcessorCoreCount); for LIdx := 0 to System.Pred (LCurrentInfo.Processor.GroupCount) do begin Result.LogicalProcessorCount := Result.LogicalProcessorCount + CountSetBits(LCurrentInfo.Processor.GroupMask[LIdx].Mask); end; end; end; LCurrentInfo := PSystemLogicalProcessorInformationEx (NativeUInt(LCurrentInfo) + LCurrentInfo.Size); end; end; finally System.FreeMem(LProcInfo); end; end; end; class function TNumCPULib.GetLogicalCPUCountWindows(): UInt32; var LIdx: Int32; LProcessAffinityMask, LSystemAffinityMask: DWORD_PTR; LMask: DWORD; LSystemInfo: SYSTEM_INFO; LProcInfo: TProcessorInformation; LProcInfoEx: TProcessorInformationEx; begin if IsGetLogicalProcessorInformationExAvailable then begin LProcInfoEx := GetProcessorInfoEx; Result := LProcInfoEx.LogicalProcessorCount; Exit; end; if IsGetLogicalProcessorInformationAvailable then begin LProcInfo := GetProcessorInfo; Result := LProcInfo.LogicalProcessorCount; Exit; end; // fallback if non of the above are available // returns total number of processors available to system including logical hyperthreaded processors LProcessAffinityMask := 0; LSystemAffinityMask := 0; if GetProcessAffinityMask(GetCurrentProcess, LProcessAffinityMask, LSystemAffinityMask) then begin Result := 0; for LIdx := 0 to 31 do begin LMask := DWORD(1) shl LIdx; if (LProcessAffinityMask and LMask) <> 0 then begin System.Inc(Result); end; end; end else begin // can't get the affinity mask so we just report the total number of processors LSystemInfo := Default (SYSTEM_INFO); GetSystemInfo(LSystemInfo); Result := LSystemInfo.dwNumberOfProcessors; end; end; class function TNumCPULib.GetPhysicalCPUCountWindows(): UInt32; var LProcInfo: TProcessorInformation; LProcInfoEx: TProcessorInformationEx; begin Result := 0; if IsGetLogicalProcessorInformationExAvailable then begin LProcInfoEx := GetProcessorInfoEx; Result := LProcInfoEx.ProcessorCoreCount; Exit; end; if IsGetLogicalProcessorInformationAvailable then begin LProcInfo := GetProcessorInfo; Result := LProcInfo.ProcessorCoreCount; Exit; end; end; class function TNumCPULib.GetPhysicalMemoryEx(): UInt32; var M: TMemoryStatusEx; begin Result := 0; FillChar(M, SizeOf(TMemoryStatusEx), 0); M.dwLength := SizeOf(TMemoryStatusEx); if FGetGlobalMemoryStatusEx(M) then Result := (M.ullTotalPhys shr 20); end; class function TNumCPULib.GetPhysicalMemory(): UInt32; var M: TMemoryStatus; begin FillChar(M, SizeOf(TMemoryStatus), 0); M.dwLength := SizeOf(TMemoryStatus); FGetGlobalMemoryStatus(M); Result := (M.dwTotalPhys shr 20); end; class function TNumCPULib.GetTotalPhysicalMemoryWindows(): UInt32; begin Result := 0; if IsGetGlobalMemoryStatusAvailableEx then begin Result := GetPhysicalMemoryEx(); Exit; end; if IsGetGlobalMemoryStatusAvailable then begin Result := GetPhysicalMemory(); Exit; end; end; class function TNumCPULib.GetProcedureAddress(ModuleHandle: THandle; const AProcedureName: String; var AFunctionFound: Boolean): Pointer; begin Result := GetProcAddress(ModuleHandle, PChar(AProcedureName)); if Result = Nil then begin AFunctionFound := False; end; end; class function TNumCPULib.IsGetLogicalProcessorInformationAvailable(): Boolean; var ModuleHandle: THandle; begin Result := False; ModuleHandle := SafeLoadLibrary(KERNEL32, SEM_FAILCRITICALERRORS); if ModuleHandle <> 0 then begin Result := True; FGetLogicalProcessorInformation := GetProcedureAddress(ModuleHandle, 'GetLogicalProcessorInformation', Result); end; end; class function TNumCPULib.IsGetLogicalProcessorInformationExAvailable: Boolean; var ModuleHandle: THandle; begin Result := False; ModuleHandle := SafeLoadLibrary(KERNEL32, SEM_FAILCRITICALERRORS); if ModuleHandle <> 0 then begin Result := True; FGetLogicalProcessorInformationEx := GetProcedureAddress(ModuleHandle, 'GetLogicalProcessorInformationEx', Result); end; end; class function TNumCPULib.IsGetGlobalMemoryStatusAvailable(): Boolean; var ModuleHandle: THandle; begin Result := False; ModuleHandle := SafeLoadLibrary(KERNEL32, SEM_FAILCRITICALERRORS); if ModuleHandle <> 0 then begin Result := True; FGetGlobalMemoryStatus := GetProcedureAddress(ModuleHandle, 'GlobalMemoryStatus', Result); end; end; class function TNumCPULib.IsGetGlobalMemoryStatusAvailableEx: Boolean; var ModuleHandle: THandle; begin Result := False; ModuleHandle := SafeLoadLibrary(KERNEL32, SEM_FAILCRITICALERRORS); if ModuleHandle <> 0 then begin Result := True; FGetGlobalMemoryStatusEx := GetProcedureAddress(ModuleHandle, 'GlobalMemoryStatusEx', Result); end; end; {$ENDIF} // ================================================================// {$IFDEF NUMCPULIB_APPLE} class function TNumCPULib.GetLogicalCPUCountApple(): UInt32; //var // LTempRes: Int32; begin Result := UInt32(GetValueUsingSysCtlByName('hw.logicalcpu')); (* {$IF DEFINED(NUMCPULIB_MACOS)} // >= (Mac OS X 10.4+) if NSAppKitVersionNumber >= 824 then // NSAppKitVersionNumber10_4 begin LTempRes := sysconf(GetAppropriateSysConfNumber()); end else begin // fallback for when sysconf API is not available LTempRes := Int32(GetLogicalCPUCountUsingSysCtl()); end; {$ELSE} LTempRes := sysconf(GetAppropriateSysConfNumber()); {$IFEND} // final fallback if all above fails if LTempRes < 1 then begin Result := UInt32(GetValueUsingSysCtlByName('hw.logicalcpu')); end else begin Result := UInt32(LTempRes); end; *) end; class function TNumCPULib.GetPhysicalCPUCountApple(): UInt32; begin Result := UInt32(GetValueUsingSysCtlByName('hw.physicalcpu')); end; class function TNumCPULib.GetTotalPhysicalMemoryApple(): UInt32; begin Result := (GetValueUsingSysCtlByName('hw.memsize') shr 20); end; {$ENDIF} // ================================================================// {$IFDEF NUMCPULIB_WILL_PARSE_DATA} class function TNumCPULib.SplitString(const AInputString: String; ADelimiter: Char): TNumCPULibStringArray; var LPosStart, LPosDel, LSplitPoints, LIdx, LLowIndex, LHighIndex, LLength: Int32; begin Result := Nil; if AInputString <> '' then begin { Determine the length of the resulting array } LLowIndex := 1; LHighIndex := System.Length(AInputString); LSplitPoints := 0; for LIdx := LLowIndex to LHighIndex do begin if (ADelimiter = AInputString[LIdx]) then begin System.Inc(LSplitPoints); end; end; System.SetLength(Result, LSplitPoints + 1); { Split the string and fill the resulting array } LIdx := 0; LLength := System.Length(ADelimiter); LPosStart := 1; LPosDel := System.Pos(ADelimiter, AInputString); while LPosDel > 0 do begin Result[LIdx] := System.Copy(AInputString, LPosStart, LPosDel - LPosStart); LPosStart := LPosDel + LLength; LPosDel := PosEx(ADelimiter, AInputString, LPosStart); System.Inc(LIdx); end; Result[LIdx] := System.Copy(AInputString, LPosStart, System.Length(AInputString)); end; end; class function TNumCPULib.ParseLastString(const AInputString: String): String; var LSplitResult: TNumCPULibStringArray; begin LSplitResult := SplitString(AInputString, ' '); if (System.Length(LSplitResult) < 1) then begin Result := Trim(AInputString); end else begin Result := Trim(LSplitResult[System.Length(LSplitResult) - 1]); end; end; class function TNumCPULib.ParseInt32(const AInputString: String; ADefault: Int32): Int32; var LLocalString: String; begin LLocalString := AInputString; if BeginsWith(LowerCase(LLocalString), '0x', False) then begin Result := StrToIntDef(StringReplace(LLocalString, '0x', '$', [rfReplaceAll, rfIgnoreCase]), ADefault); end else begin Result := StrToIntDef(LLocalString, ADefault); end; end; class function TNumCPULib.ParseLastInt32(const AInputString: String; ADefault: Int32): Int32; var LLocalString: String; begin LLocalString := ParseLastString(AInputString); result:=ParseInt32(LLocalString,ADefault); end; class function TNumCPULib.BeginsWith(const AInputString, ASubString: String; AIgnoreCase: Boolean; AOffset: Int32): Boolean; var LIdx: Int32; LPtrInputString, LPtrSubString: PChar; begin LIdx := System.Length(ASubString); Result := LIdx > 0; LPtrInputString := PChar(AInputString); System.Inc(LPtrInputString, AOffset - 1); LPtrSubString := PChar(ASubString); if Result then begin if AIgnoreCase then begin Result := StrLiComp(LPtrSubString, LPtrInputString, LIdx) = 0 end else begin Result := StrLComp(LPtrSubString, LPtrInputString, LIdx) = 0 end; end; end; {$ENDIF} // ================================================================// {$IFDEF NUMCPULIB_LINUX} class function TNumCPULib.TLogicalProcessor.Create(AProcessorNumber, APhysicalProcessorNumber, APhysicalPackageNumber: UInt32): TLogicalProcessor; begin Result := Default (TLogicalProcessor); Result.ProcessorNumber := AProcessorNumber; Result.PhysicalProcessorNumber := APhysicalProcessorNumber; Result.PhysicalPackageNumber := APhysicalPackageNumber; end; class procedure TNumCPULib.ReadFileContents(const AFilePath: String; var AOutputParameters: TStringList); const BUF_SIZE = 2048; // Buffer size for reading the output in chunks var LOutputStream: TStream; LFileStream: TFileStream; LBytesRead: LongInt; LBuffer: array [0 .. BUF_SIZE - 1] of Byte; begin if SysUtils.FileExists(AFilePath) then begin LFileStream := TFileStream.Create(AFilePath, fmOpenRead); try LOutputStream := TMemoryStream.Create; try // All data from file is read in a loop until no more data is available repeat // Get the new data from the file to a maximum of the LBuffer size that was allocated. // Note that all read(...) calls will block except for the last one, which returns 0 (zero). LBytesRead := LFileStream.Read(LBuffer, BUF_SIZE); // Add the bytes that were read to the stream for later usage LOutputStream.Write(LBuffer, LBytesRead) until LBytesRead = 0; // Stop if no more data is available // Required to make sure all data is copied from the start LOutputStream.Position := 0; AOutputParameters.LoadFromStream(LOutputStream); finally LOutputStream.Free; end; finally LFileStream.Free; end; end; end; class function TNumCPULib.GetLogicalCPUCountLinux(): UInt32; begin Result := UInt32(sysconf(GetAppropriateSysConfNumber())); end; class function TNumCPULib.GetPhysicalCPUCountLinux(): UInt32; var LProcCpuInfos, LPhysicalProcessorsDetails: TStringList; LIdx, LJIdx, LLogicalProcessorsIdx: Int32; LCurrentProcessor, LCurrentCore, LCurrentPackage: UInt32; LFirst: Boolean; LLogicalProcessors: array of TLogicalProcessor; LogicalProcessor: TLogicalProcessor; LLineProcCpuInfo: String; begin LProcCpuInfos := TStringList.Create(); LCurrentProcessor := 0; LCurrentCore := 0; LCurrentPackage := 0; LFirst := True; try ReadFileContents('/proc/cpuinfo', LProcCpuInfos); System.SetLength(LLogicalProcessors, LProcCpuInfos.Count); // allocate enough space LLogicalProcessorsIdx := 0; for LIdx := 0 to System.Pred(LProcCpuInfos.Count) do begin // Count logical processors LLineProcCpuInfo := LProcCpuInfos[LIdx]; if (BeginsWith(LLineProcCpuInfo, 'processor', False)) then begin if (not LFirst) then begin LLogicalProcessors[LLogicalProcessorsIdx] := TLogicalProcessor.Create(LCurrentProcessor, LCurrentCore, LCurrentPackage); System.Inc(LLogicalProcessorsIdx); end else begin LFirst := False; end; LCurrentProcessor := UInt32(ParseLastInt32(LLineProcCpuInfo, 0)); end else if (BeginsWith(LLineProcCpuInfo, 'core id', False) or BeginsWith(LLineProcCpuInfo, 'cpu number', False)) then begin // Count unique combinations of core id and physical id. LCurrentCore := UInt32(ParseLastInt32(LLineProcCpuInfo, 0)); end else if (BeginsWith(LLineProcCpuInfo, 'physical id', False)) then begin LCurrentPackage := UInt32(ParseLastInt32(LLineProcCpuInfo, 0)); end; end; LLogicalProcessors[LLogicalProcessorsIdx] := TLogicalProcessor.Create(LCurrentProcessor, LCurrentCore, LCurrentPackage); System.Inc(LLogicalProcessorsIdx); // reduce to used size System.SetLength(LLogicalProcessors, LLogicalProcessorsIdx); LPhysicalProcessorsDetails := TStringList.Create(); LPhysicalProcessorsDetails.Sorted := True; LPhysicalProcessorsDetails.Duplicates := dupIgnore; try for LJIdx := 0 to System.Pred(System.Length(LLogicalProcessors)) do begin LogicalProcessor := LLogicalProcessors[LJIdx]; LPhysicalProcessorsDetails.Add (Format('%u:%u', [LogicalProcessor.PhysicalProcessorNumber, LogicalProcessor.PhysicalPackageNumber])); end; // LogicalProcessorCount := System.Length(LLogicalProcessors); Result := UInt32(LPhysicalProcessorsDetails.Count); finally LPhysicalProcessorsDetails.Free; end; finally LProcCpuInfos.Free; end; end; class function TNumCPULib.GetTotalPhysicalMemoryLinux(): UInt32; static; var SystemInf: TSysInfo; mu: cardinal; begin result:=0; try FillChar({%H-}SystemInf,SizeOf(SystemInf),0); SysInfo(@SystemInf); mu := SystemInf.mem_unit; result := (QWord(SystemInf.totalram*mu) shr 20); except end; end; class function TNumCPULib.GetTotalSwapMemoryLinux(): UInt32; static; var SystemInf: TSysInfo; mu: cardinal; begin result:=0; try FillChar({%H-}SystemInf,SizeOf(SystemInf),0); SysInfo(@SystemInf); mu := SystemInf.mem_unit; result := (QWord(SystemInf.totalswap*mu) shr 20); except end; end; {$ENDIF} // ================================================================// {$IFDEF NUMCPULIB_SOLARIS} class procedure TNumCPULib.ExecuteAndParseProcessOutput(const ACallingProcess : String; AInputParameters: TStringList; var AOutputParameters: TStringList); const BUF_SIZE = 2048; // Buffer size for reading the output in chunks var LProcess: TProcess; LOutputStream: TStream; LBytesRead: LongInt; LBuffer: array [0 .. BUF_SIZE - 1] of Byte; begin LProcess := TProcess.Create(nil); try LProcess.Executable := ACallingProcess; LProcess.Parameters.AddStrings(AInputParameters); LProcess.Options := LProcess.Options + [poWaitOnExit, poUsePipes]; LProcess.Execute; // Create a stream object to store the generated output in. LOutputStream := TMemoryStream.Create; try // All generated output from LProcess is read in a loop until no more data is available repeat // Get the new data from the process to a maximum of the LBuffer size that was allocated. // Note that all read(...) calls will block except for the last one, which returns 0 (zero). LBytesRead := LProcess.Output.Read(LBuffer, BUF_SIZE); // Add the bytes that were read to the stream for later usage LOutputStream.Write(LBuffer, LBytesRead) until LBytesRead = 0; // Stop if no more data is available // Required to make sure all data is copied from the start LOutputStream.Position := 0; AOutputParameters.LoadFromStream(LOutputStream); finally LOutputStream.Free; end; finally LProcess.Free; end; end; class function TNumCPULib.GetLogicalCPUCountSolaris(): UInt32; begin Result := UInt32(sysconf(GetAppropriateSysConfNumber())); end; class function TNumCPULib.GetPhysicalCPUCountSolaris(): UInt32; var LInputParameters, LOuputParameters, LCoreChipIDs: TStringList; LLineOutputInfo: String; LIdx: Int32; LChipId, LCoreId: UInt32; begin Result := 0; LCoreChipIDs := TStringList.Create(); LInputParameters := TStringList.Create(); LOuputParameters := TStringList.Create(); LCoreChipIDs.Sorted := True; LCoreChipIDs.Duplicates := dupIgnore; LOuputParameters.Sorted := True; LOuputParameters.Duplicates := dupIgnore; try LInputParameters.Add('-m'); LInputParameters.Add('cpu_info'); ExecuteAndParseProcessOutput('/usr/bin/kstat', LInputParameters, LOuputParameters); for LIdx := 0 to System.Pred(LOuputParameters.Count) do begin LLineOutputInfo := LOuputParameters[LIdx]; if BeginsWith(LLineOutputInfo, 'chip_id', False) then begin LChipId := UInt32(ParseLastInt32(LLineOutputInfo, 0)); end else if (BeginsWith(LLineOutputInfo, 'core_id', False)) then begin LCoreId := UInt32(ParseLastInt32(LLineOutputInfo, 0)); end; LCoreChipIDs.Add(Format('%u:%u', [LCoreId, LChipId])); end; Result := UInt32(LCoreChipIDs.Count); // fallback if above method fails, note: the method below only works only for Solaris 10 and above if Result < 1 then begin LInputParameters.Clear; LOuputParameters.Clear; LInputParameters.Add('-p'); ExecuteAndParseProcessOutput('psrinfo', LInputParameters, LOuputParameters); Result := UInt32(ParseLastInt32(LOuputParameters.Text, 0)); end; finally LCoreChipIDs.Free; LInputParameters.Free; LOuputParameters.Free; end; end; class function TNumCPULib.GetTotalPhysicalMemorySolaris(): UInt32; static; var LInputParameters, LOuputParameters: TStringList; LLineOutputInfo,aLastWord: String; MemoryPages:QWord; LIdx,LWordCount: Int32; begin Result := 0; LInputParameters := TStringList.Create(); LOuputParameters := TStringList.Create(); try LInputParameters.Add('-n'); LInputParameters.Add('system_pages'); LInputParameters.Add('-p'); LInputParameters.Add('-s'); LInputParameters.Add('physmem'); ExecuteAndParseProcessOutput('/usr/bin/kstat', LInputParameters, LOuputParameters); for LIdx := 0 to System.Pred(LOuputParameters.Count) do begin LLineOutputInfo := LOuputParameters[LIdx]; if AnsiStartsText('unix:0:system_pages:physmem',LLineOutputInfo) then begin LWordCount:=WordCount(LLineOutputInfo,[' ',#9]); aLastWord:=ExtractWord(LWordCount,LLineOutputInfo,[' ',#9]); MemoryPages := QWord(ParseInt32(aLastWord, 0)); MemoryPages := MemoryPages*4096;//4096 = pagesize MemoryPages := MemoryPages DIV (1024*1024); result:=UInt32(MemoryPages); break; end end; finally LInputParameters.Free; LOuputParameters.Free; end; end; {$ENDIF} // ================================================================// {$IFDEF NUMCPULIB_GENERIC_BSD} class function TNumCPULib.GetLogicalCPUCountGenericBSD(): UInt32; var LTempRes: Int32; begin LTempRes := sysconf(GetAppropriateSysConfNumber()); if LTempRes < 1 then begin Result := GetLogicalCPUCountUsingSysCtl(); end else begin Result := UInt32(LTempRes); end; end; {$ENDIF} class function TNumCPULib.GetLogicalCPUCount(): UInt32; begin {$IF DEFINED(NUMCPULIB_MSWINDOWS)} Result := GetLogicalCPUCountWindows(); {$ELSEIF DEFINED(NUMCPULIB_APPLE)} Result := GetLogicalCPUCountApple(); {$ELSEIF DEFINED(NUMCPULIB_LINUX)} Result := GetLogicalCPUCountLinux(); {$ELSEIF DEFINED(NUMCPULIB_SOLARIS)} Result := GetLogicalCPUCountSolaris(); {$ELSEIF DEFINED(NUMCPULIB_GENERIC_BSD)} Result := GetLogicalCPUCountGenericBSD(); {$ELSE} // fallback for other Unsupported Oses Result := 1; {$IFEND} end; class function TNumCPULib.GetPhysicalCPUCount(): UInt32; begin {$IF DEFINED(NUMCPULIB_MSWINDOWS)} Result := GetPhysicalCPUCountWindows(); {$ELSEIF DEFINED(NUMCPULIB_APPLE)} Result := GetPhysicalCPUCountApple(); {$ELSEIF DEFINED(NUMCPULIB_LINUX)} Result := GetPhysicalCPUCountLinux(); {$ELSEIF DEFINED(NUMCPULIB_SOLARIS)} Result := GetPhysicalCPUCountSolaris(); {$ELSE} // fallback for other Unsupported Oses Result := 1; {$IFEND} end; class function TNumCPULib.GetTotalPhysicalMemory(): UInt32; begin {$IF DEFINED(NUMCPULIB_MSWINDOWS)} Result := GetTotalPhysicalMemoryWindows(); {$ELSEIF DEFINED(NUMCPULIB_APPLE)} Result := GetTotalPhysicalMemoryApple(); {$ELSEIF DEFINED(NUMCPULIB_LINUX)} Result := GetTotalPhysicalMemoryLinux(); {$ELSEIF DEFINED(NUMCPULIB_SOLARIS)} Result := GetTotalPhysicalMemorySolaris(); {$ELSE} // fallback for other Unsupported Oses Result := 0; {$IFEND} end; class function TNumCPULib.GetTotalSwapMemory(): UInt32; begin {$IF DEFINED(NUMCPULIB_MSWINDOWS)} Result := 0; {$ELSEIF DEFINED(NUMCPULIB_APPLE)} Result := 0; {$ELSEIF DEFINED(NUMCPULIB_LINUX)} Result := GetTotalSwapMemoryLinux(); {$ELSEIF DEFINED(NUMCPULIB_SOLARIS)} //Result := GetTotalPhysicalSwapSolaris(); Result := 0; {$ELSE} // fallback for other Unsupported Oses Result := 0; {$IFEND} end; end.
28.313125
152
0.670314
f127cb0a9e710ccea641e21e476c1c234f764b9e
922
pas
Pascal
examples/language/ProcedureContinue.pas
azrael11/GamePascal
e3c2811651b103fb7db691f3cc9697f949cf723b
[ "RSA-MD" ]
1
2020-07-20T11:22:36.000Z
2020-07-20T11:22:36.000Z
examples/language/ProcedureContinue.pas
azrael11/GamePascal
e3c2811651b103fb7db691f3cc9697f949cf723b
[ "RSA-MD" ]
null
null
null
examples/language/ProcedureContinue.pas
azrael11/GamePascal
e3c2811651b103fb7db691f3cc9697f949cf723b
[ "RSA-MD" ]
1
2020-07-20T11:22:37.000Z
2020-07-20T11:22:37.000Z
{$REGION 'Project Directives'} // Modual Info {$CONSOLEAPP} {$MODULENAME "..\bin\"} {.$EXEICON ".\bin\arc\icons\icon.ico"} {.$SEARCHPATH "path1;path2;path3"} {.$ENABLERUNTIMETHEMES} {.$HIGHDPIAWARE} // Version Infp {.$ADDVERSIONINFO} {.$COMPANYNAME "Company XYZ"} {.$FILEVERSION "1.0.0.0"} {.$FILEDESCRIPTION "Demo XYZ"} {.$INTERNALNAME "Demo XYZ"} {.$LEGALCOPYRIGHT "Copyright (c) 2015 Company XYZ"} {.$LEGALTRADEMARK "All Rights Reserved."} {.$ORIGINALFILENAME "DemoXYZ.exe"} {.$PRODUCTNAME "Demo XYZ"} {.$PRODUCTVERSION "1.0.0.0"} {.$COMMENTS "http://companyxyz.com"} {$ENDREGION} program Demo; uses SysUtils, GamePascal; var I: Integer; begin I := 0; repeat I := I + 1; if I = 5 then continue; WriteLn(I); until I = 10; Con_Pause(CON_LF+'Press any key to continue...'); end.
21.952381
57
0.58026
837eb4affe666388b1becca56b11f4e51ad8e97a
6,676
pas
Pascal
src/afucrypt/uafcrypt.pas
Arteev/afudf
d669397901fb8b3c3d428dc9cf02596169e3752a
[ "MIT" ]
null
null
null
src/afucrypt/uafcrypt.pas
Arteev/afudf
d669397901fb8b3c3d428dc9cf02596169e3752a
[ "MIT" ]
null
null
null
src/afucrypt/uafcrypt.pas
Arteev/afudf
d669397901fb8b3c3d428dc9cf02596169e3752a
[ "MIT" ]
1
2021-03-10T10:27:29.000Z
2021-03-10T10:27:29.000Z
unit uafcrypt; { This file is part of the AF UDF library for Firebird 1.0 or high. Copyright (c) 2007-2009 by Arteev Alexei, OAO Pharmacy Tyumen. See the file COPYING.TXT, included in this distribution, for details about the copyright. This program 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. email: alarteev@yandex.ru, arteev@pharm-tmn.ru, support@pharm-tmn.ru **********************************************************************} {$MODE objfpc} {$H+} interface uses Classes,ufbblob, SysUtils; {Computes the hash value for the buffer Buf in accordance with the algorithm SHA1} function CryptSha1String (Buf: PChar): PChar; cdecl; {Computes the hash value for the BLOB in accordance with the algorithm SHA1} function CryptSha1BLOB (var Blob: TFBBlob): PChar; cdecl; {Calculate the hash value for the file in accordance with the algorithm SHA1} function CryptSha1File (FileName: Pchar): PChar; cdecl; {Calculation CRC32 checksum for the string} function CryptCRC32 (Buf: PChar): PChar; cdecl; {Calculation CRC32 checksum for blob} function CryptCRC32Blob (var Blob: TFBBlob): PChar; cdecl; {Calculation CRC32 checksum file} function CryptCRC32File (FileName: Pchar): PChar; cdecl; {Calculate MD5 for a string} function CryptMD5 (Buf: PChar): PChar; cdecl; {Calculating the MD5 blob} function CryptMD5Blob (var Blob: TFBBlob): PChar; cdecl; {Calculate MD5 file} function CryptMD5File (FileName: Pchar): PChar; cdecl; implementation uses sha1, md5, ib_util, crc; Const max_len_declare = 40; max_len_declareCrc = 8; max_len_declareMd5 = 32; function GetSizeAllocSmart(s:String;max: Integer):integer; var l : Integer; begin l := Length(s); if l >= max then result := max else result := l; end; function CryptSha1String(Buf:PChar):PChar;cdecl; var S:String; begin if strlen(Buf)=0 then exit(nil); try s:= SHA1Print(SHA1String(StrPas(Buf))); result := ib_util_malloc(GetSizeAllocSmart(s,max_len_declare)+1); StrPLCopy(result,s,max_len_declare); except result := nil; end; end; function CryptSha1BLOB(var Blob:TFBBlob):PChar;cdecl; var B:PChar; ReadLength:Integer; s: string; blen: LongInt; begin try if not Assigned(Blob.Handle) then Exit(nil); blen:=Blob.TotalLength; Getmem(B,blen+1); try ReadLength:=0; FillBuffer(Blob,B,blen,ReadLength); if ReadLength>0 then begin s:= SHA1Print(SHA1Buffer(Pointer(B)^,blen)); result := ib_util_malloc(GetSizeAllocSmart(s,max_len_declare)+1); StrPLCopy(result,s,max_len_declare); end else result := nil; finally Freemem(B,blen+1); end; except result := nil; end; end; function CryptSha1File(FileName:Pchar):PChar;cdecl; var S:String; begin try if (strlen(FileName)=0) or (not FileExists(FileName)) then begin exit(nil); end; s:= SHA1Print(SHA1File(StrPas(FileName))); Result := ib_util_malloc(GetSizeAllocSmart(s,max_len_declare)+1); StrPLCopy(Result,s,max_len_declare); except Result := nil; end; end; function CryptCRC32s(Buf:PChar):string; var len: LongInt; res:dword; Begin len:=strlen(Buf); if (Buf = nil) then exit(''); res := crc32(Cardinal($FFFFFFFF), nil, 0); res := crc32(res, Pbyte(@Buf[0]), len); try if res<>0 then Result:= IntToHex(res,8) else result := ''; except result := ''; end; end; function CryptCRC32(Buf:PChar):PChar;cdecl; var s: String; Begin try s:= CryptCRC32s(Buf); if (s='') then exit(nil); Result := ib_util_malloc(GetSizeAllocSmart(s,max_len_declareCrc)+1); StrPLCopy(Result,s,max_len_declareCrc); except result := nil; end; end; function CryptCRC32Blob(var Blob:TFBBlob):PChar;cdecl; var B:PChar; ReadLength:Integer; blen: LongInt; s : string; begin try if not Assigned(Blob.Handle) then Exit(nil); blen:=Blob.TotalLength; Getmem(B,blen+1); try ReadLength:=0; FillBuffer(Blob,B,blen,ReadLength); if ReadLength>0 then begin s := CryptCRC32s(B); if (s='') then exit(nil); Result := ib_util_malloc(GetSizeAllocSmart(s,max_len_declareCrc)+1); StrPLCopy(Result,s,max_len_declareCrc); end else Result := nil; finally Freemem(B,blen+1); end; except result := nil; end; end; function CryptCRC32File(FileName:Pchar):PChar;cdecl; var B:array [0..4095] of byte; s: AnsiString; fs:TFileStream; res: LongWord; leng: LongInt; begin try if (strlen(FileName)=0) or (not FileExists(FileName)) then exit(nil); fs:=TFileStream.Create(FileName,fmOpenRead); try res := crc32(Cardinal($FFFFFFFF), nil, 0); while fs.Position<fs.Size do begin leng := fs.Read(B,4096); if leng >0 then res := crc32(res, PByte(@B[0]), leng); End; s:= IntToHex(res,8); Result := ib_util_malloc(GetSizeAllocSmart(s,max_len_declareCrc)+1); StrPLCopy(Result,s,max_len_declareCrc); Finally fs.Free; End; except Result := nil; end; end; function CryptMD5(Buf:PChar):PChar;cdecl; var S:String; begin try if strlen(Buf)=0 then exit(nil); s:= MD5Print(MD5String(StrPas(Buf))); Result := ib_util_malloc(GetSizeAllocSmart(s,max_len_declareMd5)+1); StrPLCopy(Result,s,max_len_declareMd5); except Result := nil; end; end; function CryptMD5Blob(var Blob:TFBBlob):PChar;cdecl; var B:PChar; ReadLength:Integer; s: AnsiString; blen: LongInt; begin try if not Assigned(Blob.Handle) then Exit(nil); blen:=Blob.TotalLength; Getmem(B,blen+1); try ReadLength:=0; FillBuffer(Blob,B,Blob.TotalLength,ReadLength); if ReadLength>0 then begin s:= MD5Print(MD5Buffer(B^,Blob.TotalLength)); Result := ib_util_malloc(GetSizeAllocSmart(s,max_len_declareMd5)+1); StrPLCopy(Result,PChar(s),max_len_declareMd5); end else Result := nil; finally Freemem(B,blen+1); end; except Result := nil; End; end; function CryptMD5File(FileName:Pchar):PChar;cdecl; var S:String; begin try if (strlen(FileName)=0) or (not FileExists(FileName)) then exit(nil); s:= MD5Print(MD5File(StrPas(FileName))); Result := ib_util_malloc(GetSizeAllocSmart(s,max_len_declareMd5)+1); StrPLCopy(Result,s,max_len_declareMd5); except Result := nil; end; end; end.
23.590106
82
0.658478
f1fe3e5780d023fbf689ad24fcee02a7ece4e7b5
351
lpr
Pascal
Examples/trunk/database/dblookup/project1.lpr
joecare99/Public
9eee060fbdd32bab33cf65044602976ac83f4b83
[ "MIT" ]
11
2017-06-17T05:13:45.000Z
2021-07-11T13:18:48.000Z
Examples/trunk/database/dblookup/project1.lpr
joecare99/Public
9eee060fbdd32bab33cf65044602976ac83f4b83
[ "MIT" ]
2
2019-03-05T12:52:40.000Z
2021-12-03T12:34:26.000Z
Examples/trunk/database/dblookup/project1.lpr
joecare99/Public
9eee060fbdd32bab33cf65044602976ac83f4b83
[ "MIT" ]
6
2017-09-07T09:10:09.000Z
2022-02-19T20:19:58.000Z
program project1; {$mode objfpc}{$H+} uses {$IFDEF UNIX}{$IFDEF UseCThreads} cthreads, {$ENDIF}{$ENDIF} Interfaces, // this includes the LCL widgetset Forms { you can add units after this }, Unit1, DBFLaz; {$R *.res} begin Application.Initialize; Application.CreateForm(TForm1, Form1); Application.Run; end.
16.714286
51
0.649573
8378ba14261ac8bb70054923b472f6b243683435
1,817
pas
Pascal
src/data/uCarBase.pas
bidtime/carcolor_build
463e7b105e42788f5cc1e83a9d80d36283d1e0a0
[ "Apache-2.0" ]
null
null
null
src/data/uCarBase.pas
bidtime/carcolor_build
463e7b105e42788f5cc1e83a9d80d36283d1e0a0
[ "Apache-2.0" ]
null
null
null
src/data/uCarBase.pas
bidtime/carcolor_build
463e7b105e42788f5cc1e83a9d80d36283d1e0a0
[ "Apache-2.0" ]
1
2020-06-09T12:55:41.000Z
2020-06-09T12:55:41.000Z
unit uCarBase; interface uses SysUtils, classes; type TCarBase = class(TObject) protected class var FTableName: string; public constructor Create; destructor Destroy; override; class function startTrans(): string; class function commit(): string; //procedure setRow(const S: string); function getSql: string; class function getBatchSql(const ls: TList; const rows: integer=0): string; // function getRow(const c: char=#9; const quoted: boolean=false): string; virtual; abstract; class function getColumn(const c: char=#9): string; virtual; abstract; end; implementation { TCarBase } constructor TCarBase.Create; begin end; destructor TCarBase.Destroy; begin end; class function TCarBase.startTrans: string; begin Result := 'start transaction;' + #13#10 + '-- truncate table ;'; // + FTableName; end; class function TCarBase.commit: string; begin Result := 'commit;'; end; class function TCarBase.getBatchSql(const ls: TList; const rows: integer): string; var colsSql, rowsSql, mergeChar, tmp: string; i: integer; u: TCarBase; begin if ls.Count<=0 then begin Result := ''; end; colsSql := 'insert into ' + FTableName + '(' + getColumn(#44) + ')' + #13#10 + ' values ' + #13#10; // rowsSql := ''; for I := 0 to ls.Count - 1 do begin u := ls.Items[I]; if (i = ls.Count - 1) then begin mergeChar := ';'; end else begin mergeChar := ','; end; tmp := ' (' + u.getRow(#44, true) + ')' + mergeChar; rowsSql := rowsSql + tmp + #13#10; end; Result := colsSql + rowsSql; end; function TCarBase.getSql: string; begin Result := 'insert into ' + FTableName + '(' + getColumn(#44) + ')' + ' value(' + getRow(#44, true) + ');' end; end.
19.967033
94
0.619152
f17ad6bdbeddbe3b50992d307712158c643b9301
43,768
pas
Pascal
Delphi/lcmsdll.pas
LuaDist/lcms
f6473758511db915ff1762c4aa0115f5de414b3c
[ "MIT" ]
7
2017-06-03T09:01:24.000Z
2021-12-03T00:06:41.000Z
Delphi/lcmsdll.pas
LuaDist/lcms
f6473758511db915ff1762c4aa0115f5de414b3c
[ "MIT" ]
null
null
null
Delphi/lcmsdll.pas
LuaDist/lcms
f6473758511db915ff1762c4aa0115f5de414b3c
[ "MIT" ]
7
2015-06-05T06:04:40.000Z
2022-01-14T10:33:15.000Z
// // Little cms DELPHI wrapper // Copyright (C) 1998-2005 Marti Maria // // 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. // ver 1.15 UNIT lcmsdll; INTERFACE USES Windows; CONST // Intents INTENT_PERCEPTUAL = 0; INTENT_RELATIVE_COLORIMETRIC = 1; INTENT_SATURATION = 2; INTENT_ABSOLUTE_COLORIMETRIC = 3; // Flags cmsFLAGS_MATRIXINPUT = $0001; cmsFLAGS_MATRIXOUTPUT = $0002; cmsFLAGS_MATRIXONLY = (cmsFLAGS_MATRIXINPUT OR cmsFLAGS_MATRIXOUTPUT); cmsFLAGS_NOPRELINEARIZATION = $0010; // Don't create prelinearization tables // on precalculated transforms (internal use) cmsFLAGS_NOTPRECALC = $0100; cmsFLAGS_NULLTRANSFORM = $0200; // Don't transform anyway cmsFLAGS_HIGHRESPRECALC = $0400; // Use more memory to give better accurancy cmsFLAGS_LOWRESPRECALC = $0800; // Use less memory to minimize resouces cmsFLAGS_GAMUTCHECK = $1000; // Mark Out of Gamut as alarm color (on proofing transform) cmsFLAGS_SOFTPROOFING = $4000; // Softproof of proofing profile cmsFLAGS_WHITEBLACKCOMPENSATION = $2000; cmsFLAGS_BLACKPOINTCOMPENSATION = $2000; cmsFLAGS_NODEFAULTRESOURCEDEF = $10000; // PostScript // Format descriptors TYPE_GRAY_8 = $30009; TYPE_GRAY_8_REV = $32009; TYPE_GRAY_16 = $3000A; TYPE_GRAY_16_REV = $3200A; TYPE_GRAY_16_SE = $3080A; TYPE_GRAYA_8 = $30089; TYPE_GRAYA_16 = $3008A; TYPE_GRAYA_16_SE = $3088A; TYPE_GRAYA_8_PLANAR = $31089; TYPE_GRAYA_16_PLANAR = $3108A; TYPE_RGB_8 = $40019; TYPE_RGB_8_PLANAR = $41019; TYPE_BGR_8 = $40419; TYPE_BGR_8_PLANAR = $41419; TYPE_RGB_16 = $4001A; TYPE_RGB_16_PLANAR = $4101A; TYPE_RGB_16_SE = $4081A; TYPE_BGR_16 = $4041A; TYPE_BGR_16_PLANAR = $4141A; TYPE_BGR_16_SE = $40C1A; TYPE_RGBA_8 = $40099; TYPE_RGBA_8_PLANAR = $41099; TYPE_RGBA_16 = $4009A; TYPE_RGBA_16_PLANAR = $4109A; TYPE_RGBA_16_SE = $4089A; TYPE_ARGB_8 = $44099; TYPE_ARGB_16 = $4409A; TYPE_ABGR_8 = $40499; TYPE_ABGR_16 = $4049A; TYPE_ABGR_16_PLANAR = $4149A; TYPE_ABGR_16_SE = $40C9A; TYPE_BGRA_8 = $44499; TYPE_BGRA_16 = $4449A; TYPE_BGRA_16_SE = $4489A; TYPE_CMY_8 = $50019; TYPE_CMY_8_PLANAR = $51019; TYPE_CMY_16 = $5001A; TYPE_CMY_16_PLANAR = $5101A; TYPE_CMY_16_SE = $5081A; TYPE_CMYK_8 = $60021; TYPE_CMYK_8_REV = $62021; TYPE_YUVK_8 = $62021; TYPE_CMYK_8_PLANAR = $61021; TYPE_CMYK_16 = $60022; TYPE_CMYK_16_REV = $62022; TYPE_YUVK_16 = $62022; TYPE_CMYK_16_PLANAR = $61022; TYPE_CMYK_16_SE = $60822; TYPE_KYMC_8 = $60421; TYPE_KYMC_16 = $60422; TYPE_KYMC_16_SE = $60C22; TYPE_KCMY_8 = $64021; TYPE_KCMY_8_REV = $66021; TYPE_KCMY_16 = $64022; TYPE_KCMY_16_REV = $66022; TYPE_KCMY_16_SE = $64822; TYPE_CMYKcm_8 = $0031; TYPE_CMYKcm_8_PLANAR = $1031; TYPE_CMYKcm_16 = $0032; TYPE_CMYKcm_16_PLANAR = $1032; TYPE_CMYKcm_16_SE = $0832; TYPE_CMYK7_8 = $0039; TYPE_CMYK7_16 = $003A; TYPE_CMYK7_16_SE = $083A; TYPE_KYMC7_8 = $0439; TYPE_KYMC7_16 = $043A; TYPE_KYMC7_16_SE = $0C3A; TYPE_CMYK8_8 = $0041; TYPE_CMYK8_16 = $0042; TYPE_CMYK8_16_SE = $0842; TYPE_KYMC8_8 = $0441; TYPE_KYMC8_16 = $0442; TYPE_KYMC8_16_SE = $0C42; TYPE_CMYK9_8 = $0049; TYPE_CMYK9_16 = $004A; TYPE_CMYK9_16_SE = $084A; TYPE_KYMC9_8 = $0449; TYPE_KYMC9_16 = $044A; TYPE_KYMC9_16_SE = $0C4A; TYPE_CMYK10_8 = $0051; TYPE_CMYK10_16 = $0052; TYPE_CMYK10_16_SE = $0852; TYPE_KYMC10_8 = $0451; TYPE_KYMC10_16 = $0452; TYPE_KYMC10_16_SE = $0C52; TYPE_CMYK11_8 = $0059; TYPE_CMYK11_16 = $005A; TYPE_CMYK11_16_SE = $085A; TYPE_KYMC11_8 = $0459; TYPE_KYMC11_16 = $045A; TYPE_KYMC11_16_SE = $0C5A; TYPE_CMYK12_8 = $0061; TYPE_CMYK12_16 = $0062; TYPE_CMYK12_16_SE = $0862; TYPE_KYMC12_8 = $0461; TYPE_KYMC12_16 = $0462; TYPE_KYMC12_16_SE = $0C62; TYPE_XYZ_16 = $9001A; TYPE_Lab_8 = $A0019; TYPE_LabA_8 = $A0099; TYPE_Lab_16 = $A001A; TYPE_Yxy_16 = $E001A; TYPE_YCbCr_8 = $70019; TYPE_YCbCr_8_PLANAR = $71019; TYPE_YCbCr_16 = $7001A; TYPE_YCbCr_16_PLANAR = $7101A; TYPE_YCbCr_16_SE = $7081A; TYPE_YUV_8 = $80019; TYPE_YUV_8_PLANAR = $81019; TYPE_YUV_16 = $8001A; TYPE_YUV_16_PLANAR = $8101A; TYPE_YUV_16_SE = $8081A; TYPE_HLS_8 = $D0019; TYPE_HLS_8_PLANAR = $D1019; TYPE_HLS_16 = $D001A; TYPE_HLS_16_PLANAR = $D101A; TYPE_HLS_16_SE = $D081A; TYPE_HSV_8 = $C0019; TYPE_HSV_8_PLANAR = $C1019; TYPE_HSV_16 = $C001A; TYPE_HSV_16_PLANAR = $C101A; TYPE_HSV_16_SE = $C081A; TYPE_NAMED_COLOR_INDEX = $000A; TYPE_XYZ_DBL = $90018; TYPE_Lab_DBL = $A0018; TYPE_GRAY_DBL = $30008; TYPE_RGB_DBL = $40018; TYPE_CMYK_DBL = $60020; // Some utility functions to compute new descriptors FUNCTION COLORSPACE_SH(e: Integer):Integer; FUNCTION SWAPFIRST_SH(e: Integer):Integer; FUNCTION FLAVOR_SH(e: Integer):Integer; FUNCTION PLANAR_SH(e: Integer):Integer; FUNCTION ENDIAN16_SH(e: Integer):Integer; FUNCTION DOSWAP_SH(e: Integer):Integer; FUNCTION EXTRA_SH(e: Integer):Integer; FUNCTION CHANNELS_SH(c: Integer):Integer; FUNCTION BYTES_SH(b: Integer):Integer; TYPE DWord = Cardinal; icTagSignature = DWord; icColorSpaceSignature = DWord; icProfileClassSignature= DWord; CONST // icc color space signatures icSigXYZData = $58595A20; icSigLabData = $4C616220; icSigLuvData = $4C757620; icSigYCbCrData = $59436272; icSigYxyData = $59787920; icSigRgbData = $52474220; icSigGrayData = $47524159; icSigHsvData = $48535620; icSigHlsData = $484C5320; icSigCmykData = $434D594B; icSigCmyData = $434D5920; // icc Profile class signatures icSigInputClass = $73636E72; icSigDisplayClass = $6D6E7472; icSigOutputClass = $70727472; icSigLinkClass = $6C696E6B; icSigAbstractClass = $61627374; icSigColorSpaceClass = $73706163; icSigNamedColorClass = $6e6d636c; // Added by lcms lcmsSignature = $6c636d73; icSigLuvKData = $4C75764B; {'LuvK'} icSigChromaticityTag = $6368726d; { As per Addendum 2 to Spec. ICC.1:1998-09 } icSigChromaticAdaptationTag = $63686164; TYPE cmsHPROFILE = Pointer; cmsHTRANSFORM = Pointer; LCMSHANDLE = Pointer; LCMSGAMMAPARAMS = PACKED RECORD Crc32 : DWord; TheType : Integer; Params : ARRAY [0..9] OF Double; END; GAMMATABLE = PACKED RECORD Birth : LCMSGAMMAPARAMS; nEntries : DWord; GammaTable : ARRAY [0..1] OF Word; END; LPGAMMATABLE = ^GAMMATABLE; // Colorimetric spaces cmsCIEXYZ = PACKED RECORD X, Y, Z : Double; END; LPcmsCIEXYZ = ^cmsCIEXYZ; cmsCIEXYZTRIPLE = PACKED RECORD Red, Green, Blue : cmsCIEXYZ END; LPcmsCIEXYZTRIPLE = ^cmsCIEXYZTRIPLE; cmsCIExyY = PACKED RECORD x, y, YY : Double END; LPcmsCIExyY = ^cmsCIExyY; cmsCIExyYTRIPLE = PACKED RECORD Red, Green, Blue : cmsCIExyY END; LPcmsCIExyYTRIPLE = ^cmsCIExyYTRIPLE; cmsCIELab = PACKED RECORD L, a, b: Double END; LPcmsCIELab = ^cmsCIELab; cmsCIELCh = PACKED RECORD L, C, h : Double END; LPcmsCIELCh = ^cmsCIELCh; // CIECAM97s cmsJCh = PACKED RECORD J, C, h : Double END; LPcmsJCh = ^cmsJCh; LPLUT = Pointer; CONST AVG_SURROUND_4 = 0; AVG_SURROUND = 1; DIM_SURROUND = 2; DARK_SURROUND = 3; CUTSHEET_SURROUND = 4; D_CALCULATE = -1; D_CALCULATE_DISCOUNT = -2; TYPE cmsViewingConditions = PACKED RECORD WhitePoint: cmsCIEXYZ; Yb : Double; La : Double; surround : Integer; D_value : Double END; LPcmsViewingConditions = ^cmsViewingConditions; cmsErrorHandler = FUNCTION (Severity: Integer; Msg:PChar): Integer; cdecl; LCMSARRAYOFPCHAR = ARRAY OF PChar; // Input/Output FUNCTION cmsOpenProfileFromFile(ICCProfile: PChar; sAccess: PChar) : cmsHPROFILE; StdCall; FUNCTION cmsOpenProfileFromMem(MemPtr: Pointer; dwSize: DWord) : cmsHPROFILE; StdCall; FUNCTION cmsCloseProfile(hProfile : cmsHPROFILE) : Boolean; StdCall; FUNCTION cmsCreateRGBProfile(WhitePoint : LPcmsCIExyY; Primaries: LPcmsCIExyYTRIPLE; TransferFunction: ARRAY OF LPGAMMATABLE) : cmsHPROFILE; StdCall; FUNCTION cmsCreateGrayProfile(WhitePoint: LPcmsCIExyY; TransferFunction: LPGAMMATABLE) : cmsHPROFILE; StdCall; FUNCTION cmsCreateLinearizationDeviceLink(ColorSpace: icColorSpaceSignature; TransferFunction: ARRAY OF LPGAMMATABLE) : cmsHPROFILE; StdCall; FUNCTION cmsCreateInkLimitingDeviceLink(ColorSpace: icColorSpaceSignature; Limit: Double) : cmsHPROFILE; StdCall; FUNCTION cmsCreateNULLProfile : cmsHPROFILE; StdCall; FUNCTION cmsCreateLabProfile(WhitePoint: LPcmsCIExyY): cmsHPROFILE; StdCall; FUNCTION cmsCreateLab4Profile(WhitePoint: LPcmsCIExyY): cmsHPROFILE; StdCall; FUNCTION cmsCreateXYZProfile:cmsHPROFILE; StdCall; FUNCTION cmsCreate_sRGBProfile:cmsHPROFILE; StdCall; FUNCTION cmsCreateBCHSWabstractProfile(nLUTPoints: Integer; Bright, Contrast, Hue, Saturation: Double; TempSrc, TempDest: Integer): cmsHPROFILE; StdCall; // Utils PROCEDURE cmsXYZ2xyY(Dest: LPcmsCIExyY; Source: LPcmsCIEXYZ); StdCall; PROCEDURE cmsxyY2XYZ(Dest: LPcmsCIEXYZ; Source: LPcmsCIExyY); StdCall; PROCEDURE cmsXYZ2Lab(WhitePoint: LPcmsCIEXYZ; xyz: LPcmsCIEXYZ; Lab: LPcmsCIELab); StdCall; PROCEDURE cmsLab2XYZ(WhitePoint: LPcmsCIEXYZ; Lab: LPcmsCIELab; xyz: LPcmsCIEXYZ); StdCall; PROCEDURE cmsLab2LCh(LCh: LPcmsCIELCh; Lab: LPcmsCIELab); StdCall; PROCEDURE cmsLCh2Lab(Lab: LPcmsCIELab; LCh: LPcmsCIELCh); StdCall; // CIELab handling FUNCTION cmsDeltaE(Lab1, Lab2: LPcmsCIELab): Double; StdCall; FUNCTION cmsCIE94DeltaE(Lab1, Lab2: LPcmsCIELab): Double; StdCall; FUNCTION cmsBFDdeltaE(Lab1, Lab2: LPcmsCIELab): Double; StdCall; FUNCTION cmsCMCdeltaE(Lab1, Lab2: LPcmsCIELab): Double; StdCall; FUNCTION cmsCIE2000DeltaE(Lab1, Lab2: LPcmsCIELab; Kl, Kc, Kh: Double): Double; StdCall; PROCEDURE cmsClampLab(Lab: LPcmsCIELab; amax, amin, bmax, bmin: Double); StdCall; // White point FUNCTION cmsWhitePointFromTemp(TempK: Integer; WhitePoint: LPcmsCIExyY) : Boolean; StdCall; // CIECAM97s FUNCTION cmsCIECAM97sInit(pVC : LPcmsViewingConditions ) : Pointer; StdCall; PROCEDURE cmsCIECAM97sDone(hModel : Pointer); StdCall; PROCEDURE cmsCIECAM97sForward(hModel: Pointer; pIn: LPcmsCIEXYZ; pOut: LPcmsJCh ); StdCall; PROCEDURE cmsCIECAM97sReverse(hModel: Pointer; pIn: LPcmsJCh; pOut: LPcmsCIEXYZ ); StdCall; // CIECAM02 FUNCTION cmsCIECAM02Init(pVC : LPcmsViewingConditions ) : Pointer; StdCall; PROCEDURE cmsCIECAM02Done(hModel : Pointer); StdCall; PROCEDURE cmsCIECAM02Forward(hModel: Pointer; pIn: LPcmsCIEXYZ; pOut: LPcmsJCh ); StdCall; PROCEDURE cmsCIECAM02Reverse(hModel: Pointer; pIn: LPcmsJCh; pOut: LPcmsCIEXYZ ); StdCall; // Gamma curves FUNCTION cmsBuildGamma(nEntries : Integer; Gamma: Double) : LPGAMMATABLE; StdCall; FUNCTION cmsAllocGamma(nEntries : Integer): LPGAMMATABLE; StdCall; PROCEDURE cmsFreeGamma(Gamma: LPGAMMATABLE); StdCall; PROCEDURE cmsFreeGammaTriple(Gamma: ARRAY OF LPGAMMATABLE); StdCall; FUNCTION cmsReverseGamma(nResultSamples: Integer; InGamma : LPGAMMATABLE): LPGAMMATABLE; StdCall; FUNCTION cmsJoinGamma(InGamma, OutGamma: LPGAMMATABLE): LPGAMMATABLE; StdCall; FUNCTION cmsJoinGammaEx(InGamma, OutGamma: LPGAMMATABLE; nPoints: Integer): LPGAMMATABLE; StdCall; FUNCTION cmsSmoothGamma(Gamma: LPGAMMATABLE; SmoothingLambda: Double): Boolean; StdCall; FUNCTION cmsDupGamma(Src: LPGAMMATABLE): LPGAMMATABLE; StdCall; FUNCTION cmsEstimateGamma(Src: LPGAMMATABLE): Double; StdCall; FUNCTION cmsEstimateGammaEx(Src: LPGAMMATABLE; Thereshold: Double): Double; StdCall; FUNCTION cmsReadICCGamma(hProfile: cmsHPROFILE; Sig: icTagSignature): LPGAMMATABLE; StdCall; FUNCTION cmsReadICCGammaReversed(hProfile: cmsHPROFILE; Sig: icTagSignature): LPGAMMATABLE; StdCall; CONST lcmsParametricCurveExp = 0; lcmsParametricCurveCIE_122_1966 = 1; lcmsParametricCurveIEC_61966_3 = 2; lcmsParametricCurveIEC_61966_2_1= 3; FUNCTION cmsBuildParametricGamma(nEntries: Integer; TheType: Integer; Params: array of Double) : LPGAMMATABLE; StdCall; // Access to Profile data. PROCEDURE cmsSetLanguage(LanguageCode: Integer; CountryCode: Integer); StdCall; FUNCTION cmsTakeMediaWhitePoint(Dest: LPcmsCIEXYZ; hProfile: cmsHPROFILE): Boolean; StdCall; FUNCTION cmsTakeMediaBlackPoint(Dest: LPcmsCIEXYZ; hProfile: cmsHPROFILE): Boolean; StdCall; FUNCTION cmsTakeIluminant(Dest: LPcmsCIEXYZ; hProfile: cmsHPROFILE): Boolean; StdCall; FUNCTION cmsTakeColorants(Dest: LPcmsCIEXYZTRIPLE; hProfile: cmsHPROFILE): Boolean; StdCall; FUNCTION cmsTakeHeaderFlags(hProfile: cmsHPROFILE): DWord; StdCall; FUNCTION cmsTakeProductName(hProfile: cmsHPROFILE): PChar; StdCall; FUNCTION cmsTakeProductDesc(hProfile: cmsHPROFILE): PChar; StdCall; FUNCTION cmsTakeManufacturer(hProfile: cmsHPROFILE): PChar; StdCall; FUNCTION cmsTakeModel(hProfile: cmsHPROFILE): PChar; StdCall; FUNCTION cmsTakeCopyright(hProfile: cmsHPROFILE): PChar; StdCall; FUNCTION cmsTakeProfileID(hProfile: cmsHPROFILE): PByte; StdCall; FUNCTION cmsIsTag(hProfile: cmsHPROFILE; sig: icTagSignature): Boolean; StdCall; FUNCTION cmsTakeRenderingIntent(hProfile: cmsHPROFILE): Integer; StdCall; FUNCTION cmsIsIntentSupported(hProfile: cmsHPROFILE; Intent, UsedDirection : Integer): Integer; StdCall; FUNCTION cmsTakeCharTargetData(hProfile: cmsHPROFILE; var Data : PChar; var len: Cardinal): Boolean; StdCall; FUNCTION _cmsICCcolorSpace(OurNotation: Integer) : icColorSpaceSignature; StdCall; FUNCTION _cmsLCMScolorSpace(ProfileSpace: icColorSpaceSignature): Integer; StdCall; FUNCTION _cmsChannelsOf(ColorSpace: icColorSpaceSignature): Integer; StdCall; FUNCTION cmsGetPCS(hProfile: cmsHPROFILE): icColorSpaceSignature; StdCall; FUNCTION cmsGetColorSpace(hProfile: cmsHPROFILE): icColorSpaceSignature; StdCall; FUNCTION cmsGetDeviceClass( hProfile: cmsHPROFILE): icProfileClassSignature; StdCall; FUNCTION cmsGetProfileICCversion( hProfile: cmsHPROFILE): DWord; StdCall; // Profile creation PROCEDURE cmsSetDeviceClass(hProfile: cmsHPROFILE; sig: icProfileClassSignature ); StdCall; PROCEDURE cmsSetColorSpace(hProfile: cmsHPROFILE; sig: icProfileClassSignature ); StdCall; PROCEDURE cmsSetPCS(hProfile: cmsHPROFILE; pcs: icColorSpaceSignature); StdCall; PROCEDURE cmsSetRenderingIntent(hProfile: cmsHPROFILE; Intent: Integer); StdCall; PROCEDURE cmsSetHeaderFlags(hProfile: cmsHPROFILE; dwFlags: DWord); StdCall; PROCEDURE cmsSetProfileID(hProfile: cmsHPROFILE; ProfileID: PByte); StdCall; FUNCTION cmsAddTag(hProfile: cmsHPROFILE; Sig: icTagSignature; Data: Pointer): Boolean; StdCall; FUNCTION _cmsSaveProfile(hProfile: cmsHPROFILE; FileName: PChar): Boolean; StdCall; FUNCTION _cmsSaveProfileToMem(hProfile: cmsHPROFILE; MemPtr: Pointer; var BytesNeeded: DWord): Boolean; StdCall; CONST LCMS_USED_AS_INPUT = 0; LCMS_USED_AS_OUTPUT = 1; LCMS_USED_AS_PROOF = 2; // Transforms FUNCTION cmsCreateTransform(Input: cmsHPROFILE; InputFormat: DWORD; Output: cmsHPROFILE; OutputFormat: DWORD; Intent: Integer; dwFlags: DWord): cmsHTRANSFORM; StdCall; FUNCTION cmsCreateProofingTransform(Input: cmsHPROFILE; InputFormat: DWORD; Output: cmsHPROFILE; OutputFormat: DWORD; Proofing: cmsHPROFILE; Intent: Integer; ProofingIntent: Integer; dwFlags: DWord): cmsHTRANSFORM; StdCall; FUNCTION cmsCreateMultiprofileTransform(hProfiles : ARRAY OF cmsHPROFILE; nProfiles : Integer; InputFormat: DWord; OutputFormat: DWord; Intent: Integer; dwFlags: DWord): cmsHTRANSFORM; StdCall; PROCEDURE cmsDeleteTransform( hTransform: cmsHTRANSFORM); StdCall; PROCEDURE cmsDoTransform( Transform: cmsHTRANSFORM; InputBuffer: Pointer; OutputBuffer: Pointer; Size: LongInt); StdCall; PROCEDURE cmsChangeBuffersFormat(hTransform: cmsHTRANSFORM; dwInputFormat, dwOutputFormat: DWord); StdCall; // Devicelink generation FUNCTION cmsTransform2DeviceLink(hTransform: cmsHTRANSFORM; dwFlags: DWord): cmsHPROFILE; StdCall; PROCEDURE _cmsSetLUTdepth(hProfile: cmsHPROFILE; depth: Integer); StdCall; // Named color support FUNCTION cmsNamedColorCount(xform: cmsHTRANSFORM): Integer; StdCall; FUNCTION cmsNamedColorInfo(xform: cmsHTRANSFORM; nColor: Integer; Name, Prefix, Suffix: PChar) : Boolean; StdCall; FUNCTION cmsNamedColorIndex(xform: cmsHTRANSFORM; Name: PChar): Integer; StdCall; // PostScript ColorRenderingDictionary and ColorSpaceArray FUNCTION cmsGetPostScriptCSA(hProfile: cmsHPROFILE ; Intent: Integer; Buffer: Pointer; dwBufferLen: DWord): DWord; StdCall; FUNCTION cmsGetPostScriptCRD(hProfile: cmsHPROFILE ; Intent: Integer; Buffer: Pointer; dwBufferLen: DWord): DWord; StdCall; FUNCTION cmsGetPostScriptCRDEx(hProfile: cmsHPROFILE ; Intent: Integer; dwFlags: DWord; Buffer: Pointer; dwBufferLen: DWord): DWord; StdCall; // Gamut check PROCEDURE cmsSetAlarmCodes(r, g, b: Integer); StdCall; PROCEDURE cmsGetAlarmCodes(VAR r, g, b: Integer); StdCall; // Error handling CONST LCMS_ERROR_ABORT = 0; LCMS_ERROR_SHOW = 1; LCMS_ERROR_IGNORE = 2; PROCEDURE cmsErrorAction(nAction: Integer); StdCall; PROCEDURE cmsSetErrorHandler(ErrorHandler: cmsErrorHandler); StdCall; // CGATS.13 parser FUNCTION cmsIT8Alloc: LCMSHANDLE; StdCall; PROCEDURE cmsIT8Free(hIT8: LCMSHANDLE); StdCall; // Tables FUNCTION cmsIT8TableCount(hIT8: LCMSHANDLE): Integer; StdCall; FUNCTION cmsIT8SetTable(hIT8: LCMSHANDLE; nTable: Integer): Integer; StdCall; // Persistence FUNCTION cmsIT8LoadFromFile(cFileName: PChar): LCMSHANDLE; StdCall; FUNCTION cmsIT8LoadFromMem(Ptr: Pointer; size :DWord): LCMSHANDLE; StdCall; FUNCTION cmsIT8SaveToFile(hIT8: LCMSHANDLE; cFileName: PChar): Boolean; StdCall; // Properties FUNCTION cmsIT8GetSheetType(hIT8: LCMSHANDLE): PChar; StdCall; FUNCTION cmsIT8SetSheetType(hIT8: LCMSHANDLE; TheType: PChar): Boolean; StdCall; FUNCTION cmsIT8SetComment(hIT8: LCMSHANDLE; cComment: PChar): Boolean; StdCall; FUNCTION cmsIT8SetPropertyStr(hIT8: LCMSHANDLE; cProp, Str: PChar): Boolean; StdCall; FUNCTION cmsIT8SetPropertyDbl(hIT8: LCMSHANDLE; cProp: PChar; Val: Double): Boolean; StdCall; FUNCTION cmsIT8SetPropertyHex(hIT8: LCMSHANDLE; cProp: PChar; Val: Integer): Boolean; StdCall; FUNCTION cmsIT8SetPropertyUncooked(hIT8: LCMSHANDLE; Key, Buffer: PChar): Boolean; StdCall; FUNCTION cmsIT8GetProperty(hIT8: LCMSHANDLE; cProp: PChar): PChar; StdCall; FUNCTION cmsIT8GetPropertyDbl(hIT8: LCMSHANDLE; cProp: PChar): Double; StdCall; FUNCTION cmsIT8EnumProperties(hIT8: LCMSHANDLE; var PropertyNames: LCMSARRAYOFPCHAR): Integer; StdCall; // Datasets FUNCTION cmsIT8GetDataRowCol(hIT8: LCMSHANDLE; row, col: Integer): PChar; StdCall; FUNCTION cmsIT8GetDataRowColDbl(hIT8: LCMSHANDLE; row, col: Integer): Double; StdCall; FUNCTION cmsIT8SetDataRowCol(hIT8: LCMSHANDLE; row, col: Integer; Val: PChar): Boolean; StdCall; FUNCTION cmsIT8SetDataRowColDbl(hIT8: LCMSHANDLE; row, col: Integer; Val: Double): Boolean; StdCall; FUNCTION cmsIT8GetData(hIT8: LCMSHANDLE; cPatch, cSample: PChar): PChar; StdCall; FUNCTION cmsIT8GetDataDbl(hIT8: LCMSHANDLE;cPatch, cSample: PChar): Double; StdCall; FUNCTION cmsIT8SetData(hIT8: LCMSHANDLE; cPatch, cSample, Val: PChar): Boolean; StdCall; FUNCTION cmsIT8SetDataDbl(hIT8: LCMSHANDLE; cPatch, cSample: PChar; Val: Double): Boolean; StdCall; FUNCTION cmsIT8SetDataFormat(hIT8: LCMSHANDLE; n: Integer; Sample: PChar): Boolean; StdCall; FUNCTION cmsIT8EnumDataFormat(hIT8: LCMSHANDLE; var SampleNames: LCMSARRAYOFPCHAR): Integer; StdCall; FUNCTION cmsIT8GetPatchName(hIT8: LCMSHANDLE; nPatch: Integer; Buffer: PChar): PChar; StdCall; // The LABEL extension FUNCTION cmsIT8SetTableByLabel(hIT8: LCMSHANDLE; cSet, cField, ExpectedType: PChar): Integer; StdCall; // Provided for compatibility with anterior revisions PROCEDURE cmsLabEncoded2Float(Lab: LPcmsCIELab; wLab: Pointer); StdCall; PROCEDURE cmsFloat2LabEncoded(wLab: Pointer; Lab: LPcmsCIELab); StdCall; PROCEDURE cmsXYZEncoded2Float(fxyz : LPcmsCIEXYZ; XYZ: Pointer); StdCall; PROCEDURE cmsFloat2XYZEncoded(XYZ: Pointer; fXYZ: LPcmsCIEXYZ); StdCall; FUNCTION _cmsAddTextTag(hProfile: cmsHPROFILE; sig: icTagSignature; Text: PChar): Boolean; StdCall; FUNCTION _cmsAddXYZTag(hProfile: cmsHPROFILE; sig: icTagSignature; XYZ: LPcmsCIEXYZ): Boolean; StdCall; FUNCTION _cmsAddLUTTag(hProfile: cmsHPROFILE; sig: icTagSignature; lut: PByte): Boolean; StdCall; IMPLEMENTATION // Helping functions to build format descriptors (C uses them as macros) FUNCTION COLORSPACE_SH(e: Integer):Integer; BEGIN COLORSPACE_SH := ((e) shl 16) END; FUNCTION SWAPFIRST_SH(e: Integer):Integer; BEGIN SWAPFIRST_SH := ((e) shl 13) END; FUNCTION FLAVOR_SH(e: Integer):Integer; BEGIN FLAVOR_SH := ((e) shl 13) END; FUNCTION PLANAR_SH(e: Integer):Integer; BEGIN PLANAR_SH := ((e) shl 12) END; FUNCTION ENDIAN16_SH(e: Integer):Integer; BEGIN ENDIAN16_SH := ((e) shl 11) END; FUNCTION DOSWAP_SH(e: Integer):Integer; BEGIN DOSWAP_SH := ((e) shl 10) END; FUNCTION EXTRA_SH(e: Integer):Integer; BEGIN EXTRA_SH := ((e) shl 7) END; FUNCTION CHANNELS_SH(c: Integer):Integer; BEGIN CHANNELS_SH := ((c) shl 3) END; FUNCTION BYTES_SH(b: Integer):Integer; BEGIN BYTES_SH := (b) END; CONST PT_ANY = 0; // Don't check colorspace // 1 & 2 are reserved PT_GRAY = 3; PT_RGB = 4; PT_CMY = 5; PT_CMYK = 6; PT_YCbCr = 7; PT_YUV = 8; // Lu'v' PT_XYZ = 9; PT_Lab = 10; PT_YUVK = 11; // Lu'v'K PT_HSV = 12; PT_HLS = 13; PT_Yxy = 14; FUNCTION cmsOpenProfileFromFile(ICCProfile : PChar; sAccess: PChar) : cmsHPROFILE; EXTERNAL 'lcms.dll'; FUNCTION cmsOpenProfileFromMem(MemPtr: Pointer; dwSize: DWord) : cmsHPROFILE; EXTERNAL 'lcms.dll'; FUNCTION cmsWhitePointFromTemp(TempK: Integer; WhitePoint: LPcmsCIExyY) : Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsBuildGamma(nEntries : Integer; Gamma: Double) : LPGAMMATABLE; EXTERNAL 'lcms.dll'; FUNCTION cmsAllocGamma(nEntries : Integer): LPGAMMATABLE; EXTERNAL 'lcms.dll'; PROCEDURE cmsFreeGamma(Gamma: LPGAMMATABLE); EXTERNAL 'lcms.dll'; PROCEDURE cmsFreeGammaTriple(Gamma: ARRAY OF LPGAMMATABLE); EXTERNAL 'lcms.dll'; FUNCTION cmsReverseGamma(nResultSamples : Integer; InGamma : LPGAMMATABLE): LPGAMMATABLE; EXTERNAL 'lcms.dll'; FUNCTION cmsBuildParametricGamma(nEntries: Integer; TheType: Integer; Params: array of Double) : LPGAMMATABLE; EXTERNAL 'lcms.dll'; FUNCTION cmsJoinGamma(InGamma, OutGamma : LPGAMMATABLE): LPGAMMATABLE; EXTERNAL 'lcms.dll'; FUNCTION cmsJoinGammaEx(InGamma, OutGamma: LPGAMMATABLE; nPoints: Integer): LPGAMMATABLE; EXTERNAL 'lcms.dll'; FUNCTION cmsSmoothGamma(Gamma: LPGAMMATABLE; SmoothingLambda: Double): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsDupGamma(Src: LPGAMMATABLE): LPGAMMATABLE; EXTERNAL 'lcms.dll'; FUNCTION cmsEstimateGamma(Src: LPGAMMATABLE): Double; EXTERNAL 'lcms.dll'; FUNCTION cmsEstimateGammaEx(Src: LPGAMMATABLE; Thereshold: Double): Double; EXTERNAL 'lcms.dll'; FUNCTION cmsReadICCGamma(hProfile: cmsHPROFILE; Sig: icTagSignature): LPGAMMATABLE; EXTERNAL 'lcms.dll'; FUNCTION cmsReadICCGammaReversed(hProfile: cmsHPROFILE; Sig: icTagSignature): LPGAMMATABLE; EXTERNAL 'lcms.dll'; FUNCTION cmsCreateRGBProfile( WhitePoint : LPcmsCIExyY; Primaries: LPcmsCIExyYTRIPLE; TransferFunction: ARRAY OF LPGAMMATABLE) : cmsHPROFILE; EXTERNAL 'lcms.dll'; FUNCTION cmsCreateGrayProfile(WhitePoint: LPcmsCIExyY; TransferFunction: LPGAMMATABLE) : cmsHPROFILE; EXTERNAL 'lcms.dll'; FUNCTION cmsCreateLinearizationDeviceLink(ColorSpace: icColorSpaceSignature; TransferFunction: ARRAY OF LPGAMMATABLE) : cmsHPROFILE; EXTERNAL 'lcms.dll'; FUNCTION cmsCreateInkLimitingDeviceLink(ColorSpace: icColorSpaceSignature; Limit: Double) : cmsHPROFILE; EXTERNAL 'lcms.dll'; FUNCTION cmsCreateNULLProfile : cmsHPROFILE; EXTERNAL 'lcms.dll'; FUNCTION cmsCreateLabProfile(WhitePoint: LPcmsCIExyY): cmsHPROFILE; EXTERNAL 'lcms.dll'; FUNCTION cmsCreateLab4Profile(WhitePoint: LPcmsCIExyY): cmsHPROFILE; EXTERNAL 'lcms.dll'; FUNCTION cmsCreateXYZProfile: cmsHPROFILE; EXTERNAL 'lcms.dll'; FUNCTION cmsCreate_sRGBProfile: cmsHPROFILE; EXTERNAL 'lcms.dll'; FUNCTION cmsCreateBCHSWabstractProfile(nLUTPoints: Integer; Bright, Contrast, Hue, Saturation: Double; TempSrc, TempDest: Integer): cmsHPROFILE; EXTERNAL 'lcms.dll'; FUNCTION cmsCloseProfile( hProfile : cmsHPROFILE) : Boolean; EXTERNAL 'lcms.dll'; PROCEDURE cmsSetLanguage(LanguageCode: Integer; CountryCode: Integer); EXTERNAL 'lcms.dll'; FUNCTION cmsTakeMediaWhitePoint(Dest: LPcmsCIEXYZ; hProfile: cmsHPROFILE): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsTakeMediaBlackPoint(Dest: LPcmsCIEXYZ; hProfile: cmsHPROFILE): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsTakeIluminant(Dest: LPcmsCIEXYZ; hProfile: cmsHPROFILE): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsTakeColorants(Dest: LPcmsCIEXYZTRIPLE; hProfile: cmsHPROFILE): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsTakeHeaderFlags(hProfile: cmsHPROFILE): DWord; EXTERNAL 'lcms.dll'; FUNCTION cmsTakeProductName(hProfile: cmsHPROFILE): PChar; EXTERNAL 'lcms.dll'; FUNCTION cmsTakeProductDesc(hProfile: cmsHPROFILE): PChar; EXTERNAL 'lcms.dll'; FUNCTION cmsTakeManufacturer(hProfile: cmsHPROFILE): PChar; EXTERNAL 'lcms.dll'; FUNCTION cmsTakeModel(hProfile: cmsHPROFILE): PChar; EXTERNAL 'lcms.dll'; FUNCTION cmsTakeCopyright(hProfile: cmsHPROFILE): PChar; EXTERNAL 'lcms.dll'; FUNCTION cmsTakeProfileID(hProfile: cmsHPROFILE): PByte; EXTERNAL 'lcms.dll'; FUNCTION cmsIsTag(hProfile: cmsHPROFILE; sig: icTagSignature): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsTakeRenderingIntent( hProfile: cmsHPROFILE): Integer; EXTERNAL 'lcms.dll'; FUNCTION cmsGetPCS(hProfile: cmsHPROFILE): icColorSpaceSignature; EXTERNAL 'lcms.dll'; FUNCTION cmsGetColorSpace(hProfile: cmsHPROFILE): icColorSpaceSignature; EXTERNAL 'lcms.dll'; FUNCTION cmsGetDeviceClass( hProfile: cmsHPROFILE): icProfileClassSignature; EXTERNAL 'lcms.dll'; FUNCTION cmsGetProfileICCversion( hProfile: cmsHPROFILE): DWord; EXTERNAL 'lcms.dll'; FUNCTION cmsTakeCharTargetData(hProfile: cmsHPROFILE; var Data: PChar; var len: Cardinal): Boolean; EXTERNAL 'lcms.dll'; FUNCTION _cmsICCcolorSpace(OurNotation: Integer) : icColorSpaceSignature; EXTERNAL 'lcms.dll'; FUNCTION _cmsLCMScolorSpace(ProfileSpace: icColorSpaceSignature): Integer; EXTERNAL 'lcms.dll'; FUNCTION _cmsChannelsOf(ColorSpace: icColorSpaceSignature): Integer; EXTERNAL 'lcms.dll'; PROCEDURE cmsSetDeviceClass(hProfile: cmsHPROFILE; sig: icProfileClassSignature ); EXTERNAL 'lcms.dll'; PROCEDURE cmsSetColorSpace(hProfile: cmsHPROFILE; sig: icProfileClassSignature ); EXTERNAL 'lcms.dll'; PROCEDURE cmsSetPCS(hProfile: cmsHPROFILE; pcs: icColorSpaceSignature); EXTERNAL 'lcms.dll'; PROCEDURE cmsSetRenderingIntent(hProfile: cmsHPROFILE; Intent: Integer); EXTERNAL 'lcms.dll'; PROCEDURE cmsSetHeaderFlags(hProfile: cmsHPROFILE; dwFlags: DWord); EXTERNAL 'lcms.dll'; PROCEDURE cmsSetProfileID(hProfile: cmsHPROFILE; ProfileID: PByte); EXTERNAL 'lcms.dll'; FUNCTION cmsAddTag(hProfile: cmsHPROFILE; Sig: icTagSignature; Data: Pointer): Boolean; EXTERNAL 'lcms.dll'; FUNCTION _cmsSaveProfile(hProfile: cmsHPROFILE; FileName: PChar): Boolean; EXTERNAL 'lcms.dll'; FUNCTION _cmsSaveProfileToMem(hProfile: cmsHPROFILE; MemPtr: Pointer; var BytesNeeded: DWord): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsIsIntentSupported(hProfile: cmsHPROFILE; Intent, UsedDirection : Integer): Integer; EXTERNAL 'lcms.dll'; FUNCTION cmsCreateTransform(Input: cmsHPROFILE; InputFormat: DWORD; Output: cmsHPROFILE; OutputFormat: DWORD; Intent: Integer; dwFlags: DWord): cmsHTRANSFORM; EXTERNAL 'lcms.dll'; FUNCTION cmsCreateProofingTransform(Input: cmsHPROFILE; InputFormat: DWORD; Output: cmsHPROFILE; OutputFormat: DWORD; Proofing: cmsHPROFILE; Intent: Integer; ProofingIntent: Integer; dwFlags: DWord): cmsHTRANSFORM; EXTERNAL 'lcms.dll'; FUNCTION cmsCreateMultiprofileTransform(hProfiles : ARRAY OF cmsHPROFILE; nProfiles : Integer; InputFormat: DWord; OutputFormat: DWord; Intent: Integer; dwFlags: DWord): cmsHTRANSFORM; EXTERNAL 'lcms.dll'; PROCEDURE cmsDeleteTransform( hTransform: cmsHTRANSFORM); EXTERNAL 'lcms.dll'; PROCEDURE cmsDoTransform( Transform: cmsHTRANSFORM; InputBuffer: Pointer; OutputBuffer: Pointer; Size: LongInt); EXTERNAL 'lcms.dll'; PROCEDURE cmsChangeBuffersFormat(hTransform: cmsHTRANSFORM; dwInputFormat, dwOutputFormat: DWord); EXTERNAL 'lcms.dll'; FUNCTION cmsTransform2DeviceLink(hTransform: cmsHTRANSFORM; dwFlags: DWord): cmsHPROFILE; EXTERNAL 'lcms.dll'; PROCEDURE _cmsSetLUTdepth(hProfile: cmsHPROFILE; depth: Integer); EXTERNAL 'lcms.dll'; FUNCTION cmsNamedColorCount(xform: cmsHTRANSFORM): Integer; EXTERNAL 'lcms.dll'; FUNCTION cmsNamedColorInfo(xform: cmsHTRANSFORM; nColor: Integer; Name, Prefix, Suffix: PChar) : Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsNamedColorIndex(xform: cmsHTRANSFORM; Name: PChar): Integer; EXTERNAL 'lcms.dll'; FUNCTION cmsGetPostScriptCSA(hProfile: cmsHPROFILE ; Intent: Integer; Buffer: Pointer; dwBufferLen: DWord): DWord; EXTERNAL 'lcms.dll'; FUNCTION cmsGetPostScriptCRD(hProfile: cmsHPROFILE ; Intent: Integer; Buffer: Pointer; dwBufferLen: DWord): DWord; EXTERNAL 'lcms.dll'; FUNCTION cmsGetPostScriptCRDEx(hProfile: cmsHPROFILE ; Intent: Integer; dwFlags: DWord; Buffer: Pointer; dwBufferLen: DWord): DWord; EXTERNAL 'lcms.dll'; FUNCTION cmsCIECAM97sInit(pVC : LPcmsViewingConditions ) : Pointer; EXTERNAL 'lcms.dll'; PROCEDURE cmsCIECAM97sDone(hModel : Pointer); EXTERNAL 'lcms.dll'; PROCEDURE cmsCIECAM97sForward(hModel: Pointer; pIn: LPcmsCIEXYZ; pOut: LPcmsJCh ); EXTERNAL 'lcms.dll'; PROCEDURE cmsCIECAM97sReverse(hModel: Pointer; pIn: LPcmsJCh; pOut: LPcmsCIEXYZ ); EXTERNAL 'lcms.dll'; // CIECAM02 FUNCTION cmsCIECAM02Init(pVC : LPcmsViewingConditions ) : Pointer; EXTERNAL 'lcms.dll'; PROCEDURE cmsCIECAM02Done(hModel : Pointer); EXTERNAL 'lcms.dll'; PROCEDURE cmsCIECAM02Forward(hModel: Pointer; pIn: LPcmsCIEXYZ; pOut: LPcmsJCh ); EXTERNAL 'lcms.dll'; PROCEDURE cmsCIECAM02Reverse(hModel: Pointer; pIn: LPcmsJCh; pOut: LPcmsCIEXYZ ); EXTERNAL 'lcms.dll'; // Utils PROCEDURE cmsXYZ2xyY(Dest: LPcmsCIExyY; Source: LPcmsCIEXYZ); EXTERNAL 'lcms.dll'; PROCEDURE cmsxyY2XYZ(Dest: LPcmsCIEXYZ; Source: LPcmsCIExyY); EXTERNAL 'lcms.dll'; PROCEDURE cmsXYZ2Lab(WhitePoint: LPcmsCIEXYZ; xyz: LPcmsCIEXYZ; Lab: LPcmsCIELab); EXTERNAL 'lcms.dll'; PROCEDURE cmsLab2XYZ(WhitePoint: LPcmsCIEXYZ; Lab: LPcmsCIELab; xyz: LPcmsCIEXYZ); EXTERNAL 'lcms.dll'; PROCEDURE cmsLab2LCh(LCh: LPcmsCIELCh; Lab: LPcmsCIELab); EXTERNAL 'lcms.dll'; PROCEDURE cmsLCh2Lab(Lab: LPcmsCIELab; LCh: LPcmsCIELCh); EXTERNAL 'lcms.dll'; // CIELab handling FUNCTION cmsDeltaE(Lab1, Lab2: LPcmsCIELab): Double; EXTERNAL 'lcms.dll'; FUNCTION cmsCIE94DeltaE(Lab1, Lab2: LPcmsCIELab): Double; EXTERNAL 'lcms.dll'; FUNCTION cmsBFDdeltaE(Lab1, Lab2: LPcmsCIELab): Double; EXTERNAL 'lcms.dll'; FUNCTION cmsCMCdeltaE(Lab1, Lab2: LPcmsCIELab): Double; EXTERNAL 'lcms.dll'; FUNCTION cmsCIE2000DeltaE(Lab1, Lab2: LPcmsCIELab; Kl, Kc, Kh: Double): Double; StdCall; EXTERNAL 'lcms.dll'; PROCEDURE cmsClampLab(Lab: LPcmsCIELab; amax, amin, bmax, bmin: Double); EXTERNAL 'lcms.dll'; PROCEDURE cmsSetAlarmCodes(r, g, b: Integer); EXTERNAL 'lcms.dll'; PROCEDURE cmsGetAlarmCodes(VAR r, g, b: Integer); EXTERNAL 'lcms.dll'; PROCEDURE cmsErrorAction(nAction: Integer); EXTERNAL 'lcms.dll'; PROCEDURE cmsSetErrorHandler(ErrorHandler: cmsErrorHandler); EXTERNAL 'lcms.dll'; FUNCTION cmsIT8Alloc: LCMSHANDLE; EXTERNAL 'lcms.dll'; PROCEDURE cmsIT8Free(hIT8: LCMSHANDLE); EXTERNAL 'lcms.dll'; // Tables FUNCTION cmsIT8TableCount(hIT8: LCMSHANDLE): Integer; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8SetTable(hIT8: LCMSHANDLE; nTable: Integer): Integer; EXTERNAL 'lcms.dll'; // Persistence FUNCTION cmsIT8LoadFromFile(cFileName: PChar): LCMSHANDLE; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8LoadFromMem(Ptr: Pointer; size :DWord): LCMSHANDLE; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8SaveToFile(hIT8: LCMSHANDLE; cFileName: PChar): Boolean; EXTERNAL 'lcms.dll'; // Properties FUNCTION cmsIT8GetSheetType(hIT8: LCMSHANDLE): PChar; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8SetSheetType(hIT8: LCMSHANDLE; TheType: PChar): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8SetComment(hIT8: LCMSHANDLE; cComment: PChar): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8SetPropertyStr(hIT8: LCMSHANDLE; cProp, Str: PChar): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8SetPropertyDbl(hIT8: LCMSHANDLE; cProp: PChar; Val: Double): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8SetPropertyHex(hIT8: LCMSHANDLE; cProp: PChar; Val: Integer): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8SetPropertyUncooked(hIT8: LCMSHANDLE; Key, Buffer: PChar): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8GetProperty(hIT8: LCMSHANDLE; cProp: PChar): PChar; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8GetPropertyDbl(hIT8: LCMSHANDLE; cProp: PChar): Double; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8EnumProperties(hIT8: LCMSHANDLE; var PropertyNames: LCMSARRAYOFPCHAR): Integer; EXTERNAL 'lcms.dll'; // Datasets FUNCTION cmsIT8GetDataRowCol(hIT8: LCMSHANDLE; row, col: Integer): PChar; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8GetDataRowColDbl(hIT8: LCMSHANDLE; row, col: Integer): Double; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8SetDataRowCol(hIT8: LCMSHANDLE; row, col: Integer; Val: PChar): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8SetDataRowColDbl(hIT8: LCMSHANDLE; row, col: Integer; Val: Double): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8GetData(hIT8: LCMSHANDLE; cPatch, cSample: PChar): PChar; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8GetDataDbl(hIT8: LCMSHANDLE;cPatch, cSample: PChar): Double; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8SetData(hIT8: LCMSHANDLE; cPatch, cSample, Val: PChar): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8SetDataDbl(hIT8: LCMSHANDLE; cPatch, cSample: PChar; Val: Double): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8SetDataFormat(hIT8: LCMSHANDLE; n: Integer; Sample: PChar): Boolean; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8EnumDataFormat(hIT8: LCMSHANDLE; var SampleNames: LCMSARRAYOFPCHAR): Integer; EXTERNAL 'lcms.dll'; FUNCTION cmsIT8GetPatchName(hIT8: LCMSHANDLE; nPatch: Integer; Buffer: PChar): PChar; EXTERNAL 'lcms.dll'; // The LABEL extension FUNCTION cmsIT8SetTableByLabel(hIT8: LCMSHANDLE; cSet, cField, ExpectedType: PChar): Integer; EXTERNAL 'lcms.dll'; PROCEDURE cmsLabEncoded2Float(Lab: LPcmsCIELab; wLab: Pointer); EXTERNAL 'lcms.dll'; PROCEDURE cmsFloat2LabEncoded(wLab: Pointer; Lab: LPcmsCIELab); EXTERNAL 'lcms.dll'; PROCEDURE cmsXYZEncoded2Float(fxyz : LPcmsCIEXYZ; XYZ: Pointer); EXTERNAL 'lcms.dll'; PROCEDURE cmsFloat2XYZEncoded(XYZ: Pointer; fXYZ: LPcmsCIEXYZ); EXTERNAL 'lcms.dll'; FUNCTION _cmsAddTextTag(hProfile: cmsHPROFILE; sig: icTagSignature; Text: PChar): Boolean; EXTERNAL 'lcms.dll'; FUNCTION _cmsAddXYZTag(hProfile: cmsHPROFILE; sig: icTagSignature; XYZ: LPcmsCIEXYZ): Boolean; EXTERNAL 'lcms.dll'; FUNCTION _cmsAddLUTTag(hProfile: cmsHPROFILE; sig: icTagSignature; lut: PByte): Boolean; EXTERNAL 'lcms.dll'; END.
44.120968
160
0.633614
f1b467ae63ef873ae3a39322f8ec800cdaa22c71
2,604
pas
Pascal
KLib.Math.pas
atkins126/Delphi_Utils_Library
1fcce06d8c818dd2ec52dae3adc9958938ca8a61
[ "BSD-3-Clause-Clear" ]
null
null
null
KLib.Math.pas
atkins126/Delphi_Utils_Library
1fcce06d8c818dd2ec52dae3adc9958938ca8a61
[ "BSD-3-Clause-Clear" ]
null
null
null
KLib.Math.pas
atkins126/Delphi_Utils_Library
1fcce06d8c818dd2ec52dae3adc9958938ca8a61
[ "BSD-3-Clause-Clear" ]
null
null
null
{ KLib Version = 1.0 The Clear BSD License Copyright (c) 2020 by Karol De Nery Ortiz LLave. All rights reserved. zitrokarol@gmail.com Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) 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 the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. 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. } unit KLib.Math; interface uses System.Types; function distanceBetweenPoints(a: TPoint; b: TPoint): Double; overload; function distanceBetweenPoints(Xa: integer; Ya: integer; Xb: integer; Yb: integer): Double; overload; function megabyteToByte(MB: int64): int64; implementation uses KLib.Constants, System.Math; function distanceBetweenPoints(a: TPoint; b: TPoint): Double; overload; var Xa, Ya, Xb, Yb: integer; begin Xa := a.X; Ya := a.Y; Xb := b.X; Yb := b.Y; Result := distanceBetweenPoints(Xa, Ya, Xb, Yb); end; function distanceBetweenPoints(Xa: integer; Ya: integer; Xb: integer; Yb: integer): Double; overload; begin Result := sqrt(Power(Xa - Xb, 2) + Power(Ya - Yb, 2)); end; function megabyteToByte(MB: int64): int64; var bytes: int64; begin bytes := MB * _1_MB_IN_BYTES; Result := bytes; end; end.
32.55
101
0.75768
47297fd1f55897a9a037754d7ac2c3c4a8f3240f
7,245
dfm
Pascal
net.ssa/Editors/SceneProperties.dfm
ixray-team/xray-vss-archive
b245c8601dcefb505b4b51f58142da6769d4dc92
[ "Linux-OpenIB" ]
1
2022-03-26T17:00:19.000Z
2022-03-26T17:00:19.000Z
net.ssa/Editors/SceneProperties.dfm
ixray-team/xray-vss-archive
b245c8601dcefb505b4b51f58142da6769d4dc92
[ "Linux-OpenIB" ]
null
null
null
net.ssa/Editors/SceneProperties.dfm
ixray-team/xray-vss-archive
b245c8601dcefb505b4b51f58142da6769d4dc92
[ "Linux-OpenIB" ]
1
2022-03-26T17:00:21.000Z
2022-03-26T17:00:21.000Z
object frmSceneProperties: TfrmSceneProperties Left = 603 Top = 207 BorderStyle = bsDialog Caption = 'Build...' ClientHeight = 228 ClientWidth = 348 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] KeyPreview = True OldCreateOrder = False Position = poScreenCenter Scaled = False OnKeyDown = FormKeyDown OnShow = FormShow PixelsPerInch = 96 TextHeight = 13 object pcBuildOptions: TPageControl Left = 0 Top = 0 Width = 348 Height = 201 ActivePage = tsBuildStages Align = alTop HotTrack = True MultiLine = True TabOrder = 0 object tsBuildStages: TTabSheet Caption = 'Build stages' ImageIndex = 4 object cbTesselation: TCheckBox Left = 0 Top = 8 Width = 137 Height = 17 Alignment = taLeftJustify Caption = 'Tesselation' TabOrder = 0 OnClick = cbTesselationClick end object cbProgressive: TCheckBox Left = 0 Top = 24 Width = 137 Height = 17 Alignment = taLeftJustify Caption = 'Convert to progressive' TabOrder = 1 OnClick = cbProgressiveClick end object cbLightmaps: TCheckBox Left = 0 Top = 40 Width = 137 Height = 17 Alignment = taLeftJustify Caption = 'Calculate lightmaps' TabOrder = 2 OnClick = cbLightmapsClick end end object tsMainOptions: TTabSheet Caption = 'Main Options' object RxLabel1: TRxLabel Left = 4 Top = 12 Width = 60 Height = 13 Caption = 'Level name:' end object RxLabel2: TRxLabel Left = 5 Top = 34 Width = 55 Height = 13 Caption = 'Level path:' end object RxLabel3: TRxLabel Left = 5 Top = 58 Width = 95 Height = 13 Caption = 'Adititional level text:' end object edLevelName: TEdit Left = 72 Top = 8 Width = 263 Height = 21 TabOrder = 0 end object deLevelPath: TDirectoryEdit Left = 72 Top = 30 Width = 264 Height = 21 InitialDir = 'game\data\level' NumGlyphs = 1 TabOrder = 1 Text = 'level' end object mmText: TRichEdit Left = 0 Top = 80 Width = 340 Height = 75 Align = alBottom TabOrder = 2 end end object tsOptimizing: TTabSheet Caption = 'Optimizing' ImageIndex = 1 end object tsTesselation: TTabSheet Caption = 'Tesselation' ImageIndex = 2 object RxLabel4: TRxLabel Left = 2 Top = 10 Width = 66 Height = 13 Caption = 'Max edge (m)' end object seMaxEdge: TMultiObjSpinEdit Left = 72 Top = 8 Width = 121 Height = 18 Decimal = 1 Increment = 0.05 MaxValue = 1000 ValueType = vtFloat Value = 1 AutoSize = False TabOrder = 0 end end object tsLightmaps: TTabSheet Caption = 'Light maps' ImageIndex = 4 object RxLabel5: TRxLabel Left = 2 Top = 10 Width = 76 Height = 13 Caption = 'Pixels per meter' end object sePixelsPerMeter: TMultiObjSpinEdit Left = 88 Top = 8 Width = 121 Height = 18 Decimal = 1 MaxValue = 10000 ValueType = vtFloat Value = 20 AutoSize = False TabOrder = 0 end end object tsProgressive: TTabSheet Caption = 'Progressive' ImageIndex = 5 end object tsVertexBuffers: TTabSheet Caption = 'Vertex buffers' ImageIndex = 6 object RxLabel6: TRxLabel Left = 2 Top = 10 Width = 81 Height = 13 Caption = 'VB max size (kB)' end object RxLabel7: TRxLabel Left = 2 Top = 31 Width = 78 Height = 13 Caption = 'VB max vertices' end object seVBMaxSize: TMultiObjSpinEdit Left = 88 Top = 8 Width = 121 Height = 18 MaxValue = 1000000 Value = 64 AutoSize = False TabOrder = 0 end object seVBMaxVertices: TMultiObjSpinEdit Left = 88 Top = 29 Width = 121 Height = 18 MaxValue = 100000 Value = 4096 AutoSize = False TabOrder = 1 end end object tsSubdivision: TTabSheet Caption = 'Subdivision' ImageIndex = 7 object RxLabel8: TRxLabel Left = 2 Top = 10 Width = 92 Height = 13 Caption = 'Max object size (m)' end object seMaxSize: TMultiObjSpinEdit Left = 96 Top = 8 Width = 121 Height = 18 Decimal = 1 MaxValue = 1000 ValueType = vtFloat Value = 16 AutoSize = False TabOrder = 0 end end object tsVisibility: TTabSheet Caption = 'Visibility' ImageIndex = 8 object RxLabel9: TRxLabel Left = 2 Top = 10 Width = 76 Height = 13 Caption = 'VIS slot size (m)' end object RxLabel10: TRxLabel Left = 2 Top = 31 Width = 85 Height = 13 Caption = 'View distance (m)' end object seRelevance: TMultiObjSpinEdit Left = 96 Top = 8 Width = 121 Height = 18 Decimal = 1 MaxValue = 1000 ValueType = vtFloat Value = 10 AutoSize = False TabOrder = 0 end object seViewDist: TMultiObjSpinEdit Left = 96 Top = 29 Width = 121 Height = 18 Decimal = 1 MaxValue = 1000 ValueType = vtFloat Value = 100 AutoSize = False TabOrder = 1 end end end object btOk: TButton Left = 160 Top = 205 Width = 89 Height = 20 Caption = 'Ok' ModalResult = 1 TabOrder = 1 OnClick = btContinueClick end object btCancel: TButton Left = 256 Top = 205 Width = 89 Height = 20 Caption = 'Cancel' ModalResult = 2 TabOrder = 2 end object fsSceneProps: TFormStorage IniSection = 'Build Options' Options = [] RegistryRoot = prLocalMachine StoredProps.Strings = ( 'cbLightmaps.Checked' 'cbProgressive.Checked' 'cbTesselation.Checked' 'seMaxEdge.Value' 'seMaxSize.Value' 'sePixelsPerMeter.Value' 'seRelevance.Value' 'seVBMaxSize.Value' 'seVBMaxVertices.Value' 'seViewDist.Value') StoredValues = <> Left = 4 Top = 2 end end
23.146965
49
0.511111
f1e4462b6a839d294c0a8de39eff82c8fad26ae2
2,061
pas
Pascal
windows/src/ext/jedi/jvcl/tests/restructured/examples/ChangeNotification/Unit2.pas
bravogeorge/keyman
c0797e36292de903d7313214d1f765e3d9a2bf4d
[ "MIT" ]
219
2017-06-21T03:37:03.000Z
2022-03-27T12:09:28.000Z
windows/src/ext/jedi/jvcl/tests/restructured/examples/ChangeNotification/Unit2.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/restructured/examples/ChangeNotification/Unit2.pas
bravogeorge/keyman
c0797e36292de903d7313214d1f765e3d9a2bf4d
[ "MIT" ]
72
2017-05-26T04:08:37.000Z
2022-03-03T10:26:20.000Z
unit Unit2; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, JvChangeNotify; type TForm2 = class(TForm) Edit1: TEdit; Button1: TButton; Label1: TLabel; GroupBox1: TGroupBox; cbAttributes: TCheckBox; cbDirNames: TCheckBox; cbFileNames: TCheckBox; cbSize: TCheckBox; cbWrite: TCheckBox; cbSubTrees: TCheckBox; btnOK: TButton; Button3: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } class function Execute(var Directory: string; var Options: TJvChangeActions; var IncludeSubDirs: boolean): boolean; end; implementation uses FileCtrl; {$R *.DFM} procedure TForm2.Button1Click(Sender: TObject); var S: string; begin S := GetCurrentDir; if SelectDirectory(S, [sdAllowCreate, sdPerformCreate, sdPrompt], 0) then Edit1.Text := S; end; class function TForm2.Execute(var Directory: string; var Options: TJvChangeActions; var IncludeSubDirs: boolean): boolean; var f: TForm2; begin f := self.Create(Application); with f do try Edit1.Text := Directory; cbFileNames.Checked := caChangeFileName in Options; cbAttributes.Checked := caChangeAttributes in Options; cbDirNames.Checked := caChangeDirName in Options; cbSize.Checked := caChangeSize in Options; cbWrite.Checked := caChangeLastWrite in Options; cbSubTrees.Checked := IncludeSubDirs; Result := ShowModal = mrOK; if Result then begin Directory := Edit1.Text; Options := []; if cbFileNames.Checked then Include(Options, caChangeFileName); if cbAttributes.Checked then Include(Options, caChangeAttributes); if cbDirNames.Checked then Include(Options, caChangeDirName); if cbSize.Checked then Include(Options, caChangeSize); if cbWrite.Checked then Include(Options, caChangeLastWrite); IncludeSubDirs := cbSubTrees.Checked; end; finally f.Free; end; end; end.
24.535714
119
0.699175
6aa1604fc3c5a3f3e4388397ff3158749d3f5a11
317
pas
Pascal
tests/test5.pas
jmais/Haskell-Interpreter
88b014f4f3d69b3848235dd8b08cd0d2d59a33ab
[ "MIT" ]
null
null
null
tests/test5.pas
jmais/Haskell-Interpreter
88b014f4f3d69b3848235dd8b08cd0d2d59a33ab
[ "MIT" ]
null
null
null
tests/test5.pas
jmais/Haskell-Interpreter
88b014f4f3d69b3848235dd8b08cd0d2d59a33ab
[ "MIT" ]
null
null
null
program x; var x : real = 1.0; var y : real = 0.0; begin while x < 5.0 do begin x:= x + 1.0; while y < 4.0 do begin y := y+1.0; writeln(y); end; writeln(x); end; end; (* Output should be R 1.0 R 2.0 R 3.0 R 4.0 R 2.0 R 3.0 R 4.0 R 5.0 *)
11.321429
25
0.422713
f1a44997b73a38e974bfd2fd0f5515074cb7e798
24,237
dfm
Pascal
Client/rOccupationPrcDataReport.dfm
Sembium/Sembium3
0179c38c6a217f71016f18f8a419edd147294b73
[ "Apache-2.0" ]
null
null
null
Client/rOccupationPrcDataReport.dfm
Sembium/Sembium3
0179c38c6a217f71016f18f8a419edd147294b73
[ "Apache-2.0" ]
null
null
null
Client/rOccupationPrcDataReport.dfm
Sembium/Sembium3
0179c38c6a217f71016f18f8a419edd147294b73
[ "Apache-2.0" ]
3
2021-06-30T10:11:17.000Z
2021-07-01T09:13:29.000Z
inherited rptOccupationPrcDataReport: TrptOccupationPrcDataReport Functions.DATA = ( '0' '0' #39#39 #39#39) Page.Values = ( 100.000000000000000000 2970.000000000000000000 100.000000000000000000 2100.000000000000000000 100.000000000000000000 100.000000000000000000 0.000000000000000000) inherited bndPageFooter: TQRBand Top = 201 Size.Values = ( 71.437500000000000000 1899.708333333333000000) inherited qrsDataAndTime: TQRSysData Size.Values = ( 44.979166666666670000 211.666666666666700000 21.166666666666670000 568.854166666666700000) FontSize = 8 end inherited qrsPageNum: TQRSysData Size.Values = ( 44.979166666666670000 1717.145833333333000000 21.166666666666670000 182.562500000000000000) FontSize = 8 end inherited lblPrintedByApp1: TQRLabel Size.Values = ( 44.979166666666670000 7.937500000000000000 21.166666666666670000 26.458333333333330000) FontSize = 10 end inherited lblPrintedByApp2: TQRLabel Size.Values = ( 47.625000000000000000 29.104166666666670000 18.520833333333330000 29.104166666666670000) FontSize = 11 end inherited lblPrintedByApp3: TQRLabel Size.Values = ( 44.979166666666670000 58.208333333333330000 21.166666666666670000 79.375000000000000000) FontSize = 10 end end inherited bndDetail: TQRBand Top = 181 Size.Values = ( 52.916666666666670000 1899.708333333333000000) inherited shpNodeIdentifier: TQRShape Size.Values = ( 52.916666666666670000 47.625000000000000000 0.000000000000000000 722.312500000000000000) end inherited imgNodeIcon: TQRImage Size.Values = ( 42.333333333333330000 2.645833333333333000 5.291666666666667000 42.333333333333330000) end inherited dbtNodeIdentifier: TQRDBText Size.Values = ( 44.979166666666670000 52.916666666666670000 2.645833333333333000 711.729166666666700000) FontSize = 10 end inherited shpParentLine1: TQRShape Size.Values = ( 58.208333333333330000 762.000000000000000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine2: TQRShape Size.Values = ( 58.208333333333330000 783.166666666666700000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine3: TQRShape Size.Values = ( 58.208333333333330000 804.333333333333300000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine4: TQRShape Size.Values = ( 58.208333333333330000 825.500000000000000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine5: TQRShape Size.Values = ( 58.208333333333330000 846.666666666666700000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine6: TQRShape Size.Values = ( 58.208333333333330000 867.833333333333300000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine7: TQRShape Size.Values = ( 58.208333333333330000 889.000000000000000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine8: TQRShape Size.Values = ( 58.208333333333330000 910.166666666666700000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine50: TQRShape Size.Values = ( 58.208333333333330000 1799.166666666667000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine49: TQRShape Size.Values = ( 58.208333333333330000 1778.000000000000000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine48: TQRShape Size.Values = ( 58.208333333333330000 1756.833333333333000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine47: TQRShape Size.Values = ( 58.208333333333330000 1735.666666666667000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine46: TQRShape Size.Values = ( 58.208333333333330000 1714.500000000000000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine45: TQRShape Size.Values = ( 58.208333333333330000 1693.333333333333000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine44: TQRShape Size.Values = ( 58.208333333333330000 1672.166666666667000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine43: TQRShape Size.Values = ( 58.208333333333330000 1651.000000000000000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine41: TQRShape Size.Values = ( 58.208333333333330000 1608.666666666667000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine40: TQRShape Size.Values = ( 58.208333333333330000 1587.500000000000000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine22: TQRShape Size.Values = ( 58.208333333333330000 1206.500000000000000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine19: TQRShape Size.Values = ( 58.208333333333330000 1143.000000000000000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine10: TQRShape Size.Values = ( 58.208333333333330000 952.500000000000000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine9: TQRShape Size.Values = ( 58.208333333333330000 931.333333333333300000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine11: TQRShape Size.Values = ( 58.208333333333330000 973.666666666666700000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine12: TQRShape Size.Values = ( 58.208333333333330000 994.833333333333300000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine13: TQRShape Size.Values = ( 58.208333333333330000 1016.000000000000000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine14: TQRShape Size.Values = ( 58.208333333333330000 1037.166666666667000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine15: TQRShape Size.Values = ( 58.208333333333330000 1058.333333333333000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine16: TQRShape Size.Values = ( 58.208333333333330000 1079.500000000000000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine17: TQRShape Size.Values = ( 58.208333333333330000 1100.666666666667000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine18: TQRShape Size.Values = ( 58.208333333333330000 1121.833333333333000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine20: TQRShape Size.Values = ( 58.208333333333330000 1164.166666666667000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine21: TQRShape Size.Values = ( 58.208333333333330000 1185.333333333333000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine23: TQRShape Size.Values = ( 58.208333333333330000 1227.666666666667000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine24: TQRShape Size.Values = ( 58.208333333333330000 1248.833333333333000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine25: TQRShape Size.Values = ( 58.208333333333330000 1270.000000000000000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine26: TQRShape Size.Values = ( 58.208333333333330000 1291.166666666667000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine29: TQRShape Size.Values = ( 58.208333333333330000 1354.666666666667000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine31: TQRShape Size.Values = ( 58.208333333333330000 1397.000000000000000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine33: TQRShape Size.Values = ( 58.208333333333330000 1439.333333333333000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine35: TQRShape Size.Values = ( 58.208333333333330000 1481.666666666667000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine37: TQRShape Size.Values = ( 58.208333333333330000 1524.000000000000000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine39: TQRShape Size.Values = ( 58.208333333333330000 1566.333333333333000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine38: TQRShape Size.Values = ( 58.208333333333330000 1545.166666666667000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine36: TQRShape Size.Values = ( 58.208333333333330000 1502.833333333333000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine42: TQRShape Size.Values = ( 58.208333333333330000 1629.833333333333000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine34: TQRShape Size.Values = ( 58.208333333333330000 1460.500000000000000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine32: TQRShape Size.Values = ( 58.208333333333330000 1418.166666666667000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine30: TQRShape Size.Values = ( 58.208333333333330000 1375.833333333333000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine28: TQRShape Size.Values = ( 58.208333333333330000 1333.500000000000000000 -2.645833333333333000 13.229166666666670000) end inherited shpParentLine27: TQRShape Size.Values = ( 58.208333333333330000 1312.333333333333000000 -2.645833333333333000 13.229166666666670000) end inherited shpVertLine: TQRShape Size.Values = ( 26.458333333333330000 687.916666666666700000 0.000000000000000000 13.229166666666670000) end inherited QRShape2: TQRShape Width = 295 Size.Values = ( 52.916666666666670000 767.291666666666700000 0.000000000000000000 780.520833333333300000) end inherited dbtPrcObjectName: TQRDBText Width = 291 Size.Values = ( 44.979166666666670000 772.583333333333300000 2.645833333333333000 769.937500000000000000) FontSize = 10 end inherited shpHorLine: TQRShape Size.Values = ( 37.041666666666670000 706.437500000000000000 7.937500000000000000 42.333333333333330000) end object QRShape12: TQRShape Left = 584 Top = 0 Width = 131 Height = 20 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False Size.Values = ( 52.916666666666670000 1545.166666666667000000 0.000000000000000000 346.604166666666700000) Shape = qrsRectangle VertAdjust = 0 end object QRDBText5: TQRDBText Left = 586 Top = 1 Width = 127 Height = 17 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False Size.Values = ( 44.979166666666670000 1550.458333333333000000 2.645833333333333000 336.020833333333300000) Alignment = taLeftJustify AlignToBand = False AutoSize = False AutoStretch = False Color = clWhite DataSet = mdsReport DataField = '_PRINT_DATE_INTERVAL' Transparent = False WordWrap = True ExportAs = exptText FontSize = 10 end end inherited PageHeaderBand1: TQRBand Top = 161 Size.Values = ( 52.916666666666670000 1899.708333333333000000) inherited QRShape3: TQRShape Width = 295 Size.Values = ( 52.916666666666670000 767.291666666666700000 0.000000000000000000 780.520833333333300000) end inherited QRShape5: TQRShape Size.Values = ( 52.916666666666670000 2.645833333333333000 0.000000000000000000 767.291666666666700000) end inherited QRLabel1: TQRLabel Size.Values = ( 44.979166666666670000 7.937500000000000000 2.645833333333333000 756.708333333333300000) FontSize = 10 end inherited QRLabel3: TQRLabel Width = 291 Size.Values = ( 44.979166666666670000 772.583333333333300000 2.645833333333333000 769.937500000000000000) FontSize = 10 end object QRShape8: TQRShape Left = 584 Top = 0 Width = 131 Height = 20 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False Size.Values = ( 52.916666666666670000 1545.166666666667000000 0.000000000000000000 346.604166666666700000) Shape = qrsRectangle VertAdjust = 0 end object QRLabel8: TQRLabel Left = 586 Top = 1 Width = 127 Height = 17 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False Size.Values = ( 44.979166666666670000 1550.458333333333000000 2.645833333333333000 336.020833333333300000) Alignment = taCenter AlignToBand = False AutoSize = False AutoStretch = False Caption = #1042#1088#1077#1084#1077#1074#1080' '#1048#1085#1090#1077#1088#1074#1072#1083 Color = clWhite Transparent = False WordWrap = True ExportAs = exptText FontSize = 10 end end object TitleBand1: TQRBand [3] Left = 38 Top = 38 Width = 718 Height = 123 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False AlignToBottom = False Color = clWhite TransparentBand = False ForceNewColumn = False ForceNewPage = False Size.Values = ( 325.437500000000000000 1899.708333333333000000) PreCaluculateBandHeight = False KeepOnOnePage = False BandType = rbTitle object QRLabel4: TQRLabel Left = 0 Top = 8 Width = 705 Height = 25 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False Size.Values = ( 66.145833333333330000 0.000000000000000000 21.166666666666670000 1865.312500000000000000) Alignment = taCenter AlignToBand = False AutoSize = False AutoStretch = False Caption = #1055#1088#1086#1094#1077#1089#1077#1085' '#1054#1073#1093#1074#1072#1090' '#1085#1072' '#1044#1083#1098#1078#1085#1086#1089#1090 Color = clWhite Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -19 Font.Name = 'Arial' Font.Style = [] ParentFont = False Transparent = False WordWrap = True ExportAs = exptText FontSize = 14 end object QRShape6: TQRShape Left = 0 Top = 40 Width = 715 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False Size.Values = ( 171.979166666666700000 0.000000000000000000 105.833333333333300000 1891.770833333333000000) Shape = qrsRectangle VertAdjust = 0 end object QRShape7: TQRShape Left = 5 Top = 75 Width = 140 Height = 21 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False Size.Values = ( 55.562500000000000000 13.229166666666670000 198.437500000000000000 370.416666666666700000) Shape = qrsRectangle VertAdjust = 0 end object QRDBText3: TQRDBText Left = 7 Top = 77 Width = 136 Height = 17 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False Size.Values = ( 44.979166666666670000 18.520833333333330000 203.729166666666700000 359.833333333333300000) Alignment = taLeftJustify AlignToBand = False AutoSize = False AutoStretch = False Color = clWhite DataSet = mdsParams DataField = '_OCCUPATION_STATUS_ABBREV' Transparent = False WordWrap = True ExportAs = exptText FontSize = 10 end object QRLabel6: TQRLabel Left = 5 Top = 57 Width = 134 Height = 17 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False Size.Values = ( 44.979166666666670000 13.229166666666670000 150.812500000000000000 354.541666666666700000) Alignment = taLeftJustify AlignToBand = False AutoSize = True AutoStretch = False Caption = #1057#1090#1072#1090#1091#1089' '#1085#1072' '#1044#1083#1098#1078#1085#1086#1089#1090#1090#1072 Color = clWhite Transparent = False WordWrap = True ExportAs = exptText FontSize = 10 end object QRShape10: TQRShape Left = 155 Top = 75 Width = 94 Height = 21 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False Size.Values = ( 55.562500000000000000 410.104166666666700000 198.437500000000000000 248.708333333333300000) Shape = qrsRectangle VertAdjust = 0 end object QRDBText6: TQRDBText Left = 157 Top = 77 Width = 90 Height = 17 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False Size.Values = ( 44.979166666666670000 415.395833333333300000 203.729166666666700000 238.125000000000000000) Alignment = taLeftJustify AlignToBand = False AutoSize = False AutoStretch = False Color = clWhite DataSet = mdsParams DataField = 'IS_MAIN' Transparent = False WordWrap = True ExportAs = exptText FontSize = 10 end object QRLabel9: TQRLabel Left = 155 Top = 57 Width = 88 Height = 17 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False Size.Values = ( 44.979166666666670000 410.104166666666700000 150.812500000000000000 232.833333333333300000) Alignment = taLeftJustify AlignToBand = False AutoSize = True AutoStretch = False Caption = #1042#1080#1076' '#1044#1083#1098#1078#1085#1086#1089#1090 Color = clWhite Transparent = False WordWrap = True ExportAs = exptText FontSize = 10 end object QRShape11: TQRShape Left = 259 Top = 75 Width = 450 Height = 21 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False Size.Values = ( 55.562500000000000000 685.270833333333300000 198.437500000000000000 1190.625000000000000000) Shape = qrsRectangle VertAdjust = 0 end object QRDBText7: TQRDBText Left = 261 Top = 77 Width = 446 Height = 17 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False Size.Values = ( 44.979166666666670000 690.562500000000000000 203.729166666666700000 1180.041666666667000000) Alignment = taLeftJustify AlignToBand = False AutoSize = False AutoStretch = False Color = clWhite DataSet = mdsParams DataField = 'OCCUPATION_NAME' Transparent = False WordWrap = True ExportAs = exptText FontSize = 10 end object QRLabel10: TQRLabel Left = 259 Top = 57 Width = 160 Height = 17 Frame.Color = clBlack Frame.DrawTop = False Frame.DrawBottom = False Frame.DrawLeft = False Frame.DrawRight = False Size.Values = ( 44.979166666666670000 685.270833333333300000 150.812500000000000000 423.333333333333300000) Alignment = taLeftJustify AlignToBand = False AutoSize = True AutoStretch = False Caption = #1044#1083#1098#1078#1085#1086#1089#1090' - '#1053#1072#1080#1084#1077#1085#1086#1074#1072#1085#1080#1077 Color = clWhite Transparent = False WordWrap = True ExportAs = exptText FontSize = 10 end end end
27.479592
146
0.608904
6a411f05d7e813ed5d62fe3c45996199d32edac3
512
pas
Pascal
code/uloha1.pas
petak5/INF4
6be309583ae4b743b0906c8c2b75392532bf48a4
[ "MIT" ]
null
null
null
code/uloha1.pas
petak5/INF4
6be309583ae4b743b0906c8c2b75392532bf48a4
[ "MIT" ]
null
null
null
code/uloha1.pas
petak5/INF4
6be309583ae4b743b0906c8c2b75392532bf48a4
[ "MIT" ]
null
null
null
program uloha1; var i, min, max, temp: integer; arr: array[1 .. 10] of integer; begin randomize; min := 1; max := 1; for i := 1 to 10 do arr[i] := random(30) + 1; for i := 1 to 10 do begin write(arr[i], ' '); if (arr[i] > arr[max]) then max := i else if (arr[i] < arr[min]) then min := i; end; writeln(#10, 'The maximum is ', arr[max]); writeln('The minimum is ', arr[min]); temp := arr[max]; arr[max] := arr[min]; arr[min] := temp; for i := 1 to 10 do write(arr[i], ' '); writeln; end.
18.962963
46
0.558594
6a16c6a4486dbce097e13b6686acb20d789eea8c
277
dpr
Pascal
arquivos/Componentes Nativos - iOS/Demos/FacebookSlideMenu/iOSFBSlidMenu.dpr
leovieira/sistema-de-gerenciamento-de-eventos
07262f670852db666b418d3bbdbfcf7800650481
[ "MIT" ]
null
null
null
arquivos/Componentes Nativos - iOS/Demos/FacebookSlideMenu/iOSFBSlidMenu.dpr
leovieira/sistema-de-gerenciamento-de-eventos
07262f670852db666b418d3bbdbfcf7800650481
[ "MIT" ]
null
null
null
arquivos/Componentes Nativos - iOS/Demos/FacebookSlideMenu/iOSFBSlidMenu.dpr
leovieira/sistema-de-gerenciamento-de-eventos
07262f670852db666b418d3bbdbfcf7800650481
[ "MIT" ]
null
null
null
Program iOSFBSlidMenu; uses System.StartUpCopy, FMX.Forms, uMain in 'uMain.pas' {FPanGestureRecognizer}; {$I DPF.iOS.Defs.inc} {$R *.res} Begin Application.Initialize; Application.CreateForm(TFPanGestureRecognizer, FPanGestureRecognizer); Application.Run; End.
16.294118
72
0.758123
47002a44194878717875791bddcd08d26cb020d2
3,577
pas
Pascal
Procesos/AjustesSalidasItemsForm.pas
NetVaIT/MAS
ebdbf2dc8ca6405186683eb713b9068322feb675
[ "Apache-2.0" ]
null
null
null
Procesos/AjustesSalidasItemsForm.pas
NetVaIT/MAS
ebdbf2dc8ca6405186683eb713b9068322feb675
[ "Apache-2.0" ]
null
null
null
Procesos/AjustesSalidasItemsForm.pas
NetVaIT/MAS
ebdbf2dc8ca6405186683eb713b9068322feb675
[ "Apache-2.0" ]
null
null
null
unit AjustesSalidasItemsForm; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, _StandarGFormGrid, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxStyles, 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, cxCustomData, cxFilter, cxData, cxDataStorage, cxEdit, cxNavigator, Data.DB, cxDBData, Vcl.Menus, cxGridCustomPopupMenu, cxGridPopupMenu, cxClasses, Vcl.StdActns, Vcl.DBActns, System.Actions, Vcl.ActnList, Vcl.ImgList, Vcl.ComCtrls, Vcl.ToolWin, cxGridLevel, cxGridCustomView, cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid, Vcl.ExtCtrls, cxButtonEdit; type TfrmAjustesSalidasItemsForm = class(T_frmStandarGFormGrid) tvMasterIdOrdenSalidaItem: TcxGridDBColumn; tvMasterIdOrdenSalida: TcxGridDBColumn; tvMasterIdProducto: TcxGridDBColumn; tvMasterIdUnidadMedida: TcxGridDBColumn; tvMasterClaveProducto: TcxGridDBColumn; tvMasterCantidadDespachada: TcxGridDBColumn; tvMasterCantidadSolicitada: TcxGridDBColumn; tvMasterPrecio: TcxGridDBColumn; tvMasterImporte: TcxGridDBColumn; tvMasterObservaciones: TcxGridDBColumn; tvMasterCostoUnitario: TcxGridDBColumn; tvMasterProducto: TcxGridDBColumn; cxTblVwMaster2: TcxGridDBTableView; cxTblVwMaster2Cantidad: TcxGridDBColumn; cxTblVwMaster2Producto: TcxGridDBColumn; cxTblVwMaster2Disponible: TcxGridDBColumn; cxTblVwMaster2EspacioA: TcxGridDBColumn; procedure FormCreate(Sender: TObject); procedure tvMasterCellDblClick(Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean); private FactSeleccionarProducto: TBasicAction; procedure SetactSeleccionarProducto(const Value: TBasicAction); { Private declarations } public { Public declarations } property actSeleccionarProducto: TBasicAction read FactSeleccionarProducto write SetactSeleccionarProducto; end; implementation {$R *.dfm} uses AjustesSalidasDM; { TfrmAjustesSalidasItemsForm } procedure TfrmAjustesSalidasItemsForm.FormCreate(Sender: TObject); begin inherited; ApplyBestFit:= False; end; procedure TfrmAjustesSalidasItemsForm.SetactSeleccionarProducto( const Value: TBasicAction); begin FactSeleccionarProducto := Value; tvMasterClaveProducto.Properties.Buttons[0].Action:= Value; end; procedure TfrmAjustesSalidasItemsForm.tvMasterCellDblClick( Sender: TcxCustomGridTableView; ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton; AShift: TShiftState; var AHandled: Boolean); begin // end; end.
38.880435
112
0.800671
f1d6e2fb4b7cd44d5bb3b321d7186eeebe7ce899
3,826
dpr
Pascal
MemLeakTest/Leaktest.dpr
cutec-chris/ZXing.Lazarus
92700169edfc911d03ce8a60b4ff2711a7dccbac
[ "Apache-2.0" ]
2
2019-09-28T05:47:00.000Z
2020-04-29T10:10:41.000Z
MemLeakTest/Leaktest.dpr
gkobler/ZXing.Delphi
1306e37da6eaad2feb090dd2d7b8fb1660a35817
[ "Apache-2.0" ]
null
null
null
MemLeakTest/Leaktest.dpr
gkobler/ZXing.Delphi
1306e37da6eaad2feb090dd2d7b8fb1660a35817
[ "Apache-2.0" ]
1
2021-08-04T12:35:31.000Z
2021-08-04T12:35:31.000Z
program Leaktest; uses EMemLeaks, EResLeaks, EDialogWinAPIMSClassic, EDialogWinAPIEurekaLogDetailed, EDialogWinAPIStepsToReproduce, EDebugExports, EDebugJCL, EFixSafeCallException, EMapWin32, EAppFMX, ExceptionLog7, System.StartUpCopy, FMX.Forms, MainForm in 'MainForm.pas' {Form2}, Code93Reader in '..\Lib\Classes\1D Barcodes\Code93Reader.pas', Code128Reader in '..\Lib\Classes\1D Barcodes\Code128Reader.pas', ITFReader in '..\Lib\Classes\1D Barcodes\ITFReader.pas', MultiFormatOneDReader in '..\Lib\Classes\1D Barcodes\MultiFormatOneDReader.pas', OneDReader in '..\Lib\Classes\1D Barcodes\OneDReader.pas', Reader in '..\Lib\Classes\1D Barcodes\Reader.pas', BitMatrixParser in '..\Lib\Classes\2D Barcodes\Decoder\BitMatrixParser.pas', Datablock in '..\Lib\Classes\2D Barcodes\Decoder\Datablock.pas', Datamask in '..\Lib\Classes\2D Barcodes\Decoder\Datamask.pas', DecodedBitStreamParser in '..\Lib\Classes\2D Barcodes\Decoder\DecodedBitStreamParser.pas', ErrorCorrectionLevel in '..\Lib\Classes\2D Barcodes\Decoder\ErrorCorrectionLevel.pas', FormatInformation in '..\Lib\Classes\2D Barcodes\Decoder\FormatInformation.pas', GenericGF in '..\Lib\Classes\2D Barcodes\Decoder\GenericGF.pas', Mode in '..\Lib\Classes\2D Barcodes\Decoder\Mode.pas', QRCodeDecoderMetadata in '..\Lib\Classes\2D Barcodes\Decoder\QRCodeDecoderMetadata.pas', QRDecoder in '..\Lib\Classes\2D Barcodes\Decoder\QRDecoder.pas', ReedSolomonDecoder in '..\Lib\Classes\2D Barcodes\Decoder\ReedSolomonDecoder.pas', Version in '..\Lib\Classes\2D Barcodes\Decoder\Version.pas', AlignmentPattern in '..\Lib\Classes\2D Barcodes\Detector\AlignmentPattern.pas', AlignmentPatternFinder in '..\Lib\Classes\2D Barcodes\Detector\AlignmentPatternFinder.pas', Detector in '..\Lib\Classes\2D Barcodes\Detector\Detector.pas', FinderPattern in '..\Lib\Classes\2D Barcodes\Detector\FinderPattern.pas', FinderPatternFinder in '..\Lib\Classes\2D Barcodes\Detector\FinderPatternFinder.pas', FinderPatternInfo in '..\Lib\Classes\2D Barcodes\Detector\FinderPatternInfo.pas', QRCodeReader in '..\Lib\Classes\2D Barcodes\QRCodeReader.pas', BarcodeFormat in '..\Lib\Classes\Common\BarcodeFormat.pas', BitArray in '..\Lib\Classes\Common\BitArray.pas', Bitmatrix in '..\Lib\Classes\Common\Bitmatrix.pas', BitSource in '..\Lib\Classes\Common\BitSource.pas', CharacterSetECI in '..\Lib\Classes\Common\CharacterSetECI.pas', DecodeHintType in '..\Lib\Classes\Common\DecodeHintType.pas', DecoderResult in '..\Lib\Classes\Common\DecoderResult.pas', DefaultGridSampler in '..\Lib\Classes\Common\DefaultGridSampler.pas', DetectorResult in '..\Lib\Classes\Common\DetectorResult.pas', Helpers in '..\Lib\Classes\Common\Helpers.pas', MathUtils in '..\Lib\Classes\Common\MathUtils.pas', MultiFormatReader in '..\Lib\Classes\Common\MultiFormatReader.pas', PerspectiveTransform in '..\Lib\Classes\Common\PerspectiveTransform.pas', ReadResult in '..\Lib\Classes\Common\ReadResult.pas', ResultMetadataType in '..\Lib\Classes\Common\ResultMetadataType.pas', ResultPoint in '..\Lib\Classes\Common\ResultPoint.pas', StringUtils in '..\Lib\Classes\Common\StringUtils.pas', Binarizer in '..\Lib\Classes\Filtering\Binarizer.pas', BinaryBitmap in '..\Lib\Classes\Filtering\BinaryBitmap.pas', GlobalHistogramBinarizer in '..\Lib\Classes\Filtering\GlobalHistogramBinarizer.pas', HybridBinarizer in '..\Lib\Classes\Filtering\HybridBinarizer.pas', LuminanceSource in '..\Lib\Classes\Filtering\LuminanceSource.pas', RGBLuminanceSource in '..\Lib\Classes\Filtering\RGBLuminanceSource.Pas', ScanManager in '..\Lib\Classes\ScanManager.pas'; {$R *.res} begin ReportMemoryLeaksOnShutdown := True; Application.Initialize; Application.CreateForm(TForm2, Form2); Application.Run; end.
49.688312
93
0.767904
f1d03d781463f445444ae8dd988d4beacdf24c18
3,744
dfm
Pascal
RepairUnit.dfm
amenk/myfindex
74eab085731ae6beb796f35b4cb44b3d7c09232c
[ "Unlicense" ]
null
null
null
RepairUnit.dfm
amenk/myfindex
74eab085731ae6beb796f35b4cb44b3d7c09232c
[ "Unlicense" ]
null
null
null
RepairUnit.dfm
amenk/myfindex
74eab085731ae6beb796f35b4cb44b3d7c09232c
[ "Unlicense" ]
null
null
null
object frmRepair: TfrmRepair Left = 445 Top = 194 HelpContext = 7000 BorderStyle = bsDialog Caption = 'Datenbank reparieren' ClientHeight = 168 ClientWidth = 204 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False Position = poOwnerFormCenter OnCreate = FormCreate OnDestroy = FormDestroy PixelsPerInch = 96 TextHeight = 13 object Label2: TLabel Left = 8 Top = 96 Width = 186 Height = 26 Caption = 'Sollte die Reparatur nicht funktionieren,'#13#10'bitte BDE-DPK-50.EXE ' + 'installieren.' end object lblBDE5: TLabel Left = 31 Top = 109 Width = 86 Height = 13 Cursor = crHandPoint Caption = 'BDE-DPK-50.EXE' Font.Charset = DEFAULT_CHARSET Font.Color = clBlue Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [fsUnderline] ParentFont = False OnClick = lblBDE5Click end object gb1: TGroupBox Left = 8 Top = 16 Width = 185 Height = 73 Caption = ' Datenbanken ' TabOrder = 0 object Label1: TLabel Left = 16 Top = 24 Width = 52 Height = 13 Caption = 'Sammlung:' end object cbCol: TComboBox Left = 16 Top = 40 Width = 153 Height = 21 HelpContext = 7001 Style = csDropDownList ItemHeight = 13 TabOrder = 0 end end object btnOk: TBitBtn Left = 8 Top = 134 Width = 86 Height = 25 Caption = 'OK' Default = True ModalResult = 1 TabOrder = 1 OnClick = btnOkClick Glyph.Data = { DE010000424DDE01000000000000760000002800000024000000120000000100 0400000000006801000000000000000000001000000000000000000000000000 80000080000000808000800000008000800080800000C0C0C000808080000000 FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333 3333333333333333333333330000333333333333333333333333F33333333333 00003333344333333333333333388F3333333333000033334224333333333333 338338F3333333330000333422224333333333333833338F3333333300003342 222224333333333383333338F3333333000034222A22224333333338F338F333 8F33333300003222A3A2224333333338F3838F338F33333300003A2A333A2224 33333338F83338F338F33333000033A33333A222433333338333338F338F3333 0000333333333A222433333333333338F338F33300003333333333A222433333 333333338F338F33000033333333333A222433333333333338F338F300003333 33333333A222433333333333338F338F00003333333333333A22433333333333 3338F38F000033333333333333A223333333333333338F830000333333333333 333A333333333333333338330000333333333333333333333333333333333333 0000} NumGlyphs = 2 end object btnAbort: TBitBtn Left = 106 Top = 134 Width = 86 Height = 25 TabOrder = 2 Kind = bkCancel end object gb2: TGroupBox Left = 8 Top = 168 Width = 185 Height = 81 Caption = ' Fortschritt ' TabOrder = 3 object lblFile_: TLabel Left = 14 Top = 19 Width = 28 Height = 13 Caption = 'Datei:' end object lblFile: TLabel Left = 49 Top = 19 Width = 119 Height = 13 AutoSize = False end object lblStatus: TLabel Left = 8 Top = 40 Width = 131 Height = 13 Caption = 'Datenbank neu aufbauen...' end object pb: TProgressBar Left = 8 Top = 56 Width = 169 Height = 16 Min = 0 Max = 100 TabOrder = 0 end end end
25.643836
81
0.645566
471af3650932d66c978729de2177f49a41daedde
8,226
pas
Pascal
Codigos/UnitPrincipal.pas
MDsolucoesTI/Metallum
0c946d48f57cf951152de6b6a681ded2063868c2
[ "MIT" ]
null
null
null
Codigos/UnitPrincipal.pas
MDsolucoesTI/Metallum
0c946d48f57cf951152de6b6a681ded2063868c2
[ "MIT" ]
null
null
null
Codigos/UnitPrincipal.pas
MDsolucoesTI/Metallum
0c946d48f57cf951152de6b6a681ded2063868c2
[ "MIT" ]
1
2021-12-03T08:21:33.000Z
2021-12-03T08:21:33.000Z
////////////////////////////////////////////////////////////////////////// // Criacao...........: 05/2002 // Sistema...........: Metallum - Controle de Serviços // Integracao........: Olimpo - Automacao Comercial // Analistas.........: Marilene Esquiavoni & Denny Paulista Azevedo Filho // Desenvolvedores...: Marilene Esquiavoni & Denny Paulista Azevedo Filho // Copyright.........: Marilene Esquiavoni & Denny Paulista Azevedo Filho ////////////////////////////////////////////////////////////////////////// unit UnitPrincipal; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, Menus, RxMenus, StdCtrls, ImgList, ComCtrls, ToolWin, ExtCtrls, jpeg, SRLabel, LMDGraphicControl, LMDScrollText, LMDControl, LMDBaseControl, LMDBaseGraphicControl, LMDBaseLabel, LMDCustomLabel, LMDCustomLabelFill, LMDLabelFill, XPMenu, ShellApi, LMDCustomComponent, LMDCustomHint, LMDCustomShapeHint, LMDShapeHint, EHintBal, EAppProt, RXCtrls, EFocCol; type TFrmPrincipal = class(TForm) ControlBar1: TControlBar; StandardToolBar: TToolBar; ToolButton1: TToolButton; ToolButton2: TToolButton; ToolButton4: TToolButton; ToolButton7: TToolButton; ToolButton10: TToolButton; MainMenu1: TMainMenu; Arquivo1: TMenuItem; Relatrio1: TMenuItem; Configuraes1: TMenuItem; Gerais1: TMenuItem; Ajuda1: TMenuItem; MenuItem5: TMenuItem; EnviesuaDvidapeloEmail1: TMenuItem; SobreoTritonLigth1: TMenuItem; ImageList2: TImageList; PopRelatorio: TPopupMenu; PopAjuda: TPopupMenu; Cliente2: TMenuItem; Ajuda2: TMenuItem; EnviesuaDvidapeloEmail2: TMenuItem; SobreoTriton1: TMenuItem; ToolButton3: TToolButton; ToolButton5: TToolButton; EvHintBalloon1: TEvHintBalloon; EvAppProtect1: TEvAppProtect; Fornecedor3: TMenuItem; ImageList1: TImageList; Produtos1: TMenuItem; N1: TMenuItem; Panel1: TPanel; LMDLabelFill2: TLMDLabelFill; LMDLabelFill3: TLMDLabelFill; RxLabel1: TRxLabel; RxLabel2: TRxLabel; RxLabel3: TRxLabel; StatusBar1: TStatusBar; XPMenu1: TXPMenu; EvFocusColor1: TEvFocusColor; Sair2: TMenuItem; Cargos1: TMenuItem; Cadastro1: TMenuItem; Atualizarsalrio1: TMenuItem; Cliente1: TMenuItem; Funcionrio1: TMenuItem; Atendimento1: TMenuItem; OS1: TMenuItem; Agenda1: TMenuItem; Funcionrio2: TMenuItem; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure Button2Click(Sender: TObject); procedure Sair2Click(Sender: TObject); procedure CadastrodaEmpresa1Click(Sender: TObject); procedure SobreoOlimpoLigth1Click(Sender: TObject); procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure FormShow(Sender: TObject); procedure StatusTeclas(vAcao:boolean;vTeclas:string); procedure Gerais1Click(Sender: TObject); procedure EnviesuaDvidapeloEmail1Click(Sender: TObject); procedure SobreoTritonLigth1Click(Sender: TObject); procedure ToolButton3Click(Sender: TObject); procedure Fornecedor3Click(Sender: TObject); procedure Cargos1Click(Sender: TObject); procedure Cadastro1Click(Sender: TObject); procedure Cliente1Click(Sender: TObject); procedure Funcionrio1Click(Sender: TObject); procedure Atualizarsalrio1Click(Sender: TObject); procedure OS1Click(Sender: TObject); procedure Agenda1Click(Sender: TObject); procedure Cliente2Click(Sender: TObject); procedure Funcionrio2Click(Sender: TObject); procedure ToolButton1Click(Sender: TObject); procedure ToolButton4Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var FrmPrincipal : TFrmPrincipal; ListaTeclas : String; PilhaTeclas : array[1..10] of string; Topo : integer; Acao:boolean; implementation uses unitDmDados,unitParametro,UnitSobre, UnitCadClientes, unitFunc, UnitCargos, UnitRelCliente, UnitRelFunc, UnitAtSalario, UnitOS, UnitAgenda; {$R *.DFM} procedure TfrmPrincipal.StatusTeclas(vAcao:boolean;vTeclas:string); begin if vAcao then begin Topo:=Topo + 1; if Topo > 0 Then PilhaTeclas[Topo]:=StatusBar1.Panels[0].Text; StatusBar1.Panels[0].Text:=vTeclas; end else begin StatusBar1.Panels[0].Text:=PilhaTeclas[Topo]; Topo:=Topo-1; end; end; procedure TFrmPrincipal.FormClose(Sender: TObject; var Action: TCloseAction); begin Action:= Cafree; end; procedure TFrmPrincipal.Button2Click(Sender: TObject); begin frmParametro:=tfrmParametro.create(application); frmParametro.showmodal; end; procedure TFrmPrincipal.Sair2Click(Sender: TObject); begin Close; end; procedure TFrmPrincipal.CadastrodaEmpresa1Click(Sender: TObject); begin FrmParametro:=tfrmParametro.create(application); FrmParametro.showmodal; end; procedure TFrmPrincipal.SobreoOlimpoLigth1Click(Sender: TObject); begin FrmSobre:=TFrmSobre.create(application); FrmSobre.Showmodal; end; procedure TFrmPrincipal.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if dmDados.HabilitaTeclado then case (key) of // Teclas de navega��o VK_F2 : ToolButton1.Click; VK_F3 : ToolButton4.Click; VK_F4 : ToolButton10.CheckMenuDropdown; VK_F5 : ToolButton3.Click; VK_F6 : ToolButton5.Click; VK_ESCAPE : close; end; end; procedure TFrmPrincipal.FormShow(Sender: TObject); begin Topo:= -1; ListaTeclas:='[F2] Fornecedor [F3] Pedidos [F4] Relat�rio [F5] Par�metros [F6] Ajuda [ESC] Sai'; StatusTeclas(True,ListaTeclas); end; procedure TFrmPrincipal.Gerais1Click(Sender: TObject); begin frmParametro:=tfrmParametro.create(application); frmParametro.showmodal; end; procedure TFrmPrincipal.EnviesuaDvidapeloEmail1Click(Sender: TObject); var url : string; begin url :='mailto:gensysinfo_softwares@uol.com.br'; shellexecute(0, 'open',Pchar(url), nil, nil, sw_showNormal); end; procedure TFrmPrincipal.SobreoTritonLigth1Click(Sender: TObject); begin frmSobre:=tfrmSobre.create(application); frmSobre.showmodal; end; procedure TFrmPrincipal.ToolButton3Click(Sender: TObject); begin frmParametro:=tfrmParametro.create(application); frmParametro.showmodal; end; procedure TFrmPrincipal.Fornecedor3Click(Sender: TObject); begin frmCadCliente:=tfrmCadCliente.create(application); frmCadCliente.showModal; end; procedure TFrmPrincipal.Cargos1Click(Sender: TObject); begin frmCargos:=tfrmCargos.create(application); frmCargos.showModal; end; procedure TFrmPrincipal.Cadastro1Click(Sender: TObject); begin frmFuncionario:=tfrmFuncionario.Create(application); frmfuncionario.ShowModal; end; procedure TFrmPrincipal.Cliente1Click(Sender: TObject); begin frmRelCliente:=tfrmRelCliente.create(application); frmRelCliente.showModal; end; procedure TFrmPrincipal.Funcionrio1Click(Sender: TObject); begin frmRelFunc:=tfrmRelFunc.create(application); frmRelFunc.showModal; end; procedure TFrmPrincipal.Atualizarsalrio1Click(Sender: TObject); begin frmAtualSalario:=tfrmAtualSalario.create(application); frmAtualSalario.showModal; end; procedure TFrmPrincipal.OS1Click(Sender: TObject); begin frmOs:=tfrmOs.create(application); frmOs.showModal; end; procedure TFrmPrincipal.Agenda1Click(Sender: TObject); begin frmAgenda:=tfrmAgenda.create(application); frmAgenda.showModal; end; procedure TFrmPrincipal.Cliente2Click(Sender: TObject); begin frmRelCliente:=tfrmRelCliente.Create(application); frmRelCliente.ShowModal; end; procedure TFrmPrincipal.Funcionrio2Click(Sender: TObject); begin frmRelFunc:=tfrmRelFunc.Create(application); frmRelFunc.ShowModal; end; procedure TFrmPrincipal.ToolButton1Click(Sender: TObject); begin frmOs:=tfrmOs.create(application); frmOs.showModal; end; procedure TFrmPrincipal.ToolButton4Click(Sender: TObject); begin frmAgenda:=tfrmAgenda.create(application); frmAgenda.showModal; end; end.
28.463668
99
0.723803
f1d517cccd18d3e6ea8ab722374daefae81e8449
23,898
pas
Pascal
graphics/0240.pas
nickelsworth/swag
7c21c0da2291fc249b9dc5cfe121a7672a4ffc08
[ "BSD-2-Clause" ]
11
2015-12-12T05:13:15.000Z
2020-10-14T13:32:08.000Z
graphics/0240.pas
nickelsworth/swag
7c21c0da2291fc249b9dc5cfe121a7672a4ffc08
[ "BSD-2-Clause" ]
null
null
null
graphics/0240.pas
nickelsworth/swag
7c21c0da2291fc249b9dc5cfe121a7672a4ffc08
[ "BSD-2-Clause" ]
8
2017-05-05T05:24:01.000Z
2021-07-03T20:30:09.000Z
{ SWAG NOTE : Other unit and Demos at BOTTOM ! } { LCD.PAS Written by Leopoldo Salvo Massieu, april 92. e-mail a900040@zipi.fi.upm.es Freeware. Written for Borland Pascal 7.0. This units implement scalable lcd displays for numerical output in graphics mode. Works in any graphic mode. Works in real and protected mode applications. Restrictions: Digits must be at most 254 pixels wide horizontally (the digit width is equal to the width of the lcd display divided into the number of digits) } Unit LCD; Interface Uses Graph; {Uses getmaxx,getmaxy,setcolor,putpixel,bar} Type PDisplay = ^Display; Display = object private xi,yi,xf,yf : integer; num_cars : byte; col_on, col_off : word; graficos : array [1..9] of pointer; tamano_graficos : array [1..9] of word; buffer : array [1..40] of byte; desbordado : boolean; public constructor init (x1,y1,x2,y2:integer;num_digits:byte; forecolor,backcolor:word); {coordinates of top-left and bottom-right corners, number of digits in the display (without counting the decimal point), and color of foreground and background} destructor done; {Releases memory} procedure display_string (cadena_num:string); {Writes a string (only numbers will be displayed)} procedure display_real (ndecimals: integer; r:real); {Writes a real with n decimals (use 0 for integers)} procedure redraw; end; Implementation Const palotes_x_digito = 9; {7 segments for each digit, plus the decimal point and an overflow point at the top-left} no_error = 0; Type st40 = string[40]; digi_font = (cero,uno,dos,tres,cuatro,cinco,seis,siete,ocho,nueve,e,desbordamiento,espacio,menos,punto); {these are all the characters that can be displayed ['0'..'9','E','-',' ', '.']. The '+' caracter is displayed as an space.} digi_palo = array[1..6] of pointtype; {each segment has at most 6 extremes (end points)} digi_data = array[1..palotes_x_digito] of record data:digi_palo; longitud: byte; end; {number of extremes and the extremes themselves for all segments} digi_masc = record {esta es una forma de guardar los 'trozos' de digito en} esq_si : pointtype;{memoria sin que ocupe demasiado espacio en memoria} num_lin: byte; datos : array[1..256] of record p,u:byte; end; end; {structure to keep the scaled segments in memory (only necessary mem allocated, tipycally <256)} digi_memo = array[1..palotes_x_digito] of ^digi_masc; digi_st = array[1..40] of digi_font; Const {this codes what segments must be lighted for each character} caracteres : array[cero..punto,1..palotes_x_digito] of boolean = ((true,true,true,false,true,true,true,false,false), {cero/0} (false,false,true,false,false,true,false,false,false), {uno/1} (true,false,true,true,true,false,true,false,false), {dos/2} (true,false,true,true,false,true,true,false,false), {tres/3} (false,true,true,true,false,true,false,false,false), {cuatro/4} (true,true,false,true,false,true,true,false,false), {cinco/5} (true,true,false,true,true,true,true,false,false), {seis/6} (true,false,true,false,false,true,false,false,false), {siete/7} (true,true,true,true,true,true,true,true,true), {ocho/8} (true,true,true,true,false,true,false,false,false), {nueve/9} (true,true,false,true,true,false,true,false,false), {E} (false,false,false,false,false,false,false,false,true), {desbordamiento/overflow} (false,false,false,false,false,false,false,false,false),{espacio/space} (false,false,false,true,false,false,false,false,false), {signo menos/'-'} (false,false,false,false,false,false,false,true,false));{punto decimal/'.'} {this defines the edges of each segment, scaled to 1:80 vertically and 1::90 horizontally o#9 #1 ---------- #2 / /#3 / #4 / /--------/ #5 / / #6 / #7 / ---------- o #8 } digitos : digi_data = ( ({uno, el horizontal, arriba} data : ( (x:20;y:75), (x:26;y:80), (x:78;y:80), (x:80;y:78), (x:69;y:70), (x:28;y:70) ); longitud : 6 ), ({dos, vertical, izquierda y arriba} data : ( (x:19;y:73), (x:27;y:67), (x:25;y:48), (x:18;y:43), (x:15;y:45), (x:-1;y:-1) ); longitud : 5 ), ({tres, vertical, derecha y arriba} data : ( (x:80;y:75), (x:77;y:45), (x:74;y:42), (x:67;y:47), (x:69;y:67), (x:-1;y:-1) ); longitud : 5 ), ({cuatro, horizontal en el medio} data : ( (x:27;y:47), (x:63;y:47), (x:71;y:41), (x:62;y:37), (x:25;y:37), (x:20;y:42) ); longitud : 6 ), ({cinco, vertical, izquierda y abajo} data : ( (x:14;y:40), (x:17;y:42), (x:22;y:36), (x:19;y:12), (x:10;y:09), (x:-1;y:-1) ); longitud : 5 ), ({seis, vertical, derecha y abajo} data : ( (x:73;y:40), (x:75;y:37), (x:70;y:03), (x:68;y:00), (x:61;y:11), (x:64;y:36) ); longitud : 6 ), ({siete, horizontal, abajo} data : ( (x:21;y:10), (x:58;y:10), (x:64;y:00), (x:13;y:00), (x:10;y:05), (x:11;y:07) ); longitud : 6 ), ({ocho, punto decimal} data : ( (x:80;y:10), (x:90;y:10), (x:89;y:00), (x:79;y:00), (x:-1;y:-1), (x:-1;y:-1) ); longitud : 4 ), ({nueve, desbordamiento} data : ( (x:01;y:80), (x:11;y:80), (x:10;y:70), (x:00;y:70), (x:-1;y:-1), (x:-1;y:-1) ); longitud : 4 ) ); constructor Display.init; type mem_buffer = array[0..255,0..63] of byte; {temp. buffer for initialization} var xinicial,yinicial:integer; resx,resy:real; t,l,n,digit:byte; si,id:pointtype; puntos : array [1..6] of pointtype; v_mem : ^mem_buffer; procedure pon_mem_XY (x,y:byte); {putpixel in temp. buffer to draw each segment} var sx,ox:byte; begin sx:=x div 8;ox:=x-sx*8; v_mem^[y,sx]:=v_mem^[y,sx] or (1 shl ox); end; function get_mem_XY (x,y:byte):boolean; {getpixel from temp. buffer} var sx,ox,comp:byte; begin sx:=x div 8; ox:=x-(sx*8); {faster than mod} comp:=1 shl ox; get_mem_XY:=(v_mem^[y,sx] and comp)=comp; end; procedure halla_extremos; {finds minimum area that covers a digit} var a:byte; begin si.x:=getmaxx;si.y:=getmaxy;id.x:=0;id.y:=0; for a:=1 to digitos[t].longitud do begin if (puntos[a].x<si.x) then si.x:=puntos[a].x; if (puntos[a].y<si.y) then si.y:=puntos[a].y; if (puntos[a].x>id.x) then id.x:=puntos[a].x; if (puntos[a].y>id.y) then id.y:=puntos[a].y; end; end; Procedure Linea_mem (X1,Y1,X2,Y2 : integer); {draws a line in temp. buffer} var dx,x3,y3:integer; m:real; begin if (x1>x2) then begin x3:=x1;x1:=x2;x2:=x3; y3:=y1;y1:=y2;y2:=y3; end; if (x2<>x1) then begin m:=(Y2-Y1)/(X2-X1); for dx:=X1 to X2 do pon_mem_XY (dx,y1+round(m*(dx-X1))); end; if (y1>y2) then begin x3:=x1;x1:=x2;x2:=x3; y3:=y1;y1:=y2;y2:=y3; end; if (y2<>y1) then begin m:=(X2-X1)/(Y2-Y1); for dx:=Y1 to Y2 do pon_mem_XY(x1+round(m*(dx-Y1)),dx); end; end; procedure graba_palote(pal:byte); {by now a segment is drawn in temp. buffer, the task is finding the first and last column for each row} var lneas:byte;u,p:integer; function primer_negro:byte; {primer_extremo} var f:byte; begin primer_negro:=255; for f:=si.x to id.x do if get_mem_XY(f,lneas) then begin primer_negro:=f;exit;end; end; function ultimo_negro:byte; {ultimo extremo} var f:byte; begin ultimo_negro:=255; for f:=p to id.x do if get_mem_XY (f,lneas) and not(get_mem_XY(f+1,lneas)) then ultimo_negro:=f; end; begin digi_masc(graficos[pal]^).num_lin:=id.y-si.y; {# of rows to scan} digi_masc(graficos[pal]^).esq_si:=si; {top-left corner of segment} for lneas:=si.y to id.y do begin p:=primer_negro; u:=ultimo_negro; digi_masc(graficos[pal]^).datos[lneas-si.y+1].p:=p-si.x; digi_masc(graficos[pal]^).datos[lneas-si.y+1].u:=u-si.x; {store segments in memory} end; end; begin if (x2<x1+num_digits*3) or (x2>x1+254*num_digits) or (y2<=y1+4) or (num_digits<1) then begin writeln ('Error: Invalid parameters: Area too small or number of digits<1'); FAIL; end; xi:=x1;xf:=x2;yi:=y1;yf:=y2;col_on:=forecolor;col_off:=backcolor;num_cars:=num_digits; resx:=((x2-x1)/num_digits)*0.0111; resy:=(y2-y1)*0.0125; {Constants to scale digits} xinicial:=xi; yinicial:=yi; if (MaxAvail<sizeof(mem_buffer)) then begin writeln ('Out of memory creating lcd display. Initialization failed.'); fail; end; new (V_mem); {gets temp. buffer} for t:=1 to palotes_x_digito do graficos[t]:=NIL; for t:=1 to palotes_x_digito do begin l:=digitos[t].longitud; fillchar (v_mem^,sizeof(mem_buffer),0); for n:=1 to l do begin puntos[n].x:=round(digitos[t].data[n].x*resx); puntos[n].y:=round(digitos[t].data[n].y*resy); end; {scales points...} halla_extremos; {find minimum area} tamano_graficos[t]:=5+(2*(id.y-si.y+1));{gets memory to copy coded scaled segments} if (MaxAvail<tamano_graficos[t]) then begin writeln ('Out of memory creating lcd display. Initialization failed.'); done; fail; end; getmem(graficos[t],tamano_graficos[t]); for n:=1 to l do linea_mem (puntos[n].x,puntos[n].y,puntos[(n mod l)+1].x,puntos[(n mod l)+1].y); {draws segment in memory} graba_palote(t); {copy segment to memory} end; dispose (V_mem); {release temp buffer} fillchar (buffer,sizeof(buffer),espacio); {nothing written in display} end; destructor display.done; var pal : integer; begin display_string (''); for pal:=1 to palotes_x_digito do if (graficos[pal]<>NIL) then freemem (graficos[pal], tamano_graficos[pal]) end; Procedure display.display_string; var resx:real;xinicial,yinicial:integer;f,digit:byte;cr:digi_font; cadena:digi_st;pdecs:byte; const blancos :st40 = ' '; procedure barrotes(barrote:byte;encendido:boolean); {draws a segment} var lineas:byte; color :word; begin if encendido then color:=col_on else color:=col_off; {segment colour} setcolor (color); for lineas:=1 to digi_masc(graficos[barrote]^).num_lin do if (digi_masc(graficos[barrote]^).datos[lineas].p<>255) then line (xinicial+digi_masc(graficos[barrote]^).esq_si.x+digi_masc(graficos[barrote]^).datos[lineas].p, yinicial-digi_masc(graficos[barrote]^).esq_si.y-lineas, xinicial+digi_masc(graficos[barrote]^).esq_si.x+digi_masc(graficos[barrote]^).datos[lineas].u, yinicial-digi_masc(graficos[barrote]^).esq_si.y-lineas); {actually draws the segment, scaning rows in memory} end; Procedure get_font_str(var res:digi_st); {conversion from string to displayable font} var f:byte;cr:char; begin for f:=1 to byte(cadena_num[0]) do case cadena_num[f] of 'E' : res[f]:=E; ' ' : res[f]:=espacio; '-' : res[f]:=menos; '.' : res[f]:=punto; '+' : res[f]:=espacio; {'+' is not representable} else res[f]:=digi_font(BYTE(cadena_num[f])-48); end; end; procedure display(caracter:digi_font); {displays a character} var g:byte; begin xinicial:=xi+round(digit*resx); if (caracter=punto) then barrotes (8,true) else if (caracter=desbordamiento) then barrotes (9,true) else begin inc(digit); {# of digit} for g:=1 to 7 do if (caracteres[caracter,g]<>caracteres[digi_font(buffer[f]),g]) then barrotes (g,caracteres[caracter,g]); {only draws a segment if it has changed} end; end; procedure borra_desborde; {erases overflow} begin barrotes (9,false); end; procedure borra_punto; {erases decimal point} begin barrotes (8,false); end; function num_puntos:byte; var a,res:byte; begin res:=0; for a:=1 to ord(cadena_num[0]) do if cadena_num[a]='.' then inc(res); num_puntos:=res; end; begin {proc. display} digit:=0; {digitos escritos} resx:=(xf-xi)/num_cars; yinicial:=yf; if desbordado then begin borra_desborde; {erases overflow} desbordado:=false; end; pdecs:=num_puntos; if (length(cadena_num)-pdecs<num_cars) then cadena_num:=copy(blancos,1,pdecs+num_cars-length(cadena_num))+cadena_num else if (length(cadena_num)-pdecs>num_cars) then begin desbordado:=true; cadena_num:=copy(cadena_num,(1+length(cadena_num)-num_cars),num_cars); end; get_font_str (cadena); for f:=1 to num_cars+pdecs do begin {all characters} cr:=cadena[f]; if (cr<>punto) then begin {updates decimal point} if (digi_font(buffer[f+1])=punto) then begin if not(cadena[f+1]=punto) then borra_punto end else if (cadena[f+1]=punto) then display (punto); if (cr=digi_font(buffer[f])) then inc(digit) else begin {only draws a character if it's changed} display(cadena[f]); buffer[f]:=byte(cr); end; end; end; digit:=0; {el signo de desbordamiento se encuentra incluido en el primer digito} if desbordado then display(desbordamiento); {set overflow if necessary} end; Procedure display.display_real; var cad : STRING; begin if (ndecimals+1>=num_cars) then ndecimals:=num_cars-2; str (r:num_cars-ndecimals-1:ndecimals, cad); display_string (cad); end; Procedure display.redraw; var cad : st40; i : integer; begin cad[0]:=char(num_cars); for i:=1 to num_cars do case digi_font(buffer[i]) OF E: cad[i]:='E'; espacio: cad[i]:=' '; menos: cad[i]:='-'; punto: cad[i]:='.'; else cad[i]:=CHAR(48+buffer[i]); end; fillchar (buffer, sizeof(buffer), espacio); display_string (cad); end; end. { --------- UNIT NEED FOR THIS SNIPET ----------------------- } Unit inisvga; interface uses Crt,Graph; var v : byte; OldExitProc : Pointer; { Saves exit procedure address } graphdriver,graphmode,errorcode:integer; PathToDriver : string[80]; { Stores the DOS path to *.BGI & *.CHR } const edit = 0; vga320x200x256 = 1; svga640x400x256 = 2; svga640x480x256 = 3; svga1024x768x256= 4; ega640x350x16 = 5; herc720x348x2 = 6; Procedure Graficos(modo_grafico:byte); Procedure Cierragraficos; Procedure Dimensiones (Var horizontal, vertical: INTEGER); implementation var err:integer; procedure Cierragraficos; begin closegraph; end; {$F+} procedure MyExitProc; begin ExitProc := OldExitProc; { Restore exit procedure address } CloseGraph; { Shut down the graphics system } end; { MyExitProc } {$F-} {$F+} function DetectVGA256 : integer; { Detects VGA or MCGA video cards } var DetectedDriver : integer; SuggestedMode : integer; begin DetectGraph(DetectedDriver, SuggestedMode); if (DetectedDriver = VGA) or (DetectedDriver = MCGA) then DetectVGA256 := v { Default video mode = 0 } else DetectVGA256 := grError; { Couldn't detect hardware } end; { DetectVGA256 } {$F-} var AutoDetectPointer : pointer; function Inicializa_svga:byte; { Initialize graphics and report any errors that may occur } var InGraphicsMode : boolean; { Flags initialization of graphics mode } begin { when using Crt and graphics, turn off Crt's memory-mapped writes } DirectVideo := False; OldExitProc := ExitProc; { save previous exit proc } ExitProc := @MyExitProc; { insert our exit proc in chain } repeat AutoDetectPointer := @DetectVGA256; { Point to detection routine } GraphDriver := InstallUserDriver('SVGA256', AutoDetectPointer); GraphDriver := Detect; InitGraph(GraphDriver, Graphmode, PathToDriver); ErrorCode := GraphResult; { preserve error return } inicializa_svga:=grok; if ErrorCode <> grOK then { error? } begin Writeln('Graphics error: ', GraphErrorMsg(ErrorCode)); if ErrorCode = grFileNotFound then { Can't find driver file } begin Writeln('Enter full path to BGI driver or type <Ctrl-Break> to quit:'); Readln(PathToDriver); Writeln; end else inicializa_Svga:=grok; end; until ErrorCode = grOK; Randomize; { init random number generator } end; { Initialize } procedure Graficos(modo_grafico:byte); var ch:char; procedure egadriver; begin graphdriver:=EGA; graphmode:=EGAHi; InitGraph(graphdriver,graphmode,''); Err := GraphResult; if Err <> grOk then WriteLn('Graphics error:',GraphErrorMsg(Err)); modo_grafico:=ega640x350x16; end; procedure Hercules; begin graphdriver:=hercmono; graphmode:=hercmonohi; InitGraph(graphdriver,graphmode,''); Err := GraphResult; if Err <> grOk then WriteLn('Graphics error:',GraphErrorMsg(Err)); modo_grafico:=herc720x348x2; end; begin if (modo_grafico<1) or (modo_grafico>6) then begin window (20,8,60,16); clrscr; Writeln (' Modos gráficos'); writeln; Writeln ('1 - VGA 320x200 256 colores'); Writeln ('2 - SVGA 600x480 256 colores'); Writeln ('3 - SVGA 640x480 256 colores'); Writeln ('4 - SVGA 1024x768 256 colores'); Writeln ('5 - EGA 640x350 16 colores'); Writeln ('6 - Hercules mono'); err:=-1; Repeat ch:=readkey; case ch of '1' : begin v:=0; modo_grafico:=vga320x200x256; err:=inicializa_svga; end; '2' : begin v:=1; modo_grafico:=svga640x400x256; err:=inicializa_svga; end; '3' : begin v:=2; modo_grafico:=svga640x480x256; err:=inicializa_svga; end; '4' : begin v:=3; modo_grafico:=svga1024x768x256;err:=inicializa_svga; end; '5' : egadriver; '6' : hercules; end; Until (err=grOk); end else begin if (modo_grafico=ega640x350x16) then egadriver else if (modo_grafico=herc720x348x2) then hercules else if (modo_grafico=vga320x200x256) then begin v:=0;err:=inicializa_svga; end else if (modo_grafico=svga640x400x256) then begin v:=1;err:=inicializa_svga; end else if (modo_grafico=svga640x480x256) then begin v:=2; err:=inicializa_svga; end else if (modo_grafico=svga1024x768x256) then begin v:=3;err:=inicializa_svga; end; end; end; Procedure dimensiones (Var horizontal, vertical: INTEGER); begin horizontal:=Getmaxx; vertical:=Getmaxy; end; begin PathToDriver := 'D:\bp\bgi'; end. { -------------------------- DEMO ----------------------- } Program DemoLCD; { Demo for LCD unit, keeps drawing ellipses until a key is pressed. There's a LCD that counts the number of ellipses drawn. Leopoldo Salvo, e-mail a900040@zipi.fi.upm.es } Uses Inisvga,Crt,Graph,Lcd; { unit INISVGA found at the bottom !! } Var i, numero:word; xq,yq,rx,ry,x,y,maxcolor,maxx,maxy:integer; n_str: string; graphdriver,graphmode,error:integeR; v1 : ^Display; ch : char; begin graficos (edit); maxcolor:=256;maxx:=getmaxx;maxy:=getmaxy;numero:=0; xq:=maxx div 6; yq:=maxy div 10; {constants for centering stuff} new (v1, init (xq,0,5*xq,2*yq,4,15,0)); {creates and initializes lcd display, digits are white(#15) over black(#0) background} if (v1=NIL) then begin writeln ('Error creating lcd displays, exiting...'); halt; end; maxx:=maxx-2*xq; maxy:=maxy-4*yq; setcolor (15); line (xq-4,3*yq-4,5*xq+4,3*yq-4); line (5*xq+4,3*yq-4,5*xq+4,9*yq+10); line (5*xq+4,9*yq+10,xq-1,9*yq+10); line (xq-4,9*yq+10,xq-4,3*yq-4); repeat setcolor (maxcolor+1); x:=random(maxx); y:=random(maxy); if (x<maxx div 2) then rx:=random(x) else rx:=random(maxx-x); if (y<maxy div 2) then ry:=random(y) else ry:=random(maxy-y); setfillstyle (solidfill,random(maxcolor)); fillellipse (xq+x,3*yq+y,rx,ry); inc(numero); v1^.display_real (0, numero); {updates counter lcd} until keypressed; dispose (v1, done); closegraph; ch:=readkey; end. { -------------------------- DEMO ----------------------- } { Demo for LCD unit. Leopoldo Salvo Massieu, e-mail a900040@zipi.fi.upm.es A rather artistic lcd display show. } Program demolcd3; uses crt,graph,lcd; var graphdriver,graphmode,err:integer; a:byte; rx,ry:real; maxcol,c: byte; s:string; v:array[1..6] of ^display; const tiempo= 350; procedure abre (xi,yi,xf,yf,n,c1,c0,w:byte); begin new (v[w], init (round(xi*rx),round(yi*ry),round(xf*rx),round(yf*ry),n,c1,c0)); if (v[w]=NIL) then begin writeln ('Error creating lcd display... halting program...'); halt; end; enD; procedure pon (num:byte); begin v[num]^.display_string (char(48+num)); delay (tiempo); v[num]^.display_string (' '); end; begin graphdriver:=detect; graphmode:=0; initgraph (graphdriver,graphmode,''); err:=graphresult; if err<>grok then begin writeln ('had trouble opening graphic mode (probably egavga.bgi not found)',grapherrormsg(err)); exit; end; rx:=getmaxx*0.01; ry:=getmaxy*0.01; maxcol:=getmaxcolor; Abre (5,20,25,40,1,30,0,1); Abre (43,5,77,18,1,25,0,2); Abre (85,25,100,75,1,23,0,3); Abre (72,60,93,81,1,4,0,4); Abre (36,69,72,85,1,56,0,5); Abre (12,44,36,75,1,98,0,6); Repeat for a:=1 to 6 do pon (a); Until keypressed; for a:=1 to 6 do dispose (v[a], done); closegraph; end. 
31.65298
116
0.570968
f1bc144cc8d974e63ad38573accb7a9d3f215b24
48,502
pas
Pascal
12-use-dll/chilkat-9.5.0-delphi/SFtp.pas
kelfan/delphi-tutorials
029df8e091e4bdc5e9fde7df9305492a1010b157
[ "Apache-2.0" ]
null
null
null
12-use-dll/chilkat-9.5.0-delphi/SFtp.pas
kelfan/delphi-tutorials
029df8e091e4bdc5e9fde7df9305492a1010b157
[ "Apache-2.0" ]
null
null
null
12-use-dll/chilkat-9.5.0-delphi/SFtp.pas
kelfan/delphi-tutorials
029df8e091e4bdc5e9fde7df9305492a1010b157
[ "Apache-2.0" ]
null
null
null
unit SFtp; interface type HCkDateTime = Pointer; HCkBinData = Pointer; HCkSecureString = Pointer; HCkByteData = Pointer; HCkSFtp = Pointer; HCkString = Pointer; HCkSshKey = Pointer; HCkSFtpDir = Pointer; HCkSsh = Pointer; HCkTask = Pointer; HCkStringBuilder = Pointer; function CkSFtp_Create: HCkSFtp; stdcall; procedure CkSFtp_Dispose(handle: HCkSFtp); stdcall; function CkSFtp_getAbortCurrent(objHandle: HCkSFtp): wordbool; stdcall; procedure CkSFtp_putAbortCurrent(objHandle: HCkSFtp; newPropVal: wordbool); stdcall; procedure CkSFtp_getAccumulateBuffer(objHandle: HCkSFtp; outPropVal: HCkByteData); stdcall; function CkSFtp_getAuthFailReason(objHandle: HCkSFtp): Integer; stdcall; function CkSFtp_getBandwidthThrottleDown(objHandle: HCkSFtp): Integer; stdcall; procedure CkSFtp_putBandwidthThrottleDown(objHandle: HCkSFtp; newPropVal: Integer); stdcall; function CkSFtp_getBandwidthThrottleUp(objHandle: HCkSFtp): Integer; stdcall; procedure CkSFtp_putBandwidthThrottleUp(objHandle: HCkSFtp; newPropVal: Integer); stdcall; procedure CkSFtp_getClientIdentifier(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putClientIdentifier(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__clientIdentifier(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getClientIpAddress(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putClientIpAddress(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__clientIpAddress(objHandle: HCkSFtp): PWideChar; stdcall; function CkSFtp_getConnectTimeoutMs(objHandle: HCkSFtp): Integer; stdcall; procedure CkSFtp_putConnectTimeoutMs(objHandle: HCkSFtp; newPropVal: Integer); stdcall; procedure CkSFtp_getDebugLogFilePath(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putDebugLogFilePath(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__debugLogFilePath(objHandle: HCkSFtp): PWideChar; stdcall; function CkSFtp_getDisconnectCode(objHandle: HCkSFtp): Integer; stdcall; procedure CkSFtp_getDisconnectReason(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; function CkSFtp__disconnectReason(objHandle: HCkSFtp): PWideChar; stdcall; function CkSFtp_getEnableCache(objHandle: HCkSFtp): wordbool; stdcall; procedure CkSFtp_putEnableCache(objHandle: HCkSFtp; newPropVal: wordbool); stdcall; function CkSFtp_getEnableCompression(objHandle: HCkSFtp): wordbool; stdcall; procedure CkSFtp_putEnableCompression(objHandle: HCkSFtp; newPropVal: wordbool); stdcall; procedure CkSFtp_getFilenameCharset(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putFilenameCharset(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__filenameCharset(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getForceCipher(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putForceCipher(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__forceCipher(objHandle: HCkSFtp): PWideChar; stdcall; function CkSFtp_getForceV3(objHandle: HCkSFtp): wordbool; stdcall; procedure CkSFtp_putForceV3(objHandle: HCkSFtp; newPropVal: wordbool); stdcall; function CkSFtp_getHeartbeatMs(objHandle: HCkSFtp): Integer; stdcall; procedure CkSFtp_putHeartbeatMs(objHandle: HCkSFtp; newPropVal: Integer); stdcall; procedure CkSFtp_getHostKeyAlg(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putHostKeyAlg(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__hostKeyAlg(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getHostKeyFingerprint(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; function CkSFtp__hostKeyFingerprint(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getHttpProxyAuthMethod(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putHttpProxyAuthMethod(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__httpProxyAuthMethod(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getHttpProxyDomain(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putHttpProxyDomain(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__httpProxyDomain(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getHttpProxyHostname(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putHttpProxyHostname(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__httpProxyHostname(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getHttpProxyPassword(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putHttpProxyPassword(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__httpProxyPassword(objHandle: HCkSFtp): PWideChar; stdcall; function CkSFtp_getHttpProxyPort(objHandle: HCkSFtp): Integer; stdcall; procedure CkSFtp_putHttpProxyPort(objHandle: HCkSFtp; newPropVal: Integer); stdcall; procedure CkSFtp_getHttpProxyUsername(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putHttpProxyUsername(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__httpProxyUsername(objHandle: HCkSFtp): PWideChar; stdcall; function CkSFtp_getIdleTimeoutMs(objHandle: HCkSFtp): Integer; stdcall; procedure CkSFtp_putIdleTimeoutMs(objHandle: HCkSFtp; newPropVal: Integer); stdcall; function CkSFtp_getIncludeDotDirs(objHandle: HCkSFtp): wordbool; stdcall; procedure CkSFtp_putIncludeDotDirs(objHandle: HCkSFtp; newPropVal: wordbool); stdcall; function CkSFtp_getInitializeFailCode(objHandle: HCkSFtp): Integer; stdcall; procedure CkSFtp_getInitializeFailReason(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; function CkSFtp__initializeFailReason(objHandle: HCkSFtp): PWideChar; stdcall; function CkSFtp_getIsConnected(objHandle: HCkSFtp): wordbool; stdcall; function CkSFtp_getKeepSessionLog(objHandle: HCkSFtp): wordbool; stdcall; procedure CkSFtp_putKeepSessionLog(objHandle: HCkSFtp; newPropVal: wordbool); stdcall; procedure CkSFtp_getLastErrorHtml(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; function CkSFtp__lastErrorHtml(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getLastErrorText(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; function CkSFtp__lastErrorText(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getLastErrorXml(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; function CkSFtp__lastErrorXml(objHandle: HCkSFtp): PWideChar; stdcall; function CkSFtp_getLastMethodSuccess(objHandle: HCkSFtp): wordbool; stdcall; procedure CkSFtp_putLastMethodSuccess(objHandle: HCkSFtp; newPropVal: wordbool); stdcall; function CkSFtp_getMaxPacketSize(objHandle: HCkSFtp): Integer; stdcall; procedure CkSFtp_putMaxPacketSize(objHandle: HCkSFtp; newPropVal: Integer); stdcall; function CkSFtp_getPasswordChangeRequested(objHandle: HCkSFtp): wordbool; stdcall; function CkSFtp_getPercentDoneScale(objHandle: HCkSFtp): Integer; stdcall; procedure CkSFtp_putPercentDoneScale(objHandle: HCkSFtp; newPropVal: Integer); stdcall; function CkSFtp_getPreferIpv6(objHandle: HCkSFtp): wordbool; stdcall; procedure CkSFtp_putPreferIpv6(objHandle: HCkSFtp; newPropVal: wordbool); stdcall; function CkSFtp_getPreserveDate(objHandle: HCkSFtp): wordbool; stdcall; procedure CkSFtp_putPreserveDate(objHandle: HCkSFtp; newPropVal: wordbool); stdcall; function CkSFtp_getProtocolVersion(objHandle: HCkSFtp): Integer; stdcall; procedure CkSFtp_getReadDirMustMatch(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putReadDirMustMatch(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__readDirMustMatch(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getReadDirMustNotMatch(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putReadDirMustNotMatch(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__readDirMustNotMatch(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getServerIdentifier(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; function CkSFtp__serverIdentifier(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getSessionLog(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; function CkSFtp__sessionLog(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getSocksHostname(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putSocksHostname(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__socksHostname(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getSocksPassword(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putSocksPassword(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__socksPassword(objHandle: HCkSFtp): PWideChar; stdcall; function CkSFtp_getSocksPort(objHandle: HCkSFtp): Integer; stdcall; procedure CkSFtp_putSocksPort(objHandle: HCkSFtp; newPropVal: Integer); stdcall; procedure CkSFtp_getSocksUsername(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putSocksUsername(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__socksUsername(objHandle: HCkSFtp): PWideChar; stdcall; function CkSFtp_getSocksVersion(objHandle: HCkSFtp): Integer; stdcall; procedure CkSFtp_putSocksVersion(objHandle: HCkSFtp; newPropVal: Integer); stdcall; function CkSFtp_getSoRcvBuf(objHandle: HCkSFtp): Integer; stdcall; procedure CkSFtp_putSoRcvBuf(objHandle: HCkSFtp; newPropVal: Integer); stdcall; function CkSFtp_getSoSndBuf(objHandle: HCkSFtp): Integer; stdcall; procedure CkSFtp_putSoSndBuf(objHandle: HCkSFtp; newPropVal: Integer); stdcall; function CkSFtp_getSyncCreateAllLocalDirs(objHandle: HCkSFtp): wordbool; stdcall; procedure CkSFtp_putSyncCreateAllLocalDirs(objHandle: HCkSFtp; newPropVal: wordbool); stdcall; procedure CkSFtp_getSyncDirectives(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putSyncDirectives(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__syncDirectives(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getSyncedFiles(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putSyncedFiles(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__syncedFiles(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getSyncMustMatch(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putSyncMustMatch(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__syncMustMatch(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getSyncMustMatchDir(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putSyncMustMatchDir(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__syncMustMatchDir(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getSyncMustNotMatch(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putSyncMustNotMatch(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__syncMustNotMatch(objHandle: HCkSFtp): PWideChar; stdcall; procedure CkSFtp_getSyncMustNotMatchDir(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putSyncMustNotMatchDir(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__syncMustNotMatchDir(objHandle: HCkSFtp): PWideChar; stdcall; function CkSFtp_getTcpNoDelay(objHandle: HCkSFtp): wordbool; stdcall; procedure CkSFtp_putTcpNoDelay(objHandle: HCkSFtp; newPropVal: wordbool); stdcall; procedure CkSFtp_getUncommonOptions(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; procedure CkSFtp_putUncommonOptions(objHandle: HCkSFtp; newPropVal: PWideChar); stdcall; function CkSFtp__uncommonOptions(objHandle: HCkSFtp): PWideChar; stdcall; function CkSFtp_getUploadChunkSize(objHandle: HCkSFtp): Integer; stdcall; procedure CkSFtp_putUploadChunkSize(objHandle: HCkSFtp; newPropVal: Integer); stdcall; function CkSFtp_getUtcMode(objHandle: HCkSFtp): wordbool; stdcall; procedure CkSFtp_putUtcMode(objHandle: HCkSFtp; newPropVal: wordbool); stdcall; function CkSFtp_getVerboseLogging(objHandle: HCkSFtp): wordbool; stdcall; procedure CkSFtp_putVerboseLogging(objHandle: HCkSFtp; newPropVal: wordbool); stdcall; procedure CkSFtp_getVersion(objHandle: HCkSFtp; outPropVal: HCkString); stdcall; function CkSFtp__version(objHandle: HCkSFtp): PWideChar; stdcall; function CkSFtp_getXferByteCount(objHandle: HCkSFtp): LongWord; stdcall; function CkSFtp_getXferByteCount64(objHandle: HCkSFtp): Int64; stdcall; function CkSFtp_AccumulateBytes(objHandle: HCkSFtp; handle: PWideChar; maxBytes: Integer): Integer; stdcall; function CkSFtp_AccumulateBytesAsync(objHandle: HCkSFtp; handle: PWideChar; maxBytes: Integer): HCkTask; stdcall; function CkSFtp_Add64(objHandle: HCkSFtp; n1: PWideChar; n2: PWideChar; outStr: HCkString): wordbool; stdcall; function CkSFtp__add64(objHandle: HCkSFtp; n1: PWideChar; n2: PWideChar): PWideChar; stdcall; function CkSFtp_AuthenticatePk(objHandle: HCkSFtp; username: PWideChar; privateKey: HCkSshKey): wordbool; stdcall; function CkSFtp_AuthenticatePkAsync(objHandle: HCkSFtp; username: PWideChar; privateKey: HCkSshKey): HCkTask; stdcall; function CkSFtp_AuthenticatePw(objHandle: HCkSFtp; login: PWideChar; password: PWideChar): wordbool; stdcall; function CkSFtp_AuthenticatePwAsync(objHandle: HCkSFtp; login: PWideChar; password: PWideChar): HCkTask; stdcall; function CkSFtp_AuthenticatePwPk(objHandle: HCkSFtp; username: PWideChar; password: PWideChar; privateKey: HCkSshKey): wordbool; stdcall; function CkSFtp_AuthenticatePwPkAsync(objHandle: HCkSFtp; username: PWideChar; password: PWideChar; privateKey: HCkSshKey): HCkTask; stdcall; function CkSFtp_AuthenticateSecPw(objHandle: HCkSFtp; login: HCkSecureString; password: HCkSecureString): wordbool; stdcall; function CkSFtp_AuthenticateSecPwAsync(objHandle: HCkSFtp; login: HCkSecureString; password: HCkSecureString): HCkTask; stdcall; function CkSFtp_AuthenticateSecPwPk(objHandle: HCkSFtp; username: HCkSecureString; password: HCkSecureString; privateKey: HCkSshKey): wordbool; stdcall; function CkSFtp_AuthenticateSecPwPkAsync(objHandle: HCkSFtp; username: HCkSecureString; password: HCkSecureString; privateKey: HCkSshKey): HCkTask; stdcall; procedure CkSFtp_ClearAccumulateBuffer(objHandle: HCkSFtp); stdcall; procedure CkSFtp_ClearCache(objHandle: HCkSFtp); stdcall; procedure CkSFtp_ClearSessionLog(objHandle: HCkSFtp); stdcall; function CkSFtp_CloseHandle(objHandle: HCkSFtp; handle: PWideChar): wordbool; stdcall; function CkSFtp_CloseHandleAsync(objHandle: HCkSFtp; handle: PWideChar): HCkTask; stdcall; function CkSFtp_Connect(objHandle: HCkSFtp; domainName: PWideChar; port: Integer): wordbool; stdcall; function CkSFtp_ConnectAsync(objHandle: HCkSFtp; domainName: PWideChar; port: Integer): HCkTask; stdcall; function CkSFtp_ConnectThroughSsh(objHandle: HCkSFtp; sshConn: HCkSsh; hostname: PWideChar; port: Integer): wordbool; stdcall; function CkSFtp_ConnectThroughSshAsync(objHandle: HCkSFtp; sshConn: HCkSsh; hostname: PWideChar; port: Integer): HCkTask; stdcall; function CkSFtp_CopyFileAttr(objHandle: HCkSFtp; localFilename: PWideChar; remoteFilename: PWideChar; isHandle: wordbool): wordbool; stdcall; function CkSFtp_CopyFileAttrAsync(objHandle: HCkSFtp; localFilename: PWideChar; remoteFilename: PWideChar; isHandle: wordbool): HCkTask; stdcall; function CkSFtp_CreateDir(objHandle: HCkSFtp; path: PWideChar): wordbool; stdcall; function CkSFtp_CreateDirAsync(objHandle: HCkSFtp; path: PWideChar): HCkTask; stdcall; procedure CkSFtp_Disconnect(objHandle: HCkSFtp); stdcall; function CkSFtp_DownloadBd(objHandle: HCkSFtp; remoteFilePath: PWideChar; binData: HCkBinData): wordbool; stdcall; function CkSFtp_DownloadBdAsync(objHandle: HCkSFtp; remoteFilePath: PWideChar; binData: HCkBinData): HCkTask; stdcall; function CkSFtp_DownloadFile(objHandle: HCkSFtp; handle: PWideChar; toFilename: PWideChar): wordbool; stdcall; function CkSFtp_DownloadFileAsync(objHandle: HCkSFtp; handle: PWideChar; toFilename: PWideChar): HCkTask; stdcall; function CkSFtp_DownloadFileByName(objHandle: HCkSFtp; remoteFilePath: PWideChar; localFilePath: PWideChar): wordbool; stdcall; function CkSFtp_DownloadFileByNameAsync(objHandle: HCkSFtp; remoteFilePath: PWideChar; localFilePath: PWideChar): HCkTask; stdcall; function CkSFtp_DownloadSb(objHandle: HCkSFtp; remoteFilePath: PWideChar; charset: PWideChar; sb: HCkStringBuilder): wordbool; stdcall; function CkSFtp_DownloadSbAsync(objHandle: HCkSFtp; remoteFilePath: PWideChar; charset: PWideChar; sb: HCkStringBuilder): HCkTask; stdcall; function CkSFtp_Eof(objHandle: HCkSFtp; handle: PWideChar): wordbool; stdcall; function CkSFtp_FileExists(objHandle: HCkSFtp; remotePath: PWideChar; followLinks: wordbool): Integer; stdcall; function CkSFtp_FileExistsAsync(objHandle: HCkSFtp; remotePath: PWideChar; followLinks: wordbool): HCkTask; stdcall; function CkSFtp_Fsync(objHandle: HCkSFtp; handle: PWideChar): wordbool; stdcall; function CkSFtp_FsyncAsync(objHandle: HCkSFtp; handle: PWideChar): HCkTask; stdcall; function CkSFtp_GetFileCreateDt(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): HCkDateTime; stdcall; function CkSFtp_GetFileCreateDtAsync(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): HCkTask; stdcall; function CkSFtp_GetFileCreateTimeStr(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool; outStr: HCkString): wordbool; stdcall; function CkSFtp__getFileCreateTimeStr(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): PWideChar; stdcall; function CkSFtp_GetFileCreateTimeStrAsync(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): HCkTask; stdcall; function CkSFtp_GetFileGroup(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool; outStr: HCkString): wordbool; stdcall; function CkSFtp__getFileGroup(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): PWideChar; stdcall; function CkSFtp_GetFileGroupAsync(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): HCkTask; stdcall; function CkSFtp_GetFileLastAccessDt(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): HCkDateTime; stdcall; function CkSFtp_GetFileLastAccessDtAsync(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): HCkTask; stdcall; function CkSFtp_GetFileLastAccessStr(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool; outStr: HCkString): wordbool; stdcall; function CkSFtp__getFileLastAccessStr(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): PWideChar; stdcall; function CkSFtp_GetFileLastAccessStrAsync(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): HCkTask; stdcall; function CkSFtp_GetFileLastModifiedDt(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): HCkDateTime; stdcall; function CkSFtp_GetFileLastModifiedDtAsync(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): HCkTask; stdcall; function CkSFtp_GetFileLastModifiedStr(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool; outStr: HCkString): wordbool; stdcall; function CkSFtp__getFileLastModifiedStr(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): PWideChar; stdcall; function CkSFtp_GetFileLastModifiedStrAsync(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): HCkTask; stdcall; function CkSFtp_GetFileOwner(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool; outStr: HCkString): wordbool; stdcall; function CkSFtp__getFileOwner(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): PWideChar; stdcall; function CkSFtp_GetFileOwnerAsync(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): HCkTask; stdcall; function CkSFtp_GetFilePermissions(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): Integer; stdcall; function CkSFtp_GetFilePermissionsAsync(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): HCkTask; stdcall; function CkSFtp_GetFileSize32(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): Integer; stdcall; function CkSFtp_GetFileSize64(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): Int64; stdcall; function CkSFtp_GetFileSizeStr(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool; outStr: HCkString): wordbool; stdcall; function CkSFtp__getFileSizeStr(objHandle: HCkSFtp; pathOrHandle: PWideChar; bFollowLinks: wordbool; bIsHandle: wordbool): PWideChar; stdcall; function CkSFtp_HardLink(objHandle: HCkSFtp; oldPath: PWideChar; newPath: PWideChar): wordbool; stdcall; function CkSFtp_HardLinkAsync(objHandle: HCkSFtp; oldPath: PWideChar; newPath: PWideChar): HCkTask; stdcall; function CkSFtp_InitializeSftp(objHandle: HCkSFtp): wordbool; stdcall; function CkSFtp_InitializeSftpAsync(objHandle: HCkSFtp): HCkTask; stdcall; function CkSFtp_LastReadFailed(objHandle: HCkSFtp; handle: PWideChar): wordbool; stdcall; function CkSFtp_LastReadNumBytes(objHandle: HCkSFtp; handle: PWideChar): Integer; stdcall; function CkSFtp_OpenDir(objHandle: HCkSFtp; path: PWideChar; outStr: HCkString): wordbool; stdcall; function CkSFtp__openDir(objHandle: HCkSFtp; path: PWideChar): PWideChar; stdcall; function CkSFtp_OpenDirAsync(objHandle: HCkSFtp; path: PWideChar): HCkTask; stdcall; function CkSFtp_OpenFile(objHandle: HCkSFtp; remotePath: PWideChar; access: PWideChar; createDisposition: PWideChar; outStr: HCkString): wordbool; stdcall; function CkSFtp__openFile(objHandle: HCkSFtp; remotePath: PWideChar; access: PWideChar; createDisposition: PWideChar): PWideChar; stdcall; function CkSFtp_OpenFileAsync(objHandle: HCkSFtp; remotePath: PWideChar; access: PWideChar; createDisposition: PWideChar): HCkTask; stdcall; function CkSFtp_ReadDir(objHandle: HCkSFtp; handle: PWideChar): HCkSFtpDir; stdcall; function CkSFtp_ReadDirAsync(objHandle: HCkSFtp; handle: PWideChar): HCkTask; stdcall; function CkSFtp_ReadFileBytes(objHandle: HCkSFtp; handle: PWideChar; numBytes: Integer; outData: HCkByteData): wordbool; stdcall; function CkSFtp_ReadFileBytesAsync(objHandle: HCkSFtp; handle: PWideChar; numBytes: Integer): HCkTask; stdcall; function CkSFtp_ReadFileBytes32(objHandle: HCkSFtp; handle: PWideChar; offset: Integer; numBytes: Integer; outData: HCkByteData): wordbool; stdcall; function CkSFtp_ReadFileBytes64(objHandle: HCkSFtp; handle: PWideChar; offset: Int64; numBytes: Integer; outData: HCkByteData): wordbool; stdcall; function CkSFtp_ReadFileBytes64s(objHandle: HCkSFtp; handle: PWideChar; offset: PWideChar; numBytes: Integer; outData: HCkByteData): wordbool; stdcall; function CkSFtp_ReadFileText(objHandle: HCkSFtp; handle: PWideChar; numBytes: Integer; charset: PWideChar; outStr: HCkString): wordbool; stdcall; function CkSFtp__readFileText(objHandle: HCkSFtp; handle: PWideChar; numBytes: Integer; charset: PWideChar): PWideChar; stdcall; function CkSFtp_ReadFileTextAsync(objHandle: HCkSFtp; handle: PWideChar; numBytes: Integer; charset: PWideChar): HCkTask; stdcall; function CkSFtp_ReadFileText32(objHandle: HCkSFtp; handle: PWideChar; offset: Integer; numBytes: Integer; charset: PWideChar; outStr: HCkString): wordbool; stdcall; function CkSFtp__readFileText32(objHandle: HCkSFtp; handle: PWideChar; offset: Integer; numBytes: Integer; charset: PWideChar): PWideChar; stdcall; function CkSFtp_ReadFileText64(objHandle: HCkSFtp; handle: PWideChar; offset: Int64; numBytes: Integer; charset: PWideChar; outStr: HCkString): wordbool; stdcall; function CkSFtp__readFileText64(objHandle: HCkSFtp; handle: PWideChar; offset: Int64; numBytes: Integer; charset: PWideChar): PWideChar; stdcall; function CkSFtp_ReadFileText64s(objHandle: HCkSFtp; handle: PWideChar; offset: PWideChar; numBytes: Integer; charset: PWideChar; outStr: HCkString): wordbool; stdcall; function CkSFtp__readFileText64s(objHandle: HCkSFtp; handle: PWideChar; offset: PWideChar; numBytes: Integer; charset: PWideChar): PWideChar; stdcall; function CkSFtp_ReadLink(objHandle: HCkSFtp; path: PWideChar; outStr: HCkString): wordbool; stdcall; function CkSFtp__readLink(objHandle: HCkSFtp; path: PWideChar): PWideChar; stdcall; function CkSFtp_ReadLinkAsync(objHandle: HCkSFtp; path: PWideChar): HCkTask; stdcall; function CkSFtp_RealPath(objHandle: HCkSFtp; originalPath: PWideChar; composePath: PWideChar; outStr: HCkString): wordbool; stdcall; function CkSFtp__realPath(objHandle: HCkSFtp; originalPath: PWideChar; composePath: PWideChar): PWideChar; stdcall; function CkSFtp_RealPathAsync(objHandle: HCkSFtp; originalPath: PWideChar; composePath: PWideChar): HCkTask; stdcall; function CkSFtp_RemoveDir(objHandle: HCkSFtp; path: PWideChar): wordbool; stdcall; function CkSFtp_RemoveDirAsync(objHandle: HCkSFtp; path: PWideChar): HCkTask; stdcall; function CkSFtp_RemoveFile(objHandle: HCkSFtp; filename: PWideChar): wordbool; stdcall; function CkSFtp_RemoveFileAsync(objHandle: HCkSFtp; filename: PWideChar): HCkTask; stdcall; function CkSFtp_RenameFileOrDir(objHandle: HCkSFtp; oldPath: PWideChar; newPath: PWideChar): wordbool; stdcall; function CkSFtp_RenameFileOrDirAsync(objHandle: HCkSFtp; oldPath: PWideChar; newPath: PWideChar): HCkTask; stdcall; function CkSFtp_ResumeDownloadFileByName(objHandle: HCkSFtp; remoteFilePath: PWideChar; localFilePath: PWideChar): wordbool; stdcall; function CkSFtp_ResumeDownloadFileByNameAsync(objHandle: HCkSFtp; remoteFilePath: PWideChar; localFilePath: PWideChar): HCkTask; stdcall; function CkSFtp_ResumeUploadFileByName(objHandle: HCkSFtp; remoteFilePath: PWideChar; localFilePath: PWideChar): wordbool; stdcall; function CkSFtp_ResumeUploadFileByNameAsync(objHandle: HCkSFtp; remoteFilePath: PWideChar; localFilePath: PWideChar): HCkTask; stdcall; function CkSFtp_SaveLastError(objHandle: HCkSFtp; path: PWideChar): wordbool; stdcall; function CkSFtp_SendIgnore(objHandle: HCkSFtp): wordbool; stdcall; function CkSFtp_SendIgnoreAsync(objHandle: HCkSFtp): HCkTask; stdcall; function CkSFtp_SetCreateDt(objHandle: HCkSFtp; pathOrHandle: PWideChar; isHandle: wordbool; createDateTime: HCkDateTime): wordbool; stdcall; function CkSFtp_SetCreateDtAsync(objHandle: HCkSFtp; pathOrHandle: PWideChar; isHandle: wordbool; createDateTime: HCkDateTime): HCkTask; stdcall; function CkSFtp_SetCreateTimeStr(objHandle: HCkSFtp; pathOrHandle: PWideChar; bIsHandle: wordbool; dateTimeStr: PWideChar): wordbool; stdcall; function CkSFtp_SetCreateTimeStrAsync(objHandle: HCkSFtp; pathOrHandle: PWideChar; bIsHandle: wordbool; dateTimeStr: PWideChar): HCkTask; stdcall; function CkSFtp_SetLastAccessDt(objHandle: HCkSFtp; pathOrHandle: PWideChar; isHandle: wordbool; accessDateTime: HCkDateTime): wordbool; stdcall; function CkSFtp_SetLastAccessDtAsync(objHandle: HCkSFtp; pathOrHandle: PWideChar; isHandle: wordbool; accessDateTime: HCkDateTime): HCkTask; stdcall; function CkSFtp_SetLastAccessTimeStr(objHandle: HCkSFtp; pathOrHandle: PWideChar; bIsHandle: wordbool; dateTimeStr: PWideChar): wordbool; stdcall; function CkSFtp_SetLastAccessTimeStrAsync(objHandle: HCkSFtp; pathOrHandle: PWideChar; bIsHandle: wordbool; dateTimeStr: PWideChar): HCkTask; stdcall; function CkSFtp_SetLastModifiedDt(objHandle: HCkSFtp; pathOrHandle: PWideChar; isHandle: wordbool; modifiedDateTime: HCkDateTime): wordbool; stdcall; function CkSFtp_SetLastModifiedDtAsync(objHandle: HCkSFtp; pathOrHandle: PWideChar; isHandle: wordbool; modifiedDateTime: HCkDateTime): HCkTask; stdcall; function CkSFtp_SetLastModifiedTimeStr(objHandle: HCkSFtp; pathOrHandle: PWideChar; bIsHandle: wordbool; dateTimeStr: PWideChar): wordbool; stdcall; function CkSFtp_SetLastModifiedTimeStrAsync(objHandle: HCkSFtp; pathOrHandle: PWideChar; bIsHandle: wordbool; dateTimeStr: PWideChar): HCkTask; stdcall; function CkSFtp_SetOwnerAndGroup(objHandle: HCkSFtp; pathOrHandle: PWideChar; isHandle: wordbool; owner: PWideChar; group: PWideChar): wordbool; stdcall; function CkSFtp_SetOwnerAndGroupAsync(objHandle: HCkSFtp; pathOrHandle: PWideChar; isHandle: wordbool; owner: PWideChar; group: PWideChar): HCkTask; stdcall; function CkSFtp_SetPermissions(objHandle: HCkSFtp; pathOrHandle: PWideChar; isHandle: wordbool; permissions: Integer): wordbool; stdcall; function CkSFtp_SetPermissionsAsync(objHandle: HCkSFtp; pathOrHandle: PWideChar; isHandle: wordbool; permissions: Integer): HCkTask; stdcall; function CkSFtp_SymLink(objHandle: HCkSFtp; oldPath: PWideChar; newPath: PWideChar): wordbool; stdcall; function CkSFtp_SymLinkAsync(objHandle: HCkSFtp; oldPath: PWideChar; newPath: PWideChar): HCkTask; stdcall; function CkSFtp_SyncTreeDownload(objHandle: HCkSFtp; remoteRoot: PWideChar; localRoot: PWideChar; mode: Integer; recurse: wordbool): wordbool; stdcall; function CkSFtp_SyncTreeDownloadAsync(objHandle: HCkSFtp; remoteRoot: PWideChar; localRoot: PWideChar; mode: Integer; recurse: wordbool): HCkTask; stdcall; function CkSFtp_SyncTreeUpload(objHandle: HCkSFtp; localBaseDir: PWideChar; remoteBaseDir: PWideChar; mode: Integer; bRecurse: wordbool): wordbool; stdcall; function CkSFtp_SyncTreeUploadAsync(objHandle: HCkSFtp; localBaseDir: PWideChar; remoteBaseDir: PWideChar; mode: Integer; bRecurse: wordbool): HCkTask; stdcall; function CkSFtp_UnlockComponent(objHandle: HCkSFtp; unlockCode: PWideChar): wordbool; stdcall; function CkSFtp_UploadBd(objHandle: HCkSFtp; binData: HCkBinData; remoteFilePath: PWideChar): wordbool; stdcall; function CkSFtp_UploadBdAsync(objHandle: HCkSFtp; binData: HCkBinData; remoteFilePath: PWideChar): HCkTask; stdcall; function CkSFtp_UploadFile(objHandle: HCkSFtp; handle: PWideChar; fromFilename: PWideChar): wordbool; stdcall; function CkSFtp_UploadFileAsync(objHandle: HCkSFtp; handle: PWideChar; fromFilename: PWideChar): HCkTask; stdcall; function CkSFtp_UploadFileByName(objHandle: HCkSFtp; remoteFilePath: PWideChar; localFilePath: PWideChar): wordbool; stdcall; function CkSFtp_UploadFileByNameAsync(objHandle: HCkSFtp; remoteFilePath: PWideChar; localFilePath: PWideChar): HCkTask; stdcall; function CkSFtp_UploadSb(objHandle: HCkSFtp; sb: HCkStringBuilder; remoteFilePath: PWideChar; charset: PWideChar; includeBom: wordbool): wordbool; stdcall; function CkSFtp_UploadSbAsync(objHandle: HCkSFtp; sb: HCkStringBuilder; remoteFilePath: PWideChar; charset: PWideChar; includeBom: wordbool): HCkTask; stdcall; function CkSFtp_WriteFileBytes(objHandle: HCkSFtp; handle: PWideChar; byteData: HCkByteData): wordbool; stdcall; function CkSFtp_WriteFileBytesAsync(objHandle: HCkSFtp; handle: PWideChar; byteData: HCkByteData): HCkTask; stdcall; function CkSFtp_WriteFileBytes32(objHandle: HCkSFtp; handle: PWideChar; offset: Integer; data: HCkByteData): wordbool; stdcall; function CkSFtp_WriteFileBytes64(objHandle: HCkSFtp; handle: PWideChar; offset64: Int64; data: HCkByteData): wordbool; stdcall; function CkSFtp_WriteFileBytes64s(objHandle: HCkSFtp; handle: PWideChar; offset64: PWideChar; data: HCkByteData): wordbool; stdcall; function CkSFtp_WriteFileText(objHandle: HCkSFtp; handle: PWideChar; charset: PWideChar; textData: PWideChar): wordbool; stdcall; function CkSFtp_WriteFileTextAsync(objHandle: HCkSFtp; handle: PWideChar; charset: PWideChar; textData: PWideChar): HCkTask; stdcall; function CkSFtp_WriteFileText32(objHandle: HCkSFtp; handle: PWideChar; offset32: Integer; charset: PWideChar; textData: PWideChar): wordbool; stdcall; function CkSFtp_WriteFileText64(objHandle: HCkSFtp; handle: PWideChar; offset64: Int64; charset: PWideChar; textData: PWideChar): wordbool; stdcall; function CkSFtp_WriteFileText64s(objHandle: HCkSFtp; handle: PWideChar; offset64: PWideChar; charset: PWideChar; textData: PWideChar): wordbool; stdcall; implementation {$Include chilkatDllPath.inc} function CkSFtp_Create; external DLLName; procedure CkSFtp_Dispose; external DLLName; function CkSFtp_getAbortCurrent; external DLLName; procedure CkSFtp_putAbortCurrent; external DLLName; procedure CkSFtp_getAccumulateBuffer; external DLLName; function CkSFtp_getAuthFailReason; external DLLName; function CkSFtp_getBandwidthThrottleDown; external DLLName; procedure CkSFtp_putBandwidthThrottleDown; external DLLName; function CkSFtp_getBandwidthThrottleUp; external DLLName; procedure CkSFtp_putBandwidthThrottleUp; external DLLName; procedure CkSFtp_getClientIdentifier; external DLLName; procedure CkSFtp_putClientIdentifier; external DLLName; function CkSFtp__clientIdentifier; external DLLName; procedure CkSFtp_getClientIpAddress; external DLLName; procedure CkSFtp_putClientIpAddress; external DLLName; function CkSFtp__clientIpAddress; external DLLName; function CkSFtp_getConnectTimeoutMs; external DLLName; procedure CkSFtp_putConnectTimeoutMs; external DLLName; procedure CkSFtp_getDebugLogFilePath; external DLLName; procedure CkSFtp_putDebugLogFilePath; external DLLName; function CkSFtp__debugLogFilePath; external DLLName; function CkSFtp_getDisconnectCode; external DLLName; procedure CkSFtp_getDisconnectReason; external DLLName; function CkSFtp__disconnectReason; external DLLName; function CkSFtp_getEnableCache; external DLLName; procedure CkSFtp_putEnableCache; external DLLName; function CkSFtp_getEnableCompression; external DLLName; procedure CkSFtp_putEnableCompression; external DLLName; procedure CkSFtp_getFilenameCharset; external DLLName; procedure CkSFtp_putFilenameCharset; external DLLName; function CkSFtp__filenameCharset; external DLLName; procedure CkSFtp_getForceCipher; external DLLName; procedure CkSFtp_putForceCipher; external DLLName; function CkSFtp__forceCipher; external DLLName; function CkSFtp_getForceV3; external DLLName; procedure CkSFtp_putForceV3; external DLLName; function CkSFtp_getHeartbeatMs; external DLLName; procedure CkSFtp_putHeartbeatMs; external DLLName; procedure CkSFtp_getHostKeyAlg; external DLLName; procedure CkSFtp_putHostKeyAlg; external DLLName; function CkSFtp__hostKeyAlg; external DLLName; procedure CkSFtp_getHostKeyFingerprint; external DLLName; function CkSFtp__hostKeyFingerprint; external DLLName; procedure CkSFtp_getHttpProxyAuthMethod; external DLLName; procedure CkSFtp_putHttpProxyAuthMethod; external DLLName; function CkSFtp__httpProxyAuthMethod; external DLLName; procedure CkSFtp_getHttpProxyDomain; external DLLName; procedure CkSFtp_putHttpProxyDomain; external DLLName; function CkSFtp__httpProxyDomain; external DLLName; procedure CkSFtp_getHttpProxyHostname; external DLLName; procedure CkSFtp_putHttpProxyHostname; external DLLName; function CkSFtp__httpProxyHostname; external DLLName; procedure CkSFtp_getHttpProxyPassword; external DLLName; procedure CkSFtp_putHttpProxyPassword; external DLLName; function CkSFtp__httpProxyPassword; external DLLName; function CkSFtp_getHttpProxyPort; external DLLName; procedure CkSFtp_putHttpProxyPort; external DLLName; procedure CkSFtp_getHttpProxyUsername; external DLLName; procedure CkSFtp_putHttpProxyUsername; external DLLName; function CkSFtp__httpProxyUsername; external DLLName; function CkSFtp_getIdleTimeoutMs; external DLLName; procedure CkSFtp_putIdleTimeoutMs; external DLLName; function CkSFtp_getIncludeDotDirs; external DLLName; procedure CkSFtp_putIncludeDotDirs; external DLLName; function CkSFtp_getInitializeFailCode; external DLLName; procedure CkSFtp_getInitializeFailReason; external DLLName; function CkSFtp__initializeFailReason; external DLLName; function CkSFtp_getIsConnected; external DLLName; function CkSFtp_getKeepSessionLog; external DLLName; procedure CkSFtp_putKeepSessionLog; external DLLName; procedure CkSFtp_getLastErrorHtml; external DLLName; function CkSFtp__lastErrorHtml; external DLLName; procedure CkSFtp_getLastErrorText; external DLLName; function CkSFtp__lastErrorText; external DLLName; procedure CkSFtp_getLastErrorXml; external DLLName; function CkSFtp__lastErrorXml; external DLLName; function CkSFtp_getLastMethodSuccess; external DLLName; procedure CkSFtp_putLastMethodSuccess; external DLLName; function CkSFtp_getMaxPacketSize; external DLLName; procedure CkSFtp_putMaxPacketSize; external DLLName; function CkSFtp_getPasswordChangeRequested; external DLLName; function CkSFtp_getPercentDoneScale; external DLLName; procedure CkSFtp_putPercentDoneScale; external DLLName; function CkSFtp_getPreferIpv6; external DLLName; procedure CkSFtp_putPreferIpv6; external DLLName; function CkSFtp_getPreserveDate; external DLLName; procedure CkSFtp_putPreserveDate; external DLLName; function CkSFtp_getProtocolVersion; external DLLName; procedure CkSFtp_getReadDirMustMatch; external DLLName; procedure CkSFtp_putReadDirMustMatch; external DLLName; function CkSFtp__readDirMustMatch; external DLLName; procedure CkSFtp_getReadDirMustNotMatch; external DLLName; procedure CkSFtp_putReadDirMustNotMatch; external DLLName; function CkSFtp__readDirMustNotMatch; external DLLName; procedure CkSFtp_getServerIdentifier; external DLLName; function CkSFtp__serverIdentifier; external DLLName; procedure CkSFtp_getSessionLog; external DLLName; function CkSFtp__sessionLog; external DLLName; procedure CkSFtp_getSocksHostname; external DLLName; procedure CkSFtp_putSocksHostname; external DLLName; function CkSFtp__socksHostname; external DLLName; procedure CkSFtp_getSocksPassword; external DLLName; procedure CkSFtp_putSocksPassword; external DLLName; function CkSFtp__socksPassword; external DLLName; function CkSFtp_getSocksPort; external DLLName; procedure CkSFtp_putSocksPort; external DLLName; procedure CkSFtp_getSocksUsername; external DLLName; procedure CkSFtp_putSocksUsername; external DLLName; function CkSFtp__socksUsername; external DLLName; function CkSFtp_getSocksVersion; external DLLName; procedure CkSFtp_putSocksVersion; external DLLName; function CkSFtp_getSoRcvBuf; external DLLName; procedure CkSFtp_putSoRcvBuf; external DLLName; function CkSFtp_getSoSndBuf; external DLLName; procedure CkSFtp_putSoSndBuf; external DLLName; function CkSFtp_getSyncCreateAllLocalDirs; external DLLName; procedure CkSFtp_putSyncCreateAllLocalDirs; external DLLName; procedure CkSFtp_getSyncDirectives; external DLLName; procedure CkSFtp_putSyncDirectives; external DLLName; function CkSFtp__syncDirectives; external DLLName; procedure CkSFtp_getSyncedFiles; external DLLName; procedure CkSFtp_putSyncedFiles; external DLLName; function CkSFtp__syncedFiles; external DLLName; procedure CkSFtp_getSyncMustMatch; external DLLName; procedure CkSFtp_putSyncMustMatch; external DLLName; function CkSFtp__syncMustMatch; external DLLName; procedure CkSFtp_getSyncMustMatchDir; external DLLName; procedure CkSFtp_putSyncMustMatchDir; external DLLName; function CkSFtp__syncMustMatchDir; external DLLName; procedure CkSFtp_getSyncMustNotMatch; external DLLName; procedure CkSFtp_putSyncMustNotMatch; external DLLName; function CkSFtp__syncMustNotMatch; external DLLName; procedure CkSFtp_getSyncMustNotMatchDir; external DLLName; procedure CkSFtp_putSyncMustNotMatchDir; external DLLName; function CkSFtp__syncMustNotMatchDir; external DLLName; function CkSFtp_getTcpNoDelay; external DLLName; procedure CkSFtp_putTcpNoDelay; external DLLName; procedure CkSFtp_getUncommonOptions; external DLLName; procedure CkSFtp_putUncommonOptions; external DLLName; function CkSFtp__uncommonOptions; external DLLName; function CkSFtp_getUploadChunkSize; external DLLName; procedure CkSFtp_putUploadChunkSize; external DLLName; function CkSFtp_getUtcMode; external DLLName; procedure CkSFtp_putUtcMode; external DLLName; function CkSFtp_getVerboseLogging; external DLLName; procedure CkSFtp_putVerboseLogging; external DLLName; procedure CkSFtp_getVersion; external DLLName; function CkSFtp__version; external DLLName; function CkSFtp_getXferByteCount; external DLLName; function CkSFtp_getXferByteCount64; external DLLName; function CkSFtp_AccumulateBytes; external DLLName; function CkSFtp_AccumulateBytesAsync; external DLLName; function CkSFtp_Add64; external DLLName; function CkSFtp__add64; external DLLName; function CkSFtp_AuthenticatePk; external DLLName; function CkSFtp_AuthenticatePkAsync; external DLLName; function CkSFtp_AuthenticatePw; external DLLName; function CkSFtp_AuthenticatePwAsync; external DLLName; function CkSFtp_AuthenticatePwPk; external DLLName; function CkSFtp_AuthenticatePwPkAsync; external DLLName; function CkSFtp_AuthenticateSecPw; external DLLName; function CkSFtp_AuthenticateSecPwAsync; external DLLName; function CkSFtp_AuthenticateSecPwPk; external DLLName; function CkSFtp_AuthenticateSecPwPkAsync; external DLLName; procedure CkSFtp_ClearAccumulateBuffer; external DLLName; procedure CkSFtp_ClearCache; external DLLName; procedure CkSFtp_ClearSessionLog; external DLLName; function CkSFtp_CloseHandle; external DLLName; function CkSFtp_CloseHandleAsync; external DLLName; function CkSFtp_Connect; external DLLName; function CkSFtp_ConnectAsync; external DLLName; function CkSFtp_ConnectThroughSsh; external DLLName; function CkSFtp_ConnectThroughSshAsync; external DLLName; function CkSFtp_CopyFileAttr; external DLLName; function CkSFtp_CopyFileAttrAsync; external DLLName; function CkSFtp_CreateDir; external DLLName; function CkSFtp_CreateDirAsync; external DLLName; procedure CkSFtp_Disconnect; external DLLName; function CkSFtp_DownloadBd; external DLLName; function CkSFtp_DownloadBdAsync; external DLLName; function CkSFtp_DownloadFile; external DLLName; function CkSFtp_DownloadFileAsync; external DLLName; function CkSFtp_DownloadFileByName; external DLLName; function CkSFtp_DownloadFileByNameAsync; external DLLName; function CkSFtp_DownloadSb; external DLLName; function CkSFtp_DownloadSbAsync; external DLLName; function CkSFtp_Eof; external DLLName; function CkSFtp_FileExists; external DLLName; function CkSFtp_FileExistsAsync; external DLLName; function CkSFtp_Fsync; external DLLName; function CkSFtp_FsyncAsync; external DLLName; function CkSFtp_GetFileCreateDt; external DLLName; function CkSFtp_GetFileCreateDtAsync; external DLLName; function CkSFtp_GetFileCreateTimeStr; external DLLName; function CkSFtp__getFileCreateTimeStr; external DLLName; function CkSFtp_GetFileCreateTimeStrAsync; external DLLName; function CkSFtp_GetFileGroup; external DLLName; function CkSFtp__getFileGroup; external DLLName; function CkSFtp_GetFileGroupAsync; external DLLName; function CkSFtp_GetFileLastAccessDt; external DLLName; function CkSFtp_GetFileLastAccessDtAsync; external DLLName; function CkSFtp_GetFileLastAccessStr; external DLLName; function CkSFtp__getFileLastAccessStr; external DLLName; function CkSFtp_GetFileLastAccessStrAsync; external DLLName; function CkSFtp_GetFileLastModifiedDt; external DLLName; function CkSFtp_GetFileLastModifiedDtAsync; external DLLName; function CkSFtp_GetFileLastModifiedStr; external DLLName; function CkSFtp__getFileLastModifiedStr; external DLLName; function CkSFtp_GetFileLastModifiedStrAsync; external DLLName; function CkSFtp_GetFileOwner; external DLLName; function CkSFtp__getFileOwner; external DLLName; function CkSFtp_GetFileOwnerAsync; external DLLName; function CkSFtp_GetFilePermissions; external DLLName; function CkSFtp_GetFilePermissionsAsync; external DLLName; function CkSFtp_GetFileSize32; external DLLName; function CkSFtp_GetFileSize64; external DLLName; function CkSFtp_GetFileSizeStr; external DLLName; function CkSFtp__getFileSizeStr; external DLLName; function CkSFtp_HardLink; external DLLName; function CkSFtp_HardLinkAsync; external DLLName; function CkSFtp_InitializeSftp; external DLLName; function CkSFtp_InitializeSftpAsync; external DLLName; function CkSFtp_LastReadFailed; external DLLName; function CkSFtp_LastReadNumBytes; external DLLName; function CkSFtp_OpenDir; external DLLName; function CkSFtp__openDir; external DLLName; function CkSFtp_OpenDirAsync; external DLLName; function CkSFtp_OpenFile; external DLLName; function CkSFtp__openFile; external DLLName; function CkSFtp_OpenFileAsync; external DLLName; function CkSFtp_ReadDir; external DLLName; function CkSFtp_ReadDirAsync; external DLLName; function CkSFtp_ReadFileBytes; external DLLName; function CkSFtp_ReadFileBytesAsync; external DLLName; function CkSFtp_ReadFileBytes32; external DLLName; function CkSFtp_ReadFileBytes64; external DLLName; function CkSFtp_ReadFileBytes64s; external DLLName; function CkSFtp_ReadFileText; external DLLName; function CkSFtp__readFileText; external DLLName; function CkSFtp_ReadFileTextAsync; external DLLName; function CkSFtp_ReadFileText32; external DLLName; function CkSFtp__readFileText32; external DLLName; function CkSFtp_ReadFileText64; external DLLName; function CkSFtp__readFileText64; external DLLName; function CkSFtp_ReadFileText64s; external DLLName; function CkSFtp__readFileText64s; external DLLName; function CkSFtp_ReadLink; external DLLName; function CkSFtp__readLink; external DLLName; function CkSFtp_ReadLinkAsync; external DLLName; function CkSFtp_RealPath; external DLLName; function CkSFtp__realPath; external DLLName; function CkSFtp_RealPathAsync; external DLLName; function CkSFtp_RemoveDir; external DLLName; function CkSFtp_RemoveDirAsync; external DLLName; function CkSFtp_RemoveFile; external DLLName; function CkSFtp_RemoveFileAsync; external DLLName; function CkSFtp_RenameFileOrDir; external DLLName; function CkSFtp_RenameFileOrDirAsync; external DLLName; function CkSFtp_ResumeDownloadFileByName; external DLLName; function CkSFtp_ResumeDownloadFileByNameAsync; external DLLName; function CkSFtp_ResumeUploadFileByName; external DLLName; function CkSFtp_ResumeUploadFileByNameAsync; external DLLName; function CkSFtp_SaveLastError; external DLLName; function CkSFtp_SendIgnore; external DLLName; function CkSFtp_SendIgnoreAsync; external DLLName; function CkSFtp_SetCreateDt; external DLLName; function CkSFtp_SetCreateDtAsync; external DLLName; function CkSFtp_SetCreateTimeStr; external DLLName; function CkSFtp_SetCreateTimeStrAsync; external DLLName; function CkSFtp_SetLastAccessDt; external DLLName; function CkSFtp_SetLastAccessDtAsync; external DLLName; function CkSFtp_SetLastAccessTimeStr; external DLLName; function CkSFtp_SetLastAccessTimeStrAsync; external DLLName; function CkSFtp_SetLastModifiedDt; external DLLName; function CkSFtp_SetLastModifiedDtAsync; external DLLName; function CkSFtp_SetLastModifiedTimeStr; external DLLName; function CkSFtp_SetLastModifiedTimeStrAsync; external DLLName; function CkSFtp_SetOwnerAndGroup; external DLLName; function CkSFtp_SetOwnerAndGroupAsync; external DLLName; function CkSFtp_SetPermissions; external DLLName; function CkSFtp_SetPermissionsAsync; external DLLName; function CkSFtp_SymLink; external DLLName; function CkSFtp_SymLinkAsync; external DLLName; function CkSFtp_SyncTreeDownload; external DLLName; function CkSFtp_SyncTreeDownloadAsync; external DLLName; function CkSFtp_SyncTreeUpload; external DLLName; function CkSFtp_SyncTreeUploadAsync; external DLLName; function CkSFtp_UnlockComponent; external DLLName; function CkSFtp_UploadBd; external DLLName; function CkSFtp_UploadBdAsync; external DLLName; function CkSFtp_UploadFile; external DLLName; function CkSFtp_UploadFileAsync; external DLLName; function CkSFtp_UploadFileByName; external DLLName; function CkSFtp_UploadFileByNameAsync; external DLLName; function CkSFtp_UploadSb; external DLLName; function CkSFtp_UploadSbAsync; external DLLName; function CkSFtp_WriteFileBytes; external DLLName; function CkSFtp_WriteFileBytesAsync; external DLLName; function CkSFtp_WriteFileBytes32; external DLLName; function CkSFtp_WriteFileBytes64; external DLLName; function CkSFtp_WriteFileBytes64s; external DLLName; function CkSFtp_WriteFileText; external DLLName; function CkSFtp_WriteFileTextAsync; external DLLName; function CkSFtp_WriteFileText32; external DLLName; function CkSFtp_WriteFileText64; external DLLName; function CkSFtp_WriteFileText64s; external DLLName; end.
51.379237
167
0.849511
f1ebdf3b4f0cc5247b771eab87bec2f9914bac53
2,712
dfm
Pascal
Catalogos/PersonasCSDEdit.dfm
alexismzt/SOFOM
57ca73e9f7fbb51521149ea7c0fdc409c22cc6f7
[ "Apache-2.0" ]
null
null
null
Catalogos/PersonasCSDEdit.dfm
alexismzt/SOFOM
57ca73e9f7fbb51521149ea7c0fdc409c22cc6f7
[ "Apache-2.0" ]
51
2018-07-25T15:39:25.000Z
2021-04-21T17:40:57.000Z
Catalogos/PersonasCSDEdit.dfm
alexismzt/SOFOM
57ca73e9f7fbb51521149ea7c0fdc409c22cc6f7
[ "Apache-2.0" ]
1
2021-02-23T17:27:06.000Z
2021-02-23T17:27:06.000Z
inherited frmPersonasCSDEdit: TfrmPersonasCSDEdit Caption = 'Certificado de sello digital' ClientHeight = 334 ClientWidth = 418 ExplicitWidth = 424 ExplicitHeight = 363 PixelsPerInch = 96 TextHeight = 13 inherited pcMain: TcxPageControl Width = 418 Height = 293 ExplicitWidth = 418 ExplicitHeight = 208 ClientRectBottom = 291 ClientRectRight = 416 inherited tsGeneral: TcxTabSheet ExplicitLeft = 1 ExplicitTop = 30 ExplicitWidth = 414 ExplicitHeight = 263 object Label1: TLabel Left = 16 Top = 16 Width = 59 Height = 13 Caption = 'Archivo CER' end object Label2: TLabel Left = 16 Top = 159 Width = 27 Height = 13 Caption = 'Clave' FocusControl = cxDBTextEdit1 end object Label3: TLabel Left = 16 Top = 199 Width = 57 Height = 13 Caption = 'Vencimiento' end object btnUpdateFileCER: TSpeedButton Left = 375 Top = 30 Width = 23 Height = 22 end object Label4: TLabel Left = 16 Top = 77 Width = 57 Height = 13 Caption = 'Archivo KEY' end object btnUpdateFileKEY: TSpeedButton Left = 375 Top = 91 Width = 23 Height = 22 end object cxDBTextEdit1: TcxDBTextEdit Left = 16 Top = 172 DataBinding.DataField = 'Clave' DataBinding.DataSource = DataSource TabOrder = 2 Width = 382 end object cxDBLabel1: TcxDBLabel Left = 14 Top = 30 DataBinding.DataField = 'ArchivoCER' DataBinding.DataSource = DataSource Height = 45 Width = 355 end object cxDBDateEdit1: TcxDBDateEdit Left = 16 Top = 215 DataBinding.DataField = 'Vencimiento' DataBinding.DataSource = DataSource TabOrder = 3 Width = 145 end object cxDBLabel2: TcxDBLabel Left = 14 Top = 91 DataBinding.DataField = 'ArchivoKEY' DataBinding.DataSource = DataSource Height = 45 Width = 355 end end end inherited pmlMain: TPanel Top = 293 Width = 418 ExplicitTop = 208 ExplicitWidth = 418 inherited btnCancel: TButton Left = 336 ExplicitLeft = 336 end inherited btnOk: TButton Left = 255 ExplicitLeft = 255 end end inherited cxImageList: TcxImageList FormatVersion = 1 end end
23.789474
50
0.546091
f1570ec54706344be50842e9be84f25f095e568a
2,704
pas
Pascal
toolkit/QuestionnaireContextDialog.pas
rhausam/fhirserver
d7e2fc59f9c55b1989367b4d3e2ad8a811e71af3
[ "BSD-3-Clause" ]
132
2015-02-02T00:22:40.000Z
2021-08-11T12:08:08.000Z
toolkit/QuestionnaireContextDialog.pas
rhausam/fhirserver
d7e2fc59f9c55b1989367b4d3e2ad8a811e71af3
[ "BSD-3-Clause" ]
113
2015-03-20T01:55:20.000Z
2021-10-08T16:15:28.000Z
toolkit/QuestionnaireContextDialog.pas
rhausam/fhirserver
d7e2fc59f9c55b1989367b4d3e2ad8a811e71af3
[ "BSD-3-Clause" ]
49
2015-04-11T14:59:43.000Z
2021-03-30T10:29:18.000Z
unit QuestionnaireContextDialog; { 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. } interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, FMX.ScrollBox, FMX.Memo, FMX.Edit, FMX.Controls.Presentation, FHIR.Version.Types; type TQuestionnaireContextForm = class(TForm) Label1: TLabel; Label2: TLabel; Label3: TLabel; Edit1: TEdit; Edit2: TEdit; Memo1: TMemo; Button1: TButton; Button2: TButton; procedure FormDestroy(Sender: TObject); private FContext: TFHIRExtension; procedure SetContext(const Value: TFHIRExtension); public property Context : TFHIRExtension read FContext write SetContext; end; var QuestionnaireContextForm: TQuestionnaireContextForm; implementation {$R *.fmx} { TQuestionnaireContextForm } procedure TQuestionnaireContextForm.FormDestroy(Sender: TObject); begin FContext.free; end; procedure TQuestionnaireContextForm.SetContext(const Value: TFHIRExtension); begin FContext.free; FContext := Value; end; end.
34.227848
98
0.760725
f1a162196dfc50d74e29e255c3ba25c7066f6703
4,557
pas
Pascal
examples/standard/CreateCoreObjects/CreateGenericObject.pas
CrystalNet-Tech/dotNetCore4Delphi
20a2ea4cfea4edb1c845a37aa5288c190808ed80
[ "Apache-2.0" ]
null
null
null
examples/standard/CreateCoreObjects/CreateGenericObject.pas
CrystalNet-Tech/dotNetCore4Delphi
20a2ea4cfea4edb1c845a37aa5288c190808ed80
[ "Apache-2.0" ]
null
null
null
examples/standard/CreateCoreObjects/CreateGenericObject.pas
CrystalNet-Tech/dotNetCore4Delphi
20a2ea4cfea4edb1c845a37aa5288c190808ed80
[ "Apache-2.0" ]
null
null
null
unit CreateGenericObject; {$IFDEF FPC} {$MODE Delphi} {$ENDIF} interface uses CNCoreClrLib.Intf, CNCoreClrLib.ObjectMgr, CoreClrTypes, CNCoreClrLib.RttiMgr; type TGenericObjectDemo = class private class procedure DisplayGenericInfo(GenericObj: TCoreClrObject); public class procedure CreateGenericListOfInt32; static; class procedure CreateGenericListOfString; static; class procedure CreateGenericListObjectOfInteger; static; end; TCoreGenericObject = class(TCoreClrObject) public constructor Create(AGenericTypeName: string; AGenericTypeNames: array of string; AArguments: array of Variant); overload; constructor Create(AGenericTypeName: string; AGenericTypeNames: array of string; AArguments: array of NCObject); overload; constructor Create(AGenericTypeName: string; AGenericTypeNames: array of string; AArguments: NCObjectArray); overload; end; {$IFNDEF FPC} [TypeMappingAttribute('CreateGenericObject.TList<T>', 'System.Collections.Generic.List`1')] {$ENDIF} IList<T> = Interface(ICoreClrObject) ['{59ABBB82-628E-4484-90FB-0809F2D91789}'] end; TList<T> = class(TCoreClrGenericObject, IList<T>) public constructor Create(); overload; constructor Create(capacity: Integer); overload; end; implementation uses uConsole, TypInfo; { TList<T> } constructor TList<T>.Create(capacity: Integer); begin {$IFDEF FPC} Inherited Create(TArray<PTypeInfo>.Create(GetTypeInfo<T>), 'System.Collections.Generic.List`1', [GetTypeName<T>], [capacity]); {$ELSE} {$IF CompilerVersion > 27.0} Inherited Create([GetTypeInfo<T>], 'System.Collections.Generic.List`1', [GetTypeName<T>], [capacity]); {$ELSE} Inherited Create(TArray<PTypeInfo>.Create(GetTypeInfo<T>), 'System.Collections.Generic.List`1', [GetTypeName<T>], [capacity]); {$IFEND} {$ENDIF} end; constructor TList<T>.Create; begin {$IFDEF FPC} Inherited Create(TArray<PTypeInfo>.Create(GetTypeInfo<T>), 'System.Collections.Generic.List`1', [GetTypeName<T>], []); {$ELSE} {$IF CompilerVersion > 27.0} Inherited Create([GetTypeInfo<T>], 'System.Collections.Generic.List`1', [GetTypeName<T>], []); {$ELSE} Inherited Create(TArray<PTypeInfo>.Create(GetTypeInfo<T>), 'System.Collections.Generic.List`1', [GetTypeName<T>], []); {$IFEND} {$ENDIF} end; { TCoreGenericObject } constructor TCoreGenericObject.Create(AGenericTypeName: string; AGenericTypeNames: array of string; AArguments: NCObjectArray); begin inherited Create(AGenericTypeName, AGenericTypeNames, AArguments); end; constructor TCoreGenericObject.Create(AGenericTypeName: string; AGenericTypeNames: array of string; AArguments: array of NCObject); begin inherited Create(AGenericTypeName, AGenericTypeNames, AArguments); end; constructor TCoreGenericObject.Create(AGenericTypeName: string; AGenericTypeNames: array of string; AArguments: array of Variant); begin inherited Create(AGenericTypeName, AGenericTypeNames, AArguments); end; { TGenericObjectDemo } class procedure TGenericObjectDemo.CreateGenericListOfInt32; var genericObject: TCoreGenericObject; arguments: TArray<Variant>; begin arguments := TArray<Variant>.Create(10); //C# List<int> genericObject = new List<int>(10); genericObject := TCoreGenericObject.Create('System.Collections.Generic.List`1', ['System.Int32'], arguments); try DisplayGenericInfo(genericObject); finally genericObject.Free; end; end; class procedure TGenericObjectDemo.CreateGenericListOfString; var genericObject: TCoreGenericObject; argument: ICoreClrArray; begin argument := nil; //C# List<string> genericObject = new List<string>(); genericObject := TCoreGenericObject.Create('System.Collections.Generic.List`1', ['System.String'], argument); try DisplayGenericInfo(genericObject); finally genericObject.Free; end; end; class procedure TGenericObjectDemo.DisplayGenericInfo( GenericObj: TCoreClrObject); begin TConsole.WriteLine(GenericObj.GetType.FullName); TConsole.WriteLine(GenericObj.IsGeneric); TConsole.WriteLine(GenericObj.GetPropertyValue('Capacity')); end; class procedure TGenericObjectDemo.CreateGenericListObjectOfInteger; var genericObject: TList<Integer>; begin //C# List<int> genericObject = new List<int>(10); genericObject := TList<Integer>.Create(10); try DisplayGenericInfo(genericObject); finally genericObject.Free; end; end; end.
29.980263
131
0.736669
4708401d9b79147588d97821bb247601aaa2338d
18,643
pas
Pascal
AH-Website/Backend/src/ranking.pas
Cooler2/ApusEngineExamples
9ab7e75635e4a790aff58d364168ac511b76d735
[ "BSD-3-Clause" ]
33
2020-03-06T09:14:48.000Z
2022-03-08T14:54:46.000Z
AH-Website/Backend/src/ranking.pas
Cooler2/ApusEngineExamples
9ab7e75635e4a790aff58d364168ac511b76d735
[ "BSD-3-Clause" ]
null
null
null
AH-Website/Backend/src/ranking.pas
Cooler2/ApusEngineExamples
9ab7e75635e4a790aff58d364168ac511b76d735
[ "BSD-3-Clause" ]
10
2020-03-06T16:51:00.000Z
2022-03-08T19:16:04.000Z
unit ranking; interface uses MyServis; type // Compatibility StringArr=AStringArr; // Кэшированная информация об игроке TPlayerRec=record id:integer; name,guild:string[31]; avatar,gold,crystals:integer; email,realname,location:AnsiString; customFame,customLevel,customWins,customLoses,customPlace:integer; classicFame,classicLevel,classicWins,classicLoses,classicPlace:integer; draftFame,draftLevel,draftWins,draftLoses,draftPlace:integer; totalFame,totalLevel,place:integer; campaignWins,ownedCards,astralPower:integer; end; TPlayerArr=array of TPlayerRec; // Информация о гильдиях TGuildRec=record name:string[31]; size,level,mCount:shortint; exp,treasures,leader,place:integer; members:array[1..12] of integer; end; TGuildArr=array of TGuildRec; // Game types TDuelType=( dtNone = 0, // also used for "Total" level/fame/rank etc... dtCustom = 1, dtClassic = 2, dtDraft = 3, dtCampaign = 4); var allPlayers:array of TPlayerRec; allGuilds:array of TGuildRec; // allPlayersHash:THash; // (lowercase) playername -> playerID // Индексы в массиве allPlayers (хранятся только игроки с ненулевой славой) customRanking,classicRanking,draftRanking,totalRanking:IntArray; // Индексы в массиве allGuilds [место]->guildID guildRanking:IntArray; rankingTime:TDateTime; function FormatRankingTable(dt:TDuelType;players:TPlayerArr;hlName:AnsiString):AnsiString; function FormatGuildsRankingTable(guilds:TGuildArr;hlName:AnsiString):AnsiString; // pages - ссылки на страницы рейтинга function GetRanking(dt:TDuelType;start,count:integer;out pages:AnsiString):TPlayerArr; function GetGuildRanking(start,count:integer;out pages:AnsiString):TGuildArr; function FindPlayer(name:AnsiString):integer; function FindGuild(name:AnsiString):integer; function GetPlayerInfo(id:integer):TPlayerRec; procedure LoadAllPlayersAndGuilds(loadGuilds:boolean=false); implementation uses SysUtils,SCGI,UCalculating,Logging,NetCommon,structs; var cSect:TMyCriticalSection; // ranking protection type TRankingFunc=function(playerID:integer):int64; function GuildRate(guildID:integer):int64; begin with allGuilds[guildID] do result:=int64(level)*1000000000+exp*20+mCount; end; procedure BuildGuildRanking; var i,count:integer; procedure QuickSort(a,b:integer;func:TRankingFunc); var lo,hi,v,mid:integer; o:integer; midVal:int64; begin lo:=a; hi:=b; mid:=(a+b) div 2; midVal:=func(guildranking[mid]); repeat while midVal<func(guildranking[lo]) do inc(lo); while midVal>func(guildranking[hi]) do dec(hi); if lo<=hi then begin Swap(guildranking[lo],guildranking[hi]); inc(lo); dec(hi); end; until lo>hi; if hi>a then QuickSort(a,hi,func); if lo<b then QuickSort(lo,b,func); end; begin try SetLength(guildRanking,length(allGuilds)); count:=0; for i:=1 to high(allGuilds) do if (allGuilds[i].name<>'') and (allGuilds[i].leader>0) then begin inc(count); guildRanking[count]:=i; end; SetLength(guildRanking,count+1); if count>1 then QuickSort(1,count,GuildRate); for i:=1 to high(allGuilds) do allGuilds[i].place:=0; for i:=1 to high(guildRanking) do allGuilds[guildRanking[i]].place:=i; except on e:exception do LogMsg('Error in BuildGuildRanking',logWarn); end; end; function CustomRate(playerID:integer):int64; begin with allPlayers[playerID] do result:=//int64(customLevel) shl 56+ int64(customFame) shl 40+ int64(round(1000*(customWins+10)/(customLoses+10))) shl 20+ playerID and $FFFFF; end; function ClassicRate(playerID:integer):int64; begin with allPlayers[playerID] do result:=//int64(classicLevel) shl 56+ int64(classicFame) shl 40+ int64(round(10000*(classicWins+10)/(classicLoses+10))) shl 20+ playerID and $FFFFF; end; function DraftRate(playerID:integer):int64; begin with allPlayers[playerID] do result:=//int64(draftLevel) shl 56+ int64(draftFame) shl 40+ int64(round(10000*(draftWins+10)/(draftLoses+10))) shl 20+ playerID and $FFFFF; end; function TotalRate(playerID:integer):int64; begin with allPlayers[playerID] do result:=//int64(totalLevel) shl 56+ int64(totalFame) shl 40+ int64(round(1000*(classicWins+customWins+DraftWins+10)/(classicLoses+customLoses+draftLoses+10))) shl 20+ playerID and $FFFFF; end; procedure BuildRanking(mode:TDuelType); var i,n,count:integer; ranking:IntArray; fl:boolean; procedure QuickSort(a,b:integer;func:TRankingFunc); var lo,hi,v,mid:integer; o:integer; midVal:int64; begin lo:=a; hi:=b; mid:=(a+b) div 2; midVal:=func(ranking[mid]); repeat while midVal<func(ranking[lo]) do inc(lo); while midVal>func(ranking[hi]) do dec(hi); if lo<=hi then begin Swap(ranking[lo],ranking[hi]); inc(lo); dec(hi); end; until lo>hi; if hi>a then QuickSort(a,hi,func); if lo<b then QuickSort(lo,b,func); end; begin try count:=0; for i:=1 to high(allPlayers) do case mode of dtNone:if allPlayers[i].totalFame>0 then inc(count); dtCustom:if allPlayers[i].customFame>0 then inc(count); dtClassic:if allPlayers[i].classicFame>0 then inc(count); dtDraft:if allPlayers[i].draftFame>0 then inc(count); end; SetLength(ranking,count+1); n:=0; for i:=1 to high(allPlayers) do begin fl:=false; case mode of dtNone:if allPlayers[i].totalFame>0 then fl:=true; dtCustom:if allPlayers[i].customFame>0 then fl:=true; dtClassic:if allPlayers[i].classicFame>0 then fl:=true; dtDraft:if allPlayers[i].draftFame>0 then fl:=true; end; if fl then begin inc(n); ranking[n]:=i; end; end; case mode of dtCustom:begin QuickSort(1,count,CustomRate); customRanking:=ranking; for i:=1 to high(allPlayers) do allPlayers[i].customPlace:=0; for i:=1 to high(ranking) do allPlayers[ranking[i]].customPlace:=i; end; dtClassic:begin QuickSort(1,count,ClassicRate); classicRanking:=ranking; for i:=1 to high(allPlayers) do allPlayers[i].classicPlace:=0; for i:=1 to high(ranking) do allPlayers[ranking[i]].classicPlace:=i; end; dtDraft:begin QuickSort(1,count,DraftRate); draftRanking:=ranking; for i:=1 to high(allPlayers) do allPlayers[i].draftPlace:=0; for i:=1 to high(ranking) do allPlayers[ranking[i]].draftPlace:=i; end; dtNone:begin QuickSort(1,count,TotalRate); totalRanking:=ranking; for i:=1 to high(allPlayers) do allPlayers[i].place:=0; for i:=1 to high(ranking) do allPlayers[ranking[i]].place:=i; end; end; except on e:exception do LogMsg('Error in BuildRanking, mode '+inttostr(integer(mode)),logWarn); end; end; procedure LoadAllPlayersAndGuilds(loadGuilds:boolean=false); var sa,sb,sc:StringArr; i,id,cs,count,gCount,mCount,gId,plrId:integer; begin if Now<rankingTime+15/86400 then exit; // 15 seconds LogMsg('Ranking obsolete: '+FormatDateTime('hh:nn:ss.zzz',Now)+' > '+FormatDateTime('hh:nn:ss.zzz',rankingTime+10/86400),logDebug); try // Загрузка информации обо всех игроках LogMsg('Updating players info',logInfo); sa:=db.Query('SELECT max(id) FROM players'); count:=StrToIntDef(sa[0],0)+1; if db.rowCount>0 then begin // не было ошибки? sa:=db.Query('SELECT id,name,guild,email,customFame,customLevel,classicFame,classicLevel,draftFame,draftLevel,level,'+ 'customWins,customLoses,classicWins,classicLoses,draftWins,draftLoses,'+ 'realname,location,campaignWins,cards,astralPower,avatar,gold,gems FROM players WHERE modified>"'+ FormatDateTime('yyyy-mm-dd hh:nn:ss',rankingTime-3/86400)+'"'); cSect.Enter; try SetLength(allPlayers,count); if db.rowCount>0 then begin for i:=0 to db.rowCount-1 do begin cs:=db.colCount; id:=StrToInt(sa[i*cs]); if (id>0) and (id<length(allPlayers)) then begin allPlayers[id].id:=id; allPlayers[id].name:=sa[i*cs+1]; allPlayers[id].guild:=sa[i*cs+2]; allPlayers[id].email:=sa[i*cs+3]; allPlayers[id].customFame:=StrToInt(sa[i*cs+4]); allPlayers[id].customLevel:=StrToInt(sa[i*cs+5]); allPlayers[id].classicFame:=StrToInt(sa[i*cs+6]); allPlayers[id].classicLevel:=StrToInt(sa[i*cs+7]); allPlayers[id].draftFame:=StrToInt(sa[i*cs+8]); allPlayers[id].draftLevel:=StrToInt(sa[i*cs+9]); allPlayers[id].totalFame:=CalcPlayerFame(allPlayers[id].customFame,allPlayers[id].classicFame,allPlayers[id].draftFame); allPlayers[id].totalLevel:=StrToInt(sa[i*cs+10]); allPlayers[id].customWins:=StrToInt(sa[i*cs+11]); allPlayers[id].customloses:=StrToInt(sa[i*cs+12]); allPlayers[id].classicWins:=StrToInt(sa[i*cs+13]); allPlayers[id].classicLoses:=StrToInt(sa[i*cs+14]); allPlayers[id].draftWins:=StrToInt(sa[i*cs+15]); allPlayers[id].draftLoses:=StrToInt(sa[i*cs+16]); allPlayers[id].realname:=sa[i*cs+17]; allPlayers[id].location:=sa[i*cs+18]; allPlayers[id].campaignWins:=StrToInt(sa[i*cs+19]); allPlayers[id].ownedCards:=CardsCount(sa[i*cs+20]); allPlayers[id].astralPower:=StrToInt(sa[i*cs+21]); allPlayers[id].avatar:=StrToInt(sa[i*cs+22]); allPlayers[id].gold:=StrToInt(sa[i*cs+23]); allPlayers[id].crystals:=StrToInt(sa[i*cs+24]); end; end; LogMsg('Players loaded: '+inttostr(db.rowCount),logInfo); BuildRanking(dtCustom); BuildRanking(dtClassic); BuildRanking(dtDraft); BuildRanking(dtNone); LogMsg('Rankings built',logDebug); end; // Data loaded finally cSect.Leave; end; end; if loadGuilds then begin sb:=db.Query('SELECT id,name,size,exp,level,treasures FROM guilds WHERE flags=0'); gCount:=db.rowCount; sc:=db.Query('SELECT guild,playerid,rank FROM guildmembers WHERE guild>0'); mCount:=db.rowCount; cSect.Enter; try LogMsg('Loading guilds',logInfo); SetLength(allGuilds,0); for i:=0 to gCount-1 do begin id:=StrToInt(sb[i*6]); if id>high(allGuilds) then SetLength(allGuilds,id+500); allGuilds[id].name:=sb[i*6+1]; allGuilds[id].size:=StrToInt(sb[i*6+2]); allGuilds[id].exp:=StrToInt(sb[i*6+3]); allGuilds[id].level:=StrToInt(sb[i*6+4]); allGuilds[id].treasures:=StrToInt(sb[i*6+5]); allGuilds[id].leader:=0; allGuilds[id].mCount:=0; fillchar(allGuilds[id].members,sizeof(allGuilds[id].members),0); end; for i:=0 to mCount-1 do begin gId:=StrToInt(sc[i*3]); if (gId>0) and (gId<=high(allGuilds)) then begin plrId:=StrToInt(sc[i*3+1]); inc(allGuilds[gId].mCount); if allGuilds[gId].mCount<=12 then allGuilds[gId].members[allGuilds[gId].mCount]:=plrId else LogMsg('Too many guild members! guildID='+inttostr(gId)+' plrID='+inttostr(plrID),logInfo); if sc[i*3+2]='3' then allGuilds[gId].leader:=plrId; end; end; LogMsg('Guilds loaded: '+inttostr(db.rowCount),logInfo); BuildGuildRanking; LogMsg('Ranking built',logDebug); finally cSect.Leave; end; end; except on e:exception do LogMsg('Error: LoadAllPlayers - '+ExceptionMsg(e),logError); end; rankingTime:=now; end; function FormatGuildsRankingTable(guilds:TGuildArr;hlName:AnsiString):AnsiString; var i,id:integer; place,level,exp,loses:integer; name,leader,bold:AnsiString; begin result:=''; for i:=0 to high(guilds) do begin place:=guilds[i].place; level:=guilds[i].level; exp:=guilds[i].exp; leader:='unknown'; id:=guilds[i].leader; if (id>0) and (id<=high(allPlayers)) then leader:=HTMLString(allPlayers[id].name); if place=0 then bold:=' style="font-weight:bold"' else bold:=''; if hlName=guilds[i].name then bold:=' style="font-weight:bold; color:#407;"'; name:=HTMLString(guilds[i].name); result:=result+Format('<tr%s><td>%d.<td class=GuildInfo>%s<td>%d<td>%d<td>%s'#13#10, [bold,place,name,level,exp,leader]); end; end; function FormatRankingTable(dt:TDuelType;players:TPlayerArr;hlName:AnsiString):AnsiString; var i:integer; place,level,fame,wins,loses:integer; name,bold:AnsiString; begin result:=''; for i:=0 to high(players) do begin case dt of dtNone:begin place:=players[i].place; fame:=players[i].totalFame; level:=CalcLevel(fame); wins:=players[i].customWins+players[i].classicWins+players[i].draftWins; loses:=players[i].customLoses+players[i].classicLoses+players[i].draftLoses; end; dtCustom:begin place:=players[i].customPlace; fame:=players[i].customFame; level:=CalcLevel(fame); wins:=players[i].customWins; loses:=players[i].customLoses; end; dtClassic:begin place:=players[i].classicPlace; fame:=players[i].classicFame; level:=CalcLevel(fame); wins:=players[i].classicWins; loses:=players[i].classicLoses; end; dtDraft:begin place:=players[i].draftPlace; fame:=players[i].draftFame; level:=CalcLevel(fame); wins:=players[i].draftWins; loses:=players[i].draftLoses; end; end; if (place=1) then bold:=' style="font-weight:bold"' else bold:=''; if hlName=players[i].name then bold:=' style="font-weight:bold; color:#407;"'; name:=HTMLString(players[i].name); result:=result+Format('<tr%s><td>%d.<td class=PlayerInfo>%s<td>%d<td>%d<td>%d / %d'#13#10, [bold,place,name,level,fame,wins,loses]); end; end; function GetRanking(dt:TDuelType;start,count:integer;out pages:AnsiString):TPlayerArr; var i,c,place,pCount,page,duels:integer; ranking:^IntArray; st:AnsiString; begin LoadAllPlayersAndGuilds(true); cSect.Enter; try case dt of dtNone:ranking:=@totalRanking; dtCustom:ranking:=@customRanking; dtClassic:ranking:=@ClassicRanking; dtDraft:ranking:=@DraftRanking; end; SetLength(result,count); // посчитаем сколько страниц вообще в рейтинге есть pCount:=1; while pCount*100<=high(ranking^) do begin with allPlayers[ranking^[pCount*100]] do case dt of dtCustom:duels:=customWins+customLoses; dtClassic:duels:=classicWins+classicLoses; dtDraft:duels:=draftWins+draftLoses; dtNone:duels:=customWins+customLoses+classicWins+classicLoses+draftWins+draftLoses; end; if duels<=0 then break; inc(pCount); end; place:=start; c:=0; while (c<count) and (place<high(ranking^)) do begin result[c]:=allPlayers[ranking^[place]]; inc(c); inc(place); end; SetLength(result,c); finally cSect.Leave; end; pages:=''; page:=1+start div 100; for i:=1 to pCount do begin if pCount>8 then begin // страниц больше 8 - тогда 2 варианта: if (page<=6) and (i>8) then break; // текущая страница - до 4-й, значит рисуем до 6-й включительно if (page>6) and (i>1) and (abs(i-page)>3) then begin // показывать 1-ю страницу а также +/- 3 от текущей continue; end; end; st:=''; if i=page then st:=' RankingPageCurrent'; pages:=pages+'<span id=RankingPage'+inttostr(ord(dt))+'_'+inttostr(i)+' class="RankingPageIndex'+st+'">'+inttostr(i)+'</span>'; end; end; function GetGuildRanking(start,count:integer;out pages:AnsiString):TGuildArr; var i,c,place,pCount,page,duels:integer; ranking:^IntArray; st:AnsiString; begin LoadAllPlayersAndGuilds(true); cSect.Enter; try SetLength(result,count); // посчитаем сколько страниц вообще в рейтинге есть pCount:=(length(guildRanking)-2) div 100; place:=start; c:=0; while (c<count) and (place<high(guildRanking)) do begin result[c]:=allGuilds[guildRanking[place]]; inc(c); inc(place); end; SetLength(result,c); finally cSect.Leave; end; pages:=''; page:=1+start div 100; for i:=1 to pCount do begin if pCount>8 then begin // страниц больше 8 - тогда 2 варианта: if (page<=6) and (i>8) then break; // текущая страница - до 4-й, значит рисуем до 6-й включительно if (page>6) and (i>1) and (abs(i-page)>2) then begin // показывать 1-ю страницу а также +/- 2 от текущей if i=1 then pages:=pages+' .. '; continue; end; end; st:=''; if i=page then st:=' RankingPageCurrent'; pages:=pages+'<span id=RankingPage4_'+inttostr(i)+' class="RankingPageIndex'+st+'">'+inttostr(i)+'</span>'; end; end; function FindPlayer(name:AnsiString):integer; var i:integer; begin result:=0; name:=lowercase(name); LoadAllPlayersAndGuilds; cSect.Enter; try for i:=1 to high(allPlayers) do if lowercase(allPlayers[i].name)=name then begin result:=i; break; end; LogMsg('Player '+name+' not found in AllPlayers'); finally cSect.Leave; end; end; function FindGuild(name:AnsiString):integer; var i:integer; begin result:=0; name:=lowercase(name); LoadAllPlayersAndGuilds(true); cSect.Enter; try for i:=1 to high(allGuilds) do if lowercase(allGuilds[i].name)=name then begin result:=i; break; end; LogMsg('Guild '+name+' not found in AllGuilds'); finally cSect.Leave; end; end; function GetPlayerInfo(id:integer):TPlayerRec; begin LoadAllPlayersAndGuilds; cSect.Enter; try fillchar(result,sizeof(result),0); if (id>0) and (id<=high(allPlayers)) then result:=allPlayers[id]; finally cSect.Leave; end; end; initialization InitCritSect(cSect,'ranking'); end.
32.198618
135
0.639597
85e12b82172950c14e122baeb2f8fdab81bea8f4
2,069
pas
Pascal
src/Router/Contracts/RouteArgsReaderIntf.pas
zamronypj/fano-framework
559e385be5e1d26beada94c46eb8e760c4d855da
[ "MIT" ]
78
2019-01-31T13:40:48.000Z
2022-03-22T17:26:54.000Z
src/Router/Contracts/RouteArgsReaderIntf.pas
zamronypj/fano-framework
559e385be5e1d26beada94c46eb8e760c4d855da
[ "MIT" ]
24
2020-01-04T11:50:53.000Z
2022-02-17T09:55:23.000Z
src/Router/Contracts/RouteArgsReaderIntf.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 RouteArgsReaderIntf; interface {$MODE OBJFPC} {$H+} uses PlaceholderTypes; type (*!------------------------------------------------ * interface for any class having capability to * read route arguments * * @author Zamrony P. Juhara <zamronypj@yahoo.com> *-------------------------------------------------*) IRouteArgsReader = interface ['{4AA94806-EE58-43E1-AF8C-B2B6F99BCD1B}'] (*!------------------------------------------- * get route argument data *-------------------------------------------- * @return current array of placeholders *--------------------------------------------*) function getArgs() : TArrayOfPlaceholders; (*!------------------------------------------- * get single route argument data *-------------------------------------------- * @param key name of argument * @return placeholder *--------------------------------------------*) function getArg(const key : shortstring) : TPlaceholder; (*!------------------------------------------- * get single route argument value *-------------------------------------------- * @param key name of argument * @return argument value *--------------------------------------------*) function getValue(const key : shortstring) : string; property value[const key : shortstring] : string read getValue; default; (*!------------------------------------------- * get route name *-------------------------------------------- * @return current route name *--------------------------------------------*) function getName() : shortstring; end; implementation end.
31.830769
80
0.40406
f18fe78ed691aae227b4b3eed6eb2b352a9295d0
3,490
dfm
Pascal
Components/VirtualTreeViewV5.5.3/Demos/Advanced/MultilineDemo.dfm
98kmir2/98kmir2
46196a161d46cc7a85d168dca683b4aff477a709
[ "BSD-3-Clause" ]
15
2020-02-13T11:59:11.000Z
2021-12-31T14:53:44.000Z
Libraries/treeview/Demos/Advanced/MultilineDemo.dfm
novakjf2000/FHIRServer
a47873825e94cd6cdfa1a077f02e0960098bbefa
[ "BSD-3-Clause" ]
null
null
null
Libraries/treeview/Demos/Advanced/MultilineDemo.dfm
novakjf2000/FHIRServer
a47873825e94cd6cdfa1a077f02e0960098bbefa
[ "BSD-3-Clause" ]
13
2020-02-20T07:22:09.000Z
2021-12-31T14:56:09.000Z
object NodeForm: TNodeForm Left = 573 Top = 332 Width = 773 Height = 542 Caption = 'NodeForm' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False Scaled = False OnCreate = FormCreate DesignSize = ( 757 504) PixelsPerInch = 96 TextHeight = 16 object Label8: TLabel Left = 12 Top = 393 Width = 716 Height = 72 Anchors = [akLeft, akRight, akBottom] AutoSize = False Caption = 'Since Virtual Treeview uses Unicode for text display it is not e' + 'asy to provide multiline support on Windows 9x/Me systems. Under' + ' Windows NT (4.0, 2000, XP) there is support by the operation sy' + 'stem and so full word breaking is possible there. Otherwise you ' + 'have to insert line breaks manually to have multiline captions. ' + 'Of course there is no difference in handling between multiline a' + 'nd single line nodes (except for the vertical alignment of the l' + 'atter).' ShowAccelChar = False WordWrap = True end object Panel1: TPanel Left = 12 Top = 4 Width = 716 Height = 357 Anchors = [akLeft, akTop, akRight, akBottom] Color = clAppWorkSpace ParentBackground = False TabOrder = 0 DesignSize = ( 716 357) object MLTree: TVirtualStringTree Left = 96 Top = 8 Width = 533 Height = 337 Anchors = [akLeft, akTop, akRight, akBottom] BorderStyle = bsNone ClipboardFormats.Strings = ( 'CSV' 'HTML Format' 'Plain text' 'Rich Text Format' 'Rich Text Format Without Objects' 'Unicode text' 'Virtual Tree Data') Colors.SelectionRectangleBlendColor = 10539203 DefaultNodeHeight = 130 DragMode = dmAutomatic Header.AutoSizeIndex = 0 Header.Font.Charset = DEFAULT_CHARSET Header.Font.Color = clWindowText Header.Font.Height = -11 Header.Font.Name = 'MS Sans Serif' Header.Font.Style = [] Header.Options = [hoAutoResize, hoColumnResize, hoDrag] HintAnimation = hatNone HintMode = hmTooltip LineMode = lmBands NodeAlignment = naFromTop NodeDataSize = 4 ParentShowHint = False RootNodeCount = 30 SelectionCurveRadius = 10 ShowHint = True TabOrder = 0 TextMargin = 5 TreeOptions.AutoOptions = [toAutoDropExpand, toAutoScroll, toAutoScrollOnExpand, toAutoSpanColumns, toAutoTristateTracking, toAutoDeleteMovedNodes] TreeOptions.MiscOptions = [toEditable, toInitOnSave, toReportMode, toToggleOnDblClick, toWheelPanning] TreeOptions.PaintOptions = [toHideFocusRect, toShowDropmark, toShowTreeLines, toThemeAware, toUseBlendedImages] TreeOptions.SelectionOptions = [toMultiSelect] OnEditing = MLTreeEditing OnPaintText = MLTreePaintText OnInitNode = MLTreeInitNode OnMeasureItem = MLTreeMeasureItem OnStateChange = MLTreeStateChange Columns = < item Position = 1 Width = 466 end item Position = 0 end> end end object AutoAdjustCheckBox: TCheckBox Left = 12 Top = 368 Width = 329 Height = 17 Anchors = [akLeft, akBottom] Caption = 'Automatically adjust node height to node text.' TabOrder = 1 OnClick = AutoAdjustCheckBoxClick end end
29.576271
153
0.650716
6afb1942443d4c4905e9227d187498bbcd336734
2,498
pas
Pascal
src/Patterns/PureMVC.Patterns.Observer.pas
fuadhs88/puremvc-delphi-standard-framework
2981ab34767019b87bdb758bf6c14ce0e65760c9
[ "CC-BY-3.0" ]
32
2015-01-22T17:54:17.000Z
2021-03-23T11:35:16.000Z
src/Patterns/PureMVC.Patterns.Observer.pas
fuadhs88/puremvc-delphi-standard-framework
2981ab34767019b87bdb758bf6c14ce0e65760c9
[ "CC-BY-3.0" ]
1
2016-04-19T06:08:13.000Z
2018-05-21T23:07:41.000Z
src/Patterns/PureMVC.Patterns.Observer.pas
fuadhs88/puremvc-delphi-standard-framework
2981ab34767019b87bdb758bf6c14ce0e65760c9
[ "CC-BY-3.0" ]
15
2015-01-21T22:30:06.000Z
2021-11-12T18:09:30.000Z
{ PureMVC Delphi Port by Jorge L. Cangas <jorge.cangas@puremvc.org> PureMVC - Copyright(c) 2006-11 Futurescale, Inc., Some rights reserved. Your reuse is governed by the Creative Commons Attribution 3.0 License } unit PureMVC.Patterns.Observer; interface uses PureMVC.Patterns.Collections, PureMVC.Interfaces.IObserver, PureMVC.Interfaces.INotification; type TObserver = class(TInterfacedObject, IObserver) private FNotifyMethod: string; FNotifyContext: TObject; public constructor Create(Notify: string = ''; Context: TObject = nil); procedure NotifyObserver(Notification: INotification); function CompareNotifyContext(Other: TObject): Boolean; procedure SetNotifyMethod(const Value: string); property NotifyMethod: string write SetNotifyMethod; procedure SetNotifyContext(Value: TObject); property NotifyContext: TObject write SetNotifyContext; end; TObserverList = TObjectList<TObserver>; implementation uses RTTI; type TObserverHelper = class helper for TObject protected procedure InvokeByRTTI(MethodName: string; Args: array of TValue); public procedure HandlePureMVCNotification(MethodName: string; Notification: INotification); end; procedure TObserverHelper.InvokeByRTTI(MethodName: string; Args: array of TValue); var RC: TRttiContext; RType: TRttiInstanceType; RMethod: TRttiMethod; begin RC := TRttiContext.Create; try RType := RC.GetType(Self.ClassType) as TRttiInstanceType; RMethod := RType.GetMethod(MethodName); if Assigned(RMethod) then RMethod.Invoke(Self, Args); finally RC.Free; end; end; procedure TObserverHelper.HandlePureMVCNotification(MethodName: string; Notification: INotification); begin InvokeByRTTI(MethodName, [TValue.From(Notification)]); end; function TObserver.CompareNotifyContext(Other: TObject): Boolean; begin Result := FNotifyContext = Other; end; constructor TObserver.Create(Notify: string; Context: TObject); begin FNotifyMethod := Notify; FNotifyContext := Context; end; procedure TObserver.NotifyObserver(Notification: INotification); begin FNotifyContext.HandlePureMVCNotification(FNotifyMethod, Notification); end; procedure TObserver.SetNotifyContext(Value: TObject); begin FNotifyContext := Value; end; procedure TObserver.SetNotifyMethod(const Value: string); begin FNotifyMethod := Value; end; end.
25.489796
102
0.738991
f1ff21968b741818213302b87d2f21d1a231ea60
2,328
pas
Pascal
Common/uIdentity.Connector.Internal.pas
Sembium/Sembium3
0179c38c6a217f71016f18f8a419edd147294b73
[ "Apache-2.0" ]
null
null
null
Common/uIdentity.Connector.Internal.pas
Sembium/Sembium3
0179c38c6a217f71016f18f8a419edd147294b73
[ "Apache-2.0" ]
null
null
null
Common/uIdentity.Connector.Internal.pas
Sembium/Sembium3
0179c38c6a217f71016f18f8a419edd147294b73
[ "Apache-2.0" ]
3
2021-06-30T10:11:17.000Z
2021-07-01T09:13:29.000Z
unit uIdentity.Connector.Internal; interface type InternalIdentityConnector = class abstract public class function FindUserIdentifier(const ASearchText: string): string; class function GetUserData(const AUserId: string): string; end; implementation uses System.SysUtils, REST.Client, REST.Types, uClientConnectionInfo, uCommonApp, uHttpClientProxyUtils; { InternalIdentityConnector } class function InternalIdentityConnector.FindUserIdentifier(const ASearchText: string): string; var LRequest: TRESTRequest; LClient: TRESTClient; begin LClient := TRESTClient.Create(SIdentityConnectorURL + '/search'); try BypassRESTClientProxy(LClient); LRequest := TRESTRequest.Create(LClient); LRequest.SynchronizedEvents := False; LRequest.AddParameter('searchText', ASearchText); LRequest.AddAuthParameter('Authorization', 'Bearer ' + ClientConnectionInfo.AuthenticationTokenValue, TRESTRequestParameterKind.pkHTTPHEADER,[TRESTRequestParameterOption.poDoNotEncode]); LRequest.Execute; if (LRequest.Response.StatusCode >= 300) then raise Exception.Create('Error: ' + LRequest.Response.StatusCode.ToString + ' ' + LRequest.Response.StatusText + 'Content: ' + LRequest.Response.Content); Result:= LRequest.Response.Content; finally FreeAndNil(LClient); end; end; class function InternalIdentityConnector.GetUserData( const AUserId: string): string; var LRequest: TRESTRequest; LClient: TRESTClient; begin LClient := TRESTClient.Create(SIdentityConnectorURL + '/getuserdata'); try BypassRESTClientProxy(LClient); LRequest := TRESTRequest.Create(LClient); LRequest.SynchronizedEvents := False; LRequest.AddParameter('userId', AUserId); LRequest.AddAuthParameter('Authorization', 'Bearer ' + ClientConnectionInfo.AuthenticationTokenValue, TRESTRequestParameterKind.pkHTTPHEADER,[TRESTRequestParameterOption.poDoNotEncode]); LRequest.Execute; if (LRequest.Response.StatusCode >= 300) then raise Exception.Create('Error: ' + LRequest.Response.StatusCode.ToString + ' ' + LRequest.Response.StatusText + 'Content: ' + LRequest.Response.Content); Result:= LRequest.Response.Content; finally FreeAndNil(LClient); end; end; end.
31.04
191
0.74055
83053e050c4a80c12ce99b0aa5409b52a073f8b1
8,804
pas
Pascal
library/r4/FHIR.R4.Tags.pas
17-years-old/fhirserver
9575a7358868619311a5d1169edde3ffe261e558
[ "BSD-3-Clause" ]
null
null
null
library/r4/FHIR.R4.Tags.pas
17-years-old/fhirserver
9575a7358868619311a5d1169edde3ffe261e558
[ "BSD-3-Clause" ]
null
null
null
library/r4/FHIR.R4.Tags.pas
17-years-old/fhirserver
9575a7358868619311a5d1169edde3ffe261e558
[ "BSD-3-Clause" ]
null
null
null
unit FHIR.R4.Tags; { 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. } interface uses SysUtils, Classes, FHIR.Support.Base, FHIR.Support.Json, FHIR.Support.Stream, FHIR.Base.Objects, FHIR.R4.Types; const TAG_FHIR_SYSTEM = 'http://healthintersections.com.au/fhir/tags'; TAG_TEST_SYSTEM = TAG_FHIR_SYSTEM; TAG_TEST_CODE = 'for-testing'; // TAG_FHIR_SYSTEM_PROFILES = 'http://healthintersections.com.au/fhir/profiles'; // code will be a uri // TAG_READONLY = 'read-only'; // TAG_SUMMARY = 'summary'; TAG_COMPARTMENT_IN = 'patient-compartment'; TAG_COMPARTMENT_OUT = 'patient-compartment-not'; // TAG_USER_COMPARTMENT = 'patient-compartment-user'; type TFHIRTagCategory = (tcTag, tcSecurity, tcProfile); TFHIRTag = class (TFHIRCoding) private FKey : integer; FCategory : TFHIRTagCategory; FTransactionId: String; FConfirmedStored: boolean; public function Link : TFHIRTag; property Key : integer read Fkey write FKey; property Category : TFHIRTagCategory read FCategory write FCategory; // operational stuff to do with transaction scope management property TransactionId : String read FTransactionId write FTransactionId; property ConfirmedStored : boolean read FConfirmedStored write FConfirmedStored; function describe : String; override; end; TFHIRTagList = class (TFslObject) private FList : TFslList<TFHIRTag>; function GetCount: Integer; function GetTag(index: integer): TFHIRTag; public constructor Create; Override; destructor Destroy; Override; function Link : TFHIRTagList; procedure readTags(meta : TFhirMeta); procedure writeTags(meta : TFhirMeta); procedure deleteTags(meta : TFhirMeta); procedure removeTags(meta : TFhirMeta); Property Count : Integer read GetCount; Property Tag[index : integer] : TFHIRTag read GetTag; default; function json : TArray<byte>; function findTag(category : TFHIRTagCategory; system, code : String) : TFHIRTag; procedure removeTag(category : TFHIRTagCategory; system, code : String); function hasTag(category : TFHIRTagCategory; system, code : String) : boolean; function addTag(key : integer; kind : TFHIRTagCategory; system, code, display : String) : TFHIRTag; procedure add(tag : TFHIRTag); function hasTestingTag : boolean; procedure forceTestingTag; function asHeader : String; function describe : String; end; implementation uses FHIR.R4.Utilities; { TFHIRTag } function TFHIRTag.describe: String; begin result := inttostr(ord(FCategory))+':'+system+'::'+code; end; function TFHIRTag.Link: TFHIRTag; begin result := TFHIRTag(inherited Link); end; { TFHIRTagList } Constructor TFHIRTagList.Create; begin inherited; FList := TFslList<TFHIRTag>.create; end; procedure TFHIRTagList.deleteTags(meta: TFhirMeta); var t : TFHIRTag; begin for t in FList do case t.Category of tcTag: meta.tagList.RemoveCoding(t.system, t.code); tcSecurity: meta.securityList.RemoveCoding(t.system, t.code); tcProfile: meta.profileList.removeUri(t.code); end; end; function TFHIRTagList.describe: String; var item : TFHIRTag; begin result := ''; for item in FList do result := result +', '+item.describe; end; Destructor TFHIRTagList.Destroy; begin FList.Free; inherited; end; function TFHIRTagList.Link: TFHIRTagList; begin result := TFHIRTagList(inherited Link); end; procedure TFHIRTagList.add(tag: TFHIRTag); begin FList.Add(tag); end; function TFHIRTagList.addTag(key: integer; kind: TFHIRTagCategory; system, code, display: String) : TFHIRTag; var tag : TFHIRTag; begin tag := TFHIRTag.create; try tag.Key := Key; tag.Category := kind; tag.system := system; tag.code := code; tag.display := display; FList.Add(tag.Link); result := tag; finally tag.free; end; end; function TFHIRTagList.asHeader: String; begin end; function TFHIRTagList.GetCount: Integer; begin result := FList.Count; end; function TFHIRTagList.findTag(category : TFHIRTagCategory; system, code: String): TFHIRTag; var t : TFHIRTag; begin result := nil; for t in FList do if (t.Category = category) and (t.system = system) and (t.code = code) then begin result := t; exit; end; end; procedure TFHIRTagList.forceTestingTag; begin if not hasTestingTag then addTag(0, tcTag, TAG_TEST_SYSTEM, TAG_TEST_CODE, 'For Testing Only'); end; function TFHIRTagList.GetTag(index: integer): TFHIRTag; begin result := FList[index]; end; function TFHIRTagList.hasTag(category : TFHIRTagCategory; system, code: String): boolean; begin result := findTag(category, system, code) <> nil; end; function TFHIRTagList.hasTestingTag: boolean; begin result := hasTag(tcTag, TAG_TEST_SYSTEM, TAG_TEST_CODE); end; function TFHIRTagList.json: TArray<byte>; var json : TJSONWriter; s : TBytesStream; vs : TFslVCLStream; t : TFHIRTag; begin s := TBytesStream.Create; try vs := TFslVCLStream.Create; try vs.Stream := s; json := TJsonWriterDirect.create; try json.Stream := vs.link; json.Start(true); json.HasWhitespace := false; json.ValueArray('tags'); for t in FList do begin json.ValueObject(); json.Value('key', t.Key); json.Value('category', ord(t.Category)); json.Value('system', t.system); json.Value('code', t.code); json.Value('display', t.display); json.FinishObject; end; json.FinishArray; json.Finish(true); finally json.free; end; finally vs.Free; end; result := s.Bytes; finally s.free; end; end; procedure TFHIRTagList.readTags(meta: TFhirMeta); var c : TFHIRCoding; u : TFhirUri; begin for c in meta.tagList do if not hasTag(tcTag, c.system, c.code) then addTag(0, tcTag, c.system, c.code, c.display); for c in meta.securityList do if not hasTag(tcSecurity, c.system, c.code) then addTag(0, tcSecurity, c.system, c.code, c.display); for u in meta.profileList do if not hasTag(tcProfile, 'urn:ietf:rfc:3986', u.value) then addTag(0, tcProfile, 'urn:ietf:rfc:3986', u.value, ''); end; procedure TFHIRTagList.removeTag(category: TFHIRTagCategory; system, code: String); var i : integer; begin for i := FList.count - 1 downto 0 do if (flist[i].Category = category) and (flist[i].system = system) and (flist[i].code = code) then flist.Delete(i); end; procedure TFHIRTagList.removeTags(meta: TFhirMeta); var c : TFHIRCoding; u : TFhirUri; begin for c in meta.tagList do removeTag(tcTag, c.system, c.code); for c in meta.securityList do removeTag(tcSecurity, c.system, c.code); for u in meta.profileList do removeTag(tcProfile, 'urn:ietf:rfc:3986', u.value); end; procedure TFHIRTagList.writeTags(meta: TFhirMeta); var t : TFHIRTag; begin meta.tagList.Clear; meta.securityList.Clear; meta.profileList.Clear; for t in FList do case t.Category of tcTag: meta.tagList.addCoding(t.system, t.code, t.display); tcSecurity: meta.securityList.addCoding(t.system, t.code, t.display); tcProfile: meta.profileList.Append.value := t.code; end; end; end.
27.256966
109
0.71229
f1ff9eef81f50f1997f01f710cb1aafbd245d6eb
2,890
pas
Pascal
turtle/rekpic25.pas
nickelsworth/swag
7c21c0da2291fc249b9dc5cfe121a7672a4ffc08
[ "BSD-2-Clause" ]
11
2015-12-12T05:13:15.000Z
2020-10-14T13:32:08.000Z
turtle/rekpic25.pas
nickelsworth/swag
7c21c0da2291fc249b9dc5cfe121a7672a4ffc08
[ "BSD-2-Clause" ]
null
null
null
turtle/rekpic25.pas
nickelsworth/swag
7c21c0da2291fc249b9dc5cfe121a7672a4ffc08
[ "BSD-2-Clause" ]
8
2017-05-05T05:24:01.000Z
2021-07-03T20:30:09.000Z
(* ┌───────────────────────────────────────────────────────────┐ │ Programated by Vladimir Zahoransky │ │ Vladko software │ │ Contact : zahoran@cezap.ii.fmph.uniba.sk │ │ Program tema : McCarthy 91 (rekusion) with turtles │ └───────────────────────────────────────────────────────────┘ *) { Well, the rekusions are sometimes very difficult. My program have a lot of versions. Version 1 : Rekusive inside exp. rekpic12.pas, rekpic14, rekpic16... Version 2 : Rekusive inside with a lot rekusive commands exp. rekpic01.pas ... Version 3 : Rekusive inside with one rekusive command but it is command for a lot commands. (rekpic20.pas rekpic22.pas ... ) Version 4 : Rekusive outside flepic05.pas If you did study my programs then you know some rekusions which you do not undestand. Some are easy writed, but make very difficult. Some rekusions we can to update to cycles, but some NO. For example this. McCarthy 91. Rekusion is version rekusion of rekusion. If we want to study rekusion algorithm we can use stack, (all versions) but here is one big problem : All my rekusions (rekpic01..rekpic24) are working with graphic. This don't work. Stack for this rekusion is not good to use. Here stay a question. Can stack to work with all rekusion algorithm. (graphical) Oh,oh. No. This rekusion McCarthy_91 is one rekusion where stack ... . Stack we can use IF you can write this rekusion WITH cycles. This rekusion we can not to write with cycles. Well, this program simulate how can we use turtle graphic in rekusions this type. This rekusion is not here to study perfekt, because it is very diffycult to undestand. This program is a metod how can we simulate this with turtles. The metod is : If rekusion penetrate write line with one color and when emerge with other color. If it is primitive part then with color. All steps are x for ower lines. And the rekusion variable is y for lines. Init is a point where the rekusion start. Then increment poc. (account variable) If we will make it then you see course of rekusion. } Uses Okor; Type Mykor=Object(kor) Function McCarthy_91(x:integer):integer; End; Var poc:byte; Function Mykor.McCarthy_91(x:integer):integer; Begin write(x:4); inc(poc); if x > 100 then McCarthy_91:=x-10 else begin Zmenfp(5); ZmenXY(poc,x); McCarthy_91:=McCarthy_91(McCarthy_91(x+11)); Zmenfp(9); ZmenXY(poc,x); end; End; Var k:Mykor; Number:integer; Begin Randomize; Number:=Random(91); Poc:=0; With k do Begin Init(0,0,0); McCarthy_91(Number); CakajKlaves; Koniec; End; End. 
37.051282
74
0.629066
f166c3cf4433e4171bf2e9358c7165e036766b98
1,162
pas
Pascal
src/UClipboardHistoryDisabler.pas
superswanman/Clipboard-History-Disabler
ef7357731d2c1e64695db136e789858b7471f1fd
[ "MIT" ]
null
null
null
src/UClipboardHistoryDisabler.pas
superswanman/Clipboard-History-Disabler
ef7357731d2c1e64695db136e789858b7471f1fd
[ "MIT" ]
null
null
null
src/UClipboardHistoryDisabler.pas
superswanman/Clipboard-History-Disabler
ef7357731d2c1e64695db136e789858b7471f1fd
[ "MIT" ]
1
2020-09-08T14:45:31.000Z
2020-09-08T14:45:31.000Z
unit UClipboardHistoryDisabler; interface uses Winapi.Windows, System.Rtti; procedure Register; implementation var FTargetAddr: PByte; FOriginalData: Byte; procedure Register; var ctx: TRttiContext; typ: TRttiType; oldProtect: DWORD; begin typ := ctx.FindType('ClipboardHistoryDlg.TClipboardHistoryForm'); if typ = nil then Exit; FTargetAddr := GetProcAddress(GetModuleHandle(PChar(typ.Package.Name)), '@Clipboardhistorydlg@TClipboardHistoryForm@WMClipboardUpdate$qqrr24Winapi@Messages@TMessage'); if not Assigned(FTargetAddr) then Exit; VirtualProtect(FTargetAddr, 1, PAGE_READWRITE, oldProtect); FOriginalData := FTargetAddr^; FTargetAddr^ := $C3; // RET VirtualProtect(FTargetAddr, 1, oldProtect, nil); FlushInstructionCache(GetCurrentProcess, FTargetAddr, 1); end; procedure Unregister; var oldProtect: DWORD; begin if not Assigned(FTargetAddr) then Exit; VirtualProtect(FTargetAddr, 1, PAGE_READWRITE, oldProtect); FTargetAddr^ := FOriginalData; VirtualProtect(FTargetAddr, 1, oldProtect, nil); FlushInstructionCache(GetCurrentProcess, FTargetAddr, 1); end; initialization finalization Unregister; end.
23.714286
169
0.77969
83f42c0c71f0898d86f156049143382fbbcfa004
24,012
pas
Pascal
Version8/Source/DDLL/DLoads.pas
dss-extensions/electricdss-src
fab07b5584090556b003ef037feb25ec2de3b7c9
[ "BSD-3-Clause" ]
1
2022-01-23T14:43:30.000Z
2022-01-23T14:43:30.000Z
Version8/Source/DDLL/DLoads.pas
PMeira/electricdss-src
fab07b5584090556b003ef037feb25ec2de3b7c9
[ "BSD-3-Clause" ]
7
2018-08-15T04:00:26.000Z
2018-10-25T10:15:59.000Z
Version8/Source/DDLL/DLoads.pas
PMeira/electricdss-src
fab07b5584090556b003ef037feb25ec2de3b7c9
[ "BSD-3-Clause" ]
null
null
null
unit DLoads; interface function DSSLoads(mode: Longint; arg: Longint): Longint; CDECL; function DSSLoadsF(mode: Longint; arg: Double): Double; CDECL; function DSSLoadsS(mode: Longint; arg: pAnsiChar): pAnsiChar; CDECL; procedure DSSLoadsV(mode: Longint; out arg: Variant); CDECL; implementation uses DSSGlobals, Executive, Load, Variants, SysUtils, math; // Mode defines the property of the Loads Class // Arg defines the argument and complementary data in case the property will be edited function ActiveLoad: TLoadObj; begin Result := NIL; if ActiveCircuit[ActiveActor] <> NIL then Result := ActiveCircuit[ActiveActor].Loads.Active; end; procedure Set_Parameter(const parm: String; const val: String); var cmd: String; begin if not Assigned(ActiveCircuit[ActiveActor]) then exit; SolutionAbort := FALSE; // Reset for commands entered from outside cmd := Format('load.%s.%s=%s', [ActiveLoad.Name, parm, val]); DSSExecutive.Command := cmd; end; //*********************Properties int Type*********************************** function DSSLoads(mode: Longint; arg: Longint): Longint; CDECL; var pLoad: TLoadObj; begin Result := 0; // Default return value case mode of 0: begin // Loads.First Read Result := 0; if ActiveCircuit[ActiveActor] <> NIL then begin pLoad := ActiveCircuit[ActiveActor].Loads.First; if pLoad <> NIL then begin repeat if pLoad.Enabled then begin ActiveCircuit[ActiveActor].ActiveCktElement := pLoad; Result := 1; end else pLoad := ActiveCircuit[ActiveActor].Loads.Next; until (Result = 1) or (pLoad = NIL); end else Result := 0; // signify no more end; end; 1: begin //Loads.Next Read Result := 0; if ActiveCircuit[ActiveActor] <> NIL then begin pLoad := ActiveCircuit[ActiveActor].Loads.Next; if pLoad <> NIL then begin repeat if pLoad.Enabled then begin ActiveCircuit[ActiveActor].ActiveCktElement := pLoad; Result := ActiveCircuit[ActiveActor].Loads.ActiveIndex; end else pLoad := ActiveCircuit[ActiveActor].Loads.Next; until (Result > 0) or (pLoad = NIL); end else Result := 0; // signify no more end; end; 2: begin //Loads.Idx Read if ActiveCircuit[ActiveActor] <> NIL then Result := ActiveCircuit[ActiveActor].Loads.ActiveIndex else Result := 0; end; 3: begin //Loads.Idx Write if ActiveCircuit[ActiveActor] <> NIL then begin pLoad := ActiveCircuit[ActiveActor].Loads.Get(arg); if pLoad <> NIL then ActiveCircuit[ActiveActor].ActiveCktElement := pLoad; end; Result := 0; end; 4: begin //Loads.Count if Assigned(ActiveCircuit[ActiveActor]) then Result := ActiveCircuit[ActiveActor].Loads.ListSize; end; 5: begin // Loads.Class Read Result := 0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.LoadClass; end; 6: begin // Loads.Class Write Set_Parameter('Class', IntToStr(arg)); Result := 0; end; 7: begin // Loads.Model Read Result := 1; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.FLoadModel; end; 8: begin // Loads.Model Write pLoad := ActiveLoad; if pLoad <> NIL then pLoad.FLoadModel := arg; // enums match the integer codes Result := 0; end; 9: begin // Loads.NumCust Read Result := 0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.NumCustomers; end; 10: begin // Loads.NumCust Write Set_Parameter('NumCust', IntToStr(arg)); end; 11: begin // Loads.Status Read Result := 0; pLoad := ActiveLoad; if pLoad <> NIL then begin if pLoad.ExemptLoad then Result := 2 else if pLoad.FixedLoad then Result := 1; end; end; 12: begin // Loads.Status Write case arg of 0: Set_Parameter('status', 'v'); 1: Set_Parameter('status', 'f'); 2: Set_Parameter('status', 'e'); end; end; 13: begin // Loads.IsDelta read Result := 0; pLoad := ActiveLoad; if pLoad <> NIL then if pLoad.Connection > 0 then Result := 1; end; 14: begin // Loads.IsDelta Write pLoad := ActiveLoad; if pLoad <> NIL then pLoad.Connection := Integer(arg); end else Result := -1; //The case is not identified or do not exists end; end; //*********************Properties Float Type*********************************** function DSSLoadsF(mode: Longint; arg: Double): Double; CDECL; var pLoad: TLoadObj; begin Result := 0.0; // Default return value case mode of 0: begin // Loads.kW read Result := 0.0; if ActiveCircuit[ActiveActor] <> NIL then begin with ActiveCircuit[ActiveActor].Loads do begin if ActiveIndex <> 0 then begin Result := TLoadObj(Active).kWBase; end; end; end; end; 1: begin // Loads.kW Write if ActiveCircuit[ActiveActor] <> NIL then begin with ActiveCircuit[ActiveActor].Loads do begin if ActiveIndex <> 0 then begin TLoadObj(Active).kWBase := arg; TLoadObj(Active).LoadSpecType := 0; TLoadObj(Active).RecalcElementData(ActiveActor); // sets kvar based on kW and pF end; end; end; Result := 0; end; 2: begin // Loads.kV read Result := 0.0; if ActiveCircuit[ActiveActor] <> NIL then begin with ActiveCircuit[ActiveActor].Loads do begin if ActiveIndex <> 0 then begin Result := TLoadObj(Active).kVLoadBase; end; end; end; end; 3: begin // Loads.kV Write if ActiveCircuit[ActiveActor] <> NIL then begin with ActiveCircuit[ActiveActor].Loads do begin if ActiveIndex <> 0 then begin TLoadObj(Active).kVLoadBase := arg; TLoadObj(Active).UpdateVoltageBases; // side effects end; end; end; Result := 0; end; 4: begin // Loads.kvar read Result := 0.0; if ActiveCircuit[ActiveActor] <> NIL then begin with ActiveCircuit[ActiveActor].Loads do begin if ActiveIndex <> 0 then begin Result := TLoadObj(Active).kvarBase; end; end; end; end; 5: begin // Loads.kvar Write if ActiveCircuit[ActiveActor] <> NIL then begin with ActiveCircuit[ActiveActor].Loads do begin if ActiveIndex <> 0 then begin TLoadObj(Active).kvarBase := arg; TLoadObj(Active).LoadSpecType := 1; TLoadObj(Active).RecalcElementData(ActiveActor); // set power factor based on kW, kvar end; end; end; Result := 0; end; 6: begin // Loads.PF read Result := 0.0; if ActiveCircuit[ActiveActor] <> NIL then begin with ActiveCircuit[ActiveActor].Loads do begin if ActiveIndex <> 0 then begin Result := TLoadObj(Active).PFNominal; end; end; end; end; 7: begin // Loads.PF Write if ActiveCircuit[ActiveActor] <> NIL then begin with ActiveCircuit[ActiveActor].Loads do begin if ActiveIndex <> 0 then begin TLoadObj(Active).PFNominal := arg; TLoadObj(Active).LoadSpecType := 0; TLoadObj(Active).RecalcElementData(ActiveActor); // sets kvar based on kW and pF end; end; end; Result := 0; end; 8: begin // Loads.PctMean read Result := 0.0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.puMean * 100.0; end; 9: begin // Loads.PctMean Write Set_Parameter('%mean', FloatToStr(arg)); Result := 0; end; 10: begin // Loads.PctStdDev read Result := 0.0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.puStdDev * 100.0; end; 11: begin Set_Parameter('%stddev', FloatToStr(arg)); Result := 0; end; 12: begin Result := 0.0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.AllocationFactor; end; 13: begin Set_Parameter('AllocationFactor', FloatToStr(arg)); Result := 0; end; 14: begin Result := 0.0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.CFactor; end; 15: begin Set_Parameter('Cfactor', FloatToStr(arg)); Result := 0; end; 16: begin Result := 0.0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.CVRwatts; end; 17: begin Set_Parameter('CVRwatts', FloatToStr(arg)); Result := 0; end; 18: begin Result := 0.0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.CVRvars; end; 19: begin Set_Parameter('CVRvars', FloatToStr(arg)); Result := 0; end; 20: begin Result := 0.0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.kVABase; end; 21: begin Set_Parameter('kva', FloatToStr(arg)); Result := 0; end; 22: begin Result := 0.0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.kWh; end; 23: begin Set_Parameter('kwh', FloatToStr(arg)); Result := 0; end; 24: begin Result := 0.0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.kWhDays; end; 25: begin Set_Parameter('kwhdays', FloatToStr(arg)); Result := 0; end; 26: begin Result := 0.0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.Rneut; end; 27: begin Set_Parameter('Rneut', FloatToStr(arg)); Result := 0; end; 28: begin Result := 0.0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.MaxPU; end; 29: begin Set_Parameter('VmaxPu', FloatToStr(arg)); Result := 0; end; 30: begin Result := 0.0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.MinEmerg; end; 31: begin Set_Parameter('VminEmerg', FloatToStr(arg)); Result := 0; end; 32: begin Result := 0.0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.MinNormal; end; 33: begin Set_Parameter('VminNorm', FloatToStr(arg)); Result := 0; end; 34: begin Result := 0.0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.MinPU; end; 35: begin Set_Parameter('VminPu', FloatToStr(arg)); end; 36: begin Result := 0.0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.ConnectedkVA; end; 37: begin Set_Parameter('XfKVA', FloatToStr(arg)); end; 38: begin Result := 0.0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.Xneut; end; 39: begin Set_Parameter('Xneut', FloatToStr(arg)); end; 40: begin Result := -1.0; // signify bad request pLoad := ActiveLoad; if pLoad <> NIL then begin Result := pLoad.puSeriesRL * 100.0; end; end; 41: begin pLoad := ActiveLoad; if pLoad <> NIL then begin pLoad.puSeriesRL := arg / 100.0; end; end; 42: begin Result := 0.0; pLoad := ActiveLoad; if pLoad <> NIL then Result := pLoad.RelWeighting; end; 43: begin pLoad := ActiveLoad; if pLoad <> NIL then pLoad.RelWeighting := arg; end else Result := -1; //The case is not identified or do not exists end; end; //*********************Properties String Type*********************************** function DSSLoadsS(mode: Longint; arg: pAnsiChar): pAnsiChar; CDECL; var pLoad: TLoadObj; ActiveSave: Integer; S: String; Found: Boolean; begin Result := pAnsiChar(Ansistring('')); // Default return value case mode of 0: begin // Loads.Name - Read Result := pAnsiChar(Ansistring('')); if ActiveCircuit[ActiveActor] <> NIL then begin pLoad := ActiveCircuit[ActiveActor].Loads.Active; if pLoad <> NIL then Result := pAnsiChar(Ansistring(pLoad.Name)) else Result := pAnsiChar(Ansistring('')); // signify no name end; end; 1: begin // Loads.Name - Write if ActiveCircuit[ActiveActor] <> NIL then begin // Search list of Loads in active circuit for name with ActiveCircuit[ActiveActor].Loads do begin S := Widestring(arg); // Convert to Pascal String Found := FALSE; ActiveSave := ActiveIndex; pLoad := First; while pLoad <> NIL do begin if (CompareText(pLoad.Name, S) = 0) then begin ActiveCircuit[ActiveActor].ActiveCktElement := pLoad; Found := TRUE; Break; end; pLoad := Next; end; if not Found then begin DoSimpleMsg('Load "' + S + '" Not Found in Active Circuit.', 5003); pLoad := Get(ActiveSave); // Restore active Load ActiveCircuit[ActiveActor].ActiveCktElement := pLoad; end; end; end; Result := pAnsiChar(Ansistring('')); end; 2: begin // Loads.CVRCurve - Read Result := pAnsiChar(Ansistring('')); pLoad := ActiveLoad; if pLoad <> NIL then Result := pAnsiChar(Ansistring(pLoad.CVRshape)); end; 3: begin // Loads.CVRCurve - Write Set_Parameter('CVRcurve', Widestring(arg)); Result := pAnsiChar(Ansistring('')); end; 4: begin // Loads.Daily - Read Result := pAnsiChar(Ansistring('')); pLoad := ActiveLoad; if pLoad <> NIL then Result := pAnsiChar(Ansistring(pLoad.DailyShape)); end; 5: begin // Loads.Daily - Write Set_Parameter('Daily', Widestring(arg)); Result := pAnsiChar(Ansistring('')); end; 6: begin // Loads.Duty - read Result := pAnsiChar(Ansistring('')); pLoad := ActiveLoad; if pLoad <> NIL then Result := pAnsiChar(Ansistring(pLoad.DailyShape)); end; 7: begin // Loads.Duty - Write Set_Parameter('Duty', Widestring(arg)); Result := pAnsiChar(Ansistring('')); end; 8: begin // Loads.Spectrum - Read Result := pAnsiChar(Ansistring('')); pLoad := ActiveLoad; if pLoad <> NIL then Result := pAnsiChar(Ansistring(pLoad.Spectrum)); end; 9: begin // Loads.Spectrum - Write Set_Parameter('Spectrum', Widestring(arg)); Result := pAnsiChar(Ansistring('')); end; 10: begin // Loads.Yearly - Read Result := pAnsiChar(Ansistring('')); pLoad := ActiveLoad; if pLoad <> NIL then Result := pAnsiChar(Ansistring(pLoad.YearlyShape)); end; 11: begin // Loads.Yearly - Write Set_Parameter('Yearly', Widestring(arg)); Result := pAnsiChar(Ansistring('')); end; 12: begin // Loads.Growth - read Result := pAnsiChar(Ansistring('')); pLoad := ActiveLoad; if pLoad <> NIL then Result := pAnsiChar(Ansistring(pLoad.GrowthShape)); end; 13: begin // Loads.Growth - Write Set_Parameter('Growth', Widestring(arg)); Result := pAnsiChar(Ansistring('')); end else Result := pAnsiChar(Ansistring('Error')); end end; //*********************Properties Variant Type*********************************** procedure DSSLoadsV(mode: Longint; out arg: Variant); CDECL; var pLoad: TLoadObj; k, i, Looplimit: Integer; begin case mode of 0: begin // Loads.Allnames arg := VarArrayCreate([0, 0], varOleStr); arg[0] := 'NONE'; if ActiveCircuit[ActiveActor] <> NIL then with ActiveCircuit[ActiveActor] do if Loads.ListSize > 0 then begin VarArrayRedim(arg, Loads.ListSize - 1); k := 0; pLoad := Loads.First; while pLoad <> NIL do begin arg[k] := pLoad.Name; Inc(k); pLoad := Loads.Next; end; end; end; 1: begin // Loads.ZIPV - read arg := VarArrayCreate([0, 0], varDouble); arg[0] := 0.0; // error condition: one element array=0 pLoad := ActiveLoad; if pLoad <> NIL then begin VarArrayRedim(arg, pLoad.nZIPV - 1); for k := 0 to pLoad.nZIPV - 1 do arg[k] := pLoad.ZipV^[k + 1]; end; end; 2: begin pLoad := ActiveLoad; if pLoad <> NIL then begin // allocate space for 7 pLoad.nZIPV := 7; // only put as many elements as proviced up to nZIPV LoopLimit := VarArrayHighBound(arg, 1); if (LoopLimit - VarArrayLowBound(arg, 1) + 1) > 7 then LoopLimit := VarArrayLowBound(arg, 1) + 6; k := 1; for i := VarArrayLowBound(arg, 1) to LoopLimit do begin pLoad.ZIPV^[k] := arg[i]; inc(k); end; end; end else arg[0] := 'NONE'; end; end; end.
32.580733
111
0.408004
f161cfbe796e08960820a0cbb4334226ec3efd6f
304
pas
Pascal
src/kitU.types.pas
jefer147258/KitU
8adaa69e220e328c1dd9125019793afd68822a93
[ "Apache-2.0" ]
null
null
null
src/kitU.types.pas
jefer147258/KitU
8adaa69e220e328c1dd9125019793afd68822a93
[ "Apache-2.0" ]
null
null
null
src/kitU.types.pas
jefer147258/KitU
8adaa69e220e328c1dd9125019793afd68822a93
[ "Apache-2.0" ]
null
null
null
unit kitU.types; interface type tformatType = (tfpostCode, tfdoc, tffoneNumber, tfdate, tfAge, tfIE, tfcep, tCredCard, tvalidateCredcard, tCpf, tCnpj, tphone, tcep); tageType = (tiyears, tiyearsMonth, tiyearsMonthDay, tiresume, tifull, timonths); tdocType = (dtssn, dtein); implementation end.
23.384615
135
0.75
47246e7ebb873d2880e8044db22881db499ad27c
4,555
dfm
Pascal
CPRSChart/OR_30_377V9_SRC/CPRS-chart/fRemVisitInfo.dfm
VHAINNOVATIONS/Transplant
a6c000a0df4f46a17330cec95ff25119fca1f472
[ "Apache-2.0" ]
1
2015-11-03T14:56:42.000Z
2015-11-03T14:56:42.000Z
CPRSChart/OR_30_377V9_SRC/CPRS-chart/fRemVisitInfo.dfm
VHAINNOVATIONS/Transplant
a6c000a0df4f46a17330cec95ff25119fca1f472
[ "Apache-2.0" ]
null
null
null
CPRSChart/OR_30_377V9_SRC/CPRS-chart/fRemVisitInfo.dfm
VHAINNOVATIONS/Transplant
a6c000a0df4f46a17330cec95ff25119fca1f472
[ "Apache-2.0" ]
null
null
null
inherited frmRemVisitInfo: TfrmRemVisitInfo Left = 192 Top = 195 BorderIcons = [biSystemMenu] BorderStyle = bsDialog Caption = 'Other Visit Information' ClientHeight = 221 ClientWidth = 316 Position = poOwnerFormCenter OnCreate = FormCreate ExplicitWidth = 322 ExplicitHeight = 249 DesignSize = ( 316 221) PixelsPerInch = 96 TextHeight = 13 object lblVital: TLabel [0] Left = 3 Top = 6 Width = 111 Height = 13 Caption = 'Vital Entry Date && Time:' end inline fraVisitRelated: TfraVisitRelated [1] Left = 106 Top = 27 Width = 207 Height = 174 Anchors = [akTop, akRight] TabOrder = 2 TabStop = True ExplicitLeft = 106 ExplicitTop = 27 ExplicitWidth = 207 ExplicitHeight = 174 inherited gbVisitRelatedTo: TGroupBox Width = 207 Height = 174 ExplicitWidth = 207 ExplicitHeight = 174 end end object btnOK: TButton Left = 158 Top = 198 Width = 75 Height = 21 Anchors = [akRight, akBottom] Caption = '&OK' Default = True ModalResult = 1 TabOrder = 3 end object btnCancel: TButton Left = 238 Top = 198 Width = 75 Height = 21 Anchors = [akRight, akBottom] Cancel = True Caption = '&Cancel' ModalResult = 2 TabOrder = 4 end object dteVitals: TORDateBox Tag = 11 Left = 119 Top = 2 Width = 133 Height = 21 TabOrder = 0 DateOnly = False RequireTime = True Caption = 'Vital Entry Date && Time:' end object btnNow: TButton Left = 269 Top = 2 Width = 43 Height = 21 Anchors = [akTop, akRight] Caption = 'NOW' TabOrder = 1 OnClick = btnNowClick end inherited amgrMain: TVA508AccessibilityManager Data = ( ( 'Component = fraVisitRelated' 'Status = stsDefault') ( 'Component = fraVisitRelated.gbVisitRelatedTo' 'Status = stsDefault') ( 'Component = fraVisitRelated.chkSCYes' 'Text = Service Connected Condition Yes' 'Status = stsOK') ( 'Component = fraVisitRelated.chkSCNo' 'Text = Service Connected Condition No' 'Status = stsOK') ( 'Component = fraVisitRelated.chkCVYes' 'Text = Combat Vet (Combat Related) Yes' 'Status = stsOK') ( 'Component = fraVisitRelated.chkCVNo' 'Text = Combat Vet (Combat Related) No' 'Status = stsOK') ( 'Component = fraVisitRelated.chkAOYes' 'Text = Agent Orange Exposure Yes' 'Status = stsOK') ( 'Component = fraVisitRelated.chkAONo' 'Text = Agent Orange Exposure No' 'Status = stsOK') ( 'Component = fraVisitRelated.chkIRYes' 'Text = Ionizing Radiation Exposure Yes' 'Status = stsOK') ( 'Component = fraVisitRelated.chkIRNo' 'Text = Ionizing Radiation Exposure No' 'Status = stsOK') ( 'Component = fraVisitRelated.chkECYes' 'Text = Southwest Asia Conditions Yes' 'Status = stsOK') ( 'Component = fraVisitRelated.chkECNo' 'Text = Southwest Asia Conditions No' 'Status = stsOK') ( 'Component = fraVisitRelated.chkSHDYes' 'Text = Shipboard Hazard and Defense Yes' 'Status = stsOK') ( 'Component = fraVisitRelated.chkSHDNo' 'Text = Shipboard Hazard and Defense No' 'Status = stsOK') ( 'Component = fraVisitRelated.chkMSTYes' 'Text = MST Yes' 'Status = stsOK') ( 'Component = fraVisitRelated.chkMSTNo' 'Text = MST No' 'Status = stsOK') ( 'Component = fraVisitRelated.chkHNCYes' 'Text = Head and/or Neck Cancer Yes' 'Status = stsOK') ( 'Component = fraVisitRelated.chkHNCNo' 'Text = Head and/or Neck Cancer No' 'Status = stsOK') ( 'Component = fraVisitRelated.lblSCNo' 'Status = stsDefault') ( 'Component = fraVisitRelated.lblSCYes' 'Status = stsDefault') ( 'Component = btnOK' 'Status = stsDefault') ( 'Component = btnCancel' 'Status = stsDefault') ( 'Component = dteVitals' 'Status = stsDefault') ( 'Component = btnNow' 'Status = stsDefault') ( 'Component = frmRemVisitInfo' 'Status = stsDefault')) end end
25.027473
54
0.567289
f1dd45da6b3f0f99fc0ed7dac4998816b3703971
3,440
pas
Pascal
Version8/Source/PDElements/PDClass.pas
dss-extensions/electricdss-src
fab07b5584090556b003ef037feb25ec2de3b7c9
[ "BSD-3-Clause" ]
1
2022-01-23T14:43:30.000Z
2022-01-23T14:43:30.000Z
Version8/Source/PDElements/PDClass.pas
PMeira/electricdss-src
fab07b5584090556b003ef037feb25ec2de3b7c9
[ "BSD-3-Clause" ]
7
2018-08-15T04:00:26.000Z
2018-10-25T10:15:59.000Z
Version8/Source/PDElements/PDClass.pas
PMeira/electricdss-src
fab07b5584090556b003ef037feb25ec2de3b7c9
[ "BSD-3-Clause" ]
null
null
null
unit PDClass; { ---------------------------------------------------------- Copyright (c) 2008-2015, Electric Power Research Institute, Inc. All rights reserved. ---------------------------------------------------------- } {$M+} interface uses CktElementClass; type TPDClass = class(TCktElementClass) PRIVATE PROTECTED function ClassEdit(const ActivePDObj: Pointer; const ParamPointer: Integer): Integer; procedure ClassMakeLike(const OtherObj: Pointer); procedure CountProperties; // Add no. of intrinsic properties procedure DefineProperties; // Add Properties of this class to propName PUBLIC NumPDClassProps: Integer; constructor Create; destructor Destroy; OVERRIDE; PUBLISHED end; implementation uses PDElement, ParserDel, DSSClassDefs, DSSGlobals, Utilities; constructor TPDClass.Create; begin inherited Create; NumPDClassProps := 5; DSSClassType := PD_ELEMENT; end; destructor TPDClass.Destroy; begin inherited Destroy; end; procedure TPDClass.CountProperties; begin NumProperties := NumProperties + NumPDClassProps; inherited CountProperties; end; procedure TPDClass.DefineProperties; // Define the properties for the base power delivery element class begin PropertyName^[ActiveProperty + 1] := 'normamps'; PropertyName^[ActiveProperty + 2] := 'emergamps'; PropertyName^[ActiveProperty + 3] := 'faultrate'; PropertyName^[ActiveProperty + 4] := 'pctperm'; PropertyName^[ActiveProperty + 5] := 'repair'; PropertyHelp^[ActiveProperty + 1] := 'Normal rated current.'; PropertyHelp^[ActiveProperty + 2] := 'Maximum or emerg current.'; PropertyHelp^[ActiveProperty + 3] := 'Failure rate per year.'; PropertyHelp^[ActiveProperty + 4] := 'Percent of failures that become permanent.'; PropertyHelp^[ActiveProperty + 5] := 'Hours to repair.'; ActiveProperty := ActiveProperty + NumPDClassProps; inherited DefineProperties; end; //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - function TPDClass.ClassEdit(const ActivePDObj: Pointer; const ParamPointer: Integer): Integer; begin Result := 0; // continue parsing with contents of Parser if ParamPointer > 0 then with TPDElement(ActivePDObj) do begin case ParamPointer of 1: NormAmps := Parser[ActiveActor].Dblvalue; 2: EmergAmps := Parser[ActiveActor].Dblvalue; 3: FaultRate := Parser[ActiveActor].Dblvalue; 4: PctPerm := Parser[ActiveActor].Dblvalue; 5: HrsToRepair := Parser[ActiveActor].DblValue; else inherited ClassEdit(ActivePDObj, ParamPointer - NumPDClassProps) end; end; end; procedure TPDClass.ClassMakeLike(const OtherObj: Pointer); var OtherPDObj: TPDElement; begin OtherPDObj := TPDElement(OtherObj); with TPDElement(ActiveDSSObject[ActiveActor]) do begin NormAmps := OtherPDObj.NormAmps; EmergAmps := OtherPDObj.EmergAmps; FaultRate := OtherPDObj.FaultRate; PctPerm := OtherPDObj.PctPerm; HrsToRepair := OtherPDObj.HrsToRepair; end; inherited ClassMakeLike(OtherObj); end; end.
24.748201
94
0.614535
f11248ffc6f8bc54594a11245df0b3c24ff59d05
2,429
pas
Pascal
samples/renders_spring4d_v2_collections/UMVCWebModule.pas
juliosenha/delphimvcframework
f22ff8c99df2873a98195b9d0fc8a27f952c1141
[ "Apache-2.0" ]
1,009
2015-05-28T12:34:39.000Z
2022-03-30T14:10:18.000Z
samples/renders_spring4d_v2_collections/UMVCWebModule.pas
FinCodeur/delphimvcframework
a45cb1383eaffc9e81a836247643390acbb7b9b0
[ "Apache-2.0" ]
454
2015-05-28T12:44:27.000Z
2022-03-31T22:35:45.000Z
samples/renders_spring4d_v2_collections/UMVCWebModule.pas
FinCodeur/delphimvcframework
a45cb1383eaffc9e81a836247643390acbb7b9b0
[ "Apache-2.0" ]
377
2015-05-28T16:29:21.000Z
2022-03-21T18:36:12.000Z
unit UMVCWebModule; interface uses System.SysUtils, System.Classes, Web.HTTPApp, MVCFramework; type TMyWebModule = class(TWebModule) procedure WebModuleCreate(Sender: TObject); procedure WebModuleDestroy(Sender: TObject); private FMVC: TMVCEngine; public { Public declarations } end; var WebModuleClass: TComponentClass = TMyWebModule; implementation {$R *.dfm} uses UController, System.IOUtils, MVCFramework.Commons, MVCFramework.Middleware.StaticFiles, MVCFramework.Middleware.Compression, Spring.Collections.Lists, Spring4DCollectionsSerializer; procedure TMyWebModule.WebModuleCreate(Sender: TObject); begin FMVC := TMVCEngine.Create(Self, procedure(Config: TMVCConfig) begin // session timeout (0 means session cookie) Config[TMVCConfigKey.SessionTimeout] := '0'; //default content-type Config[TMVCConfigKey.DefaultContentType] := TMVCConstants.DEFAULT_CONTENT_TYPE; //default content charset Config[TMVCConfigKey.DefaultContentCharset] := TMVCConstants.DEFAULT_CONTENT_CHARSET; //unhandled actions are permitted? Config[TMVCConfigKey.AllowUnhandledAction] := 'false'; //enables or not system controllers loading (available only from localhost requests) Config[TMVCConfigKey.LoadSystemControllers] := 'true'; //default view file extension Config[TMVCConfigKey.DefaultViewFileExtension] := 'html'; //view path Config[TMVCConfigKey.ViewPath] := 'templates'; //Max Record Count for automatic Entities CRUD Config[TMVCConfigKey.MaxEntitiesRecordCount] := '20'; //Enable Server Signature in response Config[TMVCConfigKey.ExposeServerSignature] := 'true'; //Enable X-Powered-By Header in response Config[TMVCConfigKey.ExposeXPoweredBy] := 'true'; // Max request size in bytes Config[TMVCConfigKey.MaxRequestSize] := IntToStr(TMVCConstants.DEFAULT_MAX_REQUEST_SIZE); end); FMVC.AddController(TMyController); // Register custom serializer FMVC.Serializers.Items[TMVCMediaType.APPLICATION_JSON] .RegisterTypeSerializer(TypeInfo(TFoldedList<TObject>), TSpringListSerializer.Create); // To enable compression (deflate, gzip) just add this middleware as the last one FMVC.AddMiddleware(TMVCCompressionMiddleware.Create); end; procedure TMyWebModule.WebModuleDestroy(Sender: TObject); begin FMVC.Free; end; end.
29.26506
95
0.745163
83ea9c860932d3296a5e8ef19d084e0607bdaf73
4,204
pas
Pascal
core/classes/components/control proxies/editable view proxies/clsEditButtonViewProxy.pas
sjilnikov/philadelphia
db2b57e7059047f8e208b12409adbc987895567c
[ "Apache-2.0" ]
1
2017-09-14T05:48:34.000Z
2017-09-14T05:48:34.000Z
core/classes/components/control proxies/editable view proxies/clsEditButtonViewProxy.pas
sjilnikov/philadelphia
db2b57e7059047f8e208b12409adbc987895567c
[ "Apache-2.0" ]
null
null
null
core/classes/components/control proxies/editable view proxies/clsEditButtonViewProxy.pas
sjilnikov/philadelphia
db2b57e7059047f8e208b12409adbc987895567c
[ "Apache-2.0" ]
null
null
null
unit clsEditButtonViewProxy; interface uses variants, graphics, classes, controls, stdCtrls, extCtrls, sysUtils, clsClassKit, clsMulticastEvents, clsAbstractEditableViewProxy; type tEditButtonType = (btLeft, btRigth); cEditButtonViewProxy = class; tEditButtonViewProxyButtonClickedEvent = procedure (aSender: cEditButtonViewProxy; aButtonType: tEditButtonType) of object; cEditButtonViewProxy = class(cAbstractEditableViewProxy) private fOnButtonClicked : tEditButtonViewProxyButtonClickedEvent; function getCastedView: tButtonedEdit; function getViewValue: variant; override; procedure setViewValue(aValue: variant); override; procedure setupViewEvents; override; procedure disconnectViewEvents; override; public procedure setView(aView: tWinControl); override; procedure setEditable(aValue: boolean); function isEditable: boolean; procedure setImageList(aImageList: tImageList); function getLeftButton: tEditButton; function getRightButton: tEditButton; function getFont: tFont; procedure setHorizontalAlignment(aValue: tAlignment); published {$REGION 'SLOTS'} procedure leftButtonClicked(aSender: tObject); procedure rightButtonClicked(aSender: tObject); {$ENDREGION} published {$REGION 'EVENTS'} property onButtonClicked: tEditButtonViewProxyButtonClickedEvent read fOnButtonClicked write fOnButtonClicked; {$ENDREGION} end; implementation { cEditButtonViewProxy } procedure cEditButtonViewProxy.disconnectViewEvents; begin inherited disconnectViewEvents; disconnect(getCastedView, 'onChange', self, 'changed'); disconnect(getCastedView, 'onRightButtonClick', self, 'rightButtonClicked'); disconnect(getCastedView, 'onLeftButtonClick', self, 'leftButtonClicked'); end; function cEditButtonViewProxy.getCastedView: tButtonedEdit; begin result:= fView as tButtonedEdit; end; procedure cEditButtonViewProxy.setViewValue(aValue: variant); begin getCastedView.text:= aValue; end; function cEditButtonViewProxy.getViewValue: variant; begin result:= getCastedView.text; end; function cEditButtonViewProxy.isEditable: boolean; begin result:= false; if not assigned(fView) then exit; result:= not getCastedView.readOnly; end; function cEditButtonViewProxy.getFont: tFont; begin result:= nil; if (not assigned(fView)) then exit; result:= getCastedView.font; end; function cEditButtonViewProxy.getLeftButton: tEditButton; begin result:= nil; if not assigned(fView) then exit; result:= getCastedView.leftButton; end; function cEditButtonViewProxy.getRightButton: tEditButton; begin result:= nil; if not assigned(fView) then exit; result:= getCastedView.rightButton; end; procedure cEditButtonViewProxy.setEditable(aValue: boolean); begin if not assigned(fView) then exit; getCastedView.readOnly:= not aValue; end; procedure cEditButtonViewProxy.setHorizontalAlignment(aValue: tAlignment); begin if not assigned(fView) then exit; getCastedView.alignment:= aValue; end; procedure cEditButtonViewProxy.setImageList(aImageList: tImageList); begin if not assigned(fView) then exit; getCastedView.images:= aImageList; end; procedure cEditButtonViewProxy.setupViewEvents; begin inherited setupViewEvents; connect(getCastedView, 'onChange', self, 'changed'); connect(getCastedView, 'onRightButtonClick', self, 'rightButtonClicked'); connect(getCastedView, 'onLeftButtonClick', self, 'leftButtonClicked'); end; procedure cEditButtonViewProxy.setView(aView: tWinControl); begin inherited setView(aView); if (assigned(aView)) and (not (aView is tButtonedEdit)) then begin raise eClassError.createFmt(INVALID_CLASS_RECEIVED, [tButtonedEdit.className, aView.className]); end; end; {$REGION 'SLOTS'} procedure cEditButtonViewProxy.leftButtonClicked(aSender: tObject); begin if assigned(fOnButtonClicked) then begin fOnButtonClicked(self, btLeft); end; end; procedure cEditButtonViewProxy.rightButtonClicked(aSender: tObject); begin if assigned(fOnButtonClicked) then begin fOnButtonClicked(self, btRigth); end; end; {$ENDREGION} end.
23.355556
125
0.773549
4717329e4b76a0d4c0eb5ab38ed8ec3c900c9328
1,113
pas
Pascal
samples/master_details/WebModuleUnit1.pas
kitesoft/delphimvcframework
47d2383ddaac61979a514e5cd9f5d103a0989f68
[ "Apache-2.0" ]
2
2021-08-21T10:17:27.000Z
2021-08-21T10:17:30.000Z
samples/master_details/WebModuleUnit1.pas
FinCodeur/delphimvcframework
a45cb1383eaffc9e81a836247643390acbb7b9b0
[ "Apache-2.0" ]
null
null
null
samples/master_details/WebModuleUnit1.pas
FinCodeur/delphimvcframework
a45cb1383eaffc9e81a836247643390acbb7b9b0
[ "Apache-2.0" ]
null
null
null
unit WebModuleUnit1; interface uses System.SysUtils, System.Classes, Web.HTTPApp, mvcframework; type TWebModule1 = class(TWebModule) procedure WebModuleCreate(Sender: TObject); private FEngine: TMVCEngine; public { Public declarations } end; var WebModuleClass: TComponentClass = TWebModule1; implementation { %CLASSGROUP 'Vcl.Controls.TControl' } uses Controllers.Orders, mvcframework.Middleware.CORS, mvcframework.Middleware.Compression, Controllers.Base, MVCFramework.Commons; {$R *.dfm} procedure TWebModule1.WebModuleCreate(Sender: TObject); begin FEngine := TMVCEngine.Create(self, procedure(Config: TMVCConfig) begin //Enabling the following line, the API will start to respond from "/api/v1" //So "/articles/1" becomes "/api/v1/articles/1" //Config[TMVCConfigKey.PathPrefix] := '/api/v1'; end); FEngine.AddController(TOrdersController); {$IFDEF TESTINSTANCE} FEngine.AddController(TPrivateController); {$ENDIF} FEngine.AddMiddleware(TCORSMiddleware.Create); FEngine.AddMiddleware(TMVCCompressionMiddleware.Create(256)); end; end.
23.680851
91
0.751123
471cbb42f60d2ab7034463d8c6ff85bad13632db
101
pas
Pascal
Libraries/SynEdit/Source/QSynHighlighterIni.pas
Patiencer/Concepts
e63910643b2401815dd4f6b19fbdf0cd7d443392
[ "Apache-2.0" ]
19
2018-10-22T23:45:31.000Z
2021-05-16T00:06:49.000Z
package/synedit-201b/SynEdit/Source/QSynHighlighterIni.pas
RonaldoSurdi/Sistema-gerenciamento-websites-delphi
8cc7eec2d05312dc41f514bbd5f828f9be9c579e
[ "MIT" ]
16
2019-02-02T19:54:54.000Z
2019-02-28T05:22:36.000Z
package/synedit-201b/SynEdit/Source/QSynHighlighterIni.pas
RonaldoSurdi/Sistema-gerenciamento-websites-delphi
8cc7eec2d05312dc41f514bbd5f828f9be9c579e
[ "MIT" ]
6
2018-08-30T05:16:21.000Z
2021-05-12T20:25:43.000Z
unit QSynHighlighterIni; {$DEFINE SYN_CLX} {$DEFINE QSYNHIGHLIGHTERINI} {$I SynHighlighterIni.pas}
14.428571
28
0.792079
85b5c0b3a8974f2c0c1b3717219e6036fa4cb198
17,135
dfm
Pascal
vcl/Raize/RzLabelEditor.dfm
1aq/PBox
67ced599ee36ceaff097c6584f8100cf96006dfe
[ "MIT" ]
null
null
null
vcl/Raize/RzLabelEditor.dfm
1aq/PBox
67ced599ee36ceaff097c6584f8100cf96006dfe
[ "MIT" ]
null
null
null
vcl/Raize/RzLabelEditor.dfm
1aq/PBox
67ced599ee36ceaff097c6584f8100cf96006dfe
[ "MIT" ]
null
null
null
object RzLabelEditDlg: TRzLabelEditDlg Left = 239 Top = 114 BorderStyle = bsDialog Caption = ' - Label Editor' ClientHeight = 377 ClientWidth = 631 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Verdana' Font.Style = [] OldCreateOrder = True Position = poScreenCenter OnClose = FormClose OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 object Label1: TRzLabel Left = 8 Top = 11 Width = 44 Height = 13 Caption = 'Caption' ParentColor = False end object grpPreview: TRzGroupBox Left = 8 Top = 88 Width = 289 Height = 247 Caption = 'Preview' TabOrder = 1 object lblPreview: TRzLabel Left = 30 Top = 16 Width = 225 Height = 225 Alignment = taCenter AutoSize = False Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] ParentColor = False ParentFont = False BevelWidth = 0 end end object btnOK: TRzButton Left = 462 Top = 344 Default = True ModalResult = 1 Caption = 'OK' Color = 15791348 HotTrack = True TabOrder = 2 end object btnCancel: TRzButton Left = 547 Top = 344 ModalResult = 2 Caption = 'Cancel' Color = 15791348 HotTrack = True TabOrder = 3 end object edtCaption: TRzMemo Left = 67 Top = 8 Width = 556 Height = 69 ScrollBars = ssVertical TabOrder = 0 OnChange = edtCaptionChange FrameVisible = True end object pgcFormat: TRzPageControl Left = 310 Top = 92 Width = 313 Height = 245 Hint = '' ActivePage = tabTextStyle ParentColor = False TabIndex = 0 TabOrder = 4 OnChanging = pgcFormatChanging FixedDimension = 19 object tabTextStyle: TRzTabSheet Caption = 'Text Style' ExplicitLeft = 0 ExplicitTop = 0 ExplicitWidth = 0 ExplicitHeight = 0 object Label2: TRzLabel Left = 8 Top = 13 Width = 24 Height = 13 Caption = 'Font' ParentColor = False end object Label3: TRzLabel Left = 8 Top = 96 Width = 31 Height = 13 Caption = 'Color' ParentColor = False end object Label6: TRzLabel Left = 8 Top = 53 Width = 24 Height = 13 Caption = 'Size' ParentColor = False end object trkPointSize: TRzTrackBar Left = 44 Top = 37 Width = 257 Height = 40 Max = 18 Position = 0 TickStyle = tkOwnerDraw TrackOffset = 22 OnChange = trkPointSizeChange OnDrawTick = trkPointSizeDrawTick TabOrder = 1 end object grpFontStyle: TRzGroupBox Left = 148 Top = 87 Width = 153 Height = 61 Caption = 'Font Style' ParentColor = True TabOrder = 3 object chkBold: TRzCheckBox Left = 9 Top = 16 Width = 47 Height = 15 Caption = 'Bold' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 Font.Name = 'Verdana' Font.Style = [fsBold] HotTrack = True ParentFont = False State = cbUnchecked TabOrder = 0 OnClick = chkBoldClick end object chkItalic: TRzCheckBox Left = 9 Top = 36 Width = 47 Height = 15 Caption = 'Italic' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 Font.Name = 'Verdana' Font.Style = [fsItalic] HotTrack = True ParentFont = False State = cbUnchecked TabOrder = 1 OnClick = chkItalicClick end object chkStrikeout: TRzCheckBox Left = 69 Top = 16 Width = 71 Height = 15 Caption = 'Strikeout' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 Font.Name = 'Verdana' Font.Style = [fsStrikeOut] HotTrack = True ParentFont = False State = cbUnchecked TabOrder = 2 OnClick = chkStrikeoutClick end object chkUnderline: TRzCheckBox Left = 69 Top = 36 Width = 73 Height = 15 Caption = 'Underline' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 Font.Name = 'Verdana' Font.Style = [fsUnderline] HotTrack = True ParentFont = False State = cbUnchecked TabOrder = 3 OnClick = chkUnderlineClick end end object cbxFonts: TRzFontComboBox Left = 44 Top = 9 Width = 257 Height = 22 PreviewText = 'AaBbYyZz' ShowStyle = ssFontPreview Ctl3D = False FrameVisible = True ParentCtl3D = False TabOrder = 0 OnChange = cbxFontsChange end object grpTextStyle: TRzRadioGroup Left = 8 Top = 156 Width = 293 Height = 57 Caption = 'Text Style' Columns = 4 ItemHotTrack = True ItemIndex = 0 Items.Strings = ( 'Normal' 'Raised' 'Recessed' 'Shadow') ParentColor = True TabOrder = 4 VerticalSpacing = 0 OnClick = grpTextStyleClick object chkLightStyle: TRzCheckBox Left = 8 Top = 36 Width = 79 Height = 15 Caption = 'Light Style' HotTrack = True State = cbUnchecked TabOrder = 0 OnClick = chkLightStyleClick end end object edtFontColor: TRzColorEdit Left = 44 Top = 92 Width = 97 Height = 21 CustomColors = RzCustomColors1 DefaultColor = clWindowText SelectedColor = clWindowText ShowCustomColor = True ShowDefaultColor = True ShowSystemColors = True FlatButtons = True FrameVisible = True TabOrder = 2 OnChange = edtFontColorChange end end object tabOptions: TRzTabSheet Caption = 'Options' ExplicitLeft = 0 ExplicitTop = 0 ExplicitWidth = 0 ExplicitHeight = 0 object grpShadow: TRzGroupBox Left = 8 Top = 8 Width = 293 Height = 101 Caption = 'Options' ParentColor = True TabOrder = 0 object Label4: TRzLabel Left = 8 Top = 58 Width = 80 Height = 13 Caption = 'Shadow Color' ParentColor = False end object Label5: TRzLabel Left = 160 Top = 16 Width = 83 Height = 13 Alignment = taCenter Caption = 'Shadow Depth' ParentColor = False WordWrap = True end object Label7: TRzLabel Left = 8 Top = 16 Width = 84 Height = 13 Caption = 'Highlight Color' ParentColor = False end object LblShadowDepth: TRzLabel Left = 212 Top = 76 Width = 14 Height = 13 Alignment = taCenter Caption = '00' ParentColor = False end object trkShadow: TRzTrackBar Left = 160 Top = 44 Width = 125 Height = 29 Max = 20 Position = 0 ShowTicks = False TrackOffset = 10 OnChange = trkShadowChange Enabled = False TabOrder = 2 end object edtHighlightColor: TRzColorEdit Left = 8 Top = 32 Width = 121 Height = 21 CustomColors = RzCustomColors1 DefaultColor = clBtnHighlight SelectedColor = clBtnHighlight ShowCustomColor = True ShowDefaultColor = True ShowSystemColors = True FlatButtons = True FrameVisible = True TabOrder = 0 OnChange = edtHighlightColorChange end object edtShadowColor: TRzColorEdit Left = 8 Top = 72 Width = 121 Height = 21 CustomColors = RzCustomColors1 DefaultColor = clBtnShadow SelectedColor = clBtnShadow ShowCustomColor = True ShowDefaultColor = True ShowSystemColors = True FlatButtons = True FrameVisible = True TabOrder = 1 OnChange = edtShadowColorChange end end object grpRotation: TRzGroupBox Left = 8 Top = 116 Width = 293 Height = 89 Caption = 'Rotation' ParentColor = True TabOrder = 1 object lblAngle: TRzLabel Left = 232 Top = 61 Width = 25 Height = 13 Alignment = taCenter AutoSize = False Caption = '0'#176 ParentColor = False end object btnNone: TSpeedButton Left = 131 Top = 12 Width = 30 Height = 23 Hint = 'No Rotation' GroupIndex = 1 Down = True Glyph.Data = { 4E010000424D4E01000000000000760000002800000012000000120000000100 040000000000D800000000000000000000001000000010000000000000000000 80000080000000808000800000008000800080800000C0C0C000808080000000 FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777 7777770000007777777777777777770000007777777777777777770000007777 7777777777777700000077777777777777777700000077777777777777777700 0000844447444448784448000000447447447744744744000000447447447744 7447770000007444474477447447770000004774474477447447440000008444 8744444878444800000077777744777777777700000077777744777777777700 0000777777777777777777000000777777777777777777000000777777777777 777777000000777777777777777777000000} ParentShowHint = False ShowHint = True OnClick = BtnRotationClick end object btnFlat: TSpeedButton Tag = 1 Left = 161 Top = 12 Width = 30 Height = 23 Hint = 'Flat Rotation' GroupIndex = 1 Glyph.Data = { 4E010000424D4E01000000000000760000002800000012000000120000000100 040000000000D800000000000000000000001000000010000000000000000000 80000080000000808000800000008000800080800000C0C0C000808080000000 FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777 7777770000007774447777777777770000007784844777777777770000007484 7844777777777700000084784444777777777700000074484477447777777700 0000784447744447777777000000777777448744777777000000777774487744 7777770000007777444774487777770000007774484444474447770000007744 8774487444447700000077787777774487748700000077777777774477747700 0000777777777744777777000000777777777774447777000000777777777777 877777000000777777777777777777000000} ParentShowHint = False ShowHint = True OnClick = BtnRotationClick end object btnCurve: TSpeedButton Tag = 2 Left = 191 Top = 12 Width = 30 Height = 23 Hint = 'Curve Rotation' GroupIndex = 1 Glyph.Data = { 4E010000424D4E01000000000000760000002800000012000000120000000100 040000000000D800000000000000000000001000000010000000000000000000 80000080000000808000800000008000800080800000C0C0C000808080000000 FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00777777777777 7777770000007777777777777777770000007777777777777777770000007787 7777777777777700000074447777777777448700000084874477777774487700 0000747844777777847777000000474447444447848774000000478447447744 7448440000007444774477447744470000007777774477447777770000007777 7744774477777700000077777744444777777700000077777744777777777700 0000777777447777777777000000777777777777777777000000777777777777 777777000000777777777777777777000000} ParentShowHint = False ShowHint = True OnClick = BtnRotationClick end object trkAngle: TRzTrackBar Left = 8 Top = 44 Width = 217 Max = 360 Position = 0 TickStyle = tkOwnerDraw OnChange = trkAngleChange OnDrawTick = trkAngleDrawTick TabOrder = 1 end object chk15Degrees: TRzCheckBox Left = 9 Top = 16 Width = 98 Height = 15 Caption = 'Restrict Angle' HotTrack = True State = cbUnchecked TabOrder = 0 OnClick = chk15DegreesClick end object optUpperLeft: TRzRadioButton Left = 234 Top = 10 Width = 19 Height = 15 Hint = 'Set Center Point' HotTrack = True ParentShowHint = False ShowHint = True TabOrder = 2 OnClick = OptCenterPointClick end object optUpperCenter: TRzRadioButton Tag = 1 Left = 250 Top = 10 Width = 19 Height = 15 Hint = 'Set Center Point' HotTrack = True ParentShowHint = False ShowHint = True TabOrder = 3 OnClick = OptCenterPointClick end object optUpperRight: TRzRadioButton Tag = 2 Left = 266 Top = 10 Width = 19 Height = 15 Hint = 'Set Center Point' HotTrack = True ParentShowHint = False ShowHint = True TabOrder = 4 OnClick = OptCenterPointClick end object optLeftCenter: TRzRadioButton Tag = 3 Left = 234 Top = 25 Width = 19 Height = 15 Hint = 'Set Center Point' HotTrack = True ParentShowHint = False ShowHint = True TabOrder = 5 OnClick = OptCenterPointClick end object optCenter: TRzRadioButton Tag = 4 Left = 250 Top = 25 Width = 19 Height = 15 Hint = 'Set Center Point' Checked = True HotTrack = True ParentShowHint = False ShowHint = True TabOrder = 6 TabStop = True OnClick = OptCenterPointClick end object optRightCenter: TRzRadioButton Tag = 5 Left = 266 Top = 25 Width = 19 Height = 15 Hint = 'Set Center Point' HotTrack = True ParentShowHint = False ShowHint = True TabOrder = 7 OnClick = OptCenterPointClick end object optLowerLeft: TRzRadioButton Tag = 6 Left = 234 Top = 40 Width = 19 Height = 15 Hint = 'Set Center Point' HotTrack = True ParentShowHint = False ShowHint = True TabOrder = 8 OnClick = OptCenterPointClick end object optLowerCenter: TRzRadioButton Tag = 7 Left = 250 Top = 40 Width = 19 Height = 15 Hint = 'Set Center Point' HotTrack = True ParentShowHint = False ShowHint = True TabOrder = 9 OnClick = OptCenterPointClick end object optLowerRight: TRzRadioButton Tag = 8 Left = 266 Top = 40 Width = 19 Height = 15 Hint = 'Set Center Point' HotTrack = True ParentShowHint = False ShowHint = True TabOrder = 10 OnClick = OptCenterPointClick end end end end object RzRegIniFile1: TRzRegIniFile PathType = ptRegistry Left = 12 Top = 340 end object RzCustomColors1: TRzCustomColors Colors.Strings = ( 'ColorA=FFFFFF' 'ColorB=FFFFFF' 'ColorC=FFFFFF' 'ColorD=FFFFFF' 'ColorE=FFFFFF' 'ColorF=FFFFFF' 'ColorG=FFFFFF' 'ColorH=FFFFFF' 'ColorI=FFFFFF' 'ColorJ=FFFFFF' 'ColorK=FFFFFF' 'ColorL=FFFFFF' 'ColorM=FFFFFF' 'ColorN=FFFFFF' 'ColorO=FFFFFF' 'ColorP=FFFFFF') RegIniFile = RzRegIniFile1 Left = 48 Top = 340 end end
27.241653
76
0.554888
615930e11943c79c4bed0cde34d9dcda31bf7d14
65,214
pas
Pascal
BaiduMapSDK/iOSapi.BaiduMapAPI_Search.pas
arvanus/FMXComponents
f04d62ccf452d085cb638b552bc758730dfd8518
[ "MIT" ]
343
2017-01-19T06:56:01.000Z
2022-03-30T16:01:15.000Z
BaiduMapSDK/iOSapi.BaiduMapAPI_Search.pas
HemulGM/FMXComponents
ec4f6ab16d8e48c248ede799581b2d793504344a
[ "MIT" ]
21
2017-02-20T18:38:13.000Z
2021-12-19T06:27:25.000Z
BaiduMapSDK/iOSapi.BaiduMapAPI_Search.pas
HemulGM/FMXComponents
ec4f6ab16d8e48c248ede799581b2d793504344a
[ "MIT" ]
107
2017-02-07T12:31:37.000Z
2022-03-03T00:53:11.000Z
{ *********************************************************** } { } { CodeGear Delphi Runtime Library } { } { Copyright(c) 2012-2014 Embarcadero Technologies, Inc. } { } { *********************************************************** } // // Delphi-Objective-C Bridge // Interfaces for Cocoa framework BaiduMapAPI_Search // unit iOSapi.BaiduMapAPI_Search; interface uses Macapi.CoreFoundation, Macapi.CoreServices, Macapi.Dispatch, Macapi.Mach, Macapi.ObjCRuntime, Macapi.ObjectiveC, iOSapi.BaiduMapAPI_Base, iOSapi.CocoaTypes, iOSapi.CoreGraphics, iOSapi.CoreLocation, iOSapi.Foundation; const BMKInvalidCoordinate = -1; BMKCarTrafficFIRST = 60; BMKCarTimeFirst = 0; BMKCarDisFirst = 1; BMKCarFeeFirst = 2; BMKBusTimeFirst = 3; BMKBusTransferFirst = 4; BMKBusWalkFirst = 5; BMKBusNoSubway = 6; BMKTypeCityList = 7; BMKTypePoiList = 11; BMKTypeAreaPoiList = 21; BMKTypeAreaMultiPoiList = 45; BMK_BUSLINE = 0; BMK_SUBWAY = 1; BMK_WAKLING = 2; BMK_TRANSIT_SUBWAY = 0; BMK_TRANSIT_TRAIN = 1; BMK_TRANSIT_PLANE = 2; BMK_TRANSIT_BUSLINE = 3; BMK_TRANSIT_DRIVING = 4; BMK_TRANSIT_WAKLING = 5; BMK_TRANSIT_COACH = 6; BMK_INDOOR_STEP_NODE_TYPE_ELEVATOR = 1; BMK_INDOOR_STEP_NODE_TYPE_ESCALATOR = 2; BMK_INDOOR_STEP_NODE_TYPE_STAIR = 3; BMK_INDOOR_STEP_NODE_TYPE_SECURITY_CHECK = 4; BMK_TRANSIT_TIME_FIRST = 3; BMK_TRANSIT_TRANSFER_FIRST = 4; BMK_TRANSIT_WALK_FIRST = 5; BMK_TRANSIT_NO_SUBWAY = 6; BMK_MASS_TRANSIT_INCITY_RECOMMEND = 0; BMK_MASS_TRANSIT_INCITY_TRANSFER_FIRST = 1; BMK_MASS_TRANSIT_INCITY_WALK_FIRST = 2; BMK_MASS_TRANSIT_INCITY_NO_SUBWAY = 3; BMK_MASS_TRANSIT_INCITY_TIME_FIRST = 4; BMK_MASS_TRANSIT_INCITY_SUBWAY_FIRST = 5; BMK_MASS_TRANSIT_INTERCITY_TIME_FIRST = 0; BMK_MASS_TRANSIT_INTERCITY_START_EARLY = 1; BMK_MASS_TRANSIT_INTERCITY_PRICE_FIRST = 2; BMK_MASS_TRANSIT_INTERCITY_TRANS_TRAIN_FIRST = 0; BMK_MASS_TRANSIT_INTERCITY_TRANS_PLANE_FIRST = 1; BMK_MASS_TRANSIT_INTERCITY_TRANS_BUS_FIRST = 2; BMK_DRIVING_BLK_FIRST = -1; BMK_DRIVING_TIME_FIRST = 0; BMK_DRIVING_DIS_FIRST = 1; BMK_DRIVING_FEE_FIRST = 2; BMK_DRIVING_REQUEST_TRAFFICE_TYPE_NONE = 0; BMK_DRIVING_REQUEST_TRAFFICE_TYPE_PATH_AND_TRAFFICE = 1; BMK_POI_SORT_BY_COMPOSITE = 0; BMK_POI_SORT_BY_DISTANCE = 1; BMK_ROUTE_PLAN_SHARE_URL_TYPE_DRIVE = 0; BMK_ROUTE_PLAN_SHARE_URL_TYPE_WALK = 1; BMK_ROUTE_PLAN_SHARE_URL_TYPE_RIDE = 2; BMK_ROUTE_PLAN_SHARE_URL_TYPE_TRANSIT = 3; type // ===== Forward declarations ===== {$M+} BMKCityListInfo = interface; BMKPoiInfo = interface; BMKPoiAddressInfo = interface; BMKPoiResult = interface; BMKPoiDetailResult = interface; BMKPoiIndoorInfo = interface; BMKPoiIndoorResult = interface; BMKBusLineSearchOption = interface; BMKTaxiInfo = interface; BMKVehicleInfo = interface; BMKTime = interface; BMKRouteNode = interface; BMKBusStation = interface; BMKRouteStep = interface; BMKBusStep = interface; BMKTransitStep = interface; BMKBaseVehicleInfo = interface; BMKBusVehicleInfo = interface; BMKPlaneVehicleInfo = interface; BMKTrainVehicleInfo = interface; BMKCoachVehicleInfo = interface; BMKMassTransitStep = interface; BMKMassTransitSubStep = interface; BMKDrivingStep = interface; BMKIndoorStepNode = interface; BMKIndoorRouteStep = interface; BMKWalkingStep = interface; BMKRidingStep = interface; BMKRouteLine = interface; BMKTransitRouteLine = interface; BMKMassTransitRouteLine = interface; BMKIndoorRouteLine = interface; BMKDrivingRouteLine = interface; BMKWalkingRouteLine = interface; BMKRidingRouteLine = interface; BMKSuggestAddrInfo = interface; BMKBusLineResult = interface; BMKWalkingRouteResult = interface; BMKDrivingRouteResult = interface; BMKTransitRouteResult = interface; BMKMassTransitRouteResult = interface; BMKRidingRouteResult = interface; BMKIndoorRouteResult = interface; BMKSearchBase = interface; BMKBusLineSearchDelegate = interface; BMKBusLineSearch = interface; BMKDistrictSearchOption = interface; BMKDistrictResult = interface; BMKDistrictSearchDelegate = interface; BMKDistrictSearch = interface; BMKGeoCodeSearchOption = interface; BMKReverseGeoCodeOption = interface; BMKReverseGeoCodeResult = interface; BMKGeoCodeResult = interface; BMKGeoCodeSearchDelegate = interface; BMKGeoCodeSearch = interface; BMKBasePoiSearchOption = interface; BMKCitySearchOption = interface; BMKNearbySearchOption = interface; BMKBoundSearchOption = interface; BMKPoiIndoorSearchOption = interface; BMKPoiDetailSearchOption = interface; BMKPoiSearchDelegate = interface; BMKPoiSearch = interface; BMKBaseRoutePlanOption = interface; BMKWalkingRoutePlanOption = interface; BMKDrivingRoutePlanOption = interface; BMKTransitRoutePlanOption = interface; BMKMassTransitRoutePlanOption = interface; BMKRidingRoutePlanOption = interface; BMKIndoorRoutePlanOption = interface; BMKRouteSearchDelegate = interface; BMKRouteSearch = interface; BMKPoiDetailShareURLOption = interface; BMKLocationShareURLOption = interface; BMKRoutePlanShareURLOption = interface; BMKShareURLResult = interface; BMKShareURLSearchDelegate = interface; BMKShareURLSearch = interface; BMKSuggestionSearchOption = interface; BMKSuggestionResult = interface; BMKSuggestionSearchDelegate = interface; BMKSuggestionSearch = interface; // ===== Framework typedefs ===== {$M+} CLLocationDegrees = Double; CLLocationCoordinate2D = record latitude: CLLocationDegrees; longitude: CLLocationDegrees; end; PCLLocationCoordinate2D = ^CLLocationCoordinate2D; NSInteger = Integer; BMKTransitStepType = Cardinal; BMKMassTransitType = Cardinal; BMKIndoorStepNodeType = Cardinal; BMKTransitPolicy = Cardinal; BMKMassTransitIncityPolicy = Cardinal; BMKMassTransitIntercityPolicy = Cardinal; BMKMassTransitIntercityTransPolicy = Cardinal; BMKDrivingPolicy = Integer; BMKDrivingRequestTrafficType = Cardinal; CGFloat = Single; BMKSearchErrorCode = Cardinal; BMKPoiSortType = Cardinal; NSUInteger = Cardinal; BMKRoutePlanShareURLType = Cardinal; // ===== Interface declarations ===== BMKCityListInfoClass = interface(NSObjectClass) ['{1B6F00C5-2073-4F85-A0B9-084F2BE555C9}'] end; BMKCityListInfo = interface(NSObject) ['{F308DA60-F6F5-49D4-9BCA-847984325112}'] procedure setCity(city: NSString); cdecl; function city: NSString; cdecl; procedure setNum(num: Integer); cdecl; function num: Integer; cdecl; end; TBMKCityListInfo = class(TOCGenericImport<BMKCityListInfoClass, BMKCityListInfo>) end; PBMKCityListInfo = Pointer; BMKPoiInfoClass = interface(NSObjectClass) ['{73B3EE23-BC0C-4211-B08D-F78312A293A6}'] end; BMKPoiInfo = interface(NSObject) ['{02046AA2-86A4-4709-B8FB-38A9D7476CCD}'] procedure setName(name: NSString); cdecl; function name: NSString; cdecl; procedure setUid(uid: NSString); cdecl; function uid: NSString; cdecl; procedure setAddress(address: NSString); cdecl; function address: NSString; cdecl; procedure setCity(city: NSString); cdecl; function city: NSString; cdecl; procedure setPhone(phone: NSString); cdecl; function phone: NSString; cdecl; procedure setPostcode(postcode: NSString); cdecl; function postcode: NSString; cdecl; procedure setEpoitype(epoitype: Integer); cdecl; function epoitype: Integer; cdecl; procedure setPt(pt: CLLocationCoordinate2D); cdecl; function pt: CLLocationCoordinate2D; cdecl; procedure setPanoFlag(panoFlag: Boolean); cdecl; function panoFlag: Boolean; cdecl; end; TBMKPoiInfo = class(TOCGenericImport<BMKPoiInfoClass, BMKPoiInfo>) end; PBMKPoiInfo = Pointer; BMKPoiAddressInfoClass = interface(NSObjectClass) ['{75BF3187-2B4D-4E18-A4B6-1D9B176EA6A5}'] end; BMKPoiAddressInfo = interface(NSObject) ['{35236D0B-1CF4-4D34-8EF3-3BA41D7ADE13}'] procedure setName(name: NSString); cdecl; function name: NSString; cdecl; procedure setAddress(address: NSString); cdecl; function address: NSString; cdecl; procedure setPt(pt: CLLocationCoordinate2D); cdecl; function pt: CLLocationCoordinate2D; cdecl; end; TBMKPoiAddressInfo = class(TOCGenericImport<BMKPoiAddressInfoClass, BMKPoiAddressInfo>) end; PBMKPoiAddressInfo = Pointer; BMKPoiResultClass = interface(NSObjectClass) ['{E43CD791-3942-403A-85E3-C9A4E5B0A9E4}'] end; BMKPoiResult = interface(NSObject) ['{4EDE6F59-F544-455B-BEBE-3D6F98D825B2}'] procedure setTotalPoiNum(totalPoiNum: Integer); cdecl; function totalPoiNum: Integer; cdecl; procedure setCurrPoiNum(currPoiNum: Integer); cdecl; function currPoiNum: Integer; cdecl; procedure setPageNum(pageNum: Integer); cdecl; function pageNum: Integer; cdecl; procedure setPageIndex(pageIndex: Integer); cdecl; function pageIndex: Integer; cdecl; procedure setPoiInfoList(poiInfoList: NSArray); cdecl; function poiInfoList: NSArray; cdecl; procedure setCityList(cityList: NSArray); cdecl; function cityList: NSArray; cdecl; procedure setIsHavePoiAddressInfoList(isHavePoiAddressInfoList : Boolean); cdecl; function isHavePoiAddressInfoList: Boolean; cdecl; procedure setPoiAddressInfoList(poiAddressInfoList: NSArray); cdecl; function poiAddressInfoList: NSArray; cdecl; end; TBMKPoiResult = class(TOCGenericImport<BMKPoiResultClass, BMKPoiResult>) end; PBMKPoiResult = Pointer; BMKPoiDetailResultClass = interface(NSObjectClass) ['{691FF3D2-90A5-46E1-A985-E11086B5EF18}'] end; BMKPoiDetailResult = interface(NSObject) ['{C7D3384C-DC06-45CC-93D9-5DAD7A70D95F}'] procedure setName(name: NSString); cdecl; function name: NSString; cdecl; procedure setAddress(address: NSString); cdecl; function address: NSString; cdecl; procedure setPhone(phone: NSString); cdecl; function phone: NSString; cdecl; procedure setUid(uid: NSString); cdecl; function uid: NSString; cdecl; procedure setTag(tag: NSString); cdecl; function tag: NSString; cdecl; procedure setDetailUrl(detailUrl: NSString); cdecl; function detailUrl: NSString; cdecl; procedure setType(&type: NSString); cdecl; function &type: NSString; cdecl; procedure setPt(pt: CLLocationCoordinate2D); cdecl; function pt: CLLocationCoordinate2D; cdecl; procedure setPrice(price: Double); cdecl; function price: Double; cdecl; procedure setOverallRating(overallRating: Double); cdecl; function overallRating: Double; cdecl; procedure setTasteRating(tasteRating: Double); cdecl; function tasteRating: Double; cdecl; procedure setServiceRating(serviceRating: Double); cdecl; function serviceRating: Double; cdecl; procedure setEnvironmentRating(environmentRating: Double); cdecl; function environmentRating: Double; cdecl; procedure setFacilityRating(facilityRating: Double); cdecl; function facilityRating: Double; cdecl; procedure setHygieneRating(hygieneRating: Double); cdecl; function hygieneRating: Double; cdecl; procedure setTechnologyRating(technologyRating: Double); cdecl; function technologyRating: Double; cdecl; procedure setImageNum(imageNum: Integer); cdecl; function imageNum: Integer; cdecl; procedure setGrouponNum(grouponNum: Integer); cdecl; function grouponNum: Integer; cdecl; procedure setCommentNum(commentNum: Integer); cdecl; function commentNum: Integer; cdecl; procedure setFavoriteNum(favoriteNum: Integer); cdecl; function favoriteNum: Integer; cdecl; procedure setCheckInNum(checkInNum: Integer); cdecl; function checkInNum: Integer; cdecl; procedure setShopHours(shopHours: NSString); cdecl; function shopHours: NSString; cdecl; end; TBMKPoiDetailResult = class(TOCGenericImport<BMKPoiDetailResultClass, BMKPoiDetailResult>) end; PBMKPoiDetailResult = Pointer; BMKPoiIndoorInfoClass = interface(NSObjectClass) ['{C432D06F-D34E-4E2D-8C04-C070A394F0EB}'] end; BMKPoiIndoorInfo = interface(NSObject) ['{1A98AA78-2F5E-484C-B729-7719F32B83A3}'] procedure setName(name: NSString); cdecl; function name: NSString; cdecl; procedure setUid(uid: NSString); cdecl; function uid: NSString; cdecl; procedure setIndoorId(indoorId: NSString); cdecl; function indoorId: NSString; cdecl; procedure setFloor(floor: NSString); cdecl; function floor: NSString; cdecl; procedure setAddress(address: NSString); cdecl; function address: NSString; cdecl; procedure setCity(city: NSString); cdecl; function city: NSString; cdecl; procedure setPhone(phone: NSString); cdecl; function phone: NSString; cdecl; procedure setPt(pt: CLLocationCoordinate2D); cdecl; function pt: CLLocationCoordinate2D; cdecl; procedure setTag(tag: NSString); cdecl; function tag: NSString; cdecl; procedure setPrice(price: Double); cdecl; function price: Double; cdecl; procedure setStarLevel(starLevel: NSInteger); cdecl; function starLevel: NSInteger; cdecl; procedure setGrouponFlag(grouponFlag: Boolean); cdecl; function grouponFlag: Boolean; cdecl; procedure setTakeoutFlag(takeoutFlag: Boolean); cdecl; function takeoutFlag: Boolean; cdecl; procedure setWaitedFlag(waitedFlag: Boolean); cdecl; function waitedFlag: Boolean; cdecl; procedure setGrouponNum(grouponNum: NSInteger); cdecl; function grouponNum: NSInteger; cdecl; end; TBMKPoiIndoorInfo = class(TOCGenericImport<BMKPoiIndoorInfoClass, BMKPoiIndoorInfo>) end; PBMKPoiIndoorInfo = Pointer; BMKPoiIndoorResultClass = interface(NSObjectClass) ['{9ED96363-57F3-478A-98DE-65A441A05A05}'] end; BMKPoiIndoorResult = interface(NSObject) ['{77219775-B85D-4788-B837-0CC647347277}'] procedure setTotalPoiNum(totalPoiNum: NSInteger); cdecl; function totalPoiNum: NSInteger; cdecl; procedure setCurrPoiNum(currPoiNum: NSInteger); cdecl; function currPoiNum: NSInteger; cdecl; procedure setPageNum(pageNum: NSInteger); cdecl; function pageNum: NSInteger; cdecl; procedure setPageIndex(pageIndex: Integer); cdecl; function pageIndex: Integer; cdecl; procedure setPoiIndoorInfoList(poiIndoorInfoList: NSArray); cdecl; function poiIndoorInfoList: NSArray; cdecl; end; TBMKPoiIndoorResult = class(TOCGenericImport<BMKPoiIndoorResultClass, BMKPoiIndoorResult>) end; PBMKPoiIndoorResult = Pointer; BMKBusLineSearchOptionClass = interface(NSObjectClass) ['{9259872F-24BE-40B3-B444-5C9292441566}'] end; BMKBusLineSearchOption = interface(NSObject) ['{EDAD1353-E19A-43F6-9A75-BED7C952B46F}'] procedure setCity(city: NSString); cdecl; function city: NSString; cdecl; procedure setBusLineUid(busLineUid: NSString); cdecl; function busLineUid: NSString; cdecl; end; TBMKBusLineSearchOption = class(TOCGenericImport<BMKBusLineSearchOptionClass, BMKBusLineSearchOption>) end; PBMKBusLineSearchOption = Pointer; BMKTaxiInfoClass = interface(NSObjectClass) ['{4942AD57-3924-46E9-8286-BD27E4745586}'] end; BMKTaxiInfo = interface(NSObject) ['{95D029C4-2C53-4D3F-8E1A-FF03F64493B4}'] procedure setDesc(desc: NSString); cdecl; function desc: NSString; cdecl; procedure setDistance(distance: Integer); cdecl; function distance: Integer; cdecl; procedure setDuration(duration: Integer); cdecl; function duration: Integer; cdecl; procedure setPerKMPrice(perKMPrice: CGFloat); cdecl; function perKMPrice: CGFloat; cdecl; procedure setStartPrice(startPrice: CGFloat); cdecl; function startPrice: CGFloat; cdecl; procedure setTotalPrice(totalPrice: Integer); cdecl; function totalPrice: Integer; cdecl; end; TBMKTaxiInfo = class(TOCGenericImport<BMKTaxiInfoClass, BMKTaxiInfo>) end; PBMKTaxiInfo = Pointer; BMKVehicleInfoClass = interface(NSObjectClass) ['{008FF8F7-5F82-4C88-8271-F98F574E4AB3}'] end; BMKVehicleInfo = interface(NSObject) ['{53A7A934-907F-4895-A769-4A8435FC463D}'] procedure setUid(uid: NSString); cdecl; function uid: NSString; cdecl; procedure setTitle(title: NSString); cdecl; function title: NSString; cdecl; procedure setPassStationNum(passStationNum: Integer); cdecl; function passStationNum: Integer; cdecl; procedure setTotalPrice(totalPrice: Integer); cdecl; function totalPrice: Integer; cdecl; procedure setZonePrice(zonePrice: Integer); cdecl; function zonePrice: Integer; cdecl; end; TBMKVehicleInfo = class(TOCGenericImport<BMKVehicleInfoClass, BMKVehicleInfo>) end; PBMKVehicleInfo = Pointer; BMKTimeClass = interface(NSObjectClass) ['{BFC1AC7E-4DA9-4C88-8CBC-B8309E91FE8B}'] end; BMKTime = interface(NSObject) ['{3F0E6F39-C226-4A3B-BF92-72297EE48979}'] procedure setDates(dates: Integer); cdecl; function dates: Integer; cdecl; procedure setHours(hours: Integer); cdecl; function hours: Integer; cdecl; procedure setMinutes(minutes: Integer); cdecl; function minutes: Integer; cdecl; procedure setSeconds(seconds: Integer); cdecl; function seconds: Integer; cdecl; end; TBMKTime = class(TOCGenericImport<BMKTimeClass, BMKTime>) end; PBMKTime = Pointer; BMKRouteNodeClass = interface(NSObjectClass) ['{E69CCE44-0518-4421-9B41-786688800DED}'] end; BMKRouteNode = interface(NSObject) ['{11968B80-2F9C-4C40-819B-622771725C97}'] procedure setUid(uid: NSString); cdecl; function uid: NSString; cdecl; procedure setTitle(title: NSString); cdecl; function title: NSString; cdecl; procedure setLocation(location: CLLocationCoordinate2D); cdecl; function location: CLLocationCoordinate2D; cdecl; end; TBMKRouteNode = class(TOCGenericImport<BMKRouteNodeClass, BMKRouteNode>) end; PBMKRouteNode = Pointer; BMKBusStationClass = interface(BMKRouteNodeClass) ['{5387D732-E714-44BC-BF2E-8556F040B415}'] end; BMKBusStation = interface(BMKRouteNode) ['{F7296E0C-F108-4170-B2B3-4217C8EE398D}'] end; TBMKBusStation = class(TOCGenericImport<BMKBusStationClass, BMKBusStation>) end; PBMKBusStation = Pointer; BMKRouteStepClass = interface(NSObjectClass) ['{67895D6D-EE59-4CE1-AD36-8716DFA97AB9}'] end; BMKRouteStep = interface(NSObject) ['{AC1AB58A-5F29-46E4-AB09-FE3A04BC56F9}'] procedure setDistance(distance: Integer); cdecl; function distance: Integer; cdecl; procedure setDuration(duration: Integer); cdecl; function duration: Integer; cdecl; procedure setPoints(points: Pointer); cdecl; function points: Pointer; cdecl; procedure setPointsCount(pointsCount: Integer); cdecl; function pointsCount: Integer; cdecl; end; TBMKRouteStep = class(TOCGenericImport<BMKRouteStepClass, BMKRouteStep>) end; PBMKRouteStep = Pointer; BMKBusStepClass = interface(BMKRouteStepClass) ['{202E2E73-B1F2-4F1A-83A4-3D0935CE48E7}'] end; BMKBusStep = interface(BMKRouteStep) ['{07F9DAA0-3E46-47EE-8E09-40BFAF445BE0}'] end; TBMKBusStep = class(TOCGenericImport<BMKBusStepClass, BMKBusStep>) end; PBMKBusStep = Pointer; BMKTransitStepClass = interface(BMKRouteStepClass) ['{98A976EA-026F-47E8-A25A-7398BFD4AA27}'] end; BMKTransitStep = interface(BMKRouteStep) ['{678C33F9-2C05-470C-9975-4CB6ECD5E5F5}'] procedure setEntrace(entrace: BMKRouteNode); cdecl; function entrace: BMKRouteNode; cdecl; procedure setExit(exit: BMKRouteNode); cdecl; function exit: BMKRouteNode; cdecl; procedure setInstruction(instruction: NSString); cdecl; function instruction: NSString; cdecl; procedure setStepType(stepType: BMKTransitStepType); cdecl; function stepType: BMKTransitStepType; cdecl; procedure setVehicleInfo(vehicleInfo: BMKVehicleInfo); cdecl; function vehicleInfo: BMKVehicleInfo; cdecl; end; TBMKTransitStep = class(TOCGenericImport<BMKTransitStepClass, BMKTransitStep>) end; PBMKTransitStep = Pointer; BMKBaseVehicleInfoClass = interface(NSObjectClass) ['{BFEC0BF9-26D3-498C-BAB7-A5A03CD442E2}'] end; BMKBaseVehicleInfo = interface(NSObject) ['{3E102CE0-E19C-4FDC-8B53-8C60D6ECD587}'] procedure setName(name: NSString); cdecl; function name: NSString; cdecl; procedure setDepartureStation(departureStation: NSString); cdecl; function departureStation: NSString; cdecl; procedure setArriveStation(arriveStation: NSString); cdecl; function arriveStation: NSString; cdecl; procedure setDepartureTime(departureTime: NSString); cdecl; function departureTime: NSString; cdecl; procedure setArriveTime(arriveTime: NSString); cdecl; function arriveTime: NSString; cdecl; end; TBMKBaseVehicleInfo = class(TOCGenericImport<BMKBaseVehicleInfoClass, BMKBaseVehicleInfo>) end; PBMKBaseVehicleInfo = Pointer; BMKBusVehicleInfoClass = interface(BMKBaseVehicleInfoClass) ['{223BC2C0-F537-4D44-8FA5-6B8D6000CB3C}'] end; BMKBusVehicleInfo = interface(BMKBaseVehicleInfo) ['{0751CDA3-5015-4628-9803-4A743D174DAD}'] procedure setPassStationNum(passStationNum: NSInteger); cdecl; function passStationNum: NSInteger; cdecl; procedure setFirstTime(firstTime: NSString); cdecl; function firstTime: NSString; cdecl; procedure setLastTime(lastTime: NSString); cdecl; function lastTime: NSString; cdecl; end; TBMKBusVehicleInfo = class(TOCGenericImport<BMKBusVehicleInfoClass, BMKBusVehicleInfo>) end; PBMKBusVehicleInfo = Pointer; BMKPlaneVehicleInfoClass = interface(BMKBaseVehicleInfoClass) ['{CACABA1E-F447-48DB-BCF9-6539260BBFE5}'] end; BMKPlaneVehicleInfo = interface(BMKBaseVehicleInfo) ['{4C57A89C-7481-4797-9DE1-7F761292348C}'] procedure setPrice(price: CGFloat); cdecl; function price: CGFloat; cdecl; procedure setDiscount(discount: CGFloat); cdecl; function discount: CGFloat; cdecl; procedure setAirlines(airlines: NSString); cdecl; function airlines: NSString; cdecl; procedure setBookingUrl(bookingUrl: NSString); cdecl; function bookingUrl: NSString; cdecl; end; TBMKPlaneVehicleInfo = class(TOCGenericImport<BMKPlaneVehicleInfoClass, BMKPlaneVehicleInfo>) end; PBMKPlaneVehicleInfo = Pointer; BMKTrainVehicleInfoClass = interface(BMKBaseVehicleInfoClass) ['{17B972DF-91C0-435A-9610-D323305626FC}'] end; BMKTrainVehicleInfo = interface(BMKBaseVehicleInfo) ['{8C1DC5FB-8474-4F1A-8319-1CB9D4768EAC}'] procedure setPrice(price: CGFloat); cdecl; function price: CGFloat; cdecl; procedure setBooking(booking: NSString); cdecl; function booking: NSString; cdecl; end; TBMKTrainVehicleInfo = class(TOCGenericImport<BMKTrainVehicleInfoClass, BMKTrainVehicleInfo>) end; PBMKTrainVehicleInfo = Pointer; BMKCoachVehicleInfoClass = interface(BMKBaseVehicleInfoClass) ['{792F13F2-FEE2-4FFA-9E28-D114B6CCD90A}'] end; BMKCoachVehicleInfo = interface(BMKBaseVehicleInfo) ['{7AB48A12-2A41-4A43-A751-F1BE29B3881B}'] procedure setPrice(price: CGFloat); cdecl; function price: CGFloat; cdecl; procedure setBookingUrl(bookingUrl: NSString); cdecl; function bookingUrl: NSString; cdecl; procedure setProviderName(providerName: NSString); cdecl; function providerName: NSString; cdecl; procedure setProviderUrl(providerUrl: NSString); cdecl; function providerUrl: NSString; cdecl; end; TBMKCoachVehicleInfo = class(TOCGenericImport<BMKCoachVehicleInfoClass, BMKCoachVehicleInfo>) end; PBMKCoachVehicleInfo = Pointer; BMKMassTransitStepClass = interface(NSObjectClass) ['{C1D2EE4F-8922-455A-B404-9CF47D1C0A8C}'] end; BMKMassTransitStep = interface(NSObject) ['{1D03327D-682E-4C27-9052-8A25CC849CB6}'] procedure setIsSubStep(isSubStep: Boolean); cdecl; function isSubStep: Boolean; cdecl; procedure setSteps(steps: NSArray); cdecl; function steps: NSArray; cdecl; end; TBMKMassTransitStep = class(TOCGenericImport<BMKMassTransitStepClass, BMKMassTransitStep>) end; PBMKMassTransitStep = Pointer; BMKMassTransitSubStepClass = interface(BMKRouteStepClass) ['{667EFBED-2EF1-4E5B-99BB-4A5CADFBDBB2}'] end; BMKMassTransitSubStep = interface(BMKRouteStep) ['{78F7BD14-84D8-4DA0-8D61-9F7B68BB2FCF}'] procedure setEntraceCoor(entraceCoor: CLLocationCoordinate2D); cdecl; function entraceCoor: CLLocationCoordinate2D; cdecl; procedure setExitCoor(exitCoor: CLLocationCoordinate2D); cdecl; function exitCoor: CLLocationCoordinate2D; cdecl; procedure setInstructions(instructions: NSString); cdecl; function instructions: NSString; cdecl; procedure setStepType(stepType: BMKMassTransitType); cdecl; function stepType: BMKMassTransitType; cdecl; procedure setVehicleInfo(vehicleInfo: BMKBaseVehicleInfo); cdecl; function vehicleInfo: BMKBaseVehicleInfo; cdecl; end; TBMKMassTransitSubStep = class(TOCGenericImport<BMKMassTransitSubStepClass, BMKMassTransitSubStep>) end; PBMKMassTransitSubStep = Pointer; BMKDrivingStepClass = interface(BMKRouteStepClass) ['{D68F5933-EC7E-48BB-8D8C-5A92E3AAEA3D}'] end; BMKDrivingStep = interface(BMKRouteStep) ['{5FCF3E9F-1813-4D25-BE47-61250442154C}'] procedure setDirection(direction: Integer); cdecl; function direction: Integer; cdecl; procedure setEntrace(entrace: BMKRouteNode); cdecl; function entrace: BMKRouteNode; cdecl; procedure setEntraceInstruction(entraceInstruction: NSString); cdecl; function entraceInstruction: NSString; cdecl; procedure setExit(exit: BMKRouteNode); cdecl; function exit: BMKRouteNode; cdecl; procedure setExitInstruction(exitInstruction: NSString); cdecl; function exitInstruction: NSString; cdecl; procedure setInstruction(instruction: NSString); cdecl; function instruction: NSString; cdecl; procedure setNumTurns(numTurns: Integer); cdecl; function numTurns: Integer; cdecl; procedure setHasTrafficsInfo(hasTrafficsInfo: Boolean); cdecl; function hasTrafficsInfo: Boolean; cdecl; procedure setTraffics(traffics: NSArray); cdecl; function traffics: NSArray; cdecl; end; TBMKDrivingStep = class(TOCGenericImport<BMKDrivingStepClass, BMKDrivingStep>) end; PBMKDrivingStep = Pointer; BMKIndoorStepNodeClass = interface(NSObjectClass) ['{8FB65B3B-1AAB-4466-BA73-9D59147F1852}'] end; BMKIndoorStepNode = interface(NSObject) ['{B01936BF-BC0E-4216-8D67-535C0AA8F726}'] procedure setCoordinate(coordinate: CLLocationCoordinate2D); cdecl; function coordinate: CLLocationCoordinate2D; cdecl; procedure setType(&type: BMKIndoorStepNodeType); cdecl; function &type: BMKIndoorStepNodeType; cdecl; procedure setDesc(desc: NSString); cdecl; function desc: NSString; cdecl; end; TBMKIndoorStepNode = class(TOCGenericImport<BMKIndoorStepNodeClass, BMKIndoorStepNode>) end; PBMKIndoorStepNode = Pointer; BMKIndoorRouteStepClass = interface(BMKRouteStepClass) ['{C1CB507C-3D5E-4936-AE53-7148F9403391}'] end; BMKIndoorRouteStep = interface(BMKRouteStep) ['{DE310B92-088E-41C5-B590-0E252282216A}'] procedure setEntrace(entrace: BMKRouteNode); cdecl; function entrace: BMKRouteNode; cdecl; procedure setExit(exit: BMKRouteNode); cdecl; function exit: BMKRouteNode; cdecl; procedure setInstructions(instructions: NSString); cdecl; function instructions: NSString; cdecl; procedure setBuildingid(buildingid: NSString); cdecl; function buildingid: NSString; cdecl; procedure setFloorid(floorid: NSString); cdecl; function floorid: NSString; cdecl; procedure setIndoorStepNodes(indoorStepNodes: NSArray); cdecl; function indoorStepNodes: NSArray; cdecl; end; TBMKIndoorRouteStep = class(TOCGenericImport<BMKIndoorRouteStepClass, BMKIndoorRouteStep>) end; PBMKIndoorRouteStep = Pointer; BMKWalkingStepClass = interface(BMKRouteStepClass) ['{6F3052A3-01E1-4679-9605-D581127C42A1}'] end; BMKWalkingStep = interface(BMKRouteStep) ['{85D54FAB-982A-44DB-A7B4-3E3A6353EF65}'] procedure setDirection(direction: Integer); cdecl; function direction: Integer; cdecl; procedure setEntrace(entrace: BMKRouteNode); cdecl; function entrace: BMKRouteNode; cdecl; procedure setEntraceInstruction(entraceInstruction: NSString); cdecl; function entraceInstruction: NSString; cdecl; procedure setExit(exit: BMKRouteNode); cdecl; function exit: BMKRouteNode; cdecl; procedure setExitInstruction(exitInstruction: NSString); cdecl; function exitInstruction: NSString; cdecl; procedure setInstruction(instruction: NSString); cdecl; function instruction: NSString; cdecl; end; TBMKWalkingStep = class(TOCGenericImport<BMKWalkingStepClass, BMKWalkingStep>) end; PBMKWalkingStep = Pointer; BMKRidingStepClass = interface(BMKRouteStepClass) ['{27A1E755-0EFC-44B0-9D3F-2ED14A552C98}'] end; BMKRidingStep = interface(BMKRouteStep) ['{0D63A2EE-EAE3-40E7-B961-0FD82F218368}'] procedure setDirection(direction: NSInteger); cdecl; function direction: NSInteger; cdecl; procedure setEntrace(entrace: BMKRouteNode); cdecl; function entrace: BMKRouteNode; cdecl; procedure setEntraceInstruction(entraceInstruction: NSString); cdecl; function entraceInstruction: NSString; cdecl; procedure setExit(exit: BMKRouteNode); cdecl; function exit: BMKRouteNode; cdecl; procedure setExitInstruction(exitInstruction: NSString); cdecl; function exitInstruction: NSString; cdecl; procedure setInstruction(instruction: NSString); cdecl; function instruction: NSString; cdecl; end; TBMKRidingStep = class(TOCGenericImport<BMKRidingStepClass, BMKRidingStep>) end; PBMKRidingStep = Pointer; BMKRouteLineClass = interface(NSObjectClass) ['{A9D412D8-0DA2-4B66-839E-4EF269B2CBF0}'] end; BMKRouteLine = interface(NSObject) ['{F309CE6D-94A6-45E5-85D1-EC5EF10BA315}'] procedure setDistance(distance: Integer); cdecl; function distance: Integer; cdecl; procedure setDuration(duration: BMKTime); cdecl; function duration: BMKTime; cdecl; procedure setStarting(starting: BMKRouteNode); cdecl; function starting: BMKRouteNode; cdecl; procedure setTerminal(terminal: BMKRouteNode); cdecl; function terminal: BMKRouteNode; cdecl; procedure setTitle(title: NSString); cdecl; function title: NSString; cdecl; procedure setSteps(steps: NSArray); cdecl; function steps: NSArray; cdecl; end; TBMKRouteLine = class(TOCGenericImport<BMKRouteLineClass, BMKRouteLine>) end; PBMKRouteLine = Pointer; BMKTransitRouteLineClass = interface(BMKRouteLineClass) ['{E36E5017-348F-465D-9AC7-E32A0828B97C}'] end; BMKTransitRouteLine = interface(BMKRouteLine) ['{1759528E-03C4-48BD-A90D-DF19D2FEE708}'] end; TBMKTransitRouteLine = class(TOCGenericImport<BMKTransitRouteLineClass, BMKTransitRouteLine>) end; PBMKTransitRouteLine = Pointer; BMKMassTransitRouteLineClass = interface(BMKRouteLineClass) ['{03F5D833-C208-4B8A-A72B-4F2B0885B049}'] end; BMKMassTransitRouteLine = interface(BMKRouteLine) ['{1D748096-41B5-485C-BFEE-E76A399BE09E}'] procedure setPrice(price: CGFloat); cdecl; function price: CGFloat; cdecl; end; TBMKMassTransitRouteLine = class (TOCGenericImport<BMKMassTransitRouteLineClass, BMKMassTransitRouteLine>) end; PBMKMassTransitRouteLine = Pointer; BMKIndoorRouteLineClass = interface(BMKRouteLineClass) ['{E62565B4-8E2D-44E7-A2EB-B20908D847C9}'] end; BMKIndoorRouteLine = interface(BMKRouteLine) ['{14F07764-7839-4737-9DC9-3018A723B7BF}'] end; TBMKIndoorRouteLine = class(TOCGenericImport<BMKIndoorRouteLineClass, BMKIndoorRouteLine>) end; PBMKIndoorRouteLine = Pointer; BMKDrivingRouteLineClass = interface(BMKRouteLineClass) ['{B3274412-FAD4-4971-A771-F95A175472CE}'] end; BMKDrivingRouteLine = interface(BMKRouteLine) ['{46AE2667-0E66-482E-BA01-BAFF791ADB9E}'] procedure setIsSupportTraffic(isSupportTraffic: Integer); cdecl; function isSupportTraffic: Integer; cdecl; procedure setWayPoints(wayPoints: NSArray); cdecl; function wayPoints: NSArray; cdecl; procedure setLightNum(lightNum: NSInteger); cdecl; function lightNum: NSInteger; cdecl; procedure setCongestionMetres(congestionMetres: NSInteger); cdecl; function congestionMetres: NSInteger; cdecl; procedure setTaxiFares(taxiFares: NSInteger); cdecl; function taxiFares: NSInteger; cdecl; end; TBMKDrivingRouteLine = class(TOCGenericImport<BMKDrivingRouteLineClass, BMKDrivingRouteLine>) end; PBMKDrivingRouteLine = Pointer; BMKWalkingRouteLineClass = interface(BMKRouteLineClass) ['{13AF356A-80EB-4CEC-8F02-3E4D2AA73D3A}'] end; BMKWalkingRouteLine = interface(BMKRouteLine) ['{BC4AEDAF-9388-43A7-8DA7-DFBC9C76CC35}'] end; TBMKWalkingRouteLine = class(TOCGenericImport<BMKWalkingRouteLineClass, BMKWalkingRouteLine>) end; PBMKWalkingRouteLine = Pointer; BMKRidingRouteLineClass = interface(BMKRouteLineClass) ['{F82A7586-C6A2-4501-A08D-E8405D343974}'] end; BMKRidingRouteLine = interface(BMKRouteLine) ['{5CF1C649-28AC-4672-8D29-69E85EDD0D27}'] end; TBMKRidingRouteLine = class(TOCGenericImport<BMKRidingRouteLineClass, BMKRidingRouteLine>) end; PBMKRidingRouteLine = Pointer; BMKSuggestAddrInfoClass = interface(NSObjectClass) ['{D4614B2B-E003-400E-BAFD-D073ED9EC99F}'] end; BMKSuggestAddrInfo = interface(NSObject) ['{978F1222-F7BF-4DCF-B132-308C3743AECC}'] procedure setStartPoiList(startPoiList: NSArray); cdecl; function startPoiList: NSArray; cdecl; procedure setStartCityList(startCityList: NSArray); cdecl; function startCityList: NSArray; cdecl; procedure setEndPoiList(endPoiList: NSArray); cdecl; function endPoiList: NSArray; cdecl; procedure setEndCityList(endCityList: NSArray); cdecl; function endCityList: NSArray; cdecl; procedure setWayPointPoiList(wayPointPoiList: NSArray); cdecl; function wayPointPoiList: NSArray; cdecl; procedure setWayPointCityList(wayPointCityList: NSArray); cdecl; function wayPointCityList: NSArray; cdecl; end; TBMKSuggestAddrInfo = class(TOCGenericImport<BMKSuggestAddrInfoClass, BMKSuggestAddrInfo>) end; PBMKSuggestAddrInfo = Pointer; BMKBusLineResultClass = interface(NSObjectClass) ['{D1DBD835-C2E5-462F-9D5B-4B85E7B123E5}'] end; BMKBusLineResult = interface(NSObject) ['{255ACA61-DFA2-4DC1-A5E1-AFFBACD01A2A}'] procedure setBusCompany(busCompany: NSString); cdecl; function busCompany: NSString; cdecl; procedure setBusLineName(busLineName: NSString); cdecl; function busLineName: NSString; cdecl; procedure setBusLineDirection(busLineDirection: NSString); cdecl; function busLineDirection: NSString; cdecl; procedure setUid(uid: NSString); cdecl; function uid: NSString; cdecl; procedure setStartTime(startTime: NSString); cdecl; function startTime: NSString; cdecl; procedure setEndTime(endTime: NSString); cdecl; function endTime: NSString; cdecl; procedure setIsMonTicket(isMonTicket: Integer); cdecl; function isMonTicket: Integer; cdecl; procedure setBasicPrice(basicPrice: CGFloat); cdecl; function basicPrice: CGFloat; cdecl; procedure setTotalPrice(totalPrice: CGFloat); cdecl; function totalPrice: CGFloat; cdecl; procedure setBusStations(busStations: NSArray); cdecl; function busStations: NSArray; cdecl; procedure setBusSteps(busSteps: NSArray); cdecl; function busSteps: NSArray; cdecl; end; TBMKBusLineResult = class(TOCGenericImport<BMKBusLineResultClass, BMKBusLineResult>) end; PBMKBusLineResult = Pointer; BMKWalkingRouteResultClass = interface(NSObjectClass) ['{5E206624-E89E-4325-B212-32E1C017C54A}'] end; BMKWalkingRouteResult = interface(NSObject) ['{211BB781-1E31-4EA7-AD21-1E704D0B8ACD}'] procedure setTaxiInfo(taxiInfo: BMKTaxiInfo); cdecl; function taxiInfo: BMKTaxiInfo; cdecl; procedure setSuggestAddrResult(suggestAddrResult : BMKSuggestAddrInfo); cdecl; function suggestAddrResult: BMKSuggestAddrInfo; cdecl; procedure setRoutes(routes: NSArray); cdecl; function routes: NSArray; cdecl; end; TBMKWalkingRouteResult = class(TOCGenericImport<BMKWalkingRouteResultClass, BMKWalkingRouteResult>) end; PBMKWalkingRouteResult = Pointer; BMKDrivingRouteResultClass = interface(NSObjectClass) ['{8B8C633B-DEC5-42EF-9B1B-E9D70E573B69}'] end; BMKDrivingRouteResult = interface(NSObject) ['{EB8F9C26-2FE3-4CC6-AB01-4392524D392A}'] procedure setTaxiInfo(taxiInfo: BMKTaxiInfo); cdecl; function taxiInfo: BMKTaxiInfo; cdecl; procedure setSuggestAddrResult(suggestAddrResult : BMKSuggestAddrInfo); cdecl; function suggestAddrResult: BMKSuggestAddrInfo; cdecl; procedure setRoutes(routes: NSArray); cdecl; function routes: NSArray; cdecl; end; TBMKDrivingRouteResult = class(TOCGenericImport<BMKDrivingRouteResultClass, BMKDrivingRouteResult>) end; PBMKDrivingRouteResult = Pointer; BMKTransitRouteResultClass = interface(NSObjectClass) ['{F454F137-9B4C-4CC3-A0B7-253F7A3F25E1}'] end; BMKTransitRouteResult = interface(NSObject) ['{BDFC6B28-348D-47D0-B1D1-8302245CB15E}'] procedure setTaxiInfo(taxiInfo: BMKTaxiInfo); cdecl; function taxiInfo: BMKTaxiInfo; cdecl; procedure setSuggestAddrResult(suggestAddrResult : BMKSuggestAddrInfo); cdecl; function suggestAddrResult: BMKSuggestAddrInfo; cdecl; procedure setRoutes(routes: NSArray); cdecl; function routes: NSArray; cdecl; end; TBMKTransitRouteResult = class(TOCGenericImport<BMKTransitRouteResultClass, BMKTransitRouteResult>) end; PBMKTransitRouteResult = Pointer; BMKMassTransitRouteResultClass = interface(NSObjectClass) ['{0456EEC2-2787-4079-A15A-79787A93BBD7}'] end; BMKMassTransitRouteResult = interface(NSObject) ['{07C56380-557F-4E93-9168-38A26D73089F}'] procedure setSuggestAddrResult(suggestAddrResult : BMKSuggestAddrInfo); cdecl; function suggestAddrResult: BMKSuggestAddrInfo; cdecl; procedure setRoutes(routes: NSArray); cdecl; function routes: NSArray; cdecl; procedure setTotalRoutes(totalRoutes: NSInteger); cdecl; function totalRoutes: NSInteger; cdecl; procedure setTaxiInfo(taxiInfo: BMKTaxiInfo); cdecl; function taxiInfo: BMKTaxiInfo; cdecl; end; TBMKMassTransitRouteResult = class (TOCGenericImport<BMKMassTransitRouteResultClass, BMKMassTransitRouteResult>) end; PBMKMassTransitRouteResult = Pointer; BMKRidingRouteResultClass = interface(NSObjectClass) ['{D11E5669-2CA6-4620-ABF4-107879FE9D16}'] end; BMKRidingRouteResult = interface(NSObject) ['{E83EF081-4269-48B5-A1AE-C0ADBDC3EFB2}'] procedure setSuggestAddrResult(suggestAddrResult : BMKSuggestAddrInfo); cdecl; function suggestAddrResult: BMKSuggestAddrInfo; cdecl; procedure setRoutes(routes: NSArray); cdecl; function routes: NSArray; cdecl; end; TBMKRidingRouteResult = class(TOCGenericImport<BMKRidingRouteResultClass, BMKRidingRouteResult>) end; PBMKRidingRouteResult = Pointer; BMKIndoorRouteResultClass = interface(NSObjectClass) ['{CBADAB3D-B360-4942-A816-92737570903D}'] end; BMKIndoorRouteResult = interface(NSObject) ['{2A161A84-7368-4CED-A852-DB4EEC0625F8}'] procedure setRoutes(routes: NSArray); cdecl; function routes: NSArray; cdecl; end; TBMKIndoorRouteResult = class(TOCGenericImport<BMKIndoorRouteResultClass, BMKIndoorRouteResult>) end; PBMKIndoorRouteResult = Pointer; BMKSearchBaseClass = interface(NSObjectClass) ['{6A957563-6794-4825-B047-423BD0A026F8}'] end; BMKSearchBase = interface(NSObject) ['{2831D8D4-F74A-4DCE-817F-577955186886}'] end; TBMKSearchBase = class(TOCGenericImport<BMKSearchBaseClass, BMKSearchBase>) end; PBMKSearchBase = Pointer; BMKBusLineSearchClass = interface(BMKSearchBaseClass) ['{A97C6C3A-3FC4-4FDA-A466-272F0471B284}'] end; BMKBusLineSearch = interface(BMKSearchBase) ['{0DA685B2-128E-41EF-AC31-75DAD3AE9F3C}'] procedure setDelegate(delegate: Pointer); cdecl; function delegate: Pointer; cdecl; function busLineSearch(busLineSearchOption: BMKBusLineSearchOption) : Boolean; cdecl; end; TBMKBusLineSearch = class(TOCGenericImport<BMKBusLineSearchClass, BMKBusLineSearch>) end; PBMKBusLineSearch = Pointer; BMKDistrictSearchOptionClass = interface(NSObjectClass) ['{2754CF48-E934-470A-8CFF-FE53CB97995B}'] end; BMKDistrictSearchOption = interface(NSObject) ['{B01EEA8B-F29A-422D-A47A-C63924227B16}'] procedure setCity(city: NSString); cdecl; function city: NSString; cdecl; procedure setDistrict(district: NSString); cdecl; function district: NSString; cdecl; end; TBMKDistrictSearchOption = class (TOCGenericImport<BMKDistrictSearchOptionClass, BMKDistrictSearchOption>) end; PBMKDistrictSearchOption = Pointer; BMKDistrictResultClass = interface(NSObjectClass) ['{83CDAE6B-087D-4B90-B25A-C1BCF4494E42}'] end; BMKDistrictResult = interface(NSObject) ['{7E2F4A4A-CF7D-4962-BDCC-0434D1E09201}'] procedure setCode(code: NSInteger); cdecl; function code: NSInteger; cdecl; procedure setName(name: NSString); cdecl; function name: NSString; cdecl; procedure setCenter(center: CLLocationCoordinate2D); cdecl; function center: CLLocationCoordinate2D; cdecl; procedure setPaths(paths: NSArray); cdecl; function paths: NSArray; cdecl; end; TBMKDistrictResult = class(TOCGenericImport<BMKDistrictResultClass, BMKDistrictResult>) end; PBMKDistrictResult = Pointer; BMKDistrictSearchClass = interface(BMKSearchBaseClass) ['{906B2005-2E2A-4B36-95E5-F626BA318296}'] end; BMKDistrictSearch = interface(BMKSearchBase) ['{770F512B-F57E-4B40-BAAB-CCA8C2C6B638}'] procedure setDelegate(delegate: Pointer); cdecl; function delegate: Pointer; cdecl; function districtSearch(districtSearchOption: BMKDistrictSearchOption) : Boolean; cdecl; end; TBMKDistrictSearch = class(TOCGenericImport<BMKDistrictSearchClass, BMKDistrictSearch>) end; PBMKDistrictSearch = Pointer; BMKGeoCodeSearchOptionClass = interface(NSObjectClass) ['{154C92CA-9A8A-4407-826C-AA4F7F694B3D}'] end; BMKGeoCodeSearchOption = interface(NSObject) ['{110DDE54-C02E-4E4F-9B94-CBEC925676D8}'] procedure setAddress(address: NSString); cdecl; function address: NSString; cdecl; procedure setCity(city: NSString); cdecl; function city: NSString; cdecl; end; TBMKGeoCodeSearchOption = class(TOCGenericImport<BMKGeoCodeSearchOptionClass, BMKGeoCodeSearchOption>) end; PBMKGeoCodeSearchOption = Pointer; BMKReverseGeoCodeOptionClass = interface(NSObjectClass) ['{4DDB7D72-28B5-4D25-B08F-F821131FEB37}'] end; BMKReverseGeoCodeOption = interface(NSObject) ['{2337C9A7-EE4F-48F6-917C-0396DD8437CF}'] procedure setReverseGeoPoint(reverseGeoPoint : CLLocationCoordinate2D); cdecl; function reverseGeoPoint: CLLocationCoordinate2D; cdecl; end; TBMKReverseGeoCodeOption = class (TOCGenericImport<BMKReverseGeoCodeOptionClass, BMKReverseGeoCodeOption>) end; PBMKReverseGeoCodeOption = Pointer; BMKReverseGeoCodeResultClass = interface(NSObjectClass) ['{68BC1B14-1213-4BCF-A180-8E7A8AB5C622}'] end; BMKReverseGeoCodeResult = interface(NSObject) ['{FE499D98-E9BE-44A5-A07C-1C7286BF3702}'] procedure setAddressDetail(addressDetail: BMKAddressComponent); cdecl; function addressDetail: BMKAddressComponent; cdecl; procedure setAddress(address: NSString); cdecl; function address: NSString; cdecl; procedure setBusinessCircle(businessCircle: NSString); cdecl; function businessCircle: NSString; cdecl; procedure setSematicDescription(sematicDescription: NSString); cdecl; function sematicDescription: NSString; cdecl; procedure setLocation(location: CLLocationCoordinate2D); cdecl; function location: CLLocationCoordinate2D; cdecl; procedure setPoiList(poiList: NSArray); cdecl; function poiList: NSArray; cdecl; end; TBMKReverseGeoCodeResult = class (TOCGenericImport<BMKReverseGeoCodeResultClass, BMKReverseGeoCodeResult>) end; PBMKReverseGeoCodeResult = Pointer; BMKGeoCodeResultClass = interface(NSObjectClass) ['{7F6030EF-2908-4612-BA45-BD7ECAEDD172}'] end; BMKGeoCodeResult = interface(NSObject) ['{5B0EA43E-1112-4211-BA57-D941B7F4B65A}'] procedure setLocation(location: CLLocationCoordinate2D); cdecl; function location: CLLocationCoordinate2D; cdecl; procedure setAddress(address: NSString); cdecl; function address: NSString; cdecl; end; TBMKGeoCodeResult = class(TOCGenericImport<BMKGeoCodeResultClass, BMKGeoCodeResult>) end; PBMKGeoCodeResult = Pointer; BMKGeoCodeSearchClass = interface(BMKSearchBaseClass) ['{899E8D31-A42B-4FEA-A4EE-0B7D688871C4}'] end; BMKGeoCodeSearch = interface(BMKSearchBase) ['{9B436D9F-5383-4EFB-8127-E35A5F621BFC}'] procedure setDelegate(delegate: Pointer); cdecl; function delegate: Pointer; cdecl; function geoCode(geoCodeOption: BMKGeoCodeSearchOption): Boolean; cdecl; function reverseGeoCode(reverseGeoCodeOption: BMKReverseGeoCodeOption) : Boolean; cdecl; end; TBMKGeoCodeSearch = class(TOCGenericImport<BMKGeoCodeSearchClass, BMKGeoCodeSearch>) end; PBMKGeoCodeSearch = Pointer; BMKBasePoiSearchOptionClass = interface(NSObjectClass) ['{AF7AA637-3BA4-47E4-B96E-00935DF859CA}'] end; BMKBasePoiSearchOption = interface(NSObject) ['{0E79A55D-CB43-4B61-A062-47DC85DB1070}'] procedure setKeyword(keyword: NSString); cdecl; function keyword: NSString; cdecl; procedure setPageIndex(pageIndex: Integer); cdecl; function pageIndex: Integer; cdecl; procedure setPageCapacity(pageCapacity: Integer); cdecl; function pageCapacity: Integer; cdecl; end; TBMKBasePoiSearchOption = class(TOCGenericImport<BMKBasePoiSearchOptionClass, BMKBasePoiSearchOption>) end; PBMKBasePoiSearchOption = Pointer; BMKCitySearchOptionClass = interface(BMKBasePoiSearchOptionClass) ['{0D2A0CFF-D321-426C-BCC4-ACB97E5298F3}'] end; BMKCitySearchOption = interface(BMKBasePoiSearchOption) ['{DA38A310-B4D2-4EC8-86E1-41A411E5B153}'] procedure setCity(city: NSString); cdecl; function city: NSString; cdecl; procedure setRequestPoiAddressInfoList(requestPoiAddressInfoList : Boolean); cdecl; function requestPoiAddressInfoList: Boolean; cdecl; end; TBMKCitySearchOption = class(TOCGenericImport<BMKCitySearchOptionClass, BMKCitySearchOption>) end; PBMKCitySearchOption = Pointer; BMKNearbySearchOptionClass = interface(BMKBasePoiSearchOptionClass) ['{4D69D7C2-0673-4BE0-A993-1ACC47A12380}'] end; BMKNearbySearchOption = interface(BMKBasePoiSearchOption) ['{5A030AD0-83B4-4251-A40C-A10E6F2E3DEC}'] procedure setLocation(location: CLLocationCoordinate2D); cdecl; function location: CLLocationCoordinate2D; cdecl; procedure setRadius(radius: Integer); cdecl; function radius: Integer; cdecl; procedure setSortType(sortType: BMKPoiSortType); cdecl; function sortType: BMKPoiSortType; cdecl; end; TBMKNearbySearchOption = class(TOCGenericImport<BMKNearbySearchOptionClass, BMKNearbySearchOption>) end; PBMKNearbySearchOption = Pointer; BMKBoundSearchOptionClass = interface(BMKBasePoiSearchOptionClass) ['{19A6FC1C-1864-4359-BFA5-A74C7D642EC8}'] end; BMKBoundSearchOption = interface(BMKBasePoiSearchOption) ['{853EF563-A801-42CA-8FF2-01B804F9BF14}'] procedure setLeftBottom(leftBottom: CLLocationCoordinate2D); cdecl; function leftBottom: CLLocationCoordinate2D; cdecl; procedure setRightTop(rightTop: CLLocationCoordinate2D); cdecl; function rightTop: CLLocationCoordinate2D; cdecl; end; TBMKBoundSearchOption = class(TOCGenericImport<BMKBoundSearchOptionClass, BMKBoundSearchOption>) end; PBMKBoundSearchOption = Pointer; BMKPoiIndoorSearchOptionClass = interface(BMKBasePoiSearchOptionClass) ['{78EC923C-363D-4A56-920D-40617241A61B}'] end; BMKPoiIndoorSearchOption = interface(BMKBasePoiSearchOption) ['{7D3BA4C7-D5C3-4667-9F5F-CC76B06851AE}'] procedure setIndoorId(indoorId: NSString); cdecl; function indoorId: NSString; cdecl; procedure setFloor(floor: NSString); cdecl; function floor: NSString; cdecl; end; TBMKPoiIndoorSearchOption = class (TOCGenericImport<BMKPoiIndoorSearchOptionClass, BMKPoiIndoorSearchOption>) end; PBMKPoiIndoorSearchOption = Pointer; BMKPoiDetailSearchOptionClass = interface(NSObjectClass) ['{C5146FA0-A1E6-4D3C-AE02-5BE2F782DFE8}'] end; BMKPoiDetailSearchOption = interface(NSObject) ['{AEB39FEA-0471-4E77-BDFA-E7F5E3496D7B}'] procedure setPoiUid(poiUid: NSString); cdecl; function poiUid: NSString; cdecl; end; TBMKPoiDetailSearchOption = class (TOCGenericImport<BMKPoiDetailSearchOptionClass, BMKPoiDetailSearchOption>) end; PBMKPoiDetailSearchOption = Pointer; BMKPoiSearchClass = interface(BMKSearchBaseClass) ['{79B284AC-A58F-45C8-AB8D-81C3B1D71A2B}'] end; BMKPoiSearch = interface(BMKSearchBase) ['{57F78F37-A261-4F49-A5AB-509EBCC687A0}'] procedure setDelegate(delegate: Pointer); cdecl; function delegate: Pointer; cdecl; function poiSearchInCity(option: BMKCitySearchOption): Boolean; cdecl; function poiSearchInbounds(option: BMKBoundSearchOption): Boolean; cdecl; function poiSearchNearBy(option: BMKNearbySearchOption): Boolean; cdecl; function poiDetailSearch(option: BMKPoiDetailSearchOption): Boolean; cdecl; function poiIndoorSearch(option: BMKPoiIndoorSearchOption): Boolean; cdecl; end; TBMKPoiSearch = class(TOCGenericImport<BMKPoiSearchClass, BMKPoiSearch>) end; PBMKPoiSearch = Pointer; BMKBaseRoutePlanOptionClass = interface(NSObjectClass) ['{CD9EA33F-799E-4471-B27F-E6A604EFCB21}'] end; BMKBaseRoutePlanOption = interface(NSObject) ['{A7CE5A1E-6DC0-42B7-A9B9-6FF3CADA2E18}'] procedure setFrom(from: BMKPlanNode); cdecl; function from: BMKPlanNode; cdecl; procedure setTo(&to: BMKPlanNode); cdecl; function &to: BMKPlanNode; cdecl; end; TBMKBaseRoutePlanOption = class(TOCGenericImport<BMKBaseRoutePlanOptionClass, BMKBaseRoutePlanOption>) end; PBMKBaseRoutePlanOption = Pointer; BMKWalkingRoutePlanOptionClass = interface(BMKBaseRoutePlanOptionClass) ['{456B1556-807D-4864-A2AF-02AE1DD1DE97}'] end; BMKWalkingRoutePlanOption = interface(BMKBaseRoutePlanOption) ['{324AE0EC-3812-4BBD-A7EC-3BF946927B60}'] end; TBMKWalkingRoutePlanOption = class (TOCGenericImport<BMKWalkingRoutePlanOptionClass, BMKWalkingRoutePlanOption>) end; PBMKWalkingRoutePlanOption = Pointer; BMKDrivingRoutePlanOptionClass = interface(BMKBaseRoutePlanOptionClass) ['{D3CDF043-EABE-4E5D-BAAF-712E5B8429AF}'] end; BMKDrivingRoutePlanOption = interface(BMKBaseRoutePlanOption) ['{1933D91C-4995-4202-914D-55E3D8E14DDD}'] procedure setWayPointsArray(wayPointsArray: NSArray); cdecl; function wayPointsArray: NSArray; cdecl; procedure setDrivingPolicy(drivingPolicy: BMKDrivingPolicy); cdecl; function drivingPolicy: BMKDrivingPolicy; cdecl; procedure setDrivingRequestTrafficType(drivingRequestTrafficType : BMKDrivingRequestTrafficType); cdecl; function drivingRequestTrafficType: BMKDrivingRequestTrafficType; cdecl; end; TBMKDrivingRoutePlanOption = class (TOCGenericImport<BMKDrivingRoutePlanOptionClass, BMKDrivingRoutePlanOption>) end; PBMKDrivingRoutePlanOption = Pointer; BMKTransitRoutePlanOptionClass = interface(BMKBaseRoutePlanOptionClass) ['{CEBE406D-69F0-41D4-B3EE-9A453B61CBC0}'] end; BMKTransitRoutePlanOption = interface(BMKBaseRoutePlanOption) ['{54B832A0-7563-4613-83A7-60D786BE84B3}'] procedure setCity(city: NSString); cdecl; function city: NSString; cdecl; procedure setTransitPolicy(transitPolicy: BMKTransitPolicy); cdecl; function transitPolicy: BMKTransitPolicy; cdecl; end; TBMKTransitRoutePlanOption = class (TOCGenericImport<BMKTransitRoutePlanOptionClass, BMKTransitRoutePlanOption>) end; PBMKTransitRoutePlanOption = Pointer; BMKMassTransitRoutePlanOptionClass = interface(BMKBaseRoutePlanOptionClass) ['{7C894270-C7EE-4EB3-AF62-86512E3A8599}'] end; BMKMassTransitRoutePlanOption = interface(BMKBaseRoutePlanOption) ['{F8DA438E-984D-4B4F-A203-C023A79E2B3F}'] procedure setPageIndex(pageIndex: NSUInteger); cdecl; function pageIndex: NSUInteger; cdecl; procedure setPageCapacity(pageCapacity: NSUInteger); cdecl; function pageCapacity: NSUInteger; cdecl; procedure setIncityPolicy(incityPolicy: BMKMassTransitIncityPolicy); cdecl; function incityPolicy: BMKMassTransitIncityPolicy; cdecl; procedure setIntercityPolicy(intercityPolicy : BMKMassTransitIntercityPolicy); cdecl; function intercityPolicy: BMKMassTransitIntercityPolicy; cdecl; procedure setIntercityTransPolicy(intercityTransPolicy : BMKMassTransitIntercityTransPolicy); cdecl; function intercityTransPolicy: BMKMassTransitIntercityTransPolicy; cdecl; end; TBMKMassTransitRoutePlanOption = class (TOCGenericImport<BMKMassTransitRoutePlanOptionClass, BMKMassTransitRoutePlanOption>) end; PBMKMassTransitRoutePlanOption = Pointer; BMKRidingRoutePlanOptionClass = interface(BMKBaseRoutePlanOptionClass) ['{D113A18A-9F4F-4702-9E7A-788255B06883}'] end; BMKRidingRoutePlanOption = interface(BMKBaseRoutePlanOption) ['{9ADE3DAB-D6E8-4A0C-A0FE-075364A3ECD5}'] end; TBMKRidingRoutePlanOption = class (TOCGenericImport<BMKRidingRoutePlanOptionClass, BMKRidingRoutePlanOption>) end; PBMKRidingRoutePlanOption = Pointer; BMKIndoorRoutePlanOptionClass = interface(NSObjectClass) ['{6F28DC9E-6A93-440B-BA52-13DAEE9B949F}'] end; BMKIndoorRoutePlanOption = interface(NSObject) ['{FE6766A9-08EB-463A-A06A-4D0E0522AA4D}'] procedure setFrom(from: BMKIndoorPlanNode); cdecl; function from: BMKIndoorPlanNode; cdecl; procedure setTo(&to: BMKIndoorPlanNode); cdecl; function &to: BMKIndoorPlanNode; cdecl; end; TBMKIndoorRoutePlanOption = class (TOCGenericImport<BMKIndoorRoutePlanOptionClass, BMKIndoorRoutePlanOption>) end; PBMKIndoorRoutePlanOption = Pointer; BMKRouteSearchClass = interface(BMKSearchBaseClass) ['{FCA1FCB5-F702-4195-B8DE-6D442398F5B7}'] end; BMKRouteSearch = interface(BMKSearchBase) ['{9E7FEB1D-47B8-4586-BB59-14C04DFEF814}'] procedure setDelegate(delegate: Pointer); cdecl; function delegate: Pointer; cdecl; function transitSearch(transitRoutePlanOption: BMKTransitRoutePlanOption) : Boolean; cdecl; function massTransitSearch(routePlanOption: BMKMassTransitRoutePlanOption) : Boolean; cdecl; function drivingSearch(drivingRoutePlanOption: BMKDrivingRoutePlanOption) : Boolean; cdecl; function walkingSearch(walkingRoutePlanOption: BMKWalkingRoutePlanOption) : Boolean; cdecl; function ridingSearch(ridingRoutePlanOption: BMKRidingRoutePlanOption) : Boolean; cdecl; function indoorRoutePlanSearch(indoorRoutePlanOption : BMKIndoorRoutePlanOption): Boolean; cdecl; end; TBMKRouteSearch = class(TOCGenericImport<BMKRouteSearchClass, BMKRouteSearch>) end; PBMKRouteSearch = Pointer; BMKPoiDetailShareURLOptionClass = interface(NSObjectClass) ['{28CC6116-9228-4D58-B55C-6333B0329B4B}'] end; BMKPoiDetailShareURLOption = interface(NSObject) ['{23C10567-384E-42B3-B35E-CAA460E013F3}'] procedure setUid(uid: NSString); cdecl; function uid: NSString; cdecl; end; TBMKPoiDetailShareURLOption = class (TOCGenericImport<BMKPoiDetailShareURLOptionClass, BMKPoiDetailShareURLOption>) end; PBMKPoiDetailShareURLOption = Pointer; BMKLocationShareURLOptionClass = interface(NSObjectClass) ['{8874BEAD-75EA-4766-95EB-2FF052FCD8BF}'] end; BMKLocationShareURLOption = interface(NSObject) ['{F75BC015-0A7A-4CFD-A16C-E13C29059A44}'] procedure setName(name: NSString); cdecl; function name: NSString; cdecl; procedure setSnippet(snippet: NSString); cdecl; function snippet: NSString; cdecl; procedure setLocation(location: CLLocationCoordinate2D); cdecl; function location: CLLocationCoordinate2D; cdecl; end; TBMKLocationShareURLOption = class (TOCGenericImport<BMKLocationShareURLOptionClass, BMKLocationShareURLOption>) end; PBMKLocationShareURLOption = Pointer; BMKRoutePlanShareURLOptionClass = interface(NSObjectClass) ['{2CAFCA59-CC41-4089-A8BE-0D3B137DAA21}'] end; BMKRoutePlanShareURLOption = interface(NSObject) ['{A2DAE763-C7CE-40F1-8421-CB002CC85E9B}'] procedure setRoutePlanType(routePlanType: BMKRoutePlanShareURLType); cdecl; function routePlanType: BMKRoutePlanShareURLType; cdecl; procedure setFrom(from: BMKPlanNode); cdecl; function from: BMKPlanNode; cdecl; procedure setTo(&to: BMKPlanNode); cdecl; function &to: BMKPlanNode; cdecl; procedure setCityID(cityID: NSUInteger); cdecl; function cityID: NSUInteger; cdecl; procedure setRouteIndex(routeIndex: NSUInteger); cdecl; function routeIndex: NSUInteger; cdecl; end; TBMKRoutePlanShareURLOption = class (TOCGenericImport<BMKRoutePlanShareURLOptionClass, BMKRoutePlanShareURLOption>) end; PBMKRoutePlanShareURLOption = Pointer; BMKShareURLResultClass = interface(NSObjectClass) ['{C6D5C102-AEB7-4BC8-858D-17528D356B3D}'] end; BMKShareURLResult = interface(NSObject) ['{36433423-461B-4FC1-81AE-FFF113437259}'] procedure setUrl(url: NSString); cdecl; function url: NSString; cdecl; end; TBMKShareURLResult = class(TOCGenericImport<BMKShareURLResultClass, BMKShareURLResult>) end; PBMKShareURLResult = Pointer; BMKShareURLSearchClass = interface(BMKSearchBaseClass) ['{C5EA2AE5-4698-4B8B-9E88-02E4B503A8C0}'] end; BMKShareURLSearch = interface(BMKSearchBase) ['{47546192-7BF1-4CDA-B621-0608676645A3}'] procedure setDelegate(delegate: Pointer); cdecl; function delegate: Pointer; cdecl; function requestPoiDetailShareURL(poiDetailShareUrlSearchOption : BMKPoiDetailShareURLOption): Boolean; cdecl; function requestLocationShareURL(reverseGeoShareUrlSearchOption : BMKLocationShareURLOption): Boolean; cdecl; function requestRoutePlanShareURL(routePlanShareUrlSearchOption : BMKRoutePlanShareURLOption): Boolean; cdecl; end; TBMKShareURLSearch = class(TOCGenericImport<BMKShareURLSearchClass, BMKShareURLSearch>) end; PBMKShareURLSearch = Pointer; BMKSuggestionSearchOptionClass = interface(NSObjectClass) ['{39FFA429-6174-4D1A-B78B-7B67D753C202}'] end; BMKSuggestionSearchOption = interface(NSObject) ['{21F8BD0A-116A-4AFB-ABCE-ABEB76FFE980}'] procedure setKeyword(keyword: NSString); cdecl; function keyword: NSString; cdecl; procedure setCityname(cityname: NSString); cdecl; function cityname: NSString; cdecl; procedure setCityLimit(cityLimit: Boolean); cdecl; function cityLimit: Boolean; cdecl; end; TBMKSuggestionSearchOption = class (TOCGenericImport<BMKSuggestionSearchOptionClass, BMKSuggestionSearchOption>) end; PBMKSuggestionSearchOption = Pointer; BMKSuggestionResultClass = interface(BMKSearchBaseClass) ['{2FAA3209-6B31-4B2D-A3E5-D6554BF97DE9}'] end; BMKSuggestionResult = interface(BMKSearchBase) ['{D19F9EDD-68E3-4E03-9F7F-9A6D79038D75}'] procedure setKeyList(keyList: NSArray); cdecl; function keyList: NSArray; cdecl; procedure setCityList(cityList: NSArray); cdecl; function cityList: NSArray; cdecl; procedure setDistrictList(districtList: NSArray); cdecl; function districtList: NSArray; cdecl; procedure setPoiIdList(poiIdList: NSArray); cdecl; function poiIdList: NSArray; cdecl; procedure setPtList(ptList: NSArray); cdecl; function ptList: NSArray; cdecl; end; TBMKSuggestionResult = class(TOCGenericImport<BMKSuggestionResultClass, BMKSuggestionResult>) end; PBMKSuggestionResult = Pointer; BMKSuggestionSearchClass = interface(BMKSearchBaseClass) ['{9CEA4D2B-6A94-4415-8416-8B8677BE1602}'] end; BMKSuggestionSearch = interface(BMKSearchBase) ['{D3A47B44-8633-4964-9DF5-6B1DEC1B4604}'] procedure setDelegate(delegate: Pointer); cdecl; function delegate: Pointer; cdecl; function suggestionSearch(suggestionSearchOption: BMKSuggestionSearchOption) : Boolean; cdecl; end; TBMKSuggestionSearch = class(TOCGenericImport<BMKSuggestionSearchClass, BMKSuggestionSearch>) end; PBMKSuggestionSearch = Pointer; // ===== Protocol declarations ===== BMKBusLineSearchDelegate = interface(IObjectiveC) ['{92C65D1F-087E-4C7C-BCD4-D18D27F11A5F}'] procedure onGetBusDetailResult(searcher: BMKBusLineSearch; result: BMKBusLineResult; errorCode: BMKSearchErrorCode); cdecl; end; BMKDistrictSearchDelegate = interface(IObjectiveC) ['{133E3295-1715-48A7-B0BA-036692CF5D53}'] procedure onGetDistrictResult(searcher: BMKDistrictSearch; result: BMKDistrictResult; errorCode: BMKSearchErrorCode); cdecl; end; BMKGeoCodeSearchDelegate = interface(IObjectiveC) ['{5CC3C338-536F-41EF-ADAA-9F2F8C2038F6}'] procedure onGetGeoCodeResult(searcher: BMKGeoCodeSearch; result: BMKGeoCodeResult; errorCode: BMKSearchErrorCode); cdecl; procedure onGetReverseGeoCodeResult(searcher: BMKGeoCodeSearch; result: BMKReverseGeoCodeResult; errorCode: BMKSearchErrorCode); cdecl; end; BMKPoiSearchDelegate = interface(IObjectiveC) ['{FC4727D6-0319-4A56-9A18-02BAD7B7C08B}'] procedure onGetPoiResult(searcher: BMKPoiSearch; result: BMKPoiResult; errorCode: BMKSearchErrorCode); cdecl; procedure onGetPoiDetailResult(searcher: BMKPoiSearch; result: BMKPoiDetailResult; errorCode: BMKSearchErrorCode); cdecl; procedure onGetPoiIndoorResult(searcher: BMKPoiSearch; result: BMKPoiIndoorResult; errorCode: BMKSearchErrorCode); cdecl; end; BMKRouteSearchDelegate = interface(IObjectiveC) ['{394C1EF8-5516-4E21-A11C-3125F4523DB4}'] procedure onGetTransitRouteResult(searcher: BMKRouteSearch; result: BMKTransitRouteResult; errorCode: BMKSearchErrorCode); cdecl; procedure onGetMassTransitRouteResult(searcher: BMKRouteSearch; result: BMKMassTransitRouteResult; errorCode: BMKSearchErrorCode); cdecl; procedure onGetDrivingRouteResult(searcher: BMKRouteSearch; result: BMKDrivingRouteResult; errorCode: BMKSearchErrorCode); cdecl; procedure onGetWalkingRouteResult(searcher: BMKRouteSearch; result: BMKWalkingRouteResult; errorCode: BMKSearchErrorCode); cdecl; procedure onGetRidingRouteResult(searcher: BMKRouteSearch; result: BMKRidingRouteResult; errorCode: BMKSearchErrorCode); cdecl; procedure onGetIndoorRouteResult(searcher: BMKRouteSearch; result: BMKIndoorRouteResult; errorCode: BMKSearchErrorCode); cdecl; end; BMKShareURLSearchDelegate = interface(IObjectiveC) ['{FDCE81FE-F84D-421B-B234-ADEAB0B67D14}'] procedure onGetPoiDetailShareURLResult(searcher: BMKShareURLSearch; result: BMKShareURLResult; errorCode: BMKSearchErrorCode); cdecl; procedure onGetLocationShareURLResult(searcher: BMKShareURLSearch; result: BMKShareURLResult; errorCode: BMKSearchErrorCode); cdecl; procedure onGetRoutePlanShareURLResult(searcher: BMKShareURLSearch; result: BMKShareURLResult; errorCode: BMKSearchErrorCode); cdecl; end; BMKSuggestionSearchDelegate = interface(IObjectiveC) ['{992FA38F-E9FB-46CB-ABDB-BA3AEB4BDC4B}'] procedure onGetSuggestionResult(searcher: BMKSuggestionSearch; result: BMKSuggestionResult; errorCode: BMKSearchErrorCode); cdecl; end; // ===== External functions ===== const libBaiduMapAPI_Search = '/System/Library/Frameworks/BaiduMapAPI_Search.framework/BaiduMapAPI_Search'; function BMKGetMapApiSearchComponentVersion: Pointer { NSString }; cdecl; external libBaiduMapAPI_Search name _PU + 'BMKGetMapApiSearchComponentVersion'; function BMKCheckSearchComponentIsLegal: Boolean; cdecl; external libBaiduMapAPI_Search name _PU + 'BMKCheckSearchComponentIsLegal'; implementation {$IF defined(IOS) and NOT defined(CPUARM)} uses Posix.Dlfcn; var BaiduMapAPI_SearchModule: THandle; {$ENDIF IOS} {$IF defined(IOS) and NOT defined(CPUARM)} initialization BaiduMapAPI_SearchModule := dlopen(MarshaledAString(libBaiduMapAPI_Search), RTLD_LAZY); finalization dlclose(BaiduMapAPI_SearchModule); {$ENDIF IOS} end.
33.842242
81
0.762689
179fbc1b6fbd26cc8e90c1b9c194a76cb68dcbec
5,858
pas
Pascal
uFormBot.pas
Rootmarm/sentry-2.0
f660c31c64b280758ee6a3d83234b1d9d9ea3dc1
[ "MIT" ]
19
2018-01-06T14:41:59.000Z
2022-02-09T14:26:09.000Z
uFormBot.pas
Rootmarm/sentry-2.0
f660c31c64b280758ee6a3d83234b1d9d9ea3dc1
[ "MIT" ]
null
null
null
uFormBot.pas
Rootmarm/sentry-2.0
f660c31c64b280758ee6a3d83234b1d9d9ea3dc1
[ "MIT" ]
6
2018-03-17T22:19:50.000Z
2021-01-25T14:02:21.000Z
unit uFormBot; interface uses Classes, uFormParserBot, uBruteForcer; type TFormBot = class(TFormParserBot) private // Pointer to the Statistic's Pointer FStatistics : PStatistics; FRefreshSession : boolean; FFormReferer : string; // Referer needed to get to the Form URL FFormCookie : string; // Cookie needed to get to the Form URL procedure IncrementResponse; procedure SetRefreshSession(const Value: boolean); protected procedure TriggerRequestDone; override; public constructor Create(Aowner: TComponent); override; function GetFormData: boolean; procedure LaunchPOSTRequest; procedure ParseForm; override; property FormCookie : string read FFormCookie write FFormCookie; property FormReferer : string read FFormReferer write FFormReferer; property RefreshSession : boolean read FRefreshSession write SetRefreshSession; property Statistics : PStatistics read FStatistics write FStatistics; end; implementation uses SysUtils, uKeywordBot, uFunctions, Dialogs, FastStrings; { TFormBot } {------------------------------------------------------------------------------} constructor TFormBot.Create(Aowner: TComponent); begin inherited; // FRequestVer := '1.1'; // FConnection := 'keep-alive'; FFormBotState := stReadyToPost; end; {------------------------------------------------------------------------------} procedure TFormBot.TriggerRequestDone; begin IncrementResponse; // Before dealing with Status Codes, check Header Keywords first. if CheckKeywords (True) then begin // Retry Bot if StatusCode is in the Retry StatusCode List if (FJudgement = judBad) and (CheckHeaderRetry) then FJudgement := judRetry; inherited; Exit; end; case FStatusCode of 200: begin // Retrieved Form Data, so Parse it if FFormBotState = stGetFormData then begin // Populates FPostData and FFormData ParseForm; // Check for POST Data, if none is found, then resend GET Request if FPOSTData = '' then begin TriggerDisableProxy (Tag, 'No Form Data Found'); TriggerSetProxy; FJudgement := judRetry; inherited; Exit; end; FLockHeader := False; FFormBotState := stReadyToPost; TriggerUpdateListview ('200 - Retrieved Form Data'); LaunchPOSTRequest; Exit; end // POST Request Finished else begin if FRefreshSession then FFormBotState := stGetFormData; // Check Keywords if CheckKeywords = False then // No Keywords were used FJudgement := judGood; end; end; 300..307: begin if FFormBotState = stGetFormData then begin FJudgement := judRetry; TriggerBanProxy (Tag, 'Error Retrieving Form Data: Redirect to -> ' + FLocation); TriggerSetProxy; end else FJudgement := judRedirect; end; // Deal with error codes else begin TriggerDisableProxy (Tag, IntToStr (FStatusCode) + ' - ' + FReasonPhrase); TriggerSetProxy; // Set Judgements if FReasonPhrase = 'Timeout' then FJudgement := judTimeout else FJudgement := judRetry; end; end; inherited; end; {------------------------------------------------------------------------------} procedure TFormBot.IncrementResponse; begin case FStatusCode of 200: Inc (FStatistics^.i200); 300..307: Inc (FStatistics^.i3xx); 401: Inc (FStatistics^.i401); 403: Inc (FStatistics^.i403); 404: Inc (FStatistics^.i404); 500..505: Inc (FStatistics^.i5xx); end; end; {------------------------------------------------------------------------------} procedure TFormBot.SetRefreshSession(const Value: boolean); begin FRefreshSession := Value; if FRefreshSession then FFormBotState := stGetFormData else FFormBotState := stReadyToPost; end; {------------------------------------------------------------------------------} function TFormBot.GetFormData: boolean; begin Result := FRefreshSession; if FRefreshSession then begin FFormBotState := stGetFormData; // Use ICS's autogenerated header for form retrieval requests FLockHeader := True; // Change URL to FFormURL FURL := FFormURL; // Set special headers to retrieve the Form Data if needed if FFormReferer <> '' then FReference := FFormReferer; if FFormCookie <> '' then FCookie := FFormCookie; // Send GET Request GetAsync; end; end; {------------------------------------------------------------------------------} procedure TFormBot.LaunchPOSTRequest; var MySendStream: TMemoryStream; begin MySendStream := FSendStream as TMemoryStream; SetPOSTData (MySendStream, FPOSTData); FSendStream := MySendStream; PostAsync; end; {------------------------------------------------------------------------------} procedure TFormBot.ParseForm; begin inherited; FPOSTData := FastReplace (FPOSTData, '<USER>', FUsername); FPOSTData := FastReplace (FPOSTData, '<PASS>', FPassword); end; {------------------------------------------------------------------------------} end.
29.437186
90
0.53141
47379f9383a6a0ff0e421d39a07ef958bbac88ca
5,822
pas
Pascal
trunk/SMARTSupport/SMARTSupport.Micron.New.pas
ebangin127/nstools
2a0bb4e6fd3688afd74afd4c7d69eeb46f096a99
[ "MIT" ]
15
2016-02-12T14:55:53.000Z
2021-08-17T09:44:12.000Z
trunk/SMARTSupport/SMARTSupport.Micron.New.pas
ebangin127/nstools
2a0bb4e6fd3688afd74afd4c7d69eeb46f096a99
[ "MIT" ]
1
2020-10-28T12:19:56.000Z
2020-10-28T12:19:56.000Z
trunk/SMARTSupport/SMARTSupport.Micron.New.pas
ebangin127/nstools
2a0bb4e6fd3688afd74afd4c7d69eeb46f096a99
[ "MIT" ]
7
2016-08-21T23:57:47.000Z
2022-02-14T03:26:21.000Z
// Ported CrystalDiskInfo (The MIT License, http://crystalmark.info) unit SMARTSupport.Micron.New; interface uses BufferInterpreter, Device.SMART.List, SMARTSupport, Support; type TNewMicronSMARTSupport = class(TSMARTSupport) private function CheckMU014Characteristics( const SMARTList: TSMARTValueList): Boolean; function CheckMU02Characteristics( const SMARTList: TSMARTValueList): Boolean; function GetTotalWrite(const SMARTList: TSMARTValueList): TTotalWrite; const EntryID = $CA; public function IsThisStorageMine( const IdentifyDevice: TIdentifyDeviceResult; const SMARTList: TSMARTValueList): Boolean; override; function GetTypeName: String; override; function IsSSD: Boolean; override; function IsInsufficientSMART: Boolean; override; function GetSMARTInterpreted( const SMARTList: TSMARTValueList): TSMARTInterpreted; override; function IsWriteValueSupported( const SMARTList: TSMARTValueList): Boolean; override; protected function ErrorCheckedGetLife(const SMARTList: TSMARTValueList): Integer; override; function InnerIsErrorAvailable(const SMARTList: TSMARTValueList): Boolean; override; function InnerIsCautionAvailable(const SMARTList: TSMARTValueList): Boolean; override; function InnerIsError(const SMARTList: TSMARTValueList): TSMARTErrorResult; override; function InnerIsCaution(const SMARTList: TSMARTValueList): TSMARTErrorResult; override; end; implementation { TNewMicronSMARTSupport } function TNewMicronSMARTSupport.GetTypeName: String; begin result := 'SmartMicronMU02'; end; function TNewMicronSMARTSupport.IsInsufficientSMART: Boolean; begin result := false; end; function TNewMicronSMARTSupport.IsSSD: Boolean; begin result := true; end; function TNewMicronSMARTSupport.IsThisStorageMine( const IdentifyDevice: TIdentifyDeviceResult; const SMARTList: TSMARTValueList): Boolean; begin result := CheckMU02Characteristics(SMARTList) or CheckMU014Characteristics(SMARTList); end; function TNewMicronSMARTSupport.CheckMU02Characteristics( const SMARTList: TSMARTValueList): Boolean; begin // Crucial BX100 MU02 2015/11/26 result := (SMARTList.Count >= 11) and (SMARTList[0].Id = $01) and (SMARTList[1].Id = $05) and (SMARTList[2].Id = $09) and (SMARTList[3].Id = $0C) and (SMARTList[4].Id = $A0) and (SMARTList[5].Id = $A1) and (SMARTList[6].Id = $A3) and (SMARTList[7].Id = $A4) and (SMARTList[8].Id = $A5) and (SMARTList[9].Id = $A6) and (SMARTList[10].Id = $A7); end; function TNewMicronSMARTSupport.CheckMU014Characteristics( const SMARTList: TSMARTValueList): Boolean; begin // Crucial BX200 MU01.4 2015/11/26 result := (SMARTList.Count >= 11) and (SMARTList[0].Id = $01) and (SMARTList[1].Id = $05) and (SMARTList[2].Id = $09) and (SMARTList[3].Id = $0C) and (SMARTList[4].Id = $A0) and (SMARTList[5].Id = $A1) and (SMARTList[6].Id = $A3) and (SMARTList[7].Id = $94) and (SMARTList[8].Id = $95) and (SMARTList[9].Id = $96) and (SMARTList[10].Id = $97); end; function TNewMicronSMARTSupport.ErrorCheckedGetLife( const SMARTList: TSMARTValueList): Integer; begin result := SMARTList[SMARTList.GetIndexByID($A9)].Current; end; function TNewMicronSMARTSupport.InnerIsErrorAvailable( const SMARTList: TSMARTValueList): Boolean; begin result := true; end; function TNewMicronSMARTSupport.InnerIsCautionAvailable( const SMARTList: TSMARTValueList): Boolean; begin result := IsEntryAvailable(EntryID, SMARTList); end; function TNewMicronSMARTSupport.InnerIsError( const SMARTList: TSMARTValueList): TSMARTErrorResult; begin result.Override := false; result.Status := InnerCommonIsError(EntryID, SMARTList).Status; end; function TNewMicronSMARTSupport.InnerIsCaution( const SMARTList: TSMARTValueList): TSMARTErrorResult; begin result := InnerCommonIsCaution(EntryID, SMARTList, CommonLifeThreshold); end; function TNewMicronSMARTSupport.IsWriteValueSupported( const SMARTList: TSMARTValueList): Boolean; const WriteID1 = $F1; WriteID2 = $F5; begin try SMARTList.GetIndexByID(WriteID1); result := true; except result := false; end; if not result then begin try SMARTList.GetIndexByID(WriteID2); result := true; except result := false; end; end; end; function TNewMicronSMARTSupport.GetSMARTInterpreted( const SMARTList: TSMARTValueList): TSMARTInterpreted; const ReadError = true; EraseError = false; UsedHourID = $09; ThisErrorType = ReadError; ErrorID = $01; ReplacedSectorsID = $05; begin FillChar(result, SizeOf(result), 0); result.UsedHour := SMARTList.ExceptionFreeGetRAWByID(UsedHourID); result.ReadEraseError.TrueReadErrorFalseEraseError := ReadError; result.ReadEraseError.Value := SMARTList.ExceptionFreeGetRAWByID(ErrorID); result.ReplacedSectors := SMARTList.ExceptionFreeGetRAWByID(ReplacedSectorsID); result.TotalWrite := GetTotalWrite(SMARTList); end; function TNewMicronSMARTSupport.GetTotalWrite( const SMARTList: TSMARTValueList): TTotalWrite; function LBAToMB(const SizeInLBA: Int64): UInt64; begin result := SizeInLBA shr 1; end; function GBToMB(const SizeInLBA: Int64): UInt64; begin result := SizeInLBA shl 10; end; const HostWrite = true; NANDWrite = false; WriteID1 = $F1; WriteID2 = $F5; begin result.InValue.TrueHostWriteFalseNANDWrite := HostWrite; try result.InValue.ValueInMiB := LBAToMB(SMARTList.GetRAWByID(WriteID1)); except try result.InValue.ValueInMiB := LBAToMB(SMARTList.ExceptionFreeGetRAWByID(WriteID2)); except result.InValue.ValueInMiB := 0; end; end; end; end.
26.706422
79
0.732051
6a242eabff681fd06535a4978174fac08d1faf0f
806
pas
Pascal
Chapter09/Messaging/ThreadedFooBar.Polling.pas
PacktPublishing/Hands-On-Design-Patterns-with-Delphi
30f6ab51e61d583f822be4918f4b088e2255cd82
[ "MIT" ]
38
2019-02-28T06:22:52.000Z
2022-03-16T12:30:43.000Z
Chapter09/Messaging/ThreadedFooBar.Polling.pas
alefragnani/Hands-On-Design-Patterns-with-Delphi
3d29e5b2ce9e99e809a6a9a178c3f5e549a8a03d
[ "MIT" ]
null
null
null
Chapter09/Messaging/ThreadedFooBar.Polling.pas
alefragnani/Hands-On-Design-Patterns-with-Delphi
3d29e5b2ce9e99e809a6a9a178c3f5e549a8a03d
[ "MIT" ]
18
2019-03-29T08:36:14.000Z
2022-03-30T00:31:28.000Z
unit ThreadedFooBar.Polling; interface uses System.Generics.Collections, ThreadedFooBar; type TPollingFooBarThread = class(TFooBarThread) strict private FQueue: TThreadedQueue<string>; strict protected procedure SendMessage(const msg: string); override; public procedure AfterConstruction; override; procedure BeforeDestruction; override; property MessageQueue: TThreadedQueue<string> read FQueue; end; implementation uses System.SysUtils; procedure TPollingFooBarThread.AfterConstruction; begin inherited; FQueue := TThreadedQueue<string>.Create(100); end; procedure TPollingFooBarThread.BeforeDestruction; begin FreeAndNil(FQueue); inherited; end; procedure TPollingFooBarThread.SendMessage(const msg: string); begin FQueue.PushItem(msg); end; end.
18.318182
62
0.78536
f1b46c19354d6aef3f8f4c46a276040038d5f0a6
4,835
pas
Pascal
samples/CustomAuth/MainClientFormU.pas
joaoduarte19/delphimvcframework
17cc5d5eea42dccbb9b78dd4d66260b306143909
[ "Apache-2.0" ]
1,009
2015-05-28T12:34:39.000Z
2022-03-30T14:10:18.000Z
samples/CustomAuth/MainClientFormU.pas
FinCodeur/delphimvcframework
a45cb1383eaffc9e81a836247643390acbb7b9b0
[ "Apache-2.0" ]
454
2015-05-28T12:44:27.000Z
2022-03-31T22:35:45.000Z
samples/CustomAuth/MainClientFormU.pas
FinCodeur/delphimvcframework
a45cb1383eaffc9e81a836247643390acbb7b9b0
[ "Apache-2.0" ]
377
2015-05-28T16:29:21.000Z
2022-03-21T18:36:12.000Z
// *************************************************************************** // // Delphi MVC Framework // // Copyright (c) 2010-2021 Daniele Teti and the DMVCFramework Team // // https://github.com/danieleteti/delphimvcframework // // *************************************************************************** // // 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 MainClientFormU; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.AppEvnts, MVCFramework.RESTClient.Intf, MVCFramework.RESTClient, Vcl.ExtCtrls; type TForm7 = class(TForm) GroupBox1: TGroupBox; edtUsername: TEdit; edtPassword: TEdit; btnLogInLogOut: TButton; ApplicationEvents1: TApplicationEvents; Panel1: TPanel; Button1: TButton; Memo1: TMemo; Button2: TButton; Button3: TButton; Label1: TLabel; Label2: TLabel; ListBox1: TListBox; Label3: TLabel; Label4: TLabel; Label5: TLabel; Label6: TLabel; Label7: TLabel; procedure FormCreate(Sender: TObject); procedure ApplicationEvents1Idle(Sender: TObject; var Done: Boolean); procedure btnLogInLogOutClick(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure Button3Click(Sender: TObject); procedure ListBox1Click(Sender: TObject); private FRESTClient: IMVCRESTClient; FLogoutUrl: string; FLogoutMethod: string; procedure FillMemo(Response: IMVCRESTResponse); { Private declarations } public { Public declarations } end; var Form7: TForm7; implementation uses System.JSON, MVCFramework.SystemJSONUtils; {$R *.dfm} procedure TForm7.ApplicationEvents1Idle(Sender: TObject; var Done: Boolean); begin if FRESTClient.SessionID.IsEmpty then begin btnLogInLogOut.Caption := 'LOGIN'; Panel1.Caption := 'Not Logged'; edtUsername.Enabled := True; edtPassword.Enabled := True; end else begin btnLogInLogOut.Caption := 'LOGOUT'; Panel1.Caption := 'SessionID = ' + FRESTClient.SessionID; edtUsername.Enabled := False; edtPassword.Enabled := False; end; end; procedure TForm7.btnLogInLogOutClick(Sender: TObject); var lJObj: TJSONObject; lRes: IMVCRESTResponse; begin if btnLogInLogOut.Caption = 'LOGIN' then begin lJObj := TJSONObject.Create; try lJObj.AddPair('username', edtUsername.Text); lJObj.AddPair('password', edtPassword.Text); lRes := FRESTClient.Post('/system/users/logged', TSystemJSON.JSONValueToString(lJObj, False)); if not lRes.Success then begin ShowMessage(lRes.Content); end; FLogoutUrl := lRes.HeaderValue('X-LOGOUT-URL'); FLogoutMethod := lRes.HeaderValue('X-LOGOUT-METHOD'); finally lJObj.Free; end; end else begin Assert(FLogoutMethod = 'DELETE'); lRes := FRESTClient.Delete(FLogoutUrl); if not lRes.Success then begin ShowMessage(lRes.Content); end; end; end; procedure TForm7.Button1Click(Sender: TObject); var lRes: IMVCRESTResponse; begin lRes := FRESTClient.Get('/private/public/action'); FillMemo(lRes); end; procedure TForm7.Button2Click(Sender: TObject); var lRes: IMVCRESTResponse; begin lRes := FRESTClient.Get('/private/role1'); FillMemo(lRes); end; procedure TForm7.Button3Click(Sender: TObject); var lRes: IMVCRESTResponse; begin lRes := FRESTClient.Get('/private/role2'); FillMemo(lRes); end; procedure TForm7.FillMemo(Response: IMVCRESTResponse); begin Memo1.Lines.Add( Format('[%s] [%s] %s', [TimeToStr(Time), Response.StatusText, Response.Content])); end; procedure TForm7.FormCreate(Sender: TObject); begin FRESTClient := TMVCRESTClient.New.BaseURL('localhost', 8080); end; procedure TForm7.ListBox1Click(Sender: TObject); var lText: string; lPieces: TArray<string>; begin if ListBox1.ItemIndex > -1 then begin lText := ListBox1.Items[ListBox1.ItemIndex]; lPieces := lText.Split([':']); edtUsername.Text := lPieces[0]; edtPassword.Text := lPieces[1]; ShowMessage('Now you can log in using the login/logout button'); end; end; end.
25.582011
122
0.674664
8310a33440b5d194034ff0c2f7fbf0ac42dbf5bf
1,043
pas
Pascal
Chapter04/GameOfMemory/uGameOfMem.pas
PacktPublishing/Expert-Delpi
b80f67884cfde32fff4c88cd8bd8dab30bfb8270
[ "MIT" ]
22
2017-09-13T23:05:34.000Z
2022-01-09T11:36:41.000Z
Chapter04/GameOfMemory/uGameOfMem.pas
Nitin-Mane/Expert-Delphi
b80f67884cfde32fff4c88cd8bd8dab30bfb8270
[ "MIT" ]
null
null
null
Chapter04/GameOfMemory/uGameOfMem.pas
Nitin-Mane/Expert-Delphi
b80f67884cfde32fff4c88cd8bd8dab30bfb8270
[ "MIT" ]
11
2017-10-30T17:31:21.000Z
2021-08-29T22:39:39.000Z
unit uGameOfMem; interface type TDifficultyLevel = (D3x2, D4x3, D4x4, D5x4, D6x4, D7x4); TBoardSize = record Cols, Rows: byte; end; function DifficultyLevelToBoardSize(Value: TDifficultyLevel): TBoardSize; function BoardSizeToPairsCount(bs: TBoardSize): integer; function PairsCount(Value: TDifficultyLevel): integer; implementation function DifficultyLevelToBoardSize(Value: TDifficultyLevel): TBoardSize; begin case Value of D3x2: begin Result.Cols := 3; Result.Rows := 2 end; D4x3: begin Result.Cols := 4; Result.Rows := 3 end; D4x4: begin Result.Cols := 4; Result.Rows := 4 end; D5x4: begin Result.Cols := 5; Result.Rows := 4 end; D6x4: begin Result.Cols := 6; Result.Rows := 4 end; D7x4: begin Result.Cols := 7; Result.Rows := 4 end; end; end; function BoardSizeToPairsCount(bs: TBoardSize): integer; begin Result := (bs.Cols * bs.Rows) div 2 end; function PairsCount(Value: TDifficultyLevel): integer; begin Result := BoardSizeToPairsCount(DifficultyLevelToBoardSize(Value)); end; end.
25.439024
73
0.723873
f14460e4f78ce126cb0dc2bde52df5388c9d7f94
1,924
dpr
Pascal
windows/source/DelphiLibraryHelper.dpr
vhanla/delphi-library-helper
0d0e5ceb4de1ba917961b87a0875b3f4ab5bc756
[ "Apache-2.0" ]
1
2019-05-13T12:39:21.000Z
2019-05-13T12:39:21.000Z
windows/source/DelphiLibraryHelper.dpr
vhanla/delphi-library-helper
0d0e5ceb4de1ba917961b87a0875b3f4ab5bc756
[ "Apache-2.0" ]
null
null
null
windows/source/DelphiLibraryHelper.dpr
vhanla/delphi-library-helper
0d0e5ceb4de1ba917961b87a0875b3f4ab5bc756
[ "Apache-2.0" ]
2
2019-05-13T12:39:23.000Z
2020-02-07T18:44:09.000Z
program DelphiLibraryHelper; uses Vcl.Forms, Windows, Controls, Dialogs, SysUtils, Printers, System.UITypes, frmDelphiLibraryHelperU in 'frmDelphiLibraryHelperU.pas' {frmDelphiLibraryHelper}, LibraryPathsU in 'LibraryPathsU.pas', LibraryHelperU in 'LibraryHelperU.pas', frmAddLibraryPathU in 'frmAddLibraryPathU.pas' {frmAddLibraryPath}, frmAddEnvironmentVariableU in 'frmAddEnvironmentVariableU.pas' {frmAddEnvironmentVariable}, frmAboutU in 'frmAboutU.pas' {frmAbout}, FileVersionInformationU in 'FileVersionInformationU.pas', frmFindReplaceU in 'frmFindReplaceU.pas' {frmFindReplace}, frmSearchU in 'frmSearchU.pas' {frmSearch}, frmProgressU in 'frmProgressU.pas' {frmProgress}, Vcl.Themes, Vcl.Styles, dmDelphiLibraryHelperU in 'dmDelphiLibraryHelperU.pas' {dmDelphiLibraryHelper: TDataModule}, LoggingU in 'LoggingU.pas', frmLoggingU in 'frmLoggingU.pas' {frmLogging}; {$R *.res} function IsFontInstalled(const AFontName: string): boolean; begin Result := Screen.Fonts.IndexOf(AFontName) <> -1; end; begin Application.Initialize; if CheckWin32Version(6) then begin if IsFontInstalled('Segoe UI') then begin Application.DefaultFont.Name := 'Segoe UI'; Screen.MessageFont.Name := 'Segoe UI'; end; // if IsFontInstalled('Roboto Lt') then begin Application.DefaultFont.Name := 'Roboto Lt'; Screen.MessageFont.Name := 'Roboto Lt'; end; if IsFontInstalled('Roboto Light') then begin Application.DefaultFont.Name := 'Roboto Light'; Screen.MessageFont.Name := 'Roboto Light'; end; end; Application.MainFormOnTaskbar := True; TStyleManager.TrySetStyle('Carbon'); Application.CreateForm(TfrmDelphiLibraryHelper, frmDelphiLibraryHelper); Application.CreateForm(TdmDelphiLibraryHelper, dmDelphiLibraryHelper); Application.CreateForm(TfrmLogging, frmLogging); Application.Run; end.
29.151515
94
0.747921
f1f11b7573453bc561fbcf7cbb3007129078376d
4,520
dfm
Pascal
net.ssa/Editors/MoveScene.dfm
ixray-team/xray-vss-archive
b245c8601dcefb505b4b51f58142da6769d4dc92
[ "Linux-OpenIB" ]
1
2022-03-26T17:00:19.000Z
2022-03-26T17:00:19.000Z
net.ssa/Editors/MoveScene.dfm
ixray-team/xray-vss-archive
b245c8601dcefb505b4b51f58142da6769d4dc92
[ "Linux-OpenIB" ]
null
null
null
net.ssa/Editors/MoveScene.dfm
ixray-team/xray-vss-archive
b245c8601dcefb505b4b51f58142da6769d4dc92
[ "Linux-OpenIB" ]
1
2022-03-26T17:00:21.000Z
2022-03-26T17:00:21.000Z
object fraMoveScene: TfraMoveScene Left = 0 Top = 0 Width = 443 Height = 277 Align = alClient TabOrder = 0 object Panel4: TPanel Left = 0 Top = 0 Width = 443 Height = 46 Align = alTop Font.Charset = DEFAULT_CHARSET Font.Color = clMaroon Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] ParentColor = True ParentFont = False TabOrder = 0 object Label2: TLabel Left = 1 Top = 1 Width = 441 Height = 13 Align = alTop Alignment = taCenter Caption = 'Move Selected:' Color = clBtnShadow Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] ParentColor = False ParentFont = False OnClick = Label2Click end object SpeedButton19: TExtBtn Left = 102 Top = 2 Width = 11 Height = 11 Align = alNone CloseButton = False Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] Glyph.Data = { DE000000424DDE00000000000000360000002800000007000000070000000100 180000000000A8000000120B0000120B00000000000000000000FFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFF000000FFFFFFFFFFFFFFFFFF00 0000FFFFFFFFFFFF000000000000000000FFFFFFFFFFFF000000FFFFFF000000 000000000000000000000000FFFFFF0000000000000000000000000000000000 00000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00 0000} ParentFont = False OnClick = PanelMinClick end object Label1: TLabel Left = 2 Top = 17 Width = 27 Height = 13 Caption = 'Lock:' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] ParentFont = False end object Label5: TLabel Left = 2 Top = 30 Width = 28 Height = 13 Caption = 'Snap:' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] ParentFont = False end object sbSnap: TExtBtn Left = 38 Top = 30 Width = 75 Height = 14 Align = alNone AllowAllUp = True BevelShow = False HotTrack = True CloseButton = False GroupIndex = 4 Down = True Caption = 'Enable' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] ParentFont = False Transparent = False end object sbLockX: TExtBtn Left = 38 Top = 16 Width = 25 Height = 14 Align = alNone AllowAllUp = True BevelShow = False HotTrack = True CloseButton = False GroupIndex = 1 Down = True Caption = 'X' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [fsBold] ParentFont = False Transparent = False OnClick = sbLockClick end object sbLockY: TExtBtn Left = 63 Top = 16 Width = 25 Height = 14 Align = alNone AllowAllUp = True BevelShow = False HotTrack = True CloseButton = False GroupIndex = 2 Caption = 'Y' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [fsBold] ParentFont = False Transparent = False OnClick = sbLockClick end object sbLockZ: TExtBtn Left = 88 Top = 16 Width = 25 Height = 14 Align = alNone AllowAllUp = True BevelShow = False HotTrack = True CloseButton = False GroupIndex = 3 Down = True Caption = 'Z' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [fsBold] ParentFont = False Transparent = False OnClick = sbLockClick end end end
25.393258
73
0.571681
6a7b9c022fac02ce85a37985917869b8d650e6a6
1,622
pas
Pascal
BAC 2018/Algo/Bac Pratique 2018 8h30.pas
Jev1337/CS-Studies
c9a67f2946b519e99c1012a59095d9d5063f9aac
[ "Apache-2.0" ]
1
2021-04-28T15:02:53.000Z
2021-04-28T15:02:53.000Z
BAC 2018/Algo/Bac Pratique 2018 8h30.pas
Jev1337/Pascal-Studies
c9a67f2946b519e99c1012a59095d9d5063f9aac
[ "Apache-2.0" ]
1
2021-05-23T12:04:28.000Z
2021-05-23T17:28:03.000Z
BAC 2018/Algo/Bac Pratique 2018 8h30.pas
Jev1337/Pascal-Studies
c9a67f2946b519e99c1012a59095d9d5063f9aac
[ "Apache-2.0" ]
null
null
null
Uses Wincrt; Type mat = Array[1..20,1..10] Of Integer; Var // n in 1..20 f,g: Text; m: mat; l,c: Integer; Procedure TransfertFrom(Var f:Text; Var m:mat; Var i,max:Integer); Var e,j: Integer; a: Char; ch: String; Begin Reset(f); i := 1; j := 0; max := 0; ch := ''; While Not(Eof(f)) Do Begin read(f,a); If a <> ' ' Then ch := ch+ a Else Begin j := j+1; Val(ch,M[i,j],e); ch := ''; End; If Eoln(f) Then Begin If max < j Then max := j; Val(ch,M[i,j],e); ch := ''; Readln(f); i := i+1; j := 0; End; End; i := i-1; Close(f); End; Procedure Tri_Insertion (Var M: mat ; j,l: Integer) ; Var i, k, aux : Integer ; Begin For i := 2 To l Do Begin aux := M[i,j] ; k := i ; While (k > 1) And (M[k - 1,j] > aux) Do Begin M[k,j] := M[k- 1,j] ; k := k - 1 ; End ; M[k,j] := aux ; End ; End; Procedure TransfertTo(Var m:mat; l,c:Integer; Var g:Text); Var i,j: Integer; Begin Rewrite(g); For j:= 1 To c Do Tri_Insertion(m,j,l); For i:= 1 To l Do Begin For j:= 1 To c Do Write(g,M[i,j],' '); Writeln(g); End; Close(g); End; Procedure Affiche(Var g:Text); Var ch: String; Begin Reset(g); While Not(Eof(g)) Do Begin Readln(g,ch); Writeln(ch); End; Close(g); End; Begin Assign(f,'Source.txt'); Assign(g,'Resultat.txt'); TransfertFrom(f,m,l,c); TransfertTo(m,l,c,g); Affiche(g); End.
16.55102
66
0.463625
f14482890f72c071936c802593320b5be7e78f2e
27,224
pas
Pascal
keyboard/0033.pas
nickelsworth/swag
7c21c0da2291fc249b9dc5cfe121a7672a4ffc08
[ "BSD-2-Clause" ]
11
2015-12-12T05:13:15.000Z
2020-10-14T13:32:08.000Z
keyboard/0033.pas
nickelsworth/swag
7c21c0da2291fc249b9dc5cfe121a7672a4ffc08
[ "BSD-2-Clause" ]
null
null
null
keyboard/0033.pas
nickelsworth/swag
7c21c0da2291fc249b9dc5cfe121a7672a4ffc08
[ "BSD-2-Clause" ]
8
2017-05-05T05:24:01.000Z
2021-07-03T20:30:09.000Z
UNIT HTkb; { Complete set of all keyboard scan codes. Part of the Heartware Toolkit v2.00 (HTkb.PAS) for Turbo Pascal. Author: Jose Almeida. P.O.Box 4185. 1504 Lisboa Codex. Portugal. I can also be reached at RIME network, site ->TIB or #5314. Feel completely free to use this source code in any way you want, and, if you do, please don't forget to mention my name, and, give me and Swag the proper credits. } INTERFACE const { letters ······························································ } kb_AA = $1E61; { a } kb_A = $1E41; { A } kb_CtrlA = $1E01; { ^A } { SOH - Start Of Header } kb_AltA = $1E00; { ALT A } kb_BB = $3062; { b } kb_B = $3042; { B } kb_CtrlB = $3002; { ^B } { STX - Start Of Text } kb_AltB = $3000; { ALT B } kb_CC = $2E63; { c } kb_C = $2E43; { C } kb_CtrlC = $2E03; { ^C } { ETX - End Of Text } kb_AltC = $2E00; { ALT C } kb_DD = $2064; { d } kb_D = $2044; { D } kb_CtrlD = $2004; { ^D } { EOT - End Of Transmission } kb_AltD = $2000; { ALT D } kb_EE = $1265; { e } kb_E = $1245; { E } kb_CtrlE = $1205; { ^E } { ENQ - Enquire } kb_AltE = $1200; { ALT E } kb_FF = $2166; { f } kb_F = $2146; { F } kb_CtrlF = $2106; { ^F } { ACK - Acknowledge } kb_AltF = $2100; { ALT F } kb_GG = $2267; { g } kb_G = $2247; { G } kb_CtrlG = $2207; { ^G } { BEL - Bell } kb_AltG = $2200; { ALT G } kb_HH = $2368; { h } kb_H = $2348; { H } kb_CtrlH = $2308; { ^H } { BS - BackSpace } kb_AltH = $2300; { ALT H } kb_II = $1769; { i } kb_I = $1749; { I } kb_CtrlI = $1709; { ^I } { HT - Horizontal Tab } kb_AltI = $1700; { ALT I } kb_JJ = $246A; { j } kb_J = $244A; { J } kb_CtrlJ = $240A; { ^J } { LF - Line Feed } kb_AltJ = $2400; { ALT J } kb_KK = $256B; { k } kb_K = $254B; { K } kb_CtrlK = $250B; { ^K } { VT - Vertical Tab } kb_AltK = $2500; { ALT K } kb_LL = $266C; { l } kb_L = $264C; { L } kb_CtrlL = $260C; { ^L } { FF - Form Feed (new page) } kb_AltL = $2600; { ALT L } kb_MM = $326D; { m } kb_M = $324D; { M } kb_CtrlM = $320D; { ^M } { CR - Carriage Return } kb_AltM = $3200; { ALT M } kb_NN = $316E; { n } kb_N = $314E; { N } kb_CtrlN = $310E; { ^N } { SO - Shift Out (numbers) } kb_AltN = $3100; { ALT N } kb_OO = $186F; { o } kb_O = $184F; { O } kb_CtrlO = $180F; { ^O } { SI - Shift In (letters) } kb_AltO = $1800; { ALT O } kb_PP = $1970; { p } kb_P = $1950; { P } kb_CtrlP = $1910; { ^P } { DEL - Delete } kb_AltP = $1900; { ALT P } kb_QQ = $1071; { q } kb_Q = $1051; { Q } kb_CtrlQ = $1011; { ^Q } { DC1 - Device Control 1 } kb_AltQ = $1000; { ALT Q } kb_RR = $1372; { r } kb_R = $1352; { R } kb_CtrlR = $1312; { ^R } { DC2 - Device Control 2 } kb_AltR = $1300; { ALT R } kb_SS = $1F73; { s } kb_S = $1F53; { S } kb_CtrlS = $1F13; { ^S } { DC3 - Device Control 3 } kb_AltS = $1F00; { ALT S } kb_TT = $1474; { t } kb_T = $1454; { T } kb_CtrlT = $1414; { ^T } { DC4 - Device Control 4 } kb_AltT = $1400; { ALT T } kb_UU = $1675; { u } kb_U = $1655; { U } kb_CtrlU = $1615; { ^U } { NAK - Negative Acknowlegde } kb_AltU = $1600; { ALT U } kb_VV = $2F76; { v } kb_V = $2F56; { V } kb_CtrlV = $2F16; { ^V } { SYN - Syncronize } kb_AltV = $2F00; { ALT V } kb_WW = $1177; { w } kb_W = $1157; { W } kb_CtrlW = $1117; { ^W } { ETB - End of Text Block } kb_AltW = $1100; { ALT W } kb_XX = $2D78; { x } kb_X = $2D58; { X } kb_CtrlX = $2D18; { ^X - } { CAN - Cancel } kb_AltX = $2D00; { ALT X } kb_YY = $1579; { y } kb_Y = $1559; { Y } kb_CtrlY = $1519; { ^Y } { EM - End of Medium } kb_AltY = $1500; { ALT Y } kb_ZZ = $2C7A; { z } kb_Z = $2C5A; { Z } kb_CtrlZ = $2C1A; { ^Z } { SUB - Substitute } kb_AltZ = $2C00; { ALT Z } { numbers ······························································ } kb_1 = $0231; { 1 } kb_Pad1 = $4F31; { SHIFT 1 number pad } kb_Alt1 = $7800; { ALT 1 } kb_2 = $0332; { 2 } kb_Pad2 = $5032; { SHIFT 2 number pad } kb_Alt2 = $7900; { ALT 2 } kb_Ctrl2 = $0300; { ^1 (NUL) } kb_3 = $0433; { 3 } kb_Pad3 = $5133; { SHIFT 3 number pad } kb_Alt3 = $7A00; { ALT 3 } kb_4 = $0534; { 4 } kb_Pad4 = $4B34; { SHIFT 4 number pad } kb_Alt4 = $7B00; { ALT 4 } kb_5 = $0635; { 5 } kb_Pad5 = $4C35; { SHIFT 5 number pad } kb_Alt5 = $7C00; { ALT 5 } kb_6 = $0736; { 6 } kb_Pad6 = $4D36; { SHIFT 6 number pad } kb_Ctrl6 = $071E; { ^6 (RS) } kb_Alt6 = $7D00; { ALT 6 } kb_7 = $0837; { 7 } kb_Pad7 = $4737; { SHIFT 7 number pad } kb_Alt7 = $7E00; { ALT 7 } kb_8 = $0938; { 8 } kb_Pad8 = $4838; { SHIFT 8 number pad } kb_Alt8 = $7F00; { ALT 8 } kb_9 = $0A39; { 9 } kb_Pad9 = $4939; { SHIFT 9 number pad } kb_Alt9 = $8000; { ALT 9 } kb_0 = $0B30; { 0 } kb_Pad0 = $5230; { SHIFT 0 number pad } kb_Alt0 = $8100; { ALT 0 } { etc: characters ······················································ } kb_Less = $333C; { < } kb_Great = $343E; { > } kb_Minus = $352D; { - } kb_GrayMinus = $4A2D; { - } kb_CtrlMinus = $0C1F; { ^- } kb_AltMinus = $8200; { ALT - } kb_ShiftGrayMinus = $4A2D; { SHIFT - } kb_Plus = $1A2B; { + } kb_GrayPlus = $4E2B; { + } kb_WhitePlus = $0D2B; { + } kb_ShiftGrayPlus = $4E2B; { SHIFT + } kb_Equal = $0D3D; { = } kb_AltEqual = $8300; { ALT = } kb_Slash = $352F; { / } kb_BackSlash = $2B5C; { \ } kb_CtrlBackSlash = $2B1C; { ^\ } { FS - File Separator } kb_OpenBracket = $1A5B; { [ } kb_CtrlOpenBracket = $1A1B; { ^[ } { ESC - Escape } kb_CloseBracket = $1B5D; { ] } kb_CtrlCloseBracket = $1B1D; { ^] } { GS - Group Separator } kb_OpenParenthesis = $0A28; { ( } kb_CloseParenthesis = $0B29; { ) } kb_OpenBrace = $1A7B; { can't write it } kb_CloseBrace = $1B7D; { can't write it } kb_Apostrophe = $2827; { ' } kb_Grave = $2960; { ` } kb_Quote = $2822; { " } kb_Tilde = $297E; { ~ } kb_Cater = $075E; { ^ } kb_Semicolon = $273B; { ; } kb_Comma = $332C; { , } kb_Colon = $273A; { : } kb_Period = $342E; { . } kb_ShiftPeriod = $532E; { SHIFT . number pad } kb_GrayAsterisk = $372A; { * } kb_WhiteAsterisk = $1A2A; { * } kb_ExclamationPoint = $0221; { ! } kb_QuestionMark = $353F; { ? } kb_NumberSign = $0423; { # } kb_Dollar = $0524; { $ } kb_Percent = $0625; { % } kb_AmpersAnd = $0826; { & } kb_At = $0340; { @ } { ^@ = 00h } { NUL - Null Character } kb_UnitSeparator = $0C5F; { _ } { ^_ = 1Fh } { US - Unit Separator } kb_Vertical = $2B7C; { | } kb_Space = $3920; { SPACE BAR } { functions ···························································· } kb_F1 = $3B00; { F1 } kb_ShiftF1 = $5400; { SHIFT F1 } kb_CtrlF1 = $5E00; { ^F1 } kb_AltF1 = $6800; { ALT F1 } kb_F2 = $3C00; { F2 } kb_ShiftF2 = $5500; { SHIFT F2 } kb_CtrlF2 = $5F00; { ^F2 } kb_AltF2 = $6900; { ALT F2 } kb_F3 = $3D00; { F3 } kb_ShiftF3 = $5600; { SHIFT F3 } kb_CtrlF3 = $6000; { ^F3 } kb_AltF3 = $6A00; { ALT F3 } kb_F4 = $3E00; { F4 } kb_ShiftF4 = $5700; { SHIFT F4 } kb_CtrlF4 = $6100; { ^F4 } kb_AltF4 = $6B00; { ALT F4 } kb_F5 = $3F00; { F5 } kb_ShiftF5 = $5800; { SHIFT F5 } kb_CtrlF5 = $6200; { ^F5 } kb_AltF5 = $6C00; { ALT F5 } kb_F6 = $4000; { F6 } kb_ShiftF6 = $5900; { SHIFT F6 } kb_CtrlF6 = $6300; { ^F6 } kb_AltF6 = $6D00; { ALT F6 } kb_F7 = $4100; { F7 } kb_ShiftF7 = $5A00; { SHIFT F7 } kb_CtrlF7 = $6400; { ^F7 } kb_AltF7 = $6E00; { ALT F7 } kb_F8 = $4200; { F8 } kb_ShiftF8 = $5B00; { SHIFT F8 } kb_CtrlF8 = $6500; { ^F8 } kb_AltF8 = $6F00; { ALT F8 } kb_F9 = $4300; { F9 } kb_ShiftF9 = $5C00; { SHIFT F9 } kb_CtrlF9 = $6600; { ^F9 } kb_AltF9 = $7000; { ALT F9 } kb_F10 = $4400; { F10 } kb_ShiftF10 = $5D00; { SHIFT F10 } kb_CtrlF10 = $6700; { ^F10 } kb_AltF10 = $7100; { ALT F1\0 } { cursors ······························································ } kb_Up = $4800; { UP } kb_Down = $5000; { DOWN } kb_Left = $4B00; { LEFT } kb_CtrlLeft = $7300; { ^LEFT } kb_Right = $4D00; { RIGHT } kb_CtrlRight = $7400; { ^RIGHT } kb_Home = $4700; { HOME } kb_CtrlHome = $7700; { ^HOME } kb_End = $4F00; { END } kb_CtrlEnd = $7500; { ^END } kb_PgUp = $4900; { PG UP } kb_CtrlPgUp = $8400; { ^PG UP } kb_PgDown = $5100; { PG DN } kb_CtrlPgDown = $7600; { ^PG DN } { etc: keys ···························································· } kb_Esc = $011B; { ESC } kb_Enter = $1C0D; { RETURN } kb_CtrlEnter = $1C0A; { ^ENTER } { LF - Line Feed } kb_BackSpace = $0E08; { BACKSPACE } kb_CtrlBackspace = $0E7F; { ^BACKSPACE } { DEL - Delete } kb_Tab = $0F09; { TAB } kb_Shift_Tab = $0F00; { SHIFT TAB } kb_Ins = $5200; { INSERT } kb_Del = $5300; { DELETE } kb_45 = $565C; { Key 45 [2] } kb_Shift45 = $567C; { SHIFT KEY 45 [2] } kb_CtrlPrtSc = $7200; { ^PRTSC [2] } kb_CtrlBreak = $0000; { ^BREAK [2] } { footnotes ······························································ [1] All key codes refers to Interrupt 16h Services 0 and 1, the "Standard Function", that works with all keyboards types. [2] These key codes are only availlable in the 101/102-key keyboard, the current IBM standard ("Enhanced") keyboard. ·········································································· INT 16h, 00h (0) Keyboard Read all Returns the next character in the keyboard buffer; if no character is available, this service waits until one is available. On entry: AH 00h Returns: AL ASCII character code AH Scan code ────────────────────────────────────────────────────────────────────────── Notes: The scan codes are the numbers representing the location of the key on the keyboard. As new keys have been added and the keyboard layout rearranged, this numbering scheme has not been consistent with its original purpose. If the character is a special character, then AL will be 0 and the value in AH will be the extended scan code for the key. Use the scan codes to differentiate between keys representing the same ASCII code, such as the plus key across the top of the keyboard and the gray plus key. After the character has been removed from the keyboard buffer, the keyboard buffer start pointer (at 0:041Ah) is increased by 2. If the start pointer is beyond the end of the buffer, the start pointer is reset to the start of the keyboard buffer. If no character is available at the keyboard, then the AT, XT-286, and PC Convertible issue an INT 15h, Service 90h (Device Busy), for the keyboard, informing the operating system that there is a keyboard loop taking place and thereby allowing the operating system to perform another task. After every character is typed, the AT, XT-286, and PC Convertible issue an INT 15h, Service 91h (Interrupt Complete). This allows the operating system to switch back to a task that is waiting for a character at the keyboard. See Service 10h for an equivalent service that supports the enhanced (101/102-key) keyboard. ·········································································· INT 16h, 01h (1) Keyboard Status all Checks to see if a character is available in the buffer. On entry: AH 01h Returns: Zero 0, if character is available 1, if character is not available AL ASCII character code (if character is available) AH Scan code (if character is available) ────────────────────────────────────────────────────────────────────────── Notes: If a character is available, the Zero Flag is cleared and AX contains the ASCII value in AL and the scan code in AH. The character is not removed from the buffer. Use Service 00h to remove the character from the buffer. See Service 00h for a complete description of the meaning of AX if a character is available. This service is excellent for clearing the keyboard or allowing a program to be interruptable by a specific key sequence. See Service 11h for an equivalent service that supports the enhanced (101/102-key) keyboard. ········································································ } IMPLEMENTATION END. { HTkb.PAS } 
53.802372
77
0.2446
f1d97de171230544413cd9f07be872073d35888b
10,679
pas
Pascal
projects/gltftest/src/UnitApplication.pas
michaliskambi/pasvulkan
54ff3c801acdfdc2cf4e99c8981f8ca1e96abb47
[ "Zlib" ]
null
null
null
projects/gltftest/src/UnitApplication.pas
michaliskambi/pasvulkan
54ff3c801acdfdc2cf4e99c8981f8ca1e96abb47
[ "Zlib" ]
null
null
null
projects/gltftest/src/UnitApplication.pas
michaliskambi/pasvulkan
54ff3c801acdfdc2cf4e99c8981f8ca1e96abb47
[ "Zlib" ]
null
null
null
unit UnitApplication; {$ifdef fpc} {$mode delphi} {$ifdef cpu386} {$asmmode intel} {$endif} {$ifdef cpuamd64} {$asmmode intel} {$endif} {$else} {$ifdef conditionalexpressions} {$if CompilerVersion>=24.0} {$legacyifend on} {$ifend} {$endif} {$endif} {$if defined(Win32) or defined(Win64)} {$define Windows} {$ifend} interface uses SysUtils, Classes, Math, Vulkan, PasVulkan.Types, PasVulkan.Math, PasVulkan.Framework, PasVulkan.Application, PasVulkan.VirtualReality; const ApplicationTag='gltftest'; type TApplication=class(TpvApplication) public private fVirtualReality:TpvVirtualReality; fForceUseValidationLayers:boolean; fForceNoVSync:boolean; fMaxMSAA:TpvInt32; public constructor Create; override; destructor Destroy; override; procedure SetupVulkanInstance(const aVulkanInstance:TpvVulkanInstance); override; procedure ChooseVulkanPhysicalDevice(var aVulkanPhysicalDevice:TpvVulkanPhysicalDevice); override; procedure SetupVulkanDevice(const aVulkanDevice:TpvVulkanDevice); override; procedure Setup; override; procedure Start; override; procedure Stop; override; procedure Load; override; procedure Unload; override; procedure AfterCreateSwapChain; override; procedure BeforeDestroySwapChain; override; procedure Resume; override; procedure Pause; override; function KeyEvent(const aKeyEvent:TpvApplicationInputKeyEvent):boolean; override; procedure Check(const aDeltaTime:TpvDouble); override; procedure Update(const aDeltaTime:TpvDouble); override; procedure BeginFrame(const aDeltaTime:TpvDouble); override; procedure Draw(const aSwapChainImageIndex:TpvInt32;var aWaitSemaphore:TpvVulkanSemaphore;const aWaitFence:TpvVulkanFence=nil); override; procedure FinishFrame(const aSwapChainImageIndex:TpvInt32;var aWaitSemaphore:TpvVulkanSemaphore;const aWaitFence:TpvVulkanFence=nil); override; procedure PostPresent(const aSwapChainImageIndex:TpvInt32); override; published property VirtualReality:TpvVirtualReality read fVirtualReality; property MaxMSAA:TpvInt32 read fMaxMSAA; end; var Application:TApplication=nil; GLTFFileName:UTF8String='test.glb'; implementation uses UnitScreenMain; constructor TApplication.Create; var VirtualRealityMode:TpvVirtualReality.TMode; {$if not (defined(Android) or defined(iOS))} Index:TpvInt32; Parameter:String; {$ifend} begin inherited Create; Application:=self; fForceUseValidationLayers:=false; fForceNoVSync:=false; VulkanNVIDIAAfterMath:=false; fMaxMSAA:=1; VirtualRealityMode:=TpvVirtualReality.TMode.Disabled; {$if not (defined(Android) or defined(iOS))} Index:=1; while Index<=ParamCount do begin Parameter:=LowerCase(ParamStr(Index)); inc(Index); if (Parameter='--openvr') or (Parameter='/openvr') then begin VirtualRealityMode:=TpvVirtualReality.TMode.OpenVR; end else if (Parameter='--fakedvr') or (Parameter='/fakedvr') then begin VirtualRealityMode:=TpvVirtualReality.TMode.Faked; end else if (Parameter='--force-use-validation-layers') or (Parameter='/force-use-validation-layers') then begin fForceUseValidationLayers:=true; end else if (Parameter='--force-no-vsync') or (Parameter='/force-no-vsync') then begin fForceNoVSync:=true; end else if (Parameter='--nvidia-aftermath') or (Parameter='/nvidia-aftermath') then begin VulkanNVIDIAAfterMath:=true; end else if (Parameter='--prefer-dgpus') or (Parameter='/prefer-dgpus') then begin VulkanPreferDedicatedGPUs:=true; end else if (Parameter='--prefer-igpus') or (Parameter='/prefer-igpus') then begin VulkanPreferDedicatedGPUs:=false; { end else if (Parameter='--flush-update-data') or (Parameter='/flush-update-data') then begin FlushUpdateData:=true; //} end else if (Parameter='--max-msaa') or (Parameter='/max-msaa') then begin if Index<=ParamCount then begin fMaxMSAA:=StrToIntDef(ParamStr(Index),0); inc(Index); end; end else begin GLTFFileName:=Parameter; end; end; {$ifend} if VirtualRealityMode=TpvVirtualReality.TMode.Disabled then begin fVirtualReality:=nil; end else begin fVirtualReality:=TpvVirtualReality.Create(VirtualRealityMode); fVirtualReality.ZNear:=0.1; fVirtualReality.ZFar:=-Infinity; end; end; destructor TApplication.Destroy; begin FreeAndNil(fVirtualReality); Application:=nil; inherited Destroy; end; procedure TApplication.SetupVulkanInstance(const aVulkanInstance:TpvVulkanInstance); begin inherited SetupVulkanInstance(aVulkanInstance); if assigned(fVirtualReality) then begin fVirtualReality.CheckVulkanInstanceExtensions(aVulkanInstance); aVulkanInstance.EnabledExtensionNames.Duplicates:=TDuplicates.dupIgnore; aVulkanInstance.EnabledExtensionNames.AddStrings(fVirtualReality.RequiredVulkanInstanceExtensions); end; end; procedure TApplication.ChooseVulkanPhysicalDevice(var aVulkanPhysicalDevice:TpvVulkanPhysicalDevice); var PhysicalDevice:TVkPhysicalDevice; begin inherited ChooseVulkanPhysicalDevice(aVulkanPhysicalDevice); if assigned(fVirtualReality) and not (fVirtualReality.Mode in [TpvVirtualReality.TMode.Disabled,TpvVirtualReality.TMode.Faked]) then begin fVirtualReality.ChooseVulkanPhysicalDevice(VulkanInstance,PhysicalDevice); pvApplication.VulkanPhysicalDeviceHandle:=PhysicalDevice; end; end; procedure TApplication.SetupVulkanDevice(const aVulkanDevice:TpvVulkanDevice); begin inherited SetupVulkanDevice(aVulkanDevice); if assigned(fVirtualReality) then begin fVirtualReality.CheckVulkanDeviceExtensions(pvApplication.VulkanPhysicalDeviceHandle); aVulkanDevice.EnabledExtensionNames.Duplicates:=TDuplicates.dupIgnore; aVulkanDevice.EnabledExtensionNames.AddStrings(fVirtualReality.RequiredVulkanDeviceExtensions); end; if aVulkanDevice.PhysicalDevice.AvailableExtensionNames.IndexOf(VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME)>=0 then begin aVulkanDevice.EnabledExtensionNames.Add(VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME); end; if aVulkanDevice.PhysicalDevice.AvailableExtensionNames.IndexOf(VK_EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME)>=0 then begin aVulkanDevice.EnabledExtensionNames.Add(VK_EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME); end; end; procedure TApplication.Setup; begin if Debugging or fForceUseValidationLayers then begin VulkanDebugging:=true; VulkanValidation:=true; end; Title:='PasVulkan GLTF Test'; PathName:='gltftest.pasvulkan'; StartScreen:=TScreenMain; VisibleMouseCursor:=true; CatchMouse:=false; HideSystemBars:=true; AndroidSeparateMouseAndTouch:=true; UseAudio:=true; SwapChainColorSpace:=TpvApplicationSwapChainColorSpace.SRGB; //DesiredCountSwapChainImages:=2; if fForceNoVSync or (assigned(fVirtualReality) and not (fVirtualReality.Mode in [TpvVirtualReality.TMode.Disabled,TpvVirtualReality.TMode.Faked])) then begin DesiredCountSwapChainImages:=2; PresentMode:=TpvApplicationPresentMode.Mailbox; end else begin PresentMode:=TpvApplicationPresentMode.VSync; end; // VulkanAPIVersion:=VK_API_VERSION_1_0; VulkanAPIVersion:=0;//VK_API_VERSION_1_0; end; procedure TApplication.Start; begin inherited Start; end; procedure TApplication.Stop; begin inherited Stop; end; procedure TApplication.Load; begin if not VulkanMultiviewSupportEnabled then begin raise EpvVulkanException.Create('Missing Vulkan multi-view support'); end; inherited Load; if assigned(fVirtualReality) then begin fVirtualReality.Load; end; end; procedure TApplication.Unload; begin if assigned(fVirtualReality) then begin fVirtualReality.Unload; end; inherited Unload; end; procedure TApplication.AfterCreateSwapChain; begin if assigned(fVirtualReality) then begin fVirtualReality.AfterCreateSwapChain; end; inherited AfterCreateSwapChain; end; procedure TApplication.BeforeDestroySwapChain; begin inherited BeforeDestroySwapChain; if assigned(fVirtualReality) then begin fVirtualReality.BeforeDestroySwapChain; end; end; procedure TApplication.Resume; begin inherited Resume; end; procedure TApplication.Pause; begin inherited Pause; end; function TApplication.KeyEvent(const aKeyEvent:TpvApplicationInputKeyEvent):boolean; begin result:=inherited KeyEvent(aKeyEvent); if aKeyEvent.KeyEventType=TpvApplicationInputKeyEventType.Down then begin case aKeyEvent.KeyCode of KEYCODE_F9:begin VirtualReality.ResetOrientation; end; KEYCODE_F11:begin end; end; end; end; procedure TApplication.Check(const aDeltaTime:TpvDouble); begin if assigned(fVirtualReality) then begin fVirtualReality.Check(aDeltaTime); end; inherited Check(aDeltaTime); end; procedure TApplication.Update(const aDeltaTime:TpvDouble); begin if assigned(fVirtualReality) then begin fVirtualReality.Update(aDeltaTime); end; inherited Update(aDeltaTime); end; procedure TApplication.BeginFrame(const aDeltaTime:TpvDouble); begin if assigned(fVirtualReality) then begin fVirtualReality.BeginFrame(aDeltaTime); end; inherited BeginFrame(aDeltaTime); end; procedure TApplication.Draw(const aSwapChainImageIndex:TpvInt32;var aWaitSemaphore:TpvVulkanSemaphore;const aWaitFence:TpvVulkanFence=nil); begin if assigned(fVirtualReality) then begin inherited Draw(aSwapChainImageIndex,aWaitSemaphore,nil); fVirtualReality.Draw(aSwapChainImageIndex,aWaitSemaphore,aWaitFence); end else begin inherited Draw(aSwapChainImageIndex,aWaitSemaphore,aWaitFence); end; end; procedure TApplication.FinishFrame(const aSwapChainImageIndex:TpvInt32;var aWaitSemaphore:TpvVulkanSemaphore;const aWaitFence:TpvVulkanFence=nil); begin if assigned(fVirtualReality) then begin inherited FinishFrame(aSwapChainImageIndex,aWaitSemaphore,nil); fVirtualReality.FinishFrame(aSwapChainImageIndex,aWaitSemaphore,aWaitFence); end else begin inherited FinishFrame(aSwapChainImageIndex,aWaitSemaphore,aWaitFence); end; end; procedure TApplication.PostPresent(const aSwapChainImageIndex:TpvInt32); begin inherited PostPresent(aSwapChainImageIndex); if assigned(fVirtualReality) then begin fVirtualReality.PostPresent(aSwapChainImageIndex); end; end; end.
31.043605
159
0.763274
f17f2c758237276ce411fd1c368d4c661a205b27
1,940
dfm
Pascal
Components/JVCL/examples/JvNTEventLog/JvNTEventLogMainFormU.dfm
sabatex/Delphi
0efbe6eb38bf8aa2bf269d1866741266e90b9cbf
[ "MIT" ]
null
null
null
Components/JVCL/examples/JvNTEventLog/JvNTEventLogMainFormU.dfm
sabatex/Delphi
0efbe6eb38bf8aa2bf269d1866741266e90b9cbf
[ "MIT" ]
null
null
null
Components/JVCL/examples/JvNTEventLog/JvNTEventLogMainFormU.dfm
sabatex/Delphi
0efbe6eb38bf8aa2bf269d1866741266e90b9cbf
[ "MIT" ]
1
2019-12-24T08:39:18.000Z
2019-12-24T08:39:18.000Z
object JvNTEventLogMainForm: TJvNTEventLogMainForm Left = 248 Top = 128 Width = 630 Height = 400 Caption = 'Event Viewer' Color = clBtnFace Constraints.MinHeight = 400 Constraints.MinWidth = 630 DefaultMonitor = dmDesktop Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False Position = poDesktopCenter Scaled = False OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 object Splitter1: TSplitter Left = 89 Top = 38 Width = 4 Height = 328 Cursor = crHSplit end object ButtonsPanel: TPanel Left = 0 Top = 0 Width = 622 Height = 38 Align = alTop BevelOuter = bvNone TabOrder = 0 object btnRefresh: TButton Left = 9 Top = 6 Width = 75 Height = 25 Caption = 'Refresh' TabOrder = 0 end end object ListBox1: TListBox Left = 0 Top = 38 Width = 89 Height = 328 Align = alLeft ItemHeight = 13 TabOrder = 1 OnClick = ListBox1Click end object ListView1: TListView Left = 93 Top = 38 Width = 529 Height = 328 Align = alClient Columns = < item Caption = 'Type' Width = 60 end item Caption = 'Date' Width = 62 end item Caption = 'Time' Width = 60 end item Caption = 'Source' Width = 100 end item Caption = 'Category' Width = 55 end item Caption = 'Event' Width = 40 end item Caption = 'User' Width = 70 end item Caption = 'Computer' Width = 60 end> RowSelect = True SortType = stText TabOrder = 2 ViewStyle = vsReport end object JvNTEventLog1: TJvNTEventLog Active = False Left = 40 Top = 48 end end
18.301887
50
0.562887
f1a99d9d987326635bd79906f117840454fad965
898
pas
Pascal
samples/a8/bench/2ml-for-downto.pas
zbyti/Mad-Pascal
546cae9724828f93047080109488be7d0d07d47e
[ "MIT" ]
1
2021-12-15T23:47:19.000Z
2021-12-15T23:47:19.000Z
samples/a8/bench/2ml-for-downto.pas
michalkolodziejski/Mad-Pascal
0a7a1e2f379e50b0a23878b0d881ff3407269ed6
[ "MIT" ]
null
null
null
samples/a8/bench/2ml-for-downto.pas
michalkolodziejski/Mad-Pascal
0a7a1e2f379e50b0a23878b0d881ff3407269ed6
[ "MIT" ]
null
null
null
// 591 // Effectus auto-generated Mad Pascal source code listing program testPrg; uses Crt; const DL : array[0..8] of byte = ($70, $70, $70, $42, $E0, $00, $41, $00, $20); var A : byte absolute $E0; B : byte absolute $E1; C : byte absolute $E2; D : byte absolute $E3; E : byte absolute $E4; F : byte absolute $E5; G : byte absolute $E6; RT2 : byte absolute $14; RT1 : byte absolute $13; CHBAS : byte absolute $2F4; var SDLSTL : word absolute $230; procedure MAINProc; begin Move(pointer($E080), pointer($4000), 80); CHBAS := $40; SDLSTL := word(@DL); pause(1); RT1 := 0; RT2 := 0; for a:=1 downto 0 do for b:=9 downto 0 do for c:=9 downto 0 do for d:=9 downto 0 do for e:=9 downto 0 do for f:=9 downto 0 do for g:=9 downto 0 do ; TextMode(0); Write(RT1*256+RT2); repeat until false; end; begin MAINProc; end.
16.327273
75
0.594655
f102435c0635bfa43665827496ec73960d21cb56
1,024
pas
Pascal
Uteis/uDocumentacao.pas
reiinoldo/Prototipagem
1953dbe4796f1219c484095a9a6b67a85f52608a
[ "Apache-2.0" ]
null
null
null
Uteis/uDocumentacao.pas
reiinoldo/Prototipagem
1953dbe4796f1219c484095a9a6b67a85f52608a
[ "Apache-2.0" ]
null
null
null
Uteis/uDocumentacao.pas
reiinoldo/Prototipagem
1953dbe4796f1219c484095a9a6b67a85f52608a
[ "Apache-2.0" ]
null
null
null
unit uDocumentacao; interface uses System.Classes, uPropriedades, FMX.Dialogs; type TDocumentacao = class(TPersistent) private { Protected declarations } fVisibilidade: TVisibilidade; fTipo: String; fClasse: Boolean; fAtributo: Boolean; function TipoIsStored:Boolean; protected { Protected declarations } public { Public declarations } constructor create(AOwner: TPersistent); property Tipo: String read fTipo write fTipo stored TipoIsStored; property Classe: Boolean read fClasse write fClasse; property Atributo: Boolean read fAtributo write fAtributo; published { Published declarations } property Visibilidade: TVisibilidade read fVisibilidade write fVisibilidade; end; implementation { TDoc } constructor TDocumentacao.create(AOwner: TPersistent); begin Self.Visibilidade := Privado; Self.Tipo := CTipoOpcao; Self.fAtributo := True; end; function TDocumentacao.TipoIsStored: Boolean; begin Result := fTipo <> CTipoOpcao; end; end.
20.897959
80
0.744141
83843ef25bd457e3f7ee382c687674ac61730173
5,559
pas
Pascal
Lego/bricxcc/Translate.pas
jodosh/Personal
92c943b95d3a07789d5f24faf60d4708040e22cb
[ "MIT" ]
null
null
null
Lego/bricxcc/Translate.pas
jodosh/Personal
92c943b95d3a07789d5f24faf60d4708040e22cb
[ "MIT" ]
1
2017-09-18T14:15:00.000Z
2017-09-18T14:15:00.000Z
Lego/bricxcc/Translate.pas
jodosh/Personal
92c943b95d3a07789d5f24faf60d4708040e22cb
[ "MIT" ]
null
null
null
(* * 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 Initial Developer of this code is Mark Overmars. * Portions created by John Hansen are Copyright (C) 2009 John Hansen. * All Rights Reserved. * *) unit Translate; {$IFDEF FPC} {$MODE Delphi} {$ENDIF} interface uses SynEdit; procedure TranslateIt(TheEditor: TSynEdit); implementation uses SysUtils, Dialogs, Controls, Editor, uLocalizedStrings; const MAXWORD = 48; var oldwords: array[1..MAXWORD] of string = ( 'inline', 'wait', 'Sensor', 'SensorMode', 'SensorType', 'OutputMode', 'OutputDir', 'OutputPower', 'Fwd', 'Rev', 'PlayNote', 'Sleep', 'Display', 'SetDatalog', 'Datalog', 'IRMode', 'Input', 'InputType', 'InputMode', 'InputRaw', 'InputBool', 'IN_1', 'IN_2', 'IN_3', 'SMODE_RAW', 'SMODE_BOOL', 'SMODE_EDGE', 'SMODE_PULSE', 'SMODE_PERCENT', 'SMODE_CELSIUS', 'SMODE_FAHRENHEIT', 'SMODE_ANGLE', 'STYPE_SWITCH', 'STYPE_TEMP', 'STYPE_LIGHT', 'STYPE_ANGLE', 'IN_SWITCH', 'IN_LIGHT', 'IN_ANGLE', 'IN_PULSE', 'IN_EDGE', 'OUT_FLIP', 'IR_LO', 'IR_HI', 'IN_L', 'IN_M', 'IN_R', 'IN_CFG' ); var newwords: array[1..MAXWORD] of string = ( 'void', 'until', 'SetSensor', 'SetSensorMode', 'SetSensorType', 'SetOutput', 'SetDirection', 'SetPower', 'OldFwd', 'OldRev', 'PlayTone', 'Wait', 'SelectDisplay', 'CreateDatalog', 'AddToDatalog', 'SetTxPower', 'SensorValue', 'SensorType', 'SensorMode', 'SensorValueRaw', 'SensorValueBool', 'SENSOR_1', 'SENSOR_2', 'SENSOR_3', 'SENSOR_MODE_RAW', 'SENSOR_MODE_BOOL', 'SENSOR_MODE_EDGE', 'SENSOR_MODE_PULSE', 'SENSOR_MODE_PERCENT', 'SENSOR_MODE_CELSIUS', 'SENSOR_MODE_FAHRENHEIT', 'SENSOR_MODE_ROTATION', 'SENSOR_TYPE_TOUCH', 'SENSOR_TYPE_TEMPERATURE', 'SENSOR_TYPE_LIGHT', 'SENSOR_TYPE_ROTATION', 'SENSOR_TOUCH', 'SENSOR_LIGHT', 'SENSOR_ROTATION', 'SENSOR_PULSE', 'SENSOR_EDGE', 'OUT_TOGGLE', 'TX_POWER_LO', 'TX_POWER_HI', 'SENSOR_L', 'SENSOR_M', 'SENSOR_R', '_SENSOR_CFG' ); function IsKeyChar(ch:char):boolean; {Returns whether ch is a character in a keyword name} begin IsKeyChar := ((ch>= 'a') and (ch<= 'z')) or ((ch>= 'A') and (ch<= 'Z')) or ((ch>= '0') and (ch<= '9')) or (ch = '_'); end; function TranslateWord(str:string):string; {Translates the word} var i:integer; begin Result := str; for i:=1 to MAXWORD do if CompareStr(str,oldwords[i]) = 0 then begin Result:=newwords[i]; Exit; end; end; var is_comment:boolean = false; add_brackets:boolean = false; procedure TranslateLine(Ed:TSynEdit; l:integer); {Translate line l} var curpos:integer; {Current position in the line} str:string; {Copy of the current line} str2,str3:string; {Temporary string} ttt:integer; {Temporary index} begin if Ed.ReadOnly then Exit; if (l<0) or (l>=Ed.Lines.Count) then Exit; str:=Ed.Lines[l]; {Handle the line} curpos:=1; while curpos <= Length(str) do begin {Check for comment} if (curpos<Length(str)) and (str[curpos] = '*') and (str[curpos+1] = '/') then begin curpos := curpos+2; Is_Comment := false; end else if (curpos<Length(str)) and (str[curpos] = '/') and (str[curpos+1] = '*') then begin curpos := curpos+2; Is_Comment := true; end else if (Is_Comment) then curpos := curpos+1 else if (curpos<Length(str)) and (str[curpos] = '/') and (str[curpos+1] = '/') then curpos := Length(str)+1 else if IsKeyChar(str[curpos]) then begin ttt:=curpos; str2:=''; while (curpos <= Length(str)) and IsKeyChar(str[curpos]) do begin str2:=str2+str[curpos]; curpos:=curpos+1; end; str3:=TranslateWord(str2); Delete(str,ttt,curpos-ttt); Insert(str3,str,ttt); if (CompareStr(str3,'task') = 0) or (CompareStr(str3,'sub') = 0) or (CompareStr(str3,'void') = 0) then Add_Brackets := true else if Add_Brackets then begin Add_Brackets := false; Insert('()',str,ttt+ Length(str3)); end; curpos := ttt+ Length(str3)+1; end else curpos := curpos+1; end; Ed.Lines[l] := str; end; procedure TranslateIt(TheEditor: TSynEdit); var i:integer; begin if MessageDlg(S_TRANSLATE, mtConfirmation, [mbOK,mbCancel],0) = mrCancel then Exit; for i:=0 to TheEditor.Lines.Count-1 do TranslateLine(TheEditor,i); TheEditor.Lines.Insert(0,'#pragma noinit'); TheEditor.Lines.Insert(1,'#define OldFwd(a,b) do {OnFwd(a); SetPower(a,b);} while (false)'); TheEditor.Lines.Insert(2,'#define OldRev(a,b) do {OnRev(a); SetPower(a,b);} while (false)'); TheEditor.Lines.Insert(3,''); end; end.
23.555085
97
0.59633
85dd63a960cfe9454d32d25b153c3377e47f92a1
1,292
dfm
Pascal
Section 1/CODE/Video05/MainFormU.dfm
PacktPublishing/Delphi-Solutions---Part-2
8b9674aa8b4d0d3566d040568c5a0e5161848532
[ "MIT" ]
4
2019-07-14T03:56:44.000Z
2021-10-02T03:20:03.000Z
Section 1/CODE/Video05/MainFormU.dfm
PacktPublishing/Delphi-Solutions---Part-2
8b9674aa8b4d0d3566d040568c5a0e5161848532
[ "MIT" ]
1
2019-10-28T16:51:11.000Z
2019-10-28T16:51:11.000Z
Section 1/CODE/Video05/MainFormU.dfm
PacktPublishing/Delphi-Solutions---Part-2
8b9674aa8b4d0d3566d040568c5a0e5161848532
[ "MIT" ]
2
2020-01-28T09:02:21.000Z
2020-06-27T15:30:43.000Z
object MainForm: TMainForm Left = 0 Top = 0 Caption = 'TTask' ClientHeight = 217 ClientWidth = 343 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False DesignSize = ( 343 217) PixelsPerInch = 96 TextHeight = 13 object mmLog: TMemo Left = 86 Top = 8 Width = 249 Height = 201 Anchors = [akLeft, akTop, akRight, akBottom] ReadOnly = True TabOrder = 0 ExplicitWidth = 333 ExplicitHeight = 232 end object btnExceptionDef: TButton Left = 8 Top = 90 Width = 72 Height = 35 Caption = 'Exceptions (Default)' TabOrder = 1 WordWrap = True OnClick = btnExceptionDefClick end object btnRESTRequest: TButton Left = 8 Top = 131 Width = 72 Height = 35 Caption = 'REST Call' TabOrder = 2 OnClick = btnRESTRequestClick end object btnSimple: TButton Left = 8 Top = 8 Width = 72 Height = 35 Caption = 'Simple' TabOrder = 3 OnClick = btnSimpleClick end object btnWithException: TButton Left = 8 Top = 49 Width = 72 Height = 35 Caption = 'Exceptions' TabOrder = 4 OnClick = btnWithExceptionClick end end
19
48
0.622291
470b1af8264287298d10e083e764594671f84658
5,038
pas
Pascal
Source/ClientGuiCom/ControlPacks/BoldControllerListControlPackCom.pas
LenakeTech/BoldForDelphi
3ef25517d5c92ebccc097c6bc2f2af62fc506c71
[ "MIT" ]
121
2020-09-22T10:46:20.000Z
2021-11-17T12:33:35.000Z
Source/ClientGuiCom/ControlPacks/BoldControllerListControlPackCom.pas
LenakeTech/BoldForDelphi
3ef25517d5c92ebccc097c6bc2f2af62fc506c71
[ "MIT" ]
8
2020-09-23T12:32:23.000Z
2021-07-28T07:01:26.000Z
Source/ClientGuiCom/ControlPacks/BoldControllerListControlPackCom.pas
LenakeTech/BoldForDelphi
3ef25517d5c92ebccc097c6bc2f2af62fc506c71
[ "MIT" ]
42
2020-09-22T14:37:20.000Z
2021-10-04T10:24:12.000Z
unit BoldControllerListControlPackCom; {$DEFINE BOLDCOMCLIENT} {Clientified 2002-08-05 13:13:02} interface uses Classes, BoldControlPackDefs, BoldComObjectSpace_TLB, BoldClientElementSupport, BoldComClient, BoldControlPackCom, BoldListControlPackCom; type TBoldControllerListAsFollowerListRendererCom = class; TBoldControllerListCom = class; {---TBoldControllerListCom---} TBoldControllerListCom = class(TBoldAsFollowerListControllerCom) private FList: TList; function GetCount: Integer; function GetSubController(index: Integer): TBoldFollowerControllerCom; protected procedure DoMakeUptodateAndSubscribe(Follower: TBoldFollowerCom; Subscribe: Boolean); override; function GetEffectiveRenderer: TBoldRendererCom; override; function GetEffectiveDisplayPropertyListRenderer: TBoldControllerListAsFollowerListRendererCom; public constructor Create(aOwningComponent: TComponent); destructor Destroy; override; procedure Add(BoldFollowerController: TBoldFollowerControllerCom); procedure Delete(index: Integer); procedure Remove(BoldFollowerController: TBoldFollowerControllerCom); procedure Move(CurIndex, ToIndex: Integer); property Count: Integer read GetCount; property Items[index: Integer]: TBoldFollowerControllerCom read GetSubController; default; published property DragMode default bdgSelection; property DropMode default bdpInsert; end; {---TBoldControllerListAsFollowerListRendererCom---} TBoldControllerListAsFollowerListRendererCom = class(TBoldAsFollowerListRendererCom) public class function DefaultRenderer: TBoldControllerListAsFollowerListRendererCom; procedure MakeUptodate(Follower: TBoldFollowerCom; Element: IBoldElement); end; implementation uses SysUtils, BoldRev; var DefaultDisplayPropertyListRenderer: TBoldControllerListAsFollowerListRendererCom; {---TBoldControllerListCom---} constructor TBoldControllerListCom.Create(aOwningComponent: TComponent); begin inherited Create(aOwningComponent); FList := TList.Create; DragMode := bdgSelection; DropMode := bdpInsert; end; destructor TBoldControllerListCom.Destroy; var I: Integer; begin for I := 0 to Count - 1 do Items[I].Free; FreeAndNil(FList); inherited; end; procedure TBoldControllerListCom.DoMakeUptodateAndSubscribe(Follower: TBoldFollowerCom; Subscribe: Boolean); begin inherited DoMakeUptodateAndSubscribe(Follower, Subscribe); (EffectiveRenderer as TBoldControllerListAsFollowerListRendererCom).MakeUptodate(Follower, Follower.Element); if Subscribe and Assigned(Follower.Element) then {$IFDEF BOLDCOMCLIENT} // MakeUpToDate Follower.Element.SubscribeToExpression('', Follower.Subscriber.ClientId, Follower.Subscriber.SubscriberId, False, true); {$ELSE} Follower.Element.SubscribeToExpression('', Follower.Subscriber, False); {$ENDIF} end; function TBoldControllerListCom.GetSubController(index: Integer): TBoldFollowerControllerCom; begin Result := TBoldSingleFollowerControllerCom(FList[index]); end; procedure TBoldControllerListCom.Add(BoldFollowerController: TBoldFollowerControllerCom); begin FList.Add(BoldFollowerController); Changed; end; procedure TBoldControllerListCom.Remove(BoldFollowerController: TBoldFollowerControllerCom); begin FList.Remove(BoldFollowerController); Changed; end; procedure TBoldControllerListCom.Delete(index: Integer); begin Items[index].Free; FList.Delete(index); Changed; end; procedure TBoldControllerListCom.Move(CurIndex, ToIndex: Integer); begin FList.Move(CurIndex, ToIndex); Changed; end; function TBoldControllerListCom.GetCount: Integer; begin Result := FList.Count; end; function TBoldControllerListCom.GetEffectiveRenderer: TBoldRendererCom; begin Result := GetEffectiveDisplayPropertyListRenderer; end; function TBoldControllerListCom.GetEffectiveDisplayPropertyListRenderer: TBoldControllerListAsFollowerListRendererCom; begin Result := TBoldControllerListAsFollowerListRendererCom.DefaultRenderer; // currently always uses default. end; {---TBoldControllerListAsFollowerListRendererCom---} class function TBoldControllerListAsFollowerListRendererCom.DefaultRenderer: TBoldControllerListAsFollowerListRendererCom; begin Result := DefaultDisplayPropertyListRenderer; end; procedure TBoldControllerListAsFollowerListRendererCom.MakeUptodate(Follower: TBoldFollowerCom; Element: IBoldElement); var SourceList: TBoldControllerListCom; SourceIndex: Integer; DestList: TBoldFollowerListCom; begin DestList := Follower.RendererData as TBoldFollowerListCom; SourceList := Follower.Controller as TBoldControllerListCom; for sourceIndex := 0 to SourceList.Count-1 do DestList.EnsureFollower(SourceList, SourceIndex, Element, SourceList[SourceIndex]); DestList.PurgeEnd(SourceList, SourceList.Count); end; initialization DefaultDisplayPropertyListRenderer := TBoldControllerListAsFollowerListRendererCom.Create(nil); finalization FreeAndNil(DefaultDisplayPropertyListRenderer); end.
31.098765
124
0.819968
471ddf81f60b444df2b80087f318d777cbd6926b
1,366
pas
Pascal
PROG_ADMIN/MantCorre.pas
carlosthieme/FerrePOS
54232bb0e02e4f7383c8d99ec6a9112b4e95b10e
[ "Unlicense" ]
null
null
null
PROG_ADMIN/MantCorre.pas
carlosthieme/FerrePOS
54232bb0e02e4f7383c8d99ec6a9112b4e95b10e
[ "Unlicense" ]
null
null
null
PROG_ADMIN/MantCorre.pas
carlosthieme/FerrePOS
54232bb0e02e4f7383c8d99ec6a9112b4e95b10e
[ "Unlicense" ]
null
null
null
unit MantCorre; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, DBCtrls, Mask, Db, ExtCtrls, DBTables; type TMantCorrelativosForm = class(TForm) Panel1: TPanel; Correlativos: TTable; DSCorrelativos: TDataSource; Bevel1: TBevel; Bevel2: TBevel; Label1: TLabel; Label2: TLabel; Label3: TLabel; CorrelativosVALENOW: TFloatField; CorrelativosEGRESONOW: TFloatField; CorrelativosANTINOW: TFloatField; CorrelativosBOLETAINI: TFloatField; CorrelativosBOLETAFIN: TFloatField; CorrelativosBOLETASIG: TFloatField; CorrelativosFACTURAINI: TFloatField; CorrelativosFACTURAFIN: TFloatField; CorrelativosFACTURASIG: TFloatField; Label4: TLabel; Bevel3: TBevel; Label5: TLabel; Label6: TLabel; Label7: TLabel; DBEdit1: TDBEdit; DBEdit2: TDBEdit; DBEdit3: TDBEdit; DBEdit4: TDBEdit; DBEdit5: TDBEdit; DBEdit6: TDBEdit; DBEdit7: TDBEdit; DBNavigator1: TDBNavigator; BitBtn1: TBitBtn; procedure FormCreate(Sender: TObject); private { Private declarations } public { Public declarations } end; var MantCorrelativosForm: TMantCorrelativosForm; implementation {$R *.DFM} procedure TMantCorrelativosForm.FormCreate(Sender: TObject); begin Correlativos.Open; end; end.
22.032258
75
0.72328
6a91884f4cf0dd98d6667b763e2568e64e5d6659
520
pas
Pascal
URota.pas
jorge-1987/chameleon-capturerD
591d85789b7a833129630f0c862724b6a35e91f2
[ "MIT" ]
1
2019-11-20T02:29:04.000Z
2019-11-20T02:29:04.000Z
URota.pas
jorge-1987/chameleon-capturerD
591d85789b7a833129630f0c862724b6a35e91f2
[ "MIT" ]
null
null
null
URota.pas
jorge-1987/chameleon-capturerD
591d85789b7a833129630f0c862724b6a35e91f2
[ "MIT" ]
1
2019-11-20T02:29:04.000Z
2019-11-20T02:29:04.000Z
unit URota; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TFrmRota = class(TForm) RadioGroup1: TRadioGroup; Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var FrmRota: TFrmRota; implementation {$R *.dfm} procedure TFrmRota.Button1Click(Sender: TObject); begin FrmRota.Close; end; end.
15.757576
77
0.673077
85e56f14cb6b9f0cc0db24a4786a134f35ad0317
2,866
pas
Pascal
Source/Services/SQS/Base/Model/AWS.SQS.Model.UntagQueueRequest.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.UntagQueueRequest.pas
herux/aws-sdk-delphi
4ef36e5bfc536b1d9426f78095d8fda887f390b5
[ "Apache-2.0" ]
5
2021-09-01T09:31:16.000Z
2022-03-16T18:19:21.000Z
Source/Services/SQS/Base/Model/AWS.SQS.Model.UntagQueueRequest.pas
herux/aws-sdk-delphi
4ef36e5bfc536b1d9426f78095d8fda887f390b5
[ "Apache-2.0" ]
13
2021-07-29T02:41:16.000Z
2022-03-16T10:22:38.000Z
unit AWS.SQS.Model.UntagQueueRequest; interface uses Bcl.Types.Nullable, System.Generics.Collections, AWS.SQS.Model.Request; type TUntagQueueRequest = class; IUntagQueueRequest = interface function GetQueueUrl: string; procedure SetQueueUrl(const Value: string); function GetTagKeys: TList<string>; procedure SetTagKeys(const Value: TList<string>); function GetKeepTagKeys: Boolean; procedure SetKeepTagKeys(const Value: Boolean); function Obj: TUntagQueueRequest; function IsSetQueueUrl: Boolean; function IsSetTagKeys: Boolean; property QueueUrl: string read GetQueueUrl write SetQueueUrl; property TagKeys: TList<string> read GetTagKeys write SetTagKeys; property KeepTagKeys: Boolean read GetKeepTagKeys write SetKeepTagKeys; end; TUntagQueueRequest = class(TAmazonSQSRequest, IUntagQueueRequest) strict private FQueueUrl: Nullable<string>; FTagKeys: TList<string>; FKeepTagKeys: Boolean; function GetQueueUrl: string; procedure SetQueueUrl(const Value: string); function GetTagKeys: TList<string>; procedure SetTagKeys(const Value: TList<string>); function GetKeepTagKeys: Boolean; procedure SetKeepTagKeys(const Value: Boolean); strict protected function Obj: TUntagQueueRequest; public constructor Create; destructor Destroy; override; function IsSetQueueUrl: Boolean; function IsSetTagKeys: Boolean; property QueueUrl: string read GetQueueUrl write SetQueueUrl; property TagKeys: TList<string> read GetTagKeys write SetTagKeys; property KeepTagKeys: Boolean read GetKeepTagKeys write SetKeepTagKeys; end; implementation { TUntagQueueRequest } constructor TUntagQueueRequest.Create; begin inherited; FTagKeys := TList<string>.Create; end; destructor TUntagQueueRequest.Destroy; begin TagKeys := nil; inherited; end; function TUntagQueueRequest.Obj: TUntagQueueRequest; begin Result := Self; end; function TUntagQueueRequest.GetQueueUrl: string; begin Result := FQueueUrl.ValueOrDefault; end; procedure TUntagQueueRequest.SetQueueUrl(const Value: string); begin FQueueUrl := Value; end; function TUntagQueueRequest.IsSetQueueUrl: Boolean; begin Result := FQueueUrl.HasValue; end; function TUntagQueueRequest.GetTagKeys: TList<string>; begin Result := FTagKeys; end; procedure TUntagQueueRequest.SetTagKeys(const Value: TList<string>); begin if FTagKeys <> Value then begin if not KeepTagKeys then FTagKeys.Free; FTagKeys := Value; end; end; function TUntagQueueRequest.GetKeepTagKeys: Boolean; begin Result := FKeepTagKeys; end; procedure TUntagQueueRequest.SetKeepTagKeys(const Value: Boolean); begin FKeepTagKeys := Value; end; function TUntagQueueRequest.IsSetTagKeys: Boolean; begin Result := (FTagKeys <> nil) and (FTagKeys.Count > 0); end; end.
24.288136
75
0.763782
83a58acecd824d316634bd4f8dfcdbe3b9ae4a12
6,693
pas
Pascal
Components/PngComponents/Design/PngComponentEditors.pas
jaksco/cubicexplorer
7bf2513700477d753fd8ea1c6226ddab0175df91
[ "Condor-1.1" ]
1
2021-09-23T17:32:49.000Z
2021-09-23T17:32:49.000Z
Components/PngComponents/Design/PngComponentEditors.pas
jaksco/cubicexplorer
7bf2513700477d753fd8ea1c6226ddab0175df91
[ "Condor-1.1" ]
null
null
null
Components/PngComponents/Design/PngComponentEditors.pas
jaksco/cubicexplorer
7bf2513700477d753fd8ea1c6226ddab0175df91
[ "Condor-1.1" ]
null
null
null
unit PngComponentEditors; {$I ..\Include\Thany.inc} interface uses Windows, SysUtils, Forms, Classes, Controls, PngImageList, TypInfo, {$IFDEF THANY_COMPILER_6_UP} DesignIntf, DesignEditors, ColnEdit {$ELSE} DsgnIntf {$ENDIF}; type {$IFNDEF THANY_COMPILER_6_UP} IProperty = TPropertyEditor; IDesignerSelections = TDesignerSelectionList; IDesigner = IFormDesigner; TThanyComponentEditor = class(TComponentEditor) public function GetComponent: TComponent; end; {$ELSE} TThanyComponentEditor = TComponentEditor; {$ENDIF} TPngImageListEditor = class(TThanyComponentEditor) public function GetVerbCount: Integer; override; function GetVerb(Index: Integer): string; override; procedure ExecuteVerb(Index: Integer); override; procedure Edit; override; end; TPngImageCollectionEditor = class(TThanyComponentEditor) public procedure Edit; override; function GetVerbCount: Integer; override; function GetVerb(Index: Integer): string; override; procedure ExecuteVerb(Index: Integer); override; end; TPngButtonEditor = class(TThanyComponentEditor) public function GetVerbCount: Integer; override; function GetVerb(Index: Integer): string; override; procedure ExecuteVerb(Index: Integer); override; procedure Edit; override; end; TPngImageListImagesEditor = class(TStringProperty) public function GetValue: string; override; function GetAttributes: TPropertyAttributes; override; procedure Edit; override; end; TPngImageCollectionItemsEditor = class(TPngImageListImagesEditor) public procedure Edit; override; end; TEditProperty = class private FPropery: string; procedure EnumProperty({$IFDEF THANY_COMPILER_6_UP}const{$ENDIF} Prop: IProperty); public constructor Create(Component: TComponent; const Prop: string; Designer: IDesigner); end; implementation uses PngImageListEditor; //This type is neccesary to be able to call CopyPngs without having to make it //public in the TPngImageList class. type TPngImageListAccess = class(TPngImageList) public procedure CopyPngs; override; end; procedure EditProperty(Component: TComponent; const Prop: string; Designer: IDesigner); begin TEditProperty.Create(Component, Prop, Designer).Free; end; { TPngImageListAccess } procedure TPngImageListAccess.CopyPngs; begin inherited CopyPngs; end; { TPngImageListEditor } procedure TPngImageListEditor.Edit; var Component: TPngImageList; begin Component := GetComponent as TPngImageList; EditProperty(Component, 'PngImages', Designer); end; procedure TPngImageListEditor.ExecuteVerb(Index: Integer); begin case Index of 0: Edit; 1: begin TPngImageListAccess(GetComponent).CopyPngs; MessageBox(0, 'The PNG objects have been copied to the internal imagelist.', PChar(string(GetComponent.ClassName)), MB_ICONINFORMATION or MB_OK); end; end; end; function TPngImageListEditor.GetVerb(Index: Integer): string; begin case Index of 0: Result := '&Edit images...'; 1: Result := '&Recreate images...'; end; end; function TPngImageListEditor.GetVerbCount: Integer; begin Result := 2; end; { TPngImageCollectionEditor } procedure TPngImageCollectionEditor.Edit; var Component: TPngImageCollection; begin Component := GetComponent as TPngImageCollection; EditProperty(Component, 'Items', Designer); end; procedure TPngImageCollectionEditor.ExecuteVerb(Index: Integer); begin Edit; end; function TPngImageCollectionEditor.GetVerb(Index: Integer): string; begin Result := '&Edit images...'; end; function TPngImageCollectionEditor.GetVerbCount: Integer; begin Result := 1; end; { TPngButtonEditor } procedure TPngButtonEditor.ExecuteVerb(Index: Integer); begin EditProperty(GetComponent, 'PngImage', Designer); end; function TPngButtonEditor.GetVerb(Index: Integer): string; begin Result := '&Edit image...'; end; function TPngButtonEditor.GetVerbCount: Integer; begin Result := 1; end; procedure TPngButtonEditor.Edit; begin EditProperty(GetComponent, 'OnClick', Designer); end; { TD5ComponentEditor } {$IFNDEF THANY_COMPILER_6_UP} function TThanyComponentEditor.GetComponent: TComponent; begin Result := Component; end; {$ENDIF} { TEditProperty } {$IFDEF THANY_COMPILER_6_UP} constructor TEditProperty.Create(Component: TComponent; const Prop: string; Designer: IDesigner); var Components: IDesignerSelections; begin inherited Create; FPropery := Prop; Components := TDesignerSelections.Create; Components.Add(Component); GetComponentProperties(Components, tkAny, Designer, EnumProperty); end; {$ELSE} constructor TEditProperty.Create(Component: TComponent; const Prop: string; Designer: IDesigner); var Components: TDesignerSelectionList; begin inherited Create; FPropery := Prop; Components := TDesignerSelectionList.Create; try Components.Add(Component); GetComponentProperties(Components, tkAny, Designer, EnumProperty); finally Components.Free; end; end; {$ENDIF} procedure TEditProperty.EnumProperty({$IFDEF THANY_COMPILER_6_UP}const{$ENDIF} Prop: IProperty); begin if Prop.GetName = FPropery then Prop.Edit; end; { TPngImageListImagesEditor } procedure TPngImageListImagesEditor.Edit; var ImageList: TPngImageList; begin with TPngImageListEditorDlg.Create(nil) do begin ImageList := TPngImageList(Self.GetComponent(0)); Caption := 'Editing ' + ImageList.Name + '.' + Self.GetName; Images.Items.Assign(ImageList.PngImages); ImageWidth := ImageList.Width; ImageHeight := ImageList.Height; if ShowModal = mrOK then begin ImageList.PngImages.Assign(Images.Items); Self.Designer.Modified; end; end; end; function TPngImageListImagesEditor.GetAttributes: TPropertyAttributes; begin Result := inherited GetAttributes + [paDialog, paReadOnly]; end; function TPngImageListImagesEditor.GetValue: string; begin Result := '(PNG images)'; end; { TPngImageCollectionItemsEditor } procedure TPngImageCollectionItemsEditor.Edit; var Collection: TPngImageCollection; begin with TPngImageListEditorDlg.Create(nil) do begin Collection := TPngImageCollection(Self.GetComponent(0)); Caption := 'Editing ' + Collection.Name + '.' + Self.GetName; Images.Items.Assign(Collection.Items); if ShowModal = mrOK then begin Collection.Items.Assign(Images.Items); Self.Designer.Modified; end; end; end; end.
24.25
154
0.731511
f1781798ce1d39c9cc14ae54f01e3f3f66ec103e
30,232
pas
Pascal
src/ce_common.pas
gzwplato/Coedit
4de6100c8e6f7d0292c8d441253f4a7ab2dc813b
[ "BSL-1.0" ]
null
null
null
src/ce_common.pas
gzwplato/Coedit
4de6100c8e6f7d0292c8d441253f4a7ab2dc813b
[ "BSL-1.0" ]
null
null
null
src/ce_common.pas
gzwplato/Coedit
4de6100c8e6f7d0292c8d441253f4a7ab2dc813b
[ "BSL-1.0" ]
1
2018-06-28T23:45:14.000Z
2018-06-28T23:45:14.000Z
unit ce_common; {$I ce_defines.inc} interface uses Classes, SysUtils, {$IFDEF WINDOWS} Windows, JwaTlHelp32, registry, {$ELSE} ExtCtrls, FileUtil, LazFileUtils, {$ENDIF} {$IFNDEF CEBUILD} forms, {$ENDIF} process, asyncprocess, ghashmap, ghashset, LCLIntf; const exeExt = {$IFDEF WINDOWS} '.exe' {$ELSE} '' {$ENDIF}; objExt = {$IFDEF WINDOWS} '.obj' {$ELSE} '.o' {$ENDIF}; libExt = {$IFDEF WINDOWS} '.lib' {$ELSE} '.a' {$ENDIF}; dynExt = {$IFDEF WINDOWS} '.dll' {$ENDIF} {$IFDEF LINUX}'.so'{$ENDIF} {$IFDEF DARWIN}'.dylib'{$ENDIF}; type TIndentationMode = (imSpaces, imTabs); THasMain = (mainNo, mainYes, mainDefaultBehavior); TCECompiler = (dmd, gdc, ldc); // function used as string hasher in fcl-stl TStringHash = class class function hash(const key: string; maxBucketsPow2: longword): longword; end; // HashMap for TValue by string generic TStringHashMap<TValue> = class(specialize THashmap<string, TValue, TStringHash>); // function used as object ptr hasher in fcl-stl TObjectHash = class class function hash(key: TObject; maxBucketsPow2: longword): longword; end; // HashSet for any object generic TObjectHashSet<TValue: TObject> = class(specialize THashSet<TValue, TObjectHash>); // Used instead of TStringList when the usage would mostly be ".IndexOf" TStringHashSet = class(specialize THashSet<string, TStringHash>); // aliased to get a custom prop inspector TCEPathname = type string; TCEFilename = type string; TCEEditEvent = type boolean; // sugar for classes TObjectHelper = class helper for TObject function isNil: boolean; function isNotNil: boolean; end; // sugar for pointers TPointerHelper = type helper for Pointer function isNil: boolean; function isNotNil: boolean; end; // sugar for strings TStringHelper = type helper for string function isEmpty: boolean; function isNotEmpty: boolean; function isBlank: boolean; function extractFileName: string; function extractFileExt: string; function extractFilePath: string; function extractFileDir: string; function fileExists: boolean; function dirExists: boolean; function upperCase: string; function length: integer; function toIntNoExcept(default: integer = -1): integer; function toInt: integer; end; (** * TProcess with assign() 'overriden'. *) TProcessEx = class helper for TProcess public procedure Assign(value: TPersistent); end; (** * CollectionItem used to store a shortcut. *) TCEPersistentShortcut = class(TCollectionItem) private fShortcut: TShortCut; fActionName: string; published property shortcut: TShortCut read fShortcut write fShortcut; property actionName: string read fActionName write fActionName; public procedure assign(value: TPersistent); override; end; (** * Save a component with a readable aspect. *) procedure saveCompToTxtFile(value: TComponent; const fname: string); (** * Load a component. Works in pair with saveCompToTxtFile(). *) procedure loadCompFromTxtFile(value: TComponent; const fname: string; notFoundClbck: TPropertyNotFoundEvent = nil; errorClbck: TReaderError = nil); (** * Converts a relative path to an absolute path. *) function expandFilenameEx(const basePath, fname: string): string; (** * Patches the directory separators from a string. * This is used to ensure that a project saved on a platform can be loaded * on another one. *) function patchPlateformPath(const path: string): string; procedure patchPlateformPaths(const paths: TStrings); (** * Patches the file extension from a string. * This is used to ensure that a project saved on a platform can be loaded * on another one. Note that the ext which are handled are specific to coedit projects. *) function patchPlateformExt(const fname: string): string; (** * Returns aFilename without its extension. *) function stripFileExt(const fname: string): string; (** * Returns an unique object identifier, based on its heap address. *) function uniqueObjStr(const value: TObject): string; (** * Reduces a filename if its length is over the threshold defined by charThresh. * Even if the result is not usable anymore, it avoids any "visually-overloaded" MRU menu. *) function shortenPath(const path: string; thresh: Word = 60): string; (** * Returns the user data dir. *) function getUserDataPath: string; (** * Returns the folder where Coedit stores the data, the cache, the settings. *) function getCoeditDocPath: string; (** * Fills aList with the names of the files located in aPath. *) procedure listFiles(list: TStrings; const path: string; recursive: boolean = false); (** * Fills aList with the names of the folders located in aPath. *) procedure listFolders(list: TStrings; const path: string); (** * Returns true if aPath contains at least one sub-folder. *) function hasFolder(const path: string): boolean; (** * Fills aList with the system drives. *) procedure listDrives(list: TStrings); (** * If aPath ends with an asterisk then fills aList with the names of the files located in aPath. * Returns true if aPath was 'asterisk-ifyed'. *) function listAsteriskPath(const path: string; list: TStrings; exts: TStrings = nil): boolean; (** * Lets the shell open a file. *) function shellOpen(const fname: string): boolean; (** * Returns true if anExeName can be spawn without its full path. *) function exeInSysPath(fname: string): boolean; (** * Returns the full path to anExeName. Works if exeInSysPath() returns true. *) function exeFullName(fname: string): string; (** * Clears then fills aList with aProcess output stream. *) procedure processOutputToStrings(process: TProcess; list: TStrings); (** * Copy available process output to a stream. *) procedure processOutputToStream(process: TProcess; output: TMemoryStream); (** * Terminates and frees aProcess. *) procedure killProcess(var process: TAsyncProcess); (** * Ensures that the i/o process pipes are not redirected if it waits on exit. *) procedure ensureNoPipeIfWait(process: TProcess); (** * Returns true if ExeName is already running. *) function AppIsRunning(const fname: string):Boolean; (** * Returns the length of the line ending in fname. *) function getLineEndingLength(const fname: string): byte; (** * Returns the length of the line ending for the current platform. *) function getSysLineEndLen: byte; (** * Returns the common folder of the file names stored in aList. *) function commonFolder(const files: TStringList): string; (** * Returns true if ext matches a file extension whose type is highlightable. *) function hasDlangSyntax(const ext: string): boolean; (** * Returns true if ext matches a file extension whose type can be passed as source. *) function isDlangCompilable(const ext: string): boolean; (** * Returns true if ext matches a file extension whose type is editable in Coedit. *) function isEditable(const ext: string): boolean; (** * Returns true if str starts with a semicolon or a double slash. * This is used to disable TStringList items in several places *) function isStringDisabled(const str: string): boolean; (** * Indicates wether str is only made of blank characters *) function isBlank(const str: string): boolean; (** * Converts a global match expression to a regular expression. * Limitation: Windows style, negation of set not handled [!a-z] [!abc] *) function globToReg(const glob: string ): string; (** * Detects the main indetation mode used in a file *) function indentationMode(strings: TStrings): TIndentationMode; (** * Detects the main indetation mode used in a file *) function indentationMode(const fname: string): TIndentationMode; (** * like LCLIntf eponymous function but includes a woraround that's gonna * be in Lazarus from version 1.8 (anchor + file:/// protocol under win). *) function openUrl(const value: string): boolean; var // supplementatl directories to find background tools additionalPath: string; implementation uses ce_main; class function TStringHash.hash(const key: string; maxBucketsPow2: longword): longword; var i: integer; begin {$PUSH}{$R-} {$Q-} result := 2166136261; for i:= 1 to key.length do begin result := result xor Byte(key[i]); result *= 16777619; end; result := result and (maxBucketsPow2-1); {$POP} end; class function TObjectHash.hash(key: TObject; maxBucketsPow2: longword): longword; var ptr: PByte; i: integer; begin {$PUSH}{$R-} {$Q-} ptr := PByte(key); result := 2166136261; {$IFDEF CPU32} for i:= 0 to 3 do {$ELSE} for i:= 0 to 7 do {$ENDIF} begin result := result xor ptr^; result *= 16777619; ptr += 1; end; result := result and (maxBucketsPow2-1); {$POP} end; procedure TCEPersistentShortcut.assign(value: TPersistent); var src: TCEPersistentShortcut; begin if value is TCEPersistentShortcut then begin src := TCEPersistentShortcut(value); fActionName := src.fActionName; fShortcut := src.fShortcut; end else inherited; end; function TObjectHelper.isNil: boolean; begin exit(self = nil); end; function TObjectHelper.isNotNil: boolean; begin exit(self <> nil); end; function TPointerHelper.isNil: boolean; begin exit(self = nil); end; function TPointerHelper.isNotNil: boolean; begin exit(self <> nil); end; function TStringHelper.isEmpty: boolean; begin exit(self = ''); end; function TStringHelper.isNotEmpty: boolean; begin exit(self <> ''); end; function TStringHelper.isBlank: boolean; begin exit(ce_common.isBlank(self)); end; function TStringHelper.extractFileName: string; begin exit(sysutils.extractFileName(self)); end; function TStringHelper.extractFileExt: string; begin exit(sysutils.extractFileExt(self)); end; function TStringHelper.extractFilePath: string; begin exit(sysutils.extractFilePath(self)); end; function TStringHelper.extractFileDir: string; begin exit(sysutils.extractFileDir(self)); end; function TStringHelper.fileExists: boolean; begin exit(sysutils.FileExists(self)); end; function TStringHelper.dirExists: boolean; begin exit(sysutils.DirectoryExists(self)); end; function TStringHelper.upperCase: string; begin exit(sysutils.upperCase(self)); end; function TStringHelper.length: integer; begin exit(system.length(self)); end; function TStringHelper.toInt: integer; begin exit(strToInt(self)); end; function TStringHelper.toIntNoExcept(default: integer = -1): integer; begin exit(StrToIntDef(self, default)); end; procedure TProcessEx.Assign(value: TPersistent); var src: TProcess; begin if value is TProcess then begin src := TProcess(value); PipeBufferSize := src.PipeBufferSize; Active := src.Active; Executable := src.Executable; Parameters := src.Parameters; ConsoleTitle := src.ConsoleTitle; CurrentDirectory := src.CurrentDirectory; Desktop := src.Desktop; Environment := src.Environment; Options := src.Options; Priority := src.Priority; StartupOptions := src.StartupOptions; ShowWindow := src.ShowWindow; WindowColumns := src.WindowColumns; WindowHeight := src.WindowHeight; WindowLeft := src.WindowLeft; WindowRows := src.WindowRows; WindowTop := src.WindowTop; WindowWidth := src.WindowWidth; FillAttribute := src.FillAttribute; XTermProgram := src.XTermProgram; end else inherited; end; procedure saveCompToTxtFile(value: TComponent; const fname: string); var str1, str2: TMemoryStream; begin str1 := TMemoryStream.Create; str2 := TMemoryStream.Create; try str1.WriteComponent(value); str1.Position := 0; ObjectBinaryToText(str1,str2); ForceDirectories(fname.extractFilePath); str2.SaveToFile(fname); finally str1.Free; str2.Free; end; end; procedure loadCompFromTxtFile(value: TComponent; const fname: string; notFoundClbck: TPropertyNotFoundEvent = nil; errorClbck: TReaderError = nil); var str1, str2: TMemoryStream; rdr: TReader; begin str1 := TMemoryStream.Create; str2 := TMemoryStream.Create; try str1.LoadFromFile(fname); str1.Position := 0; ObjectTextToBinary(str1, str2); str2.Position := 0; try rdr := TReader.Create(str2, 4096); try rdr.OnPropertyNotFound := notFoundClbck; rdr.OnError := errorClbck; rdr.ReadRootComponent(value); finally rdr.Free; end; except end; finally str1.Free; str2.Free; end; end; function expandFilenameEx(const basePath, fname: string): string; var curr: string = ''; begin getDir(0, curr); try if (curr <> basePath) and basePath.dirExists then chDir(basePath); result := expandFileName(fname); finally chDir(curr); end; end; function patchPlateformPath(const path: string): string; function patchProc(const src: string; const invalid: char): string; var i: Integer; dir: string; begin dir := ExtractFileDrive(src); if dir.length > 0 then result := src[dir.length+1..src.length] else result := src; i := pos(invalid, result); if i <> 0 then begin repeat result[i] := directorySeparator; i := pos(invalid,result); until i = 0; end; result := dir + result; end; begin result := path; {$IFDEF WINDOWS} result := patchProc(result, '/'); {$ELSE} result := patchProc(result, '\'); {$ENDIF} end; procedure patchPlateformPaths(const paths: TStrings); var i: Integer; str: string; begin for i:= 0 to paths.Count-1 do begin str := paths[i]; paths[i] := patchPlateformPath(str); end; end; function patchPlateformExt(const fname: string): string; var ext, newext: string; begin ext := fname.extractFileExt; newext := ''; {$IFDEF MSWINDOWS} case ext of '.so': newext := '.dll'; '.dylib': newext := '.dll'; '.a': newext := '.lib'; '.o': newext := '.obj'; else newext := ext; end; {$ENDIF} {$IFDEF LINUX} case ext of '.dll': newext := '.so'; '.dylib': newext := '.so'; '.lib': newext := '.a'; '.obj': newext := '.o'; '.exe': newext := ''; else newext := ext; end; {$ENDIF} {$IFDEF DARWIN} case ext of '.dll': newext := '.dylib'; '.so': newext := '.dylib'; '.lib': newext := '.a'; '.obj': newext := '.o'; '.exe': newext := ''; else newext := ext; end; {$ENDIF} result := ChangeFileExt(fname, newext); end; function stripFileExt(const fname: string): string; begin if Pos('.', fname) > 1 then exit(ChangeFileExt(fname, '')) else exit(fname); end; function uniqueObjStr(const value: TObject): string; begin {$PUSH}{$HINTS OFF}{$WARNINGS OFF}{$R-} exit( format('%.8X',[NativeUint(value)])); {$POP} end; function shortenPath(const path: string; thresh: Word = 60): string; var i: NativeInt; sepCnt: integer = 0; drv: string; pth1: string; begin if path.length <= thresh then exit(path); drv := extractFileDrive(path); i := path.length; while(i <> drv.length+1) do begin Inc(sepCnt, Byte(path[i] = directorySeparator)); if sepCnt = 2 then break; Dec(i); end; pth1 := path[i..path.length]; exit(format('%s%s...%s', [drv, directorySeparator, pth1])); end; function getUserDataPath: string; begin {$IFDEF WINDOWS} result := sysutils.GetEnvironmentVariable('APPDATA'); {$ENDIF} {$IFDEF LINUX} result := sysutils.GetEnvironmentVariable('HOME') + '/.config'; {$ENDIF} {$IFDEF DARWIN} result := sysutils.GetEnvironmentVariable('HOME') + '/Library/Application Support'; {$ENDIF} if not DirectoryExists(result) then raise Exception.Create('Coedit failed to retrieve the user data folder'); if result[result.length] <> DirectorySeparator then result += directorySeparator; end; function getCoeditDocPath: string; begin result := getUserDataPath + 'Coedit' + directorySeparator; end; function isFolder(sr: TSearchRec): boolean; begin result := (sr.Name <> '.') and (sr.Name <> '..' ) and (sr.Name <> '' ) and (sr.Attr and faDirectory = faDirectory); end; procedure listFiles(list: TStrings; const path: string; recursive: boolean = false); var sr: TSearchrec; procedure tryAdd; begin if sr.Attr and faDirectory <> faDirectory then list.Add(path+ directorySeparator + sr.Name); end; begin if findFirst(path + directorySeparator + '*', faAnyFile, sr) = 0 then try repeat tryAdd; if recursive then if isFolder(sr) then listFiles(list, path + directorySeparator + sr.Name, recursive); until findNext(sr) <> 0; finally sysutils.FindClose(sr); end; end; procedure listFolders(list: TStrings; const path: string); var sr: TSearchrec; begin if findFirst(path + '*', faAnyFile, sr) = 0 then try repeat if isFolder(sr) then list.Add(path + sr.Name); until findNext(sr) <> 0; finally sysutils.FindClose(sr); end; end; function hasFolder(const path: string): boolean; var sr: TSearchrec; res: boolean; begin res := false; if findFirst(path + directorySeparator + '*', faDirectory, sr) = 0 then try repeat if isFolder(sr) then begin res := true; break; end; until findNext(sr) <> 0; finally sysutils.FindClose(sr); end; result := res; end; function listAsteriskPath(const path: string; list: TStrings; exts: TStrings = nil): boolean; var pth, ext, fname: string; files: TStringList; begin result := false; if path.isEmpty then exit; // if path[path.length] = '*' then begin pth := path[1..path.length-1]; if pth[pth.length] in ['/', '\'] then pth := pth[1..pth.length-1]; if not pth.dirExists then exit(false); // files := TStringList.Create; try listFiles(files, pth, true); for fname in files do begin if exts = nil then list.Add(fname) else begin ext := fname.extractFileExt; if exts.IndexOf(ext) <> -1 then list.Add(fname); end; end; finally files.Free; end; exit(true); end; exit(false); end; procedure listDrives(list: TStrings); {$IFDEF WINDOWS} var drv: char; ltr, nme: string; OldMode : Word; {$ENDIF} begin {$IFDEF WINDOWS} setLength(nme, 255); OldMode := SetErrorMode(SEM_FAILCRITICALERRORS); try for drv := 'A' to 'Z' do begin try ltr := drv + ':\'; if not GetVolumeInformation(PChar(ltr), PChar(nme), 255, nil, nil, nil, nil, 0) then continue; case GetDriveType(PChar(ltr)) of DRIVE_REMOVABLE, DRIVE_FIXED, DRIVE_REMOTE: list.Add(ltr); end; except // SEM_FAILCRITICALERRORS: exception is sent to application. end; end; finally SetErrorMode(OldMode); end; {$ELSE} list.Add('//'); {$ENDIF} end; function shellOpen(const fname: string): boolean; begin {$IFDEF WINDOWS} result := ShellExecute(0, 'OPEN', PChar(fname), nil, nil, SW_SHOW) > 32; {$ENDIF} {$IFDEF LINUX} with TProcess.Create(nil) do try Executable := 'xdg-open'; Parameters.Add(fname); Execute; finally result := true; Free; end; {$ENDIF} {$IFDEF DARWIN} with TProcess.Create(nil) do try Executable := 'open'; Parameters.Add(aFilename); Execute; finally result := true; Free; end; {$ENDIF} end; function exeInSysPath(fname: string): boolean; begin exit(exeFullName(fname) <> ''); end; function exeFullName(fname: string): string; var ext: string; env: string; begin ext := fname.extractFileExt; if ext.isEmpty then fname += exeExt; //full path already specified if fname.fileExists and (not fname.extractFileName.fileExists) then exit(fname); // env := sysutils.GetEnvironmentVariable('PATH'); // maybe in current dir if fname.fileExists then env += PathSeparator + GetCurrentDir; if additionalPath.isNotEmpty then env += PathSeparator + additionalPath; {$IFNDEF CEBUILD} if Application <> nil then env += PathSeparator + ExtractFileDir(application.ExeName.ExtractFilePath); {$ENDIF} exit(ExeSearch(fname, env)); end; procedure processOutputToStrings(process: TProcess; list: TStrings); var str: TMemoryStream; sum: Integer = 0; cnt: Integer; buffSz: Integer; begin if not (poUsePipes in process.Options) then exit; // // note: list.LoadFromStream() does not work, lines can be split, which breaks message parsing (e.g filename detector). // { Split lines: ------------ The problem comes from TAsynProcess.OnReadData. When the output is read in the event, it does not always finish on a full line. Resolution: ----------- in TAsynProcess.OnReadData Accumulate avalaible output in a stream. Detects last line terminator in the accumation. Load TStrings from this stream range. } str := TMemoryStream.Create; try buffSz := process.PipeBufferSize; // temp fix: messages are cut if the TAsyncProcess version is used on simple TProcess. if process is TAsyncProcess then begin while process.Output.NumBytesAvailable <> 0 do begin str.SetSize(sum + buffSz); cnt := process.Output.Read((str.Memory + sum)^, buffSz); sum += cnt; end; end else begin repeat str.SetSize(sum + buffSz); cnt := process.Output.Read((str.Memory + sum)^, buffSz); sum += cnt; until cnt = 0; end; str.Size := sum; list.LoadFromStream(str); finally str.Free; end; end; procedure processOutputToStream(process: TProcess; output: TMemoryStream); var sum, cnt: Integer; const buffSz = 2048; begin if not (poUsePipes in process.Options) then exit; // sum := output.Size; while process.Output.NumBytesAvailable <> 0 do begin output.SetSize(sum + buffSz); cnt := process.Output.Read((output.Memory + sum)^, buffSz); sum += cnt; end; output.SetSize(sum); output.Position := sum; end; procedure killProcess(var process: TAsyncProcess); begin if process = nil then exit; if process.Running then process.Terminate(0); process.Free; process := nil; end; procedure ensureNoPipeIfWait(process: TProcess); begin if not (poWaitonExit in process.Options) then exit; process.Options := process.Options - [poStderrToOutPut, poUsePipes]; end; function getLineEndingLength(const fname: string): byte; var value: char = #0; le: string = LineEnding; begin result := le.length; if not fileExists(fname) then exit; with TMemoryStream.Create do try LoadFromFile(fname); while true do begin if Position = Size then exit; read(value,1); if value = #10 then exit(1); if value = #13 then exit(2); end; finally Free; end; end; function getSysLineEndLen: byte; begin {$IFDEF WINDOWS} exit(2); {$ELSE} exit(1); {$ENDIF} end; function countFolder(fname: string): integer; var parent: string; begin result := 0; while(true) do begin parent := fname.extractFileDir; if parent = fname then exit; fname := parent; result += 1; end; end; //TODO-cfeature: make it working with relative paths function commonFolder(const files: TStringList): string; var i,j,k: integer; sink: TStringList; dir: string; cnt: integer; begin result := ''; if files.Count = 0 then exit; sink := TStringList.Create; try sink.Assign(files); for i := sink.Count-1 downto 0 do if (not sink[i].fileExists) and (not sink[i].dirExists) then sink.Delete(i); // folders count cnt := 256; for dir in sink do begin k := countFolder(dir); if k < cnt then cnt := k; end; for i := sink.Count-1 downto 0 do begin while (countFolder(sink[i]) <> cnt) do sink[i] := sink[i].extractFileDir; end; // common folder while true do begin for i := sink.Count-1 downto 0 do begin dir := sink[i].extractFileDir; j := sink.IndexOf(dir); if j = -1 then sink[i] := dir else if j <> i then sink.Delete(i); end; if sink.Count < 2 then break; end; if sink.Count = 0 then result := '' else result := sink[0]; finally sink.free; end; end; {$IFDEF WINDOWS} function internalAppIsRunning(const ExeName: string): integer; var ContinueLoop: BOOL; FSnapshotHandle: THandle; FProcessEntry32: TProcessEntry32; begin FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); FProcessEntry32.dwSize := SizeOf(FProcessEntry32); ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32); Result := 0; while integer(ContinueLoop) <> 0 do begin if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) = UpperCase(ExeName)) or (UpperCase(FProcessEntry32.szExeFile) = UpperCase(ExeName))) then begin Inc(Result); // SendMessage(Exit-Message) possible? end; ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32); end; CloseHandle(FSnapshotHandle); end; {$ENDIF} {$IFDEF LINUX} function internalAppIsRunning(const ExeName: string): integer; var proc: TProcess; lst: TStringList; begin Result := 0; proc := tprocess.Create(nil); proc.Executable := 'ps'; proc.Parameters.Add('-C'); proc.Parameters.Add(ExeName); proc.Options := [poUsePipes, poWaitonexit]; try proc.Execute; lst := TStringList.Create; try lst.LoadFromStream(proc.Output); Result := Pos(ExeName, lst.Text); finally lst.Free; end; finally proc.Free; end; end; {$ENDIF} {$IFDEF DARWIN} function internalAppIsRunning(const ExeName: string): integer; var proc: TProcess; lst: TStringList; begin Result := 0; proc := tprocess.Create(nil); proc.Executable := 'pgrep'; proc.Parameters.Add(ExeName); proc.Options := [poUsePipes, poWaitonexit]; try proc.Execute; lst := TStringList.Create; try lst.LoadFromStream(proc.Output); Result := StrToIntDef(Trim(lst.Text), 0); finally lst.Free; end; finally proc.Free; end; end; {$ENDIF} function AppIsRunning(const fname: string):Boolean; begin Result:= internalAppIsRunning(fname) > 0; end; function hasDlangSyntax(const ext: string): boolean; begin result := false; case ext of '.d', '.di': result := true; end; end; function isDlangCompilable(const ext: string): boolean; begin result := false; case ext of '.d', '.di', '.dd', '.obj', '.o', '.a', '.lib': result := true; end; end; function isEditable(const ext: string): boolean; begin result := false; case ext of '.d', '.di', '.dd', '.lst', '.md', '.txt', '.map': result := true; end; end; function isStringDisabled(const str: string): boolean; begin result := false; if str.isEmpty then exit; if str[1] = ';' then result := true; if (str.length > 1) and (str[1..2] = '//') then result := true; end; function isBlank(const str: string): boolean; var c: char; begin result := true; for c in str do if not (c in [#9, ' ']) then exit(false); end; function globToReg(const glob: string ): string; procedure quote(var r: string; c: char); begin if not (c in ['a'..'z', 'A'..'Z', '0'..'9', '_', '-']) then r += '\'; r += c; end; var i: integer = 0; b: integer = 0; begin result := '^'; while i < length(glob) do begin i += 1; case glob[i] of '*': result += '.*'; '?': result += '.'; '[', ']': result += glob[i]; '{': begin b += 1; result += '('; end; '}': begin b -= 1; result += ')'; end; ',': begin if b > 0 then result += '|' else quote(result, glob[i]); end; else quote(result, glob[i]); end; end; end; function indentationMode(strings: TStrings): TIndentationMode; var i: integer; s: string; tabs: integer = 0; spcs: integer = 0; begin for s in strings do for i := 1 to s.length do begin case s[i] of #9: tabs += 1; ' ': spcs += 1; else break; end; end; if spcs >= tabs then result := imSpaces else result := imTabs; end; function indentationMode(const fname: string): TIndentationMode; var str: TStringList; begin str := TStringList.Create; try str.LoadFromFile(fname); result := indentationMode(str); finally str.Free; end; end; function openUrl(const value: string): boolean; {$IFDEF WINDOWS} function GetDefaultBrowserForCurrentUser: String; begin result := ''; with TRegistry.Create do try RootKey := HKEY_CURRENT_USER; if OpenKeyReadOnly('Software\Classes\http\shell\open\command') then begin result := ReadString(''); CloseKey; end; finally Free; end; end; var browser: string; i: integer = 2; {$ENDIF} begin {$IFNDEF WINDOWS} result := LCLIntf.OpenURL(value); {$ELSE} if pos('file://', value) = 0 then result := LCLIntf.OpenURL(value) else begin browser := GetDefaultBrowserForCurrentUser; if browser.isEmpty then result := LCLIntf.OpenURL(value) else begin if browser[1] = '"' then begin while browser[i] <> '"' do begin if i > browser.length then break; i += 1; end; if i <= browser.length then browser := browser[1..i]; end; result := ShellExecuteW(0, 'open', PWideChar(WideString(browser)), PWideChar(WideString(value)), nil, SW_SHOWNORMAL) > 32; end; end; {$ENDIF} end; initialization registerClasses([TCEPersistentShortcut]); end.
22.972644
121
0.653314
471ce212215653eb0a22ad1d846d7398e5444347
9,026
pas
Pascal
src/Core/PureMVC.Core.Controller.pas
gitter-badger/puremvc-delphi-standard-framework-1
8c30be4c3d234d4d2883a4ef282c4080458aadc1
[ "BSD-3-Clause" ]
12
2017-02-24T00:28:03.000Z
2021-02-25T16:34:17.000Z
src/Core/PureMVC.Core.Controller.pas
gitter-badger/puremvc-delphi-standard-framework-1
8c30be4c3d234d4d2883a4ef282c4080458aadc1
[ "BSD-3-Clause" ]
null
null
null
src/Core/PureMVC.Core.Controller.pas
gitter-badger/puremvc-delphi-standard-framework-1
8c30be4c3d234d4d2883a4ef282c4080458aadc1
[ "BSD-3-Clause" ]
10
2015-10-31T09:50:18.000Z
2020-11-18T14:58:06.000Z
{ PureMVC Delphi Port by Jorge L. Cangas <jorge.cangas@puremvc.org> PureMVC - Copyright(c) 2006-11 Futurescale, Inc., Some rights reserved. Your reuse is governed by the Creative Commons Attribution 3.0 License } unit PureMVC.Core.Controller; interface uses SysUtils, PureMVC.Patterns.Collections, PureMVC.Interfaces.INotification, PureMVC.Interfaces.IController, PureMVC.Interfaces.ICommand, PureMVC.Interfaces.IView, PureMVC.Patterns.Observer, PureMVC.Patterns.Command; /// <summary> /// A Singleton <c>IController</c> implementation. /// </summary> /// <remarks> /// <para>In PureMVC, the <c>Controller</c> class follows the 'Command and Controller' strategy, and assumes these responsibilities:</para> /// <list type="bullet"> /// <item>Remembering which <c>ICommand</c>s are intended to handle which <c>INotifications</c>.</item> /// <item>Registering itself as an <c>IObserver</c> with the <c>View</c> for each <c>INotification</c> that it has an <c>ICommand</c> mapping for.</item> /// <item>Creating a new instance of the proper <c>ICommand</c> to handle a given <c>INotification</c> when notified by the <c>View</c>.</item> /// <item>Calling the <c>ICommand</c>'s <c>execute</c> method, passing in the <c>INotification</c>.</item> /// </list> /// <para>Your application must register <c>ICommands</c> with the <c>Controller</c>.</para> /// <para>The simplest way is to subclass <c>Facade</c>, and use its <c>initializeController</c> method to add your registrations.</para> /// </remarks> /// <see cref="PureMVC.Core.View"/> /// <see cref="PureMVC.Patterns.Observer"/> /// <see cref="PureMVC.Patterns.Notification"/> /// <see cref="PureMVC.Patterns.SimpleCommand"/> /// <see cref="PureMVC.Patterns.MacroCommand"/> type {$M+} TController = class(TInterfacedObject, IController) {$REGION 'Constructors'} /// <summary> /// Constructs and initializes a new controller /// </summary> /// <remarks> /// <para> /// This <c>IController</c> implementation is a Singleton, /// so you should not call the constructor /// directly, but instead call the static Singleton /// Factory method <c>Controller.getInstance()</c> /// </para> /// </remarks> protected constructor Create; public destructor Destroy; override; {$ENDREGION} {$REGION 'IController Members'} /// <summary> /// If an <c>ICommand</c> has previously been registered /// to handle a the given <c>INotification</c>, then it is executed. /// </summary> /// <param name="Note">An <c>INotification</c></param> /// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks> procedure ExecuteCommand(Note: INotification); virtual; /// <summary> /// Register a particular <c>ICommand</c> class as the handler /// for a particular <c>INotification</c>. /// </summary> /// <param name="NotificationName">The name of the <c>INotification</c></param> /// <param name="CommandType">The <c>Type</c> of the <c>ICommand</c></param> /// <remarks> /// <para> /// If an <c>ICommand</c> has already been registered to /// handle <c>INotification</c>s with this name, it is no longer /// used, the new <c>ICommand</c> is used instead. /// </para> /// </remarks> /// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks> public procedure RegisterCommand(NotificationName: string; CommandType: TClass); virtual; /// <summary> /// Check if a Command is registered for a given Notification /// </summary> /// <param name="NotificationName"></param> /// <returns>whether a Command is currently registered for the given <c>notificationName</c>.</returns> /// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks> public function HasCommand(NotificationName: string): Boolean; virtual; /// <summary> /// Remove a previously registered <c>ICommand</c> to <c>INotification</c> mapping. /// </summary> /// <param name="NotificationName">The name of the <c>INotification</c> to remove the <c>ICommand</c> mapping for</param> /// <remarks>This method is thread safe and needs to be thread safe in all implementations.</remarks> public procedure RemoveCommand(NotificationName: string); virtual; {$ENDREGION} {$REGION 'Accessors'} /// <summary> /// Singleton Factory method. This method is thread safe. /// </summary> public class function Instance: IController; static; {$ENDREGION} {$REGION 'Protected & Internal Methods'} protected /// <summary> /// Initialize the Singleton <c>Controller</c> instance /// </summary> /// <remarks> /// <para>Called automatically by the constructor</para> /// /// <para> /// Note that if you are using a subclass of <c>View</c> /// in your application, you should also subclass <c>Controller</c> /// and override the <c>InitializeController</c> method in the following way: /// </para> /// <example> /// <code lang="Delphi"> /// // ensure that the Controller is talking to my IView implementation /// procedure TSampleController.InitializeController;override; /// begin /// FView = MyView.Instance; /// end /// </code> /// </example> /// </remarks> procedure InitializeController; virtual; {$ENDREGION} {$REGION 'Members'} /// <summary> /// Local reference to View /// </summary> protected FView: IView; /// <summary> /// Mapping of Notification names to Command Class references /// </summary> protected FCommandMap: TDictionary<string, TCommandClass>; /// <summary> /// Singleton instance, can be sublcassed though.... /// </summary> protected class var FInstance: IController; // volatile /// <summary> /// Used for locking /// </summary> protected // readonly FSyncRoot: TObject; /// <summary> /// Used for locking the instance calls /// </summary> protected // readonly class var FStaticSyncRoot: TObject; {$ENDREGION} end; {$M-} implementation uses PureMVC.Core.View; constructor TController.Create; begin FCommandMap := TDictionary<string, TCommandClass>.Create; FSyncRoot := TObject.Create; InitializeController; end; destructor TController.Destroy; begin FCommandMap.Free; FSyncRoot.Free; inherited; end; procedure TController.ExecuteCommand(Note: INotification); var CommandType: TCommandClass; CommandIntf: ICommand; begin TMonitor.Enter(FSyncRoot); try if not FCommandMap.TryGetValue(Note.Name, CommandType) then Exit; finally TMonitor.Exit(FSyncRoot); end; CommandIntf := CommandType.Create; if CommandIntf = nil then Exit; CommandIntf.Execute(Note); end; procedure TController.RegisterCommand(NotificationName: string; CommandType: TClass); begin Assert(CommandType.InheritsFrom(TCommand)); TMonitor.Enter(FSyncRoot); try if FCommandMap.ContainsKey(NotificationName) then Exit; // This call needs to be monitored carefully. Have to make sure that RegisterObserver // doesn't call back into the controller, or a dead lock could happen. FView.RegisterObserver(NotificationName, TObserver.Create('ExecuteCommand', Self)); FCommandMap.Add(NotificationName, TCommandClass(CommandType)); finally TMonitor.Exit(FSyncRoot); end; end; function TController.HasCommand(NotificationName: string): Boolean; begin TMonitor.Enter(FSyncRoot); try Result := FCommandMap.ContainsKey(NotificationName); finally TMonitor.Exit(FSyncRoot); end; end; procedure TController.RemoveCommand(NotificationName: string); begin TMonitor.Enter(FSyncRoot); try if (FCommandMap.ContainsKey(NotificationName)) then begin // remove the observer // This call needs to be monitored carefully. Have to make sure that RemoveObserver // doesn't call back into the controller, or a dead lock could happen. FView.RemoveObserver(NotificationName, Self); FCommandMap.Remove(NotificationName); end; finally TMonitor.Exit(FSyncRoot); end; end; class function TController.Instance: IController; begin if (FInstance = nil) then begin TMonitor.Enter(FStaticSyncRoot); try if (FInstance = nil) then FInstance := TController.Create; finally TMonitor.Exit(FStaticSyncRoot); end; end; Result := FInstance; end; procedure TController.InitializeController; begin FView := TView.Instance; end; initialization TController.FStaticSyncRoot := TObject.Create; finalization FreeAndNil(TController.FStaticSyncRoot); end.
32.467626
154
0.664635
470d1444deb8fc070b0dbccd20add2ce3825acb6
4,312
pas
Pascal
Import/Indy9/IdLogBase.pas
pavkam/wow-protocol
2adc5df4cb15f29009dd6536fec18df5a8881ebb
[ "MIT" ]
2
2018-01-09T16:49:35.000Z
2021-07-17T06:47:53.000Z
Import/Indy9/IdLogBase.pas
pavkam/wow-protocol
2adc5df4cb15f29009dd6536fec18df5a8881ebb
[ "MIT" ]
null
null
null
Import/Indy9/IdLogBase.pas
pavkam/wow-protocol
2adc5df4cb15f29009dd6536fec18df5a8881ebb
[ "MIT" ]
2
2017-01-20T10:47:56.000Z
2021-07-17T06:47:54.000Z
{ $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: 10231: IdLogBase.pas { { Rev 1.0 2002.11.12 10:44:00 PM czhower } unit IdLogBase; interface uses Classes, IdIntercept, IdSocketHandle; type TIdLogBase = class(TIdConnectionIntercept) protected FActive: Boolean; FLogTime: Boolean; FReplaceCRLF: Boolean; FStreamedActive: Boolean; // procedure Close; virtual; procedure LogStatus(const AText: string); virtual; abstract; procedure LogReceivedData(const AText: string; const AData: string); virtual; abstract; procedure LogSentData(const AText: string; const AData: string); virtual; abstract; procedure Open; virtual; procedure SetActive(const AValue: Boolean); virtual; procedure Loaded; override; public procedure Connect(AConnection: TComponent); override; constructor Create(AOwner: TComponent); override; procedure Receive(ABuffer: TStream); override; procedure Send(ABuffer: TStream); override; destructor Destroy; override; procedure Disconnect; override; published property Active: Boolean read FActive write SetActive default False; property LogTime: Boolean read FLogTime write FLogTime default True; property ReplaceCRLF: Boolean read FReplaceCRLF write FReplaceCRLF default true; end; implementation uses IdGlobal, IdResourceStrings, SysUtils; { TIdLogBase } procedure TIdLogBase.Close; begin end; procedure TIdLogBase.Connect(AConnection: TComponent); begin if FActive then begin inherited Connect(AConnection); LogStatus(RSLogConnected); end; end; constructor TIdLogBase.Create(AOwner: TComponent); begin inherited Create(AOwner); FLogTime := True; ReplaceCRLF := True; end; destructor TIdLogBase.Destroy; begin Active := False; inherited Destroy; end; procedure TIdLogBase.Disconnect; begin if FActive then begin LogStatus(RSLogDisconnected); inherited Disconnect; end; end; procedure TIdLogBase.Loaded; begin Active := FStreamedActive; end; procedure TIdLogBase.Open; begin end; procedure TIdLogBase.Receive(ABuffer: TStream); var s: string; LMsg: string; begin if FActive then begin inherited Receive(ABuffer); with TStringStream.Create('') do try {Do not translate} CopyFrom(ABuffer, ABuffer.Size); LMsg := ''; {Do not translate} if LogTime then begin LMsg := DateTimeToStr(Now); end; s := DataString; if FReplaceCRLF then begin s := StringReplace(s, EOL, RSLogEOL, [rfReplaceAll]); s := StringReplace(s, CR, RSLogCR, [rfReplaceAll]); s := StringReplace(s, LF, RSLogLF, [rfReplaceAll]); end; LogReceivedData(LMsg, s); finally Free; end; end; end; procedure TIdLogBase.Send(ABuffer: TStream); var s: string; LMsg: string; begin if FActive then begin inherited Send(ABuffer); with TStringStream.Create('') do try CopyFrom(ABuffer, ABuffer.Size); LMsg := ''; if LogTime then begin LMsg := DateTimeToStr(Now); end; s := DataString; if FReplaceCRLF then begin s := StringReplace(s, EOL, RSLogEOL, [rfReplaceAll]); s := StringReplace(s, CR, RSLogCR, [rfReplaceAll]); s := StringReplace(s, LF, RSLogLF, [rfReplaceAll]); end; LogSentData(LMsg, s); finally Free; end; end; end; procedure TIdLogBase.SetActive(const AValue: Boolean); begin if (csReading in ComponentState) then FStreamedActive := AValue else if FActive <> AValue then begin FActive := AValue; if FActive then Open else Close; end; end; end.
24.781609
92
0.612477
f1dcb628d313541ac6a28a8ca454d6eb97c736e2
45,255
dfm
Pascal
main.dfm
mikefsp/fr-contest-20
eb1ae41f8bb424e571822116c0937ea4771f96cb
[ "MIT" ]
1
2021-03-25T09:22:46.000Z
2021-03-25T09:22:46.000Z
main.dfm
mikefsp/fr-contest-20
eb1ae41f8bb424e571822116c0937ea4771f96cb
[ "MIT" ]
null
null
null
main.dfm
mikefsp/fr-contest-20
eb1ae41f8bb424e571822116c0937ea4771f96cb
[ "MIT" ]
null
null
null
object frmMain: TfrmMain Left = 0 Top = 0 Caption = 'Fast Reports Contest 2020' ClientHeight = 618 ClientWidth = 700 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False Position = poScreenCenter OnCreate = FormCreate PixelsPerInch = 96 TextHeight = 13 object Label1: TLabel Left = 200 Top = 16 Width = 251 Height = 23 Caption = 'Coronavirus COVID-19 reports' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -19 Font.Name = 'Tahoma' Font.Style = [] ParentFont = False end object lbWHOlData: TLabel Left = 40 Top = 168 Width = 300 Height = 13 AutoSize = False Caption = 'lbWHOlData' end object lbLocalData: TLabel Left = 384 Top = 168 Width = 300 Height = 13 AutoSize = False Caption = 'lbLocalData' end object btnLoadLocal: TButton Left = 472 Top = 88 Width = 121 Height = 49 Caption = 'Load local data' TabOrder = 1 OnClick = btnLoadLocalClick end object btnViewReport: TButton Left = 272 Top = 224 Width = 153 Height = 49 Caption = 'Display Report' Enabled = False TabOrder = 2 OnClick = btnViewReportClick end object btnLoadWHO: TButton Left = 120 Top = 88 Width = 129 Height = 49 Caption = 'Load data from WHO' TabOrder = 0 OnClick = btnLoadWHOClick end object Memo1: TMemo Left = 120 Top = 304 Width = 473 Height = 193 Color = clBtnFace Lines.Strings = ( #1044#1077#1084#1086#1085#1089#1090#1088#1072#1094#1080#1086#1085#1085#1099#1077' '#1086#1090#1095#1077#1090#1099' '#1087#1086' '#1082#1086#1088#1086#1085#1072#1074#1080#1088#1091#1089#1091 '' #1047#1072#1075#1088#1091#1079#1080#1090#1077' '#1076#1072#1085#1085#1099#1077':' 'Load data from WHO '#1079#1072#1075#1088#1091#1078#1072#1077#1090' '#1087#1086#1089#1083#1077#1076#1085#1080#1077' '#1076#1072#1085#1085#1099#1077' '#1089' '#1089#1072#1081#1090#1072' '#1042#1054#1047'.' 'Load local data '#1079#1072#1075#1088#1091#1078#1072#1077#1090' '#1076#1072#1085#1085#1099#1077' '#1080#1079' '#1092#1072#1081#1083#1072' WHO-COVID-19-global-da' + 'ta.csv - '#1092#1072#1081#1083' '#1076#1086#1083#1078#1077#1085' ' #1083#1077#1078#1072#1090#1100' '#1074' '#1086#1076#1085#1086#1084' '#1082#1072#1090#1072#1083#1086#1075#1077' '#1089' '#1087#1088#1086#1075#1088#1072#1084#1084#1086#1081 '' #1053#1072#1078#1084#1080#1090#1077' '#1082#1085#1086#1087#1082#1091' Display Report. ' #1054#1090#1095#1077#1090' '#1080#1085#1090#1077#1088#1072#1082#1090#1080#1074#1085#1099#1081'. ' #1050#1083#1080#1082#1085#1080#1090#1077' '#1087#1086' '#1089#1090#1088#1072#1085#1077', '#1095#1090#1086#1073#1099' '#1086#1090#1082#1088#1099#1090#1100' '#1086#1090#1095#1077#1090' '#1087#1086' '#1101#1090#1086#1081' '#1089#1090#1088#1072#1085#1077'. ' #1050#1083#1080#1082#1072#1081#1090#1077' '#1087#1086' '#1079#1072#1075#1086#1083#1086#1074#1082#1072#1084' '#1086#1090#1095#1077#1090#1072' '#1076#1083#1103' '#1089#1086#1088#1090#1080#1088#1086#1074#1082#1080' '#1080#1083#1080' '#1087#1086' '#1076#1088#1091#1075#1080#1084' '#1101#1083#1077#1084#1077 + #1085#1090#1072#1084' '#1076#1083#1103' ' #1092#1080#1083#1100#1090#1088#1072#1094#1080#1080'.' '' '(c) Michael Karsyan, 2020') ReadOnly = True TabOrder = 3 end object frxByCountry: TfrxReport Version = '6.7' DotMatrixReport = False IniFile = '\Software\Fast Reports' PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator, pbExportQuick, pbCopy, pbSelection] PreviewOptions.Zoom = 1.000000000000000000 PrintOptions.Printer = 'Default' PrintOptions.PrintOnSheet = 0 ReportOptions.CreateDate = 44045.875816122700000000 ReportOptions.LastChange = 44045.908850046300000000 ScriptLanguage = 'PascalScript' ScriptText.Strings = ( 'begin' '' 'end.') Left = 512 Top = 232 Datasets = < item DataSet = frdGlobal DataSetName = 'frdGlobal' end> Variables = <> Style = <> object Data: TfrxDataPage Height = 1000.000000000000000000 Width = 1000.000000000000000000 end object Page1: TfrxReportPage PaperWidth = 210.000000000000000000 PaperHeight = 297.000000000000000000 PaperSize = 9 LeftMargin = 10.000000000000000000 RightMargin = 10.000000000000000000 TopMargin = 10.000000000000000000 BottomMargin = 10.000000000000000000 Frame.Typ = [] MirrorMode = [] object ReportTitle1: TfrxReportTitle FillType = ftBrush Frame.Typ = [] Height = 1005.354980000000000000 Top = 18.897650000000000000 Width = 718.110700000000000000 object memTitleCountry: TfrxMemoView AllowVectorExport = True Left = 37.795300000000000000 Top = 18.897650000000000000 Width = 642.520100000000000000 Height = 41.574830000000000000 Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -32 Font.Name = 'Arial' Font.Style = [] Frame.Typ = [] HAlign = haCenter Memo.UTF8W = ( '[frdGlobal."Country"]') ParentFont = False end object Chart1: TfrxChartView AllowVectorExport = True Top = 302.362253540000000000 Width = 718.110700000000000000 Height = 226.771653540000000000 Restrictions = [rfDontEdit] HighlightColor = clBlack Frame.Typ = [] Chart = { 5450463006544368617274054368617274044C656674020003546F7002000557 696474680390010648656967687403FA00144261636B57616C6C2E50656E2E56 697369626C65080E4C6567656E642E56697369626C6508125469746C652E5465 78742E537472696E67730106094E6577206361736573000A4178697342656869 6E6408144465707468417869732E4C6162656C5374796C65070774616C4E6F6E 650D4672616D652E56697369626C65080656696577334408165669657733444F 7074696F6E732E526F746174696F6E02000A426576656C4F7574657207066276 4E6F6E6505436F6C6F720707636C57686974650D44656661756C7443616E7661 73060E54474449506C757343616E76617311436F6C6F7250616C65747465496E 646578020D000A5442617253657269657307536572696573310D4D61726B732E 56697369626C65080B4D61726B732E5374796C650708736D7356616C7565134D 61726B732E4172726F772E56697369626C6508124D61726B732E4175746F506F 736974696F6E081B4D61726B732E43616C6C6F75742E4172726F772E56697369 626C65080C5856616C7565732E4E616D650601580D5856616C7565732E4F7264 6572070B6C6F417363656E64696E670C5956616C7565732E4E616D6506034261 720D5956616C7565732E4F7264657207066C6F4E6F6E65000000} ChartElevation = 345 SeriesData = < item DataType = dtDBData DataSet = frdGlobal DataSetName = 'frdGlobal' SortOrder = soNone TopN = 0 XType = xtText Source1 = 'frdGlobal."Date_reported"' Source2 = 'frdGlobal."New_cases"' XSource = 'frdGlobal."Date_reported"' YSource = 'frdGlobal."New_cases"' end> end object Chart9: TfrxChartView AllowVectorExport = True Top = 75.590600000000000000 Width = 718.110236220000000000 Height = 226.771653540000000000 Restrictions = [rfDontEdit] HighlightColor = clBlack Frame.Typ = [] Chart = { 5450463006544368617274054368617274044C656674020003546F7002000557 696474680390010648656967687403FA00144261636B57616C6C2E50656E2E56 697369626C65080E4C6567656E642E56697369626C6508125469746C652E5465 78742E537472696E677301060B546F74616C206361736573000D4672616D652E 56697369626C65080656696577334408165669657733444F7074696F6E732E52 6F746174696F6E02000A426576656C4F75746572070662764E6F6E6505436F6C 6F720707636C57686974650D44656661756C7443616E766173060E5447444950 6C757343616E76617311436F6C6F7250616C65747465496E646578020D000B54 4C696E6553657269657307536572696573310F42727573682E4261636B436F6C 6F720709636C44656661756C7416506F696E7465722E496E666C6174654D6172 67696E73090D506F696E7465722E5374796C65070B707352656374616E676C65 0C5856616C7565732E4E616D650601580D5856616C7565732E4F72646572070B 6C6F417363656E64696E670C5956616C7565732E4E616D650601590D5956616C 7565732E4F7264657207066C6F4E6F6E65000000} ChartElevation = 345 SeriesData = < item DataType = dtDBData DataSet = frdGlobal DataSetName = 'frdGlobal' SortOrder = soNone TopN = 0 XType = xtText Source1 = 'frdGlobal."Date_reported"' Source2 = 'frdGlobal."Cumulative_cases"' Source3 = 'frdGlobal."Date_reported"' XSource = 'frdGlobal."Date_reported"' YSource = 'frdGlobal."Cumulative_cases"' end> end object Chart10: TfrxChartView AllowVectorExport = True Top = 755.905560630000000000 Width = 718.110700000000000000 Height = 226.771653540000000000 Restrictions = [rfDontEdit] HighlightColor = clBlack Frame.Typ = [] Chart = { 5450463006544368617274054368617274044C656674020003546F7002000557 696474680390010648656967687403FA00144261636B57616C6C2E50656E2E56 697369626C65080E4C6567656E642E56697369626C6508105469746C652E466F 6E742E436F6C6F720705636C526564125469746C652E546578742E537472696E 677301060A4E657720646561746873000A41786973426568696E640814446570 7468417869732E4C6162656C5374796C65070774616C4E6F6E650D4672616D65 2E56697369626C65080656696577334408165669657733444F7074696F6E732E 526F746174696F6E02000A426576656C4F75746572070662764E6F6E6505436F 6C6F720707636C57686974650D44656661756C7443616E766173060E54474449 506C757343616E76617311436F6C6F7250616C65747465496E646578020D000A 5442617253657269657307536572696573310D4D61726B732E56697369626C65 080B536572696573436F6C6F720705636C5265640C5856616C7565732E4E616D 650601580D5856616C7565732E4F72646572070B6C6F417363656E64696E670C 5956616C7565732E4E616D6506034261720D5956616C7565732E4F7264657207 066C6F4E6F6E65000000} ChartElevation = 345 SeriesData = < item DataType = dtDBData DataSet = frdGlobal DataSetName = 'frdGlobal' SortOrder = soNone TopN = 0 XType = xtText Source1 = 'frdGlobal."Date_reported"' Source2 = 'frdGlobal."New_deaths"' Source3 = 'frdGlobal."Date_reported"' XSource = 'frdGlobal."Date_reported"' YSource = 'frdGlobal."New_deaths"' end> end object Chart11: TfrxChartView AllowVectorExport = True Top = 529.133907090000000000 Width = 718.110236220000000000 Height = 226.771653540000000000 Restrictions = [rfDontEdit] HighlightColor = clBlack Frame.Typ = [] Chart = { 5450463006544368617274054368617274044C656674020003546F7002000557 696474680390010648656967687403FA00144261636B57616C6C2E50656E2E56 697369626C65080E4C6567656E642E56697369626C6508105469746C652E466F 6E742E436F6C6F720705636C526564125469746C652E546578742E537472696E 677301060C546F74616C20646561746873000D4672616D652E56697369626C65 080656696577334408165669657733444F7074696F6E732E526F746174696F6E 02000A426576656C4F75746572070662764E6F6E6505436F6C6F720707636C57 686974650D44656661756C7443616E766173060E54474449506C757343616E76 617311436F6C6F7250616C65747465496E646578020D000B544C696E65536572 69657307536572696573310B536572696573436F6C6F720705636C5265640F42 727573682E4261636B436F6C6F720709636C44656661756C7416506F696E7465 722E496E666C6174654D617267696E73090D506F696E7465722E5374796C6507 0B707352656374616E676C650C5856616C7565732E4E616D650601580D585661 6C7565732E4F72646572070B6C6F417363656E64696E670C5956616C7565732E 4E616D650601590D5956616C7565732E4F7264657207066C6F4E6F6E65000000} ChartElevation = 345 SeriesData = < item DataType = dtDBData DataSet = frdGlobal DataSetName = 'frdGlobal' SortOrder = soNone TopN = 0 XType = xtText Source1 = 'frdGlobal."Date_reported"' Source2 = 'frdGlobal."Cumulative_deaths"' Source3 = 'frdGlobal."Date_reported"' XSource = 'frdGlobal."Date_reported"' YSource = 'frdGlobal."Cumulative_deaths"' end> end end end object Page2: TfrxReportPage PaperWidth = 210.000000000000000000 PaperHeight = 297.000000000000000000 PaperSize = 9 LeftMargin = 10.000000000000000000 RightMargin = 10.000000000000000000 TopMargin = 10.000000000000000000 BottomMargin = 10.000000000000000000 Frame.Typ = [] MirrorMode = [] object Header2: TfrxHeader FillType = ftBrush Frame.Typ = [] Height = 22.677180000000000000 Top = 18.897650000000000000 Width = 718.110700000000000000 object memTitleDate: TfrxMemoView AllowVectorExport = True Left = 3.779530000000000000 Width = 83.149660000000000000 Height = 18.897650000000000000 Frame.Typ = [] Memo.UTF8W = ( 'Date') end object memTitleNewCases: TfrxMemoView AllowVectorExport = True Left = 192.756176440000000000 Width = 79.370078740000000000 Height = 18.897650000000000000 Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [] Frame.Typ = [] HAlign = haRight HideZeros = True Memo.UTF8W = ( 'Total cases') ParentFont = False end object memTitleNewDeaths: TfrxMemoView AllowVectorExport = True Left = 98.267487090000000000 Width = 79.370078740000000000 Height = 18.897650000000000000 DisplayFormat.FormatStr = '+%0.0n' DisplayFormat.Kind = fkNumeric Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [] Frame.Typ = [] HAlign = haRight HideZeros = True Highlight.Font.Charset = DEFAULT_CHARSET Highlight.Font.Color = clWhite Highlight.Font.Height = -13 Highlight.Font.Name = 'Arial' Highlight.Font.Style = [] Highlight.Condition = 'Value > 0' Highlight.FillType = ftBrush Highlight.Fill.BackColor = clRed Highlight.Fill.ForeColor = clNone Highlight.Frame.Typ = [] Memo.UTF8W = ( 'New cases') ParentFont = False end object Memo1: TfrxMemoView AllowVectorExport = True Left = 374.173470000000000000 Width = 79.370078740000000000 Height = 18.897650000000000000 Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [] Frame.Typ = [] HAlign = haRight HideZeros = True Memo.UTF8W = ( 'Total deaths') ParentFont = False end object Memo2: TfrxMemoView AllowVectorExport = True Left = 283.464310650000000000 Width = 79.370078740000000000 Height = 18.897650000000000000 DisplayFormat.FormatStr = '+%0.0n' DisplayFormat.Kind = fkNumeric Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [] Frame.Typ = [] HAlign = haRight HideZeros = True Highlight.Font.Charset = DEFAULT_CHARSET Highlight.Font.Color = clWhite Highlight.Font.Height = -13 Highlight.Font.Name = 'Arial' Highlight.Font.Style = [] Highlight.Condition = 'Value > 0' Highlight.FillType = ftBrush Highlight.Fill.BackColor = clRed Highlight.Fill.ForeColor = clNone Highlight.Frame.Typ = [] Memo.UTF8W = ( 'New deaths') ParentFont = False end end object MasterData1: TfrxMasterData FillType = ftBrush Frame.Typ = [] Height = 22.677180000000000000 Top = 64.252010000000000000 Width = 718.110700000000000000 DataSet = frdGlobal DataSetName = 'frdGlobal' RowCount = 0 object memDate: TfrxMemoView AllowVectorExport = True Left = 3.779530000000000000 Top = 3.779530000000000000 Width = 83.149660000000000000 Height = 18.897650000000000000 DataField = 'Date_reported' DataSet = frdGlobal DataSetName = 'frdGlobal' Frame.Typ = [] Memo.UTF8W = ( '[frdGlobal."Date_reported"]') end object memNewCases: TfrxMemoView AllowVectorExport = True Left = 98.267926440000000000 Top = 3.779530000000000000 Width = 79.370078740000000000 Height = 18.897650000000000000 DataField = 'New_cases' DataSet = frdGlobal DataSetName = 'frdGlobal' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [] Frame.Typ = [] HAlign = haRight HideZeros = True Memo.UTF8W = ( '[frdGlobal."New_cases"]') ParentFont = False end object memNewDeaths: TfrxMemoView AllowVectorExport = True Left = 283.464823220000000000 Top = 3.779530000000000000 Width = 79.370078740000000000 Height = 18.897650000000000000 DataField = 'New_deaths' DataSet = frdGlobal DataSetName = 'frdGlobal' DisplayFormat.FormatStr = '+%0.0n' DisplayFormat.Kind = fkNumeric Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [] Frame.Typ = [] HAlign = haRight HideZeros = True Highlight.Font.Charset = DEFAULT_CHARSET Highlight.Font.Color = clWhite Highlight.Font.Height = -13 Highlight.Font.Name = 'Arial' Highlight.Font.Style = [] Highlight.Condition = 'Value > 0' Highlight.FillType = ftBrush Highlight.Fill.BackColor = clRed Highlight.Fill.ForeColor = clNone Highlight.Frame.Typ = [] Memo.UTF8W = ( '[frdGlobal."New_deaths"]') ParentFont = False end object Memo3: TfrxMemoView AllowVectorExport = True Left = 192.756030000000000000 Top = 3.779530000000000000 Width = 79.370078740000000000 Height = 18.897650000000000000 DataField = 'Cumulative_cases' DataSet = frdGlobal DataSetName = 'frdGlobal' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [] Frame.Typ = [] HAlign = haRight HideZeros = True Memo.UTF8W = ( '[frdGlobal."Cumulative_cases"]') ParentFont = False end object Memo4: TfrxMemoView AllowVectorExport = True Left = 374.173470000000000000 Top = 3.779530000000000000 Width = 79.370078740000000000 Height = 18.897650000000000000 DataField = 'Cumulative_deaths' DataSet = frdGlobal DataSetName = 'frdGlobal' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [] Frame.Typ = [] HAlign = haRight HideZeros = True Memo.UTF8W = ( '[frdGlobal."Cumulative_deaths"]') ParentFont = False end end end end object frdGlobal: TfrxDBDataset UserName = 'frdGlobal' CloseDataSource = False DataSet = dmMain.tbGlobal BCDToCurrency = False Left = 560 Top = 224 end object frxMain: TfrxReport Version = '6.7' DotMatrixReport = False IniFile = '\Software\Fast Reports' PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator, pbExportQuick, pbCopy, pbSelection] PreviewOptions.Zoom = 1.000000000000000000 PrintOptions.Printer = 'Default' PrintOptions.PrintOnSheet = 0 ReportOptions.CreateDate = 44044.803760949100000000 ReportOptions.LastChange = 44047.983425544000000000 ScriptLanguage = 'PascalScript' ScriptText.Strings = ( 'begin' ' ' + ' ' 'end.') OnClickObject = frxMainClickObject OnGetValue = frxMainGetValue Left = 504 Top = 288 Datasets = < item DataSet = frdMain DataSetName = 'frdMain' end item DataSet = frdRegion DataSetName = 'frdRegion' end> Variables = < item Name = ' MyVars' Value = Null end item Name = 'TitleRegion' Value = '' end> Style = <> object Data: TfrxDataPage Height = 1000.000000000000000000 Width = 1000.000000000000000000 end object Page1: TfrxReportPage PaperWidth = 210.000000000000000000 PaperHeight = 297.000000000000000000 PaperSize = 9 LeftMargin = 10.000000000000000000 RightMargin = 10.000000000000000000 TopMargin = 10.000000000000000000 BottomMargin = 10.000000000000000000 Frame.Typ = [] MirrorMode = [] object MasterData1: TfrxMasterData FillType = ftBrush Frame.Typ = [] Height = 22.677180000000000000 Top = 585.827150000000000000 Width = 718.110700000000000000 DataSet = frdMain DataSetName = 'frdMain' RowCount = 0 object memCountry: TfrxMemoView AllowVectorExport = True Top = 3.779530000000000000 Width = 393.070924720000000000 Height = 18.897650000000000000 TagStr = '[frdMain."Country_code"]' DataField = 'Country' DataSet = frdMain DataSetName = 'frdMain' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [fsUnderline] Frame.Typ = [] Memo.UTF8W = ( '[frdMain."Country"]') ParentFont = False end object memNewCases: TfrxMemoView AllowVectorExport = True Left = 393.071266440000000000 Top = 3.779530000000000000 Width = 79.370078740000000000 Height = 18.897650000000000000 DataField = 'New_cases' DataSet = frdMain DataSetName = 'frdMain' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [] Frame.Typ = [] HAlign = haRight HideZeros = True Memo.UTF8W = ( '[frdMain."New_cases"]') ParentFont = False end object memTotalCases: TfrxMemoView AllowVectorExport = True Left = 472.441359830000000000 Top = 3.779530000000000000 Width = 79.370078740000000000 Height = 18.897650000000000000 DataField = 'Cumulative_cases' DataSet = frdMain DataSetName = 'frdMain' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [] Frame.Typ = [] HAlign = haRight HideZeros = True Memo.UTF8W = ( '[frdMain."Cumulative_cases"]') ParentFont = False end object memNewDeaths: TfrxMemoView AllowVectorExport = True Left = 555.590983220000000000 Top = 3.779530000000000000 Width = 79.370078740000000000 Height = 18.897650000000000000 DataField = 'New_deaths' DataSet = frdMain DataSetName = 'frdMain' DisplayFormat.FormatStr = '+%0.0n' DisplayFormat.Kind = fkNumeric Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [] Frame.Typ = [] HAlign = haRight HideZeros = True Highlight.Font.Charset = DEFAULT_CHARSET Highlight.Font.Color = clWhite Highlight.Font.Height = -13 Highlight.Font.Name = 'Arial' Highlight.Font.Style = [] Highlight.Condition = 'Value > 0' Highlight.FillType = ftBrush Highlight.Fill.BackColor = clRed Highlight.Fill.ForeColor = clNone Highlight.Frame.Typ = [] Memo.UTF8W = ( '[frdMain."New_deaths"]') ParentFont = False end object memTotalDeaths: TfrxMemoView AllowVectorExport = True Left = 638.740606610000000000 Top = 3.779530000000000000 Width = 79.370078740000000000 Height = 18.897650000000000000 DataField = 'Cumulative_deaths' DataSet = frdMain DataSetName = 'frdMain' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [] Frame.Typ = [] HAlign = haRight HideZeros = True Memo.UTF8W = ( '[frdMain."Cumulative_deaths"]') ParentFont = False end end object Header1: TfrxHeader FillType = ftBrush Frame.Typ = [] Height = 396.850650000000000000 Top = 166.299320000000000000 Width = 718.110700000000000000 object memTitleCountry: TfrxMemoView AllowVectorExport = True Top = 374.173470000000000000 Width = 393.070924720000000000 Height = 18.897650000000000000 Font.Charset = DEFAULT_CHARSET Font.Color = clBlue Font.Height = -13 Font.Name = 'Arial' Font.Style = [fsUnderline] Frame.Typ = [] Memo.UTF8W = ( 'Country') ParentFont = False end object memTitleNewCases: TfrxMemoView AllowVectorExport = True Left = 393.071266440000000000 Top = 374.173470000000000000 Width = 79.370078740000000000 Height = 18.897650000000000000 Font.Charset = DEFAULT_CHARSET Font.Color = clBlue Font.Height = -13 Font.Name = 'Arial' Font.Style = [fsUnderline] Frame.Typ = [] HAlign = haRight HideZeros = True Memo.UTF8W = ( 'New cases') ParentFont = False end object memTitleTotalCases: TfrxMemoView AllowVectorExport = True Left = 472.441359830000000000 Top = 374.173470000000000000 Width = 79.370078740000000000 Height = 18.897650000000000000 Font.Charset = DEFAULT_CHARSET Font.Color = clBlue Font.Height = -13 Font.Name = 'Arial' Font.Style = [fsUnderline] Frame.Typ = [] HAlign = haRight HideZeros = True Memo.UTF8W = ( 'Total cases') ParentFont = False end object memTitleNewDeaths: TfrxMemoView AllowVectorExport = True Left = 555.590983220000000000 Top = 374.173470000000000000 Width = 79.370078740000000000 Height = 18.897650000000000000 DisplayFormat.FormatStr = '+%0.0n' DisplayFormat.Kind = fkNumeric Font.Charset = DEFAULT_CHARSET Font.Color = clBlue Font.Height = -13 Font.Name = 'Arial' Font.Style = [fsUnderline] Frame.Typ = [] HAlign = haRight HideZeros = True Highlight.Font.Charset = DEFAULT_CHARSET Highlight.Font.Color = clWhite Highlight.Font.Height = -13 Highlight.Font.Name = 'Arial' Highlight.Font.Style = [] Highlight.Condition = 'Value > 0' Highlight.FillType = ftBrush Highlight.Fill.BackColor = clRed Highlight.Fill.ForeColor = clNone Highlight.Frame.Typ = [] Memo.UTF8W = ( 'New deaths') ParentFont = False end object memTitleTotalDeaths: TfrxMemoView AllowVectorExport = True Left = 638.740606610000000000 Top = 374.173470000000000000 Width = 79.370078740000000000 Height = 18.897650000000000000 Font.Charset = DEFAULT_CHARSET Font.Color = clBlue Font.Height = -13 Font.Name = 'Arial' Font.Style = [fsUnderline] Frame.Typ = [] HAlign = haRight HideZeros = True Memo.UTF8W = ( 'Total deaths') ParentFont = False end object chartCases: TfrxChartView AllowVectorExport = True Top = 3.779529999999994000 Width = 332.598640000000000000 Height = 321.260050000000000000 Restrictions = [rfDontEdit] HighlightColor = clBlack Frame.Typ = [] Chart = { 5450463006544368617274054368617274044C656674020003546F7002000557 696474680390010648656967687403FA00144261636B57616C6C2E50656E2E56 697369626C6508104C6567656E642E416C69676E6D656E7407086C61426F7474 6F6D124C6567656E642E526573697A65436861727408115469746C652E466F6E 742E48656967687402F0125469746C652E546578742E537472696E677301060B 546F74616C206361736573000B4178697356697369626C65080D4672616D652E 56697369626C6508175669657733444F7074696F6E732E456C65766174696F6E 033B01185669657733444F7074696F6E732E4F7274686F676F6E616C08195669 657733444F7074696F6E732E5065727370656374697665020016566965773344 4F7074696F6E732E526F746174696F6E0368010B56696577334457616C6C7308 0A426576656C4F75746572070662764E6F6E6505436F6C6F720707636C576869 74650D44656661756C7443616E766173060E54474449506C757343616E766173 11436F6C6F7250616C65747465496E646578020D000A54506965536572696573 07536572696573310D4D61726B732E56697369626C6508055469746C65060B54 6F74616C2063617365730D5856616C7565732E4F72646572070B6C6F41736365 6E64696E670C5956616C7565732E4E616D6506035069650D5956616C7565732E 4F7264657207066C6F4E6F6E651A4672616D652E496E6E657242727573682E42 61636B436F6C6F720705636C526564224672616D652E496E6E65724272757368 2E4772616469656E742E456E64436F6C6F720706636C47726179224672616D65 2E496E6E657242727573682E4772616469656E742E4D6964436F6C6F72070763 6C5768697465244672616D652E496E6E657242727573682E4772616469656E74 2E5374617274436F6C6F720440404000214672616D652E496E6E657242727573 682E4772616469656E742E56697369626C65091B4672616D652E4D6964646C65 42727573682E4261636B436F6C6F720708636C59656C6C6F77234672616D652E 4D6964646C6542727573682E4772616469656E742E456E64436F6C6F72048282 8200234672616D652E4D6964646C6542727573682E4772616469656E742E4D69 64436F6C6F720707636C5768697465254672616D652E4D6964646C6542727573 682E4772616469656E742E5374617274436F6C6F720706636C47726179224672 616D652E4D6964646C6542727573682E4772616469656E742E56697369626C65 091A4672616D652E4F7574657242727573682E4261636B436F6C6F720707636C 477265656E224672616D652E4F7574657242727573682E4772616469656E742E 456E64436F6C6F720440404000224672616D652E4F7574657242727573682E47 72616469656E742E4D6964436F6C6F720707636C5768697465244672616D652E 4F7574657242727573682E4772616469656E742E5374617274436F6C6F720708 636C53696C766572214672616D652E4F7574657242727573682E477261646965 6E742E56697369626C65090B4672616D652E57696474680204194F7468657253 6C6963652E4C6567656E642E56697369626C6508000000} ChartElevation = 315 SeriesData = < item DataType = dtDBData DataSet = frdRegion DataSetName = 'frdRegion' SortOrder = soDescending TopN = 0 XType = xtNumber Source1 = 'frdRegion."Region_name"' Source2 = 'frdRegion."Cumulative_cases"' XSource = 'frdRegion."Region_name"' YSource = 'frdRegion."Cumulative_cases"' end> end object chartDeaths: TfrxChartView AllowVectorExport = True Left = 389.291590000000000000 Top = 3.779529999999994000 Width = 328.819110000000000000 Height = 321.260050000000000000 Restrictions = [rfDontEdit] HighlightColor = clBlack Frame.Typ = [] Chart = { 5450463006544368617274054368617274044C656674020003546F7002000557 696474680390010648656967687403FA00144261636B57616C6C2E50656E2E56 697369626C6508104C6567656E642E416C69676E6D656E7407086C61426F7474 6F6D124C6567656E642E526573697A65436861727408105469746C652E466F6E 742E436F6C6F720705636C526564115469746C652E466F6E742E486569676874 02F0125469746C652E546578742E537472696E677301060C546F74616C206465 61746873000B4178697356697369626C65080D4672616D652E56697369626C65 08175669657733444F7074696F6E732E456C65766174696F6E033B0118566965 7733444F7074696F6E732E4F7274686F676F6E616C08195669657733444F7074 696F6E732E50657273706563746976650200165669657733444F7074696F6E73 2E526F746174696F6E0368010B56696577334457616C6C73080A426576656C4F 75746572070662764E6F6E6505436F6C6F720707636C57686974650D44656661 756C7443616E766173060E54474449506C757343616E76617311436F6C6F7250 616C65747465496E646578020D000A5450696553657269657307536572696573 310D4D61726B732E56697369626C65080D5856616C7565732E4F72646572070B 6C6F417363656E64696E670C5956616C7565732E4E616D6506035069650D5956 616C7565732E4F7264657207066C6F4E6F6E651A4672616D652E496E6E657242 727573682E4261636B436F6C6F720705636C526564224672616D652E496E6E65 7242727573682E4772616469656E742E456E64436F6C6F720706636C47726179 224672616D652E496E6E657242727573682E4772616469656E742E4D6964436F 6C6F720707636C5768697465244672616D652E496E6E657242727573682E4772 616469656E742E5374617274436F6C6F720440404000214672616D652E496E6E 657242727573682E4772616469656E742E56697369626C65091B4672616D652E 4D6964646C6542727573682E4261636B436F6C6F720708636C59656C6C6F7723 4672616D652E4D6964646C6542727573682E4772616469656E742E456E64436F 6C6F720482828200234672616D652E4D6964646C6542727573682E4772616469 656E742E4D6964436F6C6F720707636C5768697465254672616D652E4D696464 6C6542727573682E4772616469656E742E5374617274436F6C6F720706636C47 726179224672616D652E4D6964646C6542727573682E4772616469656E742E56 697369626C65091A4672616D652E4F7574657242727573682E4261636B436F6C 6F720707636C477265656E224672616D652E4F7574657242727573682E477261 6469656E742E456E64436F6C6F720440404000224672616D652E4F7574657242 727573682E4772616469656E742E4D6964436F6C6F720707636C576869746524 4672616D652E4F7574657242727573682E4772616469656E742E537461727443 6F6C6F720708636C53696C766572214672616D652E4F7574657242727573682E 4772616469656E742E56697369626C65090B4672616D652E5769647468020419 4F74686572536C6963652E4C6567656E642E56697369626C6508000000} ChartElevation = 315 SeriesData = < item DataType = dtDBData DataSet = frdRegion DataSetName = 'frdRegion' SortOrder = soDescending TopN = 0 XType = xtNumber Source1 = 'frdRegion."Region_name"' Source2 = 'frdRegion."Cumulative_deaths"' XSource = 'frdRegion."Region_name"' YSource = 'frdRegion."Cumulative_deaths"' end> end object memRecentDay: TfrxMemoView AllowVectorExport = True Left = 75.590600000000000000 Top = 340.157700000000000000 Width = 94.488250000000000000 Height = 18.897650000000000000 OnPreviewClick = 'memRecentDayOnPreviewClick' Font.Charset = DEFAULT_CHARSET Font.Color = clBlue Font.Height = -13 Font.Name = 'Arial' Font.Style = [fsUnderline] Frame.Typ = [] Memo.UTF8W = ( 'Recent day') ParentFont = False end object memPreviousDay: TfrxMemoView AllowVectorExport = True Left = 188.976500000000000000 Top = 340.157700000000000000 Width = 94.488250000000000000 Height = 18.897650000000000000 OnPreviewClick = 'memPreviousDayOnPreviewClick' Font.Charset = DEFAULT_CHARSET Font.Color = clBlue Font.Height = -13 Font.Name = 'Arial' Font.Style = [fsUnderline] Frame.Typ = [] Memo.UTF8W = ( 'Previous day') ParentFont = False end object memAllRegions: TfrxMemoView AllowVectorExport = True Left = 302.362400000000000000 Top = 340.157700000000000000 Width = 94.488250000000000000 Height = 18.897650000000000000 OnPreviewClick = 'memPreviousDayOnPreviewClick' Font.Charset = DEFAULT_CHARSET Font.Color = clBlue Font.Height = -13 Font.Name = 'Arial' Font.Style = [fsUnderline] Frame.Typ = [] Memo.UTF8W = ( 'All regions') ParentFont = False end object Memo2: TfrxMemoView AllowVectorExport = True Top = 340.157700000000000000 Width = 56.692950000000000000 Height = 18.897650000000000000 Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [fsBold] Frame.Typ = [] Memo.UTF8W = ( 'Filter:') ParentFont = False end end object ReportTitle1: TfrxReportTitle FillType = ftBrush Frame.Typ = [] Height = 86.929190000000000000 Top = 18.897650000000000000 Width = 718.110700000000000000 object Memo1: TfrxMemoView AllowVectorExport = True Left = 207.874150000000000000 Top = 7.559060000000000000 Width = 302.362400000000000000 Height = 30.236240000000000000 Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -24 Font.Name = 'Arial' Font.Style = [] Frame.Typ = [] HAlign = haCenter Memo.UTF8W = ( 'COVID-19 Statistics') ParentFont = False end object memRegion: TfrxMemoView AllowVectorExport = True Left = 207.874150000000000000 Top = 41.574830000000000000 Width = 302.362400000000000000 Height = 30.236240000000000000 Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -24 Font.Name = 'Arial' Font.Style = [] Frame.Typ = [] HAlign = haCenter Memo.UTF8W = ( '[memRegion]') ParentFont = False end end object ReportSummary1: TfrxReportSummary FillType = ftBrush Frame.Typ = [] Height = 37.795300000000000000 Top = 668.976810000000000000 Width = 718.110700000000000000 object Memo3: TfrxMemoView AllowVectorExport = True Left = 396.850650000000000000 Top = 18.897647560000000000 Width = 75.590600000000000000 Height = 18.897650000000000000 Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [fsBold] Frame.Typ = [] HAlign = haRight Memo.UTF8W = ( '[SUM(<frdMain."New_cases">,MasterData1)]') ParentFont = False end object memTotalCountry: TfrxMemoView AllowVectorExport = True Top = 18.897650000000000000 Width = 393.070924720000000000 Height = 18.897650000000000000 TagStr = '[frdMain."Country_code"]' DataSet = frdMain DataSetName = 'frdMain' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [fsBold] Frame.Typ = [] HAlign = haRight Memo.UTF8W = ( 'Total:') ParentFont = False end object Memo5: TfrxMemoView AllowVectorExport = True Left = 476.220780000000000000 Top = 18.897647560000000000 Width = 75.590600000000000000 Height = 18.897650000000000000 Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [fsBold] Frame.Typ = [] HAlign = haRight Memo.UTF8W = ( '[SUM(<frdMain."Cumulative_cases">,MasterData1)]') ParentFont = False end object Memo6: TfrxMemoView AllowVectorExport = True Left = 559.370440000000000000 Top = 18.897647560000000000 Width = 75.590600000000000000 Height = 18.897650000000000000 Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [fsBold] Frame.Typ = [] HAlign = haRight Memo.UTF8W = ( '[SUM(<frdMain."New_deaths">,MasterData1)]') ParentFont = False end object Memo7: TfrxMemoView AllowVectorExport = True Left = 642.520100000000000000 Top = 18.897647560000000000 Width = 75.590600000000000000 Height = 18.897650000000000000 Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -13 Font.Name = 'Arial' Font.Style = [fsBold] Frame.Typ = [] HAlign = haRight Memo.UTF8W = ( '[SUM(<frdMain."Cumulative_deaths">,MasterData1)]') ParentFont = False end end end end object frdMain: TfrxDBDataset UserName = 'frdMain' CloseDataSource = False DataSet = dmMain.tbMain BCDToCurrency = False Left = 552 Top = 288 end object frdRegion: TfrxDBDataset UserName = 'frdRegion' CloseDataSource = False DataSet = dmMain.tbRegion BCDToCurrency = False Left = 544 Top = 344 end end
37.7125
312
0.62234
4735d18fd1ba63372f6ba46fc575ab8f9b3d5892
28,719
pas
Pascal
Core/DW.Android.Helpers.pas
DelphiWorlds/Kastr
2622c7568c9e6ba02ffc9b89ce84f2836235b759
[ "MIT" ]
259
2020-05-27T03:15:19.000Z
2022-03-24T16:35:02.000Z
Core/DW.Android.Helpers.pas
DelphiWorlds/Kastr
2622c7568c9e6ba02ffc9b89ce84f2836235b759
[ "MIT" ]
95
2020-06-16T09:46:06.000Z
2022-03-28T00:27:07.000Z
Core/DW.Android.Helpers.pas
DelphiWorlds/Kastr
2622c7568c9e6ba02ffc9b89ce84f2836235b759
[ "MIT" ]
56
2020-06-04T19:32:40.000Z
2022-03-26T15:32:47.000Z
unit DW.Android.Helpers; {*******************************************************} { } { Kastri } { } { Delphi Worlds Cross-Platform Library } { } { Copyright 2020-2021 Dave Nottage under MIT license } { which is located in the root folder of this library } { } {*******************************************************} {$I DW.GlobalDefines.inc} interface uses // RTL System.Classes, System.SysUtils, // Android Androidapi.JNI.JavaTypes, Androidapi.JNI.Net, Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.Os, Androidapi.JNI.App, Androidapi.JNI.Media, Androidapi.JNIBridge, // DW DW.Androidapi.JNI.App, DW.Androidapi.JNI.Os, DW.Androidapi.JNI.JavaTypes; type JDWUtility = interface; JDWUtilityClass = interface(JObjectClass) ['{CD282406-0D42-4EEE-B42E-24E79D058B30}'] {class} function isPackageInstalled(context: JContext; packageName: JString): Boolean; cdecl; {class} procedure crashTest; cdecl; {class} function createObjectMap: JMap; cdecl; end; [JavaSignature('com/delphiworlds/kastri/DWUtility')] JDWUtility = interface(JObject) ['{5C9753FA-7746-4DCE-A709-E68F1319CB97}'] end; TJDWUtility = class(TJavaGenericImport<JDWUtilityClass, JDWUtility>) end; TUncaughtExceptionHandler = class(TJavaLocal, JThread_UncaughtExceptionHandler) public procedure uncaughtException(t: JThread; e: JThrowable); cdecl; end; TAndroidHelperEx = record private class var FAlarmManager: JAlarmManager; class var FKeyguardManager: JKeyguardManager; class var FNotificationManager: JNotificationManager; class var FPowerManager: JPowerManager; class var FUncaughtExceptionHandler: JThread_UncaughtExceptionHandler; class var FWakeLock: JPowerManager_WakeLock; private class function InternalSetAlarm(const AAction: string; const AAlarm: TDateTime; const AFromLock: Boolean; const ARequestCodeOrJobID: Integer; const AServiceName: string = ''): JPendingIntent; static; public const ICE_CREAM_SANDWICH = 14; ICE_CREAM_SANDWICH_MR1 = 15; JELLY_BEAN = 16; JELLY_BEAN_MR1 = 17; JELLY_BEAN_MR2 = 18; KITKAT = 19; KITKAT_MR1 = 20; LOLLIPOP = 21; LOLLIPOP_MR1 = 22; MARSHMALLOW = 23; NOUGAT = 24; NOUGAT_MR1 = 25; OREO = 26; OREO_MR1 = 27; PIE = 28; Q = 29; /// <summary> /// Returns the alarm manager /// </summary> class function AlarmManager: JAlarmManager; static; /// <summary> /// Checks if both build and target are greater or equal to the tested value /// </summary> class function CheckBuildAndTarget(const AValue: Integer): Boolean; static; /// <summary> /// Enables/disables the Wake Lock. Needs Wake Lock checked in the Permissions section of the Project Options /// </summary> class procedure EnableWakeLock(const AEnable: Boolean); static; /// <summary> /// Returns the equivalent of "AndroidClass.class" /// </summary> class function GetClass(const APackageClassName: string): Jlang_Class; static; /// <summary> /// Returns the application default icon ID /// </summary> class function GetDefaultIconID: Integer; static; /// <summary> /// Returns a URI to the notification sound /// </summary> class function GetDefaultNotificationSound: Jnet_Uri; static; /// <summary> /// Returns target Sdk version /// </summary> class function GetTargetSdkVersion: Integer; static; /// <summary> /// Returns the time from now, plus the ASecondsFromNow /// </summary> class function GetTimeFromNowInMillis(const ASecondsFromNow: Int64): Int64; static; /// <summary> /// Returns installed Sdk version /// </summary> class function GetBuildSdkVersion: Integer; static; /// <summary> /// Returns information about a running service, if the service is running /// </summary> class function GetRunningServiceInfo(const AServiceName: string): JActivityManager_RunningServiceInfo; static; class procedure HookUncaughtExceptionHandler; static; /// <summary> /// Imports a file that can be accessed only via ContentResolver /// </summary> class procedure ImportFile(const AURI: string; const AFileName: string); static; /// <summary> /// Returns whether the activity is running foreground /// </summary> /// <remarks> /// Useful from within a service to determine whether or not the service needs to run in foreground mode /// </remarks> class function IsActivityForeground: Boolean; static; /// <summary> /// Returns whether or not battery optimizations are being ignored /// </summary> class function IsIgnoringBatteryOptimizations: Boolean; static; /// <summary> /// Returns whether a package is present on the device /// </summary> class function IsPackageInstalled(const APackageName: string): Boolean; static; /// <summary> /// Returns whether or not this is a service /// </summary> class function IsService: Boolean; static; /// <summary> /// Returns whether a service is running foreground /// </summary> class function IsServiceForeground(const AServiceName: string): Boolean; static; /// <summary> /// Returns whether or not a service is running /// </summary> class function IsServiceRunning(const AServiceName: string): Boolean; static; /// <summary> /// Encodes a file-based URI to Base64 /// </summary> class function JURIToBase64(const AJURI: Jnet_Uri): string; static; /// <summary> /// Returns the keyguard manager /// </summary> class function KeyguardManager: JKeyguardManager; static; /// <summary> /// Returns the notification manager /// </summary> class function NotificationManager: JNotificationManager; static; /// <summary> /// Returns the power manager /// </summary> class function PowerManager: JPowerManager; static; /// <summary> /// Makes the app quit entirely /// </summary> class procedure QuitApplication; static; /// <summary> /// Restarts the app if it is not ignoring battery optimizations. /// </summary> /// <remarks> /// Needs this in the manifest: <uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS"/> /// </remarks> class procedure RestartIfNotIgnoringBatteryOptimizations; static; /// <summary> /// Call this to start an activity from an alarm. Returns the PendingIntent used for the alarm /// </summary> /// <remarks> /// Used in conjunction with dw-multireceiver.jar. To stop the alarm, use: /// TAndroidHelper.AlarmManager.cancel(AlarmIntent); /// Where AlarmIntent is the original PendingIntent returned by this function /// </remarks> class function SetStartAlarm(const AAlarm: TDateTime; const AFromLock: Boolean; const ARequestCode: Integer = 0): JPendingIntent; static; /// <summary> /// Same as SetStartAlarm, but starts the service specified by AServiceName. If it is an IntentService, use a value for JobID > 0 /// </summary> class function SetServiceAlarm(const AServiceName: string; const AAlarm: TDateTime; const AFromLock: Boolean; const AJobId: Integer = 0): JPendingIntent; static; class function ShowAllFilesAccessPermissionSettings: Boolean; static; class procedure ShowLocationPermissionSettings; static; /// <summary> /// Converts file to uri, using FileProvider if target API >= 24 /// </summary> /// <remarks> /// Use this only when accessing files with an "external" URI /// </remarks> class function UriFromFile(const AFile: JFile): Jnet_Uri; static; /// <summary> /// Converts filename to uri, using FileProvider if target API >= 24 /// </summary> /// <remarks> /// Use this only when accessing files with an "external" URI /// </remarks> class function UriFromFileName(const AFileName: string): Jnet_Uri; static; end; TJImageHelper = record private class function RotateBytes(const ABytes: TJavaArray<Byte>; const ARotation: Integer): TJavaArray<Byte>; static; class function JImageToByteArray(const AImage: JImage): TJavaArray<Byte>; overload; static; class function JImageToByteArray(const AImage: JImage; const ARotation: Integer): TJavaArray<Byte>; overload; static; class function NV21ToJPEG(const ABytes: TJavaArray<Byte>; const AWidth, AHeight: Integer): TJavaArray<Byte>; static; class function YUV_420_888ToNV21(const AImage: JImage): TJavaArray<Byte>; static; public /// <summary> /// Converts a JImage to a byte array, applying rotation (if any) /// </summary> /// <remarks> /// Used by the Camera support to orient the captured image /// </remarks> class function JImageToBytes(const AImage: JImage; const ARotation: Integer = 0): TBytes; static; /// <summary> /// Converts a JImage to a JBitmap /// </summary> /// <remarks> /// Uses the private JImageToByteArray method to convert from the appropriate image format /// </remarks> class function JImageToJBitmap(const AImage: JImage): JBitmap; static; /// <summary> /// Converts a JImage to a TStream, applying rotation (if any) /// </summary> /// <remarks> /// Used by the Camera support to orient the captured image /// </remarks> class function JImageToStream(const AImage: JImage; const ARotation: Integer = 0): TStream; static; end; /// <summary> /// Utility class implementing JRunnable /// </summary> TCustomRunnable = class(TJavaLocal, JRunnable) protected procedure DoRun; virtual; public { JRunnable } procedure run; cdecl; end; THandlerRunnable = class(TCustomRunnable) private FHandler: JHandler; protected procedure Execute; virtual; public constructor Create; end; TRunnable = class(TCustomRunnable) private FRunHandler: TThreadProcedure; FSync: Boolean; protected procedure DoRun; override; public constructor Create(const ARunHandler: TThreadProcedure; const ASync: Boolean = True); end; implementation uses // RTL System.DateUtils, System.IOUtils, // Android Androidapi.Helpers, Androidapi.JNI.Provider, Androidapi.JNI, // DW {$IF CompilerVersion < 35} DW.Androidapi.JNI.SupportV4, {$ELSE} DW.Androidapi.JNI.AndroidX.FileProvider, {$ENDIF} DW.Consts.Android, DW.Androidapi.JNI.Util; { TUncaughtExceptionHandler } procedure TUncaughtExceptionHandler.uncaughtException(t: JThread; e: JThrowable); var LStringWriter: JStringWriter; LPrintWriter: JPrintWriter; LIntent: JIntent; LFlags: Integer; begin LStringWriter := TJStringWriter.JavaClass.init; LPrintWriter := TJPrintWriter.JavaClass.init(LStringWriter); e.printStackTrace(LPrintWriter); LFlags := TJIntent.JavaClass.FLAG_ACTIVITY_CLEAR_TOP or TJIntent.JavaClass.FLAG_ACTIVITY_CLEAR_TASK or TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK; LIntent := TAndroidHelper.Context.getPackageManager.getLaunchIntentForPackage(TAndroidHelper.Context.getPackageName); LIntent.putExtra(StringToJString('CRASHED'), True); LIntent.putExtra(StringToJString('TRACE'), LStringWriter.toString); LIntent.setFlags(LFlags); TAndroidHelper.Context.startActivity(LIntent); TAndroidHelperEx.QuitApplication; end; { TAndroidHelperEx } class function TAndroidHelperEx.AlarmManager: JAlarmManager; var LService: JObject; begin if FAlarmManager = nil then begin LService := TAndroidHelper.Context.getSystemService(TJContext.JavaClass.ALARM_SERVICE); if LService <> nil then FAlarmManager := TJAlarmManager.Wrap(LService); end; Result := FAlarmManager; end; class function TAndroidHelperEx.CheckBuildAndTarget(const AValue: Integer): Boolean; begin Result := (GetBuildSdkVersion >= AValue) and (GetTargetSdkVersion >= AValue); end; class procedure TAndroidHelperEx.EnableWakeLock(const AEnable: Boolean); var LTag: string; begin if AEnable then begin if FWakeLock = nil then begin LTag := JStringToString(TAndroidHelper.Context.getPackageName) + '.wakelock'; FWakeLock := PowerManager.newWakeLock(TJPowerManager.JavaClass.PARTIAL_WAKE_LOCK, StringToJString(LTag)); end; if not FWakeLock.isHeld then FWakeLock.acquire; end else begin if (FWakeLock <> nil) and FWakeLock.isHeld then FWakeLock.release; FWakeLock := nil; end; end; class function TAndroidHelperEx.GetBuildSdkVersion: Integer; begin Result := TJBuild_VERSION.JavaClass.SDK_INT; end; class function TAndroidHelperEx.GetTimeFromNowInMillis(const ASecondsFromNow: Int64): Int64; begin Result := TJSystem.JavaClass.currentTimeMillis + (ASecondsFromNow * 1000); end; class procedure TAndroidHelperEx.HookUncaughtExceptionHandler; begin if FUncaughtExceptionHandler = nil then begin FUncaughtExceptionHandler := TUncaughtExceptionHandler.Create; TJThread.JavaClass.setDefaultUncaughtExceptionHandler(FUncaughtExceptionHandler); end; end; class function TAndroidHelperEx.GetClass(const APackageClassName: string): Jlang_Class; begin Result := TJLang_Class.JavaClass.forName(StringToJString(APackageClassName), True, TAndroidHelper.Context.getClassLoader); end; class function TAndroidHelperEx.GetDefaultIconID: Integer; begin Result := TAndroidHelper.GetResourceID('drawable/ic_notification'); if Result = 0 then Result := TAndroidHelper.Context.getApplicationInfo.icon; end; class function TAndroidHelperEx.GetDefaultNotificationSound: Jnet_Uri; begin Result := TJRingtoneManager.JavaClass.getDefaultUri(TJRingtoneManager.JavaClass.TYPE_NOTIFICATION); end; class function TAndroidHelperEx.UriFromFile(const AFile: JFile): Jnet_Uri; var LAuthority: JString; begin if CheckBuildAndTarget(NOUGAT) then begin LAuthority := StringToJString(JStringToString(TAndroidHelper.Context.getApplicationContext.getPackageName) + '.fileprovider'); Result := TJFileProvider.JavaClass.getUriForFile(TAndroidHelper.Context, LAuthority, AFile); end else Result := TJnet_uri.JavaClass.fromFile(AFile); end; class function TAndroidHelperEx.UriFromFileName(const AFileName: string): Jnet_Uri; begin Result := UriFromFile(TJFile.JavaClass.init(StringToJString(AFileName))); end; class function TAndroidHelperEx.GetTargetSdkVersion: Integer; var LApplicationInfo: JApplicationInfo; begin LApplicationInfo := TAndroidHelper.Context.getPackageManager.getApplicationInfo(TAndroidHelper.Context.getPackageName, 0); Result := LApplicationInfo.targetSdkVersion; end; class procedure TAndroidHelperEx.ImportFile(const AURI: string; const AFileName: string); var LInput: JInputStream; LURI: Jnet_Uri; LJavaBytes: TJavaArray<Byte>; LBytes: TBytes; begin LURI := TJnet_Uri.JavaClass.parse(StringToJString(AURI)); LInput := TAndroidHelper.Context.getContentResolver.openInputStream(LURI); LJavaBytes := TJavaArray<Byte>.Create(LInput.available); try LInput.read(LJavaBytes, 0, LJavaBytes.Length); SetLength(LBytes, LJavaBytes.Length); Move(LJavaBytes.Data^, LBytes[0], LJavaBytes.Length); finally LJavaBytes.Free; end; TFile.WriteAllBytes(AFileName, LBytes); end; class function TAndroidHelperEx.JURIToBase64(const AJURI: Jnet_Uri): string; var LInput: JInputStream; LJavaBytes: TJavaArray<Byte>; begin LInput := TAndroidHelper.Context.getContentResolver.openInputStream(AJURI); LJavaBytes := TJavaArray<Byte>.Create(LInput.available); try LInput.read(LJavaBytes, 0, LJavaBytes.Length); Result := JStringToString(TJBase64.JavaClass.encodeToString(LJavaBytes, TJBase64.JavaClass.NO_WRAP)); finally LJavaBytes.Free; end; end; class function TAndroidHelperEx.IsIgnoringBatteryOptimizations: Boolean; begin Result := PowerManager.isIgnoringBatteryOptimizations(TAndroidHelper.Context.getPackageName); end; class function TAndroidHelperEx.IsPackageInstalled(const APackageName: string): Boolean; begin Result := TJDWUtility.JavaClass.isPackageInstalled(TAndroidHelper.Context, StringToJString(APackageName)); end; class function TAndroidHelperEx.GetRunningServiceInfo(const AServiceName: string): JActivityManager_RunningServiceInfo; var LService: JObject; LRunningServices: JList; LServiceInfo: JActivityManager_RunningServiceInfo; I: Integer; begin Result := nil; LService := TAndroidHelper.Context.getSystemService(TJContext.JavaClass.ACTIVITY_SERVICE); LRunningServices := TJActivityManager.Wrap(TAndroidHelper.JObjectToID(LService)).getRunningServices(MaxInt); for I := 0 to LRunningServices.size - 1 do begin LServiceInfo := TJActivityManager_RunningServiceInfo.Wrap(TAndroidHelper.JObjectToID(LRunningServices.get(I))); if AServiceName.Equals(JStringToString(LServiceInfo.service.getClassName)) then Exit(LServiceInfo); end; end; class function TAndroidHelperEx.IsActivityForeground: Boolean; var LAppInfo: JActivityManager_RunningAppProcessInfo; begin LAppInfo := TJActivityManager_RunningAppProcessInfo.JavaClass.init; TJActivityManager.JavaClass.getMyMemoryState(LAppInfo); Result := (LAppInfo.importance = TJActivityManager_RunningAppProcessInfo.JavaClass.IMPORTANCE_FOREGROUND) or (LAppInfo.importance = TJActivityManager_RunningAppProcessInfo.JavaClass.IMPORTANCE_VISIBLE); end; class function TAndroidHelperEx.IsService: Boolean; begin // Comparing DelphiActivity to nil should be safe enough to determine whether this is a service Result := DelphiActivity = nil; end; class function TAndroidHelperEx.IsServiceForeground(const AServiceName: string): Boolean; var LServiceInfo: JActivityManager_RunningServiceInfo; begin LServiceInfo := GetRunningServiceInfo(AServiceName); Result := (LServiceInfo <> nil) and LServiceInfo.foreground; end; class function TAndroidHelperEx.IsServiceRunning(const AServiceName: string): Boolean; begin Result := GetRunningServiceInfo(AServiceName) <> nil; end; class function TAndroidHelperEx.KeyguardManager: JKeyguardManager; var LService: JObject; begin if FKeyguardManager = nil then begin LService := TAndroidHelper.Context.getSystemService(TJContext.JavaClass.KEYGUARD_SERVICE); if LService <> nil then FKeyguardManager := TJKeyguardManager.Wrap(TAndroidHelper.JObjectToID(LService)); end; Result := FKeyguardManager; end; class function TAndroidHelperEx.NotificationManager: JNotificationManager; var LService: JObject; begin if FNotificationManager = nil then begin LService := TAndroidHelper.Context.getSystemService(TJContext.JavaClass.NOTIFICATION_SERVICE); FNotificationManager := TJNotificationManager.Wrap(TAndroidHelper.JObjectToID(LService)); end; Result := FNotificationManager; end; class function TAndroidHelperEx.PowerManager: JPowerManager; var LService: JObject; begin if FPowerManager = nil then begin LService := TAndroidHelper.Context.getSystemService(TJContext.JavaClass.POWER_SERVICE); if LService <> nil then FPowerManager := TJPowerManager.Wrap(TAndroidHelper.JObjectToID(LService)); end; Result := FPowerManager; end; class procedure TAndroidHelperEx.QuitApplication; begin if TOSVersion.Check(5) then TAndroidHelper.Activity.finishAndRemoveTask else TAndroidHelper.Activity.finish; TJSystem.JavaClass.exit(2); end; class procedure TAndroidHelperEx.RestartIfNotIgnoringBatteryOptimizations; var LIntent: JIntent; begin if not IsIgnoringBatteryOptimizations then begin LIntent := TJIntent.Create; LIntent.setAction(TJSettings.javaClass.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); LIntent.setData(TJnet_Uri.JavaClass.parse(StringToJString('package:' + JStringtoString(TAndroidHelper.Context.getPackageName())))); // Restart app with action request TAndroidHelper.Context.startActivity(LIntent); end; end; function GetTimeFromNowInMillis(const ASecondsFromNow: Integer): Int64; var LCalendar: JCalendar; begin LCalendar := TJCalendar.JavaClass.getInstance; if ASecondsFromNow > 0 then LCalendar.add(TJCalendar.JavaClass.SECOND, ASecondsFromNow); Result := LCalendar.getTimeInMillis; end; class function TAndroidHelperEx.InternalSetAlarm(const AAction: string; const AAlarm: TDateTime; const AFromLock: Boolean; const ARequestCodeOrJobID: Integer; const AServiceName: string = ''): JPendingIntent; var LActionIntent: JIntent; LStartAt: Int64; LRequestCode: Integer; begin LActionIntent := TJIntent.JavaClass.init(StringToJString(AAction)); LActionIntent.setClassName(TAndroidHelper.Context.getPackageName, StringToJString(cDWBroadcastReceiverName)); if AFromLock = True then LActionIntent.putExtra(StringToJString(cDWBroadcastReceiverExtraStartUnlock), AFromLock); LRequestCode := ARequestCodeOrJobID; if not AServiceName.IsEmpty then begin LRequestCode := 0; LActionIntent.putExtra(StringToJString(cDWBroadcastReceiverExtraServiceName), StringToJString(AServiceName)); if ARequestCodeOrJobID > 0 then LActionIntent.putExtra(StringToJString(cDWBroadcastReceiverExtraServiceJobId), ARequestCodeOrJobID); end; Result := TJPendingIntent.JavaClass.getBroadcast(TAndroidHelper.Context, LRequestCode, LActionIntent, TJPendingIntent.JavaClass.FLAG_UPDATE_CURRENT); LStartAt := GetTimeFromNowInMillis(SecondsBetween(Now, AAlarm)); // Allow for alarms while in "doze" mode if TOSVersion.Check(6) then TAndroidHelper.AlarmManager.setExactAndAllowWhileIdle(TJAlarmManager.JavaClass.RTC_WAKEUP, LStartAt, Result) else TAndroidHelper.AlarmManager.&set(TJAlarmManager.JavaClass.RTC_WAKEUP, LStartAt, Result); end; class function TAndroidHelperEx.SetServiceAlarm(const AServiceName: string; const AAlarm: TDateTime; const AFromLock: Boolean; const AJobId: Integer = 0): JPendingIntent; begin Result := InternalSetAlarm(cDWBroadcastReceiverActionServiceAlarm, AAlarm, AFromLock, AJobId, AServiceName); end; class function TAndroidHelperEx.SetStartAlarm(const AAlarm: TDateTime; const AFromLock: Boolean; const ARequestCode: Integer = 0): JPendingIntent; begin Result := InternalSetAlarm(cDWBroadcastReceiverActionStartAlarm, AAlarm, AFromLock, ARequestCode); end; class function TAndroidHelperEx.ShowAllFilesAccessPermissionSettings: Boolean; var LIntent: JIntent; LUri: Jnet_Uri; LAction: JString; begin Result := False; if TOSVersion.Check(11) and not TJEnvironment.JavaClass.isExternalStorageManager then begin LUri := TJnet_Uri.JavaClass.fromParts(StringToJString('package'), TAndroidHelper.Context.getPackageName, nil); LAction := StringToJString('android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION'); // TJSettings.JavaClass.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION LIntent := TJIntent.JavaClass.init(LAction, LUri); TAndroidHelper.Context.startActivity(LIntent); Result := True; end; end; class procedure TAndroidHelperEx.ShowLocationPermissionSettings; var LIntent: JIntent; LUri: Jnet_Uri; begin LUri := TJnet_Uri.JavaClass.fromParts(StringToJString('package'), TAndroidHelper.Context.getPackageName, nil); LIntent := TJIntent.JavaClass.init(TJSettings.JavaClass.ACTION_APPLICATION_DETAILS_SETTINGS, LUri); TAndroidHelper.Context.startActivity(LIntent); end; { TJImageHelper } class function TJImageHelper.RotateBytes(const ABytes: TJavaArray<Byte>; const ARotation: Integer): TJavaArray<Byte>; var LMatrix: JMatrix; LBitmap, LRotatedBitmap: JBitmap; LOutputStream: JByteArrayOutputStream; begin LMatrix := TJMatrix.JavaClass.init; LMatrix.postRotate(ARotation); LBitmap := TJBitmapFactory.JavaClass.decodeByteArray(ABytes, 0, ABytes.Length); try try LRotatedBitmap := TJBitmap.JavaClass.createBitmap(LBitmap, 0, 0, LBitmap.getWidth, LBitmap.getHeight, LMatrix, True); LOutputStream := TJByteArrayOutputStream.JavaClass.init(0); LRotatedBitmap.compress(TJBitmap_CompressFormat.JavaClass.JPEG, 100, LOutputStream); Result := LOutputStream.toByteArray; finally LRotatedBitmap.recycle; end; finally LBitmap.recycle; end; end; class function TJImageHelper.JImageToByteArray(const AImage: JImage; const ARotation: Integer): TJavaArray<Byte>; var LBytes: TJavaArray<Byte>; begin Result := JImageToByteArray(AImage); if ARotation > 0 then begin LBytes := Result; try Result := TJImageHelper.RotateBytes(LBytes, ARotation); finally LBytes.Free; end; end; end; class function TJImageHelper.JImageToByteArray(const AImage: JImage): TJavaArray<Byte>; var LBuffer: JByteBuffer; begin Result := nil; if AImage.getFormat = TJImageFormat.JavaClass.JPEG then begin LBuffer := AImage.getPlanes.Items[0].getBuffer; Result := TJavaArray<Byte>.Create(LBuffer.capacity); LBuffer.get(Result); end else if AImage.getFormat = TJImageFormat.JavaClass.YUV_420_888 then Result := NV21ToJPEG(YUV_420_888ToNV21(AImage), AImage.getWidth, AImage.getHeight); end; class function TJImageHelper.JImageToJBitmap(const AImage: JImage): JBitmap; var LBytes: TJavaArray<Byte>; begin LBytes := JImageToByteArray(AImage); try Result := TJBitmapFactory.JavaClass.decodeByteArray(LBytes, 0, LBytes.Length); finally LBytes.Free; end; end; class function TJImageHelper.JImageToStream(const AImage: JImage; const ARotation: Integer = 0): TStream; var LBytes: TJavaArray<Byte>; begin Result := TMemoryStream.Create; LBytes := JImageToByteArray(AImage, ARotation); try Result.WriteBuffer(LBytes.Data^, LBytes.Length); finally LBytes.Free; end; end; class function TJImageHelper.JImageToBytes(const AImage: JImage; const ARotation: Integer = 0): TBytes; var LBytes: TJavaArray<Byte>; begin LBytes := JImageToByteArray(AImage, ARotation); try Result := TJavaArrayToTBytes(LBytes); finally LBytes.Free; end; end; class function TJImageHelper.NV21ToJPEG(const ABytes: TJavaArray<Byte>; const AWidth, AHeight: Integer): TJavaArray<Byte>; var LStream: JByteArrayOutputStream; LYUV21Image: JYuvImage; begin LStream := TJByteArrayOutputStream.Create; LYUV21Image := TJYuvImage.JavaClass.init(ABytes, TJImageFormat.JavaClass.NV21, AWidth, AHeight, nil); LYUV21Image.compressToJpeg(TJRect.JavaClass.init(0, 0, AWidth, AHeight), 100, LStream); Result := LStream.toByteArray; end; class function TJImageHelper.YUV_420_888ToNV21(const AImage: JImage): TJavaArray<Byte>; var LYBuffer, LUBuffer, LVBuffer: JByteBuffer; LYSize, LUSize, LVSize: Integer; begin LYBuffer := AImage.getPlanes.Items[0].getBuffer; LUBuffer := AImage.getPlanes.Items[1].getBuffer; LVBuffer := AImage.getPlanes.Items[2].getBuffer; LYSize := LYBuffer.remaining; LUSize := LUBuffer.remaining; LVSize := LVBuffer.remaining; Result := TJavaArray<Byte>.Create(LYSize + LUSize + LVSize); LYBuffer.get(Result, 0, LYSize); LVBuffer.get(Result, LYSize, LVSize); LUBuffer.get(Result, LYSize + LVSize, LUSize); end; { TCustomRunnable } procedure TCustomRunnable.DoRun; begin // end; procedure TCustomRunnable.run; begin DoRun; end; { THandlerRunnable } constructor THandlerRunnable.Create; begin inherited; FHandler := TJHandler.JavaClass.init; end; procedure THandlerRunnable.Execute; begin FHandler.post(Self); end; { TRunnable } constructor TRunnable.Create(const ARunHandler: TThreadProcedure; const ASync: Boolean = True); begin inherited Create; FRunHandler := ARunHandler; FSync := ASync; end; procedure TRunnable.DoRun; begin if FSync then TThread.ForceQueue(nil, FRunHandler) else FRunHandler; end; end.
35.988722
157
0.72015
859365b702bfc234d3dafce2255d2550f1780ed8
1,059
pas
Pascal
windows/src/test/test_vistaaltfixunit/vafuForm2.pas
bravogeorge/keyman
c0797e36292de903d7313214d1f765e3d9a2bf4d
[ "MIT" ]
219
2017-06-21T03:37:03.000Z
2022-03-27T12:09:28.000Z
windows/src/test/test_vistaaltfixunit/vafuForm2.pas
bravogeorge/keyman
c0797e36292de903d7313214d1f765e3d9a2bf4d
[ "MIT" ]
4,451
2017-05-29T02:52:06.000Z
2022-03-31T23:53:23.000Z
windows/src/test/test_vistaaltfixunit/vafuForm2.pas
bravogeorge/keyman
c0797e36292de903d7313214d1f765e3d9a2bf4d
[ "MIT" ]
72
2017-05-26T04:08:37.000Z
2022-03-03T10:26:20.000Z
(* Name: vafuForm2 Copyright: Copyright (C) 2003-2017 SIL International. Documentation: Description: Create Date: 2 Feb 2012 Modified Date: 2 Feb 2012 Authors: mcdurdin Related Files: Dependencies: Bugs: Todo: Notes: History: 02 Feb 2012 - mcdurdin - I2975 - VistaAltFixUnit causes crash on shutdown *) unit vafuForm2; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs; type TForm2 = class(TForm) procedure FormDestroy(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); private { Private declarations } public { Public declarations } end; var Form2: TForm2; implementation {$R *.dfm} procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction); begin Action := caFree; end; procedure TForm2.FormDestroy(Sender: TObject); begin // ShowMessage('!'); // SendMessage(Handle, WM_USER, 0, 0); end; end.
19.254545
93
0.644004
83d5e35c66ee4670b30a3c6b4127ee5dd006f36a
3,700
pas
Pascal
Source/Persistence/SQL/Spring.Persistence.SQL.Commands.BulkInsert.MongoDB.pas
VSoftTechnologies/Spring4DMirror
083931ede091613e82173fa41da413bb9ffcebea
[ "Apache-2.0" ]
1
2021-02-17T12:38:20.000Z
2021-02-17T12:38:20.000Z
Source/Persistence/SQL/Spring.Persistence.SQL.Commands.BulkInsert.MongoDB.pas
VSoftTechnologies/Spring4DMirror
083931ede091613e82173fa41da413bb9ffcebea
[ "Apache-2.0" ]
null
null
null
Source/Persistence/SQL/Spring.Persistence.SQL.Commands.BulkInsert.MongoDB.pas
VSoftTechnologies/Spring4DMirror
083931ede091613e82173fa41da413bb9ffcebea
[ "Apache-2.0" ]
2
2021-03-17T07:42:29.000Z
2021-05-03T13:55:00.000Z
{***************************************************************************} { } { Spring Framework for Delphi } { } { Copyright (c) 2009-2021 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.Persistence.SQL.Commands.BulkInsert.MongoDB; interface uses Spring.Collections, Spring.Persistence.SQL.Commands.Insert; type TMongoDBBulkInsertExecutor = class(TInsertExecutor) public procedure BulkExecute<T: class, constructor>(const entities: IEnumerable<T>); end; implementation uses Rtti, MongoBson, Spring.Reflection, Spring.Persistence.SQL.Types, Spring.Persistence.Adapters.MongoDB; {$REGION 'TMongoDBBulkInsertExecutor'} procedure TMongoDBBulkInsertExecutor.BulkExecute<T>(const entities: IEnumerable<T>); var LEntity: T; LQuery: string; LStatement: TMongoStatementAdapter; LConn: TMongoDBConnection; LDocs: TArray<IBSONDocument>; LCollection: string; i: Integer; begin if not entities.Any then Exit; LConn := (Connection as TMongoConnectionAdapter).Connection; LStatement := TMongoStatementAdapter.Create(nil, TMongoDBExceptionHandler.Create); try SetLength(LDocs, entities.Count); i := 0; if CanClientAutogenerateValue then InsertCommand.InsertFields.Add(TSQLInsertField.Create( EntityData.PrimaryKeyColumn.ColumnName, Table, EntityData.PrimaryKeyColumn, InsertCommand.GetAndIncParameterName(EntityData.PrimaryKeyColumn.ColumnName))); for LEntity in entities do begin if CanClientAutogenerateValue then EntityData.PrimaryKeyColumn.Member.SetValue(LEntity, TValue.FromVariant(Generator.GenerateUniqueId)); InsertCommand.Entity := LEntity; Command.Entity := LEntity; LQuery := Generator.GenerateInsert(InsertCommand); LStatement.SetSQLCommand(LQuery); if (LCollection = '') then LCollection := LStatement.GetFullCollectionName; LDocs[i] := JsonToBson(LStatement.GetQueryText); Inc(i); end; LConn.Insert(LCollection, LDocs); finally LStatement.Free; end; end; {$ENDREGION} end.
36.27451
109
0.514324
f17e28cd5e8e19e8b8efd1821f8ef65e96fb964b
2,276
pas
Pascal
Oxygene/Echoes/Language/Interfaces/SampleClasses.pas
remobjects/ElementsSamples
744647f59424c18ccb06c0c776b2dcafdabb0513
[ "MIT" ]
19
2016-04-09T12:40:27.000Z
2022-02-22T12:15:03.000Z
Oxygene/Echoes/Language/Interfaces/SampleClasses.pas
remobjects/ElementsSamples
744647f59424c18ccb06c0c776b2dcafdabb0513
[ "MIT" ]
3
2017-09-05T09:31:29.000Z
2019-09-11T04:49:27.000Z
Oxygene/Echoes/Language/Interfaces/SampleClasses.pas
remobjects/ElementsSamples
744647f59424c18ccb06c0c776b2dcafdabb0513
[ "MIT" ]
11
2016-12-29T19:30:39.000Z
2021-08-31T12:20:27.000Z
namespace InterfacesSample.SampleClasses; interface uses System, System.Windows.Forms; type { IVersionInfo interface Notice how, in Oxygene, there's no need to declare setter and getter methods for interface properties. Their implementation and names are deferred to the class that implements this interface. } IVersionInfo = interface property Name: String read; property MajVersion: Integer read; property MinVersion: Integer read; property Description: String read; end; { VersionInfo class } VersionInfo = class(IVersionInfo) private fControl: Control; protected method GetName: String; public constructor(aControl: Control; aMajVersion, aMinVersion: Integer; aDescription: String); property Name: String read GetName; { The following Readonly properties can only be set inside a constructor } property MajVersion: Integer; readonly; property MinVersion: Integer; readonly; property Description: String; readonly; end; { SampleButton Notice how the VersionInfo property is initialized inline and, trough the use of the keyword "implements", provides an implementation for IVersionInfo to the class SampleButton. } SampleButton = class(System.Windows.Forms.Button, IVersionInfo) public property VersionInfo: IVersionInfo := new VersionInfo(self, 1,0,'A button with VersionInfo'); implements IVersionInfo; end; { SampleTextBox See comment for SampleButton. Thanks to inline instantiation of properties and the "implements" keyword, code-reuse and interface delegation is made much simpler. } SampleTextBox = class(System.Windows.Forms.TextBox, IVersionInfo) public property VersionInfo: IVersionInfo := new VersionInfo(self, 2,3,'A text box with VersionInfo'); implements IVersionInfo; end; implementation constructor VersionInfo(aControl: Control; aMajVersion, aMinVersion: integer; aDescription: string); begin inherited constructor; fControl := aControl; MajVersion := aMajVersion; MinVersion := aMinVersion; Description := aDescription; end; method VersionInfo.GetName: string; begin { Result is implicitly initialized to '' } if assigned(fControl) then result := fControl.Name end; end.
29.558442
124
0.746485
473ac2bec24907fbbcfc4b95fa85d28e074d0178
8,377
pas
Pascal
Components/JVCL/qexamples/JvXPControls/Simple/MainFrm.pas
sabatex/Delphi
0efbe6eb38bf8aa2bf269d1866741266e90b9cbf
[ "MIT" ]
null
null
null
Components/JVCL/qexamples/JvXPControls/Simple/MainFrm.pas
sabatex/Delphi
0efbe6eb38bf8aa2bf269d1866741266e90b9cbf
[ "MIT" ]
null
null
null
Components/JVCL/qexamples/JvXPControls/Simple/MainFrm.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 MainFrm; interface uses QWindows, QMessages, SysUtils, Classes, Types, QGraphics, QControls, QForms, QDialogs, QActnList, QImgList, JvQXPCore, JvQXPCheckCtrls, JvQXPButtons, QExtCtrls, QStdCtrls, JvQXPContainer, JvQComponent, JvQExControls; type { TfrmMain } TfrmMain = class(TForm) acBtn1: TAction; acBtn2: TAction; acBtn3: TAction; acBtn4: TAction; aclMain: TActionList; btn1: TJvXPButton; btn2: TJvXPButton; btn3: TJvXPButton; btn4: TJvXPButton; btnCancel: TJvXPButton; btnClose: TJvXPToolButton; btnLeft: TJvXPToolButton; btnOK: TJvXPButton; btnRight: TJvXPToolButton; chk1: TJvXPCheckbox; chk2: TJvXPCheckbox; chkOfficeStyle: TJvXPCheckbox; chkToogleEnable: TJvXPCheckbox; cntHeader: TJvXPContainer; cntNetHeader: TJvXPContainer; cntNetPanel: TJvXPContainer; dxToolButton1: TJvXPToolButton; dxToolButton2: TJvXPToolButton; dxToolButton3: TJvXPToolButton; dxToolButton4: TJvXPToolButton; dxToolButton5: TJvXPToolButton; imgConfigure: TImage; imlMain: TImageList; lbBrowse: TLabel; lbConfigure: TLabel; lbInternalPage: TLabel; lbWebEditor: TLabel; shpSeperator: TShape; styleOffice: TJvXPStyleManager; JvXPButton1: TJvXPButton; procedure FormCreate(Sender: TObject); procedure acBtn1Execute(Sender: TObject); procedure acBtn3Execute(Sender: TObject); procedure btnCloseClick(Sender: TObject); procedure chkOfficeStyleClick(Sender: TObject); procedure chkToogleEnableClick(Sender: TObject); procedure cntHeaderMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure cntHeaderPaint(Sender: TObject; Rect: TRect; ACanvas: TCanvas; AFont: TFont); procedure cntNetPanelPaint(Sender: TObject; Rect: TRect; ACanvas: TCanvas; AFont: TFont); private { Private declarations } public { Public declarations } end; var frmMain: TfrmMain; implementation {$R *.xfm} { TfrmMain } {----------------------------------------------------------------------------- Procedure: RemoveTitleBar Author: mh Date: 31-Mrz-2003 Arguments: hWindow: THANDLE; Hide: boolean = True Result: DWORD -----------------------------------------------------------------------------} (* function RemoveTitleBar(hWindow: THANDLE; Hide: boolean = True): DWORD; var R: TRect; begin Result := GetWindowLong(hWindow, GWL_STYLE); if (Hide) then Result := Result and not WS_CAPTION else Result := Result or WS_CAPTION; GetClientRect(hWindow, R); SetWindowLong(hWindow, GWL_STYLE, Result); AdjustWindowRect(R, Result, boolean(GetMenu(hWindow))); SetWindowPos(hWindow, 0, 0, 0, (R.Right - R.Left), (R.Bottom - R.Top), SWP_NOMOVE or SWP_NOZORDER or SWP_FRAMECHANGED or SWP_NOSENDCHANGING); end; *) {----------------------------------------------------------------------------- Procedure: TfrmMain.FormCreate Author: mh Date: 31-Mrz-2003 Arguments: Sender: TObject Result: None -----------------------------------------------------------------------------} procedure TfrmMain.FormCreate(Sender: TObject); begin // RemoveTitleBar(Handle); end; {----------------------------------------------------------------------------- Procedure: TfrmMain.cntHeaderPaint Author: mh Date: 31-Mrz-2003 Arguments: Sender: TObject; Rect: TRect; ACanvas: TCanvas; AFont: TFont Result: None -----------------------------------------------------------------------------} procedure TfrmMain.cntHeaderPaint(Sender: TObject; Rect: TRect; ACanvas: TCanvas; AFont: TFont); var i: Integer; begin with ACanvas do begin for i := Rect.Top to Rect.Bottom do begin Pen.Color := clGray; Rectangle(Rect.Left + 1, Rect.Top + i shl 1, Rect.Right - 1, Rect.Top + i shl 1 + 1); end; Brush.Color := clBtnFace; DrawText(ACanvas, ' ' + Application.Title + ' ', -1, Rect, DT_SINGLELINE or DT_VCENTER or DT_CENTER or DT_END_ELLIPSIS); end; end; {----------------------------------------------------------------------------- Procedure: TfrmMain.cntHeaderMouseDown Author: mh Date: 31-Mrz-2003 Arguments: Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer Result: None -----------------------------------------------------------------------------} procedure TfrmMain.cntHeaderMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin ReleaseCapture; // Perform(WM_SYSCOMMAND, $F012, 0); end; {----------------------------------------------------------------------------- Procedure: TfrmMain.btnCloseClick Author: mh Date: 31-Mrz-2003 Arguments: Sender: TObject Result: None -----------------------------------------------------------------------------} procedure TfrmMain.btnCloseClick(Sender: TObject); begin Close; end; {----------------------------------------------------------------------------- Procedure: TfrmMain.cntNetPanelPaint Author: mh Date: 31-Mrz-2003 Arguments: Sender: TObject; Rect: TRect; ACanvas: TCanvas; AFont: TFont Result: None -----------------------------------------------------------------------------} procedure TfrmMain.cntNetPanelPaint(Sender: TObject; Rect: TRect; ACanvas: TCanvas; AFont: TFont); var Control: TControl; EdgeColor: TColor; begin Control := TControl(Sender); EdgeColor := TForm(Control.Parent).Color; ACanvas.Pixels[0, 0] := EdgeColor; ACanvas.Pixels[Control.Width - 1, 0] := EdgeColor; end; {----------------------------------------------------------------------------- Procedure: TfrmMain.acGenerateExecute Author: mh Date: 31-Mrz-2003 Arguments: Sender: TObject Result: None -----------------------------------------------------------------------------} procedure TfrmMain.acBtn1Execute(Sender: TObject); begin // end; {----------------------------------------------------------------------------- Procedure: TfrmMain.acBtn3Execute Author: mh Date: 31-Mrz-2003 Arguments: Sender: TObject Result: None -----------------------------------------------------------------------------} procedure TfrmMain.acBtn3Execute(Sender: TObject); begin // end; {----------------------------------------------------------------------------- Procedure: TfrmMain.chkToogleEnableClick Author: mh Date: 31-Mrz-2003 Arguments: Sender: TObject Result: None -----------------------------------------------------------------------------} procedure TfrmMain.chkToogleEnableClick(Sender: TObject); begin acBtn1.Enabled := not chkToogleEnable.Checked; acBtn3.Enabled := not chkToogleEnable.Checked; end; {----------------------------------------------------------------------------- Procedure: TfrmMain.chkOfficeStyleClick Author: mh Date: 31-Mrz-2003 Arguments: Sender: TObject Result: None -----------------------------------------------------------------------------} procedure TfrmMain.chkOfficeStyleClick(Sender: TObject); begin styleOffice.Theme := TJvXPTheme(chkOfficeStyle.Checked); end; end.
31.025926
107
0.552584
446fd8c786dfcbdd5be05e9f013e4c5bbef77a06
128
pas
Pascal
Blob_Lib/assimp-5.2.3/assimp/port/AssimpDelphi/aiColor4D.pas
antholuo/Blob_Traffic
5d6acf88044e9abc63c0ff356714179eaa4b75bf
[ "MIT" ]
null
null
null
Blob_Lib/assimp-5.2.3/assimp/port/AssimpDelphi/aiColor4D.pas
antholuo/Blob_Traffic
5d6acf88044e9abc63c0ff356714179eaa4b75bf
[ "MIT" ]
null
null
null
Blob_Lib/assimp-5.2.3/assimp/port/AssimpDelphi/aiColor4D.pas
antholuo/Blob_Traffic
5d6acf88044e9abc63c0ff356714179eaa4b75bf
[ "MIT" ]
null
null
null
version https://git-lfs.github.com/spec/v1 oid sha256:997392a8254d08127c7cc59c542079fe927f8210e90c5195eaf117d5139ba6d3 size 293
32
75
0.882813
f1fed8791b8e7e5c4be6029b37c37975409c0602
30,047
pas
Pascal
Libraries/DDuce/Factories/DDuce.Factories.VirtualTrees.pas
juliomar/Concepts
ef75301c6cc10c4cf7806432a970b87bf88937e2
[ "Apache-2.0" ]
null
null
null
Libraries/DDuce/Factories/DDuce.Factories.VirtualTrees.pas
juliomar/Concepts
ef75301c6cc10c4cf7806432a970b87bf88937e2
[ "Apache-2.0" ]
null
null
null
Libraries/DDuce/Factories/DDuce.Factories.VirtualTrees.pas
juliomar/Concepts
ef75301c6cc10c4cf7806432a970b87bf88937e2
[ "Apache-2.0" ]
1
2021-03-16T16:06:57.000Z
2021-03-16T16:06:57.000Z
{ Copyright (C) 2013-2019 Tim Sinaeve tim.sinaeve@gmail.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. } {$I DDuce.inc} unit DDuce.Factories.VirtualTrees; interface uses System.Classes, System.UITypes, Vcl.Controls, Spring, VirtualTrees; { TVSTOptions is a settings container which holds the most commonly adjusted properties of the TVirtualStringTree component. This is intended to create a consistent look and feel when the TVirtualStringTree control is used as a tree, grid, list, treegrid, or treelist control in your applications. } type TVSTOptions = class(TPersistent) strict private FHeaderOptions : TVTHeaderOptions; FPaintOptions : TVTPaintOptions; FAnimationOptions : TVTAnimationOptions; FAutoOptions : TVTAutoOptions; FStringOptions : TVTStringOptions; FSelectionOptions : TVTSelectionOptions; FMiscOptions : TVTMiscOptions; FEditOptions : TVTEditOptions; FColumnOptions : TVTColumnOptions; FLineStyle : TVTLineStyle; // style of the tree lines FLineMode : TVTLineMode; // tree lines or bands etc. FDrawSelectionMode : TVTDrawSelectionMode; FHintMode : TVTHintMode; FSelectionTextColor : TColor; FSelectionRectangleBlendColor : TColor; FGridLineColor : TColor; public procedure AssignTo(Dest: TPersistent); override; procedure Assign(Source: TPersistent); override; property HeaderOptions: TVTHeaderOptions read FHeaderOptions write FHeaderOptions; property PaintOptions: TVTPaintOptions read FPaintOptions write FPaintOptions; property AnimationOptions: TVTAnimationOptions read FAnimationOptions write FAnimationOptions; property AutoOptions: TVTAutoOptions read FAutoOptions write FAutoOptions; property StringOptions: TVTStringOptions read FStringOptions write FStringOptions; property SelectionOptions: TVTSelectionOptions read FSelectionOptions write FSelectionOptions; property MiscOptions: TVTMiscOptions read FMiscOptions write FMiscOptions; property EditOptions: TVTEditOptions read FEditOptions write FEditOptions; property ColumnOptions: TVTColumnOptions // TS: todo default column options read FColumnOptions write FColumnOptions; property LineStyle: TVTLineStyle read FLineStyle write FLineStyle; property LineMode: TVTLineMode read FLineMode write FLineMode; property DrawSelectionMode: TVTDrawSelectionMode read FDrawSelectionMode write FDrawSelectionMode; property HintMode: TVTHintMode read FHintMode write FHintMode; { background color for selection. } property SelectionRectangleBlendColor: TColor read FSelectionRectangleBlendColor write FSelectionRectangleBlendColor; { font color for text in selection. } property SelectionTextColor: TColor read FSelectionTextColor write FSelectionTextColor; property GridLineColor: TColor read FGridLineColor write FGridLineColor; end; type TVirtualStringTreeFactory = class sealed private class var FDefaultTreeOptions : Lazy<TVSTOptions>; FDefaultGridOptions : Lazy<TVSTOptions>; FDefaultListOptions : Lazy<TVSTOptions>; FDefaultTreeGridOptions : Lazy<TVSTOptions>; FDefaultTreeListOptions : Lazy<TVSTOptions>; class function GetDefaultGridOptions: TVSTOptions; static; class function GetDefaultListOptions: TVSTOptions; static; class function GetDefaultTreeGridOptions: TVSTOptions; static; class function GetDefaultTreeListOptions: TVSTOptions; static; class function GetDefaultTreeOptions: TVSTOptions; static; public class constructor Create; class function Create( AOwner : TComponent; AParent : TWinControl; const AName : string = '' ): TVirtualStringTree; class function CreateTree( AOwner : TComponent; AParent : TWinControl; const AName : string = '' ): TVirtualStringTree; class function CreateList( AOwner : TComponent; AParent : TWinControl; const AName : string = '' ): TVirtualStringTree; class function CreateGrid( AOwner : TComponent; AParent : TWinControl; const AName : string = '' ): TVirtualStringTree; class function CreateTreeGrid( AOwner : TComponent; AParent : TWinControl; const AName : string = '' ): TVirtualStringTree; class function CreateTreeList( AOwner : TComponent; AParent : TWinControl; const AName : string = '' ): TVirtualStringTree; class property DefaultTreeOptions: TVSTOptions read GetDefaultTreeOptions; class property DefaultGridOptions: TVSTOptions read GetDefaultGridOptions; class property DefaultListOptions: TVSTOptions read GetDefaultListOptions; class property DefaultTreeGridOptions: TVSTOptions read GetDefaultTreeGridOptions; class property DefaultTreeListOptions: TVSTOptions read GetDefaultTreeListOptions; end; implementation uses System.SysUtils, Vcl.Graphics; type TCustomVirtualStringTreeAccess = class(TCustomVirtualStringTree) end; {$REGION 'TVSTOptions'} procedure TVSTOptions.Assign(Source: TPersistent); var LOptions : TVSTOptions; begin if Source is TVSTOptions then begin LOptions := TVSTOptions(Source); AnimationOptions := LOptions.AnimationOptions; AutoOptions := LOptions.AutoOptions; MiscOptions := LOptions.MiscOptions; PaintOptions := LOptions.PaintOptions; SelectionOptions := LOptions.SelectionOptions; EditOptions := LOptions.EditOptions; HeaderOptions := LOptions.HeaderOptions; LineStyle := LOptions.LineStyle; LineMode := LOptions.LineMode; DrawSelectionMode := LOptions.DrawSelectionMode; HintMode := LOptions.HintMode; SelectionTextColor := LOptions.SelectionTextColor; GridLineColor := LOptions.GridLineColor; SelectionRectangleBlendColor := LOptions.SelectionRectangleBlendColor; StringOptions := LOptions.StringOptions; end else inherited Assign(Source); end; procedure TVSTOptions.AssignTo(Dest: TPersistent); var LTree : TCustomVirtualStringTreeAccess; LOptions : TVSTOptions; begin if Dest is TCustomVirtualStringTree then begin LTree := TCustomVirtualStringTreeAccess(Dest); LTree.TreeOptions.AnimationOptions := AnimationOptions; LTree.TreeOptions.AutoOptions := AutoOptions; LTree.TreeOptions.MiscOptions := MiscOptions; LTree.TreeOptions.PaintOptions := PaintOptions; LTree.TreeOptions.SelectionOptions := SelectionOptions; LTree.TreeOptions.EditOptions := EditOptions; LTree.Header.Options := HeaderOptions; LTree.LineStyle := LineStyle; LTree.LineMode := LineMode; LTree.DrawSelectionMode := DrawSelectionMode; LTree.HintMode := HintMode; LTree.Colors.SelectionTextColor := SelectionTextColor; LTree.Colors.GridLineColor := GridLineColor; LTree.Colors.SelectionRectangleBlendColor := SelectionRectangleBlendColor; TStringTreeOptions(LTree.TreeOptions).StringOptions := StringOptions; end else if Dest is TVSTOptions then begin LOptions := TVSTOptions(Dest); LOptions.AnimationOptions := AnimationOptions; LOptions.AutoOptions := AutoOptions; LOptions.MiscOptions := MiscOptions; LOptions.PaintOptions := PaintOptions; LOptions.SelectionOptions := SelectionOptions; LOptions.EditOptions := EditOptions; LOptions.HeaderOptions := HeaderOptions; LOptions.LineStyle := LineStyle; LOptions.LineMode := LineMode; LOptions.DrawSelectionMode := DrawSelectionMode; LOptions.HintMode := HintMode; LOptions.SelectionTextColor := SelectionTextColor; LOptions.GridLineColor := GridLineColor; LOptions.SelectionRectangleBlendColor := SelectionRectangleBlendColor; LOptions.StringOptions := StringOptions; end else inherited AssignTo(Dest); end; {$ENDREGION} {$REGION 'construction and destruction'} class constructor TVirtualStringTreeFactory.Create; begin {$REGION 'FDefaultTreeOptions'} FDefaultTreeOptions.Create( function: TVSTOptions begin Result := TVSTOptions.Create; with Result do begin HeaderOptions := [ {hoAutoResize,} {hoHeightResize,} {hoHeightDblClickResize,} {hoRestrictDrag,} {hoShowHint,} {hoShowImages,} {hoShowSortGlyphs,} {hoVisible} ]; PaintOptions := [ toHideFocusRect, {toHideSelection,} toPopupMode, toShowButtons, toShowDropmark, toShowRoot, toThemeAware, {toUseExplorerTheme,} toUseBlendedImages, toUseBlendedSelection, toStaticBackground ]; AnimationOptions := [ {toAnimatedToggle,} {toAdvancedAnimatedToggle} ]; AutoOptions := [ {toAutoDropExpand,} toAutoScroll, {toAutoScrollOnExpand,} toDisableAutoscrollOnEdit, toAutoSort, toAutoTristateTracking, toAutoDeleteMovedNodes, toAutoChangeScale, toAutoBidiColumnOrdering ]; StringOptions := [ toAutoAcceptEditChange ]; SelectionOptions := [ {toDisableDrawSelection,} toExtendedFocus, {toFullRowSelect,} {toLevelSelectConstraint,} {toMiddleClickSelect,} {toMultiSelect,} {toRightClickSelect,} {toSiblingSelectConstraint,} {toCenterScrollIntoView,} {toSimpleDrawSelection,} toAlwaysSelectNode{,} {toRestoreSelection,} {toSyncCheckboxesWithSelection} ]; MiscOptions := [ {toAcceptOLEDrop,} toCheckSupport, {toEditable,} {toFullRepaintOnResize,} {toGridExtensions,} toInitOnSave, {toReportMode,} toToggleOnDblClick, toWheelPanning, {toReadOnly,} toVariableNodeHeight{,} {toFullRowDrag,} {toNodeHeightResize,} {toNodeHeightDblClickResize,} {toEditOnClick,} {toEditOnDblClick,} {toReverseFullExpandHotKey} ]; EditOptions := toDefaultEdit; ColumnOptions := [ {coAllowClick,} {coDraggable,} {coEnabled,} {coParentBidiMode,} {coParentColor,} {coResizable,} {coShowDropMark,} {coVisible,} {coAutoSpring,} {coFixed,} {coSmartResize,} {coAllowFocus,} {coDisableAnimatedResize,} {coWrapCaption,} {coUseCaptionAlignment,} {coEditable,} {coStyleColor} ]; LineStyle := lsDotted; LineMode := lmNormal; DrawSelectionMode := smBlendedRectangle; HintMode := hmTooltip; SelectionRectangleBlendColor := clGray; SelectionTextColor := clBlack; GridLineColor := clSilver; end; end, True ); {$ENDREGION} {$REGION 'FDefaultGridOptions'} FDefaultGridOptions.Create( function: TVSTOptions begin Result := TVSTOptions.Create; with Result do begin HeaderOptions := [ hoAutoResize, hoColumnResize, hoDblClickResize, hoDrag, {hoHotTrack,} {hoOwnerDraw,} hoRestrictDrag, hoShowHint, hoShowImages, hoShowSortGlyphs, hoVisible, hoAutoSpring, {hoFullRepaintOnResize,} hoDisableAnimatedResize{,} {hoHeightResize,} {hoHeightDblClickResize,} {hoHeaderClickAutoSort,} {hoAutoColumnPopupMenu} ]; PaintOptions := [ toHideFocusRect, {toHideSelection,} {toHotTrack,} toPopupMode, {toShowBackground,} toShowButtons, toShowDropmark, toShowHorzGridLines, toShowRoot, {toShowTreeLines,} toShowVertGridLines, toThemeAware, toUseBlendedImages, {toGhostedIfUnfocused,} {toFullVertGridLines,} {toAlwaysHideSelection,} toUseBlendedSelection{,} {toStaticBackground,} {toChildrenAbove,} {toFixedIndent,} {toUseExplorerTheme,} {toHideTreeLinesIfThemed,} {toShowFilteredNodes} ]; AnimationOptions := [ {toAnimatedToggle,} {toAdvancedAnimatedToggle} ]; AutoOptions := [ toAutoDropExpand, {toAutoExpand,} toAutoScroll, toAutoScrollOnExpand, toAutoSort, {toAutoSpanColumns,} toAutoTristateTracking, {toAutoHideButtons,} toAutoDeleteMovedNodes, {toDisableAutoscrollOnFocus,} toAutoChangeScale, {toAutoFreeOnCollapse,} toDisableAutoscrollOnEdit, toAutoBidiColumnOrdering ]; StringOptions := [ toAutoAcceptEditChange ]; SelectionOptions := [ {toDisableDrawSelection,} toExtendedFocus, toFullRowSelect{,} {toLevelSelectConstraint,} {toMiddleClickSelect,} {toMultiSelect,} {toRightClickSelect,} {toSiblingSelectConstraint,} {toCenterScrollIntoView,} {toSimpleDrawSelection,} {toAlwaysSelectNode,} {toRestoreSelection,} {toSyncCheckboxesWithSelection} ]; MiscOptions := [ {toAcceptOLEDrop,} toCheckSupport, {toEditable,} {toFullRepaintOnResize,} {toGridExtensions,} toInitOnSave, {toReportMode,} toToggleOnDblClick, toWheelPanning, {toReadOnly,} toVariableNodeHeight{,} {toFullRowDrag,} {toNodeHeightResize,} {toNodeHeightDblClickResize,} {toEditOnClick,} {toEditOnDblClick,} {toReverseFullExpandHotKey} ]; EditOptions := toDefaultEdit; ColumnOptions := [ {coAllowClick,} {coDraggable,} {coEnabled,} {coParentBidiMode,} {coParentColor,} {coResizable,} {coShowDropMark,} {coVisible,} {coAutoSpring,} {coFixed,} {coSmartResize,} {coAllowFocus,} {coDisableAnimatedResize,} {coWrapCaption,} {coUseCaptionAlignment,} {coEditable,} {coStyleColor} ]; LineStyle := lsSolid; LineMode := lmBands; DrawSelectionMode := smBlendedRectangle; HintMode := hmTooltip; SelectionRectangleBlendColor := clGray; SelectionTextColor := clBlack; GridLineColor := clSilver; end; end, True ); {$ENDREGION} {$REGION 'FDefaultListOptions'} FDefaultListOptions.Create( function: TVSTOptions begin Result := TVSTOptions.Create; with Result do begin HeaderOptions := [ hoAutoResize, hoAutoSpring, hoColumnResize, hoDblClickResize, hoDrag, hoRestrictDrag, hoDisableAnimatedResize, hoShowHint, hoShowImages, hoShowSortGlyphs, hoVisible ]; PaintOptions := [ toHideFocusRect, {toHideSelection,} toHotTrack, toPopupMode, {toShowButtons,} toShowDropmark, {toShowRoot,} {toShowHorzGridLines,} {toShowVertGridLines,} toThemeAware, toUseExplorerTheme, toUseBlendedImages, toUseBlendedSelection, toStaticBackground ]; AnimationOptions := [ {toAnimatedToggle,} {toAdvancedAnimatedToggle} ]; AutoOptions := [ toAutoDropExpand, toAutoScroll, toAutoScrollOnExpand, toDisableAutoscrollOnEdit, toAutoSort, toAutoTristateTracking, toAutoDeleteMovedNodes, toAutoChangeScale, toAutoBidiColumnOrdering ]; StringOptions := [toAutoAcceptEditChange]; SelectionOptions := [ {toDisableDrawSelection,} toExtendedFocus, toFullRowSelect, {toLevelSelectConstraint,} {toMiddleClickSelect,} {toMultiSelect,} {toRightClickSelect,} {toSiblingSelectConstraint,} {toCenterScrollIntoView,} {toSimpleDrawSelection,} toAlwaysSelectNode{,} {toRestoreSelection,} {toSyncCheckboxesWithSelection} ]; MiscOptions := [ toCheckSupport, toInitOnSave, toToggleOnDblClick, toWheelPanning, toVariableNodeHeight ]; EditOptions := toDefaultEdit; ColumnOptions := [ {coAllowClick,} {coDraggable,} {coEnabled,} {coParentBidiMode,} {coParentColor,} {coResizable,} {coShowDropMark,} {coVisible,} {coAutoSpring,} {coFixed,} {coSmartResize,} {coAllowFocus,} {coDisableAnimatedResize,} {coWrapCaption,} {coUseCaptionAlignment,} {coEditable,} {coStyleColor} ]; LineStyle := lsSolid; LineMode := lmNormal; DrawSelectionMode := smBlendedRectangle; HintMode := hmTooltip; SelectionRectangleBlendColor := clGray; SelectionTextColor := clBlack; GridLineColor := clSilver; end; end, True ); {$ENDREGION} {$REGION 'FDefaultTreeGridOptions'} FDefaultTreeGridOptions.Create( function: TVSTOptions begin Result := TVSTOptions.Create; with Result do begin HeaderOptions := [ hoAutoResize, hoAutoSpring, hoColumnResize, hoDblClickResize, hoRestrictDrag, hoDisableAnimatedResize, hoShowHint, hoShowImages, hoShowSortGlyphs, hoVisible ]; PaintOptions := [ toHideFocusRect, {toHideSelection,} {toHotTrack,} toPopupMode, toShowButtons, toShowDropmark, toShowRoot, toShowHorzGridLines, toShowVertGridLines, toThemeAware, {toUseExplorerTheme,} toUseBlendedImages, toUseBlendedSelection, toStaticBackground ]; AnimationOptions := [ {toAnimatedToggle,} {toAdvancedAnimatedToggle} ]; AutoOptions := [ toAutoDropExpand, toAutoScroll, toAutoScrollOnExpand, toDisableAutoscrollOnEdit, toAutoSort, toAutoTristateTracking, toAutoDeleteMovedNodes, toAutoChangeScale, toAutoBidiColumnOrdering ]; StringOptions := [toAutoAcceptEditChange]; SelectionOptions := [ {toDisableDrawSelection,} toExtendedFocus, toFullRowSelect, {toLevelSelectConstraint,} {toMiddleClickSelect,} {toMultiSelect,} {toRightClickSelect,} {toSiblingSelectConstraint,} {toCenterScrollIntoView,} {toSimpleDrawSelection,} toAlwaysSelectNode{,} {toRestoreSelection,} {toSyncCheckboxesWithSelection} ]; MiscOptions := [ toCheckSupport, toInitOnSave, toToggleOnDblClick, toWheelPanning, toVariableNodeHeight ]; EditOptions := toDefaultEdit; ColumnOptions := [ {coAllowClick,} {coDraggable,} {coEnabled,} {coParentBidiMode,} {coParentColor,} {coResizable,} {coShowDropMark,} {coVisible,} {coAutoSpring,} {coFixed,} {coSmartResize,} {coAllowFocus,} {coDisableAnimatedResize,} {coWrapCaption,} {coUseCaptionAlignment,} {coEditable,} {coStyleColor} ]; LineStyle := lsSolid; LineMode := lmNormal; DrawSelectionMode := smBlendedRectangle; HintMode := hmTooltip; SelectionRectangleBlendColor := clGray; SelectionTextColor := clBlack; GridLineColor := clSilver; end; end, True ); {$ENDREGION} {$REGION 'FDefaultTreeListOptions'} FDefaultTreeListOptions.Create( function: TVSTOptions begin Result := TVSTOptions.Create; with Result do begin HeaderOptions := [ hoAutoResize, hoAutoSpring, hoColumnResize, hoDblClickResize, hoRestrictDrag, hoDisableAnimatedResize, hoShowHint, hoShowImages, hoShowSortGlyphs, hoVisible ]; PaintOptions := [ toHideFocusRect, {toHideSelection,} toHotTrack, toPopupMode, toShowButtons, toShowDropmark, toShowRoot, {toShowHorzGridLines,} toShowVertGridLines, toThemeAware, toUseExplorerTheme, toUseBlendedSelection, toUseBlendedImages, toStaticBackground ]; AnimationOptions := [ {toAnimatedToggle,} {toAdvancedAnimatedToggle} ]; AutoOptions := [ toAutoDropExpand, toAutoScroll, toAutoScrollOnExpand, toDisableAutoscrollOnEdit, toAutoSort, toAutoTristateTracking, toAutoDeleteMovedNodes, toAutoChangeScale, toAutoBidiColumnOrdering ]; StringOptions := [toAutoAcceptEditChange]; SelectionOptions := [ {toDisableDrawSelection,} toExtendedFocus, toFullRowSelect, {toLevelSelectConstraint,} {toMiddleClickSelect,} {toMultiSelect,} {toRightClickSelect,} {toSiblingSelectConstraint,} {toCenterScrollIntoView,} {toSimpleDrawSelection,} toAlwaysSelectNode{,} {toRestoreSelection,} {toSyncCheckboxesWithSelection} ]; MiscOptions := [ toCheckSupport, toInitOnSave, toToggleOnDblClick, toWheelPanning, toVariableNodeHeight ]; EditOptions := toDefaultEdit; ColumnOptions := [ {coAllowClick,} {coDraggable,} {coEnabled,} {coParentBidiMode,} {coParentColor,} {coResizable,} {coShowDropMark,} {coVisible,} {coAutoSpring,} {coFixed,} {coSmartResize,} {coAllowFocus,} {coDisableAnimatedResize,} {coWrapCaption,} {coUseCaptionAlignment,} {coEditable,} {coStyleColor} ]; LineStyle := lsSolid; LineMode := lmNormal; DrawSelectionMode := smBlendedRectangle; HintMode := hmTooltip; SelectionRectangleBlendColor := clGray; SelectionTextColor := clBlack; GridLineColor := clSilver; end; end, True ); {$ENDREGION} end; {$ENDREGION} {$REGION 'property access methods'} class function TVirtualStringTreeFactory.GetDefaultGridOptions: TVSTOptions; begin Result := FDefaultGridOptions; end; class function TVirtualStringTreeFactory.GetDefaultListOptions: TVSTOptions; begin Result := FDefaultListOptions; end; class function TVirtualStringTreeFactory.GetDefaultTreeGridOptions: TVSTOptions; begin Result := FDefaultTreeGridOptions; end; class function TVirtualStringTreeFactory.GetDefaultTreeListOptions: TVSTOptions; begin Result := FDefaultTreeListOptions; end; class function TVirtualStringTreeFactory.GetDefaultTreeOptions: TVSTOptions; begin Result := FDefaultTreeOptions; end; {$ENDREGION} {$REGION 'public methods'} { Creates a TVirtualStringTree instance with stock settings. } class function TVirtualStringTreeFactory.Create(AOwner: TComponent; AParent: TWinControl; const AName: string): TVirtualStringTree; var VST : TVirtualStringTree; begin Guard.CheckNotNull(AOwner, 'AOwner'); Guard.CheckNotNull(AParent, 'AParent'); VST := TVirtualStringTree.Create(AOwner); VST.AlignWithMargins := True; VST.Parent := AParent; VST.Align := alClient; VST.Header.Height := 18; VST.ShowHint := True; Result := VST; end; { Creates a TVirtualStringTree that is tuned to behave and look like a grid control. } class function TVirtualStringTreeFactory.CreateGrid(AOwner: TComponent; AParent: TWinControl; const AName: string): TVirtualStringTree; var VST : TVirtualStringTree; begin Guard.CheckNotNull(AOwner, 'AOwner'); Guard.CheckNotNull(AParent, 'AParent'); VST := TVirtualStringTree.Create(AOwner); VST.AlignWithMargins := True; VST.Parent := AParent; VST.Align := alClient; VST.Header.Height := 18; DefaultGridOptions.AssignTo(VST); VST.Indent := 2; // show first column as a normal grid column VST.ShowHint := True; Result := VST; end; { Creates a TVirtualStringTree that mimics a list control. } class function TVirtualStringTreeFactory.CreateList(AOwner: TComponent; AParent: TWinControl; const AName: string): TVirtualStringTree; var VST : TVirtualStringTree; begin Guard.CheckNotNull(AOwner, 'AOwner'); Guard.CheckNotNull(AParent, 'AParent'); VST := TVirtualStringTree.Create(AOwner); VST.AlignWithMargins := True; VST.Parent := AParent; VST.Align := alClient; VST.Header.Height := 18; DefaultListOptions.AssignTo(VST); VST.Indent := 2; // show first column as a normal grid column VST.ShowHint := True; Result := VST; end; { Creates a TVirtualStringTree that will be used as a simple tree control with no header. } class function TVirtualStringTreeFactory.CreateTree(AOwner: TComponent; AParent: TWinControl; const AName: string): TVirtualStringTree; var VST : TVirtualStringTree; begin Guard.CheckNotNull(AOwner, 'AOwner'); Guard.CheckNotNull(AParent, 'AParent'); VST := TVirtualStringTree.Create(AOwner); VST.AlignWithMargins := True; VST.Parent := AParent; VST.Align := alClient; VST.ShowHint := True; DefaultTreeOptions.AssignTo(VST); Result := VST; end; { Creates a TVirtualStringTree with a header and columns, using the first column to display the tree structure and tuned to behave and look like a grid control. } class function TVirtualStringTreeFactory.CreateTreeGrid(AOwner: TComponent; AParent: TWinControl; const AName: string): TVirtualStringTree; var VST : TVirtualStringTree; begin Guard.CheckNotNull(AOwner, 'AOwner'); Guard.CheckNotNull(AParent, 'AParent'); VST := TVirtualStringTree.Create(AOwner); VST.AlignWithMargins := True; VST.Parent := AParent; VST.Align := alClient; VST.Header.Height := 18; VST.ShowHint := True; DefaultTreeGridOptions.AssignTo(VST); Result := VST; end; { Creates a TVirtualStringTree with a header and columns, using the first column to display the tree structure and tuned to behave and look like a list control. } class function TVirtualStringTreeFactory.CreateTreeList(AOwner: TComponent; AParent: TWinControl; const AName: string): TVirtualStringTree; var VST : TVirtualStringTree; begin Guard.CheckNotNull(AOwner, 'AOwner'); Guard.CheckNotNull(AParent, 'AParent'); VST := TVirtualStringTree.Create(AOwner); VST.AlignWithMargins := True; VST.Parent := AParent; VST.Align := alClient; VST.Header.Height := 18; VST.ShowHint := True; DefaultTreeListOptions.AssignTo(VST); Result := VST; end; {$ENDREGION} end.
30.535569
81
0.608746
83c035bae7b274e9209044d0c9d97986b1b4211d
7,632
dfm
Pascal
src/xray/editors/ECore/Editor/SoundEditor.dfm
OLR-xray/OLR-3.0
b6a9bb2a0c1fb849b8c6cea2e831e1ceea5cc611
[ "Apache-2.0" ]
8
2016-01-25T20:18:51.000Z
2019-03-06T07:00:04.000Z
src/xray/editors/ECore/Editor/SoundEditor.dfm
OLR-xray/OLR-3.0
b6a9bb2a0c1fb849b8c6cea2e831e1ceea5cc611
[ "Apache-2.0" ]
null
null
null
src/xray/editors/ECore/Editor/SoundEditor.dfm
OLR-xray/OLR-3.0
b6a9bb2a0c1fb849b8c6cea2e831e1ceea5cc611
[ "Apache-2.0" ]
3
2016-02-14T01:20:43.000Z
2021-02-03T11:19:11.000Z
object frmSoundLib: TfrmSoundLib Left = -578 Top = 142 Width = 350 Height = 469 BorderIcons = [biSystemMenu, biMinimize] Caption = 'Sound Editor' Color = 10528425 Constraints.MinHeight = 400 Constraints.MinWidth = 350 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] FormStyle = fsStayOnTop KeyPreview = True OldCreateOrder = False Scaled = False OnClose = FormClose OnCreate = FormCreate OnDestroy = FormDestroy OnKeyDown = FormKeyDown OnShow = FormShow PixelsPerInch = 96 TextHeight = 13 object Splitter1: TSplitter Left = 168 Top = 0 Width = 2 Height = 435 Cursor = crHSplit Align = alRight Color = 13816530 ParentColor = False end object paRight: TPanel Left = 170 Top = 0 Width = 172 Height = 435 Align = alRight BevelOuter = bvLowered Color = 10528425 Constraints.MinWidth = 172 TabOrder = 0 object paCommand: TPanel Left = 1 Top = 398 Width = 170 Height = 36 Align = alBottom BevelOuter = bvNone Color = 10528425 TabOrder = 0 object ebOk: TExtBtn Left = 0 Top = 2 Width = 170 Height = 17 Align = alTop BevelShow = False Caption = 'Ok' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] ParentFont = False FlatAlwaysEdge = True OnClick = ebOkClick end object ebCancel: TExtBtn Left = 0 Top = 19 Width = 170 Height = 17 Align = alTop BevelShow = False Caption = 'Cancel' Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] ParentFont = False FlatAlwaysEdge = True OnClick = ebCancelClick end object Panel1: TPanel Left = 0 Top = 0 Width = 170 Height = 2 Align = alTop BevelOuter = bvNone ParentColor = True TabOrder = 0 object Panel3: TPanel Left = 0 Top = 0 Width = 170 Height = 2 Align = alTop BevelOuter = bvNone ParentColor = True TabOrder = 0 end end end object paProperties: TPanel Left = 1 Top = 1 Width = 170 Height = 397 Align = alClient BevelOuter = bvNone Color = 10528425 TabOrder = 1 end end object paItems: TPanel Left = 0 Top = 0 Width = 168 Height = 435 Align = alClient BevelOuter = bvNone ParentColor = True TabOrder = 1 end object fsStorage: TFormStorage Version = 1 OnSavePlacement = fsStorageSavePlacement OnRestorePlacement = fsStorageRestorePlacement StoredProps.Strings = ( 'paRight.Width') StoredValues = <> end object ImageList: TImageList Height = 10 Width = 11 Left = 32 Bitmap = { 494C01010200040004000B000A00FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 00000000000036000000280000002C0000000A0000000100200000000000E006 0000000000000000000000000000000000000000000000000000000000000000 00000C0C57000C0C570000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000C0C57000C0C5700000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 00000C0C57000C0C570000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000002A2A57000C0C57000C0C57002A2A57000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000002A2A 57000C0C57000C0C57002A2A5700000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000002A2A57000C0C57000C0C57002A2A57000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000002A2A 57000C0C57000C0C57002A2A5700000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000C0C57000C0C5700000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000424D3E000000000000003E000000 280000002C0000000A0000000100010000000000500000000000000000000000 000000000000000000000000FFFFFF00F3FFFC0000000000F3FDFC0000000000 FFF8FC0000000000FFF07C0000000000F3E33C0000000000E1E79C0000000000 E1FFCC0000000000E1FFE40000000000E1FFF40000000000F3FFFC0000000000 00000000000000000000000000000000000000000000} end end
36.342857
70
0.763234
f1fcd2692cff1824f4d03f2aa80ecd0c17120631
2,803
dfm
Pascal
windows/src/ext/jedi/jvcl/tests/archive/jvcl/examples/Profiler32/Profiler32MainFormU.dfm
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/examples/Profiler32/Profiler32MainFormU.dfm
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/examples/Profiler32/Profiler32MainFormU.dfm
bravogeorge/keyman
c0797e36292de903d7313214d1f765e3d9a2bf4d
[ "MIT" ]
72
2017-05-26T04:08:37.000Z
2022-03-03T10:26:20.000Z
object Profiler32MainForm: TProfiler32MainForm Left = 343 Top = 157 Width = 506 Height = 307 Caption = 'Profiler 32 test program' Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] KeyPreview = True OldCreateOrder = True OnClose = FormClose OnCreate = FormCreate OnKeyDown = FormKeyDown PixelsPerInch = 96 TextHeight = 13 object ListBox1: TListBox Left = 0 Top = 41 Width = 498 Height = 225 Align = alClient BorderStyle = bsNone ItemHeight = 13 Items.Strings = ( 'ASSOC' 'AT' 'ATTRIB' 'BREAK' 'CACLS' 'CALL' 'CD' 'CHCP' 'CHDIR' 'CHKDSK' 'CLS' 'CMD' 'COLOR' 'COMP' 'COMPACT' 'CONVERT' 'COPY' 'DATE' 'DEL' 'DIR' 'DISKCOMP' 'DISKCOPY' 'DOSKEY' 'ECHO' 'ENDLOCAL' 'ERASE' 'EXIT' 'FC' 'FIND' 'FINDSTR' 'FOR' 'FORMAT' 'FTYPE' 'GOTO' 'GRAFTABL' 'HELP' 'IF' 'KEYB' 'LABEL' 'MD' 'MKDIR' 'MODE' 'MORE' 'MOVE' 'PATH' 'PAUSE' 'POPD' 'PRINT' 'PROMPT' 'PUSHD' 'RD' 'RECOVER' 'REM' 'REN' 'RENAME' 'REPLACE' 'RESTORE' 'RMDIR' 'SET' 'SETLOCAL' 'SHIFT' 'SORT' 'START' 'SUBST' 'TIME' 'TITLE' 'TREE' 'TYPE' 'VER' 'VERIFY' 'VOL' 'XCOPY') TabOrder = 0 end object Panel1: TPanel Left = 0 Top = 0 Width = 498 Height = 41 Align = alTop BevelOuter = bvNone TabOrder = 1 object Label1: TLabel Left = 10 Top = 10 Width = 64 Height = 13 Caption = 'Create report:' end object UseIdBtn: TButton Left = 104 Top = 8 Width = 75 Height = 25 Caption = 'Use &ID' TabOrder = 0 OnClick = UseIdBtnClick end object UseNameBtn: TButton Left = 192 Top = 8 Width = 75 Height = 25 Caption = 'Use &name' TabOrder = 1 OnClick = UseNameBtnClick end object ResultBtn: TButton Left = 392 Top = 8 Width = 75 Height = 25 Caption = '&Result' TabOrder = 2 OnClick = ResultBtnClick end end object Progress: TProgressBar Left = 0 Top = 266 Width = 498 Height = 16 Align = alBottom TabOrder = 2 end object P: TJvProfiler Left = 376 Top = 56 end end
17.628931
47
0.467
f19607f232b35f7fb2726a1a21c4380b02942f58
6,972
pas
Pascal
windows/src/ext/jedi/jvcl/jvcl/design/JvSegmentedLEDDisplayMappingForm.pas
bravogeorge/keyman
c0797e36292de903d7313214d1f765e3d9a2bf4d
[ "MIT" ]
219
2017-06-21T03:37:03.000Z
2022-03-27T12:09:28.000Z
windows/src/ext/jedi/jvcl/jvcl/design/JvSegmentedLEDDisplayMappingForm.pas
bravogeorge/keyman
c0797e36292de903d7313214d1f765e3d9a2bf4d
[ "MIT" ]
4,451
2017-05-29T02:52:06.000Z
2022-03-31T23:53:23.000Z
windows/src/ext/jedi/jvcl/jvcl/design/JvSegmentedLEDDisplayMappingForm.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: JvSegmentedLEDDisplayMappingForm.PAS, released on 2002-05-26. The Initial Developer of the Original Code is John Doe. Portions created by John Doe are Copyright (C) 2003 John Doe. 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.delphi-jedi.org Known Issues: -----------------------------------------------------------------------------} // $Id$ unit JvSegmentedLEDDisplayMappingForm; {$I jvcl.inc} interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, DesignIntf, DesignEditors, JvBaseDsgnForm, JvSegmentedLEDDisplayMapperFrame, JvSegmentedLEDDisplay, JvBaseDsgnFrame, JvDsgnTypes; type TfrmJvSLDMappingEditor = class(TJvBaseDesign) fmeMapper: TfmeJvSegmentedLEDDisplayMapper; lblDigitClassCaption: TLabel; lblSegmentCountCaption: TLabel; lblCharCaption: TLabel; lblMapperValueCaption: TLabel; lblSegmentsCaption: TLabel; lblDigitClass: TLabel; lblSegmentCount: TLabel; lblChar: TLabel; lblMapperValue: TLabel; lblSegments: TLabel; btnOK: TButton; procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); private FDesigner: IJvFormDesigner; function GetDisplay: TJvCustomSegmentedLEDDisplay; procedure SetDisplay(Value: TJvCustomSegmentedLEDDisplay); procedure SetDesigner(Value: IJvFormDesigner); protected function DesignerFormName: string; override; function AutoStoreSettings: Boolean; override; procedure StoreSettings; override; procedure RestoreSettings; override; procedure UpdateDigitClass(Sender: TObject); procedure UpdateInfo(Sender: TObject); procedure MappingChanged(Sender: TObject); public procedure Loaded; override; property Designer: IJvFormDesigner read FDesigner write SetDesigner; property Display: TJvCustomSegmentedLEDDisplay read GetDisplay write SetDisplay; end; procedure EditSLDMapping(ADisplay: TJvCustomSegmentedLEDDisplay; ADesigner: IJvFormDesigner); implementation uses Registry, {$IFNDEF COMPILER12_UP} JvJCLUtils, {$ENDIF ~COMPILER12_UP} JvDsgnConsts; {$R *.dfm} const cLastOpenFolder = 'LastOpenFolder'; cLastSaveFolder = 'LastSaveFolder'; function IsSLDMappingEditForm(Form: TJvBaseDesign; const Args: array of const): Boolean; begin Result := Form is TfrmJvSLDMappingEditor; if Result then with (Form as TfrmJvSLDMappingEditor) do Result := (Pointer(Display) = Args[0].VObject) and (Pointer(Designer) = Args[1].VInterface); end; procedure EditSLDMapping(ADisplay: TJvCustomSegmentedLEDDisplay; ADesigner: IJvFormDesigner); var Form: TfrmJvSLDMappingEditor; begin Form := TfrmJvSLDMappingEditor(GetDesignerForm(IsSLDMappingEditForm, [ADisplay, ADesigner])); if Form = nil then begin Form := TfrmJvSLDMappingEditor.Create(nil); try Form.Display := ADisplay; Form.Designer := ADesigner; except FreeAndNil(Form); raise; end; end; Form.Show; Form.BringToFront; end; //=== { TfrmJvSLDMappingEditor } ============================================= function TfrmJvSLDMappingEditor.GetDisplay: TJvCustomSegmentedLEDDisplay; begin Result := fmeMapper.Display; end; procedure TfrmJvSLDMappingEditor.SetDisplay(Value: TJvCustomSegmentedLEDDisplay); begin if Value <> Display then fmeMapper.Display := Value; end; procedure TfrmJvSLDMappingEditor.SetDesigner(Value: IJvFormDesigner); begin if Value <> FDesigner then FDesigner := Value; end; function TfrmJvSLDMappingEditor.DesignerFormName: string; begin Result := RsSegmentedLEDDisplayMappingEditor; end; function TfrmJvSLDMappingEditor.AutoStoreSettings: Boolean; begin Result := True; end; procedure TfrmJvSLDMappingEditor.StoreSettings; begin inherited StoreSettings; with TRegistry.Create do try LazyWrite := False; if OpenKey(GetRegKey, True) then try WriteString(cLastOpenFolder, fmeMapper.LastOpenFolder); WriteString(cLastSaveFolder, fmeMapper.LastSaveFolder); finally CloseKey; end; finally Free; end; end; procedure TfrmJvSLDMappingEditor.RestoreSettings; begin inherited RestoreSettings; with TRegistry.Create do try if OpenKey(GetRegKey, False) then try if ValueExists(cLastOpenFolder) then fmeMapper.LastOpenFolder := ReadString(cLastOpenFolder); if ValueExists(cLastSaveFolder) then fmeMapper.LastSaveFolder := ReadString(cLastSaveFolder); finally CloseKey; end; finally Free; end; end; procedure TfrmJvSLDMappingEditor.UpdateDigitClass(Sender: TObject); begin if fmeMapper.Display <> nil then begin lblDigitClass.Caption := fmeMapper.DigitClass.ClassName; lblSegmentCount.Caption := IntToStr(fmeMapper.DigitClass.SegmentCount); end else begin lblDigitClass.Caption := ''; lblSegmentCount.Caption := ''; end; end; procedure TfrmJvSLDMappingEditor.UpdateInfo(Sender: TObject); begin with fmeMapper do begin if CharSelected then begin if CharInSet(CurChar, ['!' .. 'z']) then lblChar.Caption := CurChar + ' (#' + IntToStr(Ord(CurChar)) + ')' else lblChar.Caption := '#' + IntToStr(Ord(CurChar)); end else lblChar.Caption := ''; if Display <> nil then begin lblMapperValue.Caption := IntToStr(sldEdit.Digits[0].GetSegmentStates); lblSegments.Caption := sldEdit.Digits[0].GetSegmentString; end else begin lblMapperValue.Caption := ''; lblSegments.Caption := ''; end; end; end; procedure TfrmJvSLDMappingEditor.MappingChanged(Sender: TObject); begin if Designer <> nil then Designer.Modified; end; procedure TfrmJvSLDMappingEditor.Loaded; begin inherited Loaded; Constraints.MinHeight := Height; Constraints.MaxHeight := Height; Constraints.MinWidth := Width; if fmeMapper <> nil then begin fmeMapper.OnMappingChanged := MappingChanged; fmeMapper.OnDisplayChanged := UpdateDigitClass; fmeMapper.OnInfoUpdate := UpdateInfo; end; end; procedure TfrmJvSLDMappingEditor.FormCloseQuery(Sender: TObject; var CanClose: Boolean); begin CanClose := fmeMapper.CanClose; // (rom) this seems silly if CanClose then inherited; end; end.
27.341176
95
0.715577
85afbba05ad0a0e29caea33945ad508517e15a5b
622
dpr
Pascal
Sources/BottomNavigation.dpr
Embarcadero/Bottom-Navigation-Template
0cf8cf1f2c52698934cfbcd595bd7f80260998ce
[ "MIT" ]
null
null
null
Sources/BottomNavigation.dpr
Embarcadero/Bottom-Navigation-Template
0cf8cf1f2c52698934cfbcd595bd7f80260998ce
[ "MIT" ]
null
null
null
Sources/BottomNavigation.dpr
Embarcadero/Bottom-Navigation-Template
0cf8cf1f2c52698934cfbcd595bd7f80260998ce
[ "MIT" ]
null
null
null
program BottomNavigation; uses System.StartUpCopy, FMX.Forms, ufrmMain in 'GUI\ufrmMain.pas' {fmrMain}, ufrmBasic in 'GUI\ufrmBasic.pas' {frmBasic}, ufrmShifting in 'GUI\ufrmShifting.pas' {frmShifting}, ufrmLight in 'GUI\ufrmLight.pas' {frmLight}, ufrmDark in 'GUI\ufrmDark.pas' {frmDark}, ufrmIcon in 'GUI\ufrmIcon.pas' {frmIcon}, ufrmPrimary in 'GUI\ufrmPrimary.pas' {frmPrimary}, ufrmMap in 'GUI\ufrmMap.pas' {frmMap}, ufrmLightSimple in 'GUI\ufrmLightSimple.pas' {frmLightSimple}; {$R *.res} begin Application.Initialize; Application.CreateForm(TfmrMain, fmrMain); Application.Run; end.
27.043478
64
0.737942
f12caaf69240d42ab441b11470591b3ad46d82bb
489
pas
Pascal
Libraries/Spring4D/Samples/IntroToDependencyInjection/8-FieldInjection/uOrderInterfaces.pas
jomael/Concepts
82d18029e41d55e897d007f826c021cdf63e53f8
[ "Apache-2.0" ]
62
2016-01-20T16:26:25.000Z
2022-02-28T14:25:52.000Z
Libraries/Spring4D/Samples/IntroToDependencyInjection/8-FieldInjection/uOrderInterfaces.pas
jomael/Concepts
82d18029e41d55e897d007f826c021cdf63e53f8
[ "Apache-2.0" ]
null
null
null
Libraries/Spring4D/Samples/IntroToDependencyInjection/8-FieldInjection/uOrderInterfaces.pas
jomael/Concepts
82d18029e41d55e897d007f826c021cdf63e53f8
[ "Apache-2.0" ]
20
2016-09-08T00:15:22.000Z
2022-01-26T13:13:08.000Z
unit uOrderInterfaces; interface uses uOrder; type IOrderValidator = interface ['{6D0F52B4-A96F-4C96-97A4-DE45324FDE1B}'] function ValidateOrder(aOrder: TOrder): Boolean; end; IOrderEntry = interface ['{8D272909-3324-4849-A128-C85E249520CD}'] function EnterOrderIntoDatabase(aOrder: TOrder): Boolean; end; IOrderProcessor = interface ['{978361F2-65F0-49F7-A00C-964C05683682}'] function ProcessOrder(aOrder: TOrder): Boolean; end; implementation end.
18.111111
61
0.738241
f19ce079be8feddb180e83e32a21374eb6690fd1
3,366
pas
Pascal
Components/JVCL/examples/JvTimeFrameWork/PhotoOp/ShareUnit.pas
sabatex/Delphi
0efbe6eb38bf8aa2bf269d1866741266e90b9cbf
[ "MIT" ]
null
null
null
Components/JVCL/examples/JvTimeFrameWork/PhotoOp/ShareUnit.pas
sabatex/Delphi
0efbe6eb38bf8aa2bf269d1866741266e90b9cbf
[ "MIT" ]
null
null
null
Components/JVCL/examples/JvTimeFrameWork/PhotoOp/ShareUnit.pas
sabatex/Delphi
0efbe6eb38bf8aa2bf269d1866741266e90b9cbf
[ "MIT" ]
1
2019-12-24T08:39:18.000Z
2019-12-24T08:39:18.000Z
{****************************************************************** 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 ShareUnit; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, Buttons, checklst; type TShare = class(TForm) ResourcesCheckList: TCheckListBox; OKButton: TBitBtn; CancelButton: TBitBtn; procedure FormShow(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); private { Private declarations } public { Public declarations } end; var Share: TShare; implementation Uses PhotoOpUnit, JvTFManager; {$R *.DFM} procedure TShare.FormShow(Sender: TObject); var Appt : TJvTFAppt; I : Integer; begin // First, get the selected appointment Appt := PhotoOpMain.JvTFDays1.SelAppt; // now roll through the resource list and check all resources // that are found in the appointment's list of schedules. With ResourcesCheckList do For I := 0 to Items.Count - 1 do Checked[I] := Appt.IndexOfSchedule(Items[I]) > -1; end; procedure TShare.FormClose(Sender: TObject; var Action: TCloseAction); var TempList : TStringList; I : Integer; begin If ModalResult = mrOK Then Begin // create and populate a temporary list of the selected resources // from the checklistbox. TempList := TStringList.Create; Try With ResourcesCheckList do For I := 0 to Items.Count - 1 do If Checked[I] Then TempList.Add(Items[I]); // Enforce a business rule where removing all resources from an // appointment causes the appointment to be deleted. // NOTE: This is NOT a requirement. Feel free to implement any // business rules as you see fit. If TempList.Count > 0 Then // If at least one resource then change the appointment's // schedule list to match the temp list. PhotoOpMain.JvTFDays1.SelAppt.AssignSchedules(TempList) Else If MessageDlg('You have removed this appointment from all schedules.' + ' This will cause the appointment to be deleted.' + #13#10 + 'Are you sure this is what you want to do?', mtConfirmation, [mbYes, mbNo], 0) = mrYes Then With PhotoOpMain.JvTFDays1 do // Delete the appointment if that is what the user wants to do. ScheduleManager.dbDeleteAppt(SelAppt) Else Action := caNone; Finally TempList.Free; End; End; end; end.
29.526316
85
0.641711
4737fa6289ec5ffbe3092e048741849c68e380b5
401
pas
Pascal
O3.pas
igororeshin/Homeworks
18f8737ba407d0eadf825be91c2d2c3b6978d075
[ "Apache-2.0" ]
null
null
null
O3.pas
igororeshin/Homeworks
18f8737ba407d0eadf825be91c2d2c3b6978d075
[ "Apache-2.0" ]
null
null
null
O3.pas
igororeshin/Homeworks
18f8737ba407d0eadf825be91c2d2c3b6978d075
[ "Apache-2.0" ]
null
null
null
const N = 4; var a: array [1..N] of integer; i, p: integer; begin for i := 1 to N do begin readln(a[i]); end; for i := 1 to N do begin p := i; while (p > 1) and (a[p] < a[p - 1]) do begin a[p] := a[p] + a[p - 1]; a[p - 1] := a[p] - a[p - 1]; a[p] := a[p] - a[p - 1]; p := p - 1; end; end; for i := 1 to N do write(a[i], ' '); end.
14.851852
42
0.391521
6a8c99f0715e0f341a21252480fcc90844876ce2
5,323
pas
Pascal
Source/TextEditor.Export.HTML.pas
edwinyzh/TTextEditor
d1844c5ff10fe302457b8d58348c7dbd015703e7
[ "MIT" ]
null
null
null
Source/TextEditor.Export.HTML.pas
edwinyzh/TTextEditor
d1844c5ff10fe302457b8d58348c7dbd015703e7
[ "MIT" ]
null
null
null
Source/TextEditor.Export.HTML.pas
edwinyzh/TTextEditor
d1844c5ff10fe302457b8d58348c7dbd015703e7
[ "MIT" ]
null
null
null
unit TextEditor.Export.HTML; interface uses System.Classes, System.SysUtils, Vcl.Graphics, TextEditor.Highlighter, TextEditor.Lines; type TTextEditorExportHTML = class(TObject) private FCharSet: string; FFont: TFont; FHighlighter: TTextEditorHighlighter; FLines: TTextEditorLines; FStringList: TStrings; procedure CreateHTMLDocument; procedure CreateHeader; procedure CreateInternalCSS; procedure CreateLines; procedure CreateFooter; public constructor Create(const ALines: TTextEditorLines; const AHighlighter: TTextEditorHighlighter; const AFont: TFont; const ACharSet: string); overload; destructor Destroy; override; procedure SaveToStream(AStream: TStream; AEncoding: System.SysUtils.TEncoding); end; implementation uses Winapi.Windows, System.UITypes, TextEditor.Consts, TextEditor.Highlighter.Attributes, TextEditor.Highlighter.Colors, TextEditor.Utils; constructor TTextEditorExportHTML.Create(const ALines: TTextEditorLines; const AHighlighter: TTextEditorHighlighter; const AFont: TFont; const ACharSet: string); begin inherited Create; FStringList := TStringList.Create; FCharSet := ACharSet; if FCharSet = '' then FCharSet := 'utf-8'; FLines := ALines; FHighlighter := AHighlighter; FFont := AFont; end; destructor TTextEditorExportHTML.Destroy; begin FStringList.Free; inherited Destroy; end; procedure TTextEditorExportHTML.CreateHTMLDocument; begin if not Assigned(FHighlighter) then Exit; if FLines.Count = 0 then Exit; CreateHeader; CreateLines; CreateFooter; end; procedure TTextEditorExportHTML.CreateHeader; begin FStringList.Add('<!DOCTYPE HTML>'); FStringList.Add(''); FStringList.Add('<html>'); FStringList.Add('<head>'); FStringList.Add(' <meta charset="' + FCharSet + '">'); CreateInternalCSS; FStringList.Add('</head>'); FStringList.Add(''); FStringList.Add('<body class="Editor">'); end; procedure TTextEditorExportHTML.CreateInternalCSS; var LIndex: Integer; LStyles: TList; LElement: PTextEditorHighlighterElement; begin FStringList.Add(' <style>'); FStringList.Add(' body {'); FStringList.Add(' font-family: ' + FFont.Name + ';'); FStringList.Add(' font-size: ' + IntToStr(FFont.Size) + 'px;'); FStringList.Add(' }'); LStyles := FHighlighter.Colors.Styles; for LIndex := 0 to LStyles.Count - 1 do begin LElement := LStyles.Items[LIndex]; FStringList.Add(' .' + LElement^.Name + ' { '); FStringList.Add(' color: ' + ColorToHex(LElement^.Foreground) + ';'); FStringList.Add(' background-color: ' + ColorToHex(LElement^.Background) + ';'); if TFontStyle.fsBold in LElement^.FontStyles then FStringList.Add(' font-weight: bold;'); if TFontStyle.fsItalic in LElement^.FontStyles then FStringList.Add(' font-style: italic;'); if TFontStyle.fsUnderline in LElement^.FontStyles then FStringList.Add(' text-decoration: underline;'); if TFontStyle.fsStrikeOut in LElement^.FontStyles then FStringList.Add(' text-decoration: line-through;'); FStringList.Add(' }'); FStringList.Add(''); end; FStringList.Add(' </style>'); end; procedure TTextEditorExportHTML.CreateLines; var LIndex: Integer; LTextLine, LToken: string; LHighlighterAttribute: TTextEditorHighlighterAttribute; LPreviousElement: string; begin LPreviousElement := ''; for LIndex := 0 to FLines.Count - 1 do begin if LIndex = 0 then FHighlighter.ResetRange else FHighlighter.SetRange(FLines.Items^[LIndex - 1].Range); FHighlighter.SetLine(FLines.ExpandedStrings[LIndex]); LTextLine := ''; while not FHighlighter.EndOfLine do begin LHighlighterAttribute := FHighlighter.TokenAttribute; FHighlighter.GetToken(LToken); if LToken = TEXT_EDITOR_SPACE_CHAR then LTextLine := LTextLine + '&nbsp;' else if LToken = '&' then LTextLine := LTextLine + '&amp;' else if LToken = '<' then LTextLine := LTextLine + '&lt;' else if LToken = '>' then LTextLine := LTextLine + '&gt;' else if LToken = '"' then LTextLine := LTextLine + '&quot;' else if Assigned(LHighlighterAttribute) then begin if (LPreviousElement <> '') and (LPreviousElement <> LHighlighterAttribute.Element) then LTextLine := LTextLine + '</span>'; if LPreviousElement <> LHighlighterAttribute.Element then LTextLine := LTextLine + '<span class="' + LHighlighterAttribute.Element + '">'; LTextLine := LTextLine + LToken; LPreviousElement := LHighlighterAttribute.Element; end else LTextLine := LTextLine + LToken; FHighlighter.Next; end; FStringList.Add(LTextLine + '<br>'); end; if LPreviousElement <> '' then FStringList.Add('</span>'); end; procedure TTextEditorExportHTML.CreateFooter; begin FStringList.Add('</body>'); FStringList.Add('</html>'); end; procedure TTextEditorExportHTML.SaveToStream(AStream: TStream; AEncoding: System.SysUtils.TEncoding); begin CreateHTMLDocument; if not Assigned(AEncoding) then AEncoding := TEncoding.UTF8; FStringList.SaveToStream(AStream, AEncoding); end; end.
27.580311
118
0.688146
f1f484bd7a40a6edc8601a98b65fed6ebf179c87
422
dfm
Pascal
src/UFMain.dfm
aleksusklim/StampGrid
78b527f30a041e25a89d7d32180b765a6f6cc3ca
[ "Unlicense" ]
null
null
null
src/UFMain.dfm
aleksusklim/StampGrid
78b527f30a041e25a89d7d32180b765a6f6cc3ca
[ "Unlicense" ]
null
null
null
src/UFMain.dfm
aleksusklim/StampGrid
78b527f30a041e25a89d7d32180b765a6f6cc3ca
[ "Unlicense" ]
null
null
null
object FMain: TFMain Left = 192 Top = 107 Width = 256 Height = 128 Color = clHighlight 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 a4: TImage Left = 8 Top = 8 Width = 33 Height = 33 end end
18.347826
33
0.611374
f12dee125aaf44e676ab288e6ffc8c439540bdc1
2,036
pas
Pascal
src/lnet/trunk/tests/http/httptest.pas
laggyluk/brick_engine
1fc63d8186b4eb12cbfdb3a8b48a901089d3994c
[ "MIT" ]
1
2019-05-24T19:20:12.000Z
2019-05-24T19:20:12.000Z
src/lnet/trunk/tests/http/httptest.pas
laggyluk/brick_engine
1fc63d8186b4eb12cbfdb3a8b48a901089d3994c
[ "MIT" ]
null
null
null
src/lnet/trunk/tests/http/httptest.pas
laggyluk/brick_engine
1fc63d8186b4eb12cbfdb3a8b48a901089d3994c
[ "MIT" ]
null
null
null
program httptest; {$mode objfpc}{$H+} uses SysUtils, Classes, lNet, lHTTP; const MAX_COUNT = 10000; type { TTest } TTest = class protected FHTTP: TLHTTPClient; FBuffer: string; FExpected: string; FQuit: Boolean; FCount: Integer; procedure OnEr(const msg: string; aSocket: TLSocket); procedure OnDs(aSocket: TLSocket); function OnInput(ASocket: TLHTTPClientSocket; ABuffer: pchar; ASize: integer): integer; procedure OnDoneInput(aSocket: TLHTTPClientSocket); public constructor Create; destructor Destroy; override; procedure Get; end; { TTest } procedure TTest.OnEr(const msg: string; aSocket: TLSocket); begin Writeln(msg); FQuit := True; end; procedure TTest.OnDs(aSocket: TLSocket); begin Writeln('Lost connection'); FQuit := True; end; function TTest.OnInput(ASocket: TLHTTPClientSocket; ABuffer: pchar; ASize: integer): integer; begin FBuffer := FBuffer + aBuffer; Result := aSize; end; procedure TTest.OnDoneInput(aSocket: TLHTTPClientSocket); begin if FBuffer <> FExpected then Writeln('ERROR, doesn''t match!') else Write('.'); Inc(FCount); if FCount > MAX_COUNT then begin FQuit := True; Writeln('DONE'); end else begin FBuffer := ''; FHTTP.SendRequest; end; end; constructor TTest.Create; var f: TFileStream; begin FHTTP := TLHTTPClient.Create(nil); FHTTP.OnError := @OnEr; FHTTP.OnInput := @OnInput; FHTTP.OnDisconnect := @OnDs; FHTTP.OnDoneInput := @OnDoneInput; FHTTP.Timeout := 1000; FHTTP.Host := 'members.chello.sk'; FHTTP.URI := '/ales/index.html'; f := TFileStream.Create('expected.txt', fmOpenRead); SetLength(FExpected, f.Size); f.Read(FExpected[1], f.Size); f.Free; end; destructor TTest.Destroy; begin FHTTP.Free; inherited Destroy; end; procedure TTest.Get; begin FHTTP.SendRequest; repeat FHTTP.CallAction; until FQuit or not FHTTP.Connected; end; var t: TTest; begin t := TTest.Create; t.Get; t.Free; end.
17.109244
91
0.676326
85ed6233c7d8f318530cd807295d745721621f63
35,440
pas
Pascal
HODLER_Multiplatform_Win_And_iOS_Linux/additionalUnits/AccountData.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/AccountData.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/AccountData.pas
Ecoent/HODLER-Open-Source-Multi-Asset-Wallet
a8c54ecfc569d0ee959b6f0e7826c4ee4b5c4848
[ "Unlicense" ]
34
2018-10-30T00:40:37.000Z
2022-02-15T06:00:15.000Z
unit AccountData; interface uses tokenData, WalletStructureData, cryptoCurrencyData, System.IOUtils, FMX.Graphics, System.types, FMX.types, FMX.Controls, FMX.StdCtrls, Sysutils, Classes, FMX.Dialogs, Json, Velthuis.BigIntegers, math, System.Generics.Collections, System.SyncObjs, THreadKindergartenData {$IFDEF MSWINDOWS},Windows,URLMon, FMX.Platform.Win,Winapi.ShellAPI{$ENDIF}{$IFDEF ANDROID}, FMX.VirtualKeyBoard.Android, Androidapi.JNI, Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.App, Androidapi.JNI.JavaTypes, Androidapi.Helpers, FMX.Platform.Android, Androidapi.JNI.Provider, Androidapi.JNI.Net, Androidapi.JNI.WebKit, Androidapi.JNI.Os, Androidapi.NativeActivity, Androidapi.JNIBridge, SystemApp {$ENDIF}; procedure loadCryptoCurrencyJSONData(data: TJSONValue; cc: cryptoCurrency); function getCryptoCurrencyJsonData(cc: cryptoCurrency): TJSONObject; type TBalances = record confirmed: BigInteger; unconfirmed: BigInteger; end; type Account = class name: AnsiString; myCoins: array of TWalletInfo; myTokens: array of Token; TCAIterations: Integer; EncryptedMasterSeed: AnsiString; userSaveSeed: boolean; hideEmpties: boolean; privTCA: boolean; DirPath: AnsiString; CoinFilePath: AnsiString; TokenFilePath: AnsiString; SeedFilePath: AnsiString; DescriptionFilePath: AnsiString; BigQRImagePath: AnsiString; SmallQRImagePath: AnsiString; Paths: Array of AnsiString; firstSync: boolean; SynchronizeThreadGuardian: ThreadKindergarten; DescriptionDict: TObjectDictionary<TPair<Integer, Integer>, AnsiString>; constructor Create(_name: AnsiString); destructor Destroy(); override; procedure GenerateEQRFiles(); procedure LoadFiles(); procedure SaveFiles(); procedure AddCoin(wd: TWalletInfo); procedure AddToken(T: Token); function countWalletBy(id: Integer): Integer; function getWalletWithX(X, id: Integer): TCryptoCurrencyArray; function getSibling(wi: TWalletInfo; Y: Integer): TWalletInfo; function aggregateBalances(wi: TWalletInfo): TBalances; function aggregateUTXO(wi: TWalletInfo): TUTXOS; function aggregateFiats(wi: TWalletInfo): double; function aggregateConfirmedFiats(wi: TWalletInfo): double; function aggregateUnconfirmedFiats(wi: TWalletInfo): double; function getSpendable(wi: TWalletInfo): BigInteger; function getDescription(id, X: Integer): AnsiString; procedure changeDescription(id, X: Integer; newDesc: AnsiString); function getDecryptedMasterSeed(Password: String): AnsiString; function TokenExistInETH(TokenID: Integer; ETHAddress: AnsiString): boolean; procedure wipeAccount(); procedure AsyncSynchronize(); function keepSync(): boolean; procedure lockSynchronize(); procedure unlockSynchronize(); function isOurAddress(adr: string; coinid: Integer): boolean; procedure verifyKeypool(); procedure asyncVerifyKeyPool(); procedure refreshGUI(); procedure openExplorerForRecv(Sender:TObject); private var semaphore, VerifyKeypoolSemaphore: TLightweightSemaphore; mutex: TSemaphore; synchronizeThread: TThread; mutexTokenFile, mutexCoinFile, mutexSeedFile, mutexDescriptionFile : TSemaphore; procedure Synchronize(); procedure SaveTokenFile(); procedure SaveCoinFile(); procedure SaveSeedFile(); procedure SaveDescriptionFile(); procedure LoadDescriptionFile(); procedure LoadCoinFile(); procedure LoadTokenFile(); procedure LoadSeedFile(); procedure clearArrays(); procedure AddCoinWithoutSave(wd: TWalletInfo); procedure AddTokenWithoutSave(T: Token); procedure changeDescriptionwithoutSave(id, X: Integer; newDesc: AnsiString); end; implementation uses misc, uHome, coinData, nano, languages, SyncThr, Bitcoin, walletViewRelated, CurrencyConverter{$IFDEF LINUX64},Posix.StdLib{$ENDIF}; procedure Account.openExplorerForRecv(Sender:TObject); var myURI: AnsiString; URL: WideString; {$IFDEF ANDROID} var Intent: JIntent; {$ENDIF} {$IFDEF LINUX} psxString: System.AnsiString; {$ENDIF} begin //ShowMessage('x'); myURI := TfmxObject(Sender).TagString; URL := myURI; {$IFDEF ANDROID} Intent := TJIntent.create; Intent.setAction(TJIntent.JavaClass.ACTION_VIEW); Intent.setData(StrToJURI(myURI)); SharedActivity.startActivity(Intent); {$ENDIF} {$IFDEF MSWINDOWS} ShellExecute(0, 'OPEN', PWideChar(URL), '', '', { SW_SHOWNORMAL } 1); {$ENDIF} {$IFDEF LINUX} psxString := 'xdg-open ' + myURI; _system(@psxString[1]); {$ENDIF} end; procedure Account.refreshGUI(); begin if self = currentAccount then begin //frmhome.refreshGlobalImage.Start; refreshGlobalFiat(); TThread.Synchronize(TThread.CurrentThread, procedure begin repaintWalletList; end); TThread.Synchronize(TThread.CurrentThread, procedure begin if frmhome.PageControl.ActiveTab = frmhome.walletView then begin try reloadWalletView; except on E: Exception do end; end; end); TThread.Synchronize(TThread.CurrentThread, procedure begin TLabel(frmhome.FindComponent('globalBalance')).text := floatToStrF(frmhome.CurrencyConverter.calculate(globalFiat), ffFixed, 9, 2); TLabel(frmhome.FindComponent('globalCurrency')).text := ' ' + frmhome.CurrencyConverter.symbol; hideEmptyWallets(nil); end); //frmhome.refreshGlobalImage.Stop; end; end; procedure Account.asyncVerifyKeyPool(); begin SynchronizeThreadGuardian.CreateAnonymousThread( procedure begin verifyKeypool(); end).Start(); end; procedure Account.verifyKeypool(); var i: Integer; licz: Integer; batched: string; begin exit; for i in [0, 1, 2, 3, 4, 5, 6, 7] do begin if TThread.CurrentThread.CheckTerminated then exit(); mutex.Acquire(); SynchronizeThreadGuardian.CreateAnonymousThread( procedure var id: Integer; wi: TWalletInfo; wd: TObject; url, s: string; begin id := i; mutex.Release(); VerifyKeypoolSemaphore.WaitFor(); try s := keypoolIsUsed(self, id); url := HODLER_URL + '/batchSync0.3.2.php?keypool=true&coin=' + availablecoin[id].name; if TThread.CurrentThread.CheckTerminated then exit(); parseSync(self, postDataOverHTTP(url, s, false, True), True); except on E: Exception do begin end; end; VerifyKeypoolSemaphore.Release(); end).Start(); mutex.Acquire(); mutex.Release(); end; while VerifyKeypoolSemaphore.CurrentCount <> 8 do begin if TThread.CurrentThread.CheckTerminated then exit(); sleep(50); end; SaveFiles(); end; function Account.isOurAddress(adr: string; coinid: Integer): boolean; var twi: TWalletInfo; var segwit, cash, compatible, legacy: AnsiString; pub: AnsiString; begin result := false; adr := lowercase(StringReplace(adr, 'bitcoincash:', '', [rfReplaceAll])); for twi in myCoins do begin if twi.coin <> coinid then continue; if TThread.CurrentThread.CheckTerminated then begin exit(); end; pub := twi.pub; segwit := lowercase(generatep2wpkh(pub, availablecoin[coinid].hrp)); compatible := lowercase(generatep2sh(pub, availablecoin[coinid].p2sh)); legacy := generatep2pkh(pub, availablecoin[coinid].p2pk); cash := lowercase(bitcoinCashAddressToCashAddress(legacy, false)); legacy := lowercase(legacy); cash := StringReplace(cash, 'bitcoincash:', '', [rfReplaceAll]); if ((adr) = segwit) or (adr = compatible) or (adr = legacy) or (adr = cash) then exit(True); end; end; procedure Account.lockSynchronize(); begin end; procedure Account.unlockSynchronize(); begin end; function Account.keepSync(): boolean; begin result := (synchronizeThread = nil) or (not synchronizeThread.finished); end; procedure Account.AsyncSynchronize(); begin if (synchronizeThread <> nil) and (synchronizeThread.finished) then begin synchronizeThread.Free; synchronizeThread := nil; end; if synchronizeThread = nil then begin synchronizeThread := TThread.CreateAnonymousThread(self.Synchronize); synchronizeThread.FreeOnTerminate := false; synchronizeThread.Start(); // synchronizeThread. end; end; procedure Account.Synchronize(); var i: Integer; licz: Integer; batched: string; dataTemp:AnsiString; begin if self = currentAccount then begin frmhome.refreshGlobalImage.Start; end; // do not need anymore dataTemp := getDataOverHTTP(HODLER_URL + 'states.php',false,false); //synchronizeStates(dataTemp); dataTemp := getDataOverHTTP(HODLER_URL + 'fiat.php'); synchronizeCurrencyValue(dataTemp); dataTemp := getDataOverHTTP(HODLER_URL + 'fees.php'); synchronizeDefaultFees(dataTemp); for i in [0..8] do begin // if TThread.CurrentThread.CheckTerminated then // exit(); mutex.Acquire(); SynchronizeThreadGuardian.CreateAnonymousThread( procedure var id: Integer; wi: TWalletInfo; wd: TObject; url, s: string; temp: String; begin id := i; mutex.Release(); semaphore.WaitFor(); try if id in [0,1,2,3,4,7, 8] then begin if id in [4,8] then begin for wi in myCoins do begin // if TThread.CurrentThread.CheckTerminated then // exit(); if wi.coin =id then SynchronizeCryptoCurrency(self, wi); end; end else begin syncWithENetwork(self, id); end; end else begin s := batchSync(self, id); url := HODLER_URL + '/batchSync0.3.2.php?coin=' + availablecoin[id].name; temp := postDataOverHTTP(url, s, self.firstSync, True); // if TThread.CurrentThread.CheckTerminated then // exit(); parseSync(self, temp); end; // if TThread.CurrentThread.CheckTerminated then // exit(); { TThread.CurrentThread.Synchronize(nil, procedure begin updateBalanceLabels(id); end); } except on E: Exception do begin end; end; semaphore.Release(); { TThread.CurrentThread.Synchronize(nil, procedure begin frmHome.DashBrdProgressBar.value := frmHome.RefreshProgressBar.value + 1; end); } end).Start(); mutex.Acquire(); mutex.Release(); end; for i := 0 to Length(myTokens) - 1 do begin // if TThread.CurrentThread.CheckTerminated then // exit(); mutex.Acquire(); SynchronizeThreadGuardian.CreateAnonymousThread( procedure var id: Integer; begin id := i; mutex.Release(); semaphore.WaitFor(); try // if TThread.CurrentThread.CheckTerminated then // exit(); SynchronizeCryptoCurrency(self, myTokens[id]); except on E: Exception do begin end; end; semaphore.Release(); { TThread.CurrentThread.Synchronize(nil, procedure begin frmHome.DashBrdProgressBar.value := frmHome.RefreshProgressBar.value + 1; end); } end).Start(); // if TThread.CurrentThread.CheckTerminated then // exit(); mutex.Acquire(); mutex.Release(); end; while (semaphore <> nil) and (semaphore.CurrentCount <> 8) do begin // if TThread.CurrentThread.CheckTerminated then // exit(); sleep(50); end; { tthread.Synchronize(nil , procedure begin showmessage( floatToStr( globalLoadCacheTime ) ); end); } self.firstSync := false; SaveFiles(); refreshGUI(); if self = currentAccount then begin frmhome.refreshGlobalImage.Stop; end; end; function Account.TokenExistInETH(TokenID: Integer; ETHAddress: AnsiString): boolean; var i: Integer; begin result := false; for i := 0 to Length(myTokens) - 1 do begin if myTokens[i].addr = ETHAddress then begin if myTokens[i].id = TokenID then exit(True); end; end; end; function Account.getDecryptedMasterSeed(Password: String): AnsiString; var MasterSeed, tced: AnsiString; begin tced := TCA(Password); MasterSeed := SpeckDecrypt(tced, EncryptedMasterSeed); if not isHex(MasterSeed) then begin raise Exception.Create(dictionary('FailedToDecrypt')); { TThread.Synchronize(nil, procedure begin popupWindow.Create(dictionary('FailedToDecrypt')); end); exit; } end; exit(MasterSeed); end; procedure Account.wipeAccount(); begin end; procedure Account.GenerateEQRFiles(); begin // end; function Account.getDescription(id, X: Integer): AnsiString; var middleNum: AnsiString; begin if (not DescriptionDict.tryGetValue(TPair<Integer, Integer>.Create(id, X), result)) or (result = '') then begin if (X = 0) or (X = -1) then middleNum := '' else middleNum := ''; // ' ' + intToStr(x+1); result := availablecoin[id].displayname + middleNum + ' (' + availablecoin [id].shortcut + ')'; end; end; procedure Account.changeDescription(id, X: Integer; newDesc: AnsiString); begin DescriptionDict.AddOrSetValue(TPair<Integer, Integer>.Create(id, X), newDesc); SaveDescriptionFile(); end; procedure Account.changeDescriptionwithoutSave(id, X: Integer; newDesc: AnsiString); begin DescriptionDict.AddOrSetValue(TPair<Integer, Integer>.Create(id, X), newDesc); end; procedure Account.SaveDescriptionFile(); var obj: TJSONObject; it: TObjectDictionary<TPair<Integer, Integer>, AnsiString>.TPairEnumerator; pair: TJSONString; str: TJSONString; ts: TstringList; begin mutexDescriptionFile.Acquire; obj := TJSONObject.Create(); it := DescriptionDict.GetEnumerator; while (it.MoveNext) do begin // it.Current.Key ; pair := TJSONString.Create(intToStr(it.Current.Key.Key) + '_' + intToStr(it.Current.Key.Value)); str := TJSONString.Create(it.Current.Value); obj.AddPair(TJsonPair.Create(pair, str)); end; it.Free; ts := TstringList.Create(); ts.text := obj.ToString; ts.SaveToFile(DescriptionFilePath); ts.Free(); obj.Free; mutexDescriptionFile.Release; end; procedure Account.LoadDescriptionFile(); var obj: TJSONObject; // it : TJSONPairEnumerator; //TObjectDictionary< TPair<Integer , Integer > , AnsiString>.TPairEnumerator; // PairEnumerator works on 10.2 // TEnumerator works on 10.3 it: TJSONObject.TEnumerator; // TObjectDictionary< TPair<Integer , Integer > , AnsiString>.TPairEnumerator; ts, temp: TstringList; begin mutexDescriptionFile.Acquire; if not FileExists(DescriptionFilePath) then begin mutexDescriptionFile.Release; exit(); end; ts := TstringList.Create(); ts.loadFromFile(DescriptionFilePath); if ts.text = '' then begin ts.Free(); mutexDescriptionFile.Release; exit(); end; obj := TJSONObject(TJSONObject.ParseJSONValue(ts.text)); it := obj.GetEnumerator; while (it.MoveNext) do begin temp := SplitString(it.Current.JsonString.Value, '_'); changeDescriptionwithoutSave(strToIntdef(temp[0], 0), strToIntdef(temp[1], 0), it.Current.JsonValue.Value); temp.Free(); end; it.Free; ts.Free(); obj.Free(); mutexDescriptionFile.Release; end; function Account.aggregateConfirmedFiats(wi: TWalletInfo): double; var twi: cryptoCurrency; begin if wi.X = -1 then exit(wi.getConfirmedFiat()); result := 0.0; for twi in getWalletWithX(wi.X, TWalletInfo(wi).coin) do result := result + TWalletInfo(twi).getConfirmedFiat; end; function Account.aggregateUnconfirmedFiats(wi: TWalletInfo): double; var twi: cryptoCurrency; begin if wi.X = -1 then exit(wi.getUnconfirmedFiat()); result := 0.0; for twi in getWalletWithX(wi.X, TWalletInfo(wi).coin) do begin result := result + TWalletInfo(twi).getUnconfirmedFiat; end; end; function Account.aggregateFiats(wi: TWalletInfo): double; var twi: cryptoCurrency; begin if wi.X = -1 then exit(wi.getfiat()); result := 0.0; for twi in getWalletWithX(wi.X, TWalletInfo(wi).coin) do result := result + max(0, TWalletInfo(twi).getfiat); end; function notInUTXO(arr:TUTXOS;txid:string;n:integer):boolean; var utxo:tbitcoinoutput; begin result:=true; for utxo in arr do if utxo.txid = txid then if utxo.n=n then exit(false); end; function Account.aggregateUTXO(wi: TWalletInfo): TUTXOS; var twi: cryptoCurrency; utxo: TBitcoinOutput; i: Integer; begin SetLength(result, 0); if wi.X = -1 then begin for i := 0 to Length(TWalletInfo(wi).utxo) - 1 do begin if notInUTXO(result, TWalletInfo(wi).utxo[i].txid,TWalletInfo(wi).utxo[i].n) then begin SetLength(result, Length(result) + 1); result[high(result)] := TWalletInfo(wi).utxo[i]; end; end; exit(); end; for twi in getWalletWithX(wi.X, TWalletInfo(wi).coin) do begin for i := 0 to Length(TWalletInfo(twi).utxo) - 1 do begin begin SetLength(result, Length(result) + 1); result[high(result)] := TWalletInfo(twi).utxo[i]; end; end; end; end; function Account.getSpendable(wi: TWalletInfo): BigInteger; var twi: cryptoCurrency; twis: TCryptoCurrencyArray; i: Integer; begin result := BigInteger.Zero; if wi.X = -1 then begin result := wi.confirmed; result := result + wi.unconfirmed; end; twis := getWalletWithX(wi.X, TWalletInfo(wi).coin); for i := 0 to Length(twis) - 1 do begin twi := twis[i]; if not assigned(twi) then continue; // if not TWalletInfo(twi).inPool then Continue; try result := result + twi.confirmed; result := result + twi.unconfirmed; except end; end end; function Account.aggregateBalances(wi: TWalletInfo): TBalances; var twi: cryptoCurrency; twis: TCryptoCurrencyArray; i: Integer; begin if wi.X = -1 then begin result.confirmed := wi.confirmed; result.unconfirmed := wi.unconfirmed; exit(); end; result.confirmed := BigInteger.Zero; result.unconfirmed := BigInteger.Zero; twis := getWalletWithX(wi.X, TWalletInfo(wi).coin); for i := 0 to Length(twis) - 1 do begin twi := twis[i]; if not assigned(twi) then continue; // if not TWalletInfo(twi).inPool then Continue; try result.confirmed := result.confirmed + twi.confirmed; result.unconfirmed := result.unconfirmed + twi.unconfirmed; except end; end; end; function Account.getSibling(wi: TWalletInfo; Y: Integer): TWalletInfo; var i: Integer; pub: AnsiString; p: AnsiString; begin result := nil; if (wi.X = -1) and (wi.Y = -1) then begin result := wi; exit; end; for i := 0 to Length(myCoins) - 1 do begin if (myCoins[i].coin = wi.coin) and (myCoins[i].X = wi.X) and (myCoins[i].Y = Y) then begin result := myCoins[i]; break; end; end; end; function Account.getWalletWithX(X, id: Integer): TCryptoCurrencyArray; var i: Integer; begin SetLength(result, 0); for i := 0 to Length(myCoins) - 1 do begin if (myCoins[i].coin = id) and (myCoins[i].X = X) then begin SetLength(result, Length(result) + 1); result[Length(result) - 1] := myCoins[i]; end; end; end; constructor Account.Create(_name: AnsiString); begin inherited Create; name := _name; self.firstSync := True; DirPath := TPath.Combine(HOME_PATH, name); DescriptionDict := TObjectDictionary<TPair<Integer, Integer>, AnsiString>.Create(); if not DirectoryExists(DirPath) then CreateDir(DirPath); // CoinFilePath := TPath.Combine(HOME_PATH, name); CoinFilePath := TPath.Combine(DirPath, 'hodler.coin.dat'); // TokenFilePath := TPath.Combine(HOME_PATH, name); TokenFilePath := TPath.Combine(DirPath, 'hodler.erc20.dat'); // SeedFilePath := TPath.Combine(HOME_PATH, name); SeedFilePath := TPath.Combine(DirPath, 'hodler.masterseed.dat'); DescriptionFilePath := TPath.Combine(DirPath, 'hodler.description.dat'); // System.IOUtils.TPath.GetDownloadsPath() SetLength(Paths, 4); Paths[0] := CoinFilePath; Paths[1] := TokenFilePath; Paths[2] := SeedFilePath; Paths[3] := DescriptionFilePath; SetLength(myCoins, 0); SetLength(myTokens, 0); mutexTokenFile := TSemaphore.Create(); mutexCoinFile := TSemaphore.Create(); mutexSeedFile := TSemaphore.Create(); mutexDescriptionFile := TSemaphore.Create(); semaphore := TLightweightSemaphore.Create(8); VerifyKeypoolSemaphore := TLightweightSemaphore.Create(8); mutex := TSemaphore.Create(); SynchronizeThreadGuardian := ThreadKindergarten.Create(); end; destructor Account.Destroy(); begin { if SyncBalanceThr <> nil then SyncBalanceThr.Terminate; TThread.CreateAnonymousThread( procedure begin SyncBalanceThr.DisposeOf; SyncBalanceThr := nil; end).Start(); } if (synchronizeThread <> nil) and (synchronizeThread.finished) then begin synchronizeThread.Free; synchronizeThread := nil; end else if synchronizeThread <> nil then begin synchronizeThread.Terminate; synchronizeThread.WaitFor; end; SynchronizeThreadGuardian.DisposeOf; SynchronizeThreadGuardian := nil; mutexTokenFile.Free; mutexCoinFile.Free; mutexSeedFile.Free; mutexDescriptionFile.Free; DescriptionDict.Free(); clearArrays(); semaphore.Free; VerifyKeypoolSemaphore.Free; mutex.Free; inherited; end; procedure Account.SaveSeedFile(); var ts: TstringList; flock: TObject; begin mutexSeedFile.Acquire; { flock := TObject.Create; TMonitor.Enter(flock); } ts := TstringList.Create(); try ts.Add(intToStr(TCAIterations)); ts.Add(EncryptedMasterSeed); ts.Add(booltoStr(userSaveSeed)); ts.Add(booltoStr(privTCA)); ts.Add(booltoStr(frmhome.HideZeroWalletsCheckBox.isChecked)); ts.SaveToFile(SeedFilePath); except on E: Exception do begin end; end; ts.Free; { TMonitor.exit(flock); flock.Free; } mutexSeedFile.Release; end; procedure Account.LoadSeedFile(); var ts: TstringList; flock: TObject; begin { flock:=TObject.Create; TMonitor.Enter(flock); } mutexSeedFile.Acquire; ts := TstringList.Create(); try ts.loadFromFile(SeedFilePath); TCAIterations := strToIntdef(ts.Strings[0], 0); EncryptedMasterSeed := ts.Strings[1]; userSaveSeed := strToBool(ts.Strings[2]); if ts.Count > 4 then begin privTCA := strToBoolDef(ts.Strings[3], false); hideEmpties := strToBoolDef(ts.Strings[4], false) end else begin privTCA := false; hideEmpties := false; end; except on E: Exception do begin end; end; ts.Free; mutexSeedFile.Release; { TMonitor.exit(flock); flock.Free; } end; function Account.countWalletBy(id: Integer): Integer; var ts: TstringList; i, j: Integer; wd: TWalletInfo; begin result := 0; for wd in myCoins do if wd.coin = id then result := result + 1; end; procedure Account.clearArrays(); var T: Token; wd: TWalletInfo; begin for T in myTokens do if T <> nil then T.Free; SetLength(myTokens, 0); for wd in myCoins do if wd <> nil then wd.Free; SetLength(myCoins, 0); end; procedure Account.AddCoin(wd: TWalletInfo); begin SetLength(myCoins, Length(myCoins) + 1); myCoins[Length(myCoins) - 1] := wd; changeDescription(wd.coin, wd.X, wd.description); SaveCoinFile(); end; procedure Account.AddToken(T: Token); begin SetLength(myTokens, Length(myTokens) + 1); myTokens[Length(myTokens) - 1] := T; SaveTokenFile(); end; procedure Account.AddCoinWithoutSave(wd: TWalletInfo); begin SetLength(myCoins, Length(myCoins) + 1); myCoins[Length(myCoins) - 1] := wd; end; procedure Account.AddTokenWithoutSave(T: Token); begin SetLength(myTokens, Length(myTokens) + 1); myTokens[Length(myTokens) - 1] := T; end; procedure Account.LoadFiles(); var ts: TstringList; i: Integer; T: Token; flock: TObject; begin // flock := TObject.Create; // TMonitor.Enter(flock); clearArrays(); LoadSeedFile(); LoadCoinFile(); LoadTokenFile(); LoadDescriptionFile(); {$IF (DEFINED(MSWINDOWS) OR DEFINED(LINUX))} BigQRImagePath := TPath.Combine(DirPath, hash160FromHex(EncryptedMasterSeed) + '_' + '_BIG' + '.png'); SmallQRImagePath := TPath.Combine(DirPath, hash160FromHex(EncryptedMasterSeed) + '_' + '_SMALL' + '.png'); {$ELSE} if not DirectoryExists(TPath.Combine(System.IOUtils.TPath.GetDownloadsPath(), 'hodler.tech')) then ForceDirectories(TPath.Combine(System.IOUtils.TPath.GetDownloadsPath(), 'hodler.tech')); BigQRImagePath := TPath.Combine (TPath.Combine(System.IOUtils.TPath.GetDownloadsPath(), 'hodler.tech'), name + '_' + EncryptedMasterSeed + '_' + '_ENC_QR_BIG' + '.png'); SmallQRImagePath := TPath.Combine (TPath.Combine(System.IOUtils.TPath.GetDownloadsPath(), 'hodler.tech'), name + '_' + EncryptedMasterSeed + '_' + '_ENC_QR_SMALL' + '.png'); {$ENDIF} end; procedure Account.LoadCoinFile(); var ts: TstringList; i: Integer; JsonArray: TJsonArray; coinJson: TJSONValue; dataJson: TJSONObject; ccData: TJSONObject; inPool: AnsiString; s: string; wd: TWalletInfo; procedure setupCoin(coinName: AnsiString; dataJson: TJSONObject); var wd: TWalletInfo; nn: NanoCoin; innerID, X, Y, address, description, creationTime, panelYPosition, publicKey, EncryptedPrivateKey, isCompressed: AnsiString; begin innerID := dataJson.GetValue<string>('innerID'); X := dataJson.GetValue<string>('X'); Y := dataJson.GetValue<string>('Y'); address := dataJson.GetValue<string>('address'); description := dataJson.GetValue<string>('description'); creationTime := dataJson.GetValue<string>('creationTime'); panelYPosition := dataJson.GetValue<string>('panelYPosition'); publicKey := dataJson.GetValue<string>('publicKey'); EncryptedPrivateKey := dataJson.GetValue<string>('EncryptedPrivateKey'); isCompressed := dataJson.GetValue<string>('isCompressed'); // confirmed := dataJson.GetValue<string>('confirmed'); if coinName = 'Nano' then begin nn := NanoCoin.Create(strToIntdef(innerID, 0), strToIntdef(X, 0), strToIntdef(Y, 0), string(address), string(description), strToIntdef(creationTime, 0)); wd := TWalletInfo(nn); end else wd := TWalletInfo.Create(strToIntdef(innerID, 0), strToIntdef(X, 0), strToIntdef(Y, 0), address, description, strToIntdef(creationTime, 0)); wd.inPool := strToBoolDef(inPool, false); wd.pub := publicKey; wd.orderInWallet := strToIntdef(panelYPosition, 0); wd.EncryptedPrivKey := EncryptedPrivateKey; wd.isCompressed := strToBool(isCompressed); wd.wid := Length(myCoins); // coinJson.TryGetValue<TJsonObject>('CryptoCurrencyData', ccData); if coinJson.tryGetValue<TJSONObject>('CryptoCurrencyData', ccData) then loadCryptoCurrencyJSONData(ccData, wd); AddCoinWithoutSave(wd); end; var flock: TObject; coinName: AnsiString; begin mutexCoinFile.Acquire; { flock := TObject.Create; TMonitor.Enter(flock); } if not FileExists(CoinFilePath) then begin mutexCoinFile.Release; exit; end; ts := TstringList.Create(); ts.loadFromFile(CoinFilePath); if ts.text[low(ts.text)] = '[' then begin s := ts.text; JsonArray := TJsonArray(TJSONObject.ParseJSONValue(s)); for coinJson in JsonArray do begin coinName := coinJson.GetValue<String>('name'); dataJson := coinJson.GetValue<TJSONObject>('data'); inPool := '0'; try inPool := dataJson.GetValue<string>('inPool') except on E: Exception do begin end; // Do nothing - preKeypool .dat end; setupCoin(coinName, dataJson); end; JsonArray.Free; end else begin i := 0; while i < ts.Count - 1 do begin wd := TWalletInfo.Create(strToIntdef(ts.Strings[i], 0), strToIntdef(ts.Strings[i + 1], 0), strToIntdef(ts.Strings[i + 2], 0), ts.Strings[i + 3], ts.Strings[i + 4], strToIntdef(ts[i + 5], 0)); wd.orderInWallet := strToIntdef(ts[i + 6], 0); wd.pub := ts[i + 7]; wd.EncryptedPrivKey := ts[i + 8]; wd.isCompressed := strToBool(ts[i + 9]); wd.wid := Length(myCoins); AddCoinWithoutSave(wd); i := i + 10; end; end; // ts := TStringLIst.Create(); // ts.LoadFromFile(CoinFilePath); ts.Free; mutexCoinFile.Release; { TMonitor.exit(flock); flock.Free; } end; procedure Account.LoadTokenFile(); var ts: TstringList; i: Integer; T: Token; JsonArray: TJsonArray; tokenJson: TJSONValue; tempJson: TJSONValue; flock: TObject; begin { flock := TObject.Create; TMonitor.Enter(flock); } mutexTokenFile.Acquire; if FileExists(TokenFilePath) then begin ts := TstringList.Create(); ts.loadFromFile(TokenFilePath); if ts.text[low(ts.text)] = '[' then begin JsonArray := TJsonArray(TJSONObject.ParseJSONValue(ts.text)); for tokenJson in JsonArray do begin tokenJson.tryGetValue<TJSONValue>('TokenData', tempJson); T := Token.fromJson(tempJson); if tokenJson.tryGetValue<TJSONValue>('CryptoCurrencyData', tempJson) then begin loadCryptoCurrencyJSONData(tempJson, T); end; if (T.id < 10000) or (Token.availableToken[T.id - 10000].address <> '') then // if token.address = '' token is no longer exist AddTokenWithoutSave(T); { tokenJson.AddPair('name' , myTokens[i].name ); tokenJson.AddPair('TokenData' , myTokens[i].toJson ); TokenJson.AddPair('CryptoCurrencyData' , getCryptoCurrencyJsonData( myTokens[i] ) ); } end; JsonArray.Free; end else begin i := 0; while i < ts.Count do begin // create token from single line T := Token.fromString(ts[i]); inc(i); T.idInWallet := Length(myTokens) + 10000; // histSize := strtoInt(ts[i]); inc(i); AddTokenWithoutSave(T); // add new token to array myTokens end; end; ts.Free; end; mutexTokenFile.Release; { TMonitor.exit(flock); flock.Free; } end; procedure Account.SaveFiles(); var ts: TstringList; i: Integer; fileData: AnsiString; flock: TObject; begin // flock := TObject.Create; // TMonitor.Enter(flock); SaveSeedFile(); SaveCoinFile(); SaveTokenFile(); SaveDescriptionFile(); // TMonitor.exit(flock); // flock.Free; end; procedure Account.SaveTokenFile(); var ts: TstringList; i: Integer; fileData: AnsiString; TokenArray: TJsonArray; tokenJson: TJSONObject; flock: TObject; begin mutexTokenFile.Acquire; ts := TstringList.Create(); try TokenArray := TJsonArray.Create(); for i := 0 to Length(myTokens) - 1 do begin if myTokens[i].deleted = false then begin tokenJson := TJSONObject.Create(); tokenJson.AddPair('name', myTokens[i].name); tokenJson.AddPair('TokenData', myTokens[i].toJson); tokenJson.AddPair('CryptoCurrencyData', getCryptoCurrencyJsonData(myTokens[i])); TokenArray.Add(tokenJson); end; end; ts.text := TokenArray.ToString; ts.SaveToFile(TokenFilePath); TokenArray.Free; except on E: Exception do begin end; end; ts.Free; mutexTokenFile.Release; end; procedure Account.SaveCoinFile(); var i: Integer; ts: TstringList; data: TWalletInfo; JsonArray: TJsonArray; coinJson: TJSONObject; dataJson: TJSONObject; flock: TObject; begin { flock := TObject.Create; TMonitor.Enter(flock); } mutexCoinFile.Acquire(); try JsonArray := TJsonArray.Create(); for data in myCoins do begin if data.deleted then continue; dataJson := TJSONObject.Create(); dataJson.AddPair('innerID', intToStr(data.coin)); dataJson.AddPair('X', intToStr(data.X)); dataJson.AddPair('Y', intToStr(data.Y)); dataJson.AddPair('address', data.addr); dataJson.AddPair('description', data.description); dataJson.AddPair('creationTime', intToStr(data.creationTime)); dataJson.AddPair('panelYPosition', intToStr(data.orderInWallet)); dataJson.AddPair('publicKey', data.pub); dataJson.AddPair('EncryptedPrivateKey', data.EncryptedPrivKey); dataJson.AddPair('isCompressed', booltoStr(data.isCompressed)); dataJson.AddPair('inPool', booltoStr(data.inPool)); coinJson := TJSONObject.Create(); coinJson.AddPair('name', data.name); coinJson.AddPair('data', dataJson); coinJson.AddPair('CryptoCurrencyData', getCryptoCurrencyJsonData(data)); JsonArray.AddElement(coinJson); end; ts := TstringList.Create(); try ts.text := JsonArray.ToString; ts.SaveToFile(CoinFilePath); except on E: Exception do begin // end; end; ts.Free; JsonArray.Free; except on E: Exception do begin end; end; mutexCoinFile.Release; { TMonitor.exit(flock); flock.Free; } end; procedure loadCryptoCurrencyJSONData(data: TJSONValue; cc: cryptoCurrency); var JsonObject: TJSONObject; dataJson: TJSONObject; JsonHistArray: TJsonArray; HistArrayIt: TJSONValue; confirmed, unconfirmed, rate: string; i: Integer; begin if data.tryGetValue<string>('confirmed', confirmed) then begin BigInteger.TryParse(confirmed, 10, cc.confirmed); end; if data.tryGetValue<string>('unconfirmed', unconfirmed) then begin BigInteger.TryParse(unconfirmed, 10, cc.unconfirmed); end; if data.tryGetValue<string>('USDPrice', rate) then begin cc.rate := StrToFloatDef(rate, 0); end; { if data.TryGetValue<TJsonArray>('history', JsonHistArray) then begin SetLength(cc.history, JsonHistArray.Count); i := 0; for HistArrayIt in JsonHistArray do begin cc.history[i].fromJsonValue(HistArrayIt); inc(i); end; end; } end; function getCryptoCurrencyJsonData(cc: cryptoCurrency): TJSONObject; var JsonObject: TJSONObject; dataJson: TJSONObject; JsonHistArray: TJsonArray; i: Integer; begin dataJson := TJSONObject.Create(); dataJson.AddPair('confirmed', cc.confirmed.ToString); dataJson.AddPair('unconfirmed', cc.unconfirmed.ToString); dataJson.AddPair('USDPrice', floattoStr(cc.rate)); JsonHistArray := TJsonArray.Create(); for i := 0 to Length(cc.history) - 1 do begin JsonHistArray.Add(TJSONObject(cc.history[i].toJsonValue())); end; dataJson.AddPair('history', JsonHistArray); result := dataJson; end; end.
22.122347
108
0.664306
851fe79ef2e9bca82c412cec0a211736074fdf48
435
pas
Pascal
Diverses/Source/iupcc/unt_iupcc_bsp.pas
joecare99/Public
9eee060fbdd32bab33cf65044602976ac83f4b83
[ "MIT" ]
11
2017-06-17T05:13:45.000Z
2021-07-11T13:18:48.000Z
Diverses/Source/iupcc/unt_iupcc_bsp.pas
joecare99/Public
9eee060fbdd32bab33cf65044602976ac83f4b83
[ "MIT" ]
2
2019-03-05T12:52:40.000Z
2021-12-03T12:34:26.000Z
Diverses/Source/iupcc/unt_iupcc_bsp.pas
joecare99/Public
9eee060fbdd32bab33cf65044602976ac83f4b83
[ "MIT" ]
6
2017-09-07T09:10:09.000Z
2022-02-19T20:19:58.000Z
unit unt_iupcc_bsp; {$mode objfpc}{$H+} interface uses Classes, SysUtils; const CntCnt = 10; CntData: array[1..CntCnt - 1] of single = (1,2,3,4,5,6,7,8.9,10); Test = 'ABCDE' {Werte von für SQR((A * A}+{B * B)) mit #23 bei 'A', 'B' bei #4 ( und zusätzlich }'F´ bei ´H' ; implementation function hash(Value:integer):integer; begin result := abs(Value) mod 23; end; end.
15
115
0.556322
f18fc8d775feaa4b8f4b3368701110fc23d6e7e9
8,838
pas
Pascal
source/base/DelphiLens.pas
gabr42/DelphiLens
f8e49178095151b903869281f7b24b27e394b690
[ "BSD-3-Clause" ]
7
2017-09-05T10:52:47.000Z
2021-06-25T07:26:12.000Z
source/base/DelphiLens.pas
gabr42/DelphiLens
f8e49178095151b903869281f7b24b27e394b690
[ "BSD-3-Clause" ]
21
2017-11-16T08:16:56.000Z
2018-09-02T06:54:49.000Z
source/base/DelphiLens.pas
gabr42/DelphiLens
f8e49178095151b903869281f7b24b27e394b690
[ "BSD-3-Clause" ]
5
2017-11-02T15:57:36.000Z
2021-06-25T07:26:13.000Z
unit DelphiLens; interface uses DelphiLens.Intf; function CreateDelphiLens(const projectFile: string): IDelphiLens; implementation uses System.SysUtils, System.Classes, DelphiAST.Consts, DelphiAST.Classes, DelphiAST.Serialize.Binary, DelphiAST.ProjectIndexer, DelphiLens.Cache.Intf, DelphiLens.Cache, DelphiLens.UnitInfo.Serializer.Intf, DelphiLens.UnitInfo.Serializer, DelphiLens.UnitInfo, DelphiLens.TreeAnalyzer.Intf, DelphiLens.TreeAnalyzer, DelphiLens.Analyzers.Intf, DelphiLens.Analyzers; type TDLScanResult = class(TInterfacedObject, IDLScanResult) strict private [weak] FAnalysis : TAnalyzedUnits; FAnalyzers: IDLAnalyzers; FCache : IDLCache; [weak] FIndexer : TProjectIndexer; strict protected function GetAnalysis: TAnalyzedUnits; function GetAnalyzers: IDLAnalyzers; function GetCacheStatistics: TCacheStatistics; function GetIncludeFiles: TIncludeFiles; function GetNotFoundUnits: TStringList; function GetParsedUnits: TParsedUnits; function GetProblems: TProblems; public constructor Create(AAnalysis: TAnalyzedUnits; ACache: IDLCache; AIndexer: TProjectIndexer); procedure ReleaseAnalyzers; property Analyzers: IDLAnalyzers read GetAnalyzers; property Analysis: TAnalyzedUnits read GetAnalysis; property CacheStatistics: TCacheStatistics read GetCacheStatistics; property ParsedUnits: TParsedUnits read GetParsedUnits; property IncludeFiles: TIncludeFiles read GetIncludeFiles; property Problems: TProblems read GetProblems; property NotFoundUnits: TStringList read GetNotFoundUnits; end; { TDLScanResult } TDelphiLens = class(TInterfacedObject, IDelphiLens) strict private const CCacheDataVersion = 1; CCacheExt = '.dlens'; var FAnalysis : TAnalyzedUnits; FCache : IDLCache; FConditionalDefines: string; FIndexer : TProjectIndexer; FInterestingTypes : set of TSyntaxNodeType; FProject : string; FSearchPath : string; FTreeAnalyzer : IDLTreeAnalyzer; strict protected procedure AnalyzeTree(tree: TSyntaxNode; var unitInfo: IDLUnitInfo); procedure FilterSyntax(node: TSyntaxNode); function GetConditionalDefines: string; function GetProject: string; function GetSearchPath: string; procedure SetConditionalDefines(const value: string); procedure SetSearchPath(const value: string); function SyntaxTreeDeserializer(data: TStream; var tree: TSyntaxNode): boolean; procedure SyntaxTreeSerializer(tree: TSyntaxNode; data: TStream); public constructor Create(const AProject: string); destructor Destroy; override; function Rescan: IDLScanResult; property ConditionalDefines: string read GetConditionalDefines write SetConditionalDefines; property Project: string read GetProject; property SearchPath: string read GetSearchPath write SetSearchPath; end; { TDelphiLens } { exports } function CreateDelphiLens(const projectFile: string): IDelphiLens; begin Result := TDelphiLens.Create(projectFile); end; { CreateDelphiLens } { TDelphiLens } constructor TDelphiLens.Create(const AProject: string); begin inherited Create; // Minimum set of types needed for ProjectIndexer to walk the 'uses' chain //FInterestingTypes := [ntFinalization, ntImplementation, ntInitialization, // ntInterface, ntUnit, ntUses]; // For now, store everything. // Maybe sometimes later I'll want to filter this information and store it in a different - faster format. FInterestingTypes := []; FProject := AProject; FIndexer := TProjectIndexer.Create; FCache := CreateDLCache(ChangeFileExt(FProject, CCacheExt), CCacheDataVersion); FCache.BindTo(FIndexer); FCache.DeserializeSyntaxTree := SyntaxTreeDeserializer; FCache.SerializeSyntaxTree := SyntaxTreeSerializer; FConditionalDefines := FCache.DataVersioning; FAnalysis := TAnalyzedUnits.Create; FTreeAnalyzer := CreateDLTreeAnalyzer; end; { TDelphiLens.Create } destructor TDelphiLens.Destroy; begin FreeAndNil(FAnalysis); FreeAndNil(FIndexer); inherited; end; { TDelphiLens.Destroy } procedure TDelphiLens.AnalyzeTree(tree: TSyntaxNode; var unitInfo: IDLUnitInfo); begin FTreeAnalyzer.AnalyzeTree(tree, unitInfo); end; { TDelphiLens.AnalyzeTree } procedure TDelphiLens.FilterSyntax(node: TSyntaxNode); var iChild: integer; begin for iChild := High(node.ChildNodes) downto Low(node.ChildNodes) do if (FInterestingTypes = []) or (node.ChildNodes[iChild].Typ in FInterestingTypes) then FilterSyntax(node.ChildNodes[iChild]) else node.DeleteChild(node.ChildNodes[iChild]); end; { TDelphiLens.FilterSyntax } function TDelphiLens.GetConditionalDefines: string; begin Result := FConditionalDefines; end; { TDelphiLens.GetConditionalDefines } function TDelphiLens.GetProject: string; begin Result := FProject; end; { TDelphiLens.GetProject } function TDelphiLens.GetSearchPath: string; begin Result := FSearchPath; end; { TDelphiLens.GetSearchPath } function TDelphiLens.Rescan: IDLScanResult; begin FCache.DataVersioning := ConditionalDefines; FCache.ClearStatistics; FIndexer.SearchPath := SearchPath; FIndexer.Defines := ConditionalDefines; FAnalysis.Clear; //TODO: Don't reindex problematic units if they didn't change FIndexer.Index(Project); Result := TDLScanResult.Create(FAnalysis, FCache, FIndexer); end; { TDelphiLens.Rescan } procedure TDelphiLens.SetConditionalDefines(const value: string); begin FConditionalDefines := value; end; { TDelphiLens.SetConditionalDefines } procedure TDelphiLens.SetSearchPath(const value: string); begin FSearchPath := value; end; { TDelphiLens.SetSearchPath } function TDelphiLens.SyntaxTreeDeserializer(data: TStream; var tree: TSyntaxNode): boolean; var len : integer; mem : TMemoryStream; reader : TBinarySerializer; unitInfo : IDLUnitInfo; unitReader: IDLUnitInfoSerializer; begin Result := true; mem := TMemoryStream.Create; try Assert(SizeOf(integer) = 4); if data.Read(len, 4) <> 4 then Exit(false); mem.CopyFrom(data, len); mem.Position := 0; reader := TBinarySerializer.Create; try if not reader.Read(mem, tree) then Exit(false); finally FreeAndNil(reader); end; // Successful deserialization, therefore SyntaxTreeSerializer won't be called and // we have to store analysis in the cache. unitReader := CreateSerializer; data.Position := len + 4; if not unitReader.Read(data, unitInfo) then Exit(false); FAnalysis.Add(unitInfo); finally FreeAndNil(mem); end; end; { TDelphiLens.SyntaxTreeDeserializer } procedure TDelphiLens.SyntaxTreeSerializer(tree: TSyntaxNode; data: TStream); var len : integer; mem : TMemoryStream; unitInfo : IDLUnitInfo; unitWriter: IDLUnitInfoSerializer; writer : TBinarySerializer; begin AnalyzeTree(tree, unitInfo); FilterSyntax(tree); FAnalysis.Add(unitInfo); mem := TMemoryStream.Create; try writer := TBinarySerializer.Create; try writer.Write(mem, tree); finally FreeAndNil(writer); end; len := mem.Size; Assert(SizeOf(integer) = 4); data.Write(len, 4); data.CopyFrom(mem, 0); mem.Size := 0; unitWriter := CreateSerializer; unitWriter.Write(unitInfo, mem); data.CopyFrom(mem, 0); finally FreeAndNil(mem); end; end; { TDelphiLens.SyntaxTreeSerializer } { TDLScanResult } constructor TDLScanResult.Create(AAnalysis: TAnalyzedUnits; ACache: IDLCache; AIndexer: TProjectIndexer); begin inherited Create; FAnalysis := AAnalysis; FCache := ACache; FIndexer := AIndexer; end; { TDLScanResult.Create } function TDLScanResult.GetAnalysis: TAnalyzedUnits; begin Result := FAnalysis; end; { TDLScanResult.GetAnalysis } function TDLScanResult.GetAnalyzers: IDLAnalyzers; begin if not assigned(FAnalyzers) then FAnalyzers := CreateDLAnalyzers(Self); Result := FAnalyzers; end; { TDLScanResult.GetAnalyzers } function TDLScanResult.GetCacheStatistics: TCacheStatistics; begin Result := FCache.Statistics; end; { TDLScanResult.GetCacheStatistics } function TDLScanResult.GetIncludeFiles: TIncludeFiles; begin Result := FIndexer.IncludeFiles; end; { TDLScanResult.GetIncludeFiles } function TDLScanResult.GetNotFoundUnits: TStringList; begin Result := FIndexer.NotFoundUnits; end; { TDLScanResult.GetNotFoundUnits } function TDLScanResult.GetParsedUnits: TParsedUnits; begin Result := FIndexer.ParsedUnits; end; { TDLScanResult.GetParsedUnits } function TDLScanResult.GetProblems: TProblems; begin Result := FIndexer.Problems; end; { TDLScanResult.GetProblems } procedure TDLScanResult.ReleaseAnalyzers; begin FAnalyzers := nil; end; { TDLScanResult.ReleaseAnalyzers } end.
30.475862
108
0.752093
856ed0e568378982aeff8bb8bbf8df188bae2a17
19,155
dfm
Pascal
MAF_Editors/frmHookManager_Editor.dfm
HelgeLange/MAF
405f34c132fa5c391ee2c3a056bacc0de0aa721f
[ "Apache-2.0" ]
4
2018-06-20T08:41:00.000Z
2018-11-01T19:47:41.000Z
MAF_Editors/frmHookManager_Editor.dfm
AdriaanBoshoff/MAF
405f34c132fa5c391ee2c3a056bacc0de0aa721f
[ "Apache-2.0" ]
null
null
null
MAF_Editors/frmHookManager_Editor.dfm
AdriaanBoshoff/MAF
405f34c132fa5c391ee2c3a056bacc0de0aa721f
[ "Apache-2.0" ]
2
2018-06-20T13:46:12.000Z
2019-08-26T00:29:03.000Z
object fDFTEdit: TfDFTEdit Left = 202 Top = 81 Caption = 'DFT Editor' ClientHeight = 545 ClientWidth = 787 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' Font.Style = [] OldCreateOrder = False Position = poScreenCenter OnClose = FormClose OnCreate = FormCreate OnDestroy = FormDestroy OnShow = FormShow PixelsPerInch = 96 TextHeight = 13 object PageControl1: TPageControl Left = 0 Top = 0 Width = 787 Height = 545 ActivePage = tsLibraries Align = alClient TabOrder = 0 object tsLibraries: TTabSheet Caption = 'Libraries' ImageIndex = 2 object Label4: TLabel Left = 12 Top = 8 Width = 69 Height = 13 Caption = 'Module path : ' end object Label6: TLabel Left = 87 Top = 8 Width = 3 Height = 13 end object lvModules: TListView Left = 12 Top = 27 Width = 273 Height = 358 Columns = < item Caption = 'Module Name' Width = 250 end> ReadOnly = True RowSelect = True TabOrder = 0 ViewStyle = vsReport OnSelectItem = lvModulesSelectItem end object GroupBox1: TGroupBox Left = 291 Top = 21 Width = 254 Height = 247 Caption = ' Module information ' TabOrder = 1 object Label1: TLabel Left = 16 Top = 24 Width = 54 Height = 13 Caption = 'ID :' end object lblID: TLabel Left = 72 Top = 24 Width = 167 Height = 13 Alignment = taRightJustify AutoSize = False end object lblVersion: TLabel Left = 72 Top = 43 Width = 167 Height = 13 Alignment = taRightJustify AutoSize = False end object Label3: TLabel Left = 16 Top = 43 Width = 54 Height = 13 Caption = 'Version :' end object lblCopyright: TLabel Left = 72 Top = 62 Width = 167 Height = 13 Alignment = taRightJustify AutoSize = False end object Label5: TLabel Left = 16 Top = 62 Width = 54 Height = 13 Caption = 'Copyright :' end object lblBuildDate: TLabel Left = 72 Top = 81 Width = 167 Height = 13 Alignment = taRightJustify AutoSize = False end object Label7: TLabel Left = 16 Top = 81 Width = 54 Height = 13 Caption = 'Build date :' end object lblAuthor: TLabel Left = 72 Top = 100 Width = 167 Height = 13 Alignment = taRightJustify AutoSize = False end object Label9: TLabel Left = 16 Top = 100 Width = 55 Height = 13 Caption = 'Author :' end object Label2: TLabel Left = 16 Top = 129 Width = 60 Height = 13 Caption = 'Description :' end object mDescription: TMemo Left = 16 Top = 148 Width = 225 Height = 89 Enabled = False ReadOnly = True TabOrder = 0 end end object btnAddModule: TButton Left = 291 Top = 329 Width = 98 Height = 25 Caption = 'Add' TabOrder = 2 OnClick = btnAddModuleClick end object btnDelete: TButton Left = 291 Top = 360 Width = 98 Height = 25 Caption = 'Delete' TabOrder = 3 OnClick = btnDeleteClick end object GroupBox2: TGroupBox Left = 551 Top = 21 Width = 222 Height = 324 Caption = ' XML Import / Export ' TabOrder = 4 object Panel1: TPanel Left = -29 Top = -9 Width = 280 Height = 218 BevelInner = bvLowered TabOrder = 0 object btnXML_Import: TButton Left = 40 Top = 159 Width = 201 Height = 25 Caption = 'Import from XML' TabOrder = 0 OnClick = btnXML_ImportClick end object cbClearCurrentData: TCheckBox Left = 40 Top = 32 Width = 161 Height = 17 Hint = 'All data about modules, function and descriptions will be delete' + 'd prior importing the XML' Caption = 'Clear Current Data' ParentShowHint = False ShowHint = True TabOrder = 1 OnClick = cbClearCurrentDataClick end object cbImportDescriptions: TCheckBox Left = 40 Top = 55 Width = 169 Height = 17 Caption = 'Import Descriptions' Checked = True State = cbChecked TabOrder = 2 end object cbUpdateExistingData: TCheckBox Left = 40 Top = 78 Width = 177 Height = 17 Caption = 'Update Existing Data' TabOrder = 3 end end object Panel2: TPanel Left = -13 Top = 203 Width = 246 Height = 126 BevelInner = bvLowered TabOrder = 1 object btnXML_Export: TButton Left = 24 Top = 76 Width = 201 Height = 25 Caption = 'Export to XML' TabOrder = 0 OnClick = btnXML_ExportClick end object cbExportDescriptions: TCheckBox Left = 24 Top = 21 Width = 193 Height = 17 Caption = 'Export Descriptions' TabOrder = 1 end end end object Button2: TButton Left = 562 Top = 360 Width = 201 Height = 25 Caption = 'Clear Garbage' TabOrder = 5 OnClick = Button2Click end end object tsEdit: TTabSheet Caption = 'Editor' OnShow = tsEditShow object Panel3: TPanel Left = 0 Top = 0 Width = 779 Height = 517 Align = alClient BevelOuter = bvNone TabOrder = 0 object Splitter1: TSplitter Left = 0 Top = 253 Width = 779 Height = 3 Cursor = crVSplit Align = alBottom ExplicitLeft = 3 ExplicitTop = 305 end object Panel5: TPanel Left = 0 Top = 256 Width = 779 Height = 261 Align = alBottom BevelOuter = bvNone TabOrder = 0 object Panel9: TPanel Left = 663 Top = 0 Width = 116 Height = 261 Align = alRight BevelOuter = bvNone TabOrder = 0 object btnUp: TBitBtn Left = 13 Top = 24 Width = 42 Height = 25 Caption = 'Up' TabOrder = 0 OnClick = btnUpDownClick end object btnDown: TBitBtn Left = 13 Top = 55 Width = 41 Height = 25 Caption = 'Down' TabOrder = 1 OnClick = btnUpDownClick end object Panel14: TPanel Left = 0 Top = 108 Width = 116 Height = 153 Align = alBottom BevelOuter = bvNone TabOrder = 2 object btnNewSubHook: TButton Left = 15 Top = 44 Width = 90 Height = 25 Caption = 'New SubHook' TabOrder = 0 OnClick = btnEditSubHookClick end object btnEditSubHook: TButton Left = 15 Top = 81 Width = 90 Height = 25 Caption = 'Edit SubHook' Enabled = False TabOrder = 1 OnClick = btnEditSubHookClick end object btnDeleteSubHook: TButton Left = 15 Top = 112 Width = 90 Height = 25 Caption = 'Delete SubHook' TabOrder = 2 OnClick = btnDeleteSubHookClick end end end object Panel4: TPanel Left = 0 Top = 0 Width = 663 Height = 261 Align = alClient TabOrder = 1 object lvSubHooks: TListView Left = 1 Top = 21 Width = 661 Height = 239 Align = alClient Checkboxes = True Columns = < item Caption = 'UniqueID' Width = 70 end item Caption = 'SubHookID' Width = 70 end item Caption = 'Module' Width = 120 end item Caption = 'Description' Width = 260 end item Caption = 'CodeGroup' Width = 100 end> HideSelection = False ReadOnly = True RowSelect = True PopupMenu = PopupMenu1 TabOrder = 0 ViewStyle = vsReport OnClick = lvSubHooksClick end object Panel11: TPanel Left = 1 Top = 1 Width = 661 Height = 20 Align = alTop TabOrder = 1 object Panel12: TPanel Left = 1 Top = 1 Width = 312 Height = 18 Align = alLeft BevelOuter = bvNone TabOrder = 0 object Label11: TLabel Left = 0 Top = 0 Width = 312 Height = 18 Align = alClient Caption = 'SubHooks' ExplicitWidth = 47 ExplicitHeight = 13 end end object Panel13: TPanel Left = 313 Top = 1 Width = 347 Height = 18 Align = alClient BevelOuter = bvNone TabOrder = 1 object bFilterSubHooks: TCheckBox Left = 0 Top = 0 Width = 347 Height = 18 Align = alClient Alignment = taLeftJustify Caption = 'Apply module filter for SubHooks' TabOrder = 0 end end end end end object Panel6: TPanel Left = 0 Top = 0 Width = 779 Height = 253 Align = alClient BevelOuter = bvNone TabOrder = 1 object Label10: TLabel AlignWithMargins = True Left = 3 Top = 40 Width = 773 Height = 13 Align = alTop Caption = 'Dynamic functions (Hooks) :' ExplicitWidth = 134 end object lvHooks: TListView Left = 0 Top = 56 Width = 663 Height = 197 Align = alClient Columns = < item Caption = 'HookID' Width = 70 end item Caption = 'SubHooks' Width = 70 end item Caption = 'Description' Width = 480 end> HideSelection = False ReadOnly = True RowSelect = True TabOrder = 0 ViewStyle = vsReport OnClick = lvHooksClick OnSelectItem = lvHooksSelectItem end object Panel7: TPanel Left = 0 Top = 0 Width = 779 Height = 37 Align = alTop BevelOuter = bvNone TabOrder = 1 object Label8: TLabel Left = 12 Top = 13 Width = 66 Height = 13 Caption = 'Module filter :' end object cbModules: TComboBox Left = 304 Top = 9 Width = 357 Height = 21 Style = csDropDownList TabOrder = 0 end end object Panel8: TPanel Left = 663 Top = 56 Width = 116 Height = 197 Align = alRight BevelOuter = bvNone TabOrder = 2 object Panel10: TPanel Left = 0 Top = 156 Width = 116 Height = 41 Align = alBottom BevelOuter = bvNone TabOrder = 0 object btnEditHook: TButton Left = 13 Top = 4 Width = 90 Height = 25 Caption = 'Edit Hook' Enabled = False TabOrder = 0 OnClick = btnEditHookClick end end end end end end object tsCodeGroups: TTabSheet Caption = 'Code Groups' ImageIndex = 2 object pCodeGroups: TPanel Left = 3 Top = 17 Width = 758 Height = 192 BevelInner = bvLowered BevelOuter = bvSpace TabOrder = 0 object Label12: TLabel Left = 9 Top = 9 Width = 62 Height = 13 Caption = 'Code Groups' end object lvCodeGroups: TListView Left = 9 Top = 28 Width = 616 Height = 150 Columns = < item Caption = 'ID' end item Caption = 'Name' Width = 120 end item Caption = 'Description' Width = 260 end item Caption = 'SecurityLevel' Width = 80 end item Caption = 'Member' end> ReadOnly = True RowSelect = True TabOrder = 0 ViewStyle = vsReport OnSelectItem = lvCodeGroupsSelectItem end object btnCG_Delete: TButton Left = 639 Top = 154 Width = 106 Height = 25 Caption = 'Delete' Enabled = False TabOrder = 1 OnClick = btnCG_DeleteClick end object btnCG_Edit: TButton Left = 639 Top = 123 Width = 106 Height = 25 Caption = 'Edit' Enabled = False TabOrder = 2 OnClick = btnCG_EditClick end object btnCG_Add: TButton Left = 639 Top = 92 Width = 106 Height = 25 Caption = 'Add' TabOrder = 3 OnClick = btnCG_AddClick end end object pHooks: TPanel Left = 3 Top = 215 Width = 758 Height = 249 BevelInner = bvLowered TabOrder = 1 object Label13: TLabel Left = 9 Top = 13 Width = 105 Height = 13 Caption = 'Unassigned SubHooks' end object Label14: TLabel Left = 376 Top = 13 Width = 93 Height = 13 Caption = 'Assigned SubHooks' end object lvUnassignedSubHooks: TListView Left = 9 Top = 32 Width = 296 Height = 209 Columns = < item Caption = 'HookID' Width = 60 end item Caption = 'SubHookID' Width = 70 end item Caption = 'Module' Width = 100 end> ReadOnly = True RowSelect = True ParentShowHint = False ShowHint = True TabOrder = 0 ViewStyle = vsReport OnInfoTip = lvUnassignedSubHooksInfoTip OnSelectItem = lvUnassignedSubHooksSelectItem end object lvAssignedSubHooks: TListView Left = 432 Top = 32 Width = 313 Height = 209 Columns = < item Caption = 'HookID' Width = 60 end item Caption = 'SubHookID' Width = 70 end item Caption = 'Module' Width = 100 end> ReadOnly = True RowSelect = True TabOrder = 1 ViewStyle = vsReport OnSelectItem = lvAssignedSubHooksSelectItem end object btnCG_HookAdd: TButton Left = 323 Top = 49 Width = 92 Height = 25 Caption = 'Add -->' Enabled = False TabOrder = 2 OnClick = btnCG_HookAddClick end object btnCG_HookRemove: TButton Left = 323 Top = 208 Width = 92 Height = 25 Caption = '<-- Remove' Enabled = False TabOrder = 3 OnClick = btnCG_HookRemoveClick end end end end object OpenDialog: TOpenDialog DefaultExt = '*.dll' Title = 'Select a module...' Left = 504 Top = 8 end object XML: TXMLDocument FileName = 'D:\Delphi\TCA\TCA_DFT.xml' Left = 544 Top = 8 DOMVendorDesc = 'MSXML' end object SD: TSaveDialog DefaultExt = '*.xml' Filter = 'XML files|*.xml|All files|*.*' Title = 'Save DFT as XML...' Left = 464 Top = 8 end object PopupMenu1: TPopupMenu OnPopup = PopupMenu1Popup Left = 168 Top = 354 object mForce_uID_Change: TMenuItem Caption = 'Force uID Change' OnClick = mForce_uID_ChangeClick end end end
25.337302
82
0.428139
834baffa7e80510278975cd9ea85bbe120e5acd4
4,340
pas
Pascal
uReportsFrame.pas
bravesoftdz/Windows-10-Point-of-Sale
55f24d7d1bcae0d75a1a3b7d8b26f9d766c4e571
[ "MIT" ]
6
2021-06-21T08:18:12.000Z
2021-11-09T11:52:21.000Z
uReportsFrame.pas
Embarcadero/Windows-10-Point-of-Sale
55f24d7d1bcae0d75a1a3b7d8b26f9d766c4e571
[ "MIT" ]
null
null
null
uReportsFrame.pas
Embarcadero/Windows-10-Point-of-Sale
55f24d7d1bcae0d75a1a3b7d8b26f9d766c4e571
[ "MIT" ]
2
2021-10-01T11:42:38.000Z
2022-02-17T22:31:38.000Z
unit uReportsFrame; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.Grids, Vcl.Buttons, Vcl.StdCtrls, Vcl.WinXCtrls, Vcl.VirtualImage, Vcl.ExtCtrls, Data.Bind.Components, Data.Bind.DBScope, Data.Bind.Controls, Data.Bind.EngExt, Vcl.Bind.DBEngExt, Vcl.Bind.Grid, System.Rtti, System.Bindings.Outputs, Vcl.Bind.Editors, Data.Bind.Grid, Vcl.Bind.Navigator, Vcl.WinXPickers; type TReportsFrame = class(TFrame) ReportCSSMemo: TMemo; Panel8: TPanel; Label25: TLabel; VirtualImage7: TVirtualImage; UsersRelativePanel: TRelativePanel; SearchBox: TSearchBox; DeleteButton: TSpeedButton; ReportsSG: TStringGrid; ReportsBindSourceDB: TBindSourceDB; ViewButton: TSpeedButton; BindNavigator5: TBindNavigator; BindingsList1: TBindingsList; LinkGridToDataSourceReportsBindSourceDB: TLinkGridToDataSource; FlowPanel1: TFlowPanel; Panel1: TPanel; Label1: TLabel; FromDatePicker: TDatePicker; Panel2: TPanel; Label2: TLabel; ToDatePicker: TDatePicker; ProductPanel: TPanel; Label3: TLabel; ProductCB: TComboBox; CategoryPanel: TPanel; Label4: TLabel; CategoryCB: TComboBox; GroupPanel: TPanel; Label5: TLabel; GroupCB: TComboBox; ProductsBindSourceDB: TBindSourceDB; CategoryBindSourceDB: TBindSourceDB; GroupBindSourceDB: TBindSourceDB; LinkFillControlToField1: TLinkFillControlToField; LinkFillControlToField2: TLinkFillControlToField; LinkFillControlToField3: TLinkFillControlToField; CreateButton: TSpeedButton; TypeCB: TComboBox; Panel6: TPanel; Label6: TLabel; procedure SearchBoxInvokeSearch(Sender: TObject); procedure ViewButtonClick(Sender: TObject); procedure CreateButtonClick(Sender: TObject); procedure UsersRelativePanelResize(Sender: TObject); procedure DeleteButtonClick(Sender: TObject); procedure TypeCBChange(Sender: TObject); private { Private declarations } public { Public declarations } procedure Initialize; end; implementation {$R *.dfm} uses uDM, uReportForm; procedure TReportsFrame.DeleteButtonClick(Sender: TObject); begin if ReportsBindSourceDB.DataSet.RecordCount>0 then ReportsBindSourceDB.DataSet.Delete; end; procedure TReportsFrame.Initialize; begin ReportsBindSourceDB.DataSet := DM.ReportsFDTable; ProductsBindSourceDB.DataSet := DM.ProductsFDTable; CategoryBindSourceDB.DataSet := DM.CategoryFDTable; GroupBindSourceDB.DataSet := DM.GroupFDTable; FromDatePicker.Date := Date-7; ToDatePicker.Date := Date+1; end; procedure TReportsFrame.CreateButtonClick(Sender: TObject); begin DM.CreateReport(TypeCB.Items[TypeCB.ItemIndex], FromDatePicker.Date, ToDatePicker.Date, ProductCB.Text, CategoryCB.Text, GroupCB.Text, ReportCSSMemo.Lines.Text); ViewButtonClick(Sender); end; procedure TReportsFrame.SearchBoxInvokeSearch(Sender: TObject); begin ReportsBindSourceDB.DataSet.Filtered := False; ReportsBindSourceDB.DataSet.Filter := 'UserId LIKE '''+SearchBox.Text+'%'''; ReportsBindSourceDB.DataSet.Filtered := True; end; procedure TReportsFrame.TypeCBChange(Sender: TObject); begin case TypeCB.ItemIndex of 0: begin ProductPanel.Visible := True; CategoryPanel.Visible := True; GroupPanel.Visible := True; end; 1: begin ProductPanel.Visible := False; CategoryPanel.Visible := False; GroupPanel.Visible := False; end; end; end; procedure TReportsFrame.UsersRelativePanelResize(Sender: TObject); begin if UsersRelativePanel.Width<=400 then begin ViewButton.Caption := ''; ViewButton.Width := 40; DeleteButton.Caption := ''; DeleteButton.Width := 40; end else begin ViewButton.Caption := ViewButton.Hint; ViewButton.Width := 121; DeleteButton.Caption := DeleteButton.Hint; DeleteButton.Width := 121; end; end; procedure TReportsFrame.ViewButtonClick(Sender: TObject); begin if ReportsBindSourceDB.DataSet.Active then begin if ReportsBindSourceDB.DataSet.RecordCount>0 then begin ReportForm.LoadReport(ReportsBindSourceDB.DataSet.FieldByName('ReportData').AsWideString); ReportForm.ShowModal; end; end; end; end.
28.741722
163
0.744009
f1b050a43e67e12a9938cf243ed5ea3f7f0a2102
7,363
dfm
Pascal
Components/jcl/examples/common/filesearch/QFileSearchDemoMain.dfm
sabatex/Delphi
0efbe6eb38bf8aa2bf269d1866741266e90b9cbf
[ "MIT" ]
null
null
null
Components/jcl/examples/common/filesearch/QFileSearchDemoMain.dfm
sabatex/Delphi
0efbe6eb38bf8aa2bf269d1866741266e90b9cbf
[ "MIT" ]
null
null
null
Components/jcl/examples/common/filesearch/QFileSearchDemoMain.dfm
sabatex/Delphi
0efbe6eb38bf8aa2bf269d1866741266e90b9cbf
[ "MIT" ]
1
2019-12-24T08:39:18.000Z
2019-12-24T08:39:18.000Z
object FileSearchForm: TFileSearchForm Left = 258 Top = 301 Width = 787 Height = 508 HorzScrollBar.Range = 378 VertScrollBar.Range = 252 ActiveControl = StartBtn AutoScroll = False Caption = 'File Search Demo (TJclFileEnumerator)' Color = clBtnFace Constraints.MinHeight = 279 Constraints.MinWidth = 647 Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = 12 Font.Name = 'MS Sans Serif' Font.Pitch = fpVariable Font.Style = [] OldCreateOrder = True Position = poDefaultPosOnly Scaled = False OnCreate = FormCreate OnDestroy = FormDestroy PixelsPerInch = 96 TextHeight = 13 object StatusBar: TStatusBar Left = 0 Top = 460 Width = 779 Height = 21 Panels = < item Alignment = taRightJustify Width = 100 end item Alignment = taRightJustify Width = 100 end item Width = 50 end> end object FileList: TListView Left = 0 Top = 181 Width = 779 Height = 279 Align = alClient Columns = < item Caption = 'File' Width = 360 end item Alignment = taRightJustify AutoSize = True Caption = 'Size' end item Alignment = taCenter AutoSize = True Caption = 'Time' end item Caption = 'Attr.' Width = 60 end> ReadOnly = True TabOrder = 1 ViewStyle = vsReport OnColumnClick = FileListColumnClick end object Panel1: TPanel Left = 0 Top = 0 Width = 779 Height = 49 Align = alTop BevelOuter = bvNone TabOrder = 2 object Label1: TLabel Left = 14 Top = 14 Width = 16 Height = 13 Caption = 'List' end object Label2: TLabel Left = 216 Top = 14 Width = 29 Height = 13 Caption = 'files in' end object RootDirInput: TEdit Left = 256 Top = 10 Width = 248 Height = 21 TabOrder = 1 end object StartBtn: TButton Left = 524 Top = 10 Width = 61 Height = 25 Caption = 'Start' TabOrder = 2 OnClick = StartBtnClick end object StopBtn: TButton Left = 596 Top = 10 Width = 61 Height = 25 Caption = 'Stop' Enabled = False TabOrder = 3 OnClick = StopBtnClick end object DetailsBtn: TButton Left = 668 Top = 10 Width = 77 Height = 25 Caption = 'More >>' TabOrder = 4 OnClick = DetailsBtnClick end object FileMaskInput: TEdit Left = 40 Top = 10 Width = 169 Height = 21 TabOrder = 0 Text = '*' end end object DetailsPanel: TPanel Left = 0 Top = 49 Width = 779 Height = 132 Align = alTop BevelOuter = bvNone TabOrder = 3 Visible = False object GroupBox1: TGroupBox Left = 256 Top = 0 Width = 249 Height = 121 Caption = 'File attributes' TabOrder = 0 object cbReadOnly: TCheckBox Tag = 1 Left = 16 Top = 16 Width = 89 Height = 21 AllowGrayed = True Caption = 'Read only' State = cbGrayed TabOrder = 0 OnClick = cbFileAttributeClick end object cbHidden: TCheckBox Tag = 2 Left = 16 Top = 40 Width = 89 Height = 21 AllowGrayed = True Caption = 'Hidden' TabOrder = 1 OnClick = cbFileAttributeClick end object cbSystem: TCheckBox Tag = 4 Left = 16 Top = 64 Width = 89 Height = 21 AllowGrayed = True Caption = 'System' TabOrder = 2 OnClick = cbFileAttributeClick end object cbDirectory: TCheckBox Tag = 16 Left = 16 Top = 88 Width = 89 Height = 21 AllowGrayed = True Caption = 'Directory' TabOrder = 3 OnClick = cbFileAttributeClick end object cbSymLink: TCheckBox Tag = 64 Left = 136 Top = 16 Width = 101 Height = 21 AllowGrayed = True Caption = 'Symbolic link' State = cbGrayed TabOrder = 4 OnClick = cbFileAttributeClick end object cbNormal: TCheckBox Tag = 128 Left = 136 Top = 88 Width = 89 Height = 21 AllowGrayed = True Caption = 'Normal' State = cbGrayed TabOrder = 7 OnClick = cbFileAttributeClick end object cbArchive: TCheckBox Tag = 32 Left = 136 Top = 16 Width = 89 Height = 21 AllowGrayed = True Caption = 'Archive' State = cbGrayed TabOrder = 5 OnClick = cbFileAttributeClick end object cbVolumeID: TCheckBox Tag = 8 Left = 136 Top = 40 Width = 89 Height = 21 AllowGrayed = True Caption = 'Volume ID' TabOrder = 6 OnClick = cbFileAttributeClick end end object cbLastChangeAfter: TCheckBox Left = 524 Top = 12 Width = 131 Height = 30 Caption = 'Last change after' TabOrder = 1 end object edLastChangeAfter: TEdit Left = 656 Top = 16 Width = 113 Height = 21 MaxLength = 10 TabOrder = 2 end object cbLastChangeBefore: TCheckBox Left = 524 Top = 36 Width = 131 Height = 30 Caption = 'Last change before' TabOrder = 3 end object edLastChangeBefore: TEdit Left = 656 Top = 40 Width = 113 Height = 21 MaxLength = 10 TabOrder = 4 end object cbFileSizeMax: TCheckBox Left = 524 Top = 60 Width = 131 Height = 30 Caption = 'Maximum size' TabOrder = 5 end object edFileSizeMax: TEdit Left = 656 Top = 64 Width = 113 Height = 21 TabOrder = 6 Text = '$7FFFFFFFFFFFFFFF' end object cbFileSizeMin: TCheckBox Left = 524 Top = 84 Width = 131 Height = 30 Caption = 'Minimum size' TabOrder = 7 end object edFileSizeMin: TEdit Left = 656 Top = 88 Width = 113 Height = 21 TabOrder = 8 Text = '0' end object IncludeSubDirectories: TCheckBox Left = 40 Top = 18 Width = 157 Height = 17 Caption = 'Include sub directories' Checked = True State = cbChecked TabOrder = 9 OnClick = UpdateIncludeHiddenSubDirs end object IncludeHiddenSubDirs: TCheckBox Left = 40 Top = 42 Width = 201 Height = 17 Caption = 'Include hidden sub directories' TabOrder = 10 OnClick = IncludeHiddenSubDirsClick end object cbDisplayLiveUpdate: TCheckBox Left = 40 Top = 90 Width = 189 Height = 17 Caption = '&Display live update' Checked = True State = cbChecked TabOrder = 12 end object cbCaseInsensitiveSearch: TCheckBox Left = 40 Top = 66 Width = 177 Height = 17 Caption = 'Case insensitive search' TabOrder = 11 end end end
20.799435
51
0.538368
f1be782a3583643793b65e28ec1d007cce3762ee
7,148
pas
Pascal
Tests/Test Cases/SysUtils.DateTime.pas
atkins126/DelphiRTL
f0ea29598025346577870cc9a27338592c4dac1b
[ "BSD-2-Clause" ]
1
2019-05-13T04:44:29.000Z
2019-05-13T04:44:29.000Z
Tests/Test Cases/SysUtils.DateTime.pas
anomous/DelphiRTL
0bd427025b479a1356da846b7788e3ba3bc9a3c8
[ "BSD-2-Clause" ]
null
null
null
Tests/Test Cases/SysUtils.DateTime.pas
anomous/DelphiRTL
0bd427025b479a1356da846b7788e3ba3bc9a3c8
[ "BSD-2-Clause" ]
null
null
null
namespace DelphiRTL.Tests.Shared.Test_Cases; uses RemObjects.Elements.EUnit, RemObjects.Elements.RTL.Delphi; type SysUtilsDateTimeUsage = public class(Test) public method IsLeapYearTests; begin Assert.IsTrue(IsLeapYear(2016)); Assert.IsFalse(IsLeapYear(2015)); Assert.IsFalse(IsLeapYear(1700)); Assert.IsTrue(IsLeapYear(2004)); end; method DateTimeToTimeStampTests; begin var lDate := EncodeDateTime(2017, 1, 1, 18, 31, 30, 100); var lTemp: TTimeStamp := DateTimeToTimeStamp(lDate); Assert.AreEqual(lTemp.Time, 66690100); Assert.AreEqual(lTemp.Date, 736330); end; method TimeStampToDateTimeTests; begin var lTemp: TTimeStamp; lTemp.Time := 66690100; lTemp.Date := 736330; var lDate := TimeStampToDateTime(lTemp); var lYear, lMonth, lDay, lHour, lMin, lSec, lMSec: Word; DecodeDateTime(lDate, out lYear, out lMonth, out lDay, out lHour, out lMin, out lSec, out lMSec); Assert.AreEqual(lYear, 2017); Assert.AreEqual(lMonth, 1); Assert.AreEqual(lDay, 1); Assert.AreEqual(lHour, 18); Assert.AreEqual(lMin, 31); Assert.AreEqual(lSec, 30); Assert.AreEqual(lMSec, 100); end; method MSecsToTimeStampTests; begin // This is EncodeDateTime(2017, 1, 1, 18, 31, 30, 100); var lTemp := MSecsToTimeStamp(63618978690100); Assert.AreEqual(lTemp.Time, 66690100); Assert.AreEqual(lTemp.Date, 736330); end; method TimeStampToMSecsTests; begin var lDate := EncodeDateTime(2017, 1, 1, 18, 31, 30, 100); var lTemp: TTimeStamp := DateTimeToTimeStamp(lDate); var lMSecs := TimeStampToMSecs(lTemp); Assert.AreEqual(lMSecs, 63618978690100); end; method EncodeDateTests; begin var lDate := EncodeDate(2017, 1, 1); var lYear, lMonth, lDay: Word; DecodeDate(lDate, var lYear, var lMonth, var lDay); Assert.AreEqual(lYear, 2017); Assert.AreEqual(lMonth, 1); Assert.AreEqual(lDay, 1); lDate := EncodeDate(2000, 12, 31); DecodeDate(lDate, var lYear, var lMonth, var lDay); Assert.AreEqual(lYear, 2000); Assert.AreEqual(lMonth, 12); Assert.AreEqual(lDay, 31); end; method EncodeTimeTests; begin var lTime := EncodeTime(17, 40, 20, 100); var lHour, lMin, lSec, lMSec: Word; DecodeTime(lTime, var lHour, var lMin, var lSec, var lMSec); Assert.AreEqual(lHour, 17); Assert.AreEqual(lMin, 40); Assert.AreEqual(lSec, 20); Assert.AreEqual(lMSec, 100); lTime := EncodeTime(0, 0, 1, 100); DecodeTime(lTime, var lHour, var lMin, var lSec, var lMSec); Assert.AreEqual(lHour, 0); Assert.AreEqual(lMin, 0); Assert.AreEqual(lSec, 1); Assert.AreEqual(lMSec, 100); lTime := EncodeTime(12, 00, 00, 1); DecodeTime(lTime, var lHour, var lMin, var lSec, var lMSec); Assert.AreEqual(lHour, 12); Assert.AreEqual(lMin, 0); Assert.AreEqual(lSec, 0); Assert.AreEqual(lMSec, 1); end; method DecodeDateTests; begin var lDate := EncodeDate(2000, 1, 1); var lYear, lMonth, lDay: Word; DecodeDate(lDate, var lYear, var lMonth, var lDay); Assert.AreEqual(lYear, 2000); Assert.AreEqual(lMonth, 1); Assert.AreEqual(lDay, 1); end; method DecodeDateFullyTests; begin var lYear, lMonth, lDay, lDOW: Word; var lDate := EncodeDateTime(2017, 1, 17, 17, 27, 23, 199); DecodeDateFully(lDate, var lYear, var lMonth, var lDay, var lDOW); Assert.AreEqual(lYear, 2017); Assert.AreEqual(lMonth, 1); Assert.AreEqual(lDay, 17); Assert.AreEqual(lDOW, 3); end; method DecodeTimeTests; begin var lTime := EncodeTime(0, 0, 0, 1); var lHour, lMin, lSec, lMSec: Word; DecodeTime(lTime, var lHour, var lMin, var lSec, var lMSec); Assert.AreEqual(lHour, 0); Assert.AreEqual(lMin, 0); Assert.AreEqual(lSec, 0); Assert.AreEqual(lMSec, 1); lTime := EncodeTime(23, 59, 59, 999); DecodeTime(lTime, var lHour, var lMin, var lSec, var lMSec); Assert.AreEqual(lHour, 23); Assert.AreEqual(lMin, 59); Assert.AreEqual(lSec, 59); Assert.AreEqual(lMSec, 999); end; method DayOfWeekTests; begin var lDate := EncodeDate(2017, 1, 1); Assert.AreEqual(1, DayOfWeek(lDate)); lDate := EncodeDate(2017, 1, 19); Assert.AreEqual(5, DayOfWeek(lDate)); lDate := EncodeDate(2019, 3, 1); Assert.AreEqual(6, DayOfWeek(lDate)); end; method DateTests; begin var lDate := Date; var lYear := YearOf(lDate); Assert.AreEqual(lYear, CurrentYear); end; method TimeTests; begin var lTime := Time; var lHour := HourOf(lTime); var lHour2 := HourOf(Now); Assert.AreEqual(lHour, lHour2); end; method NowTests; begin Assert.AreEqual(YearOf(Now), CurrentYear); end; method CurrentYearTests; begin Assert.AreEqual(CurrentYear, YearOf(Date)); end; method IncMonthTests; begin var lDate := EncodeDate(2017, 1, 19); var lNewDate := IncMonth(lDate); Assert.AreEqual(MonthOf(lNewDate), 2); lNewDate := IncMonth(lDate, 2); Assert.AreEqual(MonthOf(lNewDate), 3); end; method IncAMonthTests; begin var lYear, lMonth, lDay: Word; lYear := 2017; lMonth := 1; lDay := 1; IncAMonth(var lYear, var lMonth, var lDay); Assert.AreEqual(lMonth, 2); IncAMonth(var lYear, var lMonth, var lDay, 3); Assert.AreEqual(lMonth, 5); IncAMonth(var lYear, var lMonth, var lDay, 8); Assert.AreEqual(lYear, 2018); Assert.AreEqual(lMonth, 1); end; method ReplaceTimeTests; begin var lDate := EncodeDateTime(2017, 1, 19, 20, 50, 30, 120); var lNewTime := EncodeTime(10, 2, 3, 4); ReplaceTime(var lDate, lNewTime); var lHour, lMin, lSec, lMSec: Word; DecodeTime(lDate, var lHour, var lMin, var lSec, var lMSec); Assert.AreEqual(lHour, 10); Assert.AreEqual(lMin, 2); Assert.AreEqual(lSec, 3); Assert.AreEqual(lMSec, 4); end; method ReplaceDateTests; begin var lDate := EncodeDateTime(2017, 1, 19, 20, 50, 30, 120); var lNewDate := EncodeDate(2018, 10, 10); var lYear, lMonth, lDay: Word; ReplaceDate(var lDate, lNewDate); DecodeDate(lDate, var lYear, var lMonth, var lDay); Assert.AreEqual(lYear, 2018); Assert.AreEqual(lMonth, 10); Assert.AreEqual(lDay, 10); end; method DateTimeToStringTests; begin var lDate := EncodeDateTime(2017, 1, 19, 20, 50, 30, 120); var lString: DelphiString; DateTimeToString(var lString, 'dd/mm/yyyy', lDate, FormatSettings); Assert.AreEqual(lString, '19/01/2017'); DateTimeToString(var lString, 'hh:mm:ss', lDate); Assert.AreEqual(lString, '20:50:30'); DateTimeToString(var lString, 'hh:nn:ss', lDate); Assert.AreEqual(lString, '20:50:30'); end; end; end.
29.415638
103
0.62563
83825da130a9b817f23681f5d816f8d3aa100be8
1,026
pas
Pascal
Forms/UfrmPadrao.pas
DanielS1802/ControleEstoque
4b8044844a295683da3f66cc1fdd63acf7245968
[ "MIT" ]
null
null
null
Forms/UfrmPadrao.pas
DanielS1802/ControleEstoque
4b8044844a295683da3f66cc1fdd63acf7245968
[ "MIT" ]
null
null
null
Forms/UfrmPadrao.pas
DanielS1802/ControleEstoque
4b8044844a295683da3f66cc1fdd63acf7245968
[ "MIT" ]
null
null
null
unit UfrmPadrao; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cxGraphics, cxLookAndFeels, cxLookAndFeelPainters, Vcl.Menus, dxSkinsCore, dxSkinsDefaultPainters, Vcl.StdCtrls, cxButtons, Vcl.ExtCtrls; type TfrmPadrao = class(TForm) Panel1: TPanel; btnGravar: TcxButton; btnCancelar: TcxButton; procedure btnCancelarClick(Sender: TObject); procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); private { Private declarations } public { Public declarations } end; var frmPadrao: TfrmPadrao; implementation {$R *.dfm} procedure TfrmPadrao.btnCancelarClick(Sender: TObject); begin if MessageBox(Handle, 'Deseja realmente cancelar?', 'Cancelar', MB_ICONQUESTION + MB_YESNO) = mrNO then Abort; end; procedure TfrmPadrao.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = VK_ESCAPE then btnCancelar.Click; end; end.
23.318182
98
0.751462