Skip to content

pcode

builtin · libnexusinterp/corefcn/pcode-proprietary.cc

: pcode item
: pcode item1 item2 …
: pcode … -inplace

Compile M-files to Nexus p-files.

Each item is an M-file or a folder. A folder contributes every ‘.m’ file directly inside it (subfolders are left alone, and other extensions are ignored). The source is parsed and its AST is written to a binary ‘.p’ file. Source text is not embedded. Identifier names and line numbers are preserved for diagnostics.

By default each ‘.p’ file is written in the current working directory, under the source file’s base name. With -inplace it is written next to the source.

On the Nexus path a ‘.p’ file runs in place of the ‘.m’ file of the same name, including after the ‘.m’ file is edited or removed. exist returns 6 for that name, and which reports the ‘.p’ path. clear name drops the copy in memory so the next call reads the file again; while the ‘.p’ file is still there it still wins over the ‘.m’ file.

A missing source is a warning, identifier MATLAB:pcode:FileNotFound, not an error. A non-string argument is an error, identifier MATLAB:pcode:ArgMustBeString.

Note: Nexus ‘.p’ files are not compatible with MATLAB’s pcode format. MATLAB-generated ‘.p’ files cannot be loaded by Nexus, and Nexus ‘.p’ files cannot be loaded by MATLAB. Regenerate them with Nexus pcode. See also doc/pcode.md.