Esempio n. 1
0
int IDL_Load(void) {
  /*
     These tables contain information on the functions and procedures
     that make up the cmdline_tools DLM. The information contained in these
     tables must be identical to that contained in cmdline_tools.dlm.
  */
  static IDL_SYSFUN_DEF2 function_addr[] = {
    { IDL_mg_zlib_version,     "MG_ZLIB_VERSION",     0, 0, 0, 0 },
  };

  static IDL_SYSFUN_DEF2 procedure_addr[] = {
    { (IDL_SYSRTN_GENERIC) IDL_mg_compress,    "MG_COMPRESS",    2, 2, 0, 0 },
    { (IDL_SYSRTN_GENERIC) IDL_mg_decompress,  "MG_DECOMPRESS",    2, 2, 0, 0 },
  };

  if (!(msg_block = IDL_MessageDefineBlock("mg_zlib_dlm",
                                           IDL_CARRAY_ELTS(msg_arr),
                                           msg_arr))) return IDL_FALSE;

  /*
     Register our routines. The routines must be specified exactly the same
     as in cmdline_tools.dlm.
  */
  return IDL_SysRtnAdd(procedure_addr, FALSE, IDL_CARRAY_ELTS(procedure_addr))
      && IDL_SysRtnAdd(function_addr, TRUE, IDL_CARRAY_ELTS(function_addr));
}
Esempio n. 2
0
int IDL_Load ( void )
{
  if ( ! ( msg_block = IDL_MessageDefineBlock ( "IDLtoC", ARRLEN ( msg_arr ),msg_arr ) ) )
    return IDL_FALSE;
  if ( !IDL_ShadowStartup() )
    IDL_MessageFromBlock ( msg_block, IDL_SHADOW_ERROR, IDL_MSG_RET, "Unable to initialize Shadow" );

  return IDL_TRUE;
}
Esempio n. 3
0
int IDL_Load(void) {
  if (!(readwu_msg_block=IDL_MessageDefineBlock("readwu", ARRLEN(msg_arr),msg_arr))) {
    return NULL;
  }
  if (!readwu_startup()) {
    IDL_MessageFromBlock(readwu_msg_block,0,IDL_MSG_RET,"can't load readwu");
  }
  return IDL_TRUE;
}
Esempio n. 4
0
//
// IDL_Load
//
int IDL_Load (void)
{
  int status;
  int nmsgs, nfcns, npros;

  static IDL_SYSFUN_DEF2 function_addr[] = {
    { idlpgr_CreateContext,      "IDLPGR_CREATECONTEXT",      0, 0, 0, 0 },
    { idlpgr_GetNumOfCameras,    "IDLPGR_GETNUMOFCAMERAS",    1, 1, 0, 0 },
    { idlpgr_GetCameraFromIndex, "IDLPGR_GETCAMERAFROMINDEX", 1, 2, 0, 0 },
    { idlpgr_GetCameraInfo,      "IDLPGR_GETCAMERAINFO",      1, 1, 0, 0 },
    { idlpgr_CreateImage,        "IDLPGR_CREATEIMAGE",        0, 0, 0, 0 },
    { idlpgr_AllocateImage,      "IDLPGR_ALLOCATEIMAGE",      1, 1, 0, 0 },
    { idlpgr_ReadRegister,       "IDLPGR_READREGISTER",       2, 2, 0, 0 },
    { idlpgr_GetPropertyInfo,    "IDLPGR_GETPROPERTYINFO",    2, 2, 0, 0 },
    { idlpgr_GetProperty,        "IDLPGR_GETPROPERTY",        2, 2, 0, 0 },
  };

  static IDL_SYSFUN_DEF2 procedure_addr[] = {
    { (IDL_SYSRTN_GENERIC)
      idlpgr_DestroyContext, "IDLPGR_DESTROYCONTEXT", 1, 1, 0, 0 },
    { (IDL_SYSRTN_GENERIC)
      idlpgr_Connect,        "IDLPGR_CONNECT",        2, 2, 0, 0 },
    { (IDL_SYSRTN_GENERIC)
      idlpgr_StartCapture,   "IDLPGR_STARTCAPTURE",   1, 1, 0, 0 },
    { (IDL_SYSRTN_GENERIC)
      idlpgr_StopCapture,    "IDLPGR_STOPCAPTURE",    1, 1, 0, 0 },
    { (IDL_SYSRTN_GENERIC)
      idlpgr_DestroyImage,   "IDLPGR_DESTROYIMAGE",   1, 1, 0, 0 },
    { (IDL_SYSRTN_GENERIC)
      idlpgr_RetrieveBuffer, "IDLPGR_RETRIEVEBUFFER", 2, 2, 0, 0 },
    { (IDL_SYSRTN_GENERIC)
      idlpgr_GetImage,       "IDLPGR_GETIMAGE",       2, 2, 0, 0 },
    { (IDL_SYSRTN_GENERIC)
      idlpgr_WriteRegister,  "IDLPGR_WRITEREGISTER",  3, 3, 0, 0 },
    { (IDL_SYSRTN_GENERIC)
      idlpgr_SetProperty,    "IDLPGR_SETPROPERTY",    2, 2, 0, 0 },
  };

  nmsgs = IDL_CARRAY_ELTS(msg_arr);
  msgs = IDL_MessageDefineBlock("idlpgr", nmsgs, msg_arr);
  if (!msgs)
    return IDL_FALSE;

  nfcns = IDL_CARRAY_ELTS(function_addr);
  status = IDL_SysRtnAdd(function_addr, TRUE, nfcns);

  npros = IDL_CARRAY_ELTS(procedure_addr);
  status |= IDL_SysRtnAdd(procedure_addr, FALSE, npros);

  return status;
}
Esempio n. 5
0
int IDL_Load(void) {

  static IDL_SYSFUN_DEF2 fnaddr[]={
    { IDLOldCnvMapRead,"OLDCNVMAPREAD",7,7,0,0},
    { IDLOldCnvMapWrite,"OLDCNVMAPWRITE",7,7,0,0},
    { IDLOldCnvMapLoadInx,"OLDCNVMAPLOADINX",2,2,0,0},
    { IDLOldCnvMapSeek,"OLDCNVMAPSEEK",7,8,IDL_SYSFUN_DEF_F_KEYWORDS,0},
    { IDLOldCnvMapOpen,"OLDCNVMAPOPEN",1,1,IDL_SYSFUN_DEF_F_KEYWORDS,0},
    { IDLOldCnvMapClose,"OLDCNVMAPCLOSE",1,1,0,0},
  };


  if (!(msg_block = IDL_MessageDefineBlock("oldcnvmap",
                    IDL_CARRAY_ELTS(msg_arr), msg_arr)))
    return IDL_FALSE;

  return IDL_SysRtnAdd(fnaddr,TRUE,IDL_CARRAY_ELTS(fnaddr));

}
Esempio n. 6
0
int IDL_Load(void) {

  static IDL_SYSFUN_DEF2 fnaddr[]={
    { IDLOldRawRead,"OLDRAWREAD",3,3,0,0},
    { IDLOldRawSeek,"OLDRAWSEEK",7,7,IDL_SYSFUN_DEF_F_KEYWORDS,0},
    { IDLOldRawWrite,"OLDRAWWRITE",4,4,0,0},
    { IDLOldRawOpen,"OLDRAWOPEN",1,2,0,0},
    { IDLOldRawClose,"OLDRAWCLOSE",1,1,0,0},
    { IDLOldRawWriteHeader,"OLDRAWWRITEHEADER",3,3,0,0},
  };


  if (!(msg_block = IDL_MessageDefineBlock("oldraw",
                    IDL_CARRAY_ELTS(msg_arr), msg_arr)))
    return IDL_FALSE;

  return IDL_SysRtnAdd(fnaddr,TRUE,IDL_CARRAY_ELTS(fnaddr));

}
Esempio n. 7
0
int IDL_Load(void) {

  static IDL_SYSFUN_DEF2 fnaddr[]={
    { IDLOldGridRead,"OLDGRIDREAD",4,4,0,0},
    { IDLOldGridWrite,"OLDGRIDWRITE",4,4,0,0},
    { IDLOldGridLoadInx,"OLDGRIDLOADINX",2,2,0,0},
    { IDLOldGridSeek,"OLDGRIDSEEK",7,8,IDL_SYSFUN_DEF_F_KEYWORDS,0},
    { IDLOldGridOpen,"OLDGRIDOPEN",1,1,IDL_SYSFUN_DEF_F_KEYWORDS,0},
    { IDLOldGridClose,"OLDGRIDCLOSE",1,1,0,0},
  };


  if (!(msg_block = IDL_MessageDefineBlock("grd",
                    IDL_CARRAY_ELTS(msg_arr), msg_arr)))
    return IDL_FALSE;

  return IDL_SysRtnAdd(fnaddr,TRUE,IDL_CARRAY_ELTS(fnaddr));

}
Esempio n. 8
0
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;
}
Esempio n. 9
0
int IDL_Load(void) {
  /*
     These tables contain information on the functions and procedures
     that make up the cmdline_tools DLM. The information contained in these
     tables must be identical to that contained in cmdline_tools.dlm.
  */
  static IDL_SYSFUN_DEF2 function_addr[] = {
    { IDL_mg_termlines,            "MG_TERMLINES",            0, 0, 0, 0 },
    { IDL_mg_termcolumns,          "MG_TERMCOLUMNS",          0, 0, 0, 0 },
    { IDL_mg_termistty,            "MG_TERMISTTY",            0, 0, 0, 0 },
    { IDL_mg_heapid,               "MG_HEAPID",               1, 1, 0, 0 },
    { IDL_mg_tout_pop,             "MG_TOUT_POP",             0, 0, 0, 0 },
    { IDL_IDL_OutputFormatFunc,    "MG_OUTPUTFORMATFUNC",     1, 1, 0, 0 },
    { IDL_IDL_OutputFormatLenFunc, "MG_OUTPUTFORMATLENFUNC",  1, 1, 0, 0 },
    { IDL_IDL_TypeSizeFunc,        "MG_TYPESIZEFUNC",         1, 1, 0, 0 },
    { IDL_IDL_TypeNameFunc,        "MG_TYPENAMEFUNC",         1, 1, 0, 0 },
    { IDL_IDL_SysRtnNumEnabled,    "MG_SYSRTNNUMENABLED",     2, 2, 0, 0 },
  };

  static IDL_SYSFUN_DEF2 procedure_addr[] = {
    { (IDL_SYSRTN_GENERIC) IDL_mg_print,     "MG_PRINT",     0, IDL_MAXPARAMS, IDL_SYSFUN_DEF_F_KEYWORDS, 0 },
    { (IDL_SYSRTN_GENERIC) IDL_mg_tout_push, "MG_TOUT_PUSH", 0, 1, 0, 0 },
    { (IDL_SYSRTN_GENERIC) IDL_IDL_TTYReset, "MG_TTYRESET",  0, 0, 0, 0 },
  };

  if (!(msg_block = IDL_MessageDefineBlock("MG_Cmdline_tools_DLM",
                                           IDL_CARRAY_ELTS(msg_arr),
                                           msg_arr))) return IDL_FALSE;

  /*
     Register our routines. The routines must be specified exactly the same
     as in cmdline_tools.dlm.
  */
  return IDL_SysRtnAdd(procedure_addr, FALSE, IDL_CARRAY_ELTS(procedure_addr))
      && IDL_SysRtnAdd(function_addr, TRUE, IDL_CARRAY_ELTS(function_addr));
}
Esempio n. 10
0
File: ridl.c Progetto: mgalloy/ridl
/**
   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);
}
Esempio n. 11
0
extern "C" int IDL_Load(void) {
	if (!(bam_cxc_msg_block = IDL_MessageDefineBlock("BAM_CXC", ARRLEN(bam_cxc_msg_arr), bam_cxc_msg_arr))) {
		return IDL_FALSE;
	}
	return IDL_SysRtnAdd(idl_bam_cxc_functions, TRUE, IDL_CARRAY_ELTS(idl_bam_cxc_functions));
}