diff options
-rw-r--r-- | MLKDoubleFloat.h | 1 | ||||
-rw-r--r-- | MLKInteger.h | 1 | ||||
-rw-r--r-- | MLKInteger.m | 11 | ||||
-rw-r--r-- | MLKRatio.h | 1 | ||||
-rw-r--r-- | MLKRatio.m | 11 | ||||
-rw-r--r-- | MLKSingleFloat.h | 1 | ||||
-rw-r--r-- | MLKSingleFloat.m | 5 |
7 files changed, 31 insertions, 0 deletions
diff --git a/MLKDoubleFloat.h b/MLKDoubleFloat.h index d7dbcd5..ce27ebd 100644 --- a/MLKDoubleFloat.h +++ b/MLKDoubleFloat.h @@ -50,4 +50,5 @@ -(MLKFloat *) divideBy:(MLKFloat *)arg; -(NSString *) description; +-(NSString *) descriptionForLisp; @end diff --git a/MLKInteger.h b/MLKInteger.h index c651bab..f3c8d4f 100644 --- a/MLKInteger.h +++ b/MLKInteger.h @@ -51,6 +51,7 @@ -(NSString *) description; -(NSString *) descriptionWithBase:(int)base; +-(NSString *) descriptionForLisp; -(void) dealloc; @end diff --git a/MLKInteger.m b/MLKInteger.m index c7ecc48..03e56b3 100644 --- a/MLKInteger.m +++ b/MLKInteger.m @@ -16,7 +16,9 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#import "MLKDynamicContext.h" #import "MLKInteger.h" +#import "MLKPackage.h" #import "runtime-compatibility.h" #import "util.h" @@ -101,6 +103,15 @@ DEFINE_MPZ_TWOARG_OPERATION (divideBy:, mpz_div) return str; } +-(NSString *) descriptionForLisp +{ + MLKInteger *base = [[MLKDynamicContext currentContext] + valueForBinding:[[MLKPackage + findPackage:@"COMMON-LISP"] + intern:@"*PRINT-BASE*"]]; + return [self descriptionWithBase:[base intValue]]; +} + -(void) dealloc { mpz_clear (value); @@ -49,6 +49,7 @@ -(NSString *) description; -(NSString *) descriptionWithBase:(int)base; +-(NSString *) descriptionForLisp; -(void) dealloc; @end @@ -16,6 +16,8 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#import "MLKDynamicContext.h" +#import "MLKPackage.h" #import "MLKRatio.h" #import "runtime-compatibility.h" #import "util.h" @@ -104,6 +106,15 @@ DEFINE_MPQ_TWOARG_OPERATION (divideBy:, mpq_div) return str; } +-(NSString *) descriptionForLisp +{ + MLKInteger *base = [[MLKDynamicContext currentContext] + valueForBinding:[[MLKPackage + findPackage:@"COMMON-LISP"] + intern:@"*PRINT-BASE*"]]; + return [self descriptionWithBase:[base intValue]]; +} + -(void) dealloc { mpq_clear (value); diff --git a/MLKSingleFloat.h b/MLKSingleFloat.h index 138c188..0dbec17 100644 --- a/MLKSingleFloat.h +++ b/MLKSingleFloat.h @@ -47,4 +47,5 @@ -(MLKFloat *) divideBy:(MLKFloat *)arg; -(NSString *) description; +-(NSString *) descriptionForLisp; @end diff --git a/MLKSingleFloat.m b/MLKSingleFloat.m index 20d92ed..c10ccce 100644 --- a/MLKSingleFloat.m +++ b/MLKSingleFloat.m @@ -144,4 +144,9 @@ return [NSString stringWithFormat:@"%@s0",str]; } + +-(NSString *) descriptionForLisp +{ + return [self description]; +} @end |