srcML v1.0.0 C Documentation

Base Elements XML Element Subelements
comment <comment type="line|block">
<comment type="line" format="doxygen">
<comment type="block" format="doxygen">
literal <literal type="char|number|string">
escape <escape char="0xXX">
name <name>
Statements XML Element Subelements
block <block> <block_content>
break statement <break>
case statement <case> <expr>
continue statement <continue>
default statement <default>
do while statement <do> <block>,<condition>
empty statement <empty_stmt>
expression statement <expr_stmt> <expr>
for statement <for> <control>,<block>
goto statement <goto> <name>
if statement <if_stmt> <if>,<if type="elseif">,<else>
label statement <label> <name>
pseudo block <block type="pseudo"> <block_content>
return statement <return> <expr>
switch statement <switch> <condition>,<block>,<case>,<default>
while statement <while> <condition>,<block>
Statement Subelements XML Element Subelements
block content <block_content>
condition <condition> <expr>
control <control> <init>,<condition>,<incr>
else <else> <block>
else if <if type="elseif"> <condition>,<block>
expression <expr> <name>,<operator>,<call>,<ternary>
if <if> <condition>,<block>
incr <incr> <expr>
then <then> <expr>
type <type> <specifier>,<name>
Specifiers XML Element Subelements
const <specifier>const</specifier>
extern block <extern> <literal type="string">,<function_decl>,<decl_stmt>,<block>
extern specifier <specifier>extern</specifier>
inline <specifier>inline</specifier>
register <specifier>register</specifier>
restrict <specifier>restrict</specifier>
static <specifier>static</specifier>
volatile <specifier>volatile</specifier>
Declarations, Definitions, and Initializations XML Element Subelements
bitfield <range> <expr>
declaration initialization <init>
function <function> <type>,<name>,<parameter_list>,<block>
function declaration <function_decl> <type>,<name>,<parameter_list>
pointer declaration <modifier>
typedef <typedef> <type>,<name>,<function_decl>
variable declaration <decl> <name>,<init>,<index>,<block>
variable declaration statement <decl_stmt> <decl>
Structs, Unions, and Enums XML Element Subelements
enum declaration <enum_decl> <name>
enum definition <enum> <name>,<block>
struct declaration <struct_decl> <name>
struct definition <struct> <name>,<super_list>,<block>
union declaration <union_decl> <name>
union definition <union> <name>,<block>
Expressions XML Element Subelements
function call <call> <name>,<argument_list>
operator <operator>
ternary operator <ternary> <condition>,<then>,<else>
Other XML Element Subelements
_Alignas <alignas>_Alignas()</alignas> <argument_list>
_Alignof <alignof>_Alignof()</alignof> <argument_list>
_Atomic <atomic> <argument_list>
_Generic <generic_selection> <selector>,<association_list>
_Noreturn <specifier>_Noreturn</specifier>
_Static_assert <assert type="static"> <argument_list>
_Thread_local <specifier>_Thread_local</specifier>
asm <asm>
association <association> <type>,<expr>
association_list <association_list> <association>
selector <selector> <expr>
sizeof <sizeof> <argument_list>
OpenMP XML Element Subelements
omp:argument <omp:argument> <omp:expr>
omp:argument_list <omp:argument_list> <omp:argument>
omp:clause <omp:clause> <omp:name>,<omp:argument_list>
omp:directive <omp:directive> <omp:name>,<omp:clause>
omp:expr <omp:expr>
omp:name <omp:name>
C Preprocessor XML Element Subelements
# <cpp:empty>
#define <cpp:define> <cpp:directive>,<cpp:macro>,<cpp:value>
#elif <cpp:elif> <cpp:directive>,<expr>
#else <cpp:else> <cpp:directive>
#endif <cpp:endif> <cpp:directive>
#error <cpp:error> <cpp:directive>,<cpp:literal>
#if <cpp:if> <cpp:directive>,<expr>
#ifdef <cpp:ifdef> <cpp:directive>,<name>
#ifndef <cpp:ifndef> <cpp:directive>,<name>
#include <cpp:include> <cpp:directive>,<cpp:file>
#line <cpp:line> <cpp:directive>,<cpp:number>,<cpp:file>
#pragma <cpp:pragma> <cpp:directive>,<name>
#undef <cpp:undef> <cpp:directive>,<name>
#warning <cpp:warning> <cpp:directive>,<cpp:literal>
cpp:directive <cpp:directive>
cpp:file <cpp:file>
cpp:literal <cpp:literal>
cpp:macro <cpp:macro> <name>
cpp:number <cpp:number>
cpp:value <cpp:value>

line comment


Element

  • <comment type="line">// ...</comment>

XPath

  • comments

    //src:comment
  • line comments

    //src:comment[@type='line']

Example

// line
<comment type="line">// line</comment>

block comment


Element

  • <comment type="block">/* ... */</comment>

XPath

  • comments

    //src:comment
  • block comments

    //src:comment[@type='block']

Example

/*
    block
*/
<comment type="block">/*
    block
*/</comment>

doxygen line comment


Element

  • <comment type="line" format="doxygen">/// ...</comment>

XPath

  • comments

    //src:comment
  • doxygen comments

    //src:comment[@format='doxygen']

doxygen block comment


Element

  • <comment type="block" format="doxygen">/** ... */</comment>

XPath

  • comments

    //src:comment
  • doxygen comments

    //src:comment[@format='doxygen']

Example

/**
 * doxygen comment
 */
/*!
 * text
 */
<comment type="block" format="doxygen">/**
 * doxygen comment
 */</comment>
<comment type="block" format="doxygen">/*!
 * text
 */</comment>

number literal


Element

  • <literal type="number">123</literal>

XPath

  • number literals

    //src:literal[@type='number']

character literal


Element

  • <literal type="char">'x'</literal>

XPath

srcQL

  • character literals

    //src:literal[@type='char']
  • expressions that contain character literals

    FIND '$T'
  • expression statements that contain character literals

    FIND '$T';

string literal


Element

  • <literal type="string">"Hello"</literal>

XPath

srcQL

  • string literals

    //src:literal[@type='string']
  • expressions that contain string literals

    FIND "$T"
  • expression statements that contain string literals

    FIND "$T";
  • expressions that contain string literals which start with “x”

    FIND "x$T"

name


Element

  • <name>

XPath

srcQL

  • All names (i.e., identifiers)

    //src:name
  • expressions and declarations that contain x as a name

    FIND x
  • all expressions that contain a name and all declarations

    FIND $T

if statement


Element

  • <if_stmt>

Subelements

  • <if>
  • <if type="elseif">
  • <else>

XPath

srcQL

  • if conditions

    //src:if/src:condition
  • then

    //src:if/src:block
  • else

    //src:else/src:block
  • if statements without an else

    //src:if_stmt[not(src:else)]
  • else if

    //src:if[@type='elseif']
  • First if in a nested if statement

    //src:if_stmt/src:if[1]
  • Second if in a nested if statement

    //src:if_stmt/src:if[2]
  • Last if in a nested if statement

    //src:if_stmt/src:if[last()]
  • if statements

    FIND if () {}
  • if statements that contain an else if

    FIND else if() {}
  • if statements that contain an else

    FIND else {}

Examples

if then

if (A)
    B;
<if_stmt><if>if <condition>(<expr><name>A</name></expr>)</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>B</name></expr>;</expr_stmt></block_content></block></if></if_stmt>

if then else

if (A)
    B;
else
    C;
<if_stmt><if>if <condition>(<expr><name>A</name></expr>)</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>B</name></expr>;</expr_stmt></block_content></block></if>
<else>else<block type="pseudo"><block_content>
    <expr_stmt><expr><name>C</name></expr>;</expr_stmt></block_content></block></else></if_stmt>

if then elseif

if (A)
    B;
else if (A2)
    C;
else
    D:
<if_stmt><if>if <condition>(<expr><name>A</name></expr>)</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>B</name></expr>;</expr_stmt></block_content></block></if>
<if type="elseif">else if <condition>(<expr><name>A2</name></expr>)</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>C</name></expr>;</expr_stmt></block_content></block></if>
<else>else<block type="pseudo"><block_content>
    <label><name>D</name>:</label></block_content></block></else></if_stmt>
if(x > 5)
    y+=4;
<if_stmt><if>if<condition>(<expr><name>x</name> <operator>&gt;</operator> <literal type="number">5</literal></expr>)</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>y</name><operator>+=</operator><literal type="number">4</literal></expr>;</expr_stmt></block_content></block></if></if_stmt>
if ( i > 0 ) {
    y = x / i;
}
<if_stmt><if>if <condition>( <expr><name>i</name> <operator>&gt;</operator> <literal type="number">0</literal></expr> )</condition> <block>{<block_content>
    <expr_stmt><expr><name>y</name> <operator>=</operator> <name>x</name> <operator>/</operator> <name>i</name></expr>;</expr_stmt>
</block_content>}</block></if></if_stmt>
if ( i > 0 )
    y = x / i;
else {
    x = i;
    y = f( x );
}
<if_stmt><if>if <condition>( <expr><name>i</name> <operator>&gt;</operator> <literal type="number">0</literal></expr> )</condition><block type="pseudo"><block_content>
    <expr_stmt><expr><name>y</name> <operator>=</operator> <name>x</name> <operator>/</operator> <name>i</name></expr>;</expr_stmt></block_content></block></if>
<else>else <block>{<block_content>
    <expr_stmt><expr><name>x</name> <operator>=</operator> <name>i</name></expr>;</expr_stmt>
    <expr_stmt><expr><name>y</name> <operator>=</operator> <call><name>f</name><argument_list>( <argument><expr><name>x</name></expr></argument> )</argument_list></call></expr>;</expr_stmt>
</block_content>}</block></else></if_stmt>

Without braces

if ( i > 0 )
    if ( j > i )
        x = j;
    else
        x = i;
<if_stmt><if>if <condition>( <expr><name>i</name> <operator>&gt;</operator> <literal type="number">0</literal></expr> )</condition><block type="pseudo"><block_content>
    <if_stmt><if>if <condition>( <expr><name>j</name> <operator>&gt;</operator> <name>i</name></expr> )</condition><block type="pseudo"><block_content>
        <expr_stmt><expr><name>x</name> <operator>=</operator> <name>j</name></expr>;</expr_stmt></block_content></block></if>
    <else>else<block type="pseudo"><block_content>
        <expr_stmt><expr><name>x</name> <operator>=</operator> <name>i</name></expr>;</expr_stmt></block_content></block></else></if_stmt></block_content></block></if></if_stmt>

With braces

if ( i > 0 ) {
    if ( j > i )
        x = j;
}
else
    x = i;
<if_stmt><if>if <condition>( <expr><name>i</name> <operator>&gt;</operator> <literal type="number">0</literal></expr> )</condition> <block>{<block_content>
    <if_stmt><if>if <condition>( <expr><name>j</name> <operator>&gt;</operator> <name>i</name></expr> )</condition><block type="pseudo"><block_content>
        <expr_stmt><expr><name>x</name> <operator>=</operator> <name>j</name></expr>;</expr_stmt></block_content></block></if></if_stmt>
</block_content>}</block></if>
<else>else<block type="pseudo"><block_content>
    <expr_stmt><expr><name>x</name> <operator>=</operator> <name>i</name></expr>;</expr_stmt></block_content></block></else></if_stmt>
if ( i > 0 ) {
 	x = i;
}
else if( i < 0)
	x = q;
else
    x = j;
<if_stmt><if>if <condition>( <expr><name>i</name> <operator>&gt;</operator> <literal type="number">0</literal></expr> )</condition> <block>{<block_content>
 	<expr_stmt><expr><name>x</name> <operator>=</operator> <name>i</name></expr>;</expr_stmt>
</block_content>}</block></if>
<if type="elseif">else if<condition>( <expr><name>i</name> <operator>&lt;</operator> <literal type="number">0</literal></expr>)</condition><block type="pseudo"><block_content>
	<expr_stmt><expr><name>x</name> <operator>=</operator> <name>q</name></expr>;</expr_stmt></block_content></block></if>
<else>else<block type="pseudo"><block_content>
    <expr_stmt><expr><name>x</name> <operator>=</operator> <name>j</name></expr>;</expr_stmt></block_content></block></else></if_stmt>

while statement


Element

  • <while>

Subelements

  • <condition>
  • <block>

XPath

srcQL

  • while loops

    //src:while
  • while-loop conditions

    //src:while/src:condition
  • while loops with a condition containing the variable i

    //src:while[src:condition//src:name='i']
  • while loops

    FIND while () {}
  • while loops with a condition containing the variable i

    FIND while (i) {}
  • while loops with a condition containing the == operator

    FIND while (==) {}

for statement


Element

  • <for>

Subelements

  • <control>
  • <block>

XPath

