Skip to content

Commit 52a38aa

Browse files
committed
Update CLAUDE.md
1 parent d4513cc commit 52a38aa

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

CLAUDE.md

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ Build requires Ghostscript (`gs`) in PATH and Perl.
5252

5353
### Terminology
5454

55-
"Packaging" refers to PostScript processed into a form easier to distribute but
56-
is harder to debug:
55+
"Packaging" refers to PostScript processed (by the build system's "packager")
56+
into a form easier to distribute but is harder to debug:
5757

5858
- Efficient byte-based encodings for numbers and operators
5959
- Compressed numeric/string arrays
@@ -85,7 +85,7 @@ Build outputs:
8585
- `build/standalone/<encoder>.ps` - Standalone encoder (manual, only required deps built)
8686

8787

88-
## Resource File Structure
88+
## Resource Source File Structure
8989

9090
Each resource source file has a similar structure:
9191

@@ -102,8 +102,8 @@ Each resource source file has a similar structure:
102102
4. **Static data structures**
103103
- Plain definitions of literal stuctured data (arrays and dicts) that is costly to assemble if executed every call
104104
- Runs once during resource definition; values immediately referenced by main procedure
105-
- Names are prefixed with the resource name (e.g., `encoder.charmap`)
106-
- Names are stored in a temporary dictionary discarded after resource definition, but values persist via immediate reference (`//encoder.static_var`)
105+
- Names MUST be prefixed with the resource name (e.g., `encoder.charmap`) - the Makefile extracts all `//name` references to populate the packager's atload template, requiring globally unique names
106+
- `//name` immediate references are resolved at parse time, embedding the value directly into procedures
107107
- Embedded procedures should have explicit `bind`
108108
- Must be marked `readonly`
109109

@@ -118,7 +118,7 @@ Each resource source file has a similar structure:
118118
- Calls lazy initialisation procedure
119119

120120

121-
### Encoder Metadata
121+
#### Encoder Metadata
122122

123123
Encoder source files contain metadata comments:
124124

@@ -136,6 +136,17 @@ system and is API for users that want to assemble the resources into a PS file
136136
prolog.
137137

138138

139+
### Resource output file structure
140+
141+
Built resource files have a similar structure to their source files, with their
142+
source (packaged or otherwise) wrapped by comments that follow the PostScript
143+
language Document Structuring Conventions.
144+
145+
- `BeginResource:` DSC comment contains VM memory usage that is measured by the build system per-resource by pre-loading all dependencies before measurement, so each resource's VMusage reflects only its own consumption.
146+
147+
Monolithic outputs contain comments that feature a "--BEGIN/END TEMPLATE--" marker pair that users can use to splice the relevant contents into the prolog of a PS document.
148+
149+
139150
### Lazy Initialisation Pattern
140151

141152
```postscript
@@ -396,7 +407,7 @@ Large 2D symbols have different runtime bottlenecks, for example:
396407
## Testing
397408

398409
- `tests/run_tests` - Top-level test orchestrator
399-
- `tests/ps_tests/*.ps.test` - Individual encoder tests (run against packaged resources)
410+
- `tests/ps_tests/*.ps.test` - Individual encoder tests (run from `build/packaged_resource/Resource` directory)
400411
- `tests/test_*/run` - Integration tests for each build variant
401412

402413
### Test Utilities

0 commit comments

Comments
 (0)