bugfix: shallowCopy should not break bootstrapping anymore; encodings.nim for windows improved

This commit is contained in:
Araq
2011-06-21 01:52:42 +02:00
parent cfb107f346
commit db0a4a9f86
3 changed files with 22 additions and 8 deletions

View File

@@ -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 =

15
lib/pure/encodings.nim Normal file → Executable file
View File

@@ -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()

View File

@@ -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