srcQL

  • for loops

    //src:for
  • for-loop initialization statements

    //src:for/src:control/src:init
  • for-loop conditions

    //src:for/src:control/src:condition
  • for-loop increments

    //src:for/src:control/src:incr
  • for loops that declare a variable with a single character name (e.g. x, i or y)

    //src:for[string-length(src:control/src:init/src:decl/src:name)=1]
  • for loops with post-increment in the increment expression

    //src:for[src:control/src:incr/src:expr//following-sibling::src:operator='++']
  • for loops (currently doesn’t work)

    FIND for () {}
  • for loops with an increment operator in the increment expression

    FIND for (;;++) {}
  • for loops with post-increment in the increment expression

    FIND for (;;$T++) {}
  • for loops with pre-increment in the increment expression

    FIND for (;;++$T) {}
  • for loops with less than in the condition

    FIND for (;<;) {}
  • FIND for ($T;$T;$T) {}

Examples

for( ;; ) { }
<for>for<control>( <init>;</init><condition>;</condition> <incr/>)</control> <block>{<block_content> </block_content>}</block></for>
for (i = 0; i < max; i++ ) {
    if ( line[i] == ' ' ) {
        space++;
    }
    if ( line[i] == '\t' ) {
        tab++;
    }
}
<for>for <control>(<init><expr><name>i</name> <operator>=</operator> <literal type="number">0</literal></expr>;</init> <condition><expr><name>i</name> <operator>&lt;</operator> <name>max</name></expr>;</condition> <incr><expr><name>i</name><operator>++</operator></expr></incr> )</control> <block>{<block_content>
    <if_stmt><if>if <condition>( <expr><name><name>line</name><index>[<expr><name>i</name></expr>]</index></name> <operator>==</operator> <literal type="char">' '</literal></expr> )</condition> <block>{<block_content>
        <expr_stmt><expr><name>space</name><operator>++</operator></expr>;</expr_stmt>
    </block_content>}</block></if></if_stmt>
    <if_stmt><if>if <condition>( <expr><name><name>line</name><index>[<expr><name>i</name></expr>]</index></name> <operator>==</operator> <literal type="char">'\t'</literal></expr> )</condition> <block>{<block_content>
        <expr_stmt><expr><name>tab</name><operator>++</operator></expr>;</expr_stmt>
    </block_content>}</block></if></if_stmt>
</block_content>}</block></for>
for (int i = 0; i < 10; ++i)
    a += x[i];
<for>for <control>(<init><decl><type><name>int</name></type> <name>i</name> <init>= <expr><literal type="number">0</literal></expr></init></decl>;</init> <condition><expr><name>i</name> <operator>&lt;</operator> <literal type="number">10</literal></expr>;</condition> <incr><expr><operator>++</operator><name>i</name></expr></incr>)</control><block type="pseudo"><block_content>
    <expr_stmt><expr><name>a</name> <operator>+=</operator> <name><name>x</name><index>[<expr><name>i</name></expr>]</index></name></expr>;</expr_stmt></block_content></block></for>

Empty for statement

for (auto  p = v.begin(); p != v.end() && *p != 0; ++p)
    ;
<for>for <control>(<init><decl><type><name>auto</name></type>  <name>p</name> <init>= <expr><call><name><name>v</name><operator>.</operator><name>begin</name></name><argument_list>()</argument_list></call></expr></init></decl>;</init> <condition><expr><name>p</name> <operator>!=</operator> <call><name><name>v</name><operator>.</operator><name>end</name></name><argument_list>()</argument_list></call> <operator>&amp;&amp;</operator> <operator>*</operator><name>p</name> <operator>!=</operator> <literal type="number">0</literal></expr>;</condition> <incr><expr><operator>++</operator><name>p</name></expr></incr>)</control><block type="pseudo"><block_content>
    <empty_stmt>;</empty_stmt></block_content></block></for>

do while statement


Element

  • <do>

Subelements

  • <block>
  • <condition>

XPath

srcQL

  • do-while loops

    //src:do
  • do-while loops with a condition containing the variable counter

    //src:do[src:condition//src:name='counter']
  • do-while loops

    FIND do {} while ()
  • do-while loops with a condition containing the variable counter

    FIND do {} while (counter)

break statement


Element

  • <break>

XPath

srcQL

  • break statements

    //src:break
  • break statements in for loops

    //src:for//src:break
  • for loops with break statements

    //src:for[.//src:break]
  • break statements

    FIND break
  • break statements in for loops

    FIND break WITHIN for(){}
  • for loops with break statements

    FIND for(){} CONTAINS break
  • for loops with break statements inside an if

    FIND for(){} CONTAINS if() { break }

continue statement


Element

  • <continue>

XPath

srcQL

  • continue statements

    //src:continue
  • continue statements

    FIND continue
  • for loops with continue statements

    FIND continue WITHIN for(){}
  • for loops with continue statements

    FIND for(){} CONTAINS continue
  • for loops with continue statements inside an if

    FIND for(){} CONTAINS if() { continue }

return statement


Element

  • <return>

Subelement

  • <expr>

XPath

srcQL

  • return statements

    //src:return
  • return expressions

    //src:return/src:expr
  • return statements that return true

    //src:return[src:expr='true']
  • functions with more then one return

    //src:function[count(.//src:return)>1]
  • return statements

    FIND return
  • return statements that return a value

    FIND return $E
  • return statements that return true

    FIND return true
  • functions with more than one return

    FIND $TYPE $FNAME() {} WHERE COUNT(return) > 1
  • return statements that return an integer

    FIND return WITHIN int $FNAME() {}
  • return statements that return the value of a call

    FIND return $CALL()

switch statement


Element

  • <switch>

Subelements

  • <condition>
  • <block>
  • <case>
  • <default>

XPath

srcQL

  • switch statements

    //src:switch
  • switch-statement conditions

    //src:switch/src:condition
  • switch statements

    FIND switch () {}
  • switch statements that have a default

    FIND switch () { default: }
  • switch statements with calls in the condition

    FIND switch ($CALL()) {}

case statement


Element

  • <case>

Subelement

  • <expr>

XPath

srcQL

  • case labels

    //src:case
  • case labels that use SATURDAY

    //src:case[.//src:name='SATURDAY']
  • switch statements with a case that uses SATURDAY

    //src:switch[src:block/src:block_content/src:case//src:name='SATURDAY']
  • case labels

    FIND case :
  • case labels that use SATURDAY

    FIND case SATURDAY:
  • case labels that use a character literal

    FIND case '$T':

Examples

case x:
<case>case <expr><name>x</name></expr>:</case>
case SATURDAY:
<case>case <expr><name>SATURDAY</name></expr>:</case>

