summaryrefslogtreecommitdiffstats
path: root/src/bdd/mtr
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2011-03-02 18:50:03 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2011-03-02 18:50:03 -0800
commite3f2dde1c4eeaa8c891ecb7a1f07dab324ce1da3 (patch)
treea293c8ca5981e69f09400b05d50957b844355a9d /src/bdd/mtr
parente881eaf693ff648d78c7b6ca52fc156f0993143e (diff)
downloadabc-e3f2dde1c4eeaa8c891ecb7a1f07dab324ce1da3.tar.gz
abc-e3f2dde1c4eeaa8c891ecb7a1f07dab324ce1da3.tar.bz2
abc-e3f2dde1c4eeaa8c891ecb7a1f07dab324ce1da3.zip
Upgrading epd and mtr packages to be compatible with the latest release of CUDD 2.4.2
Diffstat (limited to 'src/bdd/mtr')
-rw-r--r--src/bdd/mtr/mtr.h95
-rw-r--r--src/bdd/mtr/mtrBasic.c58
-rw-r--r--src/bdd/mtr/mtrGroup.c63
-rw-r--r--src/bdd/mtr/mtrInt.h47
4 files changed, 177 insertions, 86 deletions
diff --git a/src/bdd/mtr/mtr.h b/src/bdd/mtr/mtr.h
index 189ac1be..d3b703b8 100644
--- a/src/bdd/mtr/mtr.h
+++ b/src/bdd/mtr/mtr.h
@@ -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***************************************************************/
diff --git a/src/bdd/mtr/mtrBasic.c b/src/bdd/mtr/mtrBasic.c
index 56c78a23..e06317d5 100644
--- a/src/bdd/mtr/mtrBasic.c
+++ b/src/bdd/mtr/mtrBasic.c
@@ -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
-
diff --git a/src/bdd/mtr/mtrGroup.c b/src/bdd/mtr/mtrGroup.c
index 176643f4..afc7bfdf 100644
--- a/src/bdd/mtr/mtrGroup.c
+++ b/src/bdd/mtr/mtrGroup.c
@@ -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
-
diff --git a/src/bdd/mtr/mtrInt.h b/src/bdd/mtr/mtrInt.h
index 2a470411..9c8c6e26 100644
--- a/src/bdd/mtr/mtrInt.h
+++ b/src/bdd/mtr/mtrInt.h
@@ -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 */