COMMAND - command to compile multi-segment C programs.

Syntax:

nsc [sourcefile] [option]*
(+|-)18bitShorts (-)        (+|-)Clear (-)
(+|-)ControlComments (-)    (+|-)FAr (-)
(+|-)Hugepointers (-)       (+|-)Keep (-)
(+|-)Load (+)               (+|-)Rotate (-)
(+|-)StandardLibrary (+)    (+|-)Tables (-)
(+|-)TEST (-)               (+|-)Zdebug (-)
Configuration=file          Define=name=value
Entry=name                  FAr=bytes
Format=keyword              Heap=words
Include=catalog             LiSting=keywords
Library=library             LinK=filename
LoadOpts=options            Map=filename
Name=module                 Output=file
STI=string                  Stack=words
StandardInclude=catalog     StandardLibrary=lib
TEST=file                   USe=symbol
Update=file

Examples:

nsc /myfile.c o=/myfile.o

Options:

sourcefile
is a file containing C source code.
+18bitShorts
indicates that the program should use 18-bit integers to hold values declared as "short int" (signed and unsigned). Since 18-bit integers are not natural for the hardware to manipulate, this will increase the size and running time of your program. Note that the library is compiled with -18bitShorts. The only place where this causes problems is with the "scanf" family of functions. If you use "scanf" to read a "short" value, you MUST read it into a 36-bit machine word, even if you have +18bitShorts in effect.
+Clear
is used in conjunction with the Update= option. The +Clear option initializes the given library before any LD object code is stored in the library. Any previous contents of the library are lost. This option must be specified when creating a new library.
+ControlComments
specifies that the compiler should interpret the Lint control comments in the source code. Normally such comments are ignored, and only the corresponding pragmas are interpreted.
+FAr
specifies that all objects are to be considered as 'far', regardless of size.
-FAr
specifies that all objects are to be considered as 'near', including references to undimensioned arrays.
+Hugepointers
specifies that unqualified pointer types are to be treated as huge pointers. Indexing from huge pointers uses any carry or borrow from the word offset to change the SEGID, thus allowing the pointer to point to an array of objects spanning more than one hardware segment.
-Hugepointers
specifies that unqualified pointer types are to be treated as near pointers.
+Keep
leaves the intermediate files in the AFT.
-Load
indicates that the output of the command should not be run through the LD pass of the compiler. -Load cannot be used with Format=LD (see below).
+Rotate
specifies that all conversions between pointer types and integral types treat the integral value as a byte offset. This means that the integral value will not have the same bit pattern as the pointer value; loosely speaking, the integer value makes it look like the address space is "flat" (a contiguous series of bytes) rather than segmented. The default behaviour (-Rotate) is to do the conversion as a one-to-one bitwise mapping.
-StandardLibrary
suppresses the inclusion of standard libraries during the linking pass of the compiler.
+Tables
generates local symbol tables for line numbers and auto variables.
+TEST
asks to use test versions of the compiler passes and libraries. See the discussion "Driver Configuration File" below for more details.
+Zdebug
performs various debugging operations. This option is intended for use by those maintaining the compiler; it is not of interest to normal users.
Configuration=file
specifies a CPP configuration file. For more details, see "expl nsc cpp".
Define=name=string
defines a preprocessor symbol named "name" with the given "string" value. For example,
define=NDEBUG=1

defines a manifest NDEBUG with value 1. Single or double quotes may be used to enclose strings containing blanks. Any number of Define= options may be specified on the command line.

Entry=name
specifies an entry name. This is passed on to the LD link editing phase as the entry name for the program. For further details, see "expl ld". If no Entry= option is specified, the default entry name is "C$ENTRY". NOTE: People writing normal C programs should not use this option, since the default will provide optimal results.
FAr=bytes
specifies the threshold size for 'far' external objects. Any objects whose size is below the boundary will be linked and referenced placing the object within the first 32K words of the External Segment. Any object whose size is greater than or equal to this limit will be defined in an unbound section, and referenced with no assumptions as to binding. The default for this limit is 16K words (64k bytes).
Format=keyword
indicates the desired format of the output file. The desired format is indicated by one of the following keywords.
LD
output is in LD format. Output will be passed through the LD pass of the compiler to make it compact. This option may not be specified with -Load.
QStar
is only supported for test development. The output is an accomodation mode Q*, linked with a limited subset of the library for running under TSS.
Run_Unit
output is a complete run-unit.
Linked_Object_Module
output is a single OM that contains the entire program. To produce an appropriate run-unit, just run the OM through LKED (without specifying libraries).
Object_Module
output is an OM that does not have standard library routines linked in. To produce a run-unit, you must run the OM through LKED, specifying libraries as appropriate.
OTHER
does not specify a format. In this case, if you want to control what LD produces, you must use the LoadOpts= option.
Heap=words
specifies the size of the operand heap when LD writes a Run Unit. The heap will be broken into as many 256K word segments as are required. The default is 64K words. There is seldom any reason to change this default, since C normally grows the heap space as needed; however, in TP8 the heap space does not grow, so the Heap= option should be set as high as needed.
Include=catalog
searches the given catalog for quoted "#include" files (if necessary). Up to eight such subcatalogs may be specified on the command line. Searching through these specified catalogs takes place after the compiler has searched through the subcatalog containing the source file and before it begins searching through the default "#include" catalog If multiple subcatalogs are specified, they will be searched in the order specified on the command line.
Library=name
indicates an LD library containing routines that should be linked in with the source code being compiled. Several "Library=" options may be specified on the same command line.
LinK=filename
specifies extra input files to be supplied to LD, along with the result of the compilation of the source file (if any), in the order specified on the command line.
LiSting=keywords
specifies which parts of a listing should be produced. The keywords should be selected from abbreviations of the following, separated by commas:
Inputsource  - List the source and include files
Outputsource - List the output of the preprocessor
Xref         - List an identifier cross reference
Assembler    - List the generated machine code

