summaryrefslogtreecommitdiff
path: root/src/main/smp/sys/rt
diff options
context:
space:
mode:
authorCliff Click <cliffc@acm.org>2026-08-10 11:11:18 -0700
committerCliff Click <cliffc@acm.org>2026-11-14 16:23:39 -0800
commit207febef9924c8fa5391185e75d42a7ea480bb38 (patch)
tree68ec6225a89fa1178c32fdf659b9b4f2c3327288 /src/main/smp/sys/rt
parent259f60b105eb770bc6f7e3bd36d91f2b217e9315 (diff)
downloadSimple-207febef9924c8fa5391185e75d42a7ea480bb38.tar.gz
Simple-207febef9924c8fa5391185e75d42a7ea480bb38.zip
Chapter 31: Software Drawing, Time, and Graphical Gameslinear
Co-authored-by: Hsiang-Ying Fu <66062782+fuhsnn@users.noreply.github.com> Co-authored-by: fuhsnn <66062782+fuhsnn@users.noreply.github.com> Co-authored-by: Symious <14933944+symious@users.noreply.github.com> Co-authored-by: Jun Kawasaki <jun784@gmail.com> Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to 'src/main/smp/sys/rt')
-rw-r--r--src/main/smp/sys/rt/simple_args.smp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/smp/sys/rt/simple_args.smp b/src/main/smp/sys/rt/simple_args.smp
index 3f630e54..8bfcc1a7 100644
--- a/src/main/smp/sys/rt/simple_args.smp
+++ b/src/main/smp/sys/rt/simple_args.smp
@@ -1,18 +1,20 @@
// Native startup support, compiled independently and linked with the CRT.
// Raw native addresses stay i64; only the arrays allocated here are Simple objects.
+// This startup object is built without sys imports.
+u32 _MAX_U32 = (1<<32)-1;
{ i64 i64 -> i64 } simple_argv = "C";
{ i64 -> i64 } strlen = "C";
{ i64 i64 i64 -> i64 } memcpy = "C";
val simple_args = { i64 argc, i64 argv ->
- if( argc < 0 || argc > 4294967295 ) return null;
+ if( argc < 0 || argc > _MAX_U32 ) return null;
// Zero-filled reference arrays require nullable elements. Every slot is
// filled before returning; the native entry bridge publishes u8[~][].
val args = new u8[~]?[argc];
- for( i64 i=0; i<argc; i++ ) {
+ for( i64 i = 0; i < argc; i++ ) {
i64 src = simple_argv(argv,i);
i64 len = strlen(src);
- if( len < 0 || len > 4294967295 ) return null;
+ if( len < 0 || len > _MAX_U32 ) return null;
val bytes = new u8[len];
i64 dst = bytes;
memcpy(dst,src,len);