/* VMArenaDescribe -- describe the VMArena */ static Res VMArenaDescribe(Arena arena, mps_lib_FILE *stream) { Res res; VMArena vmArena; if (!TESTT(Arena, arena)) return ResFAIL; if (stream == NULL) return ResFAIL; vmArena = Arena2VMArena(arena); if (!TESTT(VMArena, vmArena)) return ResFAIL; /* Describe the superclass fields first via next-method call */ /* ...but the next method is ArenaTrivDescribe, so don't call it; * see impl.c.arena#describe.triv.dont-upcall. * super = ARENA_SUPERCLASS(VMArenaClass); res = super->describe(arena, stream); if (res != ResOK) return res; * */ res = WriteF(stream, " spareSize: $U\n", (WriteFU)vmArena->spareSize, NULL); if(res != ResOK) return res; /* (incomplete: some fields are not Described) */ return ResOK; }
static Compare shieldQueueEntryCompare(void *left, void *right, void *closure) { Seg segA = left, segB = right; /* These checks are not critical in a hot build, but slow down cool builds quite a bit, so just check the signatures. */ AVER(TESTT(Seg, segA)); AVER(TESTT(Seg, segB)); UNUSED(closure); return shieldAddrCompare(SegBase(segA), SegBase(segB)); }
Res SplayTreeDescribe(SplayTree splay, mps_lib_FILE *stream, Count depth, TreeDescribeFunction nodeDescribe) { Res res; if (!TESTT(SplayTree, splay)) return ResFAIL; if (stream == NULL) return ResFAIL; if (nodeDescribe == NULL) return ResFAIL; res = WriteF(stream, depth, "Splay $P {\n", (WriteFP)splay, " compare $F\n", (WriteFF)splay->compare, " nodeKey $F\n", (WriteFF)splay->nodeKey, " updateNode $F\n", (WriteFF)splay->updateNode, NULL); if (res != ResOK) return res; if (SplayTreeRoot(splay) != TreeEMPTY) { res = WriteF(stream, depth, " tree ", NULL); if (res != ResOK) return res; res = SplayNodeDescribe(SplayTreeRoot(splay), stream, nodeDescribe); if (res != ResOK) return res; } res = WriteF(stream, depth, "\n} Splay $P\n", (WriteFP)splay, NULL); return res; }
void mps_fmt_destroy(mps_fmt_t format) { Arena arena; AVER(TESTT(Format, format)); arena = FormatArena(format); ArenaEnter(arena); FormatDestroy(format); ArenaLeave(arena); }
Res ChunkNodeDescribe(Tree node, mps_lib_FILE *stream) { Chunk chunk; if (!TreeCheck(node)) return ResFAIL; if (stream == NULL) return ResFAIL; chunk = ChunkOfTree(node); if (!TESTT(Chunk, chunk)) return ResFAIL; return WriteF(stream, 0, "[$P,$P)", (WriteFP)chunk->base, (WriteFP)chunk->limit, NULL); }
void mps_pool_check_free_space(mps_pool_t mps_pool) { Pool pool = (Pool)mps_pool; Arena arena; /* TESTT not AVERT, see <design/interface-c#.check.space */ AVER(TESTT(Pool, pool)); arena = PoolArena(pool); ArenaEnter(arena); AVERT(Pool, pool); DebugPoolCheckFreeSpace(pool); ArenaLeave(arena); }
void mps_pool_check_fenceposts(mps_pool_t mps_pool) { Pool pool = (Pool)mps_pool; Arena arena; /* TESTT not AVERT, see <design/interface-c/#check.space */ AVER(TESTT(Pool, pool)); arena = PoolArena(pool); ArenaEnter(arena); AVERT(Pool, pool); DebugPoolCheckFences(pool); ArenaLeave(arena); }
static Res ArenaTrivDescribe(Arena arena, mps_lib_FILE *stream) { if (!TESTT(Arena, arena)) return ResFAIL; if (stream == NULL) return ResFAIL; /* .describe.triv.never-called-from-subclass-method: * This Triv method seems to assume that it will never get called * from a subclass-method invoking ARENA_SUPERCLASS()->describe. * It assumes that it only gets called if the describe method has * not been subclassed. (That's the only reason for printing the * "No class-specific description available" message). * This is bogus, but that's the status quo. RHSK 2007-04-27. */ /* .describe.triv.dont-upcall: Therefore (for now) the last * subclass describe method should avoid invoking * ARENA_SUPERCLASS()->describe. RHSK 2007-04-27. */ return WriteF(stream, " No class-specific description available.\n", NULL); }
void test_modular_traits(){ typedef CGAL::Residue Residue; typedef CGAL::Modular_traits<TESTT> MT; typedef typename MT::Residue_type Residue_type; typedef typename MT::Modular_image Modular_image; typedef typename MT::Modular_image_representative Modular_image_representative; typedef typename MT::Is_modularizable Is_modularizable; typedef typename MT::NT NT; assert( !(::boost::is_same<CGAL::Null_functor,Modular_image>::value)); assert( !(::boost::is_same<CGAL::Null_functor,Modular_image_representative>::value)); assert( (::boost::is_same<CGAL::Tag_true,Is_modularizable>::value)); assert( (::boost::is_same<TESTT,NT>::value)); Residue::set_current_prime(7); Modular_image modular_image; assert(modular_image(TESTT(10)+TESTT(10)) == Residue_type(-1)); assert(modular_image(TESTT(2) *TESTT(10)) == Residue_type(-1)); assert(modular_image(TESTT(20)) == Residue_type(-1)); assert(modular_image(TESTT(20)) == Residue_type(6)); assert(modular_image(TESTT(21)) == Residue_type(0)); assert(modular_image(TESTT(22)) == Residue_type(1)); assert(modular_image(TESTT(777777722)) == Residue_type(1)); Modular_image_representative modular_image_representative; assert(modular_image_representative(modular_image(TESTT(20))) == TESTT(-1)); }