コード例 #1
0
ファイル: g_hook.c プロジェクト: jaredcasper/geda-gaf
/*! \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);
}
コード例 #2
0
ファイル: g_netlist.c プロジェクト: blueantst/geda-gaf
SCM g_scm_c_get_uref (TOPLEVEL *toplevel, OBJECT *object)
{
  SCM func = scm_variable_ref (scm_c_lookup ("get-uref"));
  SCM object_smob = edascm_from_object (object);
  SCM exp = scm_list_2 (func, object_smob);

  return g_scm_eval_protected (exp, SCM_UNDEFINED);
}
コード例 #3
0
ファイル: s_netlist.c プロジェクト: gareth8118/geda-gaf
static SCM
scm_from_netlist (NETLIST *netlist)
{
  return scm_list_n (netlist->component_uref ? scm_from_utf8_string (netlist->component_uref) : SCM_BOOL_F,
                     netlist->hierarchy_tag ? scm_from_utf8_string (netlist->hierarchy_tag) : SCM_BOOL_F,
                     scm_from_bool (netlist->composite_component),
                     netlist->object_ptr ? edascm_from_object (netlist->object_ptr) : SCM_BOOL_F,
                     scm_from_pin_list (netlist->cpins),
                     SCM_UNDEFINED);
}
コード例 #4
0
ファイル: s_cpinlist.c プロジェクト: gareth8118/geda-gaf
static SCM
scm_from_pin (CPINLIST *pin)
{
  return scm_list_n (pin->object_ptr ? edascm_from_object (pin->object_ptr) : SCM_BOOL_F,
                     pin->pin_number ? scm_from_utf8_string (pin->pin_number) : SCM_BOOL_F,
                     pin->net_name ? scm_from_utf8_string (pin->net_name) : SCM_BOOL_F,
                     pin->pin_label ? scm_from_utf8_string (pin->pin_label) : SCM_BOOL_F,
                     scm_from_net_list (pin->nets),
                     SCM_UNDEFINED);
}
コード例 #5
0
ファイル: g_hook.c プロジェクト: jaredcasper/geda-gaf
/*! \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);
}
コード例 #6
0
ファイル: g_hook.c プロジェクト: frantony/geda-gaf
/*! \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);
}
コード例 #7
0
ファイル: g_hook.c プロジェクト: frantony/geda-gaf
/*! \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);
}
コード例 #8
0
ファイル: scheme_complex.c プロジェクト: blueantst/geda-gaf
 * (geda core complex) module.
 *
 * \return a newly-created complex object.
 */
SCM_DEFINE (make_complex, "%make-complex", 1, 0, 0,
            (SCM basename_s), "Create a new complex object.")
{
  SCM_ASSERT (scm_is_string (basename_s), basename_s, SCM_ARG1, s_make_complex);

  char *tmp = scm_to_utf8_string (basename_s);
  OBJECT *obj = o_complex_new_embedded (edascm_c_current_toplevel (),
                                        OBJ_COMPLEX, DEFAULT_COLOR, 0, 0, 0,
                                        FALSE, tmp, TRUE);
  free (tmp);

  SCM result = edascm_from_object (obj);

  /* At the moment, the only pointer to the object is owned by the
   * smob. */
  edascm_c_set_gc (result, TRUE);

  return result;
}

/*! \brief Instantiate a complex object from the component library.
 * \par Function Description

 * Searches the component library for a component with the given \a
 * basename.  If found, creates a new complex object by instantiating
 * that library component.  It is initially set to be unembedded.  If
 * no match is found for \a basename in the library, returns