srcML v1.0.0 C Documentation

Base Elements XML Element Subelements
block comment <comment type="block">
character literal <literal type="char">
doxygen block comment <comment type="block" format="doxygen">
doxygen line comment <comment type="line" format="doxygen">
escape <escape char="0xXX">
line comment <comment type="line">
name <name> <name>, <operator>
number literal <literal type="number">
string literal <literal type="string">
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>, <else>, <if type="elseif">
label <label> <name>
return statement <return> <expr>
switch statement <switch> <condition>, <block>
while statement <while> <condition>, <block>
Statement Subelements XML Element Subelements
block content <block_content> <expr_stmt>
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>
extern block <extern> <literal type="string">, <function_decl>, <decl_stmt>, <block>
extern specifier <specifier>
inline <specifier>
register <specifier>
restrict <specifier>
static <specifier>
volatile <specifier>
Declarations, Definitions, and Initializations XML Element Subelements
array initialization <decl> <type>, <name>, <init>
bitfield <range> <expr>
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> <type>, <name>, <init>
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>
struct initialization <decl_stmt> <decl>
union declaration <union_decl> <name>
union definition <union> <name>, <block>
Expressions XML Element Subelements
array index <index> <expr>
function call <call> <name>, <argument_list>
operator <operator>
ternary operator <ternary> <condition>, <then>, <else>
Other XML Element Subelements
_Alignas <alignas> <argument_list>
_Alignof <alignof> <argument_list>
_Atomic <atomic> <argument_list>
_Generic <generic_selection> <selector>, <association_list>
_Noreturn <specifier>
_Static_assert <assert type="static"> <argument_list>
_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>

#


Element

  • <cpp:empty>

XPath Query

  • blank preprocessor lines

    //cpp:empty

Example

#
<cpp:empty>#</cpp:empty>

#define


Element

  • <cpp:define>

Subelements

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

XPath Queries

  • 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 = '...']

Examples

#define
<cpp:define>#<cpp:directive>define</cpp:directive></cpp:define>

trivial #define

#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 used like a function

#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 a variadic macro

#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>

#endif


Element

  • <cpp:endif>

Subelement

  • <cpp:directive>

XPath Query

  • uses of #endif

    //cpp:endif

Example

#endif
<cpp:endif>#<cpp:directive>endif</cpp:directive></cpp:endif>

#error


Element

  • <cpp:error>

Subelements

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

XPath Query

  • uses of #error

    //cpp:error

Examples

#error
<cpp:error>#<cpp:directive>error</cpp:directive></cpp:error>
#if !defined(__cplusplus)
#error "C++ compiler required."
#endif
<cpp:if>#<cpp:directive>if</cpp:directive> <expr><operator>!</operator><call><name>defined</name><argument_list>(<argument><expr><name>__cplusplus</name></expr></argument>)</argument_list></call></expr></cpp:if>
<cpp:error>#<cpp:directive>error</cpp:directive> <cpp:literal>"C++ compiler required."</cpp:literal></cpp:error>
<cpp:endif>#<cpp:directive>endif</cpp:directive></cpp:endif>

#if


Element

  • <cpp:if>

Subelements

  • <cpp:directive>
  • <expr>

XPath Queries

  • uses of #if

    //cpp:if
  • conditions used by #if

    //cpp:if/src:expr

Examples

#if
<cpp:if>#<cpp:directive>if</cpp:directive></cpp:if>
#if DLEVEL > 5
<cpp:if>#<cpp:directive>if</cpp:directive> <expr><name>DLEVEL</name> <operator>&gt;</operator> <literal type="number">5</literal></expr></cpp:if>

#ifndef


Element

  • <cpp:ifndef>

Subelements

  • <cpp:directive>
  • <name>

XPath Query

  • uses of #ifndef

    //cpp:ifndef

Examples

