diff src/config.d @ 839:4063da6f3edd default tip

Refactored the config file and how it is loaded.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Thu, 21 Aug 2008 17:51:04 +0200
parents bcb74c9b895c
children
line wrap: on
line diff
--- a/src/config.d	Wed Aug 20 20:39:16 2008 +0200
+++ b/src/config.d	Thu Aug 21 17:51:04 2008 +0200
@@ -1,34 +1,57 @@
 /// The configuration file of dil.
 ///
-/// Relative paths are resolved from the directory of the executable.
+/// The file is searched for in the following order:
+/// $(OL
+///   $(LI The environment variable DILCONF.)
+///   $(LI The current working directory.)
+///   $(LI The directory set in the environment variable HOME.)
+///   $(LI The executable's directory.)
+/// )
+/// The program will fail with an error msg if the file couldn't be found.$(BR)
+///
+/// The following variables are expanded inside strings (only where paths are expected):
+/// $(UL
+///   $(LI ${DATADIR} -> the data directory of dil (e.g. /home/user/dil/bin/data or C:\dil\bin\data).)
+///   $(LI ${HOME} -> the home directory (e.g. /home/name or C:\Documents and Settings\name).)
+///   $(LI ${EXECDIR} -> the absolute path to the directory of dil's executable (e.g. /home/name/dil/bin).)
+/// )
 module config;
 
+/// Files needed by dil are located in this directory.
+///
+/// A relative path is resolved from the directory of dil's executable.
+var DATADIR = "data/";
+
 /// Predefined version identifiers.
-var version_ids = ["X86", "linux", "LittleEndian"];
+var VERSION_IDS = ["X86", "linux", "LittleEndian"];
 // "X86_64", "Windows", "Win32", "Win64", "BigEndian"
 
-/// Path to the language file.
-var langfile = "lang_en.d";
-
 /// An array of import paths to look for modules.
-var import_paths = []; /// E.g.: ["src/", "import/"]
+///
+/// Relative paths are resolved from the current working directory.
+var IMPORT_PATHS = []; /// E.g.: ["src/", "import/"]
 
 /// DDoc macro file paths.
 ///
-/// Macro definitions in ddoc_files[n] override the ones in ddoc_files[n-1].
-var ddoc_files = ["predefined.ddoc"]; /// E.g.: ["src/mymacros.ddoc", "othermacros.ddoc"]
+/// Macro definitions in ddoc_files[n] override the ones in ddoc_files[n-1].$(BR)
+/// Relative paths are resolved from the current working directory.
+var DDOC_FILES = ["${DATADIR}/predefined.ddoc"]; /// E.g.: ["src/mymacros.ddoc", "othermacros.ddoc"]
 
-var xml_map = "xml_map.d";
-var html_map = "html_map.d";
+/// Path to the language file.
+var LANG_FILE = "${DATADIR}/lang_en.d";
+/// Path to the xml map.
+var XML_MAP = "${DATADIR}/xml_map.d";
+/// Path to the html map.
+var HTML_MAP = "${DATADIR}/html_map.d";
 
 /// Customizable formats for error messages.
 ///
-/// <ul>
-///   <li>0: file path to the source text.</li>
-///   <li>1: line number.</li>
-///   <li>2: column number.</li>
-///   <li>3: error message.</li>
-/// </ul>
-var lexer_error = "{0}({1},{2})L: {3}";
-var parser_error = "{0}({1},{2})P: {3}"; /// ditto
-var semantic_error = "{0}({1},{2})S: {3}"; /// ditto
+/// $(UL
+///   $(LI 0: file path to the source text.)
+///   $(LI 1: line number.)
+///   $(LI 2: column number.)
+///   $(LI 3: error message.)
+/// )
+var LEXER_ERROR = "{0}({1},{2})L: {3}";
+var PARSER_ERROR = "{0}({1},{2})P: {3}"; /// ditto
+var SEMANTIC_ERROR = "{0}({1},{2})S: {3}"; /// ditto