From 0b37390f49499527fd9aca64afddeb5dfbe5e663 Mon Sep 17 00:00:00 2001 From: david942j Date: Mon, 18 Feb 2019 19:52:51 +0800 Subject: [PATCH] Fix typos of MOS65XX (#1390) * Fix typos * make test_mos65xx.py and test_mos65xx.c have same output format * mox65xx -> mos65xx --- bindings/python/capstone/__init__.py | 2 +- bindings/python/test_mos65xx.py | 12 ++++++------ cs.c | 8 ++++---- cstool/cstool.c | 6 +++--- include/capstone/mos65xx.h | 4 ++-- suite/capstone_get_setup.c | 2 +- tests/test_mos65xx.c | 3 ++- 7 files changed, 19 insertions(+), 18 deletions(-) diff --git a/bindings/python/capstone/__init__.py b/bindings/python/capstone/__init__.py index d6fe4649..c1fa0e58 100644 --- a/bindings/python/capstone/__init__.py +++ b/bindings/python/capstone/__init__.py @@ -31,11 +31,11 @@ __all__ = [ 'CS_ARCH_SPARC', 'CS_ARCH_SYSZ', 'CS_ARCH_XCORE', - 'CS_ARCH_MOS65XX', 'CS_ARCH_M68K', 'CS_ARCH_TMS320C64X', 'CS_ARCH_M680X', 'CS_ARCH_EVM', + 'CS_ARCH_MOS65XX', 'CS_ARCH_ALL', 'CS_MODE_LITTLE_ENDIAN', diff --git a/bindings/python/test_mos65xx.py b/bindings/python/test_mos65xx.py index fc361279..b102d195 100755 --- a/bindings/python/test_mos65xx.py +++ b/bindings/python/test_mos65xx.py @@ -3,7 +3,7 @@ # Capstone Python bindings, by Sebastian Macke from __future__ import print_function from capstone import * -from capstone.mips import * +from capstone.mos65xx import * from xprint import to_hex, to_x MOS65XX_CODE = b"\x0d\x34\x12\x00\x81\x65\x87\x6c\x01\x00\x85\xFF\x10\x00\x19\x42\x42\x00\x49\x42" @@ -33,18 +33,18 @@ def print_insn_detail(insn): # "data" instruction generated by SKIPDATA option has no detail if insn.id == 0: return - print("\taddress mode = %s" % (address_modes[insn.am])) - print("\tmodifies flags = %r" % (insn.modifies_flags != 0)) + print("\taddress mode: %s" % (address_modes[insn.am])) + print("\tmodifies flags: %s" % ('true' if insn.modifies_flags != 0 else 'false')) if len(insn.operands) > 0: print("\top_count: %u" % len(insn.operands)) c = -1 for i in insn.operands: c += 1 - if i.type == MIPS_OP_REG: + if i.type == MOS65XX_OP_REG: print("\t\toperands[%u].type: REG = %s" % (c, insn.reg_name(i.reg))) - if i.type == MIPS_OP_IMM: + if i.type == MOS65XX_OP_IMM: print("\t\toperands[%u].type: IMM = 0x%s" % (c, to_x(i.imm))) - if i.type == MIPS_OP_MEM: + if i.type == MOS65XX_OP_MEM: print("\t\toperands[%u].type: MEM = 0x%s" % (c, to_x(i.mem))) diff --git a/cs.c b/cs.c index be258431..3a5b1b37 100644 --- a/cs.c +++ b/cs.c @@ -1381,11 +1381,11 @@ int CAPSTONE_API cs_op_count(csh ud, const cs_insn *insn, unsigned int op_type) if (insn->detail->evm.operands[i].type == (evm_op_type)op_type) count++; #endif - case CS_ARCH_MOS65XX: - for (i = 0; i < insn->detail->m680x.op_count; i++) - if (insn->detail->m680x.operands[i].type == (m680x_op_type)op_type) - count++; break; + case CS_ARCH_MOS65XX: + for (i = 0; i < insn->detail->mos65xx.op_count; i++) + if (insn->detail->mos65xx.operands[i].type == (mos65xx_op_type)op_type) + count++; break; } diff --git a/cstool/cstool.c b/cstool/cstool.c index 3fb54a0d..a45dcd05 100644 --- a/cstool/cstool.c +++ b/cstool/cstool.c @@ -56,7 +56,7 @@ static struct { { "hd6309", CS_ARCH_M680X, CS_MODE_M680X_6309 }, { "hcs08", CS_ARCH_M680X, CS_MODE_M680X_HCS08 }, { "evm", CS_ARCH_EVM, 0 }, - { "mos65xx", CS_ARCH_MOS65XX, 0 }, + { "mos65xx", CS_ARCH_MOS65XX, 0 }, { NULL } }; @@ -211,7 +211,7 @@ static void usage(char *prog) } if (cs_support(CS_ARCH_MOS65XX)) { - printf(" mox65xx MOS65XX family\n"); + printf(" mos65xx MOS65XX family\n"); } printf("\nExtra options:\n"); @@ -360,7 +360,7 @@ int main(int argc, char **argv) } if (cs_support(CS_ARCH_MOS65XX)) { - printf("mox65xx=1 "); + printf("mos65xx=1 "); } if (cs_support(CS_SUPPORT_DIET)) { diff --git a/include/capstone/mos65xx.h b/include/capstone/mos65xx.h index ab7a27ba..772fba9e 100644 --- a/include/capstone/mos65xx.h +++ b/include/capstone/mos65xx.h @@ -39,7 +39,7 @@ typedef enum mos65xx_address_mode { MOS65XX_AM_IND, ///< absolute indirect addressing } mos65xx_address_mode; -/// M68K instruction +/// MOS65XX instruction typedef enum mos65xx_insn { MOS65XX_INS_INVALID = 0, MOS65XX_INS_ADC, @@ -101,7 +101,7 @@ typedef enum mos65xx_insn { MOS65XX_INS_ENDING, // <-- mark the end of the list of instructions } mos65xx_insn; -/// Group of M68K instructions +/// Group of MOS65XX instructions typedef enum mos65xx_group_type { MOS65XX_GRP_INVALID = 0, ///< CS_GRP_INVALID MOS65XX_GRP_JUMP, ///< = CS_GRP_JUMP diff --git a/suite/capstone_get_setup.c b/suite/capstone_get_setup.c index 612a7d67..a166645c 100644 --- a/suite/capstone_get_setup.c +++ b/suite/capstone_get_setup.c @@ -65,7 +65,7 @@ int main() } if (cs_support(CS_ARCH_MOS65XX)) { - printf("mox65xx=1 "); + printf("mos65xx=1 "); } if (cs_support(CS_SUPPORT_DIET)) { diff --git a/tests/test_mos65xx.c b/tests/test_mos65xx.c index 14dc8195..3aa4b6a7 100644 --- a/tests/test_mos65xx.c +++ b/tests/test_mos65xx.c @@ -23,7 +23,7 @@ static void print_string_hex(const char *comment, unsigned char *str, size_t len printf("%s", comment); for (c = str; c < str + len; c++) { - printf("0x%02x ", *c & 0xff); + printf(" 0x%02x", *c & 0xff); } printf("\n"); @@ -142,6 +142,7 @@ static void test() for (j = 0; j < count; j++) { printf("0x%" PRIx64 ":\t%s\t%s\n", insn[j].address, insn[j].mnemonic, insn[j].op_str); print_insn_detail(&insn[j]); + puts(""); } printf("0x%" PRIx64 ":\n", insn[j-1].address + insn[j-1].size);