program Test;
uses
Crt;
type
TColor = record
foreground, background: integer;
end;
// Create a new color from 3 color components
function clARGB(a, r, g, b: integer) : integer;
var
generator: android_graphics_Color;
begin
clARGB := generator.argb(a, r, g, b);
end;
// Create a new color from 3 color components
function clRGB(r, g, b: integer) : integer;
begin
clRGB := clARGB(0, r, g, b);
end;
// Create a pair of colors
function clNew(foreground, background: integer) : TColor;
var
color: TColor;
begin
color.foreground := foreground;
color.background := background;
clNew := color;
end;
// Set text and its background color based on the color pair
procedure clSet(cl: TColor);
begin
textColor(cl.foreground);
textBackground(cl.background);
end;
// Write a colored text
procedure clWrite(cl: TColor;
value: string);
begin
clSet(cl);
Write(value);
end;
var
cl: TColor;
begin
cl := clNew(clRGB(255, 0, 0), clRGB(255, 255, 0));
clWrite(cl, 'I love u, Lana');
end.
Formatted code:
program Test;
uses
Crt;
type
TColor = record
foreground, background: integer;
end;
// Create a new color from 3 color components
function clARGB(a, r, g, b: integer) : integer;
var
generator: android_graphics_Color;
begin
clARGB := generator.argb(a, r, g, b);
end;
// Create a new color from 3 color components
function clRGB(r, g, b: integer) : integer;
begin
clRGB := clARGB(0, r, g, b);
end;
// Create a pair of colors
function clNew(foreground, background: integer) : TColor;
var
color: TColor;
begin
color.foreground := foreground;
color.background := background;
clNew := color;
end;
// Set text and its background color based on the color pair
procedure clSet(cl: TColor);
begin
textColor(cl.foreground);
textBackground(cl.background);
end;
// Write a colored text
procedure clWrite(cl: TColor;
value: string);
begin
clSet(cl);
Write(value);
end;
var
cl: TColor;
begin
cl := clNew(clRGB(255, 0, 0), clRGB(255, 255, 0));
clWrite(cl, 'I love u, Lana');
end.
Issues found:
functions are joined, empty lines between them are removed
function comments became separated from functions by one empty line
empty one line is added before function's begin even there is no var section before begin
Initial code:
Formatted code:
Issues found:
begin
even there is novar
section beforebegin