Re: Rouge compile-time errors and warnings
Re: Rouge compile-time errors and warnings
- Subject: Re: Rouge compile-time errors and warnings
- From: Anders Totland <email@hidden>
- Date: Sun, 7 Sep 2003 12:19:52 +0200
Hi Jens
On Sunday, Sep 7, 2003, at 10:07 Europe/Oslo, Jens Bjerrehuus wrote:
>
Hello Anders,
>
>
It's hard to tell what's wrong without seeing the source for these
>
errors. But I'm quite sure your application doesn't build
>
correctlywith the compiler finding 62 errors during compilation.
>
Generally, I'd say you should handle every warning (and definitely
>
every error) the compiler reports to you.
I'm quite sure that it does. I've run it multiple times, from Finder
and PB, and it runs on the testing machines. The errors are in no way
harmful or blocking, they're just there, preventing me from getting
quick acces to the ACTUAL errors and warnings. They are more of an
annoyance, really.
>
>
As for one thing that is concretely wrong in this:
>
>
lxrdag 6. sep 2003 kl. 22:19 skrev Anders Totland:
>
> does not respond to setState:" and "syntax error, found 'alloc'" in
>
> the kind of line: "myObject = [[[myClass alloc] init] retain];", same
>
> line further down triggers the error "syntax error, found 'retain'"
>
>
You shouldn't retain that object as you already own it because you
>
just alloc'ed it. Any object that you acquire through alloc is
>
already retained for you and it is your responsibility to later
>
release that object. See e.g. this:
>
http://www.stepwise.com/Articles/Technical/2001-03-11.01.html for a
>
short introduction to memory management in Cocoa.
I know that, and I've fixed a few of my allocs, not all tho. It has so
far removed 1 error... (I'm now down to 65 errors and 39 warnings.)
>
>
lxrdag 6. sep 2003 kl. 22:19 skrev Anders Totland:
>
> This is PB 2.0.1 July 2002, with gcc v3.1
>
>
There's a newer release from December last year. You can get that
>
from the developer site at Apple.
I know, did that yesterday night, didn't solve a thing.
>
>
Kind regards
>
Jens
>
Ok, code snippet and build log snippet follows:
// code snippet
- (void)drawWithStyle:(int)drawStyle alpha:(float)alpha
{
NSBezierPath *childrenPath = [NSBezierPath bezierPath];
NSBezierPath *ballPath = [NSBezierPath bezierPath];
NSBezierPath *borderPath = [NSBezierPath bezierPath];
int loopFlag = 0;
if ([__children count] != 0) {
while (loopFlag <= [__children count] - 1) {
if (drawStyle == B3SVDrawStyleBlackBoard) {
[childrenPath moveToPoint:__center];
[childrenPath relativeMoveToPoint:NSMakePoint(10 *
cos(3.1415/180.0*[[[__children objectAtIndex:loopFlag]
objectForKey:ANGLE] floatValue]), 10 * sin(3.1415/180.0*[[[__children
objectAtIndex:loopFlag] objectForKey:ANGLE] floatValue]))];
[childrenPath relativeLineToPoint:NSMakePoint(22 *
cos(3.1415/180.0*[[[__children objectAtIndex:loopFlag]
objectForKey:ANGLE] floatValue]), 22 * sin(3.1415/180.0*[[[__children
objectAtIndex:loopFlag] objectForKey:ANGLE] floatValue]))];
} else {
[childrenPath moveToPoint:__center];
if ((drawStyle == B3SVDrawStyleSimpleStructure && [[[__children
objectAtIndex:loopFlag] objectForKey:ATOM] _tag] != @"H") || drawStyle
!= B3SVDrawStyleSimpleStructure) {
[childrenPath relativeLineToPoint:NSMakePoint(32 *
cos(3.1415/180.0*[[[__children objectAtIndex:loopFlag]
objectForKey:ANGLE] floatValue]), 32 * sin(3.1415/180.0*[[[__children
objectAtIndex:loopFlag] objectForKey:ANGLE] floatValue]))];
}
}
loopFlag ++;
}
}
switch (drawStyle) {
case B3SVDrawStyleRegular :
[ballPath appendBezierPathWithOvalInRect:NSMakeRect(__center.x -
__diameter / 2, __center.y - __diameter / 2, __diameter, __diameter)];
[borderPath appendBezierPathWithOvalInRect:NSMakeRect(__center.x -
__diameter / 2, __center.y - __diameter / 2, __diameter, __diameter)];
[[NSColor blueColor] set];
break;
case B3SVDrawStyleSimpleStructure :
[[NSColor blackColor] set];
break;
case B3SVDrawStyleBlackBoard :
[[NSColor whiteColor] set];
break;
}
[childrenPath stroke];
[__color set];
[ballPath fill];
if (selected) {
NSBezierPath *selPath = [NSBezierPath
bezierPathWithOvalInRect:NSMakeRect(__center.x - __diameter / 2,
__center.y - __diameter / 2, __diameter, __diameter)];
[selPath setLineWidth:4.0];
[[NSColor selectedTextBackgroundColor] set];
[selPath stroke];
}
[[NSColor blackColor] set];
[borderPath stroke];
if (drawStyle != B3SVDrawStyleSimpleStructure) {
NSSize tagSize = [__tag sizeWithAttributes:[SVAtom
fontAttributesForDrawStyle:drawStyle]];
[__tag drawAtPoint:NSMakePoint(__center.x - tagSize.width / 2,
__center.y - tagSize.height / 2) withAttributes:[SVAtom
fontAttributesForDrawStyle:drawStyle]];
}
NSEnumerator *enumerator = [__children objectEnumerator];
id anObject;
while (anObject = [enumerator nextObject]) {
[[anObject objectForKey:ATOM] drawWithStyle:drawStyle alpha:alpha];
}
}
// build log
SVAtom.m:42: syntax error, found `objectForKey'
SVAtom.m:42: illegal expression, found `unknown'
SVAtom.m:42: illegal expression, found `)'
SVAtom.m:49: illegal external declaration, found `switch'
SVAtom.m:51: undefined type, found `ballPath'
SVAtom.m:51: illegal external declaration, missing `;' after
`appendBezierPathWithOvalInRect'
SVAtom.m:51: illegal method definition, found `/'
SVAtom.m:51: illegal method definition, missing `{' after `]'
SVAtom.m:52: illegal external declaration, found `['
SVAtom.m:52: undefined type, found `borderPath'
SVAtom.m:52: illegal external declaration, missing `;' after
`appendBezierPathWithOvalInRect'
SVAtom.m:52: illegal method definition, found `/'
SVAtom.m:52: illegal method definition, missing `{' after `]'
SVAtom.m:53: illegal external declaration, found `['
SVAtom.m:53: illegal external declaration, missing `;' after `blueColor'
SVAtom.m:57: illegal external declaration, missing `;' after
`blackColor'
SVAtom.m:61: illegal external declaration, missing `;' after
`whiteColor'
SVAtom.m:64: undefined type, found `childrenPath'
SVAtom.m:64: illegal external declaration, missing `;' after `stroke'
SVAtom.m:65: undefined type, found `__color'
SVAtom.m:65: illegal external declaration, missing `;' after `set'
SVAtom.m:66: undefined type, found `ballPath'
SVAtom.m:66: illegal external declaration, missing `;' after `fill'
SVAtom.m:69: illegal external declaration, found `['
SVAtom.m:69: undefined type, found `selPath'
SVAtom.m:69: illegal external declaration, missing `;' after
`setLineWidth'
SVAtom.m:70: illegal external declaration, missing `;' after
`selectedTextBackgroundColor'
SVAtom.m:71: undefined type, found `selPath'
SVAtom.m:71: illegal external declaration, missing `;' after `stroke'
SVAtom.m:73: illegal external declaration, missing `;' after
`blackColor'
SVAtom.m:74: undefined type, found `borderPath'
SVAtom.m:74: illegal external declaration, missing `;' after `stroke'
SVAtom.m:77: illegal external declaration, found `['
SVAtom.m:77: undefined type, found `__tag'
SVAtom.m:77: illegal external declaration, missing `;' after
`drawAtPoint'
SVAtom.m:77: illegal method definition, found `.'
SVAtom.m:77: illegal method definition, missing `{' after `]'
SVAtom.m:81: illegal external declaration, found `while'
SVAtom.m:81: undefined type, found `enumerator'
SVAtom.m:81: illegal external declaration, missing `;' after
`nextObject'
SVAtom.m:82: undefined type, found `anObject'
SVAtom.m:82: illegal external declaration, missing `;' after
`objectForKey'
SVAtom.m:82: undefined type, found `drawStyle'
SVAtom.m:82: illegal external declaration, missing `;' after `alpha'
"A guy once asked me for a cup of coffee. So I bit him."
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.