mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Get parser to spot unimplemented methods.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22109 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ac8adde2b9
commit
80dc6f2589
5 changed files with 121 additions and 33 deletions
|
@ -1,3 +1,11 @@
|
|||
2005-11-28 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Tools/AGSOutput.m:
|
||||
* Tools/AGSParser.h:
|
||||
* Tools/AGSParser.m:
|
||||
Update to log warning about unimplemented methods which are not
|
||||
tagged as "<override-subclass />". ie intentionally empty.
|
||||
|
||||
2005-11-22 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSPathUtilities.m: Restructure so that GNUstepConfig() can
|
||||
|
|
|
@ -39,26 +39,26 @@
|
|||
|
||||
- (NSString*) checkComment: (NSString*)comment
|
||||
unit: (NSString*)unit
|
||||
info: (NSDictionary*)d;
|
||||
info: (NSMutableDictionary*)d;
|
||||
- (unsigned) fitWords: (NSArray*)a
|
||||
from: (unsigned)start
|
||||
to: (unsigned)end
|
||||
maxSize: (unsigned)limit
|
||||
output: (NSMutableString*)buf;
|
||||
- (NSArray*) output: (NSDictionary*)d;
|
||||
- (void) outputDecl: (NSDictionary*)d
|
||||
- (NSArray*) output: (NSMutableDictionary*)d;
|
||||
- (void) outputDecl: (NSMutableDictionary*)d
|
||||
kind: (NSString*)kind
|
||||
to: (NSMutableString*)str;
|
||||
- (void) outputFunction: (NSDictionary*)d to: (NSMutableString*)str;
|
||||
- (void) outputInstanceVariable: (NSDictionary*)d
|
||||
- (void) outputFunction: (NSMutableDictionary*)d to: (NSMutableString*)str;
|
||||
- (void) outputInstanceVariable: (NSMutableDictionary*)d
|
||||
to: (NSMutableString*)str
|
||||
for: (NSString*)unit;
|
||||
- (void) outputMacro: (NSDictionary*)d
|
||||
- (void) outputMacro: (NSMutableDictionary*)d
|
||||
to: (NSMutableString*)str;
|
||||
- (void) outputMethod: (NSDictionary*)d
|
||||
- (void) outputMethod: (NSMutableDictionary*)d
|
||||
to: (NSMutableString*)str
|
||||
for: (NSString*)unit;
|
||||
- (void) outputUnit: (NSDictionary*)d to: (NSMutableString*)str;
|
||||
- (void) outputUnit: (NSMutableDictionary*)d to: (NSMutableString*)str;
|
||||
- (unsigned) reformat: (NSString*)str
|
||||
withIndent: (unsigned)ind
|
||||
to: (NSMutableString*)buf;
|
||||
|
|
|
@ -97,7 +97,10 @@ static BOOL snuggleStart(NSString *t)
|
|||
unit: (NSString*)unit
|
||||
info: (NSDictionary*)d
|
||||
{
|
||||
if ([comment length] == 0)
|
||||
NSString *empty = [d objectForKey: @"Empty"];
|
||||
BOOL hadComment = ([comment length] == 0 ? NO : YES);
|
||||
|
||||
if (hadComment == NO)
|
||||
{
|
||||
comment = @"<em>Description forthcoming.</em>";
|
||||
if (warn == YES)
|
||||
|
@ -130,6 +133,38 @@ static BOOL snuggleStart(NSString *t)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (empty != nil && [empty boolValue] == YES)
|
||||
{
|
||||
#if 0
|
||||
static NSString *today = nil;
|
||||
|
||||
if (today == nil)
|
||||
{
|
||||
NSCalendarDate *d = [NSCalendarDate date];
|
||||
|
||||
today
|
||||
= RETAIN([d descriptionWithCalendarFormat: @"%d-%m-%Y"]);
|
||||
}
|
||||
if (hadComment == NO)
|
||||
{
|
||||
comment = @"";
|
||||
}
|
||||
comment = [NSString stringWithFormat:
|
||||
@"<em>Not implemented (as of %@).</em><br />"
|
||||
@"Please help us by producing an implementation of this "
|
||||
@"and donating it to the GNUstep project.<br />"
|
||||
@"You can check the task manager at "
|
||||
@"https://savannah.gnu.org/projects/gnustep "
|
||||
@"to see if anyone is already working on it.<br />",
|
||||
today, comment];
|
||||
#else
|
||||
NSString *name = [d objectForKey: @"Name"];
|
||||
|
||||
NSLog(@"Warning - No implementation for [%@ %@]", unit, name);
|
||||
#endif
|
||||
}
|
||||
|
||||
return comment;
|
||||
}
|
||||
|
||||
|
@ -251,7 +286,7 @@ static BOOL snuggleStart(NSString *t)
|
|||
* Return an array containing the names of any files modified as
|
||||
* a result of outputing the specified data structure.
|
||||
*/
|
||||
- (NSArray*) output: (NSDictionary*)d
|
||||
- (NSArray*) output: (NSMutableDictionary*)d
|
||||
{
|
||||
NSMutableString *str = [NSMutableString stringWithCapacity: 10240];
|
||||
NSDictionary *classes;
|
||||
|
@ -435,8 +470,8 @@ static BOOL snuggleStart(NSString *t)
|
|||
names = [names sortedArrayUsingSelector: @selector(compare:)];
|
||||
for (i = 0; i < c; i++)
|
||||
{
|
||||
NSString *name = [names objectAtIndex: i];
|
||||
NSDictionary *d = [classes objectForKey: name];
|
||||
NSString *name = [names objectAtIndex: i];
|
||||
NSMutableDictionary *d = [classes objectForKey: name];
|
||||
|
||||
[self outputUnit: d to: str];
|
||||
}
|
||||
|
@ -453,8 +488,8 @@ static BOOL snuggleStart(NSString *t)
|
|||
names = [names sortedArrayUsingSelector: @selector(compare:)];
|
||||
for (i = 0; i < c; i++)
|
||||
{
|
||||
NSString *name = [names objectAtIndex: i];
|
||||
NSDictionary *d = [categories objectForKey: name];
|
||||
NSString *name = [names objectAtIndex: i];
|
||||
NSMutableDictionary *d = [categories objectForKey: name];
|
||||
|
||||
[self outputUnit: d to: str];
|
||||
}
|
||||
|
@ -471,8 +506,8 @@ static BOOL snuggleStart(NSString *t)
|
|||
names = [names sortedArrayUsingSelector: @selector(compare:)];
|
||||
for (i = 0; i < c; i++)
|
||||
{
|
||||
NSString *name = [names objectAtIndex: i];
|
||||
NSDictionary *d = [protocols objectForKey: name];
|
||||
NSString *name = [names objectAtIndex: i];
|
||||
NSMutableDictionary *d = [protocols objectForKey: name];
|
||||
|
||||
[self outputUnit: d to: str];
|
||||
}
|
||||
|
@ -493,8 +528,8 @@ static BOOL snuggleStart(NSString *t)
|
|||
names = [names sortedArrayUsingSelector: @selector(compare:)];
|
||||
for (i = 0; i < c; i++)
|
||||
{
|
||||
NSString *name = [names objectAtIndex: i];
|
||||
NSDictionary *d = [types objectForKey: name];
|
||||
NSString *name = [names objectAtIndex: i];
|
||||
NSMutableDictionary *d = [types objectForKey: name];
|
||||
|
||||
[self outputDecl: d kind: @"type" to: m];
|
||||
}
|
||||
|
@ -529,8 +564,8 @@ static BOOL snuggleStart(NSString *t)
|
|||
names = [names sortedArrayUsingSelector: @selector(compare:)];
|
||||
for (i = 0; i < c; i++)
|
||||
{
|
||||
NSString *name = [names objectAtIndex: i];
|
||||
NSDictionary *d = [constants objectForKey: name];
|
||||
NSString *name = [names objectAtIndex: i];
|
||||
NSMutableDictionary *d = [constants objectForKey: name];
|
||||
|
||||
[self outputDecl: d kind: @"constant" to: m];
|
||||
}
|
||||
|
@ -565,8 +600,8 @@ static BOOL snuggleStart(NSString *t)
|
|||
names = [names sortedArrayUsingSelector: @selector(compare:)];
|
||||
for (i = 0; i < c; i++)
|
||||
{
|
||||
NSString *name = [names objectAtIndex: i];
|
||||
NSDictionary *d = [macros objectForKey: name];
|
||||
NSString *name = [names objectAtIndex: i];
|
||||
NSMutableDictionary *d = [macros objectForKey: name];
|
||||
|
||||
[self outputMacro: d to: m];
|
||||
}
|
||||
|
@ -601,8 +636,8 @@ static BOOL snuggleStart(NSString *t)
|
|||
names = [names sortedArrayUsingSelector: @selector(compare:)];
|
||||
for (i = 0; i < c; i++)
|
||||
{
|
||||
NSString *name = [names objectAtIndex: i];
|
||||
NSDictionary *d = [variables objectForKey: name];
|
||||
NSString *name = [names objectAtIndex: i];
|
||||
NSMutableDictionary *d = [variables objectForKey: name];
|
||||
|
||||
[self outputDecl: d kind: @"variable" to: m];
|
||||
}
|
||||
|
@ -637,8 +672,8 @@ static BOOL snuggleStart(NSString *t)
|
|||
names = [names sortedArrayUsingSelector: @selector(compare:)];
|
||||
for (i = 0; i < c; i++)
|
||||
{
|
||||
NSString *name = [names objectAtIndex: i];
|
||||
NSDictionary *d = [functions objectForKey: name];
|
||||
NSString *name = [names objectAtIndex: i];
|
||||
NSMutableDictionary *d = [functions objectForKey: name];
|
||||
|
||||
[self outputFunction: d to: m];
|
||||
}
|
||||
|
@ -686,7 +721,7 @@ static BOOL snuggleStart(NSString *t)
|
|||
/**
|
||||
* Uses -split: and -reformat:withIndent:to:.
|
||||
*/
|
||||
- (void) outputDecl: (NSDictionary*)d
|
||||
- (void) outputDecl: (NSMutableDictionary*)d
|
||||
kind: (NSString*)kind
|
||||
to: (NSMutableString*)str
|
||||
{
|
||||
|
@ -730,7 +765,7 @@ static BOOL snuggleStart(NSString *t)
|
|||
/**
|
||||
* Uses -split: and -reformat:withIndent:to:.
|
||||
*/
|
||||
- (void) outputFunction: (NSDictionary*)d to: (NSMutableString*)str
|
||||
- (void) outputFunction: (NSMutableDictionary*)d to: (NSMutableString*)str
|
||||
{
|
||||
NSArray *aa = [d objectForKey: @"Args"];
|
||||
NSString *pref = [d objectForKey: @"Prefix"];
|
||||
|
@ -828,7 +863,7 @@ static BOOL snuggleStart(NSString *t)
|
|||
/**
|
||||
* Output the gsdoc code for an instance variable.
|
||||
*/
|
||||
- (void) outputInstanceVariable: (NSDictionary*)d
|
||||
- (void) outputInstanceVariable: (NSMutableDictionary*)d
|
||||
to: (NSMutableString*)str
|
||||
for: (NSString*)unit
|
||||
{
|
||||
|
@ -865,7 +900,7 @@ static BOOL snuggleStart(NSString *t)
|
|||
/**
|
||||
* Uses -split: and -reformat:withIndent:to:.
|
||||
*/
|
||||
- (void) outputMacro: (NSDictionary*)d
|
||||
- (void) outputMacro: (NSMutableDictionary*)d
|
||||
to: (NSMutableString*)str
|
||||
{
|
||||
NSString *name = [d objectForKey: @"Name"];
|
||||
|
@ -916,7 +951,7 @@ static BOOL snuggleStart(NSString *t)
|
|||
* Uses -split: and -reformat:withIndent:to:.
|
||||
* Also has fun with YES, NO, and nil.
|
||||
*/
|
||||
- (void) outputMethod: (NSDictionary*)d
|
||||
- (void) outputMethod: (NSMutableDictionary*)d
|
||||
to: (NSMutableString*)str
|
||||
for: (NSString*)unit
|
||||
{
|
||||
|
@ -983,6 +1018,11 @@ static BOOL snuggleStart(NSString *t)
|
|||
[m deleteCharactersInRange: r];
|
||||
comment = m;
|
||||
override = @"subclass";
|
||||
/*
|
||||
* If a method should be overridden by subclasses,
|
||||
* we don't treat it as unimplemented.
|
||||
*/
|
||||
[d setObject: @"NO" forKey: @"Empty"];
|
||||
}
|
||||
} while (r.length > 0);
|
||||
do
|
||||
|
@ -1055,7 +1095,7 @@ static BOOL snuggleStart(NSString *t)
|
|||
args = nil;
|
||||
}
|
||||
|
||||
- (void) outputUnit: (NSDictionary*)d to: (NSMutableString*)str
|
||||
- (void) outputUnit: (NSMutableDictionary*)d to: (NSMutableString*)str
|
||||
{
|
||||
NSString *name = [d objectForKey: @"Name"];
|
||||
NSString *type = [d objectForKey: @"Type"];
|
||||
|
|
|
@ -101,6 +101,7 @@
|
|||
- (void) setupBuffer;
|
||||
- (unsigned) skipArray;
|
||||
- (unsigned) skipBlock;
|
||||
- (unsigned) skipBlock: (BOOL*)isEmpty;
|
||||
- (unsigned) skipLiteral;
|
||||
- (unsigned) skipRemainderOfLine;
|
||||
- (unsigned) skipSpaces;
|
||||
|
|
|
@ -2513,7 +2513,17 @@ fail:
|
|||
}
|
||||
else if (term == '{')
|
||||
{
|
||||
[self skipBlock];
|
||||
BOOL isEmpty;
|
||||
|
||||
[self skipBlock: &isEmpty];
|
||||
if (isEmpty == YES)
|
||||
{
|
||||
[method setObject: @"YES" forKey: @"Empty"];
|
||||
}
|
||||
else
|
||||
{
|
||||
[method setObject: @"NO" forKey: @"Empty"];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2621,6 +2631,7 @@ fail:
|
|||
NSArray *a1;
|
||||
NSString *c0;
|
||||
NSString *c1;
|
||||
NSString *e;
|
||||
|
||||
/*
|
||||
* Merge info from implementation into existing version.
|
||||
|
@ -2668,6 +2679,15 @@ fail:
|
|||
[self appendComment: c1 to: exist];
|
||||
}
|
||||
[exist setObject: @"YES" forKey: @"Implemented"];
|
||||
|
||||
/*
|
||||
* Record if the implementation is not empty.
|
||||
*/
|
||||
e = [method objectForKey: @"Empty"];
|
||||
if (e != nil)
|
||||
{
|
||||
[exist setObject: e forKey: @"Empty"];
|
||||
}
|
||||
}
|
||||
DESTROY(comment); // Don't want this.
|
||||
break;
|
||||
|
@ -3699,8 +3719,14 @@ fail:
|
|||
* bracket at the start of a block.
|
||||
*/
|
||||
- (unsigned) skipBlock
|
||||
{
|
||||
return [self skipBlock: 0];
|
||||
}
|
||||
|
||||
- (unsigned) skipBlock: (BOOL*)isEmpty
|
||||
{
|
||||
unichar term = '}';
|
||||
BOOL empty = YES;
|
||||
|
||||
if (buffer[pos] == '(')
|
||||
{
|
||||
|
@ -3723,21 +3749,25 @@ fail:
|
|||
|
||||
case '\'':
|
||||
case '"':
|
||||
empty = NO;
|
||||
pos--;
|
||||
[self skipLiteral];
|
||||
break;
|
||||
|
||||
case '{':
|
||||
empty = NO;
|
||||
pos--;
|
||||
[self skipBlock];
|
||||
break;
|
||||
|
||||
case '(':
|
||||
empty = NO;
|
||||
pos--;
|
||||
[self skipBlock];
|
||||
break;
|
||||
|
||||
case '[':
|
||||
empty = NO;
|
||||
pos--;
|
||||
[self skipBlock];
|
||||
break;
|
||||
|
@ -3745,10 +3775,19 @@ fail:
|
|||
default:
|
||||
if (c == term)
|
||||
{
|
||||
if (isEmpty != 0)
|
||||
{
|
||||
*isEmpty = empty;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
empty = NO;
|
||||
}
|
||||
}
|
||||
if (isEmpty != 0)
|
||||
{
|
||||
*isEmpty = empty;
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue