+ #define OPEATS(X,Y) X##Y
+ #define OPCCAT(X,Y) OPEATS(X,Y)
+ #define OPLOAD(X,Y) \
+ do { \
+ util_debug("ASM", "loading operand data ...\n"); \
+ if (expect == EXPECT_VARIABLE) { \
+ size_t f=0; \
+ for (; f<asm_symbols_elements; f++) { \
+ if (!strncmp(asm_symbols_data[f].name, (Y), strlen(Y)) && \
+ asm_symbols_data[f].type != TYPE_FUNCTION) { \
+ (X)=asm_symbols_data[f].offset; \
+ goto OPCCAT(foundv, __LINE__); \
+ } \
+ } \
+ printf("no variable named %s\n", (Y)); \
+ break; \
+ OPCCAT(foundv,__LINE__) : \
+ printf("operand loaded for %s\n", (Y)); \
+ } else if (expect == EXPECT_FUNCTION) { \
+ /* \
+ * It's a function call not a variable association with an instruction \
+ * these are harder to handle. \
+ */ \
+ size_t f=0; \
+ if (strchr(Y, ' ')) { \
+ *strchr(Y, ' ')='\0'; \
+ } \
+ for (; f<asm_symbols_elements; f++) { \
+ if (!strncmp(asm_symbols_data[f].name, (Y), strlen(Y)) && \
+ asm_symbols_data[f].type == TYPE_FUNCTION) { \
+ (X)=asm_symbols_data[f].offset; \
+ goto OPCCAT(foundf, __LINE__); \
+ } \
+ } \
+ printf("no function named [%s]\n", (Y)); \
+ break; \
+ OPCCAT(foundf,__LINE__) : \
+ printf("operand loaded for [%s]\n", (Y)); \
+ } \