Skip to content

Commit

Permalink
Helgobox runtime API mechanism: Support doc
Browse files Browse the repository at this point in the history
  • Loading branch information
helgoboss committed Nov 29, 2023
1 parent 9277da7 commit 207ab05
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
14 changes: 13 additions & 1 deletion api/src/runtime/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::ffi::{c_char, c_long, c_void, CStr};
use std::mem::transmute;

macro_rules! api {
($( $func_name:ident ($( $param_name:ident: $param_type:ty ),*) -> $ret_type:ty, )+) => {
($( $( #[doc = $doc:expr] )* $func_name:ident ($( $param_name:ident: $param_type:ty ),*) -> $ret_type:ty, )+) => {
pub struct HelgoboxApiPointers {
$(
$func_name: Option<fn($( $param_name: $param_type ),*) -> $ret_type>
Expand Down Expand Up @@ -37,6 +37,7 @@ macro_rules! api {
}

$(
$( #[doc = $doc] )*
pub fn $func_name(&self, $( $param_name: $param_type ),*) -> $ret_type {
self.pointers.$func_name.unwrap()($( $param_name ),*)
}
Expand All @@ -63,6 +64,17 @@ macro_rules! api {
}

api![
/// Finds the first Helgobox instance in the given project.
///
/// If the given project is `null`, it will look in the current project.
///
/// Returns the instance ID or -1 if none exists.
HB_FindFirstInstanceInProject(project: *const ReaProject) -> c_long,

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

structure field `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

trait method `HB_FindFirstInstanceInProject` should have a snake case name

Check failure on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Clippy

structure field `HB_FindFirstInstanceInProject` should have a snake case name

Check failure on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Clippy

method `HB_FindFirstInstanceInProject` should have a snake case name

Check failure on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Clippy

trait method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

structure field `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

trait method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

structure field `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

trait method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

structure field `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

trait method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

structure field `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

trait method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

structure field `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

trait method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

structure field `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

trait method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

structure field `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

trait method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

structure field `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

trait method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

structure field `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

trait method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

structure field `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

trait method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

structure field `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

trait method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

structure field `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

trait method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

structure field `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

trait method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

structure field `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

method `HB_FindFirstInstanceInProject` should have a snake case name

Check warning on line 72 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

trait method `HB_FindFirstInstanceInProject` should have a snake case name


/// Shows or hides the app for the given Helgobox instance and makes sure that the app displays
/// Playtime.
///
/// If necessary, this will also start the app and create a clip matrix for the given instance.
HB_ShowOrHidePlaytime(instance_id: c_long) -> (),

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

structure field `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

trait method `HB_ShowOrHidePlaytime` should have a snake case name

Check failure on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Clippy

structure field `HB_ShowOrHidePlaytime` should have a snake case name

Check failure on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Clippy

method `HB_ShowOrHidePlaytime` should have a snake case name

Check failure on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Clippy

trait method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

structure field `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

trait method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

structure field `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

trait method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

structure field `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

trait method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

structure field `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Check

trait method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

structure field `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

trait method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

structure field `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

trait method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

structure field `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

trait method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

structure field `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

trait method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

structure field `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

trait method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

structure field `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Build

trait method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

structure field `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

trait method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

structure field `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

trait method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

structure field `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

trait method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

structure field `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

method `HB_ShowOrHidePlaytime` should have a snake case name

Check warning on line 79 in api/src/runtime/mod.rs

View workflow job for this annotation

GitHub Actions / Test

trait method `HB_ShowOrHidePlaytime` should have a snake case name
];
11 changes: 0 additions & 11 deletions main/src/infrastructure/plugin/api_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,3 @@ pub fn register_api() {
));
});
}

// Finds the first Helgobox instance in the given project.
//
// If the given project is `null`, it will look in the current project.
//
// Returns the instance ID or -1 if none exists.

// Shows or hides the app for the given Helgobox instance and makes sure that the app displays
// Playtime.
//
// If necessary, this will also start the app and create a clip matrix for the given instance.

0 comments on commit 207ab05

Please sign in to comment.