coco-tools 0.24__tar.gz → 0.26__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. {coco_tools-0.24/coco_tools.egg-info → coco_tools-0.26}/PKG-INFO +113 -66
  2. {coco_tools-0.24 → coco_tools-0.26}/README.md +111 -65
  3. {coco_tools-0.24 → coco_tools-0.26}/coco/__init__.py +1 -1
  4. {coco_tools-0.24 → coco_tools-0.26}/coco/b09/compiler.py +3 -3
  5. {coco_tools-0.24 → coco_tools-0.26}/coco/b09/configs.py +2 -1
  6. {coco_tools-0.24 → coco_tools-0.26}/coco/b09/elements.py +1 -1
  7. {coco_tools-0.24 → coco_tools-0.26}/coco/b09/procbank.py +3 -4
  8. {coco_tools-0.24 → coco_tools-0.26}/coco/b09/visitors.py +2 -2
  9. {coco_tools-0.24 → coco_tools-0.26}/coco/decb_to_b09.py +0 -1
  10. {coco_tools-0.24 → coco_tools-0.26}/coco/maxtoppm.py +0 -1
  11. {coco_tools-0.24 → coco_tools-0.26}/coco/mge_viewer2.py +1 -2
  12. coco_tools-0.26/coco/png_utilities.py +494 -0
  13. {coco_tools-0.24 → coco_tools-0.26}/coco/util.py +0 -1
  14. {coco_tools-0.24 → coco_tools-0.26}/coco/veftopng.py +2 -1
  15. {coco_tools-0.24 → coco_tools-0.26/coco_tools.egg-info}/PKG-INFO +113 -66
  16. {coco_tools-0.24 → coco_tools-0.26}/coco_tools.egg-info/SOURCES.txt +2 -0
  17. {coco_tools-0.24 → coco_tools-0.26}/coco_tools.egg-info/entry_points.txt +3 -0
  18. {coco_tools-0.24 → coco_tools-0.26}/coco_tools.egg-info/requires.txt +1 -0
  19. {coco_tools-0.24 → coco_tools-0.26}/pyproject.toml +18 -11
  20. {coco_tools-0.24 → coco_tools-0.26}/tests/coco_tests/b09/test_configs.py +2 -1
  21. {coco_tools-0.24 → coco_tools-0.26}/tests/coco_tests/b09/test_visitors.py +15 -12
  22. {coco_tools-0.24 → coco_tools-0.26}/LICENSE +0 -0
  23. {coco_tools-0.24 → coco_tools-0.26}/coco/b09/__init__.py +0 -0
  24. {coco_tools-0.24 → coco_tools-0.26}/coco/b09/error_handler.py +0 -0
  25. {coco_tools-0.24 → coco_tools-0.26}/coco/b09/grammar.py +1 -1
  26. {coco_tools-0.24 → coco_tools-0.26}/coco/b09/parser.py +19 -19
  27. {coco_tools-0.24 → coco_tools-0.26}/coco/b09/prog.py +0 -0
  28. {coco_tools-0.24 → coco_tools-0.26}/coco/cm3toppm.py +0 -0
  29. {coco_tools-0.24 → coco_tools-0.26}/coco/hrstoppm.py +0 -0
  30. {coco_tools-0.24 → coco_tools-0.26}/coco/mgetoppm.py +0 -0
  31. {coco_tools-0.24 → coco_tools-0.26}/coco/pixtopgm.py +0 -0
  32. {coco_tools-0.24 → coco_tools-0.26}/coco/rattoppm.py +0 -0
  33. {coco_tools-0.24 → coco_tools-0.26}/coco/resources/__init__.py +0 -0
  34. {coco_tools-0.24 → coco_tools-0.26}/coco/resources/ecb.b09 +0 -0
  35. {coco_tools-0.24 → coco_tools-0.26}/coco_tools.egg-info/dependency_links.txt +0 -0
  36. {coco_tools-0.24 → coco_tools-0.26}/coco_tools.egg-info/top_level.txt +0 -0
  37. {coco_tools-0.24 → coco_tools-0.26}/setup.cfg +0 -0
  38. {coco_tools-0.24 → coco_tools-0.26}/tests/coco_tests/b09/__init__.py +0 -0
  39. {coco_tools-0.24 → coco_tools-0.26}/tests/coco_tests/b09/test_b09.py +0 -0
  40. {coco_tools-0.24 → coco_tools-0.26}/tests/coco_tests/fixtures/__init__.py +0 -0
  41. {coco_tools-0.24 → coco_tools-0.26}/tests/test_error_handler.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: coco-tools
3
- Version: 0.24
3
+ Version: 0.26
4
4
  Summary: TRS-80 Color Computer Tools
