Welcome to iraf.net Friday, May 17 2024 @ 12:12 PM GMT
jacom |
07/22/2011 08:56AM (Read 1706 times)
|
|
|
Status: offline
Registered: 07/22/2011
Posts: 5
|
Hi,I am using IRAF V2.14I have a C language code coordtransform.c which I want to include in a procedure script.
I have defined it as a foreign task by
task coordtransform = $coordtransform.c
In IRAF it works fine if I do the normal !coordtransform "filename", but the same command in the procedure script does not work.The C code takes a file name as an argument, where the file name is defined as imname // '.coo.1' in the procedure script.In the procedure script I have:
!gcc -lm coordtransform.c -o coordtransform
!./coordtransform , imname // '.coo.1'Is it possible to do it like this?Thanks
Jaco
|
|
|
|
fitz |
07/22/2011 08:56AM
|
|
|
Status: offline
Registered: 09/30/2005
Posts: 4040
|
For C code, you can't run it directly in a CL script and I doubt you want to compile it every time the script runs, but you're on the right track. What you want is to first compile the code and then call the binary from the script as a foreign task. For example, assuming you've compiled the program you would declare it as a foreign task using the command:[code:1:c917c84ca0]task $foreign = $/path/coordtransform[/code:1:c917c84ca0]You can put this in your login.cl or loginuser.cl file before the final 'keep' statement, or in the script itself.You would then call it from the script using something like[code:1:c917c84ca0]coordtransform (imname // ".coo.1")[/code:1:c917c84ca0]or alternatively as[code:1:c917c84ca0]print ("!/path/coordtransform " // imname // ".coo.1") | cl()[/code:1:c917c84ca0]which simply creates an escaped command string it pipes to the CL to execute.
|
|
|
|
jacom |
07/22/2011 08:56AM
|
|
|
Status: offline
Registered: 07/22/2011
Posts: 5
|
Thank you for the reply.Yes I included the compiling only to see if it runs in the script.
After some playing around with different syntax, I finally got it to work.With only the "coordtransform (imname // ".coo.1")" in the script, I got an error with the arguments in the C code, but the "print ("!/path/coordtransform " // imname // ".coo.1") | cl()" worked just fine.Thanks you!Regards
Jaco
|
|
|
|
| |
|
Content generated in: 0.09 seconds |
|