update HACK.TXT with coding style

This commit is contained in:
Nguyen Anh Quynh 2019-02-02 07:39:07 +08:00
parent 064ae66bf4
commit bc43e9fca1
1 changed files with 24 additions and 15 deletions

View File

@ -1,5 +1,7 @@
Capstone source is organized as followings. Code structure
--------------
Capstone source is organized as followings.
. <- core engine + README + COMPILE.TXT etc . <- core engine + README + COMPILE.TXT etc
├── arch <- code handling disasm engine for each arch ├── arch <- code handling disasm engine for each arch
@ -51,43 +53,50 @@ See bindings/<language>/README for detail instructions on how to compile &
install the bindings. install the bindings.
Adding an architecture : Coding style
------------
- C code follows Linux kernel coding style, using tabs for indentation.
- Python code uses 4 spaces for indentation.
Adding an architecture
----------------------
Obviously, you first need to write all the logic and put it in a new directory arch/newarch Obviously, you first need to write all the logic and put it in a new directory arch/newarch
Then, you have to modify other files. Then, you have to modify other files.
(You can look for one architecture such as EVM in these files to get what you need to do) (You can look for one architecture such as EVM in these files to get what you need to do)
Integrate : Integrate:
- cs.c - cs.c
- cstool/cstool.c - cstool/cstool.c
- cstool/cstool_newarch.c : print the architecture specific details - cstool/cstool_newarch.c: print the architecture specific details
- include/capstone/capstone.h - include/capstone/capstone.h
- include/capstone/newarch.h : create this file to export all specifics about the new architecture - include/capstone/newarch.h: create this file to export all specifics about the new architecture
Compile : Compile:
- CMakeLists.txt - CMakeLists.txt
- Makefile - Makefile
- config.mk - config.mk
Tests : Tests:
- tests/Makefile - tests/Makefile
- tests/test_basic.c - tests/test_basic.c
- tests/test_detail.c - tests/test_detail.c
- tests/test_iter.c - tests/test_iter.c
- tests/test_newarch.c - tests/test_newarch.c
- suite/fuzz/fuzz_disasm.c : add the architecture and its modes to the list of fuzzed platforms - suite/fuzz/fuzz_disasm.c: add the architecture and its modes to the list of fuzzed platforms
Bindings : Bindings:
- bindings/Makefile - bindings/Makefile
- bindings/const_generator.py : add the header file and the architecture - bindings/const_generator.py: add the header file and the architecture
- bindings/python/Makefile - bindings/python/Makefile
- bindings/python/capstone/__init__.py - bindings/python/capstone/__init__.py
- bindings/python/capstone/newarch.py : define the python structures - bindings/python/capstone/newarch.py: define the python structures
- bindings/python/capstone/newarch_const.py : generate this file - bindings/python/capstone/newarch_const.py: generate this file
- bindings/python/test_newarch.py : create a basic decoding test - bindings/python/test_newarch.py: create a basic decoding test
- bindings/python/test_all.py - bindings/python/test_all.py
Docs : Docs:
- README.md - README.md
- HACK.txt - HACK.txt
- CREDITS.txt : add your name - CREDITS.txt: add your name