default statement


Element

  • <default>

XPath

srcQL

  • default labels

    //src:default
  • switch statements with a default label

    //src:switch[src:block/src:block_content/src:default]
  • default labels

    FIND default :
  • switch statements with a default label

    FIND switch () {} CONTAINS default :

Example

default:
<default>default:</default>

block


Element

  • <block>

Subelement

  • <block_content>

XPath

srcQL

  • blocks

    //src:block
  • variable declarations in a block

    //src:block//src:decl_stmt
  • top-level variable declarations in a block

    //src:block/src:block_content/src:decl_stmt
  • blocks

    FIND {}
  • variable declarations in a block

    FIND $TYPE $NAME; WITHIN {}

pseudo block


Element

  • <block type="pseudo">

Subelement

  • <block_content>

XPath

srcQL

  • all pseudo blocks

    //src:block[@type='pseudo']
  • all non pseudo blocks

    //src:block[not(@type='pseudo')]
  • variable declarations in a pseudo block

    //src:block[@type='pseudo']//src:decl_stmt
  • top-level variable declarations in a pseudo block

    //src:block[@type='pseudo']/src:block_content/src:decl_stmt
  • while statements with pseudo blocks

    FIND while()

expression statement


Element

  • <expr_stmt>

Subelement

  • <expr>

XPath

srcQL

  • expression statements

    //src:expr_stmt
  • expression and declaration statements

    FIND $E;
  • assignment expression statements

    FIND $LHS = $RHS;
  • expression statements containing a pre-increment

    FIND ++$E;
  • expression statements containing a call

    FIND $CALL();

label statement


Element

  • <label>

Subelement

  • <name>

XPath

srcQL

  • labels

    //src:label
  • label names

    //src:label/src:name
  • labels with a goto statement

    //src:label[src:name=//src:goto/src:name]
  • labels without a goto statement

    //src:label[not(src:name[.=//src:goto/src:name])]
  • labels

    FIND PATTERN $LABEL:
  • labels named stop

    FIND PATTERN stop:
  • blocks that contain a label and a matching goto statement

    FIND {} CONTAINS PATTERN $LABEL: CONTAINS goto $LABEL;

Example

stop:
<label><name>stop</name>:</label>

goto statement


Element

  • <goto>

Subelement

  • <name>

XPath

srcQL

  • goto statements

    //src:goto
  • goto statements

    FIND goto $LABEL;
  • goto statements that go to a label using stop

    FIND goto stop;

Example

goto stop;
<goto>goto <name>stop</name>;</goto>

empty statement


Element

  • <empty_stmt>

XPath

srcQL

  • empty statements

    //src:empty_stmt
  • empty statements

    FIND ;

condition


Element

  • <condition>

Subelement

  • <expr>

XPath

  • conditions, including ternary conditions

    //src:condition
  • condition expressions

    //src:condition/src:expr
  • if conditions

    //src:if/src:condition
  • while conditions

    //src:while/src:condition
  • do while conditions

    //src:do/src:condition
  • ternary conditions

    //src:ternary/src:condition

type


Element

  • <type>

Subelements

  • <specifier>
  • <name>

XPath

srcQL

  • types

    //src:type
  • declaration types

    //src:decl/src:type
  • function types

    //src:function/src:type
  • function declaration types

    //src:function_decl/src:type
  • declaration statements that use any type

    FIND $TYPE $VAR;
  • integer declaration statements

    FIND int $VAR;
  • function definitions that use any type

    FIND $TYPE $FUNC() {}
  • integer function definitions

    FIND int $FUNC() {}

block content


Element

  • <block_content>

XPath

  • block contents

    //src:block_content
  • declaration block_contents

    //src:decl/src:block/src:block_content
  • function block_contents

    //src:function/src:block/src:block_content

expression


Element

  • <expr>

Subelements

  • <name>
  • <operator>
  • <call>
  • <ternary>

XPath

srcQL

  • expressions

    //src:expr
  • array indexes

    //src:index
  • array index expressions

    //src:index/src:expr
  • expressions and declarations

    FIND $E
  • expressions and declarations which use x

    FIND x
  • expressions that use the + operator

    FIND +
  • expressions which contain a string literal

    FIND "$T"
  • expressions which contain a call

    FIND $CALL()

const


Element

  • <specifier>const</specifier>

XPath

srcQL

  • const variables

    //src:decl[src:type/src:specifier='const']
  • function declarations with a const return type

    //src:function_decl[src:type/src:specifier='const']
  • const variables

    FIND const $TYPE $VAR
  • function declarations with a const return type

    FIND const $TYPE $FUNC();

static


Element

  • <specifier>static</specifier>

XPath

srcQL

  • static variables

    //src:decl[src:type/src:specifier='static']
  • static function declarations

    //src:function_decl[src:type/src:specifier='static']
  • static variables

    FIND static $TYPE $VAR
  • static function declarations

    FIND static $TYPE $FUNC();

inline


Element

  • <specifier>inline</specifier>

XPath

srcQL

  • inline function declarations

    //src:function_decl[src:type/src:specifier='inline']
  • inline function declarations

    FIND inline $TYPE $FUNC();

volatile


Element

  • <specifier>volatile</specifier>

XPath

srcQL

  • volatile variables

    //src:decl[src:type/src:specifier='volatile']
  • volatile variables

    FIND volatile $TYPE $VAR

restrict


Element

  • <specifier>restrict</specifier>

XPath

srcQL

  • variables declarations with the restrict specifier

    //src:decl[src:type/src:specifier='restrict']
  • variables declarations with the restrict specifier

    FIND restrict $TYPE $VAR

register


Element

  • <specifier>register</specifier>

XPath

srcQL

  • variable declarations with the register specifier

    //src:decl[src:type/src:specifier='register']
  • variable declarations with the register specifier

    FIND register $TYPE $VAR

extern block


Element

  • <extern>

Subelements

  • <literal type="string">
  • <function_decl>
  • <decl_stmt>
  • <block>

XPath

srcQL

  • extern blocks

    //src:extern
  • extern blocks

    FIND extern

extern specifier


Element

  • <specifier>extern</specifier>

XPath

srcQL

  • extern variables

    //src:decl[src:type/src:specifier='extern']
  • extern function declarations

    //src:function_decl[src:type/src:specifier='extern']
  • extern variables

    FIND extern $TYPE $VAR
  • extern function declarations

    FIND extern $TYPE $FNAME();

variable declaration statement


Element

  • <decl_stmt>

Subelement

  • <decl>

XPath

