Diff for /capa/capa51/pProj/capaUnit.c between versions 1.1 and 1.2

version 1.1, 1999/09/28 21:26:21 version 1.2, 2000/02/09 22:10:24
Line 856  u_copy_unit(Unit_t *a_p, Unit_t *b_p, do Line 856  u_copy_unit(Unit_t *a_p, Unit_t *b_p, do
     a_p->u_scale = a_p->u_scale * scale;      a_p->u_scale = a_p->u_scale * scale;
     /* printf("Found scale=%g=%g\n",a_p->u_scale,b_p->u_scale); */      /* printf("Found scale=%g=%g\n",a_p->u_scale,b_p->u_scale); */
   } else {      } else {  
     if( b_p->u_type == U_BASE || b_p->u_type == U_DERIVED) {      if( b_p->u_type == U_BASE ) { 
       /* *b_p is a base unit, so create a one element unit */        /* *b_p is a base unit, so create a one element unit */
       ne_p = (Unit_E *) capa_malloc(1, sizeof(Unit_E));   /* *** */        ne_p = (Unit_E *) capa_malloc(1, sizeof(Unit_E));   /* *** */
       ne_p->ue_scale = b_p->u_scale;        ne_p->ue_scale = b_p->u_scale;
Line 870  u_copy_unit(Unit_t *a_p, Unit_t *b_p, do Line 870  u_copy_unit(Unit_t *a_p, Unit_t *b_p, do
       }        }
       last_p = ne_p;        last_p = ne_p;
       a_p->u_count++;        a_p->u_count++;
       } else if( b_p->u_type == U_DERIVED) {
         /* derived units but without any units elements (scalar) */
         /* do nothing, ignore this units  */
     } else if( b_p->u_type == U_CONSTANT ) {      } else if( b_p->u_type == U_CONSTANT ) {
       scale = pow(b_p->u_scale, exp_scale);        scale = pow(b_p->u_scale, exp_scale);
       a_p->u_scale = a_p->u_scale * scale;        a_p->u_scale = a_p->u_scale * scale;
Line 1363  u_insert_derived(n_p,s_p,c_p,u_p)char  * Line 1366  u_insert_derived(n_p,s_p,c_p,u_p)char  *
   strcpy(new_p->u_comment,c_p);    strcpy(new_p->u_comment,c_p);
       
   simplify_unit(new_p);    simplify_unit(new_p);
       /*
   /* print_unit_t(new_p); */    printf("Derived Unit:%s\n",new_p->u_name);
       print_unit_t(new_p); 
     */
   if (c_result < 0 ) {    if (c_result < 0 ) {
     new_p->u_left = t->u_left; new_p->u_right = t;      new_p->u_left = t->u_left; new_p->u_right = t;
     t->u_left = NULL;      t->u_left = NULL;
Line 1411  simplify_unit(u_p) Unit_t *u_p; Line 1415  simplify_unit(u_p) Unit_t *u_p;
     CScale[ii] = 0.0;      CScale[ii] = 0.0;
     CExp[ii] = 0.0;      CExp[ii] = 0.0;
   }    }
     /*
     printf("Before Simplify:: \n");
     print_unit_t(u_p);
     */
   if( u_p->u_count > 0 ) {    if( u_p->u_count > 0 ) {
           
     for(eu_p=u_p->u_list; eu_p; eu_p = eu_p->ue_nextp) {      for(eu_p=u_p->u_list; eu_p; eu_p = eu_p->ue_nextp) {
Line 1422  simplify_unit(u_p) Unit_t *u_p; Line 1430  simplify_unit(u_p) Unit_t *u_p;
       CScale[idx] = CScale[idx] * eu_p->ue_scale;        CScale[idx] = CScale[idx] * eu_p->ue_scale;
       CExp[idx] = CExp[idx] + eu_p->ue_exp;        CExp[idx] = CExp[idx] + eu_p->ue_exp;
     }      }
     /*      /* debugging 
     for(ii=0;ii<BaseUnitcnt;ii++) {      for(ii=0;ii<BaseUnitcnt;ii++) {
       if( CScale[ii] != 0.0 ) {        if( CScale[ii] != 0.0 ) {
         printf("(%d)%s,S=%g,E=%g\n",ii,CSymb[ii],CScale[ii], CExp[ii]);          printf("(%d)%s,S=%g,E=%g\n",ii,CSymb[ii],CScale[ii], CExp[ii]);
       }        }
         if( CExp[ii] == 0.0 ) {
           printf("(%d)%s,S=%g,Exp=%g\n",ii,CSymb[ii],CScale[ii], CExp[ii]);
         }
     }      }
     */      */
     freelist_unit_e(u_p->u_list);      freelist_unit_e(u_p->u_list);
Line 1448  simplify_unit(u_p) Unit_t *u_p; Line 1459  simplify_unit(u_p) Unit_t *u_p;
         u_p->u_count++;          u_p->u_count++;
       }        }
     }      }
       
       
   }    }
       /* 
     printf("After Simplify:: \n");
     print_unit_t(u_p);
     */
 }  }
   
 /* before comparing two units, make sure they are of  basic form */  /* before comparing two units, make sure they are of  basic form */

Removed from v.1.1  
changed lines
  Added in v.1.2


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>