diff options
author | Dean Thompson <deansherthompson@gmail.com> | 2019-01-21 16:40:04 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-21 16:40:04 -0500 |
commit | a6de0274ee768d135bab280d2b2700a0bb475300 (patch) | |
tree | 176b91e837ab7d2217713665c16fc28163017960 /doc | |
parent | 5b39c7aca91c1d20eb81425cf8f3854876aed475 (diff) | |
parent | ee89ba6bdb664fe4972f2917499cff1afdac0bab (diff) | |
download | Nim-a6de0274ee768d135bab280d2b2700a0bb475300.tar.gz |
Merge pull request #1 from nim-lang/devel
Getting the latest from nim-lang
Diffstat (limited to 'doc')
-rw-r--r-- | doc/advopt.txt | 38 | ||||
-rw-r--r-- | doc/basicopt.txt | 4 | ||||
-rw-r--r-- | doc/docs.rst | 3 | ||||
-rw-r--r-- | doc/lib.rst | 24 | ||||
-rw-r--r-- | doc/manual.rst | 18 | ||||
-rw-r--r-- | doc/nimc.rst | 5 | ||||
-rw-r--r-- | doc/nims.rst | 36 |
7 files changed, 69 insertions, 59 deletions
diff --git a/doc/advopt.txt b/doc/advopt.txt index 60cae7fd0..7ab85abfc 100644 --- a/doc/advopt.txt +++ b/doc/advopt.txt @@ -18,9 +18,9 @@ Advanced commands: Advanced options: -o:FILE, --out:FILE set the output filename - --stdout output to stdout + --stdout:on|off output to stdout --colors:on|off turn compiler messages coloring on|off - --listFullPaths list full paths in messages + --listFullPaths:on|off list full paths in messages -w:on|off|list, --warnings:on|off|list turn all warnings on|off or list all available --warning[X]:on|off turn specific warning X on|off @@ -39,29 +39,27 @@ Advanced options: --nimcache:PATH set the path used for generated files --header:FILE the compiler should produce a .h file (FILE is optional) - -c, --compileOnly compile Nim files only; do not assemble or link - --noLinking compile Nim and generated files but do not link - --noMain do not generate a main procedure - --genScript generate a compile script (in the 'nimcache' + -c, --compileOnly:on|off compile Nim files only; do not assemble or link + --noLinking:on|off compile Nim and generated files but do not link + --noMain:on|off do not generate a main procedure + --genScript:on|off generate a compile script (in the 'nimcache' subdirectory named 'compile_$$project$$scriptext'), implies --compileOnly - --genDeps generate a '.deps' file containing the dependencies + --genDeps:on|off generate a '.deps' file containing the dependencies --os:SYMBOL set the target operating system (cross-compilation) --cpu:SYMBOL set the target processor (cross-compilation) - --debuginfo enables debug information + --debuginfo:on|off enables debug information -t, --passC:OPTION pass an option to the C compiler -l, --passL:OPTION pass an option to the linker --cincludes:DIR modify the C compiler header search path --clibdir:DIR modify the linker library search path --clib:LIBNAME link an additional C library (you should omit platform-specific extensions) - --genMapping generate a mapping file containing - (Nim, mangled) identifier pairs --project document the whole project (doc2) --docSeeSrcUrl:url activate 'see source' for doc and doc2 commands (see doc.item.seesrc in config/nimdoc.cfg) --lineDir:on|off generation of #line directive on|off - --embedsrc embeds the original source code as comments + --embedsrc:on|off embeds the original source code as comments in the generated output --threadanalysis:on|off turn thread analysis on|off --tlsEmulation:on|off turn thread local storage emulation on|off @@ -78,11 +76,12 @@ Advanced options: strings is allowed; only for backwards compatibility --nilseqs:on|off allow 'nil' for strings/seqs for backwards compatibility - --skipCfg do not read the general configuration file - --skipUserCfg do not read the user's configuration file - --skipParentCfg do not read the parent dirs' configuration files - --skipProjCfg do not read the project's configuration file - --gc:refc|v2|markAndSweep|boehm|go|none|regions + --oldast:on|off use old AST for backwards compatibility + --skipCfg:on|off do not read the nim installation's configuration file + --skipUserCfg:on|off do not read the user's configuration file + --skipParentCfg:on|off do not read the parent dirs' configuration files + --skipProjCfg:on|off do not read the project's configuration file + --gc:refc|markAndSweep|boehm|go|none|regions select the GC to use; default is 'refc' --index:on|off turn index file generation on|off --putenv:key=value set an environment variable @@ -98,8 +97,8 @@ Advanced options: symbol matching is fuzzy so that --dynlibOverride:lua matches dynlib: "liblua.so.3" - --dynlibOverrideAll makes the dynlib pragma have no effect - --listCmd list the commands used to execute external programs + --dynlibOverrideAll:on|off makes the dynlib pragma have no effect + --listCmd:on|off list the commands used to execute external programs --parallelBuild:0|1|... perform a parallel build value = number of processors (0 for auto-detect) --incremental:on|off only recompile the changed modules (experimental!) @@ -108,3 +107,6 @@ Advanced options: --experimental:$1 enable experimental language feature -v, --version show detailed version information + --profiler:on|off Enable profiling; requires `import nimprof`, and + works better with `--stackTrace:on` + see also https://nim-lang.github.io/Nim/estp.html diff --git a/doc/basicopt.txt b/doc/basicopt.txt index a9166d36c..96c9ced3d 100644 --- a/doc/basicopt.txt +++ b/doc/basicopt.txt @@ -15,7 +15,7 @@ Options: (Optionally: Define the value for that symbol, see: "compile time define pragmas") -u, --undef:SYMBOL undefine a conditional symbol - -f, --forceBuild force rebuilding of all modules + -f, --forceBuild:on|off force rebuilding of all modules --stackTrace:on|off turn stack tracing on|off --lineTrace:on|off turn line tracing on|off --threads:on|off turn support for multi-threading on|off @@ -35,7 +35,7 @@ Options: --debugger:native|endb use native debugger (gdb) | ENDB (experimental) --app:console|gui|lib|staticlib generate a console app|GUI app|DLL|static library - -r, --run run the compiled program with given arguments + -r, --run:on|off run the compiled program with given arguments --fullhelp show all command line switches -h, --help show this help diff --git a/doc/docs.rst b/doc/docs.rst index cd1a05853..4a69bd69a 100644 --- a/doc/docs.rst +++ b/doc/docs.rst @@ -6,6 +6,9 @@ The documentation consists of several documents: - | `Tutorial (part II) <tut2.html>`_ | The Nim tutorial part two deals with the advanced language constructs. +- | `Tutorial (part III) <tut3.html>`_ + | The Nim tutorial part three about Nim's macro system. + - | `Language Manual <manual.html>`_ | The Nim manual is a draft that will evolve into a proper specification. diff --git a/doc/lib.rst b/doc/lib.rst index 89e3cca40..1f19f9bf4 100644 --- a/doc/lib.rst +++ b/doc/lib.rst @@ -107,8 +107,8 @@ String handling substrings, replacing substrings. * `strformat <strformat.html>`_ - Macro based standard string interpolation / formatting. Inpired by - Python's ```f``-strings. + Macro based standard string interpolation / formatting. Inspired by + Python's ``f``-strings. * `strmisc <strmisc.html>`_ This module contains uncommon string handling operations that do not @@ -141,12 +141,6 @@ String handling Ropes can represent very long strings efficiently; especially concatenation is done in O(1) instead of O(n). -* `matchers <matchers.html>`_ - This module contains various string matchers for email addresses, etc. - -* `subexes <subexes.html>`_ - This module implements advanced string substitution operations. - * `std/editdistance <editdistance.html>`_ This module contains an algorithm to compute the edit distance between two Unicode strings. @@ -236,9 +230,6 @@ Internet Protocols and Support * `cgi <cgi.html>`_ This module implements helpers for CGI applications. -* `scgi <scgi.html>`_ - This module implements helpers for SCGI applications. - * `browsers <browsers.html>`_ This module implements procs for opening URLs with the user's default browser. @@ -275,8 +266,8 @@ Internet Protocols and Support module. * `net <net.html>`_ - This module implements a high-level sockets API. It will replace the - ``sockets`` module in the future. + This module implements a high-level sockets API. It replaces the + ``sockets`` module. * `nativesockets <nativesockets.html>`_ This module implements a low-level sockets API. @@ -456,13 +447,6 @@ Database support for other databases too. -Other ------ - -* `ssl <ssl.html>`_ - This module provides an easy to use sockets-style - Nim interface to the OpenSSL library. - Wrappers ======== diff --git a/doc/manual.rst b/doc/manual.rst index a646b7963..09b9b4d78 100644 --- a/doc/manual.rst +++ b/doc/manual.rst @@ -480,7 +480,6 @@ The type suffixes are: ``'d`` float64 ``'f32`` float32 ``'f64`` float64 - ``'f128`` float128 ================= ========================= Floating point literals may also be in binary, octal or hexadecimal @@ -1587,7 +1586,7 @@ details like this when mixing garbage collected data with unmanaged memory. Not nil annotation ------------------ -All types for that ``nil`` is a valid value can be annotated to +All types for which ``nil`` is a valid value can be annotated to exclude ``nil`` as a valid value with the ``not nil`` annotation: .. code-block:: nim @@ -1664,12 +1663,12 @@ Nim supports these `calling conventions`:idx:\: and another one for the pointer to implicitly passed environment. `stdcall`:idx: - This the stdcall convention as specified by Microsoft. The generated C + This is the stdcall convention as specified by Microsoft. The generated C procedure is declared with the ``__stdcall`` keyword. `cdecl`:idx: The cdecl convention means that a procedure shall use the same convention - as the C compiler. Under windows the generated C procedure is declared with + as the C compiler. Under Windows the generated C procedure is declared with the ``__cdecl`` keyword. `safecall`:idx: @@ -7365,6 +7364,17 @@ Example: embedsC() +``nimbase.h`` defines ``NIM_EXTERNC`` C macro that can be used for +``extern "C"`` code to work with both ``nim c`` and ``nim cpp``, eg: + +.. code-block:: Nim + proc foobar() {.importc:"$1".} + {.emit: """ + #include <stdio.h> + NIM_EXTERNC + void fun(){} + """.} + For backwards compatibility, if the argument to the ``emit`` statement is a single string literal, Nim symbols can be referred to via backticks. This usage is however deprecated. diff --git a/doc/nimc.rst b/doc/nimc.rst index e1bf98ece..4ffb595c0 100644 --- a/doc/nimc.rst +++ b/doc/nimc.rst @@ -347,13 +347,16 @@ complete list. Define Effect ====================== ========================================================= ``release`` Turns off runtime checks and turns on the optimizer. + More aggressive optimizations are possible, eg: + ``--passC:-ffast-math`` (but see issue #10305) + ``--stacktrace:off`` ``useWinAnsi`` Modules like ``os`` and ``osproc`` use the Ansi versions of the Windows API. The default build uses the Unicode version. ``useFork`` Makes ``osproc`` use ``fork`` instead of ``posix_spawn``. ``useNimRtl`` Compile and link against ``nimrtl.dll``. ``useMalloc`` Makes Nim use C's `malloc`:idx: instead of Nim's - own memory manager, ableit prefixing each allocation with + own memory manager, albeit prefixing each allocation with its size to support clearing memory on reallocation. This only works with ``gc:none``. ``useRealtimeGC`` Enables support of Nim's GC for *soft* realtime diff --git a/doc/nims.rst b/doc/nims.rst index 034ad1fda..eaf20a6db 100644 --- a/doc/nims.rst +++ b/doc/nims.rst @@ -26,9 +26,28 @@ previous settings): ``$project.nim``. This file can be skipped with the same ``--skipProjCfg`` command line option. -The VM cannot deal with ``importc`` because the FFI is not -available. So the stdlib modules using ``importc`` cannot be used with -Nim's VM. However, at least the following modules are available: +Limitations +================================= + +NimScript is subject to some limitations caused by the implementation of the VM +(virtual machine): + +* Nim's FFI (foreign function interface) is not available in NimScript. This + means that any stdlib module which relies on ``importc`` can not be used in + the VM. + +* ``ptr`` operations are are hard to emulate with the symbolic representation + the VM uses. They are available and tested extensively but there are bugs left. + +* ``var T`` function arguments rely on ``ptr`` operations internally and might + also be problematic in some cases. + +* More than one level of `ref` is generally not supported (for example, the type + `ref ref int`). + +* multimethods are not available. + +Given the above restrictions, at least the following modules are available: * `macros <macros.html>`_ * `os <os.html>`_ @@ -98,17 +117,6 @@ Task Description ========= =================================================== -If the task runs an external command via ``exec`` it should afterwards call -``setCommand "nop"`` to tell the Nim compiler that nothing else needs to be -done: - -.. code-block:: nim - - task tests, "test regular expressions": - exec "nim c -r tests" - setCommand "nop" - - Look at the module `distros <distros.html>`_ for some support of the OS's native package managers. |