srcQL

  • declaration statements

    //src:decl_stmt
  • variable declaration statements with the union qualifier

    //src:decl_stmt/src:decl[contains(src:type,'union')]
  • expression and declaration statements

    FIND $T;
  • declaration statements

    FIND $TYPE $VAR;
  • struct declaration statements

    FIND struct $TYPE $VAR;
  • declaration statements with an initialization

    FIND $TYPE $VAR = $X;

variable declaration


Element

  • <decl>

Subelements

  • <name>
  • <init>
  • <index>
  • <block>

XPath

srcQL

  • variable declarations

    //src:decl
  • variable declarations with an initialization

    //src:decl[src:init]
  • variable declarations with the struct qualifier

    //src:decl[src:type/src:name/src:name='struct']
  • array declarations

    //src:decl[src:name/src:index]
  • array declarations where the number of elements is less than 50

    //src:decl[number(src:name/src:index/src:literal)<50]
  • struct declarations with an initialization

    //src:decl[src:init/src:expr/src:block]
  • expressions and declarations

    FIND $T
  • variable declarations

    FIND $TYPE $VAR
  • variable declarations with an initialization

    FIND $TYPE $VAR = $X
  • variable declarations with the struct qualifier

    FIND struct $TYPE $VAR
  • array declarations

    FIND $TYPE $VAR[]
  • declarations with an initialization

    FIND $TYPE $VAR = {}

Examples

int x;
<decl_stmt><decl><type><name>int</name></type> <name>x</name></decl>;</decl_stmt>
int a = 5;
<decl_stmt><decl><type><name>int</name></type> <name>a</name> <init>= <expr><literal type="number">5</literal></expr></init></decl>;</decl_stmt>
char A[2];
<decl_stmt><decl><type><name>char</name></type> <name><name>A</name><index>[<expr><literal type="number">2</literal></expr>]</index></name></decl>;</decl_stmt>
float matrix[10][15];
<decl_stmt><decl><type><name>float</name></type> <name><name>matrix</name><index>[<expr><literal type="number">10</literal></expr>]</index><index>[<expr><literal type="number">15</literal></expr>]</index></name></decl>;</decl_stmt>
extern char *name[];
<decl_stmt><decl><type><specifier>extern</specifier> <name>char</name> <modifier>*</modifier></type><name><name>name</name><index>[]</index></name></decl>;</decl_stmt>
struct {
    float x, y;
} complex[100];
<struct>struct <block>{
    <decl_stmt><decl><type><name>float</name></type> <name>x</name></decl>, <decl><type ref="prev"/><name>y</name></decl>;</decl_stmt>
}</block> <decl><name><name>complex</name><index>[<expr><literal type="number">100</literal></expr>]</index></name></decl>;</struct>

struct declarations

struct X y;
<decl_stmt><decl><type><name><name>struct</name> <name>X</name></name></type> <name>y</name></decl>;</decl_stmt>

struct initializations

MY_TYPE a = { false, 234, 1.234 };
<decl_stmt><decl><type><name>MY_TYPE</name></type> <name>a</name> <init>= <expr><block>{ <expr><name>false</name></expr>, <expr><literal type="number">234</literal></expr>, <expr><literal type="number">1.234</literal></expr> }</block></expr></init></decl>;</decl_stmt>
MY_TYPE b = (MY_TYPE) { false, 234, 1.234 };
<decl_stmt><decl><type><name>MY_TYPE</name></type> <name>b</name> <init>= <expr><operator>(</operator><name>MY_TYPE</name><operator>)</operator> <block>{ <expr><name>false</name></expr>, <expr><literal type="number">234</literal></expr>, <expr><literal type="number">1.234</literal></expr> }</block></expr></init></decl>;</decl_stmt>
MY_TYPE c = { .flag = true, .value = 123, .stuff = 0.456 };
<decl_stmt><decl><type><name>MY_TYPE</name></type> <name>c</name> <init>= <expr><block>{ <expr><operator>.</operator><name>flag</name> <operator>=</operator> <name>true</name></expr>, <expr><operator>.</operator><name>value</name> <operator>=</operator> <literal type="number">123</literal></expr>, <expr><operator>.</operator><name>stuff</name> <operator>=</operator> <literal type="number">0.456</literal></expr> }</block></expr></init></decl>;</decl_stmt>

function declaration


Element

  • <function_decl>

Subelements

  • <type>
  • <name>
  • <parameter_list>

XPath

srcQL

  • function declarations

    //src:function_decl
  • function-declaration return types

    //src:function_decl/src:type
  • function-declaration parameters

    //src:function_decl/src:parameter_list/src:parameter
  • function declarations with only two parameters

    //src:function_decl[count(src:parameter_list/src:parameter)=2]
  • function declaration names

    //src:function_decl/src:name
  • function declarations

    FIND $TYPE $FNAME();
  • function declarations with at least two parameters

    FIND $TYPE $FNAME($PTYPE1 $PNAME1,$PTYPE2 $PNAME2);
  • function declarations with only two parameters

    FIND $TYPE $FNAME(); WHERE count(src:parameter) = 2

function


Element

  • <function>

Subelements

  • <type>
  • <name>
  • <parameter_list>
  • <block>

XPath

srcQL

  • function definitions

    //src:function
  • function-definition return types

    //src:function/src:type
  • function-definition parameters

    //src:function/src:parameter_list/src:parameter
  • function definitions with only two parameters

    //src:function[count(src:parameter_list/src:parameter)=2]
  • function-definition names

    //src:function/src:name
  • function definitions that have variadic arguments

    //src:function[src:parameter_list/src:parameter/src:decl/src:type/src:modifier='...']
  • K & R function definitions

    //src:function[src:decl_stmt]
  • function definitions

    FIND $TYPE $FNAME() {}
  • function definitions with at least two parameters

    FIND $TYPE $FNAME($PTYPE1 $PNAME1,$PTYPE2 $PNAME2) {}
  • function definitions with only two parameters

    FIND $TYPE $FNAME() {} WHERE COUNT(src:parameter) = 2

Examples

