Example #1
0
// only for lists
shared_ptr<WhileObject> WhileObject::append( shared_ptr<WhileObject> other ) {
	shared_ptr<X86Register> r = program->callFunction(appendFunc, arg_list{other->addrRef(), addrRef()});
	shared_ptr<WhileObject> obj = make_obj(program, w_type);
	obj->setLocation( r, false );	// object result

	return obj;
}
	std::int32_t call(state_t &state, R(*handler)(Args...),
					  typename std::enable_if<std::is_same<R, void>::value>::type * = nullptr)
	{
		call_impl(state, make_obj(handler), 0);

		return 0;
	}
	std::int32_t call(state_t &state, T *obj, R(T::*handler)(Args...), std::uint32_t offset = 0,
					  typename std::enable_if<std::is_same<R, void>::value>::type * = nullptr)
	{
		call_impl(state, make_obj(obj, handler), offset);

		return 0;
	}
Example #4
0
File: myLisp.c Project: yppp/myLisp
VALUE cons(VALUE car, VALUE cdr)
{
  LVALUE *cell = make_obj(Qnil);
  cell->u.basic.type = CELL;
  CAR(cell) = car;
  CDR(cell) = cdr;
  return (VALUE)cell;
}
Example #5
0
shared_ptr<WhileObject> WhileObject::clone() {
	shared_ptr<WhileObject> obj = make_obj(program, w_type);

	if (w_type->isAtomic() || w_type->isNull()) {
		obj->assign( shared_from_this(), false );
	}
	else {
		shared_ptr<X86Register> r = program->callFunction(cloneFunc, arg_list{addrRef()});
		obj->setLocation( r, false );	// object result
		obj->putOnStack();
	}

	return obj;
}
Example #6
0
File: myLisp.c Project: yppp/myLisp
void defsubr(const char *name, Subr pf)
{
  VALUE v = make_symbol(name, Qnil);

  VALUE f = (VALUE)make_obj(Qnil);
  ((LVALUE*)f)->u.basic.type = NATIVE_PROCEDURE;
  ((LVALUE*)f)->u.native.proc = pf;

  if(NIL_P(topenv))
    {
      topenv = cons(cons(v, f), Qnil);
    }
  else
    {
      topenv = append(cons(cons(v, f), Qnil), topenv);
    }
}
Example #7
0
void newmtrx(QSP_ARG_DECL  const char *s,int dim)
{
	Data_Obj *mp;

	if( dim <= 1 ){
		WARN("bad dimension");
		return;
	}
	mp=dobj_of(QSP_ARG  s);
	if( mp!=(NO_OBJ) ){
		WARN("name in use already");
		return;
	}
	mp=make_obj(QSP_ARG  s,1,dim,dim,1,prec_for_code(PREC_SP));
	if( mp == NO_OBJ ){
		WARN("couldn't create new matrix");
		return;
	}
	unity(mp);
}
Example #8
0
int test(const char* command)
{
  xon_client client = xon_client_new("./test_server_c", NULL);
  if (client == NULL) {
    printf("Client: Error starting client.\n");
    return 1;
  }

  xon_obj obj = make_obj();
  if (obj == NULL) {
    printf("Client: Error creating binary object.\n");
    return 1;
  }

  printf("\nClient: Sending:\n");
  xon_obj_print(obj);
  if (xon_client_send(client, obj) != XON_OK) {
    printf("Client: Error sending message.\n");
    return 1;
  }
  free(obj);

  if (xon_client_receive(client, &obj) != XON_OK) {
    printf("Client: Error receiving message.\n");
    return 2;
  }

  printf("\nReceived object:\n");
  xon_obj_print(obj);
  free(obj);

  if (xon_client_wait(client, 1000) != XON_OK) {
    printf("Server did not quit by himself.\n");
    /* xon_client_delete will kill server */
  }
  
  xon_client_delete(client);
  return 0;
}
	std::int32_t call(state_t &state, R(*handler)(Args...),
					  typename std::enable_if<!std::is_same<R, void>::value>::type * = nullptr)
	{
		using result_t = std::remove_cv<R>::type;
		return convertion_t<result_t>::to(state, call_impl(state, make_obj(handler), 0));
	}
	inline void call(state_t &state, T *obj, const std::tuple<Args...> &args)
	{
		call_impl(state, make_obj(obj, args), 1);
	}