PowerAda 35

From OC Systems Wiki!
Jump to: navigation, search

(35) Parameter passing and function return for the main subprogram.

See 10.2(21).

A PowerAda main subprogram may accept a single IN parameter of type STRING, and may return a value if it is a function. The value of the string is the entire command line except the program name. The preferred method for accessing the command line parameters is by using the function POSIX_PROCESS_ENVIRONMENT.ARGUMENT_LIST, which is part of the standard POSIX/Ada Packages as specified in IEEE Std 1003.5-1992 and supported by PowerAda. Ada95 also provides the package ADA.COMMAND_LINE for this purpose as well.

The value returned by a main function is ignored. You may set the return code when compiling in the Ada95 mode of PowerAda using ADA.COMMAND_LINE.SET_EXIT_STATUS. You may also specify a return code when exiting a program via a call to POSIX_PROCESS_PRIMITIVES.EXIT_PROCESS.