2004-03-27 23:23:39 +00:00
|
|
|
#import "STEnvironmentProcess.h"
|
|
|
|
|
2005-09-05 20:10:43 +00:00
|
|
|
#import <Foundation/NSString.h>
|
|
|
|
#import <StepTalk/STEnvironment.h>
|
|
|
|
#import <StepTalk/STEnvironmentDescription.h>
|
|
|
|
|
2004-03-27 23:23:39 +00:00
|
|
|
@implementation STEnvironmentProcess
|
2005-09-05 20:10:43 +00:00
|
|
|
- initWithDescriptionName:(NSString *)descName
|
|
|
|
{
|
2013-03-23 19:17:07 +00:00
|
|
|
if ((self = [super init]) != nil)
|
2005-09-05 20:10:43 +00:00
|
|
|
{
|
2013-03-23 19:17:07 +00:00
|
|
|
STEnvironmentDescription *desc;
|
2005-09-05 20:10:43 +00:00
|
|
|
|
2013-03-23 19:17:07 +00:00
|
|
|
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"];
|
|
|
|
}
|
2005-09-05 20:10:43 +00:00
|
|
|
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);
|
|
|
|
}
|
2004-03-27 23:23:39 +00:00
|
|
|
@end
|