Skip to content

Commit

Permalink
Implemented the new options
Browse files Browse the repository at this point in the history
  • Loading branch information
cheng-alvin committed Nov 26, 2023
1 parent d4513fd commit a832235
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion libjas/include/init.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
9 changes: 8 additions & 1 deletion libjas/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,17 @@
#include <stdint.h>
#include <stdlib.h>

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;
}

0 comments on commit a832235

Please sign in to comment.