summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xrod/commands.nim8
-rwxr-xr-xrod/condsyms.nim12
-rwxr-xr-xrod/evals.nim4
-rwxr-xr-xrod/extccomp.nim2
-rwxr-xr-xrod/main.nim4
-rwxr-xr-xrod/msgs.nim15
-rwxr-xr-xrod/nimconf.nim6
-rwxr-xr-xrod/rodread.nim6
-rw-r--r--rod/suggest.nim10
-rwxr-xr-xrod/syntaxes.nim2
10 files changed, 36 insertions, 33 deletions
diff --git a/rod/commands.nim b/rod/commands.nim
index 6ba615cf1..83c01f0ed 100755
--- a/rod/commands.nim
+++ b/rod/commands.nim
@@ -129,14 +129,14 @@ var
 proc HelpOnError(pass: TCmdLinePass) = 
   if (pass == passCmd1) and not helpWritten: 
     # BUGFIX 19
-    MessageOut(getCommandLineDesc())
+    MsgWriteln(getCommandLineDesc())
     helpWritten = true
     quit(0)
 
 proc writeAdvancedUsage(pass: TCmdLinePass) = 
   if (pass == passCmd1) and not advHelpWritten: 
     # BUGFIX 19
-    MessageOut(`%`(HelpMessage, [VersionAsString, 
+    MsgWriteln(`%`(HelpMessage, [VersionAsString, 
                                  platform.os[platform.hostOS].name, 
                                  cpu[platform.hostCPU].name]) & AdvancedUsage)
     advHelpWritten = true
@@ -147,14 +147,14 @@ proc writeVersionInfo(pass: TCmdLinePass) =
   if (pass == passCmd1) and not versionWritten: 
     versionWritten = true
     helpWritten = true
-    messageOut(`%`(HelpMessage, [VersionAsString, 
+    MsgWriteln(`%`(HelpMessage, [VersionAsString, 
                                  platform.os[platform.hostOS].name, 
                                  cpu[platform.hostCPU].name]))
     quit(0)
 
 proc writeCommandLineUsage() = 
   if not helpWritten: 
-    messageOut(getCommandLineDesc())
+    MsgWriteln(getCommandLineDesc())
     helpWritten = true
 
 proc InvalidCmdLineOption(pass: TCmdLinePass, switch: string, info: TLineInfo) = 
diff --git a/rod/condsyms.nim b/rod/condsyms.nim
index b6c3b90af..7a7505511 100755
--- a/rod/condsyms.nim
+++ b/rod/condsyms.nim
@@ -44,11 +44,11 @@ proc isDefined(symbol: PIdent): bool =
 proc ListSymbols() = 
   var it: TTabIter
   var s = InitTabIter(it, gSymbols)
-  MessageOut("-- List of currently defined symbols --")
+  OutWriteln("-- List of currently defined symbols --")
   while s != nil: 
-    if s.position == 1: MessageOut(s.name.s)
+    if s.position == 1: OutWriteln(s.name.s)
     s = nextIter(it, gSymbols)
-  MessageOut("-- End of list --")
+  OutWriteln("-- End of list --")
 
 proc countDefinedSymbols(): int = 
   var it: TTabIter
@@ -67,8 +67,7 @@ proc InitDefines() =
   of cpuI386: DefineSymbol("x86")
   of cpuIa64: DefineSymbol("itanium")
   of cpuAmd64: DefineSymbol("x8664")
-  else: 
-    nil
+  else: nil
   case targetOS
   of osDOS: 
     DefineSymbol("msdos")
@@ -93,8 +92,7 @@ proc InitDefines() =
     DefineSymbol("macintosh")
     DefineSymbol("unix")
     DefineSymbol("posix")
-  else: 
-    nil
+  else: nil
   DefineSymbol("cpu" & $cpu[targetCPU].bit)
   DefineSymbol(normalize(endianToStr[cpu[targetCPU].endian]))
   DefineSymbol(cpu[targetCPU].name)
diff --git a/rod/evals.nim b/rod/evals.nim
index bb32804fe..c4b054437 100755
--- a/rod/evals.nim
+++ b/rod/evals.nim
@@ -79,11 +79,11 @@ proc stackTraceAux(x: PStackFrame) =
   if x != nil:
     stackTraceAux(x.next)
     var info = if x.call != nil: x.call.info else: UnknownLineInfo()
-    messageOut(`%`("file: $1, line: $2", 
+    MsgWriteln(`%`("file: $1, line: $2", 
                    [toFilename(info), $(toLineNumber(info))]))
 
 proc stackTrace(c: PEvalContext, n: PNode, msg: TMsgKind, arg: string = "") = 
-  messageOut("stack trace: (most recent call last)")
+  MsgWriteln("stack trace: (most recent call last)")
   stackTraceAux(c.tos)
   Fatal(n.info, msg, arg)
 
diff --git a/rod/extccomp.nim b/rod/extccomp.nim
index bb29cea33..ea64c16b6 100755
--- a/rod/extccomp.nim
+++ b/rod/extccomp.nim
@@ -318,7 +318,7 @@ proc addFileToLink*(filename: string) =
   # BUGFIX: was ``appendStr``
 
 proc execExternalProgram*(cmd: string) = 
-  if (optListCmd in gGlobalOptions) or (gVerbosity > 0): MessageOut(cmd)
+  if (optListCmd in gGlobalOptions) or (gVerbosity > 0): MsgWriteln(cmd)
   if execCmd(cmd) != 0: rawMessage(errExecutionOfProgramFailed, "")
 
 proc generateScript(projectFile: string, script: PRope) = 
diff --git a/rod/main.nim b/rod/main.nim
index 55ac32caa..2ec65be58 100755
--- a/rod/main.nim
+++ b/rod/main.nim
@@ -254,7 +254,7 @@ proc MainCommand(cmd, filename: string) =
   of wDump: 
     gCmd = cmdDump
     condsyms.ListSymbols()
-    for it in iterSearchPath(): MessageOut(it)
+    for it in iterSearchPath(): MsgWriteln(it)
   of wCheck: 
     gCmd = cmdCheck
     wantFile(filename)
@@ -267,7 +267,7 @@ proc MainCommand(cmd, filename: string) =
     gCmd = cmdScan
     wantFile(filename)
     CommandScan(filename)
-    MessageOut("Beware: Indentation tokens depend on the parser\'s state!")
+    MsgWriteln("Beware: Indentation tokens depend on the parser\'s state!")
   of wI: 
     gCmd = cmdInteractive
     CommandInteractive()
diff --git a/rod/msgs.nim b/rod/msgs.nim
index ef3886344..dd60c4cae 100755
--- a/rod/msgs.nim
+++ b/rod/msgs.nim
@@ -438,10 +438,15 @@ proc addCheckpoint*(info: TLineInfo) =
 proc addCheckpoint*(filename: string, line: int) = 
   addCheckpoint(newLineInfo(filename, line, - 1))
 
-proc MessageOut*(s: string) = 
-  # change only this proc to put it elsewhere
+proc OutWriteln*(s: string) = 
+  ## Writes to stdout. Always.
   Writeln(stdout, s)
  
+proc MsgWriteln*(s: string) = 
+  ## Writes to stdout. If --stdout option is given, writes to stderr instead.
+  if optStdout in gGlobalOptions: Writeln(stderr, s)
+  else: Writeln(stdout, s)
+
 proc coordToStr(coord: int): string = 
   if coord == -1: result = "???"
   else: result = $coord
@@ -493,7 +498,7 @@ proc writeContext(lastinfo: TLineInfo) =
   for i in countup(0, len(msgContext) - 1): 
     if not sameLineInfo(msgContext[i], lastInfo) and
         not sameLineInfo(msgContext[i], info): 
-      MessageOut(`%`(posErrorFormat, [toFilename(msgContext[i]), 
+      MsgWriteln(`%`(posErrorFormat, [toFilename(msgContext[i]), 
                                       coordToStr(msgContext[i].line), 
                                       coordToStr(msgContext[i].col), 
                                       getMessageStr(errInstantiationFrom, "")]))
@@ -515,7 +520,7 @@ proc rawMessage*(msg: TMsgKind, args: openarray[string]) =
     if not (msg in gNotes): return 
     frmt = rawHintFormat
     inc(gHintCounter)
-  MessageOut(`%`(frmt, `%`(msgKindToString(msg), args)))
+  MsgWriteln(`%`(frmt, `%`(msgKindToString(msg), args)))
   handleError(msg, doAbort)
 
 proc rawMessage*(msg: TMsgKind, arg: string) = 
@@ -545,7 +550,7 @@ proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string,
     frmt = posHintFormat
     inc(gHintCounter)
   if not ignoreMsg:
-    MessageOut(frmt % [toFilename(info), coordToStr(info.line),
+    MsgWriteln(frmt % [toFilename(info), coordToStr(info.line),
                        coordToStr(info.col), getMessageStr(msg, arg)])
   handleError(msg, eh)
   
diff --git a/rod/nimconf.nim b/rod/nimconf.nim
index 836be5097..231377978 100755
--- a/rod/nimconf.nim
+++ b/rod/nimconf.nim
@@ -1,7 +1,7 @@
 #
 #
 #           The Nimrod Compiler
-#        (c) Copyright 2008 Andreas Rumpf
+#        (c) Copyright 2011 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
@@ -139,7 +139,7 @@ proc parseDirective(L: var TLexer, tok: PToken) =
     doEnd(L, tok)
   of wWrite: 
     ppGetTok(L, tok)
-    msgs.MessageOut(tokToStr(tok))
+    msgs.MsgWriteln(tokToStr(tok))
     ppGetTok(L, tok)
   of wPutEnv: 
     ppGetTok(L, tok)
@@ -254,4 +254,4 @@ proc LoadConfig(project: string) =
   if not (optSkipProjConfigFile in gGlobalOptions) and (project != ""): 
     conffile = changeFileExt(project, "cfg")
     if existsFile(conffile): readConfigFile(conffile)
-  
\ No newline at end of file
+  
diff --git a/rod/rodread.nim b/rod/rodread.nim
index 3159ec961..36cb29185 100755
--- a/rod/rodread.nim
+++ b/rod/rodread.nim
@@ -1,7 +1,7 @@
 #
 #
 #           The Nimrod Compiler
-#        (c) Copyright 2010 Andreas Rumpf
+#        (c) Copyright 2011 Andreas Rumpf
 #
 #    See the file "copying.txt", included in this
 #    distribution, for details about the copyright.
@@ -648,7 +648,7 @@ proc processRodFile(r: PRodReader, crc: TCrc32) =
       r.cgenIdx = r.pos + 2
       skipSection(r)
     else: 
-      MessageOut("skipping section: " & $r.pos)
+      MsgWriteln("skipping section: " & $r.pos)
       skipSection(r)
     if r.s[r.pos] == '\x0A': 
       inc(r.pos)
@@ -810,7 +810,7 @@ proc checkDep(filename: string): TReasonForRecompile =
   else: 
     result = rrRodDoesNotExist
   if (result != rrNone) and (gVerbosity > 0): 
-    MessageOut(`%`(reasonToFrmt[result], [filename]))
+    MsgWriteln(`%`(reasonToFrmt[result], [filename]))
   if (result != rrNone) or (optForceFullMake in gGlobalOptions): 
     # recompilation is necessary:
     r = nil
diff --git a/rod/suggest.nim b/rod/suggest.nim
index ab1119f9c..f553bde90 100644
--- a/rod/suggest.nim
+++ b/rod/suggest.nim
@@ -42,13 +42,13 @@ proc filterSym(s: PSym): bool {.inline.} =
 
 proc suggestField(s: PSym) = 
   if filterSym(s):
-    MessageOut(SymToStr(s, isLocal=true, sectionSuggest))
+    OutWriteln(SymToStr(s, isLocal=true, sectionSuggest))
 
 template wholeSymTab(cond, section: expr) = 
   for i in countdown(c.tab.tos-1, 0): 
     for it in items(c.tab.stack[i]): 
       if cond:
-        MessageOut(SymToStr(it, isLocal = i > ModuleTablePos, section))
+        OutWriteln(SymToStr(it, isLocal = i > ModuleTablePos, section))
 
 proc suggestSymList(list: PNode) = 
   for i in countup(0, sonsLen(list) - 1): 
@@ -115,11 +115,11 @@ proc suggestFieldAccess(c: PContext, n: PNode) =
         # all symbols accessible, because we are in the current module:
         for it in items(c.tab.stack[ModuleTablePos]): 
           if filterSym(it): 
-            MessageOut(SymToStr(it, isLocal=false, sectionSuggest))
+            OutWriteln(SymToStr(it, isLocal=false, sectionSuggest))
       else: 
         for it in items(n.sym.tab): 
           if filterSym(it): 
-            MessageOut(SymToStr(it, isLocal=false, sectionSuggest))
+            OutWriteln(SymToStr(it, isLocal=false, sectionSuggest))
     else:
       # fallback:
       suggestEverything(c, n)
@@ -228,7 +228,7 @@ proc suggestExpr*(c: PContext, node: PNode) =
   
   if optDef in gGlobalOptions:
     var n = findClosestSym(fuzzySemCheck(c, node))
-    if n != nil: MessageOut(SymToStr(n.sym, isLocal=false, sectionDef))
+    if n != nil: OutWriteln(SymToStr(n.sym, isLocal=false, sectionDef))
   quit(0)
 
 proc suggestStmt*(c: PContext, n: PNode) = 
diff --git a/rod/syntaxes.nim b/rod/syntaxes.nim
index 44c594fea..adb17efee 100755
--- a/rod/syntaxes.nim
+++ b/rod/syntaxes.nim
@@ -140,7 +140,7 @@ proc applyFilter(p: var TParsers, n: PNode, filename: string,
   if f != filtNone: 
     if gVerbosity >= 2: 
       rawMessage(hintCodeBegin, [])
-      messageOut(result.s)
+      MsgWriteln(result.s)
       rawMessage(hintCodeEnd, [])
 
 proc evalPipe(p: var TParsers, n: PNode, filename: string, 
Kartik K. Agaram <vc@akkartik.com> 2016-02-25 07:46:56 -0800 2701 - turn some warnings into errors' href='/akkartik/mu/commit/060immutable.cc?h=main&id=f51e9f63b40ce3d5c4d40808bf1b7e83ab7d60ff'>f51e9f63 ^
1ead3562 ^
e4ecdb0a ^
455fbac6 ^
e4ecdb0a ^

1ead3562 ^
e4ecdb0a ^



1ead3562 ^
e4ecdb0a ^




f51e9f63 ^
e4ecdb0a ^
41ac8877 ^
f51e9f63 ^
1ead3562 ^
41ac8877 ^
455fbac6 ^
41ac8877 ^

1ead3562 ^
41ac8877 ^

455fbac6 ^
41ac8877 ^

f51e9f63 ^
41ac8877 ^
aed29290 ^
1ead3562 ^
aed29290 ^



1ead3562 ^
aed29290 ^











1ead3562 ^
aed29290 ^

1ead3562 ^
aed29290 ^











1ead3562 ^
aed29290 ^

1ead3562 ^
aed29290 ^













1ead3562 ^
aed29290 ^

1ead3562 ^
aed29290 ^











1ead3562 ^
aed29290 ^

1ead3562 ^
aed29290 ^







e4ecdb0a ^
e4ecdb0a ^
455fbac6 ^
e4ecdb0a ^
1ead3562 ^
e4ecdb0a ^
455fbac6 ^
e4ecdb0a ^

1ead3562 ^
e4ecdb0a ^

455fbac6 ^
e4ecdb0a ^
1ead3562 ^
e4ecdb0a ^



f51e9f63 ^
e4ecdb0a ^
62a390ca ^
1ead3562 ^
455fbac6 ^
62a390ca ^


1ead3562 ^
62a390ca ^




1ead3562 ^
62a390ca ^

455fbac6 ^
62a390ca ^
f51e9f63 ^
62a390ca ^
078f48f5 ^

1ead3562 ^
078f48f5 ^



1ead3562 ^
078f48f5 ^

1ead3562 ^
078f48f5 ^
1ead3562 ^
078f48f5 ^


a70ce311 ^
078f48f5 ^


e4ecdb0a ^




f343a921 ^



e4ecdb0a ^
996a8acd ^
e4ecdb0a ^
b24eb476 ^
e4ecdb0a ^



078f48f5 ^

b24eb476 ^
41ac8877 ^
b1bb6e53 ^
41ac8877 ^
e4ecdb0a ^



078f48f5 ^
b24eb476 ^
e4ecdb0a ^

aed29290 ^

b24eb476 ^
aed29290 ^






078f48f5 ^
aed29290 ^


41ac8877 ^
e4ecdb0a ^


b24eb476 ^

d332bec1 ^
078f48f5 ^
d332bec1 ^
41ac8877 ^


b24eb476 ^
078f48f5 ^
d332bec1 ^
b24eb476 ^
62a390ca ^
078f48f5 ^
62a390ca ^
b24eb476 ^

d332bec1 ^
078f48f5 ^
d332bec1 ^
078f48f5 ^
d332bec1 ^






f51e9f63 ^
d332bec1 ^
455fbac6 ^
d332bec1 ^
1ead3562 ^
d332bec1 ^
455fbac6 ^
d332bec1 ^

1ead3562 ^
d332bec1 ^

455fbac6 ^

d332bec1 ^
1ead3562 ^
d332bec1 ^



f51e9f63 ^
d332bec1 ^

078f48f5 ^
5e1f318d ^
b24eb476 ^
5e1f318d ^
078f48f5 ^
aed29290 ^
5e1f318d ^



b24eb476 ^
41ac8877 ^
b24eb476 ^

41ac8877 ^




b1bb6e53 ^
5e1f318d ^
b1bb6e53 ^
1b76245c ^
b1bb6e53 ^
1b76245c ^
b1bb6e53 ^
41ac8877 ^



b1bb6e53 ^

1b76245c ^
b1bb6e53 ^
1b76245c ^
b1bb6e53 ^
41ac8877 ^
e4ecdb0a ^


b24eb476 ^
e4ecdb0a ^

1b76245c ^
e4ecdb0a ^

62a390ca ^
e4ecdb0a ^



b24eb476 ^
e4ecdb0a ^






b24eb476 ^
e4ecdb0a ^





b24eb476 ^


e167fdf4 ^
078f48f5 ^
41ac8877 ^
e4ecdb0a ^
41ac8877 ^
e4ecdb0a ^














e4ecdb0a ^
455fbac6 ^
e4ecdb0a ^
1ead3562 ^
e4ecdb0a ^
455fbac6 ^
e4ecdb0a ^

1ead3562 ^
e4ecdb0a ^

455fbac6 ^
e4ecdb0a ^

1ead3562 ^
e4ecdb0a ^



1ead3562 ^
e4ecdb0a ^

455fbac6 ^
e4ecdb0a ^
f51e9f63 ^
e4ecdb0a ^






1b76245c ^
e4ecdb0a ^

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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481