[Vm-dev] VM Maker: VMMaker.oscog-eem.3255.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Oct 14 23:35:43 UTC 2022


Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3255.mcz

==================== Summary ====================

Name: VMMaker.oscog-eem.3255
Author: eem
Time: 14 October 2022, 4:35:19.200377 pm
UUID: 5d455fd8-c83e-414b-9109-01d1a66094db
Ancestors: VMMaker.oscog-eem.3254

Extent ClipboardExtendedPlugin>>ioReadClipboardData:format: to take only a format number, oriented around win32's clipboard access which uses numeric types.

=============== Diff against VMMaker.oscog-eem.3254 ===============

Item was changed:
  ----- Method: AlignmentStructType class>>printTypedefOn: (in category 'code generation') -----
  printTypedefOn: aStream
  	#('Byte' 'Short' 'Int' 'LongLong' 'Float' 'Double')
  	  with: #(#char #short #int #'long long' #float #double) do:
  		[:structName :type|
  		aStream
+ 			nextPutAll: 'typedef struct { char pad_to_misalignment; ';
- 			nextPutAll: 'typedef struct { char pad_to_misalgnment; ';
  			nextPutAll: type;
  			nextPutAll: ' element; } struct';
  			nextPutAll: structName;
  			nextPut: $;; cr; cr].
  	aStream
+ 		nextPutAll: 'typedef struct { char pad_to_misalignment; struct {char c; } element; } structStruct;';
- 		nextPutAll: 'typedef struct { char pad_to_misalgnment; struct {char c; } element; } structStruct;';
  		cr; cr!

Item was changed:
  ----- Method: ClipboardExtendedPlugin class>>preambleCCode (in category 'translation') -----
  preambleCCode
+ 	^'// declarations for the support API. eem, 10/10/2022\\void sqPasteboardClear(void *inPasteboard);\sqInt sqPasteboardGetItemCount(void *inPasteboard);\sqInt sqPasteboardCopyItemFlavorsitemNumber(void *inPasteboard, sqInt formatNumber);\void *sqCreateClipboard(void);\void sqPasteboardPutItemFlavordatalengthformatTypeformatLength(void *inPasteboard, char *inData, sqInt dataLength, char *format, sqInt formatLength);\void sqPasteboardPutItemFlavordatalengthformatType(void *inPasteboard, char *inData, sqInt dataLength, sqInt format);\sqInt sqPasteboardCopyItemFlavorDataformatformatLength(void *inPasteboard, char *format, sqInt formatLength);\sqInt sqPasteboardCopyItemFlavorDataformat(void *inPasteboard, sqInt format);' withCRs
- 	^'// declarations for the support API. eem, 2021/12/31\\void sqPasteboardClear(void *inPasteboard);\sqInt sqPasteboardGetItemCount (void *inPasteboard);\sqInt sqPasteboardCopyItemFlavorsitemNumber (void *inPasteboard, sqInt formatNumber);\void *sqCreateClipboard(void);\void sqPasteboardPutItemFlavordatalengthformatTypeformatLength (void *inPasteboard, char* inData, sqInt dataLength, char* format, sqInt formatLength);\sqInt sqPasteboardCopyItemFlavorDataformatformatLength (void *inPasteboard, char* format, sqInt formatLength);' withCRs
  
  	"quick test:"
  	"ExtendedClipboardInterface current addClipboardDataConvertFormToPNG: Display"!

Item was changed:
  ----- Method: ClipboardExtendedPlugin>>ioAddClipboardData:data:dataFormat: (in category 'io') -----
+ ioAddClipboardData: clipboard data: data dataFormat: format
+ 	| dataLength |
+ 	self primitive: 'ioAddClipboardData' parameters: #(Unsigned ByteArray Oop).
- ioAddClipboardData: clipboard data: data dataFormat: aFormat
- 	| clipboardAddress formatLength dataLength |
- 	<var: #clipboardAddress type: #'usqIntptr_t'>
- 	self primitive: 'ioAddClipboardData' parameters: #(Oop ByteArray String).
  
