Commit e4624ac2 authored by Sven Robertz's avatar Sven Robertz
Browse files

applied old patch for block structure in the generated code fixing name clashes

parent 713c78f4
......@@ -23,6 +23,10 @@ aspect CS_CodeGenEnv {
public CS_printer(File f) {
file = f;
File parentFile = f.getParentFile();
if(parentFile != null) {
parentFile.mkdirs();
}
}
public CS_printer(PrintStream out) {
......@@ -140,6 +144,16 @@ aspect CS_CodeGenEnv {
println("}");
}
public void print_block_begin() {
println("{");
indent();
}
public void print_block_end() {
unindent();
println("}");
}
public String getUnique(Object o) {
String result = (String)unique.get(o);
if (result == null) {
......@@ -419,8 +433,7 @@ aspect CS_Class {
for (int i = 0 ; i < getNumExp() ; i++) {
String limit = getExp(i).CS_emitEncoder(env,
name + ".GetLength(" + i + ")");
env.println("{");
env.indent();
env.print_block_begin();
env.println("int i_" + (baseDepth + i) + "_max = " + limit + ";");
}
String index = null;
......@@ -435,9 +448,8 @@ aspect CS_Class {
getType().CS_emitEncoder(env, name + "[" + index + "]");
for (int i = 0 ; i < getNumExp() ; i++) {
env.print_for_end();
env.print_block_end();
}
env.unindent();
env.println("}");
}
public String Exp.CS_emitEncoder(CS_env env, String name) {
......
......@@ -23,6 +23,10 @@ aspect Java_CodeGenEnv {
public Java_printer(File f) {
file = f;
File parentFile = f.getParentFile();
if(parentFile != null) {
parentFile.mkdirs();
}
}
public Java_printer(PrintStream out) {
......@@ -140,6 +144,16 @@ aspect Java_CodeGenEnv {
println("}");
}
public void print_block_begin() {
println("{");
indent();
}
public void print_block_end() {
unindent();
println("}");
}
public String getUnique(Object o) {
String result = (String)unique.get(o);
if (result == null) {
......@@ -445,8 +459,7 @@ aspect Java_Class {
String prefix = "";
for (int i = 0 ; i < getNumExp() ; i++) {
String limit = getExp(i).Java_emitEncoder(env, name + prefix);
env.println("{");
env.indent();
env.print_block_begin();
env.println("int i_" + (baseDepth + i) + "_max = " + limit + ";");
prefix = prefix + "[0]";
}
......@@ -457,9 +470,8 @@ aspect Java_Class {
getType().Java_emitEncoder(env, name);
for (int i = 0 ; i < getNumExp() ; i++) {
env.print_for_end();
env.print_block_end();
}
env.unindent();
env.println("}");
}
public String Exp.Java_emitEncoder(Java_env env, String name) {
......
Markdown is supported
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