diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/impure/nre.nim | 2 | ||||
-rw-r--r-- | lib/impure/re.nim | 7 | ||||
-rw-r--r-- | lib/pure/os.nim | 9 | ||||
-rw-r--r-- | lib/system/embedded.nim | 3 | ||||
-rw-r--r-- | lib/system/excpt.nim | 11 | ||||
-rw-r--r-- | lib/wrappers/pcre.nim | 2 |
6 files changed, 22 insertions, 12 deletions
diff --git a/lib/impure/nre.nim b/lib/impure/nre.nim index 823cae1a3..5c5125ba1 100644 --- a/lib/impure/nre.nim +++ b/lib/impure/nre.nim @@ -442,7 +442,7 @@ proc extractOptions(pattern: string): tuple[pattern: string, flags: int, study: # }}} proc destroyRegex(pattern: Regex) = - pcre.free(pattern.pcreObj) + pcre.free_substring(cast[cstring](pattern.pcreObj)) pattern.pcreObj = nil if pattern.pcreExtra != nil: pcre.free_study(pattern.pcreExtra) diff --git a/lib/impure/re.nim b/lib/impure/re.nim index 6f57185e6..4f32cd5fb 100644 --- a/lib/impure/re.nim +++ b/lib/impure/re.nim @@ -60,9 +60,12 @@ proc rawCompile(pattern: string, flags: cint): ptr Pcre = raiseInvalidRegex($msg & "\n" & pattern & "\n" & spaces(offset) & "^\n") proc finalizeRegEx(x: Regex) = - pcre.free(x.h) + # XXX This is a hack, but PCRE does not export its "free" function properly. + # Sigh. The hack relies on PCRE's implementation (see ``pcre_get.c``). + # Fortunately the implementation is unlikely to change. + pcre.free_substring(cast[cstring](x.h)) if not isNil(x.e): - pcre.free_study(x.e) + pcre.free_substring(cast[cstring](x.e)) proc re*(s: string, flags = {reStudy}): Regex = ## Constructor of regular expressions. diff --git a/lib/pure/os.nim b/lib/pure/os.nim index fa32c10c4..b0b17260e 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -35,6 +35,7 @@ ## `execShellCmd proc <#execShellCmd,string>`_ ## * `parseopt module <parseopt.html>`_ for command-line parser beyond ## `parseCmdLine proc <#parseCmdLine,string>`_ +## * `uri module <uri.html>`_ ## * `distros module <distros.html>`_ ## * `dynlib module <dynlib.html>`_ ## * `streams module <streams.html>`_ @@ -115,13 +116,15 @@ proc joinPath*(head, tail: string): string {. ## ## If `head` is the empty string, `tail` is returned. If `tail` is the empty ## string, `head` is returned with a trailing path separator. If `tail` starts - ## with a path separator it will be removed when concatenated to `head`. Other - ## path separators not located on boundaries won't be modified. + ## with a path separator it will be removed when concatenated to `head`. + ## Path separators will be normalized. ## ## See also: ## * `joinPath(varargs) proc <#joinPath,varargs[string]>`_ ## * `/ proc <#/,string,string>`_ ## * `splitPath proc <#splitPath,string>`_ + ## * `uri.combine proc <uri.html#combine,Uri,Uri>`_ + ## * `uri./ proc <uri.html#/,Uri,string>`_ runnableExamples: when defined(posix): assert joinPath("usr", "lib") == "usr/lib" @@ -186,6 +189,8 @@ proc `/`*(head, tail: string): string {.noSideEffect.} = ## * `joinPath(head, tail) proc <#joinPath,string,string>`_ ## * `joinPath(varargs) proc <#joinPath,varargs[string]>`_ ## * `splitPath proc <#splitPath,string>`_ + ## * `uri.combine proc <uri.html#combine,Uri,Uri>`_ + ## * `uri./ proc <uri.html#/,Uri,string>`_ runnableExamples: when defined(posix): assert "usr" / "" == "usr/" diff --git a/lib/system/embedded.nim b/lib/system/embedded.nim index fb89e7f0f..d1e05dad5 100644 --- a/lib/system/embedded.nim +++ b/lib/system/embedded.nim @@ -29,8 +29,7 @@ const nativeStackTraceSupported = false hasSomeStackTrace = false -proc quitOrDebug() {.inline.} = - quit(1) +proc quitOrDebug() {.noreturn, importc: "abort", header: "<stdlib.h>", nodecl.} proc raiseException(e: ref Exception, ename: cstring) {.compilerRtl.} = sysFatal(ReraiseError, "exception handling is not available") diff --git a/lib/system/excpt.nim b/lib/system/excpt.nim index 8849caee5..75a0e8967 100644 --- a/lib/system/excpt.nim +++ b/lib/system/excpt.nim @@ -38,10 +38,15 @@ proc showErrorMessage(data: cstring) {.gcsafe.} = writeToStdErr(data) proc quitOrDebug() {.inline.} = - when not defined(endb): - quit(1) - else: + when defined(endb): endbStep() # call the debugger + elif not defined(nodejs) and not defined(nimscript): + when nimvm: + quit(1) + else: + c_abort() + else: + quit(1) proc chckIndx(i, a, b: int): int {.inline, compilerproc, benign.} proc chckRange(i, a, b: int): int {.inline, compilerproc, benign.} diff --git a/lib/wrappers/pcre.nim b/lib/wrappers/pcre.nim index b7975abb8..c4bb24cfd 100644 --- a/lib/wrappers/pcre.nim +++ b/lib/wrappers/pcre.nim @@ -341,8 +341,6 @@ proc compile2*(pattern: cstring, erroffset: ptr cint, tableptr: pointer): ptr Pcre -proc free*(p: ptr Pcre) - proc config*(what: cint, where: pointer): cint |