struct STUDENT sortstu( STUDENT a, STUDENT b ) {
    struct STUDENT x;
    return x;
}
<function><type><name><name>struct</name> <name>STUDENT</name></name></type> <name>sortstu</name><parameter_list>( <parameter><decl><type><name>STUDENT</name></type> <name>a</name></decl></parameter>, <parameter><decl><type><name>STUDENT</name></type> <name>b</name></decl></parameter> )</parameter_list> <block>{<block_content>
    <decl_stmt><decl><type><name><name>struct</name> <name>STUDENT</name></name></type> <name>x</name></decl>;</decl_stmt>
    <return>return <expr><name>x</name></expr>;</return>
</block_content>}</block></function>
void print(STUDENT a) { }
<function><type><name>void</name></type> <name>print</name><parameter_list>(<parameter><decl><type><name>STUDENT</name></type> <name>a</name></decl></parameter>)</parameter_list> <block>{<block_content> </block_content>}</block></function>
void foo (int a[]) { } 
<function><type><name>void</name></type> <name>foo</name> <parameter_list>(<parameter><decl><type><name>int</name></type> <name><name>a</name><index>[]</index></name></decl></parameter>)</parameter_list> <block>{<block_content> </block_content>}</block></function> 
void foo (int* a) { }
<function><type><name>void</name></type> <name>foo</name> <parameter_list>(<parameter><decl><type><name>int</name><modifier>*</modifier></type> <name>a</name></decl></parameter>)</parameter_list> <block>{<block_content> </block_content>}</block></function>
int add_multiple_values (int number, ...) { }
<function><type><name>int</name></type> <name>add_multiple_values</name> <parameter_list>(<parameter><decl><type><name>int</name></type> <name>number</name></decl></parameter>, <parameter><decl><type><modifier>...</modifier></type></decl></parameter>)</parameter_list> <block>{<block_content> </block_content>}</block></function>
int func(a, b, c)
   int a;
   int b;
   int c;
{ }
<function><type><name>int</name></type> <name>func</name><parameter_list>(<parameter><decl><type><name>a</name></type></decl></parameter>, <parameter><decl><type><name>b</name></type></decl></parameter>, <parameter><decl><type><name>c</name></type></decl></parameter>)</parameter_list>
   <decl_stmt><decl><type><name>int</name></type> <name>a</name></decl>;</decl_stmt>
   <decl_stmt><decl><type><name>int</name></type> <name>b</name></decl>;</decl_stmt>
   <decl_stmt><decl><type><name>int</name></type> <name>c</name></decl>;</decl_stmt>
<block>{<block_content> </block_content>}</block></function>

typedef


Element

  • <typedef>

Subelements

  • <type>
  • <name>
  • <function_decl>

XPath

srcQL

  • typedefs

    //src:typedef
  • types in typedefs

    //src:typedef/src:type
  • typedef names

    //src:typedef/src:name
  • typedefs that define a struct

    //src:typedef[src:type/src:struct]
  • typedefs that declare a function type

    //src:typedef[src:function_decl]
  • typedefs of function pointers

    //src:typedef[contains(src:function_decl,')')]
  • names of typedefs of function pointers

    //src:typedef/src:function_decl[contains(.,')')]/src:name
  • typedefs

    FIND typedef
  • typedefs that define a struct

    FIND typedef struct {}
  • typedefs that declare a function type

    FIND typedef $TYPE $FNAME();
  • typedefs of function pointers

    FIND typedef $TYPE (*$FNAME)();

Examples

typedef char C;
typedef unsigned int WORD;
typedef char * pChar;
typedef char field [50]; 
typedef char field, *field2; 
<typedef>typedef <type><name>char</name></type> <name>C</name>;</typedef>
<typedef>typedef <type><name>unsigned</name> <name>int</name></type> <name>WORD</name>;</typedef>
<typedef>typedef <type><name>char</name> <modifier>*</modifier></type> <name>pChar</name>;</typedef>
<typedef>typedef <type><name>char</name></type> <name><name>field</name> <index>[<expr><literal type="number">50</literal></expr>]</index></name>;</typedef> 
<typedef>typedef <type><name>char</name></type> <name>field</name>, <modifier>*</modifier><name>field2</name>;</typedef> 
typedef struct club {
    char name[30];
    int size, year;
} GROUP;
<typedef>typedef <type><struct>struct <name>club</name> <block>{
    <decl_stmt><decl><type><name>char</name></type> <name><name>name</name><index>[<expr><literal type="number">30</literal></expr>]</index></name></decl>;</decl_stmt>
    <decl_stmt><decl><type><name>int</name></type> <name>size</name></decl>, <decl><type ref="prev"/><name>year</name></decl>;</decl_stmt>
}</block></struct></type> <name>GROUP</name>;</typedef>
typedef void DRAWF( int, int );
<typedef>typedef <function_decl><type><name>void</name></type> <name>DRAWF</name><parameter_list>( <parameter><decl><type><name>int</name></type></decl></parameter>, <parameter><decl><type><name>int</name></type></decl></parameter> )</parameter_list>;</function_decl></typedef>
typedef void (*DRAWF)( int, int );
<typedef>typedef <function_decl><type><name>void</name></type> (<modifier>*</modifier><name>DRAWF</name>)<parameter_list>( <parameter><decl><type><name>int</name></type></decl></parameter>, <parameter><decl><type><name>int</name></type></decl></parameter> )</parameter_list>;</function_decl></typedef>

pointer declaration


Element

  • <modifier>

XPath

srcQL

  • declarations of pointers

    //src:decl[src:type/src:modifier='*']
  • function pointers

    //src:function_decl[contains(.,')')]
  • declarations of pointers

    FIND $TYPE* $NAME
  • function pointers

    FIND $TYPE (*$FNAME)();

Examples

char *message;
<decl_stmt><decl><type><name>char</name> <modifier>*</modifier></type><name>message</name></decl>;</decl_stmt>
int *pointers[10];
<decl_stmt><decl><type><name>int</name> <modifier>*</modifier></type><name><name>pointers</name><index>[<expr><literal type="number">10</literal></expr>]</index></name></decl>;</decl_stmt>
int (*pointer)[10];
<expr_stmt><expr><call><name>int</name> <argument_list>(<argument><expr><operator>*</operator><name>pointer</name></expr></argument>)</argument_list></call><index>[<expr><literal type="number">10</literal></expr>]</index></expr>;</expr_stmt>
int const *x;
<decl_stmt><decl><type><name>int</name> <specifier>const</specifier> <modifier>*</modifier></type><name>x</name></decl>;</decl_stmt>
int(*X)(void);
int(*X)(int, float);
int(*X)(char const*,...);
<function_decl><type><name>int</name></type>(<modifier>*</modifier><name>X</name>)<parameter_list>(<parameter><decl><type><name>void</name></type></decl></parameter>)</parameter_list>;</function_decl>
<function_decl><type><name>int</name></type>(<modifier>*</modifier><name>X</name>)<parameter_list>(<parameter><decl><type><name>int</name></type></decl></parameter>, <parameter><decl><type><name>float</name></type></decl></parameter>)</parameter_list>;</function_decl>
<function_decl><type><name>int</name></type>(<modifier>*</modifier><name>X</name>)<parameter_list>(<parameter><decl><type><name>char</name> <specifier>const</specifier><modifier>*</modifier></type></decl></parameter>,<parameter><decl><type><modifier>...</modifier></type></decl></parameter>)</parameter_list>;</function_decl>
int volatile *const z = &some_object;
<decl_stmt><decl><type><name>int</name> <specifier>volatile</specifier> <modifier>*</modifier><specifier>const</specifier></type> <name>z</name> <init>= <expr><operator>&amp;</operator><name>some_object</name></expr></init></decl>;</decl_stmt>
int *const volatile w = &some_object;
<decl_stmt><decl><type><name>int</name> <modifier>*</modifier><specifier>const</specifier> <specifier>volatile</specifier></type> <name>w</name> <init>= <expr><operator>&amp;</operator><name>some_object</name></expr></init></decl>;</decl_stmt>

