diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-03-15 21:03:12 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-03-15 21:03:12 -0700 |
commit | c48ce3c8bfb6d1578f2530ed84b8e7b25d435b6d (patch) | |
tree | 9a7b23b95d9960853aad1be4e6e95b12f300ade8 /apps | |
parent | f559236bdf9103c5f88d8dfc098f3afe3de64e4a (diff) | |
download | mu-c48ce3c8bfb6d1578f2530ed84b8e7b25d435b6d.tar.gz |
6153 - switch 'main' to use Mu strings
At the SubX level we have to put up with null-terminated kernel strings for commandline args. But so far we haven't done much with them. Rather than try to support them we'll just convert them transparently to standard length-prefixed strings. In the process I realized that it's not quite right to treat the combination of argc and argv as an array of kernel strings. Argc counts the number of elements, whereas the length of an array is usually denominated in bytes.
Diffstat (limited to 'apps')
-rwxr-xr-x | apps/assort | bin | 40852 -> 40886 bytes | |||
-rwxr-xr-x | apps/braces | bin | 42658 -> 42692 bytes | |||
-rwxr-xr-x | apps/calls | bin | 47319 -> 47353 bytes | |||
-rwxr-xr-x | apps/crenshaw2-1 | bin | 40260 -> 40294 bytes | |||
-rwxr-xr-x | apps/crenshaw2-1b | bin | 40807 -> 40841 bytes | |||
-rwxr-xr-x | apps/dquotes | bin | 44502 -> 44536 bytes | |||
-rwxr-xr-x | apps/factorial | bin | 39279 -> 39313 bytes | |||
-rw-r--r-- | apps/factorial.mu | 14 | ||||
-rwxr-xr-x | apps/handle | bin | 40177 -> 40211 bytes | |||
-rwxr-xr-x | apps/hex | bin | 43099 -> 43133 bytes | |||
-rwxr-xr-x | apps/mu | bin | 210747 -> 210914 bytes | |||
-rwxr-xr-x | apps/pack | bin | 53244 -> 53278 bytes | |||
-rwxr-xr-x | apps/sigils | bin | 55043 -> 55077 bytes | |||
-rwxr-xr-x | apps/survey | bin | 50093 -> 50127 bytes | |||
-rwxr-xr-x | apps/tests | bin | 39650 -> 39684 bytes |
15 files changed, 7 insertions, 7 deletions
diff --git a/apps/assort b/apps/assort index 980e294d..0dacda05 100755 --- a/apps/assort +++ b/apps/assort Binary files differdiff --git a/apps/braces b/apps/braces index 0de3adb7..318f8309 100755 --- a/apps/braces +++ b/apps/braces Binary files differdiff --git a/apps/calls b/apps/calls index 4015ed83..1ffc0b94 100755 --- a/apps/calls +++ b/apps/calls Binary files differdiff --git a/apps/crenshaw2-1 b/apps/crenshaw2-1 index ce6d02d7..fe3bdfc1 100755 --- a/apps/crenshaw2-1 +++ b/apps/crenshaw2-1 Binary files differdiff --git a/apps/crenshaw2-1b b/apps/crenshaw2-1b index d429e9c6..30266c2a 100755 --- a/apps/crenshaw2-1b +++ b/apps/crenshaw2-1b Binary files differdiff --git a/apps/dquotes b/apps/dquotes index fd1bae17..5a3d8aa0 100755 --- a/apps/dquotes +++ b/apps/dquotes Binary files differdiff --git a/apps/factorial b/apps/factorial index e21f6dfa..73a3417f 100755 --- a/apps/factorial +++ b/apps/factorial Binary files differdiff --git a/apps/factorial.mu b/apps/factorial.mu index 83b2bedf..55bee98e 100644 --- a/apps/factorial.mu +++ b/apps/factorial.mu @@ -31,21 +31,21 @@ fn test-factorial { check-ints-equal result 0x78 "F - test-factorial" } -fn main args: (addr array kernel-string) -> exit-status/ebx: int { - var a/eax: (addr array kernel-string) <- copy args +fn main args: (addr array string) -> exit-status/ebx: int { + var a/eax: (addr array string) <- copy args var tmp/ecx: int <- length a $main-body: { - compare tmp, 1 - # if (len(args) == 1) factorial(5) + # if (len(args) <= 4) factorial(5) + compare tmp, 4 { - break-if-!= + break-if-> var tmp/eax: int <- factorial 5 exit-status <- copy tmp break $main-body } # if (args[1] == "test") run-tests() - var tmp2/ecx: (addr kernel-string) <- index a, 1 - var tmp3/eax: boolean <- kernel-string-equal? *tmp2, "test" + var tmp2/ecx: (addr string) <- index a, 1 + var tmp3/eax: boolean <- string-equal? *tmp2, "test" compare tmp3, 0 { break-if-= diff --git a/apps/handle b/apps/handle index 76fd78ee..77834947 100755 --- a/apps/handle +++ b/apps/handle Binary files differdiff --git a/apps/hex b/apps/hex index d91286e0..2f14cc9a 100755 --- a/apps/hex +++ b/apps/hex Binary files differdiff --git a/apps/mu b/apps/mu index 17916ee9..4b34fd01 100755 --- a/apps/mu +++ b/apps/mu Binary files differdiff --git a/apps/pack b/apps/pack index ceeeb153..f788a54a 100755 --- a/apps/pack +++ b/apps/pack Binary files differdiff --git a/apps/sigils b/apps/sigils index c738b004..7035952d 100755 --- a/apps/sigils +++ b/apps/sigils Binary files differdiff --git a/apps/survey b/apps/survey index 49905f1a..58589cb5 100755 --- a/apps/survey +++ b/apps/survey Binary files differdiff --git a/apps/tests b/apps/tests index 39c29b36..08005a42 100755 --- a/apps/tests +++ b/apps/tests Binary files differ |