diff options
| author | 2023-05-12 14:53:20 -0400 | |
|---|---|---|
| committer | 2023-05-12 14:53:20 -0400 | |
| commit | 78e775a1b89c827ad2e96b73a723c7caf83f5a82 (patch) | |
| tree | 11baea453275a2c9d1d22a64bcbdb9344be0cfb7 /src/polyfill.h | |
| parent | update many things (diff) | |
rewrite
Split it into multiple things.
The new tests will actually reflect how you should use the native
library.
Diffstat (limited to 'src/polyfill.h')
| -rw-r--r-- | src/polyfill.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/polyfill.h b/src/polyfill.h new file mode 100644 index 0000000..5fa72ac --- /dev/null +++ b/src/polyfill.h @@ -0,0 +1,22 @@ +#pragma once +#include <janet.h> + +#if JANET_VERSION_MAJOR < 2 && JANET_VERSION_MINOR < 28 +#define POLYFILL_CBYTES +const char* janet_getcbytes(const Janet *argv, int32_t n); +const char *janet_optcbytes(const Janet *argv, int32_t argc, int32_t n, const char *dflt); + +#if !defined(JANET_NO_SOURCEMAPS) && !defined(JANET_NO_DOCSTRINGS) +#undef JANET_FN +#define JANET_FN(CNAME, USAGE, DOCSTRING) \ + static const int32_t CNAME##_sourceline_ = __LINE__; \ + static const char CNAME##_docstring_[] = USAGE "\n\n" DOCSTRING; \ + Janet CNAME (int32_t argc, Janet *argv) +#elif !defined(JANET_NO_SOURCEMAPS) && defined(JANET_NO_DOCSTRINGS) +#undef JANET_FN +#define JANET_FN(CNAME, USAGE, DOCSTRING) \ + static const int32_t CNAME##_sourceline_ = __LINE__; \ + Janet CNAME (int32_t argc, Janet *argv) +#endif // !defined(JANET_NO_SOURCEMAPS) + +#endif // JANET_VERSION_MAJOR < 2 && JANET_VERSION_MINOR < 28 |
