27 using namespace basis;
39 #define LOG(to_print) program_wide_logger::get().log(to_print, ALWAYS_PRINT)
63 configured_applications::configured_applications(
const astring &config_file,
75 LOG(
astring(
"the startup section doesn't exist yet; adding it now."));
90 {
return "PRIVATE_STARTUP_LNCH1.0"; }
93 {
return "placeholder"; }
103 const astring &app_name,
int &level)
116 if (product.
iequals(
"supervisor")) {
119 found = _sector->
config().
load(heading, app_name,
"");
120 }
else if (product.
iequals(
"lightlink")) {
122 found = _sector->
config().
load(heading, app_name,
"");
126 found = _sector->
config().
load(heading, app_name,
"");
132 found = parser_bits::substitute_env_vars(found);
134 int comma_loc = found.
find(
",");
137 found.
zap(0, comma_loc);
145 #ifdef DEBUG_APP_CONFIG
156 #ifdef DEBUG_APP_CONFIG
158 LOG(
astring(
"section for ") + product +
" found:");
159 for (
int i = 0; i < info_table.
symbols(); i++)
160 LOG(
astring(
"key=") + info_table.
name(i) +
" value=" + info_table[i]);
161 }
else LOG(
astring(
"section for ") + product +
" not found.");
164 info_table.
whack(app_name);
166 a_sprintf full_entry(
"%d,%s", level, full_path.
s());
167 info_table.
add(app_name, full_entry);
168 #ifdef DEBUG_APP_CONFIG
169 LOG(
astring(
"new section for ") + product +
" has:");
170 for (
int i = 0; i < info_table.
symbols(); i++)
171 LOG(
astring(
"key=") + info_table.
name(i) +
" value=" + info_table[i]);
188 info_table.
whack(app_name);
201 LOG(section_name +
" was not found in the configuration.");
211 return _sector->
add_section(section_name, info_found);
222 const astring &parms,
bool one_shot)
227 +
astring(astring::SPRINTF,
"%d", one_shot);
233 FUNCDEF(
"parse_startup_section");
236 entry_parser.
parse(info);
242 one_shot = (bool)once.
convert(0);
244 if (!product)
return false;
253 if (!found)
return false;
265 LOG(
astring(
"product \"") + product +
"\", application \"" + app_name
272 LOG(
astring(
"internal startup section not found!"));
278 startup_info.
add(app_name, new_entry);
289 FUNCDEF(
"remove_startup_entry");
292 LOG(
astring(
"product \"") + product +
"\", application \"" + app_name +
"\"");
309 if (!
find_entry(startup_info, app_name, entry_found)) {
311 LOG(
astring(
"no entry was found for ") + app_name);
315 startup_info.
whack(app_name);
a_sprintf is a specialization of astring that provides printf style support.
Provides a dynamically resizable ASCII character string.
const char * s() const
synonym for observe. the 's' stands for "string", if that helps.
int convert(int default_value) const
Converts the string into a corresponding integer.
virtual void zap(int start, int end)
Deletes the characters between "start" and "end" inclusively.
bool iequals(const astring &that) const
returns true if this is case-insensitively equal to "that".
int find(char to_find, int position=0, bool reverse=false) const
Locates "to_find" in "this".
auto_synchronizer simplifies concurrent code by automatically unlocking.
basis::astring load(const basis::astring §ion, const basis::astring &entry, const basis::astring &default_value)
a synonym for get that implements the auto-store behavior.
Supports a configurator-based interface on text initialization files.
Tracks a collection of related configurations in a configurator.
basis::astring make_section_heading(const basis::astring §ion)
provides the appropriate heading string for the "section" name.
bool add_section(const basis::astring §ion_name, const structures::string_table &to_add)
stores a new section for "section_name" using the table "to_add".
bool section_exists(const basis::astring §ion_name)
returns true if the section called "section_name" exists in the config.
bool replace_section(const basis::astring §ion, const structures::string_table &replacement)
replaces the contents of "section" with the "replacement" table.
bool find_section(const basis::astring §ion_name, structures::string_table &found)
loads the data from "section_name" into the table "found".
configurator & config()
allows access to the configurator we operate on.
Manages a bank of textual definitions of variables.
basis::astring find(const basis::astring &name) const
locates the value for a variable named "name" if it exists.
bool parse(const basis::astring &to_tokenize)
parses the string using our established sentinel characters.
Provides a symbol_table that holds strings as the content.
const basis::astring & name(int index) const
returns the name held at the "index".
contents * find(const basis::astring &name) const
returns the contents held for "name" or NULL_POINTER if it wasn't found.
basis::outcome add(const basis::astring &name, const contents &storage)
Enters a symbol name into the table along with some contents.
basis::outcome whack(const basis::astring &name)
removes a symbol from the table.
int symbols() const
returns the number of symbols listed in the table.
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
The guards collection helps in testing preconditions and reporting errors.
void WHACK(contents *&ptr)
deletion with clearing of the pointer.
bool negative(const type &a)
negative returns true if "a" is less than zero.
A logger that sends to the console screen using the standard output device.
const char * ONESHOT_HEADING()
const char * PARMS_HEADING()
const char * ASSIGN_TOKEN()
const char * PRODUCT_HEADING()
const char * SEPARATOR_TEXT()
const char * SEPARATOR_TOKEN()
A dynamic container class that holds any kind of object via pointers.