1 /**************************************************/
2 /*! Stuff to make DLLs work as plugins on CYGWIN. */
3 /**************************************************/
4 
5 #ifdef CYGWIN   /**** only use this stuff in CYGWIN ****/
6 
7 #include "mri_render.h"
8 #include "mcw_graf.h"
9 #include "parser.h"
10 
11 #ifdef BG_INSIDE_AFNI  /*--- this stuff is actuated in AFNI itself ---*/
12 
13 #define NUM_BG_array (sizeof(BG_array)/sizeof(void *))
14 
15 static void *BG_array[] = {        /* Array of pointers to functions */
16     (void *)AFNI_add_interruptable ,       /* and data inside AFNI that some */
17     (void *)AFNI_can_transform_vector ,    /* plugin needs to do its job.    */
18     (void *)AFNI_controller_index ,        /* If you add something here, be  */
19     (void *)AFNI_controller_label ,        /* sure to add it in the stuff    */
20     (void *)AFNI_force_adoption ,          /* below, as well.                */
21     (void *)AFNI_hintize_pbar ,
22     (void *)AFNI_initialize_view ,
23     (void *)AFNI_jumpto_dicom ,
24     (void *)AFNI_make_descendants ,
25     (void *)AFNI_modify_viewing ,
26     (void *)AFNI_needs_dset_ijk ,
27     (void *)AFNI_palette_label_CB ,
28     (void *)AFNI_process_drawnotice ,
29     (void *)AFNI_process_interrupts ,
30     (void *)AFNI_purge_unused_dsets ,
31     (void *)AFNI_range_rotate_av_CB ,
32     (void *)AFNI_receive_control ,
33     (void *)AFNI_receive_init ,
34     (void *)AFNI_register_nD_function ,
35     (void *)AFNI_set_cursor ,
36     (void *)AFNI_transform_vector ,
37     (void *)AV_assign_fval ,
38     (void *)AV_assign_ival ,
39     (void *)AV_colsize ,
40     (void *)AV_format_fval ,
41     (void *)AV_fval_to_char ,
42     (void *)DC_rgb_to_ovrgb ,
43     (void *)DC_yokify ,
44     (void *)ENV_add_numeric ,
45     (void *)GRAF_get_setup ,
46     (void *)GRAF_put_setup ,
47     (void *)MCW_action_area ,
48     (void *)MCW_alter_widget_cursor ,
49     (void *)MCW_av_substring_CB ,
50     (void *)MCW_choose_integer ,
51     (void *)MCW_choose_ovcolor ,
52     (void *)MCW_choose_string ,
53     (void *)MCW_choose_strlist ,
54     (void *)MCW_expose_widget ,
55     (void *)MCW_histo_bytes ,
56     (void *)MCW_invert_widget ,
57     (void *)MCW_pbar_to_mri ,
58     (void *)MCW_popdown_meter ,
59     (void *)MCW_popup_message ,
60     (void *)MCW_popup_meter ,
61     (void *)MCW_reghelp_children ,
62     (void *)MCW_reghint_children ,
63     (void *)MCW_register_help ,
64     (void *)MCW_register_hint ,
65     (void *)MCW_set_bbox ,
66     (void *)MCW_set_meter ,
67     (void *)MCW_set_widget_label ,
68     (void *)MCW_val_bbox ,
69     (void *)MCW_widget_geom ,
70     (void *)PARSER_evaluate_one ,
71     (void *)PARSER_evaluate_vector ,
72     (void *)PARSER_generate_code ,
73     (void *)PCOR_get_coef ,
74     (void *)PCOR_get_pcor ,
75     (void *)PCOR_update_float ,
76     (void *)PLUTO_4D_to_typed_fim ,
77     (void *)PLUTO_add_dset ,
78     (void *)PLUTO_add_hint ,
79     (void *)PLUTO_beep ,
80     (void *)PLUTO_commandstring ,
81     (void *)PLUTO_copy_dset ,
82     (void *)PLUTO_cpu_time ,
83     (void *)PLUTO_dset_redisplay ,
84     (void *)PLUTO_dset_redisplay_mode ,
85     (void *)PLUTO_elapsed_time ,
86     (void *)PLUTO_find_dset ,
87     (void *)PLUTO_fixup_names ,
88     (void *)PLUTO_force_redisplay ,
89     (void *)PLUTO_histoplot ,
90     (void *)PLUTO_imseq_addto ,
91     (void *)PLUTO_imseq_popim ,
92     (void *)PLUTO_imseq_rekill ,
93     (void *)PLUTO_imseq_retitle ,
94     (void *)PLUTO_popdown_meter ,
95     (void *)PLUTO_popup_dset_chooser ,
96     (void *)PLUTO_popup_meter ,
97     (void *)PLUTO_popup_worker ,
98     (void *)PLUTO_prefix_ok ,
99     (void *)PLUTO_register_timeout ,
100     (void *)PLUTO_register_timeseries ,
101     (void *)PLUTO_register_workproc ,
102     (void *)PLUTO_report ,
103     (void *)PLUTO_scatterplot ,
104     (void *)PLUTO_set_butcolor ,
105     (void *)PLUTO_set_meter ,
106     (void *)PLUTO_set_sequence ,
107     (void *)PLUTO_set_topshell ,
108     (void *)PLUTO_string_index ,
109     (void *)PLUTO_turnoff_options ,
110     (void *)RWC_visibilize_CB ,
111     (void *)RWC_visibilize_widget ,
112     (void *)TTRR_get_params ,
113     (void *)add_dataset_to_PLUGIN_interface ,
114     (void *)add_number_to_PLUGIN_interface ,
115     (void *)add_option_to_PLUGIN_interface ,
116     (void *)add_string_to_PLUGIN_interface ,
117     (void *)add_timeseries_to_PLUGIN_interface ,
118     (void *)alter_MCW_pbar ,
119     (void *)alter_PLUGIN_strval_width ,
120     (void *)drive_MCW_grapher ,
121     (void *)drive_MCW_imseq ,
122     (void *)free_PCOR_references ,
123     (void *)free_PCOR_voxel_corr ,
124     (void *)get_PLUGIN_strval ,
125     (void *)get_idcode_from_PLUGIN_interface ,
126     (void *)get_number_from_PLUGIN_interface ,
127     (void *)get_optiontag_from_PLUGIN_interface ,
128     (void *)get_string_from_PLUGIN_interface ,
129     (void *)get_timeseries_from_PLUGIN_interface ,
130     (void *)load_PBAR_palette_array ,
131     (void *)make_PLUGIN_dataset_link ,
132     (void *)new_MCW_arrowval ,
133     (void *)new_MCW_bbox ,
134     (void *)new_MCW_colormenu ,
135     (void *)new_MCW_graf ,
136     (void *)new_MCW_optmenu ,
137     (void *)new_MCW_pasgraf ,
138     (void *)new_MCW_pbar ,
139     (void *)new_MCW_textwin ,
140     (void *)new_PCOR_references ,
141     (void *)new_PCOR_voxel_corr ,
142     (void *)new_PLUGIN_interface_1999 ,
143     (void *)new_PLUGIN_strval ,
144     (void *)open_MCW_imseq ,
145     (void *)peek_optiontag_from_PLUGIN_interface ,
146     (void *)redraw_MCW_pasgraf ,
147     (void *)refit_MCW_optmenu ,
148     (void *)set_MCW_pasgraf ,
149     (void *)update_MCW_pbar ,
150     (void *)update_PCOR_references ,
151     (void *)THD_coorder_fill ,
152 
153     (void *)&GLOBAL_library ,           /* AFNI global data */
154     (void *)&GLOBAL_argopt ,
155     (void *)&afni48_pixmap ,
156     (void *)&afni48_good ,
157     (void *) TTO_list ,                 /* note: no '&' */
158 NULL } ;
159 
160 /** Send the array of pointers from AFNI to a plugin **/
161 
BG_array_send(DYNAMIC_handle handle)162 static int BG_array_send( DYNAMIC_handle handle )
163 {
164    void (*BG_array_receive)() ;
165 
166    DYNAMIC_SYMBOL( handle , "BG_array_receive" , BG_array_receive ) ;
167    if( BG_array_receive == NULL ){
168      fprintf(stderr,"CYGWIN-ize: can't find symbol BG_array_receive()\n") ;
169      return -1 ;
170    }
171 
172    BG_array_receive( NUM_BG_array , BG_array ) ;
173    return 0 ;
174 }
175 
176 #else                  /*--- this stuff is actuated in each plugin ---*/
177 
178 /**** Variables to mask the AFNI global functions called from plugins. ****/
179 
180 static RwcBoolean (*BG_drive_MCW_grapher)( MCW_grapher * , int , XtPointer ) ;
181 static RwcBoolean (*BG_drive_MCW_imseq)( MCW_imseq * , int , XtPointer ) ;
182 static MCW_arrowval * (*BG_new_MCW_arrowval)( Widget , char * , int,int,int,int,int,int , gen_func * , XtPointer , str_func * , XtPointer ) ;
183 static MCW_arrowval * (*BG_new_MCW_colormenu)( Widget , char * label , MCW_DC * , int , int , int , gen_func * , XtPointer ) ;
184 static MCW_arrowval * (*BG_new_MCW_optmenu)( Widget , char * , int,int,int,int, gen_func * , XtPointer , str_func * , XtPointer ) ;
185 static MCW_bbox * (*BG_new_MCW_bbox)( Widget , int , char * lab[] , int , int , XtCallbackProc , XtPointer ) ;
186 static MCW_graf * (*BG_new_MCW_graf)( Widget wpar , MCW_DC * , char * title , gen_func * cbfunc , void * cbdata ) ;
187 static MCW_idcode * (*BG_get_idcode_from_PLUGIN_interface)( PLUGIN_interface * ) ;
188 static MCW_imseq * (*BG_open_MCW_imseq)( MCW_DC * , get_ptr , XtPointer ) ;
189 static MCW_pasgraf * (*BG_new_MCW_pasgraf)( Widget wpar , MCW_DC * dc , char * title ) ;
190 static MCW_pbar * (*BG_new_MCW_pbar)( Widget , MCW_DC * , int,int , float,float , gen_func * , XtPointer ) ;
191 static MCW_textwin * (*BG_new_MCW_textwin)( Widget, char *, int ) ;
192 static MRI_IMAGE * (*BG_MCW_pbar_to_mri)( MCW_pbar *,int,int ) ;
193 static MRI_IMAGE * (*BG_get_timeseries_from_PLUGIN_interface)( PLUGIN_interface * ) ;
194 static PARSER_code * (*BG_PARSER_generate_code)( char * ) ;
195 static PCOR_references * (*BG_new_PCOR_references)(int) ;
196 static PCOR_voxel_corr * (*BG_new_PCOR_voxel_corr)(int,int) ;
197 static PLUGIN_interface * (*BG_new_PLUGIN_interface_1999)( char *, char *, char *, int, cptr_func * , char * ) ;
198 static PLUGIN_strval * (*BG_new_PLUGIN_strval)( Widget , char * ) ;
199 static THD_3dim_dataset * (*BG_PLUTO_4D_to_typed_fim)( THD_3dim_dataset * old_dset , char * new_prefix , int new_datum , int ignore , int detrend , generic_func * user_func , void * user_data ) ;
200 static THD_3dim_dataset * (*BG_PLUTO_copy_dset)( THD_3dim_dataset *, char * ) ;
201 static THD_3dim_dataset * (*BG_PLUTO_find_dset)( MCW_idcode * ) ;
202 static THD_fvec3 (*BG_AFNI_transform_vector)( THD_3dim_dataset * , THD_fvec3 , THD_3dim_dataset * ) ;
203 static TTRR_params * (*BG_TTRR_get_params)(void) ;
204 static Widget (*BG_MCW_action_area)( Widget , MCW_action_item * , int ) ;
205 static Widget (*BG_MCW_popup_message)( Widget , char * , int ) ;
206 static Widget (*BG_MCW_popup_meter)( Widget , int ) ;
207 static char * (*BG_AFNI_controller_label)( Three_D_View * im3d );
208 static char * (*BG_AFNI_palette_label_CB)( MCW_arrowval * , XtPointer ) ;
209 static char * (*BG_AV_format_fval)( float ) ;
210 static char * (*BG_MCW_av_substring_CB)( MCW_arrowval * , XtPointer ) ;
211 static char * (*BG_PLUTO_commandstring)( PLUGIN_interface * plint ) ;
212 static char * (*BG_get_PLUGIN_strval)( PLUGIN_strval * ) ;
213 static char * (*BG_get_optiontag_from_PLUGIN_interface)( PLUGIN_interface * ) ;
214 static char * (*BG_get_string_from_PLUGIN_interface)( PLUGIN_interface * ) ;
215 static char * (*BG_peek_optiontag_from_PLUGIN_interface)( PLUGIN_interface * ) ;
216 static double (*BG_PARSER_evaluate_one)( PARSER_code *, double atoz[] ) ;
217 static double (*BG_PLUTO_cpu_time)(void) ;
218 static double (*BG_PLUTO_elapsed_time)(void) ;
219 static float  (*BG_get_number_from_PLUGIN_interface)( PLUGIN_interface * ) ;
220 static int  (*BG_AFNI_jumpto_dicom)( Three_D_View * , float, float, float  ) ;
221 static int  (*BG_AFNI_needs_dset_ijk)(void) ;
222 static int  (*BG_MCW_val_bbox)( MCW_bbox * ) ;
223 static int (*BG_AFNI_can_transform_vector)( THD_3dim_dataset *, THD_3dim_dataset * );
224 static int (*BG_AFNI_controller_index)( Three_D_View * ) ;
225 static int (*BG_AFNI_receive_control)( Three_D_View *, int,int, void * ) ;
226 static int (*BG_AFNI_receive_init)( Three_D_View *, int, gen_func * , void * ) ;
227 static int (*BG_AV_colsize)() ;
228 static int (*BG_PLUTO_add_dset)( PLUGIN_interface *, THD_3dim_dataset *, int ) ;
229 static int (*BG_PLUTO_prefix_ok)( char * ) ;
230 static int (*BG_PLUTO_string_index)( char * , int , char ** ) ;
231 static void   (*BG_MCW_choose_integer)( Widget , char * , int,int,int , gen_func *, XtPointer );
232 static void   (*BG_MCW_choose_ovcolor)( Widget , MCW_DC * , int , gen_func * , XtPointer ) ;
233 static void   (*BG_MCW_choose_string)( Widget, char *, char *, gen_func *, XtPointer );
234 static void   (*BG_MCW_choose_strlist)( Widget, char *, int, int, char * strlist[], gen_func *, XtPointer );
235 static void   (*BG_PLUTO_imseq_addto)( void * , MRI_IMAGE * ) ;
236 static void   (*BG_PLUTO_imseq_rekill)( void *, generic_func *, void * ) ;
237 static void   (*BG_PLUTO_imseq_retitle)( void * , char * ) ;
238 static void * (*BG_PLUTO_imseq_popim)( MRI_IMAGE *, generic_func *, void * ) ;
239 static void (*BG_AFNI_add_interruptable)( Widget ) ;
240 static void (*BG_AFNI_force_adoption)( THD_session * , RwcBoolean ) ;
241 static void (*BG_AFNI_hintize_pbar)( MCW_pbar * ,  float ) ;
242 static void (*BG_AFNI_initialize_view)( THD_3dim_dataset * , Three_D_View * ) ;
243 static void (*BG_AFNI_make_descendants)( THD_sessionlist * ) ;
244 static void (*BG_AFNI_modify_viewing)( Three_D_View * , RwcBoolean ) ;
245 static void (*BG_AFNI_process_drawnotice)( Three_D_View * ) ;
246 static void (*BG_AFNI_process_interrupts)( Widget ) ;
247 static void (*BG_AFNI_purge_unused_dsets)(void) ;
248 static void (*BG_AFNI_range_rotate_av_CB)( MCW_arrowval *, XtPointer );
249 static void (*BG_AFNI_register_nD_function)( int , char * , generic_func * , int ) ;
250 static void (*BG_AFNI_set_cursor)( int ) ;
251 static void (*BG_AV_assign_fval)( MCW_arrowval * , float ) ;
252 static void (*BG_AV_assign_ival)( MCW_arrowval * , int ) ;
253 static void (*BG_AV_fval_to_char)( float , char * ) ;
254 static void (*BG_DC_rgb_to_ovrgb)( MCW_DC *, int,int *,int,byte *, byte *, byte *) ;
255 static void (*BG_DC_yokify)( Widget , MCW_DC * ) ;
256 static void (*BG_ENV_add_numeric)( char * , char * , int , int , int , int , generic_func * ) ;
257 static void (*BG_GRAF_get_setup)( MCW_graf * , int * , int * , int * , int * ) ;
258 static void (*BG_GRAF_put_setup)( MCW_graf * , int   , int * , int * , int   ) ;
259 static void (*BG_MCW_alter_widget_cursor)( Widget,int , char * , char * ) ;
260 static void (*BG_MCW_expose_widget)( Widget ) ;
261 static void (*BG_MCW_histo_bytes)( int nb , byte * bar , int * har ) ;
262 static void (*BG_MCW_invert_widget)( Widget ) ;
263 static void (*BG_MCW_popdown_meter)( Widget ) ;
264 static void (*BG_MCW_reghelp_children)( Widget , char * ) ;
265 static void (*BG_MCW_reghint_children)( Widget , char * ) ;
266 static void (*BG_MCW_register_help)( Widget , char * ) ;
267 static void (*BG_MCW_register_hint)( Widget , char * ) ;
268 static void (*BG_MCW_set_bbox)( MCW_bbox * , int ) ;
269 static void (*BG_MCW_set_meter)( Widget , int ) ;
270 static void (*BG_MCW_set_widget_label)( Widget , char * ) ;
271 static void (*BG_MCW_widget_geom)( Widget , int * , int * , int * , int * ) ;
272 static void (*BG_PARSER_evaluate_vector)( PARSER_code * pc, double  * atoz[], int nv, double vout[] ) ;
273 static void (*BG_PCOR_get_coef)(PCOR_references *, PCOR_voxel_corr *, float *) ;
274 static void (*BG_PCOR_get_pcor)(PCOR_references *, PCOR_voxel_corr *, float *) ;
275 static void (*BG_PCOR_update_float)( float * , PCOR_references * , PCOR_voxel_corr * ) ;
276 static void (*BG_PLUTO_add_hint)( PLUGIN_interface * , char * ) ;
277 static void (*BG_PLUTO_beep)(void) ;
278 static void (*BG_PLUTO_dset_redisplay)( THD_3dim_dataset * ) ;
279 static void (*BG_PLUTO_dset_redisplay_mode)( THD_3dim_dataset * , int ) ;
280 static void (*BG_PLUTO_fixup_names)(void) ;
281 static void (*BG_PLUTO_force_redisplay)( void ) ;
282 static void (*BG_PLUTO_histoplot)( int, float, float, int *, char *, char *, char * , int,int ** ) ;
283 static void (*BG_PLUTO_popdown_meter)( PLUGIN_interface * ) ;
284 static void (*BG_PLUTO_popup_dset_chooser)( Widget, int, int, int_func *, void_func *, void * ) ;
285 static void (*BG_PLUTO_popup_meter)( PLUGIN_interface * ) ;
286 static void (*BG_PLUTO_popup_worker)( PLUGIN_interface * , char * , int ) ;
287 static void (*BG_PLUTO_register_timeout)( int, generic_func *, XtPointer ) ;
288 static void (*BG_PLUTO_register_timeseries)( char * , MRI_IMAGE * ) ;
289 static void (*BG_PLUTO_register_workproc)( XtWorkProc , XtPointer ) ;
290 static void (*BG_PLUTO_report)( PLUGIN_interface * , char * ) ;
291 static void (*BG_PLUTO_scatterplot)( int , float *, float *, char *, char *, char *,float,float ) ;
292 static void (*BG_PLUTO_set_butcolor)( PLUGIN_interface *, char * ) ;
293 static void (*BG_PLUTO_set_meter)( PLUGIN_interface * , int ) ;
294 static void (*BG_PLUTO_set_sequence)( PLUGIN_interface *, char * ) ;
295 static void (*BG_PLUTO_set_topshell)( PLUGIN_interface *, Widget ) ;
296 static void (*BG_PLUTO_turnoff_options)( PLUGIN_interface * ) ;
297 static void (*BG_RWC_visibilize_CB)( Widget , XtPointer , XtPointer ) ;
298 static void (*BG_RWC_visibilize_widget)( Widget ) ;
299 static void (*BG_add_dataset_to_PLUGIN_interface)( PLUGIN_interface *, char *, int,int,int ) ;
300 static void (*BG_add_number_to_PLUGIN_interface)( PLUGIN_interface *, char *, int, int, int, int, int ) ;
301 static void (*BG_add_option_to_PLUGIN_interface)( PLUGIN_interface *, char *, char *, int ) ;
302 static void (*BG_add_string_to_PLUGIN_interface)( PLUGIN_interface *, char *, int, char **, int) ;
303 static void (*BG_add_timeseries_to_PLUGIN_interface)( PLUGIN_interface *, char * ) ;
304 static void (*BG_alter_MCW_pbar)( MCW_pbar * , int , float * ) ;
305 static void (*BG_alter_PLUGIN_strval_width)( PLUGIN_strval * , int ) ;
306 static void (*BG_free_PCOR_references)(PCOR_references *) ;
307 static void (*BG_free_PCOR_voxel_corr)(PCOR_voxel_corr *) ;
308 static void (*BG_load_PBAR_palette_array)( MCW_pbar * , PBAR_palette_array * , int ) ;
309 static void (*BG_make_PLUGIN_dataset_link)( THD_3dim_dataset *, PLUGIN_dataset_link * ) ;
310 static void (*BG_redraw_MCW_pasgraf)( MCW_pasgraf * gp ) ;
311 static void (*BG_refit_MCW_optmenu)( MCW_arrowval * , int,int,int,int, str_func * , XtPointer ) ;
312 static void (*BG_set_MCW_pasgraf)( MCW_pasgraf * gp , byte * func ) ;
313 static void (*BG_update_MCW_pbar)( MCW_pbar * ) ;
314 static void (*BG_update_PCOR_references)(float *,PCOR_references *) ;
315 static void (*BG_THD_coorder_fill)( char * , THD_coorder * ) ;
316 
317 static AFNI_library_type *BG_GLOBAL_library ;    /* AFNI global data */
318 static AF_options *BG_GLOBAL_argopt ;
319 static Pixmap *BG_afni48_pixmap ;
320 static int *BG_afni48_good ;
321 static TTO_point *BG_TTO_list ;
322 
323 #define NUM_BG_array (sizeof(BG_array)/sizeof(void *))
324 
325 static void **BG_array[] = {
326     (void **) &BG_AFNI_add_interruptable ,       /* AFNI global funcs */
327     (void **) &BG_AFNI_can_transform_vector ,
328     (void **) &BG_AFNI_controller_index ,
329     (void **) &BG_AFNI_controller_label ,
330     (void **) &BG_AFNI_force_adoption ,
331     (void **) &BG_AFNI_hintize_pbar ,
332     (void **) &BG_AFNI_initialize_view ,
333     (void **) &BG_AFNI_jumpto_dicom ,
334     (void **) &BG_AFNI_make_descendants ,
335     (void **) &BG_AFNI_modify_viewing ,
336     (void **) &BG_AFNI_needs_dset_ijk ,
337     (void **) &BG_AFNI_palette_label_CB ,
338     (void **) &BG_AFNI_process_drawnotice ,
339     (void **) &BG_AFNI_process_interrupts ,
340     (void **) &BG_AFNI_purge_unused_dsets ,
341     (void **) &BG_AFNI_range_rotate_av_CB ,
342     (void **) &BG_AFNI_receive_control ,
343     (void **) &BG_AFNI_receive_init ,
344     (void **) &BG_AFNI_register_nD_function ,
345     (void **) &BG_AFNI_set_cursor ,
346     (void **) &BG_AFNI_transform_vector ,
347     (void **) &BG_AV_assign_fval ,
348     (void **) &BG_AV_assign_ival ,
349     (void **) &BG_AV_colsize ,
350     (void **) &BG_AV_format_fval ,
351     (void **) &BG_AV_fval_to_char ,
352     (void **) &BG_DC_rgb_to_ovrgb ,
353     (void **) &BG_DC_yokify ,
354     (void **) &BG_ENV_add_numeric ,
355     (void **) &BG_GRAF_get_setup ,
356     (void **) &BG_GRAF_put_setup ,
357     (void **) &BG_MCW_action_area ,
358     (void **) &BG_MCW_alter_widget_cursor ,
359     (void **) &BG_MCW_av_substring_CB ,
360     (void **) &BG_MCW_choose_integer ,
361     (void **) &BG_MCW_choose_ovcolor ,
362     (void **) &BG_MCW_choose_string ,
363     (void **) &BG_MCW_choose_strlist ,
364     (void **) &BG_MCW_expose_widget ,
365     (void **) &BG_MCW_histo_bytes ,
366     (void **) &BG_MCW_invert_widget ,
367     (void **) &BG_MCW_pbar_to_mri ,
368     (void **) &BG_MCW_popdown_meter ,
369     (void **) &BG_MCW_popup_message ,
370     (void **) &BG_MCW_popup_meter ,
371     (void **) &BG_MCW_reghelp_children ,
372     (void **) &BG_MCW_reghint_children ,
373     (void **) &BG_MCW_register_help ,
374     (void **) &BG_MCW_register_hint ,
375     (void **) &BG_MCW_set_bbox ,
376     (void **) &BG_MCW_set_meter ,
377     (void **) &BG_MCW_set_widget_label ,
378     (void **) &BG_MCW_val_bbox ,
379     (void **) &BG_MCW_widget_geom ,
380     (void **) &BG_PARSER_evaluate_one ,
381     (void **) &BG_PARSER_evaluate_vector ,
382     (void **) &BG_PARSER_generate_code ,
383     (void **) &BG_PCOR_get_coef ,
384     (void **) &BG_PCOR_get_pcor ,
385     (void **) &BG_PCOR_update_float ,
386     (void **) &BG_PLUTO_4D_to_typed_fim ,
387     (void **) &BG_PLUTO_add_dset ,
388     (void **) &BG_PLUTO_add_hint ,
389     (void **) &BG_PLUTO_beep ,
390     (void **) &BG_PLUTO_commandstring ,
391     (void **) &BG_PLUTO_copy_dset ,
392     (void **) &BG_PLUTO_cpu_time ,
393     (void **) &BG_PLUTO_dset_redisplay ,
394     (void **) &BG_PLUTO_dset_redisplay_mode ,
395     (void **) &BG_PLUTO_elapsed_time ,
396     (void **) &BG_PLUTO_find_dset ,
397     (void **) &BG_PLUTO_fixup_names ,
398     (void **) &BG_PLUTO_force_redisplay ,
399     (void **) &BG_PLUTO_histoplot ,
400     (void **) &BG_PLUTO_imseq_addto ,
401     (void **) &BG_PLUTO_imseq_popim ,
402     (void **) &BG_PLUTO_imseq_rekill ,
403     (void **) &BG_PLUTO_imseq_retitle ,
404     (void **) &BG_PLUTO_popdown_meter ,
405     (void **) &BG_PLUTO_popup_dset_chooser ,
406     (void **) &BG_PLUTO_popup_meter ,
407     (void **) &BG_PLUTO_popup_worker ,
408     (void **) &BG_PLUTO_prefix_ok ,
409     (void **) &BG_PLUTO_register_timeout ,
410     (void **) &BG_PLUTO_register_timeseries ,
411     (void **) &BG_PLUTO_register_workproc ,
412     (void **) &BG_PLUTO_report ,
413     (void **) &BG_PLUTO_scatterplot ,
414     (void **) &BG_PLUTO_set_butcolor ,
415     (void **) &BG_PLUTO_set_meter ,
416     (void **) &BG_PLUTO_set_sequence ,
417     (void **) &BG_PLUTO_set_topshell ,
418     (void **) &BG_PLUTO_string_index ,
419     (void **) &BG_PLUTO_turnoff_options ,
420     (void **) &BG_RWC_visibilize_CB ,
421     (void **) &BG_RWC_visibilize_widget ,
422     (void **) &BG_TTRR_get_params ,
423     (void **) &BG_add_dataset_to_PLUGIN_interface ,
424     (void **) &BG_add_number_to_PLUGIN_interface ,
425     (void **) &BG_add_option_to_PLUGIN_interface ,
426     (void **) &BG_add_string_to_PLUGIN_interface ,
427     (void **) &BG_add_timeseries_to_PLUGIN_interface ,
428     (void **) &BG_alter_MCW_pbar ,
429     (void **) &BG_alter_PLUGIN_strval_width ,
430     (void **) &BG_drive_MCW_grapher ,
431     (void **) &BG_drive_MCW_imseq ,
432     (void **) &BG_free_PCOR_references ,
433     (void **) &BG_free_PCOR_voxel_corr ,
434     (void **) &BG_get_PLUGIN_strval ,
435     (void **) &BG_get_idcode_from_PLUGIN_interface ,
436     (void **) &BG_get_number_from_PLUGIN_interface ,
437     (void **) &BG_get_optiontag_from_PLUGIN_interface ,
438     (void **) &BG_get_string_from_PLUGIN_interface ,
439     (void **) &BG_get_timeseries_from_PLUGIN_interface ,
440     (void **) &BG_load_PBAR_palette_array ,
441     (void **) &BG_make_PLUGIN_dataset_link ,
442     (void **) &BG_new_MCW_arrowval ,
443     (void **) &BG_new_MCW_bbox ,
444     (void **) &BG_new_MCW_colormenu ,
445     (void **) &BG_new_MCW_graf ,
446     (void **) &BG_new_MCW_optmenu ,
447     (void **) &BG_new_MCW_pasgraf ,
448     (void **) &BG_new_MCW_pbar ,
449     (void **) &BG_new_MCW_textwin ,
450     (void **) &BG_new_PCOR_references ,
451     (void **) &BG_new_PCOR_voxel_corr ,
452     (void **) &BG_new_PLUGIN_interface_1999 ,
453     (void **) &BG_new_PLUGIN_strval ,
454     (void **) &BG_open_MCW_imseq ,
455     (void **) &BG_peek_optiontag_from_PLUGIN_interface ,
456     (void **) &BG_redraw_MCW_pasgraf ,
457     (void **) &BG_refit_MCW_optmenu ,
458     (void **) &BG_set_MCW_pasgraf ,
459     (void **) &BG_update_MCW_pbar ,
460     (void **) &BG_update_PCOR_references ,
461     (void **) &BG_THD_coorder_fill ,
462 
463     (void **) &BG_GLOBAL_library ,    /* AFNI global data */
464     (void **) &BG_GLOBAL_argopt ,
465     (void **) &BG_afni48_pixmap ,
466     (void **) &BG_afni48_good ,
467     (void **) &BG_TTO_list ,
468 NULL } ;
469 
470 /** Receive the array of global pointers from AFNI **/
471 
BG_array_receive(int nar,void * ar[])472 void BG_array_receive( int nar , void *ar[] )
473 {
474    int ii ;
475    if( nar <= 0 || ar == NULL ) return ;
476    if( nar > NUM_BG_array ) nar = NUM_BG_array ;
477    for( ii=0 ; ii < NUM_BG_array ; ii++ )
478       if( BG_array[ii] != NULL ) *(BG_array[ii]) = ar[ii] ;
479    return ;
480 }
481 
MAIN__()482 int MAIN__(){ return 0; }  /* for f2c */
483 
484 /**** Macros to make it possible to call the AFNI global functions
485       via the pointers above using the same name as the original function ****/
486 
487 #define AFNI_add_interruptable BG_AFNI_add_interruptable
488 #define AFNI_can_transform_vector BG_AFNI_can_transform_vector
489 #define AFNI_controller_index BG_AFNI_controller_index
490 #define AFNI_controller_label BG_AFNI_controller_label
491 #define AFNI_force_adoption BG_AFNI_force_adoption
492 #define AFNI_hintize_pbar BG_AFNI_hintize_pbar
493 #define AFNI_initialize_view BG_AFNI_initialize_view
494 #define AFNI_jumpto_dicom BG_AFNI_jumpto_dicom
495 #define AFNI_make_descendants BG_AFNI_make_descendants
496 #define AFNI_modify_viewing BG_AFNI_modify_viewing
497 #define AFNI_needs_dset_ijk BG_AFNI_needs_dset_ijk
498 #define AFNI_palette_label_CB BG_AFNI_palette_label_CB
499 #define AFNI_process_drawnotice BG_AFNI_process_drawnotice
500 #define AFNI_process_interrupts BG_AFNI_process_interrupts
501 #define AFNI_purge_unused_dsets BG_AFNI_purge_unused_dsets
502 #define AFNI_range_rotate_av_CB BG_AFNI_range_rotate_av_CB
503 #define AFNI_receive_control BG_AFNI_receive_control
504 #define AFNI_receive_init BG_AFNI_receive_init
505 #define AFNI_register_nD_function BG_AFNI_register_nD_function
506 #define AFNI_set_cursor BG_AFNI_set_cursor
507 #define AFNI_transform_vector BG_AFNI_transform_vector
508 #define AV_assign_fval BG_AV_assign_fval
509 #define AV_assign_ival BG_AV_assign_ival
510 #define AV_colsize BG_AV_colsize
511 #define AV_format_fval BG_AV_format_fval
512 #define AV_fval_to_char BG_AV_fval_to_char
513 #define DC_rgb_to_ovrgb BG_DC_rgb_to_ovrgb
514 #define DC_yokify BG_DC_yokify
515 #define ENV_add_numeric BG_ENV_add_numeric
516 #define GRAF_get_setup BG_GRAF_get_setup
517 #define GRAF_put_setup BG_GRAF_put_setup
518 #define MCW_action_area BG_MCW_action_area
519 #define MCW_alter_widget_cursor BG_MCW_alter_widget_cursor
520 #define MCW_av_substring_CB BG_MCW_av_substring_CB
521 #define MCW_choose_integer BG_MCW_choose_integer
522 #define MCW_choose_ovcolor BG_MCW_choose_ovcolor
523 #define MCW_choose_string BG_MCW_choose_string
524 #define MCW_choose_strlist BG_MCW_choose_strlist
525 #define MCW_expose_widget BG_MCW_expose_widget
526 #define MCW_histo_bytes BG_MCW_histo_bytes
527 #define MCW_invert_widget BG_MCW_invert_widget
528 #define MCW_pbar_to_mri BG_MCW_pbar_to_mri
529 #define MCW_popdown_meter BG_MCW_popdown_meter
530 #define MCW_popup_message BG_MCW_popup_message
531 #define MCW_popup_meter BG_MCW_popup_meter
532 #define MCW_reghelp_children BG_MCW_reghelp_children
533 #define MCW_reghint_children BG_MCW_reghint_children
534 #define MCW_register_help BG_MCW_register_help
535 #define MCW_register_hint BG_MCW_register_hint
536 #define MCW_set_bbox BG_MCW_set_bbox
537 #define MCW_set_meter BG_MCW_set_meter
538 #define MCW_set_widget_label BG_MCW_set_widget_label
539 #define MCW_val_bbox BG_MCW_val_bbox
540 #define MCW_widget_geom BG_MCW_widget_geom
541 #define PARSER_evaluate_one BG_PARSER_evaluate_one
542 #define PARSER_evaluate_vector BG_PARSER_evaluate_vector
543 #define PARSER_generate_code BG_PARSER_generate_code
544 #define PCOR_get_coef BG_PCOR_get_coef
545 #define PCOR_get_pcor BG_PCOR_get_pcor
546 #define PCOR_update_float BG_PCOR_update_float
547 #define PLUTO_4D_to_typed_fim BG_PLUTO_4D_to_typed_fim
548 #define PLUTO_add_dset BG_PLUTO_add_dset
549 #define PLUTO_add_hint BG_PLUTO_add_hint
550 #define PLUTO_beep BG_PLUTO_beep
551 #define PLUTO_commandstring BG_PLUTO_commandstring
552 #define PLUTO_copy_dset BG_PLUTO_copy_dset
553 #define PLUTO_cpu_time BG_PLUTO_cpu_time
554 #define PLUTO_dset_redisplay BG_PLUTO_dset_redisplay
555 #define PLUTO_dset_redisplay_mode BG_PLUTO_dset_redisplay_mode
556 #define PLUTO_elapsed_time BG_PLUTO_elapsed_time
557 #define PLUTO_find_dset BG_PLUTO_find_dset
558 #define PLUTO_fixup_names BG_PLUTO_fixup_names
559 #define PLUTO_force_redisplay BG_PLUTO_force_redisplay
560 #define PLUTO_histoplot BG_PLUTO_histoplot
561 #define PLUTO_imseq_addto BG_PLUTO_imseq_addto
562 #define PLUTO_imseq_popim BG_PLUTO_imseq_popim
563 #define PLUTO_imseq_rekill BG_PLUTO_imseq_rekill
564 #define PLUTO_imseq_retitle BG_PLUTO_imseq_retitle
565 #define PLUTO_popdown_meter BG_PLUTO_popdown_meter
566 #define PLUTO_popup_dset_chooser BG_PLUTO_popup_dset_chooser
567 #define PLUTO_popup_meter BG_PLUTO_popup_meter
568 #define PLUTO_popup_worker BG_PLUTO_popup_worker
569 #define PLUTO_prefix_ok BG_PLUTO_prefix_ok
570 #define PLUTO_register_timeout BG_PLUTO_register_timeout
571 #define PLUTO_register_timeseries BG_PLUTO_register_timeseries
572 #define PLUTO_register_workproc BG_PLUTO_register_workproc
573 #define PLUTO_report BG_PLUTO_report
574 #define PLUTO_scatterplot BG_PLUTO_scatterplot
575 #define PLUTO_set_butcolor BG_PLUTO_set_butcolor
576 #define PLUTO_set_meter BG_PLUTO_set_meter
577 #define PLUTO_set_sequence BG_PLUTO_set_sequence
578 #define PLUTO_set_topshell BG_PLUTO_set_topshell
579 #define PLUTO_string_index BG_PLUTO_string_index
580 #define PLUTO_turnoff_options BG_PLUTO_turnoff_options
581 #define RWC_visibilize_CB BG_RWC_visibilize_CB
582 #define RWC_visibilize_widget BG_RWC_visibilize_widget
583 #define TTRR_get_params BG_TTRR_get_params
584 #define add_dataset_to_PLUGIN_interface BG_add_dataset_to_PLUGIN_interface
585 #define add_number_to_PLUGIN_interface BG_add_number_to_PLUGIN_interface
586 #define add_option_to_PLUGIN_interface BG_add_option_to_PLUGIN_interface
587 #define add_string_to_PLUGIN_interface BG_add_string_to_PLUGIN_interface
588 #define add_timeseries_to_PLUGIN_interface BG_add_timeseries_to_PLUGIN_interface
589 #define alter_MCW_pbar BG_alter_MCW_pbar
590 #define alter_PLUGIN_strval_width BG_alter_PLUGIN_strval_width
591 #define drive_MCW_grapher BG_drive_MCW_grapher
592 #define drive_MCW_imseq BG_drive_MCW_imseq
593 #define free_PCOR_references BG_free_PCOR_references
594 #define free_PCOR_voxel_corr BG_free_PCOR_voxel_corr
595 #define get_PLUGIN_strval BG_get_PLUGIN_strval
596 #define get_idcode_from_PLUGIN_interface BG_get_idcode_from_PLUGIN_interface
597 #define get_number_from_PLUGIN_interface BG_get_number_from_PLUGIN_interface
598 #define get_optiontag_from_PLUGIN_interface BG_get_optiontag_from_PLUGIN_interface
599 #define get_string_from_PLUGIN_interface BG_get_string_from_PLUGIN_interface
600 #define get_timeseries_from_PLUGIN_interface BG_get_timeseries_from_PLUGIN_interface
601 #define load_PBAR_palette_array BG_load_PBAR_palette_array
602 #define make_PLUGIN_dataset_link BG_make_PLUGIN_dataset_link
603 #define new_MCW_arrowval BG_new_MCW_arrowval
604 #define new_MCW_bbox BG_new_MCW_bbox
605 #define new_MCW_colormenu BG_new_MCW_colormenu
606 #define new_MCW_graf BG_new_MCW_graf
607 #define new_MCW_optmenu BG_new_MCW_optmenu
608 #define new_MCW_pasgraf BG_new_MCW_pasgraf
609 #define new_MCW_pbar BG_new_MCW_pbar
610 #define new_MCW_textwin BG_new_MCW_textwin
611 #define new_PCOR_references BG_new_PCOR_references
612 #define new_PCOR_voxel_corr BG_new_PCOR_voxel_corr
613 #define new_PLUGIN_interface_1999 BG_new_PLUGIN_interface_1999
614 #define new_PLUGIN_strval BG_new_PLUGIN_strval
615 #define open_MCW_imseq BG_open_MCW_imseq
616 #define peek_optiontag_from_PLUGIN_interface BG_peek_optiontag_from_PLUGIN_interface
617 #define redraw_MCW_pasgraf BG_redraw_MCW_pasgraf
618 #define refit_MCW_optmenu BG_refit_MCW_optmenu
619 #define set_MCW_pasgraf BG_set_MCW_pasgraf
620 #define update_MCW_pbar BG_update_MCW_pbar
621 #define update_PCOR_references BG_update_PCOR_references
622 #define THD_coorder_fill BG_THD_coorder_fill
623 
624 /** Access global AFNI data this roundabout way.  The data is passed as
625     pointers, so we need to dereference them (unless they are pointers anyhoo). **/
626 
627 #define GLOBAL_library   (*BG_GLOBAL_library)
628 #define GLOBAL_argopt    (*BG_GLOBAL_argopt)
629 #define afni48_pixmap    (*BG_afni48_pixmap)
630 #define afni48_good      (*BG_afni48_good)
631 #define TTO_list         (BG_TTO_list)           /* already a pointer */
632 
633 #endif /* BG_INSIDE_AFNI */
634 #endif /* CYGWIN */
635