17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

PreProcessor<br />

#define isequal(a,b) (primary_##a[b]==backup_##a[b])<br />

// usage iseaqual(names,5) is the same as<br />

// (primary_names[5]==backup_names[5])<br />

#define str(s) #s<br />

#define part(device) #include str(device##.h)<br />

// usage part(16F887) is the same as<br />

// #include "16F887.h"<br />

#define DBG(...)<br />

fprintf(debug,__VA_ARGS__)<br />

Example<br />

Files:<br />

Also See:<br />

ex_stwt.c, ex_macro.c<br />

#UNDEF, #IFDEF, #IFNDEF<br />

definedinc<br />

Syntax: value = definedinc( variable );<br />

Parameters:<br />

Returns:<br />

Function:<br />

variable is the name of the variable, function, or type to be checked.<br />

A C status for the type of id entered as follows:<br />

0 – not known<br />

1 – typedef or enum<br />

2 – struct or union type<br />

3 – typemod qualifier<br />

4 – defined function<br />

5 – function prototype<br />

6 – compiler built-in function<br />

7 – local variable<br />

8 – global variable<br />

This function checks the type of the variable or function being passed in and returns a<br />

specific C status based on the type.<br />

Availability: All devices<br />

Requires: None.<br />

Examples: int x, y = 0;<br />

y = definedinc( x );<br />

// y will return 7 – x is a local variable<br />

Example Files:<br />

Also See:<br />

None<br />

None<br />

99

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

Saved successfully!

Ooh no, something went wrong!