| 12345678910111213141516171819202122232425262728293031323334353637 |
- MODULE TCString;
- (* C string boundary regression: an ARRAY OF CHAR actual must arrive at
- a foreign C procedure as a NUL-terminated char *, not as the V3
- descriptor address. Expected exit code: 42.
- This test is intentionally pending until the external-call boundary
- conversion lands; it is not yet wired into run_tests.sh. *)
- PROCEDURE m2_c_strlen (s : ARRAY OF CHAR) : CARDINAL; EXTERNAL;
- PROCEDURE m2_c_fill (VAR buf : ARRAY OF CHAR;
- cap : CARDINAL; ch : CHAR) : CARDINAL; EXTERNAL;
- VAR
- ExitCode : INTEGER;
- fixed : ARRAY [0..7] OF CHAR;
- out : ARRAY [0..7] OF CHAR;
- n : CARDINAL;
- PROCEDURE open_len (s : ARRAY OF CHAR) : CARDINAL;
- BEGIN
- RETURN m2_c_strlen(s)
- END open_len;
- BEGIN
- fixed := "hello";
- n := m2_c_fill(out, 8, 'x');
- IF (m2_c_strlen("hello") = 5)
- AND (m2_c_strlen(fixed) = 5)
- AND (open_len("world") = 5)
- AND (n = 7)
- AND (out[0] = 'x')
- AND (out[6] = 'x')
- AND (out[7] = CHR(0)) THEN
- ExitCode := 42
- ELSE
- ExitCode := 1
- END
- END TCString.
|