declaration initialization


Element

  • <init>

XPath

srcQL

  • //src:init
  • array declarations with an initialization

    //src:decl[src:name/src:index][src:init]
  • declarations with an initialization

    FIND $TYPE $VAR = $INIT
  • array declarations with an initialization

    FIND $TYPE $VAR[] = $INIT
  • array declarations with array initialization

    FIND $TYPE $VAR[] = {}

bitfield


Element

  • <range>

Subelement

  • <expr>

XPath

srcQL

  • bitfield declarations

    //src:decl[src:range]
  • bitfield declarations

    FIND $TYPE $VAR : $RANGE

struct declaration


Element

  • <struct_decl>

Subelement

  • <name>

XPath

srcQL

  • forward struct declarations

    //src:struct_decl
  • forward struct declarations

    FIND struct $STR;

Example

forward declaration

struct employee;
<struct_decl>struct <name>employee</name>;</struct_decl>

struct definition


Element

  • <struct>

Subelements

  • <name>
  • <super_list>
  • <block>

XPath

srcQL

  • struct definitions

    //src:struct
  • struct members

    //src:struct/src:block/*[self::src:public|self::src:private|self::src:protected]/src:decl_stmt
  • struct definitions

    FIND struct {};
  • struct members

    FIND $TYPE $VAR; WITHIN struct {};

union declaration


Element

  • <union_decl>

Subelement

  • <name>

XPath

srcQL

  • forward declarations for unions

    //src:union_decl
  • forward declarations for unions

    FIND union $UNI;

Example

union X;
<union_decl>union <name>X</name>;</union_decl>

union definition


Element

  • <union>

Subelements

  • <name>
  • <block>

XPath

srcQL

  • union definitions

    //src:union
  • union definitions

    FIND union {};

enum definition


Element

  • <enum>

Subelements

  • <name>
  • <block>

XPath

srcQL

  • enum definitions

    //src:enum
  • names of members of enums

    //src:enum/src:block/src:decl/src:name
  • enum definitions

    FIND enum {};

enum declaration


Element

  • <enum_decl>

Subelement

  • <name>

XPath

srcQL

  • enum declarations

    //src:enum_decl
  • names of enum declarations

    //src:enum_decl/src:name
  • enum declarations

    FIND enum $ENUM;

Example

enum DAY;
<enum_decl>enum <name>DAY</name>;</enum_decl>

function call


Element

  • <call>

Subelements

  • <name>
  • <argument_list>

XPath

srcQL

  • function calls

    //src:call
  • expressions with function calls

    FIND $CALL()
  • declarations initialized to a function call

    FIND $TYPE $VAR = $CALL()

ternary operator


Element

  • <ternary>

Subelements

  • <condition>
  • <then>
  • <else>

XPath

srcQL

  • ternary operators

    //src:ternary
  • expressions which contain a ternary

    FIND $X ? :

operator


Element

  • <operator>

XPath

srcQL

  • uses of the -> operator

    //src:operator[.='->']
  • uses of the . operator

    //src:operator[.='.']
  • expressions which use the -> operator

    FIND ->
  • expressions which use the . operator

    FIND .

sizeof


Element

  • <sizeof>

Subelement

  • <argument_list>

XPath

srcQL

  • uses of sizeof

    //src:sizeof
  • expression statements which use sizeof

    sizeof();

_Alignof


Element

  • <alignof>_Alignof()</alignof>

Subelement

  • <argument_list>

XPath

srcQL

  • uses of _Alignof

    //src:alignof
  • expression statements which use _Alignof

    _Alignof();

_Generic


Element

  • <generic_selection>

Subelements

  • <selector>
  • <association_list>

XPath

srcQL

  • uses of _Generic

    //src:generic_selection
  • expression statements which use _Generic

    _Generic ($E,);

_Static_assert


Element

  • <assert type="static">

Subelement

  • <argument_list>

XPath

srcQL

  • uses of _Static_assert

    //src:assert[@type ='static']
  • uses of static_assert

    _Static_assert()

_Thread_local


Element

  • <specifier>_Thread_local</specifier>

XPath

srcQL

  • uses of _Thread_local

    //src:specifier[.='_Thread_local']
  • _Thread_local variable declarations

    FIND _Thread_local $TYPE $VAR

asm


Element

  • <asm>

XPath

srcQL

  • uses of asm

    //src:asm
  • uses of asm

    asm()

Examples

asm("movl %ebx, %eax");
<asm>asm("movl %ebx, %eax");</asm>
__asm__("movl %ebx, %eax");
<asm>__asm__("movl %ebx, %eax");</asm>
__asm { __asm mov al, 2  __asm mov dx, 0xD007 __asm out dx, al }
<asm>__asm { <asm>__asm mov al, 2</asm>  <asm>__asm mov dx, 0xD007</asm> <asm>__asm out dx, al</asm> }</asm>

omp:directive


Element

  • <omp:directive>

Subelements

  • <omp:name>
  • <omp:clause>

XPath

  • omp directives

    //omp:directive
  • omp directives with the name ‘parallel’

    //omp:directive[omp:name='parallel']

omp:name


Element

  • <omp:name>

XPath

  • omp names

    //omp:name

omp:clause


Element

  • <omp:clause>

Subelements

  • <omp:name>
  • <omp:argument_list>

XPath

  • omp clauses

    //omp:clause

omp:argument_list


Element

  • <omp:argument_list>

Subelement

  • <omp:argument>

XPath

  • omp argument lists

    //omp:argument_list

omp:argument


Element

  • <omp:argument>

