Skip to content
Snippets Groups Projects
Commit f38ca28f authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Support [modname:charset=<charset>] sections

This is a getting a little kludgey

I think doing something with ARS would be nicer, but then we get into the
area of constructing a 'options' object out of keys from multiple sections
and which sections should supercede which? This'll do for now for Nelgin's
BBC mode7 terminal project.
parent 546db5d1
No related branches found
No related tags found
No related merge requests found
......@@ -4,8 +4,12 @@
/* If the section [module:lang=user-lang] exists in the .ini file,
that section (or key value from it) will be returned instead of the [module] section.
If the section [module:charset=terminal-charset] exists in the .ini file,
that section (or key value from it) will be returned instead of the [module] section.
*/
/* To avoid over-writing the parent script's "argc" and "argv" values,
pass a scope object to load(), like this:
......@@ -24,9 +28,19 @@ function get_mod_options(modname, optname, default_optval)
if(!ini_file.open("r")) {
return undefined;
}
var section = modname + ':lang=' + user.lang;
if(!user.lang || ini_file.iniGetSections().indexOf(section) < 0)
var section;
if(js.global.console || user.lang) {
var sections = ini_file.iniGetSections();
if(js.global.console)
section = modname + ':charset=' + console.charset;
if(user.lang) {
if(section === undefined || sections.indexOf(section) < 0)
section = modname + ':lang=' + user.lang;
}
if(section && sections.indexOf(section) < 0)
section = undefined;
}
if(!section)
section = modname;
var val;
if(optname) // Get a specific option value (optionally, with default value)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment