Python and GDL bridges

DPUSER can be compiled to offer the ability to call Python and/or GDL code.

Python setup

Python support is loaded dynamically when the first python code is executed. In order to do so, DPUSER must know where to find the python dynamic link library.
If you are using the DPUSER terminal application, the library will be loaded from whereever the DPUSER_PYTHONLIB environment variable is pointing. This environment variable can be either set in your .bashrc or similar, or within DPUSER itself with the setenv procedure:
setenv "DPUSER_PYTHONLIB", "/usr/lib/x86_64-linux-gnu/"
In QFitsView, you set the location within the Preferences Dialog, under the Paths tab.

GDL setup

GDL is included statically, so in order to use GDL commands, there is nothing to be done. As with GDL itself, you need to set the GDL_PATH environment variable so it knows where to look for its *.pro files. On Linux and MacOS, you set the GDL_PATH as follows (note the '+' with will expand the path):

   export GDL_PATH="/path/to/gdl/pro:+/path/to/your/codes"

On Microsoft Windows, since the colon is used to specify drive letters, use the following (separator is semicolon, forward slashes, no quotes):

   set GDL_PATH=c:/path/to/gdl/pro;+c:/path/to/your/codes

Variable conversion

The python and GDL bridges convert between the following variable types:
fits listtuple | liststruct

Calling sequences

Calling python code

There are three ways implemented how to call python code from within DPUSER:

Calling GDL code

For calling GDL code, only the inline method is supported. Of course, you can write procedures and functions in *.pro files and execute these. The included GDL interpreter will search for these using the GDL_PATH environment variable. Another small trick: If you want to make sure that a GDL procedure or function is called, capitalize the function name (since GDL is case insensitive, but DPUSER is, it will then call the GDL function):

   DPUSER> print sin(10)
   DPUSER> print Sin(10)

Arguments and keywords will be updated when calling GDL procedures and functions.