/*! \brief read a complex object from a char buffer * \par Function Description * This function reads a complex object from the buffer \a buf. * If the complex object was read successfully, a new object is * allocated and appended to the \a object_list. * * \param [in] toplevel The TOPLEVEL object * \param [in] buf a text buffer (usually a line of a schematic file) * \param [in] release_ver The release number gEDA * \param [in] fileformat_ver a integer value of the file format * \return The object list */ OBJECT *o_complex_read (TOPLEVEL *toplevel, char buf[], unsigned int release_ver, unsigned int fileformat_ver) { OBJECT *new_obj; char type; int x1, y1; int angle; char *basename = g_malloc (1 + strlen (buf)); int selectable; int mirror; sscanf(buf, "%c %d %d %d %d %d %s\n", &type, &x1, &y1, &selectable, &angle, &mirror, basename); switch(angle) { case(0): case(90): case(180): case(270): break; default: s_log_message(_("Found a component with an invalid rotation [ %c %d %d %d %d %d %s ]\n"), type, x1, y1, selectable, angle, mirror, basename); break; } switch(mirror) { case(0): case(1): break; default: s_log_message(_("Found a component with an invalid mirror flag [ %c %d %d %d %d %d %s ]\n"), type, x1, y1, selectable, angle, mirror, basename); break; } if (strncmp(basename, "EMBEDDED", 8) == 0) { new_obj = o_complex_new_embedded(toplevel, type, DEFAULT_COLOR, x1, y1, angle, mirror, basename + 8, selectable); } else { const CLibSymbol *clib = s_clib_get_symbol_by_name (basename); new_obj = o_complex_new(toplevel, type, DEFAULT_COLOR, x1, y1, angle, mirror, clib, basename, selectable); /* Delete or hide attributes eligible for promotion inside the complex */ o_complex_remove_promotable_attribs (toplevel, new_obj); } g_free (basename); return new_obj; }
* with all other parameters set to default values. It is initially set * to be embedded. * * \note Scheme API: Implements the %make-complex procedure in the * (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