On Thu, Aug 7, 2008 at 8:47 AM, Peter TB Brett <[EMAIL PROTECTED]> wrote:
> On Thursday 07 August 2008 02:35:01 Bernd Jendrissek wrote:
>
> +  interpreter = scm_c_lookup("invoke-macro");
> +  interpreter = scm_variable_ref(interpreter);
> +  if (scm_is_true(scm_procedure_p(interpreter))) {
> +    scm_call_1(interpreter,
> scm_from_locale_string(gtk_entry_get_text(entry)));
> +  } else {
> +    g_warning(_("invoke-macro is not a scheme procedure!\n"));
> +  }
>
> Shouldn't you catch any errors from the first two lines? At the very least, if
> the 'invoke-macro' symbol is undefined, scm_c_lookup will signal an error
> condition, won't it?

I was rougly copying the code in
gschem/src/g_keys.c:g_keys_dump_keymap() and convinced myself (and now
hoping to convince you) that trying to catch errors here is not so
critical:

1. There is a definition of (invoke-macro STR) in system-gschemrc.
2. Causing the code above to fail requires:
2a. Awareness of (invoke-macro STR)
2b. The act of overriding system-gschemrc's definition, brokenly.

I could be persuaded to just add the checks anyway - there's
libgeda/src/g_basic.c:g_scm_eval_string_protected() as an example, but
it's uglified by the old-guile/new-guile conditionally compiled code
paths.


_______________________________________________
geda-dev mailing list
[email protected]
http://www.seul.org/cgi-bin/mailman/listinfo/geda-dev

Reply via email to