[Vm-dev] VM Maker: VMMaker.oscog-ul.2354.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Mar 10 21:58:16 UTC 2018


Levente Uzonyi uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-ul.2354.mcz

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

Name: VMMaker.oscog-ul.2354
Author: ul
Time: 10 March 2018, 10:56:45.349653 pm
UUID: b8f3192d-2b33-4a5d-83f9-785fbefbc570
Ancestors: VMMaker.oscog-eem.2353

Restored SerialPlugin's *byName* primitives on non-PharoVM VMs.

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

Item was changed:
  ----- Method: SerialPlugin>>primitiveSerialPortOpenByName:baudRate:stopBitsType:parityType:dataBits:inFlowControlType:outFlowControlType:xOnByte:xOffByte: (in category 'primitives') -----
  primitiveSerialPortOpenByName: portName baudRate: baudRate stopBitsType: stopBitsType parityType: parityType dataBits: dataBits inFlowControlType: inFlowControl outFlowControlType: outFlowControl xOnByte: xOnChar xOffByte: xOffChar
- 	<option: #PharoVM>
  	<var: #port type: 'char *'>
  
  	| port portNameSize |
  	
  	self primitive: 'primitiveSerialPortOpenByName'
  		parameters: #(String SmallInteger SmallInteger SmallInteger SmallInteger SmallInteger SmallInteger SmallInteger SmallInteger ).
  
  	portNameSize := interpreterProxy slotSizeOf: (portName asOop: String).
  	port := self cCode: 'calloc(portNameSize+1, sizeof(char))'.
  	self cCode: 'memcpy(port, portName, portNameSize)'.
  	
  	self cCode: 'serialPortOpenByName(
  			port, baudRate, stopBitsType, parityType, dataBits,
  			inFlowControl, outFlowControl, xOnChar, xOffChar)'.
  	
  	self free: port.!

Item was changed:
  ----- Method: SerialPlugin>>primitiveSerialPortReadByName:into:startingAt:count: (in category 'primitives') -----
  primitiveSerialPortReadByName: portName into: array startingAt: startIndex count: count 
- 	<option: #PharoVM>
  	<var: #port type: 'char *'>
  
  	| port portNameSize bytesRead arrayPtr |
  
  	self primitive: 'primitiveSerialPortReadByName'
  		parameters: #(String  ByteArray SmallInteger SmallInteger ).
  
  	interpreterProxy success: (startIndex >= 1 and: [startIndex + count - 1 <= (interpreterProxy byteSizeOf: array cPtrAsOop)]).
  	"adjust for zero-origin indexing"
  
  	portNameSize := interpreterProxy slotSizeOf: (portName asOop: String).
  	port := self cCode: 'calloc(portNameSize+1, sizeof(char))'.
  	self cCode: 'memcpy(port, portName, portNameSize)'.
  
  	arrayPtr := array + startIndex - 1.
  	bytesRead := self cCode: 'serialPortReadIntoByName( port, count, arrayPtr)'.
  	
  	self free: port.
  	
  	^ bytesRead asSmallIntegerObj!

Item was changed:
  ----- Method: SerialPlugin>>primitiveSerialPortWriteByName:from:startingAt:count: (in category 'primitives') -----
  primitiveSerialPortWriteByName: portName from: array startingAt: startIndex count: count 
- 	<option: #PharoVM>
  	<var: #port type: 'char *'>
  
  	| bytesWritten arrayPtr portNameSize port |
  	
  	self primitive: 'primitiveSerialPortWriteByName'
  		parameters: #(String ByteArray SmallInteger SmallInteger ).
  
  	portNameSize := interpreterProxy slotSizeOf: (portName asOop: String).
  	port := self cCode: 'calloc(portNameSize+1, sizeof(char))'.
  	self cCode: 'memcpy(port, portName, portNameSize)'.
  
  	interpreterProxy success: (startIndex >= 1 and: [startIndex + count - 1 <= (interpreterProxy byteSizeOf: array cPtrAsOop)]).
  	interpreterProxy failed
  		ifFalse: [arrayPtr := array + startIndex - 1.
  			bytesWritten := self cCode: 'serialPortWriteFromByName(port, count, arrayPtr)' ].
  	
  	self free: port.
  
  	^ bytesWritten asSmallIntegerObj!



More information about the Vm-dev mailing list