Tools: MPW
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Support

MPW Command Reference


SC[pp]

Tool

SYNTAX

SC[pp] [sourceFile] [options]

DESCRIPTION

The SC tool compiles a C language source file. By convention, C language source filenames end with a .c suffix. Once complied, a file of the form name.c yields an object file of the form name.c.o. To change the object filename use the -o option or -fatext option.

The SCpp tool compiles a C++ language source file. By convention, C++ language source filenames end with a .cp suffix. Once complied, a file of the form name.cp yields an object file of the form name.cp.o. To change the object filename use the -o option or the -fatext option.

INPUT

Standard input, unless you specify a source file. You can press Command-Enter to terminate standard input. Note that if you compile standard input, the compiler cannot produce symbolic debugging information.

OUTPUT

An object file is generated unless the -e option is specified. Errors and warnings are always written to standard error. Error messages from the compiler have the following format:

source line containing the error or when it was detected…
    ^
File "filename"; line lineNumber #Error: message
#----------------------

The "^" is a pointer to the approximate location of the error.

STATUS

SC and SCpp can return the following status codes:

0

no errors

1

errors, compilation completed

2

fatal error, compilation aborted

PARAMETERS

[sourceFile]

Specifies a C or C++ language source file to compile. If the source language is C, use SC. If the source language is C++, use SCpp.

OPTIONS

-align power | mac68k | byte

Sets alignment within data structures. Allows you to use PowerPC, 68K, or byte with no padding alignment rules as the default setting.

-ansi off | on | relaxed | strict

Controls certain language extensions and the degree of conformance to the ANSI standard.

off

Uses ANSI C or C++ language without strict typechecking.

on | relaxed

Uses the ANSI C or C++ language with strict typechecking, but allows the use of Apple C language extensions.

strict

Uses the ANSI C or C++ language with strict typechecking, and does not allow the use of Apple C language extensions.

If you use strict, the base size of the enum type is always the same as the int type. You can override the size of the enum type with the -enum min option. If you do this, the SC compiler warns you that there is a possible conflict.

-auto_import size

Use this option with -model cfmSeg or -model cfmFlat to specify the size at which data items are to be automatically considered as imported and exported. With -model cfmFlat, this option changes the default from 1200 to the specified size. With -model cfmSeg, data greater than the specified size is to be automatically imported and exported. This option does not affect code segmentation.

-b | -b2 | -b3 | -b4

Produces code and data references that are relative to the position of the program counter. PC-relative object code tends to run more efficiently. The PC-relative strings option is useful for code resources or other self-contained programs that contain string literals.

-b

Produces PC-relative strings and function calls.

-b2

Generates PC-relative references for functions in the same segment and for string constants (the same as the -b option), but also allows the code generator to reduce code size by overlaying string constants whenever possible.

-b3

Produces only PC-relative strings.

-b4

Turns off the -b, -b2, or -b3 option.

-bigseg

Generates code for a single large segment and does not effect the automatic import or export of data items. This option can be used with the -model cfmSeg option to specify to the compiler that code is to be generated that is a single code segment and may be greater than 32 KB. This option is not required with the -model cfmFlat option.

-bool off | on

Controls whether bool, true, and false are treated as standard keywords or normal identifiers. (SCpp only)

off

Treats bool, true, and false as normal identifiers.

on

Treats bool, true, and false as standard keywords.

-char signed | unsigned | unsignedX

Determines whether objects of type char (including character literals) are treated as signed or unsigned.

signed

Treats char as signed. Maintains compatibility with MPW C and MPW C++.

unsigned

Treats char as unsigned. If you use unsigned characters, the values of char_min and char_max in the limits.h header file no longer match the actual range of the char type.

unsignedX

Treats char as a sign-extended, but unsigned, entity.

-d[efine] name | name=value

Defines a preprocessor symbol name. The name parameter defines the specified name to have the value 1. The name=value parameter defines the specified name to have the specified value. If you use the name=value parameter, do not place a space before or after the equal sign (=). Also, if the name=value parameter contains any special characters, you must enclose the parameter in double quotes (for example, name="2 ").

-dump[c] filename

Saves the state of the compilation in the specified file. Only declarations and variable definitions are allowed in a dump file, no code is included. The state can then be loaded in a later compilation with the -load[c] option. This load/dump mechanism is used to load common definitions quickly.

Note
A dump file created by the SC compiler is not compatible with the SCpp compiler. •

-e

Generates preprocessor expansion of source. Performs macro expansion and includes the specified header files in the resulting output. When you use this option, comments remain in the output and the compiler does not perform semantic analysis and code generation, which occur after the preprocessing phase.

