discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ANN: StepTalk 0.5.2 and AppTalk 0.2.0


From: Stefan Urbanek
Subject: ANN: StepTalk 0.5.2 and AppTalk 0.2.0
Date: Sat, 13 Apr 2002 19:25:27 +0200

Hi,

I've separated StepTalk and AppTalk sources.

News
----
AppTalk 

        - Created scripting support bundle, so application does not have to be
          linked with StepTalk library. 
        - Bundles loaded by the application now can provide additional 
          scripts and additional scripting capabilities (new objects).
        - Application is looking for scripting information and scripts in all
          loaded bundles. 
        - Updated documentation about script search locations and about
          optional scripting using bundle. 
        - Created scripting support source file. 

Optional application scripting
------------------------------
Now you do not have to link an application with AppTalk and StepTalk
libraries, so your application does not have to depend on them. I have created
a bundle that will add scripting support. All you have to do is to load that
bundle or just insert scripting support file (attached) to your application
project. Scripting will be loaded and initialized when requested by the user.

I would like to know what do you think about this solution.

Download
--------
http://steptalk.host.sk/
http://decef.elf.stuba.sk/~urbane/StepTalk/

http://steptalk.host.sk/Download/StepTalk-0.5.2.tar.gz
http://steptalk.host.sk/Download/AppTalk-0.2.0.tar.gz


Any comments are welcome,

Stefan
/**
    ScriptingSupport
    Code for loading scripting
    
    NOTE: Copy and include this file into your application project.
  
  
    Copyright (c) 2002 Stefan Urbanek
  
    Written by: Stefan Urbanek <stefanurbanek@yahoo.fr>
    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

   */


#import <AppKit/NSApplication.h>

#import <Foundation/NSArray.h>
#import <Foundation/NSBundle.h>
#import <Foundation/NSEnumerator.h>
#import <Foundation/NSFileManager.h>
#import <Foundation/NSString.h>

BOOL STInitializeApplicationScripting(void)
{
    NSFileManager *manager = [NSFileManager defaultManager];
    NSEnumerator  *enumerator;
    NSBundle      *bundle;
    NSString      *path;
    NSArray       *paths;
    BOOL           isDir;

    NSLog(@"Loading application scripting support");
    paths = NSStandardLibraryPaths();

    enumerator = [paths objectEnumerator];
    
    while( (path = [enumerator nextObject]) )
    {
    
        path = [path stringByAppendingPathComponent:@"Bundles"];
        path = [path stringByAppendingPathComponent:@"ScriptingSupport.bundle"];

        if( [manager fileExistsAtPath:path isDirectory:&isDir] && isDir)
        {
            break;
        }
    }

    bundle = [NSBundle bundleWithPath:path];

    if(path && bundle)
    {
        [[bundle principalClass] class];
        return YES;
    }
    else
    {
        NSLog(@"Unable to load application scripting support");
        return NO;
    }
}

@implementation NSApplication(STApplicationScriptingInit)
- (void)_loadAppTalkAndRetryAction:(SEL)sel sender:(id)sender
{
    static BOOL isIn = NO;
    
    if(isIn)
    {
        NSLog(@"Error occured while loading application scripting support");

        isIn = NO;
        return;
    }
    
    isIn = YES;

    if(STInitializeApplicationScripting())
    {
        [self performSelector:sel withObject:sender];
    }

    isIn = NO;
}

- (void)orderFrontScriptsPanel:(id)sender
{
    [self _loadAppTalkAndRetryAction:_cmd sender:sender];
}

- (void)orderFrontTranscriptWindow:(id)sender
{
    [self _loadAppTalkAndRetryAction:_cmd sender:sender];
}
@end

reply via email to

[Prev in Thread] Current Thread [Next in Thread]