View on GitHub

IRAF Community Distribution

IRAF maintained by the community

Home | Installation | Packages | X11IRAF | PyRAF | Forum

Defining a foreign task in the pkgname.cl file.

Ed Anderson wrote on Jul 25, 2006

Mike (or anyone),

I'm have a standalone fortran program that is part of a local external package.

Previously, I would define the task in my loginuser.cl file as:

task $taskname = $/path-to-executable/executable-name

Inside the packagename.cl file I have:

cl < "y4kcam$lib/zzsetenv.def"
package y4kcam, bin=y4kbin$

task $taskname = $executable-name

The result of trying to run the task is: "command not found"

If I put:

task $taskname = $y4kbin$executable-name

then I get: command not defined

What is the proper syntax for doing this?

thanks,

-- Ed

Mike Fitzpatrick wrote on Jul 25, 2006

Hi Ed,

Interesting question. In most cases one can get away with simply declaring the task to be "$foreign", but this assumes the unix PATH would find the executable (which is why you get the 'command not found' message). I presume you've got a host command in a package bin directory and want to resolve the path as part of the package loading regardless of the host path? In that case you need to convolve the task declaration as something like (assuming a 'Hello World' task in the IRAF bin directory)


printf ("task $hello = $%s ; keep\n", osfn("bin$hello")) | cl()


This formats the task statement by resolving the path with osfn(); the 'keep' preserves the declaration in the CL context, and the result is piped to a CL interpreter for processing. A similar trick is used to append e.g. the helpdb string where a simple string concatenation would exceed the CL string length limit.

I haven't actually tried this in a package loading script, but don't forsee some reason why it wouldn't work there as well. You could do something similar by creating the path string and using a redirected cl command but while obscure, this is more compact. Let me know if it doesn't work.

Cheers,
-Mike

Ed Anderson wrote on Jul 25, 2006

Sorry for the delay ... I took a week off.

Anyway, I stumbled on the answer ... or one that seems to work.

In the packagename.cl file (y4kcam.cl in this case):

*******************************

package y4kcam, bin=y4kbin
$task $pickbig = "y4kbin$$pickbig"

^^^^^^

Two "$" ... the first dereferences the environment variable (the path
to the executable), the second is the "foreign" definition.

*********************************************

The faculty member claims that things are working ok now.

-- Ed

Last post on Jul 25, 2006