mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-15 16:20:17 +02:00
Some GOOPS cleanup.
This commit is contained in:
parent
b8d3f9a8ee
commit
398d8ee17e
5 changed files with 363 additions and 325 deletions
|
@ -1,3 +1,40 @@
|
||||||
|
2000-12-16 Keisuke Nishida <kxn30@po.cwru.edu>
|
||||||
|
|
||||||
|
* validate.h (SCM_WRONG_NUM_ARGS): New macro.
|
||||||
|
* goops.h: #include "libguile/validate.h"
|
||||||
|
(SCM_CLASSP, SCM_GENERICP, SCM_METHODP): Moved from goops.c with
|
||||||
|
prefix "SCM_".
|
||||||
|
(SCM_VALIDATE_INSTANCE, SCM_VALIDATE_ACCESSOR, SCM_VALIDATE_CLASS,
|
||||||
|
SCM_VALIDATE_GENERIC, SCM_VALIDATE_METHOD): New macros.
|
||||||
|
* goops.c (CLASSP, GENERICP, METHODP): Moved to goops.h with
|
||||||
|
prefix "SCM_".
|
||||||
|
(scm_sys_compute_slots, scm_sys_initialize_object,
|
||||||
|
scm_sys_prep_layout_x, s_sys_inherit_magic_x, scm_instance_p,
|
||||||
|
scm_class_name, scm_class_direct_supers, scm_class_direct_slots,
|
||||||
|
scm_class_direct_subclasses, scm_class_direct_methods,
|
||||||
|
scm_class_precedence_list, scm_class_slots, scm_class_environment,
|
||||||
|
scm_generic_function_name, scm_generic_function_methods,
|
||||||
|
scm_method_generic_function, scm_method_specializers,
|
||||||
|
scm_method_procedure, scm_accessor_method_slot_definition,
|
||||||
|
scm_make_unbound, scm_unbound_p, scm_assert_bound,
|
||||||
|
scm_at_assert_bound_ref, scm_sys_fast_slot_ref,
|
||||||
|
scm_sys_fast_slot_set_x, scm_slot_ref_using_class,
|
||||||
|
scm_slot_set_using_class_x, scm_slot_bound_using_class_p,
|
||||||
|
scm_slot_exists_using_class_p, scm_slot_ref, scm_slot_set_x,
|
||||||
|
scm_slot_bound_p, scm_slots_exists_p, scm_sys_allocate_instance,
|
||||||
|
scm_sys_set_object_setter_x, scm_sys_modify_instance,
|
||||||
|
scm_sys_modify_class, scm_sys_invalidate_class,
|
||||||
|
scm_sys_invalidate_method_cache_x, scm_generic_capability_p,
|
||||||
|
scm_enable_primitive_generic_x, scm_primitive_generic_generic,
|
||||||
|
scm_make, scm_find_method, scm_sys_method_more_specific_p,
|
||||||
|
scm_pure_generic_p, scm_sys_goops_loaded): Replaced SCM_PROC by
|
||||||
|
SCM_DEFINE. Use validate macros defined above.
|
||||||
|
(scm_assert_bound, scm_at_assert_bound_ref, scm_sys_goops_loaded):
|
||||||
|
Declared as static functions.
|
||||||
|
(s_class_of, scm_class_of): Replaced SCM_PROC by SCM_DEFINE
|
||||||
|
in object.c.
|
||||||
|
* object.c (scm_class_of): Use SCM_DEFINE.
|
||||||
|
|
||||||
2000-12-16 Keisuke Nishida <kxn30@po.cwru.edu>
|
2000-12-16 Keisuke Nishida <kxn30@po.cwru.edu>
|
||||||
|
|
||||||
* symbols.h (scm_symbols_prehistory): Added prototype.
|
* symbols.h (scm_symbols_prehistory): Added prototype.
|
||||||
|
|
623
libguile/goops.c
623
libguile/goops.c
File diff suppressed because it is too large
Load diff
|
@ -53,6 +53,8 @@
|
||||||
|
|
||||||
#include "libguile/__scm.h"
|
#include "libguile/__scm.h"
|
||||||
|
|
||||||
|
#include "libguile/validate.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* scm_class_class
|
* scm_class_class
|
||||||
*/
|
*/
|
||||||
|
@ -125,10 +127,12 @@ typedef struct scm_method_t {
|
||||||
|
|
||||||
#define SCM_INSTANCEP(x) (SCM_STRUCTP (x) \
|
#define SCM_INSTANCEP(x) (SCM_STRUCTP (x) \
|
||||||
&& (SCM_INST_TYPE (x) & SCM_CLASSF_GOOPS))
|
&& (SCM_INST_TYPE (x) & SCM_CLASSF_GOOPS))
|
||||||
|
#define SCM_VALIDATE_INSTANCE(pos, x) SCM_MAKE_VALIDATE (pos, x, INSTANCEP)
|
||||||
|
|
||||||
#define SCM_PUREGENERICP(x) (SCM_INST_TYPE(x) & SCM_CLASSF_PURE_GENERIC)
|
#define SCM_PUREGENERICP(x) (SCM_INST_TYPE(x) & SCM_CLASSF_PURE_GENERIC)
|
||||||
#define SCM_SIMPLEMETHODP(x) (SCM_INST_TYPE(x) & SCM_CLASSF_SIMPLE_METHOD)
|
#define SCM_SIMPLEMETHODP(x) (SCM_INST_TYPE(x) & SCM_CLASSF_SIMPLE_METHOD)
|
||||||
#define SCM_ACCESSORP(x) (SCM_INST_TYPE(x) & SCM_CLASSF_ACCESSOR_METHOD)
|
#define SCM_ACCESSORP(x) (SCM_INST_TYPE(x) & SCM_CLASSF_ACCESSOR_METHOD)
|
||||||
|
#define SCM_VALIDATE_ACCESSOR(pos, x) SCM_MAKE_VALIDATE (pos, x, ACCESSORP)
|
||||||
#define SCM_FASTMETHODP(x) (SCM_INST_TYPE(x) \
|
#define SCM_FASTMETHODP(x) (SCM_INST_TYPE(x) \
|
||||||
& (SCM_CLASSF_ACCESSOR_METHOD \
|
& (SCM_CLASSF_ACCESSOR_METHOD \
|
||||||
| SCM_CLASSF_SIMPLE_METHOD))
|
| SCM_CLASSF_SIMPLE_METHOD))
|
||||||
|
@ -139,6 +143,16 @@ typedef struct scm_method_t {
|
||||||
&& SCM_INSTANCEP (x) \
|
&& SCM_INSTANCEP (x) \
|
||||||
&& SCM_SUBCLASSP (SCM_CLASS_OF (x), c))
|
&& SCM_SUBCLASSP (SCM_CLASS_OF (x), c))
|
||||||
|
|
||||||
|
#define SCM_CLASSP(x) (SCM_STRUCTP (x) \
|
||||||
|
&& SCM_OBJ_CLASS_FLAGS (x) & SCM_CLASSF_METACLASS)
|
||||||
|
#define SCM_VALIDATE_CLASS(pos, x) SCM_MAKE_VALIDATE (pos, x, CLASSP)
|
||||||
|
#define SCM_GENERICP(x) (SCM_INSTANCEP (x) \
|
||||||
|
&& SCM_SUBCLASSP (SCM_CLASS_OF (x), scm_class_generic))
|
||||||
|
#define SCM_VALIDATE_GENERIC(pos, x) SCM_MAKE_VALIDATE (pos, x, GENERICP)
|
||||||
|
#define SCM_METHODP(x) (SCM_INSTANCEP (x) \
|
||||||
|
&& SCM_SUBCLASSP(SCM_CLASS_OF(x), scm_class_method))
|
||||||
|
#define SCM_VALIDATE_METHOD(pos, x) SCM_MAKE_VALIDATE (pos, x, METHODP)
|
||||||
|
|
||||||
#define SCM_MCACHE_N_SPECIALIZED(C) SCM_CADDR (C)
|
#define SCM_MCACHE_N_SPECIALIZED(C) SCM_CADDR (C)
|
||||||
#define SCM_SET_MCACHE_N_SPECIALIZED(C, X) SCM_SETCAR (SCM_CDDR (C), X)
|
#define SCM_SET_MCACHE_N_SPECIALIZED(C, X) SCM_SETCAR (SCM_CDDR (C), X)
|
||||||
|
|
||||||
|
|
|
@ -83,8 +83,10 @@ SCM *scm_smob_class = 0;
|
||||||
SCM scm_no_applicable_method;
|
SCM scm_no_applicable_method;
|
||||||
|
|
||||||
/* This function is used for efficient type dispatch. */
|
/* This function is used for efficient type dispatch. */
|
||||||
SCM
|
SCM_DEFINE (scm_class_of, "class-of", 1, 0, 0,
|
||||||
scm_class_of (SCM x)
|
(SCM x),
|
||||||
|
"")
|
||||||
|
#define FUNC_NAME s_scm_class_of
|
||||||
{
|
{
|
||||||
switch (SCM_ITAG3 (x))
|
switch (SCM_ITAG3 (x))
|
||||||
{
|
{
|
||||||
|
@ -213,6 +215,7 @@ scm_class_of (SCM x)
|
||||||
}
|
}
|
||||||
return scm_class_unknown;
|
return scm_class_unknown;
|
||||||
}
|
}
|
||||||
|
#undef FUNC_NAME
|
||||||
|
|
||||||
/* (SCM_IM_DISPATCH ARGS N-SPECIALIZED
|
/* (SCM_IM_DISPATCH ARGS N-SPECIALIZED
|
||||||
* #((TYPE1 ... ENV FORMALS FORM ...) ...)
|
* #((TYPE1 ... ENV FORMALS FORM ...) ...)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: validate.h,v 1.21 2000-12-08 17:32:56 kei Exp $ */
|
/* $Id: validate.h,v 1.22 2000-12-16 20:25:08 kei Exp $ */
|
||||||
/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
/* Copyright (C) 1999, 2000 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -63,6 +63,9 @@
|
||||||
#define SCM_MISC_ERROR(str, args) \
|
#define SCM_MISC_ERROR(str, args) \
|
||||||
do { scm_misc_error (FUNC_NAME, str, args); } while (0)
|
do { scm_misc_error (FUNC_NAME, str, args); } while (0)
|
||||||
|
|
||||||
|
#define SCM_WRONG_NUM_ARGS() \
|
||||||
|
do { scm_wrong_num_args (scm_makfrom0str (FUNC_NAME)); } while (0)
|
||||||
|
|
||||||
#define SCM_WRONG_TYPE_ARG(pos, obj) \
|
#define SCM_WRONG_TYPE_ARG(pos, obj) \
|
||||||
do { scm_wrong_type_arg (FUNC_NAME, pos, obj); } while (0)
|
do { scm_wrong_type_arg (FUNC_NAME, pos, obj); } while (0)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue