static char *SccsId = "@(#)util.cls 4.3 (TU-Delft) 06/10/92";
/**********************************************************

Name/Version      : sls_mkdb/4.3

Language          : C
Operating system  : UNIX SYSTEM V
Host machine      : HP9000

Author(s)         : A.C. de Graaf
Creation date     : 10-Jul-1986
Modified by       : S. de Graaf
Modification date : 10-Jul-1986


        Delft University of Technology
        Department of Electrical Engineering
        Network Theory Section
        Mekelweg 4 - P.O.Box 5031
        2600 GA DELFT
        The Netherlands

        Phone : 015 - 786234

        COPYRIGHT (C) 1986 , All rights reserved
**********************************************************/
#include "sys_incl.h"

#class
#include "class.h"
#include "mkdbdefs.h"
#include "mkdbincl.h"

Stack * stackcpy(stack)
Stack * stack;
{
    if(stack)
	return (stack -> copy ());
    else
        return ((Stack *) NULL);
}

Stack * xstackcpy(stack)
Stack * stack;
{
    Stack *xs;
    char **px;
    char **xs_base;
    char **xs_limit;

    if(xs = stackcpy(stack))
    {
    	xs_base = xs -> base();
    	xs_limit = xs -> limit();
	for(px = xs_base; px < xs_limit; px++)
	{
	    *px = (char *) new Xelem (((Xelem *) *px) -> left_bound,
				      ((Xelem *) *px) -> right_bound);
	}
    }
    else
        return ((Stack *) NULL);
}

char * strsav(s)
char * s;
{
    char *p;
    p = new char [strlen (s) + 1];
#ifdef DMEM
    char_nbyte += strlen(s) + 1;
    char_maxnbyte = char_nbyte > char_maxnbyte ? char_nbyte : char_maxnbyte;
#endif
    strcpy (p, s);
    return(p);
}

void bmove (to, from, l)
char   *to,
       *from;
int     l;
{
    while (l--)
	*(to++) = *(from++);
}