Subelement

  • <omp:expr>

XPath

  • omp arguments

    //omp:argument

omp:expr


Element

  • <omp:expr>

XPath

  • omp expressions

    //omp:expr

#define


Element

  • <cpp:define>

Subelements

  • <cpp:directive>
  • <cpp:macro>
  • <cpp:value>

XPath

  • uses of #define

    //cpp:define
  • macro definitions of a macro with the name LENGTH

    //cpp:define[cpp:macro/src:name='LENGTH']
  • macro-definition values

    //cpp:define/cpp:value
  • macro definitions with parameters

    //cpp:define[src:parameter_list]
  • macro-declaration parameter names

    //cpp:define/src:parameter_list/src:parameter
  • variadic macro definitions

    //cpp:define[src:parameter_list//src:modifier='...']

#undef


Element

  • <cpp:undef>

Subelements

  • <cpp:directive>
  • <name>

XPath

  • uses of #undef

    //cpp:undef
  • names of undefined macros

    //cpp:undef/src:name
  • macro names which are both defined and undefined

    //cpp:undef/src:name[.= //cpp:define/src:macro/src:name]

#if


Element

  • <cpp:if>

Subelements

  • <cpp:directive>
  • <expr>

XPath

  • uses of #if

    //cpp:if
  • conditions used by #if

    //cpp:if/src:expr

#ifndef


Element

  • <cpp:ifndef>

Subelements

  • <cpp:directive>
  • <name>

XPath

  • uses of #ifndef

    //cpp:ifndef

#endif


Element

  • <cpp:endif>

Subelement

  • <cpp:directive>

XPath

  • uses of #endif

    //cpp:endif

#include


Element

  • <cpp:include>

Subelements

  • <cpp:directive>
  • <cpp:file>

XPath

  • includes

    //cpp:include
  • Names of all included files

    //cpp:include/cpp:file

#pragma


Element

  • <cpp:pragma>

Subelements

  • <cpp:directive>
  • <name>

XPath

  • uses of #pragma

    //cpp:pragma

#error


Element

  • <cpp:error>

Subelements

  • <cpp:directive>
  • <cpp:literal>

XPath

  • uses of #error

    //cpp:error

#warning


Element

  • <cpp:warning>

Subelements

  • <cpp:directive>
  • <cpp:literal>

XPath

  • uses of #warning

    //cpp:warning

Examples

#warning
<cpp:warning>#<cpp:directive>warning</cpp:directive></cpp:warning>
#warning "Feature not yet supported"
<cpp:warning>#<cpp:directive>warning</cpp:directive> <cpp:literal>"Feature not yet supported"</cpp:literal></cpp:warning>

#line


Element

  • <cpp:line>

Subelements

  • <cpp:directive>
  • <cpp:number>
  • <cpp:file>

XPath

  • uses of #line

    //cpp:line
  • line numbers used by #line directives

    //cpp:line/cpp:number/src:literal
  • #line directives which reference the file “copy.c”

    //cpp:line[cpp:file/src:literal='"copy.c"']

#


Element

  • <cpp:empty>

XPath

  • blank preprocessor lines

    //cpp:empty

cpp:directive


Element

  • <cpp:directive>

XPath

  • cpp directives

    //cpp:directive

cpp:file


Element

  • <cpp:file>

XPath

  • cpp files

    //cpp:file

cpp:number


Element

  • <cpp:number>

XPath

  • cpp numbers

    //cpp:number

cpp:literal


Element

  • <cpp:literal>

XPath

  • cpp literals

    //cpp:literal

cpp:value


Element

  • <cpp:value>

XPath

  • cpp values

    //cpp:value

Examples

#if DLEVEL == 0
    #define STACK 0
#elif DLEVEL == 1
    #define STACK 100
#elif DLEVEL > 5
    display( debugptr );
#else
    #define STACK 200
#endif
<cpp:if>#<cpp:directive>if</cpp:directive> <expr><name>DLEVEL</name> <operator>==</operator> <literal type="number">0</literal></expr></cpp:if>
    <cpp:define>#<cpp:directive>define</cpp:directive> <cpp:macro><name>STACK</name></cpp:macro> <cpp:value>0</cpp:value></cpp:define>
<cpp:elif>#<cpp:directive>elif</cpp:directive> <expr><name>DLEVEL</name> <operator>==</operator> <literal type="number">1</literal></expr></cpp:elif>
    <cpp:define>#<cpp:directive>define</cpp:directive> <cpp:macro><name>STACK</name></cpp:macro> <cpp:value>100</cpp:value></cpp:define>
<cpp:elif>#<cpp:directive>elif</cpp:directive> <expr><name>DLEVEL</name> <operator>&gt;</operator> <literal type="number">5</literal></expr></cpp:elif>
    <expr_stmt><expr><call><name>display</name><argument_list>( <argument><expr><name>debugptr</name></expr></argument> )</argument_list></call></expr>;</expr_stmt>
<cpp:else>#<cpp:directive>else</cpp:directive></cpp:else>
    <cpp:define>#<cpp:directive>define</cpp:directive> <cpp:macro><name>STACK</name></cpp:macro> <cpp:value>200</cpp:value></cpp:define>
<cpp:endif>#<cpp:directive>endif</cpp:directive></cpp:endif>
#define WIDTH 80
#define LENGTH ( WIDTH + 10 )
<cpp:define>#<cpp:directive>define</cpp:directive> <cpp:macro><name>WIDTH</name></cpp:macro> <cpp:value>80</cpp:value></cpp:define>
<cpp:define>#<cpp:directive>define</cpp:directive> <cpp:macro><name>LENGTH</name></cpp:macro> <cpp:value>( WIDTH + 10 )</cpp:value></cpp:define>
#define multiply( f1, f2 ) ( f1 * f2 )
<cpp:define>#<cpp:directive>define</cpp:directive> <cpp:macro><name>multiply</name><parameter_list>( <parameter><type><name>f1</name></type></parameter>, <parameter><type><name>f2</name></type></parameter> )</parameter_list></cpp:macro> <cpp:value>( f1 * f2 )</cpp:value></cpp:define>
#define eprintf(format, ...) fprintf (stderr, format, __VA_ARGS__)
<cpp:define>#<cpp:directive>define</cpp:directive> <cpp:macro><name>eprintf</name><parameter_list>(<parameter><type><name>format</name></type></parameter>, <parameter><type><modifier>...</modifier></type></parameter>)</parameter_list></cpp:macro> <cpp:value>fprintf (stderr, format, __VA_ARGS__)</cpp:value></cpp:define>