Re: buf, buf1, buf2, arg: J J & E

From: George Greer (greerga@circlemud.org)
Date: 07/21/01


On Sat, 21 Jul 2001, Ron Cole wrote:

>>-      sprintf(buf, "You say, '%s'\r\n", argument);
>>-      send_to_char(buf, ch);
>>+      send_to_char(ch, "You say, '%s'\r\n", argument);
>
>Wouldn't it be a bit more intuitive and compatable with patches/addins to do:
>
>+      send_to_charf(ch, "You say, '%s'\r\n", argument);
>
>And leave the old send_to_char in there, even if just a macro?

Do we want:

  #define send_to_char(x, y) send_to_charf(y, x)

until eternity [1] or

  s/
  send_to_char(\s*)\((\s*)(.*)(\s*),(\s*)(.*)(\s*)\)
  /send_to_char$1($2$6$4, "%s", $5$3$6)/gx

  (or if you use CircleMUD-spacing:)

  s/send_to_char\((.*), (.*)\)/send_to_char($2, "%s", $1)/g;

Perl, sed, and even Microsoft tools can do regular expression search &
replace.  The Microsoft versions change the expression tokens a bit though.
You'll have to fix the few multi-line send_to_char() calls but that's no
big deal.

I'd prefer it to be fixed, obviously.  That's why you get a sufficient
warning.  bpl19 won't have it but bpl20 will.  The impact of the changes
justifies the flag day.  You have at least 4 months to get everything
ready.

Will everybody move to the new system? I doubt it.  I suspect some people
with existing codebases won't want to change everything for fear of how
long it would take.  It only took me two days (~12 hours) to delete the
global variables, replace send_to_char, replace mudlog, and delete a bunch
of sprintf() calls.  Given the patch it shouldn't take people that long to
fix stuff. Especially with the search & replace feature.

--
George Greer
greerga@circlemud.org

1 - Don't even mention 'argument_interpreter'. :P

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



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