From: Adam Krolnik (adamk@cyrix.com)
Date: Mon Oct 26 1998 - 02:34:01 PST
Good afternoon Steve, Tom;
I gave this example:
$swrite(string, err_msg[`THIS_ERR], address, exp_data, receive_data);
report_error(string);
Steve wrote, "All of the format strings have to use the same pattern of format specifiers because they are printing the same arguments."
This is not correct. This example is a from an error reporting system. The
messages are stored in a table (array) for convenience and uniqueness.
They are referenced throughout the code and passed to $swrite where they
are intepreted as format strings. The remaining arguments to $swrite are
dependent on the context - each message may have different arguments!
E.g.
$swrite(string, err_msg[`MSG_FWIP], mod_name, index, exp_num);
...
$swrite(string, err_msg[`MSG_BDAT], me, addr, exp_data, r_data);
...
$swrite(string, err_msg[`MSG_ERRD], last_num, last_time, tag, addr);
<p>Steve wrote, "And yet he is asking us to rewrite that same large functionality by changing the definition of it from string literal formats to variable ones."
I am not quite sure exactly what you oppose, having a format string represented
by a register, or having one format string? I would agree to support multiple
format strings as they currently work so long as the second argument is intepreted
as a format string and not a decimal number.
E.g. The $swrite() calls produce identical results in 'stringvar'.
first_fmt_string = "%d format string";
$swrite(stringvar,"%d format string", var, " %d another format string", var);
$swrite(stringvar,"%d format string %d another format string", var, var);
$swrite(stringvar,first_fmt_string, var, " %d another format string", var);
This makes $swrite work like $write in all cases except the last one.There was
a suggestion on the conference call to make another system task, or another
format specifier to handle a register as a format string - but was received
with cool responses. An alternate name change was also suggested but received
the same way.
This archive was generated by hypermail 2.1.4
: Mon Jul 08 2002 - 12:53:00 PDT
and
sponsored by Boyd Technology, Inc.