Skip to content

Instantly share code, notes, and snippets.

discard newDialog(
newTitleFrame(tr"Main Menu",
newVLayout(@[
newButton(tr"New Game", on_click=new_game, is_expandable=EXPAND_WIDTH),
newButton(tr"Quick Game", on_click=quick_new_game, is_expandable=EXPAND_WIDTH),
newButton(tr"Quick Load", on_click=dummy, is_expandable=EXPAND_WIDTH),
newButton(tr"Editor", on_click=quick_load_game, is_expandable=EXPAND_WIDTH),
newButton(tr"Exit", on_click=game_exit, is_expandable=EXPAND_WIDTH),
]),
),
nim -r c --cc:gcc tests/stdlib/tbitops2.nim && \
nim -r c --cc:clang tests/stdlib/tbitops2.nim && \
nim -r c -d:release --cc:clang tests/stdlib/tbitops2.nim && \
nim -r c -d:release --cc:gcc tests/stdlib/tbitops2.nim && \
nim -r c --cc:gcc tests/stdlib/tbitops.nim && \
nim -r c --cc:clang tests/stdlib/tbitops.nim && \
nim -r c -d:release --cc:clang tests/stdlib/tbitops.nim && \
nim -r c -d:release --cc:gcc tests/stdlib/tbitops.nim && \
nim -r c --cc:gcc --cpu:i386 --passc: -m32 --passL: -m32 tests/stdlib/tbitops2.nim && \
KIND nkIntLit
Traceback (most recent call last)
nim.nim(121) nim
nim.nim(77) handleCmdLine
main.nim(163) mainCommand
main.nim(74) commandCompileToC
modules.nim(240) compileProject
modules.nim(180) compileModule
passes.nim(213) processModule
passes.nim(135) processTopLevelStmt
@Parashurama
Parashurama / name_syntax.nim
Last active June 10, 2016 15:57
`name` syntax
import macros
proc ctor_impl*(allocator: NimNode, prc: NimNode): auto {.compiletime.} =
# if prc[3][1][1].kind != nnkVarTy:
# error("Constructor must have var non-ref type as first parameter")
if prc[3][0].kind != nnkEmpty:
error("Constructor must not have return type")
if not ($prc[0] == "init" or $prc[0] == "init*"):
error("Constructor name must be `init`")
@Parashurama
Parashurama / unicode_escape.nim
Last active June 1, 2016 19:58
Add support for unicode and ASCII escape code in triple string
proc parse_hex*(num: var int; ch: char) =
case ch
of '0'..'9': num = (num shl 4) or (ch.int - '0'.int)
of 'a'..'f': num = (num shl 4) or (ch.int - 'a'.int) + 10
of 'A'..'F': num = (num shl 4) or (ch.int - 'A'.int) + 10
else: raise newException(ValueError, "invalid unicode hexcode")
template ones(n: expr): expr = ((1 shl n)-1)
proc runeLenAt(s: string, i: Natural): int =
@Parashurama
Parashurama / tcc_debug1.c
Created May 25, 2016 14:11
simplified tcc_debug0.c even further.
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
typedef struct TFrame TFrame;
struct TFrame {
TFrame* prev;
char *procname;
int64_t line;
@Parashurama
Parashurama / tcc_debug0.c
Created May 25, 2016 12:58
debug issue with struct return value.
#include <stdlib.h>
#include <stdint.h>
#include <stdio.h>
typedef struct TFrame TFrame;
struct TFrame {
TFrame* prev;
char *procname;
int64_t line;
char *filename;