shithub: choc

Download patch

ref: 992ccb3ac0a29a152ad9633c6447809753df138f
parent: d944e441212eaf0032335de5ccffad1865fd3299
author: Simon Howard <[email protected]>
date: Sat Oct 8 16:14:24 EDT 2005

Add the ability to specify unsupported fields

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 173

--- 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.
@@ -56,6 +59,13 @@
         if (!strcasecmp(entry->name, name))
         {
             void *location;
+
+            if (entry->location == NULL)
+            {
+                fprintf(stderr, "DEH_SetMapping: Field '%s' is unsupported.\n",
+                        name);
+                return false;
+            }
 
             location = structptr + (entry->location - mapping->base);
 
--- 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 @@
     char *name;
 
     // location relative to the base in the deh_mapping_t struct
+    // If this is NULL, it is an unsupported mapping
 
     void *location;