Skip to content

Commit 7d66c38

Browse files
committed
rename MPWStCompiler → STCompiler
1 parent f7f1811 commit 7d66c38

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+247
-229
lines changed

Diff for: Classes/MPWAssignmentExpression.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
#import "MPWAssignmentExpression.h"
10-
#import "MPWStCompiler.h"
10+
#import "STCompiler.h"
1111
#import "MPWIdentifierExpression.h"
1212
#import "MPWIdentifier.h"
1313

Diff for: Classes/MPWBlockContext.m

+15-15
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#import "MPWBlockContext.h"
1010
#import "MPWStatementList.h"
1111
#import "MPWEvaluator.h"
12-
#import "MPWStCompiler.h"
12+
#import "STCompiler.h"
1313
#import <MPWFoundation/MPWMapFilter.h>
1414
#import "MPWBinding.h"
1515
#import "MPWMethodHeader.h"
@@ -62,7 +62,7 @@ +(void)initialize
6262
{
6363
id localContextClass=[[self context] class];
6464
if ( !localContextClass) {
65-
localContextClass=[MPWStCompiler class];
65+
localContextClass=[STCompiler class];
6666
}
6767
return localContextClass;
6868
}
@@ -255,7 +255,7 @@ -(void)autoreleased:(ZeroArgBlock)block
255255

256256
@end
257257

258-
#import "MPWStCompiler.h"
258+
#import "STCompiler.h"
259259

260260
@interface NSNumber(methodsAddedByBlockTest)
261261

@@ -271,24 +271,24 @@ @implementation MPWBlockContext(tests)
271271

272272
+(void)testObjcBlocksWithNoArgsAreMapped
273273
{
274-
IDEXPECT([MPWStCompiler evaluate:@"a:=0. #( 1, 2, 3, 4 ) enumerateObjectsUsingBlock:[ a := a+1. ]. a."], [NSNumber numberWithInt:4], @"just counted the elements in an array using block enumeration");
274+
IDEXPECT([STCompiler evaluate:@"a:=0. #( 1, 2, 3, 4 ) enumerateObjectsUsingBlock:[ a := a+1. ]. a."], [NSNumber numberWithInt:4], @"just counted the elements in an array using block enumeration");
275275
}
276276

277277
+(void)testObjcBlocksWithObjectArgsAreMapped
278278
{
279-
IDEXPECT([MPWStCompiler evaluate:@"a:=0. #( 1, 2, 3, 4 ) enumerateObjectsUsingBlock:[ :obj | a := a+obj. ]. a."], [NSNumber numberWithInt:10], @"added the elements in an array using block enumeration");
279+
IDEXPECT([STCompiler evaluate:@"a:=0. #( 1, 2, 3, 4 ) enumerateObjectsUsingBlock:[ :obj | a := a+obj. ]. a."], [NSNumber numberWithInt:10], @"added the elements in an array using block enumeration");
280280
}
281281

282282

283283
+(void)testBlockArgsDontMessWithEnclosingScope
284284
{
285-
IDEXPECT([MPWStCompiler evaluate:@"a:=3. block:=[:a| a+10]. block value:42. a."], [NSNumber numberWithInt:3], @"local var");
285+
IDEXPECT([STCompiler evaluate:@"a:=3. block:=[:a| a+10]. block value:42. a."], [NSNumber numberWithInt:3], @"local var");
286286
}
287287
typedef id (^idBlock)(id arg );
288288

289289
+(void)testSTBlockAsObjCBlock
290290
{
291-
MPWBlockContext *stblock = [MPWStCompiler evaluate:@"[:a| a+10]"];
291+
MPWBlockContext *stblock = [STCompiler evaluate:@"[:a| a+10]"];
292292
IDEXPECT([stblock class],self, @"class");
293293
idBlock objcBlock=(idBlock)stblock;
294294
NSNumber *val=@(12);
@@ -301,7 +301,7 @@ +(void)testSTBlockAsObjCBlock
301301
+(void)testCopiedSTBlockAsObjCBlock
302302
{
303303
idBlock copiedBlock=nil;
304-
MPWBlockContext *stblock = [MPWStCompiler evaluate:@"[:a| a+10]"];
304+
MPWBlockContext *stblock = [STCompiler evaluate:@"[:a| a+10]"];
305305
IDEXPECT([stblock class],self, @"class");
306306
INTEXPECT([stblock retainCount], 1, @"retainCount");
307307
idBlock objcBlock=(idBlock)stblock;
@@ -321,7 +321,7 @@ +(void)testRetainedSTBlockOriginalAutoreleased
321321
{
322322
idBlock copiedBlock=nil;
323323
@autoreleasepool {
324-
MPWBlockContext *stblock = [MPWStCompiler evaluate:@"[:a| a+10]"];
324+
MPWBlockContext *stblock = [STCompiler evaluate:@"[:a| a+10]"];
325325
IDEXPECT([stblock class],self, @"class");
326326
idBlock objcBlock=(idBlock)stblock;
327327
copiedBlock=[objcBlock retain];
@@ -337,7 +337,7 @@ +(void)testBlock_copiedSTBlockOriginalAutoreleased
337337
{
338338
idBlock copiedBlock=nil;
339339
@autoreleasepool {
340-
MPWBlockContext *stblock = [MPWStCompiler evaluate:@"[:a| a+10]"];
340+
MPWBlockContext *stblock = [STCompiler evaluate:@"[:a| a+10]"];
341341
IDEXPECT([stblock class],self, @"class");
342342
INTEXPECT([stblock retainCount], 1, @"retainCount");
343343
idBlock objcBlock=(idBlock)stblock;
@@ -355,15 +355,15 @@ +(void)testBlock_copiedSTBlockOriginalAutoreleased
355355

356356
+(void)testBlockInstalledAsMethod
357357
{
358-
MPWBlockContext *stblock = [MPWStCompiler evaluate:@"[ 42 ]"];
358+
MPWBlockContext *stblock = [STCompiler evaluate:@"[ 42 ]"];
359359
[stblock installInClass:[NSNumber class] withSignature:"@@:@" selector:@selector(theAnswer)];
360360
id theAnswer=[@(2) theAnswer];
361361
IDEXPECT(theAnswer, @(42), @"theAnswer");
362362
}
363363

364364
+(void)testBlockAsMethodWithSelfAsArg
365365
{
366-
MPWBlockContext *stblock = [MPWStCompiler evaluate:@"[ :self | self + 42. ]"];
366+
MPWBlockContext *stblock = [STCompiler evaluate:@"[ :self | self + 42. ]"];
367367
[stblock installInClass:[NSNumber class] withSignature:"@@:@" selector:@selector(answerPlus)];
368368
id theAnswer=[@(2) answerPlus];
369369
IDEXPECT(theAnswer, @(44), @"theAnswer");
@@ -372,15 +372,15 @@ +(void)testBlockAsMethodWithSelfAsArg
372372

373373
+(void)testBlockAsMethodWithArg
374374
{
375-
MPWBlockContext *stblock = [MPWStCompiler evaluate:@"[ :self :arg | arg + 42. ]"];
375+
MPWBlockContext *stblock = [STCompiler evaluate:@"[ :self :arg | arg + 42. ]"];
376376
[stblock installInClass:[NSNumber class] withSignature:"@@:@@" selector:@selector(answerPlus:)];
377377
id theAnswer=[@(2) answerPlus:@(10)];
378378
IDEXPECT(theAnswer, @(52), @"theAnswer");
379379
}
380380

381381
+(void)testBlockAsMethodWithIntReturn
382382
{
383-
MPWBlockContext *stblock = [MPWStCompiler evaluate:@"[ 42 ]"];
383+
MPWBlockContext *stblock = [STCompiler evaluate:@"[ 42 ]"];
384384
[stblock installInClass:[NSNumber class] withSignature:"i@:" selector:@selector(theIntAnswer)];
385385
NSLog(@"=== should convert to int");
386386
int theAnswer=[@(2) theIntAnswer];
@@ -389,7 +389,7 @@ +(void)testBlockAsMethodWithIntReturn
389389

390390
+(void)testBlockAsMethodWithMethodHeader
391391
{
392-
MPWBlockContext *stblock = [MPWStCompiler evaluate:@"[ :self :arg | self + 13 + (arg * 2)]"];
392+
MPWBlockContext *stblock = [STCompiler evaluate:@"[ :self :arg | self + 13 + (arg * 2)]"];
393393
[stblock installInClass:[NSNumber class] withMethodHeaderString:@"<int>addThirtenAndArgToSelf:<int>anArg"];
394394
// NSLog(@"=== should convert to int");
395395
int theAnswer=[@(2) addThirtenAndArgToSelf:7];

Diff for: Classes/MPWClassDefinition.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#import "NSObjectScripting.h"
1111
#import "MPWMethodStore.h"
1212
#import "MPWClassMethodStore.h"
13-
#import "MPWStCompiler.h"
13+
#import "STCompiler.h"
1414
#import "MPWPropertyPathGetter.h"
1515
#import "MPWPropertyPathSetter.h"
1616

Diff for: Classes/MPWClassMethodStore.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88

99
#import <MPWFoundation/MPWFoundation.h>
1010

11-
@class MPWClassMirror,MPWStCompiler,MPWMethodCallBack,MPWScriptedMethod;
11+
@class MPWClassMirror,STCompiler,MPWMethodCallBack,MPWScriptedMethod;
1212

1313
@interface MPWClassMethodStore : NSObject
1414
{
1515
MPWClassMirror *classMirror;
1616
NSMutableDictionary *methodCallbacks;
17-
MPWStCompiler *compiler;
17+
STCompiler *compiler;
1818
}
1919

2020
-initWithClassMirror:(MPWClassMirror*)newMirror compiler:aCompiler;

Diff for: Classes/MPWClassMethodStore.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ @implementation MPWClassMethodStore
1717

1818
objectAccessor( MPWClassMirror, classMirror, setClassMirror )
1919
objectAccessor( NSMutableDictionary, methodCallbacks, setMethodCallbacks )
20-
scalarAccessor( MPWStCompiler *, compiler, setCompiler)
20+
scalarAccessor( STCompiler *, compiler, setCompiler)
2121

2222
-(Class)theClass
2323
{

Diff for: Classes/MPWExpression.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
#import <ObjectiveSmalltalk/MPWExpression.h>
10-
#import "MPWStCompiler.h"
10+
#import "STCompiler.h"
1111
#import "MPWIdentifier.h"
1212

1313
@implementation MPWExpression

Diff for: Classes/MPWMethodCallBack.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#import "MPWMethodCallBack.h"
1818
#import "MPWMethodHeader.h"
1919
#import "MPWScriptedMethod.h"
20-
#import "MPWStCompiler.h"
20+
#import "STCompiler.h"
2121
#import <ObjectiveSmalltalk/MPWAbstractInterpretedMethod.h>
2222
#import <objc/objc.h>
2323
#import <objc/runtime.h>

Diff for: Classes/MPWMethodStore.m

+6-6
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#import "MPWScriptedMethod.h"
1414
#import "MPWMethodType.h"
1515
#import "MPWMethod.h"
16-
#import "MPWStCompiler.h"
16+
#import "STCompiler.h"
1717
#import "MPWClassMethodStore.h"
1818
#import "MPWClassMirror.h"
1919

@@ -283,14 +283,14 @@ @implementation MPWMethodStore(testing)
283283

284284
+store
285285
{
286-
return [[[self alloc] initWithCompiler:[[[MPWStCompiler alloc] init] autorelease]] autorelease];
286+
return [[[self alloc] initWithCompiler:[[[STCompiler alloc] init] autorelease]] autorelease];
287287
}
288288

289289
#if !TARGET_OS_IPHONE
290290

291291
+(void)testWriteSingleMethodClass
292292
{
293-
MPWStCompiler *compiler=[MPWStCompiler compiler];
293+
STCompiler *compiler=[STCompiler compiler];
294294
MPWMethodStore *store=[compiler methodStore];
295295
EXPECTNIL(NSClassFromString(@"MPWMethodWriterTestClass1"), @"class not defined");
296296
[compiler evaluateScriptString:@"class MPWMethodWriterTestClass1 : NSObject { -answer { 42. } }. "];
@@ -308,7 +308,7 @@ +(void)testWriteSingleMethodClass
308308

309309
+(void)testWriteTwoMethodClass
310310
{
311-
MPWStCompiler *compiler=[MPWStCompiler compiler];
311+
STCompiler *compiler=[STCompiler compiler];
312312
MPWMethodStore *store=[compiler methodStore];
313313
EXPECTNIL(NSClassFromString(@"MPWMethodWriterTestClass2"), @"class not defined");
314314
[compiler evaluateScriptString:@"class MPWMethodWriterTestClass2 : NSObject { -answer1 { 42. } -answer2 { 82. } }. "];
@@ -326,7 +326,7 @@ +(void)testWriteTwoMethodClass
326326

327327
+(void)testWriteClassWithIvar
328328
{
329-
MPWStCompiler *compiler=[MPWStCompiler compiler];
329+
STCompiler *compiler=[STCompiler compiler];
330330
MPWMethodStore *store=[compiler methodStore];
331331
EXPECTNIL(NSClassFromString(@"MPWMethodWriterTestClassWithIVars1"), @"class not defined");
332332
[compiler evaluateScriptString:@"class MPWMethodWriterTestClassWithIVars1 : NSObject { var a. var b. -answer { 42. } }. "];
@@ -344,7 +344,7 @@ +(void)testWriteClassWithIvar
344344

345345
+(void)testWriteClassesToStore
346346
{
347-
MPWStCompiler *compiler=[MPWStCompiler compiler];
347+
STCompiler *compiler=[STCompiler compiler];
348348
MPWMethodStore *store=[compiler methodStore];
349349
EXPECTNIL(NSClassFromString(@"MPWMethodWriterTestClassWithIVars3"), @"class not defined");
350350
[compiler evaluateScriptString:@"class MPWMethodWriterTestClass3 : NSObject { -answer { 42. } }. "];

Diff for: Classes/MPWScriptedMethod.m

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#import "MPWScriptedMethod.h"
1010
#import "MPWEvaluator.h"
11-
#import "MPWStCompiler.h"
11+
#import "STCompiler.h"
1212
#import "MPWMethodHeader.h"
1313
#import "MPWVarScheme.h"
1414
#import "MPWSchemeScheme.h"
@@ -68,7 +68,7 @@ -(void)setScript:newScript
6868

6969
// NSLog(@"==== freshExecutionContextForRealLocalVars ===");
7070

71-
MPWEvaluator *evaluator = [[[MPWStCompiler alloc] initWithParent:nil] autorelease];
71+
MPWEvaluator *evaluator = [[[STCompiler alloc] initWithParent:nil] autorelease];
7272
// NSLog(@"compiled-in schemes: %@",[[self compiledInExecutionContext] schemes]);
7373
MPWSchemeScheme *newSchemes=[[[self compiledInExecutionContext] schemes] copy];
7474
MPWVarScheme *newVarScheme=[MPWVarScheme store];
@@ -199,7 +199,7 @@ @implementation MPWScriptedMethod(testing)
199199

200200
+(void)testLookupOfNilVariableInMethodWorks
201201
{
202-
MPWStCompiler* compiler = [MPWStCompiler compiler];
202+
STCompiler* compiler = [STCompiler compiler];
203203
id a=[[NSObject new] autorelease];
204204
id result;
205205
[compiler addScript:@"a:=nil. b:='2'. a isNil ifTrue:[ b:='335']. b." forClass:@"NSObject" methodHeaderString:@"xxxSimpleNilTestMethod"];
@@ -209,7 +209,7 @@ +(void)testLookupOfNilVariableInMethodWorks
209209

210210
+_objectWithNestedMethodsThatThrow
211211
{
212-
MPWStCompiler* compiler = [MPWStCompiler compiler];
212+
STCompiler* compiler = [STCompiler compiler];
213213
id a=[[NSObject new] autorelease];
214214
[compiler addScript:@"self bozobozozo." forClass:@"NSObject" methodHeaderString:@"xxxSimpleMethodThatRaises"];
215215
[compiler addScript:@"self xxxSimpleMethodThatRaises." forClass:@"NSObject" methodHeaderString:@"xxxSimpleMethodThatCallsMethodThatRaises"];
@@ -265,7 +265,7 @@ +(void)testCombinedScriptedAndNativeBacktrace
265265

266266
+(void)testThisSchemeReadsObject
267267
{
268-
MPWStCompiler *compiler=[MPWStCompiler compiler];
268+
STCompiler *compiler=[STCompiler compiler];
269269
[compiler evaluateScriptString:@"extension MPWScriptedMethod { -getTheText { this:script. } }." ];
270270
MPWScriptedMethod *tester=[MPWScriptedMethod new];
271271
tester.script=@"The Answer";
@@ -275,7 +275,7 @@ +(void)testThisSchemeReadsObject
275275

276276
+(void)testThisSchemeWritesObject
277277
{
278-
MPWStCompiler *compiler=[MPWStCompiler compiler];
278+
STCompiler *compiler=[STCompiler compiler];
279279
[compiler evaluateScriptString:@"extension MPWScriptedMethod { -<void>setText:someText { this:script := someText. } }." ];
280280
MPWScriptedMethod *tester=[MPWScriptedMethod new];
281281
[tester setText:@"some script text"];

Diff for: Classes/NSObjectScripting.h

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88

99
#import <Foundation/Foundation.h>
1010

11+
12+
extern void amIHereFunc( void );
13+
1114
@class MPWInstanceVariable;
1215

13-
@interface NSObject(stScripting)
16+
@interface NSObject(smalltalkScripting)
1417
+(BOOL)createSubclassWithName:(NSString*)className instanceVariableArray:(NSArray*)vars;
1518
+(BOOL)createSubclassWithName:(NSString*)className instanceVariables:(NSString*)varsAsString;
1619
+(BOOL)createSubclassWithName:(NSString*)className;

Diff for: Classes/NSObjectScripting.m

+9-5
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,23 @@
77
//
88

99
#import "NSObjectScripting.h"
10-
10+
#import "STCompiler.h"
1111
#import "MPWMethodCallBack.h"
12-
#import "MPWStCompiler.h"
1312
#import "MPWInstanceVariable.h"
1413
#import "MPWSetAccessor.h"
15-
#import <ObjectiveSmalltalk/MPWGetAccessor.h>
1614

17-
@implementation NSObject(stScripting)
15+
16+
void amIHereFunc( void )
17+
{
18+
NSLog(@"I am here");
19+
}
20+
21+
@implementation NSObject(smalltalkScripting)
1822

1923

2024
-evaluateScript:(NSString*)scriptString
2125
{
22-
id evaluator=[[[MPWStCompiler alloc] init] autorelease];
26+
id evaluator=[[[STCompiler alloc] init] autorelease];
2327
id result;
2428
result = [evaluator evaluateScript:scriptString onObject:self];
2529
return result;

Diff for: Classes/ObjectiveSmalltalk.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
#import <ObjectiveSmalltalk/MPWSelfContainedBindingsScheme.h>
5454
#import <ObjectiveSmalltalk/MPWSetAccessor.h>
5555
#import <ObjectiveSmalltalk/MPWSpotlightScheme.h>
56-
#import <ObjectiveSmalltalk/MPWStCompiler.h>
56+
#import <ObjectiveSmalltalk/STCompiler.h>
5757
#import <ObjectiveSmalltalk/MPWTreeNodeScheme.h>
5858
#import <ObjectiveSmalltalk/MPWURLBinding.h>
5959
#import <ObjectiveSmalltalk/MPWURLSchemeResolver.h>

Diff for: Classes/STBundle.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#import <Foundation/Foundation.h>
99

1010
@protocol MPWHierarchicalStorage,MPWReferencing;
11-
@class MPWStCompiler,MPWWriteBackCache;
11+
@class STCompiler,MPWWriteBackCache;
1212

1313
NS_ASSUME_NONNULL_BEGIN
1414

@@ -20,7 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
2020
-(id <MPWHierarchicalStorage>)sourceDir;
2121
-(NSArray<NSString*>*)sourceNames;
2222
-(NSDictionary*)info;
23-
-(MPWStCompiler*)interpreter;
23+
-(STCompiler*)interpreter;
2424
-(NSDictionary*)methodDict;
2525
-(id <MPWReferencing>)resourceRef;
2626
-(MPWWriteBackCache*)cachedResources;

0 commit comments

Comments
 (0)