diff options
author | Araq <rumpf_a@web.de> | 2019-07-11 00:28:20 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2019-07-11 00:28:20 +0200 |
commit | cb3c3c306c6507a09c15da26828a39fbbd4dbc66 (patch) | |
tree | 5543b3ddfb23e6a748db4e475a103fe9b1cf1f6d | |
parent | 38bdf1cd7f4d5c6e22a70ee32438beccc7e36690 (diff) | |
download | Nim-cb3c3c306c6507a09c15da26828a39fbbd4dbc66.tar.gz |
minor style changes
-rw-r--r-- | compiler/layouter.nim | 6 | ||||
-rw-r--r-- | compiler/lexer.nim | 2 | ||||
-rw-r--r-- | compiler/suggest.nim | 2 | ||||
-rw-r--r-- | lib/impure/rdstdin.nim | 4 | ||||
-rw-r--r-- | lib/system/atomics.nim | 8 | ||||
-rw-r--r-- | lib/system/threadlocalstorage.nim | 2 | ||||
-rw-r--r-- | lib/wrappers/mysql.nim | 16 | ||||
-rw-r--r-- | lib/wrappers/odbcsql.nim | 5 | ||||
-rw-r--r-- | lib/wrappers/openssl.nim | 145 | ||||
-rw-r--r-- | lib/wrappers/postgres.nim | 19 | ||||
-rw-r--r-- | lib/wrappers/sqlite3.nim | 7 | ||||
-rw-r--r-- | lib/wrappers/tinyc.nim | 6 | ||||
-rw-r--r-- | nimpretty/nimpretty.nim | 2 | ||||
-rw-r--r-- | nimsuggest/nimsuggest.nim | 18 | ||||
-rw-r--r-- | nimsuggest/sexp.nim | 2 |
15 files changed, 134 insertions, 110 deletions
diff --git a/compiler/layouter.nim b/compiler/layouter.nim index 221afc78c..5a53e1d35 100644 --- a/compiler/layouter.nim +++ b/compiler/layouter.nim @@ -53,7 +53,7 @@ type proc openEmitter*(em: var Emitter, cache: IdentCache; config: ConfigRef, fileIdx: FileIndex) = - let fullPath = Absolutefile config.toFullPath(fileIdx) + let fullPath = AbsoluteFile config.toFullPath(fileIdx) if em.indWidth == 0: em.indWidth = getIndentWidth(fileIdx, llStreamOpen(fullPath, fmRead), cache, config) @@ -285,7 +285,7 @@ const tkBracketRi, tkCurlyDotRi, 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, tkIsnot, tkNot, tkOf, tkAs, tkDotDot, tkAnd, tkOr, tkXor} @@ -458,7 +458,7 @@ proc emitTok*(em: var Emitter; L: TLexer; tok: TToken) = of tkColon: wr(em, TokTypeToStr[tok.tokType], ltOther) wrSpace em - of tkSemicolon, tkComma: + of tkSemiColon, tkComma: wr(em, TokTypeToStr[tok.tokType], ltOther) rememberSplit(splitComma) wrSpace em diff --git a/compiler/lexer.nim b/compiler/lexer.nim index ea4aea8cf..4bf50a359 100644 --- a/compiler/lexer.nim +++ b/compiler/lexer.nim @@ -375,7 +375,7 @@ proc getNumber(L: var TLexer, result: var TToken) = result.literal = "" result.base = base10 startpos = L.bufpos - tokenBegin(result, startPos) + tokenBegin(result, startpos) # First stage: find out base, make verifications, build token literal string # {'c', 'C'} is added for deprecation reasons to provide a clear error message diff --git a/compiler/suggest.nim b/compiler/suggest.nim index 705d723d1..9e738e8a6 100644 --- a/compiler/suggest.nim +++ b/compiler/suggest.nim @@ -362,7 +362,7 @@ proc suggestFieldAccess(c: PContext, n, field: PNode, outputs: var Suggestions) # error: no known module name: typ = nil 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 else: for it in items(n.sym.tab): diff --git a/lib/impure/rdstdin.nim b/lib/impure/rdstdin.nim index ac38addba..742db0cc6 100644 --- a/lib/impure/rdstdin.nim +++ b/lib/impure/rdstdin.nim @@ -43,7 +43,7 @@ when defined(Windows): type KEY_EVENT_RECORD = object - bKeyDown: WinBool + bKeyDown: WINBOOL wRepeatCount: uint16 wVirtualKeyCode: uint16 wVirtualScanCode: uint16 @@ -55,7 +55,7 @@ when defined(Windows): event*: KEY_EVENT_RECORD safetyBuffer: array[0..5, DWORD] - proc readConsoleInputW*(hConsoleInput: HANDLE, lpBuffer: var INPUTRECORD, + proc readConsoleInputW*(hConsoleInput: Handle, lpBuffer: var INPUT_RECORD, nLength: uint32, lpNumberOfEventsRead: var uint32): WINBOOL{. stdcall, dynlib: "kernel32", importc: "ReadConsoleInputW".} diff --git a/lib/system/atomics.nim b/lib/system/atomics.nim index 633348034..1b55a1ffe 100644 --- a/lib/system/atomics.nim +++ b/lib/system/atomics.nim @@ -190,7 +190,7 @@ else: proc atomicInc*(memLoc: var int, x: int = 1): int = 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: result = addAndFetch(memLoc.addr, 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 = when someGcc and hasThreadSupport: - when declared(atomic_sub_fetch): - result = atomic_sub_fetch(memLoc.addr, x, ATOMIC_RELAXED) + when declared(atomicSubFetch): + result = atomicSubFetch(memLoc.addr, x, ATOMIC_RELAXED) else: - result = atomic_add_fetch(memLoc.addr, -x, ATOMIC_RELAXED) + result = atomicAddFetch(memLoc.addr, -x, ATOMIC_RELAXED) elif defined(vcc) and hasThreadSupport: result = addAndFetch(memLoc.addr, -x) dec(result, x) diff --git a/lib/system/threadlocalstorage.nim b/lib/system/threadlocalstorage.nim index b8ffee721..6ab038a27 100644 --- a/lib/system/threadlocalstorage.nim +++ b/lib/system/threadlocalstorage.nim @@ -225,7 +225,7 @@ when emulatedThreadVars: proc GetThreadLocalVars(): pointer {.compilerRtl, inl.} = result = addr(cast[PGcThread](threadVarGetValue(globalsSlot)).tls) - proc initThreadVarsEmulation() {.compilerProc, inline.} = + proc initThreadVarsEmulation() {.compilerproc, inline.} = when not defined(useNimRtl): globalsSlot = threadVarAlloc() when declared(mainThread): diff --git a/lib/wrappers/mysql.nim b/lib/wrappers/mysql.nim index 06c663822..1f523ac5f 100644 --- a/lib/wrappers/mysql.nim +++ b/lib/wrappers/mysql.nim @@ -9,6 +9,8 @@ {.deadCodeElim: on.} # dce option deprecated {.push, callconv: cdecl.} +when defined(nimHasStyleChecks): + {.push styleChecks: off.} when defined(Unix): when defined(macosx): @@ -153,7 +155,7 @@ const type Pst_net* = ptr St_net St_net*{.final.} = object - vio*: PVio + vio*: PVIO buff*: cstring buff_end*: cstring write_pos*: cstring @@ -261,7 +263,7 @@ type Tenum_cursor_type: Enum_cursor_type, 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".} proc my_net_local_init*(net: PNET){.cdecl, dynlib: lib, importc: "my_net_local_init".} @@ -751,7 +753,7 @@ type len*: int # output length pointer is_null*: Pmy_bool # Pointer to null indicator 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_length*: int # buffer length, must be set for str/binary # 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 is_null_value*: my_bool # Used if is_null is 0 store_param_func*: proc (net: PNET, param: Pst_mysql_bind){.cdecl.} - fetch_result*: proc (para1: Pst_mysql_bind, para2: PFIELD, row: PPbyte) - skip_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) BIND* = St_mysql_bind PBIND* = ptr BIND # statement handler @@ -780,7 +782,7 @@ type data_cursor*: PROWS # current row in cached result affected_rows*: my_ulonglong # copy of mysql->affected_rows after statement execution 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 flags*: int # i.e. type of cursor to open prefetch_rows*: int # number of rows per one COM_FETCH @@ -1110,3 +1112,5 @@ proc reload(x: PMySQL): cint = result = refresh(x, REFRESH_GRANT) {.pop.} +when defined(nimHasStyleChecks): + {.pop.} diff --git a/lib/wrappers/odbcsql.nim b/lib/wrappers/odbcsql.nim index 6a27d8355..14dd10ae3 100644 --- a/lib/wrappers/odbcsql.nim +++ b/lib/wrappers/odbcsql.nim @@ -20,6 +20,9 @@ else: {.push callconv: cdecl.} const odbclib = "libodbc.so" +when defined(nimHasStyleChecks): + {.push styleChecks: off.} + # DATA TYPES CORRESPONDENCE # BDE fields ODBC types # ---------- ------------------ @@ -834,3 +837,5 @@ proc SQLErr*(henv: SqlHEnv, hdbc: SqlHDBC, hstmt: SqlHStmt, dynlib: odbclib, importc: "SQLError".} {.pop.} +when defined(nimHasStyleChecks): + {.pop.} diff --git a/lib/wrappers/openssl.nim b/lib/wrappers/openssl.nim index 3642f3628..03d6755c3 100644 --- a/lib/wrappers/openssl.nim +++ b/lib/wrappers/openssl.nim @@ -23,6 +23,8 @@ ## ./bin/nim c -d:ssl -p:. --dynlibOverride:ssl --passL:-lcrypto --passL:-lssl -r tests/untestable/tssl.nim {.deadCodeElim: on.} # dce option deprecated +when defined(nimHasStyleChecks): + {.push styleChecks: off.} const useWinVersion = defined(Windows) or defined(nimdoc) @@ -104,7 +106,7 @@ type PDES_cblock* = ptr DES_cblock des_ks_struct*{.final.} = object ks*: DES_cblock - weak_key*: cInt + weak_key*: cint 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, dynlib: DLLSSLName, importc.} 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_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, 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.} -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.} proc SSL_CTX_use_PrivateKey_file*(ctx: SslCtx, - filename: cstring, typ: cInt): cInt{.cdecl, dynlib: DLLSSLName, importc.} -proc SSL_CTX_check_private_key*(ctx: SslCtx): cInt{.cdecl, dynlib: DLLSSLName, + filename: cstring, typ: cint): cint{.cdecl, dynlib: DLLSSLName, importc.} +proc SSL_CTX_check_private_key*(ctx: SslCtx): 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_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_get_shutdown*(ssl: SslPtr): cint {.cdecl, dynlib: DLLSSLName, importc: "SSL_get_shutdown".} 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_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_accept*(ssl: SslPtr): cInt{.cdecl, dynlib: DLLSSLName, importc.} -proc SSL_pending*(ssl: SslPtr): 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_pending*(ssl: SslPtr): cint{.cdecl, dynlib: DLLSSLName, importc.} proc BIO_new_mem_buf*(data: pointer, len: cint): BIO{.cdecl, dynlib: DLLSSLName, importc.} @@ -404,19 +406,19 @@ proc BIO_do_connect*(bio: BIO): int = return BIO_do_handshake(bio) 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.} - 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.} -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_error_string*(e: cInt, buf: cstring): cstring{.cdecl, +proc ERR_error_string*(e: cint, buf: cstring): cstring{.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_get_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.} @@ -437,16 +439,16 @@ proc CRYPTO_malloc_init*() = when not useWinVersion and not defined(macosx) and not defined(android) and not defined(nimNoAllocForSSL): 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.} -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.} proc SSLCTXSetMode*(ctx: SslCtx, mode: int): int = 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.} 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. -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 ## in the callback set in `SSL_CTX_set_tlsext_servername_callback` to ## 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 bioFreeAll*(b: BIO){.cdecl, dynlib: DLLUtilName, importc: "BIO_free_all".} proc bioSMem*(): PBIO_METHOD{.cdecl, dynlib: DLLUtilName, importc: "BIO_s_mem".} -proc bioCtrlPending*(b: BIO): cInt{.cdecl, dynlib: DLLUtilName, importc: "BIO_ctrl_pending".} -proc bioRead*(b: BIO, Buf: cstring, length: cInt): cInt{.cdecl, +proc bioCtrlPending*(b: BIO): cint{.cdecl, dynlib: DLLUtilName, importc: "BIO_ctrl_pending".} +proc bioRead*(b: BIO, Buf: cstring, length: cint): cint{.cdecl, 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".} proc sslSetConnectState*(s: SslPtr) {.cdecl, @@ -508,11 +510,11 @@ proc sslSetConnectState*(s: SslPtr) {.cdecl, proc sslSetAcceptState*(s: SslPtr) {.cdecl, 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".} -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".} -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".} 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 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, dynlib: DLLSSLName, importc.} @@ -536,13 +538,13 @@ proc RSA_verify*(kind: cint, origMsg: pointer, origMsgLen: cuint, signature: poi when true: discard else: - proc SslCtxSetCipherList*(arg0: PSSL_CTX, str: cstring): cInt{.cdecl, + proc SslCtxSetCipherList*(arg0: PSSL_CTX, str: cstring): cint{.cdecl, dynlib: DLLSSLName, importc.} proc SslCtxNew*(meth: PSSL_METHOD): PSSL_CTX{.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 SslSetFd*(s: PSSL, fd: cint): cint{.cdecl, dynlib: DLLSSLName, importc.} + proc SslCTXCtrl*(ctx: PSSL_CTX, cmd: cint, larg: int, parg: Pointer): int{. cdecl, dynlib: DLLSSLName, importc.} proc SSLSetMode*(s: PSSL, mode: int): int @@ -552,84 +554,84 @@ else: proc SslMethodV3*(): PSSL_METHOD{.cdecl, dynlib: DLLSSLName, importc.} proc SslMethodTLSV1*(): 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.} - proc SslCtxUsePrivateKeyASN1*(pk: cInt, ctx: PSSL_CTX, - d: cstring, length: int): cInt{.cdecl, dynlib: DLLSSLName, importc.} + proc SslCtxUsePrivateKeyASN1*(pk: cint, ctx: PSSL_CTX, + 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.} - proc SslCtxUseCertificateASN1*(ctx: PSSL_CTX, length: int, d: cstring): cInt{. + proc SslCtxUseCertificateASN1*(ctx: PSSL_CTX, length: int, d: cstring): cint{. cdecl, dynlib: DLLSSLName, importc.} - # function SslCtxUseCertificateChainFile(ctx: PSSL_CTX; const filename: PChar):cInt; - proc SslCtxUseCertificateChainFile*(ctx: PSSL_CTX, filename: cstring): cInt{. + # function SslCtxUseCertificateChainFile(ctx: PSSL_CTX; const filename: PChar):cint; + proc SslCtxUseCertificateChainFile*(ctx: PSSL_CTX, filename: cstring): cint{. cdecl, dynlib: DLLSSLName, importc.} proc SslCtxSetDefaultPasswdCb*(ctx: PSSL_CTX, cb: PPasswdCb){.cdecl, dynlib: DLLSSLName, importc.} proc SslCtxSetDefaultPasswdCbUserdata*(ctx: PSSL_CTX, u: SslPtr){.cdecl, dynlib: DLLSSLName, importc.} - # function SslCtxLoadVerifyLocations(ctx: PSSL_CTX; const CAfile: PChar; const CApath: PChar):cInt; - proc SslCtxLoadVerifyLocations*(ctx: PSSL_CTX, CAfile: cstring, CApath: cstring): cInt{. + # function SslCtxLoadVerifyLocations(ctx: PSSL_CTX; const CAfile: PChar; const CApath: PChar):cint; + proc SslCtxLoadVerifyLocations*(ctx: PSSL_CTX, CAfile: cstring, CApath: cstring): cint{. 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 SslGetPeerCertificate*(ssl: PSSL): PX509{.cdecl, dynlib: DLLSSLName, importc.} - proc SslCtxSetVerify*(ctx: PSSL_CTX, mode: cInt, arg2: PFunction){.cdecl, + proc SslCtxSetVerify*(ctx: PSSL_CTX, mode: cint, arg2: PFunction){.cdecl, dynlib: DLLSSLName, importc.} proc SSLGetCurrentCipher*(s: PSSL): SslPtr{.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.} proc SSLGetVerifyResult*(ssl: PSSL): int{.cdecl, dynlib: DLLSSLName, importc.} # libeay.dll proc X509New*(): 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.} proc X509GetSubjectName*(a: PX509): PX509_NAME{.cdecl, dynlib: DLLUtilName, importc.} proc X509GetIssuerName*(a: PX509): PX509_NAME{.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; - proc X509Digest*(data: PX509, typ: PEVP_MD, md: cstring, length: var cInt): 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{. 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 X509print*(b: PBIO, a: PX509): cint{.cdecl, dynlib: DLLUtilName, importc.} + proc X509SetVersion*(x: PX509, version: cint): cint{.cdecl, dynlib: DLLUtilName, importc.} - proc X509SetPubkey*(x: PX509, pkey: EVP_PKEY): cInt{.cdecl, dynlib: DLLUtilName, + proc X509SetPubkey*(x: PX509, pkey: EVP_PKEY): cint{.cdecl, dynlib: DLLUtilName, importc.} - proc X509SetIssuerName*(x: PX509, name: PX509_NAME): cInt{.cdecl, + proc X509SetIssuerName*(x: PX509, name: PX509_NAME): cint{.cdecl, dynlib: DLLUtilName, importc.} - proc X509NameAddEntryByTxt*(name: PX509_NAME, field: cstring, typ: cInt, - bytes: cstring, length, loc, theSet: cInt): cInt{. + proc X509NameAddEntryByTxt*(name: PX509_NAME, field: cstring, typ: cint, + bytes: cstring, length, loc, theSet: cint): cint{. 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.} - proc X509GmtimeAdj*(s: PASN1_UTCTIME, adj: cInt): PASN1_UTCTIME{.cdecl, + proc X509GmtimeAdj*(s: PASN1_UTCTIME, adj: cint): PASN1_UTCTIME{.cdecl, dynlib: DLLUtilName, importc.} - proc X509SetNotBefore*(x: PX509, tm: PASN1_UTCTIME): cInt{.cdecl, + proc X509SetNotBefore*(x: PX509, tm: PASN1_UTCTIME): cint{.cdecl, dynlib: DLLUtilName, importc.} - proc X509SetNotAfter*(x: PX509, tm: PASN1_UTCTIME): cInt{.cdecl, + proc X509SetNotAfter*(x: PX509, tm: PASN1_UTCTIME): cint{.cdecl, dynlib: DLLUtilName, importc.} proc X509GetSerialNumber*(x: PX509): PASN1_cInt{.cdecl, dynlib: DLLUtilName, importc.} proc EvpPkeyNew*(): 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.} proc EvpGetDigestByName*(Name: cstring): PEVP_MD{.cdecl, dynlib: DLLUtilName, importc.} proc EVPcleanup*(){.cdecl, dynlib: DLLUtilName, importc.} - # function ErrErrorString(e: cInt; buf: PChar): PChar; - proc SSLeayversion*(t: cInt): cstring{.cdecl, dynlib: DLLUtilName, importc.} + # function ErrErrorString(e: cint; buf: PChar): PChar; + proc SSLeayversion*(t: cint): cstring{.cdecl, dynlib: DLLUtilName, importc.} proc OPENSSLaddallalgorithms*(){.cdecl, dynlib: DLLUtilName, importc.} @@ -642,21 +644,21 @@ else: dynlib: DLLUtilName, importc, cdecl.} 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.} proc Asn1UtctimeNew*(): 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.} - proc i2dX509bio*(b: PBIO, x: PX509): cInt{.cdecl, dynlib: DLLUtilName, importc.} - proc i2dPrivateKeyBio*(b: PBIO, pkey: EVP_PKEY): cInt{.cdecl, + proc i2dX509bio*(b: PBIO, x: PX509): cint{.cdecl, dynlib: DLLUtilName, importc.} + proc i2dPrivateKeyBio*(b: PBIO, pkey: EVP_PKEY): cint{.cdecl, dynlib: DLLUtilName, importc.} # 3DES functions 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.} 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 proc SSLSetMode(s: PSSL, mode: int): int = @@ -708,11 +710,11 @@ proc md5_File*(file: string): string {.raises: [IOError,Exception].} = buf: array[sz,char] ctx: MD5_CTX - discard md5_init(ctx) + discard md5_Init(ctx) 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 result = hexStr(addr buf) @@ -724,13 +726,16 @@ proc md5_Str*(str: string): string = ctx: MD5_CTX res: array[MD5_DIGEST_LENGTH,char] input = str.cstring - discard md5_init(ctx) + discard md5_Init(ctx) var i = 0 while i < str.len: 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 - discard md5_final(addr res, ctx) + discard md5_Final(addr res, ctx) result = hexStr(addr res) + +when defined(nimHasStyleChecks): + {.pop.} diff --git a/lib/wrappers/postgres.nim b/lib/wrappers/postgres.nim index ff0b0cb51..a9fa0b8f3 100644 --- a/lib/wrappers/postgres.nim +++ b/lib/wrappers/postgres.nim @@ -16,6 +16,8 @@ # {.deadCodeElim: on.} # dce option deprecated +when defined(nimHasStyleChecks): + {.push styleChecks: off.} when defined(windows): const @@ -114,7 +116,7 @@ type PPGVerbosity* = ptr PGVerbosity PGVerbosity* = enum PQERRORS_TERSE, PQERRORS_DEFAULT, PQERRORS_VERBOSE - PpgNotify* = ptr pgNotify + PPGNotify* = ptr pgNotify pgNotify*{.pure, final.} = object relname*: cstring be_pid*: int32 @@ -124,7 +126,7 @@ type PQnoticeProcessor* = proc (arg: pointer, message: cstring){.cdecl.} Ppqbool* = ptr pqbool pqbool* = char - P_PQprintOpt* = ptr PQprintOpt + PPQprintOpt* = ptr PQprintOpt PQprintOpt*{.pure, final.} = object header*: pqbool align*: pqbool @@ -137,7 +139,7 @@ type caption*: cstring fieldName*: ptr cstring - P_PQconninfoOption* = ptr PQconninfoOption + PPQconninfoOption* = ptr PQconninfoOption PQconninfoOption*{.pure, final.} = object keyword*: cstring envvar*: cstring @@ -164,7 +166,7 @@ proc pqconnectdb*(conninfo: cstring): PPGconn{.cdecl, dynlib: dllName, proc pqsetdbLogin*(pghost: cstring, pgport: cstring, pgoptions: cstring, pgtty: cstring, dbName: cstring, login: cstring, pwd: cstring): PPGconn{. 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 pqconndefaults*(): PPQconninfoOption{.cdecl, dynlib: dllName, importc: "PQconndefaults".} @@ -247,7 +249,7 @@ proc pqisBusy*(conn: PPGconn): int32{.cdecl, dynlib: dllName, importc: "PQisBusy".} proc pqconsumeInput*(conn: PPGconn): int32{.cdecl, dynlib: dllName, importc: "PQconsumeInput".} -proc pqnotifies*(conn: PPGconn): PPGnotify{.cdecl, dynlib: dllName, +proc pqnotifies*(conn: PPGconn): PPGNotify{.cdecl, dynlib: dllName, importc: "PQnotifies".} proc pqputCopyData*(conn: PPGconn, buffer: cstring, nbytes: int32): int32{. 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, importc: "PQmblen".} proc pqenv2encoding*(): int32{.cdecl, dynlib: dllName, importc: "PQenv2encoding".} -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, "", "") +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, "", "") + +when defined(nimHasStyleChecks): + {.pop.} diff --git a/lib/wrappers/sqlite3.nim b/lib/wrappers/sqlite3.nim index e4bf2e67b..b48fa307a 100644 --- a/lib/wrappers/sqlite3.nim +++ b/lib/wrappers/sqlite3.nim @@ -8,6 +8,10 @@ # {.deadCodeElim: on.} # dce option deprecated + +when defined(nimHasStyleChecks): + {.push styleChecks: off.} + when defined(windows): when defined(nimOldDlls): 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_global_recover:longint;cdecl; external Sqlite3Lib name 'sqlite3_global_recover'; # implementation + +when defined(nimHasStyleChecks): + {.pop.} diff --git a/lib/wrappers/tinyc.nim b/lib/wrappers/tinyc.nim index f29758f13..8d2ba3802 100644 --- a/lib/wrappers/tinyc.nim +++ b/lib/wrappers/tinyc.nim @@ -66,7 +66,7 @@ const OutputObj*: cint = 4 ## object file 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".} ## 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".} ## equivalent to -Lpath option -proc addLibrary*(s: PCCState, libraryname: cstring): cint {.cdecl, +proc addLibrary*(s: PccState, libraryname: cstring): cint {.cdecl, importc: "tcc_add_library".} ## 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, importc: "tcc_set_lib_path".} ## set CONFIG_TCCDIR at runtime - - diff --git a/nimpretty/nimpretty.nim b/nimpretty/nimpretty.nim index 6b8ddcfc6..ca40ccdb5 100644 --- a/nimpretty/nimpretty.nim +++ b/nimpretty/nimpretty.nim @@ -70,7 +70,7 @@ proc main = case kind of cmdArgument: infile = key.addFileExt(".nim") - of cmdLongoption, cmdShortOption: + of cmdLongOption, cmdShortOption: case normalize(key) of "help", "h": writeHelp() of "version", "v": writeVersion() diff --git a/nimsuggest/nimsuggest.nim b/nimsuggest/nimsuggest.nim index 299f68352..1a60c3fb6 100644 --- a/nimsuggest/nimsuggest.nim +++ b/nimsuggest/nimsuggest.nim @@ -274,7 +274,7 @@ template setVerbosity(level: typed) = conf.notes = NotesVerbosity[gVerbosity] proc connectToNextFreePort(server: Socket, host: string): Port = - server.bindaddr(Port(0), host) + server.bindAddr(Port(0), host) let (_, port) = server.getLocalAddr result = port @@ -342,9 +342,9 @@ proc argsToStr(x: SexpNode): string = result.add ';' result.add dirty.escape result.add ':' - result.add line + result.addInt line result.add ':' - result.add col + result.addInt col proc replEpc(x: ThreadParams) {.thread.} = var server = newSocket() @@ -393,7 +393,7 @@ proc replEpc(x: ThreadParams) {.thread.} = of "return", "return-error": "no return expected" else: - "unexpected call: " & epcAPI + "unexpected call: " & epcApi quit errMessage proc execCmd(cmd: string; graph: ModuleGraph; cachedMsgs: CachedMsgs) = @@ -464,7 +464,7 @@ proc recompileFullProject(graph: ModuleGraph) = resetSystemArtifacts(graph) graph.vm = nil graph.resetAllModules() - GC_fullcollect() + GC_fullCollect() compileProject(graph) #echo GC_getStatistics() @@ -553,10 +553,10 @@ proc processCmdLine*(pass: TCmdLinePass, cmd: string; conf: ConfigRef) = parseopt.next(p) case p.kind of cmdEnd: break - of cmdLongoption, cmdShortOption: + of cmdLongOption, cmdShortOption: case p.key.normalize of "help", "h": - stdout.writeline(Usage) + stdout.writeLine(Usage) quit() of "autobind": gMode = mtcp @@ -614,7 +614,7 @@ proc handleCmdLine(cache: IdentCache; conf: ConfigRef) = self.initDefinesProg(conf, "nimsuggest") if paramCount() == 0: - stdout.writeline(Usage) + stdout.writeLine(Usage) return self.processCmdLineAndProjectPath(conf) @@ -636,7 +636,7 @@ proc handleCmdLine(cache: IdentCache; conf: ConfigRef) = discard self.loadConfigsAndRunMainCommand(cache, conf) when isMainModule: - handleCmdline(newIdentCache(), newConfigRef()) + handleCmdLine(newIdentCache(), newConfigRef()) else: export Suggest export IdeCmd diff --git a/nimsuggest/sexp.nim b/nimsuggest/sexp.nim index 4fa93a6ee..0f64df4ed 100644 --- a/nimsuggest/sexp.nim +++ b/nimsuggest/sexp.nim @@ -398,7 +398,7 @@ proc sexp*(elements: openArray[SexpNode]): SexpNode = proc sexp*(s: SexpNode): SexpNode = result = s -proc toSexp(x: NimNode): NimNode {.compiletime.} = +proc toSexp(x: NimNode): NimNode {.compileTime.} = case x.kind of nnkBracket: result = newNimNode(nnkBracket) |