diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2020-06-05 20:25:24 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2020-06-05 20:25:24 +0200 |
commit | 5d780e12179ac5f951e166413058a76442fe84d3 (patch) | |
tree | b1458467061984a2d1a7a56f7798519758a99f7e /ecomp-c/tests | |
parent | e2808b15950df51127726bc4f75d765fcd676d9b (diff) | |
download | compilertests-5d780e12179ac5f951e166413058a76442fe84d3.tar.gz compilertests-5d780e12179ac5f951e166413058a76442fe84d3.tar.bz2 |
handling strings now better, keep defined dimension of character array
also to better comment printing with strings
Diffstat (limited to 'ecomp-c/tests')
-rw-r--r-- | ecomp-c/tests/string_variable.e | 8 | ||||
-rw-r--r-- | ecomp-c/tests/string_variable.easm | 14 | ||||
-rw-r--r-- | ecomp-c/tests/string_variable.erun | 44 |
3 files changed, 37 insertions, 29 deletions
diff --git a/ecomp-c/tests/string_variable.e b/ecomp-c/tests/string_variable.e index 5b92d6a..707b116 100644 --- a/ecomp-c/tests/string_variable.e +++ b/ecomp-c/tests/string_variable.e @@ -5,12 +5,12 @@ module string_variable; const - S : array 12 of character = "hello world"; + S : array 14 of character = "hello world"; var - s1 : array 12 of character := S; - s2 : array 18 of character := "hello again world"; - s3 : array 12 of character; + s1 : array 18 of character := S; + s2 : array 19 of character := "hello again world"; + s3 : array 20 of character; begin end diff --git a/ecomp-c/tests/string_variable.easm b/ecomp-c/tests/string_variable.easm index 0663ddc..6620177 100644 --- a/ecomp-c/tests/string_variable.easm +++ b/ecomp-c/tests/string_variable.easm @@ -1,11 +1,11 @@ format binary use32 org $1000000 -; CONST S -> array 12 of character, array 12 of character = { ... } -; DECL s1 -> array 12 of character, array 12 of character = { ... } -; DECL s2 -> array 18 of character, array 18 of character = { ... } -; DECL s3 -> array 12 of character, array 12 of character = { ... } +; CONST S -> array 14 of character, "hello world" +; DECL s1 -> array 18 of character, "hello world" +; DECL s2 -> array 19 of character, "hello again world" +; DECL s3 -> array 20 of character, "" hlt -s3: db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -s2: db "hello again world", 0 -s1: db "hello world", 0 +s3: db 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +s2: db "hello again world", 0, 0 +s1: db "hello world", 0, 0, 0, 0, 0, 0, 0 diff --git a/ecomp-c/tests/string_variable.erun b/ecomp-c/tests/string_variable.erun index 61b323b..d383390 100644 --- a/ecomp-c/tests/string_variable.erun +++ b/ecomp-c/tests/string_variable.erun @@ -1,20 +1,24 @@ -Read 43 bytes of code and static data.. +Read 58 bytes of code and static data.. 1000000: F4 hlt data: 01000001: 00000000 01000005: 00000000 01000009: 00000000 -0100000D: 68656C6C -01000011: 6F206167 -01000015: 61696E20 -01000019: 776F726C -0100001D: 64006865 -01000021: 6C6C6F20 -01000025: 776F726C -01000029: 64000000 +0100000D: 00000000 +01000011: 00000000 +01000015: 68656C6C +01000019: 6F206167 +0100001D: 61696E20 +01000021: 776F726C +01000025: 64000068 +01000029: 656C6C6F +0100002D: 20776F72 +01000031: 6C640000 +01000035: 00000000 +01000039: 00000000 core start 1000000 data start 1000001 -data size 2a +data size 39 stack start 1800000 Single step execution: -- iteration 1 @@ -33,11 +37,15 @@ data: 01000001: 00000000 01000005: 00000000 01000009: 00000000 -0100000D: 68656C6C -01000011: 6F206167 -01000015: 61696E20 -01000019: 776F726C -0100001D: 64006865 -01000021: 6C6C6F20 -01000025: 776F726C -01000029: 64000000 +0100000D: 00000000 +01000011: 00000000 +01000015: 68656C6C +01000019: 6F206167 +0100001D: 61696E20 +01000021: 776F726C +01000025: 64000068 +01000029: 656C6C6F +0100002D: 20776F72 +01000031: 6C640000 +01000035: 00000000 +01000039: 00000000 |