Commit c5719859 authored by Erick Gallesio's avatar Erick Gallesio

EQUAL? returns #t on structure with same types and same values now.

parent 657f1f02
......@@ -22,11 +22,12 @@
*
* Author: Erick Gallesio [eg@kaolin.unice.fr]
* Creation date: 23-Oct-1993 21:37
* Last file update: 21-Jun-2007 16:27 (eg)
* Last file update: 6-Jul-2007 17:19 (eg)
*/
#include "stklos.h"
#include "object.h"
#include "struct.h"
DEFINE_PRIMITIVE("not", not, subr1, (SCM x))
/*
......@@ -334,6 +335,10 @@ DEFINE_PRIMITIVE("equal?", equal, subr2, (SCM x, SCM y))
return res;
}
break;
case tc_struct:
if (STRUCTP(y) && (STRUCT_TYPE(x) == STRUCT_TYPE(y)))
return STk_equal(STk_struct2list(x), STk_struct2list(y));
break;
#ifdef FIXME
//EG: default:
//EG: if (EXTENDEDP(x) && EXTENDEDP(y) && TYPE(x) == TYPE(y))
......
/*
* struct.h -- Low level support for structures
*
* Copyright 2004-2006 Erick Gallesio - I3S-CNRS/ESSI <eg@essi.fr>
* Copyright 2004-2007 Erick Gallesio - I3S-CNRS/ESSI <eg@essi.fr>
*
*
* This program is free software; you can redistribute it and/or modify
......@@ -21,7 +21,7 @@
*
* Author: Erick Gallesio [eg@essi.fr]
* Creation date: 12-May-2004 17:26 (eg)
* Last file update: 20-Dec-2006 11:04 (eg)
* Last file update: 6-Jul-2007 17:17 (eg)
*/
/**** Structure types ****/
......@@ -60,6 +60,7 @@ EXTERN_PRIMITIVE("make-struct-type", make_struct_type, subr3,
EXTERN_PRIMITIVE("struct-type-slots", st_slots, subr1, (SCM obj));
EXTERN_PRIMITIVE("struct-set!", struct_set, subr3, (SCM s, SCM slot, SCM val));
EXTERN_PRIMITIVE("make-struct", make_struct, vsubr, (int argc, SCM *argv));
EXTERN_PRIMITIVE("struct->list", struct2list, subr1, (SCM s));
SCM STk_int_struct_ref(SCM s, SCM slot);
SCM STk_int_struct_set(SCM s, SCM slot, SCM val);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment