Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Pipe Operations from within ArmA. Copy of ArmALib Kegetys functions atm.
- slInit:
- "myPipe" call slInit
- Initializes scriptlink named pipe, name will be '\\.\pipe\scriptlink_myPipe'. Client
- can connect after this. Returns name of pipe if succeeded, or throws exception on error
- slIsConnected:
- "myPipe" call slIsConnected
- returns boolean true if pipe 'myPipe' has a client connected to it, false otherwise
- slReadData:
- "myPipe" call slReadData
- returns array of strings containing messages from the pipe that the client has written,
- or an emptry array if no data is waiting
- slWriteData:
- ["myPipe", _data] call slWriteData
- Writes _data to pipe, data is converted to string if other than string trype
- Throws exception on error
- slClose:
- "myPipe" call slClose
- Closes scriptlink pipe. Pipe is also closed automatically when client disconnects.
- */
- #define __str "ION." + str ION_RTE_EXPORT_NUMBER + '.COMMAND|' + PIPE + '|' + DATA + ".ION";
- // ERROR, OPEN, CLOSE, ISOPEN, ISCONNECTED, READ, WRITE
- #define __f \
- private ["_str", "_result"]; \
- _str = __str; \
- ION_RTE_EXPORT_NUMBER = ION_RTE_EXPORT_NUMBER + 1; \
- _result = call compile loadFile _str; \
- if (isNil "_result") exitWith { \
- throw "Self.Suicide(StupidUser)"; \
- false \
- }; \
- _result
- // Allow using ION next to ArmALib if wished
- ION_slInit =
- {
- #define COMMAND OPEN
- #define PIPE _this
- #define DATA
- __f
- };
- ION_slIsOpen =
- {
- #define COMMAND ISOPEN
- #define PIPE _this
- #define DATA
- __f
- };
- ION_slClose =
- {
- #define COMMAND CLOSE
- #define PIPE _this
- #define DATA
- __f
- };
- ION_slIsConnected =
- {
- #define COMMAND ISCONNECTED
- #define PIPE _this
- #define DATA
- __f
- };
- ION_slReadData =
- {
- #define COMMAND READ
- #define PIPE _this
- #define DATA
- __f
- };
- ION_slWriteData =
- {
- #define COMMAND WRITE
- #define PIPE (_this select 0)
- #define DATA (_this select 1)
- __f
- };
- ION_slError =
- {
- #define COMMAND CLOSE
- #define PIPE _this
- #define DATA
- __f
- };
- // If no ArmaLib found, emulate ArmALib
- if !(ArmALib) then
- {
- slInit = ION_slInit;
- slClose = ION_slClose;
- slIsConnectioned = ION_slIsConnectioned;
- slWriteData = ION_slWriteData;
- slReadData = ION_slReadData;
- };
Add Comment
Please, Sign In to add comment