40 lines
800 B
C
40 lines
800 B
C
#include <string.h>
|
|
|
|
void asm_rules(char *in, char _asm[27]){
|
|
|
|
|
|
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) {
|
|
_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;
|
|
}
|
|
}
|
|
|
|
word = strtok(NULL, " ");
|
|
}
|
|
}
|