static void
add_send_options_to_source (EGwSendOptions *n_opts)
{
	GConfClient *gconf = gconf_client_get_default ();
	ESource *csource, *tsource;
	ESourceList *list;
	EGwSendOptionsGeneral *gopts;
	EGwSendOptionsStatusTracking *topts, *copts;

	list = e_source_list_new_for_gconf (gconf, "/apps/evolution/calendar/sources");
	csource = get_source (list);

	list = e_source_list_new_for_gconf (gconf, "/apps/evolution/tasks/sources");
	tsource = get_source (list);

	gopts = e_gw_sendoptions_get_general_options (n_opts);
	copts = e_gw_sendoptions_get_status_tracking_options (n_opts, "calendar");
	topts = e_gw_sendoptions_get_status_tracking_options (n_opts, "task");

	if (csource)
		put_options_in_source (csource, gopts, copts);

	if (tsource)
		put_options_in_source (tsource, gopts, topts);

	g_object_unref (gconf);
}
Beispiel #2
0
    static void construct(PyObject* obj, rvalue_from_python_stage1_data* data)
    {
        void* storage = ((rvalue_from_python_storage<Target>*)data)->storage.bytes;

        arg_from_python<Source> get_source(obj);
        bool convertible = get_source.convertible();
        BOOST_VERIFY(convertible);
        
        new (storage) Target(get_source());
        
        // record successful construction
        data->convertible = storage;
    }
Beispiel #3
0
	std::wstring render(bool propper, std::wstring syntax, std::wstring date_format = DATE_FORMAT, DWORD langId = 0) const {
		if (propper) {
			// To obtain the appropriate message string from the message file, load the message file with the LoadLibrary function and use the FormatMessage function
			strEx::replace(syntax, _T("%message%"), render_message(langId));
		} else {
			strEx::replace(syntax, _T("%message%"), _T("%message% needs the descriptions flag set!"));
		}

		strEx::replace(syntax, _T("%source%"), get_source());
		strEx::replace(syntax, _T("%computer%"), get_computer());
		strEx::replace(syntax, _T("%generated%"), strEx::format_date(get_time_generated(), date_format));
		strEx::replace(syntax, _T("%written%"), strEx::format_date(get_time_written(), date_format));
		strEx::replace(syntax, _T("%generated-raw%"), strEx::itos(pevlr_->TimeGenerated));
		strEx::replace(syntax, _T("%written-raw%"), strEx::itos(pevlr_->TimeWritten));
		strEx::replace(syntax, _T("%type%"), translateType(eventType()));
		strEx::replace(syntax, _T("%category%"), strEx::itos(pevlr_->EventCategory));
		strEx::replace(syntax, _T("%facility%"), strEx::itos(facility()));
		strEx::replace(syntax, _T("%qualifier%"), strEx::itos(facility()));
		strEx::replace(syntax, _T("%customer%"), strEx::itos(customer()));
		strEx::replace(syntax, _T("%rawid%"), strEx::itos(raw_id()));
		strEx::replace(syntax, _T("%severity%"), translateSeverity(severity()));
		strEx::replace(syntax, _T("%strings%"), enumStrings());
		strEx::replace(syntax, _T("%log%"), file_);
		strEx::replace(syntax, _T("%file%"), file_);
		strEx::replace(syntax, _T("%id%"), strEx::itos(eventID()));
		strEx::replace(syntax, _T("%user%"), userSID());
		return syntax;
	}
