minor style changes
This commit is contained in:
parent
38bdf1cd7f
commit
cb3c3c306c
15 changed files with 134 additions and 110 deletions
|
|
@ -53,7 +53,7 @@ type
|
||||||
|
|
||||||
proc openEmitter*(em: var Emitter, cache: IdentCache;
|
proc openEmitter*(em: var Emitter, cache: IdentCache;
|
||||||
config: ConfigRef, fileIdx: FileIndex) =
|
config: ConfigRef, fileIdx: FileIndex) =
|
||||||
let fullPath = Absolutefile config.toFullPath(fileIdx)
|
let fullPath = AbsoluteFile config.toFullPath(fileIdx)
|
||||||
if em.indWidth == 0:
|
if em.indWidth == 0:
|
||||||
em.indWidth = getIndentWidth(fileIdx, llStreamOpen(fullPath, fmRead),
|
em.indWidth = getIndentWidth(fileIdx, llStreamOpen(fullPath, fmRead),
|
||||||
cache, config)
|
cache, config)
|
||||||
|
|
@ -285,7 +285,7 @@ const
|
||||||
tkBracketRi, tkCurlyDotRi,
|
tkBracketRi, tkCurlyDotRi,
|
||||||
tkCurlyRi}
|
tkCurlyRi}
|
||||||
|
|
||||||
splitters = openPars + {tkComma, tkSemicolon} # do not add 'tkColon' here!
|
splitters = openPars + {tkComma, tkSemiColon} # do not add 'tkColon' here!
|
||||||
oprSet = {tkOpr, tkDiv, tkMod, tkShl, tkShr, tkIn, tkNotin, tkIs,
|
oprSet = {tkOpr, tkDiv, tkMod, tkShl, tkShr, tkIn, tkNotin, tkIs,
|
||||||
tkIsnot, tkNot, tkOf, tkAs, tkDotDot, tkAnd, tkOr, tkXor}
|
tkIsnot, tkNot, tkOf, tkAs, tkDotDot, tkAnd, tkOr, tkXor}
|
||||||
|
|
||||||
|
|
@ -458,7 +458,7 @@ proc emitTok*(em: var Emitter; L: TLexer; tok: TToken) =
|
||||||
of tkColon:
|
of tkColon:
|
||||||
wr(em, TokTypeToStr[tok.tokType], ltOther)
|
wr(em, TokTypeToStr[tok.tokType], ltOther)
|
||||||
wrSpace em
|
wrSpace em
|
||||||
of tkSemicolon, tkComma:
|
of tkSemiColon, tkComma:
|
||||||
wr(em, TokTypeToStr[tok.tokType], ltOther)
|
wr(em, TokTypeToStr[tok.tokType], ltOther)
|
||||||
rememberSplit(splitComma)
|
rememberSplit(splitComma)
|
||||||
wrSpace em
|
wrSpace em
|
||||||
|
|
|
||||||
|
|
@ -375,7 +375,7 @@ proc getNumber(L: var TLexer, result: var TToken) =
|
||||||
result.literal = ""
|
result.literal = ""
|
||||||
result.base = base10
|
result.base = base10
|
||||||
startpos = L.bufpos
|
startpos = L.bufpos
|
||||||
tokenBegin(result, startPos)
|
tokenBegin(result, startpos)
|
||||||
|
|
||||||
# First stage: find out base, make verifications, build token literal string
|
# First stage: find out base, make verifications, build token literal string
|
||||||
# {'c', 'C'} is added for deprecation reasons to provide a clear error message
|
# {'c', 'C'} is added for deprecation reasons to provide a clear error message
|
||||||
|
|
|
||||||
|
|
@ -362,7 +362,7 @@ proc suggestFieldAccess(c: PContext, n, field: PNode, outputs: var Suggestions)
|
||||||
# error: no known module name:
|
# error: no known module name:
|
||||||
typ = nil
|
typ = nil
|
||||||
else:
|
else:
|
||||||
let m = c.graph.importModuleCallback(c.graph, c.module, fileInfoIdx(c.config, fullpath))
|
let m = c.graph.importModuleCallback(c.graph, c.module, fileInfoIdx(c.config, fullPath))
|
||||||
if m == nil: typ = nil
|
if m == nil: typ = nil
|
||||||
else:
|
else:
|
||||||
for it in items(n.sym.tab):
|
for it in items(n.sym.tab):
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ when defined(Windows):
|
||||||
|
|
||||||
type
|
type
|
||||||
KEY_EVENT_RECORD = object
|
KEY_EVENT_RECORD = object
|
||||||
bKeyDown: WinBool
|
bKeyDown: WINBOOL
|
||||||
wRepeatCount: uint16
|
wRepeatCount: uint16
|
||||||
wVirtualKeyCode: uint16
|
wVirtualKeyCode: uint16
|
||||||
wVirtualScanCode: uint16
|
wVirtualScanCode: uint16
|
||||||
|
|
@ -55,7 +55,7 @@ when defined(Windows):
|
||||||
event*: KEY_EVENT_RECORD
|
event*: KEY_EVENT_RECORD
|
||||||
safetyBuffer: array[0..5, DWORD]
|
safetyBuffer: array[0..5, DWORD]
|
||||||
|
|
||||||
proc readConsoleInputW*(hConsoleInput: HANDLE, lpBuffer: var INPUTRECORD,
|
proc readConsoleInputW*(hConsoleInput: Handle, lpBuffer: var INPUT_RECORD,
|
||||||
nLength: uint32,
|
nLength: uint32,
|
||||||
lpNumberOfEventsRead: var uint32): WINBOOL{.
|
lpNumberOfEventsRead: var uint32): WINBOOL{.
|
||||||
stdcall, dynlib: "kernel32", importc: "ReadConsoleInputW".}
|
stdcall, dynlib: "kernel32", importc: "ReadConsoleInputW".}
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ else:
|
||||||
|
|
||||||
proc atomicInc*(memLoc: var int, x: int = 1): int =
|
proc atomicInc*(memLoc: var int, x: int = 1): int =
|
||||||
when someGcc and hasThreadSupport:
|
when someGcc and hasThreadSupport:
|
||||||
result = atomic_add_fetch(memLoc.addr, x, ATOMIC_RELAXED)
|
result = atomicAddFetch(memLoc.addr, x, ATOMIC_RELAXED)
|
||||||
elif defined(vcc) and hasThreadSupport:
|
elif defined(vcc) and hasThreadSupport:
|
||||||
result = addAndFetch(memLoc.addr, x)
|
result = addAndFetch(memLoc.addr, x)
|
||||||
inc(result, x)
|
inc(result, x)
|
||||||
|
|
@ -200,10 +200,10 @@ proc atomicInc*(memLoc: var int, x: int = 1): int =
|
||||||
|
|
||||||
proc atomicDec*(memLoc: var int, x: int = 1): int =
|
proc atomicDec*(memLoc: var int, x: int = 1): int =
|
||||||
when someGcc and hasThreadSupport:
|
when someGcc and hasThreadSupport:
|
||||||
when declared(atomic_sub_fetch):
|
when declared(atomicSubFetch):
|
||||||
result = atomic_sub_fetch(memLoc.addr, x, ATOMIC_RELAXED)
|
result = atomicSubFetch(memLoc.addr, x, ATOMIC_RELAXED)
|
||||||
else:
|
else:
|
||||||
result = atomic_add_fetch(memLoc.addr, -x, ATOMIC_RELAXED)
|
result = atomicAddFetch(memLoc.addr, -x, ATOMIC_RELAXED)
|
||||||
elif defined(vcc) and hasThreadSupport:
|
elif defined(vcc) and hasThreadSupport:
|
||||||
result = addAndFetch(memLoc.addr, -x)
|
result = addAndFetch(memLoc.addr, -x)
|
||||||
dec(result, x)
|
dec(result, x)
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,7 @@ when emulatedThreadVars:
|
||||||
proc GetThreadLocalVars(): pointer {.compilerRtl, inl.} =
|
proc GetThreadLocalVars(): pointer {.compilerRtl, inl.} =
|
||||||
result = addr(cast[PGcThread](threadVarGetValue(globalsSlot)).tls)
|
result = addr(cast[PGcThread](threadVarGetValue(globalsSlot)).tls)
|
||||||
|
|
||||||
proc initThreadVarsEmulation() {.compilerProc, inline.} =
|
proc initThreadVarsEmulation() {.compilerproc, inline.} =
|
||||||
when not defined(useNimRtl):
|
when not defined(useNimRtl):
|
||||||
globalsSlot = threadVarAlloc()
|
globalsSlot = threadVarAlloc()
|
||||||
when declared(mainThread):
|
when declared(mainThread):
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
{.deadCodeElim: on.} # dce option deprecated
|
{.deadCodeElim: on.} # dce option deprecated
|
||||||
{.push, callconv: cdecl.}
|
{.push, callconv: cdecl.}
|
||||||
|
when defined(nimHasStyleChecks):
|
||||||
|
{.push styleChecks: off.}
|
||||||
|
|
||||||
when defined(Unix):
|
when defined(Unix):
|
||||||
when defined(macosx):
|
when defined(macosx):
|
||||||
|
|
@ -153,7 +155,7 @@ const
|
||||||
type
|
type
|
||||||
Pst_net* = ptr St_net
|
Pst_net* = ptr St_net
|
||||||
St_net*{.final.} = object
|
St_net*{.final.} = object
|
||||||
vio*: PVio
|
vio*: PVIO
|
||||||
buff*: cstring
|
buff*: cstring
|
||||||
buff_end*: cstring
|
buff_end*: cstring
|
||||||
write_pos*: cstring
|
write_pos*: cstring
|
||||||
|
|
@ -261,7 +263,7 @@ type
|
||||||
Tenum_cursor_type: Enum_cursor_type,
|
Tenum_cursor_type: Enum_cursor_type,
|
||||||
Tenum_mysql_set_option: Enum_mysql_set_option].}
|
Tenum_mysql_set_option: Enum_mysql_set_option].}
|
||||||
|
|
||||||
proc my_net_init*(net: PNET, vio: PVio): my_bool{.cdecl, dynlib: lib,
|
proc my_net_init*(net: PNET, vio: PVIO): my_bool{.cdecl, dynlib: lib,
|
||||||
importc: "my_net_init".}
|
importc: "my_net_init".}
|
||||||
proc my_net_local_init*(net: PNET){.cdecl, dynlib: lib,
|
proc my_net_local_init*(net: PNET){.cdecl, dynlib: lib,
|
||||||
importc: "my_net_local_init".}
|
importc: "my_net_local_init".}
|
||||||
|
|
@ -751,7 +753,7 @@ type
|
||||||
len*: int # output length pointer
|
len*: int # output length pointer
|
||||||
is_null*: Pmy_bool # Pointer to null indicator
|
is_null*: Pmy_bool # Pointer to null indicator
|
||||||
buffer*: pointer # buffer to get/put data
|
buffer*: pointer # buffer to get/put data
|
||||||
error*: PMy_bool # set this if you want to track data truncations happened during fetch
|
error*: Pmy_bool # set this if you want to track data truncations happened during fetch
|
||||||
buffer_type*: Enum_field_types # buffer type
|
buffer_type*: Enum_field_types # buffer type
|
||||||
buffer_length*: int # buffer length, must be set for str/binary
|
buffer_length*: int # buffer length, must be set for str/binary
|
||||||
# Following are for internal use. Set by mysql_stmt_bind_param
|
# Following are for internal use. Set by mysql_stmt_bind_param
|
||||||
|
|
@ -765,8 +767,8 @@ type
|
||||||
long_data_used*: my_bool # If used with mysql_send_long_data
|
long_data_used*: my_bool # If used with mysql_send_long_data
|
||||||
is_null_value*: my_bool # Used if is_null is 0
|
is_null_value*: my_bool # Used if is_null is 0
|
||||||
store_param_func*: proc (net: PNET, param: Pst_mysql_bind){.cdecl.}
|
store_param_func*: proc (net: PNET, param: Pst_mysql_bind){.cdecl.}
|
||||||
fetch_result*: proc (para1: Pst_mysql_bind, para2: PFIELD, row: PPbyte)
|
fetch_result*: proc (para1: Pst_mysql_bind, para2: PFIELD, row: PPByte)
|
||||||
skip_result*: proc (para1: Pst_mysql_bind, para2: PFIELD, row: PPbyte)
|
skip_result*: proc (para1: Pst_mysql_bind, para2: PFIELD, row: PPByte)
|
||||||
|
|
||||||
BIND* = St_mysql_bind
|
BIND* = St_mysql_bind
|
||||||
PBIND* = ptr BIND # statement handler
|
PBIND* = ptr BIND # statement handler
|
||||||
|
|
@ -780,7 +782,7 @@ type
|
||||||
data_cursor*: PROWS # current row in cached result
|
data_cursor*: PROWS # current row in cached result
|
||||||
affected_rows*: my_ulonglong # copy of mysql->affected_rows after statement execution
|
affected_rows*: my_ulonglong # copy of mysql->affected_rows after statement execution
|
||||||
insert_id*: my_ulonglong
|
insert_id*: my_ulonglong
|
||||||
read_row_func*: proc (stmt: Pst_mysql_stmt, row: PPbyte): cint{.cdecl.}
|
read_row_func*: proc (stmt: Pst_mysql_stmt, row: PPByte): cint{.cdecl.}
|
||||||
stmt_id*: int # Id for prepared statement
|
stmt_id*: int # Id for prepared statement
|
||||||
flags*: int # i.e. type of cursor to open
|
flags*: int # i.e. type of cursor to open
|
||||||
prefetch_rows*: int # number of rows per one COM_FETCH
|
prefetch_rows*: int # number of rows per one COM_FETCH
|
||||||
|
|
@ -1110,3 +1112,5 @@ proc reload(x: PMySQL): cint =
|
||||||
result = refresh(x, REFRESH_GRANT)
|
result = refresh(x, REFRESH_GRANT)
|
||||||
|
|
||||||
{.pop.}
|
{.pop.}
|
||||||
|
when defined(nimHasStyleChecks):
|
||||||
|
{.pop.}
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@ else:
|
||||||
{.push callconv: cdecl.}
|
{.push callconv: cdecl.}
|
||||||
const odbclib = "libodbc.so"
|
const odbclib = "libodbc.so"
|
||||||
|
|
||||||
|
when defined(nimHasStyleChecks):
|
||||||
|
{.push styleChecks: off.}
|
||||||
|
|
||||||
# DATA TYPES CORRESPONDENCE
|
# DATA TYPES CORRESPONDENCE
|
||||||
# BDE fields ODBC types
|
# BDE fields ODBC types
|
||||||
# ---------- ------------------
|
# ---------- ------------------
|
||||||
|
|
@ -834,3 +837,5 @@ proc SQLErr*(henv: SqlHEnv, hdbc: SqlHDBC, hstmt: SqlHStmt,
|
||||||
dynlib: odbclib, importc: "SQLError".}
|
dynlib: odbclib, importc: "SQLError".}
|
||||||
|
|
||||||
{.pop.}
|
{.pop.}
|
||||||
|
when defined(nimHasStyleChecks):
|
||||||
|
{.pop.}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@
|
||||||
## ./bin/nim c -d:ssl -p:. --dynlibOverride:ssl --passL:-lcrypto --passL:-lssl -r tests/untestable/tssl.nim
|
## ./bin/nim c -d:ssl -p:. --dynlibOverride:ssl --passL:-lcrypto --passL:-lssl -r tests/untestable/tssl.nim
|
||||||
|
|
||||||
{.deadCodeElim: on.} # dce option deprecated
|
{.deadCodeElim: on.} # dce option deprecated
|
||||||
|
when defined(nimHasStyleChecks):
|
||||||
|
{.push styleChecks: off.}
|
||||||
|
|
||||||
const useWinVersion = defined(Windows) or defined(nimdoc)
|
const useWinVersion = defined(Windows) or defined(nimdoc)
|
||||||
|
|
||||||
|
|
@ -104,7 +106,7 @@ type
|
||||||
PDES_cblock* = ptr DES_cblock
|
PDES_cblock* = ptr DES_cblock
|
||||||
des_ks_struct*{.final.} = object
|
des_ks_struct*{.final.} = object
|
||||||
ks*: DES_cblock
|
ks*: DES_cblock
|
||||||
weak_key*: cInt
|
weak_key*: cint
|
||||||
|
|
||||||
des_key_schedule* = array[1..16, des_ks_struct]
|
des_key_schedule* = array[1..16, des_ks_struct]
|
||||||
|
|
||||||
|
|
@ -356,20 +358,20 @@ proc SSL_set_SSL_CTX*(ssl: SslPtr, ctx: SslCtx): SslCtx {.cdecl, dynlib: DLLSSLN
|
||||||
proc SSL_CTX_new*(meth: PSSL_METHOD): SslCtx{.cdecl,
|
proc SSL_CTX_new*(meth: PSSL_METHOD): SslCtx{.cdecl,
|
||||||
dynlib: DLLSSLName, importc.}
|
dynlib: DLLSSLName, importc.}
|
||||||
proc SSL_CTX_load_verify_locations*(ctx: SslCtx, CAfile: cstring,
|
proc SSL_CTX_load_verify_locations*(ctx: SslCtx, CAfile: cstring,
|
||||||
CApath: cstring): cInt{.cdecl, dynlib: DLLSSLName, importc.}
|
CApath: cstring): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SSL_CTX_free*(arg0: SslCtx){.cdecl, dynlib: DLLSSLName, importc.}
|
proc SSL_CTX_free*(arg0: SslCtx){.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SSL_CTX_set_verify*(s: SslCtx, mode: int, cb: proc (a: int, b: pointer): int {.cdecl.}){.cdecl, dynlib: DLLSSLName, importc.}
|
proc SSL_CTX_set_verify*(s: SslCtx, mode: int, cb: proc (a: int, b: pointer): int {.cdecl.}){.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SSL_get_verify_result*(ssl: SslPtr): int{.cdecl,
|
proc SSL_get_verify_result*(ssl: SslPtr): int{.cdecl,
|
||||||
dynlib: DLLSSLName, importc.}
|
dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
proc SSL_CTX_set_cipher_list*(s: SslCtx, ciphers: cstring): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SSL_CTX_set_cipher_list*(s: SslCtx, ciphers: cstring): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SSL_CTX_use_certificate_file*(ctx: SslCtx, filename: cstring, typ: cInt): cInt{.
|
proc SSL_CTX_use_certificate_file*(ctx: SslCtx, filename: cstring, typ: cint): cint{.
|
||||||
stdcall, dynlib: DLLSSLName, importc.}
|
stdcall, dynlib: DLLSSLName, importc.}
|
||||||
proc SSL_CTX_use_certificate_chain_file*(ctx: SslCtx, filename: cstring): cInt{.
|
proc SSL_CTX_use_certificate_chain_file*(ctx: SslCtx, filename: cstring): cint{.
|
||||||
stdcall, dynlib: DLLSSLName, importc.}
|
stdcall, dynlib: DLLSSLName, importc.}
|
||||||
proc SSL_CTX_use_PrivateKey_file*(ctx: SslCtx,
|
proc SSL_CTX_use_PrivateKey_file*(ctx: SslCtx,
|
||||||
filename: cstring, typ: cInt): cInt{.cdecl, dynlib: DLLSSLName, importc.}
|
filename: cstring, typ: cint): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SSL_CTX_check_private_key*(ctx: SslCtx): cInt{.cdecl, dynlib: DLLSSLName,
|
proc SSL_CTX_check_private_key*(ctx: SslCtx): cint{.cdecl, dynlib: DLLSSLName,
|
||||||
importc.}
|
importc.}
|
||||||
|
|
||||||
proc SSL_CTX_get_ex_new_index*(argl: clong, argp: pointer, new_func: pointer, dup_func: pointer, free_func: pointer): cint {.cdecl, dynlib: DLLSSLName, importc.}
|
proc SSL_CTX_get_ex_new_index*(argl: clong, argp: pointer, new_func: pointer, dup_func: pointer, free_func: pointer): cint {.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
|
|
@ -378,15 +380,15 @@ proc SSL_CTX_get_ex_data*(ssl: SslCtx, idx: cint): pointer {.cdecl, dynlib: DLLS
|
||||||
|
|
||||||
proc SSL_set_fd*(ssl: SslPtr, fd: SocketHandle): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SSL_set_fd*(ssl: SslPtr, fd: SocketHandle): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
proc SSL_shutdown*(ssl: SslPtr): cInt{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SSL_shutdown*(ssl: SslPtr): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SSL_set_shutdown*(ssl: SslPtr, mode: cint) {.cdecl, dynlib: DLLSSLName, importc: "SSL_set_shutdown".}
|
proc SSL_set_shutdown*(ssl: SslPtr, mode: cint) {.cdecl, dynlib: DLLSSLName, importc: "SSL_set_shutdown".}
|
||||||
proc SSL_get_shutdown*(ssl: SslPtr): cint {.cdecl, dynlib: DLLSSLName, importc: "SSL_get_shutdown".}
|
proc SSL_get_shutdown*(ssl: SslPtr): cint {.cdecl, dynlib: DLLSSLName, importc: "SSL_get_shutdown".}
|
||||||
proc SSL_connect*(ssl: SslPtr): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SSL_connect*(ssl: SslPtr): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SSL_read*(ssl: SslPtr, buf: pointer, num: int): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SSL_read*(ssl: SslPtr, buf: pointer, num: int): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SSL_write*(ssl: SslPtr, buf: cstring, num: int): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SSL_write*(ssl: SslPtr, buf: cstring, num: int): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SSL_get_error*(s: SslPtr, ret_code: cInt): cInt{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SSL_get_error*(s: SslPtr, ret_code: cint): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SSL_accept*(ssl: SslPtr): cInt{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SSL_accept*(ssl: SslPtr): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SSL_pending*(ssl: SslPtr): cInt{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SSL_pending*(ssl: SslPtr): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
proc BIO_new_mem_buf*(data: pointer, len: cint): BIO{.cdecl,
|
proc BIO_new_mem_buf*(data: pointer, len: cint): BIO{.cdecl,
|
||||||
dynlib: DLLSSLName, importc.}
|
dynlib: DLLSSLName, importc.}
|
||||||
|
|
@ -404,19 +406,19 @@ proc BIO_do_connect*(bio: BIO): int =
|
||||||
return BIO_do_handshake(bio)
|
return BIO_do_handshake(bio)
|
||||||
|
|
||||||
when not defined(nimfix):
|
when not defined(nimfix):
|
||||||
proc BIO_read*(b: BIO, data: cstring, length: cInt): cInt{.cdecl,
|
proc BIO_read*(b: BIO, data: cstring, length: cint): cint{.cdecl,
|
||||||
dynlib: DLLUtilName, importc.}
|
dynlib: DLLUtilName, importc.}
|
||||||
proc BIO_write*(b: BIO, data: cstring, length: cInt): cInt{.cdecl,
|
proc BIO_write*(b: BIO, data: cstring, length: cint): cint{.cdecl,
|
||||||
dynlib: DLLUtilName, importc.}
|
dynlib: DLLUtilName, importc.}
|
||||||
|
|
||||||
proc BIO_free*(b: BIO): cInt{.cdecl, dynlib: DLLUtilName, importc.}
|
proc BIO_free*(b: BIO): cint{.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
|
|
||||||
proc ERR_print_errors_fp*(fp: File){.cdecl, dynlib: DLLSSLName, importc.}
|
proc ERR_print_errors_fp*(fp: File){.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
proc ERR_error_string*(e: cInt, buf: cstring): cstring{.cdecl,
|
proc ERR_error_string*(e: cint, buf: cstring): cstring{.cdecl,
|
||||||
dynlib: DLLUtilName, importc.}
|
dynlib: DLLUtilName, importc.}
|
||||||
proc ERR_get_error*(): cInt{.cdecl, dynlib: DLLUtilName, importc.}
|
proc ERR_get_error*(): cint{.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
proc ERR_peek_last_error*(): cInt{.cdecl, dynlib: DLLUtilName, importc.}
|
proc ERR_peek_last_error*(): cint{.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
|
|
||||||
proc OPENSSL_config*(configName: cstring){.cdecl, dynlib: DLLSSLName, importc.}
|
proc OPENSSL_config*(configName: cstring){.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
|
|
@ -437,16 +439,16 @@ proc CRYPTO_malloc_init*() =
|
||||||
when not useWinVersion and not defined(macosx) and not defined(android) and not defined(nimNoAllocForSSL):
|
when not useWinVersion and not defined(macosx) and not defined(android) and not defined(nimNoAllocForSSL):
|
||||||
CRYPTO_set_mem_functions(allocWrapper, reallocWrapper, deallocWrapper)
|
CRYPTO_set_mem_functions(allocWrapper, reallocWrapper, deallocWrapper)
|
||||||
|
|
||||||
proc SSL_CTX_ctrl*(ctx: SslCtx, cmd: cInt, larg: int, parg: pointer): int{.
|
proc SSL_CTX_ctrl*(ctx: SslCtx, cmd: cint, larg: int, parg: pointer): int{.
|
||||||
cdecl, dynlib: DLLSSLName, importc.}
|
cdecl, dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
proc SSL_CTX_callback_ctrl(ctx: SslCtx, typ: cInt, fp: PFunction): int{.
|
proc SSL_CTX_callback_ctrl(ctx: SslCtx, typ: cint, fp: PFunction): int{.
|
||||||
cdecl, dynlib: DLLSSLName, importc.}
|
cdecl, dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
proc SSLCTXSetMode*(ctx: SslCtx, mode: int): int =
|
proc SSLCTXSetMode*(ctx: SslCtx, mode: int): int =
|
||||||
result = SSL_CTX_ctrl(ctx, SSL_CTRL_MODE, mode, nil)
|
result = SSL_CTX_ctrl(ctx, SSL_CTRL_MODE, mode, nil)
|
||||||
|
|
||||||
proc SSL_ctrl*(ssl: SslPtr, cmd: cInt, larg: int, parg: pointer): int{.
|
proc SSL_ctrl*(ssl: SslPtr, cmd: cint, larg: int, parg: pointer): int{.
|
||||||
cdecl, dynlib: DLLSSLName, importc.}
|
cdecl, dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
proc SSL_set_tlsext_host_name*(ssl: SslPtr, name: cstring): int =
|
proc SSL_set_tlsext_host_name*(ssl: SslPtr, name: cstring): int =
|
||||||
|
|
@ -455,7 +457,7 @@ proc SSL_set_tlsext_host_name*(ssl: SslPtr, name: cstring): int =
|
||||||
## Returns 1 if SNI was set, 0 if current SSL configuration doesn't support SNI.
|
## Returns 1 if SNI was set, 0 if current SSL configuration doesn't support SNI.
|
||||||
|
|
||||||
|
|
||||||
proc SSL_get_servername*(ssl: SslPtr, typ: cInt = TLSEXT_NAMETYPE_host_name): cstring {.cdecl, dynlib: DLLSSLName, importc.}
|
proc SSL_get_servername*(ssl: SslPtr, typ: cint = TLSEXT_NAMETYPE_host_name): cstring {.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
## Retrieve the server name requested in the client hello. This can be used
|
## Retrieve the server name requested in the client hello. This can be used
|
||||||
## in the callback set in `SSL_CTX_set_tlsext_servername_callback` to
|
## in the callback set in `SSL_CTX_set_tlsext_servername_callback` to
|
||||||
## implement virtual hosting. May return `nil`.
|
## implement virtual hosting. May return `nil`.
|
||||||
|
|
@ -497,10 +499,10 @@ proc SSL_get_psk_identity*(ssl: SslPtr): cstring {.cdecl, dynlib: DLLSSLName, im
|
||||||
proc bioNew*(b: PBIO_METHOD): BIO{.cdecl, dynlib: DLLUtilName, importc: "BIO_new".}
|
proc bioNew*(b: PBIO_METHOD): BIO{.cdecl, dynlib: DLLUtilName, importc: "BIO_new".}
|
||||||
proc bioFreeAll*(b: BIO){.cdecl, dynlib: DLLUtilName, importc: "BIO_free_all".}
|
proc bioFreeAll*(b: BIO){.cdecl, dynlib: DLLUtilName, importc: "BIO_free_all".}
|
||||||
proc bioSMem*(): PBIO_METHOD{.cdecl, dynlib: DLLUtilName, importc: "BIO_s_mem".}
|
proc bioSMem*(): PBIO_METHOD{.cdecl, dynlib: DLLUtilName, importc: "BIO_s_mem".}
|
||||||
proc bioCtrlPending*(b: BIO): cInt{.cdecl, dynlib: DLLUtilName, importc: "BIO_ctrl_pending".}
|
proc bioCtrlPending*(b: BIO): cint{.cdecl, dynlib: DLLUtilName, importc: "BIO_ctrl_pending".}
|
||||||
proc bioRead*(b: BIO, Buf: cstring, length: cInt): cInt{.cdecl,
|
proc bioRead*(b: BIO, Buf: cstring, length: cint): cint{.cdecl,
|
||||||
dynlib: DLLUtilName, importc: "BIO_read".}
|
dynlib: DLLUtilName, importc: "BIO_read".}
|
||||||
proc bioWrite*(b: BIO, Buf: cstring, length: cInt): cInt{.cdecl,
|
proc bioWrite*(b: BIO, Buf: cstring, length: cint): cint{.cdecl,
|
||||||
dynlib: DLLUtilName, importc: "BIO_write".}
|
dynlib: DLLUtilName, importc: "BIO_write".}
|
||||||
|
|
||||||
proc sslSetConnectState*(s: SslPtr) {.cdecl,
|
proc sslSetConnectState*(s: SslPtr) {.cdecl,
|
||||||
|
|
@ -508,11 +510,11 @@ proc sslSetConnectState*(s: SslPtr) {.cdecl,
|
||||||
proc sslSetAcceptState*(s: SslPtr) {.cdecl,
|
proc sslSetAcceptState*(s: SslPtr) {.cdecl,
|
||||||
dynlib: DLLSSLName, importc: "SSL_set_accept_state".}
|
dynlib: DLLSSLName, importc: "SSL_set_accept_state".}
|
||||||
|
|
||||||
proc sslRead*(ssl: SslPtr, buf: cstring, num: cInt): cInt{.cdecl,
|
proc sslRead*(ssl: SslPtr, buf: cstring, num: cint): cint{.cdecl,
|
||||||
dynlib: DLLSSLName, importc: "SSL_read".}
|
dynlib: DLLSSLName, importc: "SSL_read".}
|
||||||
proc sslPeek*(ssl: SslPtr, buf: cstring, num: cInt): cInt{.cdecl,
|
proc sslPeek*(ssl: SslPtr, buf: cstring, num: cint): cint{.cdecl,
|
||||||
dynlib: DLLSSLName, importc: "SSL_peek".}
|
dynlib: DLLSSLName, importc: "SSL_peek".}
|
||||||
proc sslWrite*(ssl: SslPtr, buf: cstring, num: cInt): cInt{.cdecl,
|
proc sslWrite*(ssl: SslPtr, buf: cstring, num: cint): cint{.cdecl,
|
||||||
dynlib: DLLSSLName, importc: "SSL_write".}
|
dynlib: DLLSSLName, importc: "SSL_write".}
|
||||||
|
|
||||||
proc sslSetBio*(ssl: SslPtr, rbio, wbio: BIO) {.cdecl,
|
proc sslSetBio*(ssl: SslPtr, rbio, wbio: BIO) {.cdecl,
|
||||||
|
|
@ -525,7 +527,7 @@ proc sslDoHandshake*(ssl: SslPtr): cint {.cdecl,
|
||||||
|
|
||||||
proc ErrClearError*(){.cdecl, dynlib: DLLUtilName, importc: "ERR_clear_error".}
|
proc ErrClearError*(){.cdecl, dynlib: DLLUtilName, importc: "ERR_clear_error".}
|
||||||
proc ErrFreeStrings*(){.cdecl, dynlib: DLLUtilName, importc: "ERR_free_strings".}
|
proc ErrFreeStrings*(){.cdecl, dynlib: DLLUtilName, importc: "ERR_free_strings".}
|
||||||
proc ErrRemoveState*(pid: cInt){.cdecl, dynlib: DLLUtilName, importc: "ERR_remove_state".}
|
proc ErrRemoveState*(pid: cint){.cdecl, dynlib: DLLUtilName, importc: "ERR_remove_state".}
|
||||||
|
|
||||||
proc PEM_read_bio_RSA_PUBKEY*(bp: BIO, x: ptr PRSA, pw: pem_password_cb, u: pointer): PRSA {.cdecl,
|
proc PEM_read_bio_RSA_PUBKEY*(bp: BIO, x: ptr PRSA, pw: pem_password_cb, u: pointer): PRSA {.cdecl,
|
||||||
dynlib: DLLSSLName, importc.}
|
dynlib: DLLSSLName, importc.}
|
||||||
|
|
@ -536,13 +538,13 @@ proc RSA_verify*(kind: cint, origMsg: pointer, origMsgLen: cuint, signature: poi
|
||||||
when true:
|
when true:
|
||||||
discard
|
discard
|
||||||
else:
|
else:
|
||||||
proc SslCtxSetCipherList*(arg0: PSSL_CTX, str: cstring): cInt{.cdecl,
|
proc SslCtxSetCipherList*(arg0: PSSL_CTX, str: cstring): cint{.cdecl,
|
||||||
dynlib: DLLSSLName, importc.}
|
dynlib: DLLSSLName, importc.}
|
||||||
proc SslCtxNew*(meth: PSSL_METHOD): PSSL_CTX{.cdecl,
|
proc SslCtxNew*(meth: PSSL_METHOD): PSSL_CTX{.cdecl,
|
||||||
dynlib: DLLSSLName, importc.}
|
dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
proc SslSetFd*(s: PSSL, fd: cInt): cInt{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SslSetFd*(s: PSSL, fd: cint): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SslCTXCtrl*(ctx: PSSL_CTX, cmd: cInt, larg: int, parg: Pointer): int{.
|
proc SslCTXCtrl*(ctx: PSSL_CTX, cmd: cint, larg: int, parg: Pointer): int{.
|
||||||
cdecl, dynlib: DLLSSLName, importc.}
|
cdecl, dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
proc SSLSetMode*(s: PSSL, mode: int): int
|
proc SSLSetMode*(s: PSSL, mode: int): int
|
||||||
|
|
@ -552,84 +554,84 @@ else:
|
||||||
proc SslMethodV3*(): PSSL_METHOD{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SslMethodV3*(): PSSL_METHOD{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SslMethodTLSV1*(): PSSL_METHOD{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SslMethodTLSV1*(): PSSL_METHOD{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SslMethodV23*(): PSSL_METHOD{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SslMethodV23*(): PSSL_METHOD{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SslCtxUsePrivateKey*(ctx: PSSL_CTX, pkey: SslPtr): cInt{.cdecl,
|
proc SslCtxUsePrivateKey*(ctx: PSSL_CTX, pkey: SslPtr): cint{.cdecl,
|
||||||
dynlib: DLLSSLName, importc.}
|
dynlib: DLLSSLName, importc.}
|
||||||
proc SslCtxUsePrivateKeyASN1*(pk: cInt, ctx: PSSL_CTX,
|
proc SslCtxUsePrivateKeyASN1*(pk: cint, ctx: PSSL_CTX,
|
||||||
d: cstring, length: int): cInt{.cdecl, dynlib: DLLSSLName, importc.}
|
d: cstring, length: int): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
proc SslCtxUseCertificate*(ctx: PSSL_CTX, x: SslPtr): cInt{.cdecl,
|
proc SslCtxUseCertificate*(ctx: PSSL_CTX, x: SslPtr): cint{.cdecl,
|
||||||
dynlib: DLLSSLName, importc.}
|
dynlib: DLLSSLName, importc.}
|
||||||
proc SslCtxUseCertificateASN1*(ctx: PSSL_CTX, length: int, d: cstring): cInt{.
|
proc SslCtxUseCertificateASN1*(ctx: PSSL_CTX, length: int, d: cstring): cint{.
|
||||||
cdecl, dynlib: DLLSSLName, importc.}
|
cdecl, dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
# function SslCtxUseCertificateChainFile(ctx: PSSL_CTX; const filename: PChar):cInt;
|
# function SslCtxUseCertificateChainFile(ctx: PSSL_CTX; const filename: PChar):cint;
|
||||||
proc SslCtxUseCertificateChainFile*(ctx: PSSL_CTX, filename: cstring): cInt{.
|
proc SslCtxUseCertificateChainFile*(ctx: PSSL_CTX, filename: cstring): cint{.
|
||||||
cdecl, dynlib: DLLSSLName, importc.}
|
cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SslCtxSetDefaultPasswdCb*(ctx: PSSL_CTX, cb: PPasswdCb){.cdecl,
|
proc SslCtxSetDefaultPasswdCb*(ctx: PSSL_CTX, cb: PPasswdCb){.cdecl,
|
||||||
dynlib: DLLSSLName, importc.}
|
dynlib: DLLSSLName, importc.}
|
||||||
proc SslCtxSetDefaultPasswdCbUserdata*(ctx: PSSL_CTX, u: SslPtr){.cdecl,
|
proc SslCtxSetDefaultPasswdCbUserdata*(ctx: PSSL_CTX, u: SslPtr){.cdecl,
|
||||||
dynlib: DLLSSLName, importc.}
|
dynlib: DLLSSLName, importc.}
|
||||||
# function SslCtxLoadVerifyLocations(ctx: PSSL_CTX; const CAfile: PChar; const CApath: PChar):cInt;
|
# function SslCtxLoadVerifyLocations(ctx: PSSL_CTX; const CAfile: PChar; const CApath: PChar):cint;
|
||||||
proc SslCtxLoadVerifyLocations*(ctx: PSSL_CTX, CAfile: cstring, CApath: cstring): cInt{.
|
proc SslCtxLoadVerifyLocations*(ctx: PSSL_CTX, CAfile: cstring, CApath: cstring): cint{.
|
||||||
cdecl, dynlib: DLLSSLName, importc.}
|
cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SslNew*(ctx: PSSL_CTX): PSSL{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SslNew*(ctx: PSSL_CTX): PSSL{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
|
|
||||||
proc SslConnect*(ssl: PSSL): cInt{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SslConnect*(ssl: PSSL): cint{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
|
|
||||||
|
|
||||||
proc SslGetVersion*(ssl: PSSL): cstring{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SslGetVersion*(ssl: PSSL): cstring{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SslGetPeerCertificate*(ssl: PSSL): PX509{.cdecl, dynlib: DLLSSLName,
|
proc SslGetPeerCertificate*(ssl: PSSL): PX509{.cdecl, dynlib: DLLSSLName,
|
||||||
importc.}
|
importc.}
|
||||||
proc SslCtxSetVerify*(ctx: PSSL_CTX, mode: cInt, arg2: PFunction){.cdecl,
|
proc SslCtxSetVerify*(ctx: PSSL_CTX, mode: cint, arg2: PFunction){.cdecl,
|
||||||
dynlib: DLLSSLName, importc.}
|
dynlib: DLLSSLName, importc.}
|
||||||
proc SSLGetCurrentCipher*(s: PSSL): SslPtr{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SSLGetCurrentCipher*(s: PSSL): SslPtr{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SSLCipherGetName*(c: SslPtr): cstring{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SSLCipherGetName*(c: SslPtr): cstring{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
proc SSLCipherGetBits*(c: SslPtr, alg_bits: var cInt): cInt{.cdecl,
|
proc SSLCipherGetBits*(c: SslPtr, alg_bits: var cint): cint{.cdecl,
|
||||||
dynlib: DLLSSLName, importc.}
|
dynlib: DLLSSLName, importc.}
|
||||||
proc SSLGetVerifyResult*(ssl: PSSL): int{.cdecl, dynlib: DLLSSLName, importc.}
|
proc SSLGetVerifyResult*(ssl: PSSL): int{.cdecl, dynlib: DLLSSLName, importc.}
|
||||||
# libeay.dll
|
# libeay.dll
|
||||||
proc X509New*(): PX509{.cdecl, dynlib: DLLUtilName, importc.}
|
proc X509New*(): PX509{.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
proc X509Free*(x: PX509){.cdecl, dynlib: DLLUtilName, importc.}
|
proc X509Free*(x: PX509){.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
proc X509NameOneline*(a: PX509_NAME, buf: cstring, size: cInt): cstring{.
|
proc X509NameOneline*(a: PX509_NAME, buf: cstring, size: cint): cstring{.
|
||||||
cdecl, dynlib: DLLUtilName, importc.}
|
cdecl, dynlib: DLLUtilName, importc.}
|
||||||
proc X509GetSubjectName*(a: PX509): PX509_NAME{.cdecl, dynlib: DLLUtilName,
|
proc X509GetSubjectName*(a: PX509): PX509_NAME{.cdecl, dynlib: DLLUtilName,
|
||||||
importc.}
|
importc.}
|
||||||
proc X509GetIssuerName*(a: PX509): PX509_NAME{.cdecl, dynlib: DLLUtilName,
|
proc X509GetIssuerName*(a: PX509): PX509_NAME{.cdecl, dynlib: DLLUtilName,
|
||||||
importc.}
|
importc.}
|
||||||
proc X509NameHash*(x: PX509_NAME): int{.cdecl, dynlib: DLLUtilName, importc.}
|
proc X509NameHash*(x: PX509_NAME): int{.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
# function SslX509Digest(data: PX509; typ: PEVP_MD; md: PChar; len: PcInt):cInt;
|
# function SslX509Digest(data: PX509; typ: PEVP_MD; md: PChar; len: PcInt):cint;
|
||||||
proc X509Digest*(data: PX509, typ: PEVP_MD, md: cstring, length: var cInt): cInt{.
|
proc X509Digest*(data: PX509, typ: PEVP_MD, md: cstring, length: var cint): cint{.
|
||||||
cdecl, dynlib: DLLUtilName, importc.}
|
cdecl, dynlib: DLLUtilName, importc.}
|
||||||
proc X509print*(b: PBIO, a: PX509): cInt{.cdecl, dynlib: DLLUtilName, importc.}
|
proc X509print*(b: PBIO, a: PX509): cint{.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
proc X509SetVersion*(x: PX509, version: cInt): cInt{.cdecl, dynlib: DLLUtilName,
|
proc X509SetVersion*(x: PX509, version: cint): cint{.cdecl, dynlib: DLLUtilName,
|
||||||
importc.}
|
importc.}
|
||||||
proc X509SetPubkey*(x: PX509, pkey: EVP_PKEY): cInt{.cdecl, dynlib: DLLUtilName,
|
proc X509SetPubkey*(x: PX509, pkey: EVP_PKEY): cint{.cdecl, dynlib: DLLUtilName,
|
||||||
importc.}
|
importc.}
|
||||||
proc X509SetIssuerName*(x: PX509, name: PX509_NAME): cInt{.cdecl,
|
proc X509SetIssuerName*(x: PX509, name: PX509_NAME): cint{.cdecl,
|
||||||
dynlib: DLLUtilName, importc.}
|
dynlib: DLLUtilName, importc.}
|
||||||
proc X509NameAddEntryByTxt*(name: PX509_NAME, field: cstring, typ: cInt,
|
proc X509NameAddEntryByTxt*(name: PX509_NAME, field: cstring, typ: cint,
|
||||||
bytes: cstring, length, loc, theSet: cInt): cInt{.
|
bytes: cstring, length, loc, theSet: cint): cint{.
|
||||||
cdecl, dynlib: DLLUtilName, importc.}
|
cdecl, dynlib: DLLUtilName, importc.}
|
||||||
proc X509Sign*(x: PX509, pkey: EVP_PKEY, md: PEVP_MD): cInt{.cdecl,
|
proc X509Sign*(x: PX509, pkey: EVP_PKEY, md: PEVP_MD): cint{.cdecl,
|
||||||
dynlib: DLLUtilName, importc.}
|
dynlib: DLLUtilName, importc.}
|
||||||
proc X509GmtimeAdj*(s: PASN1_UTCTIME, adj: cInt): PASN1_UTCTIME{.cdecl,
|
proc X509GmtimeAdj*(s: PASN1_UTCTIME, adj: cint): PASN1_UTCTIME{.cdecl,
|
||||||
dynlib: DLLUtilName, importc.}
|
dynlib: DLLUtilName, importc.}
|
||||||
proc X509SetNotBefore*(x: PX509, tm: PASN1_UTCTIME): cInt{.cdecl,
|
proc X509SetNotBefore*(x: PX509, tm: PASN1_UTCTIME): cint{.cdecl,
|
||||||
dynlib: DLLUtilName, importc.}
|
dynlib: DLLUtilName, importc.}
|
||||||
proc X509SetNotAfter*(x: PX509, tm: PASN1_UTCTIME): cInt{.cdecl,
|
proc X509SetNotAfter*(x: PX509, tm: PASN1_UTCTIME): cint{.cdecl,
|
||||||
dynlib: DLLUtilName, importc.}
|
dynlib: DLLUtilName, importc.}
|
||||||
proc X509GetSerialNumber*(x: PX509): PASN1_cInt{.cdecl, dynlib: DLLUtilName,
|
proc X509GetSerialNumber*(x: PX509): PASN1_cInt{.cdecl, dynlib: DLLUtilName,
|
||||||
importc.}
|
importc.}
|
||||||
proc EvpPkeyNew*(): EVP_PKEY{.cdecl, dynlib: DLLUtilName, importc.}
|
proc EvpPkeyNew*(): EVP_PKEY{.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
proc EvpPkeyFree*(pk: EVP_PKEY){.cdecl, dynlib: DLLUtilName, importc.}
|
proc EvpPkeyFree*(pk: EVP_PKEY){.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
proc EvpPkeyAssign*(pkey: EVP_PKEY, typ: cInt, key: Prsa): cInt{.cdecl,
|
proc EvpPkeyAssign*(pkey: EVP_PKEY, typ: cint, key: Prsa): cint{.cdecl,
|
||||||
dynlib: DLLUtilName, importc.}
|
dynlib: DLLUtilName, importc.}
|
||||||
proc EvpGetDigestByName*(Name: cstring): PEVP_MD{.cdecl, dynlib: DLLUtilName,
|
proc EvpGetDigestByName*(Name: cstring): PEVP_MD{.cdecl, dynlib: DLLUtilName,
|
||||||
importc.}
|
importc.}
|
||||||
proc EVPcleanup*(){.cdecl, dynlib: DLLUtilName, importc.}
|
proc EVPcleanup*(){.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
# function ErrErrorString(e: cInt; buf: PChar): PChar;
|
# function ErrErrorString(e: cint; buf: PChar): PChar;
|
||||||
proc SSLeayversion*(t: cInt): cstring{.cdecl, dynlib: DLLUtilName, importc.}
|
proc SSLeayversion*(t: cint): cstring{.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
|
|
||||||
|
|
||||||
proc OPENSSLaddallalgorithms*(){.cdecl, dynlib: DLLUtilName, importc.}
|
proc OPENSSLaddallalgorithms*(){.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
|
|
@ -642,21 +644,21 @@ else:
|
||||||
dynlib: DLLUtilName, importc, cdecl.}
|
dynlib: DLLUtilName, importc, cdecl.}
|
||||||
|
|
||||||
proc PKCS12free*(p12: SslPtr){.cdecl, dynlib: DLLUtilName, importc.}
|
proc PKCS12free*(p12: SslPtr){.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
proc RsaGenerateKey*(bits, e: cInt, callback: PFunction, cb_arg: SslPtr): PRSA{.
|
proc RsaGenerateKey*(bits, e: cint, callback: PFunction, cb_arg: SslPtr): PRSA{.
|
||||||
cdecl, dynlib: DLLUtilName, importc.}
|
cdecl, dynlib: DLLUtilName, importc.}
|
||||||
proc Asn1UtctimeNew*(): PASN1_UTCTIME{.cdecl, dynlib: DLLUtilName, importc.}
|
proc Asn1UtctimeNew*(): PASN1_UTCTIME{.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
proc Asn1UtctimeFree*(a: PASN1_UTCTIME){.cdecl, dynlib: DLLUtilName, importc.}
|
proc Asn1UtctimeFree*(a: PASN1_UTCTIME){.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
proc Asn1cIntSet*(a: PASN1_cInt, v: cInt): cInt{.cdecl, dynlib: DLLUtilName,
|
proc Asn1cIntSet*(a: PASN1_cInt, v: cint): cint{.cdecl, dynlib: DLLUtilName,
|
||||||
importc.}
|
importc.}
|
||||||
proc i2dX509bio*(b: PBIO, x: PX509): cInt{.cdecl, dynlib: DLLUtilName, importc.}
|
proc i2dX509bio*(b: PBIO, x: PX509): cint{.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
proc i2dPrivateKeyBio*(b: PBIO, pkey: EVP_PKEY): cInt{.cdecl,
|
proc i2dPrivateKeyBio*(b: PBIO, pkey: EVP_PKEY): cint{.cdecl,
|
||||||
dynlib: DLLUtilName, importc.}
|
dynlib: DLLUtilName, importc.}
|
||||||
# 3DES functions
|
# 3DES functions
|
||||||
proc DESsetoddparity*(Key: des_cblock){.cdecl, dynlib: DLLUtilName, importc.}
|
proc DESsetoddparity*(Key: des_cblock){.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
proc DESsetkeychecked*(key: des_cblock, schedule: des_key_schedule): cInt{.
|
proc DESsetkeychecked*(key: des_cblock, schedule: des_key_schedule): cint{.
|
||||||
cdecl, dynlib: DLLUtilName, importc.}
|
cdecl, dynlib: DLLUtilName, importc.}
|
||||||
proc DESecbencrypt*(Input: des_cblock, output: des_cblock, ks: des_key_schedule,
|
proc DESecbencrypt*(Input: des_cblock, output: des_cblock, ks: des_key_schedule,
|
||||||
enc: cInt){.cdecl, dynlib: DLLUtilName, importc.}
|
enc: cint){.cdecl, dynlib: DLLUtilName, importc.}
|
||||||
# implementation
|
# implementation
|
||||||
|
|
||||||
proc SSLSetMode(s: PSSL, mode: int): int =
|
proc SSLSetMode(s: PSSL, mode: int): int =
|
||||||
|
|
@ -708,11 +710,11 @@ proc md5_File*(file: string): string {.raises: [IOError,Exception].} =
|
||||||
buf: array[sz,char]
|
buf: array[sz,char]
|
||||||
ctx: MD5_CTX
|
ctx: MD5_CTX
|
||||||
|
|
||||||
discard md5_init(ctx)
|
discard md5_Init(ctx)
|
||||||
while(let bytes = f.readChars(buf, 0, sz); bytes > 0):
|
while(let bytes = f.readChars(buf, 0, sz); bytes > 0):
|
||||||
discard md5_update(ctx, buf[0].addr, bytes)
|
discard md5_Update(ctx, buf[0].addr, bytes)
|
||||||
|
|
||||||
discard md5_final(buf[0].addr, ctx)
|
discard md5_Final(buf[0].addr, ctx)
|
||||||
f.close
|
f.close
|
||||||
|
|
||||||
result = hexStr(addr buf)
|
result = hexStr(addr buf)
|
||||||
|
|
@ -724,13 +726,16 @@ proc md5_Str*(str: string): string =
|
||||||
ctx: MD5_CTX
|
ctx: MD5_CTX
|
||||||
res: array[MD5_DIGEST_LENGTH,char]
|
res: array[MD5_DIGEST_LENGTH,char]
|
||||||
input = str.cstring
|
input = str.cstring
|
||||||
discard md5_init(ctx)
|
discard md5_Init(ctx)
|
||||||
|
|
||||||
var i = 0
|
var i = 0
|
||||||
while i < str.len:
|
while i < str.len:
|
||||||
let L = min(str.len - i, 512)
|
let L = min(str.len - i, 512)
|
||||||
discard md5_update(ctx, input[i].addr, L)
|
discard md5_Update(ctx, input[i].addr, L)
|
||||||
i += L
|
i += L
|
||||||
|
|
||||||
discard md5_final(addr res, ctx)
|
discard md5_Final(addr res, ctx)
|
||||||
result = hexStr(addr res)
|
result = hexStr(addr res)
|
||||||
|
|
||||||
|
when defined(nimHasStyleChecks):
|
||||||
|
{.pop.}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
{.deadCodeElim: on.} # dce option deprecated
|
{.deadCodeElim: on.} # dce option deprecated
|
||||||
|
when defined(nimHasStyleChecks):
|
||||||
|
{.push styleChecks: off.}
|
||||||
|
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
const
|
const
|
||||||
|
|
@ -114,7 +116,7 @@ type
|
||||||
PPGVerbosity* = ptr PGVerbosity
|
PPGVerbosity* = ptr PGVerbosity
|
||||||
PGVerbosity* = enum
|
PGVerbosity* = enum
|
||||||
PQERRORS_TERSE, PQERRORS_DEFAULT, PQERRORS_VERBOSE
|
PQERRORS_TERSE, PQERRORS_DEFAULT, PQERRORS_VERBOSE
|
||||||
PpgNotify* = ptr pgNotify
|
PPGNotify* = ptr pgNotify
|
||||||
pgNotify*{.pure, final.} = object
|
pgNotify*{.pure, final.} = object
|
||||||
relname*: cstring
|
relname*: cstring
|
||||||
be_pid*: int32
|
be_pid*: int32
|
||||||
|
|
@ -124,7 +126,7 @@ type
|
||||||
PQnoticeProcessor* = proc (arg: pointer, message: cstring){.cdecl.}
|
PQnoticeProcessor* = proc (arg: pointer, message: cstring){.cdecl.}
|
||||||
Ppqbool* = ptr pqbool
|
Ppqbool* = ptr pqbool
|
||||||
pqbool* = char
|
pqbool* = char
|
||||||
P_PQprintOpt* = ptr PQprintOpt
|
PPQprintOpt* = ptr PQprintOpt
|
||||||
PQprintOpt*{.pure, final.} = object
|
PQprintOpt*{.pure, final.} = object
|
||||||
header*: pqbool
|
header*: pqbool
|
||||||
align*: pqbool
|
align*: pqbool
|
||||||
|
|
@ -137,7 +139,7 @@ type
|
||||||
caption*: cstring
|
caption*: cstring
|
||||||
fieldName*: ptr cstring
|
fieldName*: ptr cstring
|
||||||
|
|
||||||
P_PQconninfoOption* = ptr PQconninfoOption
|
PPQconninfoOption* = ptr PQconninfoOption
|
||||||
PQconninfoOption*{.pure, final.} = object
|
PQconninfoOption*{.pure, final.} = object
|
||||||
keyword*: cstring
|
keyword*: cstring
|
||||||
envvar*: cstring
|
envvar*: cstring
|
||||||
|
|
@ -164,7 +166,7 @@ proc pqconnectdb*(conninfo: cstring): PPGconn{.cdecl, dynlib: dllName,
|
||||||
proc pqsetdbLogin*(pghost: cstring, pgport: cstring, pgoptions: cstring,
|
proc pqsetdbLogin*(pghost: cstring, pgport: cstring, pgoptions: cstring,
|
||||||
pgtty: cstring, dbName: cstring, login: cstring, pwd: cstring): PPGconn{.
|
pgtty: cstring, dbName: cstring, login: cstring, pwd: cstring): PPGconn{.
|
||||||
cdecl, dynlib: dllName, importc: "PQsetdbLogin".}
|
cdecl, dynlib: dllName, importc: "PQsetdbLogin".}
|
||||||
proc pqsetdb*(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME: cstring): Ppgconn
|
proc pqsetdb*(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME: cstring): PPGconn
|
||||||
proc pqfinish*(conn: PPGconn){.cdecl, dynlib: dllName, importc: "PQfinish".}
|
proc pqfinish*(conn: PPGconn){.cdecl, dynlib: dllName, importc: "PQfinish".}
|
||||||
proc pqconndefaults*(): PPQconninfoOption{.cdecl, dynlib: dllName,
|
proc pqconndefaults*(): PPQconninfoOption{.cdecl, dynlib: dllName,
|
||||||
importc: "PQconndefaults".}
|
importc: "PQconndefaults".}
|
||||||
|
|
@ -247,7 +249,7 @@ proc pqisBusy*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
|
||||||
importc: "PQisBusy".}
|
importc: "PQisBusy".}
|
||||||
proc pqconsumeInput*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
|
proc pqconsumeInput*(conn: PPGconn): int32{.cdecl, dynlib: dllName,
|
||||||
importc: "PQconsumeInput".}
|
importc: "PQconsumeInput".}
|
||||||
proc pqnotifies*(conn: PPGconn): PPGnotify{.cdecl, dynlib: dllName,
|
proc pqnotifies*(conn: PPGconn): PPGNotify{.cdecl, dynlib: dllName,
|
||||||
importc: "PQnotifies".}
|
importc: "PQnotifies".}
|
||||||
proc pqputCopyData*(conn: PPGconn, buffer: cstring, nbytes: int32): int32{.
|
proc pqputCopyData*(conn: PPGconn, buffer: cstring, nbytes: int32): int32{.
|
||||||
cdecl, dynlib: dllName, importc: "PQputCopyData".}
|
cdecl, dynlib: dllName, importc: "PQputCopyData".}
|
||||||
|
|
@ -358,5 +360,8 @@ proc lo_export*(conn: PPGconn, lobjId: Oid, filename: cstring): int32{.cdecl,
|
||||||
proc pqmblen*(s: cstring, encoding: int32): int32{.cdecl, dynlib: dllName,
|
proc pqmblen*(s: cstring, encoding: int32): int32{.cdecl, dynlib: dllName,
|
||||||
importc: "PQmblen".}
|
importc: "PQmblen".}
|
||||||
proc pqenv2encoding*(): int32{.cdecl, dynlib: dllName, importc: "PQenv2encoding".}
|
proc pqenv2encoding*(): int32{.cdecl, dynlib: dllName, importc: "PQenv2encoding".}
|
||||||
proc pqsetdb(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME: cstring): PPgConn =
|
proc pqsetdb(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME: cstring): PPGconn =
|
||||||
result = pqSetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, "", "")
|
result = pqsetdbLogin(M_PGHOST, M_PGPORT, M_PGOPT, M_PGTTY, M_DBNAME, "", "")
|
||||||
|
|
||||||
|
when defined(nimHasStyleChecks):
|
||||||
|
{.pop.}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,10 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
{.deadCodeElim: on.} # dce option deprecated
|
{.deadCodeElim: on.} # dce option deprecated
|
||||||
|
|
||||||
|
when defined(nimHasStyleChecks):
|
||||||
|
{.push styleChecks: off.}
|
||||||
|
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
when defined(nimOldDlls):
|
when defined(nimOldDlls):
|
||||||
const Lib = "sqlite3.dll"
|
const Lib = "sqlite3.dll"
|
||||||
|
|
@ -362,3 +366,6 @@ proc libversion_number*(): int32{.cdecl, dynlib: Lib,
|
||||||
#function sqlite3_expired(_para1:Psqlite3_stmt):longint;cdecl; external Sqlite3Lib name 'sqlite3_expired';
|
#function sqlite3_expired(_para1:Psqlite3_stmt):longint;cdecl; external Sqlite3Lib name 'sqlite3_expired';
|
||||||
#function sqlite3_global_recover:longint;cdecl; external Sqlite3Lib name 'sqlite3_global_recover';
|
#function sqlite3_global_recover:longint;cdecl; external Sqlite3Lib name 'sqlite3_global_recover';
|
||||||
# implementation
|
# implementation
|
||||||
|
|
||||||
|
when defined(nimHasStyleChecks):
|
||||||
|
{.pop.}
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ const
|
||||||
OutputObj*: cint = 4 ## object file
|
OutputObj*: cint = 4 ## object file
|
||||||
OutputPreprocess*: cint = 5 ## preprocessed file (used internally)
|
OutputPreprocess*: cint = 5 ## preprocessed file (used internally)
|
||||||
|
|
||||||
proc setOutputType*(s: PCCState, outputType: cint): cint {.cdecl,
|
proc setOutputType*(s: PccState, outputType: cint): cint {.cdecl,
|
||||||
importc: "tcc_set_output_type".}
|
importc: "tcc_set_output_type".}
|
||||||
## set output type. MUST BE CALLED before any compilation
|
## set output type. MUST BE CALLED before any compilation
|
||||||
|
|
||||||
|
|
@ -74,7 +74,7 @@ proc addLibraryPath*(s: PccState, pathname: cstring): cint {.cdecl,
|
||||||
importc: "tcc_add_library_path".}
|
importc: "tcc_add_library_path".}
|
||||||
## equivalent to -Lpath option
|
## equivalent to -Lpath option
|
||||||
|
|
||||||
proc addLibrary*(s: PCCState, libraryname: cstring): cint {.cdecl,
|
proc addLibrary*(s: PccState, libraryname: cstring): cint {.cdecl,
|
||||||
importc: "tcc_add_library".}
|
importc: "tcc_add_library".}
|
||||||
## the library name is the same as the argument of the '-l' option
|
## the library name is the same as the argument of the '-l' option
|
||||||
|
|
||||||
|
|
@ -105,5 +105,3 @@ proc getSymbol*(s: PccState, name: cstring): pointer {.cdecl,
|
||||||
proc setLibPath*(s: PccState, path: cstring) {.cdecl,
|
proc setLibPath*(s: PccState, path: cstring) {.cdecl,
|
||||||
importc: "tcc_set_lib_path".}
|
importc: "tcc_set_lib_path".}
|
||||||
## set CONFIG_TCCDIR at runtime
|
## set CONFIG_TCCDIR at runtime
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ proc main =
|
||||||
case kind
|
case kind
|
||||||
of cmdArgument:
|
of cmdArgument:
|
||||||
infile = key.addFileExt(".nim")
|
infile = key.addFileExt(".nim")
|
||||||
of cmdLongoption, cmdShortOption:
|
of cmdLongOption, cmdShortOption:
|
||||||
case normalize(key)
|
case normalize(key)
|
||||||
of "help", "h": writeHelp()
|
of "help", "h": writeHelp()
|
||||||
of "version", "v": writeVersion()
|
of "version", "v": writeVersion()
|
||||||
|
|
|
||||||
|
|
@ -274,7 +274,7 @@ template setVerbosity(level: typed) =
|
||||||
conf.notes = NotesVerbosity[gVerbosity]
|
conf.notes = NotesVerbosity[gVerbosity]
|
||||||
|
|
||||||
proc connectToNextFreePort(server: Socket, host: string): Port =
|
proc connectToNextFreePort(server: Socket, host: string): Port =
|
||||||
server.bindaddr(Port(0), host)
|
server.bindAddr(Port(0), host)
|
||||||
let (_, port) = server.getLocalAddr
|
let (_, port) = server.getLocalAddr
|
||||||
result = port
|
result = port
|
||||||
|
|
||||||
|
|
@ -342,9 +342,9 @@ proc argsToStr(x: SexpNode): string =
|
||||||
result.add ';'
|
result.add ';'
|
||||||
result.add dirty.escape
|
result.add dirty.escape
|
||||||
result.add ':'
|
result.add ':'
|
||||||
result.add line
|
result.addInt line
|
||||||
result.add ':'
|
result.add ':'
|
||||||
result.add col
|
result.addInt col
|
||||||
|
|
||||||
proc replEpc(x: ThreadParams) {.thread.} =
|
proc replEpc(x: ThreadParams) {.thread.} =
|
||||||
var server = newSocket()
|
var server = newSocket()
|
||||||
|
|
@ -393,7 +393,7 @@ proc replEpc(x: ThreadParams) {.thread.} =
|
||||||
of "return", "return-error":
|
of "return", "return-error":
|
||||||
"no return expected"
|
"no return expected"
|
||||||
else:
|
else:
|
||||||
"unexpected call: " & epcAPI
|
"unexpected call: " & epcApi
|
||||||
quit errMessage
|
quit errMessage
|
||||||
|
|
||||||
proc execCmd(cmd: string; graph: ModuleGraph; cachedMsgs: CachedMsgs) =
|
proc execCmd(cmd: string; graph: ModuleGraph; cachedMsgs: CachedMsgs) =
|
||||||
|
|
@ -464,7 +464,7 @@ proc recompileFullProject(graph: ModuleGraph) =
|
||||||
resetSystemArtifacts(graph)
|
resetSystemArtifacts(graph)
|
||||||
graph.vm = nil
|
graph.vm = nil
|
||||||
graph.resetAllModules()
|
graph.resetAllModules()
|
||||||
GC_fullcollect()
|
GC_fullCollect()
|
||||||
compileProject(graph)
|
compileProject(graph)
|
||||||
#echo GC_getStatistics()
|
#echo GC_getStatistics()
|
||||||
|
|
||||||
|
|
@ -553,10 +553,10 @@ proc processCmdLine*(pass: TCmdLinePass, cmd: string; conf: ConfigRef) =
|
||||||
parseopt.next(p)
|
parseopt.next(p)
|
||||||
case p.kind
|
case p.kind
|
||||||
of cmdEnd: break
|
of cmdEnd: break
|
||||||
of cmdLongoption, cmdShortOption:
|
of cmdLongOption, cmdShortOption:
|
||||||
case p.key.normalize
|
case p.key.normalize
|
||||||
of "help", "h":
|
of "help", "h":
|
||||||
stdout.writeline(Usage)
|
stdout.writeLine(Usage)
|
||||||
quit()
|
quit()
|
||||||
of "autobind":
|
of "autobind":
|
||||||
gMode = mtcp
|
gMode = mtcp
|
||||||
|
|
@ -614,7 +614,7 @@ proc handleCmdLine(cache: IdentCache; conf: ConfigRef) =
|
||||||
self.initDefinesProg(conf, "nimsuggest")
|
self.initDefinesProg(conf, "nimsuggest")
|
||||||
|
|
||||||
if paramCount() == 0:
|
if paramCount() == 0:
|
||||||
stdout.writeline(Usage)
|
stdout.writeLine(Usage)
|
||||||
return
|
return
|
||||||
|
|
||||||
self.processCmdLineAndProjectPath(conf)
|
self.processCmdLineAndProjectPath(conf)
|
||||||
|
|
@ -636,7 +636,7 @@ proc handleCmdLine(cache: IdentCache; conf: ConfigRef) =
|
||||||
discard self.loadConfigsAndRunMainCommand(cache, conf)
|
discard self.loadConfigsAndRunMainCommand(cache, conf)
|
||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
handleCmdline(newIdentCache(), newConfigRef())
|
handleCmdLine(newIdentCache(), newConfigRef())
|
||||||
else:
|
else:
|
||||||
export Suggest
|
export Suggest
|
||||||
export IdeCmd
|
export IdeCmd
|
||||||
|
|
|
||||||
|
|
@ -398,7 +398,7 @@ proc sexp*(elements: openArray[SexpNode]): SexpNode =
|
||||||
proc sexp*(s: SexpNode): SexpNode =
|
proc sexp*(s: SexpNode): SexpNode =
|
||||||
result = s
|
result = s
|
||||||
|
|
||||||
proc toSexp(x: NimNode): NimNode {.compiletime.} =
|
proc toSexp(x: NimNode): NimNode {.compileTime.} =
|
||||||
case x.kind
|
case x.kind
|
||||||
of nnkBracket:
|
of nnkBracket:
|
||||||
result = newNimNode(nnkBracket)
|
result = newNimNode(nnkBracket)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue