X-Git-Url: http://andersk.mit.edu/gitweb/splint.git/blobdiff_plain/c09ebffeb5fc8d2c644fa818f3510a6300340725..ae13359213220016611ceaf93109dac6849be88b:/src/constraintList.c diff --git a/src/constraintList.c b/src/constraintList.c index 985e2c1..c834ec6 100644 --- a/src/constraintList.c +++ b/src/constraintList.c @@ -92,11 +92,14 @@ constraintList_add (/*@returned@*/ constraintList s, /*@only@*/ constraint el) /*drl7x */ - if (constraintList_resolve (el, s) ) + if (constraintList_resolve (el, s)) { + DPRINTF (("Resolved constraint: %s", constraint_unparse (el))); constraint_free (el); return s; } + + DPRINTF (("Adding constraint: %s", constraint_unparse (el))); if (s->nspace <= 0) constraintList_grow (s); @@ -126,15 +129,15 @@ static void constraintList_freeShallow (/*@only@*/ constraintList c) /*@only@*/ constraintList constraintList_addList (/*@only@*/ /*@returned@*/ constraintList s, /*@observer@*/ /*@temp@*/ constraintList newList) { - llassert(constraintList_isDefined(s) ); - llassert(constraintList_isDefined(newList) ); + llassert(constraintList_isDefined (s)); + llassert(constraintList_isDefined (newList)); if (newList == constraintList_undefined) return s; constraintList_elements (newList, elem) { - s = constraintList_add (s, constraint_copy(elem) ); + s = constraintList_add (s, constraint_copy(elem)); } end_constraintList_elements; @@ -632,6 +635,38 @@ void constraintList_dump (/*@observer@*/ constraintList c, FILE *f) end_constraintList_elements; ; } +//! don't use this! +void constraintList_castConstraints (constraintList c, ctype tfrom, ctype tto) +{ + if (TRUE) /* flag to allow casting */ + { + int fsize = ctype_getSize (tfrom); + int tsize = ctype_getSize (tto); + + DPRINTF (("Sizes: [%s] [%s] %d / %d", ctype_unparse (tfrom), + ctype_unparse (tto), fsize, tsize)); + + if (fsize == tsize) + { + return; /* Sizes match, no change to constraints */ + } + else + { + float scale = fsize / tsize; + + DPRINTF (("Scaling constraints by: %f", scale)); + + constraintList_elements (c, el) + { + DPRINTF (("Scale: %s", constraint_unparse (el))); + // constraint_scaleSize (el, scale); + DPRINTF ((" ==> %s", constraint_unparse (el))); + } + end_constraintList_elements; + } + } +} + constraintList constraintList_sort (/*@returned@*/ constraintList ret) {