From 1a3b730bf5a2e5978d2dad3d8fb4c157134535e7 Mon Sep 17 00:00:00 2001
From: Araq
Date: Mon, 22 Sep 2014 01:25:13 +0200
Subject: [PATCH] made tests green
---
examples/curlex.nim | 2 +-
examples/htmlrefs.nim | 6 +--
examples/httpserver2.nim | 58 ++++++++++++++---------------
examples/sdlex.nim | 28 +++++++-------
lib/pure/concurrency/threadpool.nim | 4 +-
tests/effects/teffects1.nim | 2 +-
tests/effects/tgcsafe.nim | 3 +-
todo.txt | 6 ++-
8 files changed, 56 insertions(+), 53 deletions(-)
diff --git a/examples/curlex.nim b/examples/curlex.nim
index 1d0f18ddd8..9dadd9a907 100644
--- a/examples/curlex.nim
+++ b/examples/curlex.nim
@@ -3,7 +3,7 @@ import
var hCurl = easy_init()
if hCurl != nil:
- discard easy_setopt(hCurl, OPT_VERBOSE, True)
+ discard easy_setopt(hCurl, OPT_VERBOSE, true)
discard easy_setopt(hCurl, OPT_URL, "http://force7.de/nimrod")
discard easy_perform(hCurl)
easy_cleanup(hCurl)
diff --git a/examples/htmlrefs.nim b/examples/htmlrefs.nim
index 6be28d1ca3..5364d61b68 100644
--- a/examples/htmlrefs.nim
+++ b/examples/htmlrefs.nim
@@ -12,7 +12,7 @@ if paramCount() < 1:
quit("Usage: htmlrefs filename[.html]")
var links = 0 # count the number of links
-var filename = addFileExt(ParamStr(1), "html")
+var filename = addFileExt(paramStr(1), "html")
var s = newFileStream(filename, fmRead)
if s == nil: quit("cannot open the file " & filename)
var x: XmlParser
@@ -43,12 +43,12 @@ block mainLoop:
while x.kind == xmlCharData:
desc.add(x.charData)
x.next()
- Echo(desc & ": " & link)
+ echo(desc & ": " & link)
else:
x.next()
of xmlEof: break # end of file reached
of xmlError:
- Echo(errorMsg(x))
+ echo(errorMsg(x))
x.next()
else: x.next() # skip other events
diff --git a/examples/httpserver2.nim b/examples/httpserver2.nim
index 45350ac89a..13fea9e219 100644
--- a/examples/httpserver2.nim
+++ b/examples/httpserver2.nim
@@ -7,19 +7,19 @@ const
type
TRequestMethod = enum reqGet, reqPost
TServer* = object ## contains the current server state
- socket: TSocket
+ s: Socket
job: seq[TJob]
TJob* = object
- client: TSocket
- process: PProcess
+ client: Socket
+ process: Process
# --------------- output messages --------------------------------------------
-proc sendTextContentType(client: TSocket) =
+proc sendTextContentType(client: Socket) =
send(client, "Content-type: text/html" & wwwNL)
send(client, wwwNL)
-proc badRequest(client: TSocket) =
+proc badRequest(client: Socket) =
# Inform the client that a request it has made has a problem.
send(client, "HTTP/1.0 400 BAD REQUEST" & wwwNL)
sendTextContentType(client)
@@ -27,19 +27,19 @@ proc badRequest(client: TSocket) =
"such as a POST without a Content-Length.
" & wwwNL)
-proc cannotExec(client: TSocket) =
+proc cannotExec(client: Socket) =
send(client, "HTTP/1.0 500 Internal Server Error" & wwwNL)
sendTextContentType(client)
send(client, "Error prohibited CGI execution.
" & wwwNL)
-proc headers(client: TSocket, filename: string) =
+proc headers(client: Socket, filename: string) =
# XXX could use filename to determine file type
send(client, "HTTP/1.0 200 OK" & wwwNL)
send(client, ServerSig)
sendTextContentType(client)
-proc notFound(client: TSocket, path: string) =
+proc notFound(client: Socket, path: string) =
send(client, "HTTP/1.0 404 NOT FOUND" & wwwNL)
send(client, ServerSig)
sendTextContentType(client)
@@ -50,7 +50,7 @@ proc notFound(client: TSocket, path: string) =
send(client, "