/**************************************************************************/
/*                                                                        */
/*                                 Sources                                */
/*                                from  the                               */
/*                           XSC SOFTWARE PACKAGE                         */
/*                                                                        */
/*                Copyright (c) 1997 University of Karlsruhe              */
/*                     Institute for Appl. Mathematics                    */
/*                                                                        */
/* This program is free software for non-commercial use. For details, see */
/* the file LICENSE.XSC, distributed with this software package.          */
/*                                                                        */
/* This program is distributed WITHOUT ANY WARRANTY. For details, see the */
/* file LICENSE.XSC, distributed with this software package.              */
/*                                                                        */
/**************************************************************************/

/* RCS $Id: s_cons.c,v 1.2 1997/09/25 17:57:06 ae59 Exp $ */
/*
$Log: s_cons.c,v $
 * Revision 1.2  1997/09/25  17:57:06  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:24:31  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : s_cons.c                              */
/*                                                              */
/*      Entries         : a_VOID s_cons(s,e_argc,e_args)        */
/*                        s_etof s;                             */
/*                        a_char *e_argc;                       */
/*                        e_list                                */
/*                                                              */
/*      Arguments       : s = set to be constructed             */
/*                        e_argc = control string               */
/*                        e_args = variable length argument list*/
/*                                                              */
/*      Function value  : pointer to result set                 */
/*                                                              */
/*      Description     : Construct set.                        */
/*                        The control string "e_argc" consists  */
/*                        of a sequence of "1" or "2":          */
/*                        "1" : add one element to the set      */
/*                        "2" : add a contiguos range of        */
/*                              elements to the set             */
/*                        The element and the element range     */
/*                        are formed by the sequence of variable*/
/*                        length arguments "e_args".            */
/*                                                              */
/*      Date            : 1991-08-27                            */
/*      1991-08-27 : optize calls to initialization routines    */
/*      1990-11-19 : E_TPUSH+E_TPOPP / (a_VOID) in result       */
/*      1990-07-31 : char replaced by a_char                    */
/****************************************************************/

#ifndef ALL_IN_ONE
#ifdef AIX
#include "/u/p88c/runtime/o_defs.h"
#else
#include "o_defs.h"
#endif
#define local
#endif

#ifdef LINT_ARGS
#if C_P_7
local a_VOID s_cons(s_etof s,a_char *e_argc,...)
#else
local a_VOID s_cons(s,e_argc,e_args)
s_etof s;
a_char *e_argc;
e_list
#endif
#else
local a_VOID s_cons(s,e_argc,e_args)
s_etof s;
a_char *e_argc;
e_list
#endif

        {
        va_list e_argv;
        register a_intg item1,item2;

        E_TPUSH("s_cons")

        e_open(e_argc);

        /* clear set */
        (void)memset(&s[0],0x00,s_SIZE);

        while (*e_argc)
           {
           switch(*e_argc++)
              {
              case '1'  :
                          item1 = e_ref(a_intg);
                          (void)s_ins1(s,item1);
                          break;
              case '2'  :
                          item1 = e_ref(a_intg);
                          item2 = e_ref(a_intg);
                          (void)s_ins2(s,item1,item2);
                          break;
              default   : ;
              }
           }

        e_shut;

        E_TPOPP("s_cons")
        return((a_VOID)&s[0]);
        }
