Replacing __sum macro with Cyc_sum

This commit is contained in:
Justin Ethier 2015-04-10 14:56:47 -04:00
parent 5be68ec60c
commit 04c11eabfb
2 changed files with 5 additions and 4 deletions

View file

@ -400,7 +400,7 @@
((eq? p 'Cyc-set-cvar!) "Cyc_set_cvar") ((eq? p 'Cyc-set-cvar!) "Cyc_set_cvar")
((eq? p 'Cyc-cvar?) "Cyc_is_cvar") ((eq? p 'Cyc-cvar?) "Cyc_is_cvar")
((eq? p 'Cyc-has-cycle?) "Cyc_has_cycle") ((eq? p 'Cyc-has-cycle?) "Cyc_has_cycle")
((eq? p '+) "__sum") ((eq? p '+) "Cyc_sum")
((eq? p '-) "__sub") ((eq? p '-) "__sub")
((eq? p '*) "__mul") ((eq? p '*) "__mul")
((eq? p '/) "__div") ((eq? p '/) "__div")
@ -554,6 +554,7 @@
((eq? p 'open-input-file) "port_type") ((eq? p 'open-input-file) "port_type")
((eq? p 'length) "integer_type") ((eq? p 'length) "integer_type")
((eq? p 'char->integer) "integer_type") ((eq? p 'char->integer) "integer_type")
((eq? p '+) "common_type")
((eq? p 'string->number) "common_type") ((eq? p 'string->number) "common_type")
((eq? p 'list->string) "string_type") ((eq? p 'list->string) "string_type")
; ((eq? p 'string->list) "object") ; ((eq? p 'string->list) "object")

View file

@ -94,6 +94,7 @@ static object Cyc_is_char(object o);
static object Cyc_is_procedure(object o); static object Cyc_is_procedure(object o);
static object Cyc_is_eof_object(object o); static object Cyc_is_eof_object(object o);
static object Cyc_is_cvar(object o); static object Cyc_is_cvar(object o);
static common_type Cyc_sum(object x, object y);
static int equal(object,object); static int equal(object,object);
static list assq(object,list); static list assq(object,list);
static object get(object,object); static object get(object,object);
@ -782,7 +783,6 @@ static object __halt(object obj) {
return nil; return nil;
} }
#define __sum(c,x,y) integer_type c; c.tag = integer_tag; c.value = (((integer_type *)(x))->value + ((integer_type *)(y))->value);
#define __mul(c,x,y) integer_type c; c.tag = integer_tag; c.value = (((integer_type *)(x))->value * ((integer_type *)(y))->value); #define __mul(c,x,y) integer_type c; c.tag = integer_tag; c.value = (((integer_type *)(x))->value * ((integer_type *)(y))->value);
#define __sub(c,x,y) integer_type c; c.tag = integer_tag; c.value = (((integer_type *)(x))->value - ((integer_type *)(y))->value); #define __sub(c,x,y) integer_type c; c.tag = integer_tag; c.value = (((integer_type *)(x))->value - ((integer_type *)(y))->value);
#define __div(c,x,y) integer_type c; c.tag = integer_tag; c.value = (((integer_type *)(x))->value / ((integer_type *)(y))->value); #define __div(c,x,y) integer_type c; c.tag = integer_tag; c.value = (((integer_type *)(x))->value / ((integer_type *)(y))->value);
@ -939,8 +939,8 @@ static void _set_91cdr_67(object cont, object args) {
static void _Cyc_91has_91cycle_127(object cont, object args) { static void _Cyc_91has_91cycle_127(object cont, object args) {
return_funcall1(cont, Cyc_has_cycle(car(args))); } return_funcall1(cont, Cyc_has_cycle(car(args))); }
static void __87(object cont, object args) { static void __87(object cont, object args) {
__sum(i, car(args), cadr(args)); common_type n = Cyc_sum(car(args), cadr(args));
return_funcall1(cont, &i); } return_funcall1(cont, &n); }
static void __91(object cont, object args) { static void __91(object cont, object args) {
__sub(i, car(args), cadr(args)); __sub(i, car(args), cadr(args));
return_funcall1(cont, &i); } return_funcall1(cont, &i); }