[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: gEDA-user: gschem and CVS
- To: geda-user@seul.org
- Subject: Re: gEDA-user: gschem and CVS
- From: Richard Prescott <richard@ltrim.com>
- Date: 01 Dec 2004 19:12:01 -0500
- Delivered-to: archiver@seul.org
- Delivered-to: geda-user-outgoing@seul.org
- Delivered-to: geda-user@seul.org
- Delivery-date: Wed, 01 Dec 2004 19:16:03 -0500
- In-reply-to: <af89664604113014207d9a5c09@mail.gmail.com>
- References: <1101845687.2146.1220.camel@richard> <20041130214801.360882AA07@earl-grey.cloud9.net> <af89664604113014207d9a5c09@mail.gmail.com>
- Reply-to: geda-user@seul.org
- Sender: owner-geda-user@seul.org
On Tue, 2004-11-30 at 17:20, Charles Lepple wrote:
>
> Think of the difference between raw diff output, and viewcvs's color coding.
>
> In a schematic, you could have the graphical equivalent of "change
> bars" by changing the background color where parts of the schematic
> have changed.
>
> This could be a little different than what Richard is thinking, but I
> agree that the basic concept would be a handy addition. Then again,
> it's probably not a walk in the park to code, either. (/me mumbles
> something about Python and wanders off...)
>
To be more clear: what I was thinking of is pretty close to kdiff, 2way
merge in xemacs and so on. So: Three schematic frame, two on the top
one on the bottom. Next to the bottom one, it would be nice to have a
selectable list of changes plus some buttons such as "Next changes" and
"Accept A"/"Accept B". Ones on the top presenting version A and version
B, where (let's say)
removals is represented by a dark grey background,
additions as dark green background,
repositionning as dark blue,
conflicts in dark red and
changes in brown.
As opposed to unix diff, this diff should gives *logical* difference
indepandently of the order of appearance in source. But as opposed to
LVS, it should show off changes in comments and esthetic reorganisation.
There is probably someone here that know enough the source to build the
two/three frames on invocation such as :
gschem --diff fileA fileB
and
gschem --merge fileA fileB result
????
Anyway, here is my patch in attchmt a propos of CVS log.
diff -urN libgeda-20040111.orig/include/o_types.h libgeda-20040111/include/o_types.h
--- libgeda-20040111.orig/include/o_types.h 2004-01-11 21:15:09.000000000 -0500
+++ libgeda-20040111/include/o_types.h 2004-12-01 19:11:49.000000000 -0500
@@ -30,6 +30,8 @@
#define OBJ_BUS 'U'
#define OBJ_COMPLEX 'C'
#define OBJ_TEXT 'T'
+#define OBJ_INTEXT 't'
+#define OBJ_EOT 'e'
#define OBJ_PIN 'P'
#define OBJ_ARC 'A'
#define OBJ_ROUTE 'R'
diff -urN libgeda-20040111.orig/noweb/o_text_basic.nw libgeda-20040111/noweb/o_text_basic.nw
--- libgeda-20040111.orig/noweb/o_text_basic.nw 2004-01-11 18:08:45.000000000 -0500
+++ libgeda-20040111/noweb/o_text_basic.nw 2004-12-01 19:11:26.000000000 -0500
@@ -648,7 +648,7 @@
@section Function @code{o_text_height()}
@defun o_text_height size
-You do not need to divide the size in half here.
+//You do not need to divide the size in half here.
@end defun
<<o_text_basic.c : o_text_height()>>=
@@ -678,7 +678,7 @@
@section Function @code{o_text_width()}
@defun o_text_width w_current string size
-You need to divide the size in half here. FIXME consistancy.
+//You need to divide the size in half here. FIXME consistancy.
@end defun
<<o_text_basic.c : o_text_width()>>=
@@ -1277,12 +1277,21 @@
char* string = NULL;
char* temp = NULL;
char buffer[MAX_TEXT_LINE_LENGTH];
+ int variable_num_lines = 0, eot = 0;
if (fileformat_ver == 1) {
- sscanf(buf, "%c %d %d %d %d %d %d %d %d %d\n", &type, &x, &y,
+ if(sscanf(buf, "%c %d %d %d %d %d %d %d %d %d\n", &type, &x, &y,
&color, &size,
&visibility, &show_name_value,
- &angle, &alignment, &num_lines);
+ &angle, &alignment, &num_lines) != 10)
+ {
+ sscanf(buf, "%c %d %d %d %d %d %d %d %d var\n", &type, &x, &y,
+ &color, &size,
+ &visibility, &show_name_value,
+ &angle, &alignment);
+ num_lines = 0;
+ variable_num_lines = 1;
+ }
} else if (release_ver < VERSION_20000220) {
/* yes, above less than (not less than and equal) is correct. The format */
/* change occurred in 20000220 */
@@ -1300,7 +1309,7 @@
num_lines = 1; /* only support a single line */
}
- if (size == 0) {
+ if (size == 0 && !variable_num_lines) {
fprintf(stderr, "Found a zero size text string [ %c %d %d %d %d %d %d %d %d ]\n", type, x, y, color, size, visibility, show_name_value, angle, alignment);
s_log_message("Found a zero size text string [ %c %d %d %d %d %d %d %d %d ]\n", type, x, y, color, size, visibility, show_name_value, angle, alignment);
}
@@ -1356,8 +1365,36 @@
}
#endif
- assert(num_lines && num_lines > 0);
- for (i = 0; i < num_lines; i++)
+ assert(num_lines || variable_num_lines);
+ if(variable_num_lines)
+ {
+ do
+ {
+ fgets(buffer, 1024, fp);
+
+ if(buffer[0] == OBJ_INTEXT && buffer[1] == ' ')
+ {
+ if (string == 0) {
+ string = u_basic_strdup(buffer+2);
+ } else {
+ temp = u_basic_strdup_multiple(string, buffer+2, NULL);
+ free(string);
+ string = temp;
+ }
+ num_lines++;
+ }
+ else if(buffer[0] == OBJ_EOT)
+ {
+ eot = 1;
+ }
+ else
+ {
+ s_log_message("Found neither 't' or 'e' in variable length text object\n");
+ }
+ } while(!eot);
+
+ }
+ else for (i = 0; i < num_lines; i++)
{
fgets(buffer, 1024, fp);
@@ -1443,6 +1480,9 @@
char *string;
char *buf;
int num_lines;
+ int len;
+ char *single_line;
+ int i, j, k, l;
x = object->text->x;
y = object->text->y;
@@ -1460,10 +1500,66 @@
/* string can have multiple lines (seperated by \n's) */
num_lines = o_text_num_lines(string);
- buf = g_strdup_printf("%c %d %d %d %d %d %d %d %d %d\n%s", object->type,
+ if(num_lines == 1)
+ {
+ buf = g_strdup_printf("%c %d %d %d %d %d %d %d %d %d\n%s", object->type,
+ x, y, color, size, object->visibility,
+ object->show_name_value, object->text->angle,
+ object->text->alignment, num_lines, string);
+
+ return(buf);
+ }
+
+ buf = g_strdup_printf("%c %d %d %d %d %d %d %d %d var\n", object->type,
x, y, color, size, object->visibility,
object->show_name_value, object->text->angle,
- object->text->alignment, num_lines, string);
+ object->text->alignment, num_lines);
+
+
+ /*
+ * increase the size of buf to contain string
+ * "t " at the beginning of every line
+ * "e\n" at the end of all lines
+ */
+ len = strlen(string);
+ len = strlen(buf) +
+ 2*num_lines /* strcat("t ",line) */ +
+ 2 /* "e\n" */ +
+ len;
+
+ buf = g_realloc(buf,len+2); /* 2 = 1 for '\0' and 1 for possible missing '\n' */
+
+ /* break up the string */
+ single_line = u_basic_strdup(string); /* larger than needed */
+ len = strlen(string);
+ for (k = 0, l = 0; l < num_lines; l++)
+ {
+ j = 0;
+ /* break up the string into lines */
+ for (i = k; i < len; i++)
+ {
+ if (string[i] != '\n' && string[i] != '\0')
+ {
+ single_line[j] = string[i];
+ }
+ else
+ {
+ k = i + 1;
+ break;
+ }
+ j++;
+ }
+ single_line[j] = '\0';
+
+ /* it is possible to speed things here but perf isn't an issue yet AFAIK */
+ if(single_line[0] != '\0')
+ {
+ strcat(buf, "t ");
+ strcat(buf, single_line);
+ strcat(buf, "\n");
+ }
+ }
+ strcat(buf, "e");
return(buf);
}