From 26fa88efed6adff0ef5c79b918514cd5c704c84a Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Tue, 24 Jun 2008 14:30:33 +0200 Subject: Rename methods: forBinding -> forSymbol --- MLKDynamicContext.h | 8 ++++---- MLKDynamicContext.m | 24 ++++++++++++------------ MLKEnvironment.h | 12 ++++++------ MLKEnvironment.m | 18 +++++++++--------- MLKFloat.m | 2 +- MLKInteger.m | 2 +- MLKInterpreter.m | 2 +- MLKLexicalContext.m | 10 +++++----- MLKLexicalEnvironment.h | 2 +- MLKLexicalEnvironment.m | 16 ++++++++-------- MLKLowLevelTests.m | 2 +- MLKParenReader.m | 2 +- MLKRatio.m | 2 +- MLKReadEvalPrintLoop.m | 2 +- MLKReader.m | 8 ++++---- 15 files changed, 56 insertions(+), 56 deletions(-) diff --git a/MLKDynamicContext.h b/MLKDynamicContext.h index 2c58483..067dc74 100644 --- a/MLKDynamicContext.h +++ b/MLKDynamicContext.h @@ -54,10 +54,10 @@ -(id) findHandler:(MLKSymbol *)symbol; -(id) findCatchTag:(MLKSymbol *)symbol; --(id) valueForBinding:(MLKSymbol *)symbol; --(void) setValue:(id)value forBinding:(MLKSymbol *)symbol; --(void) addValue:(id)value forBinding:(MLKSymbol *)symbol; --(void) addBinding:(MLKSymbol *)symbol; +-(id) valueForSymbol:(MLKSymbol *)symbol; +-(void) setValue:(id)value forSymbol:(MLKSymbol *)symbol; +-(void) addValue:(id)value forSymbol:(MLKSymbol *)symbol; +-(void) addBindingForSymbol:(MLKSymbol *)symbol; -(BOOL) boundp:(MLKSymbol *)symbol; -(void) makunbound:(MLKSymbol *)symbol; diff --git a/MLKDynamicContext.m b/MLKDynamicContext.m index 71b5e0e..630b505 100644 --- a/MLKDynamicContext.m +++ b/MLKDynamicContext.m @@ -326,7 +326,7 @@ static MLKDynamicContext *global_context; { NS_DURING { - return [_restarts valueForBinding:symbol]; + return [_restarts valueForSymbol:symbol]; } NS_HANDLER { @@ -345,9 +345,9 @@ static MLKDynamicContext *global_context; NS_DURING { if (_activeHandlerEnvironment) - return [[_activeHandlerEnvironment parent] valueForBinding:symbol]; + return [[_activeHandlerEnvironment parent] valueForSymbol:symbol]; else - return [_conditionHandlers valueForBinding:symbol]; + return [_conditionHandlers valueForSymbol:symbol]; } NS_HANDLER { @@ -365,7 +365,7 @@ static MLKDynamicContext *global_context; { NS_DURING { - return [_catchTags valueForBinding:symbol]; + return [_catchTags valueForSymbol:symbol]; } NS_HANDLER { @@ -379,24 +379,24 @@ static MLKDynamicContext *global_context; return nil; } --(id) valueForBinding:(MLKSymbol *)symbol +-(id) valueForSymbol:(MLKSymbol *)symbol { - return [[self environment] valueForBinding:symbol]; + return [[self environment] valueForSymbol:symbol]; } --(void) setValue:(id)value forBinding:(MLKSymbol *)symbol +-(void) setValue:(id)value forSymbol:(MLKSymbol *)symbol { - [[self environment] setValue:value forBinding:symbol]; + [[self environment] setValue:value forSymbol:symbol]; } --(void) addValue:(id)value forBinding:(MLKSymbol *)symbol +-(void) addValue:(id)value forSymbol:(MLKSymbol *)symbol { - [[self environment] addValue:value forBinding:symbol]; + [[self environment] addValue:value forSymbol:symbol]; } --(void) addBinding:(MLKSymbol *)symbol +-(void) addBindingForSymbol:(MLKSymbol *)symbol { - [[self environment] addBinding:symbol]; + [[self environment] addBindingForSymbol:symbol]; } -(BOOL) boundp:(MLKSymbol *)symbol diff --git a/MLKEnvironment.h b/MLKEnvironment.h index 31cb17b..ef357f6 100644 --- a/MLKEnvironment.h +++ b/MLKEnvironment.h @@ -37,17 +37,17 @@ -(MLKEnvironment *) parent; -(NSSet *) bindings; --(void) addBinding:(MLKSymbol *)symbol; +-(void) addBindingForSymbol:(MLKSymbol *)symbol; -(void) addBindings:(NSDictionary *)bindings; --(void) addValue:(id)value forBinding:(MLKSymbol *)symbol; --(void) setValue:(id)value forBinding:(MLKSymbol *)symbol; --(id) valueForBinding:(MLKSymbol *)symbol; +-(void) addValue:(id)value forSymbol:(MLKSymbol *)symbol; +-(void) setValue:(id)value forSymbol:(MLKSymbol *)symbol; +-(id) valueForSymbol:(MLKSymbol *)symbol; --(MLKEnvironment *) environmentForBinding:(MLKSymbol *)symbol; +-(MLKEnvironment *) environmentForSymbol:(MLKSymbol *)symbol; // Private methods. -(void) setBinding:(MLKSymbol *)symbol to:(id)value inEnvironment:(MLKEnvironment *)env; --(id) valueForBinding:(MLKSymbol *)symbol inEnvironment:(MLKEnvironment *)env; +-(id) valueForSymbol:(MLKSymbol *)symbol inEnvironment:(MLKEnvironment *)env; -(BOOL) boundp:(MLKSymbol *)symbol; -(void) makunbound:(MLKSymbol *)symbol; diff --git a/MLKEnvironment.m b/MLKEnvironment.m index 581c462..73ea749 100644 --- a/MLKEnvironment.m +++ b/MLKEnvironment.m @@ -72,7 +72,7 @@ static id UNBOUND; : (id)set); } --(void) setValue:(id)value forBinding:(MLKSymbol *)symbol; +-(void) setValue:(id)value forSymbol:(MLKSymbol *)symbol; { [self setBinding:(symbol ? (id)symbol : (id)[NSNull null]) to:value @@ -93,13 +93,13 @@ static id UNBOUND; raise]; } --(id) valueForBinding:(MLKSymbol *)symbol +-(id) valueForSymbol:(MLKSymbol *)symbol { - return [self valueForBinding:(symbol ? (id)symbol : (id)[NSNull null]) + return [self valueForSymbol:(symbol ? (id)symbol : (id)[NSNull null]) inEnvironment:self]; } --(id) valueForBinding:(MLKSymbol *)symbol inEnvironment:(MLKEnvironment *)env +-(id) valueForSymbol:(MLKSymbol *)symbol inEnvironment:(MLKEnvironment *)env { id value; if ((value = [_bindings objectForKey:symbol])) @@ -115,7 +115,7 @@ static id UNBOUND; } else if (_parent) - return [_parent valueForBinding:symbol]; + return [_parent valueForSymbol:symbol]; else [[[MLKUndefinedVariableException alloc] initWithEnvironment:env variableName:symbol] @@ -129,23 +129,23 @@ static id UNBOUND; [_bindings addEntriesFromDictionary:bindings]; } --(void) addValue:(id)value forBinding:(MLKSymbol *)symbol; +-(void) addValue:(id)value forSymbol:(MLKSymbol *)symbol; { value = value ? value : (id) [NSNull null]; [_bindings setObject:value forKey:symbol]; } --(void) addBinding:(MLKSymbol *)symbol +-(void) addBindingForSymbol:(MLKSymbol *)symbol { [_bindings setObject:UNBOUND forKey:(symbol ? (id)symbol : (id)[NSNull null])]; } --(MLKEnvironment *) environmentForBinding:(MLKSymbol *)symbol +-(MLKEnvironment *) environmentForSymbol:(MLKSymbol *)symbol { if ([_bindings objectForKey:symbol]) return self; else if (_parent) - return [_parent environmentForBinding:symbol]; + return [_parent environmentForSymbol:symbol]; else return nil; } diff --git a/MLKFloat.m b/MLKFloat.m index 77e824a..898ef2f 100644 --- a/MLKFloat.m +++ b/MLKFloat.m @@ -38,7 +38,7 @@ cl = [MLKPackage findPackage:@"COMMON-LISP"]; defaultFormat = [[MLKDynamicContext currentContext] - valueForBinding:[cl intern:@"*READ-DEFAULT-FLOAT-FORMAT*"]]; + valueForSymbol:[cl intern:@"*READ-DEFAULT-FLOAT-FORMAT*"]]; // FIXME: Shouldn't the readtable decide which exponent markers do what? if (exponentMarker == 'd' || exponentMarker == 'D' diff --git a/MLKInteger.m b/MLKInteger.m index 03e56b3..8823aa6 100644 --- a/MLKInteger.m +++ b/MLKInteger.m @@ -106,7 +106,7 @@ DEFINE_MPZ_TWOARG_OPERATION (divideBy:, mpz_div) -(NSString *) descriptionForLisp { MLKInteger *base = [[MLKDynamicContext currentContext] - valueForBinding:[[MLKPackage + valueForSymbol:[[MLKPackage findPackage:@"COMMON-LISP"] intern:@"*PRINT-BASE*"]]; return [self descriptionWithBase:[base intValue]]; diff --git a/MLKInterpreter.m b/MLKInterpreter.m index a8b94ee..727ecf3 100644 --- a/MLKInterpreter.m +++ b/MLKInterpreter.m @@ -102,7 +102,7 @@ static MLKSymbol *_DEFMACRO; else { //NSLog (@"Processing special variable."); - return [dynamicContext valueForBinding:program]; + return [dynamicContext valueForSymbol:program]; } } else if (![program isKindOfClass:[MLKCons class]]) diff --git a/MLKLexicalContext.m b/MLKLexicalContext.m index 82c7ae7..5b664f4 100644 --- a/MLKLexicalContext.m +++ b/MLKLexicalContext.m @@ -123,27 +123,27 @@ static MLKSymbol *LEXICAL; -(id) macroForSymbol:(MLKSymbol *)symbol { - return [_macros valueForBinding:symbol]; + return [_macros valueForSymbol:symbol]; } -(void) setMacro:(MLKFuncallable *)value forSymbol:(MLKSymbol *)symbol { - [_symbolMacros setValue:value forBinding:symbol]; + [_symbolMacros setValue:value forSymbol:symbol]; } -(id) symbolMacroForSymbol:(MLKSymbol *)symbol { - return [_symbolMacros valueForBinding:symbol]; + return [_symbolMacros valueForSymbol:symbol]; } -(void) setSymbolMacro:(MLKFuncallable *)value forSymbol:(MLKSymbol *)symbol { - [_symbolMacros setValue:value forBinding:symbol]; + [_symbolMacros setValue:value forSymbol:symbol]; } -(id) goTagForSymbol:(MLKSymbol *)symbol { - return [_goTags valueForBinding:symbol]; + return [_goTags valueForSymbol:symbol]; } -(BOOL) symbolNamesFunction:(MLKSymbol *)symbol diff --git a/MLKLexicalEnvironment.h b/MLKLexicalEnvironment.h index d7ce0a8..b8efed3 100644 --- a/MLKLexicalEnvironment.h +++ b/MLKLexicalEnvironment.h @@ -43,7 +43,7 @@ -(id) valueForSymbol:(MLKSymbol *)symbol; -(void) setValue:(id)value forSymbol:(MLKSymbol *)symbol; -(void) addValue:(id)value forSymbol:(MLKSymbol *)symbol; --(void) addBinding:(MLKSymbol *)symbol; +-(void) addBindingForSymbol:(MLKSymbol *)symbol; -(id) functionForSymbol:(MLKSymbol *)symbol; -(void) setFunction:(id)value forSymbol:(MLKSymbol *)symbol; diff --git a/MLKLexicalEnvironment.m b/MLKLexicalEnvironment.m index 07c6f92..62ff1d7 100644 --- a/MLKLexicalEnvironment.m +++ b/MLKLexicalEnvironment.m @@ -94,22 +94,22 @@ static MLKLexicalEnvironment *global_environment; -(id) valueForSymbol:(MLKSymbol *)symbol { - return [_variables valueForBinding:symbol]; + return [_variables valueForSymbol:symbol]; } -(void) setValue:(id)value forSymbol:(MLKSymbol *)symbol { - [_variables setValue:value forBinding:symbol]; + [_variables setValue:value forSymbol:symbol]; } -(void) addValue:(id)value forSymbol:(MLKSymbol *)symbol { - [_variables addValue:value forBinding:symbol]; + [_variables addValue:value forSymbol:symbol]; } --(void) addBinding:(MLKSymbol *)symbol +-(void) addBindingForSymbol:(MLKSymbol *)symbol { - [_variables addBinding:symbol]; + [_variables addBindingForSymbol:symbol]; } -(BOOL) boundp:(MLKSymbol *)symbol @@ -124,17 +124,17 @@ static MLKLexicalEnvironment *global_environment; -(id) functionForSymbol:(MLKSymbol *)symbol { - return [_functions valueForBinding:symbol]; + return [_functions valueForSymbol:symbol]; } -(void) setFunction:(id)value forSymbol:(MLKSymbol *)symbol { - [_functions setValue:value forBinding:symbol]; + [_functions setValue:value forSymbol:symbol]; } -(void) addFunction:(id)value forSymbol:(MLKSymbol *)symbol { - [_functions addValue:value forBinding:symbol]; + [_functions addValue:value forSymbol:symbol]; } -(BOOL) fboundp:(MLKSymbol *)symbol diff --git a/MLKLowLevelTests.m b/MLKLowLevelTests.m index 498369c..d3170fd 100644 --- a/MLKLowLevelTests.m +++ b/MLKLowLevelTests.m @@ -102,7 +102,7 @@ -(id) testInitialReadtable { MLKDynamicContext *ctx = [MLKDynamicContext currentContext]; - MLKReadtable *readtable = [ctx valueForBinding: + MLKReadtable *readtable = [ctx valueForSymbol: [[MLKPackage findPackage:@"COMMON-LISP"] intern:@"*READTABLE*"]]; UKTrue ([readtable characterHasCase:'a']); diff --git a/MLKParenReader.m b/MLKParenReader.m index 0d3fcc7..6bb6ba9 100644 --- a/MLKParenReader.m +++ b/MLKParenReader.m @@ -51,7 +51,7 @@ static unichar slurpWhitespaceAndPeek (MLKStream *stream, MLKReadtable *readtabl stream = [arguments objectAtIndex:0]; ch = [[arguments objectAtIndex:1] unicharValue]; readtable = [[MLKDynamicContext currentContext] - valueForBinding:[[MLKPackage findPackage:@"COMMON-LISP"] + valueForSymbol:[[MLKPackage findPackage:@"COMMON-LISP"] intern:@"*READTABLE*"]]; cons = nil; tail = nil; diff --git a/MLKRatio.m b/MLKRatio.m index d11ff49..a61d311 100644 --- a/MLKRatio.m +++ b/MLKRatio.m @@ -109,7 +109,7 @@ DEFINE_MPQ_TWOARG_OPERATION (divideBy:, mpq_div) -(NSString *) descriptionForLisp { MLKInteger *base = [[MLKDynamicContext currentContext] - valueForBinding:[[MLKPackage + valueForSymbol:[[MLKPackage findPackage:@"COMMON-LISP"] intern:@"*PRINT-BASE*"]]; return [self descriptionWithBase:[base intValue]]; diff --git a/MLKReadEvalPrintLoop.m b/MLKReadEvalPrintLoop.m index b5710f2..392b4ed 100644 --- a/MLKReadEvalPrintLoop.m +++ b/MLKReadEvalPrintLoop.m @@ -40,7 +40,7 @@ static char **_argv; static const char *prompt (EditLine *e) { MLKPackage *package = [[MLKDynamicContext currentContext] - valueForBinding:[[MLKPackage + valueForSymbol:[[MLKPackage findPackage:@"COMMON-LISP"] intern:@"*PACKAGE*"]]; diff --git a/MLKReader.m b/MLKReader.m index 68db172..c880a68 100644 --- a/MLKReader.m +++ b/MLKReader.m @@ -54,7 +54,7 @@ ever_escaped = NO; readtable = [[MLKDynamicContext currentContext] - valueForBinding:[[MLKPackage findPackage:@"COMMON-LISP"] + valueForSymbol:[[MLKPackage findPackage:@"COMMON-LISP"] intern:@"*READTABLE*"]]; start: @@ -236,7 +236,7 @@ int base; base = [[[MLKDynamicContext currentContext] - valueForBinding:[[MLKPackage findPackage:@"COMMON-LISP"] + valueForSymbol:[[MLKPackage findPackage:@"COMMON-LISP"] intern:@"*READ-BASE*"]] intValue]; @@ -435,7 +435,7 @@ if (packageMarker == -1) { package = [[MLKDynamicContext currentContext] - valueForBinding:[[MLKPackage + valueForSymbol:[[MLKPackage findPackage:@"COMMON-LISP"] intern:@"*PACKAGE*"]]; symbolName = token; @@ -475,7 +475,7 @@ if (packageMarker == 0) { // Make keyword symbols self-evaluate. - [[MLKDynamicContext globalContext] addValue:symbol forBinding:symbol]; + [[MLKDynamicContext globalContext] addValue:symbol forSymbol:symbol]; } return symbol; -- cgit v1.2.3