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

#line<br />

Syntax:<br />

Elements:<br />

Purpose:<br />

Examples:<br />

#LINE number file name<br />

Number is non-negative decimal integer. File name is optional.<br />

The C pre-processor informs the C <strong>Compiler</strong> of the location in your source<br />

code. This code is simply used to change the value of _LINE_ and _FILE_<br />

variables.<br />

1. void main(){<br />

#line 10 // specifies the line number that<br />

// should be reported for<br />

// the following line of input<br />

2. #line 7 "hello.c"<br />

// line number in the source file<br />

// hello.c and it sets the<br />

// line 7 as current line<br />

// and hello.c as current file<br />

Example Files:<br />

Also See:<br />

None<br />

None<br />

#locate<br />

Syntax:<br />

Elements:<br />

Purpose:<br />

#LOCATE id=x<br />

id is a C variable,<br />

x is a constant memory address<br />

#LOCATE allocates a C variable to a specified address. If the C variable was not<br />

previously defined, it will be defined as an INT8.<br />

A special form of this directive may be used to locate all A functions local variables<br />

starting at a fixed location.<br />

Use: #LOCATE Auto = address<br />

This directive will place the indirected C variable at the requested address.<br />

Examples:<br />

// This will locate the float variable at 50-53<br />

// and C will not use this memory for other<br />

// variables automatically located.<br />

float x;<br />

#locate x=0x 50<br />

Example<br />

Files:<br />

ex_glint.c<br />

117

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

Saved successfully!

Ooh no, something went wrong!