Mesa (master): mapi: Allow prefix to be macro.

Chia-I Wu olv at kemper.freedesktop.org
Thu Jan 20 09:16:39 UTC 2011


Module: Mesa
Branch: master
Commit: 7828f554abf59e05a4b4152dabd599fae79d0be8
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7828f554abf59e05a4b4152dabd599fae79d0be8

Author: Chia-I Wu <olv at lunarg.com>
Date:   Mon Dec  6 22:21:51 2010 +0800

mapi: Allow prefix to be macro.

Treat prefix as macro when it is all uppercase.  Generate PREFIX(name)
instead of PREFIXname when it is a macro.

---

 src/mapi/mapi/mapi_abi.py |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/mapi/mapi/mapi_abi.py b/src/mapi/mapi/mapi_abi.py
index 1db6cf3..397e7de 100644
--- a/src/mapi/mapi/mapi_abi.py
+++ b/src/mapi/mapi/mapi_abi.py
@@ -368,8 +368,11 @@ class ABIPrinter(object):
 
     def _c_function(self, ent, prefix, mangle=False, stringify=False):
         """Return the function name of an entry."""
-        formats = { True: '"%s%s"', False: '%s%s' }
-        fmt = formats[stringify]
+        formats = {
+                True: { True: '%s_STR(%s)', False: '%s(%s)' },
+                False: { True: '"%s%s"', False: '%s%s' },
+        }
+        fmt = formats[prefix.isupper()][stringify]
         name = ent.name
         if mangle and ent.hidden:
             name = '_dispatch_stub_' + str(ent.slot)
@@ -379,7 +382,8 @@ class ABIPrinter(object):
         """Return the function name used for calling."""
         if ent.handcode:
             # _c_function does not handle this case
-            fmt = '%s%s'
+            formats = { True: '%s(%s)', False: '%s%s' }
+            fmt = formats[prefix.isupper()]
             name = fmt % (prefix, ent.handcode)
         elif self.need_entry_point(ent):
             name = self._c_function(ent, prefix, True)




More information about the mesa-commit mailing list