diff options
author | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 02:29:14 +0100 |
---|---|---|
committer | Paul Oliver <contact@pauloliver.dev> | 2024-02-29 02:29:14 +0100 |
commit | 3dcbc17b4c1cf69be5e3fc53ef81060c5b9c4e6b (patch) | |
tree | 73123fa525afe4c1f5110912936ca181c96d7a1c | |
parent | 6b1444aa3918382aba127c16c671f045a3586e53 (diff) |
Removed rest of common pipe references.
[#27] Code is now entirely free from the common pipe. We can begin
implementing its replacement.
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | README.md | 16 | ||||
-rw-r--r-- | bin/common/.keep | 0 | ||||
-rwxr-xr-x | bin/salis.py | 18 |
4 files changed, 12 insertions, 23 deletions
@@ -1,6 +1,5 @@ bin/__pycache__/* bin/modules/__pycache__/* -bin/common/pipe bin/error.log bin/lib/libsalis-*.so bin/sims/*.sim @@ -58,11 +58,11 @@ an organism performs an invalid instruction it is considered a *fault*. - Swapping or splitting when not owning 2 memory blocks
- Dividing by zero
-### The Common Pipe
-The common pipe is a mechanism through which different SALIS simulations can
-communicate. This is done via a FIFO file object that gets instantiated
-whenever a Salis simulation is running. Organisms can push or pull instructions
-to/from this common pipe via the SEND/RCVE instructions.
+### The Common Sender and Receiver
+Common sender and receiver are special functors through which SALIS simulations
+can communicate. Organisms can push or pull instructions via these functions,
+which must be provided by the wrapper application. With some configuration,
+genetic data may easily travel through a local or wide area network.
### Instruction set
|Name |Symbol |Arguments |Description |
@@ -95,8 +95,8 @@ to/from this common pipe via the SEND/RCVE instructions. |`DIVN` |`/` |3 |Divide two registers |
|`LOAD` |`L` |2 |Load instruction from memory |
|`WRTE` |`W` |2 |Write instruction into memory |
-|`SEND` |`S` |1 |Send instruction to common pipe |
-|`RECV` |`R` |1 |Receive instruction from common pipe |
+|`SEND` |`S` |1 |Send instruction to common sender |
+|`RECV` |`R` |1 |Receive instruction from common receiver |
|`PSHN` |`#` |1 |Push value to stack |
|`POPN` |`~` |1 |Pop value from stack |
@@ -136,7 +136,7 @@ Look at README file inside the `./bin` directory for a full list of commands. ### New features on Salis-2.0
- Tierran templates are now used instead of keys/lock pairs
- The instruction set is shorter
-- Organisms can send/receive instructions to/from a common pipe
+- Organisms can send/receive instructions through the network
### Python integration
- Salis controller/viewer is now written in python 3
diff --git a/bin/common/.keep b/bin/common/.keep deleted file mode 100644 index e69de29..0000000 --- a/bin/common/.keep +++ /dev/null diff --git a/bin/salis.py b/bin/salis.py index b59671a..5e69c40 100755 --- a/bin/salis.py +++ b/bin/salis.py @@ -48,7 +48,6 @@ class Salis: self.__log = self.__open_log_file() self.__exit = False self.save_file_path = self.__get_save_file_path() - self.common_pipe = self.__get_common_pipe() self.lib = self.__parse_lib() self.printer = Printer(self) self.handler = Handler(self) @@ -63,14 +62,9 @@ class Salis: # Based on CLI arguments, initialize a new Salis simulation or load # existing one from file. if self.args.action == "new": - self.lib.sal_main_init( - self.args.order, self.common_pipe.encode("utf-8") - ) + self.lib.sal_main_init(self.args.order) elif self.args.action == "load": - self.lib.sal_main_load( - self.save_file_path.encode("utf-8"), - self.common_pipe.encode("utf-8") - ) + self.lib.sal_main_load(self.save_file_path.encode("utf-8")) def __del__(self): """ Salis destructor. @@ -175,12 +169,6 @@ class Salis: """ return os.path.join(self.path, "sims", self.args.file) - def __get_common_pipe(self): - """ Get absolute path of the common pipe. This FIFO object may be used - by concurrent Salis simulations to share data between themselves. - """ - return os.path.join(self.path, "common/pipe") - def __parse_args(self): """ Parse command-line arguments with the 'argparse' module. To learn more about each command, invoke the simulator in one of the following @@ -346,6 +334,8 @@ class Salis: "uint32_p": POINTER(c_uint32), "string": c_char_p, "Process": None, + "Sender": None, + "Receiver": None, } # Finally, set correct arguments and return types of all Salis |