var classes = new Array[Klass]
var dept writable = 5
- var loops writable = 20000
+ var loops writable = 50000
var middle writable = 0
var dry writable = false
var check writable = false
middle = (dept + 1) / 2
end
- var file: nullable OFStream = null
+ var file: nullable FileWriter = null
fun write(str: String)
do
file.write(str)
do
dir = "{dir}/nit"
dir.mkdir
- file = new OFStream.open("{dir}/{name}.nit")
+ file = new FileWriter.open("{dir}/{name}.nit")
write "class Root\n\tfun id: Int do return 0\nend"
for c in classes do
write "\t\tif {test} and x >= 0 then"
if check then write "\t\tx += 1"
write "\telse"
- write "\t\t\tx -= 1"
+ write "\t\t\tx = x - 1 + i - j"
write "\t\t\ta = b"
write "\t\tend"
write "\t\tj += 1"
do
dir = "{dir}/java"
dir.mkdir
- file = new OFStream.open("{dir}/{name}.java")
+ file = new FileWriter.open("{dir}/{name}.java")
var cl = ""
if interfaces then cl = "X"
var test = "true"
if not dry then test = testjava(interfaces)
write "\t\t\tif({test} && x>=0) \{"
- if check then write "\t\t\t\tx -= 2"
- write "\t\t\t\} else \{ x--; a = b;\}"
+ if check then write "\t\t\t\tx = x + 1;"
+ write "\t\t\t\} else \{ x = x - 1 + i - j; a = b;\}"
+ #write "\t\t\t\} else \{ x = x - 1; a = b;\}"
write "\t\t}"
write "\t\}"
write "\tSystem.out.println(x);"
do
dir = "{dir}/cs"
dir.mkdir
- file = new OFStream.open("{dir}/{name}.cs")
+ file = new FileWriter.open("{dir}/{name}.cs")
var cl = ""
if interfaces then cl = "X"
if not dry then test = testcsharp(interfaces)
write "\t\t\tif({test} && x>=0) \{"
if check then write "\t\t\t\tx++;"
- write "\} else \{ x--; a = b; \};"
+ write "\} else \{ x = x - 1 + i - j; a = b; \};"
write "\t\t}"
write "\t\}"
write "\tSystem.Console.WriteLine(x);"
do
dir = "{dir}/scala"
dir.mkdir
- file = new OFStream.open("{dir}/{name}.scala")
+ file = new FileWriter.open("{dir}/{name}.scala")
var cl = ""
write "object {name} \{"
var test = "true"
if not dry then test = testscala(interfaces)
write "\t\tif ({test} && x>=0) \{"
- if check then write "\t\t\tx += 1"
+ if check then write "\t\t\tx += 1;"
+ #write "\} else \{ x = x - 1 + i - j; a = b; \}"
write "\} else \{ x = x - 1; a = b; \}"
write "\t\tj += 1"
write "\t\t\}"
do
dir = "{dir}/cpp"
dir.mkdir
- file = new OFStream.open("{dir}/{name}.cpp")
+ file = new FileWriter.open("{dir}/{name}.cpp")
write "#include <iostream>"
write "#include <stdlib.h>"
var test = "true"
if not dry then test = testcpp
write "\t\tif({test} && x>=0) \{"
- if check then write "\t\t\tx += 1"
- write "\} else \{ x--; a = b;\}"
+ if check then write "\t\t\tx += 1;"
+ write "\} else \{ x = x - 1 + i - j; a = b;\}"
write "\t\t}"
write "\t\}"
write "\tstd::cout << x << std::endl;"
dir = "{dir}/es/{name}"
end
dir.mkdir
- file = new OFStream.open("{dir}/root.e")
+ file = new FileWriter.open("{dir}/root.e")
var istk = ""
if se then istk = " is"
file.close
for c in classes do
- file = new OFStream.open("{dir}/{c}.e")
+ file = new FileWriter.open("{dir}/{c}.e")
write "class {c}[E] "
if c.supers.is_empty then
write "\tinherit ROOT"
file.close
end
- file = new OFStream.open("{dir}/app{name}.e")
+ file = new FileWriter.open("{dir}/app{name}.e")
write "class APP{name.to_upper}"
if se then
write "insert ARGUMENTS"
if not dry then test = teste(se)
write "\t\t\t\t\tif {test} and then x >= 0 then"
if check then write "\t\t\t\t\tx := x + 1"
- write "\t\t\t\t\telse x := x - 1; a := b end"
+ write "\t\t\t\t\telse x := x - 1 + i - j; a := b end"
write "\t\t\t\t\tj := j + 1"
write "\t\t\t\tend"
write "\t\t\t\ti := i + 1"