Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ vs(1) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

as

cc

ld

cpp



VS(1,C)                     AIX Commands Reference                      VS(1,C)



-------------------------------------------------------------------------------
vs



PURPOSE

Compiles C, VS Pascal and VS FORTRAN programs.

SYNTAX


      +--------------------+   +--------+   +-----------+
vs ---| +----------------+ |---| +----+ |---| +-------+ |--- filename ---|
      +-| -c      -oname |-+   +-| -v |-+   +-| d+    |-+ A            |
       ^| -C      -O     ||     ^| -# ||      | ename |   +------------+
       || -Dname  -p     ||     |+----+|      | g+    |
       || -E      -P     ||     +------+      | l+    |
       || -g      -Q!    ||                   | lname |
       || -G      -S     ||                   | o1+   |
       || -h      -w     ||                   | o2+   |
       || -Idir   -X     ||                   | o3+   |
       || -lkey   -z     ||                   | o4+   |
       || -ldir          ||                   | v+    |
       |+----------------+|                   | w-    |
       +------------------+                   +-------+


Note:  This command is for the PS/2 only.

DESCRIPTION

The vs command runs the C, VS Pascal and VS FORTRAN compilers and the
assembler.  Its syntax is similar to the cc command.  It accepts files
containing C source code, FORTRAN source code, VS Pascal source code, assembler
source code, or object code and changes them into a form that the computer
system can run.  vs compiles and assembles source files and then links them
with any specified object files, in the order listed on the command line.  It
puts the resulting executable program in a file named a.out.

The vs command runs the following programs:

cpp    The macro preprocessor.

vsc    The first pass of the C compiler.

vspascal
       The first pass of the VS Pascal compiler.

vsfort The first pass of the VS FORTRAN compiler.





Processed November 8, 1990          VS(1,C)                                   1





VS(1,C)                     AIX Commands Reference                      VS(1,C)



vspass2
       The second pass of the compilers (code generator).

vspass3
       The third pass of the compilers (code formatter).

as     The assembler.

ld     The linkage editor.

On the following page is a schematic of the suffixes accepted and generated by
the vs command.











































Processed November 8, 1990          VS(1,C)                                   2





VS(1,C)                     AIX Commands Reference                      VS(1,C)



  .c     .h 1     i      .f         .p       .s     .o   .a

   |      |       |       |          |        |      |    |
   |------+       |       |          |        |      |    |
   V              |       |          |        |      |    |
                  |       |          |        |      |    |
 +---+            |       |          |        |      |    |
 |cpp|            |       |          |        |      |    |
 +---+            |       |          |        |      |    |
   V              |       |          |        |      |    |
                  |       |          |        |      |    |
  .i              |       |          |        |      |    |
   +--------------+       |          |        |      |    |
   V                      |          |        |      |    |
                          V          V        V      |    |
 +---+                +------+  +--------+  +--+     |    |
 |vsc|                |vsfort|  |vspascal|  |as|     |    |
 +---+                +------+  +--------+  +--+     |    |
   |                      |          |        |      |    |
   +---------------------------------+        |      |    |
                          |                   |      |    |
                          V                   |      |    |
                                              |      |    |
                         .i                   |      |    |
                                              |      |    |
                          |                   |      |    |
                          V                   |      |    |
                      +-------+               |      |    |
                      |vspass2|               |      |    |
                      +-------+               |      |    |
                          |                   |      |    |
                          V                   |      |    |
                                              |      |    |
                         .j                   |      |    |
                                              |      |    |
                          |                   |      |    |
                          V                   |      |    |
                      +-------+               |      |    |
                      |vspass3|               |      |    |
                      +-------+               |      |    |
                            |-----------------+      |    |
                            V                        |    |
                                                     |    |
                           .o                        |    |
                            +-----------------------------+
                            |
                            V
                           +--+
1  If -h option is set.    |ld|
                           +--+
                            V
                           a.out (executable)



Processed November 8, 1990          VS(1,C)                                   3





VS(1,C)                     AIX Commands Reference                      VS(1,C)






You can replace any or all of these passes with your own versions by editing
the /bin/vs script.

Input File Types

The vs command recognizes and accepts as input the following file types:

file.c The name of a C language source file should end with .c.

file.f The name of a VS FORTRAN source program should end with .f.

file.p The name of a VS Pascal source file should end with .p.

file.s The name of an assembly language source program should end with .s.

file.i The name of a file that contains preprocessed C source code ends in .i.

file.o The name of an object file ends in .o.  The vs command sends these files
       to the ld command.

file.a The name of an archive library should end with .a.

FLAGS

The vs command recognizes several flags.  In addition, flags intended to modify
the action of the linkage editor (ld), the assembler (as), or the preprocessor
(cpp) may also appear on the vs command line.  vs sends any flags it does not
recognize to these commands for processing.  The following list includes the
most commonly used cpp flags (-D, -I), and ld flags (-l, -L, -o).  See "as,"
"cpp," and "ld" for a complete list of additional flags.

Note:  If you use the -l flag, it must be the last entry on the command line,
       following any file parameters.

Ordinary Operation

-c               Does not send the completed object file to the ld command.
                 With this flag, the output of vs is a .o file for each .c or
                 .s file.

-C               Copies source file output comments to output file.  If
                 omitted, the cpp command removes all comments except those
                 found on cpp directive lines.

-Dname[=def]     Defines name as in a #define directive.  The default def is 1.

-E               Runs the named C source file through only the preprocessor and
                 writes the result to standard output.




Processed November 8, 1990          VS(1,C)                                   4





VS(1,C)                     AIX Commands Reference                      VS(1,C)



-g               Produces additional information for use with the dbx command
                 (the symbolic debugger).

-G               Indicates that global variables are volatile.  The optimizer
                 makes fewer transformations when you specify this flag.  To
                 make a particular variable volatile, add the "volatile"
                 specification to its declaration.

-h               Treats files with the suffix .h in the same way as files with
                 the suffix .c.

-Idir            Looks first in dir, then looks in the directories on the
                 standard list for #include files with names that do not begin
                 with / (slash).

-lkey            Searches the specified library file, where key selects the
                 file libkey.a. ld searches for this file in the directory
                 specified by an -L flag, then in /lib and /usr/lib.  The ld
                 command searches library files in the order in which you list
                 them on the command line.

-Ldir            Looks in dir for files specified by -l keys.  If it does not
                 find the file in dir, ld searches the standard directories.

-oname           Assigns name rather than a.out to the output file.

-O               Sends compiler output to the code optimizers.

-p               Prepares the program so that the prof command can generate an
                 execution profile.  The compiler produces code that counts the
                 number of times each routine is called.  If programs are sent
                 to ld, the compiler replaces the startup routine with one that
                 calls the monitor subroutine at the start (see AIX Operating
                 System Technical Reference for a discussion of this
                 subroutine), and writes a mon.out file when the program ends
                 normally.

-P               Sends the specified C source file to the macro preprocessor
                 and stores the output in a .i file.

-Q!              Disables inlining.

-S               Compiles the specified C programs, storing assembly language
                 output in a .s file.

-w               Prevents printing of warning messages.

-X               Produces an assembler listing.  This is stored in a file that
                 has the same name as the assembler source file but with the
                 extension .lst instead of .s.





Processed November 8, 1990          VS(1,C)                                   5





VS(1,C)                     AIX Commands Reference                      VS(1,C)



-z               Uses the libm.a version, or a version specified by the user,
                 of the following transcendental functions:

                 acos     asin       atan        atan2        cos         exp
                 log      log10      sin         sqrt         tan

                 If this flag is not used, the compiler generates inline
                 instructions for the 80387 math co-processor.  For more
                 information on libm.a, see math.h in AIX Operating System
                 Technical Reference.

Debugging

-v                    Displays the trace as with -# and invokes the programs.

-#                    Displays a trace of the actions to be taken (for example,
                      invoking the preprocessor), without actually invoking any
                      programs.

Extended Compiler Functions

The following flags are accepted by the C, VS FORTRAN and VS Pascal compilers.
See the appropriate compiler User's Guide for additional compiler-specific
flags.

d+                    Produces additional information for use with the dis
                      command (the disassembler).

ename                 Produces an error listing and writes it to the file name.

g+                    Equivalent to the -g option.

l+                    Produces a source listing and writes it to standard
                      output.

lname                 Produces a source listing and writes it to the file name.

o1+                   Uses optimization level 1.

o2+                   Uses optimization level 2.

o3+                   Uses optimization level 3.

o4+                   Uses optimization level 4, equivalent to the -O option.

v+                    Generates information on the progress compilation.

w-                    Equivalent to the -w option.

EXAMPLES





Processed November 8, 1990          VS(1,C)                                   6





VS(1,C)                     AIX Commands Reference                      VS(1,C)



  1. To compile and link a VS FORTRAN program, creating an executable a.out
    file:

      vs pgm.f

  2. To compile a VS Pascal program, producing an object file to be linked
    later:

      vs -c pgm.p

    This compiles "pgm.p" and produces an object file named "pgm".o.

  3. To view the output of the macro preprocessor:

      vs -P -C pgm.c

    This creates a file named "pgm".i that contains the preprocessed program
    text including comments.  vs passes the -P and -C flags to the
    preprocessor.  See "cpp" for more details about them.

  4. To predefine macro identifiers:

      vs -DBUFFERSIZE=512 -DDEBUG pgm.c

    This assigns "BUFFERSIZE" the value "512" and "DEBUG" the value "1" before
    preprocessing.  vs passes the -D flag to the preprocessor.

  5. To use #include files located in nonstandard directories:

      vs -I/u/tom/include pgm.c

    This looks in the directory that contains "pgm.c" for the #include files
    with names enclosed in double quotes ("" ""), then in "/u/tom/include", and
    then in the standard directories.  It looks in "/u/tom/include" for
    #include file names enclosed in angle brackets ("< >"), then in the
    standard directories.  vs passes the -I flag to the preprocessor.

  6. To optimize the object code and produce an assembler listing:

      vs -S -O pgm.c

    This uses the optimizing compiler (-O is minus, capital oh), and produces
    an assembler listing in a file named "pgm".s (-S).

FILES

file.c                              C source file.
file.s                              Assembler file.
file.f                              VS FORTRAN source file.
file.p                              VS Pascal source file.
file.o                              Object file.
a.out                               Linked output.



Processed November 8, 1990          VS(1,C)                                   7





VS(1,C)                     AIX Commands Reference                      VS(1,C)



/lib/cpp                            Preprocessor.
/lib/vsc                            C compiler first pass.
/lib/vsfort                         VS FORTRAN compiler first pass.
/lib/vspascal                       VS Pascal compiler first pass.
/lib/vspass2                        Compiler second pass.
/lib/vspass3                        Compiler third pass.
/bin/as                             Assembler.
/bin/dis                            Disassembler.
/bin/ld                             Linkage editor.
/lib/crt1.o                         Runtime startoff.
/lib/mcrt1.o                        Runtime startoff for profiling.
/lib/libc.a                         Standard library.
/lib/libm.a                         Standard math library.
/lib/libvsfor.a                     VS FORTRAN runtime library.
/lib/libvssys.a                     VS Pascal and VS FORTRAN runtime library.
/usr/lib/msg/vscctmsg.inc           C compiler message file.
/usr/lib/msg/vsdismsg.inc           Disassembler message file.
/usr/lib/msg/vsfctmsg.inc           VS FORTRAN compiler message file.
/usr/lib/msg/vsfrtmsg.inc           VS FORTRAN runtime message file.
/usr/lib/msg/vspctmsg.inc           VS Pascal compiler message file.
/usr/lib/msg/vsprtmsg.inc           VS Pascal runtime message file.
/usr/include                        Standard directory for #include files.
/usr/tmp/vs*                        Temporary.

RELATED INFORMATION

See the following commands:  "as,"  "cc,"  "ld," and "cpp."




























Processed November 8, 1990          VS(1,C)                                   8



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026