char *strdup(const char *s1) { char *pchRetBuf; int nStrLen; HINT("strdup() is inefficient - consider dropping zero-terminated strings"); if (s1 == 0) return 0; nStrLen = strlen(s1); /* allocate enough buffer space for s1 and the null terminator */ pchRetBuf = (char *) malloc(nStrLen + 1); if (pchRetBuf == 0) /* memory allocation failed */ return 0; /* copy the string */ strcpy(pchRetBuf, s1); return pchRetBuf; }
/* << AUTO GENERATED FUNCTION: statevar_WLANResponse() */ static int statevar_WLANResponse ( UPNP_CONTEXT * context, UPNP_SERVICE * service, UPNP_TLV * tlv ) { HINT(BIN::tlv); /* << USER CODE START >> */ return OK; }
ULONG ParseJump(PUCHAR inString, PUCHAR *outString, POPTBLENTRY pEntry, PULONG poffset) { ULONG instruction; ULONG Ra; ULONG Rb; ULONG hint; Ra = GetIntReg(inString, &inString); if (!TestCharacter(inString, &inString, ',')) error(OPERAND); if (!TestCharacter(inString, &inString, '(')) error(OPERAND); Rb = GetIntReg(inString, &inString); if (!TestCharacter(inString, &inString, ')')) error(OPERAND); if (TestCharacter(inString, &inString, ',')) { // // User is giving us a hint // hint = GetValue(inString, &inString, TRUE, WIDTH_HINT); } else { hint = 0; } if (!TestCharacter(inString, &inString, '\0')) error(EXTRACHARS); instruction = OPCODE(pEntry->opCode) + JMP_FNC(pEntry->funcCode) + REG_A(Ra) + REG_B(Rb) + HINT(hint); return(instruction); }
/* Returns 0 if a command is matched and parsed, with the results of the parsing in the '*parsed' * structure. * * Returns 1 and logs an error if no command matches the argument list, contents of '*parsed' are * undefined. * * Returns 2 if the argument list is ambiguous, ie, matches more than one command, contents of * '*parsed' are undefined. * * Returns -1 and logs an error if the parsing fails due to an internal error (eg, malformed command * schema), contents of '*parsed' are undefined. * * @author Andrew Bettison <*****@*****.**> */ int cli_parse(const int argc, const char *const *args, const struct cli_schema *commands, struct cli_parsed *parsed) { int ambiguous = 0; int matched_cmd = -1; int cmd; for (cmd = 0; commands[cmd].function; ++cmd) { struct cli_parsed cmdpa; memset(&cmdpa, 0, sizeof cmdpa); cmdpa.commands = commands; cmdpa.cmdi = cmd; cmdpa.args = args; cmdpa.argc = argc; cmdpa.labelc = 0; cmdpa.varargi = -1; const char *pattern = NULL; unsigned arg = 0; unsigned opt = 0; while ((pattern = commands[cmd].words[opt])) { //DEBUGF("cmd=%d opt=%d pattern='%s' args[arg=%d]='%s'", cmd, opt, pattern, arg, arg < argc ? args[arg] : ""); unsigned patlen = strlen(pattern); if (cmdpa.varargi != -1) return WHYF("Internal error: commands[%d].word[%d]=\"%s\" - more words not allowed after \"...\"", cmd, opt, commands[cmd].words[opt]); /* These are the argument matching rules: * * "..." consumes all remaining arguments * * "word" consumes one argument that exactly matches "word", does not label it (this is the * "simple" case in the code below; all other rules label something that matched) * * "word1|word2|...|wordN" consumes one argument that exactly matches "word1" or "word2" etc. * or "wordN", labels it with the matched word (an empty alternative, eg "|word" does not * match an empty argument) * * (as a special case of the above rule, "|word" consumes one argument that exactly matches * "word" and labels it "word", but it appears in the help description as "word") * * "<label>" consumes exactly one argument "ANY", records it with label "label" * * "prefix=<any>" consumes one argument "prefix=ANY" or two arguments "prefix" "ANY", * and records the text matching ANY with label "prefix" * * "prefix <any>" consumes one argyment "prefix ANY" if available or two arguments "prefix" * "ANY", and records the text matching ANY with label "prefix" * * "prefix<any>" consumes one argument "prefixANY", and records the text matching ANY with * label "prefix" * * "[ANY]..." consumes all remaining arguments which match ANY, as defined below * * "[word]" consumes one argument if it exactly matches "word", records it with label * "word" * * "[word1|word2|...|wordN]" consumes one argument if it exactly matches "word1" or "word2" * etc. or "wordN", labels it with the matched word * * "[<label>]" consumes one argument "ANY" if available, records it with label "label" * * "[prefix=<any>]" consumes one argument "prefix=ANY" if available or two arguments * "prefix" "ANY" if available, records the text matching ANY with label "prefix" * * "[prefix <any>]" consumes one argument "prefix ANY" if available or two arguments * "prefix" "ANY" if available, records the text matching ANY with label "prefix" * * "[prefix<any>]" consumes one argument "prefixANY" if available, records the text matching * ANY with label "prefix" */ if (patlen == 3 && pattern[0] == '.' && pattern[1] == '.' && pattern[2] == '.') { cmdpa.varargi = arg; arg = argc; ++opt; } else { int optional = 0; int repeating = 0; if (patlen > 5 && pattern[0] == '[' && pattern[patlen-4] == ']' && pattern[patlen-3] == '.' && pattern[patlen-2] == '.' && pattern[patlen-1] == '.') { optional = repeating = 1; pattern += 1; patlen -= 5; } else if (patlen > 2 && pattern[0] == '[' && pattern[patlen-1] == ']') { optional = 1; pattern += 1; patlen -= 2; } unsigned oarg = arg; const char *text = NULL; const char *label = NULL; unsigned labellen = 0; const char *word = pattern; unsigned wordlen = 0; char simple = 0; unsigned alt = 0; if (patlen && *word == '|') { ++alt; ++word; } if (patlen == 0) return WHYF("Internal error: commands[%d].word[%d]=\"%s\" - empty words not allowed", cmd, opt, commands[cmd].words[opt]); for (; word < &pattern[patlen]; word += wordlen + 1, ++alt) { // Skip over empty "||word" alternative (but still count it). if (*word == '|') return WHYF("Internal error: commands[%d].word[%d]=\"%s\" - empty alternatives not allowed", cmd, opt, commands[cmd].words[opt]); // Find end of "word|" alternative. wordlen = 1; while (&word[wordlen] < &pattern[patlen] && word[wordlen] != '|') ++wordlen; // Skip remaining alternatives if we already got a match. if (text) continue; // Look for a match. const char *prefix = NULL; unsigned prefixlen = 0; char prefixarglen = 0; const char *caret = strchr(word, '<'); if (wordlen > 2 && caret && word[wordlen-1] == '>') { if ((prefixarglen = prefixlen = caret - word)) { prefix = word; if (prefixlen > 1 && (prefix[prefixlen-1] == '=' || prefix[prefixlen-1] == ' ')) --prefixarglen; label = prefix; labellen = prefixarglen; if (arg < argc) { unsigned arglen = strlen(args[arg]); if (arglen >= prefixlen && strncmp(args[arg], prefix, prefixlen) == 0) { text = args[arg++] + prefixlen; } else if (arg + 1 < argc && arglen == prefixarglen && strncmp(args[arg], prefix, prefixarglen) == 0) { ++arg; text = args[arg++]; } } } else { label = &word[1]; labellen = wordlen - 2; if (arg < argc) text = args[arg++]; } } else if (arg < argc && strlen(args[arg]) == wordlen && strncmp(args[arg], word, wordlen) == 0) { simple = 1; text = args[arg]; label = word; labellen = wordlen; ++arg; } } assert(alt > 0); if (arg == oarg && !optional) break; if (labellen && text && (optional || !simple || alt > 1)) { if (cmdpa.labelc >= NELS(cmdpa.labelv)) return WHYF("Internal error: commands[%d].word[%d]=\"%s\" - label limit exceeded", cmd, opt, commands[cmd].words[opt]); cmdpa.labelv[cmdpa.labelc].label = label; cmdpa.labelv[cmdpa.labelc].len = labellen; cmdpa.labelv[cmdpa.labelc].text = text; ++cmdpa.labelc; if (!repeating) ++opt; } else ++opt; } } //DEBUGF("cmd=%d opt=%d args[arg=%d]='%s'", cmd, opt, arg, arg < argc ? args[arg] : ""); if (!pattern && arg == argc) { /* A match! We got through the command definition with no internal errors and all literal args matched and we have a proper number of args. If we have multiple matches, then note that the call is ambiguous. */ if (matched_cmd >= 0) ++ambiguous; if (ambiguous == 1) { NOWHENCE(WHY_argv("Ambiguous command:", argc, args)); NOWHENCE(HINT("Matches the following:")); NOWHENCE(HINT_argv(" ", argc, commands[matched_cmd].words)); } if (ambiguous) NOWHENCE(HINT_argv(" ", argc, commands[cmd].words)); matched_cmd = cmd; *parsed = cmdpa; } } /* Don't process ambiguous calls */ if (ambiguous) return 2; /* Complain if we found no matching calls */ if (matched_cmd < 0) { if (argc) NOWHENCE(WHY_argv("Unknown command:", argc, args)); return 1; } return 0; }
static status_t uforth_execute_step(uforth_context_t *uf_ctx, simulation_context_t *sc, simulation_t *simulation, uforth_heap_t *heap, yana_complex_t *resultp, int i) { uforth_token_t *l_stack[16]; int l_stack_pos = 0; status_t status = SUCCESS; uforth_token_t *token; yana_real_t r1, r2, r3; yana_complex_t c1, c2; yana_real_t f = sc?simulation_context_get_f(sc, i):0.L; int s = sc?simulation_context_get_n_samples(sc):0; uforth_token_type_t head_type; bool printed = false; bool end = false; bool free_heap = false; if ( NULL == heap ) { free_heap = true; heap = uforth_heap_new(); } for ( token = uf_ctx->first ; token && !end; token = token->next ) { switch (token->type) { case UF_FREEAIR: POP_REAL("( x X -- x ) FREEAIR", r2); POP_REAL("( X x -- x ) FREEAIR", r1); PUSH_COMPLEX("FREEAIR", free_air_impedance(f, r1, r2)); break; case UF_DIRIMP: POP_REAL("( x x X -- x ) FREEAIR", r3); // theta POP_REAL("( x X x -- x ) FREEAIR", r2); // r POP_REAL("( X x x -- x ) FREEAIR", r1); // Sd PUSH_COMPLEX("FREEAIR", free_air_dir_impedance(f, r2, r1, r3)); break; case UF_MUL: POP_COMPLEX("( x X -- x ) MUL", c2); POP_COMPLEX("( X x -- x ) MUL", c1); PUSH_COMPLEX("MUL", c1*c2); break; case UF_DIV: POP_COMPLEX("( x X -- x ) DIV", c2); POP_COMPLEX("( X x -- x ) DIV", c1); PUSH_COMPLEX("DIV", c1/c2); break; case UF_ADD: POP_COMPLEX("( x X -- x ) ADD", c2); POP_COMPLEX("( X x -- x ) ADD", c1); PUSH_COMPLEX("ADD", c1+c2); break; case UF_SUB: POP_COMPLEX("( x X -- x ) SUB", c2); POP_COMPLEX("( X x -- x ) SUB", c1); PUSH_COMPLEX("SUB", c1-c2); break; case UF_NEG: POP_COMPLEX("( X -- x ) NEG", c1); PUSH_COMPLEX("NEG", -c1); break; case UF_EXP: POP_COMPLEX("( X -- x ) EXP", c1); PUSH_COMPLEX("EXP", cexp(c1)); break; case UF_POW: POP_COMPLEX("( x X -- x ) POW", c2); POP_COMPLEX("( X x -- x ) POW", c1); PUSH_COMPLEX("POW", cpow(c1, c2)); break; case UF_SQRT: POP_COMPLEX("( X -- x ) SQRT", c1); PUSH_COMPLEX("SQRT", csqrt(c1)); break; case UF_LN: POP_COMPLEX("( X -- x ) LN", c1); PUSH_COMPLEX("LN", clog(c1)); break; case UF_COS: POP_COMPLEX("( X -- x ) COS", c1); PUSH_COMPLEX("COS", ccos(c1)); break; case UF_SIN: POP_COMPLEX("( X -- x ) SIN", c1); PUSH_COMPLEX("SIN", csin(c1)); break; case UF_TAN: POP_COMPLEX("( X -- x ) TAN", c1); PUSH_COMPLEX("TAN", ctan(c1)); break; case UF_ACOS: POP_COMPLEX("( X -- x ) ACOS", c1); PUSH_COMPLEX("ACOS", cacos(c1)); break; case UF_ASIN: POP_COMPLEX("( X -- x ) ASIN", c1); PUSH_COMPLEX("ASIN", casin(c1)); break; case UF_ATAN: POP_COMPLEX("( X -- x ) ATAN", c1); PUSH_COMPLEX("ATAN", catan(c1)); break; case UF_LOG: POP_COMPLEX("( X -- x ) LOG", c1); PUSH_COMPLEX("LOG", clog10(c1)); break; case UF_PAR: POP_COMPLEX("( x X -- x ) PAR", c2); POP_COMPLEX("( X x -- x ) PAR", c1); PUSH_COMPLEX("PAR", (c1*c2)/(c1+c2) ); break; case UF_ABS: POP_COMPLEX("( X -- x ) ABS", c1); PUSH_REAL("ABS", cabs(c1)); break; case UF_ARG: POP_COMPLEX("( X -- x ) ARG", c1); PUSH_REAL("ARG", carg(c1)); break; case UF_DEG: POP_REAL("( X -- x ) DEG", r1); PUSH_REAL("DEG", 180. * r1 / M_PI ); break; case UF_ANGLE: POP_REAL("( x X -- x ) ANGLE", r2); POP_REAL("( X x -- x ) ANGLE", r1); if ( fabs(r1-r2-2.*M_PI) > fabs(r1-r2) ) { if ( fabs(r1-r2+2.*M_PI) > fabs(r1-r2) ) PUSH_REAL("ANGLE", r1-r2); else PUSH_REAL("ANGLE", r1-r2+2.*M_PI); } else { if ( fabs(r1-r2+2.*M_PI) > fabs(r1-r2-2.*M_PI) ) PUSH_REAL("ANGLE", r1-r2-2.*M_PI); else PUSH_REAL("ANGLE", r1-r2+2.*M_PI); } break; case UF_PDELAY: POP_REAL("( X -- x ) PDELAY", r1); PUSH_REAL("PDELAY", - r1 /( 2. * M_PI * f ) ); break; case UF_PREV_STEP: if ( 0 == i ) { end = true; break; } --i; f = simulation_context_get_f(sc, i); break; case UF_NEXT_STEP: if ( s-1 == i ) { end = true; break; } ++i; f = simulation_context_get_f(sc, i); break; case UF_IMAG: POP_COMPLEX("( X -- x ) IMAG", c1); PUSH_REAL("IMAG", cimag(c1)); break; case UF_REAL: POP_COMPLEX("( X -- x ) REAL", c1); PUSH_REAL("REAL", creal(c1)); break; case UF_PI: PUSH_REAL("PI", M_PI); break; case UF_RHO: PUSH_REAL("PI", YANA_RHO); break; case UF_C: PUSH_REAL("PI", YANA_C); break; case UF_MU: PUSH_REAL("PI", YANA_MU); break; case UF_F: PUSH_REAL("F", f); break; case UF_S: PUSH_REAL("F", i); break; case UF_I: PUSH_COMPLEX("I", 0. + I * 1.); break; case UF_DB: POP_COMPLEX("( X -- x ) DB", c1); PUSH_REAL("DB", 20. * log10(cabs(c1))); break; case UF_DBSPL: POP_COMPLEX("( X -- x ) DB", c1); PUSH_REAL("DB", 20. * log10(cabs(c1)/20e-6)); break; case UF_DOT: HEAD_TYPE(head_type); if ( UF_VALUE_REAL == head_type ) { POP_REAL("( X -- ) DOT", r1); fprintf(stdout, "%1.12g\t", (double)r1); } else if ( UF_VALUE_COMPLEX == head_type ) { POP_COMPLEX("( X -- ) DOT", c1); fprintf(stdout, "%1.12g\t", (double)cabs(c1)); } printed=true; break; case UF_DUP: POP_COMPLEX("( X -- x x ) DUP", c1); PUSH_COMPLEX("DUP", c1); PUSH_COMPLEX("DUP", c1); break; case UF_TO: token=token->next; if ( NULL == token ) { ERROR("TO: end of instructions stream"); status = FAILURE; goto loop_exit; } if ( token->type != UF_VALUE_SIMULATION ) { ERROR("TO: %s is not a valid word to be set", token->symbol); status = FAILURE; goto loop_exit; } POP_COMPLEX("(X -- ) TO", c1); uforth_heap_set(heap, token->symbol, c1); break; case UF_SWAP: if ( uf_ctx->stack_pos < 2 ) { ERROR("SWAP: Stack underflow"); status = FAILURE; goto loop_exit; } token_swap(&uf_ctx->stack[uf_ctx->stack_pos-1], &uf_ctx->stack[uf_ctx->stack_pos-2]); break; case UF_DROP: POP_COMPLEX("(X -- ) DROP", c1); break; case UF_IF: POP_COMPLEX("(X -- ) IF", c1); if ( 0. == c1 ) { int depth=-1; uforth_token_t *orig_position = token; while ( ( token->type != UF_ELSE && token->type != UF_THEN ) || depth != 0 ) { if ( token->type == UF_IF ) ++depth; if ( token->type == UF_THEN ) --depth; token = token->next; if ( NULL == token ) { ERROR("IF: no matching ELSE or THEN found"); token = orig_position; status = FAILURE; goto loop_exit; } } } break; case UF_ELSE: { int depth=0; uforth_token_t *orig_position = token; while ( token->type != UF_THEN || depth != 0 ) { if ( token->type == UF_IF ) ++depth; if ( token->type == UF_THEN ) --depth; token = token->next; if ( NULL == token ) { ERROR("ELSE: no matching THEN found"); token = orig_position; status = FAILURE; goto loop_exit; } } } break; case UF_THEN: //noop break; case UF_BEGIN: L_PUSH(token); break; case UF_WHILE: POP_COMPLEX("(X -- ) WHILE", c1); if ( 0. == c1 ) { L_DROP(); int depth=0; uforth_token_t *orig_position = token; while ( token->type != UF_REPEAT || 0 != depth) { if ( token->type == UF_BEGIN ) ++depth; if ( token->type == UF_UNTIL ) --depth; if ( token->type == UF_REPEAT ) --depth; if ( token->type == UF_AGAIN ) --depth; token=token->next; if ( NULL == token ) { ERROR("WHILE: no matching REPEAT found"); token = orig_position; status = FAILURE; goto loop_exit; } } } break; case UF_REPEAT: L_HEAD(token); break; case UF_UNTIL: POP_COMPLEX("(X -- ) UNTIL", c1); if ( 0. == c1 ) L_HEAD(token); else L_DROP(); break; case UF_AGAIN: L_HEAD(token); break; case UF_LEAVE: { int depth = 0; L_DROP(); uforth_token_t *orig_position = token; while ( ! ( ( token->type == UF_UNTIL || token->type == UF_REPEAT || token->type == UF_AGAIN ) && depth == 0 ) ) { if ( token->type == UF_BEGIN ) ++depth; if ( token->type == UF_UNTIL ) --depth; if ( token->type == UF_REPEAT ) --depth; if ( token->type == UF_AGAIN ) --depth; token = token->next; if ( NULL == token ) { ERROR("LEAVE: no matching UNTIL|REPEAT|AGAIN found"); token = orig_position; status = FAILURE; goto loop_exit; } } } break; case UF_DEPTH: PUSH_REAL("DEPTH", uf_ctx->stack_pos); break; case UF_LT: case UF_LE: case UF_EQ: case UF_NE: case UF_GE: case UF_GT: POP_COMPLEX("(x X -- ) IF", c2); POP_COMPLEX("(X x -- ) IF", c1); if ( cimag(c1) != 0.L || cimag(c2) != 0.L ) { ERROR("comparison between complex numbers"); status = FAILURE; goto loop_exit; } r1=creal(c1); r2=creal(c2); PUSH_REAL("comparison", UF_LT == token->type ? ( r1<r2) : UF_LE == token->type ? (r1<=r2) : UF_EQ == token->type ? (r1==r2) : UF_NE == token->type ? (r1!=r2) : UF_GE == token->type ? (r1>=r2) : UF_GT == token->type ? (r1>r2) : 0); break; case UF_VALUE_REAL: PUSH_REAL("real literal", token->r); break; case UF_VALUE_COMPLEX: assert(!"not possible"); PUSH_REAL("complex literal", token->c); break; case UF_VALUE_SIMULATION: { yana_complex_t *sim_array; const uforth_token_t *heap_token = heap_token = uforth_heap_get(heap, token->symbol); if ( NULL != heap_token ) { PUSH_COMPLEX("heap word", heap_token->c); } else { if ( token->symbol[0] != 'v' && token->symbol[0] != 'I' ) { ERROR("Unknown symbol '%s'\n", token->symbol); if ( sc ) HINT("dipoles start with 'I' and nodes start with 'v'"); status = FAILURE; goto loop_exit; } sim_array = simulation_result(simulation, token->symbol+1); if ( NULL == sim_array ) { ERROR("Unknown symbol '%s'", token->symbol); status = FAILURE; goto loop_exit; } PUSH_COMPLEX("sim", sim_array[i]); } } break; } } loop_exit: if (printed) fprintf(stdout, "\n"); if ( SUCCESS != status && NULL != token ) { fputs("ERROR: is here: ", stderr); uforth_token_t *t; for ( t = uf_ctx->first ; t != NULL ; t = t->next ) { if ( t == token ) { fprintf(stderr, ">>>%s<<<", t->symbol); break; } else { fprintf(stderr, "%s ", t->symbol); } } fputs("\n", stderr); } else if ( l_stack_pos != 0 ) { ERROR("loop stack not empty at the end of the processing"); status = FAILURE; } else if ( uf_ctx->stack_pos != 0 && NULL == resultp ) { if ( !end ) WARNING("stack not empty at the end of the processing"); uf_ctx->stack_pos = 0; } if ( SUCCESS == status && NULL != resultp) { if ( uf_ctx->stack_pos != 1 ) { ERROR("one result was expected and stack size is %d", uf_ctx->stack_pos); status = FAILURE; } else POP_COMPLEX("RESULT", *resultp); } if ( free_heap ) uforth_heap_free(heap); return status; }
const struct mips_operand * decode_mips16_operand (char type, bfd_boolean extended_p) { switch (type) { case '.': MAPPED_REG (0, 0, GP, reg_0_map); case '>': HINT (5, 22); case '0': HINT (5, 0); case '1': HINT (3, 5); case '2': HINT (3, 8); case '3': HINT (5, 16); case '4': HINT (3, 21); case '6': HINT (6, 5); case '9': SINT (9, 0); case 'G': SPECIAL (0, 0, REG28); case 'L': SPECIAL (6, 5, ENTRY_EXIT_LIST); case 'N': REG (5, 0, COPRO); case 'O': UINT (3, 21); case 'Q': REG (5, 16, HW); case 'P': SPECIAL (0, 0, PC); case 'R': MAPPED_REG (0, 0, GP, reg_31_map); case 'S': MAPPED_REG (0, 0, GP, reg_29_map); case 'T': HINT (5, 16); case 'X': REG (5, 0, GP); case 'Y': MAPPED_REG (5, 3, GP, reg32r_map); case 'Z': MAPPED_REG (3, 0, GP, reg_m16_map); case 'a': JUMP (26, 0, 2); case 'b': BIT (5, 22, 0); /* (0 .. 31) */ case 'c': MSB (5, 16, 1, TRUE, 32); /* (1 .. 32) */ case 'd': MSB (5, 16, 1, FALSE, 32); /* (1 .. 32) */ case 'e': HINT (11, 0); case 'i': JALX (26, 0, 2); case 'l': SPECIAL (6, 5, ENTRY_EXIT_LIST); case 'm': SPECIAL (7, 0, SAVE_RESTORE_LIST); case 'n': INT_BIAS (2, 0, 3, 1, 0, FALSE); /* (1 .. 4) */ case 'o': INT_ADJ (5, 16, 31, 4, FALSE); /* (0 .. 31) << 4 */ case 'r': MAPPED_REG (3, 16, GP, reg_m16_map); case 's': HINT (3, 24); case 'u': HINT (16, 0); case 'v': OPTIONAL_MAPPED_REG (3, 8, GP, reg_m16_map); case 'w': OPTIONAL_MAPPED_REG (3, 5, GP, reg_m16_map); case 'x': MAPPED_REG (3, 8, GP, reg_m16_map); case 'y': MAPPED_REG (3, 5, GP, reg_m16_map); case 'z': MAPPED_REG (3, 2, GP, reg_m16_map); } if (extended_p) switch (type) { case '<': UINT (5, 22); case '[': UINT (6, 0); case ']': UINT (6, 0); case '5': SINT (16, 0); case '8': SINT (16, 0); case 'A': PCREL (16, 0, TRUE, 0, 2, FALSE, FALSE); case 'B': PCREL (16, 0, TRUE, 0, 3, FALSE, FALSE); case 'C': SINT (16, 0); case 'D': SINT (16, 0); case 'E': PCREL (16, 0, TRUE, 0, 2, FALSE, FALSE); case 'F': SINT (15, 0); case 'H': SINT (16, 0); case 'K': SINT (16, 0); case 'U': UINT (16, 0); case 'V': SINT (16, 0); case 'W': SINT (16, 0); case 'j': SINT (16, 0); case 'k': SINT (16, 0); case 'p': BRANCH (16, 0, 1); case 'q': BRANCH (16, 0, 1); } else switch (type) { case '<': INT_ADJ (3, 2, 8, 0, FALSE); case '[': INT_ADJ (3, 2, 8, 0, FALSE); case ']': INT_ADJ (3, 8, 8, 0, FALSE); case '5': UINT (5, 0); case '8': UINT (8, 0); case 'A': PCREL (8, 0, FALSE, 2, 2, FALSE, FALSE); case 'B': PCREL (5, 0, FALSE, 3, 3, FALSE, FALSE); case 'C': INT_ADJ (8, 0, 255, 3, FALSE); /* (0 .. 255) << 3 */ case 'D': INT_ADJ (5, 0, 31, 3, FALSE); /* (0 .. 31) << 3 */ case 'E': PCREL (5, 0, FALSE, 2, 2, FALSE, FALSE); case 'F': SINT (4, 0); case 'H': INT_ADJ (5, 0, 31, 1, FALSE); /* (0 .. 31) << 1 */ case 'K': INT_ADJ (8, 0, 127, 3, FALSE); /* (-128 .. 127) << 3 */ case 'U': UINT (8, 0); case 'V': INT_ADJ (8, 0, 255, 2, FALSE); /* (0 .. 255) << 2 */ case 'W': INT_ADJ (5, 0, 31, 2, FALSE); /* (0 .. 31) << 2 */ case 'j': SINT (5, 0); case 'k': SINT (8, 0); case 'p': BRANCH (8, 0, 1); case 'q': BRANCH (11, 0, 1); } return 0; }