Author Topic: %ifdef  (Read 18823 times)

nobody

  • Guest
%ifdef
« on: September 29, 2009, 03:56:32 AM »
I have trouble with this:

%define  _defined_func1 func1      ;this is _defined_%1 %1, defined in another macro

If later in a macro I do
;%ifdef _defined_%1         ;%1=func1
;   %error %1 is defined
%else
;%error %1 not defined
%endif
This test will always return %1 not defined. Am I not using this correct??
The docs say:
4.4.1 %ifdef: Testing Single-Line Macro Existence
is %define  _defined_func1 func1       not a single line macro??

Your help and suggestions are welcome
Klod

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: %ifdef
« Reply #1 on: September 29, 2009, 05:22:29 AM »
Hi Klod,

I'm not sure I understand what you're doing. I tried this:

; %define  _defined_func1 func1      ;this is _defined_%1 %1, defined in another macro

%macro othermacro 1

%define _defined_%1 %1

%endmacro

%macro themacro 1

%ifdef _defined_%1
;%1=func1

%error %1 is defined

%else

%error %1 not defined

%endif
%endmacro

othermacro func1

themacro func1

(this forum software is absolutely horrid!!! - imagine underscores...)

Seems to work as expected...

Best,
Frank

nobody

  • Guest
Re: %ifdef
« Reply #2 on: September 29, 2009, 02:35:37 PM »
Yes Frank, the formatting really sucks. My code does have under scores. These were killed by the formatting.
I will have to retry my code,  By the way, your post looks nice....
Will have to play around with the formatting for future posts.
Thanks

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: %ifdef
« Reply #3 on: September 29, 2009, 06:09:45 PM »
My code has underscores, too! Or did, at one time. I "monitor" the forum, and the email version I get is less mutilated, but still not right. There are some cryptic hieroglyphics above where I'm typing. Maybe if I RTFM I could figure it out, but I don't see why I should learn a new programming language just to post some source code! Below the space where I'm typing, it says I can use "Markdown syntax". Is that like a "markup language", only on the cheap?

This forum software has always mangled source code, but thus latest "upgrade" is by far the worst. Pretty unacceptable, for a site devoted to source code!

The guys who run SourceForge aren't stupid, and they seem to care about what they're doing. I don't understand why it's such a problem, but apparently it is...

A couple weeks ago, someone posted to the "website" forum:


This is not a forum, is like a mailing group, because of this i've created a forum: http://assembly.s2.bizhat.com/


I don't know how this forum is "like a mailing group", or why he posted it to the "website forum". Last I looked, this new forum had virtually no traffic. No idea how it treats source code - it could hardly be worse. Maybe we should give 'em some?

In general, I think communication about asm is much too "scattered". In general, I'm not in favor of "new groups" - there are too many for me to monitor as it is. But this thing is just "sitting there"... Just an observation....

Best,
Frank

Link isn't clickable(?). Try this(?). Oh, my word...

[link text][1]


[1]: http://assembly.s2.bizhat.com/