home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include "export.h"
-
-
-
- static void free_callback(UCHAR *addr)
- {
- printf("IDL released(%u)\r\n", addr);
- }
-
-
-
- int main(int argc, char **argv)
- {
- float f[10];
- int i;
- IDL_VPTR v;
- IDL_LONG dim[IDL_MAX_ARRAY_DIM];
- static char *cmds[] = { "tmp2 = total(tmp)", "print,'IDL total is ', tmp2",
- "plot,tmp" };
- static char *cmds2[] = { "a = widget_base()",
- "b = widget_button(a, value='Press When Done', xsize=300, ysize=200)",
- "widget_control,/realize, a",
- "dummy = widget_event(a)",
- "widget_control,/destroy, a" };
-
-
- for (i=0; i < 10; i++) f[i] = (float) i;
- if (IDL_Init(0, &argc, argv)) {
- dim[0] = 10;
- printf("ARRAY ADDRESS(%u)\r\n", f);
- if (v = IDL_ImportNamedArray("TMP", 1, dim, IDL_TYP_FLOAT, (UCHAR *) f,
- free_callback, (void *) 0)) {
- (void) IDL_ExecuteStr("print, tmp");
- (void) IDL_Execute(sizeof(cmds)/sizeof(char *), cmds);
- (void) IDL_ExecuteStr("print, 'This should free the user memory");
- (void) IDL_ExecuteStr("tmp = 0");
- if (v = IDL_FindNamedVariable("tmp2", FALSE))
- printf("Program total is %f\n\r", v->value.f);
- (void) IDL_Execute(sizeof(cmds2)/sizeof(char *), cmds2);
- IDL_Cleanup(FALSE); /* Don't return */
- }
- }
-
- return 1;
- }
-
-