Beispiel #1
0
static camkes_error_action_t UNUSED /*? error_handler ?*/(camkes_error_t *error) {
    if (/*? error_handler ?*/_fn == NULL) {
        /* No registered handler; invoke the generic error handler. */
        return camkes_error(error);
    }
    return /*? error_handler ?*/_fn(error);
}
Beispiel #2
0
uptr_t eval(uptr_t *env, uptr_t form) {
  if (IS_INT(form) || IS_NIL(form))
    return form;

  if (IS_SYM(form))
    return get(*env, form);

  if (IS_CONS(form)) {
    uptr_t *form_p = refer(form),
      *fn_p = refer(eval(env, CAR(*form_p))),
      rval;

    if (IS_SYM(*fn_p)) {
      rval = exec_special(env, *form_p);
    } else if (IS_CONS(*fn_p) && SVAL(CAR(*fn_p)) == S_FN) {
      rval = _fn(env, *fn_p, eval_list(env, CDR(*form_p)));
    } else {
      printf_P(PSTR("ERROR: "));
      print_form(CAR(*form_p));
      printf_P(PSTR(" cannot be in function position.\n"));

      rval = NIL;
    }

    release(2); // form_p, fn_p
    return rval;
  }

  return NIL;
}
Beispiel #3
0
/*
 * I don't know if we can be absolutely certain that the fn and arg
 * parameters are preserved when returning as the child. If the
 * compiler stores them in registers (r0-r7), they should be.
 */
int clone(int (*fn)(void *arg), void *child_stack, int flags, void *arg, ...)
{
	register int (*_fn)(void *arg) = fn;
	register void *_arg = arg;
	int err;

	/* Sanity check the arguments */
	err = -EINVAL;
	if (!fn)
		goto syscall_error;
	if (!child_stack)
		goto syscall_error;

	err = INLINE_SYSCALL(clone, 2, flags, child_stack);
	if (err < 0)
		goto syscall_error;
	else if (err != 0)
		return err;

	_exit(_fn(_arg));

syscall_error:
	__set_errno (-err);
	return -1;
}
Beispiel #4
0
	// Obtain value of the cached function for k
	V operator()(const K& k) {
		V v;
		if (!get(k,v)) {
			v=_fn(k);
			insert(k,v);
		}
		return v;
	}
Beispiel #5
0
	static void _call_set_v(
		GLuint /*program*/,
		GLuint location,
		void(GLAPIENTRY *_fn)(UI, SI, const T*),
		const T* v
	)
	{
		_fn(location, 1, v);
	}
Beispiel #6
0
	static void _call_set_t(
		GLuint program,
		GLuint location,
		void(GLAPIENTRY *_fn)(GLuint, UI, P, P, P, P),
		P v0, P v1, P v2, P v3
	)
	{
		_fn(program, location, v0, v1, v2, v3);
	}
Beispiel #7
0
	static void _call_set_t(
		GLuint program,
		GLuint location,
		void(GLAPIENTRY *_fn)(GLuint, UI, P),
		P v0
	)
	{
		_fn(program, location, v0);
	}
Beispiel #8
0
	static void _call_set_v(
		GLuint program,
		GLuint location,
		void(GLAPIENTRY *_fn)(GLuint, UI, SI, const T*),
		const T* v
	)
	{
		_fn(program, location, 1, v);
	}
Beispiel #9
0
	static void _call_set_t(
		GLuint /*program*/,
		GLuint location,
		void(GLAPIENTRY *_fn)(UI, P, P, P),
		P v0, P v1, P v2
	)
	{
		_fn(location, v0, v1, v2);
	}
void BufferingAgent::run() {
    _halt = false;
    while(1) {
        if(_halt) return;
        DataBlobHash& hash = *(_buffer.next()); // blocks until ready
        if(_halt) return;
        _fn(hash);
        _queue.push_back(&hash);
    }
}
Beispiel #11
0
	static void _call_set_m(
		GLuint program,
		GLuint location,
		GLsizei count,
		GLboolean transpose,
		void(GLAPIENTRY *_fn)(GLuint, ID, CT, TP, const T*),
		const T* v
	)
	{
		_fn(program, location, count, transpose, v);
	}
Beispiel #12
0
void task_run(void (*_fn)(void*), void *_arg)
{
	LeaveCriticalSection();

	//bufferPrintf("tasks: New task started %s. 0x%08x(0x%08x).\r\n",
	//		CurrentRunning->taskName, _fn, _arg);

	_fn(_arg);

	//bufferPrintf("tasks: Task ending %s. 0x%08x(0x%08x).\r\n",
	//		CurrentRunning->taskName, _fn, _arg);

	EnterCriticalSection();
	task_stop();
}
Beispiel #13
0
/** Entry point for new kernel threads. Make this thread a DDE26
 *  worker and then execute the real thread fn.
 */
static void __kthread_helper(void *arg)
{
	struct __kthread_data *k = (struct __kthread_data *)arg;

	/*
	 * Make a copy of the fn and arg pointers, as the kthread struct is
	 * deleted by our parent after notifying it and this may happen before we
	 * get to execute the function.
	 */
	int (*_fn)(void*)   = k->fn;
	void *_arg          = k->arg;

	l4dde26_process_add_worker();

	/*
	 * Handshake with creator - we store our thread data in the
	 * kthread struct and then unlock the lock to notify our
	 * creator about completing setup
	 */
	k->kthread = (dde26_thread_data *)ddekit_thread_get_my_data();
	ddekit_lock_unlock(&k->lock);
	
	do_exit(_fn(_arg));
}
 void operator()(T&& i) {
     _c += _fn(std::forward<T>(i));
     if (countAlso) {
         ++_cnt;
     }
 }
Beispiel #15
0
void JobTask::_on_execute() { _fn(); }
Beispiel #16
0
void runner::impl::run()
{
	_fn();
}
 bool handle(ESP8266WebServer& server, HTTPMethod requestMethod, String requestUri) override {
     currentReqUri = requestUri;
     _fn(this, requestUri, requestMethod);
     currentReqUri = "";
     return true;
 }
Beispiel #18
0
 void Write(const bytes& data)
 {
     _fn(data);
 }