+ 	dataLength := interpreterProxy byteSizeOf: data cPtrAsOop.
+ 	(interpreterProxy isIntegerObject: format)
+ 		ifTrue:
+ 			[self
+ 				sqPasteboardPutItemFlavor: clipboard asVoidPointer
+ 				data: data length: dataLength
+ 				formatType: (interpreterProxy integerValueOf: format)]
+ 		ifFalse:
+ 			[(interpreterProxy isBytes: format)
+ 				ifTrue:
+ 					[self
+ 						sqPasteboardPutItemFlavor: clipboard asVoidPointer
+ 						data: data length: dataLength
+ 						formatType: (interpreterProxy firstIndexableField: format)
+ 						formatLength: (interpreterProxy byteSizeOf: format)]
+ 				ifFalse:
+ 					[interpreterProxy primitiveFailFor: PrimErrBadArgument]]!
- 	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.
- !

Item was changed:
  ----- Method: ClipboardExtendedPlugin>>ioClearClipboard: (in category 'io') -----
  ioClearClipboard: clipboard
+ 	self primitive: 'ioClearClipboard' parameters: #(Unsigned).
+ 	interpreterProxy failed ifFalse:
+ 		[self sqPasteboardClear: clipboard asVoidPointer]!
- 	| clipboardAddress |
- 	<var: #clipboardAddress type: #'usqIntptr_t'>
- 	self primitive: 'ioClearClipboard' parameters: #(Oop).
- 	clipboardAddress :=  interpreterProxy positiveMachineIntegerValueOf: clipboard.
- 	self sqPasteboardClear: clipboardAddress.!

Item was changed:
  ----- Method: ClipboardExtendedPlugin>>ioCreateClipboard (in category 'io') -----
  ioCreateClipboard
- 	| clipboardAddress |
  	self primitive: 'ioCreateClipboard' parameters: #().
+ 	^interpreterProxy positiveMachineIntegerFor: self sqCreateClipboard asUnsignedInteger!
- 
- 	clipboardAddress := interpreterProxy positiveMachineIntegerFor: self sqCreateClipboard.
- 
- 	^ clipboardAddress.!

Item was changed:
  ----- Method: ClipboardExtendedPlugin>>ioGetClipboardFormat:formatNumber: (in category 'io') -----
  ioGetClipboardFormat: clipboard formatNumber: formatNumber 
- 	| clipboardAddress itemCount |
  	<var: #clipboardAddress type: #'usqIntptr_t'>
+ 	self primitive: 'ioGetClipboardFormat' parameters: #(Unsigned SmallInteger).
+ 	^(self sqPasteboardGetItemCount: clipboard asVoidPointer) > 0
+ 		ifTrue: [self sqPasteboardCopyItemFlavors: clipboard asVoidPointer itemNumber: formatNumber]
+ 		ifFalse: [interpreterProxy nilObject]!
- 	self primitive: 'ioGetClipboardFormat' parameters: #(#Oop #SmallInteger ).
- 	clipboardAddress := interpreterProxy positiveMachineIntegerValueOf: clipboard.
- 	itemCount := self sqPasteboardGetItemCount: clipboardAddress.
- 	itemCount > 0
- 		ifTrue: [^ self sqPasteboardCopyItemFlavors: clipboardAddress itemNumber: formatNumber].
- 	^ interpreterProxy nilObject!

Item was changed:
  ----- Method: ClipboardExtendedPlugin>>ioReadClipboardData:format: (in category 'io') -----
  ioReadClipboardData: clipboard format: format
+ 	self primitive: 'ioReadClipboardData' parameters: #(Unsigned Oop).
+ 	(interpreterProxy isIntegerObject: format) ifTrue:
+ 		[^self
+ 			sqPasteboardCopyItemFlavorData: clipboard asVoidPointer
+ 			format: (interpreterProxy integerValueOf: format)].
+ 	(interpreterProxy isBytes: format) ifTrue:
+ 		[^self
+ 			sqPasteboardCopyItemFlavorData: clipboard asVoidPointer
+ 			format: (interpreterProxy firstIndexableField: format)
+ 			formatLength: (interpreterProxy byteSizeOf: format)].
+ 	interpreterProxy primitiveFailFor: PrimErrBadArgument!
- 	| 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.
- !



More information about the Vm-dev mailing list