Janet 1.39.1-e9c6678 Documentation
(Other Versions: 1.38.0 1.37.1 1.36.0 1.35.0 1.34.0 1.31.0 1.29.1 1.28.0 1.27.0 1.26.0 1.25.1 1.24.0 1.23.0 1.22.0 1.21.0 1.20.0 1.19.0 1.18.1 1.17.1 1.16.1 1.15.0 1.13.1 1.12.2 1.11.1 1.10.1 1.9.1 1.8.1 1.7.0 1.6.0 1.5.1 1.5.0 1.4.0 1.3.1 )

JPM

Index

cc/archive-c cc/compile-c cc/create-buffer-c cc/create-buffer-c-impl cc/create-executable cc/embed-name cc/entry-name cc/entry-replace cc/link-c cc/make-bin-source cc/make-define cc/make-defines cc/modpath-to-meta cc/modpath-to-static cc/out-path cgen/add-loader cgen/ir cgen/mangle cgen/print-ir commands/build commands/clean commands/configure commands/deps commands/enable-local-mode commands/help commands/install commands/jpm-debug-repl commands/list-installed commands/list-pkgs commands/list-rules commands/list-tasks commands/new-c-project commands/new-exe-project commands/new-project commands/quickbin commands/set-tree commands/show-config commands/show-paths commands/show-rule-tree commands/test commands/update-pkgs config/builtin-configs config/config-checkers config/config-docs config/config-options config/config-parsers config/config-set config/defconf config/dyn:ar config/dyn:auto-shebang config/dyn:binpath config/dyn:build-type config/dyn:buildpath config/dyn:c++ config/dyn:c++-link config/dyn:cc config/dyn:cc-link config/dyn:cflags config/dyn:cflags-verbose config/dyn:config-file config/dyn:cppflags config/dyn:curlpath config/dyn:dest-dir config/dyn:dynamic-cflags config/dyn:dynamic-lflags config/dyn:gitpath config/dyn:headerpath config/dyn:is-msvc config/dyn:janet config/dyn:janet-cflags config/dyn:janet-importlib config/dyn:janet-lflags config/dyn:ldflags config/dyn:lflags config/dyn:libpath config/dyn:local config/dyn:manpath config/dyn:modext config/dyn:modpath config/dyn:nocolor config/dyn:offline config/dyn:optimize config/dyn:pkglist config/dyn:silent config/dyn:statext config/dyn:tarpath config/dyn:test config/dyn:tree config/dyn:update-pkgs config/dyn:use-batch-shell config/dyn:verbose config/dyn:workers config/load-config config/load-config-file config/load-default config/load-options config/opt config/read-env-variables config/save-config config/shorthand-mapping dagbuild/pdag dagbuild/pmap make-config/auto make-config/generate-config pm/bundle-install pm/curl pm/do-rule pm/download-bundle pm/download-git-bundle pm/download-tar-bundle pm/git pm/import-rules pm/is-bundle-installed pm/load-lockfile pm/load-project-meta pm/make-jpm-env pm/make-lockfile pm/out-of-tree-config pm/post-deps pm/require-jpm pm/resolve-bundle pm/tar pm/update-git-bundle pm/update-installed rules/add-body rules/add-dep rules/add-input rules/add-output rules/add-thunk rules/build-rules rules/getrules rules/phony rules/rule rules/sh-phony rules/sh-rule rules/sh-task rules/task scaffold/scaffold-project shutil/abspath shutil/basename shutil/clear-cache shutil/clear-manifest shutil/clexe-shell shutil/color shutil/copy shutil/copyfile shutil/create-dirs shutil/devnull shutil/dirname shutil/do-monkeypatch shutil/drop1-shell shutil/exec-slurp shutil/filepath-replace shutil/find-build-dir shutil/find-cache shutil/find-manifest shutil/find-manifest-dir shutil/is-mingw shutil/is-win shutil/is-win-or-mingw shutil/path-splitter shutil/rimraf shutil/rm shutil/run-patched shutil/run-repl shutil/run-script shutil/shell shutil/undo-monkeypatch


