better vips list classes output
This commit is contained in:
parent
187212768d
commit
b41b9ac19c
11
TODO
11
TODO
@ -1,21 +1,12 @@
|
||||
- test docs
|
||||
|
||||
do polar.c
|
||||
|
||||
do we need a VipsUnary subclass for complex? needs to cast input to complex
|
||||
before it starts
|
||||
|
||||
do polar/rectangular/conjugate in it
|
||||
|
||||
or maybe have a single thing with an enum for complex ops lke this
|
||||
|
||||
|
||||
|
||||
- look at the help message from the vips-7.27 script
|
||||
|
||||
|
||||
|
||||
try
|
||||
- try
|
||||
|
||||
$ vips join
|
||||
... usage ...
|
||||
|
@ -265,7 +265,7 @@ vips_format_map( VSListMap2Fn fn, void *a, void *b )
|
||||
|
||||
formats = NULL;
|
||||
(void) vips_class_map_all( g_type_from_name( "VipsFormat" ),
|
||||
(VipsClassMap) format_add_class, (void *) &formats );
|
||||
(VipsClassMapFn) format_add_class, (void *) &formats );
|
||||
|
||||
formats = g_slist_sort( formats, (GCompareFunc) format_compare );
|
||||
result = im_slist_map2( formats, fn, a, b );
|
||||
|
@ -459,16 +459,17 @@ void vips_object_to_string( VipsObject *object, VipsBuf *buf );
|
||||
|
||||
void *vips_object_map( VipsSListMap2Fn fn, void *a, void *b );
|
||||
|
||||
typedef void *(*VipsTypeMap)( GType, void * );
|
||||
typedef void *(*VipsTypeMap2)( GType, void *, void * );
|
||||
typedef void *(*VipsClassMap)( VipsObjectClass *, void * );
|
||||
void *vips_type_map( GType base, VipsTypeMap2 fn, void *a, void *b );
|
||||
void *vips_type_map_all( GType base, VipsTypeMap fn, void *a );
|
||||
void *vips_class_map_all( GType base, VipsClassMap fn, void *a );
|
||||
int vips_class_depth( VipsObjectClass *klass );
|
||||
VipsObjectClass *vips_class_find( const char *basename, const char *nickname );
|
||||
typedef void *(*VipsTypeMapFn)( GType, void * );
|
||||
typedef void *(*VipsTypeMap2Fn)( GType, void *, void * );
|
||||
typedef void *(*VipsClassMapFn)( VipsObjectClass *, void * );
|
||||
void *vips_type_map( GType base, VipsTypeMap2Fn fn, void *a, void *b );
|
||||
void *vips_type_map_all( GType base, VipsTypeMapFn fn, void *a );
|
||||
int vips_type_depth( GType type );
|
||||
GType vips_type_find( const char *basename, const char *nickname );
|
||||
|
||||
void *vips_class_map_all( GType base, VipsClassMapFn fn, void *a );
|
||||
VipsObjectClass *vips_class_find( const char *basename, const char *nickname );
|
||||
|
||||
VipsObject **vips_object_local_array( VipsObject *parent, int n );
|
||||
|
||||
void vips_object_local_cb( VipsObject *vobject, GObject *gobject );
|
||||
|
@ -1658,7 +1658,7 @@ vips_object_map( VipsSListMap2Fn fn, void *a, void *b )
|
||||
/* Map over all a type's children.
|
||||
*/
|
||||
void *
|
||||
vips_type_map( GType base, VipsTypeMap2 fn, void *a, void *b )
|
||||
vips_type_map( GType base, VipsTypeMap2Fn fn, void *a, void *b )
|
||||
{
|
||||
GType *child;
|
||||
guint n_children;
|
||||
@ -1677,21 +1677,21 @@ vips_type_map( GType base, VipsTypeMap2 fn, void *a, void *b )
|
||||
/* Loop over all the subtypes of a base type.
|
||||
*/
|
||||
void *
|
||||
vips_type_map_all( GType base, VipsTypeMap fn, void *a )
|
||||
vips_type_map_all( GType base, VipsTypeMapFn fn, void *a )
|
||||
{
|
||||
void *result;
|
||||
|
||||
if( !(result = fn( base, a )) )
|
||||
result = vips_type_map( base,
|
||||
(VipsTypeMap2) vips_type_map_all, fn, a );
|
||||
(VipsTypeMap2Fn) vips_type_map_all, fn, a );
|
||||
|
||||
return( result );
|
||||
}
|
||||
|
||||
/* Loop over all the subclasses of a base type.
|
||||
/* Loop over all the subclasses of a base type. Non-abtract classes only.
|
||||
*/
|
||||
void *
|
||||
vips_class_map_all( GType type, VipsClassMap fn, void *a )
|
||||
vips_class_map_all( GType type, VipsClassMapFn fn, void *a )
|
||||
{
|
||||
void *result;
|
||||
|
||||
@ -1707,7 +1707,7 @@ vips_class_map_all( GType type, VipsClassMap fn, void *a )
|
||||
}
|
||||
|
||||
if( (result = vips_type_map( type,
|
||||
(VipsTypeMap2) vips_class_map_all, fn, a )) )
|
||||
(VipsTypeMap2Fn) vips_class_map_all, fn, a )) )
|
||||
return( result );
|
||||
|
||||
return( NULL );
|
||||
@ -1716,12 +1716,10 @@ vips_class_map_all( GType type, VipsClassMap fn, void *a )
|
||||
/* How deeply nested is a class ... used to indent class lists.
|
||||
*/
|
||||
int
|
||||
vips_class_depth( VipsObjectClass *class )
|
||||
vips_type_depth( GType type )
|
||||
{
|
||||
int depth;
|
||||
GType type;
|
||||
|
||||
type = G_TYPE_FROM_CLASS( class );
|
||||
depth = 0;
|
||||
while( type != VIPS_TYPE_OBJECT && (type = g_type_parent( type )) )
|
||||
depth += 1;
|
||||
@ -1761,7 +1759,7 @@ vips_class_find( const char *basename, const char *nickname )
|
||||
}
|
||||
|
||||
if( !(class = vips_class_map_all( base,
|
||||
(VipsClassMap) test_name, (void *) nickname )) ) {
|
||||
(VipsClassMapFn) test_name, (void *) nickname )) ) {
|
||||
vips_error( "VipsObject",
|
||||
_( "class \"%s\" not found" ), nickname );
|
||||
return( NULL );
|
||||
|
11
tools/vips.c
11
tools/vips.c
@ -165,14 +165,15 @@ list_function( im_function *func )
|
||||
}
|
||||
|
||||
static void *
|
||||
list_class( VipsObjectClass *class )
|
||||
list_class( GType type )
|
||||
{
|
||||
int depth = vips_class_depth( class );
|
||||
int depth = vips_type_depth( type );
|
||||
int i;
|
||||
|
||||
for( i = 0; i < depth * 2; i++ )
|
||||
printf( " " );
|
||||
vips_object_print_class( class );
|
||||
vips_object_print_class(
|
||||
VIPS_OBJECT_CLASS( g_type_class_ref( type ) ) );
|
||||
|
||||
return( NULL );
|
||||
}
|
||||
@ -183,8 +184,8 @@ print_list( int argc, char **argv )
|
||||
if( !argv[0] || strcmp( argv[0], "packages" ) == 0 )
|
||||
im_map_packages( (VSListMap2Fn) list_package, NULL );
|
||||
else if( strcmp( argv[0], "classes" ) == 0 )
|
||||
vips_class_map_all( g_type_from_name( "VipsObject" ),
|
||||
(VipsClassMap) list_class, NULL );
|
||||
vips_type_map_all( g_type_from_name( "VipsObject" ),
|
||||
(VipsTypeMapFn) list_class, NULL );
|
||||
else {
|
||||
if( map_name( argv[0], list_function ) )
|
||||
error_exit( "unknown package \"%s\"", argv[0] );
|
||||
|
Loading…
Reference in New Issue
Block a user