This file contains hidden or 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
iterator countfrom (start, fin: int, step = 1): int = | |
if start < fin: | |
for i in countup(start, fin, step): | |
yield i | |
else: | |
for i in countdown(start, fin, step): | |
yield i | |
for x in countfrom(10,1): |
This file contains hidden or 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 unittest | |
suite "test": | |
setup: | |
var i = 42 | |
test "i is 42": | |
check: | |
i == 42 |
This file contains hidden or 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
when defined(LINUX): | |
const libName* = "libjit.so" | |
type | |
PContext* = ptr object | |
PFunction* = ptr object | |
PBlock* = ptr object | |
PInstruction* = ptr object | |
PValue* = ptr object | |
PType* = ptr object |
This file contains hidden or 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
* | |
* STFL - The Structured Terminal Forms Language/Library | |
* Copyright (C) 2006 Clifford Wolf <[email protected]> | |
* | |
* This library is free software; you can redistribute it and/or | |
* modify it under the terms of the GNU Lesser General Public | |
* License as published by the Free Software Foundation; either | |
* version 3 of the License, or (at your option) any later version. | |
* | |
* This library is distributed in the hope that it will be useful, |
This file contains hidden or 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 unittest | |
suite "numbers": | |
setup: | |
#this code is run before each test | |
var x = 1 | |
test "1 + 1 == 2": | |
#do stuff in here | |
check 1 + 1 == 2 |
This file contains hidden or 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 enet, strutils, streams, | |
private/pkt_tools | |
if enetInit() != 0: | |
quit "Could not initialize ENet" | |
var client: PHost = createHost(nil, 1,2,0,0) | |
if client.isNil: | |
quit "Could not create client" |
This file contains hidden or 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 | |
enet, | |
endians, | |
unsigned | |
export unsigned, endians | |
type TScalar* = int8 | uint8 | byte | char | bool | | |
int16| uint16| int32|uint32| | |
float32|float64|int64|uint64 |
This file contains hidden or 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
#include "stdio.h" | |
#include <stdlib.h> | |
typedef void (*cleanup_function) (void*); | |
// the interface | |
struct IPoint { | |
float *x, *y; | |
cleanup_function cleanup; |
This file contains hidden or 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 | |
parbiter = object | |
swappedcoll: bool | |
a,b: pshape | |
pshape = ptr object | |
#/ Return the colliding shapes involved for this arbiter. | |
#/ The order of their cpSpace.collision_type values will match | |
#/ the order set when the collision handler was registered. |
This file contains hidden or 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 signals, strutils | |
echo "\L--- GC TEST ---" | |
var displayUpdate = initSignal[void]() | |
type | |
GCO = ref object of TObject | |
id : int |