cc/archive-c function source
(archive-c opts target & objects)

Link object files together to make a static library.

cc/compile-c function source
(compile-c compiler opts src dest &opt static?)

Compile a C file into an object file.

cc/create-buffer-c function source
(create-buffer-c source dest name)

Inline raw byte file as a c file.

cc/create-buffer-c-impl function source
(create-buffer-c-impl bytes dest name)


cc/create-executable function source
(create-executable opts source dest no-core)

Links an image with libjanet.a (or .lib) to produce an executable. Also will try to link native modules into the final executable as well.

cc/embed-name function source
(embed-name path)

Rename a janet symbol for embedding.

cc/entry-name function source
(entry-name name)

Name of symbol that enters static compilation of a module.

cc/entry-replace function source
(entry-replace name)

Escape special characters in the entry-name

cc/link-c function source
(link-c has-cpp opts target & objects)

Link C or C++ object files together to make a native module.

cc/make-bin-source function source
(make-bin-source declarations lookup-into-invocations no-core)


cc/make-define function source
(make-define define value)

Generate strings for adding custom defines to the compiler.

cc/make-defines function source
(make-defines defines)

Generate many defines. Takes a dictionary of defines. If a value is true, generates -DNAME (/DNAME on windows), otherwise -DNAME=value.

cc/modpath-to-meta function source
(modpath-to-meta path)

Get the meta file path (.meta.janet) corresponding to a native module path (.so).

cc/modpath-to-static function source
(modpath-to-static path)

Get the static library (.a) path corresponding to a native module path (.so).

cc/out-path function source
(out-path path from-ext to-ext)

Take a source file path and convert it to an output path.

cgen/add-loader function source
(add-loader)

Adds the custom template loader to Janet's module/loaders and update module/paths.

cgen/ir macro source
(ir & body)

Macro that automatically quotes the body provided and calls (print-ir ...) on the body.

cgen/mangle function source
(mangle token)

Convert any sequence of bytes to a valid C identifier in a way that is unlikely to collide. `print-ir` will not mangle symbols for you.

cgen/print-ir function source
(print-ir ir)

Compile the CGEN IR to C and print it to (dyn :out).

commands/build function source
(build)


commands/clean function source
(clean)


commands/configure function source
(configure &opt path)

Setup an out-of-tree build with certain configuration options.

commands/deps function source
(deps)


commands/enable-local-mode function source
(enable-local-mode)

Modify the config to enable local development. Creates a local tree if one does not exist in ./jpm_tree/

commands/help function source
(help)


commands/install function source
(install & repo)


commands/jpm-debug-repl function source
(jpm-debug-repl)


commands/list-installed function source
(list-installed)


commands/list-pkgs function source
(list-pkgs &opt search)


commands/list-rules function source
(list-rules &opt ctx)


commands/list-tasks function source
(list-tasks &opt ctx)


commands/new-c-project function source
(new-c-project name)

Create a new C project

commands/new-exe-project function source
(new-exe-project name)

Create a new executable project

commands/new-project function source
(new-project name)

Create a new project

commands/quickbin function source
(quickbin input output)


commands/set-tree function source
(set-tree tree)

Set the module tree for installing dependencies. This just sets the modpath binpath and manpath. Also creates the tree if it doesn't exist. However, still uses the system libraries and headers for janet.

commands/show-config function source
(show-config)


commands/show-paths function source
(show-paths)


commands/show-rule-tree function source
(show-rule-tree &opt root depth)


commands/test function source
(test)


commands/update-pkgs function source
(update-pkgs)


config/builtin-configs table source
Table of all built-in options, as opposed to project deifned options.

config/config-checkers table source
A table of all of the dynamic config bindings to checkers (validators).

config/config-docs table source
Table of all of the help text for each config option.

config/config-options table source
A table of possible options for enum option types.

