mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-31 15:43:01 +00:00 
			
		
		
		
	Merge pull request #56 from jfcap/register-corefile
Register core/file abstract type
This commit is contained in:
		| @@ -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); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose