예제 #1
0
/*
================================================================================
NAME              : _constructInstance
DESCRIPTION       : Constructs instance by adding its properties. The
                  : IP Interface argument has already been filled in
                  : with data from an existing IP Interface
ASSUMPTIONS       : None
PRE-CONDITIONS    :
POST-CONDITIONS   :
NOTES             :
PARAMETERS        : className, Process
================================================================================
*/
CIMInstance BIPTLEpProvider::_constructInstance(
    const CIMName &className,
    const CIMNamespaceName &nameSpace,
    const IPInterface &_ipif)
{
#ifdef DEBUG
  cout << "BIPTLEpProvider::_constructInstance()" << endl;
#endif

  String s;
  Uint16 i16;
  CIMDateTime d;

  CIMInstance inst(className);

  // Set path

  inst.setPath(CIMObjectPath(String::EMPTY, // hostname
                             nameSpace,
                             CLASS_PG_BINDS_IP_TO_LAN_ENDPOINT,
                             _constructKeyBindings(nameSpace, _ipif)));

// ======================================================
// The following properties are in CIM_ServiceAccessPoint
// ======================================================

  // The keys for this class are:
  // CIM_LANEndpoint REF Antecedent
  // CIM_IPProtocolEndpoint REF Dependent

  // Rather than rebuilding the key properties, we will reuse
  // the values that were inserted for us in the ObjectPath,
  // trusting that this was done correctly

  // Get the keys
  Array<CIMKeyBinding> key = inst.getPath().getKeyBindings();
  // loop through keys, inserting them as properties
  // luckily, all keys for this class are strings, so no
  // need to check key type
  for (Uint32 i=0; i<key.size(); i++)
  {
    // add a property created from the name and value
    inst.addProperty(CIMProperty(key[i].getName(),key[i].getValue()));
  }

// CIM_BindsToLANEndpoint

//   uint16 FrameType
  if (_ipif.getFrameType(i16))
    inst.addProperty(CIMProperty(PROPERTY_FRAME_TYPE,i16));

#ifdef DEBUG
  cout << "BIPTLEpProvider::_constructInstance() -- done" << endl;
#endif

  return inst;
}
예제 #2
0
// TransportConfig::addLast
void JNICALL Java_OpenDDS_DCPS_transport_TransportConfig_addLast
(JNIEnv * jni, jobject jthis, jobject inst_jobj)
{
  OpenDDS::DCPS::TransportConfig_rch config(recoverCppObj<OpenDDS::DCPS::TransportConfig>(jni, jthis),
                                            false); // Don't take ownership
  OpenDDS::DCPS::TransportInst_rch inst(recoverCppObj<OpenDDS::DCPS::TransportInst>(jni, inst_jobj),
                                        false); // Don't take ownership
  config->instances_.push_back(inst);
}
예제 #3
0
// RtpsUdpInst::getMulticastGroupAddress
jstring JNICALL Java_OpenDDS_DCPS_transport_RtpsUdpInst_getMulticastGroupAddress
(JNIEnv * jni, jobject jthis)
{
  OpenDDS::DCPS::RtpsUdpInst_rch inst(recoverCppObj<OpenDDS::DCPS::RtpsUdpInst>(jni, jthis),
                                      false); // Don't take ownership
  ACE_TCHAR buffer[1024];
  inst->multicast_group_address_.addr_to_string(buffer, 1024, 1);
  std::string addr_str = ACE_TEXT_ALWAYS_CHAR(buffer);
  return jni->NewStringUTF(addr_str.c_str());
}
예제 #4
0
파일: xyDist.cpp 프로젝트: anamf/SKDB
xyDist::xyDist(InstanceStream *is)
{
  reset(is);

  instance inst(*is);

  while (!is->isAtEnd()) {
    if (is->advance(inst)) update(inst);
  }
}
예제 #5
0
bbtype_t pushmember(char* id, char* member) {
  std::string id_str(id);
  std::string member_str(member);

  sym_t* record = lookup_valid(id_str);
  sym_t* member_record = lookup_member(id_str, member_str);

  if (record->local) {
    int stack_offset = record->stack_offset;
    inst("push QWORD [r12 - %d]",
        (member_record->type_offset + stack_offset) * 8 + 8);

  } else {
    inst("push QWORD [%s_%d + %d]", id, record->scope,
        member_record->type_offset * 8);
  }

  return member_record->type;
}
예제 #6
0
int CShader::newShader(const char *shaderFile, int type, int eventToLink){
	if (!inst().enableShaders)
		return 0;

	shadersList.push_back(shaderInst(shaderFile, type));
	glAttachShader(events[eventToLink].shaderProg, shadersList.back().glID);
	usingProgram = false;
	glUseProgram(0);
	return shadersList.size() - 1;
}
예제 #7
0
파일: cfg.cpp 프로젝트: IshanRastogi/hhvm
/*
 * Find the immediate dominator of each block using Cooper, Harvey, and
 * Kennedy's "A Simple, Fast Dominance Algorithm", returned as a vector
 * of Block*, indexed by block.  IdomVector[b] == nullptr if b has no
 * dominator.  This is the case for the entry block and any blocks not
 * reachable from the entry block.
 */
