mirror of https://github.com/YosysHQ/abc.git
Upgrading epd and mtr packages to be compatible with the latest release of CUDD 2.4.2
This commit is contained in:
parent
e881eaf693
commit
e3f2dde1c4
|
|
@ -12,12 +12,39 @@
|
|||
|
||||
Author [In-Ho Moon]
|
||||
|
||||
Copyright [ This file was created at the University of Colorado at
|
||||
Boulder. The University of Colorado at Boulder makes no warranty
|
||||
about the suitability of this software for any purpose. It is
|
||||
presented on an AS IS basis.]
|
||||
Copyright [Copyright (c) 1995-2004, Regents of the University of Colorado
|
||||
|
||||
Revision [$Id: epd.c,v 1.1.1.1 2003/02/24 22:23:57 wjiang Exp $]
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University of Colorado nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.]
|
||||
|
||||
Revision [$Id: epd.c,v 1.10 2004/08/13 18:20:30 fabio Exp $]
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
|
|
@ -25,13 +52,11 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include "util_hack.h"
|
||||
#include "util.h"
|
||||
#include "epd.h"
|
||||
|
||||
ABC_NAMESPACE_IMPL_START
|
||||
|
||||
|
||||
|
||||
/**Function********************************************************************
|
||||
|
||||
Synopsis [Allocates an EpDouble struct.]
|
||||
|
|
@ -44,11 +69,11 @@ ABC_NAMESPACE_IMPL_START
|
|||
|
||||
******************************************************************************/
|
||||
EpDouble *
|
||||
EpdAlloc()
|
||||
EpdAlloc(void)
|
||||
{
|
||||
EpDouble *epd;
|
||||
|
||||
epd = ABC_ALLOC(EpDouble, 1);
|
||||
epd = ALLOC(EpDouble, 1);
|
||||
return(epd);
|
||||
}
|
||||
|
||||
|
|
@ -91,15 +116,15 @@ EpdCmp(const char *key1, const char *key2)
|
|||
void
|
||||
EpdFree(EpDouble *epd)
|
||||
{
|
||||
ABC_FREE(epd);
|
||||
FREE(epd);
|
||||
}
|
||||
|
||||
|
||||
/**Function********************************************************************
|
||||
|
||||
Synopsis [Multiplies two arbitrary precision double values.]
|
||||
Synopsis [Converts an arbitrary precision double value to a string.]
|
||||
|
||||
Description [Multiplies two arbitrary precision double values.]
|
||||
Description [Converts an arbitrary precision double value to a string.]
|
||||
|
||||
SideEffects []
|
||||
|
||||
|
|
@ -1250,12 +1275,13 @@ EpdIsNanOrInf(EpDouble *epd)
|
|||
int
|
||||
IsInfDouble(double value)
|
||||
{
|
||||
IeeeDouble *ptr = (IeeeDouble *)(&value);
|
||||
EpType val;
|
||||
|
||||
if (ptr->exponent == EPD_EXP_INF &&
|
||||
ptr->mantissa0 == 0 &&
|
||||
ptr->mantissa1 == 0) {
|
||||
if (ptr->sign == 0)
|
||||
val.value = value;
|
||||
if (val.bits.exponent == EPD_EXP_INF &&
|
||||
val.bits.mantissa0 == 0 &&
|
||||
val.bits.mantissa1 == 0) {
|
||||
if (val.bits.sign == 0)
|
||||
return(1);
|
||||
else
|
||||
return(-1);
|
||||
|
|
@ -1278,13 +1304,14 @@ IsInfDouble(double value)
|
|||
int
|
||||
IsNanDouble(double value)
|
||||
{
|
||||
IeeeNan *ptr = (IeeeNan *)(&value);
|
||||
|
||||
if (ptr->exponent == EPD_EXP_INF &&
|
||||
ptr->sign == 1 &&
|
||||
ptr->quiet_bit == 1 &&
|
||||
ptr->mantissa0 == 0 &&
|
||||
ptr->mantissa1 == 0) {
|
||||
EpType val;
|
||||
|
||||
val.value = value;
|
||||
if (val.nan.exponent == EPD_EXP_INF &&
|
||||
val.nan.sign == 1 &&
|
||||
val.nan.quiet_bit == 1 &&
|
||||
val.nan.mantissa0 == 0 &&
|
||||
val.nan.mantissa1 == 0) {
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
|
|
@ -1305,15 +1332,16 @@ IsNanDouble(double value)
|
|||
int
|
||||
IsNanOrInfDouble(double value)
|
||||
{
|
||||
IeeeNan *ptr = (IeeeNan *)(&value);
|
||||
EpType val;
|
||||
|
||||
if (ptr->exponent == EPD_EXP_INF &&
|
||||
ptr->mantissa0 == 0 &&
|
||||
ptr->mantissa1 == 0 &&
|
||||
(ptr->sign == 1 || ptr->quiet_bit == 0)) {
|
||||
val.value = value;
|
||||
if (val.nan.exponent == EPD_EXP_INF &&
|
||||
val.nan.mantissa0 == 0 &&
|
||||
val.nan.mantissa1 == 0 &&
|
||||
(val.nan.sign == 1 || val.nan.quiet_bit == 0)) {
|
||||
return(1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
ABC_NAMESPACE_IMPL_END
|
||||
|
||||
ABC_NAMESPACE_IMPL_END
|
||||
|
|
|
|||
|
|
@ -12,22 +12,47 @@
|
|||
|
||||
Author [In-Ho Moon]
|
||||
|
||||
Copyright [This file was created at the University of Colorado at
|
||||
Boulder. The University of Colorado at Boulder makes no warranty
|
||||
about the suitability of this software for any purpose. It is
|
||||
presented on an AS IS basis.]
|
||||
Copyright [Copyright (c) 1995-2004, Regents of the University of Colorado
|
||||
|
||||
Revision [$Id: epd.h,v 1.1.1.1 2003/02/24 22:23:57 wjiang Exp $]
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University of Colorado nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.]
|
||||
|
||||
Revision [$Id: epd.h,v 1.9 2004/08/13 18:20:30 fabio Exp $]
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _EPD
|
||||
#define _EPD
|
||||
|
||||
|
||||
ABC_NAMESPACE_HEADER_START
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Constant declarations */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
@ -101,13 +126,15 @@ struct IeeeNanStruct { /* LITTLE_ENDIAN */
|
|||
SeeAlso []
|
||||
|
||||
******************************************************************************/
|
||||
union EpTypeUnion {
|
||||
double value;
|
||||
struct IeeeDoubleStruct bits;
|
||||
struct IeeeNanStruct nan;
|
||||
};
|
||||
|
||||
struct EpDoubleStruct {
|
||||
union {
|
||||
double value;
|
||||
struct IeeeDoubleStruct bits;
|
||||
struct IeeeNanStruct nan;
|
||||
} type;
|
||||
int exponent;
|
||||
union EpTypeUnion type;
|
||||
int exponent;
|
||||
};
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
@ -116,51 +143,53 @@ struct EpDoubleStruct {
|
|||
typedef struct EpDoubleStruct EpDouble;
|
||||
typedef struct IeeeDoubleStruct IeeeDouble;
|
||||
typedef struct IeeeNanStruct IeeeNan;
|
||||
typedef union EpTypeUnion EpType;
|
||||
|
||||
/**AutomaticStart*************************************************************/
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Function prototypes */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
EpDouble *EpdAlloc();
|
||||
int EpdCmp(const char *key1, const char *key2);
|
||||
void EpdFree(EpDouble *epd);
|
||||
void EpdGetString(EpDouble *epd, char *str);
|
||||
void EpdConvert(double value, EpDouble *epd);
|
||||
void EpdMultiply(EpDouble *epd1, double value);
|
||||
void EpdMultiply2(EpDouble *epd1, EpDouble *epd2);
|
||||
void EpdMultiply2Decimal(EpDouble *epd1, EpDouble *epd2);
|
||||
void EpdMultiply3(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3);
|
||||
void EpdMultiply3Decimal(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3);
|
||||
void EpdDivide(EpDouble *epd1, double value);
|
||||
void EpdDivide2(EpDouble *epd1, EpDouble *epd2);
|
||||
void EpdDivide3(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3);
|
||||
void EpdAdd(EpDouble *epd1, double value);
|
||||
void EpdAdd2(EpDouble *epd1, EpDouble *epd2);
|
||||
void EpdAdd3(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3);
|
||||
void EpdSubtract(EpDouble *epd1, double value);
|
||||
void EpdSubtract2(EpDouble *epd1, EpDouble *epd2);
|
||||
void EpdSubtract3(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3);
|
||||
void EpdPow2(int n, EpDouble *epd);
|
||||
void EpdPow2Decimal(int n, EpDouble *epd);
|
||||
void EpdNormalize(EpDouble *epd);
|
||||
void EpdNormalizeDecimal(EpDouble *epd);
|
||||
void EpdGetValueAndDecimalExponent(EpDouble *epd, double *value, int *exponent);
|
||||
int EpdGetExponent(double value);
|
||||
int EpdGetExponentDecimal(double value);
|
||||
void EpdMakeInf(EpDouble *epd, int sign);
|
||||
void EpdMakeZero(EpDouble *epd, int sign);
|
||||
void EpdMakeNan(EpDouble *epd);
|
||||
void EpdCopy(EpDouble *from, EpDouble *to);
|
||||
int EpdIsInf(EpDouble *epd);
|
||||
int EpdIsZero(EpDouble *epd);
|
||||
int EpdIsNan(EpDouble *epd);
|
||||
int EpdIsNanOrInf(EpDouble *epd);
|
||||
int IsInfDouble(double value);
|
||||
int IsNanDouble(double value);
|
||||
int IsNanOrInfDouble(double value);
|
||||
|
||||
extern EpDouble *EpdAlloc(void);
|
||||
extern int EpdCmp(const char *key1, const char *key2);
|
||||
extern void EpdFree(EpDouble *epd);
|
||||
extern void EpdGetString(EpDouble *epd, char *str);
|
||||
extern void EpdConvert(double value, EpDouble *epd);
|
||||
extern void EpdMultiply(EpDouble *epd1, double value);
|
||||
extern void EpdMultiply2(EpDouble *epd1, EpDouble *epd2);
|
||||
extern void EpdMultiply2Decimal(EpDouble *epd1, EpDouble *epd2);
|
||||
extern void EpdMultiply3(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3);
|
||||
extern void EpdMultiply3Decimal(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3);
|
||||
extern void EpdDivide(EpDouble *epd1, double value);
|
||||
extern void EpdDivide2(EpDouble *epd1, EpDouble *epd2);
|
||||
extern void EpdDivide3(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3);
|
||||
extern void EpdAdd(EpDouble *epd1, double value);
|
||||
extern void EpdAdd2(EpDouble *epd1, EpDouble *epd2);
|
||||
extern void EpdAdd3(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3);
|
||||
extern void EpdSubtract(EpDouble *epd1, double value);
|
||||
extern void EpdSubtract2(EpDouble *epd1, EpDouble *epd2);
|
||||
extern void EpdSubtract3(EpDouble *epd1, EpDouble *epd2, EpDouble *epd3);
|
||||
extern void EpdPow2(int n, EpDouble *epd);
|
||||
extern void EpdPow2Decimal(int n, EpDouble *epd);
|
||||
extern void EpdNormalize(EpDouble *epd);
|
||||
extern void EpdNormalizeDecimal(EpDouble *epd);
|
||||
extern void EpdGetValueAndDecimalExponent(EpDouble *epd, double *value, int *exponent);
|
||||
extern int EpdGetExponent(double value);
|
||||
extern int EpdGetExponentDecimal(double value);
|
||||
extern void EpdMakeInf(EpDouble *epd, int sign);
|
||||
extern void EpdMakeZero(EpDouble *epd, int sign);
|
||||
extern void EpdMakeNan(EpDouble *epd);
|
||||
extern void EpdCopy(EpDouble *from, EpDouble *to);
|
||||
extern int EpdIsInf(EpDouble *epd);
|
||||
extern int EpdIsZero(EpDouble *epd);
|
||||
extern int EpdIsNan(EpDouble *epd);
|
||||
extern int EpdIsNanOrInf(EpDouble *epd);
|
||||
extern int IsInfDouble(double value);
|
||||
extern int IsNanDouble(double value);
|
||||
extern int IsNanOrInfDouble(double value);
|
||||
|
||||
/**AutomaticEnd***************************************************************/
|
||||
|
||||
ABC_NAMESPACE_HEADER_END
|
||||
|
||||
|
|
|
|||
|
|
@ -20,12 +20,39 @@
|
|||
|
||||
Author [Fabio Somenzi]
|
||||
|
||||
Copyright [This file was created at the University of Colorado at
|
||||
Boulder. The University of Colorado at Boulder makes no warranty
|
||||
about the suitability of this software for any purpose. It is
|
||||
presented on an AS IS basis.]
|
||||
Copyright [Copyright (c) 1995-2004, Regents of the University of Colorado
|
||||
|
||||
Revision [$Id: mtr.h,v 1.1.1.1 2003/02/24 22:24:02 wjiang Exp $]
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University of Colorado nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.]
|
||||
|
||||
Revision [$Id: mtr.h,v 1.14 2009/02/20 02:03:47 fabio Exp $]
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
|
|
@ -38,7 +65,6 @@
|
|||
|
||||
ABC_NAMESPACE_HEADER_START
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Constant declarations */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
@ -57,23 +83,6 @@ ABC_NAMESPACE_HEADER_START
|
|||
#define CONST
|
||||
#endif /* !(__STDC__ || __cplusplus) */
|
||||
|
||||
/* These are potential duplicates. */
|
||||
#ifndef EXTERN
|
||||
# ifdef __cplusplus
|
||||
# ifdef ABC_NAMESPACE
|
||||
# define EXTERN extern
|
||||
# else
|
||||
# define EXTERN extern "C"
|
||||
# endif
|
||||
# else
|
||||
# define EXTERN extern
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ARGS
|
||||
#define ARGS(protos) protos
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#define MTR_INLINE __inline__
|
||||
# if (__GNUC__ >2 || __GNUC_MINOR__ >=7)
|
||||
|
|
@ -85,10 +94,10 @@ ABC_NAMESPACE_HEADER_START
|
|||
#define MTR_INLINE
|
||||
#define MTR_UNUSED
|
||||
#endif
|
||||
|
||||
|
||||
/* Flag definitions */
|
||||
#define MTR_DEFAULT 0x00000000
|
||||
#define MTR_TERMINAL 0x00000001
|
||||
#define MTR_TERMINAL 0x00000001
|
||||
#define MTR_SOFT 0x00000002
|
||||
#define MTR_FIXED 0x00000004
|
||||
#define MTR_NEWNODE 0x00000008
|
||||
|
|
@ -152,24 +161,24 @@ typedef struct MtrNode {
|
|||
/* Function prototypes */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
EXTERN MtrNode * Mtr_AllocNode ARGS(());
|
||||
EXTERN void Mtr_DeallocNode ARGS((MtrNode *node));
|
||||
EXTERN MtrNode * Mtr_InitTree ARGS(());
|
||||
EXTERN void Mtr_FreeTree ARGS((MtrNode *node));
|
||||
EXTERN MtrNode * Mtr_CopyTree ARGS((MtrNode *node, int expansion));
|
||||
EXTERN void Mtr_MakeFirstChild ARGS((MtrNode *parent, MtrNode *child));
|
||||
EXTERN void Mtr_MakeLastChild ARGS((MtrNode *parent, MtrNode *child));
|
||||
EXTERN MtrNode * Mtr_CreateFirstChild ARGS((MtrNode *parent));
|
||||
EXTERN MtrNode * Mtr_CreateLastChild ARGS((MtrNode *parent));
|
||||
EXTERN void Mtr_MakeNextSibling ARGS((MtrNode *first, MtrNode *second));
|
||||
EXTERN void Mtr_PrintTree ARGS((MtrNode *node));
|
||||
EXTERN MtrNode * Mtr_InitGroupTree ARGS((int lower, int size));
|
||||
EXTERN MtrNode * Mtr_MakeGroup ARGS((MtrNode *root, unsigned int low, unsigned int high, unsigned int flags));
|
||||
EXTERN MtrNode * Mtr_DissolveGroup ARGS((MtrNode *group));
|
||||
EXTERN MtrNode * Mtr_FindGroup ARGS((MtrNode *root, unsigned int low, unsigned int high));
|
||||
EXTERN int Mtr_SwapGroups ARGS((MtrNode *first, MtrNode *second));
|
||||
EXTERN void Mtr_PrintGroups ARGS((MtrNode *root, int silent));
|
||||
EXTERN MtrNode * Mtr_ReadGroups ARGS((FILE *fp, int nleaves));
|
||||
extern MtrNode * Mtr_AllocNode (void);
|
||||
extern void Mtr_DeallocNode (MtrNode *node);
|
||||
extern MtrNode * Mtr_InitTree (void);
|
||||
extern void Mtr_FreeTree (MtrNode *node);
|
||||
extern MtrNode * Mtr_CopyTree (MtrNode *node, int expansion);
|
||||
extern void Mtr_MakeFirstChild (MtrNode *parent, MtrNode *child);
|
||||
extern void Mtr_MakeLastChild (MtrNode *parent, MtrNode *child);
|
||||
extern MtrNode * Mtr_CreateFirstChild (MtrNode *parent);
|
||||
extern MtrNode * Mtr_CreateLastChild (MtrNode *parent);
|
||||
extern void Mtr_MakeNextSibling (MtrNode *first, MtrNode *second);
|
||||
extern void Mtr_PrintTree (MtrNode *node);
|
||||
extern MtrNode * Mtr_InitGroupTree (int lower, int size);
|
||||
extern MtrNode * Mtr_MakeGroup (MtrNode *root, unsigned int low, unsigned int high, unsigned int flags);
|
||||
extern MtrNode * Mtr_DissolveGroup (MtrNode *group);
|
||||
extern MtrNode * Mtr_FindGroup (MtrNode *root, unsigned int low, unsigned int high);
|
||||
extern int Mtr_SwapGroups (MtrNode *first, MtrNode *second);
|
||||
extern void Mtr_PrintGroups (MtrNode *root, int silent);
|
||||
extern MtrNode * Mtr_ReadGroups (FILE *fp, int nleaves);
|
||||
|
||||
/**AutomaticEnd***************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -26,20 +26,45 @@
|
|||
|
||||
Author [Fabio Somenzi]
|
||||
|
||||
Copyright [This file was created at the University of Colorado at
|
||||
Boulder. The University of Colorado at Boulder makes no warranty
|
||||
about the suitability of this software for any purpose. It is
|
||||
presented on an AS IS basis.]
|
||||
Copyright [Copyright (c) 1995-2004, Regents of the University of Colorado
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University of Colorado nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.]
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include "util_hack.h"
|
||||
#include "util.h"
|
||||
#include "mtrInt.h"
|
||||
|
||||
ABC_NAMESPACE_IMPL_START
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Constant declarations */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
@ -57,7 +82,7 @@ ABC_NAMESPACE_IMPL_START
|
|||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] MTR_UNUSED = "$Id: mtrBasic.c,v 1.1.1.1 2003/02/24 22:24:02 wjiang Exp $";
|
||||
static char rcsid[] MTR_UNUSED = "$Id: mtrBasic.c,v 1.13 2009/02/20 02:03:47 fabio Exp $";
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
@ -90,12 +115,11 @@ static char rcsid[] MTR_UNUSED = "$Id: mtrBasic.c,v 1.1.1.1 2003/02/24 22:24:02
|
|||
|
||||
******************************************************************************/
|
||||
MtrNode *
|
||||
Mtr_AllocNode(
|
||||
)
|
||||
Mtr_AllocNode(void)
|
||||
{
|
||||
MtrNode *node;
|
||||
|
||||
node = ABC_ALLOC(MtrNode,1);
|
||||
node = ALLOC(MtrNode,1);
|
||||
return node;
|
||||
|
||||
} /* Mtr_AllocNode */
|
||||
|
|
@ -116,7 +140,7 @@ void
|
|||
Mtr_DeallocNode(
|
||||
MtrNode * node /* node to be deallocated */)
|
||||
{
|
||||
ABC_FREE(node);
|
||||
FREE(node);
|
||||
return;
|
||||
|
||||
} /* end of Mtr_DeallocNode */
|
||||
|
|
@ -134,8 +158,7 @@ Mtr_DeallocNode(
|
|||
|
||||
******************************************************************************/
|
||||
MtrNode *
|
||||
Mtr_InitTree(
|
||||
)
|
||||
Mtr_InitTree(void)
|
||||
{
|
||||
MtrNode *node;
|
||||
|
||||
|
|
@ -227,7 +250,7 @@ Mtr_CopyTree(
|
|||
}
|
||||
}
|
||||
return(copy);
|
||||
|
||||
|
||||
} /* end of Mtr_CopyTree */
|
||||
|
||||
|
||||
|
|
@ -403,12 +426,12 @@ Mtr_PrintTree(
|
|||
if (node == NULL) return;
|
||||
(void) fprintf(stdout,
|
||||
#if SIZEOF_VOID_P == 8
|
||||
"N=0x%-8lx C=0x%-8lx Y=0x%-8lx E=0x%-8lx P=0x%-8lx F=%x L=%d S=%d\n",
|
||||
"N=0x%-8lx C=0x%-8lx Y=0x%-8lx E=0x%-8lx P=0x%-8lx F=%x L=%u S=%u\n",
|
||||
(unsigned long) node, (unsigned long) node->child,
|
||||
(unsigned long) node->younger, (unsigned long) node->elder,
|
||||
(unsigned long) node->parent, node->flags, node->low, node->size);
|
||||
#else
|
||||
"N=0x%-8x C=0x%-8x Y=0x%-8x E=0x%-8x P=0x%-8x F=%x L=%d S=%d\n",
|
||||
"N=0x%-8x C=0x%-8x Y=0x%-8x E=0x%-8x P=0x%-8x F=%x L=%hu S=%hu\n",
|
||||
(unsigned) node, (unsigned) node->child,
|
||||
(unsigned) node->younger, (unsigned) node->elder,
|
||||
(unsigned) node->parent, node->flags, node->low, node->size);
|
||||
|
|
@ -428,4 +451,3 @@ Mtr_PrintTree(
|
|||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
ABC_NAMESPACE_IMPL_END
|
||||
|
||||
|
|
|
|||
|
|
@ -26,19 +26,45 @@
|
|||
|
||||
Author [Fabio Somenzi]
|
||||
|
||||
Copyright [This file was created at the University of Colorado at
|
||||
Boulder. The University of Colorado at Boulder makes no warranty
|
||||
about the suitability of this software for any purpose. It is
|
||||
presented on an AS IS basis.]
|
||||
Copyright [Copyright (c) 1995-2004, Regents of the University of Colorado
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University of Colorado nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.]
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#include "util_hack.h"
|
||||
#include "util.h"
|
||||
#include "mtrInt.h"
|
||||
|
||||
ABC_NAMESPACE_IMPL_START
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Constant declarations */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
@ -56,7 +82,7 @@ ABC_NAMESPACE_IMPL_START
|
|||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] MTR_UNUSED = "$Id: mtrGroup.c,v 1.1.1.1 2003/02/24 22:24:02 wjiang Exp $";
|
||||
static char rcsid[] MTR_UNUSED = "$Id: mtrGroup.c,v 1.18 2009/02/20 02:03:47 fabio Exp $";
|
||||
#endif
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
@ -69,7 +95,7 @@ static char rcsid[] MTR_UNUSED = "$Id: mtrGroup.c,v 1.1.1.1 2003/02/24 22:24:02
|
|||
/* Static function prototypes */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
static int mtrShiftHL ARGS((MtrNode *node, int shift));
|
||||
static int mtrShiftHL (MtrNode *node, int shift);
|
||||
|
||||
/**AutomaticEnd***************************************************************/
|
||||
|
||||
|
|
@ -517,7 +543,11 @@ Mtr_PrintGroups(
|
|||
assert(root != NULL);
|
||||
assert(root->younger == NULL || root->younger->elder == root);
|
||||
assert(root->elder == NULL || root->elder->younger == root);
|
||||
if (!silent) (void) printf("(%d",root->low);
|
||||
#if SIZEOF_VOID_P == 8
|
||||
if (!silent) (void) printf("(%u",root->low);
|
||||
#else
|
||||
if (!silent) (void) printf("(%hu",root->low);
|
||||
#endif
|
||||
if (MTR_TEST(root,MTR_TERMINAL) || root->child == NULL) {
|
||||
if (!silent) (void) printf(",");
|
||||
} else {
|
||||
|
|
@ -530,7 +560,11 @@ Mtr_PrintGroups(
|
|||
}
|
||||
}
|
||||
if (!silent) {
|
||||
(void) printf("%d", root->low + root->size - 1);
|
||||
#if SIZEOF_VOID_P == 8
|
||||
(void) printf("%u", root->low + root->size - 1);
|
||||
#else
|
||||
(void) printf("%hu", root->low + root->size - 1);
|
||||
#endif
|
||||
if (root->flags != MTR_DEFAULT) {
|
||||
(void) printf("|");
|
||||
if (MTR_TEST(root,MTR_FIXED)) (void) printf("F");
|
||||
|
|
@ -596,12 +630,15 @@ Mtr_ReadGroups(
|
|||
if (err == EOF) {
|
||||
break;
|
||||
} else if (err != 3) {
|
||||
Mtr_FreeTree(root);
|
||||
return(NULL);
|
||||
} else if (low < 0 || low+size > nleaves || size < 1) {
|
||||
Mtr_FreeTree(root);
|
||||
return(NULL);
|
||||
} else if (strlen(attrib) > 8 * sizeof(MtrHalfWord)) {
|
||||
/* Not enough bits in the flags word to store these many
|
||||
** attributes. */
|
||||
Mtr_FreeTree(root);
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
|
|
@ -631,7 +668,10 @@ Mtr_ReadGroups(
|
|||
}
|
||||
node = Mtr_MakeGroup(root, (MtrHalfWord) low, (MtrHalfWord) size,
|
||||
flags);
|
||||
if (node == NULL) return(NULL);
|
||||
if (node == NULL) {
|
||||
Mtr_FreeTree(root);
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return(root);
|
||||
|
|
@ -692,4 +732,3 @@ mtrShiftHL(
|
|||
} /* end of mtrShiftHL */
|
||||
|
||||
ABC_NAMESPACE_IMPL_END
|
||||
|
||||
|
|
|
|||
|
|
@ -12,28 +12,52 @@
|
|||
|
||||
Author [Fabio Somenzi]
|
||||
|
||||
Copyright [This file was created at the University of Colorado at
|
||||
Boulder. The University of Colorado at Boulder makes no warranty
|
||||
about the suitability of this software for any purpose. It is
|
||||
presented on an AS IS basis.]
|
||||
Copyright [Copyright (c) 1995-2004, Regents of the University of Colorado
|
||||
|
||||
Revision [$Id: mtrInt.h,v 1.1.1.1 2003/02/24 22:24:02 wjiang Exp $]
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
|
||||
Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
Neither the name of the University of Colorado nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGE.]
|
||||
|
||||
Revision [$Id: mtrInt.h,v 1.2 2004/08/13 18:15:12 fabio Exp $]
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _MTRINT
|
||||
#define _MTRINT
|
||||
|
||||
|
||||
#include "mtr.h"
|
||||
|
||||
ABC_NAMESPACE_HEADER_START
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Nested includes */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
ABC_NAMESPACE_HEADER_START
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Constant declarations */
|
||||
|
|
@ -63,11 +87,8 @@ ABC_NAMESPACE_HEADER_START
|
|||
/* Function prototypes */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
ABC_NAMESPACE_HEADER_END
|
||||
|
||||
/**AutomaticEnd***************************************************************/
|
||||
|
||||
|
||||
|
||||
ABC_NAMESPACE_HEADER_END
|
||||
|
||||
#endif /* _MTRINT */
|
||||
|
|
|
|||
Loading…
Reference in New Issue