basic IDL_IDLBridge question [message #89302] |
Thu, 14 August 2014 23:28  |
Ken G
Messages: 14 Registered: September 2006
|
Junior Member |
|
|
An IDL_IDLBridge question, separate from all of the memory-leak headaches and whatnot. (I'm on Mac OSX 10.9.4, and IDL 8.3.2)
I'd like the bridge object to be able to run code from my own procedure libraries. But since it launches without a startup file, my path and other variable definitions are not set up initially within the Bridge.
So, what are the best ways that people handle this: i.e. to point an IDL_IDLBridge to my procedure libraries, in addition to the basic IDL functions?
|
|
|
Re: basic IDL_IDLBridge question [message #89303 is a reply to message #89302] |
Fri, 15 August 2014 00:25   |
Yngvar Larsen
Messages: 134 Registered: January 2010
|
Senior Member |
|
|
Assume that you have put all your initialization in a startup file, and issued
pref_set, 'IDL_STARTUP', '/path/to/your/startup/file', /commit
Then you can in the main process set up your bridges like this:
bridgearr = objarr(N)
for ii=0, N-1 do begin
bridgeArr[ii] = obj_new('idl_idlbridge', callback='your_callback_fn', output='your_log_file')
bridgeArr[ii]->execute, '@'+pref_get('IDL_STARTUP')
endfor
It is of course possible to adapt this to work with a custom startup file for bridges instead of using the IDL_STARTUP preference for the main process.
On Friday, 15 August 2014 08:28:28 UTC+2, Ken G wrote:
> An IDL_IDLBridge question, separate from all of the memory-leak headaches and whatnot. (I'm on Mac OSX 10.9.4, and IDL 8.3.2)
>
>
>
> I'd like the bridge object to be able to run code from my own procedure libraries. But since it launches without a startup file, my path and other variable definitions are not set up initially within the Bridge.
>
>
>
> So, what are the best ways that people handle this: i.e. to point an IDL_IDLBridge to my procedure libraries, in addition to the basic IDL functions?
|
|
|
|
|
Re: basic IDL_IDLBridge question [message #89310 is a reply to message #89302] |
Fri, 15 August 2014 11:22   |
Russell Ryan
Messages: 122 Registered: May 2012
|
Senior Member |
|
|
On Friday, August 15, 2014 2:28:28 AM UTC-4, Ken G wrote:
> An IDL_IDLBridge question, separate from all of the memory-leak headaches and whatnot. (I'm on Mac OSX 10.9.4, and IDL 8.3.2)
>
>
>
> I'd like the bridge object to be able to run code from my own procedure libraries. But since it launches without a startup file, my path and other variable definitions are not set up initially within the Bridge.
>
>
>
> So, what are the best ways that people handle this: i.e. to point an IDL_IDLBridge to my procedure libraries, in addition to the basic IDL functions?
Yngvar's got the right voodoo. But you might also worry about the current working directory. I don't think that the IDL_IDLBridge "environment" knows the cwd (which you might want). So after I issue Yngvar's command (or something nearly similar), I then issue something lie
bridge->execute,'cd '+cwd
Just a tip,
Russell
|
|
|
Re: basic IDL_IDLBridge question [message #89311 is a reply to message #89310] |
Fri, 15 August 2014 14:23  |
Jim Pendleton
Messages: 165 Registered: November 2011
|
Senior Member |
|
|
On Friday, August 15, 2014 12:22:35 PM UTC-6, rr...@stsci.edu wrote:
> On Friday, August 15, 2014 2:28:28 AM UTC-4, Ken G wrote:
>
>> An IDL_IDLBridge question, separate from all of the memory-leak headaches and whatnot. (I'm on Mac OSX 10.9.4, and IDL 8.3.2)
>
>>
>
>>
>
>>
>
>> I'd like the bridge object to be able to run code from my own procedure libraries. But since it launches without a startup file, my path and other variable definitions are not set up initially within the Bridge.
>
>>
>
>>
>
>>
>
>> So, what are the best ways that people handle this: i.e. to point an IDL_IDLBridge to my procedure libraries, in addition to the basic IDL functions?
>
>
>
> Yngvar's got the right voodoo. But you might also worry about the current working directory. I don't think that the IDL_IDLBridge "environment" knows the cwd (which you might want). So after I issue Yngvar's command (or something nearly similar), I then issue something lie
>
>
>
> bridge->execute,'cd '+cwd
>
>
>
> Just a tip,
>
> Russell
Here's another tip... There's a limited buffer size in the Execute method, one that's smaller than that of the command line. If you set your !path not through preferences (I only use <IDL_DEFAULT>) but through setups associated with your projects, you might find that some directories go missing in your bridge process if you simply try to set bridge->execute, '!path = "' + !path + '"'.
You can work around this by building !path in the bridge process in chunks.
|
|
|