home *** CD-ROM | disk | FTP | other *** search
-
-
-
- ADAED() MISC. REFERENCE MANUAL PAGES ADAED()
-
-
-
- NAME
- adaed - NYU translator and interpreter for the Ada program-
- ming language
-
- SYNOPSIS
- adacomp [ option ] ... file
-
- adabind [ option ] ... [ library ]
-
- adaexec [ option ] ... [ library ]
-
- adalib [ library ]
-
- DESCRIPTION
- Adaed is a translator/interpreter for the Ada programming
- language that is intended primarily for educational use.
- Adacomp compiles an Ada program; it invokes in succession
- the three compilation phases: parsing, semantic analysis,
- and code generation. The file argument refers to the source
- file; if it contains no suffix the Ada source is assumed to
- be in file.ada. It may be a full path name. The output of
- the compiler is an instruction stream for an abstract Ada
- machine, which is subsequently interpreted.
-
- Adabind binds the library with the specified main_unit to
- form an executable program.
-
- Adaexec invokes the Ada machine interpreter. Library speci-
- fies a library containing a bound program.
-
- Adalib is a utility that enables the user to examine the
- contents of the specified library.
-
- Note: all options must precede the file name (for adacomp),
- or library name (for adabind, adaexec, and adalib) and must
- be in lower case.
-
- LIBRARY
- All compilations require a library. A library is a sub-
- directory, which is created or reinitialized when the user
- invokes a command containing -n option, such as:
- adacomp -n -l libname adafile
- Intermediate files appear in subdirectory libname. This
- directory is created by the command if it does not already
- exist. Only the listing files are created in the directory
- from which adacomp is invoked. The libname directory should
- be used to hold files created by the adaed commands only
- (i.e. those produced by the Ada/Ed system); confusion and
- grief may result if you attempt to use a library directory
- to hold other files. The libname argument may be a full
- path name.
-
-
-
-
- NYU Ada Group Last change: 23 September 1991 1
-
-
-
-
-
-
- ADAED() MISC. REFERENCE MANUAL PAGES ADAED()
-
-
-
- If the environment variable ADALIB is defined, its value is
- used as a default library and the -l option (including its
- libname argument) to adacomp can be omitted. Similarly, if
- ADALIB is defined then the library name need not be provided
- to adabind, adaexec, and adalib.
-
- A given utility library, UL (e.g. one that contains
- mathematical functions) may be used by several unrelated
- programs. It may then be convenient to create independent
- libraries for each program, and initialize each library with
- the contents of UL. This can be done simply by creating
- directories for each library, and copying the contents of UL
- into each of these.
-
- OPTIONS
- The options for adacomp are as follows:
-
- -a Generates instructions for use by the inter-
- preter (adaexec command) to trace the Ada
- source lines. Used in conjunction with the -t
- a option of adaexec.
-
- -b Indicates that the binding of the library is
- to be performed if the current compilation is
- completed without errors.
-
- -g Specifies that the compiler is to produce a
- listing of the generated instructions for the
- Ada machine (of little interest to most
- users).
-
- -ix This is an option to the binder and is
- relevant only if the -b option is used. See
- options for adabind below.
-
- -llibrary Uses the specified library to satisfy refer-
- ences to compilation units not present in the
- file being compiled. If the compilation is
- successful, the units defined in the file are
- added to the library. If this option is not
- specified explicitly, a default library is
- implicitly defined by the ADALIB environment
- variable.
-
- -munit_name This is an option to the binder and is
- relevant only if the -b option is used. See
- options for adabind below.
-
- -n Indicates that a new library is to be created
- for this compilation. The name of the library
- is indicated by the -l option or through the
- ADALIB environment variable. The -n option
-
-
-
- NYU Ada Group Last change: 23 September 1991 2
-
-
-
-
-
-
- ADAED() MISC. REFERENCE MANUAL PAGES ADAED()
-
-
-
- must be specified if the library referenced
- by the -l option (or the ADALIB environment
- variable) does not already exist or must be
- reinitialized.
-
- -s Produces a listing of the source file. The
- name of the listing file is the input file
- name prefix with suffix .lis. By default, no
- listing file is generated unless there are
- warnings, errors or informational messages to
- report.
-
- -v Gives a (verbose) descriptive trace showing
- the subsidiary programs invoked by the
- adacomp command, the options and arguments
- passed to them, and their exit status. This
- is used primarily for system checkout.
-
- The options for adabind are as follows:
-
- -munit_name Specifies the name of the unit which is to
- serve as a main program. When the library
- contains only one main program (which must be
- a parameterless procedure) this option is not
- needed.
-
- -ix To be used for programs that use pragma
- INTERFACE. x designates the non-Ada inter-
- faced procedures and may be a) the name of an
- object file, created by the user, of the form
- filename.o (that appears in the same direc-
- tory as the Ada program); or b) an abbrevia-
- tion for the library '/lib/libx.a'. If that
- does not exist then '/usr/lib/libx.a' is
- searched. This library is unrelated to the
- Ada program library referenced by the various
- adaed commands, and generally refers to a
- standard library provided for another pro-
- gramming language. This option may be used
- as many times as necessary, providing that
- each use represents only a single file or
- library. Thus, adabind -i a.o -i b.o -i lib
- ... is acceptable, while adabind -i a.o b.o
- lib ... is not. To use this option, the
- environment variable INT must be set to point
- to the directory containing the file adaint
- (see the Setup file or your system manager).
- Usage examples appear below.
-
- The options for adaexec are as follows:
-
- -mbound_main_unit
-
-
-
- NYU Ada Group Last change: 23 September 1991 3
-
-
-
-
-
-
- ADAED() MISC. REFERENCE MANUAL PAGES ADAED()
-
-
-
- Specifies the name of the bound main unit, i.e.
- the main unit that was specified to adabind, or
- adacomp. Note that a given library may have been
- bound several times with different main units.
- When the library has been bound with only one main
- unit, this option is not needed.
-
- -hheap_size
- Specify the size of the heap increment in kilo-
- words, by which the heap is expanded when the ela-
- boration of a new entity requires it. The heap
- expands to fill available memory. The default
- increment is 128. This parameter limits the size
- of the largest object that can be created in a
- program.
-
- -pp_size Specifies the size in bytes of the program stack
- size for the main task. The default is 10000.
- Argument values in the range 1..31 are multiplied
- by 1024 to obtain the stack size in bytes. The
- maximum value is 32767.
-
- -st_size Specifies the size in bytes of the stack size for
- each new task. The default is 10000. Argument
- values in the range 1..31 are multiplied by 1024
- to obtain the stack size in bytes. Use of small
- stack sizes may be appropriate when executing pro-
- grams with many tasks, each of which can run with
- a small stack. The maximum value is 32767.
-
- -ttrace_options
- Specify one or more of the following letters indi-
- cating the kind of trace(s) requested for the exe-
- cution of the program.
-
- a (Ada line) Display the source line
- numbers. This requires that
- the program be compiled with
- the -a option.
-
- c (calls) Display the name of each sub-
- program as it is entered and
- exited.
-
- e (exceptions) Display the name of each
- exception as it is raised.
-
- r (rendezvous) Trace each rendezvous.
-
- t (tasks) Display task creation, activa-
- tion, and termination.
-
-
-
-
- NYU Ada Group Last change: 23 September 1991 4
-
-
-
-
-
-
- ADAED() MISC. REFERENCE MANUAL PAGES ADAED()
-
-
-
- EXAMPLES
- The following examples show typical usage:
-
-
- 1) Compile t1.ada into a new library called testlib
- and bind the library; then execute it. The list-
- ing is written to t1.lis. Note that -s is used to
- force a listing file to be created.
- adacomp -s -nl testlib -b t1
- adaexec testlib
-
- 2) Compile a package specification in p.spc and
- corresponding body in p.bod into a new library
- called tstlib. Then compile t2.ada into the same
- library, bind the main program, and execute it
- adacomp -nl tstlib p.spc
- adacomp -l tstlib p.bod
- adacomp -l tstlib -b t2
- adaexec tstlib
-
- 3) In the example above, the binding could be done in
- a separate phase. This is achieved by replacing
- the third command above with:
- adacomp -l tstlib t2
- adabind tstlib
-
- 4) Example 2 above could be done without explicitly
- specifying the library by setting the environment
- variable ADALIB, as follows:
- setenv ADALIB my_default_directory
- adacomp -n p.spc
- adacomp p.bod
- adacomp -b t2
- adaexec
-
-
- 5) Compile a program with line numbers included in
- the generated code. Execute it displaying Ada
- source line numbers as they are encountered.
- adacomp -a -nl libname -b t1
- adaexec -t a libname
-
- 6) Compile a program with two parameterless pro-
- cedures (potential main programs) which are named
- MAIN1 and MAIN2 in files p1.ada and p2.ada respec-
- tively, and bind the library tstlib using MAIN1 as
- the main program.
- adacomp -nl tstlib p1
- adacomp -l tstlib p2
- adabind -m main1 tstlib
- adaexec tstlib
-
-
-
-
- NYU Ada Group Last change: 23 September 1991 5
-
-
-
-
-
-
- ADAED() MISC. REFERENCE MANUAL PAGES ADAED()
-
-
-
- 7) Suppose we wish to add another program to the
- library tstlib (created in Example 6) whose main
- program unit is named MAIN3 and appears in file
- p3.ada. The following commands will compile and
- execute MAIN3. As tstlib was previously bound with
- MAIN1 as a main unit, it is now necessary to use
- the -m option to adaexec in order to select the
- desired bound main unit.
- adacomp -l tstlib p3
- adabind -m main3 tstlib
- adaexec -m main3 tstlib
-
- 8) The contents of the library above can be examined
- by:
- adalib tstlib
- Adalib writes the name, type and compilation date
- of each unit in the specified library to standard
- output. In addition, it writes the current status
- (active or obsolete) of each unit. Units which may
- be main programs are noted by "(Main)"; if there
- is more than one such unit, the -m option to ada-
- bind must be specified during binding. Libraries
- that have been bound will contain at least one
- unit labeled "binding unit". If several of these
- are active, the -m option must be specified for
- adaexec.
-
- PRAGMA INTERFACE
- Pragma interface (LRM 13.9) is currently supported for
- interfacing to subprograms written in FORTRAN or C.
-
- Arguments to interfaced procedures must be one of the fol-
- lowing types:
- For C: integer, float, access, array, record, and enumera-
- tion types.
- For FORTRAN: integer, float and array. The return types
- available are integer and float.
-
- Following are sample Ada programs that are interfaced to
- subprograms coded in FORTRAN and C, together with the code
- for the interfaced subprograms:
-
- 1) Interface to FORTRAN
-
- C This is a source file called func.f which contains two
- functions to be used in an
- C Ada program with pragma INTERFACE.
-
- function sqr(x)
- sqr = x*x
- return
- end
-
-
-
- NYU Ada Group Last change: 23 September 1991 6
-
-
-
-
-
-
- ADAED() MISC. REFERENCE MANUAL PAGES ADAED()
-
-
-
- function cube(x)
- cube = x*x*x
- return
- end
-
- -- Assume that the following are the contents of file
- fortlib.ada.
- -- It contains a compilation unit that defines two func-
- tions which are
- -- interfaced to the above routines.
-
- package FORTRAN_LIB is
- function SQR(X:FLOAT) return FLOAT;
- function CUBE(X:FLOAT) return FLOAT;
- private
- pragma INTERFACE(FORTRAN, SQR);
- pragma INTERFACE(FORTRAN, CUBE);
- end FORTRAN_LIB;
-
- with FORTRAN_LIB, TEXT_IO; use FORTRAN_LIB, TEXT_IO;
- procedure TEST is
- function SQRT(X : FLOAT) return FLOAT;
- pragma INTERFACE(C,SQRT);
- package MY_FLOAT_IO is new FLOAT_IO(FLOAT); use
- MY_FLOAT_IO;
- begin
- PUT(SQR(2.0));
- NEW_LINE;
- PUT(CUBE(2.0));
- NEW_LINE;
- PUT(SQRT(2.0));
- NEW_LINE;
- end TEST;
-
- To compile and execute, enter the following commands:
- f77 -c func.f
- adacomp -nl testlib -b -i func.o fortlib
- adaexec testlib
- The output will be:
- 4.00000E+00
- 8.00000E+00
- 1.41421E+00
-
- 2) Interface to C
-
- /*
- * Source file proc.c contains procedures PRINTA and PRINTS1
- called by
- * the Ada program above.
- */
- printa(ara)
- int ara[];
-
-
-
- NYU Ada Group Last change: 23 September 1991 7
-
-
-
-
-
-
- ADAED() MISC. REFERENCE MANUAL PAGES ADAED()
-
-
-
- {
- int i;
- for (i=0;i<10;i++) {
- printf("%d ",ara[i]);
- }
- printf("\n");
- }
-
- prints1(ara,len)
- int ara[];
- int len;
- {
- int i;
- for (i=0;i<len;i++) {
- printf("%c",ara[i]);
- }
- printf("\n");
- }
-
- -- Assume that file test_interface.ada contains the follow-
- ing program:
- procedure C_INTERFACES is
- type ARA10 is array(1..10) of INTEGER;
- A10: ARA10 := (1,2,3,4,5,6,7,8,9,10);
-
- procedure PRINTA(A:ARA10);
- -- PRINTA prints an array of 10 elements of type
- INTEGER
- pragma INTERFACE(C, PRINTA);
-
- procedure PRINTS1(A:STRING; LEN: INTEGER);
- -- PRINTS1 prints an array of LEN elements of type
- CHARACTER
- pragma INTERFACE(C, PRINTS1);
-
- procedure PRINTS(A:STRING) is
- -- This routine prints a string by passing the string
- and its length
- -- to the routine PRINTS1 which is written in C.
- begin
- PRINTS1(A, A'length);
- end;
-
- begin
- PRINTA(A10);
- PRINTS("this is any string");
- end;
-
- To compile and execute, enter the following:
- cc -c proc.c
- adacomp -i proc.o -nl testlib -b
- test_interface
-
-
-
- NYU Ada Group Last change: 23 September 1991 8
-
-
-
-
-
-
- ADAED() MISC. REFERENCE MANUAL PAGES ADAED()
-
-
-
- adaexec testlib
-
- The resulting output is as follows:
- 1 2 3 4 5 6 7 8 9 10
- this is any string
-
- ENVIRONMENT
- The environment variable ADALIB contains the name of the
- library used if none is specified on the command line.
-
- Normally the executables called by adacomp and the prede-
- fined libraries are in a directory built into the system.
- The directory containing these can be specified by the
- environment variable ADAED which overrides the built in
- directory name.
-
- The location of individual components called by adacomp or
- the location of the predefined libraries can be overridden
- with the following environment variables: PRS For the
- parser, adaprs; SEM For the semantic analyzer, adasem; GEN
- For the code generator, adagen; BND For the binder, adabind;
- and ADAEDPREDEF For the predefined libraries.
-
- FILES
- file.ada Ada source file
- adaint partially built interpreter (used for pragma
- interface)
- predef.axq symbol table for predef
- predef.trc tree file for predef
- predef.lib library for predef
-
- DIAGNOSTICS
- Adaed commands return an exit code of 0 in the case of suc-
- cess, and nonzero otherwise. An error code of 1 indicates
- errors in usage of the Ada language, 2 is returned if there
- is an internal Adaed system error, and 3 denotes some
- invalid usage of the Adaed system. Error messages regarding
- invalid system usage are directed to the standard error
- file. Ada language related messages detected at compilation
- are written to the listing file, while those detected by
- adabind or adaexec appear on standard output.
-
- Note, that an error in a given compilation unit may cause
- subsequent compilation units (within the same compilation)
- not to be recognized.
-
- AUTHORS
- Ada/Ed-C was written by the following members of the NYU Ada
- Project: Bernard Banner, Jerome Chiabaut, Robert Dewar, Anne
- Dinning, Alain Lauque, Gail Schenker Morgulis, Brett Porter,
- Jean-Pierre Rosen, Edmond Schonberg, David Shields, Brian
- Siritzky, Franck Triplet.
-
-
-
- NYU Ada Group Last change: 23 September 1991 9
-
-
-
-
-
-
- ADAED() MISC. REFERENCE MANUAL PAGES ADAED()
-
-
-
- BUGS
- We give absolutley no warranty as to the correctness of the
- system. It was designed strictly for teaching purposes.
- Currently it is unvalidated although we hope to put it in a
- validatable shape in the near future.
-
- Any compilation or execution that terminates abnormally with
- mention of internal error has uncovered a bug that should be
- reported to the NYU Ada group.
-
- NYUADA project
- New York University
- 251 Mercer Street
- New York, N.Y. 10012
- (212) 998 - 3480
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- NYU Ada Group Last change: 23 September 1991 10
-
-
-
-