17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Also See:<br />

#byte, #bit, #reserve, #word, Named Registers, Type Specifiers, Type Qualifiers,<br />

Enumerated Types, Structures & Unions, Typedef<br />

#module<br />

Syntax:<br />

Elements:<br />

Purpose:<br />

Examples:<br />

Example Files:<br />

See Also:<br />

#MODULE<br />

None<br />

All global symbols created from the #MODULE to the end of the file will<br />

only be visible within that same block of code (and files #INCLUDE<br />

within that block). This may be used to limit the scope of global<br />

variables and functions within include files. This directive also applies to<br />

pre-processor #defines.<br />

Note: The extern and static data qualifiers can also be used to denote<br />

scope of variables and functions as in the standard C methodology.<br />

#MODULE does add some benefits in that pre-processor #DEFINE can<br />

be given scope, which cannot normally be done in standard C<br />

methodology.<br />

int GetCount(void);<br />

void SetCount(int newCount);<br />

#MODULE<br />

int g_count;<br />

#define G_COUNT_MAX 100<br />

int GetCount(void) {return(g_count);}<br />

void SetCount(int newCount) {<br />

if (newCount>G_COUNT_MAX)<br />

newCount=G_COUNT_MAX;<br />

g_count=newCount;<br />

}<br />

/*<br />

the functions GetCount() and SetCount() have global scope, but the<br />

variable g_count and the #define G_COUNT_MAX only has scope to this file.<br />

*/<br />

None<br />

#EXPORT, Invoking the Command Line <strong>Compiler</strong>, Multiple Compilation<br />

Unit<br />

#nolist<br />

Syntax:<br />

Elements:<br />

#NOLIST<br />

None<br />

118

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!