config/config-parsers table source
A table of all of the dynamic config bindings to parsers.

config/config-set table source
Listing of all config dyns.

config/defconf macro source
(defconf kw &opt parser docs options)

Define a function that wraps (dyn :keyword). This will allow use of dynamic bindings with static runtime checks.

config/dyn:ar function source
(dyn:ar &opt dflt)


config/dyn:auto-shebang function source
(dyn:auto-shebang &opt dflt)


config/dyn:binpath function source
(dyn:binpath &opt dflt)


config/dyn:build-type function source
(dyn:build-type &opt dflt)


config/dyn:buildpath function source
(dyn:buildpath &opt dflt)


config/dyn:c++ function source
(dyn:c++ &opt dflt)


config/dyn:c++-link function source
(dyn:c++-link &opt dflt)


config/dyn:cc function source
(dyn:cc &opt dflt)


config/dyn:cc-link function source
(dyn:cc-link &opt dflt)


config/dyn:cflags function source
(dyn:cflags &opt dflt)


config/dyn:cflags-verbose function source
(dyn:cflags-verbose &opt dflt)


config/dyn:config-file function source
(dyn:config-file &opt dflt)


config/dyn:cppflags function source
(dyn:cppflags &opt dflt)


config/dyn:curlpath function source
(dyn:curlpath &opt dflt)


config/dyn:dest-dir function source
(dyn:dest-dir &opt dflt)


config/dyn:dynamic-cflags function source
(dyn:dynamic-cflags &opt dflt)


config/dyn:dynamic-lflags function source
(dyn:dynamic-lflags &opt dflt)


config/dyn:gitpath function source
(dyn:gitpath &opt dflt)


config/dyn:headerpath function source
(dyn:headerpath &opt dflt)


config/dyn:is-msvc function source
(dyn:is-msvc &opt dflt)


config/dyn:janet function source
(dyn:janet &opt dflt)


config/dyn:janet-cflags function source
(dyn:janet-cflags &opt dflt)


config/dyn:janet-importlib function source
(dyn:janet-importlib &opt dflt)


config/dyn:janet-lflags function source
(dyn:janet-lflags &opt dflt)


config/dyn:ldflags function source
(dyn:ldflags &opt dflt)


config/dyn:lflags function source
(dyn:lflags &opt dflt)


config/dyn:libpath function source
(dyn:libpath &opt dflt)


config/dyn:local function source
(dyn:local &opt dflt)


config/dyn:manpath function source
(dyn:manpath &opt dflt)


config/dyn:modext function source
(dyn:modext &opt dflt)


config/dyn:modpath function source
(dyn:modpath &opt dflt)


config/dyn:nocolor function source
(dyn:nocolor &opt dflt)


config/dyn:offline function source
(dyn:offline &opt dflt)


config/dyn:optimize function source
(dyn:optimize &opt dflt)


config/dyn:pkglist function source
(dyn:pkglist &opt dflt)


config/dyn:silent function source
(dyn:silent &opt dflt)


config/dyn:statext function source
(dyn:statext &opt dflt)


config/dyn:tarpath function source
(dyn:tarpath &opt dflt)


config/dyn:test function source
(dyn:test &opt dflt)


config/dyn:tree function source
(dyn:tree &opt dflt)


config/dyn:update-pkgs function source
(dyn:update-pkgs &opt dflt)


config/dyn:use-batch-shell function source
(dyn:use-batch-shell &opt dflt)


config/dyn:verbose function source
(dyn:verbose &opt dflt)


config/dyn:workers function source
(dyn:workers &opt dflt)


config/load-config function source
(load-config settings &opt override)

Load a configuration from a table or struct.

config/load-config-file function source
(load-config-file path &opt override)

Load a configuration from a file. If override is set, will override already set values. Otherwise will prefer the current value over the settings from the config file.

config/load-default function source
(load-default &opt override)

Load the default configuration.

config/load-options function source
(load-options &opt path)

Load a file that contains config options that can be set. If no such file exists, then do nothing.

