mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-07 04:14:19 +00:00
fix several typos in documentation and comments (#12553)
This commit is contained in:
@@ -592,7 +592,7 @@ proc docstringSummary(rstText: string): string =
|
||||
##
|
||||
## Most docstrings will contain a one liner summary, so stripping at the
|
||||
## first newline is usually fine. If after that the content is still too big,
|
||||
## it is stripped at the first comma, colon or dot, usual english sentence
|
||||
## it is stripped at the first comma, colon or dot, usual English sentence
|
||||
## separators.
|
||||
##
|
||||
## No guarantees are made on the size of the output, but it should be small.
|
||||
|
||||
@@ -248,7 +248,7 @@ Math libraries
|
||||
|
||||
* `fenv <fenv.html>`_
|
||||
Floating-point environment. Handling of floating-point rounding and
|
||||
exceptions (overflow, zero-devide, etc.).
|
||||
exceptions (overflow, zero-divide, etc.).
|
||||
|
||||
* `math <math.html>`_
|
||||
Mathematical operations like cosine, square root.
|
||||
|
||||
@@ -233,7 +233,7 @@ proc lcs(dataA: var DiffData; lowerA, upperA: int; dataB: var DiffData; lowerB,
|
||||
inc lowerA
|
||||
|
||||
else:
|
||||
# Find the middle snakea and length of an optimal path for A and B
|
||||
# Find the middle snake and length of an optimal path for A and B
|
||||
let smsrd = sms(dataA, lowerA, upperA, dataB, lowerB, upperB, downVector, upVector)
|
||||
# Debug.Write(2, "MiddleSnakeData", String.Format("{0},{1}", smsrd.x, smsrd.y))
|
||||
|
||||
|
||||
@@ -215,7 +215,7 @@ type
|
||||
pattern*: string ## the pattern that caused the problem
|
||||
|
||||
StudyError* = ref object of RegexError
|
||||
## Thrown when studying the regular expression failes
|
||||
## Thrown when studying the regular expression fails
|
||||
## for whatever reason. The message contains the error
|
||||
## code.
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
# - named `performCodeReload`, requires the hotcodereloading module
|
||||
# - explicitly called by the user - the current active callstack shouldn't contain
|
||||
# any functions which are defined in modules that will be reloaded (or crash!).
|
||||
# The reason is that old dynalic libraries get unloaded.
|
||||
# The reason is that old dynamic libraries get unloaded.
|
||||
# Example:
|
||||
# if A is the main module and it imports B, then only B is reloadable and only
|
||||
# if when calling hcrPerformCodeReload there is no function defined in B in the
|
||||
@@ -549,7 +549,7 @@ when defined(createNimHcr):
|
||||
# problems when the GC is executed while the reload is underway.
|
||||
# Future versions of NIMHCR won't use the GC, because all globals and the
|
||||
# metadata needed to access them will be placed in shared memory, so they
|
||||
# can be manipulted from external programs without reloading.
|
||||
# can be manipulated from external programs without reloading.
|
||||
GC_disable()
|
||||
defer: GC_enable()
|
||||
|
||||
|
||||
@@ -1605,7 +1605,7 @@ proc dirCodeBlock(p: var RstParser, nimExtension = false): PRstNode =
|
||||
## <http://docutils.sourceforge.net/docs/ref/rst/directives.html#code>`_ and
|
||||
## the nim extension ``.. code-block::``. If the block is an extension, we
|
||||
## want the default language syntax highlighting to be Nim, so we create a
|
||||
## fake internal field to comminicate with the generator. The field is named
|
||||
## fake internal field to communicate with the generator. The field is named
|
||||
## ``default-language``, which is unlikely to collide with a field specified
|
||||
## by any random rst input file.
|
||||
##
|
||||
|
||||
@@ -660,7 +660,7 @@ proc mergeIndexes*(dir: string): string =
|
||||
## As convention this proc will split index files into two categories:
|
||||
## documentation and API. API indices will be all joined together into a
|
||||
## single big sorted index, making the bulk of the final index. This is good
|
||||
## for API documentation because many symbols are repated in different
|
||||
## for API documentation because many symbols are repeated in different
|
||||
## modules. On the other hand, documentation indices are essentially table of
|
||||
## contents plus a few special markers. These documents will be rendered in a
|
||||
## separate section which tries to maintain the order and hierarchy of the
|
||||
|
||||
@@ -562,7 +562,7 @@ when defined(macosx):
|
||||
var
|
||||
SO_NOSIGPIPE* {.importc, header: "<sys/socket.h>".}: cint
|
||||
elif defined(solaris):
|
||||
# Solaris dont have MSG_NOSIGNAL
|
||||
# Solaris doesn't have MSG_NOSIGNAL
|
||||
const
|
||||
MSG_NOSIGNAL* = 0'i32
|
||||
else:
|
||||
|
||||
@@ -572,7 +572,7 @@ when defined(macosx):
|
||||
var
|
||||
SO_NOSIGPIPE* {.importc, header: "<sys/socket.h>".}: cint
|
||||
elif defined(solaris):
|
||||
# Solaris dont have MSG_NOSIGNAL
|
||||
# Solaris doesn't have MSG_NOSIGNAL
|
||||
const
|
||||
MSG_NOSIGNAL* = 0'i32
|
||||
else:
|
||||
|
||||
@@ -173,7 +173,7 @@ proc fastlog2Nim(x: uint64): int {.inline, noSideEffect.} =
|
||||
result = lookup[(v * 0x03F6EAF2CD271461'u64) shr 58].int
|
||||
|
||||
# sets.nim cannot import bitops, but bitops can use include
|
||||
# system/sets to eleminate code duplication. sets.nim defines defines
|
||||
# system/sets to eliminate code duplication. sets.nim defines
|
||||
# countBits32 and countBits64.
|
||||
include system/sets
|
||||
|
||||
|
||||
@@ -1361,7 +1361,7 @@ when isMainModule:
|
||||
doAssert foo1(openArray[int]([identity(1), identity(2)])) == @[10, 20]
|
||||
doAssert counter == 2
|
||||
|
||||
# Corner cases (openArray litterals should not be common)
|
||||
# Corner cases (openArray literals should not be common)
|
||||
template foo2(x: openArray[int]): seq[int] = x.mapIt(it * 10)
|
||||
counter = 0
|
||||
doAssert foo2(openArray[int]([identity(1), identity(2)])) == @[10, 20]
|
||||
|
||||
@@ -904,7 +904,7 @@ proc `$`*[A](s: OrderedSet[A]): string =
|
||||
iterator items*[A](s: OrderedSet[A]): A =
|
||||
## Iterates over keys in the ordered set `s` in insertion order.
|
||||
##
|
||||
## If you need a sequence with the elelments you can use `sequtils.toSeq
|
||||
## If you need a sequence with the elements you can use `sequtils.toSeq
|
||||
## template <sequtils.html#toSeq.t,untyped>`_.
|
||||
##
|
||||
## .. code-block::
|
||||
|
||||
@@ -49,7 +49,7 @@ proc satMinus(a, b: int): int {.inline.} =
|
||||
proc `+`*(a, b: Color): Color =
|
||||
## Adds two colors.
|
||||
##
|
||||
## This uses saturated artithmetic, so that each color
|
||||
## This uses saturated arithmetic, so that each color
|
||||
## component cannot overflow (255 is used as a maximum).
|
||||
##
|
||||
runnableExamples:
|
||||
@@ -63,7 +63,7 @@ proc `+`*(a, b: Color): Color =
|
||||
proc `-`*(a, b: Color): Color =
|
||||
## Subtracts two colors.
|
||||
##
|
||||
## This uses saturated artithmetic, so that each color
|
||||
## This uses saturated arithmetic, so that each color
|
||||
## component cannot underflow (0 is used as a minimum).
|
||||
##
|
||||
runnableExamples:
|
||||
|
||||
@@ -468,7 +468,7 @@ proc convert*(s: string, destEncoding = "UTF-8",
|
||||
srcEncoding = "CP1252"): string =
|
||||
## converts `s` to `destEncoding`. It assumed that `s` is in `srcEncoding`.
|
||||
## This opens a converter, uses it and closes it again and is thus more
|
||||
## convienent but also likely less efficient than re-using a converter.
|
||||
## convenient but also likely less efficient than re-using a converter.
|
||||
## utf-16BE, utf-32 conversions not supported on windows
|
||||
var c = open(destEncoding, srcEncoding)
|
||||
try:
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
## Unmarshalling
|
||||
## -------------
|
||||
##
|
||||
## In addition to reading dynamic data, Nim can also unmarshall JSON directly
|
||||
## In addition to reading dynamic data, Nim can also unmarshal JSON directly
|
||||
## into a type with the ``to`` macro.
|
||||
##
|
||||
## .. code-block:: Nim
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
## * `rationals module<rationals.html>`_ for rational numbers and their
|
||||
## mathematical operations
|
||||
## * `fenv module<fenv.html>`_ for handling of floating-point rounding
|
||||
## and exceptions (overflow, zero-devide, etc.)
|
||||
## and exceptions (overflow, zero-divide, etc.)
|
||||
## * `random module<random.html>`_ for fast and tiny random number generator
|
||||
## * `mersenne module<mersenne.html>`_ for Mersenne twister random number generator
|
||||
## * `stats module<stats.html>`_ for statistical analysis
|
||||
|
||||
@@ -3025,7 +3025,7 @@ proc getFileInfo*(handle: FileHandle): FileInfo {.noNimScript.} =
|
||||
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 descripter to a native file handle.
|
||||
# To transform the C file descriptor to a native file handle.
|
||||
var realHandle = get_osfhandle(handle)
|
||||
if getFileInformationByHandle(realHandle, addr rawInfo) == 0:
|
||||
raiseOSError(osLastError())
|
||||
|
||||
@@ -800,7 +800,7 @@ type
|
||||
## Raised if an array index is out of bounds.
|
||||
|
||||
FieldError* = object of Defect ## \
|
||||
## Raised if a record field is not accessible because its dicriminant's
|
||||
## Raised if a record field is not accessible because its discriminant's
|
||||
## value does not fit.
|
||||
RangeError* = object of Defect ## \
|
||||
## Raised if a range check error occurred.
|
||||
@@ -1646,7 +1646,7 @@ proc `+`*[T](x, y: set[T]): set[T] {.magic: "PlusSet", noSideEffect.}
|
||||
## b = {2, 3, 4}
|
||||
## echo a + b # => {1, 2, 3, 4}
|
||||
proc `-`*[T](x, y: set[T]): set[T] {.magic: "MinusSet", noSideEffect.}
|
||||
## This operator computes the diference of two sets.
|
||||
## This operator computes the difference of two sets.
|
||||
##
|
||||
## .. code-block:: Nim
|
||||
## let
|
||||
@@ -2230,13 +2230,13 @@ type
|
||||
|
||||
BiggestInt* = int64
|
||||
## is an alias for the biggest signed integer type the Nim compiler
|
||||
## supports. Currently this is ``int64``, but it is platform-dependant
|
||||
## supports. Currently this is ``int64``, but it is platform-dependent
|
||||
## in general.
|
||||
|
||||
BiggestFloat* = float64
|
||||
## is an alias for the biggest floating point type the Nim
|
||||
## compiler supports. Currently this is ``float64``, but it is
|
||||
## platform-dependant in general.
|
||||
## platform-dependent in general.
|
||||
|
||||
when defined(JS):
|
||||
type BiggestUInt* = uint32
|
||||
|
||||
@@ -213,7 +213,7 @@ proc dealloc(r: var MemRegion; p: pointer; size: int) =
|
||||
if it.typ != nil and it.typ.finalizer != nil:
|
||||
(cast[Finalizer](it.typ.finalizer))(p)
|
||||
it.typ = nil
|
||||
# it is benefitial to not use the free lists here:
|
||||
# it is beneficial to not use the free lists here:
|
||||
if r.bump -! size == p:
|
||||
dec r.bump, size
|
||||
when false:
|
||||
|
||||
@@ -115,8 +115,8 @@ proc c_fprintf(f: File, frmt: cstring): cint {.
|
||||
proc c_fputc(c: char, f: File): cint {.
|
||||
importc: "fputc", header: "<stdio.h>".}
|
||||
|
||||
## When running nim in android app stdout goes no where, so echo gets ignored
|
||||
## To redreict echo to the android logcat use -d:androidNDK
|
||||
## When running nim in android app, stdout goes nowhere, so echo gets ignored
|
||||
## To redirect echo to the android logcat, use -d:androidNDK
|
||||
when defined(androidNDK):
|
||||
const ANDROID_LOG_VERBOSE = 2.cint
|
||||
proc android_log_print(prio: cint, tag: cstring, fmt: cstring): cint
|
||||
|
||||
@@ -325,7 +325,7 @@ proc setLengthSeq(seq: PGenericSeq, elemSize, newLen: int): PGenericSeq {.
|
||||
# cell is aliased by another pointer (ie proc parameter or a let variable).
|
||||
# This is a tough problem, because even if we don't zeroMem here, in the
|
||||
# presence of user defined destructors, the user will expect the cell to be
|
||||
# "destroyed" thus creating the same problem. We can destoy the cell in the
|
||||
# "destroyed" thus creating the same problem. We can destroy the cell in the
|
||||
# finalizer of the sequence, but this makes destruction non-deterministic.
|
||||
zeroMem(cast[pointer](cast[ByteAddress](result) +% GenericSeqSize +%
|
||||
(newLen*%elemSize)), (result.len-%newLen) *% elemSize)
|
||||
@@ -361,7 +361,7 @@ proc setLengthSeqV2(s: PGenericSeq, typ: PNimType, newLen: int): PGenericSeq {.
|
||||
# cell is aliased by another pointer (ie proc parameter or a let variable).
|
||||
# This is a tough problem, because even if we don't zeroMem here, in the
|
||||
# presence of user defined destructors, the user will expect the cell to be
|
||||
# "destroyed" thus creating the same problem. We can destoy the cell in the
|
||||
# "destroyed" thus creating the same problem. We can destroy the cell in the
|
||||
# finalizer of the sequence, but this makes destruction non-deterministic.
|
||||
zeroMem(cast[pointer](cast[ByteAddress](result) +% GenericSeqSize +%
|
||||
(newLen*%elemSize)), (result.len-%newLen) *% elemSize)
|
||||
|
||||
@@ -57,7 +57,7 @@ type
|
||||
|
||||
Icallback* = proc (arg: PIhandle): cint {.cdecl.}
|
||||
|
||||
# pre-defineded dialogs
|
||||
# pre-defined dialogs
|
||||
proc fileDlg*: PIhandle {.importc: "IupFileDlg", dynlib: dllname, cdecl.}
|
||||
proc messageDlg*: PIhandle {.importc: "IupMessageDlg", dynlib: dllname, cdecl.}
|
||||
proc colorDlg*: PIhandle {.importc: "IupColorDlg", dynlib: dllname, cdecl.}
|
||||
|
||||
@@ -579,7 +579,7 @@ type
|
||||
STATUS_READY, STATUS_GET_RESULT, STATUS_USE_RESULT
|
||||
Protocol_type* = enum # There are three types of queries - the ones that have to go to
|
||||
# the master, the ones that go to a slave, and the administrative
|
||||
# type which must happen on the pivot connectioin
|
||||
# type which must happen on the pivot connection
|
||||
PROTOCOL_DEFAULT, PROTOCOL_TCP, PROTOCOL_SOCKET, PROTOCOL_PIPE,
|
||||
PROTOCOL_MEMORY
|
||||
Rpl_type* = enum
|
||||
|
||||
@@ -31,7 +31,7 @@ const useWinVersion = defined(Windows) or defined(nimdoc)
|
||||
# To force openSSL version use -d:sslVersion=1.0.0
|
||||
# See: #10281, #10230
|
||||
# General issue:
|
||||
# Other dynamic libraries (like libpg) load diffetent openSSL version then what nim loads.
|
||||
# Other dynamic libraries (like libpg) load different openSSL version then what nim loads.
|
||||
# Having two different openSSL loaded version causes a crash.
|
||||
# Use this compile time define to force the openSSL version that your other dynamic libraries want.
|
||||
const sslVersion {.strdefine.}: string = ""
|
||||
|
||||
@@ -44,7 +44,7 @@ discard """
|
||||
# - No way to check on memory use
|
||||
# - No cyclic data structures
|
||||
# - No attempt to measure variation with object size
|
||||
# - Results are sensitive to locking cost, but we dont
|
||||
# - Results are sensitive to locking cost, but we don't
|
||||
# check for proper locking
|
||||
#
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ macro defPacket*(typeNameN: untyped, typeFields: untyped): untyped =
|
||||
packBody.add(newCall("pack", streamID, dotName))
|
||||
readBody.add(resName := newCall("read" & $typeFields[i][1].ident, streamID))
|
||||
else:
|
||||
error("I dont know what to do with: " & treerepr(typeFields[i]))
|
||||
error("I don't know what to do with: " & treerepr(typeFields[i]))
|
||||
|
||||
var
|
||||
toStringFunc = newNimNode(nnkProcDef).und(
|
||||
|
||||
@@ -23,7 +23,7 @@ when false:
|
||||
var d32 = v8 + 10'i32
|
||||
|
||||
when false:
|
||||
# these dont work yet because unsigned.nim is stupid. XXX We need to fix this.
|
||||
# these don't work yet because unsigned.nim is stupid. XXX We need to fix this.
|
||||
var f8 = v16 + 10'u8
|
||||
var f16 = v16 + 10'u16
|
||||
var f32 = v16 + 10'u32
|
||||
|
||||
@@ -3,7 +3,7 @@ discard """
|
||||
file: "tadrdisc.nim"
|
||||
line: 20
|
||||
"""
|
||||
# Test that the address of a dicriminants cannot be taken
|
||||
# Test that the address of a discriminants cannot be taken
|
||||
|
||||
type
|
||||
TKind = enum ka, kb, kc
|
||||
|
||||
@@ -87,7 +87,7 @@ proc has(c: Captures; i: range[0..pegs.MaxSubpatterns-1]): bool {.nosideeffect,
|
||||
result = b.first <= b.last
|
||||
|
||||
proc get(str: string; c: Captures; i: range[0..MaxSubpatterns-1]; def: char): char {.nosideeffect, inline.} =
|
||||
## If capture `i` is non-empty return that portion of `str` casted
|
||||
## If capture `i` is non-empty return that portion of `str` cast
|
||||
## to `char`, otherwise return `def`.
|
||||
result = if c.has(i): str[c.bounds(i).first] else: def
|
||||
|
||||
@@ -344,7 +344,7 @@ proc writeformat(o: var Writer; p: pointer; fmt: Format) =
|
||||
## Write pointer `i` according to format `fmt` using output object
|
||||
## `o` and output function `add`.
|
||||
##
|
||||
## Pointers are casted to unsigned int and formatted as hexadecimal
|
||||
## Pointers are cast to unsigned int and formatted as hexadecimal
|
||||
## with prefix unless specified otherwise.
|
||||
var f = fmt
|
||||
if f.typ == 0.char:
|
||||
|
||||
Reference in New Issue
Block a user