1
0
Fork 0
mirror of https://github.com/ganelson/inform.git synced 2024-06-28 21:14:57 +03:00

Fix and test cases for Mantis bug 1839 (and 2012)

This commit is contained in:
Graham Nelson 2022-04-10 08:20:58 +01:00
parent 1a92fbc725
commit 5da67dc5a6
8 changed files with 51 additions and 5 deletions

View file

@ -1,6 +1,6 @@
# Inform 7
v10.1.0-alpha.1+6U78 'Krypton' (9 April 2022)
v10.1.0-alpha.1+6U79 'Krypton' (10 April 2022)
## About Inform 7

View file

@ -1,3 +1,3 @@
Prerelease: alpha.1
Build Date: 9 April 2022
Build Number: 6U78
Build Date: 10 April 2022
Build Number: 6U79

View file

@ -0,0 +1,4 @@
There is room.
Figure null is the file "".
Figure nearly null is the file " ".

View file

@ -0,0 +1,4 @@
There is room.
Sound null is the file "".
Sound nearly null is the file " ".

View file

@ -0,0 +1,13 @@
Inform 7 v10.1.0 has started.
I've now read your source text, which is 14 words long.
I've also read Basic Inform by Graham Nelson, which is 7691 words long.
I've also read English Language by Graham Nelson, which is 2328 words long.
I've also read Standard Rules by Graham Nelson, which is 32092 words long.
Problem__ PM_FigureWhiteSpace
>--> You wrote 'Figure null is the file ""' (source text, line 3): but this
is not a filename I can use, because it is either empty or contains only
spaces.
Problem__ PM_FigureWhiteSpace
>--> You wrote 'Figure nearly null is the file " "' (source text, line 4):
again, this is not a filename I can use.
Inform 7 has finished.

View file

@ -0,0 +1,13 @@
Inform 7 v10.1.0 has started.
I've now read your source text, which is 14 words long.
I've also read Basic Inform by Graham Nelson, which is 7691 words long.
I've also read English Language by Graham Nelson, which is 2328 words long.
I've also read Standard Rules by Graham Nelson, which is 32092 words long.
Problem__ PM_SoundWhiteSpace
>--> You wrote 'Sound null is the file ""' (source text, line 3): but this is
not a filename I can use, because it is either empty or contains only
spaces.
Problem__ PM_SoundWhiteSpace
>--> You wrote 'Sound nearly null is the file " "' (source text, line 4):
again, this is not a filename I can use.
Inform 7 has finished.

View file

@ -103,9 +103,15 @@ void Figures::register_figure(wording W, wording FN) {
if (wn >= 0) id = Task::get_next_free_blorb_resource_ID();
TEMPORARY_TEXT(leaf)
WRITE_TO(leaf, "%N", wn);
DISCARD_TEXT(leaf)
if ((wn >= 0) && (Str::is_whitespace(leaf))) {
StandardProblems::sentence_problem(Task::syntax_tree(), _p_(PM_FigureWhiteSpace),
"this is not a filename I can use",
"because it is either empty or contains only spaces.");
return;
}
filename *figure_file = NULL;
if (wn >= 0) figure_file = Filenames::in(Task::figures_path(), leaf);
DISCARD_TEXT(leaf)
Figures::figures_create(W, id, figure_file, <<alttext>>);
LOGIF(MULTIMEDIA_CREATIONS, "Created figure <%W> = filename '%f' = resource ID %d\n",
W, figure_file, id);

View file

@ -96,8 +96,14 @@ void Sounds::register_sound(wording W, wording FN) {
int id = Task::get_next_free_blorb_resource_ID();
TEMPORARY_TEXT(leaf)
WRITE_TO(leaf, "%N", wn);
DISCARD_TEXT(leaf)
if (Str::is_whitespace(leaf)) {
StandardProblems::sentence_problem(Task::syntax_tree(), _p_(PM_SoundWhiteSpace),
"this is not a filename I can use",
"because it is either empty or contains only spaces.");
return;
}
filename *sound_file = Filenames::in(Task::sounds_path(), leaf);
DISCARD_TEXT(leaf)
Sounds::sounds_create(W, id, sound_file, <<alttext>>);
LOGIF(MULTIMEDIA_CREATIONS,
"Created sound effect <%W> = filename '%N' = resource ID %d\n", W, wn, id);