Surround more things with backticks (#1862)

Co-authored-by: sogaiu <983021772@users.noreply.github.com>
This commit is contained in:
sogaiuandsogaiu authored and GitHub committed 2026-09-11 20:50:08 -05:00
1 parent e6194a8188
commit 6bbdfd0e0c
5 files changed
+148 -101

No files matched your search

+1 -1
View File
@@ -4333,7 +4333,7 @@
(compwhen (dyn 'ffi/native)
(defdyn *ffi-context* " Current native library for ffi/defbind and other settings")
(defdyn *ffi-context* "Current native library for `ffi/defbind` and other settings")
(defn- default-mangle
[name &]
+1 -1
View File
@@ -1358,7 +1358,7 @@ JanetTable *janet_core_env(JanetTable *replacements) {
janet_def(env, "janet/build", janet_cstringv(JANET_BUILD),
JDOC("The build identifier of the running janet program."));
janet_def(env, "janet/config-bits", janet_wrap_integer(JANET_CURRENT_CONFIG_BITS),
JDOC("The flag set of config options from janetconf.h which is used to check "
JDOC("The flag set of config options from `janetconf.h` which is used to check "
"if native modules are compatible with the host program."));
/* Allow references to the environment */
+102 -68
View File
@@ -835,20 +835,38 @@ static const JanetAbstractType janet_filewatch_at = {
};
JANET_CORE_FN(cfun_filewatch_make,
"(filewatch/new channel & default-flags)",
"Create a new filewatcher that will give events to a channel channel. See `filewatch/add` for available flags.\n\n"
"When an event is triggered by the filewatcher, a struct containing information will be given to channel as with `ev/give`. "
"The contents of the channel depend on the OS, but will contain some common keys:\n\n"
"* `:type` -- the type of the event that was raised.\n\n"
"* `:file-name` -- the base file name of the file that triggered the event.\n\n"
"* `:dir-name` -- the directory name of the file that triggered the event.\n\n"
"Events also will contain keys specific to the host OS.\n\n"
"Windows has no extra properties on events.\n\n"
"Linux and the BSDs have the following extra properties on events:\n\n"
"* `:wd` -- the integer key returned by `filewatch/add` for the path that triggered this. This is a file descriptor integer on BSD and macos.\n\n"
"* `:wd-path` -- the string path for watched directory of file. For files, will be the same as `:file-name`, and for directories, will be the same as `:dir-name`.\n\n"
"* `:cookie` -- a semi-randomized integer used to associate related events, such as :moved-from and :moved-to events.\n\n"
"") {
"(filewatch/new chan & default-flags)",
"Create a new filewatcher that will give events to a channel "
"`chan`. See `filewatch/add` for available flags.\n"
"\n"
"When an event is triggered by the filewatcher, a struct "
"containing information will be given to `chan` as with "
"`ev/give`. The contents of `chan` depend on the OS, but will "
"contain some common keys:\n"
"\n"
"* `:type` - type of the event that was raised\n"
"* `:file-name` - base file name of file that triggered the "
"event\n"
"* `:dir-name` - directory name of file that triggered the "
"event\n"
"\n"
"Events will also contain keys specific to the host OS.\n"
"\n"
"Windows has no extra properties on events.\n"
"\n"
"Linux and BSDs have the following extra properties on "
"events:\n"
"\n"
"* `:wd` - integer key returned by `filewatch/add` for path "
"that triggered this. This is a file descriptor integer on "
"BSD and macos.\n"
"\n"
"* `:wd-path` - string path for watched directory of file. "
"For files, same as `:file-name`, and for directories, same "
"as `:dir-name`.\n"
"\n"
"* `:cookie` - a semi-randomized integer used to associate "
"related events, such as `:moved-from` and `:moved-to`.") {
janet_sandbox_assert(JANET_SANDBOX_FS_READ);
janet_arity(argc, 1, -1);
JanetChannel *channel = janet_getchannel(argv, 0);
@@ -859,60 +877,76 @@ JANET_CORE_FN(cfun_filewatch_make,
}
JANET_CORE_FN(cfun_filewatch_add,
"(filewatch/add watcher path flag & more-flags)",
"Add a path to the watcher. Available flags depend on the current OS, and are as follows:\n\n"
"Windows/MINGW (flags correspond to `FILE_NOTIFY_CHANGE_*` flags in win32 documentation):\n\n"
"FLAGS\n\n"
"* `:all` - trigger an event for all of the below triggers.\n\n"
"* `:attributes` - `FILE_NOTIFY_CHANGE_ATTRIBUTES`\n\n"
"* `:creation` - `FILE_NOTIFY_CHANGE_CREATION`\n\n"
"* `:dir-name` - `FILE_NOTIFY_CHANGE_DIR_NAME`\n\n"
"* `:last-access` - `FILE_NOTIFY_CHANGE_LAST_ACCESS`\n\n"
"* `:last-write` - `FILE_NOTIFY_CHANGE_LAST_WRITE`\n\n"
"* `:security` - `FILE_NOTIFY_CHANGE_SECURITY`\n\n"
"* `:size` - `FILE_NOTIFY_CHANGE_SIZE`\n\n"
"* `:recursive` - watch subdirectories recursively\n\n"
"Linux (flags correspond to `IN_*` flags from <sys/inotify.h>):\n\n"
"* `:access` - `IN_ACCESS`\n\n"
"* `:all` - `IN_ALL_EVENTS`\n\n"
"* `:attrib` - `IN_ATTRIB`\n\n"
"* `:close-nowrite` - `IN_CLOSE_NOWRITE`\n\n"
"* `:close-write` - `IN_CLOSE_WRITE`\n\n"
"* `:create` - `IN_CREATE`\n\n"
"* `:delete` - `IN_DELETE`\n\n"
"* `:delete-self` - `IN_DELETE_SELF`\n\n"
"* `:ignored` - `IN_IGNORED`\n\n"
"* `:modify` - `IN_MODIFY`\n\n"
"* `:move-self` - `IN_MOVE_SELF`\n\n"
"* `:moved-from` - `IN_MOVED_FROM`\n\n"
"* `:moved-to` - `IN_MOVED_TO`\n\n"
"* `:open` - `IN_OPEN`\n\n"
"* `:q-overflow` - `IN_Q_OVERFLOW`\n\n"
"* `:unmount` - `IN_UNMOUNT`\n\n\n"
"BSDs and macos (flags correspond to `NOTE_*` flags from <sys/event.h>). Not all flags are available on all systems:\n\n"
"* `:all` - `All available NOTE_* flags on the current platform`\n\n"
"* `:attrib` - `NOTE_ATTRIB`\n\n"
"* `:close-write` - `NOTE_CLOSE_WRITE`\n\n"
"* `:close` - `NOTE_CLOSE`\n\n"
"* `:delete` - `NOTE_DELETE`\n\n"
"* `:extend` - `NOTE_EXTEND`\n\n"
"* `:funlock` - `NOTE_FUNLOCK`\n\n"
"* `:link` - `NOTE_LINK`\n\n"
"* `:open` - `NOTE_OPEN`\n\n"
"* `:read` - `NOTE_READ`\n\n"
"* `:rename` - `NOTE_RENAME`\n\n"
"* `:revoke` - `NOTE_REVOKE`\n\n"
"* `:truncate` - `NOTE_TRUNCATE`\n\n"
"* `:write` - `NOTE_WRITE`\n\n\n"
"EVENT TYPES\n\n"
"On Windows, events will have the following possible types:\n\n"
"* `:unknown`\n\n"
"* `:added`\n\n"
"* `:removed`\n\n"
"* `:modified`\n\n"
"* `:renamed-old`\n\n"
"* `:renamed-new`\n\n"
"On Linux and BSDs, events will have a `:type` corresponding to the possible flags, excluding `:all`.\n"
"(filewatch/add watcher path flags & more-flags)",
"Add a path to the watcher. Available flags and event types "
"depend on the current OS, and are as follows.\n"
"\n"
"Flags\n"
"\n"
"Windows/MINGW (correspond to `FILE_NOTIFY_CHANGE_*` flags in "
"win32 documentation):\n"
"\n"
"* `:all` - trigger an event for all of the below triggers.\n"
"* `:attributes` - `FILE_NOTIFY_CHANGE_ATTRIBUTES`\n"
"* `:creation` - `FILE_NOTIFY_CHANGE_CREATION`\n"
"* `:dir-name` - `FILE_NOTIFY_CHANGE_DIR_NAME`\n"
"* `:last-access` - `FILE_NOTIFY_CHANGE_LAST_ACCESS`\n"
"* `:last-write` - `FILE_NOTIFY_CHANGE_LAST_WRITE`\n"
"* `:security` - `FILE_NOTIFY_CHANGE_SECURITY`\n"
"* `:size` - `FILE_NOTIFY_CHANGE_SIZE`\n"
"* `:recursive` - watch subdirectories recursively\n"
"\n"
"Linux (correspond to `IN_*` flags from `<sys/inotify.h>`):\n"
"\n"
"* `:access` - `IN_ACCESS`\n"
"* `:all` - `IN_ALL_EVENTS`\n"
"* `:attrib` - `IN_ATTRIB`\n"
"* `:close-nowrite` - `IN_CLOSE_NOWRITE`\n"
"* `:close-write` - `IN_CLOSE_WRITE`\n"
"* `:create` - `IN_CREATE`\n"
"* `:delete` - `IN_DELETE`\n"
"* `:delete-self` - `IN_DELETE_SELF`\n"
"* `:ignored` - `IN_IGNORED`\n"
"* `:modify` - `IN_MODIFY`\n"
"* `:move-self` - `IN_MOVE_SELF`\n"
"* `:moved-from` - `IN_MOVED_FROM`\n"
"* `:moved-to` - `IN_MOVED_TO`\n"
"* `:open` - `IN_OPEN`\n"
"* `:q-overflow` - `IN_Q_OVERFLOW`\n"
"* `:unmount` - `IN_UNMOUNT`\n"
"\n"
"BSDs and macos (correspond to `NOTE_*` flags from "
"`<sys/event.h>`). Not all flags are available on all "
"systems:\n"
"\n"
"* `:all` - All available `NOTE_*` flags on the current platform\n"
"* `:attrib` - `NOTE_ATTRIB`\n"
"* `:close-write` - `NOTE_CLOSE_WRITE`\n"
"* `:close` - `NOTE_CLOSE`\n"
"* `:delete` - `NOTE_DELETE`\n"
"* `:extend` - `NOTE_EXTEND`\n"
"* `:funlock` - `NOTE_FUNLOCK`\n"
"* `:link` - `NOTE_LINK`\n"
"* `:open` - `NOTE_OPEN`\n"
"* `:read` - `NOTE_READ`\n"
"* `:rename` - `NOTE_RENAME`\n"
"* `:revoke` - `NOTE_REVOKE`\n"
"* `:truncate` - `NOTE_TRUNCATE`\n"
"* `:write` - `NOTE_WRITE`\n"
"\n"
"Event Types\n"
"\n"
"On Windows, events will have the following possible types:\n"
"\n"
"* `:unknown`\n"
"* `:added`\n"
"* `:removed`\n"
"* `:modified`\n"
"* `:renamed-old`\n"
"* `:renamed-new`\n"
"\n"
"On Linux and BSDs, events will have a `:type` corresponding "
"to the possible flags, excluding `:all`.\n"
"") {
janet_sandbox_assert(JANET_SANDBOX_FS_READ);
janet_arity(argc, 2, -1);
+17 -12
View File
@@ -141,18 +141,23 @@ JANET_CORE_FN(cfun_io_temp,
JANET_CORE_FN(cfun_io_fopen,
"(file/open path &opt mode buffer-size)",
"Open a file. `path` is an absolute or relative path, and "
"`mode` is a set of flags indicating the mode to open the file in. "
"`mode` is a keyword where each character represents a flag. If the file "
"cannot be opened, returns nil, otherwise returns the new file handle. "
"Mode flags:\n\n"
"* r - allow reading from the file\n\n"
"* w - allow writing to the file\n\n"
"* a - append to the file\n\n"
"Following one of the initial flags, 0 or more of the following flags can be appended:\n\n"
"* b - open the file in binary mode (rather than text mode)\n\n"
"* + - open the file for both reading and writing\n\n"
"* n - error if the file cannot be opened instead of returning nil\n\n"
"See fopen (<stdio.h>, C99) for further details.") {
"`mode` is a set of flags indicating the mode to open the "
"file in. `mode` is a keyword where each character represents "
"a flag. If the file cannot be opened, returns nil, otherwise "
"returns the new file handle. Mode flags:\n"
"\n"
"* `r` - allow reading from file\n"
"* `w` - allow writing to file\n"
"* `a` - append to file\n"
"\n"
"After one of the initial flags, 0 or more of the following "
"flags can be appended:\n"
"\n"
"* `b` - open file in binary mode (rather than text mode)\n"
"* `+` - open file for both reading and writing\n"
"* `n` - error if file cannot be opened instead of returning nil\n"
"\n"
"See `fopen()` (`<stdio.h>`, C99) for further details.") {
janet_arity(argc, 1, 3);
const uint8_t *fname = janet_getstring(argv, 0);
const uint8_t *fmode;
+27 -19
View File
@@ -1916,20 +1916,25 @@ static struct tm *time_to_tm(const Janet *argv, int32_t argc, int32_t n, struct
JANET_CORE_FN(os_date,
"(os/date &opt time local)",
"Returns the given time as a date struct, or the current time if `time` is not given. "
"Date is given in UTC unless `local` is truthy, in which case the date is formatted for "
"the local timezone. Returns a struct with following key values. Note that all numbers are 0-indexed.\n\n"
"* :seconds - number of seconds [0-61]\n\n"
"* :minutes - number of minutes [0-59]\n\n"
"* :hours - number of hours [0-23]\n\n"
"* :month-day - day of month [0-30]\n\n"
"* :month - month of year [0, 11]\n\n"
"* :year - years since year 0 (e.g. 2019)\n\n"
"* :week-day - day of the week [0-6]\n\n"
"* :year-day - day of the year [0-365]\n\n"
"* :dst - if Day Light Savings is in effect\n\n"
"You can set local timezone by setting TZ environment variable. "
"See tzset(<time.h>) or _tzset(<time.h>) for further details.") {
"Returns the given time as a date struct, or the current time "
"if `time` is not given. Date is given in UTC unless `local` "
"is truthy, in which case the date is formatted for the local "
"timezone. Returns a struct with following key-value pairs. "
"Note that all numbers are 0-indexed.\n"
"\n"
"* `:seconds` - number of seconds [0-61]\n"
"* `:minutes` - number of minutes [0-59]\n"
"* `:hours` - number of hours [0-23]\n"
"* `:month-day` - day of month [0-30]\n"
"* `:month` - month of year [0, 11]\n"
"* `:year` - years since year 0 (e.g. 2019)\n"
"* `:week-day` - day of the week [0-6]\n"
"* `:year-day` - day of the year [0-365]\n"
"* `:dst` - if Day Light Savings is in effect\n"
"\n"
"The local timezone can be set by setting the `TZ` "
"environment variable. See `tzset()` (`<time.h>`) or "
"`_tzset()` (`<time.h>`) for further details.") {
janet_arity(argc, 0, 2);
(void) argv;
struct tm t_infos;
@@ -1951,11 +1956,14 @@ JANET_CORE_FN(os_date,
JANET_CORE_FN(os_strftime,
"(os/strftime fmt &opt time local)",
"Format the given time as a string, or the current time if `time` is not given. "
"The time is formatted according to the same rules as the ISO C89 function strftime(). "
"The time is formatted in UTC unless `local` is truthy, in which case the date is formatted for "
"the local timezone. You can set local timezone by setting TZ environment variable. "
"See tzset(<time.h>) or _tzset(<time.h>) for further details.") {
"Format the given time as a string, or the current time if "
"`time` is not given. The time is formatted according to the "
"same rules as the ISO C89 function `strftime()`. The time is "
"formatted in UTC unless `local` is truthy, in which case the "
"date is formatted for the local timezone. The local timezone "
"can be set by setting the `TZ` environment variable. See "
"`tzset()` (`<time.h>`) or `_tzset()`(`<time.h>`) for further "
"details.") {
janet_arity(argc, 1, 3);
const char *fmt = janet_getcstring(argv, 0);
/* ANSI X3.159-1989, section 4.12.3.5 "The strftime function" */