The listing is written to standard output. If no keywords are supplied (that is, the option is just "LiSting="), a listing is generated which contains all of the above sections.

LoadOpts=options
specifies options for the LD phase of the compiler. This option is not of interest to general users.
Map=filename
writes a load map into the specified file.
Name=module
gives a name for the module being compiled.
Output=file
tells the compiler where to write the output of the compilation. The default output file name depends on the Format=keyword option.
QStar format:     .h
Run_Unit format:  fc*v*
All others:       fc*o*
Stack=words
specifies the size of the software stack when LD writes a Run Unit. The default is 1k words, which is adequate for most C programs.
StandardInclude=catalog
is similar to Include=catalog, but tells the compiler where to search for #include file names enclosed in <angle brackets>.
StandardLibrary=name
indicates the name of a system library to be searched.
STI=sti
specifies a 12 character STI number. This option is not normally used, but will affect where the compiler looks for its configuration file.
TEST=file
specifies a configuration file that defines where the compiler should look to find code for the different compiler passes, libraries, include files and other auxiliary files. See below for more details.
Update=file
indicates that the output module should be edited into the library specified by "filename". Normally, LEDIT will be called to edit the compiled output into an LD library. However, if the Format= option is used LEDIT, LODL, OMLEDIT or RUED may be used. This option is not available in batch, where the same effect can easily be accomplished with a following job step.
USe=name
forces LD to link in the routine(s) identified by the given name(s).

Description:

This command compiles C programs for execution in the GCOS-8 multi-segment environment. The command itself runs under TSS or batch.

Diagnostics

This compiler gives more warning messages than many other versions of C. Programmers can use various #pragma directives to suppress some of these warnings, when the code in question is known to be correct.

Compiling in Batch

If your program is too big to compile under TSS, you can compile it in batch. You can do so with the JCL

$      select  &system/profile.prod/nsc
$      run     rufile=&cv00rp/nsc_ru
$      data    cz
$      ascii
command line
$      enx

where "command line" is exactly like a command line that you would use under TSS. If necessary, you can continue the command line over several lines of input by putting a backslash at the end of every line but the last one, as in

nsc file \
    option \
    option \
    option

Notes:

The size supplied to FAr= is in bytes; the sizes supplied for Stack= and Heap= are in words. These sizes follow the C rules for radix: a value starting with "0x" or "0X" is in hexadecimal, a number starting with "0" is octal, and otherwise the number is decimal. The number may be followed by a 'k' or 'm', indicating kilo- or megabytes, respectively.

Driver Configuration File

The NSC driver uses a configuration file to locate other files used by the compiler. By default this is the file &SYSTEM/<current-sti>/files, but the STI= and TEST= options may be used to specify another version.

The file is organized as a set of lines of the form

keyword prod-path test-path

Lines beginning with "*" are treated as comments. The order of the keyword directives is not important, but all the following directives must be present.

CPP, TFD, Pass0, Pass1, LoaDer
These keyword directives give the location of the qstars for the TSS compiler passes. If the "+TEST" option is specified, and "test-path" does not exist then "prod-path" will be used instead.
LiBrary
This directive gives the location of the catalogue where the compiler will look for standard libraries. If "+TEST" is specified, the "test-path" catalogue will be checked first.
Include
This directive gives the catalogue used for the standard includes. Although a "test-path" is required on the directive, the value is always ignored.

See Also:

expl linfo
displaying the contents of LD object libraries.
expl ledit
editing LD object libraries.
expl lint manual
for checking validity and portability of C programs.

Files Used:

fc**0, fc**1, fc**2 etc - work files
fc*99 - CPP config file
&system/<sti>/files - driver configuration file

Copyright © 2000, Thinkage Ltd.