corrected CMakeLists.txt

This commit is contained in:
nilspolek 2024-01-23 21:44:03 +01:00
parent 1c0d85b5c9
commit 797bfa45eb
3 changed files with 16 additions and 3 deletions

View File

@ -5,7 +5,18 @@ set(CMAKE_C_STANDARD 99)
add_compile_options(-g -Wall -pedantic) add_compile_options(-g -Wall -pedantic)
include_directories("./bigint/build/include") add_executable(njvm njvm.c)
# Include directories for njvm executable
target_include_directories(njvm PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/bigint/build/include)
# Add the library
add_library(bigint STATIC ${CMAKE_SOURCE_DIR}/bigint/src/bigint.c
support.c)
# Include directories for the bigint library
target_include_directories(bigint PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/bigint/build/include)
# Link the executable with the library
target_link_libraries(njvm PRIVATE bigint)
add_executable(ninja njvm.c
SDA.c)

2
njvm.c
View File

@ -43,6 +43,7 @@ void execute(struct program program) {
ObjRef tempObj2; ObjRef tempObj2;
int tempInt; int tempInt;
for (i = 0; i < *program.size; ++i) { for (i = 0; i < *program.size; ++i) {
printf("Program ist an der stelle %i\n", i);
if (debug == 1) debugMenu(fp, stack, &debug, i); if (debug == 1) debugMenu(fp, stack, &debug, i);
switch (program.program[i] >> 24) { switch (program.program[i] >> 24) {
case HALT: case HALT:
@ -276,6 +277,7 @@ void execute(struct program program) {
tempObj = pop(stack).u.objRef; tempObj = pop(stack).u.objRef;
tempObj2 = pop(stack).u.objRef; tempObj2 = pop(stack).u.objRef;
bip.op1 = pop(stack).u.objRef; bip.op1 = pop(stack).u.objRef;
bigPrint(stdout);
tempInt = bigToInt(); tempInt = bigToInt();
setField(tempObj2, tempInt,tempObj); setField(tempObj2, tempInt,tempObj);
break; break;

BIN
njvm.o

Binary file not shown.