[Chapel Merge] Accept c_ptr(c_char) in string/bytes factory funct

Branch: refs/heads/master
Revision: 55cc746
Author: e-kayrakli
Log Message:

Merge pull request #16437 from e-kayrakli/string-factory-cchar

Accept c_ptr(c_char) in string/bytes factory functions

This PR adds the ability to create string and bytes from c_char pointers.

Resolves https://github.com/chapel-lang/chapel/issues/16321

Summary of changes:

  • Change the argument type of factories that creates the type from
    c_ptr(uint(8)) to c_ptr(?t)
  • Give a compiler error if t is not uint(8) or c_char
  • Cast the received argument to bufferType (c_ptr(uint(8))) before calling
    internal helpers
  • Modify tests to pass c_ptr(c_char) to those functions
  • Add tests for the error message for wrong types
  • Adjust documentation

[Reviewed by @ben-albrecht]

Test:

  • [x] make docs
  • [x] standard

Modified Files:
A test/types/bytes/factory/wrongCPtrType.chpl
A test/types/bytes/factory/wrongCPtrType.compopts
A test/types/bytes/factory/wrongCPtrType.good
A test/types/bytes/factory/wrongCPtrType.prediff
A test/types/string/factory/wrongCPtrType.chpl
A test/types/string/factory/wrongCPtrType.compopts
A test/types/string/factory/wrongCPtrType.good
A test/types/string/factory/wrongCPtrType.prediff
M modules/internal/Bytes.chpl
M modules/internal/String.chpl
M test/types/bytes/factory/basic.chpl
M test/types/bytes/factory/basic.good
M test/types/string/factory/basic.chpl
M test/types/string/factory/basic.good

Compare: https://github.com/chapel-lang/chapel/compare/d5ae1e83ed10...55cc7462db09