1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-03-22 23:04:12 -07:00

Renaming protocolinst to inst and protocolclass to instclass to make naming consistent with other classes.

Copied from Perforce
 Change: 190822
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Richard Brooksby 2016-04-08 09:35:14 +01:00
parent 19adf3ec16
commit 09e73dd1da
12 changed files with 72 additions and 69 deletions

View file

@ -79,7 +79,7 @@ typedef ArenaClassStruct AbstractArenaClassStruct;
DEFINE_CLASS(AbstractArenaClass, class)
{
INHERIT_CLASS(&class->protocol, AbstractArenaClass, ProtocolClass);
INHERIT_CLASS(&class->protocol, AbstractArenaClass, InstClass);
class->size = 0;
class->varargs = ArgTrivVarargs;
class->init = NULL;
@ -101,7 +101,7 @@ DEFINE_CLASS(AbstractArenaClass, class)
Bool ArenaClassCheck(ArenaClass class)
{
CHECKD(ProtocolClass, &class->protocol);
CHECKD(InstClass, &class->protocol);
CHECKL(class->size >= sizeof(ArenaStruct));
CHECKL(FUNCHECK(class->varargs));
CHECKL(FUNCHECK(class->init));

View file

@ -1171,7 +1171,7 @@ static Res bufferTrivDescribe(Buffer buffer, mps_lib_FILE *stream, Count depth)
Bool BufferClassCheck(BufferClass class)
{
CHECKD(ProtocolClass, &class->protocol);
CHECKD(InstClass, &class->protocol);
CHECKL(class->size >= sizeof(BufferStruct));
CHECKL(FUNCHECK(class->varargs));
CHECKL(FUNCHECK(class->init));
@ -1194,7 +1194,7 @@ Bool BufferClassCheck(BufferClass class)
DEFINE_CLASS(BufferClass, class)
{
INHERIT_CLASS(&class->protocol, BufferClass, ProtocolClass);
INHERIT_CLASS(&class->protocol, BufferClass, InstClass);
class->size = sizeof(BufferStruct);
class->varargs = ArgTrivVarargs;
class->init = bufferTrivInit;

View file

@ -60,7 +60,7 @@
#define ASSERT_TYPECHECK(type, val) \
ASSERT(ASSERT_ISTYPE(type, val), "TypeCheck " #type ": " #val)
#define ASSERT_ISCLASS(class, val) (class ## Check(CouldBeA(ProtocolInst, val)))
#define ASSERT_ISCLASS(class, val) (class ## Check(CouldBeA(Inst, val)))
#define ASSERT_CLASSCHECK(class, val) \
ASSERT(ASSERT_ISCLASS(class, val), "ClassCheck " #class ": " #val)

View file

@ -447,7 +447,7 @@ Bool LandFlush(Land dest, Land src)
Bool LandClassCheck(LandClass class)
{
CHECKL(ProtocolClassCheck(&class->protocol));
CHECKL(InstClassCheck(&class->protocol));
CHECKL(class->size >= sizeof(LandStruct));
CHECKL(FUNCHECK(class->init));
CHECKL(FUNCHECK(class->finish));
@ -576,7 +576,7 @@ static Res landTrivDescribe(Land land, mps_lib_FILE *stream, Count depth)
DEFINE_CLASS(LandClass, class)
{
INHERIT_CLASS(&class->protocol, LandClass, ProtocolClass);
INHERIT_CLASS(&class->protocol, LandClass, InstClass);
class->size = sizeof(LandStruct);
class->init = landTrivInit;
class->sizeMethod = landNoSize;

View file

@ -292,7 +292,7 @@ extern Size PoolNoSize(Pool pool);
#define ClassOfPool(pool) ((pool)->class)
#define SuperclassOfPool(pool) \
((PoolClass)ProtocolClassSuperclassPoly((pool)->class))
((PoolClass)InstClassSuperclassPoly((pool)->class))
/* Abstract Pool Classes Interface -- see <code/poolabs.c> */

View file

@ -49,7 +49,7 @@
#define PoolClassSig ((Sig)0x519C7A55) /* SIGnature pool CLASS */
typedef struct mps_pool_class_s {
ProtocolClassStruct protocol;
InstClassStruct protocol;
size_t size; /* size of outer structure */
Attr attr; /* attributes */
PoolVarargsMethod varargs; /* convert deprecated varargs into keywords */
@ -219,7 +219,7 @@ typedef struct mps_message_s {
#define SegClassSig ((Sig)0x5195E9C7) /* SIGnature SEG CLass */
typedef struct SegClassStruct {
ProtocolClassStruct protocol;
InstClassStruct protocol;
size_t size; /* size of outer structure */
SegInitMethod init; /* initialize the segment */
SegFinishMethod finish; /* finish the segment */
@ -306,7 +306,7 @@ typedef struct LocusPrefStruct { /* locus placement preferences */
#define BufferClassSig ((Sig)0x519B0FC7) /* SIGnature BUFfer CLass */
typedef struct BufferClassStruct {
ProtocolClassStruct protocol;
InstClassStruct protocol;
size_t size; /* size of outer structure */
BufferVarargsMethod varargs; /* parse obsolete varargs */
BufferInitMethod init; /* initialize the buffer */
@ -497,7 +497,7 @@ typedef struct TraceStruct {
#define ArenaClassSig ((Sig)0x519A6C1A) /* SIGnature ARena CLAss */
typedef struct mps_arena_class_s {
ProtocolClassStruct protocol;
InstClassStruct protocol;
size_t size; /* size of outer structure */
ArenaVarargsMethod varargs;
ArenaInitMethod init;
@ -574,7 +574,7 @@ typedef struct GlobalsStruct {
#define LandClassSig ((Sig)0x5197A4DC) /* SIGnature LAND Class */
typedef struct LandClassStruct {
ProtocolClassStruct protocol;
InstClassStruct protocol;
size_t size; /* size of outer structure */
LandSizeMethod sizeMethod; /* total size of ranges in land */
LandInitMethod init; /* initialize the land */

View file

@ -37,7 +37,7 @@ SRCID(pool, "$Id$");
Bool PoolClassCheck(PoolClass class)
{
CHECKD(ProtocolClass, &class->protocol);
CHECKD(InstClass, &class->protocol);
CHECKL(class->size >= sizeof(PoolStruct));
CHECKL(AttrCheck(class->attr));
CHECKL(!(class->attr & AttrMOVINGGC) || (class->attr & AttrGC));

View file

@ -113,7 +113,7 @@ void PoolClassMixInCollect(PoolClass class)
DEFINE_CLASS(AbstractPoolClass, class)
{
INHERIT_CLASS(&class->protocol, AbstractPoolClass, ProtocolClass);
INHERIT_CLASS(&class->protocol, AbstractPoolClass, InstClass);
class->size = 0;
class->attr = 0;
class->varargs = ArgTrivVarargs;

View file

@ -11,25 +11,25 @@
SRCID(protocol, "$Id$");
/* ProtocolClassCheck -- check a protocol class */
/* InstClassCheck -- check a protocol class */
Bool ProtocolClassCheck(ProtocolClass class)
Bool InstClassCheck(InstClass class)
{
CHECKS(ProtocolClass, class);
CHECKS(InstClass, class);
CHECKL(class->name != NULL);
CHECKL(class->typeId >= ProtocolPrime[0]);
CHECKL(class->typeId % class->superclass->typeId == 0);
CHECKU(ProtocolClass, class->superclass);
CHECKU(InstClass, class->superclass);
return TRUE;
}
/* ProtocolInstCheck -- check a protocol instance */
/* InstCheck -- check a protocol instance */
Bool ProtocolInstCheck(ProtocolInst inst)
Bool InstCheck(Inst inst)
{
CHECKS(ProtocolInst, inst);
CHECKD(ProtocolClass, inst->class);
CHECKS(Inst, inst);
CHECKD(InstClass, inst->class);
return TRUE;
}
@ -45,7 +45,7 @@ Bool ProtocolInstCheck(ProtocolInst inst)
* <http://www.stroustrup.com/fast_dynamic_casting.pdf>.
*/
Bool ProtocolIsSubclass(ProtocolClass sub, ProtocolClass super)
Bool ProtocolIsSubclass(InstClass sub, InstClass super)
{
return sub == super || sub->typeId % super->typeId == 0;
}
@ -53,13 +53,13 @@ Bool ProtocolIsSubclass(ProtocolClass sub, ProtocolClass super)
/* The class definition for the root of the hierarchy */
DEFINE_CLASS(ProtocolClass, theClass)
DEFINE_CLASS(InstClass, theClass)
{
theClass->sig = ProtocolClassSig;
theClass->name = "ProtocolInst";
theClass->sig = InstClassSig;
theClass->name = "Inst";
theClass->superclass = theClass;
theClass->typeId = ProtocolPrime[ProtocolClassIndexProtocolClass];
AVERT(ProtocolClass, theClass);
theClass->typeId = ProtocolPrime[InstClassIndexProtocolClass];
AVERT(InstClass, theClass);
}

View file

@ -14,8 +14,11 @@
#include "classdef.h"
/* Name derivation macros. These are not intended to be used */
/* outside of this file */
/* DERIVE_* -- name derivation macros.
*
* These turn the base identifier of a class into other identifiers.
* These are not intended to be used outside of this file.
*/
#define DERIVE_LOCAL(name) protocol ## name
#define DERIVE_STRUCT(name) name ## Struct
@ -32,7 +35,7 @@
extern void DERIVE_INIT(className)(classKind var)
/* DEFINE_CLASS -- the standard macro for defining a ProtocolClass */
/* DEFINE_CLASS -- the standard macro for defining a InstClass */
#define DEFINE_CLASS(className, var) \
DECLARE_CLASS(className, className); \
@ -65,20 +68,20 @@
extern unsigned ProtocolPrime[1000];
#define CLASS_INDEX_ENUM(prefix, ident, kind, super) prefix ## ident ## Class,
typedef enum ProtocolClassIndexEnum {
ProtocolClassIndexInvalid, /* index zero (prime 2) reserved for invalid classes */
CLASSES(CLASS_INDEX_ENUM, ProtocolClassIndex)
ProtocolClassIndexLIMIT
} ProtocolClassIndexEnum;
typedef enum InstClassIndexEnum {
InstClassIndexInvalid, /* index zero (prime 2) reserved for invalid classes */
CLASSES(CLASS_INDEX_ENUM, InstClassIndex)
InstClassIndexLIMIT
} InstClassIndexEnum;
#define INHERIT_CLASS(this, _class, super) \
BEGIN \
ProtocolClass protocolClass = (ProtocolClass)(this); \
InstClass protocolClass = (InstClass)(this); \
DERIVE_INIT(super)(this); \
protocolClass->superclass = (ProtocolClass)CLASS(super); \
protocolClass->superclass = (InstClass)CLASS(super); \
protocolClass->name = #_class; \
protocolClass->typeId = \
ProtocolPrime[ProtocolClassIndex ## _class] * \
ProtocolPrime[InstClassIndex ## _class] * \
protocolClass->superclass->typeId; \
END
@ -96,43 +99,43 @@ typedef enum ProtocolClassIndexEnum {
#define ProtocolClassSig ((Sig)0x519B60C7) /* SIGnature PROtocol CLass */
#define ProtocolInstSig ((Sig)0x519B6014) /* SIGnature PROtocol INst */
#define InstClassSig ((Sig)0x519B60C7) /* SIGnature PROtocol CLass */
#define InstSig ((Sig)0x519B6014) /* SIGnature PROtocol INst */
/* ProtocolInst -- the instance structure for support of the protocol */
/* Inst -- the instance structure for support of the protocol */
typedef struct ProtocolInstStruct *ProtocolInst;
typedef struct ProtocolClassStruct *ProtocolClass;
typedef struct InstStruct *Inst;
typedef struct InstClassStruct *InstClass;
typedef struct ProtocolInstStruct {
typedef struct InstStruct {
Sig sig; /* <design/sig/> */
ProtocolClass class;
} ProtocolInstStruct;
InstClass class;
} InstStruct;
/* ProtocolClass -- the class containing the support for the protocol */
/* InstClass -- the class containing the support for the protocol */
typedef const char *ProtocolClassName;
typedef const char *InstClassName;
typedef unsigned long ProtocolTypeId;
typedef struct ProtocolClassStruct {
typedef struct InstClassStruct {
Sig sig; /* <design/sig/> */
ProtocolClassName name;
ProtocolClass superclass;
InstClassName name;
InstClass superclass;
ProtocolTypeId typeId;
} ProtocolClassStruct;
} InstClassStruct;
/* ProtocolClass -- the root of the protocol class hierarchy */
/* InstClass -- the root of the protocol class hierarchy */
DECLARE_CLASS(ProtocolClass, ProtocolClass);
DECLARE_CLASS(InstClass, InstClass);
/* Checking functions */
extern Bool ProtocolClassCheck(ProtocolClass class);
extern Bool ProtocolInstCheck(ProtocolInst pro);
extern Bool InstClassCheck(InstClass class);
extern Bool InstCheck(Inst pro);
/* ProtocolIsSubclass - use macro IsSubclass to access this.
@ -141,33 +144,33 @@ extern Bool ProtocolInstCheck(ProtocolInst pro);
* is always a subclass of itself.
*/
extern Bool ProtocolIsSubclass(ProtocolClass sub, ProtocolClass super);
extern Bool ProtocolIsSubclass(InstClass sub, InstClass super);
/* Protocol introspection interface */
/* The following are macros because of the need to cast */
/* subtypes of ProtocolClass. Nevertheless they are named */
/* subtypes of InstClass. Nevertheless they are named */
/* as functions. See <design/protocol/#introspect.c-lang> */
#define ProtocolClassSuperclassPoly(class) \
(((ProtocolClass)(class))->superclass)
#define InstClassSuperclassPoly(class) \
(((InstClass)(class))->superclass)
#define ClassOfPoly(inst) ((ProtocolInst)(inst)->class)
#define ClassOfPoly(inst) ((Inst)(inst)->class)
#define IsSubclassPoly(sub, super) \
ProtocolIsSubclass((ProtocolClass)(sub), (ProtocolClass)(super))
ProtocolIsSubclass((InstClass)(sub), (InstClass)(super))
/* SUPERCLASS - get the superclass object, given a class name
*
* Returns the superclass, with type ProtocolClass. Clients will
* Returns the superclass, with type InstClass. Clients will
* probably wish to cast this. See
* <design/protocol/#int.static-superclass>
*/
#define SUPERCLASS(className) \
ProtocolClassSuperclassPoly(DERIVE_ENSURE(className)())
InstClassSuperclassPoly(DERIVE_ENSURE(className)())
#endif /* protocol_h */

View file

@ -1608,7 +1608,7 @@ static Res gcSegDescribe(Seg seg, mps_lib_FILE *stream, Count depth)
Bool SegClassCheck(SegClass class)
{
CHECKD(ProtocolClass, &class->protocol);
CHECKD(InstClass, &class->protocol);
CHECKL(class->size >= sizeof(SegStruct));
CHECKL(FUNCHECK(class->init));
CHECKL(FUNCHECK(class->finish));
@ -1628,7 +1628,7 @@ Bool SegClassCheck(SegClass class)
DEFINE_CLASS(SegClass, class)
{
INHERIT_CLASS(&class->protocol, SegClass, ProtocolClass);
INHERIT_CLASS(&class->protocol, SegClass, InstClass);
class->size = sizeof(SegStruct);
class->init = segTrivInit;
class->finish = segTrivFinish;

View file

@ -723,7 +723,7 @@ void ArenaExposeRemember(Globals globals, Bool remember)
do {
base = SegBase(seg);
if(IsSubclassPoly(ClassOfSeg(seg), CLASS(GCSegClass))) {
if (IsSubclassPoly(ClassOfSeg(seg), CLASS(GCSegClass))) {
if(remember) {
RefSet summary;