[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: globals.c
User: pcjc2
Date: 07/02/11 18:58:21
Modified: . Tag: noscreen globals.c i_basic.c listsort.c
s_string_list.c s_toplevel.c s_visibility.c
x_gtksheet.c x_window.c
Log:
Sync with trunc
Revision Changes Path
No revision
No revision
1.4.6.1 +0 -1 eda/geda/gaf/gattrib/src/globals.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: globals.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/globals.c,v
retrieving revision 1.4
retrieving revision 1.4.6.1
diff -u -b -r1.4 -r1.4.6.1
--- globals.c 27 Nov 2005 00:15:00 -0000 1.4
+++ globals.c 11 Feb 2007 23:58:20 -0000 1.4.6.1
@@ -61,7 +61,6 @@
void (*pin_draw_func)() = NULL;
void (*select_func)() = s_toplevel_select_object;
void (*x_log_update_func)() = NULL;
-void (*quit_func)() = gattrib_quit;
void (*variable_set_func)() = i_vars_set;
int (*load_newer_backup_func)() = NULL;
1.2.6.1 +2 -0 eda/geda/gaf/gattrib/src/i_basic.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: i_basic.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/i_basic.c,v
retrieving revision 1.2
retrieving revision 1.2.6.1
diff -u -b -r1.2 -r1.2.6.1
--- i_basic.c 5 Feb 2005 16:03:53 -0000 1.2
+++ i_basic.c 11 Feb 2007 23:58:20 -0000 1.2.6.1
@@ -45,6 +45,7 @@
/* ------------------------------------------------------------- *
*
* ------------------------------------------------------------- */
+#if 0 /* not used, but leaving it here in case we need it later */
static void i_update_status(TOPLEVEL * w_current, const char *string)
{
if (!w_current->status_label) {
@@ -57,6 +58,7 @@
gtk_label_set(GTK_LABEL(w_current->status_label), (char *) string);
}
}
+#endif
/* ------------------------------------------------------------- *
1.4.6.1 +32 -3 eda/geda/gaf/gattrib/src/listsort.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: listsort.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/listsort.c,v
retrieving revision 1.4
retrieving revision 1.4.6.1
diff -u -b -r1.4 -r1.4.6.1
--- listsort.c 21 Feb 2005 05:29:33 -0000 1.4
+++ listsort.c 11 Feb 2007 23:58:20 -0000 1.4.6.1
@@ -1,4 +1,4 @@
-/* $Id: listsort.c,v 1.4 2005/02/21 05:29:33 danmc Exp $ */
+/* $Id: listsort.c,v 1.4.6.1 2007/02/11 23:58:20 pcjc2 Exp $ */
/*----------------------------------------------------------------*
@@ -56,6 +56,7 @@
#endif
#include <stdio.h>
+#include <ctype.h>
#ifdef HAVE_STRING_H
#include <string.h>
@@ -77,8 +78,36 @@
/*----------------------------------------------------------------*
* Comparison function -- compare values of string data.
*----------------------------------------------------------------*/
-int cmp(STRING_LIST *a, STRING_LIST *b) {
- return strcmp(a->data, b->data);
+int cmp(STRING_LIST *al, STRING_LIST *bl) {
+ char *a = al->data;
+ char *b = bl->data;
+
+ if (al->pos != bl->pos)
+ return al->pos - bl->pos;
+
+ while (*a && *b)
+ {
+ if (isdigit ((int) *a) && isdigit ((int) *b))
+ {
+ int ia = atoi (a);
+ int ib = atoi (b);
+ if (ia != ib)
+ return ia - ib;
+ while (isdigit ((int) *a))
+ a++;
+ while (isdigit ((int) *b))
+ b++;
+ }
+ else if (tolower (*a) != tolower (*b))
+ return tolower (*a) - tolower (*b);
+ a++;
+ b++;
+ }
+ if (*a)
+ return 1;
+ if (*b)
+ return -1;
+ return 0;
}
/*----------------------------------------------------------------*
1.7.6.1 +37 -5 eda/geda/gaf/gattrib/src/s_string_list.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: s_string_list.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/s_string_list.c,v
retrieving revision 1.7
retrieving revision 1.7.6.1
diff -u -b -r1.7 -r1.7.6.1
--- s_string_list.c 26 Jul 2006 22:56:39 -0000 1.7
+++ s_string_list.c 11 Feb 2007 23:58:20 -0000 1.7.6.1
@@ -310,10 +310,12 @@
*------------------------------------------------------------------*/
void s_string_list_sort_master_comp_list() {
int i = 0;
- STRING_LIST *local_list;
+ STRING_LIST *local_list, *p;
/* Here's where we do the sort. The sort is done using a fcn found on the web. */
local_list = sheet_head->master_comp_list_head;
+ for (p=local_list; p; p=p->next)
+ p->pos = 0;
local_list = listsort(local_list, 0, 1);
/* Do this after sorting is done. This resets the order of the individual items
@@ -345,21 +347,49 @@
* Right now it does nothing other than fill in the "position"
* and "length" variables.
*------------------------------------------------------------------*/
+
+/* This list overrides the alphanumeric sort. Attribs not found in
+ this list are sorted as if they had a value of DEFAULT_ATTRIB_POS
+ within this list, but alphanumerically relative to each other. */
+static struct {
+ const char *attrib;
+ int pos;
+} certain_attribs[] = {
+ {"device", 1},
+ {"footprint", 2},
+ {"value", 3},
+ {"symversion", 200}
+};
+#define NUM_CERTAINS (sizeof(certain_attribs)/sizeof(certain_attribs[0]))
+#define DEFAULT_ATTRIB_POS 100
+
void s_string_list_sort_master_comp_attrib_list() {
int i = 0;
- STRING_LIST *local_list;
+ STRING_LIST *local_list, *p;
/* Here's where we do the sort */
+ local_list = sheet_head->master_comp_attrib_list_head;
/*
* Note that this sort is TBD -- it is more than just an alphabetic sort 'cause we want
* certain attribs to go first.
*/
+ for (p=local_list; p; p=p->next) {
+ int i;
+ p->pos = DEFAULT_ATTRIB_POS;
+ for (i=0; i<NUM_CERTAINS; i++)
+ if (strcmp (certain_attribs[i].attrib, p->data) == 0)
+ {
+ p->pos = certain_attribs[i].pos;
+ break;
+ }
+ }
+ local_list = listsort(local_list, 0, 1);
+ sheet_head->master_comp_attrib_list_head = local_list;
/* Do this after sorting is done. This resets the order of the individual items
* in the list. */
- local_list = sheet_head->master_comp_attrib_list_head;
while (local_list != NULL) {
local_list->pos = i;
i++;
@@ -423,10 +453,12 @@
*------------------------------------------------------------------*/
void s_string_list_sort_master_pin_list() {
int i = 0;
- STRING_LIST *local_list;
+ STRING_LIST *local_list, *p;
/* Here's where we do the sort. The sort is done using a fcn found on the web. */
local_list = sheet_head->master_pin_list_head;
+ for (p=local_list; p; p=p->next)
+ p->pos = 0;
local_list = listsort(local_list, 0, 1);
/* Do this after sorting is done. This resets the order of the individual items
1.22.6.1 +41 -21 eda/geda/gaf/gattrib/src/s_toplevel.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: s_toplevel.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/s_toplevel.c,v
retrieving revision 1.22
retrieving revision 1.22.6.1
diff -u -b -r1.22 -r1.22.6.1
--- s_toplevel.c 30 Sep 2006 13:44:56 -0000 1.22
+++ s_toplevel.c 11 Feb 2007 23:58:20 -0000 1.22.6.1
@@ -1,4 +1,4 @@
-/* $Id: s_toplevel.c,v 1.22 2006/09/30 13:44:56 sdb Exp $ */
+/* $Id: s_toplevel.c,v 1.22.6.1 2007/02/11 23:58:20 pcjc2 Exp $ */
/* gEDA - GPL Electronic Design Automation
* gattrib -- gEDA component and net attribute manipulation using spreadsheet.
@@ -201,7 +201,7 @@
printf("In s_toplevel_menubar_file_save, about to save out the project\n");
#endif
- s_toplevel_gtksheet_to_toplevel();
+ s_toplevel_gtksheet_to_toplevel(); /* Dumps sheet data into TOPLEVEL */
s_page_save_all(pr_current); /* saves all pages in design */
sheet_head->CHANGED = FALSE;
@@ -721,8 +721,10 @@
ATTRIB *a_current;
int count = 0; /* This is to fake out a fcn called later */
gint row, col;
- gint visibility;
- gint show_name_value;
+ gint visibility = 0;
+ gint show_name_value = 0;
+
+ gint status;
#if DEBUG
printf("----- Entering s_toplevel_update_component_attribs_in_toplevel.\n");
@@ -746,7 +748,18 @@
&& a_current->object->text != NULL) { /* found a name=value attribute pair. */
/* may need to check more thoroughly here. . . . */
old_name_value_pair = g_strdup(a_current->object->text->string);
+
+ /* Else clause is suggestion from Ales */
+#if 1
old_attrib_name = u_basic_breakup_string(old_name_value_pair, '=', 0);
+ if ( (strcmp(old_attrib_name, "refdes") != 0) &&
+ (strcmp(old_attrib_name, "slot") != 0) &&
+ (s_attrib_name_in_list(new_comp_attrib_list, old_attrib_name) == FALSE) ) {
+ s_string_list_add_item(complete_comp_attrib_list, &count, old_name_value_pair);
+ }
+#else
+ status = o_attrib_get_name_value(old_name_value_pair, &old_attrib_name, &old_attrib_value);
+ if (status == 0) {
/* Don't put "refdes" or "slot" into list. Don't put old name=value pair into list if a new
* one is already in there. */
if ( (strcmp(old_attrib_name, "refdes") != 0) &&
@@ -754,6 +767,10 @@
(s_attrib_name_in_list(new_comp_attrib_list, old_attrib_name) == FALSE) ) {
s_string_list_add_item(complete_comp_attrib_list, &count, old_name_value_pair);
}
+ if (old_attrib_name) g_free (old_attrib_name);
+ if (old_attrib_value) g_free (old_attrib_value);
+ }
+ #endif
g_free(old_name_value_pair);
g_free(old_attrib_name);
}
@@ -785,6 +802,7 @@
* and value from o_current */
old_attrib_name = u_basic_breakup_string(local_list->data, '=', 0);
old_attrib_value = o_attrib_search_name_single_count(o_current, old_attrib_name, 0);
+
#if DEBUG
printf(" In s_toplevel_update_component_attribs_in_toplevel, old name = \"%s\" .\n",
old_attrib_name);
@@ -792,7 +810,6 @@
old_attrib_value);
#endif
-
/* Next try to get this attrib from new_comp_attrib_list */
new_attrib_name = u_basic_breakup_string(local_list->data, '=', 0);
if (s_string_list_in_list(new_comp_attrib_list, local_list->data)) {
@@ -1027,6 +1044,8 @@
char *new_attrib_value;
char *old_attrib_value;
+ gint status;
+
#if DEBUG
printf("----- Entering s_toplevel_update_pin_attribs_in_toplevel.\n");
#endif
@@ -1038,9 +1057,10 @@
#if DEBUG
printf(" In s_toplevel_update_pin_attribs_in_toplevel, handling entry in master list %s .\n", new_name_value_pair);
#endif
+
new_attrib_name = u_basic_breakup_string(new_name_value_pair, '=', 0);
- new_attrib_value = u_basic_breakup_string(new_name_value_pair, '=', 1); /* don't use s_misc_remaining_string
- * since pinattribs are only foo=bar. */
+ new_attrib_value = u_basic_breakup_string(new_name_value_pair, '=', 1);
+
if (strlen(new_attrib_value) == 0) {
if (new_attrib_value != NULL)
g_free(new_attrib_value);
1.3.6.1 +1 -1 eda/geda/gaf/gattrib/src/s_visibility.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: s_visibility.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/s_visibility.c,v
retrieving revision 1.3
retrieving revision 1.3.6.1
diff -u -b -r1.3 -r1.3.6.1
--- s_visibility.c 12 Aug 2006 18:58:48 -0000 1.3
+++ s_visibility.c 11 Feb 2007 23:58:20 -0000 1.3.6.1
@@ -339,7 +339,7 @@
void s_visibility_set_cell(gint cur_page, gint row, gint col,
gint visibility,
gint show_name_value) {
- TABLE **local_table;
+ TABLE **local_table = NULL;
#ifdef DEBUG
printf("In s_visibility_set_cell, setting row = %d, col = %d.\n",
1.12.6.1 +1 -1 eda/geda/gaf/gattrib/src/x_gtksheet.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_gtksheet.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/x_gtksheet.c,v
retrieving revision 1.12
retrieving revision 1.12.6.1
diff -u -b -r1.12 -r1.12.6.1
--- x_gtksheet.c 16 Sep 2006 11:37:03 -0000 1.12
+++ x_gtksheet.c 11 Feb 2007 23:58:20 -0000 1.12.6.1
@@ -651,7 +651,7 @@
{
gchar *text;
GtkSheet *sheet;
- GtkWidget *sheet_entry;
+ GtkWidget *sheet_entry = NULL;
gint cur_page;
#ifdef DEBUG
1.12.6.1 +3 -3 eda/geda/gaf/gattrib/src/x_window.c
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_window.c
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/gaf/gattrib/src/x_window.c,v
retrieving revision 1.12
retrieving revision 1.12.6.1
diff -u -b -r1.12 -r1.12.6.1
--- x_window.c 16 Sep 2006 11:37:03 -0000 1.12
+++ x_window.c 11 Feb 2007 23:58:20 -0000 1.12.6.1
@@ -248,7 +248,7 @@
error_string = g_strconcat(error_string,
"Do you have refdeses on your components? \n", NULL);
error_string = g_strconcat(error_string,
- "Exiting. . . .\n");
+ "Exiting. . . .\n", NULL);
fprintf(stderr, "%s", error_string);
x_dialog_exit_announcement(error_string, -1);
g_free(error_string);
@@ -259,7 +259,7 @@
error_string = g_strdup("\n\nNo configurable component attributes found in entire design! ");
error_string = g_strconcat(error_string,
"Please attach at least some attributes before running gattrib.\n", NULL);
- error_string = g_strconcat(error_string, "Exiting. . . .\n");
+ error_string = g_strconcat(error_string, "Exiting. . . .\n", NULL);
fprintf(stderr, "%s", error_string);
x_dialog_exit_announcement(error_string, -2);
g_free(error_string);
@@ -270,7 +270,7 @@
if (sheet_head->pin_count == 0) {
error_string = g_strdup("\n\nNo pins found on any components! ");
error_string = g_strconcat(error_string, "Please check your design.\n", NULL);
- error_string = g_strconcat(error_string, "Exiting. . . .\n");
+ error_string = g_strconcat(error_string, "Exiting. . . .\n", NULL);
fprintf(stderr, "%s", error_string);
x_dialog_exit_announcement(error_string, -3);
g_free(error_string);
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs