/**************************************************************************/
/*                                                                        */
/*                                 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: y_inid.c,v 1.2 1997/09/25 18:25:20 ae59 Exp $ */
/*
$Log: y_inid.c,v $
 * Revision 1.2  1997/09/25  18:25:20  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:25:55  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : y_inid.c                              */
/*                                                              */
/*      Entry           : void y_inid(d,dim,elsize)             */
/*                        y_dscp d;                             */
/*                        a_byte dim;                           */
/*                        size_t elsize;                        */
/*                                                              */
/*      Arguments       : d - descriptor of dynamic array       */
/*                        dim - dimension of dynamic array      */
/*                        elsize - size of an element in bytes  */
/*                                                              */
/*      Description     : initialization of a dynamic array     */
/*                        same as y _init but no allocation     */
/*                        'array' should have been allocated    */
/*                        elnum =0, strid init 1,0,1,0 ....     */
/*                                                              */
/*      Date            : 1993-01-19                            */
/*      1993-01-19 : new function                               */
/****************************************************************/

#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
local void y_inid(y_dscp d,a_byte dim,size_t elsize)
#else
local void y_inid(d,dim,elsize)

y_dscp d;
a_byte dim;
size_t elsize;
#endif
{
        int i;  /* !!! must be int !!! */

        E_TPUSH("y_inid")

        ((y_dscp)d)->subarr = ((y_dscp)d)->destroy = FALSE;
        ((y_dscp)d)->elsize = elsize;
        ((y_dscp)d)->numdim = dim;
        ((y_dscp)d)->elnum  = 0;
        ((y_dscp)d)->fd[dim-1].stride = 1;
        ((y_dscp)d)->array  = NULL;
        for (i=dim-2;i>=0;i--)
        {
           ((y_dscp)d)->fd[i].stride = (((y_dscp)d)->fd[i+1].ubound-
                                        ((y_dscp)d)->fd[i+1].lbound+1)*
                                        ((y_dscp)d)->fd[i+1].stride;
        }
        E_TPOPP("y_inid")
        return;
}
