Re: send_to_charf, Take 2

From: Peter Ajamian (
Date: 07/10/01

George Greer wrote:
>   actf(TO_CHAR, 0, "You are hungry.\r\n", ch);
>   actf(TO_ROOM, 0, "$n is hungry.\r\n", ch);

I was thinking more like this:

actf(TO_CHAR, 0, "$cYou tickle $n.\r\n", ch, tch);
actf(TO_CHAR, 0, "$c$n tickles you.\r\n", tch, ch);
actf(TO_NOTCHAR, 0, "$c$c$n tickles $n.\r\n", ch, tch, ch, tch);

Note that you'd have the following target parameters:
$c = char (or not char)
$i = object (could target room, and possiblty the char who is
carrying/wearing the object)
$r = room (room and zone targets only)

Of the rest of the existing $ parameters we would keep the following:
$n, $m, $s, $e, $o, $p, $a, $F(?), $u, $U, $$

Of course (just as an aside thought), most of those are relatively easy
to do with %s without the formatter (ie, you can always use %s and
GET_NAME(ch) instead of $n and ch) but I think that may be moving
backwards (something to ponder, at any rate).

> That's a bit of abuse of variable arguments, no?

How so?

> Not that we could use GCC
> printf format checking anyway due to handling $-style parameters ourselves.

Hrmmm, I see what you mean.  I can't help but think there's got to be a
way to extract or change parameters from the list and pass the balance
on to the vsprintf() function.  Possibly we could manually dig into the
internals of the compiler to manipulate the va_list, we would have to
define our own custom macros for each supported platform to do that,
though (and looking at my own, I'm at a loss to see how, exactly, it
would be done, everything is defined from builtins).  Anyone know of a
_portable_ way to manipulate a va_list, or to build a new one?

Too bad we have to stay Windoze (and others) compatible, GNU has
facilities to specify our own printf() conversion functions.  Do Windoze
and other platforms have similar functions?  It _could_ be made to work
via that route.

Regards, Peter

   | FAQ: |
   | Archives: |

This archive was generated by hypermail 2b30 : 12/06/01 PST