mirror of
https://github.com/janet-lang/janet
synced 2026-11-29 18:33:09 +00:00
Use backticks for nicer site rendering (#1856)
Co-authored-by: sogaiu <983021772@users.noreply.github.com>
This commit is contained in:
1 parent
cae73db4af
commit
112f5aef7d
2 files changed
+40
-30
No files matched your search
+9
-6
@@ -1739,12 +1739,15 @@ JANET_CORE_FN(cfun_ffi_buffer_read,
|
||||
|
||||
JANET_CORE_FN(cfun_ffi_get_callback_trampoline,
|
||||
"(ffi/trampoline cc)",
|
||||
"Get a native function pointer that can be used as a callback and passed to C libraries. "
|
||||
"This callback trampoline has the signature `void trampoline(void \\*ctx, void \\*userdata)` in "
|
||||
"the given calling convention. This is the only function signature supported. "
|
||||
"It is up to the programmer to ensure that the `userdata` argument contains a janet function "
|
||||
"the will be called with one argument, `ctx` which is an opaque pointer. This pointer can "
|
||||
"be further inspected with `ffi/read`.") {
|
||||
"Get a native function pointer that can be used as a callback "
|
||||
"and passed to C libraries. This callback trampoline has the "
|
||||
"signature `void trampoline(void *ctx, void *userdata)` in "
|
||||
"the given calling convention. This is the only function "
|
||||
"signature supported. It is up to the programmer to ensure "
|
||||
"that the `userdata` argument contains a janet function that "
|
||||
"will be called with one argument, `ctx` which is an opaque "
|
||||
"pointer. This pointer can be further inspected with "
|
||||
"`ffi/read`.") {
|
||||
janet_arity(argc, 0, 1);
|
||||
JanetFFICallingConvention cc = JANET_FFI_CC_DEFAULT;
|
||||
if (argc >= 1) cc = decode_ffi_cc(janet_getkeyword(argv, 0));
|
||||
|
||||
+31
-24
@@ -2715,32 +2715,39 @@ static jmode_t os_optmode(int32_t argc, const Janet *argv, int32_t n, int32_t df
|
||||
|
||||
JANET_CORE_FN(os_open,
|
||||
"(os/open path &opt flags mode)",
|
||||
"Create a stream from a file, like the POSIX open system call. Returns a new stream. "
|
||||
"`mode` should be a file mode as passed to `os/chmod`, but only if the create flag is given. "
|
||||
"The default mode is 8r666. "
|
||||
"Allowed flags are as follows:\n\n"
|
||||
"Create a stream from a file, like the POSIX open system "
|
||||
"call. Returns a new stream. `mode` should be a file mode "
|
||||
"as passed to `os/chmod`, but only if the create flag is "
|
||||
"given. The default mode is 8r666.\n"
|
||||
"\n"
|
||||
"Allowed flags are as follows:\n"
|
||||
"\n"
|
||||
" * :r - open this file for reading\n"
|
||||
" * :w - open this file for writing\n"
|
||||
" * :c - create a new file (O\\_CREATE)\n"
|
||||
" * :e - fail if the file exists (O\\_EXCL)\n"
|
||||
" * :t - shorten an existing file to length 0 (O\\_TRUNC)\n\n"
|
||||
" * :a - append to a file (O\\_APPEND on posix, FILE_APPEND_DATA on windows)\n"
|
||||
"Posix-only flags:\n\n"
|
||||
" * :x - O\\_SYNC\n"
|
||||
" * :C - O\\_NOCTTY\n\n"
|
||||
" * :N - Turn off O\\_NONBLOCK and disable ev reading/writing\n\n"
|
||||
"Windows-only flags:\n\n"
|
||||
" * :R - share reads (FILE\\_SHARE\\_READ)\n"
|
||||
" * :W - share writes (FILE\\_SHARE\\_WRITE)\n"
|
||||
" * :D - share deletes (FILE\\_SHARE\\_DELETE)\n"
|
||||
" * :H - FILE\\_ATTRIBUTE\\_HIDDEN\n"
|
||||
" * :O - FILE\\_ATTRIBUTE\\_READONLY\n"
|
||||
" * :F - FILE\\_ATTRIBUTE\\_OFFLINE\n"
|
||||
" * :T - FILE\\_ATTRIBUTE\\_TEMPORARY\n"
|
||||
" * :d - FILE\\_FLAG\\_DELETE\\_ON\\_CLOSE\n"
|
||||
" * :V - Turn off FILE\\_FLAG\\_OVERLAPPED and disable ev reading/writing\n"
|
||||
" * :I - set bInheritHandle on the created file so it can be passed to other processes.\n"
|
||||
" * :b - FILE\\_FLAG\\_NO\\_BUFFERING\n") {
|
||||
" * :c - create a new file (`O_CREATE`)\n"
|
||||
" * :e - fail if the file exists (`O_EXCL`)\n"
|
||||
" * :t - shorten an existing file to length 0 (`O_TRUNC`)\n"
|
||||
" * :a - append to a file (`O_APPEND` on posix, `FILE_APPEND_DATA` on windows)\n"
|
||||
"\n"
|
||||
"Posix-only flags:\n"
|
||||
"\n"
|
||||
" * :x - `O_SYNC`\n"
|
||||
" * :C - `O_NOCTTY`\n"
|
||||
" * :N - Turn off `O_NONBLOCK` and disable ev reading/writing\n"
|
||||
"\n"
|
||||
"Windows-only flags:\n"
|
||||
"\n"
|
||||
" * :R - share reads (`FILE_SHARE_READ`)\n"
|
||||
" * :W - share writes (`FILE_SHARE_WRITE`)\n"
|
||||
" * :D - share deletes (`FILE_SHARE_DELETE`)\n"
|
||||
" * :H - `FILE_ATTRIBUTE_HIDDEN`\n"
|
||||
" * :O - `FILE_ATTRIBUTE_READONLY`\n"
|
||||
" * :F - `FILE_ATTRIBUTE_OFFLINE`\n"
|
||||
" * :T - `FILE_ATTRIBUTE_TEMPORARY`\n"
|
||||
" * :d - `FILE_FLAG_DELETE_ON_CLOSE`\n"
|
||||
" * :V - Turn off `FILE_FLAG_OVERLAPPED` and disable ev reading/writing\n"
|
||||
" * :I - set `bInheritHandle` on the created file so it can be passed to other processes.\n"
|
||||
" * :b - `FILE_FLAG_NO_BUFFERING`\n") {
|
||||
janet_arity(argc, 1, 3);
|
||||
const char *path = janet_getcstring(argv, 0);
|
||||
const uint8_t *opt_flags = janet_optkeyword(argv, argc, 1, (const uint8_t *) "r");
|
||||
|
||||
Reference in new issue
Block a user