cppsp v1.5 --module system update
Source: Dev.to
Overview
cppsp_compiler mod.cppsp -header
Generates a .h file and turns int main(){...} into a comment.
Configuration
-
module.ini – Example entry:
C:...\modfolder1, C:...\modfolder1Paths listed here are searched when resolving imports.
Importing Modules
-
You can import a
.cppspmodule with theimportstatement.
Example:import a.b.mod;-
a.b.modcorresponds to the filea/b/mod.cppsp. -
The search starts from the parent directories listed in
module.ini. -
The import generates nested namespaces:
namespace a { namespace b { namespace mod { // ... } } }
-
-
Multi‑level namespaces are supported for
@custom xxx(...)constructs.
Packages
-
The
packagedirective is written inside a.cppspfile.
Example:package d.e.f;This replaces the namespace that would otherwise be generated by an
importsuch asimport a.b.c.
Using Namespaces
-
The
usestatement brings namespaces into scope, similar tousing namespacein standard C++.
Example:use a.b.c;Any symbols introduced by
@custom xxx(...)are also affected byuse.