mirror of
https://github.com/janet-lang/janet
synced 2024-11-17 14:14:49 +00:00
Merge pull request #56 from jfcap/register-corefile
Register core/file abstract type
This commit is contained in:
commit
efbb704247
@ -400,6 +400,14 @@ static const JanetReg io_cfuns[] = {
|
|||||||
{NULL, NULL, NULL}
|
{NULL, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* C API */
|
||||||
|
|
||||||
|
FILE *janet_getfile(const Janet *argv, int32_t n, int *flags) {
|
||||||
|
IOFile *iof = janet_getabstract(argv, n, &cfun_io_filetype);
|
||||||
|
*flags = iof->flags;
|
||||||
|
return iof->file;
|
||||||
|
}
|
||||||
|
|
||||||
/* Module entry point */
|
/* Module entry point */
|
||||||
void janet_lib_io(JanetTable *env) {
|
void janet_lib_io(JanetTable *env) {
|
||||||
janet_core_cfuns(env, NULL, io_cfuns);
|
janet_core_cfuns(env, NULL, io_cfuns);
|
||||||
@ -416,4 +424,5 @@ void janet_lib_io(JanetTable *env) {
|
|||||||
janet_core_def(env, "stdin",
|
janet_core_def(env, "stdin",
|
||||||
makef(stdin, IO_READ | IO_NOT_CLOSEABLE | IO_SERIALIZABLE),
|
makef(stdin, IO_READ | IO_NOT_CLOSEABLE | IO_SERIALIZABLE),
|
||||||
JDOC("The standard input file."));
|
JDOC("The standard input file."));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1254,6 +1254,8 @@ JANET_API JanetRange janet_getslice(int32_t argc, const Janet *argv);
|
|||||||
JANET_API int32_t janet_gethalfrange(const Janet *argv, int32_t n, int32_t length, const char *which);
|
JANET_API int32_t janet_gethalfrange(const Janet *argv, int32_t n, int32_t length, const char *which);
|
||||||
JANET_API int32_t janet_getargindex(const Janet *argv, int32_t n, int32_t length, const char *which);
|
JANET_API int32_t janet_getargindex(const Janet *argv, int32_t n, int32_t length, const char *which);
|
||||||
|
|
||||||
|
JANET_API FILE *janet_getfile(const Janet *argv, int32_t n, int *flags);
|
||||||
|
|
||||||
|
|
||||||
/* Marshal API */
|
/* Marshal API */
|
||||||
JANET_API void janet_marshal_int(JanetMarshalContext *ctx, int32_t value);
|
JANET_API void janet_marshal_int(JanetMarshalContext *ctx, int32_t value);
|
||||||
|
Loading…
Reference in New Issue
Block a user