-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
headers: Fix Function Pointer as parameter arguments
Use libclang to detect kinds of parameters
- Loading branch information
1 parent
8d2f689
commit 0f816eb
Showing
7 changed files
with
160 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import unittest | ||
import sys | ||
import os | ||
import csnake | ||
sys.path.append(os.path.dirname(__file__) + "/../bw1_decomp_gen") | ||
|
||
from functions import FuncPtr, CSnakeFuncPtr | ||
|
||
|
||
class TestCSnakeFuncPtr(unittest.TestCase): | ||
def test_func_ptr_func_ptr_arg_to_code(self): | ||
f = CSnakeFuncPtr("void", [("foo", csnake.FuncPtr("void", [("param_1", "int"), ("param_2", "float"), ("param_3", "int")]))], "__fastcall") | ||
self.assertEqual(f.get_declaration("Foo"), "void (__fastcall* Foo)(void (*foo)(int param_1, float param_2, int param_3))") | ||
|
||
class TestFuncPtr(unittest.TestCase): | ||
def test_func_ptr_func_ptr_arg_to_code(self): | ||
f = FuncPtr("TestStructVftable__Foo", "__fastcall", "void", [csnake.FuncPtr("void", [("param_1", "int"), ("param_2", "float"), ("param_3", "int")])], ["foo"]) | ||
csnake_obj = f.to_csnake() | ||
self.assertEqual(csnake_obj.get_declaration("Foo"), "void (__fastcall* Foo)(void (*foo)(int param_1, float param_2, int param_3))") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters