plugin test update, prepared for C++

This commit is contained in:
Christian Thaeter 2007-08-19 05:53:43 +02:00
parent ea0b01199f
commit 27c3451aa1
3 changed files with 46 additions and 15 deletions

View file

@ -1,5 +1,24 @@
TESTING "test plugin example code" ./test-plugin
TEST "plugin example" <<END
TEST "C plugin example" C <<END
out: opened
out: Hallo Welt!
out: Tschuess C
out: opened
out: Hello World!
out: Bye C
out: closed
out: closed
END
TEST "C++ plugin example" C++ <<END
out: opened
out: Hallo Welt!
out: Tschuess C++
out: opened
out: Hello World!
out: Bye C++
out: closed
out: closed
END

View file

@ -21,17 +21,17 @@ void hallo(void)
void tschuess(const char* m)
{
printf("Tschues %s\n", m);
printf("Tschuess %s\n", m);
}
void hello(void)
{
printf("Hello world!\n");
printf("Hello World!\n");
}
void bye(const char* m)
{
printf("bye %s\n", m);
printf("Bye %s\n", m);
}
CINELERRA_INTERFACE_IMPLEMENT(hello, 1, german, myopen, myclose,

View file

@ -1,4 +1,4 @@
#include <string.h>
#include "lib/plugin.h"
#include "hello_interface.h"
@ -9,6 +9,9 @@ main(int argc, char** argv)
{
NOBUG_INIT;
if (argc < 2)
return -1;
cinelerra_init_plugin ();
/*
we have a plugin 'hello_1' which provides us 2 hello interfaces, one for english and one for german output,
@ -17,24 +20,31 @@ main(int argc, char** argv)
TODO("macros, doing casting and typing");
CINELERRA_INTERFACE_TYPE(hello, 1)* hello_de =
(CINELERRA_INTERFACE_TYPE(hello, 1)*) cinelerra_interface_open ("example_plugin", "german_1", sizeof(CINELERRA_INTERFACE_TYPE(hello, 1)));
if( !strcmp(argv[1],"C"))
{
if (!hello_de) CINELERRA_DIE;
CINELERRA_INTERFACE_TYPE(hello, 1)* hello_de =
(CINELERRA_INTERFACE_TYPE(hello, 1)*) cinelerra_interface_open ("example_plugin", "german_1", sizeof(CINELERRA_INTERFACE_TYPE(hello, 1)));
hello_de->hello();
if (!hello_de) CINELERRA_DIE;
hello_de->hello();
hello_de->goodbye(argv[1]);
CINELERRA_INTERFACE_TYPE(hello, 1)* hello_en =
(CINELERRA_INTERFACE_TYPE(hello, 1)*) cinelerra_interface_open ("example_plugin", "english_1", sizeof(CINELERRA_INTERFACE_TYPE(hello, 1)));
CINELERRA_INTERFACE_TYPE(hello, 1)* hello_en =
(CINELERRA_INTERFACE_TYPE(hello, 1)*) cinelerra_interface_open ("example_plugin", "english_1", sizeof(CINELERRA_INTERFACE_TYPE(hello, 1)));
if (!hello_en) CINELERRA_DIE;
if (!hello_en) CINELERRA_DIE;
hello_en->hello();
hello_en->hello();
hello_en->goodbye(argv[1]);
cinelerra_interface_close (hello_en);
cinelerra_interface_close (hello_de);
cinelerra_interface_close (hello_en);
cinelerra_interface_close (hello_de);
}
if( !strcmp(argv[1],"C++"))
{
#if 0
/*
same again for a plugin written in C++
@ -44,6 +54,7 @@ main(int argc, char** argv)
if (!hello_de) CINELERRA_DIE;
hello_de->say_hello();
hello_de->say_hello();
hello_en =
@ -55,6 +66,7 @@ main(int argc, char** argv)
cinelerra_interface_close (hello_en);
cinelerra_interface_close (hello_de);
#endif
}
return 0;
}