Note
The -e option does not automatically send the results of the preprocessor phase to standard output, as it does with some compilers. You must also use the -l option to see the results. •

-EH

Enables C++ exception handling. This option is the same as -exceptions on. (SCpp only)

-elems881

Inlines expansion of transcendental functions such as sin() and cos() with MC68881 instructions. This option automatically switches the -mc68881 option on.

-enum min | int

Determines the size of enumeration types. Specifying int causes all enums to be the same size as ints, while min indicates that the compiler should use the minimum size needed to store the values in the enum (1, 2, 3, or 4 bytes). The default is minimum-sized enums unless -ansi strict is specified.

-ER

Enables C++ run-time type indentification (RTTI). This option is the same as -rtti on. (SCpp only)

-exceptions on | off

Enables or disables C++ exception handling. (SCpp only)

-fatext

Specifies that the output filename generated by the compiler is the input filename followed by the appended extension ".68k.o".

-frames

Generates stack frames.

-i pathname[,pathname]…

Searches for include files in the specified directories. Multiple -i options can be specified. The search order is as follows:

The include filename is used as specified. If a full pathname is given, then no other searching is applied. If the file isn't found, and the pathname used to specify the file is a partial pathname (no colons in the name or a leading colon), then the following directories are searched.

The directory containing the current input file.

The directories specified in the -i option, in the order listed.

The directories specified in the MPW Shell variable {CIncludes}.

-ignorepragma id[,id]…

Ignores #pragmas with the specified #pragma IDs.

-inclpath normal | standard {std} | ignoresys[tem] | nosys[tem]

Controls how system header files and included files are treated.

normal | standard {std}

Distinguishes between system header files, which are given in angle brackets (< >), and include files in double quotes (""), the former being system includes, which are looked up in the {CIncludes} directory first.

ignoresys[tem] | nosys[tem]

Treats header files enclosed in angle brackets (< >) like header files in double quotes ("").

-includes mac | dos | unix

Controls how to interpret #include pathnames.

mac

Interprets #include pathnames as Macintosh pathnames.

dos

Interprets #include pathnames as DOS pathnames.

unix

Interprets #include pathnames as Unix pathnames.

-inline on | all | off | none

Controls the type of inlining performed by the compiler. (SCpp only)

on | all

Expands any function within the compilation unit where inlining provides speed optimization, including C++ functions not specified as candidates for inlining.

off | none

Does not perform any inline expansion of any function.

-ir pathname[,pathname]…

This option is the same as -i except the listed directories are searched recursively.

-j0 | -j1 | -j2

Controls the handling of 2-byte Asian characters. Use -j0 for Japanese, -j1 for Chinese or Taiwanese, or -j2 for Korean character recognition in string and character constants.

-l filename

Generates a listing of the source file with the include files expanded and sends it to filename. Use this option with the -e option to see the effect of macro expansions and conditionals.

-load[c] filename

Restores the state of a compilation from filename. The file loaded should have been dumped in an earlier compilation with the -dump[c] option. This load/dump mechanism is used to load common definitions quickly.

Note
Precompiled headers from one version of these compilers are not necessarily acceptable to other versions of the same compiler. In addition, an SC precompiled header is not acceptable to SCpp, nor is an SCpp precompiled header acceptable to SC. •

-mbg on | full | off

Controls the generation of MacsBug symbols.

on | full

Generates MacsBug symbols.

off

Does not generate MacsBug symbols.

-mc68020 | -mc68030 | -mc68040

Generates code optimized for Macintosh computers with MC68020, MC68030, or MC68040 microprocessors. These options produce faster and smaller code.

-mc68881

Uses MC68881 instructions to produce faster and smaller code. This option also changes the size of long doubles from the default of 10 bytes to 12 bytes. In addition, it inlines floating point instructions for intrinsic functions, such as add, subtract, multiply, and divide. This option implies -mc68020.

-model cfmFlat | cfmSeg | far | farCode | farData | near | nearCode | nearData

Specifies which addressing model to use for accessing data and code. The -model cfmSeg and -model cfmFlat options request generation of the CFM-68K runtime model supporting shared libraries. These models set the -mc68020 option. The -model far and -model farCode options remove the 32 KB limitation on code segments and the jump table. If any of these options are specified when compiling, they must also be used when linking.

cfmFlat

Specifies that code fragments are not segmented and can be greater than 32 KB. It allows global data items larger than 1200 bytes to be imported and requests generation of a single segment CFM-68K runtime model supporting shared libraries.

cfmSeg

Specifies that code fragments can be multisegmented and can be less than 32 KB. In addition, it requests generation of a multi-segment CFM-68K runtime model supporting shared libraries.

far

