[gobject-introspection] [annotation] Add constants for out options



commit a199218a51da23a4abbbd8e63b4f13aae7ff08c8
Author: Johan Dahlin <johan gnome org>
Date:   Fri Sep 24 09:57:35 2010 -0300

    [annotation] Add constants for out options

 giscanner/annotationparser.py |    4 ++++
 giscanner/maintransformer.py  |    5 +++--
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/giscanner/annotationparser.py b/giscanner/annotationparser.py
index 0e8fca5..c8a01b8 100644
--- a/giscanner/annotationparser.py
+++ b/giscanner/annotationparser.py
@@ -80,6 +80,10 @@ OPT_ARRAY_FIXED_SIZE = 'fixed-size'
 OPT_ARRAY_LENGTH = 'length'
 OPT_ARRAY_ZERO_TERMINATED = 'zero-terminated'
 
+# Out options
+OPT_OUT_CALLER_ALLOCATES = 'caller-allocates'
+OPT_OUT_CALLEE_ALLOCATES = 'callee-allocates'
+
 # Scope options
 OPT_SCOPE_ASYNC = 'async'
 OPT_SCOPE_CALL = 'call'
diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py
index 0364986..3403033 100644
--- a/giscanner/maintransformer.py
+++ b/giscanner/maintransformer.py
@@ -28,6 +28,7 @@ from .annotationparser import (TAG_VFUNC, TAG_SINCE, TAG_DEPRECATED, TAG_RETURNS
 from .annotationparser import (OPT_ALLOW_NONE, OPT_ARRAY, OPT_ATTRIBUTE,
                                OPT_ELEMENT_TYPE, OPT_IN, OPT_INOUT,
                                OPT_INOUT_ALT, OPT_OUT, OPT_SCOPE,
+                               OPT_OUT_CALLER_ALLOCATES, OPT_OUT_CALLEE_ALLOCATES,
                                OPT_TYPE, OPT_CLOSURE, OPT_DESTROY, OPT_TRANSFER, OPT_SKIP,
                                OPT_FOREIGN, OPT_ARRAY_FIXED_SIZE,
                                OPT_ARRAY_LENGTH, OPT_ARRAY_ZERO_TERMINATED)
@@ -479,9 +480,9 @@ usage is void (*_gtk_reserved1)(void);"""
                     caller_allocates = '**' not in node.type.ctype
                 else:
                     caller_allocates = False
-            elif subtype == 'caller-allocates':
+            elif subtype == OPT_OUT_CALLER_ALLOCATES:
                 caller_allocates = True
-            elif subtype == 'callee-allocates':
+            elif subtype == OPT_OUT_CALLEE_ALLOCATES:
                 caller_allocates = False
         elif OPT_IN in options:
             annotated_direction = ast.PARAM_DIRECTION_IN



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]