From 92c7bf0e682a63baee3cd81a36468a346b16d5a8 Mon Sep 17 00:00:00 2001 From: Jim Carroll Date: Mon, 26 Nov 2012 23:29:35 -0500 Subject: Introduce a Buffer class and use it to replace custom API definitions for RenderCapture and xbmcvfs.File. --- tools/codegenerator/SwigTypeParser.groovy | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'tools') diff --git a/tools/codegenerator/SwigTypeParser.groovy b/tools/codegenerator/SwigTypeParser.groovy index 282a971140..94872e21a8 100644 --- a/tools/codegenerator/SwigTypeParser.groovy +++ b/tools/codegenerator/SwigTypeParser.groovy @@ -42,9 +42,9 @@ public class SwigTypeParser public static String convertTypeToLTypeForParam(String ty) { // in the case where we're converting from a type to an ltype for a parameter, - // and the type is a r.q(const).*, we are going to assume the ltype is + // and the type is a r.*, we are going to assume the ltype is // a "pass-by-value" on the stack. - return (ty.trim().startsWith('r.q(const).') ? SwigTypeParser.SwigType_ltype(ty.trim().substring(11)) : SwigTypeParser.SwigType_ltype(ty.trim())) + return (ty.trim().startsWith('r.') ? SwigTypeParser.SwigType_ltype(ty.trim().substring(2)) : SwigTypeParser.SwigType_ltype(ty.trim())) } /** @@ -248,10 +248,18 @@ public class SwigTypeParser public static boolean SwigType_ispointer(String t) { - if (t.startsWith('q(')) t = t.substring(t.indexOf('.') + 1,) + if (t.startsWith('q(')) t = t.substring(t.indexOf('.') + 1) return t.startsWith('p.') } + public static String SwigType_makepointer(String t) + { + String prefix = (t.startsWith('q(')) ? t.substring(0,t.indexOf('.') + 1) : "" + String remainder = (t.startsWith('q(')) ? t.substring(t.indexOf('.') + 1) : t + + return prefix + "p." + remainder + } + public static boolean SwigType_isarray(String t) { return t.startsWith('a(') } public static boolean SwigType_ismemberpointer(String t) { return t?.startsWith('m(') } @@ -542,11 +550,12 @@ public class SwigTypeParser //System.out.println "${convertTypeToLType('bool')}" //testPrint('p.q(const).XBMCAddon::xbmcgui::ListItemList') //testPrint('p.q(const).XBMCAddon::xbmcgui::ListItemList') - testPrint('r.q(const).std::map<(String,String)>', 'foo') + //testPrint(SwigTypeParser.SwigType_makepointer('r.q(const).std::map<(String,String)>'), 'foo') + testPrint(SwigTypeParser.SwigType_makepointer('q(const).p.q(const).char'),'bfoo') } private static void testPrint(String ty, String id = 'foo') { - println SwigTypeParser.SwigType_ltype(ty) + "|" + SwigTypeParser.SwigType_str(SwigTypeParser.SwigType_ltype(ty),id) + ' ' + " = " + SwigTypeParser.SwigType_str(ty,id) + println SwigTypeParser.SwigType_ltype(ty) + "|" + SwigTypeParser.SwigType_str(SwigTypeParser.SwigType_ltype(ty),id) + ' ' + " = " + ty + '|' + SwigTypeParser.SwigType_str(ty,id) } } -- cgit v1.2.3