#ifndef
<cpp:ifndef>#<cpp:directive>ifndef</cpp:directive></cpp:ifndef>
#ifndef test
#define final
#endif
<cpp:ifndef>#<cpp:directive>ifndef</cpp:directive> <name>test</name></cpp:ifndef>
<cpp:define>#<cpp:directive>define</cpp:directive> <cpp:macro><name>final</name></cpp:macro></cpp:define>
<cpp:endif>#<cpp:directive>endif</cpp:directive></cpp:endif>

#include


Element

  • <cpp:include>

Subelements

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

XPath Queries

  • includes

    //cpp:include
  • Names of all included files

    //cpp:include/cpp:file

Examples

#include
<cpp:include>#<cpp:directive>include</cpp:directive></cpp:include>
#include <FileName>
#include "fileName"
<cpp:include>#<cpp:directive>include</cpp:directive> <cpp:file>&lt;FileName&gt;</cpp:file></cpp:include>
<cpp:include>#<cpp:directive>include</cpp:directive> <cpp:file>"fileName"</cpp:file></cpp:include>

#line


Element

  • <cpp:line>

Subelements

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

XPath Queries

  • 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"']

Examples

#line
<cpp:line>#<cpp:directive>line</cpp:directive></cpp:line>
#line 151 "copy.c"
<cpp:line>#<cpp:directive>line</cpp:directive> <cpp:number>151</cpp:number> <cpp:file>"copy.c"</cpp:file></cpp:line>

#pragma


Element

  • <cpp:pragma>

Subelements

  • <cpp:directive>
  • <name>

XPath Query

  • uses of #pragma

    //cpp:pragma

Examples

#pragma
<cpp:pragma>#<cpp:directive>pragma</cpp:directive></cpp:pragma>
#pragma warning(once : 4385)
#pragma ms_struct on
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <name>warning</name><name>(</name><name>once</name> <name>:</name> <name>4385</name><name>)</name></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <name>ms_struct</name> <name>on</name></cpp:pragma>

#undef


Element

  • <cpp:undef>

Subelements

  • <cpp:directive>
  • <name>

XPath Queries

  • 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]

Examples

#undef
<cpp:undef>#<cpp:directive>undef</cpp:directive></cpp:undef>
#define multiply( f1, f2 ) ( f1 * f2 )
#undef multiply
<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>
<cpp:undef>#<cpp:directive>undef</cpp:directive> <name>multiply</name></cpp:undef>

#warning


Element

  • <cpp:warning>

Subelements

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

XPath Query

  • 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>

_Alignof


Element

  • <alignof>

Subelement

  • <argument_list>

XPath Query

  • uses of _Alignof

    //src:alignof

Example

_Alignof(union type);
<expr_stmt><expr><alignof>_Alignof<argument_list>(<argument><expr>union <name>type</name></expr></argument>)</argument_list></alignof></expr>;</expr_stmt>

_Static_assert


Element

  • <assert type="static">

Subelement

  • <argument_list>

XPath Query

  • uses of _Static_assert

    //src:assert[@type ='static']

Example

_Static_assert(DEBUG_LEVEL > 5, "Message");
<assert type="static">_Static_assert<argument_list>(<argument><expr><name>DEBUG_LEVEL</name> <operator>&gt;</operator> <literal type="number">5</literal></expr></argument>, <argument><expr><literal type="string">"Message"</literal></expr></argument>)</argument_list>;</assert>

_Thread_local


Element

  • <specifier>

XPath Query

  • uses of _Thread_local

    //src:specifier[.='_Thread_local']

Example

_Thread_local int x;
<decl_stmt><decl><type><specifier>_Thread_local</specifier> <name>int</name></type> <name>x</name></decl>;</decl_stmt>

asm


Element

  • <asm>

XPath Query

  • uses of asm

    //src: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>

bitfield


Element

  • <range>

Subelement

  • <expr>

XPath Query

  • bitfield declarations

    //src:decl[src:range]

Example

struct mybitfields
{
    int a : 5;
} test;
<struct>struct <name>mybitfields</name>
<block>{
    <decl_stmt><decl><type><name>int</name></type> <name>a</name> <range>: <expr><literal type="number">5</literal></expr></range></decl>;</decl_stmt>
}</block> <decl><name>test</name></decl>;</struct>

