aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-16 22:14:20 +0000
committerDavid Robillard <d@drobilla.net>2012-03-16 22:14:20 +0000
commite6a03cf2be6f38ce6ccd960e66d7eac09061d958 (patch)
tree6813da9e7ce36dfd58b6f45843da9d7756f9e454
parent62481d1cd30c78b90747370b620b26f0dd8ebae8 (diff)
downloadlv2-e6a03cf2be6f38ce6ccd960e66d7eac09061d958.tar.xz
atom:Int32 => atom:Int, atom:Int64 => atom:Long.
-rw-r--r--lv2/lv2plug.in/ns/ext/atom/atom-test.c62
-rw-r--r--lv2/lv2plug.in/ns/ext/atom/atom.h14
-rw-r--r--lv2/lv2plug.in/ns/ext/atom/atom.ttl10
-rw-r--r--lv2/lv2plug.in/ns/ext/atom/forge.h16
4 files changed, 50 insertions, 52 deletions
diff --git a/lv2/lv2plug.in/ns/ext/atom/atom-test.c b/lv2/lv2plug.in/ns/ext/atom/atom-test.c
index c92a370..0fd1114 100644
--- a/lv2/lv2plug.in/ns/ext/atom/atom-test.c
+++ b/lv2/lv2plug.in/ns/ext/atom/atom-test.c
@@ -92,17 +92,17 @@ main()
LV2_Atom* obj = lv2_atom_forge_deref(
&forge, lv2_atom_forge_resource( &forge, &obj_frame, 0, eg_Object));
- // eg_one = (Int32)1
+ // eg_one = (Int)1
lv2_atom_forge_property_head(&forge, eg_one, 0);
- LV2_Atom_Int32* one = (LV2_Atom_Int32*)lv2_atom_forge_deref(
+ LV2_Atom_Int* one = (LV2_Atom_Int*)lv2_atom_forge_deref(
&forge, lv2_atom_forge_int32(&forge, 1));
if (one->body != 1) {
return test_fail("%d != 1\n", one->body);
}
- // eg_two = (Int64)2
+ // eg_two = (Long)2
lv2_atom_forge_property_head(&forge, eg_two, 0);
- LV2_Atom_Int64* two = (LV2_Atom_Int64*)lv2_atom_forge_deref(
+ LV2_Atom_Long* two = (LV2_Atom_Long*)lv2_atom_forge_deref(
&forge, lv2_atom_forge_int64(&forge, 2));
if (two->body != 2) {
return test_fail("%ld != 2\n", two->body);
@@ -141,27 +141,25 @@ main()
}
// eg_path = (Path)"/foo/bar"
- const uint8_t* pstr = (const uint8_t*)"/foo/bar";
- const size_t pstr_len = strlen((const char*)pstr);
+ const char* pstr = "/foo/bar";
+ const size_t pstr_len = strlen(pstr);
lv2_atom_forge_property_head(&forge, eg_path, 0);
LV2_Atom_String* path = (LV2_Atom_String*)lv2_atom_forge_deref(
&forge, lv2_atom_forge_uri(&forge, pstr, pstr_len));
- uint8_t* pbody = (uint8_t*)LV2_ATOM_BODY(path);
- if (strcmp((const char*)pbody, (const char*)pstr)) {
- return test_fail("%s != \"%s\"\n",
- (const char*)pbody, (const char*)pstr);
+ char* pbody = (char*)LV2_ATOM_BODY(path);
+ if (strcmp(pbody, pstr)) {
+ return test_fail("%s != \"%s\"\n", pbody, pstr);
}
// eg_uri = (URI)"http://example.org/value"
- const uint8_t* ustr = (const uint8_t*)"http://example.org/value";
- const size_t ustr_len = strlen((const char*)ustr);
+ const char* ustr = "http://example.org/value";
+ const size_t ustr_len = strlen(ustr);
lv2_atom_forge_property_head(&forge, eg_uri, 0);
LV2_Atom_String* uri = (LV2_Atom_String*)lv2_atom_forge_deref(
&forge, lv2_atom_forge_uri(&forge, ustr, ustr_len));
- uint8_t* ubody = (uint8_t*)LV2_ATOM_BODY(uri);
- if (strcmp((const char*)ubody, (const char*)ustr)) {
- return test_fail("%s != \"%s\"\n",
- (const char*)ubody, (const char*)ustr);
+ char* ubody = (char*)LV2_ATOM_BODY(uri);
+ if (strcmp(ubody, ustr)) {
+ return test_fail("%s != \"%s\"\n", ubody, ustr);
}
// eg_urid = (URID)"http://example.org/value"
@@ -177,21 +175,21 @@ main()
lv2_atom_forge_property_head(&forge, eg_string, 0);
LV2_Atom_String* string = (LV2_Atom_String*)lv2_atom_forge_deref(
&forge, lv2_atom_forge_string(
- &forge, (const uint8_t*)"hello", strlen("hello")));
- uint8_t* sbody = (uint8_t*)LV2_ATOM_BODY(string);
- if (strcmp((const char*)sbody, "hello")) {
- return test_fail("%s != \"hello\"\n", (const char*)sbody);
+ &forge, "hello", strlen("hello")));
+ char* sbody = LV2_ATOM_BODY(string);
+ if (strcmp(sbody, "hello")) {
+ return test_fail("%s != \"hello\"\n", sbody);
}
// eg_literal = (Literal)"hello"@fr
lv2_atom_forge_property_head(&forge, eg_literal, 0);
LV2_Atom_Literal* literal = (LV2_Atom_Literal*)lv2_atom_forge_deref(
&forge, lv2_atom_forge_literal(
- &forge, (const uint8_t*)"bonjour", strlen("bonjour"),
+ &forge, "bonjour", strlen("bonjour"),
0, urid_map(NULL, "http://lexvo.org/id/term/fr")));
- uint8_t* lbody = (uint8_t*)LV2_ATOM_CONTENTS(LV2_Atom_Literal, literal);
- if (strcmp((const char*)lbody, "bonjour")) {
- return test_fail("%s != \"bonjour\"\n", (const char*)lbody);
+ char* lbody = LV2_ATOM_CONTENTS(LV2_Atom_Literal, literal);
+ if (strcmp(lbody, "bonjour")) {
+ return test_fail("%s != \"bonjour\"\n", lbody);
}
// eg_tuple = "foo",true
@@ -201,7 +199,7 @@ main()
&forge, lv2_atom_forge_tuple(&forge, &tuple_frame));
LV2_Atom_String* tup0 = (LV2_Atom_String*)lv2_atom_forge_deref(
&forge, lv2_atom_forge_string(
- &forge, (const uint8_t*)"foo", strlen("foo")));
+ &forge, "foo", strlen("foo")));
LV2_Atom_Bool* tup1 = (LV2_Atom_Bool*)lv2_atom_forge_deref(
&forge, lv2_atom_forge_bool(&forge, true));
lv2_atom_forge_pop(&forge, &tuple_frame);
@@ -226,23 +224,23 @@ main()
return test_fail("Tuple iter is not at end\n");
}
- // eg_vector = (Vector<Int32>)1,2,3,4
+ // eg_vector = (Vector<Int>)1,2,3,4
lv2_atom_forge_property_head(&forge, eg_vector, 0);
int32_t elems[] = { 1, 2, 3, 4 };
LV2_Atom_Vector* vector = (LV2_Atom_Vector*)lv2_atom_forge_deref(
&forge, lv2_atom_forge_vector(
- &forge, sizeof(int32_t), forge.Int32, 4, elems));
+ &forge, sizeof(int32_t), forge.Int, 4, elems));
void* vec_body = LV2_ATOM_CONTENTS(LV2_Atom_Vector, vector);
if (memcmp(elems, vec_body, sizeof(elems))) {
return test_fail("Corrupt vector\n");
}
- // eg_vector2 = (Vector<Int32>)1,2,3,4
+ // eg_vector2 = (Vector<Int>)1,2,3,4
lv2_atom_forge_property_head(&forge, eg_vector2, 0);
LV2_Atom_Forge_Frame vec_frame;
LV2_Atom_Vector* vector2 = (LV2_Atom_Vector*)lv2_atom_forge_deref(
&forge, lv2_atom_forge_vector_head(
- &forge, &vec_frame, sizeof(int32_t), forge.Int32));
+ &forge, &vec_frame, sizeof(int32_t), forge.Int));
for (unsigned i = 0; i < sizeof(elems) / sizeof(int32_t); ++i) {
lv2_atom_forge_int32(&forge, elems[i]);
}
@@ -265,7 +263,7 @@ main()
lv2_atom_forge_pop(&forge, &obj_frame);
// Test equality
- LV2_Atom_Int32 itwo = { { forge.Int32, sizeof(int32_t) }, 2 };
+ LV2_Atom_Int itwo = { { forge.Int, sizeof(int32_t) }, 2 };
if (lv2_atom_equals((LV2_Atom*)one, (LV2_Atom*)two)) {
return test_fail("1 == 2.0\n");
} else if (lv2_atom_equals((LV2_Atom*)one, (LV2_Atom*)&itwo)) {
@@ -279,9 +277,9 @@ main()
LV2_Atom_Event* ev = lv2_sequence_iter_get(i);
if (ev->time.frames != n_events) {
return test_fail("Corrupt event %u has bad time\n", n_events);
- } else if (ev->body.type != forge.Int32) {
+ } else if (ev->body.type != forge.Int) {
return test_fail("Corrupt event %u has bad type\n", n_events);
- } else if (((LV2_Atom_Int32*)&ev->body)->body != (int)n_events + 1) {
+ } else if (((LV2_Atom_Int*)&ev->body)->body != (int)n_events + 1) {
return test_fail("Event %u != %d\n", n_events, n_events + 1);
}
++n_events;
diff --git a/lv2/lv2plug.in/ns/ext/atom/atom.h b/lv2/lv2plug.in/ns/ext/atom/atom.h
index 22eac5c..0887790 100644
--- a/lv2/lv2plug.in/ns/ext/atom/atom.h
+++ b/lv2/lv2plug.in/ns/ext/atom/atom.h
@@ -38,8 +38,8 @@
#define LV2_ATOM__Double LV2_ATOM_PREFIX "Double"
#define LV2_ATOM__Event LV2_ATOM_PREFIX "Event"
#define LV2_ATOM__Float LV2_ATOM_PREFIX "Float"
-#define LV2_ATOM__Int32 LV2_ATOM_PREFIX "Int32"
-#define LV2_ATOM__Int64 LV2_ATOM_PREFIX "Int64"
+#define LV2_ATOM__Int LV2_ATOM_PREFIX "Int"
+#define LV2_ATOM__Long LV2_ATOM_PREFIX "Long"
#define LV2_ATOM__Literal LV2_ATOM_PREFIX "Literal"
#define LV2_ATOM__MessagePort LV2_ATOM_PREFIX "MessagePort"
#define LV2_ATOM__Number LV2_ATOM_PREFIX "Number"
@@ -94,17 +94,17 @@ typedef struct {
uint32_t type; /**< Type of this atom (mapped URI). */
} LV2_Atom;
-/** An atom:Int32 or atom:Bool. May be cast to LV2_Atom. */
+/** An atom:Int or atom:Bool. May be cast to LV2_Atom. */
typedef struct {
LV2_Atom atom; /**< Atom header. */
int32_t body; /**< Integer value. */
-} LV2_Atom_Int32;
+} LV2_Atom_Int;
-/** An atom:Int64. May be cast to LV2_Atom. */
+/** An atom:Long. May be cast to LV2_Atom. */
typedef struct {
LV2_Atom atom; /**< Atom header. */
int64_t body; /**< Integer value. */
-} LV2_Atom_Int64;
+} LV2_Atom_Long;
/** An atom:Float. May be cast to LV2_Atom. */
typedef struct {
@@ -119,7 +119,7 @@ typedef struct {
} LV2_Atom_Double;
/** An atom:Bool. May be cast to LV2_Atom. */
-typedef LV2_Atom_Int32 LV2_Atom_Bool;
+typedef LV2_Atom_Int LV2_Atom_Bool;
/** An atom:URID. May be cast to LV2_Atom. */
typedef struct {
diff --git a/lv2/lv2plug.in/ns/ext/atom/atom.ttl b/lv2/lv2plug.in/ns/ext/atom/atom.ttl
index 9bc959f..ed52a5e 100644
--- a/lv2/lv2plug.in/ns/ext/atom/atom.ttl
+++ b/lv2/lv2plug.in/ns/ext/atom/atom.ttl
@@ -125,17 +125,17 @@ atom:Number
rdfs:subClassOf atom:Atom ;
rdfs:label "Number" .
-atom:Int32
+atom:Int
a rdfs:Class ;
rdfs:subClassOf atom:Number ;
rdfs:label "Signed 32-bit integer" ;
- atom:cType "LV2_Atom_Int32" .
+ atom:cType "LV2_Atom_Int" .
-atom:Int64
+atom:Long
a rdfs:Class ;
rdfs:subClassOf atom:Number ;
rdfs:label "Signed 64-bit integer" ;
- atom:cType "LV2_Atom_Int64" .
+ atom:cType "LV2_Atom_Long" .
atom:Float
a rdfs:Class ;
@@ -154,7 +154,7 @@ atom:Bool
rdfs:subClassOf atom:Atom ;
rdfs:label "Boolean" ;
atom:cType "LV2_Atom_Bool" ;
- rdfs:comment "An Int32 where 0 is false and any other value is true." .
+ rdfs:comment "An Int where 0 is false and any other value is true." .
atom:String
a rdfs:Class ;
diff --git a/lv2/lv2plug.in/ns/ext/atom/forge.h b/lv2/lv2plug.in/ns/ext/atom/forge.h
index a19c131..941f033 100644
--- a/lv2/lv2plug.in/ns/ext/atom/forge.h
+++ b/lv2/lv2plug.in/ns/ext/atom/forge.h
@@ -93,8 +93,8 @@ typedef struct {
LV2_URID Bool;
LV2_URID Double;
LV2_URID Float;
- LV2_URID Int32;
- LV2_URID Int64;
+ LV2_URID Int;
+ LV2_URID Long;
LV2_URID Literal;
LV2_URID Path;
LV2_URID Property;
@@ -125,8 +125,8 @@ lv2_atom_forge_init(LV2_Atom_Forge* forge, LV2_URID_Map* map)
forge->Bool = map->map(map->handle, LV2_ATOM__Bool);
forge->Double = map->map(map->handle, LV2_ATOM__Double);
forge->Float = map->map(map->handle, LV2_ATOM__Float);
- forge->Int32 = map->map(map->handle, LV2_ATOM__Int32);
- forge->Int64 = map->map(map->handle, LV2_ATOM__Int64);
+ forge->Int = map->map(map->handle, LV2_ATOM__Int);
+ forge->Long = map->map(map->handle, LV2_ATOM__Long);
forge->Literal = map->map(map->handle, LV2_ATOM__Literal);
forge->Path = map->map(map->handle, LV2_ATOM__Path);
forge->Property = map->map(map->handle, LV2_ATOM__Property);
@@ -324,19 +324,19 @@ lv2_atom_forge_primitive(LV2_Atom_Forge* forge, const LV2_Atom* a)
}
}
-/** Write an atom:Int32. */
+/** Write an atom:Int. */
static inline LV2_Atom_Forge_Ref
lv2_atom_forge_int32(LV2_Atom_Forge* forge, int32_t val)
{
- const LV2_Atom_Int32 a = { { sizeof(val), forge->Int32 }, val };
+ const LV2_Atom_Int a = { { sizeof(val), forge->Int }, val };
return lv2_atom_forge_primitive(forge, &a.atom);
}
-/** Write an atom:Int64. */
+/** Write an atom:Long. */
static inline LV2_Atom_Forge_Ref
lv2_atom_forge_int64(LV2_Atom_Forge* forge, int64_t val)
{
- const LV2_Atom_Int64 a = { { sizeof(val), forge->Int64 }, val };
+ const LV2_Atom_Long a = { { sizeof(val), forge->Long }, val };
return lv2_atom_forge_primitive(forge, &a.atom);
}