diff --git a/Applications/ScriptPapers/AppController.h b/Applications/ScriptPapers/AppController.h
new file mode 100644
index 0000000..4a6cd4d
--- /dev/null
+++ b/Applications/ScriptPapers/AppController.h
@@ -0,0 +1,31 @@
+/** Controller
+
+ Copyright (c) 2003 Stefan Urbanek
+
+ Written by: Stefan Urbanek
+ Date: 2003 Apr 26
+
+ This file is part of the Farmer application.
+
+ This library 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 of the License, or (at your option) any later version.
+
+ This library 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#import
+
+@interface AppController : NSObject
+{
+}
+@end
diff --git a/Applications/ScriptPapers/AppController.m b/Applications/ScriptPapers/AppController.m
new file mode 100644
index 0000000..675c93f
--- /dev/null
+++ b/Applications/ScriptPapers/AppController.m
@@ -0,0 +1,58 @@
+/** Controller
+
+ Copyright (c) 2003 Stefan Urbanek
+
+ Written by: Stefan Urbanek
+ Date: 2003 Apr 26
+
+ This file is part of the Farmer application.
+
+ This library 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 of the License, or (at your option) any later version.
+
+ This library 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#import "AppController.h"
+
+#import
+#import
+#import
+
+#import
+#import
+
+#import "ScriptPaper.h"
+#import "ScriptPaperController.h"
+
+@interface AppController(Private)
+@end
+
+@implementation AppController
+- init
+{
+ [super init];
+
+
+ return self;
+}
+- (void)dealloc
+{
+ [super dealloc];
+}
+- (void)applicationDidFinishLaunching:(id)notif
+{
+ /* Go to known state of application */
+ [[NSDocumentController sharedDocumentController] newDocument:nil];
+}
+@end
diff --git a/Applications/ScriptPapers/English.lproj/Paper.gorm/data.classes b/Applications/ScriptPapers/English.lproj/Paper.gorm/data.classes
new file mode 100644
index 0000000..89feb74
--- /dev/null
+++ b/Applications/ScriptPapers/English.lproj/Paper.gorm/data.classes
@@ -0,0 +1,154 @@
+{
+ FirstResponder = {
+ Actions = (
+ "activateContextHelpMode:",
+ "alignCenter:",
+ "alignJustified:",
+ "alignLeft:",
+ "alignRight:",
+ "arrangeInFront:",
+ "cancel:",
+ "capitalizeWord:",
+ "changeColor:",
+ "changeFont:",
+ "checkSpelling:",
+ "close:",
+ "complete:",
+ "copy:",
+ "copyFont:",
+ "copyRuler:",
+ "cut:",
+ "delete:",
+ "deleteBackward:",
+ "deleteForward:",
+ "deleteToBeginningOfLine:",
+ "deleteToBeginningOfParagraph:",
+ "deleteToEndOfLine:",
+ "deleteToEndOfParagraph:",
+ "deleteToMark:",
+ "deleteWordBackward:",
+ "deleteWordForward:",
+ "deminiaturize:",
+ "deselectAll:",
+ "fax:",
+ "hide:",
+ "hideOtherApplications:",
+ "indent:",
+ "loosenKerning:",
+ "lowerBaseline:",
+ "lowercaseWord:",
+ "makeKeyAndOrderFront:",
+ "miniaturize:",
+ "miniaturizeAll:",
+ "moveBackward:",
+ "moveBackwardAndModifySelection:",
+ "moveDown:",
+ "moveDownAndModifySelection:",
+ "moveForward:",
+ "moveForwardAndModifySelection:",
+ "moveLeft:",
+ "moveRight:",
+ "moveToBeginningOfDocument:",
+ "moveToBeginningOfLine:",
+ "moveToBeginningOfParagraph:",
+ "moveToEndOfDocument:",
+ "moveToEndOfLine:",
+ "moveToEndOfParagraph:",
+ "moveUp:",
+ "moveUpAndModifySelection:",
+ "moveWordBackward:",
+ "moveWordBackwardAndModifySelection:",
+ "moveWordForward:",
+ "moveWordForwardAndModifySelection:",
+ "newDocument:",
+ "ok:",
+ "openDocument:",
+ "orderBack:",
+ "orderFront:",
+ "orderFrontColorPanel:",
+ "orderFrontDataLinkPanel:",
+ "orderFrontFontPanel:",
+ "orderFrontHelpPanel:",
+ "orderFrontSharedMemoryPanel:",
+ "orderFrontStandardAboutPanel:",
+ "orderFrontStandardInfoPanel:",
+ "orderOut:",
+ "pageDown:",
+ "pageUp:",
+ "paste:",
+ "pasteAsPlainText:",
+ "pasteAsRichText:",
+ "pasteFont:",
+ "pasteRuler:",
+ "performClose:",
+ "performMiniaturize:",
+ "performZoom:",
+ "print:",
+ "raiseBaseline:",
+ "revertDocumentToSaved:",
+ "runPageLayout:",
+ "runToolbarCustomizationPalette:",
+ "saveAllDocuments:",
+ "saveDocument:",
+ "saveDocumentAs:",
+ "saveDocumentTo:",
+ "scrollLineDown:",
+ "scrollLineUp:",
+ "scrollPageDown:",
+ "scrollPageUp:",
+ "scrollViaScroller:",
+ "selectAll:",
+ "selectLine:",
+ "selectNextKeyView:",
+ "selectParagraph:",
+ "selectPreviousKeyView:",
+ "selectText:",
+ "selectText:",
+ "selectToMark:",
+ "selectWord:",
+ "showContextHelp:",
+ "showGuessPanel:",
+ "showHelp:",
+ "showWindow:",
+ "stop:",
+ "subscript:",
+ "superscript:",
+ "swapWithMark:",
+ "takeDoubleValueFrom:",
+ "takeFloatValueFrom:",
+ "takeIntValueFrom:",
+ "takeObjectValueFrom:",
+ "takeStringValueFrom:",
+ "terminate:",
+ "tightenKerning:",
+ "toggle:",
+ "toggleContinuousSpellChecking:",
+ "toggleRuler:",
+ "toggleToolbarShown:",
+ "toggleTraditionalCharacterShape:",
+ "transpose:",
+ "transposeWords:",
+ "turnOffKerning:",
+ "turnOffLigatures:",
+ "underline:",
+ "unhide:",
+ "unhideAllApplications:",
+ "unscript:",
+ "uppercaseWord:",
+ "useAllLigatures:",
+ "useStandardKerning:",
+ "useStandardLigatures:",
+ "yank:",
+ "zoom:"
+ );
+ Super = NSObject;
+ };
+ ScriptPaperController = {
+ Actions = (
+ );
+ Outlets = (
+ sourceView
+ );
+ Super = NSWindowController;
+ };
+}
\ No newline at end of file
diff --git a/Applications/ScriptPapers/English.lproj/Paper.gorm/objects.gorm b/Applications/ScriptPapers/English.lproj/Paper.gorm/objects.gorm
new file mode 100644
index 0000000..00b8aa8
Binary files /dev/null and b/Applications/ScriptPapers/English.lproj/Paper.gorm/objects.gorm differ
diff --git a/Applications/ScriptPapers/English.lproj/ScriptPapers.gorm/data.classes b/Applications/ScriptPapers/English.lproj/ScriptPapers.gorm/data.classes
new file mode 100644
index 0000000..7b27e31
--- /dev/null
+++ b/Applications/ScriptPapers/English.lproj/ScriptPapers.gorm/data.classes
@@ -0,0 +1,155 @@
+{
+ AppController = {
+ Actions = (
+ );
+ Outlets = (
+ );
+ Super = NSObject;
+ };
+ FirstResponder = {
+ Actions = (
+ "activateContextHelpMode:",
+ "alignCenter:",
+ "alignJustified:",
+ "alignLeft:",
+ "alignRight:",
+ "arrangeInFront:",
+ "cancel:",
+ "capitalizeWord:",
+ "changeColor:",
+ "changeFont:",
+ "checkSpelling:",
+ "close:",
+ "complete:",
+ "copy:",
+ "copyFont:",
+ "copyRuler:",
+ "cut:",
+ "delete:",
+ "deleteBackward:",
+ "deleteForward:",
+ "deleteToBeginningOfLine:",
+ "deleteToBeginningOfParagraph:",
+ "deleteToEndOfLine:",
+ "deleteToEndOfParagraph:",
+ "deleteToMark:",
+ "deleteWordBackward:",
+ "deleteWordForward:",
+ "deminiaturize:",
+ "deselectAll:",
+ "fax:",
+ "hide:",
+ "hideOtherApplications:",
+ "indent:",
+ "loosenKerning:",
+ "lowerBaseline:",
+ "lowercaseWord:",
+ "makeKeyAndOrderFront:",
+ "miniaturize:",
+ "miniaturizeAll:",
+ "moveBackward:",
+ "moveBackwardAndModifySelection:",
+ "moveDown:",
+ "moveDownAndModifySelection:",
+ "moveForward:",
+ "moveForwardAndModifySelection:",
+ "moveLeft:",
+ "moveRight:",
+ "moveToBeginningOfDocument:",
+ "moveToBeginningOfLine:",
+ "moveToBeginningOfParagraph:",
+ "moveToEndOfDocument:",
+ "moveToEndOfLine:",
+ "moveToEndOfParagraph:",
+ "moveUp:",
+ "moveUpAndModifySelection:",
+ "moveWordBackward:",
+ "moveWordBackwardAndModifySelection:",
+ "moveWordForward:",
+ "moveWordForwardAndModifySelection:",
+ "newDocument:",
+ "ok:",
+ "openDocument:",
+ "orderBack:",
+ "orderFront:",
+ "orderFrontColorPanel:",
+ "orderFrontDataLinkPanel:",
+ "orderFrontFontPanel:",
+ "orderFrontHelpPanel:",
+ "orderFrontSharedMemoryPanel:",
+ "orderFrontStandardAboutPanel:",
+ "orderFrontStandardInfoPanel:",
+ "orderOut:",
+ "pageDown:",
+ "pageUp:",
+ "paste:",
+ "pasteAsPlainText:",
+ "pasteAsRichText:",
+ "pasteFont:",
+ "pasteRuler:",
+ "performClose:",
+ "performMiniaturize:",
+ "performZoom:",
+ "print:",
+ "raiseBaseline:",
+ "revertDocumentToSaved:",
+ "runPageLayout:",
+ "runToolbarCustomizationPalette:",
+ "saveAllDocuments:",
+ "saveDocument:",
+ "saveDocumentAs:",
+ "saveDocumentTo:",
+ "scrollLineDown:",
+ "scrollLineUp:",
+ "scrollPageDown:",
+ "scrollPageUp:",
+ "scrollViaScroller:",
+ "selectAll:",
+ "selectLine:",
+ "selectNextKeyView:",
+ "selectParagraph:",
+ "selectPreviousKeyView:",
+ "selectText:",
+ "selectText:",
+ "selectToMark:",
+ "selectWord:",
+ "showContextHelp:",
+ "showGuessPanel:",
+ "showHelp:",
+ "showWindow:",
+ "stop:",
+ "subscript:",
+ "superscript:",
+ "swapWithMark:",
+ "takeDoubleValueFrom:",
+ "takeFloatValueFrom:",
+ "takeIntValueFrom:",
+ "takeObjectValueFrom:",
+ "takeStringValueFrom:",
+ "terminate:",
+ "tightenKerning:",
+ "toggle:",
+ "toggleContinuousSpellChecking:",
+ "toggleRuler:",
+ "toggleToolbarShown:",
+ "toggleTraditionalCharacterShape:",
+ "transpose:",
+ "transposeWords:",
+ "turnOffKerning:",
+ "turnOffLigatures:",
+ "underline:",
+ "unhide:",
+ "unhideAllApplications:",
+ "unscript:",
+ "uppercaseWord:",
+ "useAllLigatures:",
+ "useStandardKerning:",
+ "useStandardLigatures:",
+ "yank:",
+ "zoom:",
+ "doSelection:",
+ "doAndShowSelection:"
+ );
+ Super = NSObject;
+ };
+}
\ No newline at end of file
diff --git a/Applications/ScriptPapers/English.lproj/ScriptPapers.gorm/objects.gorm b/Applications/ScriptPapers/English.lproj/ScriptPapers.gorm/objects.gorm
new file mode 100644
index 0000000..f0f6bb6
Binary files /dev/null and b/Applications/ScriptPapers/English.lproj/ScriptPapers.gorm/objects.gorm differ
diff --git a/Applications/ScriptPapers/GNUmakefile b/Applications/ScriptPapers/GNUmakefile
new file mode 100644
index 0000000..bfb591a
--- /dev/null
+++ b/Applications/ScriptPapers/GNUmakefile
@@ -0,0 +1,62 @@
+# Script Papers
+#
+# Copyright (C) 2002 Stefan Urbanek
+#
+# Written by: Stefan Urbanek
+# Date: 2003 Apr 26
+#
+# This file is part of the AgentFarms
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Library General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library 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
+# Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public
+# License along with this library; if not, write to the Free
+# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
+#
+
+include $(GNUSTEP_MAKEFILES)/common.make
+
+APP_NAME = ScriptPapers
+PACKAGE_NAME = ScriptPapers
+
+ScriptPapers_APPLICATION_ICON =
+ScriptPapers_MAIN_MODEL_FILE = ScriptPapers.gorm
+
+ADDITIONAL_GUI_LIBS += -lStepTalk
+
+############################################################################
+# ObjC files
+
+ScriptPapers_OBJC_FILES= \
+ AppController.m \
+ ScriptPaper.m \
+ ScriptPaperController.m \
+ NSObject+NibLoading.m \
+ NSTextView+additions.m \
+ main.m
+
+############################################################################
+# Resource files
+
+ScriptPapers_LOCALIZED_RESOURCE_FILES= \
+ ScriptPapers.gorm \
+ Paper.gorm
+
+ScriptPapers_RESOURCE_FILES = \
+
+
+ADDITIONAL_OBJCFLAGS =
+
+############################################################################
+
+-include GNUmakefile.preamble
+include $(GNUSTEP_MAKEFILES)/application.make
+-include GNUmakefile.postamble
diff --git a/Applications/ScriptPapers/NSObject+NibLoading.h b/Applications/ScriptPapers/NSObject+NibLoading.h
new file mode 100644
index 0000000..b943988
--- /dev/null
+++ b/Applications/ScriptPapers/NSObject+NibLoading.h
@@ -0,0 +1,31 @@
+/** NSObject+NibLoading
+
+ Copyright (c) 2002 Stefan Urbanek
+
+ Written by: Stefan Urbanek
+ Date: 2002 Oct 10
+
+ This file is part of the Farmer application.
+
+ This library 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 of the License, or (at your option) any later version.
+
+ This library 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#import
+
+@interface NSObject(AFNibLoading)
+- (BOOL)loadMyNibNamed:(NSString *)aName;
+@end
+
diff --git a/Applications/ScriptPapers/NSObject+NibLoading.m b/Applications/ScriptPapers/NSObject+NibLoading.m
new file mode 100644
index 0000000..4a8f96e
--- /dev/null
+++ b/Applications/ScriptPapers/NSObject+NibLoading.m
@@ -0,0 +1,58 @@
+/** NSObject+NibLoading
+
+ Copyright (c) 2002 Stefan Urbanek
+
+ Written by: Stefan Urbanek
+ Date: 2002 Oct 10
+
+ This file is part of the Farmer application.
+
+ This library 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 of the License, or (at your option) any later version.
+
+ This library 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#import "NSObject+NibLoading.h"
+
+#import
+
+@class AFSimulation;
+
+@implementation NSObject(AFNibLoading)
+- (BOOL)loadMyNibNamed:(NSString *)aName
+{
+ NSDictionary *dict;
+ NSBundle *bundle;
+ BOOL flag;
+
+ dict = [NSDictionary dictionaryWithObjectsAndKeys:self, @"NSOwner",
+ nil, nil];
+
+ bundle = [NSBundle bundleForClass:[self class]];
+
+ flag = [bundle loadNibFile:aName
+ externalNameTable:dict
+ withZone:[self zone]];
+
+ if(!flag)
+ {
+ NSRunAlertPanel(@"Unable to load resources",
+ @"Unable to load '%@' resources",
+ @"Cancel", nil, nil, aName);
+
+ }
+ return flag;
+}
+@end
+
diff --git a/Applications/ScriptPapers/NSTextView+additions.h b/Applications/ScriptPapers/NSTextView+additions.h
new file mode 100644
index 0000000..429f6f4
--- /dev/null
+++ b/Applications/ScriptPapers/NSTextView+additions.h
@@ -0,0 +1,31 @@
+/** NSTextView additions
+
+ Copyright (c) 2003 Stefan Urbanek
+
+ Written by: Stefan Urbanek
+ Date: 2003 Apr 26
+
+ This file is part of the Farmer application.
+
+ This library 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 of the License, or (at your option) any later version.
+
+ This library 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#import
+
+@interface NSTextView(PaperAdditions)
+- (NSString *)selectedString;
+- (BOOL)hasSelection;
+@end
diff --git a/Applications/ScriptPapers/NSTextView+additions.m b/Applications/ScriptPapers/NSTextView+additions.m
new file mode 100644
index 0000000..22fe031
--- /dev/null
+++ b/Applications/ScriptPapers/NSTextView+additions.m
@@ -0,0 +1,40 @@
+/** NSTextView additions
+
+ Copyright (c) 2003 Stefan Urbanek
+
+ Written by: Stefan Urbanek
+ Date: 2003 Apr 26
+
+ This file is part of the Farmer application.
+
+ This library 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 of the License, or (at your option) any later version.
+
+ This library 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#import "NSTextView+additions.h"
+
+@implementation NSTextView(PaperAdditions)
+- (NSString *)selectedString
+{
+ NSRange range = [self selectedRange];
+
+ return [[self attributedSubstringFromRange:range] string];
+}
+- (BOOL)hasSelection
+{
+ NSRange range = [self selectedRange];
+ return (range.length != 0);
+}
+@end
diff --git a/Applications/ScriptPapers/ScriptPaper.h b/Applications/ScriptPapers/ScriptPaper.h
new file mode 100644
index 0000000..f676608
--- /dev/null
+++ b/Applications/ScriptPapers/ScriptPaper.h
@@ -0,0 +1,35 @@
+/** ScriptPaper
+
+ Copyright (c) 2003 Stefan Urbanek
+
+ Written by: Stefan Urbanek
+ Date: 2003 Apr 26
+
+ This file is part of the Farmer application.
+
+ This library 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 of the License, or (at your option) any later version.
+
+ This library 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#import
+
+@class STEnvironment;
+@interface ScriptPaper:NSDocument
+{
+ STEnvironment *environment;
+}
+- (IBAction)doSelection:(id)sender;
+- (IBAction)doAndShowSelection:(id)sender;
+@end
diff --git a/Applications/ScriptPapers/ScriptPaper.m b/Applications/ScriptPapers/ScriptPaper.m
new file mode 100644
index 0000000..38d2af6
--- /dev/null
+++ b/Applications/ScriptPapers/ScriptPaper.m
@@ -0,0 +1,109 @@
+/** Controller
+
+ Copyright (c) 2003 Stefan Urbanek
+
+ Written by: Stefan Urbanek
+ Date: 2003 Apr 26
+
+ This file is part of the Farmer application.
+
+ This library 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 of the License, or (at your option) any later version.
+
+ This library 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#import "ScriptPaper.h"
+
+#import
+#import
+
+#import
+#import
+#import
+
+#import "ScriptPaperController.h"
+
+@implementation ScriptPaper
+- init
+{
+ [super init];
+
+ environment = [[STEnvironment alloc] initDefault];
+
+ return self;
+}
+- (void)dealloc
+{
+ [super dealloc];
+}
+
+- (void)makeWindowControllers
+{
+ ScriptPaperController *controller;
+
+ controller = [[ScriptPaperController alloc] init];
+ [controller setDocument:self];
+
+ [self addWindowController:AUTORELEASE(controller)];
+}
+- (id)executeScriptString:(NSString *)source
+{
+ STEngine *engine;
+ NSString *error;
+ id retval = nil;
+
+ engine = [STEngine engineForLanguageWithName:
+ [STLanguage defaultLanguageName]];
+ if(!engine)
+ {
+ NSLog(@"Unable to get scripting engine.");
+ return nil;
+ }
+
+ if(!environment)
+ {
+ NSLog(@"No scripting environment");
+ return nil;
+ }
+
+ NS_DURING
+ retval = [engine executeCode:source inEnvironment:environment];
+ NS_HANDLER
+ error = [NSString stringWithFormat:
+ @"Error: "
+ @"Execution of script failed. %@. (%@)",
+ [localException reason],
+ [localException name]];
+
+ // [[STTranscript sharedTranscript] showError:error];
+
+ NSLog(@"Script exception: %@", error);
+
+ retval = nil;
+ NS_ENDHANDLER
+
+ return retval;
+}
+
+- (BOOL)writeToFile:(NSString *)fileName ofType:(NSString *)fileType
+{
+ NSLog(@"Write to file %@ of type %@. (not implemented)", fileName, fileType);
+ return YES;
+}
+- (BOOL)readFromFile:(NSString *)fileName ofType:(NSString *)fileType
+{
+ NSLog(@"Read from file %@ of type %@. (not implemented)", fileName, fileType);
+ return YES;
+}
+@end
diff --git a/Applications/ScriptPapers/ScriptPaperController.h b/Applications/ScriptPapers/ScriptPaperController.h
new file mode 100644
index 0000000..f9d3696
--- /dev/null
+++ b/Applications/ScriptPapers/ScriptPaperController.h
@@ -0,0 +1,38 @@
+/** ScriptPaper
+
+ Copyright (c) 2003 Stefan Urbanek
+
+ Written by: Stefan Urbanek
+ Date: 2003 Apr 26
+
+ This file is part of the Farmer application.
+
+ This library 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 of the License, or (at your option) any later version.
+
+ This library 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#import
+
+@class ScriptPaper;
+@class NSTextView;
+@class NSForm;
+@class NSWindow;
+
+@interface ScriptPaperController:NSWindowController
+{
+ NSTextView *sourceView;
+}
+@end
+
diff --git a/Applications/ScriptPapers/ScriptPaperController.m b/Applications/ScriptPapers/ScriptPaperController.m
new file mode 100644
index 0000000..1215c3d
--- /dev/null
+++ b/Applications/ScriptPapers/ScriptPaperController.m
@@ -0,0 +1,103 @@
+/** Controller
+
+ Copyright (c) 2003 Stefan Urbanek
+
+ Written by: Stefan Urbanek
+ Date: 2003 Apr 26
+
+ This file is part of the Farmer application.
+
+ This library 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 of the License, or (at your option) any later version.
+
+ This library 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+#import "ScriptPaperController.h"
+
+#import
+
+#import
+#import
+#import
+
+#import "NSTextView+additions.h"
+
+#import "ScriptPaper.h"
+
+@implementation ScriptPaperController
+- init
+{
+ return [self initWithWindowNibName:@"Paper"];
+}
+- (void)windowDidLoad
+{
+ [sourceView setRichText:NO];
+ [sourceView setString:@"This is a paper.\n1 + 1"];
+}
+- (void)dealloc
+{
+ [super dealloc];
+}
+
+/** Execute selected text as script. */
+- (IBAction)doSelection:(id)sender
+{
+ NSString *selectedString = [sourceView selectedString];
+
+ NSLog(@"Do!");
+
+ [[self document] executeScriptString:selectedString];
+}
+
+/** Execute selected text as script and insert result into the paper. */
+- (IBAction)doAndShowSelection:(id)sender
+{
+ NSString *selectedString = [sourceView selectedString];
+ NSRange range;
+ id string;
+ int length;
+ id retval = nil;
+
+ NSLog(@"Do and Show!");
+
+ retval = [[self document] executeScriptString:selectedString];
+
+ if(!retval)
+ {
+ retval = @"(nil)";
+ }
+
+ range = [sourceView selectedRange];
+ range = NSMakeRange(NSMaxRange(range), 0);
+ [sourceView setSelectedRange:range];
+
+
+ if([retval isKindOfClass:[NSString class]]
+ || [retval isKindOfClass:[NSAttributedString class]])
+ {
+ string = retval;
+ }
+ else
+ {
+ string = [retval description];
+ }
+
+ [sourceView insertText:@" "];
+ [sourceView insertText:string];
+
+ range = NSMakeRange(range.location + 1, [string length]);
+
+}
+
+@end
diff --git a/Applications/ScriptPapers/ScriptPapersInfo.plist b/Applications/ScriptPapers/ScriptPapersInfo.plist
new file mode 100644
index 0000000..0dfdeb4
--- /dev/null
+++ b/Applications/ScriptPapers/ScriptPapersInfo.plist
@@ -0,0 +1,20 @@
+{
+ ApplicationName = "Script Papers";
+ ApplicationDescription = "Application for writing script papers.";
+ ApplicationRelease = "0.1.0";
+ Authors = ("Stefan Urbanek ");
+ Copyright = "Copyright (c) 2003 Stefan Urbanek ";
+ CopyrightDescription = "This program is released under the GNU General Public License";
+
+ NSTypes = (
+ {
+ NSUnixExtensions = ("spaper");
+ NSName = "spaper";
+ NSHumanReadableName = "Script Paper";
+ NSMIMETypes = ("application/spaper");
+ NSIcon = spaper;
+ NSRole = Editor;
+ NSDocumentClass = ScriptPaper;
+ }
+ );
+}
diff --git a/Applications/ScriptPapers/main.m b/Applications/ScriptPapers/main.m
new file mode 100644
index 0000000..7d5bdbc
--- /dev/null
+++ b/Applications/ScriptPapers/main.m
@@ -0,0 +1,37 @@
+/** main
+
+ Copyright (c) 2002 Stefan Urbanek
+
+ Written by: Stefan Urbanek
+ Date: 2002 Feb 20
+
+ This file is part of the Farmer application.
+
+ This library 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 of the License, or (at your option) any later version.
+
+ This library 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 this library; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+ */
+
+#import
+
+#define APP_NAME @"GNUstep"
+
+/*
+ * Initialise and go!
+ */
+
+int main(int argc, const char *argv[])
+{
+ return NSApplicationMain (argc, argv);
+}
diff --git a/Applications/ScriptPapers/run b/Applications/ScriptPapers/run
new file mode 100755
index 0000000..049a917
--- /dev/null
+++ b/Applications/ScriptPapers/run
@@ -0,0 +1 @@
+make debug=yes && openapp ScriptPapers.debug
diff --git a/ChangeLog b/ChangeLog
index 495678b..1d9f8ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -5,6 +5,10 @@
check for existence of ScriptingInfo.plist before using it
* Modules: reflect changes to STBundleInfo
* Updated all GNUmakefiles to use new path
+ * STEnvironment: added initDefault - this will replace confusing
+ defaultScriptingEnvironment.
+ * Added Applications
+ * Added ScriptPapers application
2003 Apr 22 Stefan Urbanek
diff --git a/Documentation/Reference/STEnvironment.gsdoc b/Documentation/Reference/STEnvironment.gsdoc
index c5215c2..3f1c9f9 100644
--- a/Documentation/Reference/STEnvironment.gsdoc
+++ b/Documentation/Reference/STEnvironment.gsdoc
@@ -84,6 +84,13 @@
bundle if it is not already loaded.
+
+ initDefault
+
+ Initialises scripting environment using default
+ description.
+
+
initWithDescription:
aDescription
diff --git a/Documentation/Reference/STEnvironment.html b/Documentation/Reference/STEnvironment.html
index 9fedc92..f05dc2b 100644
--- a/Documentation/Reference/STEnvironment.html
+++ b/Documentation/Reference/STEnvironment.html
@@ -45,6 +45,7 @@
-createsUnknownObjects
-fullScriptingEnabled
-includeBundle:
+ -initDefault
-initWithDescription:
-initWithDescriptionName:
-knownObjectNames
@@ -134,6 +135,16 @@
bundle
+
+ - (id) initDefault;
+This is a designated initialiser for the class.
+
+
+ Initialises scripting environment using default
+ description.
+
+
+
- (id) initWithDescription: (STEnvironmentDescription*)aDescription;
diff --git a/Documentation/Reference/StepTalk.igsdoc b/Documentation/Reference/StepTalk.igsdoc
index 450e1a1..07f6062 100644
--- a/Documentation/Reference/StepTalk.igsdoc
+++ b/Documentation/Reference/StepTalk.igsdoc
@@ -155,6 +155,9 @@
"-includeBundle:" = {
STEnvironment = STEnvironment;
};
+ "-initDefault" = {
+ STEnvironment = STEnvironment;
+ };
"-initWithBundle:" = {
STBundleInfo = STBundleInfo;
};
@@ -489,6 +492,7 @@
"-createsUnknownObjects" = STEnvironment;
"-fullScriptingEnabled" = STEnvironment;
"-includeBundle:" = STEnvironment;
+ "-initDefault" = STEnvironment;
"-initWithDescription:" = STEnvironment;
"-initWithDescriptionName:" = STEnvironment;
"-knownObjectNames" = STEnvironment;
diff --git a/Source/Headers/StepTalk/STEnvironment.h b/Source/Headers/StepTalk/STEnvironment.h
index 0cb125d..378b58c 100644
--- a/Source/Headers/StepTalk/STEnvironment.h
+++ b/Source/Headers/StepTalk/STEnvironment.h
@@ -60,6 +60,7 @@
+ environmentWithDescriptionName:(NSString *)descName;
+ environmentWithDescription:(STEnvironmentDescription *)aDescription;
+- initDefault;
- initWithDescriptionName:(NSString *)descName;
- initWithDescription:(STEnvironmentDescription *)aDescription;
diff --git a/Source/STEnvironment.m b/Source/STEnvironment.m
index 9a4a165..5008dc6 100644
--- a/Source/STEnvironment.m
+++ b/Source/STEnvironment.m
@@ -83,6 +83,19 @@
return AUTORELEASE([[self alloc] initWithDescription:aDescription]);
}
+/**
+ Initialises scripting environment using default description.
+
+
+ */
+- initDefault
+{
+ NSString *name;
+
+ name = [STEnvironmentDescription defaultEnvironmentDescriptionName];
+
+ return [self initWithDescriptionName:name];
+}
/**
Initialises scripting environment using description with name
descName.