fixed for newer gcc objective c syntax/compile blah

This commit is contained in:
Dan Ballard 2013-01-30 22:05:22 -08:00
parent 694d03a826
commit 92fa074635
2 changed files with 20 additions and 5 deletions

View File

@ -558,7 +558,7 @@ foreach $l (@langs)
# So gcc stoped compiling if teh linking was done before the soruce file was specified # So gcc stoped compiling if teh linking was done before the soruce file was specified
# go figure # go figure
$gcc_code = 0; $gcc_code = 0;
if ($l =~ /^ca?[23]?$/) { if ($l =~ /^o?b?j?ca?[23]?$/) {
$gcc_code = 1; $gcc_code = 1;
} }

View File

@ -2,16 +2,29 @@
// haplo@mindstab.net // haplo@mindstab.net
#include <objc/Object.h> #include <objc/Object.h>
#include <stdio.h>
#include "math.h" #include "math.h"
@interface Primes: Object @interface Primes
{ {
} }
- print:(unsigned int)MAX; - (void)print:(unsigned int)MAX;
+ (id)alloc;
- (id)init;
@end @end
@implementation Primes @implementation Primes
- print:(unsigned int)MAX + (id)alloc
{
return self;
}
- (id)init
{
return self;
}
- (void)print:(unsigned int)MAX
{ {
unsigned int cnt, test, i; unsigned int cnt, test, i;
char isPrime; char isPrime;
@ -48,6 +61,8 @@ int main(int argc, char **argv)
printf("Invalid Max Num\n"); printf("Invalid Max Num\n");
return(1); return(1);
} }
primes = [Primes alloc]; printf("allocing\n");
primes = [[Primes alloc] init];
printf("calling\n");
[primes print:max]; [primes print:max];
} }