Ejemplo n.º 1
0
void sexp_9p_destroyfid (Fid *fid) {
  sexp_plan9_srv s = (sexp_plan9_srv)fid->pool->srv->aux;
  sexp ctx = s->context;
  sexp_gc_var(ptr, s_ptr);
  sexp_gc_var(args, s_args);
  sexp_gc_preserve(ctx, ptr, s_ptr);
  sexp_gc_preserve(ctx, args, s_args);
  ptr = sexp_make_cpointer(ctx, SEXP_CPOINTER, fid, SEXP_FALSE, 0);
  args = sexp_cons(ctx, ptr, SEXP_NULL);
  sexp_apply(ctx, s->destroyfid, args);
  sexp_gc_release(ctx, ptr, s_ptr);
}
Ejemplo n.º 2
0
void sexp_run_9p_handler (Req *r, sexp handler) {
  sexp_plan9_srv s = (sexp_plan9_srv)r->srv->aux;
  sexp ctx = s->context;
  sexp_gc_var(ptr, s_ptr);
  sexp_gc_var(args, s_args);
  sexp_gc_preserve(ctx, ptr, s_ptr);
  sexp_gc_preserve(ctx, args, s_args);
  ptr = sexp_make_cpointer(ctx, SEXP_CPOINTER, r, SEXP_FALSE, 0);
  args = sexp_cons(ctx, ptr, SEXP_NULL);
  sexp_apply(ctx, handler, args);
  sexp_gc_release(ctx, ptr, s_ptr);
}
Ejemplo n.º 3
0
static sexp
sexp_yuniffi_nccc_proc_register(sexp ctx, sexp self, sexp_sint_t n,
                                sexp proc){
    sexp_gc_var2(res, resptr);
    REQUIRE(ctx, self, proc, sexp_procedurep, SEXP_PROCEDURE);
    sexp_gc_preserve2(ctx, res, resptr);
    res = sexp_cons(ctx, ctx, proc);
    resptr = sexp_make_cpointer(ctx, SEXP_CPOINTER, (void*)(uintptr_t)res,
                                 SEXP_FALSE, 0);
    sexp_preserve_object(ctx, res);
    sexp_gc_release2(ctx);
    return resptr;
}
Ejemplo n.º 4
0
static sexp sexp_stat_stub (sexp ctx, sexp self, sexp_sint_t n, sexp arg0) {
  int err;
  struct stat* tmp1;
  sexp res;
  sexp_gc_var1(res1);
  if (! sexp_stringp(arg0))
    return sexp_type_exception(ctx, self, SEXP_STRING, arg0);
  sexp_gc_preserve1(ctx, res1);
  tmp1 = (struct stat*) calloc(1, 1 + sizeof(tmp1[0]));
  err = stat(sexp_string_data(arg0), tmp1);
  if (err) {
  res = SEXP_FALSE;
  } else {
  res1 = sexp_make_cpointer(ctx, sexp_unbox_fixnum(sexp_opcode_arg2_type(self)), tmp1, SEXP_FALSE, 1);
  res = res1;
  }
  sexp_gc_release1(ctx);
  return res;
}
Ejemplo n.º 5
0
static sexp sexp_seconds_3e_time_stub (sexp ctx, sexp self, sexp_sint_t n, sexp arg0) {
  void *err;
  struct tm* tmp1;
  time_t tmp0;
  sexp res;
  sexp_gc_var1(res1);
  if (! sexp_exact_integerp(arg0))
    return sexp_type_exception(ctx, self, SEXP_FIXNUM, arg0);
  sexp_gc_preserve1(ctx, res1);
  tmp0 = sexp_unshift_epoch(sexp_uint_value(arg0));
  tmp1 = (struct tm*) calloc(1, 1 + sizeof(tmp1[0]));
  err = localtime_r(&tmp0, tmp1);
  if (!err) {
  res = SEXP_FALSE;
  } else {
  res1 = sexp_make_cpointer(ctx, sexp_unbox_fixnum(sexp_opcode_arg2_type(self)), tmp1, SEXP_FALSE, 1);
  res = res1;
  }
  sexp_gc_release1(ctx);
  return res;
}
Ejemplo n.º 6
0
static sexp sexp_player_new_stub (sexp ctx, sexp self, sexp_sint_t n) {
  struct player* *tmp;
  sexp res;
  res = sexp_make_cpointer(ctx, sexp_unbox_fixnum(sexp_opcode_return_type(self)), player_new(), SEXP_FALSE, 0);
  return res;
}
Ejemplo n.º 7
0
sexp sexp_9p_req_newfid (sexp ctx, sexp self, sexp_sint_t n, sexp req) {
  return sexp_make_cpointer(ctx, SEXP_CPOINTER, ((Req*)sexp_cpointer_value(req))->newfid, SEXP_FALSE, 0);
}