Beispiel #4
0
	std::wstring get_dll() const {
		try {
			return simple_registry::registry_key::get_string(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Services\\EventLog\\") + file_ + (std::wstring)_T("\\") + get_source(), _T("EventMessageFile"));
		} catch (simple_registry::registry_exception &e) {
			NSC_LOG_ERROR_STD(_T("Could not extract DLL for eventsource: ") + get_source() + _T(": ") + e.what());
			return _T("");
		}
	}
Beispiel #5
0
	bool get_dll(std::wstring &file_or_error) const {
		try {
			file_or_error = simple_registry::registry_key::get_string(HKEY_LOCAL_MACHINE, _T("SYSTEM\\CurrentControlSet\\Services\\EventLog\\") + utf8::cvt<std::wstring>(file_) + (std::wstring)_T("\\") + get_source(), _T("EventMessageFile"));
			return true;
		} catch (simple_registry::registry_exception &e) {
			file_or_error = _T("Could not extract DLL for eventsource: ") + get_source() + _T(": ") + utf8::cvt<std::wstring>(e.reason());
			return false;
		}
	}
Beispiel #6
0
static void
fi_gui_sources_select_helper(GtkTreeModel *unused_model,
	GtkTreePath *unused_path, GtkTreeIter *iter, void *user_data)
{
	GSList **sources_ptr = user_data;

	(void) unused_model;
	(void) unused_path;
	*sources_ptr = g_slist_prepend(*sources_ptr, get_source(iter));
}
Beispiel #7
0
void get_one_param( char *arg ) {
    if ( isparam( arg ) )                 // -X , +X or /X
        get_option( arg );
    else if ( *arg == '@' ) {               // @filename
        if ( ! get_param_file( arg + 1 )  )
            error( ERR_RUNTIME, arg + 1 );
    }
    else
        get_source( arg );             // file.ext
}
Beispiel #8
0
/*
 * mount 'source_mnt' under the destination 'dest_mnt' at
 * dentry 'dest_dentry'. And propagate that mount to
 * all the peer and slave mounts of 'dest_mnt'.
 * Link all the new mounts into a propagation tree headed at
 * source_mnt. Also link all the new mounts using ->mnt_list
 * headed at source_mnt's ->mnt_list
 *
 * @dest_mnt: destination mount.
 * @dest_dentry: destination dentry.
 * @source_mnt: source mount.
 * @tree_list : list of heads of trees to be attached.
 */
int propagate_mnt(struct mount *dest_mnt, struct mountpoint *dest_mp,
		    struct mount *source_mnt, struct hlist_head *tree_list)
{
	struct user_namespace *user_ns = current->nsproxy->mnt_ns->user_ns;
	struct mount *m, *child;
	int ret = 0;
	struct mount *prev_dest_mnt = dest_mnt;
	struct mount *prev_src_mnt  = source_mnt;
	HLIST_HEAD(tmp_list);

	for (m = propagation_next(dest_mnt, dest_mnt); m;
			m = propagation_next(m, dest_mnt)) {
		int type;
		struct mount *source;

		if (IS_MNT_NEW(m))
			continue;

		source =  get_source(m, prev_dest_mnt, prev_src_mnt, &type);

		/* Notice when we are propagating across user namespaces */
		if (m->mnt_ns->user_ns != user_ns)
			type |= CL_UNPRIVILEGED;

		child = copy_tree(source, source->mnt.mnt_root, type);
		if (IS_ERR(child)) {
			ret = PTR_ERR(child);
			tmp_list = *tree_list;
			tmp_list.first->pprev = &tmp_list.first;
			INIT_HLIST_HEAD(tree_list);
			goto out;
		}

		if (is_subdir(dest_mp->m_dentry, m->mnt.mnt_root)) {
			mnt_set_mountpoint(m, dest_mp, child);
			hlist_add_head(&child->mnt_hash, tree_list);
		} else {
			/*
			 * This can happen if the parent mount was bind mounted
			 * on some subdirectory of a shared/slave mount.
			 */
			hlist_add_head(&child->mnt_hash, &tmp_list);
		}
		prev_dest_mnt = m;
		prev_src_mnt  = child;
	}
out:
	lock_mount_hash();
	while (!hlist_empty(&tmp_list)) {
		child = hlist_entry(tmp_list.first, struct mount, mnt_hash);
		umount_tree(child, 0);
	}
	unlock_mount_hash();
	return ret;
}
Beispiel #9
0
/*
 * mount 'source_mnt' under the destination 'dest_mnt' at
 * dentry 'dest_dentry'. And propagate that mount to
 * all the peer and slave mounts of 'dest_mnt'.
 * Link all the new mounts into a propagation tree headed at
 * source_mnt. Also link all the new mounts using ->mnt_list
 * headed at source_mnt's ->mnt_list
 *
 * @dest_mnt: destination mount.
 * @dest_dentry: destination dentry.
 * @source_mnt: source mount.
 * @tree_list : list of heads of trees to be attached.
 */
int propagate_mnt(struct mount *dest_mnt, struct dentry *dest_dentry,
		    struct mount *source_mnt, struct list_head *tree_list)
{
	struct user_namespace *user_ns = current->nsproxy->mnt_ns->user_ns;
	struct mount *m, *child;
	int ret = 0;
	struct mount *prev_dest_mnt = dest_mnt;
	struct mount *prev_src_mnt  = source_mnt;
	LIST_HEAD(tmp_list);
	LIST_HEAD(umount_list);

	for (m = propagation_next(dest_mnt, dest_mnt); m;
			m = propagation_next(m, dest_mnt)) {
		int type;
		struct mount *source;

		if (IS_MNT_NEW(m))
			continue;

		source =  get_source(m, prev_dest_mnt, prev_src_mnt, &type);

		/* Notice when we are propagating across user namespaces */
		if (m->mnt_ns->user_ns != user_ns)
			type |= CL_UNPRIVILEGED;

		child = copy_tree(source, source->mnt.mnt_root, type);
		if (IS_ERR(child)) {
			ret = PTR_ERR(child);
			list_splice(tree_list, tmp_list.prev);
			goto out;
		}

		if (is_subdir(dest_dentry, m->mnt.mnt_root)) {
			mnt_set_mountpoint(m, dest_dentry, child);
			list_add_tail(&child->mnt_hash, tree_list);
		} else {
			/*
			 * This can happen if the parent mount was bind mounted
			 * on some subdirectory of a shared/slave mount.
			 */
			list_add_tail(&child->mnt_hash, &tmp_list);
		}
		prev_dest_mnt = m;
		prev_src_mnt  = child;
	}
out:
	br_write_lock(&vfsmount_lock);
	while (!list_empty(&tmp_list)) {
		child = list_first_entry(&tmp_list, struct mount, mnt_hash);
		umount_tree(child, 0, &umount_list);
	}
	br_write_unlock(&vfsmount_lock);
	release_mounts(&umount_list);
	return ret;
}
Beispiel #10
0
static struct ureg_src
prepare_argument(struct st_translate *t, const unsigned argId,
                 const struct atifragshader_src_register *srcReg)
{
   struct ureg_src src = get_source(t, srcReg->Index);
   struct ureg_dst arg = get_temp(t, MAX_NUM_FRAGMENT_REGISTERS_ATI + argId);

   switch (srcReg->argRep) {
   case GL_NONE:
      break;
   case GL_RED:
      src = ureg_scalar(src, TGSI_SWIZZLE_X);
      break;
   case GL_GREEN:
      src = ureg_scalar(src, TGSI_SWIZZLE_Y);
      break;
   case GL_BLUE:
      src = ureg_scalar(src, TGSI_SWIZZLE_Z);
      break;
   case GL_ALPHA:
      src = ureg_scalar(src, TGSI_SWIZZLE_W);
      break;
   }
   ureg_insn(t->ureg, TGSI_OPCODE_MOV, &arg, 1, &src, 1);

   if (srcReg->argMod & GL_COMP_BIT_ATI) {
      struct ureg_src modsrc[2];
      modsrc[0] = ureg_imm1f(t->ureg, 1.0f);
      modsrc[1] = ureg_src(arg);

      ureg_insn(t->ureg, TGSI_OPCODE_SUB, &arg, 1, modsrc, 2);
   }
   if (srcReg->argMod & GL_BIAS_BIT_ATI) {
      struct ureg_src modsrc[2];
      modsrc[0] = ureg_src(arg);
      modsrc[1] = ureg_imm1f(t->ureg, 0.5f);

      ureg_insn(t->ureg, TGSI_OPCODE_SUB, &arg, 1, modsrc, 2);
   }
   if (srcReg->argMod & GL_2X_BIT_ATI) {
      struct ureg_src modsrc[2];
      modsrc[0] = ureg_src(arg);
      modsrc[1] = ureg_src(arg);

      ureg_insn(t->ureg, TGSI_OPCODE_ADD, &arg, 1, modsrc, 2);
   }
   if (srcReg->argMod & GL_NEGATE_BIT_ATI) {
      struct ureg_src modsrc[2];
      modsrc[0] = ureg_src(arg);
      modsrc[1] = ureg_imm1f(t->ureg, -1.0f);

      ureg_insn(t->ureg, TGSI_OPCODE_MUL, &arg, 1, modsrc, 2);
   }
   return  ureg_src(arg);
}
static int search_complete(uint64_t tag, size_t msglen, MPID_Request * rreq)
{
    int mpi_errno = MPI_SUCCESS;
    BEGIN_FUNC(FCNAME);
    rreq->status.MPI_SOURCE = get_source(tag);
    rreq->status.MPI_TAG = get_tag(tag);
    rreq->status.MPI_ERROR = MPI_SUCCESS;
    MPIR_STATUS_SET_COUNT(rreq->status, msglen);
    END_FUNC(FCNAME);
    return mpi_errno;
}
Beispiel #12
0
char const * script_exception::what() const noexcept {
    std::string & buffer = get_g_buffer();
    std::ostringstream strm;
    char const * msg = get_msg();
    char const * space = msg && *msg == ' ' ? "" : " ";
    switch (get_source()) {
    case source::String:  strm << "[string]:" << get_line() << ":" << space << get_msg(); break;
    case source::File:    strm << get_file_name() << ":" << get_line() << ":" << space << get_msg(); break;
    case source::Unknown: return get_msg();
    }
    buffer = strm.str();
    return buffer.c_str();
}
Beispiel #13
0
/*
 * mount 'source_mnt' under the destination 'dest_mnt' at
 * dentry 'dest_dentry'. And propagate that mount to
 * all the peer and slave mounts of 'dest_mnt'.
 * Link all the new mounts into a propagation tree headed at
 * source_mnt. Also link all the new mounts using ->mnt_list
 * headed at source_mnt's ->mnt_list
 *
 * @dest_mnt: destination mount.
 * @dest_dentry: destination dentry.
 * @source_mnt: source mount.
 * @tree_list : list of heads of trees to be attached.
 */
int propagate_mnt(struct vfsmount *dest_mnt, struct dentry *dest_dentry,
		    struct vfsmount *source_mnt, struct list_head *tree_list)
{
	struct vfsmount *m, *child;
	int ret = 0;
	struct vfsmount *prev_dest_mnt = dest_mnt;
	struct vfsmount *prev_src_mnt  = source_mnt;
	LIST_HEAD(tmp_list);
	LIST_HEAD(umount_list);

	for (m = propagation_next(dest_mnt, dest_mnt); m;
			m = propagation_next(m, dest_mnt)) {
		int type;
		struct vfsmount *source;

		if (IS_MNT_NEW(m))
			continue;

		source =  get_source(m, prev_dest_mnt, prev_src_mnt, &type);

		if (!(child = copy_tree(source, source->mnt_root, type))) {
			ret = -ENOMEM;
			list_splice(tree_list, tmp_list.prev);
			goto out;
		}

		if (is_subdir(dest_dentry, m->mnt_root)) {
			mnt_set_mountpoint(m, dest_dentry, child);
			list_add_tail(&child->mnt_hash, tree_list);
		} else {
			/*
			 * This can happen if the parent mount was bind mounted
			 * on some subdirectory of a shared/slave mount.
			 */
			list_add_tail(&child->mnt_hash, &tmp_list);
		}
		prev_dest_mnt = m;
		prev_src_mnt  = child;
	}
out:
	spin_lock(&vfsmount_lock);
	while (!list_empty(&tmp_list)) {
		child = list_entry(tmp_list.next, struct vfsmount, mnt_hash);
		list_del_init(&child->mnt_hash);
		umount_tree(child, 0, &umount_list);
	}
	spin_unlock(&vfsmount_lock);
	release_mounts(&umount_list);
	return ret;
}
Beispiel #14
0
	bool get_dll(std::wstring &file_or_error) const {
		try {
			file_or_error = simple_registry::registry_key::get_string(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\" + utf8::cvt<std::wstring>(file_) + (std::wstring)L"\\" + get_source(), L"EventMessageFile");
			return true;
		} catch (simple_registry::registry_exception &) {
		}
		try {
			std::wstring providerGuid = simple_registry::registry_key::get_string(HKEY_LOCAL_MACHINE, L"SYSTEM\\CurrentControlSet\\Services\\EventLog\\" + utf8::cvt<std::wstring>(file_) + (std::wstring)L"\\" + get_source(), L"ProviderGuid");
			file_or_error = simple_registry::registry_key::get_string(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\WINEVT\\Publishers" + providerGuid, L"MessageFileName");
			return true;
		} catch (simple_registry::registry_exception &e) {
			file_or_error = L"Could not extract DLL for eventsource: " + get_source() + L": " + utf8::cvt<std::wstring>(e.reason());
			return false;
		}
	}
static int
ADD_SUFFIX(peek_callback)(cq_tagged_entry_t * wc, MPIR_Request * rreq)
{
    int mpi_errno = MPI_SUCCESS;
    BEGIN_FUNC(FCNAME);
    REQ_OFI(rreq)->match_state = PEEK_FOUND;
#if API_SET == API_SET_1
    rreq->status.MPI_SOURCE    = get_source(wc->tag);
#elif API_SET == API_SET_2
    rreq->status.MPI_SOURCE    = wc->data;
#endif
    rreq->status.MPI_TAG       = get_tag(wc->tag);
    MPIR_STATUS_SET_COUNT(rreq->status, wc->len);
    rreq->status.MPI_ERROR     = MPI_SUCCESS;
    END_FUNC(FCNAME);
    return mpi_errno;
}
static int tsearch_callback(cq_tagged_entry_t * wc, MPID_Request * rreq)
{
    int mpi_errno = MPI_SUCCESS;
    BEGIN_FUNC(FCNAME);
    if (wc->data) {
        REQ_OFI(rreq)->match_state = TSEARCH_FOUND;
        rreq->status.MPI_SOURCE = get_source(wc->tag);
        rreq->status.MPI_TAG = get_tag(wc->tag);
        MPIR_STATUS_SET_COUNT(rreq->status, wc->len);
        rreq->status.MPI_ERROR = MPI_SUCCESS;
    }
    else {
        REQ_OFI(rreq)->match_state = TSEARCH_NOT_FOUND;
    }
    END_FUNC(FCNAME);
    return mpi_errno;
}
Beispiel #17
0
int hash_func(struct _sipcapture_object *sco, enum hash_source source,
		int denominator)
{
	int ret;
	unsigned int hash;
	str source_string;

	if(get_source(sco, source, &source_string) == -1) {
		return -1;
	}

	LM_DBG("source string: [%.*s]\n", source_string.len, source_string.s);
	crc32_uint(&source_string, &hash);

	ret = hash % denominator;
	return ret;
}
Beispiel #18
0
int propagate_mnt(struct mount *dest_mnt, struct dentry *dest_dentry,
		    struct mount *source_mnt, struct list_head *tree_list)
{
	struct mount *m, *child;
	int ret = 0;
	struct mount *prev_dest_mnt = dest_mnt;
	struct mount *prev_src_mnt  = source_mnt;
	LIST_HEAD(tmp_list);
	LIST_HEAD(umount_list);

	for (m = propagation_next(dest_mnt, dest_mnt); m;
			m = propagation_next(m, dest_mnt)) {
		int type;
		struct mount *source;

		if (IS_MNT_NEW(m))
			continue;

		source =  get_source(m, prev_dest_mnt, prev_src_mnt, &type);

		if (!(child = copy_tree(source, source->mnt.mnt_root, type))) {
			ret = -ENOMEM;
			list_splice(tree_list, tmp_list.prev);
			goto out;
		}

		if (is_subdir(dest_dentry, m->mnt.mnt_root)) {
			mnt_set_mountpoint(m, dest_dentry, child);
			list_add_tail(&child->mnt_hash, tree_list);
		} else {
			list_add_tail(&child->mnt_hash, &tmp_list);
		}
		prev_dest_mnt = m;
		prev_src_mnt  = child;
	}
out:
	br_write_lock(vfsmount_lock);
	while (!list_empty(&tmp_list)) {
		child = list_first_entry(&tmp_list, struct mount, mnt_hash);
		umount_tree(child, 0, &umount_list);
	}
	br_write_unlock(vfsmount_lock);
	release_mounts(&umount_list);
	return ret;
}
Beispiel #19
0
void LocalZipTask::run()
{
    set_has_error(false);

    // 检查路径存在性
    const QString source = get_source(), destination = get_destination();
    if (!QFileInfo(source).exists())
    {
        set_msg("Source path not exists: " + source);
        set_has_error(true);
        return;
    }
    if (!QFileInfo(QFileInfo(destination).path()).exists()) // XXX QFileInfo.path() 返回父目录
    {
        set_msg("Parent directory of ZIP destination not exists: " + QFileInfo(destination).path());
        set_has_error(true);
        return;
    }

    // 首先检查是否需要更新
    set_msg("Checking...");
    bool needUpdate = true;
    if (QFileInfo(destination).exists() && !QFileInfo(destination).isDir())
    {
        const QDateTime mtime = QFileInfo(destination).lastModified();
        needUpdate = newer_than(source, mtime);
    }
    if (!needUpdate)
    {
        set_msg("No need to update at " + QString::fromStdString(DateTime().get_clock_str()) + ".");
        return;
    }

    // 计算工作量
    set_msg("Counting...");
    _total_files = count_files(source);
    _compressed_files = 0;

    // 压缩文件/文件夹到zip
    bool rs = zip();
    if (rs)
        set_msg("Last done at " + QString::fromStdString(DateTime().get_clock_str()) + ".");
    state_changed();
}
Beispiel #20
0
static void emit_program_fini( struct i915_fragment_program *p )
{
   int cf = get_source( p, GL_PREVIOUS, 0 );
   int out = UREG( REG_TYPE_OC, 0 );

   if (p->ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) {
      /* Emit specular add.
       */
      GLuint s = i915_emit_decl(p, REG_TYPE_T, T_SPECULAR, D0_CHANNEL_ALL);
      i915_emit_arith( p, A0_ADD, out, A0_DEST_CHANNEL_ALL, 0, cf, 
		  swizzle(s, X,Y,Z,ZERO), 0 );
   }
   else if (cf != out) {
      /* Will wind up in here if no texture enabled or a couple of
       * other scenarios (GL_REPLACE for instance).
       */
      i915_emit_arith( p, A0_MOV, out, A0_DEST_CHANNEL_ALL, 0, cf, 0, 0 );
   }
}
Beispiel #21
0
HCHANNEL CALL HGE_Impl::Effect_PlayEx(HEFFECT eff, int volume, int pan, float pitch, bool loop)
{
	if(hOpenAL)
	{
		const ALuint sid = get_source(); // find an unused sid, or generate a new one.
		if (sid != 0)
		{
			if (volume < 0) volume = 0; else if (volume > 100) volume = 100;
			if (pan < -100) pan = -100; else if (pan > 100) pan = 100;
			alSourceStop(sid);
			alSourcei(sid, AL_BUFFER, (ALint) eff);
			alSourcef(sid, AL_GAIN, ((ALfloat) volume) / 100.0f);
			alSourcef(sid, AL_PITCH, pitch);
			alSource3f(sid, AL_POSITION, ((ALfloat) pan) / 100.0f, 0.0f, 0.0f);
			alSourcei(sid, AL_LOOPING, loop ? AL_TRUE : AL_FALSE);
			alSourcePlay(sid);
		}
		return sid;
	}
	else return 0;
}
Beispiel #22
0
static GLuint emit_combine_source( struct i915_fragment_program *p, 
				   GLuint mask,
				   GLuint unit,
				   GLenum source, 
				   GLenum operand )
{
   GLuint arg, src;

   src = get_source(p, source, unit);

   switch (operand) {
   case GL_ONE_MINUS_SRC_COLOR: 
      /* Get unused tmp,
       * Emit tmp = 1.0 + arg.-x-y-z-w
       */
      arg = i915_get_temp( p );
      return i915_emit_arith( p, A0_ADD, arg, mask, 0,
		  swizzle(src, ONE, ONE, ONE, ONE ),
		  negate(src, 1,1,1,1), 0);

   case GL_SRC_ALPHA: 
      if (mask == A0_DEST_CHANNEL_W)
	 return src;
      else
	 return swizzle( src, W, W, W, W );
   case GL_ONE_MINUS_SRC_ALPHA: 
      /* Get unused tmp,
       * Emit tmp = 1.0 + arg.-w-w-w-w
       */
      arg = i915_get_temp( p );
      return i915_emit_arith( p, A0_ADD, arg, mask, 0,
			 swizzle(src, ONE, ONE, ONE, ONE ),
			 negate( swizzle(src,W,W,W,W), 1,1,1,1), 0);
   case GL_SRC_COLOR: 
   default:
      return src;
   }
}
Beispiel #23
0
int main()
{
	ms_init();

	MSFilter *source = get_source();
	MSFilter *render = get_render();

	ms_filter_link(source, 0, render, 0);

	MSTicker *ticker = ms_ticker_new();
	ms_ticker_attach(ticker, source);

	while (true) {
		ms_sleep(1);
	}

	ms_ticker_destroy(ticker);

	ms_filter_destroy(render);
	ms_filter_destroy(source);

	return 0;
}
Beispiel #24
0
    syncer_proccess_unit::syncer_proccess_unit()
        : _matcher((new timestamp_composite_matcher({})))
    {
        _matcher->set_callback([this](frame_holder f, syncronization_environment env)
        {

            std::stringstream ss;
            ss << "SYNCED: ";
            auto composite = dynamic_cast<composite_frame*>(f.frame);
            for (int i = 0; i < composite->get_embedded_frames_count(); i++)
            {
                auto matched = composite->get_frame(i);
                ss << matched->get_stream()->get_stream_type() << " " << matched->get_frame_number() << ", "<<std::fixed<< matched->get_frame_timestamp()<<"\n";
            }

            LOG_DEBUG(ss.str());
            env.matches.enqueue(std::move(f));
        });

        auto f = [&](frame_holder frame, synthetic_source_interface* source)
        {
            single_consumer_queue<frame_holder> matches;

            {
                std::lock_guard<std::mutex> lock(_mutex);
                _matcher->dispatch(std::move(frame), { source, matches });
            }

            frame_holder f;
            while (matches.try_dequeue(&f))
            {
                get_source().frame_ready(std::move(f));
            }
        };
        set_processing_callback(std::shared_ptr<rs2_frame_processor_callback>(
            new internal_frame_processor_callback<decltype(f)>(f)));
    }
Beispiel #25
0
/** this function loads the settings for volume and source from the eeprom
 * and restores the settings. sets volume and source to the last saved state	*/
void restore_settings(void)
{
	AMP_ENABLE = 0;	/** mute power amplifier	*/

	uint8_t temp;//, temp1;
	temp = recall_source();
	if ((temp == 0xFF)||(temp<SOURCE_MIN)||(temp>SOURCE_MAX))	/** default value from empty eeprom or illegal value	*/
		temp = SOURCE_MIN;	/** set useful value	*/

	set_source(temp);	/** if there is a value stored, restore it	*/
	get_source(temp);	/** send restored value to the source switching function	*/

	temp = recall_volume(1);	/** used twice	*/
	if ((temp == 0xFF)||(temp<VOLUME_MAX)||(temp>VOLUME_MIN))	/** default value from empty eeprom	or illegal value	*/
		temp = VOLUME_MIN;	/** set useful value	*/

//	temp1=recall_volume(0);	/** recall value for left volume; currently not in use	*/
//	if (temp1 == 0xFF)	/** default value from empty eeprom	*/
//		temp1 = VOLUME_MIN;	/** set useful value	*/

	set_volume(temp,temp);	/** set recalled volume value			*/
	get_volume(0,temp);		/** send volume setting to volume changing function	*/

}
Beispiel #26
0
static void
render_sources(GtkTreeViewColumn *column, GtkCellRenderer *cell,
	GtkTreeModel *unused_model, GtkTreeIter *iter, void *udata)
{
	struct download *d;
	enum c_src idx;

	(void) unused_model;

	if (!gtk_tree_view_column_get_visible(column))
		return;

	d = get_source(iter);
	g_return_if_fail(d);

	idx = pointer_to_uint(udata);
	if (c_src_progress == idx) {
		unsigned value = fi_gui_source_get_progress(d);
		g_object_set(cell, "value", value, (void *) 0);
	} else {
		const char *text = fi_gui_source_column_text(d, idx);
		g_object_set(cell, "text", text, (void *) 0);
	}
}
    void  platform::cl_create_programs_with_source()
    {
        std::vector<shared_ptr<platdevices_info> >  plat_vec = get_platdevices_info_vec();
        shared_ptr<platdevices_info>  info_shared_ptr  =  plat_vec.back();
        platdevices_info   *devices = info_shared_ptr.get();


        //        platdevices_info devices  =  get_info();

        try {
            cl_int err = CL_SUCCESS;
            std::string source = get_source();
            const char  *str = source.c_str();
            std::size_t  length = source.length();
            devices->program = clCreateProgramWithSource(devices->context, 1, &str, &length , &err);

            if(err != CL_SUCCESS)
                throw clutil_exception(err, "clCreateProgramWithSource");

            std::cout<< "Start address program = " << devices->program <<", source = " << source  <<std::endl;
        } catch(std::runtime_error e) {
            std::cout << e.what() <<std::endl;
        }
    }
Beispiel #28
0
// Debug message callback for OpenGL
// Thanks to Sam Serrels for this one
void __stdcall opengl_debug_callback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length,
                                     const GLchar *message, const void *user_param) {
  switch (type) {
  case GL_DEBUG_TYPE_ERROR:
    std::cerr << "An OpenGL debug error has been detected: " << message << std::endl;
    std::cerr << get_severity(severity) << std::endl;
    std::cerr << get_source(source) << std::endl;
    break;

  case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR:
    std::cerr << "OpenGL deprecated behaviour detected: " << message << std::endl;
    std::cerr << get_severity(severity) << std::endl;
    std::cerr << get_source(source) << std::endl;
    break;

  case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR:
    std::cerr << "OpenGL undefined behaviour detected: " << message << std::endl;
    std::cerr << get_severity(severity) << std::endl;
    std::cerr << get_source(source) << std::endl;
    break;

  case GL_DEBUG_TYPE_PORTABILITY:
    std::cerr << "OpenGL portability problem detected: " << message << std::endl;
    std::cerr << get_severity(severity) << std::endl;
    std::cerr << get_source(source) << std::endl;
    break;

  case GL_DEBUG_TYPE_PERFORMANCE:
    std::cerr << "OpenGL performance problem detected: " << message << std::endl;
    std::cerr << get_severity(severity) << std::endl;
    std::cerr << get_source(source) << std::endl;
    break;

#ifdef OGL_DEBUG_OTHER
  case GL_DEBUG_TYPE_OTHER:
    std::cerr << "Other OpenGL error detected: " << message << std::endl;
    std::cerr << get_severity(severity) << std::endl;
    std::cerr << get_source(source) << std::endl;
    break;
#endif
  }
}
Beispiel #29
0
bj_ostream&
quanton::print_quanton(bj_ostream& os, bool from_pt){
	neuron* src = get_source();
	return print_quanton_base(os, from_pt, qu_tier, src, false);
}
Beispiel #30
0
int main (int argc, char **argv)
{
	fct_init();
	
	/* A captured sFlow datagram (#14) */
	u_int32_t packet[] = {
		htonl(0x00000005), htonl(0x00000001), htonl(0xb2116ff2), htonl(0x00000010), htonl(0x00002eb2), htonl(0x55f10676), htonl(0x00000006), htonl(0x00000001), 
		htonl(0x000000d0), htonl(0x00003bc4), htonl(0x000001fd), htonl(0x000003e8), htonl(0x00e971b8), htonl(0x00000000), htonl(0x000001fd), htonl(0x00000000), 
		htonl(0x00000002), htonl(0x00000001), htonl(0x00000090), htonl(0x00000001), htonl(0x00000552), htonl(0x00000004), htonl(0x00000080), htonl(0x01005e31), 
		htonl(0x1af56c9c), htonl(0xed6213d6), htonl(0x08004500), htonl(0x054034d9), htonl(0x40003a11), htonl(0x7b3ad460), htonl(0xb312e931), htonl(0x1af5090a), 
		htonl(0x090a052c), htonl(0x00004700), htonl(0x651ee36d), htonl(0x579e13dc), htonl(0x65de7811), htonl(0x377a5cf7), htonl(0x9e21eba7), htonl(0x0f8ebcf1), 
		htonl(0x0ecfa7d7), htonl(0xef1810a4), htonl(0x4da7bcf3), htonl(0x3b8dbae7), htonl(0x8a9ef3c1), htonl(0x3bb875e7), htonl(0x9ab9ef3c), htonl(0x17d73cf7), 
		htonl(0x9e06eee7), htonl(0x9ef3c73a), htonl(0xd194e203), htonl(0x01dea7f6), htonl(0xa8da1200), htonl(0x00000108), htonl(0x33cfb36f), htonl(0x000003e9), 
		htonl(0x00000010), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000001), htonl(0x000000d0), htonl(0x00003bc5), 
		htonl(0x000001fd), htonl(0x000003e8), htonl(0x00e975a0), htonl(0x00000000), htonl(0x000001fd), htonl(0x00000000), htonl(0x00000002), htonl(0x00000001), 
		htonl(0x00000090), htonl(0x00000001), htonl(0x00000552), htonl(0x00000004), htonl(0x00000080), htonl(0x01005e31), htonl(0x1a8f6c9c), htonl(0xed6213d6), 
		htonl(0x08004500), htonl(0x0540394a), htonl(0x40003a11), htonl(0x772fd460), htonl(0xb312e931), htonl(0x1a8f090a), htonl(0x090a052c), htonl(0x00004700), 
		htonl(0x65125e8a), htonl(0x2878413c), htonl(0xa8569182), htonl(0x2f223570), htonl(0x558b4499), htonl(0x27625ad6), htonl(0xbabafb77), htonl(0x8d556e64), 
		htonl(0xf68b6690), htonl(0x85d0d9ac), htonl(0x491de099), htonl(0x2159c756), htonl(0xeb74a2a5), htonl(0x7e019e40), htonl(0xc90f57bc), htonl(0x1e66e5b4), 
		htonl(0x9522a3dc), htonl(0x301446f8), htonl(0x31f31f3f), htonl(0xdbf78329), htonl(0x9baf89b3), htonl(0x000003e9), htonl(0x00000010), htonl(0x00000000), 
		htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000001), htonl(0x000000d0), htonl(0x00003bc6), htonl(0x000001fd), htonl(0x000003e8), 
		htonl(0x00e97988), htonl(0x00000000), htonl(0x000001fd), htonl(0x00000000), htonl(0x00000002), htonl(0x00000001), htonl(0x00000090), htonl(0x00000001), 
		htonl(0x00000552), htonl(0x00000004), htonl(0x00000080), htonl(0x01005e31), htonl(0x1a686c9c), htonl(0xed6213d6), htonl(0x08004500), htonl(0x05403d93), 
		htonl(0x40003a11), htonl(0x730dd460), htonl(0xb312e931), htonl(0x1a68090a), htonl(0x090a052c), htonl(0x00004700), htonl(0x651a8c9a), htonl(0xc8698831), 
		htonl(0x20740075), htonl(0x1608600a), htonl(0x0640060e), htonl(0x40788603), htonl(0x003203a0), htonl(0x13815260), htonl(0x0d9060d2), htonl(0xf93129c1), 
		htonl(0x078b801a), htonl(0x803a02a0), htonl(0x06600d80), htonl(0x3302843f), htonl(0x80789fb7), htonl(0x0941c6a3), htonl(0xde806e8e), htonl(0x02941392), 
		htonl(0x19c82dc8), htonl(0x14383213), htonl(0x01007408), htonl(0x000003e9), htonl(0x00000010), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), 
		htonl(0x00000000), htonl(0x00000001), htonl(0x000000d0), htonl(0x00003bc7), htonl(0x000001fd), htonl(0x000003e8), htonl(0x00e97d70), htonl(0x00000000), 
		htonl(0x000001fd), htonl(0x00000000), htonl(0x00000002), htonl(0x00000001), htonl(0x00000090), htonl(0x00000001), htonl(0x00000552), htonl(0x00000004), 
		htonl(0x00000080), htonl(0x01005e31), htonl(0x1a486c9c), htonl(0xed6213d6), htonl(0x08004500), htonl(0x05409771), htonl(0x40003a11), htonl(0x194ed460), 
		htonl(0xb313e931), htonl(0x1a48090a), htonl(0x090a052c), htonl(0x00004700), htonl(0x65120000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), 
		htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), 
		htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), 
		htonl(0x00000000), htonl(0x000003e9), htonl(0x00000010), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000001), 
		htonl(0x000000d0), htonl(0x00003bc8), htonl(0x000001fd), htonl(0x000003e8), htonl(0x00e98158), htonl(0x00000000), htonl(0x000001fd), htonl(0x00000000), 
		htonl(0x00000002), htonl(0x00000001), htonl(0x00000090), htonl(0x00000001), htonl(0x00000552), htonl(0x00000004), htonl(0x00000080), htonl(0x01005e31), 
		htonl(0x1aa16c9c), htonl(0xed6213d6), htonl(0x08004500), htonl(0x05404682), htonl(0x40003a11), htonl(0x69e5d460), htonl(0xb312e931), htonl(0x1aa1090a), 
		htonl(0x090a052c), htonl(0x00004700), htonl(0x6519ccaf), htonl(0x5e165667), htonl(0x3a001dc5), htonl(0x5faf0000), htonl(0x01081b5e), htonl(0x6563af95), 
		htonl(0xebd15aaf), htonl(0x95baf95b), htonl(0xaf656ebc), htonl(0xcac3d7a2), htonl(0xb0000001), htonl(0x091b5f2b), htonl(0x0d5e8af5), htonl(0xecadd7ca), 
		htonl(0xdd7cac75), htonl(0xe656339d), htonl(0x807d6bcc), htonl(0xac000001), htonl(0x0a1b5e8a), htonl(0xc55e32b2), htonl(0xaf95baf6), htonl(0x000003e9), 
		htonl(0x00000010), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000000), htonl(0x00000001), htonl(0x000000d0), htonl(0x00003bc9), 
		htonl(0x000001fd), htonl(0x000003e8), htonl(0x00e98540), htonl(0x00000000), htonl(0x000001fd), htonl(0x00000000), htonl(0x00000002), htonl(0x00000001), 
		htonl(0x00000090), htonl(0x00000001), htonl(0x00000552), htonl(0x00000004), htonl(0x00000080), htonl(0x01005e31), htonl(0x1a906c9c), htonl(0xed6213d6), 
		htonl(0x08004500), htonl(0x05404acb), htonl(0x40003a11), htonl(0x65add460), htonl(0xb312e931), htonl(0x1a90090a), htonl(0x090a052c), htonl(0x00004700), 
		htonl(0x651baafe), htonl(0x0bdedfbc), htonl(0xbd602300), htonl(0x2174c3ce), htonl(0x4b2371b8), htonl(0xe6ffdcf5), htonl(0x786be4e8), htonl(0xc0fd26c2), 
		htonl(0xeed3a46f), htonl(0x4c46f9a6), htonl(0x5db1ca70), htonl(0x79466014), htonl(0xad3298d5), htonl(0x0bb5be20), htonl(0x069402c7), htonl(0xf3a2f740), 
		htonl(0x8b297b99), htonl(0x605378ac), htonl(0xccd10ea4), htonl(0x352cb6f5), htonl(0xc00eb400), htonl(0x000003e9), htonl(0x00000010), htonl(0x00000000), 
		htonl(0x00000000), htonl(0x00000000), htonl(0x00000000)
	};
	
	sflow_sample_data_t *sample = NULL;
	sflow_flow_record_t *record = NULL;
	sflow_raw_header_t *header = NULL;
	struct sockaddr_storage ss;
	
	assert_int(1, next_sample(&packet, sizeof (packet), &sample), "Load sample #1");
	assert_int(1, is_sample_format(sample, FLOW_SAMPLE), "Sample #1: format");
	assert_int(15300, ntohl(((sflow_flow_sample_t *) (sample + 1))->sequence_number), "Sample #1: seq_number");
	
	assert_int(1, next_record(sample, &record), "Load record #1:1");
	assert_int(1, is_record_format(record, RAW_HEADER), "Record #1:1: format");
	
	header = (sflow_raw_header_t *) (record + 1);
	assert_int(1, get_source(header, &ss), "Record #1:1: Loading source address");
	assert_ip("212.96.179.18", &ss, "Record #1:1: Source address");
	
	assert_int(1, get_destination(header, &ss), "Record #1:1: Loading destination address");
	assert_ip("233.49.26.245", &ss, "Record #1:1: Destination address");
	
	assert_int(1, next_record(sample, &record), "Load record #1:2");
	assert_int(0, is_record_format(record, RAW_HEADER), "Record #1:2: format");
	
	assert_int(0, next_record(sample, &record), "Record #1:3 should fail");
	
	
	assert_int(1, next_sample(&packet, sizeof (packet), &sample), "Load sample #2");
	assert_int(1, is_sample_format(sample, FLOW_SAMPLE), "Sample #2: format");
	assert_int(15301, ntohl(((sflow_flow_sample_t *) (sample + 1))->sequence_number), "Sample #2: seq_number");
	
	assert_int(1, next_sample(&packet, sizeof (packet), &sample), "Load sample #3");
	assert_int(1, is_sample_format(sample, FLOW_SAMPLE), "Sample #3: format");
	assert_int(15302, ntohl(((sflow_flow_sample_t *) (sample + 1))->sequence_number), "Sample #3: seq_number");
	
	assert_int(1, next_sample(&packet, sizeof (packet), &sample), "Load sample #4");
	assert_int(1, is_sample_format(sample, FLOW_SAMPLE), "Sample #4: format");
	assert_int(15303, ntohl(((sflow_flow_sample_t *) (sample + 1))->sequence_number), "Sample #4: seq_number");
	
	assert_int(1, next_sample(&packet, sizeof (packet), &sample), "Load sample #5");
	assert_int(1, is_sample_format(sample, FLOW_SAMPLE), "Sample #5: format");
	assert_int(15304, ntohl(((sflow_flow_sample_t *) (sample + 1))->sequence_number), "Sample #5: seq_number");
	
	assert_int(1, next_sample(&packet, sizeof (packet), &sample), "Load sample #6");
	assert_int(1, is_sample_format(sample, FLOW_SAMPLE), "Sample #6: format");
	assert_int(15305, ntohl(((sflow_flow_sample_t *) (sample + 1))->sequence_number), "Sample #6: seq_number");
	
	assert_int(0, next_sample(&packet, sizeof (packet), &sample), "Sample #7 should fail");
	
	fct_send();
	return 0;
}