Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mu-impl-fast
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
40
Issues
40
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mu
mu-impl-fast
Commits
15a48ed7
Commit
15a48ed7
authored
Sep 22, 2016
by
Kunshan Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
API-GEN: Fixed function pointer types
fn() is already function pointer type. No need for `*mut fn()`.
parent
d77be823
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
api_c.rs
src/vm/api/api_c.rs
+3
-6
muapi2rustapi.py
src/vm/api/muapi2rustapi.py
+4
-0
No files found.
src/vm/api/api_c.rs
View file @
15a48ed7
...
...
@@ -11,9 +11,9 @@
use
std
::
os
::
raw
::
*
;
// some hand-written function pointer types
pub
type
C
_MuCFP_Func
=
extern
fn
();
pub
type
C
_MuValuesFreer_Func
=
extern
fn
(
*
mut
CMuValue
,
CMuCPtr
);
pub
type
C
_MuTrapHandler_Func
=
extern
fn
(
pub
type
C
MuCFP
=
extern
fn
();
pub
type
C
MuValuesFreer
=
extern
fn
(
*
mut
CMuValue
,
CMuCPtr
);
pub
type
C
MuTrapHandler
=
extern
fn
(
// input parameters
*
mut
CMuCtx
,
CMuThreadRefValue
,
...
...
@@ -54,14 +54,11 @@ pub type CMuCString = *mut c_char;
pub
type
CMuID
=
u32
;
pub
type
CMuName
=
CMuCString
;
pub
type
CMuCPtr
=
*
mut
c_void
;
pub
type
CMuCFP
=
*
mut
C_MuCFP_Func
;
pub
type
CMuBool
=
c_int
;
pub
type
CMuArraySize
=
usize
;
pub
type
CMuWPID
=
u32
;
pub
type
CMuFlag
=
u32
;
pub
type
CMuTrapHandlerResult
=
CMuFlag
;
pub
type
CMuValuesFreer
=
*
mut
C_MuValuesFreer_Func
;
pub
type
CMuTrapHandler
=
*
mut
C_MuTrapHandler_Func
;
pub
type
CMuBinOpStatus
=
CMuFlag
;
pub
type
CMuBinOptr
=
CMuFlag
;
pub
type
CMuCmpOptr
=
CMuFlag
;
...
...
src/vm/api/muapi2rustapi.py
View file @
15a48ed7
...
...
@@ -487,6 +487,10 @@ def generate_enums(ast):
def
generate_types
(
ast
):
types
=
[]
for
c
,
p
in
ast
[
"typedefs_order"
]:
if
p
.
startswith
(
"_"
):
# Such types are function types. The muapiparser is not smart enough
# to parse C funcptr types, so we define these types manually.
continue
rc
=
to_rust_type
(
c
)
rp
=
to_rust_type
(
p
)
types
.
append
(
"pub type {} = {};"
.
format
(
rc
,
rp
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment