Skip to content

Commit

Permalink
use same coding style on all files
Browse files Browse the repository at this point in the history
  • Loading branch information
NishiOwO committed Feb 23, 2025
1 parent d2a06eb commit 64aac08
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 57 deletions.
52 changes: 26 additions & 26 deletions src/HighballConfig.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,42 @@
interface
type
THighballConfig = record
ServerPort : Integer;
ServerURL : String;
ServerName : String;
ServerDescription : String;
UserAllowRegister : Boolean;
DatabasePath : String;
DatabaseHostname : String;
DatabaseUsername : String;
DatabasePassword : String;
DatabaseDatabase : String;
ServerPort: Integer;
ServerURL: String;
ServerName: String;
ServerDescription: String;
UserAllowRegister: Boolean;
DatabasePath: String;
DatabaseHostname: String;
DatabaseUsername: String;
DatabasePassword: String;
DatabaseDatabase: String;
end;

var
HighballParsedConfig : THighballConfig = (
ServerPort : -1;
ServerURL : '';
ServerName : '';
ServerDescription : '';
UserAllowRegister : False;
DatabasePath : '';
DatabaseHostname : '';
DatabaseUsername : '';
DatabasePassword : '';
DatabaseDatabase : '';
HighballParsedConfig: THighballConfig = (
ServerPort: -1;
ServerURL: '';
ServerName: '';
ServerDescription: '';
UserAllowRegister: False;
DatabasePath: '';
DatabaseHostname: '';
DatabaseUsername: '';
DatabasePassword: '';
DatabaseDatabase: '';
);

function HighballParseConfig(ConfPath : String) : Integer;
function HighballCheckConfig() : Integer;
function HighballParseConfig(ConfPath: String): Integer;
function HighballCheckConfig(): Integer;

implementation
uses
IniFiles;

function HighballParseConfig(ConfPath : String) : Integer;
function HighballParseConfig(ConfPath: String): Integer;
var
INI : TINIFile;
INI: TINIFile;
begin
HighballParseConfig := 0;
INI := TINIFile.Create(ConfPath);
Expand All @@ -60,7 +60,7 @@ function HighballParseConfig(ConfPath : String) : Integer;
INI.Free();
end;

function HighballCheckConfig() : Integer;
function HighballCheckConfig(): Integer;
begin
HighballCheckConfig := -1;
if HighballParsedConfig.ServerPort = -1 then
Expand Down
2 changes: 1 addition & 1 deletion src/HighballDatabase.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ implementation

procedure HighballDatabaseInit();
var
DB : THighballDB;
DB: THighballDB;
begin
DB := THighballDB.Create();
DB.ExecuteDirect('CREATE TABLE IF NOT EXISTS users(username text, password text, created_at bigint, updated_at bigint, admin boolean)');
Expand Down
4 changes: 2 additions & 2 deletions src/HighballServer.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
unit HighballServer;

interface
function HighballServerStart() : Integer;
function HighballServerStart(): Integer;

implementation
uses
Expand All @@ -14,7 +14,7 @@ implementation
HBWellKnown,
HBNodeinfo;

function HighballServerStart() : Integer;
function HighballServerStart(): Integer;
begin
HighballServerStart := 0;

Expand Down
12 changes: 6 additions & 6 deletions src/HighballUtils.pp
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
unit HighballUtils;

interface
function HighballIsArg(Argument : String; ExpShort : String; ExpLong : String) : Boolean;
function HighballHasArgPrefix(Argument : String) : Boolean;
function HighballJSONEmpty(JSON : String) : Boolean;
function HighballIsArg(Argument: String; ExpShort: String; ExpLong: String): Boolean;
function HighballHasArgPrefix(Argument: String): Boolean;
function HighballJSONEmpty(JSON: String): Boolean;

implementation
uses
Sysutils;

function HighballIsArg(Argument: String; ExpShort: String; ExpLong: String) : Boolean;
function HighballIsArg(Argument: String; ExpShort: String; ExpLong: String): Boolean;
begin
HighballIsArg := (('-' + ExpShort) = Argument) or (('--' + ExpLong) = Argument);
end;

function HighballHasArgPrefix(Argument: String) : Boolean;
function HighballHasArgPrefix(Argument: String): Boolean;
begin
HighballHasArgPrefix := False;
if Length(Argument) > 0 then begin
Expand All @@ -24,7 +24,7 @@ function HighballHasArgPrefix(Argument: String) : Boolean;
end;
end;

function HighballJSONEmpty(JSON : String) : Boolean;
function HighballJSONEmpty(JSON: String) : Boolean;
begin
HighballJSONEmpty := Length(Trim(JSON)) = 2;
end;
Expand Down
12 changes: 6 additions & 6 deletions src/HighballVersion.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@
interface
type
THighballVersion = record
Major : Integer;
Minor : Integer;
Patch : Integer;
Major: Integer;
Minor: Integer;
Patch: Integer;
end;

const
HighballVersionRaw : THighballVersion = (
HighballVersionRaw: THighballVersion = (
(* DO NOT REMOVE COMMENTS!! - THEY ARE USED INTERNALLY *)
Major : 0; (* MAJOR *)
Minor : 0; (* MINOR *)
Patch : 0; (* PATCH *)
);

function HighballGetVersion() : String;
function HighballGetVersion(): String;

implementation
uses
Sysutils;

function HighballGetVersion() : String;
function HighballGetVersion(): String;
begin
HighballGetVersion := IntToStr(HighballVersionRaw.Major) + '.'
+ IntToStr(HighballVersionRaw.Minor) + '.'
Expand Down
8 changes: 4 additions & 4 deletions src/class/HBDatabase.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ interface
{$endif}
THighballDB = class
protected
Connection : THighballDBConnection;
Transaction : TSQLTransaction;
Connection: THighballDBConnection;
Transaction: TSQLTransaction;

public
constructor Create();
destructor Destroy(); override;
procedure ExecuteDirect(Query : String);
procedure ExecuteDirect(Query: String);
end;
THighballDBPointer = ^THighballDB;

Expand Down Expand Up @@ -59,7 +59,7 @@ destructor THighballDB.Destroy();
inherited;
end;

procedure THighballDB.ExecuteDirect(Query : String);
procedure THighballDB.ExecuteDirect(Query: String);
begin
Connection.ExecuteDirect(Query);
Transaction.Commit();
Expand Down
8 changes: 4 additions & 4 deletions src/class/HBRoute.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ interface
type
TRouteBase = class
protected
RouteReq : TRequest;
RouteRes : TResponse;
RouteJSON : TJSONObject;
DefaultProcess : Boolean;
RouteReq: TRequest;
RouteRes: TResponse;
RouteJSON: TJSONObject;
DefaultProcess: Boolean;

procedure Before();
procedure Job(); virtual; abstract;
Expand Down
6 changes: 3 additions & 3 deletions src/highball.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
HighballDatabase,
HighballPathnames;

function ParseArgs() : Integer;
function ParseArgs(): Integer;
var
ArgI : Integer;
ArgI: Integer;
begin
ParseArgs := -1;
for ArgI := 1 to ParamCount do
Expand All @@ -35,7 +35,7 @@ function ParseArgs() : Integer;
end;

var
ResultFunc : Integer;
ResultFunc: Integer;
begin
WriteLn('Highball - ActivityPub server in Pascal, version ' + HighballGetVersion());
WriteLn('Copyright (c) 2025 Nishi & Contributors');
Expand Down
2 changes: 1 addition & 1 deletion src/route/HBDefault.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ TRouteDefault = class(TRouteBase)
end;

var
RouteDefault : TRouteDefault;
RouteDefault: TRouteDefault;

implementation
uses
Expand Down
4 changes: 2 additions & 2 deletions src/route/HBNodeinfo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ TRouteNodeinfo = class(TRouteBase)
end;

var
RouteNodeinfo : TRouteNodeinfo;
RouteNodeinfo: TRouteNodeinfo;

implementation
uses
Expand All @@ -21,7 +21,7 @@ implementation

procedure TRouteNodeinfo.Job();
var
EPName : String;
EPName: String;
begin
EPName := RouteReq.RouteParams['name'];
if (EPName = '2.0') or (EPName = '2.1') then
Expand Down
4 changes: 2 additions & 2 deletions src/route/HBWellKnown.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ TRouteWellKnown = class(TRouteBase)
end;

var
RouteWellKnown : TRouteWellKnown;
RouteWellKnown: TRouteWellKnown;

implementation
uses
Expand All @@ -20,7 +20,7 @@ implementation

procedure TRouteWellKnown.Job();
var
EPName : String;
EPName: String;
begin
EPName := RouteReq.RouteParams['name'];
if EPName = 'nodeinfo' then
Expand Down

0 comments on commit 64aac08

Please sign in to comment.