aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJim Carroll <thecarrolls@jiminger.com>2013-03-10 18:05:07 -0700
committerJim Carroll <thecarrolls@jiminger.com>2013-03-10 18:05:07 -0700
commit8cc671e23a452e18a3bcaed98d0a508456d260c3 (patch)
tree4131a535c28c13efa7b04a77a15a6c8b00955484 /tools
parent99f80fd96bf96745ad91a6e95ee00e47ccbcd067 (diff)
parent3ed73e8913c314edef7e3cd6622523085c792867 (diff)
Merge pull request #2359 from jimfcarroll/buffer
Addon binary reading and writing
Diffstat (limited to 'tools')
-rw-r--r--tools/codegenerator/SwigTypeParser.groovy19
1 files changed, 14 insertions, 5 deletions
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)
}
}