Skip to content

Commit 2bc6bdc

Browse files
author
wonkyhonky2024
committed
add hard reset
1 parent efd9565 commit 2bc6bdc

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

csrc/Therac.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#pragma once
12
#include <HsFFI.h>
23

34
#ifdef __cplusplus
@@ -9,7 +10,8 @@ typedef enum ExtCallType {
910
ExtCallToggleDatentComplete,
1011
ExtCallToggleEditingTakingPlace,
1112
ExtCallReset,
12-
ExtCallProceed
13+
ExtCallProceed,
14+
ExtCallHardReset
1315
} ExtCallType;
1416

1517
typedef enum BeamType {

src-lib/HsTherac25.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ btMap :: M.Map BeamTypeInt BeamType
5656
btMap = M.fromList [(1, BeamTypeXRay), (2, BeamTypeElectron), (3, BeamTypeUndefined)]
5757

5858
-- datent complete is actually "begin treatment"
59-
data ExtCallType = ExtCallSendMEOS | ExtCallToggleDatentComplete | ExtCallToggleEditingTakingPlace | ExtCallReset | ExtCallProceed
59+
data ExtCallType = ExtCallSendMEOS | ExtCallToggleDatentComplete | ExtCallToggleEditingTakingPlace | ExtCallReset | ExtCallProceed | ExtCallHardReset
6060

6161
type ExtCallTypeInt = Int
6262

6363
ectMap :: M.Map ExtCallTypeInt ExtCallType
64-
ectMap = M.fromList [(1, ExtCallSendMEOS), (2, ExtCallToggleDatentComplete), (3, ExtCallToggleEditingTakingPlace), (4, ExtCallReset), (5, ExtCallProceed)]
64+
ectMap = M.fromList [(1, ExtCallSendMEOS), (2, ExtCallToggleDatentComplete), (3, ExtCallToggleEditingTakingPlace), (4, ExtCallReset), (5, ExtCallProceed), (6, ExtCallHardReset)]
6565

6666
data ExternalCall = ExternalCall
6767
{ _ecType :: ExtCallType,
@@ -160,6 +160,7 @@ handleExternalCalls ts ecc = do
160160
ExternalCall ExtCallToggleEditingTakingPlace _ -> atomically $ toggleEditingTakingPlace ts
161161
ExternalCall ExtCallProceed _ -> atomically $ proceedTreatment ts
162162
ExternalCall ExtCallSendMEOS m -> atomically $ setTheracConsoleMEOS m ts
163+
ExternalCall ExtCallHardReset _ -> atomically $ resetTherac ts
163164
handleExternalCalls ts ecc
164165

165166
setFieldInStruct :: ASetter a1 a1 a2 b -> b -> TMVar a1 -> STM ()

0 commit comments

Comments
 (0)