Skip to content

Commit

Permalink
fix 64bit build
Browse files Browse the repository at this point in the history
  • Loading branch information
jangko committed Apr 26, 2018
1 parent 90f37b6 commit dfbed4f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions lexaccessor.nim
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ proc fill*(L: var LexAccessor, pos: int) =
if L.startPos < 0: L.startPos = 0
L.endPos = L.startPos + bufferSize
if L.endPos > L.lenDoc: L.endPos = L.lenDoc
L.pAccess.nvGetCharRange(L.buf, L.startPos, L.endPos - L.startPos)
L.pAccess.nvGetCharRange(cast[cstring](L.buf[0].addr), L.startPos, L.endPos - L.startPos)
L.buf[L.endPos - L.startPos] = chr(0)

proc `[]`*(L: var LexAccessor, pos: int): char =
Expand Down Expand Up @@ -120,7 +120,7 @@ proc length*(L: LexAccessor): int =

proc flush*(L: var LexAccessor) =
if L.validLen > 0:
discard L.pAccess.nvSetStyles(L.validLen, L.styleBuf)
discard L.pAccess.nvSetStyles(L.validLen, cast[cstring](L.styleBuf[0].addr))
inc(L.startPosStyling, L.validLen)
L.validLen = 0

Expand Down
2 changes: 1 addition & 1 deletion leximpl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ proc getNumber(sc: var StyleContext) =
var kw = newStringOfCap(50)
proc GetWordType(L: ptr LexAccessor, start, stop: int): WordType =
kw.setLen(0)
for i in start.. <stop:
for i in start..<stop:
kw.add L[][i]
if support.NimKeywords.contains(kw): return WT_KEYWORD
if support.NimTypes.contains(kw): return WT_TYPE
Expand Down
9 changes: 6 additions & 3 deletions nppnim.nim
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import
winapi, scintilla, nppmsg, menucmdid, support,
lexaccessor, stylecontext, sets, utils, strutils

{.link: "resource/resource.o".}
when defined(cpu64):
{.link: "resource/resource64.o".}
else:
{.link: "resource/resource32.o".}

const
nbFunc = 1
Expand Down Expand Up @@ -69,7 +72,7 @@ when defined(vcc):
{.emit: "N_LIB_EXPORT N_CDECL(void, NimMain)(void);".}
else:
proc NimMain() {.cdecl, importc.}

proc DllMain(hModule: HANDLE, reasonForCall: DWORD, lpReserved: LPVOID): WINBOOL {.stdcall, exportc, dynlib.} =
case reasonForCall
of DLL_PROCESS_ATTACH:
Expand Down Expand Up @@ -215,7 +218,7 @@ proc IsCommentLine(L: var LexAccessor, line: int): bool =
let pos = L.lineStart(line)
let eol_pos = L.lineStart(line + 1) - 1

for i in pos.. <eol_pos:
for i in pos..<eol_pos:
let ch = L[i]
if ch == '#': return true
elif (ch != ' ') and (ch != '\t'): return false
Expand Down
File renamed without changes.
Binary file added resource/resource64.o
Binary file not shown.
8 changes: 4 additions & 4 deletions scintilla.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1140,8 +1140,8 @@ type
ch: char

# Text retrieval and modification
proc scisend*(sci: SciHandle; iMessage: int; wParam = 0; lParam: sptr_t = 0): sptr_t {.discardable.} =
result = sci.send(sci.hnd, iMessage.cuint, wParam.uptr_t, lParam)
proc scisend*(sci: SciHandle; iMessage: int; wParam = 0; lParam: sptr_t = 0): int {.discardable.} =
result = sci.send(sci.hnd, iMessage.cuint, wParam.uptr_t, lParam).int

proc getText*(sci: SciHandle; length: int): string =
result = newString(length)
Expand Down Expand Up @@ -1357,10 +1357,10 @@ proc moveCaretInsideView*(sci: SciHandle) =
sci.scisend(SCI_MOVECARETINSIDEVIEW)

proc wordStartPosition*(sci: SciHandle; pos: int, onlyWordCharacters: bool): int =
result = sci.scisend(SCI_WORDSTARTPOSITION, pos, ord(onlyWordCharacters))
result = sci.scisend(SCI_WORDSTARTPOSITION, pos, cast[sptr_t](onlyWordCharacters))

proc wordEndPosition*(sci: SciHandle; pos: int, onlyWordCharacters: bool): int =
result = sci.scisend(SCI_WORDENDPOSITION, pos, ord(onlyWordCharacters))
result = sci.scisend(SCI_WORDENDPOSITION, pos, cast[sptr_t](onlyWordCharacters))

proc positionBefore*(sci: SciHandle; pos: int): int =
result = sci.scisend(SCI_POSITIONBEFORE, pos)
Expand Down

0 comments on commit dfbed4f

Please sign in to comment.