Skip to content

Commit

Permalink
update upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
ba0f3 committed Nov 30, 2018
1 parent aa54ba3 commit b5608a2
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/private/subhook
26 changes: 16 additions & 10 deletions src/subhook.nim
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import ospaths

{.compile: "private/subhook/subhook.c".}

{.pragma: subhook,
cdecl,
importc,
header: basename(currentSourcePath()) & "/private/subhook/subhook.h"
header: parentDir(currentSourcePath()) & "/private/subhook/subhook.h"
discardable
.}


type
subhook_t* {.final, pure.} = object

proc subhook_new(src, dst: pointer, options: int): ptr subhook_t {.subhook.}
subhook_flags* {.pure.} = enum
NONE
SUBHOOK_64BIT_OFFSET = 1

proc subhook_new(src, dst: pointer, flags: subhook_flags): ptr subhook_t {.subhook.}
proc subhook_free(hook: ptr subhook_t) {.subhook.}
proc subhook_get_src(hook: ptr subhook_t): pointer {.subhook.}
proc subhook_get_dst(hook: ptr subhook_t): pointer {.subhook.}
Expand All @@ -25,17 +31,17 @@ type
Hook* = object
impl: ptr subhook_t

proc initHook*(src, dest: pointer, options = 0): Hook {.inline.} =
result.impl = subhook_new(src, dest, options)
proc initHook*(src, dest: pointer, flags: subhook_flags = NONE): Hook {.inline.} =
result.impl = subhook_new(src, dest, flags)

proc initHook*(src, dest: int, options = 0): Hook {.inline.} =
initHook(cast[pointer](src), cast[pointer](dest), options)
proc initHook*(src, dest: int, flags = NONE): Hook {.inline.} =
initHook(cast[pointer](src), cast[pointer](dest), flags)

proc initHook*(src: pointer, dest: int, options = 0): Hook {.inline.} =
initHook(src, cast[pointer](dest), options)
proc initHook*(src: pointer, dest: int, flags = NONE): Hook {.inline.} =
initHook(src, cast[pointer](dest), flags)

proc initHook*(src: int, dest: pointer, options = 0): Hook {.inline.} =
initHook(cast[pointer](src), dest, options)
proc initHook*(src: int, dest: pointer, flags = NONE): Hook {.inline.} =
initHook(cast[pointer](src), dest, flags)

proc free*(hook: Hook) {.inline.} =
subhook_free(hook.impl)
Expand Down
2 changes: 1 addition & 1 deletion subhook.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.5.1"
version = "0.5.2"
author = "Huy Doan"
description = "subhook wrapper"
license = "BSD2"
Expand Down

0 comments on commit b5608a2

Please sign in to comment.