Skip to content

Commit 2b1aeab

Browse files
multidimensional array library
1 parent 99b272b commit 2b1aeab

37 files changed

Lines changed: 1585 additions & 570 deletions

build-usb.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
declare(strict_types=1);
33

4-
echo "Building USB image...\n";
4+
echo ">> Building USB image...\n";
55

66
define('BUILD_DIR', getcwd());
77
const ISO_DIR = BUILD_DIR . '/iso';
@@ -25,6 +25,7 @@
2525
}
2626

2727
function run(string $cmd, array $env = []): void {
28+
echo ">> RUN: $cmd\n";
2829
$proc = proc_open($cmd, [1=>['pipe','w'], 2=>['pipe','w']], $pipes, null, $env + $_ENV);
2930
if (!is_resource($proc)) {
3031
throw new RuntimeException("failed to start: $cmd");
@@ -97,7 +98,6 @@ function align_up(int $x, int $a): int {
9798
run(sprintf("mcopy -i %s %s ::/limine.conf", $img_spec, escapeshellarg(LIMINE_CONF)), $env);
9899

99100
// Install BIOS bootloader
100-
//run(sprintf("%s bios-install %s", escapeshellarg(LIMINE_BIN), escapeshellarg(OUT_IMG)));
101101
run(sprintf("%s bios-install %s 1", escapeshellarg(LIMINE_BIN), escapeshellarg(OUT_IMG)));
102102

103103
$fp = fopen(OUT_IMG, 'r+b');
@@ -115,4 +115,4 @@ function align_up(int $x, int $a): int {
115115
fclose($fp);
116116

117117
$mb = (int) round($img_bytes / (1024 * 1024));
118-
echo "USB image created: " . OUT_IMG . " (" . $mb . " MB)\n";
118+
echo ">> USB image created: " . OUT_IMG . " (" . $mb . " MB)\n";

docpages/basic-language-reference/libraries/09_INDEX.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ To view details of each library, see its dedicated page in the navigation.
1515
* \subpage http
1616
* \subpage longstring
1717
* \subpage mouse
18+
* \subpage multidim
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
\page multidim Multidimensional Array Library
2+
3+
```BASIC
4+
LIBRARY LIB$ + "/multidim"
5+
```
6+
7+
The multidim library provides a way to work with two, three and four dimensional arrays using Retro Rocket’s native single-dimensional arrays.
8+
It transparently handles indexing and storage layout, allowing access via coordinates rather than manual stride calculations.
9+
10+
The library internally stores dimension metadata alongside arrays and uses reflection to access elements.
11+
12+
The following publicly documented procedures and functions are available via this library.
13+
14+
---
15+
16+
### PROCdim2(name$, x, y)
17+
18+
Create a two-dimensional integer array.
19+
20+
### PROCdim2$(name$, x, y)
21+
22+
Create a two-dimensional string array.
23+
24+
### PROCdim2#(name$, x, y)
25+
26+
Create a two-dimensional real array.
27+
28+
---
29+
30+
### PROCredim2(name$, x, y)
31+
32+
Resize a two-dimensional integer array.
33+
34+
### PROCredim2$(name$, x, y)
35+
36+
Resize a two-dimensional string array.
37+
38+
### PROCredim2#(name$, x, y)
39+
40+
Resize a two-dimensional real array.
41+
42+
---
43+
44+
### FNmulti_get2(name$, x, y)
45+
46+
Get a value from a two-dimensional integer array.
47+
48+
### FNmulti_get2$(name$, x, y)
49+
50+
Get a value from a two-dimensional string array.
51+
52+
### FNmulti_get2#(name$, x, y)
53+
54+
Get a value from a two-dimensional real array.
55+
56+
---
57+
58+
### PROCmulti_set2(name$, x, y, value)
59+
60+
Set a value in a two-dimensional integer array.
61+
62+
### PROCmulti_set2$(name$, x, y, value$)
63+
64+
Set a value in a two-dimensional string array.
65+
66+
### PROCmulti_set2#(name$, x, y, value#)
67+
68+
Set a value in a two-dimensional real array.
69+
70+
---
71+
72+
### PROCdim3(name$, x, y, z)
73+
74+
Create a three-dimensional integer array.
75+
76+
### PROCdim3$(name$, x, y, z)
77+
78+
Create a three-dimensional string array.
79+
80+
### PROCdim3#(name$, x, y, z)
81+
82+
Create a three-dimensional real array.
83+
84+
---
85+
86+
### PROCredim3(name$, x, y, z)
87+
88+
Resize a three-dimensional integer array.
89+
90+
### PROCredim3$(name$, x, y, z)
91+
92+
Resize a three-dimensional string array.
93+
94+
### PROCredim3#(name$, x, y, z)
95+
96+
Resize a three-dimensional real array.
97+
98+
---
99+
100+
### FNmulti_get3(name$, x, y, z)
101+
102+
Get a value from a three-dimensional integer array.
103+
104+
### FNmulti_get3$(name$, x, y, z)
105+
106+
Get a value from a three-dimensional string array.
107+
108+
### FNmulti_get3#(name$, x, y, z)
109+
110+
Get a value from a three-dimensional real array.
111+
112+
---
113+
114+
### PROCmulti_set3(name$, x, y, z, value)
115+
116+
Set a value in a three-dimensional integer array.
117+
118+
### PROCmulti_set3$(name$, x, y, z, value$)
119+
120+
Set a value in a three-dimensional string array.
121+
122+
### PROCmulti_set3#(name$, x, y, z, value#)
123+
124+
Set a value in a three-dimensional real array.
125+
126+
---
127+
128+
### PROCdim4(name$, x, y, z, w)
129+
130+
Create a four-dimensional integer array.
131+
132+
### PROCdim4$(name$, x, y, z, w)
133+
134+
Create a four-dimensional string array.
135+
136+
### PROCdim4#(name$, x, y, z, w)
137+
138+
Create a four-dimensional real array.
139+
140+
---
141+
142+
### PROCredim4(name$, x, y, z, w)
143+
144+
Resize a four-dimensional integer array.
145+
146+
### PROCredim4$(name$, x, y, z, w)
147+
148+
Resize a four-dimensional string array.
149+
150+
### PROCredim4#(name$, x, y, z, w)
151+
152+
Resize a four-dimensional real array.
153+
154+
---
155+
156+
### FNmulti_get4(name$, x, y, z, w)
157+
158+
Get a value from a four-dimensional integer array.
159+
160+
### FNmulti_get4$(name$, x, y, z, w)
161+
162+
Get a value from a four-dimensional string array.
163+
164+
### FNmulti_get4#(name$, x, y, z, w)
165+
166+
Get a value from a four-dimensional real array.
167+
168+
---
169+
170+
### PROCmulti_set4(name$, x, y, z, w, value)
171+
172+
Set a value in a four-dimensional integer array.
173+
174+
### PROCmulti_set4$(name$, x, y, z, w, value$)
175+
176+
Set a value in a four-dimensional string array.
177+
178+
### PROCmulti_set4#(name$, x, y, z, w, value#)
179+
180+
Set a value in a four-dimensional real array.
181+
182+
---
183+
184+
### Example
185+
186+
```BASIC
187+
PROCdim2("screen", 80, 25)
188+
PROCmulti_set2("screen", 10, 5, 42)
189+
PRINT FNmulti_get2("screen", 10, 5)
190+
191+
PROCdim2$("names", 10, 10)
192+
PROCmulti_set2$("names", 3, 4, "Craig")
193+
PRINT FNmulti_get2$("names", 3, 4)
194+
195+
PROCdim3#("points", 8, 8, 8)
196+
PROCmulti_set3#("points", 1, 2, 3, 3.14159)
197+
PRINT FNmulti_get3#("points", 1, 2, 3)
198+
```
199+
200+
Coordinates are zero-based. Values outside the defined dimensions will result in access to unintended elements, or errors being thrown.

docs/doxygen_crawl.html

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@
12881288
<a href="modules.html#using-kernel-symbols"/>
12891289
<a href="modules.html#writing-good-modules"/>
12901290
<a href="mount-command.html"/>
1291-
<a href="mount-command.html#example-26"/>
1291+
<a href="mount-command.html#example-27"/>
12921292
<a href="mount-command.html#notes-226"/>
12931293
<a href="mouse.html"/>
12941294
<a href="mouse.html#fnmouse_lmb"/>
@@ -1300,6 +1300,44 @@
13001300
<a href="mouse.html#procfetch_mouse"/>
13011301
<a href="mouse.html#procmouse_done"/>
13021302
<a href="mousetest.html"/>
1303+
<a href="multidim.html"/>
1304+
<a href="multidim.html#example-26"/>
1305+
<a href="multidim.html#fnmulti_get2name-x-y"/>
1306+
<a href="multidim.html#fnmulti_get2name-x-y-1"/>
1307+
<a href="multidim.html#fnmulti_get2name-x-y-2"/>
1308+
<a href="multidim.html#fnmulti_get3name-x-y-z"/>
1309+
<a href="multidim.html#fnmulti_get3name-x-y-z-1"/>
1310+
<a href="multidim.html#fnmulti_get3name-x-y-z-2"/>
1311+
<a href="multidim.html#fnmulti_get4name-x-y-z-w"/>
1312+
<a href="multidim.html#fnmulti_get4name-x-y-z-w-1"/>
1313+
<a href="multidim.html#fnmulti_get4name-x-y-z-w-2"/>
1314+
<a href="multidim.html#procdim2name-x-y"/>
1315+
<a href="multidim.html#procdim2name-x-y-1"/>
1316+
<a href="multidim.html#procdim2name-x-y-2"/>
1317+
<a href="multidim.html#procdim3name-x-y-z"/>
1318+
<a href="multidim.html#procdim3name-x-y-z-1"/>
1319+
<a href="multidim.html#procdim3name-x-y-z-2"/>
1320+
<a href="multidim.html#procdim4name-x-y-z-w"/>
1321+
<a href="multidim.html#procdim4name-x-y-z-w-1"/>
1322+
<a href="multidim.html#procdim4name-x-y-z-w-2"/>
1323+
<a href="multidim.html#procmulti_set2name-x-y-value"/>
1324+
<a href="multidim.html#procmulti_set2name-x-y-value-1"/>
1325+
<a href="multidim.html#procmulti_set2name-x-y-value-2"/>
1326+
<a href="multidim.html#procmulti_set3name-x-y-z-value"/>
1327+
<a href="multidim.html#procmulti_set3name-x-y-z-value-1"/>
1328+
<a href="multidim.html#procmulti_set3name-x-y-z-value-2"/>
1329+
<a href="multidim.html#procmulti_set4name-x-y-z-w-value"/>
1330+
<a href="multidim.html#procmulti_set4name-x-y-z-w-value-1"/>
1331+
<a href="multidim.html#procmulti_set4name-x-y-z-w-value-2"/>
1332+
<a href="multidim.html#procredim2name-x-y"/>
1333+
<a href="multidim.html#procredim2name-x-y-1"/>
1334+
<a href="multidim.html#procredim2name-x-y-2"/>
1335+
<a href="multidim.html#procredim3name-x-y-z"/>
1336+
<a href="multidim.html#procredim3name-x-y-z-1"/>
1337+
<a href="multidim.html#procredim3name-x-y-z-2"/>
1338+
<a href="multidim.html#procredim4name-x-y-z-w"/>
1339+
<a href="multidim.html#procredim4name-x-y-z-w-1"/>
1340+
<a href="multidim.html#procredim4name-x-y-z-w-2"/>
13031341
<a href="musicdemo.html"/>
13041342
<a href="networking.html"/>
13051343
<a href="networking.html#connecting-by-name"/>
@@ -1349,7 +1387,7 @@
13491387
<a href="retrofs.html#byte-layout-sketch"/>
13501388
<a href="retrofs.html#retrofs-partition-type-guid"/>
13511389
<a href="rick.html"/>
1352-
<a href="rick.html#example-27"/>
1390+
<a href="rick.html#example-28"/>
13531391
<a href="rick.html#how-to-escape"/>
13541392
<a href="rick.html#notes-227"/>
13551393
<a href="rick.html#rick"/>
@@ -1480,7 +1518,7 @@
14801518
<a href="variables.html#types-of-variables"/>
14811519
<a href="version.html"/>
14821520
<a href="webserver.html"/>
1483-
<a href="webserver.html#example-28"/>
1521+
<a href="webserver.html#example-29"/>
14841522
<a href="webserver.html#notes-232"/>
14851523
<a href="webserver.html#usage-5"/>
14861524
<a href="webserver.html#webserver"/>

docs/libraries.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ <h3 class="doxsection"><a class="anchor" id="available-libraries"></a>
134134
<li><a class="el" href="datetime.html">Date and Time Library</a></li>
135135
<li><a class="el" href="http.html">HTTP Library</a></li>
136136
<li><a class="el" href="longstring.html">Long String Library</a></li>
137-
<li><a class="el" href="mouse.html">Mouse Library</a> </li>
137+
<li><a class="el" href="mouse.html">Mouse Library</a></li>
138+
<li><a class="el" href="multidim.html">Multidimensional Array Library</a> </li>
138139
</ul>
139140
</div></div><!-- contents -->
140141
</div><!-- PageDoc -->

docs/libraries.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ var libraries =
44
[ "Date and Time Library", "datetime.html", null ],
55
[ "HTTP Library", "http.html", null ],
66
[ "Long String Library", "longstring.html", null ],
7-
[ "Mouse Library", "mouse.html", null ]
7+
[ "Mouse Library", "mouse.html", null ],
8+
[ "Multidimensional Array Library", "multidim.html", null ]
89
];

docs/mount-command.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
<ul>
153153
<li>For <span class="tt">devfs</span>, you cannot create arbitrary files in this file system. Your ability to read from, or write to the files in this directory depends on the behaviour of the driver which places the file there.</li>
154154
</ul>
155-
<h3 class="doxsection"><a class="anchor" id="example-26"></a>
155+
<h3 class="doxsection"><a class="anchor" id="example-27"></a>
156156
Example</h3>
157157
<div class="fragment"><div class="line">mount /harddisk hd0 rfs</div>
158158
</div><!-- fragment --><h3 class="doxsection"><a class="anchor" id="notes-226"></a>

0 commit comments

Comments
 (0)