/*****************************************************************/
/**                                                             **/
/**             (C) Copyright 1992 the Regents of the           **/
/**        University of California.  All Rights Reserved.      **/
/**                                                             **/
/**        This work was produced under the sponsorship of      **/
/**         the U.S. Department of Energy.  The Government      **/
/**                retains certain rights therein.              **/
/**                                                             **/
/**                         Written by                          **/
/**         Distributed Programming Environments Project        **/
/**           Computer Software and Networking Division,        **/
/**                   Livermore Computer Center,                **/
/**            Lawrence Livermore National Laboratory           **/
/**                                                             **/
/*****************************************************************/

#ifndef ARGUMENT_H
#define ARGUMENT_H

static char sccsid_argument_h[] = "@(#)argument.h	1.7 10/19/92 13:33:54 LLNL ";


#include "list.h"
#include "abs.h"


class argument: public link {

   friend class argument_list;
   friend class operation_element;

   char *name;
   type_element *type;
   arg_mode mode;
   char *value_expression;		/* used when generating code */
   char *length_expression1;		/* used when generating code */
   char *length_expression2;		/* used when generating code */
   int list_position;
   char *num_id;
public:

   argument(char *v, char *l1, char *l2);
   argument(char *v, char *l1, char *l2, name_element *n);
   argument(param_element *p);
   argument(param_element *p, argument *a);

   ~argument()
   {}
   inline void set_name(char *n)
   {name = n;}
   inline void set_type(type_element *te)
   {type = te;}
   inline type_element *get_type()
   {return type;}
   inline void set_mode(arg_mode a)
   {mode = a;}
   inline arg_mode get_mode()
   {return mode;}
   inline void set_num_id(char *c)
   {num_id = c;}
   inline char * get_num_id()
   {return num_id;}
   inline void set_list_position(int lp)
   {list_position = lp;}
   inline int get_list_position()
   {return list_position;}

   void gen_sendP(FILE *output_file,
		 char *exception_label);
   void gen_getP(FILE *out, 
		 boolean ellipses, 
		 char *e_label);
};

/*********************************************************/

class argument_list: public list {
   int pos_or_named;
   boolean ellipsed;
   boolean unwrapped_Any_present;

public:
   argument_list();
   argument_list(int p);
   ~argument_list() { }
   inline void set_pos_or_named(int pn)
   { pos_or_named = pn; }
   inline int get_pos_or_named()
   { return pos_or_named; }
   inline void set_ellipsed(boolean e)
   { ellipsed = e; }
   inline boolean get_ellipsed()
   { return ellipsed; }
   inline void set_unwrapped_Any_present(boolean b)
   { unwrapped_Any_present = b; }
   inline boolean get_unwrapped_Any_present()
   { return unwrapped_Any_present; }

   boolean search_name(char *search_key, argument *&target);
};




#endif

