[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: gaf.git: branch: master updated (1.5.0-20080706-352-g617797b)
The branch, master has been updated
via 617797b5a47d370c4fee19110c826502b7e3082b (commit)
from de9c919b925ff989c3f26914e666d2e38062bfe1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
gattrib/include/prototype.h | 20 ++--
gattrib/src/s_object.c | 23 +--
gattrib/src/s_sheet_data.c | 134 ++++++++--------
gattrib/src/s_table.c | 38 ++---
gattrib/src/s_toplevel.c | 55 +++----
gattrib/src/x_fileselect.c | 18 +-
gnetlist/include/prototype.h | 4 +-
gnetlist/src/s_hierarchy.c | 2 +-
gnetlist/src/s_traverse.c | 42 ++---
gschem/include/prototype.h | 29 ++--
gschem/src/a_zoom.c | 14 +-
gschem/src/g_funcs.c | 7 +-
gschem/src/g_hook.c | 43 +++---
gschem/src/i_callbacks.c | 10 +-
gschem/src/o_arc.c | 2 +-
gschem/src/o_attrib.c | 30 ++--
gschem/src/o_basic.c | 59 ++------
gschem/src/o_box.c | 2 +-
gschem/src/o_buffer.c | 18 +-
gschem/src/o_bus.c | 6 +-
gschem/src/o_circle.c | 2 +-
gschem/src/o_complex.c | 72 +++-----
gschem/src/o_copy.c | 6 +-
gschem/src/o_cue.c | 68 +++-----
gschem/src/o_delete.c | 4 +-
gschem/src/o_find.c | 28 ++--
gschem/src/o_line.c | 3 +-
gschem/src/o_misc.c | 118 +++++++-------
gschem/src/o_move.c | 100 ++++++------
gschem/src/o_net.c | 11 +-
gschem/src/o_picture.c | 2 +-
gschem/src/o_pin.c | 2 +-
gschem/src/o_place.c | 17 +--
gschem/src/o_select.c | 17 ++-
gschem/src/o_slot.c | 20 +--
gschem/src/o_text.c | 6 +-
gschem/src/o_undo.c | 48 +++---
gschem/src/x_attribedit.c | 12 +-
gschem/src/x_autonumber.c | 17 ++-
gschem/src/x_compselect.c | 5 +-
gschem/src/x_dialog.c | 6 +-
gschem/src/x_image.c | 8 +-
gschem/src/x_preview.c | 23 ++--
gschem/src/x_window.c | 2 +-
gsymcheck/include/prototype.h | 28 ++--
gsymcheck/src/s_check.c | 185 +++++++++-------------
libgeda/include/prototype.h | 63 +++-----
libgeda/include/prototype_priv.h | 46 +++---
libgeda/include/struct.h | 15 +-
libgeda/src/a_basic.c | 227 +++++++++++++-------------
libgeda/src/f_basic.c | 11 +-
libgeda/src/f_print.c | 51 +++---
libgeda/src/o_arc_basic.c | 9 +-
libgeda/src/o_attrib.c | 177 +++++++++------------
libgeda/src/o_basic.c | 20 ---
libgeda/src/o_box_basic.c | 15 +-
libgeda/src/o_bus_basic.c | 6 +-
libgeda/src/o_circle_basic.c | 10 +-
libgeda/src/o_complex_basic.c | 330 +++++++++++++-------------------------
libgeda/src/o_line_basic.c | 12 +-
libgeda/src/o_list.c | 214 +-----------------------
libgeda/src/o_net_basic.c | 20 ++--
libgeda/src/o_path_basic.c | 13 +--
libgeda/src/o_picture.c | 12 +-
libgeda/src/o_pin_basic.c | 27 ++--
libgeda/src/o_text_basic.c | 123 +++++----------
libgeda/src/s_basic.c | 169 ++------------------
libgeda/src/s_clib.c | 6 +-
libgeda/src/s_conn.c | 30 ++--
libgeda/src/s_cue.c | 13 +-
libgeda/src/s_hierarchy.c | 8 +-
libgeda/src/s_page.c | 14 +-
libgeda/src/s_undo.c | 38 ++---
utils/gschlas/s_util.c | 20 +--
74 files changed, 1163 insertions(+), 1902 deletions(-)
=================
Commit Messages
=================
commit 617797b5a47d370c4fee19110c826502b7e3082b
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date: Tue Dec 9 16:19:09 2008 +0000
Remove linkage between OBJECTs and use GList for OBJECTs on the page
This affords quite a lot of code clean-up, since we no longer have to
maintain two versions of each operation which works on lists.
:100644 100644 97a4d0a... e597215... M gattrib/include/prototype.h
:100644 100644 37dfe0a... 23a415a... M gattrib/src/s_object.c
:100644 100644 ec827f4... ba5a404... M gattrib/src/s_sheet_data.c
:100644 100644 79025a4... 368cc92... M gattrib/src/s_table.c
:100644 100644 31cf91b... c79207e... M gattrib/src/s_toplevel.c
:100644 100644 a4d3ad5... eb10736... M gattrib/src/x_fileselect.c
:100644 100644 edde9aa... cc19689... M gnetlist/include/prototype.h
:100644 100644 2f0cc06... 6be5944... M gnetlist/src/s_hierarchy.c
:100644 100644 ad6e4be... 8bf2b33... M gnetlist/src/s_traverse.c
:100644 100644 d338a7a... 5f5965a... M gschem/include/prototype.h
:100644 100644 c112116... 2d94a7d... M gschem/src/a_zoom.c
:100644 100644 981f119... db3d56c... M gschem/src/g_funcs.c
:100644 100644 21dd7ae... af4288c... M gschem/src/g_hook.c
:100644 100644 52c630d... 47932ff... M gschem/src/i_callbacks.c
:100644 100644 cdf2f2b... 992fb57... M gschem/src/o_arc.c
:100644 100644 174adb8... ded6913... M gschem/src/o_attrib.c
:100644 100644 d44b993... 7da72a8... M gschem/src/o_basic.c
:100644 100644 936128a... 1852f63... M gschem/src/o_box.c
:100644 100644 2059e63... 21f445f... M gschem/src/o_buffer.c
:100644 100644 cfe8591... 5d7283b... M gschem/src/o_bus.c
:100644 100644 4275f7d... da22f49... M gschem/src/o_circle.c
:100644 100644 f2e86dc... 37bfedd... M gschem/src/o_complex.c
:100644 100644 be36f7c... 5ae6c84... M gschem/src/o_copy.c
:100644 100644 846c0c7... f78ca45... M gschem/src/o_cue.c
:100644 100644 c6a8188... 5613427... M gschem/src/o_delete.c
:100644 100644 4ad41a1... 9edf222... M gschem/src/o_find.c
:100644 100644 e81fad4... 9f5b103... M gschem/src/o_line.c
:100644 100644 f14f09f... a9bb436... M gschem/src/o_misc.c
:100644 100644 3586873... ade06f7... M gschem/src/o_move.c
:100644 100644 1c98089... e411773... M gschem/src/o_net.c
:100644 100644 eb4f5c5... c52bbf3... M gschem/src/o_picture.c
:100644 100644 14b3e23... 7012863... M gschem/src/o_pin.c
:100644 100644 21d7ccc... 16581d0... M gschem/src/o_place.c
:100644 100644 69c20b9... 2d72df1... M gschem/src/o_select.c
:100644 100644 1f284ba... 16825fa... M gschem/src/o_slot.c
:100644 100644 465438a... f101740... M gschem/src/o_text.c
:100644 100644 3a14d55... 17f19ed... M gschem/src/o_undo.c
:100644 100644 edc65d7... 67eff1f... M gschem/src/x_attribedit.c
:100644 100644 eb4bc53... 81a56ce... M gschem/src/x_autonumber.c
:100644 100644 7dfc6f0... 66ba6df... M gschem/src/x_compselect.c
:100644 100644 958f1ea... a11c85f... M gschem/src/x_dialog.c
:100644 100644 3641e7e... 4b18a01... M gschem/src/x_image.c
:100644 100644 a8b5049... 3b09c61... M gschem/src/x_preview.c
:100644 100644 6d4904c... 04ac14a... M gschem/src/x_window.c
:100644 100644 b61a86a... 4d063ee... M gsymcheck/include/prototype.h
:100644 100644 476759f... a3d54ff... M gsymcheck/src/s_check.c
:100644 100644 69196f6... 910707b... M libgeda/include/prototype.h
:100644 100644 3a9afca... 9b46975... M libgeda/include/prototype_priv.h
:100644 100644 efcbe4d... c9a5d85... M libgeda/include/struct.h
:100644 100644 4c86cf2... dad14c3... M libgeda/src/a_basic.c
:100644 100644 643e91d... 382bd2f... M libgeda/src/f_basic.c
:100644 100644 fb83db8... a797f82... M libgeda/src/f_print.c
:100644 100644 2d25f65... 18a0ead... M libgeda/src/o_arc_basic.c
:100644 100644 86a90cc... e612ac4... M libgeda/src/o_attrib.c
:100644 100644 a7c35dd... 27214ce... M libgeda/src/o_basic.c
:100644 100644 566aecb... 0851a2a... M libgeda/src/o_box_basic.c
:100644 100644 7793276... 82e0369... M libgeda/src/o_bus_basic.c
:100644 100644 9693e8b... 53d5e6b... M libgeda/src/o_circle_basic.c
:100644 100644 b33fd0b... d6a2518... M libgeda/src/o_complex_basic.c
:100644 100644 214e09b... 17cae09... M libgeda/src/o_line_basic.c
:100644 100644 4e54b59... 0624996... M libgeda/src/o_list.c
:100644 100644 d475b68... 8497da1... M libgeda/src/o_net_basic.c
:100644 100644 6fa1673... d592e8e... M libgeda/src/o_path_basic.c
:100644 100644 e68b58c... adeac52... M libgeda/src/o_picture.c
:100644 100644 df11edc... e9dfbb5... M libgeda/src/o_pin_basic.c
:100644 100644 856e114... 60a0516... M libgeda/src/o_text_basic.c
:100644 100644 64b78c0... f337f16... M libgeda/src/s_basic.c
:100644 100644 fef4e71... 48a0ff3... M libgeda/src/s_clib.c
:100644 100644 655cb48... 18dd0ed... M libgeda/src/s_conn.c
:100644 100644 20a9074... b85b108... M libgeda/src/s_cue.c
:100644 100644 59b4f97... c0b1ebc... M libgeda/src/s_hierarchy.c
:100644 100644 4c87932... 0aa3e29... M libgeda/src/s_page.c
:100644 100644 5fce02d... 0a99bf6... M libgeda/src/s_undo.c
:100644 100644 6944026... a202556... M utils/gschlas/s_util.c
=========
Changes
=========
commit 617797b5a47d370c4fee19110c826502b7e3082b
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date: Tue Dec 9 16:19:09 2008 +0000
Remove linkage between OBJECTs and use GList for OBJECTs on the page
This affords quite a lot of code clean-up, since we no longer have to
maintain two versions of each operation which works on lists.
diff --git a/gattrib/include/prototype.h b/gattrib/include/prototype.h
index 97a4d0a..e597215 100644
--- a/gattrib/include/prototype.h
+++ b/gattrib/include/prototype.h
@@ -36,12 +36,12 @@ char *s_attrib_get_refdes(OBJECT *object);
/* ------------- s_sheet_data.c ------------- */
SHEET_DATA *s_sheet_data_new();
-void s_sheet_data_add_master_comp_list_items(OBJECT *start_obj);
-void s_sheet_data_add_master_comp_attrib_list_items(OBJECT *start_obj);
-void s_sheet_data_add_master_net_list_items(OBJECT *start_obj);
-void s_sheet_data_add_master_net_attrib_list_items(OBJECT *start_obj);
-void s_sheet_data_add_master_pin_list_items(OBJECT *start_obj);
-void s_sheet_data_add_master_pin_attrib_list_items(OBJECT *start_obj);
+void s_sheet_data_add_master_comp_list_items(GList *obj_list);
+void s_sheet_data_add_master_comp_attrib_list_items(GList *obj_list);
+void s_sheet_data_add_master_net_list_items(GList *obj_list);
+void s_sheet_data_add_master_net_attrib_list_items(GList *obj_list);
+void s_sheet_data_add_master_pin_list_items(GList *obj_list);
+void s_sheet_data_add_master_pin_attrib_list_items(GList *obj_list);
void s_sheet_data_gtksheet_to_sheetdata();
@@ -73,9 +73,9 @@ STRING_LIST *s_table_create_attrib_pair(gchar *row_name,
STRING_LIST *row_list,
int num_attribs);
-void s_table_add_toplevel_comp_items_to_comp_table(OBJECT *start_obj);
-void s_table_add_toplevel_net_items_to_net_table(OBJECT *start_obj);
-void s_table_add_toplevel_pin_items_to_pin_table(OBJECT *start_obj);
+void s_table_add_toplevel_comp_items_to_comp_table(GList *obj_list);
+void s_table_add_toplevel_net_items_to_net_table(GList *obj_list);
+void s_table_add_toplevel_pin_items_to_pin_table(GList *obj_list);
void s_table_gtksheet_to_all_tables();
void s_table_gtksheet_to_table(GtkSheet *local_gtk_sheet,
@@ -90,7 +90,7 @@ void s_toplevel_gtksheet_to_toplevel();
void s_toplevel_add_new_attrib(gchar *new_attrib_name);
void s_toplevel_delete_attrib_col();
void s_toplevel_select_object();
-void s_toplevel_sheetdata_to_toplevel(OBJECT *start_obj);
+void s_toplevel_sheetdata_to_toplevel(GList *obj_list);
STRING_LIST *s_toplevel_get_component_attribs_in_sheet(char *refdes);
void s_toplevel_update_component_attribs_in_toplevel(OBJECT *o_current,
diff --git a/gattrib/src/s_object.c b/gattrib/src/s_object.c
index 37dfe0a..23a415a 100644
--- a/gattrib/src/s_object.c
+++ b/gattrib/src/s_object.c
@@ -287,9 +287,9 @@ OBJECT *s_object_attrib_add_attrib_in_object(TOPLEVEL * pr_current, char *text_s
exit(-1);
}
} else { /* This must be a floating attrib, but what is that !?!?!?!?! */
- world_get_object_list_bounds(pr_current,
- pr_current->page_current->object_head,
- &left, &top, &right, &bottom);
+ world_get_object_glist_bounds(pr_current,
+ pr_current->page_current->object_list,
+ &left, &top, &right, &bottom);
/* this really is the lower left hand corner */
world_x = left;
@@ -320,17 +320,15 @@ OBJECT *s_object_attrib_add_attrib_in_object(TOPLEVEL * pr_current, char *text_s
/* now attach the attribute to the object (if o_current is not NULL) */
/* remember that o_current contains the object to get the attribute */
if (o_current) {
- o_attrib_attach (pr_current, pr_current->page_current->object_tail,
- o_current);
+ o_attrib_attach (pr_current, new_obj, o_current);
}
- o_selection_add( pr_current->page_current->selection_list,
- pr_current->page_current->object_tail);
+ o_selection_add (pr_current->page_current->selection_list, new_obj);
pr_current->page_current->CHANGED = 1;
- return (pr_current->page_current->object_tail);
+ return new_obj;
}
@@ -343,15 +341,10 @@ OBJECT *s_object_attrib_add_attrib_in_object(TOPLEVEL * pr_current, char *text_s
*------------------------------------------------------------------*/
void s_object_delete_text_object_in_object(TOPLEVEL * pr_current, OBJECT * text_object)
{
+ pr_current->page_current->object_list =
+ g_list_remove (pr_current->page_current->object_list, text_object);
s_delete(pr_current, text_object);
pr_current->page_current->CHANGED = 1;
-
-#if 0
- /* What does this do?!?!? Maybe I don't need it!!! */
- pr_current->page_current->object_tail =
- (OBJECT *) return_tail(pr_current->page_current->object_head);
-#endif
-
}
diff --git a/gattrib/src/s_sheet_data.c b/gattrib/src/s_sheet_data.c
index ec827f4..ba5a404 100644
--- a/gattrib/src/s_sheet_data.c
+++ b/gattrib/src/s_sheet_data.c
@@ -100,9 +100,9 @@ SHEET_DATA *s_sheet_data_new()
* OBJECT->attribs(->next. . .)->object->text->string
*
*------------------------------------------------------------------*/
-void s_sheet_data_add_master_comp_list_items(OBJECT *start_obj) {
+void s_sheet_data_add_master_comp_list_items (GList *obj_list) {
char *temp_uref;
- OBJECT *o_current;
+ GList *iter;
#ifdef DEBUG
printf("=========== Just entered s_sheet_data_add_master_comp_list_items! ==============\n");
@@ -113,8 +113,10 @@ void s_sheet_data_add_master_comp_list_items(OBJECT *start_obj) {
}
/* ----- Iterate through all objects found on page looking for components ----- */
- o_current = start_obj;
- while (o_current != NULL) {
+ for (iter = obj_list;
+ iter != NULL;
+ iter = g_list_next (iter)) {
+ OBJECT *o_current = iter->data;
#ifdef DEBUG
printf("In s_sheet_data_add_master_comp_list_items, examining o_current->name = %s\n", o_current->name);
@@ -144,8 +146,7 @@ void s_sheet_data_add_master_comp_list_items(OBJECT *start_obj) {
} /* if (o_current->type == OBJ_COMPLEX . . . . .) */
- o_current = o_current->next; /* iterate to next object on page */
- } /* while o_current != NULL */
+ }
return;
}
@@ -160,11 +161,10 @@ void s_sheet_data_add_master_comp_list_items(OBJECT *start_obj) {
* sheet_head->component_list_head->attrib->name;
*
*------------------------------------------------------------------*/
-void s_sheet_data_add_master_comp_attrib_list_items(OBJECT *start_obj) {
+void s_sheet_data_add_master_comp_attrib_list_items (GList *obj_list) {
char *attrib_text;
char *attrib_name;
- OBJECT *o_current;
- GList *a_iter;
+ GList *o_iter, *a_iter;
OBJECT *a_current;
#ifdef DEBUG
@@ -178,8 +178,8 @@ void s_sheet_data_add_master_comp_attrib_list_items(OBJECT *start_obj) {
}
/* ----- Iterate through all objects found on page looking for components (OBJ_COMPLEX) ----- */
- o_current = start_obj;
- while (o_current != NULL) {
+ for (o_iter = obj_list; o_iter != NULL; o_iter = g_list_next (o_iter)) {
+ OBJECT *o_current = o_iter->data;
#ifdef DEBUG
printf("In s_sheet_data_add_master_comp_attrib_list_items, examining o_current->name = %s\n", o_current->name);
@@ -219,8 +219,7 @@ void s_sheet_data_add_master_comp_attrib_list_items(OBJECT *start_obj) {
} /* if (o_current->type == OBJ_COMPLEX) */
- o_current = o_current->next;
- } /* while (o_current != NULL) */
+ }
/* ----- Now sort component list into alphabetical order ----- */
@@ -237,7 +236,7 @@ void s_sheet_data_add_master_comp_attrib_list_items(OBJECT *start_obj) {
* attributes.
*
*------------------------------------------------------------------*/
-void s_sheet_data_add_master_net_list_items(OBJECT *start_obj) {
+void s_sheet_data_add_master_net_list_items (GList *obj_start) {
return;
}
@@ -248,7 +247,7 @@ void s_sheet_data_add_master_net_list_items(OBJECT *start_obj) {
* attributes.
*
*------------------------------------------------------------------*/
-void s_sheet_data_add_master_net_attrib_list_items(OBJECT *start_obj) {
+void s_sheet_data_add_master_net_attrib_list_items (GList *obj_start) {
return;
}
@@ -270,13 +269,12 @@ void s_sheet_data_add_master_net_attrib_list_items(OBJECT *start_obj) {
* it doesn't return a value.
*
*------------------------------------------------------------------*/
-void s_sheet_data_add_master_pin_list_items(OBJECT *start_obj) {
+void s_sheet_data_add_master_pin_list_items (GList *obj_list) {
char *temp_uref;
char *temp_pinnumber;
char *row_label;
- OBJECT *o_current;
- OBJECT *o_lower_current;
-
+ GList *o_iter, *o_lower_iter;
+
#ifdef DEBUG
fflush(stderr);
fflush(stdout);
@@ -288,57 +286,56 @@ void s_sheet_data_add_master_pin_list_items(OBJECT *start_obj) {
}
/* ----- Iterate through all objects found on page looking for components ----- */
- o_current = start_obj;
- while (o_current != NULL) {
+ for (o_iter = obj_list; o_iter != NULL; o_iter = g_list_next (o_iter)) {
+ OBJECT *o_current = o_iter->data;
#ifdef DEBUG
- printf("In s_sheet_data_add_master_pin_list_items, examining o_current->name = %s\n", o_current->name);
+ printf ("In s_sheet_data_add_master_pin_list_items, examining o_current->name = %s\n", o_current->name);
#endif
- if (o_current->type == OBJ_COMPLEX) {
- temp_uref = s_attrib_get_refdes(o_current);
- if (temp_uref != NULL) { /* make sure object complex has a refdes */
-
- /* ----- Now iterate through lower level objects looking for pins. ----- */
- o_lower_current = o_current->complex->prim_objs;
- while (o_lower_current != NULL) {
+ if (o_current->type == OBJ_COMPLEX) {
+ temp_uref = s_attrib_get_refdes (o_current);
+ if (temp_uref != NULL) { /* make sure object complex has a refdes */
+
+ /* ----- Now iterate through lower level objects looking for pins. ----- */
+ for (o_lower_iter = o_current->complex->prim_objs;
+ o_lower_iter != NULL;
+ o_lower_iter = g_list_next (o_lower_iter)) {
+ OBJECT *o_lower_current = o_lower_iter->data;
#if DEBUG
- printf("In s_sheet_data_add_master_pin_list_items, examining object name %s\n", o_lower_current->name);
+ printf ("In s_sheet_data_add_master_pin_list_items, examining object name %s\n", o_lower_current->name);
#endif
- if (o_lower_current->type == OBJ_PIN) {
- temp_pinnumber = o_attrib_search_name_single(o_lower_current, "pinnumber", NULL);
-
- if( temp_pinnumber != NULL) {
- row_label = g_strconcat(temp_uref, ":", temp_pinnumber, NULL);
+ if (o_lower_current->type == OBJ_PIN) {
+ temp_pinnumber = o_attrib_search_name_single (o_lower_current, "pinnumber", NULL);
+
+ if (temp_pinnumber != NULL) {
+ row_label = g_strconcat (temp_uref, ":", temp_pinnumber, NULL);
#if DEBUG
- printf("In s_sheet_data_add_master_pin_list_items, about to add to master pin list row_label = %s\n", row_label);
+ printf ("In s_sheet_data_add_master_pin_list_items, about to add to master pin list row_label = %s\n", row_label);
#endif
- s_string_list_add_item(sheet_head->master_pin_list_head, &(sheet_head->pin_count), row_label);
-
- } else { /* didn't find pinnumber. Report error to log. */
- fprintf(stderr, "In s_sheet_data_add_master_pin_list_items, found component pin with no pinnumber.\n");
+ s_string_list_add_item (sheet_head->master_pin_list_head, &(sheet_head->pin_count), row_label);
+
+ } else { /* didn't find pinnumber. Report error to log. */
+ fprintf (stderr, "In s_sheet_data_add_master_pin_list_items, found component pin with no pinnumber.\n");
#ifdef DEBUG
- fprintf(stderr, ". . . . refdes = %s.\n", temp_uref);
+ fprintf (stderr, ". . . . refdes = %s.\n", temp_uref);
#endif
- }
- g_free(temp_pinnumber);
-
- }
- o_lower_current = o_lower_current->next;
- } /* while (o_lower_current != NULL) */
-
- } else { /* didn't find refdes. Report error to log. */
+ }
+ g_free (temp_pinnumber);
+
+ }
+ }
+
+ } else { /* didn't find refdes. Report error to log. */
#ifdef DEBUG
- fprintf(stderr, "In s_sheet_data_add_master_pin_list_items, found component with no refdes.\n");
- fprintf(stderr, ". . . . complex_basename = %s.\n", o_current->complex_basename);
+ fprintf (stderr, "In s_sheet_data_add_master_pin_list_items, found component with no refdes.\n");
+ fprintf (stderr, ". . . . complex_basename = %s.\n", o_current->complex_basename);
#endif
- }
- g_free(temp_uref);
+ }
+ g_free (temp_uref);
- } /* if (o_current->type == OBJ_COMPLEX) */
- o_current = o_current->next;
-
- } /* while o_current != NULL */
+ } /* if (o_current->type == OBJ_COMPLEX) */
+ }
return;
}
@@ -359,14 +356,12 @@ void s_sheet_data_add_master_pin_list_items(OBJECT *start_obj) {
* and stick it in the master pin attrib list.
*
*------------------------------------------------------------------*/
-void s_sheet_data_add_master_pin_attrib_list_items(OBJECT *start_obj) {
+void s_sheet_data_add_master_pin_attrib_list_items (GList *obj_list) {
char *temp_uref;
char *attrib_text;
char *attrib_name;
char *attrib_value;
- OBJECT *o_current;
- OBJECT *o_lower_current;
- GList *a_iter;
+ GList *o_iter, *o_lower_iter, *a_iter;
OBJECT *pin_attrib;
#ifdef DEBUG
@@ -380,8 +375,8 @@ void s_sheet_data_add_master_pin_attrib_list_items(OBJECT *start_obj) {
}
/* ----- Iterate through all objects found on page looking for components ----- */
- o_current = start_obj;
- while (o_current != NULL) {
+ for (o_iter = obj_list; o_iter != NULL; o_iter = g_list_next (o_iter)) {
+ OBJECT *o_current = o_iter->data;
#ifdef DEBUG
printf("In s_sheet_data_add_master_pin_attrib_list_items, examining o_current->name = %s\n", o_current->name);
@@ -392,8 +387,10 @@ void s_sheet_data_add_master_pin_attrib_list_items(OBJECT *start_obj) {
if (temp_uref != NULL) { /* make sure object complex has a refdes */
/* ----- Now iterate through lower level objects looking for pins. ----- */
- o_lower_current = o_current->complex->prim_objs;
- while (o_lower_current != NULL) {
+ for (o_lower_iter = o_current->complex->prim_objs;
+ o_lower_iter != NULL;
+ o_lower_iter = g_list_next (o_lower_iter)) {
+ OBJECT *o_lower_current = o_lower_iter->data;
#if DEBUG
printf("In s_sheet_data_add_master_pin_attrib_list_items, examining component refdes = %s\n", temp_uref);
#endif
@@ -427,16 +424,13 @@ void s_sheet_data_add_master_pin_attrib_list_items(OBJECT *start_obj) {
a_iter = g_list_next (a_iter);
} /* while (pin_attrib != NULL) */
}
- o_lower_current = o_lower_current->next;
- } /* while (o_lower_current != NULL) */
+ }
g_free(temp_uref);
} /* if (temp_uref != NULL ) */
} /* if (o_current->type == OBJ_COMPLEX) */
- o_current = o_current->next;
-
- } /* while (o_current != NULL) */
+ }
return;
}
diff --git a/gattrib/src/s_table.c b/gattrib/src/s_table.c
index 79025a4..368cc92 100644
--- a/gattrib/src/s_table.c
+++ b/gattrib/src/s_table.c
@@ -238,14 +238,13 @@ STRING_LIST *s_table_create_attrib_pair(gchar *row_name,
* attribs and sticks them in the TABLE.
*
*------------------------------------------------------------------*/
-void s_table_add_toplevel_comp_items_to_comp_table(OBJECT *start_obj) {
- OBJECT *o_current;
+void s_table_add_toplevel_comp_items_to_comp_table (GList *obj_list) {
gchar *temp_uref;
int row, col;
gchar *attrib_text;
gchar *attrib_name;
gchar *attrib_value;
- GList *a_iter;
+ GList *o_iter, *a_iter;
OBJECT *a_current;
gint old_visibility, old_show_name_value;
@@ -261,8 +260,8 @@ void s_table_add_toplevel_comp_items_to_comp_table(OBJECT *start_obj) {
#endif
/* ----- Iterate through all objects found on page ----- */
- o_current = start_obj;
- while (o_current != NULL) {
+ for (o_iter = obj_list; o_iter != NULL; o_iter = g_list_next (o_iter)) {
+ OBJECT *o_current = o_iter->data;
#ifdef DEBUG
printf(" ---> In s_table_add_toplevel_comp_items_to_comp_table, examining o_current->name = %s\n", o_current->name);
@@ -338,10 +337,7 @@ void s_table_add_toplevel_comp_items_to_comp_table(OBJECT *start_obj) {
g_free(temp_uref);
} /* if (temp_uref) */
} /* if (o_current->type == OBJ_COMPLEX) */
-
- o_current = o_current->next; /* iterate to next object on page */
-
- } /* while o_current != NULL */
+ }
verbose_done();
@@ -439,9 +435,7 @@ void s_table_add_toplevel_net_items_to_net_table(OBJECT *start_obj) {
* pin attribs and sticks them into the pin table.
*
*------------------------------------------------------------------*/
-void s_table_add_toplevel_pin_items_to_pin_table(OBJECT *start_obj) {
- OBJECT *o_current;
- OBJECT *o_lower_current;
+void s_table_add_toplevel_pin_items_to_pin_table (GList *obj_list) {
gchar *temp_uref;
gchar *pinnumber;
gchar *row_label;
@@ -449,7 +443,8 @@ void s_table_add_toplevel_pin_items_to_pin_table(OBJECT *start_obj) {
gchar *attrib_text;
gchar *attrib_name;
gchar *attrib_value;
- GList *a_iter;
+ GList *o_iter, *a_iter;
+ GList *o_lower_iter;
OBJECT *pin_attrib;
if (verbose_mode) {
@@ -461,8 +456,8 @@ void s_table_add_toplevel_pin_items_to_pin_table(OBJECT *start_obj) {
#endif
/* ----- Iterate through all objects found on page ----- */
- o_current = start_obj;
- while (o_current != NULL) {
+ for (o_iter = obj_list; o_iter != NULL; o_iter = g_list_next (o_iter)) {
+ OBJECT *o_current = o_iter->data;
#ifdef DEBUG
printf(" ---> In s_table_add_toplevel_pin_items_to_pin_table, examining o_current->name = %s\n", o_current->name);
@@ -477,8 +472,10 @@ void s_table_add_toplevel_pin_items_to_pin_table(OBJECT *start_obj) {
if (temp_uref) {
/* ----- Now iterate through lower level objects looking for pins. ----- */
- o_lower_current = o_current->complex->prim_objs;
- while (o_lower_current != NULL) {
+ for (o_lower_iter = o_current->complex->prim_objs;
+ o_lower_iter != NULL;
+ o_lower_iter = g_list_next (o_lower_iter)) {
+ OBJECT *o_lower_current = o_lower_iter->data;
if (o_lower_current->type == OBJ_PIN) {
/* ----- Found a pin. First get its pinnumber. then get attrib head and loop on attribs. ----- */
@@ -538,16 +535,13 @@ void s_table_add_toplevel_pin_items_to_pin_table(OBJECT *start_obj) {
g_free(row_label);
}
- o_lower_current = o_lower_current->next;
- } /* while (o_lower_current != NULL) */
+ }
}
g_free(temp_uref);
}
- o_current = o_current->next; /* iterate to next object on page */
-
- } /* while o_current != NULL */
+ }
verbose_done();
}
diff --git a/gattrib/src/s_toplevel.c b/gattrib/src/s_toplevel.c
index 31cf91b..c79207e 100644
--- a/gattrib/src/s_toplevel.c
+++ b/gattrib/src/s_toplevel.c
@@ -86,23 +86,23 @@ int s_toplevel_read_page(char *filename)
*/
void s_toplevel_verify_design(TOPLEVEL *pr_current)
{
- GList *iter;
- OBJECT *o_current;
- PAGE *p_current;
+ GList *p_iter, *o_iter;
int missing_sym_flag = 0;
- for ( iter = geda_list_get_glist( pr_current->pages );
- iter != NULL;
- iter = g_list_next( iter ) ) {
+ for (p_iter = geda_list_get_glist (pr_current->pages);
+ p_iter != NULL;
+ p_iter = g_list_next (p_iter)) {
+ PAGE *p_current = p_iter->data;
+
+ for (o_iter = p_current->object_list;
+ o_iter != NULL;
+ o_iter = g_list_next (o_iter)) {
+ OBJECT *o_current = o_iter->data;
- p_current = (PAGE *)iter->data;
- o_current = p_current->object_head;
- while (o_current != NULL) {
/* --- look for object, and verify that it has a symbol file attached. ---- */
if (o_current->type == OBJ_PLACEHOLDER) {
missing_sym_flag = 1; /* flag to signal that problem exists. */
}
- o_current = o_current->next;
}
}
@@ -154,8 +154,8 @@ s_toplevel_gtksheet_to_toplevel()
p_current = (PAGE *)iter->data;
/* only traverse pages which are toplevel */
- if (p_current->object_head && p_current->page_control == 0) {
- s_toplevel_sheetdata_to_toplevel(p_current->object_head); /* adds all objects from page */
+ if (p_current->page_control == 0) {
+ s_toplevel_sheetdata_to_toplevel (p_current->object_list); /* adds all objects from page */
}
}
@@ -390,10 +390,9 @@ void s_toplevel_select_object()
* 3. Finally find and update pin attribs.
*------------------------------------------------------------------*/
void
-s_toplevel_sheetdata_to_toplevel(OBJECT *start_obj)
+s_toplevel_sheetdata_to_toplevel (GList *obj_list)
{
- OBJECT *o_current;
- OBJECT *comp_prim_obj;
+ GList *o_iter, *prim_iter;
char *temp_uref;
STRING_LIST *new_comp_attrib_pair_list;
STRING_LIST *new_pin_attrib_list;
@@ -402,8 +401,8 @@ s_toplevel_sheetdata_to_toplevel(OBJECT *start_obj)
#ifdef DEBUG
printf("----- In s_toplevel_sheetdata_to_toplevel, handling components\n");
#endif
- o_current = start_obj;
- while (o_current != NULL) {
+ for (o_iter = obj_list; o_iter != NULL; o_iter = g_list_next (o_iter)) {
+ OBJECT *o_current = o_iter->data;
/* ------- Object is a component. Handle component attributes. ------- */
if (o_current->type == OBJ_COMPLEX) { /* Note that OBJ_COMPLEX = component + attribs */
@@ -438,9 +437,7 @@ s_toplevel_sheetdata_to_toplevel(OBJECT *start_obj)
}
} /* if (o_current->type == OBJ_COMPLEX) */
-
- o_current = o_current->next;
- } /* while (o_current != NULL) */
+ }
#if 0
@@ -455,8 +452,8 @@ s_toplevel_sheetdata_to_toplevel(OBJECT *start_obj)
#ifdef DEBUG
printf("----- In s_toplevel_sheetdata_to_toplevel, handling pins\n");
#endif
- o_current = start_obj;
- while (o_current != NULL) {
+ for (o_iter = obj_list; o_iter != NULL; o_iter = g_list_next (o_iter)) {
+ OBJECT *o_current = o_iter->data;
/* ------- Object is a complex. Handle pins by looking ------ */
/* ------- for all pins attached to a component. ------ */
@@ -473,21 +470,21 @@ s_toplevel_sheetdata_to_toplevel(OBJECT *start_obj)
temp_uref = s_attrib_get_refdes(o_current);
if ( (temp_uref != NULL) && (o_current->complex->prim_objs) ) { /* make sure object complex has a refdes */
- comp_prim_obj = o_current->complex->prim_objs;
- while (comp_prim_obj != NULL) {
+ for (prim_iter = o_current->complex->prim_objs;
+ prim_iter != NULL;
+ prim_iter = g_list_next (prim_iter)) {
+ OBJECT *comp_prim_obj = prim_iter->data;
+
if (comp_prim_obj->type == OBJ_PIN) {
new_pin_attrib_list = s_toplevel_get_pin_attribs_in_sheet(temp_uref, comp_prim_obj);
s_toplevel_update_pin_attribs_in_toplevel(temp_uref, comp_prim_obj, new_pin_attrib_list);
}
- comp_prim_obj = comp_prim_obj->next;
- }
+ }
} /* if(temp_uref */
g_free(temp_uref);
}
-
- o_current = o_current->next;
- } /* while (o_current != NULL) */
+ }
return;
}
diff --git a/gattrib/src/x_fileselect.c b/gattrib/src/x_fileselect.c
index a4d3ad5..eb10736 100644
--- a/gattrib/src/x_fileselect.c
+++ b/gattrib/src/x_fileselect.c
@@ -147,18 +147,18 @@ x_fileselect_load_files (GSList *filenames)
}
/* Now add all items found to the master lists */
- s_sheet_data_add_master_comp_list_items(pr_current->page_current->object_head);
- s_sheet_data_add_master_comp_attrib_list_items(pr_current->page_current->object_head);
+ s_sheet_data_add_master_comp_list_items (pr_current->page_current->object_list);
+ s_sheet_data_add_master_comp_attrib_list_items (pr_current->page_current->object_list);
#if 0
/* Note that this must be changed. We need to input the entire project
* before doing anything with the nets because we need to first
* determine where they are all connected! */
- s_sheet_data_add_master_net_list_items(pr_current->page_current->object_head);
- s_sheet_data_add_master_net_attrib_list_items(pr_current->page_current->object_head);
+ s_sheet_data_add_master_net_list_items (pr_current->page_current->object_list);
+ s_sheet_data_add_master_net_attrib_list_items (pr_current->page_current->object_list);
#endif
- s_sheet_data_add_master_pin_list_items(pr_current->page_current->object_head);
- s_sheet_data_add_master_pin_attrib_list_items(pr_current->page_current->object_head);
+ s_sheet_data_add_master_pin_list_items (pr_current->page_current->object_list);
+ s_sheet_data_add_master_pin_attrib_list_items (pr_current->page_current->object_list);
} /* end of loop over files */
@@ -189,9 +189,9 @@ x_fileselect_load_files (GSList *filenames)
p_local = (PAGE *)iter->data;
/* only traverse pages which are toplevel */
- if (p_local->object_head && p_local->page_control == 0) {
+ if (p_local->page_control == 0) {
/* adds all components from page to comp_table */
- s_table_add_toplevel_comp_items_to_comp_table(p_local->object_head);
+ s_table_add_toplevel_comp_items_to_comp_table (p_local->object_list);
#if 0
/* Note that this must be changed. We need to input the entire project
* before doing anything with the nets because we need to first
@@ -202,7 +202,7 @@ x_fileselect_load_files (GSList *filenames)
#endif
/* adds all pins from page to pin_table */
- s_table_add_toplevel_pin_items_to_pin_table(p_local->object_head);
+ s_table_add_toplevel_pin_items_to_pin_table (p_local->object_list);
}
} /* for loop over pages */
diff --git a/gnetlist/include/prototype.h b/gnetlist/include/prototype.h
index edde9aa..cc19689 100644
--- a/gnetlist/include/prototype.h
+++ b/gnetlist/include/prototype.h
@@ -108,9 +108,9 @@ SCM g_get_renamed_nets(SCM scm_level);
/* s_traverse.c */
void s_traverse_init(void);
void s_traverse_start(TOPLEVEL *pr_current);
-void s_traverse_sheet(TOPLEVEL *pr_current, OBJECT *start, char *hierarchy_tag);
+void s_traverse_sheet(TOPLEVEL *pr_current, GList *obj_list, char *hierarchy_tag);
CPINLIST *s_traverse_component(TOPLEVEL *pr_current, OBJECT *component, char *hierarchy_tag);
-void s_traverse_clear_all_visited(OBJECT *object_head);
+void s_traverse_clear_all_visited(GList *obj_list);
NET *s_traverse_net(TOPLEVEL *pr_current, OBJECT *previous_object, NET *nets, OBJECT *object, char *hierarchy_tag);
/* vams_misc.c */
SCM vams_get_attribs_list(OBJECT *object);
diff --git a/gnetlist/src/s_hierarchy.c b/gnetlist/src/s_hierarchy.c
index 2f0cc06..6be5944 100644
--- a/gnetlist/src/s_hierarchy.c
+++ b/gnetlist/src/s_hierarchy.c
@@ -113,7 +113,7 @@ s_hierarchy_traverse(TOPLEVEL * pr_current, OBJECT * o_current,
/* can't do the following, don't know why... HACK TODO */
/*netlist->hierarchy_tag = u_basic_strdup (netlist->component_uref);*/
s_traverse_sheet(pr_current,
- pr_current->page_current->object_head,
+ pr_current->page_current->object_list,
netlist->component_uref);
verbose_print("^");
diff --git a/gnetlist/src/s_traverse.c b/gnetlist/src/s_traverse.c
index ad6e4be..8bf2b33 100644
--- a/gnetlist/src/s_traverse.c
+++ b/gnetlist/src/s_traverse.c
@@ -76,9 +76,9 @@ void s_traverse_start(TOPLEVEL * pr_current)
p_current = (PAGE *)iter->data;
/* only traverse pages which are toplevel, ie not underneath */
- if (p_current->object_head && p_current->page_control == 0) {
+ if (p_current->page_control == 0) {
pr_current->page_current = p_current;
- s_traverse_sheet(pr_current, p_current->object_head, NULL);
+ s_traverse_sheet (pr_current, p_current->object_list, NULL);
}
}
@@ -98,23 +98,21 @@ void s_traverse_start(TOPLEVEL * pr_current)
void
-s_traverse_sheet(TOPLEVEL * pr_current, OBJECT * start,
- char *hierarchy_tag)
+s_traverse_sheet (TOPLEVEL * pr_current, GList *obj_list, char *hierarchy_tag)
{
- OBJECT *o_current;
NETLIST *netlist;
char *temp;
SCM scm_uref;
char *temp_uref;
gboolean is_graphical=FALSE;
+ GList *iter;
if (verbose_mode) {
printf("- Starting internal netlist creation\n");
}
- o_current = start;
-
- while (o_current != NULL) {
+ for (iter = obj_list; iter != NULL; iter = g_list_next (iter)) {
+ OBJECT *o_current = iter->data;
netlist = s_netlist_return_tail(netlist_head);
@@ -208,8 +206,6 @@ s_traverse_sheet(TOPLEVEL * pr_current, OBJECT * start,
s_hierarchy_traverse(pr_current, o_current, netlist);
}
}
-
- o_current = o_current->next;
}
verbose_done();
@@ -220,19 +216,21 @@ CPINLIST *s_traverse_component(TOPLEVEL * pr_current, OBJECT * component,
{
CPINLIST *cpinlist_head = NULL;
CPINLIST *cpins = NULL;
- OBJECT *o_current = NULL;
NET *nets_head = NULL;
NET *nets = NULL;
char *temp;
CONN *c_current;
GList *cl_current;
-
- o_current = component->complex->prim_objs;
+ GList *iter;
cpinlist_head = cpins = s_cpinlist_add(NULL);
cpins->plid = -1;
- while (o_current != NULL) {
+ for (iter = component->complex->prim_objs;
+ iter != NULL;
+ iter = g_list_next (iter)) {
+ OBJECT *o_current = iter->data;
+
if (o_current->type == OBJ_PIN) {
verbose_print("p");
@@ -309,7 +307,7 @@ CPINLIST *s_traverse_component(TOPLEVEL * pr_current, OBJECT * component,
hierarchy_tag);
s_traverse_clear_all_visited(pr_current->
- page_current->object_head);
+ page_current->object_list);
}
}
@@ -323,9 +321,7 @@ CPINLIST *s_traverse_component(TOPLEVEL * pr_current, OBJECT * component,
/* should pass in page_current in top level func */
}
s_traverse_clear_all_visited(pr_current->page_current->
- object_head);
-
- o_current = o_current->next;
+ object_list);
}
@@ -333,13 +329,12 @@ CPINLIST *s_traverse_component(TOPLEVEL * pr_current, OBJECT * component,
}
-void s_traverse_clear_all_visited(OBJECT * object_head)
+void s_traverse_clear_all_visited (GList *obj_list)
{
- OBJECT *o_current;
-
- o_current = object_head;
+ GList *iter;
- while (o_current != NULL) {
+ for (iter = obj_list; iter != NULL; iter = g_list_next (iter)) {
+ OBJECT *o_current = iter->data;
#if DEBUG
if (o_current->visited) {
@@ -354,7 +349,6 @@ void s_traverse_clear_all_visited(OBJECT * object_head)
s_traverse_clear_all_visited(o_current->complex->prim_objs);
}
- o_current = o_current->next;
}
}
diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index d338a7a..5f5965a 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -9,7 +9,7 @@ void a_pan(GSCHEM_TOPLEVEL *w_current, int x, int y);
void a_pan_mouse(GSCHEM_TOPLEVEL *w_current, int diff_x, int diff_y);
/* a_zoom.c */
void a_zoom(GSCHEM_TOPLEVEL *w_current, int dir, int selected_from, int pan_flags);
-void a_zoom_extents(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int pan_flags);
+void a_zoom_extents(GSCHEM_TOPLEVEL *w_current, GList *list, int pan_flags);
void a_zoom_box(GSCHEM_TOPLEVEL *w_current, int pan_flags);
void a_zoom_box_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
void a_zoom_box_end(GSCHEM_TOPLEVEL *w_current, int x, int y);
@@ -481,7 +481,7 @@ void o_attrib_toggle_show_name_value(GSCHEM_TOPLEVEL *w_current, OBJECT *object,
OBJECT *o_attrib_add_attrib(GSCHEM_TOPLEVEL *w_current, const char *text_string, int visibility, int show_name_value, OBJECT *object);
/* o_basic.c */
void o_redraw_all(GSCHEM_TOPLEVEL *w_current);
-void o_redraw(GSCHEM_TOPLEVEL *w_current, OBJECT *object_list, gboolean draw_selected);
+void o_redraw(GSCHEM_TOPLEVEL *w_current, GList *object_list, gboolean draw_selected);
void o_redraw_single(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
void o_draw_list(GSCHEM_TOPLEVEL *w_current, GList *list);
void o_draw_selected(GSCHEM_TOPLEVEL *w_current);
@@ -492,12 +492,10 @@ void o_drawbounding(GSCHEM_TOPLEVEL *w_current, GList *o_glist, GdkColor *color,
int o_erase_rubber(GSCHEM_TOPLEVEL *w_current);
int o_redraw_cleanstates(GSCHEM_TOPLEVEL *w_current);
void o_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *object);
-void o_list_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *list);
void o_glist_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, GList *list);
void o_invalidate_rect(GSCHEM_TOPLEVEL *w_current, int x1, int y1, int x2, int y2);
void o_invalidate_all(GSCHEM_TOPLEVEL *w_current);
void o_invalidate(GSCHEM_TOPLEVEL *w_current, OBJECT *object);
-void o_invalidate_list(GSCHEM_TOPLEVEL *w_current, OBJECT *list);
void o_invalidate_glist(GSCHEM_TOPLEVEL *w_current, GList *list);
void o_erase_grips (GSCHEM_TOPLEVEL *w_current, OBJECT *object);
/* o_box.c */
@@ -561,7 +559,7 @@ void o_copy_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
void o_copy_end(GSCHEM_TOPLEVEL *w_current);
void o_copy_multiple_end(GSCHEM_TOPLEVEL *w_current);
/* o_cue.c */
-void o_cue_redraw_all(GSCHEM_TOPLEVEL *w_current, OBJECT *head, gboolean draw_selected);
+void o_cue_redraw_all(GSCHEM_TOPLEVEL *w_current, GList *list, gboolean draw_selected);
void o_cue_draw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *object, int whichone);
void o_cue_erase_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *object, int whichone);
void o_cue_draw_lowlevel_midpoints(GSCHEM_TOPLEVEL *w_current, OBJECT *object);
@@ -570,7 +568,6 @@ void o_cue_erase_single(GSCHEM_TOPLEVEL *w_current, OBJECT *object);
void o_cue_undraw(GSCHEM_TOPLEVEL *w_current, OBJECT *object);
void o_cue_draw_list(GSCHEM_TOPLEVEL *w_current, GList *object_list);
void o_cue_undraw_list(GSCHEM_TOPLEVEL *w_current, GList *object_list);
-void o_cue_undraw_objects(GSCHEM_TOPLEVEL *w_current, OBJECT *list);
/* o_delete.c */
void o_delete(GSCHEM_TOPLEVEL *w_current, OBJECT *object);
void o_delete_selected(GSCHEM_TOPLEVEL *w_current);
@@ -634,17 +631,17 @@ void o_lock(GSCHEM_TOPLEVEL *w_current);
void o_unlock(GSCHEM_TOPLEVEL *w_current);
void o_rotate_world_update(GSCHEM_TOPLEVEL *w_current, int centerx, int centery, int angle, GList *list);
void o_mirror_world_update(GSCHEM_TOPLEVEL *w_current, int centerx, int centery, GList *list);
-void o_edit_show_hidden_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list);
-void o_edit_show_hidden(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list);
-void o_edit_make_visible(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list);
-int o_edit_find_text(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list, char *stext, int descend, int skip);
-void o_edit_hide_specific_text(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list, char *stext);
-void o_edit_show_specific_text(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list, char *stext);
+void o_edit_show_hidden_lowlevel(GSCHEM_TOPLEVEL *w_current, GList *o_list);
+void o_edit_show_hidden(GSCHEM_TOPLEVEL *w_current, GList *o_list);
+void o_edit_make_visible(GSCHEM_TOPLEVEL *w_current, GList *o_list);
+int o_edit_find_text(GSCHEM_TOPLEVEL *w_current, GList *o_list, char *stext, int descend, int skip);
+void o_edit_hide_specific_text(GSCHEM_TOPLEVEL *w_current, GList *o_list, char *stext);
+void o_edit_show_specific_text(GSCHEM_TOPLEVEL *w_current, GList *o_list, char *stext);
void o_update_component(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
void o_autosave_backups(GSCHEM_TOPLEVEL *w_current);
/* o_move.c */
void o_move_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
-void o_move_end_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *list, int type, int diff_x, int diff_y, GList **other_objects, GList **connected_objects);
+void o_move_end_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *object, int diff_x, int diff_y, GList **other_objects, GList **connected_objects);
void o_move_end(GSCHEM_TOPLEVEL *w_current);
void o_move_cancel(GSCHEM_TOPLEVEL *w_current);
void o_move_rubbermove(GSCHEM_TOPLEVEL *w_current, int x, int y);
@@ -725,7 +722,7 @@ void o_select_unselect_list(GSCHEM_TOPLEVEL *w_current, SELECTION *selection);
void o_select_unselect_all(GSCHEM_TOPLEVEL *w_current);
void o_select_move_to_place_list(GSCHEM_TOPLEVEL *w_current);
/* o_slot.c */
-void o_slot_start(GSCHEM_TOPLEVEL *w_current, OBJECT *list);
+void o_slot_start(GSCHEM_TOPLEVEL *w_current, OBJECT *object);
void o_slot_end(GSCHEM_TOPLEVEL *w_current, const char *string, int len);
/* o_text.c */
void o_text_draw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
@@ -741,7 +738,7 @@ void o_text_change(GSCHEM_TOPLEVEL *w_current, OBJECT *object, char *string, int
void o_undo_init(void);
void o_undo_savestate(GSCHEM_TOPLEVEL *w_current, int flag);
char *o_undo_find_prev_filename(UNDO *start);
-OBJECT *o_undo_find_prev_object_head(UNDO *start);
+GList *o_undo_find_prev_object_head(UNDO *start);
void o_undo_callback(GSCHEM_TOPLEVEL *w_current, int type);
void o_undo_cleanup(void);
void o_undo_remove_last_undo(GSCHEM_TOPLEVEL *w_current);
@@ -751,7 +748,7 @@ int parse_commandline(int argc, char *argv[]);
/* x_attribedit.c */
gint option_menu_get_history(GtkOptionMenu *option_menu);
void attrib_edit_dialog_ok(GtkWidget *w, GSCHEM_TOPLEVEL *w_current);
-void attrib_edit_dialog(GSCHEM_TOPLEVEL *w_current, OBJECT *list, int flag);
+void attrib_edit_dialog(GSCHEM_TOPLEVEL *w_current, OBJECT *attr_obj, int flag);
/* x_autonumber.c */
void autonumber_text_dialog(GSCHEM_TOPLEVEL *w_current);
/* x_basic.c */
diff --git a/gschem/src/a_zoom.c b/gschem/src/a_zoom.c
index c112116..2d94a7d 100644
--- a/gschem/src/a_zoom.c
+++ b/gschem/src/a_zoom.c
@@ -142,24 +142,20 @@ void a_zoom(GSCHEM_TOPLEVEL *w_current, int dir, int selected_from, int pan_flag
* \par Function Description
*
*/
-void a_zoom_extents(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current, int pan_flags)
+void a_zoom_extents (GSCHEM_TOPLEVEL *w_current, GList *list, int pan_flags)
{
TOPLEVEL *toplevel = w_current->toplevel;
int lleft, lright, ltop, lbottom;
double zx, zy, relativ_zoom_factor;
double world_pan_center_x,world_pan_center_y;
- if (o_current != NULL) {
- if (o_current->next == NULL) {
- return;
- }
- } else {
+ if (list == NULL) {
return;
}
- if ( !world_get_object_list_bounds(toplevel, o_current,
- &lleft, <op,
- &lright, &lbottom)) {
+ if (!world_get_object_glist_bounds (toplevel, list,
+ &lleft, <op,
+ &lright, &lbottom)) {
return;
}
diff --git a/gschem/src/g_funcs.c b/gschem/src/g_funcs.c
index 981f119..db3d56c 100644
--- a/gschem/src/g_funcs.c
+++ b/gschem/src/g_funcs.c
@@ -264,11 +264,14 @@ SCM get_selected_component_attributes(GSCHEM_TOPLEVEL *w_current)
SCM list = SCM_EOL;
OBJECT *obj;
GHashTable *ht;
+ GList *iter;
/* build a hash table */
ht = g_hash_table_new (g_str_hash, g_str_equal);
- for (obj = w_current->toplevel->page_current->object_head; obj != NULL;
- obj = obj->next) {
+ for (iter = w_current->toplevel->page_current->object_list;
+ iter != NULL;
+ iter = g_list_next (iter)) {
+ obj = (OBJECT *)iter->data;
if (obj->selected && obj->type == OBJ_TEXT) {
const gchar *str = o_text_get_string (w_current->toplevel, obj);
if (str == NULL) continue;
diff --git a/gschem/src/g_hook.c b/gschem/src/g_hook.c
index 21dd7ae..af4288c 100644
--- a/gschem/src/g_hook.c
+++ b/gschem/src/g_hook.c
@@ -38,8 +38,8 @@ static void custom_world_get_single_object_bounds
GList *exclude_attrib_list,
GList *exclude_obj_type_list);
-static void custom_world_get_object_list_bounds
- (TOPLEVEL *toplevel, OBJECT *o_current,
+static void custom_world_get_object_glist_bounds
+ (TOPLEVEL *toplevel, GList *list,
int *left, int *top,
int *right, int *bottom,
GList *exclude_attrib_list,
@@ -439,7 +439,7 @@ static void custom_world_get_single_object_bounds
break;
case (OBJ_COMPLEX):
case (OBJ_PLACEHOLDER):
- custom_world_get_object_list_bounds(toplevel,
+ custom_world_get_object_glist_bounds (toplevel,
o_current->complex->prim_objs,
left, top, right, bottom,
exclude_attrib_list,
@@ -482,14 +482,15 @@ static void custom_world_get_single_object_bounds
}
}
-static void custom_world_get_object_list_bounds
- (TOPLEVEL *toplevel, OBJECT *o_current,
+static void custom_world_get_object_glist_bounds
+ (TOPLEVEL *toplevel, GList *list,
int *left, int *top,
int *right, int *bottom,
GList *exclude_attrib_list,
GList *exclude_obj_type_list) {
- OBJECT *obj_ptr=NULL;
+ OBJECT *o_current;
+ GList *iter;
int rleft, rtop, rright, rbottom;
*left = rleft = 999999;
@@ -498,10 +499,11 @@ static void custom_world_get_object_list_bounds
*bottom = rbottom = 0;
- obj_ptr = o_current;
+ iter = list;
- while ( obj_ptr != NULL ) {
- custom_world_get_single_object_bounds(toplevel, obj_ptr, &rleft, &rtop,
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
+ custom_world_get_single_object_bounds (toplevel, o_current, &rleft, &rtop,
&rright, &rbottom,
exclude_attrib_list,
exclude_obj_type_list);
@@ -509,9 +511,8 @@ static void custom_world_get_object_list_bounds
if (rtop < *top) *top = rtop;
if (rright > *right) *right = rright;
if (rbottom > *bottom) *bottom = rbottom;
-
- obj_ptr=obj_ptr->next;
+ iter = g_list_next (iter);
}
}
@@ -612,6 +613,7 @@ SCM g_get_object_pins (SCM object_smob)
TOPLEVEL *toplevel=NULL;
OBJECT *object=NULL;
OBJECT *prim_obj;
+ GList *iter;
SCM returned=SCM_EOL;
/* Get toplevel and o_current */
@@ -622,12 +624,13 @@ SCM g_get_object_pins (SCM object_smob)
return (returned);
}
if (object->complex && object->complex->prim_objs) {
- prim_obj = object->complex->prim_objs;
- while (prim_obj != NULL) {
+ iter = object->complex->prim_objs;
+ while (iter != NULL) {
+ prim_obj = (OBJECT *)iter->data;
if (prim_obj->type == OBJ_PIN) {
returned = scm_cons (g_make_object_smob(toplevel, prim_obj),returned);
}
- prim_obj = prim_obj->next;
+ iter = g_list_next (iter);
}
}
@@ -704,7 +707,7 @@ SCM g_add_component(SCM page_smob, SCM scm_comp_name, SCM scm_x, SCM scm_y,
new_obj = o_complex_new (toplevel, 'C', WHITE, x, y, angle, mirror,
clib, comp_name, selectable);
s_page_append (page, new_obj);
- o_complex_promote_attribs (toplevel, new_obj);
+ o_complex_promote_attribs (toplevel, new_obj, &page->object_list);
/*
* For now, do not redraw the newly added complex, since this might cause
@@ -731,18 +734,20 @@ SCM g_get_objects_in_page(SCM page_smob) {
TOPLEVEL *toplevel;
PAGE *page;
OBJECT *object;
+ GList *iter;
SCM return_list=SCM_EOL;
/* Get toplevel and the page */
SCM_ASSERT (g_get_data_from_page_smob (page_smob, &toplevel, &page),
page_smob, SCM_ARG1, "add-component");
- if (page && page->object_head && page->object_head->next) {
- object = page->object_head->next;
- while (object) {
+ if (page && page->object_list) {
+ iter = page->object_list;
+ while (iter != NULL) {
+ object = (OBJECT *)iter->data;
return_list = scm_cons (g_make_object_smob(toplevel, object),
return_list);
- object = object->next;
+ iter = g_list_next (iter);
}
}
diff --git a/gschem/src/i_callbacks.c b/gschem/src/i_callbacks.c
index 52c630d..47932ff 100644
--- a/gschem/src/i_callbacks.c
+++ b/gschem/src/i_callbacks.c
@@ -1103,7 +1103,7 @@ DEFINE_I_CALLBACK(edit_show_hidden)
i_callback_edit_show_hidden,
_("ShowHidden"));
- o_edit_show_hidden(w_current, w_current->toplevel->page_current->object_head);
+ o_edit_show_hidden (w_current, w_current->toplevel->page_current->object_list);
}
/*! \todo Finish function documentation!!!
@@ -1126,7 +1126,7 @@ DEFINE_I_CALLBACK(edit_make_visible)
i_callback_edit_make_visible,
_("MakeVisible"));
- o_edit_make_visible(w_current, w_current->toplevel->page_current->object_head);
+ o_edit_make_visible (w_current, w_current->toplevel->page_current->object_list);
}
/*! \todo Finish function documentation!!!
@@ -1343,7 +1343,7 @@ DEFINE_I_CALLBACK(view_zoom_extents)
exit_if_null(w_current);
/* scroll bar stuff */
- a_zoom_extents(w_current, w_current->toplevel->page_current->object_head, 0);
+ a_zoom_extents (w_current, w_current->toplevel->page_current->object_list, 0);
if (w_current->undo_panzoom) {
o_undo_savestate(w_current, UNDO_VIEWPORT_ONLY);
}
@@ -2775,7 +2775,7 @@ DEFINE_I_CALLBACK(hierarchy_down_schematic)
/* s_hierarchy_down_schematic_single() will not zoom the loaded page */
if (page_control != -1) {
a_zoom_extents(w_current,
- w_current->toplevel->page_current->object_head,
+ w_current->toplevel->page_current->object_list,
A_PAN_DONT_REDRAW);
o_undo_savestate(w_current, UNDO_ALL);
}
@@ -2868,7 +2868,7 @@ DEFINE_I_CALLBACK(hierarchy_down_symbol)
w_current->toplevel->page_current);
/* s_hierarchy_down_symbol() will not zoom the loaded page */
a_zoom_extents(w_current,
- w_current->toplevel->page_current->object_head,
+ w_current->toplevel->page_current->object_list,
A_PAN_DONT_REDRAW);
o_undo_savestate(w_current, UNDO_ALL);
x_window_set_current_page(w_current, w_current->toplevel->page_current);
diff --git a/gschem/src/o_arc.c b/gschem/src/o_arc.c
index cdf2f2b..992fb57 100644
--- a/gschem/src/o_arc.c
+++ b/gschem/src/o_arc.c
@@ -948,7 +948,7 @@ void o_arc_end4(GSCHEM_TOPLEVEL *w_current, int radius,
s_page_append (toplevel->page_current, new_obj);
/* draw the new object */
- o_redraw_single(w_current, toplevel->page_current->object_tail);
+ o_redraw_single (w_current, new_obj);
w_current->first_wx = -1;
w_current->first_wy = -1;
diff --git a/gschem/src/o_attrib.c b/gschem/src/o_attrib.c
index 174adb8..ded6913 100644
--- a/gschem/src/o_attrib.c
+++ b/gschem/src/o_attrib.c
@@ -224,9 +224,9 @@ OBJECT *o_attrib_add_attrib(GSCHEM_TOPLEVEL *w_current,
break;
}
} else {
- world_get_object_list_bounds(toplevel,
- toplevel->page_current->object_head,
- &left, &top, &right, &bottom);
+ world_get_object_glist_bounds (toplevel,
+ toplevel->page_current->object_list,
+ &left, &top, &right, &bottom);
/* this really is the lower left hand corner */
world_x = left;
@@ -243,19 +243,16 @@ OBJECT *o_attrib_add_attrib(GSCHEM_TOPLEVEL *w_current,
visibility, show_name_value);
s_page_append (toplevel->page_current, new_obj);
- /* now toplevel->page_current->object_tail contains new text item */
-
/* now attach the attribute to the object (if o_current is not NULL) */
/* remember that o_current contains the object to get the attribute */
if (o_current) {
- o_attrib_attach (toplevel, toplevel->page_current->object_tail, o_current);
+ o_attrib_attach (toplevel, new_obj, o_current);
}
- o_selection_add( toplevel->page_current->selection_list,
- toplevel->page_current->object_tail );
+ o_selection_add (toplevel->page_current->selection_list, new_obj);
- o_erase_single(w_current, toplevel->page_current->object_tail);
- o_text_draw(w_current, toplevel->page_current->object_tail);
+ o_erase_single (w_current, new_obj);
+ o_text_draw (w_current, new_obj);
/* handle slot= attribute, it's a special case */
if (g_ascii_strncasecmp (text_string, "slot=", 5) == 0) {
@@ -265,13 +262,12 @@ OBJECT *o_attrib_add_attrib(GSCHEM_TOPLEVEL *w_current,
/* Run the add attribute hook */
if (scm_hook_empty_p(add_attribute_hook) == SCM_BOOL_F &&
o_current != NULL) {
- scm_run_hook(add_attribute_hook,
- scm_cons(g_make_object_smob(toplevel,
- o_current),
- SCM_EOL));
- }
-
+ scm_run_hook (add_attribute_hook,
+ scm_cons (g_make_object_smob (toplevel, o_current),
+ SCM_EOL));
+ }
+
toplevel->page_current->CHANGED = 1;
- return(toplevel->page_current->object_tail);
+ return new_obj;
}
diff --git a/gschem/src/o_basic.c b/gschem/src/o_basic.c
index d44b993..7da72a8 100644
--- a/gschem/src/o_basic.c
+++ b/gschem/src/o_basic.c
@@ -50,9 +50,12 @@ void o_redraw_all(GSCHEM_TOPLEVEL *w_current)
((w_current->event_state == MOVE) ||
(w_current->event_state == ENDMOVE) ||
(w_current->event_state == GRIPS)));
- o_redraw(w_current, toplevel->page_current->object_head, draw_selected);
+ g_return_if_fail (toplevel != NULL);
+ g_return_if_fail (toplevel->page_current != NULL);
+ g_warn_if_fail (toplevel->page_current->object_list != NULL);
+ o_redraw (w_current, toplevel->page_current->object_list, draw_selected);
o_cue_redraw_all(w_current,
- toplevel->page_current->object_head, draw_selected);
+ toplevel->page_current->object_list, draw_selected);
if (w_current->inside_action) {
switch(w_current->event_state) {
@@ -85,14 +88,17 @@ void o_redraw_all(GSCHEM_TOPLEVEL *w_current)
* \par Function Description
*
*/
-void o_redraw(GSCHEM_TOPLEVEL *w_current, OBJECT *list, gboolean draw_selected)
+void o_redraw (GSCHEM_TOPLEVEL *w_current, GList *object_list, gboolean draw_selected)
{
TOPLEVEL *toplevel = w_current->toplevel;
- OBJECT *o_current = list;
+ OBJECT *o_current;
+ GList *iter;
int redraw_state = toplevel->DONT_REDRAW;
w_current->inside_redraw = 1;
- while (o_current != NULL) {
+ iter = object_list;
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
if ((o_current->draw_func != NULL) &&
(o_current->type != OBJ_HEAD)) {
toplevel->DONT_REDRAW = redraw_state ||
@@ -101,12 +107,12 @@ void o_redraw(GSCHEM_TOPLEVEL *w_current, OBJECT *list, gboolean draw_selected)
(*o_current->draw_func)(w_current, o_current);
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
w_current->inside_redraw = 0;
toplevel->DONT_REDRAW = redraw_state;
- o_invalidate_list (w_current, list);
+ o_invalidate_glist (w_current, object_list);
}
/*! \brief Redraw an object on the screen.
@@ -586,22 +592,6 @@ void o_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *object)
* \par Function Description
*
*/
-void o_list_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *list)
-{
- OBJECT *o_current = list;
-
- while(o_current != NULL) {
- o_draw_xor(w_current, dx, dy, o_current);
- o_current = o_current->next;
- }
-}
-
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
void o_glist_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, GList *list)
{
GList *iter = list;
@@ -695,29 +685,6 @@ void o_invalidate (GSCHEM_TOPLEVEL *w_current, OBJECT *object)
}
-/*! \brief Invalidate on-screen area for a list of objects
- *
- * \par Function Description
- * This function calls o_invalidate_rect() with the bounds of the
- * passed object list, converted to screen coordinates.
- *
- * \param [in] w_current The GSCHEM_TOPLEVEL object.
- * \param [in] list The list objects invalidated on screen.
- */
-void o_invalidate_list (GSCHEM_TOPLEVEL *w_current, OBJECT *list)
-{
- TOPLEVEL *toplevel = w_current->toplevel;
- int left, top, bottom, right;
- int s_left, s_top, s_bottom, s_right;
- if (world_get_object_list_bounds (toplevel, list, &left, &top,
- &right, &bottom)) {
- WORLDtoSCREEN (toplevel, left, top, &s_left, &s_top);
- WORLDtoSCREEN (toplevel, right, bottom, &s_right, &s_bottom);
- o_invalidate_rect (w_current, s_left, s_top, s_right, s_bottom);
- }
-}
-
-
/*! \brief Invalidate on-screen area for a GList of objects
*
* \par Function Description
diff --git a/gschem/src/o_box.c b/gschem/src/o_box.c
index 936128a..1852f63 100644
--- a/gschem/src/o_box.c
+++ b/gschem/src/o_box.c
@@ -835,7 +835,7 @@ void o_box_end(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
s_page_append (toplevel->page_current, new_obj);
/* draw it */
- o_redraw_single(w_current, toplevel->page_current->object_tail);
+ o_redraw_single (w_current, new_obj);
#if DEBUG
printf("coords: %d %d %d %d\n", box_left, box_top, box_width, box_height);
diff --git a/gschem/src/o_buffer.c b/gschem/src/o_buffer.c
index 2059e63..21f445f 100644
--- a/gschem/src/o_buffer.c
+++ b/gschem/src/o_buffer.c
@@ -49,9 +49,9 @@ void o_buffer_copy(GSCHEM_TOPLEVEL *w_current, int buf_num)
}
toplevel->ADDING_SEL = 1;
- object_buffer[buf_num] =
- o_glist_copy_all_to_glist(toplevel, s_current,
- object_buffer[buf_num], SELECTION_FLAG);
+ object_buffer[buf_num] = o_glist_copy_all (toplevel, s_current,
+ object_buffer[buf_num],
+ SELECTION_FLAG);
toplevel->ADDING_SEL = 0;
}
@@ -78,9 +78,9 @@ void o_buffer_cut(GSCHEM_TOPLEVEL *w_current, int buf_num)
}
toplevel->ADDING_SEL = 1;
- object_buffer[buf_num] =
- o_glist_copy_all_to_glist(toplevel, s_current,
- object_buffer[buf_num], SELECTION_FLAG);
+ object_buffer[buf_num] = o_glist_copy_all (toplevel, s_current,
+ object_buffer[buf_num],
+ SELECTION_FLAG);
toplevel->ADDING_SEL = 0;
o_delete_selected(w_current);
}
@@ -110,9 +110,9 @@ void o_buffer_paste_start(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y,
toplevel->ADDING_SEL = 1;
toplevel->page_current->place_list =
- o_glist_copy_all_to_glist(toplevel, object_buffer[buf_num],
- toplevel->page_current->place_list,
- SELECTION_FLAG);
+ o_glist_copy_all (toplevel, object_buffer[buf_num],
+ toplevel->page_current->place_list,
+ SELECTION_FLAG);
if (!world_get_object_glist_bounds (toplevel,
toplevel->page_current->place_list,
diff --git a/gschem/src/o_bus.c b/gschem/src/o_bus.c
index cfe8591..5d7283b 100644
--- a/gschem/src/o_bus.c
+++ b/gschem/src/o_bus.c
@@ -266,13 +266,11 @@ int o_bus_end(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
o_bus_draw(w_current, new_obj);
/* connect the new bus to the other busses */
- other_objects = s_conn_return_others(other_objects,
- toplevel->page_current->
- object_tail);
+ other_objects = s_conn_return_others (other_objects, new_obj);
o_cue_undraw_list(w_current, other_objects);
o_cue_draw_list(w_current, other_objects);
g_list_free(other_objects);
- o_cue_draw_single(w_current, toplevel->page_current->object_tail);
+ o_cue_draw_single (w_current, new_obj);
toplevel->page_current->CHANGED=1;
w_current->first_wx = w_current->second_wx;
diff --git a/gschem/src/o_circle.c b/gschem/src/o_circle.c
index 4275f7d..da22f49 100644
--- a/gschem/src/o_circle.c
+++ b/gschem/src/o_circle.c
@@ -590,7 +590,7 @@ void o_circle_end(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
s_page_append (toplevel->page_current, new_obj);
/* draw it */
- o_redraw_single(w_current, toplevel->page_current->object_tail);
+ o_redraw_single (w_current, new_obj);
toplevel->page_current->CHANGED = 1;
o_undo_savestate(w_current, UNDO_ALL);
diff --git a/gschem/src/o_complex.c b/gschem/src/o_complex.c
index f2e86dc..37bfedd 100644
--- a/gschem/src/o_complex.c
+++ b/gschem/src/o_complex.c
@@ -40,7 +40,6 @@ void o_complex_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
g_return_if_fail (o_current != NULL);
g_return_if_fail (o_current->complex != NULL);
- g_return_if_fail (o_current->complex->prim_objs != NULL);
if (!w_current->toplevel->DONT_REDRAW) {
o_redraw(w_current, o_current->complex->prim_objs, TRUE);
@@ -58,7 +57,7 @@ void o_complex_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *obje
g_assert( (object->type == OBJ_COMPLEX ||
object->type == OBJ_PLACEHOLDER) );
- o_list_draw_xor( w_current, dx, dy, object->complex->prim_objs);
+ o_glist_draw_xor (w_current, dx, dy, object->complex->prim_objs);
}
@@ -70,9 +69,8 @@ void o_complex_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *obje
void o_complex_prepare_place(GSCHEM_TOPLEVEL *w_current, const char *sym_name)
{
TOPLEVEL *toplevel = w_current->toplevel;
- OBJECT *temp_list;
+ GList *temp_list;
OBJECT *o_current;
- OBJECT *o_start;
char *buffer;
const CLibSymbol *sym;
int redraw_state;
@@ -89,7 +87,7 @@ void o_complex_prepare_place(GSCHEM_TOPLEVEL *w_current, const char *sym_name)
if (w_current->include_complex) {
- o_start = temp_list = new_head ();
+ temp_list = NULL;
toplevel->ADDING_SEL=1;
buffer = s_clib_symbol_get_data_by_name (sym_name);
@@ -100,42 +98,23 @@ void o_complex_prepare_place(GSCHEM_TOPLEVEL *w_current, const char *sym_name)
g_free (buffer);
toplevel->ADDING_SEL=0;
- /* Take the added objects, severing them from the HEAD node */
- o_current = o_start->next;
- o_current->prev = NULL;
- o_start->next = NULL;
-
- /* Delete the HEAD node */
- s_delete_list_fromstart (toplevel, o_start);
-
- while (o_current != NULL) {
- toplevel->page_current->place_list =
- g_list_prepend (toplevel->page_current->place_list, o_current);
- o_current = o_current->next;
- }
+ /* Take the added objects */
toplevel->page_current->place_list =
- g_list_reverse (toplevel->page_current->place_list);
+ g_list_concat (toplevel->page_current->place_list, temp_list);
} else { /* if (w_current->include_complex) {..} else { */
OBJECT *new_object;
- GList *promoted;
toplevel->ADDING_SEL = 1; /* reuse this flag, rename later hack */
sym = s_clib_get_symbol_by_name (sym_name);
new_object = o_complex_new (toplevel, OBJ_COMPLEX, WHITE, 0, 0, 0, 0,
sym, sym_name, 1);
- promoted = o_complex_get_promotable (toplevel, new_object, TRUE);
-
- /* Attach promoted attributes to the original complex object */
- o_attrib_attach_list (toplevel, promoted, new_object);
toplevel->page_current->place_list =
- g_list_concat (toplevel->page_current->place_list, promoted);
- toplevel->page_current->place_list =
g_list_append (toplevel->page_current->place_list, new_object);
- /* Link the place list OBJECTs together for good measure */
- o_glist_relink_objects (toplevel->page_current->place_list);
+ o_complex_promote_attribs (toplevel, new_object,
+ &toplevel->page_current->place_list);
toplevel->ADDING_SEL = 0;
@@ -250,18 +229,19 @@ void o_complex_translate_all(GSCHEM_TOPLEVEL *w_current, int offset)
TOPLEVEL *toplevel = w_current->toplevel;
int w_rleft, w_rtop, w_rright, w_rbottom;
OBJECT *o_current;
+ GList *iter;
int x, y;
/* first zoom extents */
- a_zoom_extents(w_current, toplevel->page_current->object_head,
+ a_zoom_extents (w_current, toplevel->page_current->object_list,
A_PAN_DONT_REDRAW);
o_redraw_all(w_current);
- world_get_object_list_bounds(toplevel, toplevel->page_current->object_head,
- &w_rleft,
- &w_rtop,
- &w_rright,
- &w_rbottom);
+ world_get_object_glist_bounds (toplevel, toplevel->page_current->object_list,
+ &w_rleft,
+ &w_rtop,
+ &w_rright,
+ &w_rbottom);
/*! \todo do we want snap grid here? */
x = snap_grid( toplevel, w_rleft );
@@ -271,40 +251,42 @@ void o_complex_translate_all(GSCHEM_TOPLEVEL *w_current, int offset)
* the correct sense) were in use . */
y = snap_grid( toplevel, w_rtop );
- o_current = toplevel->page_current->object_head;
- while(o_current != NULL) {
+ iter = toplevel->page_current->object_list;
+ while (iter != NULL) {
+ o_current = iter->data;
if (o_current->type != OBJ_COMPLEX && o_current->type != OBJ_PLACEHOLDER) {
s_conn_remove(toplevel, o_current);
} else {
s_conn_remove_complex(toplevel, o_current);
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
if (offset == 0) {
s_log_message(_("Translating schematic [%d %d]\n"), -x, -y);
- o_list_translate_world(toplevel, -x, -y,
- toplevel->page_current->object_head);
+ o_glist_translate_world (toplevel, -x, -y,
+ toplevel->page_current->object_list);
} else {
s_log_message(_("Translating schematic [%d %d]\n"),
offset, offset);
- o_list_translate_world(toplevel, offset, offset,
- toplevel->page_current->object_head);
+ o_glist_translate_world (toplevel, offset, offset,
+ toplevel->page_current->object_list);
}
- o_current = toplevel->page_current->object_head;
- while(o_current != NULL) {
+ iter = toplevel->page_current->object_list;
+ while (iter != NULL) {
+ o_current = iter->data;
if (o_current->type != OBJ_COMPLEX && o_current->type != OBJ_PLACEHOLDER) {
s_conn_update_object(toplevel, o_current);
} else {
s_conn_update_complex(toplevel, o_current->complex->prim_objs);
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
/* this is an experimental mod, to be able to translate to all
* places */
- a_zoom_extents(w_current, toplevel->page_current->object_head,
+ a_zoom_extents (w_current, toplevel->page_current->object_list,
A_PAN_DONT_REDRAW);
if (!w_current->SHIFTKEY) o_select_unselect_all(w_current);
o_redraw_all(w_current);
diff --git a/gschem/src/o_copy.c b/gschem/src/o_copy.c
index be36f7c..5ae6c84 100644
--- a/gschem/src/o_copy.c
+++ b/gschem/src/o_copy.c
@@ -56,9 +56,9 @@ void o_copy_start(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
}
toplevel->page_current->place_list =
- o_glist_copy_all_to_glist(toplevel, s_current,
- toplevel->page_current->place_list,
- SELECTION_FLAG);
+ o_glist_copy_all (toplevel, s_current,
+ toplevel->page_current->place_list,
+ SELECTION_FLAG);
w_current->inside_action = 1;
i_set_state(w_current, COPY);
diff --git a/gschem/src/o_cue.c b/gschem/src/o_cue.c
index 846c0c7..f78ca45 100644
--- a/gschem/src/o_cue.c
+++ b/gschem/src/o_cue.c
@@ -33,14 +33,16 @@
* \par Function Description
*
*/
-void o_cue_redraw_all(GSCHEM_TOPLEVEL *w_current, OBJECT *head, gboolean draw_selected)
+void o_cue_redraw_all (GSCHEM_TOPLEVEL *w_current, GList *list, gboolean draw_selected)
{
TOPLEVEL *toplevel = w_current->toplevel;
OBJECT *o_current;
+ GList *iter;
int redraw_state = w_current->toplevel->DONT_REDRAW;
- o_current = head;
- while(o_current != NULL) {
+ iter = list;
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
switch(o_current->type) {
case(OBJ_NET):
case(OBJ_BUS):
@@ -70,7 +72,7 @@ void o_cue_redraw_all(GSCHEM_TOPLEVEL *w_current, OBJECT *head, gboolean draw_se
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
toplevel->DONT_REDRAW = redraw_state;
}
@@ -470,26 +472,29 @@ static void o_cue_undraw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *object)
*/
void o_cue_undraw(GSCHEM_TOPLEVEL *w_current, OBJECT *object)
{
+ GList *iter;
switch (object->type) {
- case OBJ_PIN:
- case OBJ_NET:
- case OBJ_BUS:
- o_cue_undraw_lowlevel (w_current, object);
- break;
- case OBJ_COMPLEX:
- case OBJ_PLACEHOLDER:
- {
- OBJECT *o_current;
- for (o_current = object->complex->prim_objs;
- o_current != NULL;
- o_current = o_current->next) {
- if (o_current->type == OBJ_PIN ||
- o_current->type == OBJ_NET ||
- o_current->type == OBJ_BUS) {
- o_cue_undraw_lowlevel (w_current, o_current);
- }
+ case OBJ_PIN:
+ case OBJ_NET:
+ case OBJ_BUS:
+ o_cue_undraw_lowlevel (w_current, object);
+ break;
+ case OBJ_COMPLEX:
+ case OBJ_PLACEHOLDER:
+ {
+ OBJECT *o_current;
+ iter = object->complex->prim_objs;
+ for (iter = object->complex->prim_objs;
+ iter != NULL;
+ iter = g_list_next (iter)) {
+ o_current = iter->data;
+ if (o_current->type == OBJ_PIN ||
+ o_current->type == OBJ_NET ||
+ o_current->type == OBJ_BUS) {
+ o_cue_undraw_lowlevel (w_current, o_current);
}
}
+ }
}
o_redraw_single(w_current, object);
@@ -535,24 +540,3 @@ void o_cue_undraw_list(GSCHEM_TOPLEVEL *w_current, GList *object_list)
}
}
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void o_cue_undraw_objects(GSCHEM_TOPLEVEL *w_current, OBJECT *list)
-{
- OBJECT *o_current;
-
- o_current = list;
- while(o_current != NULL) {
-
- if (o_current->type == OBJ_PIN || o_current->type == OBJ_NET ||
- o_current->type == OBJ_BUS) {
- o_cue_undraw(w_current, o_current);
- }
-
- o_current = o_current->next;
- }
-
-}
diff --git a/gschem/src/o_delete.c b/gschem/src/o_delete.c
index c6a8188..5613427 100644
--- a/gschem/src/o_delete.c
+++ b/gschem/src/o_delete.c
@@ -54,6 +54,8 @@ void o_delete (GSCHEM_TOPLEVEL *w_current, OBJECT *object)
o_erase_single (w_current, object);
o_erase_grips (w_current, object);
+ toplevel->page_current->object_list =
+ g_list_remove (toplevel->page_current->object_list, object);
s_delete (toplevel, object);
if (do_conn) {
@@ -63,8 +65,6 @@ void o_delete (GSCHEM_TOPLEVEL *w_current, OBJECT *object)
}
toplevel->page_current->CHANGED = 1;
- toplevel->page_current->object_tail =
- (OBJECT *) return_tail(toplevel->page_current->object_head);
}
/*! \brief Delete objects from the selection.
diff --git a/gschem/src/o_find.c b/gschem/src/o_find.c
index 4ad41a1..9edf222 100644
--- a/gschem/src/o_find.c
+++ b/gschem/src/o_find.c
@@ -40,6 +40,7 @@ gboolean o_find_object(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y,
OBJECT *o_current=NULL;
gboolean object_found = FALSE;
int w_slack;
+ GList *iter = NULL;
w_slack = WORLDabs( toplevel, w_current->select_slack_pixels );
@@ -48,14 +49,15 @@ gboolean o_find_object(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y,
(w_x/w_y) position, this will select the next object below the
position point. You can change the selected object by clicking
at the same place multiple times. */
- if (toplevel->page_current->object_lastplace == NULL) {
- o_current = toplevel->page_current->object_head;
- } else {
- o_current = toplevel->page_current->object_lastplace;
- }
+ if (toplevel->page_current->object_lastplace != NULL)
+ iter = g_list_find (toplevel->page_current->object_list,
+ toplevel->page_current->object_lastplace);
+ if (iter == NULL)
+ iter = toplevel->page_current->object_list;
/* do first search */
- while (o_current != NULL) {
+ while (iter != NULL) {
+ o_current = iter->data;
if (inside_region(o_current->w_left - w_slack, o_current->w_top - w_slack,
o_current->w_right + w_slack, o_current->w_bottom + w_slack,
w_x, w_y) &&
@@ -76,13 +78,12 @@ gboolean o_find_object(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y,
}
}
object_found = TRUE;
- toplevel->page_current-> object_lastplace =
- o_current->next;
+ toplevel->page_current->object_lastplace = o_current;
i_update_menus(w_current);
return object_found;
}
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
#if DEBUG
@@ -91,9 +92,10 @@ gboolean o_find_object(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y,
/* now search again since we didn't find anything starting at start
just in case we started last time at object_lastplace */
- o_current = toplevel->page_current->object_head;
- while (o_current != NULL &&
- o_current != toplevel->page_current->object_lastplace) {
+ iter = toplevel->page_current->object_list;
+ while (iter != NULL &&
+ iter->data != toplevel->page_current->object_lastplace) {
+ o_current = iter->data;
if (inside_region(o_current->w_left - w_slack, o_current->w_top - w_slack,
o_current->w_right + w_slack, o_current->w_bottom + w_slack,
w_x, w_y) &&
@@ -120,7 +122,7 @@ gboolean o_find_object(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y,
return object_found;
}
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
/* didn't find anything.... reset lastplace */
diff --git a/gschem/src/o_line.c b/gschem/src/o_line.c
index e81fad4..9f5b103 100644
--- a/gschem/src/o_line.c
+++ b/gschem/src/o_line.c
@@ -802,7 +802,8 @@ void o_line_end(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
w_current->second_wx, w_current->second_wy);
s_page_append (toplevel->page_current, new_obj);
- o_redraw_single(w_current, toplevel->page_current->object_tail);
+ /* draw it */
+ o_redraw_single (w_current, new_obj);
toplevel->page_current->CHANGED=1;
o_undo_savestate(w_current, UNDO_ALL);
diff --git a/gschem/src/o_misc.c b/gschem/src/o_misc.c
index f14f09f..a9bb436 100644
--- a/gschem/src/o_misc.c
+++ b/gschem/src/o_misc.c
@@ -442,16 +442,15 @@ void o_mirror_world_update(GSCHEM_TOPLEVEL *w_current, int centerx, int centery,
* \par Function Description
*
*/
-void o_edit_show_hidden_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list)
+void o_edit_show_hidden_lowlevel (GSCHEM_TOPLEVEL *w_current, GList *o_list)
{
TOPLEVEL *toplevel = w_current->toplevel;
- OBJECT *o_current = o_list;
-
- if (o_current == NULL) {
- return;
- }
+ OBJECT *o_current;
+ GList *iter;
- while(o_current != NULL) {
+ iter = o_list;
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
if (o_current->type == OBJ_TEXT && o_current->visibility == INVISIBLE) {
/* don't toggle the visibility flag */
@@ -478,7 +477,7 @@ void o_edit_show_hidden_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list)
o_recalc_single_object(toplevel, o_current);
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
}
@@ -487,7 +486,7 @@ void o_edit_show_hidden_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list)
* \par Function Description
*
*/
-void o_edit_show_hidden(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list)
+void o_edit_show_hidden (GSCHEM_TOPLEVEL *w_current, GList *o_list)
{
/* this function just shows the hidden text, but doesn't toggle it */
/* this function does not change the CHANGED bit, no real changes are */
@@ -513,17 +512,16 @@ void o_edit_show_hidden(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list)
* \par Function Description
*
*/
-void o_edit_make_visible(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list)
+void o_edit_make_visible (GSCHEM_TOPLEVEL *w_current, GList *o_list)
{
/* this function actually changes the visibility flag */
TOPLEVEL *toplevel = w_current->toplevel;
- OBJECT *o_current = NULL;
-
- if (o_list == NULL)
- return;
- o_current = o_list;
+ OBJECT *o_current;
+ GList *iter;
- while(o_current != NULL) {
+ iter = o_list;
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
if (o_current->type == OBJ_TEXT) {
if (o_current->visibility == INVISIBLE) {
@@ -538,7 +536,7 @@ void o_edit_make_visible(GSCHEM_TOPLEVEL *w_current, OBJECT *o_list)
toplevel->page_current->CHANGED = 1;
}
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
o_undo_savestate(w_current, UNDO_ALL);
@@ -554,7 +552,7 @@ int skiplast;
* \par Function Description
*
*/
-int o_edit_find_text(GSCHEM_TOPLEVEL *w_current, OBJECT * o_list, char *stext,
+int o_edit_find_text (GSCHEM_TOPLEVEL *w_current, GList * o_list, char *stext,
int descend, int skip)
{
TOPLEVEL *toplevel = w_current->toplevel;
@@ -566,17 +564,15 @@ int o_edit_find_text(GSCHEM_TOPLEVEL *w_current, OBJECT * o_list, char *stext,
int pcount = 0;
int rv;
int text_screen_height;
+ GList *iter;
- OBJECT *o_current = NULL;
+ OBJECT *o_current;
skiplast = skip;
- o_current = o_list;
- if (o_current == NULL) {
- return 1;
- }
-
- while (o_current != NULL) {
+ iter = o_list;
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
if (descend) {
if (o_current->type == OBJ_COMPLEX) {
@@ -603,7 +599,7 @@ int o_edit_find_text(GSCHEM_TOPLEVEL *w_current, OBJECT * o_list, char *stext,
/* o_redraw_all(w_current); */
rv = o_edit_find_text(w_current,
- toplevel->page_current->object_head,
+ toplevel->page_current->object_list,
stext, descend, skiplast);
if (!rv) {
return 0;
@@ -647,13 +643,13 @@ int o_edit_find_text(GSCHEM_TOPLEVEL *w_current, OBJECT * o_list, char *stext,
} /* if (strstr(o_current->text->string,stext)) */
} /* if (o_current->type == OBJ_TEXT) */
- o_current = o_current->next;
+ iter = g_list_next (iter);
- if (o_current == NULL) {
+ if (iter == NULL) {
return 1;
}
}
- return (o_current == NULL);
+ return (iter == NULL);
}
@@ -662,18 +658,16 @@ int o_edit_find_text(GSCHEM_TOPLEVEL *w_current, OBJECT * o_list, char *stext,
* \par Function Description
*
*/
-void o_edit_hide_specific_text(GSCHEM_TOPLEVEL *w_current, OBJECT * o_list,
+void o_edit_hide_specific_text (GSCHEM_TOPLEVEL *w_current, GList * o_list,
char *stext)
{
TOPLEVEL *toplevel = w_current->toplevel;
- OBJECT *o_current = NULL;
-
- if (o_list == NULL)
- return;
-
- o_current = o_list;
+ OBJECT *o_current;
+ GList *iter;
- while (o_current != NULL) {
+ iter = o_list;
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
if (o_current->type == OBJ_TEXT) {
const gchar *str = o_text_get_string (w_current->toplevel, o_current);
@@ -688,7 +682,7 @@ void o_edit_hide_specific_text(GSCHEM_TOPLEVEL *w_current, OBJECT * o_list,
}
}
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
o_undo_savestate(w_current, UNDO_ALL);
o_redraw_all(w_current);
@@ -699,18 +693,16 @@ void o_edit_hide_specific_text(GSCHEM_TOPLEVEL *w_current, OBJECT * o_list,
* \par Function Description
*
*/
-void o_edit_show_specific_text(GSCHEM_TOPLEVEL *w_current, OBJECT * o_list,
+void o_edit_show_specific_text (GSCHEM_TOPLEVEL *w_current, GList * o_list,
char *stext)
{
TOPLEVEL *toplevel = w_current->toplevel;
- OBJECT *o_current = NULL;
-
- if (o_list == NULL)
- return;
-
- o_current = o_list;
+ OBJECT *o_current;
+ GList *iter;
- while (o_current != NULL) {
+ iter = o_list;
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
if (o_current->type == OBJ_TEXT) {
const gchar *str = o_text_get_string (w_current->toplevel, o_current);
@@ -726,7 +718,7 @@ void o_edit_show_specific_text(GSCHEM_TOPLEVEL *w_current, OBJECT * o_list,
}
}
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
o_undo_savestate(w_current, UNDO_ALL);
}
@@ -739,10 +731,11 @@ void o_edit_show_specific_text(GSCHEM_TOPLEVEL *w_current, OBJECT * o_list,
void o_update_component(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
{
TOPLEVEL *toplevel = w_current->toplevel;
- OBJECT *tmp_list, *new_complex;
+ OBJECT *new_complex;
OBJECT *a_current;
- OBJECT *tmp;
+ GList *temp_list;
GList *a_iter;
+ GList *po_iter;
gboolean is_embedded;
const CLibSymbol *clib;
@@ -770,8 +763,6 @@ void o_update_component(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
/* and unselect it */
o_selection_remove( toplevel->page_current->selection_list, o_current);
- /* build a temporary list and add a complex to this list */
- tmp_list = s_basic_new_object (OBJ_HEAD, "update component");
new_complex = o_complex_new (toplevel, OBJ_COMPLEX, WHITE,
o_current->complex->x,
o_current->complex->y,
@@ -779,19 +770,22 @@ void o_update_component(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
o_current->complex->mirror,
clib, o_current->complex_basename,
1);
- tmp_list = s_basic_link_object(new_complex, tmp_list);
- o_complex_promote_attribs (toplevel, new_complex);
+
+ temp_list = g_list_append (NULL, new_complex);
+ o_complex_promote_attribs (toplevel, new_complex, &temp_list);
/* updating the old complex with data from the new one */
/* first process the prim_objs: */
/* - delete the prim_objs of the old component */
- s_delete_list_fromstart (toplevel,
- o_current->complex->prim_objs);
+ s_delete_object_glist (toplevel, o_current->complex->prim_objs);
/* - put the prim_objs of the new component in the old one */
o_current->complex->prim_objs = new_complex->complex->prim_objs;
/* set the parent field now */
- for (tmp = o_current->complex->prim_objs; tmp != NULL; tmp = tmp->next) {
+ for (po_iter = o_current->complex->prim_objs;
+ po_iter != NULL;
+ po_iter = g_list_next (po_iter)) {
+ OBJECT *tmp = po_iter->data;
tmp->complex_parent = o_current;
}
@@ -802,11 +796,13 @@ void o_update_component(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
/* - check each attrib of the new complex */
a_iter = new_complex->attribs;
while (a_iter != NULL) {
- a_current = a_iter->data;
OBJECT *o_attrib;
gchar *name;
char *attrfound;
+
+ a_current = a_iter->data;
g_assert (a_current->type == OBJ_TEXT);
+
o_attrib_get_name_value (o_text_get_string (toplevel, a_current),
&name, NULL);
@@ -820,8 +816,8 @@ void o_update_component(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
/* add new attribute to old component */
/* make a copy of the attribute object */
- o_list_copy_to (toplevel, o_current,
- a_current, NORMAL_FLAG, &o_attrib);
+ o_attrib = o_object_copy (toplevel, a_current, NORMAL_FLAG);
+ s_page_append (toplevel->page_current, o_attrib);
/* add the attribute to old */
o_attrib_add (toplevel, o_current, o_attrib);
/* redraw the attribute object */
@@ -833,12 +829,10 @@ void o_update_component(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
g_free(attrfound);
}
-
a_iter = g_list_next (a_iter);
}
- /* finally delete the temp list with the updated complex */
- s_delete_list_fromstart (toplevel, tmp_list);
+ s_delete_object_glist (toplevel, temp_list);
/* update the pinnumbers to the current slot */
o_attrib_slot_update(toplevel, o_current);
diff --git a/gschem/src/o_move.c b/gschem/src/o_move.c
index 3586873..ade06f7 100644
--- a/gschem/src/o_move.c
+++ b/gschem/src/o_move.c
@@ -70,56 +70,62 @@ void o_move_start(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
}
}
-#define SINGLE 0
-#define COMPLEX 1
-
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
*
- * \note
- * type can be SINGLE or COMPLEX
- * which basically controls if this is a single object or a complex
*/
-void o_move_end_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT * list, int type,
- int diff_x, int diff_y,
- GList** other_objects, GList** connected_objects)
+static void o_move_end_lowlevel_glist (GSCHEM_TOPLEVEL *w_current,
+ GList *list,
+ int diff_x, int diff_y,
+ GList** other_objects,
+ GList** connected_objects)
{
- TOPLEVEL *toplevel = w_current->toplevel;
- OBJECT *o_current;
OBJECT *object;
+ GList *iter;
+
+ iter = list;
+ while (iter != NULL) {
+ object = (OBJECT *)iter->data;
+ o_move_end_lowlevel (w_current, object, diff_x, diff_y,
+ other_objects, connected_objects);
+ iter = g_list_next (iter);
+ }
+}
- o_current = list;
- while (o_current != NULL) {
- object = o_current;
- switch (object->type) {
+/*! \todo Finish function documentation!!!
+ * \brief
+ * \par Function Description
+ *
+ */
+void o_move_end_lowlevel (GSCHEM_TOPLEVEL *w_current,
+ OBJECT *object,
+ int diff_x, int diff_y,
+ GList** other_objects,
+ GList** connected_objects)
+{
+ TOPLEVEL *toplevel = w_current->toplevel;
- case (OBJ_NET):
- case (OBJ_BUS):
- case (OBJ_PIN):
- /* save the other objects and remove object's connections */
- *other_objects = s_conn_return_others(*other_objects, object);
- s_conn_remove(toplevel, object);
-
- /* do the actual translation */
- o_translate_world(toplevel, diff_x, diff_y, object);
- s_conn_update_object(toplevel, object);
- *connected_objects = s_conn_return_others(*connected_objects, object);
- break;
+ switch (object->type) {
- default:
- o_translate_world(toplevel, diff_x, diff_y, object);
- break;
- }
+ case (OBJ_NET):
+ case (OBJ_BUS):
+ case (OBJ_PIN):
+ /* save the other objects and remove object's connections */
+ *other_objects = s_conn_return_others (*other_objects, object);
+ s_conn_remove (toplevel, object);
- if (type == COMPLEX) {
- o_current = o_current->next;
- } else {
- o_current = NULL;
- }
+ /* do the actual translation */
+ o_translate_world (toplevel, diff_x, diff_y, object);
+ s_conn_update_object (toplevel, object);
+ *connected_objects = s_conn_return_others (*connected_objects, object);
+ break;
+
+ default:
+ o_translate_world (toplevel, diff_x, diff_y, object);
+ break;
}
-
}
/*! \todo Finish function documentation!!!
@@ -200,13 +206,13 @@ void o_move_end(GSCHEM_TOPLEVEL *w_current)
object->complex->x = object->complex->x + diff_x;
object->complex->y = object->complex->y + diff_y;
- o_move_end_lowlevel(w_current, object->complex->prim_objs,
- COMPLEX, diff_x, diff_y,
- &other_objects, &connected_objects);
+ o_move_end_lowlevel_glist (w_current, object->complex->prim_objs,
+ diff_x, diff_y,
+ &other_objects, &connected_objects);
- world_get_object_list_bounds(toplevel, object->complex->prim_objs,
- &left, &top, &right, &bottom);
+ world_get_object_glist_bounds (toplevel, object->complex->prim_objs,
+ &left, &top, &right, &bottom);
object->w_left = left;
object->w_top = top;
@@ -216,7 +222,7 @@ void o_move_end(GSCHEM_TOPLEVEL *w_current)
break;
default:
- o_move_end_lowlevel(w_current, object, SINGLE, diff_x, diff_y,
+ o_move_end_lowlevel (w_current, object, diff_x, diff_y,
&other_objects, &connected_objects);
break;
}
@@ -416,6 +422,7 @@ void o_move_prep_rubberband(GSCHEM_TOPLEVEL *w_current)
GList *s_current;
OBJECT *object;
OBJECT *o_current;
+ GList *iter;
#if DEBUG
printf("\n\n\n");
@@ -436,14 +443,15 @@ void o_move_prep_rubberband(GSCHEM_TOPLEVEL *w_current)
case (OBJ_COMPLEX):
case (OBJ_PLACEHOLDER):
- o_current = object->complex->prim_objs;
- while (o_current != NULL) {
+ iter = object->complex->prim_objs;
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
if (o_current->type == OBJ_PIN) {
o_move_check_endpoint(w_current, o_current);
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
break;
diff --git a/gschem/src/o_net.c b/gschem/src/o_net.c
index 1c98089..e411773 100644
--- a/gschem/src/o_net.c
+++ b/gschem/src/o_net.c
@@ -726,9 +726,7 @@ int o_net_end(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
/* conn stuff */
/* LEAK CHECK 1 */
- other_objects = s_conn_return_others(other_objects,
- toplevel->page_current->
- object_tail);
+ other_objects = s_conn_return_others (other_objects, new_net);
if (o_net_add_busrippers(w_current, new_net, other_objects)) {
g_list_free(other_objects);
@@ -793,9 +791,7 @@ int o_net_end(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
/* conn stuff */
/* LEAK CHECK 2 */
- other_objects = s_conn_return_others(other_objects,
- toplevel->page_current->
- object_tail);
+ other_objects = s_conn_return_others (other_objects, new_net);
if (o_net_add_busrippers(w_current, new_net, other_objects)) {
g_list_free(other_objects);
@@ -1384,7 +1380,8 @@ int o_net_add_busrippers(GSCHEM_TOPLEVEL *w_current, OBJECT *net_obj,
rippersym,
toplevel->bus_ripper_symname, 1);
s_page_append (toplevel->page_current, new_obj);
- o_complex_promote_attribs (toplevel, new_obj);
+ o_complex_promote_attribs (toplevel, new_obj,
+ &toplevel->page_current->object_list);
o_complex_draw (w_current, new_obj);
} else {
diff --git a/gschem/src/o_picture.c b/gschem/src/o_picture.c
index eb4f5c5..c52bbf3 100644
--- a/gschem/src/o_picture.c
+++ b/gschem/src/o_picture.c
@@ -113,7 +113,7 @@ void o_picture_end(GSCHEM_TOPLEVEL *w_current, int w_x, int w_y)
s_page_append (toplevel->page_current, new_obj);
/* draw it */
- o_redraw_single(w_current, toplevel->page_current->object_tail);
+ o_redraw_single (w_current, new_obj);
toplevel->page_current->CHANGED = 1;
o_undo_savestate(w_current, UNDO_ALL);
diff --git a/gschem/src/o_pin.c b/gschem/src/o_pin.c
index 14b3e23..7012863 100644
--- a/gschem/src/o_pin.c
+++ b/gschem/src/o_pin.c
@@ -196,7 +196,7 @@ void o_pin_end(GSCHEM_TOPLEVEL *w_current, int x, int y)
PIN_TYPE_NET, 0);
s_page_append (toplevel->page_current, new_obj);
- o_current = o_current_pin = toplevel->page_current->object_tail;
+ o_current = o_current_pin = new_obj;
if (scm_hook_empty_p(add_pin_hook) == SCM_BOOL_F &&
o_current != NULL) {
diff --git a/gschem/src/o_place.c b/gschem/src/o_place.c
index 21d7ccc..16581d0 100644
--- a/gschem/src/o_place.c
+++ b/gschem/src/o_place.c
@@ -52,7 +52,6 @@ void o_place_end (GSCHEM_TOPLEVEL *w_current,
TOPLEVEL *toplevel = w_current->toplevel;
int w_diff_x, w_diff_y;
OBJECT *o_current;
- OBJECT *o_saved;
PAGE *p_current;
GList *temp_dest_list = NULL;
GList *connected_objects = NULL;
@@ -70,9 +69,9 @@ void o_place_end (GSCHEM_TOPLEVEL *w_current,
if (continue_placing) {
/* Make a copy of the place list if we want to keep it afterwards */
- temp_dest_list =
- o_glist_copy_all_to_glist (toplevel, toplevel->page_current->place_list,
- temp_dest_list, SELECTION_FLAG);
+ temp_dest_list = o_glist_copy_all (toplevel,
+ toplevel->page_current->place_list,
+ temp_dest_list, SELECTION_FLAG);
} else {
/* Otherwise just take it */
temp_dest_list = toplevel->page_current->place_list;
@@ -94,12 +93,10 @@ void o_place_end (GSCHEM_TOPLEVEL *w_current,
/* Attach each item back onto the page's object list. Update object
* connectivity and add the new objects to the selection list.*/
p_current = toplevel->page_current;
- o_saved = p_current->object_tail;
for (iter = temp_dest_list; iter != NULL; iter = g_list_next (iter)) {
o_current = iter->data;
- o_current->next = NULL; /* In case it isn't linked properly */
s_page_append (p_current, o_current);
o_selection_add (toplevel->page_current->selection_list, o_current);
@@ -115,16 +112,16 @@ void o_place_end (GSCHEM_TOPLEVEL *w_current,
}
}
- g_list_free (temp_dest_list);
-
- o_cue_redraw_all (w_current, o_saved->next, TRUE);
+ o_cue_redraw_all (w_current, temp_dest_list, TRUE);
o_cue_undraw_list (w_current, connected_objects);
o_cue_draw_list (w_current, connected_objects);
g_list_free (connected_objects);
connected_objects = NULL;
toplevel->page_current->CHANGED = 1;
- o_redraw (w_current, o_saved->next, TRUE); /* only redraw new objects */
+ o_redraw (w_current, temp_dest_list, TRUE); /* only redraw new objects */
+ g_list_free (temp_dest_list);
+
o_undo_savestate (w_current, UNDO_ALL);
i_update_menus (w_current);
}
diff --git a/gschem/src/o_select.c b/gschem/src/o_select.c
index 69c20b9..2d72df1 100644
--- a/gschem/src/o_select.c
+++ b/gschem/src/o_select.c
@@ -330,15 +330,16 @@ void o_select_box_search(GSCHEM_TOPLEVEL *w_current)
int count = 0; /* object count */
int SHIFTKEY = w_current->SHIFTKEY;
int left, right, top, bottom;
+ GList *iter;
left = min(w_current->first_wx, w_current->second_wx);
right = max(w_current->first_wx, w_current->second_wx);
top = min(w_current->first_wy, w_current->second_wy);
bottom = max(w_current->first_wy, w_current->second_wy);
- o_current = toplevel->page_current->object_head;
-
- while (o_current != NULL) {
+ iter = toplevel->page_current->object_list;
+ while (iter != NULL) {
+ o_current = iter->data;
/* only select visible objects */
if (o_current->type != OBJ_HEAD &&
(o_current->visibility == VISIBLE ||
@@ -353,7 +354,7 @@ void o_select_box_search(GSCHEM_TOPLEVEL *w_current)
count++;
}
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
/* if there were no objects to be found in select box, count will be */
@@ -377,6 +378,7 @@ void o_select_box_search(GSCHEM_TOPLEVEL *w_current)
void o_select_connected_nets(GSCHEM_TOPLEVEL *w_current, OBJECT* o_net)
{
TOPLEVEL *toplevel = w_current->toplevel;
+ GList *o_iter;
GList *iter1;
OBJECT *o_current;
int count=0;
@@ -430,9 +432,10 @@ void o_select_connected_nets(GSCHEM_TOPLEVEL *w_current, OBJECT* o_net)
break; /* no new netnames in the stack --> finished */
/* get all the nets of the stacked netnames */
- for (o_current = toplevel->page_current->object_head->next;
- o_current != NULL;
- o_current = o_current->next) {
+ for (o_iter = toplevel->page_current->object_list;
+ o_iter != NULL;
+ o_iter = g_list_next (o_iter)) {
+ o_current = o_iter->data;
if (o_current->type == OBJ_TEXT
&& o_current->attached_to != NULL) {
if (o_current->attached_to->type == OBJ_NET) {
diff --git a/gschem/src/o_slot.c b/gschem/src/o_slot.c
index 1f284ba..16825fa 100644
--- a/gschem/src/o_slot.c
+++ b/gschem/src/o_slot.c
@@ -37,23 +37,12 @@
* \par Function Description
*
*/
-void o_slot_start(GSCHEM_TOPLEVEL *w_current, OBJECT *list)
+void o_slot_start (GSCHEM_TOPLEVEL *w_current, OBJECT *object)
{
- OBJECT *object;
OBJECT *slot_text_object;
char *default_slot_value;
char *slot_value;
- /* shouldn't happen */
- if (list == NULL) {
- /* this is an error condition hack */
- w_current->inside_action = 0;
- i_set_state(w_current, SELECT);
- return;
- }
-
- object = o_select_return_first_object(w_current);
-
/* single object for now */
if (object->type == OBJ_COMPLEX) {
/* first see if slot attribute already exists outside
@@ -193,12 +182,9 @@ void o_slot_end(GSCHEM_TOPLEVEL *w_current, const char *string, int len)
s_page_append (toplevel->page_current, new_obj);
/* manually attach attribute */
+ o_attrib_attach (toplevel, new_obj, object);
- /* NEWSEL this is okay too, since tail is single obj */
- o_attrib_attach (toplevel, toplevel->page_current->object_tail, object);
-
- slot_text_object =
- toplevel->page_current->object_tail;
+ slot_text_object = new_obj;
}
o_erase_single(w_current, object);
diff --git a/gschem/src/o_text.c b/gschem/src/o_text.c
index 465438a..f101740 100644
--- a/gschem/src/o_text.c
+++ b/gschem/src/o_text.c
@@ -56,8 +56,8 @@ void o_text_draw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
o_redraw(w_current, o_current->text->prim_objs, TRUE);
- world_get_object_list_bounds(toplevel, o_current->text->prim_objs,
- &left, &top, &right, &bottom);
+ world_get_object_glist_bounds (toplevel, o_current->text->prim_objs,
+ &left, &top, &right, &bottom);
o_current->w_left = left;
o_current->w_top = top;
o_current->w_right = right;
@@ -236,7 +236,7 @@ void o_text_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_curre
if ((factor < w_current->text_display_zoomfactor) ||
o_current->text->size >= 12 ||
w_current->text_feedback == ALWAYS) {
- o_list_draw_xor(w_current, dx, dy, o_current->text->prim_objs);
+ o_glist_draw_xor (w_current, dx, dy, o_current->text->prim_objs);
} else {
/* text is too small so go through and draw a line in
it's place */
diff --git a/gschem/src/o_undo.c b/gschem/src/o_undo.c
index 3a14d55..17f19ed 100644
--- a/gschem/src/o_undo.c
+++ b/gschem/src/o_undo.c
@@ -77,7 +77,7 @@ void o_undo_savestate(GSCHEM_TOPLEVEL *w_current, int flag)
{
TOPLEVEL *toplevel = w_current->toplevel;
char *filename = NULL;
- OBJECT *object_head = NULL;
+ GList *object_list = NULL;
int levels;
UNDO *u_current;
UNDO *u_current_next;
@@ -116,11 +116,9 @@ void o_undo_savestate(GSCHEM_TOPLEVEL *w_current, int flag)
toplevel->page_current->ops_since_last_backup++;
}
- object_head = s_basic_new_object(OBJ_HEAD, "undo_head");
-
- o_list_copy_all(toplevel,
- toplevel->page_current->object_head->next,
- object_head, SELECTION_FLAG);
+ object_list = o_glist_copy_all (toplevel,
+ toplevel->page_current->object_list,
+ object_list, SELECTION_FLAG);
}
/* Clear Anything above current */
@@ -138,7 +136,7 @@ void o_undo_savestate(GSCHEM_TOPLEVEL *w_current, int flag)
toplevel->page_current->undo_tos =
s_undo_add(toplevel->page_current->undo_tos,
- flag, filename, object_head,
+ flag, filename, object_list,
toplevel->page_current->left,
toplevel->page_current->top,
toplevel->page_current->right,
@@ -198,10 +196,9 @@ void o_undo_savestate(GSCHEM_TOPLEVEL *w_current, int flag)
g_free(u_current->filename);
}
- if (u_current->object_head) {
- s_delete_list_fromstart(toplevel,
- u_current->object_head);
- u_current->object_head = NULL;
+ if (u_current->object_list) {
+ s_delete_object_glist (toplevel, u_current->object_list);
+ u_current->object_list = NULL;
}
u_current->next = NULL;
@@ -259,15 +256,15 @@ char *o_undo_find_prev_filename(UNDO *start)
* \par Function Description
*
*/
-OBJECT *o_undo_find_prev_object_head(UNDO *start)
+GList *o_undo_find_prev_object_head (UNDO *start)
{
UNDO *u_current;
u_current = start->prev;
while(u_current) {
- if (u_current->object_head) {
- return(u_current->object_head);
+ if (u_current->object_list) {
+ return u_current->object_list;
}
u_current = u_current->prev;
}
@@ -330,7 +327,7 @@ void o_undo_callback(GSCHEM_TOPLEVEL *w_current, int type)
if (w_current->undo_type == UNDO_DISK) {
u_current->filename = o_undo_find_prev_filename(u_current);
} else {
- u_current->object_head = o_undo_find_prev_object_head(u_current);
+ u_current->object_list = o_undo_find_prev_object_head (u_current);
}
}
@@ -350,7 +347,7 @@ void o_undo_callback(GSCHEM_TOPLEVEL *w_current, int type)
s_page_delete (toplevel, toplevel->page_current);
p_new = s_page_new(toplevel, u_current->filename);
s_page_goto (toplevel, p_new);
- } else if (w_current->undo_type == UNDO_MEMORY && u_current->object_head) {
+ } else if (w_current->undo_type == UNDO_MEMORY && u_current->object_list) {
PAGE *p_new;
s_page_delete (toplevel, toplevel->page_current);
p_new = s_page_new (toplevel, save_filename);
@@ -372,17 +369,16 @@ void o_undo_callback(GSCHEM_TOPLEVEL *w_current, int type)
toplevel->page_current->up = u_current->up;
toplevel->page_current->CHANGED=1;
- } else if (w_current->undo_type == UNDO_MEMORY && u_current->object_head) {
-
- s_delete_list_fromstart(toplevel, toplevel->page_current->object_head);
+ } else if (w_current->undo_type == UNDO_MEMORY && u_current->object_list) {
- toplevel->page_current->object_head = s_basic_new_object(OBJ_HEAD, "object_head");
+ s_delete_object_glist (toplevel, toplevel->page_current->object_list);
+ toplevel->page_current->object_list = NULL;
- o_list_copy_all(toplevel, u_current->object_head->next,
- toplevel->page_current->object_head,
- NORMAL_FLAG);
+ toplevel->page_current->object_list =
+ o_glist_copy_all (toplevel, u_current->object_list,
+ toplevel->page_current->object_list,
+ NORMAL_FLAG);
- toplevel->page_current->object_tail = return_tail(toplevel->page_current->object_head);
x_manual_resize(w_current);
toplevel->page_current->page_control = u_current->page_control;
toplevel->page_current->up = u_current->up;
@@ -441,11 +437,11 @@ void o_undo_callback(GSCHEM_TOPLEVEL *w_current, int type)
}
}
- /* don't have to free data here since filename, object_head are */
+ /* don't have to free data here since filename, object_list are */
/* just pointers to the real data (lower in the stack) */
if (find_prev_data) {
u_current->filename = NULL;
- u_current->object_head = NULL;
+ u_current->object_list = NULL;
}
#if DEBUG
diff --git a/gschem/src/x_attribedit.c b/gschem/src/x_attribedit.c
index edc65d7..67eff1f 100644
--- a/gschem/src/x_attribedit.c
+++ b/gschem/src/x_attribedit.c
@@ -286,7 +286,7 @@ void attribute_edit_dialog_response(GtkWidget *w, gint response,
* \par Function Description
* This function creates the single attribute edit dialog.
*/
-void attrib_edit_dialog(GSCHEM_TOPLEVEL *w_current, OBJECT * list, int flag)
+void attrib_edit_dialog (GSCHEM_TOPLEVEL *w_current, OBJECT *attr_obj, int flag)
{
TOPLEVEL *toplevel = w_current->toplevel;
GtkWidget *aewindow;
@@ -355,7 +355,7 @@ void attrib_edit_dialog(GSCHEM_TOPLEVEL *w_current, OBJECT * list, int flag)
DIALOG_BORDER_SPACING);
gtk_box_set_spacing(GTK_BOX(vbox), DIALOG_V_SPACING);
- if (list)
+ if (attr_obj)
label = gtk_label_new(_("<b>Edit Attribute</b>"));
else
label = gtk_label_new(_("<b>Add Attribute</b>"));
@@ -486,10 +486,10 @@ void attrib_edit_dialog(GSCHEM_TOPLEVEL *w_current, OBJECT * list, int flag)
}
/* gschem specific */
- if (list) {
- o_attrib_get_name_value (o_text_get_string (toplevel, list),
- &name, &val);
- attrib = list;
+ if (attr_obj) {
+ o_attrib_get_name_value (o_text_get_string (toplevel, attr_obj),
+ &name, &val);
+ attrib = attr_obj;
if (attrib->visibility == VISIBLE) {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(visbutton), TRUE);
} else {
diff --git a/gschem/src/x_autonumber.c b/gschem/src/x_autonumber.c
index eb4bc53..81a56ce 100644
--- a/gschem/src/x_autonumber.c
+++ b/gschem/src/x_autonumber.c
@@ -392,9 +392,11 @@ void autonumber_get_used(GSCHEM_TOPLEVEL *w_current, AUTONUMBER_TEXT *autotext)
AUTONUMBER_SLOT *slot;
GList *slot_item;
char *numslot_str, *slot_str;
+ GList *iter;
- for (o_current = w_current->toplevel->page_current->object_head; o_current != NULL;
- o_current = o_current->next) {
+ for (iter = w_current->toplevel->page_current->object_list; iter != NULL;
+ iter = g_list_next (iter)) {
+ o_current = iter->data;
if (autonumber_match(autotext, o_current, &number) == AUTONUMBER_RESPECT) {
/* check slot and maybe add it to the lists */
o_parent = o_current->attached_to;
@@ -663,6 +665,7 @@ void autonumber_text_autonumber(AUTONUMBER_TEXT *autotext)
gchar *new_searchtext;
gint i, number, slot;
GList *o_list = NULL;
+ GList *iter;
w_current = autotext->w_current;
autotext->current_searchtext = NULL;
@@ -704,8 +707,9 @@ void autonumber_text_autonumber(AUTONUMBER_TEXT *autotext)
for (page_item = pages; page_item != NULL; page_item = g_list_next(page_item)) {
s_page_goto(w_current->toplevel, page_item->data);
/* iterate over all objects an look for matching searchtext's */
- for (o_current = w_current->toplevel->page_current->object_head; o_current != NULL;
- o_current = o_current->next) {
+ for (iter = w_current->toplevel->page_current->object_list; iter != NULL;
+ iter = g_list_next (iter)) {
+ o_current = iter->data;
if (o_current->type == OBJ_TEXT) {
if (autotext->scope_number == SCOPE_HIERARCHY
|| autotext->scope_number == SCOPE_PAGE
@@ -771,8 +775,9 @@ void autonumber_text_autonumber(AUTONUMBER_TEXT *autotext)
/* RENUMBER CODE FOR ONE PAGE AND ONE SEARCHTEXT*/
/* 1. get objects to renumber */
- for (o_current = w_current->toplevel->page_current->object_head; o_current != NULL;
- o_current = o_current->next) {
+ for (iter = w_current->toplevel->page_current->object_list; iter != NULL;
+ iter = g_list_next (iter)) {
+ o_current = iter->data;
if (autonumber_match(autotext, o_current, &number) == AUTONUMBER_RENUMBER) {
/* put number into the used list */
o_list = g_list_append(o_list, o_current);
diff --git a/gschem/src/x_compselect.c b/gschem/src/x_compselect.c
index 7dfc6f0..66ba6df 100644
--- a/gschem/src/x_compselect.c
+++ b/gschem/src/x_compselect.c
@@ -515,8 +515,9 @@ update_attributes_model (Compselect *compselect, TOPLEVEL *preview_toplevel)
return;
}
- o_attrlist = o_complex_get_toplevel_attribs (preview_toplevel,
- preview_toplevel->page_current->object_head);
+ o_attrlist =
+ o_complex_get_toplevel_attribs (preview_toplevel,
+ preview_toplevel->page_current->object_list);
filter_list = GSCHEM_DIALOG (compselect)->w_current->component_select_attrlist;
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index 958f1ea..a11c85f 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -2872,7 +2872,7 @@ void find_text_dialog_response(GtkWidget *w, gint response,
s_page_goto(toplevel, remember_page);
}
done =
- o_edit_find_text(w_current, remember_page->object_head, string,
+ o_edit_find_text (w_current, remember_page->object_list, string,
gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON
(checkdescend)),
!start_find);
@@ -3000,7 +3000,7 @@ void hide_text_dialog_response(GtkWidget *w, gint response,
strncpy(generic_textstring, string, 256);
o_edit_hide_specific_text(w_current,
- w_current->toplevel->page_current->object_head, string);
+ w_current->toplevel->page_current->object_list, string);
break;
case GTK_RESPONSE_REJECT:
case GTK_RESPONSE_DELETE_EVENT:
@@ -3099,7 +3099,7 @@ void show_text_dialog_response(GtkWidget *widget, gint response,
strncpy(generic_textstring, string, 256);
o_edit_show_specific_text(w_current,
- w_current->toplevel->page_current->object_head, string);
+ w_current->toplevel->page_current->object_list, string);
break;
case GTK_RESPONSE_REJECT:
case GTK_RESPONSE_DELETE_EVENT:
diff --git a/gschem/src/x_image.c b/gschem/src/x_image.c
index 3641e7e..4b18a01 100644
--- a/gschem/src/x_image.c
+++ b/gschem/src/x_image.c
@@ -687,13 +687,13 @@ GdkPixbuf *x_image_get_pixbuf (GSCHEM_TOPLEVEL *w_current)
/* Do a zoom extents to get fit all the schematic in the window */
/* Commented so the image returned will be the same as with libgd */
a_zoom_extents (&toplevel,
- toplevel.page_current->object_head,
+ toplevel.page_current->object_list,
A_PAN_DONT_REDRAW);
/* See if there are objects */
- aux = toplevel->page_current->object_head;
+ aux = toplevel->page_current->object_list;
while (aux != NULL) {
if (aux->type != -1) {
object_found = 1;
@@ -706,8 +706,8 @@ GdkPixbuf *x_image_get_pixbuf (GSCHEM_TOPLEVEL *w_current)
/* If there are no objects, can't use zoom_extents */
if (object_found) {
o_redraw_all (&toplevel);
- get_object_list_bounds(&toplevel,
- toplevel.page_current->object_head,
+ get_object_glist_bounds (&toplevel,
+ toplevel.page_current->object_list,
&origin_x, &origin_y,
&right, &bottom);
}
diff --git a/gschem/src/x_preview.c b/gschem/src/x_preview.c
index a8b5049..3b09c61 100644
--- a/gschem/src/x_preview.c
+++ b/gschem/src/x_preview.c
@@ -103,7 +103,7 @@ preview_callback_realize (GtkWidget *widget,
preview_toplevel->DONT_REDRAW = 0;
a_zoom_extents(preview_w_current,
- preview_page->object_head,
+ preview_page->object_list,
A_PAN_DONT_REDRAW);
o_redraw_all(preview_w_current);
@@ -220,12 +220,10 @@ preview_update (Preview *preview)
if (preview->buffer != NULL) {
/* Load the data buffer */
- preview_toplevel->page_current->object_tail = (OBJECT *)
+ preview_toplevel->page_current->object_list =
o_read_buffer (preview_toplevel,
- preview_toplevel->page_current->object_tail,
+ preview_toplevel->page_current->object_list,
preview->buffer, -1, "Preview Buffer");
- preview_toplevel->page_current->object_tail = (OBJECT *)
- return_tail(preview_toplevel->page_current->object_head);
/* Is this needed? */
if (preview_toplevel->net_consolidate == TRUE) {
@@ -234,10 +232,10 @@ preview_update (Preview *preview)
}
}
- if (world_get_object_list_bounds (preview_toplevel,
- preview_toplevel->page_current->object_head,
- &left, &top,
- &right, &bottom)) {
+ if (world_get_object_glist_bounds (preview_toplevel,
+ preview_toplevel->page_current->object_list,
+ &left, &top,
+ &right, &bottom)) {
/* Clamp the canvas size to the extents of the page being previewed */
width = right - left;
height = bottom - top;
@@ -249,7 +247,7 @@ preview_update (Preview *preview)
/* display current page (possibly empty) */
a_zoom_extents (preview_w_current,
- preview_toplevel->page_current->object_head,
+ preview_toplevel->page_current->object_list,
A_PAN_DONT_REDRAW);
o_redraw_all (preview_w_current);
@@ -333,11 +331,10 @@ preview_event_configure (GtkWidget *widget,
preview_w_current->toplevel->DONT_REDRAW = save_redraw;
if (preview_page != NULL) {
/* If we have an empty page without object, just redraw the background */
- if (preview_page->object_head == NULL
- || preview_page->object_head->next == NULL) {
+ if (preview_page->object_list == NULL) {
x_repaint_background(preview_w_current);
} else {
- a_zoom_extents(preview_w_current, preview_page->object_head, 0);
+ a_zoom_extents (preview_w_current, preview_page->object_list, 0);
}
}
return retval;
diff --git a/gschem/src/x_window.c b/gschem/src/x_window.c
index 6d4904c..04ac14a 100644
--- a/gschem/src/x_window.c
+++ b/gschem/src/x_window.c
@@ -807,7 +807,7 @@ x_window_open_page (GSCHEM_TOPLEVEL *w_current, const gchar *filename)
scm_cons (g_make_page_smob (toplevel, page), SCM_EOL));
a_zoom_extents (w_current,
- toplevel->page_current->object_head,
+ toplevel->page_current->object_list,
A_PAN_DONT_REDRAW);
o_undo_savestate (w_current, UNDO_ALL);
diff --git a/gsymcheck/include/prototype.h b/gsymcheck/include/prototype.h
index b61a86a..4d063ee 100644
--- a/gsymcheck/include/prototype.h
+++ b/gsymcheck/include/prototype.h
@@ -14,22 +14,22 @@ void usage(char *cmd);
int parse_commandline(int argc, char *argv[]);
/* s_check.c */
int s_check_all(TOPLEVEL *pr_current);
-int s_check_symbol(TOPLEVEL *pr_current, PAGE *p_current, OBJECT *object_head);
+int s_check_symbol(TOPLEVEL *pr_current, PAGE *p_current, GList *obj_list);
gboolean s_check_list_has_item(char **list , char *item);
-void s_check_symbol_structure(OBJECT *object_head, SYMCHECK *s_current);
-void s_check_graphical(OBJECT *o_current, SYMCHECK *s_current);
-void s_check_device(OBJECT *o_current, SYMCHECK *s_current);
-void s_check_pinseq(OBJECT *object_head, SYMCHECK *s_current);
-void s_check_pinnumber(OBJECT *object_head, SYMCHECK *s_current);
-void s_check_pin_ongrid(OBJECT *object_head, SYMCHECK *s_current);
-void s_check_slotdef(OBJECT *object_head, SYMCHECK *s_current);
-void s_check_oldpin(OBJECT *object_head, SYMCHECK *s_current);
-void s_check_oldslot(OBJECT *object_head, SYMCHECK *s_current);
-void s_check_nets_buses(OBJECT *object_head, SYMCHECK *s_current);
-void s_check_connections(OBJECT *object_head, SYMCHECK *s_current);
+void s_check_symbol_structure(GList *obj_list, SYMCHECK *s_current);
+void s_check_graphical(GList *obj_list, SYMCHECK *s_current);
+void s_check_device(GList *obj_list, SYMCHECK *s_current);
+void s_check_pinseq(GList *obj_list, SYMCHECK *s_current);
+void s_check_pinnumber(GList *obj_list, SYMCHECK *s_current);
+void s_check_pin_ongrid(GList *obj_list, SYMCHECK *s_current);
+void s_check_slotdef(GList *obj_list, SYMCHECK *s_current);
+void s_check_oldpin(GList *obj_list, SYMCHECK *s_current);
+void s_check_oldslot(GList *obj_list, SYMCHECK *s_current);
+void s_check_nets_buses(GList *obj_list, SYMCHECK *s_current);
+void s_check_connections(GList *obj_list, SYMCHECK *s_current);
void s_check_missing_attribute(OBJECT *object, char *attribute, SYMCHECK *s_current);
-void s_check_missing_attributes(OBJECT *object_head, SYMCHECK *s_current);
-void s_check_pintype(OBJECT *object_head, SYMCHECK *s_current);
+void s_check_missing_attributes(GList *obj_list, SYMCHECK *s_current);
+void s_check_pintype(GList *obj_list, SYMCHECK *s_current);
/* s_log.c */
void s_log_update (const gchar *log_domain, GLogLevelFlags log_level, const gchar *buf);
/* s_symstruct.c */
diff --git a/gsymcheck/src/s_check.c b/gsymcheck/src/s_check.c
index 476759f..a3d54ff 100644
--- a/gsymcheck/src/s_check.c
+++ b/gsymcheck/src/s_check.c
@@ -51,10 +51,10 @@ s_check_all(TOPLEVEL *pr_current)
p_current = (PAGE *)iter->data;
- if (p_current->object_head) {
+ if (p_current->object_list) {
return_status = return_status +
s_check_symbol(pr_current, p_current,
- p_current->object_head);
+ p_current->object_list);
if (!quiet_mode) s_log_message("\n");
}
}
@@ -64,7 +64,7 @@ s_check_all(TOPLEVEL *pr_current)
int
-s_check_symbol(TOPLEVEL *pr_current, PAGE *p_current, OBJECT *object_head)
+s_check_symbol (TOPLEVEL *pr_current, PAGE *p_current, GList *obj_list)
{
SYMCHECK *s_symcheck=NULL;
int errors=0, warnings=0;
@@ -76,43 +76,43 @@ s_check_symbol(TOPLEVEL *pr_current, PAGE *p_current, OBJECT *object_head)
}
/* overal symbol structure test */
- s_check_symbol_structure(object_head, s_symcheck);
+ s_check_symbol_structure (obj_list, s_symcheck);
/* check for graphical attribute */
- s_check_graphical(object_head, s_symcheck);
+ s_check_graphical (obj_list, s_symcheck);
/* check for device attribute */
- s_check_device(object_head, s_symcheck);
+ s_check_device (obj_list, s_symcheck);
/* check for missing attributes */
- s_check_missing_attributes(object_head, s_symcheck);
+ s_check_missing_attributes (obj_list, s_symcheck);
/* check for pintype attribute (and multiples) on all pins */
- s_check_pintype(object_head, s_symcheck);
+ s_check_pintype (obj_list, s_symcheck);
/* check for pinseq attribute (and multiples) on all pins */
- s_check_pinseq(object_head, s_symcheck);
+ s_check_pinseq (obj_list, s_symcheck);
/* check for pinnumber attribute (and multiples) on all pins */
- s_check_pinnumber(object_head, s_symcheck);
+ s_check_pinnumber (obj_list, s_symcheck);
/* check for whether all pins are on grid */
- s_check_pin_ongrid(object_head, s_symcheck);
+ s_check_pin_ongrid (obj_list, s_symcheck);
/* check for slotdef attribute on all pins (if numslots exists) */
- s_check_slotdef(object_head, s_symcheck);
+ s_check_slotdef (obj_list, s_symcheck);
/* check for old pin#=# attributes */
- s_check_oldpin(object_head, s_symcheck);
+ s_check_oldpin (obj_list, s_symcheck);
/* check for old pin#=# attributes */
- s_check_oldslot(object_head, s_symcheck);
+ s_check_oldslot (obj_list, s_symcheck);
/* check for nets or buses within the symbol (completely disallowed) */
- s_check_nets_buses(object_head, s_symcheck);
+ s_check_nets_buses (obj_list, s_symcheck);
/* check for connections with in a symbol (completely disallowed) */
- s_check_connections(object_head, s_symcheck);
+ s_check_connections (obj_list, s_symcheck);
/* now report the info/warnings/errors to the user */
if (!quiet_mode) {
@@ -176,9 +176,9 @@ s_check_list_has_item(char **list , char *item)
}
void
-s_check_symbol_structure(OBJECT *object_head, SYMCHECK *s_current)
+s_check_symbol_structure (GList *obj_list, SYMCHECK *s_current)
{
- OBJECT *o_current;
+ GList *iter;
gchar *message;
gchar **tokens;
@@ -198,9 +198,8 @@ s_check_symbol_structure(OBJECT *object_head, SYMCHECK *s_current)
NULL};
/* pin# ?, slot# ? */
- for (o_current = object_head;
- o_current != NULL;
- o_current = o_current->next) {
+ for (iter = obj_list; iter != NULL; iter = g_list_next (iter)) {
+ OBJECT *o_current = iter->data;
if (o_current->type == OBJ_TEXT) {
tokens = g_strsplit(o_current->text->string,"=", 2);
@@ -251,12 +250,12 @@ s_check_symbol_structure(OBJECT *object_head, SYMCHECK *s_current)
}
void
-s_check_graphical(OBJECT *o_current, SYMCHECK *s_current)
+s_check_graphical (GList *obj_list, SYMCHECK *s_current)
{
char *temp;
/* look for special graphical tag */
- temp = o_attrib_search_name(o_current, "graphical", 0);
+ temp = o_attrib_search_name (obj_list, "graphical", 0);
if (temp) {
s_current->graphical_symbol=TRUE;
@@ -265,13 +264,13 @@ s_check_graphical(OBJECT *o_current, SYMCHECK *s_current)
}
void
-s_check_device(OBJECT *o_current, SYMCHECK *s_current)
+s_check_device (GList *obj_list, SYMCHECK *s_current)
{
char *temp;
char *message;
/* search for device attribute */
- temp = o_attrib_search_name(o_current, "device", 0);
+ temp = o_attrib_search_name (obj_list, "device", 0);
if (!temp) {
/* did not find device= attribute */
message = g_strdup ("Missing device= attribute\n");
@@ -307,9 +306,8 @@ s_check_device(OBJECT *o_current, SYMCHECK *s_current)
void
-s_check_pinseq(OBJECT *object_head, SYMCHECK *s_current)
+s_check_pinseq (GList *obj_list, SYMCHECK *s_current)
{
- OBJECT *o_current;
char *string;
int found_first=FALSE;
int missing_pinseq_attrib_sum=0;
@@ -319,12 +317,12 @@ s_check_pinseq(OBJECT *object_head, SYMCHECK *s_current)
GList *found_numbers = NULL;
GList *ptr1 = NULL;
GList *ptr2 = NULL;
+ GList *iter;
char *number;
char *message;
- o_current = object_head;
- while(o_current != NULL)
- {
+ for (iter = obj_list; iter != NULL; iter = g_list_next (iter)) {
+ OBJECT *o_current = iter->data;
if (o_current->type == OBJ_PIN)
{
@@ -389,8 +387,6 @@ s_check_pinseq(OBJECT *object_head, SYMCHECK *s_current)
s_current->multiple_pinseq_attrib += multiple_pinseq_attrib_sum;
}
-
- o_current = o_current->next;
}
ptr1 = found_numbers;
@@ -437,9 +433,8 @@ s_check_pinseq(OBJECT *object_head, SYMCHECK *s_current)
void
-s_check_pinnumber(OBJECT *object_head, SYMCHECK *s_current)
+s_check_pinnumber (GList *obj_list, SYMCHECK *s_current)
{
- OBJECT *o_current;
char *string;
int missing_pinnumber_attrib_sum=0;
int multiple_pinnumber_attrib_sum=0;
@@ -452,12 +447,13 @@ s_check_pinnumber(OBJECT *object_head, SYMCHECK *s_current)
GList *pin_numbers = NULL;
GList *cur = NULL;
GList *cur2 = NULL;
+ GList *iter;
char *message;
char *net = NULL;
/* collect all net pins */
for (counter = 0;
- (net = o_attrib_search_toplevel(object_head, "net", counter)) != NULL;
+ (net = o_attrib_search_toplevel (obj_list, "net", counter)) != NULL;
counter++) {
message = g_strdup_printf ("Found net=%s attribute\n", net);
s_current->info_messages = g_list_append(s_current->info_messages,
@@ -518,8 +514,8 @@ s_check_pinnumber(OBJECT *object_head, SYMCHECK *s_current)
}
/* collect all pin numbers */
- for (o_current = object_head; o_current != NULL;
- o_current = o_current->next) {
+ for (iter = obj_list; iter != NULL; iter = g_list_next (iter)) {
+ OBJECT *o_current = iter->data;
if (o_current->type == OBJ_PIN) {
s_current->numpins++;
@@ -625,16 +621,15 @@ s_check_pinnumber(OBJECT *object_head, SYMCHECK *s_current)
}
void
-s_check_pin_ongrid(OBJECT *object_head, SYMCHECK *s_current)
+s_check_pin_ongrid (GList *obj_list, SYMCHECK *s_current)
{
int x1, x2, y1, y2;
- OBJECT *o_current;
+ GList *iter;
char *message;
-
- for (o_current = object_head;
- o_current != NULL;
- o_current = o_current->next) {
+ for (iter = obj_list; iter != NULL; iter = g_list_next (iter)) {
+ OBJECT *o_current = iter->data;
+
if (o_current->type == OBJ_PIN) {
x1 = o_current->line->x[0];
y1 = o_current->line->y[0];
@@ -677,7 +672,7 @@ s_check_pin_ongrid(OBJECT *object_head, SYMCHECK *s_current)
void
-s_check_slotdef(OBJECT *object_head, SYMCHECK *s_current)
+s_check_slotdef (GList *obj_list, SYMCHECK *s_current)
{
char* value = NULL;
char* slotdef = NULL;
@@ -700,7 +695,7 @@ s_check_slotdef(OBJECT *object_head, SYMCHECK *s_current)
int errors_found = 0;
/* look for numslots to see if this symbol has slotting info */
- value = o_attrib_search_name(object_head, "numslots", 0);
+ value = o_attrib_search_name (obj_list, "numslots", 0);
if (!value) {
message = g_strdup ("Did not find numslots= attribute, not checking slotting\n");
@@ -733,7 +728,7 @@ s_check_slotdef(OBJECT *object_head, SYMCHECK *s_current)
i = 0;
/* get the slotdef attribute */
- slotdef = o_attrib_search_name(object_head, "slotdef", 0);
+ slotdef = o_attrib_search_name (obj_list, "slotdef", 0);
while ((slotdef != NULL) && (!error_parsing))
{
@@ -895,7 +890,7 @@ s_check_slotdef(OBJECT *object_head, SYMCHECK *s_current)
slotdef = NULL;
i++;
- slotdef = o_attrib_search_name(object_head, "slotdef", i);
+ slotdef = o_attrib_search_name (obj_list, "slotdef", i);
}
if (!slotdef && i < s_current->numslots) {
@@ -972,18 +967,17 @@ s_check_slotdef(OBJECT *object_head, SYMCHECK *s_current)
void
-s_check_oldpin(OBJECT *object_head, SYMCHECK *s_current)
+s_check_oldpin (GList *obj_list, SYMCHECK *s_current)
{
- OBJECT *o_current;
+ GList *iter;
char *ptr;
int found_old = FALSE;
int number_counter = 0;
char *message;
-
- o_current = object_head;
- while(o_current != NULL)
- {
-
+
+ for (iter = obj_list; iter != NULL; iter = g_list_next (iter)) {
+ OBJECT *o_current = iter->data;
+
if (o_current->type == OBJ_TEXT)
{
if (strstr(o_current->text->string, "pin"))
@@ -1005,17 +999,11 @@ s_check_oldpin(OBJECT *object_head, SYMCHECK *s_current)
}
if (!ptr)
- {
- o_current = o_current->next;
continue;
- }
/* found no numbers inbetween pin and = */
if (number_counter == 0)
- {
- o_current = o_current->next;
continue;
- }
/* skip over = char */
ptr++;
@@ -1045,26 +1033,23 @@ s_check_oldpin(OBJECT *object_head, SYMCHECK *s_current)
}
}
}
-
- o_current = o_current->next;
}
}
void
-s_check_oldslot(OBJECT *object_head, SYMCHECK *s_current)
+s_check_oldslot (GList *obj_list, SYMCHECK *s_current)
{
- OBJECT *o_current;
+ GList *iter;
char *ptr;
int found_old = FALSE;
int number_counter = 0;
char *message;
- o_current = object_head;
- while(o_current != NULL)
- {
-
+ for (iter = obj_list; iter != NULL; iter = g_list_next (iter)) {
+ OBJECT *o_current = iter->data;
+
if (o_current->type == OBJ_TEXT)
{
if (strstr(o_current->text->string, "slot"))
@@ -1086,17 +1071,11 @@ s_check_oldslot(OBJECT *object_head, SYMCHECK *s_current)
}
if (!ptr)
- {
- o_current = o_current->next;
continue;
- }
/* found no numbers inbetween pin and = */
if (number_counter == 0)
- {
- o_current = o_current->next;
continue;
- }
/* skip over = char */
ptr++;
@@ -1125,21 +1104,19 @@ s_check_oldslot(OBJECT *object_head, SYMCHECK *s_current)
}
}
}
-
- o_current = o_current->next;
}
}
void
-s_check_nets_buses(OBJECT *object_head, SYMCHECK *s_current)
+s_check_nets_buses (GList *obj_list, SYMCHECK *s_current)
{
- OBJECT *o_current;
+ GList *iter;
char *message;
-
- o_current = object_head;
- while(o_current != NULL)
- {
+
+ for (iter = obj_list; iter != NULL; iter = g_list_next (iter)) {
+ OBJECT *o_current = iter->data;
+
if (o_current->type == OBJ_NET)
{
message =
@@ -1160,20 +1137,17 @@ s_check_nets_buses(OBJECT *object_head, SYMCHECK *s_current)
s_current->error_count++;
}
-
- o_current = o_current->next;
}
}
void
-s_check_connections(OBJECT *object_head, SYMCHECK *s_current)
+s_check_connections (GList *obj_list, SYMCHECK *s_current)
{
- OBJECT *o_current;
+ GList *iter;
char *message;
-
- o_current = object_head;
- while(o_current != NULL)
- {
+
+ for (iter = obj_list; iter != NULL; iter = g_list_next (iter)) {
+ OBJECT *o_current = iter->data;
if (o_current->conn_list) {
message =
@@ -1183,8 +1157,6 @@ s_check_connections(OBJECT *object_head, SYMCHECK *s_current)
s_current->found_connection++;
s_current->error_count++;
}
-
- o_current = o_current->next;
}
}
@@ -1200,8 +1172,7 @@ s_check_missing_attribute(OBJECT *object, char *attribute, SYMCHECK *s_current)
return;
}
- string = o_attrib_search_name_single_count(object, attribute,
- counter);
+ string = o_attrib_search_name_single_count (object, attribute, counter);
if (!string)
{
message = g_strdup_printf (
@@ -1238,21 +1209,20 @@ s_check_missing_attribute(OBJECT *object, char *attribute, SYMCHECK *s_current)
g_free(string);
counter++;
- string = o_attrib_search_name_single_count(object, attribute,
- counter);
+ string = o_attrib_search_name_single_count (object, attribute, counter);
}
}
void
-s_check_missing_attributes(OBJECT *object_head, SYMCHECK *s_current)
+s_check_missing_attributes (GList *obj_list, SYMCHECK *s_current)
{
- OBJECT *o_current;
+ GList *iter;
char *message;
- o_current = object_head;
- while(o_current != NULL)
- {
+ for (iter = obj_list; iter != NULL; iter = g_list_next (iter)) {
+ OBJECT *o_current = iter->data;
+
if (o_current->type == OBJ_PIN)
{
s_check_missing_attribute(o_current, "pinlabel", s_current);
@@ -1280,8 +1250,6 @@ s_check_missing_attributes(OBJECT *object_head, SYMCHECK *s_current)
}
}
-
- o_current = o_current->next;
}
if (s_current->found_footprint == 0) {
@@ -1316,9 +1284,9 @@ s_check_missing_attributes(OBJECT *object_head, SYMCHECK *s_current)
}
-void s_check_pintype(OBJECT *object_head, SYMCHECK *s_current)
+void s_check_pintype (GList *obj_list, SYMCHECK *s_current)
{
- OBJECT *o_current;
+ GList *iter;
int counter=0;
char *pintype;
char *message;
@@ -1326,10 +1294,9 @@ void s_check_pintype(OBJECT *object_head, SYMCHECK *s_current)
"pas", "tp", "tri", "clk", "pwr",
NULL};
- for (o_current = object_head;
- o_current != NULL;
- o_current = o_current->next) {
-
+ for (iter = obj_list; iter != NULL; iter = g_list_next (iter)) {
+ OBJECT *o_current = iter->data;
+
if (o_current->type == OBJ_PIN) {
for (counter = 0;
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index 69196f6..910707b 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -3,9 +3,9 @@
const gchar *o_file_format_header();
gchar *o_save_buffer(TOPLEVEL *toplevel);
int o_save(TOPLEVEL *toplevel, const char *filename);
-OBJECT *o_read_buffer(TOPLEVEL *toplevel, OBJECT *object_list, char *buffer, const int size, const char *name);
-OBJECT *o_read(TOPLEVEL *toplevel, OBJECT *object_list, char *filename, GError **err);
-void o_scale(TOPLEVEL *toplevel, OBJECT *list, int x_scale, int y_scale);
+GList *o_read_buffer(TOPLEVEL *toplevel, GList *object_list, char *buffer, const int size, const char *name);
+GList *o_read(TOPLEVEL *toplevel, GList *object_list, char *filename, GError **err);
+void o_scale(TOPLEVEL *toplevel, GList *list, int x_scale, int y_scale);
/* f_basic.c */
gchar *f_get_autosave_filename (const gchar *filename);
@@ -117,19 +117,19 @@ void o_attrib_print(GList *attributes);
void o_attrib_remove(GList **list, OBJECT *remove);
gboolean o_attrib_get_name_value (const gchar *string, gchar **name_ptr, gchar **value_ptr);
void o_attrib_set_color(TOPLEVEL *toplevel, GList *attributes);
-char *o_attrib_search_name(OBJECT *list, char *name, int counter);
-OBJECT *o_attrib_search_string_list(OBJECT *list, char *string);
+char *o_attrib_search_name(GList *list, char *name, int counter);
+OBJECT *o_attrib_search_string_list(GList *list, char *string);
char *o_attrib_search_string_partial(OBJECT *object, char *search_for, int counter);
OBJECT *o_attrib_search_string_single(OBJECT *object, char *search_for);
OBJECT *o_attrib_search_attrib_value(GList *list, char *value, char *name, int counter);
char *o_attrib_search_attrib_name(GList *list, char *name, int counter);
-char *o_attrib_search_toplevel(OBJECT *list, char *name, int counter);
+char *o_attrib_search_toplevel(GList *list, char *name, int counter);
char *o_attrib_search_name_single(OBJECT *object, char *name, OBJECT **return_found);
char *o_attrib_search_name_single_count(OBJECT *object, char *name, int counter);
char *o_attrib_search_slot(OBJECT *object, OBJECT **return_found);
char *o_attrib_search_numslots(OBJECT *object, OBJECT **return_found);
char *o_attrib_search_default_slot(OBJECT *object);
-OBJECT *o_attrib_search_pinseq(OBJECT *list, int pin_number);
+OBJECT *o_attrib_search_pinseq(GList *list, int pin_number);
char *o_attrib_search_slotdef(OBJECT *object, int slotnumber);
char *o_attrib_search_component(OBJECT *object, char *name);
void o_attrib_slot_update(TOPLEVEL *toplevel, OBJECT *object);
@@ -141,7 +141,6 @@ void o_attrib_free_returned(OBJECT **found_objects);
/* o_basic.c */
int inside_region(int xmin, int ymin, int xmax, int ymax, int x, int y);
void o_recalc_single_object(TOPLEVEL *toplevel, OBJECT *o_current);
-void o_recalc_object_list(TOPLEVEL *toplevel, OBJECT *object_list);
void o_recalc_object_glist(TOPLEVEL *toplevel, GList *object_glist);
void o_set_line_options(TOPLEVEL *toplevel, OBJECT *o_current, OBJECT_END end, OBJECT_TYPE type, int width, int length, int space);
void o_set_fill_options(TOPLEVEL *toplevel, OBJECT *o_current, OBJECT_FILLING type, int width, int pitch1, int angle1, int pitch2, int angle2);
@@ -183,16 +182,13 @@ void o_circle_mirror_world(TOPLEVEL *toplevel, int world_centerx, int world_cent
int world_get_single_object_bounds(TOPLEVEL *toplevel, OBJECT *o_current,
int *rleft, int *rtop,
int *rright, int *rbottom);
-int world_get_object_list_bounds(TOPLEVEL *toplevel, OBJECT *complex,
- int *left, int *top, int *right, int *bottom);
int world_get_object_glist_bounds(TOPLEVEL *toplevel, GList *o_list,
int *left, int *top,
int *right, int *bottom);
-OBJECT *new_head(void);
int o_complex_is_embedded(OBJECT *o_current);
-GList *o_complex_get_toplevel_attribs (TOPLEVEL *toplevel, OBJECT *o_head);
+GList *o_complex_get_toplevel_attribs (TOPLEVEL *toplevel, GList *obj_list);
GList *o_complex_get_promotable (TOPLEVEL *toplevel, OBJECT *object, int detach);
-void o_complex_promote_attribs (TOPLEVEL *toplevel, OBJECT *object);
+void o_complex_promote_attribs (TOPLEVEL *toplevel, OBJECT *object, GList **obj_list);
void o_complex_remove_promotable_attribs (TOPLEVEL *toplevel, OBJECT *object);
OBJECT *o_complex_new(TOPLEVEL *toplevel, char type, int color, int x, int y, int angle, int mirror, const CLibSymbol *clib_sym, const gchar *basename, int selectable);
OBJECT *o_complex_new_embedded(TOPLEVEL *toplevel, char type, int color, int x, int y, int angle, int mirror, const gchar *basename, int selectable);
@@ -200,13 +196,13 @@ void o_complex_set_filename(TOPLEVEL *toplevel, const char *basename);
void o_complex_translate_world(TOPLEVEL *toplevel, int dx, int dy, OBJECT *object);
OBJECT *o_complex_copy(TOPLEVEL *toplevel, OBJECT *o_current);
OBJECT *o_complex_copy_embedded(TOPLEVEL *toplevel, OBJECT *o_current);
-void o_complex_set_color(OBJECT *prim_objs, int color);
+void o_complex_set_color(GList *prim_objs, int color);
void o_complex_set_color_single(OBJECT *o_current, int color);
-void o_complex_set_color_save(OBJECT *complex, int color);
-void o_complex_unset_color(OBJECT *complex);
+void o_complex_set_color_save(GList *list, int color);
+void o_complex_unset_color(GList *list);
void o_complex_unset_color_single(OBJECT *o_current);
-void o_complex_set_saved_color_only(OBJECT *complex, int color);
-OBJECT *o_complex_return_nth_pin(OBJECT *o_list, int counter);
+void o_complex_set_saved_color_only(GList *list, int color);
+OBJECT *o_complex_return_nth_pin(GList *list, int counter);
void o_complex_rotate_world(TOPLEVEL *toplevel, int world_centerx, int world_centery, int angle, OBJECT *object);
void o_complex_mirror_world(TOPLEVEL *toplevel, int world_centerx, int world_centery, OBJECT *object);
OBJECT *o_complex_return_pin_object(OBJECT *object, char *pin);
@@ -229,16 +225,10 @@ int o_line_visible(TOPLEVEL *toplevel, LINE *line, int *x1, int *y1, int *x2, in
double o_line_length(OBJECT *object);
/* o_list.c */
-OBJECT *o_list_copy_to(TOPLEVEL *toplevel, OBJECT *list_head, OBJECT *selected, int flag, OBJECT **return_end);
-OBJECT *o_list_copy_all(TOPLEVEL *toplevel, OBJECT *src_list_head, OBJECT *dest_list_head, int flag);
-GList *o_glist_copy_all_to_glist(TOPLEVEL *toplevel, GList *src_list, GList *dest_list, int flag);
-void o_glist_relink_objects (GList *o_glist);
-void o_list_delete_rest(TOPLEVEL *toplevel, OBJECT *list);
-void o_list_translate_world(TOPLEVEL *toplevel, int dx, int dy, OBJECT *list);
+OBJECT *o_object_copy(TOPLEVEL *toplevel, OBJECT *selected, int flag);
+GList *o_glist_copy_all(TOPLEVEL *toplevel, GList *src_list, GList *dest_list, int flag);
void o_glist_translate_world(TOPLEVEL *toplevel, int dx, int dy, GList *list);
-void o_list_rotate_world(TOPLEVEL *toplevel, int x, int y, int angle, OBJECT *list);
void o_glist_rotate_world(TOPLEVEL *toplevel, int x, int y, int angle, GList *list);
-void o_list_mirror_world(TOPLEVEL *toplevel, int x, int y, OBJECT *list);
void o_glist_mirror_world(TOPLEVEL *toplevel, int x, int y, GList *list);
/* o_net_basic.c */
@@ -286,7 +276,7 @@ OBJECT *o_pin_copy(TOPLEVEL *toplevel, OBJECT *o_current);
void o_pin_rotate_world(TOPLEVEL *toplevel, int world_centerx, int world_centery, int angle, OBJECT *object);
void o_pin_mirror_world(TOPLEVEL *toplevel, int world_centerx, int world_centery, OBJECT *object);
void o_pin_modify(TOPLEVEL *toplevel, OBJECT *object, int x, int y, int whichone);
-void o_pin_update_whichend(TOPLEVEL *toplevel, OBJECT *object_list, int num_pins);
+void o_pin_update_whichend(TOPLEVEL *toplevel, GList *object_list, int num_pins);
/* o_selection.c */
SELECTION *o_selection_new( void );
@@ -297,14 +287,13 @@ void o_selection_select(OBJECT *object, int color); /* DEPRECATED */
void o_selection_unselect(OBJECT *object); /* DEPRECATED */
/* o_text_basic.c */
-OBJECT *o_text_new_head(void);
void o_text_init(void);
void o_text_print_set(void);
-OBJECT *o_text_load_font(TOPLEVEL *toplevel, gunichar needed_char);
+GList *o_text_load_font(TOPLEVEL *toplevel, gunichar needed_char);
int o_text_num_lines(const char *string);
int o_text_height(const char *string, int size);
int o_text_width(TOPLEVEL *toplevel, char *string, int size);
-OBJECT *o_text_create_string(TOPLEVEL *toplevel, OBJECT *object_list, char *string, int size, int color, int x, int y, int alignment, int angle);
+GList *o_text_create_string(TOPLEVEL *toplevel, char *string, int size, int color, int x, int y, int alignment, int angle);
OBJECT *o_text_new(TOPLEVEL *toplevel, char type, int color, int x, int y, int alignment, int angle, const char *string, int size, int visibility, int show_name_value);
void o_text_set_info_font(char buf[]);
void o_text_recreate(TOPLEVEL *toplevel, OBJECT *o_current);
@@ -327,19 +316,13 @@ char *s_attrib_get(int counter);
/* s_basic.c */
void error_if_called(void);
void exit_if_null(void *ptr);
-OBJECT *return_tail(OBJECT *head);
-OBJECT *return_head(OBJECT *tail);
OBJECT *s_basic_init_object(OBJECT *new_node, int type, char const *name);
OBJECT *s_basic_new_object(char type, char const *prefix);
-OBJECT *s_basic_link_object(OBJECT *new_node, OBJECT *ptr);
-void print_struct_forw(OBJECT *ptr);
-void print_struct_back(OBJECT *ptr);
+void print_struct_forw(GList *list);
void print_struct(OBJECT *ptr);
void s_delete_object(TOPLEVEL *toplevel, OBJECT *o_current);
void s_delete(TOPLEVEL *toplevel, OBJECT *o_current);
-void s_delete_list_fromstart(TOPLEVEL *toplevel, OBJECT *start);
void s_delete_object_glist(TOPLEVEL *toplevel, GList *list);
-OBJECT *s_remove(TOPLEVEL *toplevel, OBJECT *object);
char *remove_nl(char *string);
char *remove_last_nl(char *string);
gchar *s_expand_env_variables (const gchar *string);
@@ -381,7 +364,7 @@ void s_conn_remove(TOPLEVEL *toplevel, OBJECT *to_remove);
void s_conn_remove_complex(TOPLEVEL *toplevel, OBJECT *to_remove);
OBJECT *s_conn_check_midpoint(OBJECT *o_current, int x, int y);
void s_conn_update_object(TOPLEVEL *toplevel, OBJECT *object);
-void s_conn_update_complex(TOPLEVEL *toplevel, OBJECT *complex);
+void s_conn_update_complex(TOPLEVEL *toplevel, GList *list);
void s_conn_print(GList *conn_list);
int s_conn_net_search(OBJECT* new_net, int whichone, GList * conn_list);
GList *s_conn_return_others(GList *input_list, OBJECT *object);
@@ -390,7 +373,7 @@ GList *s_conn_return_complex_others(GList *input_list, OBJECT *object);
/* s_cue.c */
void s_cue_postscript_fillbox(TOPLEVEL *toplevel, FILE *fp, int x, int y);
void s_cue_postscript_fillcircle(TOPLEVEL *toplevel, FILE *fp, int x, int y, int size_flag);
-void s_cue_output_all(TOPLEVEL *toplevel, OBJECT *head, FILE *fp, int type);
+void s_cue_output_all(TOPLEVEL *toplevel, GList *obj_list, FILE *fp, int type);
void s_cue_output_lowlevel(TOPLEVEL *toplevel, OBJECT *object, int whichone, FILE *fp, int output_type);
void s_cue_output_lowlevel_midpoints(TOPLEVEL *toplevel, OBJECT *object, FILE *fp, int output_type);
void s_cue_output_single(TOPLEVEL *toplevel, OBJECT *object, FILE *fp, int type);
@@ -490,7 +473,7 @@ UNDO *s_undo_return_tail(UNDO *head);
UNDO *s_undo_return_head(UNDO *tail);
UNDO *s_undo_new_head(void);
void s_undo_destroy_head(UNDO *u_head);
-UNDO *s_undo_add(UNDO *head, int type, char *filename, OBJECT *object_head, int left, int top, int right, int bottom, int page_control, int up);
+UNDO *s_undo_add(UNDO *head, int type, char *filename, GList *object_list, int left, int top, int right, int bottom, int page_control, int up);
void s_undo_print_all(UNDO *head);
void s_undo_destroy_all(TOPLEVEL *toplevel, UNDO *head);
void s_undo_remove(TOPLEVEL *toplevel, UNDO *head, UNDO *u_tos);
diff --git a/libgeda/include/prototype_priv.h b/libgeda/include/prototype_priv.h
index 3a9afca..9b46975 100644
--- a/libgeda/include/prototype_priv.h
+++ b/libgeda/include/prototype_priv.h
@@ -1,12 +1,12 @@
/* a_basic.c */
-gchar *o_save_objects(OBJECT *object_list);
+gchar *o_save_objects(GList *object_list);
/* f_print.c */
void f_print_set_line_width(FILE *fp, int width);
void f_print_set_color(FILE *fp, int color);
int f_print_header(TOPLEVEL *toplevel, FILE *fp, int paper_size_x, int paper_size_y, int eps);
void f_print_footer(FILE *fp);
-void f_print_objects(TOPLEVEL *toplevel, FILE *fp, OBJECT *head, int start_x, int start_y, float scale, int unicode_count, gunichar *unicode_table);
+void f_print_objects(TOPLEVEL *toplevel, FILE *fp, GList *obj_list, int start_x, int start_y, float scale, int unicode_count, gunichar *unicode_table);
int f_print_initialize_glyph_table(void);
/* g_rc.c */
@@ -75,7 +75,7 @@ void m_transform_scale(TRANSFORM *transform, gdouble factor);
void m_transform_translate(TRANSFORM *transform, gdouble dx, gdouble dy);
/* o_arc_basic.c */
-OBJECT *o_arc_read(TOPLEVEL *toplevel, OBJECT *object_list, char buf[], unsigned int release_ver, unsigned int fileformat_ver);
+OBJECT *o_arc_read(TOPLEVEL *toplevel, char buf[], unsigned int release_ver, unsigned int fileformat_ver);
char *o_arc_save(OBJECT *object);
void o_arc_print(TOPLEVEL *toplevel, FILE *fp, OBJECT *o_current, int origin_x, int origin_y);
void o_arc_print_solid(TOPLEVEL *toplevel, FILE *fp, int x, int y, int radius, int angle1, int angle2, int color, int arc_width, int length, int space, int origin_x, int origin_y);
@@ -89,18 +89,19 @@ void world_get_arc_bounds(TOPLEVEL *toplevel, OBJECT *object, int *left, int *to
void o_arc_recalc(TOPLEVEL *toplevel, OBJECT *o_current);
/* o_attrib.c */
-OBJECT *o_read_attribs(TOPLEVEL *toplevel,
- OBJECT *object_to_get_attribs,
- TextBuffer *tb,
- unsigned int release_ver,
- unsigned int fileformat_ver);
+GList *o_read_attribs(TOPLEVEL *toplevel,
+ GList *list,
+ OBJECT *object_to_get_attribs,
+ TextBuffer *tb,
+ unsigned int release_ver,
+ unsigned int fileformat_ver);
gchar *o_save_attribs(GList *attribs);
/* o_basic.c */
void o_bounds_invalidate(TOPLEVEL *toplevel, OBJECT *object);
/* o_box_basic.c */
-OBJECT *o_box_read(TOPLEVEL *toplevel, OBJECT *object_list, char buf[], unsigned int release_ver, unsigned int fileformat_ver);
+OBJECT *o_box_read(TOPLEVEL *toplevel, char buf[], unsigned int release_ver, unsigned int fileformat_ver);
char *o_box_save(OBJECT *object);
void o_box_print(TOPLEVEL *toplevel, FILE *fp, OBJECT *o_current, int origin_x, int origin_y);
void o_box_print_solid(TOPLEVEL *toplevel, FILE *fp, int x, int y, int width, int height, int color, int line_width, int length, int space, int origin_x, int origin_y);
@@ -116,14 +117,14 @@ void world_get_box_bounds(TOPLEVEL *toplevel, OBJECT *object, int *left, int *to
void o_box_recalc(TOPLEVEL *toplevel, OBJECT *o_current);
/* o_bus_basic.c */
-OBJECT *o_bus_read(TOPLEVEL *toplevel, OBJECT *object_list, char buf[], unsigned int release_ver, unsigned int fileformat_ver);
+OBJECT *o_bus_read(TOPLEVEL *toplevel, char buf[], unsigned int release_ver, unsigned int fileformat_ver);
char *o_bus_save(OBJECT *object);
void o_bus_print(TOPLEVEL *toplevel, FILE *fp, OBJECT *o_current, int origin_x, int origin_y);
void world_get_bus_bounds(TOPLEVEL *toplevel, OBJECT *object, int *left, int *top, int *right, int *bottom);
void o_bus_recalc(TOPLEVEL *toplevel, OBJECT *o_current);
/* o_circle_basic.c */
-OBJECT *o_circle_read(TOPLEVEL *toplevel, OBJECT *object_list, char buf[], unsigned int release_ver, unsigned int fileformat_ver);
+OBJECT *o_circle_read(TOPLEVEL *toplevel, char buf[], unsigned int release_ver, unsigned int fileformat_ver);
char *o_circle_save(OBJECT *object);
void o_circle_print(TOPLEVEL *toplevel, FILE *fp, OBJECT *o_current, int origin_x, int origin_y);
void o_circle_print_solid(TOPLEVEL *toplevel, FILE *fp, int x, int y, int radius, int color, int circle_width, int length, int space, int origin_x, int origin_y);
@@ -139,14 +140,14 @@ void world_get_circle_bounds(TOPLEVEL *toplevel, OBJECT *object, int *left, int
void o_circle_recalc(TOPLEVEL *toplevel, OBJECT *o_current);
/* o_complex_basic.c */
-OBJECT *o_complex_read(TOPLEVEL *toplevel, OBJECT *object_list, char buf[], unsigned int release_ver, unsigned int fileformat_ver);
+OBJECT *o_complex_read(TOPLEVEL *toplevel, char buf[], unsigned int release_ver, unsigned int fileformat_ver);
char *o_complex_save(OBJECT *object);
gdouble o_complex_shortest_distance(COMPLEX *complex, gint x, gint y);
void world_get_complex_bounds(TOPLEVEL *toplevel, OBJECT *complex, int *left, int *top, int *right, int *bottom);
void o_complex_recalc(TOPLEVEL *toplevel, OBJECT *o_current);
/* o_line_basic.c */
-OBJECT *o_line_read(TOPLEVEL *toplevel, OBJECT *object_list, char buf[], unsigned int release_ver, unsigned int fileformat_ver);
+OBJECT *o_line_read(TOPLEVEL *toplevel, char buf[], unsigned int release_ver, unsigned int fileformat_ver);
char *o_line_save(OBJECT *object);
void o_line_print(TOPLEVEL *toplevel, FILE *fp, OBJECT *o_current, int origin_x, int origin_y);
void o_line_print_solid(TOPLEVEL *toplevel, FILE *fp, int x1, int y1, int x2, int y2, int color, int line_width, int length, int space, int origin_x, int origin_y);
@@ -159,14 +160,14 @@ void world_get_line_bounds(TOPLEVEL *toplevel, OBJECT *object, int *left, int *t
void o_line_recalc(TOPLEVEL *toplevel, OBJECT *o_current);
/* o_net_basic.c */
-OBJECT *o_net_read(TOPLEVEL *toplevel, OBJECT *object_list, char buf[], unsigned int release_ver, unsigned int fileformat_ver);
+OBJECT *o_net_read(TOPLEVEL *toplevel, char buf[], unsigned int release_ver, unsigned int fileformat_ver);
char *o_net_save(OBJECT *object);
void o_net_print(TOPLEVEL *toplevel, FILE *fp, OBJECT *o_current, int origin_x, int origin_y);
void world_get_net_bounds(TOPLEVEL *toplevel, OBJECT *object, int *left, int *top, int *right, int *bottom);
void o_net_recalc(TOPLEVEL *toplevel, OBJECT *o_current);
/* o_path_basic.c */
-OBJECT *o_path_read(TOPLEVEL *toplevel, OBJECT *object_list, const char *first_line, TextBuffer *tb, unsigned int release_ver, unsigned int fileformat_ver);
+OBJECT *o_path_read(TOPLEVEL *toplevel, const char *first_line, TextBuffer *tb, unsigned int release_ver, unsigned int fileformat_ver);
char *o_path_save(OBJECT *object);
void o_path_print(TOPLEVEL *toplevel, FILE *fp, OBJECT *o_current, int origin_x, int origin_y);
gdouble o_path_shortest_distance(OBJECT *object, gint x, gint y);
@@ -175,11 +176,7 @@ void o_path_recalc(TOPLEVEL *toplevel, OBJECT *o_current);
/* o_picture.c */
-OBJECT *o_picture_read(TOPLEVEL *toplevel, OBJECT *object_list,
- const char *first_line,
- TextBuffer *tb,
- unsigned int release_ver,
- unsigned int fileformat_ver);
+OBJECT *o_picture_read(TOPLEVEL *toplevel, const char *first_line, TextBuffer *tb, unsigned int release_ver, unsigned int fileformat_ver);
char *o_picture_save(OBJECT *object);
void o_picture_print(TOPLEVEL *toplevel, FILE *fp, OBJECT *o_current,
int origin_x, int origin_y);
@@ -188,19 +185,14 @@ void world_get_picture_bounds(TOPLEVEL *toplevel, OBJECT *object, int *left, int
void o_picture_recalc(TOPLEVEL *toplevel, OBJECT *o_current);
/* o_pin_basic.c */
-OBJECT *o_pin_read(TOPLEVEL *toplevel, OBJECT *object_list, char buf[], unsigned int release_ver, unsigned int fileformat_ver);
+OBJECT *o_pin_read(TOPLEVEL *toplevel, char buf[], unsigned int release_ver, unsigned int fileformat_ver);
char *o_pin_save(OBJECT *object);
void o_pin_print(TOPLEVEL *toplevel, FILE *fp, OBJECT *o_current, int origin_x, int origin_y);
void world_get_pin_bounds(TOPLEVEL *toplevel, OBJECT *object, int *left, int *top, int *right, int *bottom);
void o_pin_recalc(TOPLEVEL *toplevel, OBJECT *o_current);
/* o_text_basic.c */
-OBJECT *o_text_read(TOPLEVEL *toplevel,
- OBJECT *object_list,
- const char *first_line,
- TextBuffer *tb,
- unsigned int release_ver,
- unsigned int fileformat_ver);
+OBJECT *o_text_read(TOPLEVEL *toplevel, const char *first_line, TextBuffer *tb, unsigned int release_ver, unsigned int fileformat_ver);
char *o_text_save(OBJECT *object);
void o_text_print_text_string(FILE *fp, char *string, int unicode_count, gunichar *unicode_table);
void o_text_print(TOPLEVEL *toplevel, FILE *fp, OBJECT *o_current, int origin_x, int origin_y, int unicode_count, gunichar *unicode_table);
diff --git a/libgeda/include/struct.h b/libgeda/include/struct.h
index efcbe4d..c9a5d85 100644
--- a/libgeda/include/struct.h
+++ b/libgeda/include/struct.h
@@ -196,7 +196,7 @@ struct st_text {
int displayed_height;
int angle;
- OBJECT *prim_objs;
+ GList *prim_objs;
};
struct st_complex {
@@ -207,7 +207,7 @@ struct st_complex {
/* in degrees */
int mirror;
- OBJECT *prim_objs; /* Primitive objects */
+ GList *prim_objs; /* Primitive objects */
/* objects which make up the */
/* complex */
};
@@ -291,7 +291,7 @@ struct st_object {
int font_text_size; /* used only with fonts defs */
- OBJECT *font_prim_objs; /* used only with fonts defs */
+ GList *font_prim_objs; /* used only with fonts defs */
int whichend; /* for pins only, either 0 or 1 */
int pin_type; /* for pins only, either NET or BUS */
@@ -302,8 +302,6 @@ struct st_object {
OBJECT *attached_to; /* when object is an attribute */
OBJECT *copied_to; /* used when copying attributes */
- OBJECT *prev;
- OBJECT *next;
};
@@ -369,7 +367,7 @@ struct st_undo {
/* one of these is used, depending on if you are doing in-memory */
/* or file based undo state saving */
char *filename;
- OBJECT *object_head;
+ GList *object_list;
/* either UNDO_ALL or UNDO_VIEWPORT_ONLY */
int type;
@@ -403,11 +401,10 @@ struct st_page {
int pid;
- OBJECT *object_head;
- OBJECT *object_tail;
+ GList *object_list;
SELECTION *selection_list; /* new selection mechanism */
GList *place_list;
- OBJECT *object_lastplace;
+ OBJECT *object_lastplace; /* the last found item */
STRETCH *stretch_head;
STRETCH *stretch_tail;
diff --git a/libgeda/src/a_basic.c b/libgeda/src/a_basic.c
index 4c86cf2..dad14c3 100644
--- a/libgeda/src/a_basic.c
+++ b/libgeda/src/a_basic.c
@@ -74,7 +74,7 @@ gchar *o_save_buffer (TOPLEVEL *toplevel)
acc = g_string_new (o_file_format_header());
- buffer = o_save_objects (toplevel->page_current->object_head);
+ buffer = o_save_objects (toplevel->page_current->object_list);
g_string_append (acc, buffer);
g_free (buffer);
@@ -90,18 +90,20 @@ gchar *o_save_buffer (TOPLEVEL *toplevel)
* \param [in] object_list Head of list of objects to save.
* \returns a buffer containing schematic data or NULL on failure.
*/
-gchar *o_save_objects (OBJECT *object_list)
+gchar *o_save_objects (GList *object_list)
{
- OBJECT *o_current = object_list;
+ OBJECT *o_current;
+ GList *iter;
gchar *out;
GString *acc;
gboolean already_wrote = FALSE;
- g_return_val_if_fail ((object_list != NULL), NULL);
-
acc = g_string_new("");
- while ( o_current != NULL ) {
+ iter = object_list;
+
+ while ( iter != NULL ) {
+ o_current = (OBJECT *)iter->data;
if (o_current->type != OBJ_HEAD &&
o_current->attached_to == NULL) {
@@ -195,9 +197,9 @@ gchar *o_save_objects (OBJECT *object_list)
g_string_append(acc, out);
g_free (out);
}
-
}
- o_current = o_current->next;
+
+ iter = g_list_next (iter);
}
return g_string_free (acc, FALSE);
@@ -214,9 +216,9 @@ int o_save(TOPLEVEL *toplevel, const char *filename)
{
FILE *fp;
char *buffer;
-
+
fp = fopen(filename, "wb");
-
+
if (fp == NULL) {
s_log_message(_("o_save: Could not open [%s]\n"), filename);
return 0;
@@ -248,19 +250,19 @@ int o_save(TOPLEVEL *toplevel, const char *filename)
* \param [in] buffer The memory buffer to read from.
* \param [in] size The size of the buffer.
* \param [in] name The name to describe the data with.
- * \return object_list if successful read, or NULL on error.
+ * \return GList of objects if successful read, or NULL on error.
*/
-OBJECT *o_read_buffer(TOPLEVEL *toplevel, OBJECT *object_list,
- char *buffer, const int size,
- const char *name)
+GList *o_read_buffer (TOPLEVEL *toplevel, GList *object_list,
+ char *buffer, const int size,
+ const char *name)
{
char *line = NULL;
TextBuffer *tb = NULL;
char objtype;
- OBJECT *object_list_save=NULL;
- OBJECT *temp_tail=NULL;
- OBJECT *object_before_attr=NULL;
+ GList *object_list_save=NULL;
+ OBJECT *new_obj=NULL;
+ GList *new_obj_list;
unsigned int release_ver;
unsigned int fileformat_ver;
unsigned int current_fileformat_ver;
@@ -278,6 +280,8 @@ OBJECT *o_read_buffer(TOPLEVEL *toplevel, OBJECT *object_list,
tb = s_textbuffer_new (buffer, size);
+ object_list = g_list_reverse (object_list);
+
while (1) {
line = s_textbuffer_next_line(tb);
@@ -302,85 +306,78 @@ OBJECT *o_read_buffer(TOPLEVEL *toplevel, OBJECT *object_list,
switch (objtype) {
case(OBJ_LINE):
- object_list = (OBJECT *) o_line_read(toplevel, object_list, line,
- release_ver, fileformat_ver);
+ new_obj = o_line_read (toplevel, line, release_ver, fileformat_ver);
+ object_list = g_list_prepend (object_list, new_obj);
break;
case(OBJ_NET):
- object_list = (OBJECT *) o_net_read(toplevel, object_list, line,
- release_ver, fileformat_ver);
+ new_obj = o_net_read (toplevel, line, release_ver, fileformat_ver);
+ object_list = g_list_prepend (object_list, new_obj);
break;
case(OBJ_BUS):
- object_list = (OBJECT *) o_bus_read(toplevel, object_list, line,
- release_ver, fileformat_ver);
+ new_obj = o_bus_read (toplevel, line, release_ver, fileformat_ver);
+ object_list = g_list_prepend (object_list, new_obj);
break;
case(OBJ_BOX):
- object_list = (OBJECT *) o_box_read(toplevel, object_list, line,
- release_ver, fileformat_ver);
+ new_obj = o_box_read (toplevel, line, release_ver, fileformat_ver);
+ object_list = g_list_prepend (object_list, new_obj);
break;
-
+
case(OBJ_PICTURE):
- line = g_strdup(line);
- object_list = (OBJECT *) o_picture_read(toplevel, object_list,
- line, tb,
- release_ver, fileformat_ver);
- g_free (line);
+ line = g_strdup (line);
+ new_obj = o_picture_read (toplevel, line, tb, release_ver, fileformat_ver);
+ g_free (line);
+ object_list = g_list_prepend (object_list, new_obj);
break;
-
+
case(OBJ_CIRCLE):
- object_list = (OBJECT *) o_circle_read(toplevel, object_list, line,
- release_ver, fileformat_ver);
+ new_obj = o_circle_read (toplevel, line, release_ver, fileformat_ver);
+ object_list = g_list_prepend (object_list, new_obj);
break;
case(OBJ_COMPLEX):
case(OBJ_PLACEHOLDER):
- object_list = (OBJECT *) o_complex_read(toplevel, object_list, line,
- release_ver, fileformat_ver);
-
- /* this is necessary because complex may add attributes which float */
- /* needed now? */
- object_list = (OBJECT *) return_tail(object_list);
+ new_obj = o_complex_read (toplevel, line, release_ver, fileformat_ver);
+ object_list = g_list_prepend (object_list, new_obj);
/* last_complex is used for verifying symversion attribute */
- last_complex = object_list;
+ last_complex = new_obj;
break;
case(OBJ_TEXT):
- line = g_strdup(line);
- object_list = (OBJECT *) o_text_read(toplevel, object_list,
- line, tb,
- release_ver, fileformat_ver);
- g_free(line);
+ line = g_strdup (line);
+ new_obj = o_text_read (toplevel, line, tb, release_ver, fileformat_ver);
+ g_free (line);
+ object_list = g_list_prepend (object_list, new_obj);
break;
case(OBJ_PATH):
line = g_strdup(line);
- object_list = (OBJECT *) o_path_read(toplevel, object_list, line, tb,
- release_ver, fileformat_ver);
+ new_obj = o_path_read (toplevel, line, tb, release_ver, fileformat_ver);
g_free (line);
+ object_list = g_list_prepend (object_list, new_obj);
break;
case(OBJ_PIN):
- object_list = (OBJECT *) o_pin_read(toplevel, object_list, line,
- release_ver, fileformat_ver);
+ new_obj = o_pin_read (toplevel, line, release_ver, fileformat_ver);
+ object_list = g_list_prepend (object_list, new_obj);
found_pin++;
break;
case(OBJ_ARC):
- object_list = (OBJECT *) o_arc_read(toplevel, object_list, line,
- release_ver, fileformat_ver);
+ new_obj = o_arc_read (toplevel, line, release_ver, fileformat_ver);
+ object_list = g_list_prepend (object_list, new_obj);
break;
case(STARTATTACH_ATTR):
- object_before_attr = object_list;
- /* first is the fp */
- /* 2nd is the object to get the attributes */
- object_list = (OBJECT *) o_read_attribs(toplevel, object_list,
- tb,
- release_ver, fileformat_ver);
+ /* first is the fp */
+ /* 2nd is the object to get the attributes */
+ new_obj_list = o_read_attribs (toplevel, NULL, new_obj, tb, release_ver, fileformat_ver);
+ new_obj_list = g_list_reverse (new_obj_list);
+ object_list = g_list_concat (new_obj_list, object_list);
/* by now we have finished reading all the attributes */
/* did we just finish attaching to a complex object? */
@@ -391,78 +388,76 @@ OBJECT *o_read_buffer(TOPLEVEL *toplevel, OBJECT *object_list,
o_complex_check_symversion(toplevel, last_complex);
last_complex = NULL;
}
-
- /* slots only apply to complex objects */
- if (object_before_attr->type == OBJ_COMPLEX ||
- object_before_attr->type == OBJ_PLACEHOLDER) {
- o_attrib_slot_update(toplevel, object_before_attr);
+
+ /* slots only apply to complex objects */
+ if (new_obj->type == OBJ_COMPLEX ||
+ new_obj->type == OBJ_PLACEHOLDER) {
+ o_attrib_slot_update (toplevel, new_obj);
}
- /* need this? nope */
- /*object_list = return_tail(object_list);*/
- object_before_attr = NULL;
+ new_obj = NULL;
break;
- case(START_EMBEDDED):
-
- if(object_list->type == OBJ_COMPLEX ||
- object_list->type == OBJ_PLACEHOLDER) {
+ case(START_EMBEDDED):
+ new_obj = object_list->data;
+
+ if (new_obj->type == OBJ_COMPLEX ||
+ new_obj->type == OBJ_PLACEHOLDER) {
- object_list_save = object_list;
- object_list = object_list_save->complex->prim_objs;
-
- temp_tail = toplevel->page_current->object_tail;
+ object_list_save = object_list;
+ object_list = new_obj->complex->prim_objs;
- embedded_level++;
- } else {
+ embedded_level++;
+ } else {
fprintf(stderr, _("Read unexpected embedded "
"symbol start marker in [%s] :\n>>\n%s<<\n"),
- name, line);
- }
- break;
-
- case(END_EMBEDDED):
- if(embedded_level>0) {
- object_list = object_list_save;
- /* don't do this since objects are already
- * stored/read translated
- * o_complex_translate_world(toplevel, object_list->x,
- * object_list->y, object_list->complex);
- */
- toplevel->page_current->object_tail = temp_tail;
-
- o_complex_recalc( toplevel, object_list );
- embedded_level--;
- } else {
+ name, line);
+ }
+ break;
+
+ case(END_EMBEDDED):
+ if (embedded_level>0) {
+ /* don't do this since objects are already
+ * stored/read translated
+ * o_complex_translate_world (toplevel, object_list->x,
+ * object_list->y, object_list->complex);
+ */
+
+ new_obj = object_list_save->data;
+ new_obj->complex->prim_objs = object_list;
+ object_list = object_list_save;
+
+ o_recalc_single_object (toplevel, new_obj);
+
+ embedded_level--;
+ } else {
fprintf(stderr, _("Read unexpected embedded "
"symbol end marker in [%s] :\n>>\n%s<<\n"),
- name, line);
- }
-
+ name, line);
+ }
break;
case(ENDATTACH_ATTR):
/* this case is never hit, since the } is consumed by o_read_attribs */
- break;
+ break;
- case(INFO_FONT):
+ case(INFO_FONT):
o_text_set_info_font(line);
- break;
+ break;
case(COMMENT):
- /* do nothing */
+ /* do nothing */
break;
case(VERSION_CHAR):
itemsread = sscanf(line, "v %u %u\n", &release_ver, &fileformat_ver);
- /* 20030921 was the last version which did not have a fileformat */
- /* version. The below latter test should not happen, but it is here */
- /* just in in case. */
- if (release_ver <= VERSION_20030921 || itemsread == 1)
- {
+ /* 20030921 was the last version which did not have a fileformat */
+ /* version. The below latter test should not happen, but it is here */
+ /* just in in case. */
+ if (release_ver <= VERSION_20030921 || itemsread == 1) {
fileformat_ver = 0;
- }
+ }
if (fileformat_ver == 0) {
s_log_message(_("Read an old format sym/sch file!\n"
@@ -489,12 +484,14 @@ OBJECT *o_read_buffer(TOPLEVEL *toplevel, OBJECT *object_list,
if (found_pin) {
if (release_ver <= VERSION_20020825) {
- o_pin_update_whichend(toplevel, return_head(object_list), found_pin);
+ o_pin_update_whichend (toplevel, object_list, found_pin);
}
}
tb = s_textbuffer_free(tb);
-
+
+ object_list = g_list_reverse (object_list);
+
return(object_list);
}
@@ -510,12 +507,12 @@ OBJECT *o_read_buffer(TOPLEVEL *toplevel, OBJECT *object_list,
* NULL to disable error reporting
* \return object_list if successful read, or NULL on error.
*/
-OBJECT *o_read(TOPLEVEL *toplevel, OBJECT *object_list, char *filename,
+GList *o_read (TOPLEVEL *toplevel, GList *object_list, char *filename,
GError **err)
{
char *buffer = NULL;
size_t size;
- OBJECT *result = NULL;
+ GList *result;
/* Return NULL if error reporting is enabled and the return location
* for an error isn't NULL. */
@@ -546,23 +543,25 @@ OBJECT *o_read(TOPLEVEL *toplevel, OBJECT *object_list, char *filename,
* stuff
* move it to o_complex_scale
*/
-void o_scale(TOPLEVEL *toplevel, OBJECT *list, int x_scale, int y_scale)
+void o_scale (TOPLEVEL *toplevel, GList *list, int x_scale, int y_scale)
{
OBJECT *o_current;
+ GList *iter;
/* this is okay if you just hit scale and have nothing selected */
if (list == NULL) {
return;
}
- o_current = list;
- while (o_current != NULL) {
+ iter = list;
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
switch(o_current->type) {
case(OBJ_LINE):
o_line_scale_world(toplevel, x_scale, y_scale, o_current);
break;
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
}
diff --git a/libgeda/src/f_basic.c b/libgeda/src/f_basic.c
index 643e91d..382bd2f 100644
--- a/libgeda/src/f_basic.c
+++ b/libgeda/src/f_basic.c
@@ -284,12 +284,12 @@ int f_open_flags(TOPLEVEL *toplevel, const gchar *filename,
* the RC file, it's time to read in the file. */
if (load_backup_file == 1) {
/* Load the backup file */
- o_read (toplevel, toplevel->page_current->object_tail,
- backup_filename, &tmp_err);
+ toplevel->page_current->object_list = o_read (toplevel, NULL,
+ backup_filename, &tmp_err);
} else {
/* Load the original file */
- o_read (toplevel, toplevel->page_current->object_tail,
- full_filename, &tmp_err);
+ toplevel->page_current->object_list = o_read (toplevel, NULL,
+ full_filename, &tmp_err);
}
if (tmp_err == NULL)
@@ -297,9 +297,6 @@ int f_open_flags(TOPLEVEL *toplevel, const gchar *filename,
else
g_propagate_error (err, tmp_err);
- toplevel->page_current->object_tail =
- return_tail(toplevel->page_current->object_head);
-
/* make sure you init net_consolide to false (default) in all */
/* programs */
if (toplevel->net_consolidate == TRUE) {
diff --git a/libgeda/src/f_print.c b/libgeda/src/f_print.c
index fb83db8..a797f82 100644
--- a/libgeda/src/f_print.c
+++ b/libgeda/src/f_print.c
@@ -36,7 +36,7 @@
*/
GHashTable *unicode_char_to_glyph = NULL;
-static int f_print_get_unicode_chars(TOPLEVEL * toplevel, OBJECT * head,
+static int f_print_get_unicode_chars (TOPLEVEL * toplevel, GList *obj_list,
int count, gunichar * table);
static void f_print_unicode_map(FILE * fp, int count, gunichar * table);
@@ -211,7 +211,7 @@ void f_print_footer(FILE *fp)
*
* \param [in] toplevel The current TOPLEVEL object.
* \param [in] fp The postscript document to print to.
- * \param [in] head Container for objects to be printed.
+ * \param [in] obj_list List of objects to be printed.
* \param [in] start_x X origin on page to start printing objects.
* \param [in] start_y Y origin on page to start printing objects.
* \param [in] scale Scale factor for object output.
@@ -221,17 +221,18 @@ void f_print_footer(FILE *fp)
*
* \todo what happens if snap is off? hack deal with this !!!!!!!!
*/
-void f_print_objects(TOPLEVEL *toplevel, FILE *fp, OBJECT *head,
+void f_print_objects (TOPLEVEL *toplevel, FILE *fp, GList *obj_list,
int start_x, int start_y, float scale,
int unicode_count, gunichar *unicode_table)
{
OBJECT *o_current=NULL;
int origin_x, origin_y;
+ GList *iter;
origin_x = start_x;
origin_y = start_y;
- if (head == NULL) {
+ if (obj_list == NULL) {
return;
}
@@ -246,9 +247,10 @@ void f_print_objects(TOPLEVEL *toplevel, FILE *fp, OBJECT *head,
origin_x = 0;
origin_y = 0;
- o_current = head;
+ iter = obj_list;
- while ( o_current != NULL ) {
+ while ( iter != NULL ) {
+ o_current = (OBJECT *)iter->data;
if (o_current->type != OBJ_HEAD) {
@@ -353,11 +355,11 @@ void f_print_objects(TOPLEVEL *toplevel, FILE *fp, OBJECT *head,
break;
}
- }
- o_current = o_current->next;
+ }
+ iter = g_list_next (iter);
}
- s_cue_output_all(toplevel, head, fp, POSTSCRIPT);
+ s_cue_output_all (toplevel, obj_list, fp, POSTSCRIPT);
return;
}
@@ -449,15 +451,15 @@ int f_print_stream(TOPLEVEL *toplevel, FILE *fp)
/* Find all the unicode characters */
unicode_count = f_print_get_unicode_chars(toplevel,
- toplevel->page_current->object_head,
+ toplevel->page_current->object_list,
0, unicode_table);
/* printf("%d %d\n", toplevel->paper_width, toplevel->paper_height);*/
- world_get_object_list_bounds(toplevel,
- toplevel->page_current->object_head,
- &origin_x, &origin_y,
- &right, &bottom);
+ world_get_object_glist_bounds (toplevel,
+ toplevel->page_current->object_list,
+ &origin_x, &origin_y,
+ &right, &bottom);
/* Calculate scale factor that will make the image fit on the page */
dx = 0; dy = 0;
@@ -613,9 +615,8 @@ int f_print_stream(TOPLEVEL *toplevel, FILE *fp)
scale, scale);
/* Print the objects */
- f_print_objects(toplevel, fp,
- toplevel->page_current->object_head,
- origin_x, origin_y, scale, unicode_count, unicode_table);
+ f_print_objects (toplevel, fp, toplevel->page_current->object_list,
+ origin_x, origin_y, scale, unicode_count, unicode_table);
f_print_footer(fp);
@@ -640,26 +641,24 @@ void f_print_set_type(TOPLEVEL *toplevel, int type)
*
* \param [in,out] toplevel The output TOPLEVEL element to store converted
* strings in.
- * \param [in] head The object containing strings for conversion.
+ * \param [in] obj_list The object containing strings for conversion.
* \param [in] count The number of elements in the unicode table.
* \param [in] table The unicode table.
* \return count on success, 0 otherwise.
*/
-static int f_print_get_unicode_chars(TOPLEVEL *toplevel, OBJECT *head,
+static int f_print_get_unicode_chars (TOPLEVEL *toplevel, GList *obj_list,
int count, gunichar *table)
{
OBJECT *o_current = NULL;
gchar *aux;
gunichar current_char;
int i, found;
+ GList *iter;
- if (head == NULL) {
- return(0);
- }
-
- o_current = head;
+ iter = obj_list;
- while (o_current != NULL) {
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
if (o_current->type != OBJ_HEAD) {
@@ -703,7 +702,7 @@ static int f_print_get_unicode_chars(TOPLEVEL *toplevel, OBJECT *head,
break;
}
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
return (count);
}
diff --git a/libgeda/src/o_arc_basic.c b/libgeda/src/o_arc_basic.c
index 2d25f65..18a0ead 100644
--- a/libgeda/src/o_arc_basic.c
+++ b/libgeda/src/o_arc_basic.c
@@ -221,7 +221,7 @@ void o_arc_modify(TOPLEVEL *toplevel, OBJECT *object,
* \par Function Description
* This function reads a formatted text buffer describing an arc
* in the gEDA file format and initializes the corresponding object.
- * This arc is linked to the end of the <B>object_list</B> pointed list.
+ *
* Depending on the version of the file format the data extraction is
* performed differently : currently pre-20000704 and 20000704 on one
* hand and post-20000704 file format version on the other hand are supported.
@@ -238,13 +238,12 @@ void o_arc_modify(TOPLEVEL *toplevel, OBJECT *object,
* A negative or null radius is not allowed.
*
* \param [in] toplevel The TOPLEVEL object.
- * \param [in] object_list
* \param [in] buf
* \param [in] release_ver
* \param [in] fileformat_ver
* \return
*/
-OBJECT *o_arc_read(TOPLEVEL *toplevel, OBJECT *object_list, char buf[],
+OBJECT *o_arc_read (TOPLEVEL *toplevel, char buf[],
unsigned int release_ver, unsigned int fileformat_ver)
{
OBJECT *new_obj;
@@ -300,9 +299,7 @@ OBJECT *o_arc_read(TOPLEVEL *toplevel, OBJECT *object_list, char buf[],
FILLING_HOLLOW, -1, -1, -1,
-1, -1);
- object_list = s_basic_link_object(new_obj, object_list);
-
- return(object_list);
+ return new_obj;
}
/*! \brief
diff --git a/libgeda/src/o_attrib.c b/libgeda/src/o_attrib.c
index 86a90cc..e612ac4 100644
--- a/libgeda/src/o_attrib.c
+++ b/libgeda/src/o_attrib.c
@@ -289,25 +289,28 @@ void o_attrib_remove(GList **list, OBJECT *remove)
* \par Function Description
* Read attributes from a TextBuffer.
*
- * \param [in] toplevel The TOPLEVEL object.
- * \param [out] object_to_get_attribs Storage for attributes.
+ * \param [in] toplevel The TOPLEVEL object.
+ * \param [out] list Storage for attributes.
+ * \param [in] object_to_get_attribs Object which gets these attribs.
* \param [in] tb The text buffer to read from.
* \param [in] release_ver libgeda release version number.
* \param [in] fileformat_ver file format version number.
- * \return Pointer to object_to_get_attribs.
+ * \return GList of attributes read.
*/
-OBJECT *o_read_attribs(TOPLEVEL *toplevel,
- OBJECT *object_to_get_attribs,
- TextBuffer *tb,
- unsigned int release_ver, unsigned int fileformat_ver)
+GList *o_read_attribs (TOPLEVEL *toplevel,
+ GList *list,
+ OBJECT *object_to_get_attribs,
+ TextBuffer *tb,
+ unsigned int release_ver, unsigned int fileformat_ver)
{
- OBJECT *object_list=NULL;
+ GList *object_list;
+ OBJECT *new_obj;
char *line = NULL;
char objtype;
int ATTACH=FALSE;
int saved_color = -1;
- object_list = object_to_get_attribs;
+ object_list = g_list_reverse (list);
while (1) {
@@ -318,110 +321,79 @@ OBJECT *o_read_attribs(TOPLEVEL *toplevel,
switch (objtype) {
case(OBJ_LINE):
- object_list = (OBJECT *) o_line_read(toplevel,
- object_list,
- line,
- release_ver, fileformat_ver);
+ new_obj = o_line_read (toplevel, line, release_ver, fileformat_ver);
+ object_list = g_list_prepend (object_list, new_obj);
break;
case(OBJ_NET):
- object_list = (OBJECT *) o_net_read(toplevel,
- object_list,
- line,
- release_ver, fileformat_ver);
+ new_obj = o_net_read (toplevel, line, release_ver, fileformat_ver);
+ object_list = g_list_prepend (object_list, new_obj);
break;
case(OBJ_BUS):
- object_list = (OBJECT *) o_bus_read(toplevel,
- object_list,
- line,
- release_ver, fileformat_ver);
+ new_obj = o_bus_read (toplevel, line, release_ver, fileformat_ver);
+ object_list = g_list_prepend (object_list, new_obj);
break;
case(OBJ_BOX):
- object_list = (OBJECT *) o_box_read(toplevel,
- object_list,
- line,
- release_ver, fileformat_ver);
+ new_obj = o_box_read (toplevel, line, release_ver, fileformat_ver);
+ object_list = g_list_prepend (object_list, new_obj);
break;
-
+
case(OBJ_CIRCLE):
- object_list = (OBJECT *) o_circle_read(
- toplevel,
- object_list,
- line,
- release_ver, fileformat_ver);
+ new_obj = o_circle_read (toplevel, line, release_ver, fileformat_ver);
+ object_list = g_list_prepend (object_list, new_obj);
break;
case(OBJ_COMPLEX):
case(OBJ_PLACEHOLDER):
-
- object_list = (OBJECT *) o_complex_read(
- toplevel,
- object_list,
- line,
- release_ver, fileformat_ver);
-
- /* this is necessary because complex may add
- attributes which float */
- /* still needed? */
- object_list = (OBJECT *) return_tail(
- object_list);
+ new_obj = o_complex_read (toplevel, line, release_ver, fileformat_ver);
+ object_list = g_list_prepend (object_list, new_obj);
break;
case(OBJ_PATH):
line = g_strdup (line);
- object_list = (OBJECT *) o_path_read(toplevel,
- object_list,
- line, tb,
- release_ver, fileformat_ver);
+ new_obj = o_path_read (toplevel, line, tb, release_ver, fileformat_ver);
g_free (line);
+ object_list = g_list_prepend (object_list, new_obj);
break;
case(OBJ_PIN):
- object_list = (OBJECT *) o_pin_read(toplevel,
- object_list,
- line,
- release_ver, fileformat_ver);
+ new_obj = o_pin_read (toplevel, line, release_ver, fileformat_ver);
+ object_list = g_list_prepend (object_list, new_obj);
break;
case(OBJ_ARC):
- object_list = (OBJECT *) o_arc_read(toplevel,
- object_list,
- line,
- release_ver, fileformat_ver);
+ new_obj = o_arc_read (toplevel, line, release_ver, fileformat_ver);
+ object_list = g_list_prepend (object_list, new_obj);
break;
case(OBJ_TEXT):
- line = g_strdup (line);
- object_list = (OBJECT *) o_text_read(toplevel,
- object_list,
- line,
- tb,
- release_ver, fileformat_ver);
- g_free (line);
- saved_color = object_list->color;
+ line = g_strdup (line);
+ new_obj = o_text_read (toplevel, line, tb, release_ver, fileformat_ver);
+ g_free (line);
+ saved_color = new_obj->color;
+ object_list = g_list_prepend (object_list, new_obj);
ATTACH=TRUE;
-
+
break;
case(ENDATTACH_ATTR):
+ object_list = g_list_reverse (object_list);
return(object_list);
- break;
+ break;
}
if (ATTACH) {
- o_attrib_attach(toplevel, object_list, object_to_get_attribs);
+ o_attrib_attach (toplevel, new_obj, object_to_get_attribs);
/* check color to set it to the right value */
- if (object_list->color != saved_color) {
- object_list->color = saved_color;
+ if (new_obj->color != saved_color) {
+ new_obj->color = saved_color;
- if (object_list->type == OBJ_TEXT) {
- o_complex_set_color(
- object_list->text->prim_objs,
- object_list->color);
+ if (new_obj->type == OBJ_TEXT) {
+ o_complex_set_color (new_obj->text->prim_objs, new_obj->color);
} else {
printf("Tried to set the color on a complex in libgeda/src/o_read_attribs\n");
}
@@ -431,6 +403,7 @@ OBJECT *o_read_attribs(TOPLEVEL *toplevel,
fprintf(stderr, "Tried to attach a non-text item as an attribute\n");
}
}
+ object_list = g_list_reverse (object_list);
return(object_list);
}
@@ -637,13 +610,13 @@ void o_attrib_set_color(TOPLEVEL *toplevel, GList *attributes)
* Search for attribute by name.
*
* \warning
- * The list is the top level list. Do not pass it an object_head list
+ * The list is the top level list. Do not pass it an object_list list
* unless you know what you are doing.
*
* Counter is the n'th occurance of the attribute, and starts searching
* from zero. Zero is the first occurance of an attribute.
*
- * \param [in] list OBJECT list to search.
+ * \param [in] list GList to search.
* \param [in] name Character string with attribute name to search for.
* \param [in] counter Which occurance to return.
* \return Character string with attribute value, NULL otherwise.
@@ -651,7 +624,7 @@ void o_attrib_set_color(TOPLEVEL *toplevel, GList *attributes)
* \warning
* Caller must g_free returned character string.
*/
-char *o_attrib_search_name(OBJECT *list, char *name, int counter)
+char *o_attrib_search_name (GList *list, char *name, int counter)
{
OBJECT *o_current;
OBJECT *a_current;
@@ -661,10 +634,12 @@ char *o_attrib_search_name(OBJECT *list, char *name, int counter)
char *found_name = NULL;
char *found_value = NULL;
char *return_string = NULL;
+ GList *iter;
- o_current = list;
+ iter = list;
- while(o_current != NULL) {
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
if (o_current->attribs != NULL) {
a_iter = o_current->attribs;
while(a_iter != NULL) {
@@ -721,7 +696,7 @@ char *o_attrib_search_name(OBJECT *list, char *name, int counter)
}
}
- o_current=o_current->next;
+ iter = g_list_next (iter);
}
g_free(found_name);
@@ -744,22 +719,24 @@ char *o_attrib_search_name(OBJECT *list, char *name, int counter)
* iterates to the next OBJECT.
*
* \warning
- * The list is the top level list. Do not pass it an object_head list
+ * The list is the top level list. Do not pass it an object_list list
* unless you know what you are doing.
*
* \param [in] list OBJECT list to search.
* \param [in] string Character string to search for.
* \return A matching OBJECT if found, NULL otherwise.
*/
-OBJECT *o_attrib_search_string_list(OBJECT *list, char *string)
+OBJECT *o_attrib_search_string_list (GList *list, char *string)
{
OBJECT *o_current;
OBJECT *a_current;
GList *a_iter;
+ GList *o_iter;
- o_current = list;
+ o_iter = list;
- while(o_current != NULL) {
+ while (o_iter != NULL) {
+ o_current = o_iter->data;
/* first search attribute list */
if (o_current->attribs != NULL) {
a_iter = o_current->attribs;
@@ -786,7 +763,7 @@ OBJECT *o_attrib_search_string_list(OBJECT *list, char *string)
}
}
- o_current=o_current->next;
+ o_iter = g_list_next (o_iter);
}
return (NULL);
@@ -1036,13 +1013,13 @@ o_attrib_search_attrib_name(GList *list, char *name, int counter)
* \par Function Description
* This function should only be used to search for TOPLEVEL attributes.
* \warning
- * The list is the top level list. Do not pass it an object_head list
+ * The list is the top level list. Do not pass it an object_list list
* unless you know what you are doing.
*
* Counter is the n'th occurance of the attribute, and starts searching
* from zero. Zero is the first occurance of an attribute.
*
- * \param [in] list The OBJECT list to search (TOPLEVEL only).
+ * \param [in] list The GList to search (TOPLEVEL only).
* \param [in] name Character string of attribute name to search for.
* \param [in] counter Which occurance to return.
* \return Character string with attribute value, NULL otherwise.
@@ -1050,7 +1027,7 @@ o_attrib_search_attrib_name(GList *list, char *name, int counter)
* \warning
* Caller must g_free returned character string.
*/
-char *o_attrib_search_toplevel(OBJECT *list, char *name, int counter)
+char *o_attrib_search_toplevel (GList *list, char *name, int counter)
{
OBJECT *o_current;
int val;
@@ -1058,10 +1035,12 @@ char *o_attrib_search_toplevel(OBJECT *list, char *name, int counter)
char *found_name = NULL;
char *found_value = NULL;
char *return_string = NULL;
+ GList *iter;
- o_current = list;
+ iter = list;
- while(o_current != NULL) {
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
/* search for attributes outside */
@@ -1084,7 +1063,7 @@ char *o_attrib_search_toplevel(OBJECT *list, char *name, int counter)
}
}
- o_current=o_current->next;
+ iter = g_list_next (iter);
}
g_free(found_name);
@@ -1371,11 +1350,11 @@ char *o_attrib_search_default_slot(OBJECT *object)
* and a pinnumber,
* search for and return pinseq= attrib (object).
*
- * \param [in] list OBJECT list to search.
+ * \param [in] list GList list to search.
* \param [in] pin_number pin number to search for.
* \return OBJECT containing pinseq data, NULL otherwise.
*/
-OBJECT *o_attrib_search_pinseq(OBJECT *list, int pin_number)
+OBJECT *o_attrib_search_pinseq (GList *list, int pin_number)
{
OBJECT *pinseq_text_object;
char *search_for;
@@ -1407,19 +1386,21 @@ char *o_attrib_search_slotdef(OBJECT *object, int slotnumber)
char *return_value=NULL;
char *search_for=NULL;
OBJECT *o_current;
+ GList *iter;
search_for = g_strdup_printf ("slotdef=%d:", slotnumber);
- o_current = object->complex->prim_objs;
- while (o_current != NULL) {
+ iter = object->complex->prim_objs;
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
return_value = o_attrib_search_string_partial(o_current, search_for, 0);
if (return_value) {
- break;
+ break;
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
g_free(search_for);
-
+
if (return_value) {
return(return_value);
}
@@ -1700,9 +1681,7 @@ char *o_attrib_search_toplevel_all(GedaPageList *page_list, char *name)
p_current = (PAGE *)iter->data;
/* only look for first occurrance of the attribute */
- ret_value = o_attrib_search_toplevel(
- p_current->object_head,
- name, 0);
+ ret_value = o_attrib_search_toplevel (p_current->object_list, name, 0);
if (ret_value != NULL) {
return(ret_value);
diff --git a/libgeda/src/o_basic.c b/libgeda/src/o_basic.c
index a7c35dd..27214ce 100644
--- a/libgeda/src/o_basic.c
+++ b/libgeda/src/o_basic.c
@@ -138,27 +138,7 @@ void o_recalc_single_object(TOPLEVEL *toplevel, OBJECT *o_current)
}
}
-/*! \brief Recalculate position of a list of objects.
- * \par Function Description
- * This function will take a list of objects and recalculate their
- * positions on the screen.
- *
- * \param [in] toplevel The TOPLEVEL object.
- * \param [in,out] object_list OBJECT list to recalculate.
- *
- */
-void
-o_recalc_object_list(TOPLEVEL *toplevel, OBJECT *object_list)
-{
- OBJECT *o_current;
- o_current = object_list;
- while (o_current != NULL) {
- o_recalc_single_object(toplevel, o_current);
- o_current = o_current->next;
- }
-}
-
/*! \brief Recalculate position of a list (GList) of objects.
* \par Function Description
* This function will take a list (GList) of objects and recalculate their
diff --git a/libgeda/src/o_box_basic.c b/libgeda/src/o_box_basic.c
index 566aecb..0851a2a 100644
--- a/libgeda/src/o_box_basic.c
+++ b/libgeda/src/o_box_basic.c
@@ -223,8 +223,7 @@ void o_box_modify(TOPLEVEL *toplevel, OBJECT *object,
/*! \brief Create a box from a character string.
* \par Function Description
* This function gets the description of a box from the <B>*buf</B> character
- * string. The new box is then added to the list of object of which
- * <B>*object_list</B> is the last element before the call.
+ * string.
*
* Depending on <B>*version</B>, the correct file format is considered.
* Currently two file format revisions are supported :
@@ -234,19 +233,18 @@ void o_box_modify(TOPLEVEL *toplevel, OBJECT *object,
* </DL>
*
* \param [in] toplevel The TOPLEVEL object.
- * \param [in,out] object_list BOX OBJECT list to add new BOX to.
* \param [in] buf Character string with box description.
* \param [in] release_ver libgeda release version number.
* \param [in] fileformat_ver libgeda file format version number.
* \return The BOX OBJECT that was created.
*/
-OBJECT *o_box_read (TOPLEVEL *toplevel, OBJECT *object_list, char buf[],
+OBJECT *o_box_read (TOPLEVEL *toplevel, char buf[],
unsigned int release_ver, unsigned int fileformat_ver)
{
OBJECT *new_obj;
- char type;
+ char type;
int x1, y1;
- int width, height;
+ int width, height;
int d_x1, d_y1;
int d_x2, d_y2;
int color;
@@ -333,9 +331,8 @@ OBJECT *o_box_read (TOPLEVEL *toplevel, OBJECT *object_list, char buf[],
o_set_fill_options (toplevel, new_obj,
box_filling, fill_width,
pitch1, angle1, pitch2, angle2);
- /* Add the box to the object list */
- object_list = s_basic_link_object (new_obj, object_list);
- return object_list;
+
+ return new_obj;
}
/*! \brief Create a character string representation of a BOX.
diff --git a/libgeda/src/o_bus_basic.c b/libgeda/src/o_bus_basic.c
index 7793276..82e0369 100644
--- a/libgeda/src/o_bus_basic.c
+++ b/libgeda/src/o_bus_basic.c
@@ -142,7 +142,7 @@ void o_bus_recalc(TOPLEVEL *toplevel, OBJECT *o_current)
* \param [in] fileformat_ver a integer value of the file format
* \return The object list
*/
-OBJECT *o_bus_read (TOPLEVEL *toplevel, OBJECT *object_list, char buf[],
+OBJECT *o_bus_read (TOPLEVEL *toplevel, char buf[],
unsigned int release_ver, unsigned int fileformat_ver)
{
OBJECT *new_obj;
@@ -183,9 +183,7 @@ OBJECT *o_bus_read (TOPLEVEL *toplevel, OBJECT *object_list, char buf[],
new_obj = o_bus_new (toplevel, type, color, x1, y1, x2, y2, ripper_dir);
- object_list = s_basic_link_object (new_obj, object_list);
-
- return object_list;
+ return new_obj;
}
/*! \brief Create a string representation of the bus object
diff --git a/libgeda/src/o_circle_basic.c b/libgeda/src/o_circle_basic.c
index 9693e8b..53d5e6b 100644
--- a/libgeda/src/o_circle_basic.c
+++ b/libgeda/src/o_circle_basic.c
@@ -218,8 +218,7 @@ void o_circle_modify(TOPLEVEL *toplevel, OBJECT *object,
/*! \brief Create circle OBJECT from character string.
* \par Function Description
* The #o_circle_read() function gets from the character string <B>*buff</B> the
- * description of a circle. The new circle is then added to the list of
- * objects of which <B>*object_list</B> is the last element before the call.
+ * description of a circle.
*
* Depending on <B>*version</B>, the right file format is considered.
* Currently two file format revisions are supported :
@@ -229,13 +228,12 @@ void o_circle_modify(TOPLEVEL *toplevel, OBJECT *object,
* </DL>
*
* \param [in] toplevel The TOPLEVEL object.
- * \param [out] object_list OBJECT list to create circle in.
* \param [in] buf Character string with circle description.
* \param [in] release_ver libgeda release version number.
* \param [in] fileformat_ver libgeda file format version number.
* \return A pointer to the new circle object.
*/
-OBJECT *o_circle_read(TOPLEVEL *toplevel, OBJECT *object_list, char buf[],
+OBJECT *o_circle_read (TOPLEVEL *toplevel, char buf[],
unsigned int release_ver, unsigned int fileformat_ver)
{
OBJECT *new_obj;
@@ -311,9 +309,7 @@ OBJECT *o_circle_read(TOPLEVEL *toplevel, OBJECT *object_list, char buf[],
o_set_fill_options(toplevel, new_obj,
circle_fill, fill_width, pitch1, angle1, pitch2, angle2);
- object_list = s_basic_link_object(new_obj, object_list);
-
- return(object_list);
+ return new_obj;
}
/*! \brief Create a character string representation of a circle OBJECT.
diff --git a/libgeda/src/o_complex_basic.c b/libgeda/src/o_complex_basic.c
index b33fd0b..d6a2518 100644
--- a/libgeda/src/o_complex_basic.c
+++ b/libgeda/src/o_complex_basic.c
@@ -99,48 +99,6 @@ int world_get_single_object_bounds(TOPLEVEL *toplevel, OBJECT *o_current,
return 0;
}
-/*! \brief Return the bounds of the given list of objects.
- * \par Given a list of objects, calcule the bounds coordinates.
- * \param [in] toplevel The toplevel structure.
- * \param [in] complex The list of objects to look the bounds for.
- * \param [out] left pointer to the left coordinate of the object.
- * \param [out] top pointer to the top coordinate of the object.
- * \param [out] right pointer to the right coordinate of the object.
- * \param [out] bottom pointer to the bottom coordinate of the object.
- * \return If any bounds were found for the list of objects
- * \retval 0 No bounds were found
- * \retval 1 Bound was found
- */
-int
-world_get_object_list_bounds(TOPLEVEL *toplevel, OBJECT *complex,
- int *left, int *top, int *right, int *bottom)
-{
- OBJECT *o_current=NULL;
- int rleft, rtop, rright, rbottom;
- int found = 0;
-
- o_current = complex;
-
- // Find the first object with bounds, and set the bounds variables, then expand as necessary
- while ( o_current != NULL ) {
- if ( world_get_single_object_bounds( toplevel, o_current, &rleft, &rtop, &rright, &rbottom) ) {
- if ( found ) {
- *left = min( *left, rleft );
- *top = min( *top, rtop );
- *right = max( *right, rright );
- *bottom = max( *bottom, rbottom );
- } else {
- *left = rleft;
- *top = rtop;
- *right = rright;
- *bottom = rbottom;
- found = 1;
- }
- }
- o_current = o_current->next;
- }
- return found;
-}
/*! \brief Return the bounds of the given GList of objects.
* \par Given a list of objects, calcule the bounds coordinates.
@@ -211,25 +169,8 @@ void world_get_complex_bounds(TOPLEVEL *toplevel, OBJECT *complex,
complex->type == OBJ_PLACEHOLDER) &&
complex->complex != NULL);
- world_get_object_list_bounds (toplevel, complex->complex->prim_objs->next,
- left, top, right, bottom);
-
-}
-
-/*! \brief create a new head object
- * \par Function Description
- * This function creates a <b>complex_head</b> OBJECT. This OBJECT
- * is just a special empty object. This object is never modified.
- *
- * \return new head OBJECT
- */
-OBJECT *new_head ()
-{
- OBJECT *new_node=NULL;
-
- new_node = s_basic_new_object(OBJ_HEAD, "complex_head");
-
- return new_node;
+ world_get_object_glist_bounds (toplevel, complex->complex->prim_objs,
+ left, top, right, bottom);
}
/*! \brief check whether an object is a attributes
@@ -305,26 +246,26 @@ int o_complex_is_embedded(OBJECT *o_current)
* \param [in] o_head The head of the object list
* \returns A GList of attribute OBJECTs
*/
-GList *o_complex_get_toplevel_attribs (TOPLEVEL *toplevel, OBJECT *o_head)
+GList *o_complex_get_toplevel_attribs (TOPLEVEL *toplevel, GList *obj_list)
{
OBJECT *o_current;
- GList *o_list = NULL;
+ GList *attr_list = NULL;
+ GList *iter;
- for (o_current = o_head;
- o_current != NULL;
- o_current = o_current->next) {
+ for (iter = obj_list; iter != NULL; iter = g_list_next (iter)) {
+ o_current = iter->data;
if (o_current->type == OBJ_TEXT &&
o_current->attached_to == NULL &&
o_attrib_get_name_value (o_current->text->string, NULL, NULL)) {
- o_list = g_list_prepend (o_list, o_current);
+ attr_list = g_list_prepend (attr_list, o_current);
}
}
- o_list = g_list_reverse (o_list);
+ attr_list = g_list_reverse (attr_list);
- return o_list;
+ return attr_list;
}
@@ -367,13 +308,9 @@ GList *o_complex_get_promotable (TOPLEVEL *toplevel, OBJECT *object, int detach)
continue;
if (detach) {
- /* Remove and isolate it from the complex list */
- if (tmp->next)
- tmp->next->prev = tmp->prev;
- if (tmp->prev)
- tmp->prev->next = tmp->next;
- tmp->next = tmp->prev = NULL;
tmp->complex_parent = NULL;
+ object->complex->prim_objs =
+ g_list_remove (object->complex->prim_objs, tmp);
}
promoted = g_list_prepend (promoted, tmp);
@@ -394,33 +331,24 @@ GList *o_complex_get_promotable (TOPLEVEL *toplevel, OBJECT *object, int detach)
*
* \param [in] toplevel The toplevel environment.
* \param [in] object The complex object who's attributes are being promtoed.
+ * \param [in] obj_list The object list which recieves the new objects
+ * \returns The start
*/
-void o_complex_promote_attribs (TOPLEVEL *toplevel, OBJECT *object)
+void o_complex_promote_attribs (TOPLEVEL *toplevel, OBJECT *object,
+ GList **obj_list)
{
- GList *promoted;
- OBJECT *first_promoted, *last_promoted;
+ GList *promoted, *last;
promoted = o_complex_get_promotable (toplevel, object, TRUE);
- if (promoted == NULL)
- return;
-
- /* Link the promoted OBJECTs together */
- o_glist_relink_objects (promoted);
-
- first_promoted = promoted->data;
- last_promoted = g_list_last (promoted)->data;
-
- /* Insert promoted attributes before the complex in the object list */
- first_promoted->prev = object->prev;
- object->prev->next = first_promoted;
- last_promoted->next = object;
- object->prev = last_promoted;
-
/* Attach promoted attributes to the original complex object */
o_attrib_attach_list (toplevel, promoted, object);
- g_list_free (promoted);
+ /* Insert the promoted attributes before the tail of the object list */
+ last = g_list_last (*obj_list);
+ *obj_list = g_list_remove_link (*obj_list, last);
+ *obj_list = g_list_concat (*obj_list, promoted);
+ *obj_list = g_list_concat (*obj_list, last);
}
@@ -474,16 +402,15 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
int selectable)
{
OBJECT *new_node=NULL;
- OBJECT *prim_objs=NULL;
OBJECT *new_prim_obj;
- OBJECT *tmp;
+ GList *prim_objs;
+ GList *iter;
int save_adding_sel = 0;
int loaded_normally = FALSE;
gchar *buffer;
new_node = s_basic_new_object(type, "complex");
- new_node->type = type;
if (clib != NULL) {
new_node->complex_basename = g_strdup (s_clib_symbol_get_name (clib));
@@ -493,27 +420,23 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
new_node->complex_embedded = FALSE;
-
new_node->color = color;
-
+
new_node->complex = (COMPLEX *) g_malloc(sizeof(COMPLEX));
-
new_node->complex->angle = angle;
new_node->complex->mirror = mirror;
-
new_node->complex->x = x;
new_node->complex->y = y;
- new_node->draw_func = complex_draw_func;
+ new_node->draw_func = complex_draw_func;
- if (selectable) {
+ if (selectable) {
new_node->sel_func = select_func;
} else {
new_node->sel_func = NULL;
}
- /* this was at the beginning and p_complex was = to complex */
- prim_objs = new_head ();
+ prim_objs = NULL;
/* get the symbol data */
if (clib != NULL) {
@@ -525,7 +448,6 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
if (clib == NULL || buffer == NULL) {
- OBJECT *save_prim_objs;
char *not_found_text = NULL;
int left, right, top, bottom;
int x_offset, y_offset;
@@ -533,9 +455,6 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
/* filename was NOT found */
loaded_normally = FALSE;
- /* save the prim_objs pointer, since the following code modifies it */
- save_prim_objs = prim_objs;
-
/* Put placeholder into object list. Changed by SDB on
* 1.19.2005 to fix problem that symbols were silently
* deleted by gattrib when RC files were messed up. */
@@ -545,11 +464,11 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
new_prim_obj = o_line_new(toplevel, OBJ_LINE,
DETACHED_ATTRIBUTE_COLOR,
x - 50, y, x + 50, y);
- prim_objs = s_basic_link_object(new_prim_obj, prim_objs);
+ prim_objs = g_list_append (prim_objs, new_prim_obj);
new_prim_obj = o_line_new(toplevel, OBJ_LINE,
DETACHED_ATTRIBUTE_COLOR,
x, y + 50, x, y - 50);
- prim_objs = s_basic_link_object(new_prim_obj, prim_objs);
+ prim_objs = g_list_append (prim_objs, new_prim_obj);
/* Add some useful text */
not_found_text =
@@ -561,13 +480,12 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
y + NOT_FOUND_TEXT_Y, LOWER_LEFT, 0,
not_found_text, 8,
VISIBLE, SHOW_NAME_VALUE);
- prim_objs = s_basic_link_object(new_prim_obj, prim_objs);
+ prim_objs = g_list_append (prim_objs, new_prim_obj);
g_free(not_found_text);
/* figure out where to put the hazard triangle */
- world_get_text_bounds(toplevel, prim_objs,
- &left, &top, &right, &bottom);
- x_offset = (right - left) / 4;
+ world_get_text_bounds (toplevel, new_prim_obj, &left, &top, &right, &bottom);
+ x_offset = (right - left) / 4;
y_offset = bottom - top + 100; /* 100 is just an additional offset */
/* add hazard triangle */
@@ -579,7 +497,7 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
y + NOT_FOUND_TEXT_Y + y_offset);
o_set_line_options(toplevel, new_prim_obj, END_ROUND, TYPE_SOLID,
50, -1, -1);
- prim_objs = s_basic_link_object(new_prim_obj, prim_objs);
+ prim_objs = g_list_append (prim_objs, new_prim_obj);
new_prim_obj = o_line_new(toplevel, OBJ_LINE,
DETACHED_ATTRIBUTE_COLOR,
x + NOT_FOUND_TEXT_X + x_offset,
@@ -588,7 +506,7 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
y + NOT_FOUND_TEXT_Y + y_offset + 500);
o_set_line_options(toplevel, new_prim_obj, END_ROUND, TYPE_SOLID,
50, -1, -1);
- prim_objs = s_basic_link_object(new_prim_obj, prim_objs);
+ prim_objs = g_list_append (prim_objs, new_prim_obj);
new_prim_obj = o_line_new(toplevel, OBJ_LINE,
DETACHED_ATTRIBUTE_COLOR,
x + NOT_FOUND_TEXT_X + x_offset + 300,
@@ -597,15 +515,14 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
y + NOT_FOUND_TEXT_Y + y_offset);
o_set_line_options(toplevel, new_prim_obj, END_ROUND, TYPE_SOLID,
50, -1, -1);
- prim_objs = s_basic_link_object(new_prim_obj, prim_objs);
+ prim_objs = g_list_append (prim_objs, new_prim_obj);
new_prim_obj = o_text_new(toplevel,
OBJ_TEXT, DETACHED_ATTRIBUTE_COLOR,
x + NOT_FOUND_TEXT_X + x_offset + 270,
y + NOT_FOUND_TEXT_Y + y_offset + 90,
LOWER_LEFT, 0, "!", 18,
VISIBLE, SHOW_NAME_VALUE);
- prim_objs = s_basic_link_object(new_prim_obj, prim_objs);
- prim_objs = save_prim_objs;
+ prim_objs = g_list_append (prim_objs, new_prim_obj);
} else {
@@ -613,10 +530,10 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
loaded_normally = TRUE;
/* add connections till translated */
- o_read_buffer(toplevel, prim_objs, buffer, -1, new_node->complex_basename);
+ prim_objs = o_read_buffer (toplevel, prim_objs, buffer, -1, new_node->complex_basename);
g_free (buffer);
-
+
}
toplevel->ADDING_SEL = save_adding_sel;
@@ -625,11 +542,11 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
*/
if (loaded_normally == TRUE) {
if (mirror) {
- o_list_mirror_world(toplevel, 0, 0, prim_objs);
+ o_glist_mirror_world (toplevel, 0, 0, prim_objs);
}
- o_list_rotate_world(toplevel, 0, 0, angle, prim_objs);
- o_list_translate_world(toplevel, x, y, prim_objs);
+ o_glist_rotate_world (toplevel, 0, 0, angle, prim_objs);
+ o_glist_translate_world (toplevel, x, y, prim_objs);
if (!toplevel->ADDING_SEL) {
s_conn_update_complex(toplevel, prim_objs);
@@ -639,7 +556,8 @@ OBJECT *o_complex_new(TOPLEVEL *toplevel,
new_node->complex->prim_objs = prim_objs;
/* set the parent field now */
- for (tmp = prim_objs; tmp != NULL; tmp = tmp->next) {
+ for (iter = prim_objs; iter != NULL; iter = g_list_next (iter)) {
+ OBJECT *tmp = iter->data;
tmp->complex_parent = new_node;
}
@@ -667,9 +585,7 @@ OBJECT *o_complex_new_embedded(TOPLEVEL *toplevel,
char type, int color, int x, int y, int angle, int mirror,
const gchar *basename, int selectable)
{
- OBJECT *prim_objs=NULL;
OBJECT *new_node=NULL;
- OBJECT *tmp;
new_node = s_basic_new_object(type, "complex");
@@ -695,14 +611,7 @@ OBJECT *o_complex_new_embedded(TOPLEVEL *toplevel,
new_node->sel_func = NULL;
}
- /* this was at the beginning and p_complex was = to complex */
- prim_objs = new_head ();
- new_node->complex->prim_objs = prim_objs;
-
- /* set the parent field now */
- for (tmp = prim_objs; tmp != NULL; tmp = tmp->next) {
- tmp->complex_parent = new_node;
- }
+ new_node->complex->prim_objs = NULL;
/* don't have to translate/rotate/mirror here at all since the */
/* object is in place */
@@ -750,9 +659,9 @@ void o_complex_recalc(TOPLEVEL *toplevel, OBJECT *o_current)
*
* \todo Don't use fixed-length string for symbol basename
*/
-OBJECT *o_complex_read(TOPLEVEL *toplevel, OBJECT *object_list,
- char buf[], unsigned int release_ver,
- unsigned int fileformat_ver)
+OBJECT *o_complex_read (TOPLEVEL *toplevel,
+ char buf[], unsigned int release_ver,
+ unsigned int fileformat_ver)
{
OBJECT *new_obj;
char type;
@@ -810,9 +719,7 @@ OBJECT *o_complex_read(TOPLEVEL *toplevel, OBJECT *object_list,
o_complex_remove_promotable_attribs (toplevel, new_obj);
}
- object_list = s_basic_link_object(new_obj, object_list);
-
- return object_list;
+ return new_obj;
}
/*! \brief Create a string representation of the complex object
@@ -871,7 +778,7 @@ void o_complex_translate_world(TOPLEVEL *toplevel, int dx, int dy,
object->complex->x = object->complex->x + dx;
object->complex->y = object->complex->y + dy;
- o_list_translate_world(toplevel, dx, dy, object->complex->prim_objs);
+ o_glist_translate_world (toplevel, dx, dy, object->complex->prim_objs);
o_complex_recalc (toplevel, object);
}
@@ -898,12 +805,8 @@ OBJECT *o_complex_copy(TOPLEVEL *toplevel, OBJECT *o_current)
} else {
color = o_current->saved_color;
}
-
- if (o_current->sel_func) {
- selectable = TRUE;
- } else {
- selectable = FALSE;
- }
+
+ selectable = (o_current->sel_func != NULL);
clib = s_clib_get_symbol_by_name (o_current->complex_basename);
@@ -939,8 +842,7 @@ OBJECT *o_complex_copy(TOPLEVEL *toplevel, OBJECT *o_current)
OBJECT *o_complex_copy_embedded(TOPLEVEL *toplevel, OBJECT *o_current)
{
OBJECT *new_obj=NULL;
- OBJECT *temp_list;
- OBJECT *tmp;
+ GList *iter;
int color;
int selectable;
@@ -952,11 +854,7 @@ OBJECT *o_complex_copy_embedded(TOPLEVEL *toplevel, OBJECT *o_current)
color = o_current->saved_color;
}
- if (o_current->sel_func) {
- selectable = TRUE;
- } else {
- selectable = FALSE;
- }
+ selectable = (o_current->sel_func != NULL);
new_obj = o_complex_new_embedded (toplevel, o_current->type, color,
o_current->complex->x, o_current->complex->y,
@@ -966,16 +864,14 @@ OBJECT *o_complex_copy_embedded(TOPLEVEL *toplevel, OBJECT *o_current)
selectable);
/* deal with stuff that has changed */
-
- temp_list = o_list_copy_all(toplevel,
- o_current->complex->prim_objs->next,
- new_obj->complex->prim_objs,
- toplevel->ADDING_SEL);
-
- new_obj->complex->prim_objs = return_head(temp_list);
+
+ new_obj->complex->prim_objs =
+ o_glist_copy_all (toplevel, o_current->complex->prim_objs,
+ new_obj->complex->prim_objs, toplevel->ADDING_SEL);
/* set the parent field now */
- for (tmp = new_obj->complex->prim_objs; tmp != NULL; tmp = tmp->next) {
+ for (iter = new_obj->complex->prim_objs; iter != NULL; iter = g_list_next (iter)) {
+ OBJECT *tmp = iter->data;
tmp->complex_parent = new_obj;
}
@@ -997,13 +893,15 @@ OBJECT *o_complex_copy_embedded(TOPLEVEL *toplevel, OBJECT *o_current)
*
* \note This function is mainly used to change the color of text objects
*/
-void o_complex_set_color(OBJECT *prim_objs, int color)
+void o_complex_set_color (GList *prim_objs, int color)
{
OBJECT *o_current=NULL;
+ GList *iter;
- o_current = prim_objs;
+ iter = prim_objs;
- while ( o_current != NULL ) {
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
switch(o_current->type) {
case(OBJ_LINE):
case(OBJ_NET):
@@ -1029,7 +927,7 @@ void o_complex_set_color(OBJECT *prim_objs, int color)
break;
}
- o_current=o_current->next;
+ iter = g_list_next (iter);
}
}
@@ -1077,13 +975,15 @@ void o_complex_set_color_single(OBJECT *o_current, int color)
* \par Function Description
*
*/
-void o_complex_set_color_save(OBJECT *complex, int color)
+void o_complex_set_color_save (GList *list, int color)
{
OBJECT *o_current=NULL;
+ GList *iter;
- o_current = complex;
+ iter = list;
- while ( o_current != NULL ) {
+ while ( iter != NULL ) {
+ o_current = (OBJECT *)iter->data;
switch(o_current->type) {
case(OBJ_LINE):
case(OBJ_NET):
@@ -1116,7 +1016,7 @@ void o_complex_set_color_save(OBJECT *complex, int color)
break;
}
- o_current=o_current->next;
+ iter = g_list_next (iter);
}
}
@@ -1125,13 +1025,15 @@ void o_complex_set_color_save(OBJECT *complex, int color)
* \par Function Description
*
*/
-void o_complex_unset_color(OBJECT *complex)
+void o_complex_unset_color (GList *list)
{
OBJECT *o_current=NULL;
+ GList *iter;
- o_current = complex;
+ iter = list;
- while ( o_current != NULL ) {
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
switch(o_current->type) {
case(OBJ_LINE):
case(OBJ_NET):
@@ -1162,7 +1064,7 @@ void o_complex_unset_color(OBJECT *complex)
break;
}
- o_current=o_current->next;
+ iter = g_list_next (iter);
}
}
@@ -1210,13 +1112,15 @@ void o_complex_unset_color_single(OBJECT *o_current)
* \par Function Description
*
*/
-void o_complex_set_saved_color_only(OBJECT *complex, int color)
+void o_complex_set_saved_color_only (GList *list, int color)
{
OBJECT *o_current=NULL;
+ GList *iter;
- o_current = complex;
+ iter = list;
- while ( o_current != NULL ) {
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
switch(o_current->type) {
case(OBJ_LINE):
case(OBJ_NET):
@@ -1242,37 +1146,39 @@ void o_complex_set_saved_color_only(OBJECT *complex, int color)
break;
}
- o_current=o_current->next;
+ iter = g_list_next (iter);
}
}
/*! \brief get the nth pin of a object list
* \par Function Description
- * Search the nth pin the object list \a o_list and return it.
+ * Search the nth pin the object list \a list and return it.
*
- * \param o_list the object list to search through
+ * \param list the object list to search through
* \param counter specifies the nth pin
* \return the counter'th pin object, NULL if there is no more pin
*/
-OBJECT *o_complex_return_nth_pin(OBJECT *o_list, int counter)
+OBJECT *o_complex_return_nth_pin (GList *list, int counter)
{
OBJECT *o_current;
int internal_counter=0;
-
- o_current = o_list;
-
- while (o_current != NULL) {
+ GList *iter;
+
+ iter = list;
+
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
if (o_current->type == OBJ_PIN) {
-
+
if (counter == internal_counter) {
return(o_current);
} else {
- internal_counter++;
+ internal_counter++;
}
- }
- o_current = o_current->next;
+ }
+ iter = g_list_next (iter);
}
-
+
return(NULL);
}
@@ -1304,7 +1210,7 @@ void o_complex_rotate_world(TOPLEVEL *toplevel,
o_complex_translate_world(toplevel,
-object->complex->x,
-object->complex->y, object);
- o_list_rotate_world(toplevel, 0, 0, angle, object->complex->prim_objs);
+ o_glist_rotate_world (toplevel, 0, 0, angle, object->complex->prim_objs);
object->complex->x = 0;
object->complex->y = 0;
@@ -1338,7 +1244,7 @@ void o_complex_mirror_world(TOPLEVEL *toplevel,
-object->complex->x,
-object->complex->y, object);
- o_list_mirror_world( toplevel, 0, 0, object->complex->prim_objs );
+ o_glist_mirror_world (toplevel, 0, 0, object->complex->prim_objs);
switch(object->complex->angle) {
case(90):
@@ -1368,22 +1274,22 @@ void o_complex_mirror_world(TOPLEVEL *toplevel,
*/
OBJECT *o_complex_return_pin_object(OBJECT *object, char *pin)
{
- OBJECT *o_current=NULL;
OBJECT *found;
+ GList *iter;
g_return_val_if_fail(object != NULL, NULL);
g_return_val_if_fail(((object->type == OBJ_COMPLEX) ||
(object->type == OBJ_PLACEHOLDER)) , NULL);
g_return_val_if_fail(object->complex != NULL, NULL);
-
/* go inside complex objects */
- o_current = object->complex->prim_objs;
+ for (iter = object->complex->prim_objs;
+ iter != NULL;
+ iter = g_list_next (iter)) {
+ OBJECT *o_current = iter->data;
- while ( o_current != NULL ) {
switch(o_current->type) {
case(OBJ_PIN):
-
/* Search for the pin making sure that */
/* any found attribute starts with "pinnumber" */
found = o_attrib_search_attrib_value(o_current->attribs, pin,
@@ -1397,7 +1303,6 @@ OBJECT *o_complex_return_pin_object(OBJECT *object, char *pin)
}
break;
}
- o_current=o_current->next;
}
return(NULL);
}
@@ -1414,6 +1319,7 @@ int o_complex_count_pins(OBJECT *object)
{
OBJECT *o_current=NULL;
int pin_counter=0;
+ GList *iter;
g_return_val_if_fail(object != NULL, 0);
g_return_val_if_fail(((object->type == OBJ_COMPLEX) ||
@@ -1427,16 +1333,17 @@ int o_complex_count_pins(OBJECT *object)
* file (usually, objects from the .sym file).
* Then iterate over this list looking for pins and
* counting them. */
- o_current = object->complex->prim_objs;
+ iter = object->complex->prim_objs;
- while ( o_current != NULL ) {
+ while ( iter != NULL ) {
+ o_current = (OBJECT *)iter->data;
switch(o_current->type) {
case(OBJ_PIN):
pin_counter++;
break;
}
- o_current=o_current->next;
+ iter = g_list_next (iter);
}
return(pin_counter);
}
@@ -1637,25 +1544,18 @@ gdouble o_complex_shortest_distance(COMPLEX *complex, gint x, gint y)
{
gdouble distance;
gdouble shortest_distance = G_MAXDOUBLE;
- OBJECT *temp;
+ GList *iter;
if (complex == NULL) {
g_critical("o_complex_shortest_distance(): complex == NULL\n");
return G_MAXDOUBLE;
}
- temp = complex->prim_objs;
-
- if (temp != NULL) {
- temp = temp->next;
- }
-
- while (temp != NULL) {
- distance = o_shortest_distance(temp, x, y);
-
- shortest_distance = min(shortest_distance, distance);
+ for (iter = complex->prim_objs; iter != NULL; iter= g_list_next (iter)) {
+ OBJECT *obj = iter->data;
- temp = temp->next;
+ distance = o_shortest_distance (obj, x, y);
+ shortest_distance = min (shortest_distance, distance);
}
return shortest_distance;
diff --git a/libgeda/src/o_line_basic.c b/libgeda/src/o_line_basic.c
index 214e09b..17cae09 100644
--- a/libgeda/src/o_line_basic.c
+++ b/libgeda/src/o_line_basic.c
@@ -203,9 +203,8 @@ void o_line_modify(TOPLEVEL *toplevel, OBJECT *object,
/*! \brief Create line OBJECT from character string.
* \par Function Description
* This function creates a line OBJECT from the character string
- * <B>*buf</B> the description of a box. The new box is added to the
- * list of objects of which <B>*object_list</B> is the last element
- * before the call.
+ * <B>*buf</B> the description of a box.
+ *
* The function returns a pointer on the new last element, that is
* the added line object.
*
@@ -217,13 +216,12 @@ void o_line_modify(TOPLEVEL *toplevel, OBJECT *object,
* </DL>
*
* \param [in] toplevel The TOPLEVEL object.
- * \param [out] object_list OBJECT list to create line in.
* \param [in] buf Character string with line description.
* \param [in] release_ver libgeda release version number.
* \param [in] fileformat_ver libgeda file format version number.
* \return A pointer to the new line object.
*/
-OBJECT *o_line_read (TOPLEVEL *toplevel, OBJECT *object_list, char buf[],
+OBJECT *o_line_read (TOPLEVEL *toplevel, char buf[],
unsigned int release_ver, unsigned int fileformat_ver)
{
OBJECT *new_obj;
@@ -292,9 +290,7 @@ OBJECT *o_line_read (TOPLEVEL *toplevel, OBJECT *object_list, char buf[],
o_set_fill_options (toplevel, new_obj,
FILLING_HOLLOW, -1, -1, -1, -1, -1);
- object_list = s_basic_link_object (new_obj, object_list);
-
- return object_list;
+ return new_obj;
}
/*! \brief Create a character string representation of a line OBJECT.
diff --git a/libgeda/src/o_list.c b/libgeda/src/o_list.c
index 4e54b59..0624996 100644
--- a/libgeda/src/o_list.c
+++ b/libgeda/src/o_list.c
@@ -42,17 +42,15 @@ extern int global_sid;
* flag is either NORMAL_FLAG or SELECTION_FLAG
*
* \param [in] toplevel The TOPLEVEL object.
- * \param [in] list_head
* \param [in] selected
* \param [in] flag
* \param [out] return_end
* \return OBJECT pointer.
*/
-OBJECT *o_list_copy_to(TOPLEVEL *toplevel, OBJECT *list_head,
- OBJECT *selected, int flag, OBJECT **return_end)
+OBJECT *o_object_copy (TOPLEVEL *toplevel,
+ OBJECT *selected, int flag)
{
OBJECT *new_obj;
- OBJECT *end;
/* are we adding a selection or the real object list */
toplevel->ADDING_SEL = flag;
@@ -60,7 +58,6 @@ OBJECT *o_list_copy_to(TOPLEVEL *toplevel, OBJECT *list_head,
switch(selected->type) {
case(OBJ_LINE):
- /* do we do anything with the return value) ? */
new_obj = o_line_copy (toplevel, selected);
break;
@@ -112,19 +109,13 @@ OBJECT *o_list_copy_to(TOPLEVEL *toplevel, OBJECT *list_head,
default:
g_critical ("o_list_copy_to: object %p has bad type '%c'\n",
selected, selected->type);
- return list_head;
+ return NULL;
}
/* Store a reference in the copied object to where it was copied.
* Used to retain associations when copying attributes */
selected->copied_to = new_obj;
- end = return_tail (list_head);
- end = s_basic_link_object (new_obj, end);
-
- if (list_head == NULL)
- list_head = end;
-
/* make sure sid is the same! */
if (selected) {
new_obj->sid = selected->sid;
@@ -132,93 +123,10 @@ OBJECT *o_list_copy_to(TOPLEVEL *toplevel, OBJECT *list_head,
/* I don't think this is a good idea at all */
/* toplevel->ADDING_SEL = 0; */
-
- if (return_end) {
- *return_end = end;
- }
- return(list_head);
+ return new_obj;
}
-/*! \todo Finish function description!!!
- * \brief
- * \par Function Description
- * you need to pass in a head_node for dest_list_head
- * flag is either NORMAL_FLAG or SELECTION_FLAG
- *
- * \param [in] toplevel The TOPLEVEL object.
- * \param [in] src_list_head
- * \param [in] dest_list_head
- * \param [in] flag
- * \return OBJECT pointer.
- */
-OBJECT *o_list_copy_all(TOPLEVEL *toplevel, OBJECT *src_list_head,
- OBJECT *dest_list_head, int flag)
-{
- OBJECT *src;
- OBJECT *dest;
- int adding_sel_save;
-
- src = src_list_head;
- dest = dest_list_head;
-
- if (src == NULL || dest == NULL) {
- return(NULL);
- }
-
- /* Save ADDING_SEL as o_list_copy_to() sets it */
- adding_sel_save = toplevel->ADDING_SEL;
-
- /* first do all NON text items */
- while(src != NULL) {
-
- if (src->type != OBJ_TEXT) {
- dest->next = o_list_copy_to(toplevel, NULL, src, flag,
- NULL);
-
- dest->next->prev = dest;
- dest = dest->next;
- dest->sid = global_sid++;
- }
-
- src = src->next;
- }
-
- src = src_list_head;
- /*dest = dest_list_head; out since we want to add to the end */
-
- /* then do all text items */
- while(src != NULL) {
-
- if (src->type == OBJ_TEXT) {
- dest->next = o_list_copy_to(toplevel, NULL, src, flag,
- NULL);
-
- dest->next->prev = dest;
- dest = dest->next;
- dest->sid = global_sid++;
-
- if (src->attached_to /*&& !toplevel->ADDING_SEL*/) {
- if (src->attached_to->copied_to) {
- o_attrib_attach(toplevel, dest, src->attached_to->copied_to);
- }
- }
- }
-
- src = src->next;
- }
-
- /* Clean up dangling copied_to pointers */
- src = src_list_head;
- while(src != NULL) {
- src->copied_to = NULL;
- src = src->next;
- }
-
- toplevel->ADDING_SEL = adding_sel_save;
-
- return(dest);
-}
/*! \todo Finish function description!!!
* \brief
@@ -237,9 +145,9 @@ OBJECT *o_list_copy_all(TOPLEVEL *toplevel, OBJECT *src_list_head,
* \param [in] flag
* \return the dest_list GList with objects appended to it.
*/
-GList *o_glist_copy_all_to_glist(TOPLEVEL *toplevel,
- GList *src_list,
- GList *dest_list, int flag)
+GList *o_glist_copy_all (TOPLEVEL *toplevel,
+ GList *src_list,
+ GList *dest_list, int flag)
{
GList *src, *dest;
OBJECT *src_object, *dst_object;
@@ -267,7 +175,7 @@ GList *o_glist_copy_all_to_glist(TOPLEVEL *toplevel,
o_selection_unselect(src_object);
if (src_object->type != OBJ_TEXT && src_object->type != OBJ_HEAD) {
- dst_object = o_list_copy_to (toplevel, NULL, src_object, flag, NULL);
+ dst_object = o_object_copy (toplevel, src_object, flag);
dst_object->sid = global_sid++;
dest = g_list_prepend (dest, dst_object);
}
@@ -291,7 +199,7 @@ GList *o_glist_copy_all_to_glist(TOPLEVEL *toplevel,
o_selection_unselect(src_object);
if (src_object->type == OBJ_TEXT) {
- dst_object = o_list_copy_to (toplevel, NULL, src_object, flag, NULL);
+ dst_object = o_object_copy (toplevel, src_object, flag);
dst_object->sid = global_sid++;
dest = g_list_prepend (dest, dst_object);
@@ -320,85 +228,12 @@ GList *o_glist_copy_all_to_glist(TOPLEVEL *toplevel,
/* Reverse the list to be in the correct order */
dest = g_list_reverse (dest);
- /* Link the copied objects together for good measure */
- o_glist_relink_objects (dest);
-
toplevel->ADDING_SEL = adding_sel_save;
return(dest);
}
-/*! \brief Relink OBJECT next and prev pointers to match the passed GList
- *
- * \par Function Description
- * Updates the OBJECT next and prev pointers for OBJECTs in the passed
- * GList of objects to link in the same order as the passed GList.
- *
- * \param [in] o_glist The GList of OBJECTs.
- */
-void o_glist_relink_objects (GList *o_glist)
-{
- GList *iter, *tmp;
- OBJECT *object;
-
- for (iter = o_glist; iter != NULL; iter = g_list_next (iter)) {
- object = iter->data;
-
- tmp = g_list_previous (iter);
- object->prev = (tmp == NULL) ? NULL : tmp->data;
-
- tmp = g_list_next (iter);
- object->next = (tmp == NULL) ? NULL : tmp->data;
- }
-}
-
-
-/*! \todo Finish function description!!!
- * \brief
- * \par Function Description
- * assuming list is head
- * head will NOT be deleted
- *
- * \param [in] toplevel The TOPLEVEL object.
- * \param [in] list
- */
-void o_list_delete_rest(TOPLEVEL *toplevel, OBJECT *list)
-{
- OBJECT *o_current=NULL;
- OBJECT *o_prev=NULL;
-
- o_current = (OBJECT *) return_tail(list);
-
- /* remove list backwards */
- while(o_current != NULL) {
- if (o_current->type != OBJ_HEAD) {
- o_prev = o_current->prev;
- s_delete(toplevel, o_current);
- o_current = o_prev;
- } else {
- o_current->next = NULL; /* set sel_head->next to be empty */
- o_current = NULL;
- }
- }
-}
-
-
-/*! \todo Finish function description!!!
- * \brief
- * \par Function Description
- */
-void o_list_translate_world(TOPLEVEL *toplevel, int dx, int dy, OBJECT *list)
-{
- OBJECT *o_current = list;
-
- while ( o_current != NULL ) {
- o_translate_world(toplevel, dx, dy, o_current);
- o_current = o_current->next;
- }
-}
-
-
/*! \todo Finish function description!!!
* \brief
* \par Function Description
@@ -416,22 +251,6 @@ void o_glist_translate_world(TOPLEVEL *toplevel, int dx, int dy, GList *list)
}
-
-/*! \todo Finish function description!!!
- * \brief
- * \par Function Description
- */
-void o_list_rotate_world (TOPLEVEL *toplevel, int x, int y, int angle, OBJECT *list)
-{
- OBJECT *o_current = list;
-
- while ( o_current != NULL ) {
- o_rotate_world (toplevel, x, y, angle, o_current);
- o_current = o_current->next;
- }
-}
-
-
/*! \todo Finish function description!!!
* \brief
* \par Function Description
@@ -453,21 +272,6 @@ void o_glist_rotate_world (TOPLEVEL *toplevel, int x, int y, int angle, GList *l
* \brief
* \par Function Description
*/
-void o_list_mirror_world (TOPLEVEL *toplevel, int x, int y, OBJECT *list)
-{
- OBJECT *o_current = list;
-
- while ( o_current != NULL ) {
- o_mirror_world (toplevel, x, y, o_current);
- o_current = o_current->next;
- }
-}
-
-
-/*! \todo Finish function description!!!
- * \brief
- * \par Function Description
- */
void o_glist_mirror_world (TOPLEVEL *toplevel, int x, int y, GList *list)
{
GList *iter = list;
diff --git a/libgeda/src/o_net_basic.c b/libgeda/src/o_net_basic.c
index d475b68..8497da1 100644
--- a/libgeda/src/o_net_basic.c
+++ b/libgeda/src/o_net_basic.c
@@ -139,7 +139,7 @@ void o_net_recalc(TOPLEVEL *toplevel, OBJECT *o_current)
* \return The object list
*
*/
-OBJECT *o_net_read (TOPLEVEL *toplevel, OBJECT *object_list, char buf[],
+OBJECT *o_net_read (TOPLEVEL *toplevel, char buf[],
unsigned int release_ver, unsigned int fileformat_ver)
{
OBJECT *new_obj;
@@ -168,9 +168,7 @@ OBJECT *o_net_read (TOPLEVEL *toplevel, OBJECT *object_list, char buf[],
new_obj = o_net_new (toplevel, type, color, x1, y1, x2, y2);
- object_list = s_basic_link_object (new_obj, object_list);
-
- return object_list;
+ return new_obj;
}
/*! \brief Create a string representation of the net object
@@ -588,12 +586,12 @@ int o_net_consolidate_segments(TOPLEVEL *toplevel, OBJECT *object)
}
s_conn_remove(toplevel, other_object);
+ toplevel->page_current->object_list =
+ g_list_remove (toplevel->page_current->object_list, other_object);
s_delete(toplevel, other_object);
o_net_recalc(toplevel, object);
s_tile_update_object(toplevel, object);
s_conn_update_object(toplevel, object);
- toplevel->page_current->object_tail =
- return_tail(toplevel->page_current->object_head);
return(-1);
}
}
@@ -617,21 +615,23 @@ int o_net_consolidate_segments(TOPLEVEL *toplevel, OBJECT *object)
void o_net_consolidate(TOPLEVEL *toplevel)
{
OBJECT *o_current;
+ GList *iter;
int status = 0;
- o_current = toplevel->page_current->object_head;
+ iter = toplevel->page_current->object_list;
- while (o_current != NULL) {
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
if (o_current->type == OBJ_NET) {
status = o_net_consolidate_segments(toplevel, o_current);
}
if (status == -1) {
- o_current = toplevel->page_current->object_head;
+ iter = toplevel->page_current->object_list;
status = 0;
} else {
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
}
}
diff --git a/libgeda/src/o_path_basic.c b/libgeda/src/o_path_basic.c
index 6fa1673..d592e8e 100644
--- a/libgeda/src/o_path_basic.c
+++ b/libgeda/src/o_path_basic.c
@@ -149,11 +149,7 @@ OBJECT *o_path_copy (TOPLEVEL *toplevel, OBJECT *o_current)
* \par Function Description
* This function creates a path OBJECT from the character string
* <B>*buf</B> and a number of lines following that describing the
- * path, read from <B>*tb</B>. The new path is added to the
- * list of objects of which <B>*object_list</B> is the last element
- * before the call.
- * The function returns a pointer on the new last element, that is
- * the added path object.
+ * path, read from <B>*tb</B>.
*
* Depending on <B>*version</B>, the correct file format is considered.
* Currently two file format revisions are supported :
@@ -163,14 +159,13 @@ OBJECT *o_path_copy (TOPLEVEL *toplevel, OBJECT *o_current)
* </DL>
*
* \param [in] toplevel The TOPLEVEL object.
- * \param [out] object_list OBJECT list to create path in.
* \param [in] first_line Character string with path description.
* \param [in] tb Text buffer containing the path string.
* \param [in] release_ver libgeda release version number.
* \param [in] fileformat_ver libgeda file format version number.
* \return A pointer to the new path object.
*/
-OBJECT *o_path_read (TOPLEVEL *toplevel, OBJECT *object_list,
+OBJECT *o_path_read (TOPLEVEL *toplevel,
const char *first_line, TextBuffer *tb,
unsigned int release_ver, unsigned int fileformat_ver)
{
@@ -238,9 +233,7 @@ OBJECT *o_path_read (TOPLEVEL *toplevel, OBJECT *object_list,
o_set_fill_options (toplevel, new_obj,
fill_type, fill_width, pitch1, angle1, pitch2, angle2);
- /* Add the path to the object list */
- object_list = s_basic_link_object(new_obj, object_list);
- return object_list;
+ return new_obj;
}
diff --git a/libgeda/src/o_picture.c b/libgeda/src/o_picture.c
index e68b58c..adeac52 100644
--- a/libgeda/src/o_picture.c
+++ b/libgeda/src/o_picture.c
@@ -48,20 +48,16 @@ void (*picture_draw_func)() = NULL;
/*! \brief Create picture OBJECT from character string.
* \par Function Description
* This function will get the description of a picture from the
- * character string <B>*first_line</B>. The new picture is then added
- * to the list of object of which <B>*object_list</B> is the last
- * element before the call. The function returns the new last
- * element, that is the added picture object.
+ * character string <B>*first_line</B>.
*
* \param [in] toplevel The TOPLEVEL object.
- * \param [out] object_list OBJECT list to create picture in.
* \param [in] first_line Character string with picture description.
* \param [in] tb Text buffer to load embedded data from.
* \param [in] release_ver libgeda release version number.
* \param [in] fileformat_ver libgeda file format version number.
* \return A pointer to the new picture object.
*/
-OBJECT *o_picture_read(TOPLEVEL *toplevel, OBJECT *object_list,
+OBJECT *o_picture_read (TOPLEVEL *toplevel,
const char *first_line,
TextBuffer *tb,
unsigned int release_ver,
@@ -225,9 +221,7 @@ OBJECT *o_picture_read(TOPLEVEL *toplevel, OBJECT *object_list,
/* Don't free file_content, it is now owned by the picture object */
- object_list = s_basic_link_object(new_obj, object_list);
-
- return(object_list);
+ return new_obj;
}
diff --git a/libgeda/src/o_pin_basic.c b/libgeda/src/o_pin_basic.c
index df11edc..e9dfbb5 100644
--- a/libgeda/src/o_pin_basic.c
+++ b/libgeda/src/o_pin_basic.c
@@ -138,7 +138,7 @@ void o_pin_recalc(TOPLEVEL *toplevel, OBJECT *o_current)
* \param [in] fileformat_ver a integer value of the file format
* \return The object list
*/
-OBJECT *o_pin_read (TOPLEVEL *toplevel, OBJECT *object_list, char buf[],
+OBJECT *o_pin_read (TOPLEVEL *toplevel, char buf[],
unsigned int release_ver, unsigned int fileformat_ver)
{
OBJECT *new_obj;
@@ -184,9 +184,7 @@ OBJECT *o_pin_read (TOPLEVEL *toplevel, OBJECT *object_list, char buf[],
new_obj = o_pin_new (toplevel, type, color, x1, y1, x2, y2,
pin_type, whichend);
- object_list = s_basic_link_object(new_obj, object_list);
-
- return object_list;
+ return new_obj;
}
/*! \brief Create a string representation of the pin object
@@ -425,9 +423,10 @@ void o_pin_modify(TOPLEVEL *toplevel, OBJECT *object,
*
*/
void o_pin_update_whichend(TOPLEVEL *toplevel,
- OBJECT *object_list, int num_pins)
+ GList *object_list, int num_pins)
{
OBJECT *o_current;
+ GList *iter;
int top, left;
int right, bottom;
int d1, d2, d3, d4;
@@ -438,14 +437,15 @@ void o_pin_update_whichend(TOPLEVEL *toplevel,
if (object_list && num_pins) {
if (num_pins == 1 || toplevel->force_boundingbox) {
- world_get_object_list_bounds(toplevel, object_list,
- &left, &top, &right, &bottom);
+ world_get_object_glist_bounds (toplevel, object_list,
+ &left, &top, &right, &bottom);
} else {
found = 0;
/* only look at the pins to calculate bounds of the symbol */
- o_current = object_list;
- while (o_current != NULL) {
+ iter = object_list;
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
if (o_current->type == OBJ_PIN) {
rleft = o_current->w_left;
rtop = o_current->w_top;
@@ -465,7 +465,7 @@ void o_pin_update_whichend(TOPLEVEL *toplevel,
found = 1;
}
}
- o_current=o_current->next;
+ iter = g_list_next (iter);
}
}
@@ -473,8 +473,9 @@ void o_pin_update_whichend(TOPLEVEL *toplevel,
return;
}
- o_current = object_list;
- while (o_current != NULL) {
+ iter = object_list;
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
/* Determine which end of the pin is on or nearest the boundary */
if (o_current->type == OBJ_PIN && o_current->whichend == -1) {
if (o_current->line->y[0] == o_current->line->y[1]) {
@@ -560,6 +561,6 @@ void o_pin_update_whichend(TOPLEVEL *toplevel,
}
}
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
}
diff --git a/libgeda/src/o_text_basic.c b/libgeda/src/o_text_basic.c
index 856e114..60a0516 100644
--- a/libgeda/src/o_text_basic.c
+++ b/libgeda/src/o_text_basic.c
@@ -169,26 +169,8 @@ static void update_disp_string(OBJECT *o)
int world_get_text_bounds(TOPLEVEL *toplevel, OBJECT *o_current, int *left,
int *top, int *right, int *bottom)
{
- return world_get_object_list_bounds(toplevel, o_current->text->prim_objs,
- left, top, right, bottom);
-}
-
-/*! \brief create a new text head object
- * \par Function Description
- * This function creates a <b>text_head</b> OBJECT. This OBJECT
- * is just a special empty object. This object is never modified.
- *
- * \return new text head OBJECT
- */
-OBJECT *o_text_new_head (void)
-{
- OBJECT *new_node=NULL;
-
- new_node = s_basic_new_object(OBJ_HEAD, "text_head");
-
- /* don't need to do this for head nodes */
- /* ret = s_basic_link_object(new_node, NULL);*/
- return new_node;
+ return world_get_object_glist_bounds (toplevel, o_current->text->prim_objs,
+ left, top, right, bottom);
}
/*! \brief initialize the hash tables for the fonts
@@ -227,6 +209,7 @@ void o_text_init(void)
void o_text_print_set(void)
{
OBJECT *o_current, *o_font_set;
+ GList *iter;
char i;
for (i = 'A' ; i < 'Z'+1; i++) {
@@ -234,9 +217,10 @@ void o_text_print_set(void)
GUINT_TO_POINTER ((gunichar)i));
if (o_font_set != NULL) {
printf("%c: LOADED\n", i);
- for (o_current=return_tail(o_font_set->font_prim_objs); o_current;
- o_current=o_current->prev)
+ for (iter=o_font_set->font_prim_objs; iter != NULL;
+ iter = g_list_next (iter))
{
+ o_current = (OBJECT *)iter->data;
printf(" %s\n", o_current->name);
}
} else {
@@ -253,7 +237,7 @@ void o_text_print_set(void)
* \param [in] needed_char unicode character to load
* return a character OBJECT
*/
-OBJECT *o_text_load_font(TOPLEVEL *toplevel, gunichar needed_char)
+GList *o_text_load_font (TOPLEVEL *toplevel, gunichar needed_char)
{
gchar *temp_string = NULL;
OBJECT *o_font_set;
@@ -309,7 +293,7 @@ OBJECT *o_text_load_font(TOPLEVEL *toplevel, gunichar needed_char)
o_font_set->font_text_size = 100;
o_font_set->name = g_strdup_printf ("%c", needed_char);
- o_font_set->font_prim_objs = o_text_new_head ();
+ o_font_set->font_prim_objs = NULL;
/* Add it to the list and hash table. Some functions will need it */
g_hash_table_insert (font_loaded,
@@ -335,15 +319,12 @@ OBJECT *o_text_load_font(TOPLEVEL *toplevel, gunichar needed_char)
o_font_set->font_prim_objs = o_read(toplevel, o_font_set->font_prim_objs,
temp_string, &err);
- if (o_font_set->font_prim_objs == NULL) {
- g_assert (err != NULL);
+ if (err != NULL) {
g_warning ("o_text_basic.c: Failed to read font file: %s\n",
err->message);
g_error_free (err);
}
- o_font_set->font_prim_objs = return_head(o_font_set->font_prim_objs);
-
g_free(temp_string);
return(o_font_set->font_prim_objs);
@@ -514,14 +495,12 @@ int o_text_width(TOPLEVEL *toplevel, char *string, int size)
*
* \return the object list of the primary text objects
*/
-OBJECT *o_text_create_string(TOPLEVEL *toplevel, OBJECT *object_list,
- char *string, int size, int color, int x, int y,
- int alignment, int angle)
+GList *o_text_create_string (TOPLEVEL *toplevel, char *string, int size,
+ int color, int x, int y, int alignment, int angle)
{
- OBJECT *temp_tail=NULL;
- OBJECT *temp_list;
- OBJECT *temp_obj;
- OBJECT *start_of_char;
+ GList *new_obj_list = NULL;
+ GList *start_of_char;
+ OBJECT *new_obj;
int x_offset;
int y_offset;
int text_width;
@@ -539,16 +518,12 @@ OBJECT *o_text_create_string(TOPLEVEL *toplevel, OBJECT *object_list,
gboolean finish_overbar, start_overbar, leave_parser = FALSE;
gboolean draw_character, draw_tabulator, draw_newline;
- temp_list = object_list;
-
/* error condition hack */
if (string == NULL) {
return(NULL);
}
/* now read in the chars */
- temp_tail = toplevel->page_current->object_tail;
-
text_height = o_text_height(string, size);
char_height = o_text_height("a", size);
text_width = o_text_width(toplevel, string, size/2);
@@ -793,21 +768,20 @@ OBJECT *o_text_create_string(TOPLEVEL *toplevel, OBJECT *object_list,
/* Only add the character if there are primary object.
e.g. the space character doesn't have those */
- if (o_font_set->font_prim_objs->next != NULL) {
- start_of_char = temp_list;
- temp_list = o_list_copy_all(toplevel,
- o_font_set->font_prim_objs->next,
- temp_list, NORMAL_FLAG);
-
- if (start_of_char != NULL)
- start_of_char = start_of_char->next;
+ if (o_font_set->font_prim_objs != NULL) {
+ start_of_char = o_glist_copy_all (toplevel,
+ o_font_set->font_prim_objs,
+ NULL, NORMAL_FLAG);
o_complex_set_color(start_of_char, color);
o_scale(toplevel, start_of_char, size/2, size/2);
/* Rotate and translate the character to its world position */
- o_list_rotate_world(toplevel, 0, 0, angle, start_of_char);
- o_list_translate_world(toplevel, x_offset, y_offset, start_of_char);
+ o_glist_rotate_world (toplevel, 0, 0, angle, start_of_char);
+ o_glist_translate_world (toplevel, x_offset, y_offset, start_of_char);
+
+ /* Add the character to the list of prim_objs*/
+ new_obj_list = g_list_concat (new_obj_list, start_of_char);
}
/* Calcule the position of the next character */
@@ -882,10 +856,10 @@ OBJECT *o_text_create_string(TOPLEVEL *toplevel, OBJECT *object_list,
/* Now add the overbar (if it is not a zero length overbar) */
if ((overbar_startx != overbar_endx)
|| (overbar_starty != overbar_endy)) {
- temp_obj = o_line_new(toplevel, OBJ_LINE, color,
+ new_obj = o_line_new (toplevel, OBJ_LINE, color,
overbar_startx, overbar_starty,
overbar_endx, overbar_endy);
- temp_list = s_basic_link_object(temp_obj, temp_list);
+ new_obj_list = g_list_append (new_obj_list, new_obj);
}
}
@@ -940,9 +914,7 @@ OBJECT *o_text_create_string(TOPLEVEL *toplevel, OBJECT *object_list,
}
}
- toplevel->page_current->object_tail = temp_tail;
-
- return object_list;
+ return new_obj_list;
}
/*! \brief Creates a text OBJECT and the graphical objects representing it
@@ -973,7 +945,6 @@ OBJECT *o_text_new(TOPLEVEL *toplevel,
int visibility, int show_name_value)
{
OBJECT *new_node=NULL;
- OBJECT *temp_list=NULL;
TEXT *text;
char *name = NULL;
char *value = NULL;
@@ -1007,12 +978,11 @@ OBJECT *o_text_new(TOPLEVEL *toplevel,
update_disp_string (new_node);
/* now start working on the complex */
- temp_list = o_text_new_head ();
if (visibility == VISIBLE ||
(visibility == INVISIBLE && toplevel->show_hidden_text)) {
new_node->text->prim_objs =
- o_text_create_string(toplevel, temp_list,
+ o_text_create_string (toplevel,
text->disp_string, size, color,
x, y, alignment, angle);
new_node->text->displayed_width = o_text_width(toplevel,
@@ -1022,7 +992,6 @@ OBJECT *o_text_new(TOPLEVEL *toplevel,
new_node->text->prim_objs = NULL;
new_node->text->displayed_width = 0;
new_node->text->displayed_height = 0;
- s_delete(toplevel, temp_list);
}
/* Update bounding box */
@@ -1073,7 +1042,7 @@ void o_text_recalc(TOPLEVEL *toplevel, OBJECT *o_current)
* \param [in] fileformat_ver a integer value of the file format
* \return The object list
*/
-OBJECT *o_text_read(TOPLEVEL *toplevel, OBJECT *object_list,
+OBJECT *o_text_read (TOPLEVEL *toplevel,
const char *first_line,
TextBuffer *tb,
unsigned int release_ver,
@@ -1202,9 +1171,7 @@ OBJECT *o_text_read(TOPLEVEL *toplevel, OBJECT *object_list,
size, visibility, show_name_value);
g_free(string);
- object_list = s_basic_link_object(new_obj, object_list);
-
- return(object_list);
+ return new_obj;
}
/*! \brief read and set infos of a font object
@@ -1341,18 +1308,13 @@ void o_text_recreate(TOPLEVEL *toplevel, OBJECT *o_current)
update_disp_string (o_current);
- o_list_delete_rest (toplevel, text->prim_objs);
+ s_delete_object_glist (toplevel, text->prim_objs);
+ text->prim_objs = NULL;
if (o_current->visibility == VISIBLE ||
(o_current->visibility == INVISIBLE && toplevel->show_hidden_text)) {
- /* need to create that head node if complex is null */
- if (text->prim_objs == NULL) {
- text->prim_objs = o_text_new_head ();
- }
-
text->prim_objs = o_text_create_string (toplevel,
- text->prim_objs,
text->disp_string,
text->size,
o_current->color,
@@ -1370,7 +1332,7 @@ void o_text_recreate(TOPLEVEL *toplevel, OBJECT *o_current)
text->size);
} else {
/* make sure list is truely free */
- s_delete_list_fromstart (toplevel, text->prim_objs);
+ s_delete_object_glist (toplevel, text->prim_objs);
text->prim_objs = NULL;
text->displayed_width = 0;
text->displayed_height = 0;
@@ -1397,7 +1359,7 @@ void o_text_translate_world(TOPLEVEL *toplevel,
o_current->text->x = o_current->text->x + dx;
o_current->text->y = o_current->text->y + dy;
- o_list_translate_world(toplevel, dx, dy, o_current->text->prim_objs);
+ o_glist_translate_world (toplevel, dx, dy, o_current->text->prim_objs);
/* Update bounding box */
o_text_recalc( toplevel, o_current );
@@ -1450,7 +1412,7 @@ static gboolean delete_font_set (gpointer key, gpointer value,
if (tmp != NULL) {
if (tmp->font_prim_objs != NULL) {
- s_delete_list_fromstart (toplevel, tmp->font_prim_objs);
+ s_delete_object_glist (toplevel, tmp->font_prim_objs);
tmp->font_prim_objs = NULL;
}
/* do not use s_delete() as tmp is not fully initialized */
@@ -1852,25 +1814,18 @@ gdouble o_text_shortest_distance(TEXT *text, gint x, gint y)
{
gdouble distance;
gdouble shortest_distance = G_MAXDOUBLE;
- OBJECT *temp;
+ GList *iter;
if (text == NULL) {
g_critical("o_text_shortest_distance(): text == NULL\n");
return G_MAXDOUBLE;
}
- temp = text->prim_objs;
-
- if (temp != NULL) {
- temp = temp->next;
- }
-
- while (temp != NULL) {
- distance = o_shortest_distance(temp, x, y);
-
- shortest_distance = min(shortest_distance, distance);
+ for (iter = text->prim_objs; iter != NULL; iter= g_list_next (iter)) {
+ OBJECT *obj = iter->data;
- temp = temp->next;
+ distance = o_shortest_distance (obj, x, y);
+ shortest_distance = min (shortest_distance, distance);
}
return shortest_distance;
diff --git a/libgeda/src/s_basic.c b/libgeda/src/s_basic.c
index 64b78c0..f337f16 100644
--- a/libgeda/src/s_basic.c
+++ b/libgeda/src/s_basic.c
@@ -62,47 +62,6 @@ void exit_if_null(void *ptr)
}
}
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-/* hack rename this to be s_return_tail */
-/* update object_tail or any list of that matter */
-OBJECT *return_tail(OBJECT *head)
-{
- OBJECT *o_current=NULL;
- OBJECT *ret_struct=NULL;
-
- o_current = head;
- while ( o_current != NULL ) { /* goto end of list */
- ret_struct = o_current;
- o_current = o_current->next;
- }
-
- return(ret_struct);
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-/* hack rename this to be s_return_head */
-/* update object_tail or any list of that matter */
-OBJECT *return_head(OBJECT *tail)
-{
- OBJECT *o_current=NULL;
- OBJECT *ret_struct=NULL;
-
- o_current = tail;
- while ( o_current != NULL ) { /* goto end of list */
- ret_struct = o_current;
- o_current = o_current->prev;
- }
-
- return(ret_struct);
-}
/*! \brief Initialize an already-allocated object.
* \par Function Description
@@ -181,10 +140,6 @@ OBJECT *s_basic_init_object(OBJECT *new_node, int type, char const *name)
new_node->pin_type = PIN_TYPE_NET;
new_node->whichend = -1;
-
- /* Setup link list stuff */
- new_node->prev = NULL;
- new_node->next = NULL;
return(new_node);
}
@@ -205,41 +160,20 @@ OBJECT *s_basic_new_object(char type, char const *prefix)
}
-OBJECT *s_basic_link_object( OBJECT *new_node, OBJECT *ptr )
-{
- /* should never happen, but could */
- if (new_node == NULL) {
- fprintf(stderr, "Got a null new_node in link_object\n");
- return(ptr);
- }
-
- if (ptr == NULL) {
- new_node->prev = NULL; /* setup previous link */
- return(new_node);
- } else {
- new_node->prev = ptr; /* setup previous link */
- ptr->next = new_node;
- return(ptr->next);
- }
-}
-
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
*
*/
-void print_struct_forw(OBJECT *ptr)
+void print_struct_forw (GList *list)
{
OBJECT *o_current=NULL;
+ GList *iter;
- o_current = ptr;
-
- if (o_current == NULL) {
-
- printf("AGGGGGGGGGGG NULLLLL PRINT\n");
- }
+ iter = list;
printf("TRYING to PRINT\n");
- while (o_current != NULL) {
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
printf("Name: %s\n", o_current->name);
printf("Type: %d\n", o_current->type);
printf("Sid: %d\n", o_current->sid);
@@ -251,27 +185,7 @@ void print_struct_forw(OBJECT *ptr)
o_attrib_print (o_current->attribs);
printf("----\n");
- o_current = o_current->next;
- }
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
-void print_struct_back(OBJECT *ptr)
-{
- OBJECT *o_current=NULL;
-
- o_current = ptr;
-
- while (o_current != NULL) {
- printf("Name: %s\n", o_current->name);
- printf("Type: %d\n", o_current->type);
- printf("Sid: %d\n", o_current->sid);
- printf("----\n");
- o_current = o_current->prev;
+ iter = g_list_next (iter);
}
}
@@ -371,10 +285,9 @@ s_delete_object(TOPLEVEL *toplevel, OBJECT *o_current)
if (o_current->text->prim_objs) {
/*printf("sdeleting text complex\n");*/
- s_delete_list_fromstart(toplevel,
- o_current->text->prim_objs);
+ s_delete_object_glist (toplevel, o_current->text->prim_objs);
+ o_current->text->prim_objs = NULL;
}
- o_current->text->prim_objs = NULL;
/* printf("sdeleting text\n");*/
g_free(o_current->text);
@@ -394,10 +307,9 @@ s_delete_object(TOPLEVEL *toplevel, OBJECT *o_current)
if (o_current->complex->prim_objs) {
/* printf("sdeleting complex->primitive_objects\n");*/
- s_delete_list_fromstart(toplevel,
- o_current->complex->prim_objs);
+ s_delete_object_glist (toplevel, o_current->complex->prim_objs);
+ o_current->complex->prim_objs = NULL;
}
- o_current->complex->prim_objs = NULL;
g_free(o_current->complex);
o_current->complex = NULL;
@@ -430,12 +342,6 @@ s_delete(TOPLEVEL *toplevel, OBJECT *o_current)
printf("sdel: %d\n", o_current->sid);
#endif
- if (o_current->next)
- o_current->next->prev = o_current->prev;
-
- if (o_current->prev)
- o_current->prev->next = o_current->next;
-
s_delete_object(toplevel, o_current);
}
}
@@ -445,29 +351,6 @@ s_delete(TOPLEVEL *toplevel, OBJECT *o_current)
* \par Function Description
*
*/
-/* deletes everything include the head */
-void s_delete_list_fromstart(TOPLEVEL *toplevel, OBJECT *start)
-{
- OBJECT *temp=NULL; /* literally is a temp */
- OBJECT *current=NULL; /* ugg... you have both o_current and current? */
- OBJECT *o_current=NULL; /* hack */
-
- temp = start;
- current = return_tail(start);
-
- /* do the delete backwards */
- while(current != NULL) {
- o_current = current->prev;
- s_delete(toplevel, current);
- current = o_current;
- }
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
- *
- */
/* deletes everything include the GList */
void
s_delete_object_glist(TOPLEVEL *toplevel, GList *list)
@@ -490,38 +373,6 @@ s_delete_object_glist(TOPLEVEL *toplevel, GList *list)
/*! \todo Finish function documentation!!!
* \brief
* \par Function Description
- * This function removes one object pointed by parameter <B>object</B> from
- * a list as far as it does not represents a head. If so the function returns
- * NULL. If not it returns the pointer on the object, i.e. the same as the
- * parameter.
- *
- * This function must be followed by a call to #return_tail() on the
- * list it belonged to as it can be the last object. Therefore the tail
- * of the list is modified.
- *
- * \param [in] toplevel The TOPLEVEL object.
- * \param [in] object
- * \return OBJECT *
- */
-OBJECT *s_remove(TOPLEVEL *toplevel, OBJECT *object)
-{
- if(object->type == OBJ_HEAD)
- return NULL;
-
- if(object->prev != NULL)
- object->prev->next = object->next;
- if(object->next != NULL)
- object->next->prev = object->prev;
-
- object->next = NULL;
- object->prev = NULL;
-
- return object;
-}
-
-/*! \todo Finish function documentation!!!
- * \brief
- * \par Function Description
*
*/
/* used by o_text_read */
diff --git a/libgeda/src/s_clib.c b/libgeda/src/s_clib.c
index fef4e71..48a0ff3 100644
--- a/libgeda/src/s_clib.c
+++ b/libgeda/src/s_clib.c
@@ -1437,6 +1437,7 @@ GList *s_toplevel_get_symbols (const TOPLEVEL *toplevel)
GList *symlist = NULL;
CLibSymbol *sym = NULL;
const GList *p_iter;
+ const GList *o_iter;
g_return_val_if_fail ((toplevel != NULL), NULL);
@@ -1444,7 +1445,10 @@ GList *s_toplevel_get_symbols (const TOPLEVEL *toplevel)
p_iter != NULL;
p_iter = g_list_next( p_iter )) {
page = (PAGE *)p_iter->data;
- for (o = page->object_head; o != NULL; o = o->next) {
+ for (o_iter = page->object_list;
+ o_iter != NULL;
+ o_iter = g_list_next (o_iter)) {
+ o = (OBJECT *)o_iter->data;
if (o->type != OBJ_COMPLEX) continue;
if (o->complex_basename == NULL) continue;
diff --git a/libgeda/src/s_conn.c b/libgeda/src/s_conn.c
index 655cb48..18dd0ed 100644
--- a/libgeda/src/s_conn.c
+++ b/libgeda/src/s_conn.c
@@ -225,13 +225,15 @@ void s_conn_remove(TOPLEVEL * toplevel, OBJECT * to_remove)
void s_conn_remove_complex(TOPLEVEL * toplevel, OBJECT * to_remove)
{
OBJECT *o_current;
-
+ GList *iter;
+
if (to_remove->type != OBJ_COMPLEX && to_remove->type != OBJ_PLACEHOLDER) {
return;
}
- o_current = to_remove->complex->prim_objs;
- while (o_current != NULL) {
+ iter = to_remove->complex->prim_objs;
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
switch (o_current->type) {
case (OBJ_NET):
case (OBJ_PIN):
@@ -240,9 +242,8 @@ void s_conn_remove_complex(TOPLEVEL * toplevel, OBJECT * to_remove)
break;
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
-
}
/*! \brief Checks if a point is a midpoint of an OBJECT
@@ -715,12 +716,14 @@ void s_conn_update_object(TOPLEVEL * toplevel, OBJECT * object)
* \param toplevel (currently not used)
* \param complex complex OBJECT to add into the connection system
*/
-void s_conn_update_complex(TOPLEVEL * toplevel, OBJECT * complex)
+void s_conn_update_complex (TOPLEVEL * toplevel, GList* list)
{
OBJECT *o_current;
+ GList *iter;
- o_current = complex;
- while (o_current != NULL) {
+ iter = list;
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
switch (o_current->type) {
case (OBJ_PIN):
case (OBJ_NET):
@@ -729,7 +732,7 @@ void s_conn_update_complex(TOPLEVEL * toplevel, OBJECT * complex)
break;
}
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
}
@@ -851,6 +854,7 @@ GList *s_conn_return_complex_others(GList *input_list, OBJECT *object)
CONN *conn;
GList *cl_current;
GList *return_list=NULL;
+ GList *iter;
if (object->type != OBJ_COMPLEX && object->type != OBJ_PLACEHOLDER) {
return(NULL);
@@ -858,8 +862,9 @@ GList *s_conn_return_complex_others(GList *input_list, OBJECT *object)
return_list = input_list;
- o_current = object->complex->prim_objs;
- while(o_current != NULL) {
+ iter = object->complex->prim_objs;
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
cl_current = o_current->conn_list;
while (cl_current != NULL) {
@@ -871,8 +876,7 @@ GList *s_conn_return_complex_others(GList *input_list, OBJECT *object)
cl_current = g_list_next(cl_current);
}
-
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
return(return_list);
diff --git a/libgeda/src/s_cue.c b/libgeda/src/s_cue.c
index 20a9074..b85b108 100644
--- a/libgeda/src/s_cue.c
+++ b/libgeda/src/s_cue.c
@@ -87,13 +87,15 @@ void s_cue_postscript_fillcircle(TOPLEVEL * toplevel, FILE * fp,
* \par Function Description
*
*/
-void s_cue_output_all(TOPLEVEL * toplevel, OBJECT * head, FILE * fp,
- int type)
+void s_cue_output_all (TOPLEVEL * toplevel, GList *obj_list, FILE * fp,
+ int type)
{
OBJECT *o_current;
+ GList *iter;
- o_current = head;
- while (o_current != NULL) {
+ iter = obj_list;
+ while (iter != NULL) {
+ o_current = (OBJECT *)iter->data;
switch (o_current->type) {
case (OBJ_NET):
case (OBJ_BUS):
@@ -108,8 +110,7 @@ void s_cue_output_all(TOPLEVEL * toplevel, OBJECT * head, FILE * fp,
break;
}
-
- o_current = o_current->next;
+ iter = g_list_next (iter);
}
}
diff --git a/libgeda/src/s_hierarchy.c b/libgeda/src/s_hierarchy.c
index 59b4f97..c0b1ebc 100644
--- a/libgeda/src/s_hierarchy.c
+++ b/libgeda/src/s_hierarchy.c
@@ -212,6 +212,7 @@ GList *s_hierarchy_traversepages(TOPLEVEL *toplevel,
char *filename = NULL;
gint page_control = 0;
static GList *pages = NULL;
+ GList *iter;
/* init static variables the first time*/
if (!(flags & HIERARCHY_INNERLOOP)) {
@@ -231,9 +232,10 @@ GList *s_hierarchy_traversepages(TOPLEVEL *toplevel,
}
/* walk throught the page objects and search for underlaying schematics */
- for (o_current = p_current->object_head;
- o_current != NULL ;
- o_current = o_current->next) {
+ for (iter = p_current->object_list;
+ iter != NULL ;
+ iter = g_list_next (iter)) {
+ o_current = (OBJECT *)iter->data;
/* only complex things like symbols can contain attributes */
if (o_current->type == OBJ_COMPLEX) {
diff --git a/libgeda/src/s_page.c b/libgeda/src/s_page.c
index 4c87932..0aa3e29 100644
--- a/libgeda/src/s_page.c
+++ b/libgeda/src/s_page.c
@@ -96,8 +96,8 @@ PAGE *s_page_new (TOPLEVEL *toplevel, const gchar *filename)
/* Init tile array */
s_tile_init (toplevel, page);
- /* First one to setup head */
- page->object_head = s_basic_new_object(OBJ_HEAD, "object_head");
+ /* Init the object list */
+ page->object_list = NULL;
/* new selection mechanism */
page->selection_list = o_selection_new();
@@ -107,9 +107,6 @@ PAGE *s_page_new (TOPLEVEL *toplevel, const gchar *filename)
page->place_list = NULL;
- /* do this just to be sure that object tail is truely correct */
- page->object_tail = return_tail(page->object_head);
-
/* init undo struct pointers */
s_undo_init(page);
@@ -192,7 +189,8 @@ void s_page_delete (TOPLEVEL *toplevel, PAGE *page)
g_object_unref( page->selection_list );
/* then delete objects of page */
- s_delete_list_fromstart (toplevel, page->object_head);
+ s_delete_object_glist (toplevel, page->object_list);
+ page->object_list = NULL;
/* Free the objects in the place list. */
s_delete_object_glist (toplevel, page->place_list);
@@ -352,7 +350,7 @@ void s_page_print_all (TOPLEVEL *toplevel)
page = (PAGE *)iter->data;
printf ("FILENAME: %s\n", page->page_filename);
- print_struct_forw (page->object_head);
+ print_struct_forw (page->object_list);
}
}
@@ -523,5 +521,5 @@ gint s_page_autosave (TOPLEVEL *toplevel)
*/
void s_page_append (PAGE *page, OBJECT *object)
{
- page->object_tail = s_basic_link_object(object, page->object_tail);
+ page->object_list = g_list_append (page->object_list, object);
}
diff --git a/libgeda/src/s_undo.c b/libgeda/src/s_undo.c
index 5fce02d..0a99bf6 100644
--- a/libgeda/src/s_undo.c
+++ b/libgeda/src/s_undo.c
@@ -84,7 +84,7 @@ UNDO *s_undo_new_head(void)
u_new = (UNDO *) g_malloc(sizeof(UNDO));
u_new->type = -1;
u_new->filename = NULL;
- u_new->object_head = NULL;
+ u_new->object_list = NULL;
u_new->left = u_new->right = u_new->top = u_new->bottom = -1;
u_new->page_control = 0;
@@ -111,7 +111,7 @@ void s_undo_destroy_head(UNDO *u_head)
* \par Function Description
*
*/
-UNDO *s_undo_add(UNDO *head, int type, char *filename, OBJECT *object_head,
+UNDO *s_undo_add (UNDO *head, int type, char *filename, GList *object_list,
int left, int top, int right, int bottom, int page_control,
int up)
{
@@ -122,11 +122,7 @@ UNDO *s_undo_add(UNDO *head, int type, char *filename, OBJECT *object_head,
u_new->filename = g_strdup (filename);
- if (object_head != NULL) {
- u_new->object_head = object_head;
- } else {
- u_new->object_head = NULL;
- }
+ u_new->object_list = object_list;
u_new->type = type;
@@ -168,9 +164,8 @@ void s_undo_print_all( UNDO *head )
if (u_current->filename) printf("%s\n", u_current->filename);
- if (u_current->object_head) {
- printf("%s\n", u_current->object_head->name);
- print_struct_forw(u_current->object_head);
+ if (u_current->object_list) {
+ print_struct_forw (u_current->object_list);
}
printf("\t%d %d %d %d\n", u_current->left, u_current->top,
@@ -200,10 +195,9 @@ void s_undo_destroy_all(TOPLEVEL *toplevel, UNDO *head)
u_prev = u_current->prev;
g_free(u_current->filename);
- if (u_current->object_head) {
- s_delete_list_fromstart(toplevel,
- u_current->object_head);
- u_current->object_head = NULL;
+ if (u_current->object_list) {
+ s_delete_object_glist (toplevel, u_current->object_list);
+ u_current->object_list = NULL;
}
g_free(u_current);
@@ -241,10 +235,9 @@ void s_undo_remove(TOPLEVEL *toplevel, UNDO *head, UNDO *u_tos)
g_free(u_current->filename);
- if (u_current->object_head) {
- s_delete_list_fromstart(toplevel,
- u_current->object_head);
- u_current->object_head = NULL;
+ if (u_current->object_list) {
+ s_delete_object_glist (toplevel, u_current->object_list);
+ u_current->object_list = NULL;
}
g_free(u_current);
@@ -274,10 +267,9 @@ void s_undo_remove_rest(TOPLEVEL *toplevel, UNDO *head)
g_free(u_current->filename);
}
- if (u_current->object_head) {
- s_delete_list_fromstart(toplevel,
- u_current->object_head);
- u_current->object_head = NULL;
+ if (u_current->object_list) {
+ s_delete_object_glist (toplevel, u_current->object_list);
+ u_current->object_list = NULL;
}
g_free(u_current);
@@ -297,7 +289,7 @@ int s_undo_levels(UNDO *head)
u_current = head;
while (u_current != NULL) {
- if (u_current->filename || u_current->object_head) {
+ if (u_current->filename || u_current->object_list) {
count++;
}
diff --git a/utils/gschlas/s_util.c b/utils/gschlas/s_util.c
index 6944026..a202556 100644
--- a/utils/gschlas/s_util.c
+++ b/utils/gschlas/s_util.c
@@ -45,18 +45,17 @@
void
s_util_embed(TOPLEVEL *pr_current, int embed_mode)
{
- GList *iter;
- PAGE *p_current;
- OBJECT *o_current;
+ GList *p_iter, *o_iter;
- for ( iter = geda_list_get_glist( pr_current->pages );
- iter != NULL;
- iter = g_list_next( iter ) ) {
+ for (p_iter = geda_list_get_glist (pr_current->pages);
+ p_iter != NULL;
+ p_iter = g_list_next (p_iter)) {
+ PAGE *p_current = p_iter->data;
- p_current = (PAGE *)iter->data;
-
- o_current = p_current->object_head;
- while (o_current != NULL) {
+ for (o_iter = p_current->object_list;
+ o_iter != NULL;
+ o_iter = g_list_next (o_iter)) {
+ OBJECT *o_current = o_iter->data;
if (o_current->type == OBJ_COMPLEX ||
o_current->type == OBJ_PICTURE) {
@@ -66,7 +65,6 @@ s_util_embed(TOPLEVEL *pr_current, int embed_mode)
o_unembed(pr_current, o_current);
}
}
- o_current = o_current->next;
}
}
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs