[PATCH 1/3] add int*, uint* support for wayland-scanner

Zhao Halley halley.zhao at intel.com
Fri Jun 8 02:33:56 PDT 2012


---
 src/scanner.c |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 deletions(-)
 mode change 100644 => 100755 src/scanner.c

diff --git a/src/scanner.c b/src/scanner.c
old mode 100644
new mode 100755
index e4797b0..fcfb5a5
--- a/src/scanner.c
+++ b/src/scanner.c
@@ -82,12 +82,14 @@ struct message {
 enum arg_type {
 	NEW_ID,
 	INT,
-	UNSIGNED,
+	UINT,
 	FIXED,
 	STRING,
 	OBJECT,
 	ARRAY,
-	FD
+	FD,
+	INT_PTR,
+	UINT_PTR,
 };
 
 struct arg {
@@ -334,7 +336,7 @@ start_element(void *data, const char *element_name, const char **atts)
 		if (strcmp(type, "int") == 0)
 			arg->type = INT;
 		else if (strcmp(type, "uint") == 0)
-			arg->type = UNSIGNED;
+			arg->type = UINT;
 		else if (strcmp(type, "fixed") == 0)
 			arg->type = FIXED;
 		else if (strcmp(type, "string") == 0)
@@ -347,6 +349,10 @@ start_element(void *data, const char *element_name, const char **atts)
 			arg->type = NEW_ID;
 		} else if (strcmp(type, "object") == 0) {
 			arg->type = OBJECT;
+		} else if (strcmp(type, "int*") == 0) {
+			arg->type = INT_PTR;
+		} else if (strcmp(type, "uint*") == 0) {
+			arg->type = UINT_PTR;
 		} else {
 			fail(ctx, "unknown type");
 		}
@@ -484,7 +490,7 @@ emit_type(struct arg *a)
 		printf("int32_t ");
 		break;
 	case NEW_ID:
-	case UNSIGNED:
+	case UINT:
 		printf("uint32_t ");
 		break;
 	case FIXED:
@@ -499,6 +505,12 @@ emit_type(struct arg *a)
 	case ARRAY:
 		printf("struct wl_array *");
 		break;
+	case INT_PTR:
+		printf("int32_t *");
+		break;
+	case UINT_PTR:
+		printf("uint32_t *");
+		break;
 	}
 }
 
@@ -975,7 +987,7 @@ emit_messages(struct wl_list *message_list,
 			case NEW_ID:
 				printf("n");
 				break;
-			case UNSIGNED:
+			case UINT:
 				printf("u");
 				break;
 			case FIXED:
@@ -993,6 +1005,12 @@ emit_messages(struct wl_list *message_list,
 			case FD:
 				printf("h");
 				break;
+			case INT_PTR:
+				printf("I");
+				break;
+			case UINT_PTR:
+				printf("U");
+				break;
 			}
 		}
 		printf("\", types + %d },\n", m->type_index);
-- 
1.7.5.4



More information about the wayland-devel mailing list