<snip>
#define SETSUP(supstate,key) \
{
__asm ( " MODESET KEY=%0,MODE=%1 \n" : "=s"(supstate), "=s"(key) ) \
} \
</snip>
Once again you have failed to provide useful information to the readers,
such as the error messages you received. I'd guess you received something
such as, if invoking SETSUP(ZERO,SUP):
CCN3045 Undeclared identifier ZERO.
CCN3045 Undeclared identifier SUP.
There should be no "variables".
But getting other things out of the way first, the substitutions such as
"=s" need to be in the same order as their "%n" notation.
So %0 is the first, but that's on "KEY" and your first is for "supstate".
So if nothing else, the "=s" things are backwards, or you should use %1 on
KEY and %0 on MODE.
The real problem is that you need to make sure to get the string literal
specified properly.
But I'd ask a simpler question: do C macros substitute within
double-quoted strings?
If they do then
... __asm ( " MODESET KEY=supstate,MODE=key\n" ) ...
could work. Unfortunately, at least in a simple case, there is no
substitution into the quoted string.
That leads to the next question: Can __asm be built by concatenating
things together such as the "known text" and the "macro variables"? I
don't know the answer to that.
It's too bad that C's macro processor is so weak..
My SHARE presentation (s8739 from Share 2011 Anaheim) did not cover "=s".
I've never tried it. "s" is defined as "Use a string literal operand", so
you must provide a string literal, and string literals are enclosed in
quotes.
This is valid syntax:
__asm ( " MODESET KEY=%0,MODE=%1 \n" : : "=s"("ZERO"), "=s"("SUP") );
And the compiler nicely strips off the quotes, resulting in
MODESET KEY=ZERO,MODE=SUP
This is not valid syntax (the "=s" operands are not enclosed in quotes)
__asm ( " MODESET KEY=%0,MODE=%1 \n" : : "=s"(ZERO), "=s"(SUP) );
So if you define your macro properly, and invoke it properly, I'd imagine
that it would work.
Did you try invoking your macro with SETSUP("ZERO","SUP")?
Peter Relson
z/OS Core Technology Design
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN