From 7d7cd42261768f77f83c8b1fa0c3b021bef10629 Mon Sep 17 00:00:00 2001 From: helge Date: Mon, 11 Jul 2005 14:14:42 +0000 Subject: [PATCH] started HelloForm git-svn-id: http://svn.opengroupware.org/SOPE/trunk@883 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/samples/HelloForm/ChangeLog | 4 + sope-appserver/samples/HelloForm/GNUmakefile | 13 +++ .../samples/HelloForm/GNUmakefile.preamble | 9 ++ sope-appserver/samples/HelloForm/HelloWorld.m | 47 ++++++++++ sope-appserver/samples/HelloForm/Main.m | 86 +++++++++++++++++++ .../samples/HelloForm/Main.wo/Main.html | 14 +++ .../samples/HelloForm/Main.wo/Main.wod | 5 ++ sope-appserver/samples/HelloForm/common.h | 3 + 8 files changed, 181 insertions(+) create mode 100644 sope-appserver/samples/HelloForm/ChangeLog create mode 100644 sope-appserver/samples/HelloForm/GNUmakefile create mode 100644 sope-appserver/samples/HelloForm/GNUmakefile.preamble create mode 100644 sope-appserver/samples/HelloForm/HelloWorld.m create mode 100644 sope-appserver/samples/HelloForm/Main.m create mode 100644 sope-appserver/samples/HelloForm/Main.wo/Main.html create mode 100644 sope-appserver/samples/HelloForm/Main.wo/Main.wod create mode 100644 sope-appserver/samples/HelloForm/common.h diff --git a/sope-appserver/samples/HelloForm/ChangeLog b/sope-appserver/samples/HelloForm/ChangeLog new file mode 100644 index 00000000..eb60fc5a --- /dev/null +++ b/sope-appserver/samples/HelloForm/ChangeLog @@ -0,0 +1,4 @@ +2005-07-11 Helge Hess + + * created by copying HelloWorld + diff --git a/sope-appserver/samples/HelloForm/GNUmakefile b/sope-appserver/samples/HelloForm/GNUmakefile new file mode 100644 index 00000000..294501f1 --- /dev/null +++ b/sope-appserver/samples/HelloForm/GNUmakefile @@ -0,0 +1,13 @@ +# GNUstep makefile + +-include ../../../config.make +include $(GNUSTEP_MAKEFILES)/common.make + +WOAPP_NAME = HelloForm + +HelloForm_OBJC_FILES += HelloForm.m Main.m +HelloForm_COMPONENTS += Main.wo + +-include GNUmakefile.preamble +include $(GNUSTEP_MAKEFILES)/woapp.make +-include GNUmakefile.postamble diff --git a/sope-appserver/samples/HelloForm/GNUmakefile.preamble b/sope-appserver/samples/HelloForm/GNUmakefile.preamble new file mode 100644 index 00000000..76f949a3 --- /dev/null +++ b/sope-appserver/samples/HelloForm/GNUmakefile.preamble @@ -0,0 +1,9 @@ +# compile settings + +# static references required for Mach linker + +ADDITIONAL_TOOL_LIBS += \ + -lEOControl \ + -lDOM -lXmlRpc -lSaxObjC + +ADDITIONAL_LIB_DIRS += -L/usr/local/lib -L/usr/lib diff --git a/sope-appserver/samples/HelloForm/HelloWorld.m b/sope-appserver/samples/HelloForm/HelloWorld.m new file mode 100644 index 00000000..0f833754 --- /dev/null +++ b/sope-appserver/samples/HelloForm/HelloWorld.m @@ -0,0 +1,47 @@ +/* + Copyright (C) 2004-2005 SKYRIX Software AG + + This file is part of SOPE. + + SOPE is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + SOPE is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with SOPE; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#include + +@interface HelloForm : WOApplication +{ +} + +@end + +#include "common.h" + +@implementation HelloForm +@end /* HelloForm */ + +int main(int argc, char **argv, char **env) { + NSAutoreleasePool *pool; + + pool = [[NSAutoreleasePool alloc] init]; +#if LIB_FOUNDATION_LIBRARY + [NSProcessInfo initializeWithArguments:argv count:argc environment:env]; +#endif + + WOApplicationMain(@"HelloForm", argc, (void*)argv); + + [pool release]; + return 0; +} diff --git a/sope-appserver/samples/HelloForm/Main.m b/sope-appserver/samples/HelloForm/Main.m new file mode 100644 index 00000000..0817fc06 --- /dev/null +++ b/sope-appserver/samples/HelloForm/Main.m @@ -0,0 +1,86 @@ +/* + Copyright (C) 2000-2005 SKYRIX Software AG + + This file is part of SOPE. + + SOPE is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + SOPE is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public + License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with SOPE; see the file COPYING. If not, write to the + Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. +*/ + +#include + +@class NSArray; + +@interface Main : WOComponent +{ + NSArray *items; + id item; +} + +@end + +#include "common.h" + +@implementation Main + +- (id)initWithContext:(id)_ctx { + if ((self = [super initWithContext:_ctx])) { + NSMutableArray *ma; + int i; + + ma = [[NSMutableArray alloc] init]; + for (i = 0; i < 1000; i++) { + char buf[16]; + NSString *s; + sprintf(buf, "%i", i); + s = [[NSString alloc] initWithCString:buf]; + [ma addObject:s]; + [s release]; + } + self->items = ma; + } + return self; +} + +- (void)dealloc { + [self->items release]; + [self->item release]; + [super dealloc]; +} + +/* accessors */ + +- (void)setItem:(id)_item { + ASSIGN(self->item, _item); +} +- (id)item { + return self->item; +} + +- (NSArray *)list { + return self->items; +} + +/* response generation */ + +- (void)appendToResponse:(WOResponse *)_r inContext:(WOContext *)_ctx { + NSDate *s; + + s = [NSDate date]; + [super appendToResponse:_r inContext:_ctx]; + printf("duration: %.3f\n", [[NSDate date] timeIntervalSinceDate:s]); +} + +@end /* Main */ diff --git a/sope-appserver/samples/HelloForm/Main.wo/Main.html b/sope-appserver/samples/HelloForm/Main.wo/Main.html new file mode 100644 index 00000000..bbca2e38 --- /dev/null +++ b/sope-appserver/samples/HelloForm/Main.wo/Main.html @@ -0,0 +1,14 @@ + + + + + Hello World + + +

Hello World

+ + Application Name: + <#AppName/> (Hash), + (WO) + + diff --git a/sope-appserver/samples/HelloForm/Main.wo/Main.wod b/sope-appserver/samples/HelloForm/Main.wo/Main.wod new file mode 100644 index 00000000..e79ffd96 --- /dev/null +++ b/sope-appserver/samples/HelloForm/Main.wo/Main.wod @@ -0,0 +1,5 @@ +// $Id$ + +AppName: WOString { + value = application.name; +} \ No newline at end of file diff --git a/sope-appserver/samples/HelloForm/common.h b/sope-appserver/samples/HelloForm/common.h new file mode 100644 index 00000000..13127494 --- /dev/null +++ b/sope-appserver/samples/HelloForm/common.h @@ -0,0 +1,3 @@ + +#import +#include -- 2.39.5