From fa8bf26a94cd0ac747dd252090eabda7f6ab2bed Mon Sep 17 00:00:00 2001 From: CaS Date: Sat, 13 Oct 2001 08:51:54 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@11131 72102866-910b-0410-8b05-ffd578937521 --- Source/GSFFCallInvocation.m | 2 +- Source/NSProtocolChecker.m | 10 +++---- Testing/containers.m | 4 +-- Tools/AGSOutput.h | 2 +- Tools/AGSOutput.m | 52 ++++++++++++++++++++++++++++++++++--- Tools/autogsdoc.m | 42 +++++++++++++++++++++++++++++- Tools/plmerge.m | 18 ++++++------- 7 files changed, 108 insertions(+), 22 deletions(-) diff --git a/Source/GSFFCallInvocation.m b/Source/GSFFCallInvocation.m index f2cd05c3a..21c060554 100644 --- a/Source/GSFFCallInvocation.m +++ b/Source/GSFFCallInvocation.m @@ -113,7 +113,7 @@ ReturnTypeEqualsReturnType (vacallReturnTypeInfo *a, vacallReturnTypeInfo *b) #define GSI_MAP_RELEASE_KEY(X) ; #define GSI_MAP_RELEASE_VAL(X) ; -#import +#include /* This determines the number of precomputed callback data entries. The list is indexed diff --git a/Source/NSProtocolChecker.m b/Source/NSProtocolChecker.m index 1a95890a4..4c556e7af 100644 --- a/Source/NSProtocolChecker.m +++ b/Source/NSProtocolChecker.m @@ -22,11 +22,11 @@ */ #include "config.h" -#import -#import -#import -#import -#import +#include +#include +#include +#include +#include @implementation NSProtocolChecker diff --git a/Testing/containers.m b/Testing/containers.m index 722d67f15..5013e4e53 100644 --- a/Testing/containers.m +++ b/Testing/containers.m @@ -1,5 +1,5 @@ -#import -#import +#include +#include @interface Foo: NSObject { diff --git a/Tools/AGSOutput.h b/Tools/AGSOutput.h index 68e265dfe..9ae40e17d 100644 --- a/Tools/AGSOutput.h +++ b/Tools/AGSOutput.h @@ -12,7 +12,6 @@ modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - You should have received a copy of the GNU General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, @@ -31,6 +30,7 @@ NSCharacterSet *spacenl; // Blanks excluding newline } +- (NSString*) output: (NSDictionary*)d; - (BOOL) output: (NSDictionary*)d file: (NSString*)name; - (void) outputMethod: (NSDictionary*)d to: (NSMutableString*)str; - (void) outputUnit: (NSDictionary*)d to: (NSMutableString*)str; diff --git a/Tools/AGSOutput.m b/Tools/AGSOutput.m index 430988e29..d40e20ffa 100644 --- a/Tools/AGSOutput.m +++ b/Tools/AGSOutput.m @@ -51,7 +51,7 @@ return self; } -- (BOOL) output: (NSDictionary*)d file: (NSString*)name +- (NSString*) output: (NSDictionary*)d { NSMutableString *str = [NSMutableString stringWithCapacity: 10240]; NSDictionary *classes; @@ -260,6 +260,12 @@ [str appendString: @" \n"]; [str appendString: @"\n"]; + return str; +} + +- (BOOL) output: (NSDictionary*)d file: (NSString*)name +{ + NSString *str = [self output: d]; return [str writeToFile: name atomically: YES]; } @@ -814,19 +820,59 @@ } else { + /* + * We want param=value sequences to be standardised to + * not have spaces around the equals sign. + */ + if (*ptr == '=') + { + elideSpace = YES; + if (optr[-1] == ' ') + { + optr--; + } + } + else + { + elideSpace = NO; + } *optr++ = *ptr++; - elideSpace = NO; } } if (*ptr == '>') { + /* + * remove space immediately before closing bracket. + */ + if (optr[-1] == ' ') + { + optr--; + } *optr++ = *ptr++; } if (optr != buf) { NSString *tmp; - tmp = [NSString stringWithCharacters: buf length: ptr - buf]; + /* + * Ensure that elements with no content ('/>' endings) + * are standardised to have a space before their terminators. + */ + if (optr[-2] == '/' && optr[-3] != ' ') + { + unsigned len = ptr - buf; + unichar c[len + 1]; + + memcpy(c, buf, (len+1)*sizeof(unichar)); + c[len-2] = ' '; + c[len-1] = '/'; + c[len] = '>'; + tmp = [NSString stringWithCharacters: c length: len+1]; + } + else + { + tmp = [NSString stringWithCharacters: buf length: ptr - buf]; + } [a addObject: tmp]; } buf = ptr; diff --git a/Tools/autogsdoc.m b/Tools/autogsdoc.m index f5f497ae1..87a19d5d6 100644 --- a/Tools/autogsdoc.m +++ b/Tools/autogsdoc.m @@ -139,6 +139,13 @@ #include "AGSParser.h" #include "AGSOutput.h" +#include + +#if HAVE_LIBXML +#include + +static int XML_ELEMENT_NODE; +#endif int main(int argc, char **argv, char **env) @@ -191,6 +198,7 @@ main(int argc, char **argv, char **env) NSString *ddir; NSString *sdir; NSString *file; + NSString *generated; file = [[arg lastPathComponent] stringByDeletingPathExtension]; @@ -229,7 +237,39 @@ main(int argc, char **argv, char **env) [parser parseFile: sdir isSource: YES]; } - [output output: [parser info] file: ddir]; + generated = [output output: [parser info]]; + +#if HAVE_LIBXML + { + NSData *data; + GSXMLParser *parser; + + /* + * Cache XML node information. + */ + XML_ELEMENT_NODE + = [GSXMLNode typeFromDescription: @"XML_ELEMENT_NODE"]; + + data = [generated dataUsingEncoding: NSUTF8StringEncoding]; + parser = [GSXMLParser parser]; + [parser substituteEntities: YES]; + [parser doValidityChecking: YES]; + if ([parser parse: data] == NO || [parser parse: nil] == NO) + { + NSLog(@"WARNING %@ did not produce a valid document", arg); + } + if (![[[[parser doc] root] name] isEqualToString: @"gsdoc"]) + { + NSLog(@"not a gsdoc document - because name node is %@", + [[[parser doc] root] name]); + return 1; + } + } +#endif + if ([generated writeToFile: ddir atomically: YES] == NO) + { + NSLog(@"Sorry unable to write %@", ddir); + } } else if ([arg hasSuffix: @".m"]) { diff --git a/Tools/plmerge.m b/Tools/plmerge.m index a71206c29..716bedc72 100644 --- a/Tools/plmerge.m +++ b/Tools/plmerge.m @@ -18,15 +18,15 @@ */ -#import -#import -#import -#import -#import -#import -#import -#import -#import +#include +#include +#include +#include +#include +#include +#include +#include +#include int main(int argc, char** argv, char **env)