diff --git a/debian/changelog b/debian/changelog index fad4c0d..aedc745 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -rabs (2.27.5) UNRELEASED; urgency=medium +rabs (2.28.1) UNRELEASED; urgency=medium * Updates. * Updates. @@ -50,5 +50,6 @@ rabs (2.27.5) UNRELEASED; urgency=medium * Updates. * Updates. * Updates. + * Updates. - -- Raja Mukherji Fri, 17 Feb 2023 09:45:21 +0000 + -- Raja Mukherji Mon, 08 May 2023 08:08:13 +0100 diff --git a/minilang b/minilang index 9caa11b..e97df49 160000 --- a/minilang +++ b/minilang @@ -1 +1 @@ -Subproject commit 9caa11b5a10064edb43312852d360b8462430944 +Subproject commit e97df49717682181483062c15d0e1a13ab0a4120 diff --git a/radb b/radb index a128980..37fe24d 160000 --- a/radb +++ b/radb @@ -1 +1 @@ -Subproject commit a128980d7668f7e48fa6e8a12b5577e2f484a3a6 +Subproject commit 37fe24d25dd144002c08ab249bfab0b064f5caa5 diff --git a/src/rabs.c b/src/rabs.c index 1f29798..ac785f1 100644 --- a/src/rabs.c +++ b/src/rabs.c @@ -710,11 +710,15 @@ ML_FUNCTION(Open) { //>file // Opens the file at path :mini:`Path` with the specified mode. ML_CHECK_ARG_COUNT(2); + ML_CHECK_ARG_TYPE(1, MLStringT); ml_stringbuffer_t Buffer[1] = {ML_STRINGBUFFER_INIT}; ml_value_t *Result = ml_stringbuffer_simple_append(Buffer, Args[0]); if (ml_is_error(Result)) return Result; - char *FileName = ml_stringbuffer_get_string(Buffer); - return ml_simple_inline((ml_value_t *)MLFileOpen, 2, ml_string(FileName, -1), Args[1]); + const char *Path = ml_stringbuffer_get_string(Buffer); + const char *Mode = ml_string_value(Args[1]); + FILE *Handle = fopen(Path, Mode); + if (!Handle) return ml_error("FileError", "failed to open %s in mode %s: %s", Path, Mode, strerror(errno)); + return ml_file(Handle); } static const char *find_root(const char *Path) { diff --git a/src/rabs.h b/src/rabs.h index 556a5e7..fd1d022 100644 --- a/src/rabs.h +++ b/src/rabs.h @@ -30,7 +30,7 @@ extern __thread target_t *CurrentTarget; ml_value_t *rabs_global(const char *Name); ml_value_t *rabs_ml_global(void *Data, const char *Name, const char *Source, int Line, int Mode); -#define CURRENT_VERSION 2, 27, 8 +#define CURRENT_VERSION 2, 28, 1 #define MINIMAL_VERSION 2, 10, 0 #endif