diff options
author | flywind <xzsflywind@gmail.com> | 2021-03-07 19:08:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-07 12:08:41 +0100 |
commit | 0e3ea1655441036aa13d95ca1c47d9d27e0dff62 (patch) | |
tree | fd565b78e6da93d5965ce9ed89276e5843a70607 /lib | |
parent | b8c04bdb929f72ed8214122b255e88db9e713774 (diff) | |
download | Nim-0e3ea1655441036aa13d95ca1c47d9d27e0dff62.tar.gz |
use lowercase --define switches (#17283)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/posix/posix.nim | 2 | ||||
-rw-r--r-- | lib/pure/fenv.nim | 2 | ||||
-rw-r--r-- | lib/pure/includes/oserr.nim | 2 | ||||
-rw-r--r-- | lib/pure/math.nim | 2 | ||||
-rw-r--r-- | lib/pure/nativesockets.nim | 4 | ||||
-rw-r--r-- | lib/pure/net.nim | 2 | ||||
-rw-r--r-- | lib/pure/os.nim | 34 | ||||
-rw-r--r-- | lib/pure/osproc.nim | 2 | ||||
-rw-r--r-- | lib/system/arithm.nim | 2 | ||||
-rw-r--r-- | lib/system/io.nim | 6 | ||||
-rw-r--r-- | lib/system/syslocks.nim | 2 | ||||
-rw-r--r-- | lib/wrappers/mysql.nim | 4 | ||||
-rw-r--r-- | lib/wrappers/openssl.nim | 2 |
13 files changed, 33 insertions, 33 deletions
diff --git a/lib/posix/posix.nim b/lib/posix/posix.nim index d66597073..af3b7ea23 100644 --- a/lib/posix/posix.nim +++ b/lib/posix/posix.nim @@ -189,7 +189,7 @@ proc posix_fadvise*(a1: cint, a2, a3: Off, a4: cint): cint {. proc posix_fallocate*(a1: cint, a2, a3: Off): cint {. importc, header: "<fcntl.h>".} -when not defined(haiku) and not defined(OpenBSD): +when not defined(haiku) and not defined(openbsd): proc fmtmsg*(a1: int, a2: cstring, a3: cint, a4, a5, a6: cstring): cint {.importc, header: "<fmtmsg.h>".} diff --git a/lib/pure/fenv.nim b/lib/pure/fenv.nim index 57fb40449..ddb6a1a0c 100644 --- a/lib/pure/fenv.nim +++ b/lib/pure/fenv.nim @@ -12,7 +12,7 @@ ## The types, vars and procs are bindings for the C standard library ## [<fenv.h>](https://en.cppreference.com/w/c/numeric/fenv) header. -when defined(Posix) and not defined(genode): +when defined(posix) and not defined(genode): {.passl: "-lm".} var diff --git a/lib/pure/includes/oserr.nim b/lib/pure/includes/oserr.nim index 8938d7f73..94891ccba 100644 --- a/lib/pure/includes/oserr.nim +++ b/lib/pure/includes/oserr.nim @@ -39,7 +39,7 @@ proc osErrorMsg*(errorCode: OSErrorCode): string = result = "" when defined(nimscript): discard - elif defined(Windows): + elif defined(windows): if errorCode != OSErrorCode(0'i32): when useWinUnicode: var msgbuf: WideCString diff --git a/lib/pure/math.nim b/lib/pure/math.nim index 4a13eefcb..74a98e655 100644 --- a/lib/pure/math.nim +++ b/lib/pure/math.nim @@ -122,7 +122,7 @@ func fac*(n: int): int = {.push checks: off, line_dir: off, stack_trace: off.} -when defined(Posix) and not defined(genode): +when defined(posix) and not defined(genode): {.passl: "-lm".} const diff --git a/lib/pure/nativesockets.nim b/lib/pure/nativesockets.nim index fe890e721..833294239 100644 --- a/lib/pure/nativesockets.nim +++ b/lib/pure/nativesockets.nim @@ -19,7 +19,7 @@ import std/private/since when hostOS == "solaris": {.passl: "-lsocket -lnsl".} -const useWinVersion = defined(Windows) or defined(nimdoc) +const useWinVersion = defined(windows) or defined(nimdoc) when useWinVersion: import winlean @@ -748,6 +748,6 @@ proc accept*(fd: SocketHandle, inheritable = defined(nimInheritHandles)): (Socke else: return (sock, $inet_ntoa(sockAddress.sin_addr)) -when defined(Windows): +when defined(windows): var wsa: WSAData if wsaStartup(0x0101'i16, addr wsa) != 0: raiseOSError(osLastError()) diff --git a/lib/pure/net.nim b/lib/pure/net.nim index 0519fcede..a7025bd97 100644 --- a/lib/pure/net.nim +++ b/lib/pure/net.nim @@ -92,7 +92,7 @@ import ssl_config export nativesockets.Port, nativesockets.`$`, nativesockets.`==` export Domain, SockType, Protocol -const useWinVersion = defined(Windows) or defined(nimdoc) +const useWinVersion = defined(windows) or defined(nimdoc) const defineSsl = defined(ssl) or defined(nimdoc) when useWinVersion: diff --git a/lib/pure/os.nim b/lib/pure/os.nim index ad0d9949b..b900546a0 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -1408,7 +1408,7 @@ proc setCurrentDir*(newDir: string) {.inline, tags: [], noWeirdTarget.} = ## * `getConfigDir proc <#getConfigDir>`_ ## * `getTempDir proc <#getTempDir>`_ ## * `getCurrentDir proc <#getCurrentDir>`_ - when defined(Windows): + when defined(windows): when useWinUnicode: if setCurrentDirectoryW(newWideCString(newDir)) == 0'i32: raiseOSError(osLastError(), newDir) @@ -1512,7 +1512,7 @@ proc normalizedPath*(path: string): string {.rtl, extern: "nos$1", tags: [].} = assert normalizedPath("a///b//..//c///d") == "a/c/d" result = pathnorm.normalizePath(path) -when defined(Windows) and not weirdTarget: +when defined(windows) and not weirdTarget: proc openHandle(path: string, followSymlink=true, writeAccess=false): Handle = var flags = FILE_FLAG_BACKUP_SEMANTICS or FILE_ATTRIBUTE_NORMAL if not followSymlink: @@ -1545,7 +1545,7 @@ proc sameFile*(path1, path2: string): bool {.rtl, extern: "nos$1", ## ## See also: ## * `sameFileContent proc <#sameFileContent,string,string>`_ - when defined(Windows): + when defined(windows): var success = true var f1 = openHandle(path1) var f2 = openHandle(path2) @@ -1700,7 +1700,7 @@ proc createSymlink*(src, dest: string) {.noWeirdTarget.} = ## * `createHardlink proc <#createHardlink,string,string>`_ ## * `expandSymlink proc <#expandSymlink,string>`_ - when defined(Windows): + when defined(windows): const SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE = 2 # allows anyone with developer mode on to create a link let flag = dirExists(src).int32 or SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE @@ -1802,7 +1802,7 @@ proc copyFile*(source, dest: string, options = {cfSymlinkFollow}) {.rtl, let isSymlink = source.symlinkExists if isSymlink and (cfSymlinkIgnore in options or defined(windows)): return - when defined(Windows): + when defined(windows): when useWinUnicode: let s = newWideCString(source) let d = newWideCString(dest) @@ -1866,7 +1866,7 @@ proc copyFileToDir*(source, dir: string, options = {cfSymlinkFollow}) raise newException(ValueError, "dest is empty") copyFile(source, dir / source.lastPathPart, options) -when not declared(ENOENT) and not defined(Windows): +when not declared(ENOENT) and not defined(windows): when NoFakeVars: when not defined(haiku): const ENOENT = cint(2) # 2 on most systems including Solaris @@ -1875,7 +1875,7 @@ when not declared(ENOENT) and not defined(Windows): else: var ENOENT {.importc, header: "<errno.h>".}: cint -when defined(Windows) and not weirdTarget: +when defined(windows) and not weirdTarget: when useWinUnicode: template deleteFile(file: untyped): untyped = deleteFileW(file) template setFileAttributes(file, attrs: untyped): untyped = @@ -1899,7 +1899,7 @@ proc tryRemoveFile*(file: string): bool {.rtl, extern: "nos$1", tags: [WriteDirE ## * `removeFile proc <#removeFile,string>`_ ## * `moveFile proc <#moveFile,string,string>`_ result = true - when defined(Windows): + when defined(windows): when useWinUnicode: let f = newWideCString(file) else: @@ -1940,7 +1940,7 @@ proc tryMoveFSObject(source, dest: string): bool {.noWeirdTarget.} = ## Returns false in case of `EXDEV` error. ## In case of other errors `OSError` is raised. ## Returns true in case of success. - when defined(Windows): + when defined(windows): when useWinUnicode: let s = newWideCString(source) let d = newWideCString(dest) @@ -2559,7 +2559,7 @@ proc createHardlink*(src, dest: string) {.noWeirdTarget.} = ## ## See also: ## * `createSymlink proc <#createSymlink,string,string>`_ - when defined(Windows): + when defined(windows): when useWinUnicode: var wSrc = newWideCString(src) var wDst = newWideCString(dest) @@ -2604,7 +2604,7 @@ proc copyFileWithPermissions*(source, dest: string, ## * `moveFile proc <#moveFile,string,string>`_ ## * `copyDirWithPermissions proc <#copyDirWithPermissions,string,string>`_ copyFile(source, dest, options) - when not defined(Windows): + when not defined(windows): try: setFilePermissions(dest, getFilePermissions(source), followSymlinks = (cfSymlinkFollow in options)) @@ -2644,7 +2644,7 @@ proc copyDirWithPermissions*(source, dest: string, ## * `existsOrCreateDir proc <#existsOrCreateDir,string>`_ ## * `createDir proc <#createDir,string>`_ createDir(dest) - when not defined(Windows): + when not defined(windows): try: setFilePermissions(dest, getFilePermissions(source), followSymlinks = false) @@ -3178,7 +3178,7 @@ proc getFileSize*(file: string): BiggestInt {.rtl, extern: "nos$1", close(f) else: raiseOSError(osLastError(), file) -when defined(Windows) or weirdTarget: +when defined(windows) or weirdTarget: type DeviceId* = int32 FileId* = int64 @@ -3210,7 +3210,7 @@ template rawToFormalFileInfo(rawInfo, path, formalInfo): untyped = ## Transforms the native file info structure into the one nim uses. ## 'rawInfo' is either a 'BY_HANDLE_FILE_INFORMATION' structure on Windows, ## or a 'Stat' structure on posix - when defined(Windows): + when defined(windows): template merge(a, b): untyped = a or (b shl 32) formalInfo.id.device = rawInfo.dwVolumeSerialNumber formalInfo.id.file = merge(rawInfo.nFileIndexLow, rawInfo.nFileIndexHigh) @@ -3288,7 +3288,7 @@ proc getFileInfo*(handle: FileHandle): FileInfo {.noWeirdTarget.} = ## * `getFileInfo(path) proc <#getFileInfo,string>`_ # Done: ID, Kind, Size, Permissions, Link Count - when defined(Windows): + when defined(windows): var rawInfo: BY_HANDLE_FILE_INFORMATION # We have to use the super special '_get_osfhandle' call (wrapped above) # To transform the C file descriptor to a native file handle. @@ -3330,7 +3330,7 @@ proc getFileInfo*(path: string, followSymlink = true): FileInfo {.noWeirdTarget. ## See also: ## * `getFileInfo(handle) proc <#getFileInfo,FileHandle>`_ ## * `getFileInfo(file) proc <#getFileInfo,File>`_ - when defined(Windows): + when defined(windows): var handle = openHandle(path, followSymlink) rawInfo: BY_HANDLE_FILE_INFORMATION @@ -3402,7 +3402,7 @@ proc isHidden*(path: string): bool {.noWeirdTarget.} = assert not "".isHidden assert ".foo/".isHidden - when defined(Windows): + when defined(windows): when useWinUnicode: wrapUnary(attributes, getFileAttributesW, path) else: diff --git a/lib/pure/osproc.nim b/lib/pure/osproc.nim index a4d8409d7..d730e597b 100644 --- a/lib/pure/osproc.nim +++ b/lib/pure/osproc.nim @@ -522,7 +522,7 @@ when not defined(useNimRtl): template streamAccess(p) = assert poParentStreams notin p.options, "API usage error: stream access not allowed when you use poParentStreams" -when defined(Windows) and not defined(useNimRtl): +when defined(windows) and not defined(useNimRtl): # We need to implement a handle stream for Windows: type FileHandleStream = ref object of StreamObj diff --git a/lib/system/arithm.nim b/lib/system/arithm.nim index 64caddce8..158f40177 100644 --- a/lib/system/arithm.nim +++ b/lib/system/arithm.nim @@ -155,7 +155,7 @@ proc absInt(a: int): int {.compilerproc, inline.} = raiseOverflow() const - asmVersion = defined(I386) and (defined(vcc) or defined(wcc) or + asmVersion = defined(i386) and (defined(vcc) or defined(wcc) or defined(dmc) or defined(gcc) or defined(llvm_gcc)) # my Version of Borland C++Builder does not have # tasm32, which is needed for assembler blocks diff --git a/lib/system/io.nim b/lib/system/io.nim index 31768eb38..300e7ea3f 100644 --- a/lib/system/io.nim +++ b/lib/system/io.nim @@ -143,13 +143,13 @@ proc raiseEOF() {.noinline, noreturn.} = proc strerror(errnum: cint): cstring {.importc, header: "<string.h>".} -when not defined(NimScript): +when not defined(nimscript): var errno {.importc, header: "<errno.h>".}: cint ## error variable EINTR {.importc: "EINTR", header: "<errno.h>".}: cint proc checkErr(f: File) = - when not defined(NimScript): + when not defined(nimscript): if c_ferror(f) != 0: let msg = "errno: " & $errno & " `" & $strerror(errno) & "`" c_clearerr(f) @@ -452,7 +452,7 @@ proc readLine*(f: File, line: var string): bool {.tags: [ReadIOEffect], # likely other io procs need this for correctness. fgetsSuccess = c_fgets(addr line[pos], sp.cint, f) != nil if fgetsSuccess: break - when not defined(NimScript): + when not defined(nimscript): if errno == EINTR: errno = 0 c_clearerr(f) diff --git a/lib/system/syslocks.nim b/lib/system/syslocks.nim index 07fb9cb8a..51dbfd3a2 100644 --- a/lib/system/syslocks.nim +++ b/lib/system/syslocks.nim @@ -11,7 +11,7 @@ {.push stackTrace: off.} -when defined(Windows): +when defined(windows): type Handle = int diff --git a/lib/wrappers/mysql.nim b/lib/wrappers/mysql.nim index 209f63c21..2fefe4a8b 100644 --- a/lib/wrappers/mysql.nim +++ b/lib/wrappers/mysql.nim @@ -11,14 +11,14 @@ when defined(nimHasStyleChecks): {.push styleChecks: off.} -when defined(Unix): +when defined(unix): when defined(macosx): const lib = "(libmysqlclient|libmariadbclient)(|.20|.19|.18|.17|.16|.15).dylib" else: const lib = "(libmysqlclient|libmariadbclient).so(|.20|.19|.18|.17|.16|.15)" -when defined(Windows): +when defined(windows): const lib = "(libmysql.dll|libmariadb.dll)" type diff --git a/lib/wrappers/openssl.nim b/lib/wrappers/openssl.nim index 3c9c92b0d..313ce7d19 100644 --- a/lib/wrappers/openssl.nim +++ b/lib/wrappers/openssl.nim @@ -25,7 +25,7 @@ when defined(nimHasStyleChecks): {.push styleChecks: off.} -const useWinVersion = defined(Windows) or defined(nimdoc) +const useWinVersion = defined(windows) or defined(nimdoc) # To force openSSL version use -d:sslVersion=1.0.0 # See: #10281, #10230 |