-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
118b85f
commit a7a224f
Showing
3 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include "Therac.h" | ||
#include "HsFFI.h" | ||
#include <HsTherac25_stub.h> | ||
HsStablePtr start_machine() { | ||
|
||
char * argv[4] = {(char *)"-threaded",(char *)"+RTS",(char *)"-N",(char *)"-RTS"}; | ||
int argc = 4; | ||
char **pargv = argv; | ||
hs_init(&argc, &pargv); | ||
return startMachine(); | ||
} | ||
void kill_machine() { hs_exit(); } | ||
void wrap_external_call( | ||
HsStablePtr wrapped_comms, | ||
ExtCallType ext_call_type, | ||
BeamType beam_type, | ||
CollimatorPosition collimator_position, | ||
HsInt beam_energy | ||
) { | ||
|
||
externalCallWrap( | ||
wrapped_comms, | ||
ext_call_type, | ||
beam_type, | ||
collimator_position, | ||
beam_energy | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#include <HsFFI.h> | ||
typedef enum ExtCallType { | ||
CheekyPadding, | ||
ExtCallSendMEOS, | ||
ExtCallToggleDatentComplete, | ||
ExtCallToggleEditingTakingPlace, | ||
ExtCallReset, | ||
ExtCallProceed | ||
} ExtCallType; | ||
|
||
typedef enum BeamType { | ||
BTCheekyPadding, | ||
BeamTypeXRay, | ||
BeamTypeElectron, | ||
BeamTypeUndefined | ||
} BeamType; | ||
typedef enum CollimatorPosition { | ||
CPCheekyPadding, | ||
CollimatorPositionXRay, | ||
CollimatorPositionElectronBeam, | ||
CollimatorPositionUndefined | ||
} CollimatorPosition; | ||
typedef enum StateInfoRequest { | ||
SIRCheekyPadding, | ||
RequestTreatmentOutcome, | ||
RequestActiveSubsystem, | ||
RequestTreatmentState, | ||
RequestReason, | ||
RequestBeamMode, | ||
RequestBeamEnergy | ||
} StateInfoRequest; | ||
#ifdef __cplusplus | ||
extern "C" { // only need to export C interface if | ||
// used by C++ source code | ||
#endif | ||
#if mingw32_HOST_OS || _WIN32 | ||
__declspec(dllexport) HsStablePtr start_machine(); | ||
__declspec(dllexport) void kill_machine(); | ||
__declspec(dllexport) void wrap_external_call( | ||
HsStablePtr wrapped_comms, | ||
ExtCallType ext_call_type, | ||
BeamType beam_type, | ||
CollimatorPosition collimator_position, | ||
HsInt beam_energy | ||
); | ||
#else | ||
HsStablePtr start_machine(); | ||
void kill_machine(); | ||
void wrap_external_call( | ||
HsStablePtr wrapped_comms, | ||
ExtCallType ext_call_type, | ||
BeamType beam_type, | ||
CollimatorPosition collimator_position, | ||
HsInt beam_energy | ||
); | ||
#endif | ||
#ifdef __cplusplus | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters