mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 21:59:17 +02:00
working on 9p support
This commit is contained in:
parent
d36e70f6bf
commit
386a1cdb0a
2 changed files with 50 additions and 1 deletions
18
opt/plan9-opcodes.c
Normal file
18
opt/plan9-opcodes.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
_FN0("random-integer", 0, sexp_rand),
|
||||
_FN1(SEXP_FIXNUM, "random-seed", 0, sexp_srand),
|
||||
_FN0("current-directory", 0, sexp_getwd),
|
||||
_FN0("current-user", 0, sexp_getuser),
|
||||
_FN0("system-name", 0, sexp_sysname),
|
||||
_FN1(SEXP_IPORT, "port-fileno", 0, sexp_fileno),
|
||||
_FN2(SEXP_FIXNUM, SEXP_STRING, "fileno->port", 0, sexp_fdopen),
|
||||
_FN0("fork", 0, sexp_fork),
|
||||
_FN2(SEXP_STRING, SEXP_PAIR, "exec", 0, sexp_exec),
|
||||
_FN1(SEXP_STRING, "exits", 0, sexp_exits),
|
||||
_FN2(SEXP_FIXNUM, SEXP_FIXNUM, "dup", 0, sexp_dup),
|
||||
_FN0("pipe", 0, sexp_pipe),
|
||||
_FN1(SEXP_FIXNUM, "sleep", 0, sexp_sleep),
|
||||
_FN1(SEXP_STRING, "getenv", 0, sexp_getenv),
|
||||
_FN1(SEXP_STRING, "change-directory", 0, sexp_chdir),
|
||||
_FN0("wait", 0, sexp_wait),
|
||||
_FN2(SEXP_FIXNUM, SEXP_STRING, "post-note", 0, sexp_postnote),
|
||||
_FN4(SEXP_PAIR, SEXP_STRING, "%postmountsrv", 0, sexp_postmountsrv),
|
33
opt/plan9.c
33
opt/plan9.c
|
@ -277,7 +277,7 @@ sexp sexp_postmountsrv (sexp ctx, sexp ls, sexp name, sexp mtpt, sexp flags) {
|
|||
Srv s;
|
||||
struct sexp_plan9_srv p9s;
|
||||
if (! sexp_listp(ctx, ls))
|
||||
return sexp_type_exception(ctx, "postmountsrv: not an list", ls);
|
||||
return sexp_type_exception(ctx, "postmountsrv: not a list", ls);
|
||||
if (! sexp_stringp(name))
|
||||
return sexp_type_exception(ctx, "postmountsrv: not a string", name);
|
||||
if (! sexp_stringp(mtpt))
|
||||
|
@ -307,3 +307,34 @@ sexp sexp_postmountsrv (sexp ctx, sexp ls, sexp name, sexp mtpt, sexp flags) {
|
|||
return SEXP_UNDEF;
|
||||
}
|
||||
|
||||
sexp sexp_9p_req_offset (sexp ctx, sexp req) {
|
||||
return sexp_make_integer(ctx, (Req*)sexp_cpointer_value(req)->ifcall.offset);
|
||||
}
|
||||
|
||||
sexp sexp_9p_req_count (sexp ctx, sexp req) {
|
||||
return sexp_make_integer(ctx, (Req*)sexp_cpointer_value(req)->ifcall.count);
|
||||
}
|
||||
|
||||
sexp sexp_9p_req_path (sexp ctx, sexp req) {
|
||||
return sexp_c_string(ctx, (Req*)sexp_cpointer_value(req)->fid.qid.path, -1);
|
||||
}
|
||||
|
||||
sexp sexp_9p_req_fid (sexp ctx, sexp req) {
|
||||
return sexp_make_cpointer(ctx, (Req*)sexp_cpointer_value(req)->fid);
|
||||
}
|
||||
|
||||
sexp sexp_9p_req_newfid (sexp ctx, sexp req) {
|
||||
return sexp_make_cpointer(ctx, (Req*)sexp_cpointer_value(req)->newfid);
|
||||
}
|
||||
|
||||
sexp sexp_9p_respond (sexp ctx, 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) {
|
||||
responderror(sexp_cpointer_value(req));
|
||||
return SEXP_VOID;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue