Commit fc942c4d authored by Anders Blomdell's avatar Anders Blomdell
Browse files

compiler/*_CodeGen.jrag:

  put delimiter first in typeinfo to simplify parsing
  and not assume what delimiter should be used for
  various languages (was broken for C#)

compiler/CS_CodeGen.jrag:
  corrected handling of variable sized arrays (int -> packed32)

compiler/Python_CodeGen.jrag:
  added signature list 
parent e29ea626
...@@ -463,7 +463,7 @@ aspect CS_Class { ...@@ -463,7 +463,7 @@ aspect CS_Class {
} }
public String VariableSize.CS_emitEncoder(CS_env env, String name) { public String VariableSize.CS_emitEncoder(CS_env env, String name) {
env.println("e.encodeInt(" + name + ");"); env.println("e.encodePacked32(" + name + ");");
return name; return name;
} }
...@@ -571,7 +571,7 @@ aspect CS_Class { ...@@ -571,7 +571,7 @@ aspect CS_Class {
} }
public void VariableSize.CS_emitDecoder(CS_env env) { public void VariableSize.CS_emitDecoder(CS_env env) {
env.print("d.decodeInt()"); env.print("d.decodePacked32()");
} }
public void StructType.CS_emitDecoder(CS_env env, String name) { public void StructType.CS_emitDecoder(CS_env env, String name) {
...@@ -786,13 +786,13 @@ aspect CS_Info { ...@@ -786,13 +786,13 @@ aspect CS_Info {
} }
public void TypeDecl.CS_info(CS_env env, String namespace) { public void TypeDecl.CS_info(CS_env env, String namespace) {
env.print("C#,typedef," + namespace + getName() + ","); env.print(";C#;typedef;" + namespace + getName() + ";");
getType().CS_emitType(env); getType().CS_emitType(env);
env.println(); env.println();
} }
public void SampleDecl.CS_info(CS_env env, String namespace) { public void SampleDecl.CS_info(CS_env env, String namespace) {
env.print("C#,sample," + namespace + getName() + ","); env.print(";C#;sample;" + namespace + getName() + ";");
getType().CS_emitType(env); getType().CS_emitType(env);
env.println(); env.println();
} }
......
...@@ -1102,12 +1102,12 @@ aspect C_Info { ...@@ -1102,12 +1102,12 @@ aspect C_Info {
} }
public void TypeDecl.C_info(C_env env) { public void TypeDecl.C_info(C_env env) {
env.println("C,typedef," + env.prefix + getName() + "," + env.println(",C,typedef," + env.prefix + getName() + "," +
env.prefix + getName()); env.prefix + getName());
} }
public void SampleDecl.C_info(C_env env) { public void SampleDecl.C_info(C_env env) {
env.println("C,sample," + env.prefix + getName() + "," + env.println(",C,sample," + env.prefix + getName() + "," +
env.prefix + getName()); env.prefix + getName());
} }
......
...@@ -783,13 +783,13 @@ aspect Java_Info { ...@@ -783,13 +783,13 @@ aspect Java_Info {
} }
public void TypeDecl.Java_info(Java_env env) { public void TypeDecl.Java_info(Java_env env) {
env.print("Java,typedef," + getName() + ","); env.print(",Java,typedef," + getName() + ",");
getType().Java_emitType(env); getType().Java_emitType(env);
env.println(); env.println();
} }
public void SampleDecl.Java_info(Java_env env) { public void SampleDecl.Java_info(Java_env env) {
env.print("Java,sample," + getName() + ","); env.print(",Java,sample," + getName() + ",");
getType().Java_emitType(env); getType().Java_emitType(env);
env.println(); env.println();
} }
......
...@@ -80,6 +80,12 @@ aspect Python_CodeGen { ...@@ -80,6 +80,12 @@ aspect Python_CodeGen {
env.println("import labcomm"); env.println("import labcomm");
env.println(); env.println();
Python_genTypes(env); Python_genTypes(env);
env.println("signatures = [");
for (int i = 0 ; i < getNumDecl() ; i++) {
env.println(" ('" + getDecl(i).getName() + "', " +
getDecl(i).getName() + ".signature),");
}
env.println("]");
} }
} }
...@@ -167,7 +173,6 @@ aspect PythonTypes { ...@@ -167,7 +173,6 @@ aspect PythonTypes {
public void VoidType.Python_genSignature(Python_env env) { public void VoidType.Python_genSignature(Python_env env) {
env.println("labcomm.struct([])"); env.println("labcomm.struct([])");
env.unindent();
} }
public void Field.Python_genSignature(Python_env env) { public void Field.Python_genSignature(Python_env env) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment