On Wed, 23 May 2007, Klaas-Jan Stol wrote:

> > There are some magic numbers, like 255, and some other very unclear code
> > snippets like:
> > 
> >   for (i = 0; *command && isalpha((int) *command); command++, i++)
> >         c += (tolower((int) *command) + (i + 1)) * ((i + 1) * 255);
> > 
> > 
> > This needs some comments. If anybody knows what's going on there, please
> > enlighten me and fellow readers :-)

This code just maps command strings into integers for easier use with the 
switch() statement elsewhere in the file.  The list of names/numbers is 
pregenerated in include/parrot/debug.h.  See the section starting:

/*
 * These constants correspond to the debugger commands and are
 * used in src/debug.c. To map command strings to their
 * numeric values, use the algorithm from parse_command() in that file.
 */

#define c_b             25245
[etc.]

-- 
    Andy Dougherty              [EMAIL PROTECTED]

Reply via email to