This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc this: void {.cdecl, exportc, dynlib.} = | |
var i = 1 | |
var a = 2 | |
var z = 3 | |
proc foo(): int = | |
echo "here" | |
return i + a + z + 65 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc processClient(client: AsyncSocket): owned(Future[void]) = | |
var retFuture_17906029 = newFuture("processClient") | |
iterator processClientIter_17906030(): owned(FutureBase) {.closure.} = | |
while true: | |
var future_17906031 = recvLine(client, {SafeDisconn}, 1000000) | |
yield future_17906031 | |
let line = read(future_17906031) | |
if len(line) == 0: | |
break | |
for c in items(clients): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import module_b | |
from module_c import nil | |
echo HelloFromModuleB | |
echo module_c.HelloFromModuleC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import criterion | |
var cfg = newDefaultConfig() | |
cfg.brief = true | |
const | |
sepSet = {'/', '\\'} | |
sepArray = ['/', '\\'] | |
proc dummy(a: string): bool = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from strutils import nil | |
template copy(target: string, tRegion: Slice|HSlice, source: string, sRegion: Slice|HSlice): untyped = | |
template resolve(c, i): untyped = | |
when i is BackwardsIndex: | |
len(c) - int(i) | |
else: | |
i | |
# Figure out the length of each slice |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A lazybuf is a lazily constructed path buffer. | |
# It supports append, reading previously appended chars, | |
# and retrieving the final string. It does not allocate a buffer | |
# to hold the output until that output diverges from s. | |
type lazybuf = object | |
path: string | |
buf: string | |
w: int | |
volAndPath: string | |
volLen: int |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type | |
WindowsPath* = distinct string | |
PosixPath* = distinct string | |
when OS_IS_WINDOWS: | |
type | |
Path* = distinct WindowsPath | |
IPath* = distinct Path | |
else: | |
type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async proc foo(i: int) int = | |
await bar(i) // gives i+1 | |
await bar(i+1) // gives i+2 | |
await bar(i+2) // gives i+3 | |
# To | |
proc foo(state: var State) = | |
if state.state == 1: | |
state.waiting_on = bar(state.bar_state, state.i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def display_hint(value): | |
return 'string' | |
def to_string(value): | |
if value: | |
l = int(value['Sup']['len']) | |
return value['data'][0].address.string("utf-8", "ignore", l) | |
else: | |
return "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Generated by Nim Compiler v1.1.1 */ | |
/* (c) 2019 Andreas Rumpf */ | |
/* The generated code is subject to the original license. */ | |
/* Compiled for: MacOSX, amd64, clang */ | |
/* Command for C compiler: | |
clang -c -w -I/usr/local/Cellar/nim/HEAD-81a4379/nim/lib -I/Users/csweetser/Personal -o /Users/csweetser/.cache/nim/untitled_d/@muntitled.nim.c.o /Users/csweetser/.cache/nim/untitled_d/@muntitled.nim.c */ | |
#define NIM_INTBITS 64 | |
#include "nimbase.h" | |
#include <string.h> |