Compiler warnings cleanup, Shell fixed

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@18145 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Stefan Urbanek 2003-11-24 09:43:42 +00:00
parent 5ce611c23e
commit ecd3a33b3f
13 changed files with 136 additions and 39 deletions

View file

@ -1,3 +1,8 @@
2003 Nov 24 Stefan Urbanek <stefanu@altair.dcs.elf.stuba.sk>
* Few fixes, removed some compiler warnings. Fixed Shell to use
proper environment.
2003 Nov 8 Stefan Urbanek <stefanu@altair.dcs.elf.stuba.sk> 2003 Nov 8 Stefan Urbanek <stefanu@altair.dcs.elf.stuba.sk>
* Updated tools to use STConversation object. * Updated tools to use STConversation object.

View file

@ -36,7 +36,6 @@
@interface STShell:NSObject @interface STShell:NSObject
{ {
STScriptsManager *scriptsManager; STScriptsManager *scriptsManager;
STEnvironment *env;
STConversation *conversation; STConversation *conversation;
NSString *prompt; NSString *prompt;

View file

@ -142,16 +142,17 @@ int complete_handler(void)
- (void)setEnvironment:(STEnvironment *)newEnv - (void)setEnvironment:(STEnvironment *)newEnv
{ {
ASSIGN(env, newEnv); [conversation setEnvironment:newEnv];
} }
- (STEnvironment *)environment - (STEnvironment *)environment
{ {
return env; return [conversation environment];
} }
- (void)run - (void)run
{ {
STEnvironment *env = [conversation environment];
NSString *line; NSString *line;
id result; id result;
@ -169,6 +170,8 @@ int complete_handler(void)
[self showLine:@"Welcome to the StepTalk shell."]; [self showLine:@"Welcome to the StepTalk shell."];
NSLog(@"Environment %@", env);
while(1) while(1)
{ {
line = [self readLine]; line = [self readLine];
@ -199,6 +202,7 @@ int complete_handler(void)
} }
- (id)executeLine:(NSString *)line - (id)executeLine:(NSString *)line
{ {
STEnvironment *env = [conversation environment];
NSString *cmd; NSString *cmd;
id result = nil; id result = nil;
@ -257,6 +261,7 @@ int complete_handler(void)
- (int)completion - (int)completion
{ {
STEnvironment *env = [conversation environment];
NSEnumerator *enumerator; NSEnumerator *enumerator;
NSMutableSet *set; NSMutableSet *set;
NSString *match; NSString *match;

View file

@ -32,6 +32,7 @@ id STObjectFromValueOfType(void *value, const char *type);
@interface NSInvocation(STAdditions) @interface NSInvocation(STAdditions)
+ invocationWithTarget:(id)target selectorName:(NSString *)selectorName; + invocationWithTarget:(id)target selectorName:(NSString *)selectorName;
+ invocationWithTarget:(id)target selector:(SEL)selector;
- (void)setArgumentAsObject:(id)anObject atIndex:(int)anIndex; - (void)setArgumentAsObject:(id)anObject atIndex:(int)anIndex;
- (id)getArgumentAsObjectAtIndex:(int)anIndex; - (id)getArgumentAsObjectAtIndex:(int)anIndex;

View file

@ -257,6 +257,31 @@ void STGetValueOfTypeFromObject(void *value, const char *type, id anObject)
return invocation; 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:(int)anIndex - (void)setArgumentAsObject:(id)anObject atIndex:(int)anIndex
{ {
const char *type; const char *type;

View file

@ -37,7 +37,11 @@
NSString *languageName; NSString *languageName;
STEnvironment *environment; STEnvironment *environment;
} }
+ conversationInEnvironment:(STEnvironment *)env /*
+ conversationWithApplication:(NSString *)appName
language:(NSString *)langName;
*/
+ conversationWithEnvironment:(STEnvironment *)env
language:(NSString *)langName; language:(NSString *)langName;
- initWithEnvironment:(STEnvironment *)env - initWithEnvironment:(STEnvironment *)env

View file

@ -43,7 +43,7 @@
} }
/** Creates a new conversation with environment created using default /** Creates a new conversation with environment created using default
description and language with name <var>langName</var>. */ description and language with name <var>langName</var>. */
+ conversationInEnvironment:(STEnvironment *)env + conversationWithEnvironment:(STEnvironment *)env
language:(NSString *)langName language:(NSString *)langName
{ {
STConversation *c; STConversation *c;
@ -114,6 +114,7 @@
{ {
[self _createEngine]; [self _createEngine];
} }
NSLog(@"Run script in %@", environment);
return [engine executeCode: aString inEnvironment:environment]; return [engine executeCode: aString inEnvironment:environment];
} }
@end @end

View file

@ -40,5 +40,5 @@
- (NSString *)scriptName; - (NSString *)scriptName;
- (NSString *)localizedName; - (NSString *)localizedName;
- (NSString *)scriptDescription; - (NSString *)scriptDescription;
- (NSComparisonResult)compareByLocalizedName:(STScript *)aScript; - (NSComparisonResult)compareByLocalizedName:(STFileScript *)aScript;
@end @end

View file

@ -28,11 +28,13 @@
@interface STSelector:NSObject @interface STSelector:NSObject
{ {
NSString *selectorName;
SEL sel; SEL sel;
} }
- initWithName:(NSString *)aString;
- initWithSelector:(SEL)aSel; - initWithSelector:(SEL)aSel;
- (SEL)selectorValue; - (SEL)selectorValue;
- (NSString *)stringValue; - (NSString *)selectorName;
@end @end

View file

@ -25,27 +25,70 @@
*/ */
#import "STSelector.h" #import "STSelector.h"
#import "STObjCRuntime.h"
#import <Foundation/NSCoder.h>
#import <Foundation/NSString.h>
@implementation STSelector @implementation STSelector
- initWithName:(NSString *)aString
{
[super init];
selectorName = RETAIN(aString);
return self;
}
- initWithSelector:(SEL)aSel - initWithSelector:(SEL)aSel
{ {
[super init]; [super init];
sel = aSel; sel = aSel;
return self; return self;
} }
- (void)dealloc
{
RELEASE(selectorName);
[super dealloc];
}
- (SEL)selectorValue - (SEL)selectorValue
{ {
if(sel == 0)
{
sel = STSelectorFromString(selectorName);
}
return sel; return sel;
} }
- (NSString *)description - (NSString *)description
{ {
return NSStringFromSelector(sel); return [NSString stringWithFormat:@"#%@", [self selectorName]];
} }
- (NSString *)stringValue - (NSString *)selectorName
{ {
return NSStringFromSelector(sel); if(!selectorName)
{
selectorName = RETAIN(NSStringFromSelector(sel));
}
return selectorName;
}
- (void)encodeWithCoder:(NSCoder *)coder
{
// [super encodeWithCoder: coder];
[coder encodeObject:selectorName];
}
- initWithCoder:(NSCoder *)decoder
{
self = [super init]; // super initWithCoder: decoder];
[decoder decodeValueOfObjCType: @encode(id) at: &selectorName];
return self;
} }
@end @end

43
TODO
View file

@ -1,20 +1,33 @@
TODO list TODO list
1 handle 'connection did die' notification for distant objects in STEnvironment HIGH PRIORITY
2 fix class-info lookup for proxies in STEnvironment
3 implement NSRect object - implement NSRect object
5 Smalltalk: separate compiler and compilation context - Rewrite Smalltalk compiler (grammar)
9 create a 'Shell' scripting environment
11 Create ApplicationScripting framework, instead of bundle. It should offer 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 passive application scripting (without linking) and active app. scripting
(linking with the framewotk). Give it some reasonable name, becauase that one (linking with the framewotk). Give it some reasonable name, becauase that one
is already used by Apple is already used by Apple
13 Change source directory structure (see DevelopmentNotes.txt in Doumentation) - Add framework list into environment description
14 Add framework list into environment description - Change Modules to Frameworks
15 Change Modules to Framework - Fill implementation of STScriptObject, STMethod and related STEngine methods
16 Remove StepTalk modules - Remove empty directories (Source, Modules/StepTalk)
17 Fill implementation of STScriptObject, STMethod and related STEngine methods - Replace STMethod languageName with map table of method class->engine class
18 Rewrite Smalltalk compiler (grammar)
19 Remove empty directories (Source, Modules/StepTalk)
20 Replace STMethod languageName with map table of method class->engine class
21 Update application scripting to use STConversation

View file

@ -97,7 +97,6 @@
after moving from STEngnie to STConversation */ after moving from STEngnie to STConversation */
- (void)createConversation - (void)createConversation
{ {
STEnvironmentDescription *desc;
STEnvironment *env; STEnvironment *env;
if([target respondsToSelector:@selector(scriptingEnvironment)]) if([target respondsToSelector:@selector(scriptingEnvironment)])

View file

@ -4,7 +4,7 @@
# The version number of this release. # The version number of this release.
MAJOR_VERSION=0 MAJOR_VERSION=0
MINOR_VERSION=8 MINOR_VERSION=8
SUBMINOR_VERSION=1 SUBMINOR_VERSION=2
STEPTALK_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION} STEPTALK_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION}