Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor|libdeng2: Replaced /config with /modules
There is no need to have a folder just for config scripts. Instead, the /modules folder is now used for storing all scripts. Added the recutil.de module: Record manipulation utilities.
- Loading branch information
Showing
9 changed files
with
170 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
# The Doomsday Engine Project -- libdeng2 | ||
# | ||
# Copyright (c) 2012 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
|
||
#---------------------------------------------------------------------------- | ||
# MAIN CONFIGURATION FOR LIBDENG2 | ||
# | ||
# This module is the special Config namespace, reserved for the engine's | ||
# configuration variables and routines. The namespace is stored persistently | ||
# (persist.pack/modules/Config). The script is executed only when it has | ||
# been updated or when __version__ has changed. | ||
|
||
# Cleanup: this is a persistent namespace so old stuff may be hanging around. | ||
for name in ['setDefaults', 'updateWithDefaults'] | ||
if name in locals(): del locals()[name] | ||
end | ||
del name | ||
|
||
def setDefaults(d = None) | ||
# Applies the default configuration. | ||
# - d: Record where to set the values. If not specified, the | ||
# Config namespace is used. | ||
if d == None | ||
print "Defaults are set in the main Config namespace." | ||
import Config | ||
d = Config | ||
end | ||
|
||
d.importPath = ['', '/modules'] | ||
|
||
# The default audio and video subsystems. | ||
d.video = 'opengl' | ||
d.audio = 'fmod' | ||
|
||
# Window manager defaults. | ||
record d.window | ||
record d.window.main | ||
|
||
d.window.fsaa = True | ||
|
||
d.window.main.rect = [0, 0, 640, 480] | ||
d.window.main.colorDepth = 32 | ||
d.window.main.center = True | ||
d.window.main.maximize = False | ||
d.window.main.fullscreen = True | ||
|
||
# Log parameters. | ||
record d.log | ||
|
||
# Log message levels. | ||
const d.log.TRACE = 0 | ||
const d.log.DEBUG = 1 | ||
const d.log.VERBOSE = 2 | ||
const d.log.MESSAGE = 3 | ||
const d.log.INFO = 4 | ||
const d.log.WARNING = 5 | ||
const d.log.ERROR = 6 | ||
const d.log.CRITICAL = 7 | ||
|
||
d.log.file = '/home/doomsday.out' | ||
d.log.level = d.log.MESSAGE | ||
d.log.bufferSize = 1000 | ||
end | ||
|
||
def updateWithDefaults() | ||
record defaults | ||
setDefaults(defaults) | ||
# Anything that is not already in Config should be added. | ||
import recutil, Config | ||
recutil.copyMissingMembers(defaults, Config) | ||
end | ||
|
||
updateWithDefaults() | ||
|
||
# Check the previous version and decide what to do. | ||
if '__oldversion__' in locals() | ||
if __version__[3] > __oldversion__[3] | ||
# Current build number is newer. | ||
print 'Detected new build:', __oldversion__[3], '=>', __version__[3] | ||
end | ||
if __version__[0:2] > __oldversion__[0:2] | ||
# Current version is newer. | ||
print 'Detected new release:', __oldversion__, '=>', __version__ | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# The Doomsday Engine Project -- libdeng2 | ||
# | ||
# Copyright (c) 2012-2013 Jaakko Keränen <jaakko.keranen@iki.fi> | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
|
||
#---------------------------------------------------------------------------- | ||
# Utility routines for manipulating Records | ||
|
||
def copyMissingMembers(src, dest) | ||
# Checks through 'src' to see if there are any variables or | ||
# records not present in 'dest', and if those are found, inserts | ||
# the missing members to 'dest'. Private keys in 'src' are ignored. | ||
# - src: Source record. | ||
# - dest: Destination record. | ||
print "inserting missing members" | ||
|
||
for name in dictkeys(members(src)) | ||
# Private members should be ignored. | ||
if name[:2] == "__": continue | ||
|
||
print "Checking member", name | ||
if not name in members(dest) | ||
if name in subrecords(src) | ||
print "=> adding subrecord", name | ||
dest[name] = Record() | ||
else | ||
print "=> setting member", name, "=", src[name] | ||
dest[name] = src[name] | ||
end | ||
end | ||
|
||
if name in subrecords(src): copyMissingMembers(src[name], dest[name]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters