WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

Commit 15a48ed7 authored by Kunshan Wang's avatar Kunshan Wang
Browse files

API-GEN: Fixed function pointer types

fn() is already function pointer type. No need for `*mut fn()`.
parent d77be823
......@@ -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 CMuCFP = extern fn();
pub type CMuValuesFreer = extern fn(*mut CMuValue, CMuCPtr);
pub type CMuTrapHandler = 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;
......
......@@ -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))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment