-
Notifications
You must be signed in to change notification settings - Fork 71
/
ClipboardExtendedPlugin.class.st
67 lines (55 loc) · 2.53 KB
/
ClipboardExtendedPlugin.class.st
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Class {
#name : #ClipboardExtendedPlugin,
#superclass : #SmartSyntaxInterpreterPlugin,
#category : #'VMMaker-Plugins'
}
{ #category : #simulation }
ClipboardExtendedPlugin class >> simulatorClass [
"This should be easy to simulate, but I'm short of time. Feel free to have a go, following e.g. the pattern in JPEGReadWriter2Plugin."
^nil
]
{ #category : #io }
ClipboardExtendedPlugin >> ioAddClipboardData: clipboard data: data dataFormat: aFormat [
| clipboardAddress formatLength dataLength |
<var: #clipboardAddress type: #'usqIntptr_t'>
self primitive: 'ioAddClipboardData' parameters: #(Oop ByteArray String).
clipboardAddress := interpreterProxy positiveMachineIntegerValueOf: clipboard.
dataLength := interpreterProxy slotSizeOf: data cPtrAsOop.
formatLength := interpreterProxy slotSizeOf: aFormat cPtrAsOop.
self sqPasteboardPutItemFlavor: clipboardAddress data: data length: dataLength formatType: aFormat formatLength: formatLength.
]
{ #category : #io }
ClipboardExtendedPlugin >> ioClearClipboard: clipboard [
| clipboardAddress |
<var: #clipboardAddress type: #'usqIntptr_t'>
self primitive: 'ioClearClipboard' parameters: #(Oop).
clipboardAddress := interpreterProxy positiveMachineIntegerValueOf: clipboard.
self sqPasteboardClear: clipboardAddress.
]
{ #category : #io }
ClipboardExtendedPlugin >> ioCreateClipboard [
| clipboardAddress |
self primitive: 'ioCreateClipboard' parameters: #().
clipboardAddress := interpreterProxy positiveMachineIntegerFor: self sqCreateClipboard.
^ clipboardAddress.
]
{ #category : #io }
ClipboardExtendedPlugin >> ioGetClipboardFormat: clipboard formatNumber: formatNumber [
| clipboardAddress itemCount |
<var: #clipboardAddress type: #'usqIntptr_t'>
self primitive: 'ioGetClipboardFormat' parameters: #(#Oop #SmallInteger ).
clipboardAddress := interpreterProxy positiveMachineIntegerValueOf: clipboard.
itemCount := self sqPasteboardGetItemCount: clipboardAddress.
itemCount > 0
ifTrue: [^ self sqPasteboardCopyItemFlavors: clipboardAddress itemNumber: formatNumber].
^ interpreterProxy nilObject
]
{ #category : #io }
ClipboardExtendedPlugin >> ioReadClipboardData: clipboard format: format [
| clipboardAddress formatLength |
<var: #clipboardAddress type: #'usqIntptr_t'>
self primitive: 'ioReadClipboardData' parameters: #(Oop String).
clipboardAddress := interpreterProxy positiveMachineIntegerValueOf: clipboard.
formatLength := interpreterProxy slotSizeOf: format cPtrAsOop.
^ self sqPasteboardCopyItemFlavorData: clipboardAddress format: format formatLength: formatLength.
]