VM Maker: VMMaker.oscog-eem.2835.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

VM Maker: VMMaker.oscog-eem.2835.mcz

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

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

Name: VMMaker.oscog-eem.2835
Author: eem
Time: 7 October 2020, 3:30:37.335531 pm
UUID: 026231bb-5f37-4ea7-8aa1-88114061ee43
Ancestors: VMMaker.oscog-eem.2834

CameraPlugin: extend the interface to allow interrupt-driven frame receipt.

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

Item was changed:
  ----- Method: CameraPlugin>>primCameraName (in category 'primitives') -----
  primCameraName
+ "Answer the name for the camera with the given number.
+ Fail if the camera number is less than one or greater than the number of available cameras."
- "Get the name for the camera with the given number. Fail if the camera number is greater than the number of available cameras."
 
- | cameraNum nameStr count resultOop dst |
  <export: true>
+ | cameraNum |
- <var: 'nameStr' declareC: 'char* nameStr'>
- <var: 'dst' declareC: 'char* dst'>
-
  cameraNum := interpreterProxy stackIntegerValue: 0.
+ interpreterProxy failed ifFalse:
+ [interpreterProxy methodReturnString: (self CameraName: cameraNum)]!
- interpreterProxy failed ifTrue: [^ 0].
-
- nameStr := self cCode: 'CameraName(cameraNum)'.
- nameStr = nil ifTrue: [
- interpreterProxy success: false.
- ^ 0].
-
- count := self cCode: '(int) strlen(nameStr)'.
- resultOop := interpreterProxy instantiateClass: interpreterProxy classString indexableSize: count.
- dst := self cCoerce: (interpreterProxy firstIndexableField: resultOop) to: 'char *'.
- 0 to: count - 1 do: [:i | dst at: i put: (nameStr at: i)].
-
- interpreterProxy pop: 2 thenPush: resultOop.  "pop arg and rcvr, push result"
- ^ 0
- !

Item was changed:
  ----- Method: CameraPlugin>>primCloseCamera (in category 'primitives') -----
  primCloseCamera
  "Close the camera. Do nothing if it was not open."
 
- | cameraNum |
  <export: true>
+ | cameraNum |
  cameraNum := interpreterProxy stackIntegerValue: 0.
  interpreterProxy failed ifTrue: [^ 0].
 
+ self CameraClose: cameraNum.
- self cCode: 'CameraClose(cameraNum)'.
 
+ interpreterProxy methodReturnReceiver!
- interpreterProxy pop: 1.  "pop arg, leave rcvr on stack"
- ^ 0
- !

Item was changed:
  ----- Method: CameraPlugin>>primOpenCamera (in category 'primitives') -----
  primOpenCamera
  "Open a camera. Takes one argument, the index of the device to open."
 
- | cameraNum desiredFrameWidth desiredFrameHeight ok |
  <export: true>
+ | cameraNum desiredFrameWidth desiredFrameHeight ok |
 
  cameraNum := interpreterProxy stackIntegerValue: 2.
  desiredFrameWidth := interpreterProxy stackIntegerValue: 1.
  desiredFrameHeight := interpreterProxy stackIntegerValue: 0.
+ interpreterProxy failed ifTrue: [^0].
- interpreterProxy failed ifTrue: [^ 0].
 
+ ok := self CameraOpen: cameraNum _: desiredFrameWidth _: desiredFrameHeight.
+ ok <= 0 ifTrue:
+ [interpreterProxy success: false.
+ ^0].
- ok := self cCode: 'CameraOpen(cameraNum, desiredFrameWidth, desiredFrameHeight)'.
- ok = 0 ifTrue: [
- interpreterProxy success: false.
- ^ 0].
 
+ interpreterProxy methodReturnReceiver!
- interpreterProxy pop: 3.  "pop args, leave rcvr on stack"
- ^ 0
- !

Item was added:
+ ----- Method: CameraPlugin>>primSetCameraSemaphore (in category 'primitives') -----
+ primSetCameraSemaphore
+ "Supplies a semaphoreIndex through which to signal a semaphore when a frame is available from a camera.
+ Fails if the platform does not provide an interrupt-driven camera interface."
+
+ <export: true>
+ | cameraNum failCode semaphoreIndex |
+
+ cameraNum := interpreterProxy stackIntegerValue: 1.
+ semaphoreIndex := interpreterProxy stackIntegerValue: 0.
+ interpreterProxy failed ifTrue: [^0].
+
+ failCode := self Camera: cameraNum SetSemaphore: semaphoreIndex.
+ failCode ~= 0 ifTrue: [^interpreterProxy primitiveFailFor: failCode].
+
+ interpreterProxy methodReturnReceiver!

Item was changed:
  ----- Method: HostWindowPluginSimulator>>ioSizeOfWindowSet:x:y: (in category 'primitive simulation') -----
  ioSizeOfWindowSet: windowIndex x: x y: y
  <primitive: 'primitiveHostWindowSizeSet' module: 'HostWindowPlugin' error: ec>
  ^-1
 
+ "self basicNew ioSizeOfWindowSet: 1 x: Display width - 32 y: Display height - 32"
+ "self basicNew ioSizeOfWindowSet: 1 x: Display width + 32 y: Display height + 32"!
- "self basicNew ioSizeOfWindowSet: 1 x: 500 y: 500"
- "self basicNew ioSizeOfWindowSet: 1 x: 64 y: 64"!