Beispiel #1
0
	void input_system::load_bindings()
	{
		auto config = config_system();
		const auto tree = config.get_tree(config::type::input);

		for (auto const & device_node : tree)
		{
			const string & device = device_node.first;
			const auto & input_types = device_node.second;

			for (auto const & input_node : input_types)
			{
				const string & type = input_node.first;
				const auto & codes_tree = input_node.second;

				for (auto const & code_node : codes_tree)
				{
					const string & code = code_node.first;
					const string & name = code_node.second.get_value<string>();

					if (device == "keyboard")
					{
						keyboard_binds.push_back(binding(code, type, name));
					}
					else if (device == "mouse")
					{
						mouse_binds.push_back(binding(code, type, name));
					}
				}
			}
		}
	}
Beispiel #2
0
BOOL CIISConfigHelper::EnumWebSitesFromXML(std::vector<IISWebSite>& sites)
{
	sites.clear();

	// connect to the config file
	CComPtr<IXMLDOMDocument> pDOM;
	HRESULT hr = CIIS7XMLConfigHelper::GetApplicationHostConfigDocument(&pDOM);
	if (hr != S_OK || pDOM == NULL)
		return FALSE;

	// get the site collection
	CComPtr<IXMLDOMNodeList> pSites;
	hr = CIIS7XMLConfigHelper::GetSitesCollection(pDOM, &pSites);
	if (hr != S_OK)
		return FALSE;

	long nSites = 0;
	pSites->get_length(&nSites);

	// loop thru the available sites
	for (long i = 0; i < nSites; i++)
	{
		CComPtr<IXMLDOMNode> pSite;
		hr = pSites->get_item(i, &pSite);
		if (hr != S_OK || pSite == NULL)
			continue;

		IISWebSite item;		
		item.eSource = IISWebSite::XML;

		CAtlArray<CAtlString> Ports;
		CAtlArray<CAtlString> SecurePorts;

		hr = CIIS7XMLConfigHelper::GetSiteInfo(pSite, item.sInstance, item.sDescription, item.sFileSystemPath, Ports, SecurePorts);
		if (hr != S_OK)
			continue;

		const int nPorts = (int) Ports.GetCount();
		for (int i = 0; i < nPorts; i++)
		{
			IISWebSiteBindings binding(Ports[i]);
			item.Ports.Add(binding);
		}

		const int nSecurePorts = (int) SecurePorts.GetCount();
		for (int i = 0; i < nSecurePorts; i++)
		{
			IISWebSiteBindings binding(SecurePorts[i]);
			item.Ports.Add(binding);
		}

		sites.push_back(item);
	}

	return TRUE;
}
void breakpoint_Relocation::unpack_data() {
  _bits = live_bits();

  int targetlen = datalen() - 1 - instrlen();
  jint target_bits = 0;
  if (targetlen == 0)       target_bits = 0;
  else if (targetlen == 1)  target_bits = binding()->short_data_at(1);
  else if (targetlen == 2)  target_bits = binding()-> long_data_at(1);
  else                      { ShouldNotReachHere(); }

  _target = internal() ? address_from_scaled_offset(target_bits)
		       : index_to_runtime_address  ((intptr_t)target_bits);
}
Beispiel #4
0
//--------------------------------------------------------------
void ofApp::setup(){
	ofMesh mesh;
	mesh.setMode(OF_PRIMITIVE_POINTS);
	mesh.getVertices().resize(numVertices);
	ofSetBackgroundColor(0);

	ofShader::TransformFeedbackSettings settings;
	settings.shaderFiles[GL_VERTEX_SHADER] = "vert.glsl";
	settings.bindDefaults = false;
	settings.varyingsToCapture = { "v_position", "v_color" };
	shader.setup(settings);


	buffer.allocate(sizeof(glm::vec4) * 2 * numVertices, GL_STATIC_DRAW);

	ofShader::TransformFeedbackBinding binding(buffer);
	binding.index = 0;
	binding.offset = 0;
	binding.size = numVertices * sizeof(glm::vec4) * 2;
	
	shader.beginTransformFeedback(GL_POINTS, binding);
	mesh.draw();
	shader.endTransformFeedback(binding);

	vbo.setVertexBuffer(buffer, 4, sizeof(glm::vec4) * 2, 0);
	vbo.setColorBuffer(buffer, sizeof(glm::vec4) * 2, sizeof(glm::vec4));

	ofEnablePointSprites();
	glPointSize(4);
	cam.setDistance(2400);
	cam.orbit(80, 80, 2400, { 0.f, 0.f, 0.f });
}
Beispiel #5
0
/*!
  Returns the application providing the \a service or
  a null string if there is no such service.

  If \a appname is provided, a specific binding to that application may
  be used rather than the global binding.

  \sa apps()
*/
QString QtopiaService::app(const QString& service, const QString& appname)
{
    QSettings cfg("Trolltech",binding(service));
    QString r;
    if ( cfg.status()==QSettings::NoError ) {
        cfg.beginGroup("Service");
        if  (!appname.isEmpty())
            r = cfg.value(appname).toString();
        if ( r.isNull() )
            r = cfg.value("default").toString();
    }
    if ( r.isNull() ) {
        QDir dir(Qtopia::qtopiaDir()+"services/"+service, QString("*"),
          QDir::Unsorted, QDir::Files );

        if ( dir.count() )
        {
            r = dir[0]; //use any as a default
            for( unsigned int i = 0 ; i < dir.count() ; ++i )
                if( dir[i] == appname )
                    r = dir[i]; //but use specific if it exists
        }
    }
    return r;
}
Beispiel #6
0
bool Apsis::Backend::Sdl::poll(Apsis::Engine::Event& event) {
#ifndef NO_SDL
  SDL_Event sdl_event;

  if (SDL_PollEvent(&sdl_event)) {
    if(sdl_event.type == SDL_QUIT) {
      event.systemEvent(Apsis::Engine::Event::SystemEvent::Quit);
      return true;
    }

    // TODO: Get rid of this need for constructing a fake binding!
    //       Do that and we never need a mutable Binding.
    Apsis::Input::Binding binding(Apsis::Key::A, false, false, false);
    bool pressed = true;
    if (sdl_event.type == SDL_MOUSEMOTION) {
      float x = sdl_event.motion.x;
      float y = sdl_event.motion.y;
      event.motion(x, y);
      return true;
    }
    else if (_translateSDLKey(binding, sdl_event, pressed)) {
      float x, y;
      _translateSDLPosition(x, y, sdl_event);
      event.binding(binding, x, y, pressed);
      return true;
    }
    return false;
  }
#endif
  return false;
}
void test(Handle<es::Context> root)
{
    Handle<es::Iterator>   iter;
    Handle<es::File>       file;
    Handle<es::Stream>     stream;
    long long           size = 0;

    // List the root directory
    iter = root->list("");
    while (iter->hasNext())
    {
        char name[1024];
        Handle<es::Binding> binding(iter->next());
        binding->getName(name, sizeof name);
#ifdef VERBOSE
        esReport("'%s'\n", name);
#endif // VERBOSE
    }

    // Read
    file = root->lookup("NOTICE");
    TEST(file);
    size = file->getSize();
#ifdef VERBOSE
    esReport("Size: %lld\n", size);
#endif // VERBOSE
    u8* buf = new u8[size];
    stream = file->getStream();
    TEST(stream);
    stream->read(buf, size);
#ifdef VERBOSE
    esReport("%.*s\n", (int) size, buf);
#endif // VERBOSE
    delete [] buf;
}
Beispiel #8
0
AutoPtr<Host> Network::GetHostBinding(const std::string& hostname)
{
    AutoPtr<Host> binding(new Host(hostname));
    if (binding->IsInvalid())
        throw ValueException::FromString("Could not resolve address");

    return binding;
}
static ElfSymbolIR::ElfSymbolBinding
GetElfSymbolBinding(const JsonObjectRef &elf_symbol) {
  std::string binding(elf_symbol.GetString("binding"));
  if (binding.empty()) {
    return default_elf_symbol_binding_ir;
  }
  return FindInMap(elf_symbol_binding_json_to_ir, binding,
                   "Failed to convert JSON to ElfSymbolBinding");
}
Beispiel #10
0
bool OptionsMenu::capture_joybuttondown(int button) {
    gui.pop_window();
    std::string key(capture_get_config_id());
    MappedKey binding(MappedKey::DeviceJoyButton, button);
    KeyBinding::write_binding(config, binding, key);
    capture_draw(binding, ck_selected);
    ck_selected = 0;
    return true;
}
Beispiel #11
0
bool ParamManager::
bind(const std::string& iSubKey, Gtk::Scale& iWidget) {
  Binding::Ptr binding(new Binding());
  binding->mSubKey = iSubKey;
  binding->mWidget = &iWidget;
  binding->mType = WidgetTypeSlider;
  mBindings[iSubKey] = binding;
  return true;
}
Beispiel #12
0
const FieldBinding& SoapServerInternal::GetFieldBinding(const ::google::protobuf::FieldDescriptor* descriptor)
{
	if (m_fieldBindings.find(descriptor->full_name()) == m_fieldBindings.end())
	{
		FieldBinding binding(descriptor, this);
		m_fieldBindings[descriptor->full_name()] = binding;
	}

	return m_fieldBindings[descriptor->full_name()];
}
Beispiel #13
0
bool Program::setUniform( const char* name, float value )
{
	int location = getUniformLocation(name);
	if(location == -1)
		return false;

	ProgramBinding binding(context(), this);
	glUniform1f(location, value);
	return true;
}
Beispiel #14
0
const FieldBinding& SoapServerInternal::GetFieldBinding(const string& name, const string& type, size_t offset, size_t size, int flags)
{
	if (m_fieldBindings.find(name) == m_fieldBindings.end())
	{
		FieldBinding binding(name, type, offset, size, flags);
		m_fieldBindings[name] = binding;
	}

	return m_fieldBindings[name];
}
Beispiel #15
0
bool OptionsMenu::capture_keydown(int keycode) {
    gui.pop_window();

    std::string key(capture_get_config_id());
    MappedKey binding(MappedKey::DeviceKeyboard, keycode);
    KeyBinding::write_binding(config, binding, key);
    capture_draw(binding, ck_selected);
    ck_selected = 0;

    return true;
}
Beispiel #16
0
PyObject *
LDAPConnectIter_iternext(LDAPConnectIter *self) {
	int rc = -1;
	PyObject *val = NULL;
	PyObject *wrapper = NULL;

	/* The connection is already binded. */
	if (self->conn->closed == 0) {
		return PyErr_Format(PyExc_StopIteration, "Connection is already open.");
	}

	if (self->init_finished == 0) {
		rc = LDAP_finish_init(self->async, (void *)self->thread, (void *)self->data, &(self->conn->ld));
		if (rc == -1) return NULL; /* Error is happened. */
		if (rc == 1) {
			/* Initialisation is finished. */
			self->init_finished = 1;
			if (update_conn_info(self->conn->ld, self->info) != 0) return NULL;
		}
	} else {
		/* Init for the LDAP structure is finished, TLS (if it is needed) already set, start binding. */
		val = binding(self);
		if (val == NULL) return NULL;
		if (val != Py_None) {
			if (self->async) {
				/* Raise a StopIteration error to imitate a generator func. */
				/* Need some workaround (Python Issue #23996). */
				PyObject *args = Py_BuildValue("(O)", val);
				wrapper = PyObject_CallObject(PyExc_StopIteration, args);
				Py_DECREF(args);
				if (wrapper == NULL) {
					Py_DECREF(val);
					PyErr_BadInternalCall();
					return NULL;
				}
				/* Embedding StopIterator into StopIterator to
				   avoid *_PyGen_FetchStopIterationValue() crashes */
				((PyStopIterationObject *)wrapper)->value = val;
				PyErr_SetObject(PyExc_StopIteration, wrapper);
				return NULL;
			} else {
				/* Simple return the LDAPConnection object. */
				return val;
			}
		}
	}
	if (self->async) {
		Py_RETURN_NONE;
	} else {
		/* If the connection is not asynchronous, then call next() */
		/* automatically, until an error or the LDAPConnection occurs.  */
		return LDAPConnectIter_iternext(self);
	}
}
Beispiel #17
0
int main()
{
    int a=1;
    int b=2;
    a_to_b<int> fun1;
    fun1( &a, &b);

    binding( fun1);

    return 1;
}
Beispiel #18
0
const bool Bindings::addBinding(const BindingPtr b)
{
    Q_ASSERT(d);

    if(binding(b)) {
        return false;   // it's already there
    }

    d->bindings.append(b);
    d->updateIndexesOnAdd(b);

    return true;
}
Beispiel #19
0
void texture::parameter(GLenum pname, float param)
{
    gl_assert_error("entering texture::parameter(GLenum, float)");
#ifdef SCM_GL_USE_DIRECT_STATE_ACCESS
    glTextureParameterfEXT(id(), target(), pname, param);
#else // SCM_GL_USE_DIRECT_STATE_ACCESS
    binding_guard guard(target(), binding());
    bind();
    glTexParameterf(target(), pname, param);
    unbind();
#endif // SCM_GL_USE_DIRECT_STATE_ACCESS
    gl_assert_error("exiting texture::parameter(GLenum, float)");
}
Beispiel #20
0
//------------------------------------------------------------------------------
bind_resolver::binding bind_resolver::next()
{
    // Push remaining input through the tree.
    if (m_pending_input)
    {
        m_pending_input = false;

        unsigned int keys_remaining = m_key_count - m_tail;
        if (!keys_remaining || keys_remaining >= sizeof_array(m_keys))
        {
            reset();
            return binding();
        }

        for (int i = m_tail, n = m_key_count; i < n; ++i)
            if (step_impl(m_keys[i]))
                break;
    }

    // Go along this depth's nodes looking for valid binds.
    while (m_node_index)
    {
        const binder::node& node = m_binder.get_node(m_node_index);

        // Move iteration along to the next node.
        int node_index = m_node_index;
        m_node_index = node.next;

        // Check to see if where we're currently at a node in the tree that is
        // a valid bind (at the point of call).
        int key_index = m_tail + node.depth - 1;
        if (node.bound && (!node.key || node.key == m_keys[key_index]))
            return binding(this, node_index);
    }

    // We can't get any further traversing the tree with the input provided.
    reset();
    return binding();
}
Beispiel #21
0
void SoapServerInternal::RegisterClassBinding(const type_info& type, vector<const FieldBinding*>& fields, CreateObjectCallback callback)
{
	shared_ptr<NativeClassHelper> helper(new NativeClassHelper(this, callback));

	ClassBinding binding(GetTypeName(type), helper);

	for (size_t x = 0; x < fields.size(); ++x)
	{
		m_fieldBindings[fields[x]->GetName()] = *fields[x];
		binding.AddField(m_fieldBindings[fields[x]->GetName()]);
	}

	m_classBindings[GetTypeName(type)] = binding;
}
bool QtSignalForwarder::bind(QObject* sender, QEvent::Type event, const QtMetacallAdapter& callback, EventFilterFunc filter)
{
	if (!checkTypeMatch(callback, QList<QByteArray>())) {
		qWarning() << "Callback does not take 0 arguments";
		return false;
	}

	setupDestroyNotify(sender);
	sender->installEventFilter(this);

	EventBinding binding(sender, event, callback, filter);
	m_eventBindings.insertMulti(sender, binding);

	return true;
}
QSparqlResultRow QTrackerDirectSyncResult::current() const
{
    // Note: this function reads and constructs the data again every time it's called.
    if (!cursor || pos() == QSparql::BeforeFirstRow || pos() == QSparql::AfterLastRow)
        return QSparqlResultRow();

    QSparqlResultRow resultRow;
    // get the no. of columns only once; it won't change between rows
    if (n_columns < 0)
        n_columns = tracker_sparql_cursor_get_n_columns(cursor);

    for (int i = 0; i < n_columns; i++) {
        resultRow.append(binding(i));
    }
    return resultRow;
}
Beispiel #24
0
/* We catch all qt_metacall invocations */
extern "C" SEXP qt_qmetacall(SEXP x, SEXP s_call, SEXP s_id, SEXP s_args)
{
  SmokeObject *so = SmokeObject::fromSexp(x);
  QMetaObject::Call call =
    enum_from_sexp<QMetaObject::Call>(s_call, SmokeType());
  int id = from_sexp<int>(s_id);
  void **args = reinterpret_cast<void **>(from_sexp<void *>(s_args));
  
  // Assume the target slot is a C++ one
  Smoke::StackItem i[4];
  i[1].s_enum = call;
  i[2].s_int = id;
  i[3].s_voidp = args;
  so->invokeMethod("qt_metacall$$?", i);
  int ret = i[0].s_int;
  if (ret < 0) {
    return ScalarInteger(ret);
  }

  if (call != QMetaObject::InvokeMetaMethod)
    return ScalarInteger(id);

  QObject * qobj = reinterpret_cast<QObject *>(so->castPtr("QObject"));
  // get obj metaobject with a virtual call
  const QMetaObject *metaobject = qobj->metaObject();
  
  // get method count
  int count = metaobject->methodCount();
  
  QMetaMethod method = metaobject->method(id);
  if (method.methodType() == QMetaMethod::Signal) {
    // FIXME: this override of 'activate' is obsolete
    metaobject->activate(qobj, id, (void**) args);
    return ScalarInteger(id - count);
  }
  DynamicBinding binding(MocMethod(so->smoke(), metaobject, id));
  QVector<SmokeType> stackTypes = binding.types();
  MocStack mocStack = MocStack(args, stackTypes.size());
  SmokeStack smokeStack = mocStack.toSmoke(stackTypes);
  binding.invoke(so, smokeStack.items());
  mocStack.returnFromSmoke(smokeStack, stackTypes[0]);
  if (binding.lastError() == Method::NoError)
    warning("Slot invocation failed for %s::%s", so->klass()->name(),
            binding.name());
  
  return ScalarInteger(id - count);
}
Beispiel #25
0
bool Program::setUniform( const char* name, int length, const float* values )
{
	int location = getUniformLocation(name);
	if(location == -1)
		return false;

	ProgramBinding binding(context(), this);
	switch(length)
	{
		case 1: glUniform1fv(location, 1, values); break;
		case 2: glUniform2fv(location, 1, values); break;
		case 3: glUniform3fv(location, 1, values); break;
		case 4: glUniform4fv(location, 1, values); break;
		default: assert(false);
	}
	return true;
}
Beispiel #26
0
UDPServer::UDPServer(USHORT Port)
{
	port = Port;
	BUFLEN = 1400;
	slen = sizeof(si_other);

	//Initialise winsock
	printf("\nInitialising Winsock...");
	init();

	//Create a socket
	create();

	//Bind
	binding();

}
Beispiel #27
0
const BindingPtr Bindings::addBinding(
        const QString& conn /*= QString::null*/,
        const QString& var /*= QString::null*/,
        const QString& view /*= QString::null*/,
        const QString& panel /*= QString::null*/,
        const QString& templ /*= QString::null*/,
        const QString& iopin /*= QString::null*/)
{
    Q_ASSERT(d);

    BindingPtr bp = binding(conn, var, view, panel, templ, iopin);
    if(!bp.isNull()) {
        return bp;
    }

    bp = BindingPtr(new Binding(conn, var, view, panel, templ, iopin));
    addBinding(bp);

    return bp;
}
Beispiel #28
0
ClassBinding& SoapServerInternal::GetClassBinding(const ::google::protobuf::Descriptor* descriptor)
{
	if (m_classBindings.find(descriptor->full_name()) == m_classBindings.end())
	{
		ClassBinding binding(descriptor->name(), shared_ptr<ProtobufClassHelper>(new ProtobufClassHelper(*this, descriptor)));

		if (descriptor->containing_type())
		{
			binding.SetParent(GetClassBinding(descriptor->containing_type()));
		}

		for (int x = 0; x < descriptor->field_count(); ++x)
		{
			binding.AddField(GetFieldBinding(descriptor->field(x)));
		}

		m_classBindings[descriptor->full_name()] = binding;
	}

	return m_classBindings[descriptor->full_name()];
}
Beispiel #29
0
Option& Option::binding(const std::string& propertyName)
{
	return binding(propertyName, 0);
}
/* Lookup the index-th entry of the directory with the given path, starting
   at the root of the file system. Set the name, name length, creation date,
   creation time, directory flag, and file size (if the entry is a file).
   Return:  0   if a entry is found at the given index
            1   if the directory has fewer than index entries
            2   if the given path has bad syntax or does not reach a directory
*/
int dir_Lookup(char *pathString, int pathStringLength, int index /* starting at 1 */,
               // outputs:
               char *name, int *nameLength, int *creationDate, int *modificationDate,
               int *isDirectory, squeakFileOffsetType *sizeIfFile)
{
    /* default return values */
    *name             = 0;
    *nameLength       = 0;
    *creationDate     = 0;
    *modificationDate = 0;
    *isDirectory      = false;
    *sizeIfFile       = 0;

    // copy the file name into a null-terminated C string
    char cPathName[1001];
    if (sizeof cPathName <= pathStringLength)
    {
        return BAD_PATH;
    }
    sqFilenameFromString(cPathName, pathString, pathStringLength);

    /* get file or directory info */
    int i;
    Handle<es::Iterator> iter(gRoot->list(cPathName));
    if (!iter)
    {
        return BAD_PATH;
    }
    for (i = 1; iter->hasNext(); ++i)
    {
        Handle<es::Binding> binding(iter->next());
        if (i == index)
        {
            binding->getName(name, MAX_PATH);
            *nameLength = strlen(name);

            Handle<es::File> file(binding);
            if (file)
            {
                long long tick;
                tick = file->getCreationTime();
                *creationDate = convertToSqueakTime(tick);
                tick = file->getLastWriteTime();
                *modificationDate = convertToSqueakTime(tick);
            }

            Handle<es::Context> context(binding);
            if (context)
            {
                *isDirectory = true;
                *sizeIfFile = 0;
            }
            else
            {
                Handle<es::Stream> stream(file->getStream());  // XXX Check exception
                if (stream)
                {
                    *isDirectory = false;
                    long long size;
                    size = stream->getSize();
                    *sizeIfFile = size;
                }
                else
                {
                    ++index;
                    continue;
                }
            }
            return ENTRY_FOUND;
        }
    }
    return NO_MORE_ENTRIES;
}