Generates 32-bit load-time relocatable references. This removes the 32 KB restriction on the size of code segments, the jump table, and the global data area.

farCode

Generates 32-bit references for code only. This removes the 32 KB restriction on code.

farData

Generates 32-bit references for global data only. This removes the 32 KB restriction on global data.

near

Compiles normally with 16-bit (32 KB) references (the default). It enforces the 32 KB size limitation of the global data area and on code segments and jump tables.

nearCode

Compiles with 16-bit (32 KB) references for code only. It enforces the 32 KB size limitation on code segments and jump tables.

nearData

Compiles with 16-bit (32 KB) references for global data only. It enforces the 32 KB size limitation of the global data area.

-noMapCR

Tells the compiler to use the linefeed character for the newline escape sequence. Because Macintosh text files use the carriage return character to end lines, by default Macintosh C compilers generate a carriage return character for the \n newline escape sequence in character and string literals. However, on most other platforms, C compilers generate the linefeed character for the newline escape sequence.

This option also controls what is generated by the \r escape sequence. By default, the compiler generates a linefeed character for the \r escape sequence. Using this option, the compiler generates a carriage return character, so \n and \r never generate the same character, which is useful if you are compiling for other platforms.

-nomfmem

Inhibits the use of temporary memory.

-notOnce

Allows the compiler to read multiple copies of header files. You cannot use this option to specify a specific header file. The default behavior of the compiler reads header files only once, unless the -notOnce option is specified.

-o filename | dirname:

Specifies the output filename or directory for the generated code. If this option is not used, the compiler assigns a default filename to the object file (the source filename with a .o suffix) and places it in the same directory as the source file.

If only a directory is specified, the compiler assigns the default filename to the object file and places it in the specified directory. The directory must already exist; the compiler does not create new directories.

-opt off | none | space | speed | time | all

Sets the level of optimization that the compiler performs.

off | none

Suppresses all optimizations.

space

Favors space optimizations over execution time optimizations.

speed | time | all

Favors execution time optimizations over space optimizations.

-onefrag

Assumes that any C++ language constructs for the CFM-68K runtime model are in the same fragment.

-p

Generates progress information about the compilation and sends it to the diagnostic output.

-paslinkage

Requests that the default linkage convention for functions match Pascal calling conventions.

-proto strict | auto

Specifies the requirements for function prototypes in source files.

If the strict argument is used, function prototypes are required. If the auto argument is used, the compiler does not require function prototypes, but the number of parameters that are used when the function is called must be the same as the number used to declare it.

-rtti on | off

Enables or disables C++ run-time type information (RTTI). (SCpp only)

-s[eg] segname

Assigns the object code to the specified segment name. The default segment name is "Main".

-sym off | on | full [,alltypes][,nolines][,notypes][,novars]

Controls whether the compiler generates symbolic debugging information.

off

Suppresses generation of debugging information.

on | full

Generates debugging information only for referenced types and uses the following modifiers:

,alltypes

Generates debugging information for all types, even if they are not represented in the compilation.

,nolines

Suppresses the generation of source line information.

,notypes

Suppresses the generation of information about the data types of variables.

,novars

Suppresses the generation of information about variables.

-trace on | off | always | never

Controls tracing code generation.

on | always

Generates tracing code--calls to %_EP and %_BP.

off | never

Generates no tracing code.

-typecheck strict | relaxed

Controls whether the compiler performs strict or relaxed typechecking.

-u all | name[,name]…

Contols the suppression of predefined non-ANSI macros.

all

Suppresses all predefined non-ANSI macros.

name[,name]…

Suppresses only the listed predefined non-ANSI macros.

-validate_ptrs

Generates pointer validation code.

-w on | off | [is]err[or] | number[,number]…

Controls how warning messages are issued by the compiler.

on

Issues all warnings as warnings.

off

Suppresses all warning messages.

[is]err[or]

Treats all warnings as errors.

number[,number]…

Suppresses only the specified warning(s).

-x

Allows more than the default maximum number of errors without terminating the compilation.

-xa extern | public | static

Determines the accessibility of generated template functions. (SCpp only)

extern

Inhibits template expansion.

public

Uses public scope. Functions are visible outside the compiled file.

static

Uses static scope. Functions remain local to the file.

-xi template

Instantiates the template specified by the template parameter. (SCpp only)

EXAMPLES

For a C language source file:

SC sample.c -p -sym on

For a C++ language source file:

SCpp sample.cp -opt speed

SEE ALSO

MrC[pp]

The CExamples: folder in the {MPW}Examples: directory

SC/SCpp: C/C++ Compiler for 68K Macintosh

 
 


Last Updated July 2000