From a832235221d5cbaf18c49808aeeb89c4d88b3ce0 Mon Sep 17 00:00:00 2001 From: Alvin Cheng <88267875+cheng-alvin@users.noreply.github.com> Date: Sun, 26 Nov 2023 16:20:17 +1100 Subject: [PATCH] Implemented the new options --- libjas/include/init.h | 6 +++++- libjas/init.c | 9 ++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libjas/include/init.h b/libjas/include/init.h index 1207116b..4ff51a0b 100644 --- a/libjas/include/init.h +++ b/libjas/include/init.h @@ -72,6 +72,10 @@ typedef struct { * @param mode The code-generation mode for the assembler instance. * @param instance The pointer to the assembler instance to be created. * @param buffer The buffer to be used for the assembler instance. + * @param format The output format for the assembler instance. + * @param includes The includes for the assembler instance. + * @param filename The filename for the assembler instance. + * @param isFile The isFile for the assembler instance. * * @see `jasInstance_t` and `jasMode_t` for more type information. * @note The `instance` parameter can be `NULL` if you want to create @@ -84,6 +88,6 @@ typedef struct { * `malloc` or `realloc`! */ -jasErrorCode_t jasInitNew(jasMode_t mode, jasInstance_t *instance, uint8_t *buffer); +jasErrorCode_t jasInitNew(jasMode_t mode, jasInstance_t *instance, uint8_t *buffer, jasOutFormat_t format, char **includes, char *filename, bool isFile); #endif diff --git a/libjas/init.c b/libjas/init.c index b87b9ad6..7e60c38c 100644 --- a/libjas/init.c +++ b/libjas/init.c @@ -4,10 +4,17 @@ #include #include -jasErrorCode_t jasInitNew(jasMode_t mode, jasInstance_t *instance, uint8_t *buffer) { +jasErrorCode_t jasInitNew(jasMode_t mode, jasInstance_t *instance, uint8_t *buffer, jasOutFormat_t format, char **includes, char *filename, bool isFile) { + if (instance == NULL) + return JAS_ERROR_UNDEFINED_POINTER; + instance->mode = mode; instance->buffer = buffer; instance->bufferLen = 0; + instance->format = format == NULL ? JAS_OUT_FORMAT_RAW : format; + instance->includes = includes; + instance->filename = filename; + instance->isFile = isFile; return JAS_NO_ERROR; } \ No newline at end of file