This commit is contained in:
Aer Iz 2024-02-13 00:51:01 +02:00
parent c8261b7497
commit d7bed5e1a8

View File

@ -21,6 +21,7 @@ typedef enum
MINC = '+', MINC = '+',
MDEC = '-', MDEC = '-',
PDRAIN = '/', // Haha drain gang
PPIPE = '|' PPIPE = '|'
} OP; } OP;
@ -34,6 +35,15 @@ static void prefix_operator(Stack *stack, char op)
switch (op) switch (op)
{ {
case PDRAIN:
NAME++;
stack_push(stack, DATA);
DATA = 0;
break;
case PPIPE: case PPIPE:
NAME++; NAME++;
@ -129,6 +139,9 @@ void execute(Stack *stack, Stack *originstack, char *modname)
{ {
prefix_operator(stack, NAME[0]); prefix_operator(stack, NAME[0]);
if (NAME[0] == '#' || NAME[0] == '$')
NAME++;
if (NAME[0] == '@') if (NAME[0] == '@')
continue; continue;
@ -388,25 +401,13 @@ void execute(Stack *stack, Stack *originstack, char *modname)
continue; continue;
} }
if (!strcmp(NAME, "$println")) // arg <string> if (!strcmp(NAME, "println")) // arg <string>
{ {
printf("%s\n", ARG); printf("%s\n", ARG);
continue; continue;
} }
if (!strcmp(NAME, "#println")) // arg <string> if (!strcmp(NAME, "print")) // arg <string>
{
printf("%s\n", ARG);
continue;
}
if (!strcmp(NAME, "$print")) // arg <string>
{
printf("%s", ARG);
continue;
}
if (!strcmp(NAME, "#print")) // arg <const>
{ {
printf("%s", ARG); printf("%s", ARG);
continue; continue;
@ -435,7 +436,7 @@ void execute(Stack *stack, Stack *originstack, char *modname)
continue; continue;
} }
if (!strcmp(NAME, "#exec")) // arg <const> if (!strcmp(NAME, "exec")) // arg <const>
{ {
if (!strcmp(ARG, modname)) if (!strcmp(ARG, modname))
@ -471,7 +472,7 @@ void execute(Stack *stack, Stack *originstack, char *modname)
// Self-modifying // Self-modifying
if (!strcmp(NAME, "#insert")) // arg <const> if (!strcmp(NAME, "insert")) // arg <const>
{ {
if (ARG[0] == '#' || ARG[0] == '$') if (ARG[0] == '#' || ARG[0] == '$')
kms(stack, "ATTEMPTED TO INSERT A HASH/STRING-INSTRUCTION"); kms(stack, "ATTEMPTED TO INSERT A HASH/STRING-INSTRUCTION");
@ -512,7 +513,7 @@ void execute(Stack *stack, Stack *originstack, char *modname)
continue; continue;
} }
if (!strcmp(NAME, "#expr")) // arg <const> if (!strcmp(NAME, "expr")) // arg <const>
{ {
expression(stack, ARG); expression(stack, ARG);
continue; continue;