[embedded] Use the correct standard putchar signature: func putchar(_: CInt) -> CInt

This commit is contained in:
Kuba Mracek
2024-01-04 18:18:53 +01:00
parent d5de856c28
commit 8dd56d495f
11 changed files with 45 additions and 34 deletions

View File

@@ -8,17 +8,18 @@
// REQUIRES: OS=macosx || OS=linux-gnu
@_silgen_name("putchar")
func putchar(_: UInt8)
@discardableResult
func putchar(_: CInt) -> CInt
public func print(_ s: StaticString, terminator: StaticString = "\n") {
var p = s.utf8Start
while p.pointee != 0 {
putchar(p.pointee)
putchar(CInt(p.pointee))
p += 1
}
p = terminator.utf8Start
while p.pointee != 0 {
putchar(p.pointee)
putchar(CInt(p.pointee))
p += 1
}
}