/*! \brief Get a page from a smob. * \ingroup guile_c_iface * \par Function Description * Return the #PAGE represented by \a smob. * * \param [in] smob Guile value to retrieve #PAGE from. * \return the #PAGE represented by \a smob. */ PAGE * edascm_to_page (SCM smob) { #ifndef NDEBUG SCM_ASSERT (EDASCM_PAGEP (smob), smob, SCM_ARG1, "edascm_to_page"); #endif EDASCM_ASSERT_SMOB_VALID (smob); return (PAGE *) SCM_SMOB_DATA (smob); }
/*! \brief Get a smob for a page. * \ingroup guile_c_iface * \par Function Description * Create a new smob representing \a page. * * \param page #PAGE to create a smob for. * \return a smob representing \a page. */ SCM edascm_from_page (PAGE *page) { SCM smob = smob_cache_lookup (page); if (EDASCM_PAGEP (smob)) { return smob; } SCM_NEWSMOB (smob, geda_smob_tag, page); SCM_SET_SMOB_FLAGS (smob, GEDA_SMOB_PAGE); /* Set weak reference */ s_page_weak_ref (page, smob_weakref_notify, unpack_as_pointer (smob)); smob_cache_add (page, smob); return smob; }
/*! \brief Test whether a smob is a #PAGE instance * \ingroup guile_c_iface * \par Function Description * If \a smob is a #PAGE instance, returns non-zero. Otherwise, * returns zero. * * \param [in] smob Guile value to test. * * \return non-zero iff \a smob is a #PAGE instance. */ int edascm_is_page (SCM smob) { return EDASCM_PAGEP (smob); }