summary refs log tree commit diff stats
path: root/lib/core
diff options
context:
space:
mode:
Diffstat (limited to 'lib/core')
-rw-r--r--lib/core/locks.nim5
-rw-r--r--lib/core/macros.nim35
2 files changed, 36 insertions, 4 deletions
diff --git a/lib/core/locks.nim b/lib/core/locks.nim
index fbe9c8acf..f9add0037 100644
--- a/lib/core/locks.nim
+++ b/lib/core/locks.nim
@@ -19,6 +19,8 @@ type
 
 {.deprecated: [TLock: Lock, TCond: Cond].}
 
+{.push stackTrace: off.}
+
 proc initLock*(lock: var Lock) {.inline.} =
   ## Initializes the given lock.
   initSysLock(lock)
@@ -59,9 +61,12 @@ proc signal*(cond: var Cond) {.inline.} =
 template withLock*(a: Lock, body: untyped) =
   ## Acquires the given lock, executes the statements in body and
   ## releases the lock after the statements finish executing.
+  mixin acquire, release
   a.acquire()
   {.locks: [a].}:
     try:
       body
     finally:
       a.release()
+
+{.pop.}
diff --git a/lib/core/macros.nim b/lib/core/macros.nim
index af1e9de28..3473c5d7e 100644
--- a/lib/core/macros.nim
+++ b/lib/core/macros.nim
@@ -317,10 +317,30 @@ proc toStrLit*(n: NimNode): NimNode {.compileTime.} =
   ## in a string literal node
   return newStrLitNode(repr(n))
 
-proc lineinfo*(n: NimNode): string {.magic: "NLineInfo", noSideEffect.}
+type
+  LineInfo* = object
+    filename*: string
+    line*,column*: int
+
+proc `$`*(arg: Lineinfo): string =
+  result = arg.filename & "(" & $arg.line & ", " & $arg.column & ")"
+
+#proc lineinfo*(n: NimNode): LineInfo {.magic: "NLineInfo", noSideEffect.}
   ## returns the position the node appears in the original source file
   ## in the form filename(line, col)
 
+proc getLine(arg: NimNode): int {.magic: "NLineInfo", noSideEffect.}
+proc getColumn(arg: NimNode): int {.magic: "NLineInfo", noSideEffect.}
+proc getFile(arg: NimNode): string {.magic: "NLineInfo", noSideEffect.}
+
+proc lineInfoObj*(n: NimNode): LineInfo {.compileTime.} =
+  result.filename = n.getFile
+  result.line = n.getLine
+  result.column = n.getColumn
+
+proc lineInfo*(arg: NimNode): string {.compileTime.} =
+  $arg.lineInfoObj
+
 proc internalParseExpr(s: string): NimNode {.
   magic: "ParseExprToAst", noSideEffect.}
 
@@ -527,10 +547,17 @@ proc newLit*[N,T](arg: array[N,T]): NimNode {.compileTime.} =
     result.add newLit(x)
 
 proc newLit*[T](arg: seq[T]): NimNode {.compileTime.} =
-  result = nnkBracket.newTree
+  var bracket = nnkBracket.newTree
   for x in arg:
-    result.add newLit(x)
-  result = nnkPrefix.newTree(bindSym"@", result)
+    bracket.add newLit(x)
+
+  result = nnkCall.newTree(
+    nnkBracketExpr.newTree(
+      nnkAccQuoted.newTree( bindSym"@" ),
+      getTypeInst( bindSym"T" )
+    ),
+    bracket
+  )
 
 proc newLit*(arg: tuple): NimNode {.compileTime.} =
   result = nnkPar.newTree
9 +0200 fixed a nuance in dwm.1' href='/acidbong/suckless/dwm/commit/dwm.1?h=6.1&id=f17e898bd133f1bd8c530116b4b5bacb7ced5da9'>f17e898 ^
e6cbe9c ^
cdbc84b ^
84432e6 ^
338c083 ^

84432e6 ^

1a25414 ^

b439892 ^
caf5a16 ^
901b3ed ^
1076f2b

901b3ed ^
0c3544d ^
2b35fae ^

a3e3f0b ^

2b35fae ^
3e06ede ^
cdbc84b ^
338c083 ^
292ccc4 ^
d4b7a9a ^
10885d3 ^
1836b67 ^
ee8fb0c ^
7ab8c87 ^
1836b67 ^
ee8fb0c ^
7ab8c87 ^
2b35fae ^
72655f0 ^
ee8fb0c ^
df74b26 ^
0ea0343 ^
72655f0 ^
ee8fb0c ^
5871008 ^
cb9607c ^
fef6c5c ^


ee8fb0c ^
7ab8c87 ^
72655f0 ^
ee8fb0c ^
7ab8c87 ^
3af6434 ^
85c9ebf ^
2122e39 ^

85c9ebf ^
2122e39 ^

85c9ebf ^
7969250 ^
6499fc4 ^
85c9ebf ^
7969250 ^

85c9ebf ^
7969250 ^

85c9ebf ^
7969250 ^
9066ee2 ^
ee8fb0c ^
338c083 ^
352cae4 ^
ee8fb0c ^
1549faf ^
7ab8c87 ^

1549faf ^
ee8fb0c ^
42fd392 ^

ee8fb0c ^
df74b26 ^
7ab8c87 ^

df74b26 ^
ee8fb0c ^
7ab8c87 ^
45aea23 ^
ee8fb0c ^
338c083 ^
1549faf ^
ee8fb0c ^
338c083 ^
8dc8605 ^
ee8fb0c ^
df74b26 ^
7ab8c87 ^

1549faf ^
ee8fb0c ^
7ab8c87 ^
daae3bb ^
ee8fb0c ^
3e06ede ^
7ab8c87 ^

4bb89e2 ^
ee8fb0c ^
7ab8c87 ^
2b35fae ^
0c3544d ^
ee8fb0c ^
338c083 ^
0e5c819 ^
ee8fb0c ^
5871008 ^
4bd0d33 ^
ee8fb0c ^
338c083 ^
0c3544d ^
7ab8c87 ^
dc5c070 ^
7e98db2 ^

bced907 ^
60b3dce ^
21bd90d ^
c8f96b5 ^
4bb89e2 ^
c8f96b5 ^



c7da124 ^


c8f96b5 ^

124866e ^







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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165