sm-discuss AT lists.ibiblio.org
Subject: Public SourceMage Discussion List
List archive
- From: Vladimír Marek <vlmarek AT volny.cz>
- To: sm-discuss AT lists.ibiblio.org
- Subject: [SM-Discuss] config_query_option
- Date: Sun, 10 Oct 2004 12:39:34 +0200
Hello,
while fixing http://bugs.sourcemage.org/show_bug.cgi?id=7456, I found
that another weakness in config_query_option is commonly misused.
config_query_option RAPTOR_LIST "Enable RDF XML?" y "rdfxml" ""
Which should mean to add string "rdfxml" to RAPTOR_LIST when users
answer Y. The problem is that if user answers N, I am not able to decide
on next cast if this question is unanswered or was answered N. The
function was not designed to handle empty strings (my apologises I made
it possible anyways).
I modified config_query function to return 0 if user answers Y, and 1 if
N. So the code now can look like:
--- CUT ---
persistent_add RAPTOR_LIST W we want this variable to pass to BUILD
RAPTOR_LIST="" # We will build it from scratch each cast
config_query Q1 "Enable RDF XML?" y && list_add RAPTOR_LIST "rdfxml"
config_query Q2 "Enable whatever?" y && list_add RAPTOR_LIST "whatever"
...
--- CUT ---
Now, I'm thinking about deprecating and removing config_query_option,
because we can quite simply substitue it:
config_query_option RESULT "Question ?" y "--enable-x" "--disable-x"
by
persistent_add RESULT
RESULT=""
config_query Q1 "Question ?" y && list_add RESULT "--enable-x" || list_add
RESULT "--disable-x"
I would ofcourse rewrite all usages of config_query_option in grimoires.
If you wish to keep this function, I will add checks for empty
parameters. I'm sorry once more for weak design of this function.
--
Neuron
Attachment:
pgpS8J7QONsGt.pgp
Description: PGP signature
-
[SM-Discuss] config_query_option,
Vladimír Marek, 10/10/2004
-
Re: [SM-Discuss] config_query_option,
Andrew, 10/10/2004
- Re: [SM-Discuss] config_query_option, neuron, 10/10/2004
-
Re: [SM-Discuss] config_query_option,
Andrew, 10/10/2004
Archive powered by MHonArc 2.6.24.