Esempio n. 1
0
 Buckets::Buckets(size_t npositions, size_t nletters)
   : buckets_(npositions)
   , created_(false)
   , column_total_(0)
 {
   create_(nletters);
 }
Esempio n. 2
0
void
diy::Collection::
load(int i)
{
  //BinaryBuffer bb;
  //storage_->get(external_[i], bb);
  void* e = create_();
  //load_(e, bb);
  storage_->get(external_[i], e, load_);
  elements_[i] = e;
  external_[i] = -1;

  ++(*in_memory_.access());
}
Esempio n. 3
0
void main()
{
 void *npswloc;             /* new psw location address */
 unsigned int psw[2];       /* psw */
 int x;                     /* loop index */
 int wpin, rpin;            /* pin for the wait and root states */
 PCB dummypcb;              /* dummy PCB for running to be set to */
 
                  /* initialize new psw locations */
                       /* program interrupt */
 psw[0] = 0x000A0000;
 psw[1] = 0x00000BAD;
 npswloc = (void *)progint;
 memcpy(npswloc, psw, 16);
                        /* I/O interrupt */
 psw[0] = 0x00080000;
 psw[1] = (int)IOHNDLR;
 npswloc = (void *)ioint;
 memcpy(npswloc, psw, 16);
                       /* External interrupt */
 psw[1] = (int)EXTHNDLR;
 npswloc = (void *)extint;
 memcpy(npswloc, psw, 16);
                         /* SVC interrupt */
 psw[1] = (int)SVCHNDLR;
 npswloc = (void *)svcint;
 memcpy(npswloc, psw, 16);
 
                     /* initialize memory */
 initmem_();
 
                  /* initialize Ready Process Q */
 QInit(&Ready);
 
               /* initialize table to all empty slots */
 for (x=0; x<PTSIZE; x++)
  PTable[x].state = UNUSED;
 
                     /* create WAIT process */
 psw[0] = 0x030A0000;
 psw[1] = 0x0000AAAA;
 wpin = create_("WAIT    ", psw, NULL, 0, NULL);
 deQ(&Ready);
 
                    /* create terminator process */
 psw[0] = 0x3080000;
 psw[1] = (int)terminator;
 tpin = create_("TERMINAT", psw, 0, 0, NULL);
 
                   /* create PTSEM and MEMWAIT */
 PTSEM = getsem_(PTSIZE, &(PTable[0]));
 MEMWAIT = getsem_(0, &PTable[0]);
 
                 /* create 1st user (ROOT) process */
 psw[0] = 0x03080000;
 psw[1] = (int)root;
 rpin = create_("ROOT    ", psw, 0, 0, NULL);
 
                 /* initialize running to dummy PCB */
 running = &dummypcb;
 running->state = BLOCKED;
 
                 /* dispatch to give control to ROOT */
 dispatch();
} /* end main */
Esempio n. 4
0
 OlympusMakerNote::AutoPtr OlympusMakerNote::create(bool alloc) const
 {
     return AutoPtr(create_(alloc));
 }
Esempio n. 5
0
PlumedHandle::PlumedHandle(const char* kernel)
#ifdef __PLUMED_HAS_DLOPEN
  :
  handle([&]() {
  dlerror();
  int mode = RTLD_LOCAL | RTLD_NOW;
#ifdef RTLD_DEEPBIND
// Needed on Linux to avoid namespace clashes
  mode |= RTLD_DEEPBIND;
#endif
  void* h=::dlopen(kernel,mode);
// try to remove the "Kernel" string.
// needed to load old versions
  if(!h) {
    std::string k(kernel);
    auto i=k.rfind("Kernel");
    if(i!=std::string::npos) {
      k=k.substr(0,i) + k.substr(i+6);
      h=::dlopen(k.c_str(),mode);
    }
  }
  plumed_assert(h) << "there was a problem loading kernel "<<kernel <<"\n"<<dlerror();
  return DlHandle(h);
// once the DlHandle has been constructed we know that later exceptions will also call dlclose().
}()),
symbol_((plumed_symbol_table_type*) dlsym(handle,"plumed_symbol_table")),
create_([&]() {
  if(symbol_) {
    plumed_assert(symbol_->functions.create);
    return symbol_->functions.create;
  }
  void* c=nullptr;
  if(!c) c=dlsym(handle,"plumedmain_create");
  if(!c) c=dlsym(handle,"plumed_plumedmain_create");
  plumed_assert(c) << "in kernel "<<kernel<<" I could not find (plumed_)plumedmain_create";
  plumed_create_pointer cc;
  *(void **)(&cc)=c;
  return cc;
}()),
cmd_([&]() {
  if(symbol_) {
    plumed_assert(symbol_->functions.cmd);
    return symbol_->functions.cmd;
  }
  void* c=nullptr;
  if(!c) c=dlsym(handle,"plumedmain_cmd");
  if(!c) c=dlsym(handle,"plumed_plumedmain_cmd");
  plumed_assert(c) << "in kernel "<<kernel<<" I could not find (plumed_)plumedmain_cmd";
  plumed_cmd_pointer cc;
  *(void **)(&cc)=c;
  return cc;
}()),
finalize_([&]() {
  if(symbol_) {
    plumed_assert(symbol_->functions.finalize);
    return symbol_->functions.finalize;
  }
  void* f=nullptr;
  if(!f) f=dlsym(handle,"plumedmain_finalize");
  if(!f) f=dlsym(handle,"plumed_plumedmain_finalize");
  plumed_assert(f) << "in kernel "<<kernel<<" I could not find (plumed_)plumedmain_finalize";
  plumed_finalize_pointer ff;
  *(void **)(&ff)=f;
  return ff;
}()),
p(create_())
// No exceptions thrown past this point.
// Thus, destructor PlumedHandle::~PlumedHandle() will always be called and p will always be finalized.
{}
Esempio n. 6
0
 FujiMakerNote::AutoPtr FujiMakerNote::create(bool alloc) const
 {
     return AutoPtr(create_(alloc));
 }
