Reading Gauche/Reading Gauche 0.9/gauche.h/ScmClass


Top / Reading Gauche / Reading Gauche 0.9 / gauche.h / ScmClass

ScmClass

概要

クラス構造体。ScmClassは実際はScmObjのサブクラスです。

%% gauche.h
typedef struct ScmClassRec ScmClass;
/* See class.c for the description of function pointer members.
   There's a lot of voodoo magic in class structure, so don't touch
   those fields casually.  Also, the order of these fields must be
   reflected to the class definition macros below */
struct ScmClassRec {
   /* We need all class structures be aligned on (at least) 8-byte boundary
      to make our tagging scheme work.  Dynamically allocated objects
      are *always* 8-byte aligned due to Boehm GC's architecture.  However,
      we found that statically allocated class structures can be placed
      4-byte boundary on some 32bit systems if we started ScmClassRec
      with SCM_INSTANCE_HEADER.  The following union is the trick
      to ensure 8-byte alighment on such systems. */ 
   union {
       SCM_INSTANCE_HEADER;
       double align_dummy;
   } classHdr;

8-byte な境界整列に対応するための実装と思われます。

    ScmClassPrintProc     print;
    ScmClassCompareProc   compare;
    ScmClassSerializeProc serialize;
    ScmClassAllocateProc  allocate;
    ScmClass **cpa;             /* class precedence array, NULL terminated */
    int numInstanceSlots;       /* # of instance slots */
    int coreSize;               /* size of core structure; 0 == unknown */
    unsigned int flags;
    ScmObj name;                /* scheme name */
    ScmObj directSupers;        /* list of classes */
    ScmObj cpl;                 /* list of classes */
    ScmObj accessors;           /* alist of slot-name & slot-accessor */
    ScmObj directSlots;         /* alist of slot-name & slot-definition */
    ScmObj slots;               /* alist of slot-name & slot-definition */
    ScmObj directSubclasses;    /* list of direct subclasses */
    ScmObj directMethods;       /* list of methods that has this class in
                                   its specializer */
    ScmObj initargs;            /* saved key-value list for redefinition */
    ScmObj modules;             /* modules where this class is defined */
    ScmObj redefined;           /* if this class is obsoleted by class
                                   redefinition, points to the new class.
                                   if this class is being redefined, points
                                   to a thread that is handling the
                                   redefinition.  (it won't be seen by
                                   Scheme; see class.c)
                                   otherwise #f */
    ScmInternalMutex mutex;     /* to protect from MT hazard */
    ScmInternalCond cv;         /* wait on this while a class being updated */
    void   *data;               /* extra data to do nasty trick */
};

調べるもの

参照元

コメント

コメントはありません。 コメント/Reading Gauche/Reading Gauche 0.9/gauche.h/ScmClass?

お名前:

MENU

now: 3

リンク


最新の20件
2018-05-03 2017-09-29 2017-04-25 2017-01-10 2016-12-11 2016-10-04 2016-08-14 2016-06-05 2016-05-29 2016-04-15 2015-12-28 2013-02-25 2013-02-21 2013-02-20 2013-02-12 2013-02-11 2013-02-10
最新の20件
2010-02-01 2010-01-31 2010-01-30 2010-01-29 2010-01-16

Counter: 4043, today: 2, yesterday: 0

リロード   新規 編集 凍結 差分 添付 複製 改名   トップ 一覧 検索 最終更新 バックアップ   ヘルプ   最終更新のRSS

Last-modified: 2010-01-30 (土) 23:18:43 (3091d);  Modified by mona
PukiWiki 1.4.6 Copyright © 2001-2005 PukiWiki Developers Team. License is GPL.
Based on "PukiWiki" 1.3 by yu-ji
Powered by PHP 5.2.17
HTML convert time to 0.021 sec.