block


Element

  • <block>

Subelement

  • <block_content>

XPath Queries

  • 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

Example

{
    line[i] = x;
    x++;
    i--;
}
<block>{<block_content>
    <expr_stmt><expr><name><name>line</name><index>[<expr><name>i</name></expr>]</index></name> <operator>=</operator> <name>x</name></expr>;</expr_stmt>
    <expr_stmt><expr><name>x</name><operator>++</operator></expr>;</expr_stmt>
    <expr_stmt><expr><name>i</name><operator>--</operator></expr>;</expr_stmt>
</block_content>}</block>

block comment


Element

  • <comment type="block">

XPath Queries

  • comments

    //src:comment
  • block comments

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

Example

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

block content


Element

  • <block_content>

Subelement

  • <expr_stmt>

XPath Queries

  • 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

Example

{
    line[i] = x;
    x++;
    i--;
}
<block>{<block_content>
    <expr_stmt><expr><name><name>line</name><index>[<expr><name>i</name></expr>]</index></name> <operator>=</operator> <name>x</name></expr>;</expr_stmt>
    <expr_stmt><expr><name>x</name><operator>++</operator></expr>;</expr_stmt>
    <expr_stmt><expr><name>i</name><operator>--</operator></expr>;</expr_stmt>
</block_content>}</block>

case statement


Element

  • <case>

Subelement

  • <expr>

XPath Queries

  • 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']

Examples

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

character literal


Element

  • <literal type="char">

XPath Query

  • character literals

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

Example

'c';
<expr_stmt><expr><literal type="char">'c'</literal></expr>;</expr_stmt>

condition


Element

  • <condition>

Subelement

  • <expr>

XPath Queries

  • 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

Examples

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>
while ( i >= 0 ) {
    string1[i] = string2[i];
    i--;
}
<while>while <condition>( <expr><name>i</name> <operator>&gt;=</operator> <literal type="number">0</literal></expr> )</condition> <block>{<block_content>
    <expr_stmt><expr><name><name>string1</name><index>[<expr><name>i</name></expr>]</index></name> <operator>=</operator> <name><name>string2</name><index>[<expr><name>i</name></expr>]</index></name></expr>;</expr_stmt>
    <expr_stmt><expr><name>i</name><operator>--</operator></expr>;</expr_stmt>
</block_content>}</block></while>
do counter--; while (counter > 0);
<do>do<block type="pseudo"><block_content> <expr_stmt><expr><name>counter</name><operator>--</operator></expr>;</expr_stmt></block_content></block> while <condition>(<expr><name>counter</name> <operator>&gt;</operator> <literal type="number">0</literal></expr>)</condition>;</do>
a ? x : y;
<expr_stmt><expr><ternary><condition><expr><name>a</name></expr> ?</condition><then> <expr><name>x</name></expr> </then><else>: <expr><name>y</name></expr></else></ternary></expr>;</expr_stmt>

const


Element

  • <specifier>

XPath Queries

  • const variables

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

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

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

Examples

const int x;
const X y;
<decl_stmt><decl><type><specifier>const</specifier> <name>int</name></type> <name>x</name></decl>;</decl_stmt>
<decl_stmt><decl><type><specifier>const</specifier> <name>X</name></type> <name>y</name></decl>;</decl_stmt>
int const x;
X const y;
<decl_stmt><decl><type><name>int</name> <specifier>const</specifier></type> <name>x</name></decl>;</decl_stmt>
<decl_stmt><decl><type><name>X</name> <specifier>const</specifier></type> <name>y</name></decl>;</decl_stmt>

cpp:directive


Element

  • <cpp:directive>

XPath Query

  • cpp directives

    //cpp:directive

Examples

#if
<cpp:if>#<cpp:directive>if</cpp:directive></cpp:if>
#define
<cpp:define>#<cpp:directive>define</cpp:directive></cpp:define>

cpp:file


Element

  • <cpp:file>

