StepTalk-0.10.0/0000775000175000017500000000000014633027767012422 5ustar yavoryavorStepTalk-0.10.0/Version0000664000175000017500000000051714633027767013775 0ustar yavoryavor# This file is included in various Makefile's to get version information. # Compatible with Bourne shell syntax, so it can included there too. # The version number of this release. MAJOR_VERSION=0 MINOR_VERSION=10 SUBMINOR_VERSION=0 STEPTALK_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION} VERSION=${STEPTALK_VERSION} StepTalk-0.10.0/Tools/0000775000175000017500000000000014633027767013522 5ustar yavoryavorStepTalk-0.10.0/Tools/STEnvironmentProcess.h0000664000175000017500000000042214633027767020003 0ustar yavoryavor#import #import @class STConversation; @class STEnvironment; @interface STEnvironmentProcess:NSObject { STEnvironment *environment; } - initWithDescriptionName:(NSString *)descName; @end StepTalk-0.10.0/Tools/GNUmakefile.preamble0000664000175000017500000000332714633027767017367 0ustar yavoryavor# # GNUmakefile.preamble # # 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; see the file COPYING.LIB. # If not, write to the Free Software Foundation, # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # Project specific makefile variables, and additional # # Do not put any Makefile rules in this file, instead they should # be put into Makefile.postamble. # # # Flags dealing with compiling and linking # # Additional flags to pass to the preprocessor ADDITIONAL_CPPFLAGS += # Additional flags to pass to the Objective-C compiler ADDITIONAL_OBJCFLAGS += # Additional flags to pass to the C compiler ADDITIONAL_CFLAGS += #ADDITIONAL_CFLAGS += # Additional include directories the compiler should search ADDITIONAL_INCLUDE_DIRS += # Additional LDFLAGS to pass to the linker ADDITIONAL_LDFLAGS += # Additional library directories the linker should search ADDITIONAL_LIB_DIRS += ADDITIONAL_TOOL_LIBS += # # Flags dealing with installing and uninstalling # # Additional directories to be created during installation ADDITIONAL_INSTALL_DIRS += # # Local configuration # StepTalk-0.10.0/Tools/GNUmakefile0000664000175000017500000000303014633027767015570 0ustar yavoryavor# # StepTalk tools # # Copyright (C) 2000,2001 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 TOOL_NAME = \ stexec \ stenvironment COMMON_OBJC_FILES = \ STExecutor.m stexec_OBJC_FILES = \ $(COMMON_OBJC_FILES) \ $(DEBUG_FILES) \ stexec.m stenvironment_OBJC_FILES = \ stenvironment.m \ STEnvironmentProcess.m ADDITIONAL_TOOL_LIBS = -lStepTalk ADDITIONAL_INCLUDE_DIRS += -I../Frameworks/ ADDITIONAL_LIB_DIRS += -L../Frameworks/StepTalk/StepTalk.framework/Versions/Current/$(GNUSTEP_TARGET_LDIR) ADDITIONAL_OBJCFLAGS = -Wall -Wno-import ifeq ($(check),yes) ADDITIONAL_OBJCFLAGS += -Werror endif -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/tool.make -include GNUMakefile.postamble StepTalk-0.10.0/Tools/.cvsignore0000664000175000017500000000010514633027767015516 0ustar yavoryavor*.app *.debug *.profile shared_*obj *.bundle *.stmodule *.stlanguage StepTalk-0.10.0/Tools/STExecutor.m0000664000175000017500000002554114633027767015754 0ustar yavoryavor/** STExecutor.m Common class for stalk and stexec tools Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 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 "STExecutor.h" #import #import #import #import #import #import #import #import #import NSString *STExecutorException = @"STExecutorException"; const char *STExecutorCommonOptions = " -help print this message\n" " -list-all-objects list all available objects\n" " -list-classes list available classes\n" " -list-objects list named instances\n\n" " -language lang force use of language lang\n" " -list-languages list available languages\n" " -continue do not stop when one of scripts failed to execute\n\n"; //" -set obj=value define named object 'obj' with string value 'value'\n" @implementation STExecutor - (void)createEnvironment { [self subclassResponsibility:_cmd]; } - (void) dealloc { RELEASE(conversation); [super dealloc]; } - (void)executeScripts { #ifndef DEBUG NSString *logFmt = @"'%@': execution failed, reason: %@"; #endif NSMutableArray *scriptArgs; NSString *scriptFileName; NSString *arg; scriptFileName = [self nextArgument]; if(!scriptFileName) { [self executeScriptFromStandardInputArguments:nil]; return; } scriptArgs = [NSMutableArray array]; do { [scriptArgs removeAllObjects]; arg = [self nextArgument]; while(![arg isEqualToString:@","] && arg != nil) { [scriptArgs addObject:arg]; arg = [self nextArgument]; } #ifndef DEBUG NS_DURING #endif if([scriptFileName isEqualToString:@"-"]) { [self executeScriptFromStandardInputArguments:scriptArgs]; } else { [self executeScript:scriptFileName withArguments:scriptArgs]; } #ifndef DEBUG NS_HANDLER if(contFlag) { NSLog(logFmt,scriptFileName,[localException reason]); } else { [localException raise]; } NS_ENDHANDLER #endif } while( (scriptFileName = [self nextArgument]) ); } - (void)executeScriptFromStandardInputArguments:(NSArray *)args { NSFileHandle *handle; STContext *env; NSString *source; NSData *data; handle = [NSFileHandle fileHandleWithStandardInput]; data = [handle readDataToEndOfFile]; source = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; if(langName) { [conversation setLanguage:langName]; } else { STLanguageManager *langManager = [STLanguageManager defaultManager]; [conversation setLanguage:[langManager defaultLanguage]]; } if(conversation) { NSDebugLog(@"Executing script from stdin"); if([args count] > 0) { if([conversation isKindOfClass:[STRemoteConversation class]]) { [NSException raise:@"STExecutorException" format:@"Passing arguments to distant environment" @" is not implemented."]; } else { env = [conversation context]; [env setObject:args forName:@"Args"]; } } [conversation interpretScript:source]; } RELEASE(source); } - (void)executeScript:(NSString *)file withArguments:(NSArray *)args; { NSFileManager *manager = [NSFileManager defaultManager]; STEnvironment *env; NSString *useLanguage; NSString *source; /* Get proper language name */ if( [manager fileExistsAtPath:file isDirectory:NULL] ) { source = [NSString stringWithContentsOfFile:file]; if(langName) { NSDebugLog(@"Using language %@", langName); useLanguage = langName; } else { STLanguageManager *langManager = [STLanguageManager defaultManager]; NSDebugLog(@"Using language for file extension %@", [file pathExtension]); useLanguage = [langManager languageForFileType:[file pathExtension]]; } } else { STScriptsManager *sm; STFileScript *script; /* Try to find it in standard script locations */ sm = [[STScriptsManager alloc] initWithDomainName:@"Shell"]; AUTORELEASE(sm); script = [sm scriptWithName:file]; source = [script source]; if(!source) { [NSException raise:STExecutorException format:@"Could not find script '%@'", file]; return; } else { useLanguage = [script language]; } } [conversation setLanguage:useLanguage]; if(conversation) { NSDebugLog(@"Executing script '%@'",file); if([args count] > 0) { if([conversation isKindOfClass:[STRemoteConversation class]]) { [NSException raise:@"STExecutorException" format:@"Passing arguments to distant environment" @" is not implemented."]; } else { /* FIXME: do not cast */ env = (STEnvironment *)[conversation context]; [env setObject:args forName:@"Args"]; } } [conversation interpretScript:source]; } else { [NSException raise:STExecutorException format:@"Unable to create a StepTalk conversation."]; } } - (void)listLanguages { NSArray *languages; NSEnumerator *enumerator; NSString *name; languages = [[STLanguageManager defaultManager] availableLanguages]; enumerator = [languages objectEnumerator]; while( (name = [enumerator nextObject]) ) { printf("%s\n", [name cString]); } } - (NSString *)nextArgument { if(currentArg < [arguments count]) { return [arguments objectAtIndex:currentArg++]; } return nil; } - (void)reuseArgument { currentArg--; } - (void)listObjects { NSEnumerator *enumerator; NSDictionary *dict; NSString *name; NSArray *objects; dict = [[conversation context] objectDictionary]; objects = [[dict allKeys] sortedArrayUsingSelector:@selector(compare:)]; enumerator = [objects objectEnumerator]; if(listObjects == STListAll) { while( (name = [enumerator nextObject]) ) { printf("%s\n", [name cString]); } } else if (listObjects == STListClasses) { while( (name = [enumerator nextObject]) ) { if([[dict objectForKey:name] isClass]) { printf("%s\n", [name cString]); } } } else /* (listObjects == STListInstances) */ { while( (name = [enumerator nextObject]) ) { if(! [[dict objectForKey:name] isClass]) { printf("%s\n", [name cString]); } } } } - (int)parseOptions { BOOL isOption = NO; NSString *arg; listObjects = STListNone; while( (arg = [self nextArgument]) ) { isOption = NO; if( [arg isEqualToString:@"-"] ) { isOption = NO; } else if( [arg hasPrefix:@"--"] ) { arg = [arg substringFromIndex:2]; isOption = YES; } else if( [arg hasPrefix:@"-"] ) { arg = [arg substringFromIndex:1]; isOption = YES; } if ([@"help" hasPrefix:arg]) { [self printHelp]; return 1; } else if ([@"list-languages" hasPrefix:arg]) { [self listLanguages]; return 1; } /* else if ([@"list-engines" hasPrefix:arg]) { [self listEngines]; return 1; } */ else if ([@"list-objects" hasPrefix:arg]) { listObjects = STListObjects; } else if ([@"list-classes" hasPrefix:arg]) { listObjects = STListClasses; } else if ([@"list-all-objects" hasPrefix:arg]) { listObjects = STListAll; } else if ([@"continue" hasPrefix:arg]) { contFlag = YES; } else if ([@"language" hasPrefix:arg]) { RELEASE(langName); langName = [self nextArgument]; if(!langName) { [NSException raise:STExecutorException format:@"Language name expected"]; } } else { if(!isOption) { break; } else { if( [self processOption:arg] ) { return 1; } } } } if(arg) { [self reuseArgument]; } return 0; } - (void)beforeExecuting { } - (void)afterExecuting { } - (void)runWithArguments:(NSArray *)args { arguments = RETAIN(args); currentArg = 1; if([self parseOptions]) { return; } [self beforeExecuting]; [self createConversation]; [self executeScripts]; [self afterExecuting]; if(listObjects != STListNone) { [self listObjects]; } } - (void)printHelp { [self subclassResponsibility:_cmd]; } - (int)processOption:(NSString *)option { [self subclassResponsibility:_cmd]; return 0; } - (void)createConversation { [self subclassResponsibility:_cmd]; } @end StepTalk-0.10.0/Tools/STExecutor.h0000664000175000017500000000355414633027767015747 0ustar yavoryavor/** STExecutor.h Common class for stalk and stexec tools Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 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 NSString *STExecutorException; extern const char *STExecutorCommonOptions; extern void STPrintCassStats(void); enum { STListNone, STListObjects, STListClasses, STListAll }; @class STConversation; @class STEnvironment; @class NSString; @class NSArray; @interface STExecutor:NSObject { STConversation *conversation; NSString *langName; NSArray *arguments; NSUInteger currentArg; BOOL contFlag; int listObjects; } - (void)createConversation; - (void)printHelp; - (int)processOption:(NSString *)option; - (void)executeScript:(NSString *)fileName withArguments:(NSArray *)args; - (void)executeScriptFromStandardInputArguments:(NSArray *)args; - (int)parseOptions; - (void)executeScripts; - (NSString *)nextArgument; - (void)reuseArgument; - (void)runWithArguments:(NSArray *)argsArray; @end StepTalk-0.10.0/Tools/stexec.m0000664000175000017500000001275414633027767015204 0ustar yavoryavor/** stexec.m Script executor 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 "STExecutor.h" #import #import #import #import #import #import #import #import #include @interface Executor:STExecutor { NSString *typeName; NSString *environmentName; NSString *hostName; BOOL enableFull; } @end @implementation Executor - (void)createConversation { STEnvironmentDescription *desc; STEnvironment *environment; if(environmentName) { /* user wants to connect to a distant environment */ conversation = [[STRemoteConversation alloc] initWithEnvironmentName:environmentName host:hostName language:langName]; if(!conversation) { NSLog(@"Unable to connect to %@@%@", environmentName, hostName); return; } } else { /* User wants local temporary environment */ if(!typeName || [typeName isEqualToString:@""]) { environment = [STEnvironment environmentWithDefaultDescription]; } else { desc = [STEnvironmentDescription descriptionWithName:typeName]; environment = [STEnvironment environmentWithDescription:desc]; } /* Register basic objects: Environment, Transcript */ [environment setObject:environment forName:@"Environment"]; [environment loadModule:@"SimpleTranscript"]; [environment setCreatesUnknownObjects:YES]; /* FIXME: remove this or use some command-line flag */ [environment setFullScriptingEnabled:enableFull]; conversation = [[STConversation alloc] initWithContext:environment language:langName]; } } - (void)dealloc { RELEASE(typeName); RELEASE(environmentName); RELEASE(hostName); [super dealloc]; } - (int)processOption:(NSString *)option { if ([@"type" hasPrefix:option]) { ASSIGN(typeName, [self nextArgument]); if(!typeName) { [NSException raise:STExecutorException format:@"Environment description (type) name expected"]; } } else if ([@"environment" hasPrefix:option]) { ASSIGN(environmentName,[self nextArgument]); if(!environmentName) { [NSException raise:STExecutorException format:@"Environment name expected"]; } } else if ([@"host" hasPrefix:option]) { ASSIGN(hostName,[self nextArgument]); if(!hostName) { [NSException raise:STExecutorException format:@"Host name expected"]; } } else if ([@"full" hasPrefix:option]) { enableFull = YES; } else { [NSException raise:STExecutorException format:@"Unknown option -%@", option]; } return 0; } - (void)beforeExecuting { } - (void) printHelp { printf( "stexec - execute StepTalk script (in GNUstep-base environment)\n" "Usage: stexec [options] [script] [args ...] [ , script ...]\n" " Options:\n" "%s" " -full enable full scripting\n" " -environment env use scripting environment with name env\n" " -host host find environment on host\n" " -type desc use environment description with name 'desc'\n" "\n" "Notes:\n" "- if -environment is used, then -type is ignored" "- if no script is specified, standard input is used without arguments\n" "- if script name is '-' then standard input is used and arguments are passed" " to the script\n", STExecutorCommonOptions ); } @end int main(int argc, const char **argv) { Executor *executor; NSArray *args; NSAutoreleasePool *pool; NSProcessInfo *procInfo; pool = [NSAutoreleasePool new]; // [NSAutoreleasePool enableDoubleReleaseCheck:YES]; procInfo = [NSProcessInfo processInfo]; if (procInfo == nil) { NSLog(@"Unable to get process information"); RELEASE(pool); exit(1); } //GSDebugAllocationActive(YES); executor = [[Executor alloc] init]; args = [procInfo arguments]; [executor runWithArguments:args]; RELEASE(executor); //printf("%s\n",GSDebugAllocationList(NO)); RELEASE(pool); return 0; } StepTalk-0.10.0/Tools/stenvironment.m0000664000175000017500000001257414633027767016624 0ustar yavoryavor/** stenvironment.m Scripting environment process Copyright (c) 2005 Free Software Foundation Written by: Stefan Urbanek Date: 2005-08 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 "STEnvironmentProcess.h" #import #import #import #import #import #import #import #include const int MAX_SEQUENCES = 100; /* Maximal number of environment sequence numbers */ void print_help(void) { printf( "stenvironment - create StepTalk environment process\n" "Usage: stenvironment [options]\n" " Options:\n" " -name name set name of environment\n" " -type env use scripting environment description with name 'env'\n" " -observer name observer 'name' will receive notification\n" "\n" "Notes:\n" "- DO server will be created with name 'STEnvironment:name'\n" "- if no name is given then 'UnnamedNN' will be created, where NN is sequence\n" "- observer is a distributed notification observer\n" "\n" ); } int main(int argc, const char **argv) { NSNotificationCenter *dnc; STEnvironmentProcess *envprocess; NSAutoreleasePool *pool; NSUserDefaults *defs; NSString *envIdentifier; NSString *observerIdentifier; BOOL isRegistered = NO; int sequence = 0; NSConnection *connection; NSDictionary *dict; NSString *serverName; NSArray *args; NSString *str; NSString *descriptionName; pool = [NSAutoreleasePool new]; args = [[NSProcessInfo processInfo] arguments]; if([args count] >= 2) { str = [args objectAtIndex:1]; if([str isEqualToString:@"-h"] || [str isEqualToString:@"--h"] || [str isEqualToString:@"-help"] || [str isEqualToString:@"--help"]) { print_help(); RELEASE(pool); exit(0); } } // [NSAutoreleasePool enableDoubleReleaseCheck:YES]; defs = [NSUserDefaults standardUserDefaults]; observerIdentifier = [defs objectForKey:@"observer"]; envIdentifier = [defs objectForKey:@"name"]; descriptionName = [defs objectForKey:@"type"]; /* FIXME: use environment description name */ envprocess = [[STEnvironmentProcess alloc] initWithDescriptionName:descriptionName]; /* Register environment */ connection = RETAIN([NSConnection defaultConnection]); [connection setRootObject:envprocess]; if(!envIdentifier) { for(sequence = 0; sequence < MAX_SEQUENCES; sequence++) { envIdentifier = [NSString stringWithFormat:@"Unnamed%i", sequence]; serverName = [NSString stringWithFormat:@"STEnvironment:%@", envIdentifier]; NSLog(@"Trying to register environment with name '%@'", envIdentifier); if([connection registerName:serverName]) { isRegistered = YES; } if(isRegistered) { break; } } } else { serverName = [NSString stringWithFormat:@"STEnvironment:%@", envIdentifier]; if([connection registerName:serverName]) { isRegistered = YES; } else { NSLog(@"Unable to register '%@'", serverName); } } /* Finish */ if(isRegistered) { NSLog(@"Environment : '%@'", envIdentifier); NSLog(@"DO Server : '%@'", serverName); if(observerIdentifier) { NSLog(@"Notifying : '%@'", observerIdentifier); dict = [NSDictionary dictionaryWithObjectsAndKeys: envIdentifier, @"STDistantEnvironmentName", nil, nil]; dnc = [NSDistributedNotificationCenter defaultCenter]; [dnc postNotificationName:@"STDistantEnvironmentConnectNotification" object:observerIdentifier userInfo:dict]; } [[NSRunLoop currentRunLoop] run]; NSLog(@"Terminating environment process %@", envIdentifier); } else { NSLog(@"Unable to register environment '%@'.", envIdentifier); } RELEASE(connection); RELEASE(envprocess); RELEASE(pool); return 0; } StepTalk-0.10.0/Tools/STEnvironmentProcess.m0000664000175000017500000000240514633027767020013 0ustar yavoryavor#import "STEnvironmentProcess.h" #import #import #import @implementation STEnvironmentProcess - initWithDescriptionName:(NSString *)descName { if ((self = [super init]) != nil) { STEnvironmentDescription *desc; if (descName) { NSLog(@"Creating environment from description '%@'", descName); desc = [STEnvironmentDescription descriptionWithName:descName]; environment = [[STEnvironment alloc] initWithDescription:desc]; } else { environment = [[STEnvironment alloc] initWithDefaultDescription]; } /* FIXME: use some configurable mechanism */ [environment setObject:environment forName:@"Environment"]; [environment loadModule:@"SimpleTranscript"]; } return self; } - (void)dealloc { RELEASE(environment); [super dealloc]; } - (STConversation *)createConversation { STConversation *conversation; conversation = [[STConversation alloc] initWithContext:environment language:nil]; /* FIXME: create list of open conversations */ return AUTORELEASE(conversation); } @end StepTalk-0.10.0/Tools/stalk.m0000664000175000017500000001140714633027767015021 0ustar yavoryavor/** stalk.m Program for 'talking' to scriptable objects 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 "STExecutor.h" #import #import #import #import #import #import #import #import #import #import #import @interface NSObject (STPrivateMethodDeclarations) - (STEnvironment *)scriptingEnvironment; @end @interface Executor:STExecutor { NSString *hostName; NSString *objectName; id target; } - (void)setTargetWithName:(NSString *)name; @end @implementation Executor - (void)dealloc { RELEASE(objectName); RELEASE(hostName); [super dealloc]; } - (void)setTargetWithName:(NSString *)targetName { NSDebugLog(@"connecting object '%@' on host '%@'",targetName,hostName); if(!targetName) { [NSException raise:STExecutorException format:@"No target specified"]; } target = [NSConnection rootProxyForConnectionWithRegisteredName:targetName host:hostName]; /* [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(connectionDidDie:) name:NSConnectionDidDieNotification object:object]; */ if(!target) { [NSException raise:STExecutorException format:@"Unable to connect to target named '%@' " @"on host '%@'", targetName, hostName]; return; } ASSIGN(objectName,targetName); } /* FIXME: This definitely needs to be rewritten. It is a quick hack after moving from STEngnie to STConversation */ - (void)createConversation { STEnvironment *env; if([target respondsToSelector:@selector(scriptingEnvironment)]) { env = [target scriptingEnvironment]; } else { [NSException raise:STExecutorException format:@"Target '%@' on host '%@' " @"does not provide scripting environment.", objectName, hostName]; return; } [env setObject:target forName:objectName]; conversation = [[STConversation alloc] initWithContext:env language:nil]; } - (int)processOption:(NSString *)option { if ([@"host" hasPrefix:option]) { ASSIGN(hostName,[self nextArgument]); if(!hostName) { [NSException raise:STExecutorException format:@"Hostname expected"]; } } else { [NSException raise:STExecutorException format:@"Unknown option -%@", option]; } return NO; } -(void) beforeExecuting { [self setTargetWithName:[self nextArgument]]; } - (void)printHelp { printf( "stalk - 'talk' to objects with StepTalk script\n" "Usage: stalk [options] target script [args ...] [ , script ...]\n" " Options:\n" "%s" " -host hostName look for target on specified host\n", STExecutorCommonOptions ); } @end int main(int argc, const char **argv) { Executor *executor; NSArray *args; NSAutoreleasePool *pool; NSProcessInfo *procInfo; pool = [NSAutoreleasePool new]; procInfo = [NSProcessInfo processInfo]; if (procInfo == nil) { NSLog(@"Unable to get process information"); [pool release]; exit(1); } executor = [[Executor alloc] init]; args = [procInfo arguments]; NSLog(@"Warning: This tool is obsolete."); [executor runWithArguments:args]; [executor release]; [pool release]; return 0; } StepTalk-0.10.0/TODO0000664000175000017500000000266414633027767013122 0ustar yavoryavorTODO 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 - 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 - Fill implementation of STScriptObject, STMethod and related STEngine methods - Remove empty directories (Source, Modules/StepTalk) - Replace STMethod languageName with map table of method class->engine class StepTalk-0.10.0/Examples/0000775000175000017500000000000014633027767014200 5ustar yavoryavorStepTalk-0.10.0/Examples/Smalltalk/0000775000175000017500000000000014633027767016124 5ustar yavoryavorStepTalk-0.10.0/Examples/Smalltalk/selector.st0000664000175000017500000000040514633027767020313 0ustar yavoryavor" Selector example " [| main self performSelector:#hello. ^nil ! hello | b | Transcript showLine:'Hello!'. ^self ! hello2 Transcript showLine:'Hello!'. ^self ! hello3 |a| Transcript showLine:'Hello!'. ^self ] StepTalk-0.10.0/Examples/Smalltalk/scope.st0000664000175000017500000000221114633027767017601 0ustar yavoryavor" Variable scope example try to run: > stexec scope.st , scope.st " [| :global main | local | Transcript showLine: ':: Start'. (extern isNil) ifTrue: [ Transcript showLine: 'Script was run for first time. Setting extern.'. extern := 100. ] ifFalse: [ Transcript showLine: 'Extern: ', (extern stringValue). ]. local := 10. Transcript showLine: 'Local: ', (local stringValue). self setLocal:20. Transcript showLine: 'Local after call: ', (local stringValue), ' (has to be 10 not 20)'. global := 10. Transcript showLine: 'Global: ', (global stringValue). self setGlobal:20. Transcript showLine: 'Global after call 1: ', (global stringValue), ' (has to be 20 not 10)'. self testGlobal. Transcript showLine: 'Global after call 2: ', (global stringValue), ' (has to be 20 not 0)'. ^nil ! setLocal:val | local | local := val. ^self ! setGlobal:val global := val. ^self ! testGlobal | global | global := 0. ^self ] StepTalk-0.10.0/Examples/Smalltalk/plparse.st0000664000175000017500000000327414633027767020150 0ustar yavoryavor" plparse.st GNUstep plparse tool rewriten as Smalltalk script for StepTalk Ussage: stexec plparse.st file1 [file2 ...] " [| main | string result | ((Args count) < 1 ) ifTrue: [ Transcript showLine:'No file names given to parse.' ] ifFalse: [ Args do: [ :file | self parseFile:file ] ]. ^self ! parseFile: file Transcript show: ('Parsing ', file, ' - '). [ string := NSString stringWithContentsOfFile:file. result := string propertyList. (result isNil) ifTrue: [ Transcript showLine:'nil property list' ] ifFalse: [ (result isKindOfClass: (NSDictionary class)) ifTrue: [ Transcript showLine:'a dictionary'] ifFalse: [ (result isKindOfClass: (NSArray class)) ifTrue: [ Transcript showLine:'an array'] ifFalse: [ (result isKindOfClass: (NSData class)) ifTrue: [ Transcript showLine:'a data'] ifFalse: [ (result isKindOfClass: (NSString class)) ifTrue: [ Transcript showLine:'a string'] ifFalse: [ Transcript showLine: ('unexpected class - ', result class description ) ] ] ] ] ] ] handler: [ :localException | Transcript showLine: (localException reason) ]. ] StepTalk-0.10.0/Examples/Smalltalk/shell.st0000664000175000017500000000173614633027767017612 0ustar yavoryavor" Script shell - shell written in script. This is just an example. Run it by: stexec shell.st Author: Stefan Urbanek Date: 2003 Oct 3 " [| :done main | line env engine result | Environment includeFramework:'StepTalk'. Environment loadModule:'ReadlineTranscript'. " Create environment " env := STEnvironment defaultScriptingEnvironment. env setObject:env forName:'Environment'. env setObject:Transcript forName:'Transcript'. env setObject:self forName:'Shell'. " Create and setup engine " engine := STEngine engineForLanguage:'Smalltalk'. " Do the loop! " [ done ] whileFalse: [ line := Transcript readLine:'Shell > '. (line = 'exit') ifTrue: [ done := YES ]. result := engine executeCode: (line, ' ') inEnvironment:env. Transcript showLine: result. ]. ^self ! exit Transcript showLine: 'BLAH'. done := YES. ^self ] StepTalk-0.10.0/Examples/Smalltalk/pldes.st0000664000175000017500000000243714633027767017611 0ustar yavoryavor" pldes.st GNUstep plpdes tool rewriten as Smalltalk script for StepTalk Ussage: stexec pldes.st file1 [file2 ...] " [| :locale main locale := (NSUserDefaults standardUserDefaults) dictionaryRepresentation. ((Args count) < 1 ) ifTrue: [ Transcript showLine:'No file names given to deserialize.' ] ifFalse: [ Args do: [ :file | [self deserializeFile:file] handler: [ :exception | Transcript showLine:'Loading \'', file, '\' - ', (exception reason). ] ] ]. ^self ! deserializeFile:file | myData myString result out | myData := NSData dataWithContentsOfFile: file. result := NSDeserializer deserializePropertyListFromData: myData mutableContainers: NO. (result isNil) ifTrue: [ Transcript showLine:'Loading \'',file, '\' - nil property list'. ] ifFalse: [ myString := result descriptionWithLocale: locale indent: 0. myData := myString dataUsingEncoding: NSASCIIStringEncoding. out := NSFileHandle fileHandleWithStandardOutput. out writeData: myData; synchronizeFile. ]. ^self ] StepTalk-0.10.0/Examples/Smalltalk/actor.st0000664000175000017500000000257214633027767017612 0ustar yavoryavor| actor engine source method | actor := STActor actorInEnvironment:Environment. "Set ivars" ivars := NSMutableDictionary dictionary. ivars setObject:1 forKey:'number'. actor setInstanceVariables:ivars. " Get the proper engine " engine := STEngine engineForLanguage:'Smalltalk'. " This is the source of new method " source := 'increment number := number + 1. ^self'. " Create method " method := engine methodFromSource:source forReceiver:actor inContext:Environment. " Add the method to the actor " actor addMethod:method. " Add another method with an argument " source := 'setNumber:i number := i. ^self'. method := engine methodFromSource:source forReceiver:actor inContext:Environment. actor addMethod:method. source := 'print Transcript showLine: (\'The number is \', (number description)). ^self'. method := engine methodFromSource:source forReceiver:actor inContext:Environment. actor addMethod:method. " Send it! " actor print. actor increment. actor print. actor increment. actor print. actor setNumber:10. actor print. StepTalk-0.10.0/Examples/Smalltalk/range.st0000664000175000017500000000144114633027767017570 0ustar yavoryavor" Range example " |str substr range| str := 'I like apples and plums.'. Transcript showLine: ('String is : \'', str, '\''). substr := str substringWithRange: (7 <> 5). Transcript showLine: ('Substring at location 7 with length 5 is \'', substr, '\''). range := str rangeOfString: 'tomato'. ((range location) = NSNotFound) ifTrue: [ Transcript showLine: 'Tomato not found' .]. range := str rangeOfString: 'plum'. Transcript showLine: ('Location of \'plum\' is ', ((range location) stringValue), ' and length is ', ((range length) stringValue)). range := ( (range location) <> 5). Transcript showLine: ('Substring with modified range \'', (str substringWithRange:range), '\''). StepTalk-0.10.0/Examples/Smalltalk/listDir.st0000664000175000017500000000200114633027767020077 0ustar yavoryavor" List contents of current directory " " Script variables " | fileManager path files dict | " Get default file manager " fileManager := NSFileManager defaultManager. " Get current path " path := fileManager currentDirectoryPath. " Write label on Transcript (for shell it is standard output) " Transcript showLine:( 'Listing of directory: ', path ). " Get files from 'path' " files := fileManager directoryContentsAtPath:path. " For each file from files do the following ..." files do: [ :file | dict := fileManager fileAttributesAtPath: (path / file) traverseLink:NO. Transcript showLine:file. Transcript showLine: (' Type: ', (dict @ NSFileType)). Transcript showLine: (' Size: ', ((dict @ NSFileSize) stringValue)). Transcript showLine: (' Date: ', ((dict @ NSFileModificationDate) description)). Transcript showLine:'' ] StepTalk-0.10.0/Examples/Smalltalk/math.st0000664000175000017500000000012714633027767017425 0ustar yavoryavor" Smalltalk math example " Transcript show:'1 + 1 = '. Transcript showLine: (1 + 1) StepTalk-0.10.0/Examples/Smalltalk/exception.st0000664000175000017500000000124214633027767020471 0ustar yavoryavor| fileName flag | fileName := '/tmp/TestFile.text'. flag := NO. [ ('This is some file' writeToFile:fileName atomically:NO) ifTrue: [ Transcript showLine:'File was succesfully created.'] ifFalse: [ Transcript showLine:'File was not created.'] ] handler: [ :exception | Transcript showLine:('Handled exception: ',(exception name)). Transcript showLine:('Reason : ',(exception reason)). flag := YES ]. flag ifTrue: [ Transcript showLine:'Finished with exception' ] ifFalse: [ Transcript showLine:'Finished succesfully' ] StepTalk-0.10.0/Examples/Smalltalk/hello.st0000664000175000017500000000056514633027767017605 0ustar yavoryavor" hello Say hello to someone specified as an argument. Ussage: stexec hello.st name " " Is name specified? (Is there some script argument?) " ((Args count) > 0 ) ifTrue: [ " Args is an array of script arguments. " Transcript showLine: ('Hello ', (Args @ 0), '!'). ] ifFalse: [ Transcript showLine:'Hello ... who?' ] StepTalk-0.10.0/Examples/Smalltalk/createFile.st0000664000175000017500000000054514633027767020543 0ustar yavoryavor| fileManager fileName data | fileManager := NSFileManager defaultManager. fileName := '/tmp/TestFile.text'. ('This is some file' writeToFile:fileName atomically:NO) ifTrue: [ Transcript showLine:'File was succesfully created.' ] ifFalse: [ Transcript showLine:'File was not created.' ] StepTalk-0.10.0/Examples/Smalltalk/extern.st0000664000175000017500000000033314633027767020000 0ustar yavoryavor| foo | "foo is local variable" foo := 'Foo'. Transcript showLine:( 'This is foo : ', foo ). " bar is created in environment as extern variable " bar := 'Bar'. Transcript showLine:( 'And this is bar: ', bar ). StepTalk-0.10.0/Examples/Smalltalk/notification.st0000664000175000017500000000117214633027767021163 0ustar yavoryavor" Notification example Show usage of NSNotification class and notification handling in scripts " [| " Main script method " main | center | center := NSNotificationCenter defaultCenter. Transcript showLine:'Registering for notification.'. center addObserver:self selector:#handleNotification: name:'Notification' object:nil. Transcript showLine:'Posting notification.'. center postNotificationName:'Notification' object:nil. ^self ! " Method as notification handler " handleNotification:notif Transcript showLine:'Notification received.'. ^self ] StepTalk-0.10.0/Examples/AppKit/0000775000175000017500000000000014633027767015370 5ustar yavoryavorStepTalk-0.10.0/Examples/AppKit/rtf2text.st0000664000175000017500000000102414633027767017517 0ustar yavoryavor" rtf2text.st Convert RTF document to plain text. ussage: stexec rtf2text infile outfile " | infile outfile rtfString | Environment loadModule:'AppKit'. ((Args count) < 2) ifTrue: [ Transcript showLine:'rtf2text: Please specify input and output filename'. ] ifFalse: [ infile := Args @ 0. outfile := Args @ 1. rtfString := (NSAttributedString alloc) initWithPath:infile documentAttributes:nil. (rtfString string) writeToFile:outfile atomically:YES. ] StepTalk-0.10.0/Examples/AppKit/pb.st0000664000175000017500000000022714633027767016342 0ustar yavoryavor" Print available Pasteboard types " | pb | Environment loadModule:'AppKit'. pb := NSPasteboard generalPasteboard. Transcript showLine: (pb types). StepTalk-0.10.0/Examples/AppKit/panel.st0000664000175000017500000000041114633027767017033 0ustar yavoryavor| app | Environment loadModule:'AppKit'. app := NSApplication sharedApplication. app runAlertPanelWithTitle: 'Test' message: 'Alert panel test' defaultButton: 'OK' alternateButton: nil otherButton: nil. StepTalk-0.10.0/Examples/AppKit/openPanel.st0000664000175000017500000000021014633027767017652 0ustar yavoryavorEnvironment loadModule:'AppKit'. panel := NSOpenPanel openPanel. runResult := panel runModal. Transcript showLine: (panel filename). StepTalk-0.10.0/Examples/AppKit/printers.st0000664000175000017500000000026214633027767017606 0ustar yavoryavor"List all available printers" | printers | Environment loadModule:'AppKit'. printers := NSPrinter printerTypes. printers do: [ :printer | Transcript showLine: printer. ] StepTalk-0.10.0/Examples/AppKit/listFonts.st0000664000175000017500000000154314633027767017730 0ustar yavoryavor" listFonts.st Example that will create a 'rtf file containing smaples of all available fonts. " [| :text main | fontManager | Environment loadModule:'AppKit'. text := NSTextView alloc initWithFrame:NSNullRect. text setRichText:YES. fontManager := NSFontManager sharedFontManager. (fontManager availableFontFamilies) do: [ :font | self addFontSample:font ]. text writeRTFDToFile:'Fonts.rtf' atomically:YES. ^nil ! addFontSample:fontName | attr font | Transcript showLine:fontName. attr := NSMutableDictionary dictionary. font := (NSFont fontWithName:fontName size:36). (font isNil) ifFalse: [ attr setObject:font forKey:NSFontAttributeName. text setTypingAttributes:attr. text insertText:(fontName,'\n'). ]. ^self ] StepTalk-0.10.0/Examples/AppKit/text.st0000664000175000017500000000110714633027767016723 0ustar yavoryavor"NSText test" Environment loadModule:'AppKit'. tattr := NSMutableDictionary dictionary. tattr setObject:(NSFont fontWithName:'Times' size:10) forKey:NSFontAttributeName. hattr := NSMutableDictionary dictionary. hattr setObject:(NSFont fontWithName:'Helvetica' size:10) forKey:NSFontAttributeName. text := NSTextView alloc initWithFrame:NSNullRect. text setRichText:YES. text setTypingAttributes:tattr. text insertText:'This is Times\n'. text setTypingAttributes:hattr. text insertText:'This is Helvetica\n'. text writeRTFDToFile:'Test.rtf' atomically:YES. StepTalk-0.10.0/Examples/ReadMe.txt0000664000175000017500000000231714633027767016101 0ustar yavoryavorSmalltalk examples ------------------ Smalltalk examples are included in Smalltalk directory. math.st Simple example. > stexec math.st hello.st Example to show block closures, symbolic selectors and ussage of arguments. > stexec hello.st > stexec hello.st World createFile.st Try to create a file. Example to show how the restricted scriptiong works. This will work fine: > stexec createFile.st This would not: > stexec --environment Safe createFile.st exception.st Same as createFile.st but handles the exception. This will work fine: > stexec exception.st This will end with handled exception: > stexec --environment Safe exception.st listDir.st List content of current directory. > stexec listDir.st plparse.st, pldes.st GNUstep tools written in smalltalk > stexec plparse.st file1 file2 ... Scriptable server example ------------------------- To compile type > make Then run server > opentool Server Then from same directory, but in another terminal try > stalk Server talkToServer.st > stalk Server talkToServer.st "Hi there!" StepTalk-0.10.0/Examples/Developer/0000775000175000017500000000000014633027767016125 5ustar yavoryavorStepTalk-0.10.0/Examples/Developer/versions.st0000664000175000017500000000164414633027767020352 0ustar yavoryavor" Print versions of all (public) GNUstep classes Use: > stexec versions.st To include AppKit classes: > stexec -environment AppKit versions.st " | classes versions names | classes := Environment objectDictionary allValues. classes := classes select: [ :class | class isClass]. classes := classes select: [ :class | class respondsToSelector:#className]. classes := classes select: [ :class | class respondsToSelector:#version]. versions := NSMutableDictionary dictionary. classes do: [ :class | versions setObject: (class version) forKey: (class className). ]. names := versions allKeys sortedArrayUsingSelector: #compare:. names do: [ :key | Transcript showLine: ( key, ' ', ((versions objectForKey:key) stringValue)) ]. StepTalk-0.10.0/Examples/Developer/StepUnit.st0000664000175000017500000001652114633027767020255 0ustar yavoryavor" @file: StepUnit.st @author: Mateu Batle mateu.batle@tragnarion.com @brief Very simple unit testing framework done in StepTalk for testing Objective C applications @brief $Id$ StepUnit is released under the terms of the LGPL license. (check http://www.gnu.org/licenses/gpl.txt) Help: Testing framework is executed running stexec StepUnit, or directly StepUnit.sh. This script scans the currend diretory recursively and runs every script whose filename matches 'test*.st'. It provides in the environment an object called stepunit which has some useful methods for testing. Here is a list of this methods: - should: val. Tests result of boolean expression which must be true for test ok. - shouldNot: val. Tests result of boolean expression which must be false for test ok. - shouldBeEqual: left to: right. Tests objects are the same. - shouldRaise: exp. Exp must be a block. Runs the block, which must throw exception for test ok. - shouldBeEmpty: object. Object must be nil, or object isEmpty must return true for test ok. - shouldNotBeEmpty: object All methods can be added a 'desc: string' argument, which is recommended to use to identify the test. Each test script just has to run the test code and call the testing methods specified before (on the object stepunit already present in the environment). You should also load modules in the environment to access new classes, etc. if needed (with Environment loadModule: 'modulename'). Test example: res := 2 + 2. stepunit should: (res = 4) desc: '2 + 2 works' " [| :numTestFilesOK :numTestFilesFailed :numTestsFailed :numTestsOK :numTotalFailed :numTotalOK :env :conversation :fm main "*** Initialize counters ***" numTestsFailed := 0. numTestsOK := 0. numTotalFailed := 0. numTotalOK := 0. numTestFilesFailed := 0. numTestFilesOK := 0. "*** Add some classes ***" classes := (NSMutableArray alloc) init. classes += 'STEnvironment'. classes += 'STConversation'. Environment addClassesWithNames: classes. "*** Store object in the environment ***" env := Environment. env setObject: self forName:'stepunit'. env setFullScriptingEnabled: YES. "*** Create conversation ***" conv := STConversation conversationWithContext: env language: 'Smalltalk'. conv setLanguage: 'Smalltalk'. "*** Execute all tests here ***" fm := NSFileManager defaultManager. path := (fm currentDirectoryPath) stringByStandardizingPath. self runTests: path. "*** Summary of running test ***" self showSummary. ^ self ! runTests: path | dirent attr | (((path lastPathComponent) substringToIndex: 1) = '.') ifFalse: [ Transcript showLine: '*** Scanning for tests in directory ', (path), ' ***'. dirent := fm directoryContentsAtPath: path. dirent do: [ :file | attr := fm fileAttributesAtPath: (path / file) traverseLink: NO. filetype := (attr @ 'NSFileType'). (filetype isEqualToString: 'NSFileTypeDirectory') ifTrue: [ fm changeCurrentDirectoryPath: (path / file). self runTests: (path / file). fm changeCurrentDirectoryPath: path. ] ifFalse: [ (((file pathExtension) = 'st') and: ((file lowercaseString) hasPrefix: 'test')) ifTrue: [self executeTest: (path / file)]. ] ]. ^self ] ! executeTest: path numTestsFailed := 0. numTestsOK := 0. Transcript show: '*** Test Case '. Transcript show: (numTestFilesOK + numTestFilesFailed + 1). Transcript showLine: ': ', path, ' start ***'. code := NSString stringWithContentsOfFile: path. res := conv interpretScript: code; result. Transcript showLine: '*** Test Case ', path, ' finish ***'. (numTestsFailed = 0) ifTrue: [ numTestFilesOK := numTestFilesOK + 1. ] ifFalse: [ numTestFilesFailed := numTestFilesFailed + 1. ]. ^self ! showSummary Transcript showLine: '***** SUMMARY *****'. Transcript showLine: 'Name', ' ', 'Failed', ' ', 'OK', ' ', 'Total'. Transcript show: 'Files', ' '. Transcript show: numTestFilesFailed. Transcript show: ' '. Transcript show: numTestFilesOK. Transcript show: ' '. Transcript show: (numTestFilesFailed + numTestFilesOK). Transcript showLine: nil. Transcript show: 'Tests', ' '. Transcript show: numTotalFailed. Transcript show: ' '. Transcript show: numTotalOK. Transcript show: ' '. Transcript show: (numTotalFailed + numTotalOK). Transcript showLine: ''. ^self """ Methods for unit testing """ ! should: val val ifFalse: [self testfail] ifTrue: [self testok]. ^self ! should: val desc: desc val ifFalse: [self testfail: desc] ifTrue: [self testok: desc]. ^self ! shouldNot: val val ifTrue: [self testfail] ifFalse: [self testok]. ^self ! shouldNot: val desc: desc val ifTrue: [self testfail: desc] ifFalse: [self testok: desc]. ^self ! shouldBeEqual: left to: right (left = right) ifFalse: [self testfail] ifTrue: [self testok]. ^self ! shouldBeEqual: left to: right desc: desc (left = right) ifFalse: [self testfail: desc] ifTrue: [self testok: desc]. ^self ! shouldRaise: exp flag := false. desc := 'exception not raised'. exp handler: [ :exception | flag := true. desc := (exception name), ' ', (exception reason). ]. self should: flag desc: desc. ^self ! shouldRaise: exp desc: desc flag := false. desc2 := desc, ' exception not raised'. exp handler: [ :exception | flag := true. desc := desc, ' ', (exception name), ' ', (exception reason). ]. self should: flag desc: desc. ^self ! shouldBeEmpty: object (object = nil) ifFalse: [ (object respondsToSelector: #isEmpty) ifFalse: [self testfail: 'object not responds to isEmpty, assumed not empty'.] ifTrue: [self should: (object isEmpty) desc: 'object empty'.] ] ifTrue: [ self testok: 'object empty' ]. ^self ! shouldBeEmpty: object desc: desc (object = nil) ifFalse: [ (object respondsToSelector: #isEmpty) ifFalse: [self testfail: desc] ifTrue: [self should: (object isEmpty) desc: desc] ] ifTrue: [ self testok: desc ]. ^self ! shouldNotBeEmpty: object (object = nil) ifFalse: [ (object respondsToSelector: #isEmpty) ifFalse: [self testok: 'object not responds to isEmpty, assumed not empty'] ifTrue: [self shouldNot: (object isEmpty) desc: 'object empty'] ] ifTrue: [ self testfail: 'object not empty'. ]. ^self ! shouldNotBeEmpty: object desc: desc (object = nil) ifFalse: [ (object respondsToSelector: #isEmpty) ifFalse: [self testok: desc] ifTrue: [self shouldNot: (object isEmpty) desc: desc]. ] ifTrue: [ self testfail: desc. ]. ^self ! testfail ^ self testfail: 'NO DESCRIPTION' ! testfail: desc numTotalFailed := numTotalFailed + 1. numTestsFailed := numTestsFailed + 1. Transcript showLine: 'TEST FAILED: ', desc. ^nil ! testok ^ self testok: 'NO DESCRIPTION' ! testok: desc numTotalOK := numTotalOK + 1. numTestsOK := numTestsOK + 1. Transcript showLine: 'TEST OK: ', desc. ^ self ] StepTalk-0.10.0/Examples/Shell/0000775000175000017500000000000014633027767015247 5ustar yavoryavorStepTalk-0.10.0/Examples/Shell/AppKit.txt0000664000175000017500000000157114633027767017204 0ustar yavoryavorSimple AppKit Examples ---------------------- To be able to try following examples you have to load the AppKit module: > Environment loadModule: 'AppKit' How to get a filename using the Open panel > NSOpenPanel openPanel runModal ; filename Applications and files ---------------------- > Workspace := NSWorkspace sharedWorkspace How to launch an application > Workspace launchApplication:'application name' How to open a file > Workspace openFile:'file name' How to open a file with specified application > Workspace openFile:'file name' withApplication:'application name' How to open a file using the open panel > Workspace openFile:(NSOpenPanel openPanel runModal ; filename) Text ---- How to display a RTF file > text := NSAttributedString alloc > text initWithPath: file documentAttributes:nil > Transcript show: (text string) StepTalk-0.10.0/Examples/Shell/ChangeLog0000664000175000017500000000364414633027767017030 0ustar yavoryavor2013-03-23 Wolfgang Lux * STShell.m (-initWithConversation:): Check the result of the super class initializer and assign it to self. * stshell_tool.m (-run, main): Fix minor space leaks. 2012-01-15 Wolfgang Lux * STShell.h: * STShell.m: * STShell+output.m: Miscellaneous changes to shut down compiler warnings. 2005 Aug 30 * use STLanguageManager instead of removed STLanguage 2005 Aug 15 * Added distant environments * Removed named objects as they were causing troubles with distant environments * Suspend completion for distant environments Warning: option 'environment' has different meaning. See stshell --help. 2003 Sep 21 * Added named objects FileManager, LastCommand and LastObject 2003 Jun 19 * Renamed stshell.m to stshell_tool.m. MS Windows was causing problems with case insensitive file system. (Reported by Michael Adams ) 2003 Apr 04 David Ayers * GNUmakefile: Added flags to show all warnings except for import. * STShell.m: Unified name for private categories. 2003 Jan 16 Stefan Urbanek * GNUmakefile: Added -lncurses 2002 Jun 21 Stefan Urbanek * Added executeScriptNamed: 2002 Jun 8 Stefan Urbanek * Reflect STEnvironment changes * Removed loading of Foundation module as this is handleb by the STEnvironment 2002 Jun 7 Stefan Urbanek * Changed printing of result object (handle arrays, dictionaries and sets different way) 2002 Jun 6 Stefan Urbanek * Update completition list lazily (only when needed) 2002 Jun 4 Stefan Urbanek * add DistributedFinder object finder to the environment 2002 May 30 Stefan Urbanek * added Environment object. StepTalk-0.10.0/Examples/Shell/GNUmakefile0000664000175000017500000000217514633027767017326 0ustar yavoryavor# # StepTalk tools # # Copyright (C) 2002 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 TOOL_NAME = stshell stshell_OBJC_FILES = STShell.m STShell+output.m stshell_tool.m ADDITIONAL_TOOL_LIBS += -lStepTalk -lreadline -lncurses ADDITIONAL_OBJCFLAGS = -Wall -Wno-import -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/tool.make -include GNUMakefile.postamble StepTalk-0.10.0/Examples/Shell/Unix.txt0000664000175000017500000000716614633027767016745 0ustar yavoryavorUnix shell equivalents ---------------------- StepTalk is not meant to be used for tasks that can be done using ordinary Unix shells. But this does not mean, that it cannot be used for such tasks. In this file you may find list of unix commands and tasks and their Smalltalk equivalents. Contents: File Manipulation Output Paths and filenames Network Math Date and Time File manipulation ----------------- > fm := NSFileManager defaultManager ls > (fm directoryContentsAtPath: '.') sortedArrayUsingSelector:#compare: pwd > fm currentDirectoryPath cd path > fm changeCurrentDirectoryPath: 'path' ln -s path other > fm createSymbolicLinkAtPath:'path' pathContent:'other' cp src dest > fm copyPath:'src' toPath:'dest' handler: nil cp file_list dest > file_list do: [ :file | fm copyPath:file toPath:'dest' handler: nil ] mv - as cp, movePath:toPath:handler: ln - as cp, linkPath:toPath:handler: rm - removeFileAtPath:handler: mkdir dir > fm createDirectoryAtPath:'dir' attributes:nil df path > fm fileSystemAttributesAtPath:'path' Output ------ echo 'string' > Transcript show:'string' cat file > Transcript show: (NSString stringWithContentsOfFile:'file') "write a string to a file" > ('string' writeToFile:'file' atomically:YES) "create a string from a file" > str := NSString stringWithContentsOfFile:'file' Paths and filenames -------------------------------- For more information, refer to the NSString documentation. NSString methods for path manipulation: - fileSystemRepresentation - isAbsolutePath - pathComponents - lastPathComponent - pathExtension - stringByAbbreviatingWithTildeInPath - stringByAppendingPathComponent: - stringByAppendingPathExtension: - stringByDeletingLastPathComponent - stringByDeletingPathExtension - stringByExpandingTildeInPath - stringByResolvingSymlinksInPath - stringByStandardizingPath - stringsByAppendingPaths: Examples: > path := '/usr/GNUstep/System/Applications/Ink.app' > path pathComponents (?) GSArray 0 / 1 usr 2 GNUstep 3 System 4 Applications 5 Ink.app > path lastPathComponent (?) Ink.app > path pathExtension (?) app In Smalltalk there is a symbolic selector '/' for NSString that is equivalent to the 'stringByAppendingPathComponent:'. > path := 'somePath' > filename := 'someFilename' > fullPath := path / filename Network ------- localhost > NSHost currentHost name nslookup host_name > (NSHost hostWithName:'host_name') addresses nslookup host_address > (NSHost hostWithAddress:'host_address') names "download a file from the web" > data := NSData dataWithContentsOfURL:'url' > data writeToFile:'file' atomically:YES "read a file from the web" > string := NSString stringWithContentsOfURL:'url' Math ---- Just like in: > 1 + 1 or in: > a := b * c Date and Time ------------- date > NSDate date ...or... date > NSCalendarDate date For more information read the NSDate and NSCalendarDate documentation NSCalendarDate methods: Creating a date + calendarDate + dateWithString:calendarFormat: + dateWithString:calendarFormat:locale: + dateWithYear:month:day:hour:minute:second:timeZone: Retrieving date elements - dayOfCommonEra - dayOfMonth - dayOfWeek - dayOfYear - hourOfDay - minuteOfHour - monthOfYear - secondOfMinute - yearOfCommonEra Adjusting a date - dateByAddingYears:months:days:hours:minutes:seconds: StepTalk-0.10.0/Examples/Shell/.cvsignore0000664000175000017500000000010514633027767017243 0ustar yavoryavor*.app *.debug *.profile shared_*obj *.bundle *.stmodule *.stlanguage StepTalk-0.10.0/Examples/Shell/STShell+output.m0000664000175000017500000001043514633027767020302 0ustar yavoryavor/** STShell+output Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2002 Jun 7 This file is part of the StepTalk project. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02111, USA. */ #import "STShell.h" #import #import #import #import #import #import #import #import #import #import #include @implementation STShell(STShellOutput) - show:(id)anObject { printf("%s", [[anObject description] cString]); return self; } - showLine:(id)anObject { [self show:anObject]; putchar('\n'); return nil; } - (void)showError:(NSString *)errString { fprintf(stderr, "%s\n\n", [errString cString]); } - showResult:(id)obj { const char *className = [NSStringFromClass([obj class]) cString]; NSInteger objIndex = [objectStack count] - 1; NSUInteger i; if(obj) { if([obj isKindOfClass:[NSArray class]]) { printf("(%li) %s\n", (long)objIndex, className); for(i = 0;i<[obj count]; i++) { printf("%lu %s\n", (unsigned long)i, [self displayCStringForObject:[obj objectAtIndex:i]]); } } else if([obj isKindOfClass:[NSSet class]]) { printf("(%li) %s\n", (long)objIndex, className); obj = [[obj allObjects] sortedArrayUsingSelector:@selector(compare:)]; for(i = 0;i<[obj count]; i++) { printf("%s\n", [self displayCStringForObject:[obj objectAtIndex:i]]); } } else if([obj isKindOfClass:[NSDictionary class]]) { NSString *key; NSArray *keys; printf("(%li) %s\n", (long)objIndex, className); keys = [[obj allKeys] sortedArrayUsingSelector:@selector(compare:)]; for(i = 0;i<[keys count]; i++) { key = [keys objectAtIndex:i]; printf("%s : %s\n", [self displayCStringForObject:key], [self displayCStringForObject:[obj objectForKey:key]]); } } else { printf("(%li) %s\n", (long)objIndex, [self displayCStringForObject:obj]); } } return self; } - (const char *)displayCStringForObject:(id)object { NSString *str = [object description]; if( [str length] > 60 ) { str = [str substringToIndex:60]; str = [str stringByAppendingString:@"..."]; } return [str cString]; } - showException:(NSException *)exception { printf("Error (%s): %s\n", [[exception name] cString], [[exception reason] cString]); return self; } - (id)listObjects { NSString *str; NSUInteger i; id object; printf("Objects\n"); for(i = 0; i < [objectStack count]; i++) { object = [objectStack objectAtIndex:i]; str = [object description]; if( [str length] > 60 ) { str = [str substringToIndex:60]; str = [str stringByAppendingString:@"..."]; } printf("%4lu: '%s' (%s)\n", (unsigned long)i, [str cString], [[[object class] description] cString]); } return nil; } @end StepTalk-0.10.0/Examples/Shell/stshell_tool.m0000664000175000017500000001517214633027767020146 0ustar yavoryavor/** stshell StepTalk Shell Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2002 May 29 This file is part of the StepTalk project. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02111, USA. */ #import #import "STShell.h" #import #import #import #import #import #import @interface STShellTool:NSObject { STConversation *conversation; NSArray *arguments; NSUInteger currentArg; NSString *environmentName; NSString *hostName; NSString *typeName; NSString *languageName; } - (int)parseArguments; - (NSString *)nextArgument; - (void)reuseArgument; - (void)run; - (void)printHelp; @end @implementation STShellTool - (int)parseArguments { NSString *arg; BOOL isOption = NO; arguments = [[NSProcessInfo processInfo] arguments]; [self nextArgument]; while( (arg = [self nextArgument]) ) { isOption = NO; if( [arg hasPrefix:@"--"] ) { arg = [arg substringFromIndex:2]; isOption = YES; } else if( [arg hasPrefix:@"-"] ) { arg = [arg substringFromIndex:1]; isOption = YES; } if ([@"help" hasPrefix:arg]) { [self printHelp]; return 1; } else if ([@"language" hasPrefix:arg]) { RELEASE(languageName); languageName = [self nextArgument]; if(!languageName) { [NSException raise:@"STShellToolException" format:@"Language name expected"]; } } else if ([@"environment" hasPrefix:arg]) { RELEASE(environmentName); environmentName = [self nextArgument]; if(!environmentName) { [NSException raise:@"STShellToolException" format:@"Environment name expected"]; } } else if ([@"host" hasPrefix:arg]) { RELEASE(hostName); hostName = [self nextArgument]; if(!hostName) { [NSException raise:@"STShellToolException" format:@"Host name expected"]; } } else if ([@"type" hasPrefix:arg]) { RELEASE(typeName); typeName = [self nextArgument]; if(!typeName) { [NSException raise:@"STShellToolException" format:@"Environment description (type) name expected"]; } } else if(!isOption) { break; } } if(arg) { [self reuseArgument]; } return 0; } - (NSString *)nextArgument { if(currentArg < [arguments count]) { return [arguments objectAtIndex:currentArg++]; } return nil; } - (void)reuseArgument { currentArg--; } /* Method taken from stexec.m - look there for updates */ - (void)createConversation { STEnvironmentDescription *desc; STEnvironment *environment; if(environmentName) { /* user wants to connect to a distant environment */ conversation = [[STRemoteConversation alloc] initWithEnvironmentName:environmentName host:hostName language:languageName]; if(!conversation) { NSLog(@"Unable to connect to %@@%@", environmentName, hostName); return; } } else { /* User wants local temporary environment */ if(!typeName || [typeName isEqualToString:@""]) { environment = [STEnvironment environmentWithDefaultDescription]; } else { desc = [STEnvironmentDescription descriptionWithName:typeName]; environment = [STEnvironment environmentWithDescription:desc]; } /* Register basic objects: Environment, Transcript */ [environment setObject:environment forName:@"Environment"]; [environment loadModule:@"SimpleTranscript"]; [environment setCreatesUnknownObjects:YES]; /* FIXME: make this an option */ [environment setFullScriptingEnabled:YES]; conversation = [[STConversation alloc] initWithContext:environment language:languageName]; } } - (void)run { STShell *shell; [self parseArguments]; [self createConversation]; if(!languageName || [languageName isEqualToString:@""]) { languageName = [[STLanguageManager defaultManager] defaultLanguage]; } [conversation setLanguage:languageName]; shell = [[STShell alloc] initWithConversation:conversation]; [shell run]; NSDebugLog(@"Exiting StepTalk shell"); RELEASE(shell); } - (void)printHelp { NSProcessInfo *info = [NSProcessInfo processInfo]; printf("%s - StepTalk shell\n" "Usage: %s [options]\n\n" "Options are:\n" " -help this text\n" " -language lang use language lang\n" " -environment env use scripting environment with name env\n" " -host host find environment on host\n" " -type desc use environment description with name 'desc'\n", [[info processName] cString],[[info processName] cString] ); } @end int main(int argc, const char **argv) { NSAutoreleasePool *pool; STShellTool *tool; pool = [NSAutoreleasePool new]; tool = [[STShellTool alloc] init]; [tool run]; RELEASE(tool); RELEASE(pool); return 0; } StepTalk-0.10.0/Examples/Shell/STShell.h0000664000175000017500000000350114633027767016735 0ustar yavoryavor/** STShell StepTalk Shell Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2002 May 29 This file is part of the StepTalk project. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02111, USA. */ #import @class STConversation; @class STEnvironment; @class STScriptsManager; @class NSMutableArray; @class NSException; @interface STShell:NSObject { STScriptsManager *scriptsManager; STConversation *conversation; NSString *prompt; NSString *source; NSMutableArray *objectStack; BOOL exitRequest; BOOL updateCompletionList; NSArray *completionList; BOOL completionEnabled; } - initWithConversation:(STConversation *)conv; - (void)setLanguage:(NSString *)langName; - (void)run; - (id)executeLine:(NSString *)line; @end @interface STShell(STShellOutput) - show:(id)anObject; - showLine:(id)anObject; - showResult:(id)obj; - (void)showError:(NSString *)errString; - (const char *)displayCStringForObject:(id)object; - showException:(NSException *)exception; - (id)listObjects; @end StepTalk-0.10.0/Examples/Shell/STShell.m0000664000175000017500000002055114633027767016746 0ustar yavoryavor/** STShell StepTalk Shell Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2002 May 29 This file is part of the StepTalk project. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02111, USA. */ #import "STShell.h" #import #import #import #import #import #import #import #import #import #import #include #include static Class NSString_class; static Class NSNumber_class; NSArray *objcSelectors = nil; static STShell *sharedShell = nil; @interface STShell(STPrivateMethods) - (int) completion; - (NSString *)readLine; - (void)initReadline; @end int complete_handler(int count, int key) { return [sharedShell completion]; } @implementation STShell + (void)initialize { NSString_class = [NSString class]; NSNumber_class = [NSNumber class]; } + sharedShell { return sharedShell; } - initWithConversation:(STConversation *)conv { if ((self = [super init]) != nil) { [self initReadline]; objectStack = [[NSMutableArray alloc] init]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(bundleLoaded:) name:NSBundleDidLoadNotification object:nil]; scriptsManager = RETAIN([STScriptsManager defaultManager]); prompt = @"StepTalk > "; conversation = RETAIN(conv); /* FIXME: make this more clever for completion handler */ if(!sharedShell) { sharedShell = self; } } return self; } - (void)updateCompletionList { NSMutableArray *array = [[NSMutableArray alloc] init]; RELEASE(completionList); [array addObjectsFromArray:STAllObjectiveCSelectors()]; completionList = [[NSArray alloc] initWithArray:array]; updateCompletionList = NO; } - (void)dealloc { RELEASE(objectStack); RELEASE(completionList); RELEASE(scriptsManager); RELEASE(conversation); [[NSNotificationCenter defaultCenter] removeObserver:self]; [super dealloc]; } -(void)bundleLoaded:(NSNotification *)notif { updateCompletionList = YES; } - (void)initReadline { rl_initialize(); rl_bind_key('\t', complete_handler); } - (void)setLanguage:(NSString *)langName { NSDebugLog(@"Setting language to %@", langName); [conversation setLanguage:langName]; } - (void)run { NSString *line; id result; [self showLine:@"Welcome to the StepTalk shell."]; // NSLog(@"Environment %@", env); if(![conversation isKindOfClass:[STRemoteConversation class]]) { completionEnabled = YES; } else { [self showLine:@"Note: Completion disabled for distant conversation"]; } while(1) { line = [self readLine]; if(exitRequest) break; if(!line) continue; result = [self executeLine:line]; if(result) { if(result != objectStack) { [objectStack addObject:result]; } [self showResult:result]; } else { [self showResult:result]; } } printf("\n"); } - (id)executeLine:(NSString *)line { NSString *cmd; id result = nil; /* FIXME: why? */ cmd = [line stringByAppendingString:@" "]; NS_DURING [conversation interpretScript:cmd]; result = [conversation result]; NS_HANDLER [self showException:localException]; NS_ENDHANDLER return result; } - (NSString *)readLine { char *str; NSString *actualPrompt = prompt; NSString *line = @""; BOOL done = NO; int len; while(!done) { str = readline([actualPrompt cString]); done = YES; if(!str) { exitRequest = YES; return nil; } len = strlen(str); if(!len) return nil; if(str[len-1] == '\\') { actualPrompt = @"... ? "; str[strlen(str) - 1] = '\0'; done = NO; } line = [line stringByAppendingString:[NSString stringWithCString:str]]; } add_history([line cString]); return line; } - (int)completion { STContext *context; NSEnumerator *enumerator; NSMutableSet *set; NSString *match; NSString *tail; NSString *str; NSArray *array; int pos = 0; int c; if(!completionEnabled) { return 0; } if(rl_point <= 0) { return 0; } pos = rl_point - 1; c = rl_line_buffer[pos]; while((isalnum(c) || c == '_') && pos >= 0) { pos--; c = rl_line_buffer[pos]; } pos++; match = [NSString stringWithCString:rl_line_buffer + pos length:rl_point - pos]; set = [NSMutableSet set]; if(!completionList || updateCompletionList) { [self updateCompletionList]; } enumerator = [completionList objectEnumerator]; while( (str = [enumerator nextObject]) ) { if( [str hasPrefix:match] ) { [set addObject:str]; } } context = [conversation context]; enumerator = [[context knownObjectNames] objectEnumerator]; while( (str = [enumerator nextObject]) ) { if( [str hasPrefix:match] ) { [set addObject:str]; } } array = [set allObjects]; if( [array count] == 0 ) { printf("\nNo match for completion.\n"); rl_forced_update_display(); } else if ( [array count] == 1 ) { str = [array objectAtIndex:0]; str = [str substringFromIndex:rl_point - pos]; rl_insert_text([str cString]); rl_insert_text(" "); rl_redisplay(); } else { enumerator = [array objectEnumerator]; tail = [enumerator nextObject]; while( (str = [enumerator nextObject]) ) { tail = [str commonPrefixWithString:tail options:NSLiteralSearch]; } tail = [tail substringFromIndex:[match length]]; if( tail && ![tail isEqualToString:@""] ) { rl_insert_text([tail cString]); rl_redisplay(); } else { printf("\n"); enumerator = [array objectEnumerator]; while( (str = [enumerator nextObject]) ) { printf("%s\n", [str cString]); } rl_forced_update_display(); } } return 0; } - (void)exit { /* FIXME: this is not nice */ exit(0); } - (id)executeScriptNamed:(NSString *)scriptName { STFileScript *script = [scriptsManager scriptWithName:scriptName]; id result = nil; if(!script) { [self showError:[NSString stringWithFormat: @"Unable to find script with name '%@'", scriptName]]; } else { NS_DURING result = [conversation runScriptFromString:[script source]]; NS_HANDLER [self showException:localException]; NS_ENDHANDLER } return result; } - (void)setPrompt:(NSString *)aString { ASSIGN(prompt, aString); } - (NSString *)prompt { return prompt; } @end StepTalk-0.10.0/Examples/Shell/README0000664000175000017500000000421514633027767016131 0ustar yavoryavorstshell ------- Author: Stefan Urbanek What is stshell? ----------------- StepTalk Shell is an interactive tool for communicating with objects. Features -------- - GNUstep classes and objects - command-line editing - TAB completition of named objects and selectors For more information read included *.txt files. Installation ------------ Requirements: StepTalk and the readline library (development files) > make > make install Running ------- To run stshell with default language, run just > stshell If you would like to use another language, then use > stshell -language AnotherLanguage To use AppKit > stshell -environment AppKit To use it as a distributed objects 'glue' > stshell -environment Distributed The shell will greet you with 'Welcome to the StepTalk shell.' message. Welcome to the StepTalk shell. StepTalk > _ Now you may write statements in the language you have specified. StepTalk > Transcript showLine:'Current date is ', ((NSDate date) description) If the line is too long, then you may use the backslash '\' character at the end of the line to continue on the next line. StepTalk > Transcript showLine:'Current date is ', \ ... ? ((NSDate date) description) Objects history array --------------------- All results from the expressions are stored in the 'Objects' array. The example above can be written in more steps: StepTalk > ((NSDate date) description) 0: 2002-05-29 22:41:57 +0200 StepTalk > 'Current date is ', (Objects @ 0) 1: Current date is 2002-05-29 22:41:57 +0200 StepTalk > Transcript showLine: (Objects @ 1) Current date is 2002-05-29 22:41:57 +0200 To show all objects type: StepTalk > Shell listObjects Objects 0: '2002-05-29 22:41:57 +0200' (GSCInlineString) 1: 'Current date is 2002-05-29 22:41:57 +020...' (GSUnicodeString) TAB completition ---------------- Here is an example of TAB completition. StepTalk > Tr showL:'Current date is ', ((NSDate date) desci) Feedback -------- Any questions, comments and bug reports are velcome at urbanek@host.sk StepTalk-0.10.0/Documentation/0000775000175000017500000000000014633027767015233 5ustar yavoryavorStepTalk-0.10.0/Documentation/TroubleShooting.txt0000664000175000017500000000130214633027767021117 0ustar yavoryavorTrouble Shooting ---------------- - Language of a script cannot be recognized. - It is not possible to see some scripts in the scripts panel. StepTalk is trying to determine script language by the file extension. Each language has a extension list of files which contain scripts in that language. To prevend expensive searching for file extensions in languages, StepTalk uses a dictionary with file-language mapping. That dictionary is stored in ~/Library/StepTalk/Configuration and is created first time you use some StepTalk tool. If you install new language, that file has to be updated. Solution: Run in terminal: > stupdate_languages StepTalk-0.10.0/Documentation/Tools.txt0000664000175000017500000000254114633027767017076 0ustar yavoryavorStepTalk Tools Contents: stexec stshell (from Examples directory) ------------------------------------------------------------------------------ stexec - execute StepTalk script (in GNUstep-base environment) Usage: stexec [options] script [args ...] [ , script ...] Options: -help print this message -list-all-objects list all available objects -list-classes list available classes -list-objects list named instances -language lang force use of language lang -list-languages list available languages -continue do not stop when one of scripts failed to execute -full enable full scripting -environment env use scripting environment with name env (You do not have to specify full name of the option (for example, -env), but when it is not clear, the behaviour is undefined) Examples: > stexec myScript.st > stexec -env AppKit myAppKitScript.st Running more than one script (preserves the environment through all scripts) > stexec myScript1.st , myScript2.st , myScript3.st ------------------------------------------------------------------------------ stshell - StepTalk shell Usage: stshell [options] script Options are: -help this text -language lang use language lang -environment env use scripting environment with name env StepTalk-0.10.0/Documentation/Use.txt0000664000175000017500000000063314633027767016532 0ustar yavoryavorPossible use of StepTalk ------------------------ StepTalk Shell -------------- - interactive communication with remote objects for example i am using it for writing simple tests or for playing with gnustep classes moreover, the steptalk shell can be used for gnustep-novices to learn about gnustep-classes and their behavior or, as i am using it, to communicate interactively with an distant object StepTalk-0.10.0/Documentation/DevelopmentNotes.txt0000664000175000017500000000066714633027767021300 0ustar yavoryavorDevelopment Notes ----------------- This document contains information about StepTalk development. Directory structure ------------------- Directory structure needs to be changed to: / /Documentation /Examples /Source /Applications /Frameworks /StepTalk /ApplicationScripting /Languages /Modules /Tools /Support /ApplicationScripting /Testing StepTalk-0.10.0/Documentation/Additions.txt0000664000175000017500000000127614633027767017720 0ustar yavoryavorGNUstep/Cocoa classes additions ------------------------------- NSFileManager + (NSString *)homeDirectory + (NSString *)homeDirectoryForUser:(NSString *)user + (NSString *)openStepRootDirectory + (NSArray *)searchPathForDirectories:(int)dir inDomains:(int)domainMask expandTilde:(BOOL)flag + (NSArray *)searchPathForDirectories:(int)dir inDomains:(int)domainMask + (NSString *)temporaryDirectory + (NSArray *)standardLibraryPaths Example: NSFileManager searchPathForDirectories:NSLibraryDirectory inDomains:(NSUserDomainMask or: NSLocalDomainMask) StepTalk-0.10.0/Documentation/Reference/0000775000175000017500000000000014633027767017131 5ustar yavoryavorStepTalk-0.10.0/Documentation/Reference/STActor.html0000664000175000017500000001411414633027767021337 0ustar yavoryavor STActor class documentation Up

STActor class documentation

Authors

Stefan Urbanek

Copyright: (C) 2002 Free Software Foundation

Software documentation for the STActor class

STActor : NSObject

Declared in:
StepTalk/STActor.h
Conforms to:
NSCoding

Description forthcoming.


Instance Variables

Method summary

actorInEnvironment: 

+ (id) actorInEnvironment: (STEnvironment*)env;

Return new instance of script object without any instance variables


addMethod: 

- (void) addMethod: (id<STMethod>)aMethod;

Description forthcoming.


environment 

- (STEnvironment*) environment;

Description forthcoming.


initWithEnvironment: 

- (id) initWithEnvironment: (STEnvironment*)env;

Description forthcoming.


methodDictionary 

- (NSDictionary*) methodDictionary;

Description forthcoming.


methodNames 

- (NSArray*) methodNames;

Description forthcoming.


methodWithName: 

- (id<STMethod>) methodWithName: (NSString*)aName;

Description forthcoming.


removeMethod: 

- (void) removeMethod: (id<STMethod>)aMethod;

Description forthcoming.


removeMethodWithName: 

- (void) removeMethodWithName: (NSString*)aName;

Description forthcoming.


setEnvironment: 

- (void) setEnvironment: (STEnvironment*)env;

Set object's environment. Note: This method should be replaced by some other, more clever mechanism.




Instance Variables for STActor Class

environment

@protected STEnvironment* environment;

Description forthcoming.


ivars

@protected NSMutableDictionary* ivars;

Description forthcoming.


methodDictionary

@protected NSMutableDictionary* methodDictionary;

Description forthcoming.






Up
StepTalk-0.10.0/Documentation/Reference/STFileScript.html0000664000175000017500000001202614633027767022333 0ustar yavoryavor STFileScript class documentation Up

STFileScript class documentation

Authors

Stefan Urbanek (stefanurbanek@yahoo.fr)

Copyright: (C) 2002 Stefan Urbanek

Software documentation for the STFileScript class

STFileScript : STScript

Declared in:
StepTalk/STFileScript.h

Description forthcoming.


Instance Variables

Method summary

scriptWithFile: 

+ (id) scriptWithFile: (NSString*)file;

Description forthcoming.


compareByLocalizedName: 

- (NSComparisonResult) compareByLocalizedName: (STFileScript*)aScript;

Compare scripts by localized name.


fileName 

- (NSString*) fileName;

Return file name of the receiver.


initWithFile: 

- (id) initWithFile: (NSString*)aFile;

Create a new script from file aFile>. Script information will be read from 'aFile.stinfo' file containing a dictionary property list.


localizedName 

- (NSString*) localizedName;

Returns localized name of the receiver script.


scriptDescription 

- (NSString*) scriptDescription;

Returns localized description of the script.


scriptName 

- (NSString*) scriptName;

Returns a script name by which the script is identified




Instance Variables for STFileScript Class

description

@protected NSString* description;

Description forthcoming.


fileName

@protected NSString* fileName;

Description forthcoming.


localizedName

@protected NSString* localizedName;

Description forthcoming.


menuKey

@protected NSString* menuKey;

Description forthcoming.






Up
StepTalk-0.10.0/Documentation/Reference/STScript.html0000664000175000017500000000751714633027767021544 0ustar yavoryavor STScript class documentation Up

STScript class documentation

Authors

Stefan Urbanek (stefanurbanek@yahoo.fr)

Copyright: (C) 2002 Stefan Urbanek

Software documentation for the STScript class

STScript : NSObject

Declared in:
StepTalk/STScript.h

Description forthcoming.


Instance Variables

Method summary

scriptWithSource: language: 

+ (id) scriptWithSource: (NSString*)aString language: (NSString*)lang;

Description forthcoming.


initWithSource: language: 

- (id) initWithSource: (NSString*)aString language: (NSString*)lang;

Description forthcoming.


language 

- (NSString*) language;

Returns language of the script.


setLanguage: 

- (void) setLanguage: (NSString*)name;

Set language of the script.


setSource: 

- (void) setSource: (NSString*)aString;

Description forthcoming.


source 

- (NSString*) source;

Description forthcoming.




Instance Variables for STScript Class

language

@protected NSString* language;

Description forthcoming.


source

@protected NSString* source;

Description forthcoming.






Up
StepTalk-0.10.0/Documentation/Reference/STRemoteConversation.html0000664000175000017500000001233414633027767024117 0ustar yavoryavor STRemoteConversation class documentation Up

STRemoteConversation class documentation

Authors

Stefan Urbanek

Copyright: (C) 2002 Free Software Foundation

Software documentation for the STRemoteConversation class

STRemoteConversation : STConversation

Declared in:
StepTalk/STRemoteConversation.h

Description forthcoming.


Instance Variables

Method summary

close 

- (void) close;

Description forthcoming.


initWithEnvironmentName: host: language: 

- (id) initWithEnvironmentName: (NSString*)envName host: (NSString*)host language: (NSString*)langName;

Description forthcoming.


open 

- (void) open;

Description forthcoming.




Instance Variables for STRemoteConversation Class

connection

@protected NSConnection* connection;

Description forthcoming.


environmentName

@protected NSString* environmentName;

Description forthcoming.


environmentProcess

@protected NSDistantObject* environmentProcess;

Description forthcoming.


hostName

@protected NSString* hostName;

Description forthcoming.


proxy

@protected NSDistantObject* proxy;

Description forthcoming.





Software documentation for the STEnvironmentProcess protocol

STEnvironmentProcess

Declared in:
StepTalk/STRemoteConversation.h

Description forthcoming.

Method summary

createConversation 

- (STConversation*) createConversation;

Description forthcoming.



Up
StepTalk-0.10.0/Documentation/Reference/STConversation.gsdoc0000664000175000017500000000761614633027767023105 0ustar yavoryavor STConversation class documentation 2002 Free Software Foundation Software documentation for the STConversation class StepTalk/STConversation.h STConversation Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. context Description forthcoming. initWithContext: aContext language: aLanguage Description forthcoming. language Return name of the language used in the receiver conversation runScriptFromString: aString Description forthcoming. setLanguage: newLanguage Description forthcoming. Software documentation for the STConversation protocol StepTalk/STConversation.h Description forthcoming. interpretScript: aString Interpret given string as a script in the receiver environment. knownLanguages Description forthcoming. language Description forthcoming. result Description forthcoming. resultByCopy Description forthcoming. setLanguage: newLanguage Set language for the receiver. StepTalk-0.10.0/Documentation/Reference/NSObject+additions.gsdoc0000664000175000017500000000234114633027767023573 0ustar yavoryavor NSObject+additions documentation 2002 Free Software Foundation Software documentation for the NSObject(STAdditions) category StepTalk/NSObject+additions.h Description forthcoming. isNil Description forthcoming. isSame: anObject Description forthcoming. notNil Description forthcoming. StepTalk-0.10.0/Documentation/Reference/NSObject+additions.html0000664000175000017500000000377014633027767023447 0ustar yavoryavor NSObject+additions documentation Up

NSObject+additions documentation

Authors

Generated by stevko

Copyright: (C) 2002 Free Software Foundation

Software documentation for the NSObject(STAdditions) category

NSObject(STAdditions)

Declared in:
StepTalk/NSObject+additions.h

Description forthcoming.

Method summary

isNil 

- (BOOL) isNil;

Description forthcoming.


isSame: 

- (BOOL) isSame: (id)anObject;

Description forthcoming.


notNil 

- (BOOL) notNil;

Description forthcoming.



Up
StepTalk-0.10.0/Documentation/Reference/STFunctions.html0000664000175000017500000000253114633027767022237 0ustar yavoryavor STFunctions documentation Up

STFunctions documentation

Authors

Stefan Urbanek

Copyright: (C) 2002 Free Software Foundation

STFunctions functions

STFindAllResources

NSArray* STFindAllResources(NSString* resourceDir, NSString* extension);

Description forthcoming.


STFindResource

NSString* STFindResource(NSString* name, NSString* resourceDir, NSString* extension);

Description forthcoming.


STUserConfigPath

NSString* STUserConfigPath();

Description forthcoming.



Up
StepTalk-0.10.0/Documentation/Reference/STExterns.html0000664000175000017500000001047614633027767021726 0ustar yavoryavor STExterns documentation Up

STExterns documentation

Authors

Stefan Urbanek

Copyright: (C) 2002 Free Software Foundation

STExterns variables

STGenericException

NSString* STGenericException;

Description forthcoming.


STInternalInconsistencyException

NSString* STInternalInconsistencyException;

Description forthcoming.


STInvalidArgumentException

NSString* STInvalidArgumentException;

Description forthcoming.


STLanguageBundleExtension

NSString* STLanguageBundleExtension;

Description forthcoming.


STLanguageBundlesDirectory

NSString* STLanguageBundlesDirectory;

Description forthcoming.


STLanguagesConfigFile

NSString* STLanguagesConfigFile;

Description forthcoming.


STLibraryDirectory

NSString* STLibraryDirectory;

Description forthcoming.


STMallocZone

NSZone* STMallocZone;

Description forthcoming.


STModuleExtension

NSString* STModuleExtension;

Description forthcoming.


STModulesDirectory

NSString* STModulesDirectory;

Description forthcoming.


STNil

STUndefinedObject* STNil;

Description forthcoming.


STScriptExtension

NSString* STScriptExtension;

Description forthcoming.


STScriptingEnvironmentExtension

NSString* STScriptingEnvironmentExtension;

Description forthcoming.


STScriptingEnvironmentsDirectory

NSString* STScriptingEnvironmentsDirectory;

Description forthcoming.


STScriptingException

NSString* STScriptingException;

Description forthcoming.


STScriptsDirectory

NSString* STScriptsDirectory;

Description forthcoming.



Up
StepTalk-0.10.0/Documentation/Reference/NSInvocation+additions.gsdoc0000664000175000017500000000522314633027767024500 0ustar yavoryavor NSInvocation class additions 2002 Free Software Foundation Software documentation for the NSInvocation(STAdditions) category StepTalk/NSInvocation+additions.h Description forthcoming. invocationWithTarget: target selector: selector Description forthcoming. invocationWithTarget: target selectorName: selectorName Description forthcoming. getArgumentAsObjectAtIndex: anIndex Description forthcoming. returnValueAsObject Description forthcoming. setArgumentAsObject: anObject atIndex: anIndex Description forthcoming. NSInvocation+additions functions

value type anObject Description forthcoming. value type This method is a factory method, that means that you have to release the object when you no longer need it.
StepTalk-0.10.0/Documentation/Reference/STConversation.html0000664000175000017500000001651614633027767022751 0ustar yavoryavor STConversation class documentation Up

STConversation class documentation

Authors

Stefan Urbanek

Copyright: (C) 2002 Free Software Foundation

Software documentation for the STConversation class

STConversation : NSObject

Declared in:
StepTalk/STConversation.h
Conforms to:
STConversation

Description forthcoming.


Instance Variables

Method summary

context 

- (STContext*) context;

Description forthcoming.


initWithContext: language: 

- (id) initWithContext: (STContext*)aContext language: (NSString*)aLanguage;

Description forthcoming.


language 

- (NSString*) language;

Return name of the language used in the receiver conversation


runScriptFromString: 

- (id) runScriptFromString: (NSString*)aString;

Description forthcoming.


setLanguage: 

- (void) setLanguage: (NSString*)newLanguage;

Description forthcoming.




Instance Variables for STConversation Class

context

@protected STContext* context;

Description forthcoming.


engine

@protected STEngine* engine;

Description forthcoming.


languageName

@protected NSString* languageName;

Description forthcoming.


returnValue

@protected id returnValue;

Description forthcoming.





Software documentation for the STConversation protocol

STConversation

Declared in:
StepTalk/STConversation.h

Description forthcoming.

Method summary

interpretScript: 

- (void) interpretScript: (bycopy NSString*)aString;

Interpret given string as a script in the receiver environment.


knownLanguages 

- (bycopy NSArray*) knownLanguages;

Description forthcoming.


language 

- (NSString*) language;

Description forthcoming.


result 

- (id) result;

Description forthcoming.


resultByCopy 

- (bycopy id) resultByCopy;

Description forthcoming.


setLanguage: 

- (void) setLanguage: (NSString*)newLanguage;

Set language for the receiver.



Up
StepTalk-0.10.0/Documentation/Reference/STScriptsManager.gsdoc0000664000175000017500000000650414633027767023350 0ustar yavoryavor STScriptsManager class documentation 2002 Stefan Urbanek Software documentation for the STScriptsManager class StepTalk/STScriptsManager.h Description forthcoming. Description forthcoming. Description forthcoming. defaultManager Returns default scripts manager for current process (application or tool). allScripts Return list of all scripts for managed domain. initWithDomainName: name Initializes the receiver to be used with domain named name. If name is nil, default scripts domain name will be used. scriptSearchPaths 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. scriptWithName: aString Get a script with name aString for current scripting domain. scriptsDomainName Return name of script manager domain. setScriptSearchPaths: anArray Set script search paths to anArray. setScriptSearchPathsToDefaults Description forthcoming. validScriptSearchPaths Return script search paths that are valid. That means that path exists and is a directory. StepTalk-0.10.0/Documentation/Reference/STObjectReference.html0000664000175000017500000000702414633027767023316 0ustar yavoryavor STObjectReference class documentation Up

STObjectReference class documentation

Authors

Stefan Urbanek

Copyright: (C) 2002 Free Software Foundation

Software documentation for the STObjectReference class

STObjectReference : NSObject

Declared in:
StepTalk/STObjectReference.h

Description forthcoming.


Instance Variables

Method summary

identifier 

- (NSString*) identifier;

Description forthcoming.


initWithIdentifier: target: 

- (id) initWithIdentifier: (NSString*)ident target: (id)anObject;

Description forthcoming.


object 

- (id) object;

Description forthcoming.


setObject: 

- (void) setObject: (id)anObject;

Description forthcoming.


target 

- (id) target;

Description forthcoming.




Instance Variables for STObjectReference Class

identifier

@protected NSString* identifier;

Description forthcoming.


target

@protected id target;

Description forthcoming.






Up
StepTalk-0.10.0/Documentation/Reference/STEngine.html0000664000175000017500000000765614633027767021511 0ustar yavoryavor STEngine class documentation Up

STEngine class documentation

Authors

Stefan Urbanek

Copyright: (C) 2002 Free Software Foundation

Software documentation for the STEngine class

STEngine : NSObject

Declared in:
StepTalk/STEngine.h

STEngine is abstract class for language engines used to intepret scripts.

Method summary

engineForLanguage: 

+ (STEngine*) engineForLanguage: (NSString*)name;

Instance creation
Return a scripting engine for language with specified name. The engine is get from default language manager.


executeMethod: forReceiver: withArguments: inContext: 

- (id) executeMethod: (id<STMethod>)aMethod forReceiver: (id)anObject withArguments: (NSArray*)args inContext: (STContext*)env;

Description forthcoming.


interpretScript: inContext: 

- (id) interpretScript: (NSString*)script inContext: (STContext*)context;
Subclasses should override this method.

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.


methodFromSource: forReceiver: inContext: 

- (STMethod*) methodFromSource: (NSString*)sourceString forReceiver: (id)receiver inContext: (STContext*)env;

Description forthcoming.


understandsCode: 

- (BOOL) understandsCode: (NSString*)code;

Description forthcoming.



Up
StepTalk-0.10.0/Documentation/Reference/STContext.html0000664000175000017500000002071214633027767021714 0ustar yavoryavor STEnvironment class reference Up

STEnvironment class reference

Authors

Stefan Urbanek

Copyright: (C) 2002 Free Software Foundation

Software documentation for the STContext class

STContext : NSObject

Declared in:
StepTalk/STContext.h

Description forthcoming.


Instance Variables

Method summary

addNamedObjectsFromDictionary: 

- (void) addNamedObjectsFromDictionary: (NSDictionary*)dict;

Description forthcoming.


createsUnknownObjects 

- (BOOL) createsUnknownObjects;

Returns YES if unknown objects are being created.


fullScriptingEnabled 

- (BOOL) fullScriptingEnabled;

Returns YES if full scripting is enabled.


knownObjectNames 

- (NSArray*) knownObjectNames;

Description forthcoming.


objectDictionary 

- (NSMutableDictionary*) objectDictionary;

Returns a dictionary of all named objects in the environment.


objectReferenceForObjectWithName: 

- (STObjectReference*) objectReferenceForObjectWithName: (NSString*)name;

Description forthcoming.


objectWithName: 

- (id) objectWithName: (NSString*)objName;

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.


parentContext 

- (STContext*) parentContext;

Description forthcoming.


removeObjectWithName: 

- (void) removeObjectWithName: (NSString*)objName;

Remove object named objName.


setCreatesUnknownObjects: 

- (void) setCreatesUnknownObjects: (BOOL)flag;

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).


setFullScriptingEnabled: 

- (void) setFullScriptingEnabled: (BOOL)flag;

Full scripting
Enable or disable full scripting. When full scripting is enabled, you may send any message to any object.


setObject: forName: 

- (void) setObject: (id)anObject forName: (NSString*)objName;

Register object anObject with name objName.


setParentContext: 

- (void) setParentContext: (STContext*)context;

Description forthcoming.




Instance Variables for STContext Class

createsUnknownObjects

@protected BOOL createsUnknownObjects;

Description forthcoming.


fullScripting

@protected BOOL fullScripting;

Description forthcoming.


objectDictionary

@protected NSMutableDictionary* objectDictionary;

Description forthcoming.


parentContext

@protected STContext* parentContext;

Description forthcoming.






Up
StepTalk-0.10.0/Documentation/Reference/STContext.gsdoc0000664000175000017500000001210214633027767022041 0ustar yavoryavor STEnvironment class reference 2002 Free Software Foundation Software documentation for the STContext class StepTalk/STContext.h Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. addNamedObjectsFromDictionary: dict Description forthcoming. createsUnknownObjects Returns YES if unknown objects are being created. fullScriptingEnabled Returns YES if full scripting is enabled. knownObjectNames Description forthcoming. objectDictionary Returns a dictionary of all named objects in the environment. objectReferenceForObjectWithName: name Description forthcoming. objectWithName: objName 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. parentContext Description forthcoming. removeObjectWithName: objName Remove object named objName. setCreatesUnknownObjects: flag

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).

setFullScriptingEnabled: flag Full scripting
Enable or disable full scripting. When full scripting is enabled, you may send any message to any object.
setObject: anObject forName: objName Register object anObject with name objName. setParentContext: context Description forthcoming.
StepTalk-0.10.0/Documentation/Reference/STScriptObject.gsdoc0000664000175000017500000001073514633027767023022 0ustar yavoryavor STScriptObject class documentation Software documentation for the STScriptObject class StepTalk/STScriptObject.h NSCoding STScriptObject Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. scriptObject Return new instance of script object without any instance variables addMethod: aMethod Description forthcoming. environment Description forthcoming. initWithInstanceVariableNames: names Description forthcoming. instanceVariableNames Description forthcoming. methodDictionary Description forthcoming. methodNames Description forthcoming. methodWithName: aName Description forthcoming. objectForVariable: aName Description forthcoming. removeMethod: aMethod Description forthcoming. removeMethodWithName: aName Description forthcoming. setEnvironment: env Set object's environment. Note: This method should be replaced by some other, more clever mechanism. setObject: anObject forVariable: aName Description forthcoming. Software documentation for the STScriptObject protocol StepTalk/STScriptObject.h Description forthcoming. instanceVariableNames Description forthcoming. StepTalk-0.10.0/Documentation/Reference/STEnvironmentDescription.html0000664000175000017500000001754714633027767025014 0ustar yavoryavor STEnvironmentDescription class documentation Up

STEnvironmentDescription class documentation

Authors

Stefan Urbanek

Copyright: (C) 2002 Free Software Foundation

Software documentation for the STEnvironmentDescription class

STEnvironmentDescription : NSObject

Declared in:
StepTalk/STEnvironmentDescription.h

Description forthcoming.


Instance Variables

Method summary

defaultDescriptionName 

+ (NSString*) defaultDescriptionName;

Description forthcoming.


descriptionFromDictionary: 

+ (id) descriptionFromDictionary: (NSDictionary*)dictionary;

Description forthcoming.


descriptionWithName: 

+ (id) descriptionWithName: (NSString*)descriptionName;

Description forthcoming.


classes 

- (NSMutableDictionary*) classes;

Description forthcoming.


frameworks 

- (NSArray*) frameworks;

Description forthcoming.


initFromDictionary: 

- (id) initFromDictionary: (NSDictionary*)def;

Description forthcoming.


initWithName: 

- (id) initWithName: (NSString*)defName;

Description forthcoming.


modules 

- (NSArray*) modules;

Description forthcoming.


objectFinders 

- (NSArray*) objectFinders;

Description forthcoming.


updateClassWithName: description: 

- (void) updateClassWithName: (NSString*)className description: (NSDictionary*)def;

Description forthcoming.


updateFromDictionary: 

- (void) updateFromDictionary: (NSDictionary*)def;

Description forthcoming.




Instance Variables for STEnvironmentDescription Class

aliases

@protected NSMutableDictionary* aliases;

Description forthcoming.


behaviours

@protected NSMutableDictionary* behaviours;

Description forthcoming.


classes

@protected NSMutableDictionary* classes;

Description forthcoming.


finders

@protected NSMutableArray* finders;

Description forthcoming.


frameworks

@protected NSMutableArray* frameworks;

Description forthcoming.


modules

@protected NSMutableArray* modules;

Description forthcoming.


restriction

@protected int restriction;

Description forthcoming.


usedDefs

@protected NSMutableArray* usedDefs;

Description forthcoming.






Up
StepTalk-0.10.0/Documentation/Reference/STScripting.html0000664000175000017500000000762014633027767022235 0ustar yavoryavor STScripting protocol documentation Up

STScripting protocol documentation

Authors

Stefan Urbanek

Copyright: (C) 2002 Free Software Foundation

Software documentation for the NSObject(STScripting) category

NSObject(STScripting)

Declared in:
StepTalk/STScripting.h
Conforms to:
STScripting

Description forthcoming.

Software documentation for the STScripting protocol

STScripting

Declared in:
StepTalk/STScripting.h

Description forthcoming.

Method summary

classForScripting 

+ (Class) classForScripting;

Description forthcoming.


className 

+ (NSString*) className;

Description forthcoming.


isClass 

+ (BOOL) isClass;

Description forthcoming.


classForScripting 

- (Class) classForScripting;

Description forthcoming.


className 

- (NSString*) className;

Description forthcoming.


isClass 

- (BOOL) isClass;

Description forthcoming.



Up
StepTalk-0.10.0/Documentation/Reference/STUndefinedObject.html0000664000175000017500000000163614633027767023324 0ustar yavoryavor STUndefinedObject class documentation Up

STUndefinedObject class documentation

Authors

Stefan Urbanek

Copyright: (C) 2002 Free Software Foundation

Software documentation for the STUndefinedObject class

STUndefinedObject : NSObject

Declared in:
StepTalk/STUndefinedObject.h

Description forthcoming.


Up
StepTalk-0.10.0/Documentation/Reference/STObjectReference.gsdoc0000664000175000017500000000375314633027767023456 0ustar yavoryavor STObjectReference class documentation 2002 Free Software Foundation Software documentation for the STObjectReference class StepTalk/STObjectReference.h Description forthcoming. Description forthcoming. Description forthcoming. identifier Description forthcoming. initWithIdentifier: ident target: anObject Description forthcoming. object Description forthcoming. setObject: anObject Description forthcoming. target Description forthcoming. StepTalk-0.10.0/Documentation/Reference/STSelector.html0000664000175000017500000000573514633027767022060 0ustar yavoryavor STSelector class documentation Up

STSelector class documentation

Authors

Generated by stevko

Software documentation for the STSelector class

STSelector : NSObject

Declared in:
StepTalk/STSelector.h

Description forthcoming.


Instance Variables

Method summary

initWithName: 

- (id) initWithName: (NSString*)aString;

Description forthcoming.


initWithSelector: 

- (id) initWithSelector: (SEL)aSel;

Description forthcoming.


selectorName 

- (NSString*) selectorName;

Description forthcoming.


selectorValue 

- (SEL) selectorValue;

Description forthcoming.




Instance Variables for STSelector Class

sel

@protected SEL sel;

Description forthcoming.


selectorName

@protected NSString* selectorName;

Description forthcoming.






Up
StepTalk-0.10.0/Documentation/Reference/STRemoteConversation.gsdoc0000664000175000017500000000554214633027767024255 0ustar yavoryavor STRemoteConversation class documentation 2002 Free Software Foundation Software documentation for the STRemoteConversation class StepTalk/STRemoteConversation.h Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. close Description forthcoming. initWithEnvironmentName: envName host: host language: langName Description forthcoming. open Description forthcoming. Software documentation for the STEnvironmentProcess protocol StepTalk/STRemoteConversation.h Description forthcoming. createConversation Description forthcoming. StepTalk-0.10.0/Documentation/Reference/NSInvocation+additions.html0000664000175000017500000001073514633027767024351 0ustar yavoryavor NSInvocation class additions Up

NSInvocation class additions

Authors

Stefan Urbanek

Copyright: (C) 2002 Free Software Foundation

Software documentation for the NSInvocation(STAdditions) category

NSInvocation(STAdditions)

Declared in:
StepTalk/NSInvocation+additions.h

Description forthcoming.

Method summary

invocationWithTarget: selector: 

+ (id) invocationWithTarget: (id)target selector: (SEL)selector;

Description forthcoming.


invocationWithTarget: selectorName: 

+ (id) invocationWithTarget: (id)target selectorName: (NSString*)selectorName;

Description forthcoming.


getArgumentAsObjectAtIndex: 

- (id) getArgumentAsObjectAtIndex: (int)anIndex;

Description forthcoming.


returnValueAsObject 

- (id) returnValueAsObject;

Description forthcoming.


setArgumentAsObject: atIndex: 

- (void) setArgumentAsObject: (id)anObject atIndex: (int)anIndex;

Description forthcoming.


NSInvocation+additions functions

STGetValueOfTypeFromObject

void STGetValueOfTypeFromObject(void* value, const char* type, id anObject);

Description forthcoming.


STObjectFromValueOfType

id STObjectFromValueOfType(void* value, const char* type);

This method is a factory method, that means that you have to release the object when you no longer need it.



Up
StepTalk-0.10.0/Documentation/Reference/STObjCRuntime.html0000664000175000017500000000560314633027767022453 0ustar yavoryavor STObjCRuntime documentation Up

STObjCRuntime documentation

Authors

Stefan Urbanek

Copyright: (C) 2002 Free Software Foundation

STObjCRuntime functions

STAllObjectiveCClasses

NSMutableDictionary* STAllObjectiveCClasses();

Description forthcoming.


STAllObjectiveCSelectors

NSArray* STAllObjectiveCSelectors();

Description forthcoming.


STClassDictionaryWithNames

NSDictionary* STClassDictionaryWithNames(NSArray* classNames);

Description forthcoming.


STConstructMethodSignatureForSelector

NSMethodSignature* STConstructMethodSignatureForSelector(SEL sel);

Description forthcoming.


STGetFoundationConstants

NSMutableDictionary* STGetFoundationConstants();

Description forthcoming.


STMethodSignatureForSelector

NSMethodSignature* STMethodSignatureForSelector(SEL sel);

Description forthcoming.


STSelectorFromString

SEL STSelectorFromString(NSString* aString);

Description forthcoming.


STSelectorFromValue

SEL STSelectorFromValue(NSValue* val);

Description forthcoming.


STValueFromSelector

NSValue* STValueFromSelector(SEL sel);

Description forthcoming.



Up
StepTalk-0.10.0/Documentation/Reference/STSelector.gsdoc0000664000175000017500000000330214633027767022177 0ustar yavoryavor STSelector class documentation Software documentation for the STSelector class StepTalk/STSelector.h Description forthcoming. Description forthcoming. Description forthcoming. initWithName: aString Description forthcoming. initWithSelector: aSel Description forthcoming. selectorName Description forthcoming. selectorValue Description forthcoming. StepTalk-0.10.0/Documentation/Reference/STEnvironment.html0000664000175000017500000002213514633027767022575 0ustar yavoryavor STEnvironment class reference Up

STEnvironment class reference

Authors

Stefan Urbanek

Copyright: (C) 2002 Free Software Foundation

Software documentation for the STEnvironment class

STEnvironment : STContext

Declared in:
StepTalk/STEnvironment.h

Description forthcoming.


Instance Variables

Method summary

environmentWithDefaultDescription 

+ (STEnvironment*) environmentWithDefaultDescription;

Creates and initialises new scripting environment using default description.


environmentWithDescription: 

+ (id) environmentWithDescription: (STEnvironmentDescription*)aDescription;

Creates and initialises scripting environment using environment description description.


sharedEnvironment 

+ (id) sharedEnvironment;

Creating environment
Returns an instance of the scripting environment that is shared in the scope of actual application or process.


addClassesWithNames: 

- (void) addClassesWithNames: (NSArray*)names;

Add classes specified by the names in the names array. This method is used internally to add classes provided by modules.


includeBundle: 

- (BOOL) includeBundle: (NSBundle*)aBundle;

Include scripting capabilities advertised by the bundle


includeFramework: 

- (BOOL) includeFramework: (NSString*)frameworkName;

Include scripting capabilities advertised by the framework with name


initWithDefaultDescription 

- (id) initWithDefaultDescription;
This is a designated initialiser for the class.

Initialises scripting environment using default description.


initWithDescription: 

- (id) initWithDescription: (bycopy STEnvironmentDescription*)aDescription;

Initialises scripting environment using scripting description aDescription.


loadModule: 

- (void) loadModule: (NSString*)moduleName;

Modules
Load StepTalk module with the name moduleName. Modules are stored in the Library/StepTalk/Modules directory.


registerObjectFinder: name: 

- (void) registerObjectFinder: (id)finder name: (NSString*)name;

Distributed objects
Register object finder finder under the name name


registerObjectFinderNamed: 

- (void) registerObjectFinderNamed: (NSString*)name;

Register object finder named name. This method will try to find an object finder bundle in Library/StepTalk/Finders directories.


removeObjectFinderWithName: 

- (void) removeObjectFinderWithName: (NSString*)name;

Remove object finder with name name


translateSelector: forReceiver: 

- (NSString*) translateSelector: (NSString*)aString forReceiver: (id)anObject;

Selector translation




Instance Variables for STEnvironment Class

classes

@protected NSMutableDictionary* classes;

Description forthcoming.


description

@protected STEnvironmentDescription* description;

Description forthcoming.


infoCache

@protected NSMutableDictionary* infoCache;

Description forthcoming.


loadedBundles

@protected NSMutableArray* loadedBundles;

Description forthcoming.


objectFinders

@protected NSMutableDictionary* objectFinders;

Description forthcoming.






Up
StepTalk-0.10.0/Documentation/Reference/StepTalk.igsdoc0000664000175000017500000007143714633027767022066 0ustar yavoryavor{ categories = { NSBundle = { STAdditions = STBundleInfo; }; NSInvocation = { STAdditions = "NSInvocation+additions"; }; NSObject = { STAdditions = "NSObject+additions"; STScripting = STScripting; }; }; category = { "NSBundle(STAdditions)" = STBundleInfo; "NSInvocation(STAdditions)" = "NSInvocation+additions"; "NSObject(STAdditions)" = "NSObject+additions"; "NSObject(STScripting)" = STScripting; }; class = { STActor = STActor; STBundleInfo = STBundleInfo; STContext = STContext; STConversation = STConversation; STEngine = STEngine; STEnvironment = STEnvironment; STEnvironmentDescription = STEnvironmentDescription; STFileScript = STFileScript; STLanguageManager = STLanguageManager; STObjectReference = STObjectReference; STRemoteConversation = STRemoteConversation; STScript = STScript; STScriptObject = STScriptObject; STScriptsManager = STScriptsManager; STSelector = STSelector; STUndefinedObject = STUndefinedObject; }; classvars = { STActor = { environment = STActor; ivars = STActor; methodDictionary = STActor; }; STBundleInfo = { allClasses = STBundleInfo; bundle = STBundleInfo; objectReferenceDictionary = STBundleInfo; publicClasses = STBundleInfo; scriptingInfoClass = STBundleInfo; scriptingInfoClassName = STBundleInfo; useAllClasses = STBundleInfo; }; STContext = { createsUnknownObjects = STContext; fullScripting = STContext; objectDictionary = STContext; parentContext = STContext; }; STConversation = { context = STConversation; engine = STConversation; languageName = STConversation; returnValue = STConversation; }; STEnvironment = { classes = STEnvironment; description = STEnvironment; infoCache = STEnvironment; loadedBundles = STEnvironment; objectFinders = STEnvironment; }; STEnvironmentDescription = { aliases = STEnvironmentDescription; behaviours = STEnvironmentDescription; classes = STEnvironmentDescription; finders = STEnvironmentDescription; frameworks = STEnvironmentDescription; modules = STEnvironmentDescription; restriction = STEnvironmentDescription; usedDefs = STEnvironmentDescription; }; STFileScript = { description = STFileScript; fileName = STFileScript; localizedName = STFileScript; menuKey = STFileScript; }; STLanguageManager = { engineClasses = STLanguageManager; fileTypes = STLanguageManager; languageBundles = STLanguageManager; languageInfos = STLanguageManager; languages = STLanguageManager; }; STObjectReference = { identifier = STObjectReference; target = STObjectReference; }; STRemoteConversation = { connection = STRemoteConversation; environmentName = STRemoteConversation; environmentProcess = STRemoteConversation; hostName = STRemoteConversation; proxy = STRemoteConversation; }; STScript = { language = STScript; source = STScript; }; STScriptObject = { environment = STScriptObject; ivars = STScriptObject; methodDictionary = STScriptObject; }; STScriptsManager = { scriptSearchPaths = STScriptsManager; scriptsDomainName = STScriptsManager; }; STSelector = { sel = STSelector; selectorName = STSelector; }; }; function = { STAllObjectiveCClasses = STObjCRuntime; STAllObjectiveCSelectors = STObjCRuntime; STClassDictionaryWithNames = STObjCRuntime; STConstructMethodSignatureForSelector = STObjCRuntime; STFindAllResources = STFunctions; STFindResource = STFunctions; STGetFoundationConstants = STObjCRuntime; STGetValueOfTypeFromObject = "NSInvocation+additions"; STMethodSignatureForSelector = STObjCRuntime; STObjectFromValueOfType = "NSInvocation+additions"; STSelectorFromString = STObjCRuntime; STSelectorFromValue = STObjCRuntime; STUserConfigPath = STFunctions; STValueFromSelector = STObjCRuntime; }; ivariable = { aliases = { STEnvironmentDescription = STEnvironmentDescription; }; allClasses = { STBundleInfo = STBundleInfo; }; behaviours = { STEnvironmentDescription = STEnvironmentDescription; }; bundle = { STBundleInfo = STBundleInfo; }; classes = { STEnvironment = STEnvironment; STEnvironmentDescription = STEnvironmentDescription; }; connection = { STRemoteConversation = STRemoteConversation; }; context = { STConversation = STConversation; }; createsUnknownObjects = { STContext = STContext; }; description = { STEnvironment = STEnvironment; STFileScript = STFileScript; }; engine = { STConversation = STConversation; }; engineClasses = { STLanguageManager = STLanguageManager; }; environment = { STActor = STActor; STScriptObject = STScriptObject; }; environmentName = { STRemoteConversation = STRemoteConversation; }; environmentProcess = { STRemoteConversation = STRemoteConversation; }; fileName = { STFileScript = STFileScript; }; fileTypes = { STLanguageManager = STLanguageManager; }; finders = { STEnvironmentDescription = STEnvironmentDescription; }; frameworks = { STEnvironmentDescription = STEnvironmentDescription; }; fullScripting = { STContext = STContext; }; hostName = { STRemoteConversation = STRemoteConversation; }; identifier = { STObjectReference = STObjectReference; }; infoCache = { STEnvironment = STEnvironment; }; ivars = { STActor = STActor; STScriptObject = STScriptObject; }; language = { STScript = STScript; }; languageBundles = { STLanguageManager = STLanguageManager; }; languageInfos = { STLanguageManager = STLanguageManager; }; languageName = { STConversation = STConversation; }; languages = { STLanguageManager = STLanguageManager; }; loadedBundles = { STEnvironment = STEnvironment; }; localizedName = { STFileScript = STFileScript; }; menuKey = { STFileScript = STFileScript; }; methodDictionary = { STActor = STActor; STScriptObject = STScriptObject; }; modules = { STEnvironmentDescription = STEnvironmentDescription; }; objectDictionary = { STContext = STContext; }; objectFinders = { STEnvironment = STEnvironment; }; objectReferenceDictionary = { STBundleInfo = STBundleInfo; }; parentContext = { STContext = STContext; }; proxy = { STRemoteConversation = STRemoteConversation; }; publicClasses = { STBundleInfo = STBundleInfo; }; restriction = { STEnvironmentDescription = STEnvironmentDescription; }; returnValue = { STConversation = STConversation; }; scriptSearchPaths = { STScriptsManager = STScriptsManager; }; scriptingInfoClass = { STBundleInfo = STBundleInfo; }; scriptingInfoClassName = { STBundleInfo = STBundleInfo; }; scriptsDomainName = { STScriptsManager = STScriptsManager; }; sel = { STSelector = STSelector; }; selectorName = { STSelector = STSelector; }; source = { STScript = STScript; }; target = { STObjectReference = STObjectReference; }; useAllClasses = { STBundleInfo = STBundleInfo; }; usedDefs = { STEnvironmentDescription = STEnvironmentDescription; }; }; method = { "+actorInEnvironment:" = { STActor = STActor; }; "+allFrameworkNames" = { NSBundle = STBundleInfo; }; "+bundleForFrameworkWithName:" = { NSBundle = STBundleInfo; }; "+classForScripting" = { "(STScripting)" = STScripting; }; "+className" = { "(STScripting)" = STScripting; }; "+defaultDescriptionName" = { STEnvironmentDescription = STEnvironmentDescription; }; "+defaultManager" = { STLanguageManager = STLanguageManager; STScriptsManager = STScriptsManager; }; "+descriptionFromDictionary:" = { STEnvironmentDescription = STEnvironmentDescription; }; "+descriptionWithName:" = { STEnvironmentDescription = STEnvironmentDescription; }; "+engineForLanguage:" = { STEngine = STEngine; }; "+environmentWithDefaultDescription" = { STEnvironment = STEnvironment; }; "+environmentWithDescription:" = { STEnvironment = STEnvironment; }; "+infoForBundle:" = { STBundleInfo = STBundleInfo; }; "+invocationWithTarget:selector:" = { NSInvocation = "NSInvocation+additions"; }; "+invocationWithTarget:selectorName:" = { NSInvocation = "NSInvocation+additions"; }; "+isClass" = { "(STScripting)" = STScripting; }; "+pathForFrameworkWithName:" = { NSBundle = STBundleInfo; }; "+scriptObject" = { STScriptObject = STScriptObject; }; "+scriptWithFile:" = { STFileScript = STFileScript; }; "+scriptWithSource:language:" = { STScript = STScript; }; "+sharedEnvironment" = { STEnvironment = STEnvironment; }; "+stepTalkBundleNames" = { NSBundle = STBundleInfo; }; "+stepTalkBundleWithName:" = { NSBundle = STBundleInfo; }; "-addClassesWithNames:" = { STEnvironment = STEnvironment; }; "-addMethod:" = { STActor = STActor; STScriptObject = STScriptObject; }; "-addNamedObjectsFromDictionary:" = { STContext = STContext; }; "-allClassNames" = { STBundleInfo = STBundleInfo; }; "-allScripts" = { STScriptsManager = STScriptsManager; }; "-availableLanguages" = { STLanguageManager = STLanguageManager; }; "-bundleForLanguage:" = { STLanguageManager = STLanguageManager; }; "-classForScripting" = { "(STScripting)" = STScripting; }; "-className" = { "(STScripting)" = STScripting; }; "-classes" = { STEnvironmentDescription = STEnvironmentDescription; }; "-close" = { STRemoteConversation = STRemoteConversation; }; "-compareByLocalizedName:" = { STFileScript = STFileScript; }; "-context" = { STConversation = STConversation; }; "-createConversation" = { "(STEnvironmentProcess)" = STRemoteConversation; }; "-createEngineForLanguage:" = { STLanguageManager = STLanguageManager; }; "-createsUnknownObjects" = { STContext = STContext; }; "-defaultLanguage" = { STLanguageManager = STLanguageManager; }; "-engineClassForLanguage:" = { STLanguageManager = STLanguageManager; }; "-environment" = { STActor = STActor; STScriptObject = STScriptObject; }; "-executeMethod:forReceiver:withArguments:inContext:" = { STEngine = STEngine; }; "-fileName" = { STFileScript = STFileScript; }; "-frameworks" = { STEnvironmentDescription = STEnvironmentDescription; }; "-fullScriptingEnabled" = { STContext = STContext; }; "-getArgumentAsObjectAtIndex:" = { NSInvocation = "NSInvocation+additions"; }; "-identifier" = { STObjectReference = STObjectReference; }; "-includeBundle:" = { STEnvironment = STEnvironment; }; "-includeFramework:" = { STEnvironment = STEnvironment; }; "-initFromDictionary:" = { STEnvironmentDescription = STEnvironmentDescription; }; "-initWithBundle:" = { STBundleInfo = STBundleInfo; }; "-initWithContext:language:" = { STConversation = STConversation; }; "-initWithDefaultDescription" = { STEnvironment = STEnvironment; }; "-initWithDescription:" = { STEnvironment = STEnvironment; }; "-initWithDomainName:" = { STScriptsManager = STScriptsManager; }; "-initWithEnvironment:" = { STActor = STActor; }; "-initWithEnvironmentName:host:language:" = { STRemoteConversation = STRemoteConversation; }; "-initWithFile:" = { STFileScript = STFileScript; }; "-initWithIdentifier:target:" = { STObjectReference = STObjectReference; }; "-initWithInstanceVariableNames:" = { STScriptObject = STScriptObject; }; "-initWithName:" = { STEnvironmentDescription = STEnvironmentDescription; STSelector = STSelector; }; "-initWithSelector:" = { STSelector = STSelector; }; "-initWithSource:language:" = { STScript = STScript; }; "-instanceVariableNames" = { "(STScriptObject)" = STScriptObject; STScriptObject = STScriptObject; }; "-interpretScript:" = { "(STConversation)" = STConversation; }; "-interpretScript:inContext:" = { STEngine = STEngine; }; "-isClass" = { "(STScripting)" = STScripting; }; "-isNil" = { NSObject = "NSObject+additions"; }; "-isSame:" = { NSObject = "NSObject+additions"; }; "-knownLanguages" = { "(STConversation)" = STConversation; }; "-knownObjectNames" = { STContext = STContext; }; "-language" = { "(STConversation)" = STConversation; STConversation = STConversation; STScript = STScript; }; "-languageName" = { "(STMethod)" = STMethod; }; "-loadModule:" = { STEnvironment = STEnvironment; }; "-localizedName" = { STFileScript = STFileScript; }; "-methodDictionary" = { STActor = STActor; STScriptObject = STScriptObject; }; "-methodFromSource:forReceiver:inContext:" = { STEngine = STEngine; }; "-methodName" = { "(STMethod)" = STMethod; }; "-methodNames" = { STActor = STActor; STScriptObject = STScriptObject; }; "-methodWithName:" = { STActor = STActor; STScriptObject = STScriptObject; }; "-modules" = { STEnvironmentDescription = STEnvironmentDescription; }; "-namedObjects" = { STBundleInfo = STBundleInfo; }; "-notNil" = { NSObject = "NSObject+additions"; }; "-object" = { STObjectReference = STObjectReference; }; "-objectDictionary" = { STContext = STContext; }; "-objectFinders" = { STEnvironmentDescription = STEnvironmentDescription; }; "-objectForVariable:" = { STScriptObject = STScriptObject; }; "-objectReferenceDictionary" = { STBundleInfo = STBundleInfo; }; "-objectReferenceForObjectWithName:" = { STContext = STContext; }; "-objectWithName:" = { STContext = STContext; }; "-open" = { STRemoteConversation = STRemoteConversation; }; "-parentContext" = { STContext = STContext; }; "-publicClassNames" = { STBundleInfo = STBundleInfo; }; "-registerObjectFinder:name:" = { STEnvironment = STEnvironment; }; "-registerObjectFinderNamed:" = { STEnvironment = STEnvironment; }; "-removeMethod:" = { STActor = STActor; STScriptObject = STScriptObject; }; "-removeMethodWithName:" = { STActor = STActor; STScriptObject = STScriptObject; }; "-removeObjectFinderWithName:" = { STEnvironment = STEnvironment; }; "-removeObjectWithName:" = { STContext = STContext; }; "-result" = { "(STConversation)" = STConversation; }; "-resultByCopy" = { "(STConversation)" = STConversation; }; "-returnValueAsObject" = { NSInvocation = "NSInvocation+additions"; }; "-runScriptFromString:" = { STConversation = STConversation; }; "-scriptDescription" = { STFileScript = STFileScript; }; "-scriptName" = { STFileScript = STFileScript; }; "-scriptSearchPaths" = { STScriptsManager = STScriptsManager; }; "-scriptWithName:" = { STScriptsManager = STScriptsManager; }; "-scriptingInfoDictionary" = { NSBundle = STBundleInfo; }; "-scriptsDomainName" = { STScriptsManager = STScriptsManager; }; "-selectorName" = { STSelector = STSelector; }; "-selectorValue" = { STSelector = STSelector; }; "-setArgumentAsObject:atIndex:" = { NSInvocation = "NSInvocation+additions"; }; "-setCreatesUnknownObjects:" = { STContext = STContext; }; "-setEnvironment:" = { STActor = STActor; STScriptObject = STScriptObject; }; "-setFullScriptingEnabled:" = { STContext = STContext; }; "-setLanguage:" = { "(STConversation)" = STConversation; STConversation = STConversation; STScript = STScript; }; "-setObject:" = { STObjectReference = STObjectReference; }; "-setObject:forName:" = { STContext = STContext; }; "-setObject:forVariable:" = { STScriptObject = STScriptObject; }; "-setParentContext:" = { STContext = STContext; }; "-setScriptSearchPaths:" = { STScriptsManager = STScriptsManager; }; "-setScriptSearchPathsToDefaults" = { STScriptsManager = STScriptsManager; }; "-setSource:" = { STScript = STScript; }; "-source" = { "(STMethod)" = STMethod; STScript = STScript; }; "-target" = { STObjectReference = STObjectReference; }; "-translateSelector:forReceiver:" = { STEnvironment = STEnvironment; }; "-understandsCode:" = { STEngine = STEngine; }; "-updateClassWithName:description:" = { STEnvironmentDescription = STEnvironmentDescription; }; "-updateFromDictionary:" = { STEnvironmentDescription = STEnvironmentDescription; }; "-validScriptSearchPaths" = { STScriptsManager = STScriptsManager; }; }; output = { "NSInvocation+additions.h" = ( "../../Documentation/Reference/NSInvocation+additions.gsdoc" ); "NSObject+additions.h" = ( "../../Documentation/Reference/NSObject+additions.gsdoc" ); STActor.h = ( ../../Documentation/Reference/STActor.gsdoc ); STBundleInfo.h = ( ../../Documentation/Reference/STBundleInfo.gsdoc ); STContext.h = ( ../../Documentation/Reference/STContext.gsdoc ); STConversation.h = ( ../../Documentation/Reference/STConversation.gsdoc ); STEngine.h = ( ../../Documentation/Reference/STEngine.gsdoc ); STEnvironment.h = ( ../../Documentation/Reference/STEnvironment.gsdoc ); STEnvironmentDescription.h = ( ../../Documentation/Reference/STEnvironmentDescription.gsdoc ); STExterns.h = ( ../../Documentation/Reference/STExterns.gsdoc ); STFileScript.h = ( ../../Documentation/Reference/STFileScript.gsdoc ); STFunctions.h = ( ../../Documentation/Reference/STFunctions.gsdoc ); STLanguageManager.h = ( ../../Documentation/Reference/STLanguageManager.gsdoc ); STMethod.h = ( ../../Documentation/Reference/STMethod.gsdoc ); STObjCRuntime.h = ( ../../Documentation/Reference/STObjCRuntime.gsdoc ); STObjectReference.h = ( ../../Documentation/Reference/STObjectReference.gsdoc ); STRemoteConversation.h = ( ../../Documentation/Reference/STRemoteConversation.gsdoc ); STScript.h = ( ../../Documentation/Reference/STScript.gsdoc ); STScriptObject.h = ( ../../Documentation/Reference/STScriptObject.gsdoc ); STScripting.h = ( ../../Documentation/Reference/STScripting.gsdoc ); STScriptsManager.h = ( ../../Documentation/Reference/STScriptsManager.gsdoc ); STSelector.h = ( ../../Documentation/Reference/STSelector.gsdoc ); STUndefinedObject.h = ( ../../Documentation/Reference/STUndefinedObject.gsdoc ); }; protocol = { "(STConversation)" = STConversation; "(STEnvironmentProcess)" = STRemoteConversation; "(STMethod)" = STMethod; "(STScriptObject)" = STScriptObject; "(STScripting)" = STScripting; }; source = { "NSInvocation+additions.h" = ( "NSInvocation+additions.m" ); "NSObject+additions.h" = ( "NSObject+additions.m" ); STActor.h = ( STActor.m ); STBundleInfo.h = ( STBundleInfo.m ); STContext.h = ( STContext.m ); STConversation.h = ( STConversation.m ); STEngine.h = ( STEngine.m ); STEnvironment.h = ( STEnvironment.m ); STEnvironmentDescription.h = ( STEnvironmentDescription.m ); STExterns.h = ( STExterns.m ); STFileScript.h = ( STFileScript.m ); STFunctions.h = ( STFunctions.m ); STLanguageManager.h = ( STLanguageManager.m ); STMethod.h = ( STMethod.m ); STObjCRuntime.h = ( STObjCRuntime.m ); STObjectReference.h = ( STObjectReference.m ); STRemoteConversation.h = ( STRemoteConversation.m ); STScript.h = ( STScript.m ); STScriptObject.h = ( STScriptObject.m ); STScripting.h = ( STScripting.m ); STScriptsManager.h = ( STScriptsManager.m ); STSelector.h = ( STSelector.m ); STUndefinedObject.h = ( STUndefinedObject.m ); }; super = { STActor = NSObject; STBundleInfo = NSObject; STContext = NSObject; STConversation = NSObject; STEngine = NSObject; STEnvironment = STContext; STEnvironmentDescription = NSObject; STFileScript = STScript; STLanguageManager = NSObject; STObjectReference = NSObject; STRemoteConversation = STConversation; STScript = NSObject; STScriptObject = NSObject; STScriptsManager = NSObject; STSelector = NSObject; STUndefinedObject = NSObject; }; title = { "NSInvocation+additions" = "NSInvocation class additions"; "NSObject+additions" = "NSObject+additions documentation"; STActor = "STActor class documentation"; STBundleInfo = "STBundleInfo class documentation"; STContext = "STEnvironment class reference"; STConversation = "STConversation class documentation"; STEngine = "STEngine class documentation"; STEnvironment = "STEnvironment class reference"; STEnvironmentDescription = "STEnvironmentDescription class documentation"; STExterns = "STExterns documentation"; STFileScript = "STFileScript class documentation"; STFunctions = "STFunctions documentation"; STLanguageManager = "STLanguageManager class documentation"; STMethod = "STMethod documentation"; STObjCRuntime = "STObjCRuntime documentation"; STObjectReference = "STObjectReference class documentation"; STRemoteConversation = "STRemoteConversation class documentation"; STScript = "STScript class documentation"; STScriptObject = "STScriptObject class documentation"; STScripting = "STScripting protocol documentation"; STScriptsManager = "STScriptsManager class documentation"; STSelector = "STSelector class documentation"; STUndefinedObject = "STUndefinedObject class documentation"; StepTalk = "StepTalk Documentation"; }; unitmethods = { "(STConversation)" = { "-interpretScript:" = STConversation; "-knownLanguages" = STConversation; "-language" = STConversation; "-result" = STConversation; "-resultByCopy" = STConversation; "-setLanguage:" = STConversation; }; "(STEnvironmentProcess)" = { "-createConversation" = STRemoteConversation; }; "(STMethod)" = { "-languageName" = STMethod; "-methodName" = STMethod; "-source" = STMethod; }; "(STScriptObject)" = { "-instanceVariableNames" = STScriptObject; }; "(STScripting)" = { "+classForScripting" = STScripting; "+className" = STScripting; "+isClass" = STScripting; "-classForScripting" = STScripting; "-className" = STScripting; "-isClass" = STScripting; }; "NSBundle(STAdditions)" = { "+allFrameworkNames" = STBundleInfo; "+bundleForFrameworkWithName:" = STBundleInfo; "+pathForFrameworkWithName:" = STBundleInfo; "+stepTalkBundleNames" = STBundleInfo; "+stepTalkBundleWithName:" = STBundleInfo; "-scriptingInfoDictionary" = STBundleInfo; }; "NSInvocation(STAdditions)" = { "+invocationWithTarget:selector:" = "NSInvocation+additions"; "+invocationWithTarget:selectorName:" = "NSInvocation+additions"; "-getArgumentAsObjectAtIndex:" = "NSInvocation+additions"; "-returnValueAsObject" = "NSInvocation+additions"; "-setArgumentAsObject:atIndex:" = "NSInvocation+additions"; }; "NSObject(STAdditions)" = { "-isNil" = "NSObject+additions"; "-isSame:" = "NSObject+additions"; "-notNil" = "NSObject+additions"; }; STActor = { "+actorInEnvironment:" = STActor; "-addMethod:" = STActor; "-environment" = STActor; "-initWithEnvironment:" = STActor; "-methodDictionary" = STActor; "-methodNames" = STActor; "-methodWithName:" = STActor; "-removeMethod:" = STActor; "-removeMethodWithName:" = STActor; "-setEnvironment:" = STActor; }; STBundleInfo = { "+infoForBundle:" = STBundleInfo; "-allClassNames" = STBundleInfo; "-initWithBundle:" = STBundleInfo; "-namedObjects" = STBundleInfo; "-objectReferenceDictionary" = STBundleInfo; "-publicClassNames" = STBundleInfo; }; STContext = { "-addNamedObjectsFromDictionary:" = STContext; "-createsUnknownObjects" = STContext; "-fullScriptingEnabled" = STContext; "-knownObjectNames" = STContext; "-objectDictionary" = STContext; "-objectReferenceForObjectWithName:" = STContext; "-objectWithName:" = STContext; "-parentContext" = STContext; "-removeObjectWithName:" = STContext; "-setCreatesUnknownObjects:" = STContext; "-setFullScriptingEnabled:" = STContext; "-setObject:forName:" = STContext; "-setParentContext:" = STContext; }; STConversation = { "-context" = STConversation; "-initWithContext:language:" = STConversation; "-language" = STConversation; "-runScriptFromString:" = STConversation; "-setLanguage:" = STConversation; }; STEngine = { "+engineForLanguage:" = STEngine; "-executeMethod:forReceiver:withArguments:inContext:" = STEngine; "-interpretScript:inContext:" = STEngine; "-methodFromSource:forReceiver:inContext:" = STEngine; "-understandsCode:" = STEngine; }; STEnvironment = { "+environmentWithDefaultDescription" = STEnvironment; "+environmentWithDescription:" = STEnvironment; "+sharedEnvironment" = STEnvironment; "-addClassesWithNames:" = STEnvironment; "-includeBundle:" = STEnvironment; "-includeFramework:" = STEnvironment; "-initWithDefaultDescription" = STEnvironment; "-initWithDescription:" = STEnvironment; "-loadModule:" = STEnvironment; "-registerObjectFinder:name:" = STEnvironment; "-registerObjectFinderNamed:" = STEnvironment; "-removeObjectFinderWithName:" = STEnvironment; "-translateSelector:forReceiver:" = STEnvironment; }; STEnvironmentDescription = { "+defaultDescriptionName" = STEnvironmentDescription; "+descriptionFromDictionary:" = STEnvironmentDescription; "+descriptionWithName:" = STEnvironmentDescription; "-classes" = STEnvironmentDescription; "-frameworks" = STEnvironmentDescription; "-initFromDictionary:" = STEnvironmentDescription; "-initWithName:" = STEnvironmentDescription; "-modules" = STEnvironmentDescription; "-objectFinders" = STEnvironmentDescription; "-updateClassWithName:description:" = STEnvironmentDescription; "-updateFromDictionary:" = STEnvironmentDescription; }; STFileScript = { "+scriptWithFile:" = STFileScript; "-compareByLocalizedName:" = STFileScript; "-fileName" = STFileScript; "-initWithFile:" = STFileScript; "-localizedName" = STFileScript; "-scriptDescription" = STFileScript; "-scriptName" = STFileScript; }; STLanguageManager = { "+defaultManager" = STLanguageManager; "-availableLanguages" = STLanguageManager; "-bundleForLanguage:" = STLanguageManager; "-createEngineForLanguage:" = STLanguageManager; "-defaultLanguage" = STLanguageManager; "-engineClassForLanguage:" = STLanguageManager; }; STObjectReference = { "-identifier" = STObjectReference; "-initWithIdentifier:target:" = STObjectReference; "-object" = STObjectReference; "-setObject:" = STObjectReference; "-target" = STObjectReference; }; STRemoteConversation = { "-close" = STRemoteConversation; "-initWithEnvironmentName:host:language:" = STRemoteConversation; "-open" = STRemoteConversation; }; STScript = { "+scriptWithSource:language:" = STScript; "-initWithSource:language:" = STScript; "-language" = STScript; "-setLanguage:" = STScript; "-setSource:" = STScript; "-source" = STScript; }; STScriptObject = { "+scriptObject" = STScriptObject; "-addMethod:" = STScriptObject; "-environment" = STScriptObject; "-initWithInstanceVariableNames:" = STScriptObject; "-instanceVariableNames" = STScriptObject; "-methodDictionary" = STScriptObject; "-methodNames" = STScriptObject; "-methodWithName:" = STScriptObject; "-objectForVariable:" = STScriptObject; "-removeMethod:" = STScriptObject; "-removeMethodWithName:" = STScriptObject; "-setEnvironment:" = STScriptObject; "-setObject:forVariable:" = STScriptObject; }; STScriptsManager = { "+defaultManager" = STScriptsManager; "-allScripts" = STScriptsManager; "-initWithDomainName:" = STScriptsManager; "-scriptSearchPaths" = STScriptsManager; "-scriptWithName:" = STScriptsManager; "-scriptsDomainName" = STScriptsManager; "-setScriptSearchPaths:" = STScriptsManager; "-setScriptSearchPathsToDefaults" = STScriptsManager; "-validScriptSearchPaths" = STScriptsManager; }; STSelector = { "-initWithName:" = STSelector; "-initWithSelector:" = STSelector; "-selectorName" = STSelector; "-selectorValue" = STSelector; }; }; variable = { STGenericException = STExterns; STInternalInconsistencyException = STExterns; STInvalidArgumentException = STExterns; STLanguageBundleExtension = STExterns; STLanguageBundlesDirectory = STExterns; STLanguagesConfigFile = STExterns; STLibraryDirectory = STExterns; STMallocZone = STExterns; STModuleExtension = STExterns; STModulesDirectory = STExterns; STNil = STExterns; STScriptExtension = STExterns; STScriptingEnvironmentExtension = STExterns; STScriptingEnvironmentsDirectory = STExterns; STScriptingException = STExterns; STScriptsDirectory = STExterns; }; }StepTalk-0.10.0/Documentation/Reference/STBundleInfo.html0000664000175000017500000002177514633027767022327 0ustar yavoryavor STBundleInfo class documentation Up

STBundleInfo class documentation

Authors

Stefan Urbanek

Copyright: (C) 2002 Free Software Foundation

Software documentation for the STBundleInfo class

STBundleInfo : NSObject

Declared in:
StepTalk/STBundleInfo.h

Description forthcoming.


Instance Variables

Method summary

infoForBundle: 

+ (id) infoForBundle: (NSBundle*)aBundle;

Description forthcoming.


allClassNames 

- (NSArray*) allClassNames;

Return an array of all class names.


initWithBundle: 

- (id) initWithBundle: (NSBundle*)aBundle;
This is a designated initialiser for the class.

Initialize info with bundle aBundle.


namedObjects 

- (NSDictionary*) namedObjects;

Return a dictionary of named objects. Named objects are get from scripting info class specified in ScriptingInfo.plist.


objectReferenceDictionary 

- (NSDictionary*) objectReferenceDictionary;

This method is for application scripting support. Return dictionary containing object references where a key is name of an object and value is a path to the object relative to application delegate.


publicClassNames 

- (NSArray*) publicClassNames;

Description forthcoming.




Instance Variables for STBundleInfo Class

allClasses

@protected NSArray* allClasses;

Description forthcoming.


bundle

@protected NSBundle* bundle;

Description forthcoming.


objectReferenceDictionary

@protected NSDictionary* objectReferenceDictionary;

Description forthcoming.


publicClasses

@protected NSArray* publicClasses;

Description forthcoming.


scriptingInfoClass

@protected Class scriptingInfoClass;

Description forthcoming.


scriptingInfoClassName

@protected NSString* scriptingInfoClassName;

Description forthcoming.


useAllClasses

@protected BOOL useAllClasses;

Description forthcoming.





Software documentation for the NSBundle(STAdditions) category

NSBundle(STAdditions)

Declared in:
StepTalk/STBundleInfo.h

Description forthcoming.

Method summary

allFrameworkNames 

+ (NSArray*) allFrameworkNames;

Return names of all available frameworks in the system.


bundleForFrameworkWithName: 

+ (NSBundle*) bundleForFrameworkWithName: (NSString*)aName;

Return bundle for framework with name aName.


pathForFrameworkWithName: 

+ (NSString*) pathForFrameworkWithName: (NSString*)aName;

Return path for framework with name aName .


stepTalkBundleNames 

+ (NSArray*) stepTalkBundleNames;

Get list of all StepTalk bundles from Library/StepTalk/Bundles


stepTalkBundleWithName: 

+ (id) stepTalkBundleWithName: (NSString*)moduleName;

Description forthcoming.


scriptingInfoDictionary 

- (NSDictionary*) scriptingInfoDictionary;

Description forthcoming.



Up
StepTalk-0.10.0/Documentation/Reference/STEnvironment.gsdoc0000664000175000017500000001323714633027767022733 0ustar yavoryavor STEnvironment class reference 2002 Free Software Foundation Software documentation for the STEnvironment class StepTalk/STEnvironment.h Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. environmentWithDefaultDescription Creates and initialises new scripting environment using default description. environmentWithDescription: aDescription Creates and initialises scripting environment using environment description description. sharedEnvironment Creating environment
Returns an instance of the scripting environment that is shared in the scope of actual application or process.
addClassesWithNames: names Add classes specified by the names in the names array. This method is used internally to add classes provided by modules. includeBundle: aBundle Include scripting capabilities advertised by the bundle aBundle. If the bundle is already loaded, nothing happens. includeFramework: frameworkName Include scripting capabilities advertised by the framework with name frameworkName. If the framework is already loaded, nothing happens. initWithDefaultDescription Initialises scripting environment using default description. initWithDescription: aDescription Initialises scripting environment using scripting description aDescription. loadModule: moduleName Modules
Load StepTalk module with the name moduleName. Modules are stored in the Library/StepTalk/Modules directory.
registerObjectFinder: finder name: name Distributed objects
Register object finder finder under the name name
registerObjectFinderNamed: name Register object finder named name. This method will try to find an object finder bundle in Library/StepTalk/Finders directories. removeObjectFinderWithName: name Remove object finder with name name translateSelector: aString forReceiver: anObject Selector translation
StepTalk-0.10.0/Documentation/Reference/STMethod.gsdoc0000664000175000017500000000221314633027767021637 0ustar yavoryavor STMethod documentation 2003 Free Software Foundation Software documentation for the STMethod protocol StepTalk/STMethod.h Description forthcoming. languageName Description forthcoming. methodName Description forthcoming. source Description forthcoming. StepTalk-0.10.0/Documentation/Reference/STUndefinedObject.gsdoc0000664000175000017500000000133114633027767023447 0ustar yavoryavor STUndefinedObject class documentation 2002 Free Software Foundation Software documentation for the STUndefinedObject class StepTalk/STUndefinedObject.h Description forthcoming. StepTalk-0.10.0/Documentation/Reference/STFunctions.gsdoc0000664000175000017500000000220114633027767022364 0ustar yavoryavor STFunctions documentation 2002 Free Software Foundation STFunctions functions

resourceDir extension Description forthcoming. name resourceDir extension Description forthcoming. Description forthcoming.
StepTalk-0.10.0/Documentation/Reference/STFileScript.gsdoc0000664000175000017500000000571614633027767022476 0ustar yavoryavor STFileScript class documentation stefanurbanek@yahoo.fr 2002 Stefan Urbanek Software documentation for the STFileScript class StepTalk/STFileScript.h Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. scriptWithFile: file Description forthcoming. compareByLocalizedName: aScript Compare scripts by localized name. fileName Return file name of the receiver. initWithFile: aFile Create a new script from file aFile>. Script information will be read from 'aFile.stinfo' file containing a dictionary property list. localizedName Returns localized name of the receiver script. scriptDescription Returns localized description of the script. scriptName Returns a script name by which the script is identified StepTalk-0.10.0/Documentation/Reference/STEngine.gsdoc0000664000175000017500000000505714633027767021635 0ustar yavoryavor STEngine class documentation 2002 Free Software Foundation Software documentation for the STEngine class StepTalk/STEngine.h STEngine is abstract class for language engines used to intepret scripts. engineForLanguage: name Instance creation
Return a scripting engine for language with specified name. The engine is get from default language manager.
executeMethod: aMethod forReceiver: anObject withArguments: args inContext: env Description forthcoming. interpretScript: script inContext: context 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. methodFromSource: sourceString forReceiver: receiver inContext: env Description forthcoming. understandsCode: code Description forthcoming.
StepTalk-0.10.0/Documentation/Reference/STObjCRuntime.gsdoc0000664000175000017500000000417514633027767022611 0ustar yavoryavor STObjCRuntime documentation 2002 Free Software Foundation STObjCRuntime functions

Description forthcoming. Description forthcoming. classNames Description forthcoming. sel Description forthcoming. Description forthcoming. sel Description forthcoming. aString Description forthcoming. val Description forthcoming. sel Description forthcoming.
StepTalk-0.10.0/Documentation/Reference/STScripting.gsdoc0000664000175000017500000000405314633027767022365 0ustar yavoryavor STScripting protocol documentation 2002 Free Software Foundation Software documentation for the NSObject(STScripting) category StepTalk/STScripting.h STScripting Description forthcoming. Software documentation for the STScripting protocol StepTalk/STScripting.h Description forthcoming. classForScripting Description forthcoming. className Description forthcoming. isClass Description forthcoming. classForScripting Description forthcoming. className Description forthcoming. isClass Description forthcoming. StepTalk-0.10.0/Documentation/Reference/STBundleInfo.gsdoc0000664000175000017500000001210314633027767022443 0ustar yavoryavor STBundleInfo class documentation 2002 Free Software Foundation Software documentation for the STBundleInfo class StepTalk/STBundleInfo.h Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. infoForBundle: aBundle Description forthcoming. allClassNames Return an array of all class names. initWithBundle: aBundle Initialize info with bundle aBundle. namedObjects Return a dictionary of named objects. Named objects are get from scripting info class specified in ScriptingInfo.plist. objectReferenceDictionary This method is for application scripting support. Return dictionary containing object references where a key is name of an object and value is a path to the object relative to application delegate. publicClassNames Description forthcoming. Software documentation for the NSBundle(STAdditions) category StepTalk/STBundleInfo.h Description forthcoming. allFrameworkNames Return names of all available frameworks in the system. bundleForFrameworkWithName: aName Return bundle for framework with name aName. pathForFrameworkWithName: aName Return path for framework with name aName . stepTalkBundleNames Get list of all StepTalk bundles from Library/StepTalk/Bundles stepTalkBundleWithName: moduleName Description forthcoming. scriptingInfoDictionary Description forthcoming. StepTalk-0.10.0/Documentation/Reference/STScriptsManager.html0000664000175000017500000001371314633027767023215 0ustar yavoryavor STScriptsManager class documentation Up

STScriptsManager class documentation

Authors

Stefan Urbanek

Copyright: (C) 2002 Stefan Urbanek

Software documentation for the STScriptsManager class

STScriptsManager : NSObject

Declared in:
StepTalk/STScriptsManager.h

Description forthcoming.


Instance Variables

Method summary

defaultManager 

+ (id) defaultManager;

Returns default scripts manager for current process (application or tool).


allScripts 

- (NSArray*) allScripts;

Return list of all scripts for managed domain.


initWithDomainName: 

- (id) initWithDomainName: (NSString*)name;
This is a designated initialiser for the class.

Initializes the receiver to be used with domain named name. If name is nil, default scripts domain name will be used.


scriptSearchPaths 

- (NSArray*) scriptSearchPaths;

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.


scriptWithName: 

- (STFileScript*) scriptWithName: (NSString*)aString;

Get a script with name aString for current scripting domain.


scriptsDomainName 

- (NSString*) scriptsDomainName;

Return name of script manager domain.


setScriptSearchPaths: 

- (void) setScriptSearchPaths: (NSArray*)anArray;

Set script search paths to anArray.


setScriptSearchPathsToDefaults 

- (void) setScriptSearchPathsToDefaults;

Description forthcoming.


validScriptSearchPaths 

- (NSArray*) validScriptSearchPaths;

Return script search paths that are valid. That means that path exists and is a directory.




Instance Variables for STScriptsManager Class

scriptSearchPaths

@protected NSArray* scriptSearchPaths;

Description forthcoming.


scriptsDomainName

@protected NSString* scriptsDomainName;

Description forthcoming.






Up
StepTalk-0.10.0/Documentation/Reference/STExterns.gsdoc0000664000175000017500000000563114633027767022056 0ustar yavoryavor STExterns documentation 2002 Free Software Foundation STExterns variables

Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming.
StepTalk-0.10.0/Documentation/Reference/STLanguageManager.html0000664000175000017500000001232614633027767023310 0ustar yavoryavor STLanguageManager class documentation Up

STLanguageManager class documentation

Authors

Generated by stevko

Software documentation for the STLanguageManager class

STLanguageManager : NSObject

Declared in:
StepTalk/STLanguageManager.h

Description forthcoming.


Instance Variables

Method summary

defaultManager 

+ (STLanguageManager*) defaultManager;

Description forthcoming.


availableLanguages 

- (NSArray*) availableLanguages;

Description forthcoming.


bundleForLanguage: 

- (NSBundle*) bundleForLanguage: (NSString*)language;

Description forthcoming.


createEngineForLanguage: 

- (STEngine*) createEngineForLanguage: (NSString*)language;

Description forthcoming.


defaultLanguage 

- (NSString*) defaultLanguage;

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.


engineClassForLanguage: 

- (Class) engineClassForLanguage: (NSString*)language;

Return an engine class for specified language. The class lookup is as follows:




Instance Variables for STLanguageManager Class

engineClasses

@protected NSMutableDictionary* engineClasses;

Description forthcoming.


fileTypes

@protected NSMutableDictionary* fileTypes;

Description forthcoming.


languageBundles

@protected NSMutableDictionary* languageBundles;

Description forthcoming.


languageInfos

@protected NSMutableDictionary* languageInfos;

Description forthcoming.


languages

@protected NSMutableArray* languages;

Description forthcoming.






Up
StepTalk-0.10.0/Documentation/Reference/STEnvironmentDescription.gsdoc0000664000175000017500000001062614633027767025136 0ustar yavoryavor STEnvironmentDescription class documentation 2002 Free Software Foundation Software documentation for the STEnvironmentDescription class StepTalk/STEnvironmentDescription.h Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. defaultDescriptionName Description forthcoming. descriptionFromDictionary: dictionary Description forthcoming. descriptionWithName: descriptionName Description forthcoming. classes Description forthcoming. frameworks Description forthcoming. initFromDictionary: def Description forthcoming. initWithName: defName Description forthcoming. modules Description forthcoming. objectFinders Description forthcoming. updateClassWithName: className description: def Description forthcoming. updateFromDictionary: def Description forthcoming. StepTalk-0.10.0/Documentation/Reference/STMethod.html0000664000175000017500000000356214633027767021514 0ustar yavoryavor STMethod documentation Up

STMethod documentation

Authors

Stefan Urbanek

Copyright: (C) 2003 Free Software Foundation

Software documentation for the STMethod protocol

STMethod

Declared in:
StepTalk/STMethod.h

Description forthcoming.

Method summary

languageName 

- (NSString*) languageName;

Description forthcoming.


methodName 

- (NSString*) methodName;

Description forthcoming.


source 

- (NSString*) source;

Description forthcoming.



Up
StepTalk-0.10.0/Documentation/Reference/STScriptObject.html0000664000175000017500000002126714633027767022671 0ustar yavoryavor STScriptObject class documentation Up

STScriptObject class documentation

Authors

Generated by stevko

Software documentation for the STScriptObject class

STScriptObject : NSObject

Declared in:
StepTalk/STScriptObject.h
Conforms to:
NSCoding
STScriptObject

Description forthcoming.


Instance Variables

Method summary

scriptObject 

+ (id) scriptObject;

Return new instance of script object without any instance variables


addMethod: 

- (void) addMethod: (id<STMethod>)aMethod;

Description forthcoming.


environment 

- (STEnvironment*) environment;

Description forthcoming.


initWithInstanceVariableNames: 

- (id) initWithInstanceVariableNames: (NSString*)names;

Description forthcoming.


instanceVariableNames 

- (NSArray*) instanceVariableNames;

Description forthcoming.


methodDictionary 

- (NSDictionary*) methodDictionary;

Description forthcoming.


methodNames 

- (NSArray*) methodNames;

Description forthcoming.


methodWithName: 

- (id<STMethod>) methodWithName: (NSString*)aName;

Description forthcoming.


objectForVariable: 

- (id) objectForVariable: (NSString*)aName;

Description forthcoming.


removeMethod: 

- (void) removeMethod: (id<STMethod>)aMethod;

Description forthcoming.


removeMethodWithName: 

- (void) removeMethodWithName: (NSString*)aName;

Description forthcoming.


setEnvironment: 

- (void) setEnvironment: (STEnvironment*)env;

Set object's environment. Note: This method should be replaced by some other, more clever mechanism.


setObject: forVariable: 

- (void) setObject: (id)anObject forVariable: (NSString*)aName;

Description forthcoming.




Instance Variables for STScriptObject Class

environment

@protected STEnvironment* environment;

Description forthcoming.


ivars

@protected NSMutableDictionary* ivars;

Description forthcoming.


methodDictionary

@protected NSMutableDictionary* methodDictionary;

Description forthcoming.





Software documentation for the STScriptObject protocol

STScriptObject

Declared in:
StepTalk/STScriptObject.h

Description forthcoming.

Method summary

instanceVariableNames 

- (NSArray*) instanceVariableNames;

Description forthcoming.



Up
StepTalk-0.10.0/Documentation/Reference/STScript.gsdoc0000664000175000017500000000457214633027767021675 0ustar yavoryavor STScript class documentation stefanurbanek@yahoo.fr 2002 Stefan Urbanek Software documentation for the STScript class StepTalk/STScript.h Description forthcoming. Description forthcoming. Description forthcoming. scriptWithSource: aString language: lang Description forthcoming. initWithSource: aString language: lang Description forthcoming. language Returns language of the script. setLanguage: name Set language of the script. setSource: aString Description forthcoming. source Description forthcoming. StepTalk-0.10.0/Documentation/Reference/StepTalk.html0000664000175000017500000000573214633027767021555 0ustar yavoryavor StepTalk Documentation

StepTalk Documentation

Authors

Stefan Urbanek (stefan@agentfarms.net)

Version: 0.10.0

Date: 2005 Sep 5

Introduction

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. intro


StepTalk-0.10.0/Documentation/Reference/STLanguageManager.gsdoc0000664000175000017500000001155214633027767023443 0ustar yavoryavor STLanguageManager class documentation Software documentation for the STLanguageManager class StepTalk/STLanguageManager.h Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. defaultManager Description forthcoming. availableLanguages Description forthcoming. bundleForLanguage: language Description forthcoming. createEngineForLanguage: language Description forthcoming. defaultLanguage 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. engineClassForLanguage: language 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
infoForLanguage: language Description forthcoming. knownFileTypes Description forthcoming. languageForFileType: type Description forthcoming. registerLanguage: language engineClass: class info: info Description forthcoming. registerLanguagesFromBundle: bundle Description forthcoming. removeLanguage: language Description forthcoming.
StepTalk-0.10.0/Documentation/Reference/STActor.gsdoc0000664000175000017500000000656014633027767021500 0ustar yavoryavor STActor class documentation 2002 Free Software Foundation Software documentation for the STActor class StepTalk/STActor.h NSCoding Description forthcoming. Description forthcoming. Description forthcoming. Description forthcoming. actorInEnvironment: env Return new instance of script object without any instance variables addMethod: aMethod Description forthcoming. environment Description forthcoming. initWithEnvironment: env Description forthcoming. methodDictionary Description forthcoming. methodNames Description forthcoming. methodWithName: aName Description forthcoming. removeMethod: aMethod Description forthcoming. removeMethodWithName: aName Description forthcoming. setEnvironment: env Set object's environment. Note: This method should be replaced by some other, more clever mechanism. StepTalk-0.10.0/Documentation/Smalltalk.txt0000664000175000017500000001133714633027767017725 0ustar yavoryavorSmalltalk language extensions to NSObjects ------------------------------------------ Contents: 1. Source 2. Symbolic Selectors 3. Iterators and cycles 4. Exception handling 1. Source --------- Smalltalk script can be list of methods or just list of statements. List of statements is like single method without method name. List of methods --------------- Source begins with '[|' (left square bracket) and is followed by optional list of script variables. Methods are separated by '!' and are encoles by ']' (right square bracket). Example without vars: [| main self other. ^self ! other Transcript showLine:'This is other'. ! ] Example with vars: [| :var1 :var2 main "Your code here...". ^self ! other "Your code here...". ^self ! ] Simple script (statements) -------------------------- Simple script is just list of smalltalk statements. It is like contents of one method. Why source begins with '[|' and not just '['? --------------------------------------------- Look at this example: [one two three] It has more meanings. It can be: - list of methods with one method named 'one'. 'two' is target object and 'three' is a message. or - simple statement with block. 'one' is target object and 'two' and 'three' are messages. 2. Symbolic selectors --------------------- In StepTalk symbolic selectors are mapped to normal selectors. Comparison operators (NSObject) ------------------------------- Symb. sel. Real sel. ------------------------------------- = isEqual: == isSame: ~= notEqual: ~~ notSame: < isLessThan: > isGreatherThan: <= isLessOrEqualThan: >= isGreatherOrEqualThan: Target type Selector Argument Type Real Selector ----------------------------------------------------------------------- NSArray @ NSNumber objectAtIndex: NSArray , any arrayByAddingObject: NSArray + any arrayByAddingObject: NSMutableArray += any addObject: NSMutableArray -= any removeObject: NSDictionary @ any objectForKey: NSUserDefaults @ any objectForKey: NSString , NSString stringByAppendingString: NSString / NSString stringByAppendingPathComponent: NSString @ NSNumber characterAtIndex: NSMutableString += NSString appendString: NSSet < NSSet isSubsetOfSet: NSMutableSet += any addObject: NSMutableSet -= any removeObject: NSDate - NSDate timeIntervalSinceDate: NSNumber +,-,*,/ NSNumber add:,subtract:,multiply:,divide: Special selectors to create objects from two NSNumbers Symb.sel. Real sel. Result Methods ------------------------------------------------------- <> rangeWith: range location, length @ pointWith: point x, y @@ sizeWith: size width, height Examples: str := 'This is string.'. substr := str substringWithRange: (8 <> 3) range := str rangeOfString: 'str'. newRange := ( (range location) <> 6). 3. Iterator and cycles ---------------------- Cycles ------ To create a cycle, you may use whileTrue: or whileFalse: on NSBlock conditionBlock whileTrue: toDoBlock. To use a sequence of numbers, you may use to:do: or to:step:do: on NSNumber min to: max do: block min to: max step: step do: block Array iterators --------------- Following methods will iterate through all objects in receiver. Selector Description ------------------------------------------------------------------------------- do: Evaluate block for each object in array and return last evaluated expression select: Create new array which will contain those objects from receiver, for which value of block was true reject: Create new array which will contain those objects from receiver, for which value of block was false collect: Create new array from block return values. detect: Return first object for which block evaluation result is true. Othervise return nil. 4. Exception handling --------------------- If you want to handle an exception, you may do so by using blocks. You send handler: message to guarded block. guardedBlock handler: handlerBlock. If exception occures in guarded block, then handler block is evaluated. StepTalk-0.10.0/Documentation/Modules.txt0000664000175000017500000000207614633027767017411 0ustar yavoryavorModules ------- Here is a brief list of available modules and list of what they provide. To load a module use: Environment loadModule:'moduleName' or put name of a module into a Modules list into a scripting environment you use, like: ~/.../Library/StepTalk/Environments/My.stenv { Use = (Foundation); Modules = (moduleName); } Foundation - public Foundation/gnustep-base classes - extern variables, like exception and notification names AppKit - public AppKit/gnustep-gui classes - extern variables ObjectiveC - object named 'Runtime' methods: - classWithName:string - nameOfClass:class - selectorsContainingString: returns an array of selectors that contain specified string - implementorsOfSelector: returns an array of all classes that implement specified selector - additions to NSObject + instanceMethodNames - methodNames + methodNames + instanceVariableNames StepTalk-0.10.0/Documentation/Environment.txt0000664000175000017500000000217514633027767020305 0ustar yavoryavorScripting environment descriptions ---------------------------------- Property list containing dictionary with keys: Name Name of scripting description Use Array of scripting descriptions to include. Modules Array of modules to be loaded Finders Array of object finder names to be used Behaviours Dictionary of behaviour descriptions, that can be adopted by a class or another behaviour. Classes Dictionary of class descriptions. DefaultRestriction Aliases object name aliases (not impl.) Behaviours ---------- Use Adopt behaviour SymbolicSelectors Map of symbolic selectors. Aliases Method name aliases. AllowMethods List of allowed methods. DenyMethods List of denied methods. Classes ------- (Same items as in Behaviours) Super Super class name. Restriction Values: DenyAll, AllowAll "DenyAll" deny all methods except those in "AllowMethods" list or in "Aliases" "AllowAll" allow all methods except those in "DenyMehods" list. StepTalk-0.10.0/Documentation/Bundles.txt0000664000175000017500000000170014633027767017366 0ustar yavoryavorBundles ------- Any bundle, including an application or a framework, can provide information about scripting. Info dictionary --------------- STClasses - array of public classes STScriptingInfoClass - name of a scripting controller. Default value is bundleNameScriptingInfo. (STExportAllClasses - exports all classes (ignore STClasses)) (not used yet) Scripting Controller -------------------- Scripting controller is a class object that provides information about bundle scripting abilities. At this time it provides information only about available named objects. Informal protocol: + (NSDictionary *)namedObjectsForScripting; Returns a dictionary with named objects. TODO: STBundle methods ---------------- + bundleWithApplication: Search in */Applications + bundleWithFramework: Search in */Library/Frameworks + bundleWithName: Search in */Library/Bundles StepTalk-0.10.0/Documentation/ApplicationScripting.txt0000664000175000017500000000733114633027767022126 0ustar yavoryavorApplication Scripting --------------------- Scripting for applications is provided by the Application Scripting Bundle. The bundle is installed together with StepTalk. Contents: Creating a scriptable application Scripts Script Metafile Example Creating a scriptable application --------------------------------- 1 Think of objects you want to provide for scripting. 2 Make classes available in ScriptingInfo.plist: { Classes = ( MessageComposition, InternetAddress ); } Add this line to your makefile: MyApp_RESOURCE_FILES = ScriptingInfo.plist 3 Include bundle loading code Copy files: STScriptingSupport.h STScriptingSupport.m from ApplicationScripting/Support directory to your project and add following line to your makefile: MyApp_OBJC_FILES += STScriptingSupport.m 4 Make scripting available to the user #import "STScriptingSupport.h" ... if([NSApp isScriptingSupported]) { NSMenuItem *scriptingItem = [menu addItemWithTitle: @"Scripting" action: NULL keyEquivalent: @""]; [scriptingItem setSubmenu: [NSApp scriptingMenu]]; } ... Scripts ------- Application is looking for scripts in: - applications resource directory ApplicationName.app/Resources/Scripts - application specific scripts in all GNUstep Library directories */Library/StepTalk/Scripts/ApplicationName - shared scriptins in all GNUstep Library directories */Library/StepTalk/Scripts/Shared - resource directories of all bundles loaded by the application BundleName.bundle/Resources/Scripts (*) can be any of GNUstep System, Local, Network or user path Script metafile --------------- Each script may have accopmpaining file containing information about script. This information file is optional, has extension .stinfo and its name is script name with that extension. For example if script name is insertDate.st then information file is insertDate.st.stinfo. File may contain: - script name that will be shown to the user (localizable) - script description (localizable) - scripting language used for script -- overrides language guess based on file extension The file is dictionary property list. Kes are: Name - Name of a script that is shown to the user. It can be localized. Description - Description of a script. It can be localized. Language - Scripting language name used in script. This value overrides language guess based on script file extension. Localizable keys have values that are dictionaries: { Default = { Name = "Some name"; Description = "Some description"; }; English = { Name = "Some name in english"; Description = "Some description in english"; }; French = { Name = "Some name in french"; Description = "Some description in french"; }; } Example ------- 1. Create a script file test.st with contents: Transcript showLine:'It works.' 2. Create (optional) meta file test.st.stinfo with contents: { English = { Description = "This is a script for testing if scripting works"; Name = "Test"; }; } 3. Put both files into */Library/StepTalk/Scripts/your_application_name 4. Then run your application, open scripts panel, select the script and run it by doubleclicking or by pressing the 'Run' button. 5. Then look at the transcript window for the result. StepTalk-0.10.0/Documentation/DOTemplate.plist0000664000175000017500000000110514633027767020303 0ustar yavoryavor/* DOTemplate.plist This file contains template for a distributed object in the distributed environment. File name is name of the object used in the environment. DO files should reside in: any_gnustep_root/Library/StepTalk/DistributedObjects */ { Host = "default host name"; Hosts = ( list of hosts to be searched ); Tool = "name of a tool that will register the object"; Arguments = (tool arguments); Name = "name of the object to be connected"; Wait = seconds to wait before connection after the tool is launched; } StepTalk-0.10.0/Documentation/Languages.txt0000664000175000017500000000070114633027767017700 0ustar yavoryavorLanguages --------- How to create a language bundle? In directory Languages/Smalltalk/ see files SmalltalkEngine.[hm] SmalltalkInfo.plist and in STBytecodeInterpreter.m see method - sendSelectorAtIndex:withArgCount: LanguageInfo.plist ------------------ STLanguageName Language name that will be used instead of bundle name. STEngine; Engine class name. If there is no such class, then princicpial class will be used. StepTalk-0.10.0/Documentation/HowTo.txt0000664000175000017500000000252014633027767017033 0ustar yavoryavorStepTalk HowTo -------------- NOTE: This file has to be written. You may consult StepTalk header files. How to create scripting environment? ------------------------------------ STEnvironment *env; env = [STEnvironment sharedEnvironment]; or env = [STEnvironment environmentWithDefaultDescription]; or env = [STEnvironment environmentWithDescription:description]; How to register named objects in the scripting environment? ----------------------------------------------------------- [env setObject:object forName:@"ObjectName"]; like in: [env setObject:transcript forName:@"Transcript"]; See: STEnvironment, STContext How to create a scripting engine? --------------------------------- STEngine *engine; engine = [STEngine engineForLanguage:langName]; See: STLanguageManager, STEngine How to execute a code? -------------------- STEngine *engine; id result; NS_DURING result = [engine interpretScript:string inContext:env]; NS_HANDLER /* handle the exception */ NS_ENDHANDLER See: STEngine, NSException How to create a language bundle? -------------------------------- Languages/Smalltalk/SmalltalkEngine.m Languages/Smalltalk/SmalltalkEngine.h Languages/Smalltalk/STBytecodeInterpreter.m - sendSelectorAtIndex:withArgCount: StepTalk-0.10.0/Documentation/ObjectFinders.txt0000664000175000017500000000043614633027767020520 0ustar yavoryavorObject Finders -------------- STEnvironment provides mechanisms for named objects. Object finders are objects that will find an object by a name. The lookup is as follows: 1. look for object in environment's object pool 2. look for object using all environment's finders StepTalk-0.10.0/Documentation/Defaults.txt0000664000175000017500000000063614633027767017550 0ustar yavoryavorStepTalk Defaults ----------------- NOTE: Defaults changed. For example, to set default language name: > defaults write NSGlobalDomain STDefaultLanguageName Smalltalk or to set scripting environment specific to an application: > defaults write ApplicationName STDefaultEnvironmentDescriptionName Safe Name: STDefaultLanguageName Type: String Name: STDefaultEnvironmentDescriptionName Type: String StepTalk-0.10.0/Documentation/ObjCTypes.txt0000664000175000017500000000030014633027767017627 0ustar yavoryavorConversion between objects and Objective-C types ------------------------------------------------ Number types - NSNumber char * - NSString id, class - no conversion structures - STStructure StepTalk-0.10.0/ChangeLog0000664000175000017500000010417014633027767014177 0ustar yavoryavor2020-06-29 Wolfgang Lux * Frameworks/StepTalk/GNUmakefile: Specify dependent libraries while linking regardless of the target OS. 2018-03-20 Graham Lee * Documentation/HowTo.txt: Document methods that still exist. * Frameworks/StepTalk/STEngine.m (engineForLanguageWithName:): * Languages/Smalltalk/SmalltalkEngine.m (multiple methods): Correct spelling of 'deprecated' in log messages. 2018-02-18 Wolfgang Lux * Frameworks/StepTalk/STObjCRuntime.m (selector_types): Fix for generation of selector types on 64-bit architectures. 2017-12-27 Wolfgang Lux * Frameworks/StepTalk/STEnvironmentDescription.m (defaultDescriptionName): Remove redundant method call. * Frameworks/StepTalk/STBundleInfo.m (allFrameworkNames, pathForFrameworkWithName:): * Tools/STExecutor.m (executeScript:withArguments:): Use NULL instead of NO where a pointer argument is expected. * Frameworks/StepTalk/STConversation.m (knownLanguages, interpretScript:): * Frameworks/StepTalk/STRemoteConversation.m (interpretScript:): * Frameworks/StepTalk/STUndefinedObject.m (release): Fix inconsistent distributed object modifiers reported by clang. 2015-10-23 Wolfgang Lux * Frameworks/StepTalk/STObjCRuntime.m (selector_types): Fix broken array initialization, which meant that incorrect method signatures were generated for methods with more than four arguments. 2014-11-02 Wolfgang Lux * Frameworks/StepTalk/STRemoteConversation.m (-initWithEnvironmentName:host:language:, -open, -setLanguage:, -language): Correctly initialize the scripting language used in a remote conversation. 2014-11-02 Wolfgang Lux * Frameworks/StepTalk/STRemoteConversation.m (-open): Force use of a socket port name server to look up servers on other hosts. 2014-11-02 Wolfgang Lux * Frameworks/StepTalk/STRemoteConversation.m (-connectionDidDie:): Fix leak of the proxy and environmentProcess attributes when a connection died. 2014-11-01 Wolfgang Lux * Frameworks/StepTalk/NSObject+additions.h (-notEqual:, -notSame:): * Frameworks/StepTalk/NSObject+additions.m (-notEqual:, -notSame:): Add method implementations for the symbolic selectors ~= and ~~, which are defined in the SymbolicSelectors.stenv environment. 2014-11-01 Wolfgang Lux * Frameworks/StepTalk/STClassInfo.m (-dealloc): Release superclass and superclassName attributes. * Frameworks/StepTalk/STEnvironment.m (-initWithDescription:): Remove duplicated RETAIN statement. 2013-05-27 Wolfgang Lux * Frameworks/StepTalk/NSInvocation+additions.m (STGetValueOfTypeFromObject): Fix marshaling for arguments with type (char*). * Frameworks/StepTalk/NSInvocation+additions.m (STObjectFromValueOfType, STGetValueOfTypeFromObject): Skip const qualifiers in types. 2013-05-26 Wolfgang Lux * Frameworks/StepTalk/STActor.m (-instanceVariables): Fix typo in method name. * Frameworks/StepTalk/STActor.m (-addInstanceVariable:): * Frameworks/StepTalk/STActor.m (-removeInstanceVariable:): New methods to add and remove instance variables. * Frameworks/StepTalk/STActor.h (-instanceVariableNames): * Frameworks/StepTalk/STActor.h (-setInstanceVariables:): * Frameworks/StepTalk/STActor.h (-instanceVariables): * Frameworks/StepTalk/STActor.h (-addInstanceVariable:): * Frameworks/StepTalk/STActor.h (-removeInstanceVariable:): Add methods to the public API. 2013-05-26 Wolfgang Lux * Tools/STExecutor.h: * Examples/Shell/STShell+output.m: * Examples/Shell/stshell_tool.m: int->NSInteger transition 2013-05-26 Wolfgang Lux * Modules/AppKit/AppKitConstants.list: * Modules/AppKit/AppKitConstants.m: * Modules/AppKit/AppKitEvents.list: * Modules/AppKit/AppKitEvents.m: * Modules/AppKit/AppKitExceptions.m: * Modules/AppKit/AppKitNotifications.m: * Modules/AppKit/header.m: * Modules/Foundation/FoundationConstants.list: * Modules/Foundation/FoundationConstants.m: * Modules/Foundation/header.m: * Modules/GDL2/header.m: * Modules/SQLClient/SQLClientConstants.m: * Modules/SQLClient/header.m: * Modules/WebServices/WebServicesConstants.m: * Modules/WebServices/header.m: int->NSInteger transition 2013-05-26 Wolfgang Lux * Frameworks/StepTalk/NSInvocation+additions.h: * Frameworks/StepTalk/NSInvocation+additions.m: * Frameworks/StepTalk/NSNumber+additions.h: * Frameworks/StepTalk/NSNumber+additions.m: * Frameworks/StepTalk/STActor.m: * Frameworks/StepTalk/STEnvironmentDescription.h: * Frameworks/StepTalk/STEnvironmentDescription.m: * Frameworks/StepTalk/STLanguageManager.m: * Frameworks/StepTalk/STObjCRuntime.m: * Frameworks/StepTalk/STScriptObject.m: * Frameworks/StepTalk/STStructure.h: * Frameworks/StepTalk/STStructure.m: int->NSInteger transition 2013-04-06 Wolfgang Lux * Frameworks/StepTalk/STActor.m (-setValue:forKey:): Fix bug where instance variables of an actor got lost when set to nil. 2013-04-04 Wolfgang Lux * Frameworks/StepTalk/NSObject+additions.h (-yourself): * Frameworks/StepTalk/NSObject+additions.m (-yourself): Add standard Smalltalk method, which is convenient in cascades. 2013-03-23 Wolfgang Lux * Tools/STEnvironmentProcess.m (-initWithDescriptionName:): Check the result of the super class initializer and assign it to self. 2013-03-23 Wolfgang Lux * Frameworks/StepTalk/STActor.m (-init, -initWithEnvironment:, -initWithCoder:): * Frameworks/StepTalk/STBehaviourInfo.m (-initWithName:): * Frameworks/StepTalk/STClassInfo.m (-initWithName:): * Frameworks/StepTalk/STContext.m (-init): * Frameworks/StepTalk/STConversation.m (-initWithContext:language:): * Frameworks/StepTalk/STDistantConversation.m (-initWithEnvironment:language:): * Frameworks/StepTalk/STDistantEnvironment.m (-initWithName:host:): * Frameworks/StepTalk/STEnvironment.m (-initWithDescription:): * Frameworks/StepTalk/STFileScript.m (-initWithFile:): * Frameworks/StepTalk/STLanguageManager.m (-init): * Frameworks/StepTalk/STObjectReference.m (-initWithIdentifier:target:): * Frameworks/StepTalk/STRemoteConversation.m (-initWithEnvironmentName:host:language:): * Frameworks/StepTalk/STScript.m (-initWithSource:language:): * Frameworks/StepTalk/STScriptObject.m (-init, -initWithCoder:): * Frameworks/StepTalk/STScriptsManager.m (-initWithDomainName:): * Frameworks/StepTalk/STSelector.m (-initWithName:, -initWithSelector:, -initWithCoder:): * Frameworks/StepTalk/STStructure.m (-initWithValue:type:): Check the result of the super class initializer and assign it to self. 2013-02-08 Wolfgang Lux * Frameworks/StepTalk/Environments/StepTalk.stenv: Define standard Smalltalk methods for invoking blocks with arguments. 2012-11-03 Wolfgang Lux * Examples/Developer/StepUnit.st: Fix typo in method name and stop using deprecated methods. 2012-11-03 Wolfgang Lux * Frameworks/StepTalk/STConversation.h (-conversationWithContext:language:): * Frameworks/StepTalk/STConversation.m (-conversationWithContext:language:): Implement method which is advertised as replacement for the deprecated method -conversationWithEnvironment:language:. * Frameworks/StepTalk/STConversation.m (-runScriptFromString:, -conversationWithEnvironment:language:, -initWithEnvironment:language:, -environment): * Frameworks/StepTalk/STEnvironmentDescription.m (defaultEnvironmentDescriptionName): Fix typos and spacing in warning messages. 2012-10-26 Wolfgang Lux * Modules/GNUmakefile: * Modules/WebServices/Functions.h: * Modules/WebServices/Functions.m: * Modules/WebServices/GNUmakefile: * Modules/WebServices/STWebServicesModule.h: * Modules/WebServices/STWebServicesModule.m: * Modules/WebServices/ScriptingInfo.plist: * Modules/WebServices/WebServicesConstants.list: * Modules/WebServices/WebServicesConstants.m: * Modules/WebServices/create_constants.awk: * Modules/WebServices/footer.m: * Modules/WebServices/header.m: Add WebServices bundle. Must be requested explicitly by adding webservices=yes to the make command line. 2012-10-26 Wolfgang Lux * Modules/GNUmakefile: * Modules/SQLClient/Functions.h: * Modules/SQLClient/Functions.m: * Modules/SQLClient/GNUmakefile: * Modules/SQLClient/SQLClient+additions.m: * Modules/SQLClient/SQLClientConstants.list: * Modules/SQLClient/SQLClientConstants.m: * Modules/SQLClient/STSQLClientModule.h: * Modules/SQLClient/STSQLClientModule.m: * Modules/SQLClient/ScriptingInfo.plist: * Modules/SQLClient/create_constants.awk: * Modules/SQLClient/footer.m: * Modules/SQLClient/header.m: Add SQLClient bundle. Must be requested explicitly by adding sqlclient=yes to the make command line. 2012-10-26 Wolfgang Lux * Modules/AppKit/GNUmakefile: * Modules/Foundation/GNUmakefile: * Modules/GDL2/GNUmakefile: * Modules/ObjectiveC/GNUmakefile: * Modules/SimpleTranscript/GNUmakefile: Fix Makefile variables (bundle.make uses BUNDLE_LIBS, not ADDITIONAL_BUNDLE_LIBS). 2012-02-07 Wolfgang Lux * Frameworks/StepTalk/STBundleInfo.m (-_bundleDidLoad:): Add missing argument in NSLog call detected by clang. 2012-02-07 Wolfgang Lux * Frameworks/StepTalk/STEnvironment.m (-registerObjectFinderNamed:): * Frameworks/StepTalk/STEnvironmentDescription.m (-updateFromDictionary:, -updateBehavioursFromDictionary:, -updateClassWithName:description:): * Frameworks/StepTalk/STFileScript.m (-source): * Frameworks/StepTalk/STObjCRuntime.m (STAllObjectiveCSelectors): * Tools/STExecutor.m (-executeScript:withArguments:): * Tools/stalk.m (-createConversation, main): * Tools/stenvironment.m (main): Fix potential space leaks detected by clang. * Frameworks/StepTalk/STBundleInfo.m (+stepTalkBundleNames): Fix double release detected by clang. 2012-01-15 Wolfgang Lux * Frameworks/StepTalk/STStructure.h: * Frameworks/StepTalk/STStructure.m (+structureWithOrigin:size:, extent:, corner:): New methods to construct rectangles from points and sizes. * TODO: Update. 2012-01-15 Wolfgang Lux * Modules/AppKit/AppKitConstants.list: Remove obsolete NSDataLink constants. * Modules/AppKit/AppKitConstants.m: Regenerated. 2012-01-15 Wolfgang Lux * Documentation/ApplicationScripting.txt: Fix errors. 2012-01-15 Wolfgang Lux * Frameworks/StepTalk/STEngine.h (-methodFromSource:...): * Frameworks/StepTalk/STEngine.m (-methodFromSource:...): STMethod is a protocol not a class. 2012-01-15 Wolfgang Lux * Frameworks/StepTalk/STObjCRuntime.m (STSelectorTypes, STSelectorFromString, STCreateTypedSelector, STConstructMethodSignatureForSelector): Add special case to register selectors of (Smalltalk) binary operators with one argument instead of zero. 2012-01-15 Wolfgang Lux * Frameworks/StepTalk/STObjCRuntime.m (STSelectorFromString): Always register typed selectors, since forwarding to untyped selectors stopped working a while back in GNUstep. 2012-01-15 Wolfgang Lux * Frameworks/StepTalk/NSInvocation+additions.m: * Frameworks/StepTalk/STStructure.m: * Modules/ObjectiveC/NSObject+additions.m: * Modules/ObjectiveC/ObjectiveCRuntime.m: Clean up imports removing includes of Objective-C runtime headers. Also replace a few more deprecated Objective-C runtime calls. 2011-04-07 Wolfgang Lux * Modules/ObjectiveC/ObjectiveCRuntime.m (-allClasses): * Modules/ObjectiveC/NSObject+additions.m (methods_for_class, ivars_for_class, +methodNames): Update to Objective-C 2 API. 2011-04-06 Richard Frith-Macdonald * Frameworks/StepTalk/STObjCRuntime.m: replace runtime specific typed selector code with the standard gnustep functions. 2011-04-06 Wolfgang Lux * Frameworks/StepTalk/STLanguageManager.m (-dealloc): Fix typo. (Was calling -dealloc on self instead of super). 2011-04-06 Wolfgang Lux * Frameworks/StepTalk/STObjCRuntime.m (STAllObjectiveCClasses, STCreateTypedSelector, STConstructMethodSignatureForSelector, selectors_from_list, STAllObjectiveCSelectors): Update to Objective-C 2 API. 2011-01-20 Wolfgang Lux * Frameworks/StepTalk/Environments/StepTalk.stenv: Add missing semicolon at end of plist dictionary. 2011-01-20 Wolfgang Lux * Frameworks/StepTalk/STUndefinedObject.m (-forwardInvocation:): Clear result buffer to prevent crashes under GNUstep when the invoked method's result type is an object type. 2011-01-20 Wolfgang Lux * Modules/AppKit/GNUmakefile: Add header.m and footer.m to dependencies of %.list -> %.m rule. * Modules/AppKit/header.m (STGet@@NAME@@): Use local variable to get rid of compiler warning. * Modules/AppKit/AppKitNotifications.list: Update AppKit notification list to match recent change in gui. * Modules/AppKit/AppKitConstants.m: * Modules/AppKit/AppKitEvents.m: * Modules/AppKit/AppKitNotifications.m: Regenerated. 2008 Okt 28 Samuel Harvey * Modules/GDL2/GNUmakefile: Use ADDITIONAL_NATIVE_LIBS instead of GDL2_BUNDLE_LIBS to link GDL2 packages. 2007 Feb 14 Nicola Pero * All GNUmakefiles in the project: Use GNUSTEP_LIBRARY instead of GNUSTEP_INSTALLATION_DIR/Library. 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. StepTalk-0.10.0/Testing/0000775000175000017500000000000014633027767014037 5ustar yavoryavorStepTalk-0.10.0/Testing/Smalltalk/0000775000175000017500000000000014633027767015763 5ustar yavoryavorStepTalk-0.10.0/Testing/Smalltalk/nil.st0000664000175000017500000000002514633027767017112 0ustar yavoryavornil objectAtIndex:1. StepTalk-0.10.0/Testing/Smalltalk/test0000775000175000017500000000007414633027767016671 0ustar yavoryavor#!/bin/csh foreach i ( `seq 0 5` ) stexec speed.st end StepTalk-0.10.0/Testing/Smalltalk/block_test.st0000664000175000017500000000013014633027767020456 0ustar yavoryavor| array | array := NSMutableArray array. 1 to: 200000 do: [ :i | array addObject: i]. StepTalk-0.10.0/Testing/Smalltalk/distant.st0000664000175000017500000000263014633027767020002 0ustar yavoryavor" Distant environment example Date: 2005 Aug 17 Author: Stefan Urbanek Usage: 1. run: stenvironment -name test 2. run: stexec distant.st 3. repeat step 2. as many times as you like Step 1. creates a scripting environment. Step 2. executes this script. " "Create a conversation with distant environment" conversation := (STDistantConversation alloc) initWithEnvironmentName:'test' host:nil language:nil. Transcript showLine: '-- Conversation created:', (conversation description). "Interpret some scripts in the distant environment" conversation interpretScript:'Transcript showLine:\'Hello StepTalk!\'.'. conversation interpretScript:'Environment class description'. "Get run count" conversation interpretScript:'runCount'. result := conversation resultByCopy. "If there is no run count, then we are running first time and we have to define and set the run count to 1" result ifNil: [ Transcript showLine: ('This script was run for first time.'). conversation interpretScript:'runCount := 0'. result := 1. ]. conversation interpretScript:'runCount := runCount + 1'. result := conversation resultByCopy. Transcript showLine: ('This script was run ', (result description), ' times.'). conversation close. StepTalk-0.10.0/Testing/Smalltalk/observer.st0000664000175000017500000000063314633027767020164 0ustar yavoryavor[| main |center| center := NSDistributedNotificationCenter defaultCenter. Transcript showLine:'Registering'. center addObserver:self selector:#notification: name:nil object:'s'. NSRunLoop currentRunLoop run. ! notification:notif Transcript showLine:'Notification received: ', (notif description). ^self ] StepTalk-0.10.0/Testing/Smalltalk/ivar.st0000664000175000017500000000076314633027767017302 0ustar yavoryavor[| :local main 1 to: 100000 do: [ :i | local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. ] ] StepTalk-0.10.0/Testing/Smalltalk/local.st0000664000175000017500000000061614633027767017430 0ustar yavoryavor| local | 1 to: 100000 do: [ :i | local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. local := nil. ] StepTalk-0.10.0/Testing/Smalltalk/send.st0000664000175000017500000000050114633027767017260 0ustar yavoryavor| array | 1 to: 500 do: [ :i | i class. i class. i class. i class. i class. i class. i class. i class. i class. i class. i class. i class. i class. i class. i class. i class. i class. i class. i class. i class. ]. StepTalk-0.10.0/Testing/Smalltalk/test.st0000664000175000017500000000145214633027767017314 0ustar yavoryavor[| :array main self testBlock. self testExceptions. ^self ! testBlock | count array | Transcript showLine:'> Block test'. array := #( ). 1 to: 5 do: [ :i | array addObject:i ]. count := 0. array do: [ :element | count := count + 1. ]. Transcript showLine:'count ', (count stringValue). array do: [ :i | array do: [ :j | Transcript show:((i stringValue), (j stringValue),' '). ]. Transcript show:'\n'. ]. ^self ! testExceptions Transcript showLine:'> Exception handler test'. [ NSException raise:'Some exception' format:' '. ] handler: [ :localException | Transcript showLine:(' Exception: ', localException name). ]. ^self ] StepTalk-0.10.0/Testing/Smalltalk/extern.st0000664000175000017500000000062714633027767017645 0ustar yavoryavor1 to: 100000 do: [ :i | extern := nil. extern := nil. extern := nil. extern := nil. extern := nil. extern := nil. extern := nil. extern := nil. extern := nil. extern := nil. extern := nil. extern := nil. extern := nil. extern := nil. extern := nil. extern := nil. extern := nil. extern := nil. extern := nil. extern := nil. ] StepTalk-0.10.0/Testing/Smalltalk/speed.st0000664000175000017500000000335514633027767017441 0ustar yavoryavor 1 to: 2000 do:[ :i| nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. nil showLine:'Hello ... who?'. ] StepTalk-0.10.0/Testing/sobjtest.st0000664000175000017500000000206314633027767016245 0ustar yavoryavor" Test for script objects. Author: Stefan Urbanek Date: 2003 Aug 6 " | object method source engine | Environment includeFramework:'StepTalk'. " Create a script object and set it's environment " object := STScriptObject scriptObject. object setEnvironment:Environment. " Get the proper engine " engine := STEngine engineForLanguageWithName:'Smalltalk'. " This is the source of new method " source := 'sayHi Transcript showLine: \'Hi.\'. ^self'. " Create method " method := engine methodFromSource:source forReceiver:object inEnvironment:Environment. " Add the method to the object " object addMethod:method. " Add another method with an argument " source := 'sayHiTo:someone Transcript showLine: (\'Hi \', someone). ^self'. method := engine methodFromSource:source forReceiver:object inEnvironment:Environment. object addMethod:method. " Sent it! " object sayHi. object sayHiTo:'GNUstep'. StepTalk-0.10.0/Testing/gdbstexec0000775000175000017500000000063514633027767015741 0ustar yavoryavor#!/bin/csh # # gdbstexec - GDB wrapper for stexec # # Put this file to be reachable from your PATH # # Use like stexec: # gdbstexec script_name ... # This will run stexec in gdb and run it with script script_name. After # finishing, backtrace is displayed # # set temp = `tempfile -p stexec` # echo set args $*:q > $temp # echo run >> $temp # echo bt >> $temp gdb --args `which stexec` $*:q # rm $temp StepTalk-0.10.0/Testing/languageManager.st0000664000175000017500000000060614633027767017467 0ustar yavoryavormanager := STLanguageManager defaultManager. Transcript showLine:(manager description). languages := manager availableLanguages. Transcript showLine:'Available languages: ', (languages description). engine := manager createEngineForLanguage:'Smalltalk'. Transcript showLine:'Engine: ', (engine description). engine interpretScript:'Transcript showLine:\'Hi\'.' inContext:Environment. StepTalk-0.10.0/Testing/leaks/0000775000175000017500000000000014633027767015136 5ustar yavoryavorStepTalk-0.10.0/Testing/leaks/test0000775000175000017500000000005114633027767016037 0ustar yavoryavormake debug=yes && obj/leaktest | sort -n StepTalk-0.10.0/Testing/leaks/script.st0000664000175000017500000000033214633027767017010 0ustar yavoryavor[| main | tval | tval := 1. tval to: 20000 do: [ :counter | self testme: counter. ]. ! testme: tval | retval | retval := tval + 1. ^retval ] StepTalk-0.10.0/Testing/leaks/GNUmakefile0000664000175000017500000000221714633027767017212 0ustar yavoryavor# # StepTalk tools # # Copyright (C) 2000,2001 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 TOOL_NAME = leaktest leaktest_OBJC_FILES = leaktest.m ADDITIONAL_TOOL_LIBS = -lStepTalk ADDITIONAL_OBJCFLAGS = -Wall -Wno-import ifeq ($(check),yes) ADDITIONAL_OBJCFLAGS += -Werror endif -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/tool.make -include GNUMakefile.postamble StepTalk-0.10.0/Testing/leaks/leaktest.m0000664000175000017500000000221214633027767017125 0ustar yavoryavor#import #import #import #import #import int main(void) { NSAutoreleasePool *pool = [NSAutoreleasePool new]; NSAutoreleasePool *innerPool; NSString *theScript; NSString *fname = @"script.st"; STEnvironment *env; STEngine *engine; id result; theScript = [NSString stringWithContentsOfFile:fname]; GSDebugAllocationActive(YES); NSLog(@"allocated objects on starting script\n%s",GSDebugAllocationList(NO)); env = [STEnvironment defaultScriptingEnvironment]; engine = [STEngine engineForLanguageWithName:@"Smalltalk"]; NS_DURING //innerPool = [NSAutoreleasePool new]; result = [engine executeCode:theScript inEnvironment:env]; //[innerPool release]; NS_HANDLER /* handle the exception */ NSLog(@"%@",localException); NS_ENDHANDLER //NSLog(@"change of allocated objects\n%s",GSDebugAllocationList(YES)); printf("%s",GSDebugAllocationList(NO)); [pool release]; } StepTalk-0.10.0/GNUmakefile0000664000175000017500000000350214633027767014474 0ustar yavoryavor# # Main Makefile for the StepTalk # # Copyright (C) 2000 Stefan Urbanek # # Written by: 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., 59 Temple Place, Suite 330, Boston, MA 02111 USA # ifeq ($(GNUSTEP_MAKEFILES),) GNUSTEP_MAKEFILES := $(shell gnustep-config --variable=GNUSTEP_MAKEFILES 2>/dev/null) ifeq ($(GNUSTEP_MAKEFILES),) $(warning ) $(warning Unable to obtain GNUSTEP_MAKEFILES setting from gnustep-config!) $(warning Perhaps gnustep-make is not properly installed,) $(warning so gnustep-config is not in your PATH.) $(warning ) $(warning Your PATH is currently $(PATH)) $(warning ) endif endif ifeq ($(GNUSTEP_MAKEFILES),) $(error You need to set GNUSTEP_MAKEFILES before compiling!) endif include $(GNUSTEP_MAKEFILES)/common.make include Version PACKAGE_NAME = StepTalk CVS_MODULE_NAME = StepTalk APPSCRIPT=ApplicationScripting ifeq ($(appkit),no) APPSCRIPT= endif SUBPROJECTS = \ Frameworks \ Languages \ Finders \ Modules \ Tools \ $(APPSCRIPT) -include GNUMakefile.preamble include $(GNUSTEP_MAKEFILES)/aggregate.make -include GNUMakefile.postamble StepTalk-0.10.0/Languages/0000775000175000017500000000000014633027767014330 5ustar yavoryavorStepTalk-0.10.0/Languages/Guile/0000775000175000017500000000000014633027767015375 5ustar yavoryavorStepTalk-0.10.0/Languages/Guile/ChangeLog0000664000175000017500000000010614633027767017144 0ustar yavoryavor2003 Apr 4 Stefan Urbanek * ChangeLog started StepTalk-0.10.0/Languages/Guile/GNUmakefile0000664000175000017500000000251714633027767017454 0ustar yavoryavor# # Guile language bundle # # Copyright (C) 2000,2001 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 = Guile BUNDLE_EXTENSION := .stlanguage BUNDLE_INSTALL_DIR:=$(GNUSTEP_LIBRARY)/StepTalk/Languages Guile_OBJC_FILES = \ GuileEngine.m Guile_PRINCIPAL_CLASS = GuileEngine ADDITIONAL_INCLUDE_DIRS += -I../../Source/Headers ADDITIONAL_LIBRARIES += -I../../Source/Headers Guile_BUNDLE_LIBS += -lgstep_guile -lScriptKit $(GUILE_LIBS) -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUmakefile.postamble StepTalk-0.10.0/Languages/Guile/GuileInfo.plist0000664000175000017500000000004114633027767020326 0ustar yavoryavor{ STFileTypes = ( "scm" ); } StepTalk-0.10.0/Languages/Guile/GuileEngine.h0000664000175000017500000000172314633027767017744 0ustar yavoryavor/** GuileEngine Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2002 Jan 13 This file is part of the StepTalk project. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02111, USA. */ #import @interface GuileEngine:STEngine { } @end StepTalk-0.10.0/Languages/Guile/Tests/0000775000175000017500000000000014633027767016477 5ustar yavoryavorStepTalk-0.10.0/Languages/Guile/Tests/hello.scm0000664000175000017500000000013114633027767020301 0ustar yavoryavor([] Transcript show: ($$ "Hello ")) ([] Transcript showLine: ([] Args objectAtIndex: 0)) StepTalk-0.10.0/Languages/Guile/Tests/transcript.scm0000664000175000017500000000007014633027767021371 0ustar yavoryavor([] Transcript showLine: ($$ "Hello from Transcript!")) StepTalk-0.10.0/Languages/Guile/GuileEngine.m0000664000175000017500000000416414633027767017753 0ustar yavoryavor/** GuileEngine Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2002 Jan 13 This file is part of the StepTalk project. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02111, USA. */ #import "GuileEngine.h" #import #import #import @class NSEnumerator; @implementation GuileEngine - (BOOL)understandsCode:(NSString *)code { NSLog(@"Do not know how to chceck if code is Guile."); return NO; } - (id) executeCode:(NSString *)sourceCode inEnvironment:(STEnvironment *)env { GuileInterpreter *interp; GuileScript *script; GuileSCM *result; NSEnumerator *e; id *obj; /* call this multiple times initializes one interpreter you are stuck with it until exit */ scm_init_guile(); gstep_init(); // gstep_link_base(); [GuileInterpreter initializeInterpreter]; interp = AUTORELEASE([[GuileInterpreter alloc] init]); script = AUTORELEASE([[GuileScript alloc] init]); e = [[[env objectDictionary] allKeys] objectEnumerator]; /* FIXME: If we do not remove these, we get an exception */ [env removeObjectWithName:@"NSProxy"]; [env removeObjectWithName:@"NSDistantObject"]; [env setObject:env forName:@"Env"]; [script setUserDictionary:[env objectDictionary]]; [script setDelegate:sourceCode]; result = [interp executeScript:script]; } @end StepTalk-0.10.0/Languages/Guile/GNUmakefile.postamble0000664000175000017500000000372114633027767021437 0ustar yavoryavor# # GNUmakefile.postamble # # 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; see the file COPYING.LIB. # If not, write to the Free Software Foundation, # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # Project specific makefile rules # # Uncomment the targets you want. # The double colons (::) are important, do not make them single colons # otherwise the normal makefile rules will not be performed. # # Things to do before compiling # before-all:: # Things to do after compiling # after-all:: # Things to do before installing # before-install:: # Things to do after installing after-install:: @( echo ; \ echo "NOTE: Each time after installing new language, please update\ your file extension to language mapping dictionary by running \ stupdate_languages for each user."; \ echo ; \ echo Updating languages...; \ stupdate_languages; \ ) # Things to do before uninstalling # before-uninstall:: # Things to do after uninstalling after-uninstall:: @( stupdate_languages; ) # Things to do before cleaning # before-clean:: # Things to do after cleaning # after-clean:: # Things to do before distcleaning # before-distclean:: # Things to do after distcleaning # after-distclean:: # Things to do before checking # before-check:: # Things to do after checking # after-check:: StepTalk-0.10.0/Languages/Smalltalk/0000775000175000017500000000000014633027767016254 5ustar yavoryavorStepTalk-0.10.0/Languages/Smalltalk/STBytecodeInterpreter.m0000664000175000017500000004355714633027767022701 0ustar yavoryavor/** STBytecodeInterpreter.m 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 "STBytecodeInterpreter.h" #import "Externs.h" #import "STBlock.h" #import "STBlockContext.h" #import "STBytecodes.h" #import "STCompiledMethod.h" #import "STExecutionContext.h" #import "STLiterals.h" #import "STMessage.h" #import "STMethodContext.h" #import "STSmalltalkScriptObject.h" #import "STStack.h" #import #import #import #import #import #import #import #import #import #import #import #import #import @interface STBytecodeInterpreter(STPrivateMethods) - (short)fetchBytecode; - (BOOL)dispatchBytecode:(STBytecode)bytecode; - (void)invalidBytecode:(STBytecode)bytecode; - (void)setInstructionPointer:(NSUInteger)newIP; - (NSUInteger)instructionPointer; - (void)sendSelectorAtIndex:(NSUInteger)index withArgCount:(NSUInteger)argCount; - (id)interpret; - (void)returnValue:(id)value; @end static SEL sendSelectorAtIndexSel; static IMP sendSelectorAtIndexImp; static SEL pushSel; static IMP pushImp; static SEL popSel; static IMP popImp; static Class NSInvocation_class = nil; @implementation STBytecodeInterpreter + (void)initialize { sendSelectorAtIndexSel = @selector(sendSelectorAtIndex:withArgCount:); pushSel = @selector(push:); popSel = @selector(pop); sendSelectorAtIndexImp = [STBytecodeInterpreter instanceMethodForSelector:sendSelectorAtIndexSel]; pushImp = [STStack instanceMethodForSelector:pushSel]; popImp = [STStack instanceMethodForSelector:popSel]; NSInvocation_class = [NSInvocation class]; } + interpreterWithEnvrionment:(STEnvironment *)env { return AUTORELEASE([[self alloc] initWithEnvironment:env]); } - initWithEnvironment:(STEnvironment *)env { if ((self = [super init]) != nil) environment = RETAIN(env); return self; } - (void)dealloc { RELEASE(environment); RELEASE(activeContext); [super dealloc]; } - (void)setEnvironment:(STEnvironment *)env { ASSIGN(environment,env); } - (id)interpretMethod:(STCompiledMethod *)method forReceiver:(id)anObject arguments:(NSArray*)args { // NSAutoreleasePool *pool = [NSAutoreleasePool new]; STExecutionContext *oldContext; STMethodContext *newContext; id retval; if (!environment) { [NSException raise:STInterpreterGenericException format:@"No execution environment set"]; return nil; } NSDebugLLog(@"STBytecodeInterpreter",@"Executing method %@ with %lu args", [method selector],(unsigned long)[args count]); if (!method) { return nil; } if ([args count] != [method argumentCount]) { [NSException raise:STInterpreterGenericException format:@"Invalid argument count %lu (should be %lu)" @" for method %@ ", (unsigned long)[args count], (unsigned long)[method argumentCount], [method selector]]; } newContext = [[STMethodContext alloc] initWithMethod:method]; [newContext setArgumentsFromArray:args]; [newContext setReceiver:anObject]; oldContext = activeContext; [self setContext:newContext]; NS_DURING retval = [self interpret]; NS_HANDLER if ([[localException name] isEqualToString:STInterpreterReturnException]) { NSDictionary *userInfo = [localException userInfo]; if ([userInfo objectForKey: @"Context"] == newContext) { retval = [userInfo objectForKey:@"Value"]; } else { RELEASE(newContext); [localException raise]; } } else { RELEASE(newContext); [localException raise]; } NS_ENDHANDLER [self setContext:oldContext]; RELEASE(newContext); // RETAIN(retval); // [pool release]; // AUTORELEASE(retval); return retval; } /* --------------------------------------------------------------------------- * Interpret * --------------------------------------------------------------------------- */ - (void)setContext:(STExecutionContext *)newContext { NSDebugLLog(@"STExecutionContext", @"Switch from context %@ to context %@", activeContext, newContext); if(!newContext) { RELEASE(activeContext); activeContext = nil; stack = nil; bytecodes = nil; instructionPointer = 0; receiver = nil; return; } if( ![newContext isValid]) { [NSException raise:STInterpreterGenericException format:@"Trying to set an invalid context"]; } [activeContext setInstructionPointer:instructionPointer]; ASSIGN(activeContext,newContext); stack = [activeContext stack]; receiver = [activeContext receiver]; if(!stack) { [NSException raise:STInternalInconsistencyException format:@"No execution stack"]; } instructionPointer = [activeContext instructionPointer]; bytecodes = [activeContext bytecodes]; } - (STExecutionContext *)context { return activeContext; } - (id)interpret { STBytecode bytecode; id retval; entry++; NSDebugLLog(@"STBytecodeInterpreter", @"Interpreter entry %li", (long)entry); NSDebugLLog(@"STBytecodeInterpreter", @"IP %lx %lx", (unsigned long)instructionPointer, (unsigned long)[bytecodes length]); if(!bytecodes) { NSLog(@"Smalltalk: No bytecodes."); return nil; } stopRequested = NO; do { bytecode = [bytecodes fetchNextBytecodeAtPointer:&instructionPointer]; if(stopRequested) { break; } } while( [self dispatchBytecode:bytecode] ); if(!stopRequested) { retval = [stack pop]; } else { NSDebugLLog(@"STBytecodeInterpreter",@"Stop requested"); retval = nil; } NSDebugLLog(@"STBytecodeInterpreter", @"Returning '%@' from interpreter (entry %li)", retval,(long)entry); entry --; return retval; } - (void)halt { NSDebugLLog(@"STBytecodeInterpreter",@"Halt!"); stopRequested = YES; } /* --------------------------------------------------------------------------- * Return * --------------------------------------------------------------------------- */ - (void)returnValue:(id)value { NSDebugLLog(@"STExecutionContext", @"%@ return value '%@' from method", activeContext,value); [activeContext invalidate]; if (activeContext != [activeContext homeContext]) { NSDictionary *userInfo; /* FIXME Invalidate all contexts between the active context and the home context as well. Note that the semantics presented in the Blue Book doesn't get this right either. */ userInfo = [NSDictionary dictionaryWithObjectsAndKeys: /* Attention: Order is important here. The returned value may be nil, so the context value must come first. */ [activeContext homeContext], @"Context", value, @"Value", nil]; [[NSException exceptionWithName:STInterpreterReturnException reason:@"Block cannot return" userInfo:userInfo] raise]; } [stack push:value]; } - (void)returnBlockValue:(id)value { NSDebugLLog(@"STExecutionContext", @"%@ return value '%@' from block", activeContext,value); [activeContext invalidate]; [stack push:value]; } - (NSUInteger)instructionPointer { return instructionPointer; } /* --------------------------------------------------------------------------- * Block manipulation * --------------------------------------------------------------------------- */ - (void)createBlockWithArgumentCount:(NSUInteger)argCount stackSize:(NSUInteger)stackSize { NSUInteger ptr; STBlock *block; ptr = instructionPointer + STLongJumpBytecodeSize; NSDebugLLog(@"STExecutionContext", @"%@ Create block: argc:%lu stack:%lu ip:0x%04lx", activeContext, (unsigned long)argCount, (unsigned long)stackSize, (unsigned long)ptr); block = [[STBlock alloc] initWithInterpreter:self homeContext:[activeContext homeContext] initialIP:ptr argumentCount:argCount stackSize:stackSize]; [stack push:AUTORELEASE(block)]; } /* --------------------------------------------------------------------------- send selector (see also STEnvironment class) * --------------------------------------------------------------------------- */ - (void)sendSelectorAtIndex:(NSUInteger)selIndex withArgCount:(NSUInteger)argCount { NSString *selector; NSInvocation *invocation; id target; NSInteger index; id object; NSDebugLLog(@"STSending", @"send selector '%@' with %lu args'", [activeContext literalObjectAtIndex:selIndex], (unsigned long)argCount); target = [stack valueFromTop:argCount]; /* FIXME */ if(!target) { target = STNil; } selector = [activeContext literalObjectAtIndex:selIndex]; NSDebugLLog(@"STSending", @" %s receiver:%@ (%@) selector:%@", [receiver isProxy] ? "proxy for" : "", target, NSStringFromClass([target class]), selector); /* FIXME: this is too slow */ selector = [environment translateSelector:selector forReceiver:target]; invocation = [NSInvocation_class invocationWithTarget:target selectorName:selector]; if(!invocation) { [NSException raise:STInternalInconsistencyException format:@"Should not send selector '%@' to " @"receiver of type %@ (could not create invocation)", selector,[target className]]; return; } for(index = argCount + 1; index > 1; index--) { object = [stack pop]; if(object == STNil) { object = nil; } NSDebugLLog(@"STSending", @" argument %2li: '%@'",(long)(index - 2), object); [invocation setArgumentAsObject:object atIndex:index]; } /* ---------------------------- * invoke it! * ---------------------------- */ NSDebugLLog(@"STSending",@" invoking... (%@ %s)",invocation, [[invocation methodSignature] methodReturnType]); [invocation invoke]; NSDebugLLog(@"STSending",@" done invoking."); /* FIXME */ if(!stopRequested) { /* pop the receiver from the stack */ [stack pop]; [stack push: [invocation returnValueAsObject]]; } } /* --------------------------------------------------------------------------- Bytecode manipulation * --------------------------------------------------------------------------- */ #define STDebugBytecode(bc) \ NSDebugLLog(@"STBytecodeInterpreter", \ @"#%04lx %@", \ (unsigned long)(bc).pointer, \ STDissasembleBytecode(bc)) #define STDebugBytecodeWith(bc,object) \ NSDebugLLog(@"STBytecodeInterpreter", \ @"#%04lx %@ (%@)", \ (unsigned long)(bc).pointer, \ STDissasembleBytecode(bc), \ (object)) #define STPush(s, v) (*pushImp)(s, pushSel, v) // #define STPush(s, v) [s push:v] #define STPop(s) (*popImp)(s, popSel) // #define STPop(s) [s pop] - (BOOL)dispatchBytecode:(STBytecode)bytecode { NSString *refName; id object; switch(bytecode.code) { case STLongJumpBytecode: { /* NSInteger offset = STLongJumpOffset(bytecode.arg1,bytecode.arg2) - STLongJumpBytecodeSize; */ NSInteger offset = bytecode.arg1 - STLongJumpBytecodeSize; STDebugBytecode(bytecode); instructionPointer+=offset; break; } case STPushReceiverBytecode: STDebugBytecodeWith(bytecode,receiver); STPush(stack, receiver); break; case STPushNilBytecode: STDebugBytecodeWith(bytecode,receiver); STPush(stack,nil); break; case STPushTrueBytecode: STDebugBytecodeWith(bytecode,receiver); STPush(stack,[NSNumber numberWithBool:YES]); break; case STPushFalseBytecode: STDebugBytecodeWith(bytecode,receiver); STPush(stack,[NSNumber numberWithBool:NO]); break; case STPushRecVarBytecode: refName = [activeContext referenceNameAtIndex:bytecode.arg1]; object = [receiver valueForKey:refName]; STDebugBytecodeWith(bytecode,object); STPush(stack,object); break; case STPushExternBytecode: // NSLog(@"PUSH EXTERN ctx(%@): %@ %@", [activeContext className], [[activeContext method] selector], [[activeContext method] namedReferences]); refName = [activeContext referenceNameAtIndex:bytecode.arg1]; object = [environment objectWithName:refName]; STDebugBytecodeWith(bytecode,object); STPush(stack,object); break; case STPushTemporaryBytecode: object = [activeContext temporaryAtIndex:bytecode.arg1]; STPush(stack,object); STDebugBytecodeWith(bytecode,object); break; case STPushLiteralBytecode: object = [activeContext literalObjectAtIndex:bytecode.arg1]; STDebugBytecodeWith(bytecode,object); STPush(stack,object); break; case STPopAndStoreRecVarBytecode: STDebugBytecode(bytecode); refName = [activeContext referenceNameAtIndex:bytecode.arg1]; object = STPop(stack); [receiver setValue:object forKey:refName]; break; case STPopAndStoreExternBytecode: STDebugBytecode(bytecode); refName = [activeContext referenceNameAtIndex:bytecode.arg1]; object = STPop(stack); [environment setObject:object forName:refName]; break; case STPopAndStoreTempBytecode: STDebugBytecode(bytecode); [activeContext setTemporary:STPop(stack) atIndex:bytecode.arg1]; break; case STSendSelectorBytecode: STDebugBytecodeWith(bytecode, [activeContext literalObjectAtIndex:bytecode.arg1]); (*sendSelectorAtIndexImp)(self, sendSelectorAtIndexSel, bytecode.arg1,bytecode.arg2); /* [self sendSelectorAtIndex:bytecode.arg1 withArgCount:bytecode.arg2]; */ break; case STSuperSendSelectorBytecode: /* FIXME: not implemented */ [self invalidBytecode:bytecode]; break; case STDupBytecode: STDebugBytecode(bytecode); [stack duplicateTop]; break; case STPopStackBytecode: STDebugBytecode(bytecode); [stack pop]; break; case STReturnBytecode: STDebugBytecode(bytecode); [self returnValue:[stack pop]]; return NO; case STReturnBlockBytecode: STDebugBytecode(bytecode); [self returnBlockValue:[stack pop]]; return NO; case STBlockCopyBytecode: STDebugBytecode(bytecode); { STBlockLiteral *info = [stack pop]; [self createBlockWithArgumentCount:[info argumentCount] stackSize:[info stackSize]]; } break; default: [self invalidBytecode:bytecode]; break; }; return YES; } - (void)invalidBytecode:(STBytecode)bytecode { [NSException raise:STInternalInconsistencyException format:@"invalid bytecode (0x%02x) at 0x%06lx", bytecode.code,(unsigned long)bytecode.pointer]; } @end StepTalk-0.10.0/Languages/Smalltalk/STStack.m0000664000175000017500000000531614633027767017753 0ustar yavoryavor/** STStack.m Temporaries and stack storage. Copyright (c) 2002 Free Software Foundation This file is part of the StepTalk project. */ #import "STStack.h" #import #import #import @implementation STStack + stackWithSize:(NSUInteger)newSize { return AUTORELEASE([[self alloc] initWithSize:newSize]); } - initWithSize:(NSUInteger)newSize { if ((self = [super init]) != nil) { size = newSize; pointer = 0; stack = NSZoneMalloc( NSDefaultMallocZone(), size * sizeof(id) ); } return self; } - (void)invalidPointer:(NSUInteger)ptr { [NSException raise:STInternalInconsistencyException format:@"%@: invalid pointer %lu (sp=%lu size=%lu)", self, (unsigned long)ptr, (unsigned long)pointer, (unsigned long)size]; } - (void)dealloc { NSZoneFree(NSDefaultMallocZone(),stack); [super dealloc]; } #define INDEX_IS_VALID(index) \ ((index >= 0) && (index < size)) #define CHECK_POINTER(value) \ do {\ if(!INDEX_IS_VALID(value)) \ {\ [self invalidPointer:value];\ } \ }\ while(0) /* - (void)setPointer:(NSUInteger)newPointer { CHECK_POINTER(newPointer); pointer=newPointer; } */ - (NSUInteger)pointer { return pointer; } - (void)push:(id)value { CHECK_POINTER(pointer); NSDebugLLog(@"STStack",@"stack:%p %02lu push '%@'", self,(unsigned long)pointer,value); stack[pointer++] = value; } - (void)duplicateTop { [self push:[self valueAtTop]]; } #define CONVERT_NIL(obj) ((obj == STNil) ? nil : (obj)) - (id)valueAtTop { CHECK_POINTER(pointer-1); return CONVERT_NIL(stack[pointer-1]); } - (id)valueFromTop:(NSUInteger)index { id value; CHECK_POINTER(pointer-index-1); value = stack[pointer - index - 1]; NSDebugLLog(@"STStack",@"stack:%p %02li from top %li '%@'", self,(unsigned long)pointer,(unsigned long)index,value); return CONVERT_NIL(value); } - (id)pop { CHECK_POINTER(pointer-1); NSDebugLLog(@"STStack",@"stack:%p %02li pop '%@'", self,(unsigned long)pointer,stack[pointer-1]); pointer --; return CONVERT_NIL(stack[pointer]); } - (void)popCount:(NSUInteger)count { CHECK_POINTER(pointer-count); NSDebugLLog(@"STStack",@"stack:%p %02lu pop count %lu (%li)",self, (unsigned long)pointer,(unsigned long)count, (long)(pointer-count)); pointer -= count; } - (void)empty { pointer = 0; } @end StepTalk-0.10.0/Languages/Smalltalk/NSDictionary+additions.m0000664000175000017500000000677214633027767022766 0ustar yavoryavor/** NSDictionary-additions.m Various methods for NSDictionary Copyright (c) 2019 Free Software Foundation Written by: Wolfgang Lux 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 "NSDictionary+additions.h" #import "NSNumber+additions.h" #import "STBlock.h" #import #import #import @implementation NSDictionary (STCollecting) - do:(STBlock *)block { NSEnumerator *enumerator; id object; id retval = nil; enumerator = [self objectEnumerator]; while( (object = [enumerator nextObject]) ) { retval = [block value:object]; } return retval; } - select:(STBlock *)block { NSMutableDictionary *dictionary; NSEnumerator *enumerator; id key; id object; id value; dictionary = [NSMutableDictionary dictionary]; enumerator = [self keyEnumerator]; while( (key = [enumerator nextObject]) ) { object = [self objectForKey:key]; value = [block value:object]; if([(NSNumber *)value isTrue]) { [dictionary setObject:object forKey:key]; } } return [NSDictionary dictionaryWithDictionary: dictionary]; } - reject:(STBlock *)block { NSMutableDictionary *dictionary; NSEnumerator *enumerator; id key; id object; id value; dictionary = [NSMutableDictionary dictionary]; enumerator = [self keyEnumerator]; while( (key = [enumerator nextObject]) ) { object = [self objectForKey:key]; value = [block value:object]; if([(NSNumber *)value isFalse]) { [dictionary setObject:object forKey:key]; } } return [NSDictionary dictionaryWithDictionary: dictionary]; } - collect:(STBlock *)block { NSMutableDictionary *dictionary; NSEnumerator *enumerator; id key; id value; dictionary = [NSMutableDictionary dictionary]; enumerator = [self keyEnumerator]; while( (key = [enumerator nextObject]) ) { value = [block value:[self objectForKey:key]]; if (value == nil) value = STNil; [dictionary setObject:value forKey:key]; } return [NSDictionary dictionaryWithDictionary: dictionary]; } - detect:(STBlock *)block { NSEnumerator *enumerator; id object; id retval = nil; enumerator = [self objectEnumerator]; while( (object = [enumerator nextObject]) ) { retval = [block value:object]; if([(NSNumber *)retval isTrue]) { return object; } } return retval; } @end StepTalk-0.10.0/Languages/Smalltalk/NSObject+additions.m0000664000175000017500000000215114633027767022052 0ustar yavoryavor/** 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 StepTalk-0.10.0/Languages/Smalltalk/STCompiledScript.h0000664000175000017500000000255714633027767021626 0ustar yavoryavor/** STCompiledScript.h 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 NSDictionary; @class NSMutableDictionary; @class NSString; @class NSArray; @class STCompiledMethod; @class STEnvironment; @interface STCompiledScript:NSObject { NSMutableDictionary *methodDictionary; NSArray *variableNames; } - initWithVariableNames:(NSArray *)array; - (id)executeInEnvironment:(STEnvironment *)env; - (STCompiledMethod *)methodWithName:(NSString *)name; - (void)addMethod:(STCompiledMethod *)method; - (NSArray *)variableNames; @end StepTalk-0.10.0/Languages/Smalltalk/STBytecodes.m0000664000175000017500000002221714633027767020626 0ustar yavoryavor/** STBytecodes.m 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 "STBytecodes.h" #import #import "Externs.h" #import #import #import #import NSArray *STBytecodeNames; static void initNamesArray(void) { NSString *invalid = @"invalid bytecode"; NSMutableArray *array; NSInteger i; array = [NSMutableArray arrayWithCapacity:256]; for(i=0;i<256;i++) { [array insertObject:invalid atIndex:i]; } [array replaceObjectAtIndex:STPushReceiverBytecode withObject:@"push self"]; [array replaceObjectAtIndex:STPushNilBytecode withObject:@"push nil"]; [array replaceObjectAtIndex:STPushTrueBytecode withObject:@"push true"]; [array replaceObjectAtIndex:STPushFalseBytecode withObject:@"push false"]; [array replaceObjectAtIndex:STPushRecVarBytecode withObject:@"push ivar"]; [array replaceObjectAtIndex:STPushExternBytecode withObject:@"push extern"]; [array replaceObjectAtIndex:STPushTemporaryBytecode withObject:@"push temporary"]; [array replaceObjectAtIndex:STPushLiteralBytecode withObject:@"push literal"]; [array replaceObjectAtIndex:STPopAndStoreRecVarBytecode withObject:@"pop and store ivar"]; [array replaceObjectAtIndex:STPopAndStoreExternBytecode withObject:@"pop and store extern"]; [array replaceObjectAtIndex:STPopAndStoreTempBytecode withObject:@"pop and store temp"]; [array replaceObjectAtIndex:STSendSelectorBytecode withObject:@"send selector"]; [array replaceObjectAtIndex:STSuperSendSelectorBytecode withObject:@"send super selector"]; [array replaceObjectAtIndex:STBlockCopyBytecode withObject:@"block copy"]; [array replaceObjectAtIndex:STDupBytecode withObject:@"dup"]; [array replaceObjectAtIndex:STPopStackBytecode withObject:@"pop"]; [array replaceObjectAtIndex:STReturnBytecode withObject:@"return"]; [array replaceObjectAtIndex:STReturnBlockBytecode withObject:@"return from block"]; [array replaceObjectAtIndex:STBreakpointBytecode withObject:@"breakpoint"]; [array replaceObjectAtIndex:STLongJumpBytecode withObject:@"long jump"]; STBytecodeNames = [[NSArray alloc] initWithArray:array]; } NSString *STBytecodeName(unsigned short code) { static NSString *invalid = @"invalid bytecode"; NSString *name; if( code > [STBytecodeNames count] ) { return invalid; } name = [STBytecodeNames objectAtIndex:code]; if(name == nil) { return invalid; } return name; } NSString *STDissasembleBytecode(STBytecode bytecode) { NSString *str; str = STBytecodeName(bytecode.code); switch(bytecode.code) { case STLongJumpBytecode: { //NSInteger offset = // STLongJumpOffset(bytecode.arg1,bytecode.arg2); NSInteger offset = bytecode.arg1; return [NSString stringWithFormat:@"%@ %li (0x%06lx)", str, (long)offset, (unsigned long)(bytecode.pointer+offset)]; } case STSendSelectorBytecode: case STSuperSendSelectorBytecode: return [NSString stringWithFormat:@"%@ %i with %i args", str, bytecode.arg1, bytecode.arg2]; case STPushRecVarBytecode: case STPushExternBytecode: case STPushTemporaryBytecode: case STPushLiteralBytecode: case STPopAndStoreRecVarBytecode: case STPopAndStoreExternBytecode: case STPopAndStoreTempBytecode: return [NSString stringWithFormat:@"%@ %i", str, bytecode.arg1]; case STPushReceiverBytecode: case STPushNilBytecode: case STPushTrueBytecode: case STPushFalseBytecode: case STBlockCopyBytecode: case STDupBytecode: case STPopStackBytecode: case STReturnBytecode: case STReturnBlockBytecode: case STBreakpointBytecode: return str; default: return [NSString stringWithFormat:@"invalid (0x%02x)", bytecode.code]; } } @implementation STBytecodes + (void)initialize { initNamesArray(); } /* - (id) initWithBytesNoCopy: (void*)someBytes length: (NSUInteger)length fromZone: (NSZone*)zone { if ((self = [super init]) != nil) { bytes = [[NSData alloc] initWithBytesNoCopy:someBytes length:length fromZone:zone]; } return self; } */ /* FIXME: rewrite this class - it is a leftover */ - (id) initWithData: (NSData *)data { if ((self = [super init]) != nil) { bytes = RETAIN(data); } return self; } - (NSData *)data { return bytes; } - (void)dealloc { RELEASE(bytes); [super dealloc]; } - (const void *)bytes { return [bytes bytes]; } - (NSUInteger) length { return [bytes length]; } - (NSString *)description { return [bytes description]; } - (STBytecode)fetchNextBytecodeAtPointer:(NSUInteger *)pointer { STBytecode bytecode; const unsigned char *bytesPtr = (const unsigned char *)[bytes bytes]; NSUInteger length = [self length]; if(*pointer < length) { bytecode.pointer = *pointer; bytecode.code = bytesPtr[(*pointer)++]; switch(bytecode.code) { case STSendSelectorBytecode: case STSuperSendSelectorBytecode: if(*pointer + 2 >= length) { break; } /* bytecode.arg1 = bytesPtr[(*pointer)++]; bytecode.arg2 = bytesPtr[(*pointer)++]; */ bytecode.arg1 = (bytesPtr[(*pointer)++])<<8; bytecode.arg1 |= bytesPtr[(*pointer)++]; bytecode.arg2 = (bytesPtr[(*pointer)++])<<8; bytecode.arg2 |= bytesPtr[(*pointer)++]; return bytecode; case STLongJumpBytecode: case STPushRecVarBytecode: case STPushExternBytecode: case STPushTemporaryBytecode: case STPushLiteralBytecode: case STPopAndStoreRecVarBytecode: case STPopAndStoreExternBytecode: case STPopAndStoreTempBytecode: if(*pointer + 1 >= length) { break; } /* bytecode.arg1 = bytesPtr[(*pointer)++]; */ bytecode.arg1 = (bytesPtr[(*pointer)++])<<8; bytecode.arg1 |= bytesPtr[(*pointer)++]; bytecode.arg2 = 0; return bytecode; case STPushReceiverBytecode: case STPushNilBytecode: case STPushTrueBytecode: case STPushFalseBytecode: case STBlockCopyBytecode: case STDupBytecode: case STPopStackBytecode: case STReturnBytecode: case STReturnBlockBytecode: case STBreakpointBytecode: bytecode.arg1 = 0; bytecode.arg2 = 0; return bytecode; default: [NSException raise:STInternalInconsistencyException format:@"Invalid bytecode 0x%02x at 0x%06lx", bytecode.code,(unsigned long)(*pointer-1)]; } } [NSException raise:STInternalInconsistencyException format:@"Instruction pointer 0x%06lx out of bounds (0x%06lx)", (unsigned long)*pointer,(unsigned long)length]; return bytecode; } - (void)encodeWithCoder:(NSCoder *)coder { // [super encodeWithCoder: coder]; [coder encodeObject:bytes]; } - initWithCoder:(NSCoder *)decoder { if ((self = [super init] /*[super initWithCoder: decoder]*/) != nil) { [decoder decodeValueOfObjCType: @encode(id) at: &bytes]; } return self; } @end StepTalk-0.10.0/Languages/Smalltalk/STBlockContext.m0000664000175000017500000000443214633027767021303 0ustar yavoryavor/** STBlockContext.m 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 "STBlockContext.h" #import "STStack.h" #import "STBytecodeInterpreter.h" #import "STBytecodes.h" #import "STMethodContext.h" #import #import #import #import @implementation STBlockContext - initWithInitialIP:(NSUInteger)pointer stackSize:(NSUInteger)size { if ((self = [super initWithStackSize:size]) != nil) { initialIP = pointer; instructionPointer = initialIP; } return self; } - (void)dealloc { RELEASE(homeContext); [super dealloc]; } - (BOOL)isBlockContext { return YES; } - (void)setHomeContext:(STMethodContext *)context { ASSIGN(homeContext,context); } - (STMethodContext *)homeContext { return homeContext; } - (NSUInteger)initialIP { return initialIP; } - temporaryAtIndex:(NSUInteger)index; { return [homeContext temporaryAtIndex:index]; } - (void)setTemporary:anObject atIndex:(NSUInteger)index; { [homeContext setTemporary:anObject atIndex:index]; } - (NSString *)referenceNameAtIndex:(NSUInteger)index { return [homeContext referenceNameAtIndex:index]; } - (STBytecodes *)bytecodes { return [homeContext bytecodes]; } - (id)literalObjectAtIndex:(NSUInteger)index { return [homeContext literalObjectAtIndex:index]; } - (id)receiver { return [homeContext receiver]; } - (void)resetInstructionPointer { instructionPointer = initialIP; } @end StepTalk-0.10.0/Languages/Smalltalk/STMethodContext.m0000664000175000017500000000577314633027767021502 0ustar yavoryavor/** STMethodContext.m 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 "STMethodContext.h" #import "STBytecodes.h" #import "STCompiledMethod.h" #import "STLiterals.h" #import "STStack.h" #import #import #import #import @implementation STMethodContext + methodContextWithMethod:(STCompiledMethod *)newMethod { return AUTORELEASE([[self alloc] initWithMethod:newMethod]); } - initWithMethod:(STCompiledMethod *)newMethod { if ((self = [super initWithStackSize:[newMethod stackSize]]) != nil) { NSUInteger tempCount; NSUInteger i; method = RETAIN(newMethod); tempCount = [method temporariesCount]; temporaries = [[NSMutableArray alloc] initWithCapacity:tempCount]; for (i=0; i @interface STLiteral:NSObject @end @interface STObjectReferenceLiteral:STLiteral { NSString *poolName; NSString *objectName; } - initWithObjectName:(NSString *)anObject poolName:(NSString *)aPool; - (NSString *)poolName; - (NSString *)objectName; @end @interface STBlockLiteral:STLiteral { NSUInteger argCount; NSUInteger stackSize; } - initWithArgumentCount:(NSUInteger)count; - (void)setStackSize:(NSUInteger)size; - (NSUInteger)argumentCount; - (NSUInteger)stackSize; @end StepTalk-0.10.0/Languages/Smalltalk/STSmalltalkScriptObject.h0000664000175000017500000000262414633027767023140 0ustar yavoryavor/** STSmalltalkScriptObject.h Object that represents script 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 NSMutableArray; @class NSMutableDictionary; @class STBytecodeInterpreter; @class STCompiledScript; @class STEnvironment; @interface STSmalltalkScriptObject:NSObject { NSString *name; STBytecodeInterpreter *interpreter; STEnvironment *environment; STCompiledScript *script; NSMutableDictionary *variables; } - initWithEnvironment:(STEnvironment *)env compiledScript:(STCompiledScript *)compiledScript; @end StepTalk-0.10.0/Languages/Smalltalk/ChangeLog0000664000175000017500000005210014633027767020024 0ustar yavoryavor2019-03-27 Wolfgang Lux * STBytecodeInterpreter.m (dispatchBytecode:): Use numberWithBool: when pushing true and false values onto the stack. 2019-03-25 Wolfgang Lux * STSmalltalkScriptObject.m (forwardInvocation:): Call super class implementation for unimplemented methods so that they get reported as unimplemented rather than silently returning nil. 2019-02-22 Wolfgang Lux * GNUmakefile: * NSDictionary+additions.h: * NSDictionary+additions.m: Implement Smalltalk collection protocol methods for NSDictionary. 2017-12-27 Wolfgang Lux * STBlock.m (valueWithArguments:): Remove comma that unintentionally breaks an exception format string * STCompilerUtils.h: Fix wrong return type in method declaration flagged up by the GNUstep runtime. 2014-11-01 Wolfgang Lux * STBlock.m (-valueWithArguments:): Fix bug where the cached context of a block could be reused prematurely. Note: This could happen only when a block is called recursively and entered more than once in an inner invocation, as, e.g., in the following code to compute the Fibonacci numbers: fib := [:n | (n <= 1) ifTrue: [1] ifFalse: [(fib value: (n - 1)) + (fib value: (n - 2))]]. fib value: 3. Note that the code still does not produce the correct result because blocks are not (yet) reentrant in the interpreter, but at least the interpreter does not crash anymore. 2014-11-01 Wolfgang Lux * STBlock.m (-dealloc): Release cachedContext attribute. * STBlockContext.m (-dealloc): Restore method to release homeContext attribute. * STBytecodeInterpreter.m (-dealloc): Fix typo in method name and release activeContext attribute. * STBytecodeInterpreter.m (-interpretMethod:forReceiver:arguments:): Release newContext also when an exception is raised while interpreting the method. * STCompiledScript.m (-executeInEnvironment:): Release script object also when an exception is raised while interpreting the script. * STCompiler.m (-dealloc): Release environment attribute. * STCompiler.m (-compileString:): Release local auto release pool also when an exception is raised during compilation. * STSmalltalkScriptObject.m (-forwardInvocation:): Release local autorelease pool and args array also when an exception is raised while interpreting the method. 2014-10-14 Wolfgang Lux * STBlockContext.h (STExecutionContext, -initWithInitialIP:stackSize:): * STBlockContext.m (-initWithInitialIP:stackSize:): * STBlock.m (-valueWithArguments:): Remove unused interpreter attribute and corresponding argument from STBlockContext and its initializer. 2014-10-14 Wolfgang Lux * STMethodContext.h (+methodContextWithMethod:, initWithMethod:): * STMethodContext.m (+methodContextWithMethod:, initWithMethod:): * STBytecodeInterpreter.m (-interpretMethod:forReceiver:arguments:): Remove unused environment argument from STMethodContext initializer. 2014-10-14 Wolfgang Lux * STSmalltalkScriptObject.m (-forwardInvocation:): Set the return value of the invocation object also when the exit pseudo method of the script object is called. 2014-10-14 Wolfgang Lux * STBlock.m (-value:value:): * STBlock.m (-value:value:value:): Add missing nil terminator to argument list of arrayWithObjects. 2014-09-09 Wolfgang Lux * STCompiler.m (-setReceiverVariables:): Do not assign a non-mutable array to a mutable array attribute. 2014-09-09 Wolfgang Lux * STCompiledCode.h (STCompiledCode, -namedReferences, -initWithBytecodesData:literals:temporariesCount:stackSize:namedReferences:): * STCompiledCode.m (-namedReferences, -initWithBytecodesData:literals:temporariesCount:stackSize:namedReferences:): Change namedRefs attribute into a non-mutable array. 2014-09-09 Wolfgang Lux * STBytecodeInterpreter.m (-sendSelectorAtIndex:withArgCount:): * STCompiler.m (-compileString:, -emitPopAndStoreTemporary:, -emitPopAndStoreVariable:, -emitPopAndStoreReceiverVariable:, -emitSendSelector:argCount:): Fix NSDebugLLog format issues detect by clang. 2013-06-30 Wolfgang Lux * STSourceReader.m (-lineNumberForIndex:, -readNextToken): Tidy source. * STSourceReader.m (-readNextToken): Bug fixes: - Prevent out of range accesses for the input string. - Exponent of a real number must contain at least one digit. - Incorrect token range for character literals. - Incorrect token range for symbol immediately before end of source. 2013-05-26 Wolfgang Lux * STGrammar.y (temporaries): Allow empty list. * STGrammar.m: Regenerated. 2013-05-26 Wolfgang Lux * NSNumber+additions.h: * NSNumber+additions.m: * STBlock.h: * STBlock.m: * STBlockContext.h: * STBlockContext.m: * STBytecodeInterpreter.h: * STBytecodeInterpreter.m: * STBytecodes.h: * STBytecodes.m: * STCompiledCode.h: * STCompiledCode.m: * STCompiledMethod.h: * STCompiledMethod.m: * STCompiledScript.m: * STCompiler.h: * STCompiler.m: * STExecutionContext.h: * STExecutionContext.m: * STLiterals.h: * STLiterals.m: * STMethodContext.h: * STMethodContext.m: * STSmalltalkScriptObject.m: * STSourceReader.h: * STSourceReader.m: * STStack.h: * STStack.m: int->NSInteger transition 2013-04-06 Wolfgang Lux * STSourceReader.m (-readNextToken): Fix bug where the last character of an identifier was dropped when the assignment operator ':=' follows it immediately. 2013-04-03 Wolfgang Lux * NSArray+additions.m (-collect:): Properly handle nil results from block. 2013-04-03 Wolfgang Lux * STSourceReader.m (-lineNumberForIndex:): Revert broken fix and replace it by code that now works correctly for all kinds of line endings. 2013-03-25 Wolfgang Lux * STBytecodeInterpreter.m (-returnValue:): Fix bug where the STInterpreterReturnException was not handled when a block returns nil. 2013-03-24 Wolfgang Lux * STCompiler.m (-compileMethod:): Follow Smalltalk convention to return the receiver from a method without an explicit return statement. * STCompiler.m (-compileStatements:blockFlag:): Return nil from an empty block and the receiver from an empty method. 2013-03-24 Wolfgang Lux * STExecutionContext.h: Change type of instruction pointer attribute to NSUInteger. * STExecutionContext.m (-invalidate, -isValid): Invalidate an execution context by setting its instruction pointer to NSNotFound. * STMethodContext.m (-invalidate, -isValid): * STBlockContext.m (-invalidate, -isValid): Delete method implementations so that the method and home context attributes of a method context and block context, respectively, are not destroyed when the method or block returns. Together these changes make it possible to use blocks even after the method containing their definition has returned. 2013-03-24 Wolfgang Lux * Externs.h (STInterpreterReturnException): * Externs.m (STInterpreterReturnException): * STCompiler.m (-compileStatements:blockFlag:): * STBytecodeInterpreter.m (-interpretMethod:forReceiver:arguments: -returnValue:, -returnBlockValue:, -dispatchBytecode:): An explicit return statement in a block returns from the method context containing the block's definition. This is achieved by throwing a STInterpreterReturnException. * STBlock.m (-handler:): Don't let user code handle STInterpreterReturnException. * STBytecodeInterpreter.m (-interpret): Fix incorrect logging levels. 2013-03-23 Wolfgang Lux * STCompiler.m (-compileStatements:blockFlag:): Fix compiler bug: The value of a Smalltalk statement sequence is the value of its last statement and not that of the first. 2013-03-23 Wolfgang Lux * STBlock.m (-initWithInterpreter:...): * STBlockContext.m (initWithInterpreter:initialIP:stackSize:): * STBytecodeInterpreter.m (-initWithEnvironment:): * STBytecodes.m (-initWithData:, -initWithCoder:): * STCompiledMethod.m (-initWihtSelector:argumentCount:bytecodeData:...) -initWithCoder:): * STCompiledScript.m (-initWithVariableNames:): * STCompiler.m (-initWithEnvironment:, -init): * STCompilerUtils.m(STCMethod) (-initWithPattern:statements:): * STCompilerUtils.m(STCMessage) (-init): * STCompilerUtils.m(STCMessageExpression) (-initWithTarget:message:): * STCompilerUtils.m(STCPrimaryExpression) (-initWithObject:): * STCompilerUtils.m(STCPrimary) (-initWithType:object:): * STExecutionContext.m (-initWithStackSize:): * STLiterals.m(STObjectReferenceLiteral) (initWithObjectName:poolName:): * STLiterals.m(STBlockLiteral) (-initWithArgumentCount:): * STMessage.m (-initWithSelector:arguments:): * STMethodContext.m (-initWithMethod:environment:): * STSmalltalkScriptObject.m (-initWithEnvironment:compiledScript:): * STSourceReader.m (initWithString:range:): * STStack.m (-initWithSize:): Check the result of the super class initializer and assign it to self. * STBlock.m (-initWithInterpreter:..., -dealloc): Retain and release the homeContext and interpreter attributes. * STBytecodeInterpreter.m (-delloc): Release environment attribute to fix space leak. * STBytecodeInterpreter.m (createBlockWithArgumentCount:stackSize:): * STCompiledMethod.m (+methodWithCode:messagePattern:): * STCompilerUtils.m (+primaryWithVariable:, +primaryWithLiteral:, +primaryWithBlock:, +primaryWithExpression:): Use idiomatic Objective-C code, which never assigns the result of an +alloc method to a local variable. 2013-03-02 Wolfgang Lux * STSourceReader.m (_STNormalizeStringToken): Unescape two successive single quote characters inside literal string tokens. 2013-02-08 Wolfgang Lux * STBlock.h (value:,value:value:,value:value:value:,valueWithArguments:): * STBlock.m (value:,value:value:,value:value:value:,valueWithArguments:): Define standard Smalltalk methods for invoking blocks with arguments. * STBlock.m (valueWith:,valueWith:with:,valueWith:with:with:, valueWith:with:with:with:,valueWithArgs:,handler:): * NSArray+additions.m (do:,select:,reject:,collect:,detect:): * NSNumber+additions.m (to:do:,to:step:do:): Use the new standard methods instead of the old non-standard ones. 2012-12-02 Wolfgang Lux * STCompiler.m (compileString:): Fix syntax error reporting to properly show the error context. * STCompiler.m (compileMethodFromSource:forReceiver:): Fix space leak when an exception other than a syntax error is raised. * STCompiler.m (compileStatements:): Autorelease compiled code here ... * STCompiler.m (compileMethod:): ... instead of here. 2012-10-26 Wolfgang Lux * STCompilerUtils.m (STCPrimaryExpression): Remove repeated attribute declaration from the implementation. 2012-02-07 Wolfgang Lux * STSourceReader.m (-lineNumberForIndex:): Fix unintended fall through in a switch statement detected by clang. 2012-02-07 Wolfgang Lux * STCompiledScript.m (-executedInEnvironment:): * STSmalltalkScriptObject.m (-forwardInvocation:): Fix potential space leak detected by clang. 2012-01-15 Wolfgang Lux * STCompiledScript.m (+initialize, -executeInEnvironment:): Rename finalize selector to shutDown to avoid conflict with the NSObject -finalize method. 2012-01-15 Wolfgang Lux * STCompiler.m (-indexOfTemporaryVariable, -indexOfNamedReference, -compilePrimary:, -compileExpression:): Minimal set of changes to accomodate to large NSNotFound value on 64-bit machines. 2012-01-15 Wolfgang Lux * STCompiler.m (-exceptionInfo): Return exceptionInfo dictionary. * STCompiler.m (-compileMethodFromSource:forReceiver:, -compileString:, -indexOfNamedReference:): Remove unneeded variables reported by gcc 4.6. 2012-01-15 Wolfgang Lux * STBytecodes.h (-data, -length): Declare public methods. * STMethodContext.h: Remove declaration of unused methods, which were not implemented. * STCompiler.h (STCompiler, -compiledMethodFromSource:forReceiver:): * STCompiler.m (-compiledMethodFromSource:forReceiver:): STCompiler expects its receiver attribute to be a STScriptObject not just an object that satisfies the weaker STScriptObject protocol. * STSmalltalkScriptObject.m: Import NSDictionary and NSKeyValueCoding, whose methods are used in the implementation. * STCompiledMethod.h: Import definition of STMethod protocol instead of just declaring it. Gcc 4.6 complains if a protocol whose definition is not visible is used in an interface declaration. 2012-01-15 Wolfgang Lux * STBytecodeInterpreter.m: Remove unnecessary include of Objective-C runtime header. 2011-01-20 Wolfgang Lux * SmalltalkInfo.plist: Add missing semicolons at end of plist dictionaries. 2011-01-20 Wolfgang Lux * STSourceReader.m (-readNextToken): Fix bug where an incorrect token range was set for a string token that ends at the end of the input string. 2005 Aug 17 Stefan Urbanek * NSObject+additions: new file, new method ifNil:block 2005 June 24 Stefan Urbanek * STCompiler: Fixed STUndefinedKeyException name as it was fixed in -base 2005 June 20 Stefan Urbanek * Rewritten parts of STCompiler, STBytecodeInterpreter, STCompiled* and ' ST*Context: Smalltalk now refers to instance variables by name not by index. This should allow creation of STActor class and final implementation of instance variables in STScriptObject. Instance variables are accessed by their name through Key-Value-Coding protocol. 2005 Mar 9 Stefan Urbanek * Patch by Matthew D Swank: patch that keeps the temp space allocated to a particular block, while avoiding naming conflicts by storing empty strings as placeholders _after_ the block has been compiled (and the names are no longer needed). 2004 Nov 9 Stefan Urbanek * Remove STMethodSignatureForSelector as it was deprecated because of inportability to OSX. 2004 Nov 2 Stefan Urbanek * Changed super of STBytecodes from NSData to NSObject - there were some OSX issues 2004 Jul 10 Stefan Urbanek * Applied patch from Alexander V. Diemand (fixed bug #9595) - fixed maximum number of literals, fixed longjmp 2004 Jun 28 Stefan Urbanek * Fixed expresion duplicating. 2004 Jun 27 Stefan Urbanek * Version 0.8.1 2004 Jun 20 Stefan Urbanek * Added a fix to the compiler from Mateu Batle 2004 May 27 Stefan Urbanek * Fixed bug with signed/unsigned bytecode, which made StepTalk to crash if has more than 127 literals in the array. (patch by Mateu Batle) 2003 Sep 28 Stefan Urbanek * NSNumber: fixed -NSNumber to:step:do: - now accepts negative step. (Patch by Alexander Diemand) 2003 Sep 24 Stefan Urbanek * Guard compilation with an autorelease pool 2003 Sep 23 Stefan Urbanek * STBytecodeInterpreter: fixed memory leak (reported by Alexander Diemand) 2003 Aug 5 Stefan Urbanek * STScriptObject renamed to STSmalltalkScriptObject, because of steptalk core change. 2003 May 17 Stefan Urbanek * STSourceReader: treat decimal point followed by whitespace as '.' dot - end of statement. 2003 May 9 Stefan Urbanek * NSString+additions: added 2003 May 4 Stefan Urbanek * SmalltalkEngine: remove exception guard to allow debugging 2003 Apr 29 Stefan Urbanek * STSourceReader: fixed reading of identifiers at the end of source 2003 Apr 21 Stefan Urbanek * Version 0.7.1 2003 Apr 6 Stefan Urbanek * STCompiler: compileString: fixed exception reporting. 2003 Apr 04 David Ayers * GNUmakefile: Added flags to show all warnings except for import. * STBlock.m: Initialzed variables to supress compiler warnings. * STCompiledMethod.m: Added needed import. * STCompiler.m: Added missing declaration. Wrapped declarations only needed for DEBUG into #ifdefs to supress compiler warnings. Initialzed variables to supress compiler warnings. * STExecutionContext.m: Unified name for private categories. 2003 Mar 25 Stefan Urbanek * STSourceReader: added missing [super dealloc] * STCompiledCode: do not retain bytecode data * STCompiler: various memory leak fixes * SmalltalkEngine: guard compilation exception and release the compiler 2003 Mar 23 Stefan Urbanek * STSourceReader: added some end of string checks 2003 Feb 3 Stefan Urbanek * Version 0.7.0 2003 Feb 3 Stefan Urbanek * STSourceReader: fixed reading of a number terminated with '.', we treat it as an integer. Reader was complaining about i := 1.; fixed reading of var:=something. It was terating 'var:' as a selector keyword. 2003 Jan 30 Stefan Urbanek * ChangeLog, STBlock.m, STBytecodes.h, STBytecodes.m, STCompiledMethod.m, STCompiler.h, STCompiler.m, STCompilerUtils.h, STCompilerUtils.m, STExecutionContext.m, STGrammar.m, STGrammar.y, STLiterals.h, STLiterals.m, STMethodContext.h, STSourceReader.h, SmalltalkEngine.m: Cleanup of compiler warnings 2002 Dec 25 Stefan Urbanek * Version 0.6.2 2002 Dec 21 Stefan Urbanek * STSourceReader, STCompiler, STGrammar: Added real number parsing 2002 Sep 15 Stefan Urbanek * Version 0.6.1 2002 Aug 30 Stefan Urbanek * Code cleanup. 2002 Jun 14 Stefan Urbanek * STMethodContext: Raise exception on invalid reference, not on undefined object 2002 Jun 13 Stefan Urbanek * STCompiledMethod: Removed unused methods * STBytecodeInterpreter: rewritten context handling; removed unused methods * STBlockContext: rewritten context handling; cleaned exception handler * STGrammar.y: fixed empty arrays #() * STExecutionContext: removed parent context as it is longer used 2002 Jun 7 Stefan Urbanek * STBytecodeInterpreter: fixed debug-log bug 2002 Jun 6 Stefan Urbanek * STSourceReader: fixed bug in reading number token type and binary selectors beginning with the '-' character. * Moved NSObject-additions to the StepTalk sources 2002 May 29 Stefan Urbanek * STCompiledScript: assign return value on executing single-method script 2002 May 15 Stefan Urbanek * STCompiler, Externs, STGrammar: fixed undefined exceptions (reported by Björn Gohla ) 2002 Mar 17 Stefan Urbanek * STCompiler, STGrammar: changed grammar to be able to have "methods" or "just statements" in source 2002 Feb 14 Stefan Urbanek * STSourceReader: Retain character sets 2002 Feb 5 Stefan Urbanek * STSelector+additions.[hm]: new files * STCompiler: use STSelector class for symbol literals 2002 Feb 3 Stefan Urbanek * STScriptObject: handle special method 'exit' * STBytecodeInterpreter: added code to halt the interpreter and return from all contexts 2002 Jan 31 Stefan Urbanek * STBlock: small speed improvements * STBlockContext: removed evaluateWithArguments:count:, and moved code into STBLock 2002 Jan 23 Stefan Urbanek * NSNumber+additions: moved arithmetic code to the library 2002 Jan 22 Stefan Urbanek * STCompiler: create one more duplicate of stack top when assigning to a variable. 2002 Jan 9 Stefan Urbanek * SmalltalkEngine: implemented executeScript:inEnvironment: 2001 Dec 8 Stefan Urbanek * Fixed temporary variable compilation * Added special handling of nil, YES and NO constants; added corresponding bytecodes 2001 Dec 8 Stefan Urbanek * CahgeLog started StepTalk-0.10.0/Languages/Smalltalk/SmalltalkEngine.m0000664000175000017500000001024714633027767021510 0ustar yavoryavor/** SmalltalkEngine Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Oct 24 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 "SmalltalkEngine.h" #import "STCompiler.h" #import "STCompiledCode.h" #import "STCompiledMethod.h" #import "STCompiledScript.h" #import "STBytecodeInterpreter.h" #import #import #import #import #import @implementation SmalltalkEngine - (BOOL)canInterpret:(NSString *)sourceCode { STCompiler *compiler; STCompiledScript *script = nil; BOOL retval = NO; compiler = [[STCompiler alloc] init]; NS_DURING script = [compiler compileString:sourceCode]; NS_HANDLER NSLog(@"Smalltalk: Ignoring: %@", [localException reason]); NS_ENDHANDLER if(script) { retval = YES; } RELEASE(compiler); return retval; } - (id) executeCode:(NSString *)sourceCode inEnvironment:(STEnvironment *)env { NSLog(@"%@ is deprecated, use interpretScript:inContext: instead", NSStringFromSelector(_cmd)); return [self interpretScript:sourceCode inContext:env]; } - (id)interpretScript:(NSString *)script inContext:(STContext *)context { STCompiler *compiler; STCompiledScript *compiledScript; id retval = nil; compiler = [STCompiler compilerWithEnvironment:context]; compiledScript = [compiler compileString:script]; retval = [compiledScript executeInEnvironment:context]; return retval; } - (id )methodFromSource:(NSString *)sourceString forReceiver:(id)receiver inEnvironment:(STEnvironment *)env { NSLog(@"%@ is deprecated, use methodFromSource:forReceiver:inContext: instead", NSStringFromSelector(_cmd)); return [self methodFromSource:sourceString forReceiver:receiver inContext:env]; } - (id )methodFromSource:(NSString *)sourceString forReceiver:(id)receiver inContext:(STContext *)context { STCompiler *compiler; id method; compiler = [STCompiler compilerWithEnvironment:context]; method = [compiler compileMethodFromSource:sourceString forReceiver:receiver]; return method; } - (id) executeMethod:(id )aMethod forReceiver:(id)anObject withArguments:(NSArray *)args inEnvironment:(STEnvironment *)env { NSLog(@"%@ is deprecated, use ...inContext: instead", NSStringFromSelector(_cmd)); return [self executeMethod:aMethod forReceiver:anObject withArguments:args inContext:env]; } - (id) executeMethod:(id )aMethod forReceiver:(id)anObject withArguments:(NSArray *)args inContext:(STContext *)context { STBytecodeInterpreter *interpreter; id result; interpreter = [STBytecodeInterpreter interpreterWithEnvrionment:context]; result = [interpreter interpretMethod:(STCompiledMethod *)aMethod forReceiver:anObject arguments:args]; return result; } @end StepTalk-0.10.0/Languages/Smalltalk/STGrammar.y0000664000175000017500000003771014633027767020313 0ustar yavoryavor/** STGrammar.y StepTalk grammar Copyright (c) 2000 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 */ %{ #define YYSTYPE id #define YYLTYPE int #undef YYDEBUG #import #import "STCompiler.h" #import "STCompilerUtils.h" #import "STSourceReader.h" #import "Externs.h" #import /* extern int STCerror(const char *str); extern int STClex (YYSTYPE *lvalp, void *context); */ #define YYPARSE_PARAM context #define YYLEX_PARAM context #define YYERROR_VERBOSE #define CONTEXT ((STParserContext *)context) #define COMPILER (CONTEXT->compiler) #define READER (CONTEXT->reader) #define RESULT (CONTEXT->result) int STClex (YYSTYPE *lvalp, void *context); int STCerror(const char *str); %} %pure_parser /* BISON declarations */ %token TK_SEPARATOR TK_BAR TK_ASSIGNMENT %token TK_LPAREN TK_RPAREN TK_BLOCK_OPEN TK_BLOCK_CLOSE TK_ARRAY_OPEN %token TK_DOT TK_COLON TK_SEMICOLON TK_RETURN %token TK_IDENTIFIER TK_BINARY_SELECTOR TK_KEYWORD %token TK_INTNUMBER TK_REALNUMBER TK_SYMBOL TK_STRING TK_CHARACTER /* Grammar */ %% source: /* empty string */ { [COMPILER compileMethod:nil]; } | plain_code { [COMPILER compileMethod:$1]; } /* FIXME: this is a hack */ | TK_SEPARATOR TK_SEPARATOR method { [COMPILER compileMethod:$3]; } | TK_BLOCK_OPEN TK_BAR { [COMPILER beginScript]; } methods TK_BLOCK_CLOSE ; plain_code: statements { $$ = [STCMethod methodWithPattern:nil /**/ statements:$1]; } | temporaries statements { [$2 setTemporaries:$1]; $$ = [STCMethod methodWithPattern:nil /**/ statements:$2]; } ; methods: block_var_list { [COMPILER setReceiverVariables:$1]; } method_list | method_list ; method_list: method { [COMPILER compileMethod:$1]; } | method_list TK_SEPARATOR method { [COMPILER compileMethod:$3]; } ; method: message_pattern statements { $$ = [STCMethod methodWithPattern:$1 /**/ statements:$2]; } | message_pattern temporaries statements { [$3 setTemporaries:$2]; $$ = [STCMethod methodWithPattern:$1 /**/ statements:$3]; } ; message_pattern: unary_selector { $$ = [STCMessage message]; [$$ addKeyword:$1 object:nil]; } | binary_selector variable_name { $$ = [STCMessage message]; [$$ addKeyword:$1 object:$2]; } | keyword_list ; keyword_list: keyword variable_name { $$ = [STCMessage message]; [$$ addKeyword:$1 object:$2]; } | keyword_list keyword variable_name { [$1 addKeyword:$2 object:$3]; $$ = $1; } ; temporaries: TK_BAR TK_BAR { $$ = [NSMutableArray array]; } | TK_BAR variable_list TK_BAR { $$ = $2; } ; variable_list: variable_name { $$ = [NSMutableArray array]; [$$ addObject:$1]; } | variable_list variable_name { $$ = $1; [$$ addObject:$2]; } ; block: TK_BLOCK_OPEN TK_BLOCK_CLOSE { $$ = [STCStatements statements]; } | TK_BLOCK_OPEN statements TK_BLOCK_CLOSE { $$ = $2; } | TK_BLOCK_OPEN block_var_list TK_BAR statements TK_BLOCK_CLOSE { $$ = $4; [$$ setTemporaries:$2]; } ; block_var_list: TK_COLON variable_name { $$ = [NSMutableArray array]; [$$ addObject:$2]; } | block_var_list TK_COLON variable_name { $$ = $1; [$$ addObject:$3]; } ; statements: TK_RETURN expression { $$ = [STCStatements statements]; [$$ setReturnExpression:$2]; } | expressions { $$ = [STCStatements statements]; [$$ setExpressions:$1]; } | expressions TK_DOT { $$ = [STCStatements statements]; [$$ setExpressions:$1]; } | expressions TK_DOT TK_RETURN expression { $$ = [STCStatements statements]; [$$ setReturnExpression:$4]; [$$ setExpressions:$1]; } ; expressions: expression { $$ = [NSMutableArray array]; [$$ addObject:$1]; } | expressions TK_DOT expression { $$ = $1; [$$ addObject:$3]; } ; expression: primary { $$ = [STCExpression /**/ primaryExpressionWithObject:$1]; } | assignments primary { $$ = [STCExpression /**/ primaryExpressionWithObject:$2]; [$$ setAssignments:$1]; } | message_expression | assignments message_expression { $$ = $2; [$$ setAssignments:$1]; } | cascade | assignments cascade { $$ = $2; [$$ setAssignments:$1]; } ; assignments: assignment { $$ = [NSMutableArray array]; [$$ addObject:$1]; } | assignments assignment { $$ = $1; [$$ addObject:$2]; } ; assignment: variable_name TK_ASSIGNMENT { $$ = $1;} ; cascade: message_expression cascade_list { /* FIXME: check if this is this OK */ [$$ setCascade:$2]; } ; cascade_list: TK_SEMICOLON cascade_item { $$ = [NSMutableArray array]; [$$ addObject:$2]; } | cascade_list TK_SEMICOLON cascade_item { $$ = $1; [$$ addObject:$3]; } ; cascade_item: unary_selector { $$ = [STCMessage message]; [$$ addKeyword:$1 object:nil]; } | binary_selector unary_object { $$ = [STCMessage message]; [$$ addKeyword:$1 object:$2]; } | keyword_expr_list ; message_expression: unary_expression | binary_expression | keyword_expression ; unary_expression: unary_object unary_selector { STCMessage *message = [STCMessage message]; [message addKeyword:$2 object:nil]; $$ = [STCExpression /**/ messageExpressionWithTarget:$1 /**/ message:message]; } ; binary_expression: binary_object binary_selector unary_object { STCMessage *message = [STCMessage message]; [message addKeyword:$2 object:$3]; $$ = [STCExpression /**/ messageExpressionWithTarget:$1 /**/ message:message]; } ; keyword_expression: binary_object keyword_expr_list { $$ = [STCExpression /**/ messageExpressionWithTarget:$1 /**/ message:$2]; } ; keyword_expr_list: keyword binary_object { $$ = [STCMessage message]; [$$ addKeyword:$1 object:$2]; } | keyword_expr_list keyword binary_object { $$ = $1; [$$ addKeyword:$2 object:$3]; } ; unary_object: primary | unary_expression ; binary_object: unary_object | binary_expression ; primary: variable_name { $$ = [STCPrimary primaryWithVariable:$1]; } | literal { $$ = [STCPrimary primaryWithLiteral:$1]; } | block { $$ = [STCPrimary primaryWithBlock:$1]; } | TK_LPAREN expression TK_RPAREN { $$ = [STCPrimary primaryWithExpression:$2]; } ; variable_name: TK_IDENTIFIER /* STCheckVariable ... */ ; unary_selector: TK_IDENTIFIER ; binary_selector: TK_BINARY_SELECTOR ; keyword: TK_KEYWORD ; literal: TK_INTNUMBER { $$ = [COMPILER createIntNumberLiteralFrom:$1]; } | TK_REALNUMBER { $$ = [COMPILER createRealNumberLiteralFrom:$1]; } | TK_SYMBOL { $$ = [COMPILER createSymbolLiteralFrom:$1]; } | TK_STRING { $$ = [COMPILER createStringLiteralFrom:$1]; } | TK_CHARACTER { $$ = [COMPILER createCharacterLiteralFrom:$1]; } | TK_ARRAY_OPEN array TK_RPAREN { $$ = [COMPILER createArrayLiteralFrom:$2]; } ; array: /* nothing */ { $$ = [NSMutableArray array]; } | literal { $$ = [NSMutableArray array]; [$$ addObject:$1]; } | symbol { $$ = [NSMutableArray array]; [$$ addObject:$1]; } | array literal { $$ = $1; [$$ addObject:$2]; } | array symbol { $$ = $1; [$$ addObject:$2]; } ; symbol: TK_IDENTIFIER { $$ = [COMPILER createSymbolLiteralFrom:$1]; } | binary_selector { $$ = [COMPILER createSymbolLiteralFrom:$1]; } | TK_KEYWORD { $$ = [COMPILER createSymbolLiteralFrom:$1]; } ; %% int STCerror(const char *str) { [NSException raise:STCompilerSyntaxException format:@"Unknown parse error (%s)", str]; return 0; } /* * Lexer * -------------------------------------------------------------------------- */ int STClex (YYSTYPE *lvalp, void *context) { STTokenType tokenType = [READER nextToken]; if(tokenType == STEndTokenType) { return 0; } *lvalp = [READER tokenString]; switch(tokenType) { case STBarTokenType: return TK_BAR; case STReturnTokenType: return TK_RETURN; case STColonTokenType: return TK_COLON; case STSemicolonTokenType: return TK_SEMICOLON; case STDotTokenType: return TK_DOT; case STLParenTokenType: return TK_LPAREN; case STRParenTokenType: return TK_RPAREN; case STBlockOpenTokenType: return TK_BLOCK_OPEN; case STBlockCloseTokenType: return TK_BLOCK_CLOSE; case STArrayOpenTokenType: return TK_ARRAY_OPEN; case STAssignTokenType: return TK_ASSIGNMENT; case STIdentifierTokenType: return TK_IDENTIFIER; case STKeywordTokenType: return TK_KEYWORD; case STBinarySelectorTokenType: return TK_BINARY_SELECTOR; case STSymbolTokenType: return TK_SYMBOL; case STStringTokenType: return TK_STRING; case STCharacterTokenType: return TK_CHARACTER; case STIntNumberTokenType: return TK_INTNUMBER; case STRealNumberTokenType: return TK_REALNUMBER; case STSeparatorTokenType: return TK_SEPARATOR; case STEndTokenType: return 0; case STSharpTokenType: case STInvalidTokenType: case STErrorTokenType: return 1; } return 1; } StepTalk-0.10.0/Languages/Smalltalk/STGrammar.m.h0000664000175000017500000000075714633027767020526 0ustar yavoryavor#ifndef YYSTYPE #define YYSTYPE int #endif #define TK_SEPARATOR 258 #define TK_BAR 259 #define TK_ASSIGNMENT 260 #define TK_LPAREN 261 #define TK_RPAREN 262 #define TK_BLOCK_OPEN 263 #define TK_BLOCK_CLOSE 264 #define TK_ARRAY_OPEN 265 #define TK_DOT 266 #define TK_COLON 267 #define TK_SEMICOLON 268 #define TK_RETURN 269 #define TK_IDENTIFIER 270 #define TK_BINARY_SELECTOR 271 #define TK_KEYWORD 272 #define TK_NUMBER 273 #define TK_SYMBOL 274 #define TK_STRING 275 #define TK_CHARACTER 276 StepTalk-0.10.0/Languages/Smalltalk/NSString+additions.h0000664000175000017500000000212214633027767022103 0ustar yavoryavor/** 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 StepTalk-0.10.0/Languages/Smalltalk/GNUmakefile0000664000175000017500000000443314633027767020332 0ustar yavoryavor# # 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_LIBRARY)/StepTalk/Languages Smalltalk_OBJC_FILES = \ SmalltalkEngine.m \ NSArray+additions.m \ NSDictionary+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 \ STUndefinedObject+additions.m \ STSelector+additions.m \ STSourceReader.m \ Externs.m Smalltalk_PRINCIPAL_CLASS = SmalltalkEngine ADDITIONAL_OBJCFLAGS = -Wall -Wno-import ADDITIONAL_INCLUDE_DIRS += -I../../Source/Headers 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 $@ $< StepTalk-0.10.0/Languages/Smalltalk/STGrammar.m0000664000175000017500000020521614633027767020275 0ustar yavoryavor/* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 1 /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse STCparse #define yylex STClex #define yyerror STCerror #define yylval STClval #define yychar STCchar #define yydebug STCdebug #define yynerrs STCnerrs /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { TK_SEPARATOR = 258, TK_BAR = 259, TK_ASSIGNMENT = 260, TK_LPAREN = 261, TK_RPAREN = 262, TK_BLOCK_OPEN = 263, TK_BLOCK_CLOSE = 264, TK_ARRAY_OPEN = 265, TK_DOT = 266, TK_COLON = 267, TK_SEMICOLON = 268, TK_RETURN = 269, TK_IDENTIFIER = 270, TK_BINARY_SELECTOR = 271, TK_KEYWORD = 272, TK_INTNUMBER = 273, TK_REALNUMBER = 274, TK_SYMBOL = 275, TK_STRING = 276, TK_CHARACTER = 277 }; #endif /* Tokens. */ #define TK_SEPARATOR 258 #define TK_BAR 259 #define TK_ASSIGNMENT 260 #define TK_LPAREN 261 #define TK_RPAREN 262 #define TK_BLOCK_OPEN 263 #define TK_BLOCK_CLOSE 264 #define TK_ARRAY_OPEN 265 #define TK_DOT 266 #define TK_COLON 267 #define TK_SEMICOLON 268 #define TK_RETURN 269 #define TK_IDENTIFIER 270 #define TK_BINARY_SELECTOR 271 #define TK_KEYWORD 272 #define TK_INTNUMBER 273 #define TK_REALNUMBER 274 #define TK_SYMBOL 275 #define TK_STRING 276 #define TK_CHARACTER 277 /* Copy the first part of user declarations. */ #line 25 "STGrammar.y" #define YYSTYPE id #define YYLTYPE int #undef YYDEBUG #import #import "STCompiler.h" #import "STCompilerUtils.h" #import "STSourceReader.h" #import "Externs.h" #import /* extern int STCerror(const char *str); extern int STClex (YYSTYPE *lvalp, void *context); */ #define YYPARSE_PARAM context #define YYLEX_PARAM context #define YYERROR_VERBOSE #define CONTEXT ((STParserContext *)context) #define COMPILER (CONTEXT->compiler) #define READER (CONTEXT->reader) #define RESULT (CONTEXT->result) int STClex (YYSTYPE *lvalp, void *context); int STCerror(const char *str); /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef int YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 216 of yacc.c. */ #line 189 "STGrammar.m" #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if defined YYENABLE_NLS && YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int i) #else static int YYID (i) int i; #endif { return i; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss; YYSTYPE yyvs; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 51 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 245 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 23 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 37 /* YYNRULES -- Number of rules. */ #define YYNRULES 84 /* YYNRULES -- Number of states. */ #define YYNSTATES 121 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 277 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 4, 6, 10, 11, 17, 19, 22, 23, 27, 29, 31, 35, 38, 42, 44, 47, 49, 52, 56, 59, 63, 65, 68, 71, 75, 81, 84, 88, 91, 93, 96, 101, 103, 107, 109, 112, 114, 117, 119, 122, 124, 127, 130, 133, 136, 140, 142, 145, 147, 149, 151, 153, 156, 160, 163, 166, 170, 172, 174, 176, 178, 180, 182, 184, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 210, 211, 213, 215, 218, 221, 223, 225 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 24, 0, -1, -1, 26, -1, 3, 3, 30, -1, -1, 8, 4, 25, 27, 9, -1, 37, -1, 33, 37, -1, -1, 36, 28, 29, -1, 29, -1, 30, -1, 29, 3, 30, -1, 31, 37, -1, 31, 33, 37, -1, 54, -1, 55, 53, -1, 32, -1, 56, 53, -1, 32, 56, 53, -1, 4, 4, -1, 4, 34, 4, -1, 53, -1, 34, 53, -1, 8, 9, -1, 8, 37, 9, -1, 8, 36, 4, 37, 9, -1, 12, 53, -1, 36, 12, 53, -1, 14, 39, -1, 38, -1, 38, 11, -1, 38, 11, 14, 39, -1, 39, -1, 38, 11, 39, -1, 52, -1, 40, 52, -1, 45, -1, 40, 45, -1, 42, -1, 40, 42, -1, 41, -1, 40, 41, -1, 53, 5, -1, 45, 43, -1, 13, 44, -1, 43, 13, 44, -1, 54, -1, 55, 50, -1, 49, -1, 46, -1, 47, -1, 48, -1, 50, 54, -1, 51, 55, 50, -1, 51, 49, -1, 56, 51, -1, 49, 56, 51, -1, 52, -1, 46, -1, 50, -1, 47, -1, 53, -1, 57, -1, 35, -1, 6, 39, 7, -1, 15, -1, 15, -1, 16, -1, 17, -1, 18, -1, 19, -1, 20, -1, 21, -1, 22, -1, 10, 58, 7, -1, -1, 57, -1, 59, -1, 58, 57, -1, 58, 59, -1, 15, -1, 55, -1, 17, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 69, 69, 74, 79, 86, 85, 93, 98, 108, 107, 113, 116, 120, 126, 131, 140, 145, 150, 153, 158, 165, 169, 175, 180, 187, 191, 195, 201, 206, 213, 218, 224, 229, 238, 243, 249, 254, 260, 261, 266, 267, 273, 278, 285, 288, 294, 299, 305, 310, 315, 318, 319, 320, 322, 331, 340, 347, 352, 358, 359, 361, 362, 364, 368, 372, 376, 381, 383, 385, 387, 390, 392, 394, 396, 398, 400, 403, 404, 406, 408, 409, 411, 413, 415 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "TK_SEPARATOR", "TK_BAR", "TK_ASSIGNMENT", "TK_LPAREN", "TK_RPAREN", "TK_BLOCK_OPEN", "TK_BLOCK_CLOSE", "TK_ARRAY_OPEN", "TK_DOT", "TK_COLON", "TK_SEMICOLON", "TK_RETURN", "TK_IDENTIFIER", "TK_BINARY_SELECTOR", "TK_KEYWORD", "TK_INTNUMBER", "TK_REALNUMBER", "TK_SYMBOL", "TK_STRING", "TK_CHARACTER", "$accept", "source", "@1", "plain_code", "methods", "@2", "method_list", "method", "message_pattern", "keyword_list", "temporaries", "variable_list", "block", "block_var_list", "statements", "expressions", "expression", "assignments", "assignment", "cascade", "cascade_list", "cascade_item", "message_expression", "unary_expression", "binary_expression", "keyword_expression", "keyword_expr_list", "unary_object", "binary_object", "primary", "variable_name", "unary_selector", "binary_selector", "keyword", "literal", "array", "symbol", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 23, 24, 24, 24, 25, 24, 26, 26, 28, 27, 27, 29, 29, 30, 30, 31, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 35, 36, 36, 37, 37, 37, 37, 38, 38, 39, 39, 39, 39, 39, 39, 40, 40, 41, 42, 43, 43, 44, 44, 44, 45, 45, 45, 46, 47, 48, 49, 49, 50, 50, 51, 51, 52, 52, 52, 52, 53, 54, 55, 56, 57, 57, 57, 57, 57, 57, 58, 58, 58, 58, 58, 59, 59, 59 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 1, 3, 0, 5, 1, 2, 0, 3, 1, 1, 3, 2, 3, 1, 2, 1, 2, 3, 2, 3, 1, 2, 2, 3, 5, 2, 3, 2, 1, 2, 4, 1, 3, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 2, 3, 1, 2, 1, 1, 1, 1, 2, 3, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 0, 1, 1, 2, 2, 1, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 2, 0, 0, 0, 0, 77, 0, 67, 71, 72, 73, 74, 75, 0, 3, 0, 65, 7, 31, 34, 0, 42, 40, 38, 51, 52, 53, 61, 0, 36, 63, 64, 0, 21, 0, 23, 0, 0, 5, 25, 0, 0, 0, 82, 69, 84, 83, 78, 0, 79, 30, 1, 8, 32, 43, 41, 39, 37, 0, 45, 68, 54, 70, 56, 0, 0, 44, 4, 0, 18, 16, 0, 0, 22, 24, 66, 0, 28, 0, 0, 26, 76, 80, 81, 0, 35, 46, 50, 48, 0, 0, 0, 60, 55, 59, 63, 62, 57, 0, 14, 0, 17, 19, 0, 11, 12, 9, 0, 29, 33, 49, 47, 58, 15, 20, 6, 0, 0, 27, 13, 10 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 13, 76, 14, 103, 117, 104, 105, 68, 69, 15, 34, 16, 41, 42, 18, 19, 20, 21, 22, 59, 86, 23, 24, 25, 26, 87, 27, 28, 29, 30, 70, 71, 72, 31, 48, 49 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -61 static const yytype_int16 yypact[] = { 105, 13, 9, 39, 124, 223, 39, -61, -61, -61, -61, -61, -61, 30, -61, 177, -61, -61, 21, -61, 39, -61, -61, 31, 12, 51, -61, 40, 58, 35, 57, -61, 79, -61, 10, -61, 160, 70, -61, -61, 50, 14, 72, -61, -61, -61, -61, -61, 210, -61, -61, -61, -61, 194, -61, -61, 31, 35, 79, 71, -61, -61, -61, 66, 39, 39, -61, -61, 143, 66, -61, 50, 50, -61, -61, -61, 5, -61, 177, 50, -61, -61, -61, -61, 39, -61, -61, 66, -61, 39, 79, 39, -61, 40, -61, -61, -61, 73, 177, -61, 50, -61, -61, 82, 94, -61, 86, 91, -61, -61, 40, -61, 73, -61, -61, -61, 79, 79, -61, -61, 94 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -61, -61, -61, -61, -61, -61, -16, -30, -61, -61, 37, -61, -61, 27, 4, -61, 3, -61, 90, 92, -61, 24, 96, -53, -60, -61, 89, -49, -57, 15, -1, -17, -5, -21, -2, -61, 74 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -63 static const yytype_int8 yytable[] = { 46, 35, 67, 47, 17, 96, 37, 65, 97, 50, 61, 92, 92, 33, 73, 93, 32, 40, 78, 52, 60, 44, 62, 64, 7, 7, 79, -60, -60, -60, 51, 96, 53, 74, 112, 57, 92, 65, 92, 77, 110, 88, 91, 46, 58, 3, 82, 36, 100, 5, -59, -59, -59, 89, 7, 60, 85, 8, 9, 10, 11, 12, 66, 95, 95, 7, 91, -62, -62, 65, 101, 102, 99, 88, 44, 62, 61, 75, 108, 94, 94, 80, 107, 62, 90, 89, 119, 109, 95, 44, 95, 115, 64, 61, 60, 44, 62, 116, 79, 114, 118, 120, 113, 106, 94, 98, 94, 64, 1, 2, 54, 3, 55, 4, 111, 5, 56, 63, 0, 6, 7, 0, 83, 8, 9, 10, 11, 12, 38, 0, 3, 0, 36, 39, 5, 0, 40, 0, 6, 7, 0, 0, 8, 9, 10, 11, 12, 2, 0, 3, 0, 36, 0, 5, 0, 0, 0, 6, 7, 0, 0, 8, 9, 10, 11, 12, 3, 0, 36, 39, 5, 0, 40, 0, 6, 7, 0, 0, 8, 9, 10, 11, 12, 3, 0, 36, 0, 5, 0, 0, 0, 6, 7, 0, 0, 8, 9, 10, 11, 12, 3, 0, 36, 0, 5, 0, 0, 0, 84, 7, 0, 0, 8, 9, 10, 11, 12, 81, 0, 0, 5, 0, 0, 0, 0, 43, 44, 45, 8, 9, 10, 11, 12, 5, 0, 0, 0, 0, 43, 44, 45, 8, 9, 10, 11, 12 }; static const yytype_int8 yycheck[] = { 5, 2, 32, 5, 0, 65, 3, 28, 65, 6, 27, 64, 65, 4, 4, 64, 3, 12, 4, 15, 15, 16, 17, 28, 15, 15, 12, 15, 16, 17, 0, 91, 11, 34, 91, 20, 89, 58, 91, 40, 89, 58, 63, 48, 13, 6, 48, 8, 69, 10, 15, 16, 17, 58, 15, 15, 53, 18, 19, 20, 21, 22, 5, 64, 65, 15, 87, 16, 17, 90, 71, 72, 68, 90, 16, 17, 93, 7, 79, 64, 65, 9, 78, 17, 13, 90, 116, 84, 89, 16, 91, 9, 97, 110, 15, 16, 17, 3, 12, 100, 9, 117, 98, 76, 89, 68, 91, 112, 3, 4, 20, 6, 20, 8, 90, 10, 20, 28, -1, 14, 15, -1, 48, 18, 19, 20, 21, 22, 4, -1, 6, -1, 8, 9, 10, -1, 12, -1, 14, 15, -1, -1, 18, 19, 20, 21, 22, 4, -1, 6, -1, 8, -1, 10, -1, -1, -1, 14, 15, -1, -1, 18, 19, 20, 21, 22, 6, -1, 8, 9, 10, -1, 12, -1, 14, 15, -1, -1, 18, 19, 20, 21, 22, 6, -1, 8, -1, 10, -1, -1, -1, 14, 15, -1, -1, 18, 19, 20, 21, 22, 6, -1, 8, -1, 10, -1, -1, -1, 14, 15, -1, -1, 18, 19, 20, 21, 22, 7, -1, -1, 10, -1, -1, -1, -1, 15, 16, 17, 18, 19, 20, 21, 22, 10, -1, -1, -1, -1, 15, 16, 17, 18, 19, 20, 21, 22 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 3, 4, 6, 8, 10, 14, 15, 18, 19, 20, 21, 22, 24, 26, 33, 35, 37, 38, 39, 40, 41, 42, 45, 46, 47, 48, 50, 51, 52, 53, 57, 3, 4, 34, 53, 8, 39, 4, 9, 12, 36, 37, 15, 16, 17, 55, 57, 58, 59, 39, 0, 37, 11, 41, 42, 45, 52, 13, 43, 15, 54, 17, 49, 55, 56, 5, 30, 31, 32, 54, 55, 56, 4, 53, 7, 25, 53, 4, 12, 9, 7, 57, 59, 14, 39, 44, 49, 54, 55, 13, 56, 46, 50, 52, 53, 47, 51, 33, 37, 56, 53, 53, 27, 29, 30, 36, 37, 53, 39, 50, 44, 51, 37, 53, 9, 3, 28, 9, 30, 29 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, YYLEX_PARAM) #else # define YYLEX yylex (&yylval) #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) yytype_int16 *bottom; yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); fprintf (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { /* The look-ahead symbol. */ int yychar; /* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss = yyssa; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: #line 69 "STGrammar.y" { [COMPILER compileMethod:nil]; ;} break; case 3: #line 74 "STGrammar.y" { [COMPILER compileMethod:(yyvsp[(1) - (1)])]; ;} break; case 4: #line 80 "STGrammar.y" { [COMPILER compileMethod:(yyvsp[(3) - (3)])]; ;} break; case 5: #line 86 "STGrammar.y" { [COMPILER beginScript]; ;} break; case 7: #line 94 "STGrammar.y" { (yyval) = [STCMethod methodWithPattern:nil /**/ statements:(yyvsp[(1) - (1)])]; ;} break; case 8: #line 99 "STGrammar.y" { [(yyvsp[(2) - (2)]) setTemporaries:(yyvsp[(1) - (2)])]; (yyval) = [STCMethod methodWithPattern:nil /**/ statements:(yyvsp[(2) - (2)])]; ;} break; case 9: #line 108 "STGrammar.y" { [COMPILER setReceiverVariables:(yyvsp[(1) - (1)])]; ;} break; case 12: #line 117 "STGrammar.y" { [COMPILER compileMethod:(yyvsp[(1) - (1)])]; ;} break; case 13: #line 121 "STGrammar.y" { [COMPILER compileMethod:(yyvsp[(3) - (3)])]; ;} break; case 14: #line 127 "STGrammar.y" { (yyval) = [STCMethod methodWithPattern:(yyvsp[(1) - (2)]) /**/ statements:(yyvsp[(2) - (2)])]; ;} break; case 15: #line 132 "STGrammar.y" { [(yyvsp[(3) - (3)]) setTemporaries:(yyvsp[(2) - (3)])]; (yyval) = [STCMethod methodWithPattern:(yyvsp[(1) - (3)]) /**/ statements:(yyvsp[(3) - (3)])]; ;} break; case 16: #line 141 "STGrammar.y" { (yyval) = [STCMessage message]; [(yyval) addKeyword:(yyvsp[(1) - (1)]) object:nil]; ;} break; case 17: #line 146 "STGrammar.y" { (yyval) = [STCMessage message]; [(yyval) addKeyword:(yyvsp[(1) - (2)]) object:(yyvsp[(2) - (2)])]; ;} break; case 19: #line 154 "STGrammar.y" { (yyval) = [STCMessage message]; [(yyval) addKeyword:(yyvsp[(1) - (2)]) object:(yyvsp[(2) - (2)])]; ;} break; case 20: #line 159 "STGrammar.y" { [(yyvsp[(1) - (3)]) addKeyword:(yyvsp[(2) - (3)]) object:(yyvsp[(3) - (3)])]; (yyval) = (yyvsp[(1) - (3)]); ;} break; case 21: #line 166 "STGrammar.y" { (yyval) = [NSMutableArray array]; ;} break; case 22: #line 170 "STGrammar.y" { (yyval) = (yyvsp[(2) - (3)]); ;} break; case 23: #line 176 "STGrammar.y" { (yyval) = [NSMutableArray array]; [(yyval) addObject:(yyvsp[(1) - (1)])]; ;} break; case 24: #line 181 "STGrammar.y" { (yyval) = (yyvsp[(1) - (2)]); [(yyval) addObject:(yyvsp[(2) - (2)])]; ;} break; case 25: #line 188 "STGrammar.y" { (yyval) = [STCStatements statements]; ;} break; case 26: #line 192 "STGrammar.y" { (yyval) = (yyvsp[(2) - (3)]); ;} break; case 27: #line 196 "STGrammar.y" { (yyval) = (yyvsp[(4) - (5)]); [(yyval) setTemporaries:(yyvsp[(2) - (5)])]; ;} break; case 28: #line 202 "STGrammar.y" { (yyval) = [NSMutableArray array]; [(yyval) addObject:(yyvsp[(2) - (2)])]; ;} break; case 29: #line 207 "STGrammar.y" { (yyval) = (yyvsp[(1) - (3)]); [(yyval) addObject:(yyvsp[(3) - (3)])]; ;} break; case 30: #line 214 "STGrammar.y" { (yyval) = [STCStatements statements]; [(yyval) setReturnExpression:(yyvsp[(2) - (2)])]; ;} break; case 31: #line 219 "STGrammar.y" { (yyval) = [STCStatements statements]; [(yyval) setExpressions:(yyvsp[(1) - (1)])]; ;} break; case 32: #line 225 "STGrammar.y" { (yyval) = [STCStatements statements]; [(yyval) setExpressions:(yyvsp[(1) - (2)])]; ;} break; case 33: #line 230 "STGrammar.y" { (yyval) = [STCStatements statements]; [(yyval) setReturnExpression:(yyvsp[(4) - (4)])]; [(yyval) setExpressions:(yyvsp[(1) - (4)])]; ;} break; case 34: #line 238 "STGrammar.y" { (yyval) = [NSMutableArray array]; [(yyval) addObject:(yyvsp[(1) - (1)])]; ;} break; case 35: #line 244 "STGrammar.y" { (yyval) = (yyvsp[(1) - (3)]); [(yyval) addObject:(yyvsp[(3) - (3)])]; ;} break; case 36: #line 250 "STGrammar.y" { (yyval) = [STCExpression /**/ primaryExpressionWithObject:(yyvsp[(1) - (1)])]; ;} break; case 37: #line 255 "STGrammar.y" { (yyval) = [STCExpression /**/ primaryExpressionWithObject:(yyvsp[(2) - (2)])]; [(yyval) setAssignments:(yyvsp[(1) - (2)])]; ;} break; case 39: #line 262 "STGrammar.y" { (yyval) = (yyvsp[(2) - (2)]); [(yyval) setAssignments:(yyvsp[(1) - (2)])]; ;} break; case 41: #line 268 "STGrammar.y" { (yyval) = (yyvsp[(2) - (2)]); [(yyval) setAssignments:(yyvsp[(1) - (2)])]; ;} break; case 42: #line 274 "STGrammar.y" { (yyval) = [NSMutableArray array]; [(yyval) addObject:(yyvsp[(1) - (1)])]; ;} break; case 43: #line 279 "STGrammar.y" { (yyval) = (yyvsp[(1) - (2)]); [(yyval) addObject:(yyvsp[(2) - (2)])]; ;} break; case 44: #line 286 "STGrammar.y" { (yyval) = (yyvsp[(1) - (2)]);;} break; case 45: #line 289 "STGrammar.y" { /* FIXME: check if this is this OK */ [(yyval) setCascade:(yyvsp[(2) - (2)])]; ;} break; case 46: #line 295 "STGrammar.y" { (yyval) = [NSMutableArray array]; [(yyval) addObject:(yyvsp[(2) - (2)])]; ;} break; case 47: #line 300 "STGrammar.y" { (yyval) = (yyvsp[(1) - (3)]); [(yyval) addObject:(yyvsp[(3) - (3)])]; ;} break; case 48: #line 306 "STGrammar.y" { (yyval) = [STCMessage message]; [(yyval) addKeyword:(yyvsp[(1) - (1)]) object:nil]; ;} break; case 49: #line 311 "STGrammar.y" { (yyval) = [STCMessage message]; [(yyval) addKeyword:(yyvsp[(1) - (2)]) object:(yyvsp[(2) - (2)])]; ;} break; case 54: #line 323 "STGrammar.y" { STCMessage *message = [STCMessage message]; [message addKeyword:(yyvsp[(2) - (2)]) object:nil]; (yyval) = [STCExpression /**/ messageExpressionWithTarget:(yyvsp[(1) - (2)]) /**/ message:message]; ;} break; case 55: #line 332 "STGrammar.y" { STCMessage *message = [STCMessage message]; [message addKeyword:(yyvsp[(2) - (3)]) object:(yyvsp[(3) - (3)])]; (yyval) = [STCExpression /**/ messageExpressionWithTarget:(yyvsp[(1) - (3)]) /**/ message:message]; ;} break; case 56: #line 341 "STGrammar.y" { (yyval) = [STCExpression /**/ messageExpressionWithTarget:(yyvsp[(1) - (2)]) /**/ message:(yyvsp[(2) - (2)])]; ;} break; case 57: #line 348 "STGrammar.y" { (yyval) = [STCMessage message]; [(yyval) addKeyword:(yyvsp[(1) - (2)]) object:(yyvsp[(2) - (2)])]; ;} break; case 58: #line 353 "STGrammar.y" { (yyval) = (yyvsp[(1) - (3)]); [(yyval) addKeyword:(yyvsp[(2) - (3)]) object:(yyvsp[(3) - (3)])]; ;} break; case 63: #line 365 "STGrammar.y" { (yyval) = [STCPrimary primaryWithVariable:(yyvsp[(1) - (1)])]; ;} break; case 64: #line 369 "STGrammar.y" { (yyval) = [STCPrimary primaryWithLiteral:(yyvsp[(1) - (1)])]; ;} break; case 65: #line 373 "STGrammar.y" { (yyval) = [STCPrimary primaryWithBlock:(yyvsp[(1) - (1)])]; ;} break; case 66: #line 377 "STGrammar.y" { (yyval) = [STCPrimary primaryWithExpression:(yyvsp[(2) - (3)])]; ;} break; case 71: #line 391 "STGrammar.y" { (yyval) = [COMPILER createIntNumberLiteralFrom:(yyvsp[(1) - (1)])]; ;} break; case 72: #line 393 "STGrammar.y" { (yyval) = [COMPILER createRealNumberLiteralFrom:(yyvsp[(1) - (1)])]; ;} break; case 73: #line 395 "STGrammar.y" { (yyval) = [COMPILER createSymbolLiteralFrom:(yyvsp[(1) - (1)])]; ;} break; case 74: #line 397 "STGrammar.y" { (yyval) = [COMPILER createStringLiteralFrom:(yyvsp[(1) - (1)])]; ;} break; case 75: #line 399 "STGrammar.y" { (yyval) = [COMPILER createCharacterLiteralFrom:(yyvsp[(1) - (1)])]; ;} break; case 76: #line 401 "STGrammar.y" { (yyval) = [COMPILER createArrayLiteralFrom:(yyvsp[(2) - (3)])]; ;} break; case 77: #line 403 "STGrammar.y" { (yyval) = [NSMutableArray array]; ;} break; case 78: #line 404 "STGrammar.y" { (yyval) = [NSMutableArray array]; [(yyval) addObject:(yyvsp[(1) - (1)])]; ;} break; case 79: #line 406 "STGrammar.y" { (yyval) = [NSMutableArray array]; [(yyval) addObject:(yyvsp[(1) - (1)])]; ;} break; case 80: #line 408 "STGrammar.y" { (yyval) = (yyvsp[(1) - (2)]); [(yyval) addObject:(yyvsp[(2) - (2)])]; ;} break; case 81: #line 409 "STGrammar.y" { (yyval) = (yyvsp[(1) - (2)]); [(yyval) addObject:(yyvsp[(2) - (2)])]; ;} break; case 82: #line 412 "STGrammar.y" { (yyval) = [COMPILER createSymbolLiteralFrom:(yyvsp[(1) - (1)])]; ;} break; case 83: #line 414 "STGrammar.y" { (yyval) = [COMPILER createSymbolLiteralFrom:(yyvsp[(1) - (1)])]; ;} break; case 84: #line 416 "STGrammar.y" { (yyval) = [COMPILER createSymbolLiteralFrom:(yyvsp[(1) - (1)])]; ;} break; /* Line 1267 of yacc.c. */ #line 2001 "STGrammar.m" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } #line 418 "STGrammar.y" int STCerror(const char *str) { [NSException raise:STCompilerSyntaxException format:@"Unknown parse error (%s)", str]; return 0; } /* * Lexer * -------------------------------------------------------------------------- */ int STClex (YYSTYPE *lvalp, void *context) { STTokenType tokenType = [READER nextToken]; if(tokenType == STEndTokenType) { return 0; } *lvalp = [READER tokenString]; switch(tokenType) { case STBarTokenType: return TK_BAR; case STReturnTokenType: return TK_RETURN; case STColonTokenType: return TK_COLON; case STSemicolonTokenType: return TK_SEMICOLON; case STDotTokenType: return TK_DOT; case STLParenTokenType: return TK_LPAREN; case STRParenTokenType: return TK_RPAREN; case STBlockOpenTokenType: return TK_BLOCK_OPEN; case STBlockCloseTokenType: return TK_BLOCK_CLOSE; case STArrayOpenTokenType: return TK_ARRAY_OPEN; case STAssignTokenType: return TK_ASSIGNMENT; case STIdentifierTokenType: return TK_IDENTIFIER; case STKeywordTokenType: return TK_KEYWORD; case STBinarySelectorTokenType: return TK_BINARY_SELECTOR; case STSymbolTokenType: return TK_SYMBOL; case STStringTokenType: return TK_STRING; case STCharacterTokenType: return TK_CHARACTER; case STIntNumberTokenType: return TK_INTNUMBER; case STRealNumberTokenType: return TK_REALNUMBER; case STSeparatorTokenType: return TK_SEPARATOR; case STEndTokenType: return 0; case STSharpTokenType: case STInvalidTokenType: case STErrorTokenType: return 1; } return 1; } StepTalk-0.10.0/Languages/Smalltalk/NSString+additions.m0000664000175000017500000000231314633027767022112 0ustar yavoryavor/** 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 StepTalk-0.10.0/Languages/Smalltalk/Externs.m0000664000175000017500000000104214633027767020057 0ustar yavoryavor/** Externs.m Misc. variables Copyright (c) 2002 Free Software Foundation This file is part of the StepTalk project. */ #import NSString *STCompilerSyntaxException = @"STCompilerSyntaxException"; NSString *STCompilerGenericException = @"STCompilerGenericException"; NSString *STCompilerInconsistencyException =@"STCompilerInconsistencyException"; NSString *STInterpreterGenericException = @"STInterpreterGenericException"; NSString *STInterpreterReturnException = @"STInterpreterReturnException"; StepTalk-0.10.0/Languages/Smalltalk/STTokenTypes.h0000664000175000017500000000377514633027767021015 0ustar yavoryavor/* STTokenTypes.h STSourceReader token types Copyright (c) 2002 Free Software Foundation This file is part of the StpTalk 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 */ typedef enum { STInvalidTokenType, STSeparatorTokenType, // ! STBarTokenType, // | STReturnTokenType, // ^ STColonTokenType, // : STSemicolonTokenType, // ; STDotTokenType, // . STLParenTokenType, // ( STRParenTokenType, // ) STBlockOpenTokenType, // [ STBlockCloseTokenType, // ] STArrayOpenTokenType, // #( STSharpTokenType, // # STAssignTokenType, // := STErrorTokenType, STIdentifierTokenType, // thisIsIdentifier STKeywordTokenType, // thisIsKeyword: STBinarySelectorTokenType, // +,-,*,/ STSymbolTokenType, // #thisIsSymbol STStringTokenType, // 'This is string' STCharacterTokenType, // $a (any single alphanum character) STIntNumberTokenType, // [+-]?[0-9]+ STRealNumberTokenType, // [+-]?[0-9]+.[0-9]+[eE][+-][0-9]+ STEndTokenType } STTokenType; StepTalk-0.10.0/Languages/Smalltalk/STCompiledCode.m0000664000175000017500000000577414633027767021245 0ustar yavoryavor/** STCompiledCode.m 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 "STCompiledCode.h" #import "STBytecodes.h" #import #import #import #import #import @implementation STCompiledCode - initWithBytecodesData:(NSData *)data literals:(NSArray *)anArray temporariesCount:(NSUInteger)count stackSize:(NSUInteger)size namedReferences:(NSArray *)refs { if ((self = [super init]) != nil) { NSAssert(count < SHRT_MAX, @"too many temporaries (>= max(short))"); NSAssert(size < SHRT_MAX, @"stack too large (>= max(short))"); bytecodes = [[STBytecodes alloc] initWithData:data]; literals = [[NSArray alloc] initWithArray:anArray]; tempCount = count; stackSize = size; namedRefs = [[NSArray alloc] initWithArray:refs]; } return self; } - (void)dealloc { RELEASE(bytecodes); RELEASE(literals); RELEASE(namedRefs); [super dealloc]; } - (STBytecodes *)bytecodes { return bytecodes; } - (NSUInteger)temporariesCount { return tempCount; } - (NSUInteger)stackSize { return stackSize; } - (NSArray *)literals { return literals; } - (id)literalObjectAtIndex:(NSUInteger)index { return [literals objectAtIndex:index]; } - (NSArray *)namedReferences { return namedRefs; } - (void)encodeWithCoder:(NSCoder *)coder { // [super encodeWithCoder: coder]; [coder encodeObject:bytecodes]; [coder encodeObject:literals]; [coder encodeObject:namedRefs]; [coder encodeValueOfObjCType: @encode(short) at: &tempCount]; [coder encodeValueOfObjCType: @encode(short) at: &stackSize]; } - initWithCoder:(NSCoder *)decoder { if ((self = [super init] /*[super initWithCoder: decoder]*/) != nil) { [decoder decodeValueOfObjCType: @encode(id) at: &bytecodes]; [decoder decodeValueOfObjCType: @encode(id) at: &literals]; [decoder decodeValueOfObjCType: @encode(id) at: &namedRefs]; [decoder decodeValueOfObjCType: @encode(short) at: &tempCount]; [decoder decodeValueOfObjCType: @encode(short) at: &stackSize]; } return self; } @end StepTalk-0.10.0/Languages/Smalltalk/STBlock.m0000664000175000017500000001435414633027767017742 0ustar yavoryavor/** 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 "Externs.h" #import "STBlock.h" #import "STLiterals.h" #import "STBlockContext.h" #import "STBytecodeInterpreter.h" #import "STStack.h" #import #import #import #import Class STBlockContextClass = nil; @implementation STBlock + (void)initialize { STBlockContextClass = [STBlockContext class]; } - initWithInterpreter:(STBytecodeInterpreter *)anInterpreter homeContext:(STMethodContext *)context initialIP:(NSUInteger)ptr argumentCount:(NSUInteger)count stackSize:(NSUInteger)size { if ((self = [super init]) != nil) { homeContext = RETAIN(context); argCount = count; stackSize = size; initialIP = ptr; interpreter = RETAIN(anInterpreter); } return self; } - (void)dealloc { RELEASE(homeContext); RELEASE(interpreter); RELEASE(cachedContext); [super dealloc]; } - (NSUInteger)argumentCount { return argCount; } - value { if(argCount != 0) { [NSException raise:STScriptingException format:@"Block needs %lu arguments", (unsigned long)argCount]; return nil; } return [self valueWithArgs:(id*)0 count:0]; } - value:arg { return [self valueWithArguments:[NSArray arrayWithObject:arg]]; } - value:arg1 value:arg2 { return [self valueWithArguments:[NSArray arrayWithObjects:arg1,arg2,nil]]; } - value:arg1 value:arg2 value:arg3 { return [self valueWithArguments:[NSArray arrayWithObjects:arg1,arg2,arg3,nil]]; } - valueWith:arg { id args[1] = {arg}; return [self valueWithArgs:args count:1]; } - valueWith:arg1 with:arg2 { id args[2] = {arg1,arg2}; return [self valueWithArgs:args count:2]; } - valueWith:arg1 with:arg2 with:arg3 { id args[3] = {arg1,arg2,arg3}; return [self valueWithArgs:args count:3]; } - valueWith:arg1 with:arg2 with:arg3 with:arg4 { id args[4] = {arg1,arg2,arg3,arg4}; return [self valueWithArgs:args count:4]; } - valueWithArgs:(id *)args count:(NSUInteger)count { NSArray *arguments = [NSArray arrayWithObjects:args count:count]; return [self valueWithArguments:arguments]; } - valueWithArguments:(NSArray *)arguments { STExecutionContext *parentContext; STBlockContext *context; STStack *stack; NSUInteger i, count; id retval; count = [arguments count]; if (argCount != count) { [NSException raise:STScriptingException format:@"Invalid block argument count %lu, " @"wants to be %lu", (unsigned long)count, (unsigned long)argCount]; return nil; } if (!usingCachedContext) { /* In case of recursive block nesting */ usingCachedContext = YES; if (!cachedContext) { cachedContext = [[STBlockContextClass alloc] initWithInitialIP:initialIP stackSize:stackSize]; } /* Avoid allocation */ context = cachedContext; [[context stack] empty]; [context resetInstructionPointer]; } else { /* Create new context */ context = [[STBlockContextClass alloc] initWithInitialIP:initialIP stackSize:stackSize]; AUTORELEASE(context); } /* push block arguments to the stack */ stack = [context stack]; for (i = 0; i @interface STSelector(SmalltalkCompiler) + symbolFromString:(NSString *)aString; @end StepTalk-0.10.0/Languages/Smalltalk/STBlock.h0000664000175000017500000000411514633027767017727 0ustar yavoryavor/** 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; NSUInteger initialIP; NSUInteger argCount; NSUInteger stackSize; STBlockContext *cachedContext; BOOL usingCachedContext; } - initWithInterpreter:(STBytecodeInterpreter *)anInterpreter homeContext:(STMethodContext *)context initialIP:(NSUInteger)ptr argumentCount:(NSUInteger)count stackSize:(NSUInteger)size; - (NSUInteger)argumentCount; - value; - value:arg; - value:arg1 value:arg2; - value:arg1 value:arg2 value:arg3; - valueWithArguments:(NSArray *)arguments; /* The following methods are present for backward compatibility with * earlier StepTalk versions. */ - valueWith:arg; - valueWith:arg1 with:arg2; - valueWith:arg1 with:arg2 with:arg3; - valueWithArgs:(id *)args count:(NSUInteger)count; - whileTrue:(STBlock *)doBlock; - whileFalse:(STBlock *)doBlock; - handler:(STBlock *)handlerBlock; @end StepTalk-0.10.0/Languages/Smalltalk/STSourceReader.h0000664000175000017500000000302114633027767021253 0ustar yavoryavor/** STSourceReader.h Source reader class. 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 #import #include "STTokenTypes.h" @class NSString; @interface STSourceReader:NSObject { NSString *source; // Source NSRange srcRange; // range of source in string NSUInteger srcOffset; // Scan offset NSRange tokenRange; // Tokenn range STTokenType tokenType; // Token type } - initWithString:(NSString *)aString; - initWithString:(NSString *)aString range:(NSRange)range; - (STTokenType)nextToken; - (STTokenType)tokenType; - (NSString *)tokenString; - (NSRange)tokenRange; - (NSInteger)currentLine; @end StepTalk-0.10.0/Languages/Smalltalk/.cvsignore0000664000175000017500000000010514633027767020250 0ustar yavoryavor*.app *.debug *.profile shared_*obj *.bundle *.stmodule *.stlanguage StepTalk-0.10.0/Languages/Smalltalk/STMessage.m0000664000175000017500000000345414633027767020273 0ustar yavoryavor/** STMessage.m Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Jun 18 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 "STMessage.h" #import #import #import #import @implementation STMessage + (STMessage *)messageWithSelector:(NSString *)aString arguments:(NSArray *)anArray { STMessage *message; message = [[STMessage alloc] initWithSelector:aString arguments:anArray]; return AUTORELEASE(message); } - initWithSelector:(NSString *)aString arguments:(NSArray *)anArray { if ((self = [super init]) != nil) { selector = RETAIN(aString); args = RETAIN(anArray); } return self; } - (void)dealloc { RELEASE(selector); RELEASE(args); [super dealloc]; } - (NSString *)selector { return selector; } - (NSArray *)arguments { return args; } @end StepTalk-0.10.0/Languages/Smalltalk/STCompiledCode.h0000664000175000017500000000304214633027767021222 0ustar yavoryavor/** STCompiledCode.h Copyright (c) 2002 Free Software Foundation 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 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 NSData; @class NSArray; @class STBytecodes; @interface STCompiledCode:NSObject { STBytecodes *bytecodes; NSArray *literals; NSArray *namedRefs; short tempCount; short stackSize; } - initWithBytecodesData:(NSData *)data literals:(NSArray *)anArray temporariesCount:(NSUInteger)count stackSize:(NSUInteger)size namedReferences:(NSArray *)refs; - (STBytecodes *)bytecodes; - (NSUInteger)temporariesCount; - (NSUInteger)stackSize; - (id)literalObjectAtIndex:(NSUInteger)index; - (NSArray *)namedReferences; - (NSArray *)literals; @end StepTalk-0.10.0/Languages/Smalltalk/Externs.h0000664000175000017500000000063214633027767020056 0ustar yavoryavor/** Externs Misc. variables Copyright (c) 2002 Free Software Foundation This file is part of the StepTalk project. */ #import extern NSString *STCompilerSyntaxException; extern NSString *STCompilerGenericException; extern NSString *STCompilerInconsistencyException; extern NSString *STInterpreterGenericException; extern NSString *STInterpreterReturnException; StepTalk-0.10.0/Languages/Smalltalk/STCompiler.h0000664000175000017500000001043414633027767020450 0ustar yavoryavor/** STCompiler.h Bytecode compiler. Generates STExecutableCode from source code. 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 #import #import @class STCompiledScript; @class STCompiledCode; @class STCompiledMethod; @class STEnvironment; @class STScriptObject; @class STSourceReader; @class STCExpression; @class STCMethod; @class STCPrimary; @class STCStatements; @class STCompiler; @class NSMutableData; @class NSMutableArray; @protocol STScriptObject; /*" Parser context information "*/ typedef struct _STParserContext { STCompiler *compiler; STSourceReader *reader; } STParserContext; /*" Get compiler from parser context "*/ #define STParserContextGetCompiler(context)\ (((STParserContext *)context)->compiler) /*" Get source reader from parser context "*/ #define STParserContextGetReader(context)\ (((STParserContext *)context)->reader) /*" Initialize parser context "*/ #define STParserContextInit(context,aCompiler,aReader) \ do { \ ((STParserContext *)context)->compiler = aCompiler; \ ((STParserContext *)context)->reader = aReader; \ } while(0) @interface STCompiler:NSObject { STEnvironment *environment; STSourceReader *reader; STParserContext context; STCompiledScript *resultScript; STCompiledMethod *resultMethod; NSMutableData *byteCodes; NSMutableArray *tempVars; NSMutableArray *externVars; NSMutableArray *receiverVars; NSMutableArray *namedReferences; NSMutableArray *literals; STScriptObject *receiver; BOOL isSingleMethod; NSUInteger stackSize; /* Required stack size */ NSUInteger stackPos; /* Current stack pointer */ NSUInteger tempsSize; /* Required temp space */ NSUInteger tempsCount; /* Actual temp space */ NSUInteger bcpos; /* Bytecode position */ Class stringLiteralClass; /* default: NSMutableString */ Class arrayLiteralClass; /* default: NSMutableArray */ Class characterLiteralClass; /* default: NSString */ Class intNumberLiteralClass; /* default: NSNumber */ Class realNumberLiteralClass; /* default: NSNumber */ Class symbolLiteralClass; /* default: NSString */ } + compilerWithEnvironment:(STEnvironment *)env; - initWithEnvironment:(STEnvironment *)env; /*" Environment "*/ - (void)setEnvironment:(STEnvironment *)env; - (STSourceReader *)sourceReader; /*" Compilation "*/ - (STCompiledScript *)compileString:(NSString *)aString; - (STCompiledMethod *)compileMethodFromSource:(NSString *)aString forReceiver:(STScriptObject *)receiver; /* - (NSMutableArray *)compileString:(NSString *)string; - (NSMutableArray *)compileString:(NSString *)string range:(NSRange) range; */ /*" Literals "*/ - (Class)intNumberLiteralClass; - (Class)realNumberLiteralClass; - (Class)stringLiteralClass; - (Class)arrayLiteralClass; - (Class)symbolLiteralClass; - (void)setStringLiteralClass:(Class)aClass; - (void)setArrayLiteralClass:(Class)aClass; - (void)setSymbolLiteralClass:(Class)aClass; - (void)setIntNumberLiteralClass:(Class)aClass; - (void)setRealNumberLiteralClass:(Class)aClass; - (void)setReceiverVariables:(NSArray *)vars; - (void)addTempVariable:(NSString *)varName; - (BOOL)beginScript; @end StepTalk-0.10.0/Languages/Smalltalk/STCompiler.m0000664000175000017500000010536514633027767020465 0ustar yavoryavor/** STCompiler.m Bytecode compiler. Generates STExecutableCode from source code. 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 "STCompiler.h" #import "STMessage.h" #import "STLiterals.h" #import "STBytecodes.h" #import "STCompiledScript.h" #import "STCompiledCode.h" #import "STCompiledMethod.h" #import "STCompilerUtils.h" #import "STSourceReader.h" #import "Externs.h" #import #import #import #import #import #import #import #import #import #import #import extern int STCparse(void *context); /* FIXME: rewrite parser We need three kinds of grammars: 1. = | 2. = '[|' ']' = | '!' = | 3. = = | Parser 1. are 2. are for scripts. Parser 3. is for script object methods. Because majority of the grammar is reused in all three parsers we use only one grammar definition. There is no problem in haveng 1. and 2. in one file. To be able to have 3. in the same file we do a hack: we add a prefix '!!' for method source. Then we diferentiate it in grammar file by changin the rule: 3. = '!' '!' See STGrammar.y */ @interface STCompiler(STCompilerPrivate) - (void)compile; - (void)initializeContext; - (void)destroyCompilationContext; - (NSUInteger)indexOfTemporaryVariable:(NSString *)varName; - (void) initializeCompilationContext; - (NSDictionary *)exceptionInfo; - (NSUInteger)addSelectorLiteral:(NSString*)selector; - (NSUInteger)addLiteral:literal; - (void)compileMethod:(STCMethod *)method; - (STCompiledCode *) compileStatements:(STCStatements *)statements; - (void)compileStatements:(STCStatements *)statements blockFlag:(BOOL)blockFlag; - (void)compilePrimary:(STCPrimary *)primary; - (void)compileExpression:(STCExpression *)expr; - (void)emitPushReceiverVariable:(NSUInteger)index; - (void)emitPushSelf; - (void)emitPopAndStoreReceiverVariable:(NSUInteger)index; - (void)emitReturn; - (void)emitReturnFromBlock; - (void)emitPushTemporary:(NSUInteger)index; - (void)emitPushLiteral:(NSUInteger)index; - (void)emitPushVariable:(NSUInteger)index; - (void)emitPopAndStoreTemporary:(NSUInteger)index; - (void)emitPopAndStoreVariable:(NSUInteger)index ; - (void)emitPopStack; - (void)emitSendSelector:(NSUInteger)index argCount:(NSUInteger)argCount; - (void)emitBlockCopy; - (void)emitDuplicateStackTop; - (void)emitJump:(short)offset; - (void)emitLongJump:(short)offset; - (void)emitPushNil; - (void)emitPushTrue; - (void)emitPushFalse; - (void)fixupLongJumpAt:(NSUInteger)index with:(short)offset; - (NSUInteger)currentBytecode; @end #define MAX(a,b) (((a)>(b))?(a):(b)) @implementation STCompiler + compilerWithEnvironment:(STEnvironment *)env { return AUTORELEASE([[self alloc] initWithEnvironment:env]); } - initWithEnvironment:(STEnvironment *)env { if ((self = [self init]) != nil) [self setEnvironment:env]; return self; } - init { if ((self = [super init]) != nil) { arrayLiteralClass = [NSMutableArray class]; stringLiteralClass = [NSMutableString class]; /* bytesLiteralClass = [NSMutableData class]; */ intNumberLiteralClass = [NSNumber class]; realNumberLiteralClass = [NSNumber class]; symbolLiteralClass = [STSelector class]; characterLiteralClass = [NSString class]; receiverVars = [[NSMutableArray alloc] init]; namedReferences = [[NSMutableArray alloc] init]; } return self; } - (void)dealloc { RELEASE(environment); RELEASE(receiverVars); RELEASE(namedReferences); [super dealloc]; } - (BOOL)beginScript { if(isSingleMethod) { [NSException raise:@"STCompilerException" format:@"Script source given for single method"]; return NO; } else { return YES; } } /* --------------------------------------------------------------------------- * Compilation * --------------------------------------------------------------------------- */ - (void)setEnvironment:(STEnvironment *)env { ASSIGN(environment,env); } - (STCompiledMethod *)compileMethodFromSource:(NSString *)aString forReceiver:(STScriptObject *)receiverObject { STCompiledMethod *result; NSString *hackedSource; NSString *exceptionFmt = @"Syntax error at line %li near '%@', " @"reason: %@."; NSDebugLLog(@"STCompiler", @"Compile method for receiver %@", [receiverObject className]); if(!environment) { [NSException raise:STCompilerGenericException format:@"Compilation environment is not initialized"]; return nil; } hackedSource = [@"!!" stringByAppendingString:aString]; reader = [[STSourceReader alloc] initWithString:hackedSource]; [receiverVars removeAllObjects]; receiver = RETAIN(receiverObject); isSingleMethod = YES; STParserContextInit(&context,self,reader); NS_DURING { // extern int STCdebug; // STCdebug = 1; STCparse(&context); } NS_HANDLER { if ([[localException name] isEqualToString: STCompilerSyntaxException]) { NSString *tokenString; NSInteger line; tokenString = [reader tokenString]; line = [reader currentLine]; RELEASE(reader); reader = nil; [NSException raise:STCompilerSyntaxException format:exceptionFmt, (long)line, tokenString, [localException reason]]; } RELEASE(reader); reader = nil; [localException raise]; } NS_ENDHANDLER RELEASE(reader); reader = nil; result = AUTORELEASE(resultMethod); resultMethod = nil; RELEASE(receiver); receiver = nil; return result; } - (STCompiledScript *)compileString:(NSString *)aString { NSAutoreleasePool *pool = [NSAutoreleasePool new]; STCompiledScript *result; NSString *exceptionFmt = @"Syntax error at line %li near '%@', " @"reason: %@."; NSDebugLLog(@"STCompiler", @"Compile string"); isSingleMethod = NO; if(!environment) { [pool release]; [NSException raise:STCompilerGenericException format:@"Compilation environment is not initialized"]; return nil; } reader = [[STSourceReader alloc] initWithString:aString]; [receiverVars removeAllObjects]; STParserContextInit(&context,self,reader); NS_DURING { // extern int STCdebug; // STCdebug = 1; STCparse(&context); } NS_HANDLER { if ([[localException name] isEqualToString: STCompilerSyntaxException]) { NSString *tokenString; NSInteger line; tokenString = RETAIN([reader tokenString]); line = [reader currentLine]; RELEASE(reader); reader = nil; RETAIN(localException); [pool release]; [NSException raise:STCompilerSyntaxException format:exceptionFmt, (long)line, AUTORELEASE(tokenString), [AUTORELEASE(localException) reason]]; } RELEASE(reader); reader = nil; RETAIN(localException); [pool release]; [AUTORELEASE(localException) raise]; } NS_ENDHANDLER RELEASE(reader); reader = nil; [pool release]; result = AUTORELEASE(resultScript); resultScript = nil; return result; } - (void)compileMethod:(STCMethod *)method { STCompiledMethod *compiledMethod; STCompiledCode *code; STMessage *messagePattern; /* FIXME: unite STCMessage and STMessage */ messagePattern = (STMessage *)[method messagePattern]; if (!messagePattern) { messagePattern = [STMessage messageWithSelector:@"_unnamed_method" arguments:nil]; } else if (![[method statements] returnExpression]) { /* A Smalltalk method (but not plain code) without a return expression returns the receiver itself. */ STCPrimary *selfPrimary = [STCPrimary primaryWithVariable:@"self"]; STCExpression *returnExpression = [STCExpression primaryExpressionWithObject:selfPrimary]; [[method statements] setReturnExpression:returnExpression]; } NSDebugLLog(@"STCompiler", @"Compile method %@", [messagePattern selector]); tempVars = [NSMutableArray arrayWithArray:[messagePattern arguments]]; code = [self compileStatements:[method statements]]; compiledMethod = [STCompiledMethod methodWithCode:code messagePattern:messagePattern]; if (!isSingleMethod) { if (resultMethod) { [NSException raise:@"STCompilerException" format:@"Method is present when compiling a script"]; return; } if (!resultScript) { NSDebugLLog(@"STCompiler", @"Creating script with %lu variables", (unsigned long)[receiverVars count]); resultScript = [[STCompiledScript alloc] initWithVariableNames: receiverVars]; } [resultScript addMethod:compiledMethod]; } else { if (resultMethod) { [NSException raise:@"STCompilerException" format:@"More than one method compiled for single method request"]; return; } if (resultScript) { [NSException raise:@"STCompilerException" format:@"Compiled script is present when compiling single method"]; return; } resultMethod = RETAIN(compiledMethod); } } - (STCompiledCode *)compileStatements:(STCStatements *)statements { STCompiledCode *compiledCode; #ifdef DEBUG NSUInteger count; NSUInteger i; #endif /* FIXME: create another class */ [self initializeCompilationContext]; NSDebugLLog(@"STCompiler", @"compiling statements"); tempsSize = tempsCount = [tempVars count]; [self compileStatements:statements blockFlag:NO]; NSDebugLLog(@"STCompiler", @" temporaries %lu stack %lu", (unsigned long)tempsSize,(unsigned long)stackSize); #ifdef DEBUG count = [literals count]; NSDebugLLog(@"STCompiler", @" literals count %lu", (unsigned long)count); for(i=0;i 0; index--) { [self emitPopAndStoreTemporary:tempsSave + index - 1]; } } array = [statements expressions]; first = YES; if (array) { enumerator = [array objectEnumerator]; while ((expr = [enumerator nextObject]) != nil) { if (!first) { [self emitPopStack]; } else { first = NO; } [self compileExpression:expr]; } } expr = [statements returnExpression]; if (expr) { if (!first) { [self emitPopStack]; } [self compileExpression:expr]; } else if (first) { if (blockFlag) { [self emitPushNil]; } else { [self emitPushSelf]; } } if (blockFlag) { [blockInfo setStackSize:stackSize]; AUTORELEASE(blockInfo); stackSize = stackSizeSave; stackPos = stackPosSave; if (expr) { [self emitReturn]; } else { [self emitReturnFromBlock]; } } else { [self emitReturn]; } /* fixup jump (if block) */ if (blockFlag) { [self fixupLongJumpAt:jumpIP with:[self currentBytecode] - jumpIP]; } /* cleanup unneeded temp variables */ // // [tempVars removeObjectsInRange:NSMakeRange(tempsSave, // [tempVars count]-tempsSave)]; // tempsCount = tempsSave; tempsCount = [tempVars count]; if (blockFlag) { NSUInteger i; /* Need to keep the block parameters allocated until we exit the method context, but we also need to harvest the names*/ for (i = tempsSave; i < tempsCount; ++i) [tempVars replaceObjectAtIndex: i withObject:@""]; } else { /* cleanup unneeded temp variables */ [tempVars removeObjectsInRange:NSMakeRange(tempsSave, tempsCount-tempsSave)]; tempsCount = tempsSave; } } - (void)compilePrimary:(STCPrimary *)primary { id object = [primary object]; NSUInteger index; NSDebugLLog(@"STCompiler-misc",@" compile primary"); switch([primary type]) { case STCVariablePrimaryType: if([object isEqualToString:@"YES"] || [object isEqualToString:@"true"]) { [self emitPushTrue]; } else if([object isEqualToString:@"NO"] || [object isEqualToString:@"false"]) { [self emitPushFalse]; } else if([object isEqualToString:@"nil"]) { [self emitPushNil]; } else { index = [self indexOfTemporaryVariable:object]; if(index != NSNotFound) { [self emitPushTemporary:index]; break; } else if( [object isEqual:@"self"] ) { [self emitPushSelf]; break; } else { index = [self indexOfNamedReference:object]; if([self isReceiverVariable:object]) { [self emitPushReceiverVariable:index]; } else { [self emitPushVariable:index]; } } } break; case STCLiteralPrimaryType: index = [self addLiteral:object]; [self emitPushLiteral:index]; break; case STCBlockPrimaryType: [self compileStatements:object blockFlag:YES]; break; case STCExpressionPrimaryType: [self compileExpression:object]; break; default: [NSException raise:STCompilerInconsistencyException format:@"Unknown primary type %i", [primary type]]; break; } } - (void)compileMessage:(STCMessage *)message { NSEnumerator *enumerator; NSArray *args; id obj; NSUInteger index; args = [message arguments]; if(args && ([args count]>0)) { enumerator = [args objectEnumerator]; while((obj = [enumerator nextObject])) { if([obj isKindOfClass:[STCPrimary class]]) [self compilePrimary:obj]; else [self compileExpression:obj]; } } index = [self addSelectorLiteral:[message selector]]; [self emitSendSelector:index argCount:[args count]]; } - (void)compileExpression:(STCExpression *)expr { NSEnumerator *enumerator; NSArray *cascade; NSString *varName; NSArray *array; NSUInteger count; NSUInteger index,i; id obj; NSDebugLLog(@"STCompiler-misc",@" compile expression"); if([expr isPrimary]) { [self compilePrimary:[expr object]]; } else /* message expression */ { obj = [expr target]; /* target */ if([obj isKindOfClass:[STCPrimary class]]) [self compilePrimary:obj]; else [self compileExpression:obj]; cascade = [expr cascade]; if(cascade) { count = [cascade count]; for(i=0;i0) { for(i = 0; i>8)&0xff);\ bc[2] = (unsigned char)(bc2&0xff); \ [byteCodes appendBytes:bc length:3];\ bcpos+=3;\ } while(0) #define EMIT_TRIPPLE(bc1,bc2,bc3) \ do { \ unsigned char bc[5] = {bc1,0,0,0,0}; \ bc[1] = (unsigned char)((((unsigned short)bc2)>>8)&0xff);\ bc[2] = (unsigned char)(bc2&0xff); \ bc[3] = (unsigned char)((((unsigned short)bc3)>>8)&0xff);\ bc[4] = (unsigned char)(bc3&0xff); \ [byteCodes appendBytes:bc length:5];\ bcpos+=5;\ } while(0) #define STACK_PUSH \ do {\ stackPos++; \ stackSize = MAX(stackPos,stackSize);\ /* NSDebugLLog(@"STCompiler",@"stack pointer %lu/%lu",(unsigned long)stackPos,(unsigned long)stackSize); */\ } while(0) #define STACK_PUSH_COUNT(count) \ do {\ stackPos+=count; \ stackSize = MAX(stackPos,stackSize);\ /* NSDebugLLog(@"STCompiler",@"stack pointer %lu/%lu",(unsigned long)stackPos,(unsigned long)stackSize);*/ \ } while(0) #define STACK_POP \ stackPos--; \ /* NSDebugLLog(@"STCompiler",@"stack pointer %lu/%lu",(unsigned long)stackPos,(unsigned long)stackSize) */; #define STACK_POP_COUNT(count) \ stackPos-=count; \ /* NSDebugLLog(@"STCompiler",@"stack pointer %lu/%lu",(unsigned long)stackPos,(unsigned long)stackSize) */; - (void)emitPushSelf { NSDebugLLog(@"STCompiler-emit", @"#%04lx push self", (unsigned long)bcpos); EMIT_SINGLE(STPushReceiverBytecode); STACK_PUSH; } - (void)emitPushNil { NSDebugLLog(@"STCompiler-emit", @"#%04lx push nil", (unsigned long)bcpos); EMIT_SINGLE(STPushNilBytecode); STACK_PUSH; } - (void)emitPushTrue { NSDebugLLog(@"STCompiler-emit", @"#%04lx push true", (unsigned long)bcpos); EMIT_SINGLE(STPushTrueBytecode); STACK_PUSH; } - (void)emitPushFalse { NSDebugLLog(@"STCompiler-emit", @"#%04lx push false", (unsigned long)bcpos); EMIT_SINGLE(STPushFalseBytecode); STACK_PUSH; } - (void)emitPushReceiverVariable:(NSUInteger)index { NSDebugLLog(@"STCompiler-emit", @"#%04lx push receiver variable %lu (%@)", (unsigned long)bcpos,(unsigned long)index, [namedReferences objectAtIndex:index]); EMIT_DOUBLE(STPushRecVarBytecode,index); STACK_PUSH; } - (void)emitPushTemporary:(NSUInteger)index { NSDebugLLog(@"STCompiler-emit", @"#%04lx push temporary %lu (%@)", (unsigned long)bcpos,(unsigned long)index, [tempVars objectAtIndex:index]); EMIT_DOUBLE(STPushTemporaryBytecode,index); STACK_PUSH; } - (void)emitPushLiteral:(NSUInteger)index { NSDebugLLog(@"STCompiler-emit", @"#%04lx push literal %lu (%@)", (unsigned long)bcpos,(unsigned long)index, [literals objectAtIndex:index]); EMIT_DOUBLE(STPushLiteralBytecode,index); STACK_PUSH; stackSize++; } - (void)emitPushVariable:(NSUInteger)index { NSDebugLLog(@"STCompiler-emit", @"#%04lx push external variable %lu (%@)", (unsigned long)bcpos,(unsigned long)index, [namedReferences objectAtIndex:index]); EMIT_DOUBLE(STPushExternBytecode,index); STACK_PUSH; } - (void)emitPopAndStoreTemporary:(NSUInteger)index { NSDebugLLog(@"STCompiler-emit", @"#%04lx pop and store temp %lu (%@)", (unsigned long)bcpos,(unsigned long)index, [tempVars objectAtIndex:index]); EMIT_DOUBLE(STPopAndStoreTempBytecode,index); STACK_POP; } - (void)emitPopAndStoreVariable:(NSUInteger)index { NSDebugLLog(@"STCompiler-emit", @"#%04lx pop and store ext variable %lu (%@)", (unsigned long)bcpos,(unsigned long)index, [namedReferences objectAtIndex:index]); EMIT_DOUBLE(STPopAndStoreExternBytecode,index); STACK_POP; } - (void)emitPopAndStoreReceiverVariable:(NSUInteger)index { NSDebugLLog(@"STCompiler-emit", @"#%04lx pop and store rec variable %lu (%@)", (unsigned long)bcpos,(unsigned long)index, [namedReferences objectAtIndex:index]); EMIT_DOUBLE(STPopAndStoreRecVarBytecode,index); STACK_POP; } - (void)emitSendSelector:(NSUInteger)index argCount:(NSUInteger)argCount { NSDebugLLog(@"STCompiler-emit", @"#%04lx send selector %lu (%@) with %lu args", (unsigned long)bcpos,(unsigned long)index, [literals objectAtIndex:index],(unsigned long)argCount); EMIT_TRIPPLE(STSendSelectorBytecode,index,argCount); STACK_PUSH_COUNT(argCount); STACK_POP_COUNT(argCount); } - (void)emitDuplicateStackTop { NSDebugLLog(@"STCompiler-emit", @"#%04lx dup",(unsigned long)bcpos); EMIT_SINGLE(STDupBytecode); STACK_PUSH; } - (void)emitPopStack { NSDebugLLog(@"STCompiler-emit", @"#%04lx pop stack",(unsigned long)bcpos); EMIT_SINGLE(STPopStackBytecode); STACK_POP; } - (void)emitReturn { NSDebugLLog(@"STCompiler-emit", @"#%04lx return",(unsigned long)bcpos); EMIT_SINGLE(STReturnBytecode); } - (void)emitReturnFromBlock { NSDebugLLog(@"STCompiler-emit", @"#%04lx return from block",(unsigned long)bcpos); EMIT_SINGLE(STReturnBlockBytecode); } - (void)emitBlockCopy { NSDebugLLog(@"STCompiler-emit", @"#%04lx create block",(unsigned long)bcpos); EMIT_SINGLE(STBlockCopyBytecode); } - (void)emitLongJump:(short)offset { NSDebugLLog(@"STCompiler-emit", @"#%04lx long jump %i (0x%04lx)", (unsigned long)bcpos,offset,(unsigned long)(bcpos+offset)); /* EMIT_TRIPPLE(STLongJumpBytecode,STLongJumpFirstByte(offset), STLongJumpSecondByte(offset)); */ EMIT_DOUBLE(STLongJumpBytecode, offset); } - (void)fixupLongJumpAt:(NSUInteger)index with:(short)offset { //unsigned char bytes[4] = {0,STLongJumpFirstByte(offset),0,STLongJumpSecondByte(offset)}; unsigned char bytes[2] = { (offset >> 8) & 0xff, offset & 0xff }; NSDebugLLog(@"STCompiler-emit", @"# fixup long jump at 0x%04lx to 0x%04lx", (unsigned long)index, (unsigned long)(index + offset)); [byteCodes replaceBytesInRange:NSMakeRange(index+1,2) withBytes:bytes]; } - (NSUInteger)currentBytecode { return [byteCodes length]; } @end StepTalk-0.10.0/Languages/Smalltalk/STBytecodes.h0000664000175000017500000000635014633027767020621 0ustar yavoryavor/** STBytecodes.h 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 /* Bytecode table */ /* #define STReceiverConstant 0x00 #define STTrueConstant 0x01 #define STFalseConstant 0x02 #define STNilConstant 0x03 */ #define STPushReceiverBytecode 0x00 /* push self */ #define STPushNilBytecode 0x01 #define STPushTrueBytecode 0x02 #define STPushFalseBytecode 0x03 /* 0x00 - 0x07 receiver,true,false,nil, -1,0,1,2 */ #define STPushRecVarBytecode 0x08 /* recvar index */ #define STPushExternBytecode 0x09 /* extern index */ #define STPushTemporaryBytecode 0x0a /* temp index */ #define STPushLiteralBytecode 0x0b /* lit index */ #define STPopAndStoreRecVarBytecode 0x0c /* recvar index */ #define STPopAndStoreExternBytecode 0x0d /* extern index */ #define STPopAndStoreTempBytecode 0x0e /* temp index */ /* 0x0f reserved */ #define STSendSelectorBytecode 0x10 /* lit index, arg count */ #define STSuperSendSelectorBytecode 0x11 /* lit index, arg count */ #define STBlockCopyBytecode 0x12 #define STLongJumpBytecode 0x13 /* byte 1, byte 2 */ #define STDupBytecode 0x14 #define STPopStackBytecode 0x15 #define STReturnBytecode 0x16 #define STReturnBlockBytecode 0x17 /* 0x18-0x27 reserved single bytecodes */ /* 0x27-0xfe reserved */ #define STBreakpointBytecode 0xff /* #define STLongJumpOffset(arg1, arg2) \ ( (((arg1) & 0xff) << 8) | ((arg2) & 0xff) ) #define STLongJumpFirstByte(offset)\ ( ((offset) >> 8) & 0xff ) #define STLongJumpSecondByte(offset)\ ( (offset) & 0xff ) */ #define STLongJumpBytecodeSize 3 @class NSArray; @class NSString; typedef struct { unsigned short code; unsigned short arg1; unsigned short arg2; NSUInteger pointer; } STBytecode; extern NSArray *STBytecodeNames; extern NSString *STBytecodeName(unsigned short code); extern NSString *STDissasembleBytecode(STBytecode bytecode); @interface STBytecodes:NSObject { NSData *bytes; } - (id) initWithData: (NSData *)data; - (STBytecode)fetchNextBytecodeAtPointer:(NSUInteger *)pointer; - (NSData *) data; - (NSUInteger) length; @end StepTalk-0.10.0/Languages/Smalltalk/SmalltalkEngine.h0000664000175000017500000000177614633027767021512 0ustar yavoryavor/** SmalltalkEngine Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Oct 24 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 SmalltalkEngine:STEngine { } @end StepTalk-0.10.0/Languages/Smalltalk/STStack.h0000664000175000017500000000237014633027767017743 0ustar yavoryavor/** STStack.h Stack object 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 @interface STStack:NSObject { NSUInteger size; NSUInteger pointer; id *stack; } + stackWithSize:(NSUInteger)newSize; - initWithSize:(NSUInteger)newSize; - (void)push:anObject; - (id) pop; - (void)popCount:(NSUInteger)count; - (id) valueAtTop; - (id) valueFromTop:(NSUInteger)offset; - (void)duplicateTop; - (void)empty; @end StepTalk-0.10.0/Languages/Smalltalk/STCompilerUtils.m0000664000175000017500000001573514633027767021507 0ustar yavoryavor/** STCompilerUtils.m Various compiler utilities. Copyright (c) 2002 Free Software Foundation This file is part of StepTalk. */ #import "STCompiler.h" #import "STCompilerUtils.h" #import "STSourceReader.h" #import #import #import #import #import #import /* * Compiler utilities * -------------------------------------------------------------------------- */ /* * STCMethod * --------------------------------------------------------------------------- */ @implementation STCMethod + methodWithPattern:(STCMessage *)patt statements:(STCStatements *)stats { STCMethod *method; method = [[STCMethod alloc] initWithPattern:patt statements:stats]; return AUTORELEASE(method); } - initWithPattern:(STCMessage *)patt statements:(STCStatements *)stats { if ((self = [super init]) != nil) { messagePattern = RETAIN(patt); statements = RETAIN(stats); } return self; } - (void)dealloc { RELEASE(messagePattern); RELEASE(statements); [super dealloc]; } - (STCStatements *)statements { return statements; } - (STCMessage *)messagePattern { return messagePattern; } @end /* * STCStatements * --------------------------------------------------------------------------- */ @implementation STCStatements + statements { STCStatements *statements = [[STCStatements alloc] init]; return AUTORELEASE(statements); } - (void)setTemporaries:(NSArray *)vars { ASSIGN(variables,vars); } - (void)setExpressions:(NSArray *)exprs { ASSIGN(expressions,exprs); } - (void)setReturnExpression:(STCExpression *)ret { ASSIGN(retexpr,ret); } - (void)dealloc { RELEASE(variables); RELEASE(expressions); RELEASE(retexpr); [super dealloc]; } - (NSArray *)temporaries { return variables; } - (NSArray *)expressions { return expressions; } - (STCExpression *)returnExpression { return retexpr; } @end /* * STCMessage * --------------------------------------------------------------------------- */ @implementation STCMessage + message { STCMessage *message = [[STCMessage alloc] init]; return AUTORELEASE(message); } - init { if ((self = [super init]) != nil) { selector = [[NSMutableString alloc] init]; args = [[NSMutableArray alloc] init]; } return self; } - (void)dealloc { RELEASE(selector); RELEASE(args); [super dealloc]; } -(void) addKeyword:(NSString *)keyword object:object { [selector appendString:keyword]; if(object!=nil) [args addObject:object]; } - (NSString *)selector { return selector; } - (NSArray *)arguments { return args; } @end /* * STCExpression * --------------------------------------------------------------------------- */ @implementation STCExpression:NSObject + (STCExpression *) primaryExpressionWithObject:(id)anObject { STCPrimaryExpression *expr; expr = [[STCPrimaryExpression alloc] initWithObject:anObject]; return AUTORELEASE(expr); } + (STCExpression *) messageExpressionWithTarget:(id)anObject message:(STCMessage *)message { STCMessageExpression *expr; expr = [[STCMessageExpression alloc] initWithTarget:anObject message:message]; return AUTORELEASE(expr); } - (void)dealloc { RELEASE(cascade); RELEASE(assignments); [super dealloc]; } - (void)setCascade:(NSArray *)casc { ASSIGN(cascade,casc); } - (void)setAssignments:(NSArray *)asgs { ASSIGN(assignments,asgs); } - (NSArray *)cascade { return cascade; } - (NSArray *)assignments { return assignments; } - (BOOL)isPrimary { [self subclassResponsibility:_cmd]; return NO; } - (id) target { [self subclassResponsibility:_cmd]; return nil; } - (STCMessage *)message { [self subclassResponsibility:_cmd]; return nil; } - (id) object { [self subclassResponsibility:_cmd]; return nil; } @end @implementation STCMessageExpression:STCExpression - initWithTarget:(id)anObject message:(STCMessage *)aMessage; { if ((self = [super init]) != nil) { target = RETAIN(anObject); message = RETAIN(aMessage); } return self; } - (void)dealloc { RELEASE(target); RELEASE(message); [super dealloc]; } - (id) target { return target; } - (STCMessage *)message { return message; } - (BOOL)isPrimary { return NO; } @end @implementation STCPrimaryExpression:STCExpression - (void)dealloc { RELEASE(object); [super dealloc]; } - initWithObject:(id)anObject { if ((self = [super init]) != nil) object = RETAIN(anObject); return self; } - (id) object { return object; } - (BOOL)isPrimary { return YES; } @end /* * STCPrimary * --------------------------------------------------------------------------- */ @implementation STCPrimary + primaryWithVariable:(id) anObject { STCPrimary *primary; primary = [[STCPrimary alloc] initWithType:STCVariablePrimaryType object:anObject]; return AUTORELEASE(primary); } + primaryWithLiteral:(id) anObject { STCPrimary *primary; primary = [[STCPrimary alloc] initWithType:STCLiteralPrimaryType object:anObject]; return AUTORELEASE(primary); } + primaryWithBlock:(id) anObject { STCPrimary *primary; primary = [[STCPrimary alloc] initWithType:STCBlockPrimaryType object:anObject]; return AUTORELEASE(primary); } + primaryWithExpression:(id) anObject { STCPrimary *primary; primary = [[STCPrimary alloc] initWithType:STCExpressionPrimaryType object:anObject]; return AUTORELEASE(primary); } - initWithType:(int)newType object:obj { if ((self = [super init]) != nil) { type = newType; object = RETAIN(obj); } return self; } - (void)dealloc { RELEASE(object); [super dealloc]; } - (int)type { return type; } - object { return object; } @end /* * Compiler additions for literals * --------------------------------------------------------------------------- */ @implementation NSString(STCompilerAdditions) + (NSString *) symbolFromString:(NSString *)aString { return [self stringWithString:aString]; } + (id) characterFromString:(NSString *)aString { return [self stringWithString:aString]; } @end @implementation NSMutableString(STCompilerAdditions) + (id) stringFromString:(NSString *)aString { return [self stringWithString:aString]; } @end @implementation NSNumber(STCompilerAdditions) + (id) intNumberFromString:(NSString *)aString { return [self numberWithInt:[aString intValue]]; } + (id) realNumberFromString:(NSString *)aString { return [self numberWithDouble:[aString doubleValue]]; } @end @implementation NSMutableArray(STCompilerAdditions) + (id) arrayFromArray:(NSArray *)anArray { return [self arrayWithArray:anArray]; } @end StepTalk-0.10.0/Languages/Smalltalk/NSDictionary+additions.h0000664000175000017500000000226014633027767022745 0ustar yavoryavor/** NSDictionary-additions.m Various methods for NSDictionary Copyright (c) 2019 Free Software Foundation Written by: Wolfgang Lux 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 NSDictionary (STCollecting) - do:(STBlock *)block; - select:(STBlock *)block; - reject:(STBlock *)block; - collect:(STBlock *)block; - detect:(STBlock *)block; @end StepTalk-0.10.0/Languages/Smalltalk/NSArray+additions.m0000664000175000017500000000624714633027767021734 0ustar yavoryavor/** 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 #import @implementation NSArray (STCollecting) - do:(STBlock *)block { NSEnumerator *enumerator; id object; id retval = nil; enumerator = [self objectEnumerator]; while( (object = [enumerator nextObject]) ) { retval = [block value: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 value: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 value: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 value:object]; if (value == nil) value = STNil; [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 value:object]; if([(NSNumber *)retval isTrue]) { return object; } } return retval; } @end StepTalk-0.10.0/Languages/Smalltalk/STSourceReader.m0000664000175000017500000004476614633027767021305 0ustar yavoryavor/** STSourceReader.m Source reader class. Copyright (c) 2002 Free Software Foundation This file is part of the StepTalk project. */ #import "STSourceReader.h" #import #import #import #import #import "Externs.h" static NSCharacterSet *identStartCharacterSet; static NSCharacterSet *identCharacterSet; static NSCharacterSet *wsCharacterSet; static NSCharacterSet *numericCharacterSet; static NSCharacterSet *symbolicSelectorCharacterSet; static NSCharacterSet *validCharacterCharacterSet; #define AT_END (srcOffset >= NSMaxRange(srcRange)) // #define AT_END ([self atEnd]) @interface NSString (LineCounting) - (NSInteger)lineNumberForIndex:(NSInteger)index; @end @implementation NSString (LineCounting) - (NSInteger)lineNumberForIndex:(NSInteger)index { NSInteger i, len; NSInteger line = 1; len = [self length]; index = (index < len) ? index : len; for (i = 0; i < index; i++) { switch ([self characterAtIndex:i]) { case 0x000d: if (i + 1 < index && [self characterAtIndex:i + 1] == 0x000a) i++; case 0x000a: case 0x2028: case 0x2029: line++; break; } } return line; } @end #define PEEK_CHAR [source characterAtIndex:srcOffset] #define GET_CHAR [source characterAtIndex:srcOffset++] @interface NSMutableString(CharacterAppending) - (void)appendCharacter:(unichar)character; @end @implementation NSMutableString(CharacterAppending) - (void)appendCharacter:(unichar)character { [self appendString:[NSString stringWithCharacters:&character length:1]]; } @end static NSString *_STNormalizeStringToken(NSString *token) { NSMutableString *string = [NSMutableString string]; NSUInteger i; unichar c; NSUInteger len = [token length]; for (i = 0; i < len; i++) { c = [token characterAtIndex:i]; if (c == '\\') { i++; c = [token characterAtIndex:i]; switch (c) { case 'a': c = '\a'; break; case 'b': c = '\b'; break; case 'e': c = '\e'; break; case 'n': c = '\n'; break; case 'r': c = '\r'; break; case 't': c = '\t'; break; case 'v': c = '\v'; break; default:; break; } } else if (c == '\'') { i++; NSCAssert(i < len && [token characterAtIndex:i] == '\'', @"Unescaped quote character in string token"); } [string appendCharacter:c]; } return string; } @implementation STSourceReader + (void)initialize { NSMutableCharacterSet *set; set = [[NSCharacterSet letterCharacterSet] mutableCopy]; [set addCharactersInString:@"_"]; identStartCharacterSet = [set copy]; [set formUnionWithCharacterSet:[NSCharacterSet decimalDigitCharacterSet]]; identCharacterSet = [set copy]; RELEASE(set); wsCharacterSet = [NSCharacterSet whitespaceAndNewlineCharacterSet]; numericCharacterSet = [NSCharacterSet decimalDigitCharacterSet]; symbolicSelectorCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"%&*+-,/<=>?@\\~"]; RETAIN(wsCharacterSet); RETAIN(numericCharacterSet); RETAIN(symbolicSelectorCharacterSet); set = [[NSCharacterSet controlCharacterSet] mutableCopy]; [set formUnionWithCharacterSet:[NSCharacterSet illegalCharacterSet]]; [set formUnionWithCharacterSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; validCharacterCharacterSet = RETAIN([set invertedSet]); RELEASE(set); } - (void)dealloc { RELEASE(source); [super dealloc]; } - initWithString:(NSString *)aString { return [self initWithString:aString range:NSMakeRange(0, [aString length])]; } - initWithString:(NSString *)aString range:(NSRange)range { if ((self = [super init]) != nil) { source = RETAIN(aString); srcRange = range; srcOffset = range.location; tokenRange = NSMakeRange(0, 0); tokenType = STInvalidTokenType; } return self; } - (STTokenType)tokenType { return tokenType; } - (NSString *)tokenString { if (tokenType == STStringTokenType) { return _STNormalizeStringToken([source substringWithRange:tokenRange]); } else { return [source substringWithRange:tokenRange]; } } - (NSRange)tokenRange { return tokenRange; } - (BOOL)atEnd { return srcOffset >= NSMaxRange(srcRange); } - (NSInteger)currentLine { return [source lineNumberForIndex:srcOffset]; } - (BOOL)eatWhiteSpace { while (!AT_END) { unichar uc = PEEK_CHAR; /* treat comments as whitespace */ if (uc == '"') { NSUInteger start = srcOffset; do { srcOffset++; if (AT_END) { tokenRange = NSMakeRange(start, srcOffset - start); [NSException raise:STCompilerSyntaxException format:@"Unterminated comment"]; return NO; } } while (PEEK_CHAR != '"'); } else if (![wsCharacterSet characterIsMember:uc]) { return YES; } srcOffset++; } return YES; } - (STTokenType)readNextToken { unichar c; NSInteger start; if (![self eatWhiteSpace]) { return STErrorTokenType; } if (AT_END) { return STEndTokenType; } start = srcOffset; c = GET_CHAR; if ([identStartCharacterSet characterIsMember:c]) { do { if (AT_END) { tokenRange = NSMakeRange(start, srcOffset - start); return STIdentifierTokenType; } c = GET_CHAR; } while ([identCharacterSet characterIsMember:c]); if (c == ':') { if (AT_END) { tokenRange = NSMakeRange(start, srcOffset - start); return STKeywordTokenType; } c = PEEK_CHAR; if (c == '=') { /* We have found := */ srcOffset--; tokenRange = NSMakeRange(start, srcOffset - start); return STIdentifierTokenType; } else { tokenRange = NSMakeRange(start, srcOffset - start); return STKeywordTokenType; } } else { /* Put back that character */ srcOffset--; tokenRange = NSMakeRange(start, srcOffset - start); return STIdentifierTokenType; } } else if (c == '-' || c == '+' || [numericCharacterSet characterIsMember:c]) { BOOL isReal = NO; if (c == '-' || c == '+') { if (AT_END) { tokenRange = NSMakeRange(start, 1); return STBinarySelectorTokenType; } /* Take next character and see if it is binary selector */ c = GET_CHAR; if (![numericCharacterSet characterIsMember:c]) { if ([symbolicSelectorCharacterSet characterIsMember:c]) { /* Both characters are making one binary selector */ tokenRange = NSMakeRange(start, 2); } else { /* Other character was neither number nor binary selector character, so we put it back. */ srcOffset--; tokenRange = NSMakeRange(start, 1); } return STBinarySelectorTokenType; } } /* c is a digit here */ do { if (AT_END) { tokenRange = NSMakeRange(start, srcOffset - start); return STIntNumberTokenType; } c = GET_CHAR; } while ([numericCharacterSet characterIsMember:c]); if (c == '.') { if (AT_END) { /* we have read a dot '.' at the end of string, do not treat it as decimal point. We rather put it back and treat it like end of statement. */ srcOffset--; tokenRange = NSMakeRange(start, srcOffset - start); return STIntNumberTokenType; } c = PEEK_CHAR; if (![numericCharacterSet characterIsMember:c]) { if ([wsCharacterSet characterIsMember:c]) { /* If there is whitespace or newline after a decimal point, we treat it as dot '.' - end of a statement. We have to put back that dot. */ srcOffset--; tokenRange = NSMakeRange(start, srcOffset - start); return STIntNumberTokenType; } else { tokenRange = NSMakeRange(start, srcOffset - start + 1); [NSException raise:STCompilerSyntaxException format:@"Invalid character '%c' after decimal point", c]; } return STErrorTokenType; } srcOffset++; do { if (AT_END) { tokenRange = NSMakeRange(start, srcOffset - start); return STRealNumberTokenType; } c = GET_CHAR; } while ([numericCharacterSet characterIsMember:c]); isReal = YES; /* Here we are either at the end or just scanned non-digit character. */ } if (c == 'e' || c == 'E') { if (AT_END) { /* We have reached the end of source without an exponent. This is an error. */ tokenRange = NSMakeRange(start, srcOffset - start); [NSException raise:STCompilerSyntaxException format:@"Unexpected end of source. " @"Exponent is missing."]; return STErrorTokenType; } c = GET_CHAR; if (c == '+' || c == '-') { if (AT_END) { /* We have reached the end of source without an exponent. This is an error. */ tokenRange = NSMakeRange(start, srcOffset - start); [NSException raise:STCompilerSyntaxException format:@"Unexpected end of source. " @"Exponent is missing after '%c'.", c]; return STErrorTokenType; } c = GET_CHAR; } if (![numericCharacterSet characterIsMember:c]) { srcOffset--; tokenRange = NSMakeRange(start, srcOffset - start + 1); [NSException raise:STCompilerSyntaxException format:@"Invalid character '%c' in exponent", c]; return STErrorTokenType; } do { if (AT_END) { tokenRange = NSMakeRange(start, srcOffset - start); return STRealNumberTokenType; } c = GET_CHAR; } while ([numericCharacterSet characterIsMember:c]); if ([identStartCharacterSet characterIsMember:c]) { tokenRange = NSMakeRange(start, srcOffset - start); [NSException raise:STCompilerSyntaxException format:@"Invalid character '%c' in real number.", c]; return STErrorTokenType; } isReal = YES; } else if ([identStartCharacterSet characterIsMember:c]) { tokenRange = NSMakeRange(start, srcOffset - start); [NSException raise:STCompilerSyntaxException format:@"Invalid character '%c' in integer.", c]; return STErrorTokenType; } srcOffset--; tokenRange = NSMakeRange(start, srcOffset - start); return isReal ? STRealNumberTokenType : STIntNumberTokenType; } else if ([symbolicSelectorCharacterSet characterIsMember:c]) { if (AT_END) { tokenRange = NSMakeRange(start, 1); return STBinarySelectorTokenType; } c = PEEK_CHAR; if ([symbolicSelectorCharacterSet characterIsMember:c]) { srcOffset++; tokenRange = NSMakeRange(start, 2); } else tokenRange = NSMakeRange(start, 1); return STBinarySelectorTokenType; } else { switch (c) { case '$': if (AT_END) { tokenRange = NSMakeRange(start, 1); [NSException raise:STCompilerSyntaxException format:@"Character expected"]; return STErrorTokenType; } c = GET_CHAR; if ([validCharacterCharacterSet characterIsMember:c]) { if (!AT_END) { c = PEEK_CHAR; if ([identCharacterSet characterIsMember:c]) { tokenRange = NSMakeRange(start, 3); [NSException raise:STCompilerSyntaxException format:@"Too many characters"]; return STErrorTokenType; } } tokenRange = NSMakeRange(start + 1, 1); return STCharacterTokenType; } tokenRange = NSMakeRange(start, 2); [NSException raise:STCompilerSyntaxException format:@"Invalid character literal"]; return STErrorTokenType; case '#': if (AT_END) { tokenRange = NSMakeRange(start, 1); return STSharpTokenType; } c = PEEK_CHAR; if (c == '(') { srcOffset++; tokenRange = NSMakeRange(start, 2); return STArrayOpenTokenType; } if ([identStartCharacterSet characterIsMember:c]) { do { srcOffset++; if (AT_END) break; c = PEEK_CHAR; } while ([identCharacterSet characterIsMember:c] || c == ':'); tokenRange = NSMakeRange(start + 1, srcOffset - start - 1); return STSymbolTokenType; } tokenRange = NSMakeRange(start, 1); return STSharpTokenType; case ':': if (AT_END) { tokenRange = NSMakeRange(start, 1); return STColonTokenType; } c = PEEK_CHAR; if (c == '=') { srcOffset++; tokenRange = NSMakeRange(start, 2); return STAssignTokenType; } tokenRange = NSMakeRange(start, 1); return STColonTokenType; #define SIMPLE_TOKEN_RETURN(type) \ tokenRange = NSMakeRange(start, 1);\ return type case '(': SIMPLE_TOKEN_RETURN(STLParenTokenType); case ')': SIMPLE_TOKEN_RETURN(STRParenTokenType); case '|': SIMPLE_TOKEN_RETURN(STBarTokenType); case ';': SIMPLE_TOKEN_RETURN(STSemicolonTokenType); case '[': SIMPLE_TOKEN_RETURN(STBlockOpenTokenType); case ']': SIMPLE_TOKEN_RETURN(STBlockCloseTokenType); case '^': SIMPLE_TOKEN_RETURN(STReturnTokenType); case '!': SIMPLE_TOKEN_RETURN(STSeparatorTokenType); case '.': SIMPLE_TOKEN_RETURN(STDotTokenType); case '\'': for (;;) { if (AT_END) { tokenRange = NSMakeRange(start, 1); [NSException raise:STCompilerSyntaxException format:@"Unterminated string"]; return STErrorTokenType; } c = GET_CHAR; if (c == '\\') { if (AT_END) { [NSException raise:STCompilerSyntaxException format:@"\\ at end"]; return STErrorTokenType; } GET_CHAR; } else if (c == '\'') { if (AT_END) { tokenRange = NSMakeRange(start + 1, srcOffset - start - 2); return STStringTokenType; } c = GET_CHAR; if (c != '\'') { srcOffset--; tokenRange = NSMakeRange(start + 1, srcOffset - start - 2); return STStringTokenType; } } } default: tokenRange = NSMakeRange(start, 1); return STErrorTokenType; } } } - (STTokenType)nextToken { tokenType = [self readNextToken]; return tokenType; } - (void)unreadLastToken { srcOffset = tokenRange.location; } @end StepTalk-0.10.0/Languages/Smalltalk/STSmalltalkScriptObject.m0000664000175000017500000001307014633027767023142 0ustar yavoryavor/** STSmalltalkScriptObject.m Object that represents script 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 "STSmalltalkScriptObject.h" #import "STBytecodeInterpreter.h" #import "STCompiledScript.h" #import #import #import #import #import #import #import #import #import #import #import #import @implementation STSmalltalkScriptObject - initWithEnvironment:(STEnvironment *)env compiledScript:(STCompiledScript *)compiledScript { if ((self = [super init]) != nil) { NSEnumerator *enumerator; NSString *varName; NSDebugLLog(@"STEngine", @"creating script object %p with ivars %@",compiledScript, [compiledScript variableNames]); environment = RETAIN(env); script = RETAIN(compiledScript); variables = [[NSMutableDictionary alloc] init]; enumerator = [[compiledScript variableNames] objectEnumerator]; while ((varName = [enumerator nextObject]) != nil) { [variables setObject:STNil forKey:varName]; } } return self; } - (void)dealloc { RELEASE(interpreter); RELEASE(script); RELEASE(variables); RELEASE(environment); [super dealloc]; } - (STCompiledScript *)script { return script; } - (void)setValue:(id)value forKey:(NSString *)key { if(value == nil) { value = STNil; } /* FIXME: check this for potential abuse and for speed improvements */ if([variables objectForKey:key]) { [variables setObject:value forKey:key]; } else { [super setValue:value forKey:key]; } } - (id)valueForKey:(NSString *)key { id value = [variables objectForKey:key]; if(value) { return value; } else { return [super valueForKey:key]; } } - (BOOL)respondsToSelector:(SEL)aSelector { NSDebugLLog(@"STSending", @"?? script object responds to %@", NSStringFromSelector(aSelector)); if( [super respondsToSelector:(SEL)aSelector] ) { return YES; } return ([script methodWithName: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 { NSAutoreleasePool *pool = [NSAutoreleasePool new]; STCompiledMethod *method; NSString *methodName = NSStringFromSelector([invocation selector]); NSMutableArray *args; id arg; NSUInteger index; NSUInteger count; id retval = nil; if(!interpreter) { NSDebugLLog(@"STEngine", @"creating new interpreter for script '%@'", name); interpreter = [[STBytecodeInterpreter alloc] initWithEnvironment:environment]; } if([methodName isEqualToString:@"exit"]) { [interpreter halt]; [pool release]; [invocation setReturnValue:&retval]; return; } method = [script methodWithName:methodName]; if (method == nil) { [pool release]; [super forwardInvocation:invocation]; return; } count = [[invocation methodSignature] numberOfArguments]; NSDebugLLog(@"STSending", @"script object perform: %@ with %lu args", methodName,(unsigned long)(count-2)); args = [[NSMutableArray alloc] init]; for(index = 2; index < count; index++) { arg = [invocation getArgumentAsObjectAtIndex:index]; if (arg == nil) { [args addObject:STNil]; } else { [args addObject:arg]; } } // NSDebugLLog(@"STSending", // @">> forwarding to self ..."); NS_DURING retval = [interpreter interpretMethod:method forReceiver:self arguments:args]; RELEASE(args); NS_HANDLER RETAIN(localException); RELEASE(args); [pool release]; [AUTORELEASE(localException) raise]; NS_ENDHANDLER // NSDebugLLog(@"STSending", // @"<< returned from forwarding"); [invocation setReturnValue:&retval]; [pool release]; } @end StepTalk-0.10.0/Languages/Smalltalk/STCompiledScript.m0000664000175000017500000001031514633027767021622 0ustar yavoryavor/** STCompiledScript.m 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 "STCompiledScript.h" #import "STSmalltalkScriptObject.h" #import "STCompiledMethod.h" #import #import #import #import #import #import #import #import @class STEnvironment; static SEL mainSelector; static SEL initializeSelector; static SEL finalizeSelector; @implementation STCompiledScript:NSObject + (void)initialize { mainSelector = STSelectorFromString(@"main"); initializeSelector = STSelectorFromString(@"startUp"); finalizeSelector = STSelectorFromString(@"shutDown"); } - initWithVariableNames:(NSArray *)array; { if ((self = [super init]) != nil) { variableNames = RETAIN(array); } return self; } - (void)dealloc { RELEASE(methodDictionary); RELEASE(variableNames); [super dealloc]; } - (void)addMethod:(STCompiledMethod *)method { if(!methodDictionary) { methodDictionary = [[NSMutableDictionary alloc] init]; } if( ! [method isKindOfClass:[STCompiledMethod class]] ) { [NSException raise:STGenericException format:@"Invalid compiled method class '%@'", [method class]]; } [methodDictionary setObject:method forKey:[method selector]]; } - (STCompiledMethod *)methodWithName:(NSString *)name { return [methodDictionary objectForKey:name]; } - (NSArray*)variableNames { return variableNames; } - (id)executeInEnvironment:(STEnvironment *)env { STSmalltalkScriptObject *object; NSUInteger methodCount; id retval = nil; object = [[STSmalltalkScriptObject alloc] initWithEnvironment:env compiledScript:self]; methodCount = [methodDictionary count]; if (methodCount == 0) { NSLog(@"Empty script executed"); } else if (methodCount == 1) { NSString *selName = [[methodDictionary allKeys] objectAtIndex:0]; SEL sel = STSelectorFromString(selName); NSDebugLog(@"Executing single-method script. (%@)", selName); NS_DURING retval = [object performSelector:sel]; NS_HANDLER RELEASE(object); [localException raise]; NS_ENDHANDLER } else if (![object respondsToSelector:mainSelector]) { NSLog(@"No 'main' method found"); } else { NS_DURING if ([object respondsToSelector:initializeSelector]) { NSDebugLog(@"Sending 'startUp' to script object"); [object performSelector:initializeSelector]; } if ([object respondsToSelector:mainSelector]) { retval = [object performSelector:mainSelector]; } else { NSLog(@"No 'main' found in script"); } if ([object respondsToSelector:finalizeSelector]) { NSDebugLog(@"Sending 'shutDown' to script object"); [object performSelector:finalizeSelector]; } NS_HANDLER RELEASE(object); [localException raise]; NS_ENDHANDLER } RELEASE(object); return retval; } @end StepTalk-0.10.0/Languages/Smalltalk/SmalltalkInfo.plist0000664000175000017500000000030614633027767022070 0ustar yavoryavor{ STFileTypes = ( "st", "stalk" ); StepTalkLanguages = { Smalltalk = { FileTypes = ("st"); EngineClass = "SmalltalkEngine"; }; }; } StepTalk-0.10.0/Languages/Smalltalk/STExecutionContext.h0000664000175000017500000000325714633027767022213 0ustar yavoryavor/** STExecutionContext.h 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 STStack; @class STBytecodes; @class STMethodContext; @interface STExecutionContext:NSObject { NSUInteger contextId; /* for debugging */ STStack *stack; NSUInteger instructionPointer; } - initWithStackSize:(NSUInteger)stackSize; - (void)invalidate; - (BOOL)isValid; - (STMethodContext *)homeContext; - (void)setHomeContext:(STMethodContext *)context; - (BOOL)isBlockContext; - (NSUInteger)instructionPointer; - (void)setInstructionPointer:(NSUInteger)value; - (STBytecodes *)bytecodes; - (STStack *)stack; - (id)temporaryAtIndex:(NSUInteger)index; - (void)setTemporary:anObject atIndex:(NSUInteger)index; - (NSString *)referenceNameAtIndex:(NSUInteger)index; - (id)literalObjectAtIndex:(NSUInteger)index; - (id)receiver; @end StepTalk-0.10.0/Languages/Smalltalk/STSelector+additions.m0000664000175000017500000000225314633027767022435 0ustar yavoryavor/* STSelector additions Copyright (c) 2002 Free Software Foundation 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+additions.h" #import @implementation STSelector(SmalltalkCompiler) + symbolFromString:(NSString *)aString { STSelector *aSel; aSel = [[STSelector alloc] initWithSelector:STSelectorFromString(aString)]; return AUTORELEASE(aSel); } @end StepTalk-0.10.0/Languages/Smalltalk/STExecutionContext.m0000664000175000017500000000437514633027767022222 0ustar yavoryavor/** STExecutionContext.m Copyright (c) 2002 Free Software Foundation This file is part of the StepTalk project. */ #import "STExecutionContext.h" #import "STMethodContext.h" #import "STStack.h" #import #import #import static NSUInteger nextId = 1; @interface STExecutionContext(STPrivateMethods) - (NSUInteger)contextId; @end @implementation STExecutionContext - initWithStackSize:(NSUInteger)stackSize { if ((self = [super init]) != nil) { stack = [[STStack alloc] initWithSize:stackSize]; contextId = nextId ++; } return self; } - (void)dealloc { RELEASE(stack); [super dealloc]; } - (NSUInteger)contextId { return contextId; } - (NSString *)description { NSMutableString *str; str = [NSMutableString stringWithFormat: @"%@ %lu (home %lu)", [self className], (unsigned long)contextId, (unsigned long)[[self homeContext] contextId]]; return str; } - (void)invalidate { instructionPointer = NSNotFound; } - (BOOL)isValid { return (instructionPointer != NSNotFound); } - (NSUInteger)instructionPointer { return instructionPointer; } - (void)setInstructionPointer:(NSUInteger)value { instructionPointer = value; } - (STMethodContext *)homeContext { [self subclassResponsibility:_cmd]; return nil; } - (void)setHomeContext:(STMethodContext *)newContext { [self subclassResponsibility:_cmd]; } - (STStack *)stack { return stack; } - (BOOL)isBlockContext; { [self subclassResponsibility:_cmd]; return NO; } - (id)temporaryAtIndex:(NSUInteger)index { [self subclassResponsibility:_cmd]; return nil; } - (void)setTemporary:anObject atIndex:(NSUInteger)index { [self subclassResponsibility:_cmd]; } - (NSString *)referenceNameAtIndex:(NSUInteger)index { [self subclassResponsibility:_cmd]; return nil; } - (STBytecodes *)bytecodes { [self subclassResponsibility:_cmd]; return nil; } - (id)literalObjectAtIndex:(NSUInteger)index { [self subclassResponsibility:_cmd]; return nil; } - (id)receiver { [self subclassResponsibility:_cmd]; return nil; } @end StepTalk-0.10.0/Languages/Smalltalk/STUndefinedObject+additions.m0000664000175000017500000000145014633027767023703 0ustar yavoryavor/** STUndefinedObject.m Wrapper for nil object Copyright (c) 2002 Free Software Foundation This file is part of the StepTalk project. */ #import "STUndefinedObject+additions.h" #import "STBlock.h" #import #import #import @implementation STUndefinedObject(SmalltalkAdditions) - (BOOL)isNil { return YES; } - ifNil:(STBlock *)block { return [block value]; } - notNil:(STBlock *)block { return nil; } - ifFalse:(STBlock *)block { return [block value]; } - ifTrue:(STBlock *)block { return nil; } - ifFalse:(STBlock *)block ifTrue:(STBlock *)anotherBlock { return [block value]; } - ifTrue:(STBlock *)block ifFalse:(STBlock *)anotherBlock { return [anotherBlock value]; } @end StepTalk-0.10.0/Languages/Smalltalk/NSObject+additions.h0000664000175000017500000000207214633027767022047 0ustar yavoryavor/** 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 StepTalk-0.10.0/Languages/Smalltalk/STLiterals.m0000664000175000017500000000402414633027767020460 0ustar yavoryavor/** STLiterals.h Literal objects 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 "STLiterals.h" #import @implementation STLiteral @end @implementation STObjectReferenceLiteral - initWithObjectName:(NSString *)anObject poolName:(NSString *)aPool { if ((self = [super init]) != nil) { objectName = RETAIN(anObject); poolName = RETAIN(aPool); } return self; } #if 0 - copyWithZone:(NSZone *)zone { STObjectReferenceLiteral *copy = [super copyWithZone:zone]; return copy; } #endif - (void)dealloc { RELEASE(objectName); RELEASE(poolName); [super dealloc]; } - (NSString *)poolName { return poolName; } - (NSString *)objectName { return objectName; } - (NSString *)description { return [NSMutableString stringWithFormat: @"STObjectReferenceLiteral { object '%@', pool '%@' }", objectName,poolName]; } @end @implementation STBlockLiteral - initWithArgumentCount:(NSUInteger)count { if ((self = [super init]) != nil) argCount = count; return self; } - (void)setStackSize:(NSUInteger)size { stackSize = size; } - (NSUInteger)argumentCount { return argCount; } - (NSUInteger)stackSize { return stackSize; } @end StepTalk-0.10.0/Languages/Smalltalk/NSNumber+additions.m0000664000175000017500000000330414633027767022075 0ustar yavoryavor/** 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:(NSInteger)number do:(STBlock *)block { id retval = nil; NSInteger i; for(i=[self intValue];i<=number;i++) { retval = [block value:[NSNumber numberWithInt:i]]; } return retval; } - to:(NSInteger)number step:(NSInteger)step do:(STBlock *)block { id retval = nil; NSInteger i; if (step > 0) { for(i=[self intValue];i<=number;i+=step) { retval = [block value:[NSNumber numberWithInt:i]]; } } else { // step =< 0 for(i=[self intValue];i>=number;i+=step) { retval = [block value:[NSNumber numberWithInt:i]]; } } return retval; } @end StepTalk-0.10.0/Languages/Smalltalk/STCompiledMethod.m0000664000175000017500000001023514633027767021577 0ustar yavoryavor/** STCompiledMethod.m 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 "STCompiledMethod.h" #import "STMessage.h" #import "STBytecodes.h" #import #import #import #import #import #import #import @implementation STCompiledMethod + methodWithCode:(STCompiledCode *)code messagePattern:(STMessage *)pattern { STCompiledMethod *method; method = [[STCompiledMethod alloc] initWithSelector:[pattern selector] argumentCount:[[pattern arguments] count] bytecodesData:[[code bytecodes] data] literals:[code literals] temporariesCount:[code temporariesCount] stackSize:[code stackSize] namedReferences:[code namedReferences]]; return AUTORELEASE(method); } - initWithSelector:(NSString *)sel argumentCount:(NSUInteger)aCount bytecodesData:(NSData *)data literals:(NSArray *)anArray temporariesCount:(NSUInteger)tCount stackSize:(NSUInteger)size namedReferences:(NSArray *)refs; { if ((self = [super initWithBytecodesData:data literals:anArray temporariesCount:tCount stackSize:size namedReferences:refs]) != nil) { NSAssert(aCount < SHRT_MAX, @"too many arguments (>= max(short))"); selector = RETAIN(sel); argCount = aCount; } return self; } - (void)dealloc { RELEASE(selector); [super dealloc]; } - (NSString *)selector { return selector; } - (NSUInteger)argumentCount { return argCount; } - (NSString*)description { NSMutableString *desc = [NSMutableString string]; [desc appendFormat:@"%@:\n" @"Selector = %@\n" @"Literals Count = %lu\n" @"Literals = %@\n" @"External References = %@\n" @"Temporaries Count = %u\n" @"Stack Size = %u\n" @"Byte Codes = %@\n", [self className], selector, (unsigned long)[literals count], [literals description], [namedRefs description], tempCount, stackSize, [bytecodes description]]; return desc; } /* Script object method info */ - (NSString *)methodName { return selector; } - (NSString *)languageName { return @"Smalltalk"; } - (void)encodeWithCoder:(NSCoder *)coder { [super encodeWithCoder: coder]; [coder encodeObject:selector]; [coder encodeValueOfObjCType: @encode(short) at: &argCount]; } - initWithCoder:(NSCoder *)decoder { if ((self = [super initWithCoder: decoder]) != nil) { [decoder decodeValueOfObjCType: @encode(id) at: &selector]; [decoder decodeValueOfObjCType: @encode(short) at: &argCount]; } return self; } - (NSString *)source { return nil; } @end StepTalk-0.10.0/Languages/Smalltalk/STUndefinedObject+additions.h0000664000175000017500000000235114633027767023677 0ustar yavoryavor/** STUndefinedObject.h Wrapper for nil object 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 STUndefinedObject(SmalltalkAdditions) - ifFalse:(STBlock *)block ifTrue:(STBlock *)anotherBlock; - ifTrue:(STBlock *)block ifFalse:(STBlock *)anotherBlock; - ifTrue:(STBlock *)block; - ifFalse:(STBlock *)block; - ifNil:(STBlock *)block; - notNil:(STBlock *)block; - (BOOL)isNil; @end StepTalk-0.10.0/Languages/Smalltalk/STCompilerUtils.h0000664000175000017500000001106614633027767021473 0ustar yavoryavor/** STCompilerUtils.h Various compiler utilities. Copyright (c) 2002 Free Software Foundation 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 #import #import #import @class STCMessage; @class STCStatements; @class STCExpression; enum{ STCVariablePrimaryType, STCLiteralPrimaryType, STCBlockPrimaryType, STCExpressionPrimaryType }; @interface STCompiler(Utils_private) - (void)compileMethod:(STCMethod *)method; - (id)createIntNumberLiteralFrom:(NSString *)aString; - (id)createRealNumberLiteralFrom:(NSString *)aString; - (id)createSymbolLiteralFrom:(NSString *)aString; - (id)createStringLiteralFrom:(NSString *)aString; - (id)createCharacterLiteralFrom:(NSString *)aString; - (id)createArrayLiteralFrom:(NSArray *)anArray; @end /* * STCMethod * --------------------------------------------------------------------------- */ @interface STCMethod:NSObject { STCMessage *messagePattern; STCStatements *statements; } + methodWithPattern:(STCMessage *)patt statements:(STCStatements *)stats; - initWithPattern:(STCMessage *)patt statements:(STCStatements *)stats; - (STCStatements *)statements; - (STCMessage *)messagePattern; @end /* * STCStatements * --------------------------------------------------------------------------- */ @interface STCStatements:NSObject { NSArray *variables; NSArray *expressions; STCExpression *retexpr; } + statements; - (void)setTemporaries:(NSArray *)vars; - (NSArray *)temporaries; - (void)setExpressions:(NSArray *)exprs; - (NSArray *)expressions; - (void)setReturnExpression:(STCExpression *)ret; - (STCExpression *)returnExpression; @end /* * STCMessage * --------------------------------------------------------------------------- */ @interface STCMessage:NSObject { NSMutableString *selector; NSMutableArray *args; } + message; - (void) addKeyword:(NSString *)keyword object:object; - (NSString *)selector; - (NSArray*)arguments; @end /* * STCExpression * --------------------------------------------------------------------------- */ @interface STCExpression:NSObject { NSArray *cascade; NSArray *assignments; } + (STCExpression *) primaryExpressionWithObject:(id)anObject; + (STCExpression *) messageExpressionWithTarget:(id)anObject message:(STCMessage *)message; - (void)setCascade:(NSArray *)casc; - (void)setAssignments:(NSArray *)asgs; - (NSArray *)cascade; - (NSArray *)assignments; - (BOOL) isPrimary; - (id) target; - (STCMessage *)message; - (id) object; @end @interface STCMessageExpression:STCExpression { id target; STCMessage *message; } - initWithTarget:(id)anObject message:(STCMessage *)message; @end @interface STCPrimaryExpression:STCExpression { id object; } - initWithObject:(id)anObject; @end /* * STCPrimary * --------------------------------------------------------------------------- */ @interface STCPrimary:NSObject { int type; id object; } + primaryWithVariable:(id)anObject; + primaryWithLiteral:(id)anObject; + primaryWithBlock:(id)anObject; + primaryWithExpression:(id)anObject; - initWithType:(int)newType object:(id)obj; - (int)type; - object; @end /* * Compiler additions for literals * --------------------------------------------------------------------------- */ @interface NSString(STCompilerAdditions) + (NSString *) symbolFromString:(NSString *)aString; + (id) characterFromString:(NSString *)aString; @end @interface NSMutableString(STCompilerAdditions) + (id) stringFromString:(NSString *)aString; @end @interface NSNumber(STCompilerAdditions) + (id) intNumberFromString:(NSString *)aString; + (id) realNumberFromString:(NSString *)aString; @end @interface NSMutableArray(STCompilerAdditions) + (id) arrayFromArray:(NSArray *)anArray; @end StepTalk-0.10.0/Languages/Smalltalk/STBlockContext.h0000664000175000017500000000237714633027767021304 0ustar yavoryavor/** STBlockContext.h 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 "STExecutionContext.h" @class STMethodContext; @interface STBlockContext:STExecutionContext { STMethodContext *homeContext; /* owner of this block context */ NSUInteger initialIP; } - initWithInitialIP:(NSUInteger)pointer stackSize:(NSUInteger)size; - (void)setHomeContext:(STMethodContext *)context; - (NSUInteger)initialIP; - (void)resetInstructionPointer; @end StepTalk-0.10.0/Languages/Smalltalk/STMessage.h0000664000175000017500000000244314633027767020263 0ustar yavoryavor/** STMessage.h Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Jun 18 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; @class NSArray; @interface STMessage:NSObject { NSString *selector; NSArray *args; } + (STMessage *)messageWithSelector:(NSString *)selector arguments:(NSArray *)args; - initWithSelector:(NSString *)aString arguments:(NSArray *)anArray; - (NSString *)selector; - (NSArray*)arguments; @end StepTalk-0.10.0/Languages/Smalltalk/STBytecodeInterpreter.h0000664000175000017500000000370214633027767022660 0ustar yavoryavor/** STBytecodeInterpreter.h 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 STCompiledMethod; @class STCompiledCode; @class STBytecodes; @class STExecutionContext; @class STStack; @class STEnvironment; @class NSArray; @class NSMutableArray; @class NSMutableDictionary; @interface STBytecodeInterpreter:NSObject { STEnvironment *environment; /* scripting environment */ STExecutionContext *activeContext; /* current execution context */ STStack *stack; /* from context */ STBytecodes *bytecodes; /* from context */ NSUInteger instructionPointer; /* IP */ id receiver; NSInteger entry; BOOL stopRequested; } + interpreterWithEnvrionment:(STEnvironment *)env; - initWithEnvironment:(STEnvironment *)env; - (void)setEnvironment:(STEnvironment *)env; - (id)interpretMethod:(STCompiledMethod *)method forReceiver:(id)anObject arguments:(NSArray*)args; - (void)setContext:(STExecutionContext *)context; - (STExecutionContext *)context; - (id)interpret; - (void)halt; @end StepTalk-0.10.0/Languages/Smalltalk/NSNumber+additions.h0000664000175000017500000000246314633027767022075 0ustar yavoryavor/** 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:(NSInteger)number do:(STBlock *)block; - to:(NSInteger)number step:(NSInteger)step do:(STBlock *)block; @end StepTalk-0.10.0/Languages/Smalltalk/STMethodContext.h0000664000175000017500000000267714633027767021475 0ustar yavoryavor/** STMethodContext.h 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 "STExecutionContext.h" @class STCompiledMethod; @class NSMutableArray; @interface STMethodContext:STExecutionContext { STCompiledMethod *method; NSMutableArray *temporaries; id receiver; } + methodContextWithMethod:(STCompiledMethod *)newMethod; - initWithMethod:(STCompiledMethod *)newMethod; - (STCompiledMethod*)method; - (void)setReceiver:anObject; - (id)receiver; - (void)setArgumentsFromArray:(NSArray *)args; - (id)temporaryAtIndex:(NSUInteger)index; - (void)setTemporary:anObject atIndex:(NSUInteger)index; - (STBytecodes *)bytecodes; @end StepTalk-0.10.0/Languages/Smalltalk/STCompiledMethod.h0000664000175000017500000000271414633027767021575 0ustar yavoryavor/** STCompiledMethod.h Copyright (c) 2002 Free Software Foundation 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 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 "STCompiledCode.h" #import @class STMessage; @interface STCompiledMethod:STCompiledCode { NSString *selector; short argCount; // NSUInteger primitive; } + methodWithCode:(STCompiledCode *)code messagePattern:(STMessage *)pattern; - initWithSelector:(NSString *)sel argumentCount:(NSUInteger)aCount bytecodesData:(NSData *)data literals:(NSArray *)anArray temporariesCount:(NSUInteger)tCount stackSize:(NSUInteger)size namedReferences:(NSArray *)refs; - (NSString *)selector; - (NSUInteger)argumentCount; @end StepTalk-0.10.0/Languages/Smalltalk/NSArray+additions.h0000664000175000017500000000215314633027767021717 0ustar yavoryavor/** 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 StepTalk-0.10.0/Languages/MyLanguage/0000775000175000017500000000000014633027767016361 5ustar yavoryavorStepTalk-0.10.0/Languages/MyLanguage/MyLanguageInfo.plist0000664000175000017500000000033214633027767022301 0ustar yavoryavor{ /* Array of file types of your language scripts */ StepTalkLanguages = { MyLanguage = { FileTypes = ("mylang"); EngineClass = "MyLanguageEngine"; } } } StepTalk-0.10.0/Languages/MyLanguage/GNUmakefile0000664000175000017500000000134514633027767020436 0ustar yavoryavor# # MyLanguage language bundle # # @COPYRIGHT@ # include $(GNUSTEP_MAKEFILES)/common.make ########################################################################### # Language name BUNDLE_NAME = MyLanguage MyLanguage_PRINCIPAL_CLASS = MyLanguageEngine ########################################################################### # Files MyLanguage_OBJC_FILES = \ MyLanguageEngine.m # MyLanguage_BUNDLE_LIBS += -lmylanguage ########################################################################### BUNDLE_EXTENSION := .stlanguage BUNDLE_INSTALL_DIR:=$(GNUSTEP_LIBRARY)/StepTalk/Languages -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUMakefile.postamble StepTalk-0.10.0/Languages/MyLanguage/MyLanguageEngine.h0000664000175000017500000000025314633027767021711 0ustar yavoryavor/** MyLanguageEngine @COPYRIGHT@ Written by: @AUTHOR@ Date: @DATE@ */ #import @interface MyLanguageEngine:STEngine { } @end StepTalk-0.10.0/Languages/MyLanguage/MyLanguageEngine.m0000664000175000017500000000106114633027767021714 0ustar yavoryavor/** MyLanguageEngine @COPYRIGHT@ Written by: @AUTHOR@ Date: @DATE@ */ #import "MyLanguageEngine.h" @implementation MyLanguageEngine - (id) interpretScript:(NSString *)aScript inContext:(STContext *)context { id retval = nil; /* execute the code sourceCode using environment env */ /* use [env objectDictionary] to get environment objects (see STContext documentation or header file to see what you can do) */ /* retval = return value from the interpreter; */ return retval; } @end StepTalk-0.10.0/Languages/GNUmakefile0000664000175000017500000000211514633027767016401 0ustar yavoryavor# # Main Makefile for the StepTalk # # Copyright (C) 2000 Stefan Urbanek # # Written by: 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., 59 Temple Place, Suite 330, Boston, MA 02111 USA # include $(GNUSTEP_MAKEFILES)/common.make SUBPROJECTS = \ Smalltalk \ # Guile -include GNUMakefile.preamble include $(GNUSTEP_MAKEFILES)/aggregate.make -include GNUMakefile.postamble StepTalk-0.10.0/Finders/0000775000175000017500000000000014633027767014014 5ustar yavoryavorStepTalk-0.10.0/Finders/GNUmakefile0000664000175000017500000000215514633027767016071 0ustar yavoryavor# # GNUmakefile # # Copyright (C) 2002 Stefan Urbanek # # Written by: 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., 59 Temple Place, Suite 330, Boston, MA 02111 USA # include $(GNUSTEP_MAKEFILES)/common.make ifeq ($(appkit),no) SUBPROJECTS = DistributedFinder else SUBPROJECTS = DistributedFinder ApplicationFinder endif -include GNUMakefile.preamble include $(GNUSTEP_MAKEFILES)/aggregate.make -include GNUMakefile.postamble StepTalk-0.10.0/Finders/DistributedFinder/0000775000175000017500000000000014633027767017426 5ustar yavoryavorStepTalk-0.10.0/Finders/DistributedFinder/GNUmakefile0000664000175000017500000000263614633027767021507 0ustar yavoryavor# # Distributed Objects Finder module # # Copyright (C)2002 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 = DistributedFinder DistributedFinder_OBJC_FILES = STDistributedFinder.m DistributedFinder_PRINCIPAL_CLASS = STDistributedFinder DistributedFinder_BUNDLE_LIBS += -lStepTalk ADDITIONAL_BUNDLE_LIBS = -lStepTalk ADDITIONAL_INCLUDE_DIRS += -I../../Frameworks/ ADDITIONAL_LIB_DIRS += -L../../Frameworks/StepTalk/StepTalk.framework/Versions/Current/$(GNUSTEP_TARGET_LDIR) BUNDLE_INSTALL_DIR:=$(GNUSTEP_LIBRARY)/StepTalk/Finders -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUMakefile.postamble StepTalk-0.10.0/Finders/DistributedFinder/.cvsignore0000664000175000017500000000010514633027767021422 0ustar yavoryavor*.app *.debug *.profile shared_*obj *.bundle *.stmodule *.stlanguage StepTalk-0.10.0/Finders/DistributedFinder/STDistributedFinder.m0000664000175000017500000001111514633027767023464 0ustar yavoryavor/** STDistributedFinder.m StepTalk simple transcript Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Apr 13 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 "STDistributedFinder.h" #import #import #import #import #import #import #import #import #import #import static NSDictionary *STDOInfo(NSString *name) { NSString *file; file = STFindResource(name, @"DistributedObjects", @"plist"); if(file) { return [NSDictionary dictionaryWithContentsOfFile:file]; } return nil; } @implementation STDistributedFinder - (id)connectDistantObjectWithName:(NSString *)name { NSDictionary *dict = STDOInfo(name); NSEnumerator *enumerator; NSString *host; id obj; NSString *distantName; distantName = [dict objectForKey:@"ObjectName"]; if(!distantName || [distantName isEqualToString:@""]) { distantName = name; } /* find object on host 'Host' */ host = [dict objectForKey:@"Host"]; NSDebugLLog(@"STFinder", @"Looking up '%@' at '%@'", distantName, host); obj = [NSConnection rootProxyForConnectionWithRegisteredName:distantName host:host]; if(obj) { return obj; } /* Lookup for object at specified hosts */ enumerator = [[dict objectForKey:@"Hosts"] objectEnumerator]; while( (host = [enumerator nextObject]) ) { NSDebugLLog(@"STFinder", @"Looking up '%@' at '%@'", distantName, host); obj = [NSConnection rootProxyForConnectionWithRegisteredName:distantName host:host]; if(obj) { return obj; } } return nil; } - (id)objectWithName:(NSString *)name { NSDictionary *dict = STDOInfo(name); NSString *toolName = [dict objectForKey:@"Tool"]; NSString *delayStr; NSTask *task; int delay = 5; /* default delay */ id obj; obj = [self connectDistantObjectWithName:name]; if(obj || !dict) { return obj; } if(!toolName || [toolName isEqualToString:@""]) { return nil; } NSDebugLLog(@"STFinder", @"Launching '%@'", toolName); task = [NSTask launchedTaskWithLaunchPath:toolName arguments:[dict objectForKey:@"Arguments"]]; delayStr = [dict objectForKey:@"Wait"]; if(delayStr && ![delayStr isEqualToString:@""]) { delay = [[dict objectForKey:@"Wait"] intValue]; } if(!task) { NSLog(@"(StepTalk) Unable to launch task '%@'", toolName); return nil; } [NSTimer scheduledTimerWithTimeInterval: delay invocation: nil repeats: NO]; [[NSRunLoop currentRunLoop] runUntilDate: [NSDate dateWithTimeIntervalSinceNow: delay]]; return [self connectDistantObjectWithName:name]; } - (NSArray *)knownObjectNames { NSMutableArray *array = [NSMutableArray array]; NSEnumerator *enumerator; NSString *name; NSString *file; NSArray *fileArray; fileArray = STFindAllResources(@"DistributedObjects", @"plist"); enumerator = [fileArray objectEnumerator]; while( (file = [enumerator nextObject]) ) { name = [[file lastPathComponent] stringByDeletingPathExtension]; [array addObject:name]; } return [NSArray arrayWithArray:array]; } @end StepTalk-0.10.0/Finders/DistributedFinder/STDistributedFinder.h0000664000175000017500000000215714633027767023465 0ustar yavoryavor/** STDistributedFinder.h StepTalk simple transcript Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Apr 13 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 STDistributedFinder:NSObject - (NSArray *)knownObjectNames; - (id)objectWithName:(NSString *)name; @end StepTalk-0.10.0/Finders/ApplicationFinder/0000775000175000017500000000000014633027767017407 5ustar yavoryavorStepTalk-0.10.0/Finders/ApplicationFinder/GNUmakefile0000664000175000017500000000270714633027767021467 0ustar yavoryavor# # Application Finder # # Copyright (C) 2000,2001 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 include $(GNUSTEP_MAKEFILES)/Additional/gui.make BUNDLE_NAME = ApplicationFinder ApplicationFinder_OBJC_FILES = STApplicationFinder.m ApplicationFinder_PRINCIPAL_CLASS = STApplicationFinder ApplicationFinder_BUNDLE_LIBS += -lStepTalk ADDITIONAL_BUNDLE_LIBS = -lStepTalk ADDITIONAL_INCLUDE_DIRS += -I../../Frameworks/ ADDITIONAL_LIB_DIRS += -L../../Frameworks/StepTalk/StepTalk.framework/Versions/Current/$(GNUSTEP_TARGET_LDIR) BUNDLE_INSTALL_DIR:=$(GNUSTEP_LIBRARY)/StepTalk/Finders -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUMakefile.postamble StepTalk-0.10.0/Finders/ApplicationFinder/STApplicationFinder.h0000664000175000017500000000201114633027767023414 0ustar yavoryavor/** STApplicationFinder Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2002 Jun 8 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 STApplicationFinder:NSObject { } @end StepTalk-0.10.0/Finders/ApplicationFinder/.cvsignore0000664000175000017500000000010514633027767021403 0ustar yavoryavor*.app *.debug *.profile shared_*obj *.bundle *.stmodule *.stlanguage StepTalk-0.10.0/Finders/ApplicationFinder/STApplicationFinder.m0000664000175000017500000000635314633027767023436 0ustar yavoryavor/** STApplicationFinder Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2002 Jun 8 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 "STApplicationFinder.h" #import #import #import #import #import #import #import #import #import #import @implementation STApplicationFinder - (NSArray *)applicationsInDirectory:(NSString *)path { NSDirectoryEnumerator *enumerator; NSMutableArray *array = [NSMutableArray array]; NSString *file; enumerator = [[NSFileManager defaultManager] enumeratorAtPath:path]; while ( (file = [enumerator nextObject]) ) { if ([[file pathExtension] isEqualToString:@"app"]) { file = [file lastPathComponent]; file = [file stringByDeletingPathExtension]; [array addObject:file]; } } return [NSArray arrayWithArray:array]; } - (NSArray *)knownObjectNames { NSEnumerator *enumerator; NSArray *paths; NSString *path; NSMutableSet *set = [NSMutableSet set]; paths = NSSearchPathForDirectoriesInDomains(NSAllApplicationsDirectory, NSAllDomainsMask, YES); enumerator = [paths objectEnumerator]; while( (path = [enumerator nextObject]) ) { [set addObjectsFromArray:[self applicationsInDirectory:path]]; } return [set allObjects]; } - (id)connectApplicationWithName:(NSString *)name { id app; NSDebugLLog(@"STFinder", @"Connecting application '%@'", name); app = [NSConnection rootProxyForConnectionWithRegisteredName:name /* ... */ host:nil]; return app; } - (id)objectWithName:(NSString *)name { NSString *appName; if( ![[self knownObjectNames] containsObject:name] ) { return nil; } /* FIXME: We need to add .app extension */ appName = [name stringByAppendingPathExtension:@"app"]; NSLog(@"Launching '%@'", name); if([[NSWorkspace sharedWorkspace] launchApplication:appName]) { NSLog(@"Connecting '%@'", name); return [self connectApplicationWithName:name]; } return nil; } @end StepTalk-0.10.0/Modules/0000775000175000017500000000000014633027767014032 5ustar yavoryavorStepTalk-0.10.0/Modules/SQLClient/0000775000175000017500000000000014633027767015630 5ustar yavoryavorStepTalk-0.10.0/Modules/SQLClient/STSQLClientModule.m0000664000175000017500000000262514633027767021226 0ustar yavoryavor/** STSQLClientModule.m SQLClient bindings Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 May 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 "STSQLClientModule.h" #import #import @class NSApplication; extern NSDictionary *STGetSQLClientConstants(); @implementation STSQLClientModule + (NSDictionary *)namedObjectsForScripting { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict addEntriesFromDictionary:STGetSQLClientConstants()]; return [NSDictionary dictionaryWithDictionary:dict]; } @end StepTalk-0.10.0/Modules/SQLClient/ScriptingInfo.plist0000664000175000017500000000017114633027767021462 0ustar yavoryavor{ ScriptingInfoClass = STSQLClientModule; Classes = ( SQLClient, SQLRecord, SQLTransaction ); } StepTalk-0.10.0/Modules/SQLClient/GNUmakefile0000664000175000017500000000337514633027767017712 0ustar yavoryavor# # StepTalk tools # # Copyright (C) 2000,2001 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 = SQLClient SQLClient_OBJC_FILES = \ STSQLClientModule.m \ SQLClientConstants.m \ SQLClient+additions.m SQLClient_PRINCIPAL_CLASS = STSQLClientModule SQLClient_RESOURCE_FILES = ScriptingInfo.plist BUNDLE_INSTALL_DIR:=$(GNUSTEP_LIBRARY)/StepTalk/Modules ADDITIONAL_OBJCFLAGS = -Wall -Wno-import BUNDLE_LIBS += -lStepTalk -lSQLClient ADDITIONAL_INCLUDE_DIRS += -I../../Frameworks/ ADDITIONAL_LIB_DIRS += -L../../Frameworks/StepTalk/StepTalk.framework/Versions/Current/$(GNUSTEP_TARGET_LDIR) -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUMakefile.postamble SQLClientConstants.m : SQLClientConstants.list %.m : %.list header.m footer.m @( echo Creating $@ ...; \ cat header.m | sed "s/@@NAME@@/`basename $< .list`/g" > $@; \ cat $< | awk -f create_constants.awk >> $@;\ cat footer.m >> $@; ) StepTalk-0.10.0/Modules/SQLClient/footer.m0000664000175000017500000000005514633027767017304 0ustar yavoryavor return dict; } /* -- End of file -- */ StepTalk-0.10.0/Modules/SQLClient/create_constants.awk0000664000175000017500000000017114633027767021672 0ustar yavoryavor($0 !~ /^[\t ]*#.*$/) && ($0 !~ /^[\t ]*$/) && (NF == 2) { printf " ADD_%s_OBJECT(%s,@\"%s\");\n", $1, $2, $2 } StepTalk-0.10.0/Modules/SQLClient/SQLClientConstants.m0000664000175000017500000000530514633027767021504 0ustar yavoryavor/** SQLClientConstants.m NOTE: Do not edit this file, it is automaticaly generated. 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 #import #import #import #import NSDictionary *STGetSQLClientConstants(void) { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; Class numberClass = [NSNumber class]; IMP numberWithInteger; IMP numberWithFloat; IMP setObject_forKey; SEL numberWithInteger_sel = @selector(numberWithInteger:); SEL numberWithFloat_sel = @selector(numberWithFloat:); SEL setObject_forKey_sel = @selector(setObject:forKey:); numberWithInteger = [numberClass methodForSelector:numberWithInteger_sel]; numberWithFloat = [numberClass methodForSelector:numberWithFloat_sel]; setObject_forKey = [dict methodForSelector:setObject_forKey_sel]; #define ADD_id_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, obj, name) #define ADD_int_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithInteger(numberClass, numberWithInteger_sel, obj), \ name) #define ADD_float_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithFloat(numberClass, numberWithFloat_sel, obj), \ name) ADD_id_OBJECT(SQLException,@"SQLException"); ADD_id_OBJECT(SQLConnectionException,@"SQLConnectionException"); ADD_id_OBJECT(SQLEmptyException,@"SQLEmptyException"); ADD_id_OBJECT(SQLUniqueException,@"SQLUniqueException"); ADD_id_OBJECT(SQLClientDidConnectNotification,@"SQLClientDidConnectNotification"); ADD_id_OBJECT(SQLClientDidDisconnectNotification,@"SQLClientDidDisconnectNotification"); return dict; } /* -- End of file -- */ StepTalk-0.10.0/Modules/SQLClient/Functions.h0000664000175000017500000000256714633027767017763 0ustar yavoryavor/** Functions.m Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Nov 14 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 NSDictionary; @class NSString; #define _STCreateConstantsDictionaryForType(t, v, n, c) \ _ST_##t##_namesDictionary(v, n, c); #define function_header(type) \ NSDictionary *_ST_##type##_namesDictionary(type *vals, \ NSString **names, \ int count) function_header(int); function_header(float); function_header(id); StepTalk-0.10.0/Modules/SQLClient/header.m0000664000175000017500000000434214633027767017241 0ustar yavoryavor/** @@NAME@@.m NOTE: Do not edit this file, it is automaticaly generated. 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 #import #import #import #import NSDictionary *STGet@@NAME@@(void) { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; Class numberClass = [NSNumber class]; IMP numberWithInteger; IMP numberWithFloat; IMP setObject_forKey; SEL numberWithInteger_sel = @selector(numberWithInteger:); SEL numberWithFloat_sel = @selector(numberWithFloat:); SEL setObject_forKey_sel = @selector(setObject:forKey:); numberWithInteger = [numberClass methodForSelector:numberWithInteger_sel]; numberWithFloat = [numberClass methodForSelector:numberWithFloat_sel]; setObject_forKey = [dict methodForSelector:setObject_forKey_sel]; #define ADD_id_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, obj, name) #define ADD_int_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithInteger(numberClass, numberWithInteger_sel, obj), \ name) #define ADD_float_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithFloat(numberClass, numberWithFloat_sel, obj), \ name) StepTalk-0.10.0/Modules/SQLClient/Functions.m0000664000175000017500000000377514633027767017772 0ustar yavoryavor/** Functions.m Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Nov 14 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 #define function_template(type, class, selector) \ NSDictionary *_ST_##type##_namesDictionary(type *vals, \ NSString **names, \ int count) \ { \ NSMutableDictionary *dict = [NSMutableDictionary dictionary]; \ \ for(i = 0; i Date: 2001 May 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 @interface STSQLClientModule:NSObject { } @end StepTalk-0.10.0/Modules/SQLClient/SQLClient+additions.m0000664000175000017500000000246014633027767021560 0ustar yavoryavor/** SQLClient+additions.m File manager additions - GNUstep path functions Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2003 Jan 22 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 @implementation SQLClient(STAdditions) + (NSTimeInterval)timeLast { return SQLClientTimeLast(); } + (NSTimeInterval)timeNow { return SQLClientTimeNow(); } + (NSTimeInterval)timeStart { return SQLClientTimeStart(); } + (unsigned)timeTick { return SQLClientTimeTick(); } @end StepTalk-0.10.0/Modules/SQLClient/SQLClientConstants.list0000664000175000017500000000032314633027767022216 0ustar yavoryavor# SQLClient Exceptions id SQLException id SQLConnectionException id SQLEmptyException id SQLUniqueException # SQLClient Notifications id SQLClientDidConnectNotification id SQLClientDidDisconnectNotification StepTalk-0.10.0/Modules/ReadlineTranscript/0000775000175000017500000000000014633027767017627 5ustar yavoryavorStepTalk-0.10.0/Modules/ReadlineTranscript/ReadlineTranscript.h0000664000175000017500000000222214633027767023573 0ustar yavoryavor/** ReadlineTranscript.h StepTalk simple transcript Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Apr 13 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 ReadlineTranscript:NSObject + sharedTranscript; - show:(id)anObject; - showLine:(id)anObject; - (NSString*)readLine:(NSString*)prompt; @end StepTalk-0.10.0/Modules/ReadlineTranscript/ScriptingInfo.plist0000664000175000017500000000011614633027767023460 0ustar yavoryavor{ ScriptingInfoClass = ReadlineTranscriptModule; Classes = ( ); } StepTalk-0.10.0/Modules/ReadlineTranscript/GNUmakefile0000664000175000017500000000265014633027767021704 0ustar yavoryavor# # ReadlineTranscript module # # Copyright (C)2001 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 = ReadlineTranscript ReadlineTranscript_OBJC_FILES = \ ReadlineTranscriptModule.m \ ReadlineTranscript.m \ ReadlineTranscript_PRINCIPAL_CLASS = ReadlineTranscriptModule ReadlineTranscript_RESOURCE_FILES = ScriptingInfo.plist BUNDLE_INSTALL_DIR:=$(GNUSTEP_LIBRARY)/StepTalk/Modules ReadlineTranscript_BUNDLE_LIBS = -lStepTalk -lreadline ADDITIONAL_INCLUDE_DIRS += -I../../Frameworks/ ADDITIONAL_OBJCFLAGS = -Wall -Wno-import -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUMakefile.postamble StepTalk-0.10.0/Modules/ReadlineTranscript/.cvsignore0000664000175000017500000000010514633027767021623 0ustar yavoryavor*.app *.debug *.profile shared_*obj *.bundle *.stmodule *.stlanguage StepTalk-0.10.0/Modules/ReadlineTranscript/ReadlineTranscriptModule.h0000664000175000017500000000205014633027767024740 0ustar yavoryavor/** ReadlineTranscriptModule.h Transcript module Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 May 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 ReadlineTranscriptModule:NSObject @end StepTalk-0.10.0/Modules/ReadlineTranscript/ReadlineTranscriptModule.m0000664000175000017500000000251614633027767024754 0ustar yavoryavor/** ReadlineTranscriptModule.m Transcript module Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 May 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 "ReadlineTranscriptModule.h" #import "ReadlineTranscript.h" #import #import @implementation ReadlineTranscriptModule + (NSDictionary *)namedObjectsForScripting { return [NSDictionary dictionaryWithObject:[ReadlineTranscript sharedTranscript] forKey:@"Transcript"]; } @end StepTalk-0.10.0/Modules/ReadlineTranscript/ReadlineTranscript.m0000664000175000017500000000446514633027767023613 0ustar yavoryavor/** ReadlineTranscript.m StepTalk simple transcript Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Apr 13 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 "ReadlineTranscript.h" #import #import #include #include static Class NSString_class; static Class NSNumber_class; static ReadlineTranscript *sharedTranscript; @implementation ReadlineTranscript:NSObject + (void)initialize { NSString_class = [NSString class]; NSNumber_class = [NSNumber class]; } + sharedTranscript { if(!sharedTranscript) { sharedTranscript = [[ReadlineTranscript alloc] init]; } return sharedTranscript; } - show:(id)anObject { NSString *string; if( [anObject isKindOfClass:NSString_class] ) { string = anObject; } else if ( [anObject isKindOfClass:NSNumber_class] ) { string = [anObject stringValue]; } else { string = [anObject description]; } printf("%s", [string cString]); return self; } - showLine:(id)anObject { [self show:anObject]; putchar('\n'); return self; } -(NSString*)readLine:(NSString*)prompt { NSString *resret=nil; char *res; res = readline([prompt cString]); if (res) { resret = [[NSString alloc] initWithCStringNoCopy: res length: strlen(res) freeWhenDone: YES]; } return AUTORELEASE(resret); } @end StepTalk-0.10.0/Modules/ReadlineTranscript/test.st0000664000175000017500000000025714633027767021162 0ustar yavoryavorEnvironment loadModule:'ReadlineTranscript'. Transcript showLine: 'Readline test'. line := Transcript readLine:'Write something: '. Transcript showLine: line uppercaseString. StepTalk-0.10.0/Modules/SimpleTranscript/0000775000175000017500000000000014633027767017335 5ustar yavoryavorStepTalk-0.10.0/Modules/SimpleTranscript/SimpleTranscriptModule.m0000664000175000017500000000250414633027767024165 0ustar yavoryavor/** SimpleTranscriptModule.m Transcript module Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 May 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 "SimpleTranscriptModule.h" #import "SimpleTranscript.h" #import #import @implementation SimpleTranscriptModule + (NSDictionary *)namedObjectsForScripting { return [NSDictionary dictionaryWithObject:[SimpleTranscript sharedTranscript] forKey:@"Transcript"]; } @end StepTalk-0.10.0/Modules/SimpleTranscript/ScriptingInfo.plist0000664000175000017500000000011414633027767023164 0ustar yavoryavor{ ScriptingInfoClass = SimpleTranscriptModule; Classes = ( ); } StepTalk-0.10.0/Modules/SimpleTranscript/GNUmakefile0000664000175000017500000000275114633027767021414 0ustar yavoryavor# # SimpleTranscript module # # Copyright (C)2001 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 = SimpleTranscript SimpleTranscript_OBJC_FILES = \ SimpleTranscriptModule.m \ SimpleTranscript.m \ SimpleTranscript_PRINCIPAL_CLASS = SimpleTranscriptModule SimpleTranscript_RESOURCE_FILES = ScriptingInfo.plist BUNDLE_INSTALL_DIR:=$(GNUSTEP_LIBRARY)/StepTalk/Modules BUNDLE_LIBS += -lStepTalk ADDITIONAL_INCLUDE_DIRS += -I../../Frameworks/ ADDITIONAL_LIB_DIRS += -L../../Frameworks/StepTalk/StepTalk.framework/Versions/Current/$(GNUSTEP_TARGET_LDIR) ADDITIONAL_OBJCFLAGS = -Wall -Wno-import -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUMakefile.postamble StepTalk-0.10.0/Modules/SimpleTranscript/SimpleTranscript.h0000664000175000017500000000214514633027767023013 0ustar yavoryavor/** SimpleTranscript.h StepTalk simple transcript Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Apr 13 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 SimpleTranscript:NSObject + sharedTranscript; - show:(id)anObject; - showLine:(id)anObject; @end StepTalk-0.10.0/Modules/SimpleTranscript/.cvsignore0000664000175000017500000000010514633027767021331 0ustar yavoryavor*.app *.debug *.profile shared_*obj *.bundle *.stmodule *.stlanguage StepTalk-0.10.0/Modules/SimpleTranscript/SimpleTranscriptModule.h0000664000175000017500000000204414633027767024157 0ustar yavoryavor/** SimpleTranscriptModule.h Transcript module Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 May 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 SimpleTranscriptModule:NSObject @end StepTalk-0.10.0/Modules/SimpleTranscript/SimpleTranscript.m0000664000175000017500000000365614633027767023030 0ustar yavoryavor/** SimpleTranscript.m StepTalk simple transcript Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Apr 13 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 "SimpleTranscript.h" #import #import #include static Class NSString_class; static Class NSNumber_class; static SimpleTranscript *sharedTranscript; @implementation SimpleTranscript:NSObject + (void)initialize { NSString_class = [NSString class]; NSNumber_class = [NSNumber class]; } + sharedTranscript { if(!sharedTranscript) { sharedTranscript = [[SimpleTranscript alloc] init]; } return sharedTranscript; } - show:(id)anObject { NSString *string; if( [anObject isKindOfClass:NSString_class] ) { string = anObject; } else if ( [anObject isKindOfClass:NSNumber_class] ) { string = [anObject stringValue]; } else { string = [anObject description]; } printf("%s", [string cString]); return self; } - showLine:(id)anObject { [self show:anObject]; putchar('\n'); return self; } @end StepTalk-0.10.0/Modules/GNUmakefile0000664000175000017500000000255514633027767016113 0ustar yavoryavor# # Main Makefile for the StepTalk # # Copyright (C) 2000 Stefan Urbanek # # Written by: 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., 59 Temple Place, Suite 330, Boston, MA 02111 USA # include $(GNUSTEP_MAKEFILES)/common.make APPKIT=AppKit SQLCLIENT= WEBSERVICES= ifeq ($(appkit),no) APPKIT= endif ifeq ($(sqlclient),yes) SQLCLIENT=SQLClient endif ifeq ($(webservices),yes) WEBSERVICES=WebServices endif SUBPROJECTS = \ SimpleTranscript \ Foundation \ ObjectiveC \ GDL2 \ $(APPKIT) \ $(SQLCLIENT) \ $(WEBSERVICES) -include GNUMakefile.preamble include $(GNUSTEP_MAKEFILES)/aggregate.make -include GNUMakefile.postamble StepTalk-0.10.0/Modules/ObjectiveC/0000775000175000017500000000000014633027767016047 5ustar yavoryavorStepTalk-0.10.0/Modules/ObjectiveC/NSObject+additions.m0000664000175000017500000000507014633027767021650 0ustar yavoryavor/** NSObject+additions Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2002 Jun 14 This file is part of the StepTalk project. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02111, USA. */ #import "NSObject+additions.h" #import #import static NSArray *methods_for_class(Class class) { NSMutableArray *array = [NSMutableArray array]; Method *methods; SEL sel; unsigned int i, numMethods; if(!class) return nil; methods = class_copyMethodList(class, &numMethods); if(methods) { for(i = 0; i < numMethods; i++) { sel = method_getName(methods[i]); [array addObject:NSStringFromSelector(sel)]; } free(methods); } return [NSArray arrayWithArray:array]; } static NSArray *ivars_for_class(Class class) { NSMutableArray *array; Ivar* ivars; const char *cname; unsigned int i, numIvars; if(!class) return nil; array = [NSMutableArray array]; ivars = class_copyIvarList(class, &numIvars); if(ivars) { for(i = 0; i < numIvars ; i++) { cname = ivar_getName(ivars[i]); [array addObject:[NSString stringWithCString:cname]]; } } free(ivars); return [NSArray arrayWithArray:array]; } @implementation NSObject(ObjectiveCRuntime) + (NSArray *)instanceMethodNames { return methods_for_class(self); } - (NSArray *)methodNames { return [[[self class] instanceMethodNames] sortedArrayUsingSelector:@selector(compare:)]; } + (NSArray *)methodNames { return methods_for_class(object_getClass(self)); } + (NSArray *)instanceVariableNames { return ivars_for_class(self); } @end StepTalk-0.10.0/Modules/ObjectiveC/ScriptingInfo.plist0000664000175000017500000000014014633027767021675 0ustar yavoryavor{ ScriptingInfoClass = ObjectiveCModule; Classes = ( ObjectiveCRuntime ); } StepTalk-0.10.0/Modules/ObjectiveC/GNUmakefile0000664000175000017500000000302114633027767020115 0ustar yavoryavor# # ObjectiveC module # # Copyright (C)2002 Stefan Urbanek # # Written by: Stefan Urbanek # Date: 2002 Jun 14 # # 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 = ObjectiveC ObjectiveC_OBJC_FILES = \ ObjectiveCModule.m \ ObjectiveCRuntime.m \ NSObject+additions.m ObjectiveC_PRINCIPAL_CLASS = ObjectiveCModule ObjectiveC_RESOURCE_FILES = ScriptingInfo.plist BUNDLE_LIBS += -lStepTalk ADDITIONAL_INCLUDE_DIRS += -I../../Frameworks/ ADDITIONAL_LIB_DIRS += -L../../Frameworks/StepTalk/StepTalk.framework/Versions/Current/$(GNUSTEP_TARGET_LDIR) BUNDLE_INSTALL_DIR:=$(GNUSTEP_LIBRARY)/StepTalk/Modules ADDITIONAL_OBJCFLAGS = -Wall -Wno-import -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUMakefile.postamble StepTalk-0.10.0/Modules/ObjectiveC/.cvsignore0000664000175000017500000000010514633027767020043 0ustar yavoryavor*.app *.debug *.profile shared_*obj *.bundle *.stmodule *.stlanguage StepTalk-0.10.0/Modules/ObjectiveC/ObjectiveCModule.m0000664000175000017500000000240714633027767021413 0ustar yavoryavor/** ObjectiveCModule.m Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2002 Jun 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 "ObjectiveCModule.h" #import "ObjectiveCRuntime.h" #import #import @implementation ObjectiveCModule + (NSDictionary *)namedObjectsForScripting { return [NSDictionary dictionaryWithObject:[ObjectiveCRuntime sharedRuntime] forKey:@"Runtime"]; } @end StepTalk-0.10.0/Modules/ObjectiveC/ObjectiveCRuntime.h0000664000175000017500000000200414633027767021575 0ustar yavoryavor/** ObjectiveCRuntime.m Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2002 Jun 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 ObjectiveCRuntime:NSObject + sharedRuntime; @end StepTalk-0.10.0/Modules/ObjectiveC/NSObject+additions.h0000664000175000017500000000215314633027767021642 0ustar yavoryavor/** NSObject+additions Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2002 Jun 14 This file is part of the StepTalk project. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02111, USA. */ #import @class NSArray; @interface NSObject(ObjectiveCRuntime) - (NSArray *)methodNames; + (NSArray *)methodNames; + (NSArray *)instanceMethodNames; + (NSArray *)instanceVariableNames; @end StepTalk-0.10.0/Modules/ObjectiveC/ObjectiveCRuntime.m0000664000175000017500000000665514633027767021622 0ustar yavoryavor/** ObjectiveCRuntime.m Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2002 Jun 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 "ObjectiveCRuntime.h" #import "NSObject+additions.h" #import #import #import #import #import #import static ObjectiveCRuntime *sharedRuntime=nil; @implementation ObjectiveCRuntime + sharedRuntime { if(!sharedRuntime) { sharedRuntime = [[ObjectiveCRuntime alloc] init]; } return sharedRuntime; } - (NSArray *)allClasses { int i, numClasses; NSMutableArray *array; Class *classes; array = [NSMutableArray array]; numClasses = objc_getClassList(NULL, 0); classes = (Class *)NSZoneMalloc(NULL, numClasses * sizeof(Class)); numClasses = objc_getClassList(classes, numClasses); for(i = 0; i < numClasses; i++) { [array addObject:classes[i]]; } NSZoneFree(NULL, classes); return [NSArray arrayWithArray:array]; } - (Class )classWithName:(NSString *)string { return NSClassFromString(string); } - (NSString *)nameOfClass:(Class)class { return NSStringFromClass(class); } - (NSArray *)selectorsContainingString:(NSString *)string { NSMutableArray *sels = [NSMutableArray array]; NSEnumerator *enumerator; NSArray *array = STAllObjectiveCSelectors(); NSString *sel; NSRange range; enumerator = [array objectEnumerator]; while( (sel = [enumerator nextObject]) ) { range = [sel rangeOfString:string]; if(range.location != NSNotFound) { [sels addObject:sel]; } } return [NSArray arrayWithArray:sels]; } - (NSArray *)implementorsOfSelector:(id)selector { NSMutableArray *array = [NSMutableArray array]; NSEnumerator *enumerator; NSDictionary *classes = STAllObjectiveCClasses(); NSString *className; NSArray *methods; Class class; enumerator = [classes keyEnumerator]; if([selector isKindOfClass:[STSelector class]]) { selector = [selector stringValue]; } while( (className = [enumerator nextObject]) ) { class = [classes objectForKey:className]; if([class respondsToSelector:@selector(instanceMethodNames)]) { methods = [class instanceMethodNames]; if([methods containsObject:selector]) { [array addObject:className]; } } } return [NSArray arrayWithArray:array]; } @end StepTalk-0.10.0/Modules/ObjectiveC/ObjectiveCModule.h0000664000175000017500000000176114633027767021410 0ustar yavoryavor/** ObjectiveCModule.h Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2002 Jun 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 ObjectiveCModule:NSObject @end StepTalk-0.10.0/Modules/AppKit/0000775000175000017500000000000014633027767015222 5ustar yavoryavorStepTalk-0.10.0/Modules/AppKit/AppKitNotifications.list0000664000175000017500000000474714633027767022055 0ustar yavoryavor# AppKit Notifications id NSColorListDidChangeNotification id NSColorPanelColorDidChangeNotification # id NSComboBoxWillPopUpNotification # id NSComboBoxWillDismissNotification # id NSComboBoxSelectionDidChangeNotification # id NSComboBoxSelectionIsChangingNotification id NSControlTextDidBeginEditingNotification id NSControlTextDidEndEditingNotification id NSControlTextDidChangeNotification id NSDrawerDidCloseNotification id NSDrawerDidOpenNotification id NSDrawerWillCloseNotification id NSDrawerWillOpenNotification id NSImageRepRegistryChangedNotification ################################################## # FIXME: Undefined symbols # # id NSOutlineViewColumnDidMoveNotification # id NSOutlineViewColumnDidResizeNotification # id NSOutlineViewSelectionDidChangeNotification # id NSOutlineViewSelectionIsChangingNotification # id NSOutlineViewItemDidExpandNotification # id NSOutlineViewItemDidCollapseNotification # ################################################## id NSPopUpButtonWillPopUpNotification id NSSplitViewDidResizeSubviewsNotification id NSSplitViewWillResizeSubviewsNotification id NSTableViewColumnDidMoveNotification id NSTableViewColumnDidResizeNotification id NSTableViewSelectionDidChangeNotification id NSTableViewSelectionIsChangingNotification id NSTextDidBeginEditingNotification id NSTextDidEndEditingNotification id NSTextDidChangeNotification id NSTextStorageWillProcessEditingNotification id NSTextStorageDidProcessEditingNotification id NSTextViewWillChangeNotifyingTextViewNotification id NSTextViewDidChangeSelectionNotification id NSViewFrameDidChangeNotification id NSViewBoundsDidChangeNotification id NSViewFocusDidChangeNotification id NSWindowDidBecomeKeyNotification id NSWindowDidBecomeMainNotification id NSWindowDidChangeScreenNotification id NSWindowDidDeminiaturizeNotification id NSWindowDidExposeNotification id NSWindowDidMiniaturizeNotification id NSWindowDidMoveNotification id NSWindowDidResignKeyNotification id NSWindowDidResignMainNotification id NSWindowDidResizeNotification id NSWindowDidUpdateNotification id NSWindowWillCloseNotification id NSWindowWillMiniaturizeNotification id NSWindowWillMoveNotification id NSWorkspaceDidLaunchApplicationNotification id NSWorkspaceDidMountNotification id NSWorkspaceDidPerformFileOperationNotification id NSWorkspaceDidTerminateApplicationNotification id NSWorkspaceDidUnmountNotification id NSWorkspaceWillLaunchApplicationNotification id NSWorkspaceWillPowerOffNotification id NSWorkspaceWillUnmountNotification StepTalk-0.10.0/Modules/AppKit/ScriptingInfo.plist0000664000175000017500000000602014633027767021053 0ustar yavoryavor{ ScriptingInfoClass = STAppKitModule; Classes = ( NSActionCell, NSAffineTransform, NSApplication, NSAttributedString, NSBezierPath, NSBitmapImageRep, NSBox, NSBrowser, NSBrowserCell, NSBundle, NSButton, NSButtonCell, NSCachedImageRep, NSCell, NSClipView, NSCoder, NSColor, NSColorList, NSColorPanel, NSColorPicker, NSColorWell, NSComboBox, NSComboBoxCell, NSControl, NSCursor, NSCustomImageRep, NSDataLink, NSDataLinkManager, NSDataLinkPanel, NSDocument, NSDocumentController, NSDrawer, NSEPSImageRep, NSEvent, NSFileWrapper, NSFont, NSFontManager, NSFontPanel, NSForm, NSFormCell, NSGraphicsContext, NSHelpManager, NSHelpPanel, NSImage, NSImageCell, NSImageRep, NSImageView, NSInputManager, NSInputServer, NSLayoutManager, NSMatrix, NSMenu, NSMenuItem, NSMenuItemCell, NSMenuView, NSMutableAttributedString, NSMutableParagraphStyle, NSNib, NSNibConnector, NSNibControlConnector, NSNibOutletConnector, NSOpenPanel, NSOutlineView, NSPageLayout, NSPanel, NSParagraphStyle, NSPasteboard, NSPopUpButton, NSPopUpButtonCell, NSPrintInfo, NSPrintOperation, NSPrintPanel, NSPrinter, NSProgressIndicator, NSResponder, NSRulerMarker, NSRulerView, NSSavePanel, NSScreen, NSScrollView, NSScroller, NSSecureTextField, NSSecureTextFieldCell, NSSelection, /* NSSimpleHorizontalTypesetter,*/ NSSlider, NSSliderCell, NSSound, NSSpellChecker, NSSpellServer, NSSplitView, NSStepper, NSStepperCell, NSString, NSTabView, NSTabViewItem, NSTableColumn, NSTableHeaderCell, NSTableHeaderView, NSTableView, NSText, NSTextAttachment, NSTextAttachmentCell, NSTextContainer, NSTextField, NSTextFieldCell, NSTextStorage, NSTextTab, NSTextView, /* NSTypesetter,*/ NSView, NSWindow, NSWindowController, NSWorkspace /* GMArchiver, GMModel, GMUnarchiver, GSCustomView, GSFontEnumerator, GSFontInfo, GSHbox, GSHelpManagerPanel, GSInfoPanel, GSNibContainer, GSNibItem, GSServicesManager, GSTable, GSTrackingRect, GSVbox, IMConnector, IMControlConnector, IMCustomObject, IMCustomView, IMOutletConnector, */ ); } StepTalk-0.10.0/Modules/AppKit/GNUmakefile0000664000175000017500000000401214633027767017271 0ustar yavoryavor# # StepTalk tools # # Copyright (C) 2000,2001 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 include $(GNUSTEP_MAKEFILES)/Additional/gui.make BUNDLE_NAME = AppKit AppKit_OBJC_FILES = \ STAppKitModule.m \ AppKitConstants.m \ AppKitEvents.m \ AppKitExceptions.m \ AppKitNotifications.m \ NSApplication+additions.m AppKit_PRINCIPAL_CLASS = STAppKitModule AppKit_RESOURCE_FILES = ScriptingInfo.plist AppKit_BUNDLE_LIBS += $(GUI_LIBS) BUNDLE_INSTALL_DIR:=$(GNUSTEP_LIBRARY)/StepTalk/Modules ADDITIONAL_OBJCFLAGS = -Wall -Wno-import BUNDLE_LIBS += -lStepTalk ADDITIONAL_INCLUDE_DIRS += -I../../Frameworks/ ADDITIONAL_LIB_DIRS += -L../../Frameworks/StepTalk/StepTalk.framework/Versions/Current/$(GNUSTEP_TARGET_LDIR) -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUMakefile.postamble AppKitConstants.m : AppKitConstants.list AppKitEvents.m : AppKitEvents.list AppKitExceptions.m : AppKitExceptions.list AppKitNotifications.m : AppKitNotifications.list %.m : %.list header.m footer.m @( echo Creating $@ ...; \ cat header.m | sed "s/@@NAME@@/`basename $< .list`/g" > $@; \ cat $< | awk -f create_constants.awk >> $@;\ cat footer.m >> $@; ) StepTalk-0.10.0/Modules/AppKit/footer.m0000664000175000017500000000005514633027767016676 0ustar yavoryavor return dict; } /* -- End of file -- */ StepTalk-0.10.0/Modules/AppKit/STAppKitModule.h0000664000175000017500000000202614633027767020200 0ustar yavoryavor/** STAppKitModule.h AppKit bindings Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 May 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 @interface STAppKitModule:NSObject { } @end StepTalk-0.10.0/Modules/AppKit/create_constants.awk0000664000175000017500000000017114633027767021264 0ustar yavoryavor($0 !~ /^[\t ]*#.*$/) && ($0 !~ /^[\t ]*$/) && (NF == 2) { printf " ADD_%s_OBJECT(%s,@\"%s\");\n", $1, $2, $2 } StepTalk-0.10.0/Modules/AppKit/AppKitEvents.m0000664000175000017500000002504414633027767017762 0ustar yavoryavor/** AppKitEvents.m NOTE: Do not edit this file, it is automaticaly generated. 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 #import #import #import #import #import #import NSDictionary *STGetAppKitEvents(void) { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; Class numberClass = [NSNumber class]; IMP numberWithInteger; IMP numberWithFloat; IMP setObject_forKey; SEL numberWithInteger_sel = @selector(numberWithInteger:); SEL numberWithFloat_sel = @selector(numberWithFloat:); SEL setObject_forKey_sel = @selector(setObject:forKey:); numberWithInteger = [numberClass methodForSelector:numberWithInteger_sel]; numberWithFloat = [numberClass methodForSelector:numberWithFloat_sel]; setObject_forKey = [dict methodForSelector:setObject_forKey_sel]; #define ADD_id_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, obj, name) #define ADD_NSInteger_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithInteger(numberClass, numberWithInteger_sel, obj), \ name) #define ADD_float_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithFloat(numberClass, numberWithFloat_sel, obj), \ name) ADD_NSInteger_OBJECT(NSLeftMouseDown,@"NSLeftMouseDown"); ADD_NSInteger_OBJECT(NSLeftMouseUp,@"NSLeftMouseUp"); ADD_NSInteger_OBJECT(NSOtherMouseDown,@"NSOtherMouseDown"); ADD_NSInteger_OBJECT(NSOtherMouseUp,@"NSOtherMouseUp"); ADD_NSInteger_OBJECT(NSRightMouseDown,@"NSRightMouseDown"); ADD_NSInteger_OBJECT(NSRightMouseUp,@"NSRightMouseUp"); ADD_NSInteger_OBJECT(NSMouseMoved,@"NSMouseMoved"); ADD_NSInteger_OBJECT(NSLeftMouseDragged,@"NSLeftMouseDragged"); ADD_NSInteger_OBJECT(NSOtherMouseDragged,@"NSOtherMouseDragged"); ADD_NSInteger_OBJECT(NSRightMouseDragged,@"NSRightMouseDragged"); ADD_NSInteger_OBJECT(NSMouseEntered,@"NSMouseEntered"); ADD_NSInteger_OBJECT(NSMouseExited,@"NSMouseExited"); ADD_NSInteger_OBJECT(NSKeyDown,@"NSKeyDown"); ADD_NSInteger_OBJECT(NSKeyUp,@"NSKeyUp"); ADD_NSInteger_OBJECT(NSFlagsChanged,@"NSFlagsChanged"); ADD_NSInteger_OBJECT(NSAppKitDefined,@"NSAppKitDefined"); ADD_NSInteger_OBJECT(NSSystemDefined,@"NSSystemDefined"); ADD_NSInteger_OBJECT(NSApplicationDefined,@"NSApplicationDefined"); ADD_NSInteger_OBJECT(NSPeriodic,@"NSPeriodic"); ADD_NSInteger_OBJECT(NSCursorUpdate,@"NSCursorUpdate"); ADD_NSInteger_OBJECT(NSScrollWheel,@"NSScrollWheel"); ADD_NSInteger_OBJECT(NSBackspaceKey,@"NSBackspaceKey"); ADD_NSInteger_OBJECT(NSCarriageReturnKey,@"NSCarriageReturnKey"); ADD_NSInteger_OBJECT(NSDeleteKey,@"NSDeleteKey"); ADD_NSInteger_OBJECT(NSBacktabKey,@"NSBacktabKey"); ADD_NSInteger_OBJECT(NSUpArrowFunctionKey,@"NSUpArrowFunctionKey"); ADD_NSInteger_OBJECT(NSDownArrowFunctionKey,@"NSDownArrowFunctionKey"); ADD_NSInteger_OBJECT(NSLeftArrowFunctionKey,@"NSLeftArrowFunctionKey"); ADD_NSInteger_OBJECT(NSRightArrowFunctionKey,@"NSRightArrowFunctionKey"); ADD_NSInteger_OBJECT(NSF1FunctionKey,@"NSF1FunctionKey"); ADD_NSInteger_OBJECT(NSF2FunctionKey,@"NSF2FunctionKey"); ADD_NSInteger_OBJECT(NSF3FunctionKey,@"NSF3FunctionKey"); ADD_NSInteger_OBJECT(NSF4FunctionKey,@"NSF4FunctionKey"); ADD_NSInteger_OBJECT(NSF5FunctionKey,@"NSF5FunctionKey"); ADD_NSInteger_OBJECT(NSF6FunctionKey,@"NSF6FunctionKey"); ADD_NSInteger_OBJECT(NSF7FunctionKey,@"NSF7FunctionKey"); ADD_NSInteger_OBJECT(NSF8FunctionKey,@"NSF8FunctionKey"); ADD_NSInteger_OBJECT(NSF9FunctionKey,@"NSF9FunctionKey"); ADD_NSInteger_OBJECT(NSF10FunctionKey,@"NSF10FunctionKey"); ADD_NSInteger_OBJECT(NSF11FunctionKey,@"NSF11FunctionKey"); ADD_NSInteger_OBJECT(NSF12FunctionKey,@"NSF12FunctionKey"); ADD_NSInteger_OBJECT(NSF13FunctionKey,@"NSF13FunctionKey"); ADD_NSInteger_OBJECT(NSF14FunctionKey,@"NSF14FunctionKey"); ADD_NSInteger_OBJECT(NSF15FunctionKey,@"NSF15FunctionKey"); ADD_NSInteger_OBJECT(NSF16FunctionKey,@"NSF16FunctionKey"); ADD_NSInteger_OBJECT(NSF17FunctionKey,@"NSF17FunctionKey"); ADD_NSInteger_OBJECT(NSF18FunctionKey,@"NSF18FunctionKey"); ADD_NSInteger_OBJECT(NSF19FunctionKey,@"NSF19FunctionKey"); ADD_NSInteger_OBJECT(NSF20FunctionKey,@"NSF20FunctionKey"); ADD_NSInteger_OBJECT(NSF21FunctionKey,@"NSF21FunctionKey"); ADD_NSInteger_OBJECT(NSF22FunctionKey,@"NSF22FunctionKey"); ADD_NSInteger_OBJECT(NSF23FunctionKey,@"NSF23FunctionKey"); ADD_NSInteger_OBJECT(NSF24FunctionKey,@"NSF24FunctionKey"); ADD_NSInteger_OBJECT(NSF25FunctionKey,@"NSF25FunctionKey"); ADD_NSInteger_OBJECT(NSF26FunctionKey,@"NSF26FunctionKey"); ADD_NSInteger_OBJECT(NSF27FunctionKey,@"NSF27FunctionKey"); ADD_NSInteger_OBJECT(NSF28FunctionKey,@"NSF28FunctionKey"); ADD_NSInteger_OBJECT(NSF29FunctionKey,@"NSF29FunctionKey"); ADD_NSInteger_OBJECT(NSF30FunctionKey,@"NSF30FunctionKey"); ADD_NSInteger_OBJECT(NSF31FunctionKey,@"NSF31FunctionKey"); ADD_NSInteger_OBJECT(NSF32FunctionKey,@"NSF32FunctionKey"); ADD_NSInteger_OBJECT(NSF33FunctionKey,@"NSF33FunctionKey"); ADD_NSInteger_OBJECT(NSF34FunctionKey,@"NSF34FunctionKey"); ADD_NSInteger_OBJECT(NSF35FunctionKey,@"NSF35FunctionKey"); ADD_NSInteger_OBJECT(NSInsertFunctionKey,@"NSInsertFunctionKey"); ADD_NSInteger_OBJECT(NSDeleteFunctionKey,@"NSDeleteFunctionKey"); ADD_NSInteger_OBJECT(NSHomeFunctionKey,@"NSHomeFunctionKey"); ADD_NSInteger_OBJECT(NSBeginFunctionKey,@"NSBeginFunctionKey"); ADD_NSInteger_OBJECT(NSEndFunctionKey,@"NSEndFunctionKey"); ADD_NSInteger_OBJECT(NSPageUpFunctionKey,@"NSPageUpFunctionKey"); ADD_NSInteger_OBJECT(NSPageDownFunctionKey,@"NSPageDownFunctionKey"); ADD_NSInteger_OBJECT(NSPrintScreenFunctionKey,@"NSPrintScreenFunctionKey"); ADD_NSInteger_OBJECT(NSScrollLockFunctionKey,@"NSScrollLockFunctionKey"); ADD_NSInteger_OBJECT(NSPauseFunctionKey,@"NSPauseFunctionKey"); ADD_NSInteger_OBJECT(NSSysReqFunctionKey,@"NSSysReqFunctionKey"); ADD_NSInteger_OBJECT(NSBreakFunctionKey,@"NSBreakFunctionKey"); ADD_NSInteger_OBJECT(NSResetFunctionKey,@"NSResetFunctionKey"); ADD_NSInteger_OBJECT(NSStopFunctionKey,@"NSStopFunctionKey"); ADD_NSInteger_OBJECT(NSMenuFunctionKey,@"NSMenuFunctionKey"); ADD_NSInteger_OBJECT(NSUserFunctionKey,@"NSUserFunctionKey"); ADD_NSInteger_OBJECT(NSSystemFunctionKey,@"NSSystemFunctionKey"); ADD_NSInteger_OBJECT(NSPrintFunctionKey,@"NSPrintFunctionKey"); ADD_NSInteger_OBJECT(NSClearLineFunctionKey,@"NSClearLineFunctionKey"); ADD_NSInteger_OBJECT(NSClearDisplayFunctionKey,@"NSClearDisplayFunctionKey"); ADD_NSInteger_OBJECT(NSInsertLineFunctionKey,@"NSInsertLineFunctionKey"); ADD_NSInteger_OBJECT(NSDeleteLineFunctionKey,@"NSDeleteLineFunctionKey"); ADD_NSInteger_OBJECT(NSInsertCharFunctionKey,@"NSInsertCharFunctionKey"); ADD_NSInteger_OBJECT(NSDeleteCharFunctionKey,@"NSDeleteCharFunctionKey"); ADD_NSInteger_OBJECT(NSPrevFunctionKey,@"NSPrevFunctionKey"); ADD_NSInteger_OBJECT(NSNextFunctionKey,@"NSNextFunctionKey"); ADD_NSInteger_OBJECT(NSSelectFunctionKey,@"NSSelectFunctionKey"); ADD_NSInteger_OBJECT(NSExecuteFunctionKey,@"NSExecuteFunctionKey"); ADD_NSInteger_OBJECT(NSUndoFunctionKey,@"NSUndoFunctionKey"); ADD_NSInteger_OBJECT(NSRedoFunctionKey,@"NSRedoFunctionKey"); ADD_NSInteger_OBJECT(NSFindFunctionKey,@"NSFindFunctionKey"); ADD_NSInteger_OBJECT(NSHelpFunctionKey,@"NSHelpFunctionKey"); ADD_NSInteger_OBJECT(NSModeSwitchFunctionKey,@"NSModeSwitchFunctionKey"); ADD_NSInteger_OBJECT(NSLeftMouseDownMask,@"NSLeftMouseDownMask"); ADD_NSInteger_OBJECT(NSLeftMouseUpMask,@"NSLeftMouseUpMask"); ADD_NSInteger_OBJECT(NSOtherMouseDownMask,@"NSOtherMouseDownMask"); ADD_NSInteger_OBJECT(NSOtherMouseUpMask,@"NSOtherMouseUpMask"); ADD_NSInteger_OBJECT(NSRightMouseDownMask,@"NSRightMouseDownMask"); ADD_NSInteger_OBJECT(NSRightMouseUpMask,@"NSRightMouseUpMask"); ADD_NSInteger_OBJECT(NSMouseMovedMask,@"NSMouseMovedMask"); ADD_NSInteger_OBJECT(NSLeftMouseDraggedMask,@"NSLeftMouseDraggedMask"); ADD_NSInteger_OBJECT(NSOtherMouseDraggedMask,@"NSOtherMouseDraggedMask"); ADD_NSInteger_OBJECT(NSRightMouseDraggedMask,@"NSRightMouseDraggedMask"); ADD_NSInteger_OBJECT(NSMouseEnteredMask,@"NSMouseEnteredMask"); ADD_NSInteger_OBJECT(NSMouseExitedMask,@"NSMouseExitedMask"); ADD_NSInteger_OBJECT(NSFlagsChangedMask,@"NSFlagsChangedMask"); ADD_NSInteger_OBJECT(NSAppKitDefinedMask,@"NSAppKitDefinedMask"); ADD_NSInteger_OBJECT(NSSystemDefinedMask,@"NSSystemDefinedMask"); ADD_NSInteger_OBJECT(NSApplicationDefinedMask,@"NSApplicationDefinedMask"); ADD_NSInteger_OBJECT(NSPeriodicMask,@"NSPeriodicMask"); ADD_NSInteger_OBJECT(NSCursorUpdateMask,@"NSCursorUpdateMask"); ADD_NSInteger_OBJECT(NSScrollWheelMask,@"NSScrollWheelMask"); ADD_NSInteger_OBJECT(NSAnyEventMask,@"NSAnyEventMask"); ADD_NSInteger_OBJECT(NSAlphaShiftKeyMask,@"NSAlphaShiftKeyMask"); ADD_NSInteger_OBJECT(NSAlternateKeyMask,@"NSAlternateKeyMask"); ADD_NSInteger_OBJECT(NSCommandKeyMask,@"NSCommandKeyMask"); ADD_NSInteger_OBJECT(NSControlKeyMask,@"NSControlKeyMask"); ADD_NSInteger_OBJECT(NSFunctionKeyMask,@"NSFunctionKeyMask"); ADD_NSInteger_OBJECT(NSHelpKeyMask,@"NSHelpKeyMask"); ADD_NSInteger_OBJECT(NSKeyDownMask,@"NSKeyDownMask"); ADD_NSInteger_OBJECT(NSKeyUpMask,@"NSKeyUpMask"); ADD_NSInteger_OBJECT(NSNumericPadKeyMask,@"NSNumericPadKeyMask"); ADD_NSInteger_OBJECT(NSShiftKeyMask,@"NSShiftKeyMask"); return dict; } /* -- End of file -- */ StepTalk-0.10.0/Modules/AppKit/NSApplication+additions.h0000664000175000017500000000357214633027767022060 0ustar yavoryavor/** NSApplication additions Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Nov 15 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 NSApplication(STAdditions) - (int)runAlertPanelWithTitle:(NSString *)title message:(NSString *)message defaultButton:(NSString *)defaultButton alternateButton:(NSString *)alternateButton otherButton:(NSString *)otherButton; - (int)runCriticalAlertPanelWithTitle:(NSString *)title message:(NSString *)message defaultButton:(NSString *)defaultButton alternateButton:(NSString *)alternateButton otherButton:(NSString *)otherButton; - (int)runInformationalAlertPanelWithTitle:(NSString *)title message:(NSString *)message defaultButton:(NSString *)defaultButton alternateButton:(NSString *)alternateButton otherButton:(NSString *)otherButton; @end StepTalk-0.10.0/Modules/AppKit/.cvsignore0000664000175000017500000000010514633027767017216 0ustar yavoryavor*.app *.debug *.profile shared_*obj *.bundle *.stmodule *.stlanguage StepTalk-0.10.0/Modules/AppKit/Functions.h0000664000175000017500000000256714633027767017355 0ustar yavoryavor/** Functions.m Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Nov 14 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 NSDictionary; @class NSString; #define _STCreateConstantsDictionaryForType(t, v, n, c) \ _ST_##t##_namesDictionary(v, n, c); #define function_header(type) \ NSDictionary *_ST_##type##_namesDictionary(type *vals, \ NSString **names, \ int count) function_header(int); function_header(float); function_header(id); StepTalk-0.10.0/Modules/AppKit/header.m0000664000175000017500000000444714633027767016641 0ustar yavoryavor/** @@NAME@@.m NOTE: Do not edit this file, it is automaticaly generated. 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 #import #import #import #import #import #import NSDictionary *STGet@@NAME@@(void) { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; Class numberClass = [NSNumber class]; IMP numberWithInteger; IMP numberWithFloat; IMP setObject_forKey; SEL numberWithInteger_sel = @selector(numberWithInteger:); SEL numberWithFloat_sel = @selector(numberWithFloat:); SEL setObject_forKey_sel = @selector(setObject:forKey:); numberWithInteger = [numberClass methodForSelector:numberWithInteger_sel]; numberWithFloat = [numberClass methodForSelector:numberWithFloat_sel]; setObject_forKey = [dict methodForSelector:setObject_forKey_sel]; #define ADD_id_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, obj, name) #define ADD_NSInteger_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithInteger(numberClass, numberWithInteger_sel, obj), \ name) #define ADD_float_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithFloat(numberClass, numberWithFloat_sel, obj), \ name) StepTalk-0.10.0/Modules/AppKit/Functions.m0000664000175000017500000000377514633027767017364 0ustar yavoryavor/** Functions.m Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Nov 14 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 #define function_template(type, class, selector) \ NSDictionary *_ST_##type##_namesDictionary(type *vals, \ NSString **names, \ int count) \ { \ NSMutableDictionary *dict = [NSMutableDictionary dictionary]; \ \ for(i = 0; i #import #import #import #import #import #import NSDictionary *STGetAppKitExceptions(void) { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; Class numberClass = [NSNumber class]; IMP numberWithInteger; IMP numberWithFloat; IMP setObject_forKey; SEL numberWithInteger_sel = @selector(numberWithInteger:); SEL numberWithFloat_sel = @selector(numberWithFloat:); SEL setObject_forKey_sel = @selector(setObject:forKey:); numberWithInteger = [numberClass methodForSelector:numberWithInteger_sel]; numberWithFloat = [numberClass methodForSelector:numberWithFloat_sel]; setObject_forKey = [dict methodForSelector:setObject_forKey_sel]; #define ADD_id_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, obj, name) #define ADD_NSInteger_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithInteger(numberClass, numberWithInteger_sel, obj), \ name) #define ADD_float_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithFloat(numberClass, numberWithFloat_sel, obj), \ name) ADD_id_OBJECT(NSAbortModalException,@"NSAbortModalException"); ADD_id_OBJECT(NSAbortPrintingException,@"NSAbortPrintingException"); ADD_id_OBJECT(NSAppKitIgnoredException,@"NSAppKitIgnoredException"); ADD_id_OBJECT(NSAppKitVirtualMemoryException,@"NSAppKitVirtualMemoryException"); ADD_id_OBJECT(NSBadBitmapParametersException,@"NSBadBitmapParametersException"); ADD_id_OBJECT(NSBadComparisonException,@"NSBadComparisonException"); ADD_id_OBJECT(NSBadRTFColorTableException,@"NSBadRTFColorTableException"); ADD_id_OBJECT(NSBadRTFDirectiveException,@"NSBadRTFDirectiveException"); ADD_id_OBJECT(NSBadRTFFontTableException,@"NSBadRTFFontTableException"); ADD_id_OBJECT(NSBadRTFStyleSheetException,@"NSBadRTFStyleSheetException"); ADD_id_OBJECT(NSBrowserIllegalDelegateException,@"NSBrowserIllegalDelegateException"); ADD_id_OBJECT(NSColorListIOException,@"NSColorListIOException"); ADD_id_OBJECT(NSColorListNotEditableException,@"NSColorListNotEditableException"); ADD_id_OBJECT(NSDraggingException,@"NSDraggingException"); ADD_id_OBJECT(NSFontUnavailableException,@"NSFontUnavailableException"); ADD_id_OBJECT(NSIllegalSelectorException,@"NSIllegalSelectorException"); ADD_id_OBJECT(NSImageCacheException,@"NSImageCacheException"); ADD_id_OBJECT(NSNibLoadingException,@"NSNibLoadingException"); ADD_id_OBJECT(NSPPDIncludeNotFoundException,@"NSPPDIncludeNotFoundException"); ADD_id_OBJECT(NSPPDIncludeStackOverflowException,@"NSPPDIncludeStackOverflowException"); ADD_id_OBJECT(NSPPDIncludeStackUnderflowException,@"NSPPDIncludeStackUnderflowException"); ADD_id_OBJECT(NSPPDParseException,@"NSPPDParseException"); ADD_id_OBJECT(NSPasteboardCommunicationException,@"NSPasteboardCommunicationException"); ADD_id_OBJECT(NSPrintOperationExistsException,@"NSPrintOperationExistsException"); ADD_id_OBJECT(NSPrintPackageException,@"NSPrintPackageException"); ADD_id_OBJECT(NSPrintingCommunicationException,@"NSPrintingCommunicationException"); ADD_id_OBJECT(NSRTFPropertyStackOverflowException,@"NSRTFPropertyStackOverflowException"); ADD_id_OBJECT(NSTIFFException,@"NSTIFFException"); ADD_id_OBJECT(NSTextLineTooLongException,@"NSTextLineTooLongException"); ADD_id_OBJECT(NSTextNoSelectionException,@"NSTextNoSelectionException"); ADD_id_OBJECT(NSTextReadException,@"NSTextReadException"); ADD_id_OBJECT(NSTextWriteException,@"NSTextWriteException"); ADD_id_OBJECT(NSTypedStreamVersionException,@"NSTypedStreamVersionException"); ADD_id_OBJECT(NSWindowServerCommunicationException,@"NSWindowServerCommunicationException"); ADD_id_OBJECT(NSWordTablesReadException,@"NSWordTablesReadException"); ADD_id_OBJECT(NSWordTablesWriteException,@"NSWordTablesWriteException"); return dict; } /* -- End of file -- */ StepTalk-0.10.0/Modules/AppKit/NSApplication+additions.m0000664000175000017500000000444514633027767022065 0ustar yavoryavor/** NSApplication additions Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Nov 15 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 "NSApplication+additions.h" #import @implementation NSApplication(STAdditions) - (int)runAlertPanelWithTitle:(NSString *)title message:(NSString *)message defaultButton:(NSString *)defaultButton alternateButton:(NSString *)alternateButton otherButton:(NSString *)otherButton { return NSRunAlertPanel(title, message, defaultButton, alternateButton, otherButton); } - (int)runCriticalAlertPanelWithTitle:(NSString *)title message:(NSString *)message defaultButton:(NSString *)defaultButton alternateButton:(NSString *)alternateButton otherButton:(NSString *)otherButton { return NSRunCriticalAlertPanel(title, message, defaultButton, alternateButton, otherButton); } - (int)runInformationalAlertPanelWithTitle:(NSString *)title message:(NSString *)message defaultButton:(NSString *)defaultButton alternateButton:(NSString *)alternateButton otherButton:(NSString *)otherButton { return NSRunInformationalAlertPanel(title, message, defaultButton, alternateButton, otherButton); } @end StepTalk-0.10.0/Modules/AppKit/AppKitConstants.m0000664000175000017500000006216614633027767020500 0ustar yavoryavor/** AppKitConstants.m NOTE: Do not edit this file, it is automaticaly generated. 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 #import #import #import #import #import #import NSDictionary *STGetAppKitConstants(void) { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; Class numberClass = [NSNumber class]; IMP numberWithInteger; IMP numberWithFloat; IMP setObject_forKey; SEL numberWithInteger_sel = @selector(numberWithInteger:); SEL numberWithFloat_sel = @selector(numberWithFloat:); SEL setObject_forKey_sel = @selector(setObject:forKey:); numberWithInteger = [numberClass methodForSelector:numberWithInteger_sel]; numberWithFloat = [numberClass methodForSelector:numberWithFloat_sel]; setObject_forKey = [dict methodForSelector:setObject_forKey_sel]; #define ADD_id_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, obj, name) #define ADD_NSInteger_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithInteger(numberClass, numberWithInteger_sel, obj), \ name) #define ADD_float_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithFloat(numberClass, numberWithFloat_sel, obj), \ name) ADD_id_OBJECT(NSModalPanelRunLoopMode,@"NSModalPanelRunLoopMode"); ADD_id_OBJECT(NSEventTrackingRunLoopMode,@"NSEventTrackingRunLoopMode"); ADD_id_OBJECT(NSFontAttributeName,@"NSFontAttributeName"); ADD_id_OBJECT(NSParagraphStyleAttributeName,@"NSParagraphStyleAttributeName"); ADD_id_OBJECT(NSForegroundColorAttributeName,@"NSForegroundColorAttributeName"); ADD_id_OBJECT(NSUnderlineStyleAttributeName,@"NSUnderlineStyleAttributeName"); ADD_id_OBJECT(NSSuperscriptAttributeName,@"NSSuperscriptAttributeName"); ADD_id_OBJECT(NSBackgroundColorAttributeName,@"NSBackgroundColorAttributeName"); ADD_id_OBJECT(NSAttachmentAttributeName,@"NSAttachmentAttributeName"); ADD_id_OBJECT(NSLigatureAttributeName,@"NSLigatureAttributeName"); ADD_id_OBJECT(NSBaselineOffsetAttributeName,@"NSBaselineOffsetAttributeName"); ADD_id_OBJECT(NSKernAttributeName,@"NSKernAttributeName"); ADD_id_OBJECT(NSLinkAttributeName,@"NSLinkAttributeName"); ADD_id_OBJECT(NSAFMAscender,@"NSAFMAscender"); ADD_id_OBJECT(NSAFMCapHeight,@"NSAFMCapHeight"); ADD_id_OBJECT(NSAFMCharacterSet,@"NSAFMCharacterSet"); ADD_id_OBJECT(NSAFMDescender,@"NSAFMDescender"); ADD_id_OBJECT(NSAFMEncodingScheme,@"NSAFMEncodingScheme"); ADD_id_OBJECT(NSAFMFamilyName,@"NSAFMFamilyName"); ADD_id_OBJECT(NSAFMFontName,@"NSAFMFontName"); ADD_id_OBJECT(NSAFMFormatVersion,@"NSAFMFormatVersion"); ADD_id_OBJECT(NSAFMFullName,@"NSAFMFullName"); ADD_id_OBJECT(NSAFMItalicAngle,@"NSAFMItalicAngle"); ADD_id_OBJECT(NSAFMMappingScheme,@"NSAFMMappingScheme"); ADD_id_OBJECT(NSAFMNotice,@"NSAFMNotice"); ADD_id_OBJECT(NSAFMUnderlinePosition,@"NSAFMUnderlinePosition"); ADD_id_OBJECT(NSAFMUnderlineThickness,@"NSAFMUnderlineThickness"); ADD_id_OBJECT(NSAFMVersion,@"NSAFMVersion"); ADD_id_OBJECT(NSAFMWeight,@"NSAFMWeight"); ADD_id_OBJECT(NSAFMXHeight,@"NSAFMXHeight"); ADD_id_OBJECT(NSCalibratedWhiteColorSpace,@"NSCalibratedWhiteColorSpace"); ADD_id_OBJECT(NSCalibratedBlackColorSpace,@"NSCalibratedBlackColorSpace"); ADD_id_OBJECT(NSCalibratedRGBColorSpace,@"NSCalibratedRGBColorSpace"); ADD_id_OBJECT(NSDeviceWhiteColorSpace,@"NSDeviceWhiteColorSpace"); ADD_id_OBJECT(NSDeviceBlackColorSpace,@"NSDeviceBlackColorSpace"); ADD_id_OBJECT(NSDeviceRGBColorSpace,@"NSDeviceRGBColorSpace"); ADD_id_OBJECT(NSDeviceCMYKColorSpace,@"NSDeviceCMYKColorSpace"); ADD_id_OBJECT(NSNamedColorSpace,@"NSNamedColorSpace"); ADD_id_OBJECT(NSCustomColorSpace,@"NSCustomColorSpace"); ADD_NSInteger_OBJECT(NSDefaultDepth,@"NSDefaultDepth"); ADD_NSInteger_OBJECT(NSTwoBitGrayDepth,@"NSTwoBitGrayDepth"); ADD_NSInteger_OBJECT(NSEightBitGrayDepth,@"NSEightBitGrayDepth"); ADD_NSInteger_OBJECT(NSEightBitRGBDepth,@"NSEightBitRGBDepth"); ADD_NSInteger_OBJECT(NSTwelveBitRGBDepth,@"NSTwelveBitRGBDepth"); ADD_NSInteger_OBJECT(GSSixteenBitRGBDepth,@"GSSixteenBitRGBDepth"); ADD_NSInteger_OBJECT(NSTwentyFourBitRGBDepth,@"NSTwentyFourBitRGBDepth"); ADD_float_OBJECT(NSBlack,@"NSBlack"); ADD_float_OBJECT(NSDarkGray,@"NSDarkGray"); ADD_float_OBJECT(NSWhite,@"NSWhite"); ADD_float_OBJECT(NSLightGray,@"NSLightGray"); ADD_float_OBJECT(NSGray,@"NSGray"); ADD_id_OBJECT(NSDeviceResolution,@"NSDeviceResolution"); ADD_id_OBJECT(NSDeviceColorSpaceName,@"NSDeviceColorSpaceName"); ADD_id_OBJECT(NSDeviceBitsPerSample,@"NSDeviceBitsPerSample"); ADD_id_OBJECT(NSDeviceIsScreen,@"NSDeviceIsScreen"); ADD_id_OBJECT(NSDeviceIsPrinter,@"NSDeviceIsPrinter"); ADD_id_OBJECT(NSDeviceSize,@"NSDeviceSize"); ADD_id_OBJECT(NSInterfaceStyleDefault,@"NSInterfaceStyleDefault"); ADD_id_OBJECT(NSColorPboardType,@"NSColorPboardType"); ADD_id_OBJECT(NSFileContentsPboardType,@"NSFileContentsPboardType"); ADD_id_OBJECT(NSFilenamesPboardType,@"NSFilenamesPboardType"); ADD_id_OBJECT(NSFontPboardType,@"NSFontPboardType"); ADD_id_OBJECT(NSRulerPboardType,@"NSRulerPboardType"); ADD_id_OBJECT(NSPostScriptPboardType,@"NSPostScriptPboardType"); ADD_id_OBJECT(NSTabularTextPboardType,@"NSTabularTextPboardType"); ADD_id_OBJECT(NSRTFPboardType,@"NSRTFPboardType"); ADD_id_OBJECT(NSRTFDPboardType,@"NSRTFDPboardType"); ADD_id_OBJECT(NSTIFFPboardType,@"NSTIFFPboardType"); ADD_id_OBJECT(NSGeneralPboardType,@"NSGeneralPboardType"); ADD_id_OBJECT(NSDragPboard,@"NSDragPboard"); ADD_id_OBJECT(NSFindPboard,@"NSFindPboard"); ADD_id_OBJECT(NSFontPboard,@"NSFontPboard"); ADD_id_OBJECT(NSGeneralPboard,@"NSGeneralPboard"); ADD_id_OBJECT(NSRulerPboard,@"NSRulerPboard"); ADD_id_OBJECT(NSPrintAllPages,@"NSPrintAllPages"); ADD_id_OBJECT(NSPrintBottomMargin,@"NSPrintBottomMargin"); ADD_id_OBJECT(NSPrintCopies,@"NSPrintCopies"); ADD_id_OBJECT(NSPrintFaxCoverSheetName,@"NSPrintFaxCoverSheetName"); ADD_id_OBJECT(NSPrintFaxHighResolution,@"NSPrintFaxHighResolution"); ADD_id_OBJECT(NSPrintFaxModem,@"NSPrintFaxModem"); ADD_id_OBJECT(NSPrintFaxReceiverNames,@"NSPrintFaxReceiverNames"); ADD_id_OBJECT(NSPrintFaxReceiverNumbers,@"NSPrintFaxReceiverNumbers"); ADD_id_OBJECT(NSPrintFaxReturnReceipt,@"NSPrintFaxReturnReceipt"); ADD_id_OBJECT(NSPrintFaxSendTime,@"NSPrintFaxSendTime"); ADD_id_OBJECT(NSPrintFaxTrimPageEnds,@"NSPrintFaxTrimPageEnds"); ADD_id_OBJECT(NSPrintFaxUseCoverSheet,@"NSPrintFaxUseCoverSheet"); ADD_id_OBJECT(NSPrintFirstPage,@"NSPrintFirstPage"); ADD_id_OBJECT(NSPrintHorizontalPagination,@"NSPrintHorizontalPagination"); ADD_id_OBJECT(NSPrintHorizontallyCentered,@"NSPrintHorizontallyCentered"); ADD_id_OBJECT(NSPrintJobDisposition,@"NSPrintJobDisposition"); ADD_id_OBJECT(NSPrintJobFeatures,@"NSPrintJobFeatures"); ADD_id_OBJECT(NSPrintLastPage,@"NSPrintLastPage"); ADD_id_OBJECT(NSPrintLeftMargin,@"NSPrintLeftMargin"); ADD_id_OBJECT(NSPrintManualFeed,@"NSPrintManualFeed"); ADD_id_OBJECT(NSPrintOrientation,@"NSPrintOrientation"); ADD_id_OBJECT(NSPrintPagesPerSheet,@"NSPrintPagesPerSheet"); ADD_id_OBJECT(NSPrintPaperFeed,@"NSPrintPaperFeed"); ADD_id_OBJECT(NSPrintPaperName,@"NSPrintPaperName"); ADD_id_OBJECT(NSPrintPaperSize,@"NSPrintPaperSize"); ADD_id_OBJECT(NSPrintPrinter,@"NSPrintPrinter"); ADD_id_OBJECT(NSPrintReversePageOrder,@"NSPrintReversePageOrder"); ADD_id_OBJECT(NSPrintRightMargin,@"NSPrintRightMargin"); ADD_id_OBJECT(NSPrintSavePath,@"NSPrintSavePath"); ADD_id_OBJECT(NSPrintScalingFactor,@"NSPrintScalingFactor"); ADD_id_OBJECT(NSPrintTopMargin,@"NSPrintTopMargin"); ADD_id_OBJECT(NSPrintVerticalPagination,@"NSPrintVerticalPagination"); ADD_id_OBJECT(NSPrintVerticallyCentered,@"NSPrintVerticallyCentered"); ADD_id_OBJECT(NSPrintCancelJob,@"NSPrintCancelJob"); ADD_id_OBJECT(NSPrintFaxJob,@"NSPrintFaxJob"); ADD_id_OBJECT(NSPrintPreviewJob,@"NSPrintPreviewJob"); ADD_id_OBJECT(NSPrintSaveJob,@"NSPrintSaveJob"); ADD_id_OBJECT(NSPrintSpoolJob,@"NSPrintSpoolJob"); ADD_id_OBJECT(NSOldSelectedCharacterRange,@"NSOldSelectedCharacterRange"); ADD_id_OBJECT(NSPlainFileType,@"NSPlainFileType"); ADD_id_OBJECT(NSDirectoryFileType,@"NSDirectoryFileType"); ADD_id_OBJECT(NSApplicationFileType,@"NSApplicationFileType"); ADD_id_OBJECT(NSFilesystemFileType,@"NSFilesystemFileType"); ADD_id_OBJECT(NSShellCommandFileType,@"NSShellCommandFileType"); ADD_id_OBJECT(NSWorkspaceCompressOperation,@"NSWorkspaceCompressOperation"); ADD_id_OBJECT(NSWorkspaceCopyOperation,@"NSWorkspaceCopyOperation"); ADD_id_OBJECT(NSWorkspaceDecompressOperation,@"NSWorkspaceDecompressOperation"); ADD_id_OBJECT(NSWorkspaceDecryptOperation,@"NSWorkspaceDecryptOperation"); ADD_id_OBJECT(NSWorkspaceDestroyOperation,@"NSWorkspaceDestroyOperation"); ADD_id_OBJECT(NSWorkspaceDuplicateOperation,@"NSWorkspaceDuplicateOperation"); ADD_id_OBJECT(NSWorkspaceEncryptOperation,@"NSWorkspaceEncryptOperation"); ADD_id_OBJECT(NSWorkspaceLinkOperation,@"NSWorkspaceLinkOperation"); ADD_id_OBJECT(NSWorkspaceMoveOperation,@"NSWorkspaceMoveOperation"); ADD_id_OBJECT(NSWorkspaceRecycleOperation,@"NSWorkspaceRecycleOperation"); ADD_NSInteger_OBJECT(NSRunStoppedResponse,@"NSRunStoppedResponse"); ADD_NSInteger_OBJECT(NSRunAbortedResponse,@"NSRunAbortedResponse"); ADD_NSInteger_OBJECT(NSRunContinuesResponse,@"NSRunContinuesResponse"); ADD_NSInteger_OBJECT(GSNoUnderlineStyle,@"GSNoUnderlineStyle"); ADD_NSInteger_OBJECT(NSSingleUnderlineStyle,@"NSSingleUnderlineStyle"); ADD_NSInteger_OBJECT(NSButtLineCapStyle,@"NSButtLineCapStyle"); ADD_NSInteger_OBJECT(NSRoundLineCapStyle,@"NSRoundLineCapStyle"); ADD_NSInteger_OBJECT(NSSquareLineCapStyle,@"NSSquareLineCapStyle"); ADD_NSInteger_OBJECT(NSMiterLineJoinStyle,@"NSMiterLineJoinStyle"); ADD_NSInteger_OBJECT(NSRoundLineJoinStyle,@"NSRoundLineJoinStyle"); ADD_NSInteger_OBJECT(NSBevelLineJoinStyle,@"NSBevelLineJoinStyle"); ADD_NSInteger_OBJECT(NSNonZeroWindingRule,@"NSNonZeroWindingRule"); ADD_NSInteger_OBJECT(NSEvenOddWindingRule,@"NSEvenOddWindingRule"); ADD_NSInteger_OBJECT(NSMoveToBezierPathElement,@"NSMoveToBezierPathElement"); ADD_NSInteger_OBJECT(NSLineToBezierPathElement,@"NSLineToBezierPathElement"); ADD_NSInteger_OBJECT(NSCurveToBezierPathElement,@"NSCurveToBezierPathElement"); ADD_NSInteger_OBJECT(NSClosePathBezierPathElement,@"NSClosePathBezierPathElement"); ADD_NSInteger_OBJECT(NSNoTitle,@"NSNoTitle"); ADD_NSInteger_OBJECT(NSAboveTop,@"NSAboveTop"); ADD_NSInteger_OBJECT(NSAtTop,@"NSAtTop"); ADD_NSInteger_OBJECT(NSBelowTop,@"NSBelowTop"); ADD_NSInteger_OBJECT(NSAboveBottom,@"NSAboveBottom"); ADD_NSInteger_OBJECT(NSAtBottom,@"NSAtBottom"); ADD_NSInteger_OBJECT(NSBelowBottom,@"NSBelowBottom"); ADD_NSInteger_OBJECT(NSTIFFCompressionNone,@"NSTIFFCompressionNone"); ADD_NSInteger_OBJECT(NSTIFFCompressionCCITTFAX3,@"NSTIFFCompressionCCITTFAX3"); ADD_NSInteger_OBJECT(NSTIFFCompressionCCITTFAX4,@"NSTIFFCompressionCCITTFAX4"); ADD_NSInteger_OBJECT(NSTIFFCompressionLZW,@"NSTIFFCompressionLZW"); ADD_NSInteger_OBJECT(NSTIFFCompressionJPEG,@"NSTIFFCompressionJPEG"); ADD_NSInteger_OBJECT(NSTIFFCompressionNEXT,@"NSTIFFCompressionNEXT"); ADD_NSInteger_OBJECT(NSTIFFCompressionPackBits,@"NSTIFFCompressionPackBits"); ADD_NSInteger_OBJECT(NSTIFFCompressionOldJPEG,@"NSTIFFCompressionOldJPEG"); ADD_NSInteger_OBJECT(NSTIFFFileType,@"NSTIFFFileType"); ADD_NSInteger_OBJECT(NSBMPFileType,@"NSBMPFileType"); ADD_NSInteger_OBJECT(NSGIFFileType,@"NSGIFFileType"); ADD_NSInteger_OBJECT(NSJPEGFileType,@"NSJPEGFileType"); ADD_NSInteger_OBJECT(NSPNGFileType,@"NSPNGFileType"); ADD_NSInteger_OBJECT(NSMomentaryPushButton,@"NSMomentaryPushButton"); ADD_NSInteger_OBJECT(NSPushOnPushOffButton,@"NSPushOnPushOffButton"); ADD_NSInteger_OBJECT(NSToggleButton,@"NSToggleButton"); ADD_NSInteger_OBJECT(NSSwitchButton,@"NSSwitchButton"); ADD_NSInteger_OBJECT(NSRadioButton,@"NSRadioButton"); ADD_NSInteger_OBJECT(NSMomentaryChangeButton,@"NSMomentaryChangeButton"); ADD_NSInteger_OBJECT(NSOnOffButton,@"NSOnOffButton"); ADD_NSInteger_OBJECT(NSMomentaryLight,@"NSMomentaryLight"); ADD_NSInteger_OBJECT(NSRoundedBezelStyle,@"NSRoundedBezelStyle"); ADD_NSInteger_OBJECT(NSRegularSquareBezelStyle,@"NSRegularSquareBezelStyle"); ADD_NSInteger_OBJECT(NSThickSquareBezelStyle,@"NSThickSquareBezelStyle"); ADD_NSInteger_OBJECT(NSThickerSquareBezelStyle,@"NSThickerSquareBezelStyle"); ADD_NSInteger_OBJECT(NSNeXTBezelStyle,@"NSNeXTBezelStyle"); ADD_NSInteger_OBJECT(NSPushButtonBezelStyle,@"NSPushButtonBezelStyle"); ADD_NSInteger_OBJECT(NSSmallIconButtonBezelStyle,@"NSSmallIconButtonBezelStyle"); ADD_NSInteger_OBJECT(NSMediumIconButtonBezelStyle,@"NSMediumIconButtonBezelStyle"); ADD_NSInteger_OBJECT(NSLargeIconButtonBezelStyle,@"NSLargeIconButtonBezelStyle"); ADD_NSInteger_OBJECT(NSGradientNone,@"NSGradientNone"); ADD_NSInteger_OBJECT(NSGradientConcaveWeak,@"NSGradientConcaveWeak"); ADD_NSInteger_OBJECT(NSGradientConcaveStrong,@"NSGradientConcaveStrong"); ADD_NSInteger_OBJECT(NSGradientConvexWeak,@"NSGradientConvexWeak"); ADD_NSInteger_OBJECT(NSGradientConvexStrong,@"NSGradientConvexStrong"); ADD_NSInteger_OBJECT(NSNullCellType,@"NSNullCellType"); ADD_NSInteger_OBJECT(NSTextCellType,@"NSTextCellType"); ADD_NSInteger_OBJECT(NSImageCellType,@"NSImageCellType"); ADD_NSInteger_OBJECT(NSAnyType,@"NSAnyType"); ADD_NSInteger_OBJECT(NSIntType,@"NSIntType"); ADD_NSInteger_OBJECT(NSPositiveIntType,@"NSPositiveIntType"); ADD_NSInteger_OBJECT(NSFloatType,@"NSFloatType"); ADD_NSInteger_OBJECT(NSPositiveFloatType,@"NSPositiveFloatType"); ADD_NSInteger_OBJECT(NSDateType,@"NSDateType"); ADD_NSInteger_OBJECT(NSDoubleType,@"NSDoubleType"); ADD_NSInteger_OBJECT(NSPositiveDoubleType,@"NSPositiveDoubleType"); ADD_NSInteger_OBJECT(NSNoImage,@"NSNoImage"); ADD_NSInteger_OBJECT(NSImageOnly,@"NSImageOnly"); ADD_NSInteger_OBJECT(NSImageLeft,@"NSImageLeft"); ADD_NSInteger_OBJECT(NSImageRight,@"NSImageRight"); ADD_NSInteger_OBJECT(NSImageBelow,@"NSImageBelow"); ADD_NSInteger_OBJECT(NSImageAbove,@"NSImageAbove"); ADD_NSInteger_OBJECT(NSImageOverlaps,@"NSImageOverlaps"); ADD_NSInteger_OBJECT(NSCellDisabled,@"NSCellDisabled"); ADD_NSInteger_OBJECT(NSCellState,@"NSCellState"); ADD_NSInteger_OBJECT(NSPushInCell,@"NSPushInCell"); ADD_NSInteger_OBJECT(NSCellEditable,@"NSCellEditable"); ADD_NSInteger_OBJECT(NSChangeGrayCell,@"NSChangeGrayCell"); ADD_NSInteger_OBJECT(NSCellHighlighted,@"NSCellHighlighted"); ADD_NSInteger_OBJECT(NSCellLightsByContents,@"NSCellLightsByContents"); ADD_NSInteger_OBJECT(NSCellLightsByGray,@"NSCellLightsByGray"); ADD_NSInteger_OBJECT(NSChangeBackgroundCell,@"NSChangeBackgroundCell"); ADD_NSInteger_OBJECT(NSCellLightsByBackground,@"NSCellLightsByBackground"); ADD_NSInteger_OBJECT(NSCellIsBordered,@"NSCellIsBordered"); ADD_NSInteger_OBJECT(NSCellHasOverlappingImage,@"NSCellHasOverlappingImage"); ADD_NSInteger_OBJECT(NSCellHasImageHorizontal,@"NSCellHasImageHorizontal"); ADD_NSInteger_OBJECT(NSCellHasImageOnLeftOrBottom,@"NSCellHasImageOnLeftOrBottom"); ADD_NSInteger_OBJECT(NSCellChangesContents,@"NSCellChangesContents"); ADD_NSInteger_OBJECT(NSCellIsInsetButton,@"NSCellIsInsetButton"); ADD_NSInteger_OBJECT(NSCellAllowsMixedState,@"NSCellAllowsMixedState"); ADD_NSInteger_OBJECT(NSNoCellMask,@"NSNoCellMask"); ADD_NSInteger_OBJECT(NSContentsCellMask,@"NSContentsCellMask"); ADD_NSInteger_OBJECT(NSPushInCellMask,@"NSPushInCellMask"); ADD_NSInteger_OBJECT(NSChangeGrayCellMask,@"NSChangeGrayCellMask"); ADD_NSInteger_OBJECT(NSChangeBackgroundCellMask,@"NSChangeBackgroundCellMask"); ADD_NSInteger_OBJECT(NSOffState,@"NSOffState"); ADD_NSInteger_OBJECT(NSOnState,@"NSOnState"); ADD_NSInteger_OBJECT(NSMixedState,@"NSMixedState"); ADD_NSInteger_OBJECT(NSDefaultControlTint,@"NSDefaultControlTint"); ADD_NSInteger_OBJECT(NSClearControlTint,@"NSClearControlTint"); ADD_NSInteger_OBJECT(NSGrayModeColorPanel,@"NSGrayModeColorPanel"); ADD_NSInteger_OBJECT(NSRGBModeColorPanel,@"NSRGBModeColorPanel"); ADD_NSInteger_OBJECT(NSCMYKModeColorPanel,@"NSCMYKModeColorPanel"); ADD_NSInteger_OBJECT(NSHSBModeColorPanel,@"NSHSBModeColorPanel"); ADD_NSInteger_OBJECT(NSCustomPaletteModeColorPanel,@"NSCustomPaletteModeColorPanel"); ADD_NSInteger_OBJECT(NSColorListModeColorPanel,@"NSColorListModeColorPanel"); ADD_NSInteger_OBJECT(NSWheelModeColorPanel,@"NSWheelModeColorPanel"); ADD_NSInteger_OBJECT(NSColorPanelGrayModeMask,@"NSColorPanelGrayModeMask"); ADD_NSInteger_OBJECT(NSColorPanelRGBModeMask,@"NSColorPanelRGBModeMask"); ADD_NSInteger_OBJECT(NSColorPanelCMYKModeMask,@"NSColorPanelCMYKModeMask"); ADD_NSInteger_OBJECT(NSColorPanelHSBModeMask,@"NSColorPanelHSBModeMask"); ADD_NSInteger_OBJECT(NSColorPanelCustomPaletteModeMask,@"NSColorPanelCustomPaletteModeMask"); ADD_NSInteger_OBJECT(NSColorPanelColorListModeMask,@"NSColorPanelColorListModeMask"); ADD_NSInteger_OBJECT(NSColorPanelWheelModeMask,@"NSColorPanelWheelModeMask"); ADD_NSInteger_OBJECT(NSColorPanelAllModesMask,@"NSColorPanelAllModesMask"); ADD_NSInteger_OBJECT(GSArrowCursor,@"GSArrowCursor"); ADD_NSInteger_OBJECT(GSIBeamCursor,@"GSIBeamCursor"); ADD_NSInteger_OBJECT(NSChangeDone,@"NSChangeDone"); ADD_NSInteger_OBJECT(NSChangeUndone,@"NSChangeUndone"); ADD_NSInteger_OBJECT(NSChangeCleared,@"NSChangeCleared"); ADD_NSInteger_OBJECT(NSSaveOperation,@"NSSaveOperation"); ADD_NSInteger_OBJECT(NSSaveAsOperation,@"NSSaveAsOperation"); ADD_NSInteger_OBJECT(NSSaveToOperation,@"NSSaveToOperation"); ADD_NSInteger_OBJECT(NSDragOperationNone,@"NSDragOperationNone"); ADD_NSInteger_OBJECT(NSDragOperationCopy,@"NSDragOperationCopy"); ADD_NSInteger_OBJECT(NSDragOperationLink,@"NSDragOperationLink"); ADD_NSInteger_OBJECT(NSDragOperationGeneric,@"NSDragOperationGeneric"); ADD_NSInteger_OBJECT(NSDragOperationPrivate,@"NSDragOperationPrivate"); ADD_NSInteger_OBJECT(NSDragOperationAll,@"NSDragOperationAll"); ADD_NSInteger_OBJECT(NSControlGlyph,@"NSControlGlyph"); ADD_NSInteger_OBJECT(NSNullGlyph,@"NSNullGlyph"); ADD_NSInteger_OBJECT(NSGlyphBelow,@"NSGlyphBelow"); ADD_NSInteger_OBJECT(NSGlyphAbove,@"NSGlyphAbove"); ADD_NSInteger_OBJECT(NSOneByteGlyphPacking,@"NSOneByteGlyphPacking"); ADD_NSInteger_OBJECT(NSJapaneseEUCGlyphPacking,@"NSJapaneseEUCGlyphPacking"); ADD_NSInteger_OBJECT(NSAsciiWithDoubleByteEUCGlyphPacking,@"NSAsciiWithDoubleByteEUCGlyphPacking"); ADD_NSInteger_OBJECT(NSTwoByteGlyphPacking,@"NSTwoByteGlyphPacking"); ADD_NSInteger_OBJECT(NSFourByteGlyphPacking,@"NSFourByteGlyphPacking"); ADD_NSInteger_OBJECT(NSItalicFontMask,@"NSItalicFontMask"); ADD_NSInteger_OBJECT(NSUnitalicFontMask,@"NSUnitalicFontMask"); ADD_NSInteger_OBJECT(NSBoldFontMask,@"NSBoldFontMask"); ADD_NSInteger_OBJECT(NSUnboldFontMask,@"NSUnboldFontMask"); ADD_NSInteger_OBJECT(NSNarrowFontMask,@"NSNarrowFontMask"); ADD_NSInteger_OBJECT(NSExpandedFontMask,@"NSExpandedFontMask"); ADD_NSInteger_OBJECT(NSCondensedFontMask,@"NSCondensedFontMask"); ADD_NSInteger_OBJECT(NSSmallCapsFontMask,@"NSSmallCapsFontMask"); ADD_NSInteger_OBJECT(NSPosterFontMask,@"NSPosterFontMask"); ADD_NSInteger_OBJECT(NSCompressedFontMask,@"NSCompressedFontMask"); ADD_NSInteger_OBJECT(NSNonStandardCharacterSetFontMask,@"NSNonStandardCharacterSetFontMask"); ADD_NSInteger_OBJECT(NSFixedPitchFontMask,@"NSFixedPitchFontMask"); ADD_NSInteger_OBJECT(NSNoFontChangeAction,@"NSNoFontChangeAction"); ADD_NSInteger_OBJECT(NSViaPanelFontAction,@"NSViaPanelFontAction"); ADD_NSInteger_OBJECT(NSAddTraitFontAction,@"NSAddTraitFontAction"); ADD_NSInteger_OBJECT(NSRemoveTraitFontAction,@"NSRemoveTraitFontAction"); ADD_NSInteger_OBJECT(NSSizeUpFontAction,@"NSSizeUpFontAction"); ADD_NSInteger_OBJECT(NSSizeDownFontAction,@"NSSizeDownFontAction"); ADD_NSInteger_OBJECT(NSHeavierFontAction,@"NSHeavierFontAction"); ADD_NSInteger_OBJECT(NSLighterFontAction,@"NSLighterFontAction"); ADD_NSInteger_OBJECT(NSFPPreviewButton,@"NSFPPreviewButton"); ADD_NSInteger_OBJECT(NSFPRevertButton,@"NSFPRevertButton"); ADD_NSInteger_OBJECT(NSFPSetButton,@"NSFPSetButton"); ADD_NSInteger_OBJECT(NSFPPreviewField,@"NSFPPreviewField"); ADD_NSInteger_OBJECT(NSFPSizeField,@"NSFPSizeField"); ADD_NSInteger_OBJECT(NSFPSizeTitle,@"NSFPSizeTitle"); ADD_NSInteger_OBJECT(NSFPCurrentField,@"NSFPCurrentField"); ADD_NSInteger_OBJECT(NSFPFamilyBrowser,@"NSFPFamilyBrowser"); ADD_NSInteger_OBJECT(NSFPFaceBrowser,@"NSFPFaceBrowser"); ADD_NSInteger_OBJECT(NSFPSizeBrowser,@"NSFPSizeBrowser"); ADD_NSInteger_OBJECT(NSBackingStoreRetained,@"NSBackingStoreRetained"); ADD_NSInteger_OBJECT(NSBackingStoreNonretained,@"NSBackingStoreNonretained"); ADD_NSInteger_OBJECT(NSBackingStoreBuffered,@"NSBackingStoreBuffered"); ADD_NSInteger_OBJECT(NSCompositeClear,@"NSCompositeClear"); ADD_NSInteger_OBJECT(NSCompositeCopy,@"NSCompositeCopy"); ADD_NSInteger_OBJECT(NSCompositeSourceOver,@"NSCompositeSourceOver"); ADD_NSInteger_OBJECT(NSCompositeSourceIn,@"NSCompositeSourceIn"); ADD_NSInteger_OBJECT(NSCompositeSourceOut,@"NSCompositeSourceOut"); ADD_NSInteger_OBJECT(NSCompositeSourceAtop,@"NSCompositeSourceAtop"); ADD_NSInteger_OBJECT(NSCompositeDestinationOver,@"NSCompositeDestinationOver"); ADD_NSInteger_OBJECT(NSCompositeDestinationIn,@"NSCompositeDestinationIn"); ADD_NSInteger_OBJECT(NSCompositeDestinationOut,@"NSCompositeDestinationOut"); ADD_NSInteger_OBJECT(NSCompositeDestinationAtop,@"NSCompositeDestinationAtop"); ADD_NSInteger_OBJECT(NSCompositeXOR,@"NSCompositeXOR"); ADD_NSInteger_OBJECT(NSCompositePlusDarker,@"NSCompositePlusDarker"); ADD_NSInteger_OBJECT(NSCompositeHighlight,@"NSCompositeHighlight"); ADD_NSInteger_OBJECT(NSCompositePlusLighter,@"NSCompositePlusLighter"); ADD_NSInteger_OBJECT(NSWindowAbove,@"NSWindowAbove"); ADD_NSInteger_OBJECT(NSWindowBelow,@"NSWindowBelow"); ADD_NSInteger_OBJECT(NSWindowOut,@"NSWindowOut"); ADD_NSInteger_OBJECT(GSTitleBarKey,@"GSTitleBarKey"); ADD_NSInteger_OBJECT(GSTitleBarNormal,@"GSTitleBarNormal"); ADD_NSInteger_OBJECT(GSTitleBarMain,@"GSTitleBarMain"); ADD_NSInteger_OBJECT(NSScaleProportionally,@"NSScaleProportionally"); ADD_NSInteger_OBJECT(NSScaleToFit,@"NSScaleToFit"); ADD_NSInteger_OBJECT(NSScaleNone,@"NSScaleNone"); ADD_NSInteger_OBJECT(NSImageAlignCenter,@"NSImageAlignCenter"); ADD_NSInteger_OBJECT(NSImageAlignTop,@"NSImageAlignTop"); ADD_NSInteger_OBJECT(NSImageAlignTopLeft,@"NSImageAlignTopLeft"); ADD_NSInteger_OBJECT(NSImageAlignTopRight,@"NSImageAlignTopRight"); ADD_NSInteger_OBJECT(NSImageAlignLeft,@"NSImageAlignLeft"); ADD_NSInteger_OBJECT(NSImageAlignBottom,@"NSImageAlignBottom"); ADD_NSInteger_OBJECT(NSImageAlignBottomLeft,@"NSImageAlignBottomLeft"); ADD_NSInteger_OBJECT(NSImageAlignBottomRight,@"NSImageAlignBottomRight"); ADD_NSInteger_OBJECT(NSImageAlignRight,@"NSImageAlignRight"); ADD_NSInteger_OBJECT(NSImageFrameNone,@"NSImageFrameNone"); ADD_NSInteger_OBJECT(NSImageFramePhoto,@"NSImageFramePhoto"); ADD_NSInteger_OBJECT(NSImageFrameGrayBezel,@"NSImageFrameGrayBezel"); ADD_NSInteger_OBJECT(NSImageFrameGroove,@"NSImageFrameGroove"); ADD_NSInteger_OBJECT(NSImageFrameButton,@"NSImageFrameButton"); ADD_NSInteger_OBJECT(NSUtilityWindowMask,@"NSUtilityWindowMask"); ADD_NSInteger_OBJECT(NSDocModalWindowMask,@"NSDocModalWindowMask"); ADD_NSInteger_OBJECT(NSOKButton,@"NSOKButton"); ADD_NSInteger_OBJECT(NSCancelButton,@"NSCancelButton"); ADD_NSInteger_OBJECT(NSAlertDefaultReturn,@"NSAlertDefaultReturn"); ADD_NSInteger_OBJECT(NSAlertAlternateReturn,@"NSAlertAlternateReturn"); ADD_NSInteger_OBJECT(NSAlertOtherReturn,@"NSAlertOtherReturn"); ADD_NSInteger_OBJECT(NSAlertErrorReturn,@"NSAlertErrorReturn"); return dict; } /* -- End of file -- */ StepTalk-0.10.0/Modules/AppKit/AppKitNotifications.m0000664000175000017500000001563714633027767021336 0ustar yavoryavor/** AppKitNotifications.m NOTE: Do not edit this file, it is automaticaly generated. 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 #import #import #import #import #import #import NSDictionary *STGetAppKitNotifications(void) { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; Class numberClass = [NSNumber class]; IMP numberWithInteger; IMP numberWithFloat; IMP setObject_forKey; SEL numberWithInteger_sel = @selector(numberWithInteger:); SEL numberWithFloat_sel = @selector(numberWithFloat:); SEL setObject_forKey_sel = @selector(setObject:forKey:); numberWithInteger = [numberClass methodForSelector:numberWithInteger_sel]; numberWithFloat = [numberClass methodForSelector:numberWithFloat_sel]; setObject_forKey = [dict methodForSelector:setObject_forKey_sel]; #define ADD_id_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, obj, name) #define ADD_NSInteger_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithInteger(numberClass, numberWithInteger_sel, obj), \ name) #define ADD_float_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithFloat(numberClass, numberWithFloat_sel, obj), \ name) ADD_id_OBJECT(NSColorListDidChangeNotification,@"NSColorListDidChangeNotification"); ADD_id_OBJECT(NSColorPanelColorDidChangeNotification,@"NSColorPanelColorDidChangeNotification"); ADD_id_OBJECT(NSControlTextDidBeginEditingNotification,@"NSControlTextDidBeginEditingNotification"); ADD_id_OBJECT(NSControlTextDidEndEditingNotification,@"NSControlTextDidEndEditingNotification"); ADD_id_OBJECT(NSControlTextDidChangeNotification,@"NSControlTextDidChangeNotification"); ADD_id_OBJECT(NSDrawerDidCloseNotification,@"NSDrawerDidCloseNotification"); ADD_id_OBJECT(NSDrawerDidOpenNotification,@"NSDrawerDidOpenNotification"); ADD_id_OBJECT(NSDrawerWillCloseNotification,@"NSDrawerWillCloseNotification"); ADD_id_OBJECT(NSDrawerWillOpenNotification,@"NSDrawerWillOpenNotification"); ADD_id_OBJECT(NSImageRepRegistryChangedNotification,@"NSImageRepRegistryChangedNotification"); ADD_id_OBJECT(NSPopUpButtonWillPopUpNotification,@"NSPopUpButtonWillPopUpNotification"); ADD_id_OBJECT(NSSplitViewDidResizeSubviewsNotification,@"NSSplitViewDidResizeSubviewsNotification"); ADD_id_OBJECT(NSSplitViewWillResizeSubviewsNotification,@"NSSplitViewWillResizeSubviewsNotification"); ADD_id_OBJECT(NSTableViewColumnDidMoveNotification,@"NSTableViewColumnDidMoveNotification"); ADD_id_OBJECT(NSTableViewColumnDidResizeNotification,@"NSTableViewColumnDidResizeNotification"); ADD_id_OBJECT(NSTableViewSelectionDidChangeNotification,@"NSTableViewSelectionDidChangeNotification"); ADD_id_OBJECT(NSTableViewSelectionIsChangingNotification,@"NSTableViewSelectionIsChangingNotification"); ADD_id_OBJECT(NSTextDidBeginEditingNotification,@"NSTextDidBeginEditingNotification"); ADD_id_OBJECT(NSTextDidEndEditingNotification,@"NSTextDidEndEditingNotification"); ADD_id_OBJECT(NSTextDidChangeNotification,@"NSTextDidChangeNotification"); ADD_id_OBJECT(NSTextStorageWillProcessEditingNotification,@"NSTextStorageWillProcessEditingNotification"); ADD_id_OBJECT(NSTextStorageDidProcessEditingNotification,@"NSTextStorageDidProcessEditingNotification"); ADD_id_OBJECT(NSTextViewWillChangeNotifyingTextViewNotification,@"NSTextViewWillChangeNotifyingTextViewNotification"); ADD_id_OBJECT(NSTextViewDidChangeSelectionNotification,@"NSTextViewDidChangeSelectionNotification"); ADD_id_OBJECT(NSViewFrameDidChangeNotification,@"NSViewFrameDidChangeNotification"); ADD_id_OBJECT(NSViewBoundsDidChangeNotification,@"NSViewBoundsDidChangeNotification"); ADD_id_OBJECT(NSViewFocusDidChangeNotification,@"NSViewFocusDidChangeNotification"); ADD_id_OBJECT(NSWindowDidBecomeKeyNotification,@"NSWindowDidBecomeKeyNotification"); ADD_id_OBJECT(NSWindowDidBecomeMainNotification,@"NSWindowDidBecomeMainNotification"); ADD_id_OBJECT(NSWindowDidChangeScreenNotification,@"NSWindowDidChangeScreenNotification"); ADD_id_OBJECT(NSWindowDidDeminiaturizeNotification,@"NSWindowDidDeminiaturizeNotification"); ADD_id_OBJECT(NSWindowDidExposeNotification,@"NSWindowDidExposeNotification"); ADD_id_OBJECT(NSWindowDidMiniaturizeNotification,@"NSWindowDidMiniaturizeNotification"); ADD_id_OBJECT(NSWindowDidMoveNotification,@"NSWindowDidMoveNotification"); ADD_id_OBJECT(NSWindowDidResignKeyNotification,@"NSWindowDidResignKeyNotification"); ADD_id_OBJECT(NSWindowDidResignMainNotification,@"NSWindowDidResignMainNotification"); ADD_id_OBJECT(NSWindowDidResizeNotification,@"NSWindowDidResizeNotification"); ADD_id_OBJECT(NSWindowDidUpdateNotification,@"NSWindowDidUpdateNotification"); ADD_id_OBJECT(NSWindowWillCloseNotification,@"NSWindowWillCloseNotification"); ADD_id_OBJECT(NSWindowWillMiniaturizeNotification,@"NSWindowWillMiniaturizeNotification"); ADD_id_OBJECT(NSWindowWillMoveNotification,@"NSWindowWillMoveNotification"); ADD_id_OBJECT(NSWorkspaceDidLaunchApplicationNotification,@"NSWorkspaceDidLaunchApplicationNotification"); ADD_id_OBJECT(NSWorkspaceDidMountNotification,@"NSWorkspaceDidMountNotification"); ADD_id_OBJECT(NSWorkspaceDidPerformFileOperationNotification,@"NSWorkspaceDidPerformFileOperationNotification"); ADD_id_OBJECT(NSWorkspaceDidTerminateApplicationNotification,@"NSWorkspaceDidTerminateApplicationNotification"); ADD_id_OBJECT(NSWorkspaceDidUnmountNotification,@"NSWorkspaceDidUnmountNotification"); ADD_id_OBJECT(NSWorkspaceWillLaunchApplicationNotification,@"NSWorkspaceWillLaunchApplicationNotification"); ADD_id_OBJECT(NSWorkspaceWillPowerOffNotification,@"NSWorkspaceWillPowerOffNotification"); ADD_id_OBJECT(NSWorkspaceWillUnmountNotification,@"NSWorkspaceWillUnmountNotification"); return dict; } /* -- End of file -- */ StepTalk-0.10.0/Modules/AppKit/STAppKitModule.m0000664000175000017500000000344214633027767020210 0ustar yavoryavor/** STAppKitModule.m AppKit bindings Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 May 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 "STAppKitModule.h" #import #import #import @class NSApplication; extern NSDictionary *STGetAppKitConstants(); extern NSDictionary *STGetAppKitNotifications(); extern NSDictionary *STGetAppKitExceptions(); extern NSDictionary *STGetAppKitEvents(); @implementation STAppKitModule + (void)initialize { [NSApplication sharedApplication]; } + (NSDictionary *)namedObjectsForScripting { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict addEntriesFromDictionary:STGetAppKitConstants()]; [dict addEntriesFromDictionary:STGetAppKitNotifications()]; [dict addEntriesFromDictionary:STGetAppKitExceptions()]; [dict addEntriesFromDictionary:STGetAppKitEvents()]; return [NSDictionary dictionaryWithDictionary:dict]; } @end StepTalk-0.10.0/Modules/WebServices/0000775000175000017500000000000014633027767016253 5ustar yavoryavorStepTalk-0.10.0/Modules/WebServices/ScriptingInfo.plist0000664000175000017500000000045514633027767022112 0ustar yavoryavor{ ScriptingInfoClass = STWebServicesModule; Classes = ( GWSBinding, GWSCoder, GWSXMLRPCCoder, GWSJSONCoder, GWSSOAPCoder, GWSDocument, GWSElement, GWSExtensibility, GWSSOAPExtensibility, GWSMessage, GWSPort, GWSPortType, GWSService, GWSType, WSSUsernameToken ); } StepTalk-0.10.0/Modules/WebServices/GNUmakefile0000664000175000017500000000337014633027767020330 0ustar yavoryavor# # StepTalk tools # # Copyright (C) 2000,2001 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 = WebServices WebServices_OBJC_FILES = \ STWebServicesModule.m \ WebServicesConstants.m WebServices_PRINCIPAL_CLASS = STWebServicesModule WebServices_RESOURCE_FILES = ScriptingInfo.plist BUNDLE_INSTALL_DIR:=$(GNUSTEP_LIBRARY)/StepTalk/Modules ADDITIONAL_OBJCFLAGS = -Wall -Wno-import BUNDLE_LIBS += -lStepTalk -lWebServices ADDITIONAL_INCLUDE_DIRS += -I../../Frameworks/ ADDITIONAL_LIB_DIRS += -L../../Frameworks/StepTalk/StepTalk.framework/Versions/Current/$(GNUSTEP_TARGET_LDIR) -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUMakefile.postamble WebServicesConstants.m : WebServicesConstants.list %.m : %.list header.m footer.m @( echo Creating $@ ...; \ cat header.m | sed "s/@@NAME@@/`basename $< .list`/g" > $@; \ cat $< | awk -f create_constants.awk >> $@;\ cat footer.m >> $@; ) StepTalk-0.10.0/Modules/WebServices/footer.m0000664000175000017500000000005514633027767017727 0ustar yavoryavor return dict; } /* -- End of file -- */ StepTalk-0.10.0/Modules/WebServices/create_constants.awk0000664000175000017500000000017114633027767022315 0ustar yavoryavor($0 !~ /^[\t ]*#.*$/) && ($0 !~ /^[\t ]*$/) && (NF == 2) { printf " ADD_%s_OBJECT(%s,@\"%s\");\n", $1, $2, $2 } StepTalk-0.10.0/Modules/WebServices/STWebServicesModule.m0000664000175000017500000000264214633027767022273 0ustar yavoryavor/** STWebServicesModule.m WebServices bindings Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 May 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 "STWebServicesModule.h" #import #import @class NSApplication; extern NSDictionary *STGetWebServicesConstants(); @implementation STWebServicesModule + (NSDictionary *)namedObjectsForScripting { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict addEntriesFromDictionary:STGetWebServicesConstants()]; return [NSDictionary dictionaryWithDictionary:dict]; } @end StepTalk-0.10.0/Modules/WebServices/STWebServicesModule.h0000664000175000017500000000204514633027767022263 0ustar yavoryavor/** STWebServicesModule.h WebServices bindings Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 May 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 @interface STWebServicesModule:NSObject { } @end StepTalk-0.10.0/Modules/WebServices/WebServicesConstants.m0000664000175000017500000000672214633027767022556 0ustar yavoryavor/** WebServicesConstants.m NOTE: Do not edit this file, it is automaticaly generated. 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 #import #import #import #import NSDictionary *STGetWebServicesConstants(void) { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; Class numberClass = [NSNumber class]; IMP numberWithInteger; IMP numberWithFloat; IMP setObject_forKey; SEL numberWithInteger_sel = @selector(numberWithInteger:); SEL numberWithFloat_sel = @selector(numberWithFloat:); SEL setObject_forKey_sel = @selector(setObject:forKey:); numberWithInteger = [numberClass methodForSelector:numberWithInteger_sel]; numberWithFloat = [numberClass methodForSelector:numberWithFloat_sel]; setObject_forKey = [dict methodForSelector:setObject_forKey_sel]; #define ADD_id_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, obj, name) #define ADD_int_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithInteger(numberClass, numberWithInteger_sel, obj), \ name) #define ADD_float_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithFloat(numberClass, numberWithFloat_sel, obj), \ name) ADD_id_OBJECT(GWSErrorKey,@"GWSErrorKey"); ADD_id_OBJECT(GWSFaultKey,@"GWSFaultKey"); ADD_id_OBJECT(GWSMethodKey,@"GWSMethodKey"); ADD_id_OBJECT(GWSOrderKey,@"GWSOrderKey"); ADD_id_OBJECT(GWSParametersKey,@"GWSParametersKey"); ADD_id_OBJECT(GWSRequestDataKey,@"GWSRequestDataKey"); ADD_id_OBJECT(GWSResponseDataKey,@"GWSResponseDataKey"); ADD_id_OBJECT(GWSSOAPBodyEncodingStyleKey,@"GWSSOAPBodyEncodingStyleKey"); ADD_id_OBJECT(GWSSOAPBodyEncodingStyleDocument,@"GWSSOAPBodyEncodingStyleDocument"); ADD_id_OBJECT(GWSSOAPBodyEncodingStyleRPC,@"GWSSOAPBodyEncodingStyleRPC"); ADD_id_OBJECT(GWSSOAPBodyEncodingStyleWrapped,@"GWSSOAPBodyEncodingStyleWrapped"); ADD_id_OBJECT(GWSSOAPUseKey,@"GWSSOAPUseKey"); ADD_id_OBJECT(GWSSOAPUseEncoded,@"GWSSOAPUseEncoded"); ADD_id_OBJECT(GWSSOAPUseLiteral,@"GWSSOAPUseLiteral"); ADD_id_OBJECT(GWSSOAPMessageHeadersKey,@"GWSSOAPMessageHeadersKey"); ADD_id_OBJECT(GWSSOAPNamespaceURIKey,@"GWSSOAPNamespaceURIKey"); ADD_id_OBJECT(GWSSOAPNamespaceNameKey,@"GWSSOAPNamespaceNameKey"); ADD_id_OBJECT(GWSSOAPArrayKey,@"GWSSOAPArrayKey"); ADD_id_OBJECT(GWSSOAPTypeKey,@"GWSSOAPTypeKey"); return dict; } /* -- End of file -- */ StepTalk-0.10.0/Modules/WebServices/Functions.h0000664000175000017500000000256714633027767020406 0ustar yavoryavor/** Functions.m Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Nov 14 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 NSDictionary; @class NSString; #define _STCreateConstantsDictionaryForType(t, v, n, c) \ _ST_##t##_namesDictionary(v, n, c); #define function_header(type) \ NSDictionary *_ST_##type##_namesDictionary(type *vals, \ NSString **names, \ int count) function_header(int); function_header(float); function_header(id); StepTalk-0.10.0/Modules/WebServices/header.m0000664000175000017500000000434614633027767017670 0ustar yavoryavor/** @@NAME@@.m NOTE: Do not edit this file, it is automaticaly generated. 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 #import #import #import #import NSDictionary *STGet@@NAME@@(void) { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; Class numberClass = [NSNumber class]; IMP numberWithInteger; IMP numberWithFloat; IMP setObject_forKey; SEL numberWithInteger_sel = @selector(numberWithInteger:); SEL numberWithFloat_sel = @selector(numberWithFloat:); SEL setObject_forKey_sel = @selector(setObject:forKey:); numberWithInteger = [numberClass methodForSelector:numberWithInteger_sel]; numberWithFloat = [numberClass methodForSelector:numberWithFloat_sel]; setObject_forKey = [dict methodForSelector:setObject_forKey_sel]; #define ADD_id_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, obj, name) #define ADD_int_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithInteger(numberClass, numberWithInteger_sel, obj), \ name) #define ADD_float_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithFloat(numberClass, numberWithFloat_sel, obj), \ name) StepTalk-0.10.0/Modules/WebServices/Functions.m0000664000175000017500000000377514633027767020415 0ustar yavoryavor/** Functions.m Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Nov 14 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 #define function_template(type, class, selector) \ NSDictionary *_ST_##type##_namesDictionary(type *vals, \ NSString **names, \ int count) \ { \ NSMutableDictionary *dict = [NSMutableDictionary dictionary]; \ \ for(i = 0; i Date: 2001 May 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 @interface STFoundationModule:NSObject { } @end StepTalk-0.10.0/Modules/Foundation/NSFileManager+additions.m0000664000175000017500000000366214633027767022712 0ustar yavoryavor/** NSFileManager+additions.m File manager additions - GNUstep path functions Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2003 Jan 22 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 @implementation NSFileManager(STAdditions) + (NSString *)homeDirectory { return NSHomeDirectory(); } + (NSString *)homeDirectoryForUser:(NSString *)user { return NSHomeDirectoryForUser(user); } + (NSString *)openStepRootDirectory { return NSOpenStepRootDirectory(); } + (NSArray *)searchPathForDirectories:(int)dir inDomains:(int)domainMask expandTilde:(BOOL)flag { return NSSearchPathForDirectoriesInDomains(dir, domainMask, flag); } + (NSArray *)searchPathForDirectories:(int)dir inDomains:(int)domainMask { return [self searchPathForDirectories:dir inDomains:domainMask expandTilde:YES]; } + (NSString *)temporaryDirectory { return NSTemporaryDirectory(); } + (NSArray *)standardLibraryPaths { return NSStandardLibraryPaths(); } @end StepTalk-0.10.0/Modules/Foundation/STFoundationModule.m0000664000175000017500000000260414633027767022043 0ustar yavoryavor/** STFoundationModule.m Foundation bindings Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2002 Jan 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 "STFoundationModule.h" #import #import extern NSDictionary *STGetFoundationConstants(); @implementation STFoundationModule + (NSDictionary *)namedObjectsForScripting { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict addEntriesFromDictionary:STGetFoundationConstants()]; return [NSDictionary dictionaryWithDictionary:dict]; } @end StepTalk-0.10.0/Modules/Foundation/ScriptingInfo.plist0000664000175000017500000000410314633027767021771 0ustar yavoryavor{ ScriptingInfoClass = STFoundationModule; Classes = ( GSMimeCodingContext, GSMimeDocument, GSMimeParser, GSMimeHeader, GSHTMLParser, GSHTMLSAXHandler, GSSAXHandler, GSXMLAttribute, GSXMLDocument, GSXMLNamespace, GSXMLNode, GSXMLParser, NSArchiver, NSArray, NSAssertionHandler, NSAttributedString, NSAutoreleasePool, NSBitmapCharSet, NSBundle, NSCalendarDate, NSCharacterSet, NSClassDescription, NSCoder, NSConditionLock, NSConnection, NSCountedSet, NSData, NSDate, NSDateFormatter, NSDecimalNumber, NSDecimalNumberHandler, NSDeserializer, NSDictionary, NSDirectoryEnumerator, NSDistantObject, NSDistributedLock, NSDistributedNotificationCenter, NSEnumerator, NSException, NSFileHandle, NSFileManager, NSFormatter, NSGDate, NSHost, NSInvocation, NSKeyedArchiver, NSKeyedUnarchiver, NSLock, NSMethodSignature, NSMutableArray, NSMutableAttributedString, NSMutableBitmapCharSet, NSMutableCharacterSet, NSMutableData, NSMutableDictionary, NSMutableSet, NSMutableString, NSNotification, NSNotificationCenter, NSNotificationQueue, NSNull, NSNumber, NSNumberFormatter, NSObject, NSPipe, NSPort, NSPortCoder, NSPortMessage, NSPortNameServer, NSProcessInfo, NSProtocolChecker, NSProxy, NSRecursiveLock, NSRunLoop, NSScanner, NSSerializer, NSSet, NSString, NSTask, NSThread, NSTimeZone, NSTimeZoneDetail, NSTimer, NSURL, NSURLHandle, NSUnarchiver, NSUndoManager, NSUserDefaults, NSValue ); } StepTalk-0.10.0/Modules/Foundation/GNUmakefile0000664000175000017500000000342514633027767020216 0ustar yavoryavor# # Foundation module # # Copyright (C) 2000,2001 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 = Foundation Foundation_OBJC_FILES = \ STFoundationModule.m \ FoundationConstants.m \ NSString+additions.m \ NSFileManager+additions.m Foundation_PRINCIPAL_CLASS = STFoundationModule Foundation_RESOURCE_FILES = ScriptingInfo.plist BUNDLE_INSTALL_DIR:=$(GNUSTEP_LIBRARY)/StepTalk/Modules BUNDLE_LIBS += -lStepTalk ADDITIONAL_INCLUDE_DIRS += -I../../Frameworks/ ADDITIONAL_LIB_DIRS += -L../../Frameworks/StepTalk/StepTalk.framework/Versions/Current/$(GNUSTEP_TARGET_LDIR) ADDITIONAL_OBJCFLAGS = -Wall -Wno-import -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUMakefile.postamble FoundationConstants.m : FoundationConstants.list %.m : %.list @( echo Creating $@ ...; \ cat header.m | sed "s/@@NAME@@/`basename $< .list`/g" > $@; \ cat $< | awk -f create_constants.awk >> $@;\ cat footer.m >> $@; ) StepTalk-0.10.0/Modules/Foundation/footer.m0000664000175000017500000000005514633027767017614 0ustar yavoryavor return dict; } /* -- End of file -- */ StepTalk-0.10.0/Modules/Foundation/NSString+additions.m0000664000175000017500000000230614633027767022000 0ustar yavoryavor/** NSFileManager+additions.m File manager additions - GNUstep path functions Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2003 Jan 22 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 @implementation NSString(STAdditions) - (BOOL)containsString:(NSString *)string { NSRange range = [self rangeOfString:string]; return range.location != NSNotFound; } @end StepTalk-0.10.0/Modules/Foundation/create_constants.awk0000664000175000017500000000017114633027767022202 0ustar yavoryavor($0 !~ /^[\t ]*#.*$/) && ($0 !~ /^[\t ]*$/) && (NF == 2) { printf " ADD_%s_OBJECT(%s,@\"%s\");\n", $1, $2, $2 } StepTalk-0.10.0/Modules/Foundation/FoundationConstants.list0000664000175000017500000001056514633027767023047 0ustar yavoryavor# Objective-C constants NSInteger NO NSInteger YES # Foundation constants NSPoint NSZeroPoint NSSize NSZeroSize NSRect NSZeroRect NSInteger NSOrderedAscending NSInteger NSOrderedSame NSInteger NSOrderedDescending NSInteger NSNotFound NSInteger NSMinXEdge NSInteger NSMinYEdge NSInteger NSMaxXEdge NSInteger NSMaxYEdge NSInteger NS_UnknownByteOrder NSInteger NS_LittleEndian NSInteger NS_BigEndian NSInteger NSOpenStepUnicodeReservedBase NSInteger NSCaseInsensitiveSearch NSInteger NSLiteralSearch NSInteger NSBackwardsSearch NSInteger NSAnchoredSearch # Language defs keys id NSAMPMDesignation id NSCurrencyString id NSCurrencySymbol id NSDateFormatString id NSDateTimeOrdering id NSDecimalDigits id NSDecimalSeparator id NSEarlierTimeDesignations id NSHourNameDesignations id NSInternationalCurrencyString id NSLaterTimeDesignations id NSMonthNameArray id NSNextDayDesignations id NSNextNextDayDesignations id NSPriorDayDesignations id NSShortMonthNameArray id NSShortTimeDateFormatString id NSShortWeekDayNameArray id NSThisDayDesignations id NSThousandsSeparator id NSTimeDateFormatString id NSTimeFormatString id NSWeekDayNameArray id NSYearMonthWeekDesignations # File / File System attributes id NSFileDeviceIdentifier id NSFileGroupOwnerAccountID id NSFileModificationDate id NSFileOwnerAccountID id NSFilePosixPermissions id NSFileReferenceCount id NSFileSize id NSFileSystemFileNumber id NSFileSystemNumber id NSFileType id NSFileTypeBlockSpecial id NSFileTypeCharacterSpecial id NSFileTypeDirectory id NSFileTypeRegular id NSFileTypeSocket id NSFileTypeSymbolicLink id NSFileTypeUnknown id NSFileSystemSize id NSFileSystemFreeSize id NSFileSystemNodes id NSFileSystemFreeNodes # ObjC types # FIXME: It seeems, that they are not defined anywhere # NSInteger NSObjCNoType # NSInteger NSObjCVoidType # NSInteger NSObjCCharType # NSInteger NSObjCShortType # NSInteger NSObjCLongType # NSInteger NSObjCLonglongType # NSInteger NSObjCFloatType # NSInteger NSObjCDoubleType # NSInteger NSObjCSelectorType # NSInteger NSObjCObjectType # NSInteger NSObjCStructType # NSInteger NSObjCPoNSIntegererType # NSInteger NSObjCStringType # NSInteger NSObjCArrayType # NSInteger NSObjCUnionType # NSInteger NSObjCBitfield # String encodings NSInteger NSASCIIStringEncoding NSInteger NSISO2022JPStringEncoding NSInteger NSISOLatin1StringEncoding NSInteger NSISOLatin2StringEncoding NSInteger NSJapaneseEUCStringEncoding NSInteger NSNEXTSTEPStringEncoding NSInteger NSNonLossyASCIIStringEncoding NSInteger NSShiftJISStringEncoding NSInteger NSSymbolStringEncoding NSInteger NSUTF8StringEncoding NSInteger NSUnicodeStringEncoding NSInteger NSWindowsCP1250StringEncoding NSInteger NSWindowsCP1251StringEncoding NSInteger NSWindowsCP1252StringEncoding NSInteger NSWindowsCP1253StringEncoding NSInteger NSWindowsCP1254StringEncoding # Exception names id NSInconsistentArchiveException # id NSByteStoreLockedException # id NSByteStoreVersionException # id NSBTreeStoreKeyTooLargeException # id NSByteStoreDamagedException # id NSPosixFileOperationException id NSCharacterConversionException # id NSDestinationInvalidException id NSGenericException id NSInternalInconsistencyException id NSInvalidArgumentException # id NSInvalidReceivePort # id NSInvalidReceivePortException # id NSInvalidSendPort # id NSInvalidSendPortException id NSMallocException # id NSObjectInaccessibleException # id NSObjectNotAvailableException # id NSOldStyleException # id NSPortReceiveError # id NSPortReceiveException # id NSPortSendError # id NSPortSendException id NSPortTimeoutException id NSRangeException id NSFailedAuthenticationException # Notification names # id NSBundleLoaded id NSConnectionDidDieNotification id NSPortDidBecomeInvalidNotification # id NSPPLDidBecomeDirtyNotification # id NSPPLDidSaveNotification id NSBecomingMultiThreaded id NSThreadExiting id NSGlobalDomain id NSArgumentDomain id NSRegistrationDomain NSInteger NSApplicationDirectory NSInteger NSDemoApplicationDirectory NSInteger NSDeveloperApplicationDirectory NSInteger NSAdminApplicationDirectory NSInteger NSLibraryDirectory NSInteger NSDeveloperDirectory NSInteger NSUserDirectory NSInteger NSDocumentationDirectory NSInteger NSAllApplicationsDirectory NSInteger NSAllLibrariesDirectory NSInteger GSLibrariesDirectory NSInteger GSToolsDirectory NSInteger NSUserDomainMask NSInteger NSLocalDomainMask NSInteger NSNetworkDomainMask NSInteger NSSystemDomainMask NSInteger NSAllDomainsMask StepTalk-0.10.0/Modules/Foundation/.cvsignore0000664000175000017500000000010514633027767020134 0ustar yavoryavor*.app *.debug *.profile shared_*obj *.bundle *.stmodule *.stlanguage StepTalk-0.10.0/Modules/Foundation/Functions.h0000664000175000017500000000256714633027767020273 0ustar yavoryavor/** Functions.m Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Nov 14 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 NSDictionary; @class NSString; #define _STCreateConstantsDictionaryForType(t, v, n, c) \ _ST_##t##_namesDictionary(v, n, c); #define function_header(type) \ NSDictionary *_ST_##type##_namesDictionary(type *vals, \ NSString **names, \ int count) function_header(int); function_header(float); function_header(id); StepTalk-0.10.0/Modules/Foundation/header.m0000664000175000017500000000554314633027767017555 0ustar yavoryavor/** @@NAME@@.m NOTE: Do not edit this file, it is automaticaly generated. 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 NSDictionary *STGet@@NAME@@(void) { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; Class numberClass = [NSNumber class]; IMP numberWithInteger; IMP numberWithFloat; IMP setObject_forKey; SEL numberWithInteger_sel = @selector(numberWithInteger:); SEL numberWithFloat_sel = @selector(numberWithFloat:); SEL setObject_forKey_sel = @selector(setObject:forKey:); numberWithInteger = [NSNumber methodForSelector:numberWithInteger_sel]; numberWithFloat = [NSNumber methodForSelector:numberWithFloat_sel]; setObject_forKey = [dict methodForSelector:setObject_forKey_sel]; #define ADD_id_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, obj, name) #define ADD_NSInteger_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithInteger(numberClass, numberWithInteger_sel, obj), \ name) #define ADD_float_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithFloat(numberClass, numberWithFloat_sel, obj), \ name) #define ADD_NSPoint_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ [NSValue valueWithPoint:obj], \ name) #define ADD_NSRange_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ [NSValue valueWithRange:obj], \ name) #define ADD_NSSize_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ [NSValue valueWithSize:obj], \ name) #define ADD_NSRect_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ [NSValue valueWithRect:obj], \ name) StepTalk-0.10.0/Modules/Foundation/Functions.m0000664000175000017500000000377514633027767020302 0ustar yavoryavor/** Functions.m Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2001 Nov 14 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 #define function_template(type, class, selector) \ NSDictionary *_ST_##type##_namesDictionary(type *vals, \ NSString **names, \ int count) \ { \ NSMutableDictionary *dict = [NSMutableDictionary dictionary]; \ \ for(i = 0; i NSDictionary *STGetFoundationConstants(void) { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; Class numberClass = [NSNumber class]; IMP numberWithInteger; IMP numberWithFloat; IMP setObject_forKey; SEL numberWithInteger_sel = @selector(numberWithInteger:); SEL numberWithFloat_sel = @selector(numberWithFloat:); SEL setObject_forKey_sel = @selector(setObject:forKey:); numberWithInteger = [NSNumber methodForSelector:numberWithInteger_sel]; numberWithFloat = [NSNumber methodForSelector:numberWithFloat_sel]; setObject_forKey = [dict methodForSelector:setObject_forKey_sel]; #define ADD_id_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, obj, name) #define ADD_NSInteger_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithInteger(numberClass, numberWithInteger_sel, obj), \ name) #define ADD_float_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithFloat(numberClass, numberWithInt_sel, obj), \ name) #define ADD_NSPoint_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ [NSValue valueWithPoint:obj], \ name) #define ADD_NSRange_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ [NSValue valueWithRange:obj], \ name) #define ADD_NSSize_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ [NSValue valueWithSize:obj], \ name) #define ADD_NSRect_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ [NSValue valueWithRect:obj], \ name) ADD_NSInteger_OBJECT(NO,@"NO"); ADD_NSInteger_OBJECT(YES,@"YES"); ADD_NSPoint_OBJECT(NSZeroPoint,@"NSZeroPoint"); ADD_NSSize_OBJECT(NSZeroSize,@"NSZeroSize"); ADD_NSRect_OBJECT(NSZeroRect,@"NSZeroRect"); ADD_NSInteger_OBJECT(NSOrderedAscending,@"NSOrderedAscending"); ADD_NSInteger_OBJECT(NSOrderedSame,@"NSOrderedSame"); ADD_NSInteger_OBJECT(NSOrderedDescending,@"NSOrderedDescending"); ADD_NSInteger_OBJECT(NSNotFound,@"NSNotFound"); ADD_NSInteger_OBJECT(NSMinXEdge,@"NSMinXEdge"); ADD_NSInteger_OBJECT(NSMinYEdge,@"NSMinYEdge"); ADD_NSInteger_OBJECT(NSMaxXEdge,@"NSMaxXEdge"); ADD_NSInteger_OBJECT(NSMaxYEdge,@"NSMaxYEdge"); ADD_NSInteger_OBJECT(NS_UnknownByteOrder,@"NS_UnknownByteOrder"); ADD_NSInteger_OBJECT(NS_LittleEndian,@"NS_LittleEndian"); ADD_NSInteger_OBJECT(NS_BigEndian,@"NS_BigEndian"); ADD_NSInteger_OBJECT(NSOpenStepUnicodeReservedBase,@"NSOpenStepUnicodeReservedBase"); ADD_NSInteger_OBJECT(NSCaseInsensitiveSearch,@"NSCaseInsensitiveSearch"); ADD_NSInteger_OBJECT(NSLiteralSearch,@"NSLiteralSearch"); ADD_NSInteger_OBJECT(NSBackwardsSearch,@"NSBackwardsSearch"); ADD_NSInteger_OBJECT(NSAnchoredSearch,@"NSAnchoredSearch"); ADD_id_OBJECT(NSAMPMDesignation,@"NSAMPMDesignation"); ADD_id_OBJECT(NSCurrencyString,@"NSCurrencyString"); ADD_id_OBJECT(NSCurrencySymbol,@"NSCurrencySymbol"); ADD_id_OBJECT(NSDateFormatString,@"NSDateFormatString"); ADD_id_OBJECT(NSDateTimeOrdering,@"NSDateTimeOrdering"); ADD_id_OBJECT(NSDecimalDigits,@"NSDecimalDigits"); ADD_id_OBJECT(NSDecimalSeparator,@"NSDecimalSeparator"); ADD_id_OBJECT(NSEarlierTimeDesignations,@"NSEarlierTimeDesignations"); ADD_id_OBJECT(NSHourNameDesignations,@"NSHourNameDesignations"); ADD_id_OBJECT(NSInternationalCurrencyString,@"NSInternationalCurrencyString"); ADD_id_OBJECT(NSLaterTimeDesignations,@"NSLaterTimeDesignations"); ADD_id_OBJECT(NSMonthNameArray,@"NSMonthNameArray"); ADD_id_OBJECT(NSNextDayDesignations,@"NSNextDayDesignations"); ADD_id_OBJECT(NSNextNextDayDesignations,@"NSNextNextDayDesignations"); ADD_id_OBJECT(NSPriorDayDesignations,@"NSPriorDayDesignations"); ADD_id_OBJECT(NSShortMonthNameArray,@"NSShortMonthNameArray"); ADD_id_OBJECT(NSShortTimeDateFormatString,@"NSShortTimeDateFormatString"); ADD_id_OBJECT(NSShortWeekDayNameArray,@"NSShortWeekDayNameArray"); ADD_id_OBJECT(NSThisDayDesignations,@"NSThisDayDesignations"); ADD_id_OBJECT(NSThousandsSeparator,@"NSThousandsSeparator"); ADD_id_OBJECT(NSTimeDateFormatString,@"NSTimeDateFormatString"); ADD_id_OBJECT(NSTimeFormatString,@"NSTimeFormatString"); ADD_id_OBJECT(NSWeekDayNameArray,@"NSWeekDayNameArray"); ADD_id_OBJECT(NSYearMonthWeekDesignations,@"NSYearMonthWeekDesignations"); ADD_id_OBJECT(NSFileDeviceIdentifier,@"NSFileDeviceIdentifier"); ADD_id_OBJECT(NSFileGroupOwnerAccountID,@"NSFileGroupOwnerAccountID"); ADD_id_OBJECT(NSFileModificationDate,@"NSFileModificationDate"); ADD_id_OBJECT(NSFileOwnerAccountID,@"NSFileOwnerAccountID"); ADD_id_OBJECT(NSFilePosixPermissions,@"NSFilePosixPermissions"); ADD_id_OBJECT(NSFileReferenceCount,@"NSFileReferenceCount"); ADD_id_OBJECT(NSFileSize,@"NSFileSize"); ADD_id_OBJECT(NSFileSystemFileNumber,@"NSFileSystemFileNumber"); ADD_id_OBJECT(NSFileSystemNumber,@"NSFileSystemNumber"); ADD_id_OBJECT(NSFileType,@"NSFileType"); ADD_id_OBJECT(NSFileTypeBlockSpecial,@"NSFileTypeBlockSpecial"); ADD_id_OBJECT(NSFileTypeCharacterSpecial,@"NSFileTypeCharacterSpecial"); ADD_id_OBJECT(NSFileTypeDirectory,@"NSFileTypeDirectory"); ADD_id_OBJECT(NSFileTypeRegular,@"NSFileTypeRegular"); ADD_id_OBJECT(NSFileTypeSocket,@"NSFileTypeSocket"); ADD_id_OBJECT(NSFileTypeSymbolicLink,@"NSFileTypeSymbolicLink"); ADD_id_OBJECT(NSFileTypeUnknown,@"NSFileTypeUnknown"); ADD_id_OBJECT(NSFileSystemSize,@"NSFileSystemSize"); ADD_id_OBJECT(NSFileSystemFreeSize,@"NSFileSystemFreeSize"); ADD_id_OBJECT(NSFileSystemNodes,@"NSFileSystemNodes"); ADD_id_OBJECT(NSFileSystemFreeNodes,@"NSFileSystemFreeNodes"); ADD_NSInteger_OBJECT(NSASCIIStringEncoding,@"NSASCIIStringEncoding"); ADD_NSInteger_OBJECT(NSISO2022JPStringEncoding,@"NSISO2022JPStringEncoding"); ADD_NSInteger_OBJECT(NSISOLatin1StringEncoding,@"NSISOLatin1StringEncoding"); ADD_NSInteger_OBJECT(NSISOLatin2StringEncoding,@"NSISOLatin2StringEncoding"); ADD_NSInteger_OBJECT(NSJapaneseEUCStringEncoding,@"NSJapaneseEUCStringEncoding"); ADD_NSInteger_OBJECT(NSNEXTSTEPStringEncoding,@"NSNEXTSTEPStringEncoding"); ADD_NSInteger_OBJECT(NSNonLossyASCIIStringEncoding,@"NSNonLossyASCIIStringEncoding"); ADD_NSInteger_OBJECT(NSShiftJISStringEncoding,@"NSShiftJISStringEncoding"); ADD_NSInteger_OBJECT(NSSymbolStringEncoding,@"NSSymbolStringEncoding"); ADD_NSInteger_OBJECT(NSUTF8StringEncoding,@"NSUTF8StringEncoding"); ADD_NSInteger_OBJECT(NSUnicodeStringEncoding,@"NSUnicodeStringEncoding"); ADD_NSInteger_OBJECT(NSWindowsCP1250StringEncoding,@"NSWindowsCP1250StringEncoding"); ADD_NSInteger_OBJECT(NSWindowsCP1251StringEncoding,@"NSWindowsCP1251StringEncoding"); ADD_NSInteger_OBJECT(NSWindowsCP1252StringEncoding,@"NSWindowsCP1252StringEncoding"); ADD_NSInteger_OBJECT(NSWindowsCP1253StringEncoding,@"NSWindowsCP1253StringEncoding"); ADD_NSInteger_OBJECT(NSWindowsCP1254StringEncoding,@"NSWindowsCP1254StringEncoding"); ADD_id_OBJECT(NSInconsistentArchiveException,@"NSInconsistentArchiveException"); ADD_id_OBJECT(NSCharacterConversionException,@"NSCharacterConversionException"); ADD_id_OBJECT(NSGenericException,@"NSGenericException"); ADD_id_OBJECT(NSInternalInconsistencyException,@"NSInternalInconsistencyException"); ADD_id_OBJECT(NSInvalidArgumentException,@"NSInvalidArgumentException"); ADD_id_OBJECT(NSMallocException,@"NSMallocException"); ADD_id_OBJECT(NSPortTimeoutException,@"NSPortTimeoutException"); ADD_id_OBJECT(NSRangeException,@"NSRangeException"); ADD_id_OBJECT(NSFailedAuthenticationException,@"NSFailedAuthenticationException"); ADD_id_OBJECT(NSConnectionDidDieNotification,@"NSConnectionDidDieNotification"); ADD_id_OBJECT(NSPortDidBecomeInvalidNotification,@"NSPortDidBecomeInvalidNotification"); ADD_id_OBJECT(NSBecomingMultiThreaded,@"NSBecomingMultiThreaded"); ADD_id_OBJECT(NSThreadExiting,@"NSThreadExiting"); ADD_id_OBJECT(NSGlobalDomain,@"NSGlobalDomain"); ADD_id_OBJECT(NSArgumentDomain,@"NSArgumentDomain"); ADD_id_OBJECT(NSRegistrationDomain,@"NSRegistrationDomain"); ADD_NSInteger_OBJECT(NSApplicationDirectory,@"NSApplicationDirectory"); ADD_NSInteger_OBJECT(NSDemoApplicationDirectory,@"NSDemoApplicationDirectory"); ADD_NSInteger_OBJECT(NSDeveloperApplicationDirectory,@"NSDeveloperApplicationDirectory"); ADD_NSInteger_OBJECT(NSAdminApplicationDirectory,@"NSAdminApplicationDirectory"); ADD_NSInteger_OBJECT(NSLibraryDirectory,@"NSLibraryDirectory"); ADD_NSInteger_OBJECT(NSDeveloperDirectory,@"NSDeveloperDirectory"); ADD_NSInteger_OBJECT(NSUserDirectory,@"NSUserDirectory"); ADD_NSInteger_OBJECT(NSDocumentationDirectory,@"NSDocumentationDirectory"); ADD_NSInteger_OBJECT(NSAllApplicationsDirectory,@"NSAllApplicationsDirectory"); ADD_NSInteger_OBJECT(NSAllLibrariesDirectory,@"NSAllLibrariesDirectory"); ADD_NSInteger_OBJECT(GSLibrariesDirectory,@"GSLibrariesDirectory"); ADD_NSInteger_OBJECT(GSToolsDirectory,@"GSToolsDirectory"); ADD_NSInteger_OBJECT(NSUserDomainMask,@"NSUserDomainMask"); ADD_NSInteger_OBJECT(NSLocalDomainMask,@"NSLocalDomainMask"); ADD_NSInteger_OBJECT(NSNetworkDomainMask,@"NSNetworkDomainMask"); ADD_NSInteger_OBJECT(NSSystemDomainMask,@"NSSystemDomainMask"); ADD_NSInteger_OBJECT(NSAllDomainsMask,@"NSAllDomainsMask"); return dict; } /* -- End of file -- */ StepTalk-0.10.0/Modules/GDL2/0000775000175000017500000000000014633027767014522 5ustar yavoryavorStepTalk-0.10.0/Modules/GDL2/STGDL2Module.m0000664000175000017500000000272014633027767017006 0ustar yavoryavor/** STGDL2Module.m GDL bindings Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2002 Nov 29 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 "STGDL2Module.h" #import #import extern NSDictionary *STGetGDL2Constants(); @class EODatabase; @class EOQualifier; @implementation STGDL2Module + (void)initialize { [EODatabase class]; [EOQualifier class]; } + (NSDictionary *)namedObjectsForScripting { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; [dict addEntriesFromDictionary:STGetGDL2Constants()]; return [NSDictionary dictionaryWithDictionary:dict]; } @end StepTalk-0.10.0/Modules/GDL2/STGDL2Module.h0000664000175000017500000000201714633027767017000 0ustar yavoryavor/** STGDL2Module.h GDL bindings Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2002 Nov 29 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 STGDL2Module:NSObject { } @end StepTalk-0.10.0/Modules/GDL2/GDL2.stenv0000664000175000017500000000035114633027767016272 0ustar yavoryavor/** GDL2.stenv To use: > stexec -env GDL2 script_name or > stshell -env GDL2 */ { Name = "GDL2"; /* Finders = (DistributedFinder); */ Modules = (GDL2, ObjectiveC); Use = ("Standard"); } StepTalk-0.10.0/Modules/GDL2/ScriptingInfo.plist0000664000175000017500000000370714633027767020364 0ustar yavoryavor{ ScriptingInfoClass = STGDL2Module; Classes = ( /* Classes from EOAccess */ EOAccessArrayFaultHandler, EOAccessFaultHandler, EOAccessGenericFaultHandler, EOAdaptor, EOAdaptor, EOAdaptorChannel, EOAdaptorContext, EOAdaptorOperation, EOAndQualifier, EOAttribute, EODatabase, EODatabaseChannel, EODatabaseContext, EODatabaseDataSource, EODatabaseOperation, EOEditingContext, EOEntity, EOEntityClassDescription, EOExpressionArray, EOJoin, EOKeyComparisonQualifier, EOKeyValueQualifier, /* EOLoginPanel, */ EOModel, EOModelGroup, EONotQualifier, EOObjectStoreCoordinator, EOOrQualifier, EORelationship, EOSQLExpression, EOSQLQualifier, EOStoredProcedure, /* Classees from EOControl */ EOAndQualifier, EOCheapCopyArray, EOCheapCopyMutableArray, EOClassDescription, EOCooperatingObjectStore, EODataSource, /* EODelayedObserver, */ /* EODelayedObserverQueue, */ EODetailDataSource, EOEditingContext, EOFault, EOFaultHandler, EOFetchSpecification, EOGenericRecord, EOGlobalID, EOKeyComparisonQualifier, EOKeyGlobalID, EOKeyValueArchiver, EOKeyValueQualifier, EOKeyValueUnarchiver, EOMKKDArrayMapping, EOMKKDInitializer, EOMKKDKeyEnumerator, EOMKKDSubsetMapping, EOMutableKnownKeyDictionary, EONotQualifier, EONull, EOObjectStore, EOObjectStoreCoordinator, EOObserverCenter, /* EOObserverProxy, */ EOOrQualifier, EOQualifier, EOQualifierVariable, EOSortOrdering, EOTemporaryGlobalID, EOUndoManager ); } StepTalk-0.10.0/Modules/GDL2/GNUmakefile0000664000175000017500000000363714633027767016605 0ustar yavoryavor# # GDL2 module # # Copyright (C) 2002 Stefan Urbanek # # Author: Stefan Urbanek # Date: 2002 Nov 29 # # 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 = GDL2 GDL2_OBJC_FILES = \ STGDL2Module.m \ GDL2Constants.m GDL2_PRINCIPAL_CLASS = STGDL2Module GDL2_RESOURCE_FILES = ScriptingInfo.plist ADDITIONAL_NATIVE_LIBS += EOAccess EOControl EOModeler BUNDLE_LIBS += -lStepTalk ADDITIONAL_INCLUDE_DIRS += -I../../Frameworks/ ADDITIONAL_LIB_DIRS += -L../../Frameworks/StepTalk/StepTalk.framework/Versions/Current/$(GNUSTEP_TARGET_LDIR) BUNDLE_INSTALL_DIR:=$(GNUSTEP_LIBRARY)/StepTalk/Modules ADDITIONAL_OBJCFLAGS = -Wall -Wno-import # Include gdl2.make IF there -include $(GNUSTEP_MAKEFILES)/Auxiliary/gdl2.make # If gdl2.make was included, compile the bundle; else, do nothing ifneq ($(GDL2_VERSION),) include $(GNUSTEP_MAKEFILES)/bundle.make else include $(GNUSTEP_MAKEFILES)/rules.make endif GDL2Constants.m : GDL2Constants.list %.m : %.list @( echo Creating $@ ...; \ cat header.m | sed "s/@@NAME@@/`basename $< .list`/g" > $@; \ cat $< | awk -f create_constants.awk >> $@;\ cat footer.m >> $@; ) StepTalk-0.10.0/Modules/GDL2/footer.m0000664000175000017500000000005514633027767016176 0ustar yavoryavor return dict; } /* -- End of file -- */ StepTalk-0.10.0/Modules/GDL2/create_constants.awk0000664000175000017500000000017114633027767020564 0ustar yavoryavor($0 !~ /^[\t ]*#.*$/) && ($0 !~ /^[\t ]*$/) && (NF == 2) { printf " ADD_%s_OBJECT(%s,@\"%s\");\n", $1, $2, $2 } StepTalk-0.10.0/Modules/GDL2/GDL2Constants.m0000664000175000017500000000557414633027767017300 0ustar yavoryavor/** GDL2Constants.m NOTE: Do not edit this file, it is automaticaly generated. 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 NSDictionary *STGetGDL2Constants(void) { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; Class numberClass = [NSNumber class]; IMP numberWithInt; IMP numberWithFloat; IMP setObject_forKey; SEL numberWithInt_sel = @selector(numberWithInt:); SEL numberWithFloat_sel = @selector(numberWithFloat:); SEL setObject_forKey_sel = @selector(setObject:forKey:); numberWithInt = [numberClass methodForSelector:numberWithInt_sel]; numberWithFloat = [numberClass methodForSelector:numberWithFloat_sel]; setObject_forKey = [dict methodForSelector:setObject_forKey_sel]; #define ADD_id_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, obj, name) #define ADD_int_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithInt(numberClass, numberWithInt_sel, obj), \ name) #define ADD_float_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithFloat(numberClass, numberWithInt_sel, obj), \ name) #define ADD_NSPoint_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ [NSValue valueWithPoint:obj], \ name) #define ADD_NSRange_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ [NSValue valueWithRange:obj], \ name) #define ADD_NSSize_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ [NSValue valueWithSize:obj], \ name) #define ADD_NSRect_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ [NSValue valueWithRect:obj], \ name) return dict; } /* -- End of file -- */ StepTalk-0.10.0/Modules/GDL2/header.m0000664000175000017500000000553514633027767016140 0ustar yavoryavor/** @@NAME@@.m NOTE: Do not edit this file, it is automaticaly generated. 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 NSDictionary *STGet@@NAME@@(void) { NSMutableDictionary *dict = [NSMutableDictionary dictionary]; Class numberClass = [NSNumber class]; IMP numberWithInteger; IMP numberWithFloat; IMP setObject_forKey; SEL numberWithInteger_sel = @selector(numberWithInteger:); SEL numberWithFloat_sel = @selector(numberWithFloat:); SEL setObject_forKey_sel = @selector(setObject:forKey:); numberWithInteger = [NSNumber methodForSelector:numberWithInteger_sel]; numberWithFloat = [NSNumber methodForSelector:numberWithFloat_sel]; setObject_forKey = [dict methodForSelector:setObject_forKey_sel]; #define ADD_id_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, obj, name) #define ADD_int_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithInteger(numberClass, numberWithInteger_sel, obj), \ name) #define ADD_float_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ numberWithFloat(numberClass, numberWithFloat_sel, obj), \ name) #define ADD_NSPoint_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ [NSValue valueWithPoint:obj], \ name) #define ADD_NSRange_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ [NSValue valueWithRange:obj], \ name) #define ADD_NSSize_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ [NSValue valueWithSize:obj], \ name) #define ADD_NSRect_OBJECT(obj, name) \ setObject_forKey(dict, setObject_forKey_sel, \ [NSValue valueWithRect:obj], \ name) StepTalk-0.10.0/Modules/GDL2/GNUmakefile.postamble0000664000175000017500000000341614633027767020565 0ustar yavoryavor# # GNUmakefile.postamble # # 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; see the file COPYING.LIB. # If not, write to the Free Software Foundation, # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # Project specific makefile rules # # Uncomment the targets you want. # The double colons (::) are important, do not make them single colons # otherwise the normal makefile rules will not be performed. # # Things to do before compiling # before-all:: # Things to do after compiling # after-all:: # Things to do before installing # before-install:: # Things to do after installing after-install:: @(echo Copying scripting environments...; \ cp GDL2.stenv $(GNUSTEP_LIBRARY)/StepTalk/Environments; \ ) # Things to do before uninstalling # before-uninstall:: # Things to do after uninstalling # after-uninstall:: # Things to do before cleaning # before-clean:: # Things to do after cleaning # after-clean:: # Things to do before distcleaning # before-distclean:: # Things to do after distcleaning # after-distclean:: # Things to do before checking # before-check:: # Things to do after checking # after-check:: StepTalk-0.10.0/Modules/GDL2/GDL2Constants.list0000664000175000017500000000003314633027767020000 0ustar yavoryavor# GDL2 constants # # None StepTalk-0.10.0/COPYING0000664000175000017500000006347414633027767013473 0ustar yavoryavor 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! StepTalk-0.10.0/.dist-ignore0000664000175000017500000000015314633027767014646 0ustar yavoryavorCVS obj shared_obj shared_debug_obj *.app *.debug *.bundle *.o New Old Extensions .snap-ignore .stlanguage StepTalk-0.10.0/.cvsignore0000664000175000017500000000011614633027767014420 0ustar yavoryavor*.app *.debug *.profile shared_*obj *.bundle *.stmodule *.stlanguage New Old StepTalk-0.10.0/ApplicationScripting/0000775000175000017500000000000014633027767016550 5ustar yavoryavorStepTalk-0.10.0/ApplicationScripting/Version0000664000175000017500000000051414633027767020120 0ustar yavoryavor# This file is included in various Makefile's to get version information. # Compatible with Bourne shell syntax, so it can included there too. # The version number of this release. MAJOR_VERSION=0 MINOR_VERSION=2 SUBMINOR_VERSION=0 APPTALK_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION} VERSION=${APPTALK_VERSION} StepTalk-0.10.0/ApplicationScripting/ChangeLog0000664000175000017500000001171514633027767020327 0ustar yavoryavor2013-05-26 Wolfgang Lux > * Source/STScriptsPanel.m: int->NSInteger transition 2013-04-03 Wolfgang Lux * Source/STApplicationScriptingController.m (-scriptingMenu): Hide the scripting menu after it has been loaded from its bundle. 2013-03-23 Wolfgang Lux * Source/STApplicationScriptingController.m (-init): * Source/STScriptsPanel.m (-init): * Source/STTranscript.m (-init): Check the result of the super class initializer and assign it to self. * Source/STScriptsPanel.m (-dealloc): Fix a space leak. 2012-02-07 Wolfgang Lux * Source/STTranscript.m (-showError:): Fix space leak detected by clang. 2012-01-15 Wolfgang Lux * Source/STScriptsPanel.m (-selectScript:): Validate Run button of the scripts panel. 2012-01-15 Wolfgang Lux * Source/STApplicationScriptingController.m (-scriptingMenu): Protect against GNUstep stubbornly replacing the application's main menu. * Source/STScriptsPanel.m (-selectScript:): Handle case where the script's description is nil. 2012-01-15 Wolfgang Lux * Source/STTranscript.h (-window): * Source/NSApplication+additions.h (-applicationNameForScripting): Declare public methods. * Source/NSApplication+additions.m (-applicationNameForScripting): Fix typo in method name. * Source/NSApplication+additions.m (-_createDefaultScriptingEnvironment): Fix to no longer use methods which were removed when adding STConversation. * Source/STApplicationScriptingController.m (-executeScript:, -executeScriptString:inEnvironment:): Update for changes when STLanguage was removed and STContext was introduced. * Source/STApplicationScriptingController.h (-executeScript:): * Source/STApplicationScriptingController.m (-executeScript:): The method expects an STFileScript. * Source/STScriptsPanel.h (-selectedScript): * Source/STScriptsPanel.m (-run, -selectScript, -browse, -selectedScript): Method seletecedScript returns a STFileScript. 2003 May 2 Stefan Urbanek * Added 'Objects' searching in application. * Added ScriptingInfo.plist template * GNUmakefile: removed inclusion of source-distribution.make 2003 May 1 Stefan Urbanek * Support: updated files to use #include instead of #import 2003 Apr 04 David Ayers * GNUmakefile: Added flags to be able to compile from the building directories and show all warnings except for import. * NSApplication+additions.h: Added missing declaration. * NSApplication+additions.m: Added import of needed headers. Removed and commented unused variables to supress compiler warnings. Corrected variable types and added necessary casts. * NSObject+NibLoading.m: Added missing import. * NSTextView+ScriptExecution.m: Removed unused variables. * STAppScriptingSupport.m: Added missing import. * STApplicationScriptingController.m: Ditto. * STEnvironment+additions.m: Ditto. * STScriptsPanel.h: Added missing declarations. * STScriptsPanel.m: Added missing imports. Removed unused variables. * STScriptingSupport.m: Added interface declaraions to supress compiler warnings. * STTranscript.h: Added missing declarations. * STTranscript.m: Added missing imports. 2003 Mar 27 Stefan Urbanek * ScriptsPanel.gorm: disallow multiple selection in scripts list. It was not possible to get index of selected cell, because of -gui b0rk. 2003 Mar 24 Stefan Urbanek * GNUmakefile*: Removed unnecessary stuff * Documentation: Moved relevant docs into StepTalk documentation. Removed the directory. 2003 Mar 23 Stefan Urbanek * Added ScriptingMenu.gorm * NSApplication: new methods: scriptingMenu and setScriptingMenu: * Added 'Do selection' and 'Do and show selection' methods for NSTextView 2003 Mar 23 Stefan Urbanek * Rewritten and changed from library to bundle. 2002 Jun 18 Stefan Urbanek * STScriptsManager: removed methods that are implemented in StepTalk * STScript: moved to StepTalk 2002 May 24 Stefan Urbanek * STScriptsManager: reflex renamed method in StepTalk 2002 Apr 13 Stefan Urbanek * Created ScriptingSupport bundle * Created Support/ScriptingSupport.m for loading application scripting support * Updated Ink.app example to use loading of scripting support 2002 Apr 12 Stefan Urbanek * STScriptsManager: Look for scripts also in all loaded bundles * NSApplication+additions: Update scripting information from all bundles. Read scripting info when new bundle is loaded. 2002 Apr 12 Stefan Urbanek * ChangeLog started StepTalk-0.10.0/ApplicationScripting/Source/0000775000175000017500000000000014633027767020010 5ustar yavoryavorStepTalk-0.10.0/ApplicationScripting/Source/NSObject+NibLoading.h0000664000175000017500000000200314633027767023625 0ustar yavoryavor/** NSObject+NibLoading Copyright (c) 2002 Stefan Urbanek Written by: Stefan Urbanek Date: 2002 Oct 10 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 Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #import @interface NSObject(AFNibLoading) - (BOOL)loadMyNibNamed:(NSString *)aName; @end StepTalk-0.10.0/ApplicationScripting/Source/GNUmakefile0000664000175000017500000000401014633027767022055 0ustar yavoryavor# # GNUmakefile # # 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., 59 Temple Place, Suite 330, Boston, MA 02111 USA. include $(GNUSTEP_MAKEFILES)/common.make include $(GNUSTEP_MAKEFILES)/Additional/gui.make include ../Version BUNDLE_NAME = ApplicationScripting ApplicationScripting_OBJC_FILES = \ NSApplication+additions.m \ NSObject+NibLoading.m \ STAppScriptingSupport.m \ STApplicationScriptingController.m \ STEnvironment+additions.m \ STScriptsPanel.m \ NSTextView+ScriptExecution.m \ STTranscript.m ApplicationScripting_BUNDLE_LIBS = -lStepTalk $(GUI_LIBS) ADDITIONAL_INCLUDE_DIRS += -I../../Frameworks/ ADDITIONAL_LIB_DIRS += -L../../Frameworks/StepTalk/StepTalk.framework/Versions/Current/$(GNUSTEP_TARGET_LDIR) ApplicationScripting_LANGUAGES = English ApplicationScripting_RESOURCE_FILES = ScriptingInfo.plist ApplicationScripting_LOCALIZED_RESOURCE_FILES = \ ScriptsPanel.gorm \ TranscriptWindow.gorm \ ScriptingMenu.gorm \ # ApplicationScripting.xlp \ # StepTalk.tiff ADDITIONAL_INCLUDE_DIRS += -I../../Source/Headers ADDITIONAL_TOOL_LIBS += -lStepTalk ADDITIONAL_LIB_DIRS += -L../../Source/$(GNUSTEP_OBJ_DIR) ADDITIONAL_OBJCFLAGS = -Wall -Wno-import -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/bundle.make -include GNUmakefile.postamble StepTalk-0.10.0/ApplicationScripting/Source/NSTextView+ScriptExecution.m0000664000175000017500000000447414633027767025343 0ustar yavoryavor/** NSTextView+ScriptExecution Application Scripting support - execution of selected text Copyright (c)2003 Stefan Urbanek Written by: Stefan Urbanek Date: 2003 Mar 23 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 "NSTextView+ScriptExecution.h" #import "NSApplication+additions.h" #import "STApplicationScriptingController.h" @implementation NSTextView(STScriptExecution) - (void)executeSelectionScript:(id)sender { STEnvironment *env; NSString *selectedString; NSRange range = [self selectedRange]; NSLog(@"Do!"); env = [NSApp scriptingEnvironment]; selectedString = [[self attributedSubstringFromRange:range] string]; [[NSApp scriptingController] executeScriptString:selectedString inEnvironment:env]; } - (void)executeAndShowSelectionScript:(id)sender { STEnvironment *env; NSString *selectedString; NSRange range = [self selectedRange]; id retval = nil; NSLog(@"Do and Show!"); env = [NSApp scriptingEnvironment]; selectedString = [[self attributedSubstringFromRange:range] string]; retval = [[NSApp scriptingController] executeScriptString:selectedString inEnvironment:env]; NSLog(@"Returned %@",retval); if([self isEditable]) { [self insertText:[retval description]]; } else { NSLog(@"Text is not editable!"); } } @end StepTalk-0.10.0/ApplicationScripting/Source/STScriptsPanel.h0000664000175000017500000000305014633027767023035 0ustar yavoryavor/** STScriptsPanel Copyright (c)2002 Stefan Urbanek Written by: Stefan Urbanek Date: 2002 Mar 15 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 STScriptsManager; @class STFileScript; @class NSPopUpButton; @interface STScriptsPanel : NSPanel { id scriptList; id descriptionText; id runButton; NSPopUpButton *commandMenu; id _panel; id delegate; STScriptsManager *scriptsManager; NSArray *scripts; } - (void) run: (id)sender; - (void) command: (id)sender; - (void) update: (id)sender; - (void) browse: (id)sender; - (void) showHelp: (id)sender; - (STFileScript *) selectedScript; - (void) setDelegate: (id)anObject; - (id) delegate; @end StepTalk-0.10.0/ApplicationScripting/Source/STApplicationScriptingController.m0000664000175000017500000001606514633027767026637 0ustar yavoryavor/** STApplicationScriptingController Copyright (c)2002 Stefan Urbanek Written by: Stefan Urbanek Date: 2003 Jan 26 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 "STApplicationScriptingController.h" #import #import #import #import #import #import #import #import #import #import #import "STScriptsPanel.h" #import "STTranscript.h" #import "NSObject+NibLoading.h" #import "NSApplication+additions.h" @implementation STApplicationScriptingController - init { if ((self = [super init]) != nil) { STBundleInfo *info; info = [STBundleInfo infoForBundle:[NSBundle mainBundle]]; objectRefereceDict = RETAIN([info objectReferenceDictionary]); } return self; } - (void)dealloc { RELEASE(objectRefereceDict); [super dealloc]; } - (void)createScriptsPanel { scriptsPanel = [[STScriptsPanel alloc] init]; [scriptsPanel setDelegate:self]; } - (void)orderFrontScriptsPanel:(id)sender { if(!scriptsPanel) { [self createScriptsPanel]; } [scriptsPanel makeKeyAndOrderFront:self]; } - (void)orderFrontTranscriptWindow:(id)sender { [[[STTranscript sharedTranscript] window] makeKeyAndOrderFront:self]; } - (STEnvironment *)actualScriptingEnvironment { SEL sel = @selector(scriptingEnvironment); id target; target = [NSApp delegate]; if( ! [target respondsToSelector:sel] ) { if( [NSApp respondsToSelector:sel] ) { target = NSApp; } else { NSLog(@"Application is not scriptable"); return nil; } } return [target scriptingEnvironment]; } - (void)setScriptingMenu:(NSMenu *)menu { ASSIGN(scriptingMenu, menu); } - (NSMenu *)scriptingMenu { if(!scriptingMenu) { // FIXME ScriptingMenu replaces the application's main menu when it is // loaded, since GNUstep stubbornly considers the first top level menu // in a gorm file to be the application's main menu. NSMenu *mainMenu = RETAIN([NSApp mainMenu]); NS_DURING { if(![self loadMyNibNamed:@"ScriptingMenu"]) { [NSApp setMainMenu:mainMenu]; RELEASE(mainMenu); return nil; } } NS_HANDLER { [NSApp setMainMenu:mainMenu]; RELEASE(mainMenu); [localException raise]; } NS_ENDHANDLER [NSApp setMainMenu:mainMenu]; RELEASE(mainMenu); [scriptingMenu close]; } return scriptingMenu; } /* FIXME: rewrite this */ - (void)updateObjectReferences { STEnvironment *env = [self actualScriptingEnvironment]; NSEnumerator *enumerator; NSString *name; NSString *object = nil; NSString *reference; id target; target = [NSApp delegate]; enumerator = [objectRefereceDict keyEnumerator]; while( (name = [enumerator nextObject]) ) { reference = [objectRefereceDict objectForKey:name]; NSLog(@"Adding reference '%@' object '%@'", name, reference); NS_DURING object = [target valueForKeyPath:reference]; [env setObject:object forName:name]; NS_HANDLER if([[localException name] isEqualToString:NSUndefinedKeyException]) { NSLog(@"Warning: Invalid object reference '%@'.", reference); } else { [localException raise]; } NS_ENDHANDLER } } /** Execute script script in actual scripting environment. If an exception occured, it will be logged into the Transcript window. */ - (id)executeScript:(STFileScript *)script { STEnvironment *env = [self actualScriptingEnvironment]; STEngine *engine; NSString *error; id retval; NSDebugLog(@"Execute a script '%@'", [script localizedName]); engine = [STEngine engineForLanguage:[script language]]; if(!engine) { NSLog(@"Unable to get scripting engine for language '%@'", [script language]); return nil; } if(!env) { NSLog(@"No scripting environment"); return nil; } NSDebugLog(@"Updating references"); [self updateObjectReferences]; #ifndef DEBUG_EXCEPTIONS NS_DURING #endif retval = [engine interpretScript:[script source] inContext:env]; #ifndef DEBUG_EXCEPTIONS NS_HANDLER error = [NSString stringWithFormat: @"Error: " @"Execution of script '%@' failed. %@. (%@)", [script localizedName], [localException reason], [localException name]]; [[STTranscript sharedTranscript] showError:error]; retval = nil; NS_ENDHANDLER #endif return retval; } /** Execute script string source in environment env. */ - (id)executeScriptString:(NSString *)source inEnvironment:(STEnvironment *)env { STEngine *engine; NSString *error; id retval = nil; engine = [STEngine engineForLanguage: [[STLanguageManager defaultManager] defaultLanguage]]; if(!engine) { NSLog(@"Unable to get scripting engine."); return nil; } if(!env) { NSLog(@"No scripting environment"); return nil; } NSLog(@"Updating references"); [self updateObjectReferences]; NS_DURING retval = [engine interpretScript:source inContext:env]; NS_HANDLER error = [NSString stringWithFormat: @"Error: " @"Execution of script failed. %@. (%@)", [localException reason], [localException name]]; [[STTranscript sharedTranscript] showError:error]; NSLog(@"Script exception: %@", error); retval = nil; NS_ENDHANDLER return retval; } @end StepTalk-0.10.0/ApplicationScripting/Source/STTranscript.h0000664000175000017500000000230714633027767022563 0ustar yavoryavor/** STTranscript Copyright (c) 2002 Stefan Urbanek Written by: Stefan Urbanek Date: 2002 Mar 20 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 NSWindow; @class NSTextView; @interface STTranscript:NSObject { NSWindow *window; NSTextView *textView; } + sharedTranscript; - show:(id)anObject; - showLine:(id)anObject; - showError:(NSString *)errorText; - (NSWindow *)window; @end StepTalk-0.10.0/ApplicationScripting/Source/NSApplication+additions.h0000664000175000017500000000260014633027767024635 0ustar yavoryavor/** NSApplication additions Copyright (c) 2000 Stefan Urbanek Written by: Stefan Urbanek Date: 2001 Nov 15 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; @class STApplicationScriptingController; @interface NSApplication(STAppScriptingAdditions) - (STEnvironment *)scriptingEnvironment; - (STApplicationScriptingController *)scriptingController; - (void)orderFrontScriptsPanel:(id)sender; - (void)orderFrontTranscriptWindow:(id)sender; - (NSMenu *)scriptingMenu; - (void)setScriptingMenu:(NSMenu *)menu; - (NSString *)applicationNameForScripting; @end StepTalk-0.10.0/ApplicationScripting/Source/STApplicationScriptingController.h0000664000175000017500000000303214633027767026620 0ustar yavoryavor/** STApplicationScriptingController Copyright (c)2002 Stefan Urbanek Written by: Stefan Urbanek Date: 2003 Jan 26 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 STScriptsPanel; @class STFileScript; @class STEnvironment; @class NSMenu; @class NSDictionary; @interface STApplicationScriptingController:NSObject { NSDictionary *objectRefereceDict; STScriptsPanel *scriptsPanel; NSMenu *scriptingMenu; } - (void)setScriptingMenu:(NSMenu *)menu; - (NSMenu *)scriptingMenu; - (void)orderFrontScriptsPanel:(id)sender; - (void)orderFrontTranscriptWindow:(id)sender; - (id)executeScript:(STFileScript *)script; - (id)executeScriptString:(NSString *)source inEnvironment:(STEnvironment *)env; @end StepTalk-0.10.0/ApplicationScripting/Source/STAppScriptingSupport.h0000664000175000017500000000200514633027767024425 0ustar yavoryavor/** AppScriptingSupport Copyright (c) 2002 Stefan Urbanek Written by: Stefan Urbanek Date: 2003 Jan 26 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 STAppScriptingSupport:NSObject { } @end StepTalk-0.10.0/ApplicationScripting/Source/STEnvironment+additions.h0000664000175000017500000000217014633027767024706 0ustar yavoryavor/** STEnvironment additions Copyright (c)2002 Stefan Urbanek Written by: Stefan Urbanek Date: 2002 Mar 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 STEnvironment(AppTalkAdditions) - (void)updateReferencesFromDictionary:(NSDictionary *)dict target:(id)target; @end StepTalk-0.10.0/ApplicationScripting/Source/STScriptsPanel.m0000664000175000017500000001306614633027767023052 0ustar yavoryavor/** STScriptsPanel Copyright (c)2002 Stefan Urbanek Written by: Stefan Urbanek Date: 2002 Mar 15 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 "STScriptsPanel.h" #import #import #import #import #import #import #import #import #import #import "NSObject+NibLoading.h" #import "STApplicationScriptingController.h" STScriptsPanel *sharedScriptsPanel = nil; @implementation STScriptsPanel + sharedScriptsPanel { if(!sharedScriptsPanel) { sharedScriptsPanel = [[STScriptsPanel alloc] init]; } return sharedScriptsPanel; } - init { if ((self = [super initWithContentRect:NSZeroRect styleMask:NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask backing:NSBackingStoreRetained defer:NO]) != nil) { NSView *view; NSRect frame; if (![self loadMyNibNamed:@"ScriptsPanel"]) { [self release]; return nil; } frame = [[(NSPanel *)_panel contentView] frame]; frame = [NSWindow frameRectForContentRect: frame styleMask: [self styleMask]]; [self setFrame: frame display: NO]; [self setTitle:[_panel title]]; [self setFrame:[_panel frame] display:YES]; [self setHidesOnDeactivate:YES]; view = RETAIN([_panel contentView]); [_panel setContentView:nil]; [self setContentView:view]; RELEASE(view); RELEASE(_panel); [self setFrameUsingName:@"STScriptsPanel"]; [self setFrameAutosaveName:@"STScriptsPanel"]; [scriptList setTarget:self]; [scriptList setAction:@selector(selectScript:)]; [scriptList setDoubleAction:@selector(run:)]; [scriptList setMaxVisibleColumns:1]; scriptsManager = RETAIN([STScriptsManager defaultManager]); [self update:nil]; } return self; } - (void)dealloc { RELEASE(scripts); RELEASE(scriptsManager); [super dealloc]; } - (void)setDelegate:(id)anObject { ASSIGN(delegate, anObject); } - (id)delegate { return delegate; } - (void)setScriptsManager:(STScriptsManager *)aManager { ASSIGN(scriptsManager,aManager); } - (STScriptsManager *)scriptsManager { return scriptsManager; } - (void) run: (id)sender { STFileScript *script = [self selectedScript]; if(script) { [delegate executeScript:script]; } } - (void) selectScript: (id)sender { STFileScript *script = [self selectedScript]; NSString *description = [script scriptDescription]; if (!description) description = @""; [descriptionText setString:description]; [runButton setEnabled:script ? YES : NO]; } - (void)command:(id)sender { switch([commandMenu indexOfSelectedItem]) { case 1: [self update:nil]; break; case 2: [self browse:nil]; break; case 3: [self showHelp:nil]; break; } } - (void)browse:(id)sender { NSWorkspace *ws = [NSWorkspace sharedWorkspace]; STFileScript *script = [self selectedScript]; NSString *path = [[script fileName] stringByDeletingLastPathComponent]; if(script) { [ws selectFile:[script fileName] inFileViewerRootedAtPath:path]; } } - (void)update:(id)sender { RELEASE(scripts); scripts = [scriptsManager allScripts]; scripts = [scripts sortedArrayUsingSelector: @selector(compareByLocalizedName:)]; RETAIN(scripts); [scriptList reloadColumn:0]; [self selectScript:nil]; } - (STFileScript *)selectedScript { if([scriptList selectedCell]) { return [scripts objectAtIndex:[scriptList selectedRowInColumn:0]]; } else { return 0; } } - (NSInteger) browser: (NSBrowser *) sender numberOfRowsInColumn: (NSInteger) column { return [scripts count]; } - (void) browser: (NSBrowser *) sender willDisplayCell: (NSBrowserCell *) cell atRow: (NSInteger) row column: (NSInteger) column { NSString *name; if(sender != scriptList) { NSLog(@"Invalid browser, not scriptList"); return; } [cell setLeaf:YES]; name = [[scripts objectAtIndex:row] localizedName]; [cell setStringValue:name]; } - (void)showHelp:(id)sender { NSBundle *bundle = [NSBundle bundleForClass:[self class]]; NSString *file; file = [bundle pathForResource: @"ApplicationScripting" ofType: @"xlp"]; if (file) { [[NSWorkspace sharedWorkspace] openFile: file]; return; } else { NSBeep(); } } @end StepTalk-0.10.0/ApplicationScripting/Source/STAppScriptingSupport.m0000664000175000017500000000242614633027767024441 0ustar yavoryavor/** AppScriptingSupport Copyright (c) 2002 Stefan Urbanek Written by: Stefan Urbanek Date: 2003 Jan 26 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 "STAppScriptingSupport.h" #import #import #import @implementation STAppScriptingSupport + (void)initialize { [STEnvironment class]; [STScriptsManager class]; } + (NSDictionary *)namedObjectsForScripting { return [NSDictionary dictionary]; } @end StepTalk-0.10.0/ApplicationScripting/Source/NSObject+NibLoading.m0000664000175000017500000000330714633027767023642 0ustar yavoryavor/** NSObject+NibLoading Copyright (c) 2002 Stefan Urbanek Written by: Stefan Urbanek Date: 2002 Oct 10 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 Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #import "NSObject+NibLoading.h" #import #import #import @implementation NSObject(AFNibLoading) - (BOOL)loadMyNibNamed:(NSString *)aName { NSDictionary *dict; NSBundle *bundle; BOOL flag; dict = [NSDictionary dictionaryWithObjectsAndKeys:self, @"NSOwner", nil, nil]; bundle = [NSBundle bundleForClass:[self class]]; flag = [bundle loadNibFile:aName externalNameTable:dict withZone:[self zone]]; if(!flag) { NSRunAlertPanel(@"Unable to load resources", @"Unable to load '%@' resources", @"Cancel", nil, nil, aName); } return flag; } @end StepTalk-0.10.0/ApplicationScripting/Source/STTranscript.m0000664000175000017500000000734114633027767022573 0ustar yavoryavor/** STTranscript Copyright (c) 2002 Stefan Urbanek Written by: Stefan Urbanek Date: 2002 Mar 20 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 "STTranscript.h" #import #import #import #import #import #import #import #import #import #import #import "NSObject+NibLoading.h" static STTranscript *sharedTranscript; static Class NSString_class; static Class NSNumber_class; static NSDictionary *errorTextAttributes; static NSDictionary *normalTextAttributes; @implementation STTranscript + (void)initialize { NSString_class = [NSString class]; NSNumber_class = [NSNumber class]; errorTextAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: [NSColor redColor], NSForegroundColorAttributeName, nil, nil]; normalTextAttributes = [[NSDictionary alloc] initWithObjectsAndKeys: [NSColor blackColor], NSForegroundColorAttributeName, nil, nil]; } + sharedTranscript { if(!sharedTranscript) { sharedTranscript = [[STTranscript alloc] init]; [sharedTranscript showLine:@"Shared scripting transcript."]; } return sharedTranscript; } - init { if ((self = [super init]) != nil) { if (![self loadMyNibNamed:@"TranscriptWindow"]) { [self release]; return nil; } [window setTitle:@"Scripting Transcript"]; [window setFrameUsingName:@"STTranscriptWindow"]; [window setFrameAutosaveName:@"STTranscriptWindow"]; /* FIXME: Fix Gorm autoresizing */ // [textView setAutoresizingMask: NSViewHeightSizable | NSViewWidthSizable]; } return self; } - show:(id)anObject { NSString *string; if( [anObject isKindOfClass:NSString_class] ) { string = anObject; } else if ( [anObject isKindOfClass:NSNumber_class] ) { string = [anObject stringValue]; } else { string = [anObject description]; } [textView insertText:string]; return self; } - showLine:(id)anObject { [self show:anObject]; [textView insertText:@"\n"]; return self; } - (NSWindow *)window { return window; } - showError:(NSString *)errorText { NSAttributedString *astring; astring = [[NSAttributedString alloc] initWithString:errorText attributes:errorTextAttributes]; [textView insertText:astring]; RELEASE(astring); astring = [[NSAttributedString alloc] initWithString:@"\n" attributes:normalTextAttributes]; [textView insertText:astring]; RELEASE(astring); return self; } @end StepTalk-0.10.0/ApplicationScripting/Source/English.lproj/0000775000175000017500000000000014633027767022526 5ustar yavoryavorStepTalk-0.10.0/ApplicationScripting/Source/English.lproj/TranscriptWindow.gorm/0000775000175000017500000000000014633027767027012 5ustar yavoryavorStepTalk-0.10.0/ApplicationScripting/Source/English.lproj/TranscriptWindow.gorm/objects.gorm0000664000175000017500000000373214633027767031336 0ustar yavoryavorGNUstep archive00002905:00000016:00000032:00000001:01GSNibContainer1NSObject01NSMutableDictionary1 NSDictionary&01NSString&% NSOwner0±& %  STTranscript0±&% GSCustomClassMap0±&0±&% TextView01 NSTextView1NSText1NSView1 NSResponder% A˜  Cð€ Bî  Cð€ Bî&0 1 NSMutableArray1 NSArray&0 1 NSColor0 ±&% NSNamedColorSpace0 ±&% System0 ±&% textBackgroundColor  K–€ K–€0± ° ° 0±& %  textColor Cð€ K–€0±& %  ScrollView01 NSScrollView%  Cú Bî  Cú Bî&0± &01 NSClipView% A˜  Cð€ Bî A˜  Cð€ Bî&0± &°° 01 NSScroller1 NSControl%  A Bî  A Bî&0± &%01NSCell0±&01NSFont0±& %  Helvetica A`A`&&&&&&&&&°2 _doScroll:v12@0:4@8°% A A A A °0±& %  GormNSWindow01NSWindow%  Cú Bî& % C¦ C,0±%  Cú Bî  Cú Bî&0± &°0± ° 0 ±&% System0!±&% windowBackgroundColor0"±&% Window0#±& %  Transcript°# ?€ Aø F@ F@%0$1NSImage0%±&% NSApplicationIcon0&± &0'1NSNibConnector°0(±&% NSOwner0)±°0*±°0+1NSNibOutletConnector°(°0,±&% window0-±°(°0.±&% textView0/±°°(00±&% delegate01±°°02±&% initialFirstResponderStepTalk-0.10.0/ApplicationScripting/Source/English.lproj/TranscriptWindow.gorm/data.classes0000664000175000017500000000673214633027767031312 0ustar yavoryavor{ FirstResponder = { Actions = ( "activateContextHelpMode:", "alignCenter:", "alignJustified:", "alignLeft:", "alignRight:", "arrangeInFront:", "cancel:", "capitalizeWord:", "changeColor:", "changeFont:", "checkSpelling:", "close:", "complete:", "copy:", "copyFont:", "copyRuler:", "cut:", "delete:", "deleteBackward:", "deleteForward:", "deleteToBeginningOfLine:", "deleteToBeginningOfParagraph:", "deleteToEndOfLine:", "deleteToEndOfParagraph:", "deleteToMark:", "deleteWordBackward:", "deleteWordForward:", "deminiaturize:", "deselectAll:", "fax:", "hide:", "hideOtherApplications:", "indent:", "loosenKerning:", "lowerBaseline:", "lowercaseWord:", "makeKeyAndOrderFront:", "miniaturize:", "miniaturizeAll:", "moveBackward:", "moveBackwardAndModifySelection:", "moveDown:", "moveDownAndModifySelection:", "moveForward:", "moveForwardAndModifySelection:", "moveLeft:", "moveRight:", "moveToBeginningOfDocument:", "moveToBeginningOfLine:", "moveToBeginningOfParagraph:", "moveToEndOfDocument:", "moveToEndOfLine:", "moveToEndOfParagraph:", "moveUp:", "moveUpAndModifySelection:", "moveWordBackward:", "moveWordBackwardAndModifySelection:", "moveWordForward:", "moveWordForwardAndModifySelection:", "newDocument:", "ok:", "openDocument:", "orderBack:", "orderFront:", "orderFrontColorPanel:", "orderFrontDataLinkPanel:", "orderFrontFontPanel:", "orderFrontHelpPanel:", "orderFrontSharedMemoryPanel:", "orderFrontStandardAboutPanel:", "orderFrontStandardInfoPanel:", "orderOut:", "pageDown:", "pageUp:", "paste:", "pasteAsPlainText:", "pasteAsRichText:", "pasteFont:", "pasteRuler:", "performClose:", "performMiniaturize:", "performZoom:", "print:", "raiseBaseline:", "revertDocumentToSaved:", "runPageLayout:", "runToolbarCustomizationPalette:", "saveAllDocuments:", "saveDocument:", "saveDocumentAs:", "saveDocumentTo:", "scrollLineDown:", "scrollLineUp:", "scrollPageDown:", "scrollPageUp:", "scrollViaScroller:", "selectAll:", "selectLine:", "selectNextKeyView:", "selectParagraph:", "selectPreviousKeyView:", "selectText:", "selectText:", "selectToMark:", "selectWord:", "showContextHelp:", "showGuessPanel:", "showHelp:", "showWindow:", "stop:", "subscript:", "superscript:", "swapWithMark:", "takeDoubleValueFrom:", "takeFloatValueFrom:", "takeIntValueFrom:", "takeObjectValueFrom:", "takeStringValueFrom:", "terminate:", "tightenKerning:", "toggle:", "toggleContinuousSpellChecking:", "toggleRuler:", "toggleToolbarShown:", "toggleTraditionalCharacterShape:", "transpose:", "transposeWords:", "turnOffKerning:", "turnOffLigatures:", "underline:", "unhide:", "unhideAllApplications:", "unscript:", "uppercaseWord:", "useAllLigatures:", "useStandardKerning:", "useStandardLigatures:", "yank:", "zoom:" ); Super = NSObject; }; STTranscript = { Actions = ( ); Outlets = ( textView, window ); Super = NSObject; }; }StepTalk-0.10.0/ApplicationScripting/Source/English.lproj/ScriptingMenu.gorm/0000775000175000017500000000000014633027767026260 5ustar yavoryavorStepTalk-0.10.0/ApplicationScripting/Source/English.lproj/ScriptingMenu.gorm/objects.gorm0000664000175000017500000000374114633027767030604 0ustar yavoryavorGNUstep archive00002905:0000000d:00000043:00000000:01GSNibContainer1NSObject01NSMutableDictionary1 NSDictionary&01NSString& %  MenuItem401 NSMenuItem0±&% Do & Show Selection0±&&&ÿ%01NSImage0±&% common_2DCheckMark0 ±0 ±& %  common_2DDash’%0 ±& %  MenuItem50 ±0 ±&% Item0±&&&ÿ%°° ’%0±&% NSOwner0±& %  STApplicationScriptingController0±& %  MenuItem60±0±&% Scripts panel...0±&&&ÿ%°° ’%0±& %  MenuItem70±0±& %  Transcript...0±&&&ÿ%°° ’%0±& %  MenuItem80±0±& %  Do Selection0±&&&ÿ%°° ’%0±& %  GormNSMenu01NSMenu0±&% Submenu0 1 NSMutableArray1 NSArray&° 0!±0"±&% Item0#±&&&ÿ%°° ’%0$±&% NSMenu0%±0&±& %  Scripting0'± &°°°°0(±&% GSCustomClassMap0)±&0*±& %  NSVisible0+± &0,±& %  MenuItem1°0-±& %  MenuItem2°!0.±& %  MenuItem3°0/±&% MenuItem°00± &  011 NSNibConnector°$02±&% NSOwner03± °/°$04± °,°$05± ° °06± °-°07± °.°$08± °°$091 NSNibControlConnector°/°20:±&% orderFrontScriptsPanel:0;± °,°20<±&% orderFrontTranscriptWindow:0=± °.0>±&% NSFirst0?±&% executeSelectionScript:0@± °°>0A±&% executeAndShowSelectionScript:0B1 NSNibOutletConnector°2°$0C±& %  scriptingMenuStepTalk-0.10.0/ApplicationScripting/Source/English.lproj/ScriptingMenu.gorm/data.classes0000664000175000017500000000724414633027767030557 0ustar yavoryavor{ FirstResponder = { Actions = ( "activateContextHelpMode:", "alignCenter:", "alignJustified:", "alignLeft:", "alignRight:", "arrangeInFront:", "cancel:", "capitalizeWord:", "changeColor:", "changeFont:", "checkSpelling:", "close:", "complete:", "copy:", "copyFont:", "copyRuler:", "cut:", "delete:", "deleteBackward:", "deleteForward:", "deleteToBeginningOfLine:", "deleteToBeginningOfParagraph:", "deleteToEndOfLine:", "deleteToEndOfParagraph:", "deleteToMark:", "deleteWordBackward:", "deleteWordForward:", "deminiaturize:", "deselectAll:", "fax:", "hide:", "hideOtherApplications:", "indent:", "loosenKerning:", "lowerBaseline:", "lowercaseWord:", "makeKeyAndOrderFront:", "miniaturize:", "miniaturizeAll:", "moveBackward:", "moveBackwardAndModifySelection:", "moveDown:", "moveDownAndModifySelection:", "moveForward:", "moveForwardAndModifySelection:", "moveLeft:", "moveRight:", "moveToBeginningOfDocument:", "moveToBeginningOfLine:", "moveToBeginningOfParagraph:", "moveToEndOfDocument:", "moveToEndOfLine:", "moveToEndOfParagraph:", "moveUp:", "moveUpAndModifySelection:", "moveWordBackward:", "moveWordBackwardAndModifySelection:", "moveWordForward:", "moveWordForwardAndModifySelection:", "newDocument:", "ok:", "openDocument:", "orderBack:", "orderFront:", "orderFrontColorPanel:", "orderFrontDataLinkPanel:", "orderFrontFontPanel:", "orderFrontHelpPanel:", "orderFrontSharedMemoryPanel:", "orderFrontStandardAboutPanel:", "orderFrontStandardInfoPanel:", "orderOut:", "pageDown:", "pageUp:", "paste:", "pasteAsPlainText:", "pasteAsRichText:", "pasteFont:", "pasteRuler:", "performClose:", "performMiniaturize:", "performZoom:", "print:", "raiseBaseline:", "revertDocumentToSaved:", "runPageLayout:", "runToolbarCustomizationPalette:", "saveAllDocuments:", "saveDocument:", "saveDocumentAs:", "saveDocumentTo:", "scrollLineDown:", "scrollLineUp:", "scrollPageDown:", "scrollPageUp:", "scrollViaScroller:", "selectAll:", "selectLine:", "selectNextKeyView:", "selectParagraph:", "selectPreviousKeyView:", "selectText:", "selectText:", "selectToMark:", "selectWord:", "showContextHelp:", "showGuessPanel:", "showHelp:", "showWindow:", "stop:", "subscript:", "superscript:", "swapWithMark:", "takeDoubleValueFrom:", "takeFloatValueFrom:", "takeIntValueFrom:", "takeObjectValueFrom:", "takeStringValueFrom:", "terminate:", "tightenKerning:", "toggle:", "toggleContinuousSpellChecking:", "toggleRuler:", "toggleToolbarShown:", "toggleTraditionalCharacterShape:", "transpose:", "transposeWords:", "turnOffKerning:", "turnOffLigatures:", "underline:", "unhide:", "unhideAllApplications:", "unscript:", "uppercaseWord:", "useAllLigatures:", "useStandardKerning:", "useStandardLigatures:", "yank:", "zoom:", "executeSelectionScript:", "executeAndShowSelectionScript:" ); Super = NSObject; }; STApplicationScriptingController = { Actions = ( "orderFrontScriptsPanel:", "orderFrontTranscriptWindow:", "executeSelection:", "displaySelection:" ); Outlets = ( scriptingMenu ); Super = NSObject; }; }StepTalk-0.10.0/ApplicationScripting/Source/English.lproj/ScriptsPanel.gorm/0000775000175000017500000000000014633027767026100 5ustar yavoryavorStepTalk-0.10.0/ApplicationScripting/Source/English.lproj/ScriptsPanel.gorm/objects.gorm0000664000175000017500000001265714633027767030432 0ustar yavoryavorGNUstep archive00002905:00000024:00000093:00000004:01GSNibContainer1NSObject01NSMutableDictionary1 NSDictionary& 01NSString&% NSOwner0±&% STScriptsPanel0±& %  GormNSBrowser01 NSBrowser1 NSControl1NSView1 NSResponder%  C5 C  C5 C&01 NSMutableArray1 NSArray&01 NSScrollView%  C5 C  C5 C&0 ± &0 1 NSClipView% A¨ @ C Bø  C Bø&0 ± &0 1NSMatrix%  C BÈ  C BÈ&0 ± &%01 NSActionCell1NSCell0±&01NSFont0±& %  Helvetica A`A`&&&&&&&&%’% C BÈ 01NSColor0±&% NSNamedColorSpace0±&% System0±&% controlBackgroundColor°0±& %  NSBrowserCell01 NSBrowserCell0±&°&&&&&&&&%%0± &°2doClick:2doDoubleClick:’0±°0±&% System0±&% controlBackgroundColor01 NSScroller% @ @ A Bø  A Bø&0± &%0±°°&&&&&&&&&°2 _doScroll:v12@0:4@8° % A A A A °%0 ±°°&&&&&&&&°0!±&% NSMatrix0"±&% /% BÈ0#±% @ ?€ C/ A  C/ A&0$± &%0%±°°&&&&&&&&&°2 scrollViaScroller:v12@0:4@8   C5 C’’0&± &0'1NSBrowserColumn°° %°"%%0(±& %  ScrollView0)± % C C5 BÔ  C5 BÔ&0*± &0+± % A¨ @ C BÌ A˜  C BÌ&0,± &0-1 NSTextView1NSText% A˜  C BÌ  C BÌ&0.± &0/±°00±&% System01±&% textBackgroundColor  K–€ K–€02±°°003±& %  textColor C K–€°/04±% @ @ A BÌ  A BÌ&05± &%06±07±&°&&&&&&&&&°)²°+% A A A A °408±& %  GormNSWindow091NSWindow%  CF C€&% ?€ CÛ0:±%  CF C€  CF C€&0;± &0<1NSButton% C A B` AÀ  B` AÀ&!0=± &%0>1 NSButtonCell0?±&% Run°&&&&&&&&%’°<0@±&0A±&&&&0B1 NSPopUpButton% A A BÄ AÀ  BÄ AÀ&$0C± &%0D1NSPopUpButtonCell1NSMenuItemCell0E±&% Button°&&&&&&&&0F1NSMenu0G±&0H± &0I1 NSMenuItem0J±&% Commands0K±&&&ÿ%0L1 NSImage0M±&% common_3DArrowDown’%0N±0O±& %  Update list°K&&ÿ%’%0P±0Q±&% Browse°K&&ÿ%’%%’°B0R±&0S±&&&&°F°I%%%%%0T1! NSSplitView% A B C5 Cp  C5 Cp&0U± &°°)0V± 0W±&% common_Dimple.tiff0X±°0Y±&% System0Z±&% controlBackgroundColor0[±°°Y0\±&% controlShadowColor%A0]±°0^±&% System0_±&% windowBackgroundColor0`±&% Window0a±&% Scripts°a ?€ Aø F@ F@%0b± 0c±&% NSApplicationIcon0d±&% TextView°-0e±& %  SplitView1°T0f±&% GSCustomClassMap0g±&0h±&% GormNSPopUpButton°B0i±& %  MenuItem1°N0j±& %  SplitView0k±!% A B C5 Cu  C5 Cu&0l± &°V0m±°°^0n±&% controlBackgroundColor0o±°°^0p±&% controlShadowColor%A0q±& %  MenuItem2°P0r±&% MenuItem°I0s±&% Button1°<0t± &0u1"NSNibConnector°80v±&% NSOwner0w±"°(°e0x±"°d°e0y±"°s0z±"°j0{±"°h0|±"°r0}±"°i0~±"°q01#NSNibOutletConnector°v°d0€±&% descriptionText0±#°v°s0‚±& %  runButton0ƒ±#°v°h0„±& %  commandMenu0…±#°v°80†±&% _panel0‡1$NSNibControlConnector°h°v0ˆ±&% command:0‰±$°s°v0б&% run:0‹±"°°e0Œ±#°°v0±&% delegate0ޱ#°v°0±& %  scriptList0±"°eStepTalk-0.10.0/ApplicationScripting/Source/English.lproj/ScriptsPanel.gorm/data.classes0000664000175000017500000000711014633027767030367 0ustar yavoryavor{ FirstResponder = { Actions = ( "activateContextHelpMode:", "alignCenter:", "alignJustified:", "alignLeft:", "alignRight:", "arrangeInFront:", "cancel:", "capitalizeWord:", "changeColor:", "changeFont:", "checkSpelling:", "close:", "complete:", "copy:", "copyFont:", "copyRuler:", "cut:", "delete:", "deleteBackward:", "deleteForward:", "deleteToBeginningOfLine:", "deleteToBeginningOfParagraph:", "deleteToEndOfLine:", "deleteToEndOfParagraph:", "deleteToMark:", "deleteWordBackward:", "deleteWordForward:", "deminiaturize:", "deselectAll:", "fax:", "hide:", "hideOtherApplications:", "indent:", "loosenKerning:", "lowerBaseline:", "lowercaseWord:", "makeKeyAndOrderFront:", "miniaturize:", "miniaturizeAll:", "moveBackward:", "moveBackwardAndModifySelection:", "moveDown:", "moveDownAndModifySelection:", "moveForward:", "moveForwardAndModifySelection:", "moveLeft:", "moveRight:", "moveToBeginningOfDocument:", "moveToBeginningOfLine:", "moveToBeginningOfParagraph:", "moveToEndOfDocument:", "moveToEndOfLine:", "moveToEndOfParagraph:", "moveUp:", "moveUpAndModifySelection:", "moveWordBackward:", "moveWordBackwardAndModifySelection:", "moveWordForward:", "moveWordForwardAndModifySelection:", "newDocument:", "ok:", "openDocument:", "orderBack:", "orderFront:", "orderFrontColorPanel:", "orderFrontDataLinkPanel:", "orderFrontFontPanel:", "orderFrontHelpPanel:", "orderFrontSharedMemoryPanel:", "orderFrontStandardAboutPanel:", "orderFrontStandardInfoPanel:", "orderOut:", "pageDown:", "pageUp:", "paste:", "pasteAsPlainText:", "pasteAsRichText:", "pasteFont:", "pasteRuler:", "performClose:", "performMiniaturize:", "performZoom:", "print:", "raiseBaseline:", "revertDocumentToSaved:", "runPageLayout:", "runToolbarCustomizationPalette:", "saveAllDocuments:", "saveDocument:", "saveDocumentAs:", "saveDocumentTo:", "scrollLineDown:", "scrollLineUp:", "scrollPageDown:", "scrollPageUp:", "scrollViaScroller:", "selectAll:", "selectLine:", "selectNextKeyView:", "selectParagraph:", "selectPreviousKeyView:", "selectText:", "selectText:", "selectToMark:", "selectWord:", "showContextHelp:", "showGuessPanel:", "showHelp:", "showWindow:", "stop:", "subscript:", "superscript:", "swapWithMark:", "takeDoubleValueFrom:", "takeFloatValueFrom:", "takeIntValueFrom:", "takeObjectValueFrom:", "takeStringValueFrom:", "terminate:", "tightenKerning:", "toggle:", "toggleContinuousSpellChecking:", "toggleRuler:", "toggleToolbarShown:", "toggleTraditionalCharacterShape:", "transpose:", "transposeWords:", "turnOffKerning:", "turnOffLigatures:", "underline:", "unhide:", "unhideAllApplications:", "unscript:", "uppercaseWord:", "useAllLigatures:", "useStandardKerning:", "useStandardLigatures:", "yank:", "zoom:" ); Super = NSObject; }; STScriptsPanel = { Actions = ( "run:", "command:", "selectScript:" ); Outlets = ( scriptList, descriptionText, runButton, commandMenu, _panel ); Super = NSPanel; }; }StepTalk-0.10.0/ApplicationScripting/Source/NSTextView+ScriptExecution.h0000664000175000017500000000224514633027767025330 0ustar yavoryavor/** NSTextView+ScriptExecution Application Scripting support - execution of selected text Copyright (c)2003 Stefan Urbanek Written by: Stefan Urbanek Date: 2003 Mar 23 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 NSTextView(STScriptExecution) - (void)executeSelectionScript:(id)sender; - (void)executeAndShowSelectionScript:(id)sender; @end StepTalk-0.10.0/ApplicationScripting/Source/NSApplication+additions.m0000664000175000017500000001604414633027767024651 0ustar yavoryavor/** NSApplication additions Copyright (c) 2000 Stefan Urbanek Written by: Stefan Urbanek Date: 2001 Nov 15 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 "NSApplication+additions.h" #import "STScriptsPanel.h" #import "STTranscript.h" #import "STEnvironment+additions.h" #import #import #import #import #import #import #import #import #import #import #import "STApplicationScriptingController.h" static STEnvironment *scriptingEnvironment = nil; static NSMutableSet *scannedBundles; static STApplicationScriptingController *scriptingController = nil; @interface NSApplication (STPrivateMethods) - (void)updateScriptingInfoFromBundles; - (void)_createDefaultScriptingEnvironment; @end @implementation NSApplication(STAppScriptingAdditions) /** Method for preventing multiple initialization. It will show alert panel on invocation. You should not invoke this method.*/ - (BOOL)initializeApplicationScripting { /* FIXME: make it more human-readable */ NSRunAlertPanel(@"Scripting is already initialized", @"[NSApp initializeApplicationScripting] is called more than once.", @"Cancel", nil, nil); return YES; } /** Do real initialization of application scripting. You should not invoke this method directly. */ - (BOOL)setUpApplicationScripting { // STBundleInfo *info; // info = [STBundleInfo infoForBundle:[NSBundle mainBundle]]; /* FIXME: use info */ scriptingController = [[STApplicationScriptingController alloc] init]; return YES; } /** Return shared scripting environment. If there is none, create one. */ - (STEnvironment *)scriptingEnvironment { if(!scriptingEnvironment) { [self _createDefaultScriptingEnvironment]; } return scriptingEnvironment; } /** Create shared scripting environment. */ - (void)_createDefaultScriptingEnvironment { STEnvironmentDescription *desc; STEnvironment *env = nil; STBundleInfo *info; //NSString *path; NSString *str = nil; //NSString *reference; //NSDictionary *dict; //id object; NSDebugLog(@"Creating scripting environment"); scannedBundles = [[NSMutableSet alloc] init]; info = [STBundleInfo infoForBundle:[NSBundle mainBundle]]; if(!info) { NSRunAlertPanel(@"Application does not provide scripting capabilities", @"This application was designed to support " @"scripting, but something went wrong. " @"Check if the file ScriptingInfo.plist exists " @"in application's bundle directory.", @"Cancel", nil, nil); return; } [scannedBundles addObject:[NSBundle mainBundle]]; /* FIXME: use scripting environment from application bundle */ /* str = [info objectForKey:@"STEnvironmentDescription"]; */ if(str && ![str isEqualToString:@""]) { desc = [STEnvironmentDescription descriptionWithName:str]; env = [STEnvironment environmentWithDescription:desc]; } if(!env) { NSDebugLog(@"Using default scripting environment"); env = [STEnvironment environmentWithDefaultDescription]; } [env loadModule:@"AppKit"]; [env includeBundle:[NSBundle mainBundle]]; [env setObject:self forName:@"Application"]; [env setObject:self forName:[self applicationNameForScripting]]; [env setObject:[STTranscript sharedTranscript] forName:@"Transcript"]; scriptingEnvironment = RETAIN(env); [self updateScriptingInfoFromBundles]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateScriptingInfoOnBundleLoad:) name:NSBundleDidLoadNotification object:nil]; } /** Include information from loaded modules and bundles. */ - (void)updateScriptingInfoFromBundles { STEnvironment *env = [self scriptingEnvironment]; NSEnumerator *enumerator; //NSDictionary *info; //NSString *path; NSBundle *bundle; NSMutableSet *bundles; NSDebugLog(@"Updating scripting info from bundles"); bundles = (id)[NSMutableSet setWithArray:[NSBundle allBundles]]; [bundles minusSet:scannedBundles]; enumerator = [bundles objectEnumerator]; while( (bundle = [enumerator nextObject]) ) { /* If bundle provides scripting capabilities, try to include it. */ if([bundle scriptingInfoDictionary]) { if(![env includeBundle:bundle]) { NSLog(@"Failed to include bundle scripting of '%@'.", [bundle bundlePath]); } } } [scannedBundles unionSet:bundles]; } /** Called on NSBundleDidLoad notification. You */ - (void)updateScriptingInfoOnBundleLoad:(NSNotification *)notif { [self updateScriptingInfoFromBundles]; } /** Name of application object */ - (NSString *)applicationNameForScripting { return [[NSProcessInfo processInfo] processName]; } /** Order the scripts panel into the front. */ - (void)orderFrontScriptsPanel:(id)sender { [scriptingController orderFrontScriptsPanel:nil]; } /** Return scripting menu. The default menu is provided by STApplicationScriptingController */ - (NSMenu *)scriptingMenu { return [scriptingController scriptingMenu]; } /** Set application Scripting menu */ - (void)setScriptingMenu:(NSMenu *)menu { [scriptingController setScriptingMenu:menu]; } /** Order the Transcript window into the front. */ - (void)orderFrontTranscriptWindow:(id)sender { [scriptingController orderFrontTranscriptWindow:nil]; } /** Return YES if scripting is supported, otherwise returns NO. Because this method is called when framework is loaded, allways returns YES. */ - (BOOL)isScriptingSupported { return YES; } /** Return object that is responsible for controlling application scriptign */ - (STApplicationScriptingController *)scriptingController { return scriptingController; } @end StepTalk-0.10.0/ApplicationScripting/Source/STEnvironment+additions.m0000664000175000017500000000320714633027767024715 0ustar yavoryavor/** STEnvironment additions Copyright (c)2002 Stefan Urbanek Written by: Stefan Urbanek Date: 2002 Mar 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 "STEnvironment+additions.h" #import #import #import #import @implementation STEnvironment(AppTalkAdditions) - (void)updateReferencesFromDictionary:(NSDictionary *)dict target:(id)target { NSEnumerator *enumerator; NSString *name; NSString *object = nil; enumerator = [dict keyEnumerator]; while( (name = [enumerator nextObject]) ) { object = [target valueForKeyPath:[dict objectForKey:name]]; NSLog(@"Adding reference '%@' object '%@'", name, object); [self setObject:object forName:name]; } } @end StepTalk-0.10.0/ApplicationScripting/GNUmakefile0000664000175000017500000000216314633027767020624 0ustar yavoryavor# # Main Makefile for the StepTalk # # Copyright (C) 2000 Stefan Urbanek # # Written by: 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., 59 Temple Place, Suite 330, Boston, MA 02111 USA # include $(GNUSTEP_MAKEFILES)/common.make include Version PACKAGE_NAME = ApplicationScripting SUBPROJECTS = \ Source -include GNUMakefile.preamble include $(GNUSTEP_MAKEFILES)/aggregate.make -include GNUMakefile.postamble StepTalk-0.10.0/ApplicationScripting/Support/0000775000175000017500000000000014633027767020224 5ustar yavoryavorStepTalk-0.10.0/ApplicationScripting/Support/ScriptingInfo.plist0000664000175000017500000000105514633027767024060 0ustar yavoryavor/* ScriptingSupport.plist This is a template file for application scripting support description. You can take and modify this file. */ { Classes = ( /* List public classes from your application here */ ); Objects = { /* Put a dictionary of public objects here. Key is object name used in scripts and value is a path to that object relative to application delegate. For example: CurrentMessage = "lastMailWindowOnTop.delegate.selectedMessage"; */ }; } StepTalk-0.10.0/ApplicationScripting/Support/STScriptingSupport.h0000664000175000017500000000257614633027767024215 0ustar yavoryavor/** ScriptingSupport Code for loading scripting NOTE: Copy and include this file into your application project. Copyright (c) 2002 Stefan Urbanek Written by: Stefan Urbanek Date: 2002 Apr 13 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 */ #ifndef _STScriptingSupport_h #define _STScriptingSupport_h #include @interface NSApplication(STApplicationScripting) - (BOOL)initializeScripting; - (BOOL)isScriptingSupported; /* User interface */ - (void)orderFrontScriptsPanel:(id)sender; - (void)orderFrontTranscriptWindow:(id)sender; - (NSMenu *) scriptingMenu; @end #endif StepTalk-0.10.0/ApplicationScripting/Support/STScriptingSupport.m0000664000175000017500000001152314633027767024212 0ustar yavoryavor/** ScriptingSupport Code for loading scripting Copy and include this file into your application project. NOTE: Please, do not modify this file. It is part of the StepTalk and depends on its interface. Copyright (c) 2002 Stefan Urbanek Written by: Stefan Urbanek Date: 2002 Apr 13 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 */ #include "STScriptingSupport.h" #include #include #include #include #include #include #include #include @interface NSApplication (STPrivateMethods) - (BOOL)setUpApplicationScripting; - (NSBundle *) _applicationScriptingBundle; @end @implementation NSApplication(STApplicationScriptingInit) - (BOOL)initializeApplicationScripting { NSBundle *bundle; if(![self isScriptingSupported]) { NSRunAlertPanel(@"Invalid usage of scripting support", @"Please, contact the author of this application " @"and let him know about this error. The author forgot " @"to check whether the scripting is supported or not.", @"Cancel", nil, nil); return NO; } NSLog(@"Loading application scripting support"); bundle = [self _applicationScriptingBundle]; if(bundle) { /* Load the bundle! */ [[bundle principalClass] class]; if([self respondsToSelector:@selector(setUpApplicationScripting)]) { return [self setUpApplicationScripting]; } else { NSRunAlertPanel(@"Broken scripting support", @"Scripting support cannot be loaded, because " @"the application scripting bundle is broken.", @"Cancel", nil, nil); return NO; } } else { NSRunAlertPanel(@"Broken scripting support", @"Application scripting bundle cannot be loaded.", @"Cancel", nil, nil); return NO; } } - (BOOL)isScriptingSupported { return ([self _applicationScriptingBundle] != nil); } - (NSBundle *)_applicationScriptingBundle { NSFileManager *manager = [NSFileManager defaultManager]; NSEnumerator *enumerator; NSString *path; NSArray *paths; BOOL isDir; paths = NSStandardLibraryPaths(); enumerator = [paths objectEnumerator]; while( (path = [enumerator nextObject]) ) { path = [path stringByAppendingPathComponent:@"Bundles"]; path = [path stringByAppendingPathComponent:@"ApplicationScripting"]; path = [path stringByAppendingPathExtension:@"bundle"]; if( [manager fileExistsAtPath:path isDirectory:&isDir] && isDir) { return [NSBundle bundleWithPath:path]; } } return nil; } - (void)_loadAppTalkAndRetryAction:(SEL)sel with:(id)anObject { static BOOL isIn = NO; if(isIn) { NSLog(@"Error occured while loading application scripting support"); isIn = NO; return; } isIn = YES; if([self initializeApplicationScripting]) { [self performSelector:sel withObject:anObject]; } isIn = NO; } - (id)_loadAppTalkAndRetryAction:(SEL)sel { static BOOL isIn = NO; id retval = nil; if(isIn) { NSLog(@"Error occured while loading application scripting support"); isIn = NO; return nil; } isIn = YES; if([self initializeApplicationScripting]) { retval = [self performSelector:sel]; } isIn = NO; return retval; } - (void)orderFrontScriptsPanel:(id)sender { [self _loadAppTalkAndRetryAction:_cmd with:sender]; } - (void)orderFrontTranscriptWindow:(id)sender { [self _loadAppTalkAndRetryAction:_cmd with:sender]; } - (NSMenu *)scriptingMenu { return [self _loadAppTalkAndRetryAction:_cmd]; } @end StepTalk-0.10.0/ApplicationScripting/GNUmakefile.postamble0000664000175000017500000000323714633027767022614 0ustar yavoryavor# # GNUmakefile.postamble # # 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; see the file COPYING.LIB. # If not, write to the Free Software Foundation, # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # Project specific makefile rules # # Uncomment the targets you want. # The double colons (::) are important, do not make them single colons # otherwise the normal makefile rules will not be performed. # # Things to do before compiling # before-all:: # Things to do after compiling # after-all:: # Things to do before installing # before-install:: # Things to do after installing # after-install:: # Things to do before uninstalling # before-uninstall:: # Things to do after uninstalling # after-uninstall:: # Things to do before cleaning # before-clean:: # Things to do after cleaning # after-clean:: # Things to do before distcleaning # before-distclean:: # Things to do after distcleaning # after-distclean:: # Things to do before checking # before-check:: # Things to do after checking # after-check:: StepTalk-0.10.0/ApplicationScripting/README0000664000175000017500000000225314633027767017432 0ustar yavoryavorApplication Scripting bundle ---------------------------- Ahthor: Stefan Urbanek NOTE: this bundle wants another name and cleanup. What is Application Scripting Bundle ? -------------------------------------- Bundle that allows users to 'script' applications. In other words, for example, users can: - extend the behaviour of application by adding their own functionality - automate tasks in the application - create a batch task How to make applications scriptable is described in StepTalk/Documentation. It can be done very easily in less than five minutes. Where to get it? ---------------- Application Scripting Bundle is part of the StepTalk and you can download it from: http://steptalk.host.sk/download.html Installation ------------ Application Scripting Bundle is automatically installed with StepTalk. You can install it separately by doing: > make > make install Scripts ------- Scripts are stored per application domain in */Library/StepTalk/Scripts/application_name. For example GNUmail is searhing for scripts in */Library/StepTalk/Scripts/GNUmail. Feedback -------- Any bug reports and comments are welcome at urbanek@host.sk StepTalk-0.10.0/ApplicationScripting/NEWS0000664000175000017500000000066714633027767017260 0ustar yavoryavor0.2.0 * Bundles loaded by the application now can provide additional scripts and additional scripting capabilities (new scriptable objects) * Application is looking for scripting information and scripts in all loaded bundles. Documentation: * Scripts.txt: updated information about scrip search locations * ApplicationScripting.txt: updated information about optional scripting using bundle StepTalk-0.10.0/WISH0000664000175000017500000000736314633027767013130 0ustar yavoryavorDear 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. StepTalk-0.10.0/Applications/0000775000175000017500000000000014633027767015050 5ustar yavoryavorStepTalk-0.10.0/Applications/ScriptPapers/0000775000175000017500000000000014633027767017467 5ustar yavoryavorStepTalk-0.10.0/Applications/ScriptPapers/TODO0000664000175000017500000000121514633027767020156 0ustar yavoryavor1 Add 'New in environment...' which will open "New panel" where user will be able to select scripting environment. 2 Add environment browser (named objects, loaded frameworks and bundles) 2.1 Implement 'Load bundle' 2.2 Implement 'Load framework' 2.3 Implement deletion of objects 3 Add menu item 'Script->Inspect selection' and add object inspector, like the one in Smalltalk 3.1 Object inspector (use class description) 3.2 Array inspector (delete functions for mutable arrays) 3.3 Dictionary inspector 3.4 Ability to save objects (use NSArchiver) 4 Implement document saving (warn the user, that all created objects will be lost) StepTalk-0.10.0/Applications/ScriptPapers/NSObject+NibLoading.h0000664000175000017500000000173014633027767023312 0ustar yavoryavor/** NSObject+NibLoading Copyright (c) 2002 Stefan Urbanek Written by: Stefan Urbanek Date: 2002 Oct 10 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #import @interface NSObject(NibLoading) - (BOOL)loadMyNibNamed:(NSString *)aName; @end StepTalk-0.10.0/Applications/ScriptPapers/ChangeLog0000664000175000017500000000157414633027767021250 0ustar yavoryavor2013-03-23 Wolfgang Lux * AppController.m (-init): * ScriptPaper.m (-init): Check the result of the super class initializer and assign it to self. * ScriptPaper.m (-dealloc): Release environment attribute to fix space leak. * ScriptPaper.h (-doSelection:, -doAndShowSelection:): Move method declarations from here ... * ScriptPaperController.h (-doSelection:, -doAndShowSelection:): ... to here. * ScriptPaper.m (-init, -executeScriptString:): Update to use current framework classes and methods. * ScriptPaperController.m (-doAndShowSelection:): Remove unused variable. 2003 May 11 Stefan Urbanek * Added -Wno-import * Added TODO 2003 May 4 Stefan Urbanek * Added application icon 2003 May 4 Stefan Urbanek * ChangeLog started StepTalk-0.10.0/Applications/ScriptPapers/GNUmakefile0000664000175000017500000000355614633027767021552 0ustar yavoryavor# Script Papers # # Copyright (C) 2002 Stefan Urbanek # # Written by: Stefan Urbanek # Date: 2003 Apr 26 # # This file is part of the AgentFarms # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA # include $(GNUSTEP_MAKEFILES)/common.make APP_NAME = ScriptPapers PACKAGE_NAME = ScriptPapers ScriptPapers_APPLICATION_ICON = ScriptPapers_MAIN_MODEL_FILE = ScriptPapers.gorm ADDITIONAL_GUI_LIBS += -lStepTalk ############################################################################ # ObjC files ScriptPapers_OBJC_FILES= \ AppController.m \ ScriptPaper.m \ ScriptPaperController.m \ NSObject+NibLoading.m \ NSTextView+additions.m \ main.m ############################################################################ # Resource files ScriptPapers_LOCALIZED_RESOURCE_FILES= \ ScriptPapers.gorm \ Paper.gorm ScriptPapers_RESOURCE_FILES= \ Images/ScriptPaperFile.tiff \ Images/ScriptPapers.tiff ADDITIONAL_OBJCFLAGS = -Wno-import ############################################################################ -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/application.make -include GNUmakefile.postamble StepTalk-0.10.0/Applications/ScriptPapers/ScriptPaper.m0000664000175000017500000000561214633027767022105 0ustar yavoryavor/** Controller Copyright (c) 2003 Stefan Urbanek Written by: Stefan Urbanek Date: 2003 Apr 26 This file is part of the Farmer application. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #import "ScriptPaper.h" #import #import #import #import #import #import "ScriptPaperController.h" @implementation ScriptPaper - init { if ((self = [super init]) != nil) { environment = [[STEnvironment alloc] initWithDefaultDescription]; } return self; } - (void)dealloc { RELEASE(environment); [super dealloc]; } - (void)makeWindowControllers { ScriptPaperController *controller; controller = [[ScriptPaperController alloc] init]; [controller setDocument:self]; [self addWindowController:AUTORELEASE(controller)]; } - (id)executeScriptString:(NSString *)source { STEngine *engine; NSString *error; id retval = nil; engine = [STEngine engineForLanguage: [[STLanguageManager defaultManager] defaultLanguage]]; if(!engine) { NSLog(@"Unable to get scripting engine."); return nil; } if(!environment) { NSLog(@"No scripting environment"); return nil; } NS_DURING retval = [engine interpretScript:source inContext:environment]; NS_HANDLER error = [NSString stringWithFormat: @"Error: " @"Execution of script failed. %@. (%@)", [localException reason], [localException name]]; // [[STTranscript sharedTranscript] showError:error]; NSLog(@"Script exception: %@", error); retval = nil; NS_ENDHANDLER return retval; } - (BOOL)writeToFile:(NSString *)fileName ofType:(NSString *)fileType { NSLog(@"Write to file %@ of type %@. (not implemented)", fileName, fileType); return YES; } - (BOOL)readFromFile:(NSString *)fileName ofType:(NSString *)fileType { NSLog(@"Read from file %@ of type %@. (not implemented)", fileName, fileType); return YES; } @end StepTalk-0.10.0/Applications/ScriptPapers/run0000775000175000017500000000005514633027767020221 0ustar yavoryavormake debug=yes && openapp ScriptPapers.debug StepTalk-0.10.0/Applications/ScriptPapers/NSTextView+additions.h0000664000175000017500000000203214633027767023627 0ustar yavoryavor/** NSTextView additions Copyright (c) 2003 Stefan Urbanek Written by: Stefan Urbanek Date: 2003 Apr 26 This file is part of the Farmer application. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #import @interface NSTextView(PaperAdditions) - (NSString *)selectedString; - (BOOL)hasSelection; @end StepTalk-0.10.0/Applications/ScriptPapers/Images/0000775000175000017500000000000014633027767020674 5ustar yavoryavorStepTalk-0.10.0/Applications/ScriptPapers/Images/ScriptPapers.tiff0000664000175000017500000001034014633027767024163 0ustar yavoryavorII*€ Dˆ“A@ðPˆDbQ8¤V-ŒFcQ¸äDÑ H Ò7ùRLÿ*ÊeB¬¢U)–Ì%s|Öc,—M'S9ÌödUœOæÓÊîF¡ÑçÔš &_MÆN°S fE¬?ÝÕ·ûò¼ÿ°XlV;%–Íg´ZmV»e¶Ýo‚¿àªh­Np‚”ëwû2üÿrà_é|#ý7‡·Ø°é»9?oÅârX¬FO-a¸Üà¤È‰ê nÏŽ4Oö—I¦2ê_ï½fXe¯œvOöVÕÿŽ'ìvy¦3yaÚ²·G¾?'‘ߨ2;.'2ßÁá᱘Ҝˆ$à¹ë¸»¼ÿPø_ì#ü}ç¼=O÷ï¶ßγ|,?+'Ói¶ç}²n^ï*¶¿®#p¹ P ëÂ{ ¦ª =»ÁqþEB‡ùM Ÿâô4š°éþzDcܵ@.“׆KP±¹Ñ[ ü¶pöÙÅÍ´8‹tpÅn¤Í¢'ø!ÀÅàXgù%Ÿä¤œr‰þBJä<õ [ZËË’ì½/­Qô,ÌLÑ5siþCNlžÂçùc;ÊÆ©þtχùÉ?ŸçÍ0P”- ¶ÌR чø)GÀÆôÚŸä,ôÌäJSp´0ò,Àœªê¿CÕM DºèuÈR"â V”­.!W|ã%‘М*ð”-9†–)þyYùýe­nK-g8ïúÉLuYÈ1ô m†–éþ\øQqŸä]Ì’¤â]Ô‹÷iþ_ÞýÔ%Ÿã…ìû¸Q{f±:»fè:[ô¶àWülǹÖtw~6Ø+‰kÌ–Ö%® –,Òrœªã‡ù+ŸänD›9)þ4åùß•ÔÇäY}¬¯¶e˜2øÁ™¸—Ó‰¾9¥¶ÍU¨†Šh€þiø ¥Ÿàö[gøw©ŸõÀ„‹zÉþDë‡øS¯ŸãFÄ[)þLíãagaÑ6^æàÎÌ{n–=’IïøÙ½Ÿä†ü†Ü þspœ¿Öøñ‡þðIîÇ‘þ7r—­ïˆ[:-·¥€ÇøÏŸø°$‡].¡ÓÎ1þIu”ñM×_VY•öU™†8YâÚöŸ´ yøùÑáŸçŒ›Iþgy‡ùç¼o)éŸþ™êúž·£Pùæ7—æù&Áþqü–%ÌhXžŒ¸óà~‡£t¡Ñþ:~‡ø•ûôõç`W‡ù¤ÿÇøõ€Cü{ÀT¼ï ,?Æ,âî ñ_Çø¤ƒCüMAÑþ%¡IÊr©Ø@% äƒB‘;'…à/ÇøÍ†O½1¹—ÖæŸSï[mYª«•,ÔZà‰ïðWñuÇøâ‰P7Aìí‡ñkz¼‡”ö…TY…"hˆø¼?Ä,aáò2?7꽃ƒ“r®P7F¨Û´i~Ò1ÆQØó …pÑEøuaÊf«lHQþäBâ\FFhè d„ƒÜ%ñã%ã‰Ñl†Ù:x~?Å¡ãÒñGiéèÿÖ¬†«]D§ ««•h™Uô`ÄЪžá6ÖD#Gø©Ã&.‰ap¸P1pÀÚ§†Pά‘Qh°ÔˆørnÅ)¬ö^Í WD?ÀMá³Ê^Ïɱ0?Äeé¯^ÁPú#m*Ã!dbà^§¡(&စN¼cŒ”ô$°¹IBT[¹0åp(ðÿ Œâ (å8]ºˆ]» –Ýn÷`ù´nÕݳ ’:/5×(tâ 8«{/>1áSšÖÚè³ÇWÊà[gœô¨œzâPM çV&Eàÿ"\]EÑ+qÄh”«”H‹1þ„S6"ˆQ*åP\8˜P„lÍSì¡åŤ¡þó€ÿYÍ£´›¸¶œãJi‰¤C¦3™‚5 ŸÎ0ý?‰ìpžÄ+ˆÍˆÂøkA7øÛé&‰¼Œ$ÄȽ©!¨A?`›:D`’—£UjÍVÄ&áñ:ˆA*Gøs pèB… !´@®ÀÈð¹ù¶gM ™ìÉqH`ðµô[p70íÑþ·A¦ˆÑR¸0ñT+Æ+ÈPußx`Ìö®X¨ïQþ ÷ÄÙXE‰e,°jÞà h`jZÀ^¡ì@å ü Åc"+‡ü´ A^…Í$Tç> ö®åfÄ<‹h4i¨Çÿ'›•ŒíÐZ?ЈÿüÏãQœ4Û!‚ÛNÈèvߟ{?Å8¨lG‹þ ?/èýÔ$B\µAéÈ®,?ÃÀ}‹˜% âUHÉ2{UØ0C«ÂGø"îCþfí=«žvfyÁ8%ŒæDþ?{Â;` Ëg@ç‰è½©ïcãáo<ùqq›Õ8ÿ+qþðiìôL²pÜ!Çø8!§‚{”ƒcé&E‰ml×›r\¯j—òûaÐ ø]<o?08iÞ|/ÝÔ„@ÿÖ@ô“ñ~7èš'Ï!j-…Ü`ËùÈÜ®¶êxT ´,>ˆë¼'°rî@8‡a"?Ãxtãø >Â4% ˆ,a¡¥bÚ€/,6»,4ä¯zsF2Ü   ê¡€¶ éf P0 o`IïˆøÏ°óB² á!œR­nG€fo¹l, Ààþ üN à±‡&ez @š áü ¡9"T,İ{®ÃªÚàðÄjØR€‘ eØ ÚÌ#ˆøOŒiÀ<ð>þÄ'©¦A°!¼<JÔAÇ^Àö¼àpO8ý " o@ka…€Ük€ ˜" b ‚ ",öc€?b8Ã0³0¸i¦žq(Ä0.0åØ íÊ À° Êl *XàcЦ zcAÇá0«À¾¢ Ðð-fþ/æìò¶ë‘{¡ N" `àn aþà0Á½±0‹c„abÂ&NE0¾é ªZ¥îêVM¢³ XÂø àŽ n´ € ž€Ö íŠÂeƒì¦a0ÕluຠîâA@Ba·Mfô¡‚0öSâ! ÄÞR‘Œùè„ Úu@Î Î~ Ä™à‘¡bÄGe¨fãfíñ% ®„ß 5&aÿ&`4ïl-0 €Œ¡ÑÒ— Ž Nµ(n´ ¨¦@È -Š À×nÂ1€üÖ'æ €ÉmþANX`èHQò `¾ù`´  æÌ+  €ÐØ Ô ál Úõ`´ ÀèÀ\w" 1 %¥íŒLto€®D’ÃL5 NI'ˆtÀ’°p8jïlV(¤¯û&à8°ºê fôÏP þÿ é:A@N±à>BóW5³_5ÓXkÀTåáÁPàÊ F¢náØ ¡iâ+E {O€Ù‘#1+³1JP»Œò $£àN^Ä +;1º­ï„´’.ªþô²º…¹@H’/µîŽ t¨†A‘õ tä Qœ Q8±¢UH ôs¬òÎ6ÃÉ· Sœ»sQŠ>€jÑ¥i@1Bð^ñë”´8æ¯X¡J·OärFŠ9=¤ŽHó6Ja þá^ @ÌÉZ  úàB@TS„ö"%BÆgC¢,Eü8ƒ"_¦6j¿&Ïxñ 8[åÃAªÐ4¬j Š% V„RÃDWMà™Laþm!ez LRŽCAþ à' Ä q@AL†Â Ôr %² V nÀ Àâ òþmô†6ÄK%&|9à2)»Rs;pÃ¥ÀМ.4Ü¥etõzà˜óY <Ûå¼Ðà‰U­©:3O:¤$üç á>,¬ Àå-à«OçL¬a¼àÀØåØ koSgÞìÀÓýQcz:2WZÜw G`sb¬pˆEæ'´.‚}ʧàýduÀò VùvO ® ˆœ€Œãr€z&¤j(̵ðhêÂù>ä`úú!b³ëW’ß`- Ö¢@Ä5L*8GÁ– ¡  ]$åT-¥ŠþÇUúm²+\àD.uöÊ: “m+Tµ–Sµ\à¢^@š— ¢ Š. €Á Ä óî  Òj!íp`þ¼àÃG  ‹;5d’D£€T‹™5Š8€b Ô@[ósР[VÒ *†…–Ïl ‘taþ 'ð  œ7-€¥€Š  `žÜ°|í²êŽ–÷FÔø³´iw×%± õ èur×0h¶b"8A h~:·¥z7©z÷§{7­{W¤â ¶–ÎÈŽ«:– ¦œ@¨ aýT`”À( 2N0¡î ª !ü 2ÌÀ¤à!üÀ.¡ã€@: lŠÐ8• PÑ Vjx$ö* @Ø#¢$AX8¸:™x>£8E„8IƒÂ ¢ Ñ2!a…¡æžaJ1ý ‚ @@·vÀ°ÂAýKuX¶¬Á{yAÄ*O8ba@ƒ)–  ŠEƒX­Šø±‹ æôá‹á¾¦È ¡ ¡€laŽ íŽÍ®øÇaxä¶  ×8€?àjø³¸ýù"p˜â ‚ rH—”" XñU"=µ9-’ù1“87ï“B 00ÈªÐØ(R€ü '€ü 'StepTalk-0.10.0/Applications/ScriptPapers/Images/ScriptPaperFile.tiff0000664000175000017500000000672014633027767024607 0ustar yavoryavorII* € P8$ „BaP¸d6ˆDbQ8qV,ÿ‹cr©5Çã‘é –A‘JdÒI(c糊3`ÏGÎ2›FR‹HïL‰µ±k$è0,¹®o„ 篌ÛQ&°m¾ÏE’›”À3 3,K²r–{M‡ùå7Ÿäœä“©þHOøm=Ÿç4ý=O“Á!:NÁ­ 8ÎsyäÔiþ8R£E?4µÌŠ¢~Ó‡ùóOŸçD)þpÕù±UŸæu\˜Õ‰þ`Ö‡ù[ÖÕÅn`W5åh`Ö•\gUUaÇcŸçe•I7ïÛ‡ Òð=8~Ÿç­¬œÉþhÛ‡ù‹oŸåÝÄ•÷)þR]ù5uŸäµÜ’—áy^$¥ç{]ĵÕv]!þXàùŸæn fäFl’¹ÍÏtǼi'Ë24ÄËËI¢F °ÉKrK6LjøÛ©ègøÉ«³‚–´‹:éþ,løÃ±ŸâžÌŠÛN¹¯ {iÿ¶‹{~ݸâæì‹ÛÉþ1o‡øÑ¿³ƒï„JԬУ³Ð܃)ÄÌ46ï,¬õ¬zŸåÇ,ÜÎ÷¾ç$©þ1ôþú ý.Ö,Ÿâ§U´m]P¨žö Ò+ý(®‹]Éþ.÷š¶±ž¿–„“)jº+›2Kí–ƒ4ÊwÉþ5úù?éçw÷x.Ÿã¯´ŒÞïSÕõÞÿ^˜¤£×Í® Cb|–Õ° %œù?ª$7¦»þBÅŸÿ.c¼ÒßéœN¡±î=æ`ô?ĸšN|2@B@#bÿ"¸d±¡,.ø(@Å@g`C8rƒäà0¸HUPìâÎ.1Ö>÷C40{ÎÄåEèÕ^l_±Ñ)‡øÇ1¨H ar?Äp•ê09Fp-Çø` f @aF×ìR.ÅWèðŠ9—F%¦I”gñVÆ^ãü/ÉÖäÜa”f‹qvQCi2Î⼂h_ñ$&Eàÿ"\]1¡+h”£üE‰f?ÃЀ£üCˆÑ\ÇDX«kápÁȰp?Â4Ñv9?W_S3G3‚*nñC7ÜÛê†NØ’ÅÉ~+Å Ðâè_ e¼2àÿcxuF¹Z$ÄȽ{¨Að”Bðÿ‚HZP* A¨(’;‡Á.?Ä ‰#ü9‡…ì‚Ká4(=€ÒD œ î!7‚YyoIfnL:Æ?ÃÝ1€±† ‘wÃ)…Ìí]¢u` iSãht.x‚0P?ÀýIàž¦.qM/åè²l¡X5T¸”?Ô09máy”‡±0ÃðƒL€@‰ù€æ)`Ö’£’|ÜYéCiŒæ šì?Â-yoÎ Aá¹=%Dªƒü"wnlEK©µ0Ø«)Å@¬â$G‹þ 8-±ÖlÐ\?ˆR ƒü;¡'Yæx¬f?f5HagÅ&I?³ü¬dÔ¢${|?åºq´uÜYìÕƒM!—.ÍØË6 n‚ÿ"ÚbLh’ A}œ€²¼W wÛ¨^ 0¨>‰‘þCp‡àà„;. âa¶†jÂ8¯&'50¦UöQËñp/¤'ÒjUÏyóR%¹¶.¦Ýð€IE¨¶s"e W.r{‰Ï*WhD ¨Nx9{NC°‘á¼:ñüÈÈR+”zì6fôàoá¢ÛàÎ?ÆxÒIÄMO©_,B@K´`£&`»^B+°%b:$wÁ˜;³xj†ààøyÔ<8A•Ätþ ¡|19lñ¬§z®)“©D-…Ô–rÔƒ@{“‡ýЉ–öß²7¦ð¥ŸBCGìÄÅëYG._À¶(‰«ø78ÎBe cŒŠÂ"o«ˆyFR”¦s½6œi’ZÎ1gR5‡ø¹ƒüT Ñ‘#Ðÿ a8/â°Þö6È›‚*àDp?ÄÀ‰ÿb†@ÐÇý Ęš˜o(·A”BEV0Ö]S΀\ Ὡu>©ˆÍ.j£%\JVÏzð|@1†Fb†6ˆá)èbJ_ŠL°¥¢xQÏ¡:(°˜“BǺC½düEøwCo0„†É鹈#+†|³rr=ϺCPn-ø6ˆaþÃ`…Ö, ÀpDš²@ï?‡ òL’f(ªð‘ÕòènŠSeÑ'.øL¼áœHU ö ðÿAãâœW‹m@ÿÔ-‘‡ˆÏ,ê¢ã ‘‡¥õÇù[ áÙÜÐç2â–Ö¤!¨7ìÀÐoPf bÜàè?p0y´åœe=º}„è-x$è'èŠDzzÀÌCö>ËÚðAìÁx0‰×¢õþ'6È|¼Á´9Áþ A=ÙöÞÏåû_n?ÁH*³B$G þCPƒáÃð÷Ça›Æ·Íh¯³ý|’wb‹!j1.¨­á0':‹ýðe¹À¸œÁkÌŽü‰(–àH¬ÿôÿ!þ tÏá\M~ÚÁÒ@Ž.a´ÞÕʾÈHý‚¿ÇᆩÔÁ²AHv  Ð¤‹¶³K¶»Œ »¬£°j(†íM¸`H-pmaÌT ŽÄ Ïb Ê¡þ DAôüGæ!¶ÞÃ86<9. x¦’à{ kô¤D"è ŠA ™*!þAúÁèà €¬ -º0Î#A\0P`JÀV¹ë¢  $ Ä hÂAL Â Р Êf€ª &R`Záü  Ꭰ`óç†Dg+ãaäÔ,­pßpö$ È Æ`@êÙ Ü¡þ¡I òAþÀ~+‘ ?©~ëHÎàP³ì2O‡ÈáC äÙ‘*e ¡þq°.mH OÆ @õD˜5ä03é&9Ç"0ÑVw±Z|‰¢Ål/à¡änÎí îau ª´køÁ\—àØ-Ó 5h(ÂáD—îÎÒ À¤i8 hnÒ(µð48!Cæ~í[É&S'üyp*´2Lñ‚ÖÇ`aªê`í ÂÏ€å ª þÍ Ø  è$¡PI~ñŽvÿ‰ŸÌþ`úþ­~ëM™!êH Ò$w`Ä!þöð€aTC:TGD´@YÀš `ETX @Ú€öûàbmJ`áhè…7áü ^O8ºXT”³œ@ITŽÔÂCf Ô53´9K4µKt¸Zü’0v !† ‹’ÀGaÉL2 b tÙ+Ô»NtéN´é" ‚ÎŽÀ99Àò aEN"O ÂOU NÕQµQ£…#4áQâ 00¸ ª À È (R€ü '€ü 'StepTalk-0.10.0/Applications/ScriptPapers/ScriptPaperController.h0000664000175000017500000000225614633027767024145 0ustar yavoryavor/** ScriptPaper Copyright (c) 2003 Stefan Urbanek Written by: Stefan Urbanek Date: 2003 Apr 26 This file is part of the Farmer application. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #import @class ScriptPaper; @class NSTextView; @class NSForm; @class NSWindow; @interface ScriptPaperController:NSWindowController { NSTextView *sourceView; } - (IBAction)doSelection:(id)sender; - (IBAction)doAndShowSelection:(id)sender; @end StepTalk-0.10.0/Applications/ScriptPapers/AppController.h0000664000175000017500000000174014633027767022426 0ustar yavoryavor/** Controller Copyright (c) 2003 Stefan Urbanek Written by: Stefan Urbanek Date: 2003 Apr 26 This file is part of the Farmer application. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #import @interface AppController : NSObject { } @end StepTalk-0.10.0/Applications/ScriptPapers/ScriptPapersInfo.plist0000664000175000017500000000132714633027767024002 0ustar yavoryavor{ ApplicationName = "Script Papers"; ApplicationDescription = "Application for writing script papers."; ApplicationRelease = "0.1.0"; Authors = ("Stefan Urbanek "); Copyright = "Copyright (c) 2003 Stefan Urbanek "; CopyrightDescription = "This program is released under the GNU General Public License"; NSIcon = ScriptPapers; NSTypes = ( { NSUnixExtensions = ("spaper"); NSName = "spaper"; NSHumanReadableName = "Script Paper"; NSMIMETypes = ("application/spaper"); NSIcon = ScriptPaperFile; NSRole = Editor; NSDocumentClass = ScriptPaper; } ); } StepTalk-0.10.0/Applications/ScriptPapers/NSTextView+additions.m0000664000175000017500000000235214633027767023641 0ustar yavoryavor/** NSTextView additions Copyright (c) 2003 Stefan Urbanek Written by: Stefan Urbanek Date: 2003 Apr 26 This file is part of the Farmer application. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #import "NSTextView+additions.h" @implementation NSTextView(PaperAdditions) - (NSString *)selectedString { NSRange range = [self selectedRange]; return [[self attributedSubstringFromRange:range] string]; } - (BOOL)hasSelection { NSRange range = [self selectedRange]; return (range.length != 0); } @end StepTalk-0.10.0/Applications/ScriptPapers/AppController.m0000664000175000017500000000301314633027767022426 0ustar yavoryavor/** Controller Copyright (c) 2003 Stefan Urbanek Written by: Stefan Urbanek Date: 2003 Apr 26 This file is part of the Farmer application. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #import "AppController.h" #import #import #import #import #import #import #import "ScriptPaper.h" #import "ScriptPaperController.h" @interface AppController(Private) @end @implementation AppController - init { self = [super init]; return self; } - (void)dealloc { [super dealloc]; } - (void)applicationDidFinishLaunching:(id)notif { /* Go to known state of application */ [[NSDocumentController sharedDocumentController] newDocument:nil]; } @end StepTalk-0.10.0/Applications/ScriptPapers/ScriptPaperController.m0000664000175000017500000000470114633027767024147 0ustar yavoryavor/** Controller Copyright (c) 2003 Stefan Urbanek Written by: Stefan Urbanek Date: 2003 Apr 26 This file is part of the Farmer application. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #import "ScriptPaperController.h" #import #import #import #import #import "NSTextView+additions.h" #import "ScriptPaper.h" @implementation ScriptPaperController - init { return [self initWithWindowNibName:@"Paper"]; } - (void)windowDidLoad { [sourceView setRichText:NO]; [sourceView setString:@"This is a paper.\n1 + 1"]; } - (void)dealloc { [super dealloc]; } /** Execute selected text as script. */ - (IBAction)doSelection:(id)sender { NSString *selectedString = [sourceView selectedString]; NSLog(@"Do!"); [[self document] executeScriptString:selectedString]; } /** Execute selected text as script and insert result into the paper. */ - (IBAction)doAndShowSelection:(id)sender { NSString *selectedString = [sourceView selectedString]; NSRange range; id string; id retval = nil; NSLog(@"Do and Show!"); retval = [[self document] executeScriptString:selectedString]; if (!retval) { retval = @"(nil)"; } range = [sourceView selectedRange]; range = NSMakeRange(NSMaxRange(range), 0); [sourceView setSelectedRange:range]; if ([retval isKindOfClass:[NSString class]] || [retval isKindOfClass:[NSAttributedString class]]) { string = retval; } else { string = [retval description]; } [sourceView insertText:@" "]; [sourceView insertText:string]; range = NSMakeRange(range.location + 1, [string length]); } @end StepTalk-0.10.0/Applications/ScriptPapers/main.m0000664000175000017500000000207714633027767020577 0ustar yavoryavor/** main Copyright (c) 2002 Stefan Urbanek Written by: Stefan Urbanek Date: 2002 Feb 20 This file is part of the Farmer application. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #import #define APP_NAME @"GNUstep" /* * Initialise and go! */ int main(int argc, const char *argv[]) { return NSApplicationMain (argc, argv); } StepTalk-0.10.0/Applications/ScriptPapers/NSObject+NibLoading.m0000664000175000017500000000317314633027767023322 0ustar yavoryavor/** NSObject+NibLoading Copyright (c) 2002 Stefan Urbanek Written by: Stefan Urbanek Date: 2002 Oct 10 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #import "NSObject+NibLoading.h" #import #import @implementation NSObject(NibLoading) - (BOOL)loadMyNibNamed:(NSString *)aName { NSDictionary *dict; NSBundle *bundle; BOOL flag; dict = [NSDictionary dictionaryWithObjectsAndKeys:self, @"NSOwner", nil, nil]; bundle = [NSBundle bundleForClass:[self class]]; flag = [bundle loadNibFile:aName externalNameTable:dict withZone:[self zone]]; if(!flag) { NSRunAlertPanel(@"Unable to load resources", @"Unable to load '%@' resources", @"Cancel", nil, nil, aName); } return flag; } @end StepTalk-0.10.0/Applications/ScriptPapers/ScriptPaper.h0000664000175000017500000000210114633027767022066 0ustar yavoryavor/** ScriptPaper Copyright (c) 2003 Stefan Urbanek Written by: Stefan Urbanek Date: 2003 Apr 26 This file is part of the Farmer application. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #import @class STEnvironment; @interface ScriptPaper:NSDocument { STEnvironment *environment; } - (id)executeScriptString:(NSString *)source; @end StepTalk-0.10.0/Applications/ScriptPapers/English.lproj/0000775000175000017500000000000014633027767022205 5ustar yavoryavorStepTalk-0.10.0/Applications/ScriptPapers/English.lproj/Paper.gorm/0000775000175000017500000000000014633027767024217 5ustar yavoryavorStepTalk-0.10.0/Applications/ScriptPapers/English.lproj/Paper.gorm/objects.gorm0000664000175000017500000000371014633027767026537 0ustar yavoryavorGNUstep archive00002968:00000016:00000031:00000001:01GSNibContainer1NSObject01NSMutableDictionary1 NSDictionary&01NSString&% NSOwner0±&% ScriptPaperController0±&% GSCustomClassMap0±&0±&% TextView01 NSTextView1NSText1NSView1 NSResponder% A˜  Cî€ C¤  Cî€ C¤&0 1 NSMutableArray1 NSArray&0 1 NSColor0 ±&% NSNamedColorSpace0 ±&% System0 ±&% textBackgroundColor  K–€ K–€0± ° ° 0±& %  textColor Cî€ K–€0±& %  ScrollView01 NSScrollView%  Cú C¦  Cú C¦&0± &01 NSClipView% A¨ @ Cî€ C¤ A˜  Cî€ C¤&0± &°° 01 NSScroller1 NSControl% @ @ A C¤  A C¤&0± &%01NSCell0±&01NSFont0±& %  Helvetica A`A`&&&&&&&&&°2 _doScroll:v12@0:4@8°% A A A A °0±& %  GormNSWindow01NSWindow%  Cú C¦&% C\ D@À0±%  Cú C¦  Cú C¦&0± &°0± ° 0 ±&% System0!±&% windowBackgroundColor0"±&% Window0#±&% Window0$±&% Window ?€ Aø F@ F@%0%1NSImage0&±&% NSApplicationIcon0'± &0(1NSNibConnector°0)±&% NSOwner0*±°0+±°0,1NSNibOutletConnector°)°0-±&% window0.±°°)0/±&% delegate00±°)°01±& %  sourceViewStepTalk-0.10.0/Applications/ScriptPapers/English.lproj/Paper.gorm/data.classes0000664000175000017500000000674214633027767026520 0ustar yavoryavor{ FirstResponder = { Actions = ( "activateContextHelpMode:", "alignCenter:", "alignJustified:", "alignLeft:", "alignRight:", "arrangeInFront:", "cancel:", "capitalizeWord:", "changeColor:", "changeFont:", "checkSpelling:", "close:", "complete:", "copy:", "copyFont:", "copyRuler:", "cut:", "delete:", "deleteBackward:", "deleteForward:", "deleteToBeginningOfLine:", "deleteToBeginningOfParagraph:", "deleteToEndOfLine:", "deleteToEndOfParagraph:", "deleteToMark:", "deleteWordBackward:", "deleteWordForward:", "deminiaturize:", "deselectAll:", "fax:", "hide:", "hideOtherApplications:", "indent:", "loosenKerning:", "lowerBaseline:", "lowercaseWord:", "makeKeyAndOrderFront:", "miniaturize:", "miniaturizeAll:", "moveBackward:", "moveBackwardAndModifySelection:", "moveDown:", "moveDownAndModifySelection:", "moveForward:", "moveForwardAndModifySelection:", "moveLeft:", "moveRight:", "moveToBeginningOfDocument:", "moveToBeginningOfLine:", "moveToBeginningOfParagraph:", "moveToEndOfDocument:", "moveToEndOfLine:", "moveToEndOfParagraph:", "moveUp:", "moveUpAndModifySelection:", "moveWordBackward:", "moveWordBackwardAndModifySelection:", "moveWordForward:", "moveWordForwardAndModifySelection:", "newDocument:", "ok:", "openDocument:", "orderBack:", "orderFront:", "orderFrontColorPanel:", "orderFrontDataLinkPanel:", "orderFrontFontPanel:", "orderFrontHelpPanel:", "orderFrontSharedMemoryPanel:", "orderFrontStandardAboutPanel:", "orderFrontStandardInfoPanel:", "orderOut:", "pageDown:", "pageUp:", "paste:", "pasteAsPlainText:", "pasteAsRichText:", "pasteFont:", "pasteRuler:", "performClose:", "performMiniaturize:", "performZoom:", "print:", "raiseBaseline:", "revertDocumentToSaved:", "runPageLayout:", "runToolbarCustomizationPalette:", "saveAllDocuments:", "saveDocument:", "saveDocumentAs:", "saveDocumentTo:", "scrollLineDown:", "scrollLineUp:", "scrollPageDown:", "scrollPageUp:", "scrollViaScroller:", "selectAll:", "selectLine:", "selectNextKeyView:", "selectParagraph:", "selectPreviousKeyView:", "selectText:", "selectText:", "selectToMark:", "selectWord:", "showContextHelp:", "showGuessPanel:", "showHelp:", "showWindow:", "stop:", "subscript:", "superscript:", "swapWithMark:", "takeDoubleValueFrom:", "takeFloatValueFrom:", "takeIntValueFrom:", "takeObjectValueFrom:", "takeStringValueFrom:", "terminate:", "tightenKerning:", "toggle:", "toggleContinuousSpellChecking:", "toggleRuler:", "toggleToolbarShown:", "toggleTraditionalCharacterShape:", "transpose:", "transposeWords:", "turnOffKerning:", "turnOffLigatures:", "underline:", "unhide:", "unhideAllApplications:", "unscript:", "uppercaseWord:", "useAllLigatures:", "useStandardKerning:", "useStandardLigatures:", "yank:", "zoom:" ); Super = NSObject; }; ScriptPaperController = { Actions = ( ); Outlets = ( sourceView ); Super = NSWindowController; }; }StepTalk-0.10.0/Applications/ScriptPapers/English.lproj/ScriptPapers.gorm/0000775000175000017500000000000014633027767025567 5ustar yavoryavorStepTalk-0.10.0/Applications/ScriptPapers/English.lproj/ScriptPapers.gorm/objects.gorm0000664000175000017500000003132014633027767030105 0ustar yavoryavorGNUstep archive00002968:0000000e:000001c0:00000022:01GSNibContainer1NSObject01NSMutableDictionary1 NSDictionary&`01NSString& %  GormNSMenu101NSMenu0±&% Edit01NSMutableArray1NSArray&01 NSMenuItem0±&% Cut0 ±&% x&&ÿ%0 1 NSImage0 ±&% common_2DCheckMark0 ± 0 ±& %  common_2DDash2 cut:@12@0:4@8%0± 0±&% Copy0±&% c&&ÿ%° ° 2 copy:@12@0:4@8%0± 0±&% Paste0±&% v&&ÿ%° ° 2 paste:@12@0:4@8%0± 0±& %  Select All0±&% a&&ÿ%° ° 2 selectAll:v12@0:4@8%0± 0±&% Find0±&&&ÿ%° ° 2submenuAction:%0±°0±&0± 0±& %  Find Panel...0±&% f&&ÿ%° ° ’%0± 0 ±& %  Find Next0!±&% g&&ÿ%° ° ’%0"± 0#±& %  Find Previous0$±&% d&&ÿ%° ° ’%0%± 0&±&% Enter Selection0'±&% e&&ÿ%° ° ’%0(± 0)±&% Jump To Selection0*±&% j&&ÿ%° ° ’%°0+± 0,±& %  Font Panel...0-±&% t&&ÿ%° ° 2 orderFrontFontPanel:v12@0:4@8%0.± 0/±& %  Colors...00±&&&ÿ%° ° 2 orderFrontColorPanel:v12@0:4@8%01±& %  MenuItem3202± 03±& %  Copy Ruler04±&% 1&&ÿ%° ° 2 copyRuler:v12@0:4@8%05±& %  GormNSMenu206±07±&% Windows08±&09± 0:±&% Arrange In Front0;±&&&ÿ%° ° 2  arrangeInFront:v12@0:4@8%0<± 0=±&% Miniaturize Window0>±&% m&&ÿ%° ° 2  performMiniaturize:v12@0:4@8%0?± 0@±& %  Close Window0A±&% w&&ÿ%° ° 2 performClose:v12@0:4@8%0B±& %  MenuItem330C± 0D±& %  Paste Ruler0E±&% 2&&ÿ%° ° 2 pasteRuler:v12@0:4@8%0F±& %  GormNSMenu30G±0H±&% Services0I±&0J±& %  MenuItem340K± 0L±& %  Font Panel...0M±&% t&&ÿ%° ° ²%0N±& %  GormNSMenu40O±0P±&% Paper0Q±&0R± 0S±&% Open...0T±&% o&&ÿ%° ° 2 openDocument:@12@0:4@8%0U± 0V±&% New0W±&% n&&ÿ%° ° 2 newDocument:v12@0:4@8%0X± 0Y±&% Save...0Z±&% s&&ÿ%° ° 2 saveDocument:v12@0:4@8%0[± 0\±& %  Save As...0]±&% S&&ÿ%° ° 2 saveDocumentAs:v12@0:4@8%0^± 0_±& %  Save To...0`±&&&ÿ%° ° 2 saveDocumentTo:v12@0:4@8%0a± 0b±&% Save All0c±&&&ÿ%° ° 2 saveAllDocuments:v12@0:4@8%0d± 0e±&% Close0f±&&&ÿ%° ° 2 close:@12@0:4@8%0g±& %  MenuItem350h± 0i±&% Bold0j±&% b&&ÿ%° ° 2 addFontTrait:v12@0:4@8%0k±& %  GormNSMenu50l±0m±&% Format0n±&0o± 0p±&% Font0q±&&&ÿ%° ° ²%0r±°p0s±&  °K°h0t± 0u±&% Italic0v±&% i&&ÿ%° ° ²%0w± 0x±& %  Underline0y±&&&ÿ%° ° 2 underline:v12@0:4@8%0z± 0{±& %  Superscript0|±&&&ÿ%° ° 2 superscript:v12@0:4@8%0}± 0~±& %  Subscript0±&&&ÿ%° ° 2 subscript:v12@0:4@8%0€± 0±&% Unscript0‚±&&&ÿ%° ° 2 unscript:v12@0:4@8%0ƒ± 0„±& %  Copy Font0…±&% 3&&ÿ%° ° 2 copyFont:v12@0:4@8%0†± 0‡±& %  Paste Font0ˆ±&% 4&&ÿ%° ° 2 pasteFont:v12@0:4@8%°l0‰± 0б&% Text0‹±&&&ÿ%° ° ²%0Œ±°Š0±&0ޱ 0±& %  Align Left0±&&&ÿ%° ° 2 alignLeft:v12@0:4@8%0‘± 0’±&% Center0“±&&&ÿ%° ° 2 alignCenter:v12@0:4@8%0”± 0•±& %  Align Right0–±&&&ÿ%° ° 2 alignRight:v12@0:4@8%0—± 0˜±& %  Show Ruler0™±&&&ÿ%° ° 2 toggleRuler:v12@0:4@8%°2°C°l0š± 0›±& %  Colors...0œ±&&&ÿ%° ° ²%0± 0ž±&% Page Layout...0Ÿ±&% P&&ÿ%° ° 2 runPageLayout:v12@0:4@8%0 ±& %  MenuItem36°t0¡±& %  GormNSMenu6°Œ0¢±& %  MenuItem37°w0£±& %  GormNSMenu7°r0¤±& %  MenuItem38°z0¥±& %  GormNSMenu8°0¦±& %  MenuItem39°}0§±& %  MenuItem600¨± 0©±&% Script0ª±&&&ÿ%° ° ²%0«±0¬±&% Do0­±&0®± 0¯±& %  Do Selection0°±&% e&&ÿ%° ° ’%0±± 0²±&% Do and Show Selection0³±&% d&&ÿ%° ° ’%0´±0µ±& %  Script Papers0¶±&  0·± 0¸±&% Info0¹±&&&ÿ%° ° ²%0º±°¸0»±&0¼± 0½±& %  Info Panel...0¾±&&&ÿ%° ° 2  orderFrontStandardInfoPanel:v12@0:4@8%0¿± 0À±&% Preferences...0Á±&&&ÿ%° ° ’%0± 0ñ&% Help...0ı&% ?&&ÿ%° ° ’%°´0ű °P0Ʊ&&&ÿ%° ° ²%°O°´0DZ °0ȱ&&&ÿ%° ° ²%°°´°¨0ɱ 0ʱ&% Tools0˱&&&ÿ%° ° ²%0̱°Ê0ͱ&0α 0ϱ& %  Inspector0б&% 1&&ÿ%° ° ’%°´0ѱ °70Ò±&&&ÿ%° ° ²%°6°´0Ó± °H0Ô±&&&ÿ%° ° ²%°G°´0Õ± 0Ö±&% Hide0×±&% h&&ÿ%° ° 2! hide:v12@0:4@8%0ر 0Ù±&% Quit0Ú±&% q&&ÿ%° ° 2" terminate:v12@0:4@8%0Û±& %  GormNSMenu9°«0ܱ& %  MenuItem61°É0ݱ& %  MenuItem62°Ñ0Þ±& %  MenuItem63°Ó0ß±& %  MenuItem64°Õ0à±& %  MenuItem65°Ø0á±& %  MenuItem660â± 0ã±&% Font0ä±&&&ÿ%° ° ²%0å±°ã0æ±&0ç± 0è±&% Bold0é±&% b&&ÿ%° ° ²%0ê± 0ë±&% Italic0ì±&% i&&ÿ%° ° ²%0í± 0î±& %  Underline0ï±&&&ÿ%° ° ²%0ð± 0ñ±& %  Superscript0ò±&&&ÿ%° ° ²%0ó± 0ô±& %  Subscript0õ±&&&ÿ%° ° ²%0ö± 0÷±&% Unscript0ø±&&&ÿ%° ° ²%0ù± 0ú±& %  Copy Font0û±&% 3&&ÿ%° ° ²%0ü± 0ý±& %  Paste Font0þ±&% 4&&ÿ%° ° ²%0ÿ±P±&% FormatP±&°âP± P±&% TextP±&&&ÿ%° ° ²%P±ÐP±&P± P±& %  Align LeftP ±&&&ÿ%° ° ²%P ± P ±&% CenterP ±&&&ÿ%° ° ²%P ± P±& %  Align RightP±&&&ÿ%° ° ²%P± P±& %  Show RulerP±&&&ÿ%° ° ²%P± P±& %  Copy RulerP±&% 1&&ÿ%° ° ²%P± P±& %  Paste RulerP±&% 2&&ÿ%° ° ² %°ÿP± P±&% Page Layout...P±&% P&&ÿ%° ° ²%P±& %  MenuItem67ÐP±&% NSMenu°´P±& %  NSVisibleP±&P ±& %  MenuItem68ÐP!±& %  MenuItem69°+P"±& %  MenuItem10°P#±& %  MenuItem11°ÑP$±& %  MenuItem12°9P%±& %  MenuItem13°±& %  MenuItem75°öP?±& %  MenuItem76°ùP@±& %  MenuItem77°üPA±& %  GormNSMenu10°ÌPB±& %  GormNSMenu11°ÿPC±& %  GormNSMenu12°åPD±& %  MenuItem20°[PE±& %  MenuItem21°^PF±& %  GormNSMenu°ºPG±& %  MenuItem22°aPH±& %  MenuItem23°.PI±& %  MenuItem24°dPJ±& %  MenuItem25°oPK±& %  MenuItem26°‰PL±& %  MenuItem27°PM±& %  MenuItem28°ŽPN±& %  MenuItem29°‘PO±& %  MenuItem1°ØPP±&% NSOwnerPQ±& %  NSApplicationPR±& %  MenuItem50°¨PS±& %  MenuItem2°·PT±& %  MenuItem51°®PU±& %  MenuItem3°¼PV±& %  MenuItem52°ÉPW±& %  MenuItem4°¿PX±& %  MenuItem53°ÎPY±& %  MenuItem5°ÂPZ±& %  MenuItem54°±P[±& %  MenuItem6°ÇP\±& %  MenuItem55°ÅP]±& %  MenuItem7°P^±& %  MenuItem56°ÓP_±& %  MenuItem8°P`±& %  MenuItem57°·Pa±& %  MenuItem9°Pb±& %  MenuItem58°ÅPc±& %  MenuItem59°ÇPd±&% GSCustomClassMapPe±&Pf±& %  MenuItem30°”Pg±& %  MenuItem31°—Ph±&SSPi1 NSNibConnectorÐPj±&% NSOwnerPk± Ð9ÐPl± ÐOÐPm± Ð`ÐPn± ÐFÐ`Po± ÐUÐFPp± ÐWÐFPq± ÐYÐFPr± ÐcÐPs± °ÐcPt± Ð]°Pu± Ð_°Pv± Ða°Pw± Ð"°Px± Ð#ÐPy± °5Ð#Pz± Ð$°5P{± Ð%°5P|± Ð&°5P}± Ð^ÐP~± °FÐ^P± ÐbÐP€± °NÐbP± °NP‚± °NPƒ± Ð+°NP„± ÐD°NP…± ÐE°NP†± ÐG°NP‡± ÐI°NPˆ± ÐJ°kP‰± ÐK°kPб ÐL°kP‹± °¡ÐKPŒ± ÐM°¡P± ÐN°¡Pޱ Ðf°¡P± Ðg°¡P± °1°¡P‘± °B°¡P’± °£ÐJP“± °J°£P”± °g°£P•± ° °£P–± °¢°£P—± °¤°£P˜± °¦°£P™± Ð,°£Pš± Ð-°£P›± Ð.°£Pœ± Ð/°kP± Ð0°Pž± °¥Ð0PŸ± Ð1°¥P ± Ð2°¥P¡± Ð3°¥P¢± Ð4°¥P£± Ð5°¥P¤± ÐRÐP¥± °ÛÐRP¦± ÐT°ÛP§± ÐVÐP¨± ÐAÐVP©± ÐXÐAPª± ÐZ°ÛP«1 NSNibControlConnectorÐTP¬±&% NSFirstP­±& %  doSelection:P®± ÐZЬP¯±&% doAndShowSelection:P°± Ð;ÐjP±1NSNibOutletConnectorÐjÐ;P²±&% delegateP³± °áÐBP´± ÐÐBPµ± Ð ÐBP¶± ÐC°áP·± Ð6ÐCP¸± Ð7ÐCP¹± Ð8ÐCPº± Ð:ÐCP»± Ð=ÐCP¼± Ð>ÐCP½± Ð?ÐCP¾± Ð@ÐCP¿± Ð!°PÀ± ÐH°StepTalk-0.10.0/Applications/ScriptPapers/English.lproj/ScriptPapers.gorm/data.classes0000664000175000017500000000676114633027767030071 0ustar yavoryavor{ AppController = { Actions = ( ); Outlets = ( ); Super = NSObject; }; FirstResponder = { Actions = ( "activateContextHelpMode:", "alignCenter:", "alignJustified:", "alignLeft:", "alignRight:", "arrangeInFront:", "cancel:", "capitalizeWord:", "changeColor:", "changeFont:", "checkSpelling:", "close:", "complete:", "copy:", "copyFont:", "copyRuler:", "cut:", "delete:", "deleteBackward:", "deleteForward:", "deleteToBeginningOfLine:", "deleteToBeginningOfParagraph:", "deleteToEndOfLine:", "deleteToEndOfParagraph:", "deleteToMark:", "deleteWordBackward:", "deleteWordForward:", "deminiaturize:", "deselectAll:", "fax:", "hide:", "hideOtherApplications:", "indent:", "loosenKerning:", "lowerBaseline:", "lowercaseWord:", "makeKeyAndOrderFront:", "miniaturize:", "miniaturizeAll:", "moveBackward:", "moveBackwardAndModifySelection:", "moveDown:", "moveDownAndModifySelection:", "moveForward:", "moveForwardAndModifySelection:", "moveLeft:", "moveRight:", "moveToBeginningOfDocument:", "moveToBeginningOfLine:", "moveToBeginningOfParagraph:", "moveToEndOfDocument:", "moveToEndOfLine:", "moveToEndOfParagraph:", "moveUp:", "moveUpAndModifySelection:", "moveWordBackward:", "moveWordBackwardAndModifySelection:", "moveWordForward:", "moveWordForwardAndModifySelection:", "newDocument:", "ok:", "openDocument:", "orderBack:", "orderFront:", "orderFrontColorPanel:", "orderFrontDataLinkPanel:", "orderFrontFontPanel:", "orderFrontHelpPanel:", "orderFrontSharedMemoryPanel:", "orderFrontStandardAboutPanel:", "orderFrontStandardInfoPanel:", "orderOut:", "pageDown:", "pageUp:", "paste:", "pasteAsPlainText:", "pasteAsRichText:", "pasteFont:", "pasteRuler:", "performClose:", "performMiniaturize:", "performZoom:", "print:", "raiseBaseline:", "revertDocumentToSaved:", "runPageLayout:", "runToolbarCustomizationPalette:", "saveAllDocuments:", "saveDocument:", "saveDocumentAs:", "saveDocumentTo:", "scrollLineDown:", "scrollLineUp:", "scrollPageDown:", "scrollPageUp:", "scrollViaScroller:", "selectAll:", "selectLine:", "selectNextKeyView:", "selectParagraph:", "selectPreviousKeyView:", "selectText:", "selectText:", "selectToMark:", "selectWord:", "showContextHelp:", "showGuessPanel:", "showHelp:", "showWindow:", "stop:", "subscript:", "superscript:", "swapWithMark:", "takeDoubleValueFrom:", "takeFloatValueFrom:", "takeIntValueFrom:", "takeObjectValueFrom:", "takeStringValueFrom:", "terminate:", "tightenKerning:", "toggle:", "toggleContinuousSpellChecking:", "toggleRuler:", "toggleToolbarShown:", "toggleTraditionalCharacterShape:", "transpose:", "transposeWords:", "turnOffKerning:", "turnOffLigatures:", "underline:", "unhide:", "unhideAllApplications:", "unscript:", "uppercaseWord:", "useAllLigatures:", "useStandardKerning:", "useStandardLigatures:", "yank:", "zoom:", "doSelection:", "doAndShowSelection:" ); Super = NSObject; }; }StepTalk-0.10.0/GNUmakefile.postamble0000664000175000017500000000326614633027767016470 0ustar yavoryavor# # GNUmakefile.postamble # # 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; see the file COPYING.LIB. # If not, write to the Free Software Foundation, # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # Project specific makefile rules # # Uncomment the targets you want. # The double colons (::) are important, do not make them single colons # otherwise the normal makefile rules will not be performed. # # Things to do before compiling before-all:: ln -sf Source/Headers . # Things to do after compiling # after-all:: # Things to do before installing # before-install:: # Things to do after installing # after-install:: # Things to do before uninstalling # before-uninstall:: # Things to do after uninstalling # after-uninstall:: # Things to do before cleaning # before-clean:: # Things to do after cleaning # after-clean:: # Things to do before distcleaning # before-distclean:: # Things to do after distcleaning # after-distclean:: # Things to do before checking # before-check:: # Things to do after checking # after-check:: StepTalk-0.10.0/Frameworks/0000775000175000017500000000000014633027767014542 5ustar yavoryavorStepTalk-0.10.0/Frameworks/GNUmakefile0000664000175000017500000000207714633027767016622 0ustar yavoryavor# # Main Makefile for the StepTalk # # Copyright (C) 2000 Stefan Urbanek # # Written by: 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., 59 Temple Place, Suite 330, Boston, MA 02111 USA # include $(GNUSTEP_MAKEFILES)/common.make SUBPROJECTS = \ StepTalk -include GNUMakefile.preamble include $(GNUSTEP_MAKEFILES)/aggregate.make -include GNUMakefile.postamble StepTalk-0.10.0/Frameworks/StepTalk/0000775000175000017500000000000014633027767016271 5ustar yavoryavorStepTalk-0.10.0/Frameworks/StepTalk/NSInvocation+additions.h0000664000175000017500000000271514633027767022773 0ustar yavoryavor/** NSInvocation+additions.h Various NSInvocation 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 void STGetValueOfTypeFromObject(void *value, const char *type, id anObject); id STObjectFromValueOfType(void *value, const char *type); @interface NSInvocation(STAdditions) + invocationWithTarget:(id)target selectorName:(NSString *)selectorName; + invocationWithTarget:(id)target selector:(SEL)selector; - (void)setArgumentAsObject:(id)anObject atIndex:(NSInteger)anIndex; - (id)getArgumentAsObjectAtIndex:(NSInteger)anIndex; - (id)returnValueAsObject; @end StepTalk-0.10.0/Frameworks/StepTalk/STScriptsManager.m0000664000175000017500000002035014633027767021640 0ustar yavoryavor/** 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 #import #import #import #import #import #import #import #import #import #import 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 { if ((self = [super init]) != nil) { 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 = NSStandardLibraryPaths(); 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]; } 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 StepTalk-0.10.0/Frameworks/StepTalk/NSObject+additions.m0000664000175000017500000000104614633027767022071 0ustar yavoryavor/** NSObject-additions.m Various methods for NSObject Copyright (c) 2002 Free Software Foundation This file is part of the StepTalk project. */ #import "NSObject+additions.h" @implementation NSObject (STAdditions) - (BOOL)isSame:(id)anObject { return self == anObject; } - (BOOL)notEqual:(id)anObject { return ![self isEqual:anObject]; } - (BOOL)notSame:(id)anObject { return ![self isSame:anObject]; } - (BOOL)isNil { return NO; } - (BOOL)notNil { return YES; } - (id)yourself { return self; } @end StepTalk-0.10.0/Frameworks/StepTalk/STDistantEnvironment.h0000664000175000017500000000060114633027767022541 0ustar yavoryavor/* FIXME: not used! just an unimplemented idea. */ #import @interface STDistantEnvironment:NSObject { NSStrnig *distantName; NSStrnig *distantHost; NSDistantObject *environment; } + environmentWithName:(NSString *)name host:(NSString *)host; - initWithName:(NSString *)name host:(NSString *)host; - (STConversation *)createConversation; @end StepTalk-0.10.0/Frameworks/StepTalk/STEnvironment.h0000664000175000017500000000437714633027767021230 0ustar yavoryavor/** 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 @class NSBundle; @class NSDictionary; @class NSMutableDictionary; @class NSMutableArray; @class NSMutableSet; @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 StepTalk-0.10.0/Frameworks/StepTalk/STBundleInfo.h0000664000175000017500000000347214633027767020744 0ustar yavoryavor/** STBundleInfo.h Bundle scripting information Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2003 Jan 22 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 NSArray; @interface STBundleInfo:NSObject { NSBundle *bundle; BOOL useAllClasses; NSArray *publicClasses; NSArray *allClasses; NSDictionary *objectReferenceDictionary; NSString *scriptingInfoClassName; Class scriptingInfoClass; } + infoForBundle:(NSBundle *)aBundle; - initWithBundle:(NSBundle *)aBundle; - (NSDictionary *)objectReferenceDictionary; - (NSDictionary *)namedObjects; - (NSArray *)publicClassNames; - (NSArray *)allClassNames; @end @interface NSBundle(STAdditions) + (NSArray *)stepTalkBundleNames; + stepTalkBundleWithName:(NSString *)moduleName; - (NSDictionary *)scriptingInfoDictionary; + (NSArray *)allFrameworkNames; + (NSString *)pathForFrameworkWithName:(NSString *)aName; + (NSBundle *)bundleForFrameworkWithName:(NSString *)aName; @end StepTalk-0.10.0/Frameworks/StepTalk/STObjectReference.h0000664000175000017500000000242114633027767021735 0ustar yavoryavor/** 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 StepTalk-0.10.0/Frameworks/StepTalk/STEnvironmentDescription.m0000664000175000017500000003210114633027767023423 0ustar yavoryavor/** 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 "STFunctions.h" #import "STBehaviourInfo.h" #import #import #import #import #import #import #import #import static NSDictionary *dictForDescriptionWithName(NSString *defName) { NSString *file; NSDictionary *dict; file = STFindResource(defName, STScriptingEnvironmentsDirectory, STScriptingEnvironmentExtension); 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 = @"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; NSString *str; NSInteger saveFlag = restriction; if(!def) { NSLog(@"Warning: nil dictionary for environmet description update"); return; }; pool = [NSAutoreleasePool new]; 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]; } } [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]; [behInfo release]; [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]; [class release]; 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 %li)", className, flag, (long)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 StepTalk-0.10.0/Frameworks/StepTalk/STEnvironmentDescription.h0000664000175000017500000000365414633027767023431 0ustar yavoryavor/** 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 }; @class NSDictionary; @class NSMutableArray; @class NSMutableDictionary; @interface STEnvironmentDescription:NSObject { NSMutableArray *usedDefs; NSMutableDictionary *classes; NSMutableDictionary *behaviours; NSMutableDictionary *aliases; NSMutableArray *modules; NSMutableArray *frameworks; NSMutableArray *finders; NSInteger 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 StepTalk-0.10.0/Frameworks/StepTalk/STScriptObject.m0000664000175000017500000001013314633027767021307 0ustar yavoryavor/* 2003 Aug 5 */ #import "STScriptObject.h" #import "NSInvocation+additions.h" #import "STEnvironment.h" #import "STEngine.h" #import "STExterns.h" #import "STObjCRuntime.h" #import #import #import #import #import #import @implementation STScriptObject /** Return new instance of script object without any instance variables */ + scriptObject { return AUTORELEASE([[self alloc] init]); } - init { if ((self = [super init]) != nil) { 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; NSUInteger index; NSUInteger 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 { if ((self = [super init] /*[super initWithCoder: decoder]*/) != nil) { [decoder decodeValueOfObjCType: @encode(id) at: &methodDictionary]; [decoder decodeValueOfObjCType: @encode(id) at: &ivars]; } return self; } @end StepTalk-0.10.0/Frameworks/StepTalk/STFunctions.h0000664000175000017500000000237214633027767020665 0ustar yavoryavor/** STFunctions.h Misc. functions 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 NSString; @class NSArray; NSArray *STFindAllResources(NSString *resourceDir, NSString *extension); NSString *STFindResource(NSString *name, NSString *resourceDir, NSString *extension); NSString *STUserConfigPath(void); StepTalk-0.10.0/Frameworks/StepTalk/STClassInfo.h0000664000175000017500000000300214633027767020565 0ustar yavoryavor/** STClassInfo.h Objective-C class wrapper 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 "STBehaviourInfo.h" @class NSString; @class NSMutableDictionary; @interface STClassInfo:STBehaviourInfo { STClassInfo *superclass; NSString *superclassName; BOOL allowAll; NSMutableDictionary *selectorCache; } - (NSString *)translationForSelector:(NSString *)aString; - (void)setSuperclassInfo:(STClassInfo *)classInfo; - (STClassInfo *)superclassInfo; - (void)setSuperclassName:(NSString *)aString; - (NSString *)superclassName; - (void)setAllowAllMethods:(BOOL)flag; - (BOOL)allowAllMethods; @end StepTalk-0.10.0/Frameworks/StepTalk/ScriptingInfo.plist0000664000175000017500000000050714633027767022126 0ustar yavoryavor{ ScriptingInfoClass = StepTalkScriptingInfo; Classes = ( STActor, STEnvironment, STLanguageManager, STScript, STScriptsManager, STBundleInfo, STEngine, STScriptObject, STConversation, STRemoteConversation, STContext ); } StepTalk-0.10.0/Frameworks/StepTalk/GNUmakefile0000664000175000017500000000601714633027767020347 0ustar yavoryavor# # GNUmakefile # # 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., 59 Temple Place, Suite 330, Boston, MA 02111 USA. include $(GNUSTEP_MAKEFILES)/common.make include ../../Version FRAMEWORK_NAME = StepTalk StepTalk_OBJC_FILES = \ NSInvocation+additions.m \ STActor.m \ STBehaviourInfo.m \ STBundleInfo.m \ STClassInfo.m \ STContext.m \ STConversation.m \ STRemoteConversation.m \ STEngine.m \ STEnvironment.m \ STEnvironmentDescription.m \ STExterns.m \ STFunctions.m \ STFileScript.m \ STLanguageManager.m \ STObjCRuntime.m \ STObjectReference.m \ STScript.m \ STScriptsManager.m \ STScripting.m \ STMethod.m \ STScriptObject.m \ STSelector.m \ STStructure.m \ STUndefinedObject.m \ NSNumber+additions.m \ NSObject+additions.m \ StepTalkScriptingInfo.m # FIXME: NOT FINISHED: # STRemoteConversation.m \ # STDistantEnvironment.m \ STEPTALK_HEADER_FILES = \ STActor.h \ STBundleInfo.h \ STContext.h \ STConversation.h \ STRemoteConversation.h \ STEngine.h \ STEnvironment.h \ STEnvironmentDescription.h \ STExterns.h \ STFunctions.h \ STFileScript.h \ STLanguageManager.h \ STObjCRuntime.h \ STObjectReference.h \ STMethod.h \ STScriptObject.h \ STScript.h \ STScriptsManager.h \ STScripting.h \ STSelector.h \ STUndefinedObject.h \ NSInvocation+additions.h \ NSObject+additions.h StepTalk_HEADER_FILES = $(STEPTALK_HEADER_FILES) \ StepTalk.h StepTalk_RESOURCE_FILES = ScriptingInfo.plist Environments ADDITIONAL_CPPFLAGS += -pipe ADDITIONAL_OBJCFLAGS = -Wno-import -DSTEPTALK_VERSION=$(STEPTALK_VERSION) DOCUMENT_NAME = StepTalk StepTalk_DOC_INSTALL_DIR = Developer StepTalk_HEADER_FILES_DIR = $(HEADER_DIR) StepTalk_AGSDOC_FILES = StepTalk.gsdoc $(STEPTALK_HEADER_FILES) StepTalk_AGSDOC_FLAGS = \ -Up StepTalk \ -Declared StepTalk \ -DocumentationDirectory ../../Documentation/Reference StepTalk_LIBRARIES_DEPEND_UPON += -lgnustep-base -lobjc ifeq ($(check),yes) ADDITIONAL_OBJCFLAGS += -Werror endif -include GNUmakefile.preamble include $(GNUSTEP_MAKEFILES)/framework.make ifeq ($(doc), yes) include $(GNUSTEP_MAKEFILES)/documentation.make endif -include GNUmakefile.postamble StepTalk-0.10.0/Frameworks/StepTalk/NSInvocation+additions.m0000664000175000017500000002535614633027767023006 0ustar yavoryavor/** NSInvocation+additions Various NSInvocation 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 NSInvocation class additions */ #import "NSInvocation+additions.h" #import #import #import #import #import #import #import "STExterns.h" #import "STObjCRuntime.h" #import "STScripting.h" #import "STSelector.h" #import "STStructure.h" #if 0 static Class NSNumber_class = nil; static Class NSString_class = nil; static Class NSValue_class = nil; #endif #define CASE_NUMBER_TYPE(otype,type,msgtype)\ case otype: object = [NSNumber numberWith##msgtype:*((type *)value)];\ NSDebugLLog(@"STStructure",\ @" is number value '%@'", object);\ break /** This method is a factory method, that means that you have to release the object when you no longer need it. */ id STObjectFromValueOfType(void *value, const char *type) { id object; NSDebugLLog(@"STStructure", @"object from value %p of of type '%c'", value, *type); switch (*type) { case _C_ID: case _C_CLASS: object = *((id *)value); NSDebugLLog(@"STStructure", @" is object value %p", object); break; CASE_NUMBER_TYPE(_C_CHR,char,Char); CASE_NUMBER_TYPE(_C_UCHR,unsigned char,UnsignedChar); CASE_NUMBER_TYPE(_C_SHT,short,Short); CASE_NUMBER_TYPE(_C_USHT,unsigned short,UnsignedShort); CASE_NUMBER_TYPE(_C_INT,int,Int); CASE_NUMBER_TYPE(_C_UINT,unsigned int,UnsignedInt); CASE_NUMBER_TYPE(_C_LNG,long,Long); CASE_NUMBER_TYPE(_C_ULNG,unsigned long,UnsignedLong); #ifdef _C_LNG_LNG CASE_NUMBER_TYPE(_C_LNG_LNG,long long,LongLong); CASE_NUMBER_TYPE(_C_ULNG_LNG,unsigned long long,UnsignedLongLong); #endif CASE_NUMBER_TYPE(_C_FLT,float,Float); CASE_NUMBER_TYPE(_C_DBL,double,Double); case _C_PTR: object = [NSValue valueWithPointer:*((void **)value)]; NSDebugLLog(@"STStructure", @" is pointer value %p", *((void **)value)); break; case _C_CHARPTR: object = [NSString stringWithCString:*((char **)value)]; NSDebugLLog(@"STStructure", @" is string value '%s'", *((char **)value)); break; case _C_VOID: object = nil; break; case _C_STRUCT_B: object = [[STStructure alloc] initWithValue:value type:type]; AUTORELEASE(object); break; case _C_SEL: object = [[STSelector alloc] initWithSelector:*((SEL *)value)]; AUTORELEASE(object); break; case _C_CONST: object = STObjectFromValueOfType(value, ++type); break; case _C_BFLD: case _C_UNDEF: case _C_ARY_B: case _C_ARY_E: case _C_UNION_B: case _C_UNION_E: case _C_STRUCT_E: default: [NSException raise:STInvalidArgumentException format:@"unhandled ObjC type '%s'", type]; } return object; } #define CASE_TYPE(otype,type,msgtype)\ case otype:*((type *)value) = [anObject msgtype##Value];\ NSDebugLLog(@"STStructure",\ @" is number value '%@'", anObject);\ break void STGetValueOfTypeFromObject(void *value, const char *type, id anObject) { NSDebugLLog(@"STStructure", @"value at %p from object '%@' of type '%c'", value, anObject, *type); switch (*type) { case _C_ID: case _C_CLASS: NSDebugLLog(@"STStructure", @" is object value"); *((id *)value) = anObject; break; CASE_TYPE(_C_CHR,char,char); CASE_TYPE(_C_UCHR,unsigned char,unsignedChar); CASE_TYPE(_C_SHT,short,short); CASE_TYPE(_C_USHT,unsigned short,unsignedShort); CASE_TYPE(_C_INT,int,int); CASE_TYPE(_C_UINT,unsigned int,unsignedInt); CASE_TYPE(_C_LNG,long,long); CASE_TYPE(_C_ULNG,unsigned long,unsignedLong); CASE_TYPE(_C_LNG_LNG,long long,longLong); CASE_TYPE(_C_ULNG_LNG,unsigned long long,unsignedLongLong); CASE_TYPE(_C_FLT,float,float); CASE_TYPE(_C_DBL,double,double); CASE_TYPE(_C_PTR,void *,pointer); case _C_CHARPTR: /* FIXME: check if this is good (copy/no copy)*/ *((const char **)value) = [anObject cString]; NSDebugLLog(@"STStructure", @" is cstring '%@'", anObject); break; case _C_STRUCT_B: /* FIXME: check for struct compatibility */ NSDebugLLog(@"STStructure", @" is structure"); [(STStructure*)anObject getValue:value]; break; case _C_SEL: *((SEL *)value) = [anObject selectorValue]; break; case _C_CONST: STGetValueOfTypeFromObject(value, ++type, anObject); break; case _C_BFLD: case _C_VOID: case _C_UNDEF: case _C_ATOM: case _C_ARY_B: case _C_ARY_E: case _C_UNION_B: case _C_UNION_E: case _C_STRUCT_E: default: [NSException raise:STInvalidArgumentException format:@"unhandled ObjC type '%s'", type]; } } @implementation NSInvocation(STAdditions) #if 0 /* with this method it does not work, it is not posiible to create an invocation*/ + (void)initialize { NSNumber_class = [NSNumber class]; NSString_class = [NSString class]; NSValue_class = [NSValue class]; } #endif + invocationWithTarget:(id)target selectorName:(NSString *)selectorName { NSMethodSignature *signature; NSInvocation *invocation; SEL sel; BOOL requiresRegistration = NO; // NSLog(@"GETTING SELECTOR %@", selectorName); sel = NSSelectorFromString(selectorName); if (!sel) { // NSLog(@"REGISTERING SELECTOR"); const char *name = [selectorName cString]; sel = sel_registerName(name); if (!sel) { [NSException raise:STInternalInconsistencyException format:@"Unable to register selector '%@'", selectorName]; return nil; } requiresRegistration = YES; } signature = [target methodSignatureForSelector:sel]; /* FIXME: this is workaround for gnustep DO bug (hight priority) */ if (requiresRegistration) { // NSLog(@"REGISTERING SELECTOR TYPES"); sel = GSSelectorFromNameAndTypes([selectorName cString], [signature methodReturnType]); // NSLog(@"REGISTERED %@", NSStringFromSelector(sel)); } if (!signature) { [NSException raise:STInternalInconsistencyException format:@"No method signature for selector '%@' for " @"receiver of type %@", selectorName, [target className]]; return nil; } invocation = [NSInvocation invocationWithMethodSignature:signature]; [invocation setSelector:sel]; [invocation setTarget:target]; return invocation; } + invocationWithTarget:(id)target selector:(SEL)selector { NSMethodSignature *signature; NSInvocation *invocation; signature = [target methodSignatureForSelector:selector]; if (!signature) { [NSException raise:STInternalInconsistencyException format:@"No method signature for selector '%@' for " @"receiver of type %@", NSStringFromSelector(selector), [target className]]; return nil; } invocation = [NSInvocation invocationWithMethodSignature:signature]; [invocation setSelector:selector]; [invocation setTarget:target]; return invocation; } - (void)setArgumentAsObject:(id)anObject atIndex:(NSInteger)anIndex { const char *type; NSUInteger size; void *value; type = [[self methodSignature] getArgumentTypeAtIndex:anIndex]; NSGetSizeAndAlignment(type, &size, NULL); value = NSZoneMalloc(STMallocZone, size); STGetValueOfTypeFromObject(value, type, anObject); [self setArgument:(void *)value atIndex:anIndex]; NSZoneFree(STMallocZone, value); } - (id)getArgumentAsObjectAtIndex:(NSInteger)anIndex { const char *type; NSUInteger size; void *value; id object; type = [[self methodSignature] getArgumentTypeAtIndex:anIndex]; NSGetSizeAndAlignment(type, &size, NULL); value = NSZoneMalloc(STMallocZone, size); [self getArgument:value atIndex:anIndex]; object = STObjectFromValueOfType(value, type); NSZoneFree(STMallocZone, value); return object; } - (id)returnValueAsObject { const char *type; NSUInteger returnLength; void *value; id returnObject = nil; NSMethodSignature *signature = [self methodSignature]; type = [signature methodReturnType]; returnLength = [signature methodReturnLength]; NSDebugLLog(@"STSending", @" return type '%s', buffer length %lu", type, (unsigned long)returnLength); if (returnLength != 0) { value = NSZoneMalloc(STMallocZone, returnLength); [self getReturnValue:value]; if (*type == _C_VOID) { returnObject = [self target]; } else { returnObject = STObjectFromValueOfType(value, type); } NSZoneFree(STMallocZone, value); NSDebugLLog(@"STSending", @" returned object %@", returnObject); } else { returnObject = [self target]; } return returnObject; } @end StepTalk-0.10.0/Frameworks/StepTalk/StepTalkScriptingInfo.m0000664000175000017500000000220314633027767022672 0ustar yavoryavor/** 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 StepTalk-0.10.0/Frameworks/StepTalk/STLanguageManager.m0000664000175000017500000002312614633027767021740 0ustar yavoryavor#import "STLanguageManager.h" #import "STExterns.h" #import #import #import #import #import #import #import #import #import 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 { if ((self = [super init]) != nil) { 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 { NSFileManager *manager = [NSFileManager defaultManager]; NSEnumerator *enumerator; NSBundle *bundle; NSString *path; NSArray *paths; BOOL isDir; paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSAllDomainsMask, YES); enumerator = [paths objectEnumerator]; /* find languages at knowl loactions */ while( (path = [enumerator nextObject]) ) { path = [path stringByAppendingPathComponent:@"StepTalk"]; path = [path stringByAppendingPathComponent:STLanguageBundlesDirectory]; if([manager fileExistsAtPath:path isDirectory:&isDir] && isDir) { [self _registerLanguagesFromPath:path]; } } /* find languages at known loactions */ 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; NSUInteger 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 StepTalk-0.10.0/Frameworks/StepTalk/STEngine.m0000664000175000017500000000646514633027767020136 0ustar yavoryavor/** 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 "STFunctions.h" #import "STLanguageManager.h" #import "STMethod.h" #import "STUndefinedObject.h" #import #import #import #import 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 deprecated, 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 StepTalk-0.10.0/Frameworks/StepTalk/STActor.m0000664000175000017500000001256714633027767020001 0ustar yavoryavor/** STActor StepTalk actor Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2005 June 30 License: LGPL This file is part of the StepTalk project. */ #import "STActor.h" #import "NSInvocation+additions.h" #import "STEngine.h" #import "STEnvironment.h" #import "STExterns.h" #import "STObjCRuntime.h" #import #import #import #import #import #import #import @implementation STActor /** Return new instance of script object without any instance variables */ + actorInEnvironment:(STEnvironment *)env { return AUTORELEASE([[self alloc] initWithEnvironment:env]); } + actor { return AUTORELEASE([[self alloc] init]); } - init { if ((self = [super init]) != nil) { methodDictionary = [[NSMutableDictionary alloc] init]; ivars = [[NSMutableDictionary alloc] init]; } return self; } - initWithEnvironment:(STEnvironment *)env; { if ((self = [self init]) != nil) { [self setEnvironment:env]; } return self; } - (void)dealloc { RELEASE(methodDictionary); RELEASE(ivars); [super dealloc]; } - (void)setValue:(id)value forKey:(NSString *)key { if (value == nil) { value = STNil; } /* FIXME: this is not optimal */ if ([ivars valueForKey:key] != nil) { [ivars setValue:value forKey:key]; } else { [super setValue:value forKey:key]; } } - (id)valueForKey:(NSString *)key { id value = nil; value = [ivars valueForKey:key]; if (value == nil) { value = [super valueForKey:key]; } return value; } - (NSArray *)instanceVariableNames { return [ivars allKeys]; } - (void)setInstanceVariables:(NSDictionary *)dictionary { [ivars removeAllObjects]; [ivars addEntriesFromDictionary:dictionary]; } - (NSDictionary *)instanceVariables { return [NSDictionary dictionaryWithDictionary:ivars]; } - (void)addInstanceVariable:(NSString *)aName { if ([ivars valueForKey:aName] == nil) { [ivars setValue: STNil forKey: aName]; } } - (void)removeInstanceVariable:(NSString *)aName { if ([ivars valueForKey:aName] != nil) { [ivars setValue: nil forKey: aName]; } } - (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; NSUInteger index; NSUInteger count; id retval = nil; method = [methodDictionary objectForKey:methodName]; if (!method) { [NSException raise:@"STActorException" 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 { if ((self = [super init] /*[super initWithCoder: decoder]*/) != nil) { [decoder decodeValueOfObjCType: @encode(id) at: &methodDictionary]; [decoder decodeValueOfObjCType: @encode(id) at: &ivars]; } return self; } @end StepTalk-0.10.0/Frameworks/StepTalk/STRemoteConversation.h0000664000175000017500000000305314633027767022540 0ustar yavoryavor/** 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" #import @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 StepTalk-0.10.0/Frameworks/StepTalk/STFileScript.h0000664000175000017500000000253114633027767020756 0ustar yavoryavor/** 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 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 StepTalk-0.10.0/Frameworks/StepTalk/STScriptingServer.h0000664000175000017500000000047014633027767022043 0ustar yavoryavor/* FIXME: not used! just an unimplemented idea. (See NSDistant*) */ @interface STScriptingServer { } + serverWithRegisteredName:(NSString *)name host:(NSString *)host; - registerLocallyWithName:(NSString *)name; - createConversation; - conversationWithInfo:(NSDictionary*)dict; @end StepTalk-0.10.0/Frameworks/StepTalk/StepTalk.gsdoc0000664000175000017500000000150314633027767021040 0ustar yavoryavor StepTalk Documentation 0.7.1 2003 Apr 22 Introduction

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. intro

StepTalk-0.10.0/Frameworks/StepTalk/StepTalkScriptingInfo.h0000664000175000017500000000206114633027767022667 0ustar yavoryavor/** 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 StepTalk-0.10.0/Frameworks/StepTalk/STBundleInfo.m0000664000175000017500000002405114633027767020745 0ustar yavoryavor/** STBundleInfo.h Bundle scripting information Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2003 Jan 22 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 "STBundleInfo.h" #import "STFunctions.h" #import "STExterns.h" #import #import #import #import #import #import #import #import static NSMutableDictionary *bundleInfoDict; @protocol STScriptingInfoClass + (NSDictionary *)namedObjectsForScripting; @end @interface STBundleInfo(STPrivateMethods) - (void) _bundleDidLoad:(NSNotification *)notif; - (void)_initializeScriptingInfoClass; @end @implementation NSBundle(STAdditions) /** Get list of all StepTalk bundles from Library/StepTalk/Bundles */ + (NSArray *)stepTalkBundleNames { NSArray *bundles; NSEnumerator *enumerator; NSString *path; NSMutableArray *names = [NSMutableArray array]; NSString *name; bundles = STFindAllResources(@"Bundles", STModuleExtension); enumerator = [bundles objectEnumerator]; while( (path = [enumerator nextObject]) ) { name = [path lastPathComponent]; name = [name stringByDeletingPathExtension]; [names addObject:name]; } bundles = STFindAllResources(@"Modules", STModuleExtension); enumerator = [bundles objectEnumerator]; while( (path = [enumerator nextObject]) ) { name = [path lastPathComponent]; name = [name stringByDeletingPathExtension]; [names addObject:name]; } return [NSArray arrayWithArray:names]; } + stepTalkBundleWithName:(NSString *)moduleName { NSString *file = STFindResource(moduleName, @"Bundles", @"bundle"); if(!file) { file = STFindResource(moduleName, STModulesDirectory, STModuleExtension); if(!file) { NSLog(@"Could not find bundle with name '%@'", moduleName); return nil; } } return AUTORELEASE([[self alloc] initWithPath:file]); } - (NSDictionary *)scriptingInfoDictionary { NSFileManager *manager = [NSFileManager defaultManager]; NSString *file; file = [self pathForResource:@"ScriptingInfo" ofType:@"plist"]; if([manager fileExistsAtPath:file]) { return [NSDictionary dictionaryWithContentsOfFile:file]; } else { return nil; } } /** Return names of all available frameworks in the system. */ + (NSArray *)allFrameworkNames { NSMutableArray *names = [NSMutableArray array]; NSFileManager *manager = [NSFileManager defaultManager]; NSArray *paths; NSEnumerator *fenum; NSEnumerator *penum; NSString *path; NSString *file; NSString *name; paths = NSStandardLibraryPaths(); penum = [paths objectEnumerator]; while( (path = [penum nextObject]) ) { path = [path stringByAppendingPathComponent:@"Frameworks"]; fenum = [[manager directoryContentsAtPath:path] objectEnumerator]; if( ![manager fileExistsAtPath:path isDirectory:NULL] ) { continue; } while( (file = [fenum nextObject]) ) { if( [[file pathExtension] isEqualToString:@"framework"] ) { name = [[file lastPathComponent] stringByDeletingPathExtension]; [names addObject:name]; } } } return names; } /** Return path for framework with name aName. */ + (NSString *)pathForFrameworkWithName:(NSString *)aName { NSFileManager *manager = [NSFileManager defaultManager]; NSArray *paths; NSEnumerator *fenum; NSEnumerator *penum; NSString *path; NSString *file; NSString *name; paths = NSStandardLibraryPaths(); penum = [paths objectEnumerator]; while( (path = [penum nextObject]) ) { path = [path stringByAppendingPathComponent:@"Frameworks"]; fenum = [[manager directoryContentsAtPath:path] objectEnumerator]; if( ![manager fileExistsAtPath:path isDirectory:NULL] ) { continue; } while( (file = [fenum nextObject]) ) { if( [[file pathExtension] isEqualToString:@"framework"] ) { name = [[file lastPathComponent] stringByDeletingPathExtension]; if([name isEqualToString:aName]) { return [path stringByAppendingPathComponent:file]; } } } } return nil; } /** Return bundle for framework with name aName. */ + (NSBundle *)bundleForFrameworkWithName:(NSString *)aName { return [self bundleWithPath:[self pathForFrameworkWithName:aName]];; } @end @implementation STBundleInfo + infoForBundle:(NSBundle *)aBundle { return AUTORELEASE([[self alloc] initWithBundle:aBundle]); } /** Initialize info with bundle aBundle. */ - initWithBundle:(NSBundle *)aBundle { STBundleInfo *info; NSString *flagString; NSDictionary *dict; if(!aBundle) { [NSException raise:@"STBundleException" format:@"Nil bundle specified"]; [self dealloc]; return nil; } info = [bundleInfoDict objectForKey:[aBundle bundlePath]]; if(info) { [self dealloc]; return RETAIN(info); } dict = [aBundle scriptingInfoDictionary]; if(!dict) { NSLog(@"Warning: Bundle '%@' does not provide scripting capabilities.", [aBundle bundlePath]); [self dealloc]; return nil; } ASSIGN(bundle, aBundle); #if 0 /* FIXME: remove observer somewhere */ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_bundleDidLoad:) name:NSBundleDidLoadNotification object:self]; #endif flagString = [dict objectForKey:@"UseAllClasses"]; flagString = [flagString lowercaseString]; useAllClasses = [flagString isEqualToString:@"yes"]; if([dict objectForKey: @"STClasses"]) { NSLog(@"WARNING: Use 'Classes' instead of 'STClasses' in " @"ScriptingInfo.plist for bundle '%@'", [aBundle bundlePath]); publicClasses = [dict objectForKey:@"STClasses"]; } else { publicClasses = [dict objectForKey:@"Classes"]; } RETAIN(publicClasses); if([dict objectForKey: @"STScriptingInfoClass"]) { NSLog(@"WARNING: Use 'ScriptingInfoClass' instead of 'STScriptingInfoClass' in " @"ScriptingInfo.plist for bundle '%@'", [aBundle bundlePath]); scriptingInfoClassName = [dict objectForKey:@"STScriptingInfoClass"]; } else { scriptingInfoClassName = [dict objectForKey:@"ScriptingInfoClass"]; } RETAIN(scriptingInfoClassName); objectReferenceDictionary = [dict objectForKey:@"Objects"]; if(!bundleInfoDict) { bundleInfoDict = [[NSMutableDictionary alloc] init]; } [bundleInfoDict setObject:self forKey:[bundle bundlePath]]; return self; } - (void) _bundleDidLoad:(NSNotification *)notif { NSLog(@"Module '%@' loaded", [bundle bundlePath]); if([notif object] != self) { NSLog(@"STBundle: That's not me!"); return; } allClasses = [[notif userInfo] objectForKey:@"NSLoadedClasses"]; RETAIN(allClasses); NSLog(@"All classes are %@", allClasses); } - (NSArray *)publicClassNames { if(useAllClasses) { if(!allClasses) { [self _initializeScriptingInfoClass]; } return allClasses; } else { return publicClasses; } } /** Return an array of all class names. */ - (NSArray *)allClassNames { /* FIXME: not implemented; */ NSLog(@"Warning: All bundle classes requested, using public classes only."); return publicClasses; } /** Return a dictionary of named objects. Named objects are get from scripting info class specified in ScriptingInfo.plist.*/ - (NSDictionary *)namedObjects { if(!scriptingInfoClass) { [self _initializeScriptingInfoClass]; } return [(id)scriptingInfoClass namedObjectsForScripting]; } - (void)_initializeScriptingInfoClass { scriptingInfoClass = [bundle classNamed:scriptingInfoClassName]; if(!scriptingInfoClass) { NSDebugLog(@"No scripting info class for bundle '%@'",[bundle bundlePath]); #if 0 [NSException raise:@"STBundleException" format:@"Unable to get scripting info class '%@' for " @"bundle '%@'", scriptingInfoClassName, [bundle bundlePath]]; #endif } } /** This method is for application scripting support. Return dictionary containing object references where a key is name of an object and value is a path to the object relative to application delegate. */ - (NSDictionary *)objectReferenceDictionary { return objectReferenceDictionary; } @end StepTalk-0.10.0/Frameworks/StepTalk/STUndefinedObject.m0000664000175000017500000000466314633027767021757 0ustar yavoryavor/** 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" #import #import #import 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"); } - (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 */ /* Nevertheless, it must clear the invocation's result, which may contain random contents under GNUstep. That could lead to a crash if the expected result is an object. */ NSMethodSignature *signature = [anInvocation methodSignature]; NSUInteger n = [signature methodReturnLength]; if (n > 0) { char buffer[n]; memset(buffer, '\0', n); [anInvocation setReturnValue: buffer]; } } - (BOOL) isEqual: (id)anObject { return ( (self == anObject) || (anObject == nil) ); } - (oneway void) release { /* do nothing */ } - (id) retain { return self; } - (BOOL)isNil { return YES; } - (BOOL)notNil { return NO; } @end StepTalk-0.10.0/Frameworks/StepTalk/STDistantEnvironment.m0000664000175000017500000000265714633027767022563 0ustar yavoryavor#import "STDistantEnvironment.h" #import #import #import #import #import @implementation STDistantEnvironment + environmentWithName:(NSString *)name host:(NSString *)host; - initWithName:(NSString *)name host:(NSString *)host { if ((self = [super init]) != nil) { distantName = RETAIN(name); distantHost = RETAIN(host); [self connect]; } return self; } - (STConversation *)createConversation; - (void)connect { environment = (NSDistantObject *)[NSConnection rootProxyForConnectionWithRegisteredName:distantName host:distantHost]; if(!environment) { [NSException raise:@"STDistantEnvironmentException" format:@"Unable to get distant environment object from server '%@'", distantName]; return; } RETAIN(environment); // [(NSDistantObject *)simulator setProtocolForProxy:@protocol(AFSimulator)]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_connectionDidDie:) name:NSConnectionDidDieNotification object:[environment connectionForProxy]]; } - (STConversation *)createConversationProxy { return [environment createConversation]; } @end StepTalk-0.10.0/Frameworks/StepTalk/STBehaviourInfo.m0000664000175000017500000000630114633027767021456 0ustar yavoryavor/** STBehaviourInfo.m 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 "STBehaviourInfo.h" #import #import #import #import #import #import #import @implementation STBehaviourInfo - initWithName:(NSString *)aString { if ((self = [super init]) != nil) { selectorMap = [[NSMutableDictionary alloc] init]; allowMethods = [[NSMutableSet alloc] init]; denyMethods = [[NSMutableSet alloc] init]; name = RETAIN(aString); } return self; } - (void)dealloc { RELEASE(selectorMap); RELEASE(allowMethods); RELEASE(denyMethods); RELEASE(name); [super dealloc]; } - (NSString*)behaviourName { return name; } - (void)adopt:(STBehaviourInfo *)info { [self addTranslationsFromDictionary:[info selectorMap]]; [self allowMethods:[info allowedMethods]]; [self denyMethods:[info deniedMethods]]; } - (NSDictionary *)selectorMap { return selectorMap; } - (void)removeTranslationForSelector:(NSString *)aString { [selectorMap removeObjectForKey:aString]; } - (void)setTranslation:(NSString *)translation forSelector:(NSString *)selector { [selectorMap setObject:translation forKey:selector]; } - (void)addMethodsFromArray:(NSArray *)methods { NSEnumerator *enumerator; NSString *sel; enumerator = [methods objectEnumerator]; while( (sel = [enumerator nextObject]) ) { [self setTranslation:sel forSelector:sel]; } } - (void)addTranslationsFromDictionary:(NSDictionary *)map { [selectorMap addEntriesFromDictionary:map]; } - (void)allowMethods:(NSSet *)set { [allowMethods unionSet:set]; [denyMethods minusSet:allowMethods]; } - (void)denyMethods:(NSSet *)set; { [denyMethods unionSet:set]; [allowMethods minusSet:denyMethods]; } - (void)allowMethod:(NSString *)methodName; { [allowMethods addObject:methodName]; [denyMethods removeObject:methodName]; } - (void)denyMethod:(NSString *)methodName; { [denyMethods addObject:methodName]; [allowMethods removeObject:methodName]; } - (NSSet *)allowedMethods { return AUTORELEASE([allowMethods copy]); } - (NSSet *)deniedMethods { return AUTORELEASE([denyMethods copy]); } @end StepTalk-0.10.0/Frameworks/StepTalk/STClassInfo.m0000664000175000017500000000641714633027767020607 0ustar yavoryavor/** STClassInfo.m Objective-C class wrapper 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 "STClassInfo.h" #import "STFunctions.h" #import #import #import #import #import @implementation STClassInfo - initWithName:(NSString *)aString { if ((self = [super initWithName:aString]) != nil) { selectorCache = [[NSMutableDictionary alloc] init]; } return self; } - (void)dealloc { RELEASE(superclass); RELEASE(superclassName); RELEASE(selectorCache); [super dealloc]; } - (void)setSuperclassInfo:(STClassInfo *)classInfo { ASSIGN(superclass,classInfo); } - (STClassInfo *)superclassInfo { return superclass; } - (void) setSuperclassName:(NSString *)aString { ASSIGN(superclassName,aString); } - (NSString *)superclassName { return superclassName; } - (NSString *)translationForSelector:(NSString *)aString { NSString *sel; NSDebugLLog(@"STSending",@"Translate '%@' in %@:%@. (%i)", aString, [self behaviourName],superclassName, allowAll); sel = [selectorCache objectForKey:aString]; if(sel) { return sel; } sel = [selectorMap objectForKey:aString]; if(!sel) { /* Lookup for super selector maping */ if(superclass) { sel = [superclass translationForSelector:aString]; if(sel && ([denyMethods containsObject:sel] || (!allowAll && ![allowMethods containsObject:sel]))) { sel = nil; } else if([allowMethods containsObject:aString]) { sel = aString; } } else if(allowAll || [allowMethods containsObject:aString]) { sel = aString; } NSDebugLLog(@"STSending",@" translated '%@' deny %i allow %i all %i", sel, [denyMethods containsObject:sel], [allowMethods containsObject:sel], allowAll); } NSDebugLLog(@"STSending",@" Return '%@' (%@)", sel, [self behaviourName]); if(sel) { [selectorCache setObject:sel forKey:aString]; } return sel; } - (void)setAllowAllMethods:(BOOL)flag { allowAll = flag; } - (BOOL)allowAllMethods { return allowAll; } @end StepTalk-0.10.0/Frameworks/StepTalk/STMethod.m0000664000175000017500000000172214633027767020140 0ustar yavoryavor/** 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 */ StepTalk-0.10.0/Frameworks/StepTalk/.cvsignore0000664000175000017500000000013514633027767020270 0ustar yavoryavor*.app *.debug *.profile shared_*obj *.bundle *.stmodule *.stlanguage *.framework derived_src StepTalk-0.10.0/Frameworks/StepTalk/STObjectReference.m0000664000175000017500000000345214633027767021747 0ustar yavoryavor/** 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 #import #import #import @implementation STObjectReference - initWithIdentifier:(NSString *)ident target:(id)anObject; { if ((self = [super init]) != nil) { 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 StepTalk-0.10.0/Frameworks/StepTalk/STSelector.h0000664000175000017500000000223414633027767020472 0ustar yavoryavor/* 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 StepTalk-0.10.0/Frameworks/StepTalk/STLanguageManager.h0000664000175000017500000000202714633027767021730 0ustar yavoryavor#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 StepTalk-0.10.0/Frameworks/StepTalk/STRemoteConversation.m0000664000175000017500000000763714633027767022561 0ustar yavoryavor/* FIXME: not used! just an unimplemented idea. */ #import "STRemoteConversation.h" #import #import #import #import #import #import "STEnvironment.h" @implementation STRemoteConversation - initWithEnvironmentName:(NSString *)envName host:(NSString *)host language:(NSString *)langName { if ((self = [super init]) != nil) { if (!envName) { [NSException raise:@"STConversationException" format:@"Unspecified environment name for a distant conversation"]; [self release]; return nil; } languageName = RETAIN(langName); environmentName = RETAIN(envName); hostName = RETAIN(host); [self open]; } return self; } - (void)open { NSString *envProcName; NSPortNameServer *nameServer; if (connection) { [NSException raise:@"STConversationException" format:@"Unable to open conversation: already opened."]; return; } envProcName = [NSString stringWithFormat:@"STEnvironment:%@", environmentName]; if ([hostName length] > 0) nameServer = [NSSocketPortNameServer sharedInstance]; else nameServer = [NSPortNameServer systemDefaultPortNameServer]; connection = [NSConnection connectionWithRegisteredName:envProcName host:hostName usingNameServer:nameServer]; 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)]; if (languageName && ![languageName isEqual:@""]) { [proxy setLanguage: languageName]; } [[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; } - (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 { ASSIGN(languageName, newLanguage); [proxy setLanguage:newLanguage]; } /** Return name of the language used in the receiver conversation */ - (NSString *)language { return proxy != nil ? [proxy language] : languageName; } - (STEnvironment *)environment { /* FIXME: return local description */ return nil; } - (void)interpretScript:(bycopy 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); } RELEASE(proxy); proxy = nil; RELEASE(environmentProcess); environmentProcess = nil; RELEASE(connection); connection = nil; } @end StepTalk-0.10.0/Frameworks/StepTalk/STStructure.m0000664000175000017500000001770614633027767020731 0ustar yavoryavor/** 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 #import #import #import #import #import #import "NSInvocation+additions.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); } + structureWithOrigin:(NSPoint)point size:(NSSize)size { NSRect rect; STStructure *str; rect = NSMakeRect(point.x, point.y, size.width, size.height); str = [[self alloc] initWithValue:&rect type:@encode(NSRect)]; return AUTORELEASE(str); } - initWithValue:(void *)value type:(const char*)type { const char *nameBeg, *nextType; NSUInteger offset = 0; NSUInteger size, align; NSUInteger rem; if ((self = [super init]) != nil) { 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) { nextType = NSGetSizeAndAlignment(type, &size, &align); rem = offset % align; if (rem != 0) { offset += align - rem; } [fields addObject:STObjectFromValueOfType(((char *)value)+offset, type)]; offset += size; type = nextType; } } return self; } - (void)dealloc { RELEASE(fields); RELEASE(structType); RELEASE(name); [super dealloc]; } - (void)getValue:(void *)value { const char *type = [structType cString]; const char *nextType; NSUInteger offset = 0; NSUInteger size, align; NSUInteger rem; NSUInteger i = 0; type++; while (*type != _C_STRUCT_E && *type++ != '='); while(*type != _C_STRUCT_E) { nextType = NSGetSizeAndAlignment(type, &size, &align); rem = offset % align; if(rem != 0) { offset += align - rem; } STGetValueOfTypeFromObject((char*)value+offset, type, [fields objectAtIndex:i++]); offset += size; type = nextType; } } - (const char *)type { return [structType cString]; } - (NSString *)structureName { return name; } - (const char *)typeOfFieldAtIndex:(NSUInteger)index { const char *type = [structType cString]; for(type += 1; *type != _C_STRUCT_E && index>0; index--) { type = objc_skip_argspec(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 integerValueAtIndex:0],[self integerValueAtIndex: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:(NSUInteger)index { return [fields objectAtIndex:index]; } - (void)setValue:anObject atIndex:(NSUInteger)index { [fields replaceObjectAtIndex:index withObject:anObject]; } - (int)intValueAtIndex:(NSUInteger)index { return [[fields objectAtIndex:index] intValue]; } - (NSInteger)integerValueAtIndex:(NSUInteger)index { return [[fields objectAtIndex:index] integerValue]; } - (float)floatValueAtIndex:(NSUInteger)index { return (float)[[fields objectAtIndex:index] floatValue]; } /* NSRange */ - (NSUInteger)location { return [[fields objectAtIndex:0] integerValue]; } - (NSUInteger)length { return [[fields objectAtIndex:1] integerValue]; } - (void)setLocation:(NSUInteger)location { NSNumber *n = [NSNumber numberWithUnsignedInteger:location]; [fields replaceObjectAtIndex:0 withObject:n]; } - (void)setLength:(NSUInteger)length { NSNumber *n = [NSNumber numberWithUnsignedInteger:length]; [fields replaceObjectAtIndex:1 withObject: n]; } /* 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]]; } - extent:(NSSize)size { NSRect rect; rect = NSMakeRect([self x], [self y], size.width, size.height); return [[self class] structureWithRect:rect]; } - corner:(NSPoint)corner { NSRect rect; rect = NSMakeRect([self x], [self y], 0, 0); if (corner.x >= rect.origin.x) { rect.size.width = corner.x - rect.origin.x; } else { rect.size.width = rect.origin.x - corner.x; rect.origin.x = corner.x; } if (corner.y >= rect.origin.y) { rect.size.height = corner.y - rect.origin.y; } else { rect.size.height = rect.origin.y - corner.y; rect.origin.y = corner.y; } return [[self class] structureWithRect:rect]; } /* 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 StepTalk-0.10.0/Frameworks/StepTalk/STConversation.h0000664000175000017500000000365414633027767021373 0ustar yavoryavor/** 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 NSArray; @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; } + conversationWithContext:(STContext *)aContext language:(NSString *)aLanguage; - initWithContext:(STContext *)aContext language:(NSString *)aLanguage; - (void)setLanguage:(NSString *)newLanguage; - (NSString *)language; - (STContext *)context; /* Depreciated */ - (id)runScriptFromString:(NSString *)aString; @end StepTalk-0.10.0/Frameworks/StepTalk/STStructure.h0000664000175000017500000000463714633027767020723 0ustar yavoryavor/** 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 #import #import // @class STRange; // @class STPoint; // @class STRect; @class NSString; @class NSMutableArray; @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:(NSUInteger)index; - (void)setValue:anObject atIndex:(NSUInteger)index; - (int)intValueAtIndex:(NSUInteger)index; - (NSInteger)integerValueAtIndex:(NSUInteger)index; - (float)floatValueAtIndex:(NSUInteger)index; - extent:(NSSize)size; - corner:(NSPoint)corner; @end /* @interface STRange:STStructure - rangeWithLocation:(NSUInteger)loc length:(NSUInteger)length; - (NSUInteger)location; - (NSUInteger)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 */ StepTalk-0.10.0/Frameworks/StepTalk/STMethod.h0000664000175000017500000000205714633027767020135 0ustar yavoryavor/** 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 StepTalk-0.10.0/Frameworks/StepTalk/STSelector.m0000664000175000017500000000412114633027767020474 0ustar yavoryavor/* 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 #import @implementation STSelector - initWithName:(NSString *)aString { if ((self = [super init]) != nil) { selectorName = RETAIN(aString); } return self; } - initWithSelector:(SEL)aSel { if ((self = [super init]) != nil) { 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 { if ((self = [super init] /*[super initWithCoder: decoder]*/) != nil) { [decoder decodeValueOfObjCType: @encode(id) at: &selectorName]; } return self; } @end StepTalk-0.10.0/Frameworks/StepTalk/STActor.h0000664000175000017500000000224114633027767017760 0ustar yavoryavor/** STActor StepTalk actor Copyright (c) 2002 Free Software Foundation Written by: Stefan Urbanek Date: 2005 June 30 License: LGPL This file is part of the StepTalk project. */ #import #import "STMethod.h" @class NSMutableDictionary; @class NSDictionary; @class NSArray; @class STEnvironment; @interface STActor:NSObject { NSMutableDictionary *ivars; NSMutableDictionary *methodDictionary; STEnvironment *environment; } + actorInEnvironment:(STEnvironment *)env; - initWithEnvironment:(STEnvironment *)env; - (void)setEnvironment:(STEnvironment *)env; - (STEnvironment *)environment; - (NSArray *)instanceVariableNames; - (void)setInstanceVariables:(NSDictionary *)dictionary; - (NSDictionary *)instanceVariables; - (void)addInstanceVariable:(NSString *)aName; - (void)removeInstanceVariable:(NSString *)aName; - (void)addMethod:(id )aMethod; - (id )methodWithName:(NSString *)aName; - (void)removeMethod:(id )aMethod; - (void)removeMethodWithName:(NSString *)aName; - (NSArray *)methodNames; - (NSDictionary *)methodDictionary; @end StepTalk-0.10.0/Frameworks/StepTalk/STObjCRuntime.h0000664000175000017500000000331514633027767021074 0ustar yavoryavor/** 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 @class NSMutableDictionary; @class NSString; @class NSValue; @class NSMethodSignature; @class NSDictionary; @class NSArray; 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); StepTalk-0.10.0/Frameworks/StepTalk/STConversation.m0000664000175000017500000001111014633027767021362 0ustar yavoryavor/** 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 #import #import "STEnvironment.h" #import "STEngine.h" #import "STLanguageManager.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]); } + conversationWithContext:(STContext *)aContext language:(NSString *)aLanguage { return AUTORELEASE([[self alloc] initWithContext:aContext language:aLanguage]); } - (bycopy id)resultByCopy { return [self result]; } - (id)runScriptFromString:(NSString *)aString { NSLog(@"Warning: runScriptFromString: in STConversation is deprecated," @" use -interpretScript: and -result instead."); [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. */ - (bycopy 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: +[STConversation 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: -[STConversation initWithEnvironment:language:]" @" is deprecated, use initWithContext:language: instead."); return [self initWithContext:env language:langName]; } - initWithContext:(STContext *)aContext language:(NSString *)aLanguage { if ((self = [super init]) != nil) { STLanguageManager *manager = [STLanguageManager defaultManager]; 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:(bycopy NSString *)aString { if(!engine) { [self _createEngine]; } ASSIGN(returnValue, [engine interpretScript: aString inContext: context]); } - (id)result { return returnValue; } @end StepTalk-0.10.0/Frameworks/StepTalk/STEngine.h0000664000175000017500000000343314633027767020121 0ustar yavoryavor/** 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; @class STMethod; /** 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 StepTalk-0.10.0/Frameworks/StepTalk/STUndefinedObject.h0000664000175000017500000000203114633027767021735 0ustar yavoryavor/** 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 StepTalk-0.10.0/Frameworks/StepTalk/STExterns.h0000664000175000017500000000333014633027767020340 0ustar yavoryavor/** 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 *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; StepTalk-0.10.0/Frameworks/StepTalk/STFunctions.m0000664000175000017500000000767114633027767020701 0ustar yavoryavor/** STFunctions.m Misc. functions 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 "STFunctions.h" #import "STExterns.h" #import "STContext.h" #import #import #import #import #import #import @class STContext; NSString *STFindResource(NSString *name, NSString *resourceDir, NSString *extension) { NSFileManager *manager = [NSFileManager defaultManager]; NSArray *paths; NSEnumerator *enumerator; NSString *path; NSString *file; paths = NSStandardLibraryPaths(); enumerator = [paths objectEnumerator]; while( (path = [enumerator nextObject]) ) { file = [path stringByAppendingPathComponent:STLibraryDirectory]; file = [file stringByAppendingPathComponent:resourceDir]; file = [file stringByAppendingPathComponent:name]; if( [manager fileExistsAtPath:file] ) { return file; } file = [file stringByAppendingPathExtension:extension]; if( [manager fileExistsAtPath:file] ) { return file; } } return [[NSBundle bundleForClass:[STContext class]] pathForResource:name ofType:extension inDirectory:resourceDir]; } NSArray *STFindAllResources(NSString *resourceDir, NSString *extension) { NSFileManager *manager = [NSFileManager defaultManager]; NSDirectoryEnumerator *dirs; NSArray *paths; NSEnumerator *enumerator; NSString *path; NSString *file; NSMutableArray *resources = [NSMutableArray array]; paths = NSStandardLibraryPaths(); enumerator = [paths objectEnumerator]; while( (path = [enumerator nextObject]) ) { path = [path stringByAppendingPathComponent:STLibraryDirectory]; path = [path stringByAppendingPathComponent:resourceDir]; if( ![manager fileExistsAtPath:path] ) { continue; } dirs = [manager enumeratorAtPath:path]; while( (file = [dirs nextObject]) ) { if( [[[dirs directoryAttributes] fileType] isEqualToString:NSFileTypeDirectory] && [[file pathExtension] isEqualToString:extension]) { file = [path stringByAppendingPathComponent:file]; [resources addObject:file]; } } } return [NSArray arrayWithArray:resources]; } NSString *STUserConfigPath(void) { NSString *path = nil; NSArray *paths; paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); path = [paths objectAtIndex: 0]; path = [path stringByAppendingPathComponent:STLibraryDirectory]; path = [path stringByAppendingPathComponent:@"Configuration"]; return path; } StepTalk-0.10.0/Frameworks/StepTalk/STExterns.m0000664000175000017500000000425714633027767020356 0ustar yavoryavor/** 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 *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"; StepTalk-0.10.0/Frameworks/StepTalk/NSObject+additions.h0000664000175000017500000000214214633027767022062 0ustar yavoryavor/** NSObject-additions.h Various methods for NSObject 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 @interface NSObject (STAdditions) - (BOOL)isSame:(id)anObject; - (BOOL)notEqual:(id)anObject; - (BOOL)notSame:(id)anObject; - (BOOL)isNil; - (BOOL)notNil; - (id)yourself; @end StepTalk-0.10.0/Frameworks/StepTalk/STEnvironment.m0000664000175000017500000003105614633027767021227 0ustar yavoryavor/** 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 "STFunctions.h" #import "STBundleInfo.h" #import "STObjCRuntime.h" #import "STObjectReference.h" #import "STUndefinedObject.h" #import #import #import #import #import #import #import #import 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; if ((self = [super init]) != nil) { infoCache = [[NSMutableDictionary alloc] init]; description = RETAIN(aDescription); classes = [description classes]; /* Load modules */ enumerator = [[description modules] objectEnumerator]; while ((name = [enumerator nextObject]) != nil) { [self loadModule:name]; } /* Load frameworks */ enumerator = [[description frameworks] objectEnumerator]; while ((name = [enumerator nextObject]) != nil) { [self includeFramework:name]; } /* Register finders */ enumerator = [[description objectFinders] objectEnumerator]; while ((name = [enumerator nextObject]) != nil) { [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 in 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 = STFindResource(name, @"Finders", @"bundle"); 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]; [finder release]; } /** Remove object finder with name name */ - (void)removeObjectFinderWithName:(NSString *)name { [objectFinders removeObjectForKey:name]; } @end StepTalk-0.10.0/Frameworks/StepTalk/STContext.m0000664000175000017500000001205014633027767020340 0ustar yavoryavor/** 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 "STFunctions.h" #import "STBundleInfo.h" #import "STObjCRuntime.h" #import "STObjectReference.h" #import "STUndefinedObject.h" #import #import #import #import #import #import #import #import @implementation STContext -init { if ((self = [super init]) != nil) { 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 in 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); } - (NSArray *)knownObjectNames { NSMutableArray *array = [NSMutableArray array]; [array addObjectsFromArray:[objectDictionary allKeys]]; return [NSArray arrayWithArray:array]; } @end StepTalk-0.10.0/Frameworks/StepTalk/STObjCRuntime.m0000664000175000017500000002136014633027767021101 0ustar yavoryavor/** 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 #import #import #import #import #import #import #import #import #define SELECTOR_TYPES_COUNT (sizeof(selector_types)/sizeof(selector_types[0])) /* 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[] = { #if GS_SIZEOF_VOIDP == 4 "@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" #endif #if GS_SIZEOF_VOIDP == 8 "@16@0:8", "@24@0:8@16", "@32@0:8@16@24", "@40@0:8@16@24@32", "@48@0:8@16@24@32@40", "@56@0:8@16@24@32@40@48", "@64@0:8@16@24@32@40@48@56", "@72@0:8@16@24@32@40@48@56@64", "@80@0:8@16@24@32@40@48@56@64@72", "@88@0:8@16@24@32@40@48@56@64@72@80" #endif #if GS_SIZEOF_VOIDP != 4 && GS_SIZEOF_VOIDP != 8 #error Unsupported architecture: sizeof(void *) is neither 4 nor 8 #endif }; NSMutableDictionary *STAllObjectiveCClasses(void) { NSInteger i, numClasses; NSString *name; NSMutableDictionary *dict; Class *classes; dict = [NSMutableDictionary dictionary]; numClasses = objc_getClassList(NULL, 0); classes = (Class *)NSZoneMalloc(STMallocZone, numClasses * sizeof(Class)); numClasses = objc_getClassList(classes, numClasses); // NSLog(@"%li Objective-C classes found", (unsigned long)numClasses); for(i = 0; i < numClasses; i++) { name = [NSString stringWithCString:class_getName(classes[i])]; [dict setObject:classes[i] forKey:name]; } NSZoneFree(STMallocZone, classes); 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; } static const char *STSelectorTypes(const char *name) { const char *ptr; const char *types = 0; NSUInteger argc = 0; for (ptr = name; *ptr; ptr++) if (*ptr == ':') argc ++; /* Special case for binary operators, which have one argument. The set * of recognized operator names is the same as in Smalltalk. * In case you don't have the Smalltalk standard for reference, the * bitmap below contains the following characters: '!', '%', '&', '*', * '+', ',', '/', '<', '=', '>', '?', '@', '\\', '~', '|', '-' */ if (!argc) { for (ptr = name; *ptr; ptr++) { static const char binaryCharset[256] = { 0, 0, 0, 0, 0x46, 0x3d, 0, 0x0f, 0x80, 0, 0, 0x08, 0, 0, 0, 0x0a }; NSUInteger ofs = (NSUInteger)*ptr >> 3; NSUInteger mask = *ptr & 7; if (!(binaryCharset[ofs] & mask)) break; } if (!*ptr) argc = 1; } if (argc < SELECTOR_TYPES_COUNT) { NSDebugLLog(@"STSending", @"registering selector '%s' " @"with %lu arguments, types:'%s'", name,(unsigned long)argc,selector_types[argc]); types = selector_types[argc]; } return types; } SEL STSelectorFromString(NSString *aString) { const char *name = [aString cString]; const char *types = STSelectorTypes(name); SEL sel; if (types) sel = GSSelectorFromNameAndTypes(name, types); else sel = 0; if (!sel) { [NSException raise:STInternalInconsistencyException format:@"Unable to register selector '%@'", aString]; } return sel; } SEL STCreateTypedSelector(SEL sel) { const char *name = sel_getName(sel); const char *types = STSelectorTypes(name); SEL newSel; NSLog(@"STCreateTypedSelector is deprecated."); if (types) newSel = GSSelectorFromNameAndTypes(name, types); else newSel = 0; if(!newSel) { [NSException raise:STInternalInconsistencyException format:@"Unable to register typed selector '%s'", name]; } return newSel; } NSMethodSignature *STConstructMethodSignatureForSelector(SEL sel) { const char *name = sel_getName(sel); const char *types = STSelectorTypes(name); if (!types) { [NSException raise:STInternalInconsistencyException format:@"Unable to construct types for selector '%s'", name]; } return [NSMethodSignature signatureWithObjCTypes:types]; } NSMethodSignature *STMethodSignatureForSelector(SEL sel) { const char *types; NSLog(@"STMethodSignatureForSelector is deprecated."); types = GSTypesFromSelector(sel); if (!types) { sel = STCreateTypedSelector(sel); types = GSTypesFromSelector(sel); } return [NSMethodSignature signatureWithObjCTypes:types]; } static NSArray *selectors_from_list(Method *methods, NSUInteger numMethods) { NSMutableArray *array = [NSMutableArray array]; NSUInteger i; for (i = 0; i < numMethods; i++) { [array addObject:NSStringFromSelector(method_getName(methods[i]))]; } return array; } NSArray *STAllObjectiveCSelectors(void) { NSInteger i, numClasses; unsigned int numMethods; NSMutableArray *array; NSArray *selectors; Method *methods; Class *classes; array = [NSMutableArray array]; numClasses = objc_getClassList(NULL, 0); classes = (Class *)NSZoneMalloc(STMallocZone, numClasses * sizeof(Class)); numClasses = objc_getClassList(classes, numClasses); for(i = 0; i < numClasses; i++) { methods = class_copyMethodList(classes[i], &numMethods); if(methods) { selectors = selectors_from_list(methods, numMethods); [array addObjectsFromArray:selectors]; } free(methods); methods = class_copyMethodList(object_getClass(classes[i]), &numMethods); if(methods) { selectors = selectors_from_list(methods, numMethods); [array addObjectsFromArray:selectors]; } free(methods); } NSZoneFree(STMallocZone, classes); /* get rid of duplicates */ array = (NSMutableArray *)[[NSSet setWithArray:array] allObjects]; array = (NSMutableArray *)[array sortedArrayUsingSelector:@selector(compare:)]; return array; } StepTalk-0.10.0/Frameworks/StepTalk/STDistantConversation.m0000664000175000017500000000431414633027767022721 0ustar yavoryavor/* FIXME: not used! just an unimplemented idea. */ #import "STDistantConversation.h" #import #import #import #import @implementation STDistantConversation - initWithEnvironment:(STEnvironment *)env language:(NSString *)langName { if ((self = [super init]) != nil) { if (!env) { [NSException raise:@"STConversationException" format:@"Unspecified environment for a distant conversation"]; [self release]; return nil; } if (!langName || [langName isEqual:@""]) { languageName = RETAIN([STLanguage defaultLanguageName]); } else { languageName = RETAIN(langName); } environment = RETAIN(env); [self createProxy]; } return self; } - (void)dealloc { RELEASE(languageName); RELEASE(environment); [super dealloc]; } - (void)setLanguage:(NSString *)newLanguage { [proxy setLanguage:newLanguage]; } /** Return name of the language used in the receiver conversation */ - (NSString *)language { return [proxy languageName]; } - (STEnvironment *)environment { return environment; } - (id)runScriptFromString:(NSString *)aString { return [proxy runScriptFromString:aString]; } - (BOOL)isResumable { return YES; } - (void)connectionDidDie:(NSNotification *)notification { [[NSNotificationCenter defaultCenter] removeObserver:self]; proxy = nil; NSLog(@"Connection did die"); } - (BOOL)createProxy { NSConnection *connection; proxy = [environment createConversationProxy]; if(!proxy) { return NO; } connection = [proxy connectionForProxy]; [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(connectionDidDie:) name: NSConnectionDidDieNotification object: connection]; return YES; } - (BOOL)resume { if(proxy) { NSLog(@"Can not resume: already connected"); return NO; } return [self creatProxy]; } @end StepTalk-0.10.0/Frameworks/StepTalk/STBehaviourInfo.h0000664000175000017500000000347714633027767021464 0ustar yavoryavor/** STBehaviourInfo.h Scripting definition: behaviour information 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 */ #include @class NSString; @class NSDictionary; @class NSMutableDictionary; @class NSMutableSet; @class NSSet; @interface STBehaviourInfo:NSObject { NSString *name; NSMutableDictionary *selectorMap; NSMutableSet *allowMethods; NSMutableSet *denyMethods; } - initWithName:(NSString *)aString; - (NSString*)behaviourName; - (void)setTranslation:(NSString *)aSelector forSelector:(NSString *)aString; - (void)removeTranslationForSelector:(NSString *)aString; - (NSDictionary *)selectorMap; - (void)addTranslationsFromDictionary:(NSDictionary *)map; - (void)allowMethods:(NSSet *)set; - (void)denyMethods:(NSSet *)set; - (void)allowMethod:(NSString *)methodName; - (void)denyMethod:(NSString *)methodName; - (NSSet *)allowedMethods; - (NSSet *)deniedMethods; - (void)adopt:(STBehaviourInfo *)info; @end StepTalk-0.10.0/Frameworks/StepTalk/STScripting.h0000664000175000017500000000233414633027767020655 0ustar yavoryavor/** 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 StepTalk-0.10.0/Frameworks/StepTalk/STScriptObject.h0000664000175000017500000000167114633027767021311 0ustar yavoryavor/* 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 StepTalk-0.10.0/Frameworks/StepTalk/STScripting.m0000664000175000017500000000305414633027767020662 0ustar yavoryavor/** 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 StepTalk-0.10.0/Frameworks/StepTalk/Environments/0000775000175000017500000000000014633027767020760 5ustar yavoryavorStepTalk-0.10.0/Frameworks/StepTalk/Environments/Distributed.stenv0000664000175000017500000000037014633027767024323 0ustar yavoryavor/** Distributed.stenv Description for distributed environment. Using this description will include Distributed Object finder. */ { Name = "Distributed"; Finders = (DistributedFinder); Use = ("Foundation"); } StepTalk-0.10.0/Frameworks/StepTalk/Environments/StepTalk.stenv0000664000175000017500000000172114633027767023571 0ustar yavoryavor/** 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", "value:", "value:value:", "value:value:value:", "valueWithArguments:", "valueWith:", "valueWith:with:", "valueWith:with:with:", "valueWith:with:with:with:", "argumentCount", "handler:", "whileTrue:", "whileFalse:" ); }; STScriptObject = { Super = NSObject; Restriction = AllowAll; }; STUndefinedObject = { Super = nil; Restriction = AllowAll; }; }; } StepTalk-0.10.0/Frameworks/StepTalk/Environments/Foundation.stenv0000664000175000017500000000130414633027767024145 0ustar yavoryavor/** 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 */ } StepTalk-0.10.0/Frameworks/StepTalk/Environments/SymbolicSelectors.stenv0000664000175000017500000000205414633027767025507 0ustar yavoryavor/** 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:"; }; }; }; } StepTalk-0.10.0/Frameworks/StepTalk/Environments/Standard.stenv0000664000175000017500000000032414633027767023600 0ustar yavoryavor/** Standard.stenv * Standard cripting description */ { Name = "Standard"; Modules = (ObjectiveC); Use = ( "SymbolicSelectors", "Foundation", "StepTalk" ); } StepTalk-0.10.0/Frameworks/StepTalk/Environments/Safe.stenv0000664000175000017500000000304614633027767022722 0ustar yavoryavor/** 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 */ } StepTalk-0.10.0/Frameworks/StepTalk/Environments/AppKit.stenv0000664000175000017500000000042014633027767023225 0ustar yavoryavor/** 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); } StepTalk-0.10.0/Frameworks/StepTalk/Environments/Common.stenv0000664000175000017500000000043514633027767023273 0ustar yavoryavor/** Common.stenv * Common scripting environment description */ { Name = "Common"; Bundles = (CommonEnvironment); Import = ( "SymbolicSelectors", "Foundation", "AppKit" ); Applications = ( All ); } StepTalk-0.10.0/Frameworks/StepTalk/Environments/Foundation-operators.stenv0000664000175000017500000000562214633027767026170 0ustar yavoryavor/** 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 */ } StepTalk-0.10.0/Frameworks/StepTalk/STScriptsManager.h0000664000175000017500000000265714633027767021645 0ustar yavoryavor/** 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 NSArray; @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 StepTalk-0.10.0/Frameworks/StepTalk/StepTalk.h0000664000175000017500000000272514633027767020177 0ustar yavoryavor/** 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 StepTalk-0.10.0/Frameworks/StepTalk/STDistantConversation.h0000664000175000017500000000237114633027767022715 0ustar yavoryavor/* FIXME: not used! just an unimplemented idea. */ /** STDistantConversation 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 STDistantEnvironment; @interface STDistantConversation:STConversation { STDistantEnvironment *environment; STConversation *proxy; NSString *languageName; } - (BOOL)isResumable; - (BOOL)resume; @end StepTalk-0.10.0/Frameworks/StepTalk/NSNumber+additions.m0000664000175000017500000000655314633027767022123 0ustar yavoryavor/** NSNumber-additions.h Various methods for NSNumber 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 "NSNumber+additions.h" #import "STExterns.h" #import "STStructure.h" #import #include @implementation NSNumber (STAdditions) - add:(NSNumber *)number { return [NSNumber numberWithDouble:([self doubleValue] + [number doubleValue])]; } - subtract:(NSNumber *)number { return [NSNumber numberWithDouble:([self doubleValue] - [number doubleValue])]; } - multiply:(NSNumber *)number { return [NSNumber numberWithDouble:([self doubleValue] * [number doubleValue])]; } - divide:(NSNumber *)number { if([number doubleValue] == 0.0) { [NSException raise:STGenericException format:@"Division by zero"]; return self; } return [NSNumber numberWithDouble:([self doubleValue] / [number doubleValue])]; } - modulo:(NSNumber *)number { if([number doubleValue] == 0.0) { [NSException raise:STGenericException format:@"Division by zero"]; return self; } return [NSNumber numberWithDouble:(fmod([self doubleValue], [number doubleValue]))]; } - (BOOL)isLessThan:(NSNumber *)number { return ([self doubleValue] < [number doubleValue]); } - (BOOL)isGreatherThan:(NSNumber *)number { return ([self doubleValue] > [number doubleValue]); } - (BOOL)isLessOrEqualThan:(NSNumber *)number { return ([self doubleValue] <= [number doubleValue]); } - (BOOL)isGreatherOrEqualThan:(NSNumber *)number { return ([self doubleValue] >= [number doubleValue]); } @end @implementation NSNumber (STLogicOperations) - (NSUInteger)or:(NSNumber *)number { return ([self integerValue] | [number integerValue]); } - (NSUInteger)and:(NSNumber *)number { return ([self integerValue] & [number integerValue]); } - (NSUInteger)not { /* FIXME */ return ![self integerValue]; } @end @implementation NSNumber (STStructure) - rangeWith:(NSUInteger)length { NSRange r = NSMakeRange([self unsignedIntegerValue], length); return [STStructure structureWithRange:r]; } - pointWith:(float)y { return [STStructure structureWithPoint:NSMakePoint([self floatValue], y)]; } - sizeWith:(float)h { return [STStructure structureWithSize:NSMakeSize([self floatValue], h)]; } @end StepTalk-0.10.0/Frameworks/StepTalk/STContext.h0000664000175000017500000000403014633027767020332 0ustar yavoryavor/** STContext Scripting context Copyright (c) 2002 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 @class NSBundle; @class NSDictionary; @class NSMutableDictionary; @class NSMutableArray; @class NSMutableSet; @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; - (NSArray *)knownObjectNames; @end StepTalk-0.10.0/Frameworks/StepTalk/GNUmakefile.postamble0000664000175000017500000000330714633027767022333 0ustar yavoryavor# # GNUmakefile.postamble # # 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; see the file COPYING.LIB. # If not, write to the Free Software Foundation, # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # Project specific makefile rules # # Uncomment the targets you want. # The double colons (::) are important, do not make them single colons # otherwise the normal makefile rules will not be performed. # # Things to do before compiling # before-all:: # Things to do after compiling # after-all:: # Things to do before installing # before-install:: # $(MKDIRS) $(STEPTALK_LIBRARY_DIR) # Things to do after installing # after-install:: # Things to do before uninstalling # before-uninstall:: # Things to do after uninstalling # after-uninstall:: # Things to do before cleaning # before-clean:: # Things to do after cleaning # after-clean:: # Things to do before distcleaning # before-distclean:: # Things to do after distcleaning # after-distclean:: # Things to do before checking # before-check:: # Things to do after checking # after-check:: StepTalk-0.10.0/Frameworks/StepTalk/STScript.h0000664000175000017500000000243714633027767020163 0ustar yavoryavor/** 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 StepTalk-0.10.0/Frameworks/StepTalk/STFileScript.m0000664000175000017500000001150314633027767020762 0ustar yavoryavor/** 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 #import #import #import #import #import #import @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 { if ((self = [super init]) != nil) { 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]; } 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 stringWithContentsOfFile: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 StepTalk-0.10.0/Frameworks/StepTalk/STScriptingServer.m0000664000175000017500000000171014633027767022046 0ustar yavoryavor/* FIXME: not used! just an unimplemented idea. (See NSDistant*) */ @implementation STScriptingServer { } + serverWithRegisteredName:(NSString *)name host:(NSString *)host { return [STDistantScriptingServer serverWithRegisteredName:name host:host]; } - registerLocallyWithName:(NSString *)name { NSLog(@"Not implemented: registerLocallyWithName"); } - createConversation; - conversationWithInfo:(NSDictionary*)dict; @end @implementation STLocalScriptingServer { } + serverWithRegisteredName:(NSString *)name host:(NSString *)host; - registerLocallyWithName:(NSString *)name; - createConversation; - conversationWithInfo:(NSDictionary*)dict; @end @implementation STDistantScriptingServer { } + serverWithRegisteredName:(NSString *)name host:(NSString *)host; - registerLocallyWithName:(NSString *)name; - createConversation; - conversationWithInfo:(NSDictionary*)dict; @end StepTalk-0.10.0/Frameworks/StepTalk/STScript.m0000664000175000017500000000320114633027767020156 0ustar yavoryavor/** 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 @implementation STScript + scriptWithSource:(NSString *)aString language:(NSString *)lang { return AUTORELEASE([[self alloc] initWithSource:aString language:lang]); } - initWithSource:(NSString *)aString language:(NSString *)lang { if ((self = [super init]) != nil) { 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 StepTalk-0.10.0/Frameworks/StepTalk/NSNumber+additions.h0000664000175000017500000000310314633027767022102 0ustar yavoryavor/** NSNumber-additions.h Various methods for NSNumber 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 NSNumber (STAdditions) - add:(NSNumber *)number; - subtract:(NSNumber *)number; - multiply:(NSNumber *)number; - divide:(NSNumber *)number; - (BOOL)isLessThan:(NSNumber *)number; - (BOOL)isGreatherThan:(NSNumber *)number; - (BOOL)isLessOrEqualThan:(NSNumber *)number; - (BOOL)isGreatherOrEqualThan:(NSNumber *)number; @end @interface NSNumber (STLogicOperations) - (NSUInteger)or:(NSNumber *)number; - (NSUInteger)and:(NSNumber *)number; - (NSUInteger)not; @end @interface NSNumber (STStructure) - rangeWith:(NSUInteger)length; - pointWith:(float)y; - sizeWith:(float)h; @end StepTalk-0.10.0/README0000664000175000017500000000614014633027767013303 0ustar yavoryavorStepTalk -------- Ahthor: Stefan Urbanek (Google the name for contact) License: LGPL (see file COPYING) 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 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 StepTalk-0.10.0/NEWS0000664000175000017500000001527314633027767013131 0ustar yavoryavor0.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