cString => cSourceString; tyCString => tyCstring so that error msgs show cstring, not cString (#17744)
This commit is contained in:
parent
8e474fbb57
commit
7e94420847
32 changed files with 79 additions and 79 deletions
|
|
@ -322,12 +322,12 @@ proc base*(x: Any): Any =
|
|||
proc isNil*(x: Any): bool =
|
||||
## `isNil` for an `x` that represents a cstring, proc or
|
||||
## some pointer type.
|
||||
assert x.rawType.kind in {tyCString, tyRef, tyPtr, tyPointer, tyProc}
|
||||
assert x.rawType.kind in {tyCstring, tyRef, tyPtr, tyPointer, tyProc}
|
||||
result = isNil(cast[ppointer](x.value)[])
|
||||
|
||||
const pointerLike =
|
||||
when defined(gcDestructors): {tyCString, tyRef, tyPtr, tyPointer, tyProc}
|
||||
else: {tyString, tyCString, tyRef, tyPtr, tyPointer, tySequence, tyProc}
|
||||
when defined(gcDestructors): {tyCstring, tyRef, tyPtr, tyPointer, tyProc}
|
||||
else: {tyString, tyCstring, tyRef, tyPtr, tyPointer, tySequence, tyProc}
|
||||
|
||||
proc getPointer*(x: Any): pointer =
|
||||
## Retrieves the pointer value out of `x`. `x` needs to be of kind
|
||||
|
|
@ -669,7 +669,7 @@ proc setString*(x: Any, y: string) =
|
|||
|
||||
proc getCString*(x: Any): cstring =
|
||||
## Retrieves the `cstring` value out of `x`. `x` needs to represent a `cstring`.
|
||||
assert x.rawType.kind == tyCString
|
||||
assert x.rawType.kind == tyCstring
|
||||
result = cast[ptr cstring](x.value)[]
|
||||
|
||||
proc assign*(x, y: Any) =
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ when false:
|
|||
of tyPointer: k = "range"
|
||||
of tyOpenArray: k = "openarray"
|
||||
of tyString: k = "string"
|
||||
of tyCString: k = "cstring"
|
||||
of tyCstring: k = "cstring"
|
||||
of tyInt: k = "int"
|
||||
of tyInt32: k = "int32"
|
||||
else: k = "other"
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ type
|
|||
tyPointer,
|
||||
tyOpenArray,
|
||||
tyString,
|
||||
tyCString,
|
||||
tyCstring,
|
||||
tyForward,
|
||||
tyInt,
|
||||
tyInt8,
|
||||
|
|
|
|||
|
|
@ -281,7 +281,7 @@ when not defined(useNimRtl):
|
|||
of tyString:
|
||||
let sp = cast[ptr string](p)
|
||||
reprStrAux(result, sp[].cstring, sp[].len)
|
||||
of tyCString:
|
||||
of tyCstring:
|
||||
let cs = cast[ptr cstring](p)[]
|
||||
if cs.isNil: add result, "nil"
|
||||
else: reprStrAux(result, cs, cs.len)
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ proc reprAux(result: var string, p: pointer, typ: PNimType,
|
|||
var fp: int
|
||||
{. emit: "`fp` = `p`;\n" .}
|
||||
add(result, reprStr(cast[string](p)))
|
||||
of tyCString:
|
||||
of tyCstring:
|
||||
var fp: cstring
|
||||
{. emit: "`fp` = `p`;\n" .}
|
||||
if fp.isNil:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue