idlastro / IDL Structure procedures: MRD_STRUCT

[Source code]

NAME
MRD_STRUCT
PURPOSE
Return a structure as defined in the names and values data.
CALLING SEQUENCE
struct = MRD_STRUCT(NAMES, VALUES, NROW, STRUCTYP='name' )
INPUT PARAMETERS
NAMES   = A string array of names of structure fields.
VALUES  = A string array giving the values of the structure
          fields.  See examples below.
NROW    = The number of elements in the structure array.
RETURNS
A structure as described in the parameters or 0 if an error
is detected.
OPTIONAL KEYWORD PARAMETERS
/NO_EXECUTE - If set then the use of the EXECUTE() statement is avoided.
           By default, the NO_EXECUTE pathway is used if IDL is 
           running under the Virtual Machine.    Note if  /NO_EXECUTE
           is set, then the user cannot supply arbitrary values, but
           all possible values used by MRDFITS will be allowed.
STRUCTYP = The structure type.  Since IDL does not allow the
           redefinition of a named structure it is an error
           to call MRD_STRUCT with different parameters but
           the same STRUCTYP in the same session.  If this
           keyword is not set an anonymous structure is created.
COMMON BLOCKS
MRD_COMMON
SIDE EFFECTS
May create a temporary file if the structure definition is too long 
for the EXECUTE function and using old style structures
RESTRICTIONS
By default, the program defines the structure in a long string
which is executed with CREATE_STRUCT within a single EXECUTE statement.
If program is being run in the IDL Virtual machine (EXECUTE statement
not allowed), then a separate CREATE_STRUCT statement is called
for each tag.   This mode does not have the full capabilities of the
normal mode, but should be sufficient for use with MRDFITS().
PROCEDURE
A structure definition is created using the parameter values.
MRD_NSTRUCT is called  and generates the structure in pieces using the
execute and create_struct keywords.
EXAMPLES
(1) str = mrd_struct(['fld1', 'fld2'], ['0','dblarr(10,10)'],3)
    print, str(0).fld2(3,3)
Note that "0" is always considered short integer even if the default
integer is set to long.
(2) str = mrd_struct(['a','b','c','d'],['1', '1.', '1.d0', "'1'"],1)
        ; returns a structure with integer, float, double and string
        ; fields.
PROCEDURE CALLS
GETTOK() - needed for virtual machine mode only
MODIFICATION HISTORY
Created by T. McGlynn October, 1994.
Modified by T. McGlynn September, 1995.
   Added capability to create substructures so that structure
   may contain up to 4096 distinct elements.  [This can be
   increased by futher iteration of the process used if needed.]
Removed V4.0 reference to common block  October 1997
Allowed unlimited number of structure elements if the version
is greater than 5.0.  Put back in code to handle prior versions.
The [] will need to be translated back to () for this to
work.  T. McGlynn December 15 1998.
Add MRD_NSTRUCT since IDL has mysterious problems compiling
very large structures.
Removed TEMPDIR and OLD_STRUCT keywords  W. Landsman October 2003   
Alternate pathway without EXECUTE for V6.0 virtual machine, D. Lindler
Removed limit on EXECUTE statement.  W. Landsman  October 2003
Restore EXECUTE limit (sigh...), added NO_EXECUTE keyword
                  W. Landsman July 2004
Fix use of STRUCTYP with /NO_EXECUTE  W. Landsman June 2005
Assume since V6.0 (lmgr function available), remove 131 string length
      limit for execute    W. Landsman Jun 2009 
Restore EXECUTE limit (sigh...)   W. Landsman July 2009 
Make sure "0" is a short integer even with compile_opt idl2  July 2010
Added "0.0", "0.0d", "0u", "0ul", and "0ull" as valid tags
      for /NO_EXECUTE  E. Rykoff May 2012
Fix for create long64 arrays with /no_execute  E. Rykoff Sep 2013