int readwu_startup(void) { if (!IDL_SysRtnAdd(readwu_fns,TRUE,ARRLEN(readwu_fns))) { return NULL; } IDL_ExitRegister(readwu_exit_handler); return IDL_TRUE; }
int IDL_Load(void) { #ifdef WIN32 WORD wVersionRequested; WSADATA wsaData; int err; wVersionRequested = MAKEWORD(2, 0); err = WSAStartup(wVersionRequested, &wsaData); if (!err) iInitW2 = 1; #endif if (!(msg_block = IDL_MessageDefineBlock("mg_net", IDL_CARRAY_ELTS(msg_arr), msg_arr))) { return IDL_FALSE; } if (!IDL_SysRtnAdd(net_functions, TRUE, IDL_CARRAY_ELTS(net_functions))) { IDL_Message(IDL_M_GENERIC, IDL_MSG_RET, "Error adding MG_NET system routines"); return IDL_FALSE; } IDL_ExitRegister(mg_net_exit_handler); return IDL_TRUE; }
/** rIDL main loop. */ int main(int argc, char *argv[]) { ridl_handleswitches(argc, argv, 1); IDL_INIT_DATA init_data; init_data.options = ridl_options; init_data.clargs.argc = argc; init_data.clargs.argv = argv; ridl_welcome(); IDL_UicbRegInitTextDone(ridl_inittextdone); if (!IDL_Initialize(&init_data)) { ridl_warning("failed to initialize Callable IDL session.\n"); return(EXIT_FAILURE); } IDL_ExitRegister(ridl_exit_handler); IDL_UicbRegExitDone(ridl_exit); IDL_UicbRegShowCompileErr(ridl_show_compile_error); IDL_UicbRegPromptChange(ridl_changeprompt); IDL_UicbRegDeathHint(ridl_deathhint); IDL_UicbRegWorkingDirChange(ridl_changewdir); // TODO: will need to use something like this to fix ticket #1, but this // will crash now; this specifies a routine that will be called when // IDL needs to do a readline (as in RIDL_STOPTEST) IDL_UicbRegRlineFromKbrd(ridl_readline_callback); ridl_handleswitches(argc, argv, 0); ridl_cmdnumber = ridl_initialize_history() + 1; if (!(msg_block = IDL_MessageDefineBlock("RIDL_MSG_BLOCK", IDL_CARRAY_ELTS(msg_arr), msg_arr))) return(1); IDL_GetUserInfo(&user_info); ridl_changewdir(user_info.wd); IDL_ExecuteStr("!prompt = !prompt"); // triggers prompt to be set IDL_ExecuteStr("!path = filepath('', subdir=['share', 'idl'], root=getenv('RIDL_DIR')) + path_sep(/search_path) + !path"); // handle functions called by rIDL (instead of compile_opt strictarr) IDL_ExecuteStr("forward_function ridl_class_hierarchy_helper, ridl_cmp_version, ridl_getfields, ridl_getmethods, ridl_getroutines, ridl_getuserroutines, ridl_launcheditor, ridl_preflocation"); rl_readline_name = "rIDL"; ridl_completion_init(); rl_attempted_completion_function = ridl_completion; ridl_get_userdefinedroutines_list(); IDL_UicbRegPathChange(ridl_changepath); ridl_read_preferences(); // load -pref filename if present on the command line if (preferences_file_set) { // TODO: make this work (doing a PREF_SET will not change the preferences // values unless COMMIT is set, but doing so will change the user's // preferences file permanently); how to change preferences just for this // session of IDL? //char *pref_set_format = "pref_set, filename='%s'"; //char *pref_set_cmd = (char *)malloc(strlen(pref_set_format) - 2 + strlen(preferences_filename) + 1); //sprintf(pref_set_cmd, pref_set_format, preferences_filename); //int error = IDL_ExecuteStr(pref_set_cmd); //free(pref_set_cmd); } // handle -rt or -em options if one of them was present on the command line if (runtime_exec) { int error = IDL_RuntimeExec(runtime_filename); return(IDL_Cleanup(IDL_FALSE)); } // handle -e option if it was present on the command line if (execute_cmd) { int error = IDL_ExecuteStr(cmd); return(IDL_Cleanup(IDL_FALSE)); } // execute batch file if present on the command line if (execute_batch_file) { ridl_execute_batch_file(batch_file); } ridl_updateprompt(); rl_event_hook = ridl_event_hook; // bind these commands to keys in an Readline configuration file, i.e., // like ~/.inputrc (an example inputrc is given in the src/ directory of the // distribution) int f; for (f = 0; f < N_FUNMAP_FUNCTIONS; f++) { rl_add_funmap_entry(funmap_function_names[f], funmap_functions[f]); } while (1) { char *line = ridl_readline(); ridl_getevents(); int error = ridl_executeline(line, 1); free(line); } return(EXIT_FAILURE); }