Exemplo n.º 1
0
TEST_DEFINE_TEST(TestCtx, ObjectTests)
{
    auto t = Module.GetRootObject<test::IObjectTests>("GetTests");
    if (!t)
    {
        TEST_REPORT_ERROR("ObjectTests not implemented!");
        return;
    }

    auto some_obj = t->ReturnNewObject();
    TEST_THROWS_NOTHING(some_obj->Method());

    TEST_EQUALS((bool)t->ReturnNull(), false);
    TEST_EQUALS(t->CheckNotNull(nullptr), false);
    TEST_EQUALS(t->CheckNotNull(some_obj), true);

    TEST_EQUALS((bool)t->CallbackReturn(Ctx.MakeComponent<test::IObjectTestsCallbackReturn, ObjectTestsCallback>(some_obj)), true);
    auto cb = Ctx.MakeComponent<test::IObjectTestsCallbackReturn, ObjectTestsCallback>(nullptr);
    TEST_EQUALS((bool)t->CallbackReturn(cb), false);
    TEST_EQUALS(t->CallbackParam(joint::Cast<test::IObjectTestsCallbackParam>(cb), nullptr), false);
    TEST_EQUALS(t->CallbackParam(joint::Cast<test::IObjectTestsCallbackParam>(cb), some_obj), true);

    auto o_impl = Ctx.MakeComponentWrapper<SomeObject>();
    auto o = Ctx.MakeComponentProxy<test::ISomeObject>(o_impl);

    TEST_THROWS_NOTHING(t->InvokeObjectMethod(o));
    TEST_EQUALS(o_impl->GetInvokationsCount(), 1);

    auto o2 = t->ReturnSameObject(o);
    o2->Method();
    TEST_EQUALS(o_impl->GetInvokationsCount(), 2);
}
Exemplo n.º 2
0
int LibvlcCamera::PrimeCapture() {
  Info("Priming capture from %s", mPath.c_str());

  StringVector opVect = split(Options(), ",");

  // Set transport method as specified by method field, rtpUni is default
  if ( Method() == "rtpMulti" )
    opVect.push_back("--rtsp-mcast");
  else if ( Method() == "rtpRtsp" )
    opVect.push_back("--rtsp-tcp");
  else if ( Method() == "rtpRtspHttp" )
    opVect.push_back("--rtsp-http");

  opVect.push_back("--no-audio");

  if ( opVect.size() > 0 ) {
    mOptArgV = new char*[opVect.size()];
    Debug(2, "Number of Options: %d",opVect.size());
    for (size_t i=0; i< opVect.size(); i++) {
      opVect[i] = trimSpaces(opVect[i]);
      mOptArgV[i] = (char *)opVect[i].c_str();
      Debug(2, "set option %d to '%s'", i,  opVect[i].c_str());
    }
  }

  mLibvlcInstance = libvlc_new(opVect.size(), (const char* const*)mOptArgV);
  if ( mLibvlcInstance == NULL ) {
    Error("Unable to create libvlc instance due to: %s", libvlc_errmsg());
    return -1;
  }

  mLibvlcMedia = libvlc_media_new_location(mLibvlcInstance, mPath.c_str());
  if ( mLibvlcMedia == NULL ) {
    Error("Unable to open input %s due to: %s", mPath.c_str(), libvlc_errmsg());
    return -1;
  }

  mLibvlcMediaPlayer = libvlc_media_player_new_from_media(mLibvlcMedia);
  if ( mLibvlcMediaPlayer == NULL ) {
    Error("Unable to create player for %s due to: %s", mPath.c_str(), libvlc_errmsg());
    return -1;
  }

  libvlc_video_set_format(mLibvlcMediaPlayer, mTargetChroma.c_str(), width, height, width * mBpp);
  libvlc_video_set_callbacks(mLibvlcMediaPlayer, &LibvlcLockBuffer, &LibvlcUnlockBuffer, NULL, &mLibvlcData);

  mLibvlcData.bufferSize = width * height * mBpp;
  // Libvlc wants 32 byte alignment for images (should in theory do this for all image lines)
  mLibvlcData.buffer = (uint8_t*)zm_mallocaligned(64, mLibvlcData.bufferSize);
  mLibvlcData.prevBuffer = (uint8_t*)zm_mallocaligned(64, mLibvlcData.bufferSize);
  
  mLibvlcData.newImage.setValueImmediate(false);

  libvlc_media_player_play(mLibvlcMediaPlayer);

  return 0;
}
Exemplo n.º 3
0
QList<QList<card> > Method::PickOptimalSeqSingles()
{
    QList<QList<QList<card> > > seqRecord;
    QList<QList<card> > seqInherited;
    Method(m_player, m_cards).PickSeqSingles(seqRecord, seqInherited, m_cards);
    if (seqRecord.isEmpty())
    {
        return QList<QList<card> >();
    }

    QMap<int, int> seqMarks;
    for (int i = 0; i < seqRecord.size(); i++)
    {
        QList<card> backupCards = m_cards;
        QList<QList<card> > seqArray = seqRecord[i];
        for(int l=0;l<seqArray.size();l++)
        {
            for(int j=0;j<seqArray[l].size();j++)
            {
                backupCards.removeOne(seqArray[l][j]);
            }
        }

        QList<QList<card> > singleArray = Method(m_player, backupCards).FindCardsByCount(1);

        QList<card> cardList;
        for (int j = 0; j < singleArray.size(); j++)
        {
            for(int i=0;i<singleArray[j].size();i++)
                cardList<<singleArray[j][i];

        }

        int mark = 0;
        for (int j = 0; j < cardList.size(); j++)
        {
            mark += cardList[j].point + 15;
        }
        seqMarks.insert(i, mark);
    }

    int index = 0;
    int compMark = 1000000;
    QMap<int, int>::ConstIterator it = seqMarks.constBegin();
    for (; it != seqMarks.constEnd(); it++)
    {
        if (it.value() < compMark)
        {
            compMark = it.value();
            index = it.key();
        }
    }

    return seqRecord[index];
}
Exemplo n.º 4
0
unsigned int Method(int N, int M)
{
	if(N==M) return 1;
	if(M==0) return 1;//if(M==1) return N
	if(matrix[N][M]>0)
	{
		return matrix[N][M];
	}
	matrix[N][M]=Method(N-1, M) + Method(N-1, M-1);
	return matrix[N][M];
}
Exemplo n.º 5
0
int establish_root_environment(void) {
    spawn_env(NULL, Primordial_Grid(GC_SKIPREG));
    rootEnvironment=Car(env);
    rootBacros=Grid();
    unknownSymbolError=Err(Cons(String("Unknown symbol"), NULL));
    Set(rootEnvironment, "nil", NULL);
    Set(rootEnvironment, "true", Atom("true"));
    Set(rootEnvironment, "add", Routine(&dirty_sum));
    Set(rootEnvironment, "+", Get(rootEnvironment, "add"));
    Set(rootEnvironment, "subtract", Routine(&dirty_sub));
    Set(rootEnvironment, "-", Get(rootEnvironment, "subtract"));
    Set(rootEnvironment, "if", Method(&funky_if));
    Set(rootEnvironment, "&ver", String("Funky Lisp Draft 3"));
    Set(rootEnvironment, "set!", Routine(&funky_set));
    Set(rootEnvironment, "print_", Routine(&funky_print));
    Set(rootEnvironment, "list", Routine(&funky_list));
    Set(rootEnvironment, "pair", Routine(&funky_pair));
    Set(rootEnvironment, "grid", Routine(&funky_grid));
    Set(rootEnvironment, "get", Routine(&funky_grid_get));
    Set(rootEnvironment, "quote", Method(&funky_quote));
    Set(rootEnvironment, "apply", Routine(&apply));
    Set(rootEnvironment, "mac", Method(&funky_macro));
    Set(rootEnvironment, "def", Method(&funky_def));
    Set(rootEnvironment, "head", Routine(&funky_head));
    Set(rootEnvironment, "rest_", Routine(&funky_rest));
    Set(rootEnvironment, "last", Routine(&funky_last));
    Set(rootEnvironment, "err", Routine(&funky_err));
    Set(rootEnvironment, "dump", Routine(&funky_dump));
    Set(rootEnvironment, "&bacros", rootBacros);
    Set(rootEnvironment, ">", Routine(&funky_greater_than));
    Set(rootEnvironment, "<", Routine(&funky_less_than));
    Set(rootEnvironment, "=", Routine(&funky_equivalent));
    Set(rootEnvironment, "not", Routine(&funky_not_operator));
    Set(rootEnvironment, "eval", Method(&funky_evaluator));
    Set(rootEnvironment, "true?", Routine(&funky_truthy));
    Set(rootEnvironment, "false?", Routine(&funky_nilly));
    Set(rootEnvironment, "lambda?", Routine(&funky_callable));
    Set(rootEnvironment, "atom?", Routine(&funky_is_atom));
    Set(rootEnvironment, "gen?", Routine(&funky_is_gen));
    Set(rootEnvironment, "len", Routine(&funky_length));
    Set(rootEnvironment, "gen", Routine(&funky_gen));
    Set(rootEnvironment, "cons", Routine(&funky_cons));
    Set(rootEnvironment, "append", Routine(&funky_append));
    Set(rootEnvironment, "error?", Routine(&funky_is_error));
    Set(rootEnvironment, "grid?", Routine(&funky_is_grid));
    Set(rootEnvironment, "txt-concatenate_", Routine(&funky_make_txt));
    Set(rootEnvironment, "type", Routine(&funky_type_symbol));
    Set(rootEnvironment, UNKNOWN_HANDLER, Atom(UNKNOWN_LIT));
    establish_bacros(rootBacros);
    return new_env();
}
Exemplo n.º 6
0
static thing_th *dup_cell(thing_th *thing) {
    switch(th_kind(thing)) {
        case number_k:
            return Number(sym(thing));
        case string_k:
            return String(sym(thing));
        case atom_k:
            return Atom(sym(thing));
        case cons_k:
            return Cons(Car(thing), Cdr(thing));
        case error_k:
            return Err(Cdr(thing));
        case procedure_k:
            return Proc(Car(thing), Cdr(thing));
        case macro_k:
            return Mac(Car(thing), Cdr(thing));
        case gen_k:
            return Gen(Car(thing), Cdr(thing));
        case routine_k:
            return Routine(call_rt(thing));
        case method_k:
            return Method(call_rt(thing));
        case grid_k:
            return duplicate_grid(thing);
        case null_k:
            return NULL;
    }
}
Exemplo n.º 7
0
File_Group::File_Group (void)
{
    Trip_File (NULL);
    Time_File (NULL);
    Trip_Factor (NULL);
    Script_File (NULL);

    Purpose (0);
    Mode (0);
    Method (0);
    Duration (0);
    Type (0);
    SubType (0);
    Org_Wt (0);
    Des_Wt (0);
    Dist_Wt (true);
    Speed (0);
    Time_Field (0);
    Scaling_Factor (1.0);

    period = NULL;
    time_equiv = NULL;
    program = NULL;
    header = NULL;
}
Exemplo n.º 8
0
void ChunkFinish(Chunk chunk)
{
  Arena arena;

  AVERT(Chunk, chunk);

  AVER(BTIsResRange(chunk->allocTable, 0, chunk->pages));
  arena = ChunkArena(chunk);

  if (arena->hasFreeLand)
    ArenaFreeLandDelete(arena,
                        PageIndexBase(chunk, chunk->allocBase),
                        chunk->limit);

  ArenaChunkRemoved(arena, chunk);

  chunk->sig = SigInvalid;

  TreeFinish(&chunk->chunkTree);
  RingRemove(&chunk->arenaRing);

  /* Finish all other fields before class finish, because they might be */
  /* unmapped there. */
  Method(Arena, arena, chunkFinish)(chunk);
}
Exemplo n.º 9
0
Arquivo: pool.c Projeto: bhanug/mps
Res PoolAlloc(Addr *pReturn, Pool pool, Size size)
{
  Res res;

  AVER(pReturn != NULL);
  AVERT(Pool, pool);
  AVER(size > 0);

  res = Method(Pool, pool, alloc)(pReturn, pool, size);
  if (res != ResOK)
    return res;
  /* Make sure that the allocated address was in the pool's memory. */
  /* .hasaddr.critical: The PoolHasAddr check is expensive, and in */
  /* allocation-bound programs this is on the critical path. */
  AVER_CRITICAL(PoolHasAddr(pool, *pReturn));
  /* All allocations should be aligned to the pool's alignment */
  AVER_CRITICAL(AddrIsAligned(*pReturn, pool->alignment));

  /* All PoolAllocs should advance the allocation clock, so we count */
  /* it all in the fillMutatorSize field. */
  ArenaGlobals(PoolArena(pool))->fillMutatorSize += size;

  EVENT3(PoolAlloc, pool, *pReturn, size);

  return ResOK;
}
Exemplo n.º 10
0
Method Wren::method( 
    const std::string& mod,
    const std::string& var,
    const std::string& sig
) {
    return Method( vm_, wrenGetMethod( vm_, mod.c_str(), var.c_str(), sig.c_str() ) );
}
Exemplo n.º 11
0
int SuperClass::Method()
{
    Method();
    AbstractVirtualMethod(y);
    int LocalVariable;
    return y;
}
Exemplo n.º 12
0
Arquivo: pool.c Projeto: bhanug/mps
void PoolBlacken(Pool pool, TraceSet traceSet, Seg seg)
{
  AVERT(Pool, pool);
  AVERT(TraceSet, traceSet);
  AVERT(Seg, seg);
  AVER(SegPool(seg) == pool);
  Method(Pool, pool, blacken)(pool, traceSet, seg);
}
Exemplo n.º 13
0
 void Run()
 {
     int total = 0;
     for (int i=0; i<1e8; i++)
     {
         total += Method(i);
     }
 }
