Skip to content

Commit 8556fdf

Browse files
committed
Add some documentation for namespaces
1 parent 282988e commit 8556fdf

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

Changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ Version 7.1.0
44
- Added new Spin2 @\"string" for strings with embedded C-style escapes
55
- Added DITTO to duplicate code/data in Spin2 assembly
66
- Added some of the upcoming Spin2 v51 float functions
7+
- Added %namesp feature for DAT namespaces
78
- Many internal changes to support DITTO and future assembly work
89
- Updated -gbrk debug code (thanks Ada)
910
- Use cluster size for stat() st_blksize on FAT32

doc/spin.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,33 @@ end
672672
```
673673
Available conditional compilation directives are: `if`, `elseif`, `else`, and `end`. These may also be prefixed with `%` (so `%if`. `%elseif`, `%else`, and `%end`) to remove any ambiguity with future Spin syntax.
674674
675+
### DAT Namespaces
676+
677+
Within a DAT section it is possible to declare a "namespace" within which
678+
labels can be declared with the same name as labels in other namespaces.
679+
For example:
680+
```
681+
DAT
682+
orgh
683+
a long $100 ' declares a in default (global) namespace
684+
%namesp x ' switch to new namespace
685+
a long $200 ' new label a inside namespace x; does not conflict with global
686+
%namesp ' return to default namespace
687+
c
688+
long @@@a ' refers to a in global namespace
689+
long @@@x.a ' refers to a in namespace x
690+
```
691+
DAT
692+
orgh
693+
a long $100 ' declares a in default (global) namespace
694+
%namesp x ' switch to new namespace
695+
a long $200 ' new label a inside namespace x; does not conflict with global
696+
%namesp ' return to default namespace
697+
c
698+
long @@@a ' refers to a in global namespace
699+
long @@@x.a ' refers to a in namespace x
700+
```
701+
675702
## New intrinsics for both P1 and P2
676703

677704
Flexspin supports some new builtin functions. These typically start with an underscore to avoid confusion with existing variable names. Note that in Spin2 mode many of these are available without the leading underscore, and in fact it's better to use the non-underscore versions since those are also supported in the official Parallax compiler.

0 commit comments

Comments
 (0)