XPath Query

  • cpp files

    //cpp:file

Example

#include <FileName>
#include "fileName"
<cpp:include>#<cpp:directive>include</cpp:directive> <cpp:file>&lt;FileName&gt;</cpp:file></cpp:include>
<cpp:include>#<cpp:directive>include</cpp:directive> <cpp:file>"fileName"</cpp:file></cpp:include>

cpp:literal


Element

  • <cpp:literal>

XPath Query

  • cpp literals

    //cpp:literal

Examples

#if !defined(__cplusplus)
#error "C++ compiler required."
#endif
<cpp:if>#<cpp:directive>if</cpp:directive> <expr><operator>!</operator><call><name>defined</name><argument_list>(<argument><expr><name>__cplusplus</name></expr></argument>)</argument_list></call></expr></cpp:if>
<cpp:error>#<cpp:directive>error</cpp:directive> <cpp:literal>"C++ compiler required."</cpp:literal></cpp:error>
<cpp:endif>#<cpp:directive>endif</cpp:directive></cpp:endif>
#warning "Feature not yet supported"
<cpp:warning>#<cpp:directive>warning</cpp:directive> <cpp:literal>"Feature not yet supported"</cpp:literal></cpp:warning>

cpp:number


Element

  • <cpp:number>

XPath Query

  • cpp numbers

    //cpp:number

Example

#line 151 "copy.c"
<cpp:line>#<cpp:directive>line</cpp:directive> <cpp:number>151</cpp:number> <cpp:file>"copy.c"</cpp:file></cpp:line>

cpp:value


Element

  • <cpp:value>

XPath Query

  • 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>

default statement


Element

  • <default>

XPath Queries

  • default labels

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

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

Example

default:
<default>default:</default>

doxygen block comment


Element

  • <comment type="block" format="doxygen">

XPath Queries

  • 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>

doxygen line comment


Element

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

XPath Queries

  • comments

    //src:comment
  • doxygen comments

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

Example

///
//!
<comment type="line" format="doxygen">///</comment>
<comment type="line" format="doxygen">//!</comment>

else


Element

  • <else>

Subelement

  • <block>

XPath Query

  • all elses

    //src:else

else if


Element

  • <if type="elseif">

Subelements

  • <condition>
  • <block>

XPath Query

  • all else ifs

    //src:if[@type='elseif']

empty statement


Element

  • <empty_stmt>

XPath Query

  • empty statements

    //src:empty_stmt

Example

;
<empty_stmt>;</empty_stmt>

enum declaration


Element

  • <enum_decl>

Subelement

  • <name>

XPath Queries

  • enum declarations

    //src:enum_decl
  • names of enum declarations

    //src:enum_decl/src:name

Example

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

enum definition


Element

  • <enum>

Subelements

  • <name>
  • <block>

XPath Queries

  • enum definitions

    //src:enum
  • names of members of enums

    //src:enum/src:block/src:decl/src:name

Examples

enum DAY {
    sunday = 0,
    monday,
    tuesday,
    wednesday,
    thursday,
    friday,
    saturday,
};
<enum>enum <name>DAY</name> <block>{
    <decl><name>sunday</name> <init>= <expr><literal type="number">0</literal></expr></init></decl>,
    <decl><name>monday</name></decl>,
    <decl><name>tuesday</name></decl>,
    <decl><name>wednesday</name></decl>,
    <decl><name>thursday</name></decl>,
    <decl><name>friday</name></decl>,
    <decl><name>saturday</name></decl>,
}</block>;</enum>
enum { yes, no } response;
<enum>enum <block>{ <decl><name>yes</name></decl>, <decl><name>no</name></decl> }</block> <decl><name>response</name></decl>;</enum>

expression statement


Element

  • <expr_stmt>

Subelement

  • <expr>

XPath Query

  • expression statements

    //src:expr_stmt

Example

i++;
<expr_stmt><expr><name>i</name><operator>++</operator></expr>;</expr_stmt>

extern block


Element

  • <extern>

