(int arch, int mode)
| 438 | private boolean diet; |
| 439 | |
| 440 | public Capstone(int arch, int mode) { |
| 441 | cs = (CS)Native.loadLibrary("capstone", CS.class); |
| 442 | int coreVersion = cs.cs_version(null, null); |
| 443 | int bindingVersion = (CS_API_MAJOR << 8) + CS_API_MINOR; |
| 444 | if (coreVersion != bindingVersion) { |
| 445 | throw new RuntimeException("Different API version between core " + coreVersion + |
| 446 | " & binding " + bindingVersion + " (CS_ERR_VERSION)"); |
| 447 | } |
| 448 | |
| 449 | this.arch = arch; |
| 450 | this.mode = mode; |
| 451 | ns = new NativeStruct(); |
| 452 | ns.handleRef = new PointerByReference(); |
| 453 | if (cs.cs_open(arch, mode, ns.handleRef) != CS_ERR_OK) { |
| 454 | throw new RuntimeException("ERROR: Wrong arch or mode"); |
| 455 | } |
| 456 | ns.csh = ns.handleRef.getValue(); |
| 457 | this.detail = CS_OPT_OFF; |
| 458 | this.diet = cs.cs_support(CS_SUPPORT_DIET); |
| 459 | } |
| 460 | |
| 461 | // return combined API version |
| 462 | public int version() { |
nothing calls this directly
no test coverage detected