mirror of
https://github.com/gnustep/libs-steptalk.git
synced 2025-02-15 08:01:40 +00:00
Finders updated
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@13804 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
66049a0a8b
commit
dcccd47fc7
17 changed files with 305 additions and 28 deletions
|
@ -1,4 +1,11 @@
|
|||
obj
|
||||
shared_obj
|
||||
shared_debug_obj
|
||||
*.app
|
||||
*.debug
|
||||
*.bundle
|
||||
*.o
|
||||
New
|
||||
Ignore
|
||||
.snap-ignore
|
||||
Extensions
|
||||
.snap-ignore
|
||||
|
|
12
ChangeLog
12
ChangeLog
|
@ -1,8 +1,8 @@
|
|||
2002 Jun 8
|
||||
|
||||
* STEnvironmentDescription: added module list; little code cleanup;
|
||||
removed descriptionFromFile: and initFromFile: methods
|
||||
* STEnvironment: removed methods:
|
||||
* STEnvironmentDescription: added module amd finder list; little code
|
||||
cleanup; removed descriptionFromFile: and initFromFile: methods
|
||||
* STEnvironment: removed methods
|
||||
environmentWithDescriptionFromFile:
|
||||
environmentWithDescriptionFromDictionary:
|
||||
initWithDescriptionFromFile:
|
||||
|
@ -16,11 +16,11 @@
|
|||
renamed methods:
|
||||
defaultObjectPool to objectDictionary
|
||||
registerObjectFinderWithName: to registerObjectFinderNamed:
|
||||
load modules from description at initialization;
|
||||
load modules and finders from description at initialization;
|
||||
* STExecutor: reflect STEnvironment changes
|
||||
* stexec: removed loading of the Foundation environment as this is handled
|
||||
* stexec: removed loading of the Foundation module as this is handled
|
||||
by the STEnvironment
|
||||
* AppKit.stenv: new file
|
||||
* Environments: new descriptions AppKit.stenv and Distributed.stenv
|
||||
|
||||
2002 Jun 7
|
||||
|
||||
|
|
|
@ -9,6 +9,13 @@ Name
|
|||
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.
|
||||
|
|
|
@ -32,6 +32,14 @@ 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.
|
||||
|
|
|
@ -145,9 +145,6 @@
|
|||
env = [STEnvironment environmentWithDescriptionName:envName];
|
||||
}
|
||||
|
||||
// [env loadModule:@"Foundation"];
|
||||
[env registerObjectFinderNamed:@"DistributedFinder"];
|
||||
|
||||
/* FIXME: make this an option */
|
||||
[env setFullScriptingEnabled:YES];
|
||||
|
||||
|
|
45
Finders/ApplicationFinder/GNUmakefile
Normal file
45
Finders/ApplicationFinder/GNUmakefile
Normal file
|
@ -0,0 +1,45 @@
|
|||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
GNUSTEP_MAKEFILES = $(GNUSTEP_SYSTEM_ROOT)/Makefiles
|
||||
|
||||
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_INCLUDE_DIRS += -I../../Source/Headers
|
||||
ADDITIONAL_LIB_DIRS += -L../../Source/$(GNUSTEP_OBJ_DIR)
|
||||
|
||||
BUNDLE_INSTALL_DIR:=$(GNUSTEP_INSTALLATION_DIR)/Library/StepTalk/Finders
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
include $(GNUSTEP_MAKEFILES)/bundle.make
|
||||
-include GNUMakefile.postamble
|
33
Finders/ApplicationFinder/STApplicationFinder.h
Normal file
33
Finders/ApplicationFinder/STApplicationFinder.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
STApplicationFinder
|
||||
|
||||
Copyright (c) 2002 Free Software Foundation
|
||||
|
||||
Written by: Stefan Urbanek <urbanek@host.sk>
|
||||
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 <StepTalk/STModule.h>
|
||||
|
||||
@interface STApplicationFinder:NSObject
|
||||
{
|
||||
}
|
||||
@end
|
||||
|
117
Finders/ApplicationFinder/STApplicationFinder.m
Normal file
117
Finders/ApplicationFinder/STApplicationFinder.m
Normal file
|
@ -0,0 +1,117 @@
|
|||
/**
|
||||
STApplicationFinder
|
||||
|
||||
Copyright (c) 2002 Free Software Foundation
|
||||
|
||||
Written by: Stefan Urbanek <urbanek@host.sk>
|
||||
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 <AppKit/NSWorkspace.h>
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSConnection.h>
|
||||
#import <Foundation/NSDebug.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSFileManager.h>
|
||||
#import <Foundation/NSPathUtilities.h>
|
||||
#import <Foundation/NSSet.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
@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
|
||||
|
|
@ -53,7 +53,7 @@ static NSDictionary *STDOInfo(NSString *name)
|
|||
return nil;
|
||||
}
|
||||
|
||||
@implementation STDistributedFinder:NSObject
|
||||
@implementation STDistributedFinder
|
||||
- (id)connectDistantObjectWithName:(NSString *)name
|
||||
{
|
||||
NSDictionary *dict = STDOInfo(name);
|
||||
|
|
|
@ -31,7 +31,7 @@ include $(GNUSTEP_MAKEFILES)/common.make
|
|||
ifeq ($(appkit),no)
|
||||
SUBPROJECTS = DistributedFinder
|
||||
else
|
||||
SUBPROJECTS = DistributedFinder # ApplicationFinder
|
||||
SUBPROJECTS = DistributedFinder ApplicationFinder
|
||||
endif
|
||||
|
||||
-include GNUMakefile.preamble
|
||||
|
|
23
README
23
README
|
@ -24,9 +24,14 @@ You can download StepTalk from
|
|||
Installation
|
||||
------------
|
||||
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
|
||||
|
||||
Tools
|
||||
-----
|
||||
|
@ -53,6 +58,8 @@ 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
|
||||
|
@ -68,16 +75,12 @@ Files
|
|||
|
||||
There should be these directories:
|
||||
|
||||
Environments
|
||||
- directory containig environment descriptions
|
||||
Languages
|
||||
- StepTalk language bundles
|
||||
Modules
|
||||
- StepTalk modules
|
||||
|
||||
Scripts
|
||||
- directory containig StepTalk scripts
|
||||
|
||||
Configuration - Configuration files
|
||||
Environments - Directory containig environment descriptions
|
||||
Finders - Object finders
|
||||
Languages - StepTalk language bundles
|
||||
Modules - StepTalk modules
|
||||
Scripts - Directory containig StepTalk scripts
|
||||
|
||||
Defaults
|
||||
--------
|
||||
|
|
|
@ -1,11 +1,17 @@
|
|||
/** 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);
|
||||
|
||||
}
|
||||
|
|
15
Source/Environments/Distributed.stenv
Normal file
15
Source/Environments/Distributed.stenv
Normal file
|
@ -0,0 +1,15 @@
|
|||
/** Distributed.stenv
|
||||
|
||||
Description for distributed environment.
|
||||
|
||||
Using this description will include Distributed Object finder.
|
||||
|
||||
*/
|
||||
|
||||
{
|
||||
Name = "Distributed";
|
||||
|
||||
Finders = (DistributedFinder);
|
||||
|
||||
Use = ("Foundation");
|
||||
}
|
|
@ -44,6 +44,7 @@ enum
|
|||
NSMutableDictionary *behaviours;
|
||||
NSMutableDictionary *aliases;
|
||||
NSMutableArray *modules;
|
||||
NSMutableArray *finders;
|
||||
|
||||
int restriction;
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@
|
|||
- initWithDescription:(STEnvironmentDescription *)aDescription
|
||||
{
|
||||
NSEnumerator *enumerator;
|
||||
NSString *module;
|
||||
NSString *name;
|
||||
|
||||
self = [super init];
|
||||
|
||||
|
@ -109,11 +109,20 @@
|
|||
description = RETAIN(aDescription);
|
||||
classes = [description classes];
|
||||
|
||||
/* Load modules */
|
||||
enumerator = [[description modules] objectEnumerator];
|
||||
|
||||
while( (module = [enumerator nextObject]) )
|
||||
while( (name = [enumerator nextObject]) )
|
||||
{
|
||||
[self loadModule:module];
|
||||
[self loadModule:name];
|
||||
}
|
||||
|
||||
/* Register finders */
|
||||
enumerator = [[description objectFinders] objectEnumerator];
|
||||
|
||||
while( (name = [enumerator nextObject]) )
|
||||
{
|
||||
[self registerObjectFinderNamed:name];
|
||||
}
|
||||
|
||||
RETAIN(description);
|
||||
|
|
|
@ -119,6 +119,7 @@ static NSDictionary *dictForDescriptionWithName(NSString *defName)
|
|||
RELEASE(behaviours);
|
||||
RELEASE(aliases);
|
||||
RELEASE(modules);
|
||||
RELEASE(finders);
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -178,6 +179,7 @@ static NSDictionary *dictForDescriptionWithName(NSString *defName)
|
|||
|
||||
[self updateUseList:[def objectForKey:@"Use"]];
|
||||
[self updateModuleList:[def objectForKey:@"Modules"]];
|
||||
[self updateFinderList:[def objectForKey:@"Finders"]];
|
||||
[self updateBehavioursFromDictionary:[def objectForKey:@"Behaviours"]];
|
||||
[self updateClassesFromDictionary:[def objectForKey:@"Classes"]];
|
||||
[self updateAliasesFromDictionary:[def objectForKey:@"Aliases"]];
|
||||
|
@ -229,6 +231,27 @@ static NSDictionary *dictForDescriptionWithName(NSString *defName)
|
|||
}
|
||||
}
|
||||
|
||||
- (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;
|
||||
|
@ -412,6 +435,12 @@ static NSDictionary *dictForDescriptionWithName(NSString *defName)
|
|||
return [NSArray arrayWithArray:modules];
|
||||
}
|
||||
|
||||
- (NSArray *)objectFinders
|
||||
{
|
||||
return [NSArray arrayWithArray:finders];
|
||||
}
|
||||
|
||||
|
||||
- (void)fixupScriptingDescription
|
||||
{
|
||||
[self resolveSuperclasses];
|
||||
|
|
4
Version
4
Version
|
@ -3,8 +3,8 @@
|
|||
|
||||
# The version number of this release.
|
||||
MAJOR_VERSION=0
|
||||
MINOR_VERSION=5
|
||||
SUBMINOR_VERSION=3
|
||||
MINOR_VERSION=6
|
||||
SUBMINOR_VERSION=0
|
||||
|
||||
STEPTALK_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION}
|
||||
|
||||
|
|
Loading…
Reference in a new issue