summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-06-21 01:52:42 +0200
committerAraq <rumpf_a@web.de>2011-06-21 01:52:42 +0200
commitdb0a4a9f86d167faccbd50f3f12f9de470e516b8 (patch)
treeae9e52d63139488beb59b926a7f735590ef7ef2c
parentcfb107f3466b185f97c2d33d09a9e6dfa0b6e6b6 (diff)
downloadNim-db0a4a9f86d167faccbd50f3f12f9de470e516b8.tar.gz
bugfix: shallowCopy should not break bootstrapping anymore; encodings.nim for windows improved
-rwxr-xr-xcompiler/semexprs.nim14
-rwxr-xr-x[-rw-r--r--]lib/pure/encodings.nim15
-rwxr-xr-xtodo.txt1
3 files changed, 22 insertions, 8 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim
index 67ad158f4..3841ae9fb 100755
--- a/compiler/semexprs.nim
+++ b/compiler/semexprs.nim
@@ -850,11 +850,15 @@ proc semMagic(c: PContext, n: PNode, s: PSym, flags: TExprFlags): PNode =
     if semthreads.needsGlobalAnalysis():
       c.threadEntries.add(result)
   of mShallowCopy:
-    checkSonsLen(n, 3)
-    result = newNodeI(nkFastAsgn, n.info)
-    result.add(n[1])
-    result.add(n[2])
-    result = semAsgn(c, result)
+    if sonsLen(n) == 3:
+      # XXX ugh this is really a hack: shallowCopy() can be overloaded only
+      # with procs that take not 2 parameters:
+      result = newNodeI(nkFastAsgn, n.info)
+      result.add(n[1])
+      result.add(n[2])
+      result = semAsgn(c, result)
+    else:
+      result = semDirectOp(c, n, flags)
   else: result = semDirectOp(c, n, flags)
 
 proc semIfExpr(c: PContext, n: PNode): PNode = 
diff --git a/lib/pure/encodings.nim b/lib/pure/encodings.nim
index 74c3043c8..ffdfaa9b4 100644..100755
--- a/lib/pure/encodings.nim
+++ b/lib/pure/encodings.nim
@@ -93,6 +93,17 @@ when defined(windows):
       (1256, "windows-1256"), # ANSI Arabic; Arabic (Windows) 
       (1257, "windows-1257"), # ANSI Baltic; Baltic (Windows) 
       (1258, "windows-1258"), # ANSI/OEM Vietnamese; Vietnamese (Windows) 
+
+      (1250, "cp-1250"), # ANSI Central European; Central European (Windows) 
+      (1251, "cp-1251"), # ANSI Cyrillic; Cyrillic (Windows) 
+      (1252, "cp-1252"), # ANSI Latin 1; Western European (Windows) 
+      (1253, "cp-1253"), # ANSI Greek; Greek (Windows) 
+      (1254, "cp-1254"), # ANSI Turkish; Turkish (Windows) 
+      (1255, "cp-1255"), # ANSI Hebrew; Hebrew (Windows) 
+      (1256, "cp-1256"), # ANSI Arabic; Arabic (Windows) 
+      (1257, "cp-1257"), # ANSI Baltic; Baltic (Windows) 
+      (1258, "cp-1258"), # ANSI/OEM Vietnamese; Vietnamese (Windows) 
+
       (1361, "Johab"), # Korean (Johab) 
       (10000, "macintosh"), # MAC Roman; Western European (Mac) 
       (10001, "x-mac-japanese"), # Japanese (Mac) 
@@ -440,6 +451,6 @@ proc convert*(s: string, destEncoding = "UTF-8",
 when IsMainModule:
   var orig = "öäüß"
   var crap = convert(orig, "CP1252", "UTF-8")
-  echo convert(crap)
-
+  echo convert(crap, "ibm850", "CP1252")
+  echo getCurrentEncoding()
 
diff --git a/todo.txt b/todo.txt
index 5022f869e..74919c8c1 100755
--- a/todo.txt
+++ b/todo.txt
@@ -3,7 +3,6 @@ High priority (version 0.8.12)
 * implement message passing built-ins
 * add --deadlock_prevention:on|off switch? timeout for locks?
 * built-in serialization
-* test encodings.nim on windows
 
 
 version 0.9.0