Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
39 lines (28 sloc) 1.76 KB

Package/import paths

All DCPU command line tools operate on a set of package paths:

dcpu-xxx [options] <packages>

Usually, <packages> is a list of one or more import paths. An import path that is a rooted path or that begins with a . or .. element is interpreted as a file system path and denotes the package in that directory.

Otherwise, the import path P denotes the package found in the directory $DCPUROOT/src/P.

If no import paths are given, the action applies to the package in the current directory.

The special import path all applies to any and all packages found under $DCPUROOT. For instance: dcpu-list all will list all known packages on the local system.

An import path is a pattern if it has a /... wildcard suffix. It can match any string, including the empty string. Such a pattern expands to all package directories found in $DCPUROOT trees with names matching the given pattern. For example: x/... matches package x as well as all of x's sub directories.

Every package in a program must have a unique import path. By convention, this is arranged by starting each path with a unique prefix that belongs to you. This can be a company name, your own name, or anything else you prefer. This is done to prevent name collisions with packages released by others.

Whether an import path refers to its src, pkg or bin equivalent, depends on the context in which it is used. The assembler, linker and emulator will all have different requirements in that regard. For example, the import path test/hw can refer to one of the following components:

  • $DCPUROOT/src/test/hw/*.dasm: Source code for package 'test/hw'
  • $DCPUROOT/pkg/test/hw.a: Compiled archive for package 'test/hw'
  • $DCPUROOT/bin/test/hw.bin: Compiled executable for package 'test/hw'