the big renamefest: first steps

This commit is contained in:
Araq
2014-08-22 23:54:26 +02:00
parent 014b79617e
commit dbf9117c56
56 changed files with 529 additions and 508 deletions

View File

@@ -1,13 +1,13 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
# Low level allocator for Nimrod. Has been designed to support the GC.
# Low level allocator for Nim. Has been designed to support the GC.
# TODO:
# - eliminate "used" field
# - make searching for block O(1)

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2013 Andreas Rumpf
#
# See the file "copying.txt", included in this
@@ -8,7 +8,7 @@
#
# This include file contains headers of Ansi C procs
# and definitions of Ansi C types in Nimrod syntax
# and definitions of Ansi C types in Nim syntax
# All symbols are prefixed with 'c_' to avoid ambiguities
{.push hints:off}

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,13 +1,13 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2014 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
# Atomic operations for Nimrod.
# Atomic operations for Nim.
{.push stackTrace:off.}
const someGcc = defined(gcc) or defined(llvm_gcc) or defined(clang)
@@ -159,6 +159,7 @@ when someGcc and hasThreadSupport:
elif defined(vcc) and hasThreadSupport:
proc addAndFetch*(p: ptr int, val: int): int {.
importc: "NimXadd", nodecl.}
proc fence*() {.importc: "_ReadWriteBarrier", header: "<intrin.h>".}
else:
proc addAndFetch*(p: ptr int, val: int): int {.inline.} =

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2013 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2014 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2013 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2013 Andreas Rumpf
#
# See the file "copying.txt", included in this
@@ -293,7 +293,7 @@ proc checkWatchpoints =
Watchpoints[i].oldValue = newHash
proc endb(line: int, file: cstring) {.compilerproc, noinline.} =
# This proc is called before every Nimrod code line!
# This proc is called before every Nim code line!
if framePtr == nil: return
if dbgWatchpointHook != nil: checkWatchpoints()
framePtr.line = line # this is done here for smaller code size!

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2014 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2013 Andreas Rumpf
#
# See the file "copying.txt", included in this
@@ -11,7 +11,7 @@
# with the application. Mostly we do not use dynamic memory here as that
# would interfere with the GC and trigger ON/OFF errors if the
# user program corrupts memory. Unfortunately, for dispaying
# variables we use the ``system.repr()`` proc which uses Nimrod
# variables we use the ``system.repr()`` proc which uses Nim
# strings and thus allocates memory from the heap. Pity, but
# I do not want to implement ``repr()`` twice.

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2014 Andreas Rumpf
#
# See the file "copying.txt", included in this
@@ -68,8 +68,8 @@ proc popCurrentException {.compilerRtl, inl.} =
# some platforms have native support for stack traces:
const
nativeStackTraceSupported* = (defined(macosx) or defined(linux)) and
not nimrodStackTrace
hasSomeStackTrace = nimrodStackTrace or
not NimStackTrace
hasSomeStackTrace = NimStackTrace or
defined(nativeStackTrace) and nativeStackTraceSupported
when defined(nativeStacktrace) and nativeStackTraceSupported:
@@ -177,7 +177,7 @@ proc auxWriteStackTrace(f: PFrame, s: var string) =
when hasSomeStackTrace:
proc rawWriteStackTrace(s: var string) =
when nimrodStackTrace:
when NimStackTrace:
if framePtr == nil:
add(s, "No stack traceback available\n")
else:
@@ -318,7 +318,7 @@ when not defined(noSignalHandler):
GC_disable()
var buf = newStringOfCap(2000)
rawWriteStackTrace(buf)
processSignal(sig, buf.add) # nice hu? currying a la nimrod :-)
processSignal(sig, buf.add) # nice hu? currying a la Nim :-)
showErrorMessage(buf)
GC_enable()
else:

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2013 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,13 +1,13 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2014 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
# A simple mark&sweep garbage collector for Nimrod. Define the
# A simple mark&sweep garbage collector for Nim. Define the
# symbol ``gcUseBitvectors`` to generate a variant of this GC.
{.push profiler:off.}

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2014 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this
@@ -103,7 +103,7 @@ proc raiseException(e: ref E_Base, ename: cstring) {.
if excHandler != nil:
excHandler.exc = e
else:
when nimrodStackTrace:
when NimStackTrace:
var buf = rawWriteStackTrace()
else:
var buf = ""

View File

@@ -1,14 +1,14 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2013 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
# Nimrod high-level memory manager: It supports Boehm's GC, no GC and the
# native Nimrod GC. The native Nimrod GC is the default.
# Nim high-level memory manager: It supports Boehm's GC, no GC and the
# native Nim GC. The native Nim GC is the default.
#{.push checks:on, assertions:on.}
{.push checks:off.}
@@ -259,7 +259,7 @@ elif defined(nogc) and defined(useMalloc):
elif defined(nogc):
# Even though we don't want the GC, we cannot simply use C's memory manager
# because Nimrod's runtime wants ``realloc`` to zero out the additional
# because Nim's runtime wants ``realloc`` to zero out the additional
# space which C's ``realloc`` does not. And we cannot get the old size of an
# object, because C does not support this operation... Even though every
# possible implementation has to have a way to determine the object's size.

View File

@@ -1,13 +1,13 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
# This file implements the Nimrod profiler. The profiler needs support by the
# This file implements the Nim profiler. The profiler needs support by the
# code generator. The idea is to inject the instruction stream
# with 'nimProfile()' calls. These calls are injected at every loop end
# (except perhaps loops that have no side-effects). At every Nth call a

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,13 +1,13 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2014 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
## Implements Nimrod's 'spawn'.
## Implements Nim's 'spawn'.
when not declared(NimString):
{.error: "You must not import this module explicitly".}

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this
@@ -119,7 +119,7 @@ proc addChar(s: NimString, c: char): NimString =
inc(result.len)
# These routines should be used like following:
# <Nimrod code>
# <Nim code>
# s &= "Hello " & name & ", how do you feel?"
#
# <generated C code>
@@ -130,7 +130,7 @@ proc addChar(s: NimString, c: char): NimString =
# appendString(s, strLit3);
# }
#
# <Nimrod code>
# <Nim code>
# s = "Hello " & name & ", how do you feel?"
#
# <generated C code>
@@ -143,7 +143,7 @@ proc addChar(s: NimString, c: char): NimString =
# s = tmp0;
# }
#
# <Nimrod code>
# <Nim code>
# s = ""
#
# <generated C code>

View File

@@ -1,17 +1,17 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
## Thread support for Nimrod. **Note**: This is part of the system module.
## Thread support for Nim. **Note**: This is part of the system module.
## Do not import it directly. To activate thread support you need to compile
## with the ``--threads:on`` command line switch.
##
## Nimrod's memory model for threads is quite different from other common
## Nim's memory model for threads is quite different from other common
## programming languages (C, Pascal): Each thread has its own
## (garbage collected) heap and sharing of memory is restricted. This helps
## to prevent race conditions and improves efficiency. See `the manual for
@@ -19,7 +19,7 @@
##
## Example:
##
## .. code-block:: nimrod
## .. code-block:: Nim
##
## import locks
##
@@ -245,14 +245,14 @@ when not defined(useNimRtl):
# the GC can examine the stacks?
proc stopTheWord() = discard
# We jump through some hops here to ensure that Nimrod thread procs can have
# the Nimrod calling convention. This is needed because thread procs are
# We jump through some hops here to ensure that Nim thread procs can have
# the Nim calling convention. This is needed because thread procs are
# ``stdcall`` on Windows and ``noconv`` on UNIX. Alternative would be to just
# use ``stdcall`` since it is mapped to ``noconv`` on UNIX anyway.
type
TThread* {.pure, final.}[TArg] =
object of TGcThread ## Nimrod thread. A thread is a heavy object (~14K)
object of TGcThread ## Nim thread. A thread is a heavy object (~14K)
## that **must not** be part of a message! Use
## a ``TThreadId`` for that.
when TArg is void:

View File

@@ -1,6 +1,6 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this

View File

@@ -1,13 +1,13 @@
#
#
# Nimrod's Runtime Library
# Nim's Runtime Library
# (c) Copyright 2012 Andreas Rumpf
#
# See the file "copying.txt", included in this
# distribution, for details about the copyright.
#
# Nimrod support for C/C++'s `wide strings`:idx:. This is part of the system
# Nim support for C/C++'s `wide strings`:idx:. This is part of the system
# module! Do not import it directly!
when not declared(NimString):