Subelements

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

XPath Query

  • extern blocks

    //src:extern

Examples

extern function with linkage specifier

extern "C" void foo();
<extern>extern <literal type="string">"C"</literal> <function_decl><type><name>void</name></type> <name>foo</name><parameter_list>()</parameter_list>;</function_decl></extern>

extern structure with linkage specifier

extern "C" struct Z X;
<extern>extern <literal type="string">"C"</literal> <decl_stmt><decl><type><name><name>struct</name> <name>Z</name></name></type> <name>X</name></decl>;</decl_stmt></extern>

extern variable with linkage specifier

extern "C" int X;
<extern>extern <literal type="string">"C"</literal> <decl_stmt><decl><type><name>int</name></type> <name>X</name></decl>;</decl_stmt></extern>

extern block with linkage specifier

extern "C" { }
<extern>extern <literal type="string">"C"</literal> <block>{<block_content> </block_content>}</block></extern>

extern specifier


Element

  • <specifier>

XPath Queries

  • extern variables

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

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

Examples

external variable

extern int X;
<decl_stmt><decl><type><specifier>extern</specifier> <name>int</name></type> <name>X</name></decl>;</decl_stmt>

external structure

extern struct Z X;
<decl_stmt><decl><type><specifier>extern</specifier> <name><name>struct</name> <name>Z</name></name></type> <name>X</name></decl>;</decl_stmt>

external function

extern void foo();
<function_decl><type><specifier>extern</specifier> <name>void</name></type> <name>foo</name><parameter_list>()</parameter_list>;</function_decl>

for statement


Element

  • <for>

Subelements

  • <control>
  • <block>

XPath Queries

  • 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= '++']

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>

function


Element

  • <function>

Subelements

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

XPath Queries

  • 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]

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>

function call


Element

  • <call>

Subelements

  • <name>
  • <argument_list>

XPath Query

  • function calls

    //src:call

Example

typical function call

foo(x, y, z);
<expr_stmt><expr><call><name>foo</name><argument_list>(<argument><expr><name>x</name></expr></argument>, <argument><expr><name>y</name></expr></argument>, <argument><expr><name>z</name></expr></argument>)</argument_list></call></expr>;</expr_stmt>

function declaration


Element

  • <function_decl>

Subelements

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

XPath Queries

  • 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

Examples

struct STUDENT sortstu( STUDENT a, STUDENT b );
void print(STUDENT a);
<function_decl><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>;</function_decl>
<function_decl><type><name>void</name></type> <name>print</name><parameter_list>(<parameter><decl><type><name>STUDENT</name></type> <name>a</name></decl></parameter>)</parameter_list>;</function_decl>
void foo (int a[]);
<function_decl><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>;</function_decl>
void foo (int* a);
<function_decl><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>;</function_decl>
int add_multiple_values (int number, ...);
<function_decl><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>;</function_decl>

goto statement


Element

  • <goto>

Subelement

  • <name>

XPath Query

  • goto statements

    //src:goto

Example

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

if


Element

  • <if>

Subelements

  • <condition>
  • <block>

XPath Query

  • all ifs

    //src:if

if statement


Element

  • <if_stmt>

Subelements

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

XPath Queries

  • 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()]

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>

inline


Element

  • <specifier>

XPath Queries

  • inline function declarations

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

    //src:namespace[src:specifier='inline']

Example

inline void swapValues(int* a,int* b);
<function_decl><type><specifier>inline</specifier> <name>void</name></type> <name>swapValues</name><parameter_list>(<parameter><decl><type><name>int</name><modifier>*</modifier></type> <name>a</name></decl></parameter>,<parameter><decl><type><name>int</name><modifier>*</modifier></type> <name>b</name></decl></parameter>)</parameter_list>;</function_decl>

label


Element

  • <label>

Subelement

  • <name>

XPath Queries

  • 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])]

Example

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

line comment


Element

  • <comment type="line">

XPath Queries

  • comments

    //src:comment
  • line comments

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

Example

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

number literal


