mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-19 23:41:29 +00:00
This commit is contained in:
@@ -391,6 +391,7 @@ proc symToYaml(n: PSym, indent: int = 0, maxRecDepth: int = - 1): PRope =
|
||||
var marker = InitIntSet()
|
||||
result = symToYamlAux(n, marker, indent, maxRecDepth)
|
||||
|
||||
proc debugTree(n: PNode, indent: int, maxRecDepth: int): PRope
|
||||
proc debugType(n: PType): PRope =
|
||||
if n == nil:
|
||||
result = toRope("null")
|
||||
@@ -407,6 +408,9 @@ proc debugType(n: PType): PRope =
|
||||
app(result, "null")
|
||||
else:
|
||||
app(result, debugType(n.sons[i]))
|
||||
if n.kind == tyObject and n.n != nil:
|
||||
app(result, ", node: ")
|
||||
app(result, debugTree(n.n, 2, 100))
|
||||
app(result, ")")
|
||||
|
||||
proc debugTree(n: PNode, indent: int, maxRecDepth: int): PRope =
|
||||
|
||||
@@ -601,7 +601,10 @@ proc getConstExpr(m: PSym, n: PNode): PNode =
|
||||
else:
|
||||
result = magicCall(m, n)
|
||||
of mIs:
|
||||
result = newIntNodeT(ord(sameType(n[1].typ, n[2].typ)), n)
|
||||
# BUGFIX: don't evaluate this too early: ``T is void``
|
||||
if not containsGenericType(n[1].typ) and
|
||||
not containsGenericType(n[2].typ):
|
||||
result = newIntNodeT(ord(sameType(n[1].typ, n[2].typ)), n)
|
||||
of mAstToStr:
|
||||
result = newStrNodeT(renderTree(n[1], {renderNoComments}), n)
|
||||
of mConStrStr:
|
||||
|
||||
@@ -30,12 +30,6 @@ proc checkConstructedType*(info: TLineInfo, typ: PType) =
|
||||
if t.kind == tyObject and t.sons[0] != nil:
|
||||
if t.sons[0].kind != tyObject or tfFinal in t.sons[0].flags:
|
||||
localError(info, errInheritanceOnlyWithNonFinalObjects)
|
||||
|
||||
proc containsGenericTypeIter(t: PType, closure: PObject): bool =
|
||||
result = t.kind in GenericTypes
|
||||
|
||||
proc containsGenericType*(t: PType): bool =
|
||||
result = iterOverType(t, containsGenericTypeIter, nil)
|
||||
|
||||
proc searchInstTypes(tab: TIdTable, key: PType): PType =
|
||||
# returns nil if we need to declare this type
|
||||
|
||||
@@ -1094,3 +1094,9 @@ proc getSize(typ: PType): biggestInt =
|
||||
result = computeSize(typ)
|
||||
if result < 0: InternalError("getSize(" & $typ.kind & ')')
|
||||
|
||||
|
||||
proc containsGenericTypeIter(t: PType, closure: PObject): bool =
|
||||
result = t.kind in GenericTypes
|
||||
|
||||
proc containsGenericType*(t: PType): bool =
|
||||
result = iterOverType(t, containsGenericTypeIter, nil)
|
||||
|
||||
@@ -297,6 +297,6 @@ when isMainModule:
|
||||
for w in r.items:
|
||||
echo w
|
||||
|
||||
for w in r.allPrefixed("de"):
|
||||
for w in r.itemsWithPrefix("de"):
|
||||
echo w
|
||||
|
||||
|
||||
@@ -455,7 +455,7 @@ when defined(Windows) and not defined(useNimRtl):
|
||||
rfds[i] = readfds[i].FProcessHandle
|
||||
|
||||
var ret = waitForMultipleObjects(readfds.len.int32,
|
||||
addr(rfds), 0'i32, timeout)
|
||||
addr(rfds), 0'i32, timeout.int32)
|
||||
case ret
|
||||
of WAIT_TIMEOUT:
|
||||
return 0
|
||||
|
||||
@@ -352,7 +352,7 @@ proc bindAddr*(socket: TSocket, port = TPort(0), address = "") =
|
||||
hints.ai_socktype = toInt(SOCK_STREAM)
|
||||
hints.ai_protocol = toInt(IPPROTO_TCP)
|
||||
gaiNim(address, port, hints, aiList)
|
||||
if bindSocket(socket.fd, aiList.ai_addr, aiList.ai_addrLen) < 0'i32:
|
||||
if bindSocket(socket.fd, aiList.ai_addr, aiList.ai_addrLen.cint) < 0'i32:
|
||||
OSError()
|
||||
|
||||
when false:
|
||||
@@ -570,7 +570,7 @@ proc connect*(socket: TSocket, name: string, port = TPort(0),
|
||||
var success = false
|
||||
var it = aiList
|
||||
while it != nil:
|
||||
if connect(socket.fd, it.ai_addr, it.ai_addrlen) == 0'i32:
|
||||
if connect(socket.fd, it.ai_addr, it.ai_addrlen.cint) == 0'i32:
|
||||
success = true
|
||||
break
|
||||
it = it.ai_next
|
||||
@@ -624,7 +624,7 @@ proc connectAsync*(socket: TSocket, name: string, port = TPort(0),
|
||||
var success = false
|
||||
var it = aiList
|
||||
while it != nil:
|
||||
var ret = connect(socket.fd, it.ai_addr, it.ai_addrlen)
|
||||
var ret = connect(socket.fd, it.ai_addr, it.ai_addrlen.cint)
|
||||
if ret == 0'i32:
|
||||
success = true
|
||||
break
|
||||
@@ -669,8 +669,8 @@ proc connectAsync*(socket: TSocket, name: string, port = TPort(0),
|
||||
proc timeValFromMilliseconds(timeout = 500): TTimeVal =
|
||||
if timeout != -1:
|
||||
var seconds = timeout div 1000
|
||||
result.tv_sec = seconds
|
||||
result.tv_usec = (timeout - seconds * 1000) * 1000
|
||||
result.tv_sec = seconds.int32
|
||||
result.tv_usec = ((timeout - seconds * 1000) * 1000).int32
|
||||
#proc recvfrom*(s: TWinSocket, buf: cstring, len, flags: cint,
|
||||
# fromm: ptr TSockAddr, fromlen: ptr cint): cint
|
||||
|
||||
@@ -772,9 +772,9 @@ proc readIntoBuf(socket: TSocket, flags: int32): int =
|
||||
if socket.isSSL:
|
||||
result = SSLRead(socket.sslHandle, addr(socket.buffer), int(socket.buffer.high))
|
||||
else:
|
||||
result = recv(socket.fd, addr(socket.buffer), int(socket.buffer.high), flags)
|
||||
result = recv(socket.fd, addr(socket.buffer), cint(socket.buffer.high), flags)
|
||||
else:
|
||||
result = recv(socket.fd, addr(socket.buffer), int(socket.buffer.high), flags)
|
||||
result = recv(socket.fd, addr(socket.buffer), cint(socket.buffer.high), flags)
|
||||
if result <= 0:
|
||||
socket.buflen = 0
|
||||
socket.currPos = 0
|
||||
@@ -824,9 +824,9 @@ proc recv*(socket: TSocket, data: pointer, size: int): int =
|
||||
if socket.isSSL:
|
||||
result = SSLRead(socket.sslHandle, data, size)
|
||||
else:
|
||||
result = recv(socket.fd, data, size, 0'i32)
|
||||
result = recv(socket.fd, data, size.cint, 0'i32)
|
||||
else:
|
||||
result = recv(socket.fd, data, size, 0'i32)
|
||||
result = recv(socket.fd, data, size.cint, 0'i32)
|
||||
|
||||
proc waitFor(socket: TSocket, waited: var float, timeout: int): int =
|
||||
## returns the number of characters available to be read. In unbuffered
|
||||
@@ -1068,7 +1068,7 @@ proc send*(socket: TSocket, data: pointer, size: int): int =
|
||||
return SSLWrite(socket.sslHandle, cast[cstring](data), size)
|
||||
|
||||
when defined(windows) or defined(macosx):
|
||||
result = send(socket.fd, data, size, 0'i32)
|
||||
result = send(socket.fd, data, size.cint, 0'i32)
|
||||
else:
|
||||
result = send(socket.fd, data, size, int32(MSG_NOSIGNAL))
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import
|
||||
osproc,
|
||||
cairowin32, cairoxlib,
|
||||
gl, glut, glu, glx, glext, wingl,
|
||||
lua, lualib, lauxlib, mysql, sqlite3, db_mongo
|
||||
lua, lualib, lauxlib, mysql, sqlite3, db_mongo, osproc
|
||||
|
||||
|
||||
writeln(stdout, "test compilation of binding modules")
|
||||
|
||||
Reference in New Issue
Block a user