Browse Source

String fixes for the Console stuff.

Darryl Pogue 14 years ago
parent
commit
fd71861316
  1. 14
      Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp
  2. 15
      Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.cpp
  3. 12
      Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.h
  4. 6
      Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.cpp
  5. 2
      Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.h

14
Sources/Plasma/FeatureLib/pfConsole/pfConsoleCommands.cpp

@ -841,7 +841,7 @@ PF_CONSOLE_CMD( Console, SetVar, "string name, string value",
hsBool oldF = ctx.GetAddWhenNotFound();
ctx.SetAddWhenNotFound( true );
ctx.SetVar( params[ 0 ], params[ 1 ] );
ctx.SetVar((char*)params[ 0 ], (char*)params[ 1 ] );
ctx.SetAddWhenNotFound( oldF );
}
@ -2251,17 +2251,17 @@ PF_CONSOLE_CMD( App,
char* eventStr = params[1];
CallbackEvent event;
if( !_stricmp(eventStr, "Start") )
if( !stricmp(eventStr, "Start") )
{
event = kStart;
}
else
if( !_stricmp(eventStr, "Stop") )
if( !stricmp(eventStr, "Stop") )
{
event = kStop;
}
else
if( !_stricmp(eventStr, "Time") )
if( !stricmp(eventStr, "Time") )
{
event = kTime;
secs = params[2];
@ -2306,17 +2306,17 @@ PF_CONSOLE_CMD( App,
char* eventStr = params[1];
CallbackEvent event;
if( !_stricmp(eventStr, "Start") )
if( !stricmp(eventStr, "Start") )
{
event = kStart;
}
else
if( !_stricmp(eventStr, "Stop") )
if( !stricmp(eventStr, "Stop") )
{
event = kStop;
}
else
if( !_stricmp(eventStr, "Time") )
if( !stricmp(eventStr, "Time") )
{
event = kTime;
secs = params[2];

15
Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.cpp

@ -43,7 +43,7 @@ UInt32 pfConsoleCmdGroup::fBaseCmdGroupRef = 0;
//// Constructor & Destructor ////////////////////////////////////////////////
pfConsoleCmdGroup::pfConsoleCmdGroup( char *name, char *parent )
pfConsoleCmdGroup::pfConsoleCmdGroup(const char *name, const char *parent )
{
fNext = nil;
fPrevPtr = nil;
@ -160,7 +160,7 @@ pfConsoleCmd *pfConsoleCmdGroup::FindNestedPartialCommand( char *name, UInt32
// Try us
for( cmd = fCommands; cmd != nil; cmd = cmd->GetNext() )
{
if( _strnicmp( cmd->GetName(), name, strlen( name ) ) == 0 )
if(strnicmp( cmd->GetName(), name, strlen( name ) ) == 0 )
{
if( *counter == 0 )
return cmd;
@ -250,7 +250,7 @@ pfConsoleCmd *pfConsoleCmdGroup::FindCommandNoCase( char *name, UInt8 flags,
{
for( cmd = start; cmd != nil; cmd = cmd->GetNext() )
{
if( _strnicmp( cmd->GetName(), name, strlen( name ) ) == 0 )
if(strnicmp( cmd->GetName(), name, strlen( name ) ) == 0 )
return cmd;
}
}
@ -285,7 +285,7 @@ pfConsoleCmdGroup *pfConsoleCmdGroup::FindSubGroupNoCase( char *name, UInt8 fl
{
for( group = start; group != nil; group = group->GetNext() )
{
if( _strnicmp( group->GetName(), name, strlen( name ) ) == 0 )
if(strnicmp( group->GetName(), name, strlen( name ) ) == 0 )
return group;
}
}
@ -355,7 +355,8 @@ int pfConsoleCmdGroup::IterateCommands(pfConsoleCmdIterator* t, int depth)
char pfConsoleCmd::fSigTypes[ kNumTypes ][ 8 ] = { "int", "float", "bool", "string", "char", "void", "..." };
pfConsoleCmd::pfConsoleCmd( char *group, char *name, char *paramList, char *help,
pfConsoleCmd::pfConsoleCmd(const char *group, const char *name,
const char *paramList, const char *help,
pfConsoleCmdPtr func, hsBool localOnly )
{
fNext = nil;
@ -390,7 +391,7 @@ pfConsoleCmd::~pfConsoleCmd()
//// ICreateSignature ////////////////////////////////////////////////////////
// Creates the signature and sig labels based on the given string.
void pfConsoleCmd::ICreateSignature( char *paramList )
void pfConsoleCmd::ICreateSignature(const char *paramList )
{
static char seps[] = " :-";
@ -461,7 +462,7 @@ void pfConsoleCmd::ICreateSignature( char *paramList )
// Finds the group this command should be in and registers it with that
// group.
void pfConsoleCmd::Register( char *group, char *name )
void pfConsoleCmd::Register(const char *group, const char *name )
{
pfConsoleCmdGroup *g;

12
Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleCmd.h

@ -65,7 +65,7 @@ class pfConsoleCmdGroup
kFindPartial = 0x01
};
pfConsoleCmdGroup( char *name, char *parent );
pfConsoleCmdGroup(const char *name, const char *parent );
~pfConsoleCmdGroup();
void AddCommand( pfConsoleCmd *cmd );
@ -159,7 +159,7 @@ class pfConsoleCmd
{
protected:
char fName[ 128 ];
char *fHelpString;
const char* fHelpString;
pfConsoleCmdPtr fFunction;
hsBool fLocalOnly;
@ -172,7 +172,7 @@ class pfConsoleCmd
hsExpander<UInt8> fSignature;
hsExpander<char *> fSigLabels;
void ICreateSignature( char *paramList );
void ICreateSignature(const char *paramList );
public:
@ -192,10 +192,10 @@ class pfConsoleCmd
static char fSigTypes[ kNumTypes ][ 8 ];
pfConsoleCmd( char *group, char *name, char *paramList, char *help, pfConsoleCmdPtr func, hsBool localOnly = false );
pfConsoleCmd(const char *group, const char *name, const char *paramList, const char *help, pfConsoleCmdPtr func, hsBool localOnly = false );
~pfConsoleCmd();
void Register( char *group, char *name );
void Register(const char *group, const char *name );
void Unregister();
void Execute( Int32 numParams, pfConsoleCmdParam *params, void (*PrintFn)( const char * ) = nil );
@ -204,7 +204,7 @@ class pfConsoleCmd
pfConsoleCmd *GetNext( void ) { return fNext; }
char *GetName( void ) { return fName; }
char *GetHelp( void ) { return fHelpString; }
const char *GetHelp( void ) { return fHelpString; }
const char *GetSignature( void );
pfConsoleCmdGroup *GetParent( void ) { return fParentGroup; }

6
Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.cpp

@ -149,8 +149,10 @@ hsBool pfConsoleEngine::PrintCmdHelp( char *name, void (*PrintFn)( const char *
PrintFn( " Commands:" );
for( cmd = group->GetFirstCommand(); cmd != nil; cmd = cmd->GetNext() )
{
for( ptr = cmd->GetHelp(), i = 0; ptr[ i ] != 0 && ptr[ i ] != '\n'; i++ )
tempString[ i ] = ptr[ i ];
const char* p = cmd->GetHelp();
for(i = 0; p[ i ] != 0 && p[ i ] != '\n'; i++) {
tempString[ i ] = p[ i ];
}
tempString[ i ] = 0;
sprintf( string, " %s: %s", cmd->GetName(), tempString );

2
Sources/Plasma/FeatureLib/pfConsoleCore/pfConsoleEngine.h

@ -58,7 +58,7 @@ class pfConsoleEngine
char fErrorMsg[ 128 ];
char fLastErrorLine[ 512 ];
void ISetErrorMsg( char *msg ) { hsStrncpy( fErrorMsg, msg, sizeof( fErrorMsg ) ); }
void ISetErrorMsg(const char *msg ) { hsStrncpy( fErrorMsg, msg, sizeof( fErrorMsg ) ); }
// Recursive function to build a string of the groups a command is in
void IBuildCmdNameRecurse( pfConsoleCmdGroup *group, char *string );

Loading…
Cancel
Save