Searching \ for '[PIC:] How to do token pasting in MPASM?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/languages.htm?key=asm
Search entire site for: 'How to do token pasting in MPASM?'.

Exact match. Not showing close matches.
PICList Thread
'[PIC:] How to do token pasting in MPASM?'
2003\02\20@145315 by Ned Konz

flavicon
face
Say I want to make a MPASM macro that will be invoked as:

       MyMacro abc,xyz

and will generate the following code:

abcxyz    equ 123

That is, it pastes its two arguments together to make a label. Is this
possible in MPASM? How about:

abcxyz    equ "abcxyz"

Which also pastes the arguments together and makes a string out of
them.

I know how to do it in C using the ## token pasting operator and the #
stringizing operators (and the fact that two adjacent strings are
merged).

But I only see the #v(<expr>) form that would allow tokens to be
pasted together (with an intervening number).

After reading the MPASM manual I can't figure out how to do these. I
hope this isn't an oversight.

Thanks,
--
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE

--
http://www.piclist.com hint: To leave the PICList
spam_OUTpiclist-unsubscribe-requestTakeThisOuTspammitvma.mit.edu>

2003\02\20@153325 by Wouter van Ooijen

face picon face
> After reading the MPASM manual I can't figure out how to do these. I
> hope this isn't an oversight.

Before I switched to the more sensible approach of writing a compiler in
C instead of using the MPASM macro facility forn this I did a lot of
token-pasting, but as far as I remember there *had* to be a #v()
inbetween, so I always ended up with at least a 0 or so between the
tokes. No problem when the name just has to mach something generated
elsewhere, just something to recon with. You could check the wisp (not
wisp628) sources on my website.

Wouter van Ooijen

-- -------------------------------------------
Van Ooijen Technische Informatica: http://www.voti.nl
consultancy, development, PICmicro products

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam@spam@mitvma.mit.edu>

2003\02\20@153547 by Olin Lathrop

face picon face
> Say I want to make a MPASM macro that will be invoked as:
>
>         MyMacro abc,xyz
>
> and will generate the following code:
>
> abcxyz    equ 123
>
> That is, it pastes its two arguments together to make a label. Is this
> possible in MPASM?

Unfortunately not.  MPASM is particularly stupid in this regard.

> But I only see the #v(<expr>) form that would allow tokens to be
> pasted together (with an intervening number).

Yup, that's all you get.  Yes, I think it sucks too.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com hint: To leave the PICList
piclist-unsubscribe-requestspamKILLspammitvma.mit.edu>

2003\02\20@155941 by Ned Konz

flavicon
face
On Thursday 20 February 2003 12:32 pm, Wouter van Ooijen wrote:
> Before I switched to the more sensible approach of writing a
> compiler in C instead of using the MPASM macro facility forn this I
> did a lot of token-pasting, but as far as I remember there *had* to
> be a #v() inbetween, so I always ended up with at least a 0 or so
> between the tokes. No problem when the name just has to mach
> something generated elsewhere, just something to recon with. You
> could check the wisp (not wisp628) sources on my website.

Thanks.

I guess I'll just write a compiler. It's on my to-do list anyway.

--
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE

--
http://www.piclist.com hint: To leave the PICList
.....piclist-unsubscribe-requestKILLspamspam.....mitvma.mit.edu>

More... (looser matching)
- Last day of these posts
- In 2003 , 2004 only
- Today
- New search...