From 09e73dd1da68b9bc8a55ea45ffcdf0bb75cb2442 Mon Sep 17 00:00:00 2001 From: Richard Brooksby Date: Fri, 8 Apr 2016 09:35:14 +0100 Subject: [PATCH] Renaming protocolinst to inst and protocolclass to instclass to make naming consistent with other classes. Copied from Perforce Change: 190822 ServerID: perforce.ravenbrook.com --- mps/code/arena.c | 4 +-- mps/code/buffer.c | 4 +-- mps/code/check.h | 2 +- mps/code/land.c | 4 +-- mps/code/mpm.h | 2 +- mps/code/mpmst.h | 10 +++--- mps/code/pool.c | 2 +- mps/code/poolabs.c | 2 +- mps/code/protocol.c | 28 ++++++++--------- mps/code/protocol.h | 77 +++++++++++++++++++++++---------------------- mps/code/seg.c | 4 +-- mps/code/traceanc.c | 2 +- 12 files changed, 72 insertions(+), 69 deletions(-) diff --git a/mps/code/arena.c b/mps/code/arena.c index 18b548a16cd..9a0751c1da1 100644 --- a/mps/code/arena.c +++ b/mps/code/arena.c @@ -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)); diff --git a/mps/code/buffer.c b/mps/code/buffer.c index c887189d9a4..300eb3a511a 100644 --- a/mps/code/buffer.c +++ b/mps/code/buffer.c @@ -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; diff --git a/mps/code/check.h b/mps/code/check.h index 57ea38d01cb..0842b35b289 100644 --- a/mps/code/check.h +++ b/mps/code/check.h @@ -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) diff --git a/mps/code/land.c b/mps/code/land.c index 120f37bac61..090102f8fd6 100644 --- a/mps/code/land.c +++ b/mps/code/land.c @@ -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; diff --git a/mps/code/mpm.h b/mps/code/mpm.h index 9a653acd620..d4f1839e197 100644 --- a/mps/code/mpm.h +++ b/mps/code/mpm.h @@ -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 */ diff --git a/mps/code/mpmst.h b/mps/code/mpmst.h index dcb8a45b9d7..8092a9eca92 100644 --- a/mps/code/mpmst.h +++ b/mps/code/mpmst.h @@ -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 */ diff --git a/mps/code/pool.c b/mps/code/pool.c index 6cb29c76451..b7de56e43ad 100644 --- a/mps/code/pool.c +++ b/mps/code/pool.c @@ -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)); diff --git a/mps/code/poolabs.c b/mps/code/poolabs.c index e74c51d87f8..ecd35b151f6 100644 --- a/mps/code/poolabs.c +++ b/mps/code/poolabs.c @@ -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; diff --git a/mps/code/protocol.c b/mps/code/protocol.c index 6791fca0ec5..22dc0daf737 100644 --- a/mps/code/protocol.c +++ b/mps/code/protocol.c @@ -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) * . */ -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); } diff --git a/mps/code/protocol.h b/mps/code/protocol.h index 3e057284e80..0dcd58c5c78 100644 --- a/mps/code/protocol.h +++ b/mps/code/protocol.h @@ -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; /* */ - 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; /* */ - 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 */ -#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 * */ #define SUPERCLASS(className) \ - ProtocolClassSuperclassPoly(DERIVE_ENSURE(className)()) + InstClassSuperclassPoly(DERIVE_ENSURE(className)()) #endif /* protocol_h */ diff --git a/mps/code/seg.c b/mps/code/seg.c index 1aafb53b86d..78efe118d4a 100644 --- a/mps/code/seg.c +++ b/mps/code/seg.c @@ -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; diff --git a/mps/code/traceanc.c b/mps/code/traceanc.c index aa971a8c417..17df2fb2919 100644 --- a/mps/code/traceanc.c +++ b/mps/code/traceanc.c @@ -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;