src/cmuBdd/bddblk.c File Reference

#include "bddint.h"
Include dependency graph for bddblk.c:

Go to the source code of this file.

Functions

static void add_block (block b1, block b2)
block cmu_bdd_new_var_block (cmu_bdd_manager bddm, bdd v, long n)

Function Documentation

static void add_block ( block  b1,
block  b2 
) [static]

Definition at line 9 of file bddblk.c.

00010 {
00011   long i, j, k;
00012   block start, end;
00013 
00014   if (b1->num_children)
00015     {
00016       i=bdd_find_block(b1, b2->first_index);
00017       start=b1->children[i];
00018       j=bdd_find_block(b1, b2->last_index);
00019       end=b1->children[j];
00020       if (i == j)
00021         add_block(start, b2);
00022       else
00023         {
00024           if (start->first_index != b2->first_index || end->last_index != b2->last_index)
00025             cmu_bdd_fatal("add_block: illegal block overlap");
00026           b2->num_children=j-i+1;
00027           b2->children=(block *)mem_get_block((SIZE_T)(sizeof(block)*b2->num_children));
00028           for (k=0; k < b2->num_children; ++k)
00029             b2->children[k]=b1->children[i+k];
00030           b1->children[i]=b2;
00031           ++i;
00032           for (k=j+1; k < b1->num_children; ++k, ++i)
00033             b1->children[i]=b1->children[k];
00034           b1->num_children-=(b2->num_children-1);
00035           b1->children=(block *)mem_resize_block((pointer)b1->children, (SIZE_T)(sizeof(block)*b1->num_children));
00036         }
00037     }
00038   else
00039     {
00040       /* b1 and b2 are blocks representing just single variables. */
00041       b1->num_children=1;
00042       b1->children=(block *)mem_get_block((SIZE_T)(sizeof(block)*b1->num_children));
00043       b1->children[0]=b2;
00044       b2->num_children=0;
00045       b2->children=0;
00046     }
00047 }

block cmu_bdd_new_var_block ( cmu_bdd_manager  bddm,
bdd  v,
long  n 
)

Definition at line 51 of file bddblk.c.

00052 {
00053   block b;
00054 
00055   if (bdd_check_arguments(1, v))
00056     {
00057       BDD_SETUP(v);
00058       if (cmu_bdd_type_aux(bddm, v) != BDD_TYPE_POSVAR)
00059         {
00060           cmu_bdd_warning("cmu_bdd_new_var_block: second argument is not a positive variable");
00061           if (BDD_IS_CONST(v))
00062             return ((block)0);
00063         }
00064       b=(block)BDD_NEW_REC(bddm, sizeof(struct block_));
00065       b->reorderable=0;
00066       b->first_index=BDD_INDEX(bddm, v);
00067       if (n <= 0)
00068         {
00069           cmu_bdd_warning("cmu_bdd_new_var_block: invalid final argument");
00070           n=1;
00071         }
00072       b->last_index=b->first_index+n-1;
00073       if (b->last_index >= bddm->vars)
00074         {
00075           cmu_bdd_warning("cmu_bdd_new_var_block: range covers non-existent variables");
00076           b->last_index=bddm->vars-1;
00077         }
00078       add_block(bddm->super_block, b);
00079       return (b);
00080     }
00081   return ((block)0);
00082 }


Generated on Tue Jan 12 13:57:14 2010 for glu-2.2 by  doxygen 1.6.1