foxygit / doom Log in
commit 992ccb3ac0a29a152ad9633c6447809753df138f
Author:     Simon Howard <fraggle@gmail.com>
AuthorDate: Sat Oct 8 20:14:24 2005 +0000
Commit:     Simon Howard <fraggle@gmail.com>
CommitDate: Sat Oct 8 20:14:24 2005 +0000

    Add the ability to specify unsupported fields

    Subversion-branch: /trunk/chocolate-doom
    Subversion-revision: 173
---
 src/deh_mapping.c | 12 +++++++++++-
 src/deh_mapping.h |  9 ++++++++-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/src/deh_mapping.c b/src/deh_mapping.c
index fa19f8ee..e79d2ea7 100644
--- a/src/deh_mapping.c
+++ b/src/deh_mapping.c
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*-
 //-----------------------------------------------------------------------------
 //
-// $Id: deh_mapping.c 155 2005-10-03 10:25:37Z fraggle $
+// $Id: deh_mapping.c 173 2005-10-08 20:14:24Z fraggle $
 //
 // Copyright(C) 2005 Simon Howard
 //
@@ -21,6 +21,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.2  2005/10/08 20:14:24  fraggle
+// Add the ability to specify unsupported fields
+//
 // Revision 1.1  2005/10/03 10:25:37  fraggle
 // Add mapping code to map out structures and switch thing/frame code to use
 // this.
@@ -57,6 +60,13 @@ boolean DEH_SetMapping(deh_mapping_t *mapping,
         {
             void *location;

+            if (entry->location == NULL)
+            {
+                fprintf(stderr, "DEH_SetMapping: Field '%s' is unsupported.\n",
+                        name);
+                return false;
+            }
+
             location = structptr + (entry->location - mapping->base);

      //       printf("Setting %p::%s to %i (%i bytes)\n",
diff --git a/src/deh_mapping.h b/src/deh_mapping.h
index d390bbbf..b025b67f 100644
--- a/src/deh_mapping.h
+++ b/src/deh_mapping.h
@@ -1,7 +1,7 @@
 // Emacs style mode select   -*- C++ -*-
 //-----------------------------------------------------------------------------
 //
-// $Id: deh_mapping.h 155 2005-10-03 10:25:37Z fraggle $
+// $Id: deh_mapping.h 173 2005-10-08 20:14:24Z fraggle $
 //
 // Copyright(C) 2005 Simon Howard
 //
@@ -21,6 +21,9 @@
 // 02111-1307, USA.
 //
 // $Log$
+// Revision 1.2  2005/10/08 20:14:24  fraggle
+// Add the ability to specify unsupported fields
+//
 // Revision 1.1  2005/10/03 10:25:37  fraggle
 // Add mapping code to map out structures and switch thing/frame code to use
 // this.
@@ -49,6 +52,9 @@
 #define DEH_MAPPING(deh_name, fieldname)                      \
              {deh_name, &deh_mapping_base.fieldname,          \
                  sizeof(deh_mapping_base.fieldname)},
+
+#define DEH_UNSUPPORTED_MAPPING(deh_name)                     \
+             {deh_name, NULL, -1}

 #define DEH_END_MAPPING                                       \
              {NULL}                                           \
@@ -69,6 +75,7 @@ struct deh_mapping_entry_s
     char *name;

     // location relative to the base in the deh_mapping_t struct
+    // If this is NULL, it is an unsupported mapping

     void *location;