Element

  • <literal type="number">

XPath Query

  • number literals

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

Example

123;
42.0;
<expr_stmt><expr><literal type="number">123</literal></expr>;</expr_stmt>
<expr_stmt><expr><literal type="number">42.0</literal></expr>;</expr_stmt>

omp:argument


Element

  • <omp:argument>

Subelement

  • <omp:expr>

XPath Query

  • omp arguments

    //omp:argument

Example

#pragma omp parallel if ()
#pragma omp parallel if (list)
#pragma omp parallel if (one, two)
#pragma omp parallel if (one, two) if (one, two)
#pragma omp parallel if (one, two), if (one, two)
#pragma omp parallel reduction(+: sum)
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>()</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>list</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause>, <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>reduction</omp:name><omp:argument_list>(<omp:argument><omp:expr>+: sum</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>

omp:argument_list


Element

  • <omp:argument_list>

Subelement

  • <omp:argument>

XPath Query

  • omp argument lists

    //omp:argument_list

Example

#pragma omp parallel if ()
#pragma omp parallel if (list)
#pragma omp parallel if (one, two)
#pragma omp parallel if (one, two) if (one, two)
#pragma omp parallel if (one, two), if (one, two)
#pragma omp parallel reduction(+: sum)
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>()</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>list</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause>, <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>reduction</omp:name><omp:argument_list>(<omp:argument><omp:expr>+: sum</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>

omp:clause


Element

  • <omp:clause>

Subelements

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

XPath Query

  • omp clauses

    //omp:clause

Example

#pragma omp parallel if ()
#pragma omp parallel if (list)
#pragma omp parallel if (one, two)
#pragma omp parallel if (one, two) if (one, two)
#pragma omp parallel if (one, two), if (one, two)
#pragma omp parallel reduction(+: sum)
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>()</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>list</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause>, <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>reduction</omp:name><omp:argument_list>(<omp:argument><omp:expr>+: sum</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>

omp:directive


Element

  • <omp:directive>

Subelements

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

XPath Queries

  • omp directives

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

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

Example

#pragma omp parallel
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name></omp:directive></cpp:pragma>

omp:expr


Element

  • <omp:expr>

XPath Query

  • omp expressions

    //omp:expr

Example

#pragma omp parallel if (list)
#pragma omp parallel if (one, two)
#pragma omp parallel if (one, two) if (one, two)
#pragma omp parallel if (one, two), if (one, two)
#pragma omp parallel reduction(+: sum)
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>list</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause>, <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>reduction</omp:name><omp:argument_list>(<omp:argument><omp:expr>+: sum</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>

omp:name


Element

  • <omp:name>

XPath Query

  • omp names

    //omp:name

Example

#pragma omp parallel if ()
#pragma omp parallel if (list)
#pragma omp parallel if (one, two)
#pragma omp parallel if (one, two) if (one, two)
#pragma omp parallel if (one, two), if (one, two)
#pragma omp parallel reduction(+: sum)
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>()</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>list</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause>, <omp:clause><omp:name>if</omp:name> <omp:argument_list>(<omp:argument><omp:expr>one</omp:expr></omp:argument>, <omp:argument><omp:expr>two</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>
<cpp:pragma>#<cpp:directive>pragma</cpp:directive> <omp:directive>omp <omp:name>parallel</omp:name> <omp:clause><omp:name>reduction</omp:name><omp:argument_list>(<omp:argument><omp:expr>+: sum</omp:expr></omp:argument>)</omp:argument_list></omp:clause></omp:directive></cpp:pragma>

operator


Element

  • <operator>

XPath Queries

  • uses of the -> operator

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

    //src:operator[.='.']

Examples

 t->tm_sec;
 <expr_stmt><expr><name><name>t</name><operator>-&gt;</operator><name>tm_sec</name></name></expr>;</expr_stmt>
t.tm_sec;
<expr_stmt><expr><name><name>t</name><operator>.</operator><name>tm_sec</name></name></expr>;</expr_stmt>

pointer declaration


Element

  • <modifier>

XPath Queries

  • declarations of pointers

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

    //src:function_decl[contains(., ')')]

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>

register


Element

  • <specifier>

XPath Query

  • variable declarations with the register specifier

    //src:decl[src:type/src:specifier='register']

Example

register int x;
<decl_stmt><decl><type><specifier>register</specifier> <name>int</name></type> <name>x</name></decl>;</decl_stmt>

restrict


Element

  • <specifier>

XPath Query

  • variables declarations with the restrict specifier

    //src:decl[src:type/src:specifier='restrict']

Example

restrict double* x;
<decl_stmt><decl><type><specifier>restrict</specifier> <name>double</name><modifier>*</modifier></type> <name>x</name></decl>;</decl_stmt>

return statement


Element

  • <return>

Subelement

  • <expr>

XPath Queries

  • 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]

Examples

return;
<return>return;</return>
return true;
<return>return <expr><name>true</name></expr>;</return>
return( s * (long long)s );
<return>return<expr><operator>(</operator> <name>s</name> <operator>*</operator> <operator>(</operator><name>long</name> <name>long</name><operator>)</operator><name>s</name> <operator>)</operator></expr>;</return>

sizeof


Element

  • <sizeof>

Subelement

  • <argument_list>

XPath Query

  • uses of sizeof

    //src:sizeof

Example

sizeof(struct type);
<expr_stmt><expr><sizeof>sizeof<argument_list>(<argument><expr>struct <name>type</name></expr></argument>)</argument_list></sizeof></expr>;</expr_stmt>

static


Element

  • <specifier>

XPath Queries

  • static variables

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

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

Examples

static int x;
<decl_stmt><decl><type><specifier>static</specifier> <name>int</name></type> <name>x</name></decl>;</decl_stmt>
static void foo();
<function_decl><type><specifier>static</specifier> <name>void</name></type> <name>foo</name><parameter_list>()</parameter_list>;</function_decl>

string literal


Element

  • <literal type="string">

XPath Query

  • string literals

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

Example

"Hello";
L"string";
u"UTF-16 string.";
U"UTF-32 string.";
R"a("()")a";
u8R"|||(a "raw UTF-8" string)|||";
uR"*(a "raw UTF-16" string)*";
UR"(a "raw UTF-32" string)";
<expr_stmt><expr><literal type="string">"Hello"</literal></expr>;</expr_stmt>
<expr_stmt><expr><literal type="string">L"string"</literal></expr>;</expr_stmt>
<expr_stmt><expr><literal type="string">u"UTF-16 string."</literal></expr>;</expr_stmt>
<expr_stmt><expr><literal type="string">U"UTF-32 string."</literal></expr>;</expr_stmt>
<expr_stmt><expr><literal type="string">R"a("()")a"</literal></expr>;</expr_stmt>
<expr_stmt><expr><literal type="string">u8R"|||(a "raw UTF-8" string)|||"</literal></expr>;</expr_stmt>
<expr_stmt><expr><literal type="string">uR"*(a "raw UTF-16" string)*"</literal></expr>;</expr_stmt>
<expr_stmt><expr><literal type="string">UR"(a "raw UTF-32" string)"</literal></expr>;</expr_stmt>

struct declaration


Element

  • <struct_decl>

Subelement

  • <name>

XPath Query

  • forward struct declarations

    //src:struct_decl

Example

forward declaration

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

struct definition


Element

  • <struct>

Subelements

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

XPath Queries

  • struct definitions

    //src:struct
  • struct members

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

Examples

struct a {
    int x;
    double y;
    float z;
 };
<struct>struct <name>a</name> <block>{
    <decl_stmt><decl><type><name>int</name></type> <name>x</name></decl>;</decl_stmt>
    <decl_stmt><decl><type><name>double</name></type> <name>y</name></decl>;</decl_stmt>
    <decl_stmt><decl><type><name>float</name></type> <name>z</name></decl>;</decl_stmt>
 }</block>;</struct>

variable of an anonymous struct type

struct
{
    int x;
    int y;
} mystruct;
<struct>struct
<block>{
    <decl_stmt><decl><type><name>int</name></type> <name>x</name></decl>;</decl_stmt>
    <decl_stmt><decl><type><name>int</name></type> <name>y</name></decl>;</decl_stmt>
}</block> <decl><name>mystruct</name></decl>;</struct>

declaring a struct and instance

struct employee
{
    char name[20];
    int id;
    long cls;
} temp;
<struct>struct <name>employee</name>
<block>{
    <decl_stmt><decl><type><name>char</name></type> <name><name>name</name><index>[<expr><literal type="number">20</literal></expr>]</index></name></decl>;</decl_stmt>
    <decl_stmt><decl><type><name>int</name></type> <name>id</name></decl>;</decl_stmt>
    <decl_stmt><decl><type><name>long</name></type> <name>cls</name></decl>;</decl_stmt>
}</block> <decl><name>temp</name></decl>;</struct>
struct Foo
        : public bar
{ };
<struct>struct <name>Foo</name>
        <super_list>: <super><specifier>public</specifier> <name>bar</name></super></super_list>
<block>{<public type="default"> </public>}</block>;</struct>

ternary operator


Element

  • <ternary>

Subelements

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

XPath Query

  • ternary operators

    //src:ternary

Example

a ? x : y;
<expr_stmt><expr><ternary><condition><expr><name>a</name></expr> ?</condition><then> <expr><name>x</name></expr> </then><else>: <expr><name>y</name></expr></else></ternary></expr>;</expr_stmt>

typedef


Element

  • <typedef>

Subelements

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

XPath Queries

  • 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

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>, <name>year</name>;</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>

union declaration


Element

  • <union_decl>

Subelement

  • <name>

XPath Query

  • forward declarations for unions

    //src:union_decl

Example

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

union definition


Element

  • <union>

Subelements

  • <name>
  • <block>

XPath Query

  • union definitions

    //src:union

Example

union sign
{
    int svar;
    unsigned uvar;
} number;
<union>union <name>sign</name>
<block>{
    <decl_stmt><decl><type><name>int</name></type> <name>svar</name></decl>;</decl_stmt>
    <decl_stmt><decl><type><name>unsigned</name></type> <name>uvar</name></decl>;</decl_stmt>
}</block> <decl><name>number</name></decl>;</union>

variable declaration


Element

  • <decl>

Subelements

  • <type>
  • <name>
  • <init>

XPath Queries

  • 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]

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>

variable declaration statement


Element

  • <decl_stmt>

Subelement

  • <decl>

XPath Queries

  • declaration statements

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

    //src:decl_stmt/src:decl[contains(src:type, 'union')]

Examples

int x;
<decl_stmt><decl><type><name>int</name></type> <name>x</name></decl>;</decl_stmt>

struct declarations

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

volatile


Element

  • <specifier>

XPath Query

  • volatile variables

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

Example

volatile int foo; 
int volatile foo;
<decl_stmt><decl><type><specifier>volatile</specifier> <name>int</name></type> <name>foo</name></decl>;</decl_stmt> 
<decl_stmt><decl><type><name>int</name> <specifier>volatile</specifier></type> <name>foo</name></decl>;</decl_stmt>

while statement


Element

  • <while>

Subelements

  • <condition>
  • <block>

XPath Queries

  • 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']

Example

while ( i >= 0 ) {
    string1[i] = string2[i];
    i--;
}
<while>while <condition>( <expr><name>i</name> <operator>&gt;=</operator> <literal type="number">0</literal></expr> )</condition> <block>{<block_content>
    <expr_stmt><expr><name><name>string1</name><index>[<expr><name>i</name></expr>]</index></name> <operator>=</operator> <name><name>string2</name><index>[<expr><name>i</name></expr>]</index></name></expr>;</expr_stmt>
    <expr_stmt><expr><name>i</name><operator>--</operator></expr>;</expr_stmt>
</block_content>}</block></while>