home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / programm / programi / adaed.lzh / Ada / man / ada.man next >
Encoding:
Text File  |  1992-03-01  |  21.2 KB  |  661 lines

  1.  
  2.  
  3.  
  4. ADAED()           MISC. REFERENCE MANUAL PAGES            ADAED()
  5.  
  6.  
  7.  
  8. NAME
  9.      adaed - NYU translator and interpreter for the Ada  program-
  10.      ming language
  11.  
  12. SYNOPSIS
  13.      adacomp [ option ] ...  file
  14.  
  15.      adabind [ option ] ...  [ library ]
  16.  
  17.      adaexec  [ option ] ...  [ library ]
  18.  
  19.      adalib [ library ]
  20.  
  21. DESCRIPTION
  22.      Adaed is a translator/interpreter for  the  Ada  programming
  23.      language  that  is  intended  primarily for educational use.
  24.      Adacomp compiles an Ada program; it  invokes  in  succession
  25.      the  three  compilation  phases: parsing, semantic analysis,
  26.      and code generation. The file argument refers to the  source
  27.      file;  if it contains no suffix the Ada source is assumed to
  28.      be in file.ada. It may be a full path name.  The  output  of
  29.      the  compiler  is  an instruction stream for an abstract Ada
  30.      machine, which is subsequently interpreted.
  31.  
  32.      Adabind binds the library with the  specified  main_unit  to
  33.      form an executable program.
  34.  
  35.      Adaexec invokes the Ada machine interpreter.  Library speci-
  36.      fies a library containing a bound program.
  37.  
  38.      Adalib is a utility that enables the  user  to  examine  the
  39.      contents of the specified library.
  40.  
  41.      Note: all options must precede the file name (for  adacomp),
  42.      or  library name (for adabind, adaexec, and adalib) and must
  43.      be in lower case.
  44.  
  45. LIBRARY
  46.      All compilations require a library.  A  library  is  a  sub-
  47.      directory,  which  is created or reinitialized when the user
  48.      invokes a command containing -n option, such as:
  49.                     adacomp -n -l libname adafile
  50.      Intermediate files  appear  in  subdirectory  libname.  This
  51.      directory  is  created by the command if it does not already
  52.      exist.  Only the listing files are created in the  directory
  53.      from  which adacomp is invoked. The libname directory should
  54.      be used to hold files created by  the  adaed  commands  only
  55.      (i.e.  those  produced  by the Ada/Ed system); confusion and
  56.      grief may result if you attempt to use a  library  directory
  57.      to  hold  other  files.   The libname argument may be a full
  58.      path name.
  59.  
  60.  
  61.  
  62.  
  63. NYU Ada Group    Last change: 23 September 1991                 1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. ADAED()           MISC. REFERENCE MANUAL PAGES            ADAED()
  71.  
  72.  
  73.  
  74.      If the environment variable ADALIB is defined, its value  is
  75.      used  as  a default library and the -l option (including its
  76.      libname argument) to adacomp can be omitted.  Similarly,  if
  77.      ADALIB is defined then the library name need not be provided
  78.      to adabind, adaexec, and adalib.
  79.  
  80.      A  given  utility  library,  UL  (e.g.  one  that   contains
  81.      mathematical  functions)  may  be  used by several unrelated
  82.      programs.  It may then be convenient to  create  independent
  83.      libraries for each program, and initialize each library with
  84.      the contents of UL.  This can be  done  simply  by  creating
  85.      directories for each library, and copying the contents of UL
  86.      into each of these.
  87.  
  88. OPTIONS
  89.      The options for adacomp are as follows:
  90.  
  91.      -a             Generates instructions for use by the  inter-
  92.                     preter  (adaexec  command)  to  trace the Ada
  93.                     source lines. Used in conjunction with the -t
  94.                     a option of adaexec.
  95.  
  96.      -b             Indicates that the binding of the library  is
  97.                     to be performed if the current compilation is
  98.                     completed without errors.
  99.  
  100.      -g             Specifies that the compiler is to  produce  a
  101.                     listing of the generated instructions for the
  102.                     Ada  machine  (of  little  interest  to  most
  103.                     users).
  104.  
  105.      -ix            This is  an  option  to  the  binder  and  is
  106.                     relevant  only if the -b option is used.  See
  107.                     options for adabind below.
  108.  
  109.      -llibrary      Uses the specified library to satisfy  refer-
  110.                     ences to compilation units not present in the
  111.                     file being compiled. If  the  compilation  is
  112.                     successful, the units defined in the file are
  113.                     added to the library.  If this option is  not
  114.                     specified  explicitly,  a  default library is
  115.                     implicitly defined by the ADALIB  environment
  116.                     variable.
  117.  
  118.      -munit_name    This is  an  option  to  the  binder  and  is
  119.                     relevant  only if the -b option is used.  See
  120.                     options for adabind below.
  121.  
  122.      -n             Indicates that a new library is to be created
  123.                     for this compilation. The name of the library
  124.                     is indicated by the -l option or through  the
  125.                     ADALIB  environment  variable.  The -n option
  126.  
  127.  
  128.  
  129. NYU Ada Group    Last change: 23 September 1991                 2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. ADAED()           MISC. REFERENCE MANUAL PAGES            ADAED()
  137.  
  138.  
  139.  
  140.                     must be specified if the  library  referenced
  141.                     by  the  -l option (or the ADALIB environment
  142.                     variable) does not already exist or  must  be
  143.                     reinitialized.
  144.  
  145.      -s             Produces a listing of the  source  file.  The
  146.                     name  of  the  listing file is the input file
  147.                     name prefix with suffix .lis. By default,  no
  148.                     listing  file  is  generated unless there are
  149.                     warnings, errors or informational messages to
  150.                     report.
  151.  
  152.      -v             Gives a (verbose) descriptive  trace  showing
  153.                     the   subsidiary   programs  invoked  by  the
  154.                     adacomp command, the  options  and  arguments
  155.                     passed  to them, and their exit status.  This
  156.                     is used primarily for system checkout.
  157.  
  158.      The options for adabind are as follows:
  159.  
  160.      -munit_name    Specifies the name of the unit  which  is  to
  161.                     serve  as  a  main program.  When the library
  162.                     contains only one main program (which must be
  163.                     a parameterless procedure) this option is not
  164.                     needed.
  165.  
  166.      -ix            To be  used  for  programs  that  use  pragma
  167.                     INTERFACE.  x  designates  the non-Ada inter-
  168.                     faced procedures and may be a) the name of an
  169.                     object file, created by the user, of the form
  170.                     filename.o (that appears in the  same  direc-
  171.                     tory  as the Ada program); or b) an abbrevia-
  172.                     tion for the library '/lib/libx.a'.  If  that
  173.                     does  not  exist  then  '/usr/lib/libx.a'  is
  174.                     searched. This library is  unrelated  to  the
  175.                     Ada program library referenced by the various
  176.                     adaed commands, and  generally  refers  to  a
  177.                     standard  library  provided  for another pro-
  178.                     gramming language.  This option may  be  used
  179.                     as  many  times  as necessary, providing that
  180.                     each use represents only  a  single  file  or
  181.                     library.  Thus,  adabind -i a.o -i b.o -i lib
  182.                     ... is acceptable, while adabind -i  a.o  b.o
  183.                     lib  ...  is  not.   To  use this option, the
  184.                     environment variable INT must be set to point
  185.                     to  the  directory containing the file adaint
  186.                     (see the Setup file or your system  manager).
  187.                     Usage examples appear below.
  188.  
  189.      The options for adaexec are as follows:
  190.  
  191.      -mbound_main_unit
  192.  
  193.  
  194.  
  195. NYU Ada Group    Last change: 23 September 1991                 3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. ADAED()           MISC. REFERENCE MANUAL PAGES            ADAED()
  203.  
  204.  
  205.  
  206.                Specifies the name of the bound  main  unit,  i.e.
  207.                the  main  unit  that was specified to adabind, or
  208.                adacomp. Note that a given library may  have  been
  209.                bound  several  times  with  different main units.
  210.                When the library has been bound with only one main
  211.                unit, this option is not needed.
  212.  
  213.      -hheap_size
  214.                Specify the size of the heap  increment  in  kilo-
  215.                words, by which the heap is expanded when the ela-
  216.                boration of a new entity  requires  it.  The  heap
  217.                expands  to  fill  available  memory.  The default
  218.                increment is 128.  This parameter limits the  size
  219.                of  the  largest  object  that can be created in a
  220.                program.
  221.  
  222.      -pp_size  Specifies the size in bytes of the  program  stack
  223.                size  for  the  main  task.  The default is 10000.
  224.                Argument values in the range 1..31 are  multiplied
  225.                by  1024  to obtain the stack  size in bytes.  The
  226.                maximum value is 32767.
  227.  
  228.      -st_size  Specifies the size in bytes of the stack size  for
  229.                each  new  task.   The  default is 10000. Argument
  230.                values in the range 1..31 are multiplied  by  1024
  231.                to  obtain  the stack size in bytes.  Use of small
  232.                stack sizes may be appropriate when executing pro-
  233.                grams  with many tasks, each of which can run with
  234.                a small stack.  The maximum value is 32767.
  235.  
  236.      -ttrace_options
  237.                Specify one or more of the following letters indi-
  238.                cating the kind of trace(s) requested for the exe-
  239.                cution of the program.
  240.  
  241.                a    (Ada line)     Display   the   source    line
  242.                                    numbers.   This  requires that
  243.                                    the program be  compiled  with
  244.                                    the -a option.
  245.  
  246.                c    (calls)        Display the name of each  sub-
  247.                                    program  as  it is entered and
  248.                                    exited.
  249.  
  250.                e    (exceptions)   Display  the  name   of   each
  251.                                    exception as it is raised.
  252.  
  253.                r    (rendezvous)   Trace each rendezvous.
  254.  
  255.                t    (tasks)        Display task creation, activa-
  256.                                    tion, and  termination.
  257.  
  258.  
  259.  
  260.  
  261. NYU Ada Group    Last change: 23 September 1991                 4
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. ADAED()           MISC. REFERENCE MANUAL PAGES            ADAED()
  269.  
  270.  
  271.  
  272. EXAMPLES
  273.      The following examples show typical usage:
  274.  
  275.  
  276.           1)   Compile t1.ada into a new library  called  testlib
  277.                and  bind the library; then execute it.  The list-
  278.                ing is written to t1.lis.  Note that -s is used to
  279.                force a listing file to be created.
  280.                               adacomp -s -nl testlib -b t1
  281.                               adaexec testlib
  282.  
  283.           2)   Compile  a  package  specification  in  p.spc  and
  284.                corresponding  body  in  p.bod  into a new library
  285.                called tstlib.  Then compile t2.ada into the  same
  286.                library, bind the main program, and execute it
  287.                               adacomp -nl tstlib p.spc
  288.                               adacomp -l tstlib p.bod
  289.                               adacomp -l tstlib -b t2
  290.                               adaexec tstlib
  291.  
  292.           3)   In the example above, the binding could be done in
  293.                a  separate  phase.  This is achieved by replacing
  294.                the third command above with:
  295.                               adacomp -l tstlib t2
  296.                               adabind tstlib
  297.  
  298.           4)   Example 2 above could be done  without  explicitly
  299.                specifying  the library by setting the environment
  300.                variable ADALIB, as follows:
  301.                               setenv ADALIB my_default_directory
  302.                               adacomp -n p.spc
  303.                               adacomp p.bod
  304.                               adacomp -b t2
  305.                               adaexec
  306.  
  307.  
  308.           5)   Compile a program with line  numbers  included  in
  309.                the  generated  code.   Execute  it displaying Ada
  310.                source line numbers as they are encountered.
  311.                               adacomp -a -nl libname -b t1
  312.                               adaexec -t a libname
  313.  
  314.           6)   Compile a  program  with  two  parameterless  pro-
  315.                cedures  (potential main programs) which are named
  316.                MAIN1 and MAIN2 in files p1.ada and p2.ada respec-
  317.                tively, and bind the library tstlib using MAIN1 as
  318.                the main program.
  319.                               adacomp -nl tstlib p1
  320.                               adacomp -l tstlib p2
  321.                               adabind -m main1 tstlib
  322.                               adaexec tstlib
  323.  
  324.  
  325.  
  326.  
  327. NYU Ada Group    Last change: 23 September 1991                 5
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. ADAED()           MISC. REFERENCE MANUAL PAGES            ADAED()
  335.  
  336.  
  337.  
  338.           7)   Suppose we wish to  add  another  program  to  the
  339.                library  tstlib  (created in Example 6) whose main
  340.                program unit is named MAIN3 and  appears  in  file
  341.                p3.ada.   The  following commands will compile and
  342.                execute MAIN3. As tstlib was previously bound with
  343.                MAIN1  as  a main unit, it is now necessary to use
  344.                the -m option to adaexec in order  to  select  the
  345.                desired bound main unit.
  346.                               adacomp -l tstlib p3
  347.                               adabind -m main3 tstlib
  348.                               adaexec -m main3 tstlib
  349.  
  350.           8)   The contents of the library above can be  examined
  351.                by:
  352.                               adalib tstlib
  353.                Adalib writes the name, type and compilation  date
  354.                of  each unit in the specified library to standard
  355.                output.  In addition, it writes the current status
  356.                (active or obsolete) of each unit. Units which may
  357.                be main programs are noted by "(Main)";  if  there
  358.                is  more than one such unit, the -m option to ada-
  359.                bind must be specified during binding.   Libraries
  360.                that  have  been  bound  will contain at least one
  361.                unit labeled "binding unit".  If several of  these
  362.                are  active,  the  -m option must be specified for
  363.                adaexec.
  364.  
  365. PRAGMA INTERFACE
  366.      Pragma interface  (LRM  13.9)  is  currently  supported  for
  367.      interfacing to subprograms written in FORTRAN or C.
  368.  
  369.      Arguments to interfaced procedures must be one of  the  fol-
  370.      lowing types:
  371.      For C: integer, float, access, array, record,  and  enumera-
  372.      tion types.
  373.      For FORTRAN: integer, float and  array.   The  return  types
  374.      available are integer and float.
  375.  
  376.      Following are sample Ada programs  that  are  interfaced  to
  377.      subprograms  coded  in FORTRAN and C, together with the code
  378.      for the interfaced subprograms:
  379.  
  380.      1)   Interface to FORTRAN
  381.  
  382.       C This is a source file called func.f  which  contains  two
  383.      functions to be used in an
  384.       C Ada program with pragma INTERFACE.
  385.  
  386.           function sqr(x)
  387.           sqr = x*x
  388.           return
  389.           end
  390.  
  391.  
  392.  
  393. NYU Ada Group    Last change: 23 September 1991                 6
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. ADAED()           MISC. REFERENCE MANUAL PAGES            ADAED()
  401.  
  402.  
  403.  
  404.           function cube(x)
  405.           cube = x*x*x
  406.           return
  407.           end
  408.  
  409.       -- Assume that the  following  are  the  contents  of  file
  410.      fortlib.ada.
  411.       -- It contains a compilation unit that  defines  two  func-
  412.      tions which are
  413.       -- interfaced to the above routines.
  414.  
  415.       package FORTRAN_LIB is
  416.           function SQR(X:FLOAT) return FLOAT;
  417.           function CUBE(X:FLOAT) return FLOAT;
  418.       private
  419.           pragma INTERFACE(FORTRAN, SQR);
  420.           pragma INTERFACE(FORTRAN, CUBE);
  421.       end FORTRAN_LIB;
  422.  
  423.       with FORTRAN_LIB, TEXT_IO; use FORTRAN_LIB, TEXT_IO;
  424.       procedure TEST is
  425.          function SQRT(X : FLOAT) return FLOAT;
  426.          pragma INTERFACE(C,SQRT);
  427.          package  MY_FLOAT_IO   is   new   FLOAT_IO(FLOAT);   use
  428.      MY_FLOAT_IO;
  429.       begin
  430.           PUT(SQR(2.0));
  431.           NEW_LINE;
  432.           PUT(CUBE(2.0));
  433.           NEW_LINE;
  434.           PUT(SQRT(2.0));
  435.           NEW_LINE;
  436.       end TEST;
  437.  
  438.      To compile and execute, enter the following commands:
  439.                     f77 -c func.f
  440.                     adacomp -nl testlib -b -i func.o fortlib
  441.                     adaexec testlib
  442.      The output will be:
  443.       4.00000E+00
  444.       8.00000E+00
  445.       1.41421E+00
  446.  
  447.      2)   Interface to C
  448.  
  449.      /*
  450.       * Source file proc.c contains procedures PRINTA and PRINTS1
  451.      called by
  452.       * the Ada program above.
  453.       */
  454.      printa(ara)
  455.      int ara[];
  456.  
  457.  
  458.  
  459. NYU Ada Group    Last change: 23 September 1991                 7
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. ADAED()           MISC. REFERENCE MANUAL PAGES            ADAED()
  467.  
  468.  
  469.  
  470.      {
  471.          int i;
  472.          for (i=0;i<10;i++) {
  473.             printf("%d ",ara[i]);
  474.          }
  475.          printf("\n");
  476.      }
  477.  
  478.      prints1(ara,len)
  479.      int ara[];
  480.      int len;
  481.      {
  482.          int i;
  483.          for (i=0;i<len;i++) {
  484.              printf("%c",ara[i]);
  485.          }
  486.          printf("\n");
  487.      }
  488.  
  489.      -- Assume that file test_interface.ada contains the  follow-
  490.      ing program:
  491.       procedure C_INTERFACES is
  492.           type ARA10 is array(1..10) of INTEGER;
  493.           A10: ARA10 := (1,2,3,4,5,6,7,8,9,10);
  494.  
  495.           procedure PRINTA(A:ARA10);
  496.           -- PRINTA prints  an  array  of  10  elements  of  type
  497.      INTEGER
  498.           pragma INTERFACE(C, PRINTA);
  499.  
  500.           procedure PRINTS1(A:STRING; LEN: INTEGER);
  501.           -- PRINTS1 prints an array  of  LEN  elements  of  type
  502.      CHARACTER
  503.           pragma INTERFACE(C, PRINTS1);
  504.  
  505.           procedure PRINTS(A:STRING) is
  506.           -- This routine prints a string by passing  the  string
  507.      and its length
  508.           -- to the routine PRINTS1 which is written in C.
  509.           begin
  510.               PRINTS1(A, A'length);
  511.           end;
  512.  
  513.       begin
  514.          PRINTA(A10);
  515.          PRINTS("this is any string");
  516.       end;
  517.  
  518.      To compile and execute, enter the following:
  519.                     cc -c proc.c
  520.                     adacomp   -i   proc.o    -nl    testlib    -b
  521.                test_interface
  522.  
  523.  
  524.  
  525. NYU Ada Group    Last change: 23 September 1991                 8
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. ADAED()           MISC. REFERENCE MANUAL PAGES            ADAED()
  533.  
  534.  
  535.  
  536.                     adaexec testlib
  537.  
  538.      The resulting output is as follows:
  539.      1 2 3 4 5 6 7 8 9 10
  540.      this is any string
  541.  
  542. ENVIRONMENT
  543.      The environment variable ADALIB contains  the  name  of  the
  544.      library used if none is specified on the command line.
  545.  
  546.      Normally the executables called by adacomp  and  the  prede-
  547.      fined  libraries  are  in a directory built into the system.
  548.      The directory containing  these  can  be  specified  by  the
  549.      environment  variable  ADAED  which  overrides  the built in
  550.      directory name.
  551.  
  552.      The location of individual components called by  adacomp  or
  553.      the  location  of the predefined libraries can be overridden
  554.      with  the  following  environment  variables:  PRS  For  the
  555.      parser,  adaprs;  SEM For the semantic analyzer, adasem; GEN
  556.      For the code generator, adagen; BND For the binder, adabind;
  557.      and ADAEDPREDEF For the predefined libraries.
  558.  
  559. FILES
  560.      file.ada      Ada source file
  561.      adaint        partially built interpreter (used  for  pragma
  562.      interface)
  563.      predef.axq    symbol table for predef
  564.      predef.trc    tree file for predef
  565.      predef.lib    library for predef
  566.  
  567. DIAGNOSTICS
  568.      Adaed commands return an exit code of 0 in the case of  suc-
  569.      cess,  and  nonzero otherwise.  An error code of 1 indicates
  570.      errors in usage of the Ada language, 2 is returned if  there
  571.      is  an  internal  Adaed  system  error,  and  3 denotes some
  572.      invalid usage of the Adaed system.  Error messages regarding
  573.      invalid  system  usage  are  directed  to the standard error
  574.      file.  Ada language related messages detected at compilation
  575.      are  written  to  the  listing file, while those detected by
  576.      adabind or adaexec appear on standard output.
  577.  
  578.      Note, that an error in a given compilation  unit  may  cause
  579.      subsequent  compilation  units (within the same compilation)
  580.      not to be recognized.
  581.  
  582. AUTHORS
  583.      Ada/Ed-C was written by the following members of the NYU Ada
  584.      Project: Bernard Banner, Jerome Chiabaut, Robert Dewar, Anne
  585.      Dinning, Alain Lauque, Gail Schenker Morgulis, Brett Porter,
  586.      Jean-Pierre  Rosen,  Edmond  Schonberg, David Shields, Brian
  587.      Siritzky, Franck Triplet.
  588.  
  589.  
  590.  
  591. NYU Ada Group    Last change: 23 September 1991                 9
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. ADAED()           MISC. REFERENCE MANUAL PAGES            ADAED()
  599.  
  600.  
  601.  
  602. BUGS
  603.      We give absolutley no warranty as to the correctness of  the
  604.      system.  It  was  designed  strictly  for teaching purposes.
  605.      Currently it is unvalidated although we hope to put it in  a
  606.      validatable shape in the near future.
  607.  
  608.      Any compilation or execution that terminates abnormally with
  609.      mention of internal error has uncovered a bug that should be
  610.      reported to the NYU Ada group.
  611.  
  612.           NYUADA project
  613.           New York University
  614.           251 Mercer Street
  615.           New York, N.Y. 10012
  616.           (212) 998 - 3480
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657. NYU Ada Group    Last change: 23 September 1991                10
  658.  
  659.  
  660.  
  661.