comparison trunk/src/dil/Messages.d @ 798:c24be8d4f6ab

Added documentation comments.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sat, 01 Mar 2008 02:53:06 +0100
parents c1d5cfd7aa44
children cb8040538772
comparison
equal deleted inserted replaced
797:cf2ad5df025c 798:c24be8d4f6ab
1 /++ 1 /++
2 Author: Aziz Köksal 2 Author: Aziz Köksal
3 License: GPL3 3 License: GPL3
4 +/ 4 +/
5 module dil.Messages; 5 module dil.Messages;
6
6 import common; 7 import common;
7 8
8 /// Index into table of compiler messages. 9 /// Enumeration of indices into the table of compiler messages.
9 enum MID 10 enum MID
10 { 11 {
11 // Lexer messages: 12 // Lexer messages:
12 IllegalCharacter, 13 IllegalCharacter,
13 // InvalidUnicodeCharacter, 14 // InvalidUnicodeCharacter,
70 HelpMain, 71 HelpMain,
71 HelpGenerate, 72 HelpGenerate,
72 HelpImportGraph, 73 HelpImportGraph,
73 } 74 }
74 75
75 private string[] messages; 76 /// The table of compiler messages.
77 private string[] g_compilerMessages;
76 78
77 static this() 79 static this()
78 { 80 {
79 messages = new string[MID.max+1]; 81 g_compilerMessages = new string[MID.max+1];
80 } 82 }
81 83
84 /// Sets the compiler messages.
82 void SetMessages(string[] msgs) 85 void SetMessages(string[] msgs)
83 { 86 {
84 assert(MID.max+1 == msgs.length); 87 assert(MID.max+1 == msgs.length);
85 messages = msgs; 88 g_compilerMessages = msgs;
86 } 89 }
87 90
91 /// Returns the compiler message for mid.
88 string GetMsg(MID mid) 92 string GetMsg(MID mid)
89 { 93 {
90 assert(mid < messages.length); 94 assert(mid < g_compilerMessages.length);
91 return messages[mid]; 95 return g_compilerMessages[mid];
92 } 96 }
93 97
98 /// Returns a formatted string.
94 char[] FormatMsg(MID mid, ...) 99 char[] FormatMsg(MID mid, ...)
95 { 100 {
96 return Format(_arguments, _argptr, GetMsg(mid)); 101 return Format(_arguments, _argptr, GetMsg(mid));
97 } 102 }
98 103