From 71821fc95adae31014341e62742c4638d67e6539 Mon Sep 17 00:00:00 2001 From: Alex Shinn Date: Tue, 30 Mar 2010 22:06:16 +0900 Subject: [PATCH] convertin plan9 functions to new API --- opt/plan9.c | 58 ++++++++++++++++++++++++++--------------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/opt/plan9.c b/opt/plan9.c index d51c9f67..ca25afba 100644 --- a/opt/plan9.c +++ b/opt/plan9.c @@ -1,17 +1,17 @@ -/* plan9.c -- extended Plan 9 system utils */ -/* Copyright (c) 2009 Alex Shinn. All rights reserved. */ -/* BSD-style license: http://synthcode.com/license.txt */ +/* plan9.c -- extended Plan 9 system utils */ +/* Copyright (c) 2009-2010 Alex Shinn. All rights reserved. */ +/* BSD-style license: http://synthcode.com/license.txt */ -sexp sexp_rand (sexp ctx) { +sexp sexp_rand (sexp ctx sexp_api_params(self, n)) { return sexp_make_fixnum(rand()); } -sexp sexp_srand (sexp ctx, sexp seed) { +sexp sexp_srand (sexp ctx sexp_api_params(self, n), sexp seed) { srand(sexp_unbox_fixnum(seed)); return SEXP_VOID; } -sexp sexp_file_exists_p (sexp ctx, sexp path) { +sexp sexp_file_exists_p (sexp ctx sexp_api_params(self, n), sexp path) { int res; uchar statbuf[STATMAX]; if (! sexp_stringp(path)) @@ -20,7 +20,7 @@ sexp sexp_file_exists_p (sexp ctx, sexp path) { return (res < 0) ? SEXP_FALSE : SEXP_TRUE; } -sexp sexp_fdopen (sexp ctx, sexp fd, sexp mode) { +sexp sexp_fdopen (sexp ctx sexp_api_params(self, n), sexp fd, sexp mode) { FILE *f; if (! sexp_integerp(fd)) return sexp_type_exception(ctx, "fdopen: not an integer", fd); @@ -36,17 +36,17 @@ sexp sexp_fdopen (sexp ctx, sexp fd, sexp mode) { return sexp_make_input_port(ctx, f, SEXP_FALSE); } -sexp sexp_fileno (sexp ctx, sexp port) { +sexp sexp_fileno (sexp ctx sexp_api_params(self, n), sexp port) { if (! sexp_portp(port)) return sexp_type_exception(ctx, "fileno: not a port", port); return sexp_make_fixnum(fileno(sexp_port_stream(port))); } -sexp sexp_fork (sexp ctx) { +sexp sexp_fork (sexp ctx sexp_api_params(self, n)) { return sexp_make_fixnum(fork()); } -sexp sexp_exec (sexp ctx, sexp name, sexp args) { +sexp sexp_exec (sexp ctx sexp_api_params(self, n), sexp name, sexp args) { int i, len = sexp_unbox_fixnum(sexp_length(ctx, args)); char **argv = malloc((len+1)*sizeof(char*)); for (i=0; iifcall.offset); } -sexp sexp_9p_req_count (sexp ctx, sexp req) { +sexp sexp_9p_req_count (sexp ctx sexp_api_params(self, n), sexp req) { return sexp_make_integer(ctx, ((Req*)sexp_cpointer_value(req))->ifcall.count); } #if 0 -sexp sexp_9p_req_path (sexp ctx, sexp req) { +sexp sexp_9p_req_path (sexp ctx sexp_api_params(self, n), sexp req) { return sexp_c_string(ctx, ((Req*)sexp_cpointer_value(req))->fid->qid.path, -1); } #endif -sexp sexp_9p_req_fid (sexp ctx, sexp req) { +sexp sexp_9p_req_fid (sexp ctx sexp_api_params(self, n), sexp req) { return sexp_make_cpointer(ctx, SEXP_CPOINTER, ((Req*)sexp_cpointer_value(req))->fid, SEXP_FALSE, 0); } -sexp sexp_9p_req_newfid (sexp ctx, sexp req) { +sexp sexp_9p_req_newfid (sexp ctx sexp_api_params(self, n), sexp req) { return sexp_make_cpointer(ctx, SEXP_CPOINTER, ((Req*)sexp_cpointer_value(req))->newfid, SEXP_FALSE, 0); } -sexp sexp_9p_respond (sexp ctx, sexp req, sexp err) { +sexp sexp_9p_respond (sexp ctx sexp_api_params(self, n), sexp req, sexp err) { char *cerr = sexp_stringp(err) ? sexp_string_data(err) : nil; respond(sexp_cpointer_value(req), cerr); return SEXP_VOID; } -sexp sexp_9p_responderror (sexp ctx, sexp req) { +sexp sexp_9p_responderror (sexp ctx sexp_api_params(self, n), sexp req) { responderror(sexp_cpointer_value(req)); return SEXP_VOID; }