On Sun, Feb 19, 2012 at 7:00 AM, <[email protected]> wrote:
> Date: Sat, 18 Feb 2012 15:34:25 -0500
> From: Dan Katz <[email protected]>
> Yes of course. I think it's a bit easier with names because you can
> introspect
> on them in the python REPL using 'dir' and 'help' and such, but looking up the
> text of the shape module isn't very hard either. It's a bit harder with
> built-in
> shapes since you have to read the C code for those, but that's not my use
> case here. I consider that the having a stable ordering of connection points
> is sufficient for my purposes.
I don't use Python, though I would think it would have a mechanism for
defining named constants in a file that can be included by reference
by your program.
In C/C++, something like the following could be done:
enum OpAmpCP {
OpAmp_Pos,
OpAmp_Neg,
OpAmp_Out
};
Then in the program:
#include "shapeDefinitions.h"
/* other code */
ShapeType = parseShape(objectIndex, attributes, connections);
switch (ShapeType) {
case OpAmp:
makeConnection(objectIndex, OpAmp_Pos, connections[OpAmp_Pos]);
/* more code */
break;
/* cases for other shapes */
}
_______________________________________________
dia-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/dia-list
FAQ at http://live.gnome.org/Dia/Faq
Main page at http://live.gnome.org/Dia