06.02.2013 Views

C166/ST10 Cross-Assembler, Linker/Locator, Utilities ... - Tasking

C166/ST10 Cross-Assembler, Linker/Locator, Utilities ... - Tasking

C166/ST10 Cross-Assembler, Linker/Locator, Utilities ... - Tasking

SHOW MORE
SHOW LESS

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

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

• • • • • • • •<br />

Macro Preprocessor 2−69<br />

Example:<br />

@"−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

@"Macro for saving registers<br />

@"−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−<br />

@*DEFINE PushReg( RegList )<br />

@MATCH( Reg, List, @RegList )<br />

@WHILE( @LEN( @Reg ) )<br />

PUSH @Reg<br />

@MATCH(Reg, List, @List )<br />

@ENDW<br />

@ENDD<br />

@PushReg ("R0, R1")<br />

The macro PushReg("R0, R1") saves all registers that are contained in<br />

passed register lists. The register list is identified as a parameter string<br />

when called from PushReg("R0, R1") and passed as a parameter to the<br />

macro. With use of the WHILE loop and the MATCH function, all partial<br />

parameters of the returned parameters are processed by the macro.<br />

2.7.7 PARAMETER TYPE STRING<br />

The macro preprocessor provides the internal type ’STRING’ for parameter<br />

strings. This allows the following to be performed:<br />

1. Type test during the processing of this parameter when expanded<br />

by the macro<br />

2. Interpretation of the call and application<br />

3. A precise error test.<br />

Example:<br />

@*DEFINE M1( P1 )<br />

@LEN( @P1 )<br />

@ENDD<br />

A string that is to be passed as a parameter and, in addition, to be<br />

interpreted as a string by the macro expansion when this parameter is<br />

processed should, be specified in the following manner (this is in<br />

accordance with the standard text replacement rules of the macro<br />

preprocessor):<br />

@M1("""Test_String""")

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

Saved successfully!

Ooh no, something went wrong!