2024-02-19 22:25:25 +01:00
|
|
|
#include <string.h>
|
|
|
|
|
2024-02-29 22:53:11 +01:00
|
|
|
void asm_rules(char *in, char _asm[27]){
|
2024-02-19 22:25:25 +01:00
|
|
|
|
|
|
|
|
|
|
|
char *word = strtok(in, " ");
|
|
|
|
|
|
|
|
while(word != NULL) {
|
|
|
|
|
|
|
|
if (word[strlen(word)-1] == '\n') {
|
|
|
|
word[strlen(word)-1] = '\0'; //cleans newline from string
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strcmp(word, "nop") == 0) {
|
|
|
|
//keeps the default value (0)
|
|
|
|
} else {
|
|
|
|
if (strcmp(word, "max") == 0) {
|
2024-02-29 22:53:11 +01:00
|
|
|
_asm[6] = 1;
|
|
|
|
} else if (strcmp(word, "min")) {
|
|
|
|
_asm[6] = 2;
|
|
|
|
} else if (strcmp(word, "min")) {
|
|
|
|
_asm[6] = 2;
|
|
|
|
} else if (strcmp(word, "xor")) {
|
|
|
|
//_asm[5] = 1;
|
|
|
|
for (int i = 0; i < 27; i++) {
|
|
|
|
_asm[i]=2;
|
|
|
|
}
|
|
|
|
} else if (strcmp(word, "any")) {
|
|
|
|
_asm[6] = 2;
|
|
|
|
_asm[5] = 1;
|
|
|
|
} else if (strcmp(word, "cons")) {
|
|
|
|
_asm[6] = 1;
|
|
|
|
_asm[5] = 1;
|
2024-02-19 22:25:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
word = strtok(NULL, " ");
|
|
|
|
}
|
|
|
|
}
|