Home | History | Annotate | Download | only in units

Lines Matching defs:theunit

262 initializeunit(struct unittype * theunit)
264 theunit->factor = 1.0;
265 theunit->numerator[0] = theunit->denominator[0] = NULL;
285 showunit(struct unittype * theunit)
291 printf("\t%.*g", precision, theunit->factor);
292 for (ptr = theunit->numerator; *ptr; ptr++) {
293 if (ptr > theunit->numerator && **ptr &&
308 for (ptr = theunit->denominator; *ptr; ptr++) {
309 if (ptr > theunit->denominator && **ptr &&
343 addunit(struct unittype * theunit, const char *toadd, int flip)
411 theunit->factor *= num;
413 theunit->factor /= num;
420 theunit->factor /= num;
422 theunit->factor *= num;
436 theunit->factor *= num;
438 theunit->factor /= num;
478 if (addsubunit(flipthis ? theunit->numerator : theunit->denominator, item))
502 sortunit(struct unittype * theunit)
507 for (count = 0, ptr = theunit->numerator; *ptr; ptr++, count++);
508 qsort(theunit->numerator, count, sizeof(char *), compare);
509 for (count = 0, ptr = theunit->denominator; *ptr; ptr++, count++);
510 qsort(theunit->denominator, count, sizeof(char *), compare);
514 cancelunit(struct unittype * theunit)
519 den = theunit->denominator;
520 num = theunit->numerator;
625 reduceproduct(struct unittype * theunit, int flip)
633 product = theunit->denominator;
635 product = theunit->numerator;
654 if (addunit(theunit, toadd, flip))
668 reduceunit(struct unittype * theunit)
674 ret = reduceproduct(theunit, 0) | reduceproduct(theunit, 1);
756 struct unittype theunit;
796 initializeunit(&theunit);
797 if (addunit(&theunit, thedefn, 0) != 0
798 || completereduce(&theunit) != 0) {
806 showunit(&theunit);
826 initializeunit(&theunit);
827 if (addunit(&theunit, thename, 0) != 0
828 || completereduce(&theunit) != 0) {
836 showunit(&theunit);