From 4cc58e6c8a71080d5a537c2c561aa0463134e826 Mon Sep 17 00:00:00 2001 From: Anders Blomdell <anders.blomdell@control.lth.se> Date: Tue, 14 May 2013 16:33:44 +0200 Subject: [PATCH] Emit separate lists of typedefs and samples --- compiler/Python_CodeGen.jrag | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/compiler/Python_CodeGen.jrag b/compiler/Python_CodeGen.jrag index ed3f2c7..fd25e18 100644 --- a/compiler/Python_CodeGen.jrag +++ b/compiler/Python_CodeGen.jrag @@ -80,11 +80,19 @@ aspect Python_CodeGen { env.println("import labcomm"); env.println(); Python_genTypes(env); - env.println("signatures = ["); + env.println("typedef = ["); + env.indent(); + for (int i = 0 ; i < getNumDecl() ; i++) { + getDecl(i).Python_genTypedefListEntry(env); + } + env.unindent(); + env.println("]"); + env.println("sample = ["); + env.indent(); for (int i = 0 ; i < getNumDecl() ; i++) { - env.println(" ('" + getDecl(i).getName() + "', " + - getDecl(i).getName() + ".signature),"); + getDecl(i).Python_genSampleListEntry(env); } + env.unindent(); env.println("]"); } @@ -109,7 +117,7 @@ aspect PythonTypes { } public void TypeDecl.Python_genSignature(Python_env env) { - env.println("no_signature = labcomm.typedef('" + getName() + "',"); + env.println("signature = labcomm.typedef('" + getName() + "',"); env.indent(); getType().Python_genSignature(env); env.unindent(); @@ -181,6 +189,20 @@ aspect PythonTypes { env.print(")"); } + public void Decl.Python_genTypedefListEntry(Python_env env) { + } + + public void TypeDecl.Python_genTypedefListEntry(Python_env env) { + env.println("('" + getName() + "', " + getName() + ".signature),"); + } + + public void Decl.Python_genSampleListEntry(Python_env env) { + } + + public void SampleDecl.Python_genSampleListEntry(Python_env env) { + env.println("('" + getName() + "', " + getName() + ".signature),"); + } + public String Exp.Python_getValue() { throw new Error(this.getClass().getName() + ".Python_getValue()" + -- GitLab