From d3c46f7078c05fc38bde26d38f6d767167c54c6f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 1 Dec 2018 09:43:34 -0800 Subject: GLK: TADS: Add Regex class --- engines/glk/module.mk | 1 + engines/glk/tads/tads2/os.cpp | 2 +- engines/glk/tads/tads2/os.h | 20 +++++++++++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) (limited to 'engines') diff --git a/engines/glk/module.mk b/engines/glk/module.mk index 89be6a2507..a8128506c9 100644 --- a/engines/glk/module.mk +++ b/engines/glk/module.mk @@ -47,6 +47,7 @@ MODULE_OBJS := \ tads/tads.o \ tads/tads2/ler.o \ tads/tads2/os.o \ + tads/tads2/regex.o \ tads/tads2/tads2.o \ tads/tads3/tads3.o diff --git a/engines/glk/tads/tads2/os.cpp b/engines/glk/tads/tads2/os.cpp index df7cb423fe..248611d5ad 100644 --- a/engines/glk/tads/tads2/os.cpp +++ b/engines/glk/tads/tads2/os.cpp @@ -215,7 +215,7 @@ void OS::oss_change_status_right(const char *str) { oss_draw_status_line(); } -int OS::memicmp(char *s1, char *s2, int len) { +int OS::memicmp(const char *s1, const char *s2, int len) { char *x1, *x2; int i, result; diff --git a/engines/glk/tads/tads2/os.h b/engines/glk/tads/tads2/os.h index ba0058d98a..3c50cb5e64 100644 --- a/engines/glk/tads/tads2/os.h +++ b/engines/glk/tads/tads2/os.h @@ -29,6 +29,17 @@ namespace Glk { namespace TADS { namespace TADS2 { +/** + * Allocate a memory block + */ +#define mchalo(CTX, SIZE, COMMENT) ((byte *)new byte[SIZE]) + +/** + * Free a memory block + */ +#define mchfre(PTR) delete[] (byte *)PTR + + /** * The character (or characters) which mark the beginning of a special fileref string. * The important thing is that the string be one that is either not allowed in @@ -288,10 +299,17 @@ protected: */ void os_print(const char *str, size_t len); + /**@}*/ + + /** + * \defgroup Memory routines + * @{ + */ + /** * Compare two strings */ - int memicmp(char *s1, char *s2, int len); + int memicmp(const char *s1, const char *s2, int len); /**@}*/ -- cgit v1.2.3