summary refs log tree commit diff stats
path: root/lib/system.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/system.nim')
-rw-r--r--lib/system.nim39
1 files changed, 23 insertions, 16 deletions
diff --git a/lib/system.nim b/lib/system.nim
index 1f09a6d2b..03275b8fa 100644
--- a/lib/system.nim
+++ b/lib/system.nim
@@ -98,16 +98,8 @@ type
 
 proc defined*(x: expr): bool {.magic: "Defined", noSideEffect.}
   ## Special compile-time procedure that checks whether `x` is
-  ## defined. `x` has to be an identifier or a qualified identifier.
-  ## This can be used to check whether a library provides a certain
-  ## feature or not:
-  ##
-  ## .. code-block:: Nimrod
-  ##   when not defined(strutils.toUpper):
-  ##     # provide our own toUpper proc here, because strutils is
-  ##     # missing it.
-  ##
-  ## You can also check external symbols introduced through the compiler's
+  ## defined.
+  ## `x` is an external symbol introduced through the compiler's
   ## `-d:x switch <nimrodc.html#compile-time-symbols>`_ to enable build time
   ## conditionals:
   ##
@@ -116,13 +108,28 @@ proc defined*(x: expr): bool {.magic: "Defined", noSideEffect.}
   ##     # Do here programmer friendly expensive sanity checks.
   ##   # Put here the normal code
 
+proc declared*(x: expr): bool {.magic: "Defined", noSideEffect.}
+  ## Special compile-time procedure that checks whether `x` is
+  ## declared. `x` has to be an identifier or a qualified identifier.
+  ## This can be used to check whether a library provides a certain
+  ## feature or not:
+  ##
+  ## .. code-block:: Nimrod
+  ##   when not defined(strutils.toUpper):
+  ##     # provide our own toUpper proc here, because strutils is
+  ##     # missing it.
+
 when defined(useNimRtl):
   {.deadCodeElim: on.}
 
 proc definedInScope*(x: expr): bool {.
-  magic: "DefinedInScope", noSideEffect.}
+  magic: "DefinedInScope", noSideEffect, deprecated.}
+  ## **Deprecated since version 0.9.6**: Use ``declaredInScope`` instead.
+
+proc declaredInScope*(x: expr): bool {.
+  magic: "DefinedInScope", noSideEffect, deprecated.}
   ## Special compile-time procedure that checks whether `x` is
-  ## defined in the current scope. `x` has to be an identifier.
+  ## declared in the current scope. `x` has to be an identifier.
 
 proc `not` *(x: bool): bool {.magic: "Not", noSideEffect.}
   ## Boolean not; returns true iff ``x == false``.
@@ -2118,7 +2125,7 @@ template newException*(exceptn: typedesc, message: string): expr =
 when hostOS == "standalone":
   include panicoverride
 
-when not defined(sysFatal):
+when not declared(sysFatal):
   template sysFatal(exceptn: typedesc, message: string) =
     when hostOS == "standalone":
       panic(message)
@@ -2170,7 +2177,7 @@ when not defined(JS): #and not defined(NimrodVM):
       # WARNING: This is very fragile! An array size of 8 does not work on my
       # Linux 64bit system. -- That's because the stack direction is the other
       # way round.
-      when defined(setStackBottom):
+      when declared(setStackBottom):
         var locals {.volatile.}: pointer
         locals = addr(locals)
         setStackBottom(locals)
@@ -2443,7 +2450,7 @@ when not defined(JS): #and not defined(NimrodVM):
       hasRaiseAction: bool
       raiseAction: proc (e: ref E_Base): bool {.closure.}
   
-  when defined(initAllocator):
+  when declared(initAllocator):
     initAllocator()
   when hasThreadSupport:
     include "system/syslocks"
@@ -3016,7 +3023,7 @@ proc compiles*(x): bool {.magic: "Compiles", noSideEffect.} =
   ##     echo "'+' for integers is available"
   discard
 
-when defined(initDebugger):
+when declared(initDebugger):
   initDebugger()
 
 when hostOS != "standalone":
iv class='alt'>
7e747d11c ^
40ec7be45 ^
7e747d11c ^

6e6c3d2f1 ^










dd35111ff ^
6e6c3d2f1 ^
2a8bf470a ^
7e747d11c ^

6e6c3d2f1 ^








cca5684a1 ^





6e6c3d2f1 ^


84d122b5c ^
6e6c3d2f1 ^



7e747d11c ^
6e6c3d2f1 ^
dd35111ff ^
6e6c3d2f1 ^







7e747d11c ^

6e6c3d2f1 ^

7e747d11c ^
6e6c3d2f1 ^
7e747d11c ^

6e6c3d2f1 ^




dd35111ff ^
6e6c3d2f1 ^




796498525 ^
d68181246 ^
dd35111ff ^
20b011de1 ^
dd35111ff ^
6e6c3d2f1 ^
7e747d11c ^
6e6c3d2f1 ^
7e747d11c ^
d68181246 ^
7e747d11c ^

ce859d8c1 ^
6e6c3d2f1 ^
d68181246 ^
fb3ff6445 ^
7e747d11c ^
6e6c3d2f1 ^
ce859d8c1 ^
6e6c3d2f1 ^
7e747d11c ^
f344a7041 ^

6e6c3d2f1 ^
f344a7041 ^
d68181246 ^
6e6c3d2f1 ^
ef2998778 ^

6e6c3d2f1 ^
7e747d11c ^

6e6c3d2f1 ^
cca5684a1 ^





6e6c3d2f1 ^

84d122b5c ^
6e6c3d2f1 ^


cca5684a1 ^
bebac34f8 ^


db603237c ^

ef2998778 ^
6e6c3d2f1 ^


77406dd59 ^
6e6c3d2f1 ^
2a7fc84c8 ^
6e6c3d2f1 ^


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
166
167
168
169
170
171