![]() | ![]() | |||||||||||||||
|
GCC Tutorial: Compiling SparForte ScriptsComplete instructions for converting a SparForte AdaScript script into Ada and compiling it with GCC is beyond the scope of this manual. However, here's are some tips. Getting GCC Ada/GNATGCC Ada is availble for most version of Linux. If you need to, you can compile GCC from sources and activate Ada support. AdaCore, the company responsible for GCC Ada, also as a standalone GPL version and commerical versions available from their web site. Likewise, there are other Ada compiler vendors for other operating systems. Minimize the DifferencesAdaScript is not completely compatible with Ada 2005 because Ada 2005 was never designed as a language for writing scripts. Changes must be made to your script, but the changes should be minimal and easily made. First, compile your script with the pragma ada_95 directive. This will report most non-Ada features as an error. pragma ada_95 disallows the following in scripts:
Use a Main ProcedureSecond, make sure your script is contained in a procedure block (see "script structure" below). Deal with External CommandsThird, external commands will have to be rewritten as Ada procedures or calls to GNAT.OS_Lib.Spawn or the POSIX system() call. You will have to import system() to use it. Final StepsThere are still differences you may encounter such as the package names for certain functions, incompatibility with string types, use of with/use statements, or Ada attributes. To test your script, compile the script. To generate Java byte code to run on a Java Virtual Machine, use the JGNAT compiler instead of GNAT. Or use A# to generate .NET code. To learn more about GCC Ada, read The Big Online Book of Linux Ada Programming. Study Questions
|
![]() Command Prompt Tutorial 1: SparForte as a Calculator Command Prompt Tutorial 2: Basic Shell Commands Command Prompt Tutorial 3: Working with Databases Script Tutorial 1: Basic Commands Scripts Script Tutorial 2: Intermediate Program Scripts Template Tutorial 1: Basic Templates Template Tutorial 2: Intermediate Templates GCC Tutorial: Compiling SparForte Scripts Debugging Tutorial - Using the SparForte Debugger |
![]() |
![]() |