From aac392e8c08a0bcbecd1d8b3ee2ada3b4ab77dbd Mon Sep 17 00:00:00 2001 From: helge Date: Tue, 16 Aug 2005 19:37:29 +0000 Subject: [PATCH] improved saxxml, install sope-ical SAX driver in /Library git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1037 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-ical/versitSaxDriver/ChangeLog | 3 ++ .../versitSaxDriver/GNUmakefile.preamble | 7 +++ sope-ical/versitSaxDriver/Version | 2 +- sope-xml/GNUmakefile | 4 -- sope-xml/samples/ChangeLog | 6 +++ sope-xml/samples/saxxml.m | 54 ++++++++++++++++++- 6 files changed, 70 insertions(+), 6 deletions(-) diff --git a/sope-ical/versitSaxDriver/ChangeLog b/sope-ical/versitSaxDriver/ChangeLog index 41453d46..b45991ed 100644 --- a/sope-ical/versitSaxDriver/ChangeLog +++ b/sope-ical/versitSaxDriver/ChangeLog @@ -1,5 +1,8 @@ 2005-08-16 Helge Hess + * install into /Library/SaxDrivers-4.5 when compiling for frameworks + (v4.5.18) + * GNUmakefile.preamble: added support for OSX frameworks (v4.5.17) 2005-06-02 Helge Hess diff --git a/sope-ical/versitSaxDriver/GNUmakefile.preamble b/sope-ical/versitSaxDriver/GNUmakefile.preamble index 075ec3c5..c9a09c65 100644 --- a/sope-ical/versitSaxDriver/GNUmakefile.preamble +++ b/sope-ical/versitSaxDriver/GNUmakefile.preamble @@ -3,6 +3,13 @@ SOPE_ROOT=../.. SOPE_OBJ_ROOT=$(GNUSTEP_BUILD_DIR)/$(SOPE_ROOT) +ifeq ($(FOUNDATION_LIB),apple) +ifeq ($(frameworks),yes) +BUNDLE_INSTALL_DIR := /Library/SaxDrivers-$(MAJOR_VERSION).$(MINOR_VERSION)/ +endif +endif + + ADDITIONAL_INCLUDE_DIRS += \ -I$(SOPE_ROOT)/sope-xml \ -I$(SOPE_ROOT)/sope-core/NGExtensions diff --git a/sope-ical/versitSaxDriver/Version b/sope-ical/versitSaxDriver/Version index da06aa73..5fbb9f75 100644 --- a/sope-ical/versitSaxDriver/Version +++ b/sope-ical/versitSaxDriver/Version @@ -1,3 +1,3 @@ # Version file -SUBMINOR_VERSION:=17 +SUBMINOR_VERSION:=18 diff --git a/sope-xml/GNUmakefile b/sope-xml/GNUmakefile index 46588642..8d1aa82f 100644 --- a/sope-xml/GNUmakefile +++ b/sope-xml/GNUmakefile @@ -12,14 +12,10 @@ SUBPROJECTS = \ XmlRpc \ samples -ifneq ($(frameworks),yes) - SUBPROJECTS += STXSaxDriver ifeq ($(HAS_LIBRARY_xml2),yes) SUBPROJECTS += libxmlSAXDriver endif -endif - include $(GNUSTEP_MAKEFILES)/aggregate.make diff --git a/sope-xml/samples/ChangeLog b/sope-xml/samples/ChangeLog index 21621003..0a195060 100644 --- a/sope-xml/samples/ChangeLog +++ b/sope-xml/samples/ChangeLog @@ -1,3 +1,9 @@ +2005-08-16 Helge Hess + + * saxxml.m: print a usage information in case no arguments are given or + the --help argument is used. Print SAX driver lookup directories when + --dirs option is given + 2005-05-03 Helge Hess * fixed gcc 4.0 warnings, changed for new DOM implemention names diff --git a/sope-xml/samples/saxxml.m b/sope-xml/samples/saxxml.m index 047fa28f..d5e5caed 100644 --- a/sope-xml/samples/saxxml.m +++ b/sope-xml/samples/saxxml.m @@ -38,6 +38,40 @@ @end +@interface SaxXMLReaderFactory(Pathes) +- (NSArray *)saxReaderSearchPathes; +@end + +static void usage(const char *n) { + fprintf(stderr, + "Usage: %s ...\n" + "\n" + "Arguments (Defaults):\n" + " -XMLReader - select the SAX driver class\n" + " --dirs - just print the dirs containing drivers\n" + "\n" + "Samples:\n" + " %s /etc/X11/xkb/rules/xfree86.xml\n" + " %s -XMLReader STXSaxDriver structured-document.stx\n" + " %s -XMLReader VSiCalSaxDriver event.ics\n" + " %s -XMLReader VSvCardSaxDriver steve.vcf\n" + , n, n, n, n, n); +} + +static void listSaxScanDirs(void) { + NSArray *a; + unsigned i, count; + + a = [[SaxXMLReaderFactory standardXMLReaderFactory] saxReaderSearchPathes]; + for (i = 0, count = [a count]; i < count; i++) + printf("%s\n", [[a objectAtIndex:i] cString]); + + if (i == 0) { + fprintf(stderr, "found no search pathes!\n"); + exit(1); + } +} + int main(int argc, char **argv, char **env) { id parser; id sax; @@ -45,6 +79,7 @@ int main(int argc, char **argv, char **env) { NSString *path; NSAutoreleasePool *pool; NSString *cwd; + BOOL hadPath = NO; pool = [[NSAutoreleasePool alloc] init]; #if LIB_FOUNDATION_LIBRARY @@ -75,13 +110,25 @@ int main(int argc, char **argv, char **env) { paths = [[[NSProcessInfo processInfo] arguments] objectEnumerator]; [paths nextObject]; - while ((path = [paths nextObject])) { + while ((path = [paths nextObject]) != nil) { NSAutoreleasePool *pool; + if ([path isEqualToString:@"--help"]) { + usage(argv[0]); + exit(0); + } + + if ([path isEqualToString:@"--dirs"]) { + listSaxScanDirs(); + exit(0); + } + if ([path hasPrefix:@"-"]) { /* consume defaults */ [paths nextObject]; continue; } + + hadPath = YES; pool = [[NSAutoreleasePool alloc] init]; @@ -98,6 +145,11 @@ int main(int argc, char **argv, char **env) { [pool release]; } + + if (!hadPath) { + usage(argv[0]); + exit(1); + } /* cleanup */ -- 2.39.5