mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 11:46:41 +01:00
collect crates/ and deps/
This commit is contained in:
parent
2f8882f6cd
commit
8fa0f8a409
140 changed files with 23 additions and 21 deletions
15
deps/suil/Cargo.toml
vendored
Normal file
15
deps/suil/Cargo.toml
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
[package]
|
||||
name = "tek_suil"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
gtk = "0.18.1"
|
||||
livi = "0.7.4"
|
||||
#winit = { version = "0.30.4", features = [ "x11" ] }
|
||||
|
||||
[build-dependencies]
|
||||
bindgen = "0.69.4"
|
||||
|
||||
[dev-dependencies]
|
||||
winit = { version = "0.30.4", features = [ "x11" ] }
|
||||
18
deps/suil/build.rs
vendored
Normal file
18
deps/suil/build.rs
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
use std::path::PathBuf;
|
||||
use std::env::var;
|
||||
use bindgen::{Builder, CargoCallbacks};
|
||||
fn main() {
|
||||
//println!("cargo:rustc-link-lib=lv2");
|
||||
println!("cargo:rustc-link-lib=suil-0");
|
||||
let bindings = Builder::default()
|
||||
.header("wrapper.h")
|
||||
//.clang_arg("-Ilv2/include/lv2")
|
||||
.clang_arg("-Isuil/include/suil")
|
||||
.parse_callbacks(Box::new(CargoCallbacks::new()))
|
||||
.generate()
|
||||
.expect("Unable to generate bindings");
|
||||
let out_path = PathBuf::from(var("OUT_DIR").unwrap());
|
||||
bindings
|
||||
.write_to_file(out_path.join("bindings.rs"))
|
||||
.expect("Couldn't write bindings!");
|
||||
}
|
||||
5
deps/suil/src/bound.rs
vendored
Normal file
5
deps/suil/src/bound.rs
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#![allow(non_upper_case_globals)]
|
||||
#![allow(non_camel_case_types)]
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
|
||||
37
deps/suil/src/gtk.rs
vendored
Normal file
37
deps/suil/src/gtk.rs
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
struct SuilX11Wrapper {
|
||||
socket: GtkSocket,
|
||||
plug: GtkPlug,
|
||||
wrapper: SuilWrapper,
|
||||
instance: SuilInstance,
|
||||
idle_iface: LV2UI_Idle_Interface,
|
||||
idle_id: usize,
|
||||
idle_ms: usize,
|
||||
idle_size_req_id: usize,
|
||||
initial_width: usize,
|
||||
initial_height: usize,
|
||||
req_width: usize,
|
||||
req_height: usize,
|
||||
}
|
||||
|
||||
struct SuilX11WrapperClass {
|
||||
parent_class: GtkSocketClass,
|
||||
}
|
||||
|
||||
impl SuilX11Wrapper {
|
||||
fn x_window_is_valid (&self) {
|
||||
let window: GdkWindow = gtk_widget_get_window(self.plug);
|
||||
let root: X11Window = Some(0);
|
||||
let parent: X11Window = Some(0);
|
||||
let children: [X11Window] = None;
|
||||
let child_count: usize = 0;
|
||||
x_query_tree(window.xdisplay, window.xid, root, parent, children, &mut childcount);
|
||||
for i in 0..child_count {
|
||||
if children[i] == self.instance.ui_widget {
|
||||
x_free(children);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
x_free(children);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
113
deps/suil/src/lib.rs
vendored
Normal file
113
deps/suil/src/lib.rs
vendored
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
use std::ffi::{CString, c_void};
|
||||
|
||||
pub mod bound;
|
||||
#[cfg(test)] mod test;
|
||||
|
||||
pub struct Host(*mut self::bound::SuilHost);
|
||||
|
||||
impl Drop for Host {
|
||||
fn drop (&mut self) {
|
||||
unsafe {
|
||||
bound::suil_host_free(self.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Host {
|
||||
pub fn new () -> Self {
|
||||
Self(unsafe {
|
||||
let mut argv = [];
|
||||
bound::suil_init(
|
||||
&mut 0,
|
||||
&mut argv as *mut *mut *mut i8,
|
||||
0
|
||||
);
|
||||
bound::suil_host_new(
|
||||
Some(write),
|
||||
Some(index),
|
||||
None,
|
||||
None,
|
||||
)
|
||||
})
|
||||
}
|
||||
fn set_touch_func (&self) {
|
||||
unimplemented!();
|
||||
}
|
||||
fn instance <T> (
|
||||
&self,
|
||||
controller: &mut T,
|
||||
container_type_uri: &str,
|
||||
plugin_uri: &str,
|
||||
ui_uri: &str,
|
||||
ui_type_uri: &str,
|
||||
ui_bundle_path: &str,
|
||||
ui_binary_path: &str,
|
||||
features: &[*const bound::LV2_Feature],
|
||||
) -> Result<Instance, Box<dyn std::error::Error>> {
|
||||
let container_type_uri = CString::new(container_type_uri)?;
|
||||
let plugin_uri = CString::new(plugin_uri)?;
|
||||
let ui_uri = CString::new(ui_uri)?;
|
||||
let ui_type_uri = CString::new(ui_type_uri)?;
|
||||
let ui_bundle_path = CString::new(ui_bundle_path)?;
|
||||
let ui_binary_path = CString::new(ui_binary_path)?;
|
||||
Ok(Instance(unsafe {
|
||||
bound::suil_instance_new(
|
||||
self.0,
|
||||
controller as *mut _ as *mut std::ffi::c_void,
|
||||
container_type_uri.into_raw(),
|
||||
plugin_uri.into_raw(),
|
||||
ui_uri.into_raw(),
|
||||
ui_type_uri.into_raw(),
|
||||
ui_bundle_path.into_raw(),
|
||||
ui_binary_path.into_raw(),
|
||||
std::ptr::null_mut(),
|
||||
)
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
unsafe extern "C" fn write (
|
||||
_controller: *mut c_void, _: u32, _: u32, _: u32, _: *const c_void
|
||||
) {
|
||||
panic!("write")
|
||||
}
|
||||
|
||||
unsafe extern "C" fn index (
|
||||
_controller: *mut c_void, _: *const i8
|
||||
) -> u32 {
|
||||
0
|
||||
}
|
||||
|
||||
//unsafe extern "C" fn subscribe (
|
||||
//_: *mut c_void, _: u32, _: u32, _: *const *const bound::LV2_Feature
|
||||
//) -> u32 {
|
||||
//panic!("subscribe");
|
||||
//0
|
||||
//}
|
||||
|
||||
//unsafe extern "C" fn unsubscribe (
|
||||
//_: *mut c_void, _: u32, _: u32, _: *const *const bound::LV2_Feature
|
||||
//) -> u32 {
|
||||
//panic!("unsubscribe");
|
||||
//0
|
||||
//}
|
||||
|
||||
pub struct Instance(*mut self::bound::SuilInstance);
|
||||
|
||||
impl Drop for Instance {
|
||||
fn drop (&mut self) -> () {
|
||||
unsafe {
|
||||
bound::suil_instance_free(self.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl Send for Instance {}
|
||||
|
||||
unsafe impl Sync for Instance {}
|
||||
|
||||
impl Instance {
|
||||
fn get_widget (&self) -> *mut c_void {
|
||||
unsafe { bound::suil_instance_get_widget(self.0) }
|
||||
}
|
||||
}
|
||||
173
deps/suil/src/test.rs
vendored
Normal file
173
deps/suil/src/test.rs
vendored
Normal file
|
|
@ -0,0 +1,173 @@
|
|||
use crate::*;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[test]
|
||||
fn test_lv2_ui () {
|
||||
let mut features = [];
|
||||
std::mem::forget(features);
|
||||
//gtk::init().unwrap();
|
||||
use gtk::prelude::{ApplicationExt, ApplicationExtManual};
|
||||
let app = gtk::Application::builder().application_id("lol.tek").build();
|
||||
app.connect_activate(move |app| {
|
||||
let host = Host::new();
|
||||
let mut plugin = plugin::LV2Plugin::new("file:///home/user/.lv2/Odin2.lv2").unwrap();
|
||||
//let mut plugin = plugin::LV2Plugin::new("file:///home/user/.lv2/ChowKick.lv2").unwrap();
|
||||
for ui in plugin.plugin.raw().uis().unwrap().iter() {
|
||||
println!("{:?}", ui.uri());
|
||||
println!("{:?}", ui.classes());
|
||||
}
|
||||
let handle = plugin.instance.raw_mut().instance_mut().handle();
|
||||
let instance_access = crate::bound::LV2_Feature {
|
||||
URI: std::ffi::CString::new("http://lv2plug.in/ns/ext/instance-access").unwrap().into_raw(),
|
||||
data: handle as *mut _ as *mut std::ffi::c_void
|
||||
};
|
||||
let ui_instance = Arc::new(host.instance(
|
||||
&mut plugin,
|
||||
"http://lv2plug.in/ns/extensions/ui#Gtk3UI",
|
||||
"https://thewavewarden.com/odin2",
|
||||
"https://thewavewarden.com/odin2#ParentUI",
|
||||
"http://lv2plug.in/ns/extensions/ui#X11UI",
|
||||
"/home/user/.lv2/Odin2.lv2/Odin2.so",
|
||||
"/home/user/.lv2/Odin2.lv2/Odin2.so",
|
||||
&features,
|
||||
).unwrap());
|
||||
//let instance = Arc::new(host.instance(
|
||||
//&mut plugin,
|
||||
//"http://lv2plug.in/ns/extensions/ui#Gtk3UI",
|
||||
//"http://tytel.org/helm",
|
||||
//"http://tytel.org/helm#ParentUI",
|
||||
//"http://lv2plug.in/ns/extensions/ui#X11UI",
|
||||
//"/home/user/.lv2/Helm.lv2/helm.so",
|
||||
//"/home/user/.lv2/Helm.lv2/helm.so",
|
||||
//&features,
|
||||
//).unwrap());
|
||||
//let instance = Arc::new(host.instance(
|
||||
//&mut plugin,
|
||||
//"http://lv2plug.in/ns/extensions/ui#Gtk3UI",
|
||||
//"http://github.com/Chowdhury-DSP/ChowKick",
|
||||
//"http://github.com/Chowdhury-DSP/ChowKick:UI",
|
||||
//"http://lv2plug.in/ns/extensions/ui#X11UI",
|
||||
//"/home/user/.lv2/ChowKick.lv2/libChowKick.so",
|
||||
//"/home/user/.lv2/ChowKick.lv2/libChowKick.so",
|
||||
//&features,
|
||||
//).unwrap());
|
||||
//println!("{:?}", instance.get_widget());
|
||||
});
|
||||
app.run();
|
||||
//self::ui::UI::run(&instance).join();
|
||||
}
|
||||
|
||||
mod ui {
|
||||
use std::sync::Arc;
|
||||
use std::thread::{spawn, JoinHandle};
|
||||
use ::winit::{
|
||||
application::ApplicationHandler,
|
||||
event::WindowEvent,
|
||||
event_loop::{ActiveEventLoop, ControlFlow, EventLoop},
|
||||
window::{Window, WindowId},
|
||||
platform::x11::EventLoopBuilderExtX11
|
||||
};
|
||||
use crate::{Host, Instance};
|
||||
pub struct UI {
|
||||
host: Arc<Instance>,
|
||||
window: Option<Window>
|
||||
}
|
||||
impl UI {
|
||||
pub fn new (host: &Arc<Instance>) -> Self {
|
||||
Self {
|
||||
host: host.clone(),
|
||||
window: None
|
||||
}
|
||||
}
|
||||
pub fn run (host: &Arc<Instance>) -> JoinHandle<()> {
|
||||
let mut ui = Self::new(host);
|
||||
spawn(move||{
|
||||
let event_loop = EventLoop::builder().with_x11().with_any_thread(true).build().unwrap();
|
||||
event_loop.set_control_flow(ControlFlow::Wait);
|
||||
event_loop.run_app(&mut ui).unwrap()
|
||||
})
|
||||
}
|
||||
}
|
||||
impl ApplicationHandler for UI {
|
||||
fn resumed (&mut self, event_loop: &ActiveEventLoop) {
|
||||
self.window = Some(event_loop.create_window(Window::default_attributes()).unwrap());
|
||||
}
|
||||
fn window_event (&mut self, event_loop: &ActiveEventLoop, id: WindowId, event: WindowEvent) {
|
||||
match event {
|
||||
WindowEvent::CloseRequested => {
|
||||
self.window.as_ref().unwrap().set_visible(false);
|
||||
event_loop.exit();
|
||||
},
|
||||
WindowEvent::RedrawRequested => {
|
||||
self.window.as_ref().unwrap().request_redraw();
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mod plugin {
|
||||
use std::thread::JoinHandle;
|
||||
use std::sync::Arc;
|
||||
use ::livi::{
|
||||
World,
|
||||
Instance,
|
||||
Plugin as LiviPlugin,
|
||||
Features,
|
||||
FeaturesBuilder,
|
||||
Port,
|
||||
event::LV2AtomSequence,
|
||||
};
|
||||
/// A LV2 plugin.
|
||||
pub struct LV2Plugin {
|
||||
pub world: World,
|
||||
pub instance: Instance,
|
||||
pub plugin: LiviPlugin,
|
||||
pub features: Arc<Features>,
|
||||
pub port_list: Vec<Port>,
|
||||
pub input_buffer: Vec<LV2AtomSequence>,
|
||||
pub ui_thread: Option<JoinHandle<()>>,
|
||||
}
|
||||
|
||||
impl LV2Plugin {
|
||||
pub fn new (uri: &str) -> Result<Self, Box<dyn std::error::Error>> {
|
||||
// Get 1st plugin at URI
|
||||
let world = World::with_load_bundle(&uri);
|
||||
let features = FeaturesBuilder { min_block_length: 1, max_block_length: 65536 };
|
||||
let features = world.build_features(features);
|
||||
let mut plugin = None;
|
||||
#[allow(clippy::never_loop)]
|
||||
for p in world.iter_plugins() {
|
||||
plugin = Some(p);
|
||||
break
|
||||
}
|
||||
if plugin.is_none() {
|
||||
return Err(format!("plugin not found: {uri}").into())
|
||||
}
|
||||
let plugin = plugin.unwrap();
|
||||
let err = &format!("init {uri}");
|
||||
|
||||
// Instantiate
|
||||
Ok(Self {
|
||||
world,
|
||||
instance: unsafe {
|
||||
plugin
|
||||
.instantiate(features.clone(), 48000.0)
|
||||
.expect(&err)
|
||||
},
|
||||
port_list: {
|
||||
let mut port_list = vec![];
|
||||
for port in plugin.ports() {
|
||||
port_list.push(port);
|
||||
}
|
||||
port_list
|
||||
},
|
||||
plugin,
|
||||
features,
|
||||
input_buffer: Vec::with_capacity(1024),
|
||||
ui_thread: None
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
39
deps/suil/stdbool.h
vendored
Normal file
39
deps/suil/stdbool.h
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/*===---- stdbool.h - Standard header for booleans -------------------------===
|
||||
*
|
||||
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
* See https://llvm.org/LICENSE.txt for license information.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*
|
||||
*===-----------------------------------------------------------------------===
|
||||
*/
|
||||
|
||||
#ifndef __STDBOOL_H
|
||||
#define __STDBOOL_H
|
||||
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#if defined(__MVS__) && __has_include_next(<stdbool.h>)
|
||||
#include_next <stdbool.h>
|
||||
#else
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ > 201710L
|
||||
/* FIXME: We should be issuing a deprecation warning here, but cannot yet due
|
||||
* to system headers which include this header file unconditionally.
|
||||
*/
|
||||
#elif !defined(__cplusplus)
|
||||
#define bool _Bool
|
||||
#define true 1
|
||||
#define false 0
|
||||
#elif defined(__GNUC__) && !defined(__STRICT_ANSI__)
|
||||
/* Define _Bool as a GNU extension. */
|
||||
#define _Bool bool
|
||||
#if defined(__cplusplus) && __cplusplus < 201103L
|
||||
/* For C++98, define bool, false, true as a GNU extension. */
|
||||
#define bool bool
|
||||
#define false false
|
||||
#define true true
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* __MVS__ */
|
||||
#endif /* __STDBOOL_H */
|
||||
955
deps/suil/stdint.h
vendored
Normal file
955
deps/suil/stdint.h
vendored
Normal file
|
|
@ -0,0 +1,955 @@
|
|||
/*===---- stdint.h - Standard header for sized integer types --------------===*\
|
||||
*
|
||||
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
* See https://llvm.org/LICENSE.txt for license information.
|
||||
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
*
|
||||
\*===----------------------------------------------------------------------===*/
|
||||
|
||||
#ifndef __CLANG_STDINT_H
|
||||
// AIX system headers need stdint.h to be re-enterable while _STD_TYPES_T
|
||||
// is defined until an inclusion of it without _STD_TYPES_T occurs, in which
|
||||
// case the header guard macro is defined.
|
||||
#if !defined(_AIX) || !defined(_STD_TYPES_T) || !defined(__STDC_HOSTED__)
|
||||
#define __CLANG_STDINT_H
|
||||
#endif
|
||||
|
||||
#if defined(__MVS__) && __has_include_next(<stdint.h>)
|
||||
#include_next <stdint.h>
|
||||
#else
|
||||
|
||||
/* If we're hosted, fall back to the system's stdint.h, which might have
|
||||
* additional definitions.
|
||||
*/
|
||||
#if __STDC_HOSTED__ && __has_include_next(<stdint.h>)
|
||||
|
||||
// C99 7.18.3 Limits of other integer types
|
||||
//
|
||||
// Footnote 219, 220: C++ implementations should define these macros only when
|
||||
// __STDC_LIMIT_MACROS is defined before <stdint.h> is included.
|
||||
//
|
||||
// Footnote 222: C++ implementations should define these macros only when
|
||||
// __STDC_CONSTANT_MACROS is defined before <stdint.h> is included.
|
||||
//
|
||||
// C++11 [cstdint.syn]p2:
|
||||
//
|
||||
// The macros defined by <cstdint> are provided unconditionally. In particular,
|
||||
// the symbols __STDC_LIMIT_MACROS and __STDC_CONSTANT_MACROS (mentioned in
|
||||
// footnotes 219, 220, and 222 in the C standard) play no role in C++.
|
||||
//
|
||||
// C11 removed the problematic footnotes.
|
||||
//
|
||||
// Work around this inconsistency by always defining those macros in C++ mode,
|
||||
// so that a C library implementation which follows the C99 standard can be
|
||||
// used in C++.
|
||||
# ifdef __cplusplus
|
||||
# if !defined(__STDC_LIMIT_MACROS)
|
||||
# define __STDC_LIMIT_MACROS
|
||||
# define __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
|
||||
# endif
|
||||
# if !defined(__STDC_CONSTANT_MACROS)
|
||||
# define __STDC_CONSTANT_MACROS
|
||||
# define __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
|
||||
# endif
|
||||
# endif
|
||||
|
||||
# include_next <stdint.h>
|
||||
|
||||
# ifdef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
|
||||
# undef __STDC_LIMIT_MACROS
|
||||
# undef __STDC_LIMIT_MACROS_DEFINED_BY_CLANG
|
||||
# endif
|
||||
# ifdef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
|
||||
# undef __STDC_CONSTANT_MACROS
|
||||
# undef __STDC_CONSTANT_MACROS_DEFINED_BY_CLANG
|
||||
# endif
|
||||
|
||||
#else
|
||||
|
||||
/* C99 7.18.1.1 Exact-width integer types.
|
||||
* C99 7.18.1.2 Minimum-width integer types.
|
||||
* C99 7.18.1.3 Fastest minimum-width integer types.
|
||||
*
|
||||
* The standard requires that exact-width type be defined for 8-, 16-, 32-, and
|
||||
* 64-bit types if they are implemented. Other exact width types are optional.
|
||||
* This implementation defines an exact-width types for every integer width
|
||||
* that is represented in the standard integer types.
|
||||
*
|
||||
* The standard also requires minimum-width types be defined for 8-, 16-, 32-,
|
||||
* and 64-bit widths regardless of whether there are corresponding exact-width
|
||||
* types.
|
||||
*
|
||||
* To accommodate targets that are missing types that are exactly 8, 16, 32, or
|
||||
* 64 bits wide, this implementation takes an approach of cascading
|
||||
* redefinitions, redefining __int_leastN_t to successively smaller exact-width
|
||||
* types. It is therefore important that the types are defined in order of
|
||||
* descending widths.
|
||||
*
|
||||
* We currently assume that the minimum-width types and the fastest
|
||||
* minimum-width types are the same. This is allowed by the standard, but is
|
||||
* suboptimal.
|
||||
*
|
||||
* In violation of the standard, some targets do not implement a type that is
|
||||
* wide enough to represent all of the required widths (8-, 16-, 32-, 64-bit).
|
||||
* To accommodate these targets, a required minimum-width type is only
|
||||
* defined if there exists an exact-width type of equal or greater width.
|
||||
*/
|
||||
|
||||
#ifdef __INT64_TYPE__
|
||||
# ifndef __int8_t_defined /* glibc sys/types.h also defines int64_t*/
|
||||
typedef __INT64_TYPE__ int64_t;
|
||||
# endif /* __int8_t_defined */
|
||||
typedef __UINT64_TYPE__ uint64_t;
|
||||
# undef __int_least64_t
|
||||
# define __int_least64_t int64_t
|
||||
# undef __uint_least64_t
|
||||
# define __uint_least64_t uint64_t
|
||||
# undef __int_least32_t
|
||||
# define __int_least32_t int64_t
|
||||
# undef __uint_least32_t
|
||||
# define __uint_least32_t uint64_t
|
||||
# undef __int_least16_t
|
||||
# define __int_least16_t int64_t
|
||||
# undef __uint_least16_t
|
||||
# define __uint_least16_t uint64_t
|
||||
# undef __int_least8_t
|
||||
# define __int_least8_t int64_t
|
||||
# undef __uint_least8_t
|
||||
# define __uint_least8_t uint64_t
|
||||
#endif /* __INT64_TYPE__ */
|
||||
|
||||
#ifdef __int_least64_t
|
||||
typedef __int_least64_t int_least64_t;
|
||||
typedef __uint_least64_t uint_least64_t;
|
||||
typedef __int_least64_t int_fast64_t;
|
||||
typedef __uint_least64_t uint_fast64_t;
|
||||
#endif /* __int_least64_t */
|
||||
|
||||
#ifdef __INT56_TYPE__
|
||||
typedef __INT56_TYPE__ int56_t;
|
||||
typedef __UINT56_TYPE__ uint56_t;
|
||||
typedef int56_t int_least56_t;
|
||||
typedef uint56_t uint_least56_t;
|
||||
typedef int56_t int_fast56_t;
|
||||
typedef uint56_t uint_fast56_t;
|
||||
# undef __int_least32_t
|
||||
# define __int_least32_t int56_t
|
||||
# undef __uint_least32_t
|
||||
# define __uint_least32_t uint56_t
|
||||
# undef __int_least16_t
|
||||
# define __int_least16_t int56_t
|
||||
# undef __uint_least16_t
|
||||
# define __uint_least16_t uint56_t
|
||||
# undef __int_least8_t
|
||||
# define __int_least8_t int56_t
|
||||
# undef __uint_least8_t
|
||||
# define __uint_least8_t uint56_t
|
||||
#endif /* __INT56_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT48_TYPE__
|
||||
typedef __INT48_TYPE__ int48_t;
|
||||
typedef __UINT48_TYPE__ uint48_t;
|
||||
typedef int48_t int_least48_t;
|
||||
typedef uint48_t uint_least48_t;
|
||||
typedef int48_t int_fast48_t;
|
||||
typedef uint48_t uint_fast48_t;
|
||||
# undef __int_least32_t
|
||||
# define __int_least32_t int48_t
|
||||
# undef __uint_least32_t
|
||||
# define __uint_least32_t uint48_t
|
||||
# undef __int_least16_t
|
||||
# define __int_least16_t int48_t
|
||||
# undef __uint_least16_t
|
||||
# define __uint_least16_t uint48_t
|
||||
# undef __int_least8_t
|
||||
# define __int_least8_t int48_t
|
||||
# undef __uint_least8_t
|
||||
# define __uint_least8_t uint48_t
|
||||
#endif /* __INT48_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT40_TYPE__
|
||||
typedef __INT40_TYPE__ int40_t;
|
||||
typedef __UINT40_TYPE__ uint40_t;
|
||||
typedef int40_t int_least40_t;
|
||||
typedef uint40_t uint_least40_t;
|
||||
typedef int40_t int_fast40_t;
|
||||
typedef uint40_t uint_fast40_t;
|
||||
# undef __int_least32_t
|
||||
# define __int_least32_t int40_t
|
||||
# undef __uint_least32_t
|
||||
# define __uint_least32_t uint40_t
|
||||
# undef __int_least16_t
|
||||
# define __int_least16_t int40_t
|
||||
# undef __uint_least16_t
|
||||
# define __uint_least16_t uint40_t
|
||||
# undef __int_least8_t
|
||||
# define __int_least8_t int40_t
|
||||
# undef __uint_least8_t
|
||||
# define __uint_least8_t uint40_t
|
||||
#endif /* __INT40_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT32_TYPE__
|
||||
|
||||
# ifndef __int8_t_defined /* glibc sys/types.h also defines int32_t*/
|
||||
typedef __INT32_TYPE__ int32_t;
|
||||
# endif /* __int8_t_defined */
|
||||
|
||||
# ifndef __uint32_t_defined /* more glibc compatibility */
|
||||
# define __uint32_t_defined
|
||||
typedef __UINT32_TYPE__ uint32_t;
|
||||
# endif /* __uint32_t_defined */
|
||||
|
||||
# undef __int_least32_t
|
||||
# define __int_least32_t int32_t
|
||||
# undef __uint_least32_t
|
||||
# define __uint_least32_t uint32_t
|
||||
# undef __int_least16_t
|
||||
# define __int_least16_t int32_t
|
||||
# undef __uint_least16_t
|
||||
# define __uint_least16_t uint32_t
|
||||
# undef __int_least8_t
|
||||
# define __int_least8_t int32_t
|
||||
# undef __uint_least8_t
|
||||
# define __uint_least8_t uint32_t
|
||||
#endif /* __INT32_TYPE__ */
|
||||
|
||||
#ifdef __int_least32_t
|
||||
typedef __int_least32_t int_least32_t;
|
||||
typedef __uint_least32_t uint_least32_t;
|
||||
typedef __int_least32_t int_fast32_t;
|
||||
typedef __uint_least32_t uint_fast32_t;
|
||||
#endif /* __int_least32_t */
|
||||
|
||||
#ifdef __INT24_TYPE__
|
||||
typedef __INT24_TYPE__ int24_t;
|
||||
typedef __UINT24_TYPE__ uint24_t;
|
||||
typedef int24_t int_least24_t;
|
||||
typedef uint24_t uint_least24_t;
|
||||
typedef int24_t int_fast24_t;
|
||||
typedef uint24_t uint_fast24_t;
|
||||
# undef __int_least16_t
|
||||
# define __int_least16_t int24_t
|
||||
# undef __uint_least16_t
|
||||
# define __uint_least16_t uint24_t
|
||||
# undef __int_least8_t
|
||||
# define __int_least8_t int24_t
|
||||
# undef __uint_least8_t
|
||||
# define __uint_least8_t uint24_t
|
||||
#endif /* __INT24_TYPE__ */
|
||||
|
||||
#ifdef __INT16_TYPE__
|
||||
#ifndef __int8_t_defined /* glibc sys/types.h also defines int16_t*/
|
||||
typedef __INT16_TYPE__ int16_t;
|
||||
#endif /* __int8_t_defined */
|
||||
typedef __UINT16_TYPE__ uint16_t;
|
||||
# undef __int_least16_t
|
||||
# define __int_least16_t int16_t
|
||||
# undef __uint_least16_t
|
||||
# define __uint_least16_t uint16_t
|
||||
# undef __int_least8_t
|
||||
# define __int_least8_t int16_t
|
||||
# undef __uint_least8_t
|
||||
# define __uint_least8_t uint16_t
|
||||
#endif /* __INT16_TYPE__ */
|
||||
|
||||
#ifdef __int_least16_t
|
||||
typedef __int_least16_t int_least16_t;
|
||||
typedef __uint_least16_t uint_least16_t;
|
||||
typedef __int_least16_t int_fast16_t;
|
||||
typedef __uint_least16_t uint_fast16_t;
|
||||
#endif /* __int_least16_t */
|
||||
|
||||
|
||||
#ifdef __INT8_TYPE__
|
||||
#ifndef __int8_t_defined /* glibc sys/types.h also defines int8_t*/
|
||||
typedef __INT8_TYPE__ int8_t;
|
||||
#endif /* __int8_t_defined */
|
||||
typedef __UINT8_TYPE__ uint8_t;
|
||||
# undef __int_least8_t
|
||||
# define __int_least8_t int8_t
|
||||
# undef __uint_least8_t
|
||||
# define __uint_least8_t uint8_t
|
||||
#endif /* __INT8_TYPE__ */
|
||||
|
||||
#ifdef __int_least8_t
|
||||
typedef __int_least8_t int_least8_t;
|
||||
typedef __uint_least8_t uint_least8_t;
|
||||
typedef __int_least8_t int_fast8_t;
|
||||
typedef __uint_least8_t uint_fast8_t;
|
||||
#endif /* __int_least8_t */
|
||||
|
||||
/* prevent glibc sys/types.h from defining conflicting types */
|
||||
#ifndef __int8_t_defined
|
||||
# define __int8_t_defined
|
||||
#endif /* __int8_t_defined */
|
||||
|
||||
/* C99 7.18.1.4 Integer types capable of holding object pointers.
|
||||
*/
|
||||
#define __stdint_join3(a,b,c) a ## b ## c
|
||||
|
||||
#ifndef _INTPTR_T
|
||||
#ifndef __intptr_t_defined
|
||||
typedef __INTPTR_TYPE__ intptr_t;
|
||||
#define __intptr_t_defined
|
||||
#define _INTPTR_T
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _UINTPTR_T
|
||||
typedef __UINTPTR_TYPE__ uintptr_t;
|
||||
#define _UINTPTR_T
|
||||
#endif
|
||||
|
||||
/* C99 7.18.1.5 Greatest-width integer types.
|
||||
*/
|
||||
typedef __INTMAX_TYPE__ intmax_t;
|
||||
typedef __UINTMAX_TYPE__ uintmax_t;
|
||||
|
||||
/* C99 7.18.4 Macros for minimum-width integer constants.
|
||||
*
|
||||
* The standard requires that integer constant macros be defined for all the
|
||||
* minimum-width types defined above. As 8-, 16-, 32-, and 64-bit minimum-width
|
||||
* types are required, the corresponding integer constant macros are defined
|
||||
* here. This implementation also defines minimum-width types for every other
|
||||
* integer width that the target implements, so corresponding macros are
|
||||
* defined below, too.
|
||||
*
|
||||
* These macros are defined using the same successive-shrinking approach as
|
||||
* the type definitions above. It is likewise important that macros are defined
|
||||
* in order of decending width.
|
||||
*
|
||||
* Note that C++ should not check __STDC_CONSTANT_MACROS here, contrary to the
|
||||
* claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]).
|
||||
*/
|
||||
|
||||
#define __int_c_join(a, b) a ## b
|
||||
#define __int_c(v, suffix) __int_c_join(v, suffix)
|
||||
#define __uint_c(v, suffix) __int_c_join(v##U, suffix)
|
||||
|
||||
|
||||
#ifdef __INT64_TYPE__
|
||||
# undef __int64_c_suffix
|
||||
# undef __int32_c_suffix
|
||||
# undef __int16_c_suffix
|
||||
# undef __int8_c_suffix
|
||||
# ifdef __INT64_C_SUFFIX__
|
||||
# define __int64_c_suffix __INT64_C_SUFFIX__
|
||||
# define __int32_c_suffix __INT64_C_SUFFIX__
|
||||
# define __int16_c_suffix __INT64_C_SUFFIX__
|
||||
# define __int8_c_suffix __INT64_C_SUFFIX__
|
||||
# endif /* __INT64_C_SUFFIX__ */
|
||||
#endif /* __INT64_TYPE__ */
|
||||
|
||||
#ifdef __int_least64_t
|
||||
# ifdef __int64_c_suffix
|
||||
# define INT64_C(v) __int_c(v, __int64_c_suffix)
|
||||
# define UINT64_C(v) __uint_c(v, __int64_c_suffix)
|
||||
# else
|
||||
# define INT64_C(v) v
|
||||
# define UINT64_C(v) v ## U
|
||||
# endif /* __int64_c_suffix */
|
||||
#endif /* __int_least64_t */
|
||||
|
||||
|
||||
#ifdef __INT56_TYPE__
|
||||
# undef __int32_c_suffix
|
||||
# undef __int16_c_suffix
|
||||
# undef __int8_c_suffix
|
||||
# ifdef __INT56_C_SUFFIX__
|
||||
# define INT56_C(v) __int_c(v, __INT56_C_SUFFIX__)
|
||||
# define UINT56_C(v) __uint_c(v, __INT56_C_SUFFIX__)
|
||||
# define __int32_c_suffix __INT56_C_SUFFIX__
|
||||
# define __int16_c_suffix __INT56_C_SUFFIX__
|
||||
# define __int8_c_suffix __INT56_C_SUFFIX__
|
||||
# else
|
||||
# define INT56_C(v) v
|
||||
# define UINT56_C(v) v ## U
|
||||
# endif /* __INT56_C_SUFFIX__ */
|
||||
#endif /* __INT56_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT48_TYPE__
|
||||
# undef __int32_c_suffix
|
||||
# undef __int16_c_suffix
|
||||
# undef __int8_c_suffix
|
||||
# ifdef __INT48_C_SUFFIX__
|
||||
# define INT48_C(v) __int_c(v, __INT48_C_SUFFIX__)
|
||||
# define UINT48_C(v) __uint_c(v, __INT48_C_SUFFIX__)
|
||||
# define __int32_c_suffix __INT48_C_SUFFIX__
|
||||
# define __int16_c_suffix __INT48_C_SUFFIX__
|
||||
# define __int8_c_suffix __INT48_C_SUFFIX__
|
||||
# else
|
||||
# define INT48_C(v) v
|
||||
# define UINT48_C(v) v ## U
|
||||
# endif /* __INT48_C_SUFFIX__ */
|
||||
#endif /* __INT48_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT40_TYPE__
|
||||
# undef __int32_c_suffix
|
||||
# undef __int16_c_suffix
|
||||
# undef __int8_c_suffix
|
||||
# ifdef __INT40_C_SUFFIX__
|
||||
# define INT40_C(v) __int_c(v, __INT40_C_SUFFIX__)
|
||||
# define UINT40_C(v) __uint_c(v, __INT40_C_SUFFIX__)
|
||||
# define __int32_c_suffix __INT40_C_SUFFIX__
|
||||
# define __int16_c_suffix __INT40_C_SUFFIX__
|
||||
# define __int8_c_suffix __INT40_C_SUFFIX__
|
||||
# else
|
||||
# define INT40_C(v) v
|
||||
# define UINT40_C(v) v ## U
|
||||
# endif /* __INT40_C_SUFFIX__ */
|
||||
#endif /* __INT40_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT32_TYPE__
|
||||
# undef __int32_c_suffix
|
||||
# undef __int16_c_suffix
|
||||
# undef __int8_c_suffix
|
||||
# ifdef __INT32_C_SUFFIX__
|
||||
# define __int32_c_suffix __INT32_C_SUFFIX__
|
||||
# define __int16_c_suffix __INT32_C_SUFFIX__
|
||||
# define __int8_c_suffix __INT32_C_SUFFIX__
|
||||
# endif /* __INT32_C_SUFFIX__ */
|
||||
#endif /* __INT32_TYPE__ */
|
||||
|
||||
#ifdef __int_least32_t
|
||||
# ifdef __int32_c_suffix
|
||||
# define INT32_C(v) __int_c(v, __int32_c_suffix)
|
||||
# define UINT32_C(v) __uint_c(v, __int32_c_suffix)
|
||||
# else
|
||||
# define INT32_C(v) v
|
||||
# define UINT32_C(v) v ## U
|
||||
# endif /* __int32_c_suffix */
|
||||
#endif /* __int_least32_t */
|
||||
|
||||
|
||||
#ifdef __INT24_TYPE__
|
||||
# undef __int16_c_suffix
|
||||
# undef __int8_c_suffix
|
||||
# ifdef __INT24_C_SUFFIX__
|
||||
# define INT24_C(v) __int_c(v, __INT24_C_SUFFIX__)
|
||||
# define UINT24_C(v) __uint_c(v, __INT24_C_SUFFIX__)
|
||||
# define __int16_c_suffix __INT24_C_SUFFIX__
|
||||
# define __int8_c_suffix __INT24_C_SUFFIX__
|
||||
# else
|
||||
# define INT24_C(v) v
|
||||
# define UINT24_C(v) v ## U
|
||||
# endif /* __INT24_C_SUFFIX__ */
|
||||
#endif /* __INT24_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT16_TYPE__
|
||||
# undef __int16_c_suffix
|
||||
# undef __int8_c_suffix
|
||||
# ifdef __INT16_C_SUFFIX__
|
||||
# define __int16_c_suffix __INT16_C_SUFFIX__
|
||||
# define __int8_c_suffix __INT16_C_SUFFIX__
|
||||
# endif /* __INT16_C_SUFFIX__ */
|
||||
#endif /* __INT16_TYPE__ */
|
||||
|
||||
#ifdef __int_least16_t
|
||||
# ifdef __int16_c_suffix
|
||||
# define INT16_C(v) __int_c(v, __int16_c_suffix)
|
||||
# define UINT16_C(v) __uint_c(v, __int16_c_suffix)
|
||||
# else
|
||||
# define INT16_C(v) v
|
||||
# define UINT16_C(v) v ## U
|
||||
# endif /* __int16_c_suffix */
|
||||
#endif /* __int_least16_t */
|
||||
|
||||
|
||||
#ifdef __INT8_TYPE__
|
||||
# undef __int8_c_suffix
|
||||
# ifdef __INT8_C_SUFFIX__
|
||||
# define __int8_c_suffix __INT8_C_SUFFIX__
|
||||
# endif /* __INT8_C_SUFFIX__ */
|
||||
#endif /* __INT8_TYPE__ */
|
||||
|
||||
#ifdef __int_least8_t
|
||||
# ifdef __int8_c_suffix
|
||||
# define INT8_C(v) __int_c(v, __int8_c_suffix)
|
||||
# define UINT8_C(v) __uint_c(v, __int8_c_suffix)
|
||||
# else
|
||||
# define INT8_C(v) v
|
||||
# define UINT8_C(v) v ## U
|
||||
# endif /* __int8_c_suffix */
|
||||
#endif /* __int_least8_t */
|
||||
|
||||
|
||||
/* C99 7.18.2.1 Limits of exact-width integer types.
|
||||
* C99 7.18.2.2 Limits of minimum-width integer types.
|
||||
* C99 7.18.2.3 Limits of fastest minimum-width integer types.
|
||||
*
|
||||
* The presence of limit macros are completely optional in C99. This
|
||||
* implementation defines limits for all of the types (exact- and
|
||||
* minimum-width) that it defines above, using the limits of the minimum-width
|
||||
* type for any types that do not have exact-width representations.
|
||||
*
|
||||
* As in the type definitions, this section takes an approach of
|
||||
* successive-shrinking to determine which limits to use for the standard (8,
|
||||
* 16, 32, 64) bit widths when they don't have exact representations. It is
|
||||
* therefore important that the definitions be kept in order of decending
|
||||
* widths.
|
||||
*
|
||||
* Note that C++ should not check __STDC_LIMIT_MACROS here, contrary to the
|
||||
* claims of the C standard (see C++ 18.3.1p2, [cstdint.syn]).
|
||||
*/
|
||||
|
||||
#ifdef __INT64_TYPE__
|
||||
# define INT64_MAX INT64_C( 9223372036854775807)
|
||||
# define INT64_MIN (-INT64_C( 9223372036854775807)-1)
|
||||
# define UINT64_MAX UINT64_C(18446744073709551615)
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
||||
# define UINT64_WIDTH 64
|
||||
# define INT64_WIDTH UINT64_WIDTH
|
||||
|
||||
# define __UINT_LEAST64_WIDTH UINT64_WIDTH
|
||||
# undef __UINT_LEAST32_WIDTH
|
||||
# define __UINT_LEAST32_WIDTH UINT64_WIDTH
|
||||
# undef __UINT_LEAST16_WIDTH
|
||||
# define __UINT_LEAST16_WIDTH UINT64_WIDTH
|
||||
# undef __UINT_LEAST8_MAX
|
||||
# define __UINT_LEAST8_MAX UINT64_MAX
|
||||
#endif /* __STDC_VERSION__ */
|
||||
|
||||
# define __INT_LEAST64_MIN INT64_MIN
|
||||
# define __INT_LEAST64_MAX INT64_MAX
|
||||
# define __UINT_LEAST64_MAX UINT64_MAX
|
||||
# undef __INT_LEAST32_MIN
|
||||
# define __INT_LEAST32_MIN INT64_MIN
|
||||
# undef __INT_LEAST32_MAX
|
||||
# define __INT_LEAST32_MAX INT64_MAX
|
||||
# undef __UINT_LEAST32_MAX
|
||||
# define __UINT_LEAST32_MAX UINT64_MAX
|
||||
# undef __INT_LEAST16_MIN
|
||||
# define __INT_LEAST16_MIN INT64_MIN
|
||||
# undef __INT_LEAST16_MAX
|
||||
# define __INT_LEAST16_MAX INT64_MAX
|
||||
# undef __UINT_LEAST16_MAX
|
||||
# define __UINT_LEAST16_MAX UINT64_MAX
|
||||
# undef __INT_LEAST8_MIN
|
||||
# define __INT_LEAST8_MIN INT64_MIN
|
||||
# undef __INT_LEAST8_MAX
|
||||
# define __INT_LEAST8_MAX INT64_MAX
|
||||
# undef __UINT_LEAST8_MAX
|
||||
# define __UINT_LEAST8_MAX UINT64_MAX
|
||||
#endif /* __INT64_TYPE__ */
|
||||
|
||||
#ifdef __INT_LEAST64_MIN
|
||||
# define INT_LEAST64_MIN __INT_LEAST64_MIN
|
||||
# define INT_LEAST64_MAX __INT_LEAST64_MAX
|
||||
# define UINT_LEAST64_MAX __UINT_LEAST64_MAX
|
||||
# define INT_FAST64_MIN __INT_LEAST64_MIN
|
||||
# define INT_FAST64_MAX __INT_LEAST64_MAX
|
||||
# define UINT_FAST64_MAX __UINT_LEAST64_MAX
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
||||
# define UINT_LEAST64_WIDTH __UINT_LEAST64_WIDTH
|
||||
# define INT_LEAST64_WIDTH UINT_LEAST64_WIDTH
|
||||
# define UINT_FAST64_WIDTH __UINT_LEAST64_WIDTH
|
||||
# define INT_FAST64_WIDTH UINT_FAST64_WIDTH
|
||||
#endif /* __STDC_VERSION__ */
|
||||
#endif /* __INT_LEAST64_MIN */
|
||||
|
||||
|
||||
#ifdef __INT56_TYPE__
|
||||
# define INT56_MAX INT56_C(36028797018963967)
|
||||
# define INT56_MIN (-INT56_C(36028797018963967)-1)
|
||||
# define UINT56_MAX UINT56_C(72057594037927935)
|
||||
# define INT_LEAST56_MIN INT56_MIN
|
||||
# define INT_LEAST56_MAX INT56_MAX
|
||||
# define UINT_LEAST56_MAX UINT56_MAX
|
||||
# define INT_FAST56_MIN INT56_MIN
|
||||
# define INT_FAST56_MAX INT56_MAX
|
||||
# define UINT_FAST56_MAX UINT56_MAX
|
||||
|
||||
# undef __INT_LEAST32_MIN
|
||||
# define __INT_LEAST32_MIN INT56_MIN
|
||||
# undef __INT_LEAST32_MAX
|
||||
# define __INT_LEAST32_MAX INT56_MAX
|
||||
# undef __UINT_LEAST32_MAX
|
||||
# define __UINT_LEAST32_MAX UINT56_MAX
|
||||
# undef __INT_LEAST16_MIN
|
||||
# define __INT_LEAST16_MIN INT56_MIN
|
||||
# undef __INT_LEAST16_MAX
|
||||
# define __INT_LEAST16_MAX INT56_MAX
|
||||
# undef __UINT_LEAST16_MAX
|
||||
# define __UINT_LEAST16_MAX UINT56_MAX
|
||||
# undef __INT_LEAST8_MIN
|
||||
# define __INT_LEAST8_MIN INT56_MIN
|
||||
# undef __INT_LEAST8_MAX
|
||||
# define __INT_LEAST8_MAX INT56_MAX
|
||||
# undef __UINT_LEAST8_MAX
|
||||
# define __UINT_LEAST8_MAX UINT56_MAX
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
||||
# define UINT56_WIDTH 56
|
||||
# define INT56_WIDTH UINT56_WIDTH
|
||||
# define UINT_LEAST56_WIDTH UINT56_WIDTH
|
||||
# define INT_LEAST56_WIDTH UINT_LEAST56_WIDTH
|
||||
# define UINT_FAST56_WIDTH UINT56_WIDTH
|
||||
# define INT_FAST56_WIDTH UINT_FAST56_WIDTH
|
||||
# undef __UINT_LEAST32_WIDTH
|
||||
# define __UINT_LEAST32_WIDTH UINT56_WIDTH
|
||||
# undef __UINT_LEAST16_WIDTH
|
||||
# define __UINT_LEAST16_WIDTH UINT56_WIDTH
|
||||
# undef __UINT_LEAST8_WIDTH
|
||||
# define __UINT_LEAST8_WIDTH UINT56_WIDTH
|
||||
#endif /* __STDC_VERSION__ */
|
||||
#endif /* __INT56_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT48_TYPE__
|
||||
# define INT48_MAX INT48_C(140737488355327)
|
||||
# define INT48_MIN (-INT48_C(140737488355327)-1)
|
||||
# define UINT48_MAX UINT48_C(281474976710655)
|
||||
# define INT_LEAST48_MIN INT48_MIN
|
||||
# define INT_LEAST48_MAX INT48_MAX
|
||||
# define UINT_LEAST48_MAX UINT48_MAX
|
||||
# define INT_FAST48_MIN INT48_MIN
|
||||
# define INT_FAST48_MAX INT48_MAX
|
||||
# define UINT_FAST48_MAX UINT48_MAX
|
||||
|
||||
# undef __INT_LEAST32_MIN
|
||||
# define __INT_LEAST32_MIN INT48_MIN
|
||||
# undef __INT_LEAST32_MAX
|
||||
# define __INT_LEAST32_MAX INT48_MAX
|
||||
# undef __UINT_LEAST32_MAX
|
||||
# define __UINT_LEAST32_MAX UINT48_MAX
|
||||
# undef __INT_LEAST16_MIN
|
||||
# define __INT_LEAST16_MIN INT48_MIN
|
||||
# undef __INT_LEAST16_MAX
|
||||
# define __INT_LEAST16_MAX INT48_MAX
|
||||
# undef __UINT_LEAST16_MAX
|
||||
# define __UINT_LEAST16_MAX UINT48_MAX
|
||||
# undef __INT_LEAST8_MIN
|
||||
# define __INT_LEAST8_MIN INT48_MIN
|
||||
# undef __INT_LEAST8_MAX
|
||||
# define __INT_LEAST8_MAX INT48_MAX
|
||||
# undef __UINT_LEAST8_MAX
|
||||
# define __UINT_LEAST8_MAX UINT48_MAX
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
||||
#define UINT48_WIDTH 48
|
||||
#define INT48_WIDTH UINT48_WIDTH
|
||||
#define UINT_LEAST48_WIDTH UINT48_WIDTH
|
||||
#define INT_LEAST48_WIDTH UINT_LEAST48_WIDTH
|
||||
#define UINT_FAST48_WIDTH UINT48_WIDTH
|
||||
#define INT_FAST48_WIDTH UINT_FAST48_WIDTH
|
||||
#undef __UINT_LEAST32_WIDTH
|
||||
#define __UINT_LEAST32_WIDTH UINT48_WIDTH
|
||||
# undef __UINT_LEAST16_WIDTH
|
||||
#define __UINT_LEAST16_WIDTH UINT48_WIDTH
|
||||
# undef __UINT_LEAST8_WIDTH
|
||||
#define __UINT_LEAST8_WIDTH UINT48_WIDTH
|
||||
#endif /* __STDC_VERSION__ */
|
||||
#endif /* __INT48_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT40_TYPE__
|
||||
# define INT40_MAX INT40_C(549755813887)
|
||||
# define INT40_MIN (-INT40_C(549755813887)-1)
|
||||
# define UINT40_MAX UINT40_C(1099511627775)
|
||||
# define INT_LEAST40_MIN INT40_MIN
|
||||
# define INT_LEAST40_MAX INT40_MAX
|
||||
# define UINT_LEAST40_MAX UINT40_MAX
|
||||
# define INT_FAST40_MIN INT40_MIN
|
||||
# define INT_FAST40_MAX INT40_MAX
|
||||
# define UINT_FAST40_MAX UINT40_MAX
|
||||
|
||||
# undef __INT_LEAST32_MIN
|
||||
# define __INT_LEAST32_MIN INT40_MIN
|
||||
# undef __INT_LEAST32_MAX
|
||||
# define __INT_LEAST32_MAX INT40_MAX
|
||||
# undef __UINT_LEAST32_MAX
|
||||
# define __UINT_LEAST32_MAX UINT40_MAX
|
||||
# undef __INT_LEAST16_MIN
|
||||
# define __INT_LEAST16_MIN INT40_MIN
|
||||
# undef __INT_LEAST16_MAX
|
||||
# define __INT_LEAST16_MAX INT40_MAX
|
||||
# undef __UINT_LEAST16_MAX
|
||||
# define __UINT_LEAST16_MAX UINT40_MAX
|
||||
# undef __INT_LEAST8_MIN
|
||||
# define __INT_LEAST8_MIN INT40_MIN
|
||||
# undef __INT_LEAST8_MAX
|
||||
# define __INT_LEAST8_MAX INT40_MAX
|
||||
# undef __UINT_LEAST8_MAX
|
||||
# define __UINT_LEAST8_MAX UINT40_MAX
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
||||
# define UINT40_WIDTH 40
|
||||
# define INT40_WIDTH UINT40_WIDTH
|
||||
# define UINT_LEAST40_WIDTH UINT40_WIDTH
|
||||
# define INT_LEAST40_WIDTH UINT_LEAST40_WIDTH
|
||||
# define UINT_FAST40_WIDTH UINT40_WIDTH
|
||||
# define INT_FAST40_WIDTH UINT_FAST40_WIDTH
|
||||
# undef __UINT_LEAST32_WIDTH
|
||||
# define __UINT_LEAST32_WIDTH UINT40_WIDTH
|
||||
# undef __UINT_LEAST16_WIDTH
|
||||
# define __UINT_LEAST16_WIDTH UINT40_WIDTH
|
||||
# undef __UINT_LEAST8_WIDTH
|
||||
# define __UINT_LEAST8_WIDTH UINT40_WIDTH
|
||||
#endif /* __STDC_VERSION__ */
|
||||
#endif /* __INT40_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT32_TYPE__
|
||||
# define INT32_MAX INT32_C(2147483647)
|
||||
# define INT32_MIN (-INT32_C(2147483647)-1)
|
||||
# define UINT32_MAX UINT32_C(4294967295)
|
||||
|
||||
# undef __INT_LEAST32_MIN
|
||||
# define __INT_LEAST32_MIN INT32_MIN
|
||||
# undef __INT_LEAST32_MAX
|
||||
# define __INT_LEAST32_MAX INT32_MAX
|
||||
# undef __UINT_LEAST32_MAX
|
||||
# define __UINT_LEAST32_MAX UINT32_MAX
|
||||
# undef __INT_LEAST16_MIN
|
||||
# define __INT_LEAST16_MIN INT32_MIN
|
||||
# undef __INT_LEAST16_MAX
|
||||
# define __INT_LEAST16_MAX INT32_MAX
|
||||
# undef __UINT_LEAST16_MAX
|
||||
# define __UINT_LEAST16_MAX UINT32_MAX
|
||||
# undef __INT_LEAST8_MIN
|
||||
# define __INT_LEAST8_MIN INT32_MIN
|
||||
# undef __INT_LEAST8_MAX
|
||||
# define __INT_LEAST8_MAX INT32_MAX
|
||||
# undef __UINT_LEAST8_MAX
|
||||
# define __UINT_LEAST8_MAX UINT32_MAX
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
||||
# define UINT32_WIDTH 32
|
||||
# define INT32_WIDTH UINT32_WIDTH
|
||||
# undef __UINT_LEAST32_WIDTH
|
||||
# define __UINT_LEAST32_WIDTH UINT32_WIDTH
|
||||
# undef __UINT_LEAST16_WIDTH
|
||||
# define __UINT_LEAST16_WIDTH UINT32_WIDTH
|
||||
# undef __UINT_LEAST8_WIDTH
|
||||
# define __UINT_LEAST8_WIDTH UINT32_WIDTH
|
||||
#endif /* __STDC_VERSION__ */
|
||||
#endif /* __INT32_TYPE__ */
|
||||
|
||||
#ifdef __INT_LEAST32_MIN
|
||||
# define INT_LEAST32_MIN __INT_LEAST32_MIN
|
||||
# define INT_LEAST32_MAX __INT_LEAST32_MAX
|
||||
# define UINT_LEAST32_MAX __UINT_LEAST32_MAX
|
||||
# define INT_FAST32_MIN __INT_LEAST32_MIN
|
||||
# define INT_FAST32_MAX __INT_LEAST32_MAX
|
||||
# define UINT_FAST32_MAX __UINT_LEAST32_MAX
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
||||
# define UINT_LEAST32_WIDTH __UINT_LEAST32_WIDTH
|
||||
# define INT_LEAST32_WIDTH UINT_LEAST32_WIDTH
|
||||
# define UINT_FAST32_WIDTH __UINT_LEAST32_WIDTH
|
||||
# define INT_FAST32_WIDTH UINT_FAST32_WIDTH
|
||||
#endif /* __STDC_VERSION__ */
|
||||
#endif /* __INT_LEAST32_MIN */
|
||||
|
||||
|
||||
#ifdef __INT24_TYPE__
|
||||
# define INT24_MAX INT24_C(8388607)
|
||||
# define INT24_MIN (-INT24_C(8388607)-1)
|
||||
# define UINT24_MAX UINT24_C(16777215)
|
||||
# define INT_LEAST24_MIN INT24_MIN
|
||||
# define INT_LEAST24_MAX INT24_MAX
|
||||
# define UINT_LEAST24_MAX UINT24_MAX
|
||||
# define INT_FAST24_MIN INT24_MIN
|
||||
# define INT_FAST24_MAX INT24_MAX
|
||||
# define UINT_FAST24_MAX UINT24_MAX
|
||||
|
||||
# undef __INT_LEAST16_MIN
|
||||
# define __INT_LEAST16_MIN INT24_MIN
|
||||
# undef __INT_LEAST16_MAX
|
||||
# define __INT_LEAST16_MAX INT24_MAX
|
||||
# undef __UINT_LEAST16_MAX
|
||||
# define __UINT_LEAST16_MAX UINT24_MAX
|
||||
# undef __INT_LEAST8_MIN
|
||||
# define __INT_LEAST8_MIN INT24_MIN
|
||||
# undef __INT_LEAST8_MAX
|
||||
# define __INT_LEAST8_MAX INT24_MAX
|
||||
# undef __UINT_LEAST8_MAX
|
||||
# define __UINT_LEAST8_MAX UINT24_MAX
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
||||
# define UINT24_WIDTH 24
|
||||
# define INT24_WIDTH UINT24_WIDTH
|
||||
# define UINT_LEAST24_WIDTH UINT24_WIDTH
|
||||
# define INT_LEAST24_WIDTH UINT_LEAST24_WIDTH
|
||||
# define UINT_FAST24_WIDTH UINT24_WIDTH
|
||||
# define INT_FAST24_WIDTH UINT_FAST24_WIDTH
|
||||
# undef __UINT_LEAST16_WIDTH
|
||||
# define __UINT_LEAST16_WIDTH UINT24_WIDTH
|
||||
# undef __UINT_LEAST8_WIDTH
|
||||
# define __UINT_LEAST8_WIDTH UINT24_WIDTH
|
||||
#endif /* __STDC_VERSION__ */
|
||||
#endif /* __INT24_TYPE__ */
|
||||
|
||||
|
||||
#ifdef __INT16_TYPE__
|
||||
#define INT16_MAX INT16_C(32767)
|
||||
#define INT16_MIN (-INT16_C(32767)-1)
|
||||
#define UINT16_MAX UINT16_C(65535)
|
||||
|
||||
# undef __INT_LEAST16_MIN
|
||||
# define __INT_LEAST16_MIN INT16_MIN
|
||||
# undef __INT_LEAST16_MAX
|
||||
# define __INT_LEAST16_MAX INT16_MAX
|
||||
# undef __UINT_LEAST16_MAX
|
||||
# define __UINT_LEAST16_MAX UINT16_MAX
|
||||
# undef __INT_LEAST8_MIN
|
||||
# define __INT_LEAST8_MIN INT16_MIN
|
||||
# undef __INT_LEAST8_MAX
|
||||
# define __INT_LEAST8_MAX INT16_MAX
|
||||
# undef __UINT_LEAST8_MAX
|
||||
# define __UINT_LEAST8_MAX UINT16_MAX
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
||||
# define UINT16_WIDTH 16
|
||||
# define INT16_WIDTH UINT16_WIDTH
|
||||
# undef __UINT_LEAST16_WIDTH
|
||||
# define __UINT_LEAST16_WIDTH UINT16_WIDTH
|
||||
# undef __UINT_LEAST8_WIDTH
|
||||
# define __UINT_LEAST8_WIDTH UINT16_WIDTH
|
||||
#endif /* __STDC_VERSION__ */
|
||||
#endif /* __INT16_TYPE__ */
|
||||
|
||||
#ifdef __INT_LEAST16_MIN
|
||||
# define INT_LEAST16_MIN __INT_LEAST16_MIN
|
||||
# define INT_LEAST16_MAX __INT_LEAST16_MAX
|
||||
# define UINT_LEAST16_MAX __UINT_LEAST16_MAX
|
||||
# define INT_FAST16_MIN __INT_LEAST16_MIN
|
||||
# define INT_FAST16_MAX __INT_LEAST16_MAX
|
||||
# define UINT_FAST16_MAX __UINT_LEAST16_MAX
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
||||
# define UINT_LEAST16_WIDTH __UINT_LEAST16_WIDTH
|
||||
# define INT_LEAST16_WIDTH UINT_LEAST16_WIDTH
|
||||
# define UINT_FAST16_WIDTH __UINT_LEAST16_WIDTH
|
||||
# define INT_FAST16_WIDTH UINT_FAST16_WIDTH
|
||||
#endif /* __STDC_VERSION__ */
|
||||
#endif /* __INT_LEAST16_MIN */
|
||||
|
||||
|
||||
#ifdef __INT8_TYPE__
|
||||
# define INT8_MAX INT8_C(127)
|
||||
# define INT8_MIN (-INT8_C(127)-1)
|
||||
# define UINT8_MAX UINT8_C(255)
|
||||
|
||||
# undef __INT_LEAST8_MIN
|
||||
# define __INT_LEAST8_MIN INT8_MIN
|
||||
# undef __INT_LEAST8_MAX
|
||||
# define __INT_LEAST8_MAX INT8_MAX
|
||||
# undef __UINT_LEAST8_MAX
|
||||
# define __UINT_LEAST8_MAX UINT8_MAX
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
||||
# define UINT8_WIDTH 8
|
||||
# define INT8_WIDTH UINT8_WIDTH
|
||||
# undef __UINT_LEAST8_WIDTH
|
||||
# define __UINT_LEAST8_WIDTH UINT8_WIDTH
|
||||
#endif /* __STDC_VERSION__ */
|
||||
#endif /* __INT8_TYPE__ */
|
||||
|
||||
#ifdef __INT_LEAST8_MIN
|
||||
# define INT_LEAST8_MIN __INT_LEAST8_MIN
|
||||
# define INT_LEAST8_MAX __INT_LEAST8_MAX
|
||||
# define UINT_LEAST8_MAX __UINT_LEAST8_MAX
|
||||
# define INT_FAST8_MIN __INT_LEAST8_MIN
|
||||
# define INT_FAST8_MAX __INT_LEAST8_MAX
|
||||
# define UINT_FAST8_MAX __UINT_LEAST8_MAX
|
||||
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
||||
# define UINT_LEAST8_WIDTH __UINT_LEAST8_WIDTH
|
||||
# define INT_LEAST8_WIDTH UINT_LEAST8_WIDTH
|
||||
# define UINT_FAST8_WIDTH __UINT_LEAST8_WIDTH
|
||||
# define INT_FAST8_WIDTH UINT_FAST8_WIDTH
|
||||
#endif /* __STDC_VERSION__ */
|
||||
#endif /* __INT_LEAST8_MIN */
|
||||
|
||||
/* Some utility macros */
|
||||
#define __INTN_MIN(n) __stdint_join3( INT, n, _MIN)
|
||||
#define __INTN_MAX(n) __stdint_join3( INT, n, _MAX)
|
||||
#define __UINTN_MAX(n) __stdint_join3(UINT, n, _MAX)
|
||||
#define __INTN_C(n, v) __stdint_join3( INT, n, _C(v))
|
||||
#define __UINTN_C(n, v) __stdint_join3(UINT, n, _C(v))
|
||||
|
||||
/* C99 7.18.2.4 Limits of integer types capable of holding object pointers. */
|
||||
/* C99 7.18.3 Limits of other integer types. */
|
||||
|
||||
#define INTPTR_MIN (-__INTPTR_MAX__-1)
|
||||
#define INTPTR_MAX __INTPTR_MAX__
|
||||
#define UINTPTR_MAX __UINTPTR_MAX__
|
||||
#define PTRDIFF_MIN (-__PTRDIFF_MAX__-1)
|
||||
#define PTRDIFF_MAX __PTRDIFF_MAX__
|
||||
#define SIZE_MAX __SIZE_MAX__
|
||||
|
||||
/* C23 7.22.2.4 Width of integer types capable of holding object pointers. */
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
||||
/* NB: The C standard requires that these be the same value, but the compiler
|
||||
exposes separate internal width macros. */
|
||||
#define INTPTR_WIDTH __INTPTR_WIDTH__
|
||||
#define UINTPTR_WIDTH __UINTPTR_WIDTH__
|
||||
#endif
|
||||
|
||||
/* ISO9899:2011 7.20 (C11 Annex K): Define RSIZE_MAX if __STDC_WANT_LIB_EXT1__
|
||||
* is enabled. */
|
||||
#if defined(__STDC_WANT_LIB_EXT1__) && __STDC_WANT_LIB_EXT1__ >= 1
|
||||
#define RSIZE_MAX (SIZE_MAX >> 1)
|
||||
#endif
|
||||
|
||||
/* C99 7.18.2.5 Limits of greatest-width integer types. */
|
||||
#define INTMAX_MIN (-__INTMAX_MAX__-1)
|
||||
#define INTMAX_MAX __INTMAX_MAX__
|
||||
#define UINTMAX_MAX __UINTMAX_MAX__
|
||||
|
||||
/* C23 7.22.2.5 Width of greatest-width integer types. */
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
||||
/* NB: The C standard requires that these be the same value, but the compiler
|
||||
exposes separate internal width macros. */
|
||||
#define INTMAX_WIDTH __INTMAX_WIDTH__
|
||||
#define UINTMAX_WIDTH __UINTMAX_WIDTH__
|
||||
#endif
|
||||
|
||||
/* C99 7.18.3 Limits of other integer types. */
|
||||
#define SIG_ATOMIC_MIN __INTN_MIN(__SIG_ATOMIC_WIDTH__)
|
||||
#define SIG_ATOMIC_MAX __INTN_MAX(__SIG_ATOMIC_WIDTH__)
|
||||
#ifdef __WINT_UNSIGNED__
|
||||
# define WINT_MIN __UINTN_C(__WINT_WIDTH__, 0)
|
||||
# define WINT_MAX __UINTN_MAX(__WINT_WIDTH__)
|
||||
#else
|
||||
# define WINT_MIN __INTN_MIN(__WINT_WIDTH__)
|
||||
# define WINT_MAX __INTN_MAX(__WINT_WIDTH__)
|
||||
#endif
|
||||
|
||||
#ifndef WCHAR_MAX
|
||||
# define WCHAR_MAX __WCHAR_MAX__
|
||||
#endif
|
||||
#ifndef WCHAR_MIN
|
||||
# if __WCHAR_MAX__ == __INTN_MAX(__WCHAR_WIDTH__)
|
||||
# define WCHAR_MIN __INTN_MIN(__WCHAR_WIDTH__)
|
||||
# else
|
||||
# define WCHAR_MIN __UINTN_C(__WCHAR_WIDTH__, 0)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* 7.18.4.2 Macros for greatest-width integer constants. */
|
||||
#define INTMAX_C(v) __int_c(v, __INTMAX_C_SUFFIX__)
|
||||
#define UINTMAX_C(v) __int_c(v, __UINTMAX_C_SUFFIX__)
|
||||
|
||||
/* C23 7.22.3.x Width of other integer types. */
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
|
||||
#define PTRDIFF_WIDTH __PTRDIFF_WIDTH__
|
||||
#define SIG_ATOMIC_WIDTH __SIG_ATOMIC_WIDTH__
|
||||
#define SIZE_WIDTH __SIZE_WIDTH__
|
||||
#define WCHAR_WIDTH __WCHAR_WIDTH__
|
||||
#define WINT_WIDTH __WINT_WIDTH__
|
||||
#endif
|
||||
|
||||
#endif /* __STDC_HOSTED__ */
|
||||
#endif /* __MVS__ */
|
||||
#endif /* __CLANG_STDINT_H */
|
||||
302
deps/suil/wrapper.h
vendored
Normal file
302
deps/suil/wrapper.h
vendored
Normal file
|
|
@ -0,0 +1,302 @@
|
|||
// Copyright 2011-2017 David Robillard <d@drobilla.net>
|
||||
// SPDX-License-Identifier: ISC
|
||||
|
||||
/// @file suil.h Public API for Suil
|
||||
|
||||
#ifndef SUIL_SUIL_H
|
||||
#define SUIL_SUIL_H
|
||||
|
||||
typedef struct { const char *URI; void *data; } LV2_Feature;
|
||||
|
||||
#include "stdbool.h"
|
||||
#include "stdint.h"
|
||||
|
||||
// SUIL_LIB_IMPORT and SUIL_LIB_EXPORT mark the entry points of shared libraries
|
||||
#ifdef _WIN32
|
||||
# define SUIL_LIB_IMPORT __declspec(dllimport)
|
||||
# define SUIL_LIB_EXPORT __declspec(dllexport)
|
||||
#else
|
||||
# define SUIL_LIB_IMPORT __attribute__((visibility("default")))
|
||||
# define SUIL_LIB_EXPORT __attribute__((visibility("default")))
|
||||
#endif
|
||||
|
||||
// SUIL_API exposes symbols in the public API
|
||||
#ifndef SUIL_API
|
||||
# ifdef SUIL_STATIC
|
||||
# define SUIL_API
|
||||
# elif defined(SUIL_INTERNAL)
|
||||
# define SUIL_API SUIL_LIB_EXPORT
|
||||
# else
|
||||
# define SUIL_API SUIL_LIB_IMPORT
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
@defgroup suil Suil C API
|
||||
@{
|
||||
*/
|
||||
|
||||
/**
|
||||
@defgroup suil_callbacks Callbacks
|
||||
@{
|
||||
*/
|
||||
|
||||
/**
|
||||
UI controller.
|
||||
|
||||
This is an opaque pointer passed by the user which is passed to the various
|
||||
UI control functions (e.g. SuilPortWriteFunc). It is typically used to pass
|
||||
a pointer to some controller object the host uses to communicate with
|
||||
plugins.
|
||||
*/
|
||||
typedef void* SuilController;
|
||||
|
||||
/// Function to write/send a value to a port
|
||||
typedef void (*SuilPortWriteFunc)( //
|
||||
SuilController controller,
|
||||
uint32_t port_index,
|
||||
uint32_t buffer_size,
|
||||
uint32_t protocol,
|
||||
void const* buffer);
|
||||
|
||||
/// Function to return the index for a port by symbol
|
||||
typedef uint32_t (*SuilPortIndexFunc)( //
|
||||
SuilController controller,
|
||||
const char* port_symbol);
|
||||
|
||||
/// Function to subscribe to notifications for a port
|
||||
typedef uint32_t (*SuilPortSubscribeFunc)( //
|
||||
SuilController controller,
|
||||
uint32_t port_index,
|
||||
uint32_t protocol,
|
||||
const LV2_Feature* const* features);
|
||||
|
||||
/// Function to unsubscribe from notifications for a port
|
||||
typedef uint32_t (*SuilPortUnsubscribeFunc)( //
|
||||
SuilController controller,
|
||||
uint32_t port_index,
|
||||
uint32_t protocol,
|
||||
const LV2_Feature* const* features);
|
||||
|
||||
/// Function called when a control is grabbed or released
|
||||
typedef void (*SuilTouchFunc)( //
|
||||
SuilController controller,
|
||||
uint32_t port_index,
|
||||
bool grabbed);
|
||||
|
||||
/**
|
||||
@}
|
||||
@defgroup suil_library Library
|
||||
@{
|
||||
*/
|
||||
|
||||
/// Initialization argument
|
||||
typedef enum { SUIL_ARG_NONE } SuilArg;
|
||||
|
||||
/**
|
||||
Initialize suil.
|
||||
|
||||
This function should be called as early as possible, before any other GUI
|
||||
toolkit functions. The variable argument list is a sequence of SuilArg keys
|
||||
and corresponding value pairs for passing any necessary platform-specific
|
||||
information. It must be terminated with SUIL_ARG_NONE.
|
||||
*/
|
||||
SUIL_API
|
||||
void
|
||||
suil_init(int* argc, char*** argv, SuilArg key, ...);
|
||||
|
||||
/**
|
||||
Check if suil can wrap a UI type.
|
||||
|
||||
@param host_type_uri The URI of the desired widget type of the host,
|
||||
corresponding to the `type_uri` parameter of suil_instance_new().
|
||||
|
||||
@param ui_type_uri The URI of the UI widget type.
|
||||
|
||||
@return 0 if wrapping is unsupported, otherwise the quality of the wrapping
|
||||
where 1 is the highest quality (direct native embedding with no wrapping)
|
||||
and increasing values are of a progressively lower quality and/or stability.
|
||||
*/
|
||||
SUIL_API
|
||||
unsigned
|
||||
suil_ui_supported(const char* host_type_uri, const char* ui_type_uri);
|
||||
|
||||
/**
|
||||
@}
|
||||
@defgroup suil_host Host
|
||||
@{
|
||||
*/
|
||||
|
||||
/**
|
||||
UI host descriptor.
|
||||
|
||||
This contains the various functions that a plugin UI may use to communicate
|
||||
with the plugin. It is passed to suil_instance_new() to provide these
|
||||
functions to the UI.
|
||||
*/
|
||||
typedef struct SuilHostImpl SuilHost;
|
||||
|
||||
/**
|
||||
Create a new UI host descriptor.
|
||||
|
||||
@param write_func Function to send a value to a plugin port.
|
||||
@param index_func Function to get the index for a port by symbol.
|
||||
@param subscribe_func Function to subscribe to port updates.
|
||||
@param unsubscribe_func Function to unsubscribe from port updates.
|
||||
*/
|
||||
SUIL_API
|
||||
SuilHost*
|
||||
suil_host_new(SuilPortWriteFunc write_func,
|
||||
SuilPortIndexFunc index_func,
|
||||
SuilPortSubscribeFunc subscribe_func,
|
||||
SuilPortUnsubscribeFunc unsubscribe_func);
|
||||
|
||||
/**
|
||||
Set a touch function for a host descriptor.
|
||||
|
||||
Note this function will only be called if the UI supports it.
|
||||
*/
|
||||
SUIL_API
|
||||
void
|
||||
suil_host_set_touch_func(SuilHost* host, SuilTouchFunc touch_func);
|
||||
|
||||
/**
|
||||
Free `host`.
|
||||
*/
|
||||
SUIL_API
|
||||
void
|
||||
suil_host_free(SuilHost* host);
|
||||
|
||||
/**
|
||||
@}
|
||||
*/
|
||||
|
||||
/**
|
||||
@defgroup suil_instance Instance
|
||||
@{
|
||||
*/
|
||||
|
||||
/// An instance of an LV2 plugin UI
|
||||
typedef struct SuilInstanceImpl SuilInstance;
|
||||
|
||||
/// Opaque pointer to a UI handle
|
||||
typedef void* SuilHandle;
|
||||
|
||||
/// Opaque pointer to a UI widget
|
||||
typedef void* SuilWidget;
|
||||
|
||||
/**
|
||||
Instantiate a UI for an LV2 plugin.
|
||||
|
||||
This funcion may load a suil module to adapt the UI to the desired toolkit.
|
||||
Suil is configured at compile time to load modules from the appropriate
|
||||
place, but this can be changed at run-time via the environment variable
|
||||
SUIL_MODULE_DIR. This makes it possible to bundle suil with an application.
|
||||
|
||||
Note that some situations (Gtk in Qt, Windows in Gtk) require a parent
|
||||
container to be passed as a feature with URI LV2_UI__parent
|
||||
(http://lv2plug.in/ns/extensions/ui#ui) in order to work correctly. The
|
||||
data must point to a single child container of the host widget set.
|
||||
|
||||
@param host Host descriptor.
|
||||
@param controller Opaque host controller pointer.
|
||||
@param container_type_uri URI of the desired host container widget type.
|
||||
@param plugin_uri URI of the plugin to instantiate this UI for.
|
||||
@param ui_uri URI of the specifically desired UI.
|
||||
@param ui_type_uri URI of the actual UI widget type.
|
||||
@param ui_bundle_path Path of the UI bundle.
|
||||
@param ui_binary_path Path of the UI binary.
|
||||
@param features NULL-terminated array of supported features, or NULL.
|
||||
@return A new UI instance, or NULL if instantiation failed.
|
||||
*/
|
||||
SUIL_API
|
||||
SuilInstance*
|
||||
suil_instance_new(SuilHost* host,
|
||||
SuilController controller,
|
||||
const char* container_type_uri,
|
||||
const char* plugin_uri,
|
||||
const char* ui_uri,
|
||||
const char* ui_type_uri,
|
||||
const char* ui_bundle_path,
|
||||
const char* ui_binary_path,
|
||||
const LV2_Feature* const* features);
|
||||
|
||||
/**
|
||||
Free a plugin UI instance.
|
||||
|
||||
The caller must ensure all references to the UI have been dropped before
|
||||
calling this function (e.g. it has been removed from its parent).
|
||||
*/
|
||||
SUIL_API
|
||||
void
|
||||
suil_instance_free(SuilInstance* instance);
|
||||
|
||||
/**
|
||||
Get the handle for a UI instance.
|
||||
|
||||
Returns the handle to the UI instance. The returned handle has opaque type
|
||||
to insulate the Suil API from LV2 extensions, but in pactice it is currently
|
||||
of type `LV2UI_Handle`. This should not normally be needed.
|
||||
|
||||
The returned handle is shared and must not be deleted.
|
||||
*/
|
||||
SUIL_API
|
||||
SuilHandle
|
||||
suil_instance_get_handle(SuilInstance* instance);
|
||||
|
||||
/**
|
||||
Get the widget for a UI instance.
|
||||
|
||||
Returns an opaque pointer to a widget, the type of which matches the
|
||||
`container_type_uri` parameter of suil_instance_new(). Note this may be a
|
||||
wrapper widget created by Suil, and not necessarily the widget directly
|
||||
implemented by the UI.
|
||||
*/
|
||||
SUIL_API
|
||||
SuilWidget
|
||||
suil_instance_get_widget(SuilInstance* instance);
|
||||
|
||||
/**
|
||||
Notify the UI about a change in a plugin port.
|
||||
|
||||
This function can be used to notify the UI about any port change, but in the
|
||||
simplest case is used to set the value of lv2:ControlPort ports. For
|
||||
simplicity, this is a special case where `format` is 0, `buffer_size` is 4,
|
||||
and `buffer` should point to a single float.
|
||||
|
||||
The `buffer` must be valid only for the duration of this call, the UI must
|
||||
not keep a reference to it.
|
||||
|
||||
@param instance UI instance.
|
||||
@param port_index Index of the port which has changed.
|
||||
@param buffer_size Size of `buffer` in bytes.
|
||||
@param format Format of `buffer` (mapped URI, or 0 for float).
|
||||
@param buffer Change data, e.g. the new port value.
|
||||
*/
|
||||
SUIL_API
|
||||
void
|
||||
suil_instance_port_event(SuilInstance* instance,
|
||||
uint32_t port_index,
|
||||
uint32_t buffer_size,
|
||||
uint32_t format,
|
||||
const void* buffer);
|
||||
|
||||
/// Return a data structure defined by some LV2 extension URI
|
||||
SUIL_API
|
||||
const void*
|
||||
suil_instance_extension_data(SuilInstance* instance, const char* uri);
|
||||
|
||||
/**
|
||||
@}
|
||||
@}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* SUIL_SUIL_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue