mirror of
https://github.com/gnustep/libs-steptalk.git
synced 2025-02-19 18:00:45 +00:00
Added ReadlineTranscript
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@17773 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
68e320be9b
commit
5e725064c3
11 changed files with 271 additions and 2 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
2003 Oct 3 Stefan Urbanek <urbanek@host.sk>
|
||||||
|
|
||||||
|
* Added ReadlineTranscript module (Idea by Alexander Diemand)
|
||||||
|
|
||||||
2003 Sep 24 Stefan Urbanek <urbanek@host.sk>
|
2003 Sep 24 Stefan Urbanek <urbanek@host.sk>
|
||||||
|
|
||||||
* STEnvironmentDescription: guard initialisation in Autorelease pool
|
* STEnvironmentDescription: guard initialisation in Autorelease pool
|
||||||
|
|
|
@ -90,7 +90,8 @@ static NSArray *ivars_for_class(Class class)
|
||||||
|
|
||||||
- (NSArray *)methodNames
|
- (NSArray *)methodNames
|
||||||
{
|
{
|
||||||
return [[self class] instanceMethodNames];
|
return [[[self class] instanceMethodNames]
|
||||||
|
sortedArrayUsingSelector:@selector(compare:)];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (NSArray *)methodNames
|
+ (NSArray *)methodNames
|
||||||
|
|
7
Modules/ReadlineTranscript/.cvsignore
Normal file
7
Modules/ReadlineTranscript/.cvsignore
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
*.app
|
||||||
|
*.debug
|
||||||
|
*.profile
|
||||||
|
shared_*obj
|
||||||
|
*.bundle
|
||||||
|
*.stmodule
|
||||||
|
*.stlanguage
|
44
Modules/ReadlineTranscript/GNUmakefile
Normal file
44
Modules/ReadlineTranscript/GNUmakefile
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
#
|
||||||
|
# ReadlineTranscript module
|
||||||
|
#
|
||||||
|
# Copyright (C)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.
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(GNUSTEP_MAKEFILES)/common.make
|
||||||
|
|
||||||
|
BUNDLE_NAME = ReadlineTranscript
|
||||||
|
|
||||||
|
ReadlineTranscript_OBJC_FILES = \
|
||||||
|
ReadlineTranscriptModule.m \
|
||||||
|
ReadlineTranscript.m \
|
||||||
|
|
||||||
|
ReadlineTranscript_PRINCIPAL_CLASS = ReadlineTranscriptModule
|
||||||
|
|
||||||
|
ReadlineTranscript_RESOURCE_FILES = ScriptingInfo.plist
|
||||||
|
|
||||||
|
BUNDLE_INSTALL_DIR:=$(GNUSTEP_INSTALLATION_DIR)/Library/StepTalk/Modules
|
||||||
|
|
||||||
|
ReadlineTranscript_BUNDLE_LIBS = -lStepTalk -lreadline
|
||||||
|
ADDITIONAL_INCLUDE_DIRS += -I../../Frameworks/
|
||||||
|
|
||||||
|
ADDITIONAL_OBJCFLAGS = -Wall -Wno-import
|
||||||
|
|
||||||
|
-include GNUmakefile.preamble
|
||||||
|
include $(GNUSTEP_MAKEFILES)/bundle.make
|
||||||
|
-include GNUMakefile.postamble
|
35
Modules/ReadlineTranscript/ReadlineTranscript.h
Normal file
35
Modules/ReadlineTranscript/ReadlineTranscript.h
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/**
|
||||||
|
ReadlineTranscript.h
|
||||||
|
StepTalk simple transcript
|
||||||
|
|
||||||
|
Copyright (c) 2002 Free Software Foundation
|
||||||
|
|
||||||
|
Written by: Stefan Urbanek <urbanek@host.sk>
|
||||||
|
Date: 2001 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 <Foundation/NSObject.h>
|
||||||
|
|
||||||
|
@interface ReadlineTranscript:NSObject
|
||||||
|
+ sharedTranscript;
|
||||||
|
- show:(id)anObject;
|
||||||
|
- showLine:(id)anObject;
|
||||||
|
- (NSString*)readLine:(NSString*)prompt;
|
||||||
|
@end
|
96
Modules/ReadlineTranscript/ReadlineTranscript.m
Normal file
96
Modules/ReadlineTranscript/ReadlineTranscript.m
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
/**
|
||||||
|
ReadlineTranscript.m
|
||||||
|
StepTalk simple transcript
|
||||||
|
|
||||||
|
Copyright (c) 2002 Free Software Foundation
|
||||||
|
|
||||||
|
Written by: Stefan Urbanek <urbanek@host.sk>
|
||||||
|
Date: 2001 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 "ReadlineTranscript.h"
|
||||||
|
|
||||||
|
#import <Foundation/NSValue.h>
|
||||||
|
#import <Foundation/NSString.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <readline/readline.h>
|
||||||
|
|
||||||
|
static Class NSString_class;
|
||||||
|
static Class NSNumber_class;
|
||||||
|
|
||||||
|
static ReadlineTranscript *sharedTranscript;
|
||||||
|
|
||||||
|
@implementation ReadlineTranscript:NSObject
|
||||||
|
+ (void)initialize
|
||||||
|
{
|
||||||
|
NSString_class = [NSString class];
|
||||||
|
NSNumber_class = [NSNumber class];
|
||||||
|
}
|
||||||
|
+ sharedTranscript
|
||||||
|
{
|
||||||
|
if(!sharedTranscript)
|
||||||
|
{
|
||||||
|
sharedTranscript = [[ReadlineTranscript alloc] init];
|
||||||
|
}
|
||||||
|
|
||||||
|
return sharedTranscript;
|
||||||
|
}
|
||||||
|
- show:(id)anObject
|
||||||
|
{
|
||||||
|
NSString *string;
|
||||||
|
|
||||||
|
if( [anObject isKindOfClass:NSString_class] )
|
||||||
|
{
|
||||||
|
string = anObject;
|
||||||
|
}
|
||||||
|
else if ( [anObject isKindOfClass:NSNumber_class] )
|
||||||
|
{
|
||||||
|
string = [anObject stringValue];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string = [anObject description];
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%s", [string cString]);
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- showLine:(id)anObject
|
||||||
|
{
|
||||||
|
[self show:anObject];
|
||||||
|
putchar('\n');
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
-(NSString*)readLine:(NSString*)prompt
|
||||||
|
{
|
||||||
|
NSString *resret=nil;
|
||||||
|
char *res;
|
||||||
|
res = readline([prompt cString]);
|
||||||
|
if (res)
|
||||||
|
{
|
||||||
|
resret = [NSString stringWithCString: res];
|
||||||
|
}
|
||||||
|
return resret;
|
||||||
|
}
|
||||||
|
@end
|
32
Modules/ReadlineTranscript/ReadlineTranscriptModule.h
Normal file
32
Modules/ReadlineTranscript/ReadlineTranscriptModule.h
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
/**
|
||||||
|
ReadlineTranscriptModule.h
|
||||||
|
Transcript module
|
||||||
|
|
||||||
|
Copyright (c) 2002 Free Software Foundation
|
||||||
|
|
||||||
|
Written by: Stefan Urbanek <urbanek@host.sk>
|
||||||
|
Date: 2001 May 18
|
||||||
|
|
||||||
|
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 <Foundation/NSObject.h>
|
||||||
|
|
||||||
|
@interface ReadlineTranscriptModule:NSObject
|
||||||
|
@end
|
||||||
|
|
41
Modules/ReadlineTranscript/ReadlineTranscriptModule.m
Normal file
41
Modules/ReadlineTranscript/ReadlineTranscriptModule.m
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
/**
|
||||||
|
ReadlineTranscriptModule.m
|
||||||
|
Transcript module
|
||||||
|
|
||||||
|
Copyright (c) 2002 Free Software Foundation
|
||||||
|
|
||||||
|
Written by: Stefan Urbanek <urbanek@host.sk>
|
||||||
|
Date: 2001 May 18
|
||||||
|
|
||||||
|
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 "ReadlineTranscriptModule.h"
|
||||||
|
#import "ReadlineTranscript.h"
|
||||||
|
|
||||||
|
#import <Foundation/NSDictionary.h>
|
||||||
|
#import <Foundation/NSString.h>
|
||||||
|
|
||||||
|
@implementation ReadlineTranscriptModule
|
||||||
|
+ (NSDictionary *)namedObjectsForScripting
|
||||||
|
{
|
||||||
|
return [NSDictionary dictionaryWithObject:[ReadlineTranscript sharedTranscript]
|
||||||
|
forKey:@"Transcript"];
|
||||||
|
}
|
||||||
|
@end
|
||||||
|
|
5
Modules/ReadlineTranscript/ScriptingInfo.plist
Normal file
5
Modules/ReadlineTranscript/ScriptingInfo.plist
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
ScriptingInfoClass = ReadlineTranscriptModule;
|
||||||
|
Classes = (
|
||||||
|
);
|
||||||
|
}
|
4
Modules/ReadlineTranscript/test.st
Normal file
4
Modules/ReadlineTranscript/test.st
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
Environment loadModule:'ReadlineTranscript'.
|
||||||
|
Transcript showLine: 'Readline test'.
|
||||||
|
line := Transcript readLine:'Write something: '.
|
||||||
|
Transcript showLine: line uppercaseString.
|
2
Version
2
Version
|
@ -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=0
|
SUBMINOR_VERSION=1
|
||||||
|
|
||||||
STEPTALK_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION}
|
STEPTALK_VERSION=${MAJOR_VERSION}.${MINOR_VERSION}.${SUBMINOR_VERSION}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue