summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorAndreas Rumpf <andreas@andreas-desktop>2009-11-26 00:32:07 +0100
committerAndreas Rumpf <andreas@andreas-desktop>2009-11-26 00:32:07 +0100
commit196ef92c86d8b8971d4b316f7c18e404842c4b9b (patch)
tree03506a36422f8ae7543b492978067263beea8502 /lib
parent3710309d39f65718ab5990d53a977acb241432a9 (diff)
downloadNim-196ef92c86d8b8971d4b316f7c18e404842c4b9b.tar.gz
bug concerning constant evaluation fixed
Diffstat (limited to 'lib')
-rwxr-xr-xlib/impure/db_postgres.nim137
-rwxr-xr-xlib/impure/zipfiles.nim2
-rwxr-xr-xlib/pure/pegs.nim4
-rwxr-xr-xlib/pure/re.nim2
-rwxr-xr-xlib/system/profiler.nim8
-rwxr-xr-xlib/wrappers/postgres.nim2
6 files changed, 98 insertions, 57 deletions
diff --git a/lib/impure/db_postgres.nim b/lib/impure/db_postgres.nim
index 197250d9c..b9d0b068f 100755
--- a/lib/impure/db_postgres.nim
+++ b/lib/impure/db_postgres.nim
@@ -4,11 +4,20 @@
 import strutils, postgres
 
 type
-  TDbHandle* = PGconn
-  TRow* = seq[string]
-  EDb* = object of EIO
+  TDbConn* = PPGconn  ## encapsulates a database connection
+  TRow* = seq[string]  ## a row of a dataset
+  EDb* = object of EIO ## exception that is raised if a database error occurs
   
-proc dbError(db: TDbHandle) {.noreturn.} = 
+  TSqlQuery* = distinct string ## an SQL query string
+  
+proc sql*(query: string): TSqlQuery {.noSideEffect, inline.} =  
+  ## constructs a TSqlQuery from the string `query`: If assertions are turned 
+  ## off, it does nothing. If assertions are turned on, the string is checked
+  ## for SQL security holes. This is supposed to be used as a 
+  ## raw-string-literal modifier: ``sql"update user set counter = counter + 1"``
+  result = TSqlQuery(query)
+ 
+proc dbError(db: TDbConn) {.noreturn.} = 
   ## raises an EDb exception.
   var e: ref EDb
   new(e)
@@ -23,13 +32,13 @@ proc dbError*(msg: string) {.noreturn.} =
   raise e
 
 when false:
-  proc dbQueryOpt*(db: TDbHandle, query: string, args: openarray[string]) =
+  proc dbQueryOpt*(db: TDbConn, query: string, args: openarray[string]) =
     var stmt = mysql_stmt_init(db)
     if stmt == nil: dbError(db)
     if mysql_stmt_prepare(stmt, query, len(query)) != 0: 
       dbError(db)
     var 
-      bind: seq[MYSQL_BIND]
+      bindings: seq[MYSQL_BIND]
     discard mysql_stmt_close(stmt)
 
 proc dbQuote(s: string): string =
@@ -39,91 +48,123 @@ proc dbQuote(s: string): string =
     else: add(result, c)
   add(result, '\'')
 
-proc dbFormat(formatstr: string, args: openarray[string]): string =
+proc dbFormat(formatstr: TSqlQuery, args: openarray[string]): string =
   result = ""
   var a = 0
-  for c in items(formatstr):
+  for c in items(string(formatstr)):
     if c == '?':
       add(result, dbQuote(args[a]))
       inc(a)
     else: 
       add(result, c)
   
-proc dbTryQuery*(db: TDbHandle, query: string, args: openarray[string]): bool =
+proc dbTryQuery*(db: TDbConn, query: TSqlQuery, 
+                 args: openarray[string]): bool =
+  ## tries to execute the query and returns true if successful, false otherwise.
   var q = dbFormat(query, args)
   var res = PQExec(db, q)
   result = PQresultStatus(res) == PGRES_COMMAND_OK
   PQclear(res)
 
-proc dbQuery*(db: TDbHandle, query: string, args: openarray[string]) =
-  var q = dbFormat(query, args)
-  var res = PQExec(db, q)
-  if PQresultStatus(res) != PGRES_COMMAND_OK: dbError(db)
-  PQclear(res)
-  
-proc dbTryInsertID*(db: TDbHandle, query: string, 
-                    args: openarray[string]): int64 =
-  var q = dbFormat(query, args)
-  
-  
-  if mysqlRealQuery(db, q, q.len) != 0'i32: 
-    result = -1'i64
-  else:
-    result = mysql_insert_id(db)
-  LAST_INSERT_ID()
-
-proc dbInsertID*(db: TDbHandle, query: string, args: openArray[string]): int64 = 
-  result = dbTryInsertID(db, query, args)
-  if result < 0: dbError(db)
-  
-proc dbQueryAffectedRows*(db: TDbHandle, query: string, 
-                          args: openArray[string]): int64 = 
-  ## runs the query (typically "UPDATE") and returns the
-  ## number of affected rows
+proc dbQuery*(db: TDbConn, query: TSqlQuery, args: openarray[string]) =
+  ## executes the query and raises EDB if not successful.
   var q = dbFormat(query, args)
   var res = PQExec(db, q)
   if PQresultStatus(res) != PGRES_COMMAND_OK: dbError(db)
-  result = parseBiggestInt($PQcmdTuples(res))
   PQclear(res)
   
 proc newRow(L: int): TRow =
   newSeq(result, L)
   for i in 0..L-1: result[i] = ""
   
-iterator dbFastRows*(db: TDbHandle, query: string,
-                     args: openarray[string]): TRow =
+proc setupQuery(db: TDbConn, query: TSqlQuery, 
+                args: openarray[string]): PPGresult = 
   var q = dbFormat(query, args)
-  var res = PQExec(db, q)
-  if PQresultStatus(res) != PGRES_TUPLES_OK: dbError(db)
+  result = PQExec(db, q)
+  if PQresultStatus(result) != PGRES_TUPLES_OK: dbError(db)
+  
+proc setRow(res: PPGresult, r: var TRow, line, cols: int) =
+  for col in 0..cols-1:
+    setLen(r[col], 0)
+    add(r[col], PQgetvalue(res, line, cols))    
+  
+iterator dbFastRows*(db: TDbConn, query: TSqlQuery,
+                     args: openarray[string]): TRow =
+  ## executes the query and iterates over the result dataset. This is very 
+  ## fast, but potenially dangerous: If the for-loop-body executes another
+  ## query, the results can be undefined. For Postgres it is safe though.
+  var res = setupQuery(db, query, args)
   var L = int(PQnfields(res))
   var result = newRow(L)
   for i in 0..PQntuples(res)-1:
-    for j in 0..L-1:
-      setLen(result[j], 0)
-      add(result[j], PQgetvalue(res, i, j))
+    setRow(res, result, i, L)
     yield result
   PQclear(res)
 
-proc dbGetAllRows*(db: TDbHandle, query: string, 
+proc dbGetAllRows*(db: TDbConn, query: TSqlQuery, 
                    args: openarray[string]): seq[TRow] =
+  ## executes the query and returns the whole result dataset.
   result = @[]
   for r in dbFastRows(db, query, args):
     result.add(r)
 
-iterator dbRows*(db: TDbHandle, query: string, 
+iterator dbRows*(db: TDbConn, query: TSqlQuery, 
                  args: openarray[string]): TRow =
+  ## same as `dbFastRows`, but slower and safe.
   for r in items(dbGetAllRows(db, query, args)): yield r
 
-proc dbGetValue*(db: TDbHandle, query: string, 
+proc dbGetValue*(db: TDbConn, query: TSqlQuery, 
                  args: openarray[string]): string = 
+  ## executes the query and returns the result dataset's the first column 
+  ## of the first row. Returns "" if the dataset contains no rows. This uses
+  ## `dbFastRows`, so it inherits its fragile behaviour.
   result = ""
   for row in dbFastRows(db, query, args): 
     result = row[0]
     break
+  
+proc dbTryInsertID*(db: TDbConn, query: TSqlQuery, 
+                    args: openarray[string]): int64 =
+  ## executes the query (typically "INSERT") and returns the 
+  ## generated ID for the row or -1 in case of an error. For Postgre this adds
+  ## ``RETURNING id`` to the query, so it only works if your primary key is
+  ## named ``id``. 
+  var val = dbGetValue(db, TSqlQuery(string(query) & " RETURNING id"), args)
+  if val.len > 0:
+    result = ParseBiggestInt(val)
+  else:
+    result = -1
+  #if mysqlRealQuery(db, q, q.len) != 0'i32: 
+  #  result = -1'i64
+  #else:
+  #  result = mysql_insert_id(db)
+  #LAST_INSERT_ID()
+
+proc dbInsertID*(db: TDbConn, query: TSqlQuery, 
+                 args: openArray[string]): int64 = 
+  ## executes the query (typically "INSERT") and returns the 
+  ## generated ID for the row. For Postgre this adds
+  ## ``RETURNING id`` to the query, so it only works if your primary key is
+  ## named ``id``. 
+  result = dbTryInsertID(db, query, args)
+  if result < 0: dbError(db)
+  
+proc dbQueryAffectedRows*(db: TDbConn, query: TSqlQuery, 
+                          args: openArray[string]): int64 = 
+  ## executes the query (typically "UPDATE") and returns the
+  ## number of affected rows.
+  var q = dbFormat(query, args)
+  var res = PQExec(db, q)
+  if PQresultStatus(res) != PGRES_COMMAND_OK: dbError(db)
+  result = parseBiggestInt($PQcmdTuples(res))
+  PQclear(res)
 
-proc dbClose*(db: TDbHandle) = 
+proc dbClose*(db: TDbConn) = 
+  ## closes the database connection.
   if db != nil: PQfinish(db)
 
-proc dbOpen*(connection, user, password, database: string): TDbHandle =
+proc dbOpen*(connection, user, password, database: string): TDbConn =
+  ## opens a database connection. Returns nil in case of an error.
   result = PQsetdbLogin(nil, nil, nil, nil, database, user, password)
-  if PQStatus(result) != CONNECTION_OK: result = nil
+  if PQStatus(result) != CONNECTION_OK: dbError(result) # result = nil
+
diff --git a/lib/impure/zipfiles.nim b/lib/impure/zipfiles.nim
index e48b0f08e..07fe41a04 100755
--- a/lib/impure/zipfiles.nim
+++ b/lib/impure/zipfiles.nim
@@ -43,7 +43,7 @@ proc close*(z: var TZipArchive) =
   zip_close(z.w)
  
 proc createDir*(z: var TZipArchive, dir: string) = 
-  ## Creates a directory within the `z` archive. This does not fails if the
+  ## Creates a directory within the `z` archive. This does not fail if the
   ## directory already exists. Note that for adding a file like 
   ## ``"path1/path2/filename"`` it is not necessary
   ## to create the ``"path/path2"`` subdirectories - it will be done 
diff --git a/lib/pure/pegs.nim b/lib/pure/pegs.nim
index 21205bdb2..488e42c7d 100755
--- a/lib/pure/pegs.nim
+++ b/lib/pure/pegs.nim
@@ -148,7 +148,7 @@ proc sequence*(a: openArray[TPeg]): TPeg =
   multipleOp(pkSequence, addSequence)
  
 proc `?`*(a: TPeg): TPeg =
-  ## constructs an optional piece with the PEG `a`
+  ## constructs an optional for the PEG `a`
   if a.kind in {pkOption, pkGreedyRep, pkGreedyAny, pkGreedyRepChar,
                 pkGreedyRepSet}:
     # a* ?  --> a*
@@ -159,7 +159,7 @@ proc `?`*(a: TPeg): TPeg =
     result.sons = @[a]
 
 proc `*`*(a: TPeg): TPeg =
-  ## constructs a "greedy repetition" piece the PEG `a`
+  ## constructs a "greedy repetition" for the PEG `a`
   case a.kind
   of pkGreedyRep, pkGreedyRepChar, pkGreedyRepSet, pkGreedyAny, pkOption:
     assert false
diff --git a/lib/pure/re.nim b/lib/pure/re.nim
index f854c07e5..87fe79a04 100755
--- a/lib/pure/re.nim
+++ b/lib/pure/re.nim
@@ -224,7 +224,7 @@ proc replace*(s: string, sub: TRegEx, by: string): string =
   ## with the notation ``$i`` and ``$#`` (see strutils.`%`). Examples:
   ##
   ## .. code-block:: nimrod
-  ##   "var1=key; var2=key2".replace(p"{\ident}'='{\ident}", "$1<-$2$2")
+  ##   "var1=key; var2=key2".replace(re"{\ident}'='{\ident}", "$1<-$2$2")
   ##
   ## Results in:
   ##
diff --git a/lib/system/profiler.nim b/lib/system/profiler.nim
index 97c7dcfeb..b87b30d4a 100755
--- a/lib/system/profiler.nim
+++ b/lib/system/profiler.nim
@@ -41,10 +41,10 @@ proc writeProfile() {.noconv.} =
   var i = 0
   var f: TFile
   var j = 1
-  while openFile(f, filename & $j & ".txt"):
-    closeFile(f)
+  while open(f, filename & $j & ".txt"):
+    close(f)
     inc(j)
-  if openFile(f, filename & $j & ".txt", fmWrite):
+  if open(f, filename & $j & ".txt", fmWrite):
     var N = 0
     # we have to compute the actual length of the array:
     while profileData[N].procname != nil: inc(N)
@@ -56,6 +56,6 @@ proc writeProfile() {.noconv.} =
       write(f, ": ")
       writeln(f, profileData[i].total)
       inc(i)
-    closeFile(f)
+    close(f)
 
 addQuitProc(writeProfile)
diff --git a/lib/wrappers/postgres.nim b/lib/wrappers/postgres.nim
index d3c5e265b..26526b6c8 100755
--- a/lib/wrappers/postgres.nim
+++ b/lib/wrappers/postgres.nim
@@ -11,7 +11,7 @@ when defined(windows):
 elif defined(macosx):
   const dllName = "libpq.dylib"
 else:
-  const dllName = "libpq.so"
+  const dllName = "libpq.so(.5|)"
   
 type
   POid* = ptr Oid
vision' href='/ahoang/Nim/blame/compiler/semfold.nim?h=devel&id=5bf31fcabe80f9611a3860a1cbab49407269fe66'>^
cc0ca4374 ^
a6e53ec47 ^
cc0ca4374 ^





a4e2b0c15 ^
a6e53ec47 ^
cc0ca4374 ^








a4e2b0c15 ^
a6e53ec47 ^
e25474154 ^
a6e53ec47 ^
dab64b5c0 ^

a58a2f382 ^
ed0d9e271 ^
dab64b5c0 ^

ed0d9e271 ^
dab64b5c0 ^


ed0d9e271 ^
a6e53ec47 ^
dab64b5c0 ^
ed0d9e271 ^

1a8c6fb49 ^


c673607d3 ^


dab64b5c0 ^

e25474154 ^
4fbba0a65 ^














a6e53ec47 ^
62a10df76 ^



a6e53ec47 ^
c69d74818 ^


62a10df76 ^






4fbba0a65 ^
a6e53ec47 ^
4fbba0a65 ^




121d4e0fc ^
4fbba0a65 ^
7107ec05d ^













a6e53ec47 ^
7107ec05d ^


e25474154 ^


a6e53ec47 ^

7dcf435b4 ^
a6e53ec47 ^

a4e2b0c15 ^
7107ec05d ^
a4e2b0c15 ^
ab3c684c6 ^

a6e53ec47 ^
ab3c684c6 ^
a6e53ec47 ^
ab3c684c6 ^
a6e53ec47 ^
c69d74818 ^
ed0d9e271 ^
a6e53ec47 ^
cc0ca4374 ^
a6e53ec47 ^


ed0d9e271 ^
e25474154 ^
a4e2b0c15 ^
a6e53ec47 ^


7107ec05d ^


a6e53ec47 ^


c69d74818 ^
a6e53ec47 ^

c69d74818 ^
a6e53ec47 ^

658dcd2a5 ^
e25474154 ^
a6e53ec47 ^


fb62dd1fa ^
a6e53ec47 ^
fb62dd1fa ^
7107ec05d ^
a6e53ec47 ^
658dcd2a5 ^
e25474154 ^
a6e53ec47 ^


b4084df43 ^
a6e53ec47 ^

4d5cce988 ^







a6e53ec47 ^




ed0d9e271 ^
6a57ec6d2 ^
ed0d9e271 ^
a6e53ec47 ^

ed0d9e271 ^
a6e53ec47 ^


47114342c ^
a6e53ec47 ^
47114342c ^
a6e53ec47 ^
47114342c ^
a6e53ec47 ^






ed0d9e271 ^
a6e53ec47 ^
ed0d9e271 ^
a6e53ec47 ^
7107ec05d ^







a4e2b0c15 ^

ed0d9e271 ^
a4e2b0c15 ^
ed0d9e271 ^
a4e2b0c15 ^
e25474154 ^
ed0d9e271 ^
a4e2b0c15 ^
e25474154 ^
ed0d9e271 ^
a4e2b0c15 ^
e25474154 ^
ed0d9e271 ^
a4e2b0c15 ^
e25474154 ^
a6e53ec47 ^

42516c008 ^

fab8cee13 ^
a6e53ec47 ^
ed0d9e271 ^
a6e53ec47 ^


ed0d9e271 ^

a6e53ec47 ^

38040e769 ^




a6e53ec47 ^
38040e769 ^
a6e53ec47 ^
fab4d3841 ^
a6e53ec47 ^
ed0d9e271 ^
e25474154 ^

866572e2e ^
a6e53ec47 ^
866572e2e ^
92b8fac94 ^
a6e53ec47 ^
47dce2688 ^

a6e53ec47 ^
14354b436 ^
ed0d9e271 ^
a6e53ec47 ^
e25474154 ^
ed0d9e271 ^
7063670a2 ^
2afadc5c9 ^
a6e53ec47 ^
7063670a2 ^
ed0d9e271 ^

a6e53ec47 ^
ed0d9e271 ^
2afadc5c9 ^
a6e53ec47 ^

2afadc5c9 ^
5bf31fcab ^
e25474154 ^

ed0d9e271 ^
e25474154 ^
e2d38a57e ^
0cc7c9a13 ^
a6e53ec47 ^
ed0d9e271 ^
e25474154 ^
e2d38a57e ^

a6e53ec47 ^

ed0d9e271 ^
a6e53ec47 ^
c5d8a5c1d ^
7d6de1cf9 ^

a6e53ec47 ^
96b828a38 ^
ed0d9e271 ^

a6e53ec47 ^
ed0d9e271 ^

a6e53ec47 ^
ed0d9e271 ^
a6e53ec47 ^
ed0d9e271 ^
a6e53ec47 ^
328e7a100 ^
a6e53ec47 ^
328e7a100 ^
a6e53ec47 ^
328e7a100 ^
a6e53ec47 ^
cdf03b06b ^
a6e53ec47 ^
c617479c6 ^
a6e53ec47 ^
e71410d74 ^







3cb3813ee ^
2c8361bd3 ^



36247e094 ^
2c8361bd3 ^


3cb3813ee ^
a6e53ec47 ^
2c8361bd3 ^

7107ec05d ^
2c8361bd3 ^
7107ec05d ^















2c8361bd3 ^

ed0d9e271 ^
5c7e3efbc ^

c2df609cd ^
a6e53ec47 ^
3cb3813ee ^
2c8361bd3 ^
ed0d9e271 ^
a6e53ec47 ^
3cb3813ee ^
5c7e3efbc ^

76df77f91 ^
29357ab55 ^
ed0d9e271 ^
5c7e3efbc ^
e23857a98 ^
ed0d9e271 ^
a6e53ec47 ^
299390a58 ^


a6e53ec47 ^
299390a58 ^
ed0d9e271 ^
a6e53ec47 ^

e4081a720 ^
e6c5622aa ^
ed0d9e271 ^
a6e53ec47 ^
299390a58 ^
ed0d9e271 ^
299390a58 ^

47335aab4 ^
678f3d7f5 ^
299390a58 ^


942495611 ^
678f3d7f5 ^
a4e2b0c15 ^
678f3d7f5 ^
942495611 ^
678f3d7f5 ^
299390a58 ^
ed0d9e271 ^
299390a58 ^
328e7a100 ^
73c6efdf6 ^
ed0d9e271 ^
f3ecc15a9 ^
29357ab55 ^
ed0d9e271 ^
a6e53ec47 ^
299390a58 ^
a6e53ec47 ^
47335aab4 ^
299390a58 ^

225d65701 ^
299390a58 ^





ed0d9e271 ^
299390a58 ^

a6e53ec47 ^
ed0d9e271 ^
a6e53ec47 ^
ccd58fba2 ^

ed0d9e271 ^
a6e53ec47 ^
ccd58fba2 ^

78b27ed7f ^


cd0256136 ^




78b27ed7f ^
a6e53ec47 ^
e25474154 ^

ed0d9e271 ^
7063670a2 ^
fee2a7ecf ^

a6e53ec47 ^
fee2a7ecf ^
e25474154 ^
a6e53ec47 ^
e4be1cb81 ^

a4e2b0c15 ^




a6e53ec47 ^



94d1aa510 ^
a6e53ec47 ^



0091f2ad3 ^


94d1aa510 ^
a6e53ec47 ^

0091f2ad3 ^







145fabeb6 ^
7d62f031f ^
a6e53ec47 ^
e25474154 ^
a87341775 ^


fee2a7ecf ^
aebe9d7d1 ^



fee2a7ecf ^
027f30610 ^
24966e006 ^
66a255652 ^
24966e006 ^


fee2a7ecf ^

29357ab55 ^
ed0d9e271 ^
e25474154 ^
ed0d9e271 ^
a6e53ec47 ^
16a51ffc9 ^
ed0d9e271 ^
7063670a2 ^
1a61c4d46 ^
05cffb937 ^
e25474154 ^
05cffb937 ^
29357ab55 ^

ed0d9e271 ^
a4e2b0c15 ^
ed0d9e271 ^
bfa3d62cc ^
5ecc461a9 ^
a4e2b0c15 ^
42516c008 ^
a6e53ec47 ^
42516c008 ^
ed0d9e271 ^
a6e53ec47 ^
96b828a38 ^
a6e53ec47 ^
299390a58 ^
ed0d9e271 ^
a6e53ec47 ^
96b828a38 ^
a6e53ec47 ^
b1d4dfa6b ^


a4e2b0c15 ^
4ec40796e ^







70cf34cbd ^
a6e53ec47 ^
ccd58fba2 ^
a6e53ec47 ^
29357ab55 ^
4808ef72d ^


72651de71 ^
a6e53ec47 ^
ed0d9e271 ^
a6e53ec47 ^
ed0d9e271 ^
a6e53ec47 ^
ed0d9e271 ^
a6e53ec47 ^
ed0d9e271 ^
e25474154 ^

ed0d9e271 ^
e25474154 ^
ed0d9e271 ^
a6e53ec47 ^
7063670a2 ^
e25474154 ^

ed0d9e271 ^
a6e53ec47 ^
ed0d9e271 ^
a6e53ec47 ^
ed0d9e271 ^
e25474154 ^


ed0d9e271 ^
e25474154 ^
ed0d9e271 ^
a6e53ec47 ^
7063670a2 ^
e25474154 ^

e61d8166c ^






47335aab4 ^
e25474154 ^

ed0d9e271 ^

a6e53ec47 ^
7063670a2 ^
e25474154 ^
ed0d9e271 ^

a6e53ec47 ^
7063670a2 ^
e25474154 ^

ed0d9e271 ^
a6e53ec47 ^
ed0d9e271 ^

e25474154 ^

ed0d9e271 ^
a6e53ec47 ^


ed0d9e271 ^
a6e53ec47 ^
ed0d9e271 ^
e25474154 ^

ed0d9e271 ^
a6e53ec47 ^
3cb3813ee ^
2c8361bd3 ^

38ed2373a ^
a6e53ec47 ^
38ed2373a ^
a88a965c6 ^
38ed2373a ^


a6e53ec47 ^

ee67a67ac ^

a6e53ec47 ^
299390a58 ^
29357ab55 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744