Example #1
0
/*! \brief Runs a object hook with a single OBJECT.
 * \par Function Description
 * Runs a hook called \a name, which should expect a list of #OBJECT
 * smobs as its argument, with a single-element list containing only \a obj.
 *
 * \see g_run_hook_object_list()
 *
 * \param name name of hook to run.
 * \param obj  #OBJECT argument for hook.
 */
void
g_run_hook_object (const char *name, OBJECT *obj)
{
  SCM args = scm_list_1 (scm_list_1 (edascm_from_object (obj)));
  scm_run_hook (g_get_hook_by_name (name), args);
  scm_remember_upto_here_1 (args);
}
Example #2
0
/*! \brief Runs a page hook.
 * \par Function Description
 * Runs a hook called \a name, which should expect the single #PAGE \a
 * page as its argument.
 *
 * \param name name of hook to run
 * \param page #PAGE argument for hook.
 */
void
g_run_hook_page (const char *name, PAGE *page)
{
  SCM args = scm_list_1 (edascm_from_page (page));
  scm_run_hook (g_get_hook_by_name (name), args);
  scm_remember_upto_here_1 (args);
}
Example #3
0
/*! \brief Runs a object hook for a list of objects.
 * \par Function Description
 * Runs a hook called \a name, which should expect a list of #OBJECT
 * smobs as its argument, with \a obj_lst as the argument list.
 *
 * \see g_run_hook_object()
 *
 * \param name    name of hook to run.
 * \param obj_lst list of #OBJECT smobs as hook argument.
 */
void
g_run_hook_object_list (const char *name, GList *obj_lst)
{
  SCM lst = SCM_EOL;
  GList *iter;
  for (iter = obj_lst; iter != NULL; iter = g_list_next (iter)) {
    lst = scm_cons (edascm_from_object ((OBJECT *) iter->data), lst);
  }
  SCM args = scm_list_1 (scm_reverse_x (lst, SCM_EOL));

  scm_run_hook (g_get_hook_by_name (name), args);
  scm_remember_upto_here_2 (lst, args);
}
Example #4
0
/*! \brief Runs a object hook with a single OBJECT.
 * \par Function Description
 * Runs a hook called \a name, which should expect a list of #OBJECT
 * smobs as its argument, with a single-element list containing only \a obj.
 *
 * \see g_run_hook_object_list()
 *
 * \param name name of hook to run.
 * \param obj  #OBJECT argument for hook.
 */
void
g_run_hook_object (GschemToplevel *w_current, const char *name, OBJECT *obj)
{
  scm_dynwind_begin (0);
  g_dynwind_window (w_current);

  SCM expr = scm_list_3 (run_hook_sym,
                         g_get_hook_by_name (name),
                         scm_list_2 (list_sym, edascm_from_object (obj)));

  g_scm_eval_protected (expr, scm_interaction_environment ());
  scm_dynwind_end ();
  scm_remember_upto_here_1 (expr);
}
Example #5
0
/*! \brief Runs a object hook for a list of objects.
 * \par Function Description
 * Runs a hook called \a name, which should expect a list of #OBJECT
 * smobs as its argument, with \a obj_lst as the argument list.
 *
 * \see g_run_hook_object()
 *
 * \param name    name of hook to run.
 * \param obj_lst list of #OBJECT smobs as hook argument.
 */
void
g_run_hook_object_list (GschemToplevel *w_current, const char *name,
                        GList *obj_lst)
{
  SCM lst = SCM_EOL;
  GList *iter;

  scm_dynwind_begin (0);
  g_dynwind_window (w_current);

  for (iter = obj_lst; iter != NULL; iter = g_list_next (iter)) {
    lst = scm_cons (edascm_from_object ((OBJECT *) iter->data), lst);
  }
  SCM expr = scm_list_3 (run_hook_sym,
                         g_get_hook_by_name (name),
                         scm_cons (list_sym,
                                   scm_reverse_x (lst, SCM_EOL)));

  g_scm_eval_protected (expr, scm_interaction_environment ());
  scm_dynwind_end ();
  scm_remember_upto_here_1 (expr);
}
Example #6
0
/*! \brief Creates an EdascmHookProxy for a named hook.
 * Return a newly-created hook proxy object for the hook called \a
 * name.
 *
 * \param name  name of the hook for which to create a proxy.
 * \return      newly-created EdascmHookProxy instance.
 */
EdascmHookProxy *
g_hook_new_proxy_by_name (const char *name)
{
  SCM hook = g_get_hook_by_name (name);
  return edascm_hook_proxy_new_with_hook (hook);
}