Skip to Content.
Sympa Menu

sm-discuss - Re: [SM-Discuss] config_query_option

sm-discuss AT lists.ibiblio.org

Subject: Public SourceMage Discussion List

List archive

Chronological Thread  
  • From: Andrew <afrayedknot AT thefrayedknot.armory.com>
  • To: sm-discuss AT lists.ibiblio.org
  • Subject: Re: [SM-Discuss] config_query_option
  • Date: Sun, 10 Oct 2004 10:20:07 -0700

Hi, we're not making a massive change of the grimoire overnight.
The gurus agreed that the config_query* functions should not
return anything but 0 unless there is a catastrophic failure.

Why cant config_query_option handle an empty string? it seems to
me that it should, at the very least, you've answered your own question
below...

-Andrew

On Sun, Oct 10, 2004 at 12:39:34PM +0200, Vladim?r Marek wrote:
> 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



> _______________________________________________
> SM-Discuss mailing list
> SM-Discuss AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/sm-discuss


--
__________________________________________________________________________
|Andrew D. Stitt | astitt at sourcemage.org |
|irc: afrayedknot | afrayedknot at t.armory.com |
|aim: thefrayedknot or iteratorplusplus | |
|Sorcery Team Lead, Porting Team Lead | |
|Grimoire Guru ham/smgl | ftp://t.armory.com |
|Author and Maintainer of Prometheus | |
--------------------------------------------------------------------------

Attachment: pgp_j7myp6bVT.pgp
Description: PGP signature




Archive powered by MHonArc 2.6.24.

Top of Page