Browse Source

Un-nest structure declarations to make headers SWIG-friendly
Fix G_DEV_NULL definition (strings need double-quotes, not single quotes)



git-svn-id: https://svn.osgeo.org/grass/grass/trunk@33461 15284696-431f-4ddb-bdfa-cd5b030d7da7

Glynn Clements 16 years ago
parent
commit
8d01bf21bb
2 changed files with 72 additions and 59 deletions
  1. 11 10
      include/gis.h
  2. 61 49
      include/imagery.h

+ 11 - 10
include/gis.h

@@ -149,10 +149,10 @@ static const char *GRASS_copyright __attribute__ ((unused))
 #define GRASS_DIRSEP '/'
 #ifdef __MINGW32__
 #  define HOST_DIRSEP '\\'
-#  define G_DEV_NULL 'NUL:'
+#  define G_DEV_NULL "NUL:"
 #else
 #  define HOST_DIRSEP '/'
-#  define G_DEV_NULL '/dev/null'
+#  define G_DEV_NULL "/dev/null"
 #endif
 
  /**/ typedef enum
@@ -278,16 +278,17 @@ struct Cell_head
     double bottom;
 };
 
-struct _Color_Rule_
+struct _Color_Value_
 {
-    struct
-    {
-	DCELL value;
-	unsigned char red;
-	unsigned char grn;
-	unsigned char blu;
-    } low, high;
+    DCELL value;
+    unsigned char red;
+    unsigned char grn;
+    unsigned char blu;
+};
 
+struct _Color_Rule_
+{
+    struct _Color_Value_ low, high;
     struct _Color_Rule_ *next;
     struct _Color_Rule_ *prev;
 };

+ 61 - 49
include/imagery.h

@@ -6,23 +6,27 @@
 /* File/directory name lengths */
 #define INAME_LEN GNAME_MAX	/* coupled to raster map name length */
 
+struct Ref_Color
+{
+    unsigned char *table;	/* color table for min-max values */
+    unsigned char *index;	/* data translation index */
+    unsigned char *buf;	/* data buffer for reading color file */
+    int fd;			/* for image i/o */
+    CELL min, max;		/* min,max CELL values */
+    int n;			/* index into Ref_Files */
+};
+
+struct Ref_Files
+{
+    char name[INAME_LEN];	/* length is not in sync with other definitions */
+    char mapset[INAME_LEN];
+};
+
 struct Ref
 {
     int nfiles;
-    struct Ref_Files
-    {
-	char name[INAME_LEN];	/* length is not in sync with other definitions */
-	char mapset[INAME_LEN];
-    } *file;
-    struct Ref_Color
-    {
-	unsigned char *table;	/* color table for min-max values */
-	unsigned char *index;	/* data translation index */
-	unsigned char *buf;	/* data buffer for reading color file */
-	int fd;			/* for image i/o */
-	CELL min, max;		/* min,max CELL values */
-	int n;			/* index into Ref_Files */
-    } red, grn, blu;
+    struct Ref_Files *file;
+    struct Ref_Color red, grn, blu;
 };
 
 struct Tape_Info
@@ -42,21 +46,53 @@ struct Control_Points
     int *status;
 };
 
+struct One_Sig
+{
+    char desc[100];
+    int npoints;
+    double *mean;		/* one mean for each band */
+    double **var;		/* covariance band-band   */
+    int status;		/* may be used to 'delete' a signature */
+    float r, g, b;		/* color */
+    int have_color;
+};
+
 struct Signature
 {
     int nbands;
     int nsigs;
     char title[100];
-    struct One_Sig
-    {
-	char desc[100];
-	int npoints;
-	double *mean;		/* one mean for each band */
-	double **var;		/* covariance band-band   */
-	int status;		/* may be used to 'delete' a signature */
-	float r, g, b;		/* color */
-	int have_color;
-    } *sig;
+    struct One_Sig *sig;
+};
+
+struct SubSig
+{
+    double N;
+    double pi;
+    double *means;
+    double **R;
+    double **Rinv;
+    double cnst;
+    int used;
+};
+
+struct ClassData
+{
+    int npixels;
+    int count;
+    double **x;		/* pixel list: x[npixels][nbands] */
+    double **p;		/* prob        p[npixels][subclasses] */
+};
+
+struct ClassSig
+{
+    long classnum;
+    char *title;
+    int used;
+    int type;
+    int nsubclasses;
+    struct SubSig *SubSig;
+    struct ClassData ClassData;
 };
 
 struct SigSet
@@ -64,31 +100,7 @@ struct SigSet
     int nbands;
     int nclasses;
     char *title;
-    struct ClassSig
-    {
-	long classnum;
-	char *title;
-	int used;
-	int type;
-	int nsubclasses;
-	struct SubSig
-	{
-	    double N;
-	    double pi;
-	    double *means;
-	    double **R;
-	    double **Rinv;
-	    double cnst;
-	    int used;
-	} *SubSig;
-	struct ClassData
-	{
-	    int npixels;
-	    int count;
-	    double **x;		/* pixel list: x[npixels][nbands] */
-	    double **p;		/* prob        p[npixels][subclasses] */
-	} ClassData;
-    } *ClassSig;
+    struct ClassSig *ClassSig;
 };
 
 #define SIGNATURE_TYPE_MIXED 1