2020-05-05 23:59:02 +03:00
|
|
|
[OptionsFile::] The Options File.
|
|
|
|
|
|
|
|
The optional file of Options applied to all of the user's projects.
|
|
|
|
|
|
|
|
@ An Inform user with unyielding views on punctuation may want to have:
|
|
|
|
|
|
|
|
>> Use the serial comma.
|
|
|
|
|
|
|
|
applied to every project she works on. For such needs, it's possible to
|
|
|
|
create an |Options.txt| file of sentence which are present, by implication,
|
|
|
|
in every project.
|
|
|
|
|
|
|
|
When Inform reads this file, very early in its run, it tries to obey any use
|
|
|
|
options in the file right away -- earlier even than <structural-sentence>. It
|
|
|
|
spots these, very crudely, as sentences which match the following (that is,
|
|
|
|
which start with "use"). Note the final full stop -- this is all occurring
|
|
|
|
before sentence-breaking has even taken place. Fortunately, no matter how
|
|
|
|
unyielding the user's views, it's not allowed to write:
|
|
|
|
|
|
|
|
>> Use the serial comma!
|
|
|
|
|
|
|
|
so the sentence-terminator will certainly be a full stop.
|
|
|
|
|
|
|
|
=
|
|
|
|
<use-option-sentence-shape> ::=
|
2020-08-03 14:11:27 +03:00
|
|
|
use <immediate-use> .
|
2020-05-05 23:59:02 +03:00
|
|
|
|
2020-08-03 14:11:27 +03:00
|
|
|
<immediate-use> ::=
|
|
|
|
... | ==> { lookahead }
|
|
|
|
<immediate-use-entry> <immediate-use-tail> |
|
|
|
|
<immediate-use-entry>
|
|
|
|
|
|
|
|
<immediate-use-tail> ::=
|
|
|
|
, _and <immediate-use> |
|
|
|
|
_,/and <immediate-use>
|
|
|
|
|
|
|
|
<immediate-use-entry> ::=
|
|
|
|
<notable-use-option-name> | ==> @<Act on this use option immediately@>
|
|
|
|
......
|
|
|
|
|
|
|
|
@<Act on this use option immediately@> =
|
|
|
|
#ifdef CORE_MODULE
|
|
|
|
CompilationSettings::set(R[1], -1, NULL);
|
|
|
|
#endif
|
|
|
|
|
2020-05-07 18:44:07 +03:00
|
|
|
@ There is just one options file, so no need to load it more than once.
|
|
|
|
|
|
|
|
=
|
2020-05-05 23:59:02 +03:00
|
|
|
wording options_file_wording = EMPTY_WORDING_INIT;
|
|
|
|
|
|
|
|
void OptionsFile::read(filename *F) {
|
2020-05-07 18:44:07 +03:00
|
|
|
if (Wordings::empty(options_file_wording)) {
|
|
|
|
feed_t id = Feeds::begin();
|
|
|
|
TextFiles::read(F, TRUE,
|
|
|
|
NULL, FALSE, OptionsFile::read_helper, NULL, NULL);
|
|
|
|
options_file_wording = Feeds::end(id);
|
|
|
|
}
|
2020-05-05 23:59:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void OptionsFile::read_helper(text_stream *line,
|
|
|
|
text_file_position *tfp, void *unused_state) {
|
|
|
|
WRITE_TO(line, "\n");
|
2020-05-12 12:00:53 +03:00
|
|
|
wording W = Feeds::feed_text(line);
|
2020-08-03 14:11:27 +03:00
|
|
|
<use-option-sentence-shape>(W);
|
2020-05-05 23:59:02 +03:00
|
|
|
}
|