commit b394bbe7dd4dc782d72699267846ca7117394779 Author: Timothy J. Warren Date: Thu Sep 23 12:15:42 2021 -0400 First commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9bff53b --- /dev/null +++ b/.gitignore @@ -0,0 +1,46 @@ + +# Created by https://www.toptal.com/developers/gitignore/api/freepascal,lazarus +# Edit at https://www.toptal.com/developers/gitignore?templates=freepascal,lazarus + +### FreePascal ### +*.lps +*.compiled +*.[oa] +*.ppu +*.rst +*.cgi +*.exe +*.log +*.bak* +fp.ini +fp.cfg +fp.dsk + +### Lazarus ### +# Lazarus compiler-generated binaries (safe to delete) +*.dll +*.so +*.dylib +*.lrs +*.res +*.dbg +*.o +*.or +*.a + +# Lazarus autogenerated files (duplicated info) +*.rsj +*.lrt + +# Lazarus local files (user-specific info) + +# Lazarus backups and unit output folders. +# These can be changed by user in Lazarus/project options. +backup/ +*.bak +lib/ + +# Application bundle for Mac OS +*.app/ + +# End of https://www.toptal.com/developers/gitignore/api/freepascal,lazarus diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..8bf4d45 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,6 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/lazarus-tutorials.iml b/.idea/lazarus-tutorials.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/lazarus-tutorials.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..4f1e8c1 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..119fc49 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/__old_lazarus_projects/firstproject/firstproject.lpi b/__old_lazarus_projects/firstproject/firstproject.lpi new file mode 100644 index 0000000..1afb68d --- /dev/null +++ b/__old_lazarus_projects/firstproject/firstproject.lpi @@ -0,0 +1,63 @@ + + + + + + + + + + + + + + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <Units Count="1"> + <Unit0> + <Filename Value="firstproject.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="firstproject"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Linking> + <Debugging> + <DebugInfoType Value="dsDwarf2"/> + </Debugging> + </Linking> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/__old_lazarus_projects/firstproject/firstproject.lpr b/__old_lazarus_projects/firstproject/firstproject.lpr new file mode 100644 index 0000000..2e08a51 --- /dev/null +++ b/__old_lazarus_projects/firstproject/firstproject.lpr @@ -0,0 +1,18 @@ +program firstproject; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Classes + { you can add units after this }; + +begin + writeln('A Free Pascal progam'); + {$IFDEF WINDOWS} + readln; + {$ENDIF} +end. + diff --git a/__old_lazarus_projects/firstproject/firstproject.lps b/__old_lazarus_projects/firstproject/firstproject.lps new file mode 100644 index 0000000..3cfc735 --- /dev/null +++ b/__old_lazarus_projects/firstproject/firstproject.lps @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="1"> + <Unit0> + <Filename Value="firstproject.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <CursorPos X="11" Y="16"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + </Unit0> + </Units> + <JumpHistory HistoryIndex="-1"/> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/__old_lazarus_projects/pointer_project/pointer_project.lpi b/__old_lazarus_projects/pointer_project/pointer_project.lpi new file mode 100644 index 0000000..01f21fc --- /dev/null +++ b/__old_lazarus_projects/pointer_project/pointer_project.lpi @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="pointer_project"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <Units Count="1"> + <Unit0> + <Filename Value="pointer_project.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="pointer_project"/> + </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> diff --git a/__old_lazarus_projects/pointer_project/pointer_project.lpr b/__old_lazarus_projects/pointer_project/pointer_project.lpr new file mode 100644 index 0000000..a4067c2 --- /dev/null +++ b/__old_lazarus_projects/pointer_project/pointer_project.lpr @@ -0,0 +1,20 @@ +program pointer_project; + +{$mode objfpc}{$H+} + +type Plongint = ^longint; + +var + anInt: longint = 243; + intPtr: Plongint; + +begin + intPtr := @anInt; + WriteLn('The value of intPtr^ is ', intPtr^); + Inc(intPtr^, 4); + WriteLn('The value of anInt after Inc(intPtr^, 4) is: ',anInt); + {$IFDEF WINDOWS} + readln; + {$ENDIF} +end. + diff --git a/__old_lazarus_projects/pointer_project/pointer_project.lps b/__old_lazarus_projects/pointer_project/pointer_project.lps new file mode 100644 index 0000000..3cd0a7e --- /dev/null +++ b/__old_lazarus_projects/pointer_project/pointer_project.lps @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="2"> + <Unit0> + <Filename Value="pointer_project.lpr"/> + <IsPartOfProject Value="True"/> + <EditorIndex Value="-1"/> + <CursorPos X="38" Y="18"/> + <UsageCount Value="20"/> + </Unit0> + <Unit1> + <Filename Value="F:\Collector\unit1.pas"/> + <UnitName Value="Unit1"/> + <IsVisibleTab Value="True"/> + <CursorPos Y="34"/> + <UsageCount Value="10"/> + <Loaded Value="True"/> + </Unit1> + </Units> + <JumpHistory Count="1"> + <Position1> + <Filename Value="F:\Collector\unit1.pas"/> + <Caret TopLine="27"/> + </Position1> + </JumpHistory> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/__old_lazarus_projects/shortstrings/stortstrings.lpi b/__old_lazarus_projects/shortstrings/stortstrings.lpi new file mode 100644 index 0000000..550b424 --- /dev/null +++ b/__old_lazarus_projects/shortstrings/stortstrings.lpi @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <General> + <Flags> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="stortstrings"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <Units Count="1"> + <Unit0> + <Filename Value="stortstrings.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="stortstrings"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Linking> + <Debugging> + <DebugInfoType Value="dsDwarf2"/> + </Debugging> + </Linking> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/__old_lazarus_projects/shortstrings/stortstrings.lpr b/__old_lazarus_projects/shortstrings/stortstrings.lpr new file mode 100644 index 0000000..5acddd2 --- /dev/null +++ b/__old_lazarus_projects/shortstrings/stortstrings.lpr @@ -0,0 +1,13 @@ +program stortstrings; + +{$mode objfpc}{$H+} + +var testStr: string[10] = 'Lazarus'; +begin + WriteLn('This shows testStr enclosed by square brackets [', testStr, ']'); + WriteLn('testStr''s length is ', Length(testStr), ' characters'); + {$IFDEF WINDOWS} + ReadLn; + {$ENDIF} +end. + diff --git a/__old_lazarus_projects/shortstrings/stortstrings.lps b/__old_lazarus_projects/shortstrings/stortstrings.lps new file mode 100644 index 0000000..2cdc096 --- /dev/null +++ b/__old_lazarus_projects/shortstrings/stortstrings.lps @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="1"> + <Unit0> + <Filename Value="stortstrings.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <CursorPos X="11" Y="11"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + </Unit0> + </Units> + <JumpHistory HistoryIndex="-1"/> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/__old_lazarus_projects/simple_types/simple_types.lpi b/__old_lazarus_projects/simple_types/simple_types.lpi new file mode 100644 index 0000000..d04abf1 --- /dev/null +++ b/__old_lazarus_projects/simple_types/simple_types.lpi @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <General> + <Flags> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="simple_types"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <Units Count="1"> + <Unit0> + <Filename Value="simple_types.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="simple_types"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Linking> + <Debugging> + <DebugInfoType Value="dsDwarf2"/> + </Debugging> + </Linking> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/__old_lazarus_projects/simple_types/simple_types.lpr b/__old_lazarus_projects/simple_types/simple_types.lpr new file mode 100644 index 0000000..a0f0916 --- /dev/null +++ b/__old_lazarus_projects/simple_types/simple_types.lpr @@ -0,0 +1,32 @@ +program simple_types; + +{$mode objfpc}{$H+} + +const + pName='simple_types'; + tab=#9; + +var + smallInteger: SmallInt= -37; + started: boolean = false; + + +begin + WriteLn('This program is called ', tab, tab, '"', pName, '"', sLineBreak); + + WriteLn('When initalised smallInteger has the value: ', smallInteger); + WriteLn('When initialized started has the value: ', started, sLineBreak); + + smallInteger += 100; + WriteLn('After adding 100 to smallInteger its value is: ', smallInteger); + started:= not started; + WriteLn('Negating started gives it the new value: ', started, sLineBreak); + + WriteLn('The highest value a SmallInt can store is: ', High(SmallInt)); + WriteLn('The lowest value a SmallInt can store is: ', Low(SmallInt)); + + {$IFDEF WINDOWS} + readln; + {$ENDIF} +end. + diff --git a/__old_lazarus_projects/simple_types/simple_types.lps b/__old_lazarus_projects/simple_types/simple_types.lps new file mode 100644 index 0000000..06691f3 --- /dev/null +++ b/__old_lazarus_projects/simple_types/simple_types.lps @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="1"> + <Unit0> + <Filename Value="simple_types.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <CursorPos X="11" Y="30"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + </Unit0> + </Units> + <JumpHistory HistoryIndex="-1"/> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/__old_lazarus_projects/string_functions/string_functions.lpi b/__old_lazarus_projects/string_functions/string_functions.lpi new file mode 100644 index 0000000..3188fd1 --- /dev/null +++ b/__old_lazarus_projects/string_functions/string_functions.lpi @@ -0,0 +1,63 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <General> + <Flags> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasTitleStatement Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="string_functions"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <Units Count="1"> + <Unit0> + <Filename Value="string_functions.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <Target> + <Filename Value="string_functions"/> + </Target> + <SearchPaths> + <IncludeFiles Value="$(ProjOutDir)"/> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <Linking> + <Debugging> + <DebugInfoType Value="dsDwarf2"/> + </Debugging> + </Linking> + </CompilerOptions> + <Debugging> + <Exceptions Count="3"> + <Item1> + <Name Value="EAbort"/> + </Item1> + <Item2> + <Name Value="ECodetoolError"/> + </Item2> + <Item3> + <Name Value="EFOpenError"/> + </Item3> + </Exceptions> + </Debugging> +</CONFIG> diff --git a/__old_lazarus_projects/string_functions/string_functions.lpr b/__old_lazarus_projects/string_functions/string_functions.lpr new file mode 100644 index 0000000..48d6c6b --- /dev/null +++ b/__old_lazarus_projects/string_functions/string_functions.lpr @@ -0,0 +1,22 @@ +program string_functions; + +{$mode objfpc}{$H+} + +uses strutils, sysutils; + +var st: string; + +begin + WriteLn('Enter a word or pharase ([Enter] completes the entry)'); + ReadLn(st); + WriteLn('You typed: ', st); + WriteLn('Your text converted to uppercase: ', UpperCase(st)); + WriteLn('Your text converted to lowercase: ', LowerCase(st)); + WriteLn('Your text converted to proper case: ', + AnsiProperCase(st, StdWordDelims)); + WriteLn('Your text reversed: ', ReverseString(st)); + {$IFDEF WINDOWS} + ReadLn; + {$ENDIF} +end. + diff --git a/__old_lazarus_projects/string_functions/string_functions.lps b/__old_lazarus_projects/string_functions/string_functions.lps new file mode 100644 index 0000000..8d677be --- /dev/null +++ b/__old_lazarus_projects/string_functions/string_functions.lps @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="1"> + <Unit0> + <Filename Value="string_functions.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <CursorPos X="11" Y="20"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + </Unit0> + </Units> + <JumpHistory HistoryIndex="-1"/> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/__old_lazarus_projects/typed_const/typed_const.lpi b/__old_lazarus_projects/typed_const/typed_const.lpi new file mode 100644 index 0000000..04d6aef --- /dev/null +++ b/__old_lazarus_projects/typed_const/typed_const.lpi @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <General> + <Flags> + <MainUnitHasCreateFormStatements Value="False"/> + <MainUnitHasScaledStatement Value="False"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <Title Value="My Application"/> + <UseAppBundle Value="False"/> + <ResourceType Value="res"/> + </General> + <BuildModes Count="1"> + <Item1 Name="Default" Default="True"/> + </BuildModes> + <PublishOptions> + <Version Value="2"/> + <UseFileFilters Value="True"/> + </PublishOptions> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0"/> + </RunParams> + <Units Count="1"> + <Unit0> + <Filename Value="typed_const.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="11"/> + <PathDelim Value="\"/> + <Target> + <Filename Value="typed_const"/> + </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> diff --git a/__old_lazarus_projects/typed_const/typed_const.lpr b/__old_lazarus_projects/typed_const/typed_const.lpr new file mode 100644 index 0000000..74263b3 --- /dev/null +++ b/__old_lazarus_projects/typed_const/typed_const.lpr @@ -0,0 +1,28 @@ +program typed_const; + +{$mode objfpc}{$H+} + +Function GetAName: string; +const lastName: string = ''; +var constName: string = 'Lazarus'; +begin + WriteLn('[Last name entered was "', lastName, '"]'); + WriteLn('[Value of constName is "', constName, '"]'); + Write('Enter a new name: '); + ReadLn(Result); + lastName := Result; +end; + +begin + WriteLn('First invocation of GetAName'); + WriteLn(GetAName); + WriteLn; + WriteLn('Second invocation of GetAName'); + WriteLn(GetAName); + WriteLn; + WriteLn('[Finished]'); + {$IFDEF WINDOWS} + ReadLn; + {$ENDIF} +end. + diff --git a/__old_lazarus_projects/typed_const/typed_const.lps b/__old_lazarus_projects/typed_const/typed_const.lps new file mode 100644 index 0000000..0f81e49 --- /dev/null +++ b/__old_lazarus_projects/typed_const/typed_const.lps @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="UTF-8"?> +<CONFIG> + <ProjectSession> + <PathDelim Value="\"/> + <Version Value="11"/> + <BuildModes Active="Default"/> + <Units Count="1"> + <Unit0> + <Filename Value="typed_const.lpr"/> + <IsPartOfProject Value="True"/> + <IsVisibleTab Value="True"/> + <UsageCount Value="20"/> + <Loaded Value="True"/> + </Unit0> + </Units> + <JumpHistory HistoryIndex="-1"/> + <RunParams> + <FormatVersion Value="2"/> + <Modes Count="0" ActiveMode=""/> + </RunParams> + </ProjectSession> +</CONFIG> diff --git a/simple_examples/Makefile b/simple_examples/Makefile new file mode 100644 index 0000000..e62e7e6 --- /dev/null +++ b/simple_examples/Makefile @@ -0,0 +1,12 @@ +PROGRAMS_SRC = $(wildcard *.pas) +PROGRAMS_O = $(patsubst %.pas,%.o,$(PROGRAMS_SRC)) +PROGRAMS = $(patsubst %.pas,%,$(PROGRAMS_SRC)) + +all: + $(foreach file, $(PROGRAMS), fpc -v0 ${file};) + +clean: + rm -f $(PROGRAMS_O) + rm -f $(PROGRAMS) + +.PHONY: all clean \ No newline at end of file diff --git a/simple_examples/firstproject.pas b/simple_examples/firstproject.pas new file mode 100644 index 0000000..2e08a51 --- /dev/null +++ b/simple_examples/firstproject.pas @@ -0,0 +1,18 @@ +program firstproject; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Classes + { you can add units after this }; + +begin + writeln('A Free Pascal progam'); + {$IFDEF WINDOWS} + readln; + {$ENDIF} +end. + diff --git a/simple_examples/pointer_project.pas b/simple_examples/pointer_project.pas new file mode 100644 index 0000000..a4067c2 --- /dev/null +++ b/simple_examples/pointer_project.pas @@ -0,0 +1,20 @@ +program pointer_project; + +{$mode objfpc}{$H+} + +type Plongint = ^longint; + +var + anInt: longint = 243; + intPtr: Plongint; + +begin + intPtr := @anInt; + WriteLn('The value of intPtr^ is ', intPtr^); + Inc(intPtr^, 4); + WriteLn('The value of anInt after Inc(intPtr^, 4) is: ',anInt); + {$IFDEF WINDOWS} + readln; + {$ENDIF} +end. + diff --git a/simple_examples/simple_types.pas b/simple_examples/simple_types.pas new file mode 100644 index 0000000..a0f0916 --- /dev/null +++ b/simple_examples/simple_types.pas @@ -0,0 +1,32 @@ +program simple_types; + +{$mode objfpc}{$H+} + +const + pName='simple_types'; + tab=#9; + +var + smallInteger: SmallInt= -37; + started: boolean = false; + + +begin + WriteLn('This program is called ', tab, tab, '"', pName, '"', sLineBreak); + + WriteLn('When initalised smallInteger has the value: ', smallInteger); + WriteLn('When initialized started has the value: ', started, sLineBreak); + + smallInteger += 100; + WriteLn('After adding 100 to smallInteger its value is: ', smallInteger); + started:= not started; + WriteLn('Negating started gives it the new value: ', started, sLineBreak); + + WriteLn('The highest value a SmallInt can store is: ', High(SmallInt)); + WriteLn('The lowest value a SmallInt can store is: ', Low(SmallInt)); + + {$IFDEF WINDOWS} + readln; + {$ENDIF} +end. + diff --git a/simple_examples/stortstrings.pas b/simple_examples/stortstrings.pas new file mode 100644 index 0000000..5acddd2 --- /dev/null +++ b/simple_examples/stortstrings.pas @@ -0,0 +1,13 @@ +program stortstrings; + +{$mode objfpc}{$H+} + +var testStr: string[10] = 'Lazarus'; +begin + WriteLn('This shows testStr enclosed by square brackets [', testStr, ']'); + WriteLn('testStr''s length is ', Length(testStr), ' characters'); + {$IFDEF WINDOWS} + ReadLn; + {$ENDIF} +end. + diff --git a/simple_examples/string_functions.pas b/simple_examples/string_functions.pas new file mode 100644 index 0000000..48d6c6b --- /dev/null +++ b/simple_examples/string_functions.pas @@ -0,0 +1,22 @@ +program string_functions; + +{$mode objfpc}{$H+} + +uses strutils, sysutils; + +var st: string; + +begin + WriteLn('Enter a word or pharase ([Enter] completes the entry)'); + ReadLn(st); + WriteLn('You typed: ', st); + WriteLn('Your text converted to uppercase: ', UpperCase(st)); + WriteLn('Your text converted to lowercase: ', LowerCase(st)); + WriteLn('Your text converted to proper case: ', + AnsiProperCase(st, StdWordDelims)); + WriteLn('Your text reversed: ', ReverseString(st)); + {$IFDEF WINDOWS} + ReadLn; + {$ENDIF} +end. + diff --git a/simple_examples/typed_const.pas b/simple_examples/typed_const.pas new file mode 100644 index 0000000..74263b3 --- /dev/null +++ b/simple_examples/typed_const.pas @@ -0,0 +1,28 @@ +program typed_const; + +{$mode objfpc}{$H+} + +Function GetAName: string; +const lastName: string = ''; +var constName: string = 'Lazarus'; +begin + WriteLn('[Last name entered was "', lastName, '"]'); + WriteLn('[Value of constName is "', constName, '"]'); + Write('Enter a new name: '); + ReadLn(Result); + lastName := Result; +end; + +begin + WriteLn('First invocation of GetAName'); + WriteLn(GetAName); + WriteLn; + WriteLn('Second invocation of GetAName'); + WriteLn(GetAName); + WriteLn; + WriteLn('[Finished]'); + {$IFDEF WINDOWS} + ReadLn; + {$ENDIF} +end. +