Esempio n. 7
0
int
main(int argc, char* argv[])
{
    aug_mpool* mpool;
    aug_chan* chan1;
    aug_chan* chan2;
    aug_chan* chan3;
    aug_chans_t chans;

    aug_check(aug_autotlx());
    aug_setloglevel(aug_tlx, AUG_LOGDEBUG0 + 3);

    mpool = aug_getmpool(aug_tlx);
    aug_check(mpool);

    chan1 = create_(mpool, 1);
    aug_check(chan1);

    chan2 = create_(mpool, 2);
    aug_check(chan2);

    chan3 = create_(mpool, 3);
    aug_check(chan3);

    chans = aug_createchans(mpool, &chandler_);
    aug_check(chans);

    aug_check(0 <= aug_insertchan(chans, chan1));
    aug_check(0 <= aug_insertchan(chans, chan2));
    aug_check(0 <= aug_insertchan(chans, chan3));
    aug_check(6 == refs_);

    aug_release(chan1);
    aug_release(chan2);
    aug_release(chan3);
    aug_check(3 == refs_);

    /* 3 2 1 */
    foreach_(chans);
    /* 2 1 3 */
    aug_check(3 == aug_getchans(chans));
    aug_check(3 == count_);
    aug_check(3 == last_);

    /* Fairness rotation. */

    /* 2 1 3 */
    foreach_(chans);
    /* 1 3 2 */
    aug_check(3 == aug_getchans(chans));
    aug_check(3 == count_);
    aug_check(2 == last_);

    /* Fairness rotation. */

    /* 1 3 2 */
    foreach_(chans);
    /* 3 2 1 */
    aug_check(3 == aug_getchans(chans));
    aug_check(3 == count_);
    aug_check(1 == last_);

    /* Remove middle. */

    aug_check(0 <= aug_removechan(chans, 2));

    /* 3 1 */
    foreach_(chans);
    /* 1 3 */
    aug_check(2 == aug_getchans(chans));
    aug_check(2 == count_);
    aug_check(3 == last_);

    /* No longer exists. */

    aug_check(aug_removechan(chans, 2) < 0);
    aug_check(AUG_EXNONE == aug_getexcept(aug_tlx));

    /* Remove during loop. */

    cb_ = rm1_;
    aug_processchans(chans);

    /* No longer exists. */

    aug_check(aug_removechan(chans, 1) < 0);

    /* 3 */
    foreach_(chans);
    /* 3 */
    aug_check(1 == aug_getchans(chans));
    aug_check(1 == count_);
    aug_check(3 == last_);

    aug_dumpchans(chans);
    aug_destroychans(chans);

     /* Objects released. */

    aug_check(0 == aug_getchans(chans));
    aug_check(0 == refs_);
    aug_release(mpool);
    return 0;
}
Esempio n. 8
0
 void*         create() const                  { return create_(); }
Esempio n. 9
0
 PanasonicMakerNote::AutoPtr PanasonicMakerNote::create(bool alloc) const
 {
     return AutoPtr(create_(alloc));
 }