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