vips7 wrap runs

"vips list clases" now works, not tested actually supplying any args
This commit is contained in:
John Cupitt 2011-07-15 21:28:33 +01:00
parent a9dc321afd
commit 03226f6f67
5 changed files with 74 additions and 65 deletions

1
TODO
View File

@ -1,6 +1,5 @@
- revisit orc conv - revisit orc conv
use an 8.8 accumulator ... build the scale into the 8.8 coeffs ... no div at use an 8.8 accumulator ... build the scale into the 8.8 coeffs ... no div at

View File

@ -108,6 +108,9 @@ vips_arithmetic_class_init( VipsArithmeticClass *class )
GParamSpec *pspec; GParamSpec *pspec;
gobject_class->set_property = vips_object_set_property;
gobject_class->get_property = vips_object_get_property;
vobject_class->build = vips_arithmetic_build; vobject_class->build = vips_arithmetic_build;
pspec = g_param_spec_object( "out", "Output", pspec = g_param_spec_object( "out", "Output",

View File

@ -356,6 +356,9 @@ vips_binary_class_init( VipsBinaryClass *class )
GParamSpec *pspec; GParamSpec *pspec;
gobject_class->set_property = vips_object_set_property;
gobject_class->get_property = vips_object_get_property;
vobject_class->build = vips_binary_build; vobject_class->build = vips_binary_build;
/* Create properties. /* Create properties.

View File

@ -499,73 +499,10 @@ vips_wrap7_class_init( VipsWrap7Class *class )
GObjectClass *gobject_class = (GObjectClass *) class; GObjectClass *gobject_class = (GObjectClass *) class;
VipsObjectClass *vobject_class = (VipsObjectClass *) class; VipsObjectClass *vobject_class = (VipsObjectClass *) class;
/* The name of the vips operation we wrap is hidden in our class name.
*/
const char *name = G_OBJECT_CLASS_NAME( class ) +
strlen( VIPS_WRAP7_PREFIX );
im_function *fn = im_find_function( name );
int i;
g_assert( fn );
gobject_class->dispose = vips_wrap7_dispose; gobject_class->dispose = vips_wrap7_dispose;
gobject_class->finalize = vips_wrap7_finalize; gobject_class->finalize = vips_wrap7_finalize;
gobject_class->set_property = vips_wrap7_object_set_property;
gobject_class->get_property = vips_wrap7_object_get_property;
vobject_class->build = vips_wrap7_build; vobject_class->build = vips_wrap7_build;
vobject_class->nickname = name;
vobject_class->description = fn->desc;
class->fn = fn;
for( i = 0; i < fn->argc; i++ ) {
im_arg_desc *arg = &fn->argv[i];
im_type_desc *type = arg->desc;
im_arg_type vt = type->type;
GParamSpec *pspec;
switch( vips_wrap7_lookup_type( vt ) ) {
case VIPS_WRAP7_DOUBLEVEC:
case VIPS_WRAP7_DMASK:
case VIPS_WRAP7_IMASK:
case VIPS_WRAP7_IMAGEVEC:
case VIPS_WRAP7_INTVEC:
case VIPS_WRAP7_GVALUE:
case VIPS_WRAP7_INTERPOLATE:
case VIPS_WRAP7_DOUBLE:
case VIPS_WRAP7_INT:
case VIPS_WRAP7_COMPLEX:
case VIPS_WRAP7_STRING:
case VIPS_WRAP7_NONE:
/* Can't wrap this function. class_init can't fail, so
* set a flag to block _build().
*/
class->not_supported = TRUE;
break;
case VIPS_WRAP7_IMAGE:
pspec = g_param_spec_object( arg->name,
arg->name,
arg->name,
VIPS_TYPE_IMAGE,
G_PARAM_READWRITE );
g_object_class_install_property( gobject_class,
i, pspec );
vips_object_class_install_argument( vobject_class,
pspec,
(type->flags & IM_TYPE_OUTPUT) ?
VIPS_ARGUMENT_REQUIRED_OUTPUT :
VIPS_ARGUMENT_REQUIRED_INPUT,
i );
break;
default:
g_assert( 0 );
}
}
} }
static void static void
@ -690,6 +627,73 @@ vips_wrap7_init( VipsWrap7 *wrap7 )
static void static void
vips_wrap7_subclass_class_init( VipsWrap7Class *class ) vips_wrap7_subclass_class_init( VipsWrap7Class *class )
{ {
GObjectClass *gobject_class = (GObjectClass *) class;
VipsObjectClass *vobject_class = (VipsObjectClass *) class;
/* The name of the vips operation we wrap is hidden in our class name.
*/
const char *name = G_OBJECT_CLASS_NAME( class ) +
strlen( VIPS_WRAP7_PREFIX );
im_function *fn = im_find_function( name );
int i;
g_assert( fn );
gobject_class->set_property = vips_wrap7_object_set_property;
gobject_class->get_property = vips_wrap7_object_get_property;
vobject_class->nickname = name;
vobject_class->description = fn->desc;
class->fn = fn;
for( i = 0; i < fn->argc; i++ ) {
im_arg_desc *arg = &fn->argv[i];
im_type_desc *type = arg->desc;
im_arg_type vt = type->type;
GParamSpec *pspec;
switch( vips_wrap7_lookup_type( vt ) ) {
case VIPS_WRAP7_DOUBLEVEC:
case VIPS_WRAP7_DMASK:
case VIPS_WRAP7_IMASK:
case VIPS_WRAP7_IMAGEVEC:
case VIPS_WRAP7_INTVEC:
case VIPS_WRAP7_GVALUE:
case VIPS_WRAP7_INTERPOLATE:
case VIPS_WRAP7_DOUBLE:
case VIPS_WRAP7_INT:
case VIPS_WRAP7_COMPLEX:
case VIPS_WRAP7_STRING:
case VIPS_WRAP7_NONE:
/* Can't wrap this function. class_init can't fail, so
* set a flag to block _build().
*/
class->not_supported = TRUE;
break;
case VIPS_WRAP7_IMAGE:
pspec = g_param_spec_object( arg->name,
arg->name,
arg->name,
VIPS_TYPE_IMAGE,
G_PARAM_READWRITE );
g_object_class_install_property( gobject_class,
i + 1, pspec );
vips_object_class_install_argument( vobject_class,
pspec,
(type->flags & IM_TYPE_OUTPUT) ?
VIPS_ARGUMENT_REQUIRED_OUTPUT :
VIPS_ARGUMENT_REQUIRED_INPUT,
i );
break;
default:
g_assert( 0 );
}
}
} }
static void static void

View File

@ -70,9 +70,9 @@
*/ */
/* Need to disable these sometimes. /* Need to disable these sometimes.
*/
#undef DEBUG_FATAL #undef DEBUG_FATAL
#undef DEBUG_LEAK #undef DEBUG_LEAK
*/
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include <config.h> #include <config.h>