rom24b6olc help

Posted by To4ri2n0 on Thu 27 Feb 2003 12:26 AM — 2 posts, 15,031 views.

#0
I use win98 and cygwin, I got rom24b4a to go with no probs just some simple hacking of the code but when I tried to patch olc to it I got nothing. So now I'm trying to use rom24b6olc and I can't get it to compile. Heres the output:

special.c: In function 'spec string':
special.c:1037: subscripted value is neither array nor pointer
make: *** [special.o] Error1

Here is special.c 1037:

for ( cmd = 0; spec_table[cmd].function[0] != '\0'; cmd++ )

Here is the whole bunch that contains 1037:

/* OLC Inserted */
/*****************************************************************************
Name: spec_string
Purpose: Given a function, return the appropriate name.
Called by: <???>
****************************************************************************/
char *spec_string( SPEC_FUN *fun ) /* OLC */
{
int cmd;

for ( cmd = 0; spec_table[cmd].function[0] != '\0'; cmd++ )
if ( fun == spec_table[cmd].function )
return spec_table[cmd].name;

return 0;
}

I have seen this prob posted to a number of different forums and on everyone the replys do not even try to answer the prob. So if you know what I can do to make this work PLEASE tell me. Thanks
Australia #1
I'll take a wild stab at it:
char *spec_string(SPEC_FUN *fun) /* OLC */
{
    int cmd;

    for (cmd = 0; spec_table[cmd].function[0] != '\0'; cmd++)
        if (fun == spec_table[cmd].function)
            return spec_table[cmd].name;

    return 0;
}
Okay. so fun is a pointer to a SPEC_FUN, which I'm assuming isn't an array, and you compare fun to spec_table[cmd].function, so I'm assuming that .function is also a pointer to a SPEC_FUN.. so your problem would be "spec_table[cmd].function[0] != '\0'". Try changing it to "spec_table[cmd].function != NULL" perhaps? Look at the bottom of spec_table, and see how the last element defines itself. Hope this helps.

Dave