config/opt function source
(opt opts key &opt dflt)

Get an option, allowing overrides via dynamic bindings AND some default value dflt if no dynamic binding is set.

config/read-env-variables function source
(read-env-variables)

Read environment variables that correspond to config variables into dyns.

config/save-config function source
(save-config path)

Write the current configuration information to a file.

config/shorthand-mapping struct source
Map some single characters to long options.

dagbuild/pdag function source
(pdag f dag &opt n-workers)

Executes a dag by calling f on every node in the graph. Can set the number of workers for parallel execution. The graph is represented as a table mapping nodes to arrays of child nodes. Each node will only be evaluated after all children have been evaluated. Returns a table mapping each node to the result of `(f node)`.

dagbuild/pmap function source
(pmap f data)

Function form of `ev/gather`. If any of the sibling fibers error, all other siblings will be canceled. Returns the gathered results in an array.

make-config/auto function source
(auto)

Get an autodetected config.

make-config/generate-config function source
(generate-config &opt destdir silent as-data)

Make a pretty good configuration file for the current target. Returns a buffer with config source contents. If `destdir` is given, will generate the folders needed to create a jpm tree.

pm/bundle-install function source
(bundle-install bundle &opt no-deps force-update)

Install a bundle from a git repository.

pm/curl function source
(curl & args)

Make a call to curl

pm/do-rule function source
(do-rule target)

Evaluate a given rule in a one-off manner.

pm/download-bundle function source
(download-bundle url bundle-type &opt tag shallow)

Download the package source (using git) to the local cache. Return the path to the downloaded or cached soure code.

pm/download-git-bundle function source
(download-git-bundle bundle-dir url tag shallow)

Download a git bundle from a remote respository

pm/download-tar-bundle function source
(download-tar-bundle bundle-dir url &opt force-gz)

Download a dependency from a tape archive. The archive should have exactly one top level directory that contains the contents of the project.

pm/git function source
(git & args)

Make a call to git.

pm/import-rules function source
(import-rules path &opt base-env)

Import another file that defines more rules. This ruleset is merged into the current ruleset.

pm/is-bundle-installed function source
(is-bundle-installed bundle)

Determines if a bundle has been installed or not

pm/load-lockfile function source
(load-lockfile &opt filename)

Load packages from a lockfile.

pm/load-project-meta function source
(load-project-meta &opt path)

Load the metadata from a project.janet file without doing a full evaluation of the project.janet file. Returns a struct with the project metadata. Raises an error if no metadata found.

pm/make-jpm-env function source
(make-jpm-env &opt base-env)

Create an environment that is preloaded with jpm symbols.

pm/make-lockfile function source
(make-lockfile &opt filename)


pm/out-of-tree-config function source
(out-of-tree-config path &opt options)

Create an out of tree build configuration. This lets a user have a debug or release build, as well as other configuration on a one time basis. This works by creating a new directory with a project.janet that loads in the original project.janet file with some settings changed.

pm/post-deps macro source
(post-deps & body)

Run code at the top level if jpm dependencies are installed. Build code that imports dependencies should be wrapped with this macro, as project.janet needs to be able to run successfully even without dependencies installed.

pm/require-jpm function source
(require-jpm path &opt base-env)

Require a jpm file project file. This is different from a normal require in that code is loaded in the jpm environment.

pm/resolve-bundle function source
(resolve-bundle bundle)

Convert any bundle string/table to the normalized table form.

pm/tar function source
(tar & args)

Make a call to tar.

pm/update-git-bundle function source
(update-git-bundle bundle-dir tag shallow)

Fetch latest tag version from remote repository

pm/update-installed function source
(update-installed)

Update all previously installed packages to their latest versions.

rules/add-body macro source
(add-body target & body)

Add recipe code to an existing rule. This makes existing rules do more but does not modify the dependency graph.

rules/add-dep function source
(add-dep target dep)

Alias for `add-input`

rules/add-input function source
(add-input target input)