Exemplo n.º 14
0
Arquivo: pool.c Projeto: bhanug/mps
void PoolFreeWalk(Pool pool, FreeBlockVisitor f, void *p)
{
  AVERT(Pool, pool);
  AVER(FUNCHECK(f));
  /* p is arbitrary, hence can't be checked. */

  Method(Pool, pool, freewalk)(pool, f, p);
}
Exemplo n.º 15
0
Arquivo: pool.c Projeto: bhanug/mps
void PoolTraceEnd(Pool pool, Trace trace)
{
  AVERT(Pool, pool);
  AVERT(Trace, trace);
  AVER(pool->arena == trace->arena);

  Method(Pool, pool, traceEnd)(pool, trace);
}
Exemplo n.º 16
0
void BufferFinish(Buffer buffer)
{
  AVERT(Buffer, buffer);
  AVER(BufferIsReady(buffer));

  BufferDetach(buffer, BufferPool(buffer)); /* FIXME: Should be in BufferAbsFinish? */

  Method(Inst, buffer, finish)(MustBeA(Inst, buffer));
}
Exemplo n.º 17
0
Res BufferFramePop(Buffer buffer, AllocFrame frame)
{
  Pool pool;
  AVERT(Buffer, buffer);
  /* frame is of an abstract type & can't be checked */
  pool = BufferPool(buffer);
  return Method(Pool, pool, framePop)(pool, buffer, frame);
 
}
Exemplo n.º 18
0
Arquivo: pool.c Projeto: bhanug/mps
Res PoolWhiten(Pool pool, Trace trace, Seg seg)
{ 
  AVERT(Pool, pool);
  AVERT(Trace, trace);
  AVERT(Seg, seg);
  AVER(PoolArena(pool) == trace->arena);
  AVER(SegPool(seg) == pool);
  return Method(Pool, pool, whiten)(pool, trace, seg);
}
Exemplo n.º 19
0
Arquivo: pool.c Projeto: bhanug/mps
void PoolGrey(Pool pool, Trace trace, Seg seg)
{
  AVERT(Pool, pool);
  AVERT(Trace, trace);
  AVERT(Seg, seg);
  AVER(pool->arena == trace->arena);
  AVER(SegPool(seg) == pool);
  Method(Pool, pool, grey)(pool, trace, seg);
}
std::vector<std::string> ZeroDivide::MessageDump() const
{
	std::vector<std::string> result(3);
	result[0] = Message();
	result[1] = Method();
	result[2] = mess;

	return result;
}
Exemplo n.º 21
0
Res BufferFill(Addr *pReturn, Buffer buffer, Size size)
{
  Res res;
  Pool pool;
  Addr base, limit, next;

  AVER(pReturn != NULL);
  AVERT(Buffer, buffer);
  AVER(size > 0);
  AVER(SizeIsAligned(size, BufferPool(buffer)->alignment));
  AVER(BufferIsReady(buffer));

  pool = BufferPool(buffer);

  /* If we're here because the buffer was trapped, then we attempt */
  /* the allocation here. */
  if (!BufferIsReset(buffer) && buffer->ap_s.limit == (Addr)0) {
    /* .fill.unflip: If the buffer is flipped then we unflip the buffer. */
    if (buffer->mode & BufferModeFLIPPED) {
      BufferSetUnflipped(buffer);
    }

    /* .fill.logged: If the buffer is logged then we leave it logged. */
    next = AddrAdd(buffer->ap_s.alloc, size);
    if (next > (Addr)buffer->ap_s.alloc &&
        next <= (Addr)buffer->poolLimit) {
      buffer->ap_s.alloc = next;
      if (buffer->mode & BufferModeLOGGED) {
        EVENT3(BufferReserve, buffer, buffer->ap_s.init, size);
      }
      *pReturn = buffer->ap_s.init;
      return ResOK;
    }
  }

  /* There really isn't enough room for the allocation now. */
  AVER(AddrAdd(buffer->ap_s.alloc, size) > buffer->poolLimit ||
       AddrAdd(buffer->ap_s.alloc, size) < (Addr)buffer->ap_s.alloc);

  BufferDetach(buffer, pool);

  /* Ask the pool for some memory. */
  res = Method(Pool, pool, bufferFill)(&base, &limit, pool, buffer, size);
  if (res != ResOK)
    return res;

  /* Set up the buffer to point at the memory given by the pool */
  /* and do the allocation that was requested by the client. */
  BufferAttach(buffer, base, limit, base, size);

  if (buffer->mode & BufferModeLOGGED) {
    EVENT3(BufferReserve, buffer, buffer->ap_s.init, size);
  }

  *pReturn = base;
  return res;
}
Exemplo n.º 22
0
Arquivo: pool.c Projeto: bhanug/mps
void PoolWalk(Pool pool, Seg seg, FormattedObjectsVisitor f, void *p, size_t s)
{
  AVERT(Pool, pool);
  AVERT(Seg, seg);
  AVER(FUNCHECK(f));
  /* p and s are arbitrary values, hence can't be checked. */

  Method(Pool, pool, walk)(pool, seg, f, p, s);
}
Exemplo n.º 23
0
bool ARTSPConnection::receiveRTSPRequest() {
    AString requestLine;
	LOGI(LOG_TAG,"start receiveLine ......\n");
    if (!receiveLine(&requestLine)) {
        return false;
    }
//	LOGI(LOG_TAG,"receiveLine OK\n");
    sp<AMessage>  request = new AMessage(kWhatRequest,mhandlerID);
	request->setInt32("SessionID",mSessionID);
	LOGI(LOG_TAG,"request->setInt32 SessionID %d\n",mSessionID);
    LOGI(LOG_TAG,"request: %s\n", requestLine.c_str());

    ssize_t space1 = requestLine.find(" ");//寻找空格
    if (space1 < 0) {
        return false;
    }
    ssize_t space2 = requestLine.find(" ", space1 + 1);
    if (space2 < 0) {
        return false;
    }

    AString Method(requestLine.c_str(), space1);
	request->setString("Method",Method.c_str());
	AString URI(requestLine,space1+1,space2-space1-1);
	request->setString("URI",URI.c_str());
    AString line;
    for (;;) {
        if (!receiveLine(&line)) {
            break;
        }

        if (line.empty()) {
            break;
        }

        ssize_t colonPos = line.find(":");
        if (colonPos < 0) {
            // Malformed header line.
            return false;
        }

        AString key(line, 0, colonPos);
        key.trim();
       // key.tolower();

        line.erase(0, colonPos + 1);
        line.trim();
		
        LOGI(LOG_TAG,"line: %s:%s\n", key.c_str(),line.c_str());

	    request->setString(key.c_str(),line.c_str());	
    }
	LOGI(LOG_TAG,"Post the request to handler\n");
    request->post();//将请求消息发送给uplayer 处理
	return OK;
}
Exemplo n.º 24
0
Arquivo: pool.c Projeto: bhanug/mps
Res PoolAddrObject(Addr *pReturn, Pool pool, Seg seg, Addr addr)
{
  AVER(pReturn != NULL);
  AVERT(Pool, pool);
  AVERT(Seg, seg);
  AVER(pool == SegPool(seg));
  AVER(SegBase(seg) <= addr);
  AVER(addr < SegLimit(seg));
  return Method(Pool, pool, addrObject)(pReturn, pool, seg, addr);
}
Exemplo n.º 25
0
Arquivo: main.cpp Projeto: tdv/boss
int main()
{
  try
  {
    Boss::Loader Ldr("Registry.xml", "./" MAKE_MODULE_NAME("service_registry"),
                     "./" MAKE_MODULE_NAME("class_factory"));
    auto Obj1 = Boss::CreateObject<MyNs::IFace1>(MyNs::Service::Id::Face1);
    if (Obj1->Method() != Boss::Status::Ok)
      std::cerr << "Failed to call IFace1::Method" << std::endl;
    auto Obj2 = Boss::CreateObject<MyNs::IFace2>(MyNs::Service::Id::Face2);
    if (Obj2->Method() != Boss::Status::Ok)
      std::cerr << "Failed to call IFace2::Method" << std::endl;
  }
  catch (std::exception const &e)
  {
    std::cerr << "Error: " << e.what() << std::endl;
  }
  return 0;
}
Exemplo n.º 26
0
void BufferDetach(Buffer buffer, Pool pool)
{
  AVERT(Buffer, buffer);
  AVER(BufferIsReady(buffer));

  if (!BufferIsReset(buffer)) {
    Addr init, limit;
    Size spare;

    buffer->mode |= BufferModeTRANSITION;

    /* Ask the owning pool to do whatever it needs to before the */
    /* buffer is detached (e.g. copy buffer state into pool state). */
    Method(Pool, pool, bufferEmpty)(pool, buffer);

    /* run any class-specific detachment method */
    Method(Buffer, buffer, detach)(buffer);

    init = BufferGetInit(buffer);
    limit = BufferLimit(buffer);
    spare = AddrOffset(init, limit);
    buffer->emptySize += spare;
    if (buffer->isMutator) {
      ArenaGlobals(buffer->arena)->emptyMutatorSize += spare;
      ArenaGlobals(buffer->arena)->allocMutatorSize +=
        AddrOffset(buffer->base, init);
    } else {
      ArenaGlobals(buffer->arena)->emptyInternalSize += spare;
    }

    /* Reset the buffer. */
    buffer->base = (Addr)0;
    buffer->initAtFlip = (Addr)0;
    buffer->ap_s.init = (mps_addr_t)0;
    buffer->ap_s.alloc = (mps_addr_t)0;
    buffer->ap_s.limit = (mps_addr_t)0;
    buffer->poolLimit = (Addr)0;
    buffer->mode &=
      ~(BufferModeATTACHED|BufferModeFLIPPED|BufferModeTRANSITION);

    EVENT2(BufferEmpty, buffer, spare);
  }
}
Exemplo n.º 27
0
void BufferReassignSeg(Buffer buffer, Seg seg)
{
  AVERT(Buffer, buffer);
  AVERT(Seg, seg);
  AVER(!BufferIsReset(buffer));
  AVER(BufferBase(buffer) >= SegBase(seg));
  AVER(BufferLimit(buffer) <= SegLimit(seg));
  AVER(BufferPool(buffer) == SegPool(seg));
  Method(Buffer, buffer, reassignSeg)(buffer, seg);
}
Exemplo n.º 28
0
Arquivo: pool.c Projeto: bhanug/mps
Res PoolAccess(Pool pool, Seg seg, Addr addr,
               AccessSet mode, MutatorFaultContext context)
{
  AVERT(Pool, pool);
  AVERT(Seg, seg);
  AVER(SegBase(seg) <= addr);
  AVER(addr < SegLimit(seg));
  AVERT(AccessSet, mode);
  /* Can't check MutatorFaultContext as there is no check method */

  return Method(Pool, pool, access)(pool, seg, addr, mode, context);
}
Exemplo n.º 29
0
void main()
{
	int N, M;
	while(cin>>N>>M)
	{
		if(N==0) break;

		cout<<N<<" things taken "<<M<<" at a time is ";	
		if(M>N-M) M=N-M;
		cout<<Method(N, M)<<" exactly."<<endl;
	}
}
Exemplo n.º 30
0
Arquivo: pool.c Projeto: bhanug/mps
void PoolFree(Pool pool, Addr old, Size size)
{
  AVERT(Pool, pool);
  AVER(old != NULL);
  /* The pool methods should check that old is in pool. */
  AVER(size > 0);
  AVER(AddrIsAligned(old, pool->alignment));
  AVER(PoolHasRange(pool, old, AddrAdd(old, size)));

  Method(Pool, pool, free)(pool, old, size);
 
  EVENT3(PoolFree, pool, old, size);
}