[cc65] macro woes

From: MagerValp <MagerValp1cling.gu.se>
Date: 2005-03-16 18:15:58
ca65 macros just don't like me. How do I check if an argument is a
string? I want a macro that can either take a string or a label:

	.macro printf str, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9

	.local arglist
	.local string

	ldax #arglist
	jsr console_printf

	.rodata

	.if (.match(.left (1, str), '"'))
string:
	    .asciiz str
arglist:
	    .addr string
	.else
arglist:
	    .addr str
	.endif

	printfargs arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9

	.code

	.endmacro

'"' never matches, " and \" gives me syntax errors instead. In
printfargs I have the same problem when I try to match '$'...

Also, would it be possible for ca65 to spit out the expanded macro
when an error occurs inside it? It would also help if listings had the
expanded macro code.

-- 
    ___          .     .  .         .       . +  .         .      o   
  _|___|_   +   .  +     .     +         .  Per Olofsson, arkadspelare
    o-o    .      .     .   o         +          MagerValp@cling.gu.se
     -       +            +    .     http://www.cling.gu.se/~cl3polof/
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Wed Mar 16 18:16:00 2005

This archive was generated by hypermail 2.1.8 : 2005-03-16 18:16:07 CET