comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » passing multiple keywords to subroutines
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
passing multiple keywords to subroutines [message #14109] Thu, 21 January 1999 00:00
David Ritscher is currently offline  David Ritscher
Messages: 30
Registered: August 1995
Member
It's often desirable to redefine a function, and then have this new
function behave almost like the original function. To cook up an
example, let's say I need a new plot function, that plots the x-axis
as .001 units:

pro myplot, x
plot, findgen(n_elements(x) * 0.001), x
return
end

It would now be great to be able to pass any and all possible keywords
into this new plotting function, so I might call it as:
myplot, x, title='test', linestyle=3

In IDL, this can be done by including all possible keywords (rather
tedious!) In PV-Wave, it's almost impossible, since it is not
possible to pass in an undefined keyword:

(I have not defined the variable 'color' here:)
WAVE> plot, [1,5], color=color
% PLOT: Variable is undefined: COLOR.
% Execution halted at $MAIN$ (PLOT).

This same command works fine in IDL, and has the appropriate behavior
(Here, with 'color' undefined, it behaves exactly the same as if the
keyword was not specified).

Thus in IDL it is possible to define my new function along these lines:
pro myplot, x, color=color, linestyle=linestyle, ynozero=ynozero, $
noclip=noclip, yrange=yrange,
...
As I say, this becomes rather tedious.

Does anyone see a simpler way to handle this sort of thing? It seems
to me that that two things are needed:
1. both companies need to add a mechanism to handle keywords that will
be passed on to subroutines, which might take on a form like the
following:
pro pass_keywords=pass_keywords myplot, x
plot, x, pass_keywords=pass_keywords

where I can now call 'myplot' with extra keywords:
myplot, x, linestyle=3

2. The bugs in PV-Wave have to be fixed, such that undefined keywords
can be handled by every function.

Am I missing a better way to handle these issues?


David Ritscher

--
Cardiac Rhythm Management Laboratory
Department of Medicine
University of Alabama at Birmingham
B168 Volker Hall - 1670 University Boulevard
Birmingham AL 35294-0019
Tel: (205) 975-2122 Fax: (205) 975-4720
[Message index]
 
Read Message
Previous Topic: Solving equation with Monte Carlo simulation
Next Topic: Re: Info on Acr/Nema image conversion/format

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:23:33 PDT 2025

Total time taken to generate the page: 0.00435 seconds