diff options
author | Araq <rumpf_a@web.de> | 2012-07-09 20:04:19 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-07-09 20:04:19 +0200 |
commit | 049de0ef665eb8d9e62c2200c629f8adc4e179b4 (patch) | |
tree | a6be9ec8d9d619fcb91a718320668de1632dafab /lib | |
parent | 82b5e430cfab0b940f4f45516a373dee29001d69 (diff) | |
download | Nim-049de0ef665eb8d9e62c2200c629f8adc4e179b4.tar.gz |
'addSon' for types deprecated for 'int literal type' analysis (3)
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/impure/graphics.nim | 2 | ||||
-rwxr-xr-x | lib/impure/re.nim | 18 | ||||
-rwxr-xr-x | lib/impure/zipfiles.nim | 4 | ||||
-rwxr-xr-x | lib/system.nim | 22 |
4 files changed, 23 insertions, 23 deletions
diff --git a/lib/impure/graphics.nim b/lib/impure/graphics.nim index 1392fd903..c955d96ca 100755 --- a/lib/impure/graphics.nim +++ b/lib/impure/graphics.nim @@ -74,7 +74,7 @@ proc fontFinalizer(f: PFont) = closeFont(f.f) proc newFont*(name = "VeraMono.ttf", size = 9, color = colBlack): PFont = ## Creates a new font object. Raises ``EIO`` if the font cannot be loaded. new(result, fontFinalizer) - result.f = OpenFont(name, size) + result.f = OpenFont(name, size.cint) if result.f == nil: raise newException(EIO, "Could not open font file: " & name) result.color = toSdlColor(color) diff --git a/lib/impure/re.nim b/lib/impure/re.nim index f3a6e5a44..ebc4c549a 100755 --- a/lib/impure/re.nim +++ b/lib/impure/re.nim @@ -100,7 +100,7 @@ proc findBounds*(s: string, pattern: TRegEx, matches: var openarray[string], ## is written into `matches` and ``(-1,0)`` is returned. var rawMatches: array[0..maxSubpatterns * 3 - 1, cint] - res = pcre.Exec(pattern.h, pattern.e, s, len(s).cint, start, 0'i32, + res = pcre.Exec(pattern.h, pattern.e, s, len(s).cint, start.cint, 0'i32, cast[ptr cint](addr(rawMatches)), maxSubpatterns * 3) if res < 0'i32: return (-1, 0) for i in 1..int(res)-1: @@ -119,7 +119,7 @@ proc findBounds*(s: string, pattern: TRegEx, ## ``(-1,0)`` is returned. var rawMatches: array[0..maxSubpatterns * 3 - 1, cint] - res = pcre.Exec(pattern.h, pattern.e, s, len(s).cint, start, 0'i32, + res = pcre.Exec(pattern.h, pattern.e, s, len(s).cint, start.cint, 0'i32, cast[ptr cint](addr(rawMatches)), maxSubpatterns * 3) if res < 0'i32: return (-1, 0) for i in 1..int(res)-1: @@ -135,7 +135,7 @@ proc findBounds*(s: string, pattern: TRegEx, ## match, ``(-1,0)`` is returned. var rawMatches: array[0..3 - 1, cint] - res = pcre.Exec(pattern.h, nil, s, len(s).cint, start, 0'i32, + res = pcre.Exec(pattern.h, nil, s, len(s).cint, start.cint, 0'i32, cast[ptr cint](addr(rawMatches)), 3) if res < 0'i32: return (int(res), 0) return (int(rawMatches[0]), int(rawMatches[1]-1)) @@ -153,25 +153,25 @@ proc match*(s: string, pattern: TRegEx, matches: var openarray[string], ## the captured substrings in the array ``matches``. If it does not ## match, nothing is written into ``matches`` and ``false`` is ## returned. - return matchOrFind(s, pattern, matches, start, + return matchOrFind(s, pattern, matches, start.cint, pcre.ANCHORED) == cint(s.len - start) proc match*(s: string, pattern: TRegEx, start = 0): bool = ## returns ``true`` if ``s[start..]`` matches the ``pattern``. - return matchOrFind(s, pattern, start, pcre.ANCHORED) == cint(s.len - start) + return matchOrFind(s, pattern, start.cint, pcre.ANCHORED) == cint(s.len-start) proc matchLen*(s: string, pattern: TRegEx, matches: var openarray[string], start = 0): int = ## the same as ``match``, but it returns the length of the match, ## if there is no match, -1 is returned. Note that a match length ## of zero can happen. - return matchOrFind(s, pattern, matches, start, pcre.ANCHORED) + return matchOrFind(s, pattern, matches, start.cint, pcre.ANCHORED) proc matchLen*(s: string, pattern: TRegEx, start = 0): int = ## the same as ``match``, but it returns the length of the match, ## if there is no match, -1 is returned. Note that a match length ## of zero can happen. - return matchOrFind(s, pattern, start, pcre.ANCHORED) + return matchOrFind(s, pattern, start.cint, pcre.ANCHORED) proc find*(s: string, pattern: TRegEx, matches: var openarray[string], start = 0): int = @@ -180,7 +180,7 @@ proc find*(s: string, pattern: TRegEx, matches: var openarray[string], ## is written into ``matches`` and -1 is returned. var rawMatches: array[0..maxSubpatterns * 3 - 1, cint] - res = pcre.Exec(pattern.h, pattern.e, s, len(s).cint, start, 0'i32, + res = pcre.Exec(pattern.h, pattern.e, s, len(s).cint, start.cint, 0'i32, cast[ptr cint](addr(rawMatches)), maxSubpatterns * 3) if res < 0'i32: return res for i in 1..int(res)-1: @@ -195,7 +195,7 @@ proc find*(s: string, pattern: TRegEx, start = 0): int = ## match, -1 is returned. var rawMatches: array[0..3 - 1, cint] - res = pcre.Exec(pattern.h, nil, s, len(s).cint, start, 0'i32, + res = pcre.Exec(pattern.h, nil, s, len(s).cint, start.cint, 0'i32, cast[ptr cint](addr(rawMatches)), 3) if res < 0'i32: return res return rawMatches[0] diff --git a/lib/impure/zipfiles.nim b/lib/impure/zipfiles.nim index 36842a51b..029d8527d 100755 --- a/lib/impure/zipfiles.nim +++ b/lib/impure/zipfiles.nim @@ -137,8 +137,8 @@ proc getStream*(z: var TZipArchive, filename: string): PZipFileStream = iterator walkFiles*(z: var TZipArchive): string = ## walks over all files in the archive `z` and returns the filename ## (including the path). - var i = 0 - var num = int(zip_get_num_files(z.w)) + var i = 0'i32 + var num = zip_get_num_files(z.w) while i < num: yield $zip_get_name(z.w, i, 0'i32) inc(i) diff --git a/lib/system.nim b/lib/system.nim index 994127ea2..71dc063ca 100755 --- a/lib/system.nim +++ b/lib/system.nim @@ -55,23 +55,23 @@ type ## a type description (for templates) void* {.magic: "VoidType".} ## meta type to denote the absense of any type - TSignedInt* = distinct int|int8|int16|int32|int64 + TSignedInt* = int|int8|int16|int32|int64 ## type class matching all signed integer types - TUnsignedInt* = distinct uint|uint8|uint16|uint32|uint64 + TUnsignedInt* = uint|uint8|uint16|uint32|uint64 ## type class matching all unsigned integer types - TInteger* = distinct TSignedInt|TUnsignedInt + TInteger* = TSignedInt|TUnsignedInt ## type class matching all integer types - TOrdinal* = distinct TInteger|bool|enum + TOrdinal* = TInteger|bool|enum ## type class matching all ordinal types; however this includes enums with ## holes. - TReal* = distinct float|float32|float64 + TReal* = float|float32|float64 ## type class matching all floating point number types - TNumber* = distinct TInteger|TReal + TNumber* = TInteger|TReal ## type class matching all number types proc defined*(x: expr): bool {.magic: "Defined", noSideEffect.} @@ -1234,14 +1234,14 @@ iterator countup*[S, T](a: S, b: T, step = 1): T {.inline.} = ## Counts from ordinal value `a` up to `b` with the given ## step count. `S`, `T` may be any ordinal type, `step` may only ## be positive. - var res: T = a + var res: T = T(a) while res <= b: yield res inc(res, step) iterator `..`*[S, T](a: S, b: T): T {.inline.} = ## An alias for `countup`. - var res: T = a + var res: T = T(a) while res <= b: yield res inc res @@ -2242,13 +2242,13 @@ proc staticExec*(command: string, input = ""): string {. ## ## ``gorge`` is an alias for ``staticExec``. -proc `+=`*[T](x, y: ordinal[T]) {.magic: "Inc", noSideEffect.} +proc `+=`*[T: TOrdinal](x: var T, y: T) {.magic: "Inc", noSideEffect.} ## Increments an ordinal -proc `-=`*[T](x, y: ordinal[T]) {.magic: "Dec", noSideEffect.} +proc `-=`*[T: TOrdinal](x: var T, y: T) {.magic: "Dec", noSideEffect.} ## Decrements an ordinal -proc `*=`*[T](x: var ordinal[T], y: ordinal[T]) {.inline, noSideEffect.} = +proc `*=`*[T: TOrdinal](x: var T, y: T) {.inline, noSideEffect.} = ## Binary `*=` operator for ordinals x = x * y |