mirror of
https://github.com/gnustep/libs-steptalk.git
synced 2025-02-15 08:01:40 +00:00
Shut down compiler warnings for StepTalk's ApplicationScripting bundle.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@34536 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7f4a3ef104
commit
69646308b3
8 changed files with 144 additions and 113 deletions
|
@ -1,3 +1,26 @@
|
|||
2012-01-15 Wolfgang Lux <wolfgang.lux@gmail.com>
|
||||
|
||||
* 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 <urbanek@host.sk>
|
||||
|
||||
* Added 'Objects' searching in application.
|
||||
|
|
|
@ -39,4 +39,6 @@
|
|||
|
||||
- (NSMenu *)scriptingMenu;
|
||||
- (void)setScriptingMenu:(NSMenu *)menu;
|
||||
|
||||
- (NSString *)applicationNameForScripting;
|
||||
@end
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#import "STEnvironment+additions.h"
|
||||
|
||||
#import <StepTalk/STBundleInfo.h>
|
||||
#import <StepTalk/STEnvironmentDescription.h>
|
||||
|
||||
#import <Foundation/NSBundle.h>
|
||||
#import <Foundation/NSDebug.h>
|
||||
|
@ -95,6 +96,7 @@ static STApplicationScriptingController *scriptingController = nil;
|
|||
/** Create shared scripting environment. */
|
||||
- (void)_createDefaultScriptingEnvironment
|
||||
{
|
||||
STEnvironmentDescription *desc;
|
||||
STEnvironment *env = nil;
|
||||
STBundleInfo *info;
|
||||
//NSString *path;
|
||||
|
@ -127,18 +129,19 @@ static STApplicationScriptingController *scriptingController = nil;
|
|||
|
||||
if(str && ![str isEqualToString:@""])
|
||||
{
|
||||
env = [STEnvironment environmentWithDescriptionName:str];
|
||||
desc = [STEnvironmentDescription descriptionWithName:str];
|
||||
env = [STEnvironment environmentWithDescription:desc];
|
||||
}
|
||||
if(!env)
|
||||
{
|
||||
NSDebugLog(@"Using default scripting environment");
|
||||
env = [STEnvironment defaultScriptingEnvironment];
|
||||
env = [STEnvironment environmentWithDefaultDescription];
|
||||
}
|
||||
|
||||
[env loadModule:@"AppKit"];
|
||||
[env includeBundle:[NSBundle mainBundle]];
|
||||
[env setObject:self forName:@"Application"];
|
||||
[env setObject:self forName:[self applcationNameForScripting]];
|
||||
[env setObject:self forName:[self applicationNameForScripting]];
|
||||
[env setObject:[STTranscript sharedTranscript] forName:@"Transcript"];
|
||||
|
||||
scriptingEnvironment = RETAIN(env);
|
||||
|
@ -193,7 +196,7 @@ static STApplicationScriptingController *scriptingController = nil;
|
|||
}
|
||||
|
||||
/** Name of application object */
|
||||
- (NSString *)applcationNameForScripting
|
||||
- (NSString *)applicationNameForScripting
|
||||
{
|
||||
return [[NSProcessInfo processInfo] processName];
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#import <Foundation/NSObject.h>
|
||||
|
||||
@class STScriptsPanel;
|
||||
@class STScript;
|
||||
@class STFileScript;
|
||||
@class STEnvironment;
|
||||
@class NSMenu;
|
||||
@class NSDictionary;
|
||||
|
@ -45,7 +45,7 @@
|
|||
- (void)orderFrontScriptsPanel:(id)sender;
|
||||
- (void)orderFrontTranscriptWindow:(id)sender;
|
||||
|
||||
- (id)executeScript:(STScript *)script;
|
||||
- (id)executeScript:(STFileScript *)script;
|
||||
- (id)executeScriptString:(NSString *)source
|
||||
inEnvironment:(STEnvironment *)env;
|
||||
@end
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#import <StepTalk/STEngine.h>
|
||||
#import <StepTalk/STEnvironment.h>
|
||||
#import <StepTalk/STLanguageManager.h>
|
||||
#import <StepTalk/STScript.h>
|
||||
#import <StepTalk/STFileScript.h>
|
||||
|
||||
#import "STScriptsPanel.h"
|
||||
#import "STTranscript.h"
|
||||
|
@ -119,103 +119,6 @@
|
|||
return scriptingMenu;
|
||||
}
|
||||
|
||||
/** Execute script <var>script</var> in actual scripting environment. If an
|
||||
exception occured, it will be logged into the Transcript window. */
|
||||
- (id)executeScript:(STScript *)script
|
||||
{
|
||||
STEnvironment *env = [self actualScriptingEnvironment];
|
||||
STEngine *engine;
|
||||
NSString *error;
|
||||
id retval;
|
||||
|
||||
NSDebugLog(@"Execute a script '%@'", [script localizedName]);
|
||||
|
||||
engine = [STEngine engineForLanguageWithName:[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 executeCode:[script source] inEnvironment: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 <var>source</var> in environment <var>env</var>. */
|
||||
- (id)executeScriptString:(NSString *)source
|
||||
inEnvironment:(STEnvironment *)env
|
||||
{
|
||||
STEngine *engine;
|
||||
NSString *error;
|
||||
id retval = nil;
|
||||
|
||||
engine = [STEngine engineForLanguageWithName:
|
||||
[[STLanguageManager defaultManager] defaultLanguageName]];
|
||||
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 executeCode:source inEnvironment: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;
|
||||
}
|
||||
/* FIXME: rewrite this */
|
||||
- (void)updateObjectReferences
|
||||
{
|
||||
|
@ -251,4 +154,102 @@
|
|||
NS_ENDHANDLER
|
||||
}
|
||||
}
|
||||
|
||||
/** Execute script <var>script</var> 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 <var>source</var> in environment <var>env</var>. */
|
||||
- (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
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#import <AppKit/NSPanel.h>
|
||||
|
||||
@class STScriptsManager;
|
||||
@class STScript;
|
||||
@class STFileScript;
|
||||
@class NSPopUpButton;
|
||||
|
||||
@interface STScriptsPanel : NSPanel
|
||||
|
@ -49,7 +49,7 @@
|
|||
- (void) browse: (id)sender;
|
||||
- (void) showHelp: (id)sender;
|
||||
|
||||
- (STScript *) selectedScript;
|
||||
- (STFileScript *) selectedScript;
|
||||
|
||||
- (void) setDelegate: (id)anObject;
|
||||
- (id) delegate;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#import "STScriptsPanel.h"
|
||||
|
||||
#import <StepTalk/STScript.h>
|
||||
#import <StepTalk/STFileScript.h>
|
||||
#import <StepTalk/STScriptsManager.h>
|
||||
|
||||
#import <AppKit/NSApplication.h>
|
||||
|
@ -35,6 +35,7 @@
|
|||
#import <AppKit/NSMatrix.h>
|
||||
#import <AppKit/NSPopUpButton.h>
|
||||
#import <AppKit/NSWorkspace.h>
|
||||
#import <AppKit/NSGraphics.h>
|
||||
|
||||
#import "NSObject+NibLoading.h"
|
||||
#import "STApplicationScriptingController.h"
|
||||
|
@ -112,7 +113,7 @@ STScriptsPanel *sharedScriptsPanel = nil;
|
|||
}
|
||||
- (void) run: (id)sender
|
||||
{
|
||||
STScript *script = [self selectedScript];
|
||||
STFileScript *script = [self selectedScript];
|
||||
|
||||
if(script)
|
||||
{
|
||||
|
@ -122,7 +123,7 @@ STScriptsPanel *sharedScriptsPanel = nil;
|
|||
|
||||
- (void) selectScript: (id)sender
|
||||
{
|
||||
STScript *script = [self selectedScript];
|
||||
STFileScript *script = [self selectedScript];
|
||||
|
||||
[descriptionText setString:[script scriptDescription]];
|
||||
}
|
||||
|
@ -138,9 +139,9 @@ STScriptsPanel *sharedScriptsPanel = nil;
|
|||
}
|
||||
- (void)browse:(id)sender
|
||||
{
|
||||
NSWorkspace *ws = [NSWorkspace sharedWorkspace];
|
||||
STScript *script = [self selectedScript];
|
||||
NSString *path = [[script fileName] stringByDeletingLastPathComponent];
|
||||
NSWorkspace *ws = [NSWorkspace sharedWorkspace];
|
||||
STFileScript *script = [self selectedScript];
|
||||
NSString *path = [[script fileName] stringByDeletingLastPathComponent];
|
||||
|
||||
if(script)
|
||||
{
|
||||
|
@ -160,7 +161,7 @@ STScriptsPanel *sharedScriptsPanel = nil;
|
|||
[self selectScript:nil];
|
||||
}
|
||||
|
||||
- (STScript *)selectedScript
|
||||
- (STFileScript *)selectedScript
|
||||
{
|
||||
if([scriptList selectedCell])
|
||||
{
|
||||
|
|
|
@ -38,4 +38,5 @@
|
|||
- show:(id)anObject;
|
||||
- showLine:(id)anObject;
|
||||
- showError:(NSString *)errorText;
|
||||
- (NSWindow *)window;
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue