Peter's Ada Examples ↩
Directory pchapin-examples\ contains Ada code examples coming from GitHub project tutorialada created by Peter Chapin.
|
This example has the following directory structure :
> tree /a /f . | findstr /v /b [A-Z] | build.bat | build.gpr | build.sh | Makefile \---src \---main \---ada check_buffers.adb check_buffers.ads check_sorters.adb check_sorters.ads dates-check_dates.adb dates-check_dates.ads primary_suite.adb primary_suite.ads samples_test.adb
Bach file build.bat
-verbose clean run
generates and executes de Ada program target\Check.exe
:
> build -verbose run Compile 9 Ada source files into directory "target\obj" Execute Ada program "target\Check.exe" OK Buffers : Fill OK Buffers : Reverse_Buffer OK Buffers : Rotate_Right OK Buffers : Rotate_Left OK Buffers : Count_Substrings OK Buffers : Count_Character OK Buffers : Count_And_Erase_Character OK Buffers : Compact OK Buffers : Copy_Into OK Buffers : Copy_Onto OK Buffers : Substring OK Dates : Create OK Dates : Advance OK Sorters : Selection_Sort OK Sorters : Bubble_Sort OK Sorters : Merge_Sort Total Tests Run: 16 Successful Tests: 16 Failed Assertions: 0 Unexpected Errors: 0
> gprbuild & target\Check.exe
This example has the following directory structure :
> tree /a /f . | findstr /v /b [A-Z] | build.bat | build.gpr | build.sh | Makefile \---src \---main \---ada a.adb a.ads b.adb b.ads c.adb c.ads elaboration_demo.adb parent-child.adb parent-child.ads parent.adb parent.ads
Batch file build.bat
-verbose clean run
generates and executes the Ada program target\ElaborationOrder.exe
:
> build -verbose clean run Compile 11 Ada source files to directory "target\obj" Execute Ada program "target\ElaborationOrder.exe" Printing stuff in package Parent.Child
This example has the following directory structure :
> tree /a /f . | findstr /v /b [A-Z] | build.bat | build.gpr | build.sh | Makefile \---src \---main \---ada vowels.adb
Batch file build.bat
-verbose clean run
generates and executes the Ada program target\Vowels.exe
:
> build -verbose clean run Compile 1 Ada source file to directory "target\obj" Execute Ada program "target\Vowels.exe" Total number of vowels = 11 Total number of Ys = 0
Footnotes ▴
[1] Gnatmake ↩
-
GNU tools such as
gcc
,gnatmake
,objdump
andwindres
are available both in the MSYS installation and in the GNAT 2021 installation; we use the tools from the MSYS installation which have newer versions.> where gcc gnatmake windres C:\opt\msys64\usr\bin\gcc.exe C:\opt\msys64\mingw64\bin\gcc.exe C:\opt\GNAT\2021\bin\gcc.exe C:\opt\msys64\mingw64\bin\gnatmake.exe C:\opt\GNAT\2021\bin\gnatmake.exe C:\opt\msys64\usr\bin\windres.exe C:\opt\msys64\mingw64\bin\windres.exe C:\opt\GNAT\2021\bin\windres.exe > C:\opt\msys64\mingw64\bin\gnatmake.exe --version GNATMAKE 13.2.0 Copyright (C) 1995-2023, Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > C:\opt\GNAT\2021\bin\gnatmake.exe --version GNATMAKE Community 2021 (20210519-103) Copyright (C) 1995-2021, Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.