Add a dependency to an existing rule. Useful for extending phony rules or extending the dependency graph of existing rules.

rules/add-output function source
(add-output target output)

Add an output file to an existing rule. Rules can contain multiple outputs, but are still referred to by a main target name.

rules/add-thunk function source
(add-thunk target thunk)

Append a thunk to a target's recipe.

rules/build-rules function source
(build-rules rules targets &opt n-workers)

Given a graph of all rules, extract a work graph that will build out-of-date files.

rules/getrules function source
(getrules)


rules/phony macro source
(phony target deps & body)

Alias for `task`.

rules/rule macro source
(rule target deps & body)

Add a rule to the rule graph.

rules/sh-phony macro source
(sh-phony target deps & body)

Alias for `sh-task`.

rules/sh-rule macro source
(sh-rule target deps & body)

Add a rule that invokes a shell command, and fails if the command returns non-zero.

rules/sh-task macro source
(sh-task target deps & body)

Add a task that invokes a shell command, and fails if the command returns non-zero.

rules/task macro source
(task target deps & body)

Add a task rule to the rule graph. A task rule will always run if invoked (it is always considered out of date).

scaffold/scaffold-project function source
(scaffold-project name &opt options)

Generate a standardized project scaffold.

shutil/abspath function source
(abspath path)

Create an absolute path. Does not resolve . and .. (useful for generating entries in install manifest file).

shutil/basename function source
(basename path)

Get the filename of a path without any leading directory components.

shutil/clear-cache function source
(clear-cache)

Clear the global git cache.

shutil/clear-manifest function source
(clear-manifest)

Clear the global installation manifest.

shutil/clexe-shell function source
(clexe-shell & args)


shutil/color function source
(color input-color text)

Color text with ascii escape sequences if (os/isatty)

shutil/copy function source
(copy src dest)

Copy a file or directory recursively from one location to another.

shutil/copyfile function source
(copyfile src dest)

Copy a file one location to another.

shutil/create-dirs function source
(create-dirs dest)

Create all directories needed for a file (mkdir -p).

shutil/devnull function source
(devnull)


shutil/dirname function source
(dirname path)

Get the directory of a file without the filename.

shutil/do-monkeypatch function source
(do-monkeypatch build-dir)

Modify the existing environment to have the same paths as the test environment.

shutil/drop1-shell function source
(drop1-shell std args)

Variant of `shell` to play nice with cl.exe, which outputs some junk to terminal that can't be turned off.

shutil/exec-slurp function source
(exec-slurp & args)

Read stdout of subprocess and return it trimmed in a string.

shutil/filepath-replace function source
(filepath-replace repo)

Remove special characters from a string or path to make it into a path segment.

shutil/find-build-dir function source
(find-build-dir)

Gets the build directory to output files to.

shutil/find-cache function source
(find-cache)

Return the path to the global cache.

shutil/find-manifest function source
(find-manifest name)

Get the full path of a manifest file given a package name.

shutil/find-manifest-dir function source
(find-manifest-dir)

Get the path to the directory containing manifests for installed packages.

shutil/is-mingw function source
(is-mingw)

Check if built with mingw

shutil/is-win function source
(is-win)

Check if we should assume a DOS-like shell or default to posix shell.

shutil/is-win-or-mingw function source
(is-win-or-mingw)

Check if built with mingw

shutil/path-splitter core/peg source
split paths on / and \.

shutil/rimraf function source
(rimraf path)

Hard delete directory tree

shutil/rm function source
(rm path)

Remove a directory and all sub directories.

shutil/run-patched function source
(run-patched & extra-args)

Run a subprocess Janet repl that has the same environment as the test environment.

shutil/run-repl function source
(run-repl)

Run a repl in the monkey patched test environment

shutil/run-script function source
(run-script path)

Run a local script in the monkey patched environment.

shutil/shell function source
(shell & args)

Do a shell command

shutil/undo-monkeypatch function source
(undo-monkeypatch old-builddir)