use of cz.cuni.mff.d3s.trupple.language.runtime.customvalues.FileValue in project TrufflePascal by Aspect26.
the class ReadBuiltinNode method read.
@Specialization
public void read(Object[] arguments) {
this.input = PascalLanguage.INSTANCE.findContext().getInput();
if (arguments.length == 0) {
readOne();
}
FileValue file = tryGetFileValue((Reference) arguments[0]);
if (file != null) {
read(file, Arrays.copyOfRange(arguments, 1, arguments.length));
} else {
read(null, arguments);
}
}
use of cz.cuni.mff.d3s.trupple.language.runtime.customvalues.FileValue in project TrufflePascal by Aspect26.
the class FileProgramArgumentAssignmentNode method executeVoid.
@Override
public void executeVoid(VirtualFrame frame) {
try {
FileValue file = (FileValue) frame.getObject(frameSlot);
file.assignFilePath((String) frame.getArguments()[index]);
} catch (FrameSlotTypeException e) {
throw new PascalRuntimeException("Something went wrong");
}
}
use of cz.cuni.mff.d3s.trupple.language.runtime.customvalues.FileValue in project TrufflePascal by Aspect26.
the class WriteBuiltinNode method write.
@Specialization
public void write(Object[] values) {
if (values.length > 0 && values[0] instanceof FileValue) {
FileValue file = (FileValue) values[0];
Object[] arguments = Arrays.copyOfRange(values, 1, values.length);
file.write(arguments);
} else {
doWrite(values);
}
}
use of cz.cuni.mff.d3s.trupple.language.runtime.customvalues.FileValue in project TrufflePascal by Aspect26.
the class WritelnBuiltinNode method writeln.
@Specialization
public void writeln(Object... values) {
if (values.length > 0 && values[0] instanceof FileValue) {
FileValue file = (FileValue) values[0];
Object[] arguments = Arrays.copyOfRange(values, 1, values.length);
file.writeln(arguments);
} else {
doWriteln(values);
}
}
use of cz.cuni.mff.d3s.trupple.language.runtime.customvalues.FileValue in project TrufflePascal by Aspect26.
the class ProgramArgumentAssignmentNode method assignFile.
private void assignFile(VirtualFrame frame, String filePath) {
try {
FileValue file = (FileValue) frame.getObject(targetSlot);
file.assignFilePath(filePath);
} catch (FrameSlotTypeException e) {
throw new PascalRuntimeException("Something went wrong");
}
}
Aggregations