Skip to content

Commit

Permalink
Release, and script bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
asminer committed Nov 11, 2024
1 parent c58b70f commit d7a57d5
Show file tree
Hide file tree
Showing 3 changed files with 214 additions and 2 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## AC_PREREQ(2.60)
AC_PREREQ(2.59)
AC_INIT(MEDDLY, 0.17.6, [asminer@iastate.edu], meddly, [https://asminer.github.io/meddly/])
AC_INIT(MEDDLY, 0.17.7, [asminer@iastate.edu], meddly, [https://asminer.github.io/meddly/])
AM_INIT_AUTOMAKE([-Wall foreign parallel-tests color-tests subdir-objects])
# Allow silent builds, and make it the default, if we can:
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
Expand Down
2 changes: 1 addition & 1 deletion developers/Release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ update_defines()
local ddate=`date +"%m/%d/%Y"`
local versid=`tr '.' '_' <<< "$1"`
mv -f ../$DEFFILE ../$DEFFILE.old
sed "1,/=======/s/$versid.*/$versid \"$ddate\"/" ../$DEFFILE.old > ../$DEFFILE
sed "1,/=======/s|$versid.*|$versid \"$ddate\"|" ../$DEFFILE.old > ../$DEFFILE
git add ../$DEFFILE
}

Expand Down
212 changes: 212 additions & 0 deletions src/defines.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
/*
Meddly: Multi-terminal and Edge-valued Decision Diagram LibrarY.
Copyright (C) 2009, Iowa State University Research Foundation, Inc.
This library is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this library. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef MEDDLY_DEFINES_H
#define MEDDLY_DEFINES_H

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

// #define ALLOW_DEPRECATED_0_17_2 "11/11/2023"
// #define ALLOW_DEPRECATED_0_17_3 "12/03/2023"
// #define ALLOW_DEPRECATED_0_17_4 "12/19/2023"
// #define ALLOW_DEPRECATED_0_17_5 "04/05/2024"
#define ALLOW_DEPRECATED_0_17_6 "11/11/2024"
#define ALLOW_DEPRECATED_0_17_7

// ==================================================================
// ^ This line is important for the release script, don't remove it


#define REFCOUNTS_ON

// #define DEBUG_CLEANUP
// #define DEBUG_SLOW
// #define TRACE_ALL_OPS
// #define DEBUG_READ_DD

// Turn off extensible nodes for now
// #define ALLOW_EXTENSIBLE

#include <limits>

// Handy Constants

namespace MEDDLY {
// const int INF = std::numeric_limits<int>::max();
// const float NAN = std::numeric_limits<float>::quiet_NaN();
template<typename T>
inline T Inf() { return std::numeric_limits<T>::max(); }
inline float Nan() { return std::numeric_limits<float>::quiet_NaN(); }
// inline bool isNan(float t) { return t == Nan(); }
// inline bool isNan(int t) { return false; }

// Handy Macros

/// Standard MAX "macro".
template <class T> inline T MAX(T X,T Y) { return ((X>Y)?X:Y); }
/// Standard MIN "macro".
template <class T> inline T MIN(T X,T Y) { return ((X<Y)?X:Y); }
/// Standard ABS "macro".
template <class T> inline T ABS(T X) { return ((X<0)?(-X):(X)); }
/// SWAP "macro".
template <class T> inline void SWAP(T &x, T &y) { T tmp=x; x=y; y=tmp; }
/// POSITIVE "macro".
template <class T> inline bool POSITIVE(T X) { return (X>0) ? true : false; }

/// Update a maximum
template <class T> inline void UPDATEMAX(T &X, T Y) { if (Y > X) X = Y; }

// Number of digits
template <class T>
inline unsigned digits(T a) {
unsigned d;
for (d=1; a; d++) { a /= 10; }
return d;
}

/// Get the "top level" of an operation. Works for primed & unprimed.
inline int topLevel(int k1, int k2) {
if (ABS(k1) > ABS(k2)) return k1;
if (ABS(k2) > ABS(k1)) return k2;
return MAX(k1, k2);
}

/// Determine if level k1 is above k2. Works for primed & unprimed.
inline bool isLevelAbove(int k1, int k2) {
if (ABS(k1) > ABS(k2)) return true;
if (ABS(k2) > ABS(k1)) return false;
return k1 > k2;
}

}

/*
There are now two modes of code generation:
"DEVELOPMENT_CODE" and "RELEASE_CODE".
If "DEVELOPMENT_CODE" is defined (usually done in the makefile) then
debugging macros and assertions will be turned on. Otherwise we assume
that we have "RELEASE_CODE" and they are turned off.
Macros useful for debugging "development code" that are turned off
for release code (for speed):
MEDDLY_DCASSERT()
MEDDLY_CHECK_RANGE(low, x, high+1)
*/

#ifdef DEBUG_PRINTS_ON
#define DEBUG_HASH_H
#define DEBUG_HASH_EXPAND_H
#define DEBUG_MDD_HASH_H
#define DEBUG_MDD_HASH_EXPAND_H
#define TRACE_REDUCE
#define MEMORY_TRACE
#endif

// Safe typecasting for development code; fast casting otherwise

#ifdef DEVELOPMENT_CODE
#define smart_cast dynamic_cast
#else
#define smart_cast static_cast
#endif


// Flags for development version only. Significant reduction in performance.
#ifdef DEVELOPMENT_CODE
#define RANGE_CHECK_ON
#define DCASSERTS_ON
#endif

// #define TRACK_DELETIONS
// #define TRACK_CACHECOUNT
// #define TRACK_UNREACHABLE_NODES


// Use this for assertions that will fail only when your
// code is wrong. Handy for debugging.
#ifdef DCASSERTS_ON
#include <cassert>
#define MEDDLY_DCASSERT(X) assert(X)
#else
#define MEDDLY_DCASSERT(X)
#endif

// Use this for range checking assertions that should succeed.
#ifdef RANGE_CHECK_ON
#include <cassert>
#include <iostream>
#endif
namespace MEDDLY {
template <class INT>
inline void CHECK_RANGE(const char* fn, unsigned ln,
INT min, INT value, INT max)
{
#ifdef RANGE_CHECK_ON
if (value < min || value >= max ) {
std::cerr << "Check range at " << fn << " line " << ln;
std::cerr << " failed:\n min: " << min;
std::cerr << "\n val: " << value;
std::cerr << "\n max: " << max << '\n';
assert(false);
}
#endif
}
}


//
// Typedefs and constants
//

namespace MEDDLY {

/** Handles for nodes.
This should be either int or long, and effectively limits
the number of possible nodes per forest.
As an int, we get 2^32-1 possible nodes per forest,
which should be enough for most applications.
As a long on a 64-bit machine, we get 2^64-1 possible nodes
per forest, at the expense of nearly doubling the memory used.
This also specifies the incoming count range for each node.
*/
typedef int node_handle;

/** Handles for relation nodes.
TBD: can we just use node_handle everywhere?
*/
typedef int rel_node_handle;

/** Node addresses.
This is used for internal storage of a node,
and should probably not be changed.
The typedef is given simply to clarify the code
(hopefully :^)
*/
typedef unsigned long node_address;

};


#endif // #include guard

0 comments on commit d7a57d5

Please sign in to comment.