From b29d88df3820ad01ffd0d603e77c99e058178292 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Wed, 9 Nov 2011 04:59:58 +0000 Subject: Clean up URID extension. --- ext/atom.lv2/forge.h | 8 ++++---- ext/urid.lv2/urid.h | 50 ++++++++++++++++++++++++++------------------------ ext/urid.lv2/urid.ttl | 14 +++++++------- 3 files changed, 37 insertions(+), 35 deletions(-) (limited to 'ext') diff --git a/ext/atom.lv2/forge.h b/ext/atom.lv2/forge.h index b42b384..e8f5d40 100644 --- a/ext/atom.lv2/forge.h +++ b/ext/atom.lv2/forge.h @@ -35,12 +35,12 @@ typedef struct { } LV2_Atom_Forge; static inline LV2_Atom_Forge* -lv2_atom_forge_new(LV2_URID_Mapper* mapper) +lv2_atom_forge_new(LV2_URID_Map* map) { LV2_Atom_Forge* forge = (LV2_Atom_Forge*)malloc(sizeof(LV2_Atom_Forge)); - forge->ID = mapper->map_uri(mapper->handle, LV2_ATOM_URI "#ID"); - forge->Message = mapper->map_uri(mapper->handle, LV2_ATOM_URI "#Message"); - forge->Property = mapper->map_uri(mapper->handle, LV2_ATOM_URI "#Property"); + forge->ID = map->map(map->handle, LV2_ATOM_URI "#ID"); + forge->Message = map->map(map->handle, LV2_ATOM_URI "#Message"); + forge->Property = map->map(map->handle, LV2_ATOM_URI "#Property"); return forge; } diff --git a/ext/urid.lv2/urid.h b/ext/urid.lv2/urid.h index 0a01aeb..d36d0dd 100644 --- a/ext/urid.lv2/urid.h +++ b/ext/urid.lv2/urid.h @@ -28,14 +28,14 @@ #include /** - Opaque pointer to host data for LV2_URID_Mapper. + Opaque pointer to host data for LV2_URID_Map. */ -typedef void* LV2_URID_Mapper_Handle; +typedef void* LV2_URID_Map_Handle; /** - Opaque pointer to host data for LV2_URID_Unmapper. + Opaque pointer to host data for LV2_URID_Unmap. */ -typedef void* LV2_URID_Unmapper_Handle; +typedef void* LV2_URID_Unmap_Handle; /** URI mapped to an integer. @@ -43,7 +43,7 @@ typedef void* LV2_URID_Unmapper_Handle; typedef uint32_t LV2_URID; /** - URI Mapper (http://lv2plug.in/ns/ext/urid#Mapper). + URI Map (http://lv2plug.in/ns/ext/urid#map). */ typedef struct { /** @@ -52,7 +52,7 @@ typedef struct { This MUST be passed to map_uri() whenever it is called. Otherwise, it must not be interpreted in any way. */ - LV2_URID_Mapper_Handle handle; + LV2_URID_Map_Handle handle; /** Get the numeric ID of a URI. @@ -61,9 +61,11 @@ typedef struct { This function is referentially transparent; any number of calls with the same arguments is guaranteed to return the same value over the life of a - plugin instance. However, this function is not necessarily very - fast or RT-safe: plugins SHOULD cache any IDs they might need in - performance critical situations. + plugin instance. Note, however, that several URIs MAY resolve to the + same ID if the host considers those URIs equivalent. + + This function is not necessarily very fast or RT-safe: plugins SHOULD + cache any IDs they might need in performance critical situations. The return value 0 is reserved and indicates that an ID for that URI could not be created for whatever reason. However, hosts SHOULD NOT @@ -73,39 +75,39 @@ typedef struct { @param handle Must be the callback_data member of this struct. @param uri The URI to be mapped to an integer ID. */ - LV2_URID (*map_uri)(LV2_URID_Mapper_Handle handle, - const char* uri); -} LV2_URID_Mapper; + LV2_URID (*map)(LV2_URID_Map_Handle handle, + const char* uri); +} LV2_URID_Map; /** - URI Unmapper (http://lv2plug.in/ns/ext/urid#Unmapper). + URI Unmap (http://lv2plug.in/ns/ext/urid#unmap). */ typedef struct { /** Opaque pointer to host data. - This MUST be passed to unmap_uri() whenever it is called. + This MUST be passed to unmap() whenever it is called. Otherwise, it must not be interpreted in any way. */ - LV2_URID_Unmapper_Handle handle; + LV2_URID_Unmap_Handle handle; /** Get the URI for a previously mapped numeric ID. Returns NULL if @c urid is not yet mapped. Otherwise, the corresponding URI is returned in a canonical form. This MAY not be the exact same - string that was originally passed to map_uri(), but it MUST be an - identical URI according to the URI spec. A non-NULL return for a given - @c urid will always be the same for the life of the plugin. Plugins - that intend to perform string comparison on unmapped URIs SHOULD first - canonicalise URI strings with a call to map_uri() followed by a call to - unmap_uri(). + string that was originally passed to LV2_URID_Map::map(), but it MUST be + an identical URI according to the URI syntax specification (RFC3986). A + non-NULL return for a given @c urid will always be the same for the life + of the plugin. Plugins that intend to perform string comparison on + unmapped URIs SHOULD first canonicalise URI strings with a call to + map_uri() followed by a call to unmap_uri(). @param handle Must be the callback_data member of this struct. @param urid The ID to be mapped back to the URI string. */ - const char* (*unmap_uri)(LV2_URID_Unmapper_Handle handle, - LV2_URID urid); -} LV2_URID_Unmapper; + const char* (*unmap)(LV2_URID_Unmap_Handle handle, + LV2_URID urid); +} LV2_URID_Unmap; #endif /* LV2_URID_H */ diff --git a/ext/urid.lv2/urid.ttl b/ext/urid.lv2/urid.ttl index 85af5c4..6b05071 100644 --- a/ext/urid.lv2/urid.ttl +++ b/ext/urid.lv2/urid.ttl @@ -47,21 +47,21 @@ This extension is intended as an improved and simpler replacement for the map context parameter has been found problematic. """ . -urid:Mapper +urid:map a lv2:Feature ; lv2:documentation """ A feature which is used to map URIs to integers. To support this feature, the host must pass an LV2_Feature to LV2_Descriptor::instantiate() with -URI http://lv2plug.in/ns/ext/urid#Mapper and data -pointed to an instance of LV2_URID_Mapper. +URI http://lv2plug.in/ns/ext/urid#map and data +pointed to an instance of LV2_URID_Map. """ . -urid:Unmapper +urid:unmap a lv2:Feature ; lv2:documentation """ A feature which is used to unmap URIs previously mapped to integers by -urid:Mapper. To support this feature, the host must pass an LV2_Feature to +urid:map. To support this feature, the host must pass an LV2_Feature to LV2_Descriptor::instantiate() with URI -http://lv2plug.in/ns/ext/urid#Unmapper and data pointed to an -instance of LV2_URID_Unmapper. +http://lv2plug.in/ns/ext/urid#unmap and data pointed to an +instance of LV2_URID_Unmap. """ . -- cgit v1.2.1