@class STObjectReference;
@class STEnvironmentDescription;
@interface STContext:NSObject
{
NSMutableDictionary *objectDictionary;
STContext *parentContext;
BOOL fullScripting;
BOOL createsUnknownObjects;
}
- (void)setParentContext:(STContext *)context;
- (STContext *)parentContext;
/** Full scripting */
- (void)setFullScriptingEnabled:(BOOL)flag;
- (BOOL)fullScriptingEnabled;
-(void)setCreatesUnknownObjects:(BOOL)flag;
-(BOOL)createsUnknownObjects;
- (NSMutableDictionary *)objectDictionary;
- (void)setObject:(id)anObject
forName:(NSString *)objName;
- (void)removeObjectWithName:(NSString *)objName;
- (void)addNamedObjectsFromDictionary:(NSDictionary *)dict;
- (id)objectWithName:(NSString *)objName;
- (STObjectReference *)objectReferenceForObjectWithName:(NSString *)name;
- (NSString *)translateSelector:(NSString *)aString forReceiver:(id)anObject;
- (NSArray *)knownObjectNames;
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STContext.m 0000644 0002043 0000764 00000011746 11131137113 025303 0 ustar johnston nielsen /**
STContext
Scripting context
Copyright (c) 2004 Free Software Foundation
Written by: Stefan Urbanek
Date: 2004
This file is part of the StepTalk project.
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
STEnvironment class reference
*/
#import "STContext.h"
#import "STScripting.h"
#import "STClassInfo.h"
#import "STEnvironmentDescription.h"
#import "STExterns.h"
#import "STBundleInfo.h"
#import "STObjCRuntime.h"
#import "STObjectReference.h"
#import "STUndefinedObject.h"
#import "STCompat.h"
@implementation STContext
-init
{
self = [super init];
objectDictionary = [[NSMutableDictionary alloc] init];
return self;
}
- (void)dealloc
{
RELEASE(objectDictionary);
RELEASE(parentContext);
[super dealloc];
}
- (void)setParentContext:(STContext *)context
{
ASSIGN(parentContext, context);
}
- (STContext *)parentContext
{
return parentContext;
}
/**
Enable or disable full scripting. When full scripting is enabled,
you may send any message to any object.
*/
- (void)setFullScriptingEnabled:(BOOL)flag
{
fullScripting = flag;
}
/**
Returns YES if full scripting is enabled.
*/
- (BOOL)fullScriptingEnabled
{
return fullScripting;
}
/**
Enable or disable creation of unknown objects. Normally you get nil if you
request for non-existant object. If flag is YES
then by requesting non-existant object, name for that object is created
and it is set no STNil.
Note: This method will be probably removed (moved to Smalltalk language bundle).
*/
-(void)setCreatesUnknownObjects:(BOOL)flag
{
createsUnknownObjects = flag;
}
/**
Returns YES if unknown objects are being created.
*/
-(BOOL)createsUnknownObjects
{
return createsUnknownObjects;
}
/**
Returns a dictionary of all named objects in the environment.
*/
- (NSMutableDictionary *)objectDictionary
{
return objectDictionary;
}
/* -----------------------------------------------------------------------
Objects
----------------------------------------------------------------------- */
/**
Register object anObject with name objName.
*/
- (void)setObject:(id)anObject
forName:(NSString *)objName
{
if(anObject)
{
[objectDictionary setObject:anObject forKey:objName];
}
else
{
[objectDictionary setObject:STNil forKey:objName];
}
}
/**
Remove object named objName.
*/
- (void)removeObjectWithName:(NSString *)objName
{
[objectDictionary removeObjectForKey:objName];
}
/**
*/
- (void)addNamedObjectsFromDictionary:(NSDictionary *)dict
{
[objectDictionary addEntriesFromDictionary:dict];
}
/**
Return object with name objName. If object is not found int the
object dictionary, then object finders are used to try to find the object.
If object is found by an object finder, then it is put into the object
dicitonary. If there is no object with given name, nil is
returned.
*/
- (id)objectWithName:(NSString *)objName
{
id obj;
obj = [objectDictionary objectForKey:objName];
if(!obj)
{
return [parentContext objectWithName:objName];
}
return obj;
}
- (STObjectReference *)objectReferenceForObjectWithName:(NSString *)name
{
STObjectReference *ref;
id target = objectDictionary;
if( ![self objectWithName:name] )
{
if([[self knownObjectNames] containsObject:name])
{
/* FIXME: What I meant by this? */
target = nil;
}
else if(createsUnknownObjects)
{
[objectDictionary setObject:STNil forKey:name];
}
}
ref = [[STObjectReference alloc] initWithIdentifier:name
target:target];
return AUTORELEASE(ref);
}
- (NSString *)translateSelector:(NSString *)aString forReceiver:(id)anObject
{
if(parentContext)
{
return [parentContext translateSelector:aString forReceiver:anObject];
}
else
{
return nil;
}
}
- (NSArray *)knownObjectNames
{
NSMutableArray *array = [NSMutableArray array];
[array addObjectsFromArray:[objectDictionary allKeys]];
return [NSArray arrayWithArray:array];
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STConversation.h 0000644 0002043 0000764 00000003605 11131137113 026317 0 ustar johnston nielsen /**
STConversation
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2003 Sep 21
This file is part of the StepTalk project.
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 STEngine;
@class STContext;
@protocol STConversation
/** Set language for the receiver. */
- (void)setLanguage:(NSString *)newLanguage;
- (NSString *)language;
- (bycopy NSArray *)knownLanguages;
/** Interpret given string as a script in the receiver environment. */
- (void)interpretScript:(bycopy NSString *)aString;
// - (void)interpretScript:(bycopy NSString *)aString inLanguage:(NSString *)lang;
- (id)result;
- (bycopy id)resultByCopy;
@end
@interface STConversation:NSObject
{
STEngine *engine;
NSString *languageName;
STContext *context;
id returnValue;
}
+ conversation;
- initWithContext:(STContext *)aContext
language:(NSString *)aLanguage;
- (void)setLanguage:(NSString *)newLanguage;
- (NSString *)language;
- (void)interpretScript:(NSString *)aString;
- (id)result;
- (STContext *)context;
/* Depreciated */
- (id)runScriptFromString:(NSString *)aString;
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STConversation.m 0000644 0002043 0000764 00000010413 11131137113 026317 0 ustar johnston nielsen /**
STConversation
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2003 Sep 21
This file is part of the StepTalk project.
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 "STConversation.h"
#import "STEnvironment.h"
#import "STEngine.h"
#import "STLanguageManager.h"
#import "STCompat.h"
@implementation STConversation
/** Creates a new conversation with environment created using default
description and default language. */
+ conversation
{
STEnvironment *env = [STEnvironment environmentWithDefaultDescription];
NSLog(@"DEPRECATED");
return AUTORELEASE([[self alloc] initWithContext:env language:nil]);
}
- (bycopy id)resultByCopy
{
return [self result];
}
- (id)runScriptFromString:(NSString *)aString
{
NSLog(@"Warning: runScriptFromString: in STConversation is deprecated, use -interpretScript: and -returnVale");
[self interpretScript:aString];
return [self result];
}
/** Returns all languages that are known in the receiver. Should be used by
remote calls instead of NSLanguage query which gives local list of
languages. */
- (NSArray *)knownLanguages
{
return [[STLanguageManager defaultManager] availableLanguages];
}
/** Creates a new conversation with environment created using default
description and language with name langName. */
+ conversationWithEnvironment:(STEnvironment *)env
language:(NSString *)langName
{
STConversation *c;
NSLog(@"WARNING: +[STConversaion conversationWithEnvironment:language:] is deprecated, "
@" use conversationWithContext:language: instead.");
c = [[self alloc] initWithContext:env language:langName];
return AUTORELEASE(c);
}
- initWithEnvironment:(STEnvironment *)env
language:(NSString *)langName
{
NSLog(@"WARNING: -[STConversaion initWithEnvironment:language:] is deprecated, "
@" use initWithContext:language: instead.");
return [self initWithContext:env language:langName];
}
- initWithContext:(STContext *)aContext
language:(NSString *)aLanguage
{
STLanguageManager *manager = [STLanguageManager defaultManager];
self = [super init];
NSDebugLLog(@"STConversation",@"Creating conversation %@", self);
if(!aLanguage || [aLanguage isEqual:@""])
{
languageName = RETAIN([manager defaultLanguage]);
}
else
{
languageName = RETAIN(aLanguage);
}
context = RETAIN(aContext);
return self;
}
- (void)dealloc
{
NSDebugLLog(@"STConversation",@"Deallocating conversation %@", self);
RELEASE(languageName);
RELEASE(context);
RELEASE(engine);
RELEASE(returnValue);
[super dealloc];
}
- (void)_createEngine
{
ASSIGN(engine,[STEngine engineForLanguage:languageName]);
}
- (void)setLanguage:(NSString *)newLanguage
{
if(![newLanguage isEqual:languageName])
{
RELEASE(engine);
engine = nil;
ASSIGN(languageName, newLanguage);
}
}
/** Return name of the language used in the receiver conversation */
- (NSString *)language
{
return languageName;
}
- (STEnvironment *)environment
{
NSLog(@"WARNING: -[STConversation environment] is deprecated, "
@" use -context instead.");
return (STEnvironment *)context;
}
- (STContext *)context
{
return context;
}
- (void)interpretScript:(NSString *)aString
{
if(!engine)
{
[self _createEngine];
}
ASSIGN(returnValue, [engine interpretScript: aString
inContext: context]);
}
- (id)result
{
return returnValue;
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STEngine.h 0000644 0002043 0000764 00000003365 11131137113 025055 0 ustar johnston nielsen /**
STEngine.h
Scripting engine
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000
This file is part of the StepTalk project.
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
@protocol STMethod;
@class STContext;
@class STEnvironment;
@class STLanguageEngine;
/** STEngine is abstract class for language engines used to intepret scripts.*/
@interface STEngine:NSObject
{
}
/** Instance creation */
+ (STEngine *) engineForLanguage:(NSString *)name;
// - (BOOL)canInterpret:(NSString *)sourceCode;
- (id)interpretScript:(NSString *)script
inContext:(STContext *)context;
/* Methods */
- (id )methodFromSource:(NSString *)sourceString
forReceiver:(id)receiver
inContext:(STContext *)context;
- (id) executeMethod:(id )aMethod
forReceiver:(id)anObject
withArguments:(NSArray *)args
inContext:(STContext *)context;
- (BOOL)understandsCode:(NSString *)code;
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STEngine.m 0000644 0002043 0000764 00000006207 11131137113 025060 0 ustar johnston nielsen /**
STEngine.m
Scripting engine
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000
This file is part of the StepTalk project.
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 "STEngine.h"
#import "STEnvironment.h"
#import "STExterns.h"
#import "STLanguageManager.h"
#import "STMethod.h"
#import "STUndefinedObject.h"
#import "STCompat.h"
NSZone *STMallocZone = (NSZone *)nil;
void _STInitMallocZone(void)
{
if(!STMallocZone)
{
/* FIXME: do some testing whether there should be YES or NO */
STMallocZone = NSCreateZone(NSPageSize(),NSPageSize(),YES);
}
}
@implementation STEngine
+ (void)initialize
{
_STInitMallocZone();
if(!STNil)
{
STNil = (STUndefinedObject *)NSAllocateObject([STUndefinedObject class],
0, STMallocZone);
}
}
/**
Return a scripting engine for language with specified name. The engine
is get from default language manager.
*/
+ (STEngine *) engineForLanguage:(NSString *)name
{
STLanguageManager *manager = [STLanguageManager defaultManager];
if(!name)
{
[NSException raise:@"STConversationException"
format:@"Unspecified language for a new engine."];
return nil;
}
return [manager createEngineForLanguage:name];
}
+ (STEngine *) engineForLanguageWithName:(NSString *)name
{
NSLog(@"%@ %@ is depreciated, use %@ instead",
[self className], NSStringFromSelector(_cmd), @"engineForLanguage:");
return [self engineForLanguage:name];
}
/** Interpret source code code in a context context.
This is the method, that has to be implemented by those who are writing
a language engine.
*/
- (id)interpretScript:(NSString *)script
inContext:(STContext *)context
{
[self subclassResponsibility:_cmd];
return nil;
}
- (BOOL)understandsCode:(NSString *)code
{
[self subclassResponsibility:_cmd];
return NO;
}
- (id )methodFromSource:(NSString *)sourceString
forReceiver:(id)receiver
inContext:(STContext *)env;
{
[self subclassResponsibility:_cmd];
return nil;
}
- (id) executeMethod:(id )aMethod
forReceiver:(id)anObject
withArguments:(NSArray *)args
inContext:(STContext *)env;
{
[self subclassResponsibility:_cmd];
return nil;
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STEnvironment.h 0000644 0002043 0000764 00000004166 11131137113 026154 0 ustar johnston nielsen /**
STEnvironment
Scripting environment
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000
This file is part of the StepTalk project.
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
STEnvironment class reference
*/
#import "STContext.h"
@class STObjectReference;
@class STEnvironmentDescription;
@interface STEnvironment:STContext
{
STEnvironmentDescription *description;
NSMutableDictionary *classes; /* from description */
NSMutableDictionary *infoCache;
NSMutableDictionary *objectFinders;
NSMutableArray *loadedBundles;
}
/** Creating environment */
+ sharedEnvironment;
+ (STEnvironment *)environmentWithDefaultDescription;
+ environmentWithDescription:(STEnvironmentDescription *)aDescription;
- initWithDefaultDescription;
- initWithDescription:(bycopy STEnvironmentDescription *)aDescription;
/** Modules */
- (void)loadModule:(NSString *)moduleName;
- (BOOL)includeFramework:(NSString *)frameworkName;
- (BOOL)includeBundle:(NSBundle *)aBundle;
- (void)addClassesWithNames:(NSArray *)names;
/** Distributed objects */
- (void)registerObjectFinder:(id)finder name:(NSString*)name;
- (void)registerObjectFinderNamed:(NSString *)name;
- (void)removeObjectFinderWithName:(NSString *)name;
/** Selector translation */
- (NSString *)translateSelector:(NSString *)aString forReceiver:(id)anObject;
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STEnvironment.m 0000644 0002043 0000764 00000030541 11131137113 026155 0 ustar johnston nielsen /**
STEnvironment
Scripting environment
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000
This file is part of the StepTalk project.
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
STEnvironment class reference
*/
#import "STEnvironment.h"
#import "STScripting.h"
#import "STClassInfo.h"
#import "STEnvironmentDescription.h"
#import "STExterns.h"
#import "STBundleInfo.h"
#import "STObjCRuntime.h"
#import "STObjectReference.h"
#import "STUndefinedObject.h"
#import "STCompat.h"
#import "STResourceManager.h"
STEnvironment *sharedEnvironment = nil;
@interface STEnvironment(STPrivateMethods)
- (STClassInfo *)findClassInfoForObject:(id)anObject;
@end
@implementation STEnvironment
/** Returns an instance of the scripting environment that is shared in
the scope of actual application or process. */
+ sharedEnvironment
{
if(sharedEnvironment == nil)
{
sharedEnvironment = [[self alloc] initWithDefaultDescription];
}
return sharedEnvironment;
}
/**
Creates and initialises new scripting environment using default description.
*/
+ (STEnvironment *)environmentWithDefaultDescription
{
return AUTORELEASE([[self alloc] initWithDefaultDescription]);
}
/**
Creates and initialises scripting environment using environment description
description.
*/
+ environmentWithDescription:(STEnvironmentDescription *)aDescription
{
return AUTORELEASE([[self alloc] initWithDescription:aDescription]);
}
/**
Initialises scripting environment using default description.
*/
- initWithDefaultDescription
{
STEnvironmentDescription *desc;
NSString *name;
name = [STEnvironmentDescription defaultDescriptionName];
desc = [STEnvironmentDescription descriptionWithName:name];
return [self initWithDescription:desc];
}
/**
Initialises scripting environment using scripting description
aDescription.
*/
- initWithDescription:(bycopy STEnvironmentDescription *)aDescription
{
NSEnumerator *enumerator;
NSString *name;
self = [super init];
infoCache = [[NSMutableDictionary alloc] init];
description = RETAIN(aDescription);
RETAIN(description);
classes = [description classes];
/* Load modules */
enumerator = [[description modules] objectEnumerator];
while( (name = [enumerator nextObject]) )
{
[self loadModule:name];
}
/* Load frameworks */
enumerator = [[description frameworks] objectEnumerator];
while( (name = [enumerator nextObject]) )
{
[self includeFramework:name];
}
/* Register finders */
enumerator = [[description objectFinders] objectEnumerator];
while( (name = [enumerator nextObject]) )
{
[self registerObjectFinderNamed:name];
}
return self;
}
- (void)dealloc
{
RELEASE(description);
RELEASE(infoCache);
RELEASE(objectFinders);
RELEASE(loadedBundles);
[super dealloc];
}
/**
Add classes specified by the names in the names array.
This method is used internally to add classes provided by modules.
*/
- (void)addClassesWithNames:(NSArray *)names
{
[self addNamedObjectsFromDictionary:STClassDictionaryWithNames(names)];
}
/**
Load StepTalk module with the name moduleName. Modules are stored
in the Library/StepTalk/Modules directory.
*/
- (void) loadModule:(NSString *)moduleName
{
NSBundle *bundle;
bundle = [NSBundle stepTalkBundleWithName:moduleName];
[self includeBundle:bundle];
}
/**
Include scripting capabilities advertised by the framework with name
frameworkName. If the framework is already loaded, nothing
happens.
*/
- (BOOL)includeFramework:(NSString *)frameworkName
{
NSBundle *bundle;
bundle = [NSBundle bundleForFrameworkWithName:frameworkName];
if(!bundle)
{
return NO;
}
return [self includeBundle:bundle];
}
/**
Include scripting capabilities advertised by the bundle
aBundle. If the bundle is already loaded, nothing
happens.
*/
- (BOOL)includeBundle:(NSBundle *)aBundle
{
STBundleInfo *info;
/* Ignore already included bundles. */
if([loadedBundles containsObject:[aBundle bundlePath]])
{
NSDebugLog(@"Bundle '%@' already included.", [aBundle bundlePath]);
return YES;
}
info = [STBundleInfo infoForBundle:aBundle];
if(!info)
{
return NO;
}
[self addNamedObjectsFromDictionary:[info namedObjects]];
[self addClassesWithNames:[info publicClassNames]];
if(!loadedBundles)
{
loadedBundles = [[NSMutableArray alloc] init];
}
/* FIXME: is this sufficient? */
[loadedBundles addObject:[aBundle bundlePath]];
return YES;
}
/* -----------------------------------------------------------------------
Objects
----------------------------------------------------------------------- */
/**
Return object with name objName. If object is not found int the
object dictionary, then object finders are used to try to find the object.
If object is found by an object finder, then it is put into the object
dicitonary. If there is no object with given name, nil is
returned.
*/
- (id)objectWithName:(NSString *)objName
{
NSEnumerator *enumerator;
id obj;
id finder;
obj = [super objectWithName:objName];
if(!obj)
{
enumerator = [objectFinders objectEnumerator];
while( (finder = [enumerator nextObject]) )
{
obj = [finder objectWithName:objName];
if(obj)
{
[self setObject:obj forName:objName];
break;
}
}
}
/* FIXME: Warning: possible security problem in the future */
/* If there is no such object and full scripting is enabled, then
class namespace is searched */
if(!obj && fullScripting)
{
obj = NSClassFromString(objName);
}
return obj;
}
/* FIXME: rewrite, it is too sloooooow */
- (STClassInfo *)findClassInfoForObject:(id)anObject
{
STClassInfo *info = nil;
NSString *className;
NSString *origName;
Class class;
if(!anObject)
{
anObject = STNil;
}
/* FIXME: temporary solution */
if( [anObject isProxy] )
{
NSDebugLog(@"FIXME: receiver is a distant object");
info = [classes objectForKey:@"NSProxy"];
if(!info)
{
return [classes objectForKey:@"All"];
}
return info;
}
if([anObject respondsToSelector:@selector(classForScripting)])
{
class = [anObject classForScripting];
}
else
{
class = [anObject class];
}
className = [anObject className];
if([anObject isClass])
{
origName = className = [className stringByAppendingString:@" class"];
NSDebugLLog(@"STSending",
@"Looking for class info '%@'...",
className);
info = [infoCache objectForKey:className];
if(info)
{
return info;
}
while( !(info = [classes objectForKey:className]) )
{
class = [class superclass];
if(!class)
{
break;
}
className = [[class className] stringByAppendingString:@" class"];
NSDebugLLog(@"STSending",
@" ... %@?",className);
}
}
else
{
origName = className;
NSDebugLLog(@"STSending",
@"Looking for class info '%@' (instance)...",
className);
info = [infoCache objectForKey:className];
if(info)
{
return info;
}
while( !(info = [classes objectForKey:className]) )
{
class = [class superclass];
if(!class)
{
break;
}
className = [class className];
NSDebugLLog(@"STSending",
@" ... %@?",className);
}
}
if(!info)
{
NSDebugLLog(@"STSending",
@"No class info '%@'",
className);
return nil;
}
NSDebugLLog(@"STSending",
@"Found class info '%@'",
className);
[infoCache setObject:info forKey:origName];
return info;
}
- (NSString *)translateSelector:(NSString *)aString forReceiver:(id)anObject
{
STClassInfo *class;
NSString *selector;
class = [self findClassInfoForObject:anObject];
NSDebugLLog(@"STSending",
@"Lookup selector '%@' class %@", aString, [class behaviourName]);
selector = [class translationForSelector:aString];
NSDebugLLog(@"STSending",
@"Found selector '%@'",selector);
#ifdef DEBUG
if(! [selector isEqualToString:aString])
{
NSDebugLLog(@"STSending",
@"using selector '%@' instead of '%@'",
selector,aString);
}
#endif
if(!selector && fullScripting )
{
NSDebugLLog(@"STSending",
@"using selector '%@' (full scriptig)",
aString);
selector = AUTORELEASE([aString copy]);
}
if(!selector)
{
[NSException raise:STScriptingException
format:@"Receiver of type %@ denies selector '%@'",
[anObject className],aString];
/* if exception is ignored, then try to use original selector */
selector = AUTORELEASE([aString copy]);
}
return selector;
}
- (NSArray *)knownObjectNames
{
NSMutableArray *array = [NSMutableArray array];
NSEnumerator *enumerator;
id finder;
[array addObjectsFromArray:[super knownObjectNames]];
enumerator = [objectFinders objectEnumerator];
while( (finder = [enumerator nextObject]) )
{
[array addObjectsFromArray:[finder knownObjectNames]];
}
return [NSArray arrayWithArray:array];
}
/** Register object finder finder under the name name */
- (void)registerObjectFinder:(id)finder name:(NSString*)name
{
if(!objectFinders)
{
objectFinders = [[NSMutableDictionary alloc] init];
}
[objectFinders setObject:finder forKey:name];
}
/** Register object finder named name. This method will try to find
an object finder bundle in Library/StepTalk/Finders directories.
*/
- (void)registerObjectFinderNamed:(NSString *)name
{
NSBundle *bundle;
NSString *path;
id finder;
if([objectFinders objectForKey:name])
{
return;
}
path = [[STResourceManager defaultManager] pathForResource:name
ofType:@"bundle"
inDirectory:@"Finders"];
if(!path)
{
NSLog(@"Unknown object finder with name '%@'", name);
return;
}
NSDebugLog(@"Finder '%@'", path);
bundle = [NSBundle bundleWithPath:path];
if(!bundle)
{
NSLog(@"Unable to load object finder bundle '%@'", path);
return;
}
finder = [[[bundle principalClass] alloc] init];
if(!finder)
{
NSLog(@"Unable to create object finder from '%@'", path);
return;
}
[self registerObjectFinder:finder name:name];
}
/** Remove object finder with name name */
- (void)removeObjectFinderWithName:(NSString *)name
{
[objectFinders removeObjectForKey:name];
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STEnvironmentDescription.h 0000644 0002043 0000764 00000003524 11131137113 030355 0 ustar johnston nielsen /**
STEnvironmentDescription.h
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000 Jun 16
This file is part of the StepTalk project.
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
enum
{
STUndefinedRestriction,
STAllowAllRestriction,
STDenyAllRestriction
};
@interface STEnvironmentDescription:NSObject
{
NSMutableArray *usedDefs;
NSMutableDictionary *classes;
NSMutableDictionary *behaviours;
NSMutableDictionary *aliases;
NSMutableArray *modules;
NSMutableArray *frameworks;
NSMutableArray *finders;
int restriction;
}
+ (NSString *)defaultDescriptionName;
+ descriptionWithName:(NSString *)descriptionName;
+ descriptionFromDictionary:(NSDictionary *)dictionary;
- initWithName:(NSString *)defName;
- initFromDictionary:(NSDictionary *)def;
- (void)updateFromDictionary:(NSDictionary *)def;
- (void)updateClassWithName:(NSString *)className description:(NSDictionary *)def;
- (NSMutableDictionary *)classes;
- (NSArray *)modules;
- (NSArray *)frameworks;
- (NSArray *)objectFinders;
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STEnvironmentDescription.m 0000644 0002043 0000764 00000032252 11131137113 030362 0 ustar johnston nielsen /**
STEnvironmentDescription.m
Compiled scripting environment description
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000 Jun 16
This file is part of the StepTalk project.
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 "STEnvironmentDescription.h"
#import "STClassInfo.h"
#import "STExterns.h"
#import "STBehaviourInfo.h"
#import "STCompat.h"
#import "STResourceManager.h"
static NSDictionary *dictForDescriptionWithName(NSString *defName)
{
NSString *file;
NSDictionary *dict;
file = [[STResourceManager defaultManager] pathForResource:defName
ofType:STScriptingEnvironmentExtension
inDirectory:STScriptingEnvironmentsDirectory];
if(!file)
{
file = [[NSBundle bundleForClass:[STEnvironmentDescription class]]
pathForResource:defName
ofType:STScriptingEnvironmentExtension
inDirectory:nil];
}
if(!file)
{
[NSException raise:STGenericException
format: @"Could not find "
@"environment description with name '%@'.",
defName];
return nil;
}
dict = [NSDictionary dictionaryWithContentsOfFile:file];
if(!dict)
{
[NSException raise:STGenericException
format:@"Error while opening "
@"environment description with name '%@'.",
defName];
return nil;
}
return dict;
}
@interface STEnvironmentDescription(PrivateMethods)
- (void)updateFromDictionary:(NSDictionary *)def;
- (void)updateUseListFromDictionary:(NSDictionary *)def;
- (void)updateBehavioursFromDictionary:(NSDictionary *)aDict;
- (void)updateBehaviour:(STBehaviourInfo *)behInfo
description:(NSDictionary *)def;
- (void)updateClassesFromDictionary:(NSDictionary *)def;
- (void)updateClassWithName:(NSString *)className description:(NSDictionary *)def;
- (void)updateAliasesFromDictionary:(NSDictionary *)def;
- (void)fixupScriptingDescription;
- (void)resolveSuperclasses;
- (void)updateUseList:(NSArray *)array;
- (void)updateModuleList:(NSArray *)array;
- (void)updateFrameworkList:(NSArray *)array;
- (void)updateFinderList:(NSArray *)array;
@end
@implementation STEnvironmentDescription
+ (NSString *)defaultEnvironmentDescriptionName
{
NSLog(@"WARNING: +[STEnvironmentDescription defaultEnvironmentDescriptionName:] is deprecated, "
@" use defaultDescriptionName: instead.");
return [self defaultDescriptionName];
}
+ (NSString *)defaultDescriptionName
{
NSUserDefaults *defs;
NSString *name;
defs = [NSUserDefaults standardUserDefaults];
name = [defs objectForKey:@"STDefaultEnvironmentDescriptionName"];
if(!name || [name isEqualToString:@""])
{
name = [NSString stringWithString:@"Standard"];
}
return name;
}
+ descriptionWithName:(NSString *)descriptionName
{
return AUTORELEASE([[self alloc] initWithName:descriptionName]);
}
+ descriptionFromDictionary:(NSDictionary *)dictionary
{
return AUTORELEASE([[self alloc] initFromDictionary:dictionary]);
}
- (void)dealloc
{
RELEASE(usedDefs);
RELEASE(classes);
RELEASE(behaviours);
RELEASE(aliases);
RELEASE(modules);
RELEASE(finders);
[super dealloc];
}
- initWithName:(NSString *)defName;
{
return [self initFromDictionary:dictForDescriptionWithName(defName)];
}
- initFromDictionary:(NSDictionary *)def
{
if(!def)
{
[self dealloc];
return nil;
}
[self updateFromDictionary:def];
[self fixupScriptingDescription];
return self;
}
- (void)updateFromDictionary:(NSDictionary *)def
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSString *str;
BOOL saveFlag = restriction;
if(!def)
{
NSLog(@"Warning: nil dictionary for environmet description update");
return;
};
str = [def objectForKey:@"DefaultRestriction"];
if(str)
{
str = [str lowercaseString];
if([str isEqualToString:@"allowall"])
{
restriction = STAllowAllRestriction;
}
else if([str isEqualToString:@"denyall"])
{
restriction = STDenyAllRestriction;
}
else
{
[NSException raise:STGenericException
format:@"Invalid default restriction rule '%@'.",
str];
return;
}
}
[self updateUseList:[def objectForKey:@"Use"]];
[self updateModuleList:[def objectForKey:@"Modules"]];
[self updateFrameworkList:[def objectForKey:@"Frameworks"]];
[self updateFinderList:[def objectForKey:@"Finders"]];
[self updateBehavioursFromDictionary:[def objectForKey:@"Behaviours"]];
[self updateClassesFromDictionary:[def objectForKey:@"Classes"]];
[self updateAliasesFromDictionary:[def objectForKey:@"Aliases"]];
restriction = saveFlag;
[pool release];
}
- (void)updateUseList:(NSArray *)array
{
NSEnumerator *enumerator;
NSString *str;
enumerator = [array objectEnumerator];
while( (str = [enumerator nextObject]) )
{
if(!usedDefs)
{
usedDefs = [[NSMutableArray alloc] init];
}
if( ![usedDefs containsObject:str] )
{
[usedDefs addObject:str];
[self updateFromDictionary:dictForDescriptionWithName(str)];
}
}
}
- (void)updateModuleList:(NSArray *)array
{
NSEnumerator *enumerator;
NSString *str;
enumerator = [array objectEnumerator];
while( (str = [enumerator nextObject]) )
{
if(!modules)
{
modules = [[NSMutableArray alloc] init];
}
if( ![modules containsObject:str] )
{
[modules addObject:str];
}
}
}
- (void)updateFrameworkList:(NSArray *)array
{
NSEnumerator *enumerator;
NSString *str;
enumerator = [array objectEnumerator];
while( (str = [enumerator nextObject]) )
{
if(!frameworks)
{
frameworks = [[NSMutableArray alloc] init];
}
if( ![frameworks containsObject:str] )
{
[frameworks addObject:str];
}
}
}
- (NSArray *)frameworks
{
return [NSArray arrayWithArray:frameworks];
}
- (void)updateFinderList:(NSArray *)array
{
NSEnumerator *enumerator;
NSString *str;
enumerator = [array objectEnumerator];
while( (str = [enumerator nextObject]) )
{
if(!finders)
{
finders = [[NSMutableArray alloc] init];
}
if( ![finders containsObject:str] )
{
[finders addObject:str];
}
}
}
- (void)updateBehavioursFromDictionary:(NSDictionary *)dict
{
NSEnumerator *enumerator;
NSString *name;
STBehaviourInfo *behInfo;
enumerator = [dict keyEnumerator];
while( (name = [enumerator nextObject]) )
{
if([behaviours objectForKey:name])
{
[NSException raise:STGenericException
format:@"Behaviour '%@' defined more than once.",
name];
return;
}
if(!behaviours)
{
behaviours = [[NSMutableDictionary alloc] init];
}
behInfo = [[STBehaviourInfo alloc] initWithName:name];
[behaviours setObject:behInfo forKey:name];
[self updateBehaviour:behInfo description:[dict objectForKey:name]];
}
}
- (void)updateBehaviour:(STBehaviourInfo *)behInfo
description:(NSDictionary *)def
{
NSString *str;
NSEnumerator *enumerator;
STBehaviourInfo *useInfo;
enumerator = [[def objectForKey:@"Use"] objectEnumerator];
while( (str = [enumerator nextObject]) )
{
useInfo = [behaviours objectForKey:str];
if(!useInfo)
{
[NSException raise:STGenericException
format:@"Undefined behaviour '%@'.",
str];
return;
}
[behInfo adopt:useInfo];
}
[behInfo allowMethods:[NSSet setWithArray:[def objectForKey:@"AllowMethods"]]];
[behInfo denyMethods:[NSSet setWithArray:[def objectForKey:@"DenyMethods"]]];
[behInfo addTranslationsFromDictionary:[def objectForKey:@"SymbolicSelectors"]];
[behInfo addTranslationsFromDictionary:[def objectForKey:@"Aliases"]];
}
- (void)updateClassesFromDictionary:(NSDictionary *)dict
{
NSEnumerator *enumerator;
NSString *str;
enumerator = [dict keyEnumerator];
while( (str = [enumerator nextObject]) )
{
[self updateClassWithName:str
description:[dict objectForKey:str]];
}
}
- (void)updateClassWithName:(NSString *)className description:(NSDictionary *)def
{
STClassInfo *class;
NSString *superName;
NSString *flag;
NSString *str;
BOOL newClass = NO;
if(!classes)
{
classes = [[NSMutableDictionary alloc] init];
}
class = [classes objectForKey:className];
if( !class )
{
class = [[STClassInfo alloc] initWithName:className];
[classes setObject:class forKey:className];
newClass = YES;
}
str = [def objectForKey:@"Super"];
superName = [class superclassName];
if(str && (![str isEqualToString:superName]))
{
if(newClass | (superName == nil))
{
[class setSuperclassName:str];
}
else
{
[NSException raise:STGenericException
format:@"Trying to change superclass of '%@' "
@"from '%@' to '%@'",
className,[class superclassName],str];
return;
}
}
[self updateBehaviour:class description:def];
flag = [def objectForKey:@"Restriction"];
NSDebugLLog(@"STEnvironment", @"Class %@ restriction %@ (default %i)",
className, flag, restriction);
if(flag)
{
flag = [flag lowercaseString];
if([flag isEqualToString:@"allowall"])
{
[class setAllowAllMethods:YES];
}
else if([flag isEqualToString:@"denyall"])
{
[class setAllowAllMethods:NO];
}
else
{
[NSException raise:STGenericException
format:@"Invalid method restriction rule '%@'.",
flag];
return;
}
}
else
{
if(restriction == STAllowAllRestriction)
{
[class setAllowAllMethods:YES];
}
else if (restriction == STDenyAllRestriction)
{
[class setAllowAllMethods:NO];
}
}
}
- (void)updateAliasesFromDictionary:(NSDictionary *)dict
{
NSEnumerator *enumerator;
NSString *str;
enumerator = [dict keyEnumerator];
while( (str = [enumerator nextObject]) )
{
[aliases setObject:str forKey:[dict objectForKey:str]];
}
}
- (NSMutableDictionary *)classes
{
return classes;
}
- (NSArray *)modules
{
return [NSArray arrayWithArray:modules];
}
- (NSArray *)objectFinders
{
return [NSArray arrayWithArray:finders];
}
- (void)fixupScriptingDescription
{
[self resolveSuperclasses];
}
- (void)resolveSuperclasses
{
NSEnumerator *enumerator;
STClassInfo *superclass;
STClassInfo *class;
NSString *className;
enumerator = [classes objectEnumerator];
while( (class = [enumerator nextObject]) )
{
if([[class behaviourName] isEqualToString:@"All"])
{
continue;
}
className = [class superclassName];
if( (className == nil) || [className isEqualToString:@"nil"] )
{
superclass = [classes objectForKey:@"All"];
if(!superclass)
{
continue;
}
}
else
{
superclass = [classes objectForKey:className];
}
if(!superclass)
{
[NSException raise:STGenericException
format:@"Resolving superclasses: "
@"Could not find class '%@'.", className];
return;
}
[class setSuperclassInfo:superclass];
}
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STEnvironmentServer.h 0000644 0002043 0000764 00000000123 11131137113 027330 0 ustar johnston nielsen #import
@interface STEnvironmentServer:NSObject
{
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STEnvironmentServer.m 0000644 0002043 0000764 00000002131 11131137113 027336 0 ustar johnston nielsen #import "STEnvironmentServer.h"
#import
#import
#import
#import
#include
static STEnvironmentServer *sharedEnvironmentServer = nil;
@implementation STEnvironmentServer
+ sharedServer
{
if(!sharedEnvironmentServer)
{
sharedEnvironmentServer = [[self alloc] init];
}
return sharedEnvironmentServer;
}
- (void)createEnvironmentWithName:(NSString *)envName
{
NSTask *task;
NSString *path;
NSArray *args;
NSString *pid;
/* FIXME: use absolute path */
path = @"stenvironment";
pid = [NSString stringWithFormat:@"%d", [[NSProcessInfo processInfo] processIdentifier]];
args = [NSArray arrayWithObjects:@"-name",
envName,
@"-observer",
pid,
nil];
task = [NSTask launchedTaskWithLaunchPath:path arguments:args];
/* FIXME: remove this sleep */
sleep(1);
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STExterns.h 0000644 0002043 0000764 00000003360 11131137113 025273 0 ustar johnston nielsen /**
STExterns.h
Misc. variables
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000
This file is part of the StepTalk project.
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
*/
@class NSString;
@class STUndefinedObject;
extern STUndefinedObject *STNil;
/* exceptions */
extern NSString *STGenericException; /* can be ignored */
extern NSString *STInvalidArgumentException;
extern NSString *STInternalInconsistencyException; /* not recoverable */
extern NSString *STScriptingException;
extern NSString *STSyntaxErrorException;
extern NSString *STLibraryDirectory;
extern NSString *STScriptExtension;
extern NSString *STScriptsDirectory;
extern NSString *STScriptingEnvironmentsDirectory;
extern NSString *STScriptingEnvironmentExtension;
extern NSString *STModulesDirectory;
extern NSString *STModuleExtension;
extern NSString *STLanguageBundlesDirectory;
extern NSString *STLanguageBundleExtension;
extern NSString *STLanguagesConfigFile;
/* malloc zone */
extern NSZone *STMallocZone;
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STExterns.m 0000644 0002043 0000764 00000004334 11131137113 025302 0 ustar johnston nielsen /**
STExterns.m
Misc. variables
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000
This file is part of the StepTalk project.
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
NSString *STGenericException = @"STGenericException";
NSString *STInvalidArgumentException = @"STInvalidArgumentException";
NSString *STInternalInconsistencyException = @"STInternalInconsistencyException";
NSString *STRangeException = @"STRangeException";
NSString *STScriptingException = @"STScriptingException";
NSString *STSyntaxErrorException = @"STSyntaxErrorException";
NSString *STCompilerSyntaxException = @"STCompilerSyntaxException";
NSString *STCompilerGenericException = @"STCompilerGenericException";
NSString *STCompilerInconsistencyException = @"STCompilerInconsistencyException";
NSString *STInterpreterGenericException = @"STInterpreterGenericException";
NSString *STInvalidBytecodeException = @"STInterpreterInvalidBytecodeException";
NSString *STInterpreterInconsistencyException = @"STInterpreterInconsistencyException";
NSString *STLibraryDirectory = @"StepTalk";
NSString *STScriptsDirectory = @"Scripts";
NSString *STModulesDirectory = @"Modules";
NSString *STModuleExtension = @"bundle";
NSString *STScriptingEnvironmentsDirectory = @"Environments";
NSString *STScriptingEnvironmentExtension = @"stenv";
NSString *STLanguageBundlesDirectory = @"Languages";
NSString *STLanguageBundleExtension = @"stlanguage";
NSString *STLanguagesConfigFile = @"Languages.plist";
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STFileScript.h 0000644 0002043 0000764 00000002520 11131137113 025704 0 ustar johnston nielsen /**
STScript
Copyright (c) 2002 Stefan Urbanek
Written by: Stefan Urbanek
Date: 2002 Mar 10
This file is part of the StepTalk project.
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 "STScript.h"
@interface STFileScript:STScript
{
NSString *fileName;
NSString *localizedName;
NSString *menuKey;
NSString *description;
}
+ scriptWithFile:(NSString *)file;
- initWithFile:(NSString *)aFile;
- (NSString *)fileName;
- (NSString *)scriptName;
- (NSString *)localizedName;
- (NSString *)scriptDescription;
- (NSComparisonResult)compareByLocalizedName:(STFileScript *)aScript;
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STFileScript.m 0000644 0002043 0000764 00000010753 11131137113 025720 0 ustar johnston nielsen /**
STScript
Copyright (c) 2002 Stefan Urbanek
Written by: Stefan Urbanek
Date: 2002 Mar 10
This file is part of the StepTalk project.
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 "STFileScript.h"
#import "STLanguageManager.h"
#import "STCompat.h"
@interface NSDictionary(LocalizedKey)
- (id)localizedObjectForKey:(NSString *)key;
@end
@implementation NSDictionary(LocalizedKey)
- (id)localizedObjectForKey:(NSString *)key
{
NSEnumerator *enumerator;
NSDictionary *dict;
NSString *language;
NSArray *languages;
id obj = nil;
languages = [NSUserDefaults userLanguages];
enumerator = [languages objectEnumerator];
while( (language = [enumerator nextObject]) )
{
dict = [self objectForKey:language];
obj = [dict objectForKey:key];
if(obj)
{
return obj;
}
}
return [(NSDictionary *)[self objectForKey:@"Default"] objectForKey:key];
}
@end
@implementation STFileScript
+ scriptWithFile:(NSString *)file
{
STFileScript *script;
script = [[STFileScript alloc] initWithFile:file];
return AUTORELEASE(script);
}
/**
Create a new script from file aFile>. Script information will
be read from 'aFile.stinfo' file containing a dictionary property list.
*/
- initWithFile:(NSString *)aFile
{
STLanguageManager *langManager = [STLanguageManager defaultManager];
NSFileManager *manager = [NSFileManager defaultManager];
NSDictionary *info = nil;
NSString *infoFile;
NSString *lang;
BOOL isDir;
// infoFile = [aFile stringByDeletingPathExtension];
infoFile = [aFile stringByAppendingPathExtension: @"stinfo"];
if([manager fileExistsAtPath:infoFile isDirectory:&isDir] && !isDir )
{
info = [NSDictionary dictionaryWithContentsOfFile:infoFile];
}
self = [super init];
fileName = RETAIN(aFile);
localizedName = [info localizedObjectForKey:@"Name"];
if(!localizedName)
{
localizedName = [[fileName lastPathComponent]
stringByDeletingPathExtension];
}
RETAIN(localizedName);
menuKey = RETAIN([info localizedObjectForKey:@"MenuKey"]);
description = RETAIN([info localizedObjectForKey:@"Description"]);
lang = [info localizedObjectForKey:@"Language"];
if(!lang)
{
lang = [langManager languageForFileType:[fileName pathExtension]];
}
if(!lang)
{
lang = @"Unknown";
}
[self setLanguage:lang];
return self;
}
- (void)dealloc
{
RELEASE(fileName);
RELEASE(localizedName);
RELEASE(menuKey);
RELEASE(description);
[super dealloc];
}
/** Return file name of the receiver. */
- (NSString *)fileName
{
return fileName;
}
/** Return menu item key equivalent for receiver. */
- (NSString *)menuKey
{
return menuKey;
}
/** Returns source string of the receiver script.*/
- (NSString *)source
{
/* FIXME
if(!source)
{
source = [[NSString alloc] initWithContentsOfFile:fileName];
}
*/
return [[NSString alloc] initWithContentsOfFile:fileName];
}
/** Returns a script name by which the script is identified */
- (NSString *)scriptName
{
return fileName;
}
/** Returns localized name of the receiver script. */
- (NSString *)localizedName
{
return localizedName;
}
/** Returns localized description of the script. */
- (NSString *)scriptDescription
{
return description;
}
/** Returns language of the script. */
- (NSString *)language
{
return language;
}
/** Compare scripts by localized name. */
- (NSComparisonResult)compareByLocalizedName:(STFileScript *)aScript
{
return [localizedName caseInsensitiveCompare:[aScript localizedName]];
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STLanguageManager.h 0000644 0002043 0000764 00000002031 11131137113 026653 0 ustar johnston nielsen #import
@class NSArray;
@class NSBundle;
@class NSDictionary;
@class NSMutableArray;
@class NSMutableDictionary;
@class STEngine;
@interface STLanguageManager:NSObject
{
NSMutableArray *languages;
NSMutableDictionary *engineClasses;
NSMutableDictionary *languageInfos;
NSMutableDictionary *languageBundles;
NSMutableDictionary *fileTypes;
}
+ (STLanguageManager *)defaultManager;
- (NSArray *)availableLanguages;
- (NSString *)defaultLanguage;
- (void)registerLanguagesFromBundle:(NSBundle *)bundle;
- (void)registerLanguage:(NSString *)language
engineClass:(Class)class
info:(NSDictionary *)info;
- (void)removeLanguage:(NSString *)language;
- (Class)engineClassForLanguage:(NSString *)language;
- (STEngine *)createEngineForLanguage:(NSString *)language;
- (NSDictionary *)infoForLanguage:(NSString *)language;
- (NSString *)languageForFileType:(NSString *)fileType;
- (NSArray *)knownFileTypes;
- (NSBundle *)bundleForLanguage:(NSString *)language;
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STLanguageManager.m 0000644 0002043 0000764 00000022342 11131137113 026667 0 ustar johnston nielsen #import "STLanguageManager.h"
#import "STExterns.h"
#import "STCompat.h"
#import "STResourceManager.h"
static STLanguageManager *defaultManager = nil;
@interface STLanguageManager(StepTalkPrivate)
- (void) _registerKnownLanguages;
- (void) _registerLanguagesFromPath:(NSString *)path;
- (void) _updateFileTypes;
@end
@implementation STLanguageManager
+ (STLanguageManager *)defaultManager
{
if(!defaultManager)
{
defaultManager = [[STLanguageManager alloc] init];
}
return defaultManager;
}
- init
{
self = [super init];
languages = [[NSMutableArray alloc] init];
engineClasses = [[NSMutableDictionary alloc] init];
languageInfos = [[NSMutableDictionary alloc] init];
languageBundles = [[NSMutableDictionary alloc] init];
fileTypes = [[NSMutableDictionary alloc] init];
[self _registerKnownLanguages];
return self;
}
- (void)dealloc
{
RELEASE(languages);
RELEASE(engineClasses);
RELEASE(languageInfos);
RELEASE(languageBundles);
RELEASE(fileTypes);
[super dealloc];
}
- (void) _registerKnownLanguages
{
NSEnumerator *enumerator;
NSBundle *bundle;
NSString *path;
NSArray *paths;
NSLog(@"Register known languages...");
/* Search all languages */
paths = [[STResourceManager defaultManager] findAllResourcesInDirectory:@"Languages"
type:STLanguageBundleExtension];
NSLog(@"Language paths %@", paths);
/* Register plug-in languages */
enumerator = [paths objectEnumerator];
while( (path = [enumerator nextObject]) )
{
bundle = [NSBundle bundleWithPath:path];
[self registerLanguagesFromBundle:bundle];
}
/* Register contained(linked) languages */
/*enumerator = [[NSBundle allBundles] objectEnumerator];
while( (bundle = [enumerator nextObject]) )
{
[self registerLanguagesFromBundle:bundle];
}*/
}
- (void)_registerLanguagesFromPath:(NSString *)path
{
NSDirectoryEnumerator *enumerator;
NSString *file;
NSBundle *bundle;
NSDebugLLog(@"STLanguageManager",
@"Looking in path %@", path);
enumerator = [[NSFileManager defaultManager] enumeratorAtPath:path];
while( (file = [enumerator nextObject]) )
{
if([[file pathExtension] isEqualToString:STLanguageBundleExtension])
{
file = [path stringByAppendingPathComponent:file];
bundle = [NSBundle bundleWithPath:file];
[self registerLanguagesFromBundle:bundle];
}
}
}
- (void)registerLanguage:(NSString *)language
engineClass:(Class)class
info:(NSDictionary *)info
{
if([languages containsObject:language])
{
[NSException raise:@"StepTalkException"
format:@"Language '%@' already registered",
language];
return;
}
if(!language || [language isEqualToString:@""])
{
[NSException raise:@"StepTalkException"
format:@"No language specified for registration of class '%@'",
[class className]];
return;
}
if(!class)
{
[NSException raise:@"StepTalkException"
format:@"Unable to regirster language %@. No class specified.",
language];
return;
}
[languages addObject:language];
[engineClasses setObject:class forKey:language];
[languageBundles setObject:[NSBundle bundleForClass:class] forKey:language];
[languageInfos setObject:info forKey:language];
[self _updateFileTypes];
}
- (void)registerLanguagesFromBundle:(NSBundle *)bundle
{
NSDictionary *info;
NSDictionary *langDict;
NSEnumerator *enumerator;
NSString *language;
int foundLanguages = 0;
/*
StepTalkLanguages = { Smalltalk = { EngineClass = SmalltalkEngine} };
*/
NSDebugLLog(@"STLanguageManager",
@"Registering languages from bundle %@", [bundle bundlePath]);
info = [bundle infoDictionary];
langDict = [info objectForKey:@"StepTalkLanguages"];
enumerator = [langDict keyEnumerator];
while( (language = [enumerator nextObject]) )
{
info = [langDict objectForKey:language];
if([languages containsObject:language])
{
/* FIXME: issue this warning
NSLog(@"Warning: Language %@ already registered in bundle at path %@",
language, [[languageBundles objectForKey:language] bundlePath]);
*/
continue;
}
NSDebugLLog(@"STLanguageManager",
@"Found language %@", language);
[languages addObject:language];
[languageInfos setObject:info forKey:language];
[languageBundles setObject:bundle forKey:language];
foundLanguages = foundLanguages + 1;
}
if(foundLanguages == 0)
{
NSDebugLLog(@"STLanguageManager",
@"No languages found in bundle %@", [bundle bundlePath]);
}
[self _updateFileTypes];
}
- (void)_updateFileTypes
{
NSEnumerator *languageEnumerator;
NSEnumerator *fileEnumerator;
NSDictionary *info;
NSString *language;
NSString *type;
[fileTypes removeAllObjects];
languageEnumerator = [languages objectEnumerator];
while( (language = [languageEnumerator nextObject]) )
{
info = [languageInfos objectForKey:language];
fileEnumerator = [[info objectForKey:@"FileTypes"] objectEnumerator];
while( (type = [fileEnumerator nextObject]) )
{
[fileTypes setObject:language forKey:type];
}
}
}
- (NSArray *)availableLanguages
{
return [NSArray arrayWithArray:languages];
}
/** Returns the name of default scripting language specified by the
STDefaultLanguage default. If there is no such default in user's
defaults database, then Smalltalk is used. */
- (NSString *)defaultLanguage
{
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
NSString *name= [defs objectForKey:@"STDefaultLanguage"];
if(!name)
{
return @"Smalltalk";
}
else
{
return name;
}
}
- (NSArray *)knownFileTypes
{
return [fileTypes allKeys];
}
- (void)removeLanguage:(NSString *)language
{
[engineClasses removeObjectForKey:language];
[languageInfos removeObjectForKey:language];
[languageBundles removeObjectForKey:language];
[languages removeObject:language];
[self _updateFileTypes];
}
/** Return an engine class for specified language. The class lookup is as follows:
- internal class dictionary by language name
- all loaded classes by class name in the language info dictionary
- in the language bundle
- in the language bundle as language_nameEngine
*/
- (Class)engineClassForLanguage:(NSString *)language
{
NSString *className;
NSBundle *bundle;
Class class;
NSDebugLLog(@"STLanguageManager",
@"Engine class for language %@ requested", language);
class = [engineClasses objectForKey:language];
/* If there is no class, load bundle first and try again */
if(!class)
{
className = [(NSDictionary *)[languageInfos objectForKey:language]
objectForKey:@"EngineClass"];
NSDebugLLog(@"STLanguageManager",
@"No known class, looking for class named %@", className);
class = NSClassFromString(className);
if(class)
{
return class;
}
/* there is no such class, so try to load class the containing bundle */
bundle = [languageBundles objectForKey:language];
NSDebugLLog(@"STLanguageManager",
@"Looking in bundle %@", [bundle bundlePath]);
if(!bundle)
{
[NSException raise:@"StepTalkException"
format:@"Unable to find engine class for language '%@': No bundle.",
language];
return nil;
}
class = [bundle classNamed:className];
if(!class)
{
className = [language stringByAppendingString:@"Engine"];
class = [bundle classNamed:className];
if(!class)
{
[NSException raise:@"StepTalkException"
format:@"Unable to find engine class '%@' for language '%@' in bundle %@.",
className, [bundle bundlePath], language];
return nil;
}
}
}
NSDebugLLog(@"STLanguageManager",
@"Got engine class %@'", [class className]);
return class;
}
- (STEngine *)createEngineForLanguage:(NSString *)language
{
Class engineClass;
engineClass = [self engineClassForLanguage:language];
return AUTORELEASE([[engineClass alloc] init]);
}
- (NSDictionary *)infoForLanguage:(NSString *)language
{
return [languageInfos objectForKey:language];
}
- (NSBundle *)bundleForLanguage:(NSString *)language
{
return [languageBundles objectForKey:language];
}
- (NSString *)languageForFileType:(NSString *)type
{
return [fileTypes objectForKey:type];
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STMethod.h 0000644 0002043 0000764 00000002040 11131137113 025055 0 ustar johnston nielsen /**
STMethod
Copyright (c) 2003 Free Software Foundation
Written by: Stefan Urbanek
Date: 2003 Aug 6
This file is part of the StepTalk project.
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
@protocol STMethod
- (NSString *)source;
- (NSString *)methodName;
- (NSString *)languageName;
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STMethod.m 0000644 0002043 0000764 00000001701 11131137113 025065 0 ustar johnston nielsen /**
STMethod
Copyright (c) 2003 Free Software Foundation
Written by: Stefan Urbanek
Date: 2003 Aug 6
This file is part of the StepTalk project.
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 "STMethod.h"
/* Nothig here */
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STObjCRuntime.h 0000644 0002043 0000764 00000003101 11131137113 026015 0 ustar johnston nielsen /**
STObjCRuntime.m
Objective C runtime additions
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000
This file is part of the StepTalk project.
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
extern NSMutableDictionary *STAllObjectiveCClasses(void);
extern NSMutableDictionary *STGetFoundationConstants(void);
extern NSDictionary *STClassDictionaryWithNames(NSArray *classNames);
extern NSArray *STAllObjectiveCSelectors(void);
extern NSValue *STValueFromSelector(SEL sel);
extern SEL STSelectorFromValue(NSValue *val);
extern SEL STSelectorFromString(NSString *aString);
extern NSMethodSignature *STConstructMethodSignatureForSelector(SEL sel);
/* Deprecated - remove */
extern NSMethodSignature *STMethodSignatureForSelector(SEL sel);
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STObjCRuntime.m 0000644 0002043 0000764 00000016614 11131137113 026037 0 ustar johnston nielsen /**
STObjCRuntime.m
Objective C runtime additions
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000
This file is part of the StepTalk project.
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 "STObjCRuntime.h"
#import "STExterns.h"
#import "STCompat.h"
#import "ObjcRuntimeSupport.h"
#define SELECTOR_TYPES_COUNT 10
/* Predefined default selector types up to 10 arguments for fast creation.
It should be faster than manually constructing the string. */
static const char *selector_types[] =
{
"@8@0:4",
"@12@0:4@8",
"@16@0:4@8@12",
"@20@0:4@8@12@16",
"@24@0:4@8@12@16@20",
"@28@0:4@8@12@16@20@24"
"@32@0:4@8@12@16@20@24@28"
"@36@0:4@8@12@16@20@24@28@32"
"@40@0:4@8@12@16@20@24@28@32@36"
"@44@0:4@8@12@16@20@24@28@32@36@40"
};
static int VisitClassAndAddToDictionary(Class clazz, void* dictionary)
{
if (!dictionary)
return 0;
NSString* name = [NSString stringWithCString: ObjcClassName(clazz)];
[(NSMutableDictionary*)dictionary setObject: clazz forKey: name];
return 1;
}
NSMutableDictionary *STAllObjectiveCClasses(void)
{
NSMutableDictionary* dict = [NSMutableDictionary dictionary];
ObjcIterateClasses(&VisitClassAndAddToDictionary, dict);
// NSLog(@"%i Objective-C classes found",[dict count]);
return dict;
}
NSDictionary *STClassDictionaryWithNames(NSArray *classNames)
{
NSEnumerator *enumerator = [classNames objectEnumerator];
NSString *className;
NSMutableDictionary *dict = [NSMutableDictionary dictionary];
Class class;
while( (className = [enumerator nextObject]) )
{
class = NSClassFromString(className);
if(class)
{
[dict setObject:NSClassFromString(className) forKey:className];
}
else
{
NSLog(@"Warning: Class with name '%@' not found", className);
}
}
return [NSDictionary dictionaryWithDictionary:dict];
}
NSValue *STValueFromSelector(SEL sel)
{
return [NSValue value:&sel withObjCType:@encode(SEL)];
}
SEL STSelectorFromValue(NSValue *val)
{
SEL sel;
[val getValue:&sel];
return sel;
}
SEL STSelectorFromString(NSString *aString)
{
const char *name = [aString cString];
const char *ptr;
int argc = 0;
SEL sel;
sel = NSSelectorFromString(aString);
if(!sel)
{
ptr = name;
while(*ptr)
{
if(*ptr == ':')
{
argc ++;
}
ptr++;
}
if( argc < SELECTOR_TYPES_COUNT )
{
NSDebugLLog(@"STSending",
@"registering selector '%s' "
@"with %i arguments, types:'%s'",
name,argc,selector_types[argc]);
sel = ObjcRegisterSel(name, selector_types[argc]);
}
if(!sel)
{
[NSException raise:STInternalInconsistencyException
format:@"Unable to register selector '%@'",
aString];
return 0;
}
}
else
{
/* FIXME: temporary hack */
}
return sel;
}
SEL STCreateTypedSelector(SEL sel)
{
const char *name = ObjcSelName(sel);
const char *ptr;
int argc = 0;
SEL newSel;
NSLog(@"STCreateTypedSelector is deprecated.");
ptr = name;
while(*ptr)
{
if(*ptr == ':')
{
argc ++;
}
ptr++;
}
if( argc < SELECTOR_TYPES_COUNT )
{
NSDebugLLog(@"STSending",
@"registering selector '%s' "
@"with %i arguments, types:'%s'",
name,argc,selector_types[argc]);
newSel = ObjcRegisterSel(name, selector_types[argc]);
}
if(!newSel)
{
[NSException raise:STInternalInconsistencyException
format:@"Unable to register typed selector '%s'",
name];
return 0;
}
return newSel;
}
NSMethodSignature *STConstructMethodSignatureForSelector(SEL sel)
{
const char *name = ObjcSelName(sel);
const char *ptr;
const char *types = (const char *)0;
int argc = 0;
ptr = name;
while(*ptr)
{
if(*ptr == ':')
{
argc ++;
}
ptr++;
}
if( argc < SELECTOR_TYPES_COUNT )
{
NSDebugLLog(@"STSending",
@"registering selector '%s' "
@"with %i arguments, types:'%s'",
name,argc,selector_types[argc]);
types = selector_types[argc];
}
if(!types)
{
[NSException raise:STInternalInconsistencyException
format:@"Unable to construct types for selector '%s'",
name];
return 0;
}
return [NSMethodSignature signatureWithObjCTypes:types];
}
NSMethodSignature *STMethodSignatureForSelector(SEL sel)
{
const char *types;
NSLog(@"STMethodSignatureForSelector is deprecated.");
types = ObjcSelGetType(sel);
if(!types)
{
sel = STCreateTypedSelector(sel);
types = ObjcSelGetType(sel);
if (!types) {
// OSX implementation of ObjcSelGetType and returns NULL.
// It is not possible to extract the types from a selector
// on OSX. This shouldn't be a problem since this method
// is marked as deprectated.
[NSException raise: NSGenericException format: @"unsupported operation STMethodSignatureForSelector"];
}
}
return [NSMethodSignature signatureWithObjCTypes:types];
}
static int VisitSelectorAndAddToArray(Class clazz, SEL selector, void* array)
{
if (!array)
return 0;
if (selector)
[(NSMutableArray*)array addObject: NSStringFromSelector(selector)];
return 1;
}
static int VisitClassAndExtractSelectors(Class clazz, void* array)
{
if (!array)
return 0;
ObjcIterateSelectors(clazz, YES, &VisitSelectorAndAddToArray, array);
return 1;
}
NSArray *STAllObjectiveCSelectors(void)
{
NSMutableArray *array = [[NSMutableArray alloc] init];
ObjcIterateClasses(&VisitClassAndExtractSelectors, array);
/* get rid of duplicates */
array = (NSMutableArray *)[[NSSet setWithArray:(NSArray *)array] allObjects];
array = (NSMutableArray *)[array sortedArrayUsingSelector:@selector(compare:)];
return array;
}
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STObjectReference.h 0000644 0002043 0000764 00000002402 11131137113 026664 0 ustar johnston nielsen /**
STObjectReference.h
Reference to object in NSDictionary.
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000
This file is part of StepTalk.
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 NSString;
@interface STObjectReference:NSObject
{
NSString *identifier;
id target;
}
- initWithIdentifier:(NSString *)ident
target:(id)anObject;
- (void)setObject:anObject;
- (id)object;
- (NSString *)identifier;
- (id) target;
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STObjectReference.m 0000644 0002043 0000764 00000003274 11131137113 026701 0 ustar johnston nielsen /**
STObjectReference.m
Reference to object in NSDictionary.
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000
This file is part of StepTalk.
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 "STObjectReference.h"
#import "STExterns.h"
#import "STCompat.h"
#import
@implementation STObjectReference
- initWithIdentifier:(NSString *)ident
target:(id)anObject;
{
self = [super init];
identifier = [ident copy];
target = RETAIN(anObject);
return self;
}
- (void)dealloc
{
RELEASE(identifier);
RELEASE(target);
[super dealloc];
}
- (NSString *)identifier
{
return identifier;
}
- (id) target
{
return target;
}
- (void)setObject:anObject
{
if(!anObject)
{
anObject = STNil;
}
[(NSMutableDictionary *)target setObject:anObject forKey:identifier];
}
- object
{
return [(NSDictionary *)target objectForKey:identifier];
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STRemoteConversation.h 0000644 0002043 0000764 00000002762 11131137113 027476 0 ustar johnston nielsen /**
STRemoteConversation
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2003 Sep 21
This file is part of the StepTalk project.
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 "STConversation.h"
@class NSConnection;
@protocol STEnvironmentProcess
- (STConversation *)createConversation;
@end
@interface STRemoteConversation:STConversation
{
NSConnection *connection;
NSString *environmentName;
NSString *hostName;
NSDistantObject *proxy;
NSDistantObject *environmentProcess;
}
- initWithEnvironmentName:(NSString *)envName
host:(NSString *)host
language:(NSString *)langName;
- (void)open;
- (void)close;
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STRemoteConversation.m 0000644 0002043 0000764 00000006263 11131137113 027503 0 ustar johnston nielsen /* FIXME: not used! just an unimplemented idea.
*/
#import "STRemoteConversation.h"
#import "STEnvironment.h"
#import "STCompat.h"
@implementation STRemoteConversation
- initWithEnvironmentName:(NSString *)envName
host:(NSString *)host
language:(NSString *)langName
{
self = [super init];
if(!envName)
{
[NSException raise:@"STConversationException"
format:@"Unspecified environment name for a distant conversation"];
[self dealloc];
return nil;
}
environmentName = RETAIN(envName);
hostName = RETAIN(host);
[self open];
return self;
}
- (void)open
{
NSString *envProcName;
if(connection)
{
[NSException raise:@"STConversationException"
format:@"Unable to open conversation: already opened."];
return;
}
envProcName = [NSString stringWithFormat:@"STEnvironment:%@",
environmentName];
connection = [NSConnection connectionWithRegisteredName:envProcName
host:hostName];
RETAIN(connection);
if(!connection)
{
[NSException raise:@"STConversationException"
format:@"Connection failed for environment '%@'",
environmentName];
return;
}
environmentProcess = RETAIN([connection rootProxy]);
proxy = RETAIN([environmentProcess createConversation]);
[proxy setProtocolForProxy:@protocol(STConversation)];
[[NSNotificationCenter defaultCenter]
addObserver: self
selector: @selector(connectionDidDie:)
name: NSConnectionDidDieNotification
object: connection];
}
- (void)close
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
RELEASE(proxy);
proxy = nil;
RELEASE(environmentProcess);
environmentProcess = nil;
[connection invalidate];
RELEASE(connection);
connection = nil;
return;
}
- (void)dealloc
{
/* After this we should not have any connection, environmentProcess
nor proxy */
[self close];
RELEASE(environmentName);
RELEASE(hostName);
[super dealloc];
}
- (void)setLanguage:(NSString *)newLanguage
{
[proxy setLanguage:newLanguage];
}
/** Return name of the language used in the receiver conversation */
- (NSString *)language
{
return [proxy language];
}
- (STEnvironment *)environment
{
/* FIXME: return local description */
return nil;
}
- (void)interpretScript:(NSString *)aString
{
[proxy interpretScript:aString];
}
- (id)result
{
return [proxy result];
}
- (bycopy id)resultByCopy
{
return [proxy resultByCopy];
}
- (void)connectionDidDie:(NSNotification *)notification
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
if(proxy)
{
NSLog(@"Connection did die for %@ (%@)", self, environmentName);
}
else
{
NSLog(@"Closing conversation (%@) with %@", self, environmentName);
}
proxy = nil;
environmentProcess = nil;
RELEASE(connection);
connection = nil;
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STResourceManager.h 0000644 0002043 0000764 00000001541 11131145242 026726 0 ustar johnston nielsen //
// STResourceManager.h
// StepTalk
//
// Created by Stefan Urbanek on 12.5.2006.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import
@interface STResourceManager : NSObject {
NSArray *searchPaths;
BOOL searchesInLoadedBundles;
BOOL searchesBundlesFirst;
}
+ (STResourceManager *)defaultManager;
- (void)setSearchPaths:(NSArray *)array;
- (NSArray *)searchPaths;
- (void)setSearchesInLoadedBundles:(BOOL)flag;
- (BOOL)searchesInLoadedBundles;
- (void)setSearchesBundlesFirst:(BOOL)flag;
- (BOOL)searchesBundlesFirst;
- (NSArray *)findAllResourcesInDirectory:(NSString *)resourceDir
type:(NSString *)type;
- (NSString *)pathForResource:(NSString *)name
ofType:(NSString *)type
inDirectory:(NSString *)directory;
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STResourceManager.m 0000644 0002043 0000764 00000016653 11134123262 026746 0 ustar johnston nielsen //
// STResourceManager.m
// StepTalk
//
// Created by Stefan Urbanek on 12.5.2006.
// Copyright 2006 __MyCompanyName__. All rights reserved.
//
#import "STResourceManager.h"
#import "STExterns.h"
static STResourceManager *defaultManager = nil;
@implementation STResourceManager
+ (STResourceManager *)defaultManager
{
if(defaultManager == nil)
{
defaultManager = [[STResourceManager alloc] init];
}
return defaultManager;
}
+ (NSArray *)defaultSearchPaths
{
NSFileManager *manager = [NSFileManager defaultManager];
NSArray *paths;
NSEnumerator *enumerator;
NSString *path;
NSMutableArray *array;
array = [NSMutableArray array];
paths = NSSearchPathForDirectoriesInDomains(NSAllLibrariesDirectory,
NSAllDomainsMask, YES);
enumerator = [paths objectEnumerator];
while( (path = [enumerator nextObject]) )
{
path = [path stringByAppendingPathComponent:STLibraryDirectory];
if( [manager fileExistsAtPath:path] )
{
[array addObject:path];
}
}
return array;
}
- init
{
self = [super init];
[self setSearchPaths:[STResourceManager defaultSearchPaths]];
searchesInLoadedBundles = YES;
return self;
}
- (void)setSearchPaths:(NSArray *)array
{
[array retain];
[searchPaths release];
searchPaths = array;
}
- (NSArray *)searchPaths
{
return searchPaths;
}
- (void)setSearchesInLoadedBundles:(BOOL)flag
{
searchesInLoadedBundles = flag;
}
- (BOOL)searchesInLoadedBundles
{
return searchesInLoadedBundles;
}
- (void)setSearchesBundlesFirst:(BOOL)flag
{
searchesBundlesFirst = flag;
}
- (BOOL)searchesBundlesFirst
{
return searchesBundlesFirst;
}
- (NSString *)_pathForAnyBundleResource:(NSString *)name
type:(NSString *)type
directory:(NSString *)directory
{
NSEnumerator *enumerator;
NSBundle *bundle;
NSString *path = nil;
enumerator = [[NSBundle allFrameworks] objectEnumerator];
while( (bundle = [enumerator nextObject]) )
{
path = [bundle pathForResource:name ofType:type inDirectory:directory];
if(path)
{
return path;
}
}
enumerator = [[NSBundle allBundles] objectEnumerator];
while( (bundle = [enumerator nextObject]) )
{
path = [bundle pathForResource:name ofType:type inDirectory:directory];
if(path)
{
return path;
}
}
return nil;
}
- (NSArray *)_findAllBundleResourcesInDirectory:(NSString *)directory
type:(NSString *)type
{
NSFileManager *manager = [NSFileManager defaultManager];
NSDirectoryEnumerator *dirs;
NSMutableArray *resources = [NSMutableArray array];
NSEnumerator *enumerator;
NSBundle *bundle;
NSString *path = nil;
NSString *file;
enumerator = [[NSBundle allFrameworks] objectEnumerator];
while( (bundle = [enumerator nextObject]) )
{
/* FIXME: append Contents? */
path = [bundle bundlePath];
path = [path stringByAppendingPathComponent:directory];
dirs = [manager enumeratorAtPath:path];
while( (file = [dirs nextObject]) )
{
if( [[[dirs directoryAttributes] fileType]
isEqualToString:NSFileTypeDirectory]
&& [[file pathExtension] isEqualToString:type])
{
file = [path stringByAppendingPathComponent:file];
[resources addObject:file];
}
}
}
enumerator = [[NSBundle allBundles] objectEnumerator];
while( (bundle = [enumerator nextObject]) )
{
/* FIXME: append Contents? */
path = [bundle bundlePath];
path = [path stringByAppendingPathComponent:directory];
dirs = [manager enumeratorAtPath:path];
while( (file = [dirs nextObject]) )
{
if( [[[dirs directoryAttributes] fileType]
isEqualToString:NSFileTypeDirectory]
&& [[file pathExtension] isEqualToString:type])
{
file = [path stringByAppendingPathComponent:file];
[resources addObject:file];
}
}
}
return resources;
}
- (NSArray *)findAllResourcesInDirectory:(NSString *)directory
type:(NSString *)type
{
NSFileManager *manager = [NSFileManager defaultManager];
NSDirectoryEnumerator *dirs;
NSEnumerator *enumerator;
NSString *path;
NSString *file;
NSMutableArray *resources = [NSMutableArray array];
enumerator = [searchPaths objectEnumerator];
while( (path = [enumerator nextObject]) )
{
// path = [path stringByAppendingPathComponent:STLibraryDirectory];
path = [path stringByAppendingPathComponent:directory];
if( ![manager fileExistsAtPath:path] )
{
continue;
}
dirs = [manager enumeratorAtPath:path];
while( (file = [dirs nextObject]) )
{
if( [[[dirs directoryAttributes] fileType]
isEqualToString:NSFileTypeDirectory]
&& [[file pathExtension] isEqualToString:type])
{
file = [path stringByAppendingPathComponent:file];
[resources addObject:file];
}
}
}
if(searchesInLoadedBundles)
{
NSArray *bundleResources;
bundleResources = [self _findAllBundleResourcesInDirectory:directory
type:type];
if(searchesBundlesFirst)
{
resources = [bundleResources arrayByAddingObjectsFromArray:resources];
}
else
{
[resources addObjectsFromArray:bundleResources];
}
}
return [NSArray arrayWithArray:resources];
}
- (NSString *)pathForResource:(NSString *)name
ofType:(NSString *)type
inDirectory:(NSString *)directory
{
NSFileManager *manager = [NSFileManager defaultManager];
NSEnumerator *enumerator;
NSString *path;
NSString *file = nil;
if(searchesInLoadedBundles && searchesBundlesFirst)
{
file = [self _pathForAnyBundleResource:name
type:type
directory:directory];
if(file)
{
return file;
}
}
enumerator = [searchPaths objectEnumerator];
while( (path = [enumerator nextObject]) )
{
// file = [path stringByAppendingPathComponent:STLibraryDirectory];
file = path;
file = [file stringByAppendingPathComponent:directory];
file = [file stringByAppendingPathComponent:name];
file = [file stringByAppendingPathExtension:type];
if( [manager fileExistsAtPath:file] )
{
return file;
}
}
if(searchesInLoadedBundles && !searchesBundlesFirst)
{
file = [self _pathForAnyBundleResource:name
type:type
directory:directory];
if(file)
{
return file;
}
}
return nil;
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STScript.h 0000644 0002043 0000764 00000002441 11131137113 025106 0 ustar johnston nielsen /**
STScript
Copyright (c) 2002 Stefan Urbanek
Written by: Stefan Urbanek
Date: 2002 Mar 10
This file is part of the StepTalk project.
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 STScript:NSObject
{
NSString *source;
NSString *language;
}
+ scriptWithSource:(NSString *)aString language:(NSString *)lang;
- initWithSource:(NSString *)aString language:(NSString *)lang;
- (NSString *)source;
- (void)setSource:(NSString *)aString;
- (NSString *)language;
- (void)setLanguage:(NSString *)name;
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STScript.m 0000644 0002043 0000764 00000003143 11131137113 025113 0 ustar johnston nielsen /**
STScript
Copyright (c) 2002 Stefan Urbanek
Written by: Stefan Urbanek
Date: 2002 Mar 10
This file is part of the StepTalk project.
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 "STScript.h"
#import "STCompat.h"
@implementation STScript
+ scriptWithSource:(NSString *)aString language:(NSString *)lang
{
return AUTORELEASE([[self alloc] initWithSource:aString language:lang]);
}
- initWithSource:(NSString *)aString language:(NSString *)lang
{
self = [super init];
language = RETAIN(lang);
source = RETAIN(aString);
return self;
}
- (NSString *)source
{
return source;
}
- (void)setSource:(NSString *)aString
{
ASSIGN(source,aString);
}
/** Returns language of the script. */
- (NSString *)language
{
return language;
}
/** Set language of the script. */
- (void)setLanguage:(NSString *)name
{
ASSIGN(language,name);
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STScriptObject.h 0000644 0002043 0000764 00000001673 11131137113 026243 0 ustar johnston nielsen /* 2003 Aug 5 */
#import
#import "STMethod.h"
@class NSMutableDictionary;
@class NSDictionary;
@class NSArray;
@class STEnvironment;
@protocol STScriptObject
- (NSArray *)instanceVariableNames;
@end
@interface STScriptObject:NSObject
{
NSMutableDictionary *ivars;
NSMutableDictionary *methodDictionary;
STEnvironment *environment;
}
+ scriptObject;
- initWithInstanceVariableNames:(NSString *)names;
- (void)setEnvironment:(STEnvironment *)env;
- (STEnvironment *)environment;
- (void)setObject:(id)anObject forVariable:(NSString *)aName;
- (id)objectForVariable:(NSString *)aName;
- (NSArray *)instanceVariableNames;
- (void)addMethod:(id )aMethod;
- (id )methodWithName:(NSString *)aName;
- (void)removeMethod:(id )aMethod;
- (void)removeMethodWithName:(NSString *)aName;
- (NSArray *)methodNames;
- (NSDictionary *)methodDictionary;
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STScriptObject.m 0000644 0002043 0000764 00000007566 11131137113 026257 0 ustar johnston nielsen /* 2003 Aug 5 */
#import "STScriptObject.h"
#import "NSInvocation+additions.h"
#import "STEnvironment.h"
#import "STEngine.h"
#import "STExterns.h"
#import "STCompat.h"
#import "STObjCRuntime.h"
@implementation STScriptObject
/** Return new instance of script object without any instance variables */
+ scriptObject
{
return AUTORELEASE([[self alloc] init]);
}
- init
{
self = [super init];
methodDictionary = [[NSMutableDictionary alloc] init];
return self;
}
- initWithInstanceVariableNames:(NSString *)names
{
return [self init];
}
- (void)dealloc
{
RELEASE(methodDictionary);
RELEASE(ivars);
[super dealloc];
}
- (void)setObject:(id)anObject forVariable:(NSString *)aName
{
[self notImplemented:_cmd];
}
- (id)objectForVariable:(NSString *)aName
{
[self notImplemented:_cmd];
return nil;
}
- (NSArray *)instanceVariableNames
{
return [ivars allKeys];
}
- (void)addMethod:(id )aMethod
{
[methodDictionary setObject:aMethod forKey:[aMethod methodName]];
}
- (id )methodWithName:(NSString *)aName
{
return [methodDictionary objectForKey:aName];
}
- (void)removeMethod:(id )aMethod
{
[self notImplemented:_cmd];
}
- (void)removeMethodWithName:(NSString *)aName
{
[methodDictionary removeObjectForKey:aName];
}
- (NSArray *)methodNames
{
return [methodDictionary allKeys];
}
- (NSDictionary *)methodDictionary
{
return [NSDictionary dictionaryWithDictionary:methodDictionary];
}
/** Set object's environment. Note: This method should be replaced by
some other, more clever mechanism. */
- (void)setEnvironment:(STEnvironment *)env
{
ASSIGN(environment, env);
}
- (STEnvironment *)environment
{
return environment;
}
- (BOOL)respondsToSelector:(SEL)aSelector
{
if( [super respondsToSelector:(SEL)aSelector] )
{
return YES;
}
return ([methodDictionary objectForKey:NSStringFromSelector(aSelector)] != nil);
}
- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel
{
NSMethodSignature *signature = nil;
signature = [super methodSignatureForSelector:sel];
if(!signature)
{
signature = STConstructMethodSignatureForSelector(sel);
}
return signature;
}
- (void) forwardInvocation:(NSInvocation *)invocation
{
STEngine *engine;
id method;
NSString *methodName = NSStringFromSelector([invocation selector]);
NSMutableArray *args;
id arg;
int index;
int count;
id retval = nil;
method = [methodDictionary objectForKey:methodName];
if(!method)
{
[NSException raise:@"STScriptObjectException"
format:@"No script object method with name '%@'",
methodName];
return;
}
engine = [STEngine engineForLanguage:[method languageName]];
/* Get arguments as array */
count = [[invocation methodSignature] numberOfArguments];
args = [NSMutableArray array];
for(index = 2; index < count; index++)
{
arg = [invocation getArgumentAsObjectAtIndex:index];
if (arg == nil)
{
[args addObject:STNil];
}
else
{
[args addObject:arg];
}
}
retval = [engine executeMethod:method
forReceiver:self
withArguments:args
inContext:environment];
[invocation setReturnValue:&retval];
}
- (void)encodeWithCoder:(NSCoder *)coder
{
// [super encodeWithCoder: coder];
[coder encodeObject:methodDictionary];
[coder encodeObject:ivars];
}
- initWithCoder:(NSCoder *)decoder
{
self = [super init]; //[super initWithCoder: decoder];
[decoder decodeValueOfObjCType: @encode(id) at: &methodDictionary];
[decoder decodeValueOfObjCType: @encode(id) at: &ivars];
return self;
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STScripting.h 0000644 0002043 0000764 00000002315 11131137113 025604 0 ustar johnston nielsen /**
STScripting.h
Scripting protocol
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000
This file is part of the StepTalk project.
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;
@protocol STScripting
- (BOOL)isClass;
+ (BOOL)isClass;
- (NSString *)className;
+ (NSString *)className;
- (Class) classForScripting;
+ (Class) classForScripting;
@end
@interface NSObject (STScripting)
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STScripting.m 0000644 0002043 0000764 00000003033 11131137113 025607 0 ustar johnston nielsen /**
STScripting.m
Scripting protocol
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000
This file is part of the StepTalk project.
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
STScripting protocol documentation
*/
#import "STScripting.h"
@implementation NSObject (STScripting)
/*
- (id)replacementForScriptingInEnvironment:(STEnvironment *)env
{
return self;
}
*/
- (BOOL)isClass
{
return NO;
}
+ (BOOL)isClass
{
return YES;
}
+ (NSString *)className
{
return NSStringFromClass(self);
}
- (NSString *)className
{
return [[self class] className];
}
/*Subclasses should override this method to force use of another class */
- (Class) classForScripting
{
return [self class];
}
+ (Class) classForScripting
{
return [self class];
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STScriptsManager.h 0000644 0002043 0000764 00000002620 11131137113 026563 0 ustar johnston nielsen /**
STScriptsManager
Copyright (c)2002 Stefan Urbanek
Written by: Stefan Urbanek
Date: 2002 Mar 10
This file is part of the StepTalk project.
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 STFileScript;
@interface STScriptsManager:NSObject
{
NSString *scriptsDomainName;
NSArray *scriptSearchPaths;
}
+ defaultManager;
- initWithDomainName:(NSString *)name;
- (NSString *)scriptsDomainName;
- (void)setScriptSearchPathsToDefaults;
- (NSArray *)scriptSearchPaths;
- (void)setScriptSearchPaths:(NSArray *)anArray;
- (NSArray *)validScriptSearchPaths;
- (STFileScript *)scriptWithName:(NSString*)aString;
- (NSArray *)allScripts;
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STScriptsManager.m 0000644 0002043 0000764 00000020007 11131137113 026567 0 ustar johnston nielsen /**
STScriptsManager
Copyright (c)2002 Stefan Urbanek
Written by: Stefan Urbanek
Date: 2002 Mar 10
This file is part of the StepTalk project.
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 "STScriptsManager.h"
#import "STExterns.h"
#import "STLanguageManager.h"
#import "STFileScript.h"
#import "STCompat.h"
static STScriptsManager *sharedScriptsManager = nil;
@interface STScriptsManager (STPriavteMethods)
- (NSArray *)_scriptsAtPath:(NSString *)path;
@end
@implementation STScriptsManager
/** Return default domain name for scripts. Usually this is application or
process name.*/
+ (NSString *)defaultScriptsDomainName
{
return [[NSProcessInfo processInfo] processName];
}
/** Returns default scripts manager for current process (application or tool). */
+ defaultManager
{
if(!sharedScriptsManager)
{
sharedScriptsManager = [[STScriptsManager alloc] init];
}
return sharedScriptsManager;
}
- init
{
return [self initWithDomainName:nil];
}
/**
Initializes the receiver to be used with domain named name.
If name is nil, default scripts domain name will be used.
*/
- initWithDomainName:(NSString *)name
{
self = [super init];
if(!name)
{
name = [STScriptsManager defaultScriptsDomainName];
}
scriptsDomainName = RETAIN(name);
return self;
}
- (void)dealloc
{
RELEASE(scriptsDomainName);
[super dealloc];
}
/** Return name of script manager domain. */
- (NSString *)scriptsDomainName
{
return scriptsDomainName;
}
/* Sets script search paths to defaults. Default paths are (in this order):
/StepTalk/Scripts/.
/StepTalk/Scripts/Shared and
paths to Resource/Scripts in all loaded bundles including the main bundle.*/
- (void)setScriptSearchPathsToDefaults
{
NSMutableArray *scriptPaths = [NSMutableArray array];
NSEnumerator *enumerator;
NSString *path;
NSString *str;
NSArray *paths;
NSBundle *bundle;
paths = NSSearchPathForDirectoriesInDomains(NSAllLibrariesDirectory,
NSAllDomainsMask, YES);
enumerator = [paths objectEnumerator];
while( (path = [enumerator nextObject]) )
{
path = [path stringByAppendingPathComponent:STLibraryDirectory];
path = [path stringByAppendingPathComponent:@"Scripts"];
str = [path stringByAppendingPathComponent: scriptsDomainName];
[scriptPaths addObject:str];
str = [path stringByAppendingPathComponent:@"Shared"];
[scriptPaths addObject:str];
}
/* Add same, but without StepTalk (only Library/Scripts) */
enumerator = [paths objectEnumerator];
while( (path = [enumerator nextObject]) )
{
path = [path stringByAppendingPathComponent:@"Scripts"];
str = [path stringByAppendingPathComponent: scriptsDomainName];
[scriptPaths addObject:str];
str = [path stringByAppendingPathComponent:@"Shared"];
[scriptPaths addObject:str];
}
enumerator = [[NSBundle allBundles] objectEnumerator];
while( (bundle = [enumerator nextObject]) )
{
path = [bundle resourcePath];
path = [path stringByAppendingPathComponent:@"Scripts"];
[scriptPaths addObject:path];
}
NSLog(@"SCript apths %@", scriptPaths);
RELEASE(scriptSearchPaths);
scriptSearchPaths = [[NSArray alloc] initWithArray:scriptPaths];
}
/**
Retrun an array of script search paths. Scripts are searched
in Library/StepTalk/Scripts/scriptsDomainName,
Library/StepTalk/Scripts/Shared and in all loaded bundles in
bundlePath/Resources/Scripts.
*/
- (NSArray *)scriptSearchPaths
{
if(!scriptSearchPaths)
{
[self setScriptSearchPathsToDefaults];
}
return scriptSearchPaths;
}
/** Set script search paths to anArray. */
- (void)setScriptSearchPaths:(NSArray *)anArray
{
ASSIGN(scriptSearchPaths, anArray);
}
/** Return script search paths that are valid. That means that path exists and
is a directory. */
- (NSArray *)validScriptSearchPaths
{
NSMutableArray *scriptPaths = [NSMutableArray array];
NSFileManager *manager = [NSFileManager defaultManager];
NSEnumerator *enumerator;
NSString *path;
NSArray *paths;
BOOL isDir;
paths = [self scriptSearchPaths];
enumerator = [paths objectEnumerator];
while( (path = [enumerator nextObject]) )
{
if( [manager fileExistsAtPath:path isDirectory:&isDir] && isDir )
{
// NSLog(@"VARLIOD %@", path);
[scriptPaths addObject:path];
}
}
return [NSArray arrayWithArray:scriptPaths];
}
/**
Get a script with name aString for current scripting domain.
*/
- (STFileScript *)scriptWithName:(NSString*)aString
{
NSFileManager *manager = [NSFileManager defaultManager];
NSEnumerator *pEnumerator;
NSEnumerator *sEnumerator;
NSString *path;
NSString *file;
NSString *str;
NSArray *paths;
paths = [self validScriptSearchPaths];
pEnumerator = [paths objectEnumerator];
while( (path = [pEnumerator nextObject]) )
{
// NSLog(@"IN %@", path);
sEnumerator = [[manager directoryContentsAtPath:path] objectEnumerator];
while( (file = [sEnumerator nextObject]) )
{
if( ! [[file pathExtension] isEqualToString:@"stinfo"] )
{
NSDebugLLog(@"STScriptManager", @"Script %@", file);
str = [file lastPathComponent];
str = [str stringByDeletingPathExtension];
if([str isEqualToString:aString])
{
return [STFileScript scriptWithFile:
[path stringByAppendingPathComponent:file]];
}
}
}
}
return nil;
}
- (NSArray *)_scriptsAtPath:(NSString *)path
{
STLanguageManager *langManager = [STLanguageManager defaultManager];
NSMutableArray *scripts = [NSMutableArray array];
NSFileManager *manager = [NSFileManager defaultManager];
NSEnumerator *enumerator;
NSString *file;
NSString *ext;
NSSet *types;
types = [NSSet setWithArray:[langManager knownFileTypes]];
enumerator = [[manager directoryContentsAtPath:path] objectEnumerator];
while( (file = [enumerator nextObject]) )
{
ext = [file pathExtension];
if( [types containsObject:ext] )
{
STFileScript *script;
NSLog(@"Found script %@", file);
script = [STFileScript scriptWithFile:
[path stringByAppendingPathComponent:file]];
[scripts addObject:script];
}
}
return [NSArray arrayWithArray:scripts];
}
/** Return list of all scripts for managed domain. */
- (NSArray *)allScripts
{
NSMutableArray *scripts = [NSMutableArray array];
NSEnumerator *enumerator;
NSString *path;
enumerator = [[self validScriptSearchPaths] objectEnumerator];
while( (path = [enumerator nextObject]) )
{
[scripts addObjectsFromArray:[self _scriptsAtPath:path]];
}
return [NSArray arrayWithArray:scripts];
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STSelector.h 0000644 0002043 0000764 00000002215 11131137113 025421 0 ustar johnston nielsen /*
STSelector
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2002 Feb 4
This file is part of the StepTalk project.
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 STSelector:NSObject
{
NSString *selectorName;
SEL sel;
}
- initWithName:(NSString *)aString;
- initWithSelector:(SEL)aSel;
- (SEL)selectorValue;
- (NSString *)selectorName;
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STSelector.m 0000644 0002043 0000764 00000003700 11131137113 025426 0 ustar johnston nielsen /*
STSelector
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2002 Feb 4
This file is part of the StepTalk project.
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 "STSelector.h"
#import "STObjCRuntime.h"
#import "STCompat.h"
@implementation STSelector
- initWithName:(NSString *)aString
{
[super init];
selectorName = RETAIN(aString);
return self;
}
- initWithSelector:(SEL)aSel
{
[super init];
sel = aSel;
return self;
}
- (void)dealloc
{
RELEASE(selectorName);
[super dealloc];
}
- (SEL)selectorValue
{
if(sel == 0)
{
sel = STSelectorFromString(selectorName);
}
return sel;
}
- (NSString *)description
{
return [NSString stringWithFormat:@"#%@", [self selectorName]];
}
- (NSString *)selectorName
{
if(!selectorName)
{
selectorName = RETAIN(NSStringFromSelector(sel));
}
return selectorName;
}
- (void)encodeWithCoder:(NSCoder *)coder
{
// [super encodeWithCoder: coder];
[coder encodeObject:selectorName];
}
- initWithCoder:(NSCoder *)decoder
{
self = [super init]; // super initWithCoder: decoder];
[decoder decodeValueOfObjCType: @encode(id) at: &selectorName];
return self;
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STStructure.h 0000644 0002043 0000764 00000004235 11131137113 025645 0 ustar johnston nielsen /**
STStructure.h
C structure wrapper
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000
This file is part of StepTalk.
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 STRange;
// @class STPoint;
// @class STRect;
@interface STStructure:NSObject
{
NSString *structType;
NSString *name;
NSMutableArray *fields;
}
+ structureWithValue:(void *)value type:(const char*)type;
+ structureWithRange:(NSRange)range;
+ structureWithPoint:(NSPoint)point;
+ structureWithRect:(NSRect)rect;
+ structureWithSize:(NSSize)size;
- initWithValue:(void *)value type:(const char*)type;
- (const char *)type;
- (NSString *)structureName;
- (void)getValue:(void *)value;
- (NSRange)rangeValue;
- (NSPoint)pointValue;
- (NSRect)rectValue;
- (NSSize)sizeValue;
- valueAtIndex:(unsigned)index;
- (void)setValue:anObject atIndex:(unsigned)index;
- (int)intValueAtIndex:(unsigned)index;
- (float)floatValueAtIndex:(unsigned)index;
@end
/*
@interface STRange:STStructure
- rangeWithLocation:(int)loc length:(int)length;
- (int)location;
- (int)length;
@end
@interface STPoint:STStructure
- pointWithX:(float)x y:(float)y;
- (float)x;
- (float)y;
@end
@interface STRect:STStructure
- rectWithX:(float)x y:(float)y width:(float)w heigth:(float)h;
- rectWithOrigin:(NSPoint)origin size:(NSPoint)size;
- (float)x;
- (float)y;
- (float)width;
- (float)height;
- (NSPoint)origin;
- (NSPoint)size;
@end
*/
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STStructure.m 0000644 0002043 0000764 00000015157 11131137113 025657 0 ustar johnston nielsen /**
STStructure.m
C structure wrapper
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000
This file is part of StepTalk.
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 "STStructure.h"
#import "STExterns.h"
#import "STCompat.h"
#import "NSInvocation+additions.h"
#import "ObjcRuntimeSupport.h"
@implementation STStructure
+ structureWithValue:(void *)value type:(const char*)type
{
STStructure *str;
str = [[self alloc] initWithValue:value type:type];
return AUTORELEASE(str);
}
+ structureWithRange:(NSRange)range
{
STStructure *str;
str = [[self alloc] initWithValue:&range type:@encode(NSRange)];
return AUTORELEASE(str);
}
+ structureWithPoint:(NSPoint)point
{
STStructure *str;
str = [[self alloc] initWithValue:&point type:@encode(NSPoint)];
return AUTORELEASE(str);
}
+ structureWithSize:(NSSize)size
{
STStructure *str;
str = [[self alloc] initWithValue:&size type:@encode(NSSize)];
return AUTORELEASE(str);
}
+ structureWithRect:(NSRect)rect
{
STStructure *str;
str = [[self alloc] initWithValue:&rect type:@encode(NSRect)];
return AUTORELEASE(str);
}
- initWithValue:(void *)value type:(const char*)type
{
const char *nameBeg;
int offset = 0;
int align;
int rem;
self = [super init];
NSDebugLLog(@"STStructure",
@"creating structure of type '%s' value ptr %p",type,value);
structType = [[NSString alloc] initWithCString:type];
fields = [[NSMutableArray alloc] init];
type++;
nameBeg = type;
while (*type != _C_STRUCT_E && *type++ != '=');
name = [[NSString alloc] initWithCString:nameBeg length:type-nameBeg];
while(*type != _C_STRUCT_E)
{
[fields addObject:STObjectFromValueOfType(((char *)value)+offset,type)];
offset += ObjcSizeOfType(type);
type = ObjcSkipTypeSpec(type);
if(*type == _C_STRUCT_E)
{
break;
}
align = ObjcAlignOfType(type);
rem = offset % align;
if(rem != 0)
{
offset += align - rem;
}
}
return self;
}
- (void)dealloc
{
RELEASE(fields);
RELEASE(structType);
RELEASE(name);
[super dealloc];
}
- (void)getValue:(void *)value
{
const char *type = [structType cString];
int offset=0;
int align;
int rem;
int i = 0;
type++;
while (*type != _C_STRUCT_E && *type++ != '=');
while(*type != _C_STRUCT_E)
{
STGetValueOfTypeFromObject((void *)((char*)value+offset),
type,
[fields objectAtIndex:i++]);
offset += ObjcSizeOfType(type);
type = ObjcSkipTypeSpec(type);
if(*type == _C_STRUCT_E)
{
break;
}
align = ObjcAlignOfType(type);
rem = offset % align;
if(rem != 0)
{
offset += align - rem;
}
}
}
- (const char *)type
{
return [structType cString];
}
- (NSString *)structureName
{
return name;
}
- (const char *)typeOfFieldAtIndex:(unsigned)index
{
const char *type = [structType cString];
for(type += 1; *type != _C_STRUCT_E && index>0; index--)
{
type = ObjcSkipArgSpec(type);
}
if(*type == _C_STRUCT_E)
{
[NSException raise:STInternalInconsistencyException
format:@"invalid structure field index"];
return 0;
}
return type;
}
- (NSRange)rangeValue
{
/* FIXME: do some checking */
return NSMakeRange([self intValueAtIndex:0],[self intValueAtIndex:1]);
}
- (NSPoint)pointValue
{
/* FIXME: do some checking */
return NSMakePoint([self floatValueAtIndex:0],[self floatValueAtIndex:1]);
}
- (NSSize)sizeValue
{
/* FIXME: do some checking */
return NSMakeSize([self floatValueAtIndex:0],[self floatValueAtIndex:1]);
}
- (NSRect)rectValue
{
NSPoint origin = [[fields objectAtIndex:0] pointValue];
NSSize size = [[fields objectAtIndex:1] sizeValue];
NSRect rect;
/* FIXME: do some checking */
rect.origin = origin;
rect.size = size;
return rect;
}
- valueAtIndex:(unsigned)index
{
return [fields objectAtIndex:index];
}
- (void)setValue:anObject atIndex:(unsigned)index
{
[fields replaceObjectAtIndex:index withObject:anObject];
}
- (int)intValueAtIndex:(unsigned)index
{
return (int)[[fields objectAtIndex:index] intValue];
}
- (float)floatValueAtIndex:(unsigned)index
{
return (float)[[fields objectAtIndex:index] floatValue];
}
/* NSRange */
- (int)location
{
return [[fields objectAtIndex:0] intValue];
}
- (int)length
{
return [[fields objectAtIndex:1] intValue];
}
- (void)setLocation:(int)location
{
[fields replaceObjectAtIndex:0 withObject: [NSNumber numberWithInt:location]];
}
- (void)setLength:(int)length
{
[fields replaceObjectAtIndex:1 withObject: [NSNumber numberWithInt:length]];
}
/* NSPoint */
- (float)x
{
return [[fields objectAtIndex:0] floatValue];
}
- (void)setX:(float)x
{
[fields replaceObjectAtIndex:0 withObject: [NSNumber numberWithFloat:x]];
}
- (float)y
{
return [[fields objectAtIndex:1] floatValue];
}
- (void)setY:(float)y
{
[fields replaceObjectAtIndex:1 withObject: [NSNumber numberWithFloat:y]];
}
/* NSSize */
- (float)width
{
return [[fields objectAtIndex:0] floatValue];
}
- (float)height
{
return [[fields objectAtIndex:1] floatValue];
}
- (void)setWidth:(float)width
{
[fields replaceObjectAtIndex:0 withObject: [NSNumber numberWithFloat:width]];
}
- (void)setHeight:(float)height
{
[fields replaceObjectAtIndex:1 withObject: [NSNumber numberWithFloat:height]];
}
/* NSRect */
- (id)origin
{
NSLog(@"Origin %@", [fields objectAtIndex:0]);
return [fields objectAtIndex:0];
}
- (id)size
{
NSLog(@"Size %@", [fields objectAtIndex:1]);
return [fields objectAtIndex:1] ;
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STUndefinedObject.h 0000644 0002043 0000764 00000002012 11131137113 026664 0 ustar johnston nielsen /**
STUndefinedObject.h
Wrapper for nil object
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000
This file is part of the StepTalk project.
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 STUndefinedObject:NSObject
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/STUndefinedObject.m 0000644 0002043 0000764 00000003637 11131137113 026707 0 ustar johnston nielsen /**
STUndefinedObject.m
Wrapper for nil object
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2000
This file is part of the StepTalk project.
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 "STUndefinedObject.h"
#import "STExterns.h"
#import "STObjCRuntime.h"
STUndefinedObject *STNil = nil;
@implementation STUndefinedObject
+ (id) alloc
{
return STNil;
}
+ (id) allocWithZone: (NSZone*)z
{
return STNil;
}
+ (id) autorelease
{
return self;
}
- (void) dealloc
{
NSLog(@"Warning: Trying to dealloc STNil object");
[super dealloc];
}
- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel
{
NSMethodSignature *signature = nil;
signature = [super methodSignatureForSelector:sel];
if(!signature)
{
signature = STConstructMethodSignatureForSelector(sel);
}
return signature;
}
- (void) forwardInvocation: (NSInvocation*)anInvocation
{
/* this object is deaf */
}
- (BOOL) isEqual: (id)anObject
{
return ( (self == anObject) || (anObject == nil) );
}
- (void) release
{
/* do nothing */
}
- (id) retain
{
return self;
}
- (BOOL)isNil
{
return YES;
}
- (BOOL)notNil
{
return NO;
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/ScriptingInfo.plist 0000644 0002043 0000764 00000000507 11131137113 027056 0 ustar johnston nielsen {
ScriptingInfoClass = StepTalkScriptingInfo;
Classes = (
STActor,
STEnvironment,
STLanguageManager,
STScript,
STScriptsManager,
STBundleInfo,
STEngine,
STScriptObject,
STConversation,
STRemoteConversation,
STContext
);
}
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/StepTalk.h 0000644 0002043 0000764 00000003102 11131137113 025115 0 ustar johnston nielsen /**
StepTalk.h
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2001 Nov 1
This file is part of the StepTalk project.
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
#import
#import
#import
#import
#import
#import
#import
#import
#import
#import
#import
#import
#import
#import
#import
#import
#import
#import
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/StepTalkScriptingInfo.h 0000644 0002043 0000764 00000002042 11131137113 027616 0 ustar johnston nielsen /**
StepTalkScriptingInfo.h
Module to bring StepTalk classes
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2002 Jun 18
This file is part of the StepTalk project.
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 StepTalkScriptingInfo:NSObject
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/StepTalkScriptingInfo.m 0000644 0002043 0000764 00000002162 11131137113 027626 0 ustar johnston nielsen /**
StepTalkScriptingInfo.
Module to bring StepTalk classes
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
Date: 2002 Jun 18
This file is part of the StepTalk project.
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 "StepTalkScriptingInfo.h"
@class NSDictionary;
@implementation StepTalkScriptingInfo
+ (NSDictionary *)namedObjectsForScripting
{
return nil;
}
@end
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/Environments/ 0000755 0002043 0000764 00000000000 11167405532 025724 5 ustar johnston nielsen Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/Environments/AppKit.stenv 0000644 0002043 0000764 00000000420 11131140001 030143 0 ustar johnston nielsen /** AppKit.stenv
Description for AppKit environment.
Using this description will include Application Kit objects and
Application finder.
*/
{
Name = "AppKit";
Modules = (AppKit);
Finders = (ApplicationFinder);
Use = (Foundation);
}
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/Environments/Common.stenv 0000644 0002043 0000764 00000000435 11131140001 030211 0 ustar johnston nielsen /** Common.stenv
* Common scripting environment description
*/
{
Name = "Common";
Bundles = (CommonEnvironment);
Import = ( "SymbolicSelectors",
"Foundation",
"AppKit"
);
Applications = ( All );
}
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/Environments/Distributed.stenv 0000644 0002043 0000764 00000000370 11131140001 031241 0 ustar johnston nielsen /** Distributed.stenv
Description for distributed environment.
Using this description will include Distributed Object finder.
*/
{
Name = "Distributed";
Finders = (DistributedFinder);
Use = ("Foundation");
}
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/Environments/Foundation-operators.stenv 0000644 0002043 0000764 00000005622 11131140001 033106 0 ustar johnston nielsen /** Foundation-operators.stenv
*/
{
Name = "Foundation-operators";
Use = (SymbolicSelectors);
DefaultRestriction = AllowAll;
Behaviours =
{
"NSObject-operators" = {
Use = (Comparison, KeyValueCoding);
};
};
Classes =
{
All = {
};
// added by mateu
"NSObject class" = {
SymbolicSelectors = {
"=" = "isEqual:";
"==" = "isSame:";
"~=" = "notEqual:";
"~~" = "notSame:";
};
};
NSObject = {
Use = ("NSObject-operators");
};
NSProxy = {
Use = (KeyValueCoding);
};
NSArray = {
Super = "NSObject";
SymbolicSelectors = {
"@" = "objectAtIndex:";
"," = "arrayByAddingObject:";
"+" = "arrayByAddingObject:";
};
};
NSMutableArray = {
Super = "NSArray";
SymbolicSelectors =
{
"+=" = "addObject:";
"-=" = "removeObject:";
};
};
NSDictionary =
{
Super = NSObject;
SymbolicSelectors = {
"@" = "objectForKey:";
};
};
NSUserDefaults =
{
Super = NSObject;
SymbolicSelectors = {
"@" = "objectForKey:";
};
};
NSString =
{
Super = NSObject;
SymbolicSelectors =
{
"," = "stringByAppendingString:";
"/" = "stringByAppendingPathComponent:";
"@" = "characterAtIndex:";
};
Aliases =
{
size = length;
};
};
NSMutableString =
{
Super = NSString;
SymbolicSelectors =
{
"+=" = "appendString:";
};
};
NSSet =
{
Super = NSObject;
SymbolicSelectors =
{
"<" = "isSubsetOfSet:";
};
};
NSMutableSet =
{
Super = NSSet;
SymbolicSelectors =
{
"+=" = "addObject:";
"-=" = "removeObject:";
};
};
NSDate =
{
Super = NSObject;
SymbolicSelectors =
{
"-" = "timeIntervalSinceDate:";
};
};
NSNumber =
{
Super = NSValue;
Use = (NumberArithmetic);
SymbolicSelectors =
{
"<>" = "rangeWith:";
"@" = "pointWith:";
"@@" = "sizeWith:";
};
};
}; /* Classes */
}
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/Environments/Foundation.stenv 0000644 0002043 0000764 00000001304 11131140001 031063 0 ustar johnston nielsen /** Foundation.stenv
*/
{
Name = "Foundation";
Modules = (Foundation);
Use = ("Foundation-operators");
DefaultRestriction = AllowAll;
Classes =
{
NSObject = {
Super = nil;
};
"NSObject class" = {
Super = nil;
};
NSString =
{
Super = "NSObject";
};
NSArray =
{
Super = "NSObject";
};
NSDate =
{ Super = "NSObject";
};
NSValue =
{
Super = "NSObject";
};
NSNumber =
{
Super = "NSValue";
};
}; /* Classes */
}
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/Environments/Safe.stenv 0000644 0002043 0000764 00000003046 11131140001 027640 0 ustar johnston nielsen /** Foundation-safe.stenv
*/
{
Name = "Foundation-safe";
Use = ("Standard");
Behaviours =
{
"DenyWriteToFile" = {
DenyMethods = (
"writeToFile:atomically:",
"writeToURL:atomically:"
)
};
};
Classes =
{
NSString =
{
Use = (DenyWriteToFile);
};
NSArray =
{
Use = (DenyWriteToFile);
};
NSDictionary =
{
Use = (DenyWriteToFile);
};
NSData =
{
Use = (DenyWriteToFile);
};
NSFileManager =
{
DenyMethods = (
"copyPath:toPath:handler:",
"createFileAtPath:contents:attributes:",
"movePath:toPath:handler:",
"linkPath:toPath:handler:",
"removeFileAtPath:handler:",
"changeFileAttributes:atPath:",
"createSymbolicLinkAtPath:pathContent:"
);
};
NSUserDefaults =
{
DenyMethods = (
"removeObjectForKey:",
"setBool:forKey:",
"setFloat:forKey:",
"setInteger:forKey:",
"setObject:forKey:",
"removePersistentDomainForName:",
"setPersistentDomain:forName:",
"removeVolatileDomainForName:",
"setVolatileDomain:forName:",
"registerDefaults:"
);
};
}; /* Classes */
}
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/Environments/Standard.stenv 0000644 0002043 0000764 00000000324 11131140001 030516 0 ustar johnston nielsen /** Standard.stenv
* Standard cripting description
*/
{
Name = "Standard";
Modules = (ObjectiveC);
Use = ( "SymbolicSelectors",
"Foundation",
"StepTalk"
);
}
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/Environments/StepTalk.stenv 0000644 0002043 0000764 00000001602 11131140001 030505 0 ustar johnston nielsen /** StepTalk.stenv
* StepTalk scripting description
*
* Copyright (c) 2000 Stefan Urbanek
*
* This file is part of the StepTalk project.
*
*
*/
{
Name = "StepTalk";
Frameworks = (StepTalk);
Classes =
{
STBlock =
{
Super = NSObject;
AllowMethods =
(
"value",
"valueWith:",
"valueWith:with:",
"valueWith:with:with:",
"valueWith:with:with:with:",
"argumentCount",
"handler:",
"whileTrue:",
"whileFalse:"
);
};
STScriptObject =
{
Super = NSObject;
Restriction = AllowAll;
};
STUndefinedObject =
{
Super = nil;
Restriction = AllowAll;
};
};
}
Adun-0.81/ExternalPackages/StepTalk/Frameworks/StepTalk/Environments/SymbolicSelectors.stenv 0000644 0002043 0000764 00000002054 11131140001 032425 0 ustar johnston nielsen /** SymbolicSelectors.stenv
* Mappings for some symbolic selectors
*
* Copyright (c) 2000 Stefan Urbanek
*
* This file is part of the StepTalk project.
*
*/
{
Name = "SymbolicSelectors";
Behaviours =
{
Comparison = {
SymbolicSelectors =
{
"=" = "isEqual:";
"==" = "isSame:";
"~=" = "notEqual:";
"~~" = "notSame:";
"<" = "isLessThan:";
">" = "isGreatherThan:";
"<=" = "isLessOrEqualThan:";
">=" = "isGreatherOrEqualThan:";
};
};
NumberArithmetic =
{
SymbolicSelectors =
{
"+" = "add:";
"-" = "subtract:";
"*" = "multiply:";
"/" = "divide:";
};
};
KeyValueCoding =
{
SymbolicSelectors =
{
"->" = "valueForKeyPath:";
};
};
};
}
Adun-0.81/ExternalPackages/StepTalk/Frameworks/GNUmakefile 0000755 0002043 0000764 00000000363 11131140001 023537 0 ustar johnston nielsen include $(GNUSTEP_MAKEFILES)/common.make
SUBPROJECTS = StepTalk
ADDITIONAL_INCLUDE_DIRS += -I$(GNUSTEP_HOME)/$(GNUSTEP_USER_HEADERS)
-include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/aggregate.make
-include GNUmakefile.postamble
Adun-0.81/ExternalPackages/StepTalk/AppKit-Info.plist 0000644 0002043 0000764 00000001157 11131137113 022514 0 ustar johnston nielsen
CFBundleDevelopmentRegion
English
CFBundleExecutable
${EXECUTABLE_NAME}
CFBundleIdentifier
com.yourcompany.AppKit
CFBundleInfoDictionaryVersion
6.0
CFBundlePackageType
BNDL
CFBundleSignature
????
CFBundleVersion
1.0
Adun-0.81/ExternalPackages/StepTalk/COPYING 0000644 0002043 0000764 00000063474 11131137113 020423 0 ustar johnston nielsen GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
Copyright (C)
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
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
Adun-0.81/ExternalPackages/StepTalk/ChangeLog 0000644 0002043 0000764 00000052317 11131137113 021134 0 ustar johnston nielsen 2006 May 23 Stefan Urbanek
* AppKit: re-added AppKit bundle
* Foundation, AppKit: generate *.m source files for all framework
constants from *.list files (XCode: for more information see rules for each
target in target inspector window)
2006 May 20 Stefan Urbanek
* STActor: Added forwarding of methods to actor's traits
2006 May 14 Stefan Urbanek
* Added STResourceManager + updated other files to use it
* Include default bundles and languages inside the StepTalk.framework
bundle
2006 May 12 Stefan Urbanek
* STActor: added traits, added method for adding method from source
* STSyntaxErrorException: new exception, used in Smalltalk as well
* Changed to X Code project
2005 Sep 5 Stefan Urbanek
* Version 0.10.0
2005 Sep 5 Stefan Urbanek
* Frameworks/StepTalk: compiler warnings removed
2005 Aug 30 Stefan Urbanek
* STLanguageManager: new class
* STLanguage: removed
* STEngine: engineForLanguageWithName: and engineForFileType: removed, use
STLanguageManager instead, added engineForLanguage:
* Tools/stexec - updated to use STLanguageManager
* Tools/stupdate_languages - removed as it was replaced by STLanguageManager
* Examples/Server - removed as it was replaced by stenvironment and distant
scripting
Notes:
- you can delete */Library/StepTalk/Configuration directories
2005 Aug 17 Stefan Urbanek
* STConversation: renamed run* method to interpret*, interpretScript: does
not return value anymore (because of distant conversations), new methods
result and resultByCopy were added
* STEnvironment: removed depreciated methods
* STDistantConversation: new class for conversations with distant objects
* Tools/stenvironment: new tool for semi-persistent scripting environments
* Tools/stexec: added reading from stdin; reflect library changes
* Tools/stalk: removed
* STEngine: renamed methods (see STEngine.h for more information)
2005 June 30
Version 0.9.1
2005 June 30
* STActor: new class
* Examples/Smalltalk/actor - new actor example
2005 June 19
Version 0.9.0
2005 June 19 Stefan Urbanek
* STEnvironment: search class name namespace when no object is found for
given name and full scripting is enabled.
2005 Jan 4 Stefan Urbanek
* First step of introducing contexts
NOTE: This version is unstable.
2004 Nov 9 Stefan Urbanek
* Remove STMethodSignatureForSelector as it was deprecated because of
inportability to OSX.
2004 Sep 23 Stefan Urbanek
* STContext: new class
* STEnvironment: make it subclass of STContext, move several methods
2004 Sep 6 Stefan Urbanek
* stshell: fix for compiler
* added missing STEnvironmentDescription installation
2004 Aug 2 Stefan Urbanek
* Search for scripts in */Library/Scripts/*
* stexec: use scripts manager to look for scripts in default locations. For
this tool it is .../Library/Scripts/Shell or .../Library/StepTalk/Scripts/Shell
2004 Jul 26 Stefan Urbanek
* Added NSString containsString: to Foundation module.
2004 Jun 27 Stefan Urbanek
* Added examples:
- Developer/StepUnit.st from Mateu Batle
- awlaunch.sh from Frederico Munoz
* Version 0.8.1
2004 Apr 25 Stefan Urbanek
* Changed license to LGPL
2004 Apr 19 Stefan Urbanek
* applied patch from Mateu Batle to replace nil valuse with STNil on
message sending
* fixed STConversation issue
2004 Mar 28 Stefan Urbanek
Changes according to the Helge Hess:
* STBundleInfo: fix to use string instead of constant (OSX compatibility)
* STFileScript, STLanguage, STScript: added missing #imports
2003 Nov 24 Stefan Urbanek
* Version 0.8.1
2003 Nov 24 Stefan Urbanek
* Few fixes, removed some compiler warnings. Fixed Shell to use
proper environment.
2003 Nov 8 Stefan Urbanek
* Updated tools to use STConversation object.
2003 Oct 23 Stefan Urbanek
* Added STEnvironment +sharedEnvironment, +defaultScriptingEnvironment and
initWithDefaultDescription. Deprecated initDefault,
environmentWithDescriptionName, environmentWithDescriptionName
* Added STConversation class
2003 Oct 6 Stefan Urbanek
* Added STFileScript - moved all unnecessary stuff from STScript there.
* Fixed STScriptsManager to use STFileScript
2003 Oct 3 Stefan Urbanek
* Added ReadlineTranscript module (Idea by Alexander Diemand + patch from
David Ayers)
* Added shell.st example.
2003 Sep 24 Stefan Urbanek
* STEnvironmentDescription: guard initialisation in Autorelease pool
2003 Sep 23 Stefan Urbanek
* STEngine: setValueForOption: added
2003 Aug 13 Stefan Urbanek
* Version 0.8.0
2003 Aug 9 Stefan Urbanek
* Removed compiler warnings in StepTalk.framework, Smalltalk and Tools
2003 Aug 6 Stefan Urbanek
* Frameworks: new directory
* Changed StepTalk from library to framework
* Modules: Removed StepTalk module as it is no more needed, because
we have framework and it can provide scripting capabilities by it self
* All GNUMakefiles modified to reflect change to Framework
* Added Framework loading in .stenv description files.
Use: Frameworks = (name1, name2);
NOTE: You HAVE to remove your previous installation of StepTalk to be
able to install new one. (especially Local/Library/Headers/StepTalk).
2003 Aug 5 Stefan Urbanek
* Added STScriptObject and STMethod.
2003 Jun 15
* NSInvocation+additions: added unknown selector creation; created a
workaround for gnustep DO bug
* STObjCRuntime: Fixed creation of signature.
2003 May 11 Stefan Urbanek
* Fixed linking of some bundles
2003 May 10 Stefan Urbanek
* Fixed linking under mingw32
* STBundleInfo: implemented framework searching
* STEnvironment: includeFramework: new method.
2003 May 2 Stefan Urbanek
* STBundleInfo: added objectReferenceDictionary; removed unnecessary ST
prefix from ScriptingInfo.plist keys and added warnings for the change.;
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
* Added library reference documentation generated by autogsdoc.
* Added TroubleShooting.txt document
2003 Apr 21 Stefan Urbanek
* Version 0.7.1
2003 Apr 04 David Ayers
* STEngine.h: Fixed declaration to match implementation to avoid
compiler warnings.
* STEnvironment.h: Ditto.
* STScriptsManager.h: Ditto.
* STLanguage.h: Corrected declaration.
* STScriptsManager.m: Added needed interface declaration.
* GNUmakefile: Added flags to show all warnings except for import.
* Module/ObjectiveC/GNUmakefile: Added flags to show all warnings
except for import.
* Module/Foundation/GNUmakefile: Added flags to show all warnings
except for import.
* Module/AppKit/AppKitExceptions.m: Used variable to supress compiler
warnings.
* Module/AppKit/AppKitNotifications.m: Ditto.
* Module/AppKit/GNUmakefile: Added flags to show all warnings except
for import.
* Module/GDL2/GDL2Constants.m: Used variable to supress compiler
warnings.
* Module/GDL2/GNUmakefile: Added flags to show all warnings except
for import.
* Module/SimpleTranscripts/GNUmakefile: Added flags to show all warnings
except for import.
* Module/StepTalk/GNUmakefile: Added flags to show all warnings
except for import.
* Tools/stalk.m: Added needed interface declaration.
* Tools/stupdate_languages.m: Corrected variable declaration and added
cast.
2003 Apr 3 Stefan Urbanek
* STScript: added compareByLocalizedName:
2003 Mar 30 Stefan Urbanek
* WISH: new file
2003 Mar 25 Stefan Urbanek
* STScriptsManager: new method setScriptSearchPathsToDefaults; new method
setScriptSearchPaths:; added instance variable scriptSearchPaths
2003 Mar 24 Stefan Urbanek
* Documentation: Updated ApplicationScripting.txt
2003 Mar 23 Stefan Urbanek
* Added ApplicationScripting
* GNUMakefile: add ApplicationScripting. Can be ignored when appkit=no
* Languages/Guile: Fixed steptalk interface changes (patch from Matt Rice
)
2003 Mar 22 Stefan Urbanek
* STEnvironment: includeBundle returns NO on failure
* STScriptsManager: added method allScripts that returns all scripts for
domainand; added private method _scriptsAtPath:
* STScript: do not delete original extension when looking for script info
file, so some.st will have some.st.stinfo; renamed localizedScriptName to
localizedName
* STLanguage: new methods: updateFileTypeDictionary and allKnownFileTypes
2003 Feb 21 Stefan Urbanek
* StepTalk.h: Removed #import of STModule.h as it is no longer there
2003 Feb 11 Stefan Urbanek
* Source/GNUmakefile: fixed installation of documentation
2003 Feb 4 Stefan Urbanek
* STBundleInfo: warn instead of raise an exception if there is no scripting
info class.
2003 Feb 3 Stefan Urbanek
* Version 0.7.0
2003 Jan 30 Stefan Urbanek
* STBundleInfo: Removed compiler warning
* Modules/*: Cleanup for compiler warnings
2003 Jan 29 Stefan Urbanek
* Modules/ObjectiveC: fixed GNUmakefile to include source headers
2003 Jan 25 Stefan Urbanek
* STBundleInfo: Fixed NSBundle stepTalkBundleNames to use .bundle file
extension
* Modules/*/GNUmakefile: Removed now unnecesary -lStepTalk, because modules
do not have to be linked with StepTalk anymore
2003 Jan 25 Stefan Urbanek
* Version 0.7.0pre1
2003 Jan 24 Stefan Urbanek
* STBundleInfo: Use info from ScriptingInfo.plist instead of bundle's main
info dictionary
* Modules/*: Create ScriptingInfo.plist
* Modules/GNUmakefile: Compile GDL2 module if it is available.
2003 Jan 22 Stefan Urbanek
* STEnvironment: added includeBundle: method
2003 Jan 22 Stefan Urbanek
* STModule: removed
* STBundleInfo: added new class STBundleInfo and additional methods to
NSBundle
* STEnvironment: reflect change from STModule to NSBundle/STBundleInfo;
* Modules/*: reflect change from STModule to NSBundle/STBundleInfo
IMPORTANT NOTE: You have to rebuild all modules, because the format has
changed.
2003 Jan 22 Stefan Urbanek
* NSNumber+additions: Added -modulo: method.
* Foundation bundle: added NSFileManager extensions; added missing constants
* Documentation/Additions.txt: new file
2003 Jan 20 Stefan Urbanek
* GNUMakefile: Removed inclusion of source-distribution.make, as it is
not needed (suggested by Nicola Pero )
* Examples/Developer: new directory containing developer examples
2003 Jan 15 Stefan Urbanek
* GDL2: added installation of GDL2.stenv
* Documentation/Tools.txt: new file documenting steptalk tools
2002 Dec 25 Stefan Urbanek
* Version 0.6.2
2002 Dec 21 Stefan Urbanek
* Languages/GNUmakefile, Modules/GNUmakefile, Finders/GNUmakefile: removed
forced installation to the GNUSTEP_USER_ROOT. ~/Library/StepTalk/* should
be deleted.
* Documentation/Modules.txt: added
2002 Nov 29 Stefan Urbanek
* Added GDL2 module
* STModule: more details on module loading fault
2002 Nov 11 Stefan Urbanek
* ObjectiveC module: added selectorsContainingString: and
implementorsOfSelector:
2002 Nov 5 Stefan Urbanek
* Added MyLanguage as empty example language bundle
2002 Sep 17 Stefan Urbanek
* Patch from Jeff Teunissen with various bug-fixes
* Added .cvsignore files
2002 Sep 15 Stefan Urbanek
* Version 0.6.1
2002 Sep 15 Stefan Urbanek
* Modules/AppKit/AppKitConstants.list: commented out undefined constants
2002 Sep 7 Stefan Urbanek
* Modules/AppKit/AppKitInfo.plist: added NSSound class
2002 Aug 27 Stefan Urbanek
* Source/*.m: Cleanup to remove compiler warnings.
2002 Jun 18 Stefan Urbanek
* STScript: new class (from AppTalk)
* STScriptsManager: new class (from AppTalk)
* Modules/StepTalk: new module
2002 Jun 14 Stefan Urbanek
* Modules/ObjectiveC: new module
2002 Jun 10 Stefan Urbanek
* NSObject+additions: removed -className as it was added to the base library
2002 Jun 9 Stefan Urbanek
* Version 0.6.0 released
2002 Jun 8 Stefan Urbanek
* STEnvironmentDescription: added module amd finder list; little code
cleanup; removed descriptionFromFile: and initFromFile: methods
* STEnvironment: removed methods
environmentWithDescriptionFromFile:
environmentWithDescriptionFromDictionary:
initWithDescriptionFromFile:
init
addAllClasses
addObject:withName:
allObjectNames
new methods:
environmentWithDescription:
initWithDescription:
renamed methods:
defaultObjectPool to objectDictionary
registerObjectFinderWithName: to registerObjectFinderNamed:
load modules and finders from description at initialization;
* STExecutor: reflect STEnvironment changes
* stexec: removed loading of the Foundation module as this is handled
by the STEnvironment
* Environments: new descriptions AppKit.stenv and Distributed.stenv
2002 Jun 7 Stefan Urbanek
* STEnvironmentDescription: added abstract class 'All' that is root
class for all classes
* Foundation-operators.stenv: add symbolic selector '->' to all classes
2002 Jun 6 Stefan Urbanek
* Added symbolic selector '->' for valueForKeyPath:
* StepTalk.stenv: allow whileTrue: and whileFalse: in STBlock
* NSObject+additions: moved from Smalltalk; added -isSame: method
* DistributedFinder: prevent NSDictionary log when there is no file for
a requested object; changed NSLogs to NSDebugLLogs with 'STFinder'; do not
try to launch nil tool
2002 Jun 4 Stefan Urbanek
* STEnvironment: new methods -addObjectFinder:name:,
-addObjectFinderWithName:, -removeObjectFinderWithName:;
new method knownObjectNames;
objectReferenceForObjectWithName: changed to use nil reference on
known object that cannot be currently found
* Finders: new directory containing object finders
* STObjCRuntime: include selectors of metaclasses in
STAllObjectiveCSelectors()
* Documentation/HowTo.txt: rewritten
2002 Jun 3 Stefan Urbanek
* STFunctions: renamed "StepTalk/Config" directory to
"StepTalk/Configuration"; fixed bug in STFindAllResources (resourceDir
was ignored)
* STEnvironment: changed method allObjectsDictionary to allObjectNames
2002 May 30 Stefan Urbanek
* STEnvironment: removed pools
* STObjectReference: removed method initWithObjectName:pool:create:
2002 May 29 Stefan Urbanek
* STExecutor: fixed typo
* STEnvironment: new method -allObjectsDictionary that returns a NSDictionary
with all named objects
* STObjCRuntime: new function STAllObjectiveCSelectors
2002 May 24 Stefan Urbanek
* STEngine: engineForLanguage: renamed to engineForLanguageWithName:.
Some method documentation added.
* STExecutor: reflect method renaming
* STLanguage: read default language name from actual user defaults (not
from the StepTalk domain) and renamed the key to STDefaultLanguageName.
Renamed languageWithBundle: to languageWithPath:. Some method documentation
added.
* STEnvironmentDescription: read default description name from actual user
defaults (not from the StepTalk domain)
* STEnvironment: Some method documentation added.
* StepTalk.gsdoc: new file
2002 May 13 Stefan Urbanek
* Uploaded to the GNUstep CVS repository by Adam Fedor
2002 Apr 20 Stefan Urbanek
* COPYING: updated
* STExterns: Removed unused exceptions
* STStructure: Changed exception to STInternalIncosistencyException
2002 Apr 13 Stefan Urbanek
* Modules/GNUmakefile: added option that disables making of appkit support
Use make appkit=no.
* Separated AppTalk
2002 Mar 17 Stefan Urbanek
* STEngine: removed executeScript: methods and use only executeSource:
engine does not make difference between script and statements anymore
* Tools: removed --expressions option
* Examples: fixed Smalltalk examples to use new grammar
* STLanguage: new method languageNameForFileType:
2002 Mar 13 Stefan Urbanek
* AppKit module: removed old AppKit constants and renamed MiddleButton
events to OtherButton.
2002 Feb 14 Stefan Urbanek
* added make option 'appkit'. if you set it to 'no' (make appkit=no),
no appkit stuff will be compiled.
2002 Feb 5 Stefan Urbanek
* StepTalk 0.5.0 released
2002 Feb 5 Stefan Urbanek
* STSelector: new file
* NSInvocation+additions: handle SEL type with STSelector
* Examples: added selector.st, notification.st, scope.st and pldes.st
2002 Feb 3 Stefan Urbanek
* Testing: new directory
2002 Jan 30 Stefan Urbanek
* STEnvironment: Removed unused variables,
2002 Jan 23 Stefan Urbanek
* NSNumber+additions: moved from Smalltalk, added methods for creation of
range, point and size
2002 Jan 21 Stefan Urbanek
* StepTalk 0.4.1 released
2002 Jan 21 Stefan Urbanek
* Removed Foundation constants to separate module
* stexec: load Foundation module instead of loading all ObjC classes
2002 Jan 13 Stefan Urbanek
* Guile: new language bundle
2002 Jan 9 Stefan Urbanek
* StepTalk 0.4.0 released
2002 Jan 9 Stefan Urbanek
* STFunctions: new function STUserConfigPath
* STLanguage: new method languageForFileType:
* new tool stupdate_languages to create/update languages configuration file
2001 Dec 8 Stefan Urbanek
* NSInvocation+addition: return receiver (target) when return type is void
2001 Nov 19 Stefan Urbanek
* STModule: New method -classNames; returns array of names of exported
classes
2001 Nov 14 Stefan Urbanek
* removed force of use of users home directory for installation
* new module AppKit
* STEnvironment: new method -addAllClasses to add all Objective-C classes
2001 Nov 10 Stefan Urbanek
* StepTalk 0.3.0 released
2001 Nov 10 Stefan Urbanek
* Added scriptable server example.
2001 Nov 9 Stefan Urbanek
* STExecutor: new options: --list-objects, --list-classes and
--list-all-objects
* Tools/stalk.m: resurected
* Tools/GNUmakefile: uncommented stalk tool
* moved initialization of STNil from STUndefinedObject to STEngine
2001 Nov 6 Stefan Urbanek
* STProtocolInfo: removed
* STBehaviourInfo, STClassInfo, STEnvironmentDescription: rewritten
* Environment description files changed
2001 Nov 5 Stefan Urbanek
* Tools/stexec: fixed bug, that caused segfault (reported by
Nicola Pero )
* Examples: new directory with Smalltalk script examples
* STEnvironment: fixed restricted/full scripting.
translateSelector:forReceiver: now raises an exception if selector is not
allowed for receiver; standardScriptingEnvironemnt renamed to
defaultScriptingEnvironment and calls
STEnvironmentDescription defaultEnvironmentDescriptionName
* STEnvrionmentDescription: New method +defaultEnvironmentDescriptionName.
2001 Nov 3 Stefan Urbanek
* Tools: implemented --environment switch to use environment description
with name.
2001 Nov 1 Stefan Urbanek
* New ChangeLog started. Rewritten and redesigned.
* Added support for multiple languages. Created Smalltalk language bundle.
Adun-0.81/ExternalPackages/StepTalk/GNUmakefile 0000755 0002043 0000764 00000000433 11131137113 021427 0 ustar johnston nielsen
include $(GNUSTEP_MAKEFILES)/common.make
SUBPROJECTS = Frameworks/ Languages/ Modules/
GNUSTEP_INSTALLATION_DOMAIN=USER
#Rpm
PACKAGE_NAME=StepTalk
PACKAGE_VERSION=0.13
-include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/aggregate.make
-include GNUmakefile.postamble
Adun-0.81/ExternalPackages/StepTalk/Info.plist 0000644 0002043 0000764 00000001414 11131137113 021322 0 ustar johnston nielsen
CFBundleDevelopmentRegion
English
CFBundleExecutable
${EXECUTABLE_NAME}
CFBundleIconFile
CFBundleIdentifier
com.agentfarms.steptalk
CFBundleInfoDictionaryVersion
6.0
CFBundleName
${PRODUCT_NAME}
CFBundlePackageType
FMWK
CFBundleSignature
????
CFBundleVersion
0.11
NSPrincipalClass
Adun-0.81/ExternalPackages/StepTalk/NEWS 0000644 0002043 0000764 00000015466 11131137113 020065 0 ustar johnston nielsen 0.12
* readded AppKit bundle
* include all Tiger classes for Foundation and AppKit
0.11
* Mac OS X version
0.10.0
* introduced new language management (STLanguageManager)
* introduced remote scripting (STRemoteConversation)
* new tool for semi-persistent environments: stenvironment
* added reading from stdin to stexec
* added remote scripting to stshell and stexec
* new conversation methods
* removed tools: stalk, stupdate_languages
* removed depreciated methods from STEnvironment, removed class STLanguage
Notes:
- you can delete */Library/StepTalk/Configuration directories
0.9.1
* Actor class - STActor. For more information see attached example or
Examples/Smalltalk/stactor.st
* fixes after GNUstep-base fixes of NSUnknownKey
0.9.0
* Changed "full scripting" behaviour. When enabled, all classes are
available for scripting, not only those published by frameworks.
* There was done design fix in the Smalltalk language bundle. Instance
variables of script objects were accessed by index, now they are
referenced by names. This allows further creation of STActor
(STScriptObject successor) object that is composed of script methods and
ivars. Also it would be possible to create script methods for any objc
receiver. Ivar access is done through KVC. For more information do not
hesitate to ask.
0.8.2
* Fixed and changed license to LGPL
* Several fixes from Mateu Batle for the framework and Smalltalk bundle
* Fixed bug with signed/unsigned bytecode in the Smalltalk bundle
0.8.1
* Added ReadlineTranscript
* Renamed, added and deprecated some STEnvironment methods. Methods were
not removed, NSLog warnings were added.
* Added STConversation object. Basically, it's a conversation with
objects in an environment using a scripting language. The reason
for creating this clas was to open a path for easier remote scripting
where you can 'talk in a conversation' with a remote DO server or
application. However, this remote part is just going to be implemented.
0.8.0
NOTE: You HAVE to remove your previous installation of StepTalk to be
able to install new one. (especially Local/Library/Headers/StepTalk).
Major changes:
* Changed StepTalk from library to a framework
* Added script objects.
Other:
* StepTalk module was removed, because it was no longer required.
* Added framework loading support in environment description files (.stenv)
* Added some autogsdoc generated documentation
* Implemented Framework support and new Environment method: includeFramework:
* Created a workaround for gnustep-base Distributed Objects bug. Now
DO shold work correctly.
* Some smalltalk parser fixes.
0.7.1
* Prepared StepTalk for application scripting support
* Added application scripting support bundle
* Added documentation for application scripting
* Many source cleanups by David Ayers
* Some bugfixes in Smalltalk source reader
For more information about scripting bundle see ApplicationScripting
directory.
0.7.0
* Added ability to use any bundle or framework for scripting
* Moved scripting information from bundle info dictionary into separate
file.
* Replaced .stmodules with plain bundles.
* Removed STModule class
* Added conditional GDL2 module installation.
* Small improvements and bug-fixes.
IMPORTANT NOTE: You have to rebuild and reinstall all modules, because the
bundle format has changed.
0.6.2
* Smalltalk: Added parsing of real numbers
* ObjectiveC: added two new methods into the Runtime object:
selectorsContainingString:
returns an array of selectors that contain specified string
implementorsOfSelector:
returns an array of all classes that implement specified selector
* Created an empty language bundle MyLanguage as an example
* Added GDL2 module
* Fixed installation: removed forced installation to the user's home
directory
NOTE: Please delete all standard StepTalk language bundles, modules and
finders from your home directory if it is not your default installation
directory so new bundles can be found.
0.6.1
* Code cleanup
* New modules: ObjectiveC and StepTalk
* New classes: STScript and STScriptManager
0.6.0
* Created 'Object Finders'
Distributed Object Finder
Application Finder
* New example tool stshell - the StepTalk shell
* Automated loading of modules and finders using scripting environment
descriptions
* StepTalk defaults changed
* Some source documentation added
* Bugfixes in Smalltalk language
0.5.2
* Separated AppTalk
* Added option to make "appkit=no" to disable making of AppKit stuff.
0.5.1
* Added AppTalk application scripting library
* Smalltalk syntax changed. See Documentation/Smalltalk section Source.
* Fixed AppKit constants
* Make it build with latest GNUstep release
* Various bugfixes
0.5.0
* support for NSRange, NSPoint and NSSize (see example range.st)
* Implemented SEL type handling (see examples selector.st and
notification.st)
* New example pldes.st - pldes tool written in smalltalk
Smalltalk:
* Small (10-15%)speed improvements of block evaluation
* Handle 'exit' method in script object. 'self exit' will terminate script
execution.
* Documentation describing smalltalk features (exception handling,
symbolic selector and iterators)
0.4.1
* Guile - new language bundle. gstep-guile library is needed.
Guile bundle is not build by default. You have to make it in
Languages/Guile directory (make; make install). You may try to execute
very simple piece of code in Languages/Guile/Tests using stexec.
NOTE: do not forget to run 'stupdate_languages' after installing any new
language bundle. To find out if languages were updated, try
'stexec -list-languages'
* Separated Foundation binding stuff to Foundation module
0.4.0
* AppKit - new module
* AppKit examples
openPanel - shows NSOpenPanel
rtf2text - converts RTF document to plain text
* Added execution of script with more methods
* Tools will now try to get language type from file extension
* Added new tool stupdate_languages to create file extensions dictionary
0.3.0
for more details see ChangeLog file
* Added few examples to show how scripting works. See Examples directory
in source package.
* Added tool 'stalk' to talk to named servers.
* Added new tool options.
* Some known bugs were fixed.
* Little bit of documentation added (see Documentation directory)
* STEnvironment interface changed
Adun-0.81/ExternalPackages/StepTalk/README 0000644 0002043 0000764 00000006232 11131137113 020235 0 ustar johnston nielsen StepTalk
--------
Ahthor: Stefan Urbanek (Google the name for contact)
License: LGPL (see file COPYING)
Mac OS X users: See the ReadMe-OSX.txt file insead.
What is StepTalk ?
------------------
StepTalk is a scripting framework for creating scriptable servers or
applications. StepTalk, when combined with the dynamism that the Objective-C
language provides, goes way beyond mere scripting. It is written using
Cocoa/GNUstep.
Where to get it?
----------------
StepTalk requires GNUstep http://www.gnustep.org
You can download StepTalk from
http://www.gnustep.org/experience/StepTalk.html
Documentation for users and developers:
http://wiki.gnustep.org/index.php/Scripting
Installation
------------
You need to have GNUstep which you can get from http://www.gnustep.org
To install StepTalk type:
> make
> make install
If you do not want to build AppKit extensions, then type
> make appkit=no
> make appkit=no install
If something goes wrong while build process and it is not while building in the
Source directory, then try to do make and make install in that directory first.
In any case of problem, do not hesitate to contact the author.
StepTalk Shell is included in Examples/Shell directory. It requires libncurses.
Tools
-----
stexec - execute a StepTalk script in the GNUstep Foundation environment
stalk - talk to named server
stupdate_languages - update the available languages info
stshell - StepTalk shell - interactive tool (in Examples/Shell)
Predefined objects for executing scripts by 'stexec'
Args - command line arguments
Engine - scripting engine
Environment - scripting environment
Transcript - simple transcript
Sripting environment description
-------------------------------------------
Scripting environment description is used to translate the method names and/or
allow or deny the methods for concrete classes. Denying methods can be used to
create safe scripting environment as prevention against script viruses.
It contains:
- list of methods, that are available for scripting for particular class
- symbolic selector (operator) to selector mapping
- list of modules to be loaded
- list of object finders
Standard vs. full scripting
---------------------------
Before each message send, selector is translated using scipting description.
When standard scripting is used and there is no such selector avilable for
scripting for target object, then an exception is raised. With full scripting,
any message should be sent to any target object.
Files
-----
StepTalk is looking for its files in GNUSTEP_*_ROOT/Library/StepTalk
There should be these directories:
Configuration - Configuration files
Environments - Directory containig environment descriptions
Finders - Object finders
Languages - StepTalk language bundles
Modules - StepTalk modules
Scripts - Directory containig StepTalk scripts
Defaults
--------
See Documentation/Defaults.txt
Feedback
--------
Send comments, questions and suggestions to: discus-gnustep@gnu.org
Send bug reports to: bug-gnustep@gnu.org
Adun-0.81/ExternalPackages/StepTalk/ReadMe-OSX.txt 0000644 0002043 0000764 00000001300 11131137113 021711 0 ustar johnston nielsen StepTalk
--------
Ahthor: Stefan Urbanek
License: LGPL
What is StepTalk ?
------------------
StepTalk is a scripting framework for creating scriptable servers or
applications. StepTalk, when combined with the dynamism that the Objective-C
language provides, goes way beyond mere scripting.
What is StepTalking ?
---------------------
StepTalking is an application for "talking to objects" in StepTalk languages.
Installation
------------
1. Copy StepTalk.framework into ~/Library/Frameworks or /Library/Frameworks
2. Copy StepTalking application wherever you like, preferably to the
Applications folder
Feedback
--------
Send comments, questions and suggestions to: stefan@agentfarms.net
Adun-0.81/ExternalPackages/StepTalk/StepTalkKit-Info.plist 0000644 0002043 0000764 00000001164 11131137113 023521 0 ustar johnston nielsen
CFBundleDevelopmentRegion
English
CFBundleExecutable
${EXECUTABLE_NAME}
CFBundleIdentifier
com.yourcompany.StepTalkKit
CFBundleInfoDictionaryVersion
6.0
CFBundlePackageType
FMWK
CFBundleSignature
????
CFBundleVersion
1.0
Adun-0.81/ExternalPackages/StepTalk/StepTalk_Prefix.pch 0000644 0002043 0000764 00000000235 11131137113 023112 0 ustar johnston nielsen //
// Prefix header for all source files of the 'StepTalk' target in the 'StepTalk' project.
//
#ifdef __OBJC__
#import
#endif
Adun-0.81/ExternalPackages/StepTalk/TODO 0000644 0002043 0000764 00000002577 11131137113 020055 0 ustar johnston nielsen TODO list
- find all defaults and document them
- find all debug logs and document them
- find all used .plist keys/values and document them (STLanguageManager,...)
- optimalise method execution - each time language manager is fetched -can be expensive
HIGH PRIORITY
- implement NSRect object
- Rewrite Smalltalk compiler (grammar)
Remove STBytecodeInterpreter and use only STCompiler. How?
Simply convert language constructions into 'command' objects like
SmalltalkStatement, SmalltalkPrimary, SmalltalkMethodSend, ...
and implement executeInEnvironment:context:receiver:
- Update application scripting to use STConversation
LOW PRIORITY
UNDEFINED
- handle 'connection did die' notification for distant objects in STEnvironment
- fix class-info lookup for proxies in STEnvironment
- Smalltalk: separate compiler and compilation context
- create a 'Shell' scripting environment
- Create ApplicationScripting framework, instead of bundle. It should offer
passive application scripting (without linking) and active app. scripting
(linking with the framewotk). Give it some reasonable name, becauase that one
is already used by Apple
- Add framework list into environment description
- Change Modules to Frameworks
- Remove empty directories (Source, Modules/StepTalk)
- Replace STMethod languageName with map table of method class->engine class
Adun-0.81/ExternalPackages/StepTalk/WISH 0000644 0002043 0000764 00000007363 11131137113 020060 0 ustar johnston nielsen Dear all, users and developers...
This text describes my intentions and wishes for StepTalk.
Author: Stefan Urbanek
E-Mail: google the name for contact
Home : http://stefan.agentfarms.net
Content:
What is the goal of StepTalk?
Language and Interaction
The Framework
What is the goal of StepTalk?
-----------------------------
StepTalk was meant to be an 'distributed object glue' or 'application
glue'. The primary intention was to create a framework that will allow
users to join functionalities of different applications (or distributed
objects) to complete desired tasks. It should allow users to 'talk' to
their applications with some language that is understandable to both - to
the user and to the application.
Another intention was to allow users to extend applications with
functionality they miss, or want to automatize, or want to do in a batch.
StepTalk is a framework that wants to fill the gap between application
author and users with their needs. It wants to provide a feel of single
common object universe.
Language and Interaction
------------------------
StepTalk is rather language abstraction than a (scripting) language. The
idea of abstraction is, that users and developers are dealing with an
universe of interacting objects. It is based on two basic principles:
1. Every thing is an object
2. Objects are communicating by sending messages
"Objects are 'nouns' and messages are 'verbs' of a language. ", to add a
famous quote.
Nouns in a (scripting) language are objects with name. That name usually
depends on the context it is present or it should be globally well known
object.
Now, why I have chosen Smalltalk as default language? Because ...
"In essence, Smalltalk is a programming language focused on human
beings rather than the computer." - Alan Kinght
I do not say, that it is the best language, but it is more understandable
by users than other, usual, programming languages. Nevertheless, that does
not mean, that some day there will not be other language.
The Framework
-------------
(this part is for mainly for developers and curious users)
This part will be something more concrete and will describe desired
concepts and their StepTalk objects.
Language - STLanguage provides language information and execution
mechanisms.
Language context - is represented by STEnvironment. Maybe not very good
name and it should be changed to STContext rather. Context defines
names for concrete objects and defines mappings of verbs (selectors).
Nouns - Objects with names. Some names should refer no non-concrete
objects. The meaning of such names is provided by object finders, which
will assign concrete object to that name, when requested.
Script - Just plain NSString.
Script execution - Concrete subclasses of STEngine will execute a script
written in specific language. Engines should refer to the language
context to find out the objects behind names refered by users and
provided by developers.
Future
------
What needs to be done?
- make it be real object glue that will join functionalities of different
applications
- provide 'script objects' where one can create an object, define its
behaviour with 'script methods' in any language. Make it similar to
prototype based language - Self. (Google for: self language)
Conclusion
----------
I had no time to achieve this goal by implementing all I wanted and in the
way I wanted. Please, keep it simple and make the interface focused on
users.
Any further comments, questions and suggestions are welcome.
Adun-0.81/ExternalPackages/StepTalk/Languages/ 0000755 0002043 0000764 00000000000 11167405532 021274 5 ustar johnston nielsen Adun-0.81/ExternalPackages/StepTalk/Languages/GNUmakefile 0000755 0002043 0000764 00000000374 11131137113 023341 0 ustar johnston nielsen include $(GNUSTEP_MAKEFILES)/common.make
SUBPROJECTS = StepTalkSmalltalk
ADDITIONAL_INCLUDE_DIRS += -I$(GNUSTEP_HOME)/$(GNUSTEP_USER_HEADERS)
-include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/aggregate.make
-include GNUmakefile.postamble
Adun-0.81/ExternalPackages/StepTalk/Languages/StepTalkSmalltalk/ 0000755 0002043 0000764 00000000000 11167405533 024671 5 ustar johnston nielsen Adun-0.81/ExternalPackages/StepTalk/Languages/StepTalkSmalltalk/Externs.h 0000644 0002043 0000764 00000000477 11131137242 026470 0 ustar johnston nielsen /**
Externs
Misc. variables
Copyright (c) 2002 Free Software Foundation
This file is part of the StepTalk project.
*/
#import
extern NSString *STCompilerGenericException;
extern NSString *STCompilerInconsistencyException;
extern NSString *STInterpreterGenericException;
Adun-0.81/ExternalPackages/StepTalk/Languages/StepTalkSmalltalk/GNUmakefile 0000644 0002043 0000764 00000004306 11131137242 026734 0 ustar johnston nielsen #
# Smalltalk language bundle
#
# Copyright (C) 2000 Stefan Urbanek
#
# This file is part of the StepTalk.
#
# 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., 675 Mass Ave, Cambridge, MA 02111, USA.
#
include $(GNUSTEP_MAKEFILES)/common.make
BUNDLE_NAME = Smalltalk
BUNDLE_EXTENSION := .stlanguage
BUNDLE_INSTALL_DIR:=$(GNUSTEP_USER_ROOT)/Library/StepTalk/Languages
Smalltalk_OBJC_FILES = \
SmalltalkEngine.m \
NSArray+additions.m \
NSNumber+additions.m \
NSObject+additions.m \
NSString+additions.m \
STBlock.m \
STBlockContext.m \
STBytecodeInterpreter.m \
STBytecodes.m \
STCompiledCode.m \
STCompiledMethod.m \
STCompiledScript.m \
STCompiler.m \
STCompilerUtils.m \
STExecutionContext.m \
STGrammar.m \
STLiterals.m \
STMessage.m \
STMethodContext.m \
STSmalltalkScriptObject.m \
STStack.m \
STSelector+additions.m \
STSourceReader.m \
Smalltalk_PRINCIPAL_CLASS = SmalltalkEngine
ADDITIONAL_OBJCFLAGS = -Wall -Wno-import
ADDITIONAL_INCLUDE_DIRS += -I../../Frameworks/StepTalk
ADDITIONAL_BUNDLE_LIBS = -lStepTalk
ADDITIONAL_INCLUDE_DIRS += -I../../Frameworks/
ADDITIONAL_LIB_DIRS += -L../../Frameworks/StepTalk/StepTalk.framework/Versions/Current/$(GNUSTEP_TARGET_LDIR)
ifeq ($(check),yes)
ADDITIONAL_OBJCFLAGS += -Werror
endif
-include GNUmakefile.preamble
include $(GNUSTEP_MAKEFILES)/bundle.make
-include GNUMakefile.postamble
STGrammar.m: STGrammar.y
$(BISON) -p STC -o $@ $<
Adun-0.81/ExternalPackages/StepTalk/Languages/StepTalkSmalltalk/Info.plist 0000644 0002043 0000764 00000000306 11131137242 026626 0 ustar johnston nielsen {
STFileTypes = ( "st", "stalk" );
StepTalkLanguages = {
Smalltalk = {
FileTypes = ("st");
EngineClass = "SmalltalkEngine";
};
};
}
Adun-0.81/ExternalPackages/StepTalk/Languages/StepTalkSmalltalk/NSArray+additions.h 0000644 0002043 0000764 00000002153 11131137242 030322 0 ustar johnston nielsen /**
NSArray-additions.h
Various methods for NSArray
Copyright (c) 2002 Free Software Foundation
This file is part of the StepTalk project.
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 STBlock;
@interface NSArray (STCollecting)
- do:(STBlock *)block;
- select:(STBlock *)block;
- reject:(STBlock *)block;
- collect:(STBlock *)block;
- detect:(STBlock *)block;
@end
Adun-0.81/ExternalPackages/StepTalk/Languages/StepTalkSmalltalk/NSArray+additions.m 0000644 0002043 0000764 00000006164 11131137242 030335 0 ustar johnston nielsen /**
NSArray-additions.m
Various methods for NSArray
Copyright (c) 2002 Free Software Foundation
Written by: Stefan Urbanek
This file is part of the StepTalk project.
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 "NSArray+additions.h"
#import "NSNumber+additions.h"
#import "STBlock.h"
#import
#import
@implementation NSArray (STCollecting)
- do:(STBlock *)block
{
NSEnumerator *enumerator;
id object;
id retval = nil;
enumerator = [self objectEnumerator];
while( (object = [enumerator nextObject]) )
{
retval = [block valueWith:object];
}
return retval;
}
- select:(STBlock *)block
{
NSMutableArray *array;
NSEnumerator *enumerator;
id object;
id value;
array = [NSMutableArray array];
enumerator = [self objectEnumerator];
while( (object = [enumerator nextObject]) )
{
value = [block valueWith:object];
if([(NSNumber *)value isTrue])
{
[array addObject:object];
}
}
return [NSArray arrayWithArray:array];
}
- reject:(STBlock *)block
{
NSMutableArray *array;
NSEnumerator *enumerator;
id object;
id value;
array = [NSMutableArray array];
enumerator = [self objectEnumerator];
while( (object = [enumerator nextObject]) )
{
value = [block valueWith:object];
if([(NSNumber *)value isFalse])
{
[array addObject:object];
}
}
return [NSArray arrayWithArray:array];
}
- collect:(STBlock *)block
{
NSMutableArray *array;
NSEnumerator *enumerator;
id object;
id value;
array = [NSMutableArray array];
enumerator = [self objectEnumerator];
while( (object = [enumerator nextObject]) )
{
value = [block valueWith:object];
[array addObject:value];
}
return [NSArray arrayWithArray:array];
}
- detect:(STBlock *)block
{
NSEnumerator *enumerator;
id object;
id retval = nil;
enumerator = [self objectEnumerator];
while( (object = [enumerator nextObject]) )
{
retval = [block valueWith:object];
if([(NSNumber *)retval isTrue])
{
return object;
}
}
return retval;
}
@end
Adun-0.81/ExternalPackages/StepTalk/Languages/StepTalkSmalltalk/NSNumber+additions.h 0000644 0002043 0000764 00000002441 11131137242 030474 0 ustar johnston nielsen /**
NSNumber-additions.h
Various methods for NSNumber
Copyright (c) 2002 Free Software Foundation
This file is part of the StepTalk project.
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 STBlock;
@interface NSNumber (STSmalltalkAdditions)
- ifTrue:(STBlock *)block;
- ifFalse:(STBlock *)block;
- ifTrue:(STBlock *)trueBlock ifFalse:(STBlock *)falseBlock;
- ifFalse:(STBlock *)falseBlock ifTrue:(STBlock *)trueBlock;
- (BOOL)isTrue;
- (BOOL)isFalse;
- to:(int)number do:(STBlock *)block;
- to:(int)number step:(int)step do:(STBlock *)block;
@end
Adun-0.81/ExternalPackages/StepTalk/Languages/StepTalkSmalltalk/NSNumber+additions.m 0000644 0002043 0000764 00000003246 11131137242 030505 0 ustar johnston nielsen /**
NSNumber-additions.h
Various methods for NSNumber
Copyright (c) 2002 Free Software Foundation
This file is part of the StepTalk project.
*/
#import "NSNumber+additions.h"
#import "STBlock.h"
#include
#import
@implementation NSNumber (STSmalltalkAdditions)
- ifTrue:(STBlock *)block
{
if([self isTrue])
{
return [block value];
}
return self;
}
- ifFalse:(STBlock *)block
{
if([self isFalse])
{
return [block value];
}
return self;
}
- ifTrue:(STBlock *)trueBlock ifFalse:(STBlock *)falseBlock
{
if([self isTrue])
{
return [trueBlock value];
}
return [falseBlock value];
}
- ifFalse:(STBlock *)falseBlock ifTrue:(STBlock *)trueBlock
{
if([self isFalse])
{
return [falseBlock value];
}
return [trueBlock value];
}
- (BOOL)isTrue
{
return ([self intValue] != 0);
}
- (BOOL)isFalse
{
return ([self intValue] == 0);
}
/* FIXME: make it work with floats */
- to:(int)number do:(STBlock *)block
{
id retval = nil;
int i;
for(i=[self intValue];i<=number;i++)
{
retval = [block valueWith:[NSNumber numberWithInt:i]];
}
return retval;
}
- to:(int)number step:(int)step do:(STBlock *)block
{
id retval = nil;
int i;
if (step > 0)
{
for(i=[self intValue];i<=number;i+=step)
{
retval = [block valueWith:[NSNumber numberWithInt:i]];
}
}
else
{
// step =< 0
for(i=[self intValue];i>=number;i+=step)
{
retval = [block valueWith:[NSNumber numberWithInt:i]];
}
}
return retval;
}
@end
Adun-0.81/ExternalPackages/StepTalk/Languages/StepTalkSmalltalk/NSObject+additions.h 0000644 0002043 0000764 00000002072 11131137242 030452 0 ustar johnston nielsen /**
NSObject+additions.h
Smalltalk methods for NSObject
Copyright (c) 2005 Free Software Foundation
Date: 2005 Aug 17
Author: Stefan Urbanek
This file is part of the StepTalk project.
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 STBlock;
@interface NSObject (SmalltalkBlock)
- ifNil:(STBlock *)block;
@end
Adun-0.81/ExternalPackages/StepTalk/Languages/StepTalkSmalltalk/NSObject+additions.m 0000644 0002043 0000764 00000002151 11131137242 030455 0 ustar johnston nielsen /**
NSObject+additions.h
Smalltalk methods for NSObject
Copyright (c) 2005 Free Software Foundation
Date: 2005 Aug 17
Author: Stefan Urbanek
This file is part of the StepTalk project.
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+additions.h"
@implementation NSObject (SmalltalkBlock)
- ifNil:(STBlock *)block
{
/* Do nothing as we are not nil. */
return self;
}
@end
Adun-0.81/ExternalPackages/StepTalk/Languages/StepTalkSmalltalk/NSString+additions.h 0000644 0002043 0000764 00000002122 11131137242 030506 0 ustar johnston nielsen /**
NSString-additions.h
Various methods for NSString
Copyright (c) 2002 Free Software Foundation
Date: 2003 May 9
Author: Stefan Urbanek
This file is part of the StepTalk project.
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 NSString (STSmalltalkAdditions)
- (BOOL)containsString:(NSString *)aString;
@end
Adun-0.81/ExternalPackages/StepTalk/Languages/StepTalkSmalltalk/NSString+additions.m 0000644 0002043 0000764 00000002313 11131137242 030515 0 ustar johnston nielsen /**
NSString-additions.h
Various methods for NSString
Copyright (c) 2002 Free Software Foundation
Date: 2003 May 9
Author: Stefan Urbanek
This file is part of the StepTalk project.
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 "NSString+additions.h"
@implementation NSString (STSmalltalkAdditions)
- (BOOL)containsString:(NSString *)aString
{
NSRange range;
range = [self rangeOfString:aString];
return (range.location != NSNotFound);
}
@end
Adun-0.81/ExternalPackages/StepTalk/Languages/StepTalkSmalltalk/STBlock.h 0000644 0002043 0000764 00000003536 11131137242 026340 0 ustar johnston nielsen /**
STBlock.h
Wrapper for STBlockContext to make it invisible
Copyright (c) 2002 Free Software Foundation
This file is part of the StepTalk project.
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 STBlockLiteral;
@class STBytecodeInterpreter;
@class STMethodContext;
@class STBlockContext;
@interface STBlock:NSObject
{
STBytecodeInterpreter *interpreter;
STMethodContext *homeContext;
unsigned initialIP;
unsigned argCount;
unsigned stackSize;
STBlockContext *cachedContext;
BOOL usingCachedContext;
}
- initWithInterpreter:(STBytecodeInterpreter *)anInterpreter
homeContext:(STMethodContext *)context
initialIP:(unsigned)ptr
argumentCount:(int)count
stackSize:(int)size;
- (unsigned)argumentCount;
- value;
- valueWith:arg;
- valueWith:arg1 with:arg2;
- valueWith:arg1 with:arg2 with:arg3;
- valueWithArgs:(id *)args count:(unsigned)count;
- whileTrue:(STBlock *)doBlock;
- whileFalse:(STBlock *)doBlock;
- handler:(STBlock *)handlerBlock;
@end
Adun-0.81/ExternalPackages/StepTalk/Languages/StepTalkSmalltalk/STBlock.m 0000644 0002043 0000764 00000012166 11131137242 026344 0 ustar johnston nielsen /**
STBlock.m
Wrapper for STBlockContext to make it invisible from the user
Copyright (c) 2002 Free Software Foundation
This file is part of the StepTalk project.
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 "STBlock.h"
#import "STLiterals.h"
#import "STBlockContext.h"
#import "STBytecodeInterpreter.h"
#import "STStack.h"
#import
#import
#import
#import
#import
Class STBlockContextClass = nil;
@implementation STBlock
+ (void)initialize
{
STBlockContextClass = [STBlockContext class];
}
- initWithInterpreter:(STBytecodeInterpreter *)anInterpreter
homeContext:(STMethodContext *)context
initialIP:(unsigned)ptr
argumentCount:(int)count
stackSize:(int)size
{
homeContext = context;
argCount = count;
stackSize = size;
initialIP = ptr;
interpreter = anInterpreter;
return [super init];
}
- (unsigned)argumentCount
{
return argCount;
}
- value
{
if(argCount != 0)
{
[NSException raise:STScriptingException
format:@"Block needs %i arguments", argCount];
return nil;
}
return [self valueWithArgs:(id*)0 count:0];
}
- valueWith:arg
{
id args[1] = {arg};
id retval;
retval = [self valueWithArgs:args count:1];
return retval;
}
- valueWith:arg1 with:arg2
{
id args[2] = {arg1,arg2};
id retval;
retval = [self valueWithArgs:args count:2];
return retval;
}
- valueWith:arg1 with:arg2 with:arg3
{
id args[3] = {arg1,arg2,arg3};
id retval;
retval = [self valueWithArgs:args count:3];
return retval;
}
- valueWith:arg1 with:arg2 with:arg3 with:arg4
{
id args[4] = {arg1,arg2,arg3,arg4};
id retval;
retval = [self valueWithArgs:args count:4];
return retval;
}
- valueWithArgs:(id *)args count:(unsigned)count;
{
STExecutionContext *parentContext;
STBlockContext *context;
STStack *stack;
unsigned int i;
id retval;
if(argCount != count)
{
[NSException raise:STScriptingException
format:@"Invalid block argument count %i, "
@"wants to be %i", count, argCount];
return nil;
}
if(!usingCachedContext)
{
/* In case of recursive block nesting */
usingCachedContext = YES;
if(!cachedContext)
{
cachedContext = [[STBlockContextClass alloc]
initWithInterpreter:interpreter
initialIP:initialIP
stackSize:stackSize];
}
/* Avoid allocation */
context = cachedContext;
[[context stack] empty];
[context resetInstructionPointer];
}
else
{
/* Create new context */
context = [[STBlockContextClass alloc] initWithInterpreter:interpreter
initialIP:initialIP
stackSize:stackSize];
AUTORELEASE(context);
}
/* push block arguments to the stack */
stack = [context stack];
for(i = 0; i