1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

Converting land describe methods to specialize instdescribe.

Copied from Perforce
 Change: 191607
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Richard Brooksby 2016-04-23 13:35:20 +01:00
parent ea53ac476e
commit ed1ecb1bf5
5 changed files with 17 additions and 15 deletions

View file

@ -1090,8 +1090,9 @@ fail:
* See <design/land/#function.describe>.
*/
static Res cbsDescribe(Land land, mps_lib_FILE *stream, Count depth)
static Res cbsDescribe(Inst inst, mps_lib_FILE *stream, Count depth)
{
Land land = CouldBeA(Land, inst);
CBS cbs = CouldBeA(CBS, land);
Res res;
Res (*describe)(Tree, mps_lib_FILE *);
@ -1101,7 +1102,7 @@ static Res cbsDescribe(Land land, mps_lib_FILE *stream, Count depth)
if (stream == NULL)
return ResPARAM;
res = NextMethod(Land, CBS, describe)(land, stream, depth);
res = NextMethod(Inst, CBS, describe)(inst, stream, depth);
if (res != ResOK)
return res;
@ -1134,6 +1135,7 @@ static Res cbsDescribe(Land land, mps_lib_FILE *stream, Count depth)
DEFINE_CLASS(Land, CBS, klass)
{
INHERIT_CLASS(klass, CBS, Land);
klass->protocol.describe = cbsDescribe;
klass->protocol.finish = cbsFinish;
klass->size = sizeof(CBSStruct);
klass->init = cbsInit;
@ -1146,7 +1148,6 @@ DEFINE_CLASS(Land, CBS, klass)
klass->findLast = cbsFindLast;
klass->findLargest = cbsFindLargest;
klass->findInZones = cbsFindInZones;
klass->describe = cbsDescribe;
}
DEFINE_CLASS(Land, CBSFast, klass)

View file

@ -241,8 +241,9 @@ static Bool failoverFindInZones(Bool *foundReturn, Range rangeReturn, Range oldR
}
static Res failoverDescribe(Land land, mps_lib_FILE *stream, Count depth)
static Res failoverDescribe(Inst inst, mps_lib_FILE *stream, Count depth)
{
Land land = CouldBeA(Land, inst);
Failover fo = CouldBeA(Failover, land);
LandClass primaryClass, secondaryClass;
Res res;
@ -252,7 +253,7 @@ static Res failoverDescribe(Land land, mps_lib_FILE *stream, Count depth)
if (stream == NULL)
return ResPARAM;
res = NextMethod(Land, Failover, describe)(land, stream, depth);
res = NextMethod(Inst, Failover, describe)(inst, stream, depth);
if (res != ResOK)
return res;
@ -273,6 +274,7 @@ static Res failoverDescribe(Land land, mps_lib_FILE *stream, Count depth)
DEFINE_CLASS(Land, Failover, klass)
{
INHERIT_CLASS(klass, Failover, Land);
klass->protocol.describe = failoverDescribe;
klass->protocol.finish = failoverFinish;
klass->size = sizeof(FailoverStruct);
klass->init = failoverInit;
@ -284,7 +286,6 @@ DEFINE_CLASS(Land, Failover, klass)
klass->findLast = failoverFindLast;
klass->findLargest = failoverFindLargest;
klass->findInZones = failoverFindInZones;
klass->describe = failoverDescribe;
}

View file

@ -746,8 +746,9 @@ static Bool freelistDescribeVisitor(Land land, Range range,
}
static Res freelistDescribe(Land land, mps_lib_FILE *stream, Count depth)
static Res freelistDescribe(Inst inst, mps_lib_FILE *stream, Count depth)
{
Land land = CouldBeA(Land, inst);
Freelist fl = CouldBeA(Freelist, land);
Res res;
Bool b;
@ -758,7 +759,7 @@ static Res freelistDescribe(Land land, mps_lib_FILE *stream, Count depth)
if (stream == NULL)
return ResPARAM;
res = NextMethod(Land, Freelist, describe)(land, stream, depth);
res = NextMethod(Inst, Freelist, describe)(inst, stream, depth);
if (res != ResOK)
return res;
@ -780,6 +781,7 @@ static Res freelistDescribe(Land land, mps_lib_FILE *stream, Count depth)
DEFINE_CLASS(Land, Freelist, klass)
{
INHERIT_CLASS(klass, Freelist, Land);
klass->protocol.describe = freelistDescribe;
klass->protocol.finish = freelistFinish;
klass->size = sizeof(FreelistStruct);
klass->init = freelistInit;
@ -792,7 +794,6 @@ DEFINE_CLASS(Land, Freelist, klass)
klass->findLast = freelistFindLast;
klass->findLargest = freelistFindLargest;
klass->findInZones = freelistFindInZones;
klass->describe = freelistDescribe;
}

View file

@ -391,7 +391,7 @@ Res LandFindInZones(Bool *foundReturn, Range rangeReturn, Range oldRangeReturn,
Res LandDescribe(Land land, mps_lib_FILE *stream, Count depth)
{
return Method(Land, land, describe)(land, stream, depth);
return Method(Inst, land, describe)(MustBeA(Inst, land), stream, depth);
}
@ -451,7 +451,6 @@ Bool LandClassCheck(LandClass klass)
CHECKL(FUNCHECK(klass->findLast));
CHECKL(FUNCHECK(klass->findLargest));
CHECKL(FUNCHECK(klass->findInZones));
CHECKL(FUNCHECK(klass->describe));
CHECKS(LandClass, klass);
return TRUE;
}
@ -543,8 +542,9 @@ static Res landNoFindInZones(Bool *foundReturn, Range rangeReturn, Range oldRang
return ResUNIMPL;
}
static Res LandAbsDescribe(Land land, mps_lib_FILE *stream, Count depth)
static Res LandAbsDescribe(Inst inst, mps_lib_FILE *stream, Count depth)
{
Land land = CouldBeA(Land, inst);
LandClass klass;
Res res;
@ -553,7 +553,7 @@ static Res LandAbsDescribe(Land land, mps_lib_FILE *stream, Count depth)
if (stream == NULL)
return ResPARAM;
res = InstDescribe(CouldBeA(Inst, land), stream, depth);
res = NextMethod(Inst, Land, describe)(inst, stream, depth);
if (res != ResOK)
return res;
@ -575,6 +575,7 @@ DEFINE_CLASS(Inst, LandClass, klass)
DEFINE_CLASS(Land, Land, klass)
{
INHERIT_CLASS(&klass->protocol, Land, Inst);
klass->protocol.describe = LandAbsDescribe;
klass->protocol.finish = LandAbsFinish;
klass->size = sizeof(LandStruct);
klass->init = LandAbsInit;
@ -587,7 +588,6 @@ DEFINE_CLASS(Land, Land, klass)
klass->findLast = landNoFind;
klass->findLargest = landNoFind;
klass->findInZones = landNoFindInZones;
klass->describe = LandAbsDescribe;
klass->sig = LandClassSig;
}

View file

@ -583,7 +583,6 @@ typedef struct LandClassStruct {
LandFindMethod findLast; /* find last range of given size */
LandFindMethod findLargest; /* find largest range */
LandFindInZonesMethod findInZones; /* find first range of given size in zone set */
LandDescribeMethod describe; /* describe the land */
Sig sig; /* .class.end-sig */
} LandClassStruct;