From 92fa0746357f094ed445f811d32c3b340df7c4ef Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Wed, 30 Jan 2013 22:05:22 -0800 Subject: [PATCH] fixed for newer gcc objective c syntax/compile blah --- autoTest.pl | 2 +- primes.m | 23 +++++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/autoTest.pl b/autoTest.pl index 9a4cd21..e3e6457 100755 --- a/autoTest.pl +++ b/autoTest.pl @@ -558,7 +558,7 @@ foreach $l (@langs) # So gcc stoped compiling if teh linking was done before the soruce file was specified # go figure $gcc_code = 0; - if ($l =~ /^ca?[23]?$/) { + if ($l =~ /^o?b?j?ca?[23]?$/) { $gcc_code = 1; } diff --git a/primes.m b/primes.m index b5cf968..638544f 100644 --- a/primes.m +++ b/primes.m @@ -2,16 +2,29 @@ // haplo@mindstab.net #include +#include #include "math.h" -@interface Primes: Object +@interface Primes { } -- print:(unsigned int)MAX; +- (void)print:(unsigned int)MAX; ++ (id)alloc; +- (id)init; @end @implementation Primes -- print:(unsigned int)MAX ++ (id)alloc +{ + return self; +} + +- (id)init +{ + return self; +} + +- (void)print:(unsigned int)MAX { unsigned int cnt, test, i; char isPrime; @@ -48,6 +61,8 @@ int main(int argc, char **argv) printf("Invalid Max Num\n"); return(1); } - primes = [Primes alloc]; + printf("allocing\n"); + primes = [[Primes alloc] init]; + printf("calling\n"); [primes print:max]; }