From ac3c67818eaaf7e72e039bff93e4226f086b07e8 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 26 Jul 2008 14:48:12 +0200 Subject: Add OBJC-CLASS-OF, OBJC-SUBCLASSP, FIND-OBJC-CLASS, and NS-LOG. --- MLKRoot.m | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'MLKRoot.m') diff --git a/MLKRoot.m b/MLKRoot.m index f6ee730..dc2560d 100644 --- a/MLKRoot.m +++ b/MLKRoot.m @@ -409,4 +409,27 @@ static id truify (BOOL value) RETURN_VALUE ([cl intern:@"T"]); } + ++(NSArray *) objc_class_of:(NSArray *)args +{ + RETURN_VALUE ([[args objectAtIndex:0] class]); +} + ++(NSArray *) objc_subclassp:(NSArray *)args +{ + RETURN_VALUE (truify ([[args objectAtIndex:0] isSubclassOfClass: + [args objectAtIndex:1]])); +} + ++(NSArray *) find_objc_class:(NSArray *)args +{ + RETURN_VALUE (NSClassFromString ([args objectAtIndex:0])); +} + ++(NSArray *) ns_log:(NSArray *)args +{ + NSString *description = [[args objectAtIndex:0] descriptionForLisp]; + NSLog (@"%@", description); + RETURN_VALUE ([args objectAtIndex:0]); +} @end -- cgit v1.2.3 From 0f7abae8b9525d60685ae3b9ecc2fb4131c766a4 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sat, 26 Jul 2008 19:23:28 +0200 Subject: Reader: Support quasiquotation. --- MLKRoot.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'MLKRoot.m') diff --git a/MLKRoot.m b/MLKRoot.m index dc2560d..d007173 100644 --- a/MLKRoot.m +++ b/MLKRoot.m @@ -225,10 +225,12 @@ static id truify (BOOL value) +(NSArray *) macroexpand_1:(NSArray *)args { id form = [args objectAtIndex:0]; - id env = [args count] > 1 ? [args objectAtIndex:1] : nil; + id env = [args count] > 1 ? denullify([args objectAtIndex:1]) : nil; MLKLexicalContext *context = env ? (id)env : (id)[MLKLexicalContext globalContext]; - if ([context symbolNamesMacro:[form car]]) + if ([form isKindOfClass:[MLKCons class]] + && (![form car] || [[form car] isKindOfClass:[MLKSymbol class]]) + && [context symbolNamesMacro:[form car]]) { id macrofun = [context macroForSymbol:[form car]]; form = denullify ([[macrofun applyToArray: -- cgit v1.2.3