Skip to content
Success

Changes

Summary

  1. Updated some documentation about the Instantiate Generic pass. (details)
  2. Implement "scanset" semantics for manipulator `skip`, in place of exact-match. (details)
  3. Support match-failure reporting for string input. (details)
  4. Fixes to Box pass's DeclAdapter. The two largest are: Only local information in scopeTypeVars was used so it was replaced with localTypeVars, that greatly simplified the pass. The added parameters are also divided into groups more consistently. (details)
  5. Fix read-to-variable-length-string cases when internal buffer fills. (details)
Commit 04db9f67a6831b461e75e0c77e20333279541951 by ajbeach
Updated some documentation about the Instantiate Generic pass.
The file was modifiedsrc/GenPoly/InstantiateGeneric.h
The file was modifiedsrc/GenPoly/InstantiateGenericNew.cpp
Commit bf1cbde8549594a47893ee6d678e5552340e47a3 by Michael Brooks
Implement "scanset" semantics for manipulator `skip`, in place of exact-match.

That is, `sin | skip("abc")` now consumes all input before the "+" on input "cccccb+".

Exact-match semantics is available with just `sin | "abc"`.

(Prior exact-match semantics was discovered by surprise, while debugging a test program for an upcoming commit.)
The file was modifiedtests/io/.in/manipulatorsInput.txt
The file was modifiedlibcfa/src/iostream.cfa
The file was modifiedtests/io/manipulatorsInput.cfa
The file was modifiedtests/collections/.in/string-istream-manip.txt
Commit 8cffa4f21ad8d447fa5f37d523e6acfb4906f3d0 by Michael Brooks
Support match-failure reporting for string input.

On failed match, assign the empty-string value to the target.
Prior handling did not modify the target,
which in context like `char s[10]; sin | exclude("\n", s);`,
left `s` uninitialized, and invalid for `strlen`, when the input's next character is a newline.
In this case, `scanf` offers the return value, the count of output arguments written,
to say, "I did not write to your buffer," a feature lost in the pipe abstraction.

Add tests to exercise such cases.

(Prior "leave uninitialized" treatment was discovered by surprise, while debugging a test program for an upcoming commit.)
The file was modifiedtests/collections/.expect/string-istream-manip.txt
The file was modifiedtests/io/.expect/manipulatorsInput.x64.txt
The file was modifiedtests/io/.in/manipulatorsInput.txt
The file was modifiedtests/io/manipulatorsInput.cfa
The file was modifiedtests/io/.expect/manipulatorsInput.arm64.txt
The file was modifiedlibcfa/src/iostream.cfa
The file was modifiedtests/io/.expect/manipulatorsInput.x86.txt
The file was modifiedtests/collections/.in/string-istream-manip.txt
The file was modifiedtests/collections/string-istream-manip.cfa
Commit 097c8d0db2c39c0fca0eb36f369aea4b09227342 by ajbeach
Fixes to Box pass's DeclAdapter. The two largest are: Only local information in scopeTypeVars was used so it was replaced with localTypeVars, that greatly simplified the pass. The added parameters are also divided into groups more consistently.
The file was modifiedsrc/GenPoly/BoxNew.cpp
Commit 0860d9c0c788c565776cbf08f223cede6a4d6ebc by Michael Brooks
Fix read-to-variable-length-string cases when internal buffer fills.

Also fix read-to-cstring ability to give no-exception cases when an entire buffer fills.

The added test cases run, and fail, when run against prior libcfa.
Doing so illustrates a CFA-string-level bug.
Doing so illustrates a C-string-level changed semantics.

At the CFA-string level, the bug was, when reading strings of just the right length,
what should be two reads ("abc" then "def") gets mashed into one ("abcdef").
These cases are clearly bugs because a test program that just echoes chuncks of delimeted input would do so inaccurately.
They're just hard to drive because the relevant chunk lengths are implementation-dependent, and sometimes big.

At the C-string level, the semantic change concerns when to throw the cstring_length exception.
By this change, make the original semantics,
"An exception means the maximum number of characters was read," into
"An exception means that if the buffer were larger, then more characters would have been read."

The added test cases cover the respective stop conditions for manipulator state "%s", include, exclude, getline, and getline/delimiter.
The file was modifiedlibcfa/src/iostream.cfa
The file was modifiedtests/collections/.expect/string-istream-manip.txt
The file was modifiedtests/io/.in/manipulatorsInput.txt
The file was modifiedtests/io/manipulatorsInput.cfa
The file was modifiedtests/io/.expect/manipulatorsInput.arm64.txt
The file was modifiedtests/collections/string-istream-manip.cfa
The file was modifiedlibcfa/src/collections/string_res.cfa
The file was modifiedtests/collections/.in/string-istream-manip.txt
The file was modifiedtests/io/.expect/manipulatorsInput.x64.txt
The file was modifiedtests/io/.expect/manipulatorsInput.x86.txt