From f9ccf53225005cd39a370467f26cbcd60416cc8a Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Fri, 8 Feb 2019 16:05:32 +0100 Subject: [PATCH] Add dummy ClipboardExtendedPlugin (#3) --- .../plugins/ClipboardExtendedPlugin.java | 94 +++++++++++++++++++ .../primitives/PrimitiveNodeFactory.java | 2 + 2 files changed, 96 insertions(+) create mode 100644 src/de.hpi.swa.graal.squeak/src/de/hpi/swa/graal/squeak/nodes/plugins/ClipboardExtendedPlugin.java diff --git a/src/de.hpi.swa.graal.squeak/src/de/hpi/swa/graal/squeak/nodes/plugins/ClipboardExtendedPlugin.java b/src/de.hpi.swa.graal.squeak/src/de/hpi/swa/graal/squeak/nodes/plugins/ClipboardExtendedPlugin.java new file mode 100644 index 000000000..5241c64f7 --- /dev/null +++ b/src/de.hpi.swa.graal.squeak/src/de/hpi/swa/graal/squeak/nodes/plugins/ClipboardExtendedPlugin.java @@ -0,0 +1,94 @@ +package de.hpi.swa.graal.squeak.nodes.plugins; + +import java.util.List; + +import com.oracle.truffle.api.dsl.GenerateNodeFactory; +import com.oracle.truffle.api.dsl.NodeFactory; +import com.oracle.truffle.api.dsl.Specialization; + +import de.hpi.swa.graal.squeak.exceptions.PrimitiveExceptions.PrimitiveFailed; +import de.hpi.swa.graal.squeak.model.CompiledMethodObject; +import de.hpi.swa.graal.squeak.model.PointersObject; +import de.hpi.swa.graal.squeak.nodes.primitives.AbstractPrimitiveFactoryHolder; +import de.hpi.swa.graal.squeak.nodes.primitives.AbstractPrimitiveNode; +import de.hpi.swa.graal.squeak.nodes.primitives.PrimitiveInterfaces.BinaryPrimitive; +import de.hpi.swa.graal.squeak.nodes.primitives.PrimitiveInterfaces.QuaternaryPrimitive; +import de.hpi.swa.graal.squeak.nodes.primitives.PrimitiveInterfaces.TernaryPrimitive; +import de.hpi.swa.graal.squeak.nodes.primitives.PrimitiveInterfaces.UnaryPrimitiveWithoutFallback; +import de.hpi.swa.graal.squeak.nodes.primitives.SqueakPrimitive; + +public final class ClipboardExtendedPlugin extends AbstractPrimitiveFactoryHolder { + @GenerateNodeFactory + @SqueakPrimitive(names = "ioAddClipboardData") + protected abstract static class PrimIOAddClipboardDataNode extends AbstractPrimitiveNode implements QuaternaryPrimitive { + protected PrimIOAddClipboardDataNode(final CompiledMethodObject method) { + super(method); + } + + @SuppressWarnings("unused") + @Specialization + protected static final Object doAdd(final PointersObject receiver, final Object clipboard, final Object data, final Object dataFormat) { + throw new PrimitiveFailed(); // TODO: implement primitive + } + } + + @GenerateNodeFactory + @SqueakPrimitive(names = "ioClearClipboard") + protected abstract static class PrimIOClearClipboardNode extends AbstractPrimitiveNode implements BinaryPrimitive { + protected PrimIOClearClipboardNode(final CompiledMethodObject method) { + super(method); + } + + @SuppressWarnings("unused") + @Specialization + protected static final Object doClear(final PointersObject receiver, final Object clipboard) { + throw new PrimitiveFailed(); // TODO: implement primitive + } + } + + @GenerateNodeFactory + @SqueakPrimitive(names = "ioCreateClipboard") + protected abstract static class PrimIOCreateClipboardNode extends AbstractPrimitiveNode implements UnaryPrimitiveWithoutFallback { + protected PrimIOCreateClipboardNode(final CompiledMethodObject method) { + super(method); + } + + @Specialization + protected static final Object doCreate(@SuppressWarnings("unused") final Object receiver) { + throw new PrimitiveFailed(); // TODO: implement primitive + } + } + + @GenerateNodeFactory + @SqueakPrimitive(names = "ioGetClipboardFormat") + protected abstract static class PrimIOGetClipboardFormatNode extends AbstractPrimitiveNode implements TernaryPrimitive { + protected PrimIOGetClipboardFormatNode(final CompiledMethodObject method) { + super(method); + } + + @SuppressWarnings("unused") + @Specialization + protected static final Object doGet(final PointersObject receiver, final Object clipboard, final long formatNumber) { + throw new PrimitiveFailed(); // TODO: implement primitive + } + } + + @GenerateNodeFactory + @SqueakPrimitive(names = "ioReadClipboardData") + protected abstract static class PrimIOReadClipboardDataNode extends AbstractPrimitiveNode implements TernaryPrimitive { + protected PrimIOReadClipboardDataNode(final CompiledMethodObject method) { + super(method); + } + + @SuppressWarnings("unused") + @Specialization + protected static final Object doRead(final PointersObject receiver, final Object clipboard, final Object dataFormat) { + throw new PrimitiveFailed(); // TODO: implement primitive + } + } + + @Override + public List> getFactories() { + return ClipboardExtendedPluginFactory.getFactories(); + } +} diff --git a/src/de.hpi.swa.graal.squeak/src/de/hpi/swa/graal/squeak/nodes/primitives/PrimitiveNodeFactory.java b/src/de.hpi.swa.graal.squeak/src/de/hpi/swa/graal/squeak/nodes/primitives/PrimitiveNodeFactory.java index 6713e547a..3c86a726d 100644 --- a/src/de.hpi.swa.graal.squeak/src/de/hpi/swa/graal/squeak/nodes/primitives/PrimitiveNodeFactory.java +++ b/src/de.hpi.swa.graal.squeak/src/de/hpi/swa/graal/squeak/nodes/primitives/PrimitiveNodeFactory.java @@ -16,6 +16,7 @@ import de.hpi.swa.graal.squeak.nodes.plugins.B2DPlugin; import de.hpi.swa.graal.squeak.nodes.plugins.BMPReadWriterPlugin; import de.hpi.swa.graal.squeak.nodes.plugins.BitBltPlugin; +import de.hpi.swa.graal.squeak.nodes.plugins.ClipboardExtendedPlugin; import de.hpi.swa.graal.squeak.nodes.plugins.CroquetPlugin; import de.hpi.swa.graal.squeak.nodes.plugins.DropPlugin; import de.hpi.swa.graal.squeak.nodes.plugins.FilePlugin; @@ -67,6 +68,7 @@ public final class PrimitiveNodeFactory { new B2DPlugin(), new BitBltPlugin(), new BMPReadWriterPlugin(), + new ClipboardExtendedPlugin(), new CroquetPlugin(), new DropPlugin(), new FilePlugin(),