Fix formatting (again)

This commit is contained in:
bʰedoh₂ swé 2024-06-17 21:28:52 +05:00
parent 9a8feadff7
commit 589c967195

View File

@ -1,9 +1,9 @@
#include <dlfcn.h>
#include <stdint.h> #include <stdint.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
#include <dlfcn.h>
#include "config.h" #include "config.h"
#include "execute.h" #include "execute.h"
@ -186,15 +186,15 @@ void execute(Stack *stack, Stack *originstack, char *modname)
continue; continue;
} }
if (!strcmp(NAME, "string")) if (!strcmp(NAME, "string"))
{ {
for (char *i = ARG; *i != '\0'; i++) for (char *i = ARG; *i != '\0'; i++)
stack_push(stack, *i); stack_push(stack, *i);
stack_push(stack, strlen(ARG)); stack_push(stack, strlen(ARG));
continue; continue;
} }
// Math // Math
@ -522,37 +522,38 @@ void execute(Stack *stack, Stack *originstack, char *modname)
continue; continue;
} }
// Native // Native
if (!strcmp(NAME, "native")) if (!strcmp(NAME, "native"))
{ {
char *modulename = malloc(strlen(ARG) + 7 * sizeof(char)); char *modulename = malloc(strlen(ARG) + 7 * sizeof(char));
strcpy(modulename, "./"); strcpy(modulename, "./");
strcat(modulename, ARG); strcat(modulename, ARG);
#ifdef _WIN32 #ifdef _WIN32
strcat(modulename, ".dll"); strcat(modulename, ".dll");
#else #else
strcat(modulename, ".so"); strcat(modulename, ".so");
#endif #endif
void *module = dlopen(modulename, RTLD_NOW); void *module = dlopen(modulename, RTLD_NOW);
if (!module) if (!module)
kms(stack, "UNABLE TO OPEN DYNAMIC LIBRARY"); kms(stack, "UNABLE TO OPEN DYNAMIC LIBRARY");
int (*labashka)(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void), size_t max_size ); int (*labashka)(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void),
labashka = (int (*)(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void), size_t max_size ))dlsym(module, "labashka"); size_t max_size);
labashka = (int (*)(unsigned short (*pop)(void), void (*push)(unsigned short), size_t (*len)(void),
size_t max_size))dlsym(module, "labashka");
stack_init_callback(stack);
stack_init_callback(stack); labashka(stack_pop_callback, stack_push_callback, stack_len_callback, stack->stacksize);
labashka(stack_pop_callback, stack_push_callback, stack_len_callback, stack->stacksize); dlclose(module);
dlclose(module); free(modulename);
free(modulename); continue;
}
continue;
}
// Self-modifying // Self-modifying