Skip to content

Commit

Permalink
Added some pascal stuff
Browse files Browse the repository at this point in the history
Not sure if I actually like pascal more tha c++
  • Loading branch information
Mark Carter committed Feb 28, 2018
1 parent 38932f2 commit bcd80fd
Show file tree
Hide file tree
Showing 4 changed files with 189 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lab/pascal/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# freepascal local files
*.lps

backup
lib
42 changes: 42 additions & 0 deletions lab/pascal/cells.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
unit cells;


{$mode objfpc}{$H+}

interface



uses
Classes, SysUtils
//, contnrs
, fgl;

type
TCells = specialize TFPGMap<integer, string>;

procedure test_cells();

implementation

var cell_id: Integer;
var the_cells :TCells;

procedure test_cells();
//var h : TFPDataHashTable;
//var test: string;
begin
WriteLn('cells:test_cells()');

// the_cells.add(cell_id, 'hello');
the_cells[cell_id] := 'hello';
end;

initialization
begin
cell_id := 1;
the_cells.create;
end;

end.

64 changes: 64 additions & 0 deletions lab/pascal/neoleo.lpi
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="10"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasScaledStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="Neoleo"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<VersionInfo>
<StringTable ProductVersion=""/>
</VersionInfo>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
<RunParams>
<local>
<FormatVersion Value="1"/>
</local>
</RunParams>
<Units Count="2">
<Unit0>
<Filename Value="neoleo.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
<Unit1>
<Filename Value="cells.pas"/>
<IsPartOfProject Value="True"/>
</Unit1>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="neoleo"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>
78 changes: 78 additions & 0 deletions lab/pascal/neoleo.lpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
program neoleo;

{$mode objfpc}{$H+}

uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes, SysUtils, CustApp, cells
{ you can add units after this };

type

{ TNeoApp }

TNeoApp = class(TCustomApplication)
protected
procedure DoRun; override;
public
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure WriteHelp; virtual;
end;

{ TNeoApp }

procedure TNeoApp.DoRun;
var
ErrorMsg: String;
begin
// quick check parameters
ErrorMsg:=CheckOptions('h', 'help');
if ErrorMsg<>'' then begin
ShowException(Exception.Create(ErrorMsg));
Terminate;
Exit;
end;

// parse parameters
if HasOption('h', 'help') then begin
WriteHelp;
Terminate;
Exit;
end;

{ add your program here }
test_cells();

// stop program loop
Terminate;
end;

constructor TNeoApp.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
StopOnException:=True;
end;

destructor TNeoApp.Destroy;
begin
inherited Destroy;
end;

procedure TNeoApp.WriteHelp;
begin
{ add your help code here }
writeln('Usage: ', ExeName, ' -h');
end;

var
Application: TNeoApp;
begin
Application:=TNeoApp.Create(nil);
Application.Title:='Neoleo';
Application.Run;
Application.Free;
end.

0 comments on commit bcd80fd

Please sign in to comment.