summary refs log tree commit diff stats
path: root/tests
ModeNameSize
d---------actiontable89log stats plain
d---------alias38log stats plain
d---------ambsym318log stats plain
d---------arithm72log stats plain
d---------array435log stats plain
d---------assert169log stats plain
d---------assign399log stats plain
d---------astoverload45log stats plain
d---------async1574log stats plain
-rw-r--r--benchmark.nim1286log stats plain blame
d---------benchmarks81log stats plain
d---------bind381log stats plain
d---------borrow85log stats plain
d---------caas1390log stats plain
d---------casestmt419log stats plain
d---------ccgbugs2033log stats plain
d---------clearmsg199log stats plain
d---------closure1349log stats plain
d---------cnstseq122log stats plain
d---------collections523log stats plain
d---------compiles148log stats plain
d---------concat39log stats plain
d---------concepts1382log stats plain
d---------constr80log stats plain
d---------constraints44log stats plain
d---------constructors53log stats plain
d---------controlflow197log stats plain
d---------converter384log stats plain
d---------coroutines330log stats plain
d---------cpp933log stats plain
d---------defaultprocparam98log stats plain
d---------deprecated43log stats plain
d---------destructor131log stats plain
d---------dir with space38log stats plain
d---------discard133log stats plain
d---------distinct166log stats plain
d---------dll160log stats plain
d---------effects441log stats plain
d---------enum494log stats plain
d---------errmsgs725log stats plain
d---------exception764log stats plain
d---------exprs266log stats plain
d---------fields295log stats plain
d---------float315log stats plain
d---------friends80log stats plain
d---------gc777log stats plain
d---------generics4284log stats plain
d---------gensym85log stats plain
d---------/span>- 25, w: 50, h: 50) discard renderer.renderFillRect(rect.addr) delay(16) renderer.renderPresent() .. code-block:: nim # mymain.nim import logic proc main() = init() while runGame: update() destroy() main() Compile this example via:: nim c --hotcodereloading:on mymain.nim Now start the program and KEEP it running! :: # Unix: mymain & # or Windows (click on the .exe) mymain.exe # edit For example, change the line:: discard renderer.setRenderDrawColor(255, 128, 128, 0) into:: discard renderer.setRenderDrawColor(255, 255, 128, 0) (This will change the color of the rectangle.) Then recompile the project, but do not restart or quit the mymain.exe program! :: nim c --hotcodereloading:on mymain.nim Now give the ``mymain`` SDL window the focus, press F9 and watch the updated version of the program. Reloading API ============= One can use the special event handlers ``beforeCodeReload`` and ``afterCodeReload`` to reset the state of a particular variable or to force the execution of certain statements: .. code-block:: Nim var settings = initTable[string, string]() lastReload: Time for k, v in loadSettings(): settings[k] = v initProgram() afterCodeReload: lastReload = now() resetProgramState() On each code reload, Nim will first execute all `beforeCodeReload`:idx: handlers registered in the previous version of the program and then all `afterCodeReload`:idx: handlers appearing in the newly loaded code. Please note that any handlers appearing in modules that weren't reloaded will also be executed. To prevent this behavior, one can guard the code with the `hasModuleChanged()`:idx: API: .. code-block:: Nim import mydb var myCache = initTable[Key, Value]() afterCodeReload: if hasModuleChanged(mydb): resetCache(myCache) The hot code reloading is based on dynamic library hot swapping in the native targets and direct manipulation of the global namespace in the JavaScript target. The Nim compiler does not specify the mechanism for detecting the conditions when the code must be reloaded. Instead, the program code is expected to call `performCodeReload()`:idx: every time it wishes to reload its code. It's expected that most projects will implement the reloading with a suitable build-system triggered IPC notification mechanism, but a polling solution is also possible through the provided `hasAnyModuleChanged()`:idx: API. In order to access ``beforeCodeReload``, ``afterCodeReload``, ``hasModuleChanged`` or ``hasAnyModuleChanged`` one must import the `hotcodereloading`:idx: module. Native code targets =================== Native projects using the hot code reloading option will be implicitly compiled with the `-d:useNimRtl` option and they will depend on both the ``nimrtl`` library and the ``nimhcr`` library which implements the hot code reloading run-time. All modules of the project will be compiled to separate dynamic link libraries placed in the ``nimcache`` directory. Please note that during the execution of the program, the hot code reloading run-time will load only copies of these libraries in order to not interfere with any newly issued build commands. The main module of the program is considered non-reloadable. Please note that procs from reloadable modules should not appear in the call stack of program while ``performCodeReload`` is being called. Thus, the main module is a suitable place for implementing a program loop capable of calling ``performCodeReload``. Please note that reloading won't be possible when any of the type definitions in the program has been changed. When closure iterators are used (directly or through async code), the reloaded refinitions will affect only newly created instances. Existing iterator instancess will execute their original code to completion. JavaScript target ================= Once your code is compiled for hot reloading, the ``nim-livereload`` NPM package provides a convenient solution for implementing the actual reloading in the browser using a framework such as [LiveReload](http://livereload.com/) or [BrowserSync](https://browsersync.io/). l&id=ca0155a45808aa047661cbcb3d31fef6f7088953'>plain
d---------manyloc230log stats plain
d---------metatype1552log stats plain
d---------method744log stats plain
d---------misc3273log stats plain
-rw-r--r--mmaptest.nim1490log stats plain blame
d---------modules1137log stats plain
d---------namedparams134log stats plain
d---------newconfig111log stats plain
d---------notnil301log stats plain
d---------objects765log stats plain
d---------objvariant258log stats plain
d---------openarray171log stats plain
d---------osproc357log stats plain
d---------overflw120log stats plain
d---------overload961log stats plain
d---------parallel1323log stats plain
d---------parser891log stats plain
d---------pragmas241log stats plain
d---------proc82log stats plain
d---------procvar169log stats plain
d---------range292log stats plain
d---------rational83log stats plain
-rw-r--r--readme.txt523log stats plain blame
d---------realtimeGC230log stats plain
-rw-r--r--rectest.nim57log stats plain blame
d---------rodfiles652log stats plain
d---------seq279log stats plain
d---------sets153log stats plain
d---------showoff286log stats plain
d---------specialops39log stats plain
d---------statictypes134log stats plain
-rw-r--r--stckovfl.nim141log stats plain blame
d---------stdlib3032log stats plain
d---------system312log stats plain
d---------template2097log stats plain
-rw-r--r--test_nimscript.nims454log stats plain blame
d---------testament309log stats plain
d---------testdata401log stats plain
d---------threads569log stats plain
d---------trmacros561log stats plain
d---------tuples567log stats plain
d---------typerel1467log stats plain
d---------types1192log stats plain
d---------untestable41log stats plain
d---------usingstmt84log stats plain
d---------varres239log stats plain
d---------varstmt76log stats plain
d---------vm1979log stats plain