5
5
  Author-email: Jamie Cho <jamieleecho@gmail.com>
6
6
  License-Expression: GPL-2.0
@@ -14,6 +14,7 @@ Classifier: Programming Language :: Python :: 3
14
14
  Requires-Python: >=3.9.19
15
15
  Description-Content-Type: text/markdown
16
16
  License-File: LICENSE
17
+ Requires-Dist: colormath>=3.0.0
17
18
  Requires-Dist: parsimonious>=0.10.0
18
19
  Requires-Dist: Pillow>=7.0.0
19
20
  Requires-Dist: pypng>=0.0.18
@@ -28,7 +29,7 @@ the [TRS-80 Color Computer](https://en.wikipedia.org/wiki/TRS-80_Color_Computer)
28
29
 
29
30
  ## Installation
30
31
 
31
- ```
32
+ ```bash
32
33
  # To install via pip
33
34
  pip install coco-tools
34
35
 
@@ -39,32 +40,11 @@ make install-pre-commit
39
40
  make install
40
41
  ```
41
42
 
42
- The `Makefile` makes it easy to perform the most common operations:
43
- * `make all` transpiles several exapmle ECB programs to Basic09
44
- * `make check-all` runs linting and `uv.lock` checks
45
- * `make check-lint` checks for linting issues
46
- * `make check-lock` verifies the `uv.lock` is aligned to `pyproject.toml`
47
- * `make clean` cleans the virtual environment and caches
48
- * `make default` runs a default set of checks on the code
49
- * `make fix-all` formats the code, fixes lint errors and runs locks `uv.lock` to `pyproject.toml`
50
- * `make fix-format` formats the code
51
- * `make fix-lint` fixes linting issues
52
- * `make fix-lint-unsafe` fixes linting issues potentially adding inadvertant bugs
53
- * `make help` outputs the different make options
54
- * `make install` build install the distribution
55
- * `make install-pre-commit` installs pre-commit hooks
56
- * `make lock` locks `uv.lock` to `pyproject.toml`
57
- * `make install-pre-commit` installs pre-commit hooks
58
- * `make run-tests` runs the unit tests
59
- * `make sync` syncs the python environment with `uv.lock`
60
-
61
- `.vscode/settings.json` is set so that unit tests can be run without further configuration.
62
-
63
43
  ## Tools
64
44
 
65
- ### [decb-to-b09](./README.decb-to-b09.md)
45
+ ### [decb-to-b09](https://github.com/jamieleecho/coco-tools/blob/main/README.decb-to-b09.md)
66
46
 
67
- ```
47
+ ```text
68
48
  usage: decb-to-b09 [-h] [--version] [-l] [-z] [-s DEFAULT_STRING_STORAGE] [-D] [-w]
69
49
  [-c CONFIG_FILE]
70
50
  program.bas program.b09
@@ -96,7 +76,7 @@ optional arguments:
96
76
 
97
77
  ### cm3toppm
98
78
 
99
- ```
79
+ ```text
100
80
  usage: cm3toppm [-h] [--version] [image.cm3] [image.ppm]
101
81
 
102
82
  Convert RS-DOS CM3 images to PPM
@@ -115,7 +95,7 @@ options:
115
95
 
116
96
  ### hrstoppm
117
97
 
118
- ```
98
+ ```text
119
99
  usage: hrstoppm [-h] [-w width] [-r height] [-s bytes] [--version]
120
100
  [image.hrs] [image.ppm]
121
101
 
@@ -138,7 +118,7 @@ options:
138
118
 
139
119
  ### maxtoppm
140
120
 
141
- ```
121
+ ```text
142
122
  usage: maxtoppm [-h] [--version]
143
123
  [-br | -rb | -br2 | -rb2 | -br3 | -rb3 | -s10 | -s11] [-i]
144
124
  [-w width] [-r height] [-s bytes] [-newsroom]
@@ -183,7 +163,7 @@ Format and size options::
183
163
 
184
164
  ### mgetoppm
185
165
 
186
- ```
166
+ ```text
187
167
  usage: mgetoppm [-h] [--version] [image.mge] [image.ppm]
188
168
 
189
169
  Convert RS-DOS MGE images to PPM
@@ -202,7 +182,7 @@ options:
202
182
 
203
183
  ### mge_viewer2
204
184
 
205
- ```
185
+ ```text
206
186
  usage: mge_viewer2 [-h] [--version] [image.mge]
207
187
 
208
188
  View ColorMax 3 MGE files
@@ -219,7 +199,7 @@ optional arguments:
219
199
 
220
200
  ### pixtopgm
221
201
 
222
- ```
202
+ ```text
223
203
  usage: pixtopgm [-h] [--version] image.pix [image.pgm]
224
204
 
225
205
  Convert RS-DOS PIX images to PGM
@@ -235,9 +215,63 @@ options:
235
215
  --version show program's version number and exit
236
216
  ```
237
217
 
238
- ### rattoppm
218
+ ### png-to-cocopng
219
+
220
+ ```text
221
+ usage: png-to-coco-png [-h] [--bits-per-pixel BITS_PER_PIXEL] input_png input_palette output_png
222
+
223
+ Convert a PNG image to a CoCo 3 palette PNG.
224
+
225
+ positional arguments:
226
+ input_png Path to the input PNG image file.
227
+ input_palette Path to the input palette file is in the Multi Vue env.file format.
228
+ output_png Path to the output PNG file.
229
+
230
+ optional arguments:
231
+ -h, --help show this help message and exit
232
+ --bits-per-pixel BITS_PER_PIXEL
233
+ Number of bits per pixel.
234
+ ```
235
+
236
+ ### png-to-mvicon
237
+
238
+ ```text
239
+ usage: png-to-mvicon [-h] input_png input_palette output_icon
240
+
241
+ Convert a 24x24 PNG image to a Multi Vue icon file.
242
+
243
+ positional arguments:
244
+ input_png Path to the input PNG image file.
245
+ input_palette Path to the input palette file is in the Multi Vue env.file format.
246
+ output_icon Path to the output icon file.
247
+
248
+ optional arguments:
249
+ -h, --help show this help message and exit
250
+ ```
239
251
 
252
+ ### png-to-os9-image
253
+
254
+ ```text
255
+ usage: png-to-os9-image [-h] [--mask-index MASK_INDEX] [--bits-per-pixel BITS_PER_PIXEL]
256
+ input_png input_palette output_os9_image
257
+
258
+ Convert an PNG image to an OS-9 image.
259
+
260
+ positional arguments:
261
+ input_png Path to the input PNG image file.
262
+ input_palette Path to the input palette file is in the Multi Vue env.file format.
263
+ output_os9_image Path to the output OS-9 image file.
264
+
265
+ optional arguments:
266
+ -h, --help show this help message and exit
267
+ --mask-index MASK_INDEX
268
+ --bits-per-pixel BITS_PER_PIXEL
269
+ Number of bits per pixel.
240
270
  ```
271
+
272
+ ### rattoppm
273
+
274
+ ```text
241
275
  usage: rattoppm [-h] [--version] [image.rat] [image.ppm]
242
276
 
243
277
  Convert RS-DOS RAT images to PPM
@@ -255,7 +289,7 @@ options:
255
289
 
256
290
  ### veftopng
257
291
 
258
- ```
292
+ ```text
259
293
  usage: veftopng [-h] [--version] image.vef image.png
260
294
 
261
295
  Convert OS-9 VEF images to PNG
@@ -274,10 +308,42 @@ options:
274
308
 
275
309
  ## Developing and Testing
276
310
 
311
+ You will need a fairly modern python environment with [uv](https://github.com/astral-sh/uv) installed.
312
+
313
+ You can begin by entering:
314
+
315
+ ```bash
316
+ make install-pre-commit
317
+ make sync
318
+ make run-tests
277
319
  ```
278
- # To set up pre-commit checks
279
- pre-commit install
280
320
 
321
+ The `Makefile` makes it easy to perform the most common operations:
322
+
323
+ * `make all` transpiles several example ECB programs to Basic09
324
+ * `make basic.dsk os9boot.dsk` builds ECB and OS-9 disks with examples
325
+ * `make check-all` runs linting and `uv.lock` checks
326
+ * `make check-lint` checks for linting issues
327
+ * `make check-lock` verifies the `uv.lock` is aligned to `pyproject.toml`
328
+ * `make clean` cleans the virtual environment and caches
329
+ * `make default` runs a default set of checks on the code
330
+ * `make fix-all` formats the code, fixes lint errors and runs locks `uv.lock` to `pyproject.toml`
331
+ * `make fix-format` formats the code
332
+ * `make fix-lint` fixes linting issues
333
+ * `make fix-lint-unsafe` fixes linting issues potentially adding inadvertant bugs
334
+ * `make help` outputs the different make options
335
+ * `make install` build install the distribution
336
+ * `make install-pre-commit` installs pre-commit hooks
337
+ * `make lock` locks `uv.lock` to `pyproject.toml`
338
+ * `make install-pre-commit` installs pre-commit hooks
339
+ * `make run-tests` runs the unit tests
340
+ * `make sync` syncs the python environment with `uv.lock`
341
+
342
+ `.vscode/settings.json` is set so that unit tests can be run without further configuration.
343
+
344
+ You can use Docker to run tests in a Linux environment:
345
+
346
+ ```bash
281
347
  # Build the docker image
282
348
  docker compose build test
283
349
 
@@ -286,38 +352,19 @@ docker compose run test
286
352
 
287
353
  # Run tests using the source on the host computer
288
354
  docker compose run testv
289
-
290
- # To develop locally
291
- pip install -r requirements.txt
292
-
293
- # Run linting, build example disk images for basic conversion
294
- make
295
-
296
- # Remove built artifacts
297
- make clean
298
-
299
- # Reformats the code
300
- make format
301
-
302
- # Only runs linting
303
- make lint
304
-
305
- # Only run tests
306
- make test
307
-
308
- # Build basic and os-9 eample images
309
- make basic.dsk os9boot.dsk
310
355
  ```
311
356
 
312
357
  ## Credits
358
+
313
359
  The programs in the examples/decb and examples/other-decb-examples-to-try directories are from the following sources:
314
- * alien4k0.bas -- https://github.com/jggames/trs80mc10/blob/9df4c9578250009d68a03101d626faa3c22e7445/quicktype/Arcade/4K/Alien4K/ALIEN4K0.TXT#L4
315
- * bach.bas -- https://colorcomputerarchive.com/repo/MC-10/Software/Books/TRS-80%20Color%20Computer%20%26%20MC-10%20Programs/bach.c10
316
- * banner.bas -- https://colorcomputerarchive.com/repo/MC-10/Software/Books/TRS-80%20Color%20Computer%20%26%20MC-10%20Programs/banner.c10
317
- * cadnza.bas -- https://colorcomputerarchive.com/repo/MC-10/Software/Books/TRS-80%20Color%20Computer%20%26%20MC-10%20Programs/cadnza.c10
318
- * cflip.bas -- https://colorcomputerarchive.com/repo/MC-10/Software/Books/TRS-80%20Color%20Computer%20%26%20MC-10%20Programs/cflip.c10
319
- * flip.bas -- https://github.com/daftspaniel/RetroCornerRedux/blob/main/Dragon/Originals/FlipBits/flip.bas
320
- * loops.bas -- https://colorcomputerarchive.com/repo/Documents/Manuals/Hardware/Color%20Computer%203%20Extended%20Basic%20(Tandy).pdf
321
- * f15eagle.bas -- https://colorcomputerarchive.com/repo/Disks/Magazines/Rainbow%20On%20Disk.zip
322
- * mars.bas -- https://github.com/jggames/trs80mc10/tree/9df4c9578250009d68a03101d626faa3c22e7445/quicktype/Text%20Adventures/WorkInProgress/Mars
323
- * saints.bas -- https://colorcomputerarchive.com/repo/Documents/Manuals/Hardware/Color%20Computer%203%20Extended%20Basic%20(Tandy).pdf
360
+
361
+ * alien4k0.bas -- <https://github.com/jggames/trs80mc10/blob/9df4c9578250009d68a03101d626faa3c22e7445/quicktype/Arcade/4K/Alien4K/ALIEN4K0.TXT#L4>
362
+ * bach.bas -- <https://colorcomputerarchive.com/repo/MC-10/Software/Books/TRS-80%20Color%20Computer%20%26%20MC-10%20Programs/bach.c10>
363
+ * banner.bas -- <https://colorcomputerarchive.com/repo/MC-10/Software/Books/TRS-80%20Color%20Computer%20%26%20MC-10%20Programs/banner.c10>
364
+ * cadnza.bas -- <https://colorcomputerarchive.com/repo/MC-10/Software/Books/TRS-80%20Color%20Computer%20%26%20MC-10%20Programs/cadnza.c10>
365
+ * cflip.bas -- <https://colorcomputerarchive.com/repo/MC-10/Software/Books/TRS-80%20Color%20Computer%20%26%20MC-10%20Programs/cflip.c10>
366
+ * flip.bas -- <https://github.com/daftspaniel/RetroCornerRedux/blob/main/Dragon/Originals/FlipBits/flip.bas>
367
+ * loops.bas -- <https://colorcomputerarchive.com/repo/Documents/Manuals/Hardware/Color%20Computer%203%20Extended%20Basic%20(Tandy).pdf>
368
+ * f15eagle.bas -- <https://colorcomputerarchive.com/repo/Disks/Magazines/Rainbow%20On%20Disk.zip>
369
+ * mars.bas -- <https://github.com/jggames/trs80mc10/tree/9df4c9578250009d68a03101d626faa3c22e7445/quicktype/Text%20Adventures/WorkInProgress/Mars>
370
+ * saints.bas -- <https://colorcomputerarchive.com/repo/Documents/Manuals/Hardware/Color%20Computer%203%20Extended%20Basic%20(Tandy).pdf>
@@ -5,7 +5,7 @@ the [TRS-80 Color Computer](https://en.wikipedia.org/wiki/TRS-80_Color_Computer)
5
5
 
6
6
  ## Installation
7
7
 
8
- ```
8
+ ```bash
9
9
  # To install via pip
10
10
  pip install coco-tools
11
11
 
@@ -16,32 +16,11 @@ make install-pre-commit
16
16
  make install
17
17
  ```
18
18
 
19
- The `Makefile` makes it easy to perform the most common operations:
20
- * `make all` transpiles several exapmle ECB programs to Basic09
21
- * `make check-all` runs linting and `uv.lock` checks
22
- * `make check-lint` checks for linting issues
23
- * `make check-lock` verifies the `uv.lock` is aligned to `pyproject.toml`
24
- * `make clean` cleans the virtual environment and caches
25
- * `make default` runs a default set of checks on the code
26
- * `make fix-all` formats the code, fixes lint errors and runs locks `uv.lock` to `pyproject.toml`
27
- * `make fix-format` formats the code
28
- * `make fix-lint` fixes linting issues
29
- * `make fix-lint-unsafe` fixes linting issues potentially adding inadvertant bugs
30
- * `make help` outputs the different make options
31
- * `make install` build install the distribution
32
- * `make install-pre-commit` installs pre-commit hooks
33
- * `make lock` locks `uv.lock` to `pyproject.toml`
34
- * `make install-pre-commit` installs pre-commit hooks
35
- * `make run-tests` runs the unit tests
36
- * `make sync` syncs the python environment with `uv.lock`
37
-
38
- `.vscode/settings.json` is set so that unit tests can be run without further configuration.
39
-
40
19
  ## Tools
41
20
 
42
- ### [decb-to-b09](./README.decb-to-b09.md)
21
+ ### [decb-to-b09](https://github.com/jamieleecho/coco-tools/blob/main/README.decb-to-b09.md)
43
22
 
44
- ```
23
+ ```text
45
24
  usage: decb-to-b09 [-h] [--version] [-l] [-z] [-s DEFAULT_STRING_STORAGE] [-D] [-w]
46
25
  [-c CONFIG_FILE]
47
26
  program.bas program.b09
@@ -73,7 +52,7 @@ optional arguments:
73
52
 
74
53
  ### cm3toppm
75
54
 
76
- ```
55
+ ```text
77
56
  usage: cm3toppm [-h] [--version] [image.cm3] [image.ppm]
78
57
 
79
58
  Convert RS-DOS CM3 images to PPM
@@ -92,7 +71,7 @@ options:
92
71
 
93
72
  ### hrstoppm
94
73
 
95
- ```
74
+ ```text
96
75
  usage: hrstoppm [-h] [-w width] [-r height] [-s bytes] [--version]
97
76
  [image.hrs] [image.ppm]
98
77
 
@@ -115,7 +94,7 @@ options:
115
94
 
116
95
  ### maxtoppm
117
96
 
118
- ```
97
+ ```text
119
98
  usage: maxtoppm [-h] [--version]
120
99
  [-br | -rb | -br2 | -rb2 | -br3 | -rb3 | -s10 | -s11] [-i]
121
100
  [-w width] [-r height] [-s bytes] [-newsroom]
@@ -160,7 +139,7 @@ Format and size options::
160
139
 
161
140
  ### mgetoppm
162
141
 
163
- ```
142
+ ```text
164
143
  usage: mgetoppm [-h] [--version] [image.mge] [image.ppm]
165
144
 
166
145
  Convert RS-DOS MGE images to PPM
@@ -179,7 +158,7 @@ options:
179
158
 
180
159
  ### mge_viewer2
181
160
 
182
- ```
161
+ ```text
183
162
  usage: mge_viewer2 [-h] [--version] [image.mge]
184
163
 
185
164
  View ColorMax 3 MGE files
@@ -196,7 +175,7 @@ optional arguments:
196
175
 
197
176
  ### pixtopgm
198
177
 
199
- ```
178
+ ```text
200
179
  usage: pixtopgm [-h] [--version] image.pix [image.pgm]
201
180
 
202
181
  Convert RS-DOS PIX images to PGM
@@ -212,9 +191,63 @@ options:
212
191
  --version show program's version number and exit
213
192
  ```
214
193
 
215
- ### rattoppm
194
+ ### png-to-cocopng
195
+
196
+ ```text
197
+ usage: png-to-coco-png [-h] [--bits-per-pixel BITS_PER_PIXEL] input_png input_palette output_png
198
+
199
+ Convert a PNG image to a CoCo 3 palette PNG.
200
+
201
+ positional arguments:
202
+ input_png Path to the input PNG image file.
203
+ input_palette Path to the input palette file is in the Multi Vue env.file format.
204
+ output_png Path to the output PNG file.
205
+
206
+ optional arguments:
207
+ -h, --help show this help message and exit
208
+ --bits-per-pixel BITS_PER_PIXEL
209
+ Number of bits per pixel.
210
+ ```
211
+
212
+ ### png-to-mvicon
213
+
214
+ ```text
215
+ usage: png-to-mvicon [-h] input_png input_palette output_icon
216
+
217
+ Convert a 24x24 PNG image to a Multi Vue icon file.
218
+
219
+ positional arguments:
220
+ input_png Path to the input PNG image file.
221
+ input_palette Path to the input palette file is in the Multi Vue env.file format.
222
+ output_icon Path to the output icon file.
223
+
224
+ optional arguments:
225
+ -h, --help show this help message and exit
226
+ ```
216
227
 
228
+ ### png-to-os9-image
229
+
230
+ ```text
231
+ usage: png-to-os9-image [-h] [--mask-index MASK_INDEX] [--bits-per-pixel BITS_PER_PIXEL]
232
+ input_png input_palette output_os9_image
233
+
234
+ Convert an PNG image to an OS-9 image.
235
+
236
+ positional arguments:
237
+ input_png Path to the input PNG image file.
238
+ input_palette Path to the input palette file is in the Multi Vue env.file format.
239
+ output_os9_image Path to the output OS-9 image file.
240
+
241
+ optional arguments:
242
+ -h, --help show this help message and exit
243
+ --mask-index MASK_INDEX
244
+ --bits-per-pixel BITS_PER_PIXEL
245
+ Number of bits per pixel.
217
246
  ```
247
+
248
+ ### rattoppm
249
+
250
+ ```text
218
251
  usage: rattoppm [-h] [--version] [image.rat] [image.ppm]
219
252
 
220
253
  Convert RS-DOS RAT images to PPM
@@ -232,7 +265,7 @@ options:
232
265
 
233
266
  ### veftopng
234
267
 
235
- ```
268
+ ```text
236
269
  usage: veftopng [-h] [--version] image.vef image.png
237
270
 
238
271
  Convert OS-9 VEF images to PNG
@@ -251,10 +284,42 @@ options:
251
284
 
252
285
  ## Developing and Testing
253
286
 
287
+ You will need a fairly modern python environment with [uv](https://github.com/astral-sh/uv) installed.
288
+
289
+ You can begin by entering:
290
+
291
+ ```bash
292
+ make install-pre-commit
293
+ make sync
294
+ make run-tests
254
295
  ```
255
- # To set up pre-commit checks
256
- pre-commit install
257
296
 
297
+ The `Makefile` makes it easy to perform the most common operations:
298
+
299
+ * `make all` transpiles several example ECB programs to Basic09
300
+ * `make basic.dsk os9boot.dsk` builds ECB and OS-9 disks with examples
301
+ * `make check-all` runs linting and `uv.lock` checks
302
+ * `make check-lint` checks for linting issues
303
+ * `make check-lock` verifies the `uv.lock` is aligned to `pyproject.toml`
304
+ * `make clean` cleans the virtual environment and caches
305
+ * `make default` runs a default set of checks on the code
306
+ * `make fix-all` formats the code, fixes lint errors and runs locks `uv.lock` to `pyproject.toml`
307
+ * `make fix-format` formats the code
308
+ * `make fix-lint` fixes linting issues
309
+ * `make fix-lint-unsafe` fixes linting issues potentially adding inadvertant bugs
310
+ * `make help` outputs the different make options
311
+ * `make install` build install the distribution
312
+ * `make install-pre-commit` installs pre-commit hooks
313
+ * `make lock` locks `uv.lock` to `pyproject.toml`
314
+ * `make install-pre-commit` installs pre-commit hooks
315
+ * `make run-tests` runs the unit tests
316
+ * `make sync` syncs the python environment with `uv.lock`
317
+
318
+ `.vscode/settings.json` is set so that unit tests can be run without further configuration.
319
+
320
+ You can use Docker to run tests in a Linux environment:
321
+
322
+ ```bash
258
323
  # Build the docker image
259
324
  docker compose build test
260
325
 
@@ -263,38 +328,19 @@ docker compose run test
263
328
 
264
329
  # Run tests using the source on the host computer
265
330
  docker compose run testv
266
-
267
- # To develop locally
268
- pip install -r requirements.txt
269
-
270
- # Run linting, build example disk images for basic conversion
271
- make
272
-
273
- # Remove built artifacts
274
- make clean
275
-
276
- # Reformats the code
277
- make format
278
-
279
- # Only runs linting
280
- make lint
281
-
282
- # Only run tests
283
- make test
284
-
285
- # Build basic and os-9 eample images
286
- make basic.dsk os9boot.dsk
287
331
  ```
288
332
 
289
333
  ## Credits
334
+
290
335
  The programs in the examples/decb and examples/other-decb-examples-to-try directories are from the following sources:
291
- * alien4k0.bas -- https://github.com/jggames/trs80mc10/blob/9df4c9578250009d68a03101d626faa3c22e7445/quicktype/Arcade/4K/Alien4K/ALIEN4K0.TXT#L4
292
- * bach.bas -- https://colorcomputerarchive.com/repo/MC-10/Software/Books/TRS-80%20Color%20Computer%20%26%20MC-10%20Programs/bach.c10
293
- * banner.bas -- https://colorcomputerarchive.com/repo/MC-10/Software/Books/TRS-80%20Color%20Computer%20%26%20MC-10%20Programs/banner.c10
294
- * cadnza.bas -- https://colorcomputerarchive.com/repo/MC-10/Software/Books/TRS-80%20Color%20Computer%20%26%20MC-10%20Programs/cadnza.c10
295
- * cflip.bas -- https://colorcomputerarchive.com/repo/MC-10/Software/Books/TRS-80%20Color%20Computer%20%26%20MC-10%20Programs/cflip.c10
296
- * flip.bas -- https://github.com/daftspaniel/RetroCornerRedux/blob/main/Dragon/Originals/FlipBits/flip.bas
297
- * loops.bas -- https://colorcomputerarchive.com/repo/Documents/Manuals/Hardware/Color%20Computer%203%20Extended%20Basic%20(Tandy).pdf
298
- * f15eagle.bas -- https://colorcomputerarchive.com/repo/Disks/Magazines/Rainbow%20On%20Disk.zip
299
- * mars.bas -- https://github.com/jggames/trs80mc10/tree/9df4c9578250009d68a03101d626faa3c22e7445/quicktype/Text%20Adventures/WorkInProgress/Mars
300
- * saints.bas -- https://colorcomputerarchive.com/repo/Documents/Manuals/Hardware/Color%20Computer%203%20Extended%20Basic%20(Tandy).pdf
336
+
337
+ * alien4k0.bas -- <https://github.com/jggames/trs80mc10/blob/9df4c9578250009d68a03101d626faa3c22e7445/quicktype/Arcade/4K/Alien4K/ALIEN4K0.TXT#L4>
338
+ * bach.bas -- <https://colorcomputerarchive.com/repo/MC-10/Software/Books/TRS-80%20Color%20Computer%20%26%20MC-10%20Programs/bach.c10>
339
+ * banner.bas -- <https://colorcomputerarchive.com/repo/MC-10/Software/Books/TRS-80%20Color%20Computer%20%26%20MC-10%20Programs/banner.c10>
340
+ * cadnza.bas -- <https://colorcomputerarchive.com/repo/MC-10/Software/Books/TRS-80%20Color%20Computer%20%26%20MC-10%20Programs/cadnza.c10>
341
+ * cflip.bas -- <https://colorcomputerarchive.com/repo/MC-10/Software/Books/TRS-80%20Color%20Computer%20%26%20MC-10%20Programs/cflip.c10>
342
+ * flip.bas -- <https://github.com/daftspaniel/RetroCornerRedux/blob/main/Dragon/Originals/FlipBits/flip.bas>
343
+ * loops.bas -- <https://colorcomputerarchive.com/repo/Documents/Manuals/Hardware/Color%20Computer%203%20Extended%20Basic%20(Tandy).pdf>
344
+ * f15eagle.bas -- <https://colorcomputerarchive.com/repo/Disks/Magazines/Rainbow%20On%20Disk.zip>
345
+ * mars.bas -- <https://github.com/jggames/trs80mc10/tree/9df4c9578250009d68a03101d626faa3c22e7445/quicktype/Text%20Adventures/WorkInProgress/Mars>
346
+ * saints.bas -- <https://colorcomputerarchive.com/repo/Documents/Manuals/Hardware/Color%20Computer%203%20Extended%20Basic%20(Tandy).pdf>
@@ -1,2 +1,2 @@
1
1
  # __version__ MUST be defined on line 2
2
- __version__ = "0.24"
2
+ __version__ = "0.26"
@@ -3,6 +3,7 @@ from typing import List
3
3
 
4
4
  from coco import b09
5
5
  from coco.b09 import error_handler
6
+ from coco.b09.configs import CompilerConfigs
6
7
  from coco.b09.elements import (
7
8
  Basic09CodeStatement,
8
9
  BasicExpressionList,
@@ -13,8 +14,7 @@ from coco.b09.elements import (
13
14
  BasicRunCall,
14
15
  BasicVar,
15
16
  )
16
- from coco.b09.configs import CompilerConfigs
17
- from coco.b09.grammar import grammar, PROCNAME_REGEX
17
+ from coco.b09.grammar import PROCNAME_REGEX, grammar
18
18
  from coco.b09.parser import BasicVisitor
19
19
  from coco.b09.procbank import ProcedureBank
20
20
  from coco.b09.prog import BasicProg
@@ -29,8 +29,8 @@ from coco.b09.visitors import (
29
29
  DeclareImplicitArraysVisitor,
30
30
  GetDimmedArraysVisitor,
31
31
  JoystickVisitor,
32
- LineNumberFilterVisitor,
33
32
  LineNumberCheckerVisitor,
33
+ LineNumberFilterVisitor,
34
34
  LineReferenceVisitor,
35
35
  LineZeroFilterVisitor,
36
36
  SetDimStringStorageVisitor,
@@ -1,8 +1,9 @@
1
1
  import re
2
2
  from pathlib import Path
3
+ from typing import Dict
4
+
3
5
  from pydantic import BaseModel, Field, field_validator
4
6
  from pydantic_yaml import parse_yaml_raw_as
5
- from typing import Dict
6
7
 
7
8
 
8
9
  class StringConfigs(BaseModel):
@@ -1,7 +1,7 @@
1
1
  from abc import ABC, abstractmethod
2
2
  from collections import defaultdict
3
3
  from itertools import chain
4
- from typing import Dict, List, Literal, TYPE_CHECKING, Union
4
+ from typing import TYPE_CHECKING, Dict, List, Literal, Union
5
5
 
6
6
  from coco.b09 import DEFAULT_STR_STORAGE
7
7
 
@@ -1,12 +1,11 @@
1
- import importlib.resources as pkg_resources
1
+ import importlib.resources as importlib_resources
2
2
  import re
3
-
4
3
  from collections import defaultdict
5
4
  from typing import Dict, Set
6
5
 
7
6
  from coco import b09
8
- from .. import resources
9
7
 
8
+ from .. import resources
10
9
 
11
10
  # Procedure names that start with a procedure keyword.
12
11
  PROCEDURE_START_PREFIX = re.compile(r"(?i)procedure\s+(\w+)\s*$")
@@ -43,7 +42,7 @@ class ProcedureBank(object):
43
42
  Loads the BASIC09 file and stores the procedures and determines the
44
43
  dependencies.
45
44
  """
46
- resource_file = pkg_resources.files(resources) / resource_name
45
+ resource_file = importlib_resources.files(resources) / resource_name
47
46
  with resource_file.open("r") as f:
48
47
  return self.add_from_str(f.read())
49
48
 
@@ -1,4 +1,4 @@
1
- from typing import Dict, List, Set, TYPE_CHECKING
1
+ from typing import TYPE_CHECKING, Dict, List, Set
2
2
 
3
3
  from coco import b09
4
4
  from coco.b09.configs import StringConfigs
@@ -15,8 +15,8 @@ from coco.b09.elements import (
15
15
  BasicFunctionalExpression,
16
16
  BasicGoStatements,
17
17
  BasicHbuffStatement,
18
- BasicJoystkExpression,
19
18
  BasicInputStatement,
19
+ BasicJoystkExpression,
20
20
  BasicLine,
21
21
  BasicLiteral,
22
22
  BasicNextStatement,
@@ -11,7 +11,6 @@ import sys
11
11
  from coco import __version__
12
12
  from coco.b09.compiler import convert_file
13
13
 
14
-
15
14
  DESCRIPTION = """Convert a Color BASIC program to a BASIC09 program
16
15
  Copyright (c) 2023 by Jamie Cho
17
16
  Version: {}""".format(__version__)
@@ -23,7 +23,6 @@ from coco.util import (
23
23
  strtoio,
24
24
  )
25
25
 
26
-
27
26
  PIXEL_MODE_BW = 0
28
27
  PIXEL_MODE_BR = 1
29
28
  PIXEL_MODE_RB = 2
@@ -11,12 +11,11 @@
11
11
 
12
12
  import argparse
13
13
  import sys
14
- from tkinter import Tk, Canvas, PhotoImage, NW
14
+ from tkinter import NW, Canvas, PhotoImage, Tk
15
15
 
16
16
  from coco import __version__
17
17
  from coco.util import stdiotobuffer
18
18
 
19
-
20
19
  # Color Computer 3 RGB Palette in Photoimage color format
21
20
  RGB = [
22
21
  "#000000", # Black