IdomVector findDominators(const IRUnit& unit, const BlocksWithIds& blockIds) {
  auto& blocks = blockIds.blocks;
  auto& postIds = blockIds.ids;

  // Calculate immediate dominators with the iterative two-finger algorithm.
  // When it terminates, idom[post-id] will contain the post-id of the
  // immediate dominator of each block.  idom[start] will be -1.  This is
  // the general algorithm but it will only loop twice for loop-free graphs.
  IdomVector idom(unit, nullptr);
  auto start = blocks.begin();
  auto entry = *start;
  idom[entry] = entry;
  start++;
  for (bool changed = true; changed; ) {
    changed = false;
    // for each block after start, in reverse postorder
    for (auto it = start; it != blocks.end(); it++) {
      Block* block = *it;
      // p1 = any already-processed predecessor
      auto predIter = block->preds().begin();
      auto predEnd = block->preds().end();
      auto p1 = predIter->inst()->block();
      while (!idom[p1]) p1 = (++predIter)->inst()->block();
      // for all other already-processed predecessors p2 of block
      for (++predIter; predIter != predEnd; ++predIter) {
        auto p2 = predIter->inst()->block();
        if (p2 == p1 || !idom[p2]) continue;
        // find earliest common predecessor of p1 and p2
        // (higher postIds are earlier in flow and in dom-tree).
        do {
          while (postIds[p1] < postIds[p2]) p1 = idom[p1];
          while (postIds[p2] < postIds[p1]) p2 = idom[p2];
        } while (p1 != p2);
      }
      if (idom[block] != p1) {
        idom[block] = p1;
        changed = true;
      }
    }
  }
  idom[entry] = nullptr; // entry has no dominator.
  return idom;
}
예제 #8
0
파일: ir-unit.cpp 프로젝트: 2bj/hhvm
SSATmp* IRUnit::findConst(Type type) {
  assert(type.isConst());
  IRInstruction inst(DefConst, BCMarker());
  inst.setTypeParam(type);
  if (SSATmp* tmp = m_constTable.lookup(&inst)) {
    assert(tmp->type().equals(type));
    return tmp;
  }
  return m_constTable.insert(cloneInstruction(&inst)->dst());
}
예제 #9
0
SSATmp* IRFactory::findConst(ConstData& cdata, Type ctype) {
  IRInstruction inst(DefConst, BCMarker());
  inst.setExtra(&cdata);
  inst.setTypeParam(ctype);
  if (SSATmp* tmp = m_constTable.lookup(&inst)) {
    assert(tmp->type().equals(ctype));
    return tmp;
  }
  return m_constTable.insert(cloneInstruction(&inst)->dst());
}
예제 #10
0
static db_field_log * post(void *user, dbChannel *chan, db_field_log *pLog) {
    myStruct *my = (myStruct*)user;
    dbfl_freeFunc *dtor = NULL;

    if (my == puser1) {
        testOk(e1 & e_post, "post (1) called");
        testOk(!(c2 & e_post),
            "post (2) was not called before post (1)");
        c1 |= e_post;
        dtor = dbfl_free1;
    } else if (my == puser2) {
        testOk(e2 & e_post, "post (2) called");
        testOk(!(e1 & e_post) || c1 & e_post,
            "post (1) was called before post (2)");
        c2 |= e_post;
        dtor = dbfl_free2;
    } else {
        testFail("post: user pointer invalid");
        testSkip(1, "Can't check order of post(1)/post(2)");
    }
    testOk(!(e1 & e_pre) || c1 & e_pre,
        "pre (1) was called before post (%c)", inst(user));
    testOk(!(e2 & e_pre) || c2 & e_pre,
        "pre (2) was called before post (%c)", inst(user));

    if (!testOk(pLog->field_type == TYPE_START + my->offpost,
            "post (%c) got field log of expected type", inst(user)))
        testDiag("expected: %d, got %d",
            TYPE_START + my->offpost, pLog->field_type);
    pLog->field_type++;

    if (my->offpost == 0) { /* The first one registers a dtor and saves pfl */
        pLog->u.r.dtor = dtor;
        dtorpfl = pLog;
    }

    if (my->offpost == drop) {
        testDiag("post (%c) is dropping the field log", inst(user));
        return NULL;
    }
    return pLog;
}
예제 #11
0
파일: ir-unit.cpp 프로젝트: 5heri/hhvm
SSATmp* IRUnit::cns(Type type) {
  assertx(type.hasConstVal() ||
         type.subtypeOfAny(TUninit, TInitNull, TNullptr));
  IRInstruction inst(DefConst, BCMarker{});
  inst.setTypeParam(type);
  if (SSATmp* tmp = m_constTable.lookup(&inst)) {
    assertx(tmp->type() == type);
    return tmp;
  }
  return m_constTable.insert(clone(&inst)->dst());
}
예제 #12
0
void MemoryMapBuilderCS::processNode(MemoryMapNode *node)
{
    // Ignore user-land objects
    if (node->address() < _map->_vmem->memSpecs().pageOffset)
        return;

    // Create an instance from the node
    Instance inst(node->toInstance(false));

    processInstance(inst, node);
}
예제 #13
0
shared_ptr<OwCtrl> OwCtrl::Instance(const string &args)
{
    static map<string, shared_ptr<OwCtrl>> mapInst;
    auto it = mapInst.find(args);
    if (it != mapInst.end())
        return it->second;

    shared_ptr<OwCtrl> inst(new OwCtrl(args));
    mapInst[args] = std::move(inst);
    return mapInst[args];
}
예제 #14
0
CMPIStatus CmpiInstanceMI::driveCreateInstance
   (CMPIInstanceMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
    CMPIObjectPath* eCop, CMPIInstance* eInst)
{
   CmpiContext ctx(eCtx);
   CmpiResult rslt(eRslt);
   CmpiObjectPath cop(eCop);
   CmpiInstance inst(eInst);
   return ((CmpiInstanceMI*)mi->hdl)->createInstance
      (ctx,rslt,cop,inst).status();
}
예제 #15
0
/**
 * Find the last control instruction of the basic block.
 * This is usually the last one but (1) delayed-branch architecture insert instructions after the control
 * and (2) OTAWA CFG configuration system may make merge different blocks or ignore some control instructions.
 * If no control is found, return the last instruction.
 * @return	Last control instruction.
 */
Inst *BasicBlock::controlInst(void) const {
	Inst *control = 0, *last = 0;
	for(BasicBlock::InstIter inst(this); inst; inst++) {
		last = inst;
		if(inst->isControl())
			control = inst;
	}
	if(!control)
		control = last;
	return control;
}
예제 #16
0
CMPIStatus CmpiInstanceMI::driveSetInstance
   (CMPIInstanceMI* mi, CMPIContext* eCtx, CMPIResult* eRslt,
    CMPIObjectPath* eCop, CMPIInstance* eInst, const char** properties)
{
   CmpiContext ctx(eCtx);
   CmpiResult rslt(eRslt);
   CmpiObjectPath cop(eCop);
   CmpiInstance inst(eInst);
   return ((CmpiInstanceMI*)mi->hdl)->setInstance
      (ctx,rslt,cop,inst,properties).status();
}
예제 #17
0
파일: ir-unit.cpp 프로젝트: 2bj/hhvm
IRInstruction* IRUnit::defLabel(unsigned numDst, BCMarker marker) {
  IRInstruction inst(DefLabel, marker);
  IRInstruction* label = cloneInstruction(&inst);
  if (numDst > 0) {
    SSATmp* dsts = (SSATmp*) m_arena.alloc(numDst * sizeof(SSATmp));
    for (unsigned i = 0; i < numDst; ++i) {
      new (&dsts[i]) SSATmp(m_nextOpndId++, label);
    }
    label->setDsts(numDst, dsts);
  }
  return label;
}
예제 #18
0
파일: ir-unit.cpp 프로젝트: 5heri/hhvm
IRInstruction* IRUnit::defLabel(unsigned numDst, BCMarker marker) {
  IRInstruction inst(DefLabel, marker);
  auto const label = clone(&inst);
  if (numDst > 0) {
    auto const dstsPtr = new (m_arena) SSATmp*[numDst];
    for (unsigned i = 0; i < numDst; ++i) {
      dstsPtr[i] = newSSATmp(label);
    }
    label->setDsts(numDst, dstsPtr);
  }
  return label;
}
예제 #19
0
const AxmNode& ResourceManager::conf(const Arx::String &path) {
    AxmParser parser;

    ParsingContext ctxt;
    auto apath = adjustedPath(path);
    ctxt.rootDirectory = rootResourceDirectory(); // the base directory for resources in general
    ctxt.referenceDirectory = apath.parent(); // the directory containing the target file
    auto node = parser.parse(ctxt, readAll(apath.path.raw()));

    inst().confNodes.put(apath.path, node);
    return *node;
}
예제 #20
0
bbtype_t pushid(char* id) {
  std::string id_str(id);

  // ID must be previously declared for defined behavior.
  sym_t* st_entry = lookup_valid(id_str);

  int id_scope = st_entry->scope;
  bbtype_t type = st_entry->type;

  if (st_entry->local) {
    // We lookup the offset of the local variable needed, and add an 8 offset
    // to move past the saved ebp register for the stack frame.
    int offset = st_entry->stack_offset * 8 + 8;
    inst("push QWORD [r12 - %d]", offset);

  } else {
    inst("push QWORD [%s_%d]", id, id_scope);
  }

  return type;
}
void wlfPanel_AdvSettings::onChangeDayTime(const LLSD& value)
{
	// deactivate animator
	LLWLParamManager& inst(LLWLParamManager::instance());
	inst.mAnimator.deactivate();

	F32 val = value.asFloat() + 0.25f;
	if (val > 1.0f) --val;

	inst.mAnimator.setDayTime((F64)val);
	inst.mAnimator.update(inst.mCurParams);
}
예제 #22
0
bp::object CIMEnumerationContext::create(
    const boost::shared_ptr<Pegasus::CIMEnumerationContext> &ctx_ptr,
    const bool with_paths,
    const std::string &ns)
{
    bp::object inst(CIMBase<CIMEnumerationContext>::create());
    CIMEnumerationContext &fake_this = CIMEnumerationContext::asNative(inst);
    fake_this.m_enum_ctx_ptr = ctx_ptr;
    fake_this.m_is_with_paths = with_paths;
    fake_this.m_namespace = ns;
    return inst;
}
예제 #23
0
int main(int argc, char **argv)
{
    KAboutData aboutData("kwriteconfig", I18N_NOOP("KWriteConfig"), "1.0.0", I18N_NOOP("Write KConfig entries - for use in shell scripts"),
                         KAboutData::License_GPL, "(c) 2001 Red Hat, Inc. & Luís Pedro Coelho");
    aboutData.addAuthor("Luís Pedro Coelho", 0, "*****@*****.**");
    aboutData.addAuthor("Bernhard Rosenkraenzer", "Wrote kreadconfig on which this is based", "*****@*****.**");
    KCmdLineArgs::init(argc, argv, &aboutData);
    KCmdLineArgs::addCmdLineOptions(options);
    KCmdLineArgs *args = KCmdLineArgs::parsedArgs();

    QString group = QString::fromLocal8Bit(args->getOption("group"));
    QString key = QString::fromLocal8Bit(args->getOption("key"));
    QString file = QString::fromLocal8Bit(args->getOption("file"));
    QCString type = args->getOption("type").lower();


    if(key.isNull() || !args->count())
    {
        KCmdLineArgs::usage();
        return 1;
    }
    QCString value = args->arg(0);

    KInstance inst(&aboutData);

    KConfig *konfig;
    if(file.isEmpty())
        konfig = new KConfig(QString::fromLatin1("kdeglobals"), false, false);
    else
        konfig = new KConfig(file, false, false);

    konfig->setGroup(group);
    if(konfig->getConfigState() != KConfig::ReadWrite || konfig->entryIsImmutable(key))
        return 2;

    if(type == "bool")
    {
        // For symmetry with kreadconfig we accept a wider range of values as true than Qt
        bool boolvalue = (value == "true" || value == "on" || value == "yes" || value == "1");
        konfig->writeEntry(key, boolvalue);
    }
    else if(type == "path")
    {
        konfig->writePathEntry(key, QString::fromLocal8Bit(value));
    }
    else
    {
        konfig->writeEntry(key, QString::fromLocal8Bit(value));
    }
    konfig->sync();
    delete konfig;
    return 0;
}
int16_t BackgroundPlugin::handleEvent(const ANPEvent* evt) {
    switch (evt->eventType) {
        case kDraw_ANPEventType:
            gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request draw events", inst());
            break;
        case kLifecycle_ANPEventType:
            switch (evt->data.lifecycle.action)  {
                case kOnLoad_ANPLifecycleAction:
                    gLogI.log(kDebug_ANPLogType, " ------ %p onLoad", inst());
                    return 1;
                case kOnScreen_ANPLifecycleAction:
                    gLogI.log(kDebug_ANPLogType, " ------ %p onScreen", inst());
                    return 1;
                case kOffScreen_ANPLifecycleAction:
                    gLogI.log(kDebug_ANPLogType, " ------ %p offScreen", inst());
                    return 1;
            }
            break; // end kLifecycle_ANPEventType
        case kTouch_ANPEventType:
            if (kLongPress_ANPTouchAction == evt->data.touch.action) {
                browser->geturl(inst(), "javascript:alert('Detected long press event.')", 0);
                gWindowI.requestFullScreen(inst());
            }
            else if (kDoubleTap_ANPTouchAction == evt->data.touch.action)
                browser->geturl(inst(), "javascript:alert('Detected double tap event.')", 0);
            break;
        case kKey_ANPEventType:
            gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request key events", inst());
            break;
        default:
            break;
    }
    return 0;   // unknown or unhandled event
}
예제 #25
0
bbtype_t pusharr(char* id, bbtype_t index_type) {
  std::string id_str(id);

  typechk_index(index_type);

  sym_t* st_entry = lookup_valid(id_str);
  bbtype_t id_type = st_entry->type;

  inst("pop rbx");
  array_bounds_check(st_entry);

  if (st_entry->local) {
    int offset = st_entry->stack_offset * 8 + 8;
    inst("neg rbx");
    inst("push QWORD [r12 + rbx * 8 - %d]", offset);

  } else {
    inst("push QWORD [%s_%d + rbx * 8]", id, st_entry->scope);
  }

  return id_type;
}
예제 #26
0
//------------------------------------------------------------------------------
// Name: set_address
// Desc:
//------------------------------------------------------------------------------
void DialogAssembler::set_address(edb::address_t address) {
	address_ = address;
	ui->address->setText(edb::v1::format_pointer(address_));

	quint8 buffer[edb::Instruction::MAX_SIZE];
	if(const int size = edb::v1::get_instruction_bytes(address, buffer)) {
		edb::Instruction inst(buffer, buffer + size, address, std::nothrow);
		if(inst) {
			ui->assembly->setEditText(QString::fromStdString(edb::v1::formatter().to_string(inst)));
			instruction_size_ = inst.size();
		}
	}
}
예제 #27
0
std::shared_ptr<Shader> ResourceManager::shader(const Arx::String &path) {
    return inst().shaders.getOrElseUpdate(path,[&](){
        auto ret = std::make_shared<Shader>();

        auto vpath = ResourceManager::adjustedPath(path + ".vertex");
        Arx::String vsrc = readAll(vpath.path.raw());
        auto fpath = ResourceManager::adjustedPath(path + ".fragment");
        Arx::String fsrc = readAll(fpath.path.raw());

        ret->load(vsrc.raw(),fsrc.raw());
        return ret;
    });
}
예제 #28
0
SSATmp* TraceBuilder::cseLookup(IRInstruction* inst,
                                const folly::Optional<IdomVector>& idoms) {
  auto tmp = cseHashTable(inst)->lookup(inst);
  if (tmp && idoms) {
    // During a reoptimize pass, we need to make sure that any values
    // we want to reuse for CSE are only reused in blocks dominated by
    // the block that defines it.
    if (!dominates(tmp->inst()->block(), inst->block(), *idoms)) {
      return nullptr;
    }
  }
  return tmp;
}
예제 #29
0
SmartTexture* TextureCache::getTexture(std::string texPath)
{
	TextureCache* tc = inst();
	std::map<std::string, SmartTexture*>::iterator mit = tc->_texMap.find(texPath);
	if (mit == tc->_texMap.end())
	{
		SmartTexture* tex = new SmartTexture(texPath);
		tc->_texMap.insert(std::make_pair(texPath, tex));
		return tex;
	}

	return mit->second;
}
Inst buildCCall(Code& code, Value* origin, const Vector<Arg>& arguments)
{
    Inst inst(Patch, origin, Arg::special(code.cCallSpecial()));
    inst.args.append(arguments[0]);
    inst.args.append(Tmp(GPRInfo::returnValueGPR));
    inst.args.append(Tmp(GPRInfo::returnValueGPR2));
    inst.args.append(Tmp(FPRInfo::returnValueFPR));
    for (unsigned i = 1; i < arguments.size(); ++i) {
        Arg arg = arguments[i];
        if (arg.isTmp())
            inst.args.append(arg);
    }
    return inst;
}