Fix formatting (again)
This commit is contained in:
parent
9a8feadff7
commit
589c967195
@ -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
|
||||||
|
|
||||||
@ -481,12 +481,12 @@ void execute(Stack *stack, Stack *originstack, char *modname)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(NAME, "call"))
|
if (!strcmp(NAME, "call"))
|
||||||
{
|
{
|
||||||
|
|
||||||
unsigned short len = stack_pop(stack);
|
unsigned short len = stack_pop(stack);
|
||||||
char *string = calloc(len, sizeof(char));
|
char *string = calloc(len, sizeof(char));
|
||||||
|
|
||||||
for (int i = len - 1; i != -1; i--)
|
for (int i = len - 1; i != -1; i--)
|
||||||
string[i] = stack_pop(stack);
|
string[i] = stack_pop(stack);
|
||||||
|
|
||||||
@ -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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user