Skip to content

Commit e72e702

Browse files
committed
Fixed doc warning by more pre-processing
1 parent 01cd3b2 commit e72e702

File tree

4 files changed

+63
-23
lines changed

4 files changed

+63
-23
lines changed

Cargo.lock

Lines changed: 24 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build-util/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ toml = { version = "0.8.8", default-features = false, features = ["parse"] }
2020
bindgen = "0.69.4"
2121
quote = { version = "1.0.35", default-features = false }
2222
doxygen-rs = "0.4"
23+
lazy-regex = "3.1.0"

build-util/src/bindgen.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,23 @@ impl ParseCallbacks for Callbacks {
8787
fn process_comment(&self, comment: &str) -> Option<String> {
8888
let comment = comment.replace("@param[int]", "@param[in]");
8989
let comment = comment.replace("[inout]", "[in,out]");
90-
let comment = comment.replace("[in]\t", "[in] \t");
91-
let comment = comment.replace("[out]\t", "[out] \t");
90+
91+
// doxygen_rs doesn't handle tabs well
92+
let comment = comment.replace('\t', " ");
93+
// Fixes links to functions and types
94+
let comment = comment.replace("@see ::", "@see crate::");
95+
96+
// Escape square brackets for non-links
97+
let comment =
98+
lazy_regex::regex_replace_all!("\\[([\\d]+)\\]", &comment, |_, num: &str| format!(
99+
"\\[{num}\\]"
100+
));
101+
102+
// Without space these brackets are considered to be a link
103+
let comment = comment.replace(
104+
"[1,SCE_GXM_MAX_SCENES_PER_RENDERTARGET]",
105+
"[1, SCE_GXM_MAX_SCENES_PER_RENDERTARGET]",
106+
);
92107

93108
let comment = doxygen_rs::transform(&comment);
94109

src/bindings.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2160,7 +2160,7 @@ pub struct SceGxmRenderTargetParams {
21602160
pub width: u16,
21612161
#[doc = "The height of the render target in pixels."]
21622162
pub height: u16,
2163-
#[doc = "The expected number of scenes per frame, in the range [1,SCE_GXM_MAX_SCENES_PER_RENDERTARGET]."]
2163+
#[doc = "The expected number of scenes per frame, in the range [1, SCE_GXM_MAX_SCENES_PER_RENDERTARGET]."]
21642164
pub scenesPerFrame: u16,
21652165
#[doc = "A value from the #SceGxmMultisampleMode enum."]
21662166
pub multisampleMode: u16,
@@ -14570,29 +14570,29 @@ extern "C" {}
1457014570
#[link(name = "SceHid_stub", kind = "static")]
1457114571
#[cfg(feature = "SceHid_stub")]
1457214572
extern "C" {
14573-
#[doc = "Enumerate hid keyboards.\n\n # Arguments\n\n* `\thandle\tBuffer` (direction out) - to receive keyboard hid handles.\n * `\tcount` (direction in) - Number of keyboards to enumerate"]
14573+
#[doc = "Enumerate hid keyboards.\n\n # Arguments\n\n* `handle` (direction out) - Buffer to receive keyboard hid handles.\n * `count` (direction in) - Number of keyboards to enumerate"]
1457414574
pub fn sceHidKeyboardEnumerate(
1457514575
handle: *mut crate::ctypes::c_int,
1457614576
count: crate::ctypes::c_int,
1457714577
) -> crate::ctypes::c_int;
14578-
#[doc = "Get hid keyboard reports (non-blocking).\n\n # Arguments\n\n* `\thandle\t\tHid` (direction in) - handle.\n * `\treports\t\tBuffer` (direction in) - to receive reports.\n * `\tnReports\tNumber` (direction in) - of reports to receive."]
14578+
#[doc = "Get hid keyboard reports (non-blocking).\n\n # Arguments\n\n* `handle` (direction in) - Hid handle.\n * `reports` (direction in) - Buffer to receive reports.\n * `nReports` (direction in) - Number of reports to receive."]
1457914579
pub fn sceHidKeyboardPeek(
1458014580
handle: SceUInt32,
1458114581
reports: *mut *mut SceHidKeyboardReport,
1458214582
nReports: crate::ctypes::c_int,
1458314583
) -> crate::ctypes::c_int;
14584-
#[doc = "Get hid keyboard reports (blocking).\n\n # Arguments\n\n* `\thandle\t\tHid` (direction in) - handle.\n * `\treports\t\tBuffer` (direction in) - to receive reports.\n * `\tnReports\tNumber` (direction in) - of reports to receive."]
14584+
#[doc = "Get hid keyboard reports (blocking).\n\n # Arguments\n\n* `handle` (direction in) - Hid handle.\n * `reports` (direction in) - Buffer to receive reports.\n * `nReports` (direction in) - Number of reports to receive."]
1458514585
pub fn sceHidKeyboardRead(
1458614586
handle: SceUInt32,
1458714587
reports: *mut *mut SceHidKeyboardReport,
1458814588
nReports: crate::ctypes::c_int,
1458914589
) -> crate::ctypes::c_int;
14590-
#[doc = "Enumerate hid mice.\n\n # Arguments\n\n* `\thandle\tBuffer` (direction out) - to receive mouse hid handles.\n * `\tcount` (direction in) - Number of mice to enumerate"]
14590+
#[doc = "Enumerate hid mice.\n\n # Arguments\n\n* `handle` (direction out) - Buffer to receive mouse hid handles.\n * `count` (direction in) - Number of mice to enumerate"]
1459114591
pub fn sceHidMouseEnumerate(
1459214592
handle: *mut crate::ctypes::c_int,
1459314593
count: crate::ctypes::c_int,
1459414594
) -> crate::ctypes::c_int;
14595-
#[doc = "Get hid mouse reports.\n\n # Arguments\n\n* `\thandle\t\tHid` (direction in) - handle.\n * `\treports\t\tBuffer` (direction in) - to receive reports.\n * `\tnReports\tNumber` (direction in) - of reports to receive."]
14595+
#[doc = "Get hid mouse reports.\n\n # Arguments\n\n* `handle` (direction in) - Hid handle.\n * `reports` (direction in) - Buffer to receive reports.\n * `nReports` (direction in) - Number of reports to receive."]
1459614596
pub fn sceHidMouseRead(
1459714597
handle: SceUInt32,
1459814598
reports: *mut *mut SceHidMouseReport,
@@ -15070,7 +15070,7 @@ extern "C" {
1507015070
a5: crate::ctypes::c_int,
1507115071
a6: crate::ctypes::c_int,
1507215072
) -> crate::ctypes::c_int;
15073-
#[doc = "Open or create a file for reading or writing\n\n # Example1: Open a file for reading\n if(!(fd = ksceIoOpen(\"device:/path/to/file\", SCE_O_RDONLY, 0777)) {\n\t// error\n }\n # Example2: Open a file for writing, creating it if it doesn't exist\n if(!(fd = ksceIoOpen(\"device:/path/to/file\", SCE_O_WRONLY|SCE_O_CREAT, 0777)) {\n\t// error\n }\n # Arguments\n\n* `file` - - Pointer to a string holding the name of the file to open\n * `flags` - - Libc styled flags that are or'ed together\n * `mode` - - File access mode (One or more ::SceIoMode).\n # Returns\n\nA non-negative integer is a valid fd, anything else an error"]
15073+
#[doc = "Open or create a file for reading or writing\n\n # Example1: Open a file for reading\n if(!(fd = ksceIoOpen(\"device:/path/to/file\", SCE_O_RDONLY, 0777)) {\n // error\n }\n # Example2: Open a file for writing, creating it if it doesn't exist\n if(!(fd = ksceIoOpen(\"device:/path/to/file\", SCE_O_WRONLY|SCE_O_CREAT, 0777)) {\n // error\n }\n # Arguments\n\n* `file` - - Pointer to a string holding the name of the file to open\n * `flags` - - Libc styled flags that are or'ed together\n * `mode` - - File access mode (One or more ::SceIoMode).\n # Returns\n\nA non-negative integer is a valid fd, anything else an error"]
1507415074
pub fn ksceIoOpen(
1507515075
file: *const crate::ctypes::c_char,
1507615076
flags: crate::ctypes::c_int,
@@ -16829,7 +16829,7 @@ extern "C" {
1682916829
) -> SceUID;
1683016830
#[doc = "Get the main module id for a given process.\n # Arguments\n\n* `pid` - The process to query.\n # Returns\n\nthe UID of the module else < 0 for an error."]
1683116831
pub fn ksceKernelGetModuleIdByPid(pid: SceUID) -> SceUID;
16832-
#[doc = "# Example1: Get max to 10 kernel module info\n SceKernelModuleListInfo infolists[10];\n size_t num = 10;// Get max\n uint32_t offset = 0;\n SceKernelModuleListInfo *info = &infolists[0];\n\n ksceKernelGetModuleInfoForDebugger(0x10005, infolists, &num);\n\n for(int i=0;i<num;i++){\n printf(\"name : %sinfo->module_name);\n\n if(info->segments_num == 1){\n printf(\"vaddr:0x%08Xinfo->seg1.SegmentInfo[0].vaddr);\n }else if(info->segments_num == 2){\n printf(\"vaddr:0x%08Xinfo->seg2.SegmentInfo[0].vaddr);\n }\n info = ((char *)info) + info->size;\n }\n # Arguments\n\n* `pid` (direction in) - - target pid\n * `infolists` (direction out) - - infolists output\n * `num` (direction in, out) - - Specify the maximum number of modinfolist to retrieve. If the function returns 0, it returns the number of modules loaded in the target pid in num\n\n # Returns\n\n0 on success, < 0 on error."]
16832+
#[doc = "# Example1: Get max to 10 kernel module info\n SceKernelModuleListInfo infolistssize_t num = 10;// Get max\n uint32_t offset = 0;\n SceKernelModuleListInfo *info = &infolistsksceKernelGetModuleInfoForDebugger(0x10005, infolists, &num);\n\n for(int i=0;i<num;i++){\n printf(\"name : %sinfo->module_name);\n\n if(info->segments_num == 1){\n printf(\"vaddr:0x%08Xinfo->seg1.SegmentInfo}else if(info->segments_num == 2){\n printf(\"vaddr:0x%08Xinfo->seg2.SegmentInfo}\n info = ((char *)info) + info->size;\n }\n # Arguments\n\n* `pid` (direction in) - - target pid\n * `infolists` (direction out) - - infolists output\n * `num` (direction in, out) - - Specify the maximum number of modinfolist to retrieve. If the function returns 0, it returns the number of modules loaded in the target pid in num\n\n # Returns\n\n0 on success, < 0 on error."]
1683316833
pub fn ksceKernelGetModuleInfoForDebugger(
1683416834
pid: SceUID,
1683516835
infolists: *mut SceKernelModuleListInfo,
@@ -17802,7 +17802,7 @@ extern "C" {
1780217802
#[link(name = "SceNpDrm_stub", kind = "static")]
1780317803
#[cfg(feature = "SceNpDrm_stub")]
1780417804
extern "C" {
17805-
#[doc = "Check you have npdrm activation data, and get information from it\n\n # Arguments\n\n* `act_type` (direction out) - - The pointer of activation type output.\n\n * `version_flag` (direction out) - - The pointer of version flag output.\n\n * `account_id` (direction out) - - The pointer of activated account id output.\n\n * `act_exp_time` (direction out) - - The pointer of activation expire time output, [0] is start_date, [1] is end_date\n\n # Returns\n\n0 on success, < 0 on error."]
17805+
#[doc = "Check you have npdrm activation data, and get information from it\n\n # Arguments\n\n* `act_type` (direction out) - - The pointer of activation type output.\n\n * `version_flag` (direction out) - - The pointer of version flag output.\n\n * `account_id` (direction out) - - The pointer of activated account id output.\n\n * `act_exp_time` (direction out) - - The pointer of activation expire time output, is start_date, is end_date\n\n # Returns\n\n0 on success, < 0 on error."]
1780617806
pub fn _sceNpDrmCheckActData(
1780717807
act_type: *mut crate::ctypes::c_int,
1780817808
version_flag: *mut crate::ctypes::c_int,
@@ -18368,7 +18368,7 @@ extern "C" {
1836818368
pub fn kscePowerSetArmClockFrequency(freq: crate::ctypes::c_int) -> crate::ctypes::c_int;
1836918369
#[doc = "Sets BUS clock frequency\n\n # Arguments\n\n* `freq` - - Frequency to set in Mhz\n\n # Returns\n\n0 on success, < 0 on error"]
1837018370
pub fn kscePowerSetBusClockFrequency(freq: crate::ctypes::c_int) -> crate::ctypes::c_int;
18371-
#[doc = "Set the screen brightness.\n [`::sceAVConfigSetDisplayBrightness`] for userland counterpart.\n\n # Arguments\n\n* `brightness` - Brightness that the screen will be set to (range 21-65536, 0 turns off the screen).\n\n # Returns\n\n?"]
18371+
#[doc = "Set the screen brightness.\n [`crate::sceAVConfigSetDisplayBrightness`] for userland counterpart.\n\n # Arguments\n\n* `brightness` - Brightness that the screen will be set to (range 21-65536, 0 turns off the screen).\n\n # Returns\n\n?"]
1837218372
pub fn kscePowerSetDisplayBrightness(brightness: crate::ctypes::c_int) -> crate::ctypes::c_int;
1837318373
#[doc = "Sets GPU clock frequency\n\n # Arguments\n\n* `freq` - - Frequency to set in Mhz\n\n # Returns\n\n0 on success, < 0 on error"]
1837418374
pub fn kscePowerSetGpuClockFrequency(freq: crate::ctypes::c_int) -> crate::ctypes::c_int;
@@ -18498,7 +18498,7 @@ extern "C" {
1849818498
) -> crate::ctypes::c_int;
1849918499
#[doc = "Resume a suspended process.\n # Arguments\n\n* `pid` (direction in) - The process to resume.\n # Returns\n\nZero on success, < 0 on error."]
1850018500
pub fn ksceKernelResumeProcess(pid: SceUID) -> crate::ctypes::c_int;
18501-
#[doc = "Suspend a running process.\n # Arguments\n\n* `pid` (direction in) - The process to suspend.\n * `\tstatus` (direction in) - The new status for the process.\n # Returns\n\nZero on success, < 0 on error."]
18501+
#[doc = "Suspend a running process.\n # Arguments\n\n* `pid` (direction in) - The process to suspend.\n * `status` (direction in) - The new status for the process.\n # Returns\n\nZero on success, < 0 on error."]
1850218502
pub fn ksceKernelSuspendProcess(
1850318503
pid: SceUID,
1850418504
status: crate::ctypes::c_int,
@@ -20625,33 +20625,33 @@ extern "C" {
2062520625
#[link(name = "SceTouch_stub", kind = "static")]
2062620626
#[cfg(feature = "SceTouch_stub")]
2062720627
extern "C" {
20628-
#[doc = "Disable touch force output.\n\n # Arguments\n\n* `\tport\tPort` (direction in) - number."]
20628+
#[doc = "Disable touch force output.\n\n # Arguments\n\n* `port` (direction in) - Port number."]
2062920629
pub fn sceTouchDisableTouchForce(port: SceUInt32) -> crate::ctypes::c_int;
20630-
#[doc = "Enable touch force output.\n\n # Arguments\n\n* `\tport\tPort` (direction in) - number."]
20630+
#[doc = "Enable touch force output.\n\n # Arguments\n\n* `port` (direction in) - Port number."]
2063120631
pub fn sceTouchEnableTouchForce(port: SceUInt32) -> crate::ctypes::c_int;
20632-
#[doc = "Get Touch Panel information\n\n # Arguments\n\n* `\tport\t\tPort` (direction in) - number.\n * `\tpPanelInfo\tThe` (direction out) - buffer to get the Touch Panel information."]
20632+
#[doc = "Get Touch Panel information\n\n # Arguments\n\n* `port` (direction in) - Port number.\n * `pPanelInfo` (direction out) - The buffer to get the Touch Panel information."]
2063320633
pub fn sceTouchGetPanelInfo(
2063420634
port: SceUInt32,
2063520635
pPanelInfo: *mut SceTouchPanelInfo,
2063620636
) -> crate::ctypes::c_int;
20637-
#[doc = "Get sampling state of touch panel.\n\n # Arguments\n\n* `\tport\tPort` (direction in) - number.\n * `\tpState\tThe` (direction out) - buffer to receive sampling state."]
20637+
#[doc = "Get sampling state of touch panel.\n\n # Arguments\n\n* `port` (direction in) - Port number.\n * `pState` (direction out) - The buffer to receive sampling state."]
2063820638
pub fn sceTouchGetSamplingState(
2063920639
port: SceUInt32,
2064020640
pState: *mut SceTouchSamplingState,
2064120641
) -> crate::ctypes::c_int;
20642-
#[doc = "Get touch data (Polling)\n\n # Arguments\n\n* `\tport\tport` (direction in) - number.\n * `\tpData\tBuffer` (direction out) - to receive touch data.\n * `\tnBufs\tNumber` (direction in) - of buffers to receive touch data.\n\n # Returns\n\nBuffers count, between 1 and 'nBufs'. <0 on error."]
20642+
#[doc = "Get touch data (Polling)\n\n # Arguments\n\n* `port` (direction in) - port number.\n * `pData` (direction out) - Buffer to receive touch data.\n * `nBufs` (direction in) - Number of buffers to receive touch data.\n\n # Returns\n\nBuffers count, between 1 and 'nBufs'. <0 on error."]
2064320643
pub fn sceTouchPeek(
2064420644
port: SceUInt32,
2064520645
pData: *mut SceTouchData,
2064620646
nBufs: SceUInt32,
2064720647
) -> crate::ctypes::c_int;
20648-
#[doc = "Get touch data (Blocking)\n\n # Arguments\n\n* `\tport\tPort` (direction in) - Number.\n * `\tpData\tBuffer` (direction out) - to receive touch data.\n * `\tnBufs\tNumber` (direction in) - of buffers to receive touch data.\n\n # Returns\n\nBuffers count, between 1 and 'nBufs'. <0 on error."]
20648+
#[doc = "Get touch data (Blocking)\n\n # Arguments\n\n* `port` (direction in) - Port Number.\n * `pData` (direction out) - Buffer to receive touch data.\n * `nBufs` (direction in) - Number of buffers to receive touch data.\n\n # Returns\n\nBuffers count, between 1 and 'nBufs'. <0 on error."]
2064920649
pub fn sceTouchRead(
2065020650
port: SceUInt32,
2065120651
pData: *mut SceTouchData,
2065220652
nBufs: SceUInt32,
2065320653
) -> crate::ctypes::c_int;
20654-
#[doc = "Set sampling state of touch panel.\n\n # Arguments\n\n* `\tport\tPort` (direction in) - number.\n * `\tstate\tSampling` (direction in) - state."]
20654+
#[doc = "Set sampling state of touch panel.\n\n # Arguments\n\n* `port` (direction in) - Port number.\n * `state` (direction in) - Sampling state."]
2065520655
pub fn sceTouchSetSamplingState(
2065620656
port: SceUInt32,
2065720657
state: SceTouchSamplingState,
@@ -22342,11 +22342,11 @@ pub type SceSysTimerType = crate::ctypes::c_uint;
2234222342
pub type SceThreadStatus = crate::ctypes::c_uint;
2234322343
#[doc = "Touch error codes"]
2234422344
pub type SceTouchErrorCode = crate::ctypes::c_uint;
22345-
#[doc = "Port numbers of touch panels\n\n [`::sceTouchRead`]\n [`::sceTouchPeek`]"]
22345+
#[doc = "Port numbers of touch panels\n\n [`crate::sceTouchRead`]\n [`crate::sceTouchPeek`]"]
2234622346
pub type SceTouchPortType = crate::ctypes::c_uint;
22347-
#[doc = "Info field of ::SceTouchReport structure\n\n [`::SceTouchReport`]"]
22347+
#[doc = "Info field of ::SceTouchReport structure\n\n [`crate::SceTouchReport`]"]
2234822348
pub type SceTouchReportInfo = crate::ctypes::c_uint;
22349-
#[doc = "Sampling port setting of the touch panel\n\n [`::sceTouchSetSamplingState`]"]
22349+
#[doc = "Sampling port setting of the touch panel\n\n [`crate::sceTouchSetSamplingState`]"]
2235022350
pub type SceTouchSamplingState = crate::ctypes::c_uint;
2235122351
#[doc = "Days of the week for use in repeatDays member of ::SceTriggerUtilEventParamDaily"]
2235222352
pub type SceTriggerUtilDays = crate::ctypes::c_uint;

0 commit comments

Comments
 (0)