gEDA-dev: [pcb] patch: export some compile-time options (for external HIDs)

Igor2 igor2 at inno.bme.hu
Mon Oct 9 00:40:03 EDT 2006


Hi,

External HIDs are compiled outside of the pcb source dir. They depend on
the code of pcb, but not on the configure/make infrastructure of
pcb, still a few values are accessible only from -D defines while
compiling pcb. This patch exports some of these from pcb, using global
variables. The list is not complete.

I am not sure this is the proper way of exporting them, but this is the
simplest. Alternatives I can think of:
- a query function with pointer arguments; if a new option shows up, the
  API changes even if the other side doesn't need the new option
- a dedicated query function for each option (bloat)
- a general query function that takes an argument char *name and returns
some general value&type struct (bloat and slow)


Regards,

Igor2
-------------- next part --------------
Index: data.c
===================================================================
RCS file: /cvsroot/pcb/pcb/src/data.c,v
retrieving revision 1.14
diff -u -r1.14 data.c
--- data.c	2 Aug 2006 15:55:17 -0000	1.14
+++ data.c	9 Oct 2006 04:19:29 -0000
@@ -93,3 +93,8 @@
   {NULL, NULL}
 };
 #endif
+
+/* Make some compile-time choices available runtime */
+char *Dexecprefixdir = EXECPREFIXDIR;
+char *Dhost = HOST;
+int Dmax_layer = MAX_LAYER;
Index: data.h
===================================================================
RCS file: /cvsroot/pcb/pcb/src/data.h,v
retrieving revision 1.10
diff -u -r1.10 data.h
--- data.h	10 Jun 2006 03:07:38 -0000	1.10
+++ data.h	9 Oct 2006 04:19:29 -0000
@@ -84,3 +84,7 @@
 extern FlagType no_flags;
 
 #endif
+
+extern char *Dexecprefixdir;
+extern char *Dhost;
+extern int Dmax_layer;


More information about the geda-dev mailing list