Permalink
Browse files

Handle variables.

  • Loading branch information...
1 parent fecbb10 commit c62c56239f02306ee8ab52b0dc100cfd48e42329 @jacob-carlborg committed Mar 6, 2012
Showing with 12 additions and 8 deletions.
  1. +1 −1 build.sh
  2. +8 −6 dstep/converter/Converter.d
  3. +3 −1 dstep/converter/Output.d
View
@@ -1,4 +1,4 @@
#!/bin/sh
dvm use 2.058
-rdmd -m32 --build-only -ofbin/dstep -L-L. -L-lclang -L-rpath -L. "$@" dstep/driver/DStep.d
+rdmd -m32 --build-only -debug -gc -ofbin/dstep -L-L. -L-lclang -L-rpath -L. "$@" dstep/driver/DStep.d
@@ -47,16 +47,19 @@ class Converter
{
foreach (cursor, parent ; translationUnit.declarations)
{
- Declaration declaration;
-
with (CXCursorKind)
switch (cursor.kind)
{
- case CXCursor_ObjCInterfaceDecl: declaration = new ObjcInterface(cursor, parent, this); break;
+ case CXCursor_ObjCInterfaceDecl: (new ObjcInterface(cursor, parent, this)).convert; break;
+
+ case CXCursor_VarDecl:
+ auto var = new String;
+ variable(cursor, var);
+ output.variables ~= var;
+ break;
+
default: continue;
}
-
- declaration.convert;
}
write(outputFile, output.toString);
@@ -67,7 +70,6 @@ class Converter
context ~= convertType(cursor.type);
context ~= " " ~ convertIdentifier(cursor.spelling);
context ~= ";";
- context ~= nl;
}
void func (FunctionCursor func, string name, bool isStatic = false, String context = output)
View
@@ -20,7 +20,8 @@ class Output : String
String after;
String imports;
String functions;
- //String buffer;
+
+ String[] variables;
Class[] classes;
Class[] interfaces;
@@ -45,6 +46,7 @@ class Output : String
this ~= imports.data;
this ~= nl;
+ this ~= join(map!(e => e.data)(variables), "\n\n");
this ~= join(map!(e => e.data)(classes), "\n\n");
this ~= join(map!(e => e.data)(interfaces), "\n\n");

0 comments on commit c62c562

Please sign in to comment.