From 8920a736364c0b955fd8c4db0634fa129640df8e Mon Sep 17 00:00:00 2001 From: MysaaJava Date: Fri, 12 Jan 2024 19:22:10 +0100 Subject: [PATCH] Merged two working project, some cleaning to do :/ --- CMakeLists.txt | 51 +++ build.gradle | 97 +++-- .../sboard/audio/plugin/LV2Plugin.java | 5 + .../com/bernard/sboard/view/SBoardFrame.java | 8 + src/main/java/jlilv/Lilv.java | 79 +++++ src/main/java/jlilv/LilvCollection.java | 55 +++ src/main/java/jlilv/LilvInstance.java | 197 +++++++++++ src/main/java/jlilv/LilvNode.java | 133 +++++++ src/main/java/jlilv/LilvPlugin.java | 331 ++++++++++++++++++ src/main/java/jlilv/LilvPluginClass.java | 35 ++ src/main/java/jlilv/LilvPort.java | 122 +++++++ src/main/java/jlilv/LilvScalePoint.java | 21 ++ src/main/java/jlilv/LilvState.java | 291 +++++++++++++++ src/main/java/jlilv/LilvUI.java | 69 ++++ src/main/java/jlilv/LilvWorld.java | 329 +++++++++++++++++ src/main/java/jlilv/c/CFree.java | 5 + src/main/java/jlilv/c/CObject.java | 13 + src/main/jni/Lilv.cpp | 53 +++ src/main/jni/LilvCollection.cpp | 44 +++ src/main/jni/LilvNode.cpp | 175 +++++++++ src/main/jni/LilvPlugin.cpp | 286 +++++++++++++++ src/main/jni/LilvPluginClass.cpp | 45 +++ src/main/jni/LilvPort.cpp | 134 +++++++ src/main/jni/LilvScalePoint.cpp | 24 ++ src/main/jni/LilvState.cpp | 114 ++++++ src/main/jni/LilvUI.cpp | 55 +++ src/main/jni/LilvWorld.cpp | 284 +++++++++++++++ 27 files changed, 3035 insertions(+), 20 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 src/main/java/com/bernard/sboard/audio/plugin/LV2Plugin.java create mode 100644 src/main/java/com/bernard/sboard/view/SBoardFrame.java create mode 100644 src/main/java/jlilv/Lilv.java create mode 100644 src/main/java/jlilv/LilvCollection.java create mode 100644 src/main/java/jlilv/LilvInstance.java create mode 100644 src/main/java/jlilv/LilvNode.java create mode 100644 src/main/java/jlilv/LilvPlugin.java create mode 100644 src/main/java/jlilv/LilvPluginClass.java create mode 100644 src/main/java/jlilv/LilvPort.java create mode 100644 src/main/java/jlilv/LilvScalePoint.java create mode 100644 src/main/java/jlilv/LilvState.java create mode 100644 src/main/java/jlilv/LilvUI.java create mode 100644 src/main/java/jlilv/LilvWorld.java create mode 100644 src/main/java/jlilv/c/CFree.java create mode 100644 src/main/java/jlilv/c/CObject.java create mode 100644 src/main/jni/Lilv.cpp create mode 100644 src/main/jni/LilvCollection.cpp create mode 100644 src/main/jni/LilvNode.cpp create mode 100644 src/main/jni/LilvPlugin.cpp create mode 100644 src/main/jni/LilvPluginClass.cpp create mode 100644 src/main/jni/LilvPort.cpp create mode 100644 src/main/jni/LilvScalePoint.cpp create mode 100644 src/main/jni/LilvState.cpp create mode 100644 src/main/jni/LilvUI.cpp create mode 100644 src/main/jni/LilvWorld.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..c759771 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,51 @@ +cmake_minimum_required(VERSION 3.10) + +project(jlilv VERSION 1.0.0 DESCRIPTION "Java Bindings for Lilv" LANGUAGES C) + +#set(CMAKE_CXX_STANDARD 17) +#set(CMAKE_CXX_STANDARD_REQUIRED ON) +#set(CMAKE_CXX_EXTENSIONS OFF) + +include(GNUInstallDirs) +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) + +# jvm +find_package(Java REQUIRED) +# https://stackoverflow.com/questions/51047978/cmake-could-not-find-jni +set(JAVA_AWT_LIBRARY NotNeeded) +set(JAVA_JVM_LIBRARY NotNeeded) +find_package(JNI REQUIRED) + +include(FindPkgConfig) +if(NOT PKG_CONFIG_FOUND) + message(FATAL_ERROR "pkg-config not found!" ) +endif() + +include_directories(${JNI_INCLUDE_DIRS}) + +# force off-tree build +if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + message(FATAL_ERROR "CMake generation is not allowed within the source directory! + Remove the CMakeCache.txt file and try again from another folder, e.g.: + mkdir build && cd build + cmake .. + ") +endif() + +# default to Release build +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Release CACHE STRING + "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel." + FORCE) +endif() + +include_directories(build/generated/sources/headers/java/main/) +add_library(jlilv SHARED src/main/c/Lilv.c) + +#target_link_libraries(jlilv ${LILV_LIBRARIES}) +#target_include_directories(jlilv PUBLIC ${LILV_INCLUDE_DIRS}) +#target_compile_options(jlilv PUBLIC ${LILV_CFLAGS_OTHER}) +pkg_check_modules(lilv-0 REQUIRED IMPORTED_TARGET lilv-0) +target_link_libraries(jlilv PkgConfig::lilv-0) diff --git a/build.gradle b/build.gradle index de7a402..d7169fd 100644 --- a/build.gradle +++ b/build.gradle @@ -1,25 +1,82 @@ +import org.gradle.internal.jvm.Jvm + plugins { - id 'application' - id 'eclipse' + id 'java' + id 'eclipse' + id 'application' + id 'cpp' } - -repositories { - mavenCentral() -} - -dependencies { - implementation 'com.nativelibs4java:bridj:0.7.0' - - implementation 'com.illposed.osc:javaosc-core:0.8' - - implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.3' - implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.12.2' - - implementation 'org.apache.logging.log4j:log4j-core:2.17.1' - - testImplementation 'junit:junit:4.13.2' -} - application { mainClass = 'com.bernard.sboard.SBoard' + applicationDefaultJvmArgs += ["-Djava.library.path=${projectDir}/build/libs/jlilv/shared/"] } + +println "Building on OS: " + System.properties['os.name'] +println "Using JDK: " + System.properties['java.home'] + +def JNI_CFLAGS = ['-I',System.properties['java.home'] + "/include/",'-I',System.properties['java.home'] + "/include/linux/"] +def LILV_CFLAGS = ['pkg-config','--cflags','lilv-0'].execute().text.trim() +def JNI_LDFLAGS = "" +def LILV_LDFLAGS = ['pkg-config','--libs','lilv-0'].execute().text.trim() + +println "Using JNI C Flags: " + JNI_CFLAGS +println "Using LILV C Flags: " + LILV_CFLAGS +println "Using JNI ld Flags: " + JNI_LDFLAGS +println "Using LILV ld Flags: " + LILV_LDFLAGS + +model { + components { + jlilv(NativeLibrarySpec) { + sources { + cpp { + source { + srcDir 'src/main/jni' + include "**/*.cpp" + } + } + } + } + } + toolChains { + gcc(Gcc) { + eachPlatform { + cppCompiler.withArguments { args -> + args.add("-O2") + args.addAll(JNI_CFLAGS) + args.addAll("$LILV_CFLAGS".split(" ")) + args.addAll(["-I","${projectDir}/build/generated/sources/headers/java/main/"]) + args << "-std=c++11" + } + linker.withArguments { args -> + args << "-O2" + //args.addAll("$JNI_LDFLAGS".split(" ")) + args.addAll("$LILV_LDFLAGS".split(" ")) + args << "-lstdc++" + } + } + } + } +} + +run { + dependsOn build +} + +sourceSets { + main { + java { + srcDir 'src/app/java' + } + resources { + srcDir 'src/app/resources' + } + } + test { + java { + srcDir 'src/test/java' + } + resources { + srcDir 'src/test/resources' + } + } +} \ No newline at end of file diff --git a/src/main/java/com/bernard/sboard/audio/plugin/LV2Plugin.java b/src/main/java/com/bernard/sboard/audio/plugin/LV2Plugin.java new file mode 100644 index 0000000..a37cff7 --- /dev/null +++ b/src/main/java/com/bernard/sboard/audio/plugin/LV2Plugin.java @@ -0,0 +1,5 @@ +package com.bernard.sboard.audio.plugin; + +public class LV2Plugin { + +} diff --git a/src/main/java/com/bernard/sboard/view/SBoardFrame.java b/src/main/java/com/bernard/sboard/view/SBoardFrame.java new file mode 100644 index 0000000..ed6ca06 --- /dev/null +++ b/src/main/java/com/bernard/sboard/view/SBoardFrame.java @@ -0,0 +1,8 @@ +package com.bernard.sboard.view; + +import javax.swing.JFrame; + +public class SBoardFrame extends JFrame { + private static final long serialVersionUID = -7140968271977065983L; + +} diff --git a/src/main/java/jlilv/Lilv.java b/src/main/java/jlilv/Lilv.java new file mode 100644 index 0000000..3aefca7 --- /dev/null +++ b/src/main/java/jlilv/Lilv.java @@ -0,0 +1,79 @@ +package jlilv; + +/** + * Adapted from lilv.h API for Lilv + * Original Copyright: 2007-2019 David Robillard + * Lilv version: 0.24.22 + */ +public class Lilv { + + public static final String LILV_NS_DOAP = "http://usefulinc.com/ns/doap#"; + public static final String LILV_NS_FOAF = "http://xmlns.com/foaf/0.1/"; + public static final String LILV_NS_LILV = "http://drobilla.net/ns/lilv#"; + public static final String LILV_NS_LV2 = "http://lv2plug.in/ns/lv2core#"; + public static final String LILV_NS_OWL = "http://www.w3.org/2002/07/owl#"; + public static final String LILV_NS_RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; + public static final String LILV_NS_RDFS = "http://www.w3.org/2000/01/rdf-schema#"; + public static final String LILV_NS_XSD = "http://www.w3.org/2001/XMLSchema#"; + + public static final String LILV_URI_ATOM_PORT = "http://lv2plug.in/ns/ext/atom#AtomPort"; + public static final String LILV_URI_AUDIO_PORT = "http://lv2plug.in/ns/lv2core#AudioPort"; + public static final String LILV_URI_CONTROL_PORT = "http://lv2plug.in/ns/lv2core#ControlPort"; + public static final String LILV_URI_CV_PORT = "http://lv2plug.in/ns/lv2core#CVPort"; + public static final String LILV_URI_EVENT_PORT = "http://lv2plug.in/ns/ext/event#EventPort"; + public static final String LILV_URI_INPUT_PORT = "http://lv2plug.in/ns/lv2core#InputPort"; + public static final String LILV_URI_MIDI_EVENT = "http://lv2plug.in/ns/ext/midi#MidiEvent"; + public static final String LILV_URI_OUTPUT_PORT = "http://lv2plug.in/ns/lv2core#OutputPort"; + public static final String LILV_URI_PORT = "http://lv2plug.in/ns/lv2core#Port"; + + /** + Convert a file URI string to a local path string. + + For example, "file://foo/bar/baz.ttl" returns "/foo/bar/baz.ttl". + Return value is shared and must not be deleted by caller. + This function does not handle escaping correctly and should not be used for + general file URIs. Use lilv_file_uri_parse() instead. + + @return `uri` converted to a path, or NULL on failure (URI is not local). + */ + @Deprecated + public static native String lilvUriToPath(String uri); + + public static class ParsedUri { + String path; + String hostname; + public ParsedUri(String path, String hostname) { + this.path = path; + this.hostname = hostname; + } + @Override + public String toString() { + return "ParsedUri [path=" + path + ", hostname=" + hostname + "]"; + } + + } + /** + Convert a file URI string to a local path string. + + For example, "file://foo/bar%20one/baz.ttl" returns "/foo/bar one/baz.ttl". + Return value must be freed by caller with lilv_free(). + + @param uri The file URI to parse. + @return The Parsed URI with `uri` converted to a path, or NULL on failure + (URI is not local), and the hostname in the URI, if any. + */ + //XXX Must Free + public static native ParsedUri fileUriParse(String uri); + + + + /** + Free a LilvNode. + + It is safe to call this function on NULL. + */ + //XXX Should be java invisible + public native void freeNode(LilvNode val); + + +} diff --git a/src/main/java/jlilv/LilvCollection.java b/src/main/java/jlilv/LilvCollection.java new file mode 100644 index 0000000..48627d5 --- /dev/null +++ b/src/main/java/jlilv/LilvCollection.java @@ -0,0 +1,55 @@ +package jlilv; + +import java.util.Iterator; + +import jlilv.c.CObject; + +public class LilvCollection extends CObject implements Iterable{ + + //XXX Must free the class + + Type type; + + //TODO Add get_by_uri functions + + public native int size(); + + // Was lilv_plugin_classes_begin + @Override + public Iterator iterator() { + //TODO implement with + return new LilvIterator(); + } + + + private class LilvIterator implements Iterator{ + + // Was lilv_plugin_classes_is_end + @Override + public native boolean hasNext(); + + // Was lilv_plugin_classes_next + // And lilv_plugin_classes_get + @Override + public native E next(); + + } + + public static enum Type { + + PLUGIN((byte) 1,LilvPlugin.class), + PLUGINCLASS((byte) 2,LilvPluginClass.class), + SCALEPOINTS((byte) 3,LilvScalePoint.class), + NODE((byte) 4,LilvNode.class), + UI((byte) 5,LilvUI.class); + + Class clazz; + byte i; + + private Type(byte i, Class clazz) { + this.i = i; + this.clazz = clazz; + } + } + +} diff --git a/src/main/java/jlilv/LilvInstance.java b/src/main/java/jlilv/LilvInstance.java new file mode 100644 index 0000000..0e69561 --- /dev/null +++ b/src/main/java/jlilv/LilvInstance.java @@ -0,0 +1,197 @@ +package jlilv; + +import jlilv.c.CObject; + +public class LilvInstance extends CObject { +// +// /* Instance of a plugin. +// +// This is exposed in the ABI to allow inlining of performance critical +// functions like lilv_instance_run() (simple wrappers of functions in lv2.h). +// This is for performance reasons, user code should not use this definition +// in any way (which is why it is not machine documented). +// Truly private implementation details are hidden via `pimpl`. +// */ +// struct LilvInstanceImpl { +// const LV2_Descriptor* lv2_descriptor; +// LV2_Handle lv2_handle; +// void* pimpl; +// }; +// +// /** +// @endcond +// */ +// +// /** +// Instantiate a plugin. +// +// The returned value is a lightweight handle for an LV2 plugin instance, +// it does not refer to `plugin`, or any other Lilv state. The caller must +// eventually free it with lilv_instance_free(). +// `features` is a NULL-terminated array of features the host supports. +// NULL may be passed if the host supports no additional features. +// +// This function is in the "discovery" threading class: it isn't real-time +// safe, and may not be called concurrently with itself for the same plugin. +// +// @return NULL if instantiation failed. +// */ +// LILV_API +// LilvInstance* +// lilv_plugin_instantiate(const LilvPlugin* plugin, +// double sample_rate, +// const LV2_Feature* const* features); +// +// /** +// Free a plugin instance. +// +// It is safe to call this function on NULL. The `instance` is invalid after +// this call. +// +// This function is in the "discovery" threading class: it isn't real-time +// safe, and may not be called concurrently with any other function for the +// same instance, or with lilv_plugin_instantiate() for the same plugin. +// */ +// LILV_API +// void +// lilv_instance_free(LilvInstance* instance); +// +// #ifndef LILV_INTERNAL +// +// /** +// Get the URI of the plugin which `instance` is an instance of. +// +// This function is a simple accessor and may be called at any time. The +// returned string is shared and must not be modified or deleted. +// */ +// static inline const char* +// lilv_instance_get_uri(const LilvInstance* instance) +// { +// return instance->lv2_descriptor->URI; +// } +// +// /** +// Connect a port to a data location. +// +// This may be called regardless of whether the plugin is activated, +// activation and deactivation does not destroy port connections. +// +// This function is in the "audio" threading class: it's real-time safe if the +// plugin is , but may not be +// called concurrently with any other function for the same instance. +// */ +// static inline void +// lilv_instance_connect_port(LilvInstance* instance, +// uint32_t port_index, +// void* data_location) +// { +// instance->lv2_descriptor->connect_port( +// instance->lv2_handle, port_index, data_location); +// } +// +// /** +// Activate a plugin instance. +// +// This resets all state information in the plugin, except for port data +// locations (as set by lilv_instance_connect_port()). This MUST be called +// before calling lilv_instance_run(). +// +// This function is in the "instantiation" threading class: it isn't real-time +// safe, and may not be called concurrently with any other function for the +// same instance. +// */ +// static inline void +// lilv_instance_activate(LilvInstance* instance) +// { +// if (instance->lv2_descriptor->activate) { +// instance->lv2_descriptor->activate(instance->lv2_handle); +// } +// } +// +// /** +// Run `instance` for `sample_count` frames. +// +// If the hint lv2:hardRTCapable is set for this plugin, this function is +// guaranteed not to block. +// +// This function is in the "audio" threading class: it's real-time safe if the +// plugin is , but may not be +// called concurrently with any other function for the same instance. +// */ +// static inline void +// lilv_instance_run(LilvInstance* instance, uint32_t sample_count) +// { +// instance->lv2_descriptor->run(instance->lv2_handle, sample_count); +// } +// +// /** +// Deactivate a plugin instance. +// +// Note that to run the plugin after this you must activate it, which will +// reset all state information (except port connections). +// +// This function is in the "instantiation" threading class: it isn't real-time +// safe and may not be called concurrently with any other function for the same +// instance. +// */ +// static inline void +// lilv_instance_deactivate(LilvInstance* instance) +// { +// if (instance->lv2_descriptor->deactivate) { +// instance->lv2_descriptor->deactivate(instance->lv2_handle); +// } +// } +// +// /** +// Get extension data from the plugin instance. +// +// The type and semantics of the data returned is specific to the particular +// extension, though in all cases it is shared and must not be deleted. +// +// This function is in the "discovery" threading class: it isn't real-time safe +// and may not be called concurrently with any other function for the same +// instance. +// */ +// static inline const void* +// lilv_instance_get_extension_data(const LilvInstance* instance, const char* uri) +// { +// if (instance->lv2_descriptor->extension_data) { +// return instance->lv2_descriptor->extension_data(uri); +// } +// +// return NULL; +// } +// +// /** +// Get the LV2_Descriptor of the plugin instance. +// +// Normally hosts should not need to access the LV2_Descriptor directly, +// use the lilv_instance_* functions. +// +// The returned descriptor is shared and must not be deleted. +// +// This function is a simple accessor and may be called at any time. +// */ +// static inline const LV2_Descriptor* +// lilv_instance_get_descriptor(const LilvInstance* instance) +// { +// return instance->lv2_descriptor; +// } +// +// /** +// Get the LV2_Handle of the plugin instance. +// +// Normally hosts should not need to access the LV2_Handle directly, +// use the lilv_instance_* functions. +// +// The returned handle is shared and must not be deleted. +// +// This function is a simple accessor and may be called at any time. +// */ +// static inline LV2_Handle +// lilv_instance_get_handle(const LilvInstance* instance) +// { +// return instance->lv2_handle; +// } + +} diff --git a/src/main/java/jlilv/LilvNode.java b/src/main/java/jlilv/LilvNode.java new file mode 100644 index 0000000..a3c6751 --- /dev/null +++ b/src/main/java/jlilv/LilvNode.java @@ -0,0 +1,133 @@ +package jlilv; + +import jlilv.c.CObject; + +public class LilvNode extends CObject implements Cloneable { + + /** + Return this value as a Turtle/SPARQL token. + + Returned value must be freed by caller with lilv_free(). + + Example tokens: + + - URI: <http://example.org/foo> + - QName: doap:name + - String: "this is a string" + - Float: 1.0 + - Integer: 1 + - Boolean: true + */ + public native String getTurtleToken(); + + /** + Return whether the value is a URI (resource). + */ + public native boolean isUri(); + + /** + Return this value as a URI string, like "http://example.org/foo". + + Valid to call only if `lilv_node_is_uri(value)` returns true. + Returned value is owned by `value` and must not be freed by caller. + */ + public native String asUri(); + + /** + Return whether the value is a blank node (resource with no URI). + */ + public native boolean isBlank(); + + /** + Return this value as a blank node identifier, like "genid03". + + Valid to call only if `lilv_node_is_blank(value)` returns true. + Returned value is owned by `value` and must not be freed by caller. + */ + public native String asBlank(); + + /** + Return whether this value is a literal (that is, not a URI). + + Returns true if `value` is a string or numeric value. + */ + public native boolean isLiteral(); + + /** + Return whether this value is a string literal. + + Returns true if `value` is a string value (and not numeric). + */ + public native boolean isString(); + + /** + Return `value` as a string. + */ + public native String asString(); + + /** + Return the path of a file URI node. + + Returns NULL if `value` is not a file URI. + Returned value must be freed by caller with lilv_free(). + */ + //XXX Must-free + public native Lilv.ParsedUri getPath(); + + /** + Return whether this value is a decimal literal. + */ + public native boolean isFloat(); + + /** + Return `value` as a float. + + Valid to call only if `lilv_node_is_float(value)` or + `lilv_node_is_int(value)` returns true. + */ + public native float asFloat(); + + /** + Return whether this value is an integer literal. + */ + public native boolean isInt(); + + /** + Return `value` as an integer. + + Valid to call only if `lilv_node_is_int(value)` returns true. + */ + public native int asInt(); + + /** + Return whether this value is a boolean. + */ + public native boolean isBool(); + + /** + Return `value` as a bool. + + Valid to call only if `lilv_node_is_bool(value)` returns true. + */ + public native boolean asBool(); + + + /** + Duplicate a LilvNode. + */ + @Override + public native Object clone() throws CloneNotSupportedException; + + + /** + Return whether two values are equivalent. + */ + @Override + public boolean equals(Object obj) { + if(obj instanceof LilvNode) + return equals((LilvNode)obj); + return false; + } + public native boolean equals(LilvNode other); + +} diff --git a/src/main/java/jlilv/LilvPlugin.java b/src/main/java/jlilv/LilvPlugin.java new file mode 100644 index 0000000..2aec9b9 --- /dev/null +++ b/src/main/java/jlilv/LilvPlugin.java @@ -0,0 +1,331 @@ +package jlilv; + +import jlilv.c.CObject; + +public class LilvPlugin extends CObject { + + /** + Get all UIs for `plugin`. + + Returned value must be freed by caller using lilv_uis_free(). + */ + //XXX Must Free + public native LilvCollection getUis(); + + /** + Check if `plugin` is valid. + + This is not a rigorous validator, but can be used to reject some malformed + plugins that could cause bugs (for example, plugins with missing required + fields). + + Note that normal hosts do NOT need to use this - lilv does not + load invalid plugins into plugin lists. This is included for plugin + testing utilities, etc. + + @return True iff `plugin` is valid. + */ + public native boolean verify(); + + /** + Get the URI of `plugin`. + + Any serialization that refers to plugins should refer to them by this. + Hosts SHOULD NOT save any filesystem paths, plugin indexes, etc. in saved + files; save only the URI. + + The URI is a globally unique identifier for one specific plugin. Two + plugins with the same URI are compatible in port signature, and should + be guaranteed to work in a compatible and consistent way. If a plugin + is upgraded in an incompatible way (eg if it has different ports), it + MUST have a different URI than it's predecessor. + + @return A shared URI value which must not be modified or freed. + */ + public native LilvNode getUri(); + + /** + Get the (resolvable) URI of the plugin's "main" bundle. + + This returns the URI of the bundle where the plugin itself was found. Note + that the data for a plugin may be spread over many bundles, that is, + lilv_plugin_get_data_uris() may return URIs which are not within this + bundle. + + Typical hosts should not need to use this function. + Note this always returns a fully qualified URI. If you want a local + filesystem path, use lilv_file_uri_parse(). + + @return A shared string which must not be modified or freed. + */ + public native LilvNode getBundleUri(); + + /** + Get the (resolvable) URIs of the RDF data files that define a plugin. + + Typical hosts should not need to use this function. + Note this always returns fully qualified URIs. If you want local + filesystem paths, use lilv_file_uri_parse(). + + @return A list of complete URLs eg. "file:///foo/ABundle.lv2/aplug.ttl", + which is shared and must not be modified or freed. + */ + public native LilvCollection getDataUris(); + + /** + Get the (resolvable) URI of the shared library for `plugin`. + + Note this always returns a fully qualified URI. If you want a local + filesystem path, use lilv_file_uri_parse(). + + @return A shared string which must not be modified or freed. + */ + public native LilvNode getLibraryUri(); + + /** + Get the name of `plugin`. + + This returns the name (doap:name) of the plugin. The name may be + translated according to the current locale, this value MUST NOT be used + as a plugin identifier (use the URI for that). + + Returned value must be freed by the caller. + */ + public native LilvNode getName(); + + /** + Get the class this plugin belongs to (like "Filters" or "Effects"). + */ + public native LilvPluginClass getPluginClass(); + + /** + Get a value associated with the plugin in a plugin's data files. + + `predicate` must be either a URI or a QName. + + Returns the ?object of all triples found of the form: + + <plugin-uri> predicate ?object + + May return NULL if the property was not found, or if object(s) is not + sensibly represented as a LilvNodes. + + Return value must be freed by caller with lilv_nodes_free(). + */ + public native LilvCollection getValue(LilvNode predicate); + + /** + Return whether a feature is supported by a plugin. + + This will return true if the feature is an optional or required feature + of the plugin. + */ + public native boolean hasFeature(LilvNode feature); + + /** + Get the LV2 Features supported (required or optionally) by a plugin. + + A feature is "supported" by a plugin if it is required OR optional. + + Since required features have special rules the host must obey, this function + probably shouldn't be used by normal hosts. Using + lilv_plugin_get_optional_features() and lilv_plugin_get_required_features() + separately is best in most cases. + + Returned value must be freed by caller with lilv_nodes_free(). + */ + public native LilvCollection getSupportedFeatures(); + + /** + Get the LV2 Features required by a plugin. + + If a feature is required by a plugin, hosts MUST NOT use the plugin if they + do not understand (or are unable to support) that feature. + + All values returned here MUST be passed to the plugin's instantiate method + (along with data, if necessary, as defined by the feature specification) + or plugin instantiation will fail. + + Return value must be freed by caller with lilv_nodes_free(). + */ + public native LilvCollection getRequiredFeatures(); + + /** + Get the LV2 Features optionally supported by a plugin. + + Hosts MAY ignore optional plugin features for whatever reasons. Plugins + MUST operate (at least somewhat) if they are instantiated without being + passed optional features. + + Return value must be freed by caller with lilv_nodes_free(). + */ + public native LilvCollection getOptionalFeatures(); + + /** + Return whether or not a plugin provides a specific extension data. + */ + public native boolean hasExtensionData(LilvNode uri); + + /** + Get a sequence of all extension data provided by a plugin. + + This can be used to find which URIs lilv_instance_get_extension_data() + will return a value for without instantiating the plugin. + */ + public native LilvCollection getExtensionData(); + + /** + Get the number of ports on this plugin. + */ + public native int getNumPorts(); + + /** + Get the port ranges (minimum, maximum and default values) for all ports. + + `min_values`, `max_values` and `def_values` must either point to an array + of N floats, where N is the value returned by lilv_plugin_get_num_ports() + for this plugin, or NULL. The elements of the array will be set to the + the minimum, maximum and default values of the ports on this plugin, + with array index corresponding to port index. If a port doesn't have a + minimum, maximum or default value, or the port's type is not float, the + corresponding array element will be set to NAN. + + This is a convenience method for the common case of getting the range of + all float ports on a plugin, and may be significantly faster than + repeated calls to lilv_port_get_range(). + */ + public native PortRanges getPortRanges(); + + public class PortRanges { + float min_values; + float max_values; + float def_values; + } + + /** + Get the number of ports on this plugin that are members of some class(es). + + Note that this is a varargs function so ports fitting any type 'profile' + desired can be found quickly. REMEMBER TO TERMINATE THE PARAMETER LIST + OF THIS FUNCTION WITH NULL OR VERY NASTY THINGS WILL HAPPEN. + */ + //XXX implement this one + //LILV_API + //uint32_t + //lilv_plugin_get_num_ports_of_class(const LilvPlugin* plugin, + // const LilvNode* class_1, + // ...); + + /** + Variant of lilv_plugin_get_num_ports_of_class() that takes a va_list. + + This function calls va_arg() on `args` but does not call va_end(). + */ + // XXX implement this one +// LILV_API +// uint32_t +// lilv_plugin_get_num_ports_of_class_va(const LilvPlugin* plugin, +// const LilvNode* class_1, +// va_list args); + + /** + Return whether or not the plugin introduces (and reports) latency. + + The index of the latency port can be found with + lilv_plugin_get_latency_port() ONLY if this function returns true. + */ + public native boolean hasLatency(); + + /** + Return the index of the plugin's latency port. + + It is a fatal error to call this on a plugin without checking if the port + exists by first calling lilv_plugin_has_latency(). + + Any plugin that introduces unwanted latency that should be compensated for + (by hosts with the ability/need) MUST provide this port, which is a control + rate output port that reports the latency for each cycle in frames. + */ + public native int getLatencyPortIndex(); + + /** + Get a port on `plugin` by `index`. + */ + public native LilvPort getPortByIndex(int index); + + /** + Get a port on `plugin` by `symbol`. + + Note this function is slower than lilv_plugin_get_port_by_index(), + especially on plugins with a very large number of ports. + */ + public native LilvPort getPortBySymbol(LilvNode symbol); + + /** + Get a port on `plugin` by its lv2:designation. + + The designation of a port describes the meaning, assignment, allocation or + role of the port, like "left channel" or "gain". If found, the port with + matching `port_class` and `designation` is be returned, otherwise NULL is + returned. The `port_class` can be used to distinguish the input and output + ports for a particular designation. If `port_class` is NULL, any port with + the given designation will be returned. + */ + public native LilvPort getPortByDesignation(LilvNode port_class,LilvNode designation); + + /** + Get the project the plugin is a part of. + + More information about the project can be read via lilv_world_find_nodes(), + typically using properties from DOAP (such as doap:name). + */ + public native LilvNode getProject(); + + /** + Get the full name of the plugin's author. + + Returns NULL if author name is not present. + Returned value must be freed by caller. + */ + public native LilvNode getAuthorName(); + + /** + Get the email address of the plugin's author. + + Returns NULL if author email address is not present. + Returned value must be freed by caller. + */ + public native LilvNode getAuthorEmail(); + + /** + Get the address of the plugin author's home page. + + Returns NULL if author homepage is not present. + Returned value must be freed by caller. + */ + public native LilvNode getAuthorHomepage(); + + /** + Return true iff `plugin` has been replaced by another plugin. + + The plugin will still be usable, but hosts should hide them from their + user interfaces to prevent users from using deprecated plugins. + */ + public native boolean isReplaced(); + + /** + Get the resources related to `plugin` with lv2:appliesTo. + + Some plugin-related resources are not linked directly to the plugin with + rdfs:seeAlso and thus will not be automatically loaded along with the plugin + data (usually for performance reasons). All such resources of the given @c + type related to `plugin` can be accessed with this function. + + If `type` is NULL, all such resources will be returned, regardless of type. + + To actually load the data for each returned resource, use + lilv_world_load_resource(). + */ + public native LilvCollection getRelated(LilvNode type); + +} diff --git a/src/main/java/jlilv/LilvPluginClass.java b/src/main/java/jlilv/LilvPluginClass.java new file mode 100644 index 0000000..b5bdfd3 --- /dev/null +++ b/src/main/java/jlilv/LilvPluginClass.java @@ -0,0 +1,35 @@ +package jlilv; + +import jlilv.c.CObject; + +public class LilvPluginClass extends CObject { + + /** + Get the URI of this class' superclass. + + Returned value is owned by `plugin_class` and must not be freed by caller. + Returned value may be NULL, if class has no parent. + */ + public native LilvNode getParentUri(); + + /** + Get the URI of this plugin class. + + Returned value is owned by `plugin_class` and must not be freed by caller. + */ + public native LilvNode getUri(); + + /** + Get the label of this plugin class, like "Oscillators". + + Returned value is owned by `plugin_class` and must not be freed by caller. + */ + public native LilvNode getLabel(); + + /** + Get the subclasses of this plugin class. + + Returned value must be freed by caller with lilv_plugin_classes_free(). + */ + public native LilvCollection getChildren(); +} diff --git a/src/main/java/jlilv/LilvPort.java b/src/main/java/jlilv/LilvPort.java new file mode 100644 index 0000000..6358bfb --- /dev/null +++ b/src/main/java/jlilv/LilvPort.java @@ -0,0 +1,122 @@ +package jlilv; + +import jlilv.c.CObject; + +public class LilvPort extends CObject { + + long pluginPointer; + + /** + Get the RDF node of `port`. + + Ports nodes may be may be URIs or blank nodes. + + @return A shared node which must not be modified or freed. + */ + public native LilvNode getNode(); + + /** + Port analog of lilv_plugin_get_value(). + */ + public native LilvCollection getValue(LilvNode predicate); + + /** + Get a single property value of a port. + + This is equivalent to lilv_nodes_get_first(lilv_port_get_value(...)) but is + simpler to use in the common case of only caring about one value. The + caller is responsible for freeing the returned node. + */ + public native LilvNode get(LilvNode predicate); + + /** + Return the LV2 port properties of a port. + */ + public native LilvCollection getProperties(); + + /** + Return whether a port has a certain property. + */ + public native boolean hasProperty(LilvNode property); + + /** + Return whether a port supports a certain event type. + + More precisely, this returns true iff the port has an atom:supports or an + ev:supportsEvent property with `event_type` as the value. + */ + public native boolean supportsEvent(LilvNode event_type); + + /** + Get the index of a port. + + The index is only valid for the life of the plugin and may change between + versions. For a stable identifier, use the symbol. + */ + public native int getIndex(); + + /** + Get the symbol of a port. + + The 'symbol' is a short string, a valid C identifier. + Returned value is owned by `port` and must not be freed. + */ + public native LilvNode getSymbol(); + + /** + Get the name of a port. + + This is guaranteed to return the untranslated name (the doap:name in the + data file without a language tag). Returned value must be freed by + the caller. + */ + public native LilvNode getName(); + + /** + Get all the classes of a port. + + This can be used to determine if a port is an input, output, audio, + control, midi, etc, etc, though it's simpler to use lilv_port_is_a(). + The returned list does not include lv2:Port, which is implied. + Returned value is shared and must not be destroyed by caller. + */ + public native LilvCollection getClasses(); + + /** + Determine if a port is of a given class (input, output, audio, etc). + + For convenience/performance/extensibility reasons, hosts are expected to + create a LilvNode for each port class they "care about". Well-known type + URI strings like `LILV_URI_INPUT_PORT` are defined for convenience, but + this function is designed so that Lilv is usable with any port types + without requiring explicit support in Lilv. + */ + public native boolean isA(LilvNode port_class); + + /** + Get the default, minimum, and maximum values of a port. + + `def`, `min`, and `max` are outputs, pass pointers to uninitialized + LilvNode* variables. These will be set to point at new values (which must + be freed by the caller using lilv_node_free()), or NULL if the value does + not exist. + */ + public native PortValues getRange(); + public class PortValues { + LilvNode def; + LilvNode min; + LilvNode max; + } + + /** + Get the scale points (enumeration values) of a port. + + This returns a collection of 'interesting' named values of a port, which for + example might be appropriate entries for a value selector in a UI. + + Returned value may be NULL if `port` has no scale points, otherwise it + must be freed by caller with lilv_scale_points_free(). + */ + public native LilvCollection getScalePoints(); + +} diff --git a/src/main/java/jlilv/LilvScalePoint.java b/src/main/java/jlilv/LilvScalePoint.java new file mode 100644 index 0000000..b342be0 --- /dev/null +++ b/src/main/java/jlilv/LilvScalePoint.java @@ -0,0 +1,21 @@ +package jlilv; + +import jlilv.c.CObject; + +public class LilvScalePoint extends CObject{ + + /** + Get the label of this scale point (enumeration value). + + Returned value is owned by `point` and must not be freed. + */ + public native LilvNode getLabel(); + + /** + Get the value of this scale point (enumeration value). + + Returned value is owned by `point` and must not be freed. + */ + public native LilvNode getValue(); + +} diff --git a/src/main/java/jlilv/LilvState.java b/src/main/java/jlilv/LilvState.java new file mode 100644 index 0000000..2072221 --- /dev/null +++ b/src/main/java/jlilv/LilvState.java @@ -0,0 +1,291 @@ +package jlilv; + +import jlilv.c.CObject; + +public class LilvState extends CObject { + + /** + Function to get a port value. + + This function MUST set `size` and `type` appropriately. + + @param port_symbol The symbol of the port. + @param user_data The user_data passed to lilv_state_new_from_instance(). + @param size (Output) The size of the returned value. + @param type (Output) The URID of the type of the returned value. + @return A pointer to the port value. + */ + // Function symbol -> userdata -> (size,type,port) +// typedef const void* (*LilvGetPortValueFunc)(const char* port_symbol, +// void* user_data, +// uint32_t* size, +// uint32_t* type); + + /** + Create a new state snapshot from a plugin instance. + + + This function may be called simultaneously with any instance function + (except discovery functions) unless the threading class of that function + explicitly disallows this. + + To support advanced file functionality, there are several directory + parameters. The multiple parameters are necessary to support saving an + instance's state many times, or saving states from multiple instances, while + avoiding any duplication of data. For example, a host could pass the same + `copy_dir` and `link_dir` for all plugins in a session (for example + `session/shared/copy/` `session/shared/link/`), while the `save_dir` would + be unique to each plugin instance (for example `session/states/state1.lv2` + for one instance and `session/states/state2.lv2` for another instance). + Simple hosts that only wish to save a single plugin's state once may simply + use the same directory for all of them, or pass NULL to not support files at + all. + + If supported (via state:makePath passed to LV2_Descriptor::instantiate()), + `scratch_dir` should be the directory where any files created by the plugin + (for example during instantiation or while running) are stored. Any files + here that are referred to in the state will be copied to preserve their + contents at the time of the save. Lilv will assume any files within this + directory (recursively) are created by the plugin and that all other files + are immutable. Note that this function does not completely save the state, + use lilv_state_save() for that. + + See state.h from the + LV2 State extension for details on the `flags` and `features` parameters. + + @param plugin The plugin this state applies to. + + @param instance An instance of `plugin`. + + @param map The map to use for mapping URIs in state. + + @param scratch_dir Directory of files created by the plugin earlier, or + NULL. This is for hosts that support file creation at any time with state + state:makePath. These files will be copied as necessary to `copy_dir` and + not be referred to directly in state (a temporary directory is appropriate). + + @param copy_dir Directory of copies of files in `scratch_dir`, or NULL. + This directory will have the same structure as `scratch_dir` but with + possibly modified file names to distinguish revisions. This allows the + saved state to contain the exact contents of the scratch file at save time, + so that the state is not ruined if the file is later modified (for example, + by the plugin continuing to record). This can be the same as `save_dir` to + create a copy in the state bundle, but can also be a separate directory + which allows multiple state snapshots to share a single copy if the file has + not changed. + + @param link_dir Directory of links to external files, or NULL. A link will + be made in this directory to any external files referred to in plugin state. + In turn, links will be created in the save directory to these links (like + save_dir/file => link_dir/file => /foo/bar/file). This allows many state + snapshots to share a single link to an external file, so archival (for + example, with `tar -h`) will not create several copies of the file. If this + is not required, it can be the same as `save_dir`. + + @param save_dir Directory of files created by plugin during save (or NULL). + This is typically the bundle directory later passed to lilv_state_save(). + + @param get_value Function to get port values (or NULL). If NULL, the + returned state will not represent port values. This should only be NULL in + hosts that save and restore port values via some other mechanism. + + @param user_data User data to pass to `get_value`. + + @param flags Bitwise OR of LV2_State_Flags values. + + @param features Features to pass LV2_State_Interface.save(). + + @return A new LilvState which must be freed with lilv_state_free(). + */ + //TODO Implement this with getportvaluefunc +// public native LilvState newFromInstance(LilvPlugin plugin,LilvInstance instance,long mapPointer, +// String scratch_dir,String copy_dir,String link_dir,String save_dir, +// LilvGetPortValueFunc get_value,Object user_data,int flags,Object[] features); + + /** + Free `state`. + */ + public native void free(); + + /** + Return true iff `a` is equivalent to `b`. + */ + + @Override + public boolean equals(Object obj) { + if(obj instanceof LilvState) + return equals((LilvState)obj); + return false; + } + public native boolean equals(LilvState b); + + /** + Return the number of properties in `state`. + */ + public native int getNumProperties(); + + /** + Get the URI of the plugin `state` applies to. + */ + public native LilvNode getPluginUri(); + + /** + Get the URI of `state`. + + This may return NULL if the state has not been saved and has no URI. + */ + public native LilvNode getUri(); + + /** + Get the label of `state`. + */ + public native String getLabel(); + + /** + Set the label of `state`. + */ + public native void setLabel(String label); + + /** + Set a metadata property on `state`. + + This is a generic version of lilv_state_set_label(), which sets metadata + properties visible to hosts, but not plugins. This allows storing useful + information such as comments or preset banks. + + @param state The state to set the metadata for. + @param key The key to store `value` under (URID). + @param value Pointer to the value to be stored. + @param size The size of `value` in bytes. + @param type The type of `value` (URID). + @param flags LV2_State_Flags for `value`. + @return Zero on success. + */ + public native int setMetadata(int key,byte[] value,int size,int type,int flags); + + /** + Function to set a port value. + + @param port_symbol The symbol of the port. + @param user_data The user_data passed to lilv_state_restore(). + @param size The size of `value`. + @param type The URID of the type of `value`. + @param value A pointer to the port value. + */ +// typedef void (*LilvSetPortValueFunc)(const char* port_symbol, +// void* user_data, +// const void* value, +// uint32_t size, +// uint32_t type); + + /** + Enumerate the port values in a state snapshot. + + This function is a subset of lilv_state_restore() that only fires the + `set_value` callback and does not directly affect a plugin instance. This + is useful in hosts that need to retrieve the port values in a state snapshot + for special handling. + + @param state The state to retrieve port values from. + @param set_value A function to receive port values. + @param user_data User data to pass to `set_value`. + */ + //TODO Implement with setportvalue +// LILV_API +// void +// lilv_state_emit_port_values(const LilvState* state, +// LilvSetPortValueFunc set_value, +// void* user_data); + + /** + Restore a plugin instance from a state snapshot. + + This will set all the properties of `instance`, if given, to the values + stored in `state`. If `set_value` is provided, it will be called (with the + given `user_data`) to restore each port value, otherwise the host must + restore the port values itself (using lilv_state_get_port_value()) in order + to completely restore `state`. + + If the state has properties and `instance` is given, this function is in + the "instantiation" threading class, so it MUST NOT be called + simultaneously with any function on the same plugin instance. If the state + has no properties, only port values are set via `set_value`. + + See state.h from the + LV2 State extension for details on the `flags` and `features` parameters. + + @param state The state to restore, which must apply to the correct plugin. + @param instance An instance of the plugin `state` applies to, or NULL. + @param set_value A function to set a port value (may be NULL). + @param user_data User data to pass to `set_value`. + @param flags Bitwise OR of LV2_State_Flags values. + @param features Features to pass LV2_State_Interface.restore(). + */ + //TODO Implement with setportvalue +// LILV_API +// void +// lilv_state_restore(const LilvState* state, +// LilvInstance* instance, +// LilvSetPortValueFunc set_value, +// void* user_data, +// uint32_t flags, +// const LV2_Feature* const* features); + + /** + Save state to a file. + + The format of state on disk is compatible with that defined in the LV2 + preset extension, so this function may be used to save presets which can + be loaded by any host. + + If `uri` is NULL, the preset URI will be a file URI, but the bundle + can safely be moved (the state file will use `<>` as the subject). + + @param world The world. + @param map URID mapper. + @param unmap URID unmapper. + @param state State to save. + @param uri URI of state, may be NULL. + @param dir Path of the bundle directory to save into. + @param filename Path of the state file relative to `dir`. + */ + public native int save(LilvWorld world, long mapPointer, long unmapPointer, String uri, String dir, String filename); + + /** + Save state to a string. + + This function does not use the filesystem. + + @param world The world. + + @param map URID mapper. + + @param unmap URID unmapper. + + @param state The state to serialize. + + @param uri URI for the state description (mandatory). + + @param base_uri Base URI for serialisation. Unless you know what you are + doing, pass NULL for this, otherwise the state may not be restorable via + lilv_state_new_from_string(). + */ + public native String saveToString(LilvWorld world, long mapPointer, long unmapPointer, String uri, String base_url); + + /** + Unload a state from the world and delete all associated files. + + This function DELETES FILES/DIRECTORIES FROM THE FILESYSTEM! It is intended + for removing user-saved presets, but can delete any state the user has + permission to delete, including presets shipped with plugins. + + The rdfs:seeAlso file for the state will be removed. The entry in the + bundle's manifest.ttl is removed, and if this results in an empty manifest, + then the manifest file is removed. If this results in an empty bundle, then + the bundle directory is removed as well. + + @param world The world. + @param state State to remove from the system. + */ + public native int delete(LilvWorld world); +} diff --git a/src/main/java/jlilv/LilvUI.java b/src/main/java/jlilv/LilvUI.java new file mode 100644 index 0000000..ce0f195 --- /dev/null +++ b/src/main/java/jlilv/LilvUI.java @@ -0,0 +1,69 @@ +package jlilv; + +public class LilvUI { + + /** + Get the URI of a Plugin UI. + + @return A shared value which must not be modified or freed. + */ + public native LilvNode getUri(); + + /** + Get the types (URIs of RDF classes) of a Plugin UI. + + Note that in most cases lilv_ui_is_supported() should be used, which avoids + the need to use this function (and type specific logic). + + @return A shared value which must not be modified or freed. + */ + public native LilvCollection getClasses(); + + /** + Check whether a plugin UI has a given type. + + @param ui The Plugin UI + @param class_uri The URI of the LV2 UI type to check this UI against + */ + public native boolean isA(LilvNode class_uri); + + /** + Function to determine whether a UI type is supported. + + This is provided by the user and must return non-zero iff using a UI of type + `ui_type_uri` in a container of type `container_type_uri` is supported. + */ + // This is a function LilvUISupportedFunc: String -> String -> int + // typedef unsigned (*LilvUISupportedFunc)(const char* container_type_uri, const char* ui_type_uri); + + /** + Return true iff a Plugin UI is supported as a given widget type. + + @param ui The Plugin UI + + @param supported_func User provided supported predicate. + + @param container_type The widget type to host the UI within. + + @param ui_type (Output) If non-NULL, set to the native type of the UI + which is owned by `ui` and must not be freed by the caller. + + @return The embedding quality level returned by `supported_func`. + */ + // TODO Give functions manually for supported_func + // public native int isSupported(LilvUI ui,LilvUISupportedFunc supported_func,LilvNode container_type,LilvNode** ui_type); + + /** + Get the URI for a Plugin UI's bundle. + + @return A shared value which must not be modified or freed. + */ + public native LilvNode getBundleUri(); + + /** + Get the URI for a Plugin UI's shared library. + + @return A shared value which must not be modified or freed. + */ + public native LilvNode getBinaryUri(); +} diff --git a/src/main/java/jlilv/LilvWorld.java b/src/main/java/jlilv/LilvWorld.java new file mode 100644 index 0000000..8286029 --- /dev/null +++ b/src/main/java/jlilv/LilvWorld.java @@ -0,0 +1,329 @@ +package jlilv; + +import java.io.File; + +import jlilv.c.CObject; + +/** + * The "world" represents all Lilv state, and is used to discover/load/cache + * LV2 data (plugins, UIs, and extensions). + * Normal hosts which just need to load plugins by URI should simply use + * lilv_world_load_all() to discover/load the system's LV2 resources. + */ +public class LilvWorld extends CObject{ + + + + /** + Initialize a new, empty world. + + If initialization fails, NULL is returned. + */ + public native LilvWorld lilvWorldNew(); + + /** + Enable/disable language filtering. + + Language filtering applies to any functions that return (a) value(s). + With filtering enabled, Lilv will automatically return the best value(s) + for the current LANG. With filtering disabled, all matching values will + be returned regardless of language tag. Filtering is enabled by default. + */ + public static final String LILV_OPTION_FILTER_LANG = "http://drobilla.net/ns/lilv#filter-lang"; + + /** + Enable/disable dynamic manifest support. + + Dynamic manifest data will only be loaded if this option is true. + */ + public static final String LILV_OPTION_DYN_MANIFEST = "http://drobilla.net/ns/lilv#dyn-manifest"; + + /** + Set application-specific LV2_PATH. + + This overrides the LV2_PATH from the environment, so that lilv will only + look inside the given path. This can be used to make self-contained + applications. + */ + public static final String LILV_OPTION_LV2_PATH = "http://drobilla.net/ns/lilv#lv2-path"; + + /** + Set an option for `world`. + + Currently recognized options: + + - #LILV_OPTION_FILTER_LANG + - #LILV_OPTION_DYN_MANIFEST + - #LILV_OPTION_LV2_PATH + */ + public native void setOption(String uri, LilvNode value); + + + /** + Destroy the world. + + It is safe to call this function on NULL. Note that destroying `world` will + destroy all the objects it contains. Do not destroy the world until you are + finished with all objects that came from it. + */ + //XXX Should java remove + public native void free(); + + /** + Load all installed LV2 bundles on the system. + + This is the recommended way for hosts to load LV2 data. It implements the + established/standard best practice for discovering all LV2 data on the + system. The environment variable LV2_PATH may be used to control where + this function will look for bundles. + + Hosts should use this function rather than explicitly load bundles, except + in special circumstances such as development utilities, or hosts that ship + with special plugin bundles which are installed to a known location. + */ + public native void loadAll(); + + /** + Load a specific bundle. + + `bundle_uri` must be a fully qualified URI to the bundle directory, + with the trailing slash, eg. file:///usr/lib/lv2/foo.lv2/ + + Normal hosts should not need this function (use lilv_world_load_all()). + + Hosts MUST NOT attach any long-term significance to bundle paths + (for example in save files), since there are no guarantees they will remain + unchanged between (or even during) program invocations. Plugins (among + other things) MUST be identified by URIs (not paths) in save files. + */ + public native void loadBundle(LilvNode bundle_uri); + + /** + Load all specifications from currently loaded bundles. + + This is for hosts that explicitly load specific bundles, its use is not + necessary when using lilv_world_load_all(). This function parses the + specifications and adds them to the model. + */ + public native void loadSpecifications(); + + /** + Load all plugin classes from currently loaded specifications. + + Must be called after lilv_world_load_specifications(). This is for hosts + that explicitly load specific bundles, its use is not necessary when using + lilv_world_load_all(). + */ + public native void loadPluginClasses(); + + /** + Unload a specific bundle. + + This unloads statements loaded by lilv_world_load_bundle(). Note that this + is not necessarily all information loaded from the bundle. If any resources + have been separately loaded with lilv_world_load_resource(), they must be + separately unloaded with lilv_world_unload_resource(). + */ + public native int unloadBundle(LilvNode bundle_uri); + + /** + Load all the data associated with the given `resource`. + + All accessible data files linked to `resource` with rdfs:seeAlso will be + loaded into the world model. + + @param world The world. + @param resource Must be a subject (a URI or a blank node). + @return The number of files parsed, or -1 on error + */ + public native int loadResource(LilvNode resource); + + /** + Unload all the data associated with the given `resource`. + + This unloads all data loaded by a previous call to + lilv_world_load_resource() with the given `resource`. + + @param world The world. + @param resource Must be a subject (a URI or a blank node). + */ + public native int unloadResource(LilvNode resource); + + /** + Get the parent of all other plugin classes, lv2:Plugin. + */ + public native LilvPluginClass getPluginClass(); + + /** + Return a list of all found plugin classes. + + Returned list is owned by world and must not be freed by the caller. + */ + public native LilvCollection getPluginClasses(); + + /** + Return a list of all found plugins. + + The returned list contains just enough references to query + or instantiate plugins. The data for a particular plugin will not be + loaded into memory until a call to an lilv_plugin_* function results in + a query (at which time the data is cached with the LilvPlugin so future + queries are very fast). + + The returned list and the plugins it contains are owned by `world` + and must not be freed by caller. + */ + public native LilvCollection getAllPlugins(); + + /** + Find nodes matching a triple pattern. + + Either `subject` or `object` may be NULL (a wildcard), but not both. + + @return All matches for the wildcard field, or NULL. + */ + public native LilvCollection findNodes(LilvNode subject,LilvNode predicate,LilvNode object); + + /** + Find a single node that matches a pattern. + + Exactly one of `subject`, `predicate`, `object` must be NULL. + This function is equivalent to + lilv_nodes_get_first(lilv_world_find_nodes(...)) but simplifies the common + case of only wanting a single value. + + @return The first matching node, or NULL if no matches are found. + */ + public native LilvNode get(LilvNode subject,LilvNode predicate,LilvNode object); + + /** + Return true iff a statement matching a certain pattern exists. + + This is useful for checking if particular statement exists without having to + bother with collections and memory management. + + @param world The world. + @param subject Subject of statement, or NULL for anything. + @param predicate Predicate (key) of statement, or NULL for anything. + @param object Object (value) of statement, or NULL for anything. + */ + public native boolean ask(LilvNode subject,LilvNode predicate,LilvNode object); + + /** + Get an LV2 symbol for some subject. + + This will return the lv2:symbol property of the subject if it is given + explicitly, and otherwise will attempt to derive a symbol from the URI. + + @return A string node that is a valid LV2 symbol, or NULL on error. + */ + public native LilvNode getSymbol(LilvNode subject); + + + /** + Write the Turtle description of `plugin` to `plugin_file`. + + This function is particularly useful for porting plugins in conjunction with + an LV2 bridge such as NASPRO. + */ + public native void writeDescription(LilvPlugin plugin,LilvNode base_uri,File plugin_file); + + /** + Write a manifest entry for `plugin` to `manifest_file`. + + This function is intended for use with lilv_plugin_write_description() to + write a complete description of a plugin to a bundle. + */ + public native void writeManifestEntry(LilvPlugin plugin,LilvNode base_uri,File manifest_file,String plugin_file_path); + + + /** + Load a state snapshot from the world RDF model. + + This function can be used to load the default state of a plugin by passing + the plugin URI as the `subject` parameter. + + @param world The world. + @param map URID mapper. + @param node The subject of the state description (such as a preset URI). + @return A new LilvState which must be freed with lilv_state_free(), or NULL. + */ + public native LilvState newStateFromWorld(long mapPointer,LilvNode node); + + /** + Load a state snapshot from a file. + + If `subject` is NULL, it is taken to be the URI of the file (`<>` in + Turtle). + + This function parses the file separately to create the state, it does not + parse the file into the world model, that is, the returned state is the only + new memory consumed once this function returns. + + @param world The world. + @param map URID mapper. + @param subject The subject of the state description (such as a preset URI). + @param path The path of the file containing the state description. + @return A new LilvState which must be freed with lilv_state_free(). + */ + public native LilvState newStateFromFile(long mapPointer,LilvNode subject,String path); + + /** + Load a state snapshot from a string made by lilv_state_to_string(). + */ + public native LilvState newStateFromString(long mapPointer,String str); + + + + /** + Create a new URI value. + + Returned value must be freed by caller with lilv_node_free(). + */ + //XXX Must free + public native LilvNode newUri(String uri); + + /** + Create a new file URI value. + + Relative paths are resolved against the current working directory. Note + that this may yield unexpected results if `host` is another machine. + + @param host Host name, or NULL. + @param path Path on host. + @return A new node that must be freed by caller. + */ + public native LilvNode newFileUri(String host, String path); + + /** + Create a new string value (with no language). + + Returned value must be freed by caller with lilv_node_free(). + */ + //XXX Must free + public native LilvNode newString(String str); + + /** + Create a new integer value. + + Returned value must be freed by caller with lilv_node_free(). + */ + //XXX Must free + public native LilvNode newInt(int val); + + /** + Create a new floating point value. + + Returned value must be freed by caller with lilv_node_free(). + */ + //XXX Must free + public native LilvNode newFloat(float val); + + /** + Create a new boolean value. + + Returned value must be freed by caller with lilv_node_free(). + */ + //XXX Must free + public native LilvNode newBool(boolean val); +} diff --git a/src/main/java/jlilv/c/CFree.java b/src/main/java/jlilv/c/CFree.java new file mode 100644 index 0000000..b1c41e4 --- /dev/null +++ b/src/main/java/jlilv/c/CFree.java @@ -0,0 +1,5 @@ +package jlilv.c; + +public interface CFree { + public void free(long pointer); +} diff --git a/src/main/java/jlilv/c/CObject.java b/src/main/java/jlilv/c/CObject.java new file mode 100644 index 0000000..47bba29 --- /dev/null +++ b/src/main/java/jlilv/c/CObject.java @@ -0,0 +1,13 @@ +package jlilv.c; + +public class CObject { + + long cpointer; + CFree cfree = null; + + @Override + protected void finalize() throws Throwable { + if(cfree != null) + this.cfree.free(this.cpointer); + } +} diff --git a/src/main/jni/Lilv.cpp b/src/main/jni/Lilv.cpp new file mode 100644 index 0000000..be032a2 --- /dev/null +++ b/src/main/jni/Lilv.cpp @@ -0,0 +1,53 @@ +#include +#include + +#include +#include + +/* + * Class: jlilv_Lilv + * Method: lilvUriToPath + * Signature: (Ljava/lang/String;)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_jlilv_Lilv_lilvUriToPath + (JNIEnv* env, jclass clazz, jstring uriJ){ + const char* uri = env->GetStringUTFChars(uriJ, 0); + const char* path = lilv_uri_to_path(uri); + + jstring pathJ = env->NewStringUTF(path); + env->ReleaseStringUTFChars(uriJ, uri); + return pathJ; +} + +/* + * Class: jlilv_Lilv + * Method: lilv_file_uri_parse + * Signature: (Ljava/lang/String;)Ljlilv/Lilv/ParsedUri; + */ +JNIEXPORT jobject JNICALL Java_jlilv_Lilv_fileUriParse + (JNIEnv* env, jclass clazz, jstring uriJ){ + const char* uri = env->GetStringUTFChars(uriJ, NULL); + char* hostname; + + char* path = lilv_file_uri_parse(uri,&hostname); + + jstring pathJ = env->NewStringUTF(path); + jstring hostnameJ = env->NewStringUTF(hostname); + + jclass outClass = env->FindClass("jlilv/Lilv$ParsedUri"); + jmethodID outCstr = env->GetMethodID(outClass,"","(Ljava/lang/String;Ljava/lang/String;)V"); + jobject outJ = env->NewObject(outClass, outCstr, pathJ, hostnameJ); + + env->ReleaseStringUTFChars(uriJ, uri); + return outJ; +} + +/* + * Class: jlilv_Lilv + * Method: lilv_node_free + * Signature: (Ljlilv/LilvNode;)V + */ +JNIEXPORT void JNICALL Java_jlilv_Lilv_freeNode(JNIEnv* env,jobject obj, jobject ptr){ + //TODO Implement + return; +} diff --git a/src/main/jni/LilvCollection.cpp b/src/main/jni/LilvCollection.cpp new file mode 100644 index 0000000..9bf421a --- /dev/null +++ b/src/main/jni/LilvCollection.cpp @@ -0,0 +1,44 @@ +#include +#include +#include + +#include +#include + +/* + * Class: jlilv_LilvCollection + * Method: size + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_jlilv_LilvCollection_size + (JNIEnv* env, jobject obj){ + + jclass collectionClass = env->FindClass("jlilv/LilvCollection"); + jfieldID ctypeField = env->GetFieldID(collectionClass , "type", "Ljlilv/LilvCollection/Type;"); + + jbyte type = env->GetByteField(obj, ctypeField); + + printf("Found %d\n",type); + + return NULL; +} + +/* + * Class: jlilv_LilvCollection_LilvIterator + * Method: hasNext + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvCollection_00024LilvIterator_hasNext + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvCollection_LilvIterator + * Method: next + * Signature: ()Ljava/lang/Object; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvCollection_00024LilvIterator_next + (JNIEnv* env, jobject obj){ + return NULL; +} diff --git a/src/main/jni/LilvNode.cpp b/src/main/jni/LilvNode.cpp new file mode 100644 index 0000000..9a805dd --- /dev/null +++ b/src/main/jni/LilvNode.cpp @@ -0,0 +1,175 @@ +#include +#include + +#include +#include + +/* + * Class: jlilv_LilvNode + * Method: getTurtleToken + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_jlilv_LilvNode_getTurtleToken + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvNode + * Method: isUri + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvNode_isUri + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvNode + * Method: asUri + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_jlilv_LilvNode_asUri + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvNode + * Method: isBlank + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvNode_isBlank + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvNode + * Method: asBlank + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_jlilv_LilvNode_asBlank + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvNode + * Method: isLiteral + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvNode_isLiteral + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvNode + * Method: isString + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvNode_isString + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvNode + * Method: asString + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_jlilv_LilvNode_asString + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvNode + * Method: getPath + * Signature: ()Ljlilv/Lilv/ParsedUri; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvNode_getPath + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvNode + * Method: isFloat + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvNode_isFloat + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvNode + * Method: asFloat + * Signature: ()F + */ +JNIEXPORT jfloat JNICALL Java_jlilv_LilvNode_asFloat + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvNode + * Method: isInt + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvNode_isInt + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvNode + * Method: asInt + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_jlilv_LilvNode_asInt + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvNode + * Method: isBool + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvNode_isBool + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvNode + * Method: asBool + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvNode_asBool + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvNode + * Method: clone + * Signature: ()Ljava/lang/Object; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvNode_clone + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvNode + * Method: equals + * Signature: (Ljlilv/LilvNode;)Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvNode_equals + (JNIEnv* env, jobject obj, jobject oth){ + return NULL; +} diff --git a/src/main/jni/LilvPlugin.cpp b/src/main/jni/LilvPlugin.cpp new file mode 100644 index 0000000..a109243 --- /dev/null +++ b/src/main/jni/LilvPlugin.cpp @@ -0,0 +1,286 @@ +#include +#include + +#include +#include + +/* + * Class: jlilv_LilvPlugin + * Method: getUis + * Signature: (Ljlilv/LilvPlugin;)Ljlilv/LilvCollection; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getUis + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: verify + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvPlugin_verify + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getUri + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getUri + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getBundleUri + * Signature: (Ljlilv/LilvPlugin;)Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getBundleUri + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getDataUris + * Signature: ()Ljlilv/LilvCollection; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getDataUris + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getLibraryUri + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getLibraryUri + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getName + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getName + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getPluginClass + * Signature: ()Ljlilv/LilvPluginClass; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getPluginClass + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getValue + * Signature: (Ljlilv/LilvNode;)Ljlilv/LilvCollection; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getValue + (JNIEnv* env, jobject obj, jobject predicate){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: hasFeature + * Signature: (Ljlilv/LilvNode;)Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvPlugin_hasFeature + (JNIEnv* env, jobject obj, jobject feature){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getSupportedFeatures + * Signature: (Ljlilv/LilvPlugin;)Ljlilv/LilvCollection; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getSupportedFeatures + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getRequiredFeatures + * Signature: ()Ljlilv/LilvCollection; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getRequiredFeatures + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getOptionalFeatures + * Signature: ()Ljlilv/LilvCollection; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getOptionalFeatures + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: hasExtensionData + * Signature: (Ljlilv/LilvNode;)Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvPlugin_hasExtensionData + (JNIEnv* env, jobject obj, jobject uri){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getExtensionData + * Signature: (Ljlilv/LilvPlugin;)Ljlilv/LilvCollection; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getExtensionData + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getNumPorts + * Signature: (Ljlilv/LilvPlugin;)I + */ +JNIEXPORT jint JNICALL Java_jlilv_LilvPlugin_getNumPorts + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: lilv_plugin_get_port_ranges_float + * Signature: ()Ljlilv/LilvPlugin/PortRanges; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getPortRanges + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: hasLatency + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvPlugin_hasLatency + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getLatencyPortIndex + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_jlilv_LilvPlugin_getLatencyPortIndex + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getPortByIndex + * Signature: (I)Ljlilv/LilvPort; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getPortByIndex + (JNIEnv* env, jobject obj, jint index){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getPortBySymbol + * Signature: (Ljlilv/LilvNode;)Ljlilv/LilvPort; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getPortBySymbol + (JNIEnv* env, jobject obj, jobject symbol){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getPortByDesignation + * Signature: (Ljlilv/LilvNode;Ljlilv/LilvNode;)Ljlilv/LilvPort; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getPortByDesignation + (JNIEnv* env, jobject obj, jobject portClass, jobject designation){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getProject + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getProject + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getAuthorName + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getAuthorName + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getAuthorEmail + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getAuthorEmail + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getAuthorHomepage + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getAuthorHomepage + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: isReplaced + * Signature: ()Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvPlugin_isReplaced + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPlugin + * Method: getRelated + * Signature: (Ljlilv/LilvNode;)Ljlilv/LilvCollection; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPlugin_getRelated + (JNIEnv* env, jobject obj, jobject type){ + return NULL; +} + diff --git a/src/main/jni/LilvPluginClass.cpp b/src/main/jni/LilvPluginClass.cpp new file mode 100644 index 0000000..3612c27 --- /dev/null +++ b/src/main/jni/LilvPluginClass.cpp @@ -0,0 +1,45 @@ +#include +#include + +#include +#include + +/* + * Class: jlilv_LilvPluginClass + * Method: getParentUri + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPluginClass_getParentUri + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPluginClass + * Method: getUri + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPluginClass_getUri + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPluginClass + * Method: getLabel + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPluginClass_getLabel + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPluginClass + * Method: getChildren + * Signature: ()Ljlilv/LilvCollection; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPluginClass_getChildren + (JNIEnv* env, jobject obj){ + return NULL; +} diff --git a/src/main/jni/LilvPort.cpp b/src/main/jni/LilvPort.cpp new file mode 100644 index 0000000..a8f08e4 --- /dev/null +++ b/src/main/jni/LilvPort.cpp @@ -0,0 +1,134 @@ +#include +#include + +#include +#include +/* + * Class: jlilv_LilvPort + * Method: getNode + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPort_getNode + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPort + * Method: getValue + * Signature: (Ljlilv/LilvNode;)Ljlilv/LilvCollection; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPort_getValue + (JNIEnv* env, jobject obj, jobject predicate){ + return NULL; +} + +/* + * Class: jlilv_LilvPort + * Method: get + * Signature: (Ljlilv/LilvNode;)Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPort_get + (JNIEnv* env, jobject obj, jobject predicate){ + return NULL; +} + +/* + * Class: jlilv_LilvPort + * Method: getProperties + * Signature: ()Ljlilv/LilvCollection; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPort_getProperties + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPort + * Method: hasProperty + * Signature: (Ljlilv/LilvNode;)Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvPort_hasProperty + (JNIEnv* env, jobject obj, jobject property){ + return NULL; +} + +/* + * Class: jlilv_LilvPort + * Method: supportsEvent + * Signature: (Ljlilv/LilvNode;)Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvPort_supportsEvent + (JNIEnv* env, jobject obj, jobject enventType){ + return NULL; +} + +/* + * Class: jlilv_LilvPort + * Method: getIndex + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_jlilv_LilvPort_getIndex + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPort + * Method: getSymbol + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPort_getSymbol + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPort + * Method: getName + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPort_getName + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPort + * Method: getClasses + * Signature: ()Ljlilv/LilvCollection; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPort_getClasses + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPort + * Method: isA + * Signature: (Ljlilv/LilvNode;)Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvPort_isA + (JNIEnv* env, jobject obj, jobject portClass){ + return NULL; +} + +/* + * Class: jlilv_LilvPort + * Method: getRange + * Signature: ()Ljlilv/LilvPort/PortValues; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPort_getRange + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvPort + * Method: getScalePoints + * Signature: ()Ljlilv/LilvCollection; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvPort_getScalePoints + (JNIEnv* env, jobject obj){ + return NULL; +} diff --git a/src/main/jni/LilvScalePoint.cpp b/src/main/jni/LilvScalePoint.cpp new file mode 100644 index 0000000..b0aa0b4 --- /dev/null +++ b/src/main/jni/LilvScalePoint.cpp @@ -0,0 +1,24 @@ +#include +#include + +#include +#include +/* + * Class: jlilv_LilvScalePoint + * Method: getLabel + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvScalePoint_getLabel + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvScalePoint + * Method: getValue + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvScalePoint_getValue + (JNIEnv* env, jobject obj){ + return NULL; +} diff --git a/src/main/jni/LilvState.cpp b/src/main/jni/LilvState.cpp new file mode 100644 index 0000000..1b74a2d --- /dev/null +++ b/src/main/jni/LilvState.cpp @@ -0,0 +1,114 @@ +#include +#include + +#include +#include +/* + * Class: jlilv_LilvState + * Method: free + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_jlilv_LilvState_free + (JNIEnv* env, jobject obj){ + +} + +/* + * Class: jlilv_LilvState + * Method: equals + * Signature: (Ljlilv/LilvState;)Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvState_equals + (JNIEnv* env, jobject obj, jobject other){ + return JNI_FALSE; +} + +/* + * Class: jlilv_LilvState + * Method: getNumProperties + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_jlilv_LilvState_getNumProperties + (JNIEnv* env, jobject obj){ + return 0; +} + +/* + * Class: jlilv_LilvState + * Method: getPluginUri + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvState_getPluginUri + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvState + * Method: getUri + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvState_getUri + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvState + * Method: getLabel + * Signature: ()Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_jlilv_LilvState_getLabel + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvState + * Method: setLabel + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_jlilv_LilvState_setLabel + (JNIEnv* env, jobject obj, jstring label){ + +} + +/* + * Class: jlilv_LilvState + * Method: setMetadata + * Signature: (I[BIII)I + */ +JNIEXPORT jint JNICALL Java_jlilv_LilvState_setMetadata + (JNIEnv* env, jobject obj, jint key, jbyteArray value, jint size, jint type, jint flags){ + return 0; +} + +/* + * Class: jlilv_LilvState + * Method: save + * Signature: (Ljlilv/LilvWorld;JJLjava/lang/String;Ljava/lang/String;Ljava/lang/String;)I + */ +JNIEXPORT jint JNICALL Java_jlilv_LilvState_save + (JNIEnv* env, jobject obj, jobject world, jlong mapPointer, jlong unmapPointer, jstring uri, jstring dir, jstring filename){ + return 0; +} + +/* + * Class: jlilv_LilvState + * Method: saveToString + * Signature: (Ljlilv/LilvWorld;JJLjava/lang/String;Ljava/lang/String;)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_jlilv_LilvState_saveToString + (JNIEnv* env, jobject obj, jobject world, jlong mapPointer, jlong unmapPointer, jstring uri, jstring baseUrl){ + return NULL; +} + +/* + * Class: jlilv_LilvState + * Method: delete + * Signature: (Ljlilv/LilvWorld;)I + */ +JNIEXPORT jint JNICALL Java_jlilv_LilvState_delete + (JNIEnv* env, jobject obj, jobject world){ + return 0; +} diff --git a/src/main/jni/LilvUI.cpp b/src/main/jni/LilvUI.cpp new file mode 100644 index 0000000..6a69b39 --- /dev/null +++ b/src/main/jni/LilvUI.cpp @@ -0,0 +1,55 @@ +#include +#include + +#include +#include + +/* + * Class: jlilv_LilvUI + * Method: getUri + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvUI_getUri + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvUI + * Method: getClasses + * Signature: ()Ljlilv/LilvCollection; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvUI_getClasses + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvUI + * Method: isA + * Signature: (Ljlilv/LilvNode;)Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvUI_isA + (JNIEnv* env, jobject obj, jobject classUri){ + return JNI_FALSE; +} + +/* + * Class: jlilv_LilvUI + * Method: getBundleUri + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvUI_getBundleUri + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvUI + * Method: getBinaryUri + * Signature: ()Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvUI_getBinaryUri + (JNIEnv* env, jobject obj){ + return NULL; +} diff --git a/src/main/jni/LilvWorld.cpp b/src/main/jni/LilvWorld.cpp new file mode 100644 index 0000000..7f920c7 --- /dev/null +++ b/src/main/jni/LilvWorld.cpp @@ -0,0 +1,284 @@ +#include +#include + +#include +#include +/* + * Class: jlilv_LilvWorld + * Method: lilvWorldNew + * Signature: ()Ljlilv/LilvWorld; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvWorld_lilvWorldNew + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvWorld + * Method: setOption + * Signature: (Ljava/lang/String;Ljlilv/LilvNode;)V + */ +JNIEXPORT void JNICALL Java_jlilv_LilvWorld_setOption + (JNIEnv* env, jobject obj, jstring uri, jobject value){ + +} + +/* + * Class: jlilv_LilvWorld + * Method: free + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_jlilv_LilvWorld_free + (JNIEnv* env, jobject obj){ + +} + +/* + * Class: jlilv_LilvWorld + * Method: loadAll + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_jlilv_LilvWorld_loadAll + (JNIEnv* env, jobject obj){ + +} + +/* + * Class: jlilv_LilvWorld + * Method: loadBundle + * Signature: (Ljlilv/LilvNode;)V + */ +JNIEXPORT void JNICALL Java_jlilv_LilvWorld_loadBundle + (JNIEnv* env, jobject obj, jobject bundleUri){ + +} + +/* + * Class: jlilv_LilvWorld + * Method: loadSpecifications + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_jlilv_LilvWorld_loadSpecifications + (JNIEnv* env, jobject obj){ + +} + +/* + * Class: jlilv_LilvWorld + * Method: loadPluginClasses + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_jlilv_LilvWorld_loadPluginClasses + (JNIEnv* env, jobject obj){ + +} + +/* + * Class: jlilv_LilvWorld + * Method: unloadBundle + * Signature: (Ljlilv/LilvNode;)I + */ +JNIEXPORT jint JNICALL Java_jlilv_LilvWorld_unloadBundle + (JNIEnv* env, jobject obj, jobject bundleUri){ + return 0; +} + +/* + * Class: jlilv_LilvWorld + * Method: loadResource + * Signature: (Ljlilv/LilvNode;)I + */ +JNIEXPORT jint JNICALL Java_jlilv_LilvWorld_loadResource + (JNIEnv* env, jobject obj, jobject resource){ + return 0; +} + +/* + * Class: jlilv_LilvWorld + * Method: unloadResource + * Signature: (Ljlilv/LilvNode;)I + */ +JNIEXPORT jint JNICALL Java_jlilv_LilvWorld_unloadResource + (JNIEnv* env, jobject obj, jobject resource){ + return 0; +} + +/* + * Class: jlilv_LilvWorld + * Method: getPluginClass + * Signature: ()Ljlilv/LilvPluginClass; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvWorld_getPluginClass + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvWorld + * Method: getPluginClasses + * Signature: ()Ljlilv/LilvCollection; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvWorld_getPluginClasses + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvWorld + * Method: getAllPlugins + * Signature: ()Ljlilv/LilvCollection; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvWorld_getAllPlugins + (JNIEnv* env, jobject obj){ + return NULL; +} + +/* + * Class: jlilv_LilvWorld + * Method: findNodes + * Signature: (Ljlilv/LilvNode;Ljlilv/LilvNode;Ljlilv/LilvNode;)Ljlilv/LilvCollection; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvWorld_findNodes + (JNIEnv* env, jobject obj, jobject subject, jobject predicate, jobject object){ + return NULL; +} + +/* + * Class: jlilv_LilvWorld + * Method: get + * Signature: (Ljlilv/LilvNode;Ljlilv/LilvNode;Ljlilv/LilvNode;)Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvWorld_get + (JNIEnv* env, jobject obj, jobject subject, jobject predicate, jobject object){ + return NULL; +} + +/* + * Class: jlilv_LilvWorld + * Method: ask + * Signature: (Ljlilv/LilvNode;Ljlilv/LilvNode;Ljlilv/LilvNode;)Z + */ +JNIEXPORT jboolean JNICALL Java_jlilv_LilvWorld_ask + (JNIEnv* env, jobject obj, jobject subject, jobject predicate, jobject object){ + return JNI_FALSE; +} + +/* + * Class: jlilv_LilvWorld + * Method: getSymbol + * Signature: (Ljlilv/LilvNode;)Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvWorld_getSymbol + (JNIEnv* env, jobject obj, jobject subject){ + return NULL; +} + +/* + * Class: jlilv_LilvWorld + * Method: writeDescription + * Signature: (Ljlilv/LilvPlugin;Ljlilv/LilvNode;Ljava/io/File;)V + */ +JNIEXPORT void JNICALL Java_jlilv_LilvWorld_writeDescription + (JNIEnv* env, jobject obj, jobject plugin, jobject baseUri, jobject pluginFile){ + +} + +/* + * Class: jlilv_LilvWorld + * Method: writeManifestEntry + * Signature: (Ljlilv/LilvPlugin;Ljlilv/LilvNode;Ljava/io/File;Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_jlilv_LilvWorld_writeManifestEntry + (JNIEnv* env, jobject obj, jobject plugin, jobject baseUri, jobject manifestFile, jstring pluginFilePath){ + +} + +/* + * Class: jlilv_LilvWorld + * Method: newStateFromWorld + * Signature: (JLjlilv/LilvNode;)Ljlilv/LilvState; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvWorld_newStateFromWorld + (JNIEnv* env, jobject obj, jlong mappointer, jobject node){ + return NULL; +} + +/* + * Class: jlilv_LilvWorld + * Method: newStateFromFile + * Signature: (JLjlilv/LilvNode;Ljava/lang/String;)Ljlilv/LilvState; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvWorld_newStateFromFile + (JNIEnv* env, jobject obj, jlong mappointer, jobject subject, jstring path){ + return NULL; +} + +/* + * Class: jlilv_LilvWorld + * Method: newStateFromString + * Signature: (JLjava/lang/String;)Ljlilv/LilvState; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvWorld_newStateFromString + (JNIEnv* env, jobject obj, jlong mappointer, jstring str){ + return NULL; +} + +/* + * Class: jlilv_LilvWorld + * Method: newUri + * Signature: (Ljava/lang/String;)Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvWorld_newUri + (JNIEnv* env, jobject obj, jstring uri){ + return NULL; +} + +/* + * Class: jlilv_LilvWorld + * Method: newFileUri + * Signature: (Ljava/lang/String;Ljava/lang/String;)Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvWorld_newFileUri + (JNIEnv* env, jobject obj, jstring host, jstring path){ + return NULL; +} + +/* + * Class: jlilv_LilvWorld + * Method: newString + * Signature: (Ljava/lang/String;)Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvWorld_newString + (JNIEnv* env, jobject obj, jstring str){ + return NULL; +} + +/* + * Class: jlilv_LilvWorld + * Method: newInt + * Signature: (I)Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvWorld_newInt + (JNIEnv* env, jobject obj, jint val){ + return NULL; +} + +/* + * Class: jlilv_LilvWorld + * Method: newFloat + * Signature: (F)Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvWorld_newFloat + (JNIEnv* env, jobject obj, jfloat val){ + return NULL; +} + +/* + * Class: jlilv_LilvWorld + * Method: newBool + * Signature: (Z)Ljlilv/LilvNode; + */ +JNIEXPORT jobject JNICALL Java_jlilv_LilvWorld_newBool + (JNIEnv* env, jobject obj, jboolean val){ + return NULL; +}