1 /* Decls for class.c
2  */
3 
4 /*
5 
6     Copyright (C) 1991-2003 The National Gallery
7 
8     This program is free software; you can redistribute it and/or modify
9     it under the terms of the GNU General Public License as published by
10     the Free Software Foundation; either version 2 of the License, or
11     (at your option) any later version.
12 
13     This program is distributed in the hope that it will be useful,
14     but WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16     GNU General Public License for more details.
17 
18     You should have received a copy of the GNU General Public License along
19     with this program; if not, write to the Free Software Foundation, Inc.,
20     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21 
22  */
23 
24 /*
25 
26     These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
27 
28  */
29 
30 /* The builtin member names we know about.
31  */
32 #define MEMBER_BANDS "bands"
33 #define MEMBER_CAPTION "caption"
34 #define MEMBER_XCAPTION "xcaption"
35 #define MEMBER_YCAPTION "ycaption"
36 #define MEMBER_SERIES_CAPTIONS "series_captions"
37 #define MEMBER_DISPLAY "display"
38 #define MEMBER_CHECK "check"
39 #define MEMBER_FILENAME "filename"
40 #define MEMBER_FORMAT "format"
41 #define MEMBER_FROM "from"
42 #define MEMBER_HEIGHT "height"
43 #define MEMBER_LABELS "labels"
44 #define MEMBER_NAME "name"
45 #define MEMBER_OFFSET "offset"
46 #define MEMBER_SCALE "scale"
47 #define MEMBER_SUPER "super"
48 #define MEMBER_THIS "this"
49 #define MEMBER_TO "to"
50 #define MEMBER_VALUE "value"
51 #define MEMBER_WIDTH "width"
52 #define MEMBER_LEFT "left"
53 #define MEMBER_TOP "top"
54 #define MEMBER_IMAGE "image"
55 #define MEMBER_OO_BINARY "oo_binary"
56 #define MEMBER_OO_BINARY2 "oo_binary'"
57 #define MEMBER_OO_UNARY "oo_unary"
58 #define MEMBER_COLOUR_SPACE "colour_space"
59 #define MEMBER_EXPR "expr"
60 #define MEMBER_INTERVAL "interval"
61 #define MEMBER_OPTIONS "options"
62 
63 #define MEMBER_VISLEVEL "_vislevel"
64 #define MEMBER_ACTION "action"
65 #define MEMBER_LABEL "label"
66 #define MEMBER_ICON "icon"
67 #define MEMBER_TOOLTIP "tooltip"
68 
69 /* The class names we know about.
70  */
71 #define CLASS_SLIDER "Scale"
72 #define CLASS_TOGGLE "Toggle"
73 #define CLASS_IMAGE "Image"
74 #define CLASS_COLOUR "Colour"
75 #define CLASS_NUMBER "Number"
76 #define CLASS_STRING "String"
77 #define CLASS_OPTION "Option"
78 #define CLASS_MATRIX "Matrix_vips"
79 #define CLASS_ARROW "Arrow"
80 #define CLASS_REGION "Region"
81 #define CLASS_AREA "Area"
82 #define CLASS_HGUIDE "HGuide"
83 #define CLASS_VGUIDE "VGuide"
84 #define CLASS_MARK "Mark"
85 #define CLASS_POINT "Point"
86 #define CLASS_PATHNAME "Pathname"
87 #define CLASS_FONTNAME "Fontname"
88 #define CLASS_SEPARATOR "Separator"
89 #define CLASS_GROUP "Group"
90 #define CLASS_LIST "List"
91 #define CLASS_MENU "Menu"
92 #define CLASS_MENUITEM "Menuitem"
93 #define CLASS_MENUACTION "Menuaction"
94 #define CLASS_MENUPULLRIGHT "Menupullright"
95 #define CLASS_MENUSEPARATOR "Menuseparator"
96 #define CLASS_EXPRESSION "Expression"
97 #define CLASS_CLOCK "Clock"
98 #define CLASS_REAL "Real"
99 #define CLASS_VECTOR "Vector"
100 #define CLASS_PLOT "Plot"
101 
102 /* What we loop over a class instance with.
103  */
104 typedef void *(*class_map_fn)( Symbol *, PElement *, void *, void * );
105 
106 Compile *class_get_compile( PElement *instance );
107 gboolean class_get_super( PElement *instance, PElement *out );
108 void *class_map( PElement *instance, class_map_fn fn, void *a, void *b );
109 gboolean class_get_member( PElement *instance, const char *name,
110 	Symbol **sym_out, PElement *value );
111 gboolean class_get_symbol( PElement *class, Symbol *sym, PElement *out );
112 gboolean class_get_exact( PElement *instance, const char *name, PElement *out );
113 
114 gboolean class_new_super( Heap *heap,
115 	Compile *compile, PElement *this, PElement *instance );
116 gboolean class_new( Heap *heap,
117 	Compile *compile, HeapNode **args, PElement *out );
118 gboolean class_clone( Heap *heap, PElement *class, PElement *out );
119 gboolean class_clone_args( Heap *heap, PElement *klass, PElement *out );
120 gboolean class_newv( Heap *heap, const char *name, PElement *out, ... );
121 
122 gboolean class_get_member_real( PElement *klass, const char *name,
123 	double *out );
124 gboolean class_get_member_int( PElement *instance, const char *name,
125 	int *out );
126 gboolean class_get_member_bool( PElement *klass, const char *name,
127 	gboolean *out );
128 gboolean class_get_member_image( PElement *instance, const char *name,
129 	Imageinfo **out );
130 gboolean class_get_member_class( PElement *instance, const char *name,
131 	const char *type, PElement *out );
132 gboolean class_get_member_lstring( PElement *instance, const char *name,
133 	GSList **labels );
134 gboolean class_get_member_string( PElement *klass, const char *name,
135 	char *buf, int sz );
136 gboolean class_get_member_instance( PElement *instance, const char *name,
137 	const char *klass, PElement *out );
138 gboolean class_get_member_matrix_size( PElement *instance, const char *name,
139 	int *xsize, int *ysize );
140 gboolean class_get_member_matrix( PElement *instance, const char *name,
141 	double *buf, int n, int *xsize, int *ysize );
142 gboolean class_get_member_realvec( PElement *instance, const char *name,
143 	double *buf, int n, int *length );
144