about summary refs log tree commit diff stats
path: root/tools/termbox/output.inl
diff options
context:
space:
mode:
Diffstat (limited to 'tools/termbox/output.inl')
0 files changed, 0 insertions, 0 deletions
p;id=1c8ddca7e08af9075a930edaca6c522d5e6fd8b5'>^
405b86068
07d5a8085 ^

















405b86068


286e5958d ^
405b86068

439aa2d04 ^
4d4b3b1c0 ^
405b86068


07d5a8085 ^

439aa2d04 ^


07d5a8085 ^

286e5958d ^
07d5a8085 ^
405b86068
439aa2d04 ^





286e5958d ^
2169fd63b ^
286e5958d ^


2169fd63b ^
439aa2d04 ^


2169fd63b ^
439aa2d04 ^



405b86068





439aa2d04 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83


       




                      






                                   
                              
 

















                                                                             


                                                                   
                                       

                              
                                                  
         


                                 

           


                             

                   
                   
                       
 





                                                    
 
                                   


                           
                            


                                 
                



                





                                   
 
# Hallo

import
  os, strutils, macros

type
  TMyEnum = enum
    meA, meB, meC, meD

when isMainModule:
  {.hint: "this is the main file".}

proc fac[T](x: T): T =
  # test recursive generic procs
  if x <= 1: return 1
  else: return x.`*`(fac(x-1))

macro macrotest(n: expr): stmt =
  expectKind(n, nnkCall)
  expectMinLen(n, 2)
  result = newNimNode(nnkStmtList, n)
  for i in 2..n.len-1:
    result.add(newCall("write", n[1], n[i]))
  result.add(newCall("writeln", n[1], newStrLitNode("")))

macro debug(n: expr): stmt =
  result = newNimNode(nnkStmtList, n)
  for i in 1..n.len-1:
    result.add(newCall("write", newIdentNode("stdout"), toStrLit(n[i])))
    result.add(newCall("write", newIdentNode("stdout"), newStrLitNode(": ")))
    result.add(newCall("writeln", newIdentNode("stdout"), n[i]))

macrotest(stdout, "finally", 4, 5, "variable", "argument lists")
macrotest(stdout)

#GC_disable()

echo("This was compiled by Nimrod version " & system.nimrodVersion)
writeln(stdout, "Hello", " World", "!")

echo(["a", "b", "c", "d"].len)
for x in items(["What's", "your", "name", "?", ]):
  echo(x)
var `name` = readLine(stdin)
{.breakpoint.}
echo("Hi " & thallo.name & "!\n")
debug(name)

var testseq: seq[string] = @[
  "a", "b", "c", "d", "e"
]
echo(repr(testseq))

var dummy = "hello"
echo(copy(dummy, 2, 3))

echo($meC)

# test tuples:
for x, y in items([(1, 2), (3, 4), (6, 1), (5, 2)]):
  echo x
  echo y

proc simpleConst(): int = return 34

# test constant evaluation:
const
  constEval3 = simpleConst()
  constEval = "abc".contains('b')
  constEval2 = fac(7)

echo(constEval3)
echo(constEval)
echo(constEval2)
echo(1.`+`(2))

for i in 2..6:
  for j in countdown(i+4, 2):
    echo(fac(i * j))

when isMainModule:
  {.hint: "this is the main file".}