Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / February 2010



Tip: Looking for answers? Try searching our database.

odd behavior of if

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Santa Claus - 28 Feb 2010 03:21 GMT
now THIS is extremely odd

it appears that if isn't being properly tested.
[commandLine string] contains @"-help"

- (IBAction)sendCommandLine:(id)sender
{
 [command setString: [commandLine string]];
 long returnval = 1;
 long i = 0;
 long count = [thePlugins count];
 
 // ensure all plugins get sent the command line
 NSLog(@"%@, %@, %ld, %ld",command, [thePlugins objectAtIndex: i],
[thePlugins count], returnval);
 for(i = 0; i < count; i++)
   {
   if(![[thePlugins objectAtIndex: i] processCommand: &command])
     {
     returnval = 0;
     }
   NSLog(@"%@, %@, %ld, %ld",command, [thePlugins objectAtIndex: i],
[thePlugins count], returnval);
   }

 NSLog(@"%@, %ld",command, returnval);
 if (returnval == 1);
 {
   NSLog(@"found returnval");
   [command insertString: @"--> " atIndex: 0];
   [command appendString: @"\r\n"];
   [gameWindow setString: [[gameWindow string] stringByAppendingString:
command]];
 }
 NSLog(@"%@, %ld",command, returnval);
 [commandLine setString: @""];
 [gameWindow scrollRangeToVisible: NSMakeRange([[gameWindow string]
length] - 1, 1)];
}

log:
2010-02-27 22:14:47.323 YASSE Exerciser[3057] -help, YASSE expander.  
This is the script engine AND the other added features., 1, 1
2010-02-27 22:14:47.330 YASSE Exerciser[3057]
/Users/robertde/Documents/Simutronics/Plugins/YASSE.expander/Contents/Res
ources/help.txt
2010-02-27 22:14:47.339 YASSE Exerciser[3057] -help, YASSE expander.  
This is the script engine AND the other added features., 1, 0
2010-02-27 22:14:47.339 YASSE Exerciser[3057] -help, 0
2010-02-27 22:14:47.339 YASSE Exerciser[3057] found returnval
2010-02-27 22:14:47.339 YASSE Exerciser[3057] --> -help
, 0

i've tried at first with BOOL value and used YES/NO when the logs told
me it's not being processed properly.  am i too tired to notice
something painfully obvious or what?
Santa Claus - 28 Feb 2010 03:26 GMT
>   if (returnval == 1);

found the line. yup, something painfully obvious.
nix the semicolon at the end fixed the problem
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.