rendered paste bodyvoid SystemFunction_WRITELN(Program prg) {
MemoryManagement fncMemory = new MemoryManagement(prg.memory);
Variable resultVariable = new ReferenceVariable("result",
Type.UNKNOWN);
ReferenceVariable[] params = new ReferenceVariable[1];
params[0] = new ReferenceVariable("_str", PrimitiveType.STRING);
for (Variable param : params) {
if (fncMemory.variableExists(param, false)) {
log("[iSCAR] identifierRedeclared " + param.getIdentifier());
} else {
fncMemory.addVariable(param);
}
}
Function function = new SystemFunction_WRITELN("writeln", null,
fncMemory, params, resultVariable);
if (prg.memory.functionExists(function, true)) {
log("[iSCAR] Already declared " + function);
}
prg.memory.addFunction(function);
}
class SystemFunction_WRITELN extends Function {
/** Creates a new instance of SystemFunction_SIN */
public SystemFunction_WRITELN(String name, Statement body,
MemoryManagement memory, ReferenceVariable[] params,
Variable result) {
super(name, body, memory, params, result);
}
public void exec() throws InterpreterRuntimeException {
log(paramAt(0).stringValue());
}
}