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

MPW Command Reference


CMarker

Tool

SYNTAX

CMarker [file1] [file2]… [-a[nachronisms]]
[-d[efine] name[=string][,name[=string]]…] [-e] [-errors]
[-ext[ensions] on | off] [-i[ncludes] directoryPath[,directoryPath]…]
[-lang[uage] C | "C++"] [-linesize n] [-l[ist[ing]]] [-mc68881] [-msi]
[-pp] [-ppout filename] [-p[rogress]] [-showskipped] [-t]
[-u[ndefine] name[,name]…]

DESCRIPTION

The CMarker tool supports the MPW Browser by automatically generating markers for C++ and ANSI C source files. Before marking the files, CMarker reads each one separately, preprocessing it and checking it for syntax errors. The tool then generates Open and Mark commands that, when executed, mark the source files at each function definition. Note that marker names are identical to the names of the functions they mark, making it easy for you to choose the function later with the MPW Browser.

INPUT

Standard input, unless you specify input files.

OUTPUT

Standard output. The only exception is the -ppout option, which writes preprocessor information to an output file.

STATUS

CMarker can return the following status codes:

0

no errors

1

parameter or option error

2

execution error

3

syntax error

PARAMETERS

file1 [file2]…

Specifies the C++ or ANSI C source files to be marked.

OPTIONS

-a[nachronisms]

Suppresses anachronism warnings. Normally CMarker generates warnings for obsolete ANSI C features and C++ anachronisms to diagnostic output.

-d[efine] name[=string][,name[=string]]…

Defines the identifier name as having the specified value (either the specified string or 1).

Note
The -d option does not override #define statements in the source file. •

name

Specifies the identifier to be defined.

string

Specifies the string value of the identifier name. This is the same as writing

#define name string

at the beginning of the source file.

If you do not specify string, the CMarker gives name a value of 1. This is the same as writing

#define name 1

at the beginning of the source file.

-e

Shows macro expansions in the listing file when you also specify -listing. If you specify -ppout, CMarker assumes this option.

-errors

Does not mark if CMarker detects syntax errors. Severe errors can confuse the CMarker tool, causing it to generate erroneous marker commands. Normally, CMarker generates marker commands regardless of syntax errors.

-ext[ensions] on | off

Controls whether Apple extensions are accepted.

on

Allows Apple extensions (the default). Note that if you choose this option, CMarker sets the value of the macro __STDC__ to 0.

off

Prohibits Apple extensions. If you choose this option, Apple extensions generate syntax errors.

-i[ncludes] directoryPath[,directoryPath]…

Directs MPW to search additional directories for #include files. The maximum number of directories you can specify with this option (or with the {CIncludes} variable) is 15. If the number of directories exceeds this, the compiler returns an error rather than searching.

If the #include file in the source code indicates a full pathname, MPW searches for the file at that address. If the #include file indicates a partial pathname, MPW automatically searches the additional directories in the following order:

1. The current directory.

2. The directory containing the current input file.

3. The directories specified as -i parameters, in the order given.

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

-lang[uage] C | "C++"

Specifies the input source files as being either C or C++.

C

Specifies C source files. By default, CMarker assumes the language is C.

"C++"

Specifies C++ source files. When specifying "C++", be sure to use quotation marks.

-linesize n

Specifies the maximum number of characters generated in a listing line, where n is any number from 60 to 1024. By default, n is 1024.

-l[ist[ing]]

Generates a listing of the source files to standard output, including line number information. If you specify -showskipped, lines that are skipped due to conditionals are also listed.

-mc68881

Defines the macro name mc68881 as TRUE. This is equivalent to writing a #define for this name at the start of each source file or using the -d[efine] option above.

This option provides compatibility with MPW C because the macro it generates can be used in the source files.

-msi

Generates Mark commands for #include (header) files. By default, CMarker does not mark header files.

-pp

Preprocesses only. If you use this option, CMarker does not check syntax or generate Mark commands.

-ppout filename

Writes preprocessor output to the filename file. The output is essentially the same as the output from -listing except that the line number information is removed. This makes it possible to use the output as a source input file to a compiler.

Specifying -ppout implies -e for showing macro expansions.

-p[rogress]

Writes version, progress, and summary information to diagnostic output.

-showskipped

Shows lines skipped due to conditional compilation in the listing output.

-t

Writes the compilation time and number of lines to diagnostic output even if you do not specify progress information (-p).

-u[ndefine] name[,name]…

Undefines the predefined preprocessor symbol name. This is the same as writing

#undef name

at the beginning of the source file. Like the -mc68881 option, this option provides compatibility with MPW C.

EXAMPLES

The following example generates Mark commands for the C++ file DifferentLanguage and its header files unless a syntax error is detected:

CMarker DifferentLanguage -errors -lang "C++" -msi

The example below generates a listing of the source file FullList, showing both macro expansions and lines skipped due to conditional compilation.

CMarker FullList -list -e -showskipped

LIMITATIONS

CMarker contains only a C++ and ANSI C syntax recognizer and preprocessor, not a compiler. Since a compiler has more semantic constraints, a source file that is considered syntactically correct by CMarker may not successfully compile.

Where MPW C and ANSI C differ, the syntax recognizer accepts only ANSI C. Sources containing outdated C syntax will be flagged in error and may confuse CMarker enough to generate several marking errors.

 
 


Last Updated July 2000