summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/system.nim')
-rwxr-xr-xlib/system.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/system.nim b/lib/system.nim
index a83812ed0..b34adf62a 100755
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -981,6 +981,9 @@ when not defined(NimrodVM):
   proc getCurrentExceptionMsg*(): string {.exportc.}
     ## retrieves the error message that was attached to the current
     ## exception; if there is none, "" is returned.
+  
+  proc getCurrentException*(): ref E_Base
+    ## retrieves the current exception; if there is none, nil is returned.
 
 # new constants:
 const
@@ -1390,6 +1393,13 @@ when not defined(EcmaScript) and not defined(NimrodVM):
     ##
     ## Default mode is readonly. Returns true iff the file could be opened.
 
+  proc reopen*(f: TFile, filename: string, mode: TFileMode = fmRead): bool
+    ## reopens the file `f` with given `filename` and `mode`. This 
+    ## is often used to redirect the `stdin`, `stdout` or `stderr`
+    ## file variables.
+    ##
+    ## Default mode is readonly. Returns true iff the file could be reopened.
+
   proc CloseFile*(f: TFile) {.importc: "fclose", nodecl, deprecated.}
     ## Closes the file.
     ## **Deprecated since version 0.8.0**: Use `close` instead.
@@ -1554,6 +1564,7 @@ when not defined(EcmaScript) and not defined(NimrodVM):
     else:
       result = n.sons[n.len]
 
+  include "system/systhread"
   include "system/mm"
   include "system/sysstr"
   include "system/assign"
@@ -1564,6 +1575,10 @@ when not defined(EcmaScript) and not defined(NimrodVM):
     if excHandler == nil: return ""
     return $excHandler.exc.msg
 
+  proc getCurrentException(): ref E_Base = 
+    if excHandler != nil: 
+      result = excHandler.exc
+
   {.push stack_trace: